@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.
Files changed (119) hide show
  1. package/CHANGELOG.md +2007 -230
  2. package/DataGridPremium/DataGridPremium.js +41 -40
  3. package/DataGridPremium/useDataGridPremiumComponent.d.ts +2 -2
  4. package/DataGridPremium/useDataGridPremiumComponent.js +6 -4
  5. package/DataGridPremium/useDataGridPremiumProps.js +5 -3
  6. package/README.md +1 -1
  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/promptControl/GridToolbarPromptControl.js +47 -36
  15. package/esm/DataGridPremium/DataGridPremium.js +43 -42
  16. package/esm/DataGridPremium/useDataGridPremiumComponent.js +7 -5
  17. package/esm/DataGridPremium/useDataGridPremiumProps.js +6 -4
  18. package/esm/components/GridAggregationHeader.js +6 -1
  19. package/esm/components/GridColumnMenuAggregationItem.js +75 -47
  20. package/esm/components/GridColumnMenuRowGroupItem.js +6 -11
  21. package/esm/components/GridColumnMenuRowUngroupItem.js +11 -19
  22. package/esm/components/GridDataSourceGroupingCriteriaCell.js +1 -2
  23. package/esm/components/GridPremiumColumnMenu.js +5 -5
  24. package/esm/components/promptControl/GridToolbarPromptControl.js +47 -36
  25. package/esm/hooks/features/aggregation/createAggregationLookup.js +52 -55
  26. package/esm/hooks/features/aggregation/gridAggregationUtils.js +18 -14
  27. package/esm/hooks/features/aggregation/index.js +0 -1
  28. package/esm/hooks/features/aggregation/useGridAggregation.js +22 -12
  29. package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
  30. package/esm/hooks/features/cellSelection/useGridCellSelection.js +17 -15
  31. package/esm/hooks/features/clipboard/useGridClipboardImport.js +1 -1
  32. package/esm/hooks/features/dataSource/cache.js +3 -0
  33. package/esm/hooks/features/dataSource/models.js +1 -0
  34. package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
  35. package/esm/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
  36. package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -3
  37. package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +2 -2
  38. package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  39. package/esm/hooks/utils/useGridAriaAttributes.js +1 -3
  40. package/esm/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
  41. package/esm/utils/releaseInfo.js +1 -1
  42. package/hooks/features/aggregation/createAggregationLookup.d.ts +7 -6
  43. package/hooks/features/aggregation/createAggregationLookup.js +52 -55
  44. package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +18 -5
  45. package/hooks/features/aggregation/gridAggregationSelectors.d.ts +2 -2
  46. package/hooks/features/aggregation/gridAggregationUtils.d.ts +12 -13
  47. package/hooks/features/aggregation/gridAggregationUtils.js +18 -14
  48. package/hooks/features/aggregation/index.d.ts +1 -1
  49. package/hooks/features/aggregation/index.js +0 -12
  50. package/hooks/features/aggregation/useGridAggregation.d.ts +2 -2
  51. package/hooks/features/aggregation/useGridAggregation.js +22 -12
  52. package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +2 -2
  53. package/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
  54. package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +3 -2
  55. package/hooks/features/cellSelection/gridCellSelectionInterfaces.d.ts +3 -3
  56. package/hooks/features/cellSelection/useGridCellSelection.d.ts +2 -2
  57. package/hooks/features/cellSelection/useGridCellSelection.js +15 -13
  58. package/hooks/features/clipboard/useGridClipboardImport.d.ts +2 -2
  59. package/hooks/features/clipboard/useGridClipboardImport.js +1 -1
  60. package/hooks/features/dataSource/cache.d.ts +2 -0
  61. package/hooks/features/dataSource/cache.js +9 -0
  62. package/hooks/features/dataSource/models.d.ts +47 -0
  63. package/hooks/features/dataSource/models.js +5 -0
  64. package/hooks/features/dataSource/useGridDataSourcePremium.d.ts +4 -0
  65. package/hooks/features/dataSource/useGridDataSourcePremium.js +62 -0
  66. package/hooks/features/export/serializer/excelSerializer.d.ts +3 -2
  67. package/hooks/features/export/useGridExcelExport.d.ts +2 -2
  68. package/hooks/features/rowGrouping/createGroupingColDef.d.ts +2 -2
  69. package/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
  70. package/hooks/features/rowGrouping/gridRowGroupingSelector.d.ts +2 -2
  71. package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +4 -4
  72. package/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -2
  73. package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +2 -2
  74. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +2 -2
  75. package/hooks/features/rowGrouping/useGridRowGrouping.js +1 -1
  76. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +2 -2
  77. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  78. package/hooks/utils/useGridApiContext.d.ts +3 -1
  79. package/hooks/utils/useGridApiRef.d.ts +3 -1
  80. package/hooks/utils/useGridAriaAttributes.js +1 -3
  81. package/hooks/utils/useGridPrivateApiContext.d.ts +1 -1
  82. package/hooks/utils/useKeepGroupedColumnsHidden.d.ts +2 -2
  83. package/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
  84. package/index.d.ts +2 -0
  85. package/index.js +1 -1
  86. package/models/dataGridPremiumProps.d.ts +8 -12
  87. package/models/gridApiPremium.d.ts +5 -3
  88. package/models/gridGroupingValueGetter.d.ts +2 -1
  89. package/models/gridPastedValueParser.d.ts +2 -1
  90. package/modern/DataGridPremium/DataGridPremium.js +43 -42
  91. package/modern/DataGridPremium/useDataGridPremiumComponent.js +7 -5
  92. package/modern/DataGridPremium/useDataGridPremiumProps.js +6 -4
  93. package/modern/components/GridAggregationHeader.js +6 -1
  94. package/modern/components/GridColumnMenuAggregationItem.js +75 -47
  95. package/modern/components/GridColumnMenuRowGroupItem.js +6 -11
  96. package/modern/components/GridColumnMenuRowUngroupItem.js +11 -19
  97. package/modern/components/GridDataSourceGroupingCriteriaCell.js +1 -2
  98. package/modern/components/GridPremiumColumnMenu.js +5 -5
  99. package/modern/components/promptControl/GridToolbarPromptControl.js +47 -36
  100. package/modern/hooks/features/aggregation/createAggregationLookup.js +52 -55
  101. package/modern/hooks/features/aggregation/gridAggregationUtils.js +18 -14
  102. package/modern/hooks/features/aggregation/index.js +0 -1
  103. package/modern/hooks/features/aggregation/useGridAggregation.js +22 -12
  104. package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
  105. package/modern/hooks/features/cellSelection/useGridCellSelection.js +17 -15
  106. package/modern/hooks/features/clipboard/useGridClipboardImport.js +1 -1
  107. package/modern/hooks/features/dataSource/cache.js +3 -0
  108. package/modern/hooks/features/dataSource/models.js +1 -0
  109. package/modern/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
  110. package/modern/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
  111. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -3
  112. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +2 -2
  113. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  114. package/modern/hooks/utils/useGridAriaAttributes.js +1 -3
  115. package/modern/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
  116. package/modern/index.js +1 -1
  117. package/modern/utils/releaseInfo.js +1 -1
  118. package/package.json +6 -6
  119. package/utils/releaseInfo.js +1 -1
@@ -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;
@@ -119,7 +123,7 @@ const addFooterRows = ({
119
123
  }
120
124
  };
121
125
  const updateRootGroupFooter = groupNode => {
122
- const shouldHaveFooter = hasAggregationRule && getAggregationPosition(groupNode) === 'footer';
126
+ const shouldHaveFooter = hasAggregationRule && getAggregationPosition(groupNode) === 'footer' && groupNode.children.length > 0;
123
127
  if (shouldHaveFooter) {
124
128
  const rowId = getAggregationFooterRowIdFromGroupId(null);
125
129
  newGroupingParams = (0, _internals2.addPinnedRow)({
@@ -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");
@@ -40,7 +41,6 @@ const useGridAggregation = (apiRef, props) => {
40
41
  const currentModel = (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef);
41
42
  if (currentModel !== model) {
42
43
  apiRef.current.setState((0, _gridAggregationUtils.mergeStateWithAggregationModel)(model));
43
- apiRef.current.forceUpdate();
44
44
  }
45
45
  }, [apiRef]);
46
46
  const applyAggregation = React.useCallback(() => {
@@ -48,18 +48,29 @@ const useGridAggregation = (apiRef, props) => {
48
48
  apiRef,
49
49
  getAggregationPosition: props.getAggregationPosition,
50
50
  aggregationFunctions: props.aggregationFunctions,
51
- aggregationRowsScope: props.aggregationRowsScope
51
+ aggregationRowsScope: props.aggregationRowsScope,
52
+ isDataSource: !!props.unstable_dataSource
52
53
  });
53
54
  apiRef.current.setState(state => (0, _extends2.default)({}, state, {
54
55
  aggregation: (0, _extends2.default)({}, state.aggregation, {
55
56
  lookup: aggregationLookup
56
57
  })
57
58
  }));
58
- }, [apiRef, props.getAggregationPosition, props.aggregationFunctions, props.aggregationRowsScope]);
59
+ }, [apiRef, props.getAggregationPosition, props.aggregationFunctions, props.aggregationRowsScope, props.unstable_dataSource]);
59
60
  const aggregationApi = {
60
61
  setAggregationModel
61
62
  };
63
+ const aggregationPrivateApi = {
64
+ applyAggregation
65
+ };
62
66
  (0, _xDataGridPro.useGridApiMethod)(apiRef, aggregationApi, 'public');
67
+ (0, _xDataGridPro.useGridApiMethod)(apiRef, aggregationPrivateApi, 'private');
68
+ const addGetRowsParams = React.useCallback(params => {
69
+ return (0, _extends2.default)({}, params, {
70
+ aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef)
71
+ });
72
+ }, [apiRef]);
73
+ (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'getRowsParams', addGetRowsParams);
63
74
 
64
75
  /**
65
76
  * EVENTS
@@ -69,24 +80,23 @@ const useGridAggregation = (apiRef, props) => {
69
80
  rulesOnLastRowHydration,
70
81
  rulesOnLastColumnHydration
71
82
  } = 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
- });
83
+ const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)((0, _xDataGridPro.gridColumnLookupSelector)(apiRef), (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef), props.aggregationFunctions, !!props.unstable_dataSource);
77
84
 
78
85
  // Re-apply the row hydration to add / remove the aggregation footers
79
86
  if (!(0, _gridAggregationUtils.areAggregationRulesEqual)(rulesOnLastRowHydration, aggregationRules)) {
80
- apiRef.current.requestPipeProcessorsApplication('hydrateRows');
81
- applyAggregation();
87
+ if (props.unstable_dataSource) {
88
+ apiRef.current.unstable_dataSource.fetchRows();
89
+ } else {
90
+ apiRef.current.requestPipeProcessorsApplication('hydrateRows');
91
+ applyAggregation();
92
+ }
82
93
  }
83
94
 
84
95
  // Re-apply the column hydration to wrap / unwrap the aggregated columns
85
96
  if (!(0, _gridAggregationUtils.areAggregationRulesEqual)(rulesOnLastColumnHydration, aggregationRules)) {
86
- apiRef.current.caches.aggregation.rulesOnLastColumnHydration = aggregationRules;
87
97
  apiRef.current.requestPipeProcessorsApplication('hydrateColumns');
88
98
  }
89
- }, [apiRef, applyAggregation, props.aggregationFunctions, props.disableAggregation]);
99
+ }, [apiRef, applyAggregation, props.aggregationFunctions, props.disableAggregation, props.unstable_dataSource]);
90
100
  (0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'aggregationModelChange', checkAggregationRulesDiff);
91
101
  (0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'columnsChange', checkAggregationRulesDiff);
92
102
  (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;
@@ -18,11 +18,7 @@ const useGridAggregationPreProcessors = (apiRef, props) => {
18
18
  // that the pre-processor is called it will already have been updated with the current rules.
19
19
  const rulesOnLastColumnHydration = React.useRef({});
20
20
  const updateAggregatedColumns = React.useCallback(columnsState => {
21
- const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)({
22
- columnsLookup: columnsState.lookup,
23
- aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef),
24
- aggregationFunctions: props.aggregationFunctions
25
- });
21
+ const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)(columnsState.lookup, (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef), props.aggregationFunctions, !!props.unstable_dataSource);
26
22
  columnsState.orderedFields.forEach(field => {
27
23
  const shouldHaveAggregationValue = !!aggregationRules[field];
28
24
  const haveAggregationColumnValue = !!rulesOnLastColumnHydration.current[field];
@@ -42,14 +38,11 @@ const useGridAggregationPreProcessors = (apiRef, props) => {
42
38
  columnsState.lookup[field] = column;
43
39
  });
44
40
  rulesOnLastColumnHydration.current = aggregationRules;
41
+ apiRef.current.caches.aggregation.rulesOnLastColumnHydration = aggregationRules;
45
42
  return columnsState;
46
- }, [apiRef, props.aggregationFunctions, props.disableAggregation]);
43
+ }, [apiRef, props.aggregationFunctions, props.disableAggregation, props.unstable_dataSource]);
47
44
  const addGroupFooterRows = React.useCallback(value => {
48
- const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)({
49
- columnsLookup: (0, _xDataGridPro.gridColumnLookupSelector)(apiRef),
50
- aggregationModel: (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef),
51
- aggregationFunctions: props.aggregationFunctions
52
- });
45
+ const aggregationRules = props.disableAggregation ? {} : (0, _gridAggregationUtils.getAggregationRules)((0, _xDataGridPro.gridColumnLookupSelector)(apiRef), (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef), props.aggregationFunctions, !!props.unstable_dataSource);
53
46
  const hasAggregationRule = Object.keys(aggregationRules).length > 0;
54
47
 
55
48
  // If we did not have any aggregation footer before, and we still don't have any,
@@ -64,20 +57,21 @@ const useGridAggregationPreProcessors = (apiRef, props) => {
64
57
  getAggregationPosition: props.getAggregationPosition,
65
58
  hasAggregationRule
66
59
  });
67
- }, [apiRef, props.disableAggregation, props.getAggregationPosition, props.aggregationFunctions]);
60
+ }, [apiRef, props.disableAggregation, props.getAggregationPosition, props.aggregationFunctions, props.unstable_dataSource]);
68
61
  const addColumnMenuButtons = React.useCallback((columnMenuItems, colDef) => {
69
62
  if (props.disableAggregation || !colDef.aggregable) {
70
63
  return columnMenuItems;
71
64
  }
72
65
  const availableAggregationFunctions = (0, _gridAggregationUtils.getAvailableAggregationFunctions)({
73
66
  aggregationFunctions: props.aggregationFunctions,
74
- colDef
67
+ colDef,
68
+ isDataSource: !!props.unstable_dataSource
75
69
  });
76
70
  if (availableAggregationFunctions.length === 0) {
77
71
  return columnMenuItems;
78
72
  }
79
73
  return [...columnMenuItems, 'columnMenuAggregationItem'];
80
- }, [props.aggregationFunctions, props.disableAggregation]);
74
+ }, [props.aggregationFunctions, props.disableAggregation, props.unstable_dataSource]);
81
75
  const stateExportPreProcessing = React.useCallback(prevState => {
82
76
  if (props.disableAggregation) {
83
77
  return prevState;
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { RefObject } from '@mui/x-internals/types';
2
3
  import { GridColDef, GridFilterOperator } from '@mui/x-data-grid-pro';
3
4
  import { GridBaseColDef } from '@mui/x-data-grid-pro/internals';
4
5
  import { GridApiPremium } from '../../../models/gridApiPremium';
@@ -17,7 +18,7 @@ interface GridColDefWithAggregationWrappers extends GridBaseColDef {
17
18
  */
18
19
  export declare const wrapColumnWithAggregationValue: ({ column, apiRef, aggregationRule, }: {
19
20
  column: GridBaseColDef;
20
- apiRef: React.MutableRefObject<GridApiPremium>;
21
+ apiRef: RefObject<GridApiPremium>;
21
22
  aggregationRule: GridAggregationRule;
22
23
  }) => GridBaseColDef;
23
24
  /**
@@ -60,7 +61,7 @@ export declare const unwrapColumnFromAggregation: ({ column, }: {
60
61
  hideSortIcons?: boolean;
61
62
  disableColumnMenu?: boolean;
62
63
  filterable?: boolean;
63
- filterOperators?: readonly GridFilterOperator<import("@mui/x-data-grid").GridValidRowModel, any, any>[] | undefined;
64
+ filterOperators?: readonly GridFilterOperator<import("@mui/x-data-grid").GridValidRowModel, any, any, any>[] | undefined;
64
65
  getApplyQuickFilterFn?: import("@mui/x-data-grid").GetApplyQuickFilterFn<import("@mui/x-data-grid").GridValidRowModel, any> | undefined;
65
66
  disableReorder?: boolean;
66
67
  disableExport?: boolean;
@@ -13,13 +13,13 @@ export interface GridCellSelectionApi {
13
13
  isCellSelected: (id: GridRowId, field: GridColDef['field']) => boolean;
14
14
  /**
15
15
  * Returns an object containing the selection state of the cells.
16
- * The keys of the object correpond to the row IDs.
17
- * The value of each key is another object whose keys are the fields and values are the selection state.
16
+ * The keys of the object correspond to the row IDs.
17
+ * The value of each key is also an object, which has a column field for a key and a boolean value for its selection state.
18
18
  * @returns {GridCellSelectionModel} Object containing the selection state of the cells
19
19
  */
20
20
  getCellSelectionModel: () => GridCellSelectionModel;
21
21
  /**
22
- * Updates the selected cells to be those passed to the `newModel` argument.
22
+ * Updates the cell selection model according to the value passed to the `newModel` argument.
23
23
  * Any cell already selected will be unselected.
24
24
  * @param {GridCellSelectionModel} newModel The cells to select.
25
25
  */
@@ -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 cellSelectionStateInitializer: GridStateInitializer<Pick<DataGridPremiumProcessedProps, 'cellSelectionModel' | 'initialState'>>;
6
- export declare const useGridCellSelection: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "cellSelection" | "cellSelectionModel" | "onCellSelectionModelChange" | "pagination" | "paginationMode" | "ignoreValueFormatterDuringExport" | "clipboardCopyCellDelimiter" | "columnHeaderHeight">) => void;
6
+ export declare const useGridCellSelection: (apiRef: RefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "cellSelection" | "cellSelectionModel" | "onCellSelectionModelChange" | "pagination" | "paginationMode" | "ignoreValueFormatterDuringExport" | "clipboardCopyCellDelimiter" | "columnHeaderHeight">) => void;
@@ -25,13 +25,10 @@ const AUTO_SCROLL_SPEED = 20; // The speed to scroll once the mouse enters the s
25
25
 
26
26
  const useGridCellSelection = (apiRef, props) => {
27
27
  const hasRootReference = apiRef.current.rootElementRef.current !== null;
28
- const visibleRows = (0, _internals.useGridVisibleRows)(apiRef, props);
29
- const cellWithVirtualFocus = React.useRef();
30
- const lastMouseDownCell = React.useRef();
28
+ const cellWithVirtualFocus = React.useRef(null);
29
+ const lastMouseDownCell = React.useRef(null);
31
30
  const mousePosition = React.useRef(null);
32
- const autoScrollRAF = React.useRef();
33
- const sortedRowIds = (0, _xDataGridPro.useGridSelector)(apiRef, _xDataGridPro.gridSortedRowIdsSelector);
34
- const dimensions = (0, _xDataGridPro.useGridSelector)(apiRef, _xDataGridPro.gridDimensionsSelector);
31
+ const autoScrollRAF = React.useRef(null);
35
32
  const totalHeaderHeight = (0, _internals.getTotalHeaderHeight)(apiRef, props);
36
33
  const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
37
34
  const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.clipboardExport : ignoreValueFormatterProp) || false;
@@ -85,6 +82,7 @@ const useGridCellSelection = (apiRef, props) => {
85
82
  finalEndColumnIndex = startColumnIndex;
86
83
  }
87
84
  const visibleColumns = apiRef.current.getVisibleColumns();
85
+ const visibleRows = (0, _internals.getVisibleRows)(apiRef);
88
86
  const rowsInRange = visibleRows.rows.slice(finalStartRowIndex, finalEndRowIndex + 1);
89
87
  const columnsInRange = visibleColumns.slice(finalStartColumnIndex, finalEndColumnIndex + 1);
90
88
  const newModel = keepOtherSelected ? (0, _extends2.default)({}, apiRef.current.getCellSelectionModel()) : {};
@@ -97,10 +95,9 @@ const useGridCellSelection = (apiRef, props) => {
97
95
  }, {});
98
96
  });
99
97
  apiRef.current.setCellSelectionModel(newModel);
100
- }, [apiRef, visibleRows.rows]);
98
+ }, [apiRef]);
101
99
  const getSelectedCellsAsArray = React.useCallback(() => {
102
100
  const selectionModel = apiRef.current.getCellSelectionModel();
103
- const idToIdLookup = (0, _xDataGridPro.gridRowsDataRowIdToIdLookupSelector)(apiRef);
104
101
  const currentVisibleRows = (0, _internals.getVisibleRows)(apiRef, props);
105
102
  const sortedEntries = currentVisibleRows.rows.reduce((result, row) => {
106
103
  if (row.id in selectionModel) {
@@ -112,7 +109,7 @@ const useGridCellSelection = (apiRef, props) => {
112
109
  selectedCells.push(...Object.entries(fields).reduce((selectedFields, [field, isSelected]) => {
113
110
  if (isSelected) {
114
111
  selectedFields.push({
115
- id: idToIdLookup[id],
112
+ id,
116
113
  field
117
114
  });
118
115
  }
@@ -196,6 +193,7 @@ const useGridCellSelection = (apiRef, props) => {
196
193
  if (!mousePosition.current || !apiRef.current.virtualScrollerRef?.current) {
197
194
  return;
198
195
  }
196
+ const dimensions = (0, _xDataGridPro.gridDimensionsSelector)(apiRef.current.state);
199
197
  const {
200
198
  x: mouseX,
201
199
  y: mouseY
@@ -238,7 +236,7 @@ const useGridCellSelection = (apiRef, props) => {
238
236
  autoScrollRAF.current = requestAnimationFrame(autoScroll);
239
237
  }
240
238
  autoScroll();
241
- }, [apiRef, dimensions, totalHeaderHeight]);
239
+ }, [apiRef, totalHeaderHeight]);
242
240
  const handleCellMouseOver = React.useCallback((params, event) => {
243
241
  if (!lastMouseDownCell.current) {
244
242
  return;
@@ -255,6 +253,7 @@ const useGridCellSelection = (apiRef, props) => {
255
253
  if (!virtualScrollerRect) {
256
254
  return;
257
255
  }
256
+ const dimensions = (0, _xDataGridPro.gridDimensionsSelector)(apiRef.current.state);
258
257
  const {
259
258
  x,
260
259
  y
@@ -280,7 +279,7 @@ const useGridCellSelection = (apiRef, props) => {
280
279
  // Mouse has left the sensitivity area while auto scroll is on
281
280
  stopAutoScroll();
282
281
  }
283
- }, [apiRef, startAutoScroll, stopAutoScroll, totalHeaderHeight, dimensions]);
282
+ }, [apiRef, startAutoScroll, stopAutoScroll, totalHeaderHeight]);
284
283
  const handleCellClick = (0, _useEventCallback.default)((params, event) => {
285
284
  const {
286
285
  id,
@@ -340,6 +339,7 @@ const useGridCellSelection = (apiRef, props) => {
340
339
  } else if (event.key === 'ArrowLeft') {
341
340
  endColumnIndex -= 1;
342
341
  }
342
+ const visibleRows = (0, _internals.getVisibleRows)(apiRef);
343
343
  if (endRowIndex < 0 || endRowIndex >= visibleRows.rows.length) {
344
344
  return;
345
345
  }
@@ -392,6 +392,7 @@ const useGridCellSelection = (apiRef, props) => {
392
392
  id,
393
393
  field
394
394
  }) => {
395
+ const visibleRows = (0, _internals.getVisibleRows)(apiRef);
395
396
  if (!visibleRows.range || !apiRef.current.isCellSelected(id, field)) {
396
397
  return classes;
397
398
  }
@@ -440,7 +441,7 @@ const useGridCellSelection = (apiRef, props) => {
440
441
  newClasses.push(_xDataGridPro.gridClasses['cell--rangeRight']);
441
442
  }
442
443
  return newClasses;
443
- }, [apiRef, visibleRows.range, visibleRows.rows]);
444
+ }, [apiRef]);
444
445
  const canUpdateFocus = React.useCallback((initialValue, {
445
446
  event,
446
447
  cell
@@ -461,6 +462,7 @@ const useGridCellSelection = (apiRef, props) => {
461
462
  if (apiRef.current.getSelectedCellsAsArray().length <= 1) {
462
463
  return value;
463
464
  }
465
+ const sortedRowIds = (0, _xDataGridPro.gridSortedRowIdsSelector)(apiRef.current.state);
464
466
  const cellSelectionModel = apiRef.current.getCellSelectionModel();
465
467
  const unsortedSelectedRowIds = Object.keys(cellSelectionModel);
466
468
  const sortedSelectedRowIds = sortedRowIds.filter(id => unsortedSelectedRowIds.includes(`${id}`));
@@ -486,7 +488,7 @@ const useGridCellSelection = (apiRef, props) => {
486
488
  return acc === '' ? rowString : [acc, rowString].join('\r\n');
487
489
  }, '');
488
490
  return copyData;
489
- }, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter, sortedRowIds]);
491
+ }, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
490
492
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'isCellSelected', checkIfCellIsSelected);
491
493
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'cellClassName', addClassesToCells);
492
494
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'canUpdateFocus', canUpdateFocus);
@@ -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 type { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
4
- export declare const useGridClipboardImport: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "pagination" | "paginationMode" | "processRowUpdate" | "onProcessRowUpdateError" | "getRowId" | "onClipboardPasteStart" | "onClipboardPasteEnd" | "splitClipboardPastedText" | "disableClipboardPaste" | "onBeforeClipboardPasteStart">) => void;
4
+ export declare const useGridClipboardImport: (apiRef: RefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "pagination" | "paginationMode" | "processRowUpdate" | "onProcessRowUpdateError" | "getRowId" | "onClipboardPasteStart" | "onClipboardPasteEnd" | "splitClipboardPastedText" | "disableClipboardPaste" | "onBeforeClipboardPasteStart">) => void;
@@ -129,7 +129,7 @@ class CellValueUpdater {
129
129
  if (onProcessRowUpdateError) {
130
130
  onProcessRowUpdateError(errorThrown);
131
131
  } else if (process.env.NODE_ENV !== 'production') {
132
- (0, _warning.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/#server-side-persistence.'], 'error');
132
+ (0, _warning.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');
133
133
  }
134
134
  };
135
135
  try {
@@ -0,0 +1,2 @@
1
+ import { GridGetRowsParamsPremium } from './models';
2
+ export declare function getKeyPremium(params: GridGetRowsParamsPremium): string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getKeyPremium = getKeyPremium;
7
+ function getKeyPremium(params) {
8
+ return JSON.stringify([params.filterModel, params.sortModel, params.groupKeys, params.groupFields, params.start, params.end, params.aggregationModel]);
9
+ }
@@ -0,0 +1,47 @@
1
+ import type { GridColDef, GridRowId, GridValidRowModel, GridDataSource, GridGetRowsResponse, GridGetRowsParams, GridDataSourceApiBase, GridDataSourcePrivateApi } from '@mui/x-data-grid-pro';
2
+ import type { GridAggregationModel } from '../aggregation/gridAggregationInterfaces';
3
+ export interface GridGetRowsResponsePremium extends GridGetRowsResponse {
4
+ /**
5
+ * Row to be used for aggregation footer row.
6
+ * It must provide the values for the aggregated columns passed in
7
+ * `GridGetRowsParams.aggregationModel`.
8
+ */
9
+ aggregateRow?: GridValidRowModel;
10
+ }
11
+ export interface GridGetRowsParamsPremium extends GridGetRowsParams {
12
+ aggregationModel?: GridAggregationModel;
13
+ }
14
+ export interface GridDataSourcePremium extends Omit<GridDataSource, 'getRows'> {
15
+ /**
16
+ * This method will be called when the grid needs to fetch some rows.
17
+ * @param {GridGetRowsParamsPremium} params The parameters required to fetch the rows.
18
+ * @returns {Promise<GridGetRowsResponsePremium>} A promise that resolves to the data of type [GridGetRowsResponsePremium].
19
+ */
20
+ getRows(params: GridGetRowsParamsPremium): Promise<GridGetRowsResponsePremium>;
21
+ /**
22
+ * Used to get the aggregated value for a parent row.
23
+ * @param {GridValidRowModel} row The row to extract the aggregated value from.
24
+ * @param {GridColDef['field']} field The field to extract the aggregated value for.
25
+ * @returns {string} The aggregated value for a specific aggregated column.
26
+ */
27
+ getAggregatedValue?: (row: GridValidRowModel, field: GridColDef['field']) => string;
28
+ }
29
+ export interface GridDataSourceApiBasePremium extends Omit<GridDataSourceApiBase, 'fetchRows'> {
30
+ /**
31
+ * Fetches the rows from the server.
32
+ * If no `parentId` option is provided, it fetches the root rows.
33
+ * Any missing parameter from `params` will be filled from the state (sorting, filtering, etc.).
34
+ * @param {GridRowId} parentId The id of the parent node (default: `GRID_ROOT_GROUP_ID`).
35
+ * @param {Partial<GridGetRowsParamsPremium>} params Request parameters override.
36
+ */
37
+ fetchRows: (parentId?: GridRowId, params?: Partial<GridGetRowsParamsPremium>) => void;
38
+ }
39
+ export interface GridDataSourceApiPremium {
40
+ /**
41
+ * The data source API.
42
+ */
43
+ unstable_dataSource: GridDataSourceApiBasePremium;
44
+ }
45
+ export interface GridDataSourcePremiumPrivateApi extends GridDataSourcePrivateApi {
46
+ resolveGroupAggregation: (groupId: GridRowId, field: string) => any;
47
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,4 @@
1
+ import { RefObject } from '@mui/x-internals/types';
2
+ import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
3
+ import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
4
+ export declare const useGridDataSourcePremium: (apiRef: RefObject<GridPrivateApiPremium>, props: DataGridPremiumProcessedProps) => void;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useGridDataSourcePremium = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var React = _interopRequireWildcard(require("react"));
11
+ var _xDataGridPro = require("@mui/x-data-grid-pro");
12
+ var _internals = require("@mui/x-data-grid-pro/internals");
13
+ var _cache = require("./cache");
14
+ const options = {
15
+ cacheOptions: {
16
+ getKey: _cache.getKeyPremium
17
+ }
18
+ };
19
+ const useGridDataSourcePremium = (apiRef, props) => {
20
+ const {
21
+ api,
22
+ strategyProcessor,
23
+ events
24
+ } = (0, _internals.useGridDataSourceBase)(apiRef, props, options);
25
+ const aggregateRowRef = React.useRef({});
26
+ const processDataSourceRows = React.useCallback(({
27
+ params,
28
+ response
29
+ }, applyRowHydration) => {
30
+ if (response.aggregateRow) {
31
+ aggregateRowRef.current = response.aggregateRow;
32
+ }
33
+ if (Object.keys(params.aggregationModel || {}).length > 0) {
34
+ if (applyRowHydration) {
35
+ apiRef.current.requestPipeProcessorsApplication('hydrateRows');
36
+ }
37
+ apiRef.current.applyAggregation();
38
+ }
39
+ return {
40
+ params,
41
+ response
42
+ };
43
+ }, [apiRef]);
44
+ const resolveGroupAggregation = React.useCallback((groupId, field) => {
45
+ if (groupId === _xDataGridPro.GRID_ROOT_GROUP_ID) {
46
+ return props.unstable_dataSource?.getAggregatedValue?.(aggregateRowRef.current, field);
47
+ }
48
+ const row = apiRef.current.getRow(groupId);
49
+ return props.unstable_dataSource?.getAggregatedValue?.(row, field);
50
+ }, [apiRef, props.unstable_dataSource]);
51
+ const privateApi = (0, _extends2.default)({}, api.private, {
52
+ resolveGroupAggregation
53
+ });
54
+ (0, _xDataGridPro.useGridApiMethod)(apiRef, api.public, 'public');
55
+ (0, _xDataGridPro.useGridApiMethod)(apiRef, privateApi, 'private');
56
+ (0, _internals.useGridRegisterStrategyProcessor)(apiRef, strategyProcessor.strategyName, strategyProcessor.group, strategyProcessor.processor);
57
+ (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'processDataSourceRows', processDataSourceRows);
58
+ Object.entries(events).forEach(([event, handler]) => {
59
+ (0, _xDataGridPro.useGridApiEventHandler)(apiRef, event, handler);
60
+ });
61
+ };
62
+ exports.useGridDataSourcePremium = useGridDataSourcePremium;
@@ -1,4 +1,5 @@
1
1
  import type * as Excel from 'exceljs';
2
+ import { RefObject } from '@mui/x-internals/types';
2
3
  import { GridRowId, GridColDef } from '@mui/x-data-grid-pro';
3
4
  import { GridStateColDef, GridColumnGroupLookup } from '@mui/x-data-grid/internals';
4
5
  import { ColumnsStylesInterface, GridExcelExportOptions } from '../gridExcelExportInterface';
@@ -18,7 +19,7 @@ interface SerializedRow {
18
19
  * actual rendered columns.
19
20
  * The caller of this function MUST call `resetColSpan()` before and after usage.
20
21
  */
21
- export declare const serializeRowUnsafe: (id: GridRowId, columns: GridStateColDef[], apiRef: React.MutableRefObject<GridPrivateApiPremium>, defaultValueOptionsFormulae: {
22
+ export declare const serializeRowUnsafe: (id: GridRowId, columns: GridStateColDef[], apiRef: RefObject<GridPrivateApiPremium>, defaultValueOptionsFormulae: {
22
23
  [field: string]: {
23
24
  address: string;
24
25
  };
@@ -53,7 +54,7 @@ interface BuildExcelOptions extends Pick<GridExcelExportOptions, 'exceljsPreProc
53
54
  rowIds: GridRowId[];
54
55
  columnsStyles?: ColumnsStylesInterface;
55
56
  }
56
- export declare function buildExcel(options: BuildExcelOptions, apiRef: React.MutableRefObject<GridPrivateApiPremium>): Promise<Excel.Workbook>;
57
+ export declare function buildExcel(options: BuildExcelOptions, apiRef: RefObject<GridPrivateApiPremium>): Promise<Excel.Workbook>;
57
58
  export interface ExcelExportInitEvent {
58
59
  serializedColumns: SerializedColumns;
59
60
  serializedRows: SerializedRow[];
@@ -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 { DataGridPremiumProps } from '../../../models/dataGridPremiumProps';
4
4
  /**
@@ -8,4 +8,4 @@ import { DataGridPremiumProps } from '../../../models/dataGridPremiumProps';
8
8
  * @requires useGridSelection (state)
9
9
  * @requires useGridParamsApi (method)
10
10
  */
11
- export declare const useGridExcelExport: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: DataGridPremiumProps) => void;
11
+ export declare const useGridExcelExport: (apiRef: RefObject<GridPrivateApiPremium>, props: DataGridPremiumProps) => void;