Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 1 addition & 19 deletions packages/vtable/src/scenegraph/scenegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading