From eb5b72f16e79bea83cd6d511aa795f6eb3c32665 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 4 Dec 2023 11:54:23 +0800 Subject: [PATCH 01/35] fix: fix tree structure bottom frozen update --- .../fix-bug-fix-0.15.4_2023-12-04-03-54.json | 10 ++++ .../src/scenegraph/layout/update-row.ts | 60 ++++++------------- 2 files changed, 28 insertions(+), 42 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-03-54.json diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-03-54.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-03-54.json new file mode 100644 index 000000000..5aa955c78 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-03-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix tree structure bottom frozen update", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/layout/update-row.ts b/packages/vtable/src/scenegraph/layout/update-row.ts index bb1656ec7..4fa530def 100644 --- a/packages/vtable/src/scenegraph/layout/update-row.ts +++ b/packages/vtable/src/scenegraph/layout/update-row.ts @@ -91,7 +91,7 @@ export function updateRow( } // update table size - const newTotalHeight = table.getRowsHeight(table.frozenRowCount, table.rowCount - 1); + const newTotalHeight = table.getRowsHeight(table.frozenRowCount, table.rowCount - 1 - table.bottomFrozenRowCount); scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height); } @@ -217,33 +217,21 @@ function resetRowNumberAndY(scene: Scenegraph) { let newTotalHeight = 0; for (let col = 0; col < scene.table.colCount; col++) { const headerColGroup = scene.getColGroup(col, true); - const colGroup = scene.getColGroup(col, false); + const colGroup = scene.getColGroup(col, false); // body, row header, right frozen + const bottomGroup = + scene.getColGroupInBottom(col) || + scene.getColGroupInLeftBottomCorner(col) || + scene.getColGroupInRightTopCorner(col); if (!headerColGroup || !colGroup) { continue; } // reset row number let rowIndex = (headerColGroup.firstChild as Group)?.row; let y = 0; - // headerColGroup.forEachChildren((cellGroup: Group) => { - // cellGroup.row = rowIndex; - // rowIndex++; - // if (cellGroup.role !== 'cell') { - // return; - // } - // cellGroup.setAttribute('y', y); - // y+= cellGroup.attribute.height; - // }); rowIndex = (colGroup.firstChild as Group)?.row; const rowStart = rowIndex; y = scene.getCellGroupY(rowIndex); colGroup.forEachChildren((cellGroup: Group) => { - // const oldRow = cellGroup.row; - // if (isNumber(cellGroup.mergeStartRow)) { - // cellGroup.mergeStartRow = cellGroup.mergeStartRow - oldRow + rowIndex; - // } - // if (isNumber(cellGroup.mergeEndRow)) { - // cellGroup.mergeEndRow = cellGroup.mergeEndRow - oldRow + rowIndex; - // } cellGroup.row = rowIndex; const merge = getCellMergeInfo(scene.table, cellGroup.col, cellGroup.row); if (merge) { @@ -258,33 +246,21 @@ function resetRowNumberAndY(scene: Scenegraph) { } cellGroup.setAttribute('y', y); y += cellGroup.attribute.height; - - // const { col, row } = cellGroup; - // const mergeInfo = getCellMergeInfo(table, col, row); - // if (mergeInfo) { - // cellGroup.mergeStartCol = mergeInfo.start.col; - // cellGroup.mergeStartRow = mergeInfo.start.row; - // cellGroup.mergeEndCol = mergeInfo.end.col; - // cellGroup.mergeEndRow = mergeInfo.end.row; - - // const rangeHeight = table.getRowHeight(row); - // const rangeWidth = table.getColWidth(col); - // cellGroup.forEachChildren((child: IGraphic) => { - // child.setAttributes({ - // dx: 0, - // dy: 0 - // }); - // }); - // resizeCellGroup(cellGroup, rangeWidth, rangeHeight, mergeInfo, table); - // } }); newTotalHeight = y; - // const rowCount = rowIndex - rowStart; - // if (col === 0 && scene.proxy.rowEnd - scene.proxy.rowStart + 1 !== rowCount) { - // scene.proxy.rowEnd = scene.proxy.rowStart + rowCount - 1; - // scene.proxy.referenceRow = scene.proxy.rowStart + Math.floor((scene.proxy.rowEnd - scene.proxy.rowStart) / 2); - // } + // update bottom frozen cell row index + bottomGroup?.forEachChildren((cellGroup: Group) => { + cellGroup.row = rowIndex; + const merge = getCellMergeInfo(scene.table, cellGroup.col, cellGroup.row); + if (merge) { + cellGroup.mergeStartCol = merge.start.col; + cellGroup.mergeStartRow = merge.start.row; + cellGroup.mergeEndCol = merge.end.col; + cellGroup.mergeEndRow = merge.end.row; + } + rowIndex++; + }); } return newTotalHeight; } From 9d7872f66899bf663684950956860b41cbd8b273 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 4 Dec 2023 17:05:44 +0800 Subject: [PATCH 02/35] feat: axis support chart padding config --- .../fix-bug-fix-0.15.4_2023-12-04-08-50.json | 10 +++ packages/vtable/src/components/axis/axis.ts | 27 ++++++-- packages/vtable/src/core/BaseTable.ts | 22 +++++- .../layout/chart-helper/get-axis-config.ts | 69 +++++++++++++++++++ .../scenegraph/group-creater/cell-helper.ts | 2 +- .../src/scenegraph/layout/update-width.ts | 10 ++- .../scenegraph/refresh-node/update-chart.ts | 6 +- 7 files changed, 135 insertions(+), 11 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-08-50.json diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-08-50.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-08-50.json new file mode 100644 index 000000000..6a7d0002f --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-08-50.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: axis support chart padding config", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/components/axis/axis.ts b/packages/vtable/src/components/axis/axis.ts index 1130c6beb..06bc49009 100644 --- a/packages/vtable/src/components/axis/axis.ts +++ b/packages/vtable/src/components/axis/axis.ts @@ -24,6 +24,8 @@ const scaleParser: Parser = (scale: IBaseScale) => { export class CartesianAxis { width: number; height: number; + x: number = 0; + y: number = 0; table: BaseTableAPI; option: ICellAxisOption; orient: IOrientType; @@ -35,14 +37,27 @@ export class CartesianAxis { scale: BandAxisScale | LinearAxisScale; component: LineAxis; - constructor(option: ICellAxisOption, width: number, height: number, table: BaseTableAPI) { + constructor( + option: ICellAxisOption, + width: number, + height: number, + padding: [number, number, number, number], + table: BaseTableAPI + ) { this.table = table; - this.width = width; - this.height = height; - // this.option = cloneDeep(option); this.option = merge({}, commonAxis, option); - this.orient = option.orient ?? 'left'; + + if (this.orient === 'left' || this.orient === 'right') { + this.width = width; + this.height = height - padding[2]; + this.y = padding[0]; + } else if (this.orient === 'top' || this.orient === 'bottom') { + this.width = width - padding[1]; + this.height = height; + this.x = padding[3]; + } + this.visible = option.visible ?? true; this.type = option.type ?? 'band'; this.inverse = 'inverse' in option ? !!option.inverse : false; @@ -186,7 +201,7 @@ export class CartesianAxis { axisLength = height; } const attrs: LineAxisAttributes = { - start: { x: 0, y: 0 }, + start: { x: this.x, y: this.y }, end, // grid: { // type: 'line', diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 61c875d04..1b2d333e5 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -90,6 +90,7 @@ import { DataSet } from '@visactor/vdataset'; import { Title } from '../components/title/title'; import type { Chart } from '../scenegraph/graphic/chart'; import { setBatchRenderChartCount } from '../scenegraph/graphic/contributions/chart-render-helper'; +import { isLeftOrRightAxis, isTopOrBottomAxis } from '../layout/chart-helper/get-axis-config'; const { toBoxArray } = utilStyle; const { isTouchEvent } = event; const rangeReg = /^\$(\d+)\$(\d+)$/; @@ -2818,6 +2819,20 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { return cacheStyle; } const hd = layoutMap.getHeader(col, row); + + let paddingForAxis; + if (this.isPivotChart() && isTopOrBottomAxis(col, row, layoutMap as PivotHeaderLayoutMap)) { + // get chart padding for axis cell + const chartColumn = layoutMap.getBody(col, this.rowHeaderLevelCount); + const padding = (chartColumn.style as any).padding ?? this.theme.bodyStyle.padding; + paddingForAxis = padding; + } else if (this.isPivotChart() && isLeftOrRightAxis(col, row, layoutMap as PivotHeaderLayoutMap)) { + // get chart padding for axis cell + const chartColumn = layoutMap.getBody(this.columnHeaderLevelCount, row); + const padding = (chartColumn.style as any).padding ?? this.theme.bodyStyle.padding; + paddingForAxis = padding; + } + if ( (!hd || hd.isEmpty) && (layoutMap.isLeftBottomCorner(col, row) || @@ -2831,7 +2846,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { const styleClass = this.internalProps.headerHelper.getStyleClass(hd?.headerType || 'text'); if (layoutMap.isBottomFrozenRow(col, row) && this.theme.bottomFrozenStyle) { cacheStyle = headerStyleContents.of( - {}, + paddingForAxis ? { padding: paddingForAxis } : {}, this.theme.bottomFrozenStyle, { col, @@ -2846,7 +2861,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { ); } else if (layoutMap.isRightFrozenColumn(col, row) && this.theme.rightFrozenStyle) { cacheStyle = headerStyleContents.of( - {}, + paddingForAxis ? { padding: paddingForAxis } : {}, this.theme.rightFrozenStyle, { col, @@ -2863,6 +2878,9 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // const styleClass = hd.headerType.StyleClass; //BaseHeader文件 // const { style } = hd; const style = hd?.style || {}; + if (paddingForAxis) { + (style as any).padding = paddingForAxis; + } cacheStyle = headerStyleContents.of( style, layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row) diff --git a/packages/vtable/src/layout/chart-helper/get-axis-config.ts b/packages/vtable/src/layout/chart-helper/get-axis-config.ts index aa195fb68..c77705503 100644 --- a/packages/vtable/src/layout/chart-helper/get-axis-config.ts +++ b/packages/vtable/src/layout/chart-helper/get-axis-config.ts @@ -546,3 +546,72 @@ function getRange( ticks }; } + +export function isTopOrBottomAxis(col: number, row: number, layout: PivotHeaderLayoutMap): boolean { + if (!layout._table.isPivotChart()) { + return false; + } + + if (layout.indicatorsAsCol) { + if ( + layout.hasTwoIndicatorAxes && + row === layout.columnHeaderLevelCount - 1 && + col >= layout.rowHeaderLevelCount && + col < layout.colCount - layout.rightFrozenColCount + ) { + // 顶部副指标轴 + return true; + } else if ( + row === layout.rowCount - layout.bottomFrozenRowCount && + col >= layout.rowHeaderLevelCount && + col < layout.colCount - layout.rightFrozenColCount + ) { + // 底侧指标轴 + return true; + } + } else { + if ( + row === layout.rowCount - layout.bottomFrozenRowCount && + col >= layout.rowHeaderLevelCount && + col < layout.colCount - layout.rightFrozenColCount + ) { + // 底部维度轴 + return true; + } + } + return false; +} + +export function isLeftOrRightAxis(col: number, row: number, layout: PivotHeaderLayoutMap): boolean { + if (!layout._table.isPivotChart()) { + return false; + } + + if (layout.indicatorsAsCol) { + if ( + col === layout.rowHeaderLevelCount - 1 && + row >= layout.columnHeaderLevelCount && + row < layout.rowCount - layout.bottomFrozenRowCount + ) { + // 左侧维度轴 + return true; + } + } else { + if ( + col === layout.rowHeaderLevelCount - 1 && + row >= layout.columnHeaderLevelCount && + row < layout.rowCount - layout.bottomFrozenRowCount + ) { + // 左侧指标轴 + return true; + } else if ( + col === layout.colCount - layout.rightFrozenColCount && + row >= layout.columnHeaderLevelCount && + row < layout.rowCount - layout.bottomFrozenRowCount + ) { + // 右侧副指标轴 + return true; + } + } + return false; +} diff --git a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts index 6570d4559..107300e3c 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -169,7 +169,7 @@ export function createCell( const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row); if (axisConfig) { - const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, table); + const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, table); cellGroup.clear(); cellGroup.appendChild(axis.component); axis.overlap(); diff --git a/packages/vtable/src/scenegraph/layout/update-width.ts b/packages/vtable/src/scenegraph/layout/update-width.ts index 2fee9f548..9931a41c7 100644 --- a/packages/vtable/src/scenegraph/layout/update-width.ts +++ b/packages/vtable/src/scenegraph/layout/update-width.ts @@ -295,8 +295,16 @@ function updateCellWidth( } else if (cellGroup.firstChild?.name === 'axis') { // recreate axis component const axisConfig = scene.table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row); + const cellStyle = scene.table._getCellStyle(col, row); + const padding = getQuadProps(getProp('padding', cellStyle, col, row, scene.table)); if (axisConfig) { - const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, scene.table); + const axis = new CartesianAxis( + axisConfig, + cellGroup.attribute.width, + cellGroup.attribute.height, + padding, + scene.table + ); cellGroup.clear(); cellGroup.appendChild(axis.component); axis.overlap(); diff --git a/packages/vtable/src/scenegraph/refresh-node/update-chart.ts b/packages/vtable/src/scenegraph/refresh-node/update-chart.ts index b323d67a5..209725a5b 100644 --- a/packages/vtable/src/scenegraph/refresh-node/update-chart.ts +++ b/packages/vtable/src/scenegraph/refresh-node/update-chart.ts @@ -6,6 +6,8 @@ import type { Chart } from '../graphic/chart'; import type { Group } from '../graphic/group'; import type { Scenegraph } from '../scenegraph'; import type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout'; +import { getQuadProps } from '../utils/padding'; +import { getProp } from '../utils/get-prop'; /** 供调整列宽后更新chart使用 */ export function updateChartSize(scenegraph: Scenegraph, col: number) { @@ -177,7 +179,9 @@ function updateTableAxes(containerGroup: Group, table: BaseTableAPI) { }); if (isAxisComponent) { const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row); - const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, table); + const cellStyle = table._getCellStyle(cell.col, cell.row); + const padding = getQuadProps(getProp('padding', cellStyle, cell.col, cell.row, table)); + const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, table); cell.clear(); cell.appendChild(axis.component); axis.overlap(); From ae01e3004fec67e5eaec5d27301377c2e8ff434c Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 4 Dec 2023 18:06:51 +0800 Subject: [PATCH 03/35] fix: fix no padding style error in _getCellStyle() --- packages/vtable/src/core/BaseTable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 1b2d333e5..e61f9b462 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -2824,12 +2824,12 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { if (this.isPivotChart() && isTopOrBottomAxis(col, row, layoutMap as PivotHeaderLayoutMap)) { // get chart padding for axis cell const chartColumn = layoutMap.getBody(col, this.rowHeaderLevelCount); - const padding = (chartColumn.style as any).padding ?? this.theme.bodyStyle.padding; + const padding = (chartColumn.style as any)?.padding ?? this.theme.bodyStyle.padding; paddingForAxis = padding; } else if (this.isPivotChart() && isLeftOrRightAxis(col, row, layoutMap as PivotHeaderLayoutMap)) { // get chart padding for axis cell const chartColumn = layoutMap.getBody(this.columnHeaderLevelCount, row); - const padding = (chartColumn.style as any).padding ?? this.theme.bodyStyle.padding; + const padding = (chartColumn.style as any)?.padding ?? this.theme.bodyStyle.padding; paddingForAxis = padding; } From 089aca0b00e866707ed9626cd615ba8bb99a6006 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 4 Dec 2023 20:57:16 +0800 Subject: [PATCH 04/35] fix: fix limit column width adaptive update --- .../fix-bug-fix-0.15.4_2023-12-04-12-57.json | 10 + .../scenegraph/layout/compute-col-width.ts | 188 ++++++++++++------ 2 files changed, 133 insertions(+), 65 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-12-57.json diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-12-57.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-12-57.json new file mode 100644 index 000000000..f0d76131f --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-12-57.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix limit column width adaptive update", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/layout/compute-col-width.ts b/packages/vtable/src/scenegraph/layout/compute-col-width.ts index f6f3ced35..925f2a2db 100644 --- a/packages/vtable/src/scenegraph/layout/compute-col-width.ts +++ b/packages/vtable/src/scenegraph/layout/compute-col-width.ts @@ -68,90 +68,100 @@ export function computeColsWidth(table: BaseTableAPI, colStart?: number, colEnd? if (update) { newWidths[col] = table._adjustColWidth(col, maxWidth); } else { - table._setColWidth(col, maxWidth, false, true); + table._setColWidth(col, table._adjustColWidth(col, maxWidth), false, true); } } // 处理adaptive宽度 if (table.widthMode === 'adaptive') { table._clearColRangeWidthsMap(); - // const canvasWidth = table.internalProps.canvas.width; - const rowHeaderWidth = table.getColsWidth(0, table.rowHeaderLevelCount - 1); - const rightHeaderWidth = table.isPivotChart() ? table.getRightFrozenColsWidth() : 0; - const totalDrawWidth = table.tableNoFrameWidth - rowHeaderWidth - rightHeaderWidth; - const startCol = table.rowHeaderLevelCount; - const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount; - let actualWidth = 0; - for (let col = startCol; col < endCol; col++) { - actualWidth += update ? newWidths[col] : table.getColWidth(col); - } - const factor = totalDrawWidth / actualWidth; - for (let col = startCol; col < endCol; col++) { - let colWidth; - if (col === endCol - 1) { - colWidth = - totalDrawWidth - - (update - ? newWidths.reduce((acr, cur, index) => { - if (index >= startCol && index <= endCol - 2) { - return acr + cur; - } - return acr; - }, 0) - : table.getColsWidth(startCol, endCol - 2)); - } else { - colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor); - } - if (update) { - newWidths[col] = table._adjustColWidth(col, colWidth); - } else { - table._setColWidth(col, colWidth, false, true); + const canvasWidth = table.tableNoFrameWidth; + let actualHeaderWidth = 0; + for (let col = 0; col < table.colCount; col++) { + const colWidth = update ? newWidths[col] : table.getColWidth(col); + if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) { + actualHeaderWidth += colWidth; } } + const startCol = table.frozenColCount; + const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount; + getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, update, newWidths, table); + // const canvasWidth = table.internalProps.canvas.width; + // const rowHeaderWidth = table.getColsWidth(0, table.rowHeaderLevelCount - 1); + // const rightHeaderWidth = table.isPivotChart() ? table.getRightFrozenColsWidth() : 0; + // const totalDrawWidth = table.tableNoFrameWidth - rowHeaderWidth - rightHeaderWidth; + // const startCol = table.rowHeaderLevelCount; + // const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount; + // let actualWidth = 0; + // for (let col = startCol; col < endCol; col++) { + // actualWidth += update ? newWidths[col] : table.getColWidth(col); + // } + // const factor = totalDrawWidth / actualWidth; + // for (let col = startCol; col < endCol; col++) { + // let colWidth; + // if (col === endCol - 1) { + // colWidth = + // totalDrawWidth - + // (update + // ? newWidths.reduce((acr, cur, index) => { + // if (index >= startCol && index <= endCol - 2) { + // return acr + cur; + // } + // return acr; + // }, 0) + // : table.getColsWidth(startCol, endCol - 2)); + // } else { + // colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor); + // } + // if (update) { + // newWidths[col] = table._adjustColWidth(col, colWidth); + // } else { + // table._setColWidth(col, table._adjustColWidth(col, colWidth), false, true); + // } + // } } else if (table.autoFillWidth) { // 处理风神列宽特殊逻辑 table._clearColRangeWidthsMap(); const canvasWidth = table.tableNoFrameWidth; - let actualWidth = 0; let actualHeaderWidth = 0; for (let col = 0; col < table.colCount; col++) { const colWidth = update ? newWidths[col] : table.getColWidth(col); if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) { actualHeaderWidth += colWidth; } - - actualWidth += colWidth; - } - - // 如果内容宽度小于canvas宽度,执行adaptive放大 - if (actualWidth < canvasWidth && actualWidth - actualHeaderWidth > 0) { - const factor = (canvasWidth - actualHeaderWidth) / (actualWidth - actualHeaderWidth); - for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) { - let colWidth; - if (col === table.colCount - table.rightFrozenColCount - 1) { - colWidth = - canvasWidth - - actualHeaderWidth - - (update - ? newWidths.reduce((acr, cur, index) => { - if (index >= table.frozenColCount && index <= table.colCount - table.rightFrozenColCount - 2) { - return acr + cur; - } - return acr; - }, 0) - : table.getColsWidth(table.frozenColCount, table.colCount - table.rightFrozenColCount - 2)); - } else { - colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor); - } - if (update) { - // newWidths[col] = newWidths[col] * factor; - newWidths[col] = table._adjustColWidth(col, colWidth); - } else { - // table.setColWidth(col, table.getColWidth(col) * factor, false, true); - table._setColWidth(col, colWidth, false, true); - } - } } + const startCol = table.frozenColCount; + const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount; + getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, update, newWidths, table); + // // 如果内容宽度小于canvas宽度,执行adaptive放大 + // if (actualWidth < canvasWidth && actualWidth - actualHeaderWidth > 0) { + // const factor = (canvasWidth - actualHeaderWidth) / (actualWidth - actualHeaderWidth); + // for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) { + // let colWidth; + // if (col === table.colCount - table.rightFrozenColCount - 1) { + // colWidth = + // canvasWidth - + // actualHeaderWidth - + // (update + // ? newWidths.reduce((acr, cur, index) => { + // if (index >= table.frozenColCount && index <= table.colCount - table.rightFrozenColCount - 2) { + // return acr + cur; + // } + // return acr; + // }, 0) + // : table.getColsWidth(table.frozenColCount, table.colCount - table.rightFrozenColCount - 2)); + // } else { + // colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor); + // } + // if (update) { + // // newWidths[col] = newWidths[col] * factor; + // newWidths[col] = table._adjustColWidth(col, colWidth); + // } else { + // // table.setColWidth(col, table.getColWidth(col) * factor, false, true); + // table._setColWidth(col, table._adjustColWidth(col, colWidth), false, true); + // } + // } + // } } // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time); @@ -580,3 +590,51 @@ function getColWidthDefinedWidthResizedWidth(col: number, table: BaseTableAPI) { } return widthDefined; } + +function getAdaptiveWidth( + totalDrawWidth: number, + startCol: number, + endColPlus1: number, + update: boolean, + newWidths: number[], + table: BaseTableAPI +) { + let actualWidth = 0; + const adaptiveColumns: number[] = []; + for (let col = startCol; col < endColPlus1; col++) { + const width = update ? newWidths[col] : table.getColWidth(col); + const maxWidth = table.getMaxColWidth(col); + const minWidth = table.getMinColWidth(col); + if (width !== maxWidth && width !== minWidth) { + actualWidth += width; + adaptiveColumns.push(col); + } else { + // fixed width, do not adaptive + totalDrawWidth -= width; + } + } + + const factor = totalDrawWidth / actualWidth; + + for (let i = 0; i < adaptiveColumns.length; i++) { + const col = adaptiveColumns[i]; + let colWidth; + if (i === adaptiveColumns.length - 1) { + colWidth = + totalDrawWidth - + adaptiveColumns.reduce((acr, cur, index) => { + if (index !== col) { + return acr + (update ? newWidths[cur] : table.getColWidth(cur)); + } + return acr; + }, 0); + } else { + colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor); + } + if (update) { + newWidths[col] = table._adjustColWidth(col, colWidth); + } else { + table._setColWidth(col, table._adjustColWidth(col, colWidth), false, true); + } + } +} From a7b34ff9c06ce765500d1cfa985925117bec130a Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 5 Dec 2023 11:12:52 +0800 Subject: [PATCH 05/35] fix: fix last adaptive column width in getAdaptiveWidth() --- packages/vtable/src/scenegraph/layout/compute-col-width.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/scenegraph/layout/compute-col-width.ts b/packages/vtable/src/scenegraph/layout/compute-col-width.ts index 925f2a2db..7dd236c6a 100644 --- a/packages/vtable/src/scenegraph/layout/compute-col-width.ts +++ b/packages/vtable/src/scenegraph/layout/compute-col-width.ts @@ -74,6 +74,10 @@ export function computeColsWidth(table: BaseTableAPI, colStart?: number, colEnd? // 处理adaptive宽度 if (table.widthMode === 'adaptive') { + const rowHeaderWidth = table.getColsWidth(0, table.rowHeaderLevelCount - 1); + const rightHeaderWidth = table.isPivotChart() ? table.getRightFrozenColsWidth() : 0; + const totalDrawWidth = table.tableNoFrameWidth - rowHeaderWidth - rightHeaderWidth; + table._clearColRangeWidthsMap(); const canvasWidth = table.tableNoFrameWidth; let actualHeaderWidth = 0; @@ -623,7 +627,7 @@ function getAdaptiveWidth( colWidth = totalDrawWidth - adaptiveColumns.reduce((acr, cur, index) => { - if (index !== col) { + if (cur !== col) { return acr + (update ? newWidths[cur] : table.getColWidth(cur)); } return acr; From 81a59a044f81c2ae562c35cf7d38996c2bf590fd Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 5 Dec 2023 11:31:07 +0800 Subject: [PATCH 06/35] fix: add width judgement in adaptive column width --- .../src/scenegraph/layout/compute-col-width.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/vtable/src/scenegraph/layout/compute-col-width.ts b/packages/vtable/src/scenegraph/layout/compute-col-width.ts index 7dd236c6a..00f8be64f 100644 --- a/packages/vtable/src/scenegraph/layout/compute-col-width.ts +++ b/packages/vtable/src/scenegraph/layout/compute-col-width.ts @@ -128,15 +128,21 @@ export function computeColsWidth(table: BaseTableAPI, colStart?: number, colEnd? table._clearColRangeWidthsMap(); const canvasWidth = table.tableNoFrameWidth; let actualHeaderWidth = 0; + let actualWidth = 0; for (let col = 0; col < table.colCount; col++) { const colWidth = update ? newWidths[col] : table.getColWidth(col); if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) { actualHeaderWidth += colWidth; } + actualWidth += colWidth; } - const startCol = table.frozenColCount; - const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount; - getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, update, newWidths, table); + // 如果内容宽度小于canvas宽度,执行adaptive放大 + if (actualWidth < canvasWidth && actualWidth > actualHeaderWidth) { + const startCol = table.frozenColCount; + const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount; + getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, update, newWidths, table); + } + // // 如果内容宽度小于canvas宽度,执行adaptive放大 // if (actualWidth < canvasWidth && actualWidth - actualHeaderWidth > 0) { // const factor = (canvasWidth - actualHeaderWidth) / (actualWidth - actualHeaderWidth); From 09f4a88b8c92c334cb21c71ac15e25dd76b64cf7 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 5 Dec 2023 16:22:46 +0800 Subject: [PATCH 07/35] fix: fix empty error in updatePartColPosition() --- .../progress/update-position/dynamic-set-x.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts index d2f563223..f1f48e0a6 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts @@ -171,13 +171,22 @@ function updateColGroupContent(colGroup: Group, proxy: SceneProxy) { function updatePartColPosition(startCol: number, endCol: number, direction: 'left' | 'right', proxy: SceneProxy) { for (let col = startCol; col <= endCol; col++) { - if (proxy.table.scenegraph.bodyGroup.childrenCount > 0) { + if ( + proxy.table.scenegraph.bodyGroup.childrenCount > 0 && + proxy.table.scenegraph.bodyGroup.firstChild.type === 'group' + ) { updateColPosition(proxy.table.scenegraph.bodyGroup, direction, proxy); } - if (proxy.table.scenegraph.colHeaderGroup.childrenCount > 0) { + if ( + proxy.table.scenegraph.colHeaderGroup.childrenCount > 0 && + proxy.table.scenegraph.colHeaderGroup.firstChild.type === 'group' + ) { updateColPosition(proxy.table.scenegraph.colHeaderGroup, direction, proxy); } - if (proxy.table.scenegraph.bottomFrozenGroup.childrenCount > 0) { + if ( + proxy.table.scenegraph.bottomFrozenGroup.childrenCount > 0 && + proxy.table.scenegraph.bottomFrozenGroup.firstChild.type === 'group' + ) { updateColPosition(proxy.table.scenegraph.bottomFrozenGroup, direction, proxy); } } From 9f6a54645528ec1edf2091eef537bb0bdb713912 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 5 Dec 2023 16:58:13 +0800 Subject: [PATCH 08/35] feat: change columnHeaderLevelCount&rowHeaderLevelCount get function --- .../vtable/src/layout/pivot-header-layout.ts | 116 +++++++++++------- 1 file changed, 69 insertions(+), 47 deletions(-) diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index dbfb352cd..4a587156e 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -62,6 +62,8 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { private _rowHeaderCellIds: number[][] = []; private _rowHeaderCellIds_FULL: number[][] = []; private _columnWidths: WidthData[] = []; + private _columnHeaderLevelCount: number; + private _rowHeaderLevelCount: number; rowsDefine: (IRowDimension | string)[]; columnsDefine: (IColumnDimension | string)[]; indicatorsDefine: (IIndicator | string)[]; @@ -94,7 +96,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { indicatorKeys: string[] = []; indicatorDimensionKey: string = IndicatorDimensionKeyPlaceholder; // 缓存行号列号对应的cellRange 需要注意当表头位置拖拽后 这个缓存的行列号已不准确 进行重置 - private _cellRangeMap: Map; //存储单元格的行列号范围 针对解决是否为合并单元格情况 + // private _cellRangeMap: Map; //存储单元格的行列号范围 针对解决是否为合并单元格情况 // 缓存行号列号对应的headerPath,注意树形结构展开需要清除! 需要注意当表头位置拖拽后 这个缓存的行列号已不准确 进行重置 private _CellHeaderPathMap: Map; _table: PivotTable | PivotChart; @@ -130,7 +132,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.extensionRows = (table as PivotTable).options.extensionRows; } this.dataset = dataset; - this._cellRangeMap = new Map(); + // this._cellRangeMap = new Map(); this._CellHeaderPathMap = new Map(); // this.showHeader = showHeader; // this.pivotLayout = pivotLayoutObj; @@ -199,6 +201,22 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr(); this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr(); this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys); + + if (this._table.isPivotChart()) { + this.hasTwoIndicatorAxes = this._indicators.some(indicatorObject => { + if ( + indicatorObject.chartSpec && + indicatorObject.chartSpec.series && + indicatorObject.chartSpec.series.length > 1 + ) { + return true; + } + return false; + }); + } + this.resetColumnHeaderLevelCount(); + this.resetRowHeaderLevelCount(); + //生成列表头单元格 if (this.columnDimensionTree.tree.children?.length >= 1) { this.columnHeaderObjs = this._addHeaders( @@ -302,19 +320,6 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { }); } - if (this._table.isPivotChart()) { - this.hasTwoIndicatorAxes = this._indicators.some(indicatorObject => { - if ( - indicatorObject.chartSpec && - indicatorObject.chartSpec.series && - indicatorObject.chartSpec.series.length > 1 - ) { - return true; - } - return false; - }); - } - //生成cornerHeaderObjs及_cornerHeaderCellIds if (this.cornerSetting.titleOnDimension === 'column') { this.cornerHeaderObjs = this._addCornerHeaders( @@ -1141,7 +1146,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { get headerLevelCount(): number { return this.columnHeaderLevelCount; } - get columnHeaderLevelCount(): number { + resetColumnHeaderLevelCount() { if (this.showHeader && this.showColumnHeader) { if ( this._table.isPivotChart() && @@ -1149,7 +1154,8 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { !this.dataset?.colKeys?.length && !this.hasTwoIndicatorAxes ) { - return 0; + this.columnHeaderLevelCount = 0; + return; } let count = this.indicatorsAsCol ? this.hideIndicatorName //设置隐藏表头,且表头最下面一级就是指标维度 则-1 @@ -1164,47 +1170,63 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { if (this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes) { count -= 1; } - return count; + this.columnHeaderLevelCount = count; + return; } - return 0; + this.columnHeaderLevelCount = 0; + return; } - get rowHeaderLevelCount(): number { + resetRowHeaderLevelCount() { if (this.showHeader && this.showRowHeader) { if (this.rowHierarchyType === 'tree') { const extensionRowCount = this.extensionRows?.length ?? 0; if (this.rowHeaderTitle) { - return 2 + extensionRowCount; + this.rowHeaderLevelCount = 2 + extensionRowCount; + return; } - return 1 + extensionRowCount; + this.rowHeaderLevelCount = 1 + extensionRowCount; + return; } + const rowLevelCount = this.rowDimensionKeys.length; // let count = this.indicatorsAsCol - // ? this.rowDimensionTree.totalLevel + // ? rowLevelCount // : this.hideIndicatorName //设置隐藏表头,且表头最下面一级就是指标维度 则-1 // ? this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey - // ? this.rowDimensionTree.totalLevel - 1 - // : this.rowDimensionTree.totalLevel - // : this.rowDimensionTree.totalLevel; - // if (this.rowHeaderTitle) { - // count += 1; - // } - const rowLevelCount = this.rowDimensionKeys.length; - let count = this.indicatorsAsCol - ? rowLevelCount - : this.hideIndicatorName //设置隐藏表头,且表头最下面一级就是指标维度 则-1 - ? this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey - ? rowLevelCount - 1 - : rowLevelCount - : rowLevelCount; + // ? rowLevelCount - 1 + // : rowLevelCount + // : rowLevelCount; + + let count = rowLevelCount; + if (this.indicatorsAsCol) { + // count = rowLevelCount; + } else if (this.hideIndicatorName && this.rowDimensionKeys[0] === this.indicatorDimensionKey) { + count = rowLevelCount - 1; + } + if (this.rowHeaderTitle) { count += 1; } // if (this._table.isPivotChart()&&this.indicatorsAsCol) { // count+=1; // } - return count; + this.rowHeaderLevelCount = count; + return; } // return 0; - return this.indicatorsAsCol ? 0 : this.hideIndicatorName ? 0 : 1; + this.rowHeaderLevelCount = this.indicatorsAsCol ? 0 : this.hideIndicatorName ? 0 : 1; + return; + } + get columnHeaderLevelCount(): number { + return this._columnHeaderLevelCount; + } + set columnHeaderLevelCount(count: number) { + this._columnHeaderLevelCount = count; + } + get rowHeaderLevelCount(): number { + return this._rowHeaderLevelCount; + } + set rowHeaderLevelCount(count: number) { + this._rowHeaderLevelCount = count; } get colCount(): number { return ( @@ -1445,9 +1467,9 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { return result; } // if (this._cellRangeMap.has(`$${col}$${row}`)) return this._cellRangeMap.get(`$${col}$${row}`); - if (this._cellRangeMap.has(`${col}-${row}`)) { - return this._cellRangeMap.get(`${col}-${row}`); - } + // if (this._cellRangeMap.has(`${col}-${row}`)) { + // return this._cellRangeMap.get(`${col}-${row}`); + // } if (this.isHeader(col, row) && col !== -1 && row !== -1) { //in header const id = this.getCellId(col, row); @@ -1484,7 +1506,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { result.end.row = r; } } - this._cellRangeMap.set(`${col}-${row}`, result); + // this._cellRangeMap.set(`${col}-${row}`, result); return result; } isCellRangeEqual(col: number, row: number, targetCol: number, targetRow: number): boolean { @@ -1805,7 +1827,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { return o; }, {} as { [key: LayoutObjectId]: HeaderData }); this._CellHeaderPathMap = new Map(); - this._cellRangeMap = new Map(); + // this._cellRangeMap = new Map(); const diffCell: { addCellPositions: CellAddress[]; removeCellPositions: CellAddress[]; @@ -2109,7 +2131,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { ); this.columnDimensionTree.reset(this.columnDimensionTree.tree.children, true); this._CellHeaderPathMap = new Map(); - this._cellRangeMap = new Map(); + // this._cellRangeMap = new Map(); return { sourceIndex: sourceCellRange.start.col, targetIndex, @@ -2163,7 +2185,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { ); this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, true); this._CellHeaderPathMap = new Map(); - this._cellRangeMap = new Map(); + // this._cellRangeMap = new Map(); return { sourceIndex: sourceCellRange.start.row, targetIndex: targetIndex + this.columnHeaderLevelCount, @@ -2529,7 +2551,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } clearCellRangeMap() { - this._cellRangeMap.clear(); + // this._cellRangeMap.clear(); this._CellHeaderPathMap = new Map(); } From e3dd314d2d31211fe6c3de52109b4613b2b52626 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 5 Dec 2023 17:53:04 +0800 Subject: [PATCH 09/35] fix: change resetRowHeaderLevelCount() location --- .../vtable/src/layout/pivot-header-layout.ts | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index 4a587156e..e7571d2a2 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -202,19 +202,6 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr(); this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys); - if (this._table.isPivotChart()) { - this.hasTwoIndicatorAxes = this._indicators.some(indicatorObject => { - if ( - indicatorObject.chartSpec && - indicatorObject.chartSpec.series && - indicatorObject.chartSpec.series.length > 1 - ) { - return true; - } - return false; - }); - } - this.resetColumnHeaderLevelCount(); this.resetRowHeaderLevelCount(); //生成列表头单元格 @@ -298,6 +285,20 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } // } + if (this._table.isPivotChart()) { + this.hasTwoIndicatorAxes = this._indicators.some(indicatorObject => { + if ( + indicatorObject.chartSpec && + indicatorObject.chartSpec.series && + indicatorObject.chartSpec.series.length > 1 + ) { + return true; + } + return false; + }); + } + this.resetColumnHeaderLevelCount(); + // this.indicatorsAsCol = !isValid(this.rowDimensionKeys.find(key => key === this.indicatorDimensionKey)); // this.colAttrs[this.colAttrs.length-1]===this.indicatorDimensionKey&&this.colAttrs.pop(); // this.rowAttrs[this.rowAttrs.length-1]===this.indicatorDimensionKey&&this.rowAttrs.pop(); From c4345c69e7147e396ce7d461817936c291885ce7 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 5 Dec 2023 19:37:21 +0800 Subject: [PATCH 10/35] fix: fix table range when container resize --- .../fix-bug-fix-0.15.4_2023-12-05-11-36.json | 10 ++++++++++ .../src/scenegraph/group-creater/progress/proxy.ts | 14 ++++++++++++++ packages/vtable/src/scenegraph/scenegraph.ts | 5 +++++ 3 files changed, 29 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-05-11-36.json diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-05-11-36.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-05-11-36.json new file mode 100644 index 000000000..6acd91c7f --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-05-11-36.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix table range when container resize", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts index 99e7b88f0..73ce89945 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts @@ -142,6 +142,20 @@ export class SceneProxy { this.rowUpdatePos = this.bodyBottomRow; } + resize() { + const defaultColWidth = this.table.defaultColWidth; + this.taskColCount = Math.ceil(this.table.tableNoFrameWidth / defaultColWidth) * 1; + const widthLimit = this.table.tableNoFrameWidth * 5; + this.screenColCount = Math.ceil(this.table.tableNoFrameWidth / defaultColWidth); + this.firstScreenColLimit = this.bodyLeftCol + Math.min(this.colLimit, Math.ceil(widthLimit / defaultColWidth)); + + const defaultRowHeight = this.table.defaultRowHeight; + this.taskRowCount = Math.ceil(this.table.tableNoFrameHeight / defaultRowHeight) * 1; + const heightLimit = this.table.tableNoFrameHeight * 5; + this.screenRowCount = Math.ceil(this.table.tableNoFrameHeight / defaultRowHeight); + this.firstScreenRowLimit = this.bodyTopRow + Math.min(this.rowLimit, Math.ceil(heightLimit / defaultRowHeight)); + } + createGroupForFirstScreen( cornerHeaderGroup: Group, colHeaderGroup: Group, diff --git a/packages/vtable/src/scenegraph/scenegraph.ts b/packages/vtable/src/scenegraph/scenegraph.ts index 2e02d6bd2..1cfa6a7d5 100644 --- a/packages/vtable/src/scenegraph/scenegraph.ts +++ b/packages/vtable/src/scenegraph/scenegraph.ts @@ -772,6 +772,9 @@ export class Scenegraph { } resize() { + // reset proxy config + this.proxy.resize(); + if (this.table.widthMode === 'adaptive' || this.table.autoFillWidth) { if (this.table.internalProps._widthResizedColMap.size === 0) { //如果没有手动调整过行高列宽 则重新计算一遍并重新分配 @@ -806,6 +809,8 @@ export class Scenegraph { ) { this.updateChartSize(this.table.rowHeaderLevelCount); } + + this.proxy.progress(); // this.stage.window.resize(width, height); this.updateNextFrame(); } From 62eb6885169dc5a1e061aa0914584fa9a4bc6baa Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 15:01:42 +0800 Subject: [PATCH 11/35] feat: move seqId into layout class --- .../vtable/src/layout/pivot-header-layout.ts | 23 +++++++++++-------- .../vtable/src/layout/pivot-layout-helper.ts | 7 ++++-- .../vtable/src/layout/simple-header-layout.ts | 7 +++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index e7571d2a2..a18d94f2c 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -44,11 +44,12 @@ import type { ITableAxisOption } from '../ts-types/component/axis'; import { getQuadProps } from '../scenegraph/utils/padding'; import { getAxisConfigInPivotChart } from './chart-helper/get-axis-config'; -export const sharedVar = { seqId: 0 }; +// export const sharedVar = { seqId: 0 }; let colIndex = 0; const defaultDimension = { startInTotal: 0, level: 0 }; export class PivotHeaderLayoutMap implements LayoutMapAPI { + sharedVar: { seqId: number }; _showHeader = true; rowDimensionTree: DimensionTree; columnDimensionTree: DimensionTree; @@ -127,6 +128,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { _chartPadding?: number | number[]; //#endregion constructor(table: PivotTable | PivotChart, dataset: Dataset) { + this.sharedVar = { seqId: 0 }; this._table = table; if ((table as PivotTable).options.rowHierarchyType === 'tree') { this.extensionRows = (table as PivotTable).options.extensionRows; @@ -192,9 +194,10 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.indicatorKeys.push(indicator.indicatorKey); } }); - this.columnDimensionTree = new DimensionTree((this.columnTree as IPivotLayoutHeadNode[]) ?? []); + this.columnDimensionTree = new DimensionTree((this.columnTree as IPivotLayoutHeadNode[]) ?? [], this.sharedVar); this.rowDimensionTree = new DimensionTree( (this.rowTree as IPivotLayoutHeadNode[]) ?? [], + this.sharedVar, this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined ); @@ -215,7 +218,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } // if (typeof this.showColumnHeader !== 'boolean') { if (this.columnHeaderTitle) { - const id = ++sharedVar.seqId; + const id = ++this.sharedVar.seqId; const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id); this._columnHeaderCellIds.unshift(firstRowIds); const cell: HeaderData = { @@ -259,7 +262,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } // if (typeof this.showRowHeader !== 'boolean') { if (this.rowHeaderTitle) { - const id = ++sharedVar.seqId; + const id = ++this.sharedVar.seqId; const firstColIds = Array(this._rowHeaderCellIds_FULL[0]?.length ?? this.rowDimensionTree.tree.size).fill(id); this._rowHeaderCellIds_FULL.unshift(firstColIds); const cell: HeaderData = { @@ -514,7 +517,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } if (!isValid(this._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) { this._indicators?.push({ - id: ++sharedVar.seqId, + id: ++this.sharedVar.seqId, indicatorKey: indicatorInfo.indicatorKey, field: indicatorInfo.indicatorKey, fieldFormat: indicatorInfo?.format, @@ -537,7 +540,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { //兼容当某个指标没有设置在dimension.indicators中 if (!isValid(this._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) { this._indicators?.push({ - id: ++sharedVar.seqId, + id: ++this.sharedVar.seqId, indicatorKey: hd.indicatorKey, field: hd.indicatorKey, cellType: 'text', @@ -684,7 +687,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { const results: HeaderData[] = []; if (dimensionKeys) { dimensionKeys.forEach((dimensionKey: string | number, key: number) => { - const id = ++sharedVar.seqId; + const id = ++this.sharedVar.seqId; // const dimensionInfo: IDimension = // (this.rowsDefine?.find(dimension => // typeof dimension === 'string' ? false : dimension.dimensionKey === dimensionKey @@ -741,7 +744,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } }); } else { - const id = ++sharedVar.seqId; + const id = ++this.sharedVar.seqId; const cell: HeaderData = { id, title: '', @@ -791,7 +794,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this._rowHeaderExtensionTree[key].reset(this._rowHeaderExtensionTree[key].tree.children, true); rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]; } else { - rowExtensionDimensionTree = new DimensionTree(tree ?? [], this.rowHierarchyType, undefined); + rowExtensionDimensionTree = new DimensionTree(tree ?? [], this.sharedVar, this.rowHierarchyType, undefined); this._rowHeaderExtensionTree[key] = rowExtensionDimensionTree; } @@ -1792,7 +1795,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { ); if (this.rowHeaderTitle) { - const id = ++sharedVar.seqId; + const id = ++this.sharedVar.seqId; const firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id); this._rowHeaderCellIds_FULL.unshift(firstColIds); const cell: HeaderData = { diff --git a/packages/vtable/src/layout/pivot-layout-helper.ts b/packages/vtable/src/layout/pivot-layout-helper.ts index eff56e42c..a6d2cfc49 100644 --- a/packages/vtable/src/layout/pivot-layout-helper.ts +++ b/packages/vtable/src/layout/pivot-layout-helper.ts @@ -3,7 +3,7 @@ import { IndicatorDimensionKeyPlaceholder } from '../tools/global'; import type { Either } from '../tools/helper'; import type { CellInfo, ColumnIconOption, ICustomRender, LayoutObjectId } from '../ts-types'; import { HierarchyState } from '../ts-types'; -import { sharedVar } from './pivot-header-layout'; +// import { sharedVar } from './pivot-header-layout'; interface IPivotLayoutBaseHeadNode { id: number; @@ -32,6 +32,7 @@ interface IPivotLayoutIndicatorHeadNode extends IPivotLayoutBaseHeadNode { } export type IPivotLayoutHeadNode = Either; export class DimensionTree { + sharedVar: { seqId: number }; // 每一个值对应的序号 结果缓存 // cache: { // [propName: string]: any; @@ -63,12 +64,14 @@ export class DimensionTree { // dimensions: IDimension[] | undefined;//目前用不到这个 constructor( tree: IPivotLayoutHeadNode[], + sharedVar: { seqId: number }, hierarchyType: 'grid' | 'tree' = 'grid', rowExpandLevel: number = undefined ) { this.sizeIncludeParent = rowExpandLevel !== null && rowExpandLevel !== undefined; this.rowExpandLevel = rowExpandLevel; this.hierarchyType = hierarchyType; + this.sharedVar = sharedVar; this.reset(tree); } @@ -96,7 +99,7 @@ export class DimensionTree { !this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey) && this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey); if (!node.id) { - node.id = ++sharedVar.seqId; + node.id = ++this.sharedVar.seqId; } } let size = node.dimensionKey ? (this.sizeIncludeParent ? 1 : 0) : 0; diff --git a/packages/vtable/src/layout/simple-header-layout.ts b/packages/vtable/src/layout/simple-header-layout.ts index d189bf301..cb4bbb64a 100644 --- a/packages/vtable/src/layout/simple-header-layout.ts +++ b/packages/vtable/src/layout/simple-header-layout.ts @@ -14,8 +14,9 @@ import type { import { getChartDataId } from './chart-helper/get-chart-spec'; // import { EmptyDataCache } from './utils'; -let seqId = 0; +// let seqId = 0; export class SimpleHeaderLayoutMap implements LayoutMapAPI { + private seqId: number = 0; private _headerObjects: HeaderData[]; private _headerObjectMap: { [key in LayoutObjectId]: HeaderData }; // private _headerObjectFieldKey: { [key in string]: HeaderData }; @@ -612,7 +613,7 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { const rowCells = this._newRow(row, hideColumnsSubHeader); // !hideColumnsSubHeader ? this._headerCellIds[row] || this._newRow(row) : []; column.forEach((hd: ColumnDefine) => { const col = this._columns.length; - const id = seqId++; + const id = this.seqId++; const cell: HeaderData = { id, title: hd.title ?? (hd as any).caption, @@ -643,7 +644,7 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { } else { const colDef = hd; this._columns.push({ - id: seqId++, + id: this.seqId++, field: colDef.field, fieldKey: colDef.fieldKey, fieldFormat: colDef.fieldFormat, From 7e667de852e65a8a6cd5db780da84c1c5b5553f5 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 15:02:49 +0800 Subject: [PATCH 12/35] fix: fix disable dirty bounds error --- packages/vtable/src/scenegraph/graphic/group.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/vtable/src/scenegraph/graphic/group.ts b/packages/vtable/src/scenegraph/graphic/group.ts index 49254edb5..50e280c3f 100644 --- a/packages/vtable/src/scenegraph/graphic/group.ts +++ b/packages/vtable/src/scenegraph/graphic/group.ts @@ -292,6 +292,9 @@ export class Group extends VRenderGroup { } function after(group: Group, selfChange: boolean) { + if (!group.stage.dirtyBounds) { + return; + } if (!(group.stage && group.stage.renderCount)) { return; } From 05f80efcf1cb447fbbd2e02471712a0bcaf03e65 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 6 Dec 2023 15:10:21 +0800 Subject: [PATCH 13/35] fix: updateOption to update updateEventBinder --- packages/vtable/src/ListTable.ts | 13 ++++++++++--- packages/vtable/src/PivotChart.ts | 9 ++++++--- packages/vtable/src/PivotTable.ts | 8 ++++++-- packages/vtable/src/core/BaseTable.ts | 2 +- packages/vtable/src/event/event.ts | 16 +++++++++++++++- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/packages/vtable/src/ListTable.ts b/packages/vtable/src/ListTable.ts index dafbf93c5..84ac5f95b 100644 --- a/packages/vtable/src/ListTable.ts +++ b/packages/vtable/src/ListTable.ts @@ -144,6 +144,7 @@ export class ListTable extends BaseTable implements ListTableAPI { this.scenegraph.createSceneGraph(); this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row); this.renderAsync(); + this.eventManager.updateEventBinder(); } /** *@deprecated 请使用columns @@ -427,7 +428,9 @@ export class ListTable extends BaseTable implements ListTableAPI { table.frozenRowCount = 0; // table.frozenColCount = layoutMap.headerLevelCount; //这里不要这样写 这个setter会检查扁头宽度 可能将frozenColCount置为0 this.internalProps.frozenColCount = layoutMap.headerLevelCount ?? 0; - table.rightFrozenColCount = this.options.rightFrozenColCount ?? 0; + if (table.rightFrozenColCount !== (this.options.rightFrozenColCount ?? 0)) { + table.rightFrozenColCount = this.options.rightFrozenColCount ?? 0; + } } else { table.colCount = layoutMap.colCount ?? 0; table.rowCount = @@ -436,8 +439,12 @@ export class ListTable extends BaseTable implements ListTableAPI { this.internalProps.frozenColCount = this.options.frozenColCount ?? 0; table.frozenRowCount = layoutMap.headerLevelCount; - table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0; - table.rightFrozenColCount = this.options.rightFrozenColCount ?? 0; + if (table.bottomFrozenRowCount !== (this.options.bottomFrozenRowCount ?? 0)) { + table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0; + } + if (table.rightFrozenColCount !== (this.options.rightFrozenColCount ?? 0)) { + table.rightFrozenColCount = this.options.rightFrozenColCount ?? 0; + } } this.stateManager.setFrozenCol(this.internalProps.frozenColCount); } diff --git a/packages/vtable/src/PivotChart.ts b/packages/vtable/src/PivotChart.ts index 9347c9b7c..c276fe00f 100644 --- a/packages/vtable/src/PivotChart.ts +++ b/packages/vtable/src/PivotChart.ts @@ -311,9 +311,12 @@ export class PivotChart extends BaseTable implements PivotChartAPI { // table.frozenColCount = layoutMap.rowHeaderLevelCount; //这里不要这样写 这个setter会检查扁头宽度 可能将frozenColCount置为0 table.internalProps.frozenColCount = layoutMap.rowHeaderLevelCount ?? 0; table.frozenRowCount = layoutMap.headerLevelCount; - - table.bottomFrozenRowCount = layoutMap?.bottomFrozenRowCount ?? 0; - table.rightFrozenColCount = layoutMap?.rightFrozenColCount ?? 0; + if (table.bottomFrozenRowCount !== (layoutMap?.bottomFrozenRowCount ?? 0)) { + table.bottomFrozenRowCount = layoutMap?.bottomFrozenRowCount ?? 0; + } + if (table.rightFrozenColCount !== (layoutMap?.rightFrozenColCount ?? 0)) { + table.rightFrozenColCount = layoutMap?.rightFrozenColCount ?? 0; + } this.stateManager.setFrozenCol(this.internalProps.frozenColCount); } protected _getSortFuncFromHeaderOption( diff --git a/packages/vtable/src/PivotTable.ts b/packages/vtable/src/PivotTable.ts index 32d56cd06..c90e4e2eb 100644 --- a/packages/vtable/src/PivotTable.ts +++ b/packages/vtable/src/PivotTable.ts @@ -413,8 +413,12 @@ export class PivotTable extends BaseTable implements PivotTableAPI { table.internalProps.frozenColCount = layoutMap.rowHeaderLevelCount ?? 0; table.frozenRowCount = layoutMap.headerLevelCount; - table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0; - table.rightFrozenColCount = this.options.rightFrozenColCount ?? 0; + if (table.bottomFrozenRowCount !== (this.options.bottomFrozenRowCount ?? 0)) { + table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0; + } + if (table.rightFrozenColCount !== (this.options.rightFrozenColCount ?? 0)) { + table.rightFrozenColCount = this.options.rightFrozenColCount ?? 0; + } this.stateManager.setFrozenCol(this.internalProps.frozenColCount); } protected _getSortFuncFromHeaderOption( diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 61c875d04..58d12167c 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1954,7 +1954,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { this._updateSize(); // this.stateManager = new StateManager(this); // this.eventManager = new EventManager(this); - + this.eventManager.updateEventBinder(); if (options.legends) { internalProps.legends = createLegend(options.legends, this); this.scenegraph.tableGroup.setAttributes({ diff --git a/packages/vtable/src/event/event.ts b/packages/vtable/src/event/event.ts index 32badd941..029039d31 100644 --- a/packages/vtable/src/event/event.ts +++ b/packages/vtable/src/event/event.ts @@ -38,6 +38,7 @@ export class EventManager { touchEnd: boolean; // is touch event end when default touch event listener response touchMove: boolean; // is touch listener working, use to disable document touch scrolling function gesture: Gesture; + handleTextStickBindId: number; constructor(table: BaseTableAPI) { this.table = table; if (Env.mode === 'node') { @@ -57,6 +58,19 @@ export class EventManager { bindTouchListener(this); bindGesture(this); } + updateEventBinder() { + setTimeout(() => { + // 处理textStick 是否绑定SCROLL的判断 + if (checkHaveTextStick(this.table) && !this.handleTextStickBindId) { + this.handleTextStickBindId = this.table.on(TABLE_EVENT_TYPE.SCROLL, e => { + handleTextStick(this.table); + }); + } else if (!checkHaveTextStick(this.table) && this.handleTextStickBindId) { + this.table.off(this.handleTextStickBindId); + this.handleTextStickBindId = undefined; + } + }, 0); + } bindSelfEvent() { if (this.table.isReleased) { return; @@ -89,7 +103,7 @@ export class EventManager { // 处理textStick if (checkHaveTextStick(this.table)) { - this.table.on(TABLE_EVENT_TYPE.SCROLL, e => { + this.handleTextStickBindId = this.table.on(TABLE_EVENT_TYPE.SCROLL, e => { handleTextStick(this.table); }); } From 694b59e1ab2b7ab708174bd31d2a31f53d9fc8e9 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 6 Dec 2023 15:31:45 +0800 Subject: [PATCH 14/35] fix: updateOption to update updateEventBinder --- packages/vtable/src/PivotChart.ts | 1 + packages/vtable/src/PivotTable.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/vtable/src/PivotChart.ts b/packages/vtable/src/PivotChart.ts index c276fe00f..0c86e22d8 100644 --- a/packages/vtable/src/PivotChart.ts +++ b/packages/vtable/src/PivotChart.ts @@ -1176,5 +1176,6 @@ export class PivotChart extends BaseTable implements PivotChartAPI { this.internalProps.title.resize(); this.scenegraph.resize(); } + this.eventManager.updateEventBinder(); } } diff --git a/packages/vtable/src/PivotTable.ts b/packages/vtable/src/PivotTable.ts index c90e4e2eb..bd8318030 100644 --- a/packages/vtable/src/PivotTable.ts +++ b/packages/vtable/src/PivotTable.ts @@ -946,6 +946,7 @@ export class PivotTable extends BaseTable implements PivotTableAPI { this.internalProps.title.resize(); this.scenegraph.resize(); } + this.eventManager.updateEventBinder(); } /** 获取单元格对应的编辑器 */ getEditor(col: number, row: number) { From bd18fe6e32722ffe7afd796ef78f8508827097c6 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 6 Dec 2023 15:32:03 +0800 Subject: [PATCH 15/35] docs: update changlog of rush --- ...g-forbid-vtable-sort-invalid_2023-12-06-07-32.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/677-bug-forbid-vtable-sort-invalid_2023-12-06-07-32.json diff --git a/common/changes/@visactor/vtable/677-bug-forbid-vtable-sort-invalid_2023-12-06-07-32.json b/common/changes/@visactor/vtable/677-bug-forbid-vtable-sort-invalid_2023-12-06-07-32.json new file mode 100644 index 000000000..859386c59 --- /dev/null +++ b/common/changes/@visactor/vtable/677-bug-forbid-vtable-sort-invalid_2023-12-06-07-32.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: updateOption to update updateEventBinder\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 95770e39ba037ce7d9682fdb1575d5437bbcd419 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 16:31:47 +0800 Subject: [PATCH 16/35] feat: optimize pivot header performance --- .../fix-bug-fix-0.15.4_2023-12-06-08-31.json | 10 + .../vtable/src/layout/pivot-header-layout.ts | 237 +++--------------- .../vtable/src/layout/pivot-layout-helper.ts | 230 ++++++++++++++++- .../scenegraph/layout/compute-row-height.ts | 44 +++- 4 files changed, 311 insertions(+), 210 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-08-31.json diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-08-31.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-08-31.json new file mode 100644 index 000000000..e5f8dd4a3 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-08-31.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: optimize pivot header performance", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index a18d94f2c..82b563d75 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -36,7 +36,13 @@ import type { ILinkDimension } from '../ts-types/pivot-table/dimension/link-dime import type { IImageDimension } from '../ts-types/pivot-table/dimension/image-dimension'; import { getChartAxes, getChartDataId, getChartSpec, getRawChartSpec } from './chart-helper/get-chart-spec'; import type { LayouTreeNode, IPivotLayoutHeadNode } from './pivot-layout-helper'; -import { DimensionTree, countLayoutTree, generateLayoutTree } from './pivot-layout-helper'; +import { + DimensionTree, + countLayoutTree, + dealHeader, + dealHeaderForTreeMode, + generateLayoutTree +} from './pivot-layout-helper'; import type { Dataset } from '../dataset/dataset'; import { cloneDeep, isArray, isValid } from '@visactor/vutils'; import type { TextStyle } from '../body-helper/style'; @@ -45,11 +51,12 @@ import { getQuadProps } from '../scenegraph/utils/padding'; import { getAxisConfigInPivotChart } from './chart-helper/get-axis-config'; // export const sharedVar = { seqId: 0 }; -let colIndex = 0; +// let colIndex = 0; const defaultDimension = { startInTotal: 0, level: 0 }; export class PivotHeaderLayoutMap implements LayoutMapAPI { sharedVar: { seqId: number }; + colIndex = 0; _showHeader = true; rowDimensionTree: DimensionTree; columnDimensionTree: DimensionTree; @@ -69,10 +76,10 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { columnsDefine: (IColumnDimension | string)[]; indicatorsDefine: (IIndicator | string)[]; columnPaths: number[][] = []; - private _headerObjects: HeaderData[] = []; + _headerObjects: HeaderData[] = []; private _headerObjectMap: { [key: LayoutObjectId]: HeaderData } = {}; // private _emptyDataCache = new EmptyDataCache(); - private _indicators: IndicatorData[] = []; + _indicators: IndicatorData[] = []; indicatorTitle: string; indicatorsAsCol = true; hideIndicatorName = false; @@ -244,7 +251,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } // } - colIndex = 0; + this.colIndex = 0; //生成行表头单元格 if (this.rowDimensionTree.tree.children?.length >= 1) { this.rowHeaderObjs = @@ -354,7 +361,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } else { this.cornerHeaderObjs = this._addCornerHeaders(null, undefined); } - colIndex = 0; + this.colIndex = 0; this._headerObjectMap = this._headerObjects.reduce((o, e) => { o[e.id as number] = e; return o; @@ -441,15 +448,11 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.setColumnWidths(); } - private _addHeaders( - _headerCellIds: number[][], - row: number, - header: IPivotLayoutHeadNode[], - roots: number[] - ): HeaderData[] { + _addHeaders(_headerCellIds: number[][], row: number, header: IPivotLayoutHeadNode[], roots: number[]): HeaderData[] { + const _this = this; function _newRow(row: number): number[] { const newRow: number[] = (_headerCellIds[row] = []); - if (colIndex === 0) { + if (_this.colIndex === 0) { return newRow; } const prev = _headerCellIds[row - 1]; @@ -462,117 +465,14 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { if (!_headerCellIds[row]) { _newRow(row); } - header.forEach(hd => { - // const col = this._columns.length; - const id = hd.id; - const dimensionInfo: IDimension = - (this.rowsDefine?.find(dimension => - typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey - ) as IDimension) ?? - (this.columnsDefine?.find(dimension => - typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey - ) as IDimension); - const indicatorInfo = this.indicatorsDefine?.find(indicator => { - if (typeof indicator === 'string') { - return false; - } - if (hd.indicatorKey) { - return indicator.indicatorKey === hd.indicatorKey; - } - return indicator.title === hd.value; - }) as IIndicator; - const cell: HeaderData = { - id, - title: hd.value ?? indicatorInfo?.title, - field: hd.dimensionKey, - style: - typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function' - ? (indicatorInfo ?? dimensionInfo)?.headerStyle - : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle), - headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text', - headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon, - // define: hd, - define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo), - fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat, - // iconPositionList:[] - dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu, - pivotInfo: { - value: hd.value, - dimensionKey: hd.dimensionKey, - isPivotCorner: false - // customInfo: dimensionInfo?.customInfo - }, - width: (dimensionInfo as IRowDimension)?.width, - minWidth: (dimensionInfo as IRowDimension)?.minWidth, - maxWidth: (dimensionInfo as IRowDimension)?.maxWidth, - showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort, - description: dimensionInfo?.description - }; - if (indicatorInfo) { - //收集indicatorDimensionKey 提到了构造函数中 - // this.indicatorDimensionKey = dimensionInfo.dimensionKey; - if (indicatorInfo.customRender) { - hd.customRender = indicatorInfo.customRender; - } - if (!isValid(this._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) { - this._indicators?.push({ - id: ++this.sharedVar.seqId, - indicatorKey: indicatorInfo.indicatorKey, - field: indicatorInfo.indicatorKey, - fieldFormat: indicatorInfo?.format, - cellType: indicatorInfo?.cellType ?? (indicatorInfo as any)?.columnType ?? 'text', - chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null, - chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null, - sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null, - style: indicatorInfo?.style, - icon: indicatorInfo?.icon, - define: Object.assign({}, hd, indicatorInfo, { - dragHeader: dimensionInfo?.dragHeader - }), - width: indicatorInfo?.width, - minWidth: indicatorInfo?.minWidth, - maxWidth: indicatorInfo?.maxWidth, - disableColumnResize: indicatorInfo?.disableColumnResize - }); - } - } else if (hd.indicatorKey) { - //兼容当某个指标没有设置在dimension.indicators中 - if (!isValid(this._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) { - this._indicators?.push({ - id: ++this.sharedVar.seqId, - indicatorKey: hd.indicatorKey, - field: hd.indicatorKey, - cellType: 'text', - define: Object.assign({}, hd) - }); - } - } - // if (dimensionInfo.indicators) { - // this.hideIndicatorName = dimensionInfo.hideIndicatorName ?? false; - // this.indicatorsAsCol = dimensionInfo.indicatorsAsCol ?? true; - // } - results[id] = cell; - this._headerObjects[id] = cell; - _headerCellIds[row][colIndex] = id; - for (let r = row - 1; r >= 0; r--) { - _headerCellIds[r][colIndex] = roots[r]; - } - if ((hd as IPivotLayoutHeadNode).children?.length >= 1) { - this._addHeaders(_headerCellIds, row + 1, (hd as IPivotLayoutHeadNode).children ?? [], [...roots, id]).forEach( - c => results.push(c) - ); - } else { - // columns.push([""])//代码一个路径 - for (let r = row + 1; r < _headerCellIds.length; r++) { - _headerCellIds[r][colIndex] = id; - } - colIndex++; - } - }); + for (let i = 0; i < header.length; i++) { + const hd = header[i]; + dealHeader(hd, _headerCellIds, results, roots, row, this); + } return results; } - private _addHeadersForTreeMode( + _addHeadersForTreeMode( _headerCellIds: number[][], row: number, header: IPivotLayoutHeadNode[], @@ -581,9 +481,10 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { show: boolean, dimensions: (IDimension | string)[] ): HeaderData[] { + const _this = this; function _newRow(row: number): number[] { const newRow: number[] = (_headerCellIds[row] = []); - if (colIndex === 0) { + if (_this.colIndex === 0) { return newRow; } const prev = _headerCellIds[row - 1]; @@ -596,91 +497,11 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { if (!_headerCellIds[row]) { _newRow(row); } - header.forEach(hd => { - const id = hd.id; - // const dimensionInfo: IDimension = - // (this.rowsDefine?.find(dimension => - // typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey - // ) as IDimension) ?? - // (this.columnsDefine?.find(dimension => - // typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey - // ) as IDimension); - const dimensionInfo: IDimension = dimensions.find(dimension => - typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey - ) as IDimension; - - const cell: HeaderData = { - id, - title: hd.value, - field: hd.dimensionKey as FieldData, - //如果不是整棵树的叶子节点,都靠左显示 - style: - hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function' - ? dimensionInfo?.headerStyle - : Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }), - headerType: dimensionInfo?.headerType ?? 'text', - headerIcon: dimensionInfo?.headerIcon, - define: Object.assign(hd, { - linkJump: (dimensionInfo as ILinkDimension)?.linkJump, - linkDetect: (dimensionInfo as ILinkDimension)?.linkDetect, - templateLink: (dimensionInfo as ILinkDimension)?.templateLink, - - // image相关 to be fixed - keepAspectRatio: (dimensionInfo as IImageDimension)?.keepAspectRatio ?? false, - imageAutoSizing: (dimensionInfo as IImageDimension)?.imageAutoSizing, - - headerCustomRender: dimensionInfo?.headerCustomRender, - headerCustomLayout: dimensionInfo?.headerCustomLayout, - dragHeader: dimensionInfo?.dragHeader - }), //这里不能新建对象,要用hd保持引用关系 - fieldFormat: dimensionInfo?.headerFormat, - // iconPositionList:[] - dropDownMenu: dimensionInfo?.dropDownMenu, - pivotInfo: { - value: hd.value, - dimensionKey: hd.dimensionKey as string, - isPivotCorner: false - // customInfo: dimensionInfo?.customInfo - }, - hierarchyLevel: hd.level, - dimensionTotalLevel: totalLevel, - hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState, - width: (dimensionInfo as IRowDimension)?.width, - minWidth: (dimensionInfo as IRowDimension)?.minWidth, - maxWidth: (dimensionInfo as IRowDimension)?.maxWidth, - parentCellId: roots[roots.length - 1] - }; - results[id] = cell; - // this._cellIdDiemnsionMap.set(id, { - // dimensionKey: hd.dimensionKey, - // value: hd.value - // }); - this._headerObjects[id] = cell; - _headerCellIds[row][colIndex] = id; - for (let r = row - 1; r >= 0; r--) { - _headerCellIds[r][colIndex] = roots[r]; - } - if (hd.hierarchyState === HierarchyState.expand && (hd as IPivotLayoutHeadNode).children?.length >= 1) { - //row传值 colIndex++和_addHeaders有区别 - show && colIndex++; - this._addHeadersForTreeMode( - _headerCellIds, - row, - (hd as IPivotLayoutHeadNode).children ?? [], - [...roots, id], - totalLevel, - show && hd.hierarchyState === HierarchyState.expand, //当前节点show 且当前节点状态为展开 则传给子节点为show:true - dimensions - ).forEach(c => results.push(c)); - } else { - // columns.push([""])//代码一个路径 - show && colIndex++; - for (let r = row + 1; r < _headerCellIds.length; r++) { - _headerCellIds[r][colIndex] = id; - } - } - }); + for (let i = 0; i < header.length; i++) { + const hd = header[i]; + dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, this); + } return results; } private _addCornerHeaders(dimensionKeys: (string | number)[] | null, dimensions: (string | IDimension)[]) { @@ -776,7 +597,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this._rowHeaderCellIds_FULL = []; old_rowHeaderCellIds.forEach((row_ids: number[], index) => { const key = row_ids[row_ids.length - 1]; - colIndex = 0; + this.colIndex = 0; let tree; if (typeof extensionRow.rowTree === 'function') { const fullCellIds = this.findFullCellIds(row_ids); @@ -1825,7 +1646,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { if (this.rowHierarchyType === 'tree' && this.extensionRows?.length >= 1) { this.generateExtensionRowTree(); } - colIndex = 0; + this.colIndex = 0; this._headerObjectMap = this._headerObjects.reduce((o, e) => { o[e.id as number] = e; return o; diff --git a/packages/vtable/src/layout/pivot-layout-helper.ts b/packages/vtable/src/layout/pivot-layout-helper.ts index a6d2cfc49..27cfe15fd 100644 --- a/packages/vtable/src/layout/pivot-layout-helper.ts +++ b/packages/vtable/src/layout/pivot-layout-helper.ts @@ -1,8 +1,22 @@ +import { isValid } from '@visactor/vutils'; import { NumberMap } from '../tools/NumberMap'; import { IndicatorDimensionKeyPlaceholder } from '../tools/global'; import type { Either } from '../tools/helper'; -import type { CellInfo, ColumnIconOption, ICustomRender, LayoutObjectId } from '../ts-types'; +import type { + CellInfo, + ColumnIconOption, + FieldData, + HeaderData, + ICustomRender, + IDimension, + IIndicator, + IRowDimension, + LayoutObjectId +} from '../ts-types'; import { HierarchyState } from '../ts-types'; +import type { PivotHeaderLayoutMap } from './pivot-header-layout'; +import type { ILinkDimension } from '../ts-types/pivot-table/dimension/link-dimension'; +import type { IImageDimension } from '../ts-types/pivot-table/dimension/image-dimension'; // import { sharedVar } from './pivot-header-layout'; interface IPivotLayoutBaseHeadNode { @@ -306,3 +320,217 @@ export function countLayoutTree(children: { children?: any }[], countParentNode: return count; } //#endregion + +export function dealHeader( + hd: IPivotLayoutHeadNode, + _headerCellIds: number[][], + results: HeaderData[], + roots: number[], + row: number, + layoutMap: PivotHeaderLayoutMap +) { + // const col = this._columns.length; + const id = hd.id; + const dimensionInfo: IDimension = + (layoutMap.rowsDefine?.find(dimension => + typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey + ) as IDimension) ?? + (layoutMap.columnsDefine?.find(dimension => + typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey + ) as IDimension); + const indicatorInfo = layoutMap.indicatorsDefine?.find(indicator => { + if (typeof indicator === 'string') { + return false; + } + if (hd.indicatorKey) { + return indicator.indicatorKey === hd.indicatorKey; + } + return indicator.title === hd.value; + }) as IIndicator; + const cell: HeaderData = { + id, + title: hd.value ?? indicatorInfo?.title, + field: hd.dimensionKey, + style: + typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function' + ? (indicatorInfo ?? dimensionInfo)?.headerStyle + : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle), + headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text', + headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon, + // define: hd, + define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo), + fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat, + // iconPositionList:[] + dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu, + pivotInfo: { + value: hd.value, + dimensionKey: hd.dimensionKey, + isPivotCorner: false + // customInfo: dimensionInfo?.customInfo + }, + width: (dimensionInfo as IRowDimension)?.width, + minWidth: (dimensionInfo as IRowDimension)?.minWidth, + maxWidth: (dimensionInfo as IRowDimension)?.maxWidth, + showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort, + description: dimensionInfo?.description + }; + + if (indicatorInfo) { + //收集indicatorDimensionKey 提到了构造函数中 + // this.indicatorDimensionKey = dimensionInfo.dimensionKey; + if (indicatorInfo.customRender) { + hd.customRender = indicatorInfo.customRender; + } + if (!isValid(layoutMap._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) { + layoutMap._indicators?.push({ + id: ++layoutMap.sharedVar.seqId, + indicatorKey: indicatorInfo.indicatorKey, + field: indicatorInfo.indicatorKey, + fieldFormat: indicatorInfo?.format, + cellType: indicatorInfo?.cellType ?? (indicatorInfo as any)?.columnType ?? 'text', + chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null, + chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null, + sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null, + style: indicatorInfo?.style, + icon: indicatorInfo?.icon, + define: Object.assign({}, hd, indicatorInfo, { + dragHeader: dimensionInfo?.dragHeader + }), + width: indicatorInfo?.width, + minWidth: indicatorInfo?.minWidth, + maxWidth: indicatorInfo?.maxWidth, + disableColumnResize: indicatorInfo?.disableColumnResize + }); + } + } else if (hd.indicatorKey) { + //兼容当某个指标没有设置在dimension.indicators中 + if (!isValid(layoutMap._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) { + layoutMap._indicators?.push({ + id: ++layoutMap.sharedVar.seqId, + indicatorKey: hd.indicatorKey, + field: hd.indicatorKey, + cellType: 'text', + define: Object.assign({}, hd) + }); + } + } + // if (dimensionInfo.indicators) { + // layoutMap.hideIndicatorName = dimensionInfo.hideIndicatorName ?? false; + // layoutMap.indicatorsAsCol = dimensionInfo.indicatorsAsCol ?? true; + // } + results[id] = cell; + layoutMap._headerObjects[id] = cell; + _headerCellIds[row][layoutMap.colIndex] = id; + for (let r = row - 1; r >= 0; r--) { + _headerCellIds[r][layoutMap.colIndex] = roots[r]; + } + if ((hd as IPivotLayoutHeadNode).children?.length >= 1) { + layoutMap + ._addHeaders(_headerCellIds, row + 1, (hd as IPivotLayoutHeadNode).children ?? [], [...roots, id]) + .forEach(c => results.push(c)); + } else { + // columns.push([""])//代码一个路径 + for (let r = row + 1; r < _headerCellIds.length; r++) { + _headerCellIds[r][layoutMap.colIndex] = id; + } + layoutMap.colIndex++; + } +} + +export function dealHeaderForTreeMode( + hd: IPivotLayoutHeadNode, + _headerCellIds: number[][], + results: HeaderData[], + roots: number[], + row: number, + totalLevel: number, + show: boolean, + dimensions: (IDimension | string)[], + layoutMap: PivotHeaderLayoutMap +) { + const id = hd.id; + // const dimensionInfo: IDimension = + // (this.rowsDefine?.find(dimension => + // typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey + // ) as IDimension) ?? + // (this.columnsDefine?.find(dimension => + // typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey + // ) as IDimension); + const dimensionInfo: IDimension = dimensions.find(dimension => + typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey + ) as IDimension; + + const cell: HeaderData = { + id, + title: hd.value, + field: hd.dimensionKey as FieldData, + //如果不是整棵树的叶子节点,都靠左显示 + style: + hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function' + ? dimensionInfo?.headerStyle + : Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }), + headerType: dimensionInfo?.headerType ?? 'text', + headerIcon: dimensionInfo?.headerIcon, + define: Object.assign(hd, { + linkJump: (dimensionInfo as ILinkDimension)?.linkJump, + linkDetect: (dimensionInfo as ILinkDimension)?.linkDetect, + templateLink: (dimensionInfo as ILinkDimension)?.templateLink, + + // image相关 to be fixed + keepAspectRatio: (dimensionInfo as IImageDimension)?.keepAspectRatio ?? false, + imageAutoSizing: (dimensionInfo as IImageDimension)?.imageAutoSizing, + + headerCustomRender: dimensionInfo?.headerCustomRender, + headerCustomLayout: dimensionInfo?.headerCustomLayout, + dragHeader: dimensionInfo?.dragHeader + }), //这里不能新建对象,要用hd保持引用关系 + fieldFormat: dimensionInfo?.headerFormat, + // iconPositionList:[] + dropDownMenu: dimensionInfo?.dropDownMenu, + pivotInfo: { + value: hd.value, + dimensionKey: hd.dimensionKey as string, + isPivotCorner: false + // customInfo: dimensionInfo?.customInfo + }, + hierarchyLevel: hd.level, + dimensionTotalLevel: totalLevel, + hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState, + width: (dimensionInfo as IRowDimension)?.width, + minWidth: (dimensionInfo as IRowDimension)?.minWidth, + maxWidth: (dimensionInfo as IRowDimension)?.maxWidth, + parentCellId: roots[roots.length - 1] + }; + + results[id] = cell; + // this._cellIdDiemnsionMap.set(id, { + // dimensionKey: hd.dimensionKey, + // value: hd.value + // }); + layoutMap._headerObjects[id] = cell; + _headerCellIds[row][layoutMap.colIndex] = id; + for (let r = row - 1; r >= 0; r--) { + _headerCellIds[r][layoutMap.colIndex] = roots[r]; + } + if (hd.hierarchyState === HierarchyState.expand && (hd as IPivotLayoutHeadNode).children?.length >= 1) { + //row传值 colIndex++和_addHeaders有区别 + show && layoutMap.colIndex++; + layoutMap + ._addHeadersForTreeMode( + _headerCellIds, + row, + (hd as IPivotLayoutHeadNode).children ?? [], + [...roots, id], + totalLevel, + show && hd.hierarchyState === HierarchyState.expand, //当前节点show 且当前节点状态为展开 则传给子节点为show:true + dimensions + ) + .forEach(c => results.push(c)); + } else { + // columns.push([""])//代码一个路径 + show && layoutMap.colIndex++; + for (let r = row + 1; r < _headerCellIds.length; r++) { + _headerCellIds[r][layoutMap.colIndex] = id; + } + } +} diff --git a/packages/vtable/src/scenegraph/layout/compute-row-height.ts b/packages/vtable/src/scenegraph/layout/compute-row-height.ts index bd27ba14c..ecdc7f8dd 100644 --- a/packages/vtable/src/scenegraph/layout/compute-row-height.ts +++ b/packages/vtable/src/scenegraph/layout/compute-row-height.ts @@ -67,8 +67,15 @@ export function computeRowsHeight( // compute header row in column header row for (let row = rowStart; row < table.columnHeaderLevelCount; row++) { + let startCol = 0; + let endCol = table.colCount - 1; + if ((table.isPivotTable() || table.isPivotChart()) && checkPivotFixedStyleAndNoWrap(table, row)) { + // 列表头样式一致,只计算第一列行高,作为整行行高 + startCol = 0; + endCol = table.rowHeaderLevelCount; + } if (isAllRowsAuto || table.getDefaultRowHeight(row) === 'auto') { - const height = computeRowHeight(row, 0, table.colCount - 1, table); + const height = computeRowHeight(row, startCol, endCol, table); if (update) { newHeights[row] = height; } else { @@ -338,6 +345,7 @@ function checkFixedStyleAndNoWrap(table: BaseTableAPI): boolean { typeof cellDefine.style === 'function' || typeof (cellDefine as ColumnData).icon === 'function' || cellDefine.define?.customRender || + cellDefine.define?.customLayout || typeof cellDefine.define?.icon === 'function' ) { return false; @@ -371,6 +379,7 @@ function checkFixedStyleAndNoWrapForTranspose(table: BaseTableAPI, row: number): typeof cellDefine.style === 'function' || typeof (cellDefine as ColumnData).icon === 'function' || cellDefine.define?.customRender || + cellDefine.define?.customLayout || typeof cellDefine.define?.icon === 'function' ) { return false; @@ -388,6 +397,39 @@ function checkFixedStyleAndNoWrapForTranspose(table: BaseTableAPI, row: number): return true; } +function checkPivotFixedStyleAndNoWrap(table: BaseTableAPI, row: number) { + const { layoutMap } = table.internalProps; + //设置了全局自动换行的话 不能复用高度计算 + if ( + table.internalProps.autoWrapText && + (table.options.heightMode === 'autoHeight' || table.options.heightMode === 'adaptive') + ) { + return false; + } + + const headerDefine = layoutMap.getHeader(table.rowHeaderLevelCount, row); + if ( + typeof headerDefine.style === 'function' || + typeof (headerDefine as HeaderData).icons === 'function' || + headerDefine.define?.headerCustomRender || + headerDefine.define?.headerCustomLayout || + typeof headerDefine.define?.icon === 'function' + ) { + return false; + } + const headerStyle = table._getCellStyle(table.rowHeaderLevelCount, row); + if ( + typeof headerStyle.padding === 'function' || + typeof headerStyle.fontSize === 'function' || + typeof headerStyle.lineHeight === 'function' || + headerStyle.autoWrapText === true + ) { + return false; + } + + return true; +} + function fillRowsHeight( height: number, startRow: number, From 4f0b8e815a6ee17166a3a833ad9807ed5499541f Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 17:24:21 +0800 Subject: [PATCH 17/35] fix: add proxy release in table release --- packages/vtable/src/core/BaseTable.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index e61f9b462..218855611 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1806,6 +1806,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { } this.scenegraph.stage.release(); + this.scenegraph.proxy.release(); const { parentElement } = internalProps.element; if (parentElement) { From 5aad518047220e220c6c71d61cc1aaaed2f1ce44 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 18:05:12 +0800 Subject: [PATCH 18/35] fix: fix table frame shadow color --- .../fix-bug-fix-0.15.4_2023-12-06-10-04.json | 10 +++++ .../group-contribution-render.ts | 8 +++- .../vtable/src/scenegraph/graphic/group.ts | 13 +++++++ .../src/scenegraph/style/frame-border.ts | 37 ++++++++++++++++--- 4 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-10-04.json diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-10-04.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-10-04.json new file mode 100644 index 000000000..cf2f25fb1 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-10-04.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix table frame shadow color", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts index 067e61042..33f6d6a13 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts @@ -546,10 +546,12 @@ export class AdjustPosGroupBeforeRenderContribution implements IGroupRenderContr // width = groupAttribute.width, // height = groupAttribute.height, strokeArrayWidth = (groupAttribute as any).strokeArrayWidth, - strokeArrayColor = (groupAttribute as any).strokeArrayColor + strokeArrayColor = (groupAttribute as any).strokeArrayColor, + notAdjustPos } = group.attribute as any; if ( + notAdjustPos !== true && // 不需要调整位置 stroke && Array.isArray(lineDash) && !lineDash.length && // 非虚线 @@ -594,7 +596,8 @@ export class AdjustPosGroupAfterRenderContribution implements IGroupRenderContri stroke = groupAttribute.stroke, lineDash = groupAttribute.lineDash, strokeArrayWidth = (groupAttribute as any).strokeArrayWidth, - strokeArrayColor = (groupAttribute as any).strokeArrayColor + strokeArrayColor = (groupAttribute as any).strokeArrayColor, + notAdjustPos } = group.attribute as any; const { width = groupAttribute.width, height = groupAttribute.height } = group.attribute; @@ -602,6 +605,7 @@ export class AdjustPosGroupAfterRenderContribution implements IGroupRenderContri // height = Math.ceil(height); if ( + notAdjustPos !== true && // 不需要调整位置 stroke && Array.isArray(lineDash) && !lineDash.length && // 非虚线 diff --git a/packages/vtable/src/scenegraph/graphic/group.ts b/packages/vtable/src/scenegraph/graphic/group.ts index 50e280c3f..6c399670d 100644 --- a/packages/vtable/src/scenegraph/graphic/group.ts +++ b/packages/vtable/src/scenegraph/graphic/group.ts @@ -94,6 +94,13 @@ export class Group extends VRenderGroup { this.setAttribute('width', (this.attribute.width ?? 0) + deltaX); if (this.border) { this.border.setAttribute('width', this.border.attribute.width + deltaX); + + if (this.border.type === 'group') { + (this.border.firstChild as IRect).setAttribute( + 'width', + (this.border.firstChild as IRect).attribute.width + deltaX + ); + } } } @@ -104,6 +111,12 @@ export class Group extends VRenderGroup { this.setAttribute('height', (this.attribute.height ?? 0) + deltaY); if (this.border) { this.border.setAttribute('height', this.border.attribute.height + deltaY); + if (this.border.type === 'group') { + (this.border.firstChild as IRect).setAttribute( + 'width', + (this.border.firstChild as IRect).attribute.height + deltaY + ); + } } } diff --git a/packages/vtable/src/scenegraph/style/frame-border.ts b/packages/vtable/src/scenegraph/style/frame-border.ts index 9d902ff40..6ab197a03 100644 --- a/packages/vtable/src/scenegraph/style/frame-border.ts +++ b/packages/vtable/src/scenegraph/style/frame-border.ts @@ -1,5 +1,5 @@ -import type { IGroupGraphicAttribute, IRectGraphicAttribute } from '@visactor/vrender'; -import { createRect } from '@visactor/vrender'; +import type { IGroupGraphicAttribute, IRect, IRectGraphicAttribute } from '@visactor/vrender'; +import { createGroup, createRect } from '@visactor/vrender'; import type { TableFrameStyle } from '../../ts-types'; import type { Group } from '../graphic/group'; import { isArray } from '@visactor/vutils'; @@ -37,6 +37,7 @@ export function createFrameBorder( borderLineDash } = frameTheme; + let hasShadow = false; const groupAttributes: IGroupGraphicAttribute = {}; const rectAttributes: IRectGraphicAttribute = { pickable: false @@ -51,9 +52,10 @@ export function createFrameBorder( rectAttributes.stroke = true; rectAttributes.stroke = shadowColor; rectAttributes.lineWidth = 1; + hasShadow = true; - rectAttributes.fill = true; - rectAttributes.fillOpacity = 0.01; + // rectAttributes.fill = true; + // rectAttributes.fillOpacity = 0.01; } // 处理边框 @@ -118,8 +120,26 @@ export function createFrameBorder( rectAttributes.y = group.attribute.y - borderTop / 2; rectAttributes.width = group.attribute.width + borderLeft / 2 + borderRight / 2; rectAttributes.height = group.attribute.height + borderTop / 2 + borderBottom / 2; - const borderRect = createRect(rectAttributes); + + let shadowRect; + if (hasShadow) { + rectAttributes.fill = 'black'; + (rectAttributes as any).notAdjustPos = true; + shadowRect = createRect({ + x: borderLeft / 2, + y: borderTop / 2, + width: group.attribute.width, + height: group.attribute.height, + fill: 'red', + globalCompositeOperation: 'destination-out' + }); + } + + const borderRect = hasShadow ? createGroup(rectAttributes) : createRect(rectAttributes); borderRect.name = 'table-border-rect'; + if (shadowRect) { + borderRect.addChild(shadowRect); + } group.parent.insertBefore(borderRect, group); (group as any).border = borderRect; } else { @@ -196,4 +216,11 @@ export function updateFrameBorderSize(group: Group) { width: group.attribute.width - borderLeft / 2 - borderRight / 2, height: group.attribute.height - borderTop / 2 - borderBottom / 2 }); + + if (group.border.type === 'group') { + (group.border.firstChild as IRect).setAttributes({ + width: group.attribute.width, + height: group.attribute.height + }); + } } From 47ed495b1c77369976f461b689606f82466ef6fc Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 19:51:10 +0800 Subject: [PATCH 19/35] fix: fix cornerRadius attribute in shadowRect --- packages/vtable/src/scenegraph/style/frame-border.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/scenegraph/style/frame-border.ts b/packages/vtable/src/scenegraph/style/frame-border.ts index 6ab197a03..7e43207bf 100644 --- a/packages/vtable/src/scenegraph/style/frame-border.ts +++ b/packages/vtable/src/scenegraph/style/frame-border.ts @@ -123,7 +123,7 @@ export function createFrameBorder( let shadowRect; if (hasShadow) { - rectAttributes.fill = 'black'; + rectAttributes.fill = 'white'; (rectAttributes as any).notAdjustPos = true; shadowRect = createRect({ x: borderLeft / 2, @@ -131,6 +131,7 @@ export function createFrameBorder( width: group.attribute.width, height: group.attribute.height, fill: 'red', + cornerRadius: group.attribute.cornerRadius, globalCompositeOperation: 'destination-out' }); } From 7a552019201b0c140fb956bff30c99e9a7bf386e Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 20:50:33 +0800 Subject: [PATCH 20/35] fix: fix shadowRect&borderRect order --- .../vtable/src/scenegraph/style/frame-border.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/vtable/src/scenegraph/style/frame-border.ts b/packages/vtable/src/scenegraph/style/frame-border.ts index 7e43207bf..f05be3cf4 100644 --- a/packages/vtable/src/scenegraph/style/frame-border.ts +++ b/packages/vtable/src/scenegraph/style/frame-border.ts @@ -122,10 +122,14 @@ export function createFrameBorder( rectAttributes.height = group.attribute.height + borderTop / 2 + borderBottom / 2; let shadowRect; + let borderRect; if (hasShadow) { rectAttributes.fill = 'white'; (rectAttributes as any).notAdjustPos = true; - shadowRect = createRect({ + // first draw + shadowRect = createRect(rectAttributes); + // second draw + borderRect = createGroup({ x: borderLeft / 2, y: borderTop / 2, width: group.attribute.width, @@ -134,13 +138,13 @@ export function createFrameBorder( cornerRadius: group.attribute.cornerRadius, globalCompositeOperation: 'destination-out' }); - } - - const borderRect = hasShadow ? createGroup(rectAttributes) : createRect(rectAttributes); - borderRect.name = 'table-border-rect'; - if (shadowRect) { + borderRect.name = 'table-border-rect'; borderRect.addChild(shadowRect); + } else { + borderRect = createRect(rectAttributes); + borderRect.name = 'table-border-rect'; } + group.parent.insertBefore(borderRect, group); (group as any).border = borderRect; } else { From 41132ab1fde19bdb483de5da708f23b4e8c50b13 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 21:12:25 +0800 Subject: [PATCH 21/35] fix: fix border rect position --- packages/vtable/src/scenegraph/style/frame-border.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vtable/src/scenegraph/style/frame-border.ts b/packages/vtable/src/scenegraph/style/frame-border.ts index f05be3cf4..102c1e9be 100644 --- a/packages/vtable/src/scenegraph/style/frame-border.ts +++ b/packages/vtable/src/scenegraph/style/frame-border.ts @@ -116,8 +116,8 @@ export function createFrameBorder( rectAttributes.y = borderTop / 2; rectAttributes.pickable = false; if (isTableGroup) { - rectAttributes.x = group.attribute.x - borderLeft / 2; - rectAttributes.y = group.attribute.y - borderTop / 2; + rectAttributes.x = -borderLeft / 2; + rectAttributes.y = -borderTop / 2; rectAttributes.width = group.attribute.width + borderLeft / 2 + borderRight / 2; rectAttributes.height = group.attribute.height + borderTop / 2 + borderBottom / 2; @@ -130,8 +130,8 @@ export function createFrameBorder( shadowRect = createRect(rectAttributes); // second draw borderRect = createGroup({ - x: borderLeft / 2, - y: borderTop / 2, + x: group.attribute.x, + y: group.attribute.y, width: group.attribute.width, height: group.attribute.height, fill: 'red', From e1ef383e3a2b5f1540f32803c45debc972811822 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 6 Dec 2023 21:22:49 +0800 Subject: [PATCH 22/35] fix: temp reset shadow change --- packages/vtable/src/scenegraph/style/frame-border.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vtable/src/scenegraph/style/frame-border.ts b/packages/vtable/src/scenegraph/style/frame-border.ts index 102c1e9be..addc2e278 100644 --- a/packages/vtable/src/scenegraph/style/frame-border.ts +++ b/packages/vtable/src/scenegraph/style/frame-border.ts @@ -37,7 +37,7 @@ export function createFrameBorder( borderLineDash } = frameTheme; - let hasShadow = false; + const hasShadow = false; const groupAttributes: IGroupGraphicAttribute = {}; const rectAttributes: IRectGraphicAttribute = { pickable: false @@ -52,10 +52,10 @@ export function createFrameBorder( rectAttributes.stroke = true; rectAttributes.stroke = shadowColor; rectAttributes.lineWidth = 1; - hasShadow = true; + // hasShadow = true; - // rectAttributes.fill = true; - // rectAttributes.fillOpacity = 0.01; + rectAttributes.fill = true; + rectAttributes.fillOpacity = 0.01; } // 处理边框 From efd4be115e607c9b64d90c4f81266926010f1e39 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 7 Dec 2023 10:52:21 +0800 Subject: [PATCH 23/35] fix: fix border rect position --- .../src/scenegraph/style/frame-border.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/vtable/src/scenegraph/style/frame-border.ts b/packages/vtable/src/scenegraph/style/frame-border.ts index addc2e278..d0920cd40 100644 --- a/packages/vtable/src/scenegraph/style/frame-border.ts +++ b/packages/vtable/src/scenegraph/style/frame-border.ts @@ -37,7 +37,7 @@ export function createFrameBorder( borderLineDash } = frameTheme; - const hasShadow = false; + let hasShadow = false; const groupAttributes: IGroupGraphicAttribute = {}; const rectAttributes: IRectGraphicAttribute = { pickable: false @@ -52,10 +52,10 @@ export function createFrameBorder( rectAttributes.stroke = true; rectAttributes.stroke = shadowColor; rectAttributes.lineWidth = 1; - // hasShadow = true; + hasShadow = true; - rectAttributes.fill = true; - rectAttributes.fillOpacity = 0.01; + // rectAttributes.fill = true; + // rectAttributes.fillOpacity = 0.01; } // 处理边框 @@ -116,16 +116,17 @@ export function createFrameBorder( rectAttributes.y = borderTop / 2; rectAttributes.pickable = false; if (isTableGroup) { - rectAttributes.x = -borderLeft / 2; - rectAttributes.y = -borderTop / 2; + rectAttributes.x = group.attribute.x - borderLeft / 2; + rectAttributes.y = group.attribute.x - borderTop / 2; rectAttributes.width = group.attribute.width + borderLeft / 2 + borderRight / 2; rectAttributes.height = group.attribute.height + borderTop / 2 + borderBottom / 2; let shadowRect; let borderRect; if (hasShadow) { + rectAttributes.x = -borderLeft / 2; + rectAttributes.y = -borderTop / 2; rectAttributes.fill = 'white'; - (rectAttributes as any).notAdjustPos = true; // first draw shadowRect = createRect(rectAttributes); // second draw @@ -136,8 +137,9 @@ export function createFrameBorder( height: group.attribute.height, fill: 'red', cornerRadius: group.attribute.cornerRadius, - globalCompositeOperation: 'destination-out' - }); + globalCompositeOperation: 'destination-out', + notAdjustPos: true + } as any); borderRect.name = 'table-border-rect'; borderRect.addChild(shadowRect); } else { From f887c847f9c23c30585126e3d3274f32b3cab876 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 7 Dec 2023 11:23:00 +0800 Subject: [PATCH 24/35] fix: fix border rect position update --- packages/vtable/src/scenegraph/scenegraph.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/scenegraph/scenegraph.ts b/packages/vtable/src/scenegraph/scenegraph.ts index 1cfa6a7d5..9959f2934 100644 --- a/packages/vtable/src/scenegraph/scenegraph.ts +++ b/packages/vtable/src/scenegraph/scenegraph.ts @@ -833,13 +833,26 @@ export class Scenegraph { ) } as any); - if (this.tableGroup.border) { + if (this.tableGroup.border && this.tableGroup.border.type === 'rect') { this.tableGroup.border.setAttributes({ x: this.table.tableX - this.tableGroup.border.attribute.lineWidth / 2, y: this.table.tableY - this.tableGroup.border.attribute.lineWidth / 2, width: this.tableGroup.attribute.width + this.tableGroup.border.attribute.lineWidth, height: this.tableGroup.attribute.height + this.tableGroup.border.attribute.lineWidth }); + } else if (this.tableGroup.border && this.tableGroup.border.type === 'group') { + this.tableGroup.border.setAttributes({ + x: this.table.tableX, + y: this.table.tableY, + width: this.tableGroup.attribute.width, + height: this.tableGroup.attribute.height + }); + (this.tableGroup.border.firstChild as IRect)?.setAttributes({ + x: -this.tableGroup.border.attribute.lineWidth / 2, + y: -this.tableGroup.border.attribute.lineWidth / 2, + width: this.tableGroup.attribute.width + this.tableGroup.border.attribute.lineWidth, + height: this.tableGroup.attribute.height + this.tableGroup.border.attribute.lineWidth + }); } if (this.table.bottomFrozenRowCount > 0) { From d992cdf164c56d5f3a5c28d683f7c4b0448698f6 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 7 Dec 2023 15:11:39 +0800 Subject: [PATCH 25/35] fix: fix border rect position --- .../src/scenegraph/style/frame-border.ts | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/packages/vtable/src/scenegraph/style/frame-border.ts b/packages/vtable/src/scenegraph/style/frame-border.ts index d0920cd40..8101a5ec3 100644 --- a/packages/vtable/src/scenegraph/style/frame-border.ts +++ b/packages/vtable/src/scenegraph/style/frame-border.ts @@ -124,24 +124,34 @@ export function createFrameBorder( let shadowRect; let borderRect; if (hasShadow) { - rectAttributes.x = -borderLeft / 2; - rectAttributes.y = -borderTop / 2; rectAttributes.fill = 'white'; - // first draw - shadowRect = createRect(rectAttributes); - // second draw - borderRect = createGroup({ - x: group.attribute.x, - y: group.attribute.y, + (rectAttributes as any).notAdjustPos = true; + // rectAttributes.globalCompositeOperation = 'source-over'; + + // first draw group + borderRect = createGroup(rectAttributes); + borderRect.name = 'table-border-rect'; + + // second draw rect + shadowRect = createRect({ + x: borderLeft / 2, + y: borderTop / 2, width: group.attribute.width, height: group.attribute.height, fill: 'red', cornerRadius: group.attribute.cornerRadius, - globalCompositeOperation: 'destination-out', - notAdjustPos: true - } as any); - borderRect.name = 'table-border-rect'; + globalCompositeOperation: 'destination-out' + }); borderRect.addChild(shadowRect); + + // hack for vrender globalCompositeOperation&clip render problem + const hackRect = createRect({ + width: 1, + height: 1, + fill: 'transparent', + pickable: false + }); + borderRect.addChild(hackRect); } else { borderRect = createRect(rectAttributes); borderRect.name = 'table-border-rect'; From 77c062f1ae642cc82b402886afa40bd345c8dcf3 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 7 Dec 2023 15:39:24 +0800 Subject: [PATCH 26/35] fix: fix border rect position update --- packages/vtable/src/scenegraph/scenegraph.ts | 16 ++++++++-------- .../vtable/src/scenegraph/style/frame-border.ts | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/vtable/src/scenegraph/scenegraph.ts b/packages/vtable/src/scenegraph/scenegraph.ts index 9959f2934..77a8e8959 100644 --- a/packages/vtable/src/scenegraph/scenegraph.ts +++ b/packages/vtable/src/scenegraph/scenegraph.ts @@ -842,17 +842,17 @@ export class Scenegraph { }); } else if (this.tableGroup.border && this.tableGroup.border.type === 'group') { this.tableGroup.border.setAttributes({ - x: this.table.tableX, - y: this.table.tableY, - width: this.tableGroup.attribute.width, - height: this.tableGroup.attribute.height - }); - (this.tableGroup.border.firstChild as IRect)?.setAttributes({ - x: -this.tableGroup.border.attribute.lineWidth / 2, - y: -this.tableGroup.border.attribute.lineWidth / 2, + x: this.table.tableX - this.tableGroup.border.attribute.lineWidth / 2, + y: this.table.tableY - this.tableGroup.border.attribute.lineWidth / 2, width: this.tableGroup.attribute.width + this.tableGroup.border.attribute.lineWidth, height: this.tableGroup.attribute.height + this.tableGroup.border.attribute.lineWidth }); + (this.tableGroup.border.firstChild as IRect)?.setAttributes({ + x: this.tableGroup.border.attribute.lineWidth / 2, + y: this.tableGroup.border.attribute.lineWidth / 2, + width: this.tableGroup.attribute.width, + height: this.tableGroup.attribute.height + }); } if (this.table.bottomFrozenRowCount > 0) { diff --git a/packages/vtable/src/scenegraph/style/frame-border.ts b/packages/vtable/src/scenegraph/style/frame-border.ts index 8101a5ec3..25156769d 100644 --- a/packages/vtable/src/scenegraph/style/frame-border.ts +++ b/packages/vtable/src/scenegraph/style/frame-border.ts @@ -117,7 +117,7 @@ export function createFrameBorder( rectAttributes.pickable = false; if (isTableGroup) { rectAttributes.x = group.attribute.x - borderLeft / 2; - rectAttributes.y = group.attribute.x - borderTop / 2; + rectAttributes.y = group.attribute.y - borderTop / 2; rectAttributes.width = group.attribute.width + borderLeft / 2 + borderRight / 2; rectAttributes.height = group.attribute.height + borderTop / 2 + borderBottom / 2; From 8875846d500b0c4e101d3c4ea128fe14b7284a03 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 7 Dec 2023 16:58:02 +0800 Subject: [PATCH 27/35] fix: fix scroll position update problem --- .../fix-bug-fix-0.15.4_2023-12-07-08-57.json | 10 +++++++ .../vtable/examples/list/list-transpose.ts | 2 +- .../progress/update-position/dynamic-set-x.ts | 27 ++++++++++++++++--- .../progress/update-position/dynamic-set-y.ts | 18 +++++++------ packages/vtable/src/state/state.ts | 4 +++ 5 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-08-57.json diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-08-57.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-08-57.json new file mode 100644 index 000000000..b1c9af9d5 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-08-57.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix scroll position update problem", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/examples/list/list-transpose.ts b/packages/vtable/examples/list/list-transpose.ts index 96a4f890a..f1c3d282e 100644 --- a/packages/vtable/examples/list/list-transpose.ts +++ b/packages/vtable/examples/list/list-transpose.ts @@ -15,7 +15,7 @@ const generatePersons = count => { }; export function createTable() { - const records = generatePersons(100); + const records = generatePersons(1000); const columns: VTable.ColumnsDefine = [ { field: 'id', diff --git a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts index f1f48e0a6..eb0f5bd5d 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts @@ -24,11 +24,11 @@ export async function dynamicSetX(x: number, proxy: SceneProxy) { function move(deltaCol: number, screenLeftCol: number, screenLeftX: number, x: number, proxy: SceneProxy) { if (deltaCol > 0) { // 向右滚动,左部column group移到右部 - moveColumn(deltaCol, 'left', proxy.screenLeftCol, screenLeftX, proxy); + moveColumn(deltaCol, 'left', proxy.screenLeftCol, screenLeftX, x, proxy); proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX); } else if (deltaCol < 0) { // 向左滚动,右部cell group移到左部 - moveColumn(-deltaCol, 'right', proxy.screenLeftCol, screenLeftX, proxy); + moveColumn(-deltaCol, 'right', proxy.screenLeftCol, screenLeftX, x, proxy); proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX); } else { // 不改变row,更新body group范围 @@ -41,6 +41,7 @@ async function moveColumn( direction: 'left' | 'right', screenLeftCol: number, screenLeftX: number, + x: number, proxy: SceneProxy ) { // 限制count范围 @@ -125,7 +126,27 @@ async function moveColumn( proxy.table, distEndCol > proxy.bodyRightCol - (proxy.colEnd - proxy.colStart + 1) ? 'right' : 'left' // 跳转到右侧时,从右向左对齐 ); - proxy.table.scenegraph.proxy.deltaX = 0; + // update body position when click scroll bar + if (syncLeftCol === proxy.bodyLeftCol) { + const colGroup = proxy.table.scenegraph.getColGroup(syncLeftCol); + const deltaX = colGroup.attribute.x - x; + proxy.table.scenegraph.proxy.deltaX = deltaX; + } else if (syncRightCol === proxy.bodyRightCol) { + const colGroup = proxy.table.scenegraph.getColGroup(syncRightCol); + const deltaX = + colGroup.attribute.x + + colGroup.attribute.width - + (proxy.table.tableNoFrameWidth - proxy.table.getFrozenColsWidth()) - + x; + proxy.table.scenegraph.proxy.deltaX = -deltaX; + } else { + // proxy.table.scenegraph.proxy.deltaX = 0; + const colGroup = + proxy.table.scenegraph.getColGroup(screenLeftCol) || proxy.table.scenegraph.getColGroup(screenLeftCol, true); + const deltaX = + screenLeftX - (colGroup.attribute.x + proxy.table.getFrozenColsWidth() + proxy.table.scenegraph.proxy.deltaX); + proxy.table.scenegraph.proxy.deltaX = deltaX; + } proxy.currentCol = direction === 'left' ? proxy.currentCol + count : proxy.currentCol - count; proxy.totalCol = direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count; diff --git a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-y.ts b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-y.ts index 46e4cf000..9b123f3d0 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-y.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-y.ts @@ -6,7 +6,6 @@ import { updateAutoRow } from './update-auto-row'; export async function dynamicSetY(y: number, proxy: SceneProxy) { // 计算变动row range // const screenTopRow = proxy.table.getRowAt(y).row; - // proxy.deltaY = 0; const screenTop = (proxy.table as any).getTargetRowAt(y + proxy.table.scenegraph.colHeaderGroup.attribute.height); if (!screenTop) { return; @@ -123,9 +122,9 @@ async function moveCell( ); const cellGroup = proxy.table.scenegraph.highPerformanceGetCell(proxy.bodyLeftCol, screenTopRow, true); - const delaY = + const deltaY = screenTopY - (cellGroup.attribute.y + proxy.table.getFrozenRowsHeight() + proxy.table.scenegraph.proxy.deltaY); - proxy.table.scenegraph.proxy.deltaY += delaY; + proxy.table.scenegraph.proxy.deltaY += deltaY; } proxy.currentRow = direction === 'up' ? proxy.currentRow + count : proxy.currentRow - count; @@ -202,18 +201,21 @@ async function moveCell( // update body position when click scroll bar if (syncTopRow === proxy.bodyTopRow) { const cellGroup = proxy.table.scenegraph.highPerformanceGetCell(proxy.bodyLeftCol, syncTopRow, true); - const delaY = cellGroup.attribute.y - y; - proxy.table.scenegraph.proxy.deltaY = delaY; + const deltaY = cellGroup.attribute.y - y; + proxy.table.scenegraph.proxy.deltaY = deltaY; } else if (syncBottomRow === proxy.bodyBottomRow) { const cellGroup = proxy.table.scenegraph.highPerformanceGetCell(proxy.bodyLeftCol, syncBottomRow, true); - const delaY = + const deltaY = cellGroup.attribute.y + cellGroup.attribute.height - (proxy.table.tableNoFrameHeight - proxy.table.getFrozenRowsHeight()) - y; - proxy.table.scenegraph.proxy.deltaY = -delaY; + proxy.table.scenegraph.proxy.deltaY = -deltaY; } else { - proxy.table.scenegraph.proxy.deltaY = 0; + const cellGroup = proxy.table.scenegraph.highPerformanceGetCell(proxy.bodyLeftCol, screenTopRow, true); + const deltaY = + screenTopY - (cellGroup.attribute.y + proxy.table.getFrozenRowsHeight() + proxy.table.scenegraph.proxy.deltaY); + proxy.table.scenegraph.proxy.deltaY = deltaY; } proxy.currentRow = direction === 'up' ? proxy.currentRow + count : proxy.currentRow - count; diff --git a/packages/vtable/src/state/state.ts b/packages/vtable/src/state/state.ts index eb782dda2..cc939ed84 100644 --- a/packages/vtable/src/state/state.ts +++ b/packages/vtable/src/state/state.ts @@ -551,6 +551,8 @@ export class StateManager { const totalHeight = this.table.getAllRowsHeight(); this.scroll.verticalBarPos = Math.ceil(yRatio * (totalHeight - this.table.scenegraph.height)); this.table.scenegraph.setY(-this.scroll.verticalBarPos); + this.scroll.verticalBarPos -= this.table.scenegraph.proxy.deltaY; + this.table.scenegraph.proxy.deltaY = 0; // 滚动期间清空选中清空 this.table.stateManager.updateHoverPos(-1, -1); @@ -571,6 +573,8 @@ export class StateManager { const totalWidth = this.table.getAllColsWidth(); this.scroll.horizontalBarPos = Math.ceil(xRatio * (totalWidth - this.table.scenegraph.width)); this.table.scenegraph.setX(-this.scroll.horizontalBarPos); + this.scroll.horizontalBarPos -= this.table.scenegraph.proxy.deltaX; + this.table.scenegraph.proxy.deltaX = 0; // console.log(this.table.scenegraph.bodyGroup.lastChild.attribute); // this.table.scenegraph.bodyGroup.lastChild.onBeforeAttributeUpdate = attr => { // if (attr.x) { From a2f001ca3becccf4ed1d5ab868f4bdc83c4d5e60 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 7 Dec 2023 17:42:31 +0800 Subject: [PATCH 28/35] fix: fix hideIndicatorName in resetRowHeaderLevelCount() --- packages/vtable/src/layout/pivot-header-layout.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index 82b563d75..1ce344363 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -1024,7 +1024,10 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { let count = rowLevelCount; if (this.indicatorsAsCol) { // count = rowLevelCount; - } else if (this.hideIndicatorName && this.rowDimensionKeys[0] === this.indicatorDimensionKey) { + } else if ( + this.hideIndicatorName && + this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey + ) { count = rowLevelCount - 1; } From 00755ad7ede7441c04b2e1b6b4fd7ea17cf565c0 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 7 Dec 2023 18:03:03 +0800 Subject: [PATCH 29/35] fix: change icon visible into opacity --- packages/vtable/src/state/state.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/vtable/src/state/state.ts b/packages/vtable/src/state/state.ts index cc939ed84..9f26e32b4 100644 --- a/packages/vtable/src/state/state.ts +++ b/packages/vtable/src/state/state.ts @@ -756,7 +756,8 @@ export class StateManager { ); (icon as any).oldVisibleTime = icon.attribute.visibleTime; icon.setAttribute('visibleTime', 'always'); - icon.setAttribute('visible', true); + // icon.setAttribute('visible', true); + icon.setAttribute('opacity', 1); } } @@ -772,9 +773,13 @@ export class StateManager { this.residentHoverIcon.row ); this.residentHoverIcon.icon.setAttribute('visibleTime', (this.residentHoverIcon.icon as any).oldVisibleTime); + // this.residentHoverIcon.icon.setAttribute( + // 'visible', + // this.residentHoverIcon.icon.attribute.visibleTime === 'always' + // ); this.residentHoverIcon.icon.setAttribute( - 'visible', - this.residentHoverIcon.icon.attribute.visibleTime === 'always' + 'opacity', + this.residentHoverIcon.icon.attribute.visibleTime === 'always' ? 1 : 0 ); this.residentHoverIcon = null; } From c7b5daad708ed347703264fe6c14a1b2fdd8a4f0 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 7 Dec 2023 20:36:38 +0800 Subject: [PATCH 30/35] feat: add axis theme --- .../fix-bug-fix-0.15.4_2023-12-07-12-30.json | 10 +++++++++ .../vtable/examples/pivot-chart/pivotChart.ts | 16 ++++++++++++++ packages/vtable/src/components/axis/axis.ts | 18 ++++++++++++++-- packages/vtable/src/themes/component.ts | 21 +++++++++++++++++++ packages/vtable/src/themes/theme.ts | 17 +++++++++++++++ packages/vtable/src/ts-types/theme.ts | 10 +++++++++ 6 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json create mode 100644 packages/vtable/src/themes/component.ts diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json new file mode 100644 index 000000000..32ab8f6b7 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: add axis theme", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/examples/pivot-chart/pivotChart.ts b/packages/vtable/examples/pivot-chart/pivotChart.ts index 7297e8efb..a629a7091 100644 --- a/packages/vtable/examples/pivot-chart/pivotChart.ts +++ b/packages/vtable/examples/pivot-chart/pivotChart.ts @@ -9320,6 +9320,22 @@ export function createTable() { }, frameStyle: { borderLineWidth: 0 + }, + axisStyle: { + defaultAxisStyle: { + title: { + style: { + fill: 'red' + } + } + }, + leftAxisStyle: { + label: { + style: { + fill: 'yellow' + } + } + } } }; const option: VTable.PivotChartConstructorOptions = { diff --git a/packages/vtable/src/components/axis/axis.ts b/packages/vtable/src/components/axis/axis.ts index 06bc49009..be582f28f 100644 --- a/packages/vtable/src/components/axis/axis.ts +++ b/packages/vtable/src/components/axis/axis.ts @@ -13,7 +13,7 @@ import type { IBaseScale } from '@visactor/vscale'; import { ticks } from '@visactor/vutils-extension'; import { LinearAxisScale } from './linear-scale'; import { doOverlap } from './label-overlap'; -import { getQuadProps } from '../../scenegraph/utils/padding'; +import type { TableTheme } from '../../themes/theme'; const DEFAULT_BAND_INNER_PADDING = 0.1; const DEFAULT_BAND_OUTER_PADDING = 0.3; @@ -45,8 +45,8 @@ export class CartesianAxis { table: BaseTableAPI ) { this.table = table; - this.option = merge({}, commonAxis, option); this.orient = option.orient ?? 'left'; + this.option = merge({}, commonAxis, getAxisTheme(this.orient, table.theme), option); if (this.orient === 'left' || this.orient === 'right') { this.width = width; @@ -294,3 +294,17 @@ export class CartesianAxis { return (this.scale as LinearAxisScale).domain; } } + +function getAxisTheme(orient: IOrientType, theme: TableTheme) { + let directionStyle; + if (orient === 'left') { + directionStyle = theme.axisStyle.leftAxisStyle; + } else if (orient === 'right') { + directionStyle = theme.axisStyle.rightAxisStyle; + } else if (orient === 'top') { + directionStyle = theme.axisStyle.topAxisStyle; + } else if (orient === 'bottom') { + directionStyle = theme.axisStyle.bottomAxisStyle; + } + return merge({}, theme.axisStyle.defaultAxisStyle, directionStyle); +} diff --git a/packages/vtable/src/themes/component.ts b/packages/vtable/src/themes/component.ts new file mode 100644 index 000000000..153e5bafc --- /dev/null +++ b/packages/vtable/src/themes/component.ts @@ -0,0 +1,21 @@ +import type { RequiredTableThemeDefine } from '../ts-types'; + +export function getAxisStyle(axisStyle: RequiredTableThemeDefine['axisStyle']) { + const style = { + defaultAxisStyle: getSingleAxisStyle(axisStyle.defaultAxisStyle), + leftAxisStyle: getSingleAxisStyle(axisStyle.leftAxisStyle), + rightAxisStyle: getSingleAxisStyle(axisStyle.rightAxisStyle), + topAxisStyle: getSingleAxisStyle(axisStyle.topAxisStyle), + bottomAxisStyle: getSingleAxisStyle(axisStyle.bottomAxisStyle) + }; + + return style; +} + +function getSingleAxisStyle(axisStyle?: RequiredTableThemeDefine['axisStyle']['defaultAxisStyle']) { + if (!axisStyle) { + return {}; + } + + return axisStyle; // to do: turn into get mode +} diff --git a/packages/vtable/src/themes/theme.ts b/packages/vtable/src/themes/theme.ts index b61ca2d63..e3c41fc98 100644 --- a/packages/vtable/src/themes/theme.ts +++ b/packages/vtable/src/themes/theme.ts @@ -46,6 +46,7 @@ import { DEFAULTFONTFAMILY, DEFAULTFONTSIZE } from '../tools/global'; +import { getAxisStyle } from './component'; //private symbol // const _ = getSymbol(); @@ -80,6 +81,8 @@ export class TableTheme implements ITableThemeDefine { private _dragHeaderSplitLine: RequiredTableThemeDefine['dragHeaderSplitLine'] | null = null; private _frozenColumnLine: RequiredTableThemeDefine['frozenColumnLine'] | null = null; private _selectionStyle: RequiredTableThemeDefine['selectionStyle'] | null = null; + + private _axisStyle: RequiredTableThemeDefine['axisStyle'] | null = null; constructor(obj: PartialTableThemeDefine | ITableThemeDefine, superTheme: ITableThemeDefine) { this.internalTheme = { obj, @@ -615,6 +618,20 @@ export class TableTheme implements ITableThemeDefine { } return this._selectionStyle; } + + get axisStyle(): RequiredTableThemeDefine['axisStyle'] { + if (!this._axisStyle) { + const { obj, superTheme } = this.internalTheme; + const axisStyle: RequiredTableThemeDefine['axisStyle'] = ingoreNoneValueMerge( + {}, + superTheme.axisStyle, + obj.axisStyle + ); + this._axisStyle = getAxisStyle(axisStyle); + } + return this._axisStyle; + } + hasProperty(names: string[]): boolean { const { obj, superTheme } = this.internalTheme; return hasThemeProperty(obj, names) || hasThemeProperty(superTheme, names); diff --git a/packages/vtable/src/ts-types/theme.ts b/packages/vtable/src/ts-types/theme.ts index 77aa4e580..dc8a5118c 100644 --- a/packages/vtable/src/ts-types/theme.ts +++ b/packages/vtable/src/ts-types/theme.ts @@ -3,6 +3,7 @@ import type { ColorsDef, LineDashsDef, LineWidthsDef, LineWidthsPropertyDefine } import type { ITextStyleOption } from './column/style'; import type { ColorPropertyDefine, ColorsPropertyDefine } from './style-define'; import type { ColumnIconOption } from './icon'; +import type { ICellAxisOption } from './component/axis'; // ****** Custom Theme ******* export type PartialTableThemeDefine = Partial; export type ThemeStyle = ITextStyleOption & { @@ -125,6 +126,15 @@ export interface ITableThemeDefine { cellBorderLineWidth?: number; //边框线宽度 cellBgColor?: string; //选择框背景颜色 }; + + // style for axis + axisStyle?: { + defaultAxisStyle?: Omit; + leftAxisStyle?: Omit; + rightAxisStyle?: Omit; + topAxisStyle?: Omit; + bottomAxisStyle?: Omit; + }; } export type RequiredTableThemeDefine = Required; From 97699d62de3cf754dca617ed652f32077cb7a01f Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 8 Dec 2023 11:51:28 +0800 Subject: [PATCH 31/35] feat: update vchart version --- common/config/rush/pnpm-lock.yaml | 191 +++++++++++++++++++---------- docs/package.json | 2 +- packages/react-vtable/package.json | 4 +- packages/vtable/package.json | 4 +- 4 files changed, 128 insertions(+), 73 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 2bf7dde50..b9ab425ab 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -14,7 +14,7 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@visactor/vtable': workspace:* '@visactor/vtable-editors': workspace:* '@vitejs/plugin-react': 3.1.0 @@ -36,7 +36,7 @@ importers: yargs: ^17.1.1 dependencies: '@arco-design/web-react': 2.46.1_p5xgpqf7wiayqxc6j6o5zt2pdy - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@visactor/vtable': link:../packages/vtable '@visactor/vtable-editors': link:../packages/vtable-editors axios: 1.6.2 @@ -80,7 +80,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.16.10 '@vitejs/plugin-react': 3.1.0 @@ -131,7 +131,7 @@ importers: '@types/react': 18.2.38 '@types/react-dom': 18.2.17 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.2 chai: 4.3.4 @@ -177,7 +177,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@visactor/vdataset': ~0.15.7 '@visactor/vrender': 0.16.17 '@visactor/vrender-components': 0.16.17 @@ -245,7 +245,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': 18.2.38 '@types/react-dom': 18.2.17 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.2 chai: 4.3.4 @@ -3215,23 +3215,23 @@ packages: resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} dev: true - /@visactor/vchart/1.7.1: - resolution: {integrity: sha512-g+gGNDk7jF3QGw+biOpjLDaMIrFSM2Qf/FHtGjza/APuJwL/W2ZoKXkSOCpLtlJHZ/bFupm6ZTAbNI9ghsQ1BA==} - dependencies: - '@visactor/vdataset': 0.16.18 - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-hierarchy': 0.9.3 - '@visactor/vgrammar-projection': 0.9.3 - '@visactor/vgrammar-sankey': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vgrammar-wordcloud': 0.9.3 - '@visactor/vgrammar-wordcloud-shape': 0.9.3 - '@visactor/vrender-components': 0.16.17 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 - '@visactor/vscale': 0.16.18 - '@visactor/vutils': 0.16.18 - '@visactor/vutils-extension': 1.7.1 + /@visactor/vchart/1.7.3: + resolution: {integrity: sha512-DUYVbU4dXkomkE3YvG9fZuGPcCIcBS+xTKJuPYyrSjB+q/XugqQWp4fYMUMtg8lEf87ik5cDVNhHTVhHWx0//w==} + dependencies: + '@visactor/vdataset': 0.17.1 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-hierarchy': 0.9.4 + '@visactor/vgrammar-projection': 0.9.4 + '@visactor/vgrammar-sankey': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vgrammar-wordcloud': 0.9.4 + '@visactor/vgrammar-wordcloud-shape': 0.9.4 + '@visactor/vrender-components': 0.16.20 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 + '@visactor/vscale': 0.17.1 + '@visactor/vutils': 0.17.1 + '@visactor/vutils-extension': 1.7.3 /@visactor/vdataset/0.15.14: resolution: {integrity: sha512-uPRUJAcldwEUezQnXUIB5IwFyMhktgc9YyObm0fFtBEf9P+zln+d/cW1jIN8H2oTIaTyAryDCzZ3MDWTI8jOqg==} @@ -3276,72 +3276,93 @@ packages: simplify-geojson: 1.0.5 topojson-client: 3.1.0 - /@visactor/vgrammar-coordinate/0.9.3: - resolution: {integrity: sha512-nj/RCmFJqOnpqGJ4MfJH6Fd9Ur1u6mRdj9pfXc7QyAujqOhfhs+oqwZ/hkBb/pwONCdRYG7+EFqgYam5fZ5JtA==} + /@visactor/vdataset/0.17.1: + resolution: {integrity: sha512-hF83iZ/Cl13atkiUhekZluadoeksSkTJK4dUOqapSpTGt0TFR/DWKs7F/DxBUnRDRdohKUIuJzSKtha/qSPS/A==} + dependencies: + '@turf/flatten': 6.5.0 + '@turf/helpers': 6.5.0 + '@turf/rewind': 6.5.0 + '@visactor/vutils': 0.17.1 + d3-dsv: 2.0.0 + d3-geo: 1.12.1 + d3-hexbin: 0.2.2 + d3-hierarchy: 3.1.2 + eventemitter3: 4.0.7 + geobuf: 3.0.2 + geojson-dissolve: 3.1.0 + path-browserify: 1.0.1 + pbf: 3.2.1 + point-at-length: 1.1.0 + simple-statistics: 7.8.3 + simplify-geojson: 1.0.5 + topojson-client: 3.1.0 + + /@visactor/vgrammar-coordinate/0.9.4: + resolution: {integrity: sha512-Lhzs1SpBM/Uw7EVMDlObD9wwhK/WTFvRagphwb9KwC4aRAeotI1lCsH647gr6rOGoEV5s3j1jhqQ9han/l+ygA==} dependencies: - '@visactor/vgrammar-util': 0.9.3 + '@visactor/vgrammar-util': 0.9.4 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-core/0.9.3: - resolution: {integrity: sha512-vgdd2rtgeKg1aGS3pCldDh4H+s+s8OylrvEcaloZrSwPlCz2/ZBMI3q+sv+wd+ppU/fHCeNWGknUPus21m5lKA==} + /@visactor/vgrammar-core/0.9.4: + resolution: {integrity: sha512-b1FqHG8AVOQlsPYNLYdYlhxJh12WHhSBMTdSevfGVbVgn/qB4hBG1my+yugf0uwEIiwushJBVvs7yVuTmhZrSg==} dependencies: '@visactor/vdataset': 0.16.18 - '@visactor/vgrammar-coordinate': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 + '@visactor/vgrammar-coordinate': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 '@visactor/vrender-components': 0.16.17 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vscale': 0.16.18 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-hierarchy/0.9.3: - resolution: {integrity: sha512-9EBfUwZa3Y4F11Ui/N7nFWny6H832JllJteaS/H/Bax78X2ofTAgWZz6NPKNwDTSKIlHms4TfUiUZhOnm1vnHQ==} + /@visactor/vgrammar-hierarchy/0.9.4: + resolution: {integrity: sha512-mYHABCa68dM+kBZtFq+hdrRD7y4HnsTLbjonMO2iaOlhviGypoSr6fnebtgsTgs7MZiFegHdCAHJDAi/pVbLSw==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-projection/0.9.3: - resolution: {integrity: sha512-0UcRS8TBCfPFCpUIF59caoQ79hKQg8v3AY5LDrPI1usOKwRj+LPX7+ymBocQnLJLwIp8jfHSKtPoYzIKILtduA==} + /@visactor/vgrammar-projection/0.9.4: + resolution: {integrity: sha512-sC82dOByPBWipsOfkfCnYDGUvHutaHyDa92TqWE+NoQKEZcWZJrzau49FN61qfDNNbkWstgO0hy0NubuH8807Q==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 '@visactor/vutils': 0.16.18 d3-geo: 1.12.1 - /@visactor/vgrammar-sankey/0.9.3: - resolution: {integrity: sha512-PwplHOvBmFKGyRjCrqCv6Ogw/0WD5cOxuJK5lwd3ZwQEOfYwT0cJmk3MwCsXs1pPmSgeZboQxuiVi7n6DCQM0A==} + /@visactor/vgrammar-sankey/0.9.4: + resolution: {integrity: sha512-tO38gWS0SSJBU3qILscBPITqub95NbK9up+nvWjZgwqOoj1N4/NPqpAvFwxOg4EF7g48saC5QJvt4gyQWikIKg==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-util/0.9.3: - resolution: {integrity: sha512-rPxRXv9Gw0vuOr30nkE/G8ge23D2JesSrvKCHXYvZEF6Tm8dL8vYMUQILMlExxXabGT6J4kNkSH43KbxT9R0lA==} + /@visactor/vgrammar-util/0.9.4: + resolution: {integrity: sha512-i+74qgnEjqdNceLf7qFtiqwhU8Dw5VrG5C7dwG7JF+lBIvLqDvQQ+8m3g0oUW0UfvgDu+9qcPCSht4uXqoM04Q==} dependencies: '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-wordcloud-shape/0.9.3: - resolution: {integrity: sha512-JQyqq3YPnFqZi5qMwwnrWZoykYjNqtmOM4V4Y0fUWsaQgKJXvxFMKlhllWSMN9yEo38tzBdKlEwneqLeDwb//w==} + /@visactor/vgrammar-wordcloud-shape/0.9.4: + resolution: {integrity: sha512-VhG8BnUtBwzJ5PMpT0wql8ymaVhXzLo3h7+5IljfaV1cUTV3f+sAbyPZziYVsbxmPOyJZNNbhMcEHNTexayMnw==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vscale': 0.16.18 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-wordcloud/0.9.3: - resolution: {integrity: sha512-OYoJTYAhRMrwXZKoklSxIFvLNSdkn2T8VTTy4Pqdzzy8UeSlaZHjQ/uo7EuppIMOBSfGW/b80+6me+HaitpDkQ==} + /@visactor/vgrammar-wordcloud/0.9.4: + resolution: {integrity: sha512-v5geBndJaJQnGbm4kmVl1pQlcRPd6atIq1aTBKLOFpzFK30c0/VFqLy6E3fMrZ7DB2DfoOn5rU3EYq/hllUkzA==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vutils': 0.16.18 /@visactor/vrender-components/0.16.17: @@ -3352,12 +3373,26 @@ packages: '@visactor/vscale': 0.16.18 '@visactor/vutils': 0.16.18 + /@visactor/vrender-components/0.16.20: + resolution: {integrity: sha512-kAiYwoyzahhO32OlkI1J1lGRaJX4sOkaob6H2+sUKO+7Qpj+76iegekrYcVGkR4AjUScLWg/Lv6PxWFSbbjz7Q==} + dependencies: + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 + '@visactor/vscale': 0.16.18 + '@visactor/vutils': 0.16.18 + /@visactor/vrender-core/0.16.17: resolution: {integrity: sha512-cAlxWZ4xV/dDVpoHuUfvXL+YR/bQj3A9L4v39mmWhdADcaE25DIxGkpWsNn6UOJoROdojrXCHPQTPToSZS8P5A==} dependencies: '@visactor/vutils': 0.16.18 color-convert: 2.0.1 + /@visactor/vrender-core/0.16.20: + resolution: {integrity: sha512-eRNz4l8BniXg0MvnwFOLc+lnYWC+8h6GDZgjIDw7K7QR8hIm2uY/PHBAzM/Yk5jHv3aGQ0RC3v33NlFaaAS+wg==} + dependencies: + '@visactor/vutils': 0.16.18 + color-convert: 2.0.1 + /@visactor/vrender-kits/0.16.17: resolution: {integrity: sha512-vwzWy7Ukizf6PpA5yLg3izhgZ619IqjRGbiTSSJrV2vIBqkhIL5LIUIg2NTNPgQD1tSDyPZFu7BFp2sXSeSnFg==} dependencies: @@ -3366,6 +3401,14 @@ packages: '@visactor/vutils': 0.16.18 roughjs: 4.5.2 + /@visactor/vrender-kits/0.16.20: + resolution: {integrity: sha512-XqB7RsrqUxWg9SuyzKWoDRrQZRWVeUPm0Id/w6MsICZqRnZHllVPNezE71FT7trrQ8edpY8nWr5CJaSWyw1ylA==} + dependencies: + '@resvg/resvg-js': 2.4.1 + '@visactor/vrender-core': 0.16.20 + '@visactor/vutils': 0.16.18 + roughjs: 4.5.2 + /@visactor/vrender/0.16.17: resolution: {integrity: sha512-72woS3CQ7h3HHrPRneASgF17SLBifFTYY19BiCFxTiQZIfQJRm3aRems7Pbci8mTBDTwUDlWyAmF9jE2sit2mQ==} dependencies: @@ -3384,6 +3427,11 @@ packages: dependencies: '@visactor/vutils': 0.16.18 + /@visactor/vscale/0.17.1: + resolution: {integrity: sha512-vWDuVymipH7BE5qscS1s1aj+7o8L+uR1HdZ6S9qBS0+e3rxeteOiKcKTiFI8u+mLdsPh1KwHzUmec1SclzJyeg==} + dependencies: + '@visactor/vutils': 0.17.1 + /@visactor/vutils-extension/1.5.1-alpha.0: resolution: {integrity: sha512-4qtND+1Djatb5zVzAAbRX+WAKveO2SgEyJhnTzL/gWv7Elc+QYP06VmPaQy6ZnLHmxx6bsnZn1yFitz6fifmig==} dependencies: @@ -3393,13 +3441,13 @@ packages: '@visactor/vutils': 0.16.18 dev: false - /@visactor/vutils-extension/1.7.1: - resolution: {integrity: sha512-XcFpjpDmmSFz+7jFm36PTisKXk6XpnHrasOEHzSrt6OaakAMVB/fhTKHUHXJRsOjlRAokx+2gC1qdsbhwWNG8w==} + /@visactor/vutils-extension/1.7.3: + resolution: {integrity: sha512-MDxORaYXU3EjcZaamwbY3h5VKp+3PGypBWnWGhRA0C0py8yfvUpPNjUHatJb3Y9BN433GoUT8wtBsPsqWMyEqQ==} dependencies: - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 - '@visactor/vscale': 0.16.18 - '@visactor/vutils': 0.16.18 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 + '@visactor/vscale': 0.17.1 + '@visactor/vutils': 0.17.1 /@visactor/vutils/0.15.14: resolution: {integrity: sha512-mZuJhXdDZqq5arqc/LfEmWOY6l7ErK1MurO8bR3vESxeCaQ18pN36iit15K2IMQVJuKZPnZ2ksw8+a1irXi/8A==} @@ -3424,6 +3472,13 @@ packages: '@turf/invariant': 6.5.0 eventemitter3: 4.0.7 + /@visactor/vutils/0.17.1: + resolution: {integrity: sha512-rHoY/CfT8VXuoE7YXqEixvpuL95Qy/4tGHRzeoJLaMsrUxAOXFRZeVX1wEbjrdnXeBj7UlpcG5/uVt5pIOFyeQ==} + dependencies: + '@turf/helpers': 6.5.0 + '@turf/invariant': 6.5.0 + eventemitter3: 4.0.7 + /@vitejs/plugin-react/3.1.0_vite@3.2.6: resolution: {integrity: sha512-AfgcRL8ZBhAlc3BFdigClmTUMISmmzHn7sB2h9U1odvc5U/MjWXsAaz18b/WoppUTDBzxOJwo2VdClfUcItu9g==} engines: {node: ^14.18.0 || >=16.0.0} diff --git a/docs/package.json b/docs/package.json index c163db94c..a74a538d9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,7 +12,7 @@ "@arco-design/web-react": "2.46.1", "@visactor/vtable": "workspace:*", "@visactor/vtable-editors": "workspace:*", - "@visactor/vchart": "1.7.1", + "@visactor/vchart": "1.7.3", "markdown-it": "^13.0.0", "highlight.js": "^11.8.0", "axios": "^1.4.0", diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index 7e6f79614..e81c4f2df 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -52,7 +52,7 @@ "react-is": "^18.2.0" }, "devDependencies": { - "@visactor/vchart": "1.7.1", + "@visactor/vchart": "1.7.3", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} +} \ No newline at end of file diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 489223ae2..555f51a28 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -60,7 +60,7 @@ }, "devDependencies": { "luxon": "*", - "@visactor/vchart": "1.7.1", + "@visactor/vchart": "1.7.3", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -123,4 +123,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} +} \ No newline at end of file From c1286f46d475c75a2cca184a733b214dcb227695 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 8 Dec 2023 14:27:44 +0800 Subject: [PATCH 32/35] feat: overlay default and hover colors --- .../fix-bug-fix-0.15.4_2023-12-08-06-27.json | 10 +++++++++ .../group-contribution-render.ts | 19 ++++++++++++----- .../scenegraph/graphic/contributions/index.ts | 21 +++++++++---------- 3 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json new file mode 100644 index 000000000..f6996e8b6 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: overlay default and hover colors", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts index 33f6d6a13..dc8282c04 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts @@ -683,8 +683,7 @@ export class AdjustColorGroupBeforeRenderContribution implements IGroupRenderCon if (table.stateManager.interactionState !== InteractionState.scrolling) { const hoverColor = getCellHoverColor(group as Group, table); if (hoverColor) { - (group as any).oldColor = group.attribute.fill; - group.attribute.fill = hoverColor; + (group.attribute as any)._vtableHoverFill = hoverColor; } } } @@ -719,9 +718,19 @@ export class AdjustColorGroupAfterRenderContribution implements IGroupRenderCont ) => boolean ) { // 处理hover颜色 - if ('oldColor' in group) { - group.attribute.fill = group.oldColor as any; - delete group.oldColor; + if ((group.attribute as any)._vtableHoverFill) { + if (fillCb) { + // do nothing + // fillCb(context, group.attribute, groupAttribute); + } else if (fVisible) { + const oldColor = group.attribute.fill; + // draw hover fill + group.attribute.fill = (group.attribute as any)._vtableHoverFill as any; + context.setCommonStyle(group, group.attribute, x, y, groupAttribute); + context.fill(); + group.attribute.fill = oldColor; + (group.attribute as any)._vtableHoverFill = undefined; + } } } } diff --git a/packages/vtable/src/scenegraph/graphic/contributions/index.ts b/packages/vtable/src/scenegraph/graphic/contributions/index.ts index b99e3dbcb..cb0f59256 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/index.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/index.ts @@ -39,12 +39,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(RectRenderContribution).toService(VTableSplitRectAfterRenderContribution); } - // group 渲染器注入contributions - bind(SplitGroupAfterRenderContribution).toSelf().inSingletonScope(); - bind(GroupRenderContribution).toService(SplitGroupAfterRenderContribution); - bind(SplitGroupBeforeRenderContribution).toSelf().inSingletonScope(); - bind(GroupRenderContribution).toService(SplitGroupBeforeRenderContribution); - // chart渲染器注入 bind(DefaultCanvasChartRender).toSelf().inSingletonScope(); bind(ChartRender).to(DefaultCanvasChartRender); @@ -57,6 +51,16 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(ImageRenderContribution).toService(AfterImageRenderContribution); // group 渲染器注入contributions + bind(AdjustColorGroupBeforeRenderContribution).toSelf().inSingletonScope(); + bind(GroupRenderContribution).toService(AdjustColorGroupBeforeRenderContribution); + bind(AdjustColorGroupAfterRenderContribution).toSelf().inSingletonScope(); + bind(GroupRenderContribution).toService(AdjustColorGroupAfterRenderContribution); + + bind(SplitGroupAfterRenderContribution).toSelf().inSingletonScope(); + bind(GroupRenderContribution).toService(SplitGroupAfterRenderContribution); + bind(SplitGroupBeforeRenderContribution).toSelf().inSingletonScope(); + bind(GroupRenderContribution).toService(SplitGroupBeforeRenderContribution); + bind(DashGroupBeforeRenderContribution).toSelf().inSingletonScope(); bind(GroupRenderContribution).toService(DashGroupBeforeRenderContribution); bind(DashGroupAfterRenderContribution).toSelf().inSingletonScope(); @@ -66,9 +70,4 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(GroupRenderContribution).toService(AdjustPosGroupBeforeRenderContribution); bind(AdjustPosGroupAfterRenderContribution).toSelf().inSingletonScope(); bind(GroupRenderContribution).toService(AdjustPosGroupAfterRenderContribution); - - bind(AdjustColorGroupBeforeRenderContribution).toSelf().inSingletonScope(); - bind(GroupRenderContribution).toService(AdjustColorGroupBeforeRenderContribution); - bind(AdjustColorGroupAfterRenderContribution).toSelf().inSingletonScope(); - bind(GroupRenderContribution).toService(AdjustColorGroupAfterRenderContribution); }); From 6a7b6e2878ef1a3d4f928adcb82d823088cd90f9 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 8 Dec 2023 16:10:48 +0800 Subject: [PATCH 33/35] feat: support chartSpec theme config --- .../vtable/examples/pivot-chart/pivotChart.ts | 50 ++++++++++++------- packages/vtable/src/components/axis/axis.ts | 41 +++++++++++++-- .../components/axis/get-axis-attributes.ts | 28 +++++++++++ .../scenegraph/group-creater/cell-helper.ts | 10 +++- .../src/scenegraph/layout/update-width.ts | 2 + .../scenegraph/refresh-node/update-chart.ts | 10 +++- 6 files changed, 118 insertions(+), 23 deletions(-) diff --git a/packages/vtable/examples/pivot-chart/pivotChart.ts b/packages/vtable/examples/pivot-chart/pivotChart.ts index a629a7091..cc0c7064e 100644 --- a/packages/vtable/examples/pivot-chart/pivotChart.ts +++ b/packages/vtable/examples/pivot-chart/pivotChart.ts @@ -211,7 +211,23 @@ export function createTable() { axes: [ { orient: 'left', visible: true, label: { visible: true } }, { orient: 'bottom', visible: true } - ] + ], + theme: { + // axis: { + // label: { + // style: { + // fill: 'green' + // } + // } + // } + colorScheme: { + default: { + palette: { + axisLabelFontColor: 'red' + } + } + } + } } }, { @@ -9320,23 +9336,23 @@ export function createTable() { }, frameStyle: { borderLineWidth: 0 - }, - axisStyle: { - defaultAxisStyle: { - title: { - style: { - fill: 'red' - } - } - }, - leftAxisStyle: { - label: { - style: { - fill: 'yellow' - } - } - } } + // axisStyle: { + // defaultAxisStyle: { + // title: { + // style: { + // fill: 'red' + // } + // } + // }, + // leftAxisStyle: { + // label: { + // style: { + // fill: 'yellow' + // } + // } + // } + // } }; const option: VTable.PivotChartConstructorOptions = { columnTree, diff --git a/packages/vtable/src/components/axis/axis.ts b/packages/vtable/src/components/axis/axis.ts index be582f28f..073fee2fc 100644 --- a/packages/vtable/src/components/axis/axis.ts +++ b/packages/vtable/src/components/axis/axis.ts @@ -2,7 +2,7 @@ import { degreeToRadian, isNil, isValidNumber, merge } from '@visactor/vutils'; import type { BaseTableAPI } from '../../ts-types/base-table'; import type { ICellAxisOption } from '../../ts-types/component/axis'; import { LineAxis, type LineAxisAttributes } from '@visactor/vrender-components'; -import { commonAxis, getAxisAttributes } from './get-axis-attributes'; +import { commonAxis, getAxisAttributes, getCommonAxis } from './get-axis-attributes'; import { isXAxis, isYAxis } from '../util/orient'; import type { IOrientType } from '../../ts-types/component/util'; import { BandAxisScale } from './band-scale'; @@ -42,11 +42,20 @@ export class CartesianAxis { width: number, height: number, padding: [number, number, number, number], + chartSpecTheme: any, table: BaseTableAPI ) { this.table = table; this.orient = option.orient ?? 'left'; - this.option = merge({}, commonAxis, getAxisTheme(this.orient, table.theme), option); + this.type = option.type ?? 'band'; + this.option = merge( + {}, + // commonAxis, + getCommonAxis(chartSpecTheme), + getTableAxisTheme(this.orient, table.theme), + getChartSpecAxisTheme(this.orient, this.type, chartSpecTheme), + option + ); if (this.orient === 'left' || this.orient === 'right') { this.width = width; @@ -59,7 +68,6 @@ export class CartesianAxis { } this.visible = option.visible ?? true; - this.type = option.type ?? 'band'; this.inverse = 'inverse' in option ? !!option.inverse : false; if (option.type === 'band') { this.data = option.domain; @@ -295,7 +303,7 @@ export class CartesianAxis { } } -function getAxisTheme(orient: IOrientType, theme: TableTheme) { +function getTableAxisTheme(orient: IOrientType, theme: TableTheme) { let directionStyle; if (orient === 'left') { directionStyle = theme.axisStyle.leftAxisStyle; @@ -308,3 +316,28 @@ function getAxisTheme(orient: IOrientType, theme: TableTheme) { } return merge({}, theme.axisStyle.defaultAxisStyle, directionStyle); } + +function getChartSpecAxisTheme( + orient: IOrientType, + type: 'linear' | 'band' | 'point' | 'time' | 'log' | 'symlog', + chartSpecTheme?: any +) { + if (!chartSpecTheme) { + return {}; + } + const axisTheme = chartSpecTheme.axis; + let axisTypeTheme; + if (type === 'linear' || type === 'log' || type === 'symlog') { + axisTypeTheme = chartSpecTheme.axisLinear; + } else if (type === 'band') { + axisTypeTheme = chartSpecTheme.axisBand; + } + + let axisOrientTheme; + if (orient === 'top' || orient === 'bottom') { + axisOrientTheme = chartSpecTheme.axisX; + } else if (orient === 'left' || orient === 'right') { + axisOrientTheme = chartSpecTheme.axisY; + } + return merge({}, axisTheme, axisTypeTheme, axisOrientTheme); +} diff --git a/packages/vtable/src/components/axis/get-axis-attributes.ts b/packages/vtable/src/components/axis/get-axis-attributes.ts index c0125d0d8..72c0a3982 100644 --- a/packages/vtable/src/components/axis/get-axis-attributes.ts +++ b/packages/vtable/src/components/axis/get-axis-attributes.ts @@ -95,6 +95,34 @@ export const commonAxis = { } }; +export function getCommonAxis(theme: any) { + if (!theme?.colorScheme?.default?.palette) { + return commonAxis; + } + return merge({}, commonAxis, { + tick: { + style: { + stroke: theme.colorScheme.default.palette.axisDomainColor || '#D9DDE4' + } + }, + subTick: { + style: { + stroke: theme.colorScheme.default.palette.axisDomainColor || '#D9DDE4' + } + }, + label: { + style: { + fill: theme.colorScheme.default.palette.axisLabelFontColor || '#89909D' + } + }, + title: { + style: { + fill: theme.colorScheme.default.palette.secondaryFontColor || '#333333' + } + } + }); +} + export function getAxisAttributes(option: ICellAxisOption) { const spec = merge({}, option); // const spec = option; diff --git a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts index 107300e3c..71925a1b6 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -169,7 +169,15 @@ export function createCell( const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row); if (axisConfig) { - const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, table); + const spec = table.internalProps.layoutMap.getRawChartSpec(col, row); + const axis = new CartesianAxis( + axisConfig, + cellGroup.attribute.width, + cellGroup.attribute.height, + padding, + spec?.theme, + table + ); cellGroup.clear(); cellGroup.appendChild(axis.component); axis.overlap(); diff --git a/packages/vtable/src/scenegraph/layout/update-width.ts b/packages/vtable/src/scenegraph/layout/update-width.ts index 9931a41c7..5fc088471 100644 --- a/packages/vtable/src/scenegraph/layout/update-width.ts +++ b/packages/vtable/src/scenegraph/layout/update-width.ts @@ -298,11 +298,13 @@ function updateCellWidth( const cellStyle = scene.table._getCellStyle(col, row); const padding = getQuadProps(getProp('padding', cellStyle, col, row, scene.table)); if (axisConfig) { + const spec = scene.table.internalProps.layoutMap.getRawChartSpec(col, row); const axis = new CartesianAxis( axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, + spec?.theme, scene.table ); cellGroup.clear(); diff --git a/packages/vtable/src/scenegraph/refresh-node/update-chart.ts b/packages/vtable/src/scenegraph/refresh-node/update-chart.ts index 209725a5b..e55bb6811 100644 --- a/packages/vtable/src/scenegraph/refresh-node/update-chart.ts +++ b/packages/vtable/src/scenegraph/refresh-node/update-chart.ts @@ -181,7 +181,15 @@ function updateTableAxes(containerGroup: Group, table: BaseTableAPI) { const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row); const cellStyle = table._getCellStyle(cell.col, cell.row); const padding = getQuadProps(getProp('padding', cellStyle, cell.col, cell.row, table)); - const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, table); + const spec = table.internalProps.layoutMap.getRawChartSpec(cell.col, cell.row); + const axis = new CartesianAxis( + axisConfig, + cell.attribute.width, + cell.attribute.height, + padding, + spec?.theme, + table + ); cell.clear(); cell.appendChild(axis.component); axis.overlap(); From 2458a2b4d7a861cd26c454ad3f105305aa6e93ec Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 8 Dec 2023 16:16:14 +0800 Subject: [PATCH 34/35] feat: update vrender version --- common/config/rush/pnpm-lock.yaml | 16 ++++++++-------- packages/vtable/package.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index b9ab425ab..c96adda09 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -179,8 +179,8 @@ importers: '@types/react-dom': ^18.0.0 '@visactor/vchart': 1.7.3 '@visactor/vdataset': ~0.15.7 - '@visactor/vrender': 0.16.17 - '@visactor/vrender-components': 0.16.17 + '@visactor/vrender': 0.16.20 + '@visactor/vrender-components': 0.16.20 '@visactor/vscale': 0.16.0 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~0.16.10 @@ -223,8 +223,8 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 0.15.14 - '@visactor/vrender': 0.16.17 - '@visactor/vrender-components': 0.16.17 + '@visactor/vrender': 0.16.20 + '@visactor/vrender-components': 0.16.20 '@visactor/vscale': 0.16.0 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 0.16.18 @@ -3409,11 +3409,11 @@ packages: '@visactor/vutils': 0.16.18 roughjs: 4.5.2 - /@visactor/vrender/0.16.17: - resolution: {integrity: sha512-72woS3CQ7h3HHrPRneASgF17SLBifFTYY19BiCFxTiQZIfQJRm3aRems7Pbci8mTBDTwUDlWyAmF9jE2sit2mQ==} + /@visactor/vrender/0.16.20: + resolution: {integrity: sha512-2iJidENrlbQVyByaB8vajD4zDZ3K92+FdM1nhrLAbL8Nm09nohwuwjJ9ItsEq2VfemGT0XMSgBwsAH8VG6c/mQ==} dependencies: - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 dev: false /@visactor/vscale/0.16.0: diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 555f51a28..10939da2a 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -50,8 +50,8 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender": "0.16.17", - "@visactor/vrender-components": "0.16.17", + "@visactor/vrender": "0.16.20", + "@visactor/vrender-components": "0.16.20", "@visactor/vutils-extension": "1.5.1-alpha.0", "@visactor/vutils": "~0.16.10", "@visactor/vscale": "0.16.0", From 1c2213a64de9ce6d3953bb2389d709def565941c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 8 Dec 2023 09:21:22 +0000 Subject: [PATCH 35/35] build: prelease version 0.15.5 --- ...-vtable-sort-invalid_2023-12-06-07-32.json | 11 ------ .../fix-bug-fix-0.15.4_2023-12-04-03-54.json | 10 ----- .../fix-bug-fix-0.15.4_2023-12-04-08-50.json | 10 ----- .../fix-bug-fix-0.15.4_2023-12-04-12-57.json | 10 ----- .../fix-bug-fix-0.15.4_2023-12-05-11-36.json | 10 ----- .../fix-bug-fix-0.15.4_2023-12-06-08-31.json | 10 ----- .../fix-bug-fix-0.15.4_2023-12-06-10-04.json | 10 ----- .../fix-bug-fix-0.15.4_2023-12-07-08-57.json | 10 ----- .../fix-bug-fix-0.15.4_2023-12-07-12-30.json | 10 ----- .../fix-bug-fix-0.15.4_2023-12-08-06-27.json | 10 ----- common/config/rush/version-policies.json | 2 +- packages/react-vtable/package.json | 4 +- packages/vtable-editors/package.json | 2 +- packages/vtable/CHANGELOG.json | 39 +++++++++++++++++++ packages/vtable/CHANGELOG.md | 20 +++++++++- packages/vtable/package.json | 4 +- 16 files changed, 64 insertions(+), 108 deletions(-) delete mode 100644 common/changes/@visactor/vtable/677-bug-forbid-vtable-sort-invalid_2023-12-06-07-32.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-03-54.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-08-50.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-12-57.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-05-11-36.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-08-31.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-10-04.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-08-57.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json delete mode 100644 common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json diff --git a/common/changes/@visactor/vtable/677-bug-forbid-vtable-sort-invalid_2023-12-06-07-32.json b/common/changes/@visactor/vtable/677-bug-forbid-vtable-sort-invalid_2023-12-06-07-32.json deleted file mode 100644 index 859386c59..000000000 --- a/common/changes/@visactor/vtable/677-bug-forbid-vtable-sort-invalid_2023-12-06-07-32.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: updateOption to update updateEventBinder\n\n", - "type": "none", - "packageName": "@visactor/vtable" - } - ], - "packageName": "@visactor/vtable", - "email": "892739385@qq.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-03-54.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-03-54.json deleted file mode 100644 index 5aa955c78..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-03-54.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix tree structure bottom frozen update", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-08-50.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-08-50.json deleted file mode 100644 index 6a7d0002f..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-08-50.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "feat: axis support chart padding config", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-12-57.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-12-57.json deleted file mode 100644 index f0d76131f..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-04-12-57.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix limit column width adaptive update", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-05-11-36.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-05-11-36.json deleted file mode 100644 index 6acd91c7f..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-05-11-36.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix table range when container resize", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-08-31.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-08-31.json deleted file mode 100644 index e5f8dd4a3..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-08-31.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "feat: optimize pivot header performance", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-10-04.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-10-04.json deleted file mode 100644 index cf2f25fb1..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-06-10-04.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix table frame shadow color", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-08-57.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-08-57.json deleted file mode 100644 index b1c9af9d5..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-08-57.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix scroll position update problem", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json deleted file mode 100644 index 32ab8f6b7..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "feat: add axis theme", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json deleted file mode 100644 index f6996e8b6..000000000 --- a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "feat: overlay default and hover colors", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 57c801bdd..3ca1699e0 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.15.4","mainProject":"@visactor/vtable","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.15.5","mainProject":"@visactor/vtable","nextBump":"patch"}] diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index e81c4f2df..f211d5b88 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vtable", - "version": "0.15.4", + "version": "0.15.5", "description": "The react version of VTable", "keywords": [ "react", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} \ No newline at end of file +} diff --git a/packages/vtable-editors/package.json b/packages/vtable-editors/package.json index b6418aab3..2770f8bb6 100644 --- a/packages/vtable-editors/package.json +++ b/packages/vtable-editors/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-editors", - "version": "0.15.4", + "version": "0.15.5", "description": "", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/vtable/CHANGELOG.json b/packages/vtable/CHANGELOG.json index 5a8571c94..1c8873989 100644 --- a/packages/vtable/CHANGELOG.json +++ b/packages/vtable/CHANGELOG.json @@ -1,6 +1,45 @@ { "name": "@visactor/vtable", "entries": [ + { + "version": "0.15.5", + "tag": "@visactor/vtable_v0.15.5", + "date": "Fri, 08 Dec 2023 09:17:16 GMT", + "comments": { + "none": [ + { + "comment": "fix: updateOption to update updateEventBinder\n\n" + }, + { + "comment": "fix: fix tree structure bottom frozen update" + }, + { + "comment": "feat: axis support chart padding config" + }, + { + "comment": "fix: fix limit column width adaptive update" + }, + { + "comment": "fix: fix table range when container resize" + }, + { + "comment": "feat: optimize pivot header performance" + }, + { + "comment": "fix: fix table frame shadow color" + }, + { + "comment": "fix: fix scroll position update problem" + }, + { + "comment": "feat: add axis theme" + }, + { + "comment": "feat: overlay default and hover colors" + } + ] + } + }, { "version": "0.15.4", "tag": "@visactor/vtable_v0.15.4", diff --git a/packages/vtable/CHANGELOG.md b/packages/vtable/CHANGELOG.md index 9830c76d9..e00f13dfb 100644 --- a/packages/vtable/CHANGELOG.md +++ b/packages/vtable/CHANGELOG.md @@ -1,6 +1,24 @@ # Change Log - @visactor/vtable -This log was last generated on Fri, 01 Dec 2023 10:28:56 GMT and should not be manually modified. +This log was last generated on Fri, 08 Dec 2023 09:17:16 GMT and should not be manually modified. + +## 0.15.5 +Fri, 08 Dec 2023 09:17:16 GMT + +### Updates + +- fix: updateOption to update updateEventBinder + + +- fix: fix tree structure bottom frozen update +- feat: axis support chart padding config +- fix: fix limit column width adaptive update +- fix: fix table range when container resize +- feat: optimize pivot header performance +- fix: fix table frame shadow color +- fix: fix scroll position update problem +- feat: add axis theme +- feat: overlay default and hover colors ## 0.15.4 Fri, 01 Dec 2023 10:28:56 GMT diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 10939da2a..5ef8b8e79 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable", - "version": "0.15.4", + "version": "0.15.5", "description": "canvas table width high performance", "keywords": [ "grid", @@ -123,4 +123,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} \ No newline at end of file +}