material-react-table 0.7.3 → 0.7.6

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.
@@ -7,5 +7,5 @@ interface Props {
7
7
  setAnchorEl: (anchorEl: HTMLElement | null) => void;
8
8
  tableInstance: MRT_TableInstance;
9
9
  }
10
- export declare const MRT_FilterTypeMenu: FC<Props>;
10
+ export declare const MRT_FilterOptionMenu: FC<Props>;
11
11
  export {};
package/dist/utils.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { ColumnDef, Table } from '@tanstack/react-table';
2
- import { MRT_ColumnDef, MRT_FilterType } from '.';
2
+ import { MRT_ColumnDef, MRT_FilterFn } from '.';
3
3
  export declare const getAllLeafColumnDefs: (columns: MRT_ColumnDef[]) => MRT_ColumnDef[];
4
- export declare const createGroup: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnDef<D>, currentFilterTypes: {
5
- [key: string]: MRT_FilterType;
4
+ export declare const createGroup: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnDef<D>, currentFilterFns: {
5
+ [key: string]: MRT_FilterFn<{}>;
6
6
  }) => ColumnDef<D>;
7
- export declare const createDataColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnDef<D>, currentFilterTypes: {
8
- [key: string]: MRT_FilterType;
7
+ export declare const createDataColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: MRT_ColumnDef<D>, currentFilterFns: {
8
+ [key: string]: MRT_FilterFn<{}>;
9
9
  }) => ColumnDef<D>;
10
- export declare const createDisplayColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: Pick<MRT_ColumnDef<D>, "footer" | "columns" | "id" | "accessorKey" | "accessorFn" | "cell" | "meta" | "enableHiding" | "defaultCanHide" | "defaultIsVisible" | "enablePinning" | "defaultCanPin" | "filterFn" | "enableAllFilters" | "enableColumnFilter" | "enableGlobalFilter" | "defaultCanFilter" | "defaultCanColumnFilter" | "defaultCanGlobalFilter" | "sortingFn" | "sortDescFirst" | "enableSorting" | "enableMultiSort" | "defaultCanSort" | "invertSorting" | "sortUndefined" | "aggregationFn" | "aggregateValue" | "aggregatedCell" | "enableGrouping" | "defaultCanGroup" | "enableResizing" | "defaultCanResize" | "width" | "minWidth" | "maxWidth" | "Edit" | "Filter" | "Footer" | "Header" | "Cell" | "enableClickToCopy" | "enableColumnActions" | "enableEditing" | "enabledColumnFilterTypes" | "filter" | "filterSelectOptions" | "muiTableBodyCellCopyButtonProps" | "muiTableBodyCellEditTextFieldProps" | "muiTableBodyCellProps" | "muiTableFooterCellProps" | "muiTableHeadCellColumnActionsButtonProps" | "muiTableHeadCellFilterTextFieldProps" | "muiTableHeadCellProps" | "onCellEditBlur" | "onCellEditChange" | "onColumnFilterValueChange"> & {
10
+ export declare const createDisplayColumn: <D extends Record<string, any> = {}>(table: Table<D>, column: Pick<MRT_ColumnDef<D>, "footer" | "columns" | "filterFn" | "id" | "accessorKey" | "accessorFn" | "cell" | "meta" | "enableHiding" | "defaultCanHide" | "defaultIsVisible" | "enablePinning" | "defaultCanPin" | "enableAllFilters" | "enableColumnFilter" | "enableGlobalFilter" | "defaultCanFilter" | "defaultCanColumnFilter" | "defaultCanGlobalFilter" | "sortingFn" | "sortDescFirst" | "enableSorting" | "enableMultiSort" | "defaultCanSort" | "invertSorting" | "sortUndefined" | "aggregationFn" | "aggregateValue" | "aggregatedCell" | "enableGrouping" | "defaultCanGroup" | "enableResizing" | "defaultCanResize" | "width" | "minWidth" | "maxWidth" | "Edit" | "Filter" | "Footer" | "Header" | "Cell" | "enableClickToCopy" | "enableColumnActions" | "enableEditing" | "enabledColumnFilterOptions" | "filterSelectOptions" | "muiTableBodyCellCopyButtonProps" | "muiTableBodyCellEditTextFieldProps" | "muiTableBodyCellProps" | "muiTableFooterCellProps" | "muiTableHeadCellColumnActionsButtonProps" | "muiTableHeadCellFilterTextFieldProps" | "muiTableHeadCellProps" | "onCellEditBlur" | "onCellEditChange" | "onColumnFilterValueChange"> & {
11
11
  header?: string | undefined;
12
12
  }) => ColumnDef<D>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.3",
2
+ "version": "0.7.6",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI implementation of react-table, inspired by material-table and the MUI X DataGrid, written from the ground up in TypeScript.",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "scripts": {
30
30
  "analyze": "size-limit --why",
31
- "build": "tsdx build && size-limit && rm -rf material-react-table-docs/node_modules/material-react-table/dist && cp -r dist material-react-table-docs/node_modules/material-react-table/ && cp -r src material-react-table-docs/node_modules/material-react-table/ && cp -r package.json material-react-table-docs/node_modules/material-react-table/package.json",
31
+ "build": "tsdx build && size-limit && rm -rf material-react-table-docs/node_modules/material-react-table/dist && cp -r dist material-react-table-docs/node_modules/material-react-table/ && cp -r src material-react-table-docs/node_modules/material-react-table/ && cp -r package.json material-react-table-docs/node_modules/material-react-table/package.json",
32
32
  "build-storybook": "build-storybook",
33
33
  "format": "prettier -w .",
34
34
  "lint": "eslint .",
@@ -59,9 +59,9 @@
59
59
  "@emotion/react": "^11.9.0",
60
60
  "@emotion/styled": "^11.8.1",
61
61
  "@etchteam/storybook-addon-status": "^4.2.1",
62
- "@faker-js/faker": "^6.1.2",
62
+ "@faker-js/faker": "^6.2.0",
63
63
  "@mui/icons-material": "^5.6.2",
64
- "@mui/material": "^5.6.2",
64
+ "@mui/material": "^5.6.3",
65
65
  "@size-limit/preset-small-lib": "^7.0.8",
66
66
  "@storybook/addon-a11y": "^6.4.22",
67
67
  "@storybook/addon-actions": "^6.4.22",
@@ -75,7 +75,7 @@
75
75
  "@types/react": "^17.0.41",
76
76
  "@types/react-dom": "^17.0.14",
77
77
  "babel-loader": "^8.2.5",
78
- "eslint": "^8.13.0",
78
+ "eslint": "^8.14.0",
79
79
  "eslint-plugin-react-hooks": "^4.4.0",
80
80
  "husky": "^7.0.4",
81
81
  "prettier": "^2.6.2",
@@ -86,7 +86,7 @@
86
86
  "storybook-addon-paddings": "^4.3.0",
87
87
  "storybook-dark-mode": "^1.0.9",
88
88
  "tsdx": "^0.14.1",
89
- "tslib": "^2.3.1",
89
+ "tslib": "^2.4.0",
90
90
  "typescript": "^4.6.3"
91
91
  },
92
92
  "peerDependencies": {
@@ -97,7 +97,7 @@
97
97
  "react": ">=16.8"
98
98
  },
99
99
  "dependencies": {
100
- "@tanstack/react-table": "^8.0.0-alpha.45",
100
+ "@tanstack/react-table": "^8.0.0-alpha.48",
101
101
  "match-sorter": "^6.3.1"
102
102
  }
103
103
  }
@@ -31,7 +31,8 @@ import {
31
31
  Column,
32
32
  ColumnDef,
33
33
  DefaultGenerics,
34
- FilterType,
34
+ FilterFn,
35
+ FilterFnOption,
35
36
  Header,
36
37
  HeaderGroup,
37
38
  Options,
@@ -44,20 +45,21 @@ import {
44
45
  } from '@tanstack/react-table';
45
46
  import { MRT_Localization, MRT_DefaultLocalization_EN } from './localization';
46
47
  import { MRT_Default_Icons, MRT_Icons } from './icons';
47
- import { MRT_FILTER_TYPE } from './enums';
48
+ import { MRT_FILTER_OPTION } from './enums';
48
49
  import { MRT_TableRoot } from './table/MRT_TableRoot';
49
50
 
50
51
  export type MRT_TableOptions<D extends Record<string, any> = {}> = Partial<
51
52
  Omit<
52
53
  Options<D>,
53
- 'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn'
54
+ 'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn' | 'filterFns'
54
55
  >
55
56
  > & {
56
57
  columns: MRT_ColumnDef<D>[];
57
58
  data: D[];
59
+ expandRowsFn?: (dataRow: D) => D[];
60
+ filterFns?: MRT_FILTER_OPTION | FilterFn<D> | string | number | symbol;
58
61
  initialState?: Partial<MRT_TableState<D>>;
59
62
  state?: Partial<MRT_TableState<D>>;
60
- expandRowsFn?: (dataRow: D) => D[];
61
63
  };
62
64
 
63
65
  export interface MRT_RowModel<D extends Record<string, any> = {}> {
@@ -96,17 +98,16 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
96
98
  options: MaterialReactTableProps<D> & {
97
99
  icons: MRT_Icons;
98
100
  idPrefix: string;
99
- filterTypes: { [key in MRT_FILTER_TYPE]: any };
100
101
  localization: MRT_Localization;
101
102
  };
102
103
  setCurrentEditingCell: Dispatch<SetStateAction<MRT_Cell<D> | null>>;
103
104
  setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row<D> | null>>;
104
- setCurrentFilterTypes: Dispatch<
105
+ setCurrentFilterFns: Dispatch<
105
106
  SetStateAction<{
106
- [key: string]: MRT_FilterType;
107
+ [key: string]: MRT_FilterFn<D>;
107
108
  }>
108
109
  >;
109
- setCurrentGlobalFilterType: Dispatch<SetStateAction<MRT_FILTER_TYPE>>;
110
+ setCurrentGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterFn<D>>>;
110
111
  setIsDensePadding: Dispatch<SetStateAction<boolean>>;
111
112
  setIsFullScreen: Dispatch<SetStateAction<boolean>>;
112
113
  setShowFilters: Dispatch<SetStateAction<boolean>>;
@@ -119,8 +120,8 @@ export type MRT_TableState<D extends Record<string, any> = {}> = Omit<
119
120
  > & {
120
121
  currentEditingCell: MRT_Cell<D> | null;
121
122
  currentEditingRow: MRT_Row<D> | null;
122
- currentFilterTypes: Record<string, string | Function>;
123
- currentGlobalFilterType: Record<string, string | Function>;
123
+ currentFilterFns: Record<string, string | Function>;
124
+ currentGlobalFilterFn: Record<string, string | Function>;
124
125
  isDensePadding: boolean;
125
126
  isFullScreen: boolean;
126
127
  showFilters: boolean;
@@ -130,23 +131,19 @@ export type MRT_TableState<D extends Record<string, any> = {}> = Omit<
130
131
 
131
132
  export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
132
133
  ColumnDef<D>,
133
- 'header' | 'footer' | 'columns'
134
+ 'header' | 'footer' | 'columns' | 'filterFn'
134
135
  > & {
135
136
  Edit?: ({
136
137
  cell,
137
138
  tableInstance,
138
- }: // onChange,
139
- {
139
+ }: {
140
140
  cell: MRT_Cell<D>;
141
141
  tableInstance: MRT_TableInstance<D>;
142
- // onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
143
142
  }) => ReactNode;
144
143
  Filter?: ({
145
- // onChange,
146
144
  header,
147
145
  tableInstance,
148
146
  }: {
149
- // onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
150
147
  header: MRT_Header<D>;
151
148
  tableInstance: MRT_TableInstance<D>;
152
149
  }) => ReactNode;
@@ -176,8 +173,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
176
173
  enableClickToCopy?: boolean;
177
174
  enableColumnActions?: boolean;
178
175
  enableEditing?: boolean;
179
- enabledColumnFilterTypes?: (MRT_FILTER_TYPE | string)[];
180
- filter?: MRT_FilterType | string | FilterType<D>;
176
+ enabledColumnFilterOptions?: (MRT_FILTER_OPTION | string)[];
177
+ filterFn?: MRT_FilterFn;
181
178
  filterSelectOptions?: (string | { text: string; value: string })[];
182
179
  footer?: string;
183
180
  header: string;
@@ -322,7 +319,13 @@ export type MRT_Cell<D extends Record<string, any> = {}> = Omit<
322
319
  row: MRT_Row<D>;
323
320
  };
324
321
 
325
- export type MRT_FilterType = MRT_FILTER_TYPE | Function;
322
+ export type MRT_FilterFn<D extends Record<string, any> = {}> =
323
+ | FilterFn<D>
324
+ | FilterFnOption<D>
325
+ | MRT_FILTER_OPTION
326
+ | number
327
+ | string
328
+ | symbol;
326
329
 
327
330
  export type MaterialReactTableProps<D extends Record<string, any> = {}> =
328
331
  MRT_TableOptions<D> & {
@@ -334,6 +337,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
334
337
  enableExpandAll?: boolean;
335
338
  enableFullScreenToggle?: boolean;
336
339
  enablePagination?: boolean;
340
+ enablePersistentState?: boolean;
337
341
  enableRowActions?: boolean;
338
342
  enableRowNumbers?: boolean;
339
343
  enableSelectAll?: boolean;
@@ -343,8 +347,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
343
347
  enableToolbarBottom?: boolean;
344
348
  enableToolbarInternalActions?: boolean;
345
349
  enableToolbarTop?: boolean;
346
- enabledGlobalFilterTypes?: (MRT_FILTER_TYPE | string)[];
347
- filterTypes?: { [key in MRT_FILTER_TYPE]: any };
350
+ enabledColumnFilterOptions?: (MRT_FILTER_OPTION | string)[];
351
+ enabledGlobalFilterOptions?: (MRT_FILTER_OPTION | string)[];
348
352
  icons?: Partial<MRT_Icons>;
349
353
  idPrefix?: string;
350
354
  isLoading?: boolean;
@@ -694,6 +698,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
694
698
  showGlobalFilter: boolean;
695
699
  tableInstance: MRT_TableInstance<D>;
696
700
  }) => void;
701
+ persistentStateMode?: 'localStorage' | 'sessionStorage';
697
702
  positionActionsColumn?: 'first' | 'last';
698
703
  positionPagination?: 'bottom' | 'top' | 'both';
699
704
  positionToolbarActions?: 'bottom' | 'top';
@@ -755,6 +760,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
755
760
 
756
761
  export default <D extends Record<string, any> = {}>({
757
762
  autoResetExpanded = false,
763
+ autoResetSorting = false,
758
764
  columnResizeMode = 'onEnd',
759
765
  editingMode = 'row',
760
766
  enableColumnActions = true,
@@ -778,6 +784,7 @@ export default <D extends Record<string, any> = {}>({
778
784
  enableToolbarTop = true,
779
785
  icons,
780
786
  localization,
787
+ persistentStateMode = 'sessionStorage',
781
788
  positionActionsColumn = 'first',
782
789
  positionPagination = 'bottom',
783
790
  positionToolbarActions = 'top',
@@ -786,6 +793,7 @@ export default <D extends Record<string, any> = {}>({
786
793
  }: MaterialReactTableProps<D>) => (
787
794
  <MRT_TableRoot
788
795
  autoResetExpanded={autoResetExpanded}
796
+ autoResetSorting={autoResetSorting}
789
797
  columnResizeMode={columnResizeMode}
790
798
  editingMode={editingMode}
791
799
  enableColumnActions={enableColumnActions}
@@ -809,6 +817,7 @@ export default <D extends Record<string, any> = {}>({
809
817
  enableToolbarTop={enableToolbarTop}
810
818
  icons={{ ...MRT_Default_Icons, ...icons }}
811
819
  localization={{ ...MRT_DefaultLocalization_EN, ...localization }}
820
+ persistentStateMode={persistentStateMode}
812
821
  positionActionsColumn={positionActionsColumn}
813
822
  positionPagination={positionPagination}
814
823
  positionToolbarActions={positionToolbarActions}
@@ -0,0 +1,69 @@
1
+ import React, { FC } from 'react';
2
+ import { Box, IconButton, Tooltip } from '@mui/material';
3
+ import type { MRT_Column, MRT_TableInstance } from '..';
4
+
5
+ interface Props {
6
+ column: MRT_Column;
7
+ tableInstance: MRT_TableInstance;
8
+ }
9
+
10
+ export const MRT_ColumnPinningButtons: FC<Props> = ({
11
+ column,
12
+ tableInstance,
13
+ }) => {
14
+ const {
15
+ getState,
16
+ options: {
17
+ icons: { PushPinIcon },
18
+ localization,
19
+ },
20
+ } = tableInstance;
21
+
22
+ const { columnOrder } = getState();
23
+
24
+ const handlePinColumn = (pinDirection: 'left' | 'right' | false) => {
25
+ column.pin(pinDirection);
26
+ if (column.columnDefType === 'display') {
27
+ tableInstance.setColumnOrder([column.id, ...columnOrder]);
28
+ }
29
+ };
30
+
31
+ const pinned = column.getIsPinned();
32
+
33
+ return (
34
+ <Box sx={{ mr: '8px' }}>
35
+ <Tooltip
36
+ arrow
37
+ title={pinned === 'left' ? localization.unpin : localization.pinToLeft}
38
+ >
39
+ <IconButton
40
+ onClick={() => handlePinColumn(pinned === 'left' ? false : 'left')}
41
+ size="small"
42
+ >
43
+ <PushPinIcon
44
+ style={{
45
+ transform: pinned === 'left' ? 'rotate(0)' : 'rotate(90deg)',
46
+ }}
47
+ />
48
+ </IconButton>
49
+ </Tooltip>
50
+ <Tooltip
51
+ arrow
52
+ title={
53
+ pinned === 'right' ? localization.unpin : localization.pinToRight
54
+ }
55
+ >
56
+ <IconButton
57
+ onClick={() => handlePinColumn(pinned === 'right' ? false : 'right')}
58
+ size="small"
59
+ >
60
+ <PushPinIcon
61
+ style={{
62
+ transform: pinned === 'right' ? 'rotate(0)' : 'rotate(-90deg)',
63
+ }}
64
+ />
65
+ </IconButton>
66
+ </Tooltip>
67
+ </Box>
68
+ );
69
+ };
package/src/enums.ts CHANGED
@@ -1,4 +1,4 @@
1
- export enum MRT_FILTER_TYPE {
1
+ export enum MRT_FILTER_OPTION {
2
2
  BEST_MATCH = 'bestMatch',
3
3
  BEST_MATCH_FIRST = 'bestMatchFirst',
4
4
  CONTAINS = 'contains',
@@ -60,20 +60,18 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, tableInstance }) => {
60
60
  : localization.sortedByColumnAsc.replace('{column}', column.header)
61
61
  : localization.unsorted;
62
62
 
63
- const filterType = getState()?.currentFilterTypes?.[header.id];
63
+ const filterFn = getState()?.currentFilterFns?.[header.id];
64
64
 
65
65
  const filterTooltip = !!column.getColumnFilterValue()
66
66
  ? localization.filteringByColumn
67
67
  .replace('{column}', String(column.header))
68
68
  .replace(
69
69
  '{filterType}',
70
- filterType instanceof Function
70
+ filterFn instanceof Function
71
71
  ? ''
72
72
  : // @ts-ignore
73
73
  localization[
74
- `filter${
75
- filterType.charAt(0).toUpperCase() + filterType.slice(1)
76
- }`
74
+ `filter${filterFn.charAt(0).toUpperCase() + filterFn.slice(1)}`
77
75
  ],
78
76
  )
79
77
  .replace('{filterValue}', column.getColumnFilterValue() as string)
@@ -16,8 +16,8 @@ import {
16
16
  Tooltip,
17
17
  } from '@mui/material';
18
18
  import type { MRT_Header, MRT_TableInstance } from '..';
19
- import { MRT_FilterTypeMenu } from '../menus/MRT_FilterTypeMenu';
20
- import { MRT_FILTER_TYPE } from '../enums';
19
+ import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
20
+ import { MRT_FILTER_OPTION } from '../enums';
21
21
 
22
22
  interface Props {
23
23
  header: MRT_Header;
@@ -33,12 +33,12 @@ export const MRT_FilterTextField: FC<Props> = ({ header, tableInstance }) => {
33
33
  localization,
34
34
  muiTableHeadCellFilterTextFieldProps,
35
35
  },
36
- setCurrentFilterTypes,
36
+ setCurrentFilterFns,
37
37
  } = tableInstance;
38
38
 
39
39
  const { column } = header;
40
40
 
41
- const { currentFilterTypes } = getState();
41
+ const { currentFilterFns } = getState();
42
42
 
43
43
  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
44
44
 
@@ -82,9 +82,9 @@ export const MRT_FilterTextField: FC<Props> = ({ header, tableInstance }) => {
82
82
  const handleClearFilterChip = () => {
83
83
  setFilterValue('');
84
84
  column.setColumnFilterValue(undefined);
85
- setCurrentFilterTypes((prev) => ({
85
+ setCurrentFilterFns((prev) => ({
86
86
  ...prev,
87
- [header.id]: MRT_FILTER_TYPE.BEST_MATCH,
87
+ [header.id]: MRT_FILTER_OPTION.BEST_MATCH,
88
88
  }));
89
89
  };
90
90
 
@@ -93,16 +93,16 @@ export const MRT_FilterTextField: FC<Props> = ({ header, tableInstance }) => {
93
93
  }
94
94
 
95
95
  const filterId = `mrt-${idPrefix}-${header.id}-filter-text-field`;
96
- const filterType = currentFilterTypes?.[header.id];
96
+ const filterFn = currentFilterFns?.[header.id];
97
97
  const isSelectFilter = !!column.filterSelectOptions;
98
98
  const filterChipLabel =
99
- !(filterType instanceof Function) &&
100
- [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(
101
- filterType as MRT_FILTER_TYPE,
99
+ !(filterFn instanceof Function) &&
100
+ [MRT_FILTER_OPTION.EMPTY, MRT_FILTER_OPTION.NOT_EMPTY].includes(
101
+ filterFn as MRT_FILTER_OPTION,
102
102
  )
103
103
  ? //@ts-ignore
104
104
  localization[
105
- `filter${filterType.charAt(0).toUpperCase() + filterType.slice(1)}`
105
+ `filter${filterFn.charAt(0).toUpperCase() + filterFn.slice(1)}`
106
106
  ]
107
107
  : '';
108
108
  const filterPlaceholder = localization.filterByColumn?.replace(
@@ -125,14 +125,14 @@ export const MRT_FilterTextField: FC<Props> = ({ header, tableInstance }) => {
125
125
  }}
126
126
  helperText={
127
127
  <label htmlFor={filterId}>
128
- {filterType instanceof Function
128
+ {filterFn instanceof Function
129
129
  ? localization.filterMode.replace(
130
130
  '{filterType}',
131
131
  // @ts-ignore
132
132
  localization[
133
133
  `filter${
134
- filterType.name.charAt(0).toUpperCase() +
135
- filterType.name.slice(1)
134
+ filterFn.name.charAt(0).toUpperCase() +
135
+ filterFn.name.slice(1)
136
136
  }`
137
137
  ] ?? '',
138
138
  ) ?? ''
@@ -141,7 +141,7 @@ export const MRT_FilterTextField: FC<Props> = ({ header, tableInstance }) => {
141
141
  // @ts-ignore
142
142
  localization[
143
143
  `filter${
144
- filterType.charAt(0).toUpperCase() + filterType.slice(1)
144
+ filterFn.charAt(0).toUpperCase() + filterFn.slice(1)
145
145
  }`
146
146
  ],
147
147
  )}
@@ -248,7 +248,7 @@ export const MRT_FilterTextField: FC<Props> = ({ header, tableInstance }) => {
248
248
  );
249
249
  })}
250
250
  </TextField>
251
- <MRT_FilterTypeMenu
251
+ <MRT_FilterOptionMenu
252
252
  anchorEl={anchorEl}
253
253
  header={header}
254
254
  setAnchorEl={setAnchorEl}
@@ -13,7 +13,7 @@ import {
13
13
  TextField,
14
14
  Tooltip,
15
15
  } from '@mui/material';
16
- import { MRT_FilterTypeMenu } from '../menus/MRT_FilterTypeMenu';
16
+ import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
17
17
  import { MRT_TableInstance } from '..';
18
18
 
19
19
  interface Props {
@@ -105,7 +105,7 @@ export const MRT_SearchTextField: FC<Props> = ({ tableInstance }) => {
105
105
  {...textFieldProps}
106
106
  sx={{ justifySelf: 'end', ...textFieldProps?.sx }}
107
107
  />
108
- <MRT_FilterTypeMenu
108
+ <MRT_FilterOptionMenu
109
109
  anchorEl={anchorEl}
110
110
  setAnchorEl={setAnchorEl}
111
111
  tableInstance={tableInstance}
@@ -56,6 +56,7 @@ export interface MRT_Localization {
56
56
  toggleSelectRow: string;
57
57
  ungroupByColumn: string;
58
58
  unpin: string;
59
+ unpinAll: string;
59
60
  unsorted: string;
60
61
  }
61
62
 
@@ -118,5 +119,6 @@ export const MRT_DefaultLocalization_EN: MRT_Localization = {
118
119
  toggleSelectRow: 'Toggle select row',
119
120
  ungroupByColumn: 'Ungroup by {column}',
120
121
  unpin: 'Unpin',
122
+ unpinAll: 'Unpin all',
121
123
  unsorted: 'Unsorted',
122
124
  };
@@ -1,7 +1,7 @@
1
1
  import React, { FC, useState } from 'react';
2
2
  import { Box, IconButton, ListItemIcon, Menu, MenuItem } from '@mui/material';
3
3
  import type { MRT_Header, MRT_TableInstance } from '..';
4
- import { MRT_FilterTypeMenu } from './MRT_FilterTypeMenu';
4
+ import { MRT_FilterOptionMenu } from './MRT_FilterOptionMenu';
5
5
  import { MRT_ShowHideColumnsMenu } from './MRT_ShowHideColumnsMenu';
6
6
 
7
7
  export const commonMenuItemStyles = {
@@ -240,7 +240,7 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
240
240
  </IconButton>
241
241
  )}
242
242
  </MenuItem>,
243
- <MRT_FilterTypeMenu
243
+ <MRT_FilterOptionMenu
244
244
  anchorEl={filterMenuAnchorEl}
245
245
  header={header}
246
246
  key={2}