feat(grid): load all remaining rows with confirmation guard
This commit is contained in:
25 files changed
+336
-27
No files matched your search
@@ -31,6 +31,11 @@ export interface CanFetchNextDataGridSegmentOptions {
|
||||
allRowsLoaded?: boolean;
|
||||
}
|
||||
|
||||
export interface DataGridLoadAllSegment {
|
||||
offset: number;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
export type DataGridInexactTotalRowCountMode = "at-least" | "estimated";
|
||||
|
||||
export const ELASTICSEARCH_PAGE_JUMP_WARNING_REQUESTS = 100;
|
||||
@@ -109,3 +114,10 @@ export function canFetchNextDataGridSegment(options: CanFetchNextDataGridSegment
|
||||
if (options.allRowsLoaded === true) return false;
|
||||
return options.loadedRowCount >= Math.max(1, options.pageSize);
|
||||
}
|
||||
|
||||
export function dataGridLoadAllSegment(loadedRowCount: number, maxRows: number, canFetchMore: boolean): DataGridLoadAllSegment | null {
|
||||
const offset = Number.isFinite(loadedRowCount) ? Math.max(0, Math.trunc(loadedRowCount)) : 0;
|
||||
const boundedMaxRows = Number.isFinite(maxRows) ? Math.max(0, Math.trunc(maxRows)) : 0;
|
||||
if (!canFetchMore || offset >= boundedMaxRows) return null;
|
||||
return { offset, limit: boundedMaxRows - offset };
|
||||
}
|
||||
Reference in new issue
Block a user