@mui/x-data-grid-premium 5.13.0 → 5.15.0

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 (122) hide show
  1. package/CHANGELOG.md +156 -6
  2. package/DataGridPremium/DataGridPremium.js +56 -0
  3. package/DataGridPremium/useDataGridPremiumComponent.js +10 -2
  4. package/DataGridPremium/useDataGridPremiumProps.js +17 -7
  5. package/components/GridAggregationColumnMenuItem.d.ts +9 -0
  6. package/components/GridAggregationColumnMenuItem.js +93 -0
  7. package/components/GridAggregationHeader.d.ts +4 -0
  8. package/components/GridAggregationHeader.js +94 -0
  9. package/components/GridExcelExportMenuItem.js +11 -4
  10. package/components/GridFooterCell.d.ts +9 -0
  11. package/components/GridFooterCell.js +51 -0
  12. package/components/GridGroupingColumnFooterCell.d.ts +4 -0
  13. package/components/GridGroupingColumnFooterCell.js +29 -0
  14. package/hooks/features/aggregation/createAggregationLookup.d.ts +10 -0
  15. package/hooks/features/aggregation/createAggregationLookup.js +128 -0
  16. package/hooks/features/aggregation/gridAggregationFunctions.d.ts +8 -0
  17. package/hooks/features/aggregation/gridAggregationFunctions.js +96 -0
  18. package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +103 -0
  19. package/hooks/features/aggregation/gridAggregationInterfaces.js +1 -0
  20. package/hooks/features/aggregation/gridAggregationSelectors.d.ts +4 -0
  21. package/hooks/features/aggregation/gridAggregationSelectors.js +4 -0
  22. package/hooks/features/aggregation/gridAggregationUtils.d.ts +41 -0
  23. package/hooks/features/aggregation/gridAggregationUtils.js +188 -0
  24. package/hooks/features/aggregation/index.d.ts +4 -0
  25. package/hooks/features/aggregation/index.js +4 -0
  26. package/hooks/features/aggregation/useGridAggregation.d.ts +6 -0
  27. package/hooks/features/aggregation/useGridAggregation.js +94 -0
  28. package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +4 -0
  29. package/hooks/features/aggregation/useGridAggregationPreProcessors.js +138 -0
  30. package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +29 -0
  31. package/hooks/features/aggregation/wrapColumnWithAggregation.js +257 -0
  32. package/hooks/features/export/serializer/excelSerializer.js +2 -1
  33. package/hooks/features/index.d.ts +1 -0
  34. package/hooks/features/index.js +1 -0
  35. package/hooks/features/rowGrouping/createGroupingColDef.js +13 -2
  36. package/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
  37. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  38. package/hooks/features/rowGrouping/useGridRowGrouping.js +20 -10
  39. package/index.js +1 -1
  40. package/legacy/DataGridPremium/DataGridPremium.js +56 -0
  41. package/legacy/DataGridPremium/useDataGridPremiumComponent.js +10 -2
  42. package/legacy/DataGridPremium/useDataGridPremiumProps.js +12 -2
  43. package/legacy/components/GridAggregationColumnMenuItem.js +95 -0
  44. package/legacy/components/GridAggregationHeader.js +95 -0
  45. package/legacy/components/GridExcelExportMenuItem.js +11 -4
  46. package/legacy/components/GridFooterCell.js +63 -0
  47. package/legacy/components/GridGroupingColumnFooterCell.js +27 -0
  48. package/legacy/hooks/features/aggregation/createAggregationLookup.js +127 -0
  49. package/legacy/hooks/features/aggregation/gridAggregationFunctions.js +94 -0
  50. package/legacy/hooks/features/aggregation/gridAggregationInterfaces.js +1 -0
  51. package/legacy/hooks/features/aggregation/gridAggregationSelectors.js +10 -0
  52. package/legacy/hooks/features/aggregation/gridAggregationUtils.js +200 -0
  53. package/legacy/hooks/features/aggregation/index.js +4 -0
  54. package/legacy/hooks/features/aggregation/useGridAggregation.js +95 -0
  55. package/legacy/hooks/features/aggregation/useGridAggregationPreProcessors.js +141 -0
  56. package/legacy/hooks/features/aggregation/wrapColumnWithAggregation.js +262 -0
  57. package/legacy/hooks/features/export/serializer/excelSerializer.js +2 -1
  58. package/legacy/hooks/features/index.js +1 -0
  59. package/legacy/hooks/features/rowGrouping/createGroupingColDef.js +13 -2
  60. package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
  61. package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +24 -10
  62. package/legacy/index.js +1 -1
  63. package/legacy/typeOverloads/index.js +1 -1
  64. package/legacy/utils/releaseInfo.js +1 -1
  65. package/models/dataGridPremiumProps.d.ts +40 -1
  66. package/models/gridApiPremium.d.ts +3 -3
  67. package/models/gridStatePremium.d.ts +3 -1
  68. package/modern/DataGridPremium/DataGridPremium.js +56 -0
  69. package/modern/DataGridPremium/useDataGridPremiumComponent.js +10 -2
  70. package/modern/DataGridPremium/useDataGridPremiumProps.js +8 -2
  71. package/modern/components/GridAggregationColumnMenuItem.js +93 -0
  72. package/modern/components/GridAggregationHeader.js +92 -0
  73. package/modern/components/GridExcelExportMenuItem.js +11 -4
  74. package/modern/components/GridFooterCell.js +51 -0
  75. package/modern/components/GridGroupingColumnFooterCell.js +29 -0
  76. package/modern/hooks/features/aggregation/createAggregationLookup.js +122 -0
  77. package/modern/hooks/features/aggregation/gridAggregationFunctions.js +96 -0
  78. package/modern/hooks/features/aggregation/gridAggregationInterfaces.js +1 -0
  79. package/modern/hooks/features/aggregation/gridAggregationSelectors.js +4 -0
  80. package/modern/hooks/features/aggregation/gridAggregationUtils.js +186 -0
  81. package/modern/hooks/features/aggregation/index.js +4 -0
  82. package/modern/hooks/features/aggregation/useGridAggregation.js +92 -0
  83. package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +136 -0
  84. package/modern/hooks/features/aggregation/wrapColumnWithAggregation.js +251 -0
  85. package/modern/hooks/features/export/serializer/excelSerializer.js +2 -1
  86. package/modern/hooks/features/index.js +1 -0
  87. package/modern/hooks/features/rowGrouping/createGroupingColDef.js +13 -2
  88. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
  89. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +17 -11
  90. package/modern/index.js +1 -1
  91. package/modern/typeOverloads/index.js +1 -1
  92. package/modern/utils/releaseInfo.js +1 -1
  93. package/node/DataGridPremium/DataGridPremium.js +56 -0
  94. package/node/DataGridPremium/useDataGridPremiumComponent.js +11 -1
  95. package/node/DataGridPremium/useDataGridPremiumProps.js +17 -6
  96. package/node/components/GridAggregationColumnMenuItem.js +120 -0
  97. package/node/components/GridAggregationHeader.js +115 -0
  98. package/node/components/GridExcelExportMenuItem.js +12 -4
  99. package/node/components/GridFooterCell.js +73 -0
  100. package/node/components/GridGroupingColumnFooterCell.js +46 -0
  101. package/node/hooks/features/aggregation/createAggregationLookup.js +139 -0
  102. package/node/hooks/features/aggregation/gridAggregationFunctions.js +105 -0
  103. package/node/hooks/features/aggregation/gridAggregationInterfaces.js +5 -0
  104. package/node/hooks/features/aggregation/gridAggregationSelectors.js +16 -0
  105. package/node/hooks/features/aggregation/gridAggregationUtils.js +223 -0
  106. package/node/hooks/features/aggregation/index.js +65 -0
  107. package/node/hooks/features/aggregation/useGridAggregation.js +118 -0
  108. package/node/hooks/features/aggregation/useGridAggregationPreProcessors.js +162 -0
  109. package/node/hooks/features/aggregation/wrapColumnWithAggregation.js +279 -0
  110. package/node/hooks/features/export/serializer/excelSerializer.js +2 -1
  111. package/node/hooks/features/index.js +13 -0
  112. package/node/hooks/features/rowGrouping/createGroupingColDef.js +14 -2
  113. package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
  114. package/node/hooks/features/rowGrouping/useGridRowGrouping.js +19 -10
  115. package/node/index.js +1 -1
  116. package/node/typeOverloads/index.js +16 -1
  117. package/node/utils/releaseInfo.js +1 -1
  118. package/package.json +5 -5
  119. package/typeOverloads/index.d.ts +1 -1
  120. package/typeOverloads/index.js +1 -1
  121. package/typeOverloads/modules.d.ts +32 -2
  122. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,156 @@
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
+ ## 5.15.0
7
+
8
+ _Jul 29, 2022_
9
+
10
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Introduce aggregation (#5592) @flaviendelangle
13
+
14
+ Premium users can now aggregate data in the grid.
15
+ Extract information like sum, average, count, and others with a couple of clicks.
16
+
17
+ https://user-images.githubusercontent.com/45398769/181581503-77cc412e-9d9e-4de1-8bc3-c3bccc54cdaa.mp4
18
+
19
+ To enable this feature, add `experimentalFeatures={{ aggregation: true }}`.
20
+ Aggregation functions are customizable and they combine well with row grouping.
21
+ See the [documentation](https://mui.com/x/react-data-grid/aggregation/) to explore everything it has to offer.
22
+
23
+ - 🚀 Introduce row pinning (#4863) @cherniavskii
24
+
25
+ Pro users can now pin rows on top or bottom of the grid.
26
+
27
+ https://user-images.githubusercontent.com/45398769/181581493-56c733a3-6dd5-4546-bf8d-3f2dff72b14a.mp4
28
+
29
+ To do so, enable the feature with `experimentalFeatures={{ rowPinning: true }}` and provide the pinned rows data to the `pinnedRows` prop.
30
+ For more details, see the [documentation](https://mui.com/x/react-data-grid/row-pinning/).
31
+
32
+ - 🌍 Add simplified Chinese (zh-CN) locale to pickers (#5584) @gamecss
33
+ - 📚 Documentation improvements
34
+
35
+ ### `@mui/x-data-grid@v5.15.0` / `@mui/x-data-grid-pro@v5.15.0` / `@mui/x-data-grid-premium@v5.15.0`
36
+
37
+ #### Changes
38
+
39
+ - [DataGrid] Add prop to keep modifications while processing props (#5309) @m4theushw
40
+ - [DataGrid] Fix container width change on React 18 (#5566) @m4theushw
41
+ - [DataGrid] Fix ellipsis style convention (#5587) @oliviertassinari
42
+ - [DataGridPro] Implement row pinning (#4863) @cherniavskii
43
+ - [DataGridPremium] Make aggregation public (#5592) @cherniavskii
44
+ - [l10n] Improve simplified Chinese (zh-CN) locale (#5584) @gamecss
45
+
46
+ ### `@mui/x-date-pickers@v5.0.0-beta.3` / `@mui/x-date-picker-pro@5.0.0-beta.3`
47
+
48
+ #### Changes
49
+
50
+ - [l10n] Add simplified Chinese (zh-CN) locale (#5584) @gamecss
51
+
52
+ ### Docs
53
+
54
+ - [docs] Split docs page about rows (#5195) @flaviendelangle
55
+ - [docs] Add warning clarifications (#5399) @alexfauquette
56
+ - [docs] Correct slot CSS classes for Pro and Premium components (#5452) @alexfauquette
57
+ - [docs] Fix internal link to `valueParser` (#5450) @alexfauquette
58
+
59
+ ### Core
60
+
61
+ - [core] Upgrade monorepo (#5560) @m4theushw
62
+
63
+ ## 5.14.0
64
+
65
+ _Jul 21, 2022_
66
+
67
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
68
+
69
+ - 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
70
+ - ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
71
+ - 🌍 Improvements to different locales
72
+ - 📚 Documentation improvements
73
+ - 🐞 Bugfixes
74
+
75
+ ### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
76
+
77
+ #### Changes
78
+
79
+ - [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
80
+ - [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
81
+ - [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
82
+ - [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
83
+ - [DataGrid] Fix loading overlay position (#5558) @DanailH
84
+ - [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
85
+ - [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
86
+ - [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
87
+ - [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
88
+
89
+ ### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
90
+
91
+ #### Changes
92
+
93
+ - [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
94
+
95
+ ### Docs
96
+
97
+ - [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
98
+ - [docs] Remove blank line @oliviertassinari
99
+
100
+ ### Core
101
+
102
+ - [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
103
+ - [core] Polish on the bug issue template (#5525) @oliviertassinari
104
+ - [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
105
+
106
+ ## 5.13.1
107
+
108
+ _Jul 15, 2022_
109
+
110
+ We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
111
+
112
+ - ✏️ Enter edit mode when pasting in a cell with Ctrl+V (Cmd+V on macOS) (#5405) @alexfauquette
113
+ - 🌍 Many improvements to the locales
114
+ - 📚 Documentation improvements
115
+ - 🐞 Bugfixes
116
+
117
+ ### `@mui/x-data-grid@v5.13.1` / `@mui/x-data-grid-pro@v5.13.1` / `@mui/x-data-grid-premium@v5.13.1`
118
+
119
+ #### Changes
120
+
121
+ - [DataGrid] Fix blank space when using dynamic row height with pagination (#5315) @m4theushw
122
+ - [DataGrid] Start editing with uppercase letter and Ctrl+V (#5405) @alexfauquette
123
+ - [DataGrid] Fix some filters being removed from filter model on filter panel open (#5403) @cherniavskii
124
+ - [DataGridPro] Improve pinned column headers accessibility (#5370) @cherniavskii
125
+ - [l10n] Improve Dutch (nl-NL) locale (#5464) @developenguin
126
+ - [l10n] Improve French (fr-FR) locale (#3211) (#5420) @Zenoo
127
+ - [l10n] Improve German (de-DE) locale (#5448) @sebastianfrey
128
+ - [l10n] Improve Brazilian Portuguese (pt-BR) locale (#5394) @andrepxa
129
+ - [l10n] Improve Romanian (ro-RO) locale (#5449) @rolule
130
+
131
+ ### `@mui/x-date-pickers@v5.0.0-beta.1` / `@mui/x-date-picker-pro@5.0.0-beta.1`
132
+
133
+ #### Changes
134
+
135
+ - [pickers] Add Italian (it-IT) locale (#5467) @felixh10r
136
+ - [pickers] Add Spanish (es-ES) locale (#5468) @felixh10r
137
+ - [pickers] Improve French (fr-FR) locale (#5446) @Zenoo
138
+ - [pickers] Improve German (de-DE) locale (#5447) @sebastianfrey
139
+
140
+ ### Docs
141
+
142
+ - [docs] Fix typo in the sorting page (#5431) @JosephMarinier
143
+ - [docs] Fix description for "Striped rows" example (#5432) @lindapaiste
144
+ - [docs] Make a clear difference between the license and license key (#5316) @oliviertassinari
145
+ - [docs] Update pickers README files (#5456) @cherniavskii
146
+ - [docs] Clarify the scope of support for MUI X (#5423) @joserodolfofreitas
147
+
148
+ ### Core
149
+
150
+ - [core] Add technical support link to \_redirects (#5428) @joserodolfofreitas
151
+ - [core] Improve GitHub bug reproduction template (#5067) @joserodolfofreitas
152
+ - [core] Include playground pages in tsconfig (#5367) @cherniavskii
153
+ - [core] Sort keys like in material-ui @oliviertassinari
154
+ - [test] Wait for flags to load on regression tests (#5473) @m4theushw
155
+
6
156
  ## 5.13.0
7
157
 
8
158
  _Jul 7, 2022_
@@ -213,7 +363,7 @@ _May 31, 2022_
213
363
 
214
364
  We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
215
365
 
216
- - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
366
+ - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/row-height/#dynamic-row-height) (#4859) @m4theushw
217
367
 
218
368
  <img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
219
369
 
@@ -530,7 +680,7 @@ _Apr 25, 2022_
530
680
 
531
681
  We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
532
682
 
533
- - 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/rows/#row-reorder) (#4034) @DanailH
683
+ - 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/row-ordering/) (#4034) @DanailH
534
684
 
535
685
  <img src="https://user-images.githubusercontent.com/5858539/165091263-23472fbb-a989-44b8-849a-d2185adfe13b.gif" width="800">
536
686
 
@@ -794,7 +944,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
794
944
  <DataGrid getRowSpacing={() => ({ top: 10, bottom: 10 })} />
795
945
  ```
796
946
 
797
- Check the [documentation](https://mui.com/x/react-data-grid/rows/#row-spacing) for more information.
947
+ Check the [documentation](https://mui.com/x/react-data-grid/row-height/#row-spacing) for more information.
798
948
 
799
949
  ### `@mui/x-data-grid@v5.6.1` / `@mui/x-data-grid-pro@v5.6.1`
800
950
 
@@ -1048,7 +1198,7 @@ _Jan 28, 2022_
1048
1198
 
1049
1199
  A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
1050
1200
 
1051
- - 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/rows/#variable-row-height) (#438) @DanailH
1201
+ - 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/row-height/#variable-row-height) (#438) @DanailH
1052
1202
 
1053
1203
  Allows for setting a row-specific height.
1054
1204
  By default, all rows have the same height, but now you can set the height on a per-row basis.
@@ -1416,7 +1566,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
1416
1566
  - [core] Fix `yarn prettier` script (#3292) @oliviertassinari
1417
1567
  - [core] Improve tests for Tree Data (#3366) @flaviendelangle
1418
1568
  - [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
1419
- - [core] Transition to a new StackOverflow tag (#3308) @oliviertassinari
1569
+ - [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
1420
1570
  - [core] Update monorepo (#3370) @flaviendelangle
1421
1571
  - [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
1422
1572
  - [test] Replace `useFakeTimers` (#3323) @m4theushw
@@ -3700,7 +3850,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
3700
3850
  - 🎁 Add `onRowsScrollEnd` to support infinite loading (#1199) @DanailH
3701
3851
  This is an XGrid feature. Provides the ability to tap into the `onRowsScrollEnd` which is called when the scroll reaches the bottom of the grid viewport allowing developers to load additional data. It can be used with a combination of `scrollBottomThreshold` to control the area in which the `onRowsScrollEnd` is called.
3702
3852
 
3703
- See the documentation for [more details](https://mui.com/x/react-data-grid/rows/#infinite-loading).
3853
+ See the documentation for [more details](https://mui.com/x/react-data-grid/row-updates/#infinite-loading).
3704
3854
 
3705
3855
  - 🕹 Provide the ability to sort by multiple columns using Shift+click (#1203) @dtassone
3706
3856
  - 🇵🇱 Added pl-PL locale (#1117) @LarsKumbier
@@ -42,6 +42,25 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
42
42
  // | To update them edit the TypeScript types and run "yarn proptypes" |
43
43
  // ----------------------------------------------------------------------
44
44
 
45
+ /**
46
+ * Aggregation functions available on the grid.
47
+ * @default GRID_AGGREGATION_FUNCTIONS
48
+ */
49
+ aggregationFunctions: PropTypes.object,
50
+
51
+ /**
52
+ * Set the aggregation model of the grid.
53
+ */
54
+ aggregationModel: PropTypes.object,
55
+
56
+ /**
57
+ * Rows used to generate the aggregated value.
58
+ * If `filtered`, the aggregated values will be generated using only the rows currently passing the filtering process.
59
+ * If `all`, the aggregated values will be generated using all the rows.
60
+ * @default "filtered"
61
+ */
62
+ aggregationRowsScope: PropTypes.oneOf(['all', 'filtered']),
63
+
45
64
  /**
46
65
  * The ref object that allows grid manipulation. Can be instantiated with [[useGridApiRef()]].
47
66
  */
@@ -156,6 +175,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
156
175
  */
157
176
  detailPanelExpandedRowIds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired),
158
177
 
178
+ /**
179
+ * If `true`, aggregation is disabled.
180
+ * @default false
181
+ */
182
+ disableAggregation: PropTypes.bool,
183
+
159
184
  /**
160
185
  * If `true`, the filtering will only be applied to the top level rows when grouping rows with the `treeData` prop.
161
186
  * @default false
@@ -216,6 +241,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
216
241
  */
217
242
  disableExtendRowFullWidth: PropTypes.bool,
218
243
 
244
+ /**
245
+ * If `true`, modification to a cell will not be discarded if the mode is changed from "edit" to "view" while processing props.
246
+ * @default false
247
+ */
248
+ disableIgnoreModificationsIfProcessingProps: PropTypes.bool,
249
+
219
250
  /**
220
251
  * If `true`, filtering with multiple columns is disabled.
221
252
  * @default false
@@ -273,8 +304,10 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
273
304
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
274
305
  */
275
306
  experimentalFeatures: PropTypes.shape({
307
+ aggregation: PropTypes.bool,
276
308
  newEditingApi: PropTypes.bool,
277
309
  preventCommitWhileValidating: PropTypes.bool,
310
+ rowPinning: PropTypes.bool,
278
311
  warnIfFocusStateIsNotSynced: PropTypes.bool
279
312
  }),
280
313
 
@@ -306,6 +339,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
306
339
  quickFilterValues: PropTypes.array
307
340
  }),
308
341
 
342
+ /**
343
+ * Determines the position of an aggregated value.
344
+ * @param {GridRowTreeNodeConfig | null} groupNode The current group (`null` being the top level group).
345
+ * @returns {GridAggregationPosition | null} Position of the aggregated value (if `null`, the group will not be aggregated).
346
+ * @default `(groupNode) => groupNode == null ? 'footer' : 'inline'`
347
+ */
348
+ getAggregationPosition: PropTypes.func,
349
+
309
350
  /**
310
351
  * Function that applies CSS classes dynamically on cells.
311
352
  * @param {GridCellParams} params With all properties from [[GridCellParams]].
@@ -485,6 +526,13 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
485
526
  */
486
527
  nonce: PropTypes.string,
487
528
 
529
+ /**
530
+ * Callback fired when the row grouping model changes.
531
+ * @param {GridAggregationModel} model The aggregated columns.
532
+ * @param {GridCallbackDetails} details Additional details for this callback.
533
+ */
534
+ onAggregationModelChange: PropTypes.func,
535
+
488
536
  /**
489
537
  * Callback fired when any cell is clicked.
490
538
  * @param {GridCellParams} params With all properties from [[GridCellParams]].
@@ -866,6 +914,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
866
914
  right: PropTypes.arrayOf(PropTypes.string)
867
915
  }),
868
916
 
917
+ /**
918
+ * Rows data to pin on top or bottom.
919
+ */
920
+ pinnedRows: PropTypes.shape({
921
+ bottom: PropTypes.array,
922
+ top: PropTypes.array
923
+ }),
924
+
869
925
  /**
870
926
  * Callback called before updating a row with new values in the row and cell editing.
871
927
  * Only applied if `props.experimentalFeatures.newEditingApi: true`.
@@ -1,5 +1,7 @@
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';
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, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer } from '@mui/x-data-grid-pro/internals';
2
2
  // Premium-only features
3
+ import { useGridAggregation, aggregationStateInitializer } from '../hooks/features/aggregation/useGridAggregation';
4
+ import { useGridAggregationPreProcessors } from '../hooks/features/aggregation/useGridAggregationPreProcessors';
3
5
  import { useGridRowGrouping, rowGroupingStateInitializer } from '../hooks/features/rowGrouping/useGridRowGrouping';
4
6
  import { useGridRowGroupingPreProcessors } from '../hooks/features/rowGrouping/useGridRowGroupingPreProcessors';
5
7
  import { useGridExcelExport } from '../hooks/features/export/useGridExcelExport';
@@ -15,6 +17,8 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
15
17
  useGridRowReorderPreProcessors(apiRef, props);
16
18
  useGridRowGroupingPreProcessors(apiRef, props);
17
19
  useGridTreeDataPreProcessors(apiRef, props);
20
+ useGridRowPinningPreProcessors(apiRef);
21
+ useGridAggregationPreProcessors(apiRef, props);
18
22
  useGridDetailPanelPreProcessors(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
19
23
  // Because it changes the order of the columns.
20
24
 
@@ -25,10 +29,12 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
25
29
  */
26
30
 
27
31
  useGridInitializeState(rowGroupingStateInitializer, apiRef, props);
32
+ useGridInitializeState(aggregationStateInitializer, apiRef, props);
28
33
  useGridInitializeState(selectionStateInitializer, apiRef, props);
29
34
  useGridInitializeState(detailPanelStateInitializer, apiRef, props);
30
35
  useGridInitializeState(columnPinningStateInitializer, apiRef, props);
31
36
  useGridInitializeState(columnsStateInitializer, apiRef, props);
37
+ useGridInitializeState(rowPinningStateInitializer, apiRef, props);
32
38
  useGridInitializeState(rowsStateInitializer, apiRef, props);
33
39
  useGridInitializeState((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
34
40
  useGridInitializeState(focusStateInitializer, apiRef, props);
@@ -43,9 +49,11 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
43
49
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
44
50
  useGridRowGrouping(apiRef, props);
45
51
  useGridTreeData(apiRef);
52
+ useGridAggregation(apiRef, props);
46
53
  useGridKeyboardNavigation(apiRef, props);
47
54
  useGridSelection(apiRef, props);
48
55
  useGridColumnPinning(apiRef, props);
56
+ useGridRowPinning(apiRef, props);
49
57
  useGridColumns(apiRef, props);
50
58
  useGridRows(apiRef, props);
51
59
  useGridParamsApi(apiRef);
@@ -54,7 +62,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
54
62
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
55
63
  useGridEditing(apiRef, props);
56
64
  useGridFocus(apiRef, props);
57
- useGridPreferencesPanel(apiRef);
65
+ useGridPreferencesPanel(apiRef, props);
58
66
  useGridFilter(apiRef, props);
59
67
  useGridSorting(apiRef, props);
60
68
  useGridDensity(apiRef, props);
@@ -2,13 +2,18 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
4
  import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT } from '@mui/x-data-grid-pro';
5
-
5
+ import { GRID_AGGREGATION_FUNCTIONS } from '../hooks/features/aggregation';
6
6
  /**
7
7
  * The default values of `DataGridPremiumPropsWithDefaultValue` to inject in the props of DataGridPremium.
8
8
  */
9
+
9
10
  export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO_PROPS_DEFAULT_VALUES, {
11
+ disableAggregation: false,
10
12
  disableRowGrouping: false,
11
- rowGroupingColumnMode: 'single'
13
+ rowGroupingColumnMode: 'single',
14
+ aggregationFunctions: GRID_AGGREGATION_FUNCTIONS,
15
+ aggregationRowsScope: 'filtered',
16
+ getAggregationPosition: groupNode => groupNode == null ? 'footer' : 'inline'
12
17
  });
13
18
  export const useDataGridPremiumProps = inProps => {
14
19
  const themedProps = useThemeProps({
@@ -29,9 +34,14 @@ export const useDataGridPremiumProps = inProps => {
29
34
  });
30
35
  return mergedComponents;
31
36
  }, [themedProps.components]);
32
- return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
33
- localeText,
34
- components,
35
- signature: 'DataGridPremium'
36
- }), [themedProps, localeText, components]);
37
+ return React.useMemo(() => {
38
+ var _themedProps$experime;
39
+
40
+ return _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
41
+ disableAggregation: themedProps.disableAggregation || !((_themedProps$experime = themedProps.experimentalFeatures) != null && _themedProps$experime.aggregation),
42
+ localeText,
43
+ components,
44
+ signature: 'DataGridPremium'
45
+ });
46
+ }, [themedProps, localeText, components]);
37
47
  };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { GridColDef } from '@mui/x-data-grid-pro';
3
+ interface GridAggregationColumnMenuItemsProps {
4
+ column: GridColDef;
5
+ label: string;
6
+ availableAggregationFunctions: string[];
7
+ }
8
+ export declare const GridAggregationColumnMenuItem: (props: GridAggregationColumnMenuItemsProps) => JSX.Element;
9
+ export {};
@@ -0,0 +1,93 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
4
+ import * as React from 'react';
5
+ import { useGridSelector } from '@mui/x-data-grid-pro';
6
+ import MenuItem from '@mui/material/MenuItem';
7
+ import FormControl from '@mui/material/FormControl';
8
+ import InputLabel from '@mui/material/InputLabel';
9
+ import { unstable_useId as useId } from '@mui/material/utils';
10
+ import Select from '@mui/material/Select';
11
+ import { useGridApiContext } from '../hooks/utils/useGridApiContext';
12
+ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
13
+ import { canColumnHaveAggregationFunction, getAggregationFunctionLabel } from '../hooks/features/aggregation/gridAggregationUtils';
14
+ import { gridAggregationModelSelector } from '../hooks/features/aggregation/gridAggregationSelectors';
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ export const GridAggregationColumnMenuItem = props => {
18
+ const {
19
+ column,
20
+ label,
21
+ availableAggregationFunctions
22
+ } = props;
23
+ const apiRef = useGridApiContext();
24
+ const rootProps = useGridRootProps();
25
+ const id = useId();
26
+ const aggregationModel = useGridSelector(apiRef, gridAggregationModelSelector);
27
+ const selectedAggregationRule = React.useMemo(() => {
28
+ if (!column || !aggregationModel[column.field]) {
29
+ return '';
30
+ }
31
+
32
+ const aggregationFunctionName = aggregationModel[column.field];
33
+
34
+ if (canColumnHaveAggregationFunction({
35
+ column,
36
+ aggregationFunctionName,
37
+ aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName]
38
+ })) {
39
+ return aggregationFunctionName;
40
+ }
41
+
42
+ return '';
43
+ }, [rootProps.aggregationFunctions, aggregationModel, column]);
44
+
45
+ const handleAggregationItemChange = event => {
46
+ const newAggregationItem = event.target.value || undefined;
47
+ const currentModel = gridAggregationModelSelector(apiRef);
48
+
49
+ const _column$field = column.field,
50
+ otherColumnItems = _objectWithoutPropertiesLoose(currentModel, [_column$field].map(_toPropertyKey));
51
+
52
+ const newModel = newAggregationItem == null ? otherColumnItems : _extends({}, otherColumnItems, {
53
+ [column.field]: newAggregationItem
54
+ });
55
+ apiRef.current.setAggregationModel(newModel);
56
+ apiRef.current.hideColumnMenu();
57
+ };
58
+
59
+ return /*#__PURE__*/_jsx(MenuItem, {
60
+ disableRipple: true,
61
+ children: /*#__PURE__*/_jsxs(FormControl, {
62
+ size: "small",
63
+ sx: {
64
+ width: 150
65
+ },
66
+ children: [/*#__PURE__*/_jsx(InputLabel, {
67
+ id: `${id}-label`,
68
+ children: label
69
+ }), /*#__PURE__*/_jsxs(Select, {
70
+ labelId: `${id}-label`,
71
+ id: `${id}-input`,
72
+ value: selectedAggregationRule,
73
+ label: label,
74
+ onChange: handleAggregationItemChange,
75
+ onBlur: e => e.stopPropagation(),
76
+ fullWidth: true,
77
+ children: [/*#__PURE__*/_jsx(MenuItem, {
78
+ value: "",
79
+ children: "..."
80
+ }), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_jsx(MenuItem, {
81
+ value: aggFunc,
82
+ children: getAggregationFunctionLabel({
83
+ apiRef,
84
+ aggregationRule: {
85
+ aggregationFunctionName: aggFunc,
86
+ aggregationFunction: rootProps.aggregationFunctions[aggFunc]
87
+ }
88
+ })
89
+ }, aggFunc))]
90
+ })]
91
+ })
92
+ });
93
+ };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { GridColumnHeaderParams } from '@mui/x-data-grid';
3
+ declare const GridAggregationHeader: (props: GridColumnHeaderParams) => JSX.Element | null;
4
+ export { GridAggregationHeader };
@@ -0,0 +1,94 @@
1
+ import * as React from 'react';
2
+ import { unstable_composeClasses as composeClasses } from '@mui/material';
3
+ import Box from '@mui/material/Box';
4
+ import { styled } from '@mui/material/styles';
5
+ import { getDataGridUtilityClass, gridClasses, GridColumnHeaderTitle, gridDensityHeaderHeightSelector, useGridSelector } from '@mui/x-data-grid';
6
+ import { getAggregationFunctionLabel } from '../hooks/features/aggregation/gridAggregationUtils';
7
+ import { useGridApiContext } from '../hooks/utils/useGridApiContext';
8
+ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ const GridAggregationHeaderRoot = styled(Box, {
12
+ name: 'MuiDataGrid',
13
+ slot: 'AggregationColumnHeader',
14
+ overridesResolver: (_, styles) => styles.aggregationColumnHeader
15
+ })({
16
+ display: 'flex',
17
+ flexDirection: 'column',
18
+ [`&.${gridClasses['aggregationColumnHeader--alignRight']}`]: {
19
+ alignItems: 'flex-end'
20
+ },
21
+ [`&.${gridClasses['aggregationColumnHeader--alignCenter']}`]: {
22
+ alignItems: 'center'
23
+ }
24
+ });
25
+ const GridAggregationFunctionLabel = styled('div', {
26
+ name: 'MuiDataGrid',
27
+ slot: 'AggregationColumnHeaderLabel',
28
+ overridesResolver: (_, styles) => styles.aggregationColumnHeaderLabel
29
+ })(({
30
+ theme
31
+ }) => {
32
+ return {
33
+ fontSize: theme.typography.caption.fontSize,
34
+ lineHeight: theme.typography.caption.fontSize,
35
+ marginTop: `calc(-2px - ${theme.typography.caption.fontSize})`,
36
+ fontWeight: theme.typography.fontWeightMedium,
37
+ color: theme.palette.primary.dark,
38
+ textTransform: 'uppercase'
39
+ };
40
+ });
41
+
42
+ const useUtilityClasses = ownerState => {
43
+ const {
44
+ classes,
45
+ colDef
46
+ } = ownerState;
47
+ const slots = {
48
+ root: ['aggregationColumnHeader', colDef.headerAlign === 'left' && 'aggregationColumnHeader--alignLeft', colDef.headerAlign === 'center' && 'aggregationColumnHeader--alignCenter', colDef.headerAlign === 'right' && 'aggregationColumnHeader--alignRight'],
49
+ aggregationLabel: ['aggregationColumnHeaderLabel']
50
+ };
51
+ return composeClasses(slots, getDataGridUtilityClass, classes);
52
+ };
53
+
54
+ const GridAggregationHeader = props => {
55
+ var _colDef$headerName;
56
+
57
+ const {
58
+ colDef,
59
+ aggregation
60
+ } = props;
61
+ const apiRef = useGridApiContext();
62
+ const rootProps = useGridRootProps();
63
+ const headerHeight = useGridSelector(apiRef, gridDensityHeaderHeightSelector);
64
+ const ownerState = {
65
+ classes: rootProps.classes,
66
+ headerHeight,
67
+ colDef
68
+ };
69
+ const classes = useUtilityClasses(ownerState);
70
+
71
+ if (!aggregation) {
72
+ return null;
73
+ }
74
+
75
+ const aggregationLabel = getAggregationFunctionLabel({
76
+ apiRef,
77
+ aggregationRule: aggregation.aggregationRule
78
+ });
79
+ return /*#__PURE__*/_jsxs(GridAggregationHeaderRoot, {
80
+ ownerState: ownerState,
81
+ className: classes.root,
82
+ children: [/*#__PURE__*/_jsx(GridColumnHeaderTitle, {
83
+ label: (_colDef$headerName = colDef.headerName) != null ? _colDef$headerName : colDef.field,
84
+ description: colDef.description,
85
+ columnWidth: colDef.computedWidth
86
+ }), /*#__PURE__*/_jsx(GridAggregationFunctionLabel, {
87
+ ownerState: ownerState,
88
+ className: classes.aggregationLabel,
89
+ children: aggregationLabel
90
+ })]
91
+ });
92
+ };
93
+
94
+ export { GridAggregationHeader };
@@ -1,3 +1,6 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["hideMenu", "options"];
1
4
  import * as React from 'react';
2
5
  import PropTypes from 'prop-types';
3
6
  import MenuItem from '@mui/material/MenuItem';
@@ -6,17 +9,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
9
 
7
10
  const GridExcelExportMenuItem = props => {
8
11
  const apiRef = useGridApiContext();
12
+
9
13
  const {
10
14
  hideMenu,
11
15
  options
12
- } = props;
13
- return /*#__PURE__*/_jsx(MenuItem, {
16
+ } = props,
17
+ other = _objectWithoutPropertiesLoose(props, _excluded);
18
+
19
+ return /*#__PURE__*/_jsx(MenuItem, _extends({
14
20
  onClick: () => {
15
21
  apiRef.current.exportDataAsExcel(options);
16
22
  hideMenu == null ? void 0 : hideMenu();
17
- },
23
+ }
24
+ }, other, {
18
25
  children: apiRef.current.getLocaleText('toolbarExportExcel')
19
- });
26
+ }));
20
27
  };
21
28
 
22
29
  process.env.NODE_ENV !== "production" ? GridExcelExportMenuItem.propTypes = {
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { GridRenderCellParams } from '@mui/x-data-grid';
3
+ import { Theme } from '@mui/material/styles';
4
+ import { SxProps } from '@mui/system';
5
+ interface GridFooterCellProps extends GridRenderCellParams {
6
+ sx?: SxProps<Theme>;
7
+ }
8
+ declare const GridFooterCell: (props: GridFooterCellProps) => JSX.Element;
9
+ export { GridFooterCell };