fix(grid): cover horizontal wheel pagination

This commit is contained in:
t8y2
2026-07-03 00:02:11 +08:00
parent ff73a1df42
commit 46c0309c39
2 changed files with 6 additions and 0 deletions
@@ -18,6 +18,7 @@ export function dataGridScrollPosition(top: number, left: number): DataGridScrol
export function shouldCheckInfiniteScrollAfterScroll(previous: DataGridScrollPosition | undefined, current: DataGridScrollPosition): boolean {
if (!previous) return false;
// Shift+wheel horizontal scrolling changes scrollLeft only and must not paginate.
return previous.top !== current.top;
}
@@ -6,6 +6,11 @@ test("horizontal-only scroll does not check infinite scroll", () => {
assert.equal(shouldCheckInfiniteScrollAfterScroll(dataGridScrollPosition(240, 0), dataGridScrollPosition(240, 180)), false);
});
test("shift-wheel horizontal scroll near the bottom does not check infinite scroll", () => {
assert.equal(isDataGridNearScrollBottom({ scrollTop: 0, scrollHeight: 80, clientHeight: 120 }), true);
assert.equal(shouldCheckInfiniteScrollAfterScroll(dataGridScrollPosition(0, 0), dataGridScrollPosition(0, 320)), false);
});
test("vertical scroll checks infinite scroll even when horizontal offset also changes", () => {
assert.equal(shouldCheckInfiniteScrollAfterScroll(dataGridScrollPosition(240, 0), dataGridScrollPosition(360, 180)), true);
});