@mui/x-data-grid 7.19.0 → 7.20.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 (77) hide show
  1. package/CHANGELOG.md +105 -13
  2. package/DataGrid/DataGrid.js +7 -0
  3. package/components/columnHeaders/GridColumnHeaderItem.js +1 -0
  4. package/hooks/core/useGridRefs.js +4 -0
  5. package/hooks/features/dimensions/useGridDimensions.js +2 -2
  6. package/hooks/features/editing/useGridCellEditing.js +3 -1
  7. package/hooks/features/editing/useGridRowEditing.js +3 -1
  8. package/hooks/features/events/useGridEvents.d.ts +1 -1
  9. package/hooks/features/events/useGridEvents.js +1 -0
  10. package/hooks/features/filter/gridFilterUtils.js +1 -1
  11. package/hooks/features/rowSelection/utils.js +6 -6
  12. package/hooks/features/rows/gridRowsUtils.js +1 -1
  13. package/hooks/features/rows/useGridRowSpanning.js +1 -1
  14. package/hooks/features/scroll/useGridScroll.js +7 -3
  15. package/hooks/features/sorting/gridSortingUtils.js +1 -1
  16. package/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
  17. package/hooks/utils/useGridApiContext.js +1 -1
  18. package/hooks/utils/useGridApiEventHandler.d.ts +1 -1
  19. package/hooks/utils/useGridApiEventHandler.js +1 -1
  20. package/hooks/utils/useGridConfiguration.js +1 -1
  21. package/hooks/utils/useGridPrivateApiContext.js +1 -1
  22. package/index.d.ts +2 -2
  23. package/index.js +3 -3
  24. package/joy/icons.js +0 -1
  25. package/locales/jaJP.js +4 -4
  26. package/models/api/gridApiCommunity.d.ts +1 -1
  27. package/models/api/gridCoreApi.d.ts +9 -1
  28. package/models/api/gridFilterApi.d.ts +1 -1
  29. package/models/events/gridEventLookup.d.ts +7 -0
  30. package/models/gridStateCommunity.d.ts +2 -2
  31. package/models/props/DataGridProps.d.ts +23 -14
  32. package/modern/DataGrid/DataGrid.js +7 -0
  33. package/modern/components/columnHeaders/GridColumnHeaderItem.js +1 -0
  34. package/modern/hooks/core/useGridRefs.js +4 -0
  35. package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
  36. package/modern/hooks/features/editing/useGridCellEditing.js +3 -1
  37. package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
  38. package/modern/hooks/features/events/useGridEvents.js +1 -0
  39. package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
  40. package/modern/hooks/features/rowSelection/utils.js +6 -6
  41. package/modern/hooks/features/rows/gridRowsUtils.js +1 -1
  42. package/modern/hooks/features/rows/useGridRowSpanning.js +1 -1
  43. package/modern/hooks/features/scroll/useGridScroll.js +7 -3
  44. package/modern/hooks/features/sorting/gridSortingUtils.js +1 -1
  45. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
  46. package/modern/hooks/utils/useGridApiContext.js +1 -1
  47. package/modern/hooks/utils/useGridApiEventHandler.js +1 -1
  48. package/modern/hooks/utils/useGridConfiguration.js +1 -1
  49. package/modern/hooks/utils/useGridPrivateApiContext.js +1 -1
  50. package/modern/index.js +3 -3
  51. package/modern/joy/icons.js +0 -1
  52. package/modern/locales/jaJP.js +4 -4
  53. package/modern/utils/domUtils.js +1 -1
  54. package/node/DataGrid/DataGrid.js +7 -0
  55. package/node/components/columnHeaders/GridColumnHeaderItem.js +1 -0
  56. package/node/hooks/core/useGridRefs.js +4 -0
  57. package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
  58. package/node/hooks/features/editing/useGridCellEditing.js +3 -1
  59. package/node/hooks/features/editing/useGridRowEditing.js +3 -1
  60. package/node/hooks/features/events/useGridEvents.js +1 -0
  61. package/node/hooks/features/filter/gridFilterUtils.js +1 -1
  62. package/node/hooks/features/rowSelection/utils.js +6 -6
  63. package/node/hooks/features/rows/gridRowsUtils.js +1 -1
  64. package/node/hooks/features/rows/useGridRowSpanning.js +1 -1
  65. package/node/hooks/features/scroll/useGridScroll.js +7 -3
  66. package/node/hooks/features/sorting/gridSortingUtils.js +1 -1
  67. package/node/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
  68. package/node/hooks/utils/useGridApiContext.js +1 -1
  69. package/node/hooks/utils/useGridApiEventHandler.js +1 -1
  70. package/node/hooks/utils/useGridConfiguration.js +1 -1
  71. package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
  72. package/node/index.js +1 -1
  73. package/node/joy/icons.js +0 -1
  74. package/node/locales/jaJP.js +4 -4
  75. package/node/utils/domUtils.js +1 -1
  76. package/package.json +4 -4
  77. package/utils/domUtils.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,96 @@
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.20.0
7
+
8
+ _Oct 11, 2024_
9
+
10
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 📚 Updated ["What's new"](https://mui.com/x/whats-new/) page giving more detailed overview of the latest new features and other highlights
13
+ - 📚 New [collapsible column groups demo](https://mui.com/x/react-data-grid/column-groups/#collapsible-column-groups) for the Data Grid component
14
+ - 📚 New [Tree Item Customization](https://mui.com/x/react-tree-view/tree-item-customization/) documentation to learn how to use the new APIs to create custom Tree Items. The old APIs (`props.ContentComponent` and `props.ContentProps`) have been deprecated and will be removed in the new major version of the Tree View component.
15
+ - 🌍 Improve Japanese (ja-JP) locale on the Data Grid component
16
+ - 🐞 Bugfixes
17
+ - 📚 Other documentation improvements
18
+
19
+ Special thanks go out to the community contributors who have helped make this release possible:
20
+ @k-rajat19, @kalyan90, @uma-neko, @vfbiby.
21
+ Following are all team members who have contributed to this release: @alelthomas, @arminmeh, @arthurbalduini,
22
+ @cherniavskii, @flaviendelangle, @JCQuintas, @MBilalShafi, @noraleonte, @oliviertassinari, @samuelsycamore, @siriwatknp.
23
+
24
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
25
+
26
+ ### Data Grid
27
+
28
+ #### `@mui/x-data-grid@7.20.0`
29
+
30
+ - [DataGrid] Add `onColumnHeaderContextMenu` event (#14734) @vfbiby
31
+ - [DataGrid] Avoid row spanning computation of outdated rows (#14902) @MBilalShafi
32
+ - [DataGrid] Fix scrollbar position not being updated after `scrollToIndexes` (#14888) @arminmeh
33
+ - [DataGrid] Pass `rowId` param to `processRowUpdate` (#14821) @k-rajat19
34
+ - [l10n] Improve Japanese (ja-JP) locale (#14870) @uma-neko
35
+
36
+ #### `@mui/x-data-grid-pro@7.20.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
37
+
38
+ Same changes as in `@mui/x-data-grid@7.20.0`, plus:
39
+
40
+ - [DataGridPro] Fix wording on the `rowSelectionPropagation` JSDoc and doc section (#14907) @flaviendelangle
41
+
42
+ #### `@mui/x-data-grid-premium@7.20.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
43
+
44
+ Same changes as in `@mui/x-data-grid-pro@7.20.0`.
45
+
46
+ ### Date and Time Pickers
47
+
48
+ #### `@mui/x-date-pickers@7.20.0`
49
+
50
+ - [pickers] Add `PageUp` and `PageDown` support for time components (#14812) @arthurbalduini
51
+ - [pickers] Fix regression on `PickerValidDate` (#14896) @flaviendelangle
52
+ - [pickers] Move the `DateFieldInPickerProps` interface to the `DatePicker` folder and rename it `DatePickerFieldProps` (same for time and date time) (#14828) @flaviendelangle
53
+
54
+ #### `@mui/x-date-pickers-pro@7.20.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
55
+
56
+ Same changes as in `@mui/x-date-pickers@7.20.0`.
57
+
58
+ ### Charts
59
+
60
+ #### `@mui/x-charts@7.20.0`
61
+
62
+ No changes since `@mui/x-charts@v7.19.0`.
63
+
64
+ #### `@mui/x-charts-pro@7.0.0-beta.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
65
+
66
+ Same changes as in `@mui/x-charts@7.20.0`.
67
+
68
+ ### Tree View
69
+
70
+ #### `@mui/x-tree-view@7.20.0`
71
+
72
+ - [TreeItem] Deprecate the `ContentComponent` and `ContentProps` props (#14908) @flaviendelangle
73
+ - [TreeView] Rework how items are being rendered in Rich Tree View components (#14749) @flaviendelangle
74
+
75
+ ### Docs
76
+
77
+ - [docs] Update "What's new" page (#14858) @cherniavskii
78
+ - [docs] Add collapsible column groups demo (#14818) @cherniavskii
79
+ - [docs] Add custom columns panel demo (#14825) @cherniavskii
80
+ - [docs] Capitalize all instances of "Data Grid" (#14884) @samuelsycamore
81
+ - [docs] Divide charts `tooltip` and `highlighting` pages (#14824) @JCQuintas
82
+ - [docs] Document the `TreeItem2` component and the `useTreeItem2` hook (#14551) @noraleonte
83
+ - [docs] Fix column pinning for "Disable detail panel content scroll" section (#14854 and #14885) @kalyan90
84
+ - [docs] Fix detail panel demo not working well with pinned columns (#14883) @cherniavskii
85
+ - [docs] New recipe of a read-only field (#14606) @flaviendelangle
86
+ - [docs] Change demo name example (#14822) @alelthomas
87
+
88
+ ### Core
89
+
90
+ - [core] Support `@mui/utils` v6 (#14867) @siriwatknp
91
+ - [code-infra] Remove deprecated `data-mui-test` in favour of `data-testid` (#14882) @JCQuintas
92
+ - [code-infra] Update renovate config and add a `vitest` group (#14856) @JCQuintas
93
+ - [test] Replace `waitFor()` with `act()` (#14851) @oliviertassinari
94
+ - [test] Restore "pnpm tc" CLI (#14852) @oliviertassinari
95
+
6
96
  ## 7.19.0
7
97
 
8
98
  _Oct 4, 2024_
@@ -90,13 +180,13 @@ Same changes as in `@mui/x-charts@7.19.0`.
90
180
 
91
181
  - [TreeView] Apply experimental features in `getDefaultizedParams` instead of in the plugin render (#14661) @flaviendelangle
92
182
  - [TreeView] Export `publicAPI` form `useTreeItem2Utils` (#14729) @noraleonte
93
- - [TreeView] Fix cursor navigation interfering with browser shortcut keys (#14798) @sai6855
183
+ - [TreeView] Fix cursor navigation interfering with browser shortcut keys (#14798) @sai6855
94
184
  - [TreeView] Fix invalid test for items reordering (#14665) @flaviendelangle
95
185
  - [TreeView] Remove `instance.getTreeItemIdAttribute` (#14667) @flaviendelangle
96
186
 
97
187
  ### Docs
98
188
 
99
- - [docs] Added warning callout for Firefox reordering bug (#14516) @michelengelen
189
+ - [docs] Added warning callout for Firefox reordering bug (#14516) @michelengelen
100
190
  - [docs] Copyedit `pages.ts` navigation (#14782) @samuelsycamore
101
191
  - [docs] Fix typo in row spanning doc (#14770) @flaviendelangle
102
192
  - [docs] Fix typo in the Tree View migration guide to v7 (#14727) @Sanderand
@@ -121,7 +211,7 @@ We'd like to offer a big thanks to the 14 contributors who made this release pos
121
211
 
122
212
  - 💫 Support [Row spanning](https://mui.com/x/react-data-grid/row-spanning/) on the Data Grid that automatically merges the consecutive cells in a column based on the cell value
123
213
 
124
- <img width="600" src="https://github.com/user-attachments/assets/d32ec936-d238-4c92-9e1a-af6788d74cdf" alt="data grid row spanning" />
214
+ <img width="600" src="https://github.com/user-attachments/assets/d32ec936-d238-4c92-9e1a-af6788d74cdf" alt="Data Grid row spanning" />
125
215
 
126
216
  - ⏰ Support `date-fns` v4 (#14673) @LukasTy
127
217
  - 🎉 Add option for Pickers to change the order of displayed years (#11780) @thomasmoon
@@ -560,7 +650,7 @@ We'd like to offer a big thanks to the 12 contributors who made this release pos
560
650
  #### `@mui/x-data-grid@7.13.0`
561
651
 
562
652
  - [DataGrid] Fix CSV export for `null` and `undefined` values (#14166) @k-rajat19
563
- - [DataGrid] Fix error logged during skeleton loading with nested data grid (#14186) @KenanYusuf
653
+ - [DataGrid] Fix error logged during skeleton loading with nested Data Grid (#14186) @KenanYusuf
564
654
  - [DataGrid] Remove needless check in `useGridStateInitialization` (#14181) @k-rajat19
565
655
  - [DataGrid] Add recipe for persisting filters in local storage (#14208) @cherniavskii
566
656
  - [l10n] Improve Vietnamese (vi-VN) locale (#14216) @hungnd-casso
@@ -678,6 +768,8 @@ Same changes as in `@mui/x-charts@7.12.1`, plus:
678
768
 
679
769
  #### `@mui/x-tree-view@7.12.1`
680
770
 
771
+ No changes since `@mui/x-tree-view@7.12.0`.
772
+
681
773
  ### Docs
682
774
 
683
775
  - [docs] Add a warning to promote the usage of `updateRows` (#14027) @MBilalShafi
@@ -1528,7 +1620,7 @@ Same changes as in `@mui/x-date-pickers@7.6.0`.
1528
1620
  - [docs] Fix a small typo in property comment (#13245) @Janpot
1529
1621
  - [docs] Improve the Data Grid FAQ page (#13258) @MBilalShafi
1530
1622
  - [docs] Removes unused lines in TreeItem2 styling (#13264) @arthurbalduini
1531
- - [docs] Small improvements on accessibility data grid doc (#13233) @arthurbalduini
1623
+ - [docs] Small improvements on accessibility Data Grid doc (#13233) @arthurbalduini
1532
1624
  - [docs] Update Pickers demo configurations (#13303) @LukasTy
1533
1625
 
1534
1626
  ### Core
@@ -1542,7 +1634,7 @@ Same changes as in `@mui/x-date-pickers@7.6.0`.
1542
1634
  - [test] Use test-utils from npm (#12880) @michaldudak
1543
1635
  - [typescript] Remove duplicate `DateRangePosition` type in favor of `RangePosition` (#13288) @LukasTy
1544
1636
 
1545
- ## v7.5.1
1637
+ ## 7.5.1
1546
1638
 
1547
1639
  _May 23, 2024_
1548
1640
 
@@ -1602,7 +1694,7 @@ Same changes as in `@mui/x-date-pickers@7.5.1`.
1602
1694
  - [code-infra] Run corepack enable on all CI jobs (#13205) @Janpot
1603
1695
  - [code-infra] Use `nx` for lerna tasks (#13166) @LukasTy
1604
1696
 
1605
- ## v7.5.0
1697
+ ## 7.5.0
1606
1698
 
1607
1699
  _May 17, 2024_
1608
1700
 
@@ -2127,7 +2219,7 @@ Same changes as in `@mui/x-date-pickers@7.1.1`, plus:
2127
2219
  - [docs] Fix typo in `getItemId` prop description (#12637) @flaviendelangle
2128
2220
  - [docs] Make the Charts `margin` usage more visible (#12591) @alexfauquette
2129
2221
  - [docs] Match IE 11 spacing with Material UI @oliviertassinari
2130
- - [docs] Move data grid interfaces to standard API page layout (#12016) @alexfauquette
2222
+ - [docs] Move Data Grid interfaces to standard API page layout (#12016) @alexfauquette
2131
2223
  - [docs] Remove ` around @default values (#12158) @alexfauquette
2132
2224
  - [docs] Remove `day` from the default `dayOfWeekFormatter` function params (#12644) @LukasTy
2133
2225
  - [docs] Use `TreeItem2` for icon expansion example on `RichTreeView` (#12563) @flaviendelangle
@@ -3568,7 +3660,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.9`.
3568
3660
  - [docs] Fix generated tree view API docs (#11737) @LukasTy
3569
3661
  - [docs] Generate docs for Tree View slots (#11730) @flaviendelangle
3570
3662
  - [docs] Improve codemod for v7 (#11650) @oliviertassinari
3571
- - [docs] Improve data grid `pageSizeOptions` prop documentation (#11682) @oliviertassinari
3663
+ - [docs] Improve Data Grid `pageSizeOptions` prop documentation (#11682) @oliviertassinari
3572
3664
  - [docs] Parse markdown on API docs demo titles (#11728) @LukasTy
3573
3665
  - [docs] Remove the description from the `className` prop (#11693) @oliviertassinari
3574
3666
  - [docs] Uplift `SimpleTreeView` customization examples (#11424) @noraleonte
@@ -3656,8 +3748,8 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.8`.
3656
3748
  - [docs] Fix parsing of `x-date-pickers-pro` demo adapter imports (#11628) @LukasTy
3657
3749
  - [docs] Improve `git diff` format @oliviertassinari
3658
3750
  - [docs] Push up the MUI X brand (#11533) @oliviertassinari
3659
- - [docs] Remove old data grid translation files (#11646) @cherniavskii
3660
- - [docs] Improve Server-side data grid docs (#11589) @oliviertassinari
3751
+ - [docs] Remove old Data Grid translation files (#11646) @cherniavskii
3752
+ - [docs] Improve Server-side Data Grid docs (#11589) @oliviertassinari
3661
3753
  - [docs] Improve charts landing page (#11570) @oliviertassinari
3662
3754
 
3663
3755
  ### Core
@@ -4167,7 +4259,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
4167
4259
 
4168
4260
  - The clipboard related exports `ignoreValueFormatterDuringExport` and `splitClipboardPastedText` are no longer prefixed with `unstable_`.
4169
4261
 
4170
- - The deprecated constants `SUBMIT_FILTER_STROKE_TIME` and `SUBMIT_FILTER_DATE_STROKE_TIME` have been removed from the `DataGrid` exports. Use the [`filterDebounceMs`](https://next.mui.com/x/api/data-grid/data-grid/#data-grid-prop-filterDebounceMs) prop to customize filter debounce time.
4262
+ - The deprecated constants `SUBMIT_FILTER_STROKE_TIME` and `SUBMIT_FILTER_DATE_STROKE_TIME` have been removed from the Data Grid exports. Use the [`filterDebounceMs`](https://next.mui.com/x/api/data-grid/data-grid/#data-grid-prop-filterDebounceMs) prop to customize filter debounce time.
4171
4263
 
4172
4264
  - The `slots.preferencesPanel` slot and the `slotProps.preferencesPanel` prop were removed. Use `slots.panel` and `slotProps.panel` instead.
4173
4265
 
@@ -4879,7 +4971,7 @@ A special shoutout to thank the 12 contributors who made this release possible.
4879
4971
  - 🚀 First v7 alpha release
4880
4972
  - ✨ Fix aggregation label not showing when `renderHeader` is used (#10961) @cherniavskii
4881
4973
  - 📘 Server side data source [early documentation](https://mui.com/x/react-data-grid/server-side-data/)
4882
- - 💫 New recipes added for the data grid
4974
+ - 💫 New recipes added for the Data Grid
4883
4975
  - 📈 `<ChartsReferenceLine />` component is now available
4884
4976
  - 🌍 Add Basque (eu) locale, improve Czech (cs-CZ) and Spanish (es-ES) locales
4885
4977
  - 🐞 Bugfixes
@@ -438,6 +438,12 @@ DataGridRaw.propTypes = {
438
438
  * @param {GridCallbackDetails} details Additional details for this callback.
439
439
  */
440
440
  onColumnHeaderClick: PropTypes.func,
441
+ /**
442
+ * Callback fired when a contextmenu event comes from a column header element.
443
+ * @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
444
+ * @param {MuiEvent<React.MouseEvent>} event The event object.
445
+ */
446
+ onColumnHeaderContextMenu: PropTypes.func,
441
447
  /**
442
448
  * Callback fired when a double click event comes from a column header element.
443
449
  * @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
@@ -655,6 +661,7 @@ DataGridRaw.propTypes = {
655
661
  * @template R
656
662
  * @param {R} newRow Row object with the new values.
657
663
  * @param {R} oldRow Row object with the old values.
664
+ * @param {{ rowId: GridRowId }} params Additional parameters.
658
665
  * @returns {Promise<R> | R} The final values to update the row.
659
666
  */
660
667
  processRowUpdate: PropTypes.func,
@@ -92,6 +92,7 @@ function GridColumnHeaderItem(props) {
92
92
  }, [apiRef, colDef.field]);
93
93
  const mouseEventsHandlers = React.useMemo(() => ({
94
94
  onClick: publish('columnHeaderClick'),
95
+ onContextMenu: publish('columnHeaderContextMenu'),
95
96
  onDoubleClick: publish('columnHeaderDoubleClick'),
96
97
  onMouseOver: publish('columnHeaderOver'),
97
98
  // TODO remove as it's not used
@@ -3,6 +3,8 @@ export const useGridRefs = apiRef => {
3
3
  const rootElementRef = React.useRef(null);
4
4
  const mainElementRef = React.useRef(null);
5
5
  const virtualScrollerRef = React.useRef(null);
6
+ const virtualScrollbarVerticalRef = React.useRef(null);
7
+ const virtualScrollbarHorizontalRef = React.useRef(null);
6
8
  const columnHeadersContainerRef = React.useRef(null);
7
9
  apiRef.current.register('public', {
8
10
  rootElementRef
@@ -10,6 +12,8 @@ export const useGridRefs = apiRef => {
10
12
  apiRef.current.register('private', {
11
13
  mainElementRef,
12
14
  virtualScrollerRef,
15
+ virtualScrollbarVerticalRef,
16
+ virtualScrollbarHorizontalRef,
13
17
  columnHeadersContainerRef
14
18
  });
15
19
  };
@@ -238,11 +238,11 @@ export function useGridDimensions(apiRef, props) {
238
238
  // jsdom has no layout capabilities
239
239
  const isJSDOM = /jsdom/.test(window.navigator.userAgent);
240
240
  if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
241
- logger.error(['The parent DOM element of the data grid has an empty height.', 'Please make sure that this element has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
241
+ logger.error(['The parent DOM element of the Data Grid has an empty height.', 'Please make sure that this element has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
242
242
  errorShown.current = true;
243
243
  }
244
244
  if (size.width === 0 && !errorShown.current && !isJSDOM) {
245
- logger.error(['The parent DOM element of the data grid has an empty width.', 'Please make sure that this element has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
245
+ logger.error(['The parent DOM element of the Data Grid has an empty width.', 'Please make sure that this element has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
246
246
  errorShown.current = true;
247
247
  }
248
248
  if (isFirstSizing.current) {
@@ -324,7 +324,9 @@ export const useGridCellEditing = (apiRef, props) => {
324
324
  };
325
325
  try {
326
326
  const row = apiRef.current.getRow(id);
327
- Promise.resolve(processRowUpdate(rowUpdate, row)).then(finalRowUpdate => {
327
+ Promise.resolve(processRowUpdate(rowUpdate, row, {
328
+ rowId: id
329
+ })).then(finalRowUpdate => {
328
330
  apiRef.current.updateRows([finalRowUpdate]);
329
331
  finishCellEditMode();
330
332
  }).catch(handleError);
@@ -397,7 +397,9 @@ export const useGridRowEditing = (apiRef, props) => {
397
397
  }
398
398
  };
399
399
  try {
400
- Promise.resolve(processRowUpdate(rowUpdate, row)).then(finalRowUpdate => {
400
+ Promise.resolve(processRowUpdate(rowUpdate, row, {
401
+ rowId: id
402
+ })).then(finalRowUpdate => {
401
403
  apiRef.current.updateRows([finalRowUpdate]);
402
404
  finishRowEditMode();
403
405
  }).catch(handleError);
@@ -5,4 +5,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
5
5
  * @requires useGridFocus (event) - can be after, async only
6
6
  * @requires useGridColumns (event) - can be after, async only
7
7
  */
8
- export declare function useGridEvents(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'onColumnHeaderClick' | 'onColumnHeaderDoubleClick' | 'onColumnHeaderOver' | 'onColumnHeaderOut' | 'onColumnHeaderEnter' | 'onColumnHeaderLeave' | 'onCellClick' | 'onCellDoubleClick' | 'onCellKeyDown' | 'onPreferencePanelClose' | 'onPreferencePanelOpen' | 'onRowDoubleClick' | 'onRowClick' | 'onStateChange' | 'onMenuOpen' | 'onMenuClose'>): void;
8
+ export declare function useGridEvents(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'onColumnHeaderClick' | 'onColumnHeaderDoubleClick' | 'onColumnHeaderContextMenu' | 'onColumnHeaderOver' | 'onColumnHeaderOut' | 'onColumnHeaderEnter' | 'onColumnHeaderLeave' | 'onCellClick' | 'onCellDoubleClick' | 'onCellKeyDown' | 'onPreferencePanelClose' | 'onPreferencePanelOpen' | 'onRowDoubleClick' | 'onRowClick' | 'onStateChange' | 'onMenuOpen' | 'onMenuClose'>): void;
@@ -5,6 +5,7 @@ import { useGridApiOptionHandler } from "../../utils/useGridApiEventHandler.js";
5
5
  */
6
6
  export function useGridEvents(apiRef, props) {
7
7
  useGridApiOptionHandler(apiRef, 'columnHeaderClick', props.onColumnHeaderClick);
8
+ useGridApiOptionHandler(apiRef, 'columnHeaderContextMenu', props.onColumnHeaderContextMenu);
8
9
  useGridApiOptionHandler(apiRef, 'columnHeaderDoubleClick', props.onColumnHeaderDoubleClick);
9
10
  useGridApiOptionHandler(apiRef, 'columnHeaderOver', props.onColumnHeaderOver);
10
11
  useGridApiOptionHandler(apiRef, 'columnHeaderOut', props.onColumnHeaderOut);
@@ -41,7 +41,7 @@ export const sanitizeFilterModel = (model, disableMultipleColumnsFiltering, apiR
41
41
  let items;
42
42
  if (hasSeveralItems && disableMultipleColumnsFiltering) {
43
43
  if (process.env.NODE_ENV !== 'production') {
44
- warnOnce(['MUI X: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
44
+ warnOnce(['MUI X: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'], 'error');
45
45
  }
46
46
  items = [model.items[0]];
47
47
  } else {
@@ -44,21 +44,21 @@ export function getCheckboxPropsSelector(groupId, autoSelectParents) {
44
44
  isChecked: true
45
45
  };
46
46
  }
47
- let selectableDescendentsCount = 0;
48
- let selectedDescendentsCount = 0;
47
+ let selectableDescendantsCount = 0;
48
+ let selectedDescendantsCount = 0;
49
49
  const startIndex = sortedRowIds.findIndex(id => id === groupId) + 1;
50
50
  for (let index = startIndex; index < sortedRowIds.length && rowTree[sortedRowIds[index]]?.depth > groupNode.depth; index += 1) {
51
51
  const id = sortedRowIds[index];
52
52
  if (filteredRowsLookup[id] !== false) {
53
- selectableDescendentsCount += 1;
53
+ selectableDescendantsCount += 1;
54
54
  if (rowSelectionLookup[id] !== undefined) {
55
- selectedDescendentsCount += 1;
55
+ selectedDescendantsCount += 1;
56
56
  }
57
57
  }
58
58
  }
59
59
  return {
60
- isIndeterminate: selectedDescendentsCount > 0 && selectedDescendentsCount < selectableDescendentsCount || selectedDescendentsCount === selectableDescendentsCount && rowSelectionLookup[groupId] === undefined,
61
- isChecked: autoSelectParents ? selectedDescendentsCount > 0 : rowSelectionLookup[groupId] === groupId
60
+ isIndeterminate: selectedDescendantsCount > 0 && selectedDescendantsCount < selectableDescendantsCount || selectedDescendantsCount === selectableDescendantsCount && rowSelectionLookup[groupId] === undefined,
61
+ isChecked: autoSelectParents ? selectedDescendantsCount > 0 : rowSelectionLookup[groupId] === groupId
62
62
  };
63
63
  });
64
64
  }
@@ -24,7 +24,7 @@ export const buildRootGroup = () => ({
24
24
  */
25
25
  export function checkGridRowIdIsValid(id, row, detailErrorMessage = 'A row was provided without id in the rows prop:') {
26
26
  if (id == null) {
27
- throw new Error(['MUI X: The data grid component requires all rows to have a unique `id` property.', 'Alternatively, you can use the `getRowId` prop to specify a custom id for each row.', detailErrorMessage, JSON.stringify(row)].join('\n'));
27
+ throw new Error(['MUI X: The Data Grid component requires all rows to have a unique `id` property.', 'Alternatively, you can use the `getRowId` prop to specify a custom id for each row.', detailErrorMessage, JSON.stringify(row)].join('\n'));
28
28
  }
29
29
  }
30
30
  export const getRowIdFromRowModel = (rowModel, getRowId, detailErrorMessage) => {
@@ -202,7 +202,7 @@ export const useGridRowSpanning = (apiRef, props) => {
202
202
  }
203
203
  const rangeToProcess = getUnprocessedRange({
204
204
  firstRowIndex: renderContext.firstRowIndex,
205
- lastRowIndex: renderContext.lastRowIndex - 1
205
+ lastRowIndex: Math.min(renderContext.lastRowIndex - 1, range.lastRowIndex)
206
206
  }, processedRange.current);
207
207
  if (rangeToProcess === null) {
208
208
  return;
@@ -47,6 +47,8 @@ export const useGridScroll = (apiRef, props) => {
47
47
  const logger = useGridLogger(apiRef, 'useGridScroll');
48
48
  const colRef = apiRef.current.columnHeadersContainerRef;
49
49
  const virtualScrollerRef = apiRef.current.virtualScrollerRef;
50
+ const virtualScrollbarHorizontalRef = apiRef.current.virtualScrollbarHorizontalRef;
51
+ const virtualScrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
50
52
  const visibleSortedRows = useGridSelector(apiRef, gridExpandedSortedRowEntriesSelector);
51
53
  const scrollToIndexes = React.useCallback(params => {
52
54
  const dimensions = gridDimensionsSelector(apiRef.current.state);
@@ -100,18 +102,20 @@ export const useGridScroll = (apiRef, props) => {
100
102
  return false;
101
103
  }, [logger, apiRef, virtualScrollerRef, props.pagination, visibleSortedRows]);
102
104
  const scroll = React.useCallback(params => {
103
- if (virtualScrollerRef.current && params.left !== undefined && colRef.current) {
105
+ if (virtualScrollerRef.current && virtualScrollbarHorizontalRef.current && params.left !== undefined && colRef.current) {
104
106
  const direction = isRtl ? -1 : 1;
105
107
  colRef.current.scrollLeft = params.left;
106
108
  virtualScrollerRef.current.scrollLeft = direction * params.left;
109
+ virtualScrollbarHorizontalRef.current.scrollLeft = direction * params.left;
107
110
  logger.debug(`Scrolling left: ${params.left}`);
108
111
  }
109
- if (virtualScrollerRef.current && params.top !== undefined) {
112
+ if (virtualScrollerRef.current && virtualScrollbarVerticalRef.current && params.top !== undefined) {
110
113
  virtualScrollerRef.current.scrollTop = params.top;
114
+ virtualScrollbarVerticalRef.current.scrollTop = params.top;
111
115
  logger.debug(`Scrolling top: ${params.top}`);
112
116
  }
113
117
  logger.debug(`Scrolling, updating container, and viewport`);
114
- }, [virtualScrollerRef, isRtl, colRef, logger]);
118
+ }, [virtualScrollerRef, virtualScrollbarHorizontalRef, virtualScrollbarVerticalRef, isRtl, colRef, logger]);
115
119
  const getScrollPosition = React.useCallback(() => {
116
120
  if (!virtualScrollerRef?.current) {
117
121
  return {
@@ -3,7 +3,7 @@ import { warnOnce } from '@mui/x-internals/warning';
3
3
  export const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
4
4
  if (disableMultipleColumnsSorting && model.length > 1) {
5
5
  if (process.env.NODE_ENV !== 'production') {
6
- warnOnce(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
6
+ warnOnce(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'], 'error');
7
7
  }
8
8
  return [model[0]];
9
9
  }
@@ -73,8 +73,8 @@ export const useGridVirtualScroller = () => {
73
73
  const gridRootRef = apiRef.current.rootElementRef;
74
74
  const mainRef = apiRef.current.mainElementRef;
75
75
  const scrollerRef = apiRef.current.virtualScrollerRef;
76
- const scrollbarVerticalRef = React.useRef(null);
77
- const scrollbarHorizontalRef = React.useRef(null);
76
+ const scrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
77
+ const scrollbarHorizontalRef = apiRef.current.virtualScrollbarHorizontalRef;
78
78
  const contentHeight = dimensions.contentSize.height;
79
79
  const columnsTotalWidth = dimensions.columnsTotalWidth;
80
80
  const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
@@ -3,7 +3,7 @@ import { GridApiContext } from "../../components/GridApiContext.js";
3
3
  export function useGridApiContext() {
4
4
  const apiRef = React.useContext(GridApiContext);
5
5
  if (apiRef === undefined) {
6
- throw new Error(['MUI X: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
6
+ throw new Error(['MUI X: Could not find the Data Grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
7
7
  }
8
8
  return apiRef;
9
9
  }
@@ -5,7 +5,7 @@ import { CleanupTracking } from '../../utils/cleanupTracking/CleanupTracking';
5
5
  import type { GridApiCommon } from '../../models';
6
6
  /**
7
7
  * Signal to the underlying logic what version of the public component API
8
- * of the data grid is exposed.
8
+ * of the Data Grid is exposed.
9
9
  */
10
10
  declare enum GridSignature {
11
11
  DataGrid = "DataGrid",
@@ -3,7 +3,7 @@ import { TimerBasedCleanupTracking } from "../../utils/cleanupTracking/TimerBase
3
3
  import { FinalizationRegistryBasedCleanupTracking } from "../../utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js";
4
4
  /**
5
5
  * Signal to the underlying logic what version of the public component API
6
- * of the data grid is exposed.
6
+ * of the Data Grid is exposed.
7
7
  */
8
8
  var GridSignature = /*#__PURE__*/function (GridSignature) {
9
9
  GridSignature["DataGrid"] = "DataGrid";
@@ -3,7 +3,7 @@ import { GridConfigurationContext } from "../../components/GridConfigurationCont
3
3
  export const useGridConfiguration = () => {
4
4
  const configuration = React.useContext(GridConfigurationContext);
5
5
  if (configuration === undefined) {
6
- throw new Error(['MUI X: Could not find the data grid configuration context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
6
+ throw new Error(['MUI X: Could not find the Data Grid configuration context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
7
7
  }
8
8
  return configuration;
9
9
  };
@@ -6,7 +6,7 @@ if (process.env.NODE_ENV !== 'production') {
6
6
  export function useGridPrivateApiContext() {
7
7
  const privateApiRef = React.useContext(GridPrivateApiContext);
8
8
  if (privateApiRef === undefined) {
9
- throw new Error(['MUI X: Could not find the data grid private context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
9
+ throw new Error(['MUI X: Could not find the Data Grid private context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
10
10
  }
11
11
  return privateApiRef;
12
12
  }
package/index.d.ts CHANGED
@@ -27,10 +27,10 @@ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS, }
27
27
  */
28
28
  export type GridApi = GridApiCommunity;
29
29
  /**
30
- * The state of `DataGrid`.
30
+ * The state of Data Grid.
31
31
  */
32
32
  export type GridState = GridStateCommunity;
33
33
  /**
34
- * The initial state of `DataGrid`.
34
+ * The initial state of Data Grid.
35
35
  */
36
36
  export type GridInitialState = GridInitialStateCommunity;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.19.0
2
+ * @mui/x-data-grid v7.20.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -29,9 +29,9 @@ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } f
29
29
  */
30
30
 
31
31
  /**
32
- * The state of `DataGrid`.
32
+ * The state of Data Grid.
33
33
  */
34
34
 
35
35
  /**
36
- * The initial state of `DataGrid`.
36
+ * The initial state of Data Grid.
37
37
  */
package/joy/icons.js CHANGED
@@ -34,7 +34,6 @@ function createSvgIcon(path, displayName) {
34
34
  } = _ref,
35
35
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
36
36
  return /*#__PURE__*/_jsx(SvgIcon, _extends({
37
- "data-testid": `${displayName}Icon`,
38
37
  ref: ref,
39
38
  fill: "none",
40
39
  stroke: "currentColor",
package/locales/jaJP.js CHANGED
@@ -47,9 +47,9 @@ const jaJPGrid = {
47
47
  filterPanelInputPlaceholder: '値を入力…',
48
48
  // Filter operators text
49
49
  filterOperatorContains: '...を含む',
50
- // filterOperatorDoesNotContain: 'does not contain',
50
+ filterOperatorDoesNotContain: '...を含まない',
51
51
  filterOperatorEquals: '...に等しい',
52
- // filterOperatorDoesNotEqual: 'does not equal',
52
+ filterOperatorDoesNotEqual: '...に等しくない',
53
53
  filterOperatorStartsWith: '...で始まる',
54
54
  filterOperatorEndsWith: '...で終わる',
55
55
  filterOperatorIs: '...である',
@@ -69,9 +69,9 @@ const jaJPGrid = {
69
69
  'filterOperator<=': '<=',
70
70
  // Header filter operators text
71
71
  headerFilterOperatorContains: '含む',
72
- // headerFilterOperatorDoesNotContain: 'Does not contain',
72
+ headerFilterOperatorDoesNotContain: '含まない',
73
73
  headerFilterOperatorEquals: '等しい',
74
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
74
+ headerFilterOperatorDoesNotEqual: '等しくない',
75
75
  headerFilterOperatorStartsWith: 'で始まる',
76
76
  headerFilterOperatorEndsWith: 'で終わる',
77
77
  headerFilterOperatorIs: 'である',
@@ -5,7 +5,7 @@ import type { GridColumnReorderApi } from './gridColumnApi';
5
5
  import { GridRowProApi } from './gridRowApi';
6
6
  import { GridRowMultiSelectionApi } from './gridRowSelectionApi';
7
7
  /**
8
- * The api of `DataGrid`.
8
+ * The api of Data Grid.
9
9
  */
10
10
  export interface GridApiCommunity extends GridApiCommon<GridStateCommunity, GridInitialStateCommunity> {
11
11
  }
@@ -61,9 +61,17 @@ export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPri
61
61
  */
62
62
  mainElementRef: React.RefObject<HTMLDivElement>;
63
63
  /**
64
- * The React ref of the grid virtual scroller container element.
64
+ * The React ref of the grid's virtual scroller container element.
65
65
  */
66
66
  virtualScrollerRef: React.RefObject<HTMLDivElement>;
67
+ /**
68
+ * The React ref of the grid's vertical virtual scrollbar container element.
69
+ */
70
+ virtualScrollbarVerticalRef: React.RefObject<HTMLDivElement>;
71
+ /**
72
+ * The React ref of the grid's horizontal virtual scrollbar container element.
73
+ */
74
+ virtualScrollbarHorizontalRef: React.RefObject<HTMLDivElement>;
67
75
  /**
68
76
  * The React ref of the grid column container virtualized div element.
69
77
  */
@@ -59,7 +59,7 @@ export interface GridFilterApi {
59
59
  */
60
60
  ignoreDiacritics: DataGridProcessedProps['ignoreDiacritics'];
61
61
  /**
62
- * Returns the filter state for the given filter model without applying it to the data grid.
62
+ * Returns the filter state for the given filter model without applying it to the Data Grid.
63
63
  * @param {GridFilterModel} filterModel The filter model to get the state for.
64
64
  * @returns {GridStateCommunity['filter']} The filter state.
65
65
  */
@@ -92,6 +92,13 @@ export interface GridColumnHeaderEventLookup {
92
92
  params: GridColumnHeaderParams;
93
93
  event: React.MouseEvent<HTMLElement>;
94
94
  };
95
+ /**
96
+ * Fired when the user attempts to open a context menu in the column header.
97
+ */
98
+ columnHeaderContextMenu: {
99
+ params: GridColumnHeaderParams;
100
+ event: React.MouseEvent<HTMLElement>;
101
+ };
95
102
  /**
96
103
  * Fired when a column header is double-clicked.
97
104
  */
@@ -7,7 +7,7 @@ import type { GridVisibleRowsLookupState } from '../hooks/features/filter/gridFi
7
7
  import type { GridColumnResizeState } from '../hooks/features/columnResize';
8
8
  import type { GridRowSpanningState } from '../hooks/features/rows/useGridRowSpanning';
9
9
  /**
10
- * The state of `DataGrid`.
10
+ * The state of Data Grid.
11
11
  */
12
12
  export interface GridStateCommunity {
13
13
  isRtl: boolean;
@@ -34,7 +34,7 @@ export interface GridStateCommunity {
34
34
  rowSpanning: GridRowSpanningState;
35
35
  }
36
36
  /**
37
- * The initial state of `DataGrid`.
37
+ * The initial state of Data Grid.
38
38
  */
39
39
  export interface GridInitialStateCommunity {
40
40
  pagination?: GridPaginationInitialState;