From 1d5fb208a74f29b92898a469548f87f68c7e36ab Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 29 Dec 2023 18:02:00 +0800 Subject: [PATCH 1/2] fix: fix sort icon update --- .../vtable/fix-sort-icon_2023-12-29-10-01.json | 10 ++++++++++ packages/vtable/src/scenegraph/icon/icon-update.ts | 2 +- .../vtable/src/scenegraph/layout/update-width.ts | 13 +++++++------ packages/vtable/src/scenegraph/scenegraph.ts | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-sort-icon_2023-12-29-10-01.json diff --git a/common/changes/@visactor/vtable/fix-sort-icon_2023-12-29-10-01.json b/common/changes/@visactor/vtable/fix-sort-icon_2023-12-29-10-01.json new file mode 100644 index 000000000..7cb4a04d2 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-sort-icon_2023-12-29-10-01.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix sort icon update", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/icon/icon-update.ts b/packages/vtable/src/scenegraph/icon/icon-update.ts index 92bd932c2..55b7b8443 100644 --- a/packages/vtable/src/scenegraph/icon/icon-update.ts +++ b/packages/vtable/src/scenegraph/icon/icon-update.ts @@ -236,7 +236,7 @@ export function updateIcon(baseIcon: Icon, iconConfig: ColumnIconOption, col: nu col, row, // filter - (icon: Icon) => icon.name === baseIcon.name, + (icon: Icon) => icon.attribute.funcType === 'sort', // dealer (icon: Icon) => { dealWithIcon(iconConfig, icon); diff --git a/packages/vtable/src/scenegraph/layout/update-width.ts b/packages/vtable/src/scenegraph/layout/update-width.ts index 1fc971401..3a81267d2 100644 --- a/packages/vtable/src/scenegraph/layout/update-width.ts +++ b/packages/vtable/src/scenegraph/layout/update-width.ts @@ -37,9 +37,15 @@ export function updateColWidth(scene: Scenegraph, col: number, detaX: number, sk const autoRowHeight = scene.table.heightMode === 'autoHeight'; // deal with corner header or column header const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group; - if (colOrCornerHeaderColumn) { + const rightTopColumn = scene.getColGroupInRightTopCorner(col); + if (colOrCornerHeaderColumn && !rightTopColumn) { updateColunmWidth(colOrCornerHeaderColumn, detaX, autoRowHeight, 'col-corner', scene); } + // deal with right bottom frozen cells + if (rightTopColumn) { + updateColunmWidth(rightTopColumn, detaX, autoRowHeight, 'right-top', scene); + } + // deal with row header or body or right frozen cells const rowHeaderOrBodyColumn = scene.getColGroup(col) as Group; if (rowHeaderOrBodyColumn) { @@ -57,11 +63,6 @@ export function updateColWidth(scene: Scenegraph, col: number, detaX: number, sk updateColunmWidth(bottomColumn, detaX, autoRowHeight, 'bottom', scene); } // deal with right bottom frozen cells - const rightTopColumn = scene.getColGroupInRightTopCorner(col); - if (rightTopColumn) { - updateColunmWidth(rightTopColumn, detaX, autoRowHeight, 'right-top', scene); - } - // deal with right bottom frozen cells const rightBottomColumn = scene.getColGroupInRightBottomCorner(col); if (rightBottomColumn) { updateColunmWidth(rightBottomColumn, detaX, autoRowHeight, 'right-bottom', scene); diff --git a/packages/vtable/src/scenegraph/scenegraph.ts b/packages/vtable/src/scenegraph/scenegraph.ts index d3993dd35..6a406fe0f 100644 --- a/packages/vtable/src/scenegraph/scenegraph.ts +++ b/packages/vtable/src/scenegraph/scenegraph.ts @@ -1341,7 +1341,7 @@ export class Scenegraph { this.leftBottomCornerGroup.setDeltaWidth(cornerX - this.leftBottomCornerGroup.attribute.width); //TODO 可能有影响 this.colHeaderGroup.setDeltaWidth(colHeaderX - this.colHeaderGroup.attribute.width); - this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.table.getRightFrozenColsWidth()); + // this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.table.getRightFrozenColsWidth()); this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width); this.bottomFrozenGroup.setDeltaWidth(rowHeaderX - this.bottomFrozenGroup.attribute.width); this.rightFrozenGroup.setDeltaWidth(rightX - this.table.getRightFrozenColsWidth()); From 60cd1113d18b81f6adde95ad800e69189e1ad9d6 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 29 Dec 2023 19:06:11 +0800 Subject: [PATCH 2/2] fix: fix icon name update problem --- packages/vtable/src/scenegraph/icon/icon-update.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vtable/src/scenegraph/icon/icon-update.ts b/packages/vtable/src/scenegraph/icon/icon-update.ts index 55b7b8443..685885f73 100644 --- a/packages/vtable/src/scenegraph/icon/icon-update.ts +++ b/packages/vtable/src/scenegraph/icon/icon-update.ts @@ -231,12 +231,12 @@ export function updateIcon(baseIcon: Icon, iconConfig: ColumnIconOption, col: nu // dealWithIcon(iconConfig, icon); // icon.name = iconConfig.name; // scene.updateNextFrame(); - + const iconName = baseIcon.name; updateCellRangeIcon( col, row, // filter - (icon: Icon) => icon.attribute.funcType === 'sort', + (icon: Icon) => icon.name === iconName, // dealer (icon: Icon) => { dealWithIcon(iconConfig, icon);