mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-21 06:00:39 +00:00
fix(grid): cover horizontal wheel pagination
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user