@mui/x-data-grid-premium 5.13.1 → 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.
- package/CHANGELOG.md +44 -1
- package/DataGridPremium/DataGridPremium.js +47 -0
- package/DataGridPremium/useDataGridPremiumComponent.js +6 -1
- package/DataGridPremium/useDataGridPremiumProps.js +17 -7
- package/components/GridAggregationColumnMenuItem.d.ts +9 -0
- package/components/GridAggregationColumnMenuItem.js +93 -0
- package/components/GridAggregationHeader.d.ts +4 -0
- package/components/GridAggregationHeader.js +94 -0
- package/components/GridExcelExportMenuItem.js +11 -4
- package/components/GridFooterCell.d.ts +9 -0
- package/components/GridFooterCell.js +51 -0
- package/components/GridGroupingColumnFooterCell.d.ts +4 -0
- package/components/GridGroupingColumnFooterCell.js +29 -0
- package/hooks/features/aggregation/createAggregationLookup.d.ts +10 -0
- package/hooks/features/aggregation/createAggregationLookup.js +128 -0
- package/hooks/features/aggregation/gridAggregationFunctions.d.ts +8 -0
- package/hooks/features/aggregation/gridAggregationFunctions.js +96 -0
- package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +104 -0
- package/hooks/features/aggregation/gridAggregationInterfaces.js +1 -0
- package/hooks/features/aggregation/gridAggregationSelectors.d.ts +4 -0
- package/hooks/features/aggregation/gridAggregationSelectors.js +5 -0
- package/hooks/features/aggregation/gridAggregationUtils.d.ts +40 -0
- package/hooks/features/aggregation/gridAggregationUtils.js +177 -0
- package/hooks/features/aggregation/index.d.ts +4 -0
- package/hooks/features/aggregation/index.js +4 -0
- package/hooks/features/aggregation/useGridAggregation.d.ts +6 -0
- package/hooks/features/aggregation/useGridAggregation.js +94 -0
- package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +4 -0
- package/hooks/features/aggregation/useGridAggregationPreProcessors.js +137 -0
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +29 -0
- package/hooks/features/aggregation/wrapColumnWithAggregation.js +257 -0
- package/hooks/features/export/serializer/excelSerializer.js +2 -1
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/rowGrouping/createGroupingColDef.js +13 -2
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
- package/hooks/features/rowGrouping/useGridRowGrouping.js +20 -10
- package/index.js +1 -1
- package/legacy/DataGridPremium/DataGridPremium.js +47 -0
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +6 -1
- package/legacy/DataGridPremium/useDataGridPremiumProps.js +12 -2
- package/legacy/components/GridAggregationColumnMenuItem.js +95 -0
- package/legacy/components/GridAggregationHeader.js +95 -0
- package/legacy/components/GridExcelExportMenuItem.js +11 -4
- package/legacy/components/GridFooterCell.js +63 -0
- package/legacy/components/GridGroupingColumnFooterCell.js +27 -0
- package/legacy/hooks/features/aggregation/createAggregationLookup.js +127 -0
- package/legacy/hooks/features/aggregation/gridAggregationFunctions.js +94 -0
- package/legacy/hooks/features/aggregation/gridAggregationInterfaces.js +1 -0
- package/legacy/hooks/features/aggregation/gridAggregationSelectors.js +11 -0
- package/legacy/hooks/features/aggregation/gridAggregationUtils.js +189 -0
- package/legacy/hooks/features/aggregation/index.js +4 -0
- package/legacy/hooks/features/aggregation/useGridAggregation.js +95 -0
- package/legacy/hooks/features/aggregation/useGridAggregationPreProcessors.js +140 -0
- package/legacy/hooks/features/aggregation/wrapColumnWithAggregation.js +262 -0
- package/legacy/hooks/features/export/serializer/excelSerializer.js +2 -1
- package/legacy/hooks/features/index.js +1 -0
- package/legacy/hooks/features/rowGrouping/createGroupingColDef.js +13 -2
- package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +24 -10
- package/legacy/index.js +1 -1
- package/legacy/typeOverloads/index.js +1 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridPremiumProps.d.ts +46 -1
- package/models/gridApiPremium.d.ts +2 -2
- package/models/gridStatePremium.d.ts +3 -1
- package/modern/DataGridPremium/DataGridPremium.js +47 -0
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +6 -1
- package/modern/DataGridPremium/useDataGridPremiumProps.js +8 -2
- package/modern/components/GridAggregationColumnMenuItem.js +93 -0
- package/modern/components/GridAggregationHeader.js +92 -0
- package/modern/components/GridExcelExportMenuItem.js +11 -4
- package/modern/components/GridFooterCell.js +51 -0
- package/modern/components/GridGroupingColumnFooterCell.js +29 -0
- package/modern/hooks/features/aggregation/createAggregationLookup.js +122 -0
- package/modern/hooks/features/aggregation/gridAggregationFunctions.js +96 -0
- package/modern/hooks/features/aggregation/gridAggregationInterfaces.js +1 -0
- package/modern/hooks/features/aggregation/gridAggregationSelectors.js +5 -0
- package/modern/hooks/features/aggregation/gridAggregationUtils.js +175 -0
- package/modern/hooks/features/aggregation/index.js +4 -0
- package/modern/hooks/features/aggregation/useGridAggregation.js +92 -0
- package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +135 -0
- package/modern/hooks/features/aggregation/wrapColumnWithAggregation.js +251 -0
- package/modern/hooks/features/export/serializer/excelSerializer.js +2 -1
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/rowGrouping/createGroupingColDef.js +13 -2
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +17 -11
- package/modern/index.js +1 -1
- package/modern/typeOverloads/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +47 -0
- package/node/DataGridPremium/useDataGridPremiumComponent.js +8 -1
- package/node/DataGridPremium/useDataGridPremiumProps.js +17 -6
- package/node/components/GridAggregationColumnMenuItem.js +120 -0
- package/node/components/GridAggregationHeader.js +115 -0
- package/node/components/GridExcelExportMenuItem.js +12 -4
- package/node/components/GridFooterCell.js +73 -0
- package/node/components/GridGroupingColumnFooterCell.js +46 -0
- package/node/hooks/features/aggregation/createAggregationLookup.js +139 -0
- package/node/hooks/features/aggregation/gridAggregationFunctions.js +105 -0
- package/node/hooks/features/aggregation/gridAggregationInterfaces.js +5 -0
- package/node/hooks/features/aggregation/gridAggregationSelectors.js +17 -0
- package/node/hooks/features/aggregation/gridAggregationUtils.js +212 -0
- package/node/hooks/features/aggregation/index.js +65 -0
- package/node/hooks/features/aggregation/useGridAggregation.js +118 -0
- package/node/hooks/features/aggregation/useGridAggregationPreProcessors.js +161 -0
- package/node/hooks/features/aggregation/wrapColumnWithAggregation.js +279 -0
- package/node/hooks/features/export/serializer/excelSerializer.js +2 -1
- package/node/hooks/features/index.js +13 -0
- package/node/hooks/features/rowGrouping/createGroupingColDef.js +14 -2
- package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +19 -10
- package/node/index.js +1 -1
- package/node/typeOverloads/index.js +16 -1
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +4 -4
- package/typeOverloads/index.d.ts +1 -1
- package/typeOverloads/index.js +1 -1
- package/typeOverloads/modules.d.ts +32 -2
- package/utils/releaseInfo.js +1 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.wrapColumnWithAggregationValue = exports.unwrapColumnFromAggregation = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _gridAggregationSelectors = require("./gridAggregationSelectors");
|
|
15
|
+
|
|
16
|
+
var _GridFooterCell = require("../../../components/GridFooterCell");
|
|
17
|
+
|
|
18
|
+
var _GridAggregationHeader = require("../../../components/GridAggregationHeader");
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
const AGGREGATION_WRAPPABLE_PROPERTIES = ['valueGetter', 'valueFormatter', 'renderCell', 'renderHeader', 'filterOperators'];
|
|
27
|
+
|
|
28
|
+
const getAggregationValueWrappedValueGetter = ({
|
|
29
|
+
value: valueGetter,
|
|
30
|
+
getCellAggregationResult
|
|
31
|
+
}) => {
|
|
32
|
+
const wrappedValueGetter = params => {
|
|
33
|
+
const cellAggregationResult = getCellAggregationResult(params.id, params.field);
|
|
34
|
+
|
|
35
|
+
if (cellAggregationResult != null) {
|
|
36
|
+
var _cellAggregationResul;
|
|
37
|
+
|
|
38
|
+
return (_cellAggregationResul = cellAggregationResult == null ? void 0 : cellAggregationResult.value) != null ? _cellAggregationResul : null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (valueGetter) {
|
|
42
|
+
return valueGetter(params);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return params.row[params.field];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return wrappedValueGetter;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const getAggregationValueWrappedValueFormatter = ({
|
|
52
|
+
value: valueFormatter,
|
|
53
|
+
aggregationRule,
|
|
54
|
+
getCellAggregationResult
|
|
55
|
+
}) => {
|
|
56
|
+
// If neither the inline aggregation function nor the footer aggregation function have a custom value formatter,
|
|
57
|
+
// Then we don't wrap the column value formatter
|
|
58
|
+
if (!aggregationRule.aggregationFunction.valueFormatter) {
|
|
59
|
+
return valueFormatter;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const wrappedValueFormatter = params => {
|
|
63
|
+
if (params.id != null) {
|
|
64
|
+
const cellAggregationResult = getCellAggregationResult(params.id, params.field);
|
|
65
|
+
|
|
66
|
+
if (cellAggregationResult != null) {
|
|
67
|
+
return aggregationRule.aggregationFunction.valueFormatter(params);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (valueFormatter) {
|
|
72
|
+
return valueFormatter(params);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return params.value;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return wrappedValueFormatter;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const getAggregationValueWrappedRenderCell = ({
|
|
82
|
+
value: renderCell,
|
|
83
|
+
aggregationRule,
|
|
84
|
+
getCellAggregationResult
|
|
85
|
+
}) => {
|
|
86
|
+
const wrappedRenderCell = params => {
|
|
87
|
+
const cellAggregationResult = getCellAggregationResult(params.id, params.field);
|
|
88
|
+
|
|
89
|
+
if (cellAggregationResult != null) {
|
|
90
|
+
var _aggregationFunction$;
|
|
91
|
+
|
|
92
|
+
if (!renderCell) {
|
|
93
|
+
if (cellAggregationResult.position === 'footer') {
|
|
94
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridFooterCell.GridFooterCell, (0, _extends2.default)({}, params));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return params.formattedValue;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const aggregationMeta = {
|
|
101
|
+
hasCellUnit: (_aggregationFunction$ = aggregationRule.aggregationFunction.hasCellUnit) != null ? _aggregationFunction$ : true,
|
|
102
|
+
aggregationFunctionName: aggregationRule.aggregationFunctionName
|
|
103
|
+
};
|
|
104
|
+
return renderCell((0, _extends2.default)({}, params, {
|
|
105
|
+
aggregation: aggregationMeta
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!renderCell) {
|
|
110
|
+
return params.formattedValue;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return renderCell(params);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return wrappedRenderCell;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Skips the filtering for aggregated rows
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
const getWrappedFilterOperators = ({
|
|
124
|
+
value: filterOperators,
|
|
125
|
+
getCellAggregationResult
|
|
126
|
+
}) => filterOperators.map(operator => {
|
|
127
|
+
return (0, _extends2.default)({}, operator, {
|
|
128
|
+
getApplyFilterFn: (filterItem, column) => {
|
|
129
|
+
const originalFn = operator.getApplyFilterFn(filterItem, column);
|
|
130
|
+
|
|
131
|
+
if (!originalFn) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return params => {
|
|
136
|
+
if (getCellAggregationResult(params.id, params.field) != null) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return originalFn(params);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* Add the aggregation method around the header name
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
const getWrappedRenderHeader = ({
|
|
151
|
+
value: renderHeader,
|
|
152
|
+
aggregationRule
|
|
153
|
+
}) => {
|
|
154
|
+
const wrappedRenderCell = params => {
|
|
155
|
+
const aggregationMeta = {
|
|
156
|
+
aggregationRule
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
if (!renderHeader) {
|
|
160
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridAggregationHeader.GridAggregationHeader, (0, _extends2.default)({}, params, {
|
|
161
|
+
aggregation: aggregationMeta
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return renderHeader((0, _extends2.default)({}, params, {
|
|
166
|
+
aggregation: aggregationMeta
|
|
167
|
+
}));
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return wrappedRenderCell;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Add a wrapper around each wrappable property of the column to customize the behavior of the aggregation cells.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
const wrapColumnWithAggregationValue = ({
|
|
178
|
+
column,
|
|
179
|
+
apiRef,
|
|
180
|
+
aggregationRule
|
|
181
|
+
}) => {
|
|
182
|
+
const getCellAggregationResult = (id, field) => {
|
|
183
|
+
var _parent, _gridAggregationLooku;
|
|
184
|
+
|
|
185
|
+
let cellAggregationPosition = null;
|
|
186
|
+
|
|
187
|
+
if (id.toString().startsWith('auto-generated-row-')) {
|
|
188
|
+
cellAggregationPosition = 'inline';
|
|
189
|
+
} else if (id.toString().startsWith('auto-generated-group-footer-')) {
|
|
190
|
+
cellAggregationPosition = 'footer';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (cellAggregationPosition == null) {
|
|
194
|
+
return null;
|
|
195
|
+
} // TODO: Add custom root id
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
const groupId = cellAggregationPosition === 'inline' ? id : (_parent = apiRef.current.getRowNode(id).parent) != null ? _parent : '';
|
|
199
|
+
const aggregationResult = (_gridAggregationLooku = (0, _gridAggregationSelectors.gridAggregationLookupSelector)(apiRef)[groupId]) == null ? void 0 : _gridAggregationLooku[field];
|
|
200
|
+
|
|
201
|
+
if (!aggregationResult || aggregationResult.position !== cellAggregationPosition) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return aggregationResult;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const aggregationWrappedProperties = {};
|
|
209
|
+
const wrappedColumn = (0, _extends2.default)({}, column, {
|
|
210
|
+
aggregationWrappedProperties
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const wrapColumnProperty = (property, wrapper) => {
|
|
214
|
+
const originalValue = column[property];
|
|
215
|
+
const wrappedProperty = wrapper({
|
|
216
|
+
apiRef,
|
|
217
|
+
value: originalValue,
|
|
218
|
+
colDef: column,
|
|
219
|
+
aggregationRule,
|
|
220
|
+
getCellAggregationResult
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
if (wrappedProperty !== originalValue) {
|
|
224
|
+
aggregationWrappedProperties[property] = {
|
|
225
|
+
original: originalValue,
|
|
226
|
+
wrapped: wrappedProperty
|
|
227
|
+
};
|
|
228
|
+
wrappedColumn[property] = wrappedProperty;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
wrapColumnProperty('valueGetter', getAggregationValueWrappedValueGetter);
|
|
233
|
+
wrapColumnProperty('valueFormatter', getAggregationValueWrappedValueFormatter);
|
|
234
|
+
wrapColumnProperty('renderCell', getAggregationValueWrappedRenderCell);
|
|
235
|
+
wrapColumnProperty('renderHeader', getWrappedRenderHeader);
|
|
236
|
+
wrapColumnProperty('filterOperators', getWrappedFilterOperators);
|
|
237
|
+
|
|
238
|
+
if (Object.keys(aggregationWrappedProperties).length === 0) {
|
|
239
|
+
return column;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return wrappedColumn;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Remove the aggregation wrappers around the wrappable properties of the column.
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
exports.wrapColumnWithAggregationValue = wrapColumnWithAggregationValue;
|
|
250
|
+
|
|
251
|
+
const unwrapColumnFromAggregation = ({
|
|
252
|
+
column
|
|
253
|
+
}) => {
|
|
254
|
+
if (!column.aggregationWrappedProperties) {
|
|
255
|
+
return column;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const originalProperties = Object.entries(column.aggregationWrappedProperties);
|
|
259
|
+
|
|
260
|
+
if (originalProperties.length === 0) {
|
|
261
|
+
return column;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const unwrappedColumn = (0, _extends2.default)({}, column);
|
|
265
|
+
originalProperties.forEach(([propertyName, {
|
|
266
|
+
original,
|
|
267
|
+
wrapped
|
|
268
|
+
}]) => {
|
|
269
|
+
// The value changed since we wrapped it
|
|
270
|
+
if (wrapped !== column[propertyName]) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
unwrappedColumn[propertyName] = original;
|
|
275
|
+
});
|
|
276
|
+
return unwrappedColumn;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
exports.unwrapColumnFromAggregation = unwrapColumnFromAggregation;
|
|
@@ -61,7 +61,8 @@ const serializeRow = (id, columns, api, defaultValueOptionsFormulae) => {
|
|
|
61
61
|
api.unstable_calculateColSpan({
|
|
62
62
|
rowId: id,
|
|
63
63
|
minFirstColumn: 0,
|
|
64
|
-
maxLastColumn: columns.length
|
|
64
|
+
maxLastColumn: columns.length,
|
|
65
|
+
columns
|
|
65
66
|
});
|
|
66
67
|
columns.forEach((column, colIndex) => {
|
|
67
68
|
const colSpanInfo = api.unstable_getCellColSpanInfo(id, colIndex);
|
|
@@ -4,6 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _aggregation = require("./aggregation");
|
|
8
|
+
|
|
9
|
+
Object.keys(_aggregation).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _aggregation[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _aggregation[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
7
20
|
var _rowGrouping = require("./rowGrouping");
|
|
8
21
|
|
|
9
22
|
Object.keys(_rowGrouping).forEach(function (key) {
|
|
@@ -15,6 +15,8 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
17
17
|
|
|
18
|
+
var _GridGroupingColumnFooterCell = require("../../../components/GridGroupingColumnFooterCell");
|
|
19
|
+
|
|
18
20
|
var _GridGroupingCriteriaCell = require("../../../components/GridGroupingCriteriaCell");
|
|
19
21
|
|
|
20
22
|
var _GridGroupingColumnLeafCell = require("../../../components/GridGroupingColumnLeafCell");
|
|
@@ -173,7 +175,12 @@ const createGroupingColDefForOneGroupingCriteria = ({
|
|
|
173
175
|
const commonProperties = {
|
|
174
176
|
width: Math.max(((_groupedByColDef$widt = groupedByColDef.width) != null ? _groupedByColDef$widt : _xDataGridPro.GRID_STRING_COL_DEF.width) + 40, (_leafColDef$width = leafColDef == null ? void 0 : leafColDef.width) != null ? _leafColDef$width : 0),
|
|
175
177
|
renderCell: params => {
|
|
176
|
-
// Render
|
|
178
|
+
// Render footer
|
|
179
|
+
if (params.rowNode.position === 'footer') {
|
|
180
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridGroupingColumnFooterCell.GridGroupingColumnFooterCell, (0, _extends2.default)({}, params));
|
|
181
|
+
} // Render leaves
|
|
182
|
+
|
|
183
|
+
|
|
177
184
|
if (params.rowNode.groupingField == null) {
|
|
178
185
|
if (leafColDef) {
|
|
179
186
|
const leafParams = (0, _extends2.default)({}, params.api.getCellParams(params.id, leafField), {
|
|
@@ -275,7 +282,12 @@ const createGroupingColDefForAllGroupingCriteria = ({
|
|
|
275
282
|
return ((_columnsLookup$field$ = columnsLookup[field].width) != null ? _columnsLookup$field$ : _xDataGridPro.GRID_STRING_COL_DEF.width) + 40;
|
|
276
283
|
}), (_leafColDef$width2 = leafColDef == null ? void 0 : leafColDef.width) != null ? _leafColDef$width2 : 0),
|
|
277
284
|
renderCell: params => {
|
|
278
|
-
// Render
|
|
285
|
+
// Render footer
|
|
286
|
+
if (params.rowNode.position === 'footer') {
|
|
287
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridGroupingColumnFooterCell.GridGroupingColumnFooterCell, (0, _extends2.default)({}, params));
|
|
288
|
+
} // Render the leaves
|
|
289
|
+
|
|
290
|
+
|
|
279
291
|
if (params.rowNode.groupingField == null) {
|
|
280
292
|
if (leafColDef) {
|
|
281
293
|
const leafParams = (0, _extends2.default)({}, params.api.getCellParams(params.id, leafField), {
|
|
@@ -101,13 +101,17 @@ const filterRowTreeFromGroupingColumns = params => {
|
|
|
101
101
|
visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
|
|
102
102
|
filteredRowsLookup[node.id] = shouldPassFilters;
|
|
103
103
|
|
|
104
|
+
if (node.footerId != null) {
|
|
105
|
+
visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
|
|
106
|
+
}
|
|
107
|
+
|
|
104
108
|
if (!shouldPassFilters) {
|
|
105
109
|
return 0;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
filteredDescendantCountLookup[node.id] = filteredDescendantCount;
|
|
109
113
|
|
|
110
|
-
if (!node.children) {
|
|
114
|
+
if (!node.children && !node.isAutoGenerated) {
|
|
111
115
|
return filteredDescendantCount + 1;
|
|
112
116
|
}
|
|
113
117
|
|
|
@@ -31,6 +31,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
31
31
|
|
|
32
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
33
|
|
|
34
|
+
const Divider = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
35
|
+
onClick: event => event.stopPropagation()
|
|
36
|
+
});
|
|
37
|
+
|
|
34
38
|
const rowGroupingStateInitializer = (state, props, apiRef) => {
|
|
35
39
|
var _ref, _props$rowGroupingMod, _props$initialState, _props$initialState$r;
|
|
36
40
|
|
|
@@ -53,6 +57,8 @@ const rowGroupingStateInitializer = (state, props, apiRef) => {
|
|
|
53
57
|
exports.rowGroupingStateInitializer = rowGroupingStateInitializer;
|
|
54
58
|
|
|
55
59
|
const useGridRowGrouping = (apiRef, props) => {
|
|
60
|
+
var _props$initialState3, _props$initialState3$;
|
|
61
|
+
|
|
56
62
|
apiRef.current.unstable_registerControlState({
|
|
57
63
|
stateId: 'rowGrouping',
|
|
58
64
|
propModel: props.rowGroupingModel,
|
|
@@ -116,16 +122,16 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
116
122
|
* PRE-PROCESSING
|
|
117
123
|
*/
|
|
118
124
|
|
|
119
|
-
const addColumnMenuButtons = React.useCallback((initialValue,
|
|
125
|
+
const addColumnMenuButtons = React.useCallback((initialValue, column) => {
|
|
120
126
|
if (props.disableRowGrouping) {
|
|
121
127
|
return initialValue;
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
let menuItems;
|
|
125
131
|
|
|
126
|
-
if ((0, _gridRowGroupingUtils.isGroupingColumn)(
|
|
132
|
+
if ((0, _gridRowGroupingUtils.isGroupingColumn)(column.field)) {
|
|
127
133
|
menuItems = /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridRowGroupingColumnMenuItems.GridRowGroupingColumnMenuItems, {});
|
|
128
|
-
} else if (
|
|
134
|
+
} else if (column.groupable) {
|
|
129
135
|
menuItems = /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridRowGroupableColumnMenuItems.GridRowGroupableColumnMenuItems, {});
|
|
130
136
|
} else {
|
|
131
137
|
menuItems = null;
|
|
@@ -135,16 +141,19 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
135
141
|
return initialValue;
|
|
136
142
|
}
|
|
137
143
|
|
|
138
|
-
return [...initialValue, /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
144
|
+
return [...initialValue, /*#__PURE__*/(0, _jsxRuntime.jsx)(Divider, {}), menuItems];
|
|
139
145
|
}, [props.disableRowGrouping]);
|
|
140
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
141
|
-
|
|
142
|
-
return prevState;
|
|
143
|
-
}
|
|
146
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
147
|
+
var _props$initialState2, _props$initialState2$;
|
|
144
148
|
|
|
145
149
|
const rowGroupingModelToExport = (0, _gridRowGroupingSelector.gridRowGroupingModelSelector)(apiRef);
|
|
150
|
+
const shouldExportRowGroupingModel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
151
|
+
!context.exportOnlyDirtyModels || // Always export if the model is controlled
|
|
152
|
+
props.rowGroupingModel != null || // Always export if the model has been initialized
|
|
153
|
+
((_props$initialState2 = props.initialState) == null ? void 0 : (_props$initialState2$ = _props$initialState2.rowGrouping) == null ? void 0 : _props$initialState2$.model) != null || // Export if the model is not empty
|
|
154
|
+
Object.keys(rowGroupingModelToExport).length > 0;
|
|
146
155
|
|
|
147
|
-
if (
|
|
156
|
+
if (!shouldExportRowGroupingModel) {
|
|
148
157
|
return prevState;
|
|
149
158
|
}
|
|
150
159
|
|
|
@@ -153,7 +162,7 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
153
162
|
model: rowGroupingModelToExport
|
|
154
163
|
}
|
|
155
164
|
});
|
|
156
|
-
}, [apiRef, props.
|
|
165
|
+
}, [apiRef, props.rowGroupingModel, (_props$initialState3 = props.initialState) == null ? void 0 : (_props$initialState3$ = _props$initialState3.rowGrouping) == null ? void 0 : _props$initialState3$.model]);
|
|
157
166
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
158
167
|
var _context$stateToResto;
|
|
159
168
|
|
package/node/index.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
3
7
|
require("@mui/x-data-grid-pro/typeOverloads");
|
|
4
8
|
|
|
5
|
-
require("./modules");
|
|
9
|
+
var _modules = require("./modules");
|
|
10
|
+
|
|
11
|
+
Object.keys(_modules).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (key in exports && exports[key] === _modules[key]) return;
|
|
14
|
+
Object.defineProperty(exports, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _modules[key];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -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 = "MTY1ODQ0MDgwMDAwMA==";
|
|
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.14.0",
|
|
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.14.0",
|
|
37
|
+
"@mui/x-data-grid-pro": "5.14.0",
|
|
38
|
+
"@mui/x-license-pro": "5.14.0",
|
|
39
39
|
"@types/format-util": "^1.0.2",
|
|
40
40
|
"clsx": "^1.2.1",
|
|
41
41
|
"exceljs": "^4.3.0",
|
package/typeOverloads/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@mui/x-data-grid-pro/typeOverloads';
|
|
2
|
-
|
|
2
|
+
export * from './modules';
|
package/typeOverloads/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@mui/x-data-grid-pro/typeOverloads';
|
|
2
|
-
|
|
2
|
+
export * from './modules';
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { GridKeyValue, GridValidRowModel } from '@mui/x-data-grid-pro';
|
|
2
2
|
import type { GridControlledStateEventLookupPro, GridApiCachesPro } from '@mui/x-data-grid-pro/typeOverloads';
|
|
3
3
|
import type { GridGroupingValueGetterParams } from '../models';
|
|
4
|
-
import type { GridRowGroupingModel } from '../hooks';
|
|
4
|
+
import type { GridRowGroupingModel, GridAggregationModel, GridAggregationCellMeta, GridAggregationHeaderMeta } from '../hooks';
|
|
5
5
|
import { GridRowGroupingInternalCache } from '../hooks/features/rowGrouping/gridRowGroupingInterfaces';
|
|
6
|
+
import { GridAggregationInternalCache } from '../hooks/features/aggregation/gridAggregationInterfaces';
|
|
6
7
|
export interface GridControlledStateEventLookupPremium {
|
|
8
|
+
/**
|
|
9
|
+
* Fired when the aggregation model changes.
|
|
10
|
+
*/
|
|
11
|
+
aggregationModelChange: {
|
|
12
|
+
params: GridAggregationModel;
|
|
13
|
+
};
|
|
7
14
|
/**
|
|
8
15
|
* Fired when the row grouping model changes.
|
|
9
16
|
*/
|
|
@@ -12,6 +19,16 @@ export interface GridControlledStateEventLookupPremium {
|
|
|
12
19
|
};
|
|
13
20
|
}
|
|
14
21
|
export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
|
|
22
|
+
/**
|
|
23
|
+
* If `true`, the cells of the column can be aggregated based.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
private_aggregable?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Limit the aggregation function usable on this column.
|
|
29
|
+
* By default, the column will have all the aggregation functions that are compatible with its type.
|
|
30
|
+
*/
|
|
31
|
+
private_availableAggregationFunctions?: string[];
|
|
15
32
|
/**
|
|
16
33
|
* Function that transforms a complex cell value into a key that be used for grouping the rows.
|
|
17
34
|
* @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
|
|
@@ -19,14 +36,27 @@ export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F
|
|
|
19
36
|
*/
|
|
20
37
|
groupingValueGetter?: (params: GridGroupingValueGetterParams<V, R>) => GridKeyValue | null | undefined;
|
|
21
38
|
}
|
|
39
|
+
export interface GridRenderCellParamsPremium<V = any, R extends GridValidRowModel = any, F = V> {
|
|
40
|
+
aggregation?: GridAggregationCellMeta;
|
|
41
|
+
}
|
|
42
|
+
export interface GridColumnHeaderParamsPremium<V = any, R extends GridValidRowModel = any, F = V> {
|
|
43
|
+
aggregation?: GridAggregationHeaderMeta;
|
|
44
|
+
}
|
|
22
45
|
export interface GridApiCachesPremium extends GridApiCachesPro {
|
|
23
46
|
rowGrouping: GridRowGroupingInternalCache;
|
|
47
|
+
aggregation: GridAggregationInternalCache;
|
|
24
48
|
}
|
|
25
49
|
declare module '@mui/x-data-grid-pro' {
|
|
26
|
-
interface GridColDef<R
|
|
50
|
+
interface GridColDef<R, V, F> extends GridColDefPremium<R, V, F> {
|
|
27
51
|
}
|
|
28
52
|
interface GridControlledStateEventLookup extends GridControlledStateEventLookupPro, GridControlledStateEventLookupPremium {
|
|
29
53
|
}
|
|
54
|
+
interface GridRenderCellParams<V, R, F> extends GridRenderCellParamsPremium<V, R, F> {
|
|
55
|
+
}
|
|
56
|
+
interface GridColumnHeaderParams<V, R, F> extends GridColumnHeaderParamsPremium<V, R, F> {
|
|
57
|
+
}
|
|
58
|
+
interface GridApiCaches extends GridApiCachesPremium {
|
|
59
|
+
}
|
|
30
60
|
}
|
|
31
61
|
declare module '@mui/x-data-grid-pro/internals' {
|
|
32
62
|
interface GridApiCaches extends GridApiCachesPremium {
|
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 = "MTY1ODQ0MDgwMDAwMA==";
|
|
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).
|