material-react-table 3.0.3 → 3.1.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 (36) hide show
  1. package/dist/index.d.ts +22 -73
  2. package/dist/index.esm.js +94 -96
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +94 -96
  5. package/dist/index.js.map +1 -1
  6. package/package.json +31 -32
  7. package/src/components/body/MRT_TableBodyCell.tsx +2 -2
  8. package/src/components/body/MRT_TableBodyCellValue.tsx +1 -1
  9. package/src/components/body/MRT_TableBodyRow.tsx +1 -1
  10. package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +1 -1
  11. package/src/components/body/MRT_TableDetailPanel.tsx +1 -1
  12. package/src/components/buttons/MRT_EditActionButtons.tsx +2 -2
  13. package/src/components/footer/MRT_TableFooter.tsx +1 -1
  14. package/src/components/head/MRT_TableHead.tsx +1 -1
  15. package/src/components/head/MRT_TableHeadCell.tsx +2 -2
  16. package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +8 -10
  17. package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +1 -1
  18. package/src/components/inputs/MRT_EditCellTextField.tsx +5 -3
  19. package/src/components/inputs/MRT_FilterRangeSlider.tsx +12 -5
  20. package/src/components/inputs/MRT_FilterTextField.tsx +88 -66
  21. package/src/components/menus/MRT_ColumnActionMenu.tsx +3 -2
  22. package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +12 -0
  23. package/src/components/table/MRT_TableContainer.tsx +1 -1
  24. package/src/components/table/MRT_TablePaper.tsx +1 -1
  25. package/src/components/toolbar/MRT_BottomToolbar.tsx +1 -1
  26. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +2 -2
  27. package/src/components/toolbar/MRT_TopToolbar.tsx +1 -1
  28. package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +1 -1
  29. package/src/hooks/useMRT_ColumnVirtualizer.ts +1 -1
  30. package/src/hooks/useMRT_Effects.ts +2 -2
  31. package/src/hooks/useMRT_RowVirtualizer.ts +1 -1
  32. package/src/hooks/useMRT_TableInstance.ts +1 -1
  33. package/src/types.ts +15 -67
  34. package/src/utils/cell.utils.ts +2 -2
  35. package/src/utils/column.utils.ts +1 -1
  36. package/src/utils/tanstack.helpers.ts +1 -1
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
  });
@@ -1632,8 +1632,8 @@ const useMRT_Effects = (table) => {
1632
1632
  const totalColumnCount = table.options.columns.length;
1633
1633
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
1634
1634
  const rerender = react.useReducer(() => ({}), {})[1];
1635
- const initialBodyHeight = react.useRef();
1636
- const previousTop = react.useRef();
1635
+ const initialBodyHeight = react.useRef(null);
1636
+ const previousTop = react.useRef(null);
1637
1637
  react.useEffect(() => {
1638
1638
  if (typeof window !== 'undefined') {
1639
1639
  initialBodyHeight.current = document.body.style.height;
@@ -1825,7 +1825,7 @@ const useMRT_TableInstance = (definedTableOptions) => {
1825
1825
  statefulTableOptions.state.isLoading,
1826
1826
  statefulTableOptions.state.showSkeletons,
1827
1827
  ]);
1828
- //@ts-ignore
1828
+ //@ts-expect-error
1829
1829
  const table = reactTable.useReactTable(Object.assign(Object.assign({ onColumnOrderChange,
1830
1830
  onColumnSizingInfoChange,
1831
1831
  onGroupingChange,
@@ -1955,7 +1955,7 @@ const useMRT_ColumnVirtualizer = (table) => {
1955
1955
  (numPinnedRight ? totalSize - rightNonPinnedStart : 0);
1956
1956
  }
1957
1957
  if (columnVirtualizerInstanceRef) {
1958
- //@ts-ignore
1958
+ //@ts-expect-error
1959
1959
  columnVirtualizerInstanceRef.current = columnVirtualizer;
1960
1960
  }
1961
1961
  return columnVirtualizer;
@@ -1985,7 +1985,7 @@ const useMRT_RowVirtualizer = (table, rows) => {
1985
1985
  }, [draggingRow]) }, rowVirtualizerProps));
1986
1986
  rowVirtualizer.virtualRows = rowVirtualizer.getVirtualItems();
1987
1987
  if (rowVirtualizerInstanceRef) {
1988
- //@ts-ignore
1988
+ //@ts-expect-error
1989
1989
  rowVirtualizerInstanceRef.current = rowVirtualizer;
1990
1990
  }
1991
1991
  return rowVirtualizer;
@@ -2144,7 +2144,7 @@ const MRT_EditCellTextField = (_a) => {
2144
2144
  });
2145
2145
  const isSelectEdit = editVariant === 'select' || (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select);
2146
2146
  const saveInputValueToRowCache = (newValue) => {
2147
- //@ts-ignore
2147
+ //@ts-expect-error
2148
2148
  row._valuesCache[column.id] = newValue;
2149
2149
  if (isCreating) {
2150
2150
  setCreatingRow(row);
@@ -2168,10 +2168,10 @@ const MRT_EditCellTextField = (_a) => {
2168
2168
  setEditingCell(null);
2169
2169
  };
2170
2170
  const handleEnterKeyDown = (event) => {
2171
- var _a, _b;
2171
+ var _a, _b, _c;
2172
2172
  (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
2173
2173
  if (event.key === 'Enter' && !event.shiftKey && completesComposition) {
2174
- (_b = editInputRefs.current[column.id]) === null || _b === void 0 ? void 0 : _b.blur();
2174
+ (_c = (_b = editInputRefs.current) === null || _b === void 0 ? void 0 : _b[column.id]) === null || _c === void 0 ? void 0 : _c.blur();
2175
2175
  }
2176
2176
  };
2177
2177
  if (columnDef.Edit) {
@@ -2179,7 +2179,9 @@ const MRT_EditCellTextField = (_a) => {
2179
2179
  }
2180
2180
  return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: parseFromValuesOrFunc(columnDef.enableEditing, row) === false, fullWidth: true, inputRef: (inputRef) => {
2181
2181
  if (inputRef) {
2182
- editInputRefs.current[column.id] = inputRef;
2182
+ editInputRefs.current[column.id] = isSelectEdit
2183
+ ? inputRef.node
2184
+ : inputRef;
2183
2185
  if (textFieldProps.inputRef) {
2184
2186
  textFieldProps.inputRef = inputRef;
2185
2187
  }
@@ -2296,7 +2298,7 @@ const MRT_TableBodyCell = (_a) => {
2296
2298
  const showClickToCopyButton = (parseFromValuesOrFunc(enableClickToCopy, cell) === true ||
2297
2299
  parseFromValuesOrFunc(columnDef.enableClickToCopy, cell) === true) &&
2298
2300
  !['context-menu', false].includes(
2299
- // @ts-ignore
2301
+ // @ts-expect-error
2300
2302
  parseFromValuesOrFunc(columnDef.enableClickToCopy, cell));
2301
2303
  const isRightClickable = parseFromValuesOrFunc(enableCellActions, cell);
2302
2304
  const cellValueProps = {
@@ -2452,7 +2454,7 @@ const MRT_TableBodyRow = (_a) => {
2452
2454
  const sx = parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme);
2453
2455
  const defaultRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
2454
2456
  const customRowHeight =
2455
- // @ts-ignore
2457
+ // @ts-expect-error
2456
2458
  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
2459
  const rowHeight = customRowHeight || defaultRowHeight;
2458
2460
  const handleDragEnter = (_e) => {
@@ -2694,7 +2696,7 @@ const MRT_TableFooter = (_a) => {
2694
2696
  return (jsxRuntime.jsx(TableFooter__default["default"], Object.assign({}, tableFooterProps, { ref: (ref) => {
2695
2697
  tableFooterRef.current = ref;
2696
2698
  if (tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.ref) {
2697
- // @ts-ignore
2699
+ // @ts-expect-error
2698
2700
  tableFooterProps.ref.current = ref;
2699
2701
  }
2700
2702
  }, 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 +2957,7 @@ const MRT_ColumnActionMenu = (_a) => {
2955
2957
  };
2956
2958
  const handleFilterByColumn = () => {
2957
2959
  setShowColumnFilters(true);
2958
- queueMicrotask(() => { var _a; return (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus(); });
2960
+ 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
2961
  setAnchorEl(null);
2960
2962
  };
2961
2963
  const handleShowAllColumns = () => {
@@ -2978,7 +2980,7 @@ const MRT_ColumnActionMenu = (_a) => {
2978
2980
  const internalColumnMenuItems = [
2979
2981
  ...(enableSorting && column.getCanSort()
2980
2982
  ? [
2981
- enableSortingRemoval !== false && (jsxRuntime.jsx(MRT_ActionMenuItem, { icon: jsxRuntime.jsx(ClearAllIcon, {}), label: localization.clearSort, onClick: handleClearSort, table: table }, 0)),
2983
+ enableSortingRemoval !== false && (jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: column.getIsSorted() === false, icon: jsxRuntime.jsx(ClearAllIcon, {}), label: localization.clearSort, onClick: handleClearSort, table: table }, 0)),
2982
2984
  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
2985
  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
2986
  ]
@@ -3008,7 +3010,7 @@ const MRT_ColumnActionMenu = (_a) => {
3008
3010
  : []),
3009
3011
  ...(enableColumnResizing && column.getCanResize()
3010
3012
  ? [
3011
- jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: !columnSizing[column.id], icon: jsxRuntime.jsx(RestartAltIcon, {}), label: localization.resetColumnSize, onClick: handleResetColumnSize, table: table }, 10),
3013
+ jsxRuntime.jsx(MRT_ActionMenuItem, { disabled: columnSizing[column.id] === undefined, icon: jsxRuntime.jsx(RestartAltIcon, {}), label: localization.resetColumnSize, onClick: handleResetColumnSize, table: table }, 10),
3012
3014
  ]
3013
3015
  : []),
3014
3016
  ...(enableHiding
@@ -3091,7 +3093,7 @@ const MRT_FilterCheckbox = (_a) => {
3091
3093
  };
3092
3094
 
3093
3095
  const MRT_FilterTextField = (_a) => {
3094
- var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
3096
+ var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
3095
3097
  var { header, rangeFilterIndex, table } = _a, rest = __rest(_a, ["header", "rangeFilterIndex", "table"]);
3096
3098
  const { options: { enableColumnFilterModes, icons: { CloseIcon, FilterListIcon }, localization, manualFiltering, muiFilterAutocompleteProps, muiFilterDatePickerProps, muiFilterDateTimePickerProps, muiFilterTextFieldProps, muiFilterTimePickerProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
3097
3099
  const { column } = header;
@@ -3106,9 +3108,8 @@ const MRT_FilterTextField = (_a) => {
3106
3108
  const { allowedColumnFilterOptions, currentFilterOption, facetedUniqueValues, isAutocompleteFilter, isDateFilter, isMultiSelectFilter, isRangeFilter, isSelectFilter, isTextboxFilter, } = getColumnFilterInfo({ header, table });
3107
3109
  const dropdownOptions = useDropdownOptions({ header, table });
3108
3110
  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))}`]
3111
+ ? 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()) +
3112
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
3112
3113
  : '';
3113
3114
  const filterPlaceholder = !isRangeFilter
3114
3115
  ? ((_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)))
@@ -3210,33 +3211,17 @@ const MRT_FilterTextField = (_a) => {
3210
3211
  if (columnDef.Filter) {
3211
3212
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_g = columnDef.Filter) === null || _g === void 0 ? void 0 : _g.call(columnDef, { column, header, rangeFilterIndex, table }) }));
3212
3213
  }
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: {
3214
+ const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsxRuntime.jsx(InputAdornment__default["default"], { position: "end", sx: {
3215
+ mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined,
3216
+ visibility: ((_h = filterValue === null || filterValue === void 0 ? void 0 : filterValue.length) !== null && _h !== void 0 ? _h : 0) > 0 ? 'visible' : 'hidden',
3217
+ }, 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
3218
  height: '2rem',
3215
3219
  transform: 'scale(0.9)',
3216
3220
  width: '2rem',
3217
3221
  }, children: jsxRuntime.jsx(CloseIcon, {}) }) }) }) })) : null;
3218
3222
  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) => {
3223
+ 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()) +
3224
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null, inputRef: (inputRef) => {
3240
3225
  filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
3241
3226
  inputRef;
3242
3227
  if (textFieldProps.inputRef) {
@@ -3244,7 +3229,16 @@ const MRT_FilterTextField = (_a) => {
3244
3229
  }
3245
3230
  }, margin: 'none', placeholder: filterChipLabel || isSelectFilter || isMultiSelectFilter
3246
3231
  ? undefined
3247
- : filterPlaceholder, variant: 'standard' }, textFieldProps), { onKeyDown: (e) => {
3232
+ : filterPlaceholder, variant: 'standard' }, textFieldProps), { slotProps: Object.assign(Object.assign({}, textFieldProps.slotProps), { formHelperText: Object.assign({ sx: {
3233
+ fontSize: '0.75rem',
3234
+ lineHeight: '0.8rem',
3235
+ whiteSpace: 'nowrap',
3236
+ } }, (_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
3237
+ ? { endAdornment, startAdornment }
3238
+ : { startAdornment }, htmlInput: Object.assign({ 'aria-label': filterPlaceholder, autoComplete: 'off', disabled: !!filterChipLabel, sx: {
3239
+ textOverflow: 'ellipsis',
3240
+ width: filterChipLabel ? 0 : undefined,
3241
+ }, title: filterPlaceholder }, (_o = textFieldProps.slotProps) === null || _o === void 0 ? void 0 : _o.htmlInput) }), onKeyDown: (e) => {
3248
3242
  var _a;
3249
3243
  e.stopPropagation();
3250
3244
  (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
@@ -3264,32 +3258,32 @@ const MRT_FilterTextField = (_a) => {
3264
3258
  value: filterValue || null,
3265
3259
  };
3266
3260
  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),
3261
+ 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),
3262
+ 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
3263
  } }))) : (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),
3264
+ 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),
3265
+ 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
3266
  } }))) : (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
3267
+ 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),
3268
+ textField: Object.assign(Object.assign({}, commonTextFieldProps), (_u = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _u === void 0 ? void 0 : _u.textField),
3269
+ } }))) : 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 : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
3270
+ var _a, _b, _c, _d, _f;
3271
+ 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:
3272
+ //@ts-expect-error
3273
+ (_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) }), onChange: handleTextFieldChange, onClick: (e) => e.stopPropagation() })));
3274
+ }, 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
3275
+ ? (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) => {
3276
+ const selectedValue = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.find((option) => getValueAndLabel(option).value === value);
3277
+ return (jsxRuntime.jsx(Chip__default["default"], { label: getValueAndLabel(selectedValue).label }, value));
3278
+ }) }))
3279
+ : undefined }, (_x = commonTextFieldProps.slotProps) === null || _x === void 0 ? void 0 : _x.select) }), onChange: handleTextFieldChange, onClick: (e) => e.stopPropagation(), value: isMultiSelectFilter
3286
3280
  ? Array.isArray(filterValue)
3287
3281
  ? filterValue
3288
3282
  : []
3289
3283
  : filterValue, children: (isSelectFilter || isMultiSelectFilter) && [
3290
3284
  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
3285
  ...[
3292
- (_t = textFieldProps.children) !== null && _t !== void 0 ? _t : dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option, index) => {
3286
+ (_y = textFieldProps.children) !== null && _y !== void 0 ? _y : dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option, index) => {
3293
3287
  var _a;
3294
3288
  const { label, value } = getValueAndLabel(option);
3295
3289
  return (jsxRuntime.jsxs(MenuItem__default["default"], { sx: {
@@ -3333,6 +3327,12 @@ const MRT_FilterRangeSlider = (_a) => {
3333
3327
  const [filterValues, setFilterValues] = react.useState([min, max]);
3334
3328
  const columnFilterValue = column.getFilterValue();
3335
3329
  const isMounted = react.useRef(false);
3330
+ // prevent moving the focus to the next/prev cell when using the arrow keys
3331
+ const handleKeyDown = (event) => {
3332
+ if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
3333
+ event.stopPropagation();
3334
+ }
3335
+ };
3336
3336
  react.useEffect(() => {
3337
3337
  if (isMounted.current) {
3338
3338
  if (columnFilterValue === undefined) {
@@ -3356,15 +3356,15 @@ const MRT_FilterRangeSlider = (_a) => {
3356
3356
  column.setFilterValue(value);
3357
3357
  }
3358
3358
  }
3359
- }, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
3359
+ }, onKeyDown: handleKeyDown, value: filterValues, valueLabelDisplay: "auto" }, sliderProps, { slotProps: {
3360
3360
  input: {
3361
3361
  ref: (node) => {
3362
3362
  var _a, _b;
3363
3363
  if (node) {
3364
3364
  filterInputRefs.current[`${column.id}-0`] = node;
3365
- // @ts-ignore
3365
+ // @ts-expect-error
3366
3366
  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
3367
+ //@ts-expect-error
3368
3368
  sliderProps.slotProps.input.ref = node;
3369
3369
  }
3370
3370
  }
@@ -3375,9 +3375,7 @@ const MRT_FilterRangeSlider = (_a) => {
3375
3375
  lineHeight: '0.8rem',
3376
3376
  m: '-3px -6px',
3377
3377
  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()) +
3378
+ }, 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
3379
  (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
3382
3380
  };
3383
3381
 
@@ -3392,7 +3390,7 @@ const MRT_TableHeadCellFilterContainer = (_a) => {
3392
3390
  };
3393
3391
 
3394
3392
  const MRT_TableHeadCellFilterLabel = (_a) => {
3395
- var _b, _c;
3393
+ var _b;
3396
3394
  var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
3397
3395
  const { options: { columnFilterDisplayMode, icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
3398
3396
  const { column } = header;
@@ -3410,9 +3408,8 @@ const MRT_TableHeadCellFilterLabel = (_a) => {
3410
3408
  : localization.filteringByColumn
3411
3409
  .replace('{column}', String(columnDef.header))
3412
3410
  .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))}`]
3411
+ ? localization[`filter${currentFilterOption.charAt(0).toUpperCase() +
3412
+ currentFilterOption.slice(1)}`]
3416
3413
  : '')
3417
3414
  .replace('{filterValue}', `"${Array.isArray(filterValue)
3418
3415
  ? filterValue
@@ -3424,8 +3421,7 @@ const MRT_TableHeadCellFilterLabel = (_a) => {
3424
3421
  .replace('" "', '');
3425
3422
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Grow__default["default"], { in: columnFilterDisplayMode === 'popover' ||
3426
3423
  (!!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) => {
3424
+ (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
3425
  if (columnFilterDisplayMode === 'popover') {
3430
3426
  setAnchorEl(event.currentTarget);
3431
3427
  }
@@ -3433,16 +3429,16 @@ const MRT_TableHeadCellFilterLabel = (_a) => {
3433
3429
  setShowColumnFilters(true);
3434
3430
  }
3435
3431
  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);
3432
+ var _a, _b, _c, _d, _e, _f;
3433
+ (_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);
3434
+ (_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
3435
  });
3440
3436
  event.stopPropagation();
3441
3437
  }, 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
3438
  horizontal: 'center',
3443
3439
  vertical: 'top',
3444
3440
  }, disableScrollLock: true, onClick: (event) => event.stopPropagation(), onClose: (event) => {
3445
- //@ts-ignore
3441
+ //@ts-expect-error
3446
3442
  event.stopPropagation();
3447
3443
  setAnchorEl(null);
3448
3444
  }, onKeyDown: (event) => event.key === 'Enter' && setAnchorEl(null), open: !!anchorEl, slotProps: { paper: { sx: { overflow: 'visible' } } }, transformOrigin: {
@@ -3561,7 +3557,7 @@ const MRT_TableHeadCellSortLabel = (_a) => {
3561
3557
  };
3562
3558
 
3563
3559
  const MRT_TableHeadCell = (_a) => {
3564
- var _b, _c, _d, _f, _g, _h;
3560
+ var _b, _c, _d, _f, _g, _h, _j;
3565
3561
  var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
3566
3562
  const theme = styles.useTheme();
3567
3563
  const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
@@ -3728,7 +3724,7 @@ const MRT_TableHeadCell = (_a) => {
3728
3724
  }, 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
3725
  whiteSpace: 'nowrap',
3730
3726
  }, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
3731
- current: tableHeadCellRefs.current[column.id],
3727
+ current: (_j = tableHeadCellRefs.current) === null || _j === void 0 ? void 0 : _j[column.id],
3732
3728
  } })), 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
3729
  };
3734
3730
 
@@ -3756,7 +3752,7 @@ const MRT_TableHeadRow = (_a) => {
3756
3752
  const MRT_ToolbarAlertBanner = (_a) => {
3757
3753
  var _b, _c, _d;
3758
3754
  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;
3755
+ const { getFilteredSelectedRowModel, getCoreRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, manualPagination, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
3760
3756
  const { density, grouping, rowSelection, showAlertBanner } = getState();
3761
3757
  const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
3762
3758
  table,
@@ -3764,7 +3760,7 @@ const MRT_ToolbarAlertBanner = (_a) => {
3764
3760
  const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
3765
3761
  table,
3766
3762
  });
3767
- const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().flatRows.length;
3763
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getCoreRowModel().rows.length;
3768
3764
  const selectedRowCount = react.useMemo(() => manualPagination
3769
3765
  ? Object.values(rowSelection).filter(Boolean).length
3770
3766
  : getFilteredSelectedRowModel().rows.length, [rowSelection, totalRowCount, manualPagination]);
@@ -3806,7 +3802,7 @@ const MRT_TableHead = (_a) => {
3806
3802
  return (jsxRuntime.jsx(TableHead__default["default"], Object.assign({}, tableHeadProps, { ref: (ref) => {
3807
3803
  tableHeadRef.current = ref;
3808
3804
  if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
3809
- // @ts-ignore
3805
+ // @ts-expect-error
3810
3806
  tableHeadProps.ref.current = ref;
3811
3807
  }
3812
3808
  }, 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 +3973,7 @@ const MRT_TableContainer = (_a) => {
3977
3973
  if (node) {
3978
3974
  tableContainerRef.current = node;
3979
3975
  if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
3980
- //@ts-ignore
3976
+ //@ts-expect-error
3981
3977
  tableContainerProps.ref.current = node;
3982
3978
  }
3983
3979
  }
@@ -4090,7 +4086,7 @@ const MRT_BottomToolbar = (_a) => {
4090
4086
  if (node) {
4091
4087
  bottomToolbarRef.current = node;
4092
4088
  if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
4093
- // @ts-ignore
4089
+ // @ts-expect-error
4094
4090
  toolbarProps.ref.current = node;
4095
4091
  }
4096
4092
  }
@@ -4193,7 +4189,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
4193
4189
 
4194
4190
  const MRT_ShowHideColumnsMenu = (_a) => {
4195
4191
  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;
4192
+ const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, initialState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, mrtTheme: { menuBackgroundColor }, }, } = table;
4197
4193
  const { columnOrder, columnPinning, density } = getState();
4198
4194
  const handleToggleAllColumns = (value) => {
4199
4195
  getAllLeafColumns()
@@ -4220,6 +4216,8 @@ const MRT_ShowHideColumnsMenu = (_a) => {
4220
4216
  getRightLeafColumns(),
4221
4217
  ]);
4222
4218
  const isNestedColumns = allColumns.some((col) => col.columnDef.columnDefType === 'group');
4219
+ const hasColumnOrderChanged = react.useMemo(() => columnOrder.length !== initialState.columnOrder.length ||
4220
+ !columnOrder.every((column, index) => column === initialState.columnOrder[index]), [columnOrder, initialState.columnOrder]);
4223
4221
  const [hoveredColumn, setHoveredColumn] = react.useState(null);
4224
4222
  return (jsxRuntime.jsxs(Menu__default["default"], Object.assign({ MenuListProps: {
4225
4223
  dense: density === 'compact',
@@ -4231,7 +4229,7 @@ const MRT_ShowHideColumnsMenu = (_a) => {
4231
4229
  justifyContent: 'space-between',
4232
4230
  p: '0.5rem',
4233
4231
  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}`)))] })));
4232
+ }, 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
4233
  };
4236
4234
 
4237
4235
  const MRT_ShowHideColumnsButton = (_a) => {
@@ -4379,7 +4377,7 @@ const MRT_TopToolbar = ({ table, }) => {
4379
4377
  return (jsxRuntime.jsxs(Box__default["default"], Object.assign({}, toolbarProps, { ref: (ref) => {
4380
4378
  topToolbarRef.current = ref;
4381
4379
  if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
4382
- // @ts-ignore
4380
+ // @ts-expect-error
4383
4381
  toolbarProps.ref.current = ref;
4384
4382
  }
4385
4383
  }, 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 +4412,7 @@ const MRT_TablePaper = (_a) => {
4414
4412
  return (jsxRuntime.jsxs(Paper__default["default"], Object.assign({ elevation: 2, onKeyDown: (e) => e.key === 'Escape' && table.setIsFullScreen(false) }, paperProps, { ref: (ref) => {
4415
4413
  tablePaperRef.current = ref;
4416
4414
  if (paperProps === null || paperProps === void 0 ? void 0 : paperProps.ref) {
4417
- //@ts-ignore
4415
+ //@ts-expect-error
4418
4416
  paperProps.ref.current = ref;
4419
4417
  }
4420
4418
  }, style: Object.assign(Object.assign({}, (isFullScreen