@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.
- package/CHANGELOG.md +147 -5
- package/DataGridPremium/DataGridPremium.js +54 -45
- 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/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +2 -1
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +30 -21
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
- package/index.js +1 -1
- package/legacy/DataGridPremium/DataGridPremium.js +54 -45
- 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/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
- package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +35 -21
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
- 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 +54 -45
- 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/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +27 -20
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +54 -45
- 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/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
- package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +31 -21
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
- 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
|
@@ -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.
|
|
43
|
+
const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)({
|
|
44
44
|
columnsLookup: columnsState.lookup,
|
|
45
45
|
aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef),
|
|
46
|
-
aggregationFunctions: props.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
102
|
+
}, [apiRef, props.disableAggregation, props.getAggregationPosition, props.aggregationFunctions]);
|
|
102
103
|
const addColumnMenuButtons = React.useCallback((initialValue, column) => {
|
|
103
|
-
if (props.
|
|
104
|
+
if (props.disableAggregation) {
|
|
104
105
|
return initialValue;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
const availableAggregationFunctions = (0, _gridAggregationUtils.getAvailableAggregationFunctions)({
|
|
108
|
-
aggregationFunctions: props.
|
|
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.
|
|
122
|
+
}, [apiRef, props.aggregationFunctions, props.disableAggregation]);
|
|
122
123
|
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
123
|
-
if (props.
|
|
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
|
-
|
|
135
|
+
aggregation: {
|
|
135
136
|
model: aggregationModelToExport
|
|
136
137
|
}
|
|
137
138
|
});
|
|
138
|
-
}, [apiRef, props.
|
|
139
|
+
}, [apiRef, props.disableAggregation]);
|
|
139
140
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
140
141
|
var _context$stateToResto;
|
|
141
142
|
|
|
142
|
-
if (props.
|
|
143
|
+
if (props.disableAggregation) {
|
|
143
144
|
return params;
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
const aggregationModel = (_context$stateToResto = context.stateToRestore.
|
|
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.
|
|
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,
|
|
74
|
-
var _node$children
|
|
76
|
+
const filterTreeNode = (node, areAncestorsExpanded, ancestorsResults) => {
|
|
77
|
+
var _node$children;
|
|
75
78
|
|
|
76
|
-
let
|
|
79
|
+
let isPassingFiltering = false;
|
|
80
|
+
let filterResults = {
|
|
81
|
+
passingFilterItems: null,
|
|
82
|
+
passingQuickFilterValues: null
|
|
83
|
+
};
|
|
77
84
|
|
|
78
|
-
if (
|
|
79
|
-
isMatchingFilters = true;
|
|
80
|
-
} else {
|
|
85
|
+
if (isRowMatchingFilters && node.position !== 'footer') {
|
|
81
86
|
const shouldApplyItem = node.isAutoGenerated ? columnField => shouldApplyFilterItemOnGroup(columnField, node) : undefined;
|
|
82
|
-
|
|
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,
|
|
95
|
+
const childSubTreeSize = filterTreeNode(childNode, areAncestorsExpanded && !!node.childrenExpanded, [...ancestorsResults, filterResults]);
|
|
89
96
|
filteredDescendantCount += childSubTreeSize;
|
|
90
97
|
});
|
|
91
|
-
let shouldPassFilters;
|
|
92
98
|
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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] =
|
|
102
|
-
filteredRowsLookup[node.id] =
|
|
111
|
+
visibleRowsLookup[node.id] = isPassingFiltering && areAncestorsExpanded;
|
|
112
|
+
filteredRowsLookup[node.id] = isPassingFiltering;
|
|
103
113
|
|
|
104
114
|
if (node.footerId != null) {
|
|
105
|
-
visibleRowsLookup[node.footerId] =
|
|
115
|
+
visibleRowsLookup[node.footerId] = isPassingFiltering && areAncestorsExpanded && !!node.childrenExpanded;
|
|
106
116
|
}
|
|
107
117
|
|
|
108
|
-
if (!
|
|
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,
|
|
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
|
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
|
|
|
8
8
|
var _utils = require("@mui/utils");
|
|
9
9
|
|
|
10
10
|
const getReleaseInfo = () => {
|
|
11
|
-
const releaseInfo = "
|
|
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.
|
|
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.
|
|
37
|
-
"@mui/x-data-grid-pro": "5.
|
|
38
|
-
"@mui/x-license-pro": "5.
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
package/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
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).
|