@mui/x-data-grid-premium 5.11.1 → 5.12.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/CHANGELOG.md +199 -20
- package/DataGridPremium/DataGridPremium.js +26 -2
- package/DataGridPremium/useDataGridPremiumComponent.js +1 -2
- package/README.md +2 -2
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +6 -5
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
- package/hooks/features/rowGrouping/useGridRowGrouping.js +9 -11
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +3 -29
- package/index.d.ts +0 -1
- package/index.js +1 -2
- package/legacy/DataGridPremium/DataGridPremium.js +26 -2
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +1 -2
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +9 -13
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +3 -33
- package/legacy/index.js +1 -2
- package/legacy/typeOverloads/index.js +2 -1
- package/legacy/typeOverloads/modules.js +1 -33
- package/legacy/utils/releaseInfo.js +1 -1
- package/modern/DataGridPremium/DataGridPremium.js +26 -2
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +1 -2
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +14 -14
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +3 -29
- package/modern/index.js +1 -2
- package/modern/typeOverloads/index.js +2 -1
- package/modern/typeOverloads/modules.js +1 -33
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +26 -2
- package/node/DataGridPremium/useDataGridPremiumComponent.js +0 -1
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +8 -10
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -28
- package/node/index.js +1 -3
- package/node/typeOverloads/index.js +3 -1
- package/node/typeOverloads/modules.js +5 -34
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +11 -10
- package/typeOverloads/index.d.ts +1 -0
- package/typeOverloads/index.js +2 -1
- package/typeOverloads/modules.d.ts +34 -0
- package/typeOverloads/modules.js +1 -33
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,187 @@
|
|
|
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
|
+
## v5.12.2
|
|
7
|
+
|
|
8
|
+
_Jun 16, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 Performance improvement for dynamic row height (#5135) @m4theushw
|
|
13
|
+
- 🕒 Add demo of how to use the data grid with date pickers (#5053) @cherniavskii
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
### `@mui/x-data-grid@v5.12.2` / `@mui/x-data-grid-pro@v5.12.2` / `@mui/x-data-grid-premium@v5.12.2`
|
|
18
|
+
|
|
19
|
+
#### Changes
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Fix for cosmetic bug on column filter badge (#5170) @simbahandiane
|
|
22
|
+
- [DataGrid] Hide vertical scrollbar if `autoHeight` is enabled (#5164) @m4theushw
|
|
23
|
+
- [DataGrid] Use exponential search to render non-measured rows (#5135) @m4theushw
|
|
24
|
+
- [DataGridPro] Fix label of the detail panel toggle column (#5191) @m4theushw
|
|
25
|
+
- [DataGridPro] Refresh detail panel caches when props change (#5110) @m4theushw
|
|
26
|
+
|
|
27
|
+
### Docs
|
|
28
|
+
|
|
29
|
+
- [docs] Add example with custom checkbox column (#5161) @flaviendelangle
|
|
30
|
+
- [docs] Batch small changes (#5177) @oliviertassinari
|
|
31
|
+
- [docs] Fix demo currency format (#5034) @oliviertassinari
|
|
32
|
+
- [docs] Fix outdated license description to match the EULA (#5219) @joserodolfofreitas
|
|
33
|
+
- [docs] Fix redundant headers (#5104) @oliviertassinari
|
|
34
|
+
- [docs] Fix some capitalization to match the guidelines (#5105) @oliviertassinari
|
|
35
|
+
- [docs] Improve the `getRowId` doc section (#5156) @flaviendelangle
|
|
36
|
+
- [docs] Instruction to deal with invalid license message (#5074) @joserodolfofreitas
|
|
37
|
+
- [docs] Use redirection in the code (#5114) @oliviertassinari
|
|
38
|
+
- [docs] Add demo of how to use the data grid with date pickers (#5053) @cherniavskii
|
|
39
|
+
|
|
40
|
+
### Core
|
|
41
|
+
|
|
42
|
+
- [core] Improve inline code rendering within the details tag (#5166) @Harmouch101
|
|
43
|
+
- [core] Remove unused props from plugin typing (#5185) @flaviendelangle
|
|
44
|
+
- [core] Use the scrollbar size from `useGridDimensions` on `DataGridProColumnHeaders` (#5201) @flaviendelangle
|
|
45
|
+
- [core] Fix `GridColTypeDef` type (#5167) @cherniavskii
|
|
46
|
+
- [core] Fix `GridColTypeDef` usage in demo (#5197) @cherniavskii
|
|
47
|
+
- [test] Add `waitFor` before asserting height (#5203) @m4theushw
|
|
48
|
+
|
|
49
|
+
## v5.12.1
|
|
50
|
+
|
|
51
|
+
_Jun 9, 2022_
|
|
52
|
+
|
|
53
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
54
|
+
|
|
55
|
+
- 🎁 Add `reason` to `onFilterModelChange` (#4938) @m4theushw
|
|
56
|
+
- 🔎 Control quick filter input value via model prop (#5013) @alexfauquette
|
|
57
|
+
- 📚 Documentation improvements
|
|
58
|
+
- 🐞 Bugfixes
|
|
59
|
+
|
|
60
|
+
### `@mui/x-data-grid@v5.12.1` / `@mui/x-data-grid-pro@v5.12.1` / `@mui/x-data-grid-premium@v5.12.1`
|
|
61
|
+
|
|
62
|
+
#### Changes
|
|
63
|
+
|
|
64
|
+
- [DataGrid] Add `reason` to `onFilterModelChange` (#4938) @m4theushw
|
|
65
|
+
- [DataGrid] Restore focus after dismissing the column menu (#5027) @m4theushw
|
|
66
|
+
- [DataGrid] Update quick filter input when model is modified (#5013) @alexfauquette
|
|
67
|
+
- [DataGrid] Fix implicit dependency on react-dom (#5121) @oliviertassinari
|
|
68
|
+
- [DataGrid] Support `getRowId` in row reordering (#5093) @flaviendelangle
|
|
69
|
+
- [DataGridPro] Fix column resizing in RTL mode (#4989) @cherniavskii
|
|
70
|
+
- [DataGridPro] Fix column resizing on touchscreen (#5056) @cherniavskii
|
|
71
|
+
- [l10n] Update Japanese (ja-JP) locale (#5122) @hikotq
|
|
72
|
+
- [l10n] Update Russian (ru-RU) locale (#5069) @Artboomy
|
|
73
|
+
|
|
74
|
+
### `@mui/x-date-pickers@5.0.0-alpha.6` / `@mui/x-date-pickers-pro@5.0.0-alpha.6`
|
|
75
|
+
|
|
76
|
+
#### Changes
|
|
77
|
+
|
|
78
|
+
- [pickers] Fix usage of `maxDate` / `minDate` / `disableFuture` and `disablePast` (#5081) @flaviendelangle
|
|
79
|
+
- [pickers] Infer mask from `inputFormat` (#5060) @alexfauquette
|
|
80
|
+
- [pickers] Manage input value without using the focus (#4486) @alexfauquette
|
|
81
|
+
- [pickers] Use new localization for doc examples (#5097) @flaviendelangle
|
|
82
|
+
- [pickers] Fix `shouldDisableDate` in range pickers (#5123) @flaviendelangle
|
|
83
|
+
- [l10n] Add Brazilian Portuguese (pt-BR) locale (#5100) @jardelnovaes
|
|
84
|
+
- [l10n] Use `localText` for remaining texts (#4986) @alexfauquette
|
|
85
|
+
|
|
86
|
+
### Docs
|
|
87
|
+
|
|
88
|
+
- [docs] Implement the focus management on data grid demo links (#5070) @alexfauquette
|
|
89
|
+
- [docs] Fix `301` link to render cell (#5106) @oliviertassinari
|
|
90
|
+
- [docs] Fix broken anchor link @oliviertassinari
|
|
91
|
+
- [docs] Improve movie dataset (#5142) @flaviendelangle
|
|
92
|
+
- [docs] Move all localization documentation in a unique page (#5072) @alexfauquette
|
|
93
|
+
- [docs] Section for overwriting core components i18n keys (#4998) @DanailH
|
|
94
|
+
- [docs] Small grammar and format fixes for Dynamic Row Height section (#5098) @samuelsycamore
|
|
95
|
+
|
|
96
|
+
### Core
|
|
97
|
+
|
|
98
|
+
- [core] Allows to run tests with different date adapters (#5055) @alexfauquette
|
|
99
|
+
- [core] Prettify the l10n issue (#4928) @alexfauquette
|
|
100
|
+
- [core] Set correct `apiRef` type in row reorder pre processors #5125 @DanailH
|
|
101
|
+
- [core] Stop using `GridEvents` in technical doc (#5157) @flaviendelangle
|
|
102
|
+
- [core] Upgrade monorepo (#5101) @oliviertassinari
|
|
103
|
+
- [test] Fix dynamic row height test failing on Chrome (#5147) @m4theushw
|
|
104
|
+
- [test] Remove delay on server demo for regression tests (#5131) @alexfauquette
|
|
105
|
+
|
|
106
|
+
## v5.12.0
|
|
107
|
+
|
|
108
|
+
_May 31, 2022_
|
|
109
|
+
|
|
110
|
+
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
111
|
+
|
|
112
|
+
- 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
|
|
113
|
+
|
|
114
|
+
<img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
|
|
115
|
+
|
|
116
|
+
- ⚠️ Remove deprecated row grouping feature from `@mui/x-data-grid-pro`
|
|
117
|
+
|
|
118
|
+
Row grouping is available through the `@mui/x-data-grid-premium` package - see [Premium plan release blogpost](https://mui.com/blog/premium-plan-release/).
|
|
119
|
+
|
|
120
|
+
- 🐞 Bug fixes and improvements
|
|
121
|
+
|
|
122
|
+
### `@mui/x-data-grid@v5.12.0` / `@mui/x-data-grid-pro@v5.12.0` / `@mui/x-data-grid-premium@v5.12.0`
|
|
123
|
+
|
|
124
|
+
#### Changes
|
|
125
|
+
|
|
126
|
+
- [DataGrid] Support dynamic row height (#4859) @m4theushw
|
|
127
|
+
- [DataGrid] Add `onMenuOpen` and `onMenuClose` props (#4825) @DanailH
|
|
128
|
+
- [DataGrid] Add generics to `GridActionsColDef` to match `GridColDef` (#4982) @subvertallchris
|
|
129
|
+
- [DataGrid] Disable drag event handlers when row or column reorder are disabled (#4857) @DanailH
|
|
130
|
+
- [DataGrid] Allow other attempts to stop edit mode if the first failed (#5016) @m4theushw
|
|
131
|
+
- [DataGrid] Better reflect the dependency on Material UI (#4795) @oliviertassinari
|
|
132
|
+
- [DataGrid] Add an id to the filter item created when opening the filter panel (#5014) @flaviendelangle
|
|
133
|
+
- [DataGrid] Use column visibility model on Hide All / Show All when enabled (#5050) @flaviendelangle
|
|
134
|
+
- [DataGridPro] Unpin columns back to original position (#4512) @m4theushw
|
|
135
|
+
- [DataGridPro] Remove experimental row grouping from Pro plan (#4949) @flaviendelangle
|
|
136
|
+
- [DataGridPro] Allow to scroll detail panel content if it overflows the panel (#4979) @cherniavskii
|
|
137
|
+
- [DataGridPro] Do not call `setRowIndex` when dragging a column over a row (#4987) @flaviendelangle
|
|
138
|
+
- [l10n] Add Norwegian (Bokmål) (nb-NO) locale (#5001) @spiftire
|
|
139
|
+
- [l10n] Add Turkish (tr-TR) locale (#5026) @Rassilion
|
|
140
|
+
|
|
141
|
+
### `@mui/x-date-pickers@5.0.0-alpha.5` / `@mui/x-date-pickers-pro@5.0.0-alpha.5`
|
|
142
|
+
|
|
143
|
+
#### Breaking changes
|
|
144
|
+
|
|
145
|
+
- [pickers] Restructure props in `MonthPicker` / `YearPicker` and `DayPicker` (#4814) @flaviendelangle
|
|
146
|
+
|
|
147
|
+
The props of `MonthPicker` / `YearPicker` and `DayPicker` have been reworked to make them more consistent for a standalone usage (#4814) @flaviendelangle
|
|
148
|
+
|
|
149
|
+
**MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
|
|
150
|
+
|
|
151
|
+
**YearPicker**: The prop `onYearPicker` has been removed, you can use `onChange` instead since every change is a year change
|
|
152
|
+
|
|
153
|
+
**DayPicker**: The prop `isDateDisabled` has been removed, you can now use the same validation props as for the other components (`maxDate`, `minDate`, `shouldDisableDate`, `disableFuture` and `disablePast`)
|
|
154
|
+
|
|
155
|
+
#### Changes
|
|
156
|
+
|
|
157
|
+
- [pickers] Add German (de-DE) translations (#4974) @felixh10r
|
|
158
|
+
- [pickers] Support action bar on static pickers and improve typing (#5015) @flaviendelangle
|
|
159
|
+
|
|
160
|
+
### Docs
|
|
161
|
+
|
|
162
|
+
- [docs] Add docs sections / pages for upcoming features on pickers (#4603) @flaviendelangle
|
|
163
|
+
- [docs] Add docs for filter panel components (#4919) @m4theushw
|
|
164
|
+
- [docs] Explain how to manage focus with `renderCell` (#4254) @alexfauquette
|
|
165
|
+
- [docs] Fix broken links to GitHub source (#5003) @Edwardveb
|
|
166
|
+
- [docs] Fix navigation links (#4956) @oliviertassinari
|
|
167
|
+
- [docs] Fix typo on rows docs (#4952) @jamesRadicl
|
|
168
|
+
- [docs] New WAI-ARIA guidelines location (#4957) @oliviertassinari
|
|
169
|
+
- [docs] Add "Slots" section to the right nav in the API pages (#4993) @DanailH
|
|
170
|
+
- [docs] Fix docs feedback widget not working (#4905) @cherniavskii
|
|
171
|
+
- [docs] Replace custom notes and warning with callouts (#5008) @flaviendelangle
|
|
172
|
+
|
|
173
|
+
### Core
|
|
174
|
+
|
|
175
|
+
- [core] Avoid Order ID to refer to GitHub issues/PRs (#5005) @oliviertassinari
|
|
176
|
+
- [core] Improve the workflow for incomplete issues (#5012) @mnajdova
|
|
177
|
+
- [core] Remove dead code on row grouping tree creation (#4945) @flaviendelangle
|
|
178
|
+
- [core] Use new cache api for the row grouping last model tracking (#4980) @flaviendelangle
|
|
179
|
+
- [core] Ensure that PRs have atleast 1 label (#5011) @DanailH
|
|
180
|
+
- [core] Fix trailing-space @oliviertassinari
|
|
181
|
+
- [core] Stop Renovate PR updates when PR is on hold (#5020) @cherniavskii
|
|
182
|
+
- [license] Remove support for UTF-8 (#4893) @oliviertassinari
|
|
183
|
+
- [license] Tweak error messages (#4907) @mbrookes
|
|
184
|
+
- [test] Skip Safari and Firefox on broken tests (#4994) @alexfauquette
|
|
185
|
+
- [test] Make argos screenshots stable (#5061) @m4theushw
|
|
186
|
+
|
|
6
187
|
## v5.11.1
|
|
7
188
|
|
|
8
189
|
_May 20, 2022_
|
|
@@ -38,30 +219,28 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
|
|
|
38
219
|
|
|
39
220
|
To decide which button must be displayed and in which order, you can now use the `actions` prop of the `actionBar` component slot props.
|
|
40
221
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
222
|
+
```jsx
|
|
223
|
+
<DatePicker
|
|
224
|
+
componentsProps={{
|
|
225
|
+
actionBar: {
|
|
226
|
+
// The actions will be the same between desktop and mobile
|
|
227
|
+
actions: ['clear'],
|
|
47
228
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
229
|
+
// The actions will be different between desktop and mobile
|
|
230
|
+
actions: (variant) => (variant === 'desktop' ? [] : ['clear']),
|
|
231
|
+
},
|
|
232
|
+
}}
|
|
233
|
+
/>
|
|
234
|
+
```
|
|
54
235
|
|
|
55
236
|
The build-in `ActionBar` component supports 4 different actions: `'clear'`, `'cancel'`, `'accept'`, and `'today'`.
|
|
56
237
|
By default, the pickers will render the cancel and accept button on mobile and no action on desktop.
|
|
57
238
|
|
|
58
239
|
If you need other actions, you can provide your own component to the `ActionBar` component slot
|
|
59
240
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/>
|
|
64
|
-
```
|
|
241
|
+
```jsx
|
|
242
|
+
<DatePicker components={{ ActionBar: CustomActionBar }} />
|
|
243
|
+
```
|
|
65
244
|
|
|
66
245
|
#### Changes
|
|
67
246
|
|
|
@@ -121,7 +300,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
121
300
|
|
|
122
301
|
- 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
|
|
123
302
|
|
|
124
|
-
- 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](
|
|
303
|
+
- 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/#quick-filter).
|
|
125
304
|
|
|
126
305
|
<img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
|
|
127
306
|
|
|
@@ -3948,9 +4127,9 @@ Big thanks to the 8 contributors who made this release possible. Here are some h
|
|
|
3948
4127
|
|
|
3949
4128
|
### Docs
|
|
3950
4129
|
|
|
3951
|
-
- [docs] Data
|
|
4130
|
+
- [docs] Data grid depends on side effects (#666) @oliviertassinari
|
|
3952
4131
|
- [docs] Clarify the purpose of x-grid-data-generator (#634) @Elius94
|
|
3953
|
-
- [docs] Data
|
|
4132
|
+
- [docs] Data grid is in the lab (#612) @oliviertassinari
|
|
3954
4133
|
- [docs] Fix Demo app, downgrade webpack-cli, known issue in latest version (#647) @dtassone
|
|
3955
4134
|
- [docs] Fix typo in columns.md @stojy
|
|
3956
4135
|
- [docs] Reduce confusion on /export page (#646) @SerdarMustafa1
|
|
@@ -275,7 +275,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
275
275
|
experimentalFeatures: PropTypes.shape({
|
|
276
276
|
newEditingApi: PropTypes.bool,
|
|
277
277
|
preventCommitWhileValidating: PropTypes.bool,
|
|
278
|
-
rowGrouping: PropTypes.bool,
|
|
279
278
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
280
279
|
}),
|
|
281
280
|
|
|
@@ -329,6 +328,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
329
328
|
*/
|
|
330
329
|
getDetailPanelHeight: PropTypes.func,
|
|
331
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Function that returns the estimated height for a row.
|
|
333
|
+
* Only works if dynamic row height is used.
|
|
334
|
+
* Once the row height is measured this value is discarded.
|
|
335
|
+
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
|
|
336
|
+
* @returns {number | null} The estimated row height value. If `null` or `undefined` then the default row height, based on the density, is applied.
|
|
337
|
+
*/
|
|
338
|
+
getEstimatedRowHeight: PropTypes.func,
|
|
339
|
+
|
|
332
340
|
/**
|
|
333
341
|
* Function that applies CSS classes dynamically on rows.
|
|
334
342
|
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
|
|
@@ -339,7 +347,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
339
347
|
/**
|
|
340
348
|
* Function that sets the row height per row.
|
|
341
349
|
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
|
|
342
|
-
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
|
|
350
|
+
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied. If "auto" then the row height is calculated based on the content.
|
|
343
351
|
*/
|
|
344
352
|
getRowHeight: PropTypes.func,
|
|
345
353
|
|
|
@@ -665,6 +673,22 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
665
673
|
*/
|
|
666
674
|
onFilterModelChange: PropTypes.func,
|
|
667
675
|
|
|
676
|
+
/**
|
|
677
|
+
* Callback fired when the menu is closed.
|
|
678
|
+
* @param {GridMenuParams} params With all properties from [[GridMenuParams]].
|
|
679
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
680
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
681
|
+
*/
|
|
682
|
+
onMenuClose: PropTypes.func,
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Callback fired when the menu is opened.
|
|
686
|
+
* @param {GridMenuParams} params With all properties from [[GridMenuParams]].
|
|
687
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
688
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
689
|
+
*/
|
|
690
|
+
onMenuOpen: PropTypes.func,
|
|
691
|
+
|
|
668
692
|
/**
|
|
669
693
|
* Callback fired when the current page has changed.
|
|
670
694
|
* @param {number} page Index of the page displayed on the Grid.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer,
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors } from '@mui/x-data-grid-pro/internals';
|
|
2
2
|
// Premium-only features
|
|
3
3
|
import { useGridRowGrouping, rowGroupingStateInitializer } from '../hooks/features/rowGrouping/useGridRowGrouping';
|
|
4
4
|
import { useGridRowGroupingPreProcessors } from '../hooks/features/rowGrouping/useGridRowGroupingPreProcessors';
|
|
@@ -51,7 +51,6 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
51
51
|
useGridRows(apiRef, props);
|
|
52
52
|
useGridParamsApi(apiRef);
|
|
53
53
|
useGridColumnSpanning(apiRef);
|
|
54
|
-
useGridDetailPanelCache(apiRef, props);
|
|
55
54
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
56
55
|
useGridEditing(apiRef, props);
|
|
57
56
|
useGridFocus(apiRef, props);
|
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ This component has the following peer dependencies that you will need to install
|
|
|
19
19
|
|
|
20
20
|
```json
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@mui/material": "^5.
|
|
23
|
-
"@mui/system": "^5.
|
|
22
|
+
"@mui/material": "^5.4.1",
|
|
23
|
+
"@mui/system": "^5.4.1",
|
|
24
24
|
"react": "^17.0.2 || ^18.0.0"
|
|
25
25
|
},
|
|
26
26
|
```
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
export declare type GridRowGroupingModel = string[];
|
|
2
2
|
export interface GridRowGroupingState {
|
|
3
3
|
model: GridRowGroupingModel;
|
|
4
|
+
}
|
|
5
|
+
export interface GridRowGroupingInitialState {
|
|
6
|
+
model?: GridRowGroupingModel;
|
|
7
|
+
}
|
|
8
|
+
export interface GridRowGroupingInternalCache {
|
|
4
9
|
/**
|
|
5
10
|
* Tracks the model on the last pre-processing
|
|
6
11
|
* Allows to check if we need to re-build the grouping columns when the grid upserts a column.
|
|
7
|
-
* TODO: Move outside of the state
|
|
8
12
|
*/
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
export interface GridRowGroupingInitialState {
|
|
12
|
-
model?: GridRowGroupingModel;
|
|
13
|
+
sanitizedModelOnLastRowTreeCreation: GridRowGroupingModel;
|
|
13
14
|
}
|
|
14
15
|
export interface GridRowGroupingApi {
|
|
15
16
|
/**
|
|
@@ -8,4 +8,4 @@ export declare const rowGroupingStateInitializer: GridStateInitializer<Pick<Data
|
|
|
8
8
|
* @requires useGridRows (state, method) - can be after, async only
|
|
9
9
|
* @requires useGridParamsApi (method) - can be after, async only
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridRowGrouping: (apiRef: React.MutableRefObject<GridApiPremium>, props: Pick<DataGridPremiumProcessedProps, '
|
|
11
|
+
export declare const useGridRowGrouping: (apiRef: React.MutableRefObject<GridApiPremium>, props: Pick<DataGridPremiumProcessedProps, 'rowGroupingModel' | 'onRowGroupingModelChange' | 'defaultGroupingExpansionDepth' | 'isGroupExpandedByDefault' | 'groupingColDef' | 'rowGroupingColumnMode' | 'disableRowGrouping'>) => void;
|
|
@@ -3,18 +3,20 @@ import * as React from 'react';
|
|
|
3
3
|
import Divider from '@mui/material/Divider';
|
|
4
4
|
import { useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid-pro';
|
|
5
5
|
import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid-pro/internals';
|
|
6
|
-
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector
|
|
6
|
+
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
7
7
|
import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability } from './gridRowGroupingUtils';
|
|
8
8
|
import { GridRowGroupableColumnMenuItems } from '../../../components/GridRowGroupableColumnMenuItems';
|
|
9
9
|
import { GridRowGroupingColumnMenuItems } from '../../../components/GridRowGroupingColumnMenuItems';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
export const rowGroupingStateInitializer = (state, props) => {
|
|
11
|
+
export const rowGroupingStateInitializer = (state, props, apiRef) => {
|
|
12
12
|
var _ref, _props$rowGroupingMod, _props$initialState, _props$initialState$r;
|
|
13
13
|
|
|
14
|
+
apiRef.current.unstable_caches.rowGrouping = {
|
|
15
|
+
sanitizedModelOnLastRowTreeCreation: []
|
|
16
|
+
};
|
|
14
17
|
return _extends({}, state, {
|
|
15
18
|
rowGrouping: {
|
|
16
|
-
model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : []
|
|
17
|
-
unstable_sanitizedModelOnLastRowTreeCreation: []
|
|
19
|
+
model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : []
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
};
|
|
@@ -25,7 +27,7 @@ export const rowGroupingStateInitializer = (state, props) => {
|
|
|
25
27
|
*/
|
|
26
28
|
|
|
27
29
|
export const useGridRowGrouping = (apiRef, props) => {
|
|
28
|
-
apiRef.current.
|
|
30
|
+
apiRef.current.unstable_registerControlState({
|
|
29
31
|
stateId: 'rowGrouping',
|
|
30
32
|
propModel: props.rowGroupingModel,
|
|
31
33
|
propOnChange: props.onRowGroupingModelChange,
|
|
@@ -168,14 +170,10 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
168
170
|
}, [apiRef, props.rowGroupingColumnMode]);
|
|
169
171
|
const checkGroupingColumnsModelDiff = React.useCallback(() => {
|
|
170
172
|
const rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
|
|
171
|
-
const lastGroupingColumnsModelApplied =
|
|
173
|
+
const lastGroupingColumnsModelApplied = apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation;
|
|
172
174
|
|
|
173
175
|
if (!isDeepEqual(lastGroupingColumnsModelApplied, rowGroupingModel)) {
|
|
174
|
-
apiRef.current.
|
|
175
|
-
rowGrouping: _extends({}, state.rowGrouping, {
|
|
176
|
-
unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
|
|
177
|
-
})
|
|
178
|
-
}));
|
|
176
|
+
apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
|
|
179
177
|
apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
|
|
180
178
|
setStrategyAvailability(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
|
|
181
179
|
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid-pro';
|
|
3
|
+
import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid-pro';
|
|
4
4
|
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor, sortRowTree, buildRowTree } from '@mui/x-data-grid-pro/internals';
|
|
5
5
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
6
6
|
import { createGroupingColDefForAllGroupingCriteria, createGroupingColDefForOneGroupingCriteria } from './createGroupingColDef';
|
|
@@ -68,7 +68,7 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
68
68
|
|
|
69
69
|
newColumnsLookup[groupingColDef.field] = groupingColDef;
|
|
70
70
|
});
|
|
71
|
-
const startIndex = newColumnFields[0] ===
|
|
71
|
+
const startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
|
|
72
72
|
newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
|
|
73
73
|
columnsState.all = newColumnFields;
|
|
74
74
|
columnsState.lookup = newColumnsLookup;
|
|
@@ -77,15 +77,7 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
77
77
|
const createRowTree = React.useCallback(params => {
|
|
78
78
|
const rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
|
|
79
79
|
const columnsLookup = gridColumnLookupSelector(apiRef);
|
|
80
|
-
apiRef.current.
|
|
81
|
-
rowGrouping: _extends({}, state.rowGrouping, {
|
|
82
|
-
unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
|
|
83
|
-
})
|
|
84
|
-
}));
|
|
85
|
-
const distinctValues = Object.fromEntries(rowGroupingModel.map(groupingField => [groupingField, {
|
|
86
|
-
lookup: {},
|
|
87
|
-
list: []
|
|
88
|
-
}]));
|
|
80
|
+
apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
|
|
89
81
|
|
|
90
82
|
const getCellGroupingCriteria = ({
|
|
91
83
|
row,
|
|
@@ -117,24 +109,6 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
117
109
|
};
|
|
118
110
|
};
|
|
119
111
|
|
|
120
|
-
params.ids.forEach(rowId => {
|
|
121
|
-
const row = params.idRowsLookup[rowId];
|
|
122
|
-
rowGroupingModel.forEach(groupingCriteria => {
|
|
123
|
-
const {
|
|
124
|
-
key
|
|
125
|
-
} = getCellGroupingCriteria({
|
|
126
|
-
row,
|
|
127
|
-
id: rowId,
|
|
128
|
-
colDef: columnsLookup[groupingCriteria]
|
|
129
|
-
});
|
|
130
|
-
const groupingFieldsDistinctKeys = distinctValues[groupingCriteria];
|
|
131
|
-
|
|
132
|
-
if (key != null && !groupingFieldsDistinctKeys.lookup[key.toString()]) {
|
|
133
|
-
groupingFieldsDistinctKeys.lookup[key.toString()] = true;
|
|
134
|
-
groupingFieldsDistinctKeys.list.push(key);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
112
|
const rows = params.ids.map(rowId => {
|
|
139
113
|
const row = params.idRowsLookup[rowId];
|
|
140
114
|
const parentPath = rowGroupingModel.map(groupingField => getCellGroupingCriteria({
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.12.2
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
5
5
|
*/
|
|
6
6
|
import './typeOverloads';
|
|
7
|
-
import '@mui/x-data-grid-pro/typeOverloads';
|
|
8
7
|
export { LicenseInfo } from '@mui/x-license-pro';
|
|
9
8
|
export * from '@mui/x-data-grid/components';
|
|
10
9
|
export * from '@mui/x-data-grid-pro/components';
|
|
@@ -275,7 +275,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
275
275
|
experimentalFeatures: PropTypes.shape({
|
|
276
276
|
newEditingApi: PropTypes.bool,
|
|
277
277
|
preventCommitWhileValidating: PropTypes.bool,
|
|
278
|
-
rowGrouping: PropTypes.bool,
|
|
279
278
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
280
279
|
}),
|
|
281
280
|
|
|
@@ -329,6 +328,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
329
328
|
*/
|
|
330
329
|
getDetailPanelHeight: PropTypes.func,
|
|
331
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Function that returns the estimated height for a row.
|
|
333
|
+
* Only works if dynamic row height is used.
|
|
334
|
+
* Once the row height is measured this value is discarded.
|
|
335
|
+
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
|
|
336
|
+
* @returns {number | null} The estimated row height value. If `null` or `undefined` then the default row height, based on the density, is applied.
|
|
337
|
+
*/
|
|
338
|
+
getEstimatedRowHeight: PropTypes.func,
|
|
339
|
+
|
|
332
340
|
/**
|
|
333
341
|
* Function that applies CSS classes dynamically on rows.
|
|
334
342
|
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
|
|
@@ -339,7 +347,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
339
347
|
/**
|
|
340
348
|
* Function that sets the row height per row.
|
|
341
349
|
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
|
|
342
|
-
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
|
|
350
|
+
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied. If "auto" then the row height is calculated based on the content.
|
|
343
351
|
*/
|
|
344
352
|
getRowHeight: PropTypes.func,
|
|
345
353
|
|
|
@@ -665,6 +673,22 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
665
673
|
*/
|
|
666
674
|
onFilterModelChange: PropTypes.func,
|
|
667
675
|
|
|
676
|
+
/**
|
|
677
|
+
* Callback fired when the menu is closed.
|
|
678
|
+
* @param {GridMenuParams} params With all properties from [[GridMenuParams]].
|
|
679
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
680
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
681
|
+
*/
|
|
682
|
+
onMenuClose: PropTypes.func,
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Callback fired when the menu is opened.
|
|
686
|
+
* @param {GridMenuParams} params With all properties from [[GridMenuParams]].
|
|
687
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
688
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
689
|
+
*/
|
|
690
|
+
onMenuOpen: PropTypes.func,
|
|
691
|
+
|
|
668
692
|
/**
|
|
669
693
|
* Callback fired when the current page has changed.
|
|
670
694
|
* @param {number} page Index of the page displayed on the Grid.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer,
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors } from '@mui/x-data-grid-pro/internals';
|
|
2
2
|
// Premium-only features
|
|
3
3
|
import { useGridRowGrouping, rowGroupingStateInitializer } from '../hooks/features/rowGrouping/useGridRowGrouping';
|
|
4
4
|
import { useGridRowGroupingPreProcessors } from '../hooks/features/rowGrouping/useGridRowGroupingPreProcessors';
|
|
@@ -51,7 +51,6 @@ export var useDataGridPremiumComponent = function useDataGridPremiumComponent(in
|
|
|
51
51
|
useGridRows(apiRef, props);
|
|
52
52
|
useGridParamsApi(apiRef);
|
|
53
53
|
useGridColumnSpanning(apiRef);
|
|
54
|
-
useGridDetailPanelCache(apiRef, props);
|
|
55
54
|
var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
56
55
|
useGridEditing(apiRef, props);
|
|
57
56
|
useGridFocus(apiRef, props);
|
|
@@ -4,18 +4,20 @@ import * as React from 'react';
|
|
|
4
4
|
import Divider from '@mui/material/Divider';
|
|
5
5
|
import { useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid-pro';
|
|
6
6
|
import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid-pro/internals';
|
|
7
|
-
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector
|
|
7
|
+
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
8
8
|
import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability } from './gridRowGroupingUtils';
|
|
9
9
|
import { GridRowGroupableColumnMenuItems } from '../../../components/GridRowGroupableColumnMenuItems';
|
|
10
10
|
import { GridRowGroupingColumnMenuItems } from '../../../components/GridRowGroupingColumnMenuItems';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
export var rowGroupingStateInitializer = function rowGroupingStateInitializer(state, props) {
|
|
12
|
+
export var rowGroupingStateInitializer = function rowGroupingStateInitializer(state, props, apiRef) {
|
|
13
13
|
var _ref, _props$rowGroupingMod, _props$initialState, _props$initialState$r;
|
|
14
14
|
|
|
15
|
+
apiRef.current.unstable_caches.rowGrouping = {
|
|
16
|
+
sanitizedModelOnLastRowTreeCreation: []
|
|
17
|
+
};
|
|
15
18
|
return _extends({}, state, {
|
|
16
19
|
rowGrouping: {
|
|
17
|
-
model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : []
|
|
18
|
-
unstable_sanitizedModelOnLastRowTreeCreation: []
|
|
20
|
+
model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : []
|
|
19
21
|
}
|
|
20
22
|
});
|
|
21
23
|
};
|
|
@@ -26,7 +28,7 @@ export var rowGroupingStateInitializer = function rowGroupingStateInitializer(st
|
|
|
26
28
|
*/
|
|
27
29
|
|
|
28
30
|
export var useGridRowGrouping = function useGridRowGrouping(apiRef, props) {
|
|
29
|
-
apiRef.current.
|
|
31
|
+
apiRef.current.unstable_registerControlState({
|
|
30
32
|
stateId: 'rowGrouping',
|
|
31
33
|
propModel: props.rowGroupingModel,
|
|
32
34
|
propOnChange: props.onRowGroupingModelChange,
|
|
@@ -172,16 +174,10 @@ export var useGridRowGrouping = function useGridRowGrouping(apiRef, props) {
|
|
|
172
174
|
}, [apiRef, props.rowGroupingColumnMode]);
|
|
173
175
|
var checkGroupingColumnsModelDiff = React.useCallback(function () {
|
|
174
176
|
var rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
|
|
175
|
-
var lastGroupingColumnsModelApplied =
|
|
177
|
+
var lastGroupingColumnsModelApplied = apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation;
|
|
176
178
|
|
|
177
179
|
if (!isDeepEqual(lastGroupingColumnsModelApplied, rowGroupingModel)) {
|
|
178
|
-
apiRef.current.
|
|
179
|
-
return _extends({}, state, {
|
|
180
|
-
rowGrouping: _extends({}, state.rowGrouping, {
|
|
181
|
-
unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
|
|
182
|
-
})
|
|
183
|
-
});
|
|
184
|
-
});
|
|
180
|
+
apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
|
|
185
181
|
apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
|
|
186
182
|
setStrategyAvailability(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
|
|
187
183
|
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|