material-react-table 1.11.2 → 1.11.4
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 +32 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +3 -4
- package/dist/cjs/types/_locales/hu.d.ts +2 -0
- package/dist/cjs/types/index.d.ts +3 -2
- package/dist/esm/material-react-table.esm.js +32 -25
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +3 -4
- package/dist/esm/types/_locales/hu.d.ts +2 -0
- package/dist/esm/types/index.d.ts +3 -2
- package/dist/index.d.ts +27 -22
- package/locales/hu.d.ts +2 -0
- package/locales/hu.esm.d.ts +2 -0
- package/locales/hu.esm.js +94 -0
- package/locales/hu.esm.js.map +1 -0
- package/locales/hu.js +98 -0
- package/locales/hu.js.map +1 -0
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +4 -4
- package/src/_locales/hu.ts +94 -0
- package/src/body/MRT_TableBody.tsx +5 -1
- package/src/body/MRT_TableBodyRow.tsx +10 -6
- package/src/column.utils.ts +4 -3
- package/src/index.tsx +4 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +19 -15
- package/src/table/MRT_TableRoot.tsx +15 -15
@@ -45,6 +45,7 @@ export const MRT_ColumnActionMenu = ({
|
|
45
45
|
enableHiding,
|
46
46
|
enablePinning,
|
47
47
|
enableSorting,
|
48
|
+
enableSortingRemoval,
|
48
49
|
icons: {
|
49
50
|
ArrowRightIcon,
|
50
51
|
ClearAllIcon,
|
@@ -162,20 +163,23 @@ export const MRT_ColumnActionMenu = ({
|
|
162
163
|
table,
|
163
164
|
}) ??
|
164
165
|
(enableSorting &&
|
165
|
-
column.getCanSort() &&
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
166
|
+
column.getCanSort() &&
|
167
|
+
[
|
168
|
+
enableSortingRemoval !== false && (
|
169
|
+
<MenuItem
|
170
|
+
disabled={!column.getIsSorted()}
|
171
|
+
key={0}
|
172
|
+
onClick={handleClearSort}
|
173
|
+
sx={commonMenuItemStyles}
|
174
|
+
>
|
175
|
+
<Box sx={commonListItemStyles}>
|
176
|
+
<ListItemIcon>
|
177
|
+
<ClearAllIcon />
|
178
|
+
</ListItemIcon>
|
179
|
+
{localization.clearSort}
|
180
|
+
</Box>
|
181
|
+
</MenuItem>
|
182
|
+
),
|
179
183
|
<MenuItem
|
180
184
|
disabled={column.getIsSorted() === 'asc'}
|
181
185
|
key={1}
|
@@ -211,7 +215,7 @@ export const MRT_ColumnActionMenu = ({
|
|
211
215
|
)}
|
212
216
|
</Box>
|
213
217
|
</MenuItem>,
|
214
|
-
])}
|
218
|
+
].filter(Boolean))}
|
215
219
|
{enableColumnFilters &&
|
216
220
|
column.getCanFilter() &&
|
217
221
|
[
|
@@ -39,6 +39,7 @@ import type {
|
|
39
39
|
MRT_DensityState,
|
40
40
|
MRT_ColumnOrderState,
|
41
41
|
MRT_GroupingState,
|
42
|
+
MRT_FilterFnsState,
|
42
43
|
} from '..';
|
43
44
|
|
44
45
|
export const MRT_TableRoot: any = <TData extends Record<string, any> = {}>(
|
@@ -61,22 +62,21 @@ export const MRT_TableRoot: any = <TData extends Record<string, any> = {}>(
|
|
61
62
|
return initState;
|
62
63
|
}, []);
|
63
64
|
|
64
|
-
const [columnFilterFns, setColumnFilterFns] = useState<
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
65
|
+
const [columnFilterFns, setColumnFilterFns] = useState<MRT_FilterFnsState>(
|
66
|
+
() =>
|
67
|
+
Object.assign(
|
68
|
+
{},
|
69
|
+
...getAllLeafColumnDefs(props.columns as MRT_ColumnDef<TData>[]).map(
|
70
|
+
(col) => ({
|
71
|
+
[getColumnId(col)]:
|
72
|
+
col.filterFn instanceof Function
|
73
|
+
? col.filterFn.name ?? 'custom'
|
74
|
+
: col.filterFn ??
|
75
|
+
initialState?.columnFilterFns?.[getColumnId(col)] ??
|
76
|
+
getDefaultColumnFilterFn(col),
|
77
|
+
}),
|
78
|
+
),
|
78
79
|
),
|
79
|
-
),
|
80
80
|
);
|
81
81
|
const [columnOrder, setColumnOrder] = useState<MRT_ColumnOrderState>(
|
82
82
|
initialState.columnOrder ?? [],
|