material-react-table 1.0.0-beta.10 → 1.0.0-beta.11
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 +14 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/material-react-table.esm.js +15 -5
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/inputs/MRT_FilterTextField.tsx +8 -1
- package/src/inputs/MRT_GlobalFilterTextField.tsx +17 -5
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import React, {
|
|
|
3
3
|
FC,
|
|
4
4
|
MouseEvent,
|
|
5
5
|
useCallback,
|
|
6
|
+
useEffect,
|
|
6
7
|
useState,
|
|
7
8
|
} from 'react';
|
|
8
9
|
import {
|
|
@@ -169,6 +170,12 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
169
170
|
setAnchorEl(event.currentTarget);
|
|
170
171
|
};
|
|
171
172
|
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
if (column.getFilterValue() === undefined) {
|
|
175
|
+
handleClear();
|
|
176
|
+
}
|
|
177
|
+
}, [column.getFilterValue()]);
|
|
178
|
+
|
|
172
179
|
if (columnDef.Filter) {
|
|
173
180
|
return <>{columnDef.Filter?.({ column, header, table })}</>;
|
|
174
181
|
}
|
|
@@ -315,7 +322,7 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
315
322
|
? '120px'
|
|
316
323
|
: 'auto',
|
|
317
324
|
width: '100%',
|
|
318
|
-
'&
|
|
325
|
+
'& .MuiSelect-icon': {
|
|
319
326
|
mr: '1.5rem',
|
|
320
327
|
},
|
|
321
328
|
...(textFieldProps?.sx instanceof Function
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
ChangeEvent,
|
|
3
|
+
MouseEvent,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useState,
|
|
7
|
+
} from 'react';
|
|
2
8
|
import {
|
|
3
9
|
Collapse,
|
|
4
10
|
debounce,
|
|
@@ -32,6 +38,11 @@ export const MRT_GlobalFilterTextField = <
|
|
|
32
38
|
} = table;
|
|
33
39
|
const { globalFilter, showGlobalFilter } = getState();
|
|
34
40
|
|
|
41
|
+
const textFieldProps =
|
|
42
|
+
muiSearchTextFieldProps instanceof Function
|
|
43
|
+
? muiSearchTextFieldProps({ table })
|
|
44
|
+
: muiSearchTextFieldProps;
|
|
45
|
+
|
|
35
46
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
36
47
|
const [searchValue, setSearchValue] = useState(globalFilter ?? '');
|
|
37
48
|
|
|
@@ -56,10 +67,11 @@ export const MRT_GlobalFilterTextField = <
|
|
|
56
67
|
setGlobalFilter(undefined);
|
|
57
68
|
};
|
|
58
69
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (globalFilter === undefined) {
|
|
72
|
+
handleClear();
|
|
73
|
+
}
|
|
74
|
+
}, [globalFilter]);
|
|
63
75
|
|
|
64
76
|
return (
|
|
65
77
|
<Collapse
|