feat(pagination): add pagination state management and cursor handling

This commit is contained in:
2026-02-15 22:24:38 +02:00
parent 7244bd33fc
commit 391450f615
6 changed files with 97 additions and 72 deletions

View File

@@ -64,18 +64,20 @@ export interface GriddyStoreState extends GriddyUIState {
onSortingChange?: (sorting: SortingState) => void;
overscan?: number;
pagination?: PaginationConfig;
paginationState?: { pageIndex: number; pageSize: number };
persistenceKey?: string;
rowHeight?: number;
rowSelection?: RowSelectionState;
rowSelection?: RowSelectionState;
search?: SearchConfig;
selection?: SelectionConfig;
setData: (data: any[]) => void;
setDataCount: (count: number) => void;
setError: (error: Error | null) => void;
setInfiniteScroll: (config: InfiniteScrollConfig | undefined) => void;
setInfiniteScroll: (config: InfiniteScrollConfig | undefined) => void;
setIsLoading: (loading: boolean) => void;
setPaginationState: (state: { pageIndex: number; pageSize: number }) => void;
setScrollRef: (el: HTMLDivElement | null) => void;
// ─── Internal ref setters ───
setTable: (table: Table<any>) => void;
@@ -131,6 +133,7 @@ export const { Provider: GriddyProvider, useStore: useGriddyStore } = createSync
setFocusedRow: (index) => set({ focusedRowIndex: index }),
setInfiniteScroll: (config) => set({ infiniteScroll: config }),
setIsLoading: (loading) => set({ isLoading: loading }),
setPaginationState: (state) => set({ paginationState: state }),
setScrollRef: (el) => set({ _scrollRef: el }),
setSearchOpen: (open) => set({ isSearchOpen: open }),