@mui/x-data-grid-premium 5.12.3 → 5.14.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 +147 -1
  2. package/DataGridPremium/DataGridPremium.js +48 -1
  3. package/DataGridPremium/useDataGridPremiumComponent.js +6 -1
  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 +104 -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 +5 -0
  22. package/hooks/features/aggregation/gridAggregationUtils.d.ts +40 -0
  23. package/hooks/features/aggregation/gridAggregationUtils.js +177 -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 +137 -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 +48 -1
  41. package/legacy/DataGridPremium/useDataGridPremiumComponent.js +6 -1
  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 +11 -0
  52. package/legacy/hooks/features/aggregation/gridAggregationUtils.js +189 -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 +140 -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 +46 -1
  66. package/models/gridApiPremium.d.ts +2 -2
  67. package/models/gridStatePremium.d.ts +3 -1
  68. package/modern/DataGridPremium/DataGridPremium.js +48 -1
  69. package/modern/DataGridPremium/useDataGridPremiumComponent.js +6 -1
  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 +5 -0
  80. package/modern/hooks/features/aggregation/gridAggregationUtils.js +175 -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 +135 -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 +48 -1
  94. package/node/DataGridPremium/useDataGridPremiumComponent.js +8 -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 +17 -0
  105. package/node/hooks/features/aggregation/gridAggregationUtils.js +212 -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 +161 -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 +6 -6
  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,152 @@
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.14.0
7
+
8
+ _Jul 21, 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
+ - 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
13
+ - ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
14
+ - 🌍 Improvements to different locales
15
+ - 📚 Documentation improvements
16
+ - 🐞 Bugfixes
17
+
18
+ ### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
19
+
20
+ #### Changes
21
+
22
+ - [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
23
+ - [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
24
+ - [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
25
+ - [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
26
+ - [DataGrid] Fix loading overlay position (#5558) @DanailH
27
+ - [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
28
+ - [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
29
+ - [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
30
+ - [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
31
+
32
+ ### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
33
+
34
+ #### Changes
35
+
36
+ - [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
37
+
38
+ ### Docs
39
+
40
+ - [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
41
+ - [docs] Remove blank line @oliviertassinari
42
+
43
+ ### Core
44
+
45
+ - [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
46
+ - [core] Polish on the bug issue template (#5525) @oliviertassinari
47
+ - [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
48
+
49
+ ## 5.13.1
50
+
51
+ _Jul 15, 2022_
52
+
53
+ We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
54
+
55
+ - ✏️ Enter edit mode when pasting in a cell with Ctrl+V (Cmd+V on macOS) (#5405) @alexfauquette
56
+ - 🌍 Many improvements to the locales
57
+ - 📚 Documentation improvements
58
+ - 🐞 Bugfixes
59
+
60
+ ### `@mui/x-data-grid@v5.13.1` / `@mui/x-data-grid-pro@v5.13.1` / `@mui/x-data-grid-premium@v5.13.1`
61
+
62
+ #### Changes
63
+
64
+ - [DataGrid] Fix blank space when using dynamic row height with pagination (#5315) @m4theushw
65
+ - [DataGrid] Start editing with uppercase letter and Ctrl+V (#5405) @alexfauquette
66
+ - [DataGrid] Fix some filters being removed from filter model on filter panel open (#5403) @cherniavskii
67
+ - [DataGridPro] Improve pinned column headers accessibility (#5370) @cherniavskii
68
+ - [l10n] Improve Dutch (nl-NL) locale (#5464) @developenguin
69
+ - [l10n] Improve French (fr-FR) locale (#3211) (#5420) @Zenoo
70
+ - [l10n] Improve German (de-DE) locale (#5448) @sebastianfrey
71
+ - [l10n] Improve Brazilian Portuguese (pt-BR) locale (#5394) @andrepxa
72
+ - [l10n] Improve Romanian (ro-RO) locale (#5449) @rolule
73
+
74
+ ### `@mui/x-date-pickers@v5.0.0-beta.1` / `@mui/x-date-picker-pro@5.0.0-beta.1`
75
+
76
+ #### Changes
77
+
78
+ - [pickers] Add Italian (it-IT) locale (#5467) @felixh10r
79
+ - [pickers] Add Spanish (es-ES) locale (#5468) @felixh10r
80
+ - [pickers] Improve French (fr-FR) locale (#5446) @Zenoo
81
+ - [pickers] Improve German (de-DE) locale (#5447) @sebastianfrey
82
+
83
+ ### Docs
84
+
85
+ - [docs] Fix typo in the sorting page (#5431) @JosephMarinier
86
+ - [docs] Fix description for "Striped rows" example (#5432) @lindapaiste
87
+ - [docs] Make a clear difference between the license and license key (#5316) @oliviertassinari
88
+ - [docs] Update pickers README files (#5456) @cherniavskii
89
+ - [docs] Clarify the scope of support for MUI X (#5423) @joserodolfofreitas
90
+
91
+ ### Core
92
+
93
+ - [core] Add technical support link to \_redirects (#5428) @joserodolfofreitas
94
+ - [core] Improve GitHub bug reproduction template (#5067) @joserodolfofreitas
95
+ - [core] Include playground pages in tsconfig (#5367) @cherniavskii
96
+ - [core] Sort keys like in material-ui @oliviertassinari
97
+ - [test] Wait for flags to load on regression tests (#5473) @m4theushw
98
+
99
+ ## 5.13.0
100
+
101
+ _Jul 7, 2022_
102
+
103
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
104
+
105
+ - 🎁 `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` are now in beta!
106
+
107
+ - ✨ Allow detail panel's height to match its content (#5163) @m4theushw
108
+
109
+ ```tsx
110
+ <DataGridPro getDetailPanelHeight={() => 'auto'} />
111
+ ```
112
+
113
+ - 🌍 Add Romanian (ro-RO) locale on the data grid (#5345) @rolule
114
+ - 📚 Documentation improvements
115
+ - 🐞 Bugfixes
116
+
117
+ ### `@mui/x-data-grid@v5.13.0` / `@mui/x-data-grid-pro@v5.13.0` / `@mui/x-data-grid-premium@v5.13.0`
118
+
119
+ #### Changes
120
+
121
+ - [DataGrid] Allows to customize variant of value input in filter panel (#4826) @alexfauquette
122
+ - [DataGrid] Add Romanian (ro-RO) locale (#5345) @rolule
123
+ - [DataGrid] Export Norwegian (nb-NO) locale (#5407) @cherniavskii
124
+ - [DataGrid] Fix broken "start editing" integration with Japanese (#5414) @mnajdova
125
+ - [DataGrid] Fix "stop editing" integration with IME e.g. Japanese (#5257) @Gumichocopengin8
126
+ - [DataGrid] Fix dimensions computation with `autoHeight` and scroll x (#5401) @flaviendelangle
127
+ - [DataGrid] Improve Slovak (sk-SK) locale (#5332) @msidlo
128
+ - [DataGrid] Mention Premium plan in error messages and docs warnings (#5328) @cherniavskii
129
+ - [DataGrid] Remove trailing spaces in filter input (#5279) @alexfauquette
130
+ - [DataGridPro] Allow to infer detail panel height from content (#5163) @m4theushw
131
+ - [DataGridPro] Fix the depth of nodes when switching from a non-flat tree to a flat tree (#5362) @flaviendelangle
132
+
133
+ ### `@mui/x-date-pickers@v5.0.0-beta.0` / `@mui/x-date-picker-pro@5.0.0-beta.0`
134
+
135
+ #### Changes
136
+
137
+ - [DateRangePicker] Fix keyboard selection (#5265) @alexfauquette
138
+ - [DayPicker] Remove empty space at the bottom of the day view (#5073) @flaviendelangle
139
+ - [pickers] Add missing type dependencies (#5331) @Methuselah96
140
+ - [pickers] Pass the generics to the components in the theme augmentation (#5199) @toruticas
141
+
142
+ ### Docs
143
+
144
+ - [docs] Explain how to use hooks inside a cell renderer (#5158) @flaviendelangle
145
+ - [docs] Fix server-side pagination demo (#5361) @cherniavskii
146
+ - [docs] Fix typo in the quick filter docs (#5313) @alexfauquette
147
+ - [docs] Improve the "Getting started" page (#5293) @alexfauquette
148
+ - [docs] New page for the pickers action bar customization (#5267) @flaviendelangle
149
+ - [docs] Revise and split up "Overview" page into "Introduction" (#4692) @samuelsycamore
150
+ - [docs] Use `useKeepGroupedColumnsHiddren` from the grid package on remaining demo (#5382) @flaviendelangle
151
+
6
152
  ## v5.12.3
7
153
 
8
154
  _Jun 23, 2022_
@@ -1363,7 +1509,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
1363
1509
  - [core] Fix `yarn prettier` script (#3292) @oliviertassinari
1364
1510
  - [core] Improve tests for Tree Data (#3366) @flaviendelangle
1365
1511
  - [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
1366
- - [core] Transition to a new StackOverflow tag (#3308) @oliviertassinari
1512
+ - [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
1367
1513
  - [core] Update monorepo (#3370) @flaviendelangle
1368
1514
  - [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
1369
1515
  - [test] Replace `useFakeTimers` (#3323) @m4theushw
@@ -275,6 +275,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
275
275
  experimentalFeatures: PropTypes.shape({
276
276
  newEditingApi: PropTypes.bool,
277
277
  preventCommitWhileValidating: PropTypes.bool,
278
+ private_aggregation: PropTypes.bool,
278
279
  warnIfFocusStateIsNotSynced: PropTypes.bool
279
280
  }),
280
281
 
@@ -323,7 +324,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
323
324
  /**
324
325
  * Function that returns the height of the row detail panel.
325
326
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
326
- * @returns {number} The height in pixels.
327
+ * @returns {number | string} The height in pixels or "auto" to use the content height.
327
328
  * @default "() => 500"
328
329
  */
329
330
  getDetailPanelHeight: PropTypes.func,
@@ -866,6 +867,52 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
866
867
  right: PropTypes.arrayOf(PropTypes.string)
867
868
  }),
868
869
 
870
+ /**
871
+ * Aggregation functions available on the grid.
872
+ * @default GRID_AGGREGATION_FUNCTIONS
873
+ * @ignore - do not document.
874
+ */
875
+ private_aggregationFunctions: PropTypes.object,
876
+
877
+ /**
878
+ * Set the aggregation model of the grid.
879
+ * @ignore - do not document.
880
+ */
881
+ private_aggregationModel: PropTypes.object,
882
+
883
+ /**
884
+ * Rows used to generate the aggregated value.
885
+ * If `filtered`, the aggregated values will be generated using only the rows currently passing the filtering process.
886
+ * If `all`, the aggregated values will be generated using all the rows.
887
+ * @default "filtered"
888
+ * @ignore - do not document.
889
+ */
890
+ private_aggregationRowsScope: PropTypes.oneOf(['all', 'filtered']),
891
+
892
+ /**
893
+ * If `true`, aggregation is disabled.
894
+ * @default false
895
+ * @ignore - do not document.
896
+ */
897
+ private_disableAggregation: PropTypes.bool,
898
+
899
+ /**
900
+ * Determines the position of an aggregated value.
901
+ * @param {GridRowTreeNodeConfig | null} groupNode The current group (`null` being the top level group).
902
+ * @returns {GridAggregationPosition | null} Position of the aggregated value (if `null`, the group will not be aggregated).
903
+ * @default `(groupNode) => groupNode == null ? 'footer' : 'inline'`
904
+ * @ignore - do not document.
905
+ */
906
+ private_getAggregationPosition: PropTypes.func,
907
+
908
+ /**
909
+ * Callback fired when the row grouping model changes.
910
+ * @param {GridAggregationModel} model The aggregated columns.
911
+ * @param {GridCallbackDetails} details Additional details for this callback.
912
+ * @ignore - do not document.
913
+ */
914
+ private_onAggregationModelChange: PropTypes.func,
915
+
869
916
  /**
870
917
  * Callback called before updating a row with new values in the row and cell editing.
871
918
  * Only applied if `props.experimentalFeatures.newEditingApi: true`.
@@ -1,5 +1,7 @@
1
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
+ 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,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
15
17
  useGridRowReorderPreProcessors(apiRef, props);
16
18
  useGridRowGroupingPreProcessors(apiRef, props);
17
19
  useGridTreeDataPreProcessors(apiRef, props);
20
+ useGridAggregationPreProcessors(apiRef, props);
18
21
  useGridDetailPanelPreProcessors(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
19
22
  // Because it changes the order of the columns.
20
23
 
@@ -25,6 +28,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
25
28
  */
26
29
 
27
30
  useGridInitializeState(rowGroupingStateInitializer, apiRef, props);
31
+ useGridInitializeState(aggregationStateInitializer, apiRef, props);
28
32
  useGridInitializeState(selectionStateInitializer, apiRef, props);
29
33
  useGridInitializeState(detailPanelStateInitializer, apiRef, props);
30
34
  useGridInitializeState(columnPinningStateInitializer, apiRef, props);
@@ -43,6 +47,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
43
47
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
44
48
  useGridRowGrouping(apiRef, props);
45
49
  useGridTreeData(apiRef);
50
+ useGridAggregation(apiRef, props);
46
51
  useGridKeyboardNavigation(apiRef, props);
47
52
  useGridSelection(apiRef, props);
48
53
  useGridColumnPinning(apiRef, props);
@@ -54,7 +59,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
54
59
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
55
60
  useGridEditing(apiRef, props);
56
61
  useGridFocus(apiRef, props);
57
- useGridPreferencesPanel(apiRef);
62
+ useGridPreferencesPanel(apiRef, props);
58
63
  useGridFilter(apiRef, props);
59
64
  useGridSorting(apiRef, props);
60
65
  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 { PRIVATE_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
+ private_disableAggregation: false,
10
12
  disableRowGrouping: false,
11
- rowGroupingColumnMode: 'single'
13
+ rowGroupingColumnMode: 'single',
14
+ private_aggregationFunctions: PRIVATE_GRID_AGGREGATION_FUNCTIONS,
15
+ private_aggregationRowsScope: 'filtered',
16
+ private_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
+ private_disableAggregation: themedProps.private_disableAggregation || !((_themedProps$experime = themedProps.experimentalFeatures) != null && _themedProps$experime.private_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.private_aggregationFunctions[aggregationFunctionName]
38
+ })) {
39
+ return aggregationFunctionName;
40
+ }
41
+
42
+ return '';
43
+ }, [rootProps.private_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.private_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.private_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 };
@@ -0,0 +1,51 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["formattedValue", "colDef", "cellMode", "row", "api", "getValue", "id", "value", "rowNode", "field", "focusElementRef", "hasFocus", "tabIndex", "isEditable"];
4
+ import * as React from 'react';
5
+ import { getDataGridUtilityClass } from '@mui/x-data-grid';
6
+ import { styled } from '@mui/material/styles';
7
+ import Box from '@mui/material/Box';
8
+ import { unstable_composeClasses as composeClasses } from '@mui/material';
9
+ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const GridFooterCellRoot = styled(Box, {
12
+ name: 'MuiDataGrid',
13
+ slot: 'FooterCell',
14
+ overridesResolver: (_, styles) => styles.footerCell
15
+ })(({
16
+ theme
17
+ }) => ({
18
+ fontWeight: theme.typography.fontWeightMedium,
19
+ color: theme.palette.primary.dark
20
+ }));
21
+
22
+ const useUtilityClasses = ownerState => {
23
+ const {
24
+ classes
25
+ } = ownerState;
26
+ const slots = {
27
+ root: ['footerCell']
28
+ };
29
+ return composeClasses(slots, getDataGridUtilityClass, classes);
30
+ };
31
+
32
+ const GridFooterCell = props => {
33
+ const {
34
+ formattedValue
35
+ } = props,
36
+ other = _objectWithoutPropertiesLoose(props, _excluded);
37
+
38
+ const rootProps = useGridRootProps();
39
+ const ownerState = {
40
+ classes: rootProps.classes
41
+ };
42
+ const classes = useUtilityClasses(ownerState);
43
+ return /*#__PURE__*/_jsx(GridFooterCellRoot, _extends({
44
+ ownerState: ownerState,
45
+ className: classes.root
46
+ }, other, {
47
+ children: formattedValue
48
+ }));
49
+ };
50
+
51
+ export { GridFooterCell };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { GridRenderCellParams } from '@mui/x-data-grid-pro';
3
+ declare const GridGroupingColumnFooterCell: (props: GridRenderCellParams) => JSX.Element;
4
+ export { GridGroupingColumnFooterCell };
@@ -0,0 +1,29 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
4
+ import { GridFooterCell } from './GridFooterCell';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+
7
+ const GridGroupingColumnFooterCell = props => {
8
+ const {
9
+ rowNode
10
+ } = props;
11
+ const rootProps = useGridRootProps();
12
+ let marginLeft;
13
+
14
+ if (rowNode.parent == null) {
15
+ marginLeft = 0;
16
+ } else if (rootProps.rowGroupingColumnMode === 'multiple') {
17
+ marginLeft = 2;
18
+ } else {
19
+ marginLeft = rowNode.depth * 2;
20
+ }
21
+
22
+ return /*#__PURE__*/_jsx(GridFooterCell, _extends({
23
+ sx: {
24
+ ml: marginLeft
25
+ }
26
+ }, props));
27
+ };
28
+
29
+ export { GridGroupingColumnFooterCell };
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { GridApiPremium } from '../../../models/gridApiPremium';
3
+ import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
4
+ import { GridAggregationFunction, GridAggregationLookup } from './gridAggregationInterfaces';
5
+ export declare const createAggregationLookup: ({ apiRef, aggregationFunctions, aggregationRowsScope, getAggregationPosition, }: {
6
+ apiRef: React.MutableRefObject<GridApiPremium>;
7
+ aggregationFunctions: Record<string, GridAggregationFunction>;
8
+ aggregationRowsScope: DataGridPremiumProcessedProps['private_aggregationRowsScope'];
9
+ getAggregationPosition: DataGridPremiumProcessedProps['private_getAggregationPosition'];
10
+ }) => GridAggregationLookup;