material-react-table 1.10.0 → 1.11.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.
- package/dist/cjs/index.js +182 -185
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/_locales/fi.d.ts +2 -0
- package/dist/cjs/types/_locales/id.d.ts +2 -0
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +1 -1
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -2
- package/dist/esm/material-react-table.esm.js +179 -182
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/_locales/fi.d.ts +2 -0
- package/dist/esm/types/_locales/id.d.ts +2 -0
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +1 -1
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -2
- package/locales/fi.d.ts +2 -0
- package/locales/fi.esm.d.ts +2 -0
- package/locales/fi.esm.js +94 -0
- package/locales/fi.esm.js.map +1 -0
- package/locales/fi.js +98 -0
- package/locales/fi.js.map +1 -0
- package/locales/id.d.ts +2 -0
- package/locales/id.esm.d.ts +2 -0
- package/locales/id.esm.js +94 -0
- package/locales/id.esm.js.map +1 -0
- package/locales/id.js +98 -0
- package/locales/id.js.map +1 -0
- package/locales/it.esm.js +5 -5
- package/locales/it.esm.js.map +1 -1
- package/locales/it.js +5 -5
- package/locales/it.js.map +1 -1
- package/locales/nl.esm.js +25 -25
- package/locales/nl.esm.js.map +1 -1
- package/locales/nl.js +25 -25
- package/locales/nl.js.map +1 -1
- package/package.json +7 -7
- package/src/_locales/fi.ts +95 -0
- package/src/_locales/id.ts +95 -0
- package/src/_locales/it.ts +5 -5
- package/src/_locales/nl.ts +25 -25
- package/src/body/MRT_TableDetailPanel.tsx +6 -1
- package/src/head/MRT_TableHeadCell.tsx +2 -2
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +1 -1
- package/src/menus/MRT_ColumnActionMenu.tsx +8 -27
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +4 -6
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +3 -8
@@ -5,7 +5,6 @@ import ListItemIcon from '@mui/material/ListItemIcon';
|
|
5
5
|
import Menu from '@mui/material/Menu';
|
6
6
|
import MenuItem from '@mui/material/MenuItem';
|
7
7
|
import { MRT_FilterOptionMenu } from './MRT_FilterOptionMenu';
|
8
|
-
import { MRT_ShowHideColumnsMenu } from './MRT_ShowHideColumnsMenu';
|
9
8
|
import type { MRT_Header, MRT_TableInstance } from '..';
|
10
9
|
|
11
10
|
export const commonMenuItemStyles = {
|
@@ -67,12 +66,11 @@ export const MRT_ColumnActionMenu = ({
|
|
67
66
|
} = table;
|
68
67
|
const { column } = header;
|
69
68
|
const { columnDef } = column;
|
70
|
-
const { columnSizing, columnVisibility, density } =
|
69
|
+
const { columnSizing, columnVisibility, density, showColumnFilters } =
|
70
|
+
getState();
|
71
71
|
|
72
72
|
const [filterMenuAnchorEl, setFilterMenuAnchorEl] =
|
73
73
|
useState<null | HTMLElement>(null);
|
74
|
-
const [showHideColumnsMenuAnchorEl, setShowHideColumnsMenuAnchorEl] =
|
75
|
-
useState<null | HTMLElement>(null);
|
76
74
|
|
77
75
|
const handleClearSort = () => {
|
78
76
|
column.clearSorting();
|
@@ -132,13 +130,6 @@ export const MRT_ColumnActionMenu = ({
|
|
132
130
|
setFilterMenuAnchorEl(event.currentTarget);
|
133
131
|
};
|
134
132
|
|
135
|
-
const handleOpenShowHideColumnsMenu = (
|
136
|
-
event: React.MouseEvent<HTMLElement>,
|
137
|
-
) => {
|
138
|
-
event.stopPropagation();
|
139
|
-
setShowHideColumnsMenuAnchorEl(event.currentTarget);
|
140
|
-
};
|
141
|
-
|
142
133
|
const isSelectFilter = !!columnDef.filterSelectOptions;
|
143
134
|
|
144
135
|
const allowedColumnFilterOptions =
|
@@ -238,9 +229,14 @@ export const MRT_ColumnActionMenu = ({
|
|
238
229
|
</Box>
|
239
230
|
</MenuItem>,
|
240
231
|
<MenuItem
|
232
|
+
disabled={showColumnFilters && !enableColumnFilterModes}
|
241
233
|
divider={enableGrouping || enableHiding}
|
242
234
|
key={1}
|
243
|
-
onClick={
|
235
|
+
onClick={
|
236
|
+
showColumnFilters
|
237
|
+
? handleOpenFilterModeMenu
|
238
|
+
: handleFilterByColumn
|
239
|
+
}
|
244
240
|
sx={commonMenuItemStyles}
|
245
241
|
>
|
246
242
|
<Box sx={commonListItemStyles}>
|
@@ -386,22 +382,7 @@ export const MRT_ColumnActionMenu = ({
|
|
386
382
|
String(columnDef.header),
|
387
383
|
)}
|
388
384
|
</Box>
|
389
|
-
<IconButton
|
390
|
-
onClick={handleOpenShowHideColumnsMenu}
|
391
|
-
onMouseEnter={handleOpenShowHideColumnsMenu}
|
392
|
-
size="small"
|
393
|
-
sx={{ p: 0 }}
|
394
|
-
>
|
395
|
-
<ArrowRightIcon />
|
396
|
-
</IconButton>
|
397
385
|
</MenuItem>,
|
398
|
-
<MRT_ShowHideColumnsMenu
|
399
|
-
anchorEl={showHideColumnsMenuAnchorEl}
|
400
|
-
isSubMenu
|
401
|
-
key={2}
|
402
|
-
setAnchorEl={setShowHideColumnsMenuAnchorEl}
|
403
|
-
table={table}
|
404
|
-
/>,
|
405
386
|
]}
|
406
387
|
</Menu>
|
407
388
|
);
|
@@ -18,7 +18,6 @@ export const MRT_ShowHideColumnsMenu = <
|
|
18
18
|
TData extends Record<string, any> = {},
|
19
19
|
>({
|
20
20
|
anchorEl,
|
21
|
-
isSubMenu,
|
22
21
|
setAnchorEl,
|
23
22
|
table,
|
24
23
|
}: Props<TData>) => {
|
@@ -88,12 +87,12 @@ export const MRT_ShowHideColumnsMenu = <
|
|
88
87
|
<Box
|
89
88
|
sx={{
|
90
89
|
display: 'flex',
|
91
|
-
justifyContent:
|
90
|
+
justifyContent: 'space-between',
|
92
91
|
p: '0.5rem',
|
93
92
|
pt: 0,
|
94
93
|
}}
|
95
94
|
>
|
96
|
-
{
|
95
|
+
{enableHiding && (
|
97
96
|
<Button
|
98
97
|
disabled={!getIsSomeColumnsVisible()}
|
99
98
|
onClick={hideAllColumns}
|
@@ -101,7 +100,7 @@ export const MRT_ShowHideColumnsMenu = <
|
|
101
100
|
{localization.hideAll}
|
102
101
|
</Button>
|
103
102
|
)}
|
104
|
-
{
|
103
|
+
{enableColumnOrdering && (
|
105
104
|
<Button
|
106
105
|
onClick={() =>
|
107
106
|
table.setColumnOrder(
|
@@ -112,7 +111,7 @@ export const MRT_ShowHideColumnsMenu = <
|
|
112
111
|
{localization.resetOrder}
|
113
112
|
</Button>
|
114
113
|
)}
|
115
|
-
{
|
114
|
+
{enablePinning && (
|
116
115
|
<Button
|
117
116
|
disabled={!getIsSomeColumnsPinned()}
|
118
117
|
onClick={() => table.resetColumnPinning(true)}
|
@@ -135,7 +134,6 @@ export const MRT_ShowHideColumnsMenu = <
|
|
135
134
|
allColumns={allColumns}
|
136
135
|
column={column}
|
137
136
|
hoveredColumn={hoveredColumn}
|
138
|
-
isSubMenu={isSubMenu}
|
139
137
|
key={`${index}-${column.id}`}
|
140
138
|
setHoveredColumn={setHoveredColumn}
|
141
139
|
table={table}
|
@@ -20,7 +20,6 @@ interface Props<TData extends Record<string, any> = {}> {
|
|
20
20
|
allColumns: MRT_Column<TData>[];
|
21
21
|
column: MRT_Column<TData>;
|
22
22
|
hoveredColumn: MRT_Column<TData> | null;
|
23
|
-
isSubMenu?: boolean;
|
24
23
|
setHoveredColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
|
25
24
|
table: MRT_TableInstance<TData>;
|
26
25
|
}
|
@@ -32,7 +31,6 @@ export const MRT_ShowHideColumnsMenuItems = <
|
|
32
31
|
hoveredColumn,
|
33
32
|
setHoveredColumn,
|
34
33
|
column,
|
35
|
-
isSubMenu,
|
36
34
|
table,
|
37
35
|
}: Props<TData>) => {
|
38
36
|
const {
|
@@ -115,8 +113,7 @@ export const MRT_ShowHideColumnsMenuItems = <
|
|
115
113
|
gap: '8px',
|
116
114
|
}}
|
117
115
|
>
|
118
|
-
{
|
119
|
-
columnDefType !== 'group' &&
|
116
|
+
{columnDefType !== 'group' &&
|
120
117
|
enableColumnOrdering &&
|
121
118
|
!allColumns.some(
|
122
119
|
(col) => col.columnDef.columnDefType === 'group',
|
@@ -130,8 +127,7 @@ export const MRT_ShowHideColumnsMenuItems = <
|
|
130
127
|
) : (
|
131
128
|
<Box sx={{ width: '28px' }} />
|
132
129
|
))}
|
133
|
-
{
|
134
|
-
enablePinning &&
|
130
|
+
{enablePinning &&
|
135
131
|
(column.getCanPin() ? (
|
136
132
|
<MRT_ColumnPinningButtons column={column} table={table} />
|
137
133
|
) : (
|
@@ -158,7 +154,7 @@ export const MRT_ShowHideColumnsMenuItems = <
|
|
158
154
|
<Switch />
|
159
155
|
</Tooltip>
|
160
156
|
}
|
161
|
-
disabled={
|
157
|
+
disabled={!column.getCanHide()}
|
162
158
|
label={columnDef.header}
|
163
159
|
onChange={() => handleToggleColumnHidden(column)}
|
164
160
|
/>
|
@@ -174,7 +170,6 @@ export const MRT_ShowHideColumnsMenuItems = <
|
|
174
170
|
allColumns={allColumns}
|
175
171
|
column={c}
|
176
172
|
hoveredColumn={hoveredColumn}
|
177
|
-
isSubMenu={isSubMenu}
|
178
173
|
key={`${i}-${c.id}`}
|
179
174
|
setHoveredColumn={setHoveredColumn}
|
180
175
|
table={table}
|