@mui/x-data-grid-premium 7.0.0-beta.7 → 7.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 (38) hide show
  1. package/CHANGELOG.md +195 -12
  2. package/DataGridPremium/DataGridPremium.js +21 -17
  3. package/README.md +1 -1
  4. package/esm/DataGridPremium/DataGridPremium.js +21 -17
  5. package/esm/components/GridAggregationHeader.js +1 -2
  6. package/esm/components/GridColumnMenuAggregationItem.js +2 -3
  7. package/esm/components/GridColumnMenuRowGroupItem.js +1 -2
  8. package/esm/components/GridColumnMenuRowUngroupItem.js +1 -2
  9. package/esm/components/GridExcelExportMenuItem.js +1 -1
  10. package/esm/components/GridGroupingColumnLeafCell.js +1 -2
  11. package/esm/components/GridGroupingCriteriaCell.js +2 -3
  12. package/esm/hooks/features/aggregation/gridAggregationUtils.js +4 -4
  13. package/esm/hooks/features/aggregation/useGridAggregation.js +1 -2
  14. package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +1 -2
  15. package/esm/hooks/features/aggregation/wrapColumnWithAggregation.js +5 -9
  16. package/esm/hooks/features/cellSelection/useGridCellSelection.js +13 -21
  17. package/esm/hooks/features/clipboard/useGridClipboardImport.js +21 -8
  18. package/esm/hooks/features/export/serializer/excelSerializer.js +9 -22
  19. package/esm/hooks/features/export/useGridExcelExport.js +9 -11
  20. package/esm/hooks/features/rowGrouping/createGroupingColDef.js +23 -32
  21. package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -7
  22. package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +5 -9
  23. package/esm/hooks/utils/useKeepGroupedColumnsHidden.js +7 -9
  24. package/esm/utils/releaseInfo.js +1 -1
  25. package/hooks/features/cellSelection/useGridCellSelection.js +2 -1
  26. package/hooks/features/clipboard/useGridClipboardImport.d.ts +1 -1
  27. package/hooks/features/clipboard/useGridClipboardImport.js +18 -3
  28. package/hooks/features/rowGrouping/createGroupingColDef.js +3 -2
  29. package/index.js +1 -1
  30. package/models/dataGridPremiumProps.d.ts +12 -2
  31. package/modern/DataGridPremium/DataGridPremium.js +21 -17
  32. package/modern/hooks/features/cellSelection/useGridCellSelection.js +2 -1
  33. package/modern/hooks/features/clipboard/useGridClipboardImport.js +19 -4
  34. package/modern/hooks/features/rowGrouping/createGroupingColDef.js +3 -2
  35. package/modern/index.js +1 -1
  36. package/modern/utils/releaseInfo.js +1 -1
  37. package/package.json +7 -7
  38. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,189 @@
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
+ ## v7.0.0
7
+
8
+ _Mar 22, 2024_
9
+
10
+ We're excited to [announce the first v7 stable release](https://mui.com/blog/mui-x-v7/)! 🎉🚀
11
+
12
+ This is now the officially supported major version, where we'll keep rolling out new features, bug fixes, and improvements.
13
+ Migration guides are available with a complete list of the breaking changes:
14
+
15
+ - [Data Grid](https://mui.com/x/migration/migration-data-grid-v6/)
16
+ - [Date and Time Pickers](https://mui.com/x/migration/migration-pickers-v6/)
17
+ - [Tree View](https://mui.com/x/migration/migration-tree-view-v6/)
18
+ - [Charts](https://mui.com/x/migration/migration-charts-v6/)
19
+
20
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
21
+
22
+ - 🚀 Improve the usage of custom `viewRenderers` on `DateTimePicker` (#12441) @LukasTy
23
+ - ✨ Set focus on the focused Tree Item instead of the Tree View (#12226) @flaviendelangle
24
+ - đŸ•šī¸ Support controlled `density` for the Data Grid (#12332) @MBilalShafi
25
+ - 🎁 Dynamic virtualization range for the Data Grid (#12353) @romgrk
26
+ - 🐞 Bugfixes
27
+ - 📚 Documentation improvements
28
+
29
+ ### Data Grid
30
+
31
+ #### Breaking changes
32
+
33
+ - The `density` is a [controlled prop](https://mui.com/x/react-data-grid/accessibility/#set-the-density-programmatically) now, if you were previously passing the `density` prop to the Data Grid, you will need to do one of the following:
34
+
35
+ 1. Move it to the `initialState.density` to initialize it.
36
+
37
+ ```diff
38
+ <DataGrid
39
+ - density="compact"
40
+ + initialState={{ density: "compact" }}
41
+ />
42
+ ```
43
+
44
+ 2. Move it to the state and use `onDensityChange` callback to update the `density` prop accordingly for it to work as expected.
45
+
46
+ ```diff
47
+ + const [density, setDensity] = React.useState<GridDensity>('compact');
48
+ <DataGrid
49
+ - density="compact"
50
+ + density={density}
51
+ + onDensityChange={(newDensity) => setDensity(newDensity)}
52
+ />
53
+ ```
54
+
55
+ - The selector `gridDensityValueSelector` was removed, use the `gridDensitySelector` instead.
56
+
57
+ - The props `rowBuffer` and `columnBuffer` were renamed to `rowBufferPx` and `columnBufferPx`.
58
+ Their value is now a pixel value rather than a number of items. Their default value is now `150`.
59
+
60
+ - The props `rowThreshold` and `columnThreshold` have been removed.
61
+ If you had the `rowThreshold` prop set to `0` to force new rows to be rendered more often – this is no longer necessary.
62
+
63
+ #### `@mui/x-data-grid@7.0.0`
64
+
65
+ - [DataGrid] Allow to control the grid density (#12332) @MBilalShafi
66
+ - [DataGrid] Dynamic virtualization range (#12353) @romgrk
67
+ - [DataGrid] Fix `ElementType` usage (#12479) @cherniavskii
68
+ - [DataGrid] Fix cell value formatting on copy (#12357) @sai6855
69
+ - [DataGrid] Fix checkbox selection is keeping selection when filtering (#11751) @g1mishra
70
+ - [DataGrid] Make `rows` an optional prop (#12478) @MBilalShafi
71
+
72
+ #### `@mui/x-data-grid-pro@7.0.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
73
+
74
+ Same changes as in `@mui/x-data-grid@7.0.0`.
75
+
76
+ #### `@mui/x-data-grid-premium@7.0.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
77
+
78
+ Same changes as in `@mui/x-data-grid-pro@7.0.0`, plus:
79
+
80
+ - [DataGridPremium] Add support for confirmation before clipboard paste (#12225) @cherniavskii
81
+ - [DataGridPremium] Fix single grouping column sorting (#9679) @cherniavskii
82
+ - [DataGridPremium] Fix boolean cell not rendered in group rows (#12492) @sai6855
83
+
84
+ ### Date and Time Pickers
85
+
86
+ #### Breaking changes
87
+
88
+ - The `DesktopDateTimePicker` view rendering has been optimized by using the same technique as for `DesktopDateTimeRangePicker`.
89
+ - The `dateTimeViewRenderers` have been removed in favor of reusing existing time view renderers (`renderTimeViewClock`, `renderDigitalClockTimeView` and `renderMultiSectionDigitalClockTimeView`) and date view renderer (`renderDateViewCalendar`).
90
+ - Passing `renderTimeViewClock` to time view renderers will no longer revert to the old behavior of rendering only date or time view.
91
+
92
+ #### `@mui/x-date-pickers@7.0.0`
93
+
94
+ - [fields] Allow to override the separator between the start and the end date in all range fields (#12174) @flaviendelangle
95
+ - [fields] Support format without separator (#12489) @flaviendelangle
96
+ - [pickers] Use renderer interceptor on `DesktopDateTimePicker` (#12441) @LukasTy
97
+
98
+ #### `@mui/x-date-pickers-pro@7.0.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
99
+
100
+ Same changes as in `@mui/x-date-pickers@7.0.0`, plus:
101
+
102
+ - [DateTimeRangePicker] Add component `JSDoc` (#12518) @LukasTy
103
+ - [DateTimeRangePicker] Fix views behavior regression (#12529) @LukasTy
104
+
105
+ ### Charts
106
+
107
+ #### `@mui/x-charts@7.0.0`
108
+
109
+ - [charts] Fix small typo in `CartesianContextProvider` (#12461) @Janpot
110
+
111
+ ### Tree View
112
+
113
+ #### Breaking changes
114
+
115
+ - The required `nodeId` prop used by the `TreeItem` has been renamed to `itemId` for consistency:
116
+
117
+ ```diff
118
+ <TreeView>
119
+ - <TreeItem label="Item 1" nodeId="one">
120
+ + <TreeItem label="Item 1" itemId="one">
121
+ </TreeView>
122
+ ```
123
+
124
+ - The focus is now applied to the Tree Item root element instead of the Tree View root element.
125
+
126
+ This change will allow new features that require the focus to be on the Tree Item,
127
+ like the drag and drop reordering of items.
128
+ It also solves several issues with focus management,
129
+ like the inability to scroll to the focused item when a lot of items are rendered.
130
+
131
+ This will mostly impact how you write tests to interact with the Tree View:
132
+
133
+ For example, if you were writing a test with `react-testing-library`, here is what the changes could look like:
134
+
135
+ ```diff
136
+ it('test example on first item', () => {
137
+ - const { getByRole } = render(
138
+ + const { getAllByRole } = render(
139
+ <SimpleTreeView>
140
+ <TreeItem nodeId="one" />
141
+ <TreeItem nodeId="two" />
142
+ </SimpleTreeView>
143
+ );
144
+
145
+ - const tree = getByRole('tree');
146
+ + const firstTreeItem = getAllByRole('treeitem')[0];
147
+ act(() => {
148
+ - tree.focus();
149
+ + firstTreeItem.focus();
150
+ });
151
+ - fireEvent.keyDown(tree, { key: 'ArrowDown' });
152
+ + fireEvent.keyDown(firstTreeItem, { key: 'ArrowDown' });
153
+ })
154
+ ```
155
+
156
+ #### `@mui/x-tree-view@7.0.0`
157
+
158
+ - [TreeView] Rename `nodeId` to `itemId` (#12418) @noraleonte
159
+ - [TreeView] Set focus on the focused Tree Item instead of the Tree View (#12226) @flaviendelangle
160
+ - [TreeView] Update JSDoc of the `ContentComponent` prop to avoid using the word "node" (#12476) @flaviendelangle
161
+
162
+ ### `@mui/x-codemod@7.0.0`
163
+
164
+ - [codemod] Add a codemod and update the grid migration guide (#12488) @MBilalShafi
165
+
166
+ ### Docs
167
+
168
+ - [docs] Finalize migration guide (#12501) @noraleonte
169
+ - [docs] Fix nested cells alignment in the popular features demo (#12450) @cherniavskii
170
+ - [docs] Fix some Vale errors (#12469) @oliviertassinari
171
+ - [docs] Remove mentions of pre release (#12513) @noraleonte
172
+ - [docs] Update branch name and tags (#12498) @cherniavskii
173
+ - [docs] Update links to v6 (#12496) @cherniavskii
174
+ - [docs] Update links to v7 docs (#12500) @noraleonte
175
+ - [docs] Update supported versions (#12508) @joserodolfofreitas
176
+ - [docs] Update "What's new in MUI X" page #12527 @cherniavskii
177
+
178
+ ### Core
179
+
180
+ - [core] Bump `@mui/material` peer dependency for all packages (#12516) @LukasTy
181
+ - [core] Fix `no-restricted-imports` ESLint rule not working for Data Grid packages (#12477) @cherniavskii
182
+ - [core] Lower the frequency of `no-response` action runs (#12491) @michaldudak
183
+ - [core] Remove leftover `legacy` `browserlistrc` entry (#12415) @LukasTy
184
+ - [core] Update NPM tag (#12511) @cherniavskii
185
+ - [core] Update supported browsers (browserlistrc) (#12521) @LukasTy
186
+ - [core] Use Circle CI context @oliviertassinari
187
+ - [license] Fix grammar on expired license error message (#12460) @joserodolfofreitas
188
+
6
189
  ## 7.0.0-beta.7
7
190
 
8
191
  _Mar 14, 2024_
@@ -90,7 +273,7 @@ The `onNodeFocus` callback has been renamed to `onItemFocus` for consistency:
90
273
  - [docs] Add `legacy` bundle drop mention in migration pages (#12424) @LukasTy
91
274
  - [docs] Add missing luxon `Info` import (#12427) @LukasTy
92
275
  - [docs] Improve slots definitions for charts (#12408) @alexfauquette
93
- - [docs] Polish What's new in MUI X blog titles (#12309) @oliviertassinari
276
+ - [docs] Polish What's new in MUI X blog titles (#12309) @oliviertassinari
94
277
  - [docs] Replace `rel="noreferrer"` by `rel="noopener"` @oliviertassinari
95
278
  - [docs] Update `date-fns` `weekStarsOn` overriding example (#12416) @LukasTy
96
279
 
@@ -252,7 +435,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-beta.5`.
252
435
  ### Docs
253
436
 
254
437
  - [docs] Fix image layout shift when loading @oliviertassinari
255
- - [docs] Match Material UI repo comment for redirections @oliviertassinari
438
+ - [docs] Match Material UI repo comment for redirections @oliviertassinari
256
439
  - [docs] Non breaking spaces @oliviertassinari
257
440
  - [docs] Polish the Date Picker playground (#11869) @zanivan
258
441
  - [docs] Standardize WAI-ARIA references @oliviertassinari
@@ -263,9 +446,9 @@ Same changes as in `@mui/x-date-pickers@7.0.0-beta.5`.
263
446
  - [core] Remove grid folder from `getComponentInfo` RegExp (#12241) @flaviendelangle
264
447
  - [core] Remove `window.` reference for common globals @oliviertassinari
265
448
  - [core] Use runtime agnostic setTimeout type @oliviertassinari
266
- - [docs-infra] Fix Stack Overflow breaking space @oliviertassinari
449
+ - [docs-infra] Fix Stack Overflow breaking space @oliviertassinari
267
450
  - [docs-infra] Fix missing non breaking spaces @oliviertassinari
268
- - [github] Update `no-response` workflow (#12193) @MBilalShafi
451
+ - [infra] Update `no-response` workflow (#12193) @MBilalShafi
269
452
  - [infra] Fix missing permission reset @oliviertassinari
270
453
 
271
454
  ## 7.0.0-beta.4
@@ -282,7 +465,7 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
282
465
 
283
466
  ### Breaking changes
284
467
 
285
- - The support for IE11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE11 is no longer included.
468
+ - The support for IE11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE11 is no longer included.
286
469
 
287
470
  ### Data Grid
288
471
 
@@ -324,7 +507,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
324
507
  - The headless field hooks (e.g.: `useDateField`) now returns a new prop called `enableAccessibleFieldDOMStructure`.
325
508
  This property is utilized to determine whether the anticipated UI is constructed using an accessible DOM structure. Learn more about this new [accessible DOM structure](/x/react-date-pickers/fields/#accessible-dom-structure).
326
509
 
327
- When building a custom UI, you are most-likely only supporting one DOM structure, so you can remove `enableAccessibleFieldDOMStructure` before it is passed to the DOM:
510
+ When building a custom UI, you are most-likely only supporting one DOM structure, so you can remove `enableAccessibleFieldDOMStructure` before it is passed to the DOM:
328
511
 
329
512
  ```diff
330
513
  function MyCustomTextField(props) {
@@ -392,7 +575,7 @@ These components are no longer exported from `@mui/x-charts`:
392
575
  ### Docs
393
576
 
394
577
  - [docs] Add recipe for hiding separator on non-resizable columns (#12134) @michelengelen
395
- - [docs] Add small improvements to the Gauge Chart page (#12076) @danilo-leal
578
+ - [docs] Add small improvements to the Gauge page (#12076) @danilo-leal
396
579
  - [docs] Add the 'point' scaleType to the axis documentation (#12179) @alexfauquette
397
580
  - [docs] Clarify Pickers 'Component composition' section (#12097) @LukasTy
398
581
  - [docs] Fix "Licensing" page link (#12156) @LukasTy
@@ -975,7 +1158,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.9`.
975
1158
 
976
1159
  - [charts] Do not propagate `innerRadius` and `outerRadius` to the DOM (#11689) @alexfauquette
977
1160
  - [charts] Fix default `stackOffset` for `LineChart` (#11647) @alexfauquette
978
- - [charts] Remove a TS ignore (#11688) @alexfauquette
1161
+ - [charts] Remove a TypeScript ignore (#11688) @alexfauquette
979
1162
 
980
1163
  ### Tree View
981
1164
 
@@ -1404,7 +1587,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.7`.
1404
1587
  - [core] Fix release changelog (#11496) @romgrk
1405
1588
  - [core] Fix use of ::before & ::after (#11515) @oliviertassinari
1406
1589
  - [core] Localize the issue template to MUI X (#11511) @oliviertassinari
1407
- - [core] Regen api files (#11542) @flaviendelangle
1590
+ - [core] Regenerate API files (#11542) @flaviendelangle
1408
1591
  - [core] Remove issue emoji @oliviertassinari
1409
1592
  - [core] Sync the release instructions with MUI Core @oliviertassinari
1410
1593
  - [core] Yaml format match most common convention @oliviertassinari
@@ -1447,7 +1630,7 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
1447
1630
 
1448
1631
  - The `filterModel` now supports `Date` objects as values for `date` and `dateTime` column types.
1449
1632
  The `filterModel` still accepts strings as values for `date` and `dateTime` column types,
1450
- but all updates to the `filterModel` coming from the UI (e.g. filter panel) will set the value as a `Date` object.
1633
+ but all updates to the `filterModel` coming from the UI (for example filter panel) will set the value as a `Date` object.
1451
1634
 
1452
1635
  #### `@mui/x-data-grid@7.0.0-alpha.6`
1453
1636
 
@@ -1658,7 +1841,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.5`, plus:
1658
1841
  ### Core
1659
1842
 
1660
1843
  - [core] Automate cherry-pick of PRs from `next` -> `master` (#11382) @MBilalShafi
1661
- - [github] Update `no-response` workflow (#11369) @MBilalShafi
1844
+ - [infra] Update `no-response` workflow (#11369) @MBilalShafi
1662
1845
  - [test] Fix flaky screenshots (#11388) @cherniavskii
1663
1846
 
1664
1847
  ## 7.0.0-alpha.4
@@ -1896,7 +2079,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.3`.
1896
2079
 
1897
2080
  - [charts] Adjusted `defaultizeValueFormatter` util to accept an optional `series.valueFormatter` value (#11144) @michelengelen
1898
2081
  - [charts] Apply `labelStyle` and `tickLabelStyle` props on `<ChartsYAxis />` (#11180) @akamfoad
1899
- - [charts] Fix TS config (#11259) @alexfauquette
2082
+ - [charts] Fix TypeScript config (#11259) @alexfauquette
1900
2083
  - [charts] Fix error with empty dataset (#11063) @alexfauquette
1901
2084
  - [charts] Fix export strategy (#11235) @alexfauquette
1902
2085
  - [charts] Remove outdated prop-types (#11045) @alexfauquette
@@ -145,10 +145,10 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
145
145
  */
146
146
  clipboardCopyCellDelimiter: _propTypes.default.string,
147
147
  /**
148
- * Number of extra columns to be rendered before/after the visible slice.
149
- * @default 3
148
+ * Column region in pixels to render before/after the viewport
149
+ * @default 150
150
150
  */
151
- columnBuffer: _propTypes.default.number,
151
+ columnBufferPx: _propTypes.default.number,
152
152
  columnGroupingModel: _propTypes.default.arrayOf(_propTypes.default.object),
153
153
  /**
154
154
  * Sets the height in pixel of the column headers in the Data Grid.
@@ -159,11 +159,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
159
159
  * Set of columns of type [[GridColDef]][].
160
160
  */
161
161
  columns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
162
- /**
163
- * Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
164
- * @default 3
165
- */
166
- columnThreshold: _propTypes.default.number,
167
162
  /**
168
163
  * Set the column visibility model of the Data Grid.
169
164
  * If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
@@ -510,6 +505,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
510
505
  * @param {GridCallbackDetails} details Additional details for this callback.
511
506
  */
512
507
  onAggregationModelChange: _propTypes.default.func,
508
+ /**
509
+ * Callback fired before the clipboard paste operation starts.
510
+ * Use it to confirm or cancel the paste operation.
511
+ * @param {object} params Params passed to the callback.
512
+ * @param {string[][]} params.data The raw pasted data split by rows and cells.
513
+ * @returns {Promise<any>} A promise that resolves to confirm the paste operation, and rejects to cancel it.
514
+ */
515
+ onBeforeClipboardPasteStart: _propTypes.default.func,
513
516
  /**
514
517
  * Callback fired when any cell is clicked.
515
518
  * @param {GridCellParams} params With all properties from [[GridCellParams]].
@@ -637,6 +640,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
637
640
  * @param {GridCallbackDetails} details Additional details for this callback.
638
641
  */
639
642
  onColumnWidthChange: _propTypes.default.func,
643
+ /**
644
+ * Callback fired when the density changes.
645
+ * @param {GridDensity} density New density value.
646
+ */
647
+ onDensityChange: _propTypes.default.func,
640
648
  /**
641
649
  * Callback fired when the detail panel of a row is opened or closed.
642
650
  * @param {GridRowId[]} ids The ids of the rows which have the detail panel open.
@@ -838,10 +846,10 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
838
846
  */
839
847
  processRowUpdate: _propTypes.default.func,
840
848
  /**
841
- * Number of extra rows to be rendered before/after the visible slice.
842
- * @default 3
849
+ * Row region in pixels to render before/after the viewport
850
+ * @default 150
843
851
  */
844
- rowBuffer: _propTypes.default.number,
852
+ rowBufferPx: _propTypes.default.number,
845
853
  /**
846
854
  * Set the total number of rows, if it is different from the length of the value `rows` prop.
847
855
  * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
@@ -880,8 +888,9 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
880
888
  rowReordering: _propTypes.default.bool,
881
889
  /**
882
890
  * Set of rows of type [[GridRowsProp]].
891
+ * @default []
883
892
  */
884
- rows: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
893
+ rows: _propTypes.default.arrayOf(_propTypes.default.object),
885
894
  /**
886
895
  * If `false`, the row selection mode is disabled.
887
896
  * @default true
@@ -903,11 +912,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
903
912
  * @default "margin"
904
913
  */
905
914
  rowSpacingType: _propTypes.default.oneOf(['border', 'margin']),
906
- /**
907
- * Number of rows from the `rowBuffer` that can be visible before a new slice is rendered.
908
- * @default 3
909
- */
910
- rowThreshold: _propTypes.default.number,
911
915
  /**
912
916
  * Override the height/width of the Data Grid inner scrollbar.
913
917
  */
package/README.md CHANGED
@@ -15,7 +15,7 @@ This component has the following peer dependencies that you will need to install
15
15
 
16
16
  ```json
17
17
  "peerDependencies": {
18
- "@mui/material": "^5.15.0",
18
+ "@mui/material": "^5.15.14",
19
19
  "react": "^17.0.0 || ^18.0.0",
20
20
  "react-dom": "^17.0.0 || ^18.0.0"
21
21
  },
@@ -138,10 +138,10 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
138
138
  */
139
139
  clipboardCopyCellDelimiter: PropTypes.string,
140
140
  /**
141
- * Number of extra columns to be rendered before/after the visible slice.
142
- * @default 3
141
+ * Column region in pixels to render before/after the viewport
142
+ * @default 150
143
143
  */
144
- columnBuffer: PropTypes.number,
144
+ columnBufferPx: PropTypes.number,
145
145
  columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
146
146
  /**
147
147
  * Sets the height in pixel of the column headers in the Data Grid.
@@ -152,11 +152,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
152
152
  * Set of columns of type [[GridColDef]][].
153
153
  */
154
154
  columns: PropTypes.arrayOf(PropTypes.object).isRequired,
155
- /**
156
- * Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
157
- * @default 3
158
- */
159
- columnThreshold: PropTypes.number,
160
155
  /**
161
156
  * Set the column visibility model of the Data Grid.
162
157
  * If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
@@ -503,6 +498,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
503
498
  * @param {GridCallbackDetails} details Additional details for this callback.
504
499
  */
505
500
  onAggregationModelChange: PropTypes.func,
501
+ /**
502
+ * Callback fired before the clipboard paste operation starts.
503
+ * Use it to confirm or cancel the paste operation.
504
+ * @param {object} params Params passed to the callback.
505
+ * @param {string[][]} params.data The raw pasted data split by rows and cells.
506
+ * @returns {Promise<any>} A promise that resolves to confirm the paste operation, and rejects to cancel it.
507
+ */
508
+ onBeforeClipboardPasteStart: PropTypes.func,
506
509
  /**
507
510
  * Callback fired when any cell is clicked.
508
511
  * @param {GridCellParams} params With all properties from [[GridCellParams]].
@@ -630,6 +633,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
630
633
  * @param {GridCallbackDetails} details Additional details for this callback.
631
634
  */
632
635
  onColumnWidthChange: PropTypes.func,
636
+ /**
637
+ * Callback fired when the density changes.
638
+ * @param {GridDensity} density New density value.
639
+ */
640
+ onDensityChange: PropTypes.func,
633
641
  /**
634
642
  * Callback fired when the detail panel of a row is opened or closed.
635
643
  * @param {GridRowId[]} ids The ids of the rows which have the detail panel open.
@@ -831,10 +839,10 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
831
839
  */
832
840
  processRowUpdate: PropTypes.func,
833
841
  /**
834
- * Number of extra rows to be rendered before/after the visible slice.
835
- * @default 3
842
+ * Row region in pixels to render before/after the viewport
843
+ * @default 150
836
844
  */
837
- rowBuffer: PropTypes.number,
845
+ rowBufferPx: PropTypes.number,
838
846
  /**
839
847
  * Set the total number of rows, if it is different from the length of the value `rows` prop.
840
848
  * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
@@ -873,8 +881,9 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
873
881
  rowReordering: PropTypes.bool,
874
882
  /**
875
883
  * Set of rows of type [[GridRowsProp]].
884
+ * @default []
876
885
  */
877
- rows: PropTypes.arrayOf(PropTypes.object).isRequired,
886
+ rows: PropTypes.arrayOf(PropTypes.object),
878
887
  /**
879
888
  * If `false`, the row selection mode is disabled.
880
889
  * @default true
@@ -896,11 +905,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
896
905
  * @default "margin"
897
906
  */
898
907
  rowSpacingType: PropTypes.oneOf(['border', 'margin']),
899
- /**
900
- * Number of rows from the `rowBuffer` that can be visible before a new slice is rendered.
901
- * @default 3
902
- */
903
- rowThreshold: PropTypes.number,
904
908
  /**
905
909
  * Override the height/width of the Data Grid inner scrollbar.
906
910
  */
@@ -53,7 +53,6 @@ const useUtilityClasses = ownerState => {
53
53
  return composeClasses(slots, getDataGridUtilityClass, classes);
54
54
  };
55
55
  function GridAggregationHeader(props) {
56
- var _colDef$headerName;
57
56
  const {
58
57
  renderHeader
59
58
  } = props,
@@ -80,7 +79,7 @@ function GridAggregationHeader(props) {
80
79
  ownerState: ownerState,
81
80
  className: classes.root,
82
81
  children: [renderHeader ? renderHeader(params) : /*#__PURE__*/_jsx(GridColumnHeaderTitle, {
83
- label: (_colDef$headerName = colDef.headerName) != null ? _colDef$headerName : colDef.field,
82
+ label: colDef.headerName ?? colDef.field,
84
83
  description: colDef.description,
85
84
  columnWidth: colDef.computedWidth
86
85
  }), /*#__PURE__*/_jsx(GridAggregationFunctionLabel, {
@@ -44,13 +44,12 @@ function GridColumnMenuAggregationItem(props) {
44
44
  return '';
45
45
  }, [rootProps.aggregationFunctions, aggregationModel, colDef]);
46
46
  const handleAggregationItemChange = event => {
47
- var _event$target;
48
- const newAggregationItem = ((_event$target = event.target) == null ? void 0 : _event$target.value) || undefined;
47
+ const newAggregationItem = event.target?.value || undefined;
49
48
  const currentModel = gridAggregationModelSelector(apiRef);
50
49
  const _colDef$field = colDef.field,
51
50
  otherColumnItems = _objectWithoutPropertiesLoose(currentModel, [_colDef$field].map(_toPropertyKey));
52
51
  const newModel = newAggregationItem == null ? otherColumnItems : _extends({}, otherColumnItems, {
53
- [colDef == null ? void 0 : colDef.field]: newAggregationItem
52
+ [colDef?.field]: newAggregationItem
54
53
  });
55
54
  apiRef.current.setAggregationModel(newModel);
56
55
  apiRef.current.hideColumnMenu();
@@ -20,13 +20,12 @@ function GridColumnMenuRowGroupItem(props) {
20
20
  const columnsLookup = useGridSelector(apiRef, gridColumnLookupSelector);
21
21
  const rootProps = useGridRootProps();
22
22
  const renderUnGroupingMenuItem = field => {
23
- var _groupedColumn$header;
24
23
  const ungroupColumn = event => {
25
24
  apiRef.current.removeRowGroupingCriteria(field);
26
25
  onClick(event);
27
26
  };
28
27
  const groupedColumn = columnsLookup[field];
29
- const name = (_groupedColumn$header = groupedColumn.headerName) != null ? _groupedColumn$header : field;
28
+ const name = groupedColumn.headerName ?? field;
30
29
  return /*#__PURE__*/_jsxs(MenuItem, {
31
30
  onClick: ungroupColumn,
32
31
  disabled: !groupedColumn.groupable,
@@ -10,7 +10,6 @@ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  function GridColumnMenuRowUngroupItem(props) {
13
- var _columnsLookup$colDef;
14
13
  const {
15
14
  colDef,
16
15
  onClick
@@ -30,7 +29,7 @@ function GridColumnMenuRowUngroupItem(props) {
30
29
  apiRef.current.addRowGroupingCriteria(colDef.field);
31
30
  onClick(event);
32
31
  };
33
- const name = (_columnsLookup$colDef = columnsLookup[colDef.field].headerName) != null ? _columnsLookup$colDef : colDef.field;
32
+ const name = columnsLookup[colDef.field].headerName ?? colDef.field;
34
33
  if (rowGroupingModel.includes(colDef.field)) {
35
34
  return /*#__PURE__*/_jsxs(MenuItem, {
36
35
  onClick: ungroupColumn,
@@ -16,7 +16,7 @@ function GridExcelExportMenuItem(props) {
16
16
  return /*#__PURE__*/_jsx(MenuItem, _extends({
17
17
  onClick: () => {
18
18
  apiRef.current.exportDataAsExcel(options);
19
- hideMenu == null || hideMenu();
19
+ hideMenu?.();
20
20
  }
21
21
  }, other, {
22
22
  children: apiRef.current.getLocaleText('toolbarExportExcel')
@@ -3,7 +3,6 @@ import Box from '@mui/material/Box';
3
3
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  function GridGroupingColumnLeafCell(props) {
6
- var _props$formattedValue;
7
6
  const {
8
7
  rowNode
9
8
  } = props;
@@ -12,7 +11,7 @@ function GridGroupingColumnLeafCell(props) {
12
11
  sx: {
13
12
  ml: rootProps.rowGroupingColumnMode === 'multiple' ? 1 : theme => `calc(var(--DataGrid-cellOffsetMultiplier) * ${theme.spacing(rowNode.depth)})`
14
13
  },
15
- children: (_props$formattedValue = props.formattedValue) != null ? _props$formattedValue : props.value
14
+ children: props.formattedValue ?? props.value
16
15
  });
17
16
  }
18
17
  export { GridGroupingColumnLeafCell };
@@ -18,7 +18,6 @@ const useUtilityClasses = ownerState => {
18
18
  return composeClasses(slots, getDataGridUtilityClass, classes);
19
19
  };
20
20
  export function GridGroupingCriteriaCell(props) {
21
- var _filteredDescendantCo, _rootProps$slotProps;
22
21
  const {
23
22
  id,
24
23
  field,
@@ -33,7 +32,7 @@ export function GridGroupingCriteriaCell(props) {
33
32
  };
34
33
  const classes = useUtilityClasses(ownerState);
35
34
  const filteredDescendantCountLookup = useGridSelector(apiRef, gridFilteredDescendantCountLookupSelector);
36
- const filteredDescendantCount = (_filteredDescendantCo = filteredDescendantCountLookup[rowNode.id]) != null ? _filteredDescendantCo : 0;
35
+ const filteredDescendantCount = filteredDescendantCountLookup[rowNode.id] ?? 0;
37
36
  const Icon = rowNode.childrenExpanded ? rootProps.slots.groupingCriteriaCollapseIcon : rootProps.slots.groupingCriteriaExpandIcon;
38
37
  const handleKeyDown = event => {
39
38
  if (event.key === ' ') {
@@ -74,7 +73,7 @@ export function GridGroupingCriteriaCell(props) {
74
73
  onKeyDown: handleKeyDown,
75
74
  tabIndex: -1,
76
75
  "aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand')
77
- }, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseIconButton, {
76
+ }, rootProps.slotProps?.baseIconButton, {
78
77
  children: /*#__PURE__*/_jsx(Icon, {
79
78
  fontSize: "inherit"
80
79
  })
@@ -143,18 +143,18 @@ export const addFooterRows = ({
143
143
  * Compares two sets of aggregation rules to determine if they are equal or not.
144
144
  */
145
145
  export const areAggregationRulesEqual = (previousValue, newValue) => {
146
- const previousFields = Object.keys(previousValue != null ? previousValue : {});
146
+ const previousFields = Object.keys(previousValue ?? {});
147
147
  const newFields = Object.keys(newValue);
148
148
  if (!isDeepEqual(previousFields, newFields)) {
149
149
  return false;
150
150
  }
151
151
  return newFields.every(field => {
152
- const previousRule = previousValue == null ? void 0 : previousValue[field];
152
+ const previousRule = previousValue?.[field];
153
153
  const newRule = newValue[field];
154
- if ((previousRule == null ? void 0 : previousRule.aggregationFunction) !== (newRule == null ? void 0 : newRule.aggregationFunction)) {
154
+ if (previousRule?.aggregationFunction !== newRule?.aggregationFunction) {
155
155
  return false;
156
156
  }
157
- if ((previousRule == null ? void 0 : previousRule.aggregationFunctionName) !== (newRule == null ? void 0 : newRule.aggregationFunctionName)) {
157
+ if (previousRule?.aggregationFunctionName !== newRule?.aggregationFunctionName) {
158
158
  return false;
159
159
  }
160
160
  return true;
@@ -5,14 +5,13 @@ import { gridAggregationModelSelector } from './gridAggregationSelectors';
5
5
  import { getAggregationRules, mergeStateWithAggregationModel, areAggregationRulesEqual } from './gridAggregationUtils';
6
6
  import { createAggregationLookup } from './createAggregationLookup';
7
7
  export const aggregationStateInitializer = (state, props, apiRef) => {
8
- var _ref, _props$aggregationMod, _props$initialState;
9
8
  apiRef.current.caches.aggregation = {
10
9
  rulesOnLastColumnHydration: {},
11
10
  rulesOnLastRowHydration: {}
12
11
  };
13
12
  return _extends({}, state, {
14
13
  aggregation: {
15
- model: (_ref = (_props$aggregationMod = props.aggregationModel) != null ? _props$aggregationMod : (_props$initialState = props.initialState) == null || (_props$initialState = _props$initialState.aggregation) == null ? void 0 : _props$initialState.model) != null ? _ref : {}
14
+ model: props.aggregationModel ?? props.initialState?.aggregation?.model ?? {}
16
15
  }
17
16
  });
18
17
  };
@@ -85,11 +85,10 @@ export const useGridAggregationPreProcessors = (apiRef, props) => {
85
85
  });
86
86
  }, [apiRef, props.disableAggregation]);
87
87
  const stateRestorePreProcessing = React.useCallback((params, context) => {
88
- var _context$stateToResto;
89
88
  if (props.disableAggregation) {
90
89
  return params;
91
90
  }
92
- const aggregationModel = (_context$stateToResto = context.stateToRestore.aggregation) == null ? void 0 : _context$stateToResto.model;
91
+ const aggregationModel = context.stateToRestore.aggregation?.model;
93
92
  if (aggregationModel != null) {
94
93
  apiRef.current.setState(mergeStateWithAggregationModel(aggregationModel));
95
94
  }