material-react-table 0.35.0 → 0.35.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/package.json
CHANGED
|
@@ -48,7 +48,17 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
48
48
|
const initState = props.initialState ?? {};
|
|
49
49
|
initState.columnOrder =
|
|
50
50
|
initState.columnOrder ?? getDefaultColumnOrderIds(props);
|
|
51
|
-
initState.
|
|
51
|
+
initState.globalFilterFn =
|
|
52
|
+
props.globalFilterFn instanceof String
|
|
53
|
+
? (props.globalFilterFn as MRT_FilterOption)
|
|
54
|
+
: 'fuzzy';
|
|
55
|
+
return initState;
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const [columnFilterFns, setColumnFilterFns] = useState<{
|
|
59
|
+
[key: string]: MRT_FilterOption;
|
|
60
|
+
}>(() =>
|
|
61
|
+
Object.assign(
|
|
52
62
|
{},
|
|
53
63
|
...getAllLeafColumnDefs(props.columns as MRT_ColumnDef<TData>[]).map(
|
|
54
64
|
(col) => ({
|
|
@@ -62,17 +72,8 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
62
72
|
getDefaultColumnFilterFn(col),
|
|
63
73
|
}),
|
|
64
74
|
),
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
props.globalFilterFn instanceof String
|
|
68
|
-
? (props.globalFilterFn as MRT_FilterOption)
|
|
69
|
-
: 'fuzzy';
|
|
70
|
-
return initState;
|
|
71
|
-
}, []);
|
|
72
|
-
|
|
73
|
-
const [columnFilterFns, setColumnFilterFns] = useState<{
|
|
74
|
-
[key: string]: MRT_FilterOption;
|
|
75
|
-
}>(initialState.columnFilterFns ?? {});
|
|
75
|
+
),
|
|
76
|
+
);
|
|
76
77
|
const [columnOrder, setColumnOrder] = useState(
|
|
77
78
|
initialState.columnOrder ?? [],
|
|
78
79
|
);
|