material-react-table 0.13.1 → 0.13.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/README.md +9 -5
- package/dist/MaterialReactTable.d.ts +44 -35
- package/dist/material-react-table.cjs.development.js +28 -13
- 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 +28 -13
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +47 -35
- package/src/buttons/MRT_ExpandAllButton.tsx +8 -0
- package/src/buttons/MRT_ExpandButton.tsx +8 -0
- package/src/inputs/MRT_SelectCheckbox.tsx +14 -5
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.13.
|
|
2
|
+
"version": "0.13.2",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "material-react-table",
|
|
5
5
|
"description": "A fully featured Material UI implementation of TanStack React Table, inspired by material-table and the MUI X DataGrid, written from the ground up in TypeScript.",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"size-limit": [
|
|
49
49
|
{
|
|
50
50
|
"path": "dist/material-react-table.cjs.production.min.js",
|
|
51
|
-
"limit": "
|
|
51
|
+
"limit": "55 KB"
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"path": "dist/material-react-table.esm.js",
|
|
55
|
-
"limit": "
|
|
55
|
+
"limit": "55 KB"
|
|
56
56
|
}
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
@@ -215,7 +215,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
|
215
215
|
instance,
|
|
216
216
|
cell,
|
|
217
217
|
}: {
|
|
218
|
-
instance: MRT_TableInstance
|
|
218
|
+
instance: MRT_TableInstance<D>;
|
|
219
219
|
cell: MRT_Cell<D>;
|
|
220
220
|
}) => ButtonProps);
|
|
221
221
|
muiTableBodyCellEditTextFieldProps?:
|
|
@@ -224,7 +224,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
|
224
224
|
instance,
|
|
225
225
|
cell,
|
|
226
226
|
}: {
|
|
227
|
-
instance: MRT_TableInstance
|
|
227
|
+
instance: MRT_TableInstance<D>;
|
|
228
228
|
cell: MRT_Cell<D>;
|
|
229
229
|
}) => TextFieldProps);
|
|
230
230
|
muiTableBodyCellProps?:
|
|
@@ -233,7 +233,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
|
233
233
|
instance,
|
|
234
234
|
cell,
|
|
235
235
|
}: {
|
|
236
|
-
instance: MRT_TableInstance
|
|
236
|
+
instance: MRT_TableInstance<D>;
|
|
237
237
|
cell: MRT_Cell<D>;
|
|
238
238
|
}) => TableCellProps);
|
|
239
239
|
muiTableFooterCellProps?:
|
|
@@ -242,7 +242,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
|
242
242
|
instance,
|
|
243
243
|
column,
|
|
244
244
|
}: {
|
|
245
|
-
instance: MRT_TableInstance
|
|
245
|
+
instance: MRT_TableInstance<D>;
|
|
246
246
|
column: MRT_Column<D>;
|
|
247
247
|
}) => TableCellProps);
|
|
248
248
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
@@ -251,7 +251,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
|
251
251
|
instance,
|
|
252
252
|
column,
|
|
253
253
|
}: {
|
|
254
|
-
instance: MRT_TableInstance
|
|
254
|
+
instance: MRT_TableInstance<D>;
|
|
255
255
|
column: MRT_Column<D>;
|
|
256
256
|
}) => IconButtonProps);
|
|
257
257
|
muiTableHeadCellFilterTextFieldProps?:
|
|
@@ -260,7 +260,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
|
260
260
|
instance,
|
|
261
261
|
column,
|
|
262
262
|
}: {
|
|
263
|
-
instance: MRT_TableInstance
|
|
263
|
+
instance: MRT_TableInstance<D>;
|
|
264
264
|
column: MRT_Column<D>;
|
|
265
265
|
}) => TextFieldProps);
|
|
266
266
|
muiTableHeadCellProps?:
|
|
@@ -269,7 +269,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
|
269
269
|
instance,
|
|
270
270
|
column,
|
|
271
271
|
}: {
|
|
272
|
-
instance: MRT_TableInstance
|
|
272
|
+
instance: MRT_TableInstance<D>;
|
|
273
273
|
column: MRT_Column<D>;
|
|
274
274
|
}) => TableCellProps);
|
|
275
275
|
onCellEditBlur?: ({
|
|
@@ -406,26 +406,38 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
406
406
|
enabledGlobalFilterOptions?: (MRT_FILTER_OPTION | string)[] | null;
|
|
407
407
|
icons?: Partial<MRT_Icons>;
|
|
408
408
|
localization?: Partial<MRT_Localization>;
|
|
409
|
+
muiExpandAllButtonProps?:
|
|
410
|
+
| IconButtonProps
|
|
411
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => IconButtonProps);
|
|
412
|
+
muiExpandButtonProps?:
|
|
413
|
+
| IconButtonProps
|
|
414
|
+
| (({
|
|
415
|
+
instance,
|
|
416
|
+
}: {
|
|
417
|
+
instance: MRT_TableInstance<D>;
|
|
418
|
+
row: MRT_Row<D>;
|
|
419
|
+
}) => IconButtonProps);
|
|
409
420
|
muiLinearProgressProps?:
|
|
410
421
|
| LinearProgressProps
|
|
411
422
|
| (({
|
|
412
423
|
instance,
|
|
413
424
|
}: {
|
|
414
|
-
instance: MRT_TableInstance
|
|
425
|
+
instance: MRT_TableInstance<D>;
|
|
415
426
|
}) => LinearProgressProps);
|
|
416
427
|
muiSearchTextFieldProps?:
|
|
417
428
|
| TextFieldProps
|
|
418
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TextFieldProps);
|
|
429
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TextFieldProps);
|
|
430
|
+
muiSelectAllCheckboxProps?:
|
|
431
|
+
| CheckboxProps
|
|
432
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => CheckboxProps);
|
|
419
433
|
muiSelectCheckboxProps?:
|
|
420
434
|
| CheckboxProps
|
|
421
435
|
| (({
|
|
422
436
|
instance,
|
|
423
|
-
isSelectAll,
|
|
424
437
|
row,
|
|
425
438
|
}: {
|
|
426
|
-
instance: MRT_TableInstance
|
|
427
|
-
|
|
428
|
-
row?: MRT_Row<D>;
|
|
439
|
+
instance: MRT_TableInstance<D>;
|
|
440
|
+
row: MRT_Row<D>;
|
|
429
441
|
}) => CheckboxProps);
|
|
430
442
|
muiTableBodyCellCopyButtonProps?:
|
|
431
443
|
| ButtonProps
|
|
@@ -433,7 +445,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
433
445
|
instance,
|
|
434
446
|
cell,
|
|
435
447
|
}: {
|
|
436
|
-
instance: MRT_TableInstance
|
|
448
|
+
instance: MRT_TableInstance<D>;
|
|
437
449
|
cell: MRT_Cell<D>;
|
|
438
450
|
}) => ButtonProps);
|
|
439
451
|
muiTableBodyCellEditTextFieldProps?:
|
|
@@ -442,7 +454,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
442
454
|
instance,
|
|
443
455
|
cell,
|
|
444
456
|
}: {
|
|
445
|
-
instance: MRT_TableInstance
|
|
457
|
+
instance: MRT_TableInstance<D>;
|
|
446
458
|
cell: MRT_Cell<D>;
|
|
447
459
|
}) => TextFieldProps);
|
|
448
460
|
muiTableBodyCellProps?:
|
|
@@ -451,7 +463,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
451
463
|
instance,
|
|
452
464
|
cell,
|
|
453
465
|
}: {
|
|
454
|
-
instance: MRT_TableInstance
|
|
466
|
+
instance: MRT_TableInstance<D>;
|
|
455
467
|
cell: MRT_Cell<D>;
|
|
456
468
|
}) => TableCellProps);
|
|
457
469
|
muiTableBodyCellSkeletonProps?:
|
|
@@ -460,19 +472,19 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
460
472
|
instance,
|
|
461
473
|
cell,
|
|
462
474
|
}: {
|
|
463
|
-
instance: MRT_TableInstance
|
|
475
|
+
instance: MRT_TableInstance<D>;
|
|
464
476
|
cell: MRT_Cell<D>;
|
|
465
477
|
}) => SkeletonProps);
|
|
466
478
|
muiTableBodyProps?:
|
|
467
479
|
| TableBodyProps
|
|
468
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableBodyProps);
|
|
480
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableBodyProps);
|
|
469
481
|
muiTableBodyRowProps?:
|
|
470
482
|
| TableRowProps
|
|
471
483
|
| (({
|
|
472
484
|
instance,
|
|
473
485
|
row,
|
|
474
486
|
}: {
|
|
475
|
-
instance: MRT_TableInstance
|
|
487
|
+
instance: MRT_TableInstance<D>;
|
|
476
488
|
row: MRT_Row<D>;
|
|
477
489
|
}) => TableRowProps);
|
|
478
490
|
muiTableContainerProps?:
|
|
@@ -480,7 +492,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
480
492
|
| (({
|
|
481
493
|
instance,
|
|
482
494
|
}: {
|
|
483
|
-
instance: MRT_TableInstance
|
|
495
|
+
instance: MRT_TableInstance<D>;
|
|
484
496
|
}) => TableContainerProps);
|
|
485
497
|
muiTableDetailPanelProps?:
|
|
486
498
|
| TableCellProps
|
|
@@ -488,7 +500,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
488
500
|
instance,
|
|
489
501
|
row,
|
|
490
502
|
}: {
|
|
491
|
-
instance: MRT_TableInstance
|
|
503
|
+
instance: MRT_TableInstance<D>;
|
|
492
504
|
row: MRT_Row<D>;
|
|
493
505
|
}) => TableCellProps);
|
|
494
506
|
muiTableFooterCellProps?:
|
|
@@ -497,19 +509,19 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
497
509
|
instance,
|
|
498
510
|
column,
|
|
499
511
|
}: {
|
|
500
|
-
instance: MRT_TableInstance
|
|
512
|
+
instance: MRT_TableInstance<D>;
|
|
501
513
|
column: MRT_Column<D>;
|
|
502
514
|
}) => TableCellProps);
|
|
503
515
|
muiTableFooterProps?:
|
|
504
516
|
| TableFooterProps
|
|
505
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableFooterProps);
|
|
517
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableFooterProps);
|
|
506
518
|
muiTableFooterRowProps?:
|
|
507
519
|
| TableRowProps
|
|
508
520
|
| (({
|
|
509
521
|
instance,
|
|
510
522
|
footerGroup,
|
|
511
523
|
}: {
|
|
512
|
-
instance: MRT_TableInstance
|
|
524
|
+
instance: MRT_TableInstance<D>;
|
|
513
525
|
footerGroup: MRT_HeaderGroup<D>;
|
|
514
526
|
}) => TableRowProps);
|
|
515
527
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
@@ -518,7 +530,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
518
530
|
instance,
|
|
519
531
|
column,
|
|
520
532
|
}: {
|
|
521
|
-
instance: MRT_TableInstance
|
|
533
|
+
instance: MRT_TableInstance<D>;
|
|
522
534
|
column: MRT_Column<D>;
|
|
523
535
|
}) => IconButtonProps);
|
|
524
536
|
muiTableHeadCellFilterTextFieldProps?:
|
|
@@ -527,7 +539,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
527
539
|
instance,
|
|
528
540
|
column,
|
|
529
541
|
}: {
|
|
530
|
-
instance: MRT_TableInstance
|
|
542
|
+
instance: MRT_TableInstance<D>;
|
|
531
543
|
column: MRT_Column<D>;
|
|
532
544
|
}) => TextFieldProps);
|
|
533
545
|
muiTableHeadCellProps?:
|
|
@@ -536,19 +548,19 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
536
548
|
instance,
|
|
537
549
|
column,
|
|
538
550
|
}: {
|
|
539
|
-
instance: MRT_TableInstance
|
|
551
|
+
instance: MRT_TableInstance<D>;
|
|
540
552
|
column: MRT_Column<D>;
|
|
541
553
|
}) => TableCellProps);
|
|
542
554
|
muiTableHeadProps?:
|
|
543
555
|
| TableHeadProps
|
|
544
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableHeadProps);
|
|
556
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableHeadProps);
|
|
545
557
|
muiTableHeadRowProps?:
|
|
546
558
|
| TableRowProps
|
|
547
559
|
| (({
|
|
548
560
|
instance,
|
|
549
561
|
headerGroup,
|
|
550
562
|
}: {
|
|
551
|
-
instance: MRT_TableInstance
|
|
563
|
+
instance: MRT_TableInstance<D>;
|
|
552
564
|
headerGroup: MRT_HeaderGroup<D>;
|
|
553
565
|
}) => TableRowProps);
|
|
554
566
|
muiTablePaginationProps?:
|
|
@@ -556,23 +568,23 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
556
568
|
| (({
|
|
557
569
|
instance,
|
|
558
570
|
}: {
|
|
559
|
-
instance: MRT_TableInstance
|
|
571
|
+
instance: MRT_TableInstance<D>;
|
|
560
572
|
}) => Partial<TablePaginationProps>);
|
|
561
573
|
muiTablePaperProps?:
|
|
562
574
|
| PaperProps
|
|
563
|
-
| (({ instance }: { instance: MRT_TableInstance }) => PaperProps);
|
|
575
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => PaperProps);
|
|
564
576
|
muiTableProps?:
|
|
565
577
|
| TableProps
|
|
566
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableProps);
|
|
578
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableProps);
|
|
567
579
|
muiTableToolbarAlertBannerProps?:
|
|
568
580
|
| AlertProps
|
|
569
|
-
| (({ instance }: { instance: MRT_TableInstance }) => AlertProps);
|
|
581
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => AlertProps);
|
|
570
582
|
muiTableToolbarBottomProps?:
|
|
571
583
|
| ToolbarProps
|
|
572
|
-
| (({ instance }: { instance: MRT_TableInstance }) => ToolbarProps);
|
|
584
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => ToolbarProps);
|
|
573
585
|
muiTableToolbarTopProps?:
|
|
574
586
|
| ToolbarProps
|
|
575
|
-
| (({ instance }: { instance: MRT_TableInstance }) => ToolbarProps);
|
|
587
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => ToolbarProps);
|
|
576
588
|
onCellClick?: ({
|
|
577
589
|
cell,
|
|
578
590
|
event,
|
|
@@ -15,6 +15,7 @@ export const MRT_ExpandAllButton: FC<Props> = ({ instance }) => {
|
|
|
15
15
|
options: {
|
|
16
16
|
icons: { KeyboardDoubleArrowDownIcon },
|
|
17
17
|
localization,
|
|
18
|
+
muiExpandAllButtonProps,
|
|
18
19
|
renderDetailPanel,
|
|
19
20
|
},
|
|
20
21
|
toggleAllRowsExpanded,
|
|
@@ -22,6 +23,11 @@ export const MRT_ExpandAllButton: FC<Props> = ({ instance }) => {
|
|
|
22
23
|
|
|
23
24
|
const { density } = getState();
|
|
24
25
|
|
|
26
|
+
const iconButtonProps =
|
|
27
|
+
muiExpandAllButtonProps instanceof Function
|
|
28
|
+
? muiExpandAllButtonProps({ instance })
|
|
29
|
+
: muiExpandAllButtonProps;
|
|
30
|
+
|
|
25
31
|
return (
|
|
26
32
|
<Tooltip
|
|
27
33
|
arrow
|
|
@@ -33,9 +39,11 @@ export const MRT_ExpandAllButton: FC<Props> = ({ instance }) => {
|
|
|
33
39
|
aria-label={localization.expandAll}
|
|
34
40
|
disabled={!getCanSomeRowsExpand() && !renderDetailPanel}
|
|
35
41
|
onClick={() => toggleAllRowsExpanded(!getIsAllRowsExpanded())}
|
|
42
|
+
{...iconButtonProps}
|
|
36
43
|
sx={{
|
|
37
44
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
38
45
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
46
|
+
...iconButtonProps?.sx,
|
|
39
47
|
}}
|
|
40
48
|
>
|
|
41
49
|
<KeyboardDoubleArrowDownIcon
|
|
@@ -13,6 +13,7 @@ export const MRT_ExpandButton: FC<Props> = ({ row, instance }) => {
|
|
|
13
13
|
options: {
|
|
14
14
|
icons: { ExpandMoreIcon },
|
|
15
15
|
localization,
|
|
16
|
+
muiExpandButtonProps,
|
|
16
17
|
onExpandChanged,
|
|
17
18
|
renderDetailPanel,
|
|
18
19
|
},
|
|
@@ -20,6 +21,11 @@ export const MRT_ExpandButton: FC<Props> = ({ row, instance }) => {
|
|
|
20
21
|
|
|
21
22
|
const { density } = getState();
|
|
22
23
|
|
|
24
|
+
const iconButtonProps =
|
|
25
|
+
muiExpandButtonProps instanceof Function
|
|
26
|
+
? muiExpandButtonProps({ instance, row })
|
|
27
|
+
: muiExpandButtonProps;
|
|
28
|
+
|
|
23
29
|
const handleToggleExpand = (event: MouseEvent<HTMLButtonElement>) => {
|
|
24
30
|
row.toggleExpanded();
|
|
25
31
|
onExpandChanged?.({ event, row, instance });
|
|
@@ -36,9 +42,11 @@ export const MRT_ExpandButton: FC<Props> = ({ row, instance }) => {
|
|
|
36
42
|
aria-label={localization.expand}
|
|
37
43
|
disabled={!row.getCanExpand() && !renderDetailPanel}
|
|
38
44
|
onClick={handleToggleExpand}
|
|
45
|
+
{...iconButtonProps}
|
|
39
46
|
sx={{
|
|
40
47
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
41
48
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
49
|
+
...iconButtonProps?.sx,
|
|
42
50
|
}}
|
|
43
51
|
>
|
|
44
52
|
<ExpandMoreIcon
|
|
@@ -11,11 +11,13 @@ interface Props {
|
|
|
11
11
|
export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, instance }) => {
|
|
12
12
|
const {
|
|
13
13
|
getRowModel,
|
|
14
|
+
getPaginationRowModel,
|
|
14
15
|
getSelectedRowModel,
|
|
15
16
|
getState,
|
|
16
17
|
options: {
|
|
17
18
|
localization,
|
|
18
19
|
muiSelectCheckboxProps,
|
|
20
|
+
muiSelectAllCheckboxProps,
|
|
19
21
|
onRowSelectionChanged,
|
|
20
22
|
onRowSelectAllChanged,
|
|
21
23
|
selectAllMode,
|
|
@@ -33,7 +35,11 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, instance }) => {
|
|
|
33
35
|
}
|
|
34
36
|
onRowSelectAllChanged?.({
|
|
35
37
|
event,
|
|
36
|
-
selectedRows: event.target.checked
|
|
38
|
+
selectedRows: event.target.checked
|
|
39
|
+
? selectAllMode === 'all'
|
|
40
|
+
? getRowModel().flatRows
|
|
41
|
+
: getPaginationRowModel().flatRows
|
|
42
|
+
: [],
|
|
37
43
|
instance,
|
|
38
44
|
});
|
|
39
45
|
} else if (row) {
|
|
@@ -51,10 +57,13 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, instance }) => {
|
|
|
51
57
|
}
|
|
52
58
|
};
|
|
53
59
|
|
|
54
|
-
const checkboxProps =
|
|
55
|
-
|
|
56
|
-
?
|
|
57
|
-
:
|
|
60
|
+
const checkboxProps = selectAll
|
|
61
|
+
? muiSelectAllCheckboxProps instanceof Function
|
|
62
|
+
? muiSelectAllCheckboxProps({ instance })
|
|
63
|
+
: muiSelectAllCheckboxProps
|
|
64
|
+
: muiSelectCheckboxProps instanceof Function
|
|
65
|
+
? muiSelectCheckboxProps({ row: row as MRT_Row, instance })
|
|
66
|
+
: muiSelectCheckboxProps;
|
|
58
67
|
|
|
59
68
|
return (
|
|
60
69
|
<Tooltip
|