@mui/x-data-grid-pro 7.0.0-alpha.3 → 7.0.0-alpha.5
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/CHANGELOG.md +245 -0
- package/DataGridPro/DataGridPro.js +6 -6
- package/DataGridPro/useDataGridProProps.js +1 -1
- package/components/GridTreeDataGroupingCell.js +0 -1
- package/components/headerFiltering/GridHeaderFilterCell.js +3 -3
- package/components/headerFiltering/GridHeaderFilterMenuContainer.js +2 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -4
- package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +1 -1
- package/hooks/features/rowReorder/gridRowReorderColDef.js +1 -1
- package/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/hooks/features/treeData/useGridTreeData.js +2 -1
- package/index.js +1 -1
- package/legacy/DataGridPro/DataGridPro.js +6 -6
- package/legacy/DataGridPro/useDataGridProProps.js +1 -1
- package/legacy/components/GridTreeDataGroupingCell.js +0 -1
- package/legacy/components/headerFiltering/GridHeaderFilterCell.js +3 -3
- package/legacy/components/headerFiltering/GridHeaderFilterMenuContainer.js +2 -2
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -4
- package/legacy/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +1 -1
- package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +1 -1
- package/legacy/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/legacy/hooks/features/treeData/useGridTreeData.js +2 -1
- package/legacy/index.js +1 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridProProps.d.ts +1 -1
- package/modern/DataGridPro/DataGridPro.js +6 -6
- package/modern/DataGridPro/useDataGridProProps.js +1 -1
- package/modern/components/GridTreeDataGroupingCell.js +0 -1
- package/modern/components/headerFiltering/GridHeaderFilterCell.js +3 -3
- package/modern/components/headerFiltering/GridHeaderFilterMenuContainer.js +2 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -4
- package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +1 -1
- package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +1 -1
- package/modern/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/modern/hooks/features/treeData/useGridTreeData.js +2 -1
- package/modern/index.js +1 -1
- package/modern/utils/domUtils.js +0 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPro/DataGridPro.js +6 -6
- package/node/DataGridPro/useDataGridProProps.js +1 -1
- package/node/components/GridTreeDataGroupingCell.js +0 -1
- package/node/components/headerFiltering/GridHeaderFilterCell.js +2 -2
- package/node/components/headerFiltering/GridHeaderFilterMenuContainer.js +1 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -3
- package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +1 -1
- package/node/hooks/features/rowReorder/gridRowReorderColDef.js +1 -1
- package/node/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/node/hooks/features/treeData/useGridTreeData.js +2 -1
- package/node/index.js +1 -1
- package/node/utils/domUtils.js +0 -1
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +5 -5
- package/utils/domUtils.js +0 -1
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,169 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.0.0-alpha.5
|
|
7
|
+
|
|
8
|
+
_Dec 14, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 💫 New recipe added for the Data Grid
|
|
13
|
+
- 🌍 Improve Swedish (sv-SE) and Urdu (ur-PK) locales on the Data Grid
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
|
|
16
|
+
### Data Grid
|
|
17
|
+
|
|
18
|
+
#### Breaking changes
|
|
19
|
+
|
|
20
|
+
- The `instanceId` prop is now required for state selectors.
|
|
21
|
+
This prop is used to distinguish between multiple Data Grid instances on the same page.
|
|
22
|
+
See [migration docs](https://next.mui.com/x/migration/migration-data-grid-v6/#instanceid-prop-is-required-for-state-selectors) for more details.
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid@7.0.0-alpha.5`
|
|
25
|
+
|
|
26
|
+
- [DataGrid] Make `instanceId` required for state selectors (#11395) @cherniavskii
|
|
27
|
+
- [DataGrid] Recipe for grouped rows autosizing (#11401) @michelengelen
|
|
28
|
+
- [l10n] Improve Swedish (sv-SE) locale (#11373) @fredrikcarlbom
|
|
29
|
+
- [l10n] Improve Urdu (ur-PK) locale (#11400) @MBilalShafi
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-pro@7.0.0-alpha.5` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid@7.0.0-alpha.5`.
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-premium@7.0.0-alpha.5` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.5`.
|
|
38
|
+
|
|
39
|
+
### Date Pickers
|
|
40
|
+
|
|
41
|
+
#### Breaking changes
|
|
42
|
+
|
|
43
|
+
- The slot interfaces got renamed to match with `@mui/base` naming.
|
|
44
|
+
The `SlotsComponent` suffix has been replaced with `Slots` and `SlotsComponentsProps` with `SlotProps`.
|
|
45
|
+
|
|
46
|
+
```diff
|
|
47
|
+
- DateCalendarSlotsComponent
|
|
48
|
+
+ DateCalendarSlots
|
|
49
|
+
- DateCalendarSlotsComponentsProps
|
|
50
|
+
+ DateCalendarSlotProps
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### `@mui/x-date-pickers@7.0.0-alpha.5`
|
|
54
|
+
|
|
55
|
+
- [fields] Support empty sections (#10307) @flaviendelangle
|
|
56
|
+
- [pickers] Fix field types to avoid error on latest `@types/react` version (#11397) @LukasTy
|
|
57
|
+
- [pickers] Remove all relative imports to the internals index file (#11375) @flaviendelangle
|
|
58
|
+
- [pickers] Rename slots interfaces (#11339) @alexfauquette
|
|
59
|
+
- [pickers] Simplify the API of the field hooks (#11371) @flaviendelangle
|
|
60
|
+
- [pickers] Support name prop (#11025) @gitstart
|
|
61
|
+
|
|
62
|
+
#### `@mui/x-date-pickers-pro@7.0.0-alpha.5` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
63
|
+
|
|
64
|
+
Same changes as in `@mui/x-date-pickers@7.0.0-alpha.5`, plus:
|
|
65
|
+
|
|
66
|
+
- [DateRangePicker] Fix `autoFocus` behavior (#11273) @kealjones-wk
|
|
67
|
+
|
|
68
|
+
### Charts / `@mui/x-charts@7.0.0-alpha.5`
|
|
69
|
+
|
|
70
|
+
- [charts] Fix size overflow (#11385) @alexfauquette
|
|
71
|
+
|
|
72
|
+
### `@mui/x-codemod@7.0.0-alpha.5`
|
|
73
|
+
|
|
74
|
+
- [codemod] Add `cellSelection` codemod and update migration guide (#11353) @MBilalShafi
|
|
75
|
+
|
|
76
|
+
### Docs
|
|
77
|
+
|
|
78
|
+
- [docs] Respect GoT books (@janoma) (#11387) @alexfauquette
|
|
79
|
+
|
|
80
|
+
### Core
|
|
81
|
+
|
|
82
|
+
- [core] Automate cherry-pick of PRs from `next` -> `master` (#11382) @MBilalShafi
|
|
83
|
+
- [github] Update `no-response` workflow (#11369) @MBilalShafi
|
|
84
|
+
- [test] Fix flaky screenshots (#11388) @cherniavskii
|
|
85
|
+
|
|
86
|
+
## 7.0.0-alpha.4
|
|
87
|
+
|
|
88
|
+
_Dec 8, 2023_
|
|
89
|
+
|
|
90
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
91
|
+
|
|
92
|
+
- 🚀 The scatter charts now use voronoi to trigger items
|
|
93
|
+
|
|
94
|
+
Users needed to hover the item to highlight the scatter item or show the tooltip.
|
|
95
|
+
Now they can interact with data by triggering the closest element. See the [docs page](https://next.mui.com/x/react-charts/scatter/#interaction) for more info.
|
|
96
|
+
|
|
97
|
+
- 📚 Add [Pickers FAQ page](https://next.mui.com/x/react-date-pickers/faq/)
|
|
98
|
+
- 🎉 The Data Grid Header filters feature is now stable
|
|
99
|
+
- 🌍 Improve Danish (da-DK) locale on Data Grid
|
|
100
|
+
- 🐞 Bugfixes
|
|
101
|
+
|
|
102
|
+
### Data Grid
|
|
103
|
+
|
|
104
|
+
#### Breaking changes
|
|
105
|
+
|
|
106
|
+
- The header filters feature is now stable. `unstable_` prefix is removed from prop `headerFilters` and related exports.
|
|
107
|
+
See [migration docs](https://next.mui.com/x/migration/migration-data-grid-v6/#filtering) for more details.
|
|
108
|
+
|
|
109
|
+
- The `GridColDef['type']` has been narrowed down to only accept the built-in column types.
|
|
110
|
+
TypeScript users need to use the `GridColDef` interface when defining columns:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
// 🛑 `type` is inferred as `string` and is too wide
|
|
114
|
+
const columns = [{ type: 'number', field: 'id' }];
|
|
115
|
+
<DataGrid columns={columns} />;
|
|
116
|
+
|
|
117
|
+
// ✅ `type` is `'number'`
|
|
118
|
+
const columns: GridColDef[] = [{ type: 'number', field: 'id' }];
|
|
119
|
+
<DataGrid columns={columns} />;
|
|
120
|
+
|
|
121
|
+
// ✅ Alternalively, `as const` can be used to narrow down the type
|
|
122
|
+
const columns = [{ type: 'number' as const, field: 'id' }];
|
|
123
|
+
<DataGrid columns={columns} />;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### `@mui/x-data-grid@7.0.0-alpha.4`
|
|
127
|
+
|
|
128
|
+
- [DataGrid] Added a guard for reorder cells (#11159) @michelengelen
|
|
129
|
+
- [DataGrid] Narrow down `GridColDef['type']` (#11270) @cherniavskii
|
|
130
|
+
- [l10n] Improve Danish (da-DK) locale (#11304) @goibon
|
|
131
|
+
|
|
132
|
+
#### `@mui/x-data-grid-pro@7.0.0-alpha.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
133
|
+
|
|
134
|
+
Same changes as in `@mui/x-data-grid@7.0.0-alpha.4`, plus:
|
|
135
|
+
|
|
136
|
+
- [DataGridPro] Make header filters feature stable (#11243) @MBilalShafi
|
|
137
|
+
|
|
138
|
+
#### `@mui/x-data-grid-premium@7.0.0-alpha.4` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
139
|
+
|
|
140
|
+
Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.4`.
|
|
141
|
+
|
|
142
|
+
### Date Pickers
|
|
143
|
+
|
|
144
|
+
#### `@mui/x-date-pickers@7.0.0-alpha.4`
|
|
145
|
+
|
|
146
|
+
- [fields] Rework `PickersTextField` (#11258) @flaviendelangle
|
|
147
|
+
- [pickers] Fix `MultiSectionDigitalClock` issues (#11305) @LukasTy
|
|
148
|
+
- [pickers] Fix views height consistency (#11337) @LukasTy
|
|
149
|
+
|
|
150
|
+
#### `@mui/x-date-pickers-pro@7.0.0-alpha.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
151
|
+
|
|
152
|
+
Same changes as in `@mui/x-date-pickers@7.0.0-alpha.4`.
|
|
153
|
+
|
|
154
|
+
### Charts / `@mui/x-charts@7.0.0-alpha.4`
|
|
155
|
+
|
|
156
|
+
- [charts] Remove animation on sparkline (#11311) @oliviertassinari
|
|
157
|
+
- [charts] Use voronoi cells to trigger interaction with scatter items (#10981) @alexfauquette
|
|
158
|
+
- [charts] Add `@mui/utils` as a dependency (#11351) @michelengelen
|
|
159
|
+
|
|
160
|
+
### Docs
|
|
161
|
+
|
|
162
|
+
- [docs] Add FAQ page (#11271) @noraleonte
|
|
163
|
+
- [docs] Add a doc section on how to override the start of the week with each adapter (#11223) @flaviendelangle
|
|
164
|
+
- [docs] Added params to `onPaginationModelChange` docs (#10191) @JFBenzs
|
|
165
|
+
- [docs] Fix typo (#11324) @cadam11
|
|
166
|
+
- [docs] Improve `DemoContainer` styling coverage (#11315) @LukasTy
|
|
167
|
+
- [docs] General revision of the Charts docs (#11249) @danilo-leal
|
|
168
|
+
|
|
6
169
|
## 7.0.0-alpha.3
|
|
7
170
|
|
|
8
171
|
_Dec 4, 2023_
|
|
@@ -866,6 +1029,88 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
|
|
|
866
1029
|
- [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
|
|
867
1030
|
- [license] Correctly throw errors (#10924) @oliviertassinari
|
|
868
1031
|
|
|
1032
|
+
## 6.18.5
|
|
1033
|
+
|
|
1034
|
+
_Dec 14, 2023_
|
|
1035
|
+
|
|
1036
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
1037
|
+
|
|
1038
|
+
- 🌍 Improve Swedish (sv-SE) and Urdu (ur-PK) locales on the Data Grid
|
|
1039
|
+
- 🐞 Bugfixes
|
|
1040
|
+
|
|
1041
|
+
### Data Grid
|
|
1042
|
+
|
|
1043
|
+
#### `@mui/x-data-grid@6.18.5`
|
|
1044
|
+
|
|
1045
|
+
- [l10n] Improve Swedish (sv-SE) locale (#11379) @fredrikcarlbom
|
|
1046
|
+
- [l10n] Improve Urdu (ur-PK) locale for data grid (#11409) @MBilalShafi
|
|
1047
|
+
|
|
1048
|
+
#### `@mui/x-data-grid-pro@6.18.5` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1049
|
+
|
|
1050
|
+
Same changes as in `@mui/x-data-grid@6.18.5`.
|
|
1051
|
+
|
|
1052
|
+
#### `@mui/x-data-grid-premium@6.18.5` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
1053
|
+
|
|
1054
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.5`.
|
|
1055
|
+
|
|
1056
|
+
### Date Pickers
|
|
1057
|
+
|
|
1058
|
+
#### `@mui/x-date-pickers@6.18.5`
|
|
1059
|
+
|
|
1060
|
+
- [pickers] Fix field types to avoid error on latest `@types/react` version (#11398) @LukasTy
|
|
1061
|
+
- [pickers] Support name prop (#11380) @gitstart
|
|
1062
|
+
|
|
1063
|
+
#### `@mui/x-date-pickers-pro@6.18.5` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1064
|
+
|
|
1065
|
+
Same changes as in `@mui/x-date-pickers@6.18.5`, plus:
|
|
1066
|
+
|
|
1067
|
+
- [DateRangePicker] Fix `autoFocus` behavior (#11376) @kealjones-wk
|
|
1068
|
+
|
|
1069
|
+
### Docs
|
|
1070
|
+
|
|
1071
|
+
- [docs] Respect GoT books (#11294) @janoma
|
|
1072
|
+
- [test] Fix flaky screenshots (#11391) @cherniavskii
|
|
1073
|
+
|
|
1074
|
+
## 6.18.4
|
|
1075
|
+
|
|
1076
|
+
_Dec 8, 2023_
|
|
1077
|
+
|
|
1078
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
1079
|
+
|
|
1080
|
+
- 📚 Add [Pickers FAQ page](https://mui.com/x/react-date-pickers/faq/)
|
|
1081
|
+
- 🌍 Improve Danish (da-DK) locale on Data Grid
|
|
1082
|
+
- 🐞 Bugfixes
|
|
1083
|
+
|
|
1084
|
+
### Data Grid
|
|
1085
|
+
|
|
1086
|
+
#### `@mui/x-data-grid@6.18.4`
|
|
1087
|
+
|
|
1088
|
+
- [DataGrid] Fix cell slot style override (#11215) @oliviertassinari
|
|
1089
|
+
- [l10n] Improve Danish (da-DK) locale (#11346) @goibon
|
|
1090
|
+
|
|
1091
|
+
#### `@mui/x-data-grid-pro@6.18.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1092
|
+
|
|
1093
|
+
Same changes as in `@mui/x-data-grid@6.18.4`.
|
|
1094
|
+
|
|
1095
|
+
#### `@mui/x-data-grid-premium@6.18.4` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
1096
|
+
|
|
1097
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.4`.
|
|
1098
|
+
|
|
1099
|
+
### Date Pickers
|
|
1100
|
+
|
|
1101
|
+
#### `@mui/x-date-pickers@6.18.4`
|
|
1102
|
+
|
|
1103
|
+
- [pickers] Fix `MultiSectionDigitalClock` issues (#11308) @LukasTy
|
|
1104
|
+
|
|
1105
|
+
#### `@mui/x-date-pickers-pro@6.18.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1106
|
+
|
|
1107
|
+
Same changes as in `@mui/x-date-pickers@6.18.4`.
|
|
1108
|
+
|
|
1109
|
+
### Docs
|
|
1110
|
+
|
|
1111
|
+
- [docs] Fix typo (#11323) @cadam11
|
|
1112
|
+
- [docs] Add FAQ page (#11347) @noraleonte
|
|
1113
|
+
|
|
869
1114
|
## 6.18.3
|
|
870
1115
|
|
|
871
1116
|
_Dec 4, 2023_
|
|
@@ -354,6 +354,11 @@ DataGridProRaw.propTypes = {
|
|
|
354
354
|
* The grouping column used by the tree data.
|
|
355
355
|
*/
|
|
356
356
|
groupingColDef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
357
|
+
/**
|
|
358
|
+
* If `true`, enables the data grid filtering on header feature.
|
|
359
|
+
* @default false
|
|
360
|
+
*/
|
|
361
|
+
headerFilters: PropTypes.bool,
|
|
357
362
|
/**
|
|
358
363
|
* If `true`, the footer component is hidden.
|
|
359
364
|
* @default false
|
|
@@ -888,10 +893,5 @@ DataGridProRaw.propTypes = {
|
|
|
888
893
|
* If `true`, the rows will be gathered in a tree structure according to the `getTreeDataPath` prop.
|
|
889
894
|
* @default false
|
|
890
895
|
*/
|
|
891
|
-
treeData: PropTypes.bool
|
|
892
|
-
/**
|
|
893
|
-
* If `true`, enables the data grid filtering on header feature.
|
|
894
|
-
* @default false
|
|
895
|
-
*/
|
|
896
|
-
unstable_headerFilters: PropTypes.bool
|
|
896
|
+
treeData: PropTypes.bool
|
|
897
897
|
};
|
|
@@ -21,7 +21,7 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
|
|
|
21
21
|
rowReordering: false,
|
|
22
22
|
rowsLoadingMode: 'client',
|
|
23
23
|
getDetailPanelHeight: () => 500,
|
|
24
|
-
|
|
24
|
+
headerFilters: false
|
|
25
25
|
});
|
|
26
26
|
const defaultSlots = DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS;
|
|
27
27
|
export const useDataGridProProps = inProps => {
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
8
8
|
import { gridVisibleColumnFieldsSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
9
|
-
import { useGridPrivateApiContext,
|
|
9
|
+
import { useGridPrivateApiContext, gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector, isNavigationKey } from '@mui/x-data-grid/internals';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
11
|
import { GridHeaderFilterMenuContainer } from './GridHeaderFilterMenuContainer';
|
|
12
12
|
import { GridHeaderFilterClearButton } from './GridHeaderFilterClearButton';
|
|
@@ -51,8 +51,8 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
51
51
|
const handleRef = useForkRef(ref, cellRef);
|
|
52
52
|
const inputRef = React.useRef(null);
|
|
53
53
|
const buttonRef = React.useRef(null);
|
|
54
|
-
const isEditing =
|
|
55
|
-
const isMenuOpen =
|
|
54
|
+
const isEditing = gridHeaderFilteringEditFieldSelector(apiRef) === colDef.field;
|
|
55
|
+
const isMenuOpen = gridHeaderFilteringMenuSelector(apiRef) === colDef.field;
|
|
56
56
|
const currentOperator = filterOperators[0];
|
|
57
57
|
const InputComponent = colDef.filterable ? currentOperator.InputComponent : null;
|
|
58
58
|
const applyFilterChanges = React.useCallback(updatedItem => {
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useGridApiContext } from '@mui/x-data-grid';
|
|
7
7
|
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { gridHeaderFilteringMenuSelector } from '@mui/x-data-grid/internals';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -28,7 +28,7 @@ function GridHeaderFilterMenuContainer(props) {
|
|
|
28
28
|
const menuId = useId();
|
|
29
29
|
const rootProps = useGridRootProps();
|
|
30
30
|
const apiRef = useGridApiContext();
|
|
31
|
-
const open = Boolean(
|
|
31
|
+
const open = Boolean(gridHeaderFilteringMenuSelector(apiRef) === field && headerFilterMenuRef.current);
|
|
32
32
|
const handleClick = event => {
|
|
33
33
|
headerFilterMenuRef.current = event.currentTarget;
|
|
34
34
|
apiRef.current.showHeaderFilterMenu(field);
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["getColumnsToRender", "getRootProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, gridTabIndexColumnHeaderFilterSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
6
6
|
import { styled } from '@mui/system';
|
|
7
7
|
import { useGridColumnHeaders as useGridColumnHeadersCommunity, getTotalHeaderHeight, useGridPrivateApiContext, getGridFilter } from '@mui/x-data-grid/internals';
|
|
8
8
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -33,7 +33,7 @@ export const useGridColumnHeaders = props => {
|
|
|
33
33
|
headerGroupingMaxDepth,
|
|
34
34
|
hasOtherElementInTabSequence
|
|
35
35
|
} = props;
|
|
36
|
-
const columnHeaderFilterTabIndexState = useGridSelector(apiRef,
|
|
36
|
+
const columnHeaderFilterTabIndexState = useGridSelector(apiRef, gridTabIndexColumnHeaderFilterSelector);
|
|
37
37
|
const _useGridColumnHeaders = useGridColumnHeadersCommunity(_extends({}, props, {
|
|
38
38
|
hasOtherElementInTabSequence: hasOtherElementInTabSequence || columnHeaderFilterTabIndexState !== null
|
|
39
39
|
})),
|
|
@@ -49,11 +49,11 @@ export const useGridColumnHeaders = props => {
|
|
|
49
49
|
const headerFilterMenuRef = React.useRef(null);
|
|
50
50
|
const rootProps = useGridRootProps();
|
|
51
51
|
const classes = useUtilityClasses(rootProps);
|
|
52
|
-
const disableHeaderFiltering = !rootProps.
|
|
52
|
+
const disableHeaderFiltering = !rootProps.headerFilters;
|
|
53
53
|
const headerHeight = Math.floor(rootProps.columnHeaderHeight * props.densityFactor);
|
|
54
54
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
55
55
|
const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight) + (disableHeaderFiltering ? 0 : headerHeight);
|
|
56
|
-
const columnHeaderFilterFocus = useGridSelector(apiRef,
|
|
56
|
+
const columnHeaderFilterFocus = useGridSelector(apiRef, gridFocusColumnHeaderFilterSelector);
|
|
57
57
|
const getFilterItem = React.useCallback(colDef => {
|
|
58
58
|
const filterModelItem = filterModel == null ? void 0 : filterModel.items.find(it => it.field === colDef.field && it.operator !== 'isAnyOf');
|
|
59
59
|
if (filterModelItem != null) {
|
|
@@ -6,8 +6,8 @@ import { gridDetailPanelExpandedRowIdsSelector } from './gridDetailPanelSelector
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export const GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
8
8
|
export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
9
|
+
type: 'custom',
|
|
9
10
|
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
10
|
-
type: 'detailPanelToggle',
|
|
11
11
|
editable: false,
|
|
12
12
|
sortable: false,
|
|
13
13
|
filterable: false,
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
3
3
|
import { renderRowReorderCell } from '../../../components/GridRowReorderCell';
|
|
4
4
|
export const GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
5
|
+
type: 'custom',
|
|
5
6
|
field: '__reorder__',
|
|
6
|
-
type: 'reorder',
|
|
7
7
|
sortable: false,
|
|
8
8
|
filterable: false,
|
|
9
9
|
width: 50,
|
|
@@ -5,7 +5,7 @@ import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
|
5
5
|
* TODO: Add sorting and filtering on the value and the filteredDescendantCount
|
|
6
6
|
*/
|
|
7
7
|
export const GRID_TREE_DATA_GROUPING_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
8
|
-
type: '
|
|
8
|
+
type: 'custom',
|
|
9
9
|
sortable: false,
|
|
10
10
|
filterable: false,
|
|
11
11
|
disableColumnMenu: true,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useGridApiEventHandler } from '@mui/x-data-grid';
|
|
3
|
+
import { GRID_TREE_DATA_GROUPING_FIELD } from './gridTreeDataGroupColDef';
|
|
3
4
|
export const useGridTreeData = apiRef => {
|
|
4
5
|
/**
|
|
5
6
|
* EVENTS
|
|
6
7
|
*/
|
|
7
8
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
8
9
|
const cellParams = apiRef.current.getCellParams(params.id, params.field);
|
|
9
|
-
if (cellParams.colDef.
|
|
10
|
+
if (cellParams.colDef.field === GRID_TREE_DATA_GROUPING_FIELD && event.key === ' ' && !event.shiftKey) {
|
|
10
11
|
if (params.rowNode.type !== 'group') {
|
|
11
12
|
return;
|
|
12
13
|
}
|
package/index.js
CHANGED
|
@@ -354,6 +354,11 @@ DataGridProRaw.propTypes = {
|
|
|
354
354
|
* The grouping column used by the tree data.
|
|
355
355
|
*/
|
|
356
356
|
groupingColDef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
357
|
+
/**
|
|
358
|
+
* If `true`, enables the data grid filtering on header feature.
|
|
359
|
+
* @default false
|
|
360
|
+
*/
|
|
361
|
+
headerFilters: PropTypes.bool,
|
|
357
362
|
/**
|
|
358
363
|
* If `true`, the footer component is hidden.
|
|
359
364
|
* @default false
|
|
@@ -888,10 +893,5 @@ DataGridProRaw.propTypes = {
|
|
|
888
893
|
* If `true`, the rows will be gathered in a tree structure according to the `getTreeDataPath` prop.
|
|
889
894
|
* @default false
|
|
890
895
|
*/
|
|
891
|
-
treeData: PropTypes.bool
|
|
892
|
-
/**
|
|
893
|
-
* If `true`, enables the data grid filtering on header feature.
|
|
894
|
-
* @default false
|
|
895
|
-
*/
|
|
896
|
-
unstable_headerFilters: PropTypes.bool
|
|
896
|
+
treeData: PropTypes.bool
|
|
897
897
|
};
|
|
@@ -23,7 +23,7 @@ export var DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_DEF
|
|
|
23
23
|
getDetailPanelHeight: function getDetailPanelHeight() {
|
|
24
24
|
return 500;
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
headerFilters: false
|
|
27
27
|
});
|
|
28
28
|
var defaultSlots = DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS;
|
|
29
29
|
export var useDataGridProProps = function useDataGridProProps(inProps) {
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
9
9
|
import { gridVisibleColumnFieldsSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
10
|
-
import { useGridPrivateApiContext,
|
|
10
|
+
import { useGridPrivateApiContext, gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector, isNavigationKey } from '@mui/x-data-grid/internals';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridHeaderFilterMenuContainer } from './GridHeaderFilterMenuContainer';
|
|
13
13
|
import { GridHeaderFilterClearButton } from './GridHeaderFilterClearButton';
|
|
@@ -47,8 +47,8 @@ var GridHeaderFilterCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
47
47
|
var handleRef = useForkRef(ref, cellRef);
|
|
48
48
|
var inputRef = React.useRef(null);
|
|
49
49
|
var buttonRef = React.useRef(null);
|
|
50
|
-
var isEditing =
|
|
51
|
-
var isMenuOpen =
|
|
50
|
+
var isEditing = gridHeaderFilteringEditFieldSelector(apiRef) === colDef.field;
|
|
51
|
+
var isMenuOpen = gridHeaderFilteringMenuSelector(apiRef) === colDef.field;
|
|
52
52
|
var currentOperator = filterOperators[0];
|
|
53
53
|
var InputComponent = colDef.filterable ? currentOperator.InputComponent : null;
|
|
54
54
|
var applyFilterChanges = React.useCallback(function (updatedItem) {
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useGridApiContext } from '@mui/x-data-grid';
|
|
7
7
|
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { gridHeaderFilteringMenuSelector } from '@mui/x-data-grid/internals';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -26,7 +26,7 @@ function GridHeaderFilterMenuContainer(props) {
|
|
|
26
26
|
var menuId = useId();
|
|
27
27
|
var rootProps = useGridRootProps();
|
|
28
28
|
var apiRef = useGridApiContext();
|
|
29
|
-
var open = Boolean(
|
|
29
|
+
var open = Boolean(gridHeaderFilteringMenuSelector(apiRef) === field && headerFilterMenuRef.current);
|
|
30
30
|
var handleClick = function handleClick(event) {
|
|
31
31
|
headerFilterMenuRef.current = event.currentTarget;
|
|
32
32
|
apiRef.current.showHeaderFilterMenu(field);
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["getColumnsToRender", "getRootProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, gridTabIndexColumnHeaderFilterSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
6
6
|
import { styled } from '@mui/system';
|
|
7
7
|
import { useGridColumnHeaders as useGridColumnHeadersCommunity, getTotalHeaderHeight, useGridPrivateApiContext, getGridFilter } from '@mui/x-data-grid/internals';
|
|
8
8
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -33,7 +33,7 @@ export var useGridColumnHeaders = function useGridColumnHeaders(props) {
|
|
|
33
33
|
var apiRef = useGridPrivateApiContext();
|
|
34
34
|
var headerGroupingMaxDepth = props.headerGroupingMaxDepth,
|
|
35
35
|
hasOtherElementInTabSequence = props.hasOtherElementInTabSequence;
|
|
36
|
-
var columnHeaderFilterTabIndexState = useGridSelector(apiRef,
|
|
36
|
+
var columnHeaderFilterTabIndexState = useGridSelector(apiRef, gridTabIndexColumnHeaderFilterSelector);
|
|
37
37
|
var _useGridColumnHeaders = useGridColumnHeadersCommunity(_extends({}, props, {
|
|
38
38
|
hasOtherElementInTabSequence: hasOtherElementInTabSequence || columnHeaderFilterTabIndexState !== null
|
|
39
39
|
})),
|
|
@@ -47,11 +47,11 @@ export var useGridColumnHeaders = function useGridColumnHeaders(props) {
|
|
|
47
47
|
var headerFilterMenuRef = React.useRef(null);
|
|
48
48
|
var rootProps = useGridRootProps();
|
|
49
49
|
var classes = useUtilityClasses(rootProps);
|
|
50
|
-
var disableHeaderFiltering = !rootProps.
|
|
50
|
+
var disableHeaderFiltering = !rootProps.headerFilters;
|
|
51
51
|
var headerHeight = Math.floor(rootProps.columnHeaderHeight * props.densityFactor);
|
|
52
52
|
var filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
53
53
|
var totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight) + (disableHeaderFiltering ? 0 : headerHeight);
|
|
54
|
-
var columnHeaderFilterFocus = useGridSelector(apiRef,
|
|
54
|
+
var columnHeaderFilterFocus = useGridSelector(apiRef, gridFocusColumnHeaderFilterSelector);
|
|
55
55
|
var getFilterItem = React.useCallback(function (colDef) {
|
|
56
56
|
var filterModelItem = filterModel == null ? void 0 : filterModel.items.find(function (it) {
|
|
57
57
|
return it.field === colDef.field && it.operator !== 'isAnyOf';
|
|
@@ -6,8 +6,8 @@ import { gridDetailPanelExpandedRowIdsSelector } from './gridDetailPanelSelector
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export var GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
8
8
|
export var GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
9
|
+
type: 'custom',
|
|
9
10
|
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
10
|
-
type: 'detailPanelToggle',
|
|
11
11
|
editable: false,
|
|
12
12
|
sortable: false,
|
|
13
13
|
filterable: false,
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
3
3
|
import { renderRowReorderCell } from '../../../components/GridRowReorderCell';
|
|
4
4
|
export var GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
5
|
+
type: 'custom',
|
|
5
6
|
field: '__reorder__',
|
|
6
|
-
type: 'reorder',
|
|
7
7
|
sortable: false,
|
|
8
8
|
filterable: false,
|
|
9
9
|
width: 50,
|
|
@@ -5,7 +5,7 @@ import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
|
5
5
|
* TODO: Add sorting and filtering on the value and the filteredDescendantCount
|
|
6
6
|
*/
|
|
7
7
|
export var GRID_TREE_DATA_GROUPING_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
8
|
-
type: '
|
|
8
|
+
type: 'custom',
|
|
9
9
|
sortable: false,
|
|
10
10
|
filterable: false,
|
|
11
11
|
disableColumnMenu: true,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useGridApiEventHandler } from '@mui/x-data-grid';
|
|
3
|
+
import { GRID_TREE_DATA_GROUPING_FIELD } from './gridTreeDataGroupColDef';
|
|
3
4
|
export var useGridTreeData = function useGridTreeData(apiRef) {
|
|
4
5
|
/**
|
|
5
6
|
* EVENTS
|
|
6
7
|
*/
|
|
7
8
|
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
8
9
|
var cellParams = apiRef.current.getCellParams(params.id, params.field);
|
|
9
|
-
if (cellParams.colDef.
|
|
10
|
+
if (cellParams.colDef.field === GRID_TREE_DATA_GROUPING_FIELD && event.key === ' ' && !event.shiftKey) {
|
|
10
11
|
if (params.rowNode.type !== 'group') {
|
|
11
12
|
return;
|
|
12
13
|
}
|
package/legacy/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export var getReleaseInfo = function getReleaseInfo() {
|
|
3
|
-
var releaseInfo = "
|
|
3
|
+
var releaseInfo = "MTcwMjQ5NDAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -118,7 +118,7 @@ export interface DataGridProPropsWithDefaultValue extends DataGridPropsWithDefau
|
|
|
118
118
|
* If `true`, enables the data grid filtering on header feature.
|
|
119
119
|
* @default false
|
|
120
120
|
*/
|
|
121
|
-
|
|
121
|
+
headerFilters: boolean;
|
|
122
122
|
}
|
|
123
123
|
export interface DataGridProPropsWithoutDefaultValue<R extends GridValidRowModel = any> extends Omit<DataGridPropsWithoutDefaultValue<R>, 'initialState' | 'componentsProps' | 'slotProps'> {
|
|
124
124
|
/**
|
|
@@ -354,6 +354,11 @@ DataGridProRaw.propTypes = {
|
|
|
354
354
|
* The grouping column used by the tree data.
|
|
355
355
|
*/
|
|
356
356
|
groupingColDef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
357
|
+
/**
|
|
358
|
+
* If `true`, enables the data grid filtering on header feature.
|
|
359
|
+
* @default false
|
|
360
|
+
*/
|
|
361
|
+
headerFilters: PropTypes.bool,
|
|
357
362
|
/**
|
|
358
363
|
* If `true`, the footer component is hidden.
|
|
359
364
|
* @default false
|
|
@@ -888,10 +893,5 @@ DataGridProRaw.propTypes = {
|
|
|
888
893
|
* If `true`, the rows will be gathered in a tree structure according to the `getTreeDataPath` prop.
|
|
889
894
|
* @default false
|
|
890
895
|
*/
|
|
891
|
-
treeData: PropTypes.bool
|
|
892
|
-
/**
|
|
893
|
-
* If `true`, enables the data grid filtering on header feature.
|
|
894
|
-
* @default false
|
|
895
|
-
*/
|
|
896
|
-
unstable_headerFilters: PropTypes.bool
|
|
896
|
+
treeData: PropTypes.bool
|
|
897
897
|
};
|
|
@@ -21,7 +21,7 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
|
|
|
21
21
|
rowReordering: false,
|
|
22
22
|
rowsLoadingMode: 'client',
|
|
23
23
|
getDetailPanelHeight: () => 500,
|
|
24
|
-
|
|
24
|
+
headerFilters: false
|
|
25
25
|
});
|
|
26
26
|
const defaultSlots = DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS;
|
|
27
27
|
export const useDataGridProProps = inProps => {
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
8
8
|
import { gridVisibleColumnFieldsSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
9
|
-
import { useGridPrivateApiContext,
|
|
9
|
+
import { useGridPrivateApiContext, gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector, isNavigationKey } from '@mui/x-data-grid/internals';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
11
|
import { GridHeaderFilterMenuContainer } from './GridHeaderFilterMenuContainer';
|
|
12
12
|
import { GridHeaderFilterClearButton } from './GridHeaderFilterClearButton';
|
|
@@ -50,8 +50,8 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
50
50
|
const handleRef = useForkRef(ref, cellRef);
|
|
51
51
|
const inputRef = React.useRef(null);
|
|
52
52
|
const buttonRef = React.useRef(null);
|
|
53
|
-
const isEditing =
|
|
54
|
-
const isMenuOpen =
|
|
53
|
+
const isEditing = gridHeaderFilteringEditFieldSelector(apiRef) === colDef.field;
|
|
54
|
+
const isMenuOpen = gridHeaderFilteringMenuSelector(apiRef) === colDef.field;
|
|
55
55
|
const currentOperator = filterOperators[0];
|
|
56
56
|
const InputComponent = colDef.filterable ? currentOperator.InputComponent : null;
|
|
57
57
|
const applyFilterChanges = React.useCallback(updatedItem => {
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useGridApiContext } from '@mui/x-data-grid';
|
|
7
7
|
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { gridHeaderFilteringMenuSelector } from '@mui/x-data-grid/internals';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -27,7 +27,7 @@ function GridHeaderFilterMenuContainer(props) {
|
|
|
27
27
|
const menuId = useId();
|
|
28
28
|
const rootProps = useGridRootProps();
|
|
29
29
|
const apiRef = useGridApiContext();
|
|
30
|
-
const open = Boolean(
|
|
30
|
+
const open = Boolean(gridHeaderFilteringMenuSelector(apiRef) === field && headerFilterMenuRef.current);
|
|
31
31
|
const handleClick = event => {
|
|
32
32
|
headerFilterMenuRef.current = event.currentTarget;
|
|
33
33
|
apiRef.current.showHeaderFilterMenu(field);
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["getColumnsToRender", "getRootProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, gridTabIndexColumnHeaderFilterSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
6
6
|
import { styled } from '@mui/system';
|
|
7
7
|
import { useGridColumnHeaders as useGridColumnHeadersCommunity, getTotalHeaderHeight, useGridPrivateApiContext, getGridFilter } from '@mui/x-data-grid/internals';
|
|
8
8
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -33,7 +33,7 @@ export const useGridColumnHeaders = props => {
|
|
|
33
33
|
headerGroupingMaxDepth,
|
|
34
34
|
hasOtherElementInTabSequence
|
|
35
35
|
} = props;
|
|
36
|
-
const columnHeaderFilterTabIndexState = useGridSelector(apiRef,
|
|
36
|
+
const columnHeaderFilterTabIndexState = useGridSelector(apiRef, gridTabIndexColumnHeaderFilterSelector);
|
|
37
37
|
const _useGridColumnHeaders = useGridColumnHeadersCommunity(_extends({}, props, {
|
|
38
38
|
hasOtherElementInTabSequence: hasOtherElementInTabSequence || columnHeaderFilterTabIndexState !== null
|
|
39
39
|
})),
|
|
@@ -49,11 +49,11 @@ export const useGridColumnHeaders = props => {
|
|
|
49
49
|
const headerFilterMenuRef = React.useRef(null);
|
|
50
50
|
const rootProps = useGridRootProps();
|
|
51
51
|
const classes = useUtilityClasses(rootProps);
|
|
52
|
-
const disableHeaderFiltering = !rootProps.
|
|
52
|
+
const disableHeaderFiltering = !rootProps.headerFilters;
|
|
53
53
|
const headerHeight = Math.floor(rootProps.columnHeaderHeight * props.densityFactor);
|
|
54
54
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
55
55
|
const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight) + (disableHeaderFiltering ? 0 : headerHeight);
|
|
56
|
-
const columnHeaderFilterFocus = useGridSelector(apiRef,
|
|
56
|
+
const columnHeaderFilterFocus = useGridSelector(apiRef, gridFocusColumnHeaderFilterSelector);
|
|
57
57
|
const getFilterItem = React.useCallback(colDef => {
|
|
58
58
|
const filterModelItem = filterModel?.items.find(it => it.field === colDef.field && it.operator !== 'isAnyOf');
|
|
59
59
|
if (filterModelItem != null) {
|
|
@@ -6,8 +6,8 @@ import { gridDetailPanelExpandedRowIdsSelector } from './gridDetailPanelSelector
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export const GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
8
8
|
export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
9
|
+
type: 'custom',
|
|
9
10
|
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
10
|
-
type: 'detailPanelToggle',
|
|
11
11
|
editable: false,
|
|
12
12
|
sortable: false,
|
|
13
13
|
filterable: false,
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
3
3
|
import { renderRowReorderCell } from '../../../components/GridRowReorderCell';
|
|
4
4
|
export const GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
5
|
+
type: 'custom',
|
|
5
6
|
field: '__reorder__',
|
|
6
|
-
type: 'reorder',
|
|
7
7
|
sortable: false,
|
|
8
8
|
filterable: false,
|
|
9
9
|
width: 50,
|
|
@@ -5,7 +5,7 @@ import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
|
5
5
|
* TODO: Add sorting and filtering on the value and the filteredDescendantCount
|
|
6
6
|
*/
|
|
7
7
|
export const GRID_TREE_DATA_GROUPING_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
8
|
-
type: '
|
|
8
|
+
type: 'custom',
|
|
9
9
|
sortable: false,
|
|
10
10
|
filterable: false,
|
|
11
11
|
disableColumnMenu: true,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useGridApiEventHandler } from '@mui/x-data-grid';
|
|
3
|
+
import { GRID_TREE_DATA_GROUPING_FIELD } from './gridTreeDataGroupColDef';
|
|
3
4
|
export const useGridTreeData = apiRef => {
|
|
4
5
|
/**
|
|
5
6
|
* EVENTS
|
|
6
7
|
*/
|
|
7
8
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
8
9
|
const cellParams = apiRef.current.getCellParams(params.id, params.field);
|
|
9
|
-
if (cellParams.colDef.
|
|
10
|
+
if (cellParams.colDef.field === GRID_TREE_DATA_GROUPING_FIELD && event.key === ' ' && !event.shiftKey) {
|
|
10
11
|
if (params.rowNode.type !== 'group') {
|
|
11
12
|
return;
|
|
12
13
|
}
|
package/modern/index.js
CHANGED
package/modern/utils/domUtils.js
CHANGED
|
@@ -25,7 +25,6 @@ export function findGridCellElementsFromCol(col, api) {
|
|
|
25
25
|
}
|
|
26
26
|
const renderedRowElements = api.virtualScrollerRef?.current.querySelectorAll(`:scope > div > div > .${gridClasses.row}` // Use > to ignore rows from nested data grids (e.g. in detail panel)
|
|
27
27
|
);
|
|
28
|
-
|
|
29
28
|
renderedRowElements.forEach(rowElement => {
|
|
30
29
|
const rowId = rowElement.getAttribute('data-id');
|
|
31
30
|
if (!rowId) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcwMjQ5NDAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -362,6 +362,11 @@ DataGridProRaw.propTypes = {
|
|
|
362
362
|
* The grouping column used by the tree data.
|
|
363
363
|
*/
|
|
364
364
|
groupingColDef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
365
|
+
/**
|
|
366
|
+
* If `true`, enables the data grid filtering on header feature.
|
|
367
|
+
* @default false
|
|
368
|
+
*/
|
|
369
|
+
headerFilters: _propTypes.default.bool,
|
|
365
370
|
/**
|
|
366
371
|
* If `true`, the footer component is hidden.
|
|
367
372
|
* @default false
|
|
@@ -896,10 +901,5 @@ DataGridProRaw.propTypes = {
|
|
|
896
901
|
* If `true`, the rows will be gathered in a tree structure according to the `getTreeDataPath` prop.
|
|
897
902
|
* @default false
|
|
898
903
|
*/
|
|
899
|
-
treeData: _propTypes.default.bool
|
|
900
|
-
/**
|
|
901
|
-
* If `true`, enables the data grid filtering on header feature.
|
|
902
|
-
* @default false
|
|
903
|
-
*/
|
|
904
|
-
unstable_headerFilters: _propTypes.default.bool
|
|
904
|
+
treeData: _propTypes.default.bool
|
|
905
905
|
};
|
|
@@ -29,7 +29,7 @@ const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PRO_PROPS_DEFAULT_V
|
|
|
29
29
|
rowReordering: false,
|
|
30
30
|
rowsLoadingMode: 'client',
|
|
31
31
|
getDetailPanelHeight: () => 500,
|
|
32
|
-
|
|
32
|
+
headerFilters: false
|
|
33
33
|
});
|
|
34
34
|
const defaultSlots = _dataGridProDefaultSlotsComponents.DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS;
|
|
35
35
|
const useDataGridProProps = inProps => {
|
|
@@ -58,8 +58,8 @@ const GridHeaderFilterCell = exports.GridHeaderFilterCell = /*#__PURE__*/React.f
|
|
|
58
58
|
const handleRef = (0, _utils.unstable_useForkRef)(ref, cellRef);
|
|
59
59
|
const inputRef = React.useRef(null);
|
|
60
60
|
const buttonRef = React.useRef(null);
|
|
61
|
-
const isEditing = (0, _internals.
|
|
62
|
-
const isMenuOpen = (0, _internals.
|
|
61
|
+
const isEditing = (0, _internals.gridHeaderFilteringEditFieldSelector)(apiRef) === colDef.field;
|
|
62
|
+
const isMenuOpen = (0, _internals.gridHeaderFilteringMenuSelector)(apiRef) === colDef.field;
|
|
63
63
|
const currentOperator = filterOperators[0];
|
|
64
64
|
const InputComponent = colDef.filterable ? currentOperator.InputComponent : null;
|
|
65
65
|
const applyFilterChanges = React.useCallback(updatedItem => {
|
|
@@ -35,7 +35,7 @@ function GridHeaderFilterMenuContainer(props) {
|
|
|
35
35
|
const menuId = (0, _utils.unstable_useId)();
|
|
36
36
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
37
37
|
const apiRef = (0, _xDataGrid.useGridApiContext)();
|
|
38
|
-
const open = Boolean((0, _internals.
|
|
38
|
+
const open = Boolean((0, _internals.gridHeaderFilteringMenuSelector)(apiRef) === field && headerFilterMenuRef.current);
|
|
39
39
|
const handleClick = event => {
|
|
40
40
|
headerFilterMenuRef.current = event.currentTarget;
|
|
41
41
|
apiRef.current.showHeaderFilterMenu(field);
|
|
@@ -42,7 +42,7 @@ const useGridColumnHeaders = props => {
|
|
|
42
42
|
headerGroupingMaxDepth,
|
|
43
43
|
hasOtherElementInTabSequence
|
|
44
44
|
} = props;
|
|
45
|
-
const columnHeaderFilterTabIndexState = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.
|
|
45
|
+
const columnHeaderFilterTabIndexState = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridTabIndexColumnHeaderFilterSelector);
|
|
46
46
|
const _useGridColumnHeaders = (0, _internals.useGridColumnHeaders)((0, _extends2.default)({}, props, {
|
|
47
47
|
hasOtherElementInTabSequence: hasOtherElementInTabSequence || columnHeaderFilterTabIndexState !== null
|
|
48
48
|
})),
|
|
@@ -58,11 +58,11 @@ const useGridColumnHeaders = props => {
|
|
|
58
58
|
const headerFilterMenuRef = React.useRef(null);
|
|
59
59
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
60
60
|
const classes = useUtilityClasses(rootProps);
|
|
61
|
-
const disableHeaderFiltering = !rootProps.
|
|
61
|
+
const disableHeaderFiltering = !rootProps.headerFilters;
|
|
62
62
|
const headerHeight = Math.floor(rootProps.columnHeaderHeight * props.densityFactor);
|
|
63
63
|
const filterModel = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridFilterModelSelector);
|
|
64
64
|
const totalHeaderHeight = (0, _internals.getTotalHeaderHeight)(apiRef, rootProps.columnHeaderHeight) + (disableHeaderFiltering ? 0 : headerHeight);
|
|
65
|
-
const columnHeaderFilterFocus = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.
|
|
65
|
+
const columnHeaderFilterFocus = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridFocusColumnHeaderFilterSelector);
|
|
66
66
|
const getFilterItem = React.useCallback(colDef => {
|
|
67
67
|
const filterModelItem = filterModel?.items.find(it => it.field === colDef.field && it.operator !== 'isAnyOf');
|
|
68
68
|
if (filterModelItem != null) {
|
|
@@ -15,8 +15,8 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
const GRID_DETAIL_PANEL_TOGGLE_FIELD = exports.GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
17
17
|
const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = exports.GRID_DETAIL_PANEL_TOGGLE_COL_DEF = (0, _extends2.default)({}, _xDataGrid.GRID_STRING_COL_DEF, {
|
|
18
|
+
type: 'custom',
|
|
18
19
|
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
19
|
-
type: 'detailPanelToggle',
|
|
20
20
|
editable: false,
|
|
21
21
|
sortable: false,
|
|
22
22
|
filterable: false,
|
|
@@ -9,8 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
10
10
|
var _GridRowReorderCell = require("../../../components/GridRowReorderCell");
|
|
11
11
|
const GRID_REORDER_COL_DEF = exports.GRID_REORDER_COL_DEF = (0, _extends2.default)({}, _xDataGrid.GRID_STRING_COL_DEF, {
|
|
12
|
+
type: 'custom',
|
|
12
13
|
field: '__reorder__',
|
|
13
|
-
type: 'reorder',
|
|
14
14
|
sortable: false,
|
|
15
15
|
filterable: false,
|
|
16
16
|
width: 50,
|
|
@@ -11,7 +11,7 @@ var _xDataGrid = require("@mui/x-data-grid");
|
|
|
11
11
|
* TODO: Add sorting and filtering on the value and the filteredDescendantCount
|
|
12
12
|
*/
|
|
13
13
|
const GRID_TREE_DATA_GROUPING_COL_DEF = exports.GRID_TREE_DATA_GROUPING_COL_DEF = (0, _extends2.default)({}, _xDataGrid.GRID_STRING_COL_DEF, {
|
|
14
|
-
type: '
|
|
14
|
+
type: 'custom',
|
|
15
15
|
sortable: false,
|
|
16
16
|
filterable: false,
|
|
17
17
|
disableColumnMenu: true,
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useGridTreeData = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
9
|
+
var _gridTreeDataGroupColDef = require("./gridTreeDataGroupColDef");
|
|
9
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
11
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
12
|
const useGridTreeData = apiRef => {
|
|
@@ -14,7 +15,7 @@ const useGridTreeData = apiRef => {
|
|
|
14
15
|
*/
|
|
15
16
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
16
17
|
const cellParams = apiRef.current.getCellParams(params.id, params.field);
|
|
17
|
-
if (cellParams.colDef.
|
|
18
|
+
if (cellParams.colDef.field === _gridTreeDataGroupColDef.GRID_TREE_DATA_GROUPING_FIELD && event.key === ' ' && !event.shiftKey) {
|
|
18
19
|
if (params.rowNode.type !== 'group') {
|
|
19
20
|
return;
|
|
20
21
|
}
|
package/node/index.js
CHANGED
package/node/utils/domUtils.js
CHANGED
|
@@ -36,7 +36,6 @@ function findGridCellElementsFromCol(col, api) {
|
|
|
36
36
|
}
|
|
37
37
|
const renderedRowElements = api.virtualScrollerRef?.current.querySelectorAll(`:scope > div > div > .${_xDataGrid.gridClasses.row}` // Use > to ignore rows from nested data grids (e.g. in detail panel)
|
|
38
38
|
);
|
|
39
|
-
|
|
40
39
|
renderedRowElements.forEach(rowElement => {
|
|
41
40
|
const rowId = rowElement.getAttribute('data-id');
|
|
42
41
|
if (!rowId) {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getReleaseInfo = void 0;
|
|
7
7
|
var _utils = require("@mui/utils");
|
|
8
8
|
const getReleaseInfo = () => {
|
|
9
|
-
const releaseInfo = "
|
|
9
|
+
const releaseInfo = "MTcwMjQ5NDAwMDAwMA==";
|
|
10
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
11
11
|
// A simple hack to set the value in the test environment (has no build step).
|
|
12
12
|
// eslint-disable-next-line no-useless-concat
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-pro",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.5",
|
|
4
4
|
"description": "The Pro plan edition of the data grid component (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"directory": "packages/grid/x-data-grid-pro"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@babel/runtime": "^7.23.
|
|
36
|
-
"@mui/system": "^5.14.
|
|
37
|
-
"@mui/utils": "^5.14.
|
|
38
|
-
"@mui/x-data-grid": "7.0.0-alpha.
|
|
35
|
+
"@babel/runtime": "^7.23.5",
|
|
36
|
+
"@mui/system": "^5.14.20",
|
|
37
|
+
"@mui/utils": "^5.14.20",
|
|
38
|
+
"@mui/x-data-grid": "7.0.0-alpha.5",
|
|
39
39
|
"@mui/x-license-pro": "7.0.0-alpha.1",
|
|
40
40
|
"@types/format-util": "^1.0.4",
|
|
41
41
|
"clsx": "^2.0.0",
|
package/utils/domUtils.js
CHANGED
|
@@ -27,7 +27,6 @@ export function findGridCellElementsFromCol(col, api) {
|
|
|
27
27
|
}
|
|
28
28
|
const renderedRowElements = (_api$virtualScrollerR2 = api.virtualScrollerRef) == null ? void 0 : _api$virtualScrollerR2.current.querySelectorAll(`:scope > div > div > .${gridClasses.row}` // Use > to ignore rows from nested data grids (e.g. in detail panel)
|
|
29
29
|
);
|
|
30
|
-
|
|
31
30
|
renderedRowElements.forEach(rowElement => {
|
|
32
31
|
const rowId = rowElement.getAttribute('data-id');
|
|
33
32
|
if (!rowId) {
|
package/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcwMjQ5NDAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|