@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,9 +18,10 @@ var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
18
18
  var _RecordButton = require("./RecordButton");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
20
  const supportsSpeechRecognition = !!_RecordButton.BrowserSpeechRecognition;
21
- const useUtilityClasses = (ownerState, recording) => {
21
+ const useUtilityClasses = ownerState => {
22
22
  const {
23
- classes
23
+ classes,
24
+ recording
24
25
  } = ownerState;
25
26
  const slots = {
26
27
  root: ['toolbarPromptControl', recording && 'toolbarPromptControl--recording'],
@@ -33,7 +34,12 @@ const useUtilityClasses = (ownerState, recording) => {
33
34
  const GridToolbarPromptControlRoot = (0, _styles.styled)('div', {
34
35
  name: 'MuiDataGrid',
35
36
  slot: 'ToolbarPromptControl',
36
- overridesResolver: (_, styles) => styles.toolbarPromptControl
37
+ overridesResolver: (props, styles) => {
38
+ const {
39
+ ownerState
40
+ } = props;
41
+ return [styles.toolbarPromptControl, ownerState.recording && styles['toolbarPromptControl--recording']];
42
+ }
37
43
  })({
38
44
  flex: 1,
39
45
  display: 'flex',
@@ -79,7 +85,11 @@ function GridToolbarPromptControl(props) {
79
85
  const [error, setError] = React.useState(null);
80
86
  const [isRecording, setRecording] = React.useState(false);
81
87
  const [query, setQuery] = React.useState('');
82
- const classes = useUtilityClasses(rootProps, isRecording);
88
+ const ownerState = {
89
+ classes: rootProps.classes,
90
+ recording: isRecording
91
+ };
92
+ const classes = useUtilityClasses(ownerState);
83
93
  const examplesFromData = React.useMemo(() => allowDataSampling ? sampleData(apiRef) : undefined, [apiRef, allowDataSampling]);
84
94
  const processPrompt = React.useCallback(() => {
85
95
  const context = generateContext(apiRef, examplesFromData);
@@ -153,10 +163,9 @@ function GridToolbarPromptControl(props) {
153
163
  });
154
164
  const placeholder = supportsSpeechRecognition ? apiRef.current.getLocaleText('toolbarPromptControlWithRecordingPlaceholder') : apiRef.current.getLocaleText('toolbarPromptControlPlaceholder');
155
165
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridToolbarPromptControlRoot, {
156
- ownerState: rootProps,
166
+ ownerState: ownerState,
157
167
  className: classes.root,
158
168
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, {
159
- variant: "outlined",
160
169
  placeholder: isRecording ? apiRef.current.getLocaleText('toolbarPromptControlRecordingPlaceholder') : placeholder,
161
170
  "aria-label": apiRef.current.getLocaleText('toolbarPromptControlLabel'),
162
171
  disabled: isLoading,
@@ -169,40 +178,42 @@ function GridToolbarPromptControl(props) {
169
178
  onKeyDown: handleKeyDown,
170
179
  error: !!error,
171
180
  helperText: error,
172
- InputProps: {
173
- startAdornment: supportsSpeechRecognition && /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputAdornment, {
174
- position: "start",
175
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RecordButton.RecordButton, {
176
- className: classes.recordButton,
177
- lang: lang,
178
- recording: isRecording,
179
- setRecording: setRecording,
180
- disabled: isLoading,
181
- onUpdate: setQuery,
182
- onDone: handleDone,
183
- onError: setError
184
- })
185
- }),
186
- endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputAdornment, {
187
- position: "end",
188
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, {
189
- title: apiRef.current.getLocaleText('toolbarPromptControlSendActionLabel'),
190
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
191
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, {
192
- className: classes.sendButton,
193
- disabled: isLoading || isRecording || query === '',
194
- color: "primary",
195
- onClick: processPrompt,
196
- size: "small",
197
- "aria-label": apiRef.current.getLocaleText('toolbarPromptControlSendActionAriaLabel'),
198
- edge: "end",
199
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.toolbarPromptSendIcon, {
200
- fontSize: "small"
181
+ slotProps: {
182
+ input: {
183
+ startAdornment: supportsSpeechRecognition && /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputAdornment, {
184
+ position: "start",
185
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RecordButton.RecordButton, {
186
+ className: classes.recordButton,
187
+ lang: lang,
188
+ recording: isRecording,
189
+ setRecording: setRecording,
190
+ disabled: isLoading,
191
+ onUpdate: setQuery,
192
+ onDone: handleDone,
193
+ onError: setError
194
+ })
195
+ }),
196
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputAdornment, {
197
+ position: "end",
198
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, {
199
+ title: apiRef.current.getLocaleText('toolbarPromptControlSendActionLabel'),
200
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
201
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, {
202
+ className: classes.sendButton,
203
+ disabled: isLoading || isRecording || query === '',
204
+ color: "primary",
205
+ onClick: processPrompt,
206
+ size: "small",
207
+ "aria-label": apiRef.current.getLocaleText('toolbarPromptControlSendActionAriaLabel'),
208
+ edge: "end",
209
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.toolbarPromptSendIcon, {
210
+ fontSize: "small"
211
+ })
201
212
  })
202
213
  })
203
214
  })
204
215
  })
205
- })
216
+ }
206
217
  }
207
218
  })
208
219
  });
@@ -4,14 +4,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useLicenseVerifier, Watermark } from '@mui/x-license';
7
- import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider } from '@mui/x-data-grid-pro';
7
+ import { GridRoot, GridContextProvider } from '@mui/x-data-grid-pro';
8
8
  import { propValidatorsDataGrid, propValidatorsDataGridPro, validateProps } from '@mui/x-data-grid-pro/internals';
9
+ import { forwardRef } from '@mui/x-internals/forwardRef';
9
10
  import { useDataGridPremiumComponent } from "./useDataGridPremiumComponent.js";
10
11
  import { useDataGridPremiumProps } from "./useDataGridPremiumProps.js";
11
12
  import { getReleaseInfo } from "../utils/releaseInfo.js";
12
13
  import { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
13
14
  import { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
15
16
  const configuration = {
16
17
  hooks: {
17
18
  useGridAriaAttributes,
@@ -19,11 +20,15 @@ const configuration = {
19
20
  }
20
21
  };
21
22
  const releaseInfo = getReleaseInfo();
23
+ const watermark = /*#__PURE__*/_jsx(Watermark, {
24
+ packageName: "x-data-grid-premium",
25
+ releaseInfo: releaseInfo
26
+ });
22
27
  let dataGridPremiumPropValidators;
23
28
  if (process.env.NODE_ENV !== 'production') {
24
29
  dataGridPremiumPropValidators = [...propValidatorsDataGrid, ...propValidatorsDataGridPro];
25
30
  }
26
- const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremium(inProps, ref) {
31
+ const DataGridPremiumRaw = forwardRef(function DataGridPremium(inProps, ref) {
27
32
  const props = useDataGridPremiumProps(inProps);
28
33
  const privateApiRef = useDataGridPremiumComponent(props.apiRef, props);
29
34
  useLicenseVerifier('x-data-grid-premium', releaseInfo);
@@ -34,18 +39,13 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
34
39
  privateApiRef: privateApiRef,
35
40
  configuration: configuration,
36
41
  props: props,
37
- children: /*#__PURE__*/_jsxs(GridRoot, _extends({
42
+ children: /*#__PURE__*/_jsx(GridRoot, _extends({
38
43
  className: props.className,
39
44
  style: props.style,
40
- sx: props.sx,
41
- ref: ref
42
- }, props.forwardedProps, {
43
- children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
44
- children: /*#__PURE__*/_jsx(Watermark, {
45
- packageName: "x-data-grid-premium",
46
- releaseInfo: releaseInfo
47
- })
48
- }), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
45
+ sx: props.sx
46
+ }, props.slotProps?.root, {
47
+ ref: ref,
48
+ children: watermark
49
49
  }))
50
50
  });
51
51
  });
@@ -56,7 +56,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
56
56
  // ----------------------------------------------------------------------
57
57
  /**
58
58
  * Aggregation functions available on the grid.
59
- * @default GRID_AGGREGATION_FUNCTIONS
59
+ * @default GRID_AGGREGATION_FUNCTIONS when `unstable_dataSource` is not provided, `{}` when `unstable_dataSource` is provided
60
60
  */
61
61
  aggregationFunctions: PropTypes.object,
62
62
  /**
@@ -74,7 +74,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
74
74
  * The ref object that allows grid manipulation. Can be instantiated with `useGridApiRef()`.
75
75
  */
76
76
  apiRef: PropTypes.shape({
77
- current: PropTypes.object.isRequired
77
+ current: PropTypes.object
78
78
  }),
79
79
  /**
80
80
  * The label of the Data Grid.
@@ -109,6 +109,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
109
109
  */
110
110
  autosizeOptions: PropTypes.shape({
111
111
  columns: PropTypes.arrayOf(PropTypes.string),
112
+ disableColumnVirtualization: PropTypes.bool,
112
113
  expand: PropTypes.bool,
113
114
  includeHeaders: PropTypes.bool,
114
115
  includeOutliers: PropTypes.bool,
@@ -186,7 +187,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
186
187
  /**
187
188
  * The row ids to show the detail panel.
188
189
  */
189
- detailPanelExpandedRowIds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired),
190
+ detailPanelExpandedRowIds: PropTypes /* @typescript-to-proptypes-ignore */.instanceOf(Set),
190
191
  /**
191
192
  * If `true`, aggregation is disabled.
192
193
  * @default false
@@ -304,7 +305,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
304
305
  * For each feature, if the flag is not explicitly set to `true`, then the feature is fully disabled, and neither property nor method calls will have any effect.
305
306
  */
306
307
  experimentalFeatures: PropTypes.shape({
307
- ariaV8: PropTypes.bool,
308
308
  warnIfFocusStateIsNotSynced: PropTypes.bool
309
309
  }),
310
310
  /**
@@ -333,11 +333,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
333
333
  quickFilterLogicOperator: PropTypes.oneOf(['and', 'or']),
334
334
  quickFilterValues: PropTypes.array
335
335
  }),
336
- /**
337
- * Forwarded props for the Data Grid root element.
338
- * @ignore - do not document.
339
- */
340
- forwardedProps: PropTypes.object,
341
336
  /**
342
337
  * Determines the position of an aggregated value.
343
338
  * @param {GridGroupNode} groupNode The current group.
@@ -452,14 +447,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
452
447
  clipboardExport: PropTypes.bool,
453
448
  csvExport: PropTypes.bool
454
449
  }), PropTypes.bool]),
455
- /**
456
- * If `select`, a group header checkbox in indeterminate state (like "Select All" checkbox)
457
- * will select all the rows under it.
458
- * If `deselect`, it will deselect all the rows under it.
459
- * Works only if `checkboxSelection` is enabled.
460
- * @default "deselect"
461
- */
462
- indeterminateCheckboxAction: PropTypes.oneOf(['deselect', 'select']),
463
450
  /**
464
451
  * The initial state of the DataGridPremium.
465
452
  * The data in it is set in the state on initialization but isn't controlled.
@@ -927,14 +914,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
927
914
  * Controls the modes of the rows.
928
915
  */
929
916
  rowModesModel: PropTypes.object,
930
- /**
931
- * The milliseconds delay to wait after measuring the row height before recalculating row positions.
932
- * Setting it to a lower value could be useful when using dynamic row height,
933
- * but might reduce performance when displaying a large number of rows.
934
- * @default 166
935
- * @deprecated
936
- */
937
- rowPositionsDebounceMs: PropTypes.number,
938
917
  /**
939
918
  * If `true`, the reordering of rows is enabled.
940
919
  * @default false
@@ -964,7 +943,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
964
943
  * - Deselecting a descendant of a selected parent deselects the parent automatically.
965
944
  *
966
945
  * Works with tree data and row grouping on the client-side only.
967
- * @default { parents: false, descendants: false }
946
+ * @default { parents: true, descendants: true }
968
947
  */
969
948
  rowSelectionPropagation: PropTypes.shape({
970
949
  descendants: PropTypes.bool,
@@ -974,7 +953,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
974
953
  * Loading rows can be processed on the server or client-side.
975
954
  * Set it to 'client' if you would like enable infnite loading.
976
955
  * Set it to 'server' if you would like to enable lazy loading.
977
- * * @default "client"
956
+ * @default "client"
978
957
  */
979
958
  rowsLoadingMode: PropTypes.oneOf(['client', 'server']),
980
959
  /**
@@ -982,12 +961,18 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
982
961
  * @default "margin"
983
962
  */
984
963
  rowSpacingType: PropTypes.oneOf(['border', 'margin']),
964
+ /**
965
+ * If `true`, the Data Grid will auto span the cells over the rows having the same value.
966
+ * @default false
967
+ */
968
+ rowSpanning: PropTypes.bool,
985
969
  /**
986
970
  * Override the height/width of the Data Grid inner scrollbar.
987
971
  */
988
972
  scrollbarSize: PropTypes.number,
989
973
  /**
990
974
  * Set the area in `px` at the bottom of the grid viewport where onRowsScrollEnd is called.
975
+ * If combined with `unstable_lazyLoading`, it defines the area where the next data request is triggered.
991
976
  * @default 80
992
977
  */
993
978
  scrollEndThreshold: PropTypes.number,
@@ -1051,6 +1036,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
1051
1036
  */
1052
1037
  treeData: PropTypes.bool,
1053
1038
  unstable_dataSource: PropTypes.shape({
1039
+ getAggregatedValue: PropTypes.func,
1054
1040
  getChildrenCount: PropTypes.func,
1055
1041
  getGroupKey: PropTypes.func,
1056
1042
  getRows: PropTypes.func.isRequired,
@@ -1061,6 +1047,18 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
1061
1047
  get: PropTypes.func.isRequired,
1062
1048
  set: PropTypes.func.isRequired
1063
1049
  }),
1050
+ /**
1051
+ * Used together with `unstable_dataSource` to enable lazy loading.
1052
+ * If enabled, the grid stops adding `paginationModel` to the data requests (`getRows`)
1053
+ * and starts sending `start` and `end` values depending on the loading mode and the scroll position.
1054
+ * @default false
1055
+ */
1056
+ unstable_lazyLoading: PropTypes.bool,
1057
+ /**
1058
+ * If positive, the Data Grid will throttle data source requests on rendered rows interval change.
1059
+ * @default 500
1060
+ */
1061
+ unstable_lazyLoadingRequestThrottleMs: PropTypes.number,
1064
1062
  /**
1065
1063
  * Definition of the column rendered when the `unstable_listView` prop is enabled.
1066
1064
  */
@@ -1078,10 +1076,13 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
1078
1076
  unstable_listView: PropTypes.bool,
1079
1077
  unstable_onDataSourceError: PropTypes.func,
1080
1078
  /**
1081
- * If `true`, the Data Grid will auto span the cells over the rows having the same value.
1079
+ * If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
1080
+ * By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
1081
+ * For datasets with a large number of columns, this can cause performance issues.
1082
+ * The downside of enabling this prop is that the row height will be estimated based the cells that are currently rendered, which can cause row height change when scrolling horizontally.
1082
1083
  * @default false
1083
1084
  */
1084
- unstable_rowSpanning: PropTypes.bool
1085
+ virtualizeColumnsWithAutoRowHeight: PropTypes.bool
1085
1086
  } : void 0;
1086
1087
  /**
1087
1088
  * Demos:
@@ -1,4 +1,5 @@
1
- import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridDataSourceTreeDataPreProcessors, useGridDataSource, dataSourceStateInitializer, useGridRowSpanning, rowSpanningStateInitializer, useGridListView, listViewStateInitializer } from '@mui/x-data-grid-pro/internals';
1
+ import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors, useGridDataSourceLazyLoader, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridDataSourceTreeDataPreProcessors, dataSourceStateInitializer, useGridRowSpanning, rowSpanningStateInitializer, useGridListView, listViewStateInitializer } from '@mui/x-data-grid-pro/internals';
2
+ import { useGridDataSourcePremium as useGridDataSource } from "../hooks/features/dataSource/useGridDataSourcePremium.js";
2
3
  // Premium-only features
3
4
  import { useGridAggregation, aggregationStateInitializer } from "../hooks/features/aggregation/useGridAggregation.js";
4
5
  import { useGridAggregationPreProcessors } from "../hooks/features/aggregation/useGridAggregationPreProcessors.js";
@@ -32,7 +33,6 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
32
33
  /**
33
34
  * Register all state initializers here.
34
35
  */
35
- useGridInitializeState(dimensionsStateInitializer, apiRef, props);
36
36
  useGridInitializeState(headerFilteringStateInitializer, apiRef, props);
37
37
  useGridInitializeState(rowGroupingStateInitializer, apiRef, props);
38
38
  useGridInitializeState(aggregationStateInitializer, apiRef, props);
@@ -42,6 +42,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
42
42
  useGridInitializeState(columnPinningStateInitializer, apiRef, props);
43
43
  useGridInitializeState(columnsStateInitializer, apiRef, props);
44
44
  useGridInitializeState(rowPinningStateInitializer, apiRef, props);
45
+ useGridInitializeState(paginationStateInitializer, apiRef, props);
45
46
  useGridInitializeState(rowsStateInitializer, apiRef, props);
46
47
  useGridInitializeState(editingStateInitializer, apiRef, props);
47
48
  useGridInitializeState(focusStateInitializer, apiRef, props);
@@ -52,17 +53,18 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
52
53
  useGridInitializeState(densityStateInitializer, apiRef, props);
53
54
  useGridInitializeState(columnReorderStateInitializer, apiRef, props);
54
55
  useGridInitializeState(columnResizeStateInitializer, apiRef, props);
55
- useGridInitializeState(paginationStateInitializer, apiRef, props);
56
- useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
57
56
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
58
57
  useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
59
58
  useGridInitializeState(virtualizationStateInitializer, apiRef, props);
60
59
  useGridInitializeState(dataSourceStateInitializer, apiRef, props);
60
+ useGridInitializeState(dimensionsStateInitializer, apiRef, props);
61
+ useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
61
62
  useGridInitializeState(listViewStateInitializer, apiRef, props);
62
63
  useGridRowGrouping(apiRef, props);
63
64
  useGridHeaderFiltering(apiRef, props);
64
65
  useGridTreeData(apiRef, props);
65
66
  useGridAggregation(apiRef, props);
67
+ useGridDataSource(apiRef, props);
66
68
  useGridKeyboardNavigation(apiRef, props);
67
69
  useGridRowSelection(apiRef, props);
68
70
  useGridCellSelection(apiRef, props);
@@ -90,6 +92,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
90
92
  useGridScroll(apiRef, props);
91
93
  useGridInfiniteLoader(apiRef, props);
92
94
  useGridLazyLoader(apiRef, props);
95
+ useGridDataSourceLazyLoader(apiRef, props);
93
96
  useGridColumnMenu(apiRef);
94
97
  useGridCsvExport(apiRef, props);
95
98
  useGridPrintExport(apiRef, props);
@@ -98,7 +101,6 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
98
101
  useGridDimensions(apiRef, props);
99
102
  useGridEvents(apiRef, props);
100
103
  useGridStatePersistence(apiRef);
101
- useGridDataSource(apiRef, props);
102
104
  useGridVirtualization(apiRef, props);
103
105
  useGridListView(apiRef, props);
104
106
  return apiRef;
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
4
  import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT, GridSignature } from '@mui/x-data-grid-pro';
5
- import { computeSlots, useProps } from '@mui/x-data-grid-pro/internals';
5
+ import { computeSlots } from '@mui/x-data-grid-pro/internals';
6
6
  import { GRID_AGGREGATION_FUNCTIONS } from "../hooks/features/aggregation/index.js";
7
7
  import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from "../constants/dataGridPremiumDefaultSlotsComponents.js";
8
8
  const getDataGridPremiumForcedProps = themedProps => _extends({
@@ -34,18 +34,20 @@ export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO
34
34
  });
35
35
  const defaultSlots = DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS;
36
36
  export const useDataGridPremiumProps = inProps => {
37
- const themedProps = useProps(
37
+ const themedProps =
38
38
  // eslint-disable-next-line material-ui/mui-name-matches-component-name
39
39
  useThemeProps({
40
40
  props: inProps,
41
41
  name: 'MuiDataGrid'
42
- }));
42
+ });
43
43
  const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
44
44
  const slots = React.useMemo(() => computeSlots({
45
45
  defaultSlots,
46
46
  slots: themedProps.slots
47
47
  }), [themedProps.slots]);
48
- return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
48
+ return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps.unstable_dataSource ? {
49
+ aggregationFunctions: {}
50
+ } : {}, themedProps, {
49
51
  localeText,
50
52
  slots
51
53
  }, getDataGridPremiumForcedProps(themedProps)), [themedProps, localeText, slots]);
@@ -12,7 +12,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const GridAggregationHeaderRoot = styled('div', {
13
13
  name: 'MuiDataGrid',
14
14
  slot: 'AggregationColumnHeader',
15
- overridesResolver: (_, styles) => styles.aggregationColumnHeader
15
+ overridesResolver: (props, styles) => {
16
+ const {
17
+ ownerState
18
+ } = props;
19
+ return [styles.aggregationColumnHeader, ownerState.colDef.headerAlign === 'left' && styles['aggregationColumnHeader--alignLeft'], ownerState.colDef.headerAlign === 'center' && styles['aggregationColumnHeader--alignCenter'], ownerState.colDef.headerAlign === 'right' && styles['aggregationColumnHeader--alignRight']];
20
+ }
16
21
  })({
17
22
  display: 'flex',
18
23
  flexDirection: 'column',
@@ -1,11 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
2
  import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
3
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
+ const _excluded = ["native"];
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import { useGridSelector } from '@mui/x-data-grid-pro';
7
- import ListItemIcon from '@mui/material/ListItemIcon';
8
- import ListItemText from '@mui/material/ListItemText';
9
8
  import FormControl from '@mui/material/FormControl';
10
9
  import InputLabel from '@mui/material/InputLabel';
11
10
  import { unstable_useId as useId } from '@mui/utils';
@@ -14,18 +13,27 @@ import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
14
13
  import { canColumnHaveAggregationFunction, getAggregationFunctionLabel, getAvailableAggregationFunctions } from "../hooks/features/aggregation/gridAggregationUtils.js";
15
14
  import { gridAggregationModelSelector } from "../hooks/features/aggregation/gridAggregationSelectors.js";
16
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ import { createElement as _createElement } from "react";
17
17
  function GridColumnMenuAggregationItem(props) {
18
18
  const {
19
19
  colDef
20
20
  } = props;
21
21
  const apiRef = useGridApiContext();
22
+ const inputRef = React.useRef(null);
22
23
  const rootProps = useGridRootProps();
23
24
  const id = useId();
24
25
  const aggregationModel = useGridSelector(apiRef, gridAggregationModelSelector);
25
26
  const availableAggregationFunctions = React.useMemo(() => getAvailableAggregationFunctions({
26
27
  aggregationFunctions: rootProps.aggregationFunctions,
27
- colDef
28
- }), [colDef, rootProps.aggregationFunctions]);
28
+ colDef,
29
+ isDataSource: !!rootProps.unstable_dataSource
30
+ }), [colDef, rootProps.aggregationFunctions, rootProps.unstable_dataSource]);
31
+ const _ref = rootProps.slotProps?.baseSelect || {},
32
+ {
33
+ native: isBaseSelectNative = false
34
+ } = _ref,
35
+ baseSelectProps = _objectWithoutPropertiesLoose(_ref, _excluded);
36
+ const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
29
37
  const selectedAggregationRule = React.useMemo(() => {
30
38
  if (!colDef || !aggregationModel[colDef.field]) {
31
39
  return '';
@@ -34,12 +42,13 @@ function GridColumnMenuAggregationItem(props) {
34
42
  if (canColumnHaveAggregationFunction({
35
43
  colDef,
36
44
  aggregationFunctionName,
37
- aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName]
45
+ aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName],
46
+ isDataSource: !!rootProps.unstable_dataSource
38
47
  })) {
39
48
  return aggregationFunctionName;
40
49
  }
41
50
  return '';
42
- }, [rootProps.aggregationFunctions, aggregationModel, colDef]);
51
+ }, [rootProps.aggregationFunctions, rootProps.unstable_dataSource, aggregationModel, colDef]);
43
52
  const handleAggregationItemChange = event => {
44
53
  const newAggregationItem = event.target?.value || undefined;
45
54
  const currentModel = gridAggregationModelSelector(apiRef);
@@ -52,47 +61,66 @@ function GridColumnMenuAggregationItem(props) {
52
61
  apiRef.current.hideColumnMenu();
53
62
  };
54
63
  const label = apiRef.current.getLocaleText('aggregationMenuItemHeader');
55
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
56
- disableRipple: true,
57
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
58
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
59
- fontSize: "small"
60
- })
61
- }), /*#__PURE__*/_jsx(ListItemText, {
62
- children: /*#__PURE__*/_jsxs(FormControl, {
63
- size: "small",
64
- fullWidth: true,
65
- sx: {
66
- minWidth: 150
64
+ const handleMenuItemKeyDown = React.useCallback(event => {
65
+ if (event.key === 'Enter' || event.key === ' ') {
66
+ inputRef.current.focus();
67
+ }
68
+ }, []);
69
+ const handleSelectKeyDown = React.useCallback(event => {
70
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === ' ') {
71
+ event.stopPropagation();
72
+ }
73
+ }, []);
74
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
75
+ inert: true,
76
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
77
+ fontSize: "small"
78
+ }),
79
+ onKeyDown: handleMenuItemKeyDown,
80
+ children: /*#__PURE__*/_jsxs(FormControl, {
81
+ size: "small",
82
+ fullWidth: true,
83
+ sx: {
84
+ minWidth: 150
85
+ },
86
+ children: [/*#__PURE__*/_jsx(InputLabel, {
87
+ id: `${id}-label`,
88
+ htmlFor: `${id}-input`,
89
+ children: label
90
+ }), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
91
+ labelId: `${id}-label`,
92
+ inputRef: inputRef,
93
+ id: `${id}-input`,
94
+ value: selectedAggregationRule,
95
+ label: label,
96
+ color: "primary",
97
+ onChange: handleAggregationItemChange,
98
+ MenuProps: {
99
+ PaperProps: {
100
+ onKeyDown: handleSelectKeyDown
101
+ }
67
102
  },
68
- children: [/*#__PURE__*/_jsx(InputLabel, {
69
- id: `${id}-label`,
70
- children: label
71
- }), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, {
72
- labelId: `${id}-label`,
73
- id: `${id}-input`,
74
- value: selectedAggregationRule,
75
- label: label,
76
- color: "primary",
77
- onChange: handleAggregationItemChange,
78
- onBlur: event => event.stopPropagation(),
79
- fullWidth: true,
80
- children: [/*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
81
- value: "",
82
- children: "..."
83
- }), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
84
- value: aggFunc,
85
- children: getAggregationFunctionLabel({
86
- apiRef,
87
- aggregationRule: {
88
- aggregationFunctionName: aggFunc,
89
- aggregationFunction: rootProps.aggregationFunctions[aggFunc]
90
- }
91
- })
92
- }, aggFunc))]
93
- })]
94
- })
95
- })]
103
+ onBlur: event => event.stopPropagation(),
104
+ native: isBaseSelectNative,
105
+ fullWidth: true
106
+ }, baseSelectProps, {
107
+ children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
108
+ native: isBaseSelectNative,
109
+ value: "",
110
+ children: "..."
111
+ })), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
112
+ key: aggFunc,
113
+ value: aggFunc,
114
+ native: isBaseSelectNative
115
+ }), getAggregationFunctionLabel({
116
+ apiRef,
117
+ aggregationRule: {
118
+ aggregationFunctionName: aggFunc,
119
+ aggregationFunction: rootProps.aggregationFunctions[aggFunc]
120
+ }
121
+ })))]
122
+ }))]
123
+ })
96
124
  });
97
125
  }
98
126
  process.env.NODE_ENV !== "production" ? GridColumnMenuAggregationItem.propTypes = {