Skip to content
Open
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: handle right frozen column count update",
"type": "none",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "biukam.w@gmail.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,28 @@ describe('listTable init test', () => {
rowEnd: 29
});
});

test('listTable should support decreasing rightFrozenColCount by setter with row series number', () => {
const optionWithRightFrozen = {
...option,
bottomFrozenRowCount: 0,
rowSeriesNumber: {
title: 'index',
dragOrder: true,
width: 'auto'
},
container: createDiv(),
records
};
optionWithRightFrozen.container.style.position = 'relative';
optionWithRightFrozen.container.style.width = '1000px';
optionWithRightFrozen.container.style.height = '800px';

const rightFrozenTable = new ListTable(optionWithRightFrozen);

expect(() => {
rightFrozenTable.rightFrozenColCount = 1;
}).not.toThrow();
expect(rightFrozenTable.rightFrozenColCount).toBe(1);
});
});
18 changes: 11 additions & 7 deletions packages/vtable/src/scenegraph/layout/frozen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ export function dealRightFrozen(distRightFrozenCol: number, scene: Scenegraph) {
const headerColGroup = scene.getColGroup(col, true);
insertBefore(rightTopCornerGroup, headerColGroup, rightTopCornerGroup.firstChild as Group);
const bottomColGroup = scene.getColGroupInBottom(col);
insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild as Group);
if (bottomColGroup) {
insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild as Group);
}
}
// reset cell y
let x = 0;
Expand Down Expand Up @@ -268,12 +270,14 @@ export function dealRightFrozen(distRightFrozenCol: number, scene: Scenegraph) {
);
colHeaderGroup.appendChild(headerColGroup);
const bottomColGroup = scene.getColGroupInRightBottomCorner(col);
bottomColGroup.setAttribute(
'x',
(bottomFrozenGroup.lastChild as Group).attribute.x +
table.getColWidth((bottomFrozenGroup.lastChild as Group).col)
);
bottomFrozenGroup.appendChild(bottomColGroup);
if (bottomColGroup) {
const lastBottomColGroup = bottomFrozenGroup.lastChild as Group | undefined;
bottomColGroup.setAttribute(
'x',
lastBottomColGroup ? lastBottomColGroup.attribute.x + table.getColWidth(lastBottomColGroup.col) : 0
);
bottomFrozenGroup.appendChild(bottomColGroup);
}
}
// reset cell y
let x = 0;
Expand Down
Loading