material-react-table 0.5.8 → 0.6.1

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 (67) hide show
  1. package/dist/MaterialReactTable.d.ts +1 -10
  2. package/dist/body/MRT_TableBodyCell.d.ts +1 -1
  3. package/dist/body/MRT_TableBodyRow.d.ts +1 -1
  4. package/dist/body/MRT_TableDetailPanel.d.ts +1 -1
  5. package/dist/buttons/MRT_EditActionButtons.d.ts +1 -1
  6. package/dist/buttons/MRT_ExpandButton.d.ts +1 -1
  7. package/dist/buttons/MRT_ToggleColumnActionMenuButton.d.ts +1 -1
  8. package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +1 -1
  9. package/dist/enums.d.ts +12 -0
  10. package/dist/filtersFNs.d.ts +20 -0
  11. package/dist/footer/MRT_TableFooterCell.d.ts +1 -1
  12. package/dist/footer/MRT_TableFooterRow.d.ts +1 -1
  13. package/dist/head/MRT_TableHeadCell.d.ts +1 -1
  14. package/dist/head/MRT_TableHeadRow.d.ts +1 -1
  15. package/dist/inputs/MRT_EditCellTextField.d.ts +1 -1
  16. package/dist/inputs/MRT_FilterTextField.d.ts +1 -1
  17. package/dist/inputs/MRT_SelectCheckbox.d.ts +1 -1
  18. package/dist/localization.d.ts +43 -44
  19. package/dist/material-react-table.cjs.development.js +375 -227
  20. package/dist/material-react-table.cjs.development.js.map +1 -1
  21. package/dist/material-react-table.cjs.production.min.js +1 -1
  22. package/dist/material-react-table.cjs.production.min.js.map +1 -1
  23. package/dist/material-react-table.esm.js +367 -221
  24. package/dist/material-react-table.esm.js.map +1 -1
  25. package/dist/menus/MRT_ColumnActionMenu.d.ts +1 -1
  26. package/dist/menus/MRT_FilterTypeMenu.d.ts +1 -1
  27. package/dist/menus/MRT_RowActionMenu.d.ts +1 -1
  28. package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +3 -2
  29. package/dist/menus/MRT_ShowHideColumnsMenuItems.d.ts +8 -0
  30. package/dist/useMRT.d.ts +1 -1
  31. package/package.json +3 -3
  32. package/src/MaterialReactTable.tsx +1 -11
  33. package/src/body/MRT_TableBody.tsx +1 -1
  34. package/src/body/MRT_TableBodyCell.tsx +1 -1
  35. package/src/body/MRT_TableBodyRow.tsx +1 -1
  36. package/src/body/MRT_TableDetailPanel.tsx +1 -1
  37. package/src/buttons/MRT_EditActionButtons.tsx +5 -8
  38. package/src/buttons/MRT_ExpandAllButton.tsx +2 -2
  39. package/src/buttons/MRT_ExpandButton.tsx +3 -3
  40. package/src/buttons/MRT_FullScreenToggleButton.tsx +2 -2
  41. package/src/buttons/MRT_ShowHideColumnsButton.tsx +4 -52
  42. package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +4 -3
  43. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -2
  44. package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -2
  45. package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +4 -8
  46. package/src/buttons/MRT_ToggleSearchButton.tsx +1 -1
  47. package/src/enums.ts +12 -0
  48. package/src/filtersFNs.ts +31 -0
  49. package/src/footer/MRT_TableFooter.tsx +1 -1
  50. package/src/footer/MRT_TableFooterCell.tsx +1 -1
  51. package/src/footer/MRT_TableFooterRow.tsx +1 -1
  52. package/src/head/MRT_TableHead.tsx +1 -1
  53. package/src/head/MRT_TableHeadCell.tsx +20 -7
  54. package/src/head/MRT_TableHeadCellActions.tsx +1 -1
  55. package/src/head/MRT_TableHeadRow.tsx +1 -1
  56. package/src/inputs/MRT_EditCellTextField.tsx +1 -1
  57. package/src/inputs/MRT_FilterTextField.tsx +35 -11
  58. package/src/inputs/MRT_SearchTextField.tsx +3 -3
  59. package/src/inputs/MRT_SelectCheckbox.tsx +5 -5
  60. package/src/localization.ts +87 -88
  61. package/src/menus/MRT_ColumnActionMenu.tsx +60 -15
  62. package/src/menus/MRT_FilterTypeMenu.tsx +45 -11
  63. package/src/menus/MRT_RowActionMenu.tsx +2 -2
  64. package/src/menus/MRT_ShowHideColumnsMenu.tsx +53 -36
  65. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +57 -0
  66. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +3 -3
  67. package/src/useMRT.tsx +22 -4
@@ -10,8 +10,9 @@ import {
10
10
  } from '@mui/material';
11
11
  import { useAsyncDebounce } from 'react-table';
12
12
  import { useMRT } from '../useMRT';
13
- import { MRT_FILTER_TYPE, MRT_HeaderGroup } from '..';
13
+ import type { MRT_HeaderGroup } from '..';
14
14
  import { MRT_FilterTypeMenu } from '../menus/MRT_FilterTypeMenu';
15
+ import { MRT_FILTER_TYPE } from '../enums';
15
16
 
16
17
  interface Props {
17
18
  column: MRT_HeaderGroup;
@@ -77,14 +78,18 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
77
78
  }
78
79
 
79
80
  const filterType = tableInstance.state.currentFilterTypes[column.id];
80
- const isCustomFilterType = filterType instanceof Function;
81
81
  const isSelectFilter = !!column.filterSelectOptions;
82
82
  const filterChipLabel =
83
- !isCustomFilterType &&
83
+ !(filterType instanceof Function) &&
84
84
  [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(
85
85
  filterType as MRT_FILTER_TYPE,
86
- );
87
- const filterPlaceholder = localization.filterTextFieldPlaceholder?.replace(
86
+ )
87
+ ? //@ts-ignore
88
+ localization[
89
+ `filter${filterType.charAt(0).toUpperCase() + filterType.slice(1)}`
90
+ ]
91
+ : '';
92
+ const filterPlaceholder = localization.filterByColumn?.replace(
88
93
  '{column}',
89
94
  String(column.Header),
90
95
  );
@@ -102,6 +107,22 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
102
107
  },
103
108
  title: filterPlaceholder,
104
109
  }}
110
+ helperText={
111
+ filterType instanceof Function
112
+ ? ''
113
+ : localization.filterMode.replace(
114
+ '{filterType}',
115
+ // @ts-ignore
116
+ localization[
117
+ `filter${
118
+ filterType.charAt(0).toUpperCase() + filterType.slice(1)
119
+ }`
120
+ ],
121
+ )
122
+ }
123
+ FormHelperTextProps={{
124
+ sx: { fontSize: '0.6rem', lineHeight: '0.8rem' },
125
+ }}
105
126
  label={isSelectFilter && !filterValue ? filterPlaceholder : undefined}
106
127
  InputLabelProps={{
107
128
  shrink: false,
@@ -128,7 +149,6 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
128
149
  <Tooltip arrow title={localization.changeFilterMode}>
129
150
  <span>
130
151
  <IconButton
131
- disabled={isCustomFilterType}
132
152
  onClick={handleFilterMenuOpen}
133
153
  size="small"
134
154
  sx={{ height: '1.75rem', width: '1.75rem' }}
@@ -138,7 +158,10 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
138
158
  </span>
139
159
  </Tooltip>
140
160
  {filterChipLabel && (
141
- <Chip onDelete={handleClearFilterChip} label={filterType} />
161
+ <Chip
162
+ onDelete={handleClearFilterChip}
163
+ label={filterChipLabel}
164
+ />
142
165
  )}
143
166
  </InputAdornment>
144
167
  ),
@@ -148,11 +171,11 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
148
171
  arrow
149
172
  disableHoverListener={isSelectFilter}
150
173
  placement="right"
151
- title={localization.filterTextFieldClearButtonTitle ?? ''}
174
+ title={localization.clearFilter ?? ''}
152
175
  >
153
176
  <span>
154
177
  <IconButton
155
- aria-label={localization.filterTextFieldClearButtonTitle}
178
+ aria-label={localization.clearFilter}
156
179
  disabled={!filterValue?.length}
157
180
  onClick={handleClear}
158
181
  size="small"
@@ -170,7 +193,8 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
170
193
  }}
171
194
  {...textFieldProps}
172
195
  sx={{
173
- m: '0 -0.25rem',
196
+ m: '-0.25rem',
197
+ p: 0,
174
198
  minWidth: !filterChipLabel ? '5rem' : 'auto',
175
199
  width: 'calc(100% + 0.5rem)',
176
200
  mt: isSelectFilter && !filterValue ? '-1rem' : undefined,
@@ -182,7 +206,7 @@ export const MRT_FilterTextField: FC<Props> = ({ column }) => {
182
206
  >
183
207
  {isSelectFilter && (
184
208
  <MenuItem divider disabled={!filterValue} value="">
185
- {localization.filterTextFieldClearButtonTitle}
209
+ {localization.clearFilter}
186
210
  </MenuItem>
187
211
  )}
188
212
  {column?.filterSelectOptions?.map((option) => {
@@ -34,7 +34,7 @@ export const MRT_SearchTextField: FC<Props> = () => {
34
34
  <Collapse in={tableInstance.state.showSearch} orientation="horizontal">
35
35
  <TextField
36
36
  id={`mrt-${idPrefix}-search-text-field`}
37
- placeholder={localization.searchTextFieldPlaceholder}
37
+ placeholder={localization.search}
38
38
  onChange={(event: ChangeEvent<HTMLInputElement>) => {
39
39
  setSearchValue(event.target.value);
40
40
  handleChange(event);
@@ -50,11 +50,11 @@ export const MRT_SearchTextField: FC<Props> = () => {
50
50
  endAdornment: (
51
51
  <InputAdornment position="end">
52
52
  <IconButton
53
- aria-label={localization.searchTextFieldClearButtonTitle}
53
+ aria-label={localization.clearSearch}
54
54
  disabled={searchValue?.length === 0}
55
55
  onClick={handleClear}
56
56
  size="small"
57
- title={localization.searchTextFieldClearButtonTitle}
57
+ title={localization.clearSearch}
58
58
  >
59
59
  <CloseIcon fontSize="small" />
60
60
  </IconButton>
@@ -1,7 +1,7 @@
1
1
  import React, { ChangeEvent, FC } from 'react';
2
2
  import { Checkbox, TableCell, Tooltip } from '@mui/material';
3
3
  import { useMRT } from '../useMRT';
4
- import { MRT_Row } from '..';
4
+ import type { MRT_Row } from '..';
5
5
  import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
6
6
 
7
7
  interface Props {
@@ -37,15 +37,15 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll }) => {
37
37
  enterNextDelay={1000}
38
38
  title={
39
39
  selectAll
40
- ? localization.selectAllCheckboxTitle
41
- : localization.selectCheckboxTitle
40
+ ? localization.toggleSelectAll
41
+ : localization.toggleSelectRow
42
42
  }
43
43
  >
44
44
  <Checkbox
45
45
  inputProps={{
46
46
  'aria-label': selectAll
47
- ? localization.selectAllCheckboxTitle
48
- : localization.selectCheckboxTitle,
47
+ ? localization.toggleSelectAll
48
+ : localization.toggleSelectRow,
49
49
  }}
50
50
  onChange={onSelectChange}
51
51
  {...checkboxProps}
@@ -1,95 +1,94 @@
1
1
  export interface MRT_Localization {
2
- actionsHeadColumnTitle: string;
3
- columnActionMenuButtonTitle: string;
4
- columnActionMenuItemClearSort: string;
5
- columnActionMenuItemGroupBy: string;
6
- columnActionMenuItemHideColumn: string;
7
- columnActionMenuItemSortAsc: string;
8
- columnActionMenuItemSortDesc: string;
9
- columnActionMenuItemUnGroupBy: string;
10
- columnShowHideMenuHideAll: string;
11
- columnShowHideMenuShowAll: string;
12
- expandAllButtonTitle: string;
13
- expandButtonTitle: string;
14
- filterApplied: string;
15
- filterMenuItemContains: string;
16
- filterMenuItemEmpty: string;
17
- filterMenuItemEndsWith: string;
18
- filterMenuItemEquals: string;
19
- filterMenuItemFuzzy: string;
20
- filterMenuItemNotEmpty: string;
21
- filterMenuItemNotEquals: string;
22
- filterMenuItemStartsWith: string;
23
- filterMenuTitle: string;
24
- filterTextFieldChangeFilterButtonTitle: string;
25
- filterTextFieldChipLabelEmpty: string;
26
- filterTextFieldChipLabelNotEmpty: string;
27
- filterTextFieldClearButtonTitle: string;
28
- filterTextFieldPlaceholder: string;
2
+ actions: string;
3
+ cancel: string;
29
4
  changeFilterMode: string;
30
- rowActionButtonCancel: string;
31
- rowActionButtonSave: string;
32
- rowActionMenuButtonTitle: string;
33
- rowActionMenuItemEdit: string;
34
- rowActionsColumnTitle: string;
35
- searchTextFieldClearButtonTitle: string;
36
- searchTextFieldPlaceholder: string;
37
- selectAllCheckboxTitle: string;
38
- selectCheckboxTitle: string;
39
- showHideColumnsButtonTitle: string;
40
- toggleDensePaddingSwitchTitle: string;
41
- toggleFilterButtonTitle: string;
42
- toggleFullScreenButtonTitle: string;
43
- toggleSearchButtonTitle: string;
44
- toolbarAlertGroupedByMessage: string;
45
- toolbarAlertGroupedThenByMessage: string;
46
- toolbarAlertSelectionMessage: string;
5
+ clearFilter: string;
6
+ clearSearch: string;
7
+ clearSort: string;
8
+ columnActions: string;
9
+ edit: string;
10
+ expand: string;
11
+ expandAll: string;
12
+ filterByColumn: string;
13
+ filterContains: string;
14
+ filterEmpty: string;
15
+ filterEndsWith: string;
16
+ filterEquals: string;
17
+ filterFuzzy: string;
18
+ filterGreaterThan: string;
19
+ filterLessThan: string;
20
+ filterMode: string;
21
+ filterNotEmpty: string;
22
+ filterNotEquals: string;
23
+ filterStartsWith: string;
24
+ filteringByColumn: string;
25
+ groupByColumn: string;
26
+ groupedBy: string;
27
+ hideAll: string;
28
+ hideColumn: string;
29
+ rowActions: string;
30
+ save: string;
31
+ search: string;
32
+ selectedCountOfRowCountRowsSelected: string;
33
+ showAll: string;
34
+ showHideColumns: string;
35
+ showAllColumns: string;
36
+ showHideFilters: string;
37
+ showHideSearch: string;
38
+ sortByColumnAsc: string;
39
+ sortByColumnDesc: string;
40
+ thenBy: string;
41
+ toggleDensePadding: string;
42
+ toggleFullScreen: string;
43
+ toggleSelectAll: string;
44
+ toggleSelectRow: string;
45
+ ungroupByColumn: string;
47
46
  }
48
47
 
49
48
  export const MRT_DefaultLocalization_EN: MRT_Localization = {
50
- actionsHeadColumnTitle: 'Actions',
51
- columnActionMenuButtonTitle: 'Column Actions',
52
- columnActionMenuItemClearSort: 'Clear sort',
53
- columnActionMenuItemGroupBy: 'Group by {column}',
54
- columnActionMenuItemHideColumn: 'Hide {column} column',
55
- columnActionMenuItemSortAsc: 'Sort by {column} ascending',
56
- columnActionMenuItemSortDesc: 'Sort by {column} descending',
57
- columnActionMenuItemUnGroupBy: 'Ungroup by {column}',
58
- columnShowHideMenuHideAll: 'Hide all',
59
- columnShowHideMenuShowAll: 'Show all',
60
- expandAllButtonTitle: 'Expand all',
61
- expandButtonTitle: 'Expand',
62
- filterApplied: 'Filtering by {column} - ({filterType})',
63
- filterMenuItemContains: 'Contains Exact',
64
- filterMenuItemEmpty: 'Empty',
65
- filterMenuItemEndsWith: 'Ends With',
66
- filterMenuItemEquals: 'Equals',
49
+ actions: 'Actions',
50
+ cancel: 'Cancel',
67
51
  changeFilterMode: 'Change filter mode',
68
- filterMenuItemFuzzy: 'Fuzzy Match (Default)',
69
- filterMenuItemNotEmpty: 'Not Empty',
70
- filterMenuItemNotEquals: 'Not Equals',
71
- filterMenuItemStartsWith: 'Starts With',
72
- filterMenuTitle: 'Filter Mode',
73
- filterTextFieldChangeFilterButtonTitle: 'Change Filter Mode',
74
- filterTextFieldChipLabelEmpty: 'Empty',
75
- filterTextFieldChipLabelNotEmpty: 'Not Empty',
76
- filterTextFieldClearButtonTitle: 'Clear filter',
77
- filterTextFieldPlaceholder: 'Filter by {column}',
78
- rowActionButtonCancel: 'Cancel',
79
- rowActionButtonSave: 'Save',
80
- rowActionMenuButtonTitle: 'Row Actions',
81
- rowActionMenuItemEdit: 'Edit',
82
- rowActionsColumnTitle: 'Actions',
83
- searchTextFieldClearButtonTitle: 'Clear search',
84
- searchTextFieldPlaceholder: 'Search',
85
- selectAllCheckboxTitle: 'Toggle select all',
86
- selectCheckboxTitle: 'Toggle select row',
87
- showHideColumnsButtonTitle: 'Show/Hide columns',
88
- toggleDensePaddingSwitchTitle: 'Toggle dense padding',
89
- toggleFilterButtonTitle: 'Show/Hide filters',
90
- toggleFullScreenButtonTitle: 'Toggle full screen',
91
- toggleSearchButtonTitle: 'Show/Hide search',
92
- toolbarAlertGroupedByMessage: 'Grouped by ',
93
- toolbarAlertGroupedThenByMessage: ', then by ',
94
- toolbarAlertSelectionMessage: '{selectedCount} of {rowCount} row(s) selected',
52
+ clearFilter: 'Clear filter',
53
+ clearSearch: 'Clear search',
54
+ clearSort: 'Clear sort',
55
+ columnActions: 'Column Actions',
56
+ edit: 'Edit',
57
+ expand: 'Expand',
58
+ expandAll: 'Expand all',
59
+ filterByColumn: 'Filter by {column}',
60
+ filterContains: 'Contains Exact',
61
+ filterEmpty: 'Empty',
62
+ filterEndsWith: 'Ends With',
63
+ filterEquals: 'Equals',
64
+ filterFuzzy: 'Fuzzy Match',
65
+ filterGreaterThan: 'Greater Than',
66
+ filterLessThan: 'Less Than',
67
+ filterMode: 'Filter Mode: {filterType}',
68
+ filterNotEmpty: 'Not Empty',
69
+ filterNotEquals: 'Not Equals',
70
+ filterStartsWith: 'Starts With',
71
+ filteringByColumn: 'Filtering by {column} - {filterType} "{filterValue}"',
72
+ groupByColumn: 'Group by {column}',
73
+ groupedBy: 'Grouped by ',
74
+ hideAll: 'Hide all',
75
+ hideColumn: 'Hide {column} column',
76
+ rowActions: 'Row Actions',
77
+ save: 'Save',
78
+ search: 'Search',
79
+ selectedCountOfRowCountRowsSelected:
80
+ '{selectedCount} of {rowCount} row(s) selected',
81
+ showAll: 'Show all',
82
+ showAllColumns: 'Show all columns',
83
+ showHideColumns: 'Show/Hide columns',
84
+ showHideFilters: 'Show/Hide filters',
85
+ showHideSearch: 'Show/Hide search',
86
+ sortByColumnAsc: 'Sort by {column} ascending',
87
+ sortByColumnDesc: 'Sort by {column} descending',
88
+ thenBy: ', then by ',
89
+ toggleDensePadding: 'Toggle dense padding',
90
+ toggleFullScreen: 'Toggle full screen',
91
+ toggleSelectAll: 'Toggle select all',
92
+ toggleSelectRow: 'Toggle select row',
93
+ ungroupByColumn: 'Ungroup by {column}',
95
94
  };
@@ -1,8 +1,9 @@
1
1
  import React, { FC, useState } from 'react';
2
2
  import { Box, IconButton, Menu, MenuItem } from '@mui/material';
3
3
  import { useMRT } from '../useMRT';
4
- import { MRT_HeaderGroup } from '..';
4
+ import type { MRT_HeaderGroup } from '..';
5
5
  import { MRT_FilterTypeMenu } from './MRT_FilterTypeMenu';
6
+ import { MRT_ShowHideColumnsMenu } from './MRT_ShowHideColumnsMenu';
6
7
 
7
8
  export const commonMenuItemStyles = {
8
9
  py: '6px',
@@ -36,6 +37,7 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
36
37
  icons: {
37
38
  ArrowRightIcon,
38
39
  ClearAllIcon,
40
+ ViewColumnIcon,
39
41
  DynamicFeedIcon,
40
42
  FilterListIcon,
41
43
  FilterListOffIcon,
@@ -51,6 +53,9 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
51
53
  const [filterMenuAnchorEl, setFilterMenuAnchorEl] =
52
54
  useState<null | HTMLElement>(null);
53
55
 
56
+ const [showHideColumnsMenuAnchorEl, setShowHideColumnsMenuAnchorEl] =
57
+ useState<null | HTMLElement>(null);
58
+
54
59
  const handleClearSort = () => {
55
60
  column.clearSortBy();
56
61
  setAnchorEl(null);
@@ -102,6 +107,17 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
102
107
  setFilterMenuAnchorEl(event.currentTarget);
103
108
  };
104
109
 
110
+ const handleShowAllColumns = () => {
111
+ tableInstance.toggleHideAllColumns(false);
112
+ };
113
+
114
+ const handleOpenShowHideColumnsMenu = (
115
+ event: React.MouseEvent<HTMLElement>,
116
+ ) => {
117
+ event.stopPropagation();
118
+ setShowHideColumnsMenuAnchorEl(event.currentTarget);
119
+ };
120
+
105
121
  return (
106
122
  <Menu
107
123
  anchorEl={anchorEl}
@@ -115,24 +131,24 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
115
131
  column.canSort && [
116
132
  <MenuItem
117
133
  disabled={!column.isSorted}
118
- key={1}
134
+ key={0}
119
135
  onClick={handleClearSort}
120
136
  sx={commonMenuItemStyles}
121
137
  >
122
138
  <Box sx={commonListItemStyles}>
123
139
  <ClearAllIcon />
124
- {localization.columnActionMenuItemClearSort}
140
+ {localization.clearSort}
125
141
  </Box>
126
142
  </MenuItem>,
127
143
  <MenuItem
128
144
  disabled={column.isSorted && !column.isSortedDesc}
129
- key={2}
145
+ key={1}
130
146
  onClick={handleSortAsc}
131
147
  sx={commonMenuItemStyles}
132
148
  >
133
149
  <Box sx={commonListItemStyles}>
134
150
  <SortIcon />
135
- {localization.columnActionMenuItemSortAsc?.replace(
151
+ {localization.sortByColumnAsc?.replace(
136
152
  '{column}',
137
153
  String(column.Header),
138
154
  )}
@@ -142,14 +158,14 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
142
158
  divider={
143
159
  !disableFilters || enableColumnGrouping || !disableColumnHiding
144
160
  }
145
- key={3}
161
+ key={2}
146
162
  disabled={column.isSorted && column.isSortedDesc}
147
163
  onClick={handleSortDesc}
148
164
  sx={commonMenuItemStyles}
149
165
  >
150
166
  <Box sx={commonListItemStyles}>
151
167
  <SortIcon style={{ transform: 'rotate(180deg) scaleX(-1)' }} />
152
- {localization.columnActionMenuItemSortDesc?.replace(
168
+ {localization.sortByColumnDesc?.replace(
153
169
  '{column}',
154
170
  String(column.Header),
155
171
  )}
@@ -166,7 +182,7 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
166
182
  >
167
183
  <Box sx={commonListItemStyles}>
168
184
  <FilterListOffIcon />
169
- {localization.filterTextFieldClearButtonTitle}
185
+ {localization.clearFilter}
170
186
  </Box>
171
187
  </MenuItem>,
172
188
  <MenuItem
@@ -177,7 +193,7 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
177
193
  >
178
194
  <Box sx={commonListItemStyles}>
179
195
  <FilterListIcon />
180
- {localization.filterTextFieldPlaceholder?.replace(
196
+ {localization.filterByColumn?.replace(
181
197
  '{column}',
182
198
  String(column.Header),
183
199
  )}
@@ -205,30 +221,59 @@ export const MRT_ColumnActionMenu: FC<Props> = ({
205
221
  column.canGroupBy && [
206
222
  <MenuItem
207
223
  divider={!disableColumnHiding}
208
- key={2}
224
+ key={0}
209
225
  onClick={handleGroupByColumn}
210
226
  sx={commonMenuItemStyles}
211
227
  >
212
228
  <Box sx={commonListItemStyles}>
213
229
  <DynamicFeedIcon />
214
230
  {localization[
215
- column.isGrouped
216
- ? 'columnActionMenuItemUnGroupBy'
217
- : 'columnActionMenuItemGroupBy'
231
+ column.isGrouped ? 'ungroupByColumn' : 'groupByColumn'
218
232
  ]?.replace('{column}', String(column.Header))}
219
233
  </Box>
220
234
  </MenuItem>,
221
235
  ]}
222
236
  {!disableColumnHiding && [
223
- <MenuItem key={1} onClick={handleHideColumn} sx={commonMenuItemStyles}>
237
+ <MenuItem key={0} onClick={handleHideColumn} sx={commonMenuItemStyles}>
224
238
  <Box sx={commonListItemStyles}>
225
239
  <VisibilityOffIcon />
226
- {localization.columnActionMenuItemHideColumn?.replace(
240
+ {localization.hideColumn?.replace(
241
+ '{column}',
242
+ String(column.Header),
243
+ )}
244
+ </Box>
245
+ </MenuItem>,
246
+ <MenuItem
247
+ disabled={!tableInstance.state.hiddenColumns?.length}
248
+ key={1}
249
+ onClick={handleShowAllColumns}
250
+ sx={commonMenuItemStyles}
251
+ >
252
+ <Box sx={commonListItemStyles}>
253
+ <ViewColumnIcon />
254
+
255
+ {localization.showAllColumns?.replace(
227
256
  '{column}',
228
257
  String(column.Header),
229
258
  )}
230
259
  </Box>
260
+ {!column.filterSelectOptions && (
261
+ <IconButton
262
+ onClick={handleOpenShowHideColumnsMenu}
263
+ onMouseEnter={handleOpenShowHideColumnsMenu}
264
+ size="small"
265
+ sx={{ p: 0 }}
266
+ >
267
+ <ArrowRightIcon />
268
+ </IconButton>
269
+ )}
231
270
  </MenuItem>,
271
+ <MRT_ShowHideColumnsMenu
272
+ anchorEl={showHideColumnsMenuAnchorEl}
273
+ isSubMenu
274
+ key={2}
275
+ setAnchorEl={setShowHideColumnsMenuAnchorEl}
276
+ />,
232
277
  ]}
233
278
  </Menu>
234
279
  );
@@ -1,7 +1,20 @@
1
1
  import React, { FC, useMemo } from 'react';
2
2
  import { Menu, MenuItem } from '@mui/material';
3
3
  import { useMRT } from '../useMRT';
4
- import { MRT_FilterType, MRT_FILTER_TYPE, MRT_HeaderGroup } from '..';
4
+ import type { MRT_FilterType, MRT_HeaderGroup } from '..';
5
+ import { MRT_FILTER_TYPE } from '../enums';
6
+ import {
7
+ containsFilterFN,
8
+ emptyFilterFN,
9
+ endsWithFilterFN,
10
+ equalsFilterFN,
11
+ fuzzyFilterFN,
12
+ greaterThanFilterFN,
13
+ lessThanFilterFN,
14
+ notEmptyFilterFN,
15
+ notEqualsFilterFN,
16
+ startsWithFilterFN,
17
+ } from '../filtersFNs';
5
18
 
6
19
  const commonMenuItemStyles = {
7
20
  py: '6px',
@@ -28,47 +41,68 @@ export const MRT_FilterTypeMenu: FC<Props> = ({
28
41
  type: MRT_FILTER_TYPE;
29
42
  label: string;
30
43
  divider: boolean;
44
+ fn: Function;
31
45
  }[] = useMemo(
32
46
  () => [
33
47
  {
34
48
  type: MRT_FILTER_TYPE.FUZZY,
35
- label: localization.filterMenuItemFuzzy,
49
+ label: localization.filterFuzzy,
36
50
  divider: false,
51
+ fn: fuzzyFilterFN,
37
52
  },
38
53
  {
39
54
  type: MRT_FILTER_TYPE.CONTAINS,
40
- label: localization.filterMenuItemContains,
55
+ label: localization.filterContains,
41
56
  divider: true,
57
+ fn: containsFilterFN,
42
58
  },
43
59
  {
44
60
  type: MRT_FILTER_TYPE.STARTS_WITH,
45
- label: localization.filterMenuItemStartsWith,
61
+ label: localization.filterStartsWith,
46
62
  divider: false,
63
+ fn: startsWithFilterFN,
47
64
  },
48
65
  {
49
66
  type: MRT_FILTER_TYPE.ENDS_WITH,
50
- label: localization.filterMenuItemEndsWith,
67
+ label: localization.filterEndsWith,
51
68
  divider: true,
69
+ fn: endsWithFilterFN,
52
70
  },
53
71
  {
54
72
  type: MRT_FILTER_TYPE.EQUALS,
55
- label: localization.filterMenuItemEquals,
73
+ label: localization.filterEquals,
56
74
  divider: false,
75
+ fn: equalsFilterFN,
57
76
  },
58
77
  {
59
78
  type: MRT_FILTER_TYPE.NOT_EQUALS,
60
- label: localization.filterMenuItemNotEquals,
79
+ label: localization.filterNotEquals,
61
80
  divider: true,
81
+ fn: notEqualsFilterFN,
82
+ },
83
+ {
84
+ type: MRT_FILTER_TYPE.GREATER_THAN,
85
+ label: localization.filterGreaterThan,
86
+ divider: false,
87
+ fn: greaterThanFilterFN,
88
+ },
89
+ {
90
+ type: MRT_FILTER_TYPE.LESS_THAN,
91
+ label: localization.filterLessThan,
92
+ divider: true,
93
+ fn: lessThanFilterFN,
62
94
  },
63
95
  {
64
96
  type: MRT_FILTER_TYPE.EMPTY,
65
- label: localization.filterMenuItemEmpty,
97
+ label: localization.filterEmpty,
66
98
  divider: false,
99
+ fn: emptyFilterFN,
67
100
  },
68
101
  {
69
102
  type: MRT_FILTER_TYPE.NOT_EMPTY,
70
- label: localization.filterMenuItemNotEmpty,
103
+ label: localization.filterNotEmpty,
71
104
  divider: false,
105
+ fn: notEmptyFilterFN,
72
106
  },
73
107
  ],
74
108
  [],
@@ -98,12 +132,12 @@ export const MRT_FilterTypeMenu: FC<Props> = ({
98
132
  dense: tableInstance.state.densePadding,
99
133
  }}
100
134
  >
101
- {filterTypes.map(({ type, label, divider }, index) => (
135
+ {filterTypes.map(({ type, label, divider, fn }, index) => (
102
136
  <MenuItem
103
137
  divider={divider}
104
138
  key={index}
105
139
  onClick={() => handleSelectFilterType(type)}
106
- selected={type === filterType}
140
+ selected={type === filterType || fn === filterType}
107
141
  sx={commonMenuItemStyles}
108
142
  value={type}
109
143
  >
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from 'react';
2
2
  import { Menu, MenuItem } from '@mui/material';
3
3
  import { useMRT } from '../useMRT';
4
- import { MRT_Row } from '..';
4
+ import type { MRT_Row } from '..';
5
5
  import { commonMenuItemStyles } from './MRT_ColumnActionMenu';
6
6
 
7
7
  interface Props {
@@ -37,7 +37,7 @@ export const MRT_RowActionMenu: FC<Props> = ({
37
37
  {enableRowEditing && (
38
38
  <MenuItem onClick={handleEdit} sx={commonMenuItemStyles}>
39
39
  <EditIcon />
40
- {localization.rowActionMenuItemEdit}
40
+ {localization.edit}
41
41
  </MenuItem>
42
42
  )}
43
43
  {renderRowActionMenuItems?.(row, tableInstance, () =>