@mui/x-data-grid 8.0.0-alpha.7 → 8.0.0-alpha.9

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 (393) hide show
  1. package/CHANGELOG.md +551 -3
  2. package/DataGrid/DataGrid.js +4 -5
  3. package/DataGrid/useDataGridComponent.d.ts +2 -1
  4. package/DataGrid/useDataGridComponent.js +1 -1
  5. package/components/GridApiContext.js +2 -0
  6. package/components/GridConfigurationContext.js +2 -0
  7. package/components/GridHeaders.js +2 -2
  8. package/components/GridRow.d.ts +5 -9
  9. package/components/GridRow.js +28 -78
  10. package/components/GridScrollArea.js +2 -0
  11. package/components/GridSkeletonLoadingOverlay.js +18 -18
  12. package/components/cell/GridCell.d.ts +9 -16
  13. package/components/cell/GridCell.js +17 -35
  14. package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -5
  15. package/components/columnHeaders/GridColumnGroupHeader.js +7 -10
  16. package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
  17. package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
  18. package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -5
  19. package/components/columnHeaders/GridColumnHeaderItem.js +13 -12
  20. package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
  21. package/components/containers/GridRoot.d.ts +2 -2
  22. package/components/containers/GridRoot.js +14 -6
  23. package/components/containers/GridRootStyles.js +7 -0
  24. package/components/panel/GridPanel.js +2 -1
  25. package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -0
  26. package/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
  27. package/components/panel/filterPanel/GridFilterInputDate.d.ts +2 -1
  28. package/components/panel/filterPanel/GridFilterInputDate.js +32 -29
  29. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
  30. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
  31. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -0
  32. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
  33. package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -0
  34. package/components/panel/filterPanel/GridFilterInputValue.js +34 -28
  35. package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
  36. package/components/toolbar/GridToolbarColumnsButton.js +6 -1
  37. package/components/toolbar/GridToolbarFilterButton.js +6 -1
  38. package/components/virtualization/GridVirtualScrollbar.js +11 -12
  39. package/components/virtualization/GridVirtualScroller.js +4 -4
  40. package/constants/gridClasses.d.ts +12 -0
  41. package/constants/gridClasses.js +1 -1
  42. package/constants/localeTextConstants.js +1 -0
  43. package/context/GridContextProvider.d.ts +2 -1
  44. package/context/GridRootPropsContext.js +2 -0
  45. package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +2 -2
  46. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -2
  47. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
  48. package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
  49. package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +2 -2
  50. package/hooks/core/useGridApiInitialization.d.ts +2 -2
  51. package/hooks/core/useGridInitialization.d.ts +2 -2
  52. package/hooks/core/useGridIsRtl.d.ts +2 -2
  53. package/hooks/core/useGridLocaleText.d.ts +2 -2
  54. package/hooks/core/useGridLoggerFactory.d.ts +2 -2
  55. package/hooks/core/useGridRefs.d.ts +2 -2
  56. package/hooks/core/useGridStateInitialization.d.ts +2 -2
  57. package/hooks/features/clipboard/useGridClipboard.d.ts +2 -2
  58. package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +2 -2
  59. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +5 -7
  60. package/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
  61. package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -2
  62. package/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  63. package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -2
  64. package/hooks/features/columns/gridColumnsUtils.d.ts +4 -4
  65. package/hooks/features/columns/useGridColumnSpanning.d.ts +2 -2
  66. package/hooks/features/columns/useGridColumns.d.ts +2 -2
  67. package/hooks/features/density/useGridDensity.d.ts +2 -2
  68. package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
  69. package/hooks/features/dimensions/useGridDimensions.js +1 -3
  70. package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
  71. package/hooks/features/editing/useGridCellEditing.js +1 -1
  72. package/hooks/features/editing/useGridEditing.d.ts +2 -2
  73. package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
  74. package/hooks/features/editing/useGridRowEditing.js +1 -1
  75. package/hooks/features/events/useGridEvents.d.ts +2 -2
  76. package/hooks/features/export/serializers/csvSerializer.d.ts +2 -1
  77. package/hooks/features/export/useGridCsvExport.d.ts +2 -2
  78. package/hooks/features/export/useGridPrintExport.d.ts +2 -2
  79. package/hooks/features/export/utils.d.ts +2 -2
  80. package/hooks/features/filter/gridFilterSelector.d.ts +1 -1
  81. package/hooks/features/filter/gridFilterSelector.js +6 -1
  82. package/hooks/features/filter/gridFilterUtils.d.ts +7 -7
  83. package/hooks/features/filter/gridFilterUtils.js +3 -3
  84. package/hooks/features/filter/useGridFilter.d.ts +2 -2
  85. package/hooks/features/focus/useGridFocus.d.ts +2 -2
  86. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
  87. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
  88. package/hooks/features/keyboardNavigation/utils.d.ts +3 -3
  89. package/hooks/features/listView/useGridListView.d.ts +2 -2
  90. package/hooks/features/pagination/gridPaginationInterfaces.d.ts +3 -0
  91. package/hooks/features/pagination/gridPaginationSelector.d.ts +21 -2
  92. package/hooks/features/pagination/gridPaginationSelector.js +39 -1
  93. package/hooks/features/pagination/useGridPagination.d.ts +3 -3
  94. package/hooks/features/pagination/useGridPagination.js +5 -3
  95. package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
  96. package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
  97. package/hooks/features/pagination/useGridPaginationModel.js +23 -1
  98. package/hooks/features/pagination/useGridRowCount.d.ts +2 -2
  99. package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +1 -0
  100. package/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
  101. package/hooks/features/preferencesPanel/index.d.ts +1 -1
  102. package/hooks/features/preferencesPanel/index.js +1 -1
  103. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +2 -2
  104. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  105. package/hooks/features/rowSelection/useGridRowSelection.d.ts +2 -2
  106. package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +2 -2
  107. package/hooks/features/rowSelection/utils.d.ts +3 -2
  108. package/hooks/features/rows/gridRowSpanningUtils.d.ts +2 -2
  109. package/hooks/features/rows/gridRowsSelector.js +1 -1
  110. package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
  111. package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
  112. package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
  113. package/hooks/features/rows/useGridRows.d.ts +2 -2
  114. package/hooks/features/rows/useGridRows.js +2 -2
  115. package/hooks/features/rows/useGridRowsMeta.d.ts +2 -2
  116. package/hooks/features/rows/useGridRowsPreProcessors.d.ts +2 -2
  117. package/hooks/features/scroll/useGridScroll.d.ts +2 -2
  118. package/hooks/features/sorting/gridSortingUtils.d.ts +3 -3
  119. package/hooks/features/sorting/gridSortingUtils.js +2 -2
  120. package/hooks/features/sorting/useGridSorting.d.ts +2 -2
  121. package/hooks/features/statePersistence/useGridStatePersistence.d.ts +2 -2
  122. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +6 -0
  123. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
  124. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -1
  125. package/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
  126. package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
  127. package/hooks/utils/useGridApiContext.d.ts +2 -2
  128. package/hooks/utils/useGridApiEventHandler.d.ts +4 -4
  129. package/hooks/utils/useGridApiMethod.d.ts +2 -2
  130. package/hooks/utils/useGridApiRef.d.ts +2 -2
  131. package/hooks/utils/useGridApiRef.js +3 -1
  132. package/hooks/utils/useGridInitializeState.d.ts +3 -3
  133. package/hooks/utils/useGridLogger.d.ts +2 -2
  134. package/hooks/utils/useGridNativeEventListener.d.ts +2 -1
  135. package/hooks/utils/useGridPrivateApiContext.d.ts +2 -1
  136. package/hooks/utils/useGridSelector.d.ts +2 -2
  137. package/hooks/utils/useGridVisibleRows.d.ts +8 -6
  138. package/hooks/utils/useGridVisibleRows.js +5 -28
  139. package/index.js +1 -1
  140. package/internals/constants.d.ts +6 -0
  141. package/internals/constants.js +8 -1
  142. package/internals/index.d.ts +1 -0
  143. package/internals/index.js +1 -0
  144. package/internals/utils/attachPinnedStyle.d.ts +2 -0
  145. package/internals/utils/attachPinnedStyle.js +9 -0
  146. package/internals/utils/getPinnedCellOffset.d.ts +3 -3
  147. package/internals/utils/getPinnedCellOffset.js +6 -7
  148. package/internals/utils/index.d.ts +1 -0
  149. package/internals/utils/index.js +2 -1
  150. package/locales/arSD.js +2 -0
  151. package/locales/beBY.js +1 -0
  152. package/locales/bgBG.js +2 -0
  153. package/locales/csCZ.js +2 -0
  154. package/locales/daDK.js +2 -0
  155. package/locales/deDE.js +2 -0
  156. package/locales/elGR.js +2 -0
  157. package/locales/esES.js +2 -0
  158. package/locales/faIR.js +7 -6
  159. package/locales/fiFI.js +2 -0
  160. package/locales/frFR.js +2 -0
  161. package/locales/heIL.js +2 -0
  162. package/locales/hrHR.js +2 -0
  163. package/locales/huHU.js +2 -0
  164. package/locales/isIS.js +2 -0
  165. package/locales/itIT.js +2 -0
  166. package/locales/jaJP.js +2 -0
  167. package/locales/koKR.js +2 -0
  168. package/locales/nbNO.js +2 -0
  169. package/locales/nlNL.js +2 -0
  170. package/locales/nnNO.js +2 -0
  171. package/locales/plPL.js +2 -0
  172. package/locales/ptBR.js +2 -0
  173. package/locales/ptPT.js +2 -0
  174. package/locales/roRO.js +2 -0
  175. package/locales/ruRU.js +2 -0
  176. package/locales/skSK.js +2 -0
  177. package/locales/svSE.js +2 -0
  178. package/locales/trTR.js +2 -0
  179. package/locales/ukUA.js +2 -0
  180. package/locales/urPK.js +11 -10
  181. package/locales/viVN.js +2 -0
  182. package/locales/zhCN.js +2 -0
  183. package/locales/zhHK.js +2 -0
  184. package/locales/zhTW.js +2 -0
  185. package/material/index.js +2 -1
  186. package/models/api/gridLocaleTextApi.d.ts +1 -0
  187. package/models/colDef/gridColDef.d.ts +9 -8
  188. package/models/events/gridEventLookup.d.ts +6 -1
  189. package/models/gridExport.d.ts +2 -2
  190. package/models/gridFilterOperator.d.ts +2 -1
  191. package/models/gridIconSlotsComponent.d.ts +5 -0
  192. package/models/gridStateCommunity.d.ts +4 -0
  193. package/models/props/DataGridProps.d.ts +2 -1
  194. package/modern/DataGrid/DataGrid.js +4 -5
  195. package/modern/DataGrid/useDataGridComponent.js +1 -1
  196. package/modern/components/GridApiContext.js +2 -0
  197. package/modern/components/GridConfigurationContext.js +2 -0
  198. package/modern/components/GridHeaders.js +2 -2
  199. package/modern/components/GridRow.js +28 -78
  200. package/modern/components/GridScrollArea.js +2 -0
  201. package/modern/components/GridSkeletonLoadingOverlay.js +18 -18
  202. package/modern/components/cell/GridCell.js +17 -35
  203. package/modern/components/columnHeaders/GridColumnGroupHeader.js +7 -10
  204. package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
  205. package/modern/components/columnHeaders/GridColumnHeaderItem.js +13 -12
  206. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
  207. package/modern/components/containers/GridRoot.js +14 -6
  208. package/modern/components/containers/GridRootStyles.js +7 -0
  209. package/modern/components/panel/GridPanel.js +2 -1
  210. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
  211. package/modern/components/panel/filterPanel/GridFilterInputDate.js +32 -29
  212. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
  213. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
  214. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
  215. package/modern/components/panel/filterPanel/GridFilterInputValue.js +34 -28
  216. package/modern/components/toolbar/GridToolbarColumnsButton.js +6 -1
  217. package/modern/components/toolbar/GridToolbarFilterButton.js +6 -1
  218. package/modern/components/virtualization/GridVirtualScrollbar.js +11 -12
  219. package/modern/components/virtualization/GridVirtualScroller.js +4 -4
  220. package/modern/constants/gridClasses.js +1 -1
  221. package/modern/constants/localeTextConstants.js +1 -0
  222. package/modern/context/GridRootPropsContext.js +2 -0
  223. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
  224. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  225. package/modern/hooks/features/dimensions/useGridDimensions.js +1 -3
  226. package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
  227. package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
  228. package/modern/hooks/features/filter/gridFilterSelector.js +6 -1
  229. package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
  230. package/modern/hooks/features/pagination/gridPaginationSelector.js +39 -1
  231. package/modern/hooks/features/pagination/useGridPagination.js +5 -3
  232. package/modern/hooks/features/pagination/useGridPaginationModel.js +23 -1
  233. package/modern/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
  234. package/modern/hooks/features/preferencesPanel/index.js +1 -1
  235. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  236. package/modern/hooks/features/rows/gridRowsSelector.js +1 -1
  237. package/modern/hooks/features/rows/useGridRows.js +2 -2
  238. package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
  239. package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
  240. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
  241. package/modern/hooks/utils/useGridApiRef.js +3 -1
  242. package/modern/hooks/utils/useGridVisibleRows.js +5 -28
  243. package/modern/index.js +1 -1
  244. package/modern/internals/constants.js +8 -1
  245. package/modern/internals/index.js +1 -0
  246. package/modern/internals/utils/attachPinnedStyle.js +9 -0
  247. package/modern/internals/utils/getPinnedCellOffset.js +6 -7
  248. package/modern/internals/utils/index.js +2 -1
  249. package/modern/locales/arSD.js +2 -0
  250. package/modern/locales/beBY.js +1 -0
  251. package/modern/locales/bgBG.js +2 -0
  252. package/modern/locales/csCZ.js +2 -0
  253. package/modern/locales/daDK.js +2 -0
  254. package/modern/locales/deDE.js +2 -0
  255. package/modern/locales/elGR.js +2 -0
  256. package/modern/locales/esES.js +2 -0
  257. package/modern/locales/faIR.js +7 -6
  258. package/modern/locales/fiFI.js +2 -0
  259. package/modern/locales/frFR.js +2 -0
  260. package/modern/locales/heIL.js +2 -0
  261. package/modern/locales/hrHR.js +2 -0
  262. package/modern/locales/huHU.js +2 -0
  263. package/modern/locales/isIS.js +2 -0
  264. package/modern/locales/itIT.js +2 -0
  265. package/modern/locales/jaJP.js +2 -0
  266. package/modern/locales/koKR.js +2 -0
  267. package/modern/locales/nbNO.js +2 -0
  268. package/modern/locales/nlNL.js +2 -0
  269. package/modern/locales/nnNO.js +2 -0
  270. package/modern/locales/plPL.js +2 -0
  271. package/modern/locales/ptBR.js +2 -0
  272. package/modern/locales/ptPT.js +2 -0
  273. package/modern/locales/roRO.js +2 -0
  274. package/modern/locales/ruRU.js +2 -0
  275. package/modern/locales/skSK.js +2 -0
  276. package/modern/locales/svSE.js +2 -0
  277. package/modern/locales/trTR.js +2 -0
  278. package/modern/locales/ukUA.js +2 -0
  279. package/modern/locales/urPK.js +11 -10
  280. package/modern/locales/viVN.js +2 -0
  281. package/modern/locales/zhCN.js +2 -0
  282. package/modern/locales/zhHK.js +2 -0
  283. package/modern/locales/zhTW.js +2 -0
  284. package/modern/material/index.js +2 -1
  285. package/modern/utils/cellBorderUtils.js +5 -5
  286. package/modern/utils/domUtils.js +7 -2
  287. package/modern/utils/isJSDOM.js +1 -0
  288. package/modern/utils/rtlFlipSide.js +22 -0
  289. package/node/DataGrid/DataGrid.js +2 -3
  290. package/node/DataGrid/useDataGridComponent.js +1 -1
  291. package/node/components/GridApiContext.js +1 -0
  292. package/node/components/GridConfigurationContext.js +1 -0
  293. package/node/components/GridHeaders.js +2 -2
  294. package/node/components/GridRow.js +26 -77
  295. package/node/components/GridScrollArea.js +1 -0
  296. package/node/components/GridSkeletonLoadingOverlay.js +17 -17
  297. package/node/components/cell/GridCell.js +18 -36
  298. package/node/components/columnHeaders/GridColumnGroupHeader.js +7 -10
  299. package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +19 -5
  300. package/node/components/columnHeaders/GridColumnHeaderItem.js +13 -12
  301. package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  302. package/node/components/containers/GridRoot.js +14 -6
  303. package/node/components/containers/GridRootStyles.js +7 -0
  304. package/node/components/panel/GridPanel.js +2 -1
  305. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
  306. package/node/components/panel/filterPanel/GridFilterInputDate.js +31 -28
  307. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
  308. package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
  309. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
  310. package/node/components/panel/filterPanel/GridFilterInputValue.js +33 -27
  311. package/node/components/toolbar/GridToolbarColumnsButton.js +6 -1
  312. package/node/components/toolbar/GridToolbarFilterButton.js +6 -1
  313. package/node/components/virtualization/GridVirtualScrollbar.js +11 -12
  314. package/node/components/virtualization/GridVirtualScroller.js +4 -4
  315. package/node/constants/gridClasses.js +1 -1
  316. package/node/constants/localeTextConstants.js +1 -0
  317. package/node/context/GridRootPropsContext.js +1 -0
  318. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +32 -74
  319. package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  320. package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
  321. package/node/hooks/features/editing/useGridCellEditing.js +1 -1
  322. package/node/hooks/features/editing/useGridRowEditing.js +1 -1
  323. package/node/hooks/features/filter/gridFilterSelector.js +6 -1
  324. package/node/hooks/features/filter/gridFilterUtils.js +3 -3
  325. package/node/hooks/features/pagination/gridPaginationSelector.js +41 -3
  326. package/node/hooks/features/pagination/useGridPagination.js +5 -3
  327. package/node/hooks/features/pagination/useGridPaginationModel.js +23 -1
  328. package/node/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +9 -2
  329. package/node/hooks/features/preferencesPanel/index.js +11 -10
  330. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  331. package/node/hooks/features/rows/gridRowsSelector.js +1 -1
  332. package/node/hooks/features/rows/useGridRows.js +1 -1
  333. package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
  334. package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +49 -0
  335. package/node/hooks/features/virtualization/useGridVirtualScroller.js +94 -52
  336. package/node/hooks/utils/useGridApiRef.js +3 -1
  337. package/node/hooks/utils/useGridVisibleRows.js +3 -28
  338. package/node/index.js +1 -1
  339. package/node/internals/constants.js +9 -2
  340. package/node/internals/index.js +12 -0
  341. package/node/internals/utils/attachPinnedStyle.js +15 -0
  342. package/node/internals/utils/getPinnedCellOffset.js +6 -7
  343. package/node/internals/utils/index.js +11 -0
  344. package/node/locales/arSD.js +2 -0
  345. package/node/locales/beBY.js +1 -0
  346. package/node/locales/bgBG.js +2 -0
  347. package/node/locales/csCZ.js +2 -0
  348. package/node/locales/daDK.js +2 -0
  349. package/node/locales/deDE.js +2 -0
  350. package/node/locales/elGR.js +2 -0
  351. package/node/locales/esES.js +2 -0
  352. package/node/locales/faIR.js +7 -6
  353. package/node/locales/fiFI.js +2 -0
  354. package/node/locales/frFR.js +2 -0
  355. package/node/locales/heIL.js +2 -0
  356. package/node/locales/hrHR.js +2 -0
  357. package/node/locales/huHU.js +2 -0
  358. package/node/locales/isIS.js +2 -0
  359. package/node/locales/itIT.js +2 -0
  360. package/node/locales/jaJP.js +2 -0
  361. package/node/locales/koKR.js +2 -0
  362. package/node/locales/nbNO.js +2 -0
  363. package/node/locales/nlNL.js +2 -0
  364. package/node/locales/nnNO.js +2 -0
  365. package/node/locales/plPL.js +2 -0
  366. package/node/locales/ptBR.js +2 -0
  367. package/node/locales/ptPT.js +2 -0
  368. package/node/locales/roRO.js +2 -0
  369. package/node/locales/ruRU.js +2 -0
  370. package/node/locales/skSK.js +2 -0
  371. package/node/locales/svSE.js +2 -0
  372. package/node/locales/trTR.js +2 -0
  373. package/node/locales/ukUA.js +2 -0
  374. package/node/locales/urPK.js +11 -10
  375. package/node/locales/viVN.js +2 -0
  376. package/node/locales/zhCN.js +2 -0
  377. package/node/locales/zhHK.js +2 -0
  378. package/node/locales/zhTW.js +2 -0
  379. package/node/material/index.js +2 -1
  380. package/node/utils/cellBorderUtils.js +5 -5
  381. package/node/utils/domUtils.js +7 -2
  382. package/node/utils/isJSDOM.js +7 -0
  383. package/node/utils/rtlFlipSide.js +29 -0
  384. package/package.json +2 -2
  385. package/utils/cellBorderUtils.d.ts +3 -3
  386. package/utils/cellBorderUtils.js +5 -5
  387. package/utils/createSelector.d.ts +2 -2
  388. package/utils/domUtils.js +7 -2
  389. package/utils/getPublicApiRef.d.ts +2 -1
  390. package/utils/isJSDOM.d.ts +1 -0
  391. package/utils/isJSDOM.js +1 -0
  392. package/utils/rtlFlipSide.d.ts +2 -0
  393. package/utils/rtlFlipSide.js +22 -0
@@ -21,7 +21,7 @@ const gridRowMaximumTreeDepthSelector = exports.gridRowMaximumTreeDepthSelector
21
21
  if (entries.length === 0) {
22
22
  return 1;
23
23
  }
24
- return entries.filter(([, nodeCount]) => nodeCount > 0).map(([depth]) => Number(depth)).sort((a, b) => b - a)[0] + 1;
24
+ return (entries.filter(([, nodeCount]) => nodeCount > 0).map(([depth]) => Number(depth)).sort((a, b) => b - a)[0] ?? 0) + 1;
25
25
  });
26
26
  const gridDataRowIdsSelector = exports.gridDataRowIdsSelector = (0, _createSelector.createSelector)(gridRowsStateSelector, rows => rows.dataRowIds);
27
27
 
@@ -49,7 +49,7 @@ const useGridRows = (apiRef, props) => {
49
49
  }
50
50
  }
51
51
  const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridRows');
52
- const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props);
52
+ const currentPage = (0, _useGridVisibleRows.getVisibleRows)(apiRef);
53
53
  const lastUpdateMs = React.useRef(Date.now());
54
54
  const lastRowCount = React.useRef(props.rowCount);
55
55
  const timeout = (0, _useTimeout.useTimeout)();
@@ -28,7 +28,7 @@ const isDesc = direction => direction === 'desc';
28
28
  /**
29
29
  * Transform an item of the sorting model into a method comparing two rows.
30
30
  * @param {GridSortItem} sortItem The sort item we want to apply.
31
- * @param {React.MutableRefObject<GridApiCommunity>} apiRef The API of the grid.
31
+ * @param {RefObject<GridApiCommunity>} apiRef The API of the grid.
32
32
  * @returns {GridParsedSortItem | null} The parsed sort item. Returns `null` is the sort item is not valid.
33
33
  */
34
34
  const parseSortItem = (sortItem, apiRef) => {
@@ -81,7 +81,7 @@ const compareRows = (parsedSortItems, row1, row2) => {
81
81
  /**
82
82
  * Generates a method to easily sort a list of rows according to the current sort model.
83
83
  * @param {GridSortModel} sortModel The model with which we want to sort the rows.
84
- * @param {React.MutableRefObject<GridApiCommunity>} apiRef The API of the grid.
84
+ * @param {RefObject<GridApiCommunity>} apiRef The API of the grid.
85
85
  * @returns {GridSortingModelApplier | null} A method that generates a list of sorted row ids from a list of rows according to the current sort model. If `null`, we consider that the rows should remain in the order there were provided.
86
86
  */
87
87
  const buildAggregatedSortingApplier = (sortModel, apiRef) => {
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.gridFocusedVirtualCellSelector = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _reselect = require("reselect");
10
+ var _createSelector = require("../../../utils/createSelector");
11
+ var _gridColumnsSelector = require("../columns/gridColumnsSelector");
12
+ var _gridVirtualizationSelectors = require("./gridVirtualizationSelectors");
13
+ var _focus = require("../focus");
14
+ var _pagination = require("../pagination");
15
+ var _rows = require("../rows");
16
+ const gridIsFocusedCellOutOfContex = (0, _reselect.createSelector)(_focus.gridFocusCellSelector, _gridVirtualizationSelectors.gridRenderContextSelector, _pagination.gridVisibleRowsSelector, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector, _rows.gridRowsLookupSelector, (focusedCell, renderContext, currentPage, visibleColumns, rows) => {
17
+ if (!focusedCell) {
18
+ return false;
19
+ }
20
+ const row = rows[focusedCell.id];
21
+ if (!row) {
22
+ return false;
23
+ }
24
+ const rowIndex = currentPage.rowToIndexMap.get(row);
25
+ const columnIndex = visibleColumns.slice(renderContext.firstColumnIndex, renderContext.lastColumnIndex).findIndex(column => column.field === focusedCell.field);
26
+ const isInRenderContext = rowIndex !== undefined && columnIndex !== -1 && rowIndex >= renderContext.firstRowIndex && rowIndex <= renderContext.lastRowIndex;
27
+ return !isInRenderContext;
28
+ });
29
+ const gridFocusedVirtualCellSelector = exports.gridFocusedVirtualCellSelector = (0, _createSelector.createSelectorMemoized)(gridIsFocusedCellOutOfContex, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector, _pagination.gridVisibleRowsSelector, _rows.gridRowsLookupSelector, _focus.gridFocusCellSelector, (isFocusedCellOutOfRenderContext, visibleColumns, currentPage, rows, focusedCell) => {
30
+ if (!isFocusedCellOutOfRenderContext) {
31
+ return null;
32
+ }
33
+ const row = rows[focusedCell.id];
34
+ if (!row) {
35
+ return null;
36
+ }
37
+ const rowIndex = currentPage.rowToIndexMap.get(row);
38
+ if (rowIndex === undefined) {
39
+ return null;
40
+ }
41
+ const columnIndex = visibleColumns.findIndex(column => column.field === focusedCell.field);
42
+ if (columnIndex === -1) {
43
+ return null;
44
+ }
45
+ return (0, _extends2.default)({}, focusedCell, {
46
+ rowIndex,
47
+ columnIndex
48
+ });
49
+ });
@@ -24,7 +24,6 @@ var _useRunOnce = require("../../utils/useRunOnce");
24
24
  var _gridColumnsSelector = require("../columns/gridColumnsSelector");
25
25
  var _gridDimensionsSelectors = require("../dimensions/gridDimensionsSelectors");
26
26
  var _gridRowsSelector = require("../rows/gridRowsSelector");
27
- var _gridFocusStateSelector = require("../focus/gridFocusStateSelector");
28
27
  var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
29
28
  var _utils2 = require("../../utils");
30
29
  var platform = _interopRequireWildcard(require("../../../utils/platform"));
@@ -37,6 +36,8 @@ var _useGridVirtualization = require("./useGridVirtualization");
37
36
  var _gridRowSpanningSelectors = require("../rows/gridRowSpanningSelectors");
38
37
  var _gridListViewSelectors = require("../listView/gridListViewSelectors");
39
38
  var _gridRowsUtils = require("../rows/gridRowsUtils");
39
+ var _gridFocusedVirtualCellSelector = require("./gridFocusedVirtualCellSelector");
40
+ var _isJSDOM = require("../../../utils/isJSDOM");
40
41
  var _jsxRuntime = require("react/jsx-runtime");
41
42
  const MINIMUM_COLUMN_WIDTH = 50;
42
43
  var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
@@ -56,14 +57,6 @@ const createScrollCache = (isRtl, rowBufferPx, columnBufferPx, verticalBuffer, h
56
57
  direction: ScrollDirection.NONE,
57
58
  buffer: bufferForDirection(isRtl, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
58
59
  });
59
- let isJSDOM = false;
60
- try {
61
- if (typeof window !== 'undefined') {
62
- isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
63
- }
64
- } catch (_) {
65
- /* ignore */
66
- }
67
60
  const useGridVirtualScroller = () => {
68
61
  const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
69
62
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
@@ -71,8 +64,8 @@ const useGridVirtualScroller = () => {
71
64
  unstable_listView: listView
72
65
  } = rootProps;
73
66
  const visibleColumns = (0, _useGridSelector.useGridSelector)(apiRef, () => listView ? [(0, _gridListViewSelectors.gridListColumnSelector)(apiRef.current.state)] : (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef));
74
- const enabledForRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationRowEnabledSelector) && !isJSDOM;
75
- const enabledForColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationColumnEnabledSelector) && !isJSDOM;
67
+ const enabledForRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationRowEnabledSelector) && !_isJSDOM.isJSDOM;
68
+ const enabledForColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationColumnEnabledSelector) && !_isJSDOM.isJSDOM;
76
69
  const dimensions = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridDimensionsSelector);
77
70
  const outerSize = dimensions.viewportOuterSize;
78
71
  const pinnedRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsSelector);
@@ -84,12 +77,9 @@ const useGridVirtualScroller = () => {
84
77
  const hasBottomPinnedRows = pinnedRows.bottom.length > 0;
85
78
  const [panels, setPanels] = React.useState(EMPTY_DETAIL_PANELS);
86
79
  const isRtl = (0, _RtlProvider.useRtl)();
87
- const cellFocus = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridFocusCellSelector);
88
- const cellTabIndex = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridTabIndexCellSelector);
89
80
  const rowsMeta = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsMetaSelector.gridRowsMetaSelector);
90
81
  const selectedRowsLookup = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowSelectionSelector.selectedIdsLookupSelector);
91
82
  const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, rootProps);
92
- const gridRootRef = apiRef.current.rootElementRef;
93
83
  const mainRef = apiRef.current.mainElementRef;
94
84
  const scrollerRef = apiRef.current.virtualScrollerRef;
95
85
  const scrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
@@ -97,6 +87,7 @@ const useGridVirtualScroller = () => {
97
87
  const contentHeight = dimensions.contentSize.height;
98
88
  const columnsTotalWidth = dimensions.columnsTotalWidth;
99
89
  const hasColSpan = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridHasColSpanSelector);
90
+ const isRenderContextReady = React.useRef(false);
100
91
  const previousSize = React.useRef(null);
101
92
  const mainRefCallback = React.useCallback(node => {
102
93
  mainRef.current = node;
@@ -149,17 +140,15 @@ const useGridVirtualScroller = () => {
149
140
  * work that's not necessary. Thus we store the context at the start of the scroll in `frozenContext`, and the rows
150
141
  * that are part of this old context will keep their same render context as to avoid re-rendering.
151
142
  */
152
- const scrollPosition = React.useRef(EMPTY_SCROLL_POSITION);
143
+ const scrollPosition = React.useRef(rootProps.initialState?.scroll ?? EMPTY_SCROLL_POSITION);
144
+ const ignoreNextScrollEvent = React.useRef(false);
153
145
  const previousContextScrollPosition = React.useRef(EMPTY_SCROLL_POSITION);
154
146
  const previousRowContext = React.useRef(_useGridVirtualization.EMPTY_RENDER_CONTEXT);
155
147
  const renderContext = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridRenderContextSelector);
148
+ const focusedVirtualCell = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusedVirtualCellSelector.gridFocusedVirtualCellSelector);
156
149
  const scrollTimeout = (0, _useTimeout.default)();
157
150
  const frozenContext = React.useRef(undefined);
158
151
  const scrollCache = (0, _useLazyRef.default)(() => createScrollCache(isRtl, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
159
- const focusedCell = {
160
- rowIndex: React.useMemo(() => cellFocus ? currentPage.rows.findIndex(row => row.id === cellFocus.id) : -1, [cellFocus, currentPage.rows]),
161
- columnIndex: React.useMemo(() => cellFocus ? visibleColumns.findIndex(column => column.field === cellFocus.field) : -1, [cellFocus, visibleColumns])
162
- };
163
152
  const updateRenderContext = React.useCallback(nextRenderContext => {
164
153
  if (areRenderContextsEqual(nextRenderContext, apiRef.current.state.virtualization.renderContext)) {
165
154
  return;
@@ -243,6 +232,10 @@ const useGridVirtualScroller = () => {
243
232
  updateRenderContext(nextRenderContext);
244
233
  };
245
234
  const handleScroll = (0, _utils.unstable_useEventCallback)(event => {
235
+ if (ignoreNextScrollEvent.current) {
236
+ ignoreNextScrollEvent.current = false;
237
+ return;
238
+ }
246
239
  const {
247
240
  scrollTop,
248
241
  scrollLeft
@@ -301,14 +294,14 @@ const useGridVirtualScroller = () => {
301
294
  const lastRowToRender = Math.min(baseRenderContext.lastRowIndex, rowModels.length);
302
295
  const rowIndexes = params.rows ? (0, _utils3.range)(0, params.rows.length) : (0, _utils3.range)(firstRowToRender, lastRowToRender);
303
296
  let virtualRowIndex = -1;
304
- if (!isPinnedSection && focusedCell.rowIndex !== -1) {
305
- if (focusedCell.rowIndex < firstRowToRender) {
306
- virtualRowIndex = focusedCell.rowIndex;
307
- rowIndexes.unshift(virtualRowIndex);
297
+ if (!isPinnedSection && focusedVirtualCell) {
298
+ if (focusedVirtualCell.rowIndex < firstRowToRender) {
299
+ rowIndexes.unshift(focusedVirtualCell.rowIndex);
300
+ virtualRowIndex = focusedVirtualCell.rowIndex;
308
301
  }
309
- if (focusedCell.rowIndex >= lastRowToRender) {
310
- virtualRowIndex = focusedCell.rowIndex;
311
- rowIndexes.push(virtualRowIndex);
302
+ if (focusedVirtualCell.rowIndex > lastRowToRender) {
303
+ rowIndexes.push(focusedVirtualCell.rowIndex);
304
+ virtualRowIndex = focusedVirtualCell.rowIndex;
312
305
  }
313
306
  }
314
307
  const rows = [];
@@ -348,7 +341,6 @@ const useGridVirtualScroller = () => {
348
341
  });
349
342
  }
350
343
  }
351
- const hasFocus = cellFocus?.id === id;
352
344
  const baseRowHeight = !apiRef.current.rowHasAutoHeight(id) ? apiRef.current.unstable_getRowHeight(id) : 'auto';
353
345
  let isSelected;
354
346
  if (selectedRowsLookup[id] == null) {
@@ -373,19 +365,16 @@ const useGridVirtualScroller = () => {
373
365
  isLastVisible = isLastVisibleInSection;
374
366
  }
375
367
  }
376
- const isVirtualRow = rowIndexInPage === virtualRowIndex;
377
- const isNotVisible = isVirtualRow;
378
- let tabbableCell = null;
379
- if (cellTabIndex !== null && cellTabIndex.id === id) {
380
- const cellParams = apiRef.current.getCellParams(id, cellTabIndex.field);
381
- tabbableCell = cellParams.cellMode === 'view' ? cellTabIndex.field : null;
382
- }
383
368
  let currentRenderContext = baseRenderContext;
384
369
  if (!isPinnedSection && frozenContext.current && rowIndexInPage >= frozenContext.current.firstRowIndex && rowIndexInPage < frozenContext.current.lastRowIndex) {
385
370
  currentRenderContext = frozenContext.current;
386
371
  }
372
+ const isVirtualFocusRow = rowIndexInPage === virtualRowIndex;
373
+ const isVirtualFocusColumn = focusedVirtualCell?.rowIndex === rowIndex;
387
374
  const offsetLeft = computeOffsetLeft(columnPositions, currentRenderContext, pinnedColumns.left.length);
388
375
  const showBottomBorder = isLastVisibleInSection && params.position === 'top';
376
+ const firstColumnIndex = currentRenderContext.firstColumnIndex;
377
+ const lastColumnIndex = currentRenderContext.lastColumnIndex;
389
378
  rows.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.row, (0, _extends2.default)({
390
379
  row: model,
391
380
  rowId: id,
@@ -393,19 +382,21 @@ const useGridVirtualScroller = () => {
393
382
  selected: isSelected,
394
383
  offsetTop: params.rows ? undefined : rowsMeta.positions[rowIndexInPage],
395
384
  offsetLeft: offsetLeft,
396
- dimensions: dimensions,
385
+ columnsTotalWidth: dimensions.columnsTotalWidth,
397
386
  rowHeight: baseRowHeight,
398
- tabbableCell: tabbableCell,
399
387
  pinnedColumns: pinnedColumns,
400
388
  visibleColumns: visibleColumns,
401
- renderContext: currentRenderContext,
402
- focusedColumnIndex: hasFocus ? focusedCell.columnIndex : undefined,
389
+ firstColumnIndex: firstColumnIndex,
390
+ lastColumnIndex: lastColumnIndex,
391
+ focusedColumnIndex: isVirtualFocusColumn ? focusedVirtualCell.columnIndex : undefined,
403
392
  isFirstVisible: isFirstVisible,
404
393
  isLastVisible: isLastVisible,
405
- isNotVisible: isNotVisible,
406
- showBottomBorder: showBottomBorder
394
+ isNotVisible: isVirtualFocusRow,
395
+ showBottomBorder: showBottomBorder,
396
+ scrollbarWidth: dimensions.hasScrollY ? dimensions.scrollbarSize : 0,
397
+ gridHasFiller: dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width
407
398
  }, rowProps), id));
408
- if (isNotVisible) {
399
+ if (isVirtualFocusRow) {
409
400
  return;
410
401
  }
411
402
  const panel = panels.get(id);
@@ -436,18 +427,21 @@ const useGridVirtualScroller = () => {
436
427
  }
437
428
  return size;
438
429
  }, [columnsTotalWidth, contentHeight, needsHorizontalScrollbar]);
439
- React.useEffect(() => {
440
- apiRef.current.publishEvent('virtualScrollerContentSizeChange');
441
- }, [apiRef, contentSize]);
442
- (0, _utils.unstable_useEnhancedEffect)(() => {
443
- // TODO a scroll reset should not be necessary
444
- if (enabledForColumns) {
445
- scrollerRef.current.scrollLeft = 0;
430
+ const onContentSizeApplied = React.useCallback(node => {
431
+ if (!node) {
432
+ return;
446
433
  }
447
- if (enabledForRows) {
448
- scrollerRef.current.scrollTop = 0;
434
+ apiRef.current.publishEvent('virtualScrollerContentSizeChange', {
435
+ columnsTotalWidth,
436
+ contentHeight
437
+ });
438
+ }, [apiRef, columnsTotalWidth, contentHeight]);
439
+ (0, _utils.unstable_useEnhancedEffect)(() => {
440
+ if (!isRenderContextReady.current) {
441
+ return;
449
442
  }
450
- }, [enabledForColumns, enabledForRows, gridRootRef, scrollerRef]);
443
+ apiRef.current.updateRenderContext?.();
444
+ }, [apiRef, enabledForColumns, enabledForRows]);
451
445
  (0, _utils.unstable_useEnhancedEffect)(() => {
452
446
  if (listView) {
453
447
  scrollerRef.current.scrollLeft = 0;
@@ -462,6 +456,53 @@ const useGridVirtualScroller = () => {
462
456
  left: scrollPosition.current.left,
463
457
  renderContext: initialRenderContext
464
458
  });
459
+ isRenderContextReady.current = true;
460
+ if (rootProps.initialState?.scroll && scrollerRef.current) {
461
+ const scroller = scrollerRef.current;
462
+ const {
463
+ top,
464
+ left
465
+ } = rootProps.initialState.scroll;
466
+
467
+ // On initial mount, if we have columns available, we can restore the horizontal scroll immediately, but we need to skip the resulting scroll event, otherwise we would recalculate the render context at position top=0, left=restoredValue, but the initial render context is already calculated based on the initial value of scrollPosition ref.
468
+ const isScrollRestored = {
469
+ top: !(top > 0),
470
+ left: !(left > 0)
471
+ };
472
+ if (!isScrollRestored.left && columnsTotalWidth) {
473
+ scroller.scrollLeft = left;
474
+ ignoreNextScrollEvent.current = true;
475
+ isScrollRestored.left = true;
476
+ }
477
+
478
+ // For the sake of completeness, but I'm not sure if contentHeight is ever available at this point. Maybe when virtualisation is disabled?
479
+ if (!isScrollRestored.top && contentHeight) {
480
+ scroller.scrollTop = top;
481
+ ignoreNextScrollEvent.current = true;
482
+ isScrollRestored.top = true;
483
+ }
484
+
485
+ // To restore the vertical scroll, we need to wait until the rows are available in the DOM (otherwise there's nowhere to scroll), but before paint to avoid reflows
486
+ if (!isScrollRestored.top || !isScrollRestored.left) {
487
+ const unsubscribeContentSizeChange = apiRef.current.subscribeEvent('virtualScrollerContentSizeChange', params => {
488
+ if (!isScrollRestored.left && params.columnsTotalWidth) {
489
+ scroller.scrollLeft = left;
490
+ ignoreNextScrollEvent.current = true;
491
+ isScrollRestored.left = true;
492
+ }
493
+ if (!isScrollRestored.top && params.contentHeight) {
494
+ scroller.scrollTop = top;
495
+ ignoreNextScrollEvent.current = true;
496
+ isScrollRestored.top = true;
497
+ }
498
+ if (isScrollRestored.left && isScrollRestored.top) {
499
+ unsubscribeContentSizeChange();
500
+ }
501
+ });
502
+ return unsubscribeContentSizeChange;
503
+ }
504
+ }
505
+ return undefined;
465
506
  });
466
507
  apiRef.current.register('private', {
467
508
  updateRenderContext: forceUpdateRenderContext
@@ -489,7 +530,8 @@ const useGridVirtualScroller = () => {
489
530
  }),
490
531
  getContentProps: () => ({
491
532
  style: contentSize,
492
- role: 'presentation'
533
+ role: 'presentation',
534
+ ref: onContentSizeApplied
493
535
  }),
494
536
  getRenderZoneProps: () => ({
495
537
  role: 'rowgroup'
@@ -9,5 +9,7 @@ var React = _interopRequireWildcard(require("react"));
9
9
  /**
10
10
  * Hook that instantiate a [[GridApiRef]].
11
11
  */
12
- const useGridApiRef = () => React.useRef({});
12
+ const useGridApiRef = () =>
13
+ // TODO v8: initialize with null (see https://github.com/mui/mui-x/issues/16135#issuecomment-2589395230 and https://github.com/mui/mui-x/issues/16000#issuecomment-2567820735)
14
+ React.useRef({});
13
15
  exports.useGridApiRef = useGridApiRef;
@@ -1,34 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.useGridVisibleRows = exports.getVisibleRows = void 0;
8
- var React = _interopRequireWildcard(require("react"));
9
7
  var _gridPaginationSelector = require("../features/pagination/gridPaginationSelector");
10
- var _gridFilterSelector = require("../features/filter/gridFilterSelector");
8
+ var _ = require(".");
11
9
  const getVisibleRows = (apiRef, props) => {
12
- let rows;
13
- let range;
14
- if (props.pagination && props.paginationMode === 'client') {
15
- range = (0, _gridPaginationSelector.gridPaginationRowRangeSelector)(apiRef);
16
- rows = (0, _gridPaginationSelector.gridPaginatedVisibleSortedGridRowEntriesSelector)(apiRef);
17
- } else {
18
- rows = (0, _gridFilterSelector.gridExpandedSortedRowEntriesSelector)(apiRef);
19
- if (rows.length === 0) {
20
- range = null;
21
- } else {
22
- range = {
23
- firstRowIndex: 0,
24
- lastRowIndex: rows.length - 1
25
- };
26
- }
27
- }
28
- return {
29
- rows,
30
- range
31
- };
10
+ return (0, _gridPaginationSelector.gridVisibleRowsSelector)(apiRef);
32
11
  };
33
12
 
34
13
  /**
@@ -40,10 +19,6 @@ const getVisibleRows = (apiRef, props) => {
40
19
  */
41
20
  exports.getVisibleRows = getVisibleRows;
42
21
  const useGridVisibleRows = (apiRef, props) => {
43
- const response = getVisibleRows(apiRef, props);
44
- return React.useMemo(() => ({
45
- rows: response.rows,
46
- range: response.range
47
- }), [response.rows, response.range]);
22
+ return (0, _.useGridSelector)(apiRef, _gridPaginationSelector.gridVisibleRowsSelector);
48
23
  };
49
24
  exports.useGridVisibleRows = useGridVisibleRows;
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.0.0-alpha.7
2
+ * @mui/x-data-grid v8.0.0-alpha.9
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -3,7 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.GRID_TREE_DATA_GROUPING_FIELD = exports.GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = exports.GRID_DETAIL_PANEL_TOGGLE_FIELD = void 0;
6
+ exports.PinnedColumnPosition = exports.GRID_TREE_DATA_GROUPING_FIELD = exports.GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = exports.GRID_DETAIL_PANEL_TOGGLE_FIELD = void 0;
7
7
  const GRID_TREE_DATA_GROUPING_FIELD = exports.GRID_TREE_DATA_GROUPING_FIELD = '__tree_data_group__';
8
8
  const GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = exports.GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = '__row_group_by_columns_group__';
9
- const GRID_DETAIL_PANEL_TOGGLE_FIELD = exports.GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
9
+ const GRID_DETAIL_PANEL_TOGGLE_FIELD = exports.GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
10
+ let PinnedColumnPosition = exports.PinnedColumnPosition = /*#__PURE__*/function (PinnedColumnPosition) {
11
+ PinnedColumnPosition[PinnedColumnPosition["NONE"] = 0] = "NONE";
12
+ PinnedColumnPosition[PinnedColumnPosition["LEFT"] = 1] = "LEFT";
13
+ PinnedColumnPosition[PinnedColumnPosition["RIGHT"] = 2] = "RIGHT";
14
+ PinnedColumnPosition[PinnedColumnPosition["VIRTUAL"] = 3] = "VIRTUAL";
15
+ return PinnedColumnPosition;
16
+ }({});
@@ -814,6 +814,18 @@ Object.keys(_createControllablePromise).forEach(function (key) {
814
814
  }
815
815
  });
816
816
  });
817
+ var _rtlFlipSide = require("../utils/rtlFlipSide");
818
+ Object.keys(_rtlFlipSide).forEach(function (key) {
819
+ if (key === "default" || key === "__esModule") return;
820
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
821
+ if (key in exports && exports[key] === _rtlFlipSide[key]) return;
822
+ Object.defineProperty(exports, key, {
823
+ enumerable: true,
824
+ get: function () {
825
+ return _rtlFlipSide[key];
826
+ }
827
+ });
828
+ });
817
829
  var _createSelector = require("../utils/createSelector");
818
830
  var _domUtils = require("../utils/domUtils");
819
831
  var _keyboardUtils = require("../utils/keyboardUtils");
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attachPinnedStyle = attachPinnedStyle;
7
+ var _rtlFlipSide = require("../../utils/rtlFlipSide");
8
+ function attachPinnedStyle(style, isRtl, pinnedPosition, pinnedOffset) {
9
+ const side = (0, _rtlFlipSide.rtlFlipSide)(pinnedPosition, isRtl);
10
+ if (!side || pinnedOffset === undefined) {
11
+ return style;
12
+ }
13
+ style[side] = pinnedOffset;
14
+ return style;
15
+ }
@@ -4,19 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getPinnedCellOffset = void 0;
7
- var _columns = require("../../hooks/features/columns");
8
- const getPinnedCellOffset = (pinnedPosition, computedWidth, columnIndex, columnPositions, dimensions) => {
9
- const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
7
+ var _constants = require("../constants");
8
+ const getPinnedCellOffset = (pinnedPosition, computedWidth, columnIndex, columnPositions, columnsTotalWidth, scrollbarWidth) => {
10
9
  let pinnedOffset;
11
10
  switch (pinnedPosition) {
12
- case _columns.GridPinnedColumnPosition.LEFT:
11
+ case _constants.PinnedColumnPosition.LEFT:
13
12
  pinnedOffset = columnPositions[columnIndex];
14
13
  break;
15
- case _columns.GridPinnedColumnPosition.RIGHT:
16
- pinnedOffset = dimensions.columnsTotalWidth - columnPositions[columnIndex] - computedWidth + scrollbarWidth;
14
+ case _constants.PinnedColumnPosition.RIGHT:
15
+ pinnedOffset = columnsTotalWidth - columnPositions[columnIndex] - computedWidth + scrollbarWidth;
17
16
  break;
18
17
  default:
19
- pinnedOffset = 0;
18
+ pinnedOffset = undefined;
20
19
  break;
21
20
  }
22
21
  return pinnedOffset;
@@ -35,4 +35,15 @@ Object.keys(_gridRowGroupingUtils).forEach(function (key) {
35
35
  return _gridRowGroupingUtils[key];
36
36
  }
37
37
  });
38
+ });
39
+ var _attachPinnedStyle = require("./attachPinnedStyle");
40
+ Object.keys(_attachPinnedStyle).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _attachPinnedStyle[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _attachPinnedStyle[key];
47
+ }
48
+ });
38
49
  });
@@ -108,6 +108,8 @@ const arSDGrid = {
108
108
  'headerFilterOperator>=': 'أكبر من او يساوي',
109
109
  'headerFilterOperator<': 'اصغر من',
110
110
  'headerFilterOperator<=': 'اصغر من او يساوي',
111
+ // headerFilterClear: 'Clear filter',
112
+
111
113
  // Filter values text
112
114
  filterValueAny: 'أي',
113
115
  filterValueTrue: 'صائب',
@@ -123,6 +123,7 @@ const beBYGrid = {
123
123
  // 'headerFilterOperator>=': 'Greater than or equal to',
124
124
  // 'headerFilterOperator<': 'Less than',
125
125
  // 'headerFilterOperator<=': 'Less than or equal to',
126
+ // headerFilterClear: 'Clear filter',
126
127
 
127
128
  // Filter values text
128
129
  filterValueAny: 'усякі',
@@ -108,6 +108,8 @@ const bgBGGrid = {
108
108
  'headerFilterOperator>=': 'По-голямо или равно на',
109
109
  'headerFilterOperator<': 'По-малко от',
110
110
  'headerFilterOperator<=': 'По-малко или равно на',
111
+ // headerFilterClear: 'Clear filter',
112
+
111
113
  // Filter values text
112
114
  filterValueAny: 'всякакви',
113
115
  filterValueTrue: 'вярно',
@@ -116,6 +116,8 @@ const csCZGrid = {
116
116
  'headerFilterOperator>=': 'Větší než nebo rovno',
117
117
  'headerFilterOperator<': 'Menší než',
118
118
  'headerFilterOperator<=': 'Menší než nebo rovno',
119
+ // headerFilterClear: 'Clear filter',
120
+
119
121
  // Filter values text
120
122
  filterValueAny: 'jakýkoliv',
121
123
  filterValueTrue: 'ano',
@@ -108,6 +108,8 @@ const daDKGrid = {
108
108
  'headerFilterOperator>=': 'Større end eller lig med',
109
109
  'headerFilterOperator<': 'Mindre end',
110
110
  'headerFilterOperator<=': 'Mindre end eller lig med',
111
+ // headerFilterClear: 'Clear filter',
112
+
111
113
  // Filter values text
112
114
  filterValueAny: 'hvilken som helst',
113
115
  filterValueTrue: 'positiv',
@@ -106,6 +106,8 @@ const deDEGrid = {
106
106
  'headerFilterOperator>=': 'Größer als oder gleich',
107
107
  'headerFilterOperator<': 'Kleiner als',
108
108
  'headerFilterOperator<=': 'Kleiner als oder gleich',
109
+ // headerFilterClear: 'Clear filter',
110
+
109
111
  // Filter values text
110
112
  filterValueAny: 'Beliebig',
111
113
  filterValueTrue: 'Ja',
@@ -108,6 +108,8 @@ const elGRGrid = {
108
108
  'headerFilterOperator>=': 'Μεγαλύτερο ή ίσο με',
109
109
  'headerFilterOperator<': 'Μικρότερο από',
110
110
  'headerFilterOperator<=': 'Μικρότερο ή ίσο με',
111
+ // headerFilterClear: 'Clear filter',
112
+
111
113
  // Filter values text
112
114
  filterValueAny: 'οποιοδήποτε',
113
115
  filterValueTrue: 'αληθές',
@@ -106,6 +106,8 @@ const esESGrid = {
106
106
  'headerFilterOperator>=': 'Es mayor o igual que',
107
107
  'headerFilterOperator<': 'Es menor que',
108
108
  'headerFilterOperator<=': 'Es menor o igual que',
109
+ // headerFilterClear: 'Clear filter',
110
+
109
111
  // Filter values text
110
112
  filterValueAny: 'cualquiera',
111
113
  filterValueTrue: 'verdadero',
@@ -51,8 +51,7 @@ const faIRGrid = {
51
51
  columnsManagementNoColumns: 'بدون سطر',
52
52
  columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
53
53
  columnsManagementReset: 'بازنشانی',
54
- // columnsManagementDeleteIconLabel: 'Clear',
55
-
54
+ columnsManagementDeleteIconLabel: 'پاک کردن',
56
55
  // Filter panel text
57
56
  filterPanelAddFilter: 'افزودن فیلتر',
58
57
  filterPanelRemoveAll: 'حذف همه',
@@ -66,9 +65,9 @@ const faIRGrid = {
66
65
  filterPanelInputPlaceholder: 'فیلتر مقدار',
67
66
  // Filter operators text
68
67
  filterOperatorContains: 'شامل',
69
- // filterOperatorDoesNotContain: 'does not contain',
68
+ filterOperatorDoesNotContain: 'شامل نمیشود',
70
69
  filterOperatorEquals: 'مساوی',
71
- // filterOperatorDoesNotEqual: 'does not equal',
70
+ filterOperatorDoesNotEqual: 'برابر نیست',
72
71
  filterOperatorStartsWith: 'شروع با',
73
72
  filterOperatorEndsWith: 'پایان با',
74
73
  filterOperatorIs: 'هست',
@@ -88,9 +87,9 @@ const faIRGrid = {
88
87
  'filterOperator<=': '<=',
89
88
  // Header filter operators text
90
89
  headerFilterOperatorContains: 'شامل',
91
- // headerFilterOperatorDoesNotContain: 'Does not contain',
90
+ headerFilterOperatorDoesNotContain: 'شامل نمیشود',
92
91
  headerFilterOperatorEquals: 'مساوی',
93
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
92
+ headerFilterOperatorDoesNotEqual: 'برابر نیست',
94
93
  headerFilterOperatorStartsWith: 'شروع با',
95
94
  headerFilterOperatorEndsWith: 'پایان با',
96
95
  headerFilterOperatorIs: 'هست',
@@ -108,6 +107,8 @@ const faIRGrid = {
108
107
  'headerFilterOperator>=': 'بزرگتر یا مساوی',
109
108
  'headerFilterOperator<': 'کوچکتر',
110
109
  'headerFilterOperator<=': 'کوچکتر یا مساوی',
110
+ // headerFilterClear: 'Clear filter',
111
+
111
112
  // Filter values text
112
113
  filterValueAny: 'هرچیزی',
113
114
  filterValueTrue: 'صحیح',