@mui/x-data-grid-premium 5.13.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 +156 -6
- package/DataGridPremium/DataGridPremium.js +56 -0
- package/DataGridPremium/useDataGridPremiumComponent.js +10 -2
- 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 +103 -0
- package/hooks/features/aggregation/gridAggregationInterfaces.js +1 -0
- package/hooks/features/aggregation/gridAggregationSelectors.d.ts +4 -0
- package/hooks/features/aggregation/gridAggregationSelectors.js +4 -0
- package/hooks/features/aggregation/gridAggregationUtils.d.ts +41 -0
- package/hooks/features/aggregation/gridAggregationUtils.js +188 -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 +138 -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 +56 -0
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +10 -2
- 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 +10 -0
- package/legacy/hooks/features/aggregation/gridAggregationUtils.js +200 -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 +141 -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 +40 -1
- package/models/gridApiPremium.d.ts +3 -3
- package/models/gridStatePremium.d.ts +3 -1
- package/modern/DataGridPremium/DataGridPremium.js +56 -0
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +10 -2
- 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 +4 -0
- package/modern/hooks/features/aggregation/gridAggregationUtils.js +186 -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 +136 -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 +56 -0
- package/node/DataGridPremium/useDataGridPremiumComponent.js +11 -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 +16 -0
- package/node/hooks/features/aggregation/gridAggregationUtils.js +223 -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 +162 -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 +5 -5
- 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
|
@@ -4,6 +4,7 @@ const _excluded = ["leafField", "mainGroupingCriteria", "hideDescendantCount"],
|
|
|
4
4
|
_excluded2 = ["leafField", "mainGroupingCriteria", "hideDescendantCount"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid-pro';
|
|
7
|
+
import { GridGroupingColumnFooterCell } from '../../../components/GridGroupingColumnFooterCell';
|
|
7
8
|
import { GridGroupingCriteriaCell } from '../../../components/GridGroupingCriteriaCell';
|
|
8
9
|
import { GridGroupingColumnLeafCell } from '../../../components/GridGroupingColumnLeafCell';
|
|
9
10
|
import { getRowGroupingFieldFromGroupingCriteria, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD } from './gridRowGroupingUtils';
|
|
@@ -142,7 +143,12 @@ export const createGroupingColDefForOneGroupingCriteria = ({
|
|
|
142
143
|
const commonProperties = {
|
|
143
144
|
width: Math.max((groupedByColDef.width ?? GRID_STRING_COL_DEF.width) + 40, leafColDef?.width ?? 0),
|
|
144
145
|
renderCell: params => {
|
|
145
|
-
// Render
|
|
146
|
+
// Render footer
|
|
147
|
+
if (params.rowNode.position === 'footer') {
|
|
148
|
+
return /*#__PURE__*/_jsx(GridGroupingColumnFooterCell, _extends({}, params));
|
|
149
|
+
} // Render leaves
|
|
150
|
+
|
|
151
|
+
|
|
146
152
|
if (params.rowNode.groupingField == null) {
|
|
147
153
|
if (leafColDef) {
|
|
148
154
|
const leafParams = _extends({}, params.api.getCellParams(params.id, leafField), {
|
|
@@ -237,7 +243,12 @@ export const createGroupingColDefForAllGroupingCriteria = ({
|
|
|
237
243
|
headerName: apiRef.current.getLocaleText('groupingColumnHeaderName'),
|
|
238
244
|
width: Math.max(...rowGroupingModel.map(field => (columnsLookup[field].width ?? GRID_STRING_COL_DEF.width) + 40), leafColDef?.width ?? 0),
|
|
239
245
|
renderCell: params => {
|
|
240
|
-
// Render
|
|
246
|
+
// Render footer
|
|
247
|
+
if (params.rowNode.position === 'footer') {
|
|
248
|
+
return /*#__PURE__*/_jsx(GridGroupingColumnFooterCell, _extends({}, params));
|
|
249
|
+
} // Render the leaves
|
|
250
|
+
|
|
251
|
+
|
|
241
252
|
if (params.rowNode.groupingField == null) {
|
|
242
253
|
if (leafColDef) {
|
|
243
254
|
const leafParams = _extends({}, params.api.getCellParams(params.id, leafField), {
|
|
@@ -77,13 +77,17 @@ export const filterRowTreeFromGroupingColumns = params => {
|
|
|
77
77
|
visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
|
|
78
78
|
filteredRowsLookup[node.id] = shouldPassFilters;
|
|
79
79
|
|
|
80
|
+
if (node.footerId != null) {
|
|
81
|
+
visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
if (!shouldPassFilters) {
|
|
81
85
|
return 0;
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
filteredDescendantCountLookup[node.id] = filteredDescendantCount;
|
|
85
89
|
|
|
86
|
-
if (!node.children) {
|
|
90
|
+
if (!node.children && !node.isAutoGenerated) {
|
|
87
91
|
return filteredDescendantCount + 1;
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import MuiDivider from '@mui/material/Divider';
|
|
4
4
|
import { useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid-pro';
|
|
5
5
|
import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid-pro/internals';
|
|
6
6
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
@@ -8,6 +8,11 @@ import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroup
|
|
|
8
8
|
import { GridRowGroupableColumnMenuItems } from '../../../components/GridRowGroupableColumnMenuItems';
|
|
9
9
|
import { GridRowGroupingColumnMenuItems } from '../../../components/GridRowGroupingColumnMenuItems';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
const Divider = () => /*#__PURE__*/_jsx(MuiDivider, {
|
|
13
|
+
onClick: event => event.stopPropagation()
|
|
14
|
+
});
|
|
15
|
+
|
|
11
16
|
export const rowGroupingStateInitializer = (state, props, apiRef) => {
|
|
12
17
|
apiRef.current.unstable_caches.rowGrouping = {
|
|
13
18
|
sanitizedModelOnLastRowTreeCreation: []
|
|
@@ -88,16 +93,16 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
88
93
|
* PRE-PROCESSING
|
|
89
94
|
*/
|
|
90
95
|
|
|
91
|
-
const addColumnMenuButtons = React.useCallback((initialValue,
|
|
96
|
+
const addColumnMenuButtons = React.useCallback((initialValue, column) => {
|
|
92
97
|
if (props.disableRowGrouping) {
|
|
93
98
|
return initialValue;
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
let menuItems;
|
|
97
102
|
|
|
98
|
-
if (isGroupingColumn(
|
|
103
|
+
if (isGroupingColumn(column.field)) {
|
|
99
104
|
menuItems = /*#__PURE__*/_jsx(GridRowGroupingColumnMenuItems, {});
|
|
100
|
-
} else if (
|
|
105
|
+
} else if (column.groupable) {
|
|
101
106
|
menuItems = /*#__PURE__*/_jsx(GridRowGroupableColumnMenuItems, {});
|
|
102
107
|
} else {
|
|
103
108
|
menuItems = null;
|
|
@@ -109,14 +114,15 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
109
114
|
|
|
110
115
|
return [...initialValue, /*#__PURE__*/_jsx(Divider, {}), menuItems];
|
|
111
116
|
}, [props.disableRowGrouping]);
|
|
112
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
113
|
-
if (props.disableRowGrouping) {
|
|
114
|
-
return prevState;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
117
118
|
const rowGroupingModelToExport = gridRowGroupingModelSelector(apiRef);
|
|
119
|
+
const shouldExportRowGroupingModel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
120
|
+
!context.exportOnlyDirtyModels || // Always export if the model is controlled
|
|
121
|
+
props.rowGroupingModel != null || // Always export if the model has been initialized
|
|
122
|
+
props.initialState?.rowGrouping?.model != null || // Export if the model is not empty
|
|
123
|
+
Object.keys(rowGroupingModelToExport).length > 0;
|
|
118
124
|
|
|
119
|
-
if (
|
|
125
|
+
if (!shouldExportRowGroupingModel) {
|
|
120
126
|
return prevState;
|
|
121
127
|
}
|
|
122
128
|
|
|
@@ -125,7 +131,7 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
125
131
|
model: rowGroupingModelToExport
|
|
126
132
|
}
|
|
127
133
|
});
|
|
128
|
-
}, [apiRef, props.
|
|
134
|
+
}, [apiRef, props.rowGroupingModel, props.initialState?.rowGrouping?.model]);
|
|
129
135
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
130
136
|
if (props.disableRowGrouping) {
|
|
131
137
|
return params;
|
package/modern/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@mui/x-data-grid-pro/typeOverloads';
|
|
2
|
-
|
|
2
|
+
export * from './modules';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY1OTA0NTYwMDAwMA==";
|
|
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).
|
|
@@ -65,6 +65,25 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
65
65
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
66
66
|
// ----------------------------------------------------------------------
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Aggregation functions available on the grid.
|
|
70
|
+
* @default GRID_AGGREGATION_FUNCTIONS
|
|
71
|
+
*/
|
|
72
|
+
aggregationFunctions: _propTypes.default.object,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Set the aggregation model of the grid.
|
|
76
|
+
*/
|
|
77
|
+
aggregationModel: _propTypes.default.object,
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Rows used to generate the aggregated value.
|
|
81
|
+
* If `filtered`, the aggregated values will be generated using only the rows currently passing the filtering process.
|
|
82
|
+
* If `all`, the aggregated values will be generated using all the rows.
|
|
83
|
+
* @default "filtered"
|
|
84
|
+
*/
|
|
85
|
+
aggregationRowsScope: _propTypes.default.oneOf(['all', 'filtered']),
|
|
86
|
+
|
|
68
87
|
/**
|
|
69
88
|
* The ref object that allows grid manipulation. Can be instantiated with [[useGridApiRef()]].
|
|
70
89
|
*/
|
|
@@ -179,6 +198,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
179
198
|
*/
|
|
180
199
|
detailPanelExpandedRowIds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired),
|
|
181
200
|
|
|
201
|
+
/**
|
|
202
|
+
* If `true`, aggregation is disabled.
|
|
203
|
+
* @default false
|
|
204
|
+
*/
|
|
205
|
+
disableAggregation: _propTypes.default.bool,
|
|
206
|
+
|
|
182
207
|
/**
|
|
183
208
|
* If `true`, the filtering will only be applied to the top level rows when grouping rows with the `treeData` prop.
|
|
184
209
|
* @default false
|
|
@@ -239,6 +264,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
239
264
|
*/
|
|
240
265
|
disableExtendRowFullWidth: _propTypes.default.bool,
|
|
241
266
|
|
|
267
|
+
/**
|
|
268
|
+
* If `true`, modification to a cell will not be discarded if the mode is changed from "edit" to "view" while processing props.
|
|
269
|
+
* @default false
|
|
270
|
+
*/
|
|
271
|
+
disableIgnoreModificationsIfProcessingProps: _propTypes.default.bool,
|
|
272
|
+
|
|
242
273
|
/**
|
|
243
274
|
* If `true`, filtering with multiple columns is disabled.
|
|
244
275
|
* @default false
|
|
@@ -296,8 +327,10 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
296
327
|
* 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.
|
|
297
328
|
*/
|
|
298
329
|
experimentalFeatures: _propTypes.default.shape({
|
|
330
|
+
aggregation: _propTypes.default.bool,
|
|
299
331
|
newEditingApi: _propTypes.default.bool,
|
|
300
332
|
preventCommitWhileValidating: _propTypes.default.bool,
|
|
333
|
+
rowPinning: _propTypes.default.bool,
|
|
301
334
|
warnIfFocusStateIsNotSynced: _propTypes.default.bool
|
|
302
335
|
}),
|
|
303
336
|
|
|
@@ -329,6 +362,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
329
362
|
quickFilterValues: _propTypes.default.array
|
|
330
363
|
}),
|
|
331
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Determines the position of an aggregated value.
|
|
367
|
+
* @param {GridRowTreeNodeConfig | null} groupNode The current group (`null` being the top level group).
|
|
368
|
+
* @returns {GridAggregationPosition | null} Position of the aggregated value (if `null`, the group will not be aggregated).
|
|
369
|
+
* @default `(groupNode) => groupNode == null ? 'footer' : 'inline'`
|
|
370
|
+
*/
|
|
371
|
+
getAggregationPosition: _propTypes.default.func,
|
|
372
|
+
|
|
332
373
|
/**
|
|
333
374
|
* Function that applies CSS classes dynamically on cells.
|
|
334
375
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -508,6 +549,13 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
508
549
|
*/
|
|
509
550
|
nonce: _propTypes.default.string,
|
|
510
551
|
|
|
552
|
+
/**
|
|
553
|
+
* Callback fired when the row grouping model changes.
|
|
554
|
+
* @param {GridAggregationModel} model The aggregated columns.
|
|
555
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
556
|
+
*/
|
|
557
|
+
onAggregationModelChange: _propTypes.default.func,
|
|
558
|
+
|
|
511
559
|
/**
|
|
512
560
|
* Callback fired when any cell is clicked.
|
|
513
561
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -889,6 +937,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
889
937
|
right: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
890
938
|
}),
|
|
891
939
|
|
|
940
|
+
/**
|
|
941
|
+
* Rows data to pin on top or bottom.
|
|
942
|
+
*/
|
|
943
|
+
pinnedRows: _propTypes.default.shape({
|
|
944
|
+
bottom: _propTypes.default.array,
|
|
945
|
+
top: _propTypes.default.array
|
|
946
|
+
}),
|
|
947
|
+
|
|
892
948
|
/**
|
|
893
949
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
894
950
|
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
@@ -7,6 +7,10 @@ exports.useDataGridPremiumComponent = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
9
9
|
|
|
10
|
+
var _useGridAggregation = require("../hooks/features/aggregation/useGridAggregation");
|
|
11
|
+
|
|
12
|
+
var _useGridAggregationPreProcessors = require("../hooks/features/aggregation/useGridAggregationPreProcessors");
|
|
13
|
+
|
|
10
14
|
var _useGridRowGrouping = require("../hooks/features/rowGrouping/useGridRowGrouping");
|
|
11
15
|
|
|
12
16
|
var _useGridRowGroupingPreProcessors = require("../hooks/features/rowGrouping/useGridRowGroupingPreProcessors");
|
|
@@ -26,6 +30,8 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
26
30
|
(0, _internals.useGridRowReorderPreProcessors)(apiRef, props);
|
|
27
31
|
(0, _useGridRowGroupingPreProcessors.useGridRowGroupingPreProcessors)(apiRef, props);
|
|
28
32
|
(0, _internals.useGridTreeDataPreProcessors)(apiRef, props);
|
|
33
|
+
(0, _internals.useGridRowPinningPreProcessors)(apiRef);
|
|
34
|
+
(0, _useGridAggregationPreProcessors.useGridAggregationPreProcessors)(apiRef, props);
|
|
29
35
|
(0, _internals.useGridDetailPanelPreProcessors)(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
|
|
30
36
|
// Because it changes the order of the columns.
|
|
31
37
|
|
|
@@ -36,10 +42,12 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
36
42
|
*/
|
|
37
43
|
|
|
38
44
|
(0, _internals.useGridInitializeState)(_useGridRowGrouping.rowGroupingStateInitializer, apiRef, props);
|
|
45
|
+
(0, _internals.useGridInitializeState)(_useGridAggregation.aggregationStateInitializer, apiRef, props);
|
|
39
46
|
(0, _internals.useGridInitializeState)(_internals.selectionStateInitializer, apiRef, props);
|
|
40
47
|
(0, _internals.useGridInitializeState)(_internals.detailPanelStateInitializer, apiRef, props);
|
|
41
48
|
(0, _internals.useGridInitializeState)(_internals.columnPinningStateInitializer, apiRef, props);
|
|
42
49
|
(0, _internals.useGridInitializeState)(_internals.columnsStateInitializer, apiRef, props);
|
|
50
|
+
(0, _internals.useGridInitializeState)(_internals.rowPinningStateInitializer, apiRef, props);
|
|
43
51
|
(0, _internals.useGridInitializeState)(_internals.rowsStateInitializer, apiRef, props);
|
|
44
52
|
(0, _internals.useGridInitializeState)((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? _internals.editingStateInitializer_new : _internals.editingStateInitializer_old, apiRef, props);
|
|
45
53
|
(0, _internals.useGridInitializeState)(_internals.focusStateInitializer, apiRef, props);
|
|
@@ -54,9 +62,11 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
54
62
|
(0, _internals.useGridInitializeState)(_internals.columnMenuStateInitializer, apiRef, props);
|
|
55
63
|
(0, _useGridRowGrouping.useGridRowGrouping)(apiRef, props);
|
|
56
64
|
(0, _internals.useGridTreeData)(apiRef);
|
|
65
|
+
(0, _useGridAggregation.useGridAggregation)(apiRef, props);
|
|
57
66
|
(0, _internals.useGridKeyboardNavigation)(apiRef, props);
|
|
58
67
|
(0, _internals.useGridSelection)(apiRef, props);
|
|
59
68
|
(0, _internals.useGridColumnPinning)(apiRef, props);
|
|
69
|
+
(0, _internals.useGridRowPinning)(apiRef, props);
|
|
60
70
|
(0, _internals.useGridColumns)(apiRef, props);
|
|
61
71
|
(0, _internals.useGridRows)(apiRef, props);
|
|
62
72
|
(0, _internals.useGridParamsApi)(apiRef);
|
|
@@ -65,7 +75,7 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
65
75
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? _internals.useGridEditing_new : _internals.useGridEditing_old;
|
|
66
76
|
useGridEditing(apiRef, props);
|
|
67
77
|
(0, _internals.useGridFocus)(apiRef, props);
|
|
68
|
-
(0, _internals.useGridPreferencesPanel)(apiRef);
|
|
78
|
+
(0, _internals.useGridPreferencesPanel)(apiRef, props);
|
|
69
79
|
(0, _internals.useGridFilter)(apiRef, props);
|
|
70
80
|
(0, _internals.useGridSorting)(apiRef, props);
|
|
71
81
|
(0, _internals.useGridDensity)(apiRef, props);
|
|
@@ -15,6 +15,8 @@ var _styles = require("@mui/material/styles");
|
|
|
15
15
|
|
|
16
16
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
17
17
|
|
|
18
|
+
var _aggregation = require("../hooks/features/aggregation");
|
|
19
|
+
|
|
18
20
|
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); }
|
|
19
21
|
|
|
20
22
|
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; }
|
|
@@ -23,8 +25,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
25
|
* The default values of `DataGridPremiumPropsWithDefaultValue` to inject in the props of DataGridPremium.
|
|
24
26
|
*/
|
|
25
27
|
const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = (0, _extends2.default)({}, _xDataGridPro.DATA_GRID_PRO_PROPS_DEFAULT_VALUES, {
|
|
28
|
+
disableAggregation: false,
|
|
26
29
|
disableRowGrouping: false,
|
|
27
|
-
rowGroupingColumnMode: 'single'
|
|
30
|
+
rowGroupingColumnMode: 'single',
|
|
31
|
+
aggregationFunctions: _aggregation.GRID_AGGREGATION_FUNCTIONS,
|
|
32
|
+
aggregationRowsScope: 'filtered',
|
|
33
|
+
getAggregationPosition: groupNode => groupNode == null ? 'footer' : 'inline'
|
|
28
34
|
});
|
|
29
35
|
exports.DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES;
|
|
30
36
|
|
|
@@ -47,11 +53,16 @@ const useDataGridPremiumProps = inProps => {
|
|
|
47
53
|
});
|
|
48
54
|
return mergedComponents;
|
|
49
55
|
}, [themedProps.components]);
|
|
50
|
-
return React.useMemo(() =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
return React.useMemo(() => {
|
|
57
|
+
var _themedProps$experime;
|
|
58
|
+
|
|
59
|
+
return (0, _extends2.default)({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
|
|
60
|
+
disableAggregation: themedProps.disableAggregation || !((_themedProps$experime = themedProps.experimentalFeatures) != null && _themedProps$experime.aggregation),
|
|
61
|
+
localeText,
|
|
62
|
+
components,
|
|
63
|
+
signature: 'DataGridPremium'
|
|
64
|
+
});
|
|
65
|
+
}, [themedProps, localeText, components]);
|
|
55
66
|
};
|
|
56
67
|
|
|
57
68
|
exports.useDataGridPremiumProps = useDataGridPremiumProps;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.GridAggregationColumnMenuItem = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
|
+
|
|
14
|
+
var _toPropertyKey2 = _interopRequireDefault(require("@babel/runtime/helpers/toPropertyKey"));
|
|
15
|
+
|
|
16
|
+
var React = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
19
|
+
|
|
20
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
21
|
+
|
|
22
|
+
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
23
|
+
|
|
24
|
+
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
25
|
+
|
|
26
|
+
var _utils = require("@mui/material/utils");
|
|
27
|
+
|
|
28
|
+
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
29
|
+
|
|
30
|
+
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
31
|
+
|
|
32
|
+
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
33
|
+
|
|
34
|
+
var _gridAggregationUtils = require("../hooks/features/aggregation/gridAggregationUtils");
|
|
35
|
+
|
|
36
|
+
var _gridAggregationSelectors = require("../hooks/features/aggregation/gridAggregationSelectors");
|
|
37
|
+
|
|
38
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
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; }
|
|
43
|
+
|
|
44
|
+
const GridAggregationColumnMenuItem = props => {
|
|
45
|
+
const {
|
|
46
|
+
column,
|
|
47
|
+
label,
|
|
48
|
+
availableAggregationFunctions
|
|
49
|
+
} = props;
|
|
50
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
51
|
+
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
52
|
+
const id = (0, _utils.unstable_useId)();
|
|
53
|
+
const aggregationModel = (0, _xDataGridPro.useGridSelector)(apiRef, _gridAggregationSelectors.gridAggregationModelSelector);
|
|
54
|
+
const selectedAggregationRule = React.useMemo(() => {
|
|
55
|
+
if (!column || !aggregationModel[column.field]) {
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const aggregationFunctionName = aggregationModel[column.field];
|
|
60
|
+
|
|
61
|
+
if ((0, _gridAggregationUtils.canColumnHaveAggregationFunction)({
|
|
62
|
+
column,
|
|
63
|
+
aggregationFunctionName,
|
|
64
|
+
aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName]
|
|
65
|
+
})) {
|
|
66
|
+
return aggregationFunctionName;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return '';
|
|
70
|
+
}, [rootProps.aggregationFunctions, aggregationModel, column]);
|
|
71
|
+
|
|
72
|
+
const handleAggregationItemChange = event => {
|
|
73
|
+
const newAggregationItem = event.target.value || undefined;
|
|
74
|
+
const currentModel = (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef);
|
|
75
|
+
const _column$field = column.field,
|
|
76
|
+
otherColumnItems = (0, _objectWithoutPropertiesLoose2.default)(currentModel, [_column$field].map(_toPropertyKey2.default));
|
|
77
|
+
const newModel = newAggregationItem == null ? otherColumnItems : (0, _extends2.default)({}, otherColumnItems, {
|
|
78
|
+
[column.field]: newAggregationItem
|
|
79
|
+
});
|
|
80
|
+
apiRef.current.setAggregationModel(newModel);
|
|
81
|
+
apiRef.current.hideColumnMenu();
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
85
|
+
disableRipple: true,
|
|
86
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FormControl.default, {
|
|
87
|
+
size: "small",
|
|
88
|
+
sx: {
|
|
89
|
+
width: 150
|
|
90
|
+
},
|
|
91
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputLabel.default, {
|
|
92
|
+
id: `${id}-label`,
|
|
93
|
+
children: label
|
|
94
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Select.default, {
|
|
95
|
+
labelId: `${id}-label`,
|
|
96
|
+
id: `${id}-input`,
|
|
97
|
+
value: selectedAggregationRule,
|
|
98
|
+
label: label,
|
|
99
|
+
onChange: handleAggregationItemChange,
|
|
100
|
+
onBlur: e => e.stopPropagation(),
|
|
101
|
+
fullWidth: true,
|
|
102
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
103
|
+
value: "",
|
|
104
|
+
children: "..."
|
|
105
|
+
}), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
106
|
+
value: aggFunc,
|
|
107
|
+
children: (0, _gridAggregationUtils.getAggregationFunctionLabel)({
|
|
108
|
+
apiRef,
|
|
109
|
+
aggregationRule: {
|
|
110
|
+
aggregationFunctionName: aggFunc,
|
|
111
|
+
aggregationFunction: rootProps.aggregationFunctions[aggFunc]
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
}, aggFunc))]
|
|
115
|
+
})]
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
exports.GridAggregationColumnMenuItem = GridAggregationColumnMenuItem;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.GridAggregationHeader = void 0;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _material = require("@mui/material");
|
|
13
|
+
|
|
14
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
15
|
+
|
|
16
|
+
var _styles = require("@mui/material/styles");
|
|
17
|
+
|
|
18
|
+
var _xDataGrid = require("@mui/x-data-grid");
|
|
19
|
+
|
|
20
|
+
var _gridAggregationUtils = require("../hooks/features/aggregation/gridAggregationUtils");
|
|
21
|
+
|
|
22
|
+
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
23
|
+
|
|
24
|
+
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
25
|
+
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
const GridAggregationHeaderRoot = (0, _styles.styled)(_Box.default, {
|
|
33
|
+
name: 'MuiDataGrid',
|
|
34
|
+
slot: 'AggregationColumnHeader',
|
|
35
|
+
overridesResolver: (_, styles) => styles.aggregationColumnHeader
|
|
36
|
+
})({
|
|
37
|
+
display: 'flex',
|
|
38
|
+
flexDirection: 'column',
|
|
39
|
+
[`&.${_xDataGrid.gridClasses['aggregationColumnHeader--alignRight']}`]: {
|
|
40
|
+
alignItems: 'flex-end'
|
|
41
|
+
},
|
|
42
|
+
[`&.${_xDataGrid.gridClasses['aggregationColumnHeader--alignCenter']}`]: {
|
|
43
|
+
alignItems: 'center'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const GridAggregationFunctionLabel = (0, _styles.styled)('div', {
|
|
47
|
+
name: 'MuiDataGrid',
|
|
48
|
+
slot: 'AggregationColumnHeaderLabel',
|
|
49
|
+
overridesResolver: (_, styles) => styles.aggregationColumnHeaderLabel
|
|
50
|
+
})(({
|
|
51
|
+
theme
|
|
52
|
+
}) => {
|
|
53
|
+
return {
|
|
54
|
+
fontSize: theme.typography.caption.fontSize,
|
|
55
|
+
lineHeight: theme.typography.caption.fontSize,
|
|
56
|
+
marginTop: `calc(-2px - ${theme.typography.caption.fontSize})`,
|
|
57
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
58
|
+
color: theme.palette.primary.dark,
|
|
59
|
+
textTransform: 'uppercase'
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const useUtilityClasses = ownerState => {
|
|
64
|
+
const {
|
|
65
|
+
classes,
|
|
66
|
+
colDef
|
|
67
|
+
} = ownerState;
|
|
68
|
+
const slots = {
|
|
69
|
+
root: ['aggregationColumnHeader', colDef.headerAlign === 'left' && 'aggregationColumnHeader--alignLeft', colDef.headerAlign === 'center' && 'aggregationColumnHeader--alignCenter', colDef.headerAlign === 'right' && 'aggregationColumnHeader--alignRight'],
|
|
70
|
+
aggregationLabel: ['aggregationColumnHeaderLabel']
|
|
71
|
+
};
|
|
72
|
+
return (0, _material.unstable_composeClasses)(slots, _xDataGrid.getDataGridUtilityClass, classes);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const GridAggregationHeader = props => {
|
|
76
|
+
var _colDef$headerName;
|
|
77
|
+
|
|
78
|
+
const {
|
|
79
|
+
colDef,
|
|
80
|
+
aggregation
|
|
81
|
+
} = props;
|
|
82
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
83
|
+
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
84
|
+
const headerHeight = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridDensityHeaderHeightSelector);
|
|
85
|
+
const ownerState = {
|
|
86
|
+
classes: rootProps.classes,
|
|
87
|
+
headerHeight,
|
|
88
|
+
colDef
|
|
89
|
+
};
|
|
90
|
+
const classes = useUtilityClasses(ownerState);
|
|
91
|
+
|
|
92
|
+
if (!aggregation) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const aggregationLabel = (0, _gridAggregationUtils.getAggregationFunctionLabel)({
|
|
97
|
+
apiRef,
|
|
98
|
+
aggregationRule: aggregation.aggregationRule
|
|
99
|
+
});
|
|
100
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GridAggregationHeaderRoot, {
|
|
101
|
+
ownerState: ownerState,
|
|
102
|
+
className: classes.root,
|
|
103
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.GridColumnHeaderTitle, {
|
|
104
|
+
label: (_colDef$headerName = colDef.headerName) != null ? _colDef$headerName : colDef.field,
|
|
105
|
+
description: colDef.description,
|
|
106
|
+
columnWidth: colDef.computedWidth
|
|
107
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(GridAggregationFunctionLabel, {
|
|
108
|
+
ownerState: ownerState,
|
|
109
|
+
className: classes.aggregationLabel,
|
|
110
|
+
children: aggregationLabel
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
exports.GridAggregationHeader = GridAggregationHeader;
|
|
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.GridExcelExportMenuItem = void 0;
|
|
9
9
|
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
|
+
|
|
10
14
|
var React = _interopRequireWildcard(require("react"));
|
|
11
15
|
|
|
12
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -17,6 +21,8 @@ var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
|
17
21
|
|
|
18
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
23
|
|
|
24
|
+
const _excluded = ["hideMenu", "options"];
|
|
25
|
+
|
|
20
26
|
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); }
|
|
21
27
|
|
|
22
28
|
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; }
|
|
@@ -26,14 +32,16 @@ const GridExcelExportMenuItem = props => {
|
|
|
26
32
|
const {
|
|
27
33
|
hideMenu,
|
|
28
34
|
options
|
|
29
|
-
} = props
|
|
30
|
-
|
|
35
|
+
} = props,
|
|
36
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, (0, _extends2.default)({
|
|
31
38
|
onClick: () => {
|
|
32
39
|
apiRef.current.exportDataAsExcel(options);
|
|
33
40
|
hideMenu == null ? void 0 : hideMenu();
|
|
34
|
-
}
|
|
41
|
+
}
|
|
42
|
+
}, other, {
|
|
35
43
|
children: apiRef.current.getLocaleText('toolbarExportExcel')
|
|
36
|
-
});
|
|
44
|
+
}));
|
|
37
45
|
};
|
|
38
46
|
|
|
39
47
|
exports.GridExcelExportMenuItem = GridExcelExportMenuItem;
|