-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix column update problem #1951
- Loading branch information
Showing
10 changed files
with
170 additions
and
54 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@visactor/vtable/fix-column-update_2024-06-20-11-59.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@visactor/vtable", | ||
"comment": "fix: fix column update problem #1951", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@visactor/vtable" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* eslint-disable */ | ||
import * as VTable from '../../src'; | ||
import VChart from '@visactor/vchart'; | ||
import { bindDebugTool } from '../../src/scenegraph/debug-tool'; | ||
|
||
const CONTAINER_ID = 'vTable'; | ||
VTable.register.chartModule('vchart', VChart); | ||
|
||
function createColumn(col: number) { | ||
const arr: any[] = []; | ||
for (let i = 0; i < col; i++) { | ||
const obj = { | ||
title: i, | ||
field: i | ||
// width: "auto", | ||
}; | ||
arr.push(obj); | ||
} | ||
return arr; | ||
} | ||
|
||
function createRecords(col: number, row: number) { | ||
const arr: any[] = []; | ||
for (let i = 0; i < row; i++) { | ||
const obj = {}; | ||
for (let j = 0; j < col; j++) { | ||
obj[j] = `c${j}r${i}`; | ||
} | ||
arr.push(obj); | ||
} | ||
return arr; | ||
} | ||
|
||
export function createTable() { | ||
const records = createRecords(500, 500); | ||
const columns = createColumn(500); | ||
|
||
const option = { | ||
records, | ||
columns, | ||
// 表格列宽度的计算模式,可以是 'standard'(标准模式)、'adaptive'(自适应容器宽度模式)或 'autoWidth'(自动宽度模式),默认为 'standard'。 | ||
widthMode: 'autoWidth', | ||
heightMode: 'autoHeight', | ||
defaultColWidth: 120 | ||
// 冻结列数 | ||
// frozenColCount: 3, | ||
}; | ||
|
||
// document.getElementById(CONTAINER_ID).parentElement.style.display = 'none'; | ||
const instance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option); | ||
window.tableInstance = instance; | ||
|
||
// tableInstance.onVChartEvent('mouseover', args => { | ||
// console.log('listenChart mouseover', args); | ||
// }); | ||
|
||
bindDebugTool(tableInstance.scenegraph.stage, { | ||
customGrapicKeys: ['col', 'row'] | ||
}); | ||
|
||
window.update = () => { | ||
(option.rowTree = [ | ||
{ | ||
dimensionKey: '20001', | ||
value: '销售额' | ||
} | ||
]), | ||
(option.rows = [ | ||
{ | ||
dimensionKey: '20001', | ||
title: '销售额', | ||
headerStyle: { | ||
color: 'red', | ||
cursor: 'pointer' | ||
} | ||
} | ||
]), | ||
tableInstance.updateOption(option); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.