@mui/x-data-grid-premium 5.14.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.
- package/CHANGELOG.md +62 -5
- package/DataGridPremium/DataGridPremium.js +53 -44
- package/DataGridPremium/useDataGridPremiumComponent.js +4 -1
- package/DataGridPremium/useDataGridPremiumProps.js +6 -6
- package/components/GridAggregationColumnMenuItem.js +4 -4
- package/hooks/features/aggregation/createAggregationLookup.d.ts +2 -2
- package/hooks/features/aggregation/gridAggregationFunctions.d.ts +1 -1
- package/hooks/features/aggregation/gridAggregationFunctions.js +1 -1
- package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +1 -2
- package/hooks/features/aggregation/gridAggregationSelectors.d.ts +1 -1
- package/hooks/features/aggregation/gridAggregationSelectors.js +3 -4
- package/hooks/features/aggregation/gridAggregationUtils.d.ts +5 -4
- package/hooks/features/aggregation/gridAggregationUtils.js +27 -16
- package/hooks/features/aggregation/index.d.ts +1 -1
- package/hooks/features/aggregation/index.js +1 -1
- package/hooks/features/aggregation/useGridAggregation.d.ts +2 -2
- package/hooks/features/aggregation/useGridAggregation.js +17 -17
- package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
- package/hooks/features/aggregation/useGridAggregationPreProcessors.js +17 -16
- package/index.js +1 -1
- package/legacy/DataGridPremium/DataGridPremium.js +53 -44
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +4 -1
- package/legacy/DataGridPremium/useDataGridPremiumProps.js +6 -6
- package/legacy/components/GridAggregationColumnMenuItem.js +4 -4
- package/legacy/hooks/features/aggregation/gridAggregationFunctions.js +1 -1
- package/legacy/hooks/features/aggregation/gridAggregationSelectors.js +4 -5
- package/legacy/hooks/features/aggregation/gridAggregationUtils.js +27 -16
- package/legacy/hooks/features/aggregation/index.js +1 -1
- package/legacy/hooks/features/aggregation/useGridAggregation.js +17 -17
- package/legacy/hooks/features/aggregation/useGridAggregationPreProcessors.js +17 -16
- package/legacy/index.js +1 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridPremiumProps.d.ts +7 -13
- package/models/gridApiPremium.d.ts +2 -2
- package/models/gridStatePremium.d.ts +2 -2
- package/modern/DataGridPremium/DataGridPremium.js +53 -44
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +4 -1
- package/modern/DataGridPremium/useDataGridPremiumProps.js +6 -6
- package/modern/components/GridAggregationColumnMenuItem.js +4 -4
- package/modern/hooks/features/aggregation/gridAggregationFunctions.js +1 -1
- package/modern/hooks/features/aggregation/gridAggregationSelectors.js +3 -4
- package/modern/hooks/features/aggregation/gridAggregationUtils.js +27 -16
- package/modern/hooks/features/aggregation/index.js +1 -1
- package/modern/hooks/features/aggregation/useGridAggregation.js +16 -16
- package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +17 -16
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +53 -44
- package/node/DataGridPremium/useDataGridPremiumComponent.js +3 -0
- package/node/DataGridPremium/useDataGridPremiumProps.js +5 -5
- package/node/components/GridAggregationColumnMenuItem.js +4 -4
- package/node/hooks/features/aggregation/gridAggregationFunctions.js +3 -3
- package/node/hooks/features/aggregation/gridAggregationSelectors.js +5 -6
- package/node/hooks/features/aggregation/gridAggregationUtils.js +29 -18
- package/node/hooks/features/aggregation/index.js +6 -6
- package/node/hooks/features/aggregation/useGridAggregation.js +17 -17
- package/node/hooks/features/aggregation/useGridAggregationPreProcessors.js +17 -16
- package/node/index.js +1 -1
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +4 -4
- package/typeOverloads/modules.d.ts +2 -2
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,63 @@
|
|
|
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
|
+
|
|
6
63
|
## 5.14.0
|
|
7
64
|
|
|
8
65
|
_Jul 21, 2022_
|
|
@@ -306,7 +363,7 @@ _May 31, 2022_
|
|
|
306
363
|
|
|
307
364
|
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
308
365
|
|
|
309
|
-
- 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/
|
|
366
|
+
- 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/row-height/#dynamic-row-height) (#4859) @m4theushw
|
|
310
367
|
|
|
311
368
|
<img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
|
|
312
369
|
|
|
@@ -623,7 +680,7 @@ _Apr 25, 2022_
|
|
|
623
680
|
|
|
624
681
|
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
625
682
|
|
|
626
|
-
- 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/
|
|
683
|
+
- 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/row-ordering/) (#4034) @DanailH
|
|
627
684
|
|
|
628
685
|
<img src="https://user-images.githubusercontent.com/5858539/165091263-23472fbb-a989-44b8-849a-d2185adfe13b.gif" width="800">
|
|
629
686
|
|
|
@@ -887,7 +944,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
887
944
|
<DataGrid getRowSpacing={() => ({ top: 10, bottom: 10 })} />
|
|
888
945
|
```
|
|
889
946
|
|
|
890
|
-
Check the [documentation](https://mui.com/x/react-data-grid/
|
|
947
|
+
Check the [documentation](https://mui.com/x/react-data-grid/row-height/#row-spacing) for more information.
|
|
891
948
|
|
|
892
949
|
### `@mui/x-data-grid@v5.6.1` / `@mui/x-data-grid-pro@v5.6.1`
|
|
893
950
|
|
|
@@ -1141,7 +1198,7 @@ _Jan 28, 2022_
|
|
|
1141
1198
|
|
|
1142
1199
|
A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
1143
1200
|
|
|
1144
|
-
- 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/
|
|
1201
|
+
- 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/row-height/#variable-row-height) (#438) @DanailH
|
|
1145
1202
|
|
|
1146
1203
|
Allows for setting a row-specific height.
|
|
1147
1204
|
By default, all rows have the same height, but now you can set the height on a per-row basis.
|
|
@@ -3793,7 +3850,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
|
|
|
3793
3850
|
- 🎁 Add `onRowsScrollEnd` to support infinite loading (#1199) @DanailH
|
|
3794
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.
|
|
3795
3852
|
|
|
3796
|
-
See the documentation for [more details](https://mui.com/x/react-data-grid/
|
|
3853
|
+
See the documentation for [more details](https://mui.com/x/react-data-grid/row-updates/#infinite-loading).
|
|
3797
3854
|
|
|
3798
3855
|
- 🕹 Provide the ability to sort by multiple columns using Shift+click (#1203) @dtassone
|
|
3799
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,9 +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,
|
|
278
|
-
|
|
310
|
+
rowPinning: PropTypes.bool,
|
|
279
311
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
280
312
|
}),
|
|
281
313
|
|
|
@@ -307,6 +339,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
307
339
|
quickFilterValues: PropTypes.array
|
|
308
340
|
}),
|
|
309
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
|
+
|
|
310
350
|
/**
|
|
311
351
|
* Function that applies CSS classes dynamically on cells.
|
|
312
352
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -486,6 +526,13 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
486
526
|
*/
|
|
487
527
|
nonce: PropTypes.string,
|
|
488
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
|
+
|
|
489
536
|
/**
|
|
490
537
|
* Callback fired when any cell is clicked.
|
|
491
538
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -868,50 +915,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
868
915
|
}),
|
|
869
916
|
|
|
870
917
|
/**
|
|
871
|
-
*
|
|
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.
|
|
918
|
+
* Rows data to pin on top or bottom.
|
|
889
919
|
*/
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
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,
|
|
920
|
+
pinnedRows: PropTypes.shape({
|
|
921
|
+
bottom: PropTypes.array,
|
|
922
|
+
top: PropTypes.array
|
|
923
|
+
}),
|
|
915
924
|
|
|
916
925
|
/**
|
|
917
926
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, 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
3
|
import { useGridAggregation, aggregationStateInitializer } from '../hooks/features/aggregation/useGridAggregation';
|
|
4
4
|
import { useGridAggregationPreProcessors } from '../hooks/features/aggregation/useGridAggregationPreProcessors';
|
|
@@ -17,6 +17,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
17
17
|
useGridRowReorderPreProcessors(apiRef, props);
|
|
18
18
|
useGridRowGroupingPreProcessors(apiRef, props);
|
|
19
19
|
useGridTreeDataPreProcessors(apiRef, props);
|
|
20
|
+
useGridRowPinningPreProcessors(apiRef);
|
|
20
21
|
useGridAggregationPreProcessors(apiRef, props);
|
|
21
22
|
useGridDetailPanelPreProcessors(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
|
|
22
23
|
// Because it changes the order of the columns.
|
|
@@ -33,6 +34,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
33
34
|
useGridInitializeState(detailPanelStateInitializer, apiRef, props);
|
|
34
35
|
useGridInitializeState(columnPinningStateInitializer, apiRef, props);
|
|
35
36
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
37
|
+
useGridInitializeState(rowPinningStateInitializer, apiRef, props);
|
|
36
38
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
37
39
|
useGridInitializeState((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
|
|
38
40
|
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
@@ -51,6 +53,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
51
53
|
useGridKeyboardNavigation(apiRef, props);
|
|
52
54
|
useGridSelection(apiRef, props);
|
|
53
55
|
useGridColumnPinning(apiRef, props);
|
|
56
|
+
useGridRowPinning(apiRef, props);
|
|
54
57
|
useGridColumns(apiRef, props);
|
|
55
58
|
useGridRows(apiRef, props);
|
|
56
59
|
useGridParamsApi(apiRef);
|
|
@@ -2,18 +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
|
-
import {
|
|
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
10
|
export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO_PROPS_DEFAULT_VALUES, {
|
|
11
|
-
|
|
11
|
+
disableAggregation: false,
|
|
12
12
|
disableRowGrouping: false,
|
|
13
13
|
rowGroupingColumnMode: 'single',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
aggregationFunctions: GRID_AGGREGATION_FUNCTIONS,
|
|
15
|
+
aggregationRowsScope: 'filtered',
|
|
16
|
+
getAggregationPosition: groupNode => groupNode == null ? 'footer' : 'inline'
|
|
17
17
|
});
|
|
18
18
|
export const useDataGridPremiumProps = inProps => {
|
|
19
19
|
const themedProps = useThemeProps({
|
|
@@ -38,7 +38,7 @@ export const useDataGridPremiumProps = inProps => {
|
|
|
38
38
|
var _themedProps$experime;
|
|
39
39
|
|
|
40
40
|
return _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
|
|
41
|
-
|
|
41
|
+
disableAggregation: themedProps.disableAggregation || !((_themedProps$experime = themedProps.experimentalFeatures) != null && _themedProps$experime.aggregation),
|
|
42
42
|
localeText,
|
|
43
43
|
components,
|
|
44
44
|
signature: 'DataGridPremium'
|
|
@@ -34,13 +34,13 @@ export const GridAggregationColumnMenuItem = props => {
|
|
|
34
34
|
if (canColumnHaveAggregationFunction({
|
|
35
35
|
column,
|
|
36
36
|
aggregationFunctionName,
|
|
37
|
-
aggregationFunction: rootProps.
|
|
37
|
+
aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName]
|
|
38
38
|
})) {
|
|
39
39
|
return aggregationFunctionName;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
return '';
|
|
43
|
-
}, [rootProps.
|
|
43
|
+
}, [rootProps.aggregationFunctions, aggregationModel, column]);
|
|
44
44
|
|
|
45
45
|
const handleAggregationItemChange = event => {
|
|
46
46
|
const newAggregationItem = event.target.value || undefined;
|
|
@@ -52,7 +52,7 @@ export const GridAggregationColumnMenuItem = props => {
|
|
|
52
52
|
const newModel = newAggregationItem == null ? otherColumnItems : _extends({}, otherColumnItems, {
|
|
53
53
|
[column.field]: newAggregationItem
|
|
54
54
|
});
|
|
55
|
-
apiRef.current.
|
|
55
|
+
apiRef.current.setAggregationModel(newModel);
|
|
56
56
|
apiRef.current.hideColumnMenu();
|
|
57
57
|
};
|
|
58
58
|
|
|
@@ -83,7 +83,7 @@ export const GridAggregationColumnMenuItem = props => {
|
|
|
83
83
|
apiRef,
|
|
84
84
|
aggregationRule: {
|
|
85
85
|
aggregationFunctionName: aggFunc,
|
|
86
|
-
aggregationFunction: rootProps.
|
|
86
|
+
aggregationFunction: rootProps.aggregationFunctions[aggFunc]
|
|
87
87
|
}
|
|
88
88
|
})
|
|
89
89
|
}, aggFunc))]
|
|
@@ -5,6 +5,6 @@ import { GridAggregationFunction, GridAggregationLookup } from './gridAggregatio
|
|
|
5
5
|
export declare const createAggregationLookup: ({ apiRef, aggregationFunctions, aggregationRowsScope, getAggregationPosition, }: {
|
|
6
6
|
apiRef: React.MutableRefObject<GridApiPremium>;
|
|
7
7
|
aggregationFunctions: Record<string, GridAggregationFunction>;
|
|
8
|
-
aggregationRowsScope: DataGridPremiumProcessedProps['
|
|
9
|
-
getAggregationPosition: DataGridPremiumProcessedProps['
|
|
8
|
+
aggregationRowsScope: DataGridPremiumProcessedProps['aggregationRowsScope'];
|
|
9
|
+
getAggregationPosition: DataGridPremiumProcessedProps['getAggregationPosition'];
|
|
10
10
|
}) => GridAggregationLookup;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridAggregationFunction } from './gridAggregationInterfaces';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const GRID_AGGREGATION_FUNCTIONS: {
|
|
3
3
|
sum: GridAggregationFunction<number, number, number>;
|
|
4
4
|
avg: GridAggregationFunction<number, number, number>;
|
|
5
5
|
min: GridAggregationFunction<number | Date, number | Date, number | Date>;
|
|
@@ -14,9 +14,8 @@ export interface GridAggregationApi {
|
|
|
14
14
|
/**
|
|
15
15
|
* Sets the aggregation model to the one given by `model`.
|
|
16
16
|
* @param {GridAggregationModel} model The aggregation model.
|
|
17
|
-
* @ignore - do not document.
|
|
18
17
|
*/
|
|
19
|
-
|
|
18
|
+
setAggregationModel: (model: GridAggregationModel) => void;
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* Grid aggregation function definition interface.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GridStatePremium } from '../../../models/gridStatePremium';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const gridAggregationStateSelector: (state: GridStatePremium) => import("./gridAggregationInterfaces").GridAggregationState;
|
|
3
3
|
export declare const gridAggregationModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationModel>;
|
|
4
4
|
export declare const gridAggregationLookupSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationLookup>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createSelector } from '@mui/x-data-grid-pro/internals';
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const gridAggregationLookupSelector = createSelector(private_gridAggregationStateSelector, aggregationState => aggregationState.lookup);
|
|
2
|
+
export const gridAggregationStateSelector = state => state.aggregation;
|
|
3
|
+
export const gridAggregationModelSelector = createSelector(gridAggregationStateSelector, aggregationState => aggregationState.model);
|
|
4
|
+
export const gridAggregationLookupSelector = createSelector(gridAggregationStateSelector, aggregationState => aggregationState.lookup);
|
|
@@ -5,8 +5,8 @@ import { GridAggregationFunction, GridAggregationModel, GridAggregationRule, Gri
|
|
|
5
5
|
import { GridStatePremium } from '../../../models/gridStatePremium';
|
|
6
6
|
import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
7
7
|
import { GridApiPremium } from '../../../models/gridApiPremium';
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
8
|
+
export declare const GRID_AGGREGATION_ROOT_FOOTER_ROW_ID = "auto-generated-group-footer-root";
|
|
9
|
+
export declare const getAggregationFooterRowIdFromGroupId: (groupId: GridRowId | null) => string;
|
|
10
10
|
export declare const canColumnHaveAggregationFunction: ({ column, aggregationFunctionName, aggregationFunction, }: {
|
|
11
11
|
column: GridColDef | undefined;
|
|
12
12
|
aggregationFunctionName: string;
|
|
@@ -25,10 +25,11 @@ export declare const getAggregationRules: ({ columnsLookup, aggregationModel, ag
|
|
|
25
25
|
/**
|
|
26
26
|
* Add a footer for each group that has at least one column with an aggregated value.
|
|
27
27
|
*/
|
|
28
|
-
export declare const addFooterRows: ({ groupingParams, aggregationRules, getAggregationPosition, }: {
|
|
28
|
+
export declare const addFooterRows: ({ groupingParams, aggregationRules, getAggregationPosition, apiRef, }: {
|
|
29
29
|
groupingParams: GridRowTreeCreationValue;
|
|
30
30
|
aggregationRules: GridAggregationRules;
|
|
31
|
-
getAggregationPosition: DataGridPremiumProcessedProps['
|
|
31
|
+
getAggregationPosition: DataGridPremiumProcessedProps['getAggregationPosition'];
|
|
32
|
+
apiRef: React.MutableRefObject<GridApiPremium>;
|
|
32
33
|
}) => GridRowTreeCreationValue;
|
|
33
34
|
/**
|
|
34
35
|
* Compares two sets of aggregation rules to determine if they are equal or not.
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { capitalize } from '@mui/material';
|
|
3
|
-
import { isDeepEqual } from '@mui/x-data-grid-pro/internals';
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
export const private_getAggregationFooterRowIdFromGroupId = groupId => {
|
|
3
|
+
import { addPinnedRow, isDeepEqual } from '@mui/x-data-grid-pro/internals';
|
|
4
|
+
export const GRID_AGGREGATION_ROOT_FOOTER_ROW_ID = 'auto-generated-group-footer-root';
|
|
5
|
+
export const getAggregationFooterRowIdFromGroupId = groupId => {
|
|
7
6
|
if (groupId == null) {
|
|
8
|
-
return
|
|
7
|
+
return GRID_AGGREGATION_ROOT_FOOTER_ROW_ID;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
return `auto-generated-group-footer-${groupId}`;
|
|
@@ -15,7 +14,7 @@ export const canColumnHaveAggregationFunction = ({
|
|
|
15
14
|
aggregationFunctionName,
|
|
16
15
|
aggregationFunction
|
|
17
16
|
}) => {
|
|
18
|
-
if (!column || !column.
|
|
17
|
+
if (!column || !column.aggregable) {
|
|
19
18
|
return false;
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -23,8 +22,8 @@ export const canColumnHaveAggregationFunction = ({
|
|
|
23
22
|
return false;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
if (column.
|
|
27
|
-
return column.
|
|
25
|
+
if (column.availableAggregationFunctions != null) {
|
|
26
|
+
return column.availableAggregationFunctions.includes(aggregationFunctionName);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
if (!aggregationFunction.columnTypes) {
|
|
@@ -42,7 +41,7 @@ export const getAvailableAggregationFunctions = ({
|
|
|
42
41
|
aggregationFunction: aggregationFunctions[aggregationFunctionName]
|
|
43
42
|
}));
|
|
44
43
|
export const mergeStateWithAggregationModel = aggregationModel => state => _extends({}, state, {
|
|
45
|
-
|
|
44
|
+
aggregation: _extends({}, state.aggregation, {
|
|
46
45
|
model: aggregationModel
|
|
47
46
|
})
|
|
48
47
|
});
|
|
@@ -73,7 +72,8 @@ export const getAggregationRules = ({
|
|
|
73
72
|
export const addFooterRows = ({
|
|
74
73
|
groupingParams,
|
|
75
74
|
aggregationRules,
|
|
76
|
-
getAggregationPosition
|
|
75
|
+
getAggregationPosition,
|
|
76
|
+
apiRef
|
|
77
77
|
}) => {
|
|
78
78
|
if (Object.keys(aggregationRules).length === 0) {
|
|
79
79
|
return groupingParams;
|
|
@@ -94,7 +94,7 @@ export const addFooterRows = ({
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
const footerId =
|
|
97
|
+
const footerId = getAggregationFooterRowIdFromGroupId(groupId);
|
|
98
98
|
ids.push(footerId);
|
|
99
99
|
idRowsLookup[footerId] = {};
|
|
100
100
|
tree[footerId] = {
|
|
@@ -112,9 +112,8 @@ export const addFooterRows = ({
|
|
|
112
112
|
footerId
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
};
|
|
115
|
+
}; // If the tree is flat, we don't need to loop through the rows
|
|
116
116
|
|
|
117
|
-
addGroupFooter(null); // If the tree is flat, we don't need to loop through the rows
|
|
118
117
|
|
|
119
118
|
if (groupingParams.treeDepth > 1) {
|
|
120
119
|
groupingParams.ids.forEach(parentId => {
|
|
@@ -128,11 +127,23 @@ export const addFooterRows = ({
|
|
|
128
127
|
});
|
|
129
128
|
}
|
|
130
129
|
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
let newGroupingParams = _extends({}, groupingParams, {
|
|
131
|
+
tree,
|
|
133
132
|
idRowsLookup,
|
|
134
|
-
|
|
133
|
+
ids
|
|
135
134
|
});
|
|
135
|
+
|
|
136
|
+
if (getAggregationPosition(null) === 'footer') {
|
|
137
|
+
newGroupingParams = addPinnedRow({
|
|
138
|
+
groupingParams: newGroupingParams,
|
|
139
|
+
rowModel: {},
|
|
140
|
+
rowId: getAggregationFooterRowIdFromGroupId(null),
|
|
141
|
+
position: 'bottom',
|
|
142
|
+
apiRef
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return _extends({}, groupingParams, newGroupingParams);
|
|
136
147
|
};
|
|
137
148
|
/**
|
|
138
149
|
* Compares two sets of aggregation rules to determine if they are equal or not.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './gridAggregationInterfaces';
|
|
2
2
|
export * from './gridAggregationSelectors';
|
|
3
3
|
export * from './gridAggregationFunctions';
|
|
4
|
-
export {
|
|
4
|
+
export { GRID_AGGREGATION_ROOT_FOOTER_ROW_ID, getAggregationFooterRowIdFromGroupId, } from './gridAggregationUtils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './gridAggregationInterfaces';
|
|
2
2
|
export * from './gridAggregationSelectors';
|
|
3
3
|
export * from './gridAggregationFunctions';
|
|
4
|
-
export {
|
|
4
|
+
export { GRID_AGGREGATION_ROOT_FOOTER_ROW_ID, getAggregationFooterRowIdFromGroupId } from './gridAggregationUtils';
|
|
@@ -2,5 +2,5 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridStateInitializer } from '@mui/x-data-grid-pro/internals';
|
|
3
3
|
import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
4
4
|
import { GridApiPremium } from '../../../models/gridApiPremium';
|
|
5
|
-
export declare const aggregationStateInitializer: GridStateInitializer<Pick<DataGridPremiumProcessedProps, '
|
|
6
|
-
export declare const useGridAggregation: (apiRef: React.MutableRefObject<GridApiPremium>, props: Pick<DataGridPremiumProcessedProps, '
|
|
5
|
+
export declare const aggregationStateInitializer: GridStateInitializer<Pick<DataGridPremiumProcessedProps, 'aggregationModel' | 'initialState'>, GridApiPremium>;
|
|
6
|
+
export declare const useGridAggregation: (apiRef: React.MutableRefObject<GridApiPremium>, props: Pick<DataGridPremiumProcessedProps, 'onAggregationModelChange' | 'initialState' | 'aggregationModel' | 'getAggregationPosition' | 'aggregationFunctions' | 'aggregationRowsScope' | 'disableAggregation' | 'rowGroupingColumnMode'>) => void;
|