material-react-table 0.18.1 → 0.19.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MaterialReactTable.d.ts +166 -133
- package/dist/body/MRT_TableBody.d.ts +1 -1
- package/dist/body/MRT_TableBodyCell.d.ts +1 -1
- package/dist/body/MRT_TableBodyRow.d.ts +1 -1
- package/dist/body/MRT_TableDetailPanel.d.ts +1 -1
- package/dist/buttons/MRT_ColumnPinningButtons.d.ts +1 -1
- package/dist/buttons/MRT_CopyButton.d.ts +1 -1
- package/dist/buttons/MRT_EditActionButtons.d.ts +1 -1
- package/dist/buttons/MRT_ExpandAllButton.d.ts +1 -1
- package/dist/buttons/MRT_ExpandButton.d.ts +1 -1
- package/dist/buttons/MRT_FullScreenToggleButton.d.ts +1 -1
- package/dist/buttons/MRT_GrabHandleButton.d.ts +1 -1
- package/dist/buttons/MRT_ShowHideColumnsButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleFiltersButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +1 -1
- package/dist/filtersFns.d.ts +31 -23
- package/dist/footer/MRT_TableFooter.d.ts +1 -1
- package/dist/footer/MRT_TableFooterCell.d.ts +1 -1
- package/dist/footer/MRT_TableFooterRow.d.ts +1 -1
- package/dist/head/MRT_DraggableTableHeadCell.d.ts +1 -1
- package/dist/head/MRT_TableHead.d.ts +1 -1
- package/dist/head/MRT_TableHeadCell.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellColumnActionsButton.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellFilterContainer.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellFilterLabel.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellResizeHandle.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellSortLabel.d.ts +1 -1
- package/dist/head/MRT_TableHeadRow.d.ts +1 -1
- package/dist/inputs/MRT_EditCellTextField.d.ts +1 -1
- package/dist/inputs/MRT_FilterRangeFields.d.ts +1 -1
- package/dist/inputs/MRT_FilterTextField.d.ts +1 -1
- package/dist/inputs/MRT_GlobalFilterTextField.d.ts +1 -1
- package/dist/inputs/MRT_SelectCheckbox.d.ts +1 -1
- package/dist/material-react-table.cjs.development.js +756 -756
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +757 -757
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_ColumnActionMenu.d.ts +1 -1
- package/dist/menus/MRT_FilterOptionMenu.d.ts +1 -1
- package/dist/menus/MRT_RowActionMenu.d.ts +1 -1
- package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +1 -1
- package/dist/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -1
- package/dist/sortingFns.d.ts +10 -3
- package/dist/table/MRT_Table.d.ts +1 -1
- package/dist/table/MRT_TableContainer.d.ts +1 -1
- package/dist/table/MRT_TablePaper.d.ts +1 -1
- package/dist/toolbar/MRT_LinearProgressBar.d.ts +1 -1
- package/dist/toolbar/MRT_TablePagination.d.ts +1 -1
- package/dist/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/toolbar/MRT_ToolbarBottom.d.ts +1 -1
- package/dist/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -1
- package/dist/toolbar/MRT_ToolbarTop.d.ts +1 -1
- package/dist/utils.d.ts +10 -16
- package/package.json +4 -4
- package/src/MaterialReactTable.tsx +163 -156
- package/src/body/MRT_TableBody.tsx +5 -6
- package/src/body/MRT_TableBodyCell.tsx +18 -27
- package/src/body/MRT_TableBodyRow.tsx +7 -7
- package/src/body/MRT_TableDetailPanel.tsx +7 -7
- package/src/buttons/MRT_ColumnPinningButtons.tsx +3 -3
- package/src/buttons/MRT_CopyButton.tsx +5 -7
- package/src/buttons/MRT_EditActionButtons.tsx +4 -5
- package/src/buttons/MRT_ExpandAllButton.tsx +4 -5
- package/src/buttons/MRT_ExpandButton.tsx +4 -5
- package/src/buttons/MRT_FullScreenToggleButton.tsx +3 -7
- package/src/buttons/MRT_GrabHandleButton.tsx +39 -41
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +4 -4
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +3 -7
- package/src/buttons/MRT_ToggleFiltersButton.tsx +3 -4
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +4 -8
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +6 -6
- package/src/filtersFns.ts +24 -23
- package/src/footer/MRT_TableFooter.tsx +5 -6
- package/src/footer/MRT_TableFooterCell.tsx +8 -11
- package/src/footer/MRT_TableFooterRow.tsx +5 -9
- package/src/head/MRT_DraggableTableHeadCell.tsx +4 -6
- package/src/head/MRT_TableHead.tsx +5 -5
- package/src/head/MRT_TableHeadCell.tsx +18 -29
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +6 -8
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +5 -7
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +13 -19
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +12 -11
- package/src/head/MRT_TableHeadCellSortLabel.tsx +3 -5
- package/src/head/MRT_TableHeadRow.tsx +6 -6
- package/src/inputs/MRT_EditCellTextField.tsx +12 -14
- package/src/inputs/MRT_FilterRangeFields.tsx +4 -4
- package/src/inputs/MRT_FilterTextField.tsx +27 -38
- package/src/inputs/MRT_GlobalFilterTextField.tsx +5 -6
- package/src/inputs/MRT_SelectCheckbox.tsx +9 -12
- package/src/menus/MRT_ColumnActionMenu.tsx +5 -9
- package/src/menus/MRT_FilterOptionMenu.tsx +16 -48
- package/src/menus/MRT_RowActionMenu.tsx +4 -5
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +8 -9
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +11 -10
- package/src/sortingFns.ts +11 -3
- package/src/table/MRT_Table.tsx +7 -11
- package/src/table/MRT_TableContainer.tsx +5 -6
- package/src/table/MRT_TablePaper.tsx +7 -8
- package/src/table/MRT_TableRoot.tsx +118 -132
- package/src/toolbar/MRT_LinearProgressBar.tsx +4 -5
- package/src/toolbar/MRT_TablePagination.tsx +7 -9
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +6 -7
- package/src/toolbar/MRT_ToolbarBottom.tsx +8 -9
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +10 -10
- package/src/toolbar/MRT_ToolbarTop.tsx +11 -11
- package/src/utils.ts +56 -50
|
@@ -30,28 +30,25 @@ import {
|
|
|
30
30
|
Column,
|
|
31
31
|
ColumnDef,
|
|
32
32
|
FilterFn,
|
|
33
|
-
FilterFnOption,
|
|
34
33
|
Header,
|
|
35
34
|
HeaderGroup,
|
|
36
35
|
OnChangeFn,
|
|
37
|
-
Overwrite,
|
|
38
|
-
ReactTableGenerics,
|
|
39
36
|
Row,
|
|
40
37
|
SortingFn,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
TableInstance,
|
|
38
|
+
Table,
|
|
39
|
+
TableOptions,
|
|
44
40
|
TableState,
|
|
45
|
-
UseTableInstanceOptions,
|
|
46
41
|
} from '@tanstack/react-table';
|
|
47
42
|
import { Options as VirtualizerOptions } from 'react-virtual';
|
|
48
43
|
import { MRT_Localization, MRT_DefaultLocalization_EN } from './localization';
|
|
49
44
|
import { MRT_Default_Icons, MRT_Icons } from './icons';
|
|
50
45
|
import { MRT_TableRoot } from './table/MRT_TableRoot';
|
|
46
|
+
import { MRT_FilterFns } from './filtersFns';
|
|
47
|
+
import { MRT_SortingFns } from './sortingFns';
|
|
51
48
|
|
|
52
49
|
export type MRT_TableOptions<D extends Record<string, any> = {}> = Partial<
|
|
53
50
|
Omit<
|
|
54
|
-
|
|
51
|
+
TableOptions<D>,
|
|
55
52
|
'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn'
|
|
56
53
|
>
|
|
57
54
|
> & {
|
|
@@ -69,14 +66,7 @@ export interface MRT_RowModel<D extends Record<string, any> = {}> {
|
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
|
|
72
|
-
|
|
73
|
-
Overwrite<
|
|
74
|
-
Partial<TableGenerics>,
|
|
75
|
-
{
|
|
76
|
-
Row: D;
|
|
77
|
-
}
|
|
78
|
-
>
|
|
79
|
-
>,
|
|
69
|
+
Table<D>,
|
|
80
70
|
| 'getAllColumns'
|
|
81
71
|
| 'getAllFlatColumns'
|
|
82
72
|
| 'getAllLeafColumns'
|
|
@@ -118,10 +108,10 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
|
|
|
118
108
|
setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row | null>>;
|
|
119
109
|
setCurrentFilterFns: Dispatch<
|
|
120
110
|
SetStateAction<{
|
|
121
|
-
[key: string]:
|
|
111
|
+
[key: string]: MRT_FilterOption;
|
|
122
112
|
}>
|
|
123
113
|
>;
|
|
124
|
-
setCurrentGlobalFilterFn: Dispatch<SetStateAction<
|
|
114
|
+
setCurrentGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterOption>>;
|
|
125
115
|
setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
|
|
126
116
|
setIsFullScreen: Dispatch<SetStateAction<boolean>>;
|
|
127
117
|
setShowAlertBanner: Dispatch<SetStateAction<boolean>>;
|
|
@@ -132,8 +122,8 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
|
|
|
132
122
|
export type MRT_TableState<D extends Record<string, any> = {}> = TableState & {
|
|
133
123
|
currentEditingCell: MRT_Cell<D> | null;
|
|
134
124
|
currentEditingRow: MRT_Row<D> | null;
|
|
135
|
-
currentFilterFns: Record<string,
|
|
136
|
-
currentGlobalFilterFn: Record<string,
|
|
125
|
+
currentFilterFns: Record<string, MRT_FilterOption>;
|
|
126
|
+
currentGlobalFilterFn: Record<string, MRT_FilterOption>;
|
|
137
127
|
density: 'comfortable' | 'compact' | 'spacious';
|
|
138
128
|
isLoading: boolean;
|
|
139
129
|
isFullScreen: boolean;
|
|
@@ -147,165 +137,204 @@ export type MRT_TableState<D extends Record<string, any> = {}> = TableState & {
|
|
|
147
137
|
export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
148
138
|
ColumnDef<D>,
|
|
149
139
|
| 'accessorFn'
|
|
140
|
+
| 'accessorKey'
|
|
150
141
|
| 'aggregatedCell'
|
|
151
142
|
| 'cell'
|
|
152
143
|
| 'columns'
|
|
153
144
|
| 'filterFn'
|
|
154
145
|
| 'footer'
|
|
155
146
|
| 'header'
|
|
147
|
+
| 'id'
|
|
156
148
|
| 'sortingFn'
|
|
157
149
|
> & {
|
|
158
150
|
AggregatedCell?: ({
|
|
159
151
|
cell,
|
|
160
|
-
|
|
152
|
+
table,
|
|
161
153
|
}: {
|
|
162
154
|
cell: MRT_Cell<D>;
|
|
163
|
-
|
|
155
|
+
table: MRT_TableInstance<D>;
|
|
164
156
|
}) => ReactNode;
|
|
165
157
|
Cell?: ({
|
|
166
158
|
cell,
|
|
167
|
-
|
|
159
|
+
table,
|
|
168
160
|
}: {
|
|
169
161
|
cell: MRT_Cell<D>;
|
|
170
|
-
|
|
162
|
+
table: MRT_TableInstance<D>;
|
|
171
163
|
}) => ReactNode;
|
|
172
164
|
Edit?: ({
|
|
173
165
|
cell,
|
|
174
|
-
|
|
166
|
+
table,
|
|
175
167
|
}: {
|
|
176
168
|
cell: MRT_Cell<D>;
|
|
177
|
-
|
|
169
|
+
table: MRT_TableInstance<D>;
|
|
178
170
|
}) => ReactNode;
|
|
179
171
|
Filter?: ({
|
|
180
172
|
header,
|
|
181
|
-
|
|
173
|
+
table,
|
|
182
174
|
}: {
|
|
183
175
|
header: MRT_Header<D>;
|
|
184
|
-
|
|
176
|
+
table: MRT_TableInstance<D>;
|
|
185
177
|
}) => ReactNode;
|
|
186
178
|
Footer?:
|
|
187
179
|
| ReactNode
|
|
188
180
|
| (({
|
|
189
181
|
footer,
|
|
190
|
-
|
|
182
|
+
table,
|
|
191
183
|
}: {
|
|
192
184
|
footer: MRT_Header<D>;
|
|
193
|
-
|
|
185
|
+
table: MRT_TableInstance<D>;
|
|
194
186
|
}) => ReactNode);
|
|
195
187
|
Header?:
|
|
196
188
|
| ReactNode
|
|
197
189
|
| (({
|
|
198
190
|
header,
|
|
199
|
-
|
|
191
|
+
table,
|
|
200
192
|
}: {
|
|
201
193
|
header: MRT_Header<D>;
|
|
202
|
-
|
|
194
|
+
table: MRT_TableInstance<D>;
|
|
203
195
|
}) => ReactNode);
|
|
196
|
+
/**
|
|
197
|
+
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
|
198
|
+
* Specify a function here to point to the correct property in the data object.
|
|
199
|
+
*
|
|
200
|
+
* @example accessorFn: (row) => row.username
|
|
201
|
+
*/
|
|
204
202
|
accessorFn?: (row: D) => any;
|
|
203
|
+
/**
|
|
204
|
+
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
|
205
|
+
* Specify which key in the row this column should use to access the correct data.
|
|
206
|
+
*
|
|
207
|
+
* @example accessorKey: 'username'
|
|
208
|
+
*/
|
|
209
|
+
accessorKey?: keyof D;
|
|
210
|
+
/**
|
|
211
|
+
* Specify what type of column this is. Either `data`, `display`, or `group`. Defaults to `data`.
|
|
212
|
+
* Leave this blank if you are just creating a normal data column.
|
|
213
|
+
*
|
|
214
|
+
* @default 'data'
|
|
215
|
+
*
|
|
216
|
+
* @example columnDefType: 'display'
|
|
217
|
+
*/
|
|
218
|
+
columnDefType?: 'data' | 'display' | 'group';
|
|
205
219
|
columns?: MRT_ColumnDef<D>[];
|
|
206
220
|
enableClickToCopy?: boolean;
|
|
207
221
|
enableColumnActions?: boolean;
|
|
208
222
|
enableColumnFilterChangeMode?: boolean;
|
|
209
223
|
enableColumnOrdering?: boolean;
|
|
210
224
|
enableEditing?: boolean;
|
|
211
|
-
enabledColumnFilterOptions?:
|
|
212
|
-
filterFn?: MRT_FilterFn
|
|
225
|
+
enabledColumnFilterOptions?: MRT_FilterOption[] | null;
|
|
226
|
+
filterFn?: MRT_FilterFn<D>;
|
|
213
227
|
filterSelectOptions?: (string | { text: string; value: string })[];
|
|
214
228
|
footer?: string;
|
|
215
229
|
header: string;
|
|
216
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
|
|
232
|
+
* If you have also specified an `accessorFn`, MRT still needs to have a valid `id` to be able to identify the column uniquely.
|
|
233
|
+
* `id` defaults to the `accessorKey` or `header` if not specified.
|
|
234
|
+
*
|
|
235
|
+
* @default gets set to the same value as `accessorKey` by default
|
|
236
|
+
*/
|
|
237
|
+
id?: string;
|
|
217
238
|
muiTableBodyCellCopyButtonProps?:
|
|
218
239
|
| ButtonProps
|
|
219
240
|
| (({
|
|
220
|
-
|
|
241
|
+
table,
|
|
221
242
|
cell,
|
|
222
243
|
}: {
|
|
223
|
-
|
|
244
|
+
table: MRT_TableInstance<D>;
|
|
224
245
|
cell: MRT_Cell<D>;
|
|
225
246
|
}) => ButtonProps);
|
|
226
247
|
muiTableBodyCellEditTextFieldProps?:
|
|
227
248
|
| TextFieldProps
|
|
228
249
|
| (({
|
|
229
|
-
|
|
250
|
+
table,
|
|
230
251
|
cell,
|
|
231
252
|
}: {
|
|
232
|
-
|
|
253
|
+
table: MRT_TableInstance<D>;
|
|
233
254
|
cell: MRT_Cell<D>;
|
|
234
255
|
}) => TextFieldProps);
|
|
235
256
|
muiTableBodyCellProps?:
|
|
236
257
|
| TableCellProps
|
|
237
258
|
| (({
|
|
238
|
-
|
|
259
|
+
table,
|
|
239
260
|
cell,
|
|
240
261
|
}: {
|
|
241
|
-
|
|
262
|
+
table: MRT_TableInstance<D>;
|
|
242
263
|
cell: MRT_Cell<D>;
|
|
243
264
|
}) => TableCellProps);
|
|
244
265
|
muiTableFooterCellProps?:
|
|
245
266
|
| TableCellProps
|
|
246
267
|
| (({
|
|
247
|
-
|
|
268
|
+
table,
|
|
248
269
|
column,
|
|
249
270
|
}: {
|
|
250
|
-
|
|
271
|
+
table: MRT_TableInstance<D>;
|
|
251
272
|
column: MRT_Column<D>;
|
|
252
273
|
}) => TableCellProps);
|
|
253
274
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
254
275
|
| IconButtonProps
|
|
255
276
|
| (({
|
|
256
|
-
|
|
277
|
+
table,
|
|
257
278
|
column,
|
|
258
279
|
}: {
|
|
259
|
-
|
|
280
|
+
table: MRT_TableInstance<D>;
|
|
260
281
|
column: MRT_Column<D>;
|
|
261
282
|
}) => IconButtonProps);
|
|
262
283
|
muiTableHeadCellFilterTextFieldProps?:
|
|
263
284
|
| TextFieldProps
|
|
264
285
|
| (({
|
|
265
|
-
|
|
286
|
+
table,
|
|
266
287
|
column,
|
|
267
288
|
}: {
|
|
268
|
-
|
|
289
|
+
table: MRT_TableInstance<D>;
|
|
269
290
|
column: MRT_Column<D>;
|
|
270
291
|
}) => TextFieldProps);
|
|
271
292
|
muiTableHeadCellProps?:
|
|
272
293
|
| TableCellProps
|
|
273
294
|
| (({
|
|
274
|
-
|
|
295
|
+
table,
|
|
275
296
|
column,
|
|
276
297
|
}: {
|
|
277
|
-
|
|
298
|
+
table: MRT_TableInstance<D>;
|
|
278
299
|
column: MRT_Column<D>;
|
|
279
300
|
}) => TableCellProps);
|
|
280
301
|
onCellEditBlur?: ({
|
|
281
302
|
cell,
|
|
282
303
|
event,
|
|
283
|
-
|
|
304
|
+
table,
|
|
284
305
|
}: {
|
|
285
306
|
event: FocusEvent<HTMLInputElement>;
|
|
286
307
|
cell: MRT_Cell<D>;
|
|
287
|
-
|
|
308
|
+
table: MRT_TableInstance<D>;
|
|
288
309
|
}) => void;
|
|
289
310
|
onCellEditChange?: ({
|
|
290
311
|
cell,
|
|
291
312
|
event,
|
|
292
|
-
|
|
313
|
+
table,
|
|
293
314
|
}: {
|
|
294
315
|
event: ChangeEvent<HTMLInputElement>;
|
|
295
316
|
cell: MRT_Cell<D>;
|
|
296
|
-
|
|
317
|
+
table: MRT_TableInstance<D>;
|
|
297
318
|
}) => void;
|
|
298
319
|
sortingFn?: MRT_SortingFn;
|
|
299
320
|
};
|
|
300
321
|
|
|
322
|
+
export type MRT_DefinedColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
323
|
+
MRT_ColumnDef<D>,
|
|
324
|
+
'id'
|
|
325
|
+
> & {
|
|
326
|
+
id: string;
|
|
327
|
+
};
|
|
328
|
+
|
|
301
329
|
export type MRT_Column<D extends Record<string, any> = {}> = Omit<
|
|
302
330
|
Column<D>,
|
|
303
|
-
'header' | 'footer' | 'columns' | 'columnDef'
|
|
331
|
+
'header' | 'footer' | 'columns' | 'columnDef' | 'filterFn'
|
|
304
332
|
> & {
|
|
333
|
+
columnDef: MRT_DefinedColumnDef<D>;
|
|
305
334
|
columns?: MRT_Column<D>[];
|
|
306
|
-
|
|
307
|
-
header: string;
|
|
335
|
+
filterFn?: MRT_FilterFn<D>;
|
|
308
336
|
footer: string;
|
|
337
|
+
header: string;
|
|
309
338
|
};
|
|
310
339
|
|
|
311
340
|
export type MRT_Header<D extends Record<string, any> = {}> = Omit<
|
|
@@ -341,27 +370,17 @@ export type MRT_Cell<D extends Record<string, any> = {}> = Omit<
|
|
|
341
370
|
row: MRT_Row<D>;
|
|
342
371
|
};
|
|
343
372
|
|
|
344
|
-
export type MRT_SortingOption =
|
|
373
|
+
export type MRT_SortingOption = keyof typeof MRT_SortingFns;
|
|
345
374
|
|
|
346
|
-
export type MRT_SortingFn
|
|
375
|
+
export type MRT_SortingFn<D extends Record<string, any> = {}> =
|
|
376
|
+
| SortingFn<D>
|
|
377
|
+
| MRT_SortingOption;
|
|
347
378
|
|
|
348
|
-
export type
|
|
349
|
-
| 'between'
|
|
350
|
-
| 'contains'
|
|
351
|
-
| 'empty'
|
|
352
|
-
| 'endsWith'
|
|
353
|
-
| 'equals'
|
|
354
|
-
| 'fuzzy'
|
|
355
|
-
| 'greaterThan'
|
|
356
|
-
| 'greaterThanOrEqual'
|
|
357
|
-
| 'lessThan'
|
|
358
|
-
| 'lessThanOrEqual'
|
|
359
|
-
| 'notEmpty'
|
|
360
|
-
| 'notEquals'
|
|
361
|
-
| 'startsWith'
|
|
362
|
-
| FilterFnOption<TableGenerics>;
|
|
379
|
+
export type MRT_FilterOption = keyof typeof MRT_FilterFns;
|
|
363
380
|
|
|
364
|
-
export type MRT_FilterFn
|
|
381
|
+
export type MRT_FilterFn<D extends Record<string, any> = {}> =
|
|
382
|
+
| FilterFn<D>
|
|
383
|
+
| MRT_FilterOption;
|
|
365
384
|
|
|
366
385
|
export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
367
386
|
MRT_TableOptions<D> & {
|
|
@@ -387,221 +406,209 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
387
406
|
enableToolbarBottom?: boolean;
|
|
388
407
|
enableToolbarInternalActions?: boolean;
|
|
389
408
|
enableToolbarTop?: boolean;
|
|
390
|
-
enabledColumnFilterOptions?: (
|
|
391
|
-
enabledGlobalFilterOptions?: (
|
|
409
|
+
enabledColumnFilterOptions?: (MRT_FilterOption | string)[] | null;
|
|
410
|
+
enabledGlobalFilterOptions?: (MRT_FilterOption | string)[] | null;
|
|
392
411
|
icons?: Partial<MRT_Icons>;
|
|
393
412
|
localization?: Partial<MRT_Localization>;
|
|
394
413
|
muiExpandAllButtonProps?:
|
|
395
414
|
| IconButtonProps
|
|
396
|
-
| (({
|
|
415
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => IconButtonProps);
|
|
397
416
|
muiExpandButtonProps?:
|
|
398
417
|
| IconButtonProps
|
|
399
418
|
| (({
|
|
400
|
-
|
|
419
|
+
table,
|
|
401
420
|
}: {
|
|
402
|
-
|
|
421
|
+
table: MRT_TableInstance<D>;
|
|
403
422
|
row: MRT_Row<D>;
|
|
404
423
|
}) => IconButtonProps);
|
|
405
424
|
muiLinearProgressProps?:
|
|
406
425
|
| LinearProgressProps
|
|
407
|
-
| (({
|
|
408
|
-
instance,
|
|
409
|
-
}: {
|
|
410
|
-
instance: MRT_TableInstance<D>;
|
|
411
|
-
}) => LinearProgressProps);
|
|
426
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => LinearProgressProps);
|
|
412
427
|
muiSearchTextFieldProps?:
|
|
413
428
|
| TextFieldProps
|
|
414
|
-
| (({
|
|
429
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => TextFieldProps);
|
|
415
430
|
muiSelectAllCheckboxProps?:
|
|
416
431
|
| CheckboxProps
|
|
417
|
-
| (({
|
|
432
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => CheckboxProps);
|
|
418
433
|
muiSelectCheckboxProps?:
|
|
419
434
|
| CheckboxProps
|
|
420
435
|
| (({
|
|
421
|
-
|
|
436
|
+
table,
|
|
422
437
|
row,
|
|
423
438
|
}: {
|
|
424
|
-
|
|
439
|
+
table: MRT_TableInstance<D>;
|
|
425
440
|
row: MRT_Row<D>;
|
|
426
441
|
}) => CheckboxProps);
|
|
427
442
|
muiTableBodyCellCopyButtonProps?:
|
|
428
443
|
| ButtonProps
|
|
429
444
|
| (({
|
|
430
|
-
|
|
445
|
+
table,
|
|
431
446
|
cell,
|
|
432
447
|
}: {
|
|
433
|
-
|
|
448
|
+
table: MRT_TableInstance<D>;
|
|
434
449
|
cell: MRT_Cell<D>;
|
|
435
450
|
}) => ButtonProps);
|
|
436
451
|
muiTableBodyCellEditTextFieldProps?:
|
|
437
452
|
| TextFieldProps
|
|
438
453
|
| (({
|
|
439
|
-
|
|
454
|
+
table,
|
|
440
455
|
cell,
|
|
441
456
|
}: {
|
|
442
|
-
|
|
457
|
+
table: MRT_TableInstance<D>;
|
|
443
458
|
cell: MRT_Cell<D>;
|
|
444
459
|
}) => TextFieldProps);
|
|
445
460
|
muiTableBodyCellProps?:
|
|
446
461
|
| TableCellProps
|
|
447
462
|
| (({
|
|
448
|
-
|
|
463
|
+
table,
|
|
449
464
|
cell,
|
|
450
465
|
}: {
|
|
451
|
-
|
|
466
|
+
table: MRT_TableInstance<D>;
|
|
452
467
|
cell: MRT_Cell<D>;
|
|
453
468
|
}) => TableCellProps);
|
|
454
469
|
muiTableBodyCellSkeletonProps?:
|
|
455
470
|
| SkeletonProps
|
|
456
471
|
| (({
|
|
457
|
-
|
|
472
|
+
table,
|
|
458
473
|
cell,
|
|
459
474
|
}: {
|
|
460
|
-
|
|
475
|
+
table: MRT_TableInstance<D>;
|
|
461
476
|
cell: MRT_Cell<D>;
|
|
462
477
|
}) => SkeletonProps);
|
|
463
478
|
muiTableBodyProps?:
|
|
464
479
|
| TableBodyProps
|
|
465
|
-
| (({
|
|
480
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => TableBodyProps);
|
|
466
481
|
muiTableBodyRowProps?:
|
|
467
482
|
| TableRowProps
|
|
468
483
|
| (({
|
|
469
|
-
|
|
484
|
+
table,
|
|
470
485
|
row,
|
|
471
486
|
}: {
|
|
472
|
-
|
|
487
|
+
table: MRT_TableInstance<D>;
|
|
473
488
|
row: MRT_Row<D>;
|
|
474
489
|
}) => TableRowProps);
|
|
475
490
|
muiTableContainerProps?:
|
|
476
491
|
| TableContainerProps
|
|
477
|
-
| (({
|
|
478
|
-
instance,
|
|
479
|
-
}: {
|
|
480
|
-
instance: MRT_TableInstance<D>;
|
|
481
|
-
}) => TableContainerProps);
|
|
492
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => TableContainerProps);
|
|
482
493
|
muiTableDetailPanelProps?:
|
|
483
494
|
| TableCellProps
|
|
484
495
|
| (({
|
|
485
|
-
|
|
496
|
+
table,
|
|
486
497
|
row,
|
|
487
498
|
}: {
|
|
488
|
-
|
|
499
|
+
table: MRT_TableInstance<D>;
|
|
489
500
|
row: MRT_Row<D>;
|
|
490
501
|
}) => TableCellProps);
|
|
491
502
|
muiTableFooterCellProps?:
|
|
492
503
|
| TableCellProps
|
|
493
504
|
| (({
|
|
494
|
-
|
|
505
|
+
table,
|
|
495
506
|
column,
|
|
496
507
|
}: {
|
|
497
|
-
|
|
508
|
+
table: MRT_TableInstance<D>;
|
|
498
509
|
column: MRT_Column<D>;
|
|
499
510
|
}) => TableCellProps);
|
|
500
511
|
muiTableFooterProps?:
|
|
501
512
|
| TableFooterProps
|
|
502
|
-
| (({
|
|
503
|
-
instance,
|
|
504
|
-
}: {
|
|
505
|
-
instance: MRT_TableInstance<D>;
|
|
506
|
-
}) => TableFooterProps);
|
|
513
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => TableFooterProps);
|
|
507
514
|
muiTableFooterRowProps?:
|
|
508
515
|
| TableRowProps
|
|
509
516
|
| (({
|
|
510
|
-
|
|
517
|
+
table,
|
|
511
518
|
footerGroup,
|
|
512
519
|
}: {
|
|
513
|
-
|
|
520
|
+
table: MRT_TableInstance<D>;
|
|
514
521
|
footerGroup: MRT_HeaderGroup<D>;
|
|
515
522
|
}) => TableRowProps);
|
|
516
523
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
517
524
|
| IconButtonProps
|
|
518
525
|
| (({
|
|
519
|
-
|
|
526
|
+
table,
|
|
520
527
|
column,
|
|
521
528
|
}: {
|
|
522
|
-
|
|
529
|
+
table: MRT_TableInstance<D>;
|
|
523
530
|
column: MRT_Column<D>;
|
|
524
531
|
}) => IconButtonProps);
|
|
525
532
|
muiTableHeadCellFilterTextFieldProps?:
|
|
526
533
|
| TextFieldProps
|
|
527
534
|
| (({
|
|
528
|
-
|
|
535
|
+
table,
|
|
529
536
|
column,
|
|
530
537
|
}: {
|
|
531
|
-
|
|
538
|
+
table: MRT_TableInstance<D>;
|
|
532
539
|
column: MRT_Column<D>;
|
|
533
540
|
}) => TextFieldProps);
|
|
534
541
|
muiTableHeadCellProps?:
|
|
535
542
|
| TableCellProps
|
|
536
543
|
| (({
|
|
537
|
-
|
|
544
|
+
table,
|
|
538
545
|
column,
|
|
539
546
|
}: {
|
|
540
|
-
|
|
547
|
+
table: MRT_TableInstance<D>;
|
|
541
548
|
column: MRT_Column<D>;
|
|
542
549
|
}) => TableCellProps);
|
|
543
550
|
muiTableHeadProps?:
|
|
544
551
|
| TableHeadProps
|
|
545
|
-
| (({
|
|
552
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => TableHeadProps);
|
|
546
553
|
muiTableHeadRowProps?:
|
|
547
554
|
| TableRowProps
|
|
548
555
|
| (({
|
|
549
|
-
|
|
556
|
+
table,
|
|
550
557
|
headerGroup,
|
|
551
558
|
}: {
|
|
552
|
-
|
|
559
|
+
table: MRT_TableInstance<D>;
|
|
553
560
|
headerGroup: MRT_HeaderGroup<D>;
|
|
554
561
|
}) => TableRowProps);
|
|
555
562
|
muiTablePaginationProps?:
|
|
556
563
|
| Partial<TablePaginationProps>
|
|
557
564
|
| (({
|
|
558
|
-
|
|
565
|
+
table,
|
|
559
566
|
}: {
|
|
560
|
-
|
|
567
|
+
table: MRT_TableInstance<D>;
|
|
561
568
|
}) => Partial<TablePaginationProps>);
|
|
562
569
|
muiTablePaperProps?:
|
|
563
570
|
| PaperProps
|
|
564
|
-
| (({
|
|
571
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => PaperProps);
|
|
565
572
|
muiTableProps?:
|
|
566
573
|
| TableProps
|
|
567
|
-
| (({
|
|
574
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => TableProps);
|
|
568
575
|
muiTableToolbarAlertBannerProps?:
|
|
569
576
|
| AlertProps
|
|
570
|
-
| (({
|
|
577
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => AlertProps);
|
|
571
578
|
muiTableToolbarBottomProps?:
|
|
572
579
|
| ToolbarProps
|
|
573
|
-
| (({
|
|
580
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => ToolbarProps);
|
|
574
581
|
muiTableToolbarTopProps?:
|
|
575
582
|
| ToolbarProps
|
|
576
|
-
| (({
|
|
583
|
+
| (({ table }: { table: MRT_TableInstance<D> }) => ToolbarProps);
|
|
577
584
|
onCellEditBlur?: ({
|
|
578
585
|
cell,
|
|
579
586
|
event,
|
|
580
|
-
|
|
587
|
+
table,
|
|
581
588
|
}: {
|
|
582
589
|
event: FocusEvent<HTMLInputElement>;
|
|
583
590
|
cell: MRT_Cell<D>;
|
|
584
|
-
|
|
591
|
+
table: MRT_TableInstance<D>;
|
|
585
592
|
}) => void;
|
|
586
593
|
onCellEditChange?: ({
|
|
587
594
|
cell,
|
|
588
595
|
event,
|
|
589
|
-
|
|
596
|
+
table,
|
|
590
597
|
}: {
|
|
591
598
|
event: ChangeEvent<HTMLInputElement>;
|
|
592
599
|
cell: MRT_Cell<D>;
|
|
593
|
-
|
|
600
|
+
table: MRT_TableInstance<D>;
|
|
594
601
|
}) => void;
|
|
595
602
|
onCurrentEditingCellChange?: OnChangeFn<MRT_Cell>;
|
|
596
603
|
onCurrentEditingRowChange?: OnChangeFn<MRT_Row>;
|
|
597
|
-
onCurrentFilterFnsChange?: OnChangeFn<{ [key: string]:
|
|
598
|
-
onCurrentGlobalFilterFnChange?: OnChangeFn<
|
|
604
|
+
onCurrentFilterFnsChange?: OnChangeFn<{ [key: string]: MRT_FilterOption }>;
|
|
605
|
+
onCurrentGlobalFilterFnChange?: OnChangeFn<MRT_FilterOption>;
|
|
599
606
|
onEditRowSubmit?: ({
|
|
600
607
|
row,
|
|
601
|
-
|
|
608
|
+
table,
|
|
602
609
|
}: {
|
|
603
610
|
row: MRT_Row<D>;
|
|
604
|
-
|
|
611
|
+
table: MRT_TableInstance<D>;
|
|
605
612
|
}) => Promise<void> | void;
|
|
606
613
|
onDensityChange?: OnChangeFn<boolean>;
|
|
607
614
|
onIsFullScreenChange?: OnChangeFn<boolean>;
|
|
@@ -614,60 +621,60 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
614
621
|
positionToolbarAlertBanner?: 'bottom' | 'top';
|
|
615
622
|
renderDetailPanel?: ({
|
|
616
623
|
row,
|
|
617
|
-
|
|
624
|
+
table,
|
|
618
625
|
}: {
|
|
619
626
|
row: MRT_Row<D>;
|
|
620
|
-
|
|
627
|
+
table: MRT_TableInstance<D>;
|
|
621
628
|
}) => ReactNode;
|
|
622
629
|
renderRowActionMenuItems?: ({
|
|
623
630
|
closeMenu,
|
|
624
631
|
row,
|
|
625
|
-
|
|
632
|
+
table,
|
|
626
633
|
}: {
|
|
627
634
|
closeMenu: () => void;
|
|
628
635
|
row: MRT_Row<D>;
|
|
629
|
-
|
|
636
|
+
table: MRT_TableInstance<D>;
|
|
630
637
|
}) => ReactNode[];
|
|
631
638
|
renderRowActions?: ({
|
|
632
639
|
row,
|
|
633
|
-
|
|
640
|
+
table,
|
|
634
641
|
}: {
|
|
635
642
|
row: MRT_Row<D>;
|
|
636
|
-
|
|
643
|
+
table: MRT_TableInstance<D>;
|
|
637
644
|
}) => ReactNode;
|
|
638
645
|
renderToolbarBottomCustomActions?: ({
|
|
639
|
-
|
|
646
|
+
table,
|
|
640
647
|
}: {
|
|
641
|
-
|
|
648
|
+
table: MRT_TableInstance<D>;
|
|
642
649
|
}) => ReactNode;
|
|
643
650
|
renderToolbarTopCustomActions?: ({
|
|
644
|
-
|
|
651
|
+
table,
|
|
645
652
|
}: {
|
|
646
|
-
|
|
653
|
+
table: MRT_TableInstance<D>;
|
|
647
654
|
}) => ReactNode;
|
|
648
655
|
renderToolbarInternalActions?: ({
|
|
649
|
-
|
|
656
|
+
table,
|
|
650
657
|
MRT_ToggleGlobalFilterButton,
|
|
651
658
|
MRT_ToggleFiltersButton,
|
|
652
659
|
MRT_ShowHideColumnsButton,
|
|
653
660
|
MRT_ToggleDensePaddingButton,
|
|
654
661
|
MRT_FullScreenToggleButton,
|
|
655
662
|
}: {
|
|
656
|
-
|
|
663
|
+
table: MRT_TableInstance<D>;
|
|
657
664
|
MRT_ToggleGlobalFilterButton: FC<
|
|
658
|
-
IconButtonProps & {
|
|
665
|
+
IconButtonProps & { table: MRT_TableInstance<D> }
|
|
659
666
|
>;
|
|
660
667
|
MRT_ToggleFiltersButton: FC<
|
|
661
|
-
IconButtonProps & {
|
|
668
|
+
IconButtonProps & { table: MRT_TableInstance<D> }
|
|
662
669
|
>;
|
|
663
670
|
MRT_ShowHideColumnsButton: FC<
|
|
664
|
-
IconButtonProps & {
|
|
671
|
+
IconButtonProps & { table: MRT_TableInstance<D> }
|
|
665
672
|
>;
|
|
666
673
|
MRT_ToggleDensePaddingButton: FC<
|
|
667
|
-
IconButtonProps & {
|
|
674
|
+
IconButtonProps & { table: MRT_TableInstance<D> }
|
|
668
675
|
>;
|
|
669
676
|
MRT_FullScreenToggleButton: FC<
|
|
670
|
-
IconButtonProps & {
|
|
677
|
+
IconButtonProps & { table: MRT_TableInstance<D> }
|
|
671
678
|
>;
|
|
672
679
|
}) => ReactNode;
|
|
673
680
|
rowCount?: number;
|