@mui/x-data-grid-premium 7.11.0 → 7.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,90 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.11.1
7
+
8
+ _Jul 25, 2024_
9
+
10
+ We'd like to offer a big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🔎 Allow `Zoom` to be controllable for charts (#13858) @JCQuintas
13
+ - 🌍 Add Icelandic (is-IS) and Norwegian Nynorsk (nn-NO) locales on the Data Grid
14
+ - 🌍 Improve Norwegian Bokmål (nb-NO) and German (de-DE) locales on the Data Grid
15
+ - 🌍 Add Norwegian Nynorsk (nn-NO) locale on the Date and Time Pickers
16
+ - 🐞 Bugfixes
17
+ - 📚 Documentation improvements
18
+
19
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
20
+
21
+ ### Data Grid
22
+
23
+ #### `@mui/x-data-grid@7.11.1`
24
+
25
+ - [DataGrid] Remove dead code in internal `GridPreferencesPanel` (#13934) @k-rajat19
26
+ - [DataGrid] Do not miss to escape formulas in CSV export (#13888) @arminmeh
27
+ - [l10n] Add Icelandic (is-IS) locale (#13283) @magnimarels
28
+ - [l10n] Add Norwegian nynorsk (nn-NO) locale and improve Norwegian bokmål (nb-NO) locale (#13588) @AnderzL7
29
+ - [l10n] Improve German (de-DE) locale (#13910) @lhilgert9
30
+
31
+ #### `@mui/x-data-grid-pro@7.11.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
32
+
33
+ Same changes as in `@mui/x-data-grid@7.11.1`.
34
+
35
+ #### `@mui/x-data-grid-premium@7.11.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
36
+
37
+ Same changes as in `@mui/x-data-grid-pro@7.11.1`, plus:
38
+
39
+ - [DataGridPremium] Pass the `api` object to events (#13893) @pcorpet
40
+ - [DataGridPremium] Fix paste to selected cells (#13967) @romgrk
41
+
42
+ ### Date and Time Pickers
43
+
44
+ #### `@mui/x-date-pickers@7.11.1`
45
+
46
+ - [fields] Prevent keyboard editing when disabled (#13900) @arthurbalduini
47
+ - [l10n] Add Norwegian Nynorsk (nn-NO) locale (#13946) @AnderzL7
48
+
49
+ #### `@mui/x-date-pickers-pro@7.11.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
50
+
51
+ Same changes as in `@mui/x-date-pickers@7.11.1`.
52
+
53
+ ### Charts
54
+
55
+ #### `@mui/x-charts@7.11.1`
56
+
57
+ - [charts] Add `ownerState` function to `slotProps` typing when available (#13965) @alexfauquette
58
+ - [charts] Allow `Zoom` to be controllable (#13858) @JCQuintas
59
+ - [charts] Deprecate `xAxisKey` /`zAxisKey` in favor of `xAxisId`/`zAxisId` (#13940) @alexfauquette
60
+ - [charts] Hide empty arcs in the PieChart (#13897) @alexfauquette
61
+ - [charts] Limit the trigger of exit charts (#13682) @alexfauquette
62
+
63
+ ### Tree View
64
+
65
+ #### `@mui/x-tree-view@7.11.1`
66
+
67
+ - [TreeView] Allow the plugins to enrich the props passed to the item slots (#13953) @flaviendelangle
68
+
69
+ ### Docs
70
+
71
+ - [docs] Bump pnpm priority as a package manager (#13894) @oliviertassinari
72
+ - [docs] Explicitly mark charts pro as not released (#13905) @alexfauquette
73
+ - [docs] Fix dot consistency a11y table @oliviertassinari
74
+ - [docs] Fix some typos in charts docs (#13906) @cratiu222
75
+ - [docs] Fix spelling (#13902) @nnsW3
76
+ - [docs] Improve error message when moving between plans (#13874) @oliviertassinari
77
+ - [docs] Update `SparkLineChart` reference not being correctly capitalised (#13960) @duckboy81
78
+ - [docs] Fix scroll demos disorientation (#13909) @oliviertassinari
79
+
80
+ ### Core
81
+
82
+ - [core] Add `@mui/material-nextjs` to `MUI Core` renovate group (#13966) @LukasTy
83
+ - [core] Remove warning message in production (#13911) @oliviertassinari
84
+ - [code-infra] Reuse `useReactVersion` script from the monorepo (#13710) @cherniavskii
85
+ - [infra] Adds order id validation action (#13957) @michelengelen
86
+ - [infra] Fix order id validator action (#13971) @michelengelen
87
+ - [infra] Fix regex in order id validation (#13976) @michelengelen
88
+ - [infra] Issue template improvement (#13954) @michelengelen
89
+
6
90
  ## 7.11.0
7
91
 
8
92
  _Jul 18, 2024_
@@ -12,7 +12,7 @@ function DataGrid() {
12
12
  if (process.env.NODE_ENV === 'production') {
13
13
  return null;
14
14
  }
15
- throw new Error(["You try to import `DataGrid` from @mui/x-data-grid-premium but this module doesn't exist.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`."].join('\n'));
15
+ throw new Error(["You try to import `DataGrid` from @mui/x-data-grid-premium but this module isn't exported from this npm package.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`.", ''].join('\n'));
16
16
  }
17
17
 
18
18
  /**
@@ -22,5 +22,5 @@ function DataGridPro() {
22
22
  if (process.env.NODE_ENV === 'production') {
23
23
  return null;
24
24
  }
25
- throw new Error(["You try to import `DataGridPro` from @mui/x-data-grid-premium but this module doesn't exist.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`."].join('\n'));
25
+ throw new Error(["You try to import `DataGridPro` from @mui/x-data-grid-premium but this module isn't exported from this npm package.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`.", ''].join('\n'));
26
26
  }
@@ -15,7 +15,7 @@ var _dataGridPremiumDefaultSlotsComponents = require("../constants/dataGridPremi
15
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
17
  const getDataGridPremiumForcedProps = themedProps => (0, _extends2.default)({
18
- signature: 'DataGridPremium'
18
+ signature: _xDataGridPro.GridSignature.DataGridPremium
19
19
  }, themedProps.unstable_dataSource ? {
20
20
  filterMode: 'server',
21
21
  sortingMode: 'server',
@@ -5,7 +5,7 @@ export function DataGrid() {
5
5
  if (process.env.NODE_ENV === 'production') {
6
6
  return null;
7
7
  }
8
- throw new Error(["You try to import `DataGrid` from @mui/x-data-grid-premium but this module doesn't exist.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`."].join('\n'));
8
+ throw new Error(["You try to import `DataGrid` from @mui/x-data-grid-premium but this module isn't exported from this npm package.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`.", ''].join('\n'));
9
9
  }
10
10
 
11
11
  /**
@@ -15,5 +15,5 @@ export function DataGridPro() {
15
15
  if (process.env.NODE_ENV === 'production') {
16
16
  return null;
17
17
  }
18
- throw new Error(["You try to import `DataGridPro` from @mui/x-data-grid-premium but this module doesn't exist.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`."].join('\n'));
18
+ throw new Error(["You try to import `DataGridPro` from @mui/x-data-grid-premium but this module isn't exported from this npm package.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`.", ''].join('\n'));
19
19
  }
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
- import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT } from '@mui/x-data-grid-pro';
4
+ import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT, GridSignature } from '@mui/x-data-grid-pro';
5
5
  import { computeSlots, useProps } from '@mui/x-data-grid-pro/internals';
6
6
  import { GRID_AGGREGATION_FUNCTIONS } from '../hooks/features/aggregation';
7
7
  import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridPremiumDefaultSlotsComponents';
8
8
  const getDataGridPremiumForcedProps = themedProps => _extends({
9
- signature: 'DataGridPremium'
9
+ signature: GridSignature.DataGridPremium
10
10
  }, themedProps.unstable_dataSource ? {
11
11
  filterMode: 'server',
12
12
  sortingMode: 'server',
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { ownerDocument, useEventCallback } from '@mui/material/utils';
4
- import { getTotalHeaderHeight, isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor, useGridVisibleRows } from '@mui/x-data-grid-pro/internals';
4
+ import { getTotalHeaderHeight, getVisibleRows, isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor, useGridVisibleRows } from '@mui/x-data-grid-pro/internals';
5
5
  import { useGridApiEventHandler, useGridApiMethod, GRID_ACTIONS_COLUMN_TYPE, GRID_CHECKBOX_SELECTION_COL_DEF, GRID_DETAIL_PANEL_TOGGLE_FIELD, gridRowsDataRowIdToIdLookupSelector, gridClasses, gridFocusCellSelector, GRID_REORDER_COL_DEF, useGridSelector, gridSortedRowIdsSelector, gridDimensionsSelector } from '@mui/x-data-grid-pro';
6
6
  import { gridCellSelectionStateSelector } from './gridCellSelectionSelector';
7
7
  export const cellSelectionStateInitializer = (state, props) => _extends({}, state, {
@@ -88,15 +88,28 @@ export const useGridCellSelection = (apiRef, props) => {
88
88
  apiRef.current.setCellSelectionModel(newModel);
89
89
  }, [apiRef, visibleRows.rows]);
90
90
  const getSelectedCellsAsArray = React.useCallback(() => {
91
- const model = apiRef.current.getCellSelectionModel();
91
+ const selectionModel = apiRef.current.getCellSelectionModel();
92
92
  const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
93
- return Object.entries(model).reduce((acc, [id, fields]) => [...acc, ...Object.entries(fields).reduce((acc2, [field, isSelected]) => {
94
- return isSelected ? [...acc2, {
95
- id: idToIdLookup[id],
96
- field
97
- }] : acc2;
98
- }, [])], []);
99
- }, [apiRef]);
93
+ const currentVisibleRows = getVisibleRows(apiRef, props);
94
+ const sortedEntries = currentVisibleRows.rows.reduce((result, row) => {
95
+ if (row.id in selectionModel) {
96
+ result.push([row.id, selectionModel[row.id]]);
97
+ }
98
+ return result;
99
+ }, []);
100
+ return sortedEntries.reduce((selectedCells, [id, fields]) => {
101
+ selectedCells.push(...Object.entries(fields).reduce((selectedFields, [field, isSelected]) => {
102
+ if (isSelected) {
103
+ selectedFields.push({
104
+ id: idToIdLookup[id],
105
+ field
106
+ });
107
+ }
108
+ return selectedFields;
109
+ }, []));
110
+ return selectedCells;
111
+ }, []);
112
+ }, [apiRef, props]);
100
113
  const cellSelectionApi = {
101
114
  isCellSelected,
102
115
  getCellSelectionModel,
@@ -1,10 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { GRID_CHECKBOX_SELECTION_FIELD, gridFocusCellSelector, gridVisibleColumnFieldsSelector, useGridApiOptionHandler, useGridApiEventHandler, gridPaginatedVisibleSortedGridRowIdsSelector, gridExpandedSortedRowIdsSelector } from '@mui/x-data-grid';
4
- import { buildWarning, getRowIdFromRowModel, getActiveElement, useGridRegisterPipeProcessor, getPublicApiRef, isPasteShortcut, useGridLogger } from '@mui/x-data-grid/internals';
4
+ import { warnOnce, getRowIdFromRowModel, getActiveElement, useGridRegisterPipeProcessor, getPublicApiRef, isPasteShortcut, useGridLogger } from '@mui/x-data-grid/internals';
5
5
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD, GRID_REORDER_COL_DEF } from '@mui/x-data-grid-pro';
6
6
  import { unstable_debounce as debounce } from '@mui/utils';
7
- const missingOnProcessRowUpdateErrorWarning = buildWarning(['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');
8
7
  const columnFieldsToExcludeFromPaste = [GRID_CHECKBOX_SELECTION_FIELD, GRID_REORDER_COL_DEF.field, GRID_DETAIL_PANEL_TOGGLE_FIELD];
9
8
 
10
9
  // Batches rows that are updated during clipboard paste to reduce `updateRows` calls
@@ -121,7 +120,7 @@ class CellValueUpdater {
121
120
  if (onProcessRowUpdateError) {
122
121
  onProcessRowUpdateError(errorThrown);
123
122
  } else if (process.env.NODE_ENV !== 'production') {
124
- missingOnProcessRowUpdateErrorWarning();
123
+ 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');
125
124
  }
126
125
  };
127
126
  try {
@@ -158,20 +157,29 @@ function defaultPasteResolver({
158
157
  const cellSelectionModel = apiRef.current.getCellSelectionModel();
159
158
  const selectedCellsArray = apiRef.current.getSelectedCellsAsArray();
160
159
  if (cellSelectionModel && selectedCellsArray.length > 1) {
161
- Object.keys(cellSelectionModel).forEach((rowId, rowIndex) => {
160
+ let lastRowId = selectedCellsArray[0].id;
161
+ let rowIndex = 0;
162
+ let colIndex = 0;
163
+ selectedCellsArray.forEach(({
164
+ id: rowId,
165
+ field
166
+ }) => {
167
+ if (rowId !== lastRowId) {
168
+ lastRowId = rowId;
169
+ rowIndex += 1;
170
+ colIndex = 0;
171
+ }
162
172
  const rowDataArr = pastedData[isSingleValuePasted ? 0 : rowIndex];
163
173
  const hasRowData = isSingleValuePasted ? true : rowDataArr !== undefined;
164
- if (!hasRowData) {
165
- return;
166
- }
167
- Object.keys(cellSelectionModel[rowId]).forEach((field, colIndex) => {
174
+ if (hasRowData) {
168
175
  const cellValue = isSingleValuePasted ? rowDataArr[0] : rowDataArr[colIndex];
169
176
  updateCell({
170
177
  rowId,
171
178
  field,
172
179
  pastedCellValue: cellValue
173
180
  });
174
- });
181
+ }
182
+ colIndex += 1;
175
183
  });
176
184
  return;
177
185
  }
@@ -1,11 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { GRID_DATE_COL_DEF, GRID_DATETIME_COL_DEF } from '@mui/x-data-grid-pro';
3
- import { buildWarning, isObject, isSingleSelectColDef, gridHasColSpanSelector } from '@mui/x-data-grid/internals';
3
+ import { warnOnce, isObject, isSingleSelectColDef, gridHasColSpanSelector } from '@mui/x-data-grid/internals';
4
4
  const getExcelJs = async () => {
5
5
  const excelJsModule = await import('exceljs');
6
6
  return excelJsModule.default ?? excelJsModule;
7
7
  };
8
- const warnInvalidFormattedValue = buildWarning(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
9
8
  const getFormattedValueOptions = (colDef, row, valueOptions, api) => {
10
9
  if (!colDef.valueOptions) {
11
10
  return [];
@@ -89,7 +88,7 @@ export const serializeRowUnsafe = (id, columns, apiRef, defaultValueOptionsFormu
89
88
  const formattedValue = apiRef.current.getCellParams(id, castColumn.field).formattedValue;
90
89
  if (process.env.NODE_ENV !== 'production') {
91
90
  if (String(cellParams.formattedValue) === '[object Object]') {
92
- warnInvalidFormattedValue();
91
+ warnOnce(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
93
92
  }
94
93
  }
95
94
  if (isObject(formattedValue)) {
@@ -124,7 +123,7 @@ export const serializeRowUnsafe = (id, columns, apiRef, defaultValueOptionsFormu
124
123
  cellValue = apiRef.current.getCellParams(id, column.field).formattedValue;
125
124
  if (process.env.NODE_ENV !== 'production') {
126
125
  if (String(cellParams.formattedValue) === '[object Object]') {
127
- warnInvalidFormattedValue();
126
+ warnOnce(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
128
127
  }
129
128
  }
130
129
  break;
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTcyMTI1MzYwMDAwMA==";
3
+ const releaseInfo = "MTcyMTg0NzYwMDAwMA==";
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
@@ -98,15 +98,28 @@ const useGridCellSelection = (apiRef, props) => {
98
98
  apiRef.current.setCellSelectionModel(newModel);
99
99
  }, [apiRef, visibleRows.rows]);
100
100
  const getSelectedCellsAsArray = React.useCallback(() => {
101
- const model = apiRef.current.getCellSelectionModel();
101
+ const selectionModel = apiRef.current.getCellSelectionModel();
102
102
  const idToIdLookup = (0, _xDataGridPro.gridRowsDataRowIdToIdLookupSelector)(apiRef);
103
- return Object.entries(model).reduce((acc, [id, fields]) => [...acc, ...Object.entries(fields).reduce((acc2, [field, isSelected]) => {
104
- return isSelected ? [...acc2, {
105
- id: idToIdLookup[id],
106
- field
107
- }] : acc2;
108
- }, [])], []);
109
- }, [apiRef]);
103
+ const currentVisibleRows = (0, _internals.getVisibleRows)(apiRef, props);
104
+ const sortedEntries = currentVisibleRows.rows.reduce((result, row) => {
105
+ if (row.id in selectionModel) {
106
+ result.push([row.id, selectionModel[row.id]]);
107
+ }
108
+ return result;
109
+ }, []);
110
+ return sortedEntries.reduce((selectedCells, [id, fields]) => {
111
+ selectedCells.push(...Object.entries(fields).reduce((selectedFields, [field, isSelected]) => {
112
+ if (isSelected) {
113
+ selectedFields.push({
114
+ id: idToIdLookup[id],
115
+ field
116
+ });
117
+ }
118
+ return selectedFields;
119
+ }, []));
120
+ return selectedCells;
121
+ }, []);
122
+ }, [apiRef, props]);
110
123
  const cellSelectionApi = {
111
124
  isCellSelected,
112
125
  getCellSelectionModel,
@@ -13,7 +13,6 @@ var _xDataGridPro = require("@mui/x-data-grid-pro");
13
13
  var _utils = require("@mui/utils");
14
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- const missingOnProcessRowUpdateErrorWarning = (0, _internals.buildWarning)(['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');
17
16
  const columnFieldsToExcludeFromPaste = [_xDataGrid.GRID_CHECKBOX_SELECTION_FIELD, _xDataGridPro.GRID_REORDER_COL_DEF.field, _xDataGridPro.GRID_DETAIL_PANEL_TOGGLE_FIELD];
18
17
 
19
18
  // Batches rows that are updated during clipboard paste to reduce `updateRows` calls
@@ -130,7 +129,7 @@ class CellValueUpdater {
130
129
  if (onProcessRowUpdateError) {
131
130
  onProcessRowUpdateError(errorThrown);
132
131
  } else if (process.env.NODE_ENV !== 'production') {
133
- missingOnProcessRowUpdateErrorWarning();
132
+ (0, _internals.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');
134
133
  }
135
134
  };
136
135
  try {
@@ -167,20 +166,29 @@ function defaultPasteResolver({
167
166
  const cellSelectionModel = apiRef.current.getCellSelectionModel();
168
167
  const selectedCellsArray = apiRef.current.getSelectedCellsAsArray();
169
168
  if (cellSelectionModel && selectedCellsArray.length > 1) {
170
- Object.keys(cellSelectionModel).forEach((rowId, rowIndex) => {
169
+ let lastRowId = selectedCellsArray[0].id;
170
+ let rowIndex = 0;
171
+ let colIndex = 0;
172
+ selectedCellsArray.forEach(({
173
+ id: rowId,
174
+ field
175
+ }) => {
176
+ if (rowId !== lastRowId) {
177
+ lastRowId = rowId;
178
+ rowIndex += 1;
179
+ colIndex = 0;
180
+ }
171
181
  const rowDataArr = pastedData[isSingleValuePasted ? 0 : rowIndex];
172
182
  const hasRowData = isSingleValuePasted ? true : rowDataArr !== undefined;
173
- if (!hasRowData) {
174
- return;
175
- }
176
- Object.keys(cellSelectionModel[rowId]).forEach((field, colIndex) => {
183
+ if (hasRowData) {
177
184
  const cellValue = isSingleValuePasted ? rowDataArr[0] : rowDataArr[colIndex];
178
185
  updateCell({
179
186
  rowId,
180
187
  field,
181
188
  pastedCellValue: cellValue
182
189
  });
183
- });
190
+ }
191
+ colIndex += 1;
184
192
  });
185
193
  return;
186
194
  }
@@ -19,7 +19,6 @@ const getExcelJs = async () => {
19
19
  const excelJsModule = await Promise.resolve().then(() => _interopRequireWildcard(require('exceljs')));
20
20
  return excelJsModule.default ?? excelJsModule;
21
21
  };
22
- const warnInvalidFormattedValue = (0, _internals.buildWarning)(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
23
22
  const getFormattedValueOptions = (colDef, row, valueOptions, api) => {
24
23
  if (!colDef.valueOptions) {
25
24
  return [];
@@ -103,7 +102,7 @@ const serializeRowUnsafe = (id, columns, apiRef, defaultValueOptionsFormulae, op
103
102
  const formattedValue = apiRef.current.getCellParams(id, castColumn.field).formattedValue;
104
103
  if (process.env.NODE_ENV !== 'production') {
105
104
  if (String(cellParams.formattedValue) === '[object Object]') {
106
- warnInvalidFormattedValue();
105
+ (0, _internals.warnOnce)(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
107
106
  }
108
107
  }
109
108
  if ((0, _internals.isObject)(formattedValue)) {
@@ -138,7 +137,7 @@ const serializeRowUnsafe = (id, columns, apiRef, defaultValueOptionsFormulae, op
138
137
  cellValue = apiRef.current.getCellParams(id, column.field).formattedValue;
139
138
  if (process.env.NODE_ENV !== 'production') {
140
139
  if (String(cellParams.formattedValue) === '[object Object]') {
141
- warnInvalidFormattedValue();
140
+ (0, _internals.warnOnce)(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
142
141
  }
143
142
  }
144
143
  break;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-premium v7.11.0
2
+ * @mui/x-data-grid-premium v7.11.1
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -5,7 +5,7 @@ export function DataGrid() {
5
5
  if (process.env.NODE_ENV === 'production') {
6
6
  return null;
7
7
  }
8
- throw new Error(["You try to import `DataGrid` from @mui/x-data-grid-premium but this module doesn't exist.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`."].join('\n'));
8
+ throw new Error(["You try to import `DataGrid` from @mui/x-data-grid-premium but this module isn't exported from this npm package.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`.", ''].join('\n'));
9
9
  }
10
10
 
11
11
  /**
@@ -15,5 +15,5 @@ export function DataGridPro() {
15
15
  if (process.env.NODE_ENV === 'production') {
16
16
  return null;
17
17
  }
18
- throw new Error(["You try to import `DataGridPro` from @mui/x-data-grid-premium but this module doesn't exist.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`."].join('\n'));
18
+ throw new Error(["You try to import `DataGridPro` from @mui/x-data-grid-premium but this module isn't exported from this npm package.", '', "Instead, you can do `import { DataGridPremium } from '@mui/x-data-grid-premium'`.", ''].join('\n'));
19
19
  }
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
- import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT } from '@mui/x-data-grid-pro';
4
+ import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT, GridSignature } from '@mui/x-data-grid-pro';
5
5
  import { computeSlots, useProps } from '@mui/x-data-grid-pro/internals';
6
6
  import { GRID_AGGREGATION_FUNCTIONS } from '../hooks/features/aggregation';
7
7
  import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridPremiumDefaultSlotsComponents';
8
8
  const getDataGridPremiumForcedProps = themedProps => _extends({
9
- signature: 'DataGridPremium'
9
+ signature: GridSignature.DataGridPremium
10
10
  }, themedProps.unstable_dataSource ? {
11
11
  filterMode: 'server',
12
12
  sortingMode: 'server',
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { ownerDocument, useEventCallback } from '@mui/material/utils';
4
- import { getTotalHeaderHeight, isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor, useGridVisibleRows } from '@mui/x-data-grid-pro/internals';
4
+ import { getTotalHeaderHeight, getVisibleRows, isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor, useGridVisibleRows } from '@mui/x-data-grid-pro/internals';
5
5
  import { useGridApiEventHandler, useGridApiMethod, GRID_ACTIONS_COLUMN_TYPE, GRID_CHECKBOX_SELECTION_COL_DEF, GRID_DETAIL_PANEL_TOGGLE_FIELD, gridRowsDataRowIdToIdLookupSelector, gridClasses, gridFocusCellSelector, GRID_REORDER_COL_DEF, useGridSelector, gridSortedRowIdsSelector, gridDimensionsSelector } from '@mui/x-data-grid-pro';
6
6
  import { gridCellSelectionStateSelector } from './gridCellSelectionSelector';
7
7
  export const cellSelectionStateInitializer = (state, props) => _extends({}, state, {
@@ -88,15 +88,28 @@ export const useGridCellSelection = (apiRef, props) => {
88
88
  apiRef.current.setCellSelectionModel(newModel);
89
89
  }, [apiRef, visibleRows.rows]);
90
90
  const getSelectedCellsAsArray = React.useCallback(() => {
91
- const model = apiRef.current.getCellSelectionModel();
91
+ const selectionModel = apiRef.current.getCellSelectionModel();
92
92
  const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef);
93
- return Object.entries(model).reduce((acc, [id, fields]) => [...acc, ...Object.entries(fields).reduce((acc2, [field, isSelected]) => {
94
- return isSelected ? [...acc2, {
95
- id: idToIdLookup[id],
96
- field
97
- }] : acc2;
98
- }, [])], []);
99
- }, [apiRef]);
93
+ const currentVisibleRows = getVisibleRows(apiRef, props);
94
+ const sortedEntries = currentVisibleRows.rows.reduce((result, row) => {
95
+ if (row.id in selectionModel) {
96
+ result.push([row.id, selectionModel[row.id]]);
97
+ }
98
+ return result;
99
+ }, []);
100
+ return sortedEntries.reduce((selectedCells, [id, fields]) => {
101
+ selectedCells.push(...Object.entries(fields).reduce((selectedFields, [field, isSelected]) => {
102
+ if (isSelected) {
103
+ selectedFields.push({
104
+ id: idToIdLookup[id],
105
+ field
106
+ });
107
+ }
108
+ return selectedFields;
109
+ }, []));
110
+ return selectedCells;
111
+ }, []);
112
+ }, [apiRef, props]);
100
113
  const cellSelectionApi = {
101
114
  isCellSelected,
102
115
  getCellSelectionModel,
@@ -1,10 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { GRID_CHECKBOX_SELECTION_FIELD, gridFocusCellSelector, gridVisibleColumnFieldsSelector, useGridApiOptionHandler, useGridApiEventHandler, gridPaginatedVisibleSortedGridRowIdsSelector, gridExpandedSortedRowIdsSelector } from '@mui/x-data-grid';
4
- import { buildWarning, getRowIdFromRowModel, getActiveElement, useGridRegisterPipeProcessor, getPublicApiRef, isPasteShortcut, useGridLogger } from '@mui/x-data-grid/internals';
4
+ import { warnOnce, getRowIdFromRowModel, getActiveElement, useGridRegisterPipeProcessor, getPublicApiRef, isPasteShortcut, useGridLogger } from '@mui/x-data-grid/internals';
5
5
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD, GRID_REORDER_COL_DEF } from '@mui/x-data-grid-pro';
6
6
  import { unstable_debounce as debounce } from '@mui/utils';
7
- const missingOnProcessRowUpdateErrorWarning = buildWarning(['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');
8
7
  const columnFieldsToExcludeFromPaste = [GRID_CHECKBOX_SELECTION_FIELD, GRID_REORDER_COL_DEF.field, GRID_DETAIL_PANEL_TOGGLE_FIELD];
9
8
 
10
9
  // Batches rows that are updated during clipboard paste to reduce `updateRows` calls
@@ -121,7 +120,7 @@ class CellValueUpdater {
121
120
  if (onProcessRowUpdateError) {
122
121
  onProcessRowUpdateError(errorThrown);
123
122
  } else if (process.env.NODE_ENV !== 'production') {
124
- missingOnProcessRowUpdateErrorWarning();
123
+ 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');
125
124
  }
126
125
  };
127
126
  try {
@@ -158,20 +157,29 @@ function defaultPasteResolver({
158
157
  const cellSelectionModel = apiRef.current.getCellSelectionModel();
159
158
  const selectedCellsArray = apiRef.current.getSelectedCellsAsArray();
160
159
  if (cellSelectionModel && selectedCellsArray.length > 1) {
161
- Object.keys(cellSelectionModel).forEach((rowId, rowIndex) => {
160
+ let lastRowId = selectedCellsArray[0].id;
161
+ let rowIndex = 0;
162
+ let colIndex = 0;
163
+ selectedCellsArray.forEach(({
164
+ id: rowId,
165
+ field
166
+ }) => {
167
+ if (rowId !== lastRowId) {
168
+ lastRowId = rowId;
169
+ rowIndex += 1;
170
+ colIndex = 0;
171
+ }
162
172
  const rowDataArr = pastedData[isSingleValuePasted ? 0 : rowIndex];
163
173
  const hasRowData = isSingleValuePasted ? true : rowDataArr !== undefined;
164
- if (!hasRowData) {
165
- return;
166
- }
167
- Object.keys(cellSelectionModel[rowId]).forEach((field, colIndex) => {
174
+ if (hasRowData) {
168
175
  const cellValue = isSingleValuePasted ? rowDataArr[0] : rowDataArr[colIndex];
169
176
  updateCell({
170
177
  rowId,
171
178
  field,
172
179
  pastedCellValue: cellValue
173
180
  });
174
- });
181
+ }
182
+ colIndex += 1;
175
183
  });
176
184
  return;
177
185
  }
@@ -1,11 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { GRID_DATE_COL_DEF, GRID_DATETIME_COL_DEF } from '@mui/x-data-grid-pro';
3
- import { buildWarning, isObject, isSingleSelectColDef, gridHasColSpanSelector } from '@mui/x-data-grid/internals';
3
+ import { warnOnce, isObject, isSingleSelectColDef, gridHasColSpanSelector } from '@mui/x-data-grid/internals';
4
4
  const getExcelJs = async () => {
5
5
  const excelJsModule = await import('exceljs');
6
6
  return excelJsModule.default ?? excelJsModule;
7
7
  };
8
- const warnInvalidFormattedValue = buildWarning(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
9
8
  const getFormattedValueOptions = (colDef, row, valueOptions, api) => {
10
9
  if (!colDef.valueOptions) {
11
10
  return [];
@@ -89,7 +88,7 @@ export const serializeRowUnsafe = (id, columns, apiRef, defaultValueOptionsFormu
89
88
  const formattedValue = apiRef.current.getCellParams(id, castColumn.field).formattedValue;
90
89
  if (process.env.NODE_ENV !== 'production') {
91
90
  if (String(cellParams.formattedValue) === '[object Object]') {
92
- warnInvalidFormattedValue();
91
+ warnOnce(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
93
92
  }
94
93
  }
95
94
  if (isObject(formattedValue)) {
@@ -124,7 +123,7 @@ export const serializeRowUnsafe = (id, columns, apiRef, defaultValueOptionsFormu
124
123
  cellValue = apiRef.current.getCellParams(id, column.field).formattedValue;
125
124
  if (process.env.NODE_ENV !== 'production') {
126
125
  if (String(cellParams.formattedValue) === '[object Object]') {
127
- warnInvalidFormattedValue();
126
+ warnOnce(['MUI X: When the value of a field is an object or a `renderCell` is provided, the Excel export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
128
127
  }
129
128
  }
130
129
  break;
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-premium v7.11.0
2
+ * @mui/x-data-grid-premium v7.11.1
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTcyMTI1MzYwMDAwMA==";
3
+ const releaseInfo = "MTcyMTg0NzYwMDAwMA==";
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-premium",
3
- "version": "7.11.0",
3
+ "version": "7.11.1",
4
4
  "description": "The Premium plan edition of the Data Grid Components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -34,17 +34,17 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/runtime": "^7.24.8",
37
- "@mui/system": "^5.16.2",
38
- "@mui/utils": "^5.16.2",
37
+ "@mui/system": "^5.16.5",
38
+ "@mui/utils": "^5.16.5",
39
39
  "@types/format-util": "^1.0.4",
40
40
  "clsx": "^2.1.1",
41
41
  "exceljs": "^4.4.0",
42
42
  "prop-types": "^15.8.1",
43
43
  "reselect": "^4.1.8",
44
- "@mui/x-license": "7.11.0",
45
- "@mui/x-data-grid": "7.11.0",
46
- "@mui/x-data-grid-pro": "7.11.0",
47
- "@mui/x-internals": "7.11.0"
44
+ "@mui/x-data-grid": "7.11.1",
45
+ "@mui/x-data-grid-pro": "7.11.1",
46
+ "@mui/x-license": "7.11.1",
47
+ "@mui/x-internals": "7.11.1"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@mui/material": "^5.15.14",
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getReleaseInfo = void 0;
7
7
  var _utils = require("@mui/utils");
8
8
  const getReleaseInfo = () => {
9
- const releaseInfo = "MTcyMTI1MzYwMDAwMA==";
9
+ const releaseInfo = "MTcyMTg0NzYwMDAwMA==";
10
10
  if (process.env.NODE_ENV !== 'production') {
11
11
  // A simple hack to set the value in the test environment (has no build step).
12
12
  // eslint-disable-next-line no-useless-concat