@mui/x-data-grid-premium 5.14.0 → 5.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +147 -5
  2. package/DataGridPremium/DataGridPremium.js +54 -45
  3. package/DataGridPremium/useDataGridPremiumComponent.js +4 -1
  4. package/DataGridPremium/useDataGridPremiumProps.js +6 -6
  5. package/components/GridAggregationColumnMenuItem.js +4 -4
  6. package/hooks/features/aggregation/createAggregationLookup.d.ts +2 -2
  7. package/hooks/features/aggregation/gridAggregationFunctions.d.ts +1 -1
  8. package/hooks/features/aggregation/gridAggregationFunctions.js +1 -1
  9. package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +1 -2
  10. package/hooks/features/aggregation/gridAggregationSelectors.d.ts +1 -1
  11. package/hooks/features/aggregation/gridAggregationSelectors.js +3 -4
  12. package/hooks/features/aggregation/gridAggregationUtils.d.ts +5 -4
  13. package/hooks/features/aggregation/gridAggregationUtils.js +27 -16
  14. package/hooks/features/aggregation/index.d.ts +1 -1
  15. package/hooks/features/aggregation/index.js +1 -1
  16. package/hooks/features/aggregation/useGridAggregation.d.ts +2 -2
  17. package/hooks/features/aggregation/useGridAggregation.js +17 -17
  18. package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
  19. package/hooks/features/aggregation/useGridAggregationPreProcessors.js +17 -16
  20. package/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
  21. package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +2 -1
  22. package/hooks/features/rowGrouping/gridRowGroupingUtils.js +30 -21
  23. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
  24. package/index.js +1 -1
  25. package/legacy/DataGridPremium/DataGridPremium.js +54 -45
  26. package/legacy/DataGridPremium/useDataGridPremiumComponent.js +4 -1
  27. package/legacy/DataGridPremium/useDataGridPremiumProps.js +6 -6
  28. package/legacy/components/GridAggregationColumnMenuItem.js +4 -4
  29. package/legacy/hooks/features/aggregation/gridAggregationFunctions.js +1 -1
  30. package/legacy/hooks/features/aggregation/gridAggregationSelectors.js +4 -5
  31. package/legacy/hooks/features/aggregation/gridAggregationUtils.js +27 -16
  32. package/legacy/hooks/features/aggregation/index.js +1 -1
  33. package/legacy/hooks/features/aggregation/useGridAggregation.js +17 -17
  34. package/legacy/hooks/features/aggregation/useGridAggregationPreProcessors.js +17 -16
  35. package/legacy/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
  36. package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +35 -21
  37. package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
  38. package/legacy/index.js +1 -1
  39. package/legacy/utils/releaseInfo.js +1 -1
  40. package/models/dataGridPremiumProps.d.ts +7 -13
  41. package/models/gridApiPremium.d.ts +2 -2
  42. package/models/gridStatePremium.d.ts +2 -2
  43. package/modern/DataGridPremium/DataGridPremium.js +54 -45
  44. package/modern/DataGridPremium/useDataGridPremiumComponent.js +4 -1
  45. package/modern/DataGridPremium/useDataGridPremiumProps.js +6 -6
  46. package/modern/components/GridAggregationColumnMenuItem.js +4 -4
  47. package/modern/hooks/features/aggregation/gridAggregationFunctions.js +1 -1
  48. package/modern/hooks/features/aggregation/gridAggregationSelectors.js +3 -4
  49. package/modern/hooks/features/aggregation/gridAggregationUtils.js +27 -16
  50. package/modern/hooks/features/aggregation/index.js +1 -1
  51. package/modern/hooks/features/aggregation/useGridAggregation.js +16 -16
  52. package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +17 -16
  53. package/modern/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
  54. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +27 -20
  55. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
  56. package/modern/index.js +1 -1
  57. package/modern/utils/releaseInfo.js +1 -1
  58. package/node/DataGridPremium/DataGridPremium.js +54 -45
  59. package/node/DataGridPremium/useDataGridPremiumComponent.js +3 -0
  60. package/node/DataGridPremium/useDataGridPremiumProps.js +5 -5
  61. package/node/components/GridAggregationColumnMenuItem.js +4 -4
  62. package/node/hooks/features/aggregation/gridAggregationFunctions.js +3 -3
  63. package/node/hooks/features/aggregation/gridAggregationSelectors.js +5 -6
  64. package/node/hooks/features/aggregation/gridAggregationUtils.js +29 -18
  65. package/node/hooks/features/aggregation/index.js +6 -6
  66. package/node/hooks/features/aggregation/useGridAggregation.js +17 -17
  67. package/node/hooks/features/aggregation/useGridAggregationPreProcessors.js +17 -16
  68. package/node/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
  69. package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +31 -21
  70. package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
  71. package/node/index.js +1 -1
  72. package/node/utils/releaseInfo.js +1 -1
  73. package/package.json +4 -4
  74. package/typeOverloads/modules.d.ts +2 -2
  75. package/utils/releaseInfo.js +1 -1
@@ -40,10 +40,10 @@ const useGridAggregationPreProcessors = (apiRef, props) => {
40
40
  const {
41
41
  rulesOnLastColumnHydration
42
42
  } = apiRef.current.unstable_caches.aggregation;
43
- const aggregationRules = props.private_disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)({
43
+ const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)({
44
44
  columnsLookup: columnsState.lookup,
45
45
  aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef),
46
- aggregationFunctions: props.private_aggregationFunctions
46
+ aggregationFunctions: props.aggregationFunctions
47
47
  });
48
48
  columnsState.all.forEach(field => {
49
49
  const shouldHaveAggregationValue = !!aggregationRules[field];
@@ -68,19 +68,19 @@ const useGridAggregationPreProcessors = (apiRef, props) => {
68
68
  });
69
69
  apiRef.current.unstable_caches.aggregation.rulesOnLastColumnHydration = aggregationRules;
70
70
  return columnsState;
71
- }, [apiRef, props.private_aggregationFunctions, props.private_disableAggregation]);
71
+ }, [apiRef, props.aggregationFunctions, props.disableAggregation]);
72
72
  const addGroupFooterRows = React.useCallback(groupingParams => {
73
73
  let newGroupingParams;
74
74
  let rulesOnLastRowHydration;
75
75
 
76
- if (props.private_disableAggregation) {
76
+ if (props.disableAggregation) {
77
77
  newGroupingParams = groupingParams;
78
78
  rulesOnLastRowHydration = {};
79
79
  } else {
80
80
  const aggregationRules = (0, _gridAggregationUtils.getAggregationRules)({
81
81
  columnsLookup: (0, _xDataGridPro.gridColumnLookupSelector)(apiRef),
82
82
  aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef),
83
- aggregationFunctions: props.private_aggregationFunctions
83
+ aggregationFunctions: props.aggregationFunctions
84
84
  });
85
85
  rulesOnLastRowHydration = aggregationRules; // If no column have an aggregation rule
86
86
  // Then don't create the footer rows
@@ -91,21 +91,22 @@ const useGridAggregationPreProcessors = (apiRef, props) => {
91
91
  newGroupingParams = (0, _gridAggregationUtils.addFooterRows)({
92
92
  groupingParams,
93
93
  aggregationRules,
94
- getAggregationPosition: props.private_getAggregationPosition
94
+ getAggregationPosition: props.getAggregationPosition,
95
+ apiRef
95
96
  });
96
97
  }
97
98
  }
98
99
 
99
100
  apiRef.current.unstable_caches.aggregation.rulesOnLastRowHydration = rulesOnLastRowHydration;
100
101
  return newGroupingParams;
101
- }, [apiRef, props.private_disableAggregation, props.private_getAggregationPosition, props.private_aggregationFunctions]);
102
+ }, [apiRef, props.disableAggregation, props.getAggregationPosition, props.aggregationFunctions]);
102
103
  const addColumnMenuButtons = React.useCallback((initialValue, column) => {
103
- if (props.private_disableAggregation) {
104
+ if (props.disableAggregation) {
104
105
  return initialValue;
105
106
  }
106
107
 
107
108
  const availableAggregationFunctions = (0, _gridAggregationUtils.getAvailableAggregationFunctions)({
108
- aggregationFunctions: props.private_aggregationFunctions,
109
+ aggregationFunctions: props.aggregationFunctions,
109
110
  column
110
111
  });
111
112
 
@@ -118,9 +119,9 @@ const useGridAggregationPreProcessors = (apiRef, props) => {
118
119
  label: apiRef.current.getLocaleText('aggregationMenuItemHeader'),
119
120
  availableAggregationFunctions: availableAggregationFunctions
120
121
  })];
121
- }, [apiRef, props.private_aggregationFunctions, props.private_disableAggregation]);
122
+ }, [apiRef, props.aggregationFunctions, props.disableAggregation]);
122
123
  const stateExportPreProcessing = React.useCallback(prevState => {
123
- if (props.private_disableAggregation) {
124
+ if (props.disableAggregation) {
124
125
  return prevState;
125
126
  }
126
127
 
@@ -131,26 +132,26 @@ const useGridAggregationPreProcessors = (apiRef, props) => {
131
132
  }
132
133
 
133
134
  return (0, _extends2.default)({}, prevState, {
134
- private_aggregation: {
135
+ aggregation: {
135
136
  model: aggregationModelToExport
136
137
  }
137
138
  });
138
- }, [apiRef, props.private_disableAggregation]);
139
+ }, [apiRef, props.disableAggregation]);
139
140
  const stateRestorePreProcessing = React.useCallback((params, context) => {
140
141
  var _context$stateToResto;
141
142
 
142
- if (props.private_disableAggregation) {
143
+ if (props.disableAggregation) {
143
144
  return params;
144
145
  }
145
146
 
146
- const aggregationModel = (_context$stateToResto = context.stateToRestore.private_aggregation) == null ? void 0 : _context$stateToResto.model;
147
+ const aggregationModel = (_context$stateToResto = context.stateToRestore.aggregation) == null ? void 0 : _context$stateToResto.model;
147
148
 
148
149
  if (aggregationModel != null) {
149
150
  apiRef.current.setState((0, _gridAggregationUtils.mergeStateWithAggregationModel)(aggregationModel));
150
151
  }
151
152
 
152
153
  return params;
153
- }, [apiRef, props.private_disableAggregation]);
154
+ }, [apiRef, props.disableAggregation]);
154
155
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'hydrateColumns', updateAggregatedColumns);
155
156
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'hydrateRows', addGroupFooterRows);
156
157
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'columnMenu', addColumnMenuButtons);
@@ -88,11 +88,6 @@ const getLeafProperties = leafColDef => {
88
88
  }
89
89
 
90
90
  return params => {
91
- // We only want to filter leaves
92
- if (params.rowNode.groupingField != null) {
93
- return true;
94
- }
95
-
96
91
  return originalFn(params);
97
92
  };
98
93
  }
@@ -131,11 +126,6 @@ const getGroupingCriteriaProperties = (groupedByColDef, applyHeaderName) => {
131
126
  }
132
127
 
133
128
  return params => {
134
- // We only want to filter the groups of the current grouping criteria
135
- if (params.rowNode.groupingField !== groupedByColDef.field) {
136
- return true;
137
- }
138
-
139
129
  return originalFn(params);
140
130
  };
141
131
  }
@@ -9,6 +9,8 @@ exports.setStrategyAvailability = exports.mergeStateWithRowGroupingModel = expor
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
+ var _internals = require("@mui/x-data-grid-pro/internals");
13
+
12
14
  var _gridRowGroupingSelector = require("./gridRowGroupingSelector");
13
15
 
14
16
  const GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = '__row_group_by_columns_group__';
@@ -64,48 +66,56 @@ const shouldApplyFilterItemOnGroup = (columnField, node) => {
64
66
  const filterRowTreeFromGroupingColumns = params => {
65
67
  const {
66
68
  rowTree,
67
- isRowMatchingFilters
69
+ isRowMatchingFilters,
70
+ filterModel
68
71
  } = params;
69
72
  const visibleRowsLookup = {};
70
73
  const filteredRowsLookup = {};
71
74
  const filteredDescendantCountLookup = {};
72
75
 
73
- const filterTreeNode = (node, areAncestorsPassingChildren, areAncestorsExpanded) => {
74
- var _node$children, _node$children2;
76
+ const filterTreeNode = (node, areAncestorsExpanded, ancestorsResults) => {
77
+ var _node$children;
75
78
 
76
- let isMatchingFilters;
79
+ let isPassingFiltering = false;
80
+ let filterResults = {
81
+ passingFilterItems: null,
82
+ passingQuickFilterValues: null
83
+ };
77
84
 
78
- if (!isRowMatchingFilters) {
79
- isMatchingFilters = true;
80
- } else {
85
+ if (isRowMatchingFilters && node.position !== 'footer') {
81
86
  const shouldApplyItem = node.isAutoGenerated ? columnField => shouldApplyFilterItemOnGroup(columnField, node) : undefined;
82
- isMatchingFilters = isRowMatchingFilters(node.id, shouldApplyItem);
87
+ filterResults = isRowMatchingFilters(node.id, shouldApplyItem);
88
+ } else {
89
+ isPassingFiltering = true;
83
90
  }
84
91
 
85
92
  let filteredDescendantCount = 0;
86
93
  (_node$children = node.children) == null ? void 0 : _node$children.forEach(childId => {
87
94
  const childNode = rowTree[childId];
88
- const childSubTreeSize = filterTreeNode(childNode, areAncestorsPassingChildren && isMatchingFilters, areAncestorsExpanded && !!node.childrenExpanded);
95
+ const childSubTreeSize = filterTreeNode(childNode, areAncestorsExpanded && !!node.childrenExpanded, [...ancestorsResults, filterResults]);
89
96
  filteredDescendantCount += childSubTreeSize;
90
97
  });
91
- let shouldPassFilters;
92
98
 
93
- if (!areAncestorsPassingChildren) {
94
- shouldPassFilters = false;
95
- } else if ((_node$children2 = node.children) != null && _node$children2.length) {
96
- shouldPassFilters = isMatchingFilters && filteredDescendantCount > 0;
97
- } else {
98
- shouldPassFilters = isMatchingFilters;
99
+ if (isPassingFiltering === false) {
100
+ var _node$children2;
101
+
102
+ if ((_node$children2 = node.children) != null && _node$children2.length) {
103
+ // If node has children - it's passing if at least one child passes filters
104
+ isPassingFiltering = filteredDescendantCount > 0;
105
+ } else {
106
+ const allResults = [...ancestorsResults, filterResults];
107
+ isPassingFiltering = (0, _internals.passFilterLogic)(allResults.map(result => result.passingFilterItems), allResults.map(result => result.passingQuickFilterValues), filterModel);
108
+ }
99
109
  }
100
110
 
101
- visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
102
- filteredRowsLookup[node.id] = shouldPassFilters;
111
+ visibleRowsLookup[node.id] = isPassingFiltering && areAncestorsExpanded;
112
+ filteredRowsLookup[node.id] = isPassingFiltering;
103
113
 
104
114
  if (node.footerId != null) {
105
- visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
115
+ visibleRowsLookup[node.footerId] = isPassingFiltering && areAncestorsExpanded && !!node.childrenExpanded;
106
116
  }
107
117
 
108
- if (!shouldPassFilters) {
118
+ if (!isPassingFiltering) {
109
119
  return 0;
110
120
  }
111
121
 
@@ -124,7 +134,7 @@ const filterRowTreeFromGroupingColumns = params => {
124
134
  const node = nodes[i];
125
135
 
126
136
  if (node.depth === 0) {
127
- filterTreeNode(node, true, true);
137
+ filterTreeNode(node, true, []);
128
138
  }
129
139
  }
130
140
 
@@ -156,7 +156,8 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
156
156
  const rowTree = (0, _xDataGridPro.gridRowTreeSelector)(apiRef);
157
157
  return (0, _gridRowGroupingUtils.filterRowTreeFromGroupingColumns)({
158
158
  rowTree,
159
- isRowMatchingFilters: params.isRowMatchingFilters
159
+ isRowMatchingFilters: params.isRowMatchingFilters,
160
+ filterModel: params.filterModel
160
161
  });
161
162
  }, [apiRef]);
162
163
  const sortRows = React.useCallback(params => {
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.14.0
1
+ /** @license MUI v5.15.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
8
8
  var _utils = require("@mui/utils");
9
9
 
10
10
  const getReleaseInfo = () => {
11
- const releaseInfo = "MTY1ODQ0MDgwMDAwMA==";
11
+ const releaseInfo = "MTY2MDE2NTIwMDAwMA==";
12
12
 
13
13
  if (process.env.NODE_ENV !== 'production') {
14
14
  // A simple hack to set the value in the test environment (has no build step).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-premium",
3
- "version": "5.14.0",
3
+ "version": "5.15.2",
4
4
  "description": "The Premium plan edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -33,9 +33,9 @@
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.18.6",
35
35
  "@mui/utils": "^5.4.1",
36
- "@mui/x-data-grid": "5.14.0",
37
- "@mui/x-data-grid-pro": "5.14.0",
38
- "@mui/x-license-pro": "5.14.0",
36
+ "@mui/x-data-grid": "5.15.2",
37
+ "@mui/x-data-grid-pro": "5.15.2",
38
+ "@mui/x-license-pro": "5.15.0",
39
39
  "@types/format-util": "^1.0.2",
40
40
  "clsx": "^1.2.1",
41
41
  "exceljs": "^4.3.0",
@@ -23,12 +23,12 @@ export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F
23
23
  * If `true`, the cells of the column can be aggregated based.
24
24
  * @default true
25
25
  */
26
- private_aggregable?: boolean;
26
+ aggregable?: boolean;
27
27
  /**
28
28
  * Limit the aggregation function usable on this column.
29
29
  * By default, the column will have all the aggregation functions that are compatible with its type.
30
30
  */
31
- private_availableAggregationFunctions?: string[];
31
+ availableAggregationFunctions?: string[];
32
32
  /**
33
33
  * Function that transforms a complex cell value into a key that be used for grouping the rows.
34
34
  * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY1ODQ0MDgwMDAwMA==";
3
+ const releaseInfo = "MTY2MDE2NTIwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).