material-react-table 0.6.9 → 0.6.10

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.
@@ -2,7 +2,7 @@ import { FC } from 'react';
2
2
  import type { MRT_HeaderGroup } from '..';
3
3
  interface Props {
4
4
  anchorEl: HTMLElement | null;
5
- column: MRT_HeaderGroup;
5
+ column?: MRT_HeaderGroup;
6
6
  setAnchorEl: (anchorEl: HTMLElement | null) => void;
7
7
  onSelect?: () => void;
8
8
  }
package/dist/useMRT.d.ts CHANGED
@@ -17,6 +17,7 @@ export declare type UseMRT<D extends {} = {}> = MaterialReactTableProps<D> & {
17
17
  setCurrentFilterTypes: Dispatch<SetStateAction<{
18
18
  [key: string]: MRT_FilterType;
19
19
  }>>;
20
+ setCurrentGlobalFilterType: Dispatch<SetStateAction<MRT_FILTER_TYPE>>;
20
21
  setDensePadding: Dispatch<SetStateAction<boolean>>;
21
22
  setFullScreen: Dispatch<SetStateAction<boolean>>;
22
23
  setShowFilters: Dispatch<SetStateAction<boolean>>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.9",
2
+ "version": "0.6.10",
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 DataGrid, written from the ground up in TypeScript.",
@@ -1,6 +1,7 @@
1
1
  import React, { ChangeEvent, FC, MouseEvent, ReactNode } from 'react';
2
2
  import {
3
3
  AlertProps,
4
+ ButtonProps,
4
5
  CheckboxProps,
5
6
  IconButtonProps,
6
7
  LinearProgressProps,
@@ -140,9 +141,12 @@ export type MRT_ColumnInterface<D extends {} = {}> = ColumnInterface<D> &
140
141
  disableColumnHiding?: boolean;
141
142
  disableEditing?: boolean;
142
143
  disableFilters?: boolean;
144
+ enabledFilterTypes?: (MRT_FILTER_TYPE | string)[];
143
145
  filter?: MRT_FilterType | string | FilterType<D>;
144
146
  filterSelectOptions?: (string | { text: string; value: string })[];
145
- filterTypes?: (MRT_FILTER_TYPE | string)[];
147
+ muiTableBodyCellCopyButtonProps?:
148
+ | ButtonProps
149
+ | ((cell?: MRT_Cell<D>) => ButtonProps);
146
150
  muiTableBodyCellEditTextFieldProps?:
147
151
  | TextFieldProps
148
152
  | ((cell: MRT_Cell<D>) => TextFieldProps);
@@ -152,12 +156,12 @@ export type MRT_ColumnInterface<D extends {} = {}> = ColumnInterface<D> &
152
156
  muiTableFooterCellProps?:
153
157
  | TableCellProps
154
158
  | ((column: Column<D>) => TableCellProps);
155
- muiTableHeadCellFilterTextFieldProps?:
156
- | TextFieldProps
157
- | ((column: Column<D>) => TextFieldProps);
158
159
  muiTableHeadCellColumnActionsButtonProps?:
159
160
  | IconButtonProps
160
161
  | ((column: Column<D>) => IconButtonProps);
162
+ muiTableHeadCellFilterTextFieldProps?:
163
+ | TextFieldProps
164
+ | ((column: Column<D>) => TextFieldProps);
161
165
  muiTableHeadCellProps?:
162
166
  | TableCellProps
163
167
  | ((column: Column<D>) => TableCellProps);
@@ -215,6 +219,7 @@ export type MRT_TableState<D extends {} = {}> = TableState<D> &
215
219
  UseSortByState<D> & {
216
220
  currentEditingRow: MRT_Row<D> | null;
217
221
  currentFilterTypes: { [key: string]: MRT_FilterType };
222
+ currentGlobalFilterType: MRT_FilterType;
218
223
  densePadding: boolean;
219
224
  fullScreen: boolean;
220
225
  showFilters: boolean;
@@ -246,6 +251,7 @@ export type MaterialReactTableProps<D extends {} = {}> = UseTableOptions<D> &
246
251
  enableRowEditing?: boolean;
247
252
  enableRowNumbers?: boolean;
248
253
  enableSelection?: boolean;
254
+ enabledGlobalFilterTypes?: (MRT_FILTER_TYPE | string)[];
249
255
  filterTypes?: { [key in MRT_FILTER_TYPE]: any };
250
256
  hideTableFooter?: boolean;
251
257
  hideTableHead?: boolean;
@@ -268,6 +274,9 @@ export type MaterialReactTableProps<D extends {} = {}> = UseTableOptions<D> &
268
274
  row?: MRT_Row<D>,
269
275
  tableInstance?: MRT_TableInstance<D>,
270
276
  ) => CheckboxProps);
277
+ muiTableBodyCellCopyButtonProps?:
278
+ | ButtonProps
279
+ | ((cell?: MRT_Cell<D>) => ButtonProps);
271
280
  muiTableBodyCellEditTextFieldProps?:
272
281
  | TextFieldProps
273
282
  | ((cell?: MRT_Cell<D>) => TextFieldProps);
@@ -344,12 +353,12 @@ export type MaterialReactTableProps<D extends {} = {}> = UseTableOptions<D> &
344
353
  event: MouseEvent<HTMLButtonElement>,
345
354
  row: Row<D>,
346
355
  ) => void;
356
+ onSelectAllChange?: (event: ChangeEvent, selectedRows: Row<D>[]) => void;
347
357
  onSelectChange?: (
348
358
  event: ChangeEvent,
349
359
  row: Row<D>,
350
360
  selectedRows: Row<D>[],
351
361
  ) => void;
352
- onSelectAllChange?: (event: ChangeEvent, selectedRows: Row<D>[]) => void;
353
362
  positionActionsColumn?: 'first' | 'last';
354
363
  positionPagination?: 'bottom' | 'top' | 'both';
355
364
  positionToolbarActions?: 'bottom' | 'top';
@@ -388,7 +397,7 @@ export type MaterialReactTableProps<D extends {} = {}> = UseTableOptions<D> &
388
397
  export default <D extends {} = {}>({
389
398
  defaultColumn = { minWidth: 50, maxWidth: 1000 },
390
399
  filterTypes,
391
- globalFilter = 'fuzzy',
400
+ globalFilter = MRT_FILTER_TYPE.BEST_MATCH_FIRST,
392
401
  icons,
393
402
  localization,
394
403
  positionActionsColumn = 'first',
@@ -78,13 +78,19 @@ export const MRT_TableBodyCell: FC<Props> = ({ cell }) => {
78
78
  currentEditingRow?.id === cell.row.id ? (
79
79
  <MRT_EditCellTextField cell={cell} />
80
80
  ) : cell.isPlaceholder ? null : cell.isAggregated ? (
81
- cell.render('Aggregated')
81
+ enableClickToCopy && !cell.column.disableClickToCopy ? (
82
+ <MRT_CopyButton cell={cell}>
83
+ {cell.render('Aggregated')}
84
+ </MRT_CopyButton>
85
+ ) : (
86
+ cell.render('Aggregated')
87
+ )
82
88
  ) : cell.isGrouped ? (
83
89
  <span>
84
90
  {cell.render('Cell')} ({cell.row.subRows.length})
85
91
  </span>
86
92
  ) : enableClickToCopy && !cell.column.disableClickToCopy ? (
87
- <MRT_CopyButton cell={cell} />
93
+ <MRT_CopyButton cell={cell}>{cell.render('Cell')}</MRT_CopyButton>
88
94
  ) : (
89
95
  cell.render('Cell')
90
96
  )}
@@ -57,17 +57,21 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
57
57
  selected={row.isSelected}
58
58
  {...tableRowProps}
59
59
  >
60
- {enableRowNumbers && (
61
- <TableCell sx={{ ...commonTableBodyCellStyles(densePadding) }}>
62
- {row.index + 1}
63
- </TableCell>
64
- )}
65
60
  {(enableRowActions || enableRowEditing) &&
66
61
  positionActionsColumn === 'first' && (
67
62
  <MRT_ToggleRowActionMenuButton row={row} />
68
63
  )}
69
64
  {(anyRowsCanExpand || renderDetailPanel) && (
70
- <MRT_ExpandButton row={row} />
65
+ <TableCell
66
+ size="small"
67
+ sx={{
68
+ ...commonTableBodyButtonCellStyles(densePadding),
69
+ pl: `${row.depth + 0.5}rem`,
70
+ textAlign: 'left',
71
+ }}
72
+ >
73
+ <MRT_ExpandButton row={row} />
74
+ </TableCell>
71
75
  )}
72
76
  {enableSelection && (
73
77
  <TableCell
@@ -82,6 +86,11 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
82
86
  <MRT_SelectCheckbox row={row} />
83
87
  </TableCell>
84
88
  )}
89
+ {enableRowNumbers && (
90
+ <TableCell sx={{ ...commonTableBodyCellStyles(densePadding) }}>
91
+ {row.index + 1}
92
+ </TableCell>
93
+ )}
85
94
  {row.cells.map((cell: MRT_Cell) => (
86
95
  <MRT_TableBodyCell key={cell.getCellProps().key} cell={cell} />
87
96
  ))}
@@ -7,8 +7,8 @@ interface Props {
7
7
  cell: MRT_Cell;
8
8
  }
9
9
 
10
- export const MRT_CopyButton: FC<Props> = ({ cell }) => {
11
- const { localization } = useMRT();
10
+ export const MRT_CopyButton: FC<Props> = ({ cell, children }) => {
11
+ const { localization, muiTableBodyCellCopyButtonProps } = useMRT();
12
12
 
13
13
  const [copied, setCopied] = useState(false);
14
14
 
@@ -18,6 +18,21 @@ export const MRT_CopyButton: FC<Props> = ({ cell }) => {
18
18
  setTimeout(() => setCopied(false), 4000);
19
19
  };
20
20
 
21
+ const mTableBodyCellCopyButtonProps =
22
+ muiTableBodyCellCopyButtonProps instanceof Function
23
+ ? muiTableBodyCellCopyButtonProps(cell)
24
+ : muiTableBodyCellCopyButtonProps;
25
+
26
+ const mcTableBodyCellCopyButtonProps =
27
+ cell.column.muiTableBodyCellCopyButtonProps instanceof Function
28
+ ? cell.column.muiTableBodyCellCopyButtonProps(cell)
29
+ : cell.column.muiTableBodyCellCopyButtonProps;
30
+
31
+ const buttonProps = {
32
+ ...mTableBodyCellCopyButtonProps,
33
+ ...mcTableBodyCellCopyButtonProps,
34
+ };
35
+
21
36
  return (
22
37
  <Tooltip
23
38
  arrow
@@ -30,20 +45,23 @@ export const MRT_CopyButton: FC<Props> = ({ cell }) => {
30
45
  aria-label={localization.clickToCopy}
31
46
  onClick={() => handleCopy(cell.value)}
32
47
  size="small"
48
+ {...buttonProps}
33
49
  sx={{
34
50
  backgroundColor: 'transparent',
51
+ border: 'none',
35
52
  color: 'inherit',
36
- letterSpacing: 'inherit',
37
53
  fontFamily: 'inherit',
38
54
  fontSize: 'inherit',
55
+ letterSpacing: 'inherit',
39
56
  m: '-0.25rem',
40
- textTransform: 'inherit',
41
- textAlign: 'inherit',
42
57
  minWidth: 'unset',
58
+ textAlign: 'inherit',
59
+ textTransform: 'inherit',
60
+ ...buttonProps?.sx,
43
61
  }}
44
62
  variant="text"
45
63
  >
46
- {cell.render('Cell')}
64
+ {children}
47
65
  </Button>
48
66
  </Tooltip>
49
67
  );
@@ -1,7 +1,6 @@
1
1
  import React, { FC } from 'react';
2
- import { IconButton, TableCell } from '@mui/material';
2
+ import { IconButton } from '@mui/material';
3
3
  import { useMRT } from '../useMRT';
4
- import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
5
4
 
6
5
  interface Props {}
7
6
 
@@ -14,24 +13,18 @@ export const MRT_ExpandAllButton: FC<Props> = () => {
14
13
  } = useMRT();
15
14
 
16
15
  return (
17
- <TableCell
18
- size="small"
19
- {...tableInstance.getToggleAllRowsExpandedProps()}
20
- sx={commonTableBodyButtonCellStyles(tableInstance.state.densePadding)}
16
+ <IconButton
17
+ aria-label={localization.expandAll}
18
+ title={localization.expandAll}
21
19
  >
22
- <IconButton
23
- aria-label={localization.expandAll}
24
- title={localization.expandAll}
25
- >
26
- <DoubleArrowDownIcon
27
- style={{
28
- transform: `rotate(${
29
- tableInstance.isAllRowsExpanded ? -180 : anyRowsExpanded ? -90 : 0
30
- }deg)`,
31
- transition: 'transform 0.2s',
32
- }}
33
- />
34
- </IconButton>
35
- </TableCell>
20
+ <DoubleArrowDownIcon
21
+ style={{
22
+ transform: `rotate(${
23
+ tableInstance.isAllRowsExpanded ? -180 : anyRowsExpanded ? -90 : 0
24
+ }deg)`,
25
+ transition: 'transform 0.2s',
26
+ }}
27
+ />
28
+ </IconButton>
36
29
  );
37
30
  };
@@ -1,8 +1,7 @@
1
1
  import React, { FC, MouseEvent } from 'react';
2
- import { IconButton, TableCell } from '@mui/material';
2
+ import { IconButton } from '@mui/material';
3
3
  import { useMRT } from '../useMRT';
4
4
  import type { MRT_Row } from '..';
5
- import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
6
5
 
7
6
  interface Props {
8
7
  row: MRT_Row;
@@ -14,9 +13,6 @@ export const MRT_ExpandButton: FC<Props> = ({ row }) => {
14
13
  localization,
15
14
  onRowExpandChange,
16
15
  renderDetailPanel,
17
- tableInstance: {
18
- state: { densePadding },
19
- },
20
16
  } = useMRT();
21
17
 
22
18
  const handleToggleExpand = (event: MouseEvent<HTMLButtonElement>) => {
@@ -26,34 +22,25 @@ export const MRT_ExpandButton: FC<Props> = ({ row }) => {
26
22
  };
27
23
 
28
24
  return (
29
- <TableCell
30
- size="small"
31
- sx={{
32
- ...commonTableBodyButtonCellStyles(densePadding),
33
- pl: `${row.depth + 0.5}rem`,
34
- textAlign: 'left',
35
- }}
25
+ <IconButton
26
+ aria-label={localization.expand}
27
+ disabled={!row.canExpand && !renderDetailPanel}
28
+ title={localization.expand}
29
+ {...row.getToggleRowExpandedProps()}
30
+ onClick={handleToggleExpand}
36
31
  >
37
- <IconButton
38
- aria-label={localization.expand}
39
- disabled={!row.canExpand && !renderDetailPanel}
40
- title={localization.expand}
41
- {...row.getToggleRowExpandedProps()}
42
- onClick={handleToggleExpand}
43
- >
44
- <ExpandMoreIcon
45
- style={{
46
- transform: `rotate(${
47
- !row.canExpand && !renderDetailPanel
48
- ? -90
49
- : row.isExpanded
50
- ? -180
51
- : 0
52
- }deg)`,
53
- transition: 'transform 0.2s',
54
- }}
55
- />
56
- </IconButton>
57
- </TableCell>
32
+ <ExpandMoreIcon
33
+ style={{
34
+ transform: `rotate(${
35
+ !row.canExpand && !renderDetailPanel
36
+ ? -90
37
+ : row.isExpanded
38
+ ? -180
39
+ : 0
40
+ }deg)`,
41
+ transition: 'transform 0.2s',
42
+ }}
43
+ />
44
+ </IconButton>
58
45
  );
59
46
  };
package/src/enums.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  export enum MRT_FILTER_TYPE {
2
+ BEST_MATCH = 'bestMatch',
3
+ BEST_MATCH_FIRST = 'bestMatchFirst',
2
4
  CONTAINS = 'contains',
3
5
  EMPTY = 'empty',
4
6
  ENDS_WITH = 'endsWith',
5
7
  EQUALS = 'equals',
6
- FUZZY = 'fuzzy',
7
8
  GREATER_THAN = 'greaterThan',
8
9
  LESS_THAN = 'lessThan',
9
10
  NOT_EMPTY = 'notEmpty',
package/src/filtersFNs.ts CHANGED
@@ -1,7 +1,20 @@
1
1
  import { matchSorter } from 'match-sorter';
2
2
  import { MRT_Row } from '.';
3
3
 
4
- export const fuzzy = (
4
+ export const bestMatchFirst = (
5
+ rows: MRT_Row[],
6
+ columnIds: string[] | string,
7
+ filterValue: string | number,
8
+ ) =>
9
+ matchSorter(rows, filterValue.toString().trim(), {
10
+ keys: Array.isArray(columnIds)
11
+ ? columnIds.map((c) => `values.${c}`)
12
+ : [`values.${columnIds}`],
13
+ });
14
+
15
+ bestMatchFirst.autoRemove = (val: any) => !val;
16
+
17
+ export const bestMatch = (
5
18
  rows: MRT_Row[],
6
19
  columnIds: string[] | string,
7
20
  filterValue: string | number,
@@ -13,7 +26,7 @@ export const fuzzy = (
13
26
  sorter: (rankedItems) => rankedItems,
14
27
  });
15
28
 
16
- fuzzy.autoRemove = (val: any) => !val;
29
+ bestMatch.autoRemove = (val: any) => !val;
17
30
 
18
31
  export const contains = (
19
32
  rows: MRT_Row[],
@@ -131,11 +144,12 @@ export const notEmpty = (
131
144
  notEmpty.autoRemove = (val: any) => !val;
132
145
 
133
146
  export const defaultFilterFNs = {
147
+ bestMatch,
148
+ bestMatchFirst,
134
149
  contains,
135
150
  empty,
136
151
  endsWith,
137
152
  equals,
138
- fuzzy,
139
153
  greaterThan,
140
154
  lessThan,
141
155
  notEmpty,
@@ -99,6 +99,7 @@ export const MRT_TableHeadCell: FC<Props> = ({ column }) => {
99
99
  ],
100
100
  )
101
101
  .replace('{filterValue}', column.filterValue)
102
+ .replace('" "', '')
102
103
  : localization.showHideFilters;
103
104
 
104
105
  const columnHeader = column.render('Header') as string;
@@ -4,7 +4,6 @@ import {
4
4
  commonTableHeadCellStyles,
5
5
  MRT_TableHeadCell,
6
6
  } from './MRT_TableHeadCell';
7
- import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
8
7
  import { useMRT } from '../useMRT';
9
8
  import { MRT_SelectCheckbox } from '../inputs/MRT_SelectCheckbox';
10
9
  import { MRT_ExpandAllButton } from '../buttons/MRT_ExpandAllButton';
@@ -52,18 +51,6 @@ export const MRT_TableHeadRow: FC<Props> = ({ headerGroup }) => {
52
51
 
53
52
  return (
54
53
  <TableRow {...tableRowProps}>
55
- {enableRowNumbers &&
56
- (isParentHeader ? (
57
- <MRT_TableSpacerCell />
58
- ) : (
59
- <TableCell
60
- sx={{
61
- ...commonTableHeadCellStyles(tableInstance.state.densePadding),
62
- }}
63
- >
64
- #
65
- </TableCell>
66
- ))}
67
54
  {(enableRowActions || enableRowEditing) &&
68
55
  positionActionsColumn === 'first' &&
69
56
  (isParentHeader ? (
@@ -73,7 +60,18 @@ export const MRT_TableHeadRow: FC<Props> = ({ headerGroup }) => {
73
60
  ))}
74
61
  {anyRowsCanExpand || renderDetailPanel ? (
75
62
  !disableExpandAll && !isParentHeader ? (
76
- <MRT_ExpandAllButton />
63
+ <TableCell
64
+ size="small"
65
+ {...tableInstance.getToggleAllRowsExpandedProps()}
66
+ sx={{
67
+ ...commonTableHeadCellStyles(tableInstance.state.densePadding),
68
+ width: '3rem',
69
+ maxWidth: '3rem',
70
+ textAlign: 'center',
71
+ }}
72
+ >
73
+ <MRT_ExpandAllButton />
74
+ </TableCell>
77
75
  ) : (
78
76
  <MRT_TableSpacerCell
79
77
  width={`${
@@ -86,11 +84,10 @@ export const MRT_TableHeadRow: FC<Props> = ({ headerGroup }) => {
86
84
  !isParentHeader && !disableSelectAll ? (
87
85
  <TableCell
88
86
  sx={{
89
- ...commonTableBodyButtonCellStyles(
90
- tableInstance.state.densePadding,
91
- ),
87
+ ...commonTableHeadCellStyles(tableInstance.state.densePadding),
92
88
  maxWidth: '3rem',
93
89
  width: '3rem',
90
+ textAlign: 'center',
94
91
  }}
95
92
  >
96
93
  <MRT_SelectCheckbox selectAll />
@@ -99,6 +96,20 @@ export const MRT_TableHeadRow: FC<Props> = ({ headerGroup }) => {
99
96
  <MRT_TableSpacerCell width="1rem" />
100
97
  )
101
98
  ) : null}
99
+ {enableRowNumbers &&
100
+ (isParentHeader ? (
101
+ <MRT_TableSpacerCell />
102
+ ) : (
103
+ <TableCell
104
+ sx={{
105
+ ...commonTableHeadCellStyles(tableInstance.state.densePadding),
106
+ width: '2rem',
107
+ maxWidth: '2rem',
108
+ }}
109
+ >
110
+ #
111
+ </TableCell>
112
+ ))}
102
113
  {headerGroup.headers.map((column: MRT_HeaderGroup) => (
103
114
  <MRT_TableHeadCell key={column.getHeaderProps().key} column={column} />
104
115
  ))}
@@ -65,7 +65,7 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
65
65
  column.setFilter(undefined);
66
66
  setCurrentFilterTypes((prev) => ({
67
67
  ...prev,
68
- [column.id]: MRT_FILTER_TYPE.FUZZY,
68
+ [column.id]: MRT_FILTER_TYPE.BEST_MATCH,
69
69
  }));
70
70
  };
71
71
 
@@ -132,13 +132,6 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
132
132
  sx: { fontSize: '0.6rem', lineHeight: '0.8rem' },
133
133
  }}
134
134
  label={isSelectFilter && !filterValue ? filterPlaceholder : undefined}
135
- InputLabelProps={{
136
- shrink: false,
137
- sx: {
138
- maxWidth: 'calc(100% - 2.5rem)',
139
- },
140
- title: filterPlaceholder,
141
- }}
142
135
  margin="none"
143
136
  placeholder={
144
137
  filterChipLabel || isSelectFilter ? undefined : filterPlaceholder
@@ -1,7 +1,14 @@
1
- import React, { ChangeEvent, FC, useState } from 'react';
2
- import { Collapse, IconButton, InputAdornment, TextField } from '@mui/material';
1
+ import React, { ChangeEvent, FC, MouseEvent, useState } from 'react';
2
+ import {
3
+ Collapse,
4
+ IconButton,
5
+ InputAdornment,
6
+ TextField,
7
+ Tooltip,
8
+ } from '@mui/material';
3
9
  import { useMRT } from '../useMRT';
4
10
  import { useAsyncDebounce } from 'react-table';
11
+ import { MRT_FilterTypeMenu } from '../menus/MRT_FilterTypeMenu';
5
12
 
6
13
  interface Props {}
7
14
 
@@ -15,6 +22,7 @@ export const MRT_SearchTextField: FC<Props> = () => {
15
22
  tableInstance,
16
23
  } = useMRT();
17
24
 
25
+ const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
18
26
  const [searchValue, setSearchValue] = useState('');
19
27
 
20
28
  const handleChange = useAsyncDebounce(
@@ -25,6 +33,10 @@ export const MRT_SearchTextField: FC<Props> = () => {
25
33
  200,
26
34
  );
27
35
 
36
+ const handleGlobalFilterMenuOpen = (event: MouseEvent<HTMLElement>) => {
37
+ setAnchorEl(event.currentTarget);
38
+ };
39
+
28
40
  const handleClear = () => {
29
41
  setSearchValue('');
30
42
  tableInstance.setGlobalFilter(undefined);
@@ -44,7 +56,18 @@ export const MRT_SearchTextField: FC<Props> = () => {
44
56
  InputProps={{
45
57
  startAdornment: (
46
58
  <InputAdornment position="start">
47
- <SearchIcon fontSize="small" />
59
+ <Tooltip arrow title={localization.changeSearchMode}>
60
+ <span>
61
+ <IconButton
62
+ aria-label={localization.changeSearchMode}
63
+ onClick={handleGlobalFilterMenuOpen}
64
+ size="small"
65
+ sx={{ height: '1.75rem', width: '1.75rem' }}
66
+ >
67
+ <SearchIcon fontSize="small" />
68
+ </IconButton>
69
+ </span>
70
+ </Tooltip>
48
71
  </InputAdornment>
49
72
  ),
50
73
  endAdornment: (
@@ -64,6 +87,7 @@ export const MRT_SearchTextField: FC<Props> = () => {
64
87
  {...muiSearchTextFieldProps}
65
88
  sx={{ justifySelf: 'end', ...muiSearchTextFieldProps?.sx }}
66
89
  />
90
+ <MRT_FilterTypeMenu anchorEl={anchorEl} setAnchorEl={setAnchorEl} />
67
91
  </Collapse>
68
92
  );
69
93
  };
@@ -2,6 +2,7 @@ export interface MRT_Localization {
2
2
  actions: string;
3
3
  cancel: string;
4
4
  changeFilterMode: string;
5
+ changeSearchMode: string;
5
6
  clearFilter: string;
6
7
  clearSearch: string;
7
8
  clearSort: string;
@@ -11,12 +12,13 @@ export interface MRT_Localization {
11
12
  edit: string;
12
13
  expand: string;
13
14
  expandAll: string;
15
+ filterBestMatchFirst: string;
14
16
  filterByColumn: string;
15
17
  filterContains: string;
16
18
  filterEmpty: string;
17
19
  filterEndsWith: string;
18
20
  filterEquals: string;
19
- filterFuzzy: string;
21
+ filterBestMatch: string;
20
22
  filterGreaterThan: string;
21
23
  filterLessThan: string;
22
24
  filterMode: string;
@@ -51,6 +53,7 @@ export const MRT_DefaultLocalization_EN: MRT_Localization = {
51
53
  actions: 'Actions',
52
54
  cancel: 'Cancel',
53
55
  changeFilterMode: 'Change filter mode',
56
+ changeSearchMode: 'Change search mode',
54
57
  clearFilter: 'Clear filter',
55
58
  clearSearch: 'Clear search',
56
59
  clearSort: 'Clear sort',
@@ -60,12 +63,13 @@ export const MRT_DefaultLocalization_EN: MRT_Localization = {
60
63
  edit: 'Edit',
61
64
  expand: 'Expand',
62
65
  expandAll: 'Expand all',
66
+ filterBestMatch: 'Best Match',
67
+ filterBestMatchFirst: 'Best Match First',
63
68
  filterByColumn: 'Filter by {column}',
64
- filterContains: 'Contains Exact',
69
+ filterContains: 'Contains',
65
70
  filterEmpty: 'Empty',
66
71
  filterEndsWith: 'Ends With',
67
72
  filterEquals: 'Equals',
68
- filterFuzzy: 'Fuzzy Match',
69
73
  filterGreaterThan: 'Greater Than',
70
74
  filterLessThan: 'Less Than',
71
75
  filterMode: 'Filter Mode: {filterType}',