Skip to content

Commit

Permalink
fix: fix large number rows in updateRow()
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Oct 31, 2024
1 parent cfa5ec3 commit a64ebaf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,19 @@ export class SceneProxy {
const totalActualBodyRowCount = Math.min(this.rowLimit, this.bodyBottomRow - this.bodyTopRow + 1); // 渐进加载总row数量
this.totalActualBodyRowCount = totalActualBodyRowCount;
this.totalRow = this.rowStart + totalActualBodyRowCount - 1; // 目标渐进完成的row

this.rowStart = this.bodyTopRow;
this.rowEnd = this.totalRow; // temp for first screen, will replace in createGroupForFirstScreen()
}

refreshColCount() {
this.bodyRightCol = this.table.colCount - 1 - this.table.rightFrozenColCount;
const totalActualBodyColCount = Math.min(this.colLimit, this.bodyRightCol - this.bodyLeftCol + 1);
this.totalActualBodyColCount = totalActualBodyColCount;
this.totalCol = this.bodyLeftCol + totalActualBodyColCount - 1; // 目标渐进完成的col

this.colStart = this.bodyLeftCol;
this.colEnd = this.totalCol; // temp for first screen, will replace in createGroupForFirstScreen()
}

resize() {
Expand Down
27 changes: 18 additions & 9 deletions packages/vtable/src/scenegraph/layout/update-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,26 @@ export function updateRow(

for (let col = 0; col < table.colCount; col++) {
// add cells
updateRows.forEach(r => {
// updateRowAttr(row, scene);
const mergeInfo = getCellMergeInfo(scene.table, col, r);
if (mergeInfo) {
for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) {
for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) {
updateCell(col, row, scene.table, false);
updateRows.forEach(row => {
if (
row < table.frozenRowCount || // not top frozen
row > table.rowCount - 1 || // greater than rowCount - 1
(row < scene.table.rowCount - scene.table.bottomFrozenRowCount && // not bottom frozen
(row < scene.proxy.rowStart || row > scene.proxy.rowEnd)) // not in row range
) {
removeCellGroup(row, scene);
} else {
// updateRowAttr(row, scene);
const mergeInfo = getCellMergeInfo(scene.table, col, row);
if (mergeInfo) {
for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) {
for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) {
updateCell(col, row, scene.table, false);
}
}
} else {
updateCell(col, row, scene.table, false);
}
} else {
updateCell(col, r, scene.table, false);
}
});
}
Expand Down

0 comments on commit a64ebaf

Please sign in to comment.