@payfit/unity-components
Version:
23 lines (22 loc) • 900 B
TypeScript
import { ReactTable as TableType, RowData, TableFeatures } from '@tanstack/react-table';
type SelectionSource<T> = {
get: () => T;
subscribe: (listener: (value: T) => void) => {
unsubscribe: () => void;
};
};
type PaginationState = {
pageIndex: number;
pageSize: number;
};
export type PaginationCapableTable<TFeatures extends TableFeatures, TData extends RowData> = TableType<TFeatures, TData> & {
atoms: TableType<TFeatures, TData>['atoms'] & {
pagination: SelectionSource<PaginationState>;
};
getPageCount: () => number;
getRowCount: () => number;
setPageIndex: (pageIndex: number) => void;
setPageSize: (pageSize: number) => void;
};
export declare const getPaginationTable: <TFeatures extends TableFeatures, TData extends RowData>(table: TableType<TFeatures, TData>) => PaginationCapableTable<TFeatures, TData> | undefined;
export {};