material-react-table 0.30.1 → 0.30.2
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/MaterialReactTable.d.ts +2 -2
- package/dist/column.utils.d.ts +1 -1
- package/dist/material-react-table.cjs.development.js +18 -7
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +18 -7
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +2 -5
- package/src/MaterialReactTable.tsx +6 -2
- package/src/column.utils.ts +1 -0
- package/src/head/MRT_TableHeadCell.tsx +12 -2
- package/src/inputs/MRT_FilterTextField.tsx +28 -26
- package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -1
- package/src/table/MRT_TableRoot.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.30.
|
|
2
|
+
"version": "0.30.2",
|
|
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.",
|
|
@@ -82,9 +82,6 @@
|
|
|
82
82
|
"react": "^18.2.0",
|
|
83
83
|
"react-dom": "^18.2.0",
|
|
84
84
|
"react-is": "^18.2.0",
|
|
85
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
|
86
|
-
"rollup-plugin-node-resolve": "^5.2.0",
|
|
87
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
88
85
|
"size-limit": "^7.0.8",
|
|
89
86
|
"storybook-dark-mode": "^1.1.0",
|
|
90
87
|
"tsdx": "^0.14.1",
|
|
@@ -100,7 +97,7 @@
|
|
|
100
97
|
},
|
|
101
98
|
"dependencies": {
|
|
102
99
|
"@tanstack/match-sorter-utils": "8.1.1",
|
|
103
|
-
"@tanstack/react-table": "8.
|
|
100
|
+
"@tanstack/react-table": "8.5.2",
|
|
104
101
|
"@tanstack/react-virtual": "^3.0.0-beta.13"
|
|
105
102
|
}
|
|
106
103
|
}
|
|
@@ -390,13 +390,17 @@ export type MRT_Cell<TData extends Record<string, any> = {}> = Omit<
|
|
|
390
390
|
row: MRT_Row<TData>;
|
|
391
391
|
};
|
|
392
392
|
|
|
393
|
-
export type MRT_SortingOption =
|
|
393
|
+
export type MRT_SortingOption = LiteralUnion<
|
|
394
|
+
string & keyof typeof MRT_SortingFns
|
|
395
|
+
>;
|
|
394
396
|
|
|
395
397
|
export type MRT_SortingFn<TData extends Record<string, any> = {}> =
|
|
396
398
|
| SortingFn<TData>
|
|
397
399
|
| MRT_SortingOption;
|
|
398
400
|
|
|
399
|
-
export type MRT_FilterOption =
|
|
401
|
+
export type MRT_FilterOption = LiteralUnion<
|
|
402
|
+
string & keyof typeof MRT_FilterFns
|
|
403
|
+
>;
|
|
400
404
|
|
|
401
405
|
export type MRT_FilterFn<TData extends Record<string, any> = {}> =
|
|
402
406
|
| FilterFn<TData>
|
package/src/column.utils.ts
CHANGED
|
@@ -51,6 +51,7 @@ export const prepareColumns = <TData extends Record<string, any> = {}>(
|
|
|
51
51
|
} else if (columnDef.columnDefType === 'data') {
|
|
52
52
|
if (Object.keys(MRT_FilterFns).includes(currentFilterFns[columnDef.id])) {
|
|
53
53
|
columnDef.filterFn =
|
|
54
|
+
// @ts-ignore
|
|
54
55
|
MRT_FilterFns[currentFilterFns[columnDef.id]] ?? MRT_FilterFns.fuzzy;
|
|
55
56
|
//@ts-ignore
|
|
56
57
|
columnDef._filterFn = currentFilterFns[columnDef.id];
|
|
@@ -28,7 +28,12 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
|
28
28
|
},
|
|
29
29
|
setCurrentHoveredColumn,
|
|
30
30
|
} = table;
|
|
31
|
-
const {
|
|
31
|
+
const {
|
|
32
|
+
density,
|
|
33
|
+
currentDraggingColumn,
|
|
34
|
+
currentHoveredColumn,
|
|
35
|
+
showColumnFilters,
|
|
36
|
+
} = getState();
|
|
32
37
|
const { column } = header;
|
|
33
38
|
const { columnDef } = column;
|
|
34
39
|
const { columnDefType } = columnDef;
|
|
@@ -136,7 +141,12 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
|
136
141
|
: columnDefType === 'display'
|
|
137
142
|
? '1rem 1.25rem'
|
|
138
143
|
: '1.5rem',
|
|
139
|
-
pb:
|
|
144
|
+
pb:
|
|
145
|
+
columnDefType === 'display'
|
|
146
|
+
? 0
|
|
147
|
+
: showColumnFilters
|
|
148
|
+
? '0.5rem'
|
|
149
|
+
: undefined,
|
|
140
150
|
position:
|
|
141
151
|
column.getIsPinned() && columnDefType !== 'group'
|
|
142
152
|
? 'sticky'
|
|
@@ -250,7 +250,7 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
250
250
|
)}
|
|
251
251
|
</InputAdornment>
|
|
252
252
|
) : (
|
|
253
|
-
<FilterListIcon />
|
|
253
|
+
<FilterListIcon style={{ marginRight: '4px' }} />
|
|
254
254
|
),
|
|
255
255
|
endAdornment: !filterChipLabel && (
|
|
256
256
|
<InputAdornment position="end">
|
|
@@ -297,7 +297,7 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
297
297
|
sx={(theme) => ({
|
|
298
298
|
p: 0,
|
|
299
299
|
minWidth: !filterChipLabel ? '6rem' : 'auto',
|
|
300
|
-
width: '
|
|
300
|
+
width: '100%',
|
|
301
301
|
'& .MuiSelect-icon': {
|
|
302
302
|
mr: '1.5rem',
|
|
303
303
|
},
|
|
@@ -311,30 +311,32 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
311
311
|
<Box sx={{ opacity: 0.5 }}>{filterPlaceholder}</Box>
|
|
312
312
|
</MenuItem>
|
|
313
313
|
)}
|
|
314
|
-
{columnDef?.filterSelectOptions?.map(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
{
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
314
|
+
{columnDef?.filterSelectOptions?.map(
|
|
315
|
+
(option: string | { text: string; value: string }) => {
|
|
316
|
+
let value: string;
|
|
317
|
+
let text: string;
|
|
318
|
+
if (typeof option !== 'object') {
|
|
319
|
+
value = option;
|
|
320
|
+
text = option;
|
|
321
|
+
} else {
|
|
322
|
+
value = option.value;
|
|
323
|
+
text = option.text;
|
|
324
|
+
}
|
|
325
|
+
return (
|
|
326
|
+
<MenuItem key={value} value={value}>
|
|
327
|
+
{isMultiSelectFilter && (
|
|
328
|
+
<Checkbox
|
|
329
|
+
checked={(
|
|
330
|
+
(column.getFilterValue() ?? []) as string[]
|
|
331
|
+
).includes(value)}
|
|
332
|
+
sx={{ mr: '0.5rem' }}
|
|
333
|
+
/>
|
|
334
|
+
)}
|
|
335
|
+
<ListItemText>{text}</ListItemText>
|
|
336
|
+
</MenuItem>
|
|
337
|
+
);
|
|
338
|
+
},
|
|
339
|
+
)}
|
|
338
340
|
</TextField>
|
|
339
341
|
<MRT_FilterOptionMenu
|
|
340
342
|
anchorEl={anchorEl}
|