-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
43 lines (37 loc) · 1.14 KB
/
types.ts
File metadata and controls
43 lines (37 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import type React from 'react';
import type { Row, TableInstance, TableState } from 'react-table';
export interface Column {
key: string;
title: string | React.ReactNode;
filterable?: boolean;
render?: (value: string | number, item: DataItem) => React.ReactNode;
sortable?: boolean;
customSortFn?: (rowA: DataItem, rowB: DataItem, columnId: string) => number;
}
export interface DataItem {
id: number;
name: string;
value: number;
status: 'Active' | 'Inactive' | 'Pending';
children?: DataItem[];
}
export interface TableStateWithPagination<T extends object> extends TableState<T> {
pageIndex: number;
pageSize: number;
}
export interface TableInstanceWithHooks<T extends object> extends TableInstance<T> {
page: Row<T>[];
canPreviousPage: boolean;
canNextPage: boolean;
pageOptions: number[];
pageCount: number;
gotoPage: (updater: number | ((pageIndex: number) => number)) => void;
nextPage: () => void;
previousPage: () => void;
setPageSize: (pageSize: number) => void;
state: TableStateWithPagination<T>;
}
export interface SelectionState {
selectedRows: Set<string | number>;
isAllSelected: boolean;
}