material-react-table 0.8.9 → 0.8.12

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 (30) hide show
  1. package/README.md +29 -15
  2. package/dist/MaterialReactTable.d.ts +15 -12
  3. package/dist/localization.d.ts +1 -0
  4. package/dist/material-react-table.cjs.development.js +185 -176
  5. package/dist/material-react-table.cjs.development.js.map +1 -1
  6. package/dist/material-react-table.cjs.production.min.js +1 -1
  7. package/dist/material-react-table.cjs.production.min.js.map +1 -1
  8. package/dist/material-react-table.esm.js +186 -177
  9. package/dist/material-react-table.esm.js.map +1 -1
  10. package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +1 -1
  11. package/package.json +14 -14
  12. package/src/MaterialReactTable.tsx +34 -30
  13. package/src/body/MRT_TableBodyCell.tsx +20 -18
  14. package/src/buttons/MRT_CopyButton.tsx +10 -3
  15. package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +5 -3
  16. package/src/footer/MRT_TableFooterCell.tsx +11 -7
  17. package/src/footer/MRT_TableFooterRow.tsx +4 -4
  18. package/src/head/MRT_DraggableTableHeadCell.tsx +16 -9
  19. package/src/head/MRT_TableHeadCell.tsx +36 -37
  20. package/src/head/MRT_TableHeadCellFilterLabel.tsx +3 -1
  21. package/src/head/MRT_TableHeadCellResizeHandle.tsx +3 -2
  22. package/src/head/MRT_TableHeadCellSortLabel.tsx +4 -8
  23. package/src/inputs/MRT_EditCellTextField.tsx +15 -9
  24. package/src/inputs/MRT_FilterTextField.tsx +14 -9
  25. package/src/localization.ts +2 -0
  26. package/src/menus/MRT_ColumnActionMenu.tsx +10 -8
  27. package/src/menus/MRT_FilterOptionMenu.tsx +11 -7
  28. package/src/menus/MRT_ShowHideColumnsMenu.tsx +25 -39
  29. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +15 -6
  30. package/src/table/MRT_TableRoot.tsx +29 -28
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  interface Props {
4
4
  anchorEl: HTMLElement | null;
5
5
  isSubMenu?: boolean;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "0.8.9",
2
+ "version": "0.8.12",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
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.",
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.",
6
6
  "author": "Kevin Vandy",
7
7
  "keywords": [
8
8
  "react-table",
@@ -48,11 +48,11 @@
48
48
  "size-limit": [
49
49
  {
50
50
  "path": "dist/material-react-table.cjs.production.min.js",
51
- "limit": "60 KB"
51
+ "limit": "50 KB"
52
52
  },
53
53
  {
54
54
  "path": "dist/material-react-table.esm.js",
55
- "limit": "60 KB"
55
+ "limit": "50 KB"
56
56
  }
57
57
  ],
58
58
  "devDependencies": {
@@ -63,17 +63,17 @@
63
63
  "@mui/icons-material": "^5.8.2",
64
64
  "@mui/material": "^5.8.2",
65
65
  "@size-limit/preset-small-lib": "^7.0.8",
66
- "@storybook/addon-a11y": "^6.5.5",
67
- "@storybook/addon-actions": "^6.5.5",
68
- "@storybook/addon-essentials": "^6.5.5",
66
+ "@storybook/addon-a11y": "^6.5.6",
67
+ "@storybook/addon-actions": "^6.5.6",
68
+ "@storybook/addon-essentials": "^6.5.6",
69
69
  "@storybook/addon-info": "^5.3.21",
70
- "@storybook/addon-links": "^6.5.5",
71
- "@storybook/addons": "^6.5.5",
72
- "@storybook/react": "^6.5.5",
73
- "@types/react": "^18.0.10",
70
+ "@storybook/addon-links": "^6.5.6",
71
+ "@storybook/addons": "^6.5.6",
72
+ "@storybook/react": "^6.5.6",
73
+ "@types/react": "^18.0.11",
74
74
  "@types/react-dom": "^18.0.5",
75
75
  "babel-loader": "^8.2.5",
76
- "eslint": "^8.16.0",
76
+ "eslint": "^8.17.0",
77
77
  "eslint-plugin-react-hooks": "^4.5.0",
78
78
  "husky": "^8.0.1",
79
79
  "prettier": "^2.6.2",
@@ -87,7 +87,7 @@
87
87
  "storybook-dark-mode": "^1.1.0",
88
88
  "tsdx": "^0.14.1",
89
89
  "tslib": "^2.4.0",
90
- "typescript": "^4.7.2"
90
+ "typescript": "^4.7.3"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "@emotion/react": ">=11",
@@ -98,7 +98,7 @@
98
98
  },
99
99
  "dependencies": {
100
100
  "@tanstack/match-sorter-utils": "^8.0.0-alpha.83",
101
- "@tanstack/react-table": "^8.0.0-alpha.89",
101
+ "@tanstack/react-table": "^8.0.0-beta.4",
102
102
  "react-dnd": "^16.0.1",
103
103
  "react-dnd-html5-backend": "^16.0.1"
104
104
  }
@@ -35,7 +35,6 @@ import {
35
35
  Header,
36
36
  HeaderGroup,
37
37
  Overwrite,
38
- PaginationState,
39
38
  ReactTableGenerics,
40
39
  Row,
41
40
  TableGenerics,
@@ -79,9 +78,11 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
79
78
  >
80
79
  >,
81
80
  | 'getAllColumns'
81
+ | 'getAllFlatColumns'
82
82
  | 'getAllLeafColumns'
83
83
  | 'getColumn'
84
84
  | 'getExpandedRowModel'
85
+ | 'getFlatHeaders'
85
86
  | 'getPaginationRowModel'
86
87
  | 'getPrePaginationRowModel'
87
88
  | 'getRowModel'
@@ -90,9 +91,11 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
90
91
  | 'options'
91
92
  > & {
92
93
  getAllColumns: () => MRT_Column<D>[];
94
+ getAllFlatColumns: () => MRT_Column<D>[];
93
95
  getAllLeafColumns: () => MRT_Column<D>[];
94
96
  getColumn: (columnId: string) => MRT_Column<D>;
95
97
  getExpandedRowModel: () => MRT_RowModel<D>;
98
+ getFlatHeaders: () => MRT_Header<D>[];
96
99
  getPaginationRowModel: () => MRT_RowModel<D>;
97
100
  getPrePaginationRowModel: () => MRT_RowModel<D>;
98
101
  getRowModel: () => MRT_RowModel<D>;
@@ -117,10 +120,7 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
117
120
  setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
118
121
  };
119
122
 
120
- export type MRT_TableState<D extends Record<string, any> = {}> = Omit<
121
- TableState,
122
- 'pagination'
123
- > & {
123
+ export type MRT_TableState<D extends Record<string, any> = {}> = TableState & {
124
124
  currentEditingCell: MRT_Cell<D> | null;
125
125
  currentEditingRow: MRT_Row<D> | null;
126
126
  currentFilterFns: Record<string, string | Function>;
@@ -128,7 +128,6 @@ export type MRT_TableState<D extends Record<string, any> = {}> = Omit<
128
128
  isDensePadding: boolean;
129
129
  isLoading: boolean;
130
130
  isFullScreen: boolean;
131
- pagination: Partial<PaginationState>;
132
131
  showFilters: boolean;
133
132
  showGlobalFilter: boolean;
134
133
  showProgressBars: boolean;
@@ -137,7 +136,7 @@ export type MRT_TableState<D extends Record<string, any> = {}> = Omit<
137
136
 
138
137
  export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
139
138
  ColumnDef<D>,
140
- 'header' | 'footer' | 'columns' | 'filterFn'
139
+ 'accessorFN' | 'header' | 'footer' | 'columns' | 'filterFn'
141
140
  > & {
142
141
  Edit?: ({
143
142
  cell,
@@ -153,20 +152,24 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
153
152
  header: MRT_Header<D>;
154
153
  tableInstance: MRT_TableInstance<D>;
155
154
  }) => ReactNode;
156
- Footer?: ({
157
- footer,
158
- tableInstance,
159
- }: {
160
- footer: MRT_Header<D>;
161
- tableInstance: MRT_TableInstance<D>;
162
- }) => ReactNode;
163
- Header?: ({
164
- header,
165
- tableInstance,
166
- }: {
167
- header: MRT_Header<D>;
168
- tableInstance: MRT_TableInstance<D>;
169
- }) => ReactNode;
155
+ Footer?:
156
+ | ReactNode
157
+ | (({
158
+ footer,
159
+ tableInstance,
160
+ }: {
161
+ footer: MRT_Header<D>;
162
+ tableInstance: MRT_TableInstance<D>;
163
+ }) => ReactNode);
164
+ Header?:
165
+ | ReactNode
166
+ | (({
167
+ header,
168
+ tableInstance,
169
+ }: {
170
+ header: MRT_Header<D>;
171
+ tableInstance: MRT_TableInstance<D>;
172
+ }) => ReactNode);
170
173
  Cell?: ({
171
174
  cell,
172
175
  tableInstance,
@@ -174,7 +177,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
174
177
  cell: MRT_Cell<D>;
175
178
  tableInstance: MRT_TableInstance<D>;
176
179
  }) => ReactNode;
177
- id: keyof D | string;
180
+ accessorFN?: (row: D) => any;
178
181
  columns?: MRT_ColumnDef<D>[];
179
182
  enableClickToCopy?: boolean;
180
183
  enableColumnActions?: boolean;
@@ -185,6 +188,7 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
185
188
  filterSelectOptions?: (string | { text: string; value: string })[];
186
189
  footer?: string;
187
190
  header: string;
191
+ id: keyof D | string;
188
192
  muiTableBodyCellCopyButtonProps?:
189
193
  | ButtonProps
190
194
  | (({
@@ -280,13 +284,12 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
280
284
  export type MRT_Column<D extends Record<string, any> = {}> = Omit<
281
285
  Column<D>,
282
286
  'header' | 'footer' | 'columns'
283
- > &
284
- MRT_ColumnDef<D> & {
285
- columns?: MRT_Column<D>[];
286
- columnDef: MRT_ColumnDef<D>;
287
- header: string;
288
- footer: string;
289
- };
287
+ > & {
288
+ columns?: MRT_Column<D>[];
289
+ columnDef: MRT_ColumnDef<D>;
290
+ header: string;
291
+ footer: string;
292
+ };
290
293
 
291
294
  export type MRT_Header<D extends Record<string, any> = {}> = Omit<
292
295
  Header<D>,
@@ -304,12 +307,13 @@ export type MRT_HeaderGroup<D extends Record<string, any> = {}> = Omit<
304
307
 
305
308
  export type MRT_Row<D extends Record<string, any> = {}> = Omit<
306
309
  Row<D>,
307
- 'getVisibleCells' | 'getAllCells' | 'subRows' | 'original'
310
+ 'getVisibleCells' | 'getAllCells' | 'subRows' | 'original' | '_valuesCache'
308
311
  > & {
309
312
  getAllCells: () => MRT_Cell<D>[];
310
313
  getVisibleCells: () => MRT_Cell<D>[];
311
314
  subRows?: MRT_Row<D>[];
312
315
  original: D;
316
+ _valuesCache?: D;
313
317
  };
314
318
 
315
319
  export type MRT_Cell<D extends Record<string, any> = {}> = Omit<
@@ -39,15 +39,17 @@ export const MRT_TableBodyCell: FC<Props> = ({
39
39
 
40
40
  const { column, row } = cell;
41
41
 
42
+ const { columnDef, columnDefType } = column;
43
+
42
44
  const mTableCellBodyProps =
43
45
  muiTableBodyCellProps instanceof Function
44
46
  ? muiTableBodyCellProps({ cell, tableInstance })
45
47
  : muiTableBodyCellProps;
46
48
 
47
49
  const mcTableCellBodyProps =
48
- column.muiTableBodyCellProps instanceof Function
49
- ? column.muiTableBodyCellProps({ cell, tableInstance })
50
- : column.muiTableBodyCellProps;
50
+ columnDef.muiTableBodyCellProps instanceof Function
51
+ ? columnDef.muiTableBodyCellProps({ cell, tableInstance })
52
+ : columnDef.muiTableBodyCellProps;
51
53
 
52
54
  const tableCellProps = {
53
55
  ...mTableCellBodyProps,
@@ -56,15 +58,16 @@ export const MRT_TableBodyCell: FC<Props> = ({
56
58
 
57
59
  const skeletonWidth = useMemo(
58
60
  () =>
59
- column.columnDefType === 'display'
61
+ columnDefType === 'display'
60
62
  ? column.getSize() / 2
61
63
  : Math.random() * (column.getSize() - column.getSize() / 3) +
62
64
  column.getSize() / 3,
63
- [column.columnDefType, column.getSize()],
65
+ [columnDefType, column.getSize()],
64
66
  );
65
67
 
66
68
  const isEditable =
67
- (enableEditing || column.enableEditing) && column.enableEditing !== false;
69
+ (enableEditing || columnDef.enableEditing) &&
70
+ columnDef.enableEditing !== false;
68
71
 
69
72
  const isEditing =
70
73
  isEditable &&
@@ -74,8 +77,8 @@ export const MRT_TableBodyCell: FC<Props> = ({
74
77
 
75
78
  const handleDoubleClick = (_event: MouseEvent<HTMLTableCellElement>) => {
76
79
  if (
77
- (enableEditing || column.enableEditing) &&
78
- column.enableEditing !== false &&
80
+ (enableEditing || columnDef.enableEditing) &&
81
+ columnDef.enableEditing !== false &&
79
82
  editingMode === 'cell'
80
83
  ) {
81
84
  setCurrentEditingCell(cell);
@@ -133,10 +136,10 @@ export const MRT_TableBodyCell: FC<Props> = ({
133
136
  ? `${column.getStart('left')}px`
134
137
  : undefined,
135
138
  p: isDensePadding
136
- ? column.columnDefType === 'display'
139
+ ? columnDefType === 'display'
137
140
  ? '0 0.5rem'
138
141
  : '0.5rem'
139
- : column.columnDefType === 'display'
142
+ : columnDefType === 'display'
140
143
  ? '0.5rem 0.75rem'
141
144
  : '1rem',
142
145
  pl:
@@ -160,7 +163,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
160
163
  })}
161
164
  style={{
162
165
  maxWidth: `min(${column.getSize()}px, fit-content)`,
163
- minWidth: `max(${column.getSize()}px, ${column.minSize ?? 30}px)`,
166
+ minWidth: `max(${column.getSize()}px, ${columnDef.minSize ?? 30}px)`,
164
167
  width: column.getSize(),
165
168
  }}
166
169
  >
@@ -172,8 +175,8 @@ export const MRT_TableBodyCell: FC<Props> = ({
172
175
  width={skeletonWidth}
173
176
  {...muiTableBodyCellSkeletonProps}
174
177
  />
175
- ) : column.columnDefType === 'display' ? (
176
- column.columnDef.Cell?.({ cell, tableInstance })
178
+ ) : columnDefType === 'display' ? (
179
+ columnDef.Cell?.({ cell, tableInstance })
177
180
  ) : cell.getIsPlaceholder() ||
178
181
  (row.getIsGrouped() &&
179
182
  column.id !==
@@ -181,12 +184,12 @@ export const MRT_TableBodyCell: FC<Props> = ({
181
184
  cell.renderAggregatedCell()
182
185
  ) : isEditing ? (
183
186
  <MRT_EditCellTextField cell={cell} tableInstance={tableInstance} />
184
- ) : (enableClickToCopy || column.enableClickToCopy) &&
185
- column.enableClickToCopy !== false ? (
187
+ ) : (enableClickToCopy || columnDef.enableClickToCopy) &&
188
+ columnDef.enableClickToCopy !== false ? (
186
189
  <>
187
190
  <MRT_CopyButton cell={cell} tableInstance={tableInstance}>
188
191
  <>
189
- {cell.column.columnDef?.Cell?.({ cell, tableInstance }) ??
192
+ {columnDef?.Cell?.({ cell, tableInstance }) ??
190
193
  cell.renderCell()}
191
194
  </>
192
195
  </MRT_CopyButton>
@@ -194,8 +197,7 @@ export const MRT_TableBodyCell: FC<Props> = ({
194
197
  </>
195
198
  ) : (
196
199
  <>
197
- {cell.column.columnDef?.Cell?.({ cell, tableInstance }) ??
198
- cell.renderCell()}
200
+ {columnDef?.Cell?.({ cell, tableInstance }) ?? cell.renderCell()}
199
201
  {row.getIsGrouped() && <> ({row.subRows?.length ?? ''})</>}
200
202
  </>
201
203
  )}
@@ -17,6 +17,10 @@ export const MRT_CopyButton: FC<Props> = ({
17
17
  options: { localization, muiTableBodyCellCopyButtonProps },
18
18
  } = tableInstance;
19
19
 
20
+ const { column } = cell;
21
+
22
+ const { columnDef } = column;
23
+
20
24
  const [copied, setCopied] = useState(false);
21
25
 
22
26
  const handleCopy = (text: unknown) => {
@@ -31,9 +35,12 @@ export const MRT_CopyButton: FC<Props> = ({
31
35
  : muiTableBodyCellCopyButtonProps;
32
36
 
33
37
  const mcTableBodyCellCopyButtonProps =
34
- cell.column.muiTableBodyCellCopyButtonProps instanceof Function
35
- ? cell.column.muiTableBodyCellCopyButtonProps({ cell, tableInstance })
36
- : cell.column.muiTableBodyCellCopyButtonProps;
38
+ columnDef.muiTableBodyCellCopyButtonProps instanceof Function
39
+ ? columnDef.muiTableBodyCellCopyButtonProps({
40
+ cell,
41
+ tableInstance,
42
+ })
43
+ : columnDef.muiTableBodyCellCopyButtonProps;
37
44
 
38
45
  const buttonProps = {
39
46
  ...mTableBodyCellCopyButtonProps,
@@ -22,6 +22,8 @@ export const MRT_ToggleColumnActionMenuButton: FC<Props> = ({
22
22
 
23
23
  const { column } = header;
24
24
 
25
+ const { columnDef } = column;
26
+
25
27
  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
26
28
 
27
29
  const handleClick = (event: MouseEvent<HTMLElement>) => {
@@ -36,12 +38,12 @@ export const MRT_ToggleColumnActionMenuButton: FC<Props> = ({
36
38
  : muiTableHeadCellColumnActionsButtonProps;
37
39
 
38
40
  const mcTableHeadCellColumnActionsButtonProps =
39
- column.muiTableHeadCellColumnActionsButtonProps instanceof Function
40
- ? column.muiTableHeadCellColumnActionsButtonProps({
41
+ columnDef.muiTableHeadCellColumnActionsButtonProps instanceof Function
42
+ ? columnDef.muiTableHeadCellColumnActionsButtonProps({
41
43
  column,
42
44
  tableInstance,
43
45
  })
44
- : column.muiTableHeadCellColumnActionsButtonProps;
46
+ : columnDef.muiTableHeadCellColumnActionsButtonProps;
45
47
 
46
48
  const iconButtonProps = {
47
49
  ...mTableHeadCellColumnActionsButtonProps,
@@ -17,15 +17,17 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, tableInstance }) => {
17
17
 
18
18
  const { column } = footer;
19
19
 
20
+ const { columnDef, columnDefType } = column;
21
+
20
22
  const mTableFooterCellProps =
21
23
  muiTableFooterCellProps instanceof Function
22
24
  ? muiTableFooterCellProps({ column, tableInstance })
23
25
  : muiTableFooterCellProps;
24
26
 
25
27
  const mcTableFooterCellProps =
26
- column.muiTableFooterCellProps instanceof Function
27
- ? column.muiTableFooterCellProps({ column, tableInstance })
28
- : column.muiTableFooterCellProps;
28
+ columnDef.muiTableFooterCellProps instanceof Function
29
+ ? columnDef.muiTableFooterCellProps({ column, tableInstance })
30
+ : columnDef.muiTableFooterCellProps;
29
31
 
30
32
  const tableCellProps = {
31
33
  ...mTableFooterCellProps,
@@ -34,7 +36,7 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, tableInstance }) => {
34
36
 
35
37
  return (
36
38
  <TableCell
37
- align={column.columnDefType === 'group' ? 'center' : 'left'}
39
+ align={columnDefType === 'group' ? 'center' : 'left'}
38
40
  colSpan={footer.colSpan}
39
41
  variant="head"
40
42
  {...tableCellProps}
@@ -57,11 +59,13 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, tableInstance }) => {
57
59
  <>
58
60
  {footer.isPlaceholder
59
61
  ? null
60
- : column.columnDef.Footer?.({
62
+ : columnDef.Footer instanceof Function
63
+ ? columnDef.Footer?.({
61
64
  footer,
62
65
  tableInstance,
63
- }) ??
64
- column.columnDef.footer ??
66
+ })
67
+ : columnDef.Footer ??
68
+ columnDef.footer ??
65
69
  footer.renderFooter() ??
66
70
  null}
67
71
  </>
@@ -19,10 +19,10 @@ export const MRT_TableFooterRow: FC<Props> = ({
19
19
  // if no content in row, skip row
20
20
  if (
21
21
  !footerGroup.headers?.some(
22
- (h) =>
23
- (typeof h.column.columnDef.footer === 'string' &&
24
- !!h.column.columnDef.footer) ||
25
- h.column.columnDef.Footer,
22
+ (header) =>
23
+ (typeof header.column.columnDef.footer === 'string' &&
24
+ !!header.column.columnDef.footer) ||
25
+ header.column.columnDef.Footer,
26
26
  )
27
27
  )
28
28
  return null;
@@ -20,18 +20,25 @@ export const MRT_DraggableTableHeadCell: FC<Props> = ({
20
20
 
21
21
  const { columnOrder } = getState();
22
22
 
23
- const reorder = (item: MRT_Header, newIndex: number) => {
24
- const { index: currentIndex } = item;
25
- columnOrder.splice(newIndex, 0, columnOrder.splice(currentIndex, 1)[0]);
23
+ const reorder = (movingHeader: MRT_Header, receivingHeader: MRT_Header) => {
24
+ if (movingHeader.column.getCanPin()) {
25
+ movingHeader.column.pin(receivingHeader.column.getIsPinned());
26
+ }
27
+ const { index: currentIndex } = movingHeader;
28
+ columnOrder.splice(
29
+ receivingHeader.index,
30
+ 0,
31
+ columnOrder.splice(currentIndex, 1)[0],
32
+ );
26
33
  setColumnOrder([...columnOrder]);
27
34
  };
28
35
 
29
- const [, drop] = useDrop({
36
+ const [, dropRef] = useDrop({
30
37
  accept: 'header',
31
- drop: (item: MRT_Header) => reorder(item, header.index),
38
+ drop: (movingHeader: MRT_Header) => reorder(movingHeader, header),
32
39
  });
33
40
 
34
- const [{ isDragging }, drag, preview] = useDrag({
41
+ const [{ isDragging }, dragRef, previewRef] = useDrag({
35
42
  collect: (monitor) => ({
36
43
  isDragging: monitor.isDragging(),
37
44
  }),
@@ -41,11 +48,11 @@ export const MRT_DraggableTableHeadCell: FC<Props> = ({
41
48
 
42
49
  return (
43
50
  <MRT_TableHeadCell
44
- dragRef={drag}
45
- dropRef={drop}
51
+ dragRef={dragRef}
52
+ dropRef={dropRef}
46
53
  header={header}
47
54
  isDragging={isDragging}
48
- previewRef={preview}
55
+ previewRef={previewRef}
49
56
  tableInstance={tableInstance}
50
57
  />
51
58
  );