@mui/x-data-grid-premium 5.11.0 → 5.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +237 -16
  2. package/DataGridPremium/DataGridPremium.js +26 -2
  3. package/LICENSE +3 -3
  4. package/README.md +3 -4
  5. package/hooks/features/export/serializer/excelSerializer.js +33 -5
  6. package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +6 -5
  7. package/hooks/features/rowGrouping/useGridRowGrouping.js +9 -11
  8. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
  9. package/index.d.ts +0 -1
  10. package/index.js +1 -2
  11. package/legacy/DataGridPremium/DataGridPremium.js +26 -2
  12. package/legacy/hooks/features/export/serializer/excelSerializer.js +33 -5
  13. package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +9 -13
  14. package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -31
  15. package/legacy/index.js +1 -2
  16. package/legacy/typeOverloads/index.js +2 -1
  17. package/legacy/typeOverloads/modules.js +1 -33
  18. package/legacy/utils/releaseInfo.js +1 -1
  19. package/modern/DataGridPremium/DataGridPremium.js +26 -2
  20. package/modern/hooks/features/export/serializer/excelSerializer.js +33 -5
  21. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +14 -14
  22. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
  23. package/modern/index.js +1 -2
  24. package/modern/typeOverloads/index.js +2 -1
  25. package/modern/typeOverloads/modules.js +1 -33
  26. package/modern/utils/releaseInfo.js +1 -1
  27. package/node/DataGridPremium/DataGridPremium.js +26 -2
  28. package/node/hooks/features/export/serializer/excelSerializer.js +33 -5
  29. package/node/hooks/features/rowGrouping/useGridRowGrouping.js +8 -10
  30. package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
  31. package/node/index.js +1 -3
  32. package/node/typeOverloads/index.js +3 -1
  33. package/node/typeOverloads/modules.js +5 -34
  34. package/node/utils/releaseInfo.js +1 -1
  35. package/package.json +13 -16
  36. package/typeOverloads/index.d.ts +1 -0
  37. package/typeOverloads/index.js +2 -1
  38. package/typeOverloads/modules.d.ts +34 -0
  39. package/typeOverloads/modules.js +1 -33
  40. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,21 +3,247 @@
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.1
7
+
8
+ _Jun 9, 2022_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add `reason` to `onFilterModelChange` (#4938) @m4theushw
13
+ - 🔎 Control quick filter input value via model prop (#5013) @alexfauquette
14
+ - 📚 Documentation improvements
15
+ - 🐞 Bugfixes
16
+
17
+ ### `@mui/x-data-grid@v5.12.1` / `@mui/x-data-grid-pro@v5.12.1` / `@mui/x-data-grid-premium@v5.12.1`
18
+
19
+ #### Changes
20
+
21
+ - [DataGrid] Add `reason` to `onFilterModelChange` (#4938) @m4theushw
22
+ - [DataGrid] Restore focus after dismissing the column menu (#5027) @m4theushw
23
+ - [DataGrid] Update quick filter input when model is modified (#5013) @alexfauquette
24
+ - [DataGrid] Fix implicit dependency on react-dom (#5121) @oliviertassinari
25
+ - [DataGrid] Support `getRowId` in row reordering (#5093) @flaviendelangle
26
+ - [DataGridPro] Fix column resizing in RTL mode (#4989) @cherniavskii
27
+ - [DataGridPro] Fix column resizing on touchscreen (#5056) @cherniavskii
28
+ - [l10n] Update Japanese (ja-JP) locale (#5122) @hikotq
29
+ - [l10n] Update Russian (ru-RU) locale (#5069) @Artboomy
30
+
31
+ ### `@mui/x-date-pickers@5.0.0-alpha.6` / `@mui/x-date-pickers-pro@5.0.0-alpha.6`
32
+
33
+ #### Changes
34
+
35
+ - [pickers] Fix usage of `maxDate` / `minDate` / `disableFuture` and `disablePast` (#5081) @flaviendelangle
36
+ - [pickers] Infer mask from `inputFormat` (#5060) @alexfauquette
37
+ - [pickers] Manage input value without using the focus (#4486) @alexfauquette
38
+ - [pickers] Use new localization for doc examples (#5097) @flaviendelangle
39
+ - [pickers] Fix `shouldDisableDate` in range pickers (#5123) @flaviendelangle
40
+ - [l10n] Add Brazilian Portuguese (pt-BR) locale (#5100) @jardelnovaes
41
+ - [l10n] Use `localText` for remaining texts (#4986) @alexfauquette
42
+
43
+ ### Docs
44
+
45
+ - [docs] Implement the focus management on data grid demo links (#5070) @alexfauquette
46
+ - [docs] Fix `301` link to render cell (#5106) @oliviertassinari
47
+ - [docs] Fix broken anchor link @oliviertassinari
48
+ - [docs] Improve movie dataset (#5142) @flaviendelangle
49
+ - [docs] Move all localization documentation in a unique page (#5072) @alexfauquette
50
+ - [docs] Section for overwriting core components i18n keys (#4998) @DanailH
51
+ - [docs] Small grammar and format fixes for Dynamic Row Height section (#5098) @samuelsycamore
52
+
53
+ ### Core
54
+
55
+ - [core] Allows to run tests with different date adapters (#5055) @alexfauquette
56
+ - [core] Prettify the l10n issue (#4928) @alexfauquette
57
+ - [core] Set correct `apiRef` type in row reorder pre processors #5125 @DanailH
58
+ - [core] Stop using `GridEvents` in technical doc (#5157) @flaviendelangle
59
+ - [core] Upgrade monorepo (#5101) @oliviertassinari
60
+ - [test] Fix dynamic row height test failing on Chrome (#5147) @m4theushw
61
+ - [test] Remove delay on server demo for regression tests (#5131) @alexfauquette
62
+
63
+ ## v5.12.0
64
+
65
+ _May 31, 2022_
66
+
67
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
68
+
69
+ - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
70
+
71
+ <img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
72
+
73
+ - ⚠️ Remove deprecated row grouping feature from `@mui/x-data-grid-pro`
74
+
75
+ Row grouping is available through the `@mui/x-data-grid-premium` package - see [Premium plan release blogpost](https://mui.com/blog/premium-plan-release/).
76
+
77
+ - 🐞 Bug fixes and improvements
78
+
79
+ ### `@mui/x-data-grid@v5.12.0` / `@mui/x-data-grid-pro@v5.12.0` / `@mui/x-data-grid-premium@v5.12.0`
80
+
81
+ #### Changes
82
+
83
+ - [DataGrid] Support dynamic row height (#4859) @m4theushw
84
+ - [DataGrid] Add `onMenuOpen` and `onMenuClose` props (#4825) @DanailH
85
+ - [DataGrid] Add generics to `GridActionsColDef` to match `GridColDef` (#4982) @subvertallchris
86
+ - [DataGrid] Disable drag event handlers when row or column reorder are disabled (#4857) @DanailH
87
+ - [DataGrid] Allow other attempts to stop edit mode if the first failed (#5016) @m4theushw
88
+ - [DataGrid] Better reflect the dependency on Material UI (#4795) @oliviertassinari
89
+ - [DataGrid] Add an id to the filter item created when opening the filter panel (#5014) @flaviendelangle
90
+ - [DataGrid] Use column visibility model on Hide All / Show All when enabled (#5050) @flaviendelangle
91
+ - [DataGridPro] Unpin columns back to original position (#4512) @m4theushw
92
+ - [DataGridPro] Remove experimental row grouping from Pro plan (#4949) @flaviendelangle
93
+ - [DataGridPro] Allow to scroll detail panel content if it overflows the panel (#4979) @cherniavskii
94
+ - [DataGridPro] Do not call `setRowIndex` when dragging a column over a row (#4987) @flaviendelangle
95
+ - [l10n] Add Norwegian (Bokmål) (nb-NO) locale (#5001) @spiftire
96
+ - [l10n] Add Turkish (tr-TR) locale (#5026) @Rassilion
97
+
98
+ ### `@mui/x-date-pickers@5.0.0-alpha.5` / `@mui/x-date-pickers-pro@5.0.0-alpha.5`
99
+
100
+ #### Breaking changes
101
+
102
+ - [pickers] Restructure props in `MonthPicker` / `YearPicker` and `DayPicker` (#4814) @flaviendelangle
103
+
104
+ The props of `MonthPicker` / `YearPicker` and `DayPicker` have been reworked to make them more consistent for a standalone usage (#4814) @flaviendelangle
105
+
106
+ **MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
107
+
108
+ **YearPicker**: The prop `onYearPicker` has been removed, you can use `onChange` instead since every change is a year change
109
+
110
+ **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`)
111
+
112
+ #### Changes
113
+
114
+ - [pickers] Add German (de-DE) translations (#4974) @felixh10r
115
+ - [pickers] Support action bar on static pickers and improve typing (#5015) @flaviendelangle
116
+
117
+ ### Docs
118
+
119
+ - [docs] Add docs sections / pages for upcoming features on pickers (#4603) @flaviendelangle
120
+ - [docs] Add docs for filter panel components (#4919) @m4theushw
121
+ - [docs] Explain how to manage focus with `renderCell` (#4254) @alexfauquette
122
+ - [docs] Fix broken links to GitHub source (#5003) @Edwardveb
123
+ - [docs] Fix navigation links (#4956) @oliviertassinari
124
+ - [docs] Fix typo on rows docs (#4952) @jamesRadicl
125
+ - [docs] New WAI-ARIA guidelines location (#4957) @oliviertassinari
126
+ - [docs] Add "Slots" section to the right nav in the API pages (#4993) @DanailH
127
+ - [docs] Fix docs feedback widget not working (#4905) @cherniavskii
128
+ - [docs] Replace custom notes and warning with callouts (#5008) @flaviendelangle
129
+
130
+ ### Core
131
+
132
+ - [core] Avoid Order ID to refer to GitHub issues/PRs (#5005) @oliviertassinari
133
+ - [core] Improve the workflow for incomplete issues (#5012) @mnajdova
134
+ - [core] Remove dead code on row grouping tree creation (#4945) @flaviendelangle
135
+ - [core] Use new cache api for the row grouping last model tracking (#4980) @flaviendelangle
136
+ - [core] Ensure that PRs have atleast 1 label (#5011) @DanailH
137
+ - [core] Fix trailing-space @oliviertassinari
138
+ - [core] Stop Renovate PR updates when PR is on hold (#5020) @cherniavskii
139
+ - [license] Remove support for UTF-8 (#4893) @oliviertassinari
140
+ - [license] Tweak error messages (#4907) @mbrookes
141
+ - [test] Skip Safari and Firefox on broken tests (#4994) @alexfauquette
142
+ - [test] Make argos screenshots stable (#5061) @m4theushw
143
+
144
+ ## v5.11.1
145
+
146
+ _May 20, 2022_
147
+
148
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
149
+
150
+ - 🌍 Support localization on the date and time picker components (#4517) @alexfauquette
151
+
152
+ Texts can be translated in the pickers components, similar to what can be done in the data grid component. Check the [documentation](https://mui.com/x/react-date-pickers/localization/) for more information.
153
+
154
+ - 📃 Add support for column spanning when exporting to Excel (#4830) @cherniavskii
155
+
156
+ <img src="https://user-images.githubusercontent.com/13808724/167691417-bf6baeb9-d409-4134-acb6-aadaf6434de9.png" width="800">
157
+
158
+ - 🐞 Bugs fixes
159
+
160
+ ### `@mui/x-data-grid@v5.11.1` / `@mui/x-data-grid-pro@v5.11.1` / `@mui/x-data-grid-premium@v5.11.1`
161
+
162
+ #### Changes
163
+
164
+ - [DataGrid] Add a CSS class corresponding to current density (#4858) @m4theushw
165
+ - [DataGrid] Execute the pipe-processors in their initialization order (#4913) @flaviendelangle
166
+ - [DataGrid] Fix rendering of the no rows overlay when the `loading` prop is changed (#4910) @m4theushw
167
+ - [DataGridPremium] Add `exceljs` to the dependencies (#4939) @alexfauquette
168
+ - [DataGridPremium] Support column spanning in the Excel export (#4830) @cherniavskii
169
+ - [l10n] Improve Russian (ru-RU) locale (#4864) @arvkonstantin
170
+
171
+ ### `@mui/x-date-pickers@5.0.0-alpha.4` / `@mui/x-date-pickers-pro@5.0.0-alpha.4`
172
+
173
+ #### Breaking changes
174
+
175
+ - The props related to the action bar buttons have been removed (`clearable`, `showTodayButton`, `cancelText`, `okText`)
176
+
177
+ To decide which button must be displayed and in which order, you can now use the `actions` prop of the `actionBar` component slot props.
178
+
179
+ ```jsx
180
+ <DatePicker
181
+ componentsProps={{
182
+ actionBar: {
183
+ // The actions will be the same between desktop and mobile
184
+ actions: ['clear'],
185
+
186
+ // The actions will be different between desktop and mobile
187
+ actions: (variant) => (variant === 'desktop' ? [] : ['clear']),
188
+ },
189
+ }}
190
+ />
191
+ ```
192
+
193
+ The build-in `ActionBar` component supports 4 different actions: `'clear'`, `'cancel'`, `'accept'`, and `'today'`.
194
+ By default, the pickers will render the cancel and accept button on mobile and no action on desktop.
195
+
196
+ If you need other actions, you can provide your own component to the `ActionBar` component slot
197
+
198
+ ```jsx
199
+ <DatePicker components={{ ActionBar: CustomActionBar }} />
200
+ ```
201
+
202
+ #### Changes
203
+
204
+ - [DatePicker] Fix keyboard accessibility for first and last year (#4807) @alexfauquette
205
+ - [pickers] Add component slot for action bar (#4778) @alexfauquette
206
+ - [pickers] Add l10n support (#4517) @alexfauquette
207
+ - [pickers] Close Popper when pressing <kbd>Esc</kbd> inside a modal (#4499) @alexfauquette
208
+ - [pickers] Support class slots on toolbar components (#4855) @flaviendelangle
209
+ - [TimePicker] Fix time validation when current date is `null` (#4867) @flaviendelangle
210
+
211
+ ### Docs
212
+
213
+ - [docs] Add 301 redirect for columns page (#4940) @alexfauquette
214
+ - [docs] Avoid confusion with license key installation (#4891) @oliviertassinari
215
+ - [docs] Complete the instructions for pickers installation in readme (#4852) @alexfauquette
216
+ - [docs] Disable ads on paid-only pages (#4842) @flaviendelangle
217
+ - [docs] Don't redirect to localized doc on deploy preview (#4818) @m4theushw
218
+ - [docs] Limit `LICENSE` file to 80 char per line (#4873) @oliviertassinari
219
+ - [docs] Typo on OrderId @oliviertassinari
220
+ - [docs] Update feature comparison table (#4918) @cherniavskii
221
+
222
+ ### Core
223
+
224
+ - [core] Add new script to generate tree data rows from file tree (#4902) @flaviendelangle
225
+ - [core] Fix code style (#4874) @oliviertassinari
226
+ - [core] Fix React 18 peer dependency (#4908) @oliviertassinari
227
+ - [core] Fix link to the LICENSE file (#4875) @oliviertassinari
228
+ - [core] Fix transitive babel dependency (#4793) @oliviertassinari
229
+ - [core] New pipe processing `rowHydration` (#4896) @flaviendelangle
230
+ - [core] Remove dead code for the docs (#4791) @oliviertassinari
231
+ - [core] Run `yarn prettier` @oliviertassinari
232
+ - [core] Polishes on `CHANGELOG.md` (#4876) @oliviertassinari
233
+ - [core] Simplify rows cache management (#4933) @flaviendelangle
234
+ - [core] Use internal icons for quick filter (#4912) @alexfauquette
235
+
6
236
  ## v5.11.0
7
237
 
8
238
  _May 13, 2022_
9
239
 
10
240
  We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
11
241
 
12
- - 🚀 Premium plan release
13
-
14
- We’re happy to announce that the Premium plan is [finally out](https://mui.com/blog/premium-plan-release/)!
15
- With it, MUI X officially steps up to the next level, supporting the most advanced use cases for UI components.
242
+ - 🚀 **Premium plan release**. We're happy to announce that the Premium plan is [finally out](https://mui.com/blog/premium-plan-release/)! With it, MUI X officially steps up to the next level, supporting the most advanced use cases for UI components.
16
243
 
17
244
  This plan is available through the new `@mui/x-data-grid-premium` package, which contains the row grouping and the Excel export features.
18
245
 
19
- If you were already using the row grouping feature, you can upgrade by [installing](https://mui.com/x/react-data-grid/getting-started/#installation) `@mui/x-data-grid-premium` and replace `DataGridPro` with `DataGridPremium`, as follows.
20
- Note that the experimental flag is not required anymore to use the row grouping.
246
+ If you were already using the row grouping feature, you can upgrade by [installing](https://mui.com/x/react-data-grid/getting-started/#installation) `@mui/x-data-grid-premium` and replace `DataGridPro` with `DataGridPremium`, as follows. Note that the experimental flag is not required anymore to use the row grouping.
21
247
 
22
248
  ```diff
23
249
  -import { DataGridPro } from '@mui/x-data-grid-pro';
@@ -29,16 +255,11 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
29
255
 
30
256
  For more information about the revised pricing model please have a look at the [blog post](https://mui.com/blog/premium-plan-release/#the-new-licensing-model).
31
257
 
32
- - 👔 Add Excel export
33
-
34
- - 🔎 Quick filtering
35
-
36
- You can now add a quick filtering search bar to your grid.
37
- To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar.
258
+ - 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
38
259
 
39
- More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/#quick-filter)
260
+ - 🔎 **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).
40
261
 
41
- ![image](https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png)
262
+ <img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
42
263
 
43
264
  - 🐞 Bugs fixes
44
265
 
@@ -46,7 +267,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
46
267
 
47
268
  #### Breaking changes
48
269
 
49
- - Moving row grouping to premium package
270
+ - Move row grouping to the premium package (#4223) @flaviendelangle
50
271
 
51
272
  The use of `rowGrouping` in the `@mui/x-data-grid-pro` package is deprecated. The experimental flag will be removed in an upcoming release.
52
273
 
@@ -76,7 +297,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
76
297
 
77
298
  #### Breaking changes
78
299
 
79
- - Rework the auto-closing behavior of the pickers.
300
+ - Rework the auto-closing behavior of the pickers (#4408) @flaviendelangle
80
301
 
81
302
  The `disableCloseOnSelect` prop has been replaced by a new `closeOnSelect` prop which has the opposite behavior.
82
303
  The default behavior remains the same (close after the last step on desktop but not on mobile).
@@ -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.
package/LICENSE CHANGED
@@ -2,9 +2,9 @@ Commercial License
2
2
 
3
3
  Copyright (c) 2020 Material-UI SAS
4
4
 
5
- MUI X Premium (https://mui.com/pricing/) is commercial software. You must purchase
6
- a license and agree to the End User License Agreement (EULA: https://mui.com/r/x-license-eula)
7
- to be able to use the software.
5
+ MUI X Premium (https://mui.com/pricing/) is commercial software.
6
+ You must purchase a license and agree to the End User License Agreement
7
+ (EULA: https://mui.com/r/x-license-eula) to be able to use the software.
8
8
 
9
9
  Commercial licenses can be obtained at https://mui.com/r/x-get-license?scope=premium.
10
10
  You are free to install and try the software without a license key as long as it
package/README.md CHANGED
@@ -19,10 +19,9 @@ 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.2.8",
23
- "@mui/system": "^5.2.8",
24
- "react": "^17.0.2 || ^18.0.0",
25
- "react-dom": "^17.0.2 || ^18.0.0"
22
+ "@mui/material": "^5.4.1",
23
+ "@mui/system": "^5.4.1",
24
+ "react": "^17.0.2 || ^18.0.0"
26
25
  },
27
26
  ```
28
27
 
@@ -34,9 +34,29 @@ const getFormattedValueOptions = (colDef, valueOptions, api) => {
34
34
  const serializeRow = (id, columns, api, defaultValueOptionsFormulae) => {
35
35
  const row = {};
36
36
  const dataValidation = {};
37
+ const mergedCells = [];
37
38
  const firstCellParams = api.getCellParams(id, columns[0].field);
38
- const outlineLevel = firstCellParams.rowNode.depth;
39
- columns.forEach(column => {
39
+ const outlineLevel = firstCellParams.rowNode.depth; // `colSpan` is only calculated for rendered rows, so we need to calculate it during export for every row
40
+
41
+ api.unstable_calculateColSpan({
42
+ rowId: id,
43
+ minFirstColumn: 0,
44
+ maxLastColumn: columns.length - 1
45
+ });
46
+ columns.forEach((column, colIndex) => {
47
+ const colSpanInfo = api.unstable_getCellColSpanInfo(id, colIndex);
48
+
49
+ if (colSpanInfo && colSpanInfo.spannedByColSpan) {
50
+ return;
51
+ }
52
+
53
+ if (colSpanInfo && colSpanInfo.cellProps.colSpan > 1) {
54
+ mergedCells.push({
55
+ leftIndex: colIndex + 1,
56
+ rightIndex: colIndex + colSpanInfo.cellProps.colSpan
57
+ });
58
+ }
59
+
40
60
  const cellParams = api.getCellParams(id, column.field);
41
61
 
42
62
  switch (cellParams.colDef.type) {
@@ -119,7 +139,8 @@ const serializeRow = (id, columns, api, defaultValueOptionsFormulae) => {
119
139
  return {
120
140
  row,
121
141
  dataValidation,
122
- outlineLevel
142
+ outlineLevel,
143
+ mergedCells
123
144
  };
124
145
  };
125
146
 
@@ -195,7 +216,8 @@ export async function buildExcel(options, api) {
195
216
  const {
196
217
  row,
197
218
  dataValidation,
198
- outlineLevel
219
+ outlineLevel,
220
+ mergedCells
199
221
  } = serializeRow(id, columns, api, defaultValueOptionsFormulae);
200
222
  const newRow = worksheet.addRow(row);
201
223
  Object.keys(dataValidation).forEach(field => {
@@ -204,7 +226,13 @@ export async function buildExcel(options, api) {
204
226
 
205
227
  if (outlineLevel) {
206
228
  newRow.outlineLevel = outlineLevel;
207
- }
229
+ } // use `rowCount`, since worksheet can have additional rows added in `exceljsPreProcess`
230
+
231
+
232
+ const lastRowIndex = newRow.worksheet.rowCount;
233
+ mergedCells.forEach(mergedCell => {
234
+ worksheet.mergeCells(lastRowIndex, mergedCell.leftIndex, lastRowIndex, mergedCell.rightIndex);
235
+ });
208
236
  });
209
237
 
210
238
  if (exceljsPostProcess) {
@@ -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
- unstable_sanitizedModelOnLastRowTreeCreation: GridRowGroupingModel;
10
- }
11
- export interface GridRowGroupingInitialState {
12
- model?: GridRowGroupingModel;
13
+ sanitizedModelOnLastRowTreeCreation: GridRowGroupingModel;
13
14
  }
14
15
  export interface GridRowGroupingApi {
15
16
  /**
@@ -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, gridRowGroupingStateSelector } from './gridRowGroupingSelector';
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.unstable_updateControlState({
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 = gridRowGroupingStateSelector(apiRef.current.state).unstable_sanitizedModelOnLastRowTreeCreation;
173
+ const lastGroupingColumnsModelApplied = apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation;
172
174
 
173
175
  if (!isDeepEqual(lastGroupingColumnsModelApplied, rowGroupingModel)) {
174
- apiRef.current.setState(state => _extends({}, state, {
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
@@ -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.setState(state => _extends({}, state, {
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
@@ -1,5 +1,4 @@
1
1
  import './typeOverloads';
2
- import '@mui/x-data-grid-pro/typeOverloads';
3
2
  export { LicenseInfo } from '@mui/x-license-pro';
4
3
  export * from '@mui/x-data-grid/components';
5
4
  export * from '@mui/x-data-grid-pro/components';
package/index.js CHANGED
@@ -1,10 +1,9 @@
1
- /** @license MUI v5.11.0
1
+ /** @license MUI v5.12.1
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.