material-react-table 2.13.1 → 2.13.3
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/index.d.ts +3 -3
- package/dist/index.esm.js +23 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +23 -18
- package/dist/index.js.map +1 -1
- package/locales/no/index.esm.js +1 -1
- package/locales/no/index.js +1 -1
- package/package.json +22 -22
- package/src/components/body/MRT_TableBody.tsx +1 -1
- package/src/components/body/MRT_TableBodyCell.tsx +1 -1
- package/src/components/body/MRT_TableBodyRow.tsx +1 -1
- package/src/components/body/MRT_TableDetailPanel.tsx +1 -1
- package/src/components/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/components/head/MRT_TableHeadCell.tsx +11 -2
- package/src/components/inputs/MRT_EditCellTextField.tsx +4 -1
- package/src/components/inputs/MRT_FilterRangeSlider.tsx +1 -1
- package/src/components/inputs/MRT_FilterTextField.tsx +6 -3
- package/src/components/menus/MRT_FilterOptionMenu.tsx +2 -2
- package/src/components/table/MRT_TableContainer.tsx +2 -2
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +1 -1
- package/src/hooks/useMRT_TableInstance.ts +3 -3
- package/src/locales/no.ts +2 -1
- package/src/types.ts +1 -1
package/locales/no/index.esm.js
CHANGED
@@ -89,7 +89,7 @@ const MRT_Localization_NO = {
|
|
89
89
|
unpin: 'Løsne',
|
90
90
|
unpinAll: 'Løsne alle',
|
91
91
|
ungroupByColumn: 'Oppgrupper etter {column}',
|
92
|
-
selectedCountOfRowCountRowsSelected: '{
|
92
|
+
selectedCountOfRowCountRowsSelected: '{selectedCount} av {rowCount} rader valgt',
|
93
93
|
};
|
94
94
|
|
95
95
|
export { MRT_Localization_NO };
|
package/locales/no/index.js
CHANGED
@@ -93,7 +93,7 @@ const MRT_Localization_NO = {
|
|
93
93
|
unpin: 'Løsne',
|
94
94
|
unpinAll: 'Løsne alle',
|
95
95
|
ungroupByColumn: 'Oppgrupper etter {column}',
|
96
|
-
selectedCountOfRowCountRowsSelected: '{
|
96
|
+
selectedCountOfRowCountRowsSelected: '{selectedCount} av {rowCount} rader valgt',
|
97
97
|
};
|
98
98
|
|
99
99
|
exports.MRT_Localization_NO = MRT_Localization_NO;
|
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "2.13.
|
2
|
+
"version": "2.13.3",
|
3
3
|
"license": "MIT",
|
4
4
|
"name": "material-react-table",
|
5
5
|
"description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
|
@@ -62,7 +62,7 @@
|
|
62
62
|
"build-storybook": "storybook build"
|
63
63
|
},
|
64
64
|
"devDependencies": {
|
65
|
-
"@emotion/react": "^11.13.
|
65
|
+
"@emotion/react": "^11.13.3",
|
66
66
|
"@emotion/styled": "^11.13.0",
|
67
67
|
"@faker-js/faker": "^8.4.1",
|
68
68
|
"@mui/icons-material": "^5.16.5",
|
@@ -70,23 +70,23 @@
|
|
70
70
|
"@mui/x-date-pickers": "^7.11.1",
|
71
71
|
"@rollup/plugin-typescript": "^11.1.6",
|
72
72
|
"@size-limit/preset-small-lib": "^11.1.4",
|
73
|
-
"@storybook/addon-a11y": "^8.2.
|
74
|
-
"@storybook/addon-essentials": "^8.2.
|
75
|
-
"@storybook/addon-links": "^8.2.
|
76
|
-
"@storybook/addon-storysource": "^8.2.
|
77
|
-
"@storybook/blocks": "^8.2.
|
78
|
-
"@storybook/preview-api": "^8.2.
|
79
|
-
"@storybook/react": "^8.2.
|
80
|
-
"@storybook/react-vite": "^8.2.
|
81
|
-
"@types/node": "^22.
|
82
|
-
"@types/react": "^18.3.
|
73
|
+
"@storybook/addon-a11y": "^8.2.9",
|
74
|
+
"@storybook/addon-essentials": "^8.2.9",
|
75
|
+
"@storybook/addon-links": "^8.2.9",
|
76
|
+
"@storybook/addon-storysource": "^8.2.9",
|
77
|
+
"@storybook/blocks": "^8.2.9",
|
78
|
+
"@storybook/preview-api": "^8.2.9",
|
79
|
+
"@storybook/react": "^8.2.9",
|
80
|
+
"@storybook/react-vite": "^8.2.9",
|
81
|
+
"@types/node": "^22.5.1",
|
82
|
+
"@types/react": "^18.3.5",
|
83
83
|
"@types/react-dom": "^18.3.0",
|
84
|
-
"@typescript-eslint/eslint-plugin": "^
|
85
|
-
"@typescript-eslint/parser": "^
|
84
|
+
"@typescript-eslint/eslint-plugin": "^8.3.0",
|
85
|
+
"@typescript-eslint/parser": "^8.3.0",
|
86
86
|
"@vitejs/plugin-react": "^4.3.1",
|
87
|
-
"eslint": "^9.
|
87
|
+
"eslint": "^9.9.1",
|
88
88
|
"eslint-plugin-mui-path-imports": "^0.0.15",
|
89
|
-
"eslint-plugin-perfectionist": "^3.
|
89
|
+
"eslint-plugin-perfectionist": "^3.3.0",
|
90
90
|
"eslint-plugin-storybook": "^0.8.0",
|
91
91
|
"prop-types": "^15.8.1",
|
92
92
|
"react": "^18.3.1",
|
@@ -98,11 +98,11 @@
|
|
98
98
|
"rollup-plugin-dts": "^6.1.1",
|
99
99
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
100
100
|
"size-limit": "^11.1.4",
|
101
|
-
"storybook": "^8.2.
|
101
|
+
"storybook": "^8.2.9",
|
102
102
|
"storybook-dark-mode": "^4.0.2",
|
103
|
-
"tslib": "^2.
|
103
|
+
"tslib": "^2.7.0",
|
104
104
|
"typescript": "^5.5.4",
|
105
|
-
"vite": "^5.
|
105
|
+
"vite": "^5.4.2"
|
106
106
|
},
|
107
107
|
"peerDependencies": {
|
108
108
|
"@emotion/react": ">=11.11",
|
@@ -114,9 +114,9 @@
|
|
114
114
|
"react-dom": ">=17.0"
|
115
115
|
},
|
116
116
|
"dependencies": {
|
117
|
-
"@tanstack/match-sorter-utils": "8.
|
118
|
-
"@tanstack/react-table": "8.
|
119
|
-
"@tanstack/react-virtual": "3.
|
117
|
+
"@tanstack/match-sorter-utils": "8.19.4",
|
118
|
+
"@tanstack/react-table": "8.20.5",
|
119
|
+
"@tanstack/react-virtual": "3.10.6",
|
120
120
|
"highlight-words": "1.2.2"
|
121
121
|
}
|
122
122
|
}
|
@@ -172,7 +172,7 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
172
172
|
rowVirtualizer,
|
173
173
|
staticRowIndex,
|
174
174
|
virtualRow: rowVirtualizer
|
175
|
-
? (rowOrVirtualRow as VirtualItem
|
175
|
+
? (rowOrVirtualRow as VirtualItem)
|
176
176
|
: undefined,
|
177
177
|
};
|
178
178
|
const key = `${row.id}-${row.index}`;
|
@@ -287,7 +287,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
287
287
|
{tableCellProps.children ?? (
|
288
288
|
<>
|
289
289
|
{cell.getIsPlaceholder() ? (
|
290
|
-
columnDef.PlaceholderCell?.({ cell, column, row, table }) ?? null
|
290
|
+
(columnDef.PlaceholderCell?.({ cell, column, row, table }) ?? null)
|
291
291
|
) : showSkeletons !== false && (isLoading || showSkeletons) ? (
|
292
292
|
<Skeleton
|
293
293
|
animation="wave"
|
@@ -35,7 +35,7 @@ export interface MRT_TableBodyRowProps<TData extends MRT_RowData>
|
|
35
35
|
rowVirtualizer?: MRT_RowVirtualizer;
|
36
36
|
staticRowIndex: number;
|
37
37
|
table: MRT_TableInstance<TData>;
|
38
|
-
virtualRow?: VirtualItem
|
38
|
+
virtualRow?: VirtualItem;
|
39
39
|
}
|
40
40
|
|
41
41
|
export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
@@ -18,7 +18,7 @@ export interface MRT_TableDetailPanelProps<TData extends MRT_RowData>
|
|
18
18
|
rowVirtualizer?: MRT_RowVirtualizer;
|
19
19
|
staticRowIndex: number;
|
20
20
|
table: MRT_TableInstance<TData>;
|
21
|
-
virtualRow?: MRT_VirtualItem
|
21
|
+
virtualRow?: MRT_VirtualItem;
|
22
22
|
}
|
23
23
|
|
24
24
|
export const MRT_TableDetailPanel = <TData extends MRT_RowData>({
|
@@ -79,13 +79,13 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
79
79
|
{tableCellProps.children ??
|
80
80
|
(footer.isPlaceholder
|
81
81
|
? null
|
82
|
-
: parseFromValuesOrFunc(columnDef.Footer, {
|
82
|
+
: (parseFromValuesOrFunc(columnDef.Footer, {
|
83
83
|
column,
|
84
84
|
footer,
|
85
85
|
table,
|
86
86
|
}) ??
|
87
87
|
columnDef.footer ??
|
88
|
-
null)}
|
88
|
+
null))}
|
89
89
|
</TableCell>
|
90
90
|
);
|
91
91
|
};
|
@@ -163,9 +163,18 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
163
163
|
? 'right'
|
164
164
|
: 'left'
|
165
165
|
}
|
166
|
+
aria-sort={
|
167
|
+
column.getIsSorted()
|
168
|
+
? column.getIsSorted() === 'asc'
|
169
|
+
? 'ascending'
|
170
|
+
: 'descending'
|
171
|
+
: 'none'
|
172
|
+
}
|
166
173
|
colSpan={header.colSpan}
|
174
|
+
data-can-sort={column.getCanSort() || undefined}
|
167
175
|
data-index={staticColumnIndex}
|
168
176
|
data-pinned={!!isColumnPinned || undefined}
|
177
|
+
data-sort={column.getIsSorted() || undefined}
|
169
178
|
onDragEnter={handleDragEnter}
|
170
179
|
onDragOver={handleDragOver}
|
171
180
|
ref={(node: HTMLTableCellElement) => {
|
@@ -222,7 +231,7 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
222
231
|
>
|
223
232
|
{header.isPlaceholder
|
224
233
|
? null
|
225
|
-
: tableCellProps.children ?? (
|
234
|
+
: (tableCellProps.children ?? (
|
226
235
|
<Box
|
227
236
|
className="Mui-TableHeadCell-Content"
|
228
237
|
sx={{
|
@@ -312,7 +321,7 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
312
321
|
<MRT_TableHeadCellResizeHandle header={header} table={table} />
|
313
322
|
)}
|
314
323
|
</Box>
|
315
|
-
)}
|
324
|
+
))}
|
316
325
|
{columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (
|
317
326
|
<MRT_TableHeadCellFilterContainer header={header} table={table} />
|
318
327
|
)}
|
@@ -42,6 +42,7 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
42
42
|
const isEditing = editingRow?.id === row.id;
|
43
43
|
|
44
44
|
const [value, setValue] = useState(() => cell.getValue<string>());
|
45
|
+
const [completesComposition, setCompletesComposition] = useState(true);
|
45
46
|
|
46
47
|
const textFieldProps: TextFieldProps = {
|
47
48
|
...parseFromValuesOrFunc(muiEditTextFieldProps, {
|
@@ -94,7 +95,7 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
94
95
|
|
95
96
|
const handleEnterKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
|
96
97
|
textFieldProps.onKeyDown?.(event);
|
97
|
-
if (event.key === 'Enter' && !event.shiftKey) {
|
98
|
+
if (event.key === 'Enter' && !event.shiftKey && completesComposition) {
|
98
99
|
editInputRefs.current[column.id]?.blur();
|
99
100
|
}
|
100
101
|
};
|
@@ -164,6 +165,8 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
164
165
|
textFieldProps?.onClick?.(e);
|
165
166
|
}}
|
166
167
|
onKeyDown={handleEnterKeyDown}
|
168
|
+
onCompositionStart={() => setCompletesComposition(false)}
|
169
|
+
onCompositionEnd={() => setCompletesComposition(true)}
|
167
170
|
>
|
168
171
|
{textFieldProps.children ??
|
169
172
|
selectOptions?.map((option) => {
|
@@ -41,7 +41,7 @@ export const MRT_FilterRangeSlider = <TData extends MRT_RowData>({
|
|
41
41
|
let [min, max] =
|
42
42
|
sliderProps.min !== undefined && sliderProps.max !== undefined
|
43
43
|
? [sliderProps.min, sliderProps.max]
|
44
|
-
: column.getFacetedMinMaxValues() ?? [0, 1];
|
44
|
+
: (column.getFacetedMinMaxValues() ?? [0, 1]);
|
45
45
|
|
46
46
|
//fix potential TanStack Table bugs where min or max is an array
|
47
47
|
if (Array.isArray(min)) min = min[0];
|
@@ -117,8 +117,11 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
117
117
|
: '';
|
118
118
|
|
119
119
|
const filterPlaceholder = !isRangeFilter
|
120
|
-
? textFieldProps?.placeholder ??
|
121
|
-
localization.filterByColumn?.replace(
|
120
|
+
? (textFieldProps?.placeholder ??
|
121
|
+
localization.filterByColumn?.replace(
|
122
|
+
'{column}',
|
123
|
+
String(columnDef.header),
|
124
|
+
))
|
122
125
|
: rangeFilterIndex === 0
|
123
126
|
? localization.min
|
124
127
|
: rangeFilterIndex === 1
|
@@ -141,7 +144,7 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
141
144
|
? (column.getFilterValue() as [string, string])?.[
|
142
145
|
rangeFilterIndex as number
|
143
146
|
] || ''
|
144
|
-
: (column.getFilterValue() as string) ?? '',
|
147
|
+
: ((column.getFilterValue() as string) ?? ''),
|
145
148
|
);
|
146
149
|
const [autocompleteValue, setAutocompleteValue] =
|
147
150
|
useState<DropdownOption | null>(
|
@@ -254,7 +254,7 @@ export const MRT_FilterOptionMenu = <TData extends MRT_RowData>({
|
|
254
254
|
{...rest}
|
255
255
|
>
|
256
256
|
{(header && column && columnDef
|
257
|
-
? columnDef.renderColumnFilterModeMenuItems?.({
|
257
|
+
? (columnDef.renderColumnFilterModeMenuItems?.({
|
258
258
|
column: column as any,
|
259
259
|
internalFilterOptions,
|
260
260
|
onSelectFilterMode: handleSelectFilterMode,
|
@@ -265,7 +265,7 @@ export const MRT_FilterOptionMenu = <TData extends MRT_RowData>({
|
|
265
265
|
internalFilterOptions,
|
266
266
|
onSelectFilterMode: handleSelectFilterMode,
|
267
267
|
table,
|
268
|
-
})
|
268
|
+
}))
|
269
269
|
: renderGlobalFilterModeMenuItems?.({
|
270
270
|
internalFilterOptions,
|
271
271
|
onSelectFilterMode: handleSelectFilterMode,
|
@@ -56,12 +56,12 @@ export const MRT_TableContainer = <TData extends MRT_RowData>({
|
|
56
56
|
useIsomorphicLayoutEffect(() => {
|
57
57
|
const topToolbarHeight =
|
58
58
|
typeof document !== 'undefined'
|
59
|
-
? topToolbarRef.current?.offsetHeight ?? 0
|
59
|
+
? (topToolbarRef.current?.offsetHeight ?? 0)
|
60
60
|
: 0;
|
61
61
|
|
62
62
|
const bottomToolbarHeight =
|
63
63
|
typeof document !== 'undefined'
|
64
|
-
? bottomToolbarRef?.current?.offsetHeight ?? 0
|
64
|
+
? (bottomToolbarRef?.current?.offsetHeight ?? 0)
|
65
65
|
: 0;
|
66
66
|
|
67
67
|
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
@@ -99,10 +99,10 @@ export const useMRT_TableInstance = <TData extends MRT_RowData>(
|
|
99
99
|
).map((col) => ({
|
100
100
|
[getColumnId(col)]:
|
101
101
|
col.filterFn instanceof Function
|
102
|
-
? col.filterFn.name ?? 'custom'
|
103
|
-
: col.filterFn ??
|
102
|
+
? (col.filterFn.name ?? 'custom')
|
103
|
+
: (col.filterFn ??
|
104
104
|
initialState?.columnFilterFns?.[getColumnId(col)] ??
|
105
|
-
getDefaultColumnFilterFn(col),
|
105
|
+
getDefaultColumnFilterFn(col)),
|
106
106
|
})),
|
107
107
|
),
|
108
108
|
);
|
package/src/locales/no.ts
CHANGED
@@ -93,5 +93,6 @@ export const MRT_Localization_NO: MRT_Localization = {
|
|
93
93
|
unpinAll: 'Løsne alle',
|
94
94
|
|
95
95
|
ungroupByColumn: 'Oppgrupper etter {column}',
|
96
|
-
selectedCountOfRowCountRowsSelected:
|
96
|
+
selectedCountOfRowCountRowsSelected:
|
97
|
+
'{selectedCount} av {rowCount} rader valgt',
|
97
98
|
};
|
package/src/types.ts
CHANGED
@@ -114,7 +114,7 @@ export type MRT_PaginationState = PaginationState;
|
|
114
114
|
export type MRT_RowSelectionState = RowSelectionState;
|
115
115
|
export type MRT_SortingState = SortingState;
|
116
116
|
export type MRT_Updater<T> = Updater<T>;
|
117
|
-
export type MRT_VirtualItem
|
117
|
+
export type MRT_VirtualItem = VirtualItem;
|
118
118
|
export type MRT_VisibilityState = VisibilityState;
|
119
119
|
|
120
120
|
export type MRT_VirtualizerOptions<
|