material-react-table 0.12.2 → 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 +13 -8
- package/dist/MaterialReactTable.d.ts +59 -46
- package/dist/icons.d.ts +1 -0
- package/dist/localization.d.ts +1 -1
- package/dist/material-react-table.cjs.development.js +90 -68
- 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 +91 -69
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +64 -44
- package/src/body/MRT_TableBody.tsx +2 -2
- package/src/body/MRT_TableBodyCell.tsx +22 -10
- package/src/buttons/MRT_ExpandAllButton.tsx +11 -3
- package/src/buttons/MRT_ExpandButton.tsx +11 -3
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +22 -10
- package/src/footer/MRT_TableFooterCell.tsx +7 -2
- package/src/head/MRT_TableHeadCell.tsx +21 -9
- package/src/icons.ts +6 -3
- package/src/inputs/MRT_FilterTextField.tsx +4 -0
- package/src/inputs/MRT_SelectCheckbox.tsx +18 -9
- package/src/localization.ts +2 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +2 -2
- package/src/menus/MRT_FilterOptionMenu.tsx +2 -3
- package/src/menus/MRT_RowActionMenu.tsx +2 -2
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +2 -2
- package/src/table/MRT_TableRoot.tsx +4 -4
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
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": {
|
|
@@ -121,7 +121,7 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
|
|
|
121
121
|
}>
|
|
122
122
|
>;
|
|
123
123
|
setCurrentGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterFn>>;
|
|
124
|
-
|
|
124
|
+
setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
|
|
125
125
|
setIsFullScreen: Dispatch<SetStateAction<boolean>>;
|
|
126
126
|
setShowFilters: Dispatch<SetStateAction<boolean>>;
|
|
127
127
|
setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
|
|
@@ -132,7 +132,7 @@ export type MRT_TableState<D extends Record<string, any> = {}> = TableState & {
|
|
|
132
132
|
currentEditingRow: MRT_Row<D> | null;
|
|
133
133
|
currentFilterFns: Record<string, string | Function>;
|
|
134
134
|
currentGlobalFilterFn: Record<string, string | Function>;
|
|
135
|
-
|
|
135
|
+
density: 'comfortable' | 'compact' | 'spacious';
|
|
136
136
|
isLoading: boolean;
|
|
137
137
|
isFullScreen: boolean;
|
|
138
138
|
showFilters: boolean;
|
|
@@ -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?: ({
|
|
@@ -294,19 +294,23 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
|
|
|
294
294
|
column,
|
|
295
295
|
event,
|
|
296
296
|
filterValue,
|
|
297
|
+
instance,
|
|
297
298
|
}: {
|
|
298
299
|
column: MRT_Column<D>;
|
|
299
300
|
event: ChangeEvent<HTMLInputElement>;
|
|
300
301
|
filterValue: any;
|
|
302
|
+
instance: MRT_TableInstance<D>;
|
|
301
303
|
}) => void;
|
|
302
304
|
onColumnFilterValueChangedDebounced?: ({
|
|
303
305
|
column,
|
|
304
306
|
event,
|
|
305
307
|
filterValue,
|
|
308
|
+
instance,
|
|
306
309
|
}: {
|
|
307
310
|
column: MRT_Column<D>;
|
|
308
311
|
event: ChangeEvent<HTMLInputElement>;
|
|
309
312
|
filterValue: any;
|
|
313
|
+
instance: MRT_TableInstance<D>;
|
|
310
314
|
}) => void;
|
|
311
315
|
};
|
|
312
316
|
|
|
@@ -382,7 +386,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
382
386
|
enableClickToCopy?: boolean;
|
|
383
387
|
enableColumnActions?: boolean;
|
|
384
388
|
enableColumnOrdering?: boolean;
|
|
385
|
-
|
|
389
|
+
enableDensityToggle?: boolean;
|
|
386
390
|
enableEditing?: boolean;
|
|
387
391
|
enableExpandAll?: boolean;
|
|
388
392
|
enableFullScreenToggle?: boolean;
|
|
@@ -402,26 +406,38 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
402
406
|
enabledGlobalFilterOptions?: (MRT_FILTER_OPTION | string)[] | null;
|
|
403
407
|
icons?: Partial<MRT_Icons>;
|
|
404
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);
|
|
405
420
|
muiLinearProgressProps?:
|
|
406
421
|
| LinearProgressProps
|
|
407
422
|
| (({
|
|
408
423
|
instance,
|
|
409
424
|
}: {
|
|
410
|
-
instance: MRT_TableInstance
|
|
425
|
+
instance: MRT_TableInstance<D>;
|
|
411
426
|
}) => LinearProgressProps);
|
|
412
427
|
muiSearchTextFieldProps?:
|
|
413
428
|
| TextFieldProps
|
|
414
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TextFieldProps);
|
|
429
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TextFieldProps);
|
|
430
|
+
muiSelectAllCheckboxProps?:
|
|
431
|
+
| CheckboxProps
|
|
432
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => CheckboxProps);
|
|
415
433
|
muiSelectCheckboxProps?:
|
|
416
434
|
| CheckboxProps
|
|
417
435
|
| (({
|
|
418
436
|
instance,
|
|
419
|
-
isSelectAll,
|
|
420
437
|
row,
|
|
421
438
|
}: {
|
|
422
|
-
instance: MRT_TableInstance
|
|
423
|
-
|
|
424
|
-
row?: MRT_Row<D>;
|
|
439
|
+
instance: MRT_TableInstance<D>;
|
|
440
|
+
row: MRT_Row<D>;
|
|
425
441
|
}) => CheckboxProps);
|
|
426
442
|
muiTableBodyCellCopyButtonProps?:
|
|
427
443
|
| ButtonProps
|
|
@@ -429,7 +445,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
429
445
|
instance,
|
|
430
446
|
cell,
|
|
431
447
|
}: {
|
|
432
|
-
instance: MRT_TableInstance
|
|
448
|
+
instance: MRT_TableInstance<D>;
|
|
433
449
|
cell: MRT_Cell<D>;
|
|
434
450
|
}) => ButtonProps);
|
|
435
451
|
muiTableBodyCellEditTextFieldProps?:
|
|
@@ -438,7 +454,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
438
454
|
instance,
|
|
439
455
|
cell,
|
|
440
456
|
}: {
|
|
441
|
-
instance: MRT_TableInstance
|
|
457
|
+
instance: MRT_TableInstance<D>;
|
|
442
458
|
cell: MRT_Cell<D>;
|
|
443
459
|
}) => TextFieldProps);
|
|
444
460
|
muiTableBodyCellProps?:
|
|
@@ -447,7 +463,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
447
463
|
instance,
|
|
448
464
|
cell,
|
|
449
465
|
}: {
|
|
450
|
-
instance: MRT_TableInstance
|
|
466
|
+
instance: MRT_TableInstance<D>;
|
|
451
467
|
cell: MRT_Cell<D>;
|
|
452
468
|
}) => TableCellProps);
|
|
453
469
|
muiTableBodyCellSkeletonProps?:
|
|
@@ -456,19 +472,19 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
456
472
|
instance,
|
|
457
473
|
cell,
|
|
458
474
|
}: {
|
|
459
|
-
instance: MRT_TableInstance
|
|
475
|
+
instance: MRT_TableInstance<D>;
|
|
460
476
|
cell: MRT_Cell<D>;
|
|
461
477
|
}) => SkeletonProps);
|
|
462
478
|
muiTableBodyProps?:
|
|
463
479
|
| TableBodyProps
|
|
464
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableBodyProps);
|
|
480
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableBodyProps);
|
|
465
481
|
muiTableBodyRowProps?:
|
|
466
482
|
| TableRowProps
|
|
467
483
|
| (({
|
|
468
484
|
instance,
|
|
469
485
|
row,
|
|
470
486
|
}: {
|
|
471
|
-
instance: MRT_TableInstance
|
|
487
|
+
instance: MRT_TableInstance<D>;
|
|
472
488
|
row: MRT_Row<D>;
|
|
473
489
|
}) => TableRowProps);
|
|
474
490
|
muiTableContainerProps?:
|
|
@@ -476,7 +492,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
476
492
|
| (({
|
|
477
493
|
instance,
|
|
478
494
|
}: {
|
|
479
|
-
instance: MRT_TableInstance
|
|
495
|
+
instance: MRT_TableInstance<D>;
|
|
480
496
|
}) => TableContainerProps);
|
|
481
497
|
muiTableDetailPanelProps?:
|
|
482
498
|
| TableCellProps
|
|
@@ -484,7 +500,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
484
500
|
instance,
|
|
485
501
|
row,
|
|
486
502
|
}: {
|
|
487
|
-
instance: MRT_TableInstance
|
|
503
|
+
instance: MRT_TableInstance<D>;
|
|
488
504
|
row: MRT_Row<D>;
|
|
489
505
|
}) => TableCellProps);
|
|
490
506
|
muiTableFooterCellProps?:
|
|
@@ -493,19 +509,19 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
493
509
|
instance,
|
|
494
510
|
column,
|
|
495
511
|
}: {
|
|
496
|
-
instance: MRT_TableInstance
|
|
512
|
+
instance: MRT_TableInstance<D>;
|
|
497
513
|
column: MRT_Column<D>;
|
|
498
514
|
}) => TableCellProps);
|
|
499
515
|
muiTableFooterProps?:
|
|
500
516
|
| TableFooterProps
|
|
501
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableFooterProps);
|
|
517
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableFooterProps);
|
|
502
518
|
muiTableFooterRowProps?:
|
|
503
519
|
| TableRowProps
|
|
504
520
|
| (({
|
|
505
521
|
instance,
|
|
506
522
|
footerGroup,
|
|
507
523
|
}: {
|
|
508
|
-
instance: MRT_TableInstance
|
|
524
|
+
instance: MRT_TableInstance<D>;
|
|
509
525
|
footerGroup: MRT_HeaderGroup<D>;
|
|
510
526
|
}) => TableRowProps);
|
|
511
527
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
@@ -514,7 +530,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
514
530
|
instance,
|
|
515
531
|
column,
|
|
516
532
|
}: {
|
|
517
|
-
instance: MRT_TableInstance
|
|
533
|
+
instance: MRT_TableInstance<D>;
|
|
518
534
|
column: MRT_Column<D>;
|
|
519
535
|
}) => IconButtonProps);
|
|
520
536
|
muiTableHeadCellFilterTextFieldProps?:
|
|
@@ -523,7 +539,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
523
539
|
instance,
|
|
524
540
|
column,
|
|
525
541
|
}: {
|
|
526
|
-
instance: MRT_TableInstance
|
|
542
|
+
instance: MRT_TableInstance<D>;
|
|
527
543
|
column: MRT_Column<D>;
|
|
528
544
|
}) => TextFieldProps);
|
|
529
545
|
muiTableHeadCellProps?:
|
|
@@ -532,19 +548,19 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
532
548
|
instance,
|
|
533
549
|
column,
|
|
534
550
|
}: {
|
|
535
|
-
instance: MRT_TableInstance
|
|
551
|
+
instance: MRT_TableInstance<D>;
|
|
536
552
|
column: MRT_Column<D>;
|
|
537
553
|
}) => TableCellProps);
|
|
538
554
|
muiTableHeadProps?:
|
|
539
555
|
| TableHeadProps
|
|
540
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableHeadProps);
|
|
556
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableHeadProps);
|
|
541
557
|
muiTableHeadRowProps?:
|
|
542
558
|
| TableRowProps
|
|
543
559
|
| (({
|
|
544
560
|
instance,
|
|
545
561
|
headerGroup,
|
|
546
562
|
}: {
|
|
547
|
-
instance: MRT_TableInstance
|
|
563
|
+
instance: MRT_TableInstance<D>;
|
|
548
564
|
headerGroup: MRT_HeaderGroup<D>;
|
|
549
565
|
}) => TableRowProps);
|
|
550
566
|
muiTablePaginationProps?:
|
|
@@ -552,23 +568,23 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
552
568
|
| (({
|
|
553
569
|
instance,
|
|
554
570
|
}: {
|
|
555
|
-
instance: MRT_TableInstance
|
|
571
|
+
instance: MRT_TableInstance<D>;
|
|
556
572
|
}) => Partial<TablePaginationProps>);
|
|
557
573
|
muiTablePaperProps?:
|
|
558
574
|
| PaperProps
|
|
559
|
-
| (({ instance }: { instance: MRT_TableInstance }) => PaperProps);
|
|
575
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => PaperProps);
|
|
560
576
|
muiTableProps?:
|
|
561
577
|
| TableProps
|
|
562
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableProps);
|
|
578
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableProps);
|
|
563
579
|
muiTableToolbarAlertBannerProps?:
|
|
564
580
|
| AlertProps
|
|
565
|
-
| (({ instance }: { instance: MRT_TableInstance }) => AlertProps);
|
|
581
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => AlertProps);
|
|
566
582
|
muiTableToolbarBottomProps?:
|
|
567
583
|
| ToolbarProps
|
|
568
|
-
| (({ instance }: { instance: MRT_TableInstance }) => ToolbarProps);
|
|
584
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => ToolbarProps);
|
|
569
585
|
muiTableToolbarTopProps?:
|
|
570
586
|
| ToolbarProps
|
|
571
|
-
| (({ instance }: { instance: MRT_TableInstance }) => ToolbarProps);
|
|
587
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => ToolbarProps);
|
|
572
588
|
onCellClick?: ({
|
|
573
589
|
cell,
|
|
574
590
|
event,
|
|
@@ -600,19 +616,23 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
600
616
|
column,
|
|
601
617
|
event,
|
|
602
618
|
filterValue,
|
|
619
|
+
instance,
|
|
603
620
|
}: {
|
|
604
621
|
column: MRT_Column<D>;
|
|
605
622
|
event: ChangeEvent<HTMLInputElement>;
|
|
606
623
|
filterValue: any;
|
|
624
|
+
instance: MRT_TableInstance<D>;
|
|
607
625
|
}) => void;
|
|
608
626
|
onColumnFilterValueChangedDebounced?: ({
|
|
609
627
|
column,
|
|
610
628
|
event,
|
|
611
629
|
filterValue,
|
|
630
|
+
instance,
|
|
612
631
|
}: {
|
|
613
632
|
column: MRT_Column<D>;
|
|
614
633
|
event: ChangeEvent<HTMLInputElement>;
|
|
615
634
|
filterValue: any;
|
|
635
|
+
instance: MRT_TableInstance<D>;
|
|
616
636
|
}) => void;
|
|
617
637
|
onColumnVisibilityChanged?: ({
|
|
618
638
|
column,
|
|
@@ -665,14 +685,14 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
665
685
|
event: ChangeEvent<HTMLInputElement>;
|
|
666
686
|
instance: MRT_TableInstance<D>;
|
|
667
687
|
}) => void;
|
|
668
|
-
|
|
669
|
-
|
|
688
|
+
onDensityChange?: OnChangeFn<boolean>;
|
|
689
|
+
onDensityChanged?: ({
|
|
670
690
|
event,
|
|
671
|
-
|
|
691
|
+
density,
|
|
672
692
|
instance,
|
|
673
693
|
}: {
|
|
674
694
|
event: MouseEvent<HTMLButtonElement>;
|
|
675
|
-
|
|
695
|
+
density: 'comfortable' | 'compact' | 'spacious';
|
|
676
696
|
instance: MRT_TableInstance<D>;
|
|
677
697
|
}) => void;
|
|
678
698
|
onIsFullScreenChange?: OnChangeFn<boolean>;
|
|
@@ -808,7 +828,7 @@ export default <D extends Record<string, any> = {}>({
|
|
|
808
828
|
enableColumnFilters = true,
|
|
809
829
|
enableColumnOrdering = false,
|
|
810
830
|
enableColumnResizing = false,
|
|
811
|
-
|
|
831
|
+
enableDensityToggle = true,
|
|
812
832
|
enableExpandAll = true,
|
|
813
833
|
enableFilters = true,
|
|
814
834
|
enableFullScreenToggle = true,
|
|
@@ -847,7 +867,7 @@ export default <D extends Record<string, any> = {}>({
|
|
|
847
867
|
enableColumnFilters={enableColumnFilters}
|
|
848
868
|
enableColumnOrdering={enableColumnOrdering}
|
|
849
869
|
enableColumnResizing={enableColumnResizing}
|
|
850
|
-
|
|
870
|
+
enableDensityToggle={enableDensityToggle}
|
|
851
871
|
enableExpandAll={enableExpandAll}
|
|
852
872
|
enableFilters={enableFilters}
|
|
853
873
|
enableFullScreenToggle={enableFullScreenToggle}
|
|
@@ -22,7 +22,7 @@ export const MRT_TableBody: FC<Props> = ({ instance, tableContainerRef }) => {
|
|
|
22
22
|
},
|
|
23
23
|
} = instance;
|
|
24
24
|
|
|
25
|
-
const {
|
|
25
|
+
const { density } = getState();
|
|
26
26
|
|
|
27
27
|
const tableBodyProps =
|
|
28
28
|
muiTableBodyProps instanceof Function
|
|
@@ -35,7 +35,7 @@ export const MRT_TableBody: FC<Props> = ({ instance, tableContainerRef }) => {
|
|
|
35
35
|
|
|
36
36
|
const rowVirtualizer = enableRowVirtualization
|
|
37
37
|
? useVirtual({
|
|
38
|
-
overscan:
|
|
38
|
+
overscan: density === 'compact' ? 15 : 5,
|
|
39
39
|
size: rows.length,
|
|
40
40
|
parentRef: tableContainerRef,
|
|
41
41
|
...virtualizerProps,
|
|
@@ -41,7 +41,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
|
41
41
|
columnOrder,
|
|
42
42
|
currentEditingCell,
|
|
43
43
|
currentEditingRow,
|
|
44
|
-
|
|
44
|
+
density,
|
|
45
45
|
isLoading,
|
|
46
46
|
showSkeletons,
|
|
47
47
|
} = getState();
|
|
@@ -152,23 +152,35 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
|
152
152
|
? `${column.getStart('left')}px`
|
|
153
153
|
: undefined,
|
|
154
154
|
overflow: 'hidden',
|
|
155
|
-
p:
|
|
156
|
-
|
|
157
|
-
?
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
p:
|
|
156
|
+
density === 'compact'
|
|
157
|
+
? columnDefType === 'display'
|
|
158
|
+
? '0 0.5rem'
|
|
159
|
+
: '0.5rem'
|
|
160
|
+
: density === 'comfortable'
|
|
161
|
+
? columnDefType === 'display'
|
|
162
|
+
? '0.5rem 0.75rem'
|
|
163
|
+
: '1rem'
|
|
164
|
+
: columnDefType === 'display'
|
|
165
|
+
? '1rem 1.25rem'
|
|
166
|
+
: '1.5rem',
|
|
162
167
|
pl:
|
|
163
168
|
column.id === 'mrt-expand'
|
|
164
|
-
? `${
|
|
169
|
+
? `${
|
|
170
|
+
row.depth +
|
|
171
|
+
(density === 'compact'
|
|
172
|
+
? 0.5
|
|
173
|
+
: density === 'comfortable'
|
|
174
|
+
? 0.75
|
|
175
|
+
: 1.25)
|
|
176
|
+
}rem`
|
|
165
177
|
: undefined,
|
|
166
178
|
position: column.getIsPinned() ? 'sticky' : 'relative',
|
|
167
179
|
right:
|
|
168
180
|
column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined,
|
|
169
181
|
textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined,
|
|
170
182
|
transition: 'all 0.2s ease-in-out',
|
|
171
|
-
whiteSpace:
|
|
183
|
+
whiteSpace: density === 'compact' ? 'nowrap' : 'normal',
|
|
172
184
|
zIndex: column.getIsPinned() ? 1 : undefined,
|
|
173
185
|
'&:hover': {
|
|
174
186
|
backgroundColor:
|
|
@@ -15,12 +15,18 @@ 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,
|
|
21
22
|
} = instance;
|
|
22
23
|
|
|
23
|
-
const {
|
|
24
|
+
const { density } = getState();
|
|
25
|
+
|
|
26
|
+
const iconButtonProps =
|
|
27
|
+
muiExpandAllButtonProps instanceof Function
|
|
28
|
+
? muiExpandAllButtonProps({ instance })
|
|
29
|
+
: muiExpandAllButtonProps;
|
|
24
30
|
|
|
25
31
|
return (
|
|
26
32
|
<Tooltip
|
|
@@ -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
|
-
height:
|
|
38
|
-
width:
|
|
44
|
+
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
45
|
+
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
46
|
+
...iconButtonProps?.sx,
|
|
39
47
|
}}
|
|
40
48
|
>
|
|
41
49
|
<KeyboardDoubleArrowDownIcon
|
|
@@ -13,12 +13,18 @@ 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
|
},
|
|
19
20
|
} = instance;
|
|
20
21
|
|
|
21
|
-
const {
|
|
22
|
+
const { density } = getState();
|
|
23
|
+
|
|
24
|
+
const iconButtonProps =
|
|
25
|
+
muiExpandButtonProps instanceof Function
|
|
26
|
+
? muiExpandButtonProps({ instance, row })
|
|
27
|
+
: muiExpandButtonProps;
|
|
22
28
|
|
|
23
29
|
const handleToggleExpand = (event: MouseEvent<HTMLButtonElement>) => {
|
|
24
30
|
row.toggleExpanded();
|
|
@@ -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
|
-
height:
|
|
41
|
-
width:
|
|
47
|
+
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
48
|
+
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
49
|
+
...iconButtonProps?.sx,
|
|
42
50
|
}}
|
|
43
51
|
>
|
|
44
52
|
<ExpandMoreIcon
|
|
@@ -13,32 +13,44 @@ export const MRT_ToggleDensePaddingButton: FC<Props> = ({
|
|
|
13
13
|
const {
|
|
14
14
|
getState,
|
|
15
15
|
options: {
|
|
16
|
-
icons: { DensityMediumIcon, DensitySmallIcon },
|
|
16
|
+
icons: { DensityLargeIcon, DensityMediumIcon, DensitySmallIcon },
|
|
17
17
|
localization,
|
|
18
|
-
|
|
18
|
+
onDensityChanged,
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
setDensity,
|
|
21
21
|
} = instance;
|
|
22
22
|
|
|
23
|
-
const {
|
|
23
|
+
const { density } = getState();
|
|
24
24
|
|
|
25
25
|
const handleToggleDensePadding = (event: MouseEvent<HTMLButtonElement>) => {
|
|
26
|
-
|
|
26
|
+
const nextDensity =
|
|
27
|
+
density === 'comfortable'
|
|
28
|
+
? 'compact'
|
|
29
|
+
: density === 'compact'
|
|
30
|
+
? 'spacious'
|
|
31
|
+
: 'comfortable';
|
|
32
|
+
onDensityChanged?.({
|
|
27
33
|
event,
|
|
28
|
-
|
|
34
|
+
density: nextDensity,
|
|
29
35
|
instance,
|
|
30
36
|
});
|
|
31
|
-
|
|
37
|
+
setDensity(nextDensity);
|
|
32
38
|
};
|
|
33
39
|
|
|
34
40
|
return (
|
|
35
|
-
<Tooltip arrow title={localization.
|
|
41
|
+
<Tooltip arrow title={localization.toggleDensity}>
|
|
36
42
|
<IconButton
|
|
37
|
-
aria-label={localization.
|
|
43
|
+
aria-label={localization.toggleDensity}
|
|
38
44
|
onClick={handleToggleDensePadding}
|
|
39
45
|
{...rest}
|
|
40
46
|
>
|
|
41
|
-
{
|
|
47
|
+
{density === 'compact' ? (
|
|
48
|
+
<DensitySmallIcon />
|
|
49
|
+
) : density === 'comfortable' ? (
|
|
50
|
+
<DensityMediumIcon />
|
|
51
|
+
) : (
|
|
52
|
+
<DensityLargeIcon />
|
|
53
|
+
)}
|
|
42
54
|
</IconButton>
|
|
43
55
|
</Tooltip>
|
|
44
56
|
);
|
|
@@ -13,7 +13,7 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, instance }) => {
|
|
|
13
13
|
options: { muiTableFooterCellProps, enableColumnResizing },
|
|
14
14
|
} = instance;
|
|
15
15
|
|
|
16
|
-
const {
|
|
16
|
+
const { density } = getState();
|
|
17
17
|
|
|
18
18
|
const { column } = footer;
|
|
19
19
|
|
|
@@ -49,7 +49,12 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, instance }) => {
|
|
|
49
49
|
fontWeight: 'bold',
|
|
50
50
|
maxWidth: `${column.getSize()}px`,
|
|
51
51
|
minWidth: `${column.getSize()}px`,
|
|
52
|
-
p:
|
|
52
|
+
p:
|
|
53
|
+
density === 'compact'
|
|
54
|
+
? '0.5rem'
|
|
55
|
+
: density === 'comfortable'
|
|
56
|
+
? '1rem'
|
|
57
|
+
: '1.5rem',
|
|
53
58
|
transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`,
|
|
54
59
|
width: column.getSize(),
|
|
55
60
|
verticalAlign: 'text-top',
|
|
@@ -37,7 +37,7 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
37
37
|
},
|
|
38
38
|
} = instance;
|
|
39
39
|
|
|
40
|
-
const {
|
|
40
|
+
const { density } = getState();
|
|
41
41
|
|
|
42
42
|
const { column } = header;
|
|
43
43
|
|
|
@@ -111,19 +111,31 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
111
111
|
? `${column.getStart('left')}px`
|
|
112
112
|
: undefined,
|
|
113
113
|
overflow: 'visible',
|
|
114
|
-
p:
|
|
115
|
-
|
|
116
|
-
?
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
p:
|
|
115
|
+
density === 'compact'
|
|
116
|
+
? columnDefType === 'display'
|
|
117
|
+
? '0 0.5rem'
|
|
118
|
+
: '0.5rem'
|
|
119
|
+
: density === 'comfortable'
|
|
120
|
+
? columnDefType === 'display'
|
|
121
|
+
? '0.5rem 0.75rem'
|
|
122
|
+
: '1rem'
|
|
123
|
+
: columnDefType === 'display'
|
|
124
|
+
? '1rem 1.25rem'
|
|
125
|
+
: '1.5rem',
|
|
121
126
|
pb: columnDefType === 'display' ? 0 : undefined,
|
|
122
127
|
position:
|
|
123
128
|
column.getIsPinned() && columnDefType !== 'group'
|
|
124
129
|
? 'sticky'
|
|
125
130
|
: undefined,
|
|
126
|
-
pt:
|
|
131
|
+
pt:
|
|
132
|
+
columnDefType !== 'data'
|
|
133
|
+
? 0
|
|
134
|
+
: density === 'compact'
|
|
135
|
+
? '0.25'
|
|
136
|
+
: density === 'comfortable'
|
|
137
|
+
? '.75rem'
|
|
138
|
+
: '1.25rem',
|
|
127
139
|
right:
|
|
128
140
|
column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined,
|
|
129
141
|
transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`,
|