material-react-table 3.0.3 → 3.2.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 (152) hide show
  1. package/dist/index.d.ts +23 -73
  2. package/dist/index.esm.js +130 -107
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +130 -107
  5. package/dist/index.js.map +1 -1
  6. package/locales/ar/index.esm.js +1 -0
  7. package/locales/ar/index.js +1 -0
  8. package/locales/az/index.esm.js +1 -0
  9. package/locales/az/index.js +1 -0
  10. package/locales/bg/index.esm.js +1 -0
  11. package/locales/bg/index.js +1 -0
  12. package/locales/cs/index.esm.js +1 -0
  13. package/locales/cs/index.js +1 -0
  14. package/locales/da/index.esm.js +1 -0
  15. package/locales/da/index.js +1 -0
  16. package/locales/de/index.esm.js +1 -0
  17. package/locales/de/index.js +1 -0
  18. package/locales/el/index.esm.js +1 -0
  19. package/locales/el/index.js +1 -0
  20. package/locales/en/index.esm.js +1 -0
  21. package/locales/en/index.js +1 -0
  22. package/locales/es/index.esm.js +1 -0
  23. package/locales/es/index.js +1 -0
  24. package/locales/et/index.esm.js +1 -0
  25. package/locales/et/index.js +1 -0
  26. package/locales/fa/index.esm.js +1 -0
  27. package/locales/fa/index.js +1 -0
  28. package/locales/fi/index.esm.js +1 -0
  29. package/locales/fi/index.js +1 -0
  30. package/locales/fr/index.esm.js +1 -0
  31. package/locales/fr/index.js +1 -0
  32. package/locales/he/index.esm.js +1 -0
  33. package/locales/he/index.js +1 -0
  34. package/locales/hr/index.esm.js +1 -0
  35. package/locales/hr/index.js +1 -0
  36. package/locales/hu/index.esm.js +1 -0
  37. package/locales/hu/index.js +1 -0
  38. package/locales/hy/index.esm.js +1 -0
  39. package/locales/hy/index.js +1 -0
  40. package/locales/id/index.esm.js +1 -0
  41. package/locales/id/index.js +1 -0
  42. package/locales/it/index.esm.js +1 -0
  43. package/locales/it/index.js +1 -0
  44. package/locales/ja/index.esm.js +1 -0
  45. package/locales/ja/index.js +1 -0
  46. package/locales/ko/index.esm.js +1 -0
  47. package/locales/ko/index.js +1 -0
  48. package/locales/nl/index.esm.js +1 -0
  49. package/locales/nl/index.js +1 -0
  50. package/locales/no/index.esm.js +1 -0
  51. package/locales/no/index.js +1 -0
  52. package/locales/np/index.esm.js +1 -0
  53. package/locales/np/index.js +1 -0
  54. package/locales/pl/index.esm.js +1 -0
  55. package/locales/pl/index.js +1 -0
  56. package/locales/pt/index.esm.js +1 -0
  57. package/locales/pt/index.js +1 -0
  58. package/locales/pt-BR/index.esm.js +1 -0
  59. package/locales/pt-BR/index.js +1 -0
  60. package/locales/ro/index.esm.js +1 -0
  61. package/locales/ro/index.js +1 -0
  62. package/locales/ru/index.esm.js +1 -0
  63. package/locales/ru/index.js +1 -0
  64. package/locales/sk/index.esm.js +1 -0
  65. package/locales/sk/index.js +1 -0
  66. package/locales/sr-Cyrl-RS/index.esm.js +1 -0
  67. package/locales/sr-Cyrl-RS/index.js +1 -0
  68. package/locales/sr-Latn-RS/index.esm.js +1 -0
  69. package/locales/sr-Latn-RS/index.js +1 -0
  70. package/locales/sv/index.esm.js +1 -0
  71. package/locales/sv/index.js +1 -0
  72. package/locales/tr/index.esm.js +1 -0
  73. package/locales/tr/index.js +1 -0
  74. package/locales/uk/index.esm.js +1 -0
  75. package/locales/uk/index.js +1 -0
  76. package/locales/vi/index.esm.js +1 -0
  77. package/locales/vi/index.js +1 -0
  78. package/locales/zh-Hans/index.esm.js +1 -0
  79. package/locales/zh-Hans/index.js +1 -0
  80. package/locales/zh-Hant/index.esm.js +1 -0
  81. package/locales/zh-Hant/index.js +1 -0
  82. package/package.json +31 -32
  83. package/src/components/body/MRT_TableBodyCell.tsx +2 -2
  84. package/src/components/body/MRT_TableBodyCellValue.tsx +1 -1
  85. package/src/components/body/MRT_TableBodyRow.tsx +1 -1
  86. package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +1 -1
  87. package/src/components/body/MRT_TableDetailPanel.tsx +1 -1
  88. package/src/components/buttons/MRT_EditActionButtons.tsx +2 -2
  89. package/src/components/footer/MRT_TableFooter.tsx +1 -1
  90. package/src/components/head/MRT_TableHead.tsx +1 -1
  91. package/src/components/head/MRT_TableHeadCell.tsx +2 -2
  92. package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +8 -10
  93. package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +1 -1
  94. package/src/components/inputs/MRT_EditCellTextField.tsx +5 -3
  95. package/src/components/inputs/MRT_FilterRangeSlider.tsx +12 -5
  96. package/src/components/inputs/MRT_FilterTextField.tsx +106 -70
  97. package/src/components/menus/MRT_ColumnActionMenu.tsx +3 -2
  98. package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +12 -0
  99. package/src/components/table/MRT_TableContainer.tsx +1 -1
  100. package/src/components/table/MRT_TablePaper.tsx +1 -1
  101. package/src/components/toolbar/MRT_BottomToolbar.tsx +1 -1
  102. package/src/components/toolbar/MRT_TablePagination.tsx +5 -3
  103. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +4 -4
  104. package/src/components/toolbar/MRT_TopToolbar.tsx +1 -1
  105. package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +1 -1
  106. package/src/hooks/useMRT_ColumnVirtualizer.ts +1 -1
  107. package/src/hooks/useMRT_Effects.ts +3 -3
  108. package/src/hooks/useMRT_RowVirtualizer.ts +17 -5
  109. package/src/hooks/useMRT_TableInstance.ts +1 -1
  110. package/src/locales/ar.ts +1 -0
  111. package/src/locales/az.ts +1 -0
  112. package/src/locales/bg.ts +1 -0
  113. package/src/locales/cs.ts +1 -0
  114. package/src/locales/da.ts +1 -0
  115. package/src/locales/de.ts +1 -0
  116. package/src/locales/el.ts +1 -0
  117. package/src/locales/en.ts +1 -0
  118. package/src/locales/es.ts +1 -0
  119. package/src/locales/et.ts +1 -0
  120. package/src/locales/fa.ts +1 -0
  121. package/src/locales/fi.ts +1 -0
  122. package/src/locales/fr.ts +1 -0
  123. package/src/locales/he.ts +1 -0
  124. package/src/locales/hr.ts +1 -0
  125. package/src/locales/hu.ts +1 -0
  126. package/src/locales/hy.ts +1 -0
  127. package/src/locales/id.ts +1 -0
  128. package/src/locales/it.ts +1 -0
  129. package/src/locales/ja.ts +1 -0
  130. package/src/locales/ko.ts +1 -0
  131. package/src/locales/nl.ts +1 -0
  132. package/src/locales/no.ts +1 -0
  133. package/src/locales/np.ts +1 -0
  134. package/src/locales/pl.ts +1 -0
  135. package/src/locales/pt-BR.ts +1 -0
  136. package/src/locales/pt.ts +1 -0
  137. package/src/locales/ro.ts +1 -0
  138. package/src/locales/ru.ts +1 -0
  139. package/src/locales/sk.ts +1 -0
  140. package/src/locales/sr-Cyrl-RS.ts +1 -0
  141. package/src/locales/sr-Latn-RS.ts +1 -0
  142. package/src/locales/sv.ts +1 -0
  143. package/src/locales/tr.ts +1 -0
  144. package/src/locales/uk.ts +1 -0
  145. package/src/locales/vi.ts +1 -0
  146. package/src/locales/zh-Hans.ts +1 -0
  147. package/src/locales/zh-Hant.ts +1 -0
  148. package/src/types.ts +17 -67
  149. package/src/utils/cell.utils.ts +2 -2
  150. package/src/utils/column.utils.ts +1 -1
  151. package/src/utils/tanstack.helpers.ts +1 -1
  152. package/src/utils/virtualization.utils.ts +5 -0
package/dist/index.js CHANGED
@@ -231,7 +231,7 @@ const prepareColumns = ({ columnDefs, tableOptions, }) => {
231
231
  }
232
232
  //assign sortingFns
233
233
  if (Object.keys(sortingFns).includes(columnDef.sortingFn)) {
234
- // @ts-ignore
234
+ // @ts-expect-error
235
235
  columnDef.sortingFn = sortingFns[columnDef.sortingFn];
236
236
  }
237
237
  }
@@ -513,11 +513,11 @@ const openEditingCell = ({ cell, table, }) => {
513
513
  if (isCellEditable({ cell, table }) && editDisplayMode === 'cell') {
514
514
  table.setEditingCell(cell);
515
515
  queueMicrotask(() => {
516
- var _a;
517
- const textField = editInputRefs.current[column.id];
516
+ var _a, _b;
517
+ const textField = (_a = editInputRefs.current) === null || _a === void 0 ? void 0 : _a[column.id];
518
518
  if (textField) {
519
519
  textField.focus();
520
- (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
520
+ (_b = textField.select) === null || _b === void 0 ? void 0 : _b.call(textField);
521
521
  }
522
522
  });
523
523
  }
@@ -538,7 +538,7 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
538
538
  getMRT_RowSelectionHandler({
539
539
  row: cell.row,
540
540
  table,
541
- //@ts-ignore
541
+ //@ts-expect-error
542
542
  staticRowIndex: +event.target.getAttribute('data-index'),
543
543
  })(event);
544
544
  }
@@ -865,13 +865,13 @@ const MRT_EditActionButtons = (_a) => {
865
865
  row._valuesCache = {}; //reset values cache
866
866
  };
867
867
  const handleSubmitRow = () => {
868
- var _a;
868
+ var _a, _b;
869
869
  //look for auto-filled input values
870
- (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
871
- .filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
870
+ (_b = Object.values((_a = editInputRefs.current) !== null && _a !== void 0 ? _a : {})
871
+ .filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _b === void 0 ? void 0 : _b.forEach((input) => {
872
872
  if (input.value !== undefined &&
873
873
  Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
874
- // @ts-ignore
874
+ // @ts-expect-error
875
875
  row._valuesCache[input.name] = input.value;
876
876
  }
877
877
  });
@@ -1388,6 +1388,7 @@ const MRT_Default_Icons = {
1388
1388
  };
1389
1389
 
1390
1390
  const MRT_Localization_EN = {
1391
+ language: 'en',
1391
1392
  actions: 'Actions',
1392
1393
  and: 'and',
1393
1394
  cancel: 'Cancel',
@@ -1632,8 +1633,8 @@ const useMRT_Effects = (table) => {
1632
1633
  const totalColumnCount = table.options.columns.length;
1633
1634
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
1634
1635
  const rerender = react.useReducer(() => ({}), {})[1];
1635
- const initialBodyHeight = react.useRef();
1636
- const previousTop = react.useRef();
1636
+ const initialBodyHeight = react.useRef(null);
1637
+ const previousTop = react.useRef(null);
1637
1638
  react.useEffect(() => {
1638
1639
  if (typeof window !== 'undefined') {
1639
1640
  initialBodyHeight.current = document.body.style.height;
@@ -1673,7 +1674,7 @@ const useMRT_Effects = (table) => {
1673
1674
  if (firstVisibleRowIndex >= totalRowCount) {
1674
1675
  table.setPageIndex(Math.ceil(totalRowCount / pageSize) - 1);
1675
1676
  }
1676
- }, [totalRowCount]);
1677
+ }, [totalRowCount, enablePagination, isLoading, showSkeletons]);
1677
1678
  //turn off sort when global filter is looking for ranked results
1678
1679
  const appliedSort = react.useRef(sorting);
1679
1680
  react.useEffect(() => {
@@ -1825,7 +1826,7 @@ const useMRT_TableInstance = (definedTableOptions) => {
1825
1826
  statefulTableOptions.state.isLoading,
1826
1827
  statefulTableOptions.state.showSkeletons,
1827
1828
  ]);
1828
- //@ts-ignore
1829
+ //@ts-expect-error
1829
1830
  const table = reactTable.useReactTable(Object.assign(Object.assign({ onColumnOrderChange,
1830
1831
  onColumnSizingInfoChange,
1831
1832
  onGroupingChange,
@@ -1887,6 +1888,11 @@ const useMRT_TableInstance = (definedTableOptions) => {
1887
1888
 
1888
1889
  const useMaterialReactTable = (tableOptions) => useMRT_TableInstance(useMRT_TableOptions(tableOptions));
1889
1890
 
1891
+ /**
1892
+ * When scroll, the `draggingRow` or `draggingColumn` can be removed from document because of virtualization,
1893
+ * then, the `dragEnd` event on `MRT_TableBodyRowGrabHandle` or `MRT_TableHeadCellGrabHandle` will not fire.
1894
+ * We should keep the `draggingRow` or `draggingColumn` in `getVirtualItems()` to avoid this thing.
1895
+ */
1890
1896
  const extraIndexRangeExtractor = (range, draggingIndex) => {
1891
1897
  const newIndexes = reactVirtual.defaultRangeExtractor(range);
1892
1898
  if (draggingIndex === undefined)
@@ -1955,14 +1961,13 @@ const useMRT_ColumnVirtualizer = (table) => {
1955
1961
  (numPinnedRight ? totalSize - rightNonPinnedStart : 0);
1956
1962
  }
1957
1963
  if (columnVirtualizerInstanceRef) {
1958
- //@ts-ignore
1964
+ //@ts-expect-error
1959
1965
  columnVirtualizerInstanceRef.current = columnVirtualizer;
1960
1966
  }
1961
1967
  return columnVirtualizer;
1962
1968
  };
1963
1969
 
1964
1970
  const useMRT_RowVirtualizer = (table, rows) => {
1965
- var _a;
1966
1971
  const { getRowModel, getState, options: { enableRowVirtualization, renderDetailPanel, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef }, } = table;
1967
1972
  const { density, draggingRow, expanded } = getState();
1968
1973
  if (!enableRowVirtualization)
@@ -1970,7 +1975,14 @@ const useMRT_RowVirtualizer = (table, rows) => {
1970
1975
  const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
1971
1976
  table,
1972
1977
  });
1973
- const rowCount = (_a = rows === null || rows === void 0 ? void 0 : rows.length) !== null && _a !== void 0 ? _a : getRowModel().rows.length;
1978
+ const realRows = rows !== null && rows !== void 0 ? rows : getRowModel().rows;
1979
+ /**
1980
+ * when filtering, should find the correct index in filtered rows
1981
+ */
1982
+ const draggingRowIndex = react.useMemo(() => (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id)
1983
+ ? realRows.findIndex((r) => r.id === (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id))
1984
+ : undefined, [realRows, draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id]);
1985
+ const rowCount = realRows.length;
1974
1986
  const normalRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73;
1975
1987
  const rowVirtualizer = reactVirtual.useVirtualizer(Object.assign({ count: renderDetailPanel ? rowCount * 2 : rowCount, estimateSize: (index) => renderDetailPanel && index % 2 === 1
1976
1988
  ? expanded === true
@@ -1980,12 +1992,11 @@ const useMRT_RowVirtualizer = (table, rows) => {
1980
1992
  navigator.userAgent.indexOf('Firefox') === -1
1981
1993
  ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
1982
1994
  : undefined, overscan: 4, rangeExtractor: react.useCallback((range) => {
1983
- var _a;
1984
- return extraIndexRangeExtractor(range, (_a = draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.index) !== null && _a !== void 0 ? _a : 0);
1985
- }, [draggingRow]) }, rowVirtualizerProps));
1995
+ return extraIndexRangeExtractor(range, draggingRowIndex);
1996
+ }, [draggingRowIndex]) }, rowVirtualizerProps));
1986
1997
  rowVirtualizer.virtualRows = rowVirtualizer.getVirtualItems();
1987
1998
  if (rowVirtualizerInstanceRef) {
1988
- //@ts-ignore
1999
+ //@ts-expect-error
1989
2000
  rowVirtualizerInstanceRef.current = rowVirtualizer;
1990
2001
  }
1991
2002
  return rowVirtualizer;
@@ -2144,7 +2155,7 @@ const MRT_EditCellTextField = (_a) => {
2144
2155
  });
2145
2156
  const isSelectEdit = editVariant === 'select' || (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select);
2146
2157
  const saveInputValueToRowCache = (newValue) => {
2147
- //@ts-ignore
2158
+ //@ts-expect-error
2148
2159
  row._valuesCache[column.id] = newValue;
2149
2160
  if (isCreating) {
2150
2161
  setCreatingRow(row);
@@ -2168,10 +2179,10 @@ const MRT_EditCellTextField = (_a) => {
2168
2179
  setEditingCell(null);
2169
2180
  };
2170
2181
  const handleEnterKeyDown = (event) => {
2171
- var _a, _b;
2182
+ var _a, _b, _c;
2172
2183
  (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2173
2184
  if (event.key === 'Enter' && !event.shiftKey && completesComposition) {
2174
- (_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
2185
+ (_c = (_b = editInputRefs.current) === null || _b === void 0 ? void 0 : _b[column.id]) === null || _c === void 0 ? void 0 : _c.blur();
2175
2186
  }
2176
2187
  };
2177
2188
  if (columnDef.Edit) {
@@ -2179,7 +2190,9 @@ const MRT_EditCellTextField = (_a) => {
2179
2190
  }
2180
2191
  return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: parseFromValuesOrFunc(columnDef.enableEditing, row) === false, fullWidth: true, inputRef: (inputRef) => {
2181
2192
  if (inputRef) {
2182
- editInputRefs.current[column.id] = inputRef;
2193
+ editInputRefs.current[column.id] = isSelectEdit
2194
+ ? inputRef.node
2195
+ : inputRef;
2183
2196
  if (textFieldProps.inputRef) {
2184
2197
  textFieldProps.inputRef = inputRef;
2185
2198
  }
@@ -2296,7 +2309,7 @@ const MRT_TableBodyCell = (_a) => {
2296
2309
  const showClickToCopyButton = (parseFromValuesOrFunc(enableClickToCopy, cell) === true ||
2297
2310
  parseFromValuesOrFunc(columnDef.enableClickToCopy, cell) === true) &&
2298
2311
  !['context-menu', false].includes(
2299
- // @ts-ignore
2312
+ // @ts-expect-error
2300
2313
  parseFromValuesOrFunc(columnDef.enableClickToCopy, cell));
2301
2314
  const isRightClickable = parseFromValuesOrFunc(enableCellActions, cell);
2302
2315
  const cellValueProps = {
@@ -2452,7 +2465,7 @@ const MRT_TableBodyRow = (_a) => {
2452
2465
  const sx = parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme);
2453
2466
  const defaultRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
2454
2467
  const customRowHeight =
2455
- // @ts-ignore
2468
+ // @ts-expect-error
2456
2469
  parseInt((_f = (_d = tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) === null || _d === void 0 ? void 0 : _d.height) !== null && _f !== void 0 ? _f : sx === null || sx === void 0 ? void 0 : sx.height, 10) || undefined;
2457
2470
  const rowHeight = customRowHeight || defaultRowHeight;
2458
2471
  const handleDragEnter = (_e) => {
@@ -2694,7 +2707,7 @@ const MRT_TableFooter = (_a) => {
2694
2707
  return (jsxRuntime.jsx(TableFooter__default["default"], Object.assign({}, tableFooterProps, { ref: (ref) => {
2695
2708
  tableFooterRef.current = ref;
2696
2709
  if (tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.ref) {
2697
- // @ts-ignore
2710
+ // @ts-expect-error
2698
2711
  tableFooterProps.ref.current = ref;
2699
2712
  }
2700
2713
  }, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
@@ -2955,7 +2968,7 @@ const MRT_ColumnActionMenu = (_a) => {
2955
2968
  };
2956
2969
  const handleFilterByColumn = () => {
2957
2970
  setShowColumnFilters(true);
2958
- queueMicrotask(() => { var _a; return (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus(); });
2971
+ queueMicrotask(() => { var _a, _b; return (_b = (_a = filterInputRefs.current) === null || _a === void 0 ? void 0 : _a[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.focus(); });
2959
2972
  setAnchorEl(null);
2960
2973
  };
2961
2974
  const handleShowAllColumns = () => {
@@ -2978,7 +2991,7 @@ const MRT_ColumnActionMenu = (_a) => {
2978
2991
  const internalColumnMenuItems = [
2979
2992
  ...(enableSorting && column.getCanSort()
2980
2993
  ? [
2981
- enableSortingRemoval !== false && (jsxRuntime.jsx(MRT_ActionMenuItem, { icon: jsxRuntime.jsx(ClearAllIcon, {}), label: localization.clearSort, onClick: handleClearSort, table: table }, 0)),
2994
+ enableSortingRemoval !== false && (jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: column.getIsSorted() === false, icon: jsxRuntime.jsx(ClearAllIcon, {}), label: localization.clearSort, onClick: handleClearSort, table: table }, 0)),
2982
2995
  jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: column.getIsSorted() === 'asc', icon: jsxRuntime.jsx(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } }), label: (_c = localization.sortByColumnAsc) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header)), onClick: handleSortAsc, table: table }, 1),
2983
2996
  jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: column.getIsSorted() === 'desc', divider: enableColumnFilters || enableGrouping || enableHiding, icon: jsxRuntime.jsx(SortIcon, {}), label: (_d = localization.sortByColumnDesc) === null || _d === void 0 ? void 0 : _d.replace('{column}', String(columnDef.header)), onClick: handleSortDesc, table: table }, 2),
2984
2997
  ]
@@ -3008,7 +3021,7 @@ const MRT_ColumnActionMenu = (_a) => {
3008
3021
  : []),
3009
3022
  ...(enableColumnResizing && column.getCanResize()
3010
3023
  ? [
3011
- jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: !columnSizing[column.id], icon: jsxRuntime.jsx(RestartAltIcon, {}), label: localization.resetColumnSize, onClick: handleResetColumnSize, table: table }, 10),
3024
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: columnSizing[column.id] === undefined, icon: jsxRuntime.jsx(RestartAltIcon, {}), label: localization.resetColumnSize, onClick: handleResetColumnSize, table: table }, 10),
3012
3025
  ]
3013
3026
  : []),
3014
3027
  ...(enableHiding
@@ -3091,7 +3104,7 @@ const MRT_FilterCheckbox = (_a) => {
3091
3104
  };
3092
3105
 
3093
3106
  const MRT_FilterTextField = (_a) => {
3094
- var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
3107
+ var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
3095
3108
  var { header, rangeFilterIndex, table } = _a, rest = __rest(_a, ["header", "rangeFilterIndex", "table"]);
3096
3109
  const { options: { enableColumnFilterModes, icons: { CloseIcon, FilterListIcon }, localization, manualFiltering, muiFilterAutocompleteProps, muiFilterDatePickerProps, muiFilterDateTimePickerProps, muiFilterTextFieldProps, muiFilterTimePickerProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
3097
3110
  const { column } = header;
@@ -3106,9 +3119,8 @@ const MRT_FilterTextField = (_a) => {
3106
3119
  const { allowedColumnFilterOptions, currentFilterOption, facetedUniqueValues, isAutocompleteFilter, isDateFilter, isMultiSelectFilter, isRangeFilter, isSelectFilter, isTextboxFilter, } = getColumnFilterInfo({ header, table });
3107
3120
  const dropdownOptions = useDropdownOptions({ header, table });
3108
3121
  const filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption)
3109
- ? //@ts-ignore
3110
- localization[`filter${((_c = (_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt) === null || _b === void 0 ? void 0 : _b.call(currentFilterOption, 0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
3111
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
3122
+ ? localization[`filter${((_c = (_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt) === null || _b === void 0 ? void 0 : _b.call(currentFilterOption, 0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
3123
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
3112
3124
  : '';
3113
3125
  const filterPlaceholder = !isRangeFilter
3114
3126
  ? ((_d = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.placeholder) !== null && _d !== void 0 ? _d : (_f = localization.filterByColumn) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header)))
@@ -3129,9 +3141,11 @@ const MRT_FilterTextField = (_a) => {
3129
3141
  ? column.getFilterValue() || []
3130
3142
  : isRangeFilter
3131
3143
  ? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || ''
3132
- : ((_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '');
3144
+ : isAutocompleteFilter
3145
+ ? typeof column.getFilterValue() === 'string' ? column.getFilterValue() : ''
3146
+ : ((_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '');
3133
3147
  });
3134
- const [autocompleteValue, setAutocompleteValue] = react.useState(isAutocompleteFilter ? filterValue : null);
3148
+ const [autocompleteValue, setAutocompleteValue] = react.useState(() => isAutocompleteFilter ? (column.getFilterValue() || null) : null);
3135
3149
  const handleChangeDebounced = react.useCallback(utils.debounce((newValue) => {
3136
3150
  if (isRangeFilter) {
3137
3151
  column.setFilterValue((old) => {
@@ -3158,9 +3172,12 @@ const MRT_FilterTextField = (_a) => {
3158
3172
  handleChange(newValue);
3159
3173
  (_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
3160
3174
  };
3175
+ const handleAutocompleteInputChange = (_event, newValue, _reason) => {
3176
+ handleChange(newValue);
3177
+ };
3161
3178
  const handleAutocompleteChange = (newValue) => {
3162
3179
  setAutocompleteValue(newValue);
3163
- handleChange(getValueAndLabel(newValue).value);
3180
+ handleChangeDebounced(getValueAndLabel(newValue).value);
3164
3181
  };
3165
3182
  const handleClear = () => {
3166
3183
  if (isMultiSelectFilter) {
@@ -3175,6 +3192,13 @@ const MRT_FilterTextField = (_a) => {
3175
3192
  return newFilterValues;
3176
3193
  });
3177
3194
  }
3195
+ else if (isAutocompleteFilter) {
3196
+ setAutocompleteValue(null);
3197
+ setFilterValue('');
3198
+ // when using 'autocomplete' this function is called only inside effect and only if the filterValue === undefined
3199
+ // so the following call is excessive; should be uncommented if the handleClear becomes part of the Autocomplete component callbacks
3200
+ // column.setFilterValue(undefined)
3201
+ }
3178
3202
  else {
3179
3203
  setFilterValue('');
3180
3204
  column.setFilterValue(undefined);
@@ -3210,33 +3234,17 @@ const MRT_FilterTextField = (_a) => {
3210
3234
  if (columnDef.Filter) {
3211
3235
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_g = columnDef.Filter) === null || _g === void 0 ? void 0 : _g.call(columnDef, { column, header, rangeFilterIndex, table }) }));
3212
3236
  }
3213
- const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsxRuntime.jsx(InputAdornment__default["default"], { position: "end", sx: { mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined }, children: jsxRuntime.jsx(Tooltip__default["default"], { placement: "right", title: (_h = localization.clearFilter) !== null && _h !== void 0 ? _h : '', children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.clearFilter, disabled: !((_j = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _j === void 0 ? void 0 : _j.length), onClick: handleClear, size: "small", sx: {
3237
+ const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsxRuntime.jsx(InputAdornment__default["default"], { position: "end", sx: {
3238
+ mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined,
3239
+ visibility: ((_h = filterValue === null || filterValue === void 0 ? void 0 : filterValue.length) !== null && _h !== void 0 ? _h : 0) > 0 ? 'visible' : 'hidden',
3240
+ }, children: jsxRuntime.jsx(Tooltip__default["default"], { placement: "right", title: (_j = localization.clearFilter) !== null && _j !== void 0 ? _j : '', children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.clearFilter, disabled: !((_k = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _k === void 0 ? void 0 : _k.length), onClick: handleClear, size: "small", sx: {
3214
3241
  height: '2rem',
3215
3242
  transform: 'scale(0.9)',
3216
3243
  width: '2rem',
3217
3244
  }, children: jsxRuntime.jsx(CloseIcon, {}) }) }) }) })) : null;
3218
3245
  const startAdornment = showChangeModeButton ? (jsxRuntime.jsxs(InputAdornment__default["default"], { position: "start", children: [jsxRuntime.jsx(Tooltip__default["default"], { title: localization.changeFilterMode, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.changeFilterMode, onClick: handleFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsxRuntime.jsx(FilterListIcon, {}) }) }) }), filterChipLabel && (jsxRuntime.jsx(Chip__default["default"], { label: filterChipLabel, onDelete: handleClearEmptyFilterChip }))] })) : null;
3219
- const commonTextFieldProps = Object.assign(Object.assign({ FormHelperTextProps: {
3220
- sx: {
3221
- fontSize: '0.75rem',
3222
- lineHeight: '0.8rem',
3223
- whiteSpace: 'nowrap',
3224
- },
3225
- }, InputProps: endAdornment //hack because mui looks for presence of endAdornment key instead of undefined
3226
- ? { endAdornment, startAdornment }
3227
- : { startAdornment }, fullWidth: true, helperText: showChangeModeButton ? (jsxRuntime.jsx("label", { children: localization.filterMode.replace('{filterType}',
3228
- // @ts-ignore
3229
- localization[`filter${((_k = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _k === void 0 ? void 0 : _k.toUpperCase()) +
3230
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null, inputProps: {
3231
- 'aria-label': filterPlaceholder,
3232
- autoComplete: 'off',
3233
- disabled: !!filterChipLabel,
3234
- sx: {
3235
- textOverflow: 'ellipsis',
3236
- width: filterChipLabel ? 0 : undefined,
3237
- },
3238
- title: filterPlaceholder,
3239
- }, inputRef: (inputRef) => {
3246
+ const commonTextFieldProps = Object.assign(Object.assign({ fullWidth: true, helperText: showChangeModeButton ? (jsxRuntime.jsx("label", { children: localization.filterMode.replace('{filterType}', localization[`filter${((_l = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _l === void 0 ? void 0 : _l.toUpperCase()) +
3247
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null, inputRef: (inputRef) => {
3240
3248
  filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
3241
3249
  inputRef;
3242
3250
  if (textFieldProps.inputRef) {
@@ -3244,7 +3252,16 @@ const MRT_FilterTextField = (_a) => {
3244
3252
  }
3245
3253
  }, margin: 'none', placeholder: filterChipLabel || isSelectFilter || isMultiSelectFilter
3246
3254
  ? undefined
3247
- : filterPlaceholder, variant: 'standard' }, textFieldProps), { onKeyDown: (e) => {
3255
+ : filterPlaceholder, variant: 'standard' }, textFieldProps), { slotProps: Object.assign(Object.assign({}, textFieldProps.slotProps), { formHelperText: Object.assign({ sx: {
3256
+ fontSize: '0.75rem',
3257
+ lineHeight: '0.8rem',
3258
+ whiteSpace: 'nowrap',
3259
+ } }, (_m = textFieldProps.slotProps) === null || _m === void 0 ? void 0 : _m.formHelperText), input: endAdornment //hack because mui looks for presence of endAdornment key instead of undefined
3260
+ ? { endAdornment, startAdornment }
3261
+ : { startAdornment }, htmlInput: Object.assign({ 'aria-label': filterPlaceholder, autoComplete: 'off', disabled: !!filterChipLabel, sx: {
3262
+ textOverflow: 'ellipsis',
3263
+ width: filterChipLabel ? 0 : undefined,
3264
+ }, title: filterPlaceholder }, (_o = textFieldProps.slotProps) === null || _o === void 0 ? void 0 : _o.htmlInput) }), onKeyDown: (e) => {
3248
3265
  var _a;
3249
3266
  e.stopPropagation();
3250
3267
  (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
@@ -3264,32 +3281,32 @@ const MRT_FilterTextField = (_a) => {
3264
3281
  value: filterValue || null,
3265
3282
  };
3266
3283
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('time')) ? (jsxRuntime.jsx(TimePicker.TimePicker, Object.assign({}, commonDatePickerProps, timePickerProps, { slotProps: {
3267
- field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_l = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.slotProps) === null || _l === void 0 ? void 0 : _l.field),
3268
- textField: Object.assign(Object.assign({}, commonTextFieldProps), (_m = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.slotProps) === null || _m === void 0 ? void 0 : _m.textField),
3284
+ field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_p = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.slotProps) === null || _p === void 0 ? void 0 : _p.field),
3285
+ textField: Object.assign(Object.assign({}, commonTextFieldProps), (_q = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.slotProps) === null || _q === void 0 ? void 0 : _q.textField),
3269
3286
  } }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('datetime')) ? (jsxRuntime.jsx(DateTimePicker.DateTimePicker, Object.assign({}, commonDatePickerProps, dateTimePickerProps, { slotProps: {
3270
- field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_o = dateTimePickerProps === null || dateTimePickerProps === void 0 ? void 0 : dateTimePickerProps.slotProps) === null || _o === void 0 ? void 0 : _o.field),
3271
- textField: Object.assign(Object.assign({}, commonTextFieldProps), (_p = dateTimePickerProps === null || dateTimePickerProps === void 0 ? void 0 : dateTimePickerProps.slotProps) === null || _p === void 0 ? void 0 : _p.textField),
3287
+ field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_r = dateTimePickerProps === null || dateTimePickerProps === void 0 ? void 0 : dateTimePickerProps.slotProps) === null || _r === void 0 ? void 0 : _r.field),
3288
+ textField: Object.assign(Object.assign({}, commonTextFieldProps), (_s = dateTimePickerProps === null || dateTimePickerProps === void 0 ? void 0 : dateTimePickerProps.slotProps) === null || _s === void 0 ? void 0 : _s.textField),
3272
3289
  } }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('date')) ? (jsxRuntime.jsx(DatePicker.DatePicker, Object.assign({}, commonDatePickerProps, datePickerProps, { slotProps: {
3273
- field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_q = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _q === void 0 ? void 0 : _q.field),
3274
- textField: Object.assign(Object.assign({}, commonTextFieldProps), (_r = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _r === void 0 ? void 0 : _r.textField),
3275
- } }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ freeSolo: true, getOptionLabel: (option) => getValueAndLabel(option).label,
3276
- // @ts-ignore
3277
- onChange: (_e, newValue) => handleAutocompleteChange(newValue), options: (_s = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option) => getValueAndLabel(option))) !== null && _s !== void 0 ? _s : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
3278
- var _a;
3279
- return (jsxRuntime.jsx(TextField__default["default"], Object.assign({}, builtinTextFieldProps, commonTextFieldProps, { InputProps: Object.assign(Object.assign({}, builtinTextFieldProps.InputProps), { startAdornment: (_a = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.startAdornment }), inputProps: Object.assign(Object.assign({}, builtinTextFieldProps.inputProps), commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.inputProps), onChange: handleTextFieldChange, onClick: (e) => e.stopPropagation() })));
3280
- }, value: autocompleteValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { SelectProps: Object.assign({ MenuProps: { disableScrollLock: true }, displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
3281
- ? (selected) => !Array.isArray(selected) || selected.length === 0 ? (jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder })) : (jsxRuntime.jsx(Box__default["default"], { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' }, children: selected.map((value) => {
3282
- const selectedValue = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.find((option) => getValueAndLabel(option).value === value);
3283
- return (jsxRuntime.jsx(Chip__default["default"], { label: getValueAndLabel(selectedValue).label }, value));
3284
- }) }))
3285
- : undefined }, commonTextFieldProps.SelectProps), onChange: handleTextFieldChange, onClick: (e) => e.stopPropagation(), value: isMultiSelectFilter
3290
+ field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_t = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _t === void 0 ? void 0 : _t.field),
3291
+ textField: Object.assign(Object.assign({}, commonTextFieldProps), (_u = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _u === void 0 ? void 0 : _u.textField),
3292
+ } }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ freeSolo: true, getOptionLabel: (option) => getValueAndLabel(option).label, onChange: (_e, newValue) => handleAutocompleteChange(newValue), options: (_v = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option) => getValueAndLabel(option))) !== null && _v !== void 0 ? _v : [], inputValue: filterValue, onInputChange: handleAutocompleteInputChange }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
3293
+ var _a, _b, _c, _d, _f;
3294
+ return (jsxRuntime.jsx(TextField__default["default"], Object.assign({}, commonTextFieldProps, builtinTextFieldProps, { slotProps: Object.assign(Object.assign(Object.assign({}, builtinTextFieldProps.slotProps), commonTextFieldProps.slotProps), { input: Object.assign(Object.assign(Object.assign({}, builtinTextFieldProps.InputProps), (_a = builtinTextFieldProps.slotProps) === null || _a === void 0 ? void 0 : _a.input), { startAdornment:
3295
+ //@ts-expect-error
3296
+ (_c = (_b = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.slotProps) === null || _b === void 0 ? void 0 : _b.input) === null || _c === void 0 ? void 0 : _c.startAdornment }), htmlInput: Object.assign(Object.assign(Object.assign({}, builtinTextFieldProps.inputProps), (_d = builtinTextFieldProps.slotProps) === null || _d === void 0 ? void 0 : _d.htmlInput), (_f = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.slotProps) === null || _f === void 0 ? void 0 : _f.htmlInput) }), onClick: (e) => e.stopPropagation() })));
3297
+ }, value: autocompleteValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { slotProps: Object.assign(Object.assign({}, commonTextFieldProps.slotProps), { inputLabel: Object.assign({ shrink: isSelectFilter || isMultiSelectFilter }, (_w = commonTextFieldProps.slotProps) === null || _w === void 0 ? void 0 : _w.inputLabel), select: Object.assign({ MenuProps: { disableScrollLock: true }, displayEmpty: true, multiple: isMultiSelectFilter, renderValue: isMultiSelectFilter
3298
+ ? (selected) => !Array.isArray(selected) || (selected === null || selected === void 0 ? void 0 : selected.length) === 0 ? (jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder })) : (jsxRuntime.jsx(Box__default["default"], { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' }, children: selected.map((value) => {
3299
+ const selectedValue = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.find((option) => getValueAndLabel(option).value === value);
3300
+ return (jsxRuntime.jsx(Chip__default["default"], { label: getValueAndLabel(selectedValue).label }, value));
3301
+ }) }))
3302
+ : undefined }, (_x = commonTextFieldProps.slotProps) === null || _x === void 0 ? void 0 : _x.select) }), onChange: handleTextFieldChange, onClick: (e) => e.stopPropagation(), value: isMultiSelectFilter
3286
3303
  ? Array.isArray(filterValue)
3287
3304
  ? filterValue
3288
3305
  : []
3289
3306
  : filterValue, children: (isSelectFilter || isMultiSelectFilter) && [
3290
3307
  jsxRuntime.jsx(MenuItem__default["default"], { disabled: true, divider: true, hidden: true, value: "", children: jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder }) }, "p"),
3291
3308
  ...[
3292
- (_t = textFieldProps.children) !== null && _t !== void 0 ? _t : dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option, index) => {
3309
+ (_y = textFieldProps.children) !== null && _y !== void 0 ? _y : dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option, index) => {
3293
3310
  var _a;
3294
3311
  const { label, value } = getValueAndLabel(option);
3295
3312
  return (jsxRuntime.jsxs(MenuItem__default["default"], { sx: {
@@ -3333,6 +3350,12 @@ const MRT_FilterRangeSlider = (_a) => {
3333
3350
  const [filterValues, setFilterValues] = react.useState([min, max]);
3334
3351
  const columnFilterValue = column.getFilterValue();
3335
3352
  const isMounted = react.useRef(false);
3353
+ // prevent moving the focus to the next/prev cell when using the arrow keys
3354
+ const handleKeyDown = (event) => {
3355
+ if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
3356
+ event.stopPropagation();
3357
+ }
3358
+ };
3336
3359
  react.useEffect(() => {
3337
3360
  if (isMounted.current) {
3338
3361
  if (columnFilterValue === undefined) {
@@ -3356,15 +3379,15 @@ const MRT_FilterRangeSlider = (_a) => {
3356
3379
  column.setFilterValue(value);
3357
3380
  }
3358
3381
  }
3359
- }, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
3382
+ }, onKeyDown: handleKeyDown, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
3360
3383
  input: {
3361
3384
  ref: (node) => {
3362
3385
  var _a, _b;
3363
3386
  if (node) {
3364
3387
  filterInputRefs.current[`${column.id}-0`] = node;
3365
- // @ts-ignore
3388
+ // @ts-expect-error
3366
3389
  if ((_b = (_a = sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.slotProps) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.ref) {
3367
- //@ts-ignore
3390
+ //@ts-expect-error
3368
3391
  sliderProps.slotProps.input.ref = node;
3369
3392
  }
3370
3393
  }
@@ -3375,9 +3398,7 @@ const MRT_FilterRangeSlider = (_a) => {
3375
3398
  lineHeight: '0.8rem',
3376
3399
  m: '-3px -6px',
3377
3400
  whiteSpace: 'nowrap',
3378
- }, children: localization.filterMode.replace('{filterType}',
3379
- // @ts-ignore
3380
- localization[`filter${((_c = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
3401
+ }, children: localization.filterMode.replace('{filterType}', localization[`filter${((_c = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
3381
3402
  (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
3382
3403
  };
3383
3404
 
@@ -3392,7 +3413,7 @@ const MRT_TableHeadCellFilterContainer = (_a) => {
3392
3413
  };
3393
3414
 
3394
3415
  const MRT_TableHeadCellFilterLabel = (_a) => {
3395
- var _b, _c;
3416
+ var _b;
3396
3417
  var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
3397
3418
  const { options: { columnFilterDisplayMode, icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
3398
3419
  const { column } = header;
@@ -3410,9 +3431,8 @@ const MRT_TableHeadCellFilterLabel = (_a) => {
3410
3431
  : localization.filteringByColumn
3411
3432
  .replace('{column}', String(columnDef.header))
3412
3433
  .replace('{filterType}', currentFilterOption
3413
- ? // @ts-ignore
3414
- localization[`filter${((_c = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
3415
- (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
3434
+ ? localization[`filter${currentFilterOption.charAt(0).toUpperCase() +
3435
+ currentFilterOption.slice(1)}`]
3416
3436
  : '')
3417
3437
  .replace('{filterValue}', `"${Array.isArray(filterValue)
3418
3438
  ? filterValue
@@ -3424,8 +3444,7 @@ const MRT_TableHeadCellFilterLabel = (_a) => {
3424
3444
  .replace('" "', '');
3425
3445
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Grow__default["default"], { in: columnFilterDisplayMode === 'popover' ||
3426
3446
  (!!filterValue && !isRangeFilter) ||
3427
- (isRangeFilter && // @ts-ignore
3428
- (!!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[0]) || !!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[1]))), unmountOnExit: true, children: jsxRuntime.jsx(Box__default["default"], { component: "span", sx: { flex: '0 0' }, children: jsxRuntime.jsx(Tooltip__default["default"], { placement: "top", title: filterTooltip, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ disableRipple: true, onClick: (event) => {
3447
+ (isRangeFilter && (!!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[0]) || !!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[1]))), unmountOnExit: true, children: jsxRuntime.jsx(Box__default["default"], { component: "span", sx: { flex: '0 0' }, children: jsxRuntime.jsx(Tooltip__default["default"], { placement: "top", title: filterTooltip, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ disableRipple: true, onClick: (event) => {
3429
3448
  if (columnFilterDisplayMode === 'popover') {
3430
3449
  setAnchorEl(event.currentTarget);
3431
3450
  }
@@ -3433,16 +3452,16 @@ const MRT_TableHeadCellFilterLabel = (_a) => {
3433
3452
  setShowColumnFilters(true);
3434
3453
  }
3435
3454
  queueMicrotask(() => {
3436
- var _a, _b, _c, _d;
3437
- (_b = (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3438
- (_d = (_c = filterInputRefs.current[`${column.id}-0`]) === null || _c === void 0 ? void 0 : _c.select) === null || _d === void 0 ? void 0 : _d.call(_c);
3455
+ var _a, _b, _c, _d, _e, _f;
3456
+ (_c = (_b = (_a = filterInputRefs.current) === null || _a === void 0 ? void 0 : _a[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.focus) === null || _c === void 0 ? void 0 : _c.call(_b);
3457
+ (_f = (_e = (_d = filterInputRefs.current) === null || _d === void 0 ? void 0 : _d[`${column.id}-0`]) === null || _e === void 0 ? void 0 : _e.select) === null || _f === void 0 ? void 0 : _f.call(_e);
3439
3458
  });
3440
3459
  event.stopPropagation();
3441
3460
  }, size: "small" }, rest, { sx: (theme) => (Object.assign({ height: '16px', ml: '4px', opacity: isFilterActive ? 1 : 0.3, p: '8px', transform: 'scale(0.75)', transition: 'all 150ms ease-in-out', width: '16px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsxRuntime.jsx(FilterAltIcon, {}) })) }) }) }), columnFilterDisplayMode === 'popover' && (jsxRuntime.jsx(Popover__default["default"], { anchorEl: anchorEl, anchorOrigin: {
3442
3461
  horizontal: 'center',
3443
3462
  vertical: 'top',
3444
3463
  }, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: (event) => {
3445
- //@ts-ignore
3464
+ //@ts-expect-error
3446
3465
  event.stopPropagation();
3447
3466
  setAnchorEl(null);
3448
3467
  }, onKeyDown: (event) => event.key === 'Enter' && setAnchorEl(null), open: !!anchorEl, slotProps: { paper: { sx: { overflow: 'visible' } } }, transformOrigin: {
@@ -3561,7 +3580,7 @@ const MRT_TableHeadCellSortLabel = (_a) => {
3561
3580
  };
3562
3581
 
3563
3582
  const MRT_TableHeadCell = (_a) => {
3564
- var _b, _c, _d, _f, _g, _h;
3583
+ var _b, _c, _d, _f, _g, _h, _j;
3565
3584
  var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
3566
3585
  const theme = styles.useTheme();
3567
3586
  const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
@@ -3728,7 +3747,7 @@ const MRT_TableHeadCell = (_a) => {
3728
3747
  }, children: HeaderElement }), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: {
3729
3748
  whiteSpace: 'nowrap',
3730
3749
  }, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
3731
- current: tableHeadCellRefs.current[column.id],
3750
+ current: (_j = tableHeadCellRefs.current) === null || _j === void 0 ? void 0 : _j[column.id],
3732
3751
  } })), showColumnActions && (jsxRuntime.jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsxRuntime.jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] }))), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
3733
3752
  };
3734
3753
 
@@ -3756,7 +3775,7 @@ const MRT_TableHeadRow = (_a) => {
3756
3775
  const MRT_ToolbarAlertBanner = (_a) => {
3757
3776
  var _b, _c, _d;
3758
3777
  var { stackAlertBanner, table } = _a, rest = __rest(_a, ["stackAlertBanner", "table"]);
3759
- const { getFilteredSelectedRowModel, getPrePaginationRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, manualPagination, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
3778
+ const { getFilteredSelectedRowModel, getCoreRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, manualPagination, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
3760
3779
  const { density, grouping, rowSelection, showAlertBanner } = getState();
3761
3780
  const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
3762
3781
  table,
@@ -3764,11 +3783,11 @@ const MRT_ToolbarAlertBanner = (_a) => {
3764
3783
  const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
3765
3784
  table,
3766
3785
  });
3767
- const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().flatRows.length;
3786
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getCoreRowModel().rows.length;
3768
3787
  const selectedRowCount = react.useMemo(() => manualPagination
3769
3788
  ? Object.values(rowSelection).filter(Boolean).length
3770
3789
  : getFilteredSelectedRowModel().rows.length, [rowSelection, totalRowCount, manualPagination]);
3771
- const selectedAlert = selectedRowCount > 0 ? (jsxRuntime.jsxs(Stack__default["default"], { alignItems: "center", direction: "row", gap: "16px", children: [(_c = (_b = localization.selectedCountOfRowCountRowsSelected) === null || _b === void 0 ? void 0 : _b.replace('{selectedCount}', selectedRowCount.toLocaleString())) === null || _c === void 0 ? void 0 : _c.replace('{rowCount}', totalRowCount.toString()), jsxRuntime.jsx(Button__default["default"], { onClick: (event) => getMRT_SelectAllHandler({ table })(event, false, true), size: "small", sx: { p: '2px' }, children: localization.clearSelection })] })) : null;
3790
+ const selectedAlert = selectedRowCount > 0 ? (jsxRuntime.jsxs(Stack__default["default"], { alignItems: "center", direction: "row", gap: "16px", children: [(_c = (_b = localization.selectedCountOfRowCountRowsSelected) === null || _b === void 0 ? void 0 : _b.replace('{selectedCount}', selectedRowCount.toLocaleString(localization.language))) === null || _c === void 0 ? void 0 : _c.replace('{rowCount}', totalRowCount.toLocaleString(localization.language)), jsxRuntime.jsx(Button__default["default"], { onClick: (event) => getMRT_SelectAllHandler({ table })(event, false, true), size: "small", sx: { p: '2px' }, children: localization.clearSelection })] })) : null;
3772
3791
  const groupedAlert = grouping.length > 0 ? (jsxRuntime.jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxRuntime.jsxs(react.Fragment, { children: [index > 0 ? localization.thenBy : '', jsxRuntime.jsx(Chip__default["default"], Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
3773
3792
  return (jsxRuntime.jsx(Collapse__default["default"], { in: showAlertBanner || !!selectedAlert || !!groupedAlert, timeout: stackAlertBanner ? 200 : 0, children: jsxRuntime.jsx(Alert__default["default"], Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => {
3774
3793
  var _a, _b;
@@ -3806,7 +3825,7 @@ const MRT_TableHead = (_a) => {
3806
3825
  return (jsxRuntime.jsx(TableHead__default["default"], Object.assign({}, tableHeadProps, { ref: (ref) => {
3807
3826
  tableHeadRef.current = ref;
3808
3827
  if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
3809
- // @ts-ignore
3828
+ // @ts-expect-error
3810
3829
  tableHeadProps.ref.current = ref;
3811
3830
  }
3812
3831
  }, sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, parseFromValuesOrFunc(tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx, theme))), children: positionToolbarAlertBanner === 'head-overlay' &&
@@ -3977,7 +3996,7 @@ const MRT_TableContainer = (_a) => {
3977
3996
  if (node) {
3978
3997
  tableContainerRef.current = node;
3979
3998
  if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
3980
- //@ts-ignore
3999
+ //@ts-expect-error
3981
4000
  tableContainerProps.ref.current = node;
3982
4001
  }
3983
4002
  }
@@ -4053,7 +4072,9 @@ const MRT_TablePagination = (_a) => {
4053
4072
  last: LastPageIcon,
4054
4073
  next: ChevronRightIcon,
4055
4074
  previous: ChevronLeftIcon,
4056
- } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, restPaginationProps))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToFirstPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () => table.firstPage(), size: "small", children: jsxRuntime.jsx(FirstPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) }))), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToPreviousPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: disableBack, onClick: () => table.previousPage(), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToNextPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: disableNext, onClick: () => table.nextPage(), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), showLastButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToLastPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: disableNext, onClick: () => table.lastPage(), size: "small", children: jsxRuntime.jsx(LastPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) })))] })] })) : null] }));
4075
+ } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, restPaginationProps))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, variant: "body2", children: `${lastRowIndex === 0
4076
+ ? 0
4077
+ : (firstRowIndex + 1).toLocaleString(localization.language)}-${lastRowIndex.toLocaleString(localization.language)} ${localization.of} ${totalRowCount.toLocaleString(localization.language)}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToFirstPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () => table.firstPage(), size: "small", children: jsxRuntime.jsx(FirstPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) }))), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToPreviousPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: disableBack, onClick: () => table.previousPage(), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToNextPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: disableNext, onClick: () => table.nextPage(), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), showLastButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToLastPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: disableNext, onClick: () => table.lastPage(), size: "small", children: jsxRuntime.jsx(LastPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) })))] })] })) : null] }));
4057
4078
  };
4058
4079
 
4059
4080
  const MRT_ToolbarDropZone = (_a) => {
@@ -4090,7 +4111,7 @@ const MRT_BottomToolbar = (_a) => {
4090
4111
  if (node) {
4091
4112
  bottomToolbarRef.current = node;
4092
4113
  if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
4093
- // @ts-ignore
4114
+ // @ts-expect-error
4094
4115
  toolbarProps.ref.current = node;
4095
4116
  }
4096
4117
  }
@@ -4193,7 +4214,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
4193
4214
 
4194
4215
  const MRT_ShowHideColumnsMenu = (_a) => {
4195
4216
  var { anchorEl, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "setAnchorEl", "table"]);
4196
- const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, mrtTheme: { menuBackgroundColor }, }, } = table;
4217
+ const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, initialState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, mrtTheme: { menuBackgroundColor }, }, } = table;
4197
4218
  const { columnOrder, columnPinning, density } = getState();
4198
4219
  const handleToggleAllColumns = (value) => {
4199
4220
  getAllLeafColumns()
@@ -4220,6 +4241,8 @@ const MRT_ShowHideColumnsMenu = (_a) => {
4220
4241
  getRightLeafColumns(),
4221
4242
  ]);
4222
4243
  const isNestedColumns = allColumns.some((col) => col.columnDef.columnDefType === 'group');
4244
+ const hasColumnOrderChanged = react.useMemo(() => columnOrder.length !== initialState.columnOrder.length ||
4245
+ !columnOrder.every((column, index) => column === initialState.columnOrder[index]), [columnOrder, initialState.columnOrder]);
4223
4246
  const [hoveredColumn, setHoveredColumn] = react.useState(null);
4224
4247
  return (jsxRuntime.jsxs(Menu__default["default"], Object.assign({ MenuListProps: {
4225
4248
  dense: density === 'compact',
@@ -4231,7 +4254,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
4231
4254
  justifyContent: 'space-between',
4232
4255
  p: '0.5rem',
4233
4256
  pt: 0,
4234
- }, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
4257
+ }, children: [enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsVisible(), onClick: () => handleToggleAllColumns(false), children: localization.hideAll })), enableColumnOrdering && (jsxRuntime.jsx(Button__default["default"], { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)), disabled: !hasColumnOrderChanged, children: localization.resetOrder })), enableColumnPinning && (jsxRuntime.jsx(Button__default["default"], { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsxRuntime.jsx(Button__default["default"], { disabled: getIsAllColumnsVisible(), onClick: () => handleToggleAllColumns(true), children: localization.showAll }))] }), jsxRuntime.jsx(Divider__default["default"], {}), allColumns.map((column, index) => (jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isNestedColumns: isNestedColumns, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
4235
4258
  };
4236
4259
 
4237
4260
  const MRT_ShowHideColumnsButton = (_a) => {
@@ -4379,7 +4402,7 @@ const MRT_TopToolbar = ({ table, }) => {
4379
4402
  return (jsxRuntime.jsxs(Box__default["default"], Object.assign({}, toolbarProps, { ref: (ref) => {
4380
4403
  topToolbarRef.current = ref;
4381
4404
  if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
4382
- // @ts-ignore
4405
+ // @ts-expect-error
4383
4406
  toolbarProps.ref.current = ref;
4384
4407
  }
4385
4408
  }, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, getCommonToolbarStyles({ table, theme })), { position: isFullScreen ? 'sticky' : 'relative', top: isFullScreen ? '0' : undefined }), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [positionToolbarAlertBanner === 'top' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
@@ -4414,7 +4437,7 @@ const MRT_TablePaper = (_a) => {
4414
4437
  return (jsxRuntime.jsxs(Paper__default["default"], Object.assign({ elevation: 2, onKeyDown: (e) => e.key === 'Escape' && table.setIsFullScreen(false) }, paperProps, { ref: (ref) => {
4415
4438
  tablePaperRef.current = ref;
4416
4439
  if (paperProps === null || paperProps === void 0 ? void 0 : paperProps.ref) {
4417
- //@ts-ignore
4440
+ //@ts-expect-error
4418
4441
  paperProps.ref.current = ref;
4419
4442
  }
4420
4443
  }, style: Object.assign(Object.assign({}, (isFullScreen