@mui/x-data-grid 7.3.1 → 7.3.2

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 (130) hide show
  1. package/CHANGELOG.md +76 -5
  2. package/DataGrid/DataGrid.js +1 -1
  3. package/components/cell/GridCell.js +5 -4
  4. package/components/columnsManagement/GridColumnsManagement.js +1 -1
  5. package/constants/localeTextConstants.js +1 -0
  6. package/hooks/features/export/useGridPrintExport.js +22 -5
  7. package/hooks/features/filter/gridFilterSelector.d.ts +3 -12
  8. package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -4
  9. package/hooks/features/rows/useGridRows.js +9 -1
  10. package/hooks/features/sorting/gridSortingSelector.d.ts +4 -6
  11. package/hooks/features/sorting/gridSortingSelector.js +21 -8
  12. package/index.js +1 -1
  13. package/locales/arSD.js +1 -0
  14. package/locales/beBY.js +1 -0
  15. package/locales/bgBG.js +1 -0
  16. package/locales/csCZ.js +1 -0
  17. package/locales/daDK.js +3 -1
  18. package/locales/deDE.js +2 -0
  19. package/locales/elGR.js +1 -0
  20. package/locales/esES.js +2 -0
  21. package/locales/faIR.js +2 -0
  22. package/locales/fiFI.js +1 -0
  23. package/locales/frFR.js +2 -0
  24. package/locales/heIL.js +1 -0
  25. package/locales/hrHR.js +1 -0
  26. package/locales/huHU.js +1 -0
  27. package/locales/itIT.js +1 -0
  28. package/locales/jaJP.js +2 -0
  29. package/locales/koKR.js +1 -0
  30. package/locales/nbNO.js +1 -0
  31. package/locales/nlNL.js +1 -0
  32. package/locales/plPL.js +1 -0
  33. package/locales/ptBR.js +2 -0
  34. package/locales/ptPT.js +1 -0
  35. package/locales/roRO.js +1 -0
  36. package/locales/ruRU.js +1 -0
  37. package/locales/skSK.js +4 -3
  38. package/locales/svSE.js +2 -0
  39. package/locales/trTR.js +1 -0
  40. package/locales/ukUA.js +1 -0
  41. package/locales/urPK.js +1 -0
  42. package/locales/viVN.js +1 -0
  43. package/locales/zhCN.js +1 -0
  44. package/locales/zhHK.js +1 -0
  45. package/locales/zhTW.js +1 -0
  46. package/models/api/gridLocaleTextApi.d.ts +1 -0
  47. package/models/props/DataGridProps.d.ts +1 -1
  48. package/modern/DataGrid/DataGrid.js +1 -1
  49. package/modern/components/cell/GridCell.js +5 -4
  50. package/modern/components/columnsManagement/GridColumnsManagement.js +1 -1
  51. package/modern/constants/localeTextConstants.js +1 -0
  52. package/modern/hooks/features/export/useGridPrintExport.js +22 -5
  53. package/modern/hooks/features/rows/useGridRows.js +9 -1
  54. package/modern/hooks/features/sorting/gridSortingSelector.js +21 -8
  55. package/modern/index.js +1 -1
  56. package/modern/locales/arSD.js +1 -0
  57. package/modern/locales/beBY.js +1 -0
  58. package/modern/locales/bgBG.js +1 -0
  59. package/modern/locales/csCZ.js +1 -0
  60. package/modern/locales/daDK.js +3 -1
  61. package/modern/locales/deDE.js +2 -0
  62. package/modern/locales/elGR.js +1 -0
  63. package/modern/locales/esES.js +2 -0
  64. package/modern/locales/faIR.js +2 -0
  65. package/modern/locales/fiFI.js +1 -0
  66. package/modern/locales/frFR.js +2 -0
  67. package/modern/locales/heIL.js +1 -0
  68. package/modern/locales/hrHR.js +1 -0
  69. package/modern/locales/huHU.js +1 -0
  70. package/modern/locales/itIT.js +1 -0
  71. package/modern/locales/jaJP.js +2 -0
  72. package/modern/locales/koKR.js +1 -0
  73. package/modern/locales/nbNO.js +1 -0
  74. package/modern/locales/nlNL.js +1 -0
  75. package/modern/locales/plPL.js +1 -0
  76. package/modern/locales/ptBR.js +2 -0
  77. package/modern/locales/ptPT.js +1 -0
  78. package/modern/locales/roRO.js +1 -0
  79. package/modern/locales/ruRU.js +1 -0
  80. package/modern/locales/skSK.js +4 -3
  81. package/modern/locales/svSE.js +2 -0
  82. package/modern/locales/trTR.js +1 -0
  83. package/modern/locales/ukUA.js +1 -0
  84. package/modern/locales/urPK.js +1 -0
  85. package/modern/locales/viVN.js +1 -0
  86. package/modern/locales/zhCN.js +1 -0
  87. package/modern/locales/zhHK.js +1 -0
  88. package/modern/locales/zhTW.js +1 -0
  89. package/node/DataGrid/DataGrid.js +1 -1
  90. package/node/components/cell/GridCell.js +5 -4
  91. package/node/components/columnsManagement/GridColumnsManagement.js +1 -1
  92. package/node/constants/localeTextConstants.js +1 -0
  93. package/node/hooks/features/export/useGridPrintExport.js +22 -5
  94. package/node/hooks/features/rows/useGridRows.js +9 -1
  95. package/node/hooks/features/sorting/gridSortingSelector.js +20 -6
  96. package/node/index.js +1 -1
  97. package/node/locales/arSD.js +1 -0
  98. package/node/locales/beBY.js +1 -0
  99. package/node/locales/bgBG.js +1 -0
  100. package/node/locales/csCZ.js +1 -0
  101. package/node/locales/daDK.js +3 -1
  102. package/node/locales/deDE.js +2 -0
  103. package/node/locales/elGR.js +1 -0
  104. package/node/locales/esES.js +2 -0
  105. package/node/locales/faIR.js +2 -0
  106. package/node/locales/fiFI.js +1 -0
  107. package/node/locales/frFR.js +2 -0
  108. package/node/locales/heIL.js +1 -0
  109. package/node/locales/hrHR.js +1 -0
  110. package/node/locales/huHU.js +1 -0
  111. package/node/locales/itIT.js +1 -0
  112. package/node/locales/jaJP.js +2 -0
  113. package/node/locales/koKR.js +1 -0
  114. package/node/locales/nbNO.js +1 -0
  115. package/node/locales/nlNL.js +1 -0
  116. package/node/locales/plPL.js +1 -0
  117. package/node/locales/ptBR.js +2 -0
  118. package/node/locales/ptPT.js +1 -0
  119. package/node/locales/roRO.js +1 -0
  120. package/node/locales/ruRU.js +1 -0
  121. package/node/locales/skSK.js +4 -3
  122. package/node/locales/svSE.js +2 -0
  123. package/node/locales/trTR.js +1 -0
  124. package/node/locales/ukUA.js +1 -0
  125. package/node/locales/urPK.js +1 -0
  126. package/node/locales/viVN.js +1 -0
  127. package/node/locales/zhCN.js +1 -0
  128. package/node/locales/zhHK.js +1 -0
  129. package/node/locales/zhTW.js +1 -0
  130. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,77 @@
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.3.2
7
+
8
+ _May 2, 2024_
9
+
10
+ We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add "no data" and "loading" states to charts, allowing users to create [custom visualizations for each state](https://mui.com/x/react-charts/styling/#overlay)
13
+ - 🌍 Improve Hebrew (he-IL) and Hungarian (hu-HU) locales on the Date and Time Pickers
14
+ - 🌍 Improve Danish (da-DK) and Slovak (sk-SK) locales on the Data Grid
15
+ - 📝 Fix a [typo](https://github.com/mui/mui-x/pull/12941/files/4bf4bffbc2799a01a96bc7458a17318cf41c1722#diff-26c31cc69d6f51110f89e339578ef9b3d4a3551f79077fff73f7babb81c5099f) in the auto-generated Charts gradient `id` attribute.
16
+ It should not affect you, but if you were relying on the gradient `id` attribute, please update your usage.
17
+ - 🐞 Bugfixes
18
+ - 📚 Documentation improvements
19
+
20
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
21
+
22
+ ### Data Grid
23
+
24
+ #### `@mui/x-data-grid@7.3.2`
25
+
26
+ - [DataGrid] Allow to change reset text in the columns management panel (#12972) @MBilalShafi
27
+ - [DataGrid] Derive `formattedValue` from the edit value when passing to `renderEditCell` (#12870) @cherniavskii
28
+ - [DataGrid] Fix rows not being recomputed on `props.rowCount` change (#12833) @MBilalShafi
29
+ - [l10n] Improve Danish (da-DK) locale (#12844) @fosterbuster
30
+ - [l10n] Improve Slovak (sk-SK) locale (#12949) @stefikp
31
+
32
+ #### `@mui/x-data-grid-pro@7.3.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
33
+
34
+ Same changes as in `@mui/x-data-grid@7.3.2`.
35
+
36
+ #### `@mui/x-data-grid-premium@7.3.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
37
+
38
+ Same changes as in `@mui/x-data-grid-pro@7.3.2`, plus:
39
+
40
+ - [DataGridPremium] Fix print export not working with row grouping (#12957) @MBilalShafi
41
+
42
+ ### Date and Time Pickers
43
+
44
+ #### `@mui/x-date-pickers@7.3.2`
45
+
46
+ - [l10n] Improve Hebrew (he-IL) locale (#12910) @michaelNXT1
47
+ - [l10n] Improve Hungarian (hu-HU) locale (#12930) @noherczeg
48
+ - [pickers] Fix typo on the `viewRenderers` prop description (#12915) @flaviendelangle
49
+ - [pickers] Improve TypeScript performance in `PickersDay` (#12920) @flaviendelangle
50
+
51
+ #### `@mui/x-date-pickers-pro@7.3.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
52
+
53
+ Same changes as in `@mui/x-date-pickers@7.3.2`.
54
+
55
+ ### Charts
56
+
57
+ #### `@mui/x-charts@7.3.2`
58
+
59
+ - [charts] Add an overlay for "no data" or "loading" states (#12817) @alexfauquette
60
+ - [charts] Fix typos in documentation, translations and errors (#12941) @JCQuintas
61
+ - [charts] Fix `prop.slots` and `prop.slotProps` not passed to `<ChartsTooltip />` (#12939) @JCQuintas
62
+
63
+ ### Docs
64
+
65
+ - [docs] Improve Data Grid migration guide (#12969) @MBilalShafi
66
+ - [docs] Polish references to the plans (#12922) @oliviertassinari
67
+
68
+ ### Core
69
+
70
+ - [core] Fix dependencies (#12951) @LukasTy
71
+ - [core] Remove inconsistent blank lines (#12966) @oliviertassinari
72
+ - [code-infra] Bump node image used by CI in docker (#12961) @LukasTy
73
+ - [docs-infra] Remove no longer needed `next.config` settings (#12861) @oliviertassinari
74
+ - [docs-infra] Use the `@mui/docs/HighlightedCode` (#12848) @alexfauquette
75
+ - [test] Restore `t` command (#12948) @LukasTy
76
+
6
77
  ## 7.3.1
7
78
 
8
79
  _Apr 26, 2024_
@@ -305,7 +376,7 @@ Same changes as in `@mui/x-date-pickers@7.1.1`, plus:
305
376
 
306
377
  - [TreeView] Add JSDoc to all `publicAPI` methods (#12649) @flaviendelangle
307
378
  - [TreeView] Create `RichTreeViewPro` component (not released yet) (#12610) @flaviendelangle
308
- - [TreeView] Create pro package (not released yet) (#12240) @flaviendelangle
379
+ - [TreeView] Create Pro package (not released yet) (#12240) @flaviendelangle
309
380
  - [TreeView] Fix typo in errors (#12623) @alissa-tung
310
381
  - [TreeView] New API method: `setItemExpansion` (#12595) @flaviendelangle
311
382
 
@@ -2517,7 +2588,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.3`.
2517
2588
  - [core] Make `@mui/system` a direct dependency (#11128) @LukasTy
2518
2589
  - [core] Remove blank lines, coding style @oliviertassinari
2519
2590
  - [core] Remove outdated `ENABLE_AD` env variable (#11181) @oliviertassinari
2520
- - [github] Do not add `plan: Pro` and `plan: Premium` labels on pro / premium issue templates (#10183) @flaviendelangle
2591
+ - [github] Do not add `plan: Pro` and `plan: Premium` labels on Pro / Premium issue templates (#10183) @flaviendelangle
2521
2592
 
2522
2593
  ## 7.0.0-alpha.2
2523
2594
 
@@ -3440,10 +3511,10 @@ Same changes as in `@mui/x-date-pickers@6.19.5`.
3440
3511
  - [docs] Fix the Treemap illustration (#12189) @danilo-leal
3441
3512
  - [docs] Fix typo for `AdapterDateFnsV3` (#12037) @flaviendelangle
3442
3513
  - [docs] Improve performance on Charts entry point @oliviertassinari
3443
- - [docs] Move Heatmap to pro (#12170) @alexfauquette
3514
+ - [docs] Move Heatmap to Pro (#12170) @alexfauquette
3444
3515
  - [docs] Remove Charts installation next tag call-out (#12133) @LukasTy
3445
3516
  - [docs] Removed `focused` prop from demo (#12126) @michelengelen
3446
- - [docs] Add missing Heatmap pro icon @oliviertassinari
3517
+ - [docs] Add missing Heatmap Pro icon @oliviertassinari
3447
3518
  - [docs] Add more illustrations to the Overview page (#12041) @danilo-leal
3448
3519
  - [docs] Avoid use of shorthand (#12009) @oliviertassinari
3449
3520
 
@@ -6170,7 +6241,7 @@ We'd like to offer a big thanks to the 11 contributors who made this release pos
6170
6241
  - [docs] Create examples of pickers with custom fields (#8034) @flaviendelangle
6171
6242
  - [docs] Fix 301 redirections @oliviertassinari
6172
6243
  - [docs] Fix link to React's docs @oliviertassinari
6173
- - [docs] Fix pro license links to point to the same page (#8303) @LukasTy
6244
+ - [docs] Fix Pro license links to point to the same page (#8303) @LukasTy
6174
6245
  - [docs] Give an incentive to upgrade (#8269) @oliviertassinari
6175
6246
  - [docs] Improve contrast on data grid navigation (#8239) @oliviertassinari
6176
6247
  - [docs] Update shortcuts page to use slotProps (#8288) @dcorb
@@ -327,7 +327,7 @@ DataGridRaw.propTypes = {
327
327
  */
328
328
  keepNonExistentRowsSelected: PropTypes.bool,
329
329
  /**
330
- * If `true`, a loading overlay is displayed.
330
+ * If `true`, a loading overlay is displayed.
331
331
  */
332
332
  loading: PropTypes.bool,
333
333
  /**
@@ -131,8 +131,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
131
131
  cellMode,
132
132
  hasFocus,
133
133
  isEditable = false,
134
- value,
135
- formattedValue
134
+ value
136
135
  } = cellParamsWithAPI;
137
136
  const canManageOwnFocus = column.type === 'actions' && column.getActions?.(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
138
137
  const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
@@ -156,7 +155,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
156
155
  if (getCellClassName) {
157
156
  classNames.push(getCellClassName(cellParamsWithAPI));
158
157
  }
159
- const valueToRender = formattedValue == null ? value : formattedValue;
158
+ const valueToRender = cellParamsWithAPI.formattedValue ?? value;
160
159
  const cellRef = React.useRef(null);
161
160
  const handleRef = useForkRef(ref, cellRef);
162
161
  const focusElementRef = React.useRef(null);
@@ -268,8 +267,10 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
268
267
 
269
268
  // eslint-disable-next-line @typescript-eslint/naming-convention
270
269
  const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded2);
270
+ const formattedValue = column.valueFormatter ? column.valueFormatter(editCellState.value, updatedRow, column, apiRef) : cellParamsWithAPI.formattedValue;
271
271
  const params = _extends({}, cellParamsWithAPI, {
272
- row: updatedRow
272
+ row: updatedRow,
273
+ formattedValue
273
274
  }, editCellStateRest);
274
275
  children = column.renderEditCell(params);
275
276
  classNames.push(gridClasses['cell--editing']);
@@ -170,7 +170,7 @@ function GridColumnsManagement(props) {
170
170
  onClick: () => apiRef.current.setColumnVisibilityModel(initialColumnVisibilityModel),
171
171
  disabled: isResetDisabled
172
172
  }, rootProps.slotProps?.baseButton, {
173
- children: "Reset"
173
+ children: apiRef.current.getLocaleText('columnsManagementReset')
174
174
  })) : null]
175
175
  }) : null]
176
176
  });
@@ -31,6 +31,7 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
31
31
  columnsManagementSearchTitle: 'Search',
32
32
  columnsManagementNoColumns: 'No columns',
33
33
  columnsManagementShowHideAllText: 'Show/Hide All',
34
+ columnsManagementReset: 'Reset',
34
35
  // Filter panel text
35
36
  filterPanelAddFilter: 'Add filter',
36
37
  filterPanelRemoveAll: 'Remove all',
@@ -7,6 +7,7 @@ import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from
7
7
  import { gridClasses } from '../../../constants/gridClasses';
8
8
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
9
9
  import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
10
+ import { GRID_ID_AUTOGENERATED } from '../rows/gridRowsUtils';
10
11
  import { defaultGetRowsToExport, getColumnsToExport } from './utils';
11
12
  import { getDerivedPaginationModel } from '../pagination/useGridPaginationModel';
12
13
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
@@ -42,6 +43,7 @@ export const useGridPrintExport = (apiRef, props) => {
42
43
  const previousGridState = React.useRef(null);
43
44
  const previousColumnVisibility = React.useRef({});
44
45
  const previousRows = React.useRef([]);
46
+ const previousVirtualizationState = React.useRef();
45
47
  React.useEffect(() => {
46
48
  doc.current = ownerDocument(apiRef.current.rootElementRef.current);
47
49
  }, [apiRef]);
@@ -71,7 +73,13 @@ export const useGridPrintExport = (apiRef, props) => {
71
73
  const rowsToExportIds = getRowsToExport({
72
74
  apiRef
73
75
  });
74
- const newRows = rowsToExportIds.map(id => apiRef.current.getRow(id));
76
+ const newRows = rowsToExportIds.reduce((acc, id) => {
77
+ const row = apiRef.current.getRow(id);
78
+ if (!row[GRID_ID_AUTOGENERATED]) {
79
+ acc.push(row);
80
+ }
81
+ return acc;
82
+ }, []);
75
83
  apiRef.current.setRows(newRows);
76
84
  }, [apiRef]);
77
85
  const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
@@ -124,6 +132,8 @@ export const useGridPrintExport = (apiRef, props) => {
124
132
  // prevents us to do it
125
133
  const container = document.createElement('div');
126
134
  container.appendChild(gridClone);
135
+ // To avoid an empty page in start on Chromium based browsers
136
+ printDoc.body.style.marginTop = '0px';
127
137
  printDoc.body.innerHTML = container.innerHTML;
128
138
  const defaultPageStyle = typeof normalizeOptions.pageStyle === 'function' ? normalizeOptions.pageStyle() : normalizeOptions.pageStyle;
129
139
  if (typeof defaultPageStyle === 'string') {
@@ -192,7 +202,9 @@ export const useGridPrintExport = (apiRef, props) => {
192
202
  // if the apiRef.current.exportState(); did not exported the column visibility, we update it
193
203
  apiRef.current.setColumnVisibilityModel(previousColumnVisibility.current);
194
204
  }
195
- apiRef.current.unstable_setVirtualization(true);
205
+ apiRef.current.setState(state => _extends({}, state, {
206
+ virtualization: previousVirtualizationState.current
207
+ }));
196
208
  apiRef.current.setRows(previousRows.current);
197
209
 
198
210
  // Clear local state
@@ -208,7 +220,7 @@ export const useGridPrintExport = (apiRef, props) => {
208
220
  previousGridState.current = apiRef.current.exportState();
209
221
  // It appends that the visibility model is not exported, especially if columnVisibility is not controlled
210
222
  previousColumnVisibility.current = gridColumnVisibilityModelSelector(apiRef);
211
- previousRows.current = apiRef.current.getSortedRows();
223
+ previousRows.current = apiRef.current.getSortedRows().filter(row => !row[GRID_ID_AUTOGENERATED]);
212
224
  if (props.pagination) {
213
225
  const visibleRowCount = gridExpandedRowCountSelector(apiRef);
214
226
  const paginationModel = {
@@ -222,11 +234,16 @@ export const useGridPrintExport = (apiRef, props) => {
222
234
  'DataGridPro', paginationModel)
223
235
  })
224
236
  }));
225
- apiRef.current.forceUpdate();
226
237
  }
238
+ previousVirtualizationState.current = apiRef.current.state.virtualization;
239
+ apiRef.current.setState(state => _extends({}, state, {
240
+ virtualization: _extends({}, state.virtualization, {
241
+ enabled: false,
242
+ enabledForColumns: false
243
+ })
244
+ }));
227
245
  await updateGridColumnsForPrint(options?.fields, options?.allColumns, options?.includeCheckboxes);
228
246
  updateGridRowsForPrint(options?.getRowsToExport ?? defaultGetRowsToExport);
229
- apiRef.current.unstable_setVirtualization(false);
230
247
  await raf(); // wait for the state changes to take action
231
248
  const printWindow = buildPrintWindow(options?.fileName);
232
249
  if (process.env.NODE_ENV === 'test') {
@@ -30,10 +30,7 @@ export declare const gridFilteredDescendantCountLookupSelector: import("../../..
30
30
  * Does not contain the collapsed children.
31
31
  * @category Filtering
32
32
  */
33
- export declare const gridExpandedSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, {
34
- id: import("../../..").GridRowId;
35
- model: import("../../..").GridValidRowModel;
36
- }[]>;
33
+ export declare const gridExpandedSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
37
34
  /**
38
35
  * Get the id of the rows accessible after the filtering process.
39
36
  * Does not contain the collapsed children.
@@ -45,10 +42,7 @@ export declare const gridExpandedSortedRowIdsSelector: import("../../../utils/cr
45
42
  * Contains the collapsed children.
46
43
  * @category Filtering
47
44
  */
48
- export declare const gridFilteredSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, {
49
- id: import("../../..").GridRowId;
50
- model: import("../../..").GridValidRowModel;
51
- }[]>;
45
+ export declare const gridFilteredSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
52
46
  /**
53
47
  * Get the id of the rows accessible after the filtering process.
54
48
  * Contains the collapsed children.
@@ -59,10 +53,7 @@ export declare const gridFilteredSortedRowIdsSelector: import("../../../utils/cr
59
53
  * Get the id and the model of the top level rows accessible after the filtering process.
60
54
  * @category Filtering
61
55
  */
62
- export declare const gridFilteredSortedTopLevelRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, {
63
- id: import("../../..").GridRowId;
64
- model: import("../../..").GridValidRowModel;
65
- }[]>;
56
+ export declare const gridFilteredSortedTopLevelRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
66
57
  /**
67
58
  * Get the amount of rows accessible after the filtering process.
68
59
  * @category Filtering
@@ -46,10 +46,7 @@ export declare const gridPaginationRowRangeSelector: import("../../../utils/crea
46
46
  * Get the id and the model of each row to include in the current page if the pagination is enabled.
47
47
  * @category Pagination
48
48
  */
49
- export declare const gridPaginatedVisibleSortedGridRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, {
50
- id: import("../../..").GridRowId;
51
- model: import("../../..").GridValidRowModel;
52
- }[]>;
49
+ export declare const gridPaginatedVisibleSortedGridRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
53
50
  /**
54
51
  * Get the id of each row to include in the current page if the pagination is enabled.
55
52
  * @category Pagination
@@ -39,6 +39,7 @@ export const useGridRows = (apiRef, props) => {
39
39
  const logger = useGridLogger(apiRef, 'useGridRows');
40
40
  const currentPage = useGridVisibleRows(apiRef, props);
41
41
  const lastUpdateMs = React.useRef(Date.now());
42
+ const lastRowCount = React.useRef(props.rowCount);
42
43
  const timeout = useTimeout();
43
44
  const getRow = React.useCallback(id => {
44
45
  const model = gridRowsLookupSelector(apiRef)[id];
@@ -400,6 +401,11 @@ export const useGridRows = (apiRef, props) => {
400
401
  isFirstRender.current = false;
401
402
  return;
402
403
  }
404
+ let isRowCountPropUpdated = false;
405
+ if (props.rowCount !== lastRowCount.current) {
406
+ isRowCountPropUpdated = true;
407
+ lastRowCount.current = props.rowCount;
408
+ }
403
409
  const areNewRowsAlreadyInState = apiRef.current.caches.rows.rowsBeforePartialUpdates === props.rows;
404
410
  const isNewLoadingAlreadyInState = apiRef.current.caches.rows.loadingPropBeforePartialUpdates === props.loading;
405
411
  const isNewRowCountAlreadyInState = apiRef.current.caches.rows.rowCountPropBeforePartialUpdates === props.rowCount;
@@ -426,7 +432,9 @@ export const useGridRows = (apiRef, props) => {
426
432
  apiRef.current.caches.rows.rowCountPropBeforePartialUpdates = props.rowCount;
427
433
  apiRef.current.forceUpdate();
428
434
  }
429
- return;
435
+ if (!isRowCountPropUpdated) {
436
+ return;
437
+ }
430
438
  }
431
439
  logger.debug(`Updating all rows, new length ${props.rows.length}`);
432
440
  throttledRowsChange({
@@ -1,18 +1,16 @@
1
1
  import { GridSortDirection, GridSortModel } from '../../../models/gridSortModel';
2
- import { GridStateCommunity } from '../../../models/gridStateCommunity';
2
+ import type { GridStateCommunity } from '../../../models/gridStateCommunity';
3
+ import type { GridValidRowModel, GridRowEntry } from '../../../models/gridRows';
3
4
  /**
4
5
  * Get the id of the rows after the sorting process.
5
6
  * @category Sorting
6
7
  */
7
- export declare const gridSortedRowIdsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
8
+ export declare const gridSortedRowIdsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../models/gridRows").GridRowId[]>;
8
9
  /**
9
10
  * Get the id and the model of the rows after the sorting process.
10
11
  * @category Sorting
11
12
  */
12
- export declare const gridSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, {
13
- id: import("../../..").GridRowId;
14
- model: import("../../..").GridValidRowModel;
15
- }[]>;
13
+ export declare const gridSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridRowEntry<GridValidRowModel>[]>;
16
14
  /**
17
15
  * Get the current sorting model.
18
16
  * @category Sorting
@@ -1,6 +1,6 @@
1
1
  import { createSelector, createSelectorMemoized } from '../../../utils/createSelector';
2
- import { gridRowsLookupSelector } from '../rows/gridRowsSelector';
3
-
2
+ import { gridRowTreeSelector, gridRowsLookupSelector } from '../rows/gridRowsSelector';
3
+ import { GRID_ID_AUTOGENERATED, isAutoGeneratedRow } from '../rows/gridRowsUtils';
4
4
  /**
5
5
  * @category Sorting
6
6
  * @ignore - do not document.
@@ -17,12 +17,25 @@ export const gridSortedRowIdsSelector = createSelector(gridSortingStateSelector,
17
17
  * Get the id and the model of the rows after the sorting process.
18
18
  * @category Sorting
19
19
  */
20
- export const gridSortedRowEntriesSelector = createSelectorMemoized(gridSortedRowIdsSelector, gridRowsLookupSelector,
21
- // TODO rows v6: Is this the best approach ?
22
- (sortedIds, idRowsLookup) => sortedIds.map(id => ({
23
- id,
24
- model: idRowsLookup[id] ?? {}
25
- })));
20
+ export const gridSortedRowEntriesSelector = createSelectorMemoized(gridSortedRowIdsSelector, gridRowsLookupSelector, gridRowTreeSelector, (sortedIds, idRowsLookup, rowTree) => sortedIds.reduce((acc, id) => {
21
+ const model = idRowsLookup[id];
22
+ if (model) {
23
+ acc.push({
24
+ id,
25
+ model
26
+ });
27
+ }
28
+ const rowNode = rowTree[id];
29
+ if (rowNode && isAutoGeneratedRow(rowNode)) {
30
+ acc.push({
31
+ id,
32
+ model: {
33
+ [GRID_ID_AUTOGENERATED]: id
34
+ }
35
+ });
36
+ }
37
+ return acc;
38
+ }, []));
26
39
 
27
40
  /**
28
41
  * Get the current sorting model.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.3.1
2
+ * @mui/x-data-grid v7.3.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/locales/arSD.js CHANGED
@@ -33,6 +33,7 @@ const arSDGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'إضافة مرشِح',
package/locales/beBY.js CHANGED
@@ -47,6 +47,7 @@ const beBYGrid = {
47
47
  // columnsManagementSearchTitle: 'Search',
48
48
  // columnsManagementNoColumns: 'No columns',
49
49
  // columnsManagementShowHideAllText: 'Show/Hide All',
50
+ // columnsManagementReset: 'Reset',
50
51
 
51
52
  // Filter panel text
52
53
  filterPanelAddFilter: 'Дадаць фільтр',
package/locales/bgBG.js CHANGED
@@ -33,6 +33,7 @@ const bgBGGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Добави Филтър',
package/locales/csCZ.js CHANGED
@@ -41,6 +41,7 @@ const csCZGrid = {
41
41
  // columnsManagementSearchTitle: 'Search',
42
42
  // columnsManagementNoColumns: 'No columns',
43
43
  // columnsManagementShowHideAllText: 'Show/Hide All',
44
+ // columnsManagementReset: 'Reset',
44
45
 
45
46
  // Filter panel text
46
47
  filterPanelAddFilter: 'Přidat filtr',
package/locales/daDK.js CHANGED
@@ -32,7 +32,9 @@ const daDKGrid = {
32
32
  // Columns management text
33
33
  columnsManagementSearchTitle: 'Søg',
34
34
  columnsManagementNoColumns: 'Ingen søjler',
35
- columnsManagementShowHideAllText: 'Vis/Shjul Alle',
35
+ columnsManagementShowHideAllText: 'Vis/Skjul Alle',
36
+ // columnsManagementReset: 'Reset',
37
+
36
38
  // Filter panel text
37
39
  filterPanelAddFilter: 'Tilføj filter',
38
40
  filterPanelRemoveAll: 'Fjern alle',
package/locales/deDE.js CHANGED
@@ -33,6 +33,8 @@ const deDEGrid = {
33
33
  columnsManagementSearchTitle: 'Suche',
34
34
  columnsManagementNoColumns: 'Keine Spalten',
35
35
  columnsManagementShowHideAllText: 'Alle anzeigen/verbergen',
36
+ // columnsManagementReset: 'Reset',
37
+
36
38
  // Filter panel text
37
39
  filterPanelAddFilter: 'Filter hinzufügen',
38
40
  filterPanelRemoveAll: 'Alle entfernen',
package/locales/elGR.js CHANGED
@@ -33,6 +33,7 @@ const elGRGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Προσθήκη φίλτρου',
package/locales/esES.js CHANGED
@@ -33,6 +33,8 @@ const esESGrid = {
33
33
  columnsManagementSearchTitle: 'Buscar',
34
34
  columnsManagementNoColumns: 'Sin columnas',
35
35
  columnsManagementShowHideAllText: 'Mostrar/Ocultar todas',
36
+ // columnsManagementReset: 'Reset',
37
+
36
38
  // Filter panel text
37
39
  filterPanelAddFilter: 'Agregar filtro',
38
40
  filterPanelRemoveAll: 'Remover todos',
package/locales/faIR.js CHANGED
@@ -33,6 +33,8 @@ const faIRGrid = {
33
33
  columnsManagementSearchTitle: 'جستجو',
34
34
  columnsManagementNoColumns: 'بدون سطر',
35
35
  columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
36
+ // columnsManagementReset: 'Reset',
37
+
36
38
  // Filter panel text
37
39
  filterPanelAddFilter: 'افزودن فیلتر',
38
40
  filterPanelRemoveAll: 'حذف همه',
package/locales/fiFI.js CHANGED
@@ -33,6 +33,7 @@ const fiFIGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Lisää suodatin',
package/locales/frFR.js CHANGED
@@ -33,6 +33,8 @@ const frFRGrid = {
33
33
  columnsManagementSearchTitle: 'Rechercher',
34
34
  columnsManagementNoColumns: 'Pas de colonnes',
35
35
  columnsManagementShowHideAllText: 'Afficher/masquer toutes',
36
+ // columnsManagementReset: 'Reset',
37
+
36
38
  // Filter panel text
37
39
  filterPanelAddFilter: 'Ajouter un filtre',
38
40
  filterPanelRemoveAll: 'Tout supprimer',
package/locales/heIL.js CHANGED
@@ -33,6 +33,7 @@ const heILGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'הוסף מסנן',
package/locales/hrHR.js CHANGED
@@ -33,6 +33,7 @@ const hrHRGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Dodajte filter',
package/locales/huHU.js CHANGED
@@ -33,6 +33,7 @@ const huHUGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Szűrő hozzáadása',
package/locales/itIT.js CHANGED
@@ -33,6 +33,7 @@ const itITGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Aggiungi un filtro',
package/locales/jaJP.js CHANGED
@@ -33,6 +33,8 @@ const jaJPGrid = {
33
33
  columnsManagementSearchTitle: '検索',
34
34
  columnsManagementNoColumns: 'カラムなし',
35
35
  columnsManagementShowHideAllText: 'すべて表示/非表示',
36
+ // columnsManagementReset: 'Reset',
37
+
36
38
  // Filter panel text
37
39
  filterPanelAddFilter: 'フィルター追加',
38
40
  filterPanelRemoveAll: 'すべて削除',
package/locales/koKR.js CHANGED
@@ -33,6 +33,7 @@ const koKRGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: '필터 추가',
package/locales/nbNO.js CHANGED
@@ -33,6 +33,7 @@ const nbNOGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Legg til filter',
package/locales/nlNL.js CHANGED
@@ -33,6 +33,7 @@ const nlNLGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Filter toevoegen',
package/locales/plPL.js CHANGED
@@ -33,6 +33,7 @@ const plPLGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Dodaj filtr',
package/locales/ptBR.js CHANGED
@@ -33,6 +33,8 @@ const ptBRGrid = {
33
33
  columnsManagementSearchTitle: 'Buscar',
34
34
  columnsManagementNoColumns: 'Nenhuma coluna',
35
35
  columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
36
+ // columnsManagementReset: 'Reset',
37
+
36
38
  // Filter panel text
37
39
  filterPanelAddFilter: 'Adicionar filtro',
38
40
  filterPanelRemoveAll: 'Remover todos',
package/locales/ptPT.js CHANGED
@@ -33,6 +33,7 @@ const ptPTGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Adicionar filtro',
package/locales/roRO.js CHANGED
@@ -33,6 +33,7 @@ const roROGrid = {
33
33
  // columnsManagementSearchTitle: 'Search',
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
+ // columnsManagementReset: 'Reset',
36
37
 
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: 'Adăugare filtru',
package/locales/ruRU.js CHANGED
@@ -42,6 +42,7 @@ const ruRUGrid = {
42
42
  // columnsManagementSearchTitle: 'Search',
43
43
  // columnsManagementNoColumns: 'No columns',
44
44
  // columnsManagementShowHideAllText: 'Show/Hide All',
45
+ // columnsManagementReset: 'Reset',
45
46
 
46
47
  // Filter panel text
47
48
  filterPanelAddFilter: 'Добавить фильтр',