material-react-table 0.18.1 → 0.20.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.
Files changed (110) hide show
  1. package/dist/MaterialReactTable.d.ts +170 -135
  2. package/dist/body/MRT_TableBody.d.ts +1 -1
  3. package/dist/body/MRT_TableBodyCell.d.ts +1 -1
  4. package/dist/body/MRT_TableBodyRow.d.ts +1 -1
  5. package/dist/body/MRT_TableDetailPanel.d.ts +1 -1
  6. package/dist/buttons/MRT_ColumnPinningButtons.d.ts +1 -1
  7. package/dist/buttons/MRT_CopyButton.d.ts +1 -1
  8. package/dist/buttons/MRT_EditActionButtons.d.ts +1 -1
  9. package/dist/buttons/MRT_ExpandAllButton.d.ts +1 -1
  10. package/dist/buttons/MRT_ExpandButton.d.ts +1 -1
  11. package/dist/buttons/MRT_FullScreenToggleButton.d.ts +1 -1
  12. package/dist/buttons/MRT_GrabHandleButton.d.ts +1 -1
  13. package/dist/buttons/MRT_ShowHideColumnsButton.d.ts +1 -1
  14. package/dist/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -1
  15. package/dist/buttons/MRT_ToggleFiltersButton.d.ts +1 -1
  16. package/dist/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -1
  17. package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +1 -1
  18. package/dist/filtersFns.d.ts +31 -23
  19. package/dist/footer/MRT_TableFooter.d.ts +1 -1
  20. package/dist/footer/MRT_TableFooterCell.d.ts +1 -1
  21. package/dist/footer/MRT_TableFooterRow.d.ts +1 -1
  22. package/dist/head/MRT_DraggableTableHeadCell.d.ts +1 -1
  23. package/dist/head/MRT_TableHead.d.ts +1 -1
  24. package/dist/head/MRT_TableHeadCell.d.ts +1 -1
  25. package/dist/head/MRT_TableHeadCellColumnActionsButton.d.ts +1 -1
  26. package/dist/head/MRT_TableHeadCellFilterContainer.d.ts +1 -1
  27. package/dist/head/MRT_TableHeadCellFilterLabel.d.ts +1 -1
  28. package/dist/head/MRT_TableHeadCellResizeHandle.d.ts +1 -1
  29. package/dist/head/MRT_TableHeadCellSortLabel.d.ts +1 -1
  30. package/dist/head/MRT_TableHeadRow.d.ts +1 -1
  31. package/dist/inputs/MRT_EditCellTextField.d.ts +1 -1
  32. package/dist/inputs/MRT_FilterRangeFields.d.ts +1 -1
  33. package/dist/inputs/MRT_FilterTextField.d.ts +1 -1
  34. package/dist/inputs/MRT_GlobalFilterTextField.d.ts +1 -1
  35. package/dist/inputs/MRT_SelectCheckbox.d.ts +1 -1
  36. package/dist/material-react-table.cjs.development.js +1161 -1104
  37. package/dist/material-react-table.cjs.development.js.map +1 -1
  38. package/dist/material-react-table.cjs.production.min.js +1 -1
  39. package/dist/material-react-table.cjs.production.min.js.map +1 -1
  40. package/dist/material-react-table.esm.js +776 -765
  41. package/dist/material-react-table.esm.js.map +1 -1
  42. package/dist/menus/MRT_ColumnActionMenu.d.ts +1 -1
  43. package/dist/menus/MRT_FilterOptionMenu.d.ts +1 -1
  44. package/dist/menus/MRT_RowActionMenu.d.ts +1 -1
  45. package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +1 -1
  46. package/dist/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -1
  47. package/dist/sortingFns.d.ts +10 -3
  48. package/dist/table/MRT_Table.d.ts +1 -1
  49. package/dist/table/MRT_TableContainer.d.ts +1 -1
  50. package/dist/table/MRT_TablePaper.d.ts +1 -1
  51. package/dist/toolbar/MRT_LinearProgressBar.d.ts +1 -1
  52. package/dist/toolbar/MRT_TablePagination.d.ts +1 -1
  53. package/dist/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  54. package/dist/toolbar/MRT_ToolbarBottom.d.ts +1 -1
  55. package/dist/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -1
  56. package/dist/toolbar/MRT_ToolbarTop.d.ts +1 -1
  57. package/dist/utils.d.ts +10 -16
  58. package/package.json +7 -7
  59. package/src/MaterialReactTable.tsx +169 -158
  60. package/src/body/MRT_TableBody.tsx +26 -19
  61. package/src/body/MRT_TableBodyCell.tsx +18 -27
  62. package/src/body/MRT_TableBodyRow.tsx +7 -7
  63. package/src/body/MRT_TableDetailPanel.tsx +7 -7
  64. package/src/buttons/MRT_ColumnPinningButtons.tsx +3 -3
  65. package/src/buttons/MRT_CopyButton.tsx +5 -7
  66. package/src/buttons/MRT_EditActionButtons.tsx +4 -5
  67. package/src/buttons/MRT_ExpandAllButton.tsx +4 -5
  68. package/src/buttons/MRT_ExpandButton.tsx +4 -5
  69. package/src/buttons/MRT_FullScreenToggleButton.tsx +3 -7
  70. package/src/buttons/MRT_GrabHandleButton.tsx +39 -41
  71. package/src/buttons/MRT_ShowHideColumnsButton.tsx +4 -4
  72. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +3 -7
  73. package/src/buttons/MRT_ToggleFiltersButton.tsx +3 -4
  74. package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +4 -8
  75. package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +6 -6
  76. package/src/filtersFns.ts +24 -23
  77. package/src/footer/MRT_TableFooter.tsx +5 -6
  78. package/src/footer/MRT_TableFooterCell.tsx +8 -11
  79. package/src/footer/MRT_TableFooterRow.tsx +5 -9
  80. package/src/head/MRT_DraggableTableHeadCell.tsx +4 -6
  81. package/src/head/MRT_TableHead.tsx +5 -5
  82. package/src/head/MRT_TableHeadCell.tsx +18 -29
  83. package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +6 -8
  84. package/src/head/MRT_TableHeadCellFilterContainer.tsx +5 -7
  85. package/src/head/MRT_TableHeadCellFilterLabel.tsx +13 -19
  86. package/src/head/MRT_TableHeadCellResizeHandle.tsx +12 -11
  87. package/src/head/MRT_TableHeadCellSortLabel.tsx +3 -5
  88. package/src/head/MRT_TableHeadRow.tsx +6 -6
  89. package/src/inputs/MRT_EditCellTextField.tsx +12 -14
  90. package/src/inputs/MRT_FilterRangeFields.tsx +4 -4
  91. package/src/inputs/MRT_FilterTextField.tsx +27 -38
  92. package/src/inputs/MRT_GlobalFilterTextField.tsx +5 -6
  93. package/src/inputs/MRT_SelectCheckbox.tsx +9 -12
  94. package/src/menus/MRT_ColumnActionMenu.tsx +5 -9
  95. package/src/menus/MRT_FilterOptionMenu.tsx +16 -48
  96. package/src/menus/MRT_RowActionMenu.tsx +4 -5
  97. package/src/menus/MRT_ShowHideColumnsMenu.tsx +8 -9
  98. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +11 -10
  99. package/src/sortingFns.ts +11 -3
  100. package/src/table/MRT_Table.tsx +7 -11
  101. package/src/table/MRT_TableContainer.tsx +5 -6
  102. package/src/table/MRT_TablePaper.tsx +7 -8
  103. package/src/table/MRT_TableRoot.tsx +118 -132
  104. package/src/toolbar/MRT_LinearProgressBar.tsx +4 -5
  105. package/src/toolbar/MRT_TablePagination.tsx +7 -9
  106. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +6 -7
  107. package/src/toolbar/MRT_ToolbarBottom.tsx +8 -9
  108. package/src/toolbar/MRT_ToolbarInternalButtons.tsx +10 -10
  109. package/src/toolbar/MRT_ToolbarTop.tsx +11 -11
  110. package/src/utils.ts +56 -50
@@ -1,16 +1,16 @@
1
1
  import React, { FC, RefObject, useMemo } from 'react';
2
- import { useVirtual } from 'react-virtual';
2
+ import { useVirtualizer } from '@tanstack/react-virtual';
3
3
  import { TableBody } from '@mui/material';
4
4
  import { MRT_TableBodyRow } from './MRT_TableBodyRow';
5
5
  import type { MRT_Row, MRT_TableInstance } from '..';
6
6
  import { rankGlobalFuzzy } from '../sortingFns';
7
7
 
8
8
  interface Props {
9
- instance: MRT_TableInstance;
9
+ table: MRT_TableInstance;
10
10
  tableContainerRef: RefObject<HTMLDivElement>;
11
11
  }
12
12
 
13
- export const MRT_TableBody: FC<Props> = ({ instance, tableContainerRef }) => {
13
+ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
14
14
  const {
15
15
  getRowModel,
16
16
  getPrePaginationRowModel,
@@ -22,13 +22,12 @@ export const MRT_TableBody: FC<Props> = ({ instance, tableContainerRef }) => {
22
22
  muiTableBodyProps,
23
23
  virtualizerProps,
24
24
  },
25
- } = instance;
26
-
25
+ } = table;
27
26
  const { density, globalFilter, pagination, sorting } = getState();
28
27
 
29
28
  const tableBodyProps =
30
29
  muiTableBodyProps instanceof Function
31
- ? muiTableBodyProps({ instance })
30
+ ? muiTableBodyProps({ table })
32
31
  : muiTableBodyProps;
33
32
 
34
33
  const getIsSomeColumnsSorted = () => {
@@ -62,20 +61,29 @@ export const MRT_TableBody: FC<Props> = ({ instance, tableContainerRef }) => {
62
61
  ]);
63
62
 
64
63
  const rowVirtualizer = enableRowVirtualization
65
- ? useVirtual({
66
- overscan: density === 'compact' ? 20 : 10,
67
- size: rows.length,
68
- parentRef: tableContainerRef,
64
+ ? useVirtualizer({
65
+ count: rows.length,
66
+ estimateSize: () => (density === 'compact' ? 25 : 50),
67
+ getScrollElement: () => tableContainerRef.current,
68
+ overscan: density === 'compact' ? 30 : 10,
69
69
  ...virtualizerProps,
70
70
  })
71
- : ({} as any);
71
+ : {};
72
+
73
+ const virtualRows = enableRowVirtualization
74
+ ? rowVirtualizer.getVirtualItems()
75
+ : [];
72
76
 
73
- const { virtualItems: virtualRows } = rowVirtualizer;
74
- const paddingTop = virtualRows?.length > 0 ? virtualRows[0].start : 0;
75
- const paddingBottom =
76
- virtualRows?.length > 0
77
- ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end
78
- : 0;
77
+ let paddingTop = 0;
78
+ let paddingBottom = 0;
79
+ if (enableRowVirtualization) {
80
+ paddingTop = virtualRows.length > 0 ? virtualRows[0].start : 0;
81
+ paddingBottom =
82
+ virtualRows.length > 0
83
+ ? rowVirtualizer.getTotalSize() -
84
+ virtualRows[virtualRows.length - 1].end
85
+ : 0;
86
+ }
79
87
 
80
88
  return (
81
89
  <TableBody {...tableBodyProps}>
@@ -84,7 +92,6 @@ export const MRT_TableBody: FC<Props> = ({ instance, tableContainerRef }) => {
84
92
  <td style={{ height: `${paddingTop}px` }} />
85
93
  </tr>
86
94
  )}
87
- {/* @ts-ignore */}
88
95
  {(enableRowVirtualization ? virtualRows : rows).map(
89
96
  (rowOrVirtualRow: any, rowIndex: number) => {
90
97
  const row = enableRowVirtualization
@@ -97,7 +104,7 @@ export const MRT_TableBody: FC<Props> = ({ instance, tableContainerRef }) => {
97
104
  rowIndex={
98
105
  enableRowVirtualization ? rowOrVirtualRow.index : rowIndex
99
106
  }
100
- instance={instance}
107
+ table={table}
101
108
  />
102
109
  );
103
110
  },
@@ -10,14 +10,14 @@ interface Props {
10
10
  cell: MRT_Cell;
11
11
  enableHover?: boolean;
12
12
  rowIndex: number;
13
- instance: MRT_TableInstance;
13
+ table: MRT_TableInstance;
14
14
  }
15
15
 
16
16
  export const MRT_TableBodyCell: FC<Props> = ({
17
17
  cell,
18
18
  enableHover,
19
19
  rowIndex,
20
- instance,
20
+ table,
21
21
  }) => {
22
22
  const {
23
23
  getState,
@@ -34,8 +34,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
34
34
  },
35
35
  setColumnOrder,
36
36
  setCurrentEditingCell,
37
- } = instance;
38
-
37
+ } = table;
39
38
  const {
40
39
  columnOrder,
41
40
  currentEditingCell,
@@ -44,10 +43,9 @@ export const MRT_TableBodyCell: FC<Props> = ({
44
43
  isLoading,
45
44
  showSkeletons,
46
45
  } = getState();
47
-
48
46
  const { column, row } = cell;
49
-
50
- const { columnDef, columnDefType } = column;
47
+ const { columnDef } = column;
48
+ const { columnDefType } = columnDef;
51
49
 
52
50
  const [, dropRef] = useDrop({
53
51
  accept: 'column',
@@ -59,12 +57,12 @@ export const MRT_TableBodyCell: FC<Props> = ({
59
57
 
60
58
  const mTableCellBodyProps =
61
59
  muiTableBodyCellProps instanceof Function
62
- ? muiTableBodyCellProps({ cell, instance })
60
+ ? muiTableBodyCellProps({ cell, table })
63
61
  : muiTableBodyCellProps;
64
62
 
65
63
  const mcTableCellBodyProps =
66
64
  columnDef.muiTableBodyCellProps instanceof Function
67
- ? columnDef.muiTableBodyCellProps({ cell, instance })
65
+ ? columnDef.muiTableBodyCellProps({ cell, table })
68
66
  : columnDef.muiTableBodyCellProps;
69
67
 
70
68
  const tableCellProps = {
@@ -78,7 +76,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
78
76
  ? column.getSize() / 2
79
77
  : Math.random() * (column.getSize() - column.getSize() / 3) +
80
78
  column.getSize() / 3,
81
- [columnDefType, column.getSize()],
79
+ [],
82
80
  );
83
81
 
84
82
  const isEditable =
@@ -113,7 +111,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
113
111
  const getIsLastLeftPinnedColumn = () => {
114
112
  return (
115
113
  column.getIsPinned() === 'left' &&
116
- instance.getLeftLeafHeaders().length - 1 === column.getPinnedIndex()
114
+ table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex()
117
115
  );
118
116
  };
119
117
 
@@ -123,8 +121,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
123
121
 
124
122
  const getTotalRight = () => {
125
123
  return (
126
- (instance.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) *
127
- 150
124
+ (table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150
128
125
  );
129
126
  };
130
127
 
@@ -198,7 +195,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
198
195
  })}
199
196
  >
200
197
  <>
201
- {isLoading || showSkeletons ? (
198
+ {cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (
202
199
  <Skeleton
203
200
  animation="wave"
204
201
  height={20}
@@ -210,27 +207,21 @@ export const MRT_TableBodyCell: FC<Props> = ({
210
207
  column.id === 'mrt-row-numbers' ? (
211
208
  rowIndex + 1
212
209
  ) : columnDefType === 'display' ? (
213
- columnDef.Cell?.({ cell, instance })
214
- ) : cell.getIsPlaceholder() ||
215
- (row.getIsGrouped() &&
216
- column.id !==
217
- row.groupingColumnId) ? null : cell.getIsAggregated() ? (
218
- columnDef.AggregatedCell?.({ cell, instance }) ??
219
- cell.renderAggregatedCell()
210
+ columnDef.Cell?.({ cell, table })
220
211
  ) : isEditing ? (
221
- <MRT_EditCellTextField cell={cell} instance={instance} />
212
+ <MRT_EditCellTextField cell={cell} table={table} />
222
213
  ) : (enableClickToCopy || columnDef.enableClickToCopy) &&
223
214
  columnDef.enableClickToCopy !== false ? (
224
215
  <>
225
- <MRT_CopyButton cell={cell} instance={instance}>
226
- <>{columnDef?.Cell?.({ cell, instance }) ?? cell.renderCell()}</>
216
+ <MRT_CopyButton cell={cell} table={table}>
217
+ <>{columnDef?.Cell?.({ cell, table }) ?? cell.renderValue()}</>
227
218
  </MRT_CopyButton>
228
- {row.getIsGrouped() && <> ({row.subRows?.length})</>}
219
+ {cell.getIsGrouped() && <> ({row.subRows?.length})</>}
229
220
  </>
230
221
  ) : (
231
222
  <>
232
- {columnDef?.Cell?.({ cell, instance }) ?? cell.renderCell()}
233
- {row.getIsGrouped() && <> ({row.subRows?.length ?? ''})</>}
223
+ {columnDef?.Cell?.({ cell, table }) ?? cell.renderValue()}
224
+ {cell.getIsGrouped() && <> ({row.subRows?.length ?? ''})</>}
234
225
  </>
235
226
  )}
236
227
  </>
@@ -7,18 +7,18 @@ import type { MRT_Row, MRT_TableInstance } from '..';
7
7
  interface Props {
8
8
  row: MRT_Row;
9
9
  rowIndex: number;
10
- instance: MRT_TableInstance;
10
+ table: MRT_TableInstance;
11
11
  }
12
12
 
13
- export const MRT_TableBodyRow: FC<Props> = ({ row, rowIndex, instance }) => {
13
+ export const MRT_TableBodyRow: FC<Props> = ({ row, rowIndex, table }) => {
14
14
  const {
15
15
  getIsSomeColumnsPinned,
16
16
  options: { muiTableBodyRowProps, renderDetailPanel },
17
- } = instance;
17
+ } = table;
18
18
 
19
19
  const tableRowProps =
20
20
  muiTableBodyRowProps instanceof Function
21
- ? muiTableBodyRowProps({ row, instance })
21
+ ? muiTableBodyRowProps({ row, table })
22
22
  : muiTableBodyRowProps;
23
23
 
24
24
  return (
@@ -41,18 +41,18 @@ export const MRT_TableBodyRow: FC<Props> = ({ row, rowIndex, instance }) => {
41
41
  ...(tableRowProps?.sx as any),
42
42
  })}
43
43
  >
44
- {row.getVisibleCells().map((cell) => (
44
+ {row?.getVisibleCells()?.map?.((cell) => (
45
45
  <MRT_TableBodyCell
46
46
  cell={cell}
47
47
  key={cell.id}
48
48
  enableHover={tableRowProps?.hover !== false}
49
49
  rowIndex={rowIndex}
50
- instance={instance}
50
+ table={table}
51
51
  />
52
52
  ))}
53
53
  </TableRow>
54
54
  {renderDetailPanel && !row.getIsGrouped() && (
55
- <MRT_TableDetailPanel row={row} instance={instance} />
55
+ <MRT_TableDetailPanel row={row} table={table} />
56
56
  )}
57
57
  </>
58
58
  );
@@ -4,10 +4,10 @@ import type { MRT_Row, MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props {
6
6
  row: MRT_Row;
7
- instance: MRT_TableInstance;
7
+ table: MRT_TableInstance;
8
8
  }
9
9
 
10
- export const MRT_TableDetailPanel: FC<Props> = ({ row, instance }) => {
10
+ export const MRT_TableDetailPanel: FC<Props> = ({ row, table }) => {
11
11
  const {
12
12
  getVisibleLeafColumns,
13
13
  options: {
@@ -15,16 +15,16 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row, instance }) => {
15
15
  muiTableDetailPanelProps,
16
16
  renderDetailPanel,
17
17
  },
18
- } = instance;
18
+ } = table;
19
19
 
20
20
  const tableRowProps =
21
21
  muiTableBodyRowProps instanceof Function
22
- ? muiTableBodyRowProps({ row, instance })
22
+ ? muiTableBodyRowProps({ row, table })
23
23
  : muiTableBodyRowProps;
24
24
 
25
25
  const tableCellProps =
26
26
  muiTableDetailPanelProps instanceof Function
27
- ? muiTableDetailPanelProps({ row, instance })
27
+ ? muiTableDetailPanelProps({ row, table })
28
28
  : muiTableDetailPanelProps;
29
29
 
30
30
  return (
@@ -37,13 +37,13 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row, instance }) => {
37
37
  pb: row.getIsExpanded() ? '1rem' : 0,
38
38
  pt: row.getIsExpanded() ? '1rem' : 0,
39
39
  transition: 'all 0.2s ease-in-out',
40
- width: `${instance.getTotalSize()}px`,
40
+ width: `${table.getTotalSize()}px`,
41
41
  ...tableCellProps?.sx,
42
42
  }}
43
43
  >
44
44
  {renderDetailPanel && (
45
45
  <Collapse in={row.getIsExpanded()}>
46
- {renderDetailPanel({ row, instance })}
46
+ {renderDetailPanel({ row, table })}
47
47
  </Collapse>
48
48
  )}
49
49
  </TableCell>
@@ -4,16 +4,16 @@ import type { MRT_Column, MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props {
6
6
  column: MRT_Column;
7
- instance: MRT_TableInstance;
7
+ table: MRT_TableInstance;
8
8
  }
9
9
 
10
- export const MRT_ColumnPinningButtons: FC<Props> = ({ column, instance }) => {
10
+ export const MRT_ColumnPinningButtons: FC<Props> = ({ column, table }) => {
11
11
  const {
12
12
  options: {
13
13
  icons: { PushPinIcon },
14
14
  localization,
15
15
  },
16
- } = instance;
16
+ } = table;
17
17
 
18
18
  const handlePinColumn = (pinDirection: 'left' | 'right' | false) => {
19
19
  column.pin(pinDirection);
@@ -5,16 +5,14 @@ import { MRT_Cell, MRT_TableInstance } from '..';
5
5
  interface Props {
6
6
  cell: MRT_Cell;
7
7
  children: ReactNode;
8
- instance: MRT_TableInstance;
8
+ table: MRT_TableInstance;
9
9
  }
10
10
 
11
- export const MRT_CopyButton: FC<Props> = ({ cell, children, instance }) => {
11
+ export const MRT_CopyButton: FC<Props> = ({ cell, children, table }) => {
12
12
  const {
13
13
  options: { localization, muiTableBodyCellCopyButtonProps },
14
- } = instance;
15
-
14
+ } = table;
16
15
  const { column } = cell;
17
-
18
16
  const { columnDef } = column;
19
17
 
20
18
  const [copied, setCopied] = useState(false);
@@ -27,14 +25,14 @@ export const MRT_CopyButton: FC<Props> = ({ cell, children, instance }) => {
27
25
 
28
26
  const mTableBodyCellCopyButtonProps =
29
27
  muiTableBodyCellCopyButtonProps instanceof Function
30
- ? muiTableBodyCellCopyButtonProps({ cell, instance })
28
+ ? muiTableBodyCellCopyButtonProps({ cell, table })
31
29
  : muiTableBodyCellCopyButtonProps;
32
30
 
33
31
  const mcTableBodyCellCopyButtonProps =
34
32
  columnDef.muiTableBodyCellCopyButtonProps instanceof Function
35
33
  ? columnDef.muiTableBodyCellCopyButtonProps({
36
34
  cell,
37
- instance,
35
+ table,
38
36
  })
39
37
  : columnDef.muiTableBodyCellCopyButtonProps;
40
38
 
@@ -4,10 +4,10 @@ import type { MRT_Row, MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props {
6
6
  row: MRT_Row;
7
- instance: MRT_TableInstance;
7
+ table: MRT_TableInstance;
8
8
  }
9
9
 
10
- export const MRT_EditActionButtons: FC<Props> = ({ row, instance }) => {
10
+ export const MRT_EditActionButtons: FC<Props> = ({ row, table }) => {
11
11
  const {
12
12
  getState,
13
13
  options: {
@@ -16,8 +16,7 @@ export const MRT_EditActionButtons: FC<Props> = ({ row, instance }) => {
16
16
  onEditRowSubmit,
17
17
  },
18
18
  setCurrentEditingRow,
19
- } = instance;
20
-
19
+ } = table;
21
20
  const { currentEditingRow } = getState();
22
21
 
23
22
  const handleCancel = () => {
@@ -26,7 +25,7 @@ export const MRT_EditActionButtons: FC<Props> = ({ row, instance }) => {
26
25
  };
27
26
 
28
27
  const handleSave = () => {
29
- onEditRowSubmit?.({ row: currentEditingRow ?? row, instance });
28
+ onEditRowSubmit?.({ row: currentEditingRow ?? row, table });
30
29
  setCurrentEditingRow(null);
31
30
  };
32
31
 
@@ -3,10 +3,10 @@ import { IconButton, Tooltip } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props {
6
- instance: MRT_TableInstance;
6
+ table: MRT_TableInstance;
7
7
  }
8
8
 
9
- export const MRT_ExpandAllButton: FC<Props> = ({ instance }) => {
9
+ export const MRT_ExpandAllButton: FC<Props> = ({ table }) => {
10
10
  const {
11
11
  getIsAllRowsExpanded,
12
12
  getIsSomeRowsExpanded,
@@ -19,13 +19,12 @@ export const MRT_ExpandAllButton: FC<Props> = ({ instance }) => {
19
19
  renderDetailPanel,
20
20
  },
21
21
  toggleAllRowsExpanded,
22
- } = instance;
23
-
22
+ } = table;
24
23
  const { density } = getState();
25
24
 
26
25
  const iconButtonProps =
27
26
  muiExpandAllButtonProps instanceof Function
28
- ? muiExpandAllButtonProps({ instance })
27
+ ? muiExpandAllButtonProps({ table })
29
28
  : muiExpandAllButtonProps;
30
29
 
31
30
  return (
@@ -4,10 +4,10 @@ import type { MRT_Row, MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props {
6
6
  row: MRT_Row;
7
- instance: MRT_TableInstance;
7
+ table: MRT_TableInstance;
8
8
  }
9
9
 
10
- export const MRT_ExpandButton: FC<Props> = ({ row, instance }) => {
10
+ export const MRT_ExpandButton: FC<Props> = ({ row, table }) => {
11
11
  const {
12
12
  getState,
13
13
  options: {
@@ -16,13 +16,12 @@ export const MRT_ExpandButton: FC<Props> = ({ row, instance }) => {
16
16
  muiExpandButtonProps,
17
17
  renderDetailPanel,
18
18
  },
19
- } = instance;
20
-
19
+ } = table;
21
20
  const { density } = getState();
22
21
 
23
22
  const iconButtonProps =
24
23
  muiExpandButtonProps instanceof Function
25
- ? muiExpandButtonProps({ instance, row })
24
+ ? muiExpandButtonProps({ table, row })
26
25
  : muiExpandButtonProps;
27
26
 
28
27
  const handleToggleExpand = () => {
@@ -3,13 +3,10 @@ import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props extends IconButtonProps {
6
- instance: MRT_TableInstance;
6
+ table: MRT_TableInstance;
7
7
  }
8
8
 
9
- export const MRT_FullScreenToggleButton: FC<Props> = ({
10
- instance,
11
- ...rest
12
- }) => {
9
+ export const MRT_FullScreenToggleButton: FC<Props> = ({ table, ...rest }) => {
13
10
  const {
14
11
  getState,
15
12
  options: {
@@ -17,8 +14,7 @@ export const MRT_FullScreenToggleButton: FC<Props> = ({
17
14
  localization,
18
15
  },
19
16
  setIsFullScreen,
20
- } = instance;
21
-
17
+ } = table;
22
18
  const { isFullScreen } = getState();
23
19
 
24
20
  const handleToggleFullScreen = () => {
@@ -4,48 +4,46 @@ import { MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props {
6
6
  ref: Ref<HTMLButtonElement>;
7
- instance: MRT_TableInstance;
7
+ table: MRT_TableInstance;
8
8
  }
9
9
 
10
- export const MRT_GrabHandleButton: FC<Props> = forwardRef(
11
- ({ instance }, ref) => {
12
- const {
13
- options: {
14
- icons: { DragHandleIcon },
15
- localization,
16
- },
17
- } = instance;
10
+ export const MRT_GrabHandleButton: FC<Props> = forwardRef(({ table }, ref) => {
11
+ const {
12
+ options: {
13
+ icons: { DragHandleIcon },
14
+ localization,
15
+ },
16
+ } = table;
18
17
 
19
- return (
20
- <Tooltip
21
- arrow
22
- enterDelay={1000}
23
- enterNextDelay={1000}
24
- placement="top"
25
- title={localization.grab}
18
+ return (
19
+ <Tooltip
20
+ arrow
21
+ enterDelay={1000}
22
+ enterNextDelay={1000}
23
+ placement="top"
24
+ title={localization.grab}
25
+ >
26
+ <IconButton
27
+ disableRipple
28
+ ref={ref}
29
+ size="small"
30
+ sx={{
31
+ cursor: 'grab',
32
+ m: 0,
33
+ opacity: 0.5,
34
+ p: '2px',
35
+ transition: 'all 0.2s ease-in-out',
36
+ '&:hover': {
37
+ backgroundColor: 'transparent',
38
+ opacity: 1,
39
+ },
40
+ '&:active': {
41
+ cursor: 'grabbing',
42
+ },
43
+ }}
26
44
  >
27
- <IconButton
28
- disableRipple
29
- ref={ref}
30
- size="small"
31
- sx={{
32
- cursor: 'grab',
33
- m: 0,
34
- opacity: 0.5,
35
- p: '2px',
36
- transition: 'all 0.2s ease-in-out',
37
- '&:hover': {
38
- backgroundColor: 'transparent',
39
- opacity: 1,
40
- },
41
- '&:active': {
42
- cursor: 'grabbing',
43
- },
44
- }}
45
- >
46
- <DragHandleIcon />
47
- </IconButton>
48
- </Tooltip>
49
- );
50
- },
51
- );
45
+ <DragHandleIcon />
46
+ </IconButton>
47
+ </Tooltip>
48
+ );
49
+ });
@@ -4,16 +4,16 @@ import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
4
4
  import { MRT_TableInstance } from '..';
5
5
 
6
6
  interface Props extends IconButtonProps {
7
- instance: MRT_TableInstance;
7
+ table: MRT_TableInstance;
8
8
  }
9
9
 
10
- export const MRT_ShowHideColumnsButton: FC<Props> = ({ instance, ...rest }) => {
10
+ export const MRT_ShowHideColumnsButton: FC<Props> = ({ table, ...rest }) => {
11
11
  const {
12
12
  options: {
13
13
  icons: { ViewColumnIcon },
14
14
  localization,
15
15
  },
16
- } = instance;
16
+ } = table;
17
17
 
18
18
  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
19
19
 
@@ -35,7 +35,7 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ instance, ...rest }) => {
35
35
  <MRT_ShowHideColumnsMenu
36
36
  anchorEl={anchorEl}
37
37
  setAnchorEl={setAnchorEl}
38
- instance={instance}
38
+ table={table}
39
39
  />
40
40
  </>
41
41
  );
@@ -3,13 +3,10 @@ import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props extends IconButtonProps {
6
- instance: MRT_TableInstance;
6
+ table: MRT_TableInstance;
7
7
  }
8
8
 
9
- export const MRT_ToggleDensePaddingButton: FC<Props> = ({
10
- instance,
11
- ...rest
12
- }) => {
9
+ export const MRT_ToggleDensePaddingButton: FC<Props> = ({ table, ...rest }) => {
13
10
  const {
14
11
  getState,
15
12
  options: {
@@ -17,8 +14,7 @@ export const MRT_ToggleDensePaddingButton: FC<Props> = ({
17
14
  localization,
18
15
  },
19
16
  setDensity,
20
- } = instance;
21
-
17
+ } = table;
22
18
  const { density } = getState();
23
19
 
24
20
  const handleToggleDensePadding = () => {
@@ -3,10 +3,10 @@ import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
3
3
  import { MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props extends IconButtonProps {
6
- instance: MRT_TableInstance;
6
+ table: MRT_TableInstance;
7
7
  }
8
8
 
9
- export const MRT_ToggleFiltersButton: FC<Props> = ({ instance, ...rest }) => {
9
+ export const MRT_ToggleFiltersButton: FC<Props> = ({ table, ...rest }) => {
10
10
  const {
11
11
  getState,
12
12
  options: {
@@ -14,8 +14,7 @@ export const MRT_ToggleFiltersButton: FC<Props> = ({ instance, ...rest }) => {
14
14
  localization,
15
15
  },
16
16
  setShowFilters,
17
- } = instance;
18
-
17
+ } = table;
19
18
  const { showFilters } = getState();
20
19
 
21
20
  const handleToggleShowFilters = () => {