material-react-table 0.13.0 → 0.13.3
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 +55 -42
- package/dist/material-react-table.cjs.development.js +103 -80
- 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 +103 -80
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/utils.d.ts +5 -2
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +65 -39
- package/src/buttons/MRT_ExpandAllButton.tsx +8 -0
- package/src/buttons/MRT_ExpandButton.tsx +8 -0
- package/src/inputs/MRT_FilterTextField.tsx +4 -0
- 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_ToolbarInternalButtons.tsx +2 -2
- 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.13.
|
|
2
|
+
"version": "0.13.3",
|
|
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?: ({
|
|
@@ -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,23 @@ 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
|
-
| (({
|
|
517
|
+
| (({
|
|
518
|
+
instance,
|
|
519
|
+
}: {
|
|
520
|
+
instance: MRT_TableInstance<D>;
|
|
521
|
+
}) => TableFooterProps);
|
|
502
522
|
muiTableFooterRowProps?:
|
|
503
523
|
| TableRowProps
|
|
504
524
|
| (({
|
|
505
525
|
instance,
|
|
506
526
|
footerGroup,
|
|
507
527
|
}: {
|
|
508
|
-
instance: MRT_TableInstance
|
|
528
|
+
instance: MRT_TableInstance<D>;
|
|
509
529
|
footerGroup: MRT_HeaderGroup<D>;
|
|
510
530
|
}) => TableRowProps);
|
|
511
531
|
muiTableHeadCellColumnActionsButtonProps?:
|
|
@@ -514,7 +534,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
514
534
|
instance,
|
|
515
535
|
column,
|
|
516
536
|
}: {
|
|
517
|
-
instance: MRT_TableInstance
|
|
537
|
+
instance: MRT_TableInstance<D>;
|
|
518
538
|
column: MRT_Column<D>;
|
|
519
539
|
}) => IconButtonProps);
|
|
520
540
|
muiTableHeadCellFilterTextFieldProps?:
|
|
@@ -523,7 +543,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
523
543
|
instance,
|
|
524
544
|
column,
|
|
525
545
|
}: {
|
|
526
|
-
instance: MRT_TableInstance
|
|
546
|
+
instance: MRT_TableInstance<D>;
|
|
527
547
|
column: MRT_Column<D>;
|
|
528
548
|
}) => TextFieldProps);
|
|
529
549
|
muiTableHeadCellProps?:
|
|
@@ -532,19 +552,19 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
532
552
|
instance,
|
|
533
553
|
column,
|
|
534
554
|
}: {
|
|
535
|
-
instance: MRT_TableInstance
|
|
555
|
+
instance: MRT_TableInstance<D>;
|
|
536
556
|
column: MRT_Column<D>;
|
|
537
557
|
}) => TableCellProps);
|
|
538
558
|
muiTableHeadProps?:
|
|
539
559
|
| TableHeadProps
|
|
540
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableHeadProps);
|
|
560
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableHeadProps);
|
|
541
561
|
muiTableHeadRowProps?:
|
|
542
562
|
| TableRowProps
|
|
543
563
|
| (({
|
|
544
564
|
instance,
|
|
545
565
|
headerGroup,
|
|
546
566
|
}: {
|
|
547
|
-
instance: MRT_TableInstance
|
|
567
|
+
instance: MRT_TableInstance<D>;
|
|
548
568
|
headerGroup: MRT_HeaderGroup<D>;
|
|
549
569
|
}) => TableRowProps);
|
|
550
570
|
muiTablePaginationProps?:
|
|
@@ -552,23 +572,23 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
552
572
|
| (({
|
|
553
573
|
instance,
|
|
554
574
|
}: {
|
|
555
|
-
instance: MRT_TableInstance
|
|
575
|
+
instance: MRT_TableInstance<D>;
|
|
556
576
|
}) => Partial<TablePaginationProps>);
|
|
557
577
|
muiTablePaperProps?:
|
|
558
578
|
| PaperProps
|
|
559
|
-
| (({ instance }: { instance: MRT_TableInstance }) => PaperProps);
|
|
579
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => PaperProps);
|
|
560
580
|
muiTableProps?:
|
|
561
581
|
| TableProps
|
|
562
|
-
| (({ instance }: { instance: MRT_TableInstance }) => TableProps);
|
|
582
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => TableProps);
|
|
563
583
|
muiTableToolbarAlertBannerProps?:
|
|
564
584
|
| AlertProps
|
|
565
|
-
| (({ instance }: { instance: MRT_TableInstance }) => AlertProps);
|
|
585
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => AlertProps);
|
|
566
586
|
muiTableToolbarBottomProps?:
|
|
567
587
|
| ToolbarProps
|
|
568
|
-
| (({ instance }: { instance: MRT_TableInstance }) => ToolbarProps);
|
|
588
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => ToolbarProps);
|
|
569
589
|
muiTableToolbarTopProps?:
|
|
570
590
|
| ToolbarProps
|
|
571
|
-
| (({ instance }: { instance: MRT_TableInstance }) => ToolbarProps);
|
|
591
|
+
| (({ instance }: { instance: MRT_TableInstance<D> }) => ToolbarProps);
|
|
572
592
|
onCellClick?: ({
|
|
573
593
|
cell,
|
|
574
594
|
event,
|
|
@@ -600,19 +620,23 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
600
620
|
column,
|
|
601
621
|
event,
|
|
602
622
|
filterValue,
|
|
623
|
+
instance,
|
|
603
624
|
}: {
|
|
604
625
|
column: MRT_Column<D>;
|
|
605
626
|
event: ChangeEvent<HTMLInputElement>;
|
|
606
627
|
filterValue: any;
|
|
628
|
+
instance: MRT_TableInstance<D>;
|
|
607
629
|
}) => void;
|
|
608
630
|
onColumnFilterValueChangedDebounced?: ({
|
|
609
631
|
column,
|
|
610
632
|
event,
|
|
611
633
|
filterValue,
|
|
634
|
+
instance,
|
|
612
635
|
}: {
|
|
613
636
|
column: MRT_Column<D>;
|
|
614
637
|
event: ChangeEvent<HTMLInputElement>;
|
|
615
638
|
filterValue: any;
|
|
639
|
+
instance: MRT_TableInstance<D>;
|
|
616
640
|
}) => void;
|
|
617
641
|
onColumnVisibilityChanged?: ({
|
|
618
642
|
column,
|
|
@@ -808,7 +832,7 @@ export default <D extends Record<string, any> = {}>({
|
|
|
808
832
|
enableColumnFilters = true,
|
|
809
833
|
enableColumnOrdering = false,
|
|
810
834
|
enableColumnResizing = false,
|
|
811
|
-
|
|
835
|
+
enableDensityToggle = true,
|
|
812
836
|
enableExpandAll = true,
|
|
813
837
|
enableFilters = true,
|
|
814
838
|
enableFullScreenToggle = true,
|
|
@@ -818,6 +842,7 @@ export default <D extends Record<string, any> = {}>({
|
|
|
818
842
|
enableMultiRowSelection = true,
|
|
819
843
|
enablePagination = true,
|
|
820
844
|
enablePinning = false,
|
|
845
|
+
enableRowSelection = false,
|
|
821
846
|
enableSelectAll = true,
|
|
822
847
|
enableSorting = true,
|
|
823
848
|
enableStickyHeader = false,
|
|
@@ -830,8 +855,8 @@ export default <D extends Record<string, any> = {}>({
|
|
|
830
855
|
localization,
|
|
831
856
|
persistentStateMode = 'sessionStorage',
|
|
832
857
|
positionActionsColumn = 'first',
|
|
833
|
-
positionPagination = 'bottom',
|
|
834
858
|
positionGlobalFilter = 'right',
|
|
859
|
+
positionPagination = 'bottom',
|
|
835
860
|
positionToolbarActions = 'top',
|
|
836
861
|
positionToolbarAlertBanner = 'top',
|
|
837
862
|
rowNumberMode = 'original',
|
|
@@ -847,7 +872,7 @@ export default <D extends Record<string, any> = {}>({
|
|
|
847
872
|
enableColumnFilters={enableColumnFilters}
|
|
848
873
|
enableColumnOrdering={enableColumnOrdering}
|
|
849
874
|
enableColumnResizing={enableColumnResizing}
|
|
850
|
-
|
|
875
|
+
enableDensityToggle={enableDensityToggle}
|
|
851
876
|
enableExpandAll={enableExpandAll}
|
|
852
877
|
enableFilters={enableFilters}
|
|
853
878
|
enableFullScreenToggle={enableFullScreenToggle}
|
|
@@ -857,6 +882,7 @@ export default <D extends Record<string, any> = {}>({
|
|
|
857
882
|
enableMultiRowSelection={enableMultiRowSelection}
|
|
858
883
|
enablePagination={enablePagination}
|
|
859
884
|
enablePinning={enablePinning}
|
|
885
|
+
enableRowSelection={enableRowSelection}
|
|
860
886
|
enableSelectAll={enableSelectAll}
|
|
861
887
|
enableSorting={enableSorting}
|
|
862
888
|
enableStickyHeader={enableStickyHeader}
|
|
@@ -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
|
|
@@ -90,11 +90,13 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
90
90
|
column,
|
|
91
91
|
event,
|
|
92
92
|
filterValue: event.target.value,
|
|
93
|
+
instance,
|
|
93
94
|
});
|
|
94
95
|
columnDef.onColumnFilterValueChangedDebounced?.({
|
|
95
96
|
column,
|
|
96
97
|
event,
|
|
97
98
|
filterValue: event.target.value,
|
|
99
|
+
instance,
|
|
98
100
|
});
|
|
99
101
|
}, 200),
|
|
100
102
|
[],
|
|
@@ -107,11 +109,13 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
107
109
|
column,
|
|
108
110
|
event,
|
|
109
111
|
filterValue: event.target.value,
|
|
112
|
+
instance,
|
|
110
113
|
});
|
|
111
114
|
columnDef.onColumnFilterValueChanged?.({
|
|
112
115
|
column,
|
|
113
116
|
event,
|
|
114
117
|
filterValue: event.target.value,
|
|
118
|
+
instance,
|
|
115
119
|
});
|
|
116
120
|
};
|
|
117
121
|
|
|
@@ -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
|
)}
|