@mui/x-data-grid-premium 8.0.0-alpha.0 → 8.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/CHANGELOG.md +2215 -119
  2. package/DataGridPremium/DataGridPremium.js +40 -40
  3. package/DataGridPremium/useDataGridPremiumComponent.d.ts +2 -2
  4. package/DataGridPremium/useDataGridPremiumComponent.js +4 -2
  5. package/DataGridPremium/useDataGridPremiumProps.js +5 -3
  6. package/README.md +3 -3
  7. package/components/GridAggregationHeader.js +6 -1
  8. package/components/GridColumnMenuAggregationItem.js +77 -49
  9. package/components/GridColumnMenuRowGroupItem.js +5 -11
  10. package/components/GridColumnMenuRowUngroupItem.js +10 -19
  11. package/components/GridDataSourceGroupingCriteriaCell.js +1 -2
  12. package/components/GridPremiumColumnMenu.d.ts +1 -1
  13. package/components/GridPremiumColumnMenu.js +5 -5
  14. package/components/index.d.ts +1 -0
  15. package/components/index.js +12 -0
  16. package/components/promptControl/GridToolbarPromptControl.d.ts +26 -0
  17. package/components/promptControl/GridToolbarPromptControl.js +220 -0
  18. package/components/promptControl/RecordButton.d.ts +16 -0
  19. package/components/promptControl/RecordButton.js +119 -0
  20. package/components/promptControl/index.d.ts +1 -0
  21. package/components/promptControl/index.js +12 -0
  22. package/esm/DataGridPremium/DataGridPremium.js +42 -42
  23. package/esm/DataGridPremium/useDataGridPremiumComponent.js +5 -3
  24. package/esm/DataGridPremium/useDataGridPremiumProps.js +6 -4
  25. package/esm/components/GridAggregationHeader.js +6 -1
  26. package/esm/components/GridColumnMenuAggregationItem.js +75 -47
  27. package/esm/components/GridColumnMenuRowGroupItem.js +6 -11
  28. package/esm/components/GridColumnMenuRowUngroupItem.js +11 -19
  29. package/esm/components/GridDataSourceGroupingCriteriaCell.js +1 -2
  30. package/esm/components/GridPremiumColumnMenu.js +5 -5
  31. package/esm/components/index.js +1 -0
  32. package/esm/components/promptControl/GridToolbarPromptControl.js +213 -0
  33. package/esm/components/promptControl/RecordButton.js +111 -0
  34. package/esm/components/promptControl/index.js +1 -0
  35. package/esm/hooks/features/aggregation/createAggregationLookup.js +52 -55
  36. package/esm/hooks/features/aggregation/gridAggregationUtils.js +17 -13
  37. package/esm/hooks/features/aggregation/index.js +0 -1
  38. package/esm/hooks/features/aggregation/useGridAggregation.js +22 -10
  39. package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
  40. package/esm/hooks/features/cellSelection/useGridCellSelection.js +5 -6
  41. package/esm/hooks/features/clipboard/useGridClipboardImport.js +1 -1
  42. package/esm/hooks/features/dataSource/cache.js +3 -0
  43. package/esm/hooks/features/dataSource/models.js +1 -0
  44. package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
  45. package/esm/hooks/features/index.js +2 -1
  46. package/esm/hooks/features/promptControl/api.js +22 -0
  47. package/esm/hooks/features/promptControl/index.js +1 -0
  48. package/esm/hooks/features/promptControl/types.js +1 -0
  49. package/esm/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
  50. package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +2 -2
  51. package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +2 -2
  52. package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  53. package/esm/hooks/utils/useGridAriaAttributes.js +1 -3
  54. package/esm/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
  55. package/esm/material/icons.js +7 -1
  56. package/esm/material/index.js +4 -2
  57. package/esm/utils/releaseInfo.js +1 -1
  58. package/hooks/features/aggregation/createAggregationLookup.d.ts +7 -6
  59. package/hooks/features/aggregation/createAggregationLookup.js +52 -55
  60. package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +18 -5
  61. package/hooks/features/aggregation/gridAggregationSelectors.d.ts +2 -2
  62. package/hooks/features/aggregation/gridAggregationUtils.d.ts +12 -13
  63. package/hooks/features/aggregation/gridAggregationUtils.js +17 -13
  64. package/hooks/features/aggregation/index.d.ts +1 -1
  65. package/hooks/features/aggregation/index.js +0 -12
  66. package/hooks/features/aggregation/useGridAggregation.d.ts +2 -2
  67. package/hooks/features/aggregation/useGridAggregation.js +22 -10
  68. package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +2 -2
  69. package/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
  70. package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +4 -2
  71. package/hooks/features/cellSelection/gridCellSelectionInterfaces.d.ts +3 -3
  72. package/hooks/features/cellSelection/useGridCellSelection.d.ts +2 -2
  73. package/hooks/features/cellSelection/useGridCellSelection.js +4 -5
  74. package/hooks/features/clipboard/useGridClipboardImport.d.ts +2 -2
  75. package/hooks/features/clipboard/useGridClipboardImport.js +1 -1
  76. package/hooks/features/dataSource/cache.d.ts +2 -0
  77. package/hooks/features/dataSource/cache.js +9 -0
  78. package/hooks/features/dataSource/models.d.ts +47 -0
  79. package/hooks/features/dataSource/models.js +5 -0
  80. package/hooks/features/dataSource/useGridDataSourcePremium.d.ts +4 -0
  81. package/hooks/features/dataSource/useGridDataSourcePremium.js +62 -0
  82. package/hooks/features/export/serializer/excelSerializer.d.ts +3 -2
  83. package/hooks/features/export/useGridExcelExport.d.ts +2 -2
  84. package/hooks/features/index.d.ts +1 -0
  85. package/hooks/features/index.js +11 -0
  86. package/hooks/features/promptControl/api.d.ts +2 -0
  87. package/hooks/features/promptControl/api.js +28 -0
  88. package/hooks/features/promptControl/index.d.ts +2 -0
  89. package/hooks/features/promptControl/index.js +12 -0
  90. package/hooks/features/promptControl/types.d.ts +25 -0
  91. package/hooks/features/promptControl/types.js +5 -0
  92. package/hooks/features/rowGrouping/createGroupingColDef.d.ts +2 -2
  93. package/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
  94. package/hooks/features/rowGrouping/gridRowGroupingSelector.d.ts +2 -2
  95. package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +4 -4
  96. package/hooks/features/rowGrouping/gridRowGroupingUtils.js +1 -1
  97. package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +2 -2
  98. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +2 -2
  99. package/hooks/features/rowGrouping/useGridRowGrouping.js +1 -1
  100. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +2 -2
  101. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  102. package/hooks/utils/useGridApiContext.d.ts +1 -1
  103. package/hooks/utils/useGridApiRef.d.ts +3 -1
  104. package/hooks/utils/useGridAriaAttributes.js +1 -3
  105. package/hooks/utils/useGridPrivateApiContext.d.ts +1 -1
  106. package/hooks/utils/useKeepGroupedColumnsHidden.d.ts +2 -2
  107. package/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
  108. package/index.d.ts +2 -0
  109. package/index.js +1 -1
  110. package/material/icons.d.ts +6 -0
  111. package/material/icons.js +8 -2
  112. package/material/index.d.ts +2 -0
  113. package/material/index.js +3 -1
  114. package/models/dataGridPremiumProps.d.ts +8 -12
  115. package/models/gridApiPremium.d.ts +5 -3
  116. package/models/gridGroupingValueGetter.d.ts +2 -1
  117. package/models/gridPastedValueParser.d.ts +2 -1
  118. package/models/gridPremiumIconSlotsComponent.d.ts +10 -0
  119. package/modern/DataGridPremium/DataGridPremium.js +42 -42
  120. package/modern/DataGridPremium/useDataGridPremiumComponent.js +5 -3
  121. package/modern/DataGridPremium/useDataGridPremiumProps.js +6 -4
  122. package/modern/components/GridAggregationHeader.js +6 -1
  123. package/modern/components/GridColumnMenuAggregationItem.js +75 -47
  124. package/modern/components/GridColumnMenuRowGroupItem.js +6 -11
  125. package/modern/components/GridColumnMenuRowUngroupItem.js +11 -19
  126. package/modern/components/GridDataSourceGroupingCriteriaCell.js +1 -2
  127. package/modern/components/GridPremiumColumnMenu.js +5 -5
  128. package/modern/components/index.js +1 -0
  129. package/modern/components/promptControl/GridToolbarPromptControl.js +213 -0
  130. package/modern/components/promptControl/RecordButton.js +111 -0
  131. package/modern/components/promptControl/index.js +1 -0
  132. package/modern/hooks/features/aggregation/createAggregationLookup.js +52 -55
  133. package/modern/hooks/features/aggregation/gridAggregationUtils.js +17 -13
  134. package/modern/hooks/features/aggregation/index.js +0 -1
  135. package/modern/hooks/features/aggregation/useGridAggregation.js +22 -10
  136. package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
  137. package/modern/hooks/features/cellSelection/useGridCellSelection.js +5 -6
  138. package/modern/hooks/features/clipboard/useGridClipboardImport.js +1 -1
  139. package/modern/hooks/features/dataSource/cache.js +3 -0
  140. package/modern/hooks/features/dataSource/models.js +1 -0
  141. package/modern/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
  142. package/modern/hooks/features/index.js +2 -1
  143. package/modern/hooks/features/promptControl/api.js +22 -0
  144. package/modern/hooks/features/promptControl/index.js +1 -0
  145. package/modern/hooks/features/promptControl/types.js +1 -0
  146. package/modern/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
  147. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +2 -2
  148. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +2 -2
  149. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  150. package/modern/hooks/utils/useGridAriaAttributes.js +1 -3
  151. package/modern/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
  152. package/modern/index.js +1 -1
  153. package/modern/material/icons.js +7 -1
  154. package/modern/material/index.js +4 -2
  155. package/modern/utils/releaseInfo.js +1 -1
  156. package/package.json +8 -8
  157. package/utils/releaseInfo.js +1 -1
@@ -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('rowTree') === RowGroupingStrategy.Default) {
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 (!isGroupingColumn(field)) {
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
- const startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
70
- newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
71
- columnsState.orderedFields = newColumnFields;
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 = rootProps.experimentalFeatures?.ariaV8 && gridRowGroupingModel.length > 0 ? {
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.subscribeEvent('rowGroupingModelChange', newModel => {
28
+ props.apiRef.current?.subscribeEvent('rowGroupingModelChange', newModel => {
29
29
  const columnVisibilityModel = updateColumnVisibilityModel(gridColumnVisibilityModelSelector(props.apiRef), newModel, rowGroupingModel.current);
30
- props.apiRef.current.setColumnVisibilityModel(columnVisibilityModel);
30
+ props.apiRef.current?.setColumnVisibilityModel(columnVisibilityModel);
31
31
  rowGroupingModel.current = newModel;
32
32
  });
33
33
  }, [props.apiRef]);
@@ -11,4 +11,10 @@ export const GridGroupWorkIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
11
11
  }), 'GroupWork');
12
12
  export const GridFunctionsIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
13
13
  d: "M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z"
14
- }), 'Functions');
14
+ }), 'Functions');
15
+ export const GridSendPromptIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
16
+ d: "M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"
17
+ }), 'SendPrompt');
18
+ export const GridRecordPromptIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
19
+ d: "M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3m5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72z"
20
+ }), 'RecordPrompt');
@@ -1,9 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon } from "./icons.js";
2
+ import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon, GridSendPromptIcon, GridRecordPromptIcon } from "./icons.js";
3
3
  const iconsSlots = {
4
4
  columnMenuUngroupIcon: GridWorkspacesIcon,
5
5
  columnMenuGroupIcon: GridGroupWorkIcon,
6
- columnMenuAggregationIcon: GridFunctionsIcon
6
+ columnMenuAggregationIcon: GridFunctionsIcon,
7
+ toolbarPromptSendIcon: GridSendPromptIcon,
8
+ toolbarPromptRecordIcon: GridRecordPromptIcon
7
9
  };
8
10
  const materialSlots = _extends({}, iconsSlots);
9
11
  export default materialSlots;
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczMTUzODgwMDAwMA==";
3
+ const releaseInfo = "MTczODI5OTYwMDAwMA==";
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 * as React from 'react';
2
- import { GridApiPremium } from '../../../models/gridApiPremium';
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: React.MutableRefObject<GridApiPremium>;
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 getAggregationCellValue = ({
11
- apiRef,
12
- groupId,
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 values = [];
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
- if (typeof aggregationFunction.getCellValue === 'function') {
39
- const row = apiRef.current.getRow(rowId);
40
- values.push(aggregationFunction.getCellValue({
41
- row
42
- }));
43
- } else {
44
- values.push(apiRef.current.getCellValue(rowId, field));
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
- return aggregationFunction.apply({
48
- values,
49
- groupId,
50
- field // Added per user request in https://github.com/mui/mui-x/issues/6995#issuecomment-1327423455
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 getGroupAggregatedValue = ({
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: getAggregationCellValue({
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 hasAggregableChildren = groupNode.children.length;
104
- if (hasAggregableChildren) {
105
- const position = getAggregationPosition(groupNode);
106
- if (position != null) {
107
- aggregationLookup[groupNode.id] = getGroupAggregatedValue({
108
- groupId: groupNode.id,
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
- * Will be used to add a label on the footer of the grouping column when this aggregation function is the only one being used.
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 that allows to apply a formatter to the aggregated value.
52
- * If not defined, the grid will use the formatter of the column.
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 have the same unit as the cells used to generate it.
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 * as React from 'react';
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
- export declare const canColumnHaveAggregationFunction: ({ colDef, aggregationFunctionName, aggregationFunction, }: {
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: GridAggregationFunction | undefined;
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: ({ columnsLookup, aggregationModel, aggregationFunctions, }: {
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: React.MutableRefObject<GridPrivateApiPremium>;
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: React.MutableRefObject<GridApiPremium>;
42
+ apiRef: RefObject<GridApiPremium>;
44
43
  aggregationRule: GridAggregationRule;
45
44
  }) => string;
46
45
  export {};
@@ -18,21 +18,23 @@ const getAggregationFooterRowIdFromGroupId = groupId => {
18
18
  return `auto-generated-group-footer-${groupId}`;
19
19
  };
20
20
  exports.getAggregationFooterRowIdFromGroupId = getAggregationFooterRowIdFromGroupId;
21
+ const isClientSideAggregateFunction = aggregationFunction => !!aggregationFunction && 'apply' in aggregationFunction;
21
22
  const canColumnHaveAggregationFunction = ({
22
23
  colDef,
23
24
  aggregationFunctionName,
24
- aggregationFunction
25
+ aggregationFunction,
26
+ isDataSource
25
27
  }) => {
26
28
  if (!colDef) {
27
29
  return false;
28
30
  }
29
- if (!aggregationFunction) {
31
+ if (!isClientSideAggregateFunction(aggregationFunction) && !isDataSource) {
30
32
  return false;
31
33
  }
32
34
  if (colDef.availableAggregationFunctions != null) {
33
35
  return colDef.availableAggregationFunctions.includes(aggregationFunctionName);
34
36
  }
35
- if (!aggregationFunction.columnTypes) {
37
+ if (!aggregationFunction?.columnTypes) {
36
38
  return true;
37
39
  }
38
40
  return aggregationFunction.columnTypes.includes(colDef.type);
@@ -40,11 +42,13 @@ const canColumnHaveAggregationFunction = ({
40
42
  exports.canColumnHaveAggregationFunction = canColumnHaveAggregationFunction;
41
43
  const getAvailableAggregationFunctions = ({
42
44
  aggregationFunctions,
43
- colDef
45
+ colDef,
46
+ isDataSource
44
47
  }) => Object.keys(aggregationFunctions).filter(aggregationFunctionName => canColumnHaveAggregationFunction({
45
48
  colDef,
46
49
  aggregationFunctionName,
47
- aggregationFunction: aggregationFunctions[aggregationFunctionName]
50
+ aggregationFunction: aggregationFunctions[aggregationFunctionName],
51
+ isDataSource
48
52
  }));
49
53
  exports.getAvailableAggregationFunctions = getAvailableAggregationFunctions;
50
54
  const mergeStateWithAggregationModel = aggregationModel => state => (0, _extends2.default)({}, state, {
@@ -53,24 +57,24 @@ const mergeStateWithAggregationModel = aggregationModel => state => (0, _extends
53
57
  })
54
58
  });
55
59
  exports.mergeStateWithAggregationModel = mergeStateWithAggregationModel;
56
- const getAggregationRules = ({
57
- columnsLookup,
58
- aggregationModel,
59
- aggregationFunctions
60
- }) => {
60
+ const getAggregationRules = (columnsLookup, aggregationModel, aggregationFunctions, isDataSource) => {
61
61
  const aggregationRules = {};
62
- Object.entries(aggregationModel).forEach(([field, columnItem]) => {
62
+
63
+ // eslint-disable-next-line guard-for-in
64
+ for (const field in aggregationModel) {
65
+ const columnItem = aggregationModel[field];
63
66
  if (columnsLookup[field] && canColumnHaveAggregationFunction({
64
67
  colDef: columnsLookup[field],
65
68
  aggregationFunctionName: columnItem,
66
- aggregationFunction: aggregationFunctions[columnItem]
69
+ aggregationFunction: aggregationFunctions[columnItem],
70
+ isDataSource
67
71
  })) {
68
72
  aggregationRules[field] = {
69
73
  aggregationFunctionName: columnItem,
70
74
  aggregationFunction: aggregationFunctions[columnItem]
71
75
  };
72
76
  }
73
- });
77
+ }
74
78
  return aggregationRules;
75
79
  };
76
80
  exports.getAggregationRules = getAggregationRules;
@@ -1,4 +1,4 @@
1
- export * from './gridAggregationInterfaces';
1
+ export type { GridAggregationState, GridAggregationInitialState, GridAggregationInternalCache, GridAggregationApi, GridAggregationGetCellValueParams, GridAggregationFunction, GridAggregationFunctionDataSource, GridAggregationParams, GridAggregationModel, GridAggregationLookup, GridAggregationPosition, GridAggregationCellMeta, GridAggregationHeaderMeta, GridAggregationRule, GridAggregationRules, } from './gridAggregationInterfaces';
2
2
  export * from './gridAggregationSelectors';
3
3
  export * from './gridAggregationFunctions';
4
4
  export { GRID_AGGREGATION_ROOT_FOOTER_ROW_ID, getAggregationFooterRowIdFromGroupId, } from './gridAggregationUtils';
@@ -19,18 +19,6 @@ Object.defineProperty(exports, "getAggregationFooterRowIdFromGroupId", {
19
19
  return _gridAggregationUtils.getAggregationFooterRowIdFromGroupId;
20
20
  }
21
21
  });
22
- var _gridAggregationInterfaces = require("./gridAggregationInterfaces");
23
- Object.keys(_gridAggregationInterfaces).forEach(function (key) {
24
- if (key === "default" || key === "__esModule") return;
25
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
26
- if (key in exports && exports[key] === _gridAggregationInterfaces[key]) return;
27
- Object.defineProperty(exports, key, {
28
- enumerable: true,
29
- get: function () {
30
- return _gridAggregationInterfaces[key];
31
- }
32
- });
33
- });
34
22
  var _gridAggregationSelectors = require("./gridAggregationSelectors");
35
23
  Object.keys(_gridAggregationSelectors).forEach(function (key) {
36
24
  if (key === "default" || key === "__esModule") return;
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridStateInitializer } from '@mui/x-data-grid-pro/internals';
3
3
  import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
4
4
  import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
5
5
  export declare const aggregationStateInitializer: GridStateInitializer<Pick<DataGridPremiumProcessedProps, 'aggregationModel' | 'initialState'>, GridPrivateApiPremium>;
6
- export declare const useGridAggregation: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "onAggregationModelChange" | "initialState" | "aggregationModel" | "getAggregationPosition" | "aggregationFunctions" | "aggregationRowsScope" | "disableAggregation" | "rowGroupingColumnMode">) => void;
6
+ export declare const useGridAggregation: (apiRef: RefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "onAggregationModelChange" | "initialState" | "aggregationModel" | "getAggregationPosition" | "aggregationFunctions" | "aggregationRowsScope" | "disableAggregation" | "rowGroupingColumnMode" | "unstable_dataSource">) => void;
@@ -9,6 +9,7 @@ exports.useGridAggregation = exports.aggregationStateInitializer = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _xDataGridPro = require("@mui/x-data-grid-pro");
12
+ var _internals = require("@mui/x-data-grid-pro/internals");
12
13
  var _gridAggregationSelectors = require("./gridAggregationSelectors");
13
14
  var _gridAggregationUtils = require("./gridAggregationUtils");
14
15
  var _createAggregationLookup = require("./createAggregationLookup");
@@ -48,18 +49,29 @@ const useGridAggregation = (apiRef, props) => {
48
49
  apiRef,
49
50
  getAggregationPosition: props.getAggregationPosition,
50
51
  aggregationFunctions: props.aggregationFunctions,
51
- aggregationRowsScope: props.aggregationRowsScope
52
+ aggregationRowsScope: props.aggregationRowsScope,
53
+ isDataSource: !!props.unstable_dataSource
52
54
  });
53
55
  apiRef.current.setState(state => (0, _extends2.default)({}, state, {
54
56
  aggregation: (0, _extends2.default)({}, state.aggregation, {
55
57
  lookup: aggregationLookup
56
58
  })
57
59
  }));
58
- }, [apiRef, props.getAggregationPosition, props.aggregationFunctions, props.aggregationRowsScope]);
60
+ }, [apiRef, props.getAggregationPosition, props.aggregationFunctions, props.aggregationRowsScope, props.unstable_dataSource]);
59
61
  const aggregationApi = {
60
62
  setAggregationModel
61
63
  };
64
+ const aggregationPrivateApi = {
65
+ applyAggregation
66
+ };
62
67
  (0, _xDataGridPro.useGridApiMethod)(apiRef, aggregationApi, 'public');
68
+ (0, _xDataGridPro.useGridApiMethod)(apiRef, aggregationPrivateApi, 'private');
69
+ const addGetRowsParams = React.useCallback(params => {
70
+ return (0, _extends2.default)({}, params, {
71
+ aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef)
72
+ });
73
+ }, [apiRef]);
74
+ (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'getRowsParams', addGetRowsParams);
63
75
 
64
76
  /**
65
77
  * EVENTS
@@ -69,16 +81,16 @@ const useGridAggregation = (apiRef, props) => {
69
81
  rulesOnLastRowHydration,
70
82
  rulesOnLastColumnHydration
71
83
  } = apiRef.current.caches.aggregation;
72
- const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)({
73
- columnsLookup: (0, _xDataGridPro.gridColumnLookupSelector)(apiRef),
74
- aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef),
75
- aggregationFunctions: props.aggregationFunctions
76
- });
84
+ const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)((0, _xDataGridPro.gridColumnLookupSelector)(apiRef), (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef), props.aggregationFunctions, !!props.unstable_dataSource);
77
85
 
78
86
  // Re-apply the row hydration to add / remove the aggregation footers
79
87
  if (!(0, _gridAggregationUtils.areAggregationRulesEqual)(rulesOnLastRowHydration, aggregationRules)) {
80
- apiRef.current.requestPipeProcessorsApplication('hydrateRows');
81
- applyAggregation();
88
+ if (props.unstable_dataSource) {
89
+ apiRef.current.unstable_dataSource.fetchRows();
90
+ } else {
91
+ apiRef.current.requestPipeProcessorsApplication('hydrateRows');
92
+ applyAggregation();
93
+ }
82
94
  }
83
95
 
84
96
  // Re-apply the column hydration to wrap / unwrap the aggregated columns
@@ -86,7 +98,7 @@ const useGridAggregation = (apiRef, props) => {
86
98
  apiRef.current.caches.aggregation.rulesOnLastColumnHydration = aggregationRules;
87
99
  apiRef.current.requestPipeProcessorsApplication('hydrateColumns');
88
100
  }
89
- }, [apiRef, applyAggregation, props.aggregationFunctions, props.disableAggregation]);
101
+ }, [apiRef, applyAggregation, props.aggregationFunctions, props.disableAggregation, props.unstable_dataSource]);
90
102
  (0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'aggregationModelChange', checkAggregationRulesDiff);
91
103
  (0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'columnsChange', checkAggregationRulesDiff);
92
104
  (0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'filteredRowsSet', applyAggregation);
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
3
3
  import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
4
- export declare const useGridAggregationPreProcessors: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "aggregationFunctions" | "disableAggregation" | "getAggregationPosition" | "slotProps" | "slots">) => void;
4
+ export declare const useGridAggregationPreProcessors: (apiRef: RefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "aggregationFunctions" | "disableAggregation" | "getAggregationPosition" | "slotProps" | "slots" | "unstable_dataSource">) => void;