Skip to content

Commit

Permalink
fix: fix react component update
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Jul 12, 2024
1 parent 81087cb commit a346932
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/vtable/src/components/react/react-custom-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,16 @@ function getUpdateCustomCellRangeInListTable(componentId: string, table: BaseTab
}
}

// return {
// start: {
// col: 0,
// row: 0
// },
// end: {
// col: table.colCount - 1,
// row: table.rowCount - 1
// }
// };
return {
start: {
col: 0,
row: 0
},
end: {
col: table.colCount - 1,
row: table.rowCount - 1
}
};
}

function getUpdateCustomCellRangeInPivotTable(
Expand Down
3 changes: 3 additions & 0 deletions packages/vtable/src/scenegraph/component/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,9 @@ function onBeforeAttributeUpdate(val: Record<string, any>, attribute: any) {
return;
}
const cellGroup = getTargetCell(graphic) as Group;
if (!cellGroup || cellGroup.stage) {
return;
}
const table = ((cellGroup as any).stage as any).table as BaseTableAPI;
graphic.skipAttributeUpdate = true;
const { mergeStartCol, mergeEndCol, mergeStartRow, mergeEndRow } = cellGroup;
Expand Down
4 changes: 4 additions & 0 deletions packages/vtable/src/scenegraph/layout/update-height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ export function updateCellHeight(
(cell.getChildByName(CUSTOM_CONTAINER_NAME) as Group) ||
(cell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME) as Group);
if (customContainer) {
if (scene.table.reactCustomLayout) {
scene.table.reactCustomLayout.removeCustomCell(col, row);
}

let customElementsGroup;
customContainer.removeAllChild();
cell.removeChild(customContainer);
Expand Down
3 changes: 3 additions & 0 deletions packages/vtable/src/scenegraph/layout/update-width.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ function updateCellWidth(
(cell.getChildByName(CUSTOM_CONTAINER_NAME) as Group) ||
(cell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME) as Group);
if (customContainer) {
if (scene.table.reactCustomLayout) {
scene.table.reactCustomLayout.removeCustomCell(col, row);
}
let customElementsGroup;
customContainer.removeAllChild();
cell.removeChild(customContainer);
Expand Down

0 comments on commit a346932

Please sign in to comment.