@mui/x-data-grid-premium 8.0.0-alpha.1 → 8.0.0-alpha.11
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 +2007 -230
- package/DataGridPremium/DataGridPremium.js +41 -40
- package/DataGridPremium/useDataGridPremiumComponent.d.ts +2 -2
- package/DataGridPremium/useDataGridPremiumComponent.js +6 -4
- package/DataGridPremium/useDataGridPremiumProps.js +5 -3
- package/README.md +1 -1
- package/components/GridAggregationHeader.js +6 -1
- package/components/GridColumnMenuAggregationItem.js +77 -49
- package/components/GridColumnMenuRowGroupItem.js +5 -11
- package/components/GridColumnMenuRowUngroupItem.js +10 -19
- package/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/components/GridPremiumColumnMenu.d.ts +1 -1
- package/components/GridPremiumColumnMenu.js +5 -5
- package/components/promptControl/GridToolbarPromptControl.js +47 -36
- package/esm/DataGridPremium/DataGridPremium.js +43 -42
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +7 -5
- package/esm/DataGridPremium/useDataGridPremiumProps.js +6 -4
- package/esm/components/GridAggregationHeader.js +6 -1
- package/esm/components/GridColumnMenuAggregationItem.js +75 -47
- package/esm/components/GridColumnMenuRowGroupItem.js +6 -11
- package/esm/components/GridColumnMenuRowUngroupItem.js +11 -19
- package/esm/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/esm/components/GridPremiumColumnMenu.js +5 -5
- package/esm/components/promptControl/GridToolbarPromptControl.js +47 -36
- package/esm/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/esm/hooks/features/aggregation/gridAggregationUtils.js +18 -14
- package/esm/hooks/features/aggregation/index.js +0 -1
- package/esm/hooks/features/aggregation/useGridAggregation.js +22 -12
- package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
- package/esm/hooks/features/cellSelection/useGridCellSelection.js +17 -15
- package/esm/hooks/features/clipboard/useGridClipboardImport.js +1 -1
- package/esm/hooks/features/dataSource/cache.js +3 -0
- package/esm/hooks/features/dataSource/models.js +1 -0
- package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
- package/esm/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -3
- package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +2 -2
- package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/esm/hooks/utils/useGridAriaAttributes.js +1 -3
- package/esm/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/aggregation/createAggregationLookup.d.ts +7 -6
- package/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +18 -5
- package/hooks/features/aggregation/gridAggregationSelectors.d.ts +2 -2
- package/hooks/features/aggregation/gridAggregationUtils.d.ts +12 -13
- package/hooks/features/aggregation/gridAggregationUtils.js +18 -14
- package/hooks/features/aggregation/index.d.ts +1 -1
- package/hooks/features/aggregation/index.js +0 -12
- package/hooks/features/aggregation/useGridAggregation.d.ts +2 -2
- package/hooks/features/aggregation/useGridAggregation.js +22 -12
- package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +2 -2
- package/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +3 -2
- package/hooks/features/cellSelection/gridCellSelectionInterfaces.d.ts +3 -3
- package/hooks/features/cellSelection/useGridCellSelection.d.ts +2 -2
- package/hooks/features/cellSelection/useGridCellSelection.js +15 -13
- package/hooks/features/clipboard/useGridClipboardImport.d.ts +2 -2
- package/hooks/features/clipboard/useGridClipboardImport.js +1 -1
- package/hooks/features/dataSource/cache.d.ts +2 -0
- package/hooks/features/dataSource/cache.js +9 -0
- package/hooks/features/dataSource/models.d.ts +47 -0
- package/hooks/features/dataSource/models.js +5 -0
- package/hooks/features/dataSource/useGridDataSourcePremium.d.ts +4 -0
- package/hooks/features/dataSource/useGridDataSourcePremium.js +62 -0
- package/hooks/features/export/serializer/excelSerializer.d.ts +3 -2
- package/hooks/features/export/useGridExcelExport.d.ts +2 -2
- package/hooks/features/rowGrouping/createGroupingColDef.d.ts +2 -2
- package/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/hooks/features/rowGrouping/gridRowGroupingSelector.d.ts +2 -2
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +4 -4
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -2
- package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +2 -2
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +2 -2
- package/hooks/features/rowGrouping/useGridRowGrouping.js +1 -1
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +2 -2
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/hooks/utils/useGridApiContext.d.ts +3 -1
- package/hooks/utils/useGridApiRef.d.ts +3 -1
- package/hooks/utils/useGridAriaAttributes.js +1 -3
- package/hooks/utils/useGridPrivateApiContext.d.ts +1 -1
- package/hooks/utils/useKeepGroupedColumnsHidden.d.ts +2 -2
- package/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/models/dataGridPremiumProps.d.ts +8 -12
- package/models/gridApiPremium.d.ts +5 -3
- package/models/gridGroupingValueGetter.d.ts +2 -1
- package/models/gridPastedValueParser.d.ts +2 -1
- package/modern/DataGridPremium/DataGridPremium.js +43 -42
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +7 -5
- package/modern/DataGridPremium/useDataGridPremiumProps.js +6 -4
- package/modern/components/GridAggregationHeader.js +6 -1
- package/modern/components/GridColumnMenuAggregationItem.js +75 -47
- package/modern/components/GridColumnMenuRowGroupItem.js +6 -11
- package/modern/components/GridColumnMenuRowUngroupItem.js +11 -19
- package/modern/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/modern/components/GridPremiumColumnMenu.js +5 -5
- package/modern/components/promptControl/GridToolbarPromptControl.js +47 -36
- package/modern/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/modern/hooks/features/aggregation/gridAggregationUtils.js +18 -14
- package/modern/hooks/features/aggregation/index.js +0 -1
- package/modern/hooks/features/aggregation/useGridAggregation.js +22 -12
- package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
- package/modern/hooks/features/cellSelection/useGridCellSelection.js +17 -15
- package/modern/hooks/features/clipboard/useGridClipboardImport.js +1 -1
- package/modern/hooks/features/dataSource/cache.js +3 -0
- package/modern/hooks/features/dataSource/models.js +1 -0
- package/modern/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
- package/modern/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -3
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +2 -2
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/modern/hooks/utils/useGridAriaAttributes.js +1 -3
- package/modern/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +6 -6
- package/utils/releaseInfo.js +1 -1
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import ownerDocument from '@mui/utils/ownerDocument';
|
|
4
4
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
5
|
-
import { getTotalHeaderHeight, getVisibleRows, isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor
|
|
6
|
-
import { useGridApiEventHandler, useGridApiMethod, GRID_ACTIONS_COLUMN_TYPE, GRID_CHECKBOX_SELECTION_COL_DEF, GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
5
|
+
import { getTotalHeaderHeight, getVisibleRows, isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor } from '@mui/x-data-grid-pro/internals';
|
|
6
|
+
import { useGridApiEventHandler, useGridApiMethod, GRID_ACTIONS_COLUMN_TYPE, GRID_CHECKBOX_SELECTION_COL_DEF, GRID_DETAIL_PANEL_TOGGLE_FIELD, gridClasses, gridFocusCellSelector, GRID_REORDER_COL_DEF, gridSortedRowIdsSelector, gridDimensionsSelector } from '@mui/x-data-grid-pro';
|
|
7
7
|
import { gridCellSelectionStateSelector } from "./gridCellSelectionSelector.js";
|
|
8
8
|
export const cellSelectionStateInitializer = (state, props) => _extends({}, state, {
|
|
9
9
|
cellSelection: _extends({}, props.cellSelectionModel ?? props.initialState?.cellSelection)
|
|
@@ -16,13 +16,10 @@ const AUTO_SCROLL_SPEED = 20; // The speed to scroll once the mouse enters the s
|
|
|
16
16
|
|
|
17
17
|
export const useGridCellSelection = (apiRef, props) => {
|
|
18
18
|
const hasRootReference = apiRef.current.rootElementRef.current !== null;
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const lastMouseDownCell = React.useRef();
|
|
19
|
+
const cellWithVirtualFocus = React.useRef(null);
|
|
20
|
+
const lastMouseDownCell = React.useRef(null);
|
|
22
21
|
const mousePosition = React.useRef(null);
|
|
23
|
-
const autoScrollRAF = React.useRef();
|
|
24
|
-
const sortedRowIds = useGridSelector(apiRef, gridSortedRowIdsSelector);
|
|
25
|
-
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
22
|
+
const autoScrollRAF = React.useRef(null);
|
|
26
23
|
const totalHeaderHeight = getTotalHeaderHeight(apiRef, props);
|
|
27
24
|
const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
|
|
28
25
|
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.clipboardExport : ignoreValueFormatterProp) || false;
|
|
@@ -76,6 +73,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
76
73
|
finalEndColumnIndex = startColumnIndex;
|
|
77
74
|
}
|
|
78
75
|
const visibleColumns = apiRef.current.getVisibleColumns();
|
|
76
|
+
const visibleRows = getVisibleRows(apiRef);
|
|
79
77
|
const rowsInRange = visibleRows.rows.slice(finalStartRowIndex, finalEndRowIndex + 1);
|
|
80
78
|
const columnsInRange = visibleColumns.slice(finalStartColumnIndex, finalEndColumnIndex + 1);
|
|
81
79
|
const newModel = keepOtherSelected ? _extends({}, apiRef.current.getCellSelectionModel()) : {};
|
|
@@ -88,10 +86,9 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
88
86
|
}, {});
|
|
89
87
|
});
|
|
90
88
|
apiRef.current.setCellSelectionModel(newModel);
|
|
91
|
-
}, [apiRef
|
|
89
|
+
}, [apiRef]);
|
|
92
90
|
const getSelectedCellsAsArray = React.useCallback(() => {
|
|
93
91
|
const selectionModel = apiRef.current.getCellSelectionModel();
|
|
94
|
-
const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
|
|
95
92
|
const currentVisibleRows = getVisibleRows(apiRef, props);
|
|
96
93
|
const sortedEntries = currentVisibleRows.rows.reduce((result, row) => {
|
|
97
94
|
if (row.id in selectionModel) {
|
|
@@ -103,7 +100,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
103
100
|
selectedCells.push(...Object.entries(fields).reduce((selectedFields, [field, isSelected]) => {
|
|
104
101
|
if (isSelected) {
|
|
105
102
|
selectedFields.push({
|
|
106
|
-
id
|
|
103
|
+
id,
|
|
107
104
|
field
|
|
108
105
|
});
|
|
109
106
|
}
|
|
@@ -187,6 +184,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
187
184
|
if (!mousePosition.current || !apiRef.current.virtualScrollerRef?.current) {
|
|
188
185
|
return;
|
|
189
186
|
}
|
|
187
|
+
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
190
188
|
const {
|
|
191
189
|
x: mouseX,
|
|
192
190
|
y: mouseY
|
|
@@ -229,7 +227,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
229
227
|
autoScrollRAF.current = requestAnimationFrame(autoScroll);
|
|
230
228
|
}
|
|
231
229
|
autoScroll();
|
|
232
|
-
}, [apiRef,
|
|
230
|
+
}, [apiRef, totalHeaderHeight]);
|
|
233
231
|
const handleCellMouseOver = React.useCallback((params, event) => {
|
|
234
232
|
if (!lastMouseDownCell.current) {
|
|
235
233
|
return;
|
|
@@ -246,6 +244,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
246
244
|
if (!virtualScrollerRect) {
|
|
247
245
|
return;
|
|
248
246
|
}
|
|
247
|
+
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
249
248
|
const {
|
|
250
249
|
x,
|
|
251
250
|
y
|
|
@@ -271,7 +270,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
271
270
|
// Mouse has left the sensitivity area while auto scroll is on
|
|
272
271
|
stopAutoScroll();
|
|
273
272
|
}
|
|
274
|
-
}, [apiRef, startAutoScroll, stopAutoScroll, totalHeaderHeight
|
|
273
|
+
}, [apiRef, startAutoScroll, stopAutoScroll, totalHeaderHeight]);
|
|
275
274
|
const handleCellClick = useEventCallback((params, event) => {
|
|
276
275
|
const {
|
|
277
276
|
id,
|
|
@@ -331,6 +330,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
331
330
|
} else if (event.key === 'ArrowLeft') {
|
|
332
331
|
endColumnIndex -= 1;
|
|
333
332
|
}
|
|
333
|
+
const visibleRows = getVisibleRows(apiRef);
|
|
334
334
|
if (endRowIndex < 0 || endRowIndex >= visibleRows.rows.length) {
|
|
335
335
|
return;
|
|
336
336
|
}
|
|
@@ -383,6 +383,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
383
383
|
id,
|
|
384
384
|
field
|
|
385
385
|
}) => {
|
|
386
|
+
const visibleRows = getVisibleRows(apiRef);
|
|
386
387
|
if (!visibleRows.range || !apiRef.current.isCellSelected(id, field)) {
|
|
387
388
|
return classes;
|
|
388
389
|
}
|
|
@@ -431,7 +432,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
431
432
|
newClasses.push(gridClasses['cell--rangeRight']);
|
|
432
433
|
}
|
|
433
434
|
return newClasses;
|
|
434
|
-
}, [apiRef
|
|
435
|
+
}, [apiRef]);
|
|
435
436
|
const canUpdateFocus = React.useCallback((initialValue, {
|
|
436
437
|
event,
|
|
437
438
|
cell
|
|
@@ -452,6 +453,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
452
453
|
if (apiRef.current.getSelectedCellsAsArray().length <= 1) {
|
|
453
454
|
return value;
|
|
454
455
|
}
|
|
456
|
+
const sortedRowIds = gridSortedRowIdsSelector(apiRef.current.state);
|
|
455
457
|
const cellSelectionModel = apiRef.current.getCellSelectionModel();
|
|
456
458
|
const unsortedSelectedRowIds = Object.keys(cellSelectionModel);
|
|
457
459
|
const sortedSelectedRowIds = sortedRowIds.filter(id => unsortedSelectedRowIds.includes(`${id}`));
|
|
@@ -477,7 +479,7 @@ export const useGridCellSelection = (apiRef, props) => {
|
|
|
477
479
|
return acc === '' ? rowString : [acc, rowString].join('\r\n');
|
|
478
480
|
}, '');
|
|
479
481
|
return copyData;
|
|
480
|
-
}, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter
|
|
482
|
+
}, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
|
|
481
483
|
useGridRegisterPipeProcessor(apiRef, 'isCellSelected', checkIfCellIsSelected);
|
|
482
484
|
useGridRegisterPipeProcessor(apiRef, 'cellClassName', addClassesToCells);
|
|
483
485
|
useGridRegisterPipeProcessor(apiRef, 'canUpdateFocus', canUpdateFocus);
|
|
@@ -121,7 +121,7 @@ class CellValueUpdater {
|
|
|
121
121
|
if (onProcessRowUpdateError) {
|
|
122
122
|
onProcessRowUpdateError(errorThrown);
|
|
123
123
|
} else if (process.env.NODE_ENV !== 'production') {
|
|
124
|
-
warnOnce(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing
|
|
124
|
+
warnOnce(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/persistence/.'], 'error');
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
try {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useGridApiEventHandler as addEventHandler, useGridApiMethod, GRID_ROOT_GROUP_ID } from '@mui/x-data-grid-pro';
|
|
4
|
+
import { useGridDataSourceBase, useGridRegisterStrategyProcessor, useGridRegisterPipeProcessor } from '@mui/x-data-grid-pro/internals';
|
|
5
|
+
import { getKeyPremium } from "./cache.js";
|
|
6
|
+
const options = {
|
|
7
|
+
cacheOptions: {
|
|
8
|
+
getKey: getKeyPremium
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export const useGridDataSourcePremium = (apiRef, props) => {
|
|
12
|
+
const {
|
|
13
|
+
api,
|
|
14
|
+
strategyProcessor,
|
|
15
|
+
events
|
|
16
|
+
} = useGridDataSourceBase(apiRef, props, options);
|
|
17
|
+
const aggregateRowRef = React.useRef({});
|
|
18
|
+
const processDataSourceRows = React.useCallback(({
|
|
19
|
+
params,
|
|
20
|
+
response
|
|
21
|
+
}, applyRowHydration) => {
|
|
22
|
+
if (response.aggregateRow) {
|
|
23
|
+
aggregateRowRef.current = response.aggregateRow;
|
|
24
|
+
}
|
|
25
|
+
if (Object.keys(params.aggregationModel || {}).length > 0) {
|
|
26
|
+
if (applyRowHydration) {
|
|
27
|
+
apiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
28
|
+
}
|
|
29
|
+
apiRef.current.applyAggregation();
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
params,
|
|
33
|
+
response
|
|
34
|
+
};
|
|
35
|
+
}, [apiRef]);
|
|
36
|
+
const resolveGroupAggregation = React.useCallback((groupId, field) => {
|
|
37
|
+
if (groupId === GRID_ROOT_GROUP_ID) {
|
|
38
|
+
return props.unstable_dataSource?.getAggregatedValue?.(aggregateRowRef.current, field);
|
|
39
|
+
}
|
|
40
|
+
const row = apiRef.current.getRow(groupId);
|
|
41
|
+
return props.unstable_dataSource?.getAggregatedValue?.(row, field);
|
|
42
|
+
}, [apiRef, props.unstable_dataSource]);
|
|
43
|
+
const privateApi = _extends({}, api.private, {
|
|
44
|
+
resolveGroupAggregation
|
|
45
|
+
});
|
|
46
|
+
useGridApiMethod(apiRef, api.public, 'public');
|
|
47
|
+
useGridApiMethod(apiRef, privateApi, 'private');
|
|
48
|
+
useGridRegisterStrategyProcessor(apiRef, strategyProcessor.strategyName, strategyProcessor.group, strategyProcessor.processor);
|
|
49
|
+
useGridRegisterPipeProcessor(apiRef, 'processDataSourceRows', processDataSourceRows);
|
|
50
|
+
Object.entries(events).forEach(([event, handler]) => {
|
|
51
|
+
addEventHandler(apiRef, event, handler);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
@@ -32,7 +32,9 @@ const GROUPING_COL_DEF_FORCED_PROPERTIES_DATA_SOURCE = _extends({}, GROUPING_COL
|
|
|
32
32
|
* TODO: Make this index comparator depth invariant, the logic should not be inverted when sorting in the "desc" direction (but the current return format of `sortComparator` does not support this behavior).
|
|
33
33
|
*/
|
|
34
34
|
const groupingFieldIndexComparator = (v1, v2, cellParams1, cellParams2) => {
|
|
35
|
-
const model = gridRowGroupingSanitizedModelSelector(
|
|
35
|
+
const model = gridRowGroupingSanitizedModelSelector({
|
|
36
|
+
current: cellParams1.api
|
|
37
|
+
});
|
|
36
38
|
const groupingField1 = cellParams1.rowNode.groupingField ?? null;
|
|
37
39
|
const groupingField2 = cellParams2.rowNode.groupingField ?? null;
|
|
38
40
|
if (groupingField1 === groupingField2) {
|
|
@@ -63,10 +65,12 @@ const getLeafProperties = leafColDef => ({
|
|
|
63
65
|
return groupingFieldIndexComparator(v1, v2, cellParams1, cellParams2);
|
|
64
66
|
}
|
|
65
67
|
});
|
|
68
|
+
const groupedByColValueFormatter = groupedByColDef => (value, row, _, apiRef) => groupedByColDef.valueFormatter(value, row, groupedByColDef, apiRef);
|
|
66
69
|
const getGroupingCriteriaProperties = (groupedByColDef, applyHeaderName) => {
|
|
67
70
|
const properties = {
|
|
68
71
|
sortable: groupedByColDef.sortable,
|
|
69
72
|
filterable: groupedByColDef.filterable,
|
|
73
|
+
valueFormatter: groupedByColDef.valueFormatter ? groupedByColValueFormatter(groupedByColDef) : undefined,
|
|
70
74
|
valueOptions: isSingleSelectColDef(groupedByColDef) ? groupedByColDef.valueOptions : undefined,
|
|
71
75
|
sortComparator: (v1, v2, cellParams1, cellParams2) => {
|
|
72
76
|
// We only want to sort the groups of the current grouping criteria
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { passFilterLogic, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, getRowGroupingCriteriaFromGroupingField, isGroupingColumn } from '@mui/x-data-grid-pro/internals';
|
|
2
|
+
import { passFilterLogic, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, getRowGroupingCriteriaFromGroupingField, isGroupingColumn, GridStrategyGroup } from '@mui/x-data-grid-pro/internals';
|
|
3
3
|
import { gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
|
|
4
4
|
export { GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, getRowGroupingCriteriaFromGroupingField, isGroupingColumn };
|
|
5
5
|
export let RowGroupingStrategy = /*#__PURE__*/function (RowGroupingStrategy) {
|
|
@@ -75,7 +75,9 @@ export const filterRowTreeFromGroupingColumns = params => {
|
|
|
75
75
|
isPassingFiltering = passFilterLogic(allResults.map(result => result.passingFilterItems), allResults.map(result => result.passingQuickFilterValues), filterModel, params.apiRef, filterCache);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
if (!isPassingFiltering) {
|
|
79
|
+
filteredRowsLookup[node.id] = false;
|
|
80
|
+
}
|
|
79
81
|
if (!isPassingFiltering) {
|
|
80
82
|
return 0;
|
|
81
83
|
}
|
|
@@ -124,7 +126,7 @@ export const setStrategyAvailability = (privateApiRef, disableRowGrouping, dataS
|
|
|
124
126
|
};
|
|
125
127
|
}
|
|
126
128
|
const strategy = dataSource ? RowGroupingStrategy.DataSource : RowGroupingStrategy.Default;
|
|
127
|
-
privateApiRef.current.setStrategyAvailability(
|
|
129
|
+
privateApiRef.current.setStrategyAvailability(GridStrategyGroup.RowTree, strategy, isAvailable);
|
|
128
130
|
};
|
|
129
131
|
export const getCellGroupingCriteria = ({
|
|
130
132
|
row,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridApiEventHandler, useGridApiMethod, gridColumnLookupSelector } from '@mui/x-data-grid-pro';
|
|
4
|
-
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid-pro/internals';
|
|
4
|
+
import { useGridRegisterPipeProcessor, GridStrategyGroup } from '@mui/x-data-grid-pro/internals';
|
|
5
5
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
|
|
6
6
|
import { getRowGroupingFieldFromGroupingCriteria, RowGroupingStrategy, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability, getGroupingRules, areGroupingRulesEqual } from "./gridRowGroupingUtils.js";
|
|
7
7
|
export const rowGroupingStateInitializer = (state, props, apiRef) => {
|
|
@@ -162,7 +162,7 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
162
162
|
|
|
163
163
|
// Refresh the row tree creation strategy processing
|
|
164
164
|
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|
|
165
|
-
if (apiRef.current.getActiveStrategy(
|
|
165
|
+
if (apiRef.current.getActiveStrategy(GridStrategyGroup.RowTree) === RowGroupingStrategy.Default) {
|
|
166
166
|
apiRef.current.publishEvent('activeStrategyProcessorChange', 'rowTreeCreation');
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -48,10 +48,13 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
48
48
|
const groupingColDefs = getGroupingColDefs(columnsState);
|
|
49
49
|
let newColumnFields = [];
|
|
50
50
|
const newColumnsLookup = {};
|
|
51
|
+
const prevGroupingfields = [];
|
|
51
52
|
|
|
52
53
|
// We only keep the non-grouping columns
|
|
53
54
|
columnsState.orderedFields.forEach(field => {
|
|
54
|
-
if (
|
|
55
|
+
if (isGroupingColumn(field)) {
|
|
56
|
+
prevGroupingfields.push(field);
|
|
57
|
+
} else {
|
|
55
58
|
newColumnFields.push(field);
|
|
56
59
|
newColumnsLookup[field] = columnsState.lookup[field];
|
|
57
60
|
}
|
|
@@ -66,9 +69,11 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
66
69
|
}
|
|
67
70
|
newColumnsLookup[groupingColDef.field] = groupingColDef;
|
|
68
71
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
if (prevGroupingfields.length !== groupingColDefs.length) {
|
|
73
|
+
const startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
|
|
74
|
+
newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
|
|
75
|
+
columnsState.orderedFields = newColumnFields;
|
|
76
|
+
}
|
|
72
77
|
columnsState.lookup = newColumnsLookup;
|
|
73
78
|
return columnsState;
|
|
74
79
|
}, [getGroupingColDefs]);
|
|
@@ -2,13 +2,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { useGridAriaAttributes as useGridAriaAttributesPro, useGridSelector } from '@mui/x-data-grid-pro/internals';
|
|
3
3
|
import { gridRowGroupingSanitizedModelSelector } from "../features/rowGrouping/gridRowGroupingSelector.js";
|
|
4
4
|
import { useGridPrivateApiContext } from "./useGridPrivateApiContext.js";
|
|
5
|
-
import { useGridRootProps } from "./useGridRootProps.js";
|
|
6
5
|
export const useGridAriaAttributes = () => {
|
|
7
|
-
const rootProps = useGridRootProps();
|
|
8
6
|
const ariaAttributesPro = useGridAriaAttributesPro();
|
|
9
7
|
const apiRef = useGridPrivateApiContext();
|
|
10
8
|
const gridRowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector);
|
|
11
|
-
const ariaAttributesPremium =
|
|
9
|
+
const ariaAttributesPremium = gridRowGroupingModel.length > 0 ? {
|
|
12
10
|
role: 'treegrid'
|
|
13
11
|
} : {};
|
|
14
12
|
return _extends({}, ariaAttributesPro, ariaAttributesPremium);
|
|
@@ -25,9 +25,9 @@ export const useKeepGroupedColumnsHidden = props => {
|
|
|
25
25
|
const initialProps = React.useRef(props);
|
|
26
26
|
const rowGroupingModel = React.useRef(props.rowGroupingModel ?? props.initialState?.rowGrouping?.model);
|
|
27
27
|
React.useEffect(() => {
|
|
28
|
-
props.apiRef.current
|
|
28
|
+
props.apiRef.current?.subscribeEvent('rowGroupingModelChange', newModel => {
|
|
29
29
|
const columnVisibilityModel = updateColumnVisibilityModel(gridColumnVisibilityModelSelector(props.apiRef), newModel, rowGroupingModel.current);
|
|
30
|
-
props.apiRef.current
|
|
30
|
+
props.apiRef.current?.setColumnVisibilityModel(columnVisibilityModel);
|
|
31
31
|
rowGroupingModel.current = newModel;
|
|
32
32
|
});
|
|
33
33
|
}, [props.apiRef]);
|
package/esm/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 = "MTczODg4MjgwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
+
import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
|
|
3
3
|
import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
4
|
-
import { GridAggregationFunction, GridAggregationLookup } from './gridAggregationInterfaces';
|
|
5
|
-
export declare const createAggregationLookup: ({ apiRef, aggregationFunctions, aggregationRowsScope, getAggregationPosition, }: {
|
|
6
|
-
apiRef:
|
|
7
|
-
aggregationFunctions: Record<string, GridAggregationFunction>;
|
|
4
|
+
import { GridAggregationFunction, GridAggregationFunctionDataSource, GridAggregationLookup } from './gridAggregationInterfaces';
|
|
5
|
+
export declare const createAggregationLookup: ({ apiRef, aggregationFunctions, aggregationRowsScope, getAggregationPosition, isDataSource, }: {
|
|
6
|
+
apiRef: RefObject<GridPrivateApiPremium>;
|
|
7
|
+
aggregationFunctions: Record<string, GridAggregationFunction> | Record<string, GridAggregationFunctionDataSource>;
|
|
8
8
|
aggregationRowsScope: DataGridPremiumProcessedProps["aggregationRowsScope"];
|
|
9
9
|
getAggregationPosition: DataGridPremiumProcessedProps["getAggregationPosition"];
|
|
10
|
+
isDataSource: boolean;
|
|
10
11
|
}) => GridAggregationLookup;
|
|
@@ -7,18 +7,13 @@ exports.createAggregationLookup = void 0;
|
|
|
7
7
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
8
8
|
var _gridAggregationUtils = require("./gridAggregationUtils");
|
|
9
9
|
var _gridAggregationSelectors = require("./gridAggregationSelectors");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
field,
|
|
14
|
-
aggregationFunction,
|
|
15
|
-
aggregationRowsScope
|
|
16
|
-
}) => {
|
|
17
|
-
const filteredRowsLookup = (0, _xDataGridPro.gridFilteredRowsLookupSelector)(apiRef);
|
|
10
|
+
const getGroupAggregatedValue = (groupId, apiRef, aggregationRowsScope, aggregatedFields, aggregationRules, position) => {
|
|
11
|
+
const groupAggregationLookup = {};
|
|
12
|
+
const aggregatedValues = [];
|
|
18
13
|
const rowIds = apiRef.current.getRowGroupChildren({
|
|
19
14
|
groupId
|
|
20
15
|
});
|
|
21
|
-
const
|
|
16
|
+
const filteredRowsLookup = (0, _xDataGridPro.gridFilteredRowsLookupSelector)(apiRef);
|
|
22
17
|
rowIds.forEach(rowId => {
|
|
23
18
|
if (aggregationRowsScope === 'filtered' && filteredRowsLookup[rowId] === false) {
|
|
24
19
|
return;
|
|
@@ -35,42 +30,53 @@ const getAggregationCellValue = ({
|
|
|
35
30
|
if (rowNode.type === 'group') {
|
|
36
31
|
return;
|
|
37
32
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const row = apiRef.current.getRow(rowId);
|
|
34
|
+
for (let j = 0; j < aggregatedFields.length; j += 1) {
|
|
35
|
+
const aggregatedField = aggregatedFields[j];
|
|
36
|
+
const columnAggregationRules = aggregationRules[aggregatedField];
|
|
37
|
+
const aggregationFunction = columnAggregationRules.aggregationFunction;
|
|
38
|
+
const field = aggregatedField;
|
|
39
|
+
if (aggregatedValues[j] === undefined) {
|
|
40
|
+
aggregatedValues[j] = {
|
|
41
|
+
aggregatedField,
|
|
42
|
+
values: []
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (typeof aggregationFunction.getCellValue === 'function') {
|
|
46
|
+
aggregatedValues[j].values.push(aggregationFunction.getCellValue({
|
|
47
|
+
row
|
|
48
|
+
}));
|
|
49
|
+
} else {
|
|
50
|
+
const colDef = apiRef.current.getColumn(field);
|
|
51
|
+
aggregatedValues[j].values.push(apiRef.current.getRowValue(row, colDef));
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
for (let i = 0; i < aggregatedValues.length; i += 1) {
|
|
56
|
+
const {
|
|
57
|
+
aggregatedField,
|
|
58
|
+
values
|
|
59
|
+
} = aggregatedValues[i];
|
|
60
|
+
const aggregationFunction = aggregationRules[aggregatedField].aggregationFunction;
|
|
61
|
+
const value = aggregationFunction.apply({
|
|
62
|
+
values,
|
|
63
|
+
groupId,
|
|
64
|
+
field: aggregatedField // Added per user request in https://github.com/mui/mui-x/issues/6995#issuecomment-1327423455
|
|
65
|
+
});
|
|
66
|
+
groupAggregationLookup[aggregatedField] = {
|
|
67
|
+
position,
|
|
68
|
+
value
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return groupAggregationLookup;
|
|
52
72
|
};
|
|
53
|
-
const
|
|
54
|
-
groupId,
|
|
55
|
-
apiRef,
|
|
56
|
-
aggregationRowsScope,
|
|
57
|
-
aggregatedFields,
|
|
58
|
-
aggregationRules,
|
|
59
|
-
position
|
|
60
|
-
}) => {
|
|
73
|
+
const getGroupAggregatedValueDataSource = (groupId, apiRef, aggregatedFields, position) => {
|
|
61
74
|
const groupAggregationLookup = {};
|
|
62
75
|
for (let j = 0; j < aggregatedFields.length; j += 1) {
|
|
63
76
|
const aggregatedField = aggregatedFields[j];
|
|
64
|
-
const columnAggregationRules = aggregationRules[aggregatedField];
|
|
65
77
|
groupAggregationLookup[aggregatedField] = {
|
|
66
78
|
position,
|
|
67
|
-
value:
|
|
68
|
-
apiRef,
|
|
69
|
-
groupId,
|
|
70
|
-
field: aggregatedField,
|
|
71
|
-
aggregationFunction: columnAggregationRules.aggregationFunction,
|
|
72
|
-
aggregationRowsScope
|
|
73
|
-
})
|
|
79
|
+
value: apiRef.current.resolveGroupAggregation(groupId, aggregatedField)
|
|
74
80
|
};
|
|
75
81
|
}
|
|
76
82
|
return groupAggregationLookup;
|
|
@@ -79,13 +85,10 @@ const createAggregationLookup = ({
|
|
|
79
85
|
apiRef,
|
|
80
86
|
aggregationFunctions,
|
|
81
87
|
aggregationRowsScope,
|
|
82
|
-
getAggregationPosition
|
|
88
|
+
getAggregationPosition,
|
|
89
|
+
isDataSource
|
|
83
90
|
}) => {
|
|
84
|
-
const aggregationRules = (0, _gridAggregationUtils.getAggregationRules)(
|
|
85
|
-
columnsLookup: (0, _xDataGridPro.gridColumnLookupSelector)(apiRef),
|
|
86
|
-
aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef),
|
|
87
|
-
aggregationFunctions
|
|
88
|
-
});
|
|
91
|
+
const aggregationRules = (0, _gridAggregationUtils.getAggregationRules)((0, _xDataGridPro.gridColumnLookupSelector)(apiRef), (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef), aggregationFunctions, isDataSource);
|
|
89
92
|
const aggregatedFields = Object.keys(aggregationRules);
|
|
90
93
|
if (aggregatedFields.length === 0) {
|
|
91
94
|
return {};
|
|
@@ -100,18 +103,12 @@ const createAggregationLookup = ({
|
|
|
100
103
|
createGroupAggregationLookup(childNode);
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
apiRef,
|
|
110
|
-
aggregatedFields,
|
|
111
|
-
aggregationRowsScope,
|
|
112
|
-
aggregationRules,
|
|
113
|
-
position
|
|
114
|
-
});
|
|
106
|
+
const position = getAggregationPosition(groupNode);
|
|
107
|
+
if (position !== null) {
|
|
108
|
+
if (isDataSource) {
|
|
109
|
+
aggregationLookup[groupNode.id] = getGroupAggregatedValueDataSource(groupNode.id, apiRef, aggregatedFields, position);
|
|
110
|
+
} else if (groupNode.children.length) {
|
|
111
|
+
aggregationLookup[groupNode.id] = getGroupAggregatedValue(groupNode.id, apiRef, aggregationRowsScope, aggregatedFields, aggregationRules, position);
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
114
|
};
|
|
@@ -17,6 +17,12 @@ export interface GridAggregationApi {
|
|
|
17
17
|
*/
|
|
18
18
|
setAggregationModel: (model: GridAggregationModel) => void;
|
|
19
19
|
}
|
|
20
|
+
export interface GridAggregationPrivateApi {
|
|
21
|
+
/**
|
|
22
|
+
* Applies the aggregation to the rows.
|
|
23
|
+
*/
|
|
24
|
+
applyAggregation: () => void;
|
|
25
|
+
}
|
|
20
26
|
export interface GridAggregationGetCellValueParams {
|
|
21
27
|
/**
|
|
22
28
|
* The row model of the row that the current cell belongs to.
|
|
@@ -38,7 +44,7 @@ export interface GridAggregationFunction<V = any, AV = V> {
|
|
|
38
44
|
apply: (params: GridAggregationParams<V>) => AV | null | undefined;
|
|
39
45
|
/**
|
|
40
46
|
* Label of the aggregation function.
|
|
41
|
-
*
|
|
47
|
+
* Used for adding a label to the footer of the grouping column when this aggregation function is the only one being used.
|
|
42
48
|
* @default apiRef.current.getLocaleText('aggregationFunctionLabel{capitalize(name)})
|
|
43
49
|
*/
|
|
44
50
|
label?: string;
|
|
@@ -48,12 +54,12 @@ export interface GridAggregationFunction<V = any, AV = V> {
|
|
|
48
54
|
*/
|
|
49
55
|
columnTypes?: string[];
|
|
50
56
|
/**
|
|
51
|
-
* Function
|
|
52
|
-
* If not defined, the grid
|
|
57
|
+
* Function for applying a formatter to the aggregated value.
|
|
58
|
+
* If not defined, the grid uses the formatter of the column.
|
|
53
59
|
*/
|
|
54
60
|
valueFormatter?: GridValueFormatter;
|
|
55
61
|
/**
|
|
56
|
-
* Indicates if the aggregated value
|
|
62
|
+
* Indicates if the aggregated value has the same unit as the cells used to generate it.
|
|
57
63
|
* It can be used to apply a custom cell renderer only if the aggregated value has the same unit.
|
|
58
64
|
* @default true
|
|
59
65
|
*/
|
|
@@ -67,6 +73,13 @@ export interface GridAggregationFunction<V = any, AV = V> {
|
|
|
67
73
|
*/
|
|
68
74
|
getCellValue?: (params: GridAggregationGetCellValueParams) => V;
|
|
69
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Grid aggregation function data source definition interface.
|
|
78
|
+
* @demos
|
|
79
|
+
* - [Server-side aggregation](/x/react-data-grid/server-side-data/aggregation/)
|
|
80
|
+
*/
|
|
81
|
+
export interface GridAggregationFunctionDataSource extends Omit<GridAggregationFunction, 'apply' | 'getCellValue'> {
|
|
82
|
+
}
|
|
70
83
|
export interface GridAggregationParams<V = any> {
|
|
71
84
|
values: (V | undefined)[];
|
|
72
85
|
groupId: GridRowId;
|
|
@@ -102,7 +115,7 @@ export interface GridAggregationHeaderMeta {
|
|
|
102
115
|
}
|
|
103
116
|
export interface GridAggregationRule {
|
|
104
117
|
aggregationFunctionName: string;
|
|
105
|
-
aggregationFunction: GridAggregationFunction;
|
|
118
|
+
aggregationFunction: GridAggregationFunction | GridAggregationFunctionDataSource;
|
|
106
119
|
}
|
|
107
120
|
/**
|
|
108
121
|
* Object containing all the aggregation rules that must be applied to the current columns.
|
|
@@ -5,9 +5,9 @@ export declare const gridAggregationStateSelector: (state: GridStatePremium) =>
|
|
|
5
5
|
* If a column is not in the model, it is not aggregated.
|
|
6
6
|
* @category Aggregation
|
|
7
7
|
*/
|
|
8
|
-
export declare const gridAggregationModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationModel>;
|
|
8
|
+
export declare const gridAggregationModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationState, import("./gridAggregationInterfaces").GridAggregationModel>;
|
|
9
9
|
/**
|
|
10
10
|
* Get the aggregation results as a lookup.
|
|
11
11
|
* @category Aggregation
|
|
12
12
|
*/
|
|
13
|
-
export declare const gridAggregationLookupSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationLookup>;
|
|
13
|
+
export declare const gridAggregationLookupSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationState, import("./gridAggregationInterfaces").GridAggregationLookup>;
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridColDef, GridRowId } from '@mui/x-data-grid-pro';
|
|
3
3
|
import { GridColumnRawLookup, GridHydrateRowsValue } from '@mui/x-data-grid-pro/internals';
|
|
4
|
-
import { GridAggregationFunction, GridAggregationModel, GridAggregationRule, GridAggregationRules } from './gridAggregationInterfaces';
|
|
4
|
+
import { GridAggregationFunction, GridAggregationFunctionDataSource, GridAggregationModel, GridAggregationRule, GridAggregationRules } from './gridAggregationInterfaces';
|
|
5
5
|
import { GridStatePremium } from '../../../models/gridStatePremium';
|
|
6
6
|
import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
7
7
|
import { GridApiPremium, GridPrivateApiPremium } from '../../../models/gridApiPremium';
|
|
8
8
|
export declare const GRID_AGGREGATION_ROOT_FOOTER_ROW_ID = "auto-generated-group-footer-root";
|
|
9
9
|
export declare const getAggregationFooterRowIdFromGroupId: (groupId: GridRowId | null) => string;
|
|
10
|
-
|
|
10
|
+
type AggregationFunction = GridAggregationFunction | GridAggregationFunctionDataSource | undefined;
|
|
11
|
+
export declare const canColumnHaveAggregationFunction: ({ colDef, aggregationFunctionName, aggregationFunction, isDataSource, }: {
|
|
11
12
|
colDef: GridColDef | undefined;
|
|
12
13
|
aggregationFunctionName: string;
|
|
13
|
-
aggregationFunction:
|
|
14
|
+
aggregationFunction: AggregationFunction;
|
|
15
|
+
isDataSource: boolean;
|
|
14
16
|
}) => boolean;
|
|
15
|
-
export declare const getAvailableAggregationFunctions: ({ aggregationFunctions, colDef, }: {
|
|
16
|
-
aggregationFunctions: Record<string, GridAggregationFunction>;
|
|
17
|
+
export declare const getAvailableAggregationFunctions: ({ aggregationFunctions, colDef, isDataSource, }: {
|
|
18
|
+
aggregationFunctions: Record<string, GridAggregationFunction> | Record<string, GridAggregationFunctionDataSource>;
|
|
17
19
|
colDef: GridColDef;
|
|
20
|
+
isDataSource: boolean;
|
|
18
21
|
}) => string[];
|
|
19
22
|
export declare const mergeStateWithAggregationModel: (aggregationModel: GridAggregationModel) => (state: GridStatePremium) => GridStatePremium;
|
|
20
|
-
export declare const getAggregationRules: (
|
|
21
|
-
columnsLookup: GridColumnRawLookup;
|
|
22
|
-
aggregationModel: GridAggregationModel;
|
|
23
|
-
aggregationFunctions: Record<string, GridAggregationFunction>;
|
|
24
|
-
}) => GridAggregationRules;
|
|
23
|
+
export declare const getAggregationRules: (columnsLookup: GridColumnRawLookup, aggregationModel: GridAggregationModel, aggregationFunctions: Record<string, GridAggregationFunction> | Record<string, GridAggregationFunctionDataSource>, isDataSource: boolean) => GridAggregationRules;
|
|
25
24
|
interface AddFooterRowsParams {
|
|
26
25
|
groupingParams: GridHydrateRowsValue;
|
|
27
26
|
getAggregationPosition: DataGridPremiumProcessedProps['getAggregationPosition'];
|
|
@@ -29,7 +28,7 @@ interface AddFooterRowsParams {
|
|
|
29
28
|
* If `true`, there are some aggregation rules to apply
|
|
30
29
|
*/
|
|
31
30
|
hasAggregationRule: boolean;
|
|
32
|
-
apiRef:
|
|
31
|
+
apiRef: RefObject<GridPrivateApiPremium>;
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
35
34
|
* Add a footer for each group that has at least one column with an aggregated value.
|
|
@@ -40,7 +39,7 @@ export declare const addFooterRows: ({ groupingParams, apiRef, getAggregationPos
|
|
|
40
39
|
*/
|
|
41
40
|
export declare const areAggregationRulesEqual: (previousValue: GridAggregationRules | undefined, newValue: GridAggregationRules) => boolean;
|
|
42
41
|
export declare const getAggregationFunctionLabel: ({ apiRef, aggregationRule, }: {
|
|
43
|
-
apiRef:
|
|
42
|
+
apiRef: RefObject<GridApiPremium>;
|
|
44
43
|
aggregationRule: GridAggregationRule;
|
|
45
44
|
}) => string;
|
|
46
45
|
export {};
|