@mui/x-data-grid 8.0.0-alpha.12 → 8.0.0-alpha.13

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 (348) hide show
  1. package/CHANGELOG.md +299 -0
  2. package/DataGrid/DataGrid.js +31 -22
  3. package/DataGrid/useDataGridProps.js +1 -1
  4. package/colDef/gridCheckboxSelectionColDef.js +1 -3
  5. package/components/GridFooter.js +1 -1
  6. package/components/GridHeader.js +1 -1
  7. package/components/GridPagination.js +5 -6
  8. package/components/GridRowCount.js +4 -5
  9. package/components/GridScrollArea.js +4 -3
  10. package/components/GridSelectedRowCount.js +5 -6
  11. package/components/GridShadowScrollArea.d.ts +8 -0
  12. package/components/GridShadowScrollArea.js +82 -0
  13. package/components/cell/GridEditInputCell.js +2 -3
  14. package/components/columnSelection/GridHeaderCheckbox.js +51 -17
  15. package/components/columnsManagement/GridColumnsManagement.js +59 -61
  16. package/components/containers/GridOverlay.js +6 -8
  17. package/components/containers/GridRoot.js +4 -2
  18. package/components/containers/GridRootStyles.d.ts +1 -2
  19. package/components/containers/GridRootStyles.js +77 -100
  20. package/components/containers/GridToolbarContainer.js +5 -6
  21. package/components/menu/GridMenu.js +7 -6
  22. package/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -3
  23. package/components/panel/GridPanel.js +18 -20
  24. package/components/panel/GridPanelContent.js +6 -8
  25. package/components/panel/GridPanelFooter.js +5 -6
  26. package/components/panel/GridPanelHeader.js +4 -5
  27. package/components/panel/filterPanel/GridFilterForm.js +13 -20
  28. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
  29. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
  30. package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
  31. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +20 -45
  32. package/components/panel/filterPanel/GridFilterInputValue.js +3 -6
  33. package/components/toolbar/GridToolbarFilterButton.js +5 -6
  34. package/components/toolbar/GridToolbarQuickFilter.js +23 -30
  35. package/components/virtualization/GridVirtualScrollbar.js +8 -5
  36. package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
  37. package/constants/cssVariables.d.ts +294 -0
  38. package/constants/cssVariables.js +168 -0
  39. package/constants/dataGridPropsDefaultValues.js +1 -0
  40. package/constants/defaultGridSlotsComponents.js +1 -1
  41. package/constants/gridClasses.d.ts +13 -0
  42. package/constants/gridClasses.js +1 -1
  43. package/context/GridContextProvider.js +4 -1
  44. package/esm/DataGrid/DataGrid.js +31 -22
  45. package/esm/DataGrid/useDataGridProps.js +1 -1
  46. package/esm/colDef/gridCheckboxSelectionColDef.js +1 -3
  47. package/esm/components/GridFooter.js +2 -2
  48. package/esm/components/GridHeader.js +1 -1
  49. package/esm/components/GridPagination.js +5 -6
  50. package/esm/components/GridRowCount.js +4 -5
  51. package/esm/components/GridScrollArea.js +2 -1
  52. package/esm/components/GridSelectedRowCount.js +5 -6
  53. package/esm/components/GridShadowScrollArea.d.ts +8 -0
  54. package/esm/components/GridShadowScrollArea.js +74 -0
  55. package/esm/components/cell/GridEditInputCell.js +2 -3
  56. package/esm/components/columnSelection/GridHeaderCheckbox.js +51 -17
  57. package/esm/components/columnsManagement/GridColumnsManagement.js +60 -62
  58. package/esm/components/containers/GridOverlay.js +6 -8
  59. package/esm/components/containers/GridRoot.js +4 -2
  60. package/esm/components/containers/GridRootStyles.d.ts +1 -2
  61. package/esm/components/containers/GridRootStyles.js +78 -101
  62. package/esm/components/containers/GridToolbarContainer.js +5 -6
  63. package/esm/components/menu/GridMenu.js +7 -6
  64. package/esm/components/menu/columnMenu/GridColumnHeaderMenu.js +2 -1
  65. package/esm/components/panel/GridPanel.js +18 -20
  66. package/esm/components/panel/GridPanelContent.js +6 -8
  67. package/esm/components/panel/GridPanelFooter.js +5 -6
  68. package/esm/components/panel/GridPanelHeader.js +4 -5
  69. package/esm/components/panel/filterPanel/GridFilterForm.js +13 -20
  70. package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
  71. package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
  72. package/esm/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
  73. package/esm/components/panel/filterPanel/GridFilterInputMultipleValue.js +19 -44
  74. package/esm/components/panel/filterPanel/GridFilterInputValue.js +3 -6
  75. package/esm/components/toolbar/GridToolbarFilterButton.js +5 -6
  76. package/esm/components/toolbar/GridToolbarQuickFilter.js +23 -30
  77. package/esm/components/virtualization/GridVirtualScrollbar.js +3 -1
  78. package/esm/components/virtualization/GridVirtualScrollerFiller.js +2 -1
  79. package/esm/constants/cssVariables.d.ts +294 -0
  80. package/esm/constants/cssVariables.js +161 -0
  81. package/esm/constants/dataGridPropsDefaultValues.js +1 -0
  82. package/esm/constants/defaultGridSlotsComponents.js +2 -2
  83. package/esm/constants/gridClasses.d.ts +13 -0
  84. package/esm/constants/gridClasses.js +1 -1
  85. package/esm/context/GridContextProvider.js +4 -1
  86. package/esm/hooks/features/clipboard/useGridClipboard.js +3 -2
  87. package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  88. package/esm/hooks/features/columnResize/useGridColumnResize.js +2 -1
  89. package/esm/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
  90. package/esm/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
  91. package/esm/hooks/features/columns/gridColumnsSelector.js +8 -0
  92. package/esm/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
  93. package/esm/hooks/features/columns/gridColumnsUtils.js +6 -3
  94. package/esm/hooks/features/columns/index.d.ts +1 -1
  95. package/esm/hooks/features/columns/index.js +1 -1
  96. package/esm/hooks/features/columns/useGridColumns.js +4 -2
  97. package/esm/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
  98. package/esm/hooks/features/dataSource/gridDataSourceError.js +32 -0
  99. package/esm/hooks/features/dataSource/index.d.ts +2 -0
  100. package/esm/hooks/features/dataSource/index.js +2 -0
  101. package/esm/hooks/features/dataSource/models.d.ts +1 -1
  102. package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
  103. package/esm/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
  104. package/esm/hooks/features/dimensions/useGridDimensions.js +11 -10
  105. package/esm/hooks/features/editing/useGridCellEditing.js +2 -1
  106. package/esm/hooks/features/editing/useGridRowEditing.js +2 -1
  107. package/esm/hooks/features/export/utils.js +4 -2
  108. package/esm/hooks/features/focus/useGridFocus.js +3 -2
  109. package/esm/hooks/features/index.d.ts +1 -1
  110. package/esm/hooks/features/index.js +1 -1
  111. package/esm/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
  112. package/esm/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
  113. package/esm/hooks/features/rowSelection/useGridRowSelection.js +148 -81
  114. package/esm/hooks/features/rowSelection/utils.d.ts +2 -2
  115. package/esm/hooks/features/rowSelection/utils.js +11 -11
  116. package/esm/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
  117. package/esm/hooks/features/rows/gridRowsUtils.d.ts +2 -1
  118. package/esm/hooks/features/rows/gridRowsUtils.js +8 -0
  119. package/esm/hooks/features/rows/useGridParamsApi.js +2 -8
  120. package/esm/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
  121. package/esm/hooks/features/rows/useGridRows.d.ts +2 -2
  122. package/esm/hooks/features/rows/useGridRows.js +7 -7
  123. package/esm/hooks/features/virtualization/useGridVirtualScroller.js +5 -9
  124. package/esm/hooks/utils/useGridSelector.js +4 -1
  125. package/esm/hooks/utils/useIsSSR.js +4 -1
  126. package/esm/index.js +1 -1
  127. package/esm/internals/index.d.ts +2 -1
  128. package/esm/internals/index.js +2 -1
  129. package/esm/internals/utils/propValidation.js +1 -1
  130. package/esm/locales/bnBD.d.ts +2 -0
  131. package/esm/locales/bnBD.js +167 -0
  132. package/esm/locales/deDE.js +3 -5
  133. package/esm/locales/huHU.js +10 -13
  134. package/esm/locales/index.d.ts +1 -0
  135. package/esm/locales/index.js +1 -0
  136. package/esm/locales/ruRU.js +17 -21
  137. package/esm/material/index.d.ts +1 -0
  138. package/esm/material/index.js +164 -49
  139. package/esm/material/variables.d.ts +5 -0
  140. package/esm/material/variables.js +89 -0
  141. package/esm/models/api/gridRowSelectionApi.d.ts +4 -2
  142. package/esm/models/api/gridSortApi.d.ts +1 -1
  143. package/esm/models/configuration/gridConfiguration.d.ts +7 -1
  144. package/esm/models/gridBaseSlots.d.ts +56 -6
  145. package/esm/models/gridDataSource.d.ts +9 -4
  146. package/esm/models/gridRowSelectionManager.d.ts +9 -0
  147. package/esm/models/gridRowSelectionManager.js +36 -0
  148. package/esm/models/gridRowSelectionModel.d.ts +4 -2
  149. package/esm/models/gridSlotsComponent.d.ts +7 -27
  150. package/esm/models/gridSlotsComponentsProps.d.ts +3 -11
  151. package/esm/models/gridSortModel.d.ts +1 -1
  152. package/esm/models/index.d.ts +2 -1
  153. package/esm/models/index.js +2 -3
  154. package/esm/models/props/DataGridProps.d.ts +22 -17
  155. package/esm/utils/css/context.d.ts +14 -0
  156. package/esm/utils/css/context.js +54 -0
  157. package/esm/utils/index.d.ts +2 -1
  158. package/esm/utils/index.js +1 -1
  159. package/hooks/features/clipboard/useGridClipboard.js +3 -2
  160. package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  161. package/hooks/features/columnResize/useGridColumnResize.js +28 -27
  162. package/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
  163. package/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
  164. package/hooks/features/columns/gridColumnsSelector.js +9 -1
  165. package/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
  166. package/hooks/features/columns/gridColumnsUtils.js +6 -3
  167. package/hooks/features/columns/index.d.ts +1 -1
  168. package/hooks/features/columns/index.js +94 -10
  169. package/hooks/features/columns/useGridColumns.js +4 -2
  170. package/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
  171. package/hooks/features/dataSource/gridDataSourceError.js +40 -0
  172. package/hooks/features/dataSource/index.d.ts +2 -0
  173. package/hooks/features/dataSource/index.js +25 -0
  174. package/hooks/features/dataSource/models.d.ts +1 -1
  175. package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
  176. package/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
  177. package/hooks/features/dimensions/useGridDimensions.js +19 -18
  178. package/hooks/features/editing/useGridCellEditing.js +10 -9
  179. package/hooks/features/editing/useGridRowEditing.js +11 -10
  180. package/hooks/features/export/utils.js +4 -2
  181. package/hooks/features/focus/useGridFocus.js +8 -7
  182. package/hooks/features/index.d.ts +1 -1
  183. package/hooks/features/index.js +11 -28
  184. package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
  185. package/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
  186. package/hooks/features/rowSelection/useGridRowSelection.js +146 -79
  187. package/hooks/features/rowSelection/utils.d.ts +2 -2
  188. package/hooks/features/rowSelection/utils.js +10 -10
  189. package/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
  190. package/hooks/features/rows/gridRowsUtils.d.ts +2 -1
  191. package/hooks/features/rows/gridRowsUtils.js +10 -1
  192. package/hooks/features/rows/useGridParamsApi.js +2 -8
  193. package/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
  194. package/hooks/features/rows/useGridRows.d.ts +2 -2
  195. package/hooks/features/rows/useGridRows.js +7 -7
  196. package/hooks/features/virtualization/useGridVirtualScroller.js +21 -25
  197. package/hooks/utils/useGridSelector.js +6 -2
  198. package/hooks/utils/useIsSSR.js +6 -2
  199. package/index.js +1 -1
  200. package/internals/index.d.ts +2 -1
  201. package/internals/index.js +15 -0
  202. package/internals/utils/propValidation.js +1 -1
  203. package/locales/bnBD.d.ts +2 -0
  204. package/locales/bnBD.js +173 -0
  205. package/locales/deDE.js +3 -5
  206. package/locales/huHU.js +10 -13
  207. package/locales/index.d.ts +1 -0
  208. package/locales/index.js +11 -0
  209. package/locales/ruRU.js +17 -21
  210. package/material/index.d.ts +1 -0
  211. package/material/index.js +170 -49
  212. package/material/variables.d.ts +5 -0
  213. package/material/variables.js +95 -0
  214. package/models/api/gridRowSelectionApi.d.ts +4 -2
  215. package/models/api/gridSortApi.d.ts +1 -1
  216. package/models/configuration/gridConfiguration.d.ts +7 -1
  217. package/models/gridBaseSlots.d.ts +56 -6
  218. package/models/gridDataSource.d.ts +9 -4
  219. package/models/gridRowSelectionManager.d.ts +9 -0
  220. package/models/gridRowSelectionManager.js +43 -0
  221. package/models/gridRowSelectionModel.d.ts +4 -2
  222. package/models/gridSlotsComponent.d.ts +7 -27
  223. package/models/gridSlotsComponentsProps.d.ts +3 -11
  224. package/models/gridSortModel.d.ts +1 -1
  225. package/models/index.d.ts +2 -1
  226. package/models/index.js +34 -11
  227. package/models/props/DataGridProps.d.ts +22 -17
  228. package/modern/DataGrid/DataGrid.js +31 -22
  229. package/modern/DataGrid/useDataGridProps.js +1 -1
  230. package/modern/colDef/gridCheckboxSelectionColDef.js +1 -3
  231. package/modern/components/GridFooter.js +2 -2
  232. package/modern/components/GridHeader.js +1 -1
  233. package/modern/components/GridPagination.js +5 -6
  234. package/modern/components/GridRowCount.js +4 -5
  235. package/modern/components/GridScrollArea.js +2 -1
  236. package/modern/components/GridSelectedRowCount.js +5 -6
  237. package/modern/components/GridShadowScrollArea.d.ts +8 -0
  238. package/modern/components/GridShadowScrollArea.js +74 -0
  239. package/modern/components/cell/GridEditInputCell.js +2 -3
  240. package/modern/components/columnSelection/GridHeaderCheckbox.js +51 -17
  241. package/modern/components/columnsManagement/GridColumnsManagement.js +60 -62
  242. package/modern/components/containers/GridOverlay.js +6 -8
  243. package/modern/components/containers/GridRoot.js +4 -2
  244. package/modern/components/containers/GridRootStyles.d.ts +1 -2
  245. package/modern/components/containers/GridRootStyles.js +78 -101
  246. package/modern/components/containers/GridToolbarContainer.js +5 -6
  247. package/modern/components/menu/GridMenu.js +7 -6
  248. package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +2 -1
  249. package/modern/components/panel/GridPanel.js +18 -20
  250. package/modern/components/panel/GridPanelContent.js +6 -8
  251. package/modern/components/panel/GridPanelFooter.js +5 -6
  252. package/modern/components/panel/GridPanelHeader.js +4 -5
  253. package/modern/components/panel/filterPanel/GridFilterForm.js +13 -20
  254. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
  255. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +10 -39
  256. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
  257. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +19 -44
  258. package/modern/components/panel/filterPanel/GridFilterInputValue.js +3 -6
  259. package/modern/components/toolbar/GridToolbarFilterButton.js +5 -6
  260. package/modern/components/toolbar/GridToolbarQuickFilter.js +23 -30
  261. package/modern/components/virtualization/GridVirtualScrollbar.js +3 -1
  262. package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
  263. package/modern/constants/cssVariables.d.ts +294 -0
  264. package/modern/constants/cssVariables.js +161 -0
  265. package/modern/constants/dataGridPropsDefaultValues.js +1 -0
  266. package/modern/constants/defaultGridSlotsComponents.js +2 -2
  267. package/modern/constants/gridClasses.d.ts +13 -0
  268. package/modern/constants/gridClasses.js +1 -1
  269. package/modern/context/GridContextProvider.js +4 -1
  270. package/modern/hooks/features/clipboard/useGridClipboard.js +3 -2
  271. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  272. package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
  273. package/modern/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -0
  274. package/modern/hooks/features/columns/gridColumnsSelector.d.ts +7 -0
  275. package/modern/hooks/features/columns/gridColumnsSelector.js +8 -0
  276. package/modern/hooks/features/columns/gridColumnsUtils.d.ts +3 -1
  277. package/modern/hooks/features/columns/gridColumnsUtils.js +6 -3
  278. package/modern/hooks/features/columns/index.d.ts +1 -1
  279. package/modern/hooks/features/columns/index.js +1 -1
  280. package/modern/hooks/features/columns/useGridColumns.js +4 -2
  281. package/modern/hooks/features/dataSource/gridDataSourceError.d.ts +31 -0
  282. package/modern/hooks/features/dataSource/gridDataSourceError.js +32 -0
  283. package/modern/hooks/features/dataSource/index.d.ts +2 -0
  284. package/modern/hooks/features/dataSource/index.js +2 -0
  285. package/modern/hooks/features/dataSource/models.d.ts +1 -1
  286. package/modern/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
  287. package/modern/hooks/features/dataSource/useGridDataSourceBase.js +27 -17
  288. package/modern/hooks/features/dimensions/useGridDimensions.js +11 -10
  289. package/modern/hooks/features/editing/useGridCellEditing.js +2 -1
  290. package/modern/hooks/features/editing/useGridRowEditing.js +2 -1
  291. package/modern/hooks/features/export/utils.js +4 -2
  292. package/modern/hooks/features/focus/useGridFocus.js +3 -2
  293. package/modern/hooks/features/index.d.ts +1 -1
  294. package/modern/hooks/features/index.js +1 -1
  295. package/modern/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
  296. package/modern/hooks/features/rowSelection/gridRowSelectionSelector.js +27 -7
  297. package/modern/hooks/features/rowSelection/useGridRowSelection.js +148 -81
  298. package/modern/hooks/features/rowSelection/utils.d.ts +2 -2
  299. package/modern/hooks/features/rowSelection/utils.js +11 -11
  300. package/modern/hooks/features/rows/gridRowsInterfaces.d.ts +1 -1
  301. package/modern/hooks/features/rows/gridRowsUtils.d.ts +2 -1
  302. package/modern/hooks/features/rows/gridRowsUtils.js +8 -0
  303. package/modern/hooks/features/rows/useGridParamsApi.js +2 -8
  304. package/modern/hooks/features/rows/useGridRowAriaAttributes.js +2 -4
  305. package/modern/hooks/features/rows/useGridRows.d.ts +2 -2
  306. package/modern/hooks/features/rows/useGridRows.js +7 -7
  307. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +5 -9
  308. package/modern/hooks/utils/useGridSelector.js +4 -1
  309. package/modern/hooks/utils/useIsSSR.js +4 -1
  310. package/modern/index.js +1 -1
  311. package/modern/internals/index.d.ts +2 -1
  312. package/modern/internals/index.js +2 -1
  313. package/modern/internals/utils/propValidation.js +1 -1
  314. package/modern/locales/bnBD.d.ts +2 -0
  315. package/modern/locales/bnBD.js +167 -0
  316. package/modern/locales/deDE.js +3 -5
  317. package/modern/locales/huHU.js +10 -13
  318. package/modern/locales/index.d.ts +1 -0
  319. package/modern/locales/index.js +1 -0
  320. package/modern/locales/ruRU.js +17 -21
  321. package/modern/material/index.d.ts +1 -0
  322. package/modern/material/index.js +164 -49
  323. package/modern/material/variables.d.ts +5 -0
  324. package/modern/material/variables.js +89 -0
  325. package/modern/models/api/gridRowSelectionApi.d.ts +4 -2
  326. package/modern/models/api/gridSortApi.d.ts +1 -1
  327. package/modern/models/configuration/gridConfiguration.d.ts +7 -1
  328. package/modern/models/gridBaseSlots.d.ts +56 -6
  329. package/modern/models/gridDataSource.d.ts +9 -4
  330. package/modern/models/gridRowSelectionManager.d.ts +9 -0
  331. package/modern/models/gridRowSelectionManager.js +36 -0
  332. package/modern/models/gridRowSelectionModel.d.ts +4 -2
  333. package/modern/models/gridSlotsComponent.d.ts +7 -27
  334. package/modern/models/gridSlotsComponentsProps.d.ts +3 -11
  335. package/modern/models/gridSortModel.d.ts +1 -1
  336. package/modern/models/index.d.ts +2 -1
  337. package/modern/models/index.js +2 -3
  338. package/modern/models/props/DataGridProps.d.ts +22 -17
  339. package/modern/utils/css/context.d.ts +14 -0
  340. package/modern/utils/css/context.js +54 -0
  341. package/modern/utils/index.d.ts +2 -1
  342. package/modern/utils/index.js +1 -1
  343. package/package.json +2 -2
  344. package/tsconfig.build.tsbuildinfo +1 -1
  345. package/utils/css/context.d.ts +14 -0
  346. package/utils/css/context.js +64 -0
  347. package/utils/index.d.ts +2 -1
  348. package/utils/index.js +8 -1
@@ -11,9 +11,11 @@ import { GridContextProvider } from "../context/GridContextProvider.js";
11
11
  import { useDataGridComponent } from "./useDataGridComponent.js";
12
12
  import { useDataGridProps } from "./useDataGridProps.js";
13
13
  import { propValidatorsDataGrid, validateProps } from "../internals/utils/propValidation.js";
14
+ import { useMaterialCSSVariables } from "../material/variables.js";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  const configuration = {
16
17
  hooks: {
18
+ useCSSVariables: useMaterialCSSVariables,
17
19
  useGridAriaAttributes,
18
20
  useGridRowAriaAttributes
19
21
  }
@@ -138,6 +140,21 @@ DataGridRaw.propTypes = {
138
140
  * If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
139
141
  */
140
142
  columnVisibilityModel: PropTypes.object,
143
+ /**
144
+ * The data source object.
145
+ */
146
+ dataSource: PropTypes.shape({
147
+ getRows: PropTypes.func.isRequired,
148
+ updateRow: PropTypes.func
149
+ }),
150
+ /**
151
+ * Data source cache object.
152
+ */
153
+ dataSourceCache: PropTypes.shape({
154
+ clear: PropTypes.func.isRequired,
155
+ get: PropTypes.func.isRequired,
156
+ set: PropTypes.func.isRequired
157
+ }),
141
158
  /**
142
159
  * Set the density of the Data Grid.
143
160
  * @default "standard"
@@ -490,6 +507,11 @@ DataGridRaw.propTypes = {
490
507
  * @param {GridCallbackDetails} details Additional details for this callback.
491
508
  */
492
509
  onColumnWidthChange: PropTypes.func,
510
+ /**
511
+ * Callback fired when a data source request fails.
512
+ * @param {GridGetRowsError | GridUpdateRowError} error The data source error object.
513
+ */
514
+ onDataSourceError: PropTypes.func,
493
515
  /**
494
516
  * Callback fired when the density changes.
495
517
  * @param {GridDensity} density New density value.
@@ -687,7 +709,10 @@ DataGridRaw.propTypes = {
687
709
  /**
688
710
  * Sets the row selection model of the Data Grid.
689
711
  */
690
- rowSelectionModel: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.string]),
712
+ rowSelectionModel: PropTypes /* @typescript-to-proptypes-ignore */.shape({
713
+ ids: PropTypes.instanceOf(Set).isRequired,
714
+ type: PropTypes.oneOf(['exclude', 'include']).isRequired
715
+ }),
691
716
  /**
692
717
  * Sets the type of space between rows added by `getRowSpacing`.
693
718
  * @default "margin"
@@ -712,6 +737,11 @@ DataGridRaw.propTypes = {
712
737
  * @default false
713
738
  */
714
739
  showColumnVerticalBorder: PropTypes.bool,
740
+ /**
741
+ * If `true`, the toolbar is displayed.
742
+ * @default false
743
+ */
744
+ showToolbar: PropTypes.bool,
715
745
  /**
716
746
  * Overridable components props dynamically passed to the component at rendering.
717
747
  */
@@ -743,27 +773,6 @@ DataGridRaw.propTypes = {
743
773
  * The system prop that allows defining system overrides as well as additional CSS styles.
744
774
  */
745
775
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
746
- /**
747
- * The data source object.
748
- */
749
- unstable_dataSource: PropTypes.shape({
750
- getRows: PropTypes.func.isRequired,
751
- updateRow: PropTypes.func
752
- }),
753
- /**
754
- * Data source cache object.
755
- */
756
- unstable_dataSourceCache: PropTypes.shape({
757
- clear: PropTypes.func.isRequired,
758
- get: PropTypes.func.isRequired,
759
- set: PropTypes.func.isRequired
760
- }),
761
- /**
762
- * Callback fired when the data source request fails.
763
- * @param {Error} error The error object.
764
- * @param {GridGetRowsParams} params With all properties from [[GridGetRowsParams]].
765
- */
766
- unstable_onDataSourceError: PropTypes.func,
767
776
  /**
768
777
  * If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
769
778
  * By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
@@ -17,7 +17,7 @@ const DATA_GRID_FORCED_PROPS = {
17
17
  signature: 'DataGrid',
18
18
  unstable_listView: false
19
19
  };
20
- const getDataGridForcedProps = themedProps => _extends({}, DATA_GRID_FORCED_PROPS, themedProps.unstable_dataSource ? {
20
+ const getDataGridForcedProps = themedProps => _extends({}, DATA_GRID_FORCED_PROPS, themedProps.dataSource ? {
21
21
  filterMode: 'server',
22
22
  sortingMode: 'server',
23
23
  paginationMode: 'server'
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { GridCellCheckboxRenderer } from "../components/columnSelection/GridCellCheckboxRenderer.js";
4
4
  import { GridHeaderCheckbox } from "../components/columnSelection/GridHeaderCheckbox.js";
5
- import { selectedIdsLookupSelector } from "../hooks/features/rowSelection/gridRowSelectionSelector.js";
6
5
  import { GRID_BOOLEAN_COL_DEF } from "./gridBooleanColDef.js";
7
6
  import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -22,9 +21,8 @@ export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF
22
21
  getApplyQuickFilterFn: undefined,
23
22
  display: 'flex',
24
23
  valueGetter: (value, row, column, apiRef) => {
25
- const selectionLookup = selectedIdsLookupSelector(apiRef);
26
24
  const rowId = gridRowIdSelector(apiRef, row);
27
- return selectionLookup[rowId] !== undefined;
25
+ return apiRef.current.isRowSelected(rowId);
28
26
  },
29
27
  renderHeader: params => /*#__PURE__*/_jsx(GridHeaderCheckbox, _extends({}, params)),
30
28
  renderCell: params => /*#__PURE__*/_jsx(GridCellCheckboxRenderer, _extends({}, params))
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { forwardRef } from '@mui/x-internals/forwardRef';
5
5
  import { useGridSelector } from "../hooks/utils/useGridSelector.js";
6
6
  import { gridTopLevelRowCountSelector } from "../hooks/features/rows/gridRowsSelector.js";
7
- import { selectedGridRowsCountSelector } from "../hooks/features/rowSelection/gridRowSelectionSelector.js";
7
+ import { gridRowSelectionCountSelector } from "../hooks/features/rowSelection/gridRowSelectionSelector.js";
8
8
  import { gridFilteredTopLevelRowCountSelector } from "../hooks/features/filter/gridFilterSelector.js";
9
9
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
10
10
  import { GridSelectedRowCount } from "./GridSelectedRowCount.js";
@@ -15,7 +15,7 @@ const GridFooter = forwardRef(function GridFooter(props, ref) {
15
15
  const apiRef = useGridApiContext();
16
16
  const rootProps = useGridRootProps();
17
17
  const totalTopLevelRowCount = useGridSelector(apiRef, gridTopLevelRowCountSelector);
18
- const selectedRowCount = useGridSelector(apiRef, selectedGridRowsCountSelector);
18
+ const selectedRowCount = useGridSelector(apiRef, gridRowSelectionCountSelector);
19
19
  const visibleTopLevelRowCount = useGridSelector(apiRef, gridFilteredTopLevelRowCountSelector);
20
20
  const selectedRowCountElement = !rootProps.hideFooterSelectedRowCount && selectedRowCount > 0 ? /*#__PURE__*/_jsx(GridSelectedRowCount, {
21
21
  selectedRowCount: selectedRowCount
@@ -6,6 +6,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  export function GridHeader() {
7
7
  const rootProps = useGridRootProps();
8
8
  return /*#__PURE__*/_jsxs(React.Fragment, {
9
- children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, rootProps.slotProps?.toolbar))]
9
+ children: [/*#__PURE__*/_jsx(GridPreferencesPanel, {}), rootProps.showToolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, rootProps.slotProps?.toolbar))]
10
10
  });
11
11
  }
@@ -4,30 +4,29 @@ import { styled } from '@mui/material/styles';
4
4
  import PropTypes from 'prop-types';
5
5
  import TablePagination, { tablePaginationClasses } from '@mui/material/TablePagination';
6
6
  import { forwardRef } from '@mui/x-internals/forwardRef';
7
+ import { vars } from "../constants/cssVariables.js";
7
8
  import { useGridSelector } from "../hooks/utils/useGridSelector.js";
8
9
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
9
10
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
10
11
  import { gridPaginationModelSelector, gridPaginationRowCountSelector, gridPageCountSelector } from "../hooks/features/pagination/gridPaginationSelector.js";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
- const GridPaginationRoot = styled(TablePagination)(({
13
- theme
14
- }) => ({
13
+ const GridPaginationRoot = styled(TablePagination)({
15
14
  maxHeight: 'calc(100% + 1px)',
16
15
  // border width
17
16
  flexGrow: 1,
18
17
  [`& .${tablePaginationClasses.selectLabel}`]: {
19
18
  display: 'none',
20
- [theme.breakpoints.up('sm')]: {
19
+ [vars.breakpoints.up('sm')]: {
21
20
  display: 'block'
22
21
  }
23
22
  },
24
23
  [`& .${tablePaginationClasses.input}`]: {
25
24
  display: 'none',
26
- [theme.breakpoints.up('sm')]: {
25
+ [vars.breakpoints.up('sm')]: {
27
26
  display: 'inline-flex'
28
27
  }
29
28
  }
30
- }));
29
+ });
31
30
  const wrapLabelDisplayedRows = (labelDisplayedRows, estimated) => {
32
31
  return ({
33
32
  from,
@@ -7,6 +7,7 @@ import clsx from 'clsx';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { styled } from '@mui/system';
9
9
  import { forwardRef } from '@mui/x-internals/forwardRef';
10
+ import { vars } from "../constants/cssVariables.js";
10
11
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
11
12
  import { getDataGridUtilityClass } from "../constants/gridClasses.js";
12
13
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
@@ -24,13 +25,11 @@ const GridRowCountRoot = styled('div', {
24
25
  name: 'MuiDataGrid',
25
26
  slot: 'RowCount',
26
27
  overridesResolver: (props, styles) => styles.rowCount
27
- })(({
28
- theme
29
- }) => ({
28
+ })({
30
29
  alignItems: 'center',
31
30
  display: 'flex',
32
- margin: theme.spacing(0, 2)
33
- }));
31
+ margin: vars.spacing(0, 2)
32
+ });
34
33
  const GridRowCount = forwardRef(function GridRowCount(props, ref) {
35
34
  const {
36
35
  className,
@@ -3,7 +3,8 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
- import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
6
+ import useEventCallback from '@mui/utils/useEventCallback';
7
+ import composeClasses from '@mui/utils/composeClasses';
7
8
  import { styled } from '@mui/system';
8
9
  import { fastMemo } from '@mui/x-internals/fastMemo';
9
10
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
@@ -7,6 +7,7 @@ import clsx from 'clsx';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { styled } from '@mui/system';
9
9
  import { forwardRef } from '@mui/x-internals/forwardRef';
10
+ import { vars } from "../constants/cssVariables.js";
10
11
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
11
12
  import { getDataGridUtilityClass } from "../constants/gridClasses.js";
12
13
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
@@ -24,21 +25,19 @@ const GridSelectedRowCountRoot = styled('div', {
24
25
  name: 'MuiDataGrid',
25
26
  slot: 'SelectedRowCount',
26
27
  overridesResolver: (props, styles) => styles.selectedRowCount
27
- })(({
28
- theme
29
- }) => ({
28
+ })({
30
29
  alignItems: 'center',
31
30
  display: 'flex',
32
- margin: theme.spacing(0, 2),
31
+ margin: vars.spacing(0, 2),
33
32
  visibility: 'hidden',
34
33
  width: 0,
35
34
  height: 0,
36
- [theme.breakpoints.up('sm')]: {
35
+ [vars.breakpoints.up('sm')]: {
37
36
  visibility: 'visible',
38
37
  width: 'auto',
39
38
  height: 'auto'
40
39
  }
41
- }));
40
+ });
42
41
  const GridSelectedRowCount = forwardRef(function GridSelectedRowCount(props, ref) {
43
42
  const {
44
43
  className,
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ export interface GridShadowScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ children: React.ReactNode;
4
+ }
5
+ /**
6
+ * Adds scroll shadows above and below content in a scrollable container.
7
+ */
8
+ export declare function GridShadowScrollArea(props: GridShadowScrollAreaProps): React.JSX.Element;
@@ -0,0 +1,74 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["children"];
4
+ import * as React from 'react';
5
+ import { styled, keyframes } from '@mui/system';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const reveal = keyframes({
8
+ from: {
9
+ opacity: 0
10
+ },
11
+ to: {
12
+ opacity: 1
13
+ }
14
+ });
15
+ const detectScroll = keyframes({
16
+ 'from, to': {
17
+ '--scrollable': '" "'
18
+ }
19
+ });
20
+ const ShadowScrollArea = styled('div', {
21
+ name: 'MuiDataGrid',
22
+ slot: 'ShadowScrollArea'
23
+ })({
24
+ flex: 1,
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ animation: detectScroll,
28
+ animationTimeline: '--scroll-timeline',
29
+ animationFillMode: 'none',
30
+ boxSizing: 'border-box',
31
+ overflow: 'auto',
32
+ scrollTimeline: '--scroll-timeline block',
33
+ '&::before, &::after': {
34
+ content: '""',
35
+ flexShrink: 0,
36
+ display: 'block',
37
+ position: 'sticky',
38
+ left: 0,
39
+ width: '100%',
40
+ height: '4px',
41
+ animation: `${reveal} linear both`,
42
+ animationTimeline: '--scroll-timeline',
43
+ // Custom property toggle trick:
44
+ // - Detects if the element is scrollable
45
+ // - https://css-tricks.com/the-css-custom-property-toggle-trick/
46
+ '--visibility-scrollable': 'var(--scrollable) visible',
47
+ '--visibility-not-scrollable': 'hidden',
48
+ visibility: 'var(--visibility-scrollable, var(--visibility-not-scrollable))'
49
+ },
50
+ '&::before': {
51
+ top: 0,
52
+ background: 'linear-gradient(to bottom, rgba(0,0,0,0.05) 0, transparent 100%)',
53
+ animationRange: '0 4px'
54
+ },
55
+ '&::after': {
56
+ bottom: 0,
57
+ background: 'linear-gradient(to top, rgba(0,0,0,0.05) 0, transparent 100%)',
58
+ animationDirection: 'reverse',
59
+ animationRange: 'calc(100% - 4px) 100%'
60
+ }
61
+ });
62
+
63
+ /**
64
+ * Adds scroll shadows above and below content in a scrollable container.
65
+ */
66
+ export function GridShadowScrollArea(props) {
67
+ const {
68
+ children
69
+ } = props,
70
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
71
+ return /*#__PURE__*/_jsx(ShadowScrollArea, _extends({}, rest, {
72
+ children: children
73
+ }));
74
+ }
@@ -7,6 +7,7 @@ import { unstable_composeClasses as composeClasses, unstable_useEnhancedEffect a
7
7
  import { styled } from '@mui/material/styles';
8
8
  import { forwardRef } from '@mui/x-internals/forwardRef';
9
9
  import { NotRendered } from "../../utils/assert.js";
10
+ import { vars } from "../../constants/cssVariables.js";
10
11
  import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
11
12
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
12
13
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
@@ -23,9 +24,7 @@ const useUtilityClasses = ownerState => {
23
24
  const GridEditInputCellRoot = styled(NotRendered, {
24
25
  name: 'MuiDataGrid',
25
26
  slot: 'EditInputCell'
26
- })(({
27
- theme
28
- }) => _extends({}, theme.typography.body2, {
27
+ })(_extends({}, vars.typography.body, {
29
28
  padding: '1px 0',
30
29
  '& input': {
31
30
  padding: '0 16px',
@@ -14,6 +14,7 @@ import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
14
14
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
15
15
  import { gridExpandedSortedRowIdsSelector } from "../../hooks/features/filter/gridFilterSelector.js";
16
16
  import { gridPaginatedVisibleSortedGridRowIdsSelector } from "../../hooks/features/pagination/gridPaginationSelector.js";
17
+ import { createRowSelectionManager } from "../../models/gridRowSelectionManager.js";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  const useUtilityClasses = ownerState => {
19
20
  const {
@@ -38,39 +39,72 @@ const GridHeaderCheckbox = forwardRef(function GridHeaderCheckbox(props, ref) {
38
39
  const visibleRowIds = useGridSelector(apiRef, gridExpandedSortedRowIdsSelector);
39
40
  const paginatedVisibleRowIds = useGridSelector(apiRef, gridPaginatedVisibleSortedGridRowIdsSelector);
40
41
  const filteredSelection = React.useMemo(() => {
41
- if (typeof rootProps.isRowSelectable !== 'function') {
42
+ const isRowSelectable = rootProps.isRowSelectable;
43
+ if (typeof isRowSelectable !== 'function') {
42
44
  return selection;
43
45
  }
44
- return selection.filter(id => {
46
+ if (selection.type === 'exclude') {
47
+ return selection;
48
+ }
49
+
50
+ // selection.type === 'include'
51
+ const selectionModel = {
52
+ type: 'include',
53
+ ids: new Set()
54
+ };
55
+ for (const id of selection.ids) {
45
56
  if (rootProps.keepNonExistentRowsSelected) {
46
- return true;
57
+ selectionModel.ids.add(id);
47
58
  }
48
59
  // The row might have been deleted
49
60
  if (!apiRef.current.getRow(id)) {
50
- return false;
61
+ continue;
62
+ }
63
+ if (isRowSelectable(apiRef.current.getRowParams(id))) {
64
+ selectionModel.ids.add(id);
51
65
  }
52
- return rootProps.isRowSelectable(apiRef.current.getRowParams(id));
53
- });
54
- }, [apiRef, rootProps.isRowSelectable, selection, rootProps.keepNonExistentRowsSelected]);
66
+ }
67
+ return selectionModel;
68
+ }, [apiRef, rootProps.isRowSelectable, rootProps.keepNonExistentRowsSelected, selection]);
55
69
 
56
70
  // All the rows that could be selected / unselected by toggling this checkbox
57
71
  const selectionCandidates = React.useMemo(() => {
58
72
  const rowIds = !rootProps.pagination || !rootProps.checkboxSelectionVisibleOnly ? visibleRowIds : paginatedVisibleRowIds;
59
73
 
60
- // Convert to an object to make O(1) checking if a row exists or not
61
- // TODO create selector that returns visibleRowIds/paginatedVisibleRowIds as an object
62
- return rowIds.reduce((acc, id) => {
63
- if (!apiRef.current.isRowSelectable(id)) {
64
- return acc;
74
+ // Convert to a Set to make O(1) checking if a row exists or not
75
+ const candidates = new Set();
76
+ for (let i = 0; i < rowIds.length; i += 1) {
77
+ const id = rowIds[i];
78
+ if (apiRef.current.isRowSelectable(id)) {
79
+ candidates.add(id);
65
80
  }
66
- acc[id] = true;
67
- return acc;
68
- }, {});
81
+ }
82
+ return candidates;
69
83
  }, [apiRef, rootProps.pagination, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
70
84
 
71
85
  // Amount of rows selected and that are visible in the current page
72
- const currentSelectionSize = React.useMemo(() => filteredSelection.filter(id => selectionCandidates[id]).length, [filteredSelection, selectionCandidates]);
73
- const isIndeterminate = currentSelectionSize > 0 && currentSelectionSize < Object.keys(selectionCandidates).length;
86
+ const currentSelectionSize = React.useMemo(() => {
87
+ const selectionManager = createRowSelectionManager(filteredSelection);
88
+ let size = 0;
89
+ for (const id of selectionCandidates) {
90
+ if (selectionManager.has(id)) {
91
+ size += 1;
92
+ }
93
+ }
94
+ return size;
95
+ }, [filteredSelection, selectionCandidates]);
96
+ const isIndeterminate = React.useMemo(() => {
97
+ if (filteredSelection.ids.size === 0) {
98
+ return false;
99
+ }
100
+ const selectionManager = createRowSelectionManager(filteredSelection);
101
+ for (const rowId of selectionCandidates) {
102
+ if (!selectionManager.has(rowId)) {
103
+ return true;
104
+ }
105
+ }
106
+ return false;
107
+ }, [filteredSelection, selectionCandidates]);
74
108
  const isChecked = currentSelectionSize > 0;
75
109
  const handleChange = event => {
76
110
  const params = {
@@ -5,14 +5,15 @@ import PropTypes from 'prop-types';
5
5
  import composeClasses from '@mui/utils/composeClasses';
6
6
  import { styled } from '@mui/material/styles';
7
7
  import { inputBaseClasses } from '@mui/material/InputBase';
8
- import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from "../../hooks/features/columns/gridColumnsSelector.js";
8
+ import { vars } from "../../constants/cssVariables.js";
9
+ import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector, gridInitialColumnVisibilityModelSelector } from "../../hooks/features/columns/gridColumnsSelector.js";
9
10
  import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
10
11
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
11
12
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
12
13
  import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
13
- import { useLazyRef } from "../../hooks/utils/useLazyRef.js";
14
14
  import { checkColumnVisibilityModelsSame, defaultSearchPredicate } from "./utils.js";
15
15
  import { NotRendered } from "../../utils/assert.js";
16
+ import { GridShadowScrollArea } from "../GridShadowScrollArea.js";
16
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
18
  const useUtilityClasses = ownerState => {
18
19
  const {
@@ -32,7 +33,7 @@ function GridColumnsManagement(props) {
32
33
  const apiRef = useGridApiContext();
33
34
  const searchInputRef = React.useRef(null);
34
35
  const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
35
- const initialColumnVisibilityModel = useLazyRef(() => gridColumnVisibilityModelSelector(apiRef)).current;
36
+ const initialColumnVisibilityModel = useGridSelector(apiRef, gridInitialColumnVisibilityModelSelector);
36
37
  const columnVisibilityModel = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
37
38
  const rootProps = useGridRootProps();
38
39
  const [searchValue, setSearchValue] = React.useState('');
@@ -132,20 +133,20 @@ function GridColumnsManagement(props) {
132
133
  type: "search",
133
134
  slotProps: {
134
135
  input: {
135
- startAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseInputAdornment, {
136
- position: "start",
137
- children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {})
136
+ startAdornment: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {
137
+ fontSize: "small"
138
138
  }),
139
139
  endAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
140
- "aria-label": apiRef.current.getLocaleText('columnsManagementDeleteIconLabel'),
141
140
  size: "small",
141
+ "aria-label": apiRef.current.getLocaleText('columnsManagementDeleteIconLabel'),
142
142
  style: searchValue ? {
143
143
  visibility: 'visible'
144
144
  } : {
145
145
  visibility: 'hidden'
146
146
  },
147
147
  tabIndex: -1,
148
- onClick: handleSearchReset
148
+ onClick: handleSearchReset,
149
+ edge: "end"
149
150
  }, rootProps.slotProps?.baseIconButton, {
150
151
  children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterClearIcon, {
151
152
  fontSize: "small"
@@ -159,25 +160,27 @@ function GridColumnsManagement(props) {
159
160
  autoComplete: "off",
160
161
  fullWidth: true
161
162
  }, rootProps.slotProps?.baseTextField, searchInputProps))
162
- }), /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
163
- className: classes.root,
163
+ }), /*#__PURE__*/_jsx(GridColumnsManagementScrollArea, {
164
164
  ownerState: rootProps,
165
- children: [currentColumns.map(column => /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
166
- className: classes.row,
167
- disabled: column.hideable === false,
168
- checked: columnVisibilityModel[column.field] !== false,
169
- onClick: toggleColumn,
170
- name: column.field,
171
- inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined,
172
- label: column.headerName || column.field,
173
- size: "medium",
174
- density: "compact",
175
- fullWidth: true
176
- }, rootProps.slotProps?.baseCheckbox), column.field)), currentColumns.length === 0 && /*#__PURE__*/_jsx(GridColumnsManagementEmptyText, {
165
+ children: /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
166
+ className: classes.root,
177
167
  ownerState: rootProps,
178
- children: apiRef.current.getLocaleText('columnsManagementNoColumns')
179
- })]
180
- }), (!disableShowHideToggle || !disableResetButton) && currentColumns.length > 0 ? /*#__PURE__*/_jsxs(GridColumnsManagementFooter, {
168
+ children: [currentColumns.map(column => /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
169
+ className: classes.row,
170
+ disabled: column.hideable === false,
171
+ checked: columnVisibilityModel[column.field] !== false,
172
+ onClick: toggleColumn,
173
+ name: column.field,
174
+ inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined,
175
+ label: column.headerName || column.field,
176
+ density: "compact",
177
+ fullWidth: true
178
+ }, rootProps.slotProps?.baseCheckbox), column.field)), currentColumns.length === 0 && /*#__PURE__*/_jsx(GridColumnsManagementEmptyText, {
179
+ ownerState: rootProps,
180
+ children: apiRef.current.getLocaleText('columnsManagementNoColumns')
181
+ })]
182
+ })
183
+ }), !disableShowHideToggle || !disableResetButton ? /*#__PURE__*/_jsxs(GridColumnsManagementFooter, {
181
184
  ownerState: rootProps,
182
185
  className: classes.footer,
183
186
  children: [!disableShowHideToggle ? /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
@@ -186,7 +189,8 @@ function GridColumnsManagement(props) {
186
189
  indeterminate: !allHideableColumnsVisible && !allHideableColumnsHidden,
187
190
  onClick: () => toggleAllColumns(!allHideableColumnsVisible),
188
191
  name: apiRef.current.getLocaleText('columnsManagementShowHideAllText'),
189
- label: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
192
+ label: apiRef.current.getLocaleText('columnsManagementShowHideAllText'),
193
+ density: "compact"
190
194
  }, rootProps.slotProps?.baseCheckbox)) : /*#__PURE__*/_jsx("span", {}), !disableResetButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
191
195
  onClick: () => apiRef.current.setColumnVisibilityModel(initialColumnVisibilityModel),
192
196
  disabled: isResetDisabled
@@ -262,57 +266,51 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
262
266
  const GridColumnsManagementBody = styled('div', {
263
267
  name: 'MuiDataGrid',
264
268
  slot: 'ColumnsManagement'
265
- })(({
266
- theme
267
- }) => ({
268
- padding: theme.spacing(0, 2, 1.5),
269
+ })({
269
270
  display: 'flex',
270
271
  flexDirection: 'column',
271
- overflow: 'auto',
272
- flex: '1 1',
273
- maxHeight: 400,
274
- alignItems: 'flex-start'
275
- }));
272
+ padding: vars.spacing(0.5, 1.5)
273
+ });
274
+ const GridColumnsManagementScrollArea = styled(GridShadowScrollArea, {
275
+ name: 'MuiDataGrid',
276
+ slot: 'ColumnsManagementScrollArea'
277
+ })({
278
+ maxHeight: 400
279
+ });
276
280
  const GridColumnsManagementHeader = styled('div', {
277
281
  name: 'MuiDataGrid',
278
282
  slot: 'ColumnsManagementHeader'
279
- })(({
280
- theme
281
- }) => ({
282
- padding: theme.spacing(1.5, 3)
283
- }));
283
+ })({
284
+ padding: vars.spacing(1.5, 2),
285
+ borderBottom: `1px solid ${vars.colors.border.base}`
286
+ });
284
287
  const SearchInput = styled(NotRendered, {
285
288
  name: 'MuiDataGrid',
286
289
  slot: 'ColumnsManagementSearchInput'
287
- })(({
288
- theme
289
- }) => ({
290
- [`& .${inputBaseClasses.root}`]: {
291
- padding: theme.spacing(0, 1.5, 0, 1.5)
292
- },
290
+ })({
293
291
  [`& .${inputBaseClasses.input}::-webkit-search-decoration,
294
- & .${inputBaseClasses.input}::-webkit-search-cancel-button,
295
- & .${inputBaseClasses.input}::-webkit-search-results-button,
296
- & .${inputBaseClasses.input}::-webkit-search-results-decoration`]: {
292
+ & .${inputBaseClasses.input}::-webkit-search-cancel-button,
293
+ & .${inputBaseClasses.input}::-webkit-search-results-button,
294
+ & .${inputBaseClasses.input}::-webkit-search-results-decoration`]: {
297
295
  /* clears the 'X' icon from Chrome */
298
296
  display: 'none'
299
297
  }
300
- }));
298
+ });
301
299
  const GridColumnsManagementFooter = styled('div', {
302
300
  name: 'MuiDataGrid',
303
301
  slot: 'ColumnsManagementFooter'
304
- })(({
305
- theme
306
- }) => ({
307
- padding: theme.spacing(0.5, 1, 0.5, 3),
302
+ })({
303
+ padding: vars.spacing(1, 1, 1, 1.5),
308
304
  display: 'flex',
309
305
  justifyContent: 'space-between',
310
- borderTop: `1px solid ${theme.palette.divider}`
311
- }));
312
- const GridColumnsManagementEmptyText = styled('div')(({
313
- theme
314
- }) => ({
315
- padding: theme.spacing(0.5, 0),
316
- color: theme.palette.grey[500]
317
- }));
306
+ borderTop: `1px solid ${vars.colors.border.base}`
307
+ });
308
+ const GridColumnsManagementEmptyText = styled('div', {
309
+ name: 'MuiDataGrid',
310
+ slot: 'ColumnsManagementEmptyText'
311
+ })({
312
+ padding: vars.spacing(1, 0),
313
+ alignSelf: 'center',
314
+ fontSize: vars.typography.body.fontSize
315
+ });
318
316
  export { GridColumnsManagement };