material-react-table 0.7.0-alpha.1 → 0.7.0-alpha.2
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 +195 -58
- package/dist/material-react-table.cjs.development.js +239 -931
- 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 +239 -931
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +364 -126
- package/src/body/MRT_TableBody.tsx +1 -1
- package/src/body/MRT_TableBodyCell.tsx +3 -3
- package/src/body/MRT_TableBodyRow.tsx +2 -2
- package/src/body/MRT_TableDetailPanel.tsx +6 -4
- package/src/buttons/MRT_CopyButton.tsx +2 -2
- package/src/buttons/MRT_EditActionButtons.tsx +4 -2
- package/src/buttons/MRT_ExpandButton.tsx +1 -1
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +5 -2
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +1 -1
- package/src/buttons/MRT_ToggleSearchButton.tsx +6 -1
- package/src/footer/MRT_TableFooter.tsx +1 -1
- package/src/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/footer/MRT_TableFooterRow.tsx +1 -1
- package/src/head/MRT_TableHead.tsx +1 -1
- package/src/head/MRT_TableHeadCell.tsx +22 -29
- package/src/head/MRT_TableHeadRow.tsx +1 -1
- package/src/inputs/MRT_EditCellTextField.tsx +7 -7
- package/src/inputs/MRT_FilterTextField.tsx +2 -2
- package/src/inputs/MRT_SearchTextField.tsx +8 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +9 -7
- package/src/menus/MRT_RowActionMenu.tsx +5 -3
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +4 -5
- package/src/table/MRT_Table.tsx +1 -1
- package/src/table/MRT_TableContainer.tsx +16 -20
- package/src/table/MRT_TablePaper.tsx +9 -5
- package/src/toolbar/MRT_LinearProgressBar.tsx +1 -1
- package/src/toolbar/MRT_TablePagination.tsx +3 -2
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +2 -1
- package/src/toolbar/MRT_ToolbarBottom.tsx +1 -1
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +5 -4
- package/src/toolbar/MRT_ToolbarTop.tsx +2 -2
package/dist/utils.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export declare const createGroup: <D extends Record<string, any> = {}>(table: Ta
|
|
|
7
7
|
export declare const createDataColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnInterface<D>, currentFilterTypes: {
|
|
8
8
|
[key: string]: MRT_FilterType;
|
|
9
9
|
}) => ColumnDef<D>;
|
|
10
|
-
export declare const createDisplayColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: Pick<MRT_ColumnInterface<D>, "footer" | "columns" | "id" | "accessorKey" | "accessorFn" | "cell" | "meta" | "enableHiding" | "defaultCanHide" | "defaultIsVisible" | "enablePinning" | "defaultCanPin" | "filterType" | "enableAllFilters" | "enableColumnFilter" | "enableGlobalFilter" | "defaultCanFilter" | "defaultCanColumnFilter" | "defaultCanGlobalFilter" | "sortType" | "sortDescFirst" | "enableSorting" | "enableMultiSort" | "defaultCanSort" | "invertSorting" | "sortUndefined" | "aggregationType" | "aggregateValue" | "aggregatedCell" | "enableGrouping" | "defaultCanGroup" | "enableResizing" | "defaultCanResize" | "width" | "minWidth" | "maxWidth" | "Edit" | "Filter" | "Footer" | "Header" | "Cell" | "enableClickToCopy" | "enableColumnActions" | "enableEditing" | "
|
|
10
|
+
export declare const createDisplayColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: Pick<MRT_ColumnInterface<D>, "footer" | "columns" | "id" | "accessorKey" | "accessorFn" | "cell" | "meta" | "enableHiding" | "defaultCanHide" | "defaultIsVisible" | "enablePinning" | "defaultCanPin" | "filterType" | "enableAllFilters" | "enableColumnFilter" | "enableGlobalFilter" | "defaultCanFilter" | "defaultCanColumnFilter" | "defaultCanGlobalFilter" | "sortType" | "sortDescFirst" | "enableSorting" | "enableMultiSort" | "defaultCanSort" | "invertSorting" | "sortUndefined" | "aggregationType" | "aggregateValue" | "aggregatedCell" | "enableGrouping" | "defaultCanGroup" | "enableResizing" | "defaultCanResize" | "width" | "minWidth" | "maxWidth" | "Edit" | "Filter" | "Footer" | "Header" | "Cell" | "enableClickToCopy" | "enableColumnActions" | "enableEditing" | "enabledFilterTypes" | "filter" | "filterSelectOptions" | "muiTableBodyCellCopyButtonProps" | "muiTableBodyCellEditTextFieldProps" | "muiTableBodyCellProps" | "muiTableFooterCellProps" | "muiTableHeadCellColumnActionsButtonProps" | "muiTableHeadCellFilterTextFieldProps" | "muiTableHeadCellProps" | "onCellEditChange" | "onColumnFilterValueChange"> & {
|
|
11
11
|
header?: string | undefined;
|
|
12
12
|
}) => ColumnDef<D>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.7.0-alpha.
|
|
2
|
+
"version": "0.7.0-alpha.2",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "material-react-table",
|
|
5
5
|
"description": "A fully featured Material-UI implementation of react-table, inspired by material-table and the mui DataGrid, written from the ground up in TypeScript.",
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
Row,
|
|
40
40
|
TableInstance,
|
|
41
41
|
TableState,
|
|
42
|
+
VisibilityState,
|
|
42
43
|
} from '@tanstack/react-table';
|
|
43
44
|
import { MRT_Localization, MRT_DefaultLocalization_EN } from './localization';
|
|
44
45
|
import { MRT_Default_Icons, MRT_Icons } from './icons';
|
|
@@ -85,11 +86,11 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
|
|
|
85
86
|
> & {
|
|
86
87
|
getAllColumns: () => MRT_ColumnInstance<D>[];
|
|
87
88
|
getAllLeafColumns: () => MRT_ColumnInstance<D>[];
|
|
88
|
-
getExpandedRowModel: () => MRT_RowModel
|
|
89
|
-
getPaginationRowModel: () => MRT_RowModel
|
|
90
|
-
getPrePaginationRowModel: () => MRT_RowModel
|
|
91
|
-
getRowModel: () => MRT_RowModel
|
|
92
|
-
getSelectedRowModel: () => MRT_RowModel
|
|
89
|
+
getExpandedRowModel: () => MRT_RowModel<D>;
|
|
90
|
+
getPaginationRowModel: () => MRT_RowModel<D>;
|
|
91
|
+
getPrePaginationRowModel: () => MRT_RowModel<D>;
|
|
92
|
+
getRowModel: () => MRT_RowModel<D>;
|
|
93
|
+
getSelectedRowModel: () => MRT_RowModel<D>;
|
|
93
94
|
getState: () => MRT_TableState<D>;
|
|
94
95
|
options: MaterialReactTableProps<D> & {
|
|
95
96
|
icons: MRT_Icons;
|
|
@@ -131,16 +132,18 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
|
|
|
131
132
|
Edit?: ({
|
|
132
133
|
cell,
|
|
133
134
|
tableInstance,
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
}: // onChange,
|
|
136
|
+
{
|
|
136
137
|
cell: MRT_Cell<D>;
|
|
137
138
|
tableInstance: MRT_TableInstance<D>;
|
|
138
|
-
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
139
|
+
// onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
139
140
|
}) => ReactNode;
|
|
140
141
|
Filter?: ({
|
|
142
|
+
// onChange,
|
|
141
143
|
header,
|
|
142
144
|
tableInstance,
|
|
143
145
|
}: {
|
|
146
|
+
// onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
144
147
|
header: MRT_Header<D>;
|
|
145
148
|
tableInstance: MRT_TableInstance<D>;
|
|
146
149
|
}) => ReactNode;
|
|
@@ -170,8 +173,6 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
|
|
|
170
173
|
enableClickToCopy?: boolean;
|
|
171
174
|
enableColumnActions?: boolean;
|
|
172
175
|
enableEditing?: boolean;
|
|
173
|
-
enableColumnFilters?: boolean;
|
|
174
|
-
enableHiding?: boolean;
|
|
175
176
|
enabledFilterTypes?: (MRT_FILTER_TYPE | string)[];
|
|
176
177
|
filter?: MRT_FilterType | string | FilterType<D>;
|
|
177
178
|
filterSelectOptions?: (string | { text: string; value: string })[];
|
|
@@ -179,33 +180,83 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
|
|
|
179
180
|
header: string;
|
|
180
181
|
muiTableBodyCellCopyButtonProps?:
|
|
181
182
|
| ButtonProps
|
|
182
|
-
| ((
|
|
183
|
+
| (({
|
|
184
|
+
tableInstance,
|
|
185
|
+
cell,
|
|
186
|
+
}: {
|
|
187
|
+
tableInstance: MRT_TableInstance;
|
|
188
|
+
cell: MRT_Cell<D>;
|
|
189
|
+
}) => ButtonProps);
|
|
183
190
|
muiTableBodyCellEditTextFieldProps?:
|
|
184
191
|
| TextFieldProps
|
|
185
|
-
| ((
|
|
192
|
+
| (({
|
|
193
|
+
tableInstance,
|
|
194
|
+
cell,
|
|
195
|
+
}: {
|
|
196
|
+
tableInstance: MRT_TableInstance;
|
|
197
|
+
cell: MRT_Cell<D>;
|
|
198
|
+
}) => TextFieldProps);
|
|
186
199
|
muiTableBodyCellProps?:
|
|
187
200
|
| TableCellProps
|
|
188
|
-
| ((
|
|
201
|
+
| (({
|
|
202
|
+
tableInstance,
|
|
203
|
+
cell,
|
|
204
|
+
}: {
|
|
205
|
+
tableInstance: MRT_TableInstance;
|
|
206
|
+
cell: MRT_Cell<D>;
|
|
207
|
+
}) => TableCellProps);
|
|
189
208
|
muiTableFooterCellProps?:
|
|
190
209
|
| TableCellProps
|
|
191
|
-
| ((
|
|
210
|
+
| (({
|
|
211
|
+
tableInstance,
|
|
212
|
+
column,
|
|
213
|
+
}: {
|
|
214
|
+
tableInstance: MRT_TableInstance;
|
|
215
|
+
column: MRT_ColumnInstance<D>;
|
|
216
|
+
}) => TableCellProps);
|
|
192
217
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
193
218
|
| IconButtonProps
|
|
194
|
-
| ((
|
|
219
|
+
| (({
|
|
220
|
+
tableInstance,
|
|
221
|
+
column,
|
|
222
|
+
}: {
|
|
223
|
+
tableInstance: MRT_TableInstance;
|
|
224
|
+
column: MRT_ColumnInstance<D>;
|
|
225
|
+
}) => IconButtonProps);
|
|
195
226
|
muiTableHeadCellFilterTextFieldProps?:
|
|
196
227
|
| TextFieldProps
|
|
197
|
-
| ((
|
|
228
|
+
| (({
|
|
229
|
+
tableInstance,
|
|
230
|
+
column,
|
|
231
|
+
}: {
|
|
232
|
+
tableInstance: MRT_TableInstance;
|
|
233
|
+
column: MRT_ColumnInstance<D>;
|
|
234
|
+
}) => TextFieldProps);
|
|
198
235
|
muiTableHeadCellProps?:
|
|
199
236
|
| TableCellProps
|
|
200
|
-
| ((
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
237
|
+
| (({
|
|
238
|
+
tableInstance,
|
|
239
|
+
column,
|
|
240
|
+
}: {
|
|
241
|
+
tableInstance: MRT_TableInstance;
|
|
242
|
+
column: MRT_ColumnInstance<D>;
|
|
243
|
+
}) => TableCellProps);
|
|
244
|
+
onCellEditChange?: ({
|
|
245
|
+
cell,
|
|
246
|
+
event,
|
|
247
|
+
tableInstance,
|
|
248
|
+
}: {
|
|
249
|
+
event: ChangeEvent<HTMLInputElement>;
|
|
250
|
+
cell: MRT_Cell<D>;
|
|
251
|
+
tableInstance: MRT_TableInstance<D>;
|
|
252
|
+
}) => void;
|
|
253
|
+
onColumnFilterValueChange?: ({
|
|
254
|
+
event,
|
|
255
|
+
filterValue,
|
|
256
|
+
}: {
|
|
257
|
+
event: ChangeEvent<HTMLInputElement>;
|
|
258
|
+
filterValue: any;
|
|
259
|
+
}) => void;
|
|
209
260
|
};
|
|
210
261
|
|
|
211
262
|
export type MRT_ColumnInstance<D extends Record<string, any> = {}> = Omit<
|
|
@@ -287,155 +338,342 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
287
338
|
localization?: Partial<MRT_Localization>;
|
|
288
339
|
muiLinearProgressProps?:
|
|
289
340
|
| LinearProgressProps
|
|
290
|
-
| ((
|
|
291
|
-
|
|
341
|
+
| (({
|
|
342
|
+
tableInstance,
|
|
343
|
+
}: {
|
|
344
|
+
tableInstance: MRT_TableInstance;
|
|
345
|
+
}) => LinearProgressProps);
|
|
346
|
+
muiSearchTextFieldProps?:
|
|
347
|
+
| TextFieldProps
|
|
348
|
+
| (({
|
|
349
|
+
tableInstance,
|
|
350
|
+
}: {
|
|
351
|
+
tableInstance: MRT_TableInstance;
|
|
352
|
+
}) => TextFieldProps);
|
|
292
353
|
muiSelectCheckboxProps?:
|
|
293
354
|
| CheckboxProps
|
|
294
|
-
| ((
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
355
|
+
| (({
|
|
356
|
+
tableInstance,
|
|
357
|
+
isSelectAll,
|
|
358
|
+
row,
|
|
359
|
+
}: {
|
|
360
|
+
tableInstance: MRT_TableInstance;
|
|
361
|
+
isSelectAll: boolean;
|
|
362
|
+
row?: MRT_Row<D>;
|
|
363
|
+
}) => CheckboxProps);
|
|
299
364
|
muiTableBodyCellCopyButtonProps?:
|
|
300
365
|
| ButtonProps
|
|
301
|
-
| ((
|
|
366
|
+
| (({
|
|
367
|
+
tableInstance,
|
|
368
|
+
cell,
|
|
369
|
+
}: {
|
|
370
|
+
tableInstance: MRT_TableInstance;
|
|
371
|
+
cell: MRT_Cell<D>;
|
|
372
|
+
}) => ButtonProps);
|
|
302
373
|
muiTableBodyCellEditTextFieldProps?:
|
|
303
374
|
| TextFieldProps
|
|
304
|
-
| ((
|
|
375
|
+
| (({
|
|
376
|
+
tableInstance,
|
|
377
|
+
cell,
|
|
378
|
+
}: {
|
|
379
|
+
tableInstance: MRT_TableInstance;
|
|
380
|
+
cell: MRT_Cell<D>;
|
|
381
|
+
}) => TextFieldProps);
|
|
305
382
|
muiTableBodyCellProps?:
|
|
306
383
|
| TableCellProps
|
|
307
|
-
| ((
|
|
384
|
+
| (({
|
|
385
|
+
tableInstance,
|
|
386
|
+
cell,
|
|
387
|
+
}: {
|
|
388
|
+
tableInstance: MRT_TableInstance;
|
|
389
|
+
cell: MRT_Cell<D>;
|
|
390
|
+
}) => TableCellProps);
|
|
308
391
|
muiTableBodyCellSkeletonProps?:
|
|
309
392
|
| SkeletonProps
|
|
310
|
-
| ((
|
|
393
|
+
| (({
|
|
394
|
+
tableInstance,
|
|
395
|
+
cell,
|
|
396
|
+
}: {
|
|
397
|
+
tableInstance: MRT_TableInstance;
|
|
398
|
+
cell: MRT_Cell<D>;
|
|
399
|
+
}) => SkeletonProps);
|
|
311
400
|
muiTableBodyProps?:
|
|
312
401
|
| TableBodyProps
|
|
313
|
-
| ((
|
|
314
|
-
|
|
402
|
+
| (({
|
|
403
|
+
tableInstance,
|
|
404
|
+
}: {
|
|
405
|
+
tableInstance: MRT_TableInstance;
|
|
406
|
+
}) => TableBodyProps);
|
|
407
|
+
muiTableBodyRowProps?:
|
|
408
|
+
| TableRowProps
|
|
409
|
+
| (({
|
|
410
|
+
tableInstance,
|
|
411
|
+
row,
|
|
412
|
+
}: {
|
|
413
|
+
tableInstance: MRT_TableInstance;
|
|
414
|
+
row: MRT_Row<D>;
|
|
415
|
+
}) => TableRowProps);
|
|
315
416
|
muiTableContainerProps?:
|
|
316
417
|
| TableContainerProps
|
|
317
|
-
| ((
|
|
418
|
+
| (({
|
|
419
|
+
tableInstance,
|
|
420
|
+
}: {
|
|
421
|
+
tableInstance: MRT_TableInstance;
|
|
422
|
+
}) => TableContainerProps);
|
|
318
423
|
muiTableDetailPanelProps?:
|
|
319
424
|
| TableCellProps
|
|
320
|
-
| ((
|
|
425
|
+
| (({
|
|
426
|
+
tableInstance,
|
|
427
|
+
row,
|
|
428
|
+
}: {
|
|
429
|
+
tableInstance: MRT_TableInstance;
|
|
430
|
+
row: MRT_Row<D>;
|
|
431
|
+
}) => TableCellProps);
|
|
321
432
|
muiTableFooterCellProps?:
|
|
322
433
|
| TableCellProps
|
|
323
|
-
| ((
|
|
434
|
+
| (({
|
|
435
|
+
tableInstance,
|
|
436
|
+
column,
|
|
437
|
+
}: {
|
|
438
|
+
tableInstance: MRT_TableInstance;
|
|
439
|
+
column: MRT_ColumnInstance<D>;
|
|
440
|
+
}) => TableCellProps);
|
|
324
441
|
muiTableFooterProps?:
|
|
325
442
|
| TableFooterProps
|
|
326
|
-
| ((
|
|
443
|
+
| (({
|
|
444
|
+
tableInstance,
|
|
445
|
+
}: {
|
|
446
|
+
tableInstance: MRT_TableInstance;
|
|
447
|
+
}) => TableFooterProps);
|
|
327
448
|
muiTableFooterRowProps?:
|
|
328
449
|
| TableRowProps
|
|
329
|
-
| ((
|
|
450
|
+
| (({
|
|
451
|
+
tableInstance,
|
|
452
|
+
footerGroup,
|
|
453
|
+
}: {
|
|
454
|
+
tableInstance: MRT_TableInstance;
|
|
455
|
+
footerGroup: MRT_HeaderGroup<D>;
|
|
456
|
+
}) => TableRowProps);
|
|
330
457
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
331
458
|
| IconButtonProps
|
|
332
|
-
| ((
|
|
459
|
+
| (({
|
|
460
|
+
tableInstance,
|
|
461
|
+
column,
|
|
462
|
+
}: {
|
|
463
|
+
tableInstance: MRT_TableInstance;
|
|
464
|
+
column: MRT_ColumnInstance<D>;
|
|
465
|
+
}) => IconButtonProps);
|
|
333
466
|
muiTableHeadCellFilterTextFieldProps?:
|
|
334
467
|
| TextFieldProps
|
|
335
|
-
| ((
|
|
468
|
+
| (({
|
|
469
|
+
tableInstance,
|
|
470
|
+
column,
|
|
471
|
+
}: {
|
|
472
|
+
tableInstance: MRT_TableInstance;
|
|
473
|
+
column: MRT_ColumnInstance<D>;
|
|
474
|
+
}) => TextFieldProps);
|
|
336
475
|
muiTableHeadCellProps?:
|
|
337
476
|
| TableCellProps
|
|
338
|
-
| ((
|
|
477
|
+
| (({
|
|
478
|
+
tableInstance,
|
|
479
|
+
column,
|
|
480
|
+
}: {
|
|
481
|
+
tableInstance: MRT_TableInstance;
|
|
482
|
+
column: MRT_ColumnInstance<D>;
|
|
483
|
+
}) => TableCellProps);
|
|
339
484
|
muiTableHeadProps?:
|
|
340
485
|
| TableHeadProps
|
|
341
|
-
| ((
|
|
486
|
+
| (({
|
|
487
|
+
tableInstance,
|
|
488
|
+
}: {
|
|
489
|
+
tableInstance: MRT_TableInstance;
|
|
490
|
+
}) => TableHeadProps);
|
|
342
491
|
muiTableHeadRowProps?:
|
|
343
492
|
| TableRowProps
|
|
344
|
-
| ((
|
|
493
|
+
| (({
|
|
494
|
+
tableInstance,
|
|
495
|
+
headerGroup,
|
|
496
|
+
}: {
|
|
497
|
+
tableInstance: MRT_TableInstance;
|
|
498
|
+
headerGroup: MRT_HeaderGroup<D>;
|
|
499
|
+
}) => TableRowProps);
|
|
345
500
|
muiTablePaperProps?:
|
|
346
501
|
| PaperProps
|
|
347
|
-
| ((
|
|
502
|
+
| (({
|
|
503
|
+
tableInstance,
|
|
504
|
+
}: {
|
|
505
|
+
tableInstance: MRT_TableInstance;
|
|
506
|
+
}) => PaperProps);
|
|
348
507
|
muiTablePaginationProps?:
|
|
349
508
|
| Partial<TablePaginationProps>
|
|
350
|
-
| ((
|
|
351
|
-
tableInstance
|
|
352
|
-
|
|
509
|
+
| (({
|
|
510
|
+
tableInstance,
|
|
511
|
+
}: {
|
|
512
|
+
tableInstance: MRT_TableInstance;
|
|
513
|
+
}) => Partial<TablePaginationProps>);
|
|
353
514
|
muiTableProps?:
|
|
354
515
|
| TableProps
|
|
355
|
-
| ((
|
|
516
|
+
| (({
|
|
517
|
+
tableInstance,
|
|
518
|
+
}: {
|
|
519
|
+
tableInstance: MRT_TableInstance;
|
|
520
|
+
}) => TableProps);
|
|
356
521
|
muiTableToolbarAlertBannerProps?:
|
|
357
522
|
| AlertProps
|
|
358
|
-
| ((
|
|
523
|
+
| (({
|
|
524
|
+
tableInstance,
|
|
525
|
+
}: {
|
|
526
|
+
tableInstance: MRT_TableInstance;
|
|
527
|
+
}) => AlertProps);
|
|
359
528
|
muiTableToolbarBottomProps?:
|
|
360
529
|
| ToolbarProps
|
|
361
|
-
| ((
|
|
530
|
+
| (({
|
|
531
|
+
tableInstance,
|
|
532
|
+
}: {
|
|
533
|
+
tableInstance: MRT_TableInstance;
|
|
534
|
+
}) => ToolbarProps);
|
|
362
535
|
muiTableToolbarTopProps?:
|
|
363
536
|
| ToolbarProps
|
|
364
|
-
| ((
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
) => void;
|
|
387
|
-
|
|
388
|
-
event
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
event:
|
|
393
|
-
row: MRT_Row<D
|
|
394
|
-
|
|
395
|
-
) => void;
|
|
537
|
+
| (({
|
|
538
|
+
tableInstance,
|
|
539
|
+
}: {
|
|
540
|
+
tableInstance: MRT_TableInstance;
|
|
541
|
+
}) => ToolbarProps);
|
|
542
|
+
onCellClick?: ({
|
|
543
|
+
cell,
|
|
544
|
+
event,
|
|
545
|
+
tableInstance,
|
|
546
|
+
}: {
|
|
547
|
+
cell: MRT_Cell<D>;
|
|
548
|
+
tableInstance: MRT_TableInstance<D>;
|
|
549
|
+
event: MouseEvent<HTMLTableCellElement>;
|
|
550
|
+
}) => void;
|
|
551
|
+
onColumnHide?: ({
|
|
552
|
+
column,
|
|
553
|
+
columnVisibility,
|
|
554
|
+
tableInstance,
|
|
555
|
+
}: {
|
|
556
|
+
column: MRT_ColumnInstance<D>;
|
|
557
|
+
columnVisibility: VisibilityState;
|
|
558
|
+
tableInstance: MRT_TableInstance<D>;
|
|
559
|
+
}) => void;
|
|
560
|
+
onDetailPanelClick?: ({
|
|
561
|
+
event,
|
|
562
|
+
row,
|
|
563
|
+
tableInstance,
|
|
564
|
+
}: {
|
|
565
|
+
event: MouseEvent<HTMLTableCellElement>;
|
|
566
|
+
row: MRT_Row<D>;
|
|
567
|
+
tableInstance: MRT_TableInstance<D>;
|
|
568
|
+
}) => void;
|
|
569
|
+
onGlobalFilterChange?: ({
|
|
570
|
+
event,
|
|
571
|
+
tableInstance,
|
|
572
|
+
}: {
|
|
573
|
+
event: ChangeEvent<HTMLInputElement>;
|
|
574
|
+
tableInstance: MRT_TableInstance<D>;
|
|
575
|
+
}) => void;
|
|
576
|
+
onRowClick?: ({
|
|
577
|
+
event,
|
|
578
|
+
row,
|
|
579
|
+
tableInstance,
|
|
580
|
+
}: {
|
|
581
|
+
event: MouseEvent<HTMLTableRowElement>;
|
|
582
|
+
row: MRT_Row<D>;
|
|
583
|
+
tableInstance: MRT_TableInstance<D>;
|
|
584
|
+
}) => void;
|
|
585
|
+
onRowEditSubmit?: ({
|
|
586
|
+
row,
|
|
587
|
+
tableInstance,
|
|
588
|
+
}: {
|
|
589
|
+
row: MRT_Row<D>;
|
|
590
|
+
tableInstance: MRT_TableInstance<D>;
|
|
591
|
+
}) => Promise<void> | void;
|
|
592
|
+
onRowExpandChange?: ({
|
|
593
|
+
event,
|
|
594
|
+
row,
|
|
595
|
+
}: {
|
|
596
|
+
event: MouseEvent<HTMLButtonElement>;
|
|
597
|
+
row: MRT_Row<D>;
|
|
598
|
+
tableInstance: MRT_TableInstance<D>;
|
|
599
|
+
}) => void;
|
|
600
|
+
onSelectAllChange?: ({
|
|
601
|
+
event,
|
|
602
|
+
selectedRows,
|
|
603
|
+
tableInstance,
|
|
604
|
+
}: {
|
|
605
|
+
event: ChangeEvent;
|
|
606
|
+
selectedRows: MRT_Row<D>[];
|
|
607
|
+
tableInstance: MRT_TableInstance<D>;
|
|
608
|
+
}) => void;
|
|
609
|
+
onSelectChange?: ({
|
|
610
|
+
event,
|
|
611
|
+
row,
|
|
612
|
+
selectedRows,
|
|
613
|
+
tableInstance,
|
|
614
|
+
}: {
|
|
615
|
+
event: ChangeEvent;
|
|
616
|
+
row: MRT_Row<D>;
|
|
617
|
+
selectedRows: MRT_Row<D>[];
|
|
618
|
+
tableInstance: MRT_TableInstance<D>;
|
|
619
|
+
}) => void;
|
|
396
620
|
positionActionsColumn?: 'first' | 'last';
|
|
397
621
|
positionPagination?: 'bottom' | 'top' | 'both';
|
|
398
622
|
positionToolbarActions?: 'bottom' | 'top';
|
|
399
623
|
positionToolbarAlertBanner?: 'bottom' | 'top';
|
|
400
|
-
renderDetailPanel?: (
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
tableInstance: MRT_TableInstance<D
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
624
|
+
renderDetailPanel?: ({
|
|
625
|
+
row,
|
|
626
|
+
tableInstance,
|
|
627
|
+
}: {
|
|
628
|
+
row: MRT_Row<D>;
|
|
629
|
+
tableInstance: MRT_TableInstance<D>;
|
|
630
|
+
}) => ReactNode;
|
|
631
|
+
renderRowActionMenuItems?: ({
|
|
632
|
+
closeMenu,
|
|
633
|
+
row,
|
|
634
|
+
tableInstance,
|
|
635
|
+
}: {
|
|
636
|
+
closeMenu: () => void;
|
|
637
|
+
row: MRT_Row<D>;
|
|
638
|
+
tableInstance: MRT_TableInstance<D>;
|
|
639
|
+
}) => ReactNode[];
|
|
640
|
+
renderRowActions?: ({
|
|
641
|
+
row,
|
|
642
|
+
tableInstance,
|
|
643
|
+
}: {
|
|
644
|
+
row: MRT_Row<D>;
|
|
645
|
+
tableInstance: MRT_TableInstance<D>;
|
|
646
|
+
}) => ReactNode;
|
|
647
|
+
renderToolbarCustomActions?: ({
|
|
648
|
+
tableInstance,
|
|
649
|
+
}: {
|
|
650
|
+
tableInstance: MRT_TableInstance<D>;
|
|
651
|
+
}) => ReactNode;
|
|
652
|
+
renderToolbarInternalActions?: ({
|
|
653
|
+
tableInstance,
|
|
654
|
+
MRT_ToggleSearchButton,
|
|
655
|
+
MRT_ToggleFiltersButton,
|
|
656
|
+
MRT_ShowHideColumnsButton,
|
|
657
|
+
MRT_ToggleDensePaddingButton,
|
|
658
|
+
MRT_FullScreenToggleButton,
|
|
659
|
+
}: {
|
|
660
|
+
tableInstance: MRT_TableInstance<D>;
|
|
661
|
+
MRT_ToggleSearchButton: FC<
|
|
662
|
+
IconButtonProps & { tableInstance: MRT_TableInstance<D> }
|
|
663
|
+
>;
|
|
664
|
+
MRT_ToggleFiltersButton: FC<
|
|
665
|
+
IconButtonProps & { tableInstance: MRT_TableInstance<D> }
|
|
666
|
+
>;
|
|
667
|
+
MRT_ShowHideColumnsButton: FC<
|
|
668
|
+
IconButtonProps & { tableInstance: MRT_TableInstance<D> }
|
|
669
|
+
>;
|
|
670
|
+
MRT_ToggleDensePaddingButton: FC<
|
|
671
|
+
IconButtonProps & { tableInstance: MRT_TableInstance<D> }
|
|
672
|
+
>;
|
|
673
|
+
MRT_FullScreenToggleButton: FC<
|
|
674
|
+
IconButtonProps & { tableInstance: MRT_TableInstance<D> }
|
|
675
|
+
>;
|
|
676
|
+
}) => ReactNode;
|
|
439
677
|
};
|
|
440
678
|
|
|
441
679
|
export default <D extends Record<string, any> = {}>({
|
|
@@ -22,7 +22,7 @@ export const MRT_TableBody: FC<Props> = ({ pinned, tableInstance }) => {
|
|
|
22
22
|
|
|
23
23
|
const mTableBodyProps =
|
|
24
24
|
muiTableBodyProps instanceof Function
|
|
25
|
-
? muiTableBodyProps(tableInstance)
|
|
25
|
+
? muiTableBodyProps({ tableInstance })
|
|
26
26
|
: muiTableBodyProps;
|
|
27
27
|
|
|
28
28
|
const tableBodyProps = {
|
|
@@ -29,12 +29,12 @@ export const MRT_TableBodyCell: FC<Props> = ({ cell, tableInstance }) => {
|
|
|
29
29
|
|
|
30
30
|
const mTableCellBodyProps =
|
|
31
31
|
muiTableBodyCellProps instanceof Function
|
|
32
|
-
? muiTableBodyCellProps(cell)
|
|
32
|
+
? muiTableBodyCellProps({ cell, tableInstance })
|
|
33
33
|
: muiTableBodyCellProps;
|
|
34
34
|
|
|
35
35
|
const mcTableCellBodyProps =
|
|
36
36
|
column.muiTableBodyCellProps instanceof Function
|
|
37
|
-
? column.muiTableBodyCellProps(cell)
|
|
37
|
+
? column.muiTableBodyCellProps({ cell, tableInstance })
|
|
38
38
|
: column.muiTableBodyCellProps;
|
|
39
39
|
|
|
40
40
|
const tableCellProps = {
|
|
@@ -55,7 +55,7 @@ export const MRT_TableBodyCell: FC<Props> = ({ cell, tableInstance }) => {
|
|
|
55
55
|
return (
|
|
56
56
|
<TableCell
|
|
57
57
|
onClick={(event: MouseEvent<HTMLTableCellElement>) =>
|
|
58
|
-
onCellClick?.(event, cell)
|
|
58
|
+
onCellClick?.({ event, cell, tableInstance })
|
|
59
59
|
}
|
|
60
60
|
{...tableCellProps}
|
|
61
61
|
sx={{
|
|
@@ -27,7 +27,7 @@ export const MRT_TableBodyRow: FC<Props> = ({ pinned, row, tableInstance }) => {
|
|
|
27
27
|
|
|
28
28
|
const mTableBodyRowProps =
|
|
29
29
|
muiTableBodyRowProps instanceof Function
|
|
30
|
-
? muiTableBodyRowProps(row)
|
|
30
|
+
? muiTableBodyRowProps({ row, tableInstance })
|
|
31
31
|
: muiTableBodyRowProps;
|
|
32
32
|
|
|
33
33
|
const tableRowProps = {
|
|
@@ -47,7 +47,7 @@ export const MRT_TableBodyRow: FC<Props> = ({ pinned, row, tableInstance }) => {
|
|
|
47
47
|
<TableRow
|
|
48
48
|
hover
|
|
49
49
|
onClick={(event: MouseEvent<HTMLTableRowElement>) =>
|
|
50
|
-
onRowClick?.(event, row)
|
|
50
|
+
onRowClick?.({ event, row, tableInstance })
|
|
51
51
|
}
|
|
52
52
|
selected={getIsSelected()}
|
|
53
53
|
{...tableRowProps}
|