@mui/x-data-grid 7.0.0-alpha.8 → 7.0.0-beta.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 (566) hide show
  1. package/CHANGELOG.md +508 -30
  2. package/DataGrid/DataGrid.js +6 -6
  3. package/DataGrid/useDataGridComponent.js +2 -1
  4. package/DataGrid/useDataGridProps.js +1 -0
  5. package/README.md +3 -3
  6. package/components/GridColumnHeaders.d.ts +3 -2
  7. package/components/GridColumnHeaders.js +3 -11
  8. package/components/GridDetailPanels.d.ts +5 -0
  9. package/components/GridDetailPanels.js +4 -0
  10. package/components/GridHeaders.d.ts +4 -0
  11. package/components/GridHeaders.js +53 -0
  12. package/components/GridPinnedRows.d.ts +7 -0
  13. package/components/GridPinnedRows.js +4 -0
  14. package/components/GridRow.d.ts +7 -4
  15. package/components/GridRow.js +161 -97
  16. package/components/GridScrollbarFillerCell.d.ts +7 -0
  17. package/components/GridScrollbarFillerCell.js +39 -0
  18. package/components/base/GridBody.d.ts +2 -13
  19. package/components/base/GridBody.js +2 -116
  20. package/components/base/GridOverlays.js +10 -21
  21. package/components/cell/GridActionsCellItem.d.ts +2 -2
  22. package/components/cell/GridCell.d.ts +15 -21
  23. package/components/cell/GridCell.js +67 -372
  24. package/components/columnHeaders/GridBaseColumnHeaders.js +1 -6
  25. package/components/columnHeaders/GridColumnHeaderItem.d.ts +2 -1
  26. package/components/columnHeaders/GridColumnHeaderItem.js +7 -3
  27. package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -0
  28. package/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -2
  29. package/components/columnHeaders/GridColumnHeadersInner.js +1 -2
  30. package/components/columnsManagement/GridColumnsManagement.d.ts +36 -0
  31. package/components/columnsManagement/GridColumnsManagement.js +260 -0
  32. package/components/columnsManagement/index.d.ts +1 -0
  33. package/components/columnsManagement/index.js +1 -0
  34. package/components/columnsManagement/utils.d.ts +4 -0
  35. package/components/columnsManagement/utils.js +16 -0
  36. package/components/containers/GridRoot.js +18 -15
  37. package/components/containers/GridRootStyles.js +307 -204
  38. package/components/index.d.ts +1 -0
  39. package/components/index.js +1 -0
  40. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
  41. package/components/panel/GridColumnsPanel.d.ts +0 -28
  42. package/components/panel/GridColumnsPanel.js +5 -213
  43. package/components/panel/GridPanel.js +3 -4
  44. package/components/panel/filterPanel/GridFilterForm.d.ts +6 -4
  45. package/components/panel/filterPanel/GridFilterForm.js +31 -14
  46. package/components/panel/filterPanel/GridFilterPanel.js +46 -20
  47. package/components/toolbar/GridToolbarColumnsButton.d.ts +13 -1
  48. package/components/toolbar/GridToolbarColumnsButton.js +40 -22
  49. package/components/toolbar/GridToolbarDensitySelector.d.ts +13 -1
  50. package/components/toolbar/GridToolbarDensitySelector.js +40 -22
  51. package/components/toolbar/GridToolbarExport.d.ts +10 -1
  52. package/components/toolbar/GridToolbarExport.js +6 -1
  53. package/components/toolbar/GridToolbarExportContainer.d.ts +15 -1
  54. package/components/toolbar/GridToolbarExportContainer.js +41 -23
  55. package/components/toolbar/GridToolbarFilterButton.d.ts +5 -4
  56. package/components/toolbar/GridToolbarFilterButton.js +6 -10
  57. package/components/virtualization/GridBottomContainer.d.ts +2 -0
  58. package/components/virtualization/GridBottomContainer.js +25 -0
  59. package/components/{containers → virtualization}/GridMainContainer.d.ts +2 -0
  60. package/components/virtualization/GridMainContainer.js +20 -0
  61. package/components/virtualization/GridTopContainer.d.ts +2 -0
  62. package/components/virtualization/GridTopContainer.js +35 -0
  63. package/components/virtualization/GridVirtualScrollbar.d.ts +7 -0
  64. package/components/virtualization/GridVirtualScrollbar.js +131 -0
  65. package/components/virtualization/GridVirtualScroller.d.ts +4 -4
  66. package/components/virtualization/GridVirtualScroller.js +69 -16
  67. package/components/virtualization/GridVirtualScrollerFiller.d.ts +4 -0
  68. package/components/virtualization/GridVirtualScrollerFiller.js +71 -0
  69. package/components/virtualization/GridVirtualScrollerRenderZone.js +2 -1
  70. package/constants/defaultGridSlotsComponents.js +8 -3
  71. package/constants/gridClasses.d.ts +72 -12
  72. package/constants/gridClasses.js +1 -1
  73. package/constants/localeTextConstants.js +4 -6
  74. package/hooks/core/gridCoreSelector.d.ts +6 -0
  75. package/hooks/core/gridCoreSelector.js +5 -0
  76. package/hooks/core/useGridApiInitialization.js +4 -0
  77. package/hooks/core/useGridInitialization.js +4 -0
  78. package/hooks/core/useGridRefs.d.ts +3 -0
  79. package/hooks/core/useGridRefs.js +13 -0
  80. package/hooks/core/useGridTheme.d.ts +3 -0
  81. package/hooks/core/useGridTheme.js +19 -0
  82. package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
  83. package/hooks/features/columnGrouping/useGridColumnGrouping.js +7 -14
  84. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +13 -18
  85. package/hooks/features/columnHeaders/useGridColumnHeaders.js +68 -162
  86. package/hooks/features/columnMenu/useGridColumnMenu.js +28 -23
  87. package/hooks/features/columns/gridColumnsInterfaces.d.ts +17 -0
  88. package/hooks/features/columns/gridColumnsInterfaces.js +9 -1
  89. package/hooks/features/columns/gridColumnsSelector.d.ts +14 -1
  90. package/hooks/features/columns/gridColumnsSelector.js +52 -0
  91. package/hooks/features/columns/gridColumnsUtils.d.ts +1 -5
  92. package/hooks/features/columns/gridColumnsUtils.js +10 -12
  93. package/hooks/features/columns/index.d.ts +2 -2
  94. package/hooks/features/columns/index.js +2 -1
  95. package/hooks/features/columns/useGridColumnSpanning.js +62 -61
  96. package/hooks/features/columns/useGridColumns.js +20 -23
  97. package/hooks/features/dimensions/gridDimensionsApi.d.ts +60 -11
  98. package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +2 -0
  99. package/hooks/features/dimensions/gridDimensionsSelectors.js +1 -0
  100. package/hooks/features/dimensions/index.d.ts +2 -0
  101. package/hooks/features/dimensions/index.js +1 -0
  102. package/hooks/features/dimensions/useGridDimensions.d.ts +7 -1
  103. package/hooks/features/dimensions/useGridDimensions.js +216 -148
  104. package/hooks/features/export/serializers/csvSerializer.js +2 -2
  105. package/hooks/features/filter/useGridFilter.js +3 -3
  106. package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -2
  107. package/hooks/features/focus/gridFocusStateSelector.js +2 -6
  108. package/hooks/features/focus/useGridFocus.js +3 -3
  109. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +3 -16
  110. package/hooks/features/pagination/useGridPagination.js +3 -5
  111. package/hooks/features/rows/gridRowsInterfaces.d.ts +1 -0
  112. package/hooks/features/rows/gridRowsSelector.d.ts +2 -2
  113. package/hooks/features/rows/gridRowsSelector.js +5 -5
  114. package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  115. package/hooks/features/rows/gridRowsUtils.js +8 -5
  116. package/hooks/features/rows/useGridRowsMeta.js +7 -4
  117. package/hooks/features/scroll/useGridScroll.js +8 -10
  118. package/hooks/features/sorting/gridSortingUtils.js +1 -1
  119. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  120. package/hooks/features/sorting/useGridSorting.js +15 -10
  121. package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +14 -0
  122. package/hooks/features/virtualization/gridVirtualizationSelectors.js +22 -2
  123. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +27 -42
  124. package/hooks/features/virtualization/useGridVirtualScroller.js +441 -438
  125. package/hooks/features/virtualization/useGridVirtualization.d.ts +8 -0
  126. package/hooks/features/virtualization/useGridVirtualization.js +8 -1
  127. package/hooks/utils/index.d.ts +3 -0
  128. package/hooks/utils/index.js +4 -1
  129. package/hooks/utils/useGridAriaAttributes.js +1 -2
  130. package/hooks/utils/useGridNativeEventListener.js +4 -9
  131. package/hooks/utils/useResizeObserver.d.ts +2 -0
  132. package/hooks/utils/useResizeObserver.js +36 -0
  133. package/hooks/utils/useRunOnce.d.ts +5 -0
  134. package/hooks/utils/useRunOnce.js +18 -0
  135. package/index.js +1 -1
  136. package/internals/index.d.ts +12 -9
  137. package/internals/index.js +9 -7
  138. package/legacy/DataGrid/DataGrid.js +6 -6
  139. package/legacy/DataGrid/useDataGridComponent.js +2 -1
  140. package/legacy/DataGrid/useDataGridProps.js +1 -0
  141. package/legacy/components/GridColumnHeaders.js +3 -11
  142. package/legacy/components/GridDetailPanels.js +4 -0
  143. package/legacy/components/GridHeaders.js +53 -0
  144. package/legacy/components/GridPinnedRows.js +4 -0
  145. package/legacy/components/GridRow.js +159 -98
  146. package/legacy/components/GridScrollbarFillerCell.js +36 -0
  147. package/legacy/components/base/GridBody.js +2 -114
  148. package/legacy/components/base/GridOverlays.js +10 -25
  149. package/legacy/components/cell/GridCell.js +69 -377
  150. package/legacy/components/columnHeaders/GridBaseColumnHeaders.js +1 -6
  151. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +7 -3
  152. package/legacy/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -2
  153. package/legacy/components/columnHeaders/GridColumnHeadersInner.js +1 -2
  154. package/legacy/components/columnsManagement/GridColumnsManagement.js +300 -0
  155. package/legacy/components/columnsManagement/index.js +1 -0
  156. package/legacy/components/columnsManagement/utils.js +22 -0
  157. package/legacy/components/containers/GridRoot.js +18 -15
  158. package/legacy/components/containers/GridRootStyles.js +215 -137
  159. package/legacy/components/index.js +1 -0
  160. package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
  161. package/legacy/components/panel/GridColumnsPanel.js +5 -233
  162. package/legacy/components/panel/GridPanel.js +3 -4
  163. package/legacy/components/panel/filterPanel/GridFilterForm.js +30 -13
  164. package/legacy/components/panel/filterPanel/GridFilterPanel.js +49 -20
  165. package/legacy/components/toolbar/GridToolbarColumnsButton.js +40 -21
  166. package/legacy/components/toolbar/GridToolbarDensitySelector.js +40 -21
  167. package/legacy/components/toolbar/GridToolbarExport.js +6 -1
  168. package/legacy/components/toolbar/GridToolbarExportContainer.js +40 -21
  169. package/legacy/components/toolbar/GridToolbarFilterButton.js +6 -10
  170. package/legacy/components/virtualization/GridBottomContainer.js +25 -0
  171. package/legacy/components/virtualization/GridMainContainer.js +20 -0
  172. package/legacy/components/virtualization/GridTopContainer.js +35 -0
  173. package/legacy/components/virtualization/GridVirtualScrollbar.js +129 -0
  174. package/legacy/components/virtualization/GridVirtualScroller.js +67 -16
  175. package/legacy/components/virtualization/GridVirtualScrollerFiller.js +70 -0
  176. package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +2 -1
  177. package/legacy/constants/defaultGridSlotsComponents.js +8 -3
  178. package/legacy/constants/gridClasses.js +1 -1
  179. package/legacy/constants/localeTextConstants.js +4 -6
  180. package/legacy/hooks/core/gridCoreSelector.js +7 -0
  181. package/legacy/hooks/core/useGridApiInitialization.js +4 -0
  182. package/legacy/hooks/core/useGridInitialization.js +4 -0
  183. package/legacy/hooks/core/useGridRefs.js +13 -0
  184. package/legacy/hooks/core/useGridTheme.js +21 -0
  185. package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +7 -14
  186. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +69 -181
  187. package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +28 -23
  188. package/legacy/hooks/features/columns/gridColumnsInterfaces.js +9 -1
  189. package/legacy/hooks/features/columns/gridColumnsSelector.js +62 -0
  190. package/legacy/hooks/features/columns/gridColumnsUtils.js +10 -16
  191. package/legacy/hooks/features/columns/index.js +2 -1
  192. package/legacy/hooks/features/columns/useGridColumnSpanning.js +60 -59
  193. package/legacy/hooks/features/columns/useGridColumns.js +22 -23
  194. package/legacy/hooks/features/dimensions/gridDimensionsSelectors.js +3 -0
  195. package/legacy/hooks/features/dimensions/index.js +1 -0
  196. package/legacy/hooks/features/dimensions/useGridDimensions.js +226 -151
  197. package/legacy/hooks/features/export/serializers/csvSerializer.js +2 -2
  198. package/legacy/hooks/features/filter/useGridFilter.js +3 -3
  199. package/legacy/hooks/features/focus/gridFocusStateSelector.js +2 -6
  200. package/legacy/hooks/features/focus/useGridFocus.js +3 -3
  201. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +3 -16
  202. package/legacy/hooks/features/pagination/useGridPagination.js +3 -5
  203. package/legacy/hooks/features/rows/gridRowsSelector.js +5 -5
  204. package/legacy/hooks/features/rows/gridRowsUtils.js +8 -5
  205. package/legacy/hooks/features/rows/useGridRowsMeta.js +7 -4
  206. package/legacy/hooks/features/scroll/useGridScroll.js +8 -10
  207. package/legacy/hooks/features/sorting/gridSortingUtils.js +1 -1
  208. package/legacy/hooks/features/sorting/useGridSorting.js +15 -10
  209. package/legacy/hooks/features/virtualization/gridVirtualizationSelectors.js +29 -1
  210. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +490 -483
  211. package/legacy/hooks/features/virtualization/useGridVirtualization.js +8 -1
  212. package/legacy/hooks/utils/index.js +4 -1
  213. package/legacy/hooks/utils/useGridAriaAttributes.js +1 -2
  214. package/legacy/hooks/utils/useGridNativeEventListener.js +4 -9
  215. package/legacy/hooks/utils/useResizeObserver.js +36 -0
  216. package/legacy/hooks/utils/useRunOnce.js +18 -0
  217. package/legacy/index.js +1 -1
  218. package/legacy/internals/index.js +9 -7
  219. package/legacy/locales/arSD.js +5 -6
  220. package/legacy/locales/beBY.js +5 -6
  221. package/legacy/locales/bgBG.js +5 -6
  222. package/legacy/locales/csCZ.js +5 -6
  223. package/legacy/locales/daDK.js +5 -6
  224. package/legacy/locales/deDE.js +5 -6
  225. package/legacy/locales/elGR.js +5 -6
  226. package/legacy/locales/esES.js +5 -6
  227. package/legacy/locales/faIR.js +5 -6
  228. package/legacy/locales/fiFI.js +5 -6
  229. package/legacy/locales/frFR.js +5 -6
  230. package/legacy/locales/heIL.js +5 -6
  231. package/legacy/locales/hrHR.js +160 -0
  232. package/legacy/locales/huHU.js +5 -6
  233. package/legacy/locales/index.js +4 -1
  234. package/legacy/locales/itIT.js +5 -6
  235. package/legacy/locales/jaJP.js +5 -6
  236. package/legacy/locales/koKR.js +5 -6
  237. package/legacy/locales/nbNO.js +5 -6
  238. package/legacy/locales/nlNL.js +5 -6
  239. package/legacy/locales/plPL.js +5 -6
  240. package/legacy/locales/ptBR.js +5 -6
  241. package/legacy/locales/ptPT.js +160 -0
  242. package/legacy/locales/roRO.js +5 -6
  243. package/legacy/locales/ruRU.js +5 -6
  244. package/legacy/locales/skSK.js +5 -6
  245. package/legacy/locales/svSE.js +5 -6
  246. package/legacy/locales/trTR.js +5 -6
  247. package/legacy/locales/ukUA.js +5 -6
  248. package/legacy/locales/urPK.js +5 -6
  249. package/legacy/locales/viVN.js +5 -6
  250. package/legacy/locales/zhCN.js +5 -6
  251. package/legacy/locales/zhHK.js +160 -0
  252. package/legacy/locales/zhTW.js +5 -6
  253. package/legacy/models/index.js +0 -1
  254. package/legacy/models/params/index.js +1 -2
  255. package/legacy/utils/utils.js +10 -1
  256. package/locales/arSD.js +5 -6
  257. package/locales/beBY.js +5 -6
  258. package/locales/bgBG.js +5 -6
  259. package/locales/csCZ.js +5 -6
  260. package/locales/daDK.js +5 -6
  261. package/locales/deDE.js +5 -6
  262. package/locales/elGR.js +5 -6
  263. package/locales/esES.js +5 -6
  264. package/locales/faIR.js +5 -6
  265. package/locales/fiFI.js +5 -6
  266. package/locales/frFR.js +5 -6
  267. package/locales/heIL.js +5 -6
  268. package/locales/hrHR.d.ts +1 -0
  269. package/locales/hrHR.js +148 -0
  270. package/locales/huHU.js +5 -6
  271. package/locales/index.d.ts +3 -0
  272. package/locales/index.js +4 -1
  273. package/locales/itIT.js +5 -6
  274. package/locales/jaJP.js +5 -6
  275. package/locales/koKR.js +5 -6
  276. package/locales/nbNO.js +5 -6
  277. package/locales/nlNL.js +5 -6
  278. package/locales/plPL.js +5 -6
  279. package/locales/ptBR.js +5 -6
  280. package/locales/ptPT.d.ts +1 -0
  281. package/locales/ptPT.js +148 -0
  282. package/locales/roRO.js +5 -6
  283. package/locales/ruRU.js +5 -6
  284. package/locales/skSK.js +5 -6
  285. package/locales/svSE.js +5 -6
  286. package/locales/trTR.js +5 -6
  287. package/locales/ukUA.js +5 -6
  288. package/locales/urPK.js +5 -6
  289. package/locales/viVN.js +5 -6
  290. package/locales/zhCN.js +5 -6
  291. package/locales/zhHK.d.ts +1 -0
  292. package/locales/zhHK.js +148 -0
  293. package/locales/zhTW.js +5 -6
  294. package/models/api/gridColumnGroupingApi.d.ts +2 -2
  295. package/models/api/gridCoreApi.d.ts +16 -16
  296. package/models/api/gridLocaleTextApi.d.ts +3 -5
  297. package/models/api/gridRowsMetaApi.d.ts +1 -1
  298. package/models/api/gridVirtualizationApi.d.ts +2 -3
  299. package/models/colDef/gridColType.d.ts +11 -2
  300. package/models/events/gridEventLookup.d.ts +3 -3
  301. package/models/gridFilterModel.d.ts +1 -1
  302. package/models/gridSlotsComponent.d.ts +21 -2
  303. package/models/gridSlotsComponentsProps.d.ts +4 -0
  304. package/models/gridStateCommunity.d.ts +5 -1
  305. package/models/index.d.ts +0 -1
  306. package/models/index.js +0 -1
  307. package/models/params/index.d.ts +0 -1
  308. package/models/params/index.js +1 -2
  309. package/models/props/DataGridProps.d.ts +6 -11
  310. package/modern/DataGrid/DataGrid.js +6 -6
  311. package/modern/DataGrid/useDataGridComponent.js +2 -1
  312. package/modern/DataGrid/useDataGridProps.js +1 -0
  313. package/modern/components/GridColumnHeaders.js +3 -11
  314. package/modern/components/GridDetailPanels.js +4 -0
  315. package/modern/components/GridHeaders.js +53 -0
  316. package/modern/components/GridPinnedRows.js +4 -0
  317. package/modern/components/GridRow.js +159 -96
  318. package/modern/components/GridScrollbarFillerCell.js +39 -0
  319. package/modern/components/base/GridBody.js +2 -116
  320. package/modern/components/base/GridOverlays.js +10 -16
  321. package/modern/components/cell/GridCell.js +65 -369
  322. package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -6
  323. package/modern/components/columnHeaders/GridColumnHeaderItem.js +7 -3
  324. package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -2
  325. package/modern/components/columnHeaders/GridColumnHeadersInner.js +1 -1
  326. package/modern/components/columnsManagement/GridColumnsManagement.js +256 -0
  327. package/modern/components/columnsManagement/index.js +1 -0
  328. package/modern/components/columnsManagement/utils.js +16 -0
  329. package/modern/components/containers/GridRoot.js +18 -14
  330. package/modern/components/containers/GridRootStyles.js +307 -204
  331. package/modern/components/index.js +1 -0
  332. package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
  333. package/modern/components/panel/GridColumnsPanel.js +4 -209
  334. package/modern/components/panel/GridPanel.js +3 -4
  335. package/modern/components/panel/filterPanel/GridFilterForm.js +30 -13
  336. package/modern/components/panel/filterPanel/GridFilterPanel.js +46 -20
  337. package/modern/components/toolbar/GridToolbarColumnsButton.js +38 -21
  338. package/modern/components/toolbar/GridToolbarDensitySelector.js +38 -21
  339. package/modern/components/toolbar/GridToolbarExport.js +6 -1
  340. package/modern/components/toolbar/GridToolbarExportContainer.js +39 -22
  341. package/modern/components/toolbar/GridToolbarFilterButton.js +6 -10
  342. package/modern/components/virtualization/GridBottomContainer.js +25 -0
  343. package/modern/components/virtualization/GridMainContainer.js +20 -0
  344. package/modern/components/virtualization/GridTopContainer.js +35 -0
  345. package/modern/components/virtualization/GridVirtualScrollbar.js +131 -0
  346. package/modern/components/virtualization/GridVirtualScroller.js +69 -16
  347. package/modern/components/virtualization/GridVirtualScrollerFiller.js +71 -0
  348. package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +2 -1
  349. package/modern/constants/defaultGridSlotsComponents.js +8 -3
  350. package/modern/constants/gridClasses.js +1 -1
  351. package/modern/constants/localeTextConstants.js +4 -6
  352. package/modern/hooks/core/gridCoreSelector.js +5 -0
  353. package/modern/hooks/core/useGridApiInitialization.js +3 -0
  354. package/modern/hooks/core/useGridInitialization.js +4 -0
  355. package/modern/hooks/core/useGridRefs.js +13 -0
  356. package/modern/hooks/core/useGridTheme.js +19 -0
  357. package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +5 -12
  358. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +67 -160
  359. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +28 -23
  360. package/modern/hooks/features/columns/gridColumnsInterfaces.js +9 -1
  361. package/modern/hooks/features/columns/gridColumnsSelector.js +51 -0
  362. package/modern/hooks/features/columns/gridColumnsUtils.js +10 -12
  363. package/modern/hooks/features/columns/index.js +2 -1
  364. package/modern/hooks/features/columns/useGridColumnSpanning.js +62 -61
  365. package/modern/hooks/features/columns/useGridColumns.js +19 -21
  366. package/modern/hooks/features/dimensions/gridDimensionsSelectors.js +1 -0
  367. package/modern/hooks/features/dimensions/index.js +1 -0
  368. package/modern/hooks/features/dimensions/useGridDimensions.js +214 -146
  369. package/modern/hooks/features/export/serializers/csvSerializer.js +2 -2
  370. package/modern/hooks/features/filter/useGridFilter.js +3 -3
  371. package/modern/hooks/features/focus/gridFocusStateSelector.js +2 -6
  372. package/modern/hooks/features/focus/useGridFocus.js +3 -3
  373. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +3 -16
  374. package/modern/hooks/features/pagination/useGridPagination.js +3 -5
  375. package/modern/hooks/features/rows/gridRowsSelector.js +2 -2
  376. package/modern/hooks/features/rows/gridRowsUtils.js +8 -5
  377. package/modern/hooks/features/rows/useGridRowsMeta.js +7 -4
  378. package/modern/hooks/features/scroll/useGridScroll.js +8 -9
  379. package/modern/hooks/features/sorting/gridSortingUtils.js +1 -1
  380. package/modern/hooks/features/sorting/useGridSorting.js +15 -10
  381. package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +22 -2
  382. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +435 -432
  383. package/modern/hooks/features/virtualization/useGridVirtualization.js +8 -1
  384. package/modern/hooks/utils/index.js +4 -1
  385. package/modern/hooks/utils/useGridAriaAttributes.js +1 -1
  386. package/modern/hooks/utils/useGridNativeEventListener.js +3 -9
  387. package/modern/hooks/utils/useResizeObserver.js +36 -0
  388. package/modern/hooks/utils/useRunOnce.js +18 -0
  389. package/modern/index.js +1 -1
  390. package/modern/internals/index.js +9 -7
  391. package/modern/locales/arSD.js +5 -6
  392. package/modern/locales/beBY.js +5 -6
  393. package/modern/locales/bgBG.js +5 -6
  394. package/modern/locales/csCZ.js +5 -6
  395. package/modern/locales/daDK.js +5 -6
  396. package/modern/locales/deDE.js +5 -6
  397. package/modern/locales/elGR.js +5 -6
  398. package/modern/locales/esES.js +5 -6
  399. package/modern/locales/faIR.js +5 -6
  400. package/modern/locales/fiFI.js +5 -6
  401. package/modern/locales/frFR.js +5 -6
  402. package/modern/locales/heIL.js +5 -6
  403. package/modern/locales/hrHR.js +148 -0
  404. package/modern/locales/huHU.js +5 -6
  405. package/modern/locales/index.js +4 -1
  406. package/modern/locales/itIT.js +5 -6
  407. package/modern/locales/jaJP.js +5 -6
  408. package/modern/locales/koKR.js +5 -6
  409. package/modern/locales/nbNO.js +5 -6
  410. package/modern/locales/nlNL.js +5 -6
  411. package/modern/locales/plPL.js +5 -6
  412. package/modern/locales/ptBR.js +5 -6
  413. package/modern/locales/ptPT.js +148 -0
  414. package/modern/locales/roRO.js +5 -6
  415. package/modern/locales/ruRU.js +5 -6
  416. package/modern/locales/skSK.js +5 -6
  417. package/modern/locales/svSE.js +5 -6
  418. package/modern/locales/trTR.js +5 -6
  419. package/modern/locales/ukUA.js +5 -6
  420. package/modern/locales/urPK.js +5 -6
  421. package/modern/locales/viVN.js +5 -6
  422. package/modern/locales/zhCN.js +5 -6
  423. package/modern/locales/zhHK.js +148 -0
  424. package/modern/locales/zhTW.js +5 -6
  425. package/modern/models/index.js +0 -1
  426. package/modern/models/params/index.js +1 -2
  427. package/modern/utils/utils.js +10 -1
  428. package/node/DataGrid/DataGrid.js +6 -6
  429. package/node/DataGrid/useDataGridComponent.js +1 -0
  430. package/node/DataGrid/useDataGridProps.js +1 -0
  431. package/node/components/GridColumnHeaders.js +3 -11
  432. package/node/components/GridDetailPanels.js +10 -0
  433. package/node/components/GridHeaders.js +60 -0
  434. package/node/components/GridPinnedRows.js +10 -0
  435. package/node/components/GridRow.js +157 -94
  436. package/node/components/GridScrollbarFillerCell.js +47 -0
  437. package/node/components/base/GridBody.js +7 -118
  438. package/node/components/base/GridOverlays.js +9 -15
  439. package/node/components/cell/GridCell.js +66 -369
  440. package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -6
  441. package/node/components/columnHeaders/GridColumnHeaderItem.js +8 -4
  442. package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -2
  443. package/node/components/columnHeaders/GridColumnHeadersInner.js +1 -1
  444. package/node/components/columnsManagement/GridColumnsManagement.js +264 -0
  445. package/node/components/columnsManagement/index.js +16 -0
  446. package/node/components/columnsManagement/utils.js +24 -0
  447. package/node/components/containers/GridRoot.js +17 -14
  448. package/node/components/containers/GridRootStyles.js +175 -72
  449. package/node/components/index.js +11 -0
  450. package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
  451. package/node/components/panel/GridColumnsPanel.js +4 -208
  452. package/node/components/panel/GridPanel.js +3 -4
  453. package/node/components/panel/filterPanel/GridFilterForm.js +29 -12
  454. package/node/components/panel/filterPanel/GridFilterPanel.js +45 -19
  455. package/node/components/toolbar/GridToolbarColumnsButton.js +36 -20
  456. package/node/components/toolbar/GridToolbarDensitySelector.js +36 -20
  457. package/node/components/toolbar/GridToolbarExport.js +6 -1
  458. package/node/components/toolbar/GridToolbarExportContainer.js +37 -21
  459. package/node/components/toolbar/GridToolbarFilterButton.js +6 -10
  460. package/node/components/virtualization/GridBottomContainer.js +34 -0
  461. package/node/components/{containers → virtualization}/GridMainContainer.js +7 -29
  462. package/node/components/virtualization/GridTopContainer.js +44 -0
  463. package/node/components/virtualization/GridVirtualScrollbar.js +138 -0
  464. package/node/components/virtualization/GridVirtualScroller.js +69 -17
  465. package/node/components/virtualization/GridVirtualScrollerFiller.js +77 -0
  466. package/node/components/virtualization/GridVirtualScrollerRenderZone.js +2 -1
  467. package/node/constants/defaultGridSlotsComponents.js +6 -1
  468. package/node/constants/gridClasses.js +1 -1
  469. package/node/constants/localeTextConstants.js +4 -6
  470. package/node/hooks/core/gridCoreSelector.js +12 -0
  471. package/node/hooks/core/useGridApiInitialization.js +3 -0
  472. package/node/hooks/core/useGridInitialization.js +4 -0
  473. package/node/hooks/core/useGridRefs.js +22 -0
  474. package/node/hooks/core/useGridTheme.js +29 -0
  475. package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +5 -12
  476. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +65 -159
  477. package/node/hooks/features/columnMenu/useGridColumnMenu.js +28 -23
  478. package/node/hooks/features/columns/gridColumnsInterfaces.js +11 -1
  479. package/node/hooks/features/columns/gridColumnsSelector.js +52 -1
  480. package/node/hooks/features/columns/gridColumnsUtils.js +10 -13
  481. package/node/hooks/features/columns/index.js +22 -61
  482. package/node/hooks/features/columns/useGridColumnSpanning.js +62 -61
  483. package/node/hooks/features/columns/useGridColumns.js +20 -22
  484. package/node/hooks/features/dimensions/gridDimensionsSelectors.js +8 -0
  485. package/node/hooks/features/dimensions/index.js +11 -0
  486. package/node/hooks/features/dimensions/useGridDimensions.js +215 -144
  487. package/node/hooks/features/export/serializers/csvSerializer.js +2 -2
  488. package/node/hooks/features/filter/useGridFilter.js +2 -2
  489. package/node/hooks/features/focus/gridFocusStateSelector.js +3 -7
  490. package/node/hooks/features/focus/useGridFocus.js +2 -2
  491. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -15
  492. package/node/hooks/features/pagination/useGridPagination.js +3 -5
  493. package/node/hooks/features/rows/gridRowsSelector.js +2 -2
  494. package/node/hooks/features/rows/gridRowsUtils.js +8 -5
  495. package/node/hooks/features/rows/useGridRowsMeta.js +5 -3
  496. package/node/hooks/features/scroll/useGridScroll.js +8 -9
  497. package/node/hooks/features/sorting/gridSortingUtils.js +1 -1
  498. package/node/hooks/features/sorting/useGridSorting.js +15 -10
  499. package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +22 -2
  500. package/node/hooks/features/virtualization/useGridVirtualScroller.js +434 -431
  501. package/node/hooks/features/virtualization/useGridVirtualization.js +9 -1
  502. package/node/hooks/utils/index.js +36 -0
  503. package/node/hooks/utils/useGridAriaAttributes.js +1 -1
  504. package/node/hooks/utils/useGridNativeEventListener.js +3 -9
  505. package/node/hooks/utils/useResizeObserver.js +44 -0
  506. package/node/hooks/utils/useRunOnce.js +27 -0
  507. package/node/index.js +1 -1
  508. package/node/internals/index.js +86 -71
  509. package/node/locales/arSD.js +5 -6
  510. package/node/locales/beBY.js +5 -6
  511. package/node/locales/bgBG.js +5 -6
  512. package/node/locales/csCZ.js +5 -6
  513. package/node/locales/daDK.js +5 -6
  514. package/node/locales/deDE.js +5 -6
  515. package/node/locales/elGR.js +5 -6
  516. package/node/locales/esES.js +5 -6
  517. package/node/locales/faIR.js +5 -6
  518. package/node/locales/fiFI.js +5 -6
  519. package/node/locales/frFR.js +5 -6
  520. package/node/locales/heIL.js +5 -6
  521. package/node/locales/hrHR.js +154 -0
  522. package/node/locales/huHU.js +5 -6
  523. package/node/locales/index.js +33 -0
  524. package/node/locales/itIT.js +5 -6
  525. package/node/locales/jaJP.js +5 -6
  526. package/node/locales/koKR.js +5 -6
  527. package/node/locales/nbNO.js +5 -6
  528. package/node/locales/nlNL.js +5 -6
  529. package/node/locales/plPL.js +5 -6
  530. package/node/locales/ptBR.js +5 -6
  531. package/node/locales/ptPT.js +154 -0
  532. package/node/locales/roRO.js +5 -6
  533. package/node/locales/ruRU.js +5 -6
  534. package/node/locales/skSK.js +5 -6
  535. package/node/locales/svSE.js +5 -6
  536. package/node/locales/trTR.js +5 -6
  537. package/node/locales/ukUA.js +5 -6
  538. package/node/locales/urPK.js +5 -6
  539. package/node/locales/viVN.js +5 -6
  540. package/node/locales/zhCN.js +5 -6
  541. package/node/locales/zhHK.js +154 -0
  542. package/node/locales/zhTW.js +5 -6
  543. package/node/models/index.js +0 -11
  544. package/node/models/params/index.js +0 -11
  545. package/node/utils/utils.js +11 -1
  546. package/package.json +6 -6
  547. package/utils/utils.d.ts +6 -0
  548. package/utils/utils.js +10 -1
  549. package/components/DataGridVirtualScroller.d.ts +0 -3
  550. package/components/DataGridVirtualScroller.js +0 -35
  551. package/components/containers/GridMainContainer.js +0 -43
  552. package/legacy/components/DataGridVirtualScroller.js +0 -32
  553. package/legacy/components/containers/GridMainContainer.js +0 -45
  554. package/legacy/models/gridRootContainerRef.js +0 -1
  555. package/legacy/models/params/gridRenderedRowsIntervalChangeParams.js +0 -1
  556. package/models/gridRootContainerRef.d.ts +0 -5
  557. package/models/gridRootContainerRef.js +0 -1
  558. package/models/params/gridRenderedRowsIntervalChangeParams.d.ts +0 -10
  559. package/models/params/gridRenderedRowsIntervalChangeParams.js +0 -1
  560. package/modern/components/DataGridVirtualScroller.js +0 -35
  561. package/modern/components/containers/GridMainContainer.js +0 -42
  562. package/modern/models/gridRootContainerRef.js +0 -1
  563. package/modern/models/params/gridRenderedRowsIntervalChangeParams.js +0 -1
  564. package/node/components/DataGridVirtualScroller.js +0 -42
  565. package/node/models/gridRootContainerRef.js +0 -5
  566. package/node/models/params/gridRenderedRowsIntervalChangeParams.js +0 -5
@@ -1,9 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["changeReason", "unstable_updateValueOnRender"],
4
- _excluded2 = ["align", "children", "editCellState", "colIndex", "column", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "isSelected", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "isNotVisible", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
5
- _excluded3 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "isNotVisible", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
6
- _excluded4 = ["changeReason", "unstable_updateValueOnRender"];
3
+ const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "style", "gridHasScrollX", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
4
+ _excluded2 = ["changeReason", "unstable_updateValueOnRender"];
7
5
  import * as React from 'react';
8
6
  import PropTypes from 'prop-types';
9
7
  import clsx from 'clsx';
@@ -18,6 +16,12 @@ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
18
16
  import { gridFocusCellSelector } from '../../hooks/features/focus/gridFocusStateSelector';
19
17
  import { MissingRowIdError } from '../../hooks/features/rows/useGridParamsApi';
20
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
+ export let PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
20
+ PinnedPosition[PinnedPosition["NONE"] = 0] = "NONE";
21
+ PinnedPosition[PinnedPosition["LEFT"] = 1] = "LEFT";
22
+ PinnedPosition[PinnedPosition["RIGHT"] = 2] = "RIGHT";
23
+ return PinnedPosition;
24
+ }({});
21
25
  const EMPTY_CELL_PARAMS = {
22
26
  id: -1,
23
27
  field: '__unset__',
@@ -45,345 +49,25 @@ const EMPTY_CELL_PARAMS = {
45
49
  const useUtilityClasses = ownerState => {
46
50
  const {
47
51
  align,
52
+ showLeftBorder,
48
53
  showRightBorder,
54
+ pinnedPosition,
49
55
  isEditable,
50
56
  isSelected,
51
57
  isSelectionMode,
52
58
  classes
53
59
  } = ownerState;
54
60
  const slots = {
55
- root: ['cell', `cell--text${capitalize(align)}`, isEditable && 'cell--editable', isSelected && 'selected', showRightBorder && 'cell--withRightBorder', isSelectionMode && !isEditable && 'cell--selectionMode', 'withBorderColor'],
61
+ root: ['cell', `cell--text${capitalize(align)}`, isSelected && 'selected', isEditable && 'cell--editable', showLeftBorder && 'cell--withLeftBorder', showRightBorder && 'cell--withRightBorder', pinnedPosition === PinnedPosition.LEFT && 'cell--pinnedLeft', pinnedPosition === PinnedPosition.RIGHT && 'cell--pinnedRight', isSelectionMode && !isEditable && 'cell--selectionMode'],
56
62
  content: ['cellContent']
57
63
  };
58
64
  return composeClasses(slots, getDataGridUtilityClass, classes);
59
65
  };
60
66
  let warnedOnce = false;
61
67
 
62
- // GridCellWrapper is a compatibility layer for the V6 cell slot. If we can use the more efficient
63
- // `GridCellV7`, we should. That component is a merge of `GridCellWrapper` and `GridCell`.
64
- // TODO(v7): Remove the wrapper & cellV6 and use the cellV7 exclusively.
65
68
  // TODO(v7): Removing the wrapper will break the docs performance visualization demo.
66
- const GridCellWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
67
- const {
68
- column,
69
- rowId,
70
- editCellState
71
- } = props;
72
- const apiRef = useGridApiContext();
73
- const rootProps = useGridRootProps();
74
- const field = column.field;
75
- const cellParamsWithAPI = useGridSelector(apiRef, () => {
76
- // This is required because `.getCellParams` tries to get the `state.rows.tree` entry
77
- // associated with `rowId`/`fieldId`, but this selector runs after the state has been
78
- // updated, while `rowId`/`fieldId` reference an entry in the old state.
79
- try {
80
- const cellParams = apiRef.current.getCellParams(rowId, field);
81
- const result = cellParams;
82
- result.api = apiRef.current;
83
- return result;
84
- } catch (e) {
85
- if (e instanceof MissingRowIdError) {
86
- return EMPTY_CELL_PARAMS;
87
- }
88
- throw e;
89
- }
90
- }, objectShallowCompare);
91
- const isSelected = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
92
- id: rowId,
93
- field
94
- }));
95
- if (cellParamsWithAPI === EMPTY_CELL_PARAMS) {
96
- return null;
97
- }
98
- const {
99
- cellMode,
100
- hasFocus,
101
- isEditable,
102
- value,
103
- formattedValue
104
- } = cellParamsWithAPI;
105
- const managesOwnFocus = column.type === 'actions';
106
- const tabIndex = (cellMode === 'view' || !isEditable) && !managesOwnFocus ? cellParamsWithAPI.tabIndex : -1;
107
- const {
108
- classes: rootClasses,
109
- getCellClassName
110
- } = rootProps;
111
- const classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
112
- id: rowId,
113
- field
114
- });
115
- if (column.cellClassName) {
116
- classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParamsWithAPI) : column.cellClassName);
117
- }
118
- if (getCellClassName) {
119
- classNames.push(getCellClassName(cellParamsWithAPI));
120
- }
121
- let children;
122
- if (editCellState == null && column.renderCell) {
123
- children = column.renderCell(cellParamsWithAPI);
124
- classNames.push(gridClasses['cell--withRenderer']);
125
- classNames.push(rootClasses?.['cell--withRenderer']);
126
- }
127
- if (editCellState != null && column.renderEditCell) {
128
- const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
129
69
 
130
- // eslint-disable-next-line @typescript-eslint/naming-convention
131
- const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded);
132
- const params = _extends({}, cellParamsWithAPI, {
133
- row: updatedRow
134
- }, editCellStateRest);
135
- children = column.renderEditCell(params);
136
- classNames.push(gridClasses['cell--editing']);
137
- classNames.push(rootClasses?.['cell--editing']);
138
- }
139
- const {
140
- slots
141
- } = rootProps;
142
- const CellComponent = slots.cell;
143
- const cellProps = _extends({}, props, {
144
- ref,
145
- field,
146
- formattedValue,
147
- hasFocus,
148
- isEditable,
149
- isSelected,
150
- value,
151
- cellMode,
152
- children,
153
- tabIndex,
154
- className: clsx(classNames)
155
- });
156
- return /*#__PURE__*/React.createElement(CellComponent, cellProps);
157
- });
158
70
  const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
159
- const {
160
- align,
161
- children: childrenProp,
162
- colIndex,
163
- column,
164
- cellMode,
165
- field,
166
- formattedValue,
167
- hasFocus,
168
- height,
169
- isEditable,
170
- isSelected,
171
- rowId,
172
- tabIndex,
173
- value,
174
- width,
175
- className,
176
- showRightBorder,
177
- colSpan,
178
- disableDragEvents,
179
- isNotVisible,
180
- onClick,
181
- onDoubleClick,
182
- onMouseDown,
183
- onMouseUp,
184
- onMouseOver,
185
- onKeyDown,
186
- onKeyUp,
187
- onDragEnter,
188
- onDragOver
189
- } = props,
190
- other = _objectWithoutPropertiesLoose(props, _excluded2);
191
- const valueToRender = formattedValue == null ? value : formattedValue;
192
- const cellRef = React.useRef(null);
193
- const handleRef = useForkRef(ref, cellRef);
194
- const focusElementRef = React.useRef(null);
195
- const apiRef = useGridApiContext();
196
- const rootProps = useGridRootProps();
197
- const ownerState = {
198
- align,
199
- showRightBorder,
200
- isEditable,
201
- classes: rootProps.classes,
202
- isSelected
203
- };
204
- const classes = useUtilityClasses(ownerState);
205
- const publishMouseUp = React.useCallback(eventName => event => {
206
- const params = apiRef.current.getCellParams(rowId, field || '');
207
- apiRef.current.publishEvent(eventName, params, event);
208
- if (onMouseUp) {
209
- onMouseUp(event);
210
- }
211
- }, [apiRef, field, onMouseUp, rowId]);
212
- const publishMouseDown = React.useCallback(eventName => event => {
213
- const params = apiRef.current.getCellParams(rowId, field || '');
214
- apiRef.current.publishEvent(eventName, params, event);
215
- if (onMouseDown) {
216
- onMouseDown(event);
217
- }
218
- }, [apiRef, field, onMouseDown, rowId]);
219
- const publish = React.useCallback((eventName, propHandler) => event => {
220
- // The row might have been deleted during the click
221
- if (!apiRef.current.getRow(rowId)) {
222
- return;
223
- }
224
- const params = apiRef.current.getCellParams(rowId, field || '');
225
- apiRef.current.publishEvent(eventName, params, event);
226
- if (propHandler) {
227
- propHandler(event);
228
- }
229
- }, [apiRef, field, rowId]);
230
- const style = React.useMemo(() => {
231
- if (isNotVisible) {
232
- return {
233
- padding: 0,
234
- opacity: 0,
235
- width: 0,
236
- border: 0
237
- };
238
- }
239
- const cellStyle = {
240
- minWidth: width,
241
- maxWidth: width,
242
- minHeight: height,
243
- maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
244
- };
245
- return cellStyle;
246
- }, [width, height, isNotVisible]);
247
- React.useEffect(() => {
248
- if (!hasFocus || cellMode === GridCellModes.Edit) {
249
- return;
250
- }
251
- const doc = ownerDocument(apiRef.current.rootElementRef.current);
252
- if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
253
- const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
254
- const elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
255
- if (doesSupportPreventScroll()) {
256
- elementToFocus.focus({
257
- preventScroll: true
258
- });
259
- } else {
260
- const scrollPosition = apiRef.current.getScrollPosition();
261
- elementToFocus.focus();
262
- apiRef.current.scroll(scrollPosition);
263
- }
264
- }
265
- }, [hasFocus, cellMode, apiRef]);
266
- let handleFocus = other.onFocus;
267
- if (process.env.NODE_ENV === 'test' && rootProps.experimentalFeatures?.warnIfFocusStateIsNotSynced) {
268
- handleFocus = event => {
269
- const focusedCell = gridFocusCellSelector(apiRef);
270
- if (focusedCell?.id === rowId && focusedCell.field === field) {
271
- if (typeof other.onFocus === 'function') {
272
- other.onFocus(event);
273
- }
274
- return;
275
- }
276
- if (!warnedOnce) {
277
- console.warn([`MUI X: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${focusedCell?.field}.`, "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
278
- warnedOnce = true;
279
- }
280
- };
281
- }
282
- const managesOwnFocus = column.type === 'actions';
283
- let children = childrenProp;
284
- if (children === undefined) {
285
- const valueString = valueToRender?.toString();
286
- children = /*#__PURE__*/_jsx("div", {
287
- className: classes.content,
288
- title: valueString,
289
- role: "presentation",
290
- children: valueString
291
- });
292
- }
293
- if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
294
- children = /*#__PURE__*/React.cloneElement(children, {
295
- focusElementRef
296
- });
297
- }
298
- const draggableEventHandlers = disableDragEvents ? null : {
299
- onDragEnter: publish('cellDragEnter', onDragEnter),
300
- onDragOver: publish('cellDragOver', onDragOver)
301
- };
302
- const ariaV7 = rootProps.experimentalFeatures?.ariaV7;
303
- return (
304
- /*#__PURE__*/
305
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
306
- _jsx("div", _extends({
307
- ref: handleRef,
308
- className: clsx(className, classes.root),
309
- role: ariaV7 ? 'gridcell' : 'cell',
310
- "data-field": field,
311
- "data-colindex": colIndex,
312
- "aria-colindex": colIndex + 1,
313
- "aria-colspan": colSpan,
314
- style: style,
315
- tabIndex: tabIndex,
316
- onClick: publish('cellClick', onClick),
317
- onDoubleClick: publish('cellDoubleClick', onDoubleClick),
318
- onMouseOver: publish('cellMouseOver', onMouseOver),
319
- onMouseDown: publishMouseDown('cellMouseDown'),
320
- onMouseUp: publishMouseUp('cellMouseUp'),
321
- onKeyDown: publish('cellKeyDown', onKeyDown),
322
- onKeyUp: publish('cellKeyUp', onKeyUp)
323
- }, draggableEventHandlers, other, {
324
- onFocus: handleFocus,
325
- children: children
326
- }))
327
- );
328
- });
329
- const MemoizedCellWrapper = fastMemo(GridCellWrapper);
330
- process.env.NODE_ENV !== "production" ? GridCellWrapper.propTypes = {
331
- // ----------------------------- Warning --------------------------------
332
- // | These PropTypes are generated from the TypeScript type definitions |
333
- // | To update them edit the TypeScript types and run "yarn proptypes" |
334
- // ----------------------------------------------------------------------
335
- align: PropTypes.oneOf(['center', 'left', 'right']),
336
- className: PropTypes.string,
337
- colIndex: PropTypes.number,
338
- colSpan: PropTypes.number,
339
- column: PropTypes.object,
340
- disableDragEvents: PropTypes.bool,
341
- height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
342
- onClick: PropTypes.func,
343
- onDoubleClick: PropTypes.func,
344
- onDragEnter: PropTypes.func,
345
- onDragOver: PropTypes.func,
346
- onKeyDown: PropTypes.func,
347
- onMouseDown: PropTypes.func,
348
- onMouseUp: PropTypes.func,
349
- rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
350
- showRightBorder: PropTypes.bool,
351
- width: PropTypes.number
352
- } : void 0;
353
- process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
354
- // ----------------------------- Warning --------------------------------
355
- // | These PropTypes are generated from the TypeScript type definitions |
356
- // | To update them edit the TypeScript types and run "yarn proptypes" |
357
- // ----------------------------------------------------------------------
358
- align: PropTypes.oneOf(['center', 'left', 'right']),
359
- cellMode: PropTypes.oneOf(['edit', 'view']),
360
- children: PropTypes.node,
361
- className: PropTypes.string,
362
- colIndex: PropTypes.number,
363
- colSpan: PropTypes.number,
364
- column: PropTypes.object,
365
- disableDragEvents: PropTypes.bool,
366
- editCellState: PropTypes.shape({
367
- changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
368
- isProcessingProps: PropTypes.bool,
369
- isValidating: PropTypes.bool,
370
- value: PropTypes.any
371
- }),
372
- isNotVisible: PropTypes.bool,
373
- height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
374
- onClick: PropTypes.func,
375
- onDoubleClick: PropTypes.func,
376
- onDragEnter: PropTypes.func,
377
- onDragOver: PropTypes.func,
378
- onKeyDown: PropTypes.func,
379
- onMouseDown: PropTypes.func,
380
- onMouseUp: PropTypes.func,
381
- rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
382
- showRightBorder: PropTypes.bool,
383
- width: PropTypes.number
384
- } : void 0;
385
- export { MemoizedCellWrapper as GridCellWrapper, GridCell };
386
- const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
387
71
  const {
388
72
  column,
389
73
  rowId,
@@ -393,10 +77,14 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
393
77
  height,
394
78
  width,
395
79
  className,
396
- showRightBorder,
80
+ style: styleProp,
397
81
  colSpan,
398
82
  disableDragEvents,
399
83
  isNotVisible,
84
+ pinnedOffset,
85
+ pinnedPosition,
86
+ sectionIndex,
87
+ sectionLength,
400
88
  onClick,
401
89
  onDoubleClick,
402
90
  onMouseDown,
@@ -407,7 +95,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
407
95
  onDragEnter,
408
96
  onDragOver
409
97
  } = props,
410
- other = _objectWithoutPropertiesLoose(props, _excluded3);
98
+ other = _objectWithoutPropertiesLoose(props, _excluded);
411
99
  const apiRef = useGridApiContext();
412
100
  const rootProps = useGridRootProps();
413
101
  const field = column.field;
@@ -434,7 +122,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
434
122
  const {
435
123
  cellMode,
436
124
  hasFocus,
437
- isEditable,
125
+ isEditable = false,
438
126
  value,
439
127
  formattedValue
440
128
  } = cellParamsWithAPI;
@@ -460,11 +148,16 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
460
148
  const focusElementRef = React.useRef(null);
461
149
  // @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
462
150
  const isSelectionMode = rootProps.cellSelection ?? false;
151
+ const isSectionLastCell = sectionIndex === sectionLength - 1;
152
+ const showLeftBorder = pinnedPosition === PinnedPosition.RIGHT && sectionIndex === 0;
153
+ const showRightBorder = rootProps.showCellVerticalBorder && (pinnedPosition !== PinnedPosition.LEFT ? !isSectionLastCell : true) || pinnedPosition === PinnedPosition.LEFT && isSectionLastCell;
463
154
  const ownerState = {
464
155
  align,
156
+ showLeftBorder,
465
157
  showRightBorder,
466
158
  isEditable,
467
159
  classes: rootProps.classes,
160
+ pinnedPosition,
468
161
  isSelected,
469
162
  isSelectionMode
470
163
  };
@@ -503,14 +196,18 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
503
196
  border: 0
504
197
  };
505
198
  }
506
- const cellStyle = {
507
- minWidth: width,
508
- maxWidth: width,
509
- minHeight: height,
510
- maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
511
- };
199
+ const cellStyle = _extends({
200
+ '--width': `${width}px`,
201
+ '--height': typeof height === 'number' ? `${height}px` : height
202
+ }, styleProp);
203
+ if (pinnedPosition === PinnedPosition.LEFT) {
204
+ cellStyle.left = pinnedOffset;
205
+ }
206
+ if (pinnedPosition === PinnedPosition.RIGHT) {
207
+ cellStyle.right = pinnedOffset;
208
+ }
512
209
  return cellStyle;
513
- }, [width, height, isNotVisible]);
210
+ }, [width, height, isNotVisible, styleProp, pinnedOffset, pinnedPosition]);
514
211
  React.useEffect(() => {
515
212
  if (!hasFocus || cellMode === GridCellModes.Edit) {
516
213
  return;
@@ -559,7 +256,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
559
256
  const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
560
257
 
561
258
  // eslint-disable-next-line @typescript-eslint/naming-convention
562
- const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded4);
259
+ const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded2);
563
260
  const params = _extends({}, cellParamsWithAPI, {
564
261
  row: updatedRow
565
262
  }, editCellStateRest);
@@ -585,34 +282,29 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
585
282
  onDragEnter: publish('cellDragEnter', onDragEnter),
586
283
  onDragOver: publish('cellDragOver', onDragOver)
587
284
  };
588
- const ariaV7 = rootProps.experimentalFeatures?.ariaV7;
589
- return (
590
- /*#__PURE__*/
591
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
592
- _jsx("div", _extends({
593
- ref: handleRef,
594
- className: clsx(className, classNames, classes.root),
595
- role: ariaV7 ? 'gridcell' : 'cell',
596
- "data-field": field,
597
- "data-colindex": colIndex,
598
- "aria-colindex": colIndex + 1,
599
- "aria-colspan": colSpan,
600
- style: style,
601
- tabIndex: tabIndex,
602
- onClick: publish('cellClick', onClick),
603
- onDoubleClick: publish('cellDoubleClick', onDoubleClick),
604
- onMouseOver: publish('cellMouseOver', onMouseOver),
605
- onMouseDown: publishMouseDown('cellMouseDown'),
606
- onMouseUp: publishMouseUp('cellMouseUp'),
607
- onKeyDown: publish('cellKeyDown', onKeyDown),
608
- onKeyUp: publish('cellKeyUp', onKeyUp)
609
- }, draggableEventHandlers, other, {
610
- onFocus: handleFocus,
611
- children: children
612
- }))
613
- );
285
+ return /*#__PURE__*/_jsx("div", _extends({
286
+ ref: handleRef,
287
+ className: clsx(className, classNames, classes.root),
288
+ role: "gridcell",
289
+ "data-field": field,
290
+ "data-colindex": colIndex,
291
+ "aria-colindex": colIndex + 1,
292
+ "aria-colspan": colSpan,
293
+ style: style,
294
+ tabIndex: tabIndex,
295
+ onClick: publish('cellClick', onClick),
296
+ onDoubleClick: publish('cellDoubleClick', onDoubleClick),
297
+ onMouseOver: publish('cellMouseOver', onMouseOver),
298
+ onMouseDown: publishMouseDown('cellMouseDown'),
299
+ onMouseUp: publishMouseUp('cellMouseUp'),
300
+ onKeyDown: publish('cellKeyDown', onKeyDown),
301
+ onKeyUp: publish('cellKeyUp', onKeyUp)
302
+ }, draggableEventHandlers, other, {
303
+ onFocus: handleFocus,
304
+ children: children
305
+ }));
614
306
  });
615
- process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
307
+ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
616
308
  // ----------------------------- Warning --------------------------------
617
309
  // | These PropTypes are generated from the TypeScript type definitions |
618
310
  // | To update them edit the TypeScript types and run "yarn proptypes" |
@@ -629,8 +321,9 @@ process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
629
321
  isValidating: PropTypes.bool,
630
322
  value: PropTypes.any
631
323
  }),
324
+ gridHasScrollX: PropTypes.bool.isRequired,
632
325
  height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
633
- isNotVisible: PropTypes.bool,
326
+ isNotVisible: PropTypes.bool.isRequired,
634
327
  onClick: PropTypes.func,
635
328
  onDoubleClick: PropTypes.func,
636
329
  onDragEnter: PropTypes.func,
@@ -638,9 +331,12 @@ process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
638
331
  onKeyDown: PropTypes.func,
639
332
  onMouseDown: PropTypes.func,
640
333
  onMouseUp: PropTypes.func,
334
+ pinnedOffset: PropTypes.number.isRequired,
335
+ pinnedPosition: PropTypes.oneOf([0, 1, 2]).isRequired,
641
336
  rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
642
- showRightBorder: PropTypes.bool,
337
+ sectionIndex: PropTypes.number.isRequired,
338
+ sectionLength: PropTypes.number.isRequired,
643
339
  width: PropTypes.number.isRequired
644
340
  } : void 0;
645
- const MemoizedGridCellV7 = fastMemo(GridCellV7);
646
- export { MemoizedGridCellV7 as GridCellV7 };
341
+ const MemoizedGridCell = fastMemo(GridCell);
342
+ export { MemoizedGridCell as GridCell };
@@ -13,7 +13,7 @@ const useUtilityClasses = ownerState => {
13
13
  classes
14
14
  } = ownerState;
15
15
  const slots = {
16
- root: ['columnHeaders', 'withBorderColor']
16
+ root: ['columnHeaders']
17
17
  };
18
18
  return composeClasses(slots, getDataGridUtilityClass, classes);
19
19
  };
@@ -22,12 +22,7 @@ const GridColumnHeadersRoot = styled('div', {
22
22
  slot: 'ColumnHeaders',
23
23
  overridesResolver: (props, styles) => styles.columnHeaders
24
24
  })({
25
- position: 'relative',
26
- overflow: 'hidden',
27
25
  display: 'flex',
28
- alignItems: 'center',
29
- boxSizing: 'border-box',
30
- borderBottom: '1px solid',
31
26
  borderTopLeftRadius: 'var(--unstable_DataGrid-radius)',
32
27
  borderTopRightRadius: 'var(--unstable_DataGrid-radius)'
33
28
  });
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
5
+ import { fastMemo } from '../../utils/fastMemo';
5
6
  import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
6
7
  import { GridColumnHeaderSortIcon } from './GridColumnHeaderSortIcon';
7
8
  import { ColumnHeaderMenuIcon } from './ColumnHeaderMenuIcon';
@@ -124,14 +125,16 @@ function GridColumnHeaderItem(props) {
124
125
  onExited: handleExited
125
126
  });
126
127
  const sortingOrder = colDef.sortingOrder ?? rootProps.sortingOrder;
128
+ const showSortIcon = (colDef.sortable || sortDirection != null) && !colDef.hideSortIcons && !rootProps.disableColumnSorting;
127
129
  const columnTitleIconButtons = /*#__PURE__*/_jsxs(React.Fragment, {
128
130
  children: [!rootProps.disableColumnFilter && /*#__PURE__*/_jsx(rootProps.slots.columnHeaderFilterIconButton, _extends({
129
131
  field: colDef.field,
130
132
  counter: filterItemsCounter
131
- }, rootProps.slotProps?.columnHeaderFilterIconButton)), colDef.sortable && !colDef.hideSortIcons && /*#__PURE__*/_jsx(GridColumnHeaderSortIcon, {
133
+ }, rootProps.slotProps?.columnHeaderFilterIconButton)), showSortIcon && /*#__PURE__*/_jsx(GridColumnHeaderSortIcon, {
132
134
  direction: sortDirection,
133
135
  index: sortIndex,
134
- sortingOrder: sortingOrder
136
+ sortingOrder: sortingOrder,
137
+ disabled: !colDef.sortable
135
138
  })]
136
139
  });
137
140
  React.useLayoutEffect(() => {
@@ -194,4 +197,5 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
194
197
  sortIndex: PropTypes.number,
195
198
  tabIndex: PropTypes.oneOf([-1, 0]).isRequired
196
199
  } : void 0;
197
- export { GridColumnHeaderItem };
200
+ const Memoized = fastMemo(GridColumnHeaderItem);
201
+ export { Memoized as GridColumnHeaderItem };
@@ -38,7 +38,8 @@ function GridColumnHeaderSortIconRaw(props) {
38
38
  const {
39
39
  direction,
40
40
  index,
41
- sortingOrder
41
+ sortingOrder,
42
+ disabled
42
43
  } = props;
43
44
  const apiRef = useGridApiContext();
44
45
  const rootProps = useGridRootProps();
@@ -54,7 +55,8 @@ function GridColumnHeaderSortIconRaw(props) {
54
55
  tabIndex: -1,
55
56
  "aria-label": apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
56
57
  title: apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
57
- size: "small"
58
+ size: "small",
59
+ disabled: disabled
58
60
  }, rootProps.slotProps?.baseIconButton, {
59
61
  children: iconElement
60
62
  }));
@@ -73,6 +75,7 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderSortIconRaw.propTypes =
73
75
  // | To update them edit the TypeScript types and run "yarn proptypes" |
74
76
  // ----------------------------------------------------------------------
75
77
  direction: PropTypes.oneOf(['asc', 'desc']),
78
+ disabled: PropTypes.bool,
76
79
  index: PropTypes.number,
77
80
  sortingOrder: PropTypes.arrayOf(PropTypes.oneOf(['asc', 'desc'])).isRequired
78
81
  } : void 0;
@@ -47,7 +47,7 @@ export const GridColumnHeadersInner = /*#__PURE__*/React.forwardRef(function Gri
47
47
  const rootProps = useGridRootProps();
48
48
  const ownerState = _extends({}, rootProps, {
49
49
  isDragging,
50
- hasScrollX: apiRef.current.getRootDimensions()?.hasScrollX ?? false
50
+ hasScrollX: apiRef.current.getRootDimensions().hasScrollX
51
51
  });
52
52
  const classes = useUtilityClasses(ownerState);
53
53
  return /*#__PURE__*/_jsx(GridColumnHeadersInnerRoot, _extends({