From 36e2e8ac9f9c82a872f308b194e5f591a91b25f0 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 5 Nov 2024 14:30:37 +0800 Subject: [PATCH] fix: fix cellLocation in pivot-table #2694 --- .../fix-pivot-frozen-col_2024-11-05-06-26.json | 10 ++++++++++ .../src/scenegraph/group-creater/column-helper.ts | 3 ++- .../vtable/src/scenegraph/group-creater/column.ts | 2 +- .../src/scenegraph/group-creater/progress/proxy.ts | 12 ++++++------ 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-pivot-frozen-col_2024-11-05-06-26.json diff --git a/common/changes/@visactor/vtable/fix-pivot-frozen-col_2024-11-05-06-26.json b/common/changes/@visactor/vtable/fix-pivot-frozen-col_2024-11-05-06-26.json new file mode 100644 index 000000000..1afbf747c --- /dev/null +++ b/common/changes/@visactor/vtable/fix-pivot-frozen-col_2024-11-05-06-26.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix cellLocation in pivot-table #2694", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/group-creater/column-helper.ts b/packages/vtable/src/scenegraph/group-creater/column-helper.ts index b47473d76..64949c230 100644 --- a/packages/vtable/src/scenegraph/group-creater/column-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/column-helper.ts @@ -42,7 +42,7 @@ export function createComplexColumn( mergeMap: MergeMap, defaultRowHeight: number | number[], table: BaseTableAPI, - cellLocation: CellLocation, + // cellLocation: CellLocation, rowLimit?: number ) { let padding; @@ -63,6 +63,7 @@ export function createComplexColumn( for (let j = rowStart; j <= rowEnd; j++) { const row = j; + let cellLocation = table.getCellLocation(col, row); let value = table.getCellValue(col, row); // 处理单元格合并 diff --git a/packages/vtable/src/scenegraph/group-creater/column.ts b/packages/vtable/src/scenegraph/group-creater/column.ts index 4e8390a62..5e82d9d53 100644 --- a/packages/vtable/src/scenegraph/group-creater/column.ts +++ b/packages/vtable/src/scenegraph/group-creater/column.ts @@ -152,7 +152,7 @@ export function createColGroup( table.scenegraph.mergeMap, cellLocation === 'columnHeader' && isNumber(defaultHeaderRowHeight) ? defaultHeaderRowHeight : defaultRowHeight, table, - cellLocation, + // cellLocation, rowLimit ); x += default2Width; diff --git a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts index d5789caa9..1c98ed78f 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts @@ -314,8 +314,8 @@ export class SceneProxy { endRow, this.table.scenegraph.mergeMap, this.table.internalProps.defaultRowHeight, - this.table, - cellLocation + this.table + // cellLocation ); maxHeight = Math.max(maxHeight, height); this.table.scenegraph.rowHeaderGroup.setAttribute('height', maxHeight); @@ -336,8 +336,8 @@ export class SceneProxy { endRow, this.table.scenegraph.mergeMap, this.table.internalProps.defaultRowHeight, - this.table, - cellLocation + this.table + // cellLocation ); maxHeight = Math.max(maxHeight, height); this.table.scenegraph.rightFrozenGroup.setAttribute('height', maxHeight); @@ -360,8 +360,8 @@ export class SceneProxy { endRow, this.table.scenegraph.mergeMap, this.table.internalProps.defaultRowHeight, - this.table, - cellLocation + this.table + // cellLocation ); maxHeight = Math.max(maxHeight, height); }