@mui/x-data-grid-premium 6.0.0-beta.4 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +204 -29
  2. package/DataGridPremium/DataGridPremium.js +21 -4
  3. package/DataGridPremium/useDataGridPremiumComponent.js +1 -1
  4. package/DataGridPremium/useDataGridPremiumProps.js +26 -19
  5. package/components/GridAggregationHeader.js +3 -2
  6. package/components/GridColumnMenuAggregationItem.js +1 -1
  7. package/components/GridColumnMenuRowGroupItem.js +1 -1
  8. package/components/GridColumnMenuRowUngroupItem.js +2 -2
  9. package/components/GridExcelExportMenuItem.js +2 -1
  10. package/components/GridFooterCell.js +1 -3
  11. package/components/GridGroupingCriteriaCell.js +4 -4
  12. package/components/index.d.ts +1 -1
  13. package/components/index.js +1 -1
  14. package/constants/dataGridPremiumDefaultSlotsComponents.d.ts +1 -2
  15. package/constants/dataGridPremiumDefaultSlotsComponents.js +2 -7
  16. package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +2 -0
  17. package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
  18. package/hooks/features/export/gridExcelExportInterface.d.ts +11 -0
  19. package/hooks/features/export/index.d.ts +1 -0
  20. package/hooks/features/export/index.js +2 -1
  21. package/hooks/features/export/serializer/excelSerializer.d.ts +52 -3
  22. package/hooks/features/export/serializer/excelSerializer.js +137 -51
  23. package/hooks/features/export/useGridExcelExport.d.ts +2 -1
  24. package/hooks/features/export/useGridExcelExport.js +67 -12
  25. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  26. package/index.d.ts +1 -0
  27. package/index.js +2 -1
  28. package/legacy/DataGridPremium/DataGridPremium.js +21 -4
  29. package/legacy/DataGridPremium/useDataGridPremiumComponent.js +1 -1
  30. package/legacy/DataGridPremium/useDataGridPremiumProps.js +21 -20
  31. package/legacy/components/GridAggregationHeader.js +3 -2
  32. package/legacy/components/GridColumnMenuAggregationItem.js +1 -1
  33. package/legacy/components/GridColumnMenuRowGroupItem.js +1 -1
  34. package/legacy/components/GridColumnMenuRowUngroupItem.js +2 -2
  35. package/legacy/components/GridExcelExportMenuItem.js +2 -1
  36. package/legacy/components/GridFooterCell.js +1 -3
  37. package/legacy/components/GridGroupingCriteriaCell.js +4 -4
  38. package/legacy/components/index.js +1 -1
  39. package/legacy/constants/dataGridPremiumDefaultSlotsComponents.js +2 -7
  40. package/legacy/hooks/features/export/index.js +2 -1
  41. package/legacy/hooks/features/export/serializer/excelSerializer.js +227 -72
  42. package/legacy/hooks/features/export/useGridExcelExport.js +125 -36
  43. package/legacy/index.js +2 -1
  44. package/legacy/material/index.js +9 -0
  45. package/legacy/utils/releaseInfo.js +1 -1
  46. package/material/index.d.ts +7 -0
  47. package/material/index.js +9 -0
  48. package/material/package.json +6 -0
  49. package/models/dataGridPremiumProps.d.ts +13 -3
  50. package/models/gridPremiumSlotsComponent.d.ts +4 -1
  51. package/modern/DataGridPremium/DataGridPremium.js +21 -4
  52. package/modern/DataGridPremium/useDataGridPremiumComponent.js +1 -1
  53. package/modern/DataGridPremium/useDataGridPremiumProps.js +21 -17
  54. package/modern/components/GridAggregationHeader.js +3 -2
  55. package/modern/components/GridColumnMenuAggregationItem.js +1 -1
  56. package/modern/components/GridColumnMenuRowGroupItem.js +1 -1
  57. package/modern/components/GridColumnMenuRowUngroupItem.js +2 -2
  58. package/modern/components/GridExcelExportMenuItem.js +2 -1
  59. package/modern/components/GridFooterCell.js +1 -3
  60. package/modern/components/GridGroupingCriteriaCell.js +3 -3
  61. package/modern/components/index.js +1 -1
  62. package/modern/constants/dataGridPremiumDefaultSlotsComponents.js +2 -7
  63. package/modern/hooks/features/export/index.js +2 -1
  64. package/modern/hooks/features/export/serializer/excelSerializer.js +131 -47
  65. package/modern/hooks/features/export/useGridExcelExport.js +67 -12
  66. package/modern/index.js +2 -1
  67. package/modern/material/index.js +9 -0
  68. package/modern/utils/releaseInfo.js +1 -1
  69. package/node/DataGridPremium/DataGridPremium.js +19 -2
  70. package/node/DataGridPremium/useDataGridPremiumComponent.js +1 -1
  71. package/node/DataGridPremium/useDataGridPremiumProps.js +21 -17
  72. package/node/components/GridAggregationHeader.js +3 -2
  73. package/node/components/GridColumnMenuAggregationItem.js +1 -1
  74. package/node/components/GridColumnMenuRowGroupItem.js +1 -1
  75. package/node/components/GridColumnMenuRowUngroupItem.js +2 -2
  76. package/node/components/GridExcelExportMenuItem.js +2 -1
  77. package/node/components/GridFooterCell.js +1 -3
  78. package/node/components/GridGroupingCriteriaCell.js +3 -3
  79. package/node/components/index.js +1 -1
  80. package/node/constants/dataGridPremiumDefaultSlotsComponents.js +3 -9
  81. package/node/hooks/features/export/index.js +12 -1
  82. package/node/hooks/features/export/serializer/excelSerializer.js +136 -45
  83. package/node/hooks/features/export/useGridExcelExport.js +66 -10
  84. package/node/index.js +9 -1
  85. package/node/material/index.js +17 -0
  86. package/node/utils/releaseInfo.js +1 -1
  87. package/package.json +4 -4
  88. package/typeOverloads/modules.d.ts +6 -0
  89. package/utils/releaseInfo.js +1 -1
  90. /package/legacy/{components → material}/icons.js +0 -0
  91. /package/{components → material}/icons.d.ts +0 -0
  92. /package/{components → material}/icons.js +0 -0
  93. /package/modern/{components → material}/icons.js +0 -0
  94. /package/node/{components → material}/icons.js +0 -0
@@ -1,10 +1,12 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ var _excluded = ["worker", "exceljsPostProcess", "exceljsPreProcess", "columnsStyles", "includeHeaders", "getRowsToExport", "valueOptionsSheetName"];
3
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
6
  import * as React from 'react';
5
- import { useGridApiMethod, useGridLogger } from '@mui/x-data-grid';
7
+ import { useGridApiMethod, useGridLogger, useGridApiOptionHandler } from '@mui/x-data-grid';
6
8
  import { useGridRegisterPipeProcessor, exportAs, getColumnsToExport, defaultGetRowsToExport } from '@mui/x-data-grid/internals';
7
- import { buildExcel } from './serializer/excelSerializer';
9
+ import { buildExcel, getDataForValueOptionsSheet, serializeColumns, serializeRow } from './serializer/excelSerializer';
8
10
  import { GridExcelExportMenuItem } from '../../../components';
9
11
 
10
12
  /**
@@ -15,7 +17,7 @@ import { GridExcelExportMenuItem } from '../../../components';
15
17
  * @requires useGridParamsApi (method)
16
18
  */
17
19
  import { jsx as _jsx } from "react/jsx-runtime";
18
- export var useGridExcelExport = function useGridExcelExport(apiRef) {
20
+ export var useGridExcelExport = function useGridExcelExport(apiRef, props) {
19
21
  var logger = useGridLogger(apiRef, 'useGridExcelExport');
20
22
  var getDataAsExcel = React.useCallback(function () {
21
23
  var _options$getRowsToExp, _options$includeHeade, _options$includeColum;
@@ -40,43 +42,129 @@ export var useGridExcelExport = function useGridExcelExport(apiRef) {
40
42
  exceljsPostProcess: options == null ? void 0 : options.exceljsPostProcess
41
43
  }, apiRef.current);
42
44
  }, [logger, apiRef]);
43
- var exportDataAsExcel = React.useCallback( /*#__PURE__*/function () {
44
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
45
- var workbook, content, blob;
46
- return _regeneratorRuntime.wrap(function _callee$(_context) {
47
- while (1) {
48
- switch (_context.prev = _context.next) {
49
- case 0:
50
- logger.debug("Export data as excel");
51
- _context.next = 3;
52
- return getDataAsExcel(options);
53
- case 3:
54
- workbook = _context.sent;
55
- if (!(workbook === null)) {
56
- _context.next = 6;
57
- break;
58
- }
59
- return _context.abrupt("return");
60
- case 6:
61
- _context.next = 8;
62
- return workbook.xlsx.writeBuffer();
63
- case 8:
64
- content = _context.sent;
65
- blob = new Blob([content], {
45
+ var exportDataAsExcel = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
46
+ var options,
47
+ workerFn,
48
+ exceljsPostProcess,
49
+ exceljsPreProcess,
50
+ columnsStyles,
51
+ includeHeaders,
52
+ _options$getRowsToExp2,
53
+ getRowsToExport,
54
+ _options$valueOptions,
55
+ valueOptionsSheetName,
56
+ cloneableOptions,
57
+ sendExcelToUser,
58
+ workbook,
59
+ content,
60
+ worker,
61
+ exportedRowIds,
62
+ exportedColumns,
63
+ valueOptionsData,
64
+ serializedColumns,
65
+ serializedRows,
66
+ columnGroupPaths,
67
+ message,
68
+ _args2 = arguments;
69
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
70
+ while (1) {
71
+ switch (_context2.prev = _context2.next) {
72
+ case 0:
73
+ options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
74
+ workerFn = options.worker, exceljsPostProcess = options.exceljsPostProcess, exceljsPreProcess = options.exceljsPreProcess, columnsStyles = options.columnsStyles, includeHeaders = options.includeHeaders, _options$getRowsToExp2 = options.getRowsToExport, getRowsToExport = _options$getRowsToExp2 === void 0 ? defaultGetRowsToExport : _options$getRowsToExp2, _options$valueOptions = options.valueOptionsSheetName, valueOptionsSheetName = _options$valueOptions === void 0 ? 'Options' : _options$valueOptions, cloneableOptions = _objectWithoutProperties(options, _excluded);
75
+ sendExcelToUser = function sendExcelToUser(buffer) {
76
+ var blob = new Blob([buffer], {
66
77
  type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
67
78
  });
68
79
  exportAs(blob, 'xlsx', options == null ? void 0 : options.fileName);
69
- case 11:
70
- case "end":
71
- return _context.stop();
72
- }
80
+ };
81
+ if (workerFn) {
82
+ _context2.next = 16;
83
+ break;
84
+ }
85
+ apiRef.current.publishEvent('excelExportStateChange', 'pending');
86
+ _context2.next = 7;
87
+ return getDataAsExcel(options);
88
+ case 7:
89
+ workbook = _context2.sent;
90
+ if (!(workbook === null)) {
91
+ _context2.next = 10;
92
+ break;
93
+ }
94
+ return _context2.abrupt("return");
95
+ case 10:
96
+ _context2.next = 12;
97
+ return workbook.xlsx.writeBuffer();
98
+ case 12:
99
+ content = _context2.sent;
100
+ apiRef.current.publishEvent('excelExportStateChange', 'finished');
101
+ sendExcelToUser(content);
102
+ return _context2.abrupt("return");
103
+ case 16:
104
+ if (exceljsPostProcess && process.env.NODE_ENV !== 'production') {
105
+ console.warn(["MUI: The exceljsPostProcess option is not supported when a web worker is used.", 'As alternative, pass the callback to the same option in setupExcelExportWebWorker.'].join('\n'));
106
+ }
107
+ if (exceljsPreProcess && process.env.NODE_ENV !== 'production') {
108
+ console.warn(["MUI: The exceljsPreProcess option is not supported when a web worker is used.", 'As alternative, pass the callback to the same option in setupExcelExportWebWorker.'].join('\n'));
109
+ }
110
+ worker = workerFn();
111
+ apiRef.current.publishEvent('excelExportStateChange', 'pending');
112
+ worker.onmessage = /*#__PURE__*/function () {
113
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
114
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
115
+ while (1) {
116
+ switch (_context.prev = _context.next) {
117
+ case 0:
118
+ sendExcelToUser(event.data);
119
+ apiRef.current.publishEvent('excelExportStateChange', 'finished');
120
+ worker.terminate();
121
+ case 3:
122
+ case "end":
123
+ return _context.stop();
124
+ }
125
+ }
126
+ }, _callee);
127
+ }));
128
+ return function (_x) {
129
+ return _ref2.apply(this, arguments);
130
+ };
131
+ }();
132
+ exportedRowIds = getRowsToExport({
133
+ apiRef: apiRef
134
+ });
135
+ exportedColumns = getColumnsToExport({
136
+ apiRef: apiRef,
137
+ options: options
138
+ });
139
+ _context2.next = 25;
140
+ return getDataForValueOptionsSheet(exportedColumns, valueOptionsSheetName, apiRef.current);
141
+ case 25:
142
+ valueOptionsData = _context2.sent;
143
+ serializedColumns = serializeColumns(exportedColumns, options.columnsStyles || {});
144
+ serializedRows = exportedRowIds.map(function (id) {
145
+ return serializeRow(id, exportedColumns, apiRef.current, valueOptionsData);
146
+ });
147
+ columnGroupPaths = exportedColumns.reduce(function (acc, column) {
148
+ acc[column.field] = apiRef.current.unstable_getColumnGroupPath(column.field);
149
+ return acc;
150
+ }, {});
151
+ message = {
152
+ serializedColumns: serializedColumns,
153
+ serializedRows: serializedRows,
154
+ valueOptionsData: valueOptionsData,
155
+ columnGroupPaths: columnGroupPaths,
156
+ columnGroupDetails: apiRef.current.unstable_getAllGroupDetails(),
157
+ options: cloneableOptions,
158
+ valueOptionsSheetName: valueOptionsSheetName
159
+ };
160
+ worker.postMessage(message);
161
+ case 31:
162
+ case "end":
163
+ return _context2.stop();
73
164
  }
74
- }, _callee);
75
- }));
76
- return function (_x) {
77
- return _ref.apply(this, arguments);
78
- };
79
- }(), [logger, getDataAsExcel]);
165
+ }
166
+ }, _callee2);
167
+ })), [apiRef, getDataAsExcel]);
80
168
  var excelExportApi = {
81
169
  getDataAsExcel: getDataAsExcel,
82
170
  exportDataAsExcel: exportDataAsExcel
@@ -99,4 +187,5 @@ export var useGridExcelExport = function useGridExcelExport(apiRef) {
99
187
  }]);
100
188
  }, []);
101
189
  useGridRegisterPipeProcessor(apiRef, 'exportMenu', addExportMenuButtons);
190
+ useGridApiOptionHandler(apiRef, 'excelExportStateChange', props.onExcelExportStateChange);
102
191
  };
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-premium v6.0.0-beta.4
2
+ * @mui/x-data-grid-premium v6.0.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -23,5 +23,6 @@ export * from './DataGridPremium';
23
23
  export * from './hooks';
24
24
  export * from './models';
25
25
  export * from './components';
26
+ export { GridColumnHeaders } from '@mui/x-data-grid-pro';
26
27
  export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
27
28
  export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexports';
@@ -0,0 +1,9 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon } from './icons';
3
+ var iconsSlots = {
4
+ ColumnMenuUngroupIcon: GridWorkspacesIcon,
5
+ ColumnMenuGroupIcon: GridGroupWorkIcon,
6
+ ColumnMenuAggregationIcon: GridFunctionsIcon
7
+ };
8
+ var materialSlots = _extends({}, iconsSlots);
9
+ export default materialSlots;
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export var getReleaseInfo = function getReleaseInfo() {
3
- var releaseInfo = "MTY3NjQ5ODQwMDAwMA==";
3
+ var releaseInfo = "MTY3Nzc5ODAwMDAwMA==";
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
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare const materialSlots: {
3
+ ColumnMenuUngroupIcon: import("react").JSXElementConstructor<any>;
4
+ ColumnMenuGroupIcon: import("react").JSXElementConstructor<any>;
5
+ ColumnMenuAggregationIcon: import("react").JSXElementConstructor<any>;
6
+ };
7
+ export default materialSlots;
@@ -0,0 +1,9 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon } from './icons';
3
+ const iconsSlots = {
4
+ ColumnMenuUngroupIcon: GridWorkspacesIcon,
5
+ ColumnMenuGroupIcon: GridGroupWorkIcon,
6
+ ColumnMenuAggregationIcon: GridFunctionsIcon
7
+ };
8
+ const materialSlots = _extends({}, iconsSlots);
9
+ export default materialSlots;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/material/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -3,7 +3,7 @@ import { GridCallbackDetails, GridValidRowModel, GridGroupNode } from '@mui/x-da
3
3
  import { GridExperimentalProFeatures, DataGridProPropsWithDefaultValue, DataGridProPropsWithoutDefaultValue, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing } from '@mui/x-data-grid-pro/internals';
4
4
  import type { GridRowGroupingModel } from '../hooks/features/rowGrouping';
5
5
  import type { GridAggregationModel, GridAggregationFunction, GridAggregationPosition } from '../hooks/features/aggregation';
6
- import { GridPremiumSlotsComponent } from './gridPremiumSlotsComponent';
6
+ import { GridPremiumSlotsComponent, UncapitalizedGridPremiumSlotsComponent } from './gridPremiumSlotsComponent';
7
7
  import { GridInitialStatePremium } from './gridStatePremium';
8
8
  import { GridApiPremium } from './gridApiPremium';
9
9
  import { GridCellSelectionModel } from '../hooks/features/cellSelection';
@@ -12,8 +12,13 @@ export interface GridExperimentalPremiumFeatures extends GridExperimentalProFeat
12
12
  export interface DataGridPremiumPropsWithComplexDefaultValueBeforeProcessing extends Pick<DataGridPropsWithComplexDefaultValueBeforeProcessing, 'localeText'> {
13
13
  /**
14
14
  * Overrideable components.
15
+ * @deprecated Use the `slots` prop instead.
15
16
  */
16
17
  components?: Partial<GridPremiumSlotsComponent>;
18
+ /**
19
+ * Overrideable components.
20
+ */
21
+ slots?: Partial<UncapitalizedGridPremiumSlotsComponent>;
17
22
  }
18
23
  /**
19
24
  * The props users can give to the `DataGridPremiumProps` component.
@@ -26,12 +31,12 @@ export interface DataGridPremiumProps<R extends GridValidRowModel = any> extends
26
31
  experimentalFeatures?: Partial<GridExperimentalPremiumFeatures>;
27
32
  }
28
33
  export interface DataGridPremiumPropsWithComplexDefaultValueAfterProcessing extends Pick<DataGridPropsWithComplexDefaultValueAfterProcessing, 'localeText'> {
29
- components: GridPremiumSlotsComponent;
34
+ slots: UncapitalizedGridPremiumSlotsComponent;
30
35
  }
31
36
  /**
32
37
  * The props of the `DataGridPremium` component after the pre-processing phase.
33
38
  */
34
- export interface DataGridPremiumProcessedProps extends DataGridPremiumPropsWithDefaultValue, DataGridPremiumPropsWithComplexDefaultValueAfterProcessing, DataGridPremiumPropsWithoutDefaultValue {
39
+ export interface DataGridPremiumProcessedProps extends DataGridPremiumPropsWithDefaultValue, DataGridPremiumPropsWithComplexDefaultValueAfterProcessing, Omit<DataGridPremiumPropsWithoutDefaultValue, 'componentsProps'> {
35
40
  }
36
41
  export type DataGridPremiumForcedPropsKey = 'signature';
37
42
  /**
@@ -122,4 +127,9 @@ export interface DataGridPremiumPropsWithoutDefaultValue<R extends GridValidRowM
122
127
  * @param {GridCallbackDetails} details Additional details for this callback.
123
128
  */
124
129
  unstable_onCellSelectionModelChange?: (cellSelectionModel: GridCellSelectionModel, details: GridCallbackDetails) => void;
130
+ /**
131
+ * Callback fired when the state of the Excel export changes.
132
+ * @param {string} inProgress Indicates if the task is in progress.
133
+ */
134
+ onExcelExportStateChange?: (inProgress: 'pending' | 'finished') => void;
125
135
  }
@@ -1,4 +1,5 @@
1
- import { GridProSlotsComponent } from '@mui/x-data-grid-pro';
1
+ import { GridProSlotsComponent, UncapitalizedGridProSlotsComponent } from '@mui/x-data-grid-pro';
2
+ import { UncapitalizeObjectKeys } from '@mui/x-data-grid-pro/internals';
2
3
  import { GridPremiumIconSlotsComponent } from './gridPremiumIconSlotsComponent';
3
4
  /**
4
5
  * Grid components React prop interface containing all the overridable components
@@ -6,3 +7,5 @@ import { GridPremiumIconSlotsComponent } from './gridPremiumIconSlotsComponent';
6
7
  */
7
8
  export interface GridPremiumSlotsComponent extends GridProSlotsComponent, GridPremiumIconSlotsComponent {
8
9
  }
10
+ export interface UncapitalizedGridPremiumSlotsComponent extends UncapitalizedGridProSlotsComponent, UncapitalizeObjectKeys<GridPremiumIconSlotsComponent> {
11
+ }
@@ -2,8 +2,8 @@ import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
4
4
  import { chainPropTypes } from '@mui/utils';
5
- import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider } from '@mui/x-data-grid-pro';
6
- import { DataGridProVirtualScroller, DataGridProColumnHeaders } from '@mui/x-data-grid-pro/internals';
5
+ import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider, useGridSelector, gridPinnedColumnsSelector } from '@mui/x-data-grid-pro';
6
+ import { DataGridProVirtualScroller } from '@mui/x-data-grid-pro/internals';
7
7
  import { useDataGridPremiumComponent } from './useDataGridPremiumComponent';
8
8
  import { useDataGridPremiumProps } from './useDataGridPremiumProps';
9
9
  import { getReleaseInfo } from '../utils/releaseInfo';
@@ -14,6 +14,7 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
14
14
  const props = useDataGridPremiumProps(inProps);
15
15
  const privateApiRef = useDataGridPremiumComponent(props.apiRef, props);
16
16
  useLicenseVerifier('x-data-grid-premium', releaseInfo);
17
+ const pinnedColumns = useGridSelector(privateApiRef, gridPinnedColumnsSelector);
17
18
  return /*#__PURE__*/_jsx(GridContextProvider, {
18
19
  privateApiRef: privateApiRef,
19
20
  props: props,
@@ -23,8 +24,10 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
23
24
  sx: props.sx,
24
25
  ref: ref,
25
26
  children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
26
- ColumnHeadersComponent: DataGridProColumnHeaders,
27
27
  VirtualScrollerComponent: DataGridProVirtualScroller,
28
+ ColumnHeadersProps: {
29
+ pinnedColumns
30
+ },
28
31
  children: /*#__PURE__*/_jsx(Watermark, {
29
32
  packageName: "x-data-grid-premium",
30
33
  releaseInfo: releaseInfo
@@ -130,10 +133,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
130
133
  columnVisibilityModel: PropTypes.object,
131
134
  /**
132
135
  * Overrideable components.
136
+ * @deprecated Use the `slots` prop instead.
133
137
  */
134
138
  components: PropTypes.object,
135
139
  /**
136
140
  * Overrideable components props dynamically passed to the component at rendering.
141
+ * @deprecated Use the `slotProps` prop instead.
137
142
  */
138
143
  componentsProps: PropTypes.object,
139
144
  /**
@@ -243,7 +248,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
243
248
  experimentalFeatures: PropTypes.shape({
244
249
  columnGrouping: PropTypes.bool,
245
250
  lazyLoading: PropTypes.bool,
246
- rowPinning: PropTypes.bool,
247
251
  warnIfFocusStateIsNotSynced: PropTypes.bool
248
252
  }),
249
253
  /**
@@ -552,6 +556,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
552
556
  * @param {GridCallbackDetails} details Additional details for this callback.
553
557
  */
554
558
  onDetailPanelExpandedRowIdsChange: PropTypes.func,
559
+ /**
560
+ * Callback fired when the state of the Excel export changes.
561
+ * @param {string} inProgress Indicates if the task is in progress.
562
+ */
563
+ onExcelExportStateChange: PropTypes.func,
555
564
  /**
556
565
  * Callback fired when rowCount is set and the next batch of virtualized rows is rendered.
557
566
  * @param {GridFetchRowsParams} params With all properties from [[GridFetchRowsParams]].
@@ -825,6 +834,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
825
834
  * @default false
826
835
  */
827
836
  showColumnVerticalBorder: PropTypes.bool,
837
+ /**
838
+ * Overrideable components props dynamically passed to the component at rendering.
839
+ */
840
+ slotProps: PropTypes.object,
841
+ /**
842
+ * Overrideable components.
843
+ */
844
+ slots: PropTypes.object,
828
845
  /**
829
846
  * Sorting can be processed on the server or client-side.
830
847
  * Set it to 'client' if you would like to handle sorting on the client-side.
@@ -80,7 +80,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
80
80
  useGridColumnMenu(privateApiRef);
81
81
  useGridCsvExport(privateApiRef);
82
82
  useGridPrintExport(privateApiRef, props);
83
- useGridExcelExport(privateApiRef);
83
+ useGridExcelExport(privateApiRef, props);
84
84
  useGridClipboard(privateApiRef);
85
85
  useGridDimensions(privateApiRef, props);
86
86
  useGridEvents(privateApiRef, props);
@@ -1,7 +1,10 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
1
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["components", "componentsProps"];
2
4
  import * as React from 'react';
3
5
  import { useThemeProps } from '@mui/material/styles';
4
6
  import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT } from '@mui/x-data-grid-pro';
7
+ import { computeSlots, uncapitalizeObjectKeys } from '@mui/x-data-grid-pro/internals';
5
8
  import { GRID_AGGREGATION_FUNCTIONS } from '../hooks/features/aggregation';
6
9
  import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridPremiumDefaultSlotsComponents';
7
10
 
@@ -17,26 +20,27 @@ export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO
17
20
  aggregationRowsScope: 'filtered',
18
21
  getAggregationPosition: groupNode => groupNode.depth === -1 ? 'footer' : 'inline'
19
22
  });
23
+ const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS);
20
24
  export const useDataGridPremiumProps = inProps => {
21
- const themedProps = useThemeProps({
22
- props: inProps,
23
- name: 'MuiDataGrid'
24
- });
25
+ const _useThemeProps = useThemeProps({
26
+ props: inProps,
27
+ name: 'MuiDataGrid'
28
+ }),
29
+ {
30
+ components,
31
+ componentsProps
32
+ } = _useThemeProps,
33
+ themedProps = _objectWithoutPropertiesLoose(_useThemeProps, _excluded);
25
34
  const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
26
- const components = React.useMemo(() => {
27
- const overrides = themedProps.components;
28
- if (!overrides) {
29
- return _extends({}, DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS);
30
- }
31
- const mergedComponents = {};
32
- Object.entries(DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS).forEach(([key, defaultComponent]) => {
33
- mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
34
- });
35
- return mergedComponents;
36
- }, [themedProps.components]);
35
+ const slots = React.useMemo(() => computeSlots({
36
+ defaultSlots,
37
+ components,
38
+ slots: themedProps.slots
39
+ }), [components, themedProps.slots]);
37
40
  return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
41
+ slotProps: themedProps.slotProps ?? componentsProps,
38
42
  localeText,
39
- components,
43
+ slots,
40
44
  signature: 'DataGridPremium'
41
- }), [themedProps, localeText, components]);
45
+ }), [themedProps, componentsProps, localeText, slots]);
42
46
  };
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import * as React from 'react';
2
3
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
3
4
  import Box from '@mui/material/Box';
@@ -56,10 +57,10 @@ function GridAggregationHeader(props) {
56
57
  } = props;
57
58
  const apiRef = useGridApiContext();
58
59
  const rootProps = useGridRootProps();
59
- const ownerState = {
60
+ const ownerState = _extends({}, rootProps, {
60
61
  classes: rootProps.classes,
61
62
  colDef
62
- };
63
+ });
63
64
  const classes = useUtilityClasses(ownerState);
64
65
  if (!aggregation) {
65
66
  return null;
@@ -58,7 +58,7 @@ function GridColumnMenuAggregationItem(props) {
58
58
  return /*#__PURE__*/_jsxs(MenuItem, {
59
59
  disableRipple: true,
60
60
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
61
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuAggregationIcon, {
61
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
62
62
  fontSize: "small"
63
63
  })
64
64
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -28,7 +28,7 @@ function GridColumnMenuRowGroupItem(props) {
28
28
  return /*#__PURE__*/_jsxs(MenuItem, {
29
29
  onClick: ungroupColumn,
30
30
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
31
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuUngroupIcon, {
31
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
32
32
  fontSize: "small"
33
33
  })
34
34
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -34,7 +34,7 @@ function GridColumnMenuRowUngroupItem(props) {
34
34
  return /*#__PURE__*/_jsxs(MenuItem, {
35
35
  onClick: ungroupColumn,
36
36
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
37
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuUngroupIcon, {
37
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
38
38
  fontSize: "small"
39
39
  })
40
40
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -45,7 +45,7 @@ function GridColumnMenuRowUngroupItem(props) {
45
45
  return /*#__PURE__*/_jsxs(MenuItem, {
46
46
  onClick: groupColumn,
47
47
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
48
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuGroupIcon, {
48
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
49
49
  fontSize: "small"
50
50
  })
51
51
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -39,7 +39,8 @@ process.env.NODE_ENV !== "production" ? GridExcelExportMenuItem.propTypes = {
39
39
  getRowsToExport: PropTypes.func,
40
40
  includeColumnGroupsHeaders: PropTypes.bool,
41
41
  includeHeaders: PropTypes.bool,
42
- valueOptionsSheetName: PropTypes.string
42
+ valueOptionsSheetName: PropTypes.string,
43
+ worker: PropTypes.func
43
44
  })
44
45
  } : void 0;
45
46
  export { GridExcelExportMenuItem };
@@ -33,9 +33,7 @@ function GridFooterCell(props) {
33
33
  } = props,
34
34
  other = _objectWithoutPropertiesLoose(props, _excluded);
35
35
  const rootProps = useGridRootProps();
36
- const ownerState = {
37
- classes: rootProps.classes
38
- };
36
+ const ownerState = rootProps;
39
37
  const classes = useUtilityClasses(ownerState);
40
38
  return /*#__PURE__*/_jsx(GridFooterCellRoot, _extends({
41
39
  ownerState: ownerState,
@@ -33,7 +33,7 @@ export function GridGroupingCriteriaCell(props) {
33
33
  const classes = useUtilityClasses(ownerState);
34
34
  const filteredDescendantCountLookup = useGridSelector(apiRef, gridFilteredDescendantCountLookupSelector);
35
35
  const filteredDescendantCount = filteredDescendantCountLookup[rowNode.id] ?? 0;
36
- const Icon = rowNode.childrenExpanded ? rootProps.components.GroupingCriteriaCollapseIcon : rootProps.components.GroupingCriteriaExpandIcon;
36
+ const Icon = rowNode.childrenExpanded ? rootProps.slots.groupingCriteriaCollapseIcon : rootProps.slots.groupingCriteriaExpandIcon;
37
37
  const handleKeyDown = event => {
38
38
  if (event.key === ' ') {
39
39
  // We call event.stopPropagation to avoid unfolding the row and also scrolling to bottom
@@ -68,13 +68,13 @@ export function GridGroupingCriteriaCell(props) {
68
68
  },
69
69
  children: [/*#__PURE__*/_jsx("div", {
70
70
  className: classes.toggle,
71
- children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
71
+ children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
72
72
  size: "small",
73
73
  onClick: handleClick,
74
74
  onKeyDown: handleKeyDown,
75
75
  tabIndex: -1,
76
76
  "aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand')
77
- }, rootProps.componentsProps?.baseIconButton, {
77
+ }, rootProps.slotProps?.baseIconButton, {
78
78
  children: /*#__PURE__*/_jsx(Icon, {
79
79
  fontSize: "inherit"
80
80
  })
@@ -1,4 +1,4 @@
1
1
  export * from './GridExcelExportMenuItem';
2
- export * from './icons';
2
+ export * from '../material/icons';
3
3
  export * from './GridColumnMenuAggregationItem';
4
4
  export { GridColumnMenuGroupingItem } from './GridPremiumColumnMenu';
@@ -1,12 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '@mui/x-data-grid-pro/internals';
3
- import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon } from '../components';
4
3
  import { GridPremiumColumnMenu } from '../components/GridPremiumColumnMenu';
5
- export const DEFAULT_GRID_PREMIUM_ICON_SLOTS_COMPONENTS = {
6
- ColumnMenuUngroupIcon: GridWorkspacesIcon,
7
- ColumnMenuGroupIcon: GridGroupWorkIcon,
8
- ColumnMenuAggregationIcon: GridFunctionsIcon
9
- };
10
- export const DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS, DEFAULT_GRID_PREMIUM_ICON_SLOTS_COMPONENTS, {
4
+ import materialSlots from '../material';
5
+ export const DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS, materialSlots, {
11
6
  ColumnMenu: GridPremiumColumnMenu
12
7
  });
@@ -1 +1,2 @@
1
- export * from './gridExcelExportInterface';
1
+ export * from './gridExcelExportInterface';
2
+ export { setupExcelExportWebWorker } from './serializer/excelSerializer';