material-react-table 0.7.4 → 0.7.5

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.
@@ -1,15 +1,16 @@
1
1
  import { ChangeEvent, Dispatch, FC, FocusEvent, MouseEvent, ReactNode, SetStateAction } from 'react';
2
2
  import { AlertProps, ButtonProps, CheckboxProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
3
- import { Cell, Column, ColumnDef, DefaultGenerics, FilterType, Header, HeaderGroup, Options, Overwrite, PaginationState, Row, TableInstance, TableState, VisibilityState } from '@tanstack/react-table';
3
+ import { Cell, Column, ColumnDef, DefaultGenerics, FilterFn, FilterFnOption, Header, HeaderGroup, Options, Overwrite, PaginationState, Row, TableInstance, TableState, VisibilityState } from '@tanstack/react-table';
4
4
  import { MRT_Localization } from './localization';
5
5
  import { MRT_Icons } from './icons';
6
- import { MRT_FILTER_TYPE } from './enums';
7
- export declare type MRT_TableOptions<D extends Record<string, any> = {}> = Partial<Omit<Options<D>, 'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn'>> & {
6
+ import { MRT_FILTER_OPTION } from './enums';
7
+ export declare type MRT_TableOptions<D extends Record<string, any> = {}> = Partial<Omit<Options<D>, 'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn' | 'filterFns'>> & {
8
8
  columns: MRT_ColumnDef<D>[];
9
9
  data: D[];
10
+ expandRowsFn?: (dataRow: D) => D[];
11
+ filterFns?: MRT_FILTER_OPTION | FilterFn<D> | string | number | symbol;
10
12
  initialState?: Partial<MRT_TableState<D>>;
11
13
  state?: Partial<MRT_TableState<D>>;
12
- expandRowsFn?: (dataRow: D) => D[];
13
14
  };
14
15
  export interface MRT_RowModel<D extends Record<string, any> = {}> {
15
16
  flatRows: MRT_Row<D>[];
@@ -32,17 +33,14 @@ export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit
32
33
  options: MaterialReactTableProps<D> & {
33
34
  icons: MRT_Icons;
34
35
  idPrefix: string;
35
- filterTypes: {
36
- [key in MRT_FILTER_TYPE]: any;
37
- };
38
36
  localization: MRT_Localization;
39
37
  };
40
38
  setCurrentEditingCell: Dispatch<SetStateAction<MRT_Cell<D> | null>>;
41
39
  setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row<D> | null>>;
42
- setCurrentFilterTypes: Dispatch<SetStateAction<{
43
- [key: string]: MRT_FilterType;
40
+ setCurrentFilterFns: Dispatch<SetStateAction<{
41
+ [key: string]: MRT_FilterFn<D>;
44
42
  }>>;
45
- setCurrentGlobalFilterType: Dispatch<SetStateAction<MRT_FILTER_TYPE>>;
43
+ setCurrentGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterFn<D>>>;
46
44
  setIsDensePadding: Dispatch<SetStateAction<boolean>>;
47
45
  setIsFullScreen: Dispatch<SetStateAction<boolean>>;
48
46
  setShowFilters: Dispatch<SetStateAction<boolean>>;
@@ -51,15 +49,15 @@ export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit
51
49
  export declare type MRT_TableState<D extends Record<string, any> = {}> = Omit<TableState, 'pagination'> & {
52
50
  currentEditingCell: MRT_Cell<D> | null;
53
51
  currentEditingRow: MRT_Row<D> | null;
54
- currentFilterTypes: Record<string, string | Function>;
55
- currentGlobalFilterType: Record<string, string | Function>;
52
+ currentFilterFns: Record<string, string | Function>;
53
+ currentGlobalFilterFn: Record<string, string | Function>;
56
54
  isDensePadding: boolean;
57
55
  isFullScreen: boolean;
58
56
  showFilters: boolean;
59
57
  showGlobalFilter: boolean;
60
58
  pagination: Partial<PaginationState>;
61
59
  };
62
- export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<ColumnDef<D>, 'header' | 'footer' | 'columns'> & {
60
+ export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<ColumnDef<D>, 'header' | 'footer' | 'columns' | 'filterFn'> & {
63
61
  Edit?: ({ cell, tableInstance, }: {
64
62
  cell: MRT_Cell<D>;
65
63
  tableInstance: MRT_TableInstance<D>;
@@ -85,8 +83,8 @@ export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<Col
85
83
  enableClickToCopy?: boolean;
86
84
  enableColumnActions?: boolean;
87
85
  enableEditing?: boolean;
88
- enabledColumnFilterTypes?: (MRT_FILTER_TYPE | string)[];
89
- filter?: MRT_FilterType | string | FilterType<D>;
86
+ enabledColumnFilterOptions?: (MRT_FILTER_OPTION | string)[];
87
+ filterFn?: MRT_FilterFn;
90
88
  filterSelectOptions?: (string | {
91
89
  text: string;
92
90
  value: string;
@@ -159,7 +157,7 @@ export declare type MRT_Cell<D extends Record<string, any> = {}> = Omit<Cell<D>,
159
157
  column: MRT_Column<D>;
160
158
  row: MRT_Row<D>;
161
159
  };
162
- export declare type MRT_FilterType = MRT_FILTER_TYPE | Function;
160
+ export declare type MRT_FilterFn<D extends Record<string, any> = {}> = FilterFn<D> | FilterFnOption<D> | MRT_FILTER_OPTION | number | string | symbol;
163
161
  export declare type MaterialReactTableProps<D extends Record<string, any> = {}> = MRT_TableOptions<D> & {
164
162
  editingMode?: 'table' | 'row' | 'cell';
165
163
  enableClickToCopy?: boolean;
@@ -179,10 +177,8 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
179
177
  enableToolbarBottom?: boolean;
180
178
  enableToolbarInternalActions?: boolean;
181
179
  enableToolbarTop?: boolean;
182
- enabledGlobalFilterTypes?: (MRT_FILTER_TYPE | string)[];
183
- filterTypes?: {
184
- [key in MRT_FILTER_TYPE]: any;
185
- };
180
+ enabledColumnFilterOptions?: (MRT_FILTER_OPTION | string)[];
181
+ enabledGlobalFilterOptions?: (MRT_FILTER_OPTION | string)[];
186
182
  icons?: Partial<MRT_Icons>;
187
183
  idPrefix?: string;
188
184
  isLoading?: boolean;
@@ -396,5 +392,5 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
396
392
  }>;
397
393
  }) => ReactNode;
398
394
  };
399
- declare const _default: <D extends Record<string, any> = {}>({ autoResetExpanded, columnResizeMode, editingMode, enableColumnActions, enableColumnFilters, enableColumnResizing, enableDensePaddingToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableMultiRowSelection, enablePagination, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarBottom, enableToolbarInternalActions, enableToolbarTop, icons, localization, persistentStateMode, positionActionsColumn, positionPagination, positionToolbarActions, positionToolbarAlertBanner, ...rest }: MaterialReactTableProps<D>) => JSX.Element;
395
+ declare const _default: <D extends Record<string, any> = {}>({ autoResetExpanded, autoResetSorting, columnResizeMode, editingMode, enableColumnActions, enableColumnFilters, enableColumnResizing, enableDensePaddingToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableMultiRowSelection, enablePagination, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarBottom, enableToolbarInternalActions, enableToolbarTop, icons, localization, persistentStateMode, positionActionsColumn, positionPagination, positionToolbarActions, positionToolbarAlertBanner, ...rest }: MaterialReactTableProps<D>) => JSX.Element;
400
396
  export default _default;
package/dist/enums.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare enum MRT_FILTER_TYPE {
1
+ export declare enum MRT_FILTER_OPTION {
2
2
  BEST_MATCH = "bestMatch",
3
3
  BEST_MATCH_FIRST = "bestMatchFirst",
4
4
  CONTAINS = "contains",
@@ -235,21 +235,21 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
235
235
  }));
236
236
  };
237
237
 
238
- var MRT_FILTER_TYPE;
239
-
240
- (function (MRT_FILTER_TYPE) {
241
- MRT_FILTER_TYPE["BEST_MATCH"] = "bestMatch";
242
- MRT_FILTER_TYPE["BEST_MATCH_FIRST"] = "bestMatchFirst";
243
- MRT_FILTER_TYPE["CONTAINS"] = "contains";
244
- MRT_FILTER_TYPE["EMPTY"] = "empty";
245
- MRT_FILTER_TYPE["ENDS_WITH"] = "endsWith";
246
- MRT_FILTER_TYPE["EQUALS"] = "equals";
247
- MRT_FILTER_TYPE["GREATER_THAN"] = "greaterThan";
248
- MRT_FILTER_TYPE["LESS_THAN"] = "lessThan";
249
- MRT_FILTER_TYPE["NOT_EMPTY"] = "notEmpty";
250
- MRT_FILTER_TYPE["NOT_EQUALS"] = "notEquals";
251
- MRT_FILTER_TYPE["STARTS_WITH"] = "startsWith";
252
- })(MRT_FILTER_TYPE || (MRT_FILTER_TYPE = {}));
238
+ var MRT_FILTER_OPTION;
239
+
240
+ (function (MRT_FILTER_OPTION) {
241
+ MRT_FILTER_OPTION["BEST_MATCH"] = "bestMatch";
242
+ MRT_FILTER_OPTION["BEST_MATCH_FIRST"] = "bestMatchFirst";
243
+ MRT_FILTER_OPTION["CONTAINS"] = "contains";
244
+ MRT_FILTER_OPTION["EMPTY"] = "empty";
245
+ MRT_FILTER_OPTION["ENDS_WITH"] = "endsWith";
246
+ MRT_FILTER_OPTION["EQUALS"] = "equals";
247
+ MRT_FILTER_OPTION["GREATER_THAN"] = "greaterThan";
248
+ MRT_FILTER_OPTION["LESS_THAN"] = "lessThan";
249
+ MRT_FILTER_OPTION["NOT_EMPTY"] = "notEmpty";
250
+ MRT_FILTER_OPTION["NOT_EQUALS"] = "notEquals";
251
+ MRT_FILTER_OPTION["STARTS_WITH"] = "startsWith";
252
+ })(MRT_FILTER_OPTION || (MRT_FILTER_OPTION = {}));
253
253
 
254
254
  var bestMatchFirst = function bestMatchFirst(rows, columnIds, filterValue) {
255
255
  return matchSorter.matchSorter(rows, filterValue.toString().trim(), {
@@ -387,7 +387,7 @@ var commonMenuItemStyles = {
387
387
  my: 0,
388
388
  alignItems: 'center'
389
389
  };
390
- var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
390
+ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
391
391
  var anchorEl = _ref.anchorEl,
392
392
  header = _ref.header,
393
393
  onSelect = _ref.onSelect,
@@ -395,97 +395,97 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
395
395
  tableInstance = _ref.tableInstance;
396
396
  var getState = tableInstance.getState,
397
397
  _tableInstance$option = tableInstance.options,
398
- enabledGlobalFilterTypes = _tableInstance$option.enabledGlobalFilterTypes,
398
+ enabledGlobalFilterOptions = _tableInstance$option.enabledGlobalFilterOptions,
399
399
  localization = _tableInstance$option.localization,
400
- setCurrentFilterTypes = tableInstance.setCurrentFilterTypes,
401
- setCurrentGlobalFilterType = tableInstance.setCurrentGlobalFilterType;
400
+ setCurrentFilterFns = tableInstance.setCurrentFilterFns,
401
+ setCurrentGlobalFilterFn = tableInstance.setCurrentGlobalFilterFn;
402
402
 
403
403
  var _getState = getState(),
404
404
  isDensePadding = _getState.isDensePadding,
405
- currentFilterTypes = _getState.currentFilterTypes,
406
- currentGlobalFilterType = _getState.currentGlobalFilterType;
405
+ currentFilterFns = _getState.currentFilterFns,
406
+ currentGlobalFilterFn = _getState.currentGlobalFilterFn;
407
407
 
408
- var filterTypes = React.useMemo(function () {
408
+ var filterOptions = React.useMemo(function () {
409
409
  return [{
410
- type: MRT_FILTER_TYPE.BEST_MATCH_FIRST,
410
+ type: MRT_FILTER_OPTION.BEST_MATCH_FIRST,
411
411
  label: localization.filterBestMatchFirst,
412
412
  divider: false,
413
413
  fn: bestMatchFirst
414
414
  }, {
415
- type: MRT_FILTER_TYPE.BEST_MATCH,
415
+ type: MRT_FILTER_OPTION.BEST_MATCH,
416
416
  label: localization.filterBestMatch,
417
417
  divider: !!header,
418
418
  fn: bestMatch
419
419
  }, {
420
- type: MRT_FILTER_TYPE.CONTAINS,
420
+ type: MRT_FILTER_OPTION.CONTAINS,
421
421
  label: localization.filterContains,
422
422
  divider: false,
423
423
  fn: contains
424
424
  }, {
425
- type: MRT_FILTER_TYPE.STARTS_WITH,
425
+ type: MRT_FILTER_OPTION.STARTS_WITH,
426
426
  label: localization.filterStartsWith,
427
427
  divider: false,
428
428
  fn: startsWith
429
429
  }, {
430
- type: MRT_FILTER_TYPE.ENDS_WITH,
430
+ type: MRT_FILTER_OPTION.ENDS_WITH,
431
431
  label: localization.filterEndsWith,
432
432
  divider: true,
433
433
  fn: endsWith
434
434
  }, {
435
- type: MRT_FILTER_TYPE.EQUALS,
435
+ type: MRT_FILTER_OPTION.EQUALS,
436
436
  label: localization.filterEquals,
437
437
  divider: false,
438
438
  fn: equals
439
439
  }, {
440
- type: MRT_FILTER_TYPE.NOT_EQUALS,
440
+ type: MRT_FILTER_OPTION.NOT_EQUALS,
441
441
  label: localization.filterNotEquals,
442
442
  divider: true,
443
443
  fn: notEquals
444
444
  }, {
445
- type: MRT_FILTER_TYPE.GREATER_THAN,
445
+ type: MRT_FILTER_OPTION.GREATER_THAN,
446
446
  label: localization.filterGreaterThan,
447
447
  divider: false,
448
448
  fn: greaterThan
449
449
  }, {
450
- type: MRT_FILTER_TYPE.LESS_THAN,
450
+ type: MRT_FILTER_OPTION.LESS_THAN,
451
451
  label: localization.filterLessThan,
452
452
  divider: true,
453
453
  fn: lessThan
454
454
  }, {
455
- type: MRT_FILTER_TYPE.EMPTY,
455
+ type: MRT_FILTER_OPTION.EMPTY,
456
456
  label: localization.filterEmpty,
457
457
  divider: false,
458
458
  fn: empty
459
459
  }, {
460
- type: MRT_FILTER_TYPE.NOT_EMPTY,
460
+ type: MRT_FILTER_OPTION.NOT_EMPTY,
461
461
  label: localization.filterNotEmpty,
462
462
  divider: false,
463
463
  fn: notEmpty
464
464
  }].filter(function (filterType) {
465
- return header ? !header.column.enabledColumnFilterTypes || header.column.enabledColumnFilterTypes.includes(filterType.type) : (!enabledGlobalFilterTypes || enabledGlobalFilterTypes.includes(filterType.type)) && [MRT_FILTER_TYPE.BEST_MATCH_FIRST, MRT_FILTER_TYPE.BEST_MATCH].includes(filterType.type);
465
+ return header ? !header.column.enabledColumnFilterOptions || header.column.enabledColumnFilterOptions.includes(filterType.type) : (!enabledGlobalFilterOptions || enabledGlobalFilterOptions.includes(filterType.type)) && [MRT_FILTER_OPTION.BEST_MATCH_FIRST, MRT_FILTER_OPTION.BEST_MATCH].includes(filterType.type);
466
466
  });
467
467
  }, []);
468
468
 
469
469
  var handleSelectFilterType = function handleSelectFilterType(value) {
470
470
  if (header) {
471
- setCurrentFilterTypes(function (prev) {
471
+ setCurrentFilterFns(function (prev) {
472
472
  var _extends2;
473
473
 
474
474
  return _extends({}, prev, (_extends2 = {}, _extends2[header.id] = value, _extends2));
475
475
  });
476
476
 
477
- if ([MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(value)) {
477
+ if ([MRT_FILTER_OPTION.EMPTY, MRT_FILTER_OPTION.NOT_EMPTY].includes(value)) {
478
478
  header.column.setColumnFilterValue(' ');
479
479
  }
480
480
  } else {
481
- setCurrentGlobalFilterType(value);
481
+ setCurrentGlobalFilterFn(value);
482
482
  }
483
483
 
484
484
  setAnchorEl(null);
485
485
  onSelect == null ? void 0 : onSelect();
486
486
  };
487
487
 
488
- var filterType = !!header ? currentFilterTypes[header.id] : currentGlobalFilterType;
488
+ var filterType = !!header ? currentFilterFns[header.id] : currentGlobalFilterFn;
489
489
  return React__default.createElement(material.Menu, {
490
490
  anchorEl: anchorEl,
491
491
  anchorOrigin: {
@@ -499,7 +499,7 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
499
499
  MenuListProps: {
500
500
  dense: isDensePadding
501
501
  }
502
- }, filterTypes.map(function (_ref2, index) {
502
+ }, filterOptions.map(function (_ref2, index) {
503
503
  var type = _ref2.type,
504
504
  label = _ref2.label,
505
505
  divider = _ref2.divider,
@@ -843,7 +843,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
843
843
  sx: {
844
844
  p: 0
845
845
  }
846
- }, React__default.createElement(ArrowRightIcon, null))), React__default.createElement(MRT_FilterTypeMenu, {
846
+ }, React__default.createElement(ArrowRightIcon, null))), React__default.createElement(MRT_FilterOptionMenu, {
847
847
  anchorEl: filterMenuAnchorEl,
848
848
  header: header,
849
849
  key: 2,
@@ -1257,7 +1257,7 @@ var MRT_SearchTextField = function MRT_SearchTextField(_ref) {
1257
1257
  sx: _extends({
1258
1258
  justifySelf: 'end'
1259
1259
  }, textFieldProps == null ? void 0 : textFieldProps.sx)
1260
- })), React__default.createElement(MRT_FilterTypeMenu, {
1260
+ })), React__default.createElement(MRT_FilterOptionMenu, {
1261
1261
  anchorEl: anchorEl,
1262
1262
  setAnchorEl: setAnchorEl,
1263
1263
  tableInstance: tableInstance
@@ -1755,11 +1755,11 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
1755
1755
  idPrefix = _tableInstance$option.idPrefix,
1756
1756
  localization = _tableInstance$option.localization,
1757
1757
  muiTableHeadCellFilterTextFieldProps = _tableInstance$option.muiTableHeadCellFilterTextFieldProps,
1758
- setCurrentFilterTypes = tableInstance.setCurrentFilterTypes;
1758
+ setCurrentFilterFns = tableInstance.setCurrentFilterFns;
1759
1759
  var column = header.column;
1760
1760
 
1761
1761
  var _getState = getState(),
1762
- currentFilterTypes = _getState.currentFilterTypes;
1762
+ currentFilterFns = _getState.currentFilterFns;
1763
1763
 
1764
1764
  var _useState = React.useState(null),
1765
1765
  anchorEl = _useState[0],
@@ -1798,10 +1798,10 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
1798
1798
  var handleClearFilterChip = function handleClearFilterChip() {
1799
1799
  setFilterValue('');
1800
1800
  column.setColumnFilterValue(undefined);
1801
- setCurrentFilterTypes(function (prev) {
1801
+ setCurrentFilterFns(function (prev) {
1802
1802
  var _extends2;
1803
1803
 
1804
- return _extends({}, prev, (_extends2 = {}, _extends2[header.id] = MRT_FILTER_TYPE.BEST_MATCH, _extends2));
1804
+ return _extends({}, prev, (_extends2 = {}, _extends2[header.id] = MRT_FILTER_OPTION.BEST_MATCH, _extends2));
1805
1805
  });
1806
1806
  };
1807
1807
 
@@ -1813,10 +1813,10 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
1813
1813
  }
1814
1814
 
1815
1815
  var filterId = "mrt-" + idPrefix + "-" + header.id + "-filter-text-field";
1816
- var filterType = currentFilterTypes == null ? void 0 : currentFilterTypes[header.id];
1816
+ var filterFn = currentFilterFns == null ? void 0 : currentFilterFns[header.id];
1817
1817
  var isSelectFilter = !!column.filterSelectOptions;
1818
- var filterChipLabel = !(filterType instanceof Function) && [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(filterType) ? //@ts-ignore
1819
- localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))] : '';
1818
+ var filterChipLabel = !(filterFn instanceof Function) && [MRT_FILTER_OPTION.EMPTY, MRT_FILTER_OPTION.NOT_EMPTY].includes(filterFn) ? //@ts-ignore
1819
+ localization["filter" + (filterFn.charAt(0).toUpperCase() + filterFn.slice(1))] : '';
1820
1820
  var filterPlaceholder = (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.header));
1821
1821
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(material.TextField, Object.assign({
1822
1822
  fullWidth: true,
@@ -1831,9 +1831,9 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
1831
1831
  },
1832
1832
  helperText: React__default.createElement("label", {
1833
1833
  htmlFor: filterId
1834
- }, filterType instanceof Function ? (_localization$filterM = localization.filterMode.replace('{filterType}', // @ts-ignore
1835
- (_localization$ = localization["filter" + (filterType.name.charAt(0).toUpperCase() + filterType.name.slice(1))]) != null ? _localization$ : '')) != null ? _localization$filterM : '' : localization.filterMode.replace('{filterType}', // @ts-ignore
1836
- localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))])),
1834
+ }, filterFn instanceof Function ? (_localization$filterM = localization.filterMode.replace('{filterType}', // @ts-ignore
1835
+ (_localization$ = localization["filter" + (filterFn.name.charAt(0).toUpperCase() + filterFn.name.slice(1))]) != null ? _localization$ : '')) != null ? _localization$filterM : '' : localization.filterMode.replace('{filterType}', // @ts-ignore
1836
+ localization["filter" + (filterFn.charAt(0).toUpperCase() + filterFn.slice(1))])),
1837
1837
  FormHelperTextProps: {
1838
1838
  sx: {
1839
1839
  fontSize: '0.6rem',
@@ -1920,7 +1920,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
1920
1920
  key: value,
1921
1921
  value: value
1922
1922
  }, text);
1923
- })), React__default.createElement(MRT_FilterTypeMenu, {
1923
+ })), React__default.createElement(MRT_FilterOptionMenu, {
1924
1924
  anchorEl: anchorEl,
1925
1925
  header: header,
1926
1926
  setAnchorEl: setAnchorEl,
@@ -2022,9 +2022,9 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
2022
2022
  var tableCellProps = _extends({}, header.getHeaderProps(), mTableHeadCellProps, mcTableHeadCellProps);
2023
2023
 
2024
2024
  var sortTooltip = !!column.getIsSorted() ? column.getIsSorted() === 'desc' ? localization.sortedByColumnDesc.replace('{column}', column.header) : localization.sortedByColumnAsc.replace('{column}', column.header) : localization.unsorted;
2025
- var filterType = (_getState2 = getState()) == null ? void 0 : (_getState2$currentFil = _getState2.currentFilterTypes) == null ? void 0 : _getState2$currentFil[header.id];
2026
- var filterTooltip = !!column.getColumnFilterValue() ? localization.filteringByColumn.replace('{column}', String(column.header)).replace('{filterType}', filterType instanceof Function ? '' : // @ts-ignore
2027
- localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))]).replace('{filterValue}', column.getColumnFilterValue()).replace('" "', '') : localization.showHideFilters;
2025
+ var filterFn = (_getState2 = getState()) == null ? void 0 : (_getState2$currentFil = _getState2.currentFilterFns) == null ? void 0 : _getState2$currentFil[header.id];
2026
+ var filterTooltip = !!column.getColumnFilterValue() ? localization.filteringByColumn.replace('{column}', String(column.header)).replace('{filterType}', filterFn instanceof Function ? '' : // @ts-ignore
2027
+ localization["filter" + (filterFn.charAt(0).toUpperCase() + filterFn.slice(1))]).replace('{filterValue}', column.getColumnFilterValue()).replace('" "', '') : localization.showHideFilters;
2028
2028
  var headerElement = (_column$Header = column == null ? void 0 : column.Header == null ? void 0 : column.Header({
2029
2029
  header: header,
2030
2030
  tableInstance: tableInstance
@@ -2858,19 +2858,19 @@ var getAllLeafColumnDefs = function getAllLeafColumnDefs(columns) {
2858
2858
  return !col.columns;
2859
2859
  });
2860
2860
  };
2861
- var createGroup = function createGroup(table, column, currentFilterTypes) {
2861
+ var createGroup = function createGroup(table, column, currentFilterFns) {
2862
2862
  var _column$columns;
2863
2863
 
2864
2864
  return table.createGroup(_extends({}, column, {
2865
2865
  columns: column == null ? void 0 : (_column$columns = column.columns) == null ? void 0 : _column$columns.map == null ? void 0 : _column$columns.map(function (col) {
2866
- return col.columns ? createGroup(table, col, currentFilterTypes) : createDataColumn(table, col, currentFilterTypes);
2866
+ return col.columns ? createGroup(table, col, currentFilterFns) : createDataColumn(table, col, currentFilterFns);
2867
2867
  })
2868
2868
  }));
2869
2869
  };
2870
- var createDataColumn = function createDataColumn(table, column, currentFilterTypes) {
2870
+ var createDataColumn = function createDataColumn(table, column, currentFilterFns) {
2871
2871
  return (// @ts-ignore
2872
2872
  table.createDataColumn(column.id, _extends({
2873
- filterFn: currentFilterTypes[column.id] instanceof Function ? currentFilterTypes[column.id] : defaultFilterFNs[currentFilterTypes[column.id]]
2873
+ filterFn: currentFilterFns[column.id] instanceof Function ? currentFilterFns[column.id] : defaultFilterFNs[currentFilterFns[column.id]]
2874
2874
  }, column))
2875
2875
  );
2876
2876
  };
@@ -2879,7 +2879,7 @@ var createDisplayColumn = function createDisplayColumn(table, column) {
2879
2879
  };
2880
2880
 
2881
2881
  var MRT_TableRoot = function MRT_TableRoot(props) {
2882
- var _initialState$current, _initialState$current2, _initialState$isDense, _initialState$isFullS, _initialState$showFil, _initialState$showGlo, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6, _props$globalFilterTy;
2882
+ var _initialState$current, _initialState$current2, _initialState$isDense, _initialState$isFullS, _initialState$showFil, _initialState$showGlo, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6, _props$globalFilterFn;
2883
2883
 
2884
2884
  var _useState = React.useState(props.idPrefix),
2885
2885
  idPrefix = _useState[0],
@@ -2950,17 +2950,17 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
2950
2950
 
2951
2951
  var _useState9 = React.useState(function () {
2952
2952
  return Object.assign.apply(Object, [{}].concat(getAllLeafColumnDefs(props.columns).map(function (c) {
2953
- var _ref, _c$filter, _initialState$current3, _c$filterSelectOption, _ref2;
2953
+ var _ref, _c$filterFn, _initialState$current3, _c$filterSelectOption, _ref2;
2954
2954
 
2955
- return _ref2 = {}, _ref2[c.id] = (_ref = (_c$filter = c.filter) != null ? _c$filter : initialState == null ? void 0 : (_initialState$current3 = initialState.currentFilterTypes) == null ? void 0 : _initialState$current3[c.id]) != null ? _ref : !!((_c$filterSelectOption = c.filterSelectOptions) != null && _c$filterSelectOption.length) ? MRT_FILTER_TYPE.EQUALS : MRT_FILTER_TYPE.BEST_MATCH, _ref2;
2955
+ return _ref2 = {}, _ref2[c.id] = (_ref = (_c$filterFn = c.filterFn) != null ? _c$filterFn : initialState == null ? void 0 : (_initialState$current3 = initialState.currentFilterFns) == null ? void 0 : _initialState$current3[c.id]) != null ? _ref : !!((_c$filterSelectOption = c.filterSelectOptions) != null && _c$filterSelectOption.length) ? MRT_FILTER_OPTION.EQUALS : MRT_FILTER_OPTION.BEST_MATCH, _ref2;
2956
2956
  })));
2957
2957
  }),
2958
- currentFilterTypes = _useState9[0],
2959
- setCurrentFilterTypes = _useState9[1];
2958
+ currentFilterFns = _useState9[0],
2959
+ setCurrentFilterFns = _useState9[1];
2960
2960
 
2961
- var _useState10 = React.useState((_props$globalFilterTy = props.globalFilterType) != null ? _props$globalFilterTy : MRT_FILTER_TYPE.BEST_MATCH_FIRST),
2962
- currentGlobalFilterType = _useState10[0],
2963
- setCurrentGlobalFilterType = _useState10[1];
2961
+ var _useState10 = React.useState((_props$globalFilterFn = props.globalFilterFn) != null ? _props$globalFilterFn : MRT_FILTER_OPTION.BEST_MATCH_FIRST),
2962
+ currentGlobalFilterFn = _useState10[0],
2963
+ setCurrentGlobalFilterFn = _useState10[1];
2964
2964
 
2965
2965
  var table = React.useMemo(function () {
2966
2966
  return reactTable.createTable();
@@ -3034,9 +3034,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3034
3034
  }, [props.editingMode, props.enableEditing, props.enableExpandAll, props.enableExpanded, props.enableGrouping, props.enableRowActions, props.enableRowNumbers, props.enableRowSelection, props.enableSelectAll, props.localization, table]);
3035
3035
  var columns = React.useMemo(function () {
3036
3036
  return table.createColumns([].concat(displayColumns, props.columns.map(function (column) {
3037
- return column.columns ? createGroup(table, column, currentFilterTypes) : createDataColumn(table, column, currentFilterTypes);
3037
+ return column.columns ? createGroup(table, column, currentFilterFns) : createDataColumn(table, column, currentFilterFns);
3038
3038
  })));
3039
- }, [table, props.columns, currentFilterTypes]);
3039
+ }, [table, props.columns, currentFilterFns]);
3040
3040
  var data = React.useMemo(function () {
3041
3041
  return props.isLoading && !props.data.length ? [].concat(Array(10).fill(null)).map(function () {
3042
3042
  return Object.assign.apply(Object, [{}].concat(getAllLeafColumnDefs(props.columns).map(function (c) {
@@ -3049,7 +3049,7 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3049
3049
 
3050
3050
  var tableInstance = _extends({}, reactTable.useTableInstance(table, _extends({
3051
3051
  //@ts-ignore
3052
- filterTypes: defaultFilterFNs,
3052
+ filterFns: defaultFilterFNs,
3053
3053
  getColumnFilteredRowModel: reactTable.getColumnFilteredRowModelSync(),
3054
3054
  getCoreRowModel: reactTable.getCoreRowModelSync(),
3055
3055
  getExpandedRowModel: reactTable.getExpandedRowModel(),
@@ -3060,7 +3060,7 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3060
3060
  getSubRows: function getSubRows(originalRow) {
3061
3061
  return originalRow.subRows;
3062
3062
  },
3063
- globalFilterType: currentGlobalFilterType,
3063
+ globalFilterFn: currentGlobalFilterFn,
3064
3064
  onPaginationChange: function onPaginationChange(updater) {
3065
3065
  return setPagination(function (old) {
3066
3066
  return reactTable.functionalUpdate(updater, old);
@@ -3075,8 +3075,8 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3075
3075
  state: _extends({
3076
3076
  currentEditingCell: currentEditingCell,
3077
3077
  currentEditingRow: currentEditingRow,
3078
- currentFilterTypes: currentFilterTypes,
3079
- currentGlobalFilterType: currentGlobalFilterType,
3078
+ currentFilterFns: currentFilterFns,
3079
+ currentGlobalFilterFn: currentGlobalFilterFn,
3080
3080
  isDensePadding: isDensePadding,
3081
3081
  isFullScreen: isFullScreen,
3082
3082
  //@ts-ignore
@@ -3089,8 +3089,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3089
3089
  setCurrentEditingCell: setCurrentEditingCell,
3090
3090
  //@ts-ignore
3091
3091
  setCurrentEditingRow: setCurrentEditingRow,
3092
- setCurrentFilterTypes: setCurrentFilterTypes,
3093
- setCurrentGlobalFilterType: setCurrentGlobalFilterType,
3092
+ setCurrentFilterFns: setCurrentFilterFns,
3093
+ //@ts-ignore
3094
+ setCurrentGlobalFilterFn: setCurrentGlobalFilterFn,
3094
3095
  setIsDensePadding: setIsDensePadding,
3095
3096
  setIsFullScreen: setIsFullScreen,
3096
3097
  setShowFilters: setShowFilters,
@@ -3120,27 +3121,29 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3120
3121
  }
3121
3122
  }, [props.enablePersistentState, props.idPrefix, props.persistentStateMode, tableInstance]);
3122
3123
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(material.Dialog, {
3123
- TransitionComponent: material.Grow,
3124
3124
  PaperComponent: material.Box,
3125
+ TransitionComponent: material.Grow,
3125
3126
  disablePortal: true,
3126
3127
  fullScreen: true,
3127
3128
  keepMounted: false,
3128
3129
  onClose: function onClose() {
3129
- return tableInstance.setIsFullScreen(false);
3130
+ return setIsFullScreen(false);
3130
3131
  },
3131
- open: tableInstance.getState().isFullScreen,
3132
+ open: isFullScreen,
3132
3133
  transitionDuration: 400
3133
3134
  }, React__default.createElement(MRT_TablePaper, {
3134
3135
  tableInstance: tableInstance
3135
- })), !tableInstance.getState().isFullScreen && React__default.createElement(MRT_TablePaper, {
3136
+ })), !isFullScreen && React__default.createElement(MRT_TablePaper, {
3136
3137
  tableInstance: tableInstance
3137
3138
  }));
3138
3139
  };
3139
3140
 
3140
- var _excluded$5 = ["autoResetExpanded", "columnResizeMode", "editingMode", "enableColumnActions", "enableColumnFilters", "enableColumnResizing", "enableDensePaddingToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableHiding", "enableMultiRowSelection", "enablePagination", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarBottom", "enableToolbarInternalActions", "enableToolbarTop", "icons", "localization", "persistentStateMode", "positionActionsColumn", "positionPagination", "positionToolbarActions", "positionToolbarAlertBanner"];
3141
+ var _excluded$5 = ["autoResetExpanded", "autoResetSorting", "columnResizeMode", "editingMode", "enableColumnActions", "enableColumnFilters", "enableColumnResizing", "enableDensePaddingToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableHiding", "enableMultiRowSelection", "enablePagination", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarBottom", "enableToolbarInternalActions", "enableToolbarTop", "icons", "localization", "persistentStateMode", "positionActionsColumn", "positionPagination", "positionToolbarActions", "positionToolbarAlertBanner"];
3141
3142
  var MaterialReactTable = (function (_ref) {
3142
3143
  var _ref$autoResetExpande = _ref.autoResetExpanded,
3143
3144
  autoResetExpanded = _ref$autoResetExpande === void 0 ? false : _ref$autoResetExpande,
3145
+ _ref$autoResetSorting = _ref.autoResetSorting,
3146
+ autoResetSorting = _ref$autoResetSorting === void 0 ? false : _ref$autoResetSorting,
3144
3147
  _ref$columnResizeMode = _ref.columnResizeMode,
3145
3148
  columnResizeMode = _ref$columnResizeMode === void 0 ? 'onEnd' : _ref$columnResizeMode,
3146
3149
  _ref$editingMode = _ref.editingMode,
@@ -3199,6 +3202,7 @@ var MaterialReactTable = (function (_ref) {
3199
3202
 
3200
3203
  return React__default.createElement(MRT_TableRoot, Object.assign({
3201
3204
  autoResetExpanded: autoResetExpanded,
3205
+ autoResetSorting: autoResetSorting,
3202
3206
  columnResizeMode: columnResizeMode,
3203
3207
  editingMode: editingMode,
3204
3208
  enableColumnActions: enableColumnActions,