material-react-table 0.7.0-alpha.9 → 0.7.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.
Files changed (42) hide show
  1. package/README.md +3 -5
  2. package/dist/MaterialReactTable.d.ts +65 -46
  3. package/dist/buttons/{MRT_ToggleSearchButton.d.ts → MRT_ToggleGlobalFilterButton.d.ts} +1 -1
  4. package/dist/icons.d.ts +1 -0
  5. package/dist/localization.d.ts +4 -0
  6. package/dist/material-react-table.cjs.development.js +279 -187
  7. package/dist/material-react-table.cjs.development.js.map +1 -1
  8. package/dist/material-react-table.cjs.production.min.js +1 -1
  9. package/dist/material-react-table.cjs.production.min.js.map +1 -1
  10. package/dist/material-react-table.esm.js +282 -190
  11. package/dist/material-react-table.esm.js.map +1 -1
  12. package/dist/menus/MRT_ShowHideColumnsMenuItems.d.ts +2 -2
  13. package/dist/utils.d.ts +5 -5
  14. package/package.json +5 -5
  15. package/src/MaterialReactTable.tsx +107 -57
  16. package/src/body/MRT_TableBodyCell.tsx +5 -2
  17. package/src/buttons/MRT_EditActionButtons.tsx +1 -1
  18. package/src/buttons/MRT_FullScreenToggleButton.tsx +13 -4
  19. package/src/buttons/MRT_ShowHideColumnsButton.tsx +0 -1
  20. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +13 -4
  21. package/src/buttons/MRT_ToggleFiltersButton.tsx +13 -4
  22. package/src/buttons/{MRT_ToggleSearchButton.tsx → MRT_ToggleGlobalFilterButton.tsx} +14 -8
  23. package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +1 -1
  24. package/src/footer/MRT_TableFooterCell.tsx +3 -0
  25. package/src/head/MRT_TableHeadCell.tsx +60 -62
  26. package/src/head/MRT_TableHeadRow.tsx +12 -3
  27. package/src/icons.ts +3 -0
  28. package/src/inputs/MRT_EditCellTextField.tsx +2 -5
  29. package/src/inputs/MRT_FilterTextField.tsx +2 -2
  30. package/src/inputs/MRT_SearchTextField.tsx +6 -6
  31. package/src/localization.ts +8 -0
  32. package/src/menus/MRT_ColumnActionMenu.tsx +29 -7
  33. package/src/menus/MRT_FilterTypeMenu.tsx +5 -8
  34. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +7 -7
  35. package/src/table/MRT_Table.tsx +5 -5
  36. package/src/table/MRT_TableContainer.tsx +6 -7
  37. package/src/table/MRT_TablePaper.tsx +9 -13
  38. package/src/table/MRT_TableRoot.tsx +97 -83
  39. package/src/toolbar/MRT_ToolbarBottom.tsx +2 -2
  40. package/src/toolbar/MRT_ToolbarInternalButtons.tsx +8 -9
  41. package/src/toolbar/MRT_ToolbarTop.tsx +2 -2
  42. package/src/utils.ts +15 -11
@@ -1,7 +1,7 @@
1
1
  import { FC } from 'react';
2
- import type { MRT_ColumnInstance, MRT_TableInstance } from '..';
2
+ import type { MRT_Column, MRT_TableInstance } from '..';
3
3
  interface Props {
4
- column: MRT_ColumnInstance;
4
+ column: MRT_Column;
5
5
  isSubMenu?: boolean;
6
6
  tableInstance: MRT_TableInstance;
7
7
  }
package/dist/utils.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { ColumnDef, Table } from '@tanstack/react-table';
2
- import { MRT_ColumnInterface, MRT_FilterType } from '.';
3
- export declare const getAllLeafColumnDefs: (columns: MRT_ColumnInterface[]) => MRT_ColumnInterface[];
4
- export declare const createGroup: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnInterface<D>, currentFilterTypes: {
2
+ import { MRT_ColumnDef, MRT_FilterType } from '.';
3
+ export declare const getAllLeafColumnDefs: (columns: MRT_ColumnDef[]) => MRT_ColumnDef[];
4
+ export declare const createGroup: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnDef<D>, currentFilterTypes: {
5
5
  [key: string]: MRT_FilterType;
6
6
  }) => ColumnDef<D>;
7
- export declare const createDataColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnInterface<D>, currentFilterTypes: {
7
+ export declare const createDataColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnDef<D>, currentFilterTypes: {
8
8
  [key: string]: MRT_FilterType;
9
9
  }) => ColumnDef<D>;
10
- export declare const createDisplayColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: Pick<MRT_ColumnInterface<D>, "footer" | "columns" | "id" | "accessorKey" | "accessorFn" | "cell" | "meta" | "enableHiding" | "defaultCanHide" | "defaultIsVisible" | "enablePinning" | "defaultCanPin" | "filterType" | "enableAllFilters" | "enableColumnFilter" | "enableGlobalFilter" | "defaultCanFilter" | "defaultCanColumnFilter" | "defaultCanGlobalFilter" | "sortType" | "sortDescFirst" | "enableSorting" | "enableMultiSort" | "defaultCanSort" | "invertSorting" | "sortUndefined" | "aggregationType" | "aggregateValue" | "aggregatedCell" | "enableGrouping" | "defaultCanGroup" | "enableResizing" | "defaultCanResize" | "width" | "minWidth" | "maxWidth" | "Edit" | "Filter" | "Footer" | "Header" | "Cell" | "enableClickToCopy" | "enableColumnActions" | "enableEditing" | "enabledFilterTypes" | "filter" | "filterSelectOptions" | "muiTableBodyCellCopyButtonProps" | "muiTableBodyCellEditTextFieldProps" | "muiTableBodyCellProps" | "muiTableFooterCellProps" | "muiTableHeadCellColumnActionsButtonProps" | "muiTableHeadCellFilterTextFieldProps" | "muiTableHeadCellProps" | "onCellEditChange" | "onColumnFilterValueChange"> & {
10
+ export declare const createDisplayColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: Pick<MRT_ColumnDef<D>, "footer" | "columns" | "id" | "accessorKey" | "accessorFn" | "cell" | "meta" | "enableHiding" | "defaultCanHide" | "defaultIsVisible" | "enablePinning" | "defaultCanPin" | "filterFn" | "enableAllFilters" | "enableColumnFilter" | "enableGlobalFilter" | "defaultCanFilter" | "defaultCanColumnFilter" | "defaultCanGlobalFilter" | "sortingFn" | "sortDescFirst" | "enableSorting" | "enableMultiSort" | "defaultCanSort" | "invertSorting" | "sortUndefined" | "aggregationFn" | "aggregateValue" | "aggregatedCell" | "enableGrouping" | "defaultCanGroup" | "enableResizing" | "defaultCanResize" | "width" | "minWidth" | "maxWidth" | "Edit" | "Filter" | "Footer" | "Header" | "Cell" | "enableClickToCopy" | "enableColumnActions" | "enableEditing" | "enabledColumnFilterTypes" | "filter" | "filterSelectOptions" | "muiTableBodyCellCopyButtonProps" | "muiTableBodyCellEditTextFieldProps" | "muiTableBodyCellProps" | "muiTableFooterCellProps" | "muiTableHeadCellColumnActionsButtonProps" | "muiTableHeadCellFilterTextFieldProps" | "muiTableHeadCellProps" | "onCellEditBlur" | "onCellEditChange" | "onColumnFilterValueChange"> & {
11
11
  header?: string | undefined;
12
12
  }) => ColumnDef<D>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.0-alpha.9",
2
+ "version": "0.7.2",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI implementation of react-table, inspired by material-table and the MUI X DataGrid, written from the ground up in TypeScript.",
@@ -60,8 +60,8 @@
60
60
  "@emotion/styled": "^11.8.1",
61
61
  "@etchteam/storybook-addon-status": "^4.2.1",
62
62
  "@faker-js/faker": "^6.1.2",
63
- "@mui/icons-material": "^5.6.1",
64
- "@mui/material": "^5.6.1",
63
+ "@mui/icons-material": "^5.6.2",
64
+ "@mui/material": "^5.6.2",
65
65
  "@size-limit/preset-small-lib": "^7.0.8",
66
66
  "@storybook/addon-a11y": "^6.4.22",
67
67
  "@storybook/addon-actions": "^6.4.22",
@@ -74,7 +74,7 @@
74
74
  "@storybook/react": "^6.4.22",
75
75
  "@types/react": "^17.0.41",
76
76
  "@types/react-dom": "^17.0.14",
77
- "babel-loader": "^8.2.4",
77
+ "babel-loader": "^8.2.5",
78
78
  "eslint": "^8.13.0",
79
79
  "eslint-plugin-react-hooks": "^4.4.0",
80
80
  "husky": "^7.0.4",
@@ -97,7 +97,7 @@
97
97
  "react": ">=16.8"
98
98
  },
99
99
  "dependencies": {
100
- "@tanstack/react-table": "^8.0.0-alpha.28",
100
+ "@tanstack/react-table": "^8.0.0-alpha.45",
101
101
  "match-sorter": "^6.3.1"
102
102
  }
103
103
  }
@@ -47,18 +47,13 @@ import { MRT_Default_Icons, MRT_Icons } from './icons';
47
47
  import { MRT_FILTER_TYPE } from './enums';
48
48
  import { MRT_TableRoot } from './table/MRT_TableRoot';
49
49
 
50
- //@ts-ignore
51
- global.performance = global.performance || {
52
- now: () => new Date().getTime(),
53
- };
54
-
55
50
  export type MRT_TableOptions<D extends Record<string, any> = {}> = Partial<
56
51
  Omit<
57
52
  Options<D>,
58
53
  'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn'
59
54
  >
60
55
  > & {
61
- columns: MRT_ColumnInterface<D>[];
56
+ columns: MRT_ColumnDef<D>[];
62
57
  data: D[];
63
58
  initialState?: Partial<MRT_TableState<D>>;
64
59
  state?: Partial<MRT_TableState<D>>;
@@ -90,8 +85,8 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
90
85
  | 'getState'
91
86
  | 'options'
92
87
  > & {
93
- getAllColumns: () => MRT_ColumnInstance<D>[];
94
- getAllLeafColumns: () => MRT_ColumnInstance<D>[];
88
+ getAllColumns: () => MRT_Column<D>[];
89
+ getAllLeafColumns: () => MRT_Column<D>[];
95
90
  getExpandedRowModel: () => MRT_RowModel<D>;
96
91
  getPaginationRowModel: () => MRT_RowModel<D>;
97
92
  getPrePaginationRowModel: () => MRT_RowModel<D>;
@@ -103,18 +98,18 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
103
98
  idPrefix: string;
104
99
  filterTypes: { [key in MRT_FILTER_TYPE]: any };
105
100
  localization: MRT_Localization;
106
- setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row<D> | null>>;
107
- setCurrentFilterTypes: Dispatch<
108
- SetStateAction<{
109
- [key: string]: MRT_FilterType;
110
- }>
111
- >;
112
- setCurrentGlobalFilterType: Dispatch<SetStateAction<MRT_FILTER_TYPE>>;
113
- setIsDensePadding: Dispatch<SetStateAction<boolean>>;
114
- setIsFullScreen: Dispatch<SetStateAction<boolean>>;
115
- setShowFilters: Dispatch<SetStateAction<boolean>>;
116
- setShowSearch: Dispatch<SetStateAction<boolean>>;
117
101
  };
102
+ setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row<D> | null>>;
103
+ setCurrentFilterTypes: Dispatch<
104
+ SetStateAction<{
105
+ [key: string]: MRT_FilterType;
106
+ }>
107
+ >;
108
+ setCurrentGlobalFilterType: Dispatch<SetStateAction<MRT_FILTER_TYPE>>;
109
+ setIsDensePadding: Dispatch<SetStateAction<boolean>>;
110
+ setIsFullScreen: Dispatch<SetStateAction<boolean>>;
111
+ setShowFilters: Dispatch<SetStateAction<boolean>>;
112
+ setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
118
113
  };
119
114
 
120
115
  export type MRT_TableState<D extends Record<string, any> = {}> = Omit<
@@ -127,11 +122,11 @@ export type MRT_TableState<D extends Record<string, any> = {}> = Omit<
127
122
  isDensePadding: boolean;
128
123
  isFullScreen: boolean;
129
124
  showFilters: boolean;
130
- showSearch: boolean;
125
+ showGlobalFilter: boolean;
131
126
  pagination: Partial<PaginationState>;
132
127
  };
133
128
 
134
- export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
129
+ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
135
130
  ColumnDef<D>,
136
131
  'header' | 'footer' | 'columns'
137
132
  > & {
@@ -175,11 +170,11 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
175
170
  tableInstance: MRT_TableInstance<D>;
176
171
  }) => ReactNode;
177
172
  id: keyof D | string;
178
- columns?: MRT_ColumnInterface<D>[];
173
+ columns?: MRT_ColumnDef<D>[];
179
174
  enableClickToCopy?: boolean;
180
175
  enableColumnActions?: boolean;
181
176
  enableEditing?: boolean;
182
- enabledFilterTypes?: (MRT_FILTER_TYPE | string)[];
177
+ enabledColumnFilterTypes?: (MRT_FILTER_TYPE | string)[];
183
178
  filter?: MRT_FilterType | string | FilterType<D>;
184
179
  filterSelectOptions?: (string | { text: string; value: string })[];
185
180
  footer?: string;
@@ -218,7 +213,7 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
218
213
  column,
219
214
  }: {
220
215
  tableInstance: MRT_TableInstance;
221
- column: MRT_ColumnInstance<D>;
216
+ column: MRT_Column<D>;
222
217
  }) => TableCellProps);
223
218
  muiTableHeadCellColumnActionsButtonProps?:
224
219
  | IconButtonProps
@@ -227,7 +222,7 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
227
222
  column,
228
223
  }: {
229
224
  tableInstance: MRT_TableInstance;
230
- column: MRT_ColumnInstance<D>;
225
+ column: MRT_Column<D>;
231
226
  }) => IconButtonProps);
232
227
  muiTableHeadCellFilterTextFieldProps?:
233
228
  | TextFieldProps
@@ -236,7 +231,7 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
236
231
  column,
237
232
  }: {
238
233
  tableInstance: MRT_TableInstance;
239
- column: MRT_ColumnInstance<D>;
234
+ column: MRT_Column<D>;
240
235
  }) => TextFieldProps);
241
236
  muiTableHeadCellProps?:
242
237
  | TableCellProps
@@ -245,7 +240,7 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
245
240
  column,
246
241
  }: {
247
242
  tableInstance: MRT_TableInstance;
248
- column: MRT_ColumnInstance<D>;
243
+ column: MRT_Column<D>;
249
244
  }) => TableCellProps);
250
245
  onCellEditBlur?: ({
251
246
  cell,
@@ -274,19 +269,19 @@ export type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<
274
269
  }) => void;
275
270
  };
276
271
 
277
- export type MRT_ColumnInstance<D extends Record<string, any> = {}> = Omit<
272
+ export type MRT_Column<D extends Record<string, any> = {}> = Omit<
278
273
  Column<D>,
279
274
  'header' | 'footer' | 'columns'
280
275
  > &
281
- MRT_ColumnInterface<D> & {
282
- columns?: MRT_ColumnInstance<D>[];
276
+ MRT_ColumnDef<D> & {
277
+ columns?: MRT_Column<D>[];
283
278
  };
284
279
 
285
280
  export type MRT_Header<D extends Record<string, any> = {}> = Omit<
286
281
  Header<D>,
287
282
  'column'
288
283
  > & {
289
- column: MRT_ColumnInstance<D>;
284
+ column: MRT_Column<D>;
290
285
  };
291
286
 
292
287
  export type MRT_HeaderGroup<D extends Record<string, any> = {}> = Omit<
@@ -319,7 +314,7 @@ export type MRT_Cell<D extends Record<string, any> = {}> = Omit<
319
314
  Cell<D>,
320
315
  'column' | 'row'
321
316
  > & {
322
- column: MRT_ColumnInstance<D>;
317
+ column: MRT_Column<D>;
323
318
  row: MRT_Row<D>;
324
319
  };
325
320
 
@@ -329,27 +324,26 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
329
324
  MRT_TableOptions<D> & {
330
325
  enableClickToCopy?: boolean;
331
326
  enableColumnActions?: boolean;
332
- enableColumnPinning?: boolean;
333
327
  enableDensePaddingToggle?: boolean;
328
+ enableEditing?: boolean;
334
329
  enableExpandAll?: boolean;
335
330
  enableFullScreenToggle?: boolean;
336
331
  enablePagination?: boolean;
337
332
  enableRowActions?: boolean;
338
- enableStickyHeader?: boolean;
339
- enableEditing?: boolean;
340
333
  enableRowNumbers?: boolean;
341
334
  enableSelectAll?: boolean;
335
+ enableStickyHeader?: boolean;
336
+ enableTableFooter?: boolean;
337
+ enableTableHead?: boolean;
338
+ enableToolbarBottom?: boolean;
339
+ enableToolbarInternalActions?: boolean;
340
+ enableToolbarTop?: boolean;
342
341
  enabledGlobalFilterTypes?: (MRT_FILTER_TYPE | string)[];
343
342
  filterTypes?: { [key in MRT_FILTER_TYPE]: any };
344
- hideTableFooter?: boolean;
345
- hideTableHead?: boolean;
346
- hideToolbarBottom?: boolean;
347
- hideToolbarInternalActions?: boolean;
348
- hideToolbarTop?: boolean;
349
343
  icons?: Partial<MRT_Icons>;
350
344
  idPrefix?: string;
351
- isReloading?: boolean;
352
345
  isLoading?: boolean;
346
+ isReloading?: boolean;
353
347
  localization?: Partial<MRT_Localization>;
354
348
  muiLinearProgressProps?:
355
349
  | LinearProgressProps
@@ -451,7 +445,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
451
445
  column,
452
446
  }: {
453
447
  tableInstance: MRT_TableInstance;
454
- column: MRT_ColumnInstance<D>;
448
+ column: MRT_Column<D>;
455
449
  }) => TableCellProps);
456
450
  muiTableFooterProps?:
457
451
  | TableFooterProps
@@ -476,7 +470,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
476
470
  column,
477
471
  }: {
478
472
  tableInstance: MRT_TableInstance;
479
- column: MRT_ColumnInstance<D>;
473
+ column: MRT_Column<D>;
480
474
  }) => IconButtonProps);
481
475
  muiTableHeadCellFilterTextFieldProps?:
482
476
  | TextFieldProps
@@ -485,7 +479,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
485
479
  column,
486
480
  }: {
487
481
  tableInstance: MRT_TableInstance;
488
- column: MRT_ColumnInstance<D>;
482
+ column: MRT_Column<D>;
489
483
  }) => TextFieldProps);
490
484
  muiTableHeadCellProps?:
491
485
  | TableCellProps
@@ -494,7 +488,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
494
488
  column,
495
489
  }: {
496
490
  tableInstance: MRT_TableInstance;
497
- column: MRT_ColumnInstance<D>;
491
+ column: MRT_Column<D>;
498
492
  }) => TableCellProps);
499
493
  muiTableHeadProps?:
500
494
  | TableHeadProps
@@ -563,15 +557,6 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
563
557
  tableInstance: MRT_TableInstance<D>;
564
558
  event: MouseEvent<HTMLTableCellElement>;
565
559
  }) => void;
566
- onColumnHide?: ({
567
- column,
568
- columnVisibility,
569
- tableInstance,
570
- }: {
571
- column: MRT_ColumnInstance<D>;
572
- columnVisibility: VisibilityState;
573
- tableInstance: MRT_TableInstance<D>;
574
- }) => void;
575
560
  onDetailPanelClick?: ({
576
561
  event,
577
562
  row,
@@ -581,7 +566,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
581
566
  row: MRT_Row<D>;
582
567
  tableInstance: MRT_TableInstance<D>;
583
568
  }) => void;
584
- onGlobalFilterChange?: ({
569
+ onGlobalSearchFilterChange?: ({
585
570
  event,
586
571
  tableInstance,
587
572
  }: {
@@ -632,6 +617,51 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
632
617
  selectedRows: MRT_Row<D>[];
633
618
  tableInstance: MRT_TableInstance<D>;
634
619
  }) => void;
620
+ onToggleColumnVisibility?: ({
621
+ column,
622
+ columnVisibility,
623
+ tableInstance,
624
+ }: {
625
+ column: MRT_Column<D>;
626
+ columnVisibility: VisibilityState;
627
+ tableInstance: MRT_TableInstance<D>;
628
+ }) => void;
629
+ onToggleDensePadding?: ({
630
+ event,
631
+ isDensePadding,
632
+ tableInstance,
633
+ }: {
634
+ event: MouseEvent<HTMLButtonElement>;
635
+ isDensePadding: boolean;
636
+ tableInstance: MRT_TableInstance<D>;
637
+ }) => void;
638
+ onToggleFullScreen?: ({
639
+ event,
640
+ isFullScreen,
641
+ tableInstance,
642
+ }: {
643
+ event: MouseEvent<HTMLButtonElement>;
644
+ isFullScreen: boolean;
645
+ tableInstance: MRT_TableInstance<D>;
646
+ }) => void;
647
+ onToggleShowFilters?: ({
648
+ event,
649
+ showFilters,
650
+ tableInstance,
651
+ }: {
652
+ event: MouseEvent<HTMLButtonElement>;
653
+ showFilters: boolean;
654
+ tableInstance: MRT_TableInstance<D>;
655
+ }) => void;
656
+ onToggleShowGlobalFilter?: ({
657
+ event,
658
+ showGlobalFilter,
659
+ tableInstance,
660
+ }: {
661
+ event: MouseEvent<HTMLButtonElement>;
662
+ showGlobalFilter: boolean;
663
+ tableInstance: MRT_TableInstance<D>;
664
+ }) => void;
635
665
  positionActionsColumn?: 'first' | 'last';
636
666
  positionPagination?: 'bottom' | 'top' | 'both';
637
667
  positionToolbarActions?: 'bottom' | 'top';
@@ -666,14 +696,14 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
666
696
  }) => ReactNode;
667
697
  renderToolbarInternalActions?: ({
668
698
  tableInstance,
669
- MRT_ToggleSearchButton,
699
+ MRT_ToggleGlobalFilterButton,
670
700
  MRT_ToggleFiltersButton,
671
701
  MRT_ShowHideColumnsButton,
672
702
  MRT_ToggleDensePaddingButton,
673
703
  MRT_FullScreenToggleButton,
674
704
  }: {
675
705
  tableInstance: MRT_TableInstance<D>;
676
- MRT_ToggleSearchButton: FC<
706
+ MRT_ToggleGlobalFilterButton: FC<
677
707
  IconButtonProps & { tableInstance: MRT_TableInstance<D> }
678
708
  >;
679
709
  MRT_ToggleFiltersButton: FC<
@@ -692,17 +722,27 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
692
722
  };
693
723
 
694
724
  export default <D extends Record<string, any> = {}>({
725
+ autoResetExpanded = false,
726
+ columnResizeMode = 'onEnd',
695
727
  enableColumnActions = true,
696
728
  enableColumnFilters = true,
729
+ enableColumnResizing = false,
697
730
  enableDensePaddingToggle = true,
698
731
  enableExpandAll = true,
732
+ enableFilters = true,
699
733
  enableFullScreenToggle = true,
700
734
  enableGlobalFilter = true,
701
735
  enableHiding = true,
736
+ enableMultiRowSelection = true,
702
737
  enablePagination = true,
703
738
  enableSelectAll = true,
704
739
  enableSorting = true,
705
740
  enableStickyHeader = true,
741
+ enableTableFooter = true,
742
+ enableTableHead = true,
743
+ enableToolbarBottom = true,
744
+ enableToolbarInternalActions = true,
745
+ enableToolbarTop = true,
706
746
  icons,
707
747
  localization,
708
748
  positionActionsColumn = 'first',
@@ -712,17 +752,27 @@ export default <D extends Record<string, any> = {}>({
712
752
  ...rest
713
753
  }: MaterialReactTableProps<D>) => (
714
754
  <MRT_TableRoot
755
+ autoResetExpanded={autoResetExpanded}
756
+ columnResizeMode={columnResizeMode}
715
757
  enableColumnActions={enableColumnActions}
758
+ enableColumnResizing={enableColumnResizing}
716
759
  enableColumnFilters={enableColumnFilters}
717
760
  enableDensePaddingToggle={enableDensePaddingToggle}
718
761
  enableExpandAll={enableExpandAll}
762
+ enableFilters={enableFilters}
719
763
  enableFullScreenToggle={enableFullScreenToggle}
720
764
  enableGlobalFilter={enableGlobalFilter}
721
765
  enableHiding={enableHiding}
766
+ enableMultiRowSelection={enableMultiRowSelection}
722
767
  enablePagination={enablePagination}
723
768
  enableSelectAll={enableSelectAll}
724
769
  enableSorting={enableSorting}
725
770
  enableStickyHeader={enableStickyHeader}
771
+ enableTableFooter={enableTableFooter}
772
+ enableTableHead={enableTableHead}
773
+ enableToolbarBottom={enableToolbarBottom}
774
+ enableToolbarInternalActions={enableToolbarInternalActions}
775
+ enableToolbarTop={enableToolbarTop}
726
776
  icons={{ ...MRT_Default_Icons, ...icons }}
727
777
  localization={{ ...MRT_DefaultLocalization_EN, ...localization }}
728
778
  positionActionsColumn={positionActionsColumn}
@@ -15,7 +15,7 @@ export const MRT_TableBodyCell: FC<Props> = ({ cell, tableInstance }) => {
15
15
  getState,
16
16
  options: {
17
17
  enableClickToCopy,
18
- enableColumnPinning,
18
+ enablePinning,
19
19
  enableEditing,
20
20
  isLoading,
21
21
  muiTableBodyCellProps,
@@ -60,6 +60,8 @@ export const MRT_TableBodyCell: FC<Props> = ({ cell, tableInstance }) => {
60
60
  }
61
61
  {...tableCellProps}
62
62
  sx={{
63
+ maxWidth: `min(${column.getWidth()}px, fit-content)`,
64
+ minWidth: `max(${column.getWidth()}px, ${column.minWidth}px)`,
63
65
  p: isDensePadding
64
66
  ? column.columnDefType === 'display'
65
67
  ? '0 0.5rem'
@@ -73,9 +75,10 @@ export const MRT_TableBodyCell: FC<Props> = ({ cell, tableInstance }) => {
73
75
  : undefined,
74
76
  transition: 'all 0.2s ease-in-out',
75
77
  whiteSpace:
76
- isDensePadding || (enableColumnPinning && getIsSomeColumnsPinned())
78
+ isDensePadding || (enablePinning && getIsSomeColumnsPinned())
77
79
  ? 'nowrap'
78
80
  : 'normal',
81
+ width: column.getWidth(),
79
82
  //@ts-ignore
80
83
  ...tableCellProps?.sx,
81
84
  }}
@@ -15,8 +15,8 @@ export const MRT_EditActionButtons: FC<Props> = ({ row, tableInstance }) => {
15
15
  icons: { CancelIcon, SaveIcon },
16
16
  localization,
17
17
  onEditSubmit,
18
- setCurrentEditingRow,
19
18
  },
19
+ setCurrentEditingRow,
20
20
  } = tableInstance;
21
21
 
22
22
  const { currentEditingRow } = getState();
@@ -1,4 +1,4 @@
1
- import React, { FC } from 'react';
1
+ import React, { FC, MouseEvent } from 'react';
2
2
  import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
@@ -15,18 +15,27 @@ export const MRT_FullScreenToggleButton: FC<Props> = ({
15
15
  options: {
16
16
  icons: { FullscreenExitIcon, FullscreenIcon },
17
17
  localization,
18
- setIsFullScreen,
18
+ onToggleFullScreen,
19
19
  },
20
+ setIsFullScreen,
20
21
  } = tableInstance;
21
22
 
22
23
  const { isFullScreen } = getState();
23
24
 
25
+ const handleToggleFullScreen = (event: MouseEvent<HTMLButtonElement>) => {
26
+ onToggleFullScreen?.({
27
+ event,
28
+ isFullScreen: !isFullScreen,
29
+ tableInstance,
30
+ });
31
+ setIsFullScreen(!isFullScreen);
32
+ };
33
+
24
34
  return (
25
35
  <Tooltip arrow title={localization.toggleFullScreen}>
26
36
  <IconButton
27
37
  aria-label={localization.showHideFilters}
28
- onClick={() => setIsFullScreen(!isFullScreen)}
29
- size="small"
38
+ onClick={handleToggleFullScreen}
30
39
  {...rest}
31
40
  >
32
41
  {isFullScreen ? <FullscreenExitIcon /> : <FullscreenIcon />}
@@ -30,7 +30,6 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({
30
30
  <IconButton
31
31
  aria-label={localization.showHideColumns}
32
32
  onClick={handleClick}
33
- size="small"
34
33
  {...rest}
35
34
  >
36
35
  <ViewColumnIcon />
@@ -1,4 +1,4 @@
1
- import React, { FC } from 'react';
1
+ import React, { FC, MouseEvent } from 'react';
2
2
  import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
@@ -15,18 +15,27 @@ export const MRT_ToggleDensePaddingButton: FC<Props> = ({
15
15
  options: {
16
16
  icons: { DensityMediumIcon, DensitySmallIcon },
17
17
  localization,
18
- setIsDensePadding,
18
+ onToggleDensePadding,
19
19
  },
20
+ setIsDensePadding,
20
21
  } = tableInstance;
21
22
 
22
23
  const { isDensePadding } = getState();
23
24
 
25
+ const handleToggleDensePadding = (event: MouseEvent<HTMLButtonElement>) => {
26
+ onToggleDensePadding?.({
27
+ event,
28
+ isDensePadding: !isDensePadding,
29
+ tableInstance,
30
+ });
31
+ setIsDensePadding(!isDensePadding);
32
+ };
33
+
24
34
  return (
25
35
  <Tooltip arrow title={localization.toggleDensePadding}>
26
36
  <IconButton
27
37
  aria-label={localization.toggleDensePadding}
28
- onClick={() => setIsDensePadding(!isDensePadding)}
29
- size="small"
38
+ onClick={handleToggleDensePadding}
30
39
  {...rest}
31
40
  >
32
41
  {isDensePadding ? <DensitySmallIcon /> : <DensityMediumIcon />}
@@ -1,4 +1,4 @@
1
- import React, { FC } from 'react';
1
+ import React, { FC, MouseEvent } from 'react';
2
2
  import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
@@ -15,18 +15,27 @@ export const MRT_ToggleFiltersButton: FC<Props> = ({
15
15
  options: {
16
16
  icons: { FilterListIcon, FilterListOffIcon },
17
17
  localization,
18
- setShowFilters,
18
+ onToggleShowFilters,
19
19
  },
20
+ setShowFilters,
20
21
  } = tableInstance;
21
22
 
22
23
  const { showFilters } = getState();
23
24
 
25
+ const handleToggleShowFilters = (event: MouseEvent<HTMLButtonElement>) => {
26
+ onToggleShowFilters?.({
27
+ event,
28
+ showFilters: !showFilters,
29
+ tableInstance,
30
+ });
31
+ setShowFilters(!showFilters);
32
+ };
33
+
24
34
  return (
25
35
  <Tooltip arrow title={localization.showHideFilters}>
26
36
  <IconButton
27
37
  aria-label={localization.showHideFilters}
28
- onClick={() => setShowFilters(!showFilters)}
29
- size="small"
38
+ onClick={handleToggleShowFilters}
30
39
  {...rest}
31
40
  >
32
41
  {showFilters ? <FilterListOffIcon /> : <FilterListIcon />}
@@ -1,4 +1,4 @@
1
- import React, { FC } from 'react';
1
+ import React, { FC, MouseEvent } from 'react';
2
2
  import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
@@ -6,7 +6,7 @@ interface Props extends IconButtonProps {
6
6
  tableInstance: MRT_TableInstance;
7
7
  }
8
8
 
9
- export const MRT_ToggleSearchButton: FC<Props> = ({
9
+ export const MRT_ToggleGlobalFilterButton: FC<Props> = ({
10
10
  tableInstance,
11
11
  ...rest
12
12
  }) => {
@@ -17,19 +17,25 @@ export const MRT_ToggleSearchButton: FC<Props> = ({
17
17
  idPrefix,
18
18
  localization,
19
19
  muiSearchTextFieldProps,
20
- setShowSearch,
20
+ onToggleShowGlobalFilter,
21
21
  },
22
+ setShowGlobalFilter,
22
23
  } = tableInstance;
23
24
 
24
- const { showSearch } = getState();
25
+ const { showGlobalFilter } = getState();
25
26
 
26
27
  const textFieldProps =
27
28
  muiSearchTextFieldProps instanceof Function
28
29
  ? muiSearchTextFieldProps({ tableInstance })
29
30
  : muiSearchTextFieldProps;
30
31
 
31
- const handleToggleSearch = () => {
32
- setShowSearch(!showSearch);
32
+ const handleToggleSearch = (event: MouseEvent<HTMLButtonElement>) => {
33
+ onToggleShowGlobalFilter?.({
34
+ event,
35
+ showGlobalFilter: !showGlobalFilter,
36
+ tableInstance,
37
+ });
38
+ setShowGlobalFilter(!showGlobalFilter);
33
39
  setTimeout(
34
40
  () =>
35
41
  document
@@ -43,8 +49,8 @@ export const MRT_ToggleSearchButton: FC<Props> = ({
43
49
 
44
50
  return (
45
51
  <Tooltip arrow title={localization.showHideSearch}>
46
- <IconButton size="small" onClick={handleToggleSearch} {...rest}>
47
- {showSearch ? <SearchOffIcon /> : <SearchIcon />}
52
+ <IconButton onClick={handleToggleSearch} {...rest}>
53
+ {showGlobalFilter ? <SearchOffIcon /> : <SearchIcon />}
48
54
  </IconButton>
49
55
  </Tooltip>
50
56
  );
@@ -32,8 +32,8 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({
32
32
  localization,
33
33
  renderRowActionMenuItems,
34
34
  renderRowActions,
35
- setCurrentEditingRow,
36
35
  },
36
+ setCurrentEditingRow,
37
37
  } = tableInstance;
38
38
 
39
39
  const { currentEditingRow } = getState();