Skip to content

Commit

Permalink
fix: fix column update in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Dec 25, 2024
1 parent 8a16ff9 commit b198473
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ export function createGroupForFirstScreen(
// proxy.colEnd = distCol;

distColForCompute = table.colCount - 1;
distCol = Math.min(proxy.firstScreenColLimit, table.colCount - 1);
distCol = Math.min(proxy.firstScreenColLimit - 1, table.colCount - 1);
} else {
distCol = Math.min(proxy.firstScreenColLimit, table.colCount - 1);
distCol = Math.min(proxy.firstScreenColLimit - 1, table.colCount - 1);
}
if (table.heightMode === 'adaptive') {
// distRow = table.rowCount - 1;
// proxy.rowEnd = distRow;

distRowForCompute = table.rowCount - 1;
distRow = Math.min(proxy.firstScreenRowLimit, table.rowCount - 1);
distRow = Math.min(proxy.firstScreenRowLimit - 1, table.rowCount - 1);
} else {
distRow = Math.min(proxy.firstScreenRowLimit, table.rowCount - 1);
distRow = Math.min(proxy.firstScreenRowLimit - 1, table.rowCount - 1);
}
if (table.internalProps._widthResizedColMap.size === 0) {
// compute colums width in first screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ export function updateColContent(syncLeftCol: number, syncRightCol: number, prox
const colGroup = proxy.table.scenegraph.getColGroup(col);
colGroup && updateColGroupContentAsync(colGroup, proxy);
}

// update column container width
updateColumnContainerWidth(proxy.table.scenegraph.colHeaderGroup);
updateColumnContainerWidth(proxy.table.scenegraph.bottomFrozenGroup);
updateColumnContainerWidth(proxy.table.scenegraph.bodyGroup);

proxy.progress();
}

Expand Down Expand Up @@ -331,3 +337,13 @@ function updateAllColPosition(distStartColY: number, count: number, direction: '
}
});
}

function updateColumnContainerWidth(containerGroup: Group) {
// update column container width
const lastColGroup = getLastChild(containerGroup);
if (!lastColGroup) {
return;
}
containerGroup.setAttribute('width', lastColGroup.attribute.x + lastColGroup.attribute.width);
containerGroup.border?.setAttribute('width', lastColGroup.attribute.x + lastColGroup.attribute.width);
}
2 changes: 1 addition & 1 deletion packages/vtable/src/scenegraph/layout/update-width.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ function resetRowHeight(scene: Scenegraph, row: number) {
const distHeight = maxHeight;
const cell = scene.highPerformanceGetCell(col, row);
if (cell.role === 'empty') {
return;
continue;
}

updateCellHeightForRow(
Expand Down
9 changes: 9 additions & 0 deletions packages/vtable/src/scenegraph/scenegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,24 @@ export class Scenegraph {
this.mergeMap.clear();

this.colHeaderGroup.clear();
delete this.colHeaderGroup.border;
this.rowHeaderGroup.clear();
delete this.rowHeaderGroup.border;
this.cornerHeaderGroup.clear();
delete this.cornerHeaderGroup.border;
this.bodyGroup.clear();
delete this.bodyGroup.border;

this.bottomFrozenGroup.clear();
delete this.bottomFrozenGroup.border;
this.rightFrozenGroup.clear();
delete this.rightFrozenGroup.border;
this.rightTopCornerGroup.clear();
delete this.rightTopCornerGroup.border;
this.rightBottomCornerGroup.clear();
delete this.rightBottomCornerGroup.border;
this.leftBottomCornerGroup.clear();
delete this.leftBottomCornerGroup.border;

this.colHeaderGroup.setAttributes({
x: 0,
Expand Down

0 comments on commit b198473

Please sign in to comment.