@mui/x-data-grid 5.15.3 → 5.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/CHANGELOG.md +150 -1
  2. package/DataGrid/DataGrid.js +2 -0
  3. package/DataGrid/useDataGridComponent.js +5 -0
  4. package/components/DataGridColumnHeaders.js +4 -3
  5. package/components/GridRow.d.ts +2 -1
  6. package/components/GridRow.js +136 -85
  7. package/components/base/GridBody.js +8 -5
  8. package/components/base/GridOverlays.js +3 -3
  9. package/components/cell/GridBooleanCell.js +2 -1
  10. package/components/cell/GridCell.js +9 -1
  11. package/components/cell/GridEditBooleanCell.js +2 -1
  12. package/components/cell/GridEditDateCell.js +2 -1
  13. package/components/cell/GridEditInputCell.js +2 -1
  14. package/components/cell/GridEditSingleSelectCell.js +2 -1
  15. package/components/cell/GridSkeletonCell.d.ts +12 -0
  16. package/components/cell/GridSkeletonCell.js +60 -0
  17. package/components/cell/index.d.ts +1 -0
  18. package/components/cell/index.js +2 -1
  19. package/components/columnHeaders/GridColumnGroupHeader.d.ts +14 -0
  20. package/components/columnHeaders/GridColumnGroupHeader.js +122 -0
  21. package/components/columnHeaders/GridColumnHeaderItem.js +55 -71
  22. package/components/columnHeaders/GridColumnHeadersInner.js +2 -1
  23. package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +32 -0
  24. package/components/columnHeaders/GridGenericColumnHeaderItem.js +104 -0
  25. package/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
  26. package/components/containers/GridRoot.js +3 -3
  27. package/components/containers/GridRootStyles.js +16 -2
  28. package/components/panel/GridColumnsPanel.d.ts +6 -1
  29. package/components/panel/GridColumnsPanel.js +38 -6
  30. package/components/panel/GridPanel.d.ts +1 -1
  31. package/constants/defaultGridSlotsComponents.js +2 -1
  32. package/constants/gridClasses.d.ts +24 -0
  33. package/constants/gridClasses.js +1 -1
  34. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
  35. package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +7 -0
  36. package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
  37. package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +7 -0
  38. package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +8 -0
  39. package/hooks/features/columnGrouping/index.d.ts +2 -0
  40. package/hooks/features/columnGrouping/index.js +2 -0
  41. package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +24 -0
  42. package/hooks/features/columnGrouping/useGridColumnGrouping.js +153 -0
  43. package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.d.ts +4 -0
  44. package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +35 -0
  45. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +7 -6
  46. package/hooks/features/columnHeaders/useGridColumnHeaders.js +204 -9
  47. package/hooks/features/density/densitySelector.d.ts +2 -0
  48. package/hooks/features/density/densitySelector.js +3 -1
  49. package/hooks/features/density/densityState.d.ts +1 -0
  50. package/hooks/features/density/useGridDensity.d.ts +1 -1
  51. package/hooks/features/density/useGridDensity.js +45 -9
  52. package/hooks/features/dimensions/useGridDimensions.js +4 -4
  53. package/hooks/features/export/useGridPrintExport.js +3 -3
  54. package/hooks/features/filter/gridFilterSelector.d.ts +3 -3
  55. package/hooks/features/filter/gridFilterUtils.d.ts +1 -1
  56. package/hooks/features/filter/gridFilterUtils.js +55 -54
  57. package/hooks/features/filter/useGridFilter.js +1 -1
  58. package/hooks/features/focus/useGridFocus.js +13 -3
  59. package/hooks/features/index.d.ts +1 -0
  60. package/hooks/features/index.js +1 -0
  61. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
  62. package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -1
  63. package/hooks/features/rows/gridRowsSelector.d.ts +1 -1
  64. package/hooks/features/rows/useGridParamsApi.js +1 -1
  65. package/hooks/features/rows/useGridRows.js +65 -8
  66. package/hooks/features/rows/useGridRowsMeta.js +36 -16
  67. package/hooks/features/selection/gridSelectionSelector.d.ts +1 -1
  68. package/hooks/features/sorting/gridSortingSelector.d.ts +1 -1
  69. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -2
  70. package/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
  71. package/hooks/utils/useGridVisibleRows.d.ts +2 -2
  72. package/index.js +1 -1
  73. package/internals/index.d.ts +3 -1
  74. package/internals/index.js +3 -1
  75. package/legacy/DataGrid/DataGrid.js +2 -0
  76. package/legacy/DataGrid/useDataGridComponent.js +5 -0
  77. package/legacy/components/DataGridColumnHeaders.js +4 -3
  78. package/legacy/components/GridRow.js +138 -85
  79. package/legacy/components/base/GridBody.js +8 -5
  80. package/legacy/components/base/GridOverlays.js +3 -3
  81. package/legacy/components/cell/GridBooleanCell.js +2 -1
  82. package/legacy/components/cell/GridCell.js +11 -1
  83. package/legacy/components/cell/GridEditBooleanCell.js +2 -1
  84. package/legacy/components/cell/GridEditDateCell.js +2 -1
  85. package/legacy/components/cell/GridEditInputCell.js +2 -1
  86. package/legacy/components/cell/GridEditSingleSelectCell.js +2 -1
  87. package/legacy/components/cell/GridSkeletonCell.js +57 -0
  88. package/legacy/components/cell/index.js +2 -1
  89. package/legacy/components/columnHeaders/GridColumnGroupHeader.js +120 -0
  90. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +78 -88
  91. package/legacy/components/columnHeaders/GridColumnHeadersInner.js +2 -1
  92. package/legacy/components/columnHeaders/GridGenericColumnHeaderItem.js +112 -0
  93. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
  94. package/legacy/components/containers/GridRoot.js +3 -3
  95. package/legacy/components/containers/GridRootStyles.js +14 -5
  96. package/legacy/components/panel/GridColumnsPanel.js +41 -6
  97. package/legacy/constants/defaultGridSlotsComponents.js +2 -1
  98. package/legacy/constants/gridClasses.js +1 -1
  99. package/legacy/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
  100. package/legacy/hooks/features/columnGrouping/gridColumnGroupsSelector.js +12 -0
  101. package/legacy/hooks/features/columnGrouping/index.js +2 -0
  102. package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +151 -0
  103. package/legacy/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +35 -0
  104. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +213 -12
  105. package/legacy/hooks/features/density/densitySelector.js +6 -0
  106. package/legacy/hooks/features/density/useGridDensity.js +44 -6
  107. package/legacy/hooks/features/dimensions/useGridDimensions.js +4 -4
  108. package/legacy/hooks/features/export/useGridPrintExport.js +3 -3
  109. package/legacy/hooks/features/filter/gridFilterUtils.js +61 -56
  110. package/legacy/hooks/features/filter/useGridFilter.js +1 -1
  111. package/legacy/hooks/features/focus/useGridFocus.js +13 -3
  112. package/legacy/hooks/features/index.js +1 -0
  113. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
  114. package/legacy/hooks/features/rows/useGridParamsApi.js +1 -1
  115. package/legacy/hooks/features/rows/useGridRows.js +73 -8
  116. package/legacy/hooks/features/rows/useGridRowsMeta.js +45 -18
  117. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +31 -13
  118. package/legacy/index.js +1 -1
  119. package/legacy/internals/index.js +3 -1
  120. package/legacy/models/api/gridColumnGroupingApi.js +1 -0
  121. package/legacy/models/events/gridEvents.js +2 -0
  122. package/legacy/models/gridColumnGrouping.js +6 -0
  123. package/legacy/models/index.js +2 -1
  124. package/legacy/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
  125. package/legacy/models/params/index.js +2 -1
  126. package/legacy/utils/utils.js +18 -0
  127. package/models/api/gridApiCommon.d.ts +2 -1
  128. package/models/api/gridColumnGroupingApi.d.ts +19 -0
  129. package/models/api/gridColumnGroupingApi.js +1 -0
  130. package/models/api/gridDensityApi.d.ts +2 -1
  131. package/models/api/gridParamsApi.d.ts +1 -1
  132. package/models/api/gridRowApi.d.ts +6 -0
  133. package/models/api/gridRowsMetaApi.d.ts +6 -1
  134. package/models/colDef/gridColDef.d.ts +15 -1
  135. package/models/events/gridEventLookup.d.ts +7 -1
  136. package/models/events/gridEvents.d.ts +3 -1
  137. package/models/events/gridEvents.js +2 -0
  138. package/models/gridColumnGrouping.d.ts +67 -0
  139. package/models/gridColumnGrouping.js +6 -0
  140. package/models/gridRows.d.ts +5 -5
  141. package/models/gridSlotsComponent.d.ts +5 -0
  142. package/models/gridStateCommunity.d.ts +2 -1
  143. package/models/index.d.ts +1 -0
  144. package/models/index.js +2 -1
  145. package/models/params/gridCellParams.d.ts +7 -2
  146. package/models/params/gridRenderedRowsIntervalChangeParams.d.ts +10 -0
  147. package/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
  148. package/models/params/index.d.ts +1 -0
  149. package/models/params/index.js +2 -1
  150. package/models/props/DataGridProps.d.ts +6 -0
  151. package/modern/DataGrid/DataGrid.js +2 -0
  152. package/modern/DataGrid/useDataGridComponent.js +5 -0
  153. package/modern/components/DataGridColumnHeaders.js +4 -3
  154. package/modern/components/GridRow.js +133 -84
  155. package/modern/components/base/GridBody.js +8 -5
  156. package/modern/components/base/GridOverlays.js +3 -3
  157. package/modern/components/cell/GridBooleanCell.js +2 -1
  158. package/modern/components/cell/GridCell.js +9 -1
  159. package/modern/components/cell/GridEditBooleanCell.js +2 -1
  160. package/modern/components/cell/GridEditDateCell.js +2 -1
  161. package/modern/components/cell/GridEditInputCell.js +2 -1
  162. package/modern/components/cell/GridEditSingleSelectCell.js +2 -1
  163. package/modern/components/cell/GridSkeletonCell.js +60 -0
  164. package/modern/components/cell/index.js +2 -1
  165. package/modern/components/columnHeaders/GridColumnGroupHeader.js +120 -0
  166. package/modern/components/columnHeaders/GridColumnHeaderItem.js +53 -69
  167. package/modern/components/columnHeaders/GridColumnHeadersInner.js +2 -1
  168. package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +104 -0
  169. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
  170. package/modern/components/containers/GridRoot.js +3 -3
  171. package/modern/components/containers/GridRootStyles.js +16 -2
  172. package/modern/components/panel/GridColumnsPanel.js +38 -6
  173. package/modern/constants/defaultGridSlotsComponents.js +2 -1
  174. package/modern/constants/gridClasses.js +1 -1
  175. package/modern/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
  176. package/modern/hooks/features/columnGrouping/gridColumnGroupsSelector.js +8 -0
  177. package/modern/hooks/features/columnGrouping/index.js +2 -0
  178. package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +145 -0
  179. package/modern/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +29 -0
  180. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -9
  181. package/modern/hooks/features/density/densitySelector.js +3 -1
  182. package/modern/hooks/features/density/useGridDensity.js +37 -9
  183. package/modern/hooks/features/dimensions/useGridDimensions.js +4 -4
  184. package/modern/hooks/features/export/useGridPrintExport.js +3 -3
  185. package/modern/hooks/features/filter/gridFilterUtils.js +54 -53
  186. package/modern/hooks/features/filter/useGridFilter.js +1 -1
  187. package/modern/hooks/features/focus/useGridFocus.js +13 -3
  188. package/modern/hooks/features/index.js +1 -0
  189. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
  190. package/modern/hooks/features/rows/useGridParamsApi.js +1 -1
  191. package/modern/hooks/features/rows/useGridRows.js +65 -8
  192. package/modern/hooks/features/rows/useGridRowsMeta.js +36 -16
  193. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
  194. package/modern/index.js +1 -1
  195. package/modern/internals/index.js +3 -1
  196. package/modern/models/api/gridColumnGroupingApi.js +1 -0
  197. package/modern/models/events/gridEvents.js +2 -0
  198. package/modern/models/gridColumnGrouping.js +6 -0
  199. package/modern/models/index.js +2 -1
  200. package/modern/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
  201. package/modern/models/params/index.js +2 -1
  202. package/modern/utils/utils.js +16 -0
  203. package/node/DataGrid/DataGrid.js +2 -0
  204. package/node/DataGrid/useDataGridComponent.js +7 -0
  205. package/node/components/DataGridColumnHeaders.js +4 -3
  206. package/node/components/GridRow.js +136 -77
  207. package/node/components/base/GridBody.js +7 -4
  208. package/node/components/base/GridOverlays.js +2 -2
  209. package/node/components/cell/GridBooleanCell.js +2 -1
  210. package/node/components/cell/GridCell.js +9 -1
  211. package/node/components/cell/GridEditBooleanCell.js +2 -1
  212. package/node/components/cell/GridEditDateCell.js +2 -1
  213. package/node/components/cell/GridEditInputCell.js +2 -1
  214. package/node/components/cell/GridEditSingleSelectCell.js +2 -1
  215. package/node/components/cell/GridSkeletonCell.js +81 -0
  216. package/node/components/cell/index.js +13 -0
  217. package/node/components/columnHeaders/GridColumnGroupHeader.js +141 -0
  218. package/node/components/columnHeaders/GridColumnHeaderItem.js +53 -72
  219. package/node/components/columnHeaders/GridColumnHeadersInner.js +2 -1
  220. package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +126 -0
  221. package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
  222. package/node/components/containers/GridRoot.js +4 -4
  223. package/node/components/containers/GridRootStyles.js +16 -2
  224. package/node/components/panel/GridColumnsPanel.js +36 -5
  225. package/node/constants/defaultGridSlotsComponents.js +1 -0
  226. package/node/constants/gridClasses.js +1 -1
  227. package/node/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +5 -0
  228. package/node/hooks/features/columnGrouping/gridColumnGroupsSelector.js +18 -0
  229. package/node/hooks/features/columnGrouping/index.js +18 -0
  230. package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +182 -0
  231. package/node/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +55 -0
  232. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +207 -8
  233. package/node/hooks/features/density/densitySelector.js +6 -2
  234. package/node/hooks/features/density/useGridDensity.js +48 -9
  235. package/node/hooks/features/dimensions/useGridDimensions.js +3 -3
  236. package/node/hooks/features/export/useGridPrintExport.js +2 -2
  237. package/node/hooks/features/filter/gridFilterUtils.js +55 -55
  238. package/node/hooks/features/filter/useGridFilter.js +1 -1
  239. package/node/hooks/features/focus/useGridFocus.js +13 -3
  240. package/node/hooks/features/index.js +13 -0
  241. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
  242. package/node/hooks/features/rows/useGridParamsApi.js +1 -1
  243. package/node/hooks/features/rows/useGridRows.js +60 -7
  244. package/node/hooks/features/rows/useGridRowsMeta.js +35 -15
  245. package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
  246. package/node/index.js +1 -1
  247. package/node/internals/index.js +28 -0
  248. package/node/models/api/gridColumnGroupingApi.js +5 -0
  249. package/node/models/events/gridEvents.js +2 -0
  250. package/node/models/gridColumnGrouping.js +13 -0
  251. package/node/models/index.js +13 -0
  252. package/node/models/params/gridRenderedRowsIntervalChangeParams.js +5 -0
  253. package/node/models/params/index.js +13 -0
  254. package/node/utils/utils.js +18 -0
  255. package/package.json +3 -3
  256. package/utils/utils.d.ts +1 -0
  257. package/utils/utils.js +16 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,155 @@
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
+ ## 5.17.1
7
+
8
+ _Sep 5, 2022_
9
+
10
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🐞 Bugfixes
13
+
14
+ ### `@mui/x-data-grid@v5.17.1` / `@mui/x-data-grid-pro@v5.17.1` / `@mui/x-data-grid-premium@v5.17.1`
15
+
16
+ #### Changes
17
+
18
+ - [DataGrid] Fix cells being focused on mouseUp (#5980) @cherniavskii
19
+ - [DataGrid] Fix focused cell if column is spanned and new editing API is used (#5962) @m4theushw
20
+ - [DataGridPro] Fix import in lazy-loading causing a bundling error (#6031) @flaviendelangle
21
+
22
+ ## 5.17.0
23
+
24
+ _Sep 2, 2022_
25
+
26
+ 🎉 We are excited to finally introduce a stable release (v5.0.0) for the `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` packages!
27
+
28
+ If you are still using picker components from the `lab`, take a look at the [migration guide](https://mui.com/x/react-date-pickers/migration-lab/).
29
+
30
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
31
+
32
+ - 🎁 Implement Lazy loading (#5214) @DanailH
33
+
34
+ Pro users now can try the experimental lazy loading feature.
35
+ In a few steps, you can load your data on demand, as the rows are displayed.
36
+
37
+ To enable this feature, add `experimentalFeatures={{ lazyLoading: true }}`.
38
+ Lazy Loading requires a few other settings.
39
+ See the [documentation](https://mui.com/x/react-data-grid/row-updates/#lazy-loading) to explore the example in detail.
40
+
41
+ - 🚀 Improve `pickers` focus management (#5820) @alexfauquette
42
+ - 🎉 Enable disabling `day` on date range picker depending on `position` (#5773) @alexfauquette
43
+ - ✨ Various improvements
44
+ - 📚 Documentation improvements
45
+ - 🐞 Bugfixes
46
+
47
+ ### `@mui/x-data-grid@v5.17.0` / `@mui/x-data-grid-pro@v5.17.0` / `@mui/x-data-grid-premium@v5.17.0`
48
+
49
+ #### Changes
50
+
51
+ - [DataGrid] Add `sort` prop to columns panel slot (#5888) @gavbrennan
52
+ - [DataGrid] Do not throw if `fieldToFocus` cannot be found (#5871) @cherniavskii
53
+ - [DataGrid] Support `getRowId` in the `replaceRows` method (#5988) @flaviendelangle
54
+ - [DataGridPro] Add class name to row with open detail panel (#5924) @m4theushw
55
+ - [DataGridPro] Fix crash when using `pinnedRows` + `getRowClassName` props and `rows=[]` (#5851) @cherniavskii
56
+ - [DataGridPro] Fix filtering with inactive filter items (#5993) @alexfauquette
57
+ - [DataGridPro] Implement Lazy loading (#5214) @DanailH
58
+ - [DataGridPro] Support pinned columns and dynamic row height (#5782) @m4theushw
59
+ - [DataGridPremium] Add state initializer for column groups (#5963) @alexfauquette
60
+ - [DataGridPremium] Update grouping when `groupingValueGetter` changes (#5919) @flaviendelangle
61
+ - [DataGridPremium] Use the aggregated value on tree data real groups (#5953) @flaviendelangle
62
+
63
+ ### `@mui/x-date-pickers@v5.0.0` / `@mui/x-date-pickers-pro@v5.0.0`
64
+
65
+ #### Changes
66
+
67
+ - [DatePicker] Improve focus management (#5820) @alexfauquette
68
+ - [DateRangePicker] Enable disabling `day` depending on `position` (#5773) @alexfauquette
69
+ - [DateTimePicker] Create a new `tabs` component slot (#5972) @LukasTy
70
+ - [pickers] Do not forward validation props to the DOM on field components (#5971) @flaviendelangle
71
+ - [pickers] Do not hardcode `date-fns` elements in field components (#5975) @flaviendelangle
72
+ - [pickers] Do not require `date-fns` in `@mui/x-date-pickers-pro` (#5941) @flaviendelangle
73
+ - [pickers] Fix mobile picker not opening on label click (#5651) @LukasTy
74
+ - [pickers] Improve DOM event management on `useField` (#5901) @flaviendelangle
75
+ - [pickers] Include `community` package `themeAugmentation` in `pro` package types (#5969) @LukasTy
76
+ - [pickers] Rename `DateRangeField` into `SingleInputDateRangeField` (#5961) @flaviendelangle
77
+ - [pickers] Support `isSameError` on field components (#5984) @flaviendelangle
78
+
79
+ ### Docs
80
+
81
+ - [docs] Add `description` and `default` to pickers slots (#5893) @alexfauquette
82
+ - [docs] Fix typo (#5945) @wettopa
83
+ - [docs] Fix typo `onYearPicker` to `onYearChange` (#5954) @alexfauquette
84
+ - [docs] Update `GridCellParams`'s `value` description (#5849) @cherniavskii
85
+ - [docs] Update `README.md` to match Introduction section of the docs (#5754) @samuelsycamore
86
+
87
+ ### Core
88
+
89
+ - [core] Fix typo (#5990) @flaviendelangle
90
+ - [core] Remove old babel resolve rule (#5939) @oliviertassinari
91
+ - [core] Remove outdated TODO (#5956) @flaviendelangle
92
+ - [core] Upgrade monorepo (#5960) @cherniavskii
93
+ - [core] Fix statics (#5986) @DanailH
94
+ - [core] Remove unused dependencies (#5937) @oliviertassinari
95
+ - [license] Remove CLI (#5757) @flaviendelangle
96
+ - [test] Fix time zone sensitive test (#5955) @LukasTy
97
+ - [test] Use `userEvent.mousePress` instead of `fireClickEvent` (#5920) @cherniavskii
98
+
99
+ ## 5.16.0
100
+
101
+ _Aug 25, 2022_
102
+
103
+ We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
104
+
105
+ - 🎁 Introduce column grouping for data grid (#5133) @alexfauquette
106
+
107
+ You can now group columns using the `columnGroupingModel` prop. This lets you to display more structured data.
108
+
109
+ <img src="https://user-images.githubusercontent.com/45398769/186178366-4fba66b2-bf90-4c7a-9d83-940a7fc78704.png" width="800" />
110
+
111
+ To enable this feature, add `experimentalFeatures={{ columnGrouping: true }}`.
112
+ The grouping header can be fully customized.
113
+ See the [documentation](https://mui.com/x/react-data-grid/column-groups/) to explore everything it has to offer.
114
+
115
+ - 🐞 Bugfixes
116
+ - 🌏 New locales for pickers thanks to @tesseractjh and @drastus
117
+
118
+ ### `@mui/x-data-grid@v5.16.0` / `@mui/x-data-grid-pro@v5.16.0` / `@mui/x-data-grid-premium@v5.16.0`
119
+
120
+ #### Changes
121
+
122
+ - [DataGrid] Implement column grouping (#5133) @alexfauquette
123
+ - [DataGrid] Handle `disableVirtualization` prop change (#5889) @cherniavskii
124
+ - [DataGrid] Improve `GridRowModel` typing (#5734) @cherniavskii
125
+ - [DataGrid] Update deprecation note for `GridColDef` `hide` property (#5886) @cherniavskii
126
+
127
+ ### `@mui/x-date-pickers@v5.0.0-beta.7` / `@mui/x-date-pickers-pro@v5.0.0-beta.7`
128
+
129
+ #### Changes
130
+
131
+ - [DatePicker] Fix to pass down `className` prop provided on DatePicker to `renderInput` (#5471) @CruseCtrl
132
+ - [DatePicker] Improve `a11y` support (#5809) @LukasTy
133
+ - [pickers] Add `PaperContent` component slot (#5801) @LukasTy
134
+ - [pickers] Add a breaking change section in the migration guide (#5805) @alexfauquette
135
+ - [pickers] Add new translations to `localeText` (#5143) @alexfauquette
136
+ - [pickers] Document components slots (#4657) @flaviendelangle
137
+ - [pickers] Add new unstable field components (#5504) @flaviendelangle
138
+ - [pickers] Fallback to default `minDate` / `maxDate` when `null` value is passed (#5397) @flaviendelangle
139
+ - [l10n] Add Korean (ko-KR) locale (#5854) @tesseractjh
140
+ - [l10n] Add Polish (pl-PL) locale (#5833) @drastus
141
+
142
+ ### Docs
143
+
144
+ - [docs] Fix typo in `migration from lab` (#5277) @chuckwired
145
+ - [docs] Use `dayjs` instead of `date-fns` in doc examples (#5481) @flaviendelangle
146
+
147
+ ### Core
148
+
149
+ - [core] Clarify the scope of the license key used for tests and documentation (#5824) @oliviertassinari
150
+ - [core] Fix Typescript error on field hooks (#5892) @flaviendelangle
151
+ - [core] Memoize `columns` in `useDemoData` hook (#5848) @cherniavskii
152
+ - [core] Remove Firefox from the BrowserStack list (#5874) @DanailH
153
+ - [core] Small changes to the release script (#5840) @m4theushw
154
+
6
155
  ## 5.15.3
7
156
 
8
157
  _Aug 18, 2022_
@@ -529,7 +678,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
529
678
 
530
679
  **MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
531
680
 
532
- **YearPicker**: The prop `onYearPicker` has been removed, you can use `onChange` instead since every change is a year change
681
+ **YearPicker**: The prop `onYearChange` has been removed, you can use `onChange` instead since every change is a year change
533
682
 
534
683
  **DayPicker**: The prop `isDateDisabled` has been removed, you can now use the same validation props as for the other components (`maxDate`, `minDate`, `shouldDisableDate`, `disableFuture` and `disablePast`)
535
684
 
@@ -79,6 +79,7 @@ DataGridRaw.propTypes = {
79
79
  * @default 3
80
80
  */
81
81
  columnBuffer: PropTypes.number,
82
+ columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
82
83
 
83
84
  /**
84
85
  * Set of columns of type [[GridColumns]].
@@ -194,6 +195,7 @@ DataGridRaw.propTypes = {
194
195
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
195
196
  */
196
197
  experimentalFeatures: PropTypes.shape({
198
+ columnGrouping: PropTypes.bool,
197
199
  newEditingApi: PropTypes.bool,
198
200
  preventCommitWhileValidating: PropTypes.bool,
199
201
  warnIfFocusStateIsNotSynced: PropTypes.bool
@@ -25,6 +25,8 @@ import { useGridDimensions } from '../hooks/features/dimensions/useGridDimension
25
25
  import { rowsMetaStateInitializer, useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
26
26
  import { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
27
27
  import { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
28
+ import { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
29
+ import { useGridColumnGroupingPreProcessors } from '../hooks/features/columnGrouping/useGridColumnGroupingPreProcessors';
28
30
  export const useDataGridComponent = props => {
29
31
  var _props$experimentalFe, _props$experimentalFe2;
30
32
 
@@ -33,6 +35,7 @@ export const useDataGridComponent = props => {
33
35
  * Register all pre-processors called during state initialization here.
34
36
  */
35
37
 
38
+ useGridColumnGroupingPreProcessors(apiRef, props);
36
39
  useGridSelectionPreProcessors(apiRef, props);
37
40
  useGridRowsPreProcessors(apiRef);
38
41
  /**
@@ -41,6 +44,7 @@ export const useDataGridComponent = props => {
41
44
 
42
45
  useGridInitializeState(selectionStateInitializer, apiRef, props);
43
46
  useGridInitializeState(columnsStateInitializer, apiRef, props);
47
+ useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
44
48
  useGridInitializeState(rowsStateInitializer, apiRef, props);
45
49
  useGridInitializeState((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
46
50
  useGridInitializeState(focusStateInitializer, apiRef, props);
@@ -57,6 +61,7 @@ export const useDataGridComponent = props => {
57
61
  useGridRows(apiRef, props);
58
62
  useGridParamsApi(apiRef);
59
63
  useGridColumnSpanning(apiRef);
64
+ useGridColumnGrouping(apiRef, props);
60
65
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
61
66
  useGridEditing(apiRef, props);
62
67
  useGridFocus(apiRef, props);
@@ -18,7 +18,8 @@ export const DataGridColumnHeaders = /*#__PURE__*/React.forwardRef(function Grid
18
18
  isDragging,
19
19
  getRootProps,
20
20
  getInnerProps,
21
- getColumns
21
+ getColumnHeaders,
22
+ getColumnGroupHeaders
22
23
  } = useGridColumnHeaders({
23
24
  innerRef
24
25
  });
@@ -27,10 +28,10 @@ export const DataGridColumnHeaders = /*#__PURE__*/React.forwardRef(function Grid
27
28
  }, getRootProps(other), {
28
29
  children: [/*#__PURE__*/_jsx(GridScrollArea, {
29
30
  scrollDirection: "left"
30
- }), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
31
+ }), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
31
32
  isDragging: isDragging
32
33
  }, getInnerProps(), {
33
- children: getColumns()
34
+ children: [getColumnGroupHeaders(), getColumnHeaders()]
34
35
  })), /*#__PURE__*/_jsx(GridScrollArea, {
35
36
  scrollDirection: "right"
36
37
  })]
@@ -13,7 +13,6 @@ export interface GridRowProps {
13
13
  index: number;
14
14
  rowHeight: number | 'auto';
15
15
  containerWidth: number;
16
- row: GridRowModel;
17
16
  firstColumnToRender: number;
18
17
  lastColumnToRender: number;
19
18
  visibleColumns: GridStateColDef[];
@@ -21,6 +20,8 @@ export interface GridRowProps {
21
20
  cellFocus: GridCellIdentifier | null;
22
21
  cellTabIndex: GridCellIdentifier | null;
23
22
  editRowsState: GridEditRowsModel;
23
+ position: 'left' | 'center' | 'right';
24
+ row?: GridRowModel;
24
25
  isLastVisible?: boolean;
25
26
  onClick?: React.MouseEventHandler<HTMLDivElement>;
26
27
  onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
@@ -1,10 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
4
-
5
- /* eslint-disable jsx-a11y/click-events-have-key-events */
6
-
7
- /* eslint-disable jsx-a11y/interactive-supports-focus */
3
+ const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
8
4
  import * as React from 'react';
9
5
  import PropTypes from 'prop-types';
10
6
  import clsx from 'clsx';
@@ -22,6 +18,8 @@ import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
22
18
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
23
19
  import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
24
20
  import { gridRowTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
21
+ import { gridDensityHeaderGroupingMaxDepthSelector } from '../hooks/features/density/densitySelector';
22
+ import { randomNumberBetween } from '../utils/utils';
25
23
  import { jsx as _jsx } from "react/jsx-runtime";
26
24
  import { jsxs as _jsxs } from "react/jsx-runtime";
27
25
 
@@ -65,6 +63,7 @@ function GridRow(props) {
65
63
  row,
66
64
  index,
67
65
  style: styleProp,
66
+ position,
68
67
  rowHeight,
69
68
  className,
70
69
  visibleColumns,
@@ -82,8 +81,6 @@ function GridRow(props) {
82
81
  } = props,
83
82
  other = _objectWithoutPropertiesLoose(props, _excluded);
84
83
 
85
- const ariaRowIndex = index + 2; // 1 for the header row and 1 as it's 1-based
86
-
87
84
  const apiRef = useGridApiContext();
88
85
  const ref = React.useRef(null);
89
86
  const rootProps = useGridRootProps();
@@ -91,6 +88,9 @@ function GridRow(props) {
91
88
  const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
92
89
  const sortModel = useGridSelector(apiRef, gridSortModelSelector);
93
90
  const treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
91
+ const headerGroupingMaxDepth = useGridSelector(apiRef, gridDensityHeaderGroupingMaxDepthSelector);
92
+ const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
93
+
94
94
  const {
95
95
  hasScrollX,
96
96
  hasScrollY
@@ -110,9 +110,9 @@ function GridRow(props) {
110
110
  React.useLayoutEffect(() => {
111
111
  if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
112
112
  // Fallback for IE
113
- apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
113
+ apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight, position);
114
114
  }
115
- }, [apiRef, rowHeight, rowId]);
115
+ }, [apiRef, rowHeight, rowId, position]);
116
116
  React.useLayoutEffect(() => {
117
117
  if (currentPage.range) {
118
118
  // The index prop is relative to the rows from all pages. As example, the index prop of the
@@ -137,11 +137,11 @@ function GridRow(props) {
137
137
  const resizeObserver = new ResizeObserver(entries => {
138
138
  const [entry] = entries;
139
139
  const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
140
- apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
140
+ apiRef.current.unstable_storeRowHeightMeasurement(rowId, height, position);
141
141
  });
142
142
  resizeObserver.observe(rootElement);
143
143
  return () => resizeObserver.disconnect();
144
- }, [apiRef, currentPage.range, index, rowHeight, rowId]);
144
+ }, [apiRef, currentPage.range, index, rowHeight, rowId, position]);
145
145
  const publish = React.useCallback((eventName, propHandler) => event => {
146
146
  // Ignore portal
147
147
  // The target is not an element when triggered by a Select inside the cell
@@ -197,47 +197,9 @@ function GridRow(props) {
197
197
 
198
198
  publish('rowClick', onClick)(event);
199
199
  }, [apiRef, onClick, publish, rowId]);
200
+ const getCell = React.useCallback((column, cellProps) => {
201
+ var _rootProps$components;
200
202
 
201
- const style = _extends({}, styleProp, {
202
- maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
203
- // max-height doesn't support "auto"
204
- minHeight: rowHeight
205
- });
206
-
207
- const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
208
-
209
- if (sizes != null && sizes.spacingTop) {
210
- const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
211
- style[property] = sizes.spacingTop;
212
- }
213
-
214
- if (sizes != null && sizes.spacingBottom) {
215
- const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
216
- style[property] = sizes.spacingBottom;
217
- }
218
-
219
- let rowClassName = null;
220
-
221
- if (typeof rootProps.getRowClassName === 'function') {
222
- const indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
223
-
224
- const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
225
- isFirstVisible: indexRelativeToCurrentPage === 0,
226
- isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
227
- indexRelativeToCurrentPage
228
- });
229
-
230
- rowClassName = rootProps.getRowClassName(rowParams);
231
- }
232
-
233
- const cells = [];
234
-
235
- for (let i = 0; i < renderedColumns.length; i += 1) {
236
- const column = renderedColumns[i];
237
- const indexRelativeToAllColumns = firstColumnToRender + i;
238
- const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
239
- const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
240
- const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
241
203
  const cellParams = apiRef.current.getCellParams(rowId, column.field);
242
204
  const classNames = [];
243
205
  const disableDragEvents = rootProps.disableColumnReorder && column.disableReorder || !rootProps.rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
@@ -287,53 +249,141 @@ function GridRow(props) {
287
249
 
288
250
  const hasFocus = cellFocus !== null && cellFocus.id === rowId && cellFocus.field === column.field;
289
251
  const tabIndex = cellTabIndex !== null && cellTabIndex.id === rowId && cellTabIndex.field === column.field && cellParams.cellMode === 'view' ? 0 : -1;
252
+ return /*#__PURE__*/_jsx(rootProps.components.Cell, _extends({
253
+ value: cellParams.value,
254
+ field: column.field,
255
+ width: cellProps.width,
256
+ rowId: rowId,
257
+ height: rowHeight,
258
+ showRightBorder: cellProps.showRightBorder,
259
+ formattedValue: cellParams.formattedValue,
260
+ align: column.align || 'left',
261
+ cellMode: cellParams.cellMode,
262
+ colIndex: cellProps.indexRelativeToAllColumns,
263
+ isEditable: cellParams.isEditable,
264
+ hasFocus: hasFocus,
265
+ tabIndex: tabIndex,
266
+ className: clsx(classNames),
267
+ colSpan: cellProps.colSpan,
268
+ disableDragEvents: disableDragEvents
269
+ }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
270
+ children: content
271
+ }), column.field);
272
+ }, [apiRef, cellTabIndex, editRowsState, cellFocus, rootProps, row, rowHeight, rowId, treeDepth, sortModel.length]);
273
+ const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
274
+ let minHeight = rowHeight;
275
+
276
+ if (minHeight === 'auto' && sizes) {
277
+ let numberOfBaseSizes = 0;
278
+ const maximumSize = Object.entries(sizes).reduce((acc, [key, size]) => {
279
+ const isBaseHeight = /^base[A-Z]/.test(key);
280
+
281
+ if (!isBaseHeight) {
282
+ return acc;
283
+ }
284
+
285
+ numberOfBaseSizes += 1;
286
+
287
+ if (size > acc) {
288
+ return size;
289
+ }
290
+
291
+ return acc;
292
+ }, 0);
293
+
294
+ if (maximumSize > 0 && numberOfBaseSizes > 1) {
295
+ minHeight = maximumSize;
296
+ }
297
+ }
298
+
299
+ const style = _extends({}, styleProp, {
300
+ maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
301
+ // max-height doesn't support "auto"
302
+ minHeight
303
+ });
304
+
305
+ if (sizes != null && sizes.spacingTop) {
306
+ const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
307
+ style[property] = sizes.spacingTop;
308
+ }
309
+
310
+ if (sizes != null && sizes.spacingBottom) {
311
+ const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
312
+ style[property] = sizes.spacingBottom;
313
+ }
314
+
315
+ const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
316
+
317
+ if (typeof rootProps.getRowClassName === 'function') {
318
+ var _currentPage$range;
319
+
320
+ const indexRelativeToCurrentPage = index - (((_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0);
321
+
322
+ const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
323
+ isFirstVisible: indexRelativeToCurrentPage === 0,
324
+ isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
325
+ indexRelativeToCurrentPage
326
+ });
327
+
328
+ rowClassNames.push(rootProps.getRowClassName(rowParams));
329
+ }
330
+
331
+ const randomNumber = randomNumberBetween(10000, 20, 80);
332
+ const cells = [];
333
+
334
+ for (let i = 0; i < renderedColumns.length; i += 1) {
335
+ const column = renderedColumns[i];
336
+ const indexRelativeToAllColumns = firstColumnToRender + i;
337
+ const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
338
+ const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
339
+ const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
290
340
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
291
341
 
292
342
  if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
293
- var _rootProps$components;
294
-
295
- const {
296
- colSpan,
297
- width
298
- } = cellColSpanInfo.cellProps;
299
- cells.push( /*#__PURE__*/_jsx(rootProps.components.Cell, _extends({
300
- value: cellParams.value,
301
- field: column.field,
302
- width: width,
303
- rowId: rowId,
304
- height: rowHeight,
305
- showRightBorder: showRightBorder,
306
- formattedValue: cellParams.formattedValue,
307
- align: column.align || 'left',
308
- cellMode: cellParams.cellMode,
309
- colIndex: indexRelativeToAllColumns,
310
- isEditable: cellParams.isEditable,
311
- hasFocus: hasFocus,
312
- tabIndex: tabIndex,
313
- className: clsx(classNames),
314
- colSpan: colSpan,
315
- disableDragEvents: disableDragEvents
316
- }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
317
- children: content
318
- }), column.field));
343
+ if (row) {
344
+ const {
345
+ colSpan,
346
+ width
347
+ } = cellColSpanInfo.cellProps;
348
+ const cellProps = {
349
+ width,
350
+ colSpan,
351
+ showRightBorder,
352
+ indexRelativeToAllColumns
353
+ };
354
+ cells.push(getCell(column, cellProps));
355
+ } else {
356
+ const {
357
+ width
358
+ } = cellColSpanInfo.cellProps;
359
+ const contentWidth = Math.round(randomNumber());
360
+ cells.push( /*#__PURE__*/_jsx(rootProps.components.SkeletonCell, {
361
+ width: width,
362
+ contentWidth: contentWidth,
363
+ field: column.field,
364
+ align: column.align
365
+ }, column.field));
366
+ }
319
367
  }
320
368
  }
321
369
 
322
370
  const emptyCellWidth = containerWidth - columnsTotalWidth;
371
+ const eventHandlers = row ? {
372
+ onClick: publishClick,
373
+ onDoubleClick: publish('rowDoubleClick', onDoubleClick),
374
+ onMouseEnter: publish('rowMouseEnter', onMouseEnter),
375
+ onMouseLeave: publish('rowMouseLeave', onMouseLeave)
376
+ } : null;
323
377
  return /*#__PURE__*/_jsxs("div", _extends({
324
378
  ref: ref,
325
379
  "data-id": rowId,
326
380
  "data-rowindex": index,
327
381
  role: "row",
328
- className: clsx(rowClassName, classes.root, className),
382
+ className: clsx(...rowClassNames, classes.root, className),
329
383
  "aria-rowindex": ariaRowIndex,
330
384
  "aria-selected": selected,
331
- style: style,
332
- onClick: publishClick,
333
- onDoubleClick: publish('rowDoubleClick', onDoubleClick),
334
- onMouseEnter: publish('rowMouseEnter', onMouseEnter),
335
- onMouseLeave: publish('rowMouseLeave', onMouseLeave)
336
- }, other, {
385
+ style: style
386
+ }, eventHandlers, other, {
337
387
  children: [cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
338
388
  width: emptyCellWidth
339
389
  })]
@@ -358,8 +408,9 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
358
408
  index: PropTypes.number.isRequired,
359
409
  isLastVisible: PropTypes.bool,
360
410
  lastColumnToRender: PropTypes.number.isRequired,
411
+ position: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
361
412
  renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
362
- row: PropTypes.any.isRequired,
413
+ row: PropTypes.object,
363
414
  rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
364
415
  rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
365
416
  selected: PropTypes.bool.isRequired,
@@ -6,7 +6,7 @@ import { GridAutoSizer } from '../GridAutoSizer';
6
6
  import { GridOverlays } from './GridOverlays';
7
7
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
8
8
  import { useGridSelector } from '../../hooks/utils/useGridSelector';
9
- import { gridDensityHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
9
+ import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
 
@@ -18,14 +18,17 @@ function GridBody(props) {
18
18
  } = props;
19
19
  const apiRef = useGridApiContext();
20
20
  const rootProps = useGridRootProps();
21
- const headerHeight = useGridSelector(apiRef, gridDensityHeaderHeightSelector);
21
+ const totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
22
22
  const [isVirtualizationDisabled, setIsVirtualizationDisabled] = React.useState(rootProps.disableVirtualization);
23
23
  const disableVirtualization = React.useCallback(() => {
24
24
  setIsVirtualizationDisabled(true);
25
25
  }, []);
26
26
  const enableVirtualization = React.useCallback(() => {
27
27
  setIsVirtualizationDisabled(false);
28
- }, []); // The `useGridApiMethod` hook can't be used here, because it only installs the
28
+ }, []);
29
+ React.useEffect(() => {
30
+ setIsVirtualizationDisabled(rootProps.disableVirtualization);
31
+ }, [rootProps.disableVirtualization]); // The `useGridApiMethod` hook can't be used here, because it only installs the
29
32
  // method if it doesn't exist yet. Once installed, it's never updated again.
30
33
  // This break the methods above, since their closure comes from the first time
31
34
  // they were installed. Which means that calling `setIsVirtualizationDisabled`
@@ -60,8 +63,8 @@ function GridBody(props) {
60
63
  width: size.width,
61
64
  // If `autoHeight` is on, there will be no height value.
62
65
  // In this case, let the container to grow whatever it needs.
63
- height: size.height ? size.height - headerHeight : 'auto',
64
- marginTop: headerHeight
66
+ height: size.height ? size.height - totalHeaderHeight : 'auto',
67
+ marginTop: totalHeaderHeight
65
68
  };
66
69
  return /*#__PURE__*/_jsx(VirtualScrollerComponent, {
67
70
  ref: windowRef,
@@ -6,7 +6,7 @@ import { gridVisibleRowCountSelector } from '../../hooks/features/filter/gridFil
6
6
  import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/features/rows/gridRowsSelector';
7
7
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
8
8
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
- import { gridDensityHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
9
+ import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
 
12
12
  function GridOverlayWrapper(props) {
@@ -14,7 +14,7 @@ function GridOverlayWrapper(props) {
14
14
 
15
15
  const apiRef = useGridApiContext();
16
16
  const rootProps = useGridRootProps();
17
- const headerHeight = useGridSelector(apiRef, gridDensityHeaderHeightSelector);
17
+ const totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
18
18
  const [viewportInnerSize, setViewportInnerSize] = React.useState(() => {
19
19
  var _apiRef$current$getRo, _apiRef$current$getRo2;
20
20
 
@@ -43,7 +43,7 @@ function GridOverlayWrapper(props) {
43
43
  height,
44
44
  width: (_viewportInnerSize$wi = viewportInnerSize == null ? void 0 : viewportInnerSize.width) != null ? _viewportInnerSize$wi : 0,
45
45
  position: 'absolute',
46
- top: headerHeight,
46
+ top: totalHeaderHeight,
47
47
  bottom: height === 'auto' ? 0 : undefined
48
48
  }
49
49
  }, props));
@@ -123,7 +123,8 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
123
123
  tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
124
124
 
125
125
  /**
126
- * The cell value, but if the column has valueGetter, use getValue.
126
+ * The cell value.
127
+ * If the column has `valueGetter`, use `params.row` to directly access the fields.
127
128
  */
128
129
  value: PropTypes.any
129
130
  } : void 0;
@@ -98,6 +98,14 @@ function GridCell(props) {
98
98
  onMouseUp(event);
99
99
  }
100
100
  }, [apiRef, field, onMouseUp, rowId]);
101
+ const publishMouseDown = React.useCallback(eventName => event => {
102
+ const params = apiRef.current.getCellParams(rowId, field || '');
103
+ apiRef.current.publishEvent(eventName, params, event);
104
+
105
+ if (onMouseDown) {
106
+ onMouseDown(event);
107
+ }
108
+ }, [apiRef, field, onMouseDown, rowId]);
101
109
  const publish = React.useCallback((eventName, propHandler) => event => {
102
110
  // Ignore portal
103
111
  if (!event.currentTarget.contains(event.target)) {
@@ -202,7 +210,7 @@ function GridCell(props) {
202
210
  tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
203
211
  onClick: publish('cellClick', onClick),
204
212
  onDoubleClick: publish('cellDoubleClick', onDoubleClick),
205
- onMouseDown: publish('cellMouseDown', onMouseDown),
213
+ onMouseDown: publishMouseDown('cellMouseDown'),
206
214
  onMouseUp: publishMouseUp('cellMouseUp'),
207
215
  onKeyDown: publish('cellKeyDown', onKeyDown)
208
216
  }, draggableEventHandlers, other, {