diff --git a/common/changes/@visactor/vtable/fix-issue-5253-frozen-row-layout_2026-07-29-17-46.json b/common/changes/@visactor/vtable/fix-issue-5253-frozen-row-layout_2026-07-29-17-46.json new file mode 100644 index 0000000000..20cd59f063 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-issue-5253-frozen-row-layout_2026-07-29-17-46.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: align frozen rows in short tables", + "type": "patch", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "biukam.w@gmail.com" +} diff --git a/packages/vtable/__tests__/options/listTable-api-with-frozen.test.ts b/packages/vtable/__tests__/options/listTable-api-with-frozen.test.ts index 4a243da287..b2839d24f8 100644 --- a/packages/vtable/__tests__/options/listTable-api-with-frozen.test.ts +++ b/packages/vtable/__tests__/options/listTable-api-with-frozen.test.ts @@ -143,6 +143,28 @@ describe('listTable init test', () => { }); }); + test('listTable should keep bottom frozen rows next to short table content', () => { + const shortTableContainer = createDiv(); + shortTableContainer.style.position = 'relative'; + shortTableContainer.style.width = '1000px'; + shortTableContainer.style.height = '800px'; + + const shortTable = new ListTable({ + ...option, + container: shortTableContainer, + records: records.slice(0, 6), + frozenRowCount: 4, + bottomFrozenRowCount: 1 + }); + const contentHeight = shortTable.getAllRowsHeight(); + const bottomFrozenHeight = shortTable.getBottomFrozenRowsHeight(); + + expect(shortTable.scenegraph.tableGroup.attribute.height).toBe(contentHeight); + expect(shortTable.scenegraph.bottomFrozenGroup.attribute.y).toBe(contentHeight - bottomFrozenHeight); + + shortTable.release(); + }); + test('listTable should support decreasing rightFrozenColCount by setter with row series number', () => { const optionWithRightFrozen = { ...option, diff --git a/packages/vtable/src/scenegraph/scenegraph.ts b/packages/vtable/src/scenegraph/scenegraph.ts index 0330409fa0..99eb7834f0 100644 --- a/packages/vtable/src/scenegraph/scenegraph.ts +++ b/packages/vtable/src/scenegraph/scenegraph.ts @@ -1316,25 +1316,7 @@ export class Scenegraph { 0 ); - const contentHeight = - Math.max( - this.colHeaderGroup.attribute.height, - this.cornerHeaderGroup.attribute.height, - this.rightTopCornerGroup.attribute.height, - 0 - ) + - Math.max( - this.rowHeaderGroup.attribute.height, - this.bodyGroup.attribute.height, - this.rightFrozenGroup.attribute.height, - 0 - ) + - Math.max( - this.leftBottomCornerGroup.attribute.height, - this.bottomFrozenGroup.attribute.height, - this.rightBottomCornerGroup.attribute.height, - 0 - ); + const contentHeight = this.table.getAllRowsHeight(); // 处理containerFit模式 let tableWidth = contentWidth;