-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dx-react-grid) remote virtual scrolling (#1936)
- Loading branch information
Showing
64 changed files
with
3,916 additions
and
1,268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/dx-grid-core/src/plugins/virtual-table-state/computeds.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { virtualRowsWithCache } from './computeds'; | ||
import { mergeRows } from './helpers'; | ||
import { createVirtualRows, createInterval } from './test-utils'; | ||
|
||
jest.mock('./helpers', () => ({ | ||
mergeRows: jest.fn(), | ||
})); | ||
|
||
describe('VirtualTableState computeds', () => { | ||
describe('#virtualRowsWithCache', () => { | ||
it('should call mergeRows with correct parameters', () => { | ||
const rowsInterval = createInterval(20, 30); | ||
const cacheInterval = createInterval(15, 25); | ||
const { skip, rows } = createVirtualRows(rowsInterval); | ||
const cache = createVirtualRows(cacheInterval); | ||
|
||
virtualRowsWithCache(skip, rows, cache); | ||
|
||
expect(mergeRows).toHaveBeenCalledWith( | ||
{ start: 20, end: 30 }, | ||
{ start: 15, end: 25 }, | ||
rows, | ||
cache.rows, | ||
20, | ||
15, | ||
); | ||
}); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/dx-grid-core/src/plugins/virtual-table-state/computeds.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { mergeRows } from './helpers'; | ||
import { intervalUtil } from './utils'; | ||
import { VirtualRowsWithCacheFn, PlainRowsFn, LoadedRowsStartFn } from '../../types'; | ||
|
||
export const virtualRowsWithCache: VirtualRowsWithCacheFn = (skip, rows, cache) => { | ||
const rowsInterval = intervalUtil.getRowsInterval({ skip, rows }); | ||
const cacheInterval = intervalUtil.getRowsInterval(cache); | ||
|
||
return mergeRows(rowsInterval, cacheInterval, rows, cache.rows, skip, cache.skip); | ||
}; | ||
|
||
export const plainRows: PlainRowsFn = virtualRows => virtualRows.rows; | ||
|
||
export const loadedRowsStart: LoadedRowsStartFn = virtualRows => virtualRows.skip; |
Oops, something went wrong.