material-react-table 0.8.7 → 0.8.10
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/README.md +29 -15
- package/dist/MaterialReactTable.d.ts +10 -8
- package/dist/material-react-table.cjs.development.js +1774 -4839
- 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 +91 -74
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +5 -4
- package/src/MaterialReactTable.tsx +29 -24
- package/src/body/MRT_TableBodyCell.tsx +13 -10
- package/src/buttons/MRT_CopyButton.tsx +6 -3
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +4 -3
- package/src/footer/MRT_TableFooterCell.tsx +10 -6
- package/src/head/MRT_TableHeadCell.tsx +36 -32
- package/src/inputs/MRT_EditCellTextField.tsx +15 -9
- package/src/inputs/MRT_FilterTextField.tsx +15 -10
- package/src/menus/MRT_ColumnActionMenu.tsx +10 -8
- package/src/menus/MRT_FilterOptionMenu.tsx +11 -7
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +1 -1
|
@@ -47,6 +47,10 @@ export const MRT_FilterOptionMenu: FC<Props> = ({
|
|
|
47
47
|
const { isDensePadding, currentFilterFns, currentGlobalFilterFn } =
|
|
48
48
|
getState();
|
|
49
49
|
|
|
50
|
+
const { column } = header ?? {};
|
|
51
|
+
|
|
52
|
+
const { columnDef } = column ?? {};
|
|
53
|
+
|
|
50
54
|
const filterOptions: {
|
|
51
55
|
option: MRT_FILTER_OPTION;
|
|
52
56
|
label: string;
|
|
@@ -122,9 +126,9 @@ export const MRT_FilterOptionMenu: FC<Props> = ({
|
|
|
122
126
|
fn: notEmpty,
|
|
123
127
|
},
|
|
124
128
|
].filter((filterType) =>
|
|
125
|
-
|
|
126
|
-
? !
|
|
127
|
-
|
|
129
|
+
columnDef
|
|
130
|
+
? !columnDef.enabledColumnFilterOptions ||
|
|
131
|
+
columnDef.enabledColumnFilterOptions.includes(filterType.option)
|
|
128
132
|
: (!enabledGlobalFilterOptions ||
|
|
129
133
|
enabledGlobalFilterOptions.includes(filterType.option)) &&
|
|
130
134
|
[MRT_FILTER_OPTION.FUZZY, MRT_FILTER_OPTION.CONTAINS].includes(
|
|
@@ -135,7 +139,7 @@ export const MRT_FilterOptionMenu: FC<Props> = ({
|
|
|
135
139
|
);
|
|
136
140
|
|
|
137
141
|
const handleSelectFilterType = (value: MRT_FILTER_OPTION) => {
|
|
138
|
-
if (header) {
|
|
142
|
+
if (header && column) {
|
|
139
143
|
setCurrentFilterFns((prev: { [key: string]: MRT_FilterFn }) => ({
|
|
140
144
|
...prev,
|
|
141
145
|
[header.id]: value,
|
|
@@ -143,11 +147,11 @@ export const MRT_FilterOptionMenu: FC<Props> = ({
|
|
|
143
147
|
if (
|
|
144
148
|
[MRT_FILTER_OPTION.EMPTY, MRT_FILTER_OPTION.NOT_EMPTY].includes(value)
|
|
145
149
|
) {
|
|
146
|
-
|
|
150
|
+
column.setFilterValue(' ');
|
|
147
151
|
} else if (value === MRT_FILTER_OPTION.BETWEEN) {
|
|
148
|
-
|
|
152
|
+
column.setFilterValue(['', '']);
|
|
149
153
|
} else {
|
|
150
|
-
|
|
154
|
+
column.setFilterValue('');
|
|
151
155
|
}
|
|
152
156
|
} else {
|
|
153
157
|
setCurrentGlobalFilterFn(value);
|
|
@@ -31,7 +31,7 @@ export const MRT_ShowHideColumnsMenu: FC<Props> = ({
|
|
|
31
31
|
|
|
32
32
|
const hideAllColumns = () => {
|
|
33
33
|
getAllLeafColumns()
|
|
34
|
-
.filter((col) => col.enableHiding !== false)
|
|
34
|
+
.filter((col) => col.columnDef.enableHiding !== false)
|
|
35
35
|
.forEach((col) => col.toggleVisibility(false));
|
|
36
36
|
};
|
|
37
37
|
|