forked from neolution-ch/react-data-table
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReactDataTableProps.ts
More file actions
142 lines (119 loc) · 3.63 KB
/
ReactDataTableProps.ts
File metadata and controls
142 lines (119 loc) · 3.63 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import { Row, Table } from "@tanstack/react-table";
import { CSSProperties } from "react";
import { FilterModel } from "../types/TableState";
import { DragAndDropOptions } from "./DragAndDropOptions";
import { VirtualizationOptions } from "./VirtualizationOptions";
import { PagingNavigationComponents } from "@neolution-ch/react-pattern-ui";
import { useVirtualizationTableHeightProps } from "../hooks/useVirtualizationTableHeight";
/**
* The props for the ReactDataTable component
*/
export interface ReactDataTableProps<TData, TFilter extends FilterModel> extends Pick<
useVirtualizationTableHeightProps,
"onPseudoHeightChange"
> {
/**
* the table instance returned from useReactDataTable or useReactTable
*/
table: Table<TData>;
/**
* the page sizes to display in the page size dropdown
* @default [5, 10, 25, 50, 100]
*/
pageSizes?: number[];
/**
* custom table class name
*/
tableClassName?: string;
/**
* custom table style
*/
tableStyle?: CSSProperties;
/**
* custom header table row style
*/
tableHeaderStyle?: CSSProperties;
/**
* total number of records in the table, if not supplied,
* the table will assume that all the data is loaded and set it to the length of the data array
*/
totalRecords?: number;
/**
* indicates if the table is loading data for the first time
* will display skeletons if true
*/
isLoading?: boolean;
/**
* indicates if the table is fetching data
* will display loading indicator if true while keeping the data in the table and reactive
*/
isFetching?: boolean;
/**
* custom row style
* @param row the row to style
* @returns the style
*/
rowStyle?: (row: TData) => CSSProperties;
/**
* boolean indicating whether to enable click for specific row
* Notice that this is ignored in case of rowSelection feature is enabled and fullRowSelectable is not provided as false
* @param row the row model
*/
enableRowClick?: boolean | ((row: Row<TData>) => boolean);
/**
* callback which gets triggered when the row is clicked
* Notice that this is ignored in case of rowSelection feature is enabled and fullRowSelectable is not provided as false
* @param row the row model
*/
onRowClick?: (row: Row<TData>) => void | Promise<void>;
/**
* boolean flag to indicate if the paging should be displayed
*/
showPaging?: boolean;
/**
* boolean flag to hide the possibility to change the page size
*/
hidePageSizeChange?: boolean;
/**
* callback that gets trigger by pressing enter or clicking the search icon
*/
onEnter?: (columnFilters: TFilter) => void;
/**
* To draw the table without headers (titles + filters)
*/
withoutHeaders?: boolean;
/**
* to draw the table without headers filters
*/
withoutHeaderFilters?: boolean;
/**
* to define drag-and-drop options
*/
dragAndDropOptions?: DragAndDropOptions;
/**
* to define virtualizer options
*/
virtualizerOptions?: VirtualizationOptions;
/**
* to override the default message in case no entries is found
*/
noEntriesMessage?: string;
/**
* boolean flag to indicate if the table should be striped
* @default true
*/
isStriped?: boolean;
/**
* boolean flag to indicate if the table should have hover effect
* @default true
*/
showClearSearchButton?: boolean;
/**
* A component to render as a sub-row for a specific row, this will be rendered additionally to the subrows.
*/
subRowComponent?: (row: Row<TData>) => React.ReactNode;
/**
* Custom navigation components for the paging controls
*/
pagingNavigationComponents?: PagingNavigationComponents;
}