@mui/x-data-grid 6.0.0-alpha.2 → 6.0.0-alpha.4

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 (293) hide show
  1. package/CHANGELOG.md +493 -141
  2. package/DataGrid/DataGrid.js +14 -34
  3. package/DataGrid/useDataGridComponent.js +8 -14
  4. package/DataGrid/useDataGridProps.js +3 -3
  5. package/colDef/gridCheckboxSelectionColDef.js +1 -1
  6. package/colDef/gridNumericOperators.d.ts +1 -1
  7. package/colDef/gridSingleSelectOperators.d.ts +1 -1
  8. package/colDef/gridStringOperators.d.ts +1 -1
  9. package/components/GridFooter.js +1 -1
  10. package/components/GridRow.js +2 -2
  11. package/components/base/GridBody.js +2 -2
  12. package/components/cell/GridEditInputCell.js +3 -8
  13. package/components/cell/GridEditSingleSelectCell.js +6 -38
  14. package/components/columnHeaders/GridColumnGroupHeader.d.ts +2 -0
  15. package/components/columnHeaders/GridColumnGroupHeader.js +32 -5
  16. package/components/columnSelection/GridHeaderCheckbox.js +3 -3
  17. package/components/containers/GridRoot.js +4 -3
  18. package/components/panel/GridColumnsPanel.d.ts +2 -0
  19. package/components/panel/GridColumnsPanel.js +10 -4
  20. package/components/panel/filterPanel/GridFilterForm.d.ts +12 -0
  21. package/components/panel/filterPanel/GridFilterForm.js +29 -7
  22. package/components/panel/filterPanel/GridFilterPanel.d.ts +12 -0
  23. package/components/panel/filterPanel/GridFilterPanel.js +64 -19
  24. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +1 -1
  25. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
  26. package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +1 -1
  27. package/hooks/core/useGridInitialization.d.ts +1 -1
  28. package/hooks/core/useGridStateInitialization.d.ts +1 -1
  29. package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +10 -1
  30. package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +6 -0
  31. package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +34 -1
  32. package/hooks/features/columnGrouping/gridColumnGroupsUtils.d.ts +15 -0
  33. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +89 -0
  34. package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -15
  35. package/hooks/features/columnGrouping/useGridColumnGrouping.js +66 -66
  36. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
  37. package/hooks/features/columnHeaders/useGridColumnHeaders.js +60 -116
  38. package/hooks/features/density/densitySelector.d.ts +0 -2
  39. package/hooks/features/density/densitySelector.js +1 -3
  40. package/hooks/features/density/densityState.d.ts +0 -1
  41. package/hooks/features/density/useGridDensity.d.ts +1 -1
  42. package/hooks/features/density/useGridDensity.js +9 -45
  43. package/hooks/features/dimensions/useGridDimensions.js +3 -2
  44. package/hooks/features/{editRows/gridEditRowsSelector.d.ts → editing/gridEditingSelectors.d.ts} +0 -0
  45. package/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
  46. package/hooks/features/editing/index.d.ts +1 -0
  47. package/hooks/features/editing/index.js +1 -0
  48. package/hooks/features/{editRows/useGridCellEditing.new.d.ts → editing/useGridCellEditing.d.ts} +0 -0
  49. package/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
  50. package/hooks/features/{editRows/useGridEditing.new.d.ts → editing/useGridEditing.d.ts} +0 -0
  51. package/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
  52. package/hooks/features/{editRows/useGridRowEditing.new.d.ts → editing/useGridRowEditing.d.ts} +0 -0
  53. package/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
  54. package/hooks/features/export/useGridPrintExport.js +2 -2
  55. package/hooks/features/focus/gridFocusState.d.ts +6 -0
  56. package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -0
  57. package/hooks/features/focus/gridFocusStateSelector.js +6 -2
  58. package/hooks/features/focus/useGridFocus.js +69 -11
  59. package/hooks/features/index.d.ts +2 -2
  60. package/hooks/features/index.js +2 -2
  61. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +135 -1
  62. package/hooks/features/{selection/gridSelectionSelector.d.ts → rowSelection/gridRowSelectionSelector.d.ts} +1 -1
  63. package/hooks/features/rowSelection/gridRowSelectionSelector.js +9 -0
  64. package/hooks/features/rowSelection/index.d.ts +1 -0
  65. package/hooks/features/rowSelection/index.js +1 -0
  66. package/hooks/features/rowSelection/useGridRowSelection.d.ts +12 -0
  67. package/hooks/features/{selection/useGridSelection.js → rowSelection/useGridRowSelection.js} +37 -37
  68. package/hooks/features/{selection/useGridSelectionPreProcessors.d.ts → rowSelection/useGridRowSelectionPreProcessors.d.ts} +1 -1
  69. package/hooks/features/{selection/useGridSelectionPreProcessors.js → rowSelection/useGridRowSelectionPreProcessors.js} +1 -1
  70. package/hooks/features/rows/gridRowsInterfaces.d.ts +4 -0
  71. package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  72. package/hooks/features/rows/gridRowsUtils.js +5 -2
  73. package/hooks/features/rows/useGridRows.js +23 -7
  74. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
  75. package/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
  76. package/hooks/utils/useGridApi.d.ts +1 -1
  77. package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
  78. package/hooks/utils/useGridApiRef.d.ts +1 -1
  79. package/hooks/utils/useGridInitializeState.d.ts +1 -1
  80. package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
  81. package/hooks/utils/useGridSelector.d.ts +1 -1
  82. package/hooks/utils/useGridState.d.ts +1 -1
  83. package/hooks/utils/useGridVisibleRows.d.ts +2 -2
  84. package/index.js +1 -1
  85. package/internals/index.d.ts +3 -5
  86. package/internals/index.js +3 -5
  87. package/legacy/DataGrid/DataGrid.js +14 -34
  88. package/legacy/DataGrid/useDataGridComponent.js +8 -14
  89. package/legacy/DataGrid/useDataGridProps.js +3 -3
  90. package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -1
  91. package/legacy/components/GridFooter.js +1 -1
  92. package/legacy/components/GridRow.js +2 -2
  93. package/legacy/components/base/GridBody.js +2 -2
  94. package/legacy/components/cell/GridEditInputCell.js +3 -8
  95. package/legacy/components/cell/GridEditSingleSelectCell.js +6 -52
  96. package/legacy/components/columnHeaders/GridColumnGroupHeader.js +46 -13
  97. package/legacy/components/columnSelection/GridHeaderCheckbox.js +3 -3
  98. package/legacy/components/containers/GridRoot.js +4 -3
  99. package/legacy/components/panel/GridColumnsPanel.js +10 -3
  100. package/legacy/components/panel/filterPanel/GridFilterForm.js +31 -7
  101. package/legacy/components/panel/filterPanel/GridFilterPanel.js +67 -18
  102. package/legacy/hooks/features/columnGrouping/gridColumnGroupsSelector.js +33 -1
  103. package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +96 -0
  104. package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +64 -64
  105. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +70 -122
  106. package/legacy/hooks/features/density/densitySelector.js +0 -6
  107. package/legacy/hooks/features/density/useGridDensity.js +6 -44
  108. package/legacy/hooks/features/dimensions/useGridDimensions.js +3 -2
  109. package/legacy/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
  110. package/legacy/hooks/features/editing/index.js +1 -0
  111. package/legacy/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
  112. package/legacy/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
  113. package/legacy/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
  114. package/legacy/hooks/features/export/useGridPrintExport.js +2 -2
  115. package/legacy/hooks/features/focus/gridFocusStateSelector.js +8 -0
  116. package/legacy/hooks/features/focus/useGridFocus.js +72 -11
  117. package/legacy/hooks/features/index.js +2 -2
  118. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +129 -1
  119. package/legacy/hooks/features/rowSelection/gridRowSelectionSelector.js +19 -0
  120. package/legacy/hooks/features/rowSelection/index.js +1 -0
  121. package/legacy/hooks/features/{selection/useGridSelection.js → rowSelection/useGridRowSelection.js} +37 -37
  122. package/legacy/hooks/features/{selection/useGridSelectionPreProcessors.js → rowSelection/useGridRowSelectionPreProcessors.js} +1 -1
  123. package/legacy/hooks/features/rows/gridRowsUtils.js +5 -2
  124. package/legacy/hooks/features/rows/useGridRows.js +25 -7
  125. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
  126. package/legacy/index.js +1 -1
  127. package/legacy/internals/index.js +3 -5
  128. package/legacy/locales/trTR.js +17 -17
  129. package/legacy/models/api/{gridSelectionApi.js → gridRowSelectionApi.js} +0 -0
  130. package/legacy/models/api/index.js +1 -1
  131. package/legacy/models/{gridSelectionModel.js → gridRowSelectionModel.js} +0 -0
  132. package/legacy/models/index.js +1 -1
  133. package/{models/api/gridSelectionApi.js → legacy/models/params/gridColumnGroupHeaderParams.js} +0 -0
  134. package/legacy/models/params/gridEditCellParams.js +0 -4
  135. package/legacy/models/params/index.js +1 -0
  136. package/locales/trTR.js +17 -17
  137. package/models/api/gridApiCommon.d.ts +3 -6
  138. package/models/api/gridApiCommunity.d.ts +1 -7
  139. package/models/api/gridEditingApi.d.ts +36 -121
  140. package/models/api/gridFocusApi.d.ts +13 -0
  141. package/models/api/{gridSelectionApi.d.ts → gridRowSelectionApi.d.ts} +2 -2
  142. package/models/{gridSelectionModel.js → api/gridRowSelectionApi.js} +0 -0
  143. package/models/api/index.d.ts +2 -2
  144. package/models/api/index.js +1 -1
  145. package/models/colDef/gridColDef.d.ts +0 -8
  146. package/models/events/gridEventLookup.d.ts +30 -19
  147. package/models/gridColumnGrouping.d.ts +1 -26
  148. package/models/gridRowSelectionModel.d.ts +3 -0
  149. package/{modern/models/api/gridSelectionApi.js → models/gridRowSelectionModel.js} +0 -0
  150. package/models/gridStateCommunity.d.ts +2 -2
  151. package/models/index.d.ts +1 -1
  152. package/models/index.js +1 -1
  153. package/models/params/gridColumnGroupHeaderParams.d.ts +30 -0
  154. package/{modern/models/gridSelectionModel.js → models/params/gridColumnGroupHeaderParams.js} +0 -0
  155. package/models/params/gridEditCellParams.d.ts +4 -17
  156. package/models/params/gridEditCellParams.js +0 -4
  157. package/models/params/gridRowParams.d.ts +4 -4
  158. package/models/params/index.d.ts +1 -0
  159. package/models/params/index.js +1 -0
  160. package/models/props/DataGridProps.d.ts +8 -32
  161. package/modern/DataGrid/DataGrid.js +14 -34
  162. package/modern/DataGrid/useDataGridComponent.js +8 -12
  163. package/modern/DataGrid/useDataGridProps.js +3 -3
  164. package/modern/colDef/gridCheckboxSelectionColDef.js +1 -1
  165. package/modern/components/GridFooter.js +1 -1
  166. package/modern/components/GridRow.js +2 -2
  167. package/modern/components/base/GridBody.js +2 -2
  168. package/modern/components/cell/GridEditInputCell.js +3 -4
  169. package/modern/components/cell/GridEditSingleSelectCell.js +6 -34
  170. package/modern/components/columnHeaders/GridColumnGroupHeader.js +32 -5
  171. package/modern/components/columnSelection/GridHeaderCheckbox.js +3 -3
  172. package/modern/components/containers/GridRoot.js +4 -3
  173. package/modern/components/panel/GridColumnsPanel.js +10 -4
  174. package/modern/components/panel/filterPanel/GridFilterForm.js +29 -7
  175. package/modern/components/panel/filterPanel/GridFilterPanel.js +62 -17
  176. package/modern/hooks/features/columnGrouping/gridColumnGroupsSelector.js +14 -1
  177. package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +83 -0
  178. package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +50 -62
  179. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +58 -98
  180. package/modern/hooks/features/density/densitySelector.js +1 -3
  181. package/modern/hooks/features/density/useGridDensity.js +9 -37
  182. package/modern/hooks/features/dimensions/useGridDimensions.js +3 -2
  183. package/modern/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
  184. package/modern/hooks/features/editing/index.js +1 -0
  185. package/modern/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
  186. package/modern/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
  187. package/modern/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
  188. package/modern/hooks/features/export/useGridPrintExport.js +2 -2
  189. package/modern/hooks/features/focus/gridFocusStateSelector.js +6 -2
  190. package/modern/hooks/features/focus/useGridFocus.js +69 -11
  191. package/modern/hooks/features/index.js +2 -2
  192. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +135 -1
  193. package/modern/hooks/features/rowSelection/gridRowSelectionSelector.js +9 -0
  194. package/modern/hooks/features/rowSelection/index.js +1 -0
  195. package/modern/hooks/features/{selection/useGridSelection.js → rowSelection/useGridRowSelection.js} +37 -37
  196. package/modern/hooks/features/{selection/useGridSelectionPreProcessors.js → rowSelection/useGridRowSelectionPreProcessors.js} +1 -1
  197. package/modern/hooks/features/rows/gridRowsUtils.js +5 -2
  198. package/modern/hooks/features/rows/useGridRows.js +23 -7
  199. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
  200. package/modern/index.js +1 -1
  201. package/modern/internals/index.js +3 -5
  202. package/modern/locales/trTR.js +17 -17
  203. package/modern/models/api/gridRowSelectionApi.js +1 -0
  204. package/modern/models/api/index.js +1 -1
  205. package/modern/models/gridRowSelectionModel.js +1 -0
  206. package/modern/models/index.js +1 -1
  207. package/modern/models/params/gridColumnGroupHeaderParams.js +1 -0
  208. package/modern/models/params/gridEditCellParams.js +0 -4
  209. package/modern/models/params/index.js +1 -0
  210. package/node/DataGrid/DataGrid.js +14 -34
  211. package/node/DataGrid/useDataGridComponent.js +9 -17
  212. package/node/DataGrid/useDataGridProps.js +3 -3
  213. package/node/colDef/gridCheckboxSelectionColDef.js +2 -2
  214. package/node/components/GridFooter.js +2 -2
  215. package/node/components/GridRow.js +2 -2
  216. package/node/components/base/GridBody.js +2 -2
  217. package/node/components/cell/GridEditInputCell.js +3 -9
  218. package/node/components/cell/GridEditSingleSelectCell.js +6 -38
  219. package/node/components/columnHeaders/GridColumnGroupHeader.js +32 -5
  220. package/node/components/columnSelection/GridHeaderCheckbox.js +3 -3
  221. package/node/components/containers/GridRoot.js +4 -2
  222. package/node/components/panel/GridColumnsPanel.js +10 -4
  223. package/node/components/panel/filterPanel/GridFilterForm.js +30 -7
  224. package/node/components/panel/filterPanel/GridFilterPanel.js +63 -19
  225. package/node/hooks/features/columnGrouping/gridColumnGroupsSelector.js +40 -3
  226. package/node/hooks/features/columnGrouping/gridColumnGroupsUtils.js +102 -0
  227. package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +68 -71
  228. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +57 -113
  229. package/node/hooks/features/density/densitySelector.js +2 -6
  230. package/node/hooks/features/density/useGridDensity.js +9 -48
  231. package/node/hooks/features/dimensions/useGridDimensions.js +3 -1
  232. package/node/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
  233. package/node/hooks/features/{editRows → editing}/index.js +4 -4
  234. package/node/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +28 -13
  235. package/node/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +4 -4
  236. package/node/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +28 -14
  237. package/node/hooks/features/export/useGridPrintExport.js +2 -2
  238. package/node/hooks/features/focus/gridFocusStateSelector.js +10 -4
  239. package/node/hooks/features/focus/useGridFocus.js +68 -10
  240. package/node/hooks/features/index.js +8 -8
  241. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +138 -1
  242. package/node/hooks/features/{selection/gridSelectionSelector.js → rowSelection/gridRowSelectionSelector.js} +6 -6
  243. package/node/hooks/features/rowSelection/index.js +18 -0
  244. package/node/hooks/features/{selection/useGridSelection.js → rowSelection/useGridRowSelection.js} +43 -43
  245. package/node/hooks/features/{selection/useGridSelectionPreProcessors.js → rowSelection/useGridRowSelectionPreProcessors.js} +3 -3
  246. package/node/hooks/features/rows/gridRowsUtils.js +5 -2
  247. package/node/hooks/features/rows/useGridRows.js +23 -7
  248. package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  249. package/node/index.js +1 -1
  250. package/node/internals/index.js +23 -45
  251. package/node/locales/trTR.js +17 -17
  252. package/node/models/api/{gridSelectionApi.js → gridRowSelectionApi.js} +0 -0
  253. package/node/models/api/index.js +4 -4
  254. package/node/models/{gridSelectionModel.js → gridRowSelectionModel.js} +0 -0
  255. package/node/models/index.js +4 -4
  256. package/node/models/params/gridColumnGroupHeaderParams.js +5 -0
  257. package/node/models/params/gridEditCellParams.js +0 -3
  258. package/node/models/params/index.js +13 -0
  259. package/package.json +2 -2
  260. package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.d.ts +0 -4
  261. package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +0 -35
  262. package/hooks/features/editRows/index.d.ts +0 -1
  263. package/hooks/features/editRows/index.js +0 -1
  264. package/hooks/features/editRows/useGridCellEditing.old.d.ts +0 -4
  265. package/hooks/features/editRows/useGridCellEditing.old.js +0 -359
  266. package/hooks/features/editRows/useGridEditing.old.d.ts +0 -11
  267. package/hooks/features/editRows/useGridEditing.old.js +0 -167
  268. package/hooks/features/editRows/useGridRowEditing.old.d.ts +0 -4
  269. package/hooks/features/editRows/useGridRowEditing.old.js +0 -334
  270. package/hooks/features/selection/gridSelectionSelector.js +0 -9
  271. package/hooks/features/selection/index.d.ts +0 -1
  272. package/hooks/features/selection/index.js +0 -1
  273. package/hooks/features/selection/useGridSelection.d.ts +0 -12
  274. package/legacy/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +0 -35
  275. package/legacy/hooks/features/editRows/index.js +0 -1
  276. package/legacy/hooks/features/editRows/useGridCellEditing.old.js +0 -411
  277. package/legacy/hooks/features/editRows/useGridEditing.old.js +0 -184
  278. package/legacy/hooks/features/editRows/useGridRowEditing.old.js +0 -505
  279. package/legacy/hooks/features/selection/gridSelectionSelector.js +0 -19
  280. package/legacy/hooks/features/selection/index.js +0 -1
  281. package/models/gridSelectionModel.d.ts +0 -3
  282. package/modern/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +0 -29
  283. package/modern/hooks/features/editRows/index.js +0 -1
  284. package/modern/hooks/features/editRows/useGridCellEditing.old.js +0 -355
  285. package/modern/hooks/features/editRows/useGridEditing.old.js +0 -163
  286. package/modern/hooks/features/editRows/useGridRowEditing.old.js +0 -326
  287. package/modern/hooks/features/selection/gridSelectionSelector.js +0 -9
  288. package/modern/hooks/features/selection/index.js +0 -1
  289. package/node/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +0 -55
  290. package/node/hooks/features/editRows/useGridCellEditing.old.js +0 -380
  291. package/node/hooks/features/editRows/useGridEditing.old.js +0 -193
  292. package/node/hooks/features/editRows/useGridRowEditing.old.js +0 -358
  293. package/node/hooks/features/selection/index.js +0 -18
@@ -4,7 +4,7 @@ import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
4
4
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
5
5
  import { useGridLogger } from '../../utils/useGridLogger';
6
6
  import { gridRowsLookupSelector } from '../rows/gridRowsSelector';
7
- import { gridSelectionStateSelector, selectedGridRowsSelector, selectedIdsLookupSelector } from './gridSelectionSelector';
7
+ import { gridRowSelectionStateSelector, selectedGridRowsSelector, selectedIdsLookupSelector } from './gridRowSelectionSelector';
8
8
  import { gridPaginatedVisibleSortedGridRowIdsSelector } from '../pagination';
9
9
  import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
10
10
  import { gridVisibleSortedRowIdsSelector } from '../filter/gridFilterSelector';
@@ -30,11 +30,11 @@ const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
30
30
  return [selectionModelProp];
31
31
  };
32
32
 
33
- export const selectionStateInitializer = (state, props) => {
33
+ export const rowSelectionStateInitializer = (state, props) => {
34
34
  var _getSelectionModelPro;
35
35
 
36
36
  return _extends({}, state, {
37
- selection: (_getSelectionModelPro = getSelectionModelPropValue(props.selectionModel)) != null ? _getSelectionModelPro : []
37
+ rowSelection: (_getSelectionModelPro = getSelectionModelPropValue(props.rowSelectionModel)) != null ? _getSelectionModelPro : []
38
38
  });
39
39
  };
40
40
  /**
@@ -44,28 +44,28 @@ export const selectionStateInitializer = (state, props) => {
44
44
  * @requires useGridKeyboardNavigation (`cellKeyDown` event must first be consumed by it)
45
45
  */
46
46
 
47
- export const useGridSelection = (apiRef, props) => {
47
+ export const useGridRowSelection = (apiRef, props) => {
48
48
  const logger = useGridLogger(apiRef, 'useGridSelection');
49
- const propSelectionModel = React.useMemo(() => {
50
- return getSelectionModelPropValue(props.selectionModel, gridSelectionStateSelector(apiRef.current.state));
51
- }, [apiRef, props.selectionModel]);
49
+ const propRowSelectionModel = React.useMemo(() => {
50
+ return getSelectionModelPropValue(props.rowSelectionModel, gridRowSelectionStateSelector(apiRef.current.state));
51
+ }, [apiRef, props.rowSelectionModel]);
52
52
  const lastRowToggled = React.useRef(null);
53
53
  apiRef.current.unstable_registerControlState({
54
- stateId: 'selection',
55
- propModel: propSelectionModel,
56
- propOnChange: props.onSelectionModelChange,
57
- stateSelector: gridSelectionStateSelector,
58
- changeEvent: 'selectionChange'
54
+ stateId: 'rowSelection',
55
+ propModel: propRowSelectionModel,
56
+ propOnChange: props.onRowSelectionModelChange,
57
+ stateSelector: gridRowSelectionStateSelector,
58
+ changeEvent: 'rowSelectionChange'
59
59
  });
60
60
  const {
61
61
  checkboxSelection,
62
- disableMultipleSelection,
63
- disableSelectionOnClick,
62
+ disableMultipleRowSelection,
63
+ disableRowSelectionOnClick,
64
64
  pagination,
65
65
  paginationMode,
66
66
  isRowSelectable: propIsRowSelectable
67
67
  } = props;
68
- const canHaveMultipleSelection = !disableMultipleSelection || checkboxSelection;
68
+ const canHaveMultipleSelection = !disableMultipleRowSelection || checkboxSelection;
69
69
  const visibleRows = useGridVisibleRows(apiRef, props);
70
70
  const expandMouseRowRangeSelection = React.useCallback(id => {
71
71
  var _lastRowToggled$curre;
@@ -100,18 +100,18 @@ export const useGridSelection = (apiRef, props) => {
100
100
  * API METHODS
101
101
  */
102
102
 
103
- const setSelectionModel = React.useCallback(model => {
104
- const currentModel = gridSelectionStateSelector(apiRef.current.state);
103
+ const setRowSelectionModel = React.useCallback(model => {
104
+ const currentModel = gridRowSelectionStateSelector(apiRef.current.state);
105
105
 
106
106
  if (currentModel !== model) {
107
107
  logger.debug(`Setting selection model`);
108
108
  apiRef.current.setState(state => _extends({}, state, {
109
- selection: model
109
+ rowSelection: model
110
110
  }));
111
111
  apiRef.current.forceUpdate();
112
112
  }
113
113
  }, [apiRef, logger]);
114
- const isRowSelected = React.useCallback(id => gridSelectionStateSelector(apiRef.current.state).includes(id), [apiRef]);
114
+ const isRowSelected = React.useCallback(id => gridRowSelectionStateSelector(apiRef.current.state).includes(id), [apiRef]);
115
115
  const isRowSelectable = React.useCallback(id => {
116
116
  if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
117
117
  return false;
@@ -135,10 +135,10 @@ export const useGridSelection = (apiRef, props) => {
135
135
 
136
136
  if (resetSelection) {
137
137
  logger.debug(`Setting selection for row ${id}`);
138
- apiRef.current.setSelectionModel(isSelected ? [id] : []);
138
+ apiRef.current.setRowSelectionModel(isSelected ? [id] : []);
139
139
  } else {
140
140
  logger.debug(`Toggling selection for row ${id}`);
141
- const selection = gridSelectionStateSelector(apiRef.current.state);
141
+ const selection = gridRowSelectionStateSelector(apiRef.current.state);
142
142
  const newSelection = selection.filter(el => el !== id);
143
143
 
144
144
  if (isSelected) {
@@ -148,7 +148,7 @@ export const useGridSelection = (apiRef, props) => {
148
148
  const isSelectionValid = newSelection.length < 2 || canHaveMultipleSelection;
149
149
 
150
150
  if (isSelectionValid) {
151
- apiRef.current.setSelectionModel(newSelection);
151
+ apiRef.current.setRowSelectionModel(newSelection);
152
152
  }
153
153
  }
154
154
  }, [apiRef, logger, canHaveMultipleSelection]);
@@ -176,7 +176,7 @@ export const useGridSelection = (apiRef, props) => {
176
176
  const isSelectionValid = newSelection.length < 2 || canHaveMultipleSelection;
177
177
 
178
178
  if (isSelectionValid) {
179
- apiRef.current.setSelectionModel(newSelection);
179
+ apiRef.current.setRowSelectionModel(newSelection);
180
180
  }
181
181
  }, [apiRef, logger, canHaveMultipleSelection]);
182
182
  const selectRowRange = React.useCallback(({
@@ -200,7 +200,7 @@ export const useGridSelection = (apiRef, props) => {
200
200
  selectRow,
201
201
  selectRows,
202
202
  selectRowRange,
203
- setSelectionModel,
203
+ setRowSelectionModel,
204
204
  getSelectedRows,
205
205
  isRowSelected,
206
206
  isRowSelectable
@@ -215,7 +215,7 @@ export const useGridSelection = (apiRef, props) => {
215
215
  return;
216
216
  }
217
217
 
218
- const currentSelection = gridSelectionStateSelector(apiRef.current.state);
218
+ const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
219
219
  const rowsLookup = gridRowsLookupSelector(apiRef); // We clone the existing object to avoid mutating the same object returned by the selector to others part of the project
220
220
 
221
221
  const selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));
@@ -229,7 +229,7 @@ export const useGridSelection = (apiRef, props) => {
229
229
  });
230
230
 
231
231
  if (hasChanged) {
232
- apiRef.current.setSelectionModel(Object.values(selectionLookup));
232
+ apiRef.current.setRowSelectionModel(Object.values(selectionLookup));
233
233
  }
234
234
  }, [apiRef, props.keepNonExistentRowsSelected]);
235
235
  const handleSingleRowSelection = React.useCallback((id, event) => {
@@ -249,7 +249,7 @@ export const useGridSelection = (apiRef, props) => {
249
249
  }
250
250
  }, [apiRef, canHaveMultipleSelection, checkboxSelection]);
251
251
  const handleCellClick = React.useCallback((params, event) => {
252
- if (disableSelectionOnClick) {
252
+ if (disableRowSelectionOnClick) {
253
253
  return;
254
254
  }
255
255
 
@@ -280,7 +280,7 @@ export const useGridSelection = (apiRef, props) => {
280
280
  } else {
281
281
  handleSingleRowSelection(params.id, event);
282
282
  }
283
- }, [disableSelectionOnClick, canHaveMultipleSelection, checkboxSelection, apiRef, expandMouseRowRangeSelection, handleSingleRowSelection]);
283
+ }, [disableRowSelectionOnClick, canHaveMultipleSelection, checkboxSelection, apiRef, expandMouseRowRangeSelection, handleSingleRowSelection]);
284
284
  const preventSelectionOnShift = React.useCallback((params, event) => {
285
285
  if (canHaveMultipleSelection && event.shiftKey) {
286
286
  var _window$getSelection;
@@ -381,29 +381,29 @@ export const useGridSelection = (apiRef, props) => {
381
381
  */
382
382
 
383
383
  React.useEffect(() => {
384
- if (propSelectionModel !== undefined) {
385
- apiRef.current.setSelectionModel(propSelectionModel);
384
+ if (propRowSelectionModel !== undefined) {
385
+ apiRef.current.setRowSelectionModel(propRowSelectionModel);
386
386
  }
387
- }, [apiRef, propSelectionModel]);
388
- const isStateControlled = propSelectionModel != null;
387
+ }, [apiRef, propRowSelectionModel]);
388
+ const isStateControlled = propRowSelectionModel != null;
389
389
  React.useEffect(() => {
390
390
  if (isStateControlled) {
391
391
  return;
392
392
  } // props.isRowSelectable changed
393
393
 
394
394
 
395
- const currentSelection = gridSelectionStateSelector(apiRef.current.state);
395
+ const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
396
396
 
397
397
  if (isRowSelectable) {
398
398
  const newSelection = currentSelection.filter(id => isRowSelectable(id));
399
399
 
400
400
  if (newSelection.length < currentSelection.length) {
401
- apiRef.current.setSelectionModel(newSelection);
401
+ apiRef.current.setRowSelectionModel(newSelection);
402
402
  }
403
403
  }
404
404
  }, [apiRef, isRowSelectable, isStateControlled]);
405
405
  React.useEffect(() => {
406
- const currentSelection = gridSelectionStateSelector(apiRef.current.state);
406
+ const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
407
407
 
408
408
  if (!canHaveMultipleSelection && currentSelection.length > 1) {
409
409
  const {
@@ -427,7 +427,7 @@ export const useGridSelection = (apiRef, props) => {
427
427
 
428
428
  return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page
429
429
  });
430
- apiRef.current.setSelectionModel(firstSelectableRow !== undefined ? [firstSelectableRow] : []);
430
+ apiRef.current.setRowSelectionModel(firstSelectableRow !== undefined ? [firstSelectableRow] : []);
431
431
  }
432
- }, [apiRef, canHaveMultipleSelection, checkboxSelection, disableMultipleSelection, isRowSelectable, pagination, paginationMode]);
432
+ }, [apiRef, canHaveMultipleSelection, checkboxSelection, disableMultipleRowSelection, isRowSelectable, pagination, paginationMode]);
433
433
  };
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
3
  import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
4
- export declare const useGridSelectionPreProcessors: (apiRef: React.MutableRefObject<GridApiCommunity>, props: DataGridProcessedProps) => void;
4
+ export declare const useGridRowSelectionPreProcessors: (apiRef: React.MutableRefObject<GridApiCommunity>, props: DataGridProcessedProps) => void;
@@ -18,7 +18,7 @@ const useUtilityClasses = ownerState => {
18
18
  }, [classes]);
19
19
  };
20
20
 
21
- export const useGridSelectionPreProcessors = (apiRef, props) => {
21
+ export const useGridRowSelectionPreProcessors = (apiRef, props) => {
22
22
  const ownerState = {
23
23
  classes: props.classes
24
24
  };
@@ -10,6 +10,10 @@ export interface GridRowsInternalCache {
10
10
  * The value of the `loading` prop since the last time that the rows state was updated.
11
11
  */
12
12
  loadingPropBeforePartialUpdates: DataGridProcessedProps['loading'];
13
+ /**
14
+ * The value of the `rowCount` prop since the last time that the rows state was updated.
15
+ */
16
+ rowCountPropBeforePartialUpdates: DataGridProcessedProps['rowCount'];
13
17
  /**
14
18
  * Lookup containing the latest model at all time (even those not stored in the state yet).
15
19
  */
@@ -13,7 +13,7 @@ export declare const buildRootGroup: () => GridGroupNode;
13
13
  */
14
14
  export declare function checkGridRowIdIsValid(id: GridRowId, row: GridRowModel | Partial<GridRowModel>, detailErrorMessage?: string): void;
15
15
  export declare const getRowIdFromRowModel: (rowModel: GridRowModel, getRowId?: GridRowIdGetter, detailErrorMessage?: string) => GridRowId;
16
- export declare const createRowsInternalCache: ({ rows, getRowId, loading, }: Pick<DataGridProcessedProps, 'rows' | 'getRowId' | 'loading'>) => GridRowsInternalCache;
16
+ export declare const createRowsInternalCache: ({ rows, getRowId, loading, rowCount, }: Pick<DataGridProcessedProps, 'rows' | 'getRowId' | 'loading' | 'rowCount'>) => GridRowsInternalCache;
17
17
  export declare const getTopLevelRowCount: ({ tree, rowCountProp, }: {
18
18
  tree: GridRowTreeConfig;
19
19
  rowCountProp: DataGridProcessedProps['rowCount'];
@@ -34,7 +34,8 @@ export const getRowIdFromRowModel = (rowModel, getRowId, detailErrorMessage) =>
34
34
  export const createRowsInternalCache = ({
35
35
  rows,
36
36
  getRowId,
37
- loading
37
+ loading,
38
+ rowCount
38
39
  }) => {
39
40
  const updates = {
40
41
  type: 'full',
@@ -54,6 +55,7 @@ export const createRowsInternalCache = ({
54
55
  return {
55
56
  rowsBeforePartialUpdates: rows,
56
57
  loadingPropBeforePartialUpdates: loading,
58
+ rowCountPropBeforePartialUpdates: rowCount,
57
59
  updates,
58
60
  dataRowIdToIdLookup,
59
61
  dataRowIdToModelLookup
@@ -264,7 +266,8 @@ export const updateCacheWithNewRows = ({
264
266
  dataRowIdToIdLookup,
265
267
  updates: partialUpdates,
266
268
  rowsBeforePartialUpdates: previousCache.rowsBeforePartialUpdates,
267
- loadingPropBeforePartialUpdates: previousCache.loadingPropBeforePartialUpdates
269
+ loadingPropBeforePartialUpdates: previousCache.loadingPropBeforePartialUpdates,
270
+ rowCountPropBeforePartialUpdates: previousCache.rowCountPropBeforePartialUpdates
268
271
  };
269
272
  };
270
273
  export function calculatePinnedRowsHeight(apiRef) {
@@ -13,7 +13,8 @@ export const rowsStateInitializer = (state, props, apiRef) => {
13
13
  apiRef.current.unstable_caches.rows = createRowsInternalCache({
14
14
  rows: props.rows,
15
15
  getRowId: props.getRowId,
16
- loading: props.loading
16
+ loading: props.loading,
17
+ rowCount: props.rowCount
17
18
  });
18
19
  return _extends({}, state, {
19
20
  rows: getRowsStateFromCache({
@@ -111,11 +112,12 @@ export const useGridRows = (apiRef, props) => {
111
112
  cache: createRowsInternalCache({
112
113
  rows,
113
114
  getRowId: props.getRowId,
114
- loading: props.loading
115
+ loading: props.loading,
116
+ rowCount: props.rowCount
115
117
  }),
116
118
  throttle: true
117
119
  });
118
- }, [logger, props.getRowId, props.loading, throttledRowsChange]);
120
+ }, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
119
121
  const updateRows = React.useCallback(updates => {
120
122
  if (props.signature === GridSignature.DataGrid && updates.length > 1) {
121
123
  // TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
@@ -349,7 +351,8 @@ export const useGridRows = (apiRef, props) => {
349
351
  cache = createRowsInternalCache({
350
352
  rows: props.rows,
351
353
  getRowId: props.getRowId,
352
- loading: props.loading
354
+ loading: props.loading,
355
+ rowCount: props.rowCount
353
356
  });
354
357
  }
355
358
 
@@ -357,7 +360,7 @@ export const useGridRows = (apiRef, props) => {
357
360
  cache,
358
361
  throttle: false
359
362
  });
360
- }, [logger, apiRef, props.rows, props.getRowId, props.loading, throttledRowsChange]);
363
+ }, [logger, apiRef, props.rows, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
361
364
  const handleStrategyProcessorChange = React.useCallback(methodName => {
362
365
  if (methodName === 'rowTreeCreation') {
363
366
  groupRows();
@@ -420,7 +423,8 @@ export const useGridRows = (apiRef, props) => {
420
423
  }
421
424
 
422
425
  const areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
423
- const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
426
+ const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading;
427
+ const isNewRowCountAlreadyInState = apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates === props.rowCount; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
424
428
 
425
429
  if (areNewRowsAlreadyInState) {
426
430
  // If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
@@ -434,6 +438,17 @@ export const useGridRows = (apiRef, props) => {
434
438
  apiRef.current.forceUpdate();
435
439
  }
436
440
 
441
+ if (!isNewRowCountAlreadyInState) {
442
+ apiRef.current.setState(state => _extends({}, state, {
443
+ rows: _extends({}, state.rows, {
444
+ totalRowCount: Math.max(props.rowCount || 0, state.rows.totalRowCount),
445
+ totalTopLevelRowCount: Math.max(props.rowCount || 0, state.rows.totalTopLevelRowCount)
446
+ })
447
+ }));
448
+ apiRef.current.unstable_caches.rows.rowCountPropBeforePartialUpdates = props.rowCount;
449
+ apiRef.current.forceUpdate();
450
+ }
451
+
437
452
  return;
438
453
  }
439
454
 
@@ -442,7 +457,8 @@ export const useGridRows = (apiRef, props) => {
442
457
  cache: createRowsInternalCache({
443
458
  rows: props.rows,
444
459
  getRowId: props.getRowId,
445
- loading: props.loading
460
+ loading: props.loading,
461
+ rowCount: props.rowCount
446
462
  }),
447
463
  throttle: false
448
464
  });
@@ -35,7 +35,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
35
35
  getRootProps: ({ style, ...other }?: {
36
36
  style?: {} | undefined;
37
37
  }) => {
38
- ref: React.Ref<HTMLDivElement>;
38
+ ref: ((instance: HTMLDivElement | null) => void) | null;
39
39
  onScroll: (event: React.UIEvent) => void;
40
40
  onWheel: (event: React.WheelEvent) => void;
41
41
  onTouchMove: (event: React.TouchEvent) => void;
@@ -9,11 +9,11 @@ import { useGridRootProps } from '../../utils/useGridRootProps';
9
9
  import { useGridSelector } from '../../utils/useGridSelector';
10
10
  import { gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector } from '../columns/gridColumnsSelector';
11
11
  import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
12
- import { gridEditRowsStateSelector } from '../editRows/gridEditRowsSelector';
12
+ import { gridEditRowsStateSelector } from '../editing/gridEditingSelectors';
13
13
  import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
14
14
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
15
15
  import { clamp } from '../../../utils/utils';
16
- import { selectedIdsLookupSelector } from '../selection/gridSelectionSelector';
16
+ import { selectedIdsLookupSelector } from '../rowSelection/gridRowSelectionSelector';
17
17
  import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
18
18
  import { getFirstNonSpannedColumnToRender } from '../columns/gridColumnsUtils';
19
19
  import { getMinimalContentHeight } from '../rows/gridRowsUtils'; // Uses binary search to avoid looping through all possible positions
@@ -3,4 +3,4 @@ import { GridApiCommon } from '../../models/api/gridApiCommon';
3
3
  /**
4
4
  * @deprecated Use `apiRef.current` instead.
5
5
  */
6
- export declare const useGridApi: <Api extends GridApiCommon>(apiRef: React.MutableRefObject<Api>) => Api;
6
+ export declare const useGridApi: <Api extends GridApiCommon<any, any>>(apiRef: React.MutableRefObject<Api>) => Api;
@@ -14,8 +14,8 @@ declare enum GridSignature {
14
14
  interface RegistryContainer {
15
15
  registry: CleanupTracking | null;
16
16
  }
17
- export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
17
+ export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
18
18
  export declare const unstable_resetCleanupTracking: () => void;
19
- export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
19
+ export declare const useGridApiEventHandler: <Api extends GridApiCommon<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E> | undefined, options?: EventListenerOptions) => void;
20
20
  export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEvents>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>): void;
21
21
  export { GridSignature };
@@ -4,4 +4,4 @@ import { GridApiCommunity } from '../../models/api/gridApiCommunity';
4
4
  /**
5
5
  * Hook that instantiate a [[GridApiRef]].
6
6
  */
7
- export declare const useGridApiRef: <Api extends GridApiCommon = GridApiCommunity>() => React.MutableRefObject<Api>;
7
+ export declare const useGridApiRef: <Api extends GridApiCommon<any, any> = GridApiCommunity>() => React.MutableRefObject<Api>;
@@ -6,5 +6,5 @@ declare type DeepPartial<T> = {
6
6
  [P in keyof T]?: DeepPartial<T[P]>;
7
7
  };
8
8
  export declare type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, Api extends GridApiCommon = GridApiCommunity> = (state: DeepPartial<Api['state']>, props: P, apiRef: React.MutableRefObject<Api>) => DeepPartial<Api['state']>;
9
- export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps<any>>, Api extends GridApiCommon = GridApiCommunity>(initializer: GridStateInitializer<P, Api>, apiRef: React.MutableRefObject<Api>, props: P) => void;
9
+ export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps<any>>, Api extends GridApiCommon<any, any> = GridApiCommunity>(initializer: GridStateInitializer<P, Api>, apiRef: React.MutableRefObject<Api>, props: P) => void;
10
10
  export {};
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import { GridApiCommon } from '../../models';
3
- export declare const useGridNativeEventListener: <Api extends GridApiCommon, K extends keyof HTMLElementEventMap>(apiRef: React.MutableRefObject<Api>, ref: React.MutableRefObject<HTMLDivElement | null> | (() => HTMLElement | undefined | null), eventName: K, handler?: ((event: HTMLElementEventMap[K]) => any) | undefined, options?: AddEventListenerOptions) => void;
3
+ export declare const useGridNativeEventListener: <Api extends GridApiCommon<any, any>, K extends keyof HTMLElementEventMap>(apiRef: React.MutableRefObject<Api>, ref: React.MutableRefObject<HTMLDivElement | null> | (() => HTMLElement | undefined | null), eventName: K, handler?: ((event: HTMLElementEventMap[K]) => any) | undefined, options?: AddEventListenerOptions) => void;
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { GridApiCommon } from '../../models/api/gridApiCommon';
3
3
  import { OutputSelector } from '../../utils/createSelector';
4
- export declare const useGridSelector: <Api extends GridApiCommon, T>(apiRef: React.MutableRefObject<Api>, selector: OutputSelector<Api["state"], T> | ((state: Api["state"]) => T)) => T;
4
+ export declare const useGridSelector: <Api extends GridApiCommon<any, any>, T>(apiRef: React.MutableRefObject<Api>, selector: OutputSelector<Api["state"], T> | ((state: Api["state"]) => T)) => T;
@@ -4,4 +4,4 @@ import { GridApiCommunity } from '../../models/api/gridApiCommunity';
4
4
  /**
5
5
  * @deprecated Use `apiRef.current.state`, `apiRef.current.setState` and `apiRef.current.forceUpdate` instead.
6
6
  */
7
- export declare const useGridState: <Api extends GridApiCommon = GridApiCommunity>(apiRef: React.MutableRefObject<Api>) => readonly [any, any, any];
7
+ export declare const useGridState: <Api extends GridApiCommon<any, any> = GridApiCommunity>(apiRef: React.MutableRefObject<Api>) => readonly [any, <S extends any, K extends "filter">(state: S | ((previousState: S) => S), reason?: import("../..").GridControlledStateReasonLookup[K] | undefined) => boolean, () => void];
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { DataGridProcessedProps } from '../../models/props/DataGridProps';
3
3
  import type { GridApiCommon, GridRowEntry } from '../../models';
4
- export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => {
4
+ export declare const getVisibleRows: <Api extends GridApiCommon<any, any>>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => {
5
5
  rows: GridRowEntry<import("../../models").GridValidRowModel>[];
6
6
  range: {
7
7
  firstRowIndex: number;
@@ -15,7 +15,7 @@ export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.M
15
15
  * - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants.
16
16
  * - If the row tree is flat, it only contains up to `state.pageSize` rows.
17
17
  */
18
- export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => {
18
+ export declare const useGridVisibleRows: <Api extends GridApiCommon<any, any>>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => {
19
19
  rows: GridRowEntry<import("../../models").GridValidRowModel>[];
20
20
  range: {
21
21
  firstRowIndex: number;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v6.0.0-alpha.2
1
+ /** @license MUI v6.0.0-alpha.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -14,7 +14,6 @@ export { useGridColumnMenu, columnMenuStateInitializer, } from '../hooks/feature
14
14
  export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
15
15
  export { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
16
16
  export { useGridColumnGrouping, columnGroupsStateInitializer, } from '../hooks/features/columnGrouping/useGridColumnGrouping';
17
- export { useGridColumnGroupingPreProcessors } from '../hooks/features/columnGrouping/useGridColumnGroupingPreProcessors';
18
17
  export type { GridColumnRawLookup, GridColumnsRawState, GridHydrateColumnsValue, } from '../hooks/features/columns/gridColumnsInterfaces';
19
18
  export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
20
19
  export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
@@ -26,8 +25,7 @@ export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/use
26
25
  export { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
27
26
  export { useGridPagination, paginationStateInitializer, } from '../hooks/features/pagination/useGridPagination';
28
27
  export { useGridPreferencesPanel, preferencePanelStateInitializer, } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
29
- export { useGridEditing as useGridEditing_new, editingStateInitializer as editingStateInitializer_new, } from '../hooks/features/editRows/useGridEditing.new';
30
- export { useGridEditing as useGridEditing_old, editingStateInitializer as editingStateInitializer_old, } from '../hooks/features/editRows/useGridEditing.old';
28
+ export { useGridEditing, editingStateInitializer } from '../hooks/features/editing/useGridEditing';
31
29
  export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
32
30
  export { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
33
31
  export type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridHydrateRowsValue, GridRowsPartialUpdates, GridRowsPartialUpdateAction, GridTreeDepths, GridRowTreeUpdatedGroupsManager, GridRowTreeUpdateGroupAction, GridPinnedRowsState, } from '../hooks/features/rows/gridRowsInterfaces';
@@ -37,8 +35,8 @@ export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
37
35
  export { getRowIdFromRowModel } from '../hooks/features/rows/gridRowsUtils';
38
36
  export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, } from '../hooks/features/rows/gridRowsSelector';
39
37
  export { calculatePinnedRowsHeight } from '../hooks/features/rows/gridRowsUtils';
40
- export { useGridSelection, selectionStateInitializer, } from '../hooks/features/selection/useGridSelection';
41
- export { useGridSelectionPreProcessors } from '../hooks/features/selection/useGridSelectionPreProcessors';
38
+ export { useGridRowSelection, rowSelectionStateInitializer, } from '../hooks/features/rowSelection/useGridRowSelection';
39
+ export { useGridRowSelectionPreProcessors } from '../hooks/features/rowSelection/useGridRowSelectionPreProcessors';
42
40
  export { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
43
41
  export type { GridSortingModelApplier } from '../hooks/features/sorting/gridSortingState';
44
42
  export { useGridScroll } from '../hooks/features/scroll/useGridScroll';
@@ -12,7 +12,6 @@ export { useGridColumnMenu, columnMenuStateInitializer } from '../hooks/features
12
12
  export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
13
13
  export { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
14
14
  export { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
15
- export { useGridColumnGroupingPreProcessors } from '../hooks/features/columnGrouping/useGridColumnGroupingPreProcessors';
16
15
  export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
17
16
  export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
18
17
  export { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
@@ -22,8 +21,7 @@ export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/use
22
21
  export { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
23
22
  export { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
24
23
  export { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
25
- export { useGridEditing as useGridEditing_new, editingStateInitializer as editingStateInitializer_new } from '../hooks/features/editRows/useGridEditing.new';
26
- export { useGridEditing as useGridEditing_old, editingStateInitializer as editingStateInitializer_old } from '../hooks/features/editRows/useGridEditing.old';
24
+ export { useGridEditing, editingStateInitializer } from '../hooks/features/editing/useGridEditing';
27
25
  export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
28
26
  export { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
29
27
  export { getTreeNodeDescendants, buildRootGroup } from '../hooks/features/rows/gridRowsUtils';
@@ -32,8 +30,8 @@ export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
32
30
  export { getRowIdFromRowModel } from '../hooks/features/rows/gridRowsUtils';
33
31
  export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector } from '../hooks/features/rows/gridRowsSelector';
34
32
  export { calculatePinnedRowsHeight } from '../hooks/features/rows/gridRowsUtils';
35
- export { useGridSelection, selectionStateInitializer } from '../hooks/features/selection/useGridSelection';
36
- export { useGridSelectionPreProcessors } from '../hooks/features/selection/useGridSelectionPreProcessors';
33
+ export { useGridRowSelection, rowSelectionStateInitializer } from '../hooks/features/rowSelection/useGridRowSelection';
34
+ export { useGridRowSelectionPreProcessors } from '../hooks/features/rowSelection/useGridRowSelectionPreProcessors';
37
35
  export { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
38
36
  export { useGridScroll } from '../hooks/features/scroll/useGridScroll';
39
37
  export { useGridEvents } from '../hooks/features/events/useGridEvents';
@@ -168,7 +168,7 @@ DataGridRaw.propTypes = {
168
168
  * If `true`, the selection on click on a row or cell is disabled.
169
169
  * @default false
170
170
  */
171
- disableSelectionOnClick: PropTypes.bool,
171
+ disableRowSelectionOnClick: PropTypes.bool,
172
172
 
173
173
  /**
174
174
  * If `true`, the virtualization is disabled.
@@ -198,8 +198,6 @@ DataGridRaw.propTypes = {
198
198
  */
199
199
  experimentalFeatures: PropTypes.shape({
200
200
  columnGrouping: PropTypes.bool,
201
- newEditingApi: PropTypes.bool,
202
- preventCommitWhileValidating: PropTypes.bool,
203
201
  warnIfFocusStateIsNotSynced: PropTypes.bool
204
202
  }),
205
203
 
@@ -376,14 +374,6 @@ DataGridRaw.propTypes = {
376
374
  */
377
375
  onCellDoubleClick: PropTypes.func,
378
376
 
379
- /**
380
- * Callback fired when the cell changes are committed.
381
- * @param {GridCellEditCommitParams} params With all properties from [[GridCellEditCommitParams]].
382
- * @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
383
- * @param {GridCallbackDetails} details Additional details for this callback.
384
- */
385
- onCellEditCommit: PropTypes.func,
386
-
387
377
  /**
388
378
  * Callback fired when the cell turns to edit mode.
389
379
  * @param {GridCellParams} params With all properties from [[GridCellParams]].
@@ -484,15 +474,6 @@ DataGridRaw.propTypes = {
484
474
  */
485
475
  onColumnVisibilityModelChange: PropTypes.func,
486
476
 
487
- /**
488
- * Callback fired when the edit cell value changes.
489
- * @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
490
- * @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
491
- * @param {GridCallbackDetails} details Additional details for this callback.
492
- * @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
493
- */
494
- onEditCellPropsChange: PropTypes.func,
495
-
496
477
  /**
497
478
  * Callback fired when the `editRowsModel` changes.
498
479
  * @param {GridEditRowsModel} editRowsModel With all properties from [[GridEditRowsModel]].
@@ -622,10 +603,10 @@ DataGridRaw.propTypes = {
622
603
 
623
604
  /**
624
605
  * Callback fired when the selection state of one or multiple rows changes.
625
- * @param {GridSelectionModel} selectionModel With all the row ids [[GridSelectionModel]].
606
+ * @param {GridRowSelectionModel} rowSelectionModel With all the row ids [[GridSelectionModel]].
626
607
  * @param {GridCallbackDetails} details Additional details for this callback.
627
608
  */
628
- onSelectionModelChange: PropTypes.func,
609
+ onRowSelectionModelChange: PropTypes.func,
629
610
 
630
611
  /**
631
612
  * Callback fired when the sort model changes before a column is sorted.
@@ -679,7 +660,6 @@ DataGridRaw.propTypes = {
679
660
 
680
661
  /**
681
662
  * Callback called before updating a row with new values in the row and cell editing.
682
- * Only applied if `props.experimentalFeatures.newEditingApi: true`.
683
663
  * @template R
684
664
  * @param {R} newRow Row object with the new values.
685
665
  * @param {R} oldRow Row object with the old values.
@@ -715,6 +695,17 @@ DataGridRaw.propTypes = {
715
695
  */
716
696
  rows: PropTypes.arrayOf(PropTypes.object).isRequired,
717
697
 
698
+ /**
699
+ * Sets the row selection model of the grid.
700
+ */
701
+ rowSelectionModel: chainPropTypes(PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.array]), function (props) {
702
+ if (!props.checkboxSelection && Array.isArray(props.rowSelectionModel) && props.rowSelectionModel.length > 1) {
703
+ return new Error(["MUI: `<DataGrid rowSelectionModel={".concat(JSON.stringify(props.rowSelectionModel), "} />` is not a valid prop."), 'rowSelectionModel can only be of 1 item in DataGrid.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
704
+ }
705
+
706
+ return null;
707
+ }),
708
+
718
709
  /**
719
710
  * Sets the type of space between rows added by `getRowSpacing`.
720
711
  * @default "margin"
@@ -738,17 +729,6 @@ DataGridRaw.propTypes = {
738
729
  */
739
730
  scrollbarSize: PropTypes.number,
740
731
 
741
- /**
742
- * Set the selection model of the grid.
743
- */
744
- selectionModel: chainPropTypes(PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.array]), function (props) {
745
- if (!props.checkboxSelection && Array.isArray(props.selectionModel) && props.selectionModel.length > 1) {
746
- return new Error(["MUI: `<DataGrid selectionModel={".concat(JSON.stringify(props.selectionModel), "} />` is not a valid prop."), 'selectionModel can only be of 1 item in DataGrid.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
747
- }
748
-
749
- return null;
750
- }),
751
-
752
732
  /**
753
733
  * If `true`, the right border of the cells are displayed.
754
734
  * @default false