material-react-table 0.13.1 → 0.14.0
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 +50 -39
- package/dist/material-react-table.cjs.development.js +137 -110
- 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 +137 -110
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/toolbar/MRT_TablePagination.d.ts +1 -0
- package/dist/toolbar/MRT_ToolbarTop.d.ts +0 -1
- package/dist/utils.d.ts +5 -2
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +60 -40
- package/src/buttons/MRT_ExpandAllButton.tsx +8 -0
- package/src/buttons/MRT_ExpandButton.tsx +8 -0
- package/src/inputs/MRT_SearchTextField.tsx +8 -11
- package/src/inputs/MRT_SelectCheckbox.tsx +14 -5
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +8 -1
- package/src/table/MRT_TableRoot.tsx +16 -43
- package/src/toolbar/MRT_TablePagination.tsx +10 -2
- package/src/toolbar/MRT_ToolbarBottom.tsx +21 -18
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +1 -1
- package/src/toolbar/MRT_ToolbarTop.tsx +18 -15
- package/src/utils.ts +33 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColumnDef, ColumnOrderState, Table, Updater } from '@tanstack/react-table';
|
|
2
|
-
import { MRT_Column, MRT_ColumnDef, MRT_FilterFn } from '.';
|
|
2
|
+
import { MaterialReactTableProps, MRT_Column, MRT_ColumnDef, MRT_FilterFn } from '.';
|
|
3
3
|
export declare const getAllLeafColumnDefs: (columns: MRT_ColumnDef[]) => MRT_ColumnDef[];
|
|
4
4
|
export declare const createGroup: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnDef<D>, currentFilterFns: {
|
|
5
5
|
[key: string]: import("@tanstack/react-table").FilterFnOption<import("@tanstack/react-table").TableGenerics>;
|
|
@@ -7,7 +7,10 @@ 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_ColumnDef<D>, currentFilterFns: {
|
|
8
8
|
[key: string]: import("@tanstack/react-table").FilterFnOption<import("@tanstack/react-table").TableGenerics>;
|
|
9
9
|
}) => ColumnDef<D>;
|
|
10
|
-
export declare const createDisplayColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: Pick<MRT_ColumnDef<D>, "
|
|
10
|
+
export declare const createDisplayColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: Pick<MRT_ColumnDef<D>, "accessorFn" | "footer" | "columns" | "filterFn" | "id" | "accessorKey" | "meta" | "enableHiding" | "enablePinning" | "enableColumnFilter" | "enableGlobalFilter" | "sortingFn" | "sortDescFirst" | "enableSorting" | "enableMultiSort" | "invertSorting" | "sortUndefined" | "aggregationFn" | "enableGrouping" | "enableResizing" | "size" | "minSize" | "maxSize" | "AggregatedCell" | "Cell" | "Edit" | "Filter" | "Footer" | "Header" | "enableClickToCopy" | "enableColumnActions" | "enableColumnOrdering" | "enableEditing" | "enabledColumnFilterOptions" | "filterSelectOptions" | "muiTableBodyCellCopyButtonProps" | "muiTableBodyCellEditTextFieldProps" | "muiTableBodyCellProps" | "muiTableFooterCellProps" | "muiTableHeadCellColumnActionsButtonProps" | "muiTableHeadCellFilterTextFieldProps" | "muiTableHeadCellProps" | "onCellEditBlur" | "onCellEditChanged" | "onColumnFilterValueChanged" | "onColumnFilterValueChangedDebounced"> & {
|
|
11
11
|
header?: string | undefined;
|
|
12
12
|
}) => ColumnDef<D>;
|
|
13
13
|
export declare const reorderColumn: (movingColumn: MRT_Column, receivingColumn: MRT_Column, columnOrder: ColumnOrderState, setColumnOrder: (updater: Updater<ColumnOrderState>) => void) => void;
|
|
14
|
+
export declare const getLeadingDisplayColumnIds: (props: MaterialReactTableProps<any>) => string[];
|
|
15
|
+
export declare const getTrailingDisplayColumnIds: (props: MaterialReactTableProps<any>) => (string | false | undefined)[];
|
|
16
|
+
export declare const getDefaultColumnOrderIds: (props: MaterialReactTableProps<any>) => string[];
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.14.0",
|
|
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,23 @@ 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
|
-
| (({
|
|
517
|
+
| (({
|
|
518
|
+
instance,
|
|
519
|
+
}: {
|
|
520
|
+
instance: MRT_TableInstance<D>;
|
|
521
|
+
}) => TableFooterProps);
|
|
506
522
|
muiTableFooterRowProps?:
|
|
507
523
|
| TableRowProps
|
|
508
524
|
| (({
|
|
509
525
|
instance,
|
|
510
526
|
footerGroup,
|
|
511
527
|
}: {
|
|
512
|
-
instance: MRT_TableInstance
|
|
528
|
+
instance: MRT_TableInstance<D>;
|
|
513
529
|
footerGroup: MRT_HeaderGroup<D>;
|
|
514
530
|
}) => TableRowProps);
|
|
515
531
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
@@ -518,7 +534,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
518
534
|
instance,
|
|
519
535
|
column,
|
|
520
536
|
}: {
|
|
521
|
-
instance: MRT_TableInstance
|
|
537
|
+
instance: MRT_TableInstance<D>;
|
|
522
538
|
column: MRT_Column<D>;
|
|
523
539
|
}) => IconButtonProps);
|
|
524
540
|
muiTableHeadCellFilterTextFieldProps?:
|
|
@@ -527,7 +543,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
527
543
|
instance,
|
|
528
544
|
column,
|
|
529
545
|
}: {
|
|
530
|
-
instance: MRT_TableInstance
|
|
546
|
+
instance: MRT_TableInstance<D>;
|
|
531
547
|
column: MRT_Column<D>;
|
|
532
548
|
}) => TextFieldProps);
|
|
533
549
|
muiTableHeadCellProps?:
|
|
@@ -536,19 +552,19 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
536
552
|
instance,
|
|
537
553
|
column,
|
|
538
554
|
}: {
|
|
539
|
-
instance: MRT_TableInstance
|
|
555
|
+
instance: MRT_TableInstance<D>;
|
|
540
556
|
column: MRT_Column<D>;
|
|
541
557
|
}) => TableCellProps);
|
|
542
558
|
muiTableHeadProps?:
|
|
543
559
|
| TableHeadProps
|
|
544
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableHeadProps);
|
|
560
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableHeadProps);
|
|
545
561
|
muiTableHeadRowProps?:
|
|
546
562
|
| TableRowProps
|
|
547
563
|
| (({
|
|
548
564
|
instance,
|
|
549
565
|
headerGroup,
|
|
550
566
|
}: {
|
|
551
|
-
instance: MRT_TableInstance
|
|
567
|
+
instance: MRT_TableInstance<D>;
|
|
552
568
|
headerGroup: MRT_HeaderGroup<D>;
|
|
553
569
|
}) => TableRowProps);
|
|
554
570
|
muiTablePaginationProps?:
|
|
@@ -556,23 +572,23 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
556
572
|
| (({
|
|
557
573
|
instance,
|
|
558
574
|
}: {
|
|
559
|
-
instance: MRT_TableInstance
|
|
575
|
+
instance: MRT_TableInstance<D>;
|
|
560
576
|
}) => Partial<TablePaginationProps>);
|
|
561
577
|
muiTablePaperProps?:
|
|
562
578
|
| PaperProps
|
|
563
|
-
| (({ instance }: { instance: MRT_TableInstance }) => PaperProps);
|
|
579
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => PaperProps);
|
|
564
580
|
muiTableProps?:
|
|
565
581
|
| TableProps
|
|
566
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableProps);
|
|
582
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableProps);
|
|
567
583
|
muiTableToolbarAlertBannerProps?:
|
|
568
584
|
| AlertProps
|
|
569
|
-
| (({ instance }: { instance: MRT_TableInstance }) => AlertProps);
|
|
585
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => AlertProps);
|
|
570
586
|
muiTableToolbarBottomProps?:
|
|
571
587
|
| ToolbarProps
|
|
572
|
-
| (({ instance }: { instance: MRT_TableInstance }) => ToolbarProps);
|
|
588
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => ToolbarProps);
|
|
573
589
|
muiTableToolbarTopProps?:
|
|
574
590
|
| ToolbarProps
|
|
575
|
-
| (({ instance }: { instance: MRT_TableInstance }) => ToolbarProps);
|
|
591
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => ToolbarProps);
|
|
576
592
|
onCellClick?: ({
|
|
577
593
|
cell,
|
|
578
594
|
event,
|
|
@@ -746,7 +762,6 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
746
762
|
positionActionsColumn?: 'first' | 'last';
|
|
747
763
|
positionGlobalFilter?: 'left' | 'right';
|
|
748
764
|
positionPagination?: 'bottom' | 'top' | 'both';
|
|
749
|
-
positionToolbarActions?: 'bottom' | 'top';
|
|
750
765
|
positionToolbarAlertBanner?: 'bottom' | 'top';
|
|
751
766
|
renderDetailPanel?: ({
|
|
752
767
|
row,
|
|
@@ -771,7 +786,12 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
771
786
|
row: MRT_Row<D>;
|
|
772
787
|
instance: MRT_TableInstance<D>;
|
|
773
788
|
}) => ReactNode;
|
|
774
|
-
|
|
789
|
+
renderToolbarBottomCustomActions?: ({
|
|
790
|
+
instance,
|
|
791
|
+
}: {
|
|
792
|
+
instance: MRT_TableInstance<D>;
|
|
793
|
+
}) => ReactNode;
|
|
794
|
+
renderToolbarTopCustomActions?: ({
|
|
775
795
|
instance,
|
|
776
796
|
}: {
|
|
777
797
|
instance: MRT_TableInstance<D>;
|
|
@@ -826,6 +846,7 @@ export default <D extends Record<string, any> = {}>({
|
|
|
826
846
|
enableMultiRowSelection = true,
|
|
827
847
|
enablePagination = true,
|
|
828
848
|
enablePinning = false,
|
|
849
|
+
enableRowSelection = false,
|
|
829
850
|
enableSelectAll = true,
|
|
830
851
|
enableSorting = true,
|
|
831
852
|
enableStickyHeader = false,
|
|
@@ -838,9 +859,8 @@ export default <D extends Record<string, any> = {}>({
|
|
|
838
859
|
localization,
|
|
839
860
|
persistentStateMode = 'sessionStorage',
|
|
840
861
|
positionActionsColumn = 'first',
|
|
841
|
-
positionPagination = 'bottom',
|
|
842
862
|
positionGlobalFilter = 'right',
|
|
843
|
-
|
|
863
|
+
positionPagination = 'bottom',
|
|
844
864
|
positionToolbarAlertBanner = 'top',
|
|
845
865
|
rowNumberMode = 'original',
|
|
846
866
|
selectAllMode = 'all',
|
|
@@ -865,6 +885,7 @@ export default <D extends Record<string, any> = {}>({
|
|
|
865
885
|
enableMultiRowSelection={enableMultiRowSelection}
|
|
866
886
|
enablePagination={enablePagination}
|
|
867
887
|
enablePinning={enablePinning}
|
|
888
|
+
enableRowSelection={enableRowSelection}
|
|
868
889
|
enableSelectAll={enableSelectAll}
|
|
869
890
|
enableSorting={enableSorting}
|
|
870
891
|
enableStickyHeader={enableStickyHeader}
|
|
@@ -879,7 +900,6 @@ export default <D extends Record<string, any> = {}>({
|
|
|
879
900
|
positionActionsColumn={positionActionsColumn}
|
|
880
901
|
positionGlobalFilter={positionGlobalFilter}
|
|
881
902
|
positionPagination={positionPagination}
|
|
882
|
-
positionToolbarActions={positionToolbarActions}
|
|
883
903
|
positionToolbarAlertBanner={positionToolbarAlertBanner}
|
|
884
904
|
rowNumberMode={rowNumberMode}
|
|
885
905
|
selectAllMode={selectAllMode}
|
|
@@ -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
|
|
@@ -79,16 +79,14 @@ export const MRT_SearchTextField: FC<Props> = ({ instance }) => {
|
|
|
79
79
|
startAdornment: (
|
|
80
80
|
<InputAdornment position="start">
|
|
81
81
|
<Tooltip arrow title={localization.changeSearchMode}>
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</IconButton>
|
|
91
|
-
</span>
|
|
82
|
+
<IconButton
|
|
83
|
+
aria-label={localization.changeSearchMode}
|
|
84
|
+
onClick={handleGlobalFilterMenuOpen}
|
|
85
|
+
size="small"
|
|
86
|
+
sx={{ height: '1.75rem', width: '1.75rem' }}
|
|
87
|
+
>
|
|
88
|
+
<SearchIcon />
|
|
89
|
+
</IconButton>
|
|
92
90
|
</Tooltip>
|
|
93
91
|
</InputAdornment>
|
|
94
92
|
),
|
|
@@ -107,7 +105,6 @@ export const MRT_SearchTextField: FC<Props> = ({ instance }) => {
|
|
|
107
105
|
),
|
|
108
106
|
}}
|
|
109
107
|
{...textFieldProps}
|
|
110
|
-
sx={{ justifySelf: 'end', ...textFieldProps?.sx }}
|
|
111
108
|
/>
|
|
112
109
|
<MRT_FilterOptionMenu
|
|
113
110
|
anchorEl={anchorEl}
|
|
@@ -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
|
|
@@ -2,6 +2,7 @@ import React, { FC, useMemo } from 'react';
|
|
|
2
2
|
import { Button, Menu, Divider, Box } from '@mui/material';
|
|
3
3
|
import { MRT_ShowHideColumnsMenuItems } from './MRT_ShowHideColumnsMenuItems';
|
|
4
4
|
import type { MRT_Column, MRT_TableInstance } from '..';
|
|
5
|
+
import { getDefaultColumnOrderIds } from '../utils';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
anchorEl: HTMLElement | null;
|
|
@@ -88,7 +89,13 @@ export const MRT_ShowHideColumnsMenu: FC<Props> = ({
|
|
|
88
89
|
</Button>
|
|
89
90
|
)}
|
|
90
91
|
{!isSubMenu && enableColumnOrdering && (
|
|
91
|
-
<Button
|
|
92
|
+
<Button
|
|
93
|
+
onClick={() =>
|
|
94
|
+
instance.setColumnOrder(
|
|
95
|
+
getDefaultColumnOrderIds(instance.options as any),
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
>
|
|
92
99
|
{localization.resetOrder}
|
|
93
100
|
</Button>
|
|
94
101
|
)}
|