@mui/x-data-grid 5.9.0 → 5.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (519) hide show
  1. package/CHANGELOG.md +284 -10
  2. package/DataGrid/DataGrid.js +35 -1
  3. package/DataGrid/useDataGridProps.js +2 -1
  4. package/README.md +5 -4
  5. package/colDef/gridActionsColDef.js +2 -1
  6. package/colDef/gridBooleanColDef.js +2 -1
  7. package/colDef/gridCheckboxSelectionColDef.js +1 -0
  8. package/colDef/gridDateColDef.js +4 -2
  9. package/colDef/gridNumericColDef.js +3 -2
  10. package/colDef/gridNumericOperators.d.ts +2 -0
  11. package/colDef/gridNumericOperators.js +11 -0
  12. package/colDef/gridSingleSelectColDef.js +3 -2
  13. package/colDef/gridSingleSelectOperators.d.ts +3 -0
  14. package/colDef/gridSingleSelectOperators.js +52 -0
  15. package/colDef/gridStringColDef.js +3 -2
  16. package/colDef/gridStringOperators.d.ts +2 -0
  17. package/colDef/gridStringOperators.js +12 -0
  18. package/components/GridFooter.d.ts +4 -2
  19. package/components/GridFooter.js +11 -2
  20. package/components/GridRow.js +9 -5
  21. package/components/GridRowCount.d.ts +4 -1
  22. package/components/GridRowCount.js +1 -0
  23. package/components/GridScrollArea.js +3 -4
  24. package/components/GridSelectedRowCount.d.ts +4 -1
  25. package/components/GridSelectedRowCount.js +2 -1
  26. package/components/base/GridBody.js +1 -2
  27. package/components/base/GridOverlays.js +2 -3
  28. package/components/cell/GridActionsCell.js +13 -4
  29. package/components/cell/GridCell.js +8 -8
  30. package/components/cell/GridEditBooleanCell.d.ts +15 -3
  31. package/components/cell/GridEditBooleanCell.js +101 -6
  32. package/components/cell/GridEditDateCell.d.ts +16 -4
  33. package/components/cell/GridEditDateCell.js +99 -5
  34. package/components/cell/GridEditInputCell.d.ts +11 -5
  35. package/components/cell/GridEditInputCell.js +29 -5
  36. package/components/cell/GridEditSingleSelectCell.d.ts +12 -4
  37. package/components/cell/GridEditSingleSelectCell.js +28 -5
  38. package/components/cell/index.d.ts +2 -0
  39. package/components/cell/index.js +2 -0
  40. package/components/columnHeaders/GridColumnHeaderItem.js +15 -16
  41. package/components/columnHeaders/GridColumnHeaders.d.ts +2 -0
  42. package/components/columnHeaders/GridColumnHeadersInner.d.ts +2 -0
  43. package/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
  44. package/components/columnSelection/GridHeaderCheckbox.js +4 -5
  45. package/components/containers/GridFooterContainer.d.ts +8 -2
  46. package/components/containers/GridFooterContainer.js +11 -2
  47. package/components/containers/GridRoot.js +25 -5
  48. package/components/containers/GridRootStyles.js +36 -1
  49. package/components/containers/GridToolbarContainer.d.ts +8 -2
  50. package/components/containers/GridToolbarContainer.js +12 -2
  51. package/components/menu/GridMenu.js +1 -0
  52. package/components/panel/GridPanelContent.d.ts +8 -1
  53. package/components/panel/GridPanelContent.js +13 -2
  54. package/components/panel/GridPanelFooter.d.ts +8 -1
  55. package/components/panel/GridPanelFooter.js +13 -2
  56. package/components/panel/GridPanelHeader.d.ts +8 -1
  57. package/components/panel/GridPanelHeader.js +13 -2
  58. package/components/toolbar/GridToolbar.d.ts +12 -2
  59. package/components/toolbar/GridToolbar.js +30 -7
  60. package/components/toolbar/GridToolbarExport.d.ts +5 -4
  61. package/components/toolbar/GridToolbarExport.js +15 -20
  62. package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
  63. package/components/toolbar/GridToolbarQuickFilter.d.ts +20 -0
  64. package/components/toolbar/GridToolbarQuickFilter.js +87 -0
  65. package/components/toolbar/index.d.ts +3 -1
  66. package/components/toolbar/index.js +3 -2
  67. package/components/virtualization/GridVirtualScroller.d.ts +4 -1
  68. package/components/virtualization/GridVirtualScrollerContent.d.ts +4 -1
  69. package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +4 -1
  70. package/constants/defaultGridSlotsComponents.js +4 -2
  71. package/constants/gridClasses.d.ts +32 -0
  72. package/constants/gridClasses.js +1 -1
  73. package/constants/localeTextConstants.js +8 -1
  74. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +11 -0
  75. package/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -9
  76. package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +4 -4
  77. package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
  78. package/hooks/core/useGridApiInitialization.js +3 -3
  79. package/hooks/core/useGridErrorHandler.js +1 -2
  80. package/hooks/core/useGridStateInitialization.js +1 -2
  81. package/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -6
  82. package/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
  83. package/hooks/features/columns/useGridColumnSpanning.js +1 -2
  84. package/hooks/features/columns/useGridColumns.d.ts +1 -1
  85. package/hooks/features/columns/useGridColumns.js +8 -9
  86. package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
  87. package/hooks/features/dimensions/useGridDimensions.js +8 -9
  88. package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
  89. package/hooks/features/editRows/useGridCellEditing.new.js +133 -32
  90. package/hooks/features/editRows/useGridCellEditing.old.js +20 -21
  91. package/hooks/features/editRows/useGridEditing.old.js +4 -5
  92. package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
  93. package/hooks/features/editRows/useGridRowEditing.new.js +122 -42
  94. package/hooks/features/editRows/useGridRowEditing.old.js +21 -22
  95. package/hooks/features/events/useGridEvents.js +17 -18
  96. package/hooks/features/export/serializers/csvSerializer.js +5 -5
  97. package/hooks/features/export/useGridCsvExport.js +23 -16
  98. package/hooks/features/export/useGridPrintExport.js +22 -0
  99. package/hooks/features/export/utils.d.ts +3 -1
  100. package/hooks/features/export/utils.js +13 -0
  101. package/hooks/features/filter/gridFilterState.d.ts +1 -2
  102. package/hooks/features/filter/gridFilterState.js +3 -1
  103. package/hooks/features/filter/gridFilterUtils.d.ts +8 -0
  104. package/hooks/features/filter/gridFilterUtils.js +84 -2
  105. package/hooks/features/filter/useGridFilter.js +20 -8
  106. package/hooks/features/focus/useGridFocus.d.ts +1 -1
  107. package/hooks/features/focus/useGridFocus.js +29 -33
  108. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +4 -5
  109. package/hooks/features/pagination/useGridPage.js +3 -4
  110. package/hooks/features/pagination/useGridPageSize.js +2 -3
  111. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
  112. package/hooks/features/rows/gridRowsSelector.d.ts +1 -0
  113. package/hooks/features/rows/gridRowsSelector.js +1 -0
  114. package/hooks/features/rows/gridRowsState.d.ts +16 -11
  115. package/hooks/features/rows/gridRowsUtils.d.ts +14 -1
  116. package/hooks/features/rows/gridRowsUtils.js +79 -1
  117. package/hooks/features/rows/useGridRows.js +148 -128
  118. package/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
  119. package/hooks/features/scroll/useGridScroll.js +6 -1
  120. package/hooks/features/selection/useGridSelection.d.ts +1 -1
  121. package/hooks/features/selection/useGridSelection.js +13 -10
  122. package/hooks/features/sorting/useGridSorting.js +8 -9
  123. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -0
  124. package/hooks/features/virtualization/useGridVirtualScroller.js +14 -5
  125. package/hooks/utils/useGridApiEventHandler.d.ts +4 -1
  126. package/hooks/utils/useGridApiEventHandler.js +22 -9
  127. package/hooks/utils/useGridNativeEventListener.js +1 -2
  128. package/hooks/utils/useGridSelector.js +1 -1
  129. package/index.d.ts +2 -0
  130. package/index.js +1 -1
  131. package/internals/index.d.ts +4 -1
  132. package/internals/index.js +5 -2
  133. package/legacy/DataGrid/DataGrid.js +35 -1
  134. package/legacy/DataGrid/useDataGridProps.js +2 -1
  135. package/legacy/colDef/gridActionsColDef.js +2 -1
  136. package/legacy/colDef/gridBooleanColDef.js +2 -1
  137. package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -0
  138. package/legacy/colDef/gridDateColDef.js +4 -2
  139. package/legacy/colDef/gridNumericColDef.js +3 -2
  140. package/legacy/colDef/gridNumericOperators.js +28 -18
  141. package/legacy/colDef/gridSingleSelectColDef.js +3 -2
  142. package/legacy/colDef/gridSingleSelectOperators.js +55 -6
  143. package/legacy/colDef/gridStringColDef.js +3 -2
  144. package/legacy/colDef/gridStringOperators.js +25 -14
  145. package/legacy/components/GridFooter.js +11 -2
  146. package/legacy/components/GridRow.js +9 -5
  147. package/legacy/components/GridRowCount.js +1 -0
  148. package/legacy/components/GridScrollArea.js +3 -4
  149. package/legacy/components/GridSelectedRowCount.js +2 -1
  150. package/legacy/components/base/GridBody.js +1 -2
  151. package/legacy/components/base/GridOverlays.js +2 -3
  152. package/legacy/components/cell/GridActionsCell.js +13 -4
  153. package/legacy/components/cell/GridCell.js +8 -8
  154. package/legacy/components/cell/GridEditBooleanCell.js +132 -11
  155. package/legacy/components/cell/GridEditDateCell.js +148 -42
  156. package/legacy/components/cell/GridEditInputCell.js +61 -12
  157. package/legacy/components/cell/GridEditSingleSelectCell.js +41 -13
  158. package/legacy/components/cell/index.js +2 -0
  159. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +15 -16
  160. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
  161. package/legacy/components/columnSelection/GridHeaderCheckbox.js +4 -5
  162. package/legacy/components/containers/GridFooterContainer.js +11 -2
  163. package/legacy/components/containers/GridRoot.js +23 -5
  164. package/legacy/components/containers/GridRootStyles.js +26 -5
  165. package/legacy/components/containers/GridToolbarContainer.js +12 -2
  166. package/legacy/components/menu/GridMenu.js +1 -0
  167. package/legacy/components/panel/GridPanelContent.js +13 -2
  168. package/legacy/components/panel/GridPanelFooter.js +13 -2
  169. package/legacy/components/panel/GridPanelHeader.js +13 -2
  170. package/legacy/components/toolbar/GridToolbar.js +31 -6
  171. package/legacy/components/toolbar/GridToolbarExport.js +18 -19
  172. package/legacy/components/toolbar/GridToolbarQuickFilter.js +102 -0
  173. package/legacy/components/toolbar/index.js +3 -2
  174. package/legacy/constants/defaultGridSlotsComponents.js +4 -2
  175. package/legacy/constants/gridClasses.js +1 -1
  176. package/legacy/constants/localeTextConstants.js +8 -1
  177. package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -10
  178. package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
  179. package/legacy/hooks/core/useGridApiInitialization.js +3 -3
  180. package/legacy/hooks/core/useGridErrorHandler.js +1 -2
  181. package/legacy/hooks/core/useGridStateInitialization.js +1 -2
  182. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -6
  183. package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
  184. package/legacy/hooks/features/columns/useGridColumnSpanning.js +1 -2
  185. package/legacy/hooks/features/columns/useGridColumns.js +8 -9
  186. package/legacy/hooks/features/dimensions/useGridDimensions.js +8 -9
  187. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +213 -83
  188. package/legacy/hooks/features/editRows/useGridCellEditing.old.js +20 -21
  189. package/legacy/hooks/features/editRows/useGridEditing.old.js +4 -5
  190. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +126 -42
  191. package/legacy/hooks/features/editRows/useGridRowEditing.old.js +20 -21
  192. package/legacy/hooks/features/events/useGridEvents.js +17 -18
  193. package/legacy/hooks/features/export/serializers/csvSerializer.js +5 -5
  194. package/legacy/hooks/features/export/useGridCsvExport.js +24 -17
  195. package/legacy/hooks/features/export/useGridPrintExport.js +22 -0
  196. package/legacy/hooks/features/export/utils.js +14 -0
  197. package/legacy/hooks/features/filter/gridFilterState.js +3 -1
  198. package/legacy/hooks/features/filter/gridFilterUtils.js +96 -2
  199. package/legacy/hooks/features/filter/useGridFilter.js +20 -8
  200. package/legacy/hooks/features/focus/useGridFocus.js +31 -35
  201. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +4 -5
  202. package/legacy/hooks/features/pagination/useGridPage.js +3 -4
  203. package/legacy/hooks/features/pagination/useGridPageSize.js +2 -3
  204. package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
  205. package/legacy/hooks/features/rows/gridRowsSelector.js +3 -0
  206. package/legacy/hooks/features/rows/gridRowsUtils.js +82 -1
  207. package/legacy/hooks/features/rows/useGridRows.js +164 -131
  208. package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
  209. package/legacy/hooks/features/scroll/useGridScroll.js +6 -1
  210. package/legacy/hooks/features/selection/useGridSelection.js +13 -10
  211. package/legacy/hooks/features/sorting/useGridSorting.js +8 -9
  212. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +14 -5
  213. package/legacy/hooks/utils/useGridApiEventHandler.js +20 -9
  214. package/legacy/hooks/utils/useGridNativeEventListener.js +1 -2
  215. package/legacy/hooks/utils/useGridSelector.js +1 -1
  216. package/legacy/index.js +1 -1
  217. package/legacy/internals/index.js +5 -2
  218. package/legacy/locales/arSD.js +8 -1
  219. package/legacy/locales/bgBG.js +8 -1
  220. package/legacy/locales/csCZ.js +7 -0
  221. package/legacy/locales/daDK.js +8 -1
  222. package/legacy/locales/deDE.js +10 -3
  223. package/legacy/locales/elGR.js +7 -0
  224. package/legacy/locales/esES.js +7 -0
  225. package/legacy/locales/faIR.js +8 -1
  226. package/legacy/locales/fiFI.js +7 -0
  227. package/legacy/locales/frFR.js +7 -0
  228. package/legacy/locales/heIL.js +8 -1
  229. package/legacy/locales/huHU.js +8 -1
  230. package/legacy/locales/itIT.js +7 -0
  231. package/legacy/locales/jaJP.js +7 -0
  232. package/legacy/locales/koKR.js +7 -0
  233. package/legacy/locales/nlNL.js +7 -0
  234. package/legacy/locales/plPL.js +8 -1
  235. package/legacy/locales/ptBR.js +8 -1
  236. package/legacy/locales/ruRU.js +7 -0
  237. package/legacy/locales/skSK.js +7 -0
  238. package/legacy/locales/trTR.js +8 -1
  239. package/legacy/locales/ukUA.js +7 -0
  240. package/legacy/locales/viVN.js +7 -0
  241. package/legacy/locales/zhCN.js +7 -0
  242. package/legacy/models/events/gridEvents.js +8 -0
  243. package/legacy/models/index.js +4 -3
  244. package/legacy/utils/createSelector.js +18 -2
  245. package/legacy/utils/exportAs.js +1 -1
  246. package/locales/arSD.js +8 -1
  247. package/locales/bgBG.js +8 -1
  248. package/locales/csCZ.js +7 -0
  249. package/locales/daDK.js +8 -1
  250. package/locales/deDE.js +10 -3
  251. package/locales/elGR.js +7 -0
  252. package/locales/esES.js +7 -0
  253. package/locales/faIR.js +8 -1
  254. package/locales/fiFI.js +7 -0
  255. package/locales/frFR.js +7 -0
  256. package/locales/heIL.js +8 -1
  257. package/locales/huHU.js +8 -1
  258. package/locales/itIT.js +7 -0
  259. package/locales/jaJP.js +7 -0
  260. package/locales/koKR.js +7 -0
  261. package/locales/nlNL.js +7 -0
  262. package/locales/plPL.js +8 -1
  263. package/locales/ptBR.js +8 -1
  264. package/locales/ruRU.js +7 -0
  265. package/locales/skSK.js +7 -0
  266. package/locales/trTR.js +8 -1
  267. package/locales/ukUA.js +7 -0
  268. package/locales/viVN.js +7 -0
  269. package/locales/zhCN.js +7 -0
  270. package/models/api/gridCoreApi.d.ts +10 -0
  271. package/models/api/gridEditingApi.d.ts +23 -4
  272. package/models/api/gridFilterApi.d.ts +5 -0
  273. package/models/api/gridFocusApi.d.ts +1 -0
  274. package/models/api/gridLocaleTextApi.d.ts +5 -0
  275. package/models/api/gridRowApi.d.ts +34 -0
  276. package/models/api/index.d.ts +1 -1
  277. package/models/colDef/gridColDef.d.ts +13 -0
  278. package/models/events/gridEventLookup.d.ts +293 -3
  279. package/models/events/gridEvents.d.ts +8 -251
  280. package/models/events/gridEvents.js +8 -0
  281. package/models/gridExport.d.ts +29 -2
  282. package/models/gridFilterModel.d.ts +11 -0
  283. package/models/gridFilterOperator.d.ts +1 -1
  284. package/models/gridIconSlotsComponent.d.ts +10 -0
  285. package/models/gridStateCommunity.d.ts +0 -2
  286. package/models/index.d.ts +1 -1
  287. package/models/index.js +4 -3
  288. package/models/props/DataGridProps.d.ts +56 -28
  289. package/modern/DataGrid/DataGrid.js +35 -1
  290. package/modern/DataGrid/useDataGridProps.js +2 -1
  291. package/modern/colDef/gridActionsColDef.js +2 -1
  292. package/modern/colDef/gridBooleanColDef.js +2 -1
  293. package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
  294. package/modern/colDef/gridDateColDef.js +4 -2
  295. package/modern/colDef/gridNumericColDef.js +3 -2
  296. package/modern/colDef/gridNumericOperators.js +11 -0
  297. package/modern/colDef/gridSingleSelectColDef.js +3 -2
  298. package/modern/colDef/gridSingleSelectOperators.js +52 -0
  299. package/modern/colDef/gridStringColDef.js +3 -2
  300. package/modern/colDef/gridStringOperators.js +12 -0
  301. package/modern/components/GridFooter.js +11 -2
  302. package/modern/components/GridRow.js +9 -5
  303. package/modern/components/GridRowCount.js +1 -0
  304. package/modern/components/GridScrollArea.js +3 -4
  305. package/modern/components/GridSelectedRowCount.js +2 -1
  306. package/modern/components/base/GridBody.js +1 -2
  307. package/modern/components/base/GridOverlays.js +2 -3
  308. package/modern/components/cell/GridActionsCell.js +14 -3
  309. package/modern/components/cell/GridCell.js +8 -8
  310. package/modern/components/cell/GridEditBooleanCell.js +101 -6
  311. package/modern/components/cell/GridEditDateCell.js +99 -5
  312. package/modern/components/cell/GridEditInputCell.js +29 -5
  313. package/modern/components/cell/GridEditSingleSelectCell.js +28 -5
  314. package/modern/components/cell/index.js +2 -0
  315. package/modern/components/columnHeaders/GridColumnHeaderItem.js +15 -16
  316. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
  317. package/modern/components/columnSelection/GridHeaderCheckbox.js +4 -5
  318. package/modern/components/containers/GridFooterContainer.js +11 -2
  319. package/modern/components/containers/GridRoot.js +25 -3
  320. package/modern/components/containers/GridRootStyles.js +36 -1
  321. package/modern/components/containers/GridToolbarContainer.js +12 -2
  322. package/modern/components/menu/GridMenu.js +1 -0
  323. package/modern/components/panel/GridPanelContent.js +13 -2
  324. package/modern/components/panel/GridPanelFooter.js +13 -2
  325. package/modern/components/panel/GridPanelHeader.js +13 -2
  326. package/modern/components/toolbar/GridToolbar.js +30 -7
  327. package/modern/components/toolbar/GridToolbarExport.js +15 -20
  328. package/modern/components/toolbar/GridToolbarQuickFilter.js +85 -0
  329. package/modern/components/toolbar/index.js +3 -2
  330. package/modern/constants/defaultGridSlotsComponents.js +4 -2
  331. package/modern/constants/gridClasses.js +1 -1
  332. package/modern/constants/localeTextConstants.js +8 -1
  333. package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -9
  334. package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
  335. package/modern/hooks/core/useGridApiInitialization.js +3 -3
  336. package/modern/hooks/core/useGridErrorHandler.js +1 -2
  337. package/modern/hooks/core/useGridStateInitialization.js +1 -2
  338. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -6
  339. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
  340. package/modern/hooks/features/columns/useGridColumnSpanning.js +1 -2
  341. package/modern/hooks/features/columns/useGridColumns.js +8 -9
  342. package/modern/hooks/features/dimensions/useGridDimensions.js +8 -9
  343. package/modern/hooks/features/editRows/useGridCellEditing.new.js +131 -32
  344. package/modern/hooks/features/editRows/useGridCellEditing.old.js +20 -21
  345. package/modern/hooks/features/editRows/useGridEditing.old.js +4 -5
  346. package/modern/hooks/features/editRows/useGridRowEditing.new.js +120 -42
  347. package/modern/hooks/features/editRows/useGridRowEditing.old.js +21 -22
  348. package/modern/hooks/features/events/useGridEvents.js +17 -18
  349. package/modern/hooks/features/export/serializers/csvSerializer.js +5 -5
  350. package/modern/hooks/features/export/useGridCsvExport.js +21 -16
  351. package/modern/hooks/features/export/useGridPrintExport.js +20 -0
  352. package/modern/hooks/features/export/utils.js +13 -0
  353. package/modern/hooks/features/filter/gridFilterState.js +3 -1
  354. package/modern/hooks/features/filter/gridFilterUtils.js +80 -2
  355. package/modern/hooks/features/filter/useGridFilter.js +20 -8
  356. package/modern/hooks/features/focus/useGridFocus.js +29 -33
  357. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +4 -5
  358. package/modern/hooks/features/pagination/useGridPage.js +3 -4
  359. package/modern/hooks/features/pagination/useGridPageSize.js +2 -3
  360. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
  361. package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
  362. package/modern/hooks/features/rows/gridRowsUtils.js +77 -1
  363. package/modern/hooks/features/rows/useGridRows.js +148 -128
  364. package/modern/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
  365. package/modern/hooks/features/scroll/useGridScroll.js +6 -1
  366. package/modern/hooks/features/selection/useGridSelection.js +13 -10
  367. package/modern/hooks/features/sorting/useGridSorting.js +8 -9
  368. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +14 -5
  369. package/modern/hooks/utils/useGridApiEventHandler.js +20 -9
  370. package/modern/hooks/utils/useGridNativeEventListener.js +1 -2
  371. package/modern/hooks/utils/useGridSelector.js +1 -1
  372. package/modern/index.js +1 -1
  373. package/modern/internals/index.js +5 -2
  374. package/modern/locales/arSD.js +8 -1
  375. package/modern/locales/bgBG.js +8 -1
  376. package/modern/locales/csCZ.js +7 -0
  377. package/modern/locales/daDK.js +8 -1
  378. package/modern/locales/deDE.js +10 -3
  379. package/modern/locales/elGR.js +7 -0
  380. package/modern/locales/esES.js +7 -0
  381. package/modern/locales/faIR.js +8 -1
  382. package/modern/locales/fiFI.js +7 -0
  383. package/modern/locales/frFR.js +7 -0
  384. package/modern/locales/heIL.js +8 -1
  385. package/modern/locales/huHU.js +8 -1
  386. package/modern/locales/itIT.js +7 -0
  387. package/modern/locales/jaJP.js +7 -0
  388. package/modern/locales/koKR.js +7 -0
  389. package/modern/locales/nlNL.js +7 -0
  390. package/modern/locales/plPL.js +8 -1
  391. package/modern/locales/ptBR.js +8 -1
  392. package/modern/locales/ruRU.js +7 -0
  393. package/modern/locales/skSK.js +7 -0
  394. package/modern/locales/trTR.js +8 -1
  395. package/modern/locales/ukUA.js +7 -0
  396. package/modern/locales/viVN.js +7 -0
  397. package/modern/locales/zhCN.js +7 -0
  398. package/modern/models/events/gridEvents.js +8 -0
  399. package/modern/models/index.js +4 -3
  400. package/modern/utils/createSelector.js +20 -2
  401. package/modern/utils/exportAs.js +1 -1
  402. package/node/DataGrid/DataGrid.js +35 -1
  403. package/node/DataGrid/useDataGridProps.js +2 -1
  404. package/node/colDef/gridActionsColDef.js +2 -1
  405. package/node/colDef/gridBooleanColDef.js +2 -1
  406. package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
  407. package/node/colDef/gridDateColDef.js +4 -2
  408. package/node/colDef/gridNumericColDef.js +2 -1
  409. package/node/colDef/gridNumericOperators.js +15 -1
  410. package/node/colDef/gridSingleSelectColDef.js +2 -1
  411. package/node/colDef/gridSingleSelectOperators.js +56 -1
  412. package/node/colDef/gridStringColDef.js +2 -1
  413. package/node/colDef/gridStringOperators.js +16 -1
  414. package/node/components/GridFooter.js +10 -1
  415. package/node/components/GridRow.js +9 -6
  416. package/node/components/GridRowCount.js +1 -0
  417. package/node/components/GridScrollArea.js +3 -5
  418. package/node/components/GridSelectedRowCount.js +2 -1
  419. package/node/components/base/GridBody.js +1 -3
  420. package/node/components/base/GridOverlays.js +2 -4
  421. package/node/components/cell/GridActionsCell.js +13 -4
  422. package/node/components/cell/GridCell.js +7 -7
  423. package/node/components/cell/GridEditBooleanCell.js +100 -5
  424. package/node/components/cell/GridEditDateCell.js +98 -4
  425. package/node/components/cell/GridEditInputCell.js +29 -5
  426. package/node/components/cell/GridEditSingleSelectCell.js +28 -6
  427. package/node/components/cell/index.js +26 -0
  428. package/node/components/columnHeaders/GridColumnHeaderItem.js +15 -17
  429. package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -4
  430. package/node/components/columnSelection/GridHeaderCheckbox.js +4 -6
  431. package/node/components/containers/GridFooterContainer.js +10 -1
  432. package/node/components/containers/GridRoot.js +24 -3
  433. package/node/components/containers/GridRootStyles.js +36 -1
  434. package/node/components/containers/GridToolbarContainer.js +11 -1
  435. package/node/components/menu/GridMenu.js +1 -0
  436. package/node/components/panel/GridPanelContent.js +11 -1
  437. package/node/components/panel/GridPanelFooter.js +11 -1
  438. package/node/components/panel/GridPanelHeader.js +11 -1
  439. package/node/components/toolbar/GridToolbar.js +32 -7
  440. package/node/components/toolbar/GridToolbarExport.js +14 -19
  441. package/node/components/toolbar/GridToolbarQuickFilter.js +109 -0
  442. package/node/components/toolbar/index.js +42 -11
  443. package/node/constants/defaultGridSlotsComponents.js +3 -1
  444. package/node/constants/gridClasses.js +1 -1
  445. package/node/constants/localeTextConstants.js +8 -1
  446. package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -8
  447. package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -8
  448. package/node/hooks/core/useGridApiInitialization.js +3 -4
  449. package/node/hooks/core/useGridErrorHandler.js +1 -3
  450. package/node/hooks/core/useGridStateInitialization.js +1 -3
  451. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -7
  452. package/node/hooks/features/columnMenu/useGridColumnMenu.js +3 -4
  453. package/node/hooks/features/columns/useGridColumnSpanning.js +1 -3
  454. package/node/hooks/features/columns/useGridColumns.js +8 -10
  455. package/node/hooks/features/dimensions/useGridDimensions.js +8 -10
  456. package/node/hooks/features/editRows/useGridCellEditing.new.js +133 -32
  457. package/node/hooks/features/editRows/useGridCellEditing.old.js +20 -22
  458. package/node/hooks/features/editRows/useGridEditing.old.js +4 -6
  459. package/node/hooks/features/editRows/useGridRowEditing.new.js +122 -43
  460. package/node/hooks/features/editRows/useGridRowEditing.old.js +21 -23
  461. package/node/hooks/features/events/useGridEvents.js +17 -19
  462. package/node/hooks/features/export/serializers/csvSerializer.js +5 -5
  463. package/node/hooks/features/export/useGridCsvExport.js +26 -17
  464. package/node/hooks/features/export/useGridPrintExport.js +25 -0
  465. package/node/hooks/features/export/utils.js +19 -2
  466. package/node/hooks/features/filter/gridFilterState.js +3 -1
  467. package/node/hooks/features/filter/gridFilterUtils.js +92 -3
  468. package/node/hooks/features/filter/useGridFilter.js +21 -9
  469. package/node/hooks/features/focus/useGridFocus.js +29 -34
  470. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +4 -6
  471. package/node/hooks/features/pagination/useGridPage.js +3 -5
  472. package/node/hooks/features/pagination/useGridPageSize.js +2 -4
  473. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -8
  474. package/node/hooks/features/rows/gridRowsSelector.js +3 -1
  475. package/node/hooks/features/rows/gridRowsUtils.js +95 -1
  476. package/node/hooks/features/rows/useGridRows.js +150 -126
  477. package/node/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
  478. package/node/hooks/features/scroll/useGridScroll.js +6 -1
  479. package/node/hooks/features/selection/useGridSelection.js +13 -11
  480. package/node/hooks/features/sorting/useGridSorting.js +8 -10
  481. package/node/hooks/features/virtualization/useGridVirtualScroller.js +14 -6
  482. package/node/hooks/utils/useGridApiEventHandler.js +22 -10
  483. package/node/hooks/utils/useGridNativeEventListener.js +1 -3
  484. package/node/hooks/utils/useGridSelector.js +1 -1
  485. package/node/index.js +1 -1
  486. package/node/internals/index.js +39 -3
  487. package/node/locales/arSD.js +8 -1
  488. package/node/locales/bgBG.js +8 -1
  489. package/node/locales/csCZ.js +7 -0
  490. package/node/locales/daDK.js +8 -1
  491. package/node/locales/deDE.js +10 -3
  492. package/node/locales/elGR.js +7 -0
  493. package/node/locales/esES.js +7 -0
  494. package/node/locales/faIR.js +8 -1
  495. package/node/locales/fiFI.js +7 -0
  496. package/node/locales/frFR.js +7 -0
  497. package/node/locales/heIL.js +8 -1
  498. package/node/locales/huHU.js +8 -1
  499. package/node/locales/itIT.js +7 -0
  500. package/node/locales/jaJP.js +7 -0
  501. package/node/locales/koKR.js +7 -0
  502. package/node/locales/nlNL.js +7 -0
  503. package/node/locales/plPL.js +8 -1
  504. package/node/locales/ptBR.js +8 -1
  505. package/node/locales/ruRU.js +7 -0
  506. package/node/locales/skSK.js +7 -0
  507. package/node/locales/trTR.js +8 -1
  508. package/node/locales/ukUA.js +7 -0
  509. package/node/locales/viVN.js +7 -0
  510. package/node/locales/zhCN.js +7 -0
  511. package/node/models/events/gridEvents.js +8 -0
  512. package/node/models/index.js +0 -13
  513. package/node/utils/createSelector.js +25 -4
  514. package/node/utils/exportAs.js +1 -1
  515. package/package.json +3 -2
  516. package/utils/createSelector.d.ts +2 -1
  517. package/utils/createSelector.js +20 -2
  518. package/utils/exportAs.d.ts +2 -2
  519. package/utils/exportAs.js +1 -1
@@ -1,2 +1,4 @@
1
1
  import { GridFilterOperator } from '../models/gridFilterOperator';
2
+ import { GridCellParams } from '../models';
3
+ export declare const getGridStringQuickFilterFn: (value: any) => (({ value: columnValue }: GridCellParams) => boolean) | null;
2
4
  export declare const getGridStringOperators: () => GridFilterOperator<any, number | string | null, any>[];
@@ -1,6 +1,18 @@
1
1
  import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilterInputValue';
2
2
  import { escapeRegExp } from '../utils/utils';
3
3
  import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue';
4
+ export const getGridStringQuickFilterFn = value => {
5
+ if (!value) {
6
+ return null;
7
+ }
8
+
9
+ const filterRegex = new RegExp(escapeRegExp(value), 'i');
10
+ return ({
11
+ value: columnValue
12
+ }) => {
13
+ return columnValue != null ? filterRegex.test(columnValue.toString()) : false;
14
+ };
15
+ };
4
16
  export const getGridStringOperators = () => [{
5
17
  value: 'contains',
6
18
  getApplyFilterFn: filterItem => {
@@ -1,3 +1,5 @@
1
1
  import * as React from 'react';
2
- import { GridFooterContainerProps } from './containers/GridFooterContainer';
3
- export declare const GridFooter: React.ForwardRefExoticComponent<GridFooterContainerProps & React.RefAttributes<HTMLDivElement>>;
2
+ declare const GridFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
3
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
4
+ } & React.RefAttributes<HTMLDivElement>>;
5
+ export { GridFooter };
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
3
4
  import { useGridSelector } from '../hooks/utils/useGridSelector';
4
5
  import { gridTopLevelRowCountSelector } from '../hooks/features/rows/gridRowsSelector';
5
6
  import { selectedGridRowsCountSelector } from '../hooks/features/selection/gridSelectionSelector';
@@ -11,7 +12,7 @@ import { GridFooterContainer } from './containers/GridFooterContainer';
11
12
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
- export const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(props, ref) {
15
+ const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(props, ref) {
15
16
  var _rootProps$components;
16
17
 
17
18
  const apiRef = useGridApiContext();
@@ -34,4 +35,12 @@ export const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(prop
34
35
  }, props, {
35
36
  children: [selectedRowCountElement, rowCountElement, paginationElement]
36
37
  }));
37
- });
38
+ });
39
+ process.env.NODE_ENV !== "production" ? GridFooter.propTypes = {
40
+ // ----------------------------- Warning --------------------------------
41
+ // | These PropTypes are generated from the TypeScript type definitions |
42
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
43
+ // ----------------------------------------------------------------------
44
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
45
+ } : void 0;
46
+ export { GridFooter };
@@ -9,7 +9,6 @@ import * as React from 'react';
9
9
  import PropTypes from 'prop-types';
10
10
  import clsx from 'clsx';
11
11
  import { unstable_composeClasses as composeClasses } from '@mui/material';
12
- import { GridEvents } from '../models/events';
13
12
  import { GridEditModes, GridRowModes, GridCellModes } from '../models/gridEditRowModel';
14
13
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
15
14
  import { getDataGridUtilityClass, gridClasses } from '../constants/gridClasses';
@@ -136,6 +135,11 @@ function GridRow(props) {
136
135
 
137
136
  if (field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {
138
137
  return;
138
+ } // User reorders a row
139
+
140
+
141
+ if (field === '__reorder__') {
142
+ return;
139
143
  } // User is editing a cell
140
144
 
141
145
 
@@ -151,7 +155,7 @@ function GridRow(props) {
151
155
  }
152
156
  }
153
157
 
154
- publish(GridEvents.rowClick, onClick)(event);
158
+ publish('rowClick', onClick)(event);
155
159
  }, [apiRef, onClick, publish, rowId]);
156
160
 
157
161
  const style = _extends({}, styleProp, {
@@ -282,9 +286,9 @@ function GridRow(props) {
282
286
  "aria-selected": selected,
283
287
  style: style,
284
288
  onClick: publishClick,
285
- onDoubleClick: publish(GridEvents.rowDoubleClick, onDoubleClick),
286
- onMouseEnter: publish(GridEvents.rowMouseEnter, onMouseEnter),
287
- onMouseLeave: publish(GridEvents.rowMouseLeave, onMouseLeave)
289
+ onDoubleClick: publish('rowDoubleClick', onDoubleClick),
290
+ onMouseEnter: publish('rowMouseEnter', onMouseEnter),
291
+ onMouseLeave: publish('rowMouseLeave', onMouseLeave)
288
292
  }, other, {
289
293
  children: [cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
290
294
  width: emptyCellWidth,
@@ -1,7 +1,10 @@
1
1
  import * as React from 'react';
2
+ import { SxProps, Theme } from '@mui/material/styles';
2
3
  interface RowCountProps {
3
4
  rowCount: number;
4
5
  visibleRowCount: number;
5
6
  }
6
- declare const GridRowCount: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & RowCountProps & React.RefAttributes<HTMLDivElement>>;
7
+ declare const GridRowCount: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & RowCountProps & {
8
+ sx?: SxProps<Theme> | undefined;
9
+ } & React.RefAttributes<HTMLDivElement>>;
7
10
  export { GridRowCount };
@@ -65,6 +65,7 @@ process.env.NODE_ENV !== "production" ? GridRowCount.propTypes = {
65
65
  // | To update them edit the TypeScript types and run "yarn proptypes" |
66
66
  // ----------------------------------------------------------------------
67
67
  rowCount: PropTypes.number.isRequired,
68
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
68
69
  visibleRowCount: PropTypes.number.isRequired
69
70
  } : void 0;
70
71
  export { GridRowCount };
@@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
4
4
  import clsx from 'clsx';
5
5
  import { unstable_composeClasses as composeClasses } from '@mui/material';
6
6
  import { styled } from '@mui/material/styles';
7
- import { GridEvents } from '../models/events';
8
7
  import { useGridApiEventHandler } from '../hooks/utils/useGridApiEventHandler';
9
8
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
10
9
  import { getDataGridUtilityClass, gridClasses } from '../constants/gridClasses';
@@ -100,9 +99,9 @@ function GridScrollAreaRaw(props) {
100
99
  const toggleDragging = React.useCallback(() => {
101
100
  setDragging(prevDragging => !prevDragging);
102
101
  }, []);
103
- useGridApiEventHandler(apiRef, GridEvents.rowsScroll, handleScrolling);
104
- useGridApiEventHandler(apiRef, GridEvents.columnHeaderDragStart, toggleDragging);
105
- useGridApiEventHandler(apiRef, GridEvents.columnHeaderDragEnd, toggleDragging);
102
+ useGridApiEventHandler(apiRef, 'rowsScroll', handleScrolling);
103
+ useGridApiEventHandler(apiRef, 'columnHeaderDragStart', toggleDragging);
104
+ useGridApiEventHandler(apiRef, 'columnHeaderDragEnd', toggleDragging);
106
105
  return dragging ? /*#__PURE__*/_jsx(GridScrollAreaRawRoot, {
107
106
  ref: rootRef,
108
107
  className: clsx(classes.root),
@@ -1,6 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { SxProps, Theme } from '@mui/material/styles';
2
3
  interface SelectedRowCountProps {
3
4
  selectedRowCount: number;
4
5
  }
5
- declare const GridSelectedRowCount: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & SelectedRowCountProps & React.RefAttributes<HTMLDivElement>>;
6
+ declare const GridSelectedRowCount: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & SelectedRowCountProps & {
7
+ sx?: SxProps<Theme> | undefined;
8
+ } & React.RefAttributes<HTMLDivElement>>;
6
9
  export { GridSelectedRowCount };
@@ -66,6 +66,7 @@ process.env.NODE_ENV !== "production" ? GridSelectedRowCount.propTypes = {
66
66
  // | These PropTypes are generated from the TypeScript type definitions |
67
67
  // | To update them edit the TypeScript types and run "yarn proptypes" |
68
68
  // ----------------------------------------------------------------------
69
- selectedRowCount: PropTypes.number.isRequired
69
+ selectedRowCount: PropTypes.number.isRequired,
70
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
70
71
  } : void 0;
71
72
  export { GridSelectedRowCount };
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { GridEvents } from '../../models/events';
4
3
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
5
4
  import { GridMainContainer } from '../containers/GridMainContainer';
6
5
  import { GridAutoSizer } from '../GridAutoSizer';
@@ -46,7 +45,7 @@ function GridBody(props) {
46
45
  apiRef.current.renderingZoneRef = renderingZoneRef; // TODO remove, nobody should have access to internal parts of the virtualization
47
46
 
48
47
  const handleResize = React.useCallback(size => {
49
- apiRef.current.publishEvent(GridEvents.resize, size);
48
+ apiRef.current.publishEvent('resize', size);
50
49
  }, [apiRef]);
51
50
  return /*#__PURE__*/_jsxs(GridMainContainer, {
52
51
  children: [/*#__PURE__*/_jsx(GridOverlays, {}), /*#__PURE__*/_jsx(ColumnHeadersComponent, {
@@ -7,7 +7,6 @@ import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/featu
7
7
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
8
8
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
9
  import { gridDensityHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
10
- import { GridEvents } from '../../models/events';
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
11
 
13
12
  function GridOverlayWrapper(props) {
@@ -27,7 +26,7 @@ function GridOverlayWrapper(props) {
27
26
  setViewportInnerSize((_apiRef$current$getRo3 = (_apiRef$current$getRo4 = apiRef.current.getRootDimensions()) == null ? void 0 : _apiRef$current$getRo4.viewportInnerSize) != null ? _apiRef$current$getRo3 : null);
28
27
  }, [apiRef]);
29
28
  useEnhancedEffect(() => {
30
- return apiRef.current.subscribeEvent(GridEvents.viewportInnerSizeChange, handleViewportSizeChange);
29
+ return apiRef.current.subscribeEvent('viewportInnerSizeChange', handleViewportSizeChange);
31
30
  }, [apiRef, handleViewportSizeChange]);
32
31
  let height = (_viewportInnerSize$he = viewportInnerSize == null ? void 0 : viewportInnerSize.height) != null ? _viewportInnerSize$he : 0;
33
32
 
@@ -72,7 +71,7 @@ export function GridOverlays() {
72
71
  overlay = /*#__PURE__*/_jsx(rootProps.components.NoResultsOverlay, _extends({}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.noResultsOverlay));
73
72
  }
74
73
 
75
- if (rootProps.loading) {
74
+ if (loading) {
76
75
  var _rootProps$components3;
77
76
 
78
77
  overlay = /*#__PURE__*/_jsx(rootProps.components.LoadingOverlay, _extends({}, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.loadingOverlay));
@@ -46,12 +46,16 @@ const GridActionsCell = props => {
46
46
  }
47
47
  }, [hasFocus]);
48
48
  React.useEffect(() => {
49
- if (focusedButtonIndex >= 0) {
50
- var _rootRef$current;
49
+ if (focusedButtonIndex < 0 || !rootRef.current) {
50
+ return;
51
+ }
51
52
 
52
- const child = (_rootRef$current = rootRef.current) == null ? void 0 : _rootRef$current.children[focusedButtonIndex];
53
- child.focus();
53
+ if (focusedButtonIndex >= rootRef.current.children.length) {
54
+ return;
54
55
  }
56
+
57
+ const child = rootRef.current.children[focusedButtonIndex];
58
+ child.focus();
55
59
  }, [focusedButtonIndex]);
56
60
  React.useEffect(() => {
57
61
  if (!hasFocus) {
@@ -77,6 +81,11 @@ const GridActionsCell = props => {
77
81
  const iconButtons = options.filter(option => !option.props.showInMenu);
78
82
  const menuButtons = options.filter(option => option.props.showInMenu);
79
83
  const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
84
+ React.useEffect(() => {
85
+ if (focusedButtonIndex >= numberOfButtons) {
86
+ setFocusedButtonIndex(numberOfButtons - 1);
87
+ }
88
+ }, [focusedButtonIndex, numberOfButtons]);
80
89
 
81
90
  const showMenu = () => {
82
91
  setOpen(true);
@@ -9,7 +9,7 @@ import clsx from 'clsx';
9
9
  import { unstable_composeClasses as composeClasses } from '@mui/material';
10
10
  import { ownerDocument, capitalize } from '@mui/material/utils';
11
11
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
12
- import { GridEvents, GridCellModes } from '../../models';
12
+ import { GridCellModes } from '../../models';
13
13
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
14
14
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
15
15
  import { gridFocusCellSelector } from '../../hooks/features/focus/gridFocusStateSelector';
@@ -194,13 +194,13 @@ function GridCell(props) {
194
194
  "aria-colspan": colSpan,
195
195
  style: style,
196
196
  tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
197
- onClick: publish(GridEvents.cellClick, onClick),
198
- onDoubleClick: publish(GridEvents.cellDoubleClick, onDoubleClick),
199
- onMouseDown: publish(GridEvents.cellMouseDown, onMouseDown),
200
- onMouseUp: publishMouseUp(GridEvents.cellMouseUp),
201
- onKeyDown: publish(GridEvents.cellKeyDown, onKeyDown),
202
- onDragEnter: publish(GridEvents.cellDragEnter, onDragEnter),
203
- onDragOver: publish(GridEvents.cellDragOver, onDragOver)
197
+ onClick: publish('cellClick', onClick),
198
+ onDoubleClick: publish('cellDoubleClick', onDoubleClick),
199
+ onMouseDown: publish('cellMouseDown', onMouseDown),
200
+ onMouseUp: publishMouseUp('cellMouseUp'),
201
+ onKeyDown: publish('cellKeyDown', onKeyDown),
202
+ onDragEnter: publish('cellDragEnter', onDragEnter),
203
+ onDragOver: publish('cellDragOver', onDragOver)
204
204
  }, other, {
205
205
  onFocus: handleFocus,
206
206
  children: renderChildren()
@@ -1,5 +1,17 @@
1
1
  import * as React from 'react';
2
2
  import { GridRenderEditCellParams } from '../../models/params/gridCellParams';
3
- import { GridColDef } from '../../models/colDef/gridColDef';
4
- export declare function GridEditBooleanCell(props: GridRenderEditCellParams & Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, 'id'>): JSX.Element;
5
- export declare const renderEditBooleanCell: GridColDef['renderEditCell'];
3
+ export interface GridEditBooleanCellProps extends GridRenderEditCellParams, Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, 'id' | 'tabIndex'> {
4
+ /**
5
+ * Callback called when the value is changed by the user.
6
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
7
+ * @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
8
+ * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
9
+ */
10
+ onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: boolean) => Promise<void> | void;
11
+ }
12
+ declare function GridEditBooleanCell(props: GridEditBooleanCellProps): JSX.Element;
13
+ declare namespace GridEditBooleanCell {
14
+ var propTypes: any;
15
+ }
16
+ export { GridEditBooleanCell };
17
+ export declare const renderEditBooleanCell: (params: GridEditBooleanCellProps) => JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "getValue", "hasFocus", "isValidating", "isProcessingProps", "error"];
3
+ const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "getValue", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange"];
4
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
5
6
  import clsx from 'clsx';
6
7
  import { unstable_composeClasses as composeClasses } from '@mui/material';
7
8
  import { unstable_useId as useId, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
@@ -19,7 +20,7 @@ const useUtilityClasses = ownerState => {
19
20
  return composeClasses(slots, getDataGridUtilityClass, classes);
20
21
  };
21
22
 
22
- export function GridEditBooleanCell(props) {
23
+ function GridEditBooleanCell(props) {
23
24
  var _rootProps$components;
24
25
 
25
26
  const {
@@ -28,7 +29,8 @@ export function GridEditBooleanCell(props) {
28
29
  api,
29
30
  field,
30
31
  className,
31
- hasFocus
32
+ hasFocus,
33
+ onValueChange
32
34
  } = props,
33
35
  other = _objectWithoutPropertiesLoose(props, _excluded);
34
36
 
@@ -40,15 +42,20 @@ export function GridEditBooleanCell(props) {
40
42
  classes: rootProps.classes
41
43
  };
42
44
  const classes = useUtilityClasses(ownerState);
43
- const handleChange = React.useCallback(event => {
45
+ const handleChange = React.useCallback(async event => {
44
46
  const newValue = event.target.checked;
47
+
48
+ if (onValueChange) {
49
+ await onValueChange(event, newValue);
50
+ }
51
+
45
52
  setValueState(newValue);
46
- api.setEditCellValue({
53
+ await api.setEditCellValue({
47
54
  id: idProp,
48
55
  field,
49
56
  value: newValue
50
57
  }, event);
51
- }, [api, field, idProp]);
58
+ }, [api, field, idProp, onValueChange]);
52
59
  React.useEffect(() => {
53
60
  setValueState(value);
54
61
  }, [value]);
@@ -70,4 +77,92 @@ export function GridEditBooleanCell(props) {
70
77
  }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseCheckbox))
71
78
  }));
72
79
  }
80
+
81
+ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
82
+ // ----------------------------- Warning --------------------------------
83
+ // | These PropTypes are generated from the TypeScript type definitions |
84
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
85
+ // ----------------------------------------------------------------------
86
+
87
+ /**
88
+ * GridApi that let you manipulate the grid.
89
+ * @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
90
+ */
91
+ api: PropTypes.any.isRequired,
92
+
93
+ /**
94
+ * The mode of the cell.
95
+ */
96
+ cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
97
+
98
+ /**
99
+ * The column of the row that the current cell belongs to.
100
+ */
101
+ colDef: PropTypes.object.isRequired,
102
+
103
+ /**
104
+ * The column field of the cell that triggered the event.
105
+ */
106
+ field: PropTypes.string.isRequired,
107
+
108
+ /**
109
+ * The cell value formatted with the column valueFormatter.
110
+ */
111
+ formattedValue: PropTypes.any,
112
+
113
+ /**
114
+ * Get the cell value of a row and field.
115
+ * @param {GridRowId} id The row id.
116
+ * @param {string} field The field.
117
+ * @returns {any} The cell value.
118
+ * @deprecated Use `params.row` to directly access the fields you want instead.
119
+ */
120
+ getValue: PropTypes.func.isRequired,
121
+
122
+ /**
123
+ * If true, the cell is the active element.
124
+ */
125
+ hasFocus: PropTypes.bool.isRequired,
126
+
127
+ /**
128
+ * The grid row id.
129
+ */
130
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
131
+
132
+ /**
133
+ * If true, the cell is editable.
134
+ */
135
+ isEditable: PropTypes.bool,
136
+ isProcessingProps: PropTypes.bool,
137
+ isValidating: PropTypes.bool,
138
+
139
+ /**
140
+ * Callback called when the value is changed by the user.
141
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
142
+ * @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
143
+ * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
144
+ */
145
+ onValueChange: PropTypes.func,
146
+
147
+ /**
148
+ * The row model of the row that the current cell belongs to.
149
+ */
150
+ row: PropTypes.object.isRequired,
151
+
152
+ /**
153
+ * The node of the row that the current cell belongs to.
154
+ */
155
+ rowNode: PropTypes.object.isRequired,
156
+
157
+ /**
158
+ * the tabIndex value.
159
+ */
160
+ tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
161
+
162
+ /**
163
+ * The cell value, but if the column has valueGetter, use getValue.
164
+ */
165
+ value: PropTypes.any
166
+ } : void 0;
167
+ export { GridEditBooleanCell };
73
168
  export const renderEditBooleanCell = params => /*#__PURE__*/_jsx(GridEditBooleanCell, _extends({}, params));
@@ -1,6 +1,18 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { InputBaseProps } from '@mui/material/InputBase';
3
3
  import { GridRenderEditCellParams } from '../../models/params/gridCellParams';
4
- import { GridColDef } from '../../models/colDef/gridColDef';
5
- export declare function GridEditDateCell(props: GridRenderEditCellParams & Omit<InputBaseProps, 'id'>): JSX.Element;
6
- export declare const renderEditDateCell: GridColDef['renderEditCell'];
4
+ export interface GridEditDateCellProps extends GridRenderEditCellParams, Omit<InputBaseProps, 'id' | 'value' | 'tabIndex'> {
5
+ /**
6
+ * Callback called when the value is changed by the user.
7
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
8
+ * @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
9
+ * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
10
+ */
11
+ onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: Date | null) => Promise<void> | void;
12
+ }
13
+ declare function GridEditDateCell(props: GridEditDateCellProps): JSX.Element;
14
+ declare namespace GridEditDateCell {
15
+ var propTypes: any;
16
+ }
17
+ export { GridEditDateCell };
18
+ export declare const renderEditDateCell: (params: GridRenderEditCellParams) => JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "hasFocus", "getValue", "inputProps", "isValidating", "isProcessingProps"];
3
+ const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "hasFocus", "getValue", "inputProps", "isValidating", "isProcessingProps", "onValueChange"];
4
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
5
6
  import { unstable_composeClasses as composeClasses } from '@mui/material';
6
7
  import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
7
8
  import InputBase from '@mui/material/InputBase';
@@ -19,7 +20,7 @@ const useUtilityClasses = ownerState => {
19
20
  return composeClasses(slots, getDataGridUtilityClass, classes);
20
21
  };
21
22
 
22
- export function GridEditDateCell(props) {
23
+ function GridEditDateCell(props) {
23
24
  const {
24
25
  id,
25
26
  value: valueProp,
@@ -27,7 +28,8 @@ export function GridEditDateCell(props) {
27
28
  field,
28
29
  colDef,
29
30
  hasFocus,
30
- inputProps
31
+ inputProps,
32
+ onValueChange
31
33
  } = props,
32
34
  other = _objectWithoutPropertiesLoose(props, _excluded);
33
35
 
@@ -64,7 +66,7 @@ export function GridEditDateCell(props) {
64
66
  classes: rootProps.classes
65
67
  };
66
68
  const classes = useUtilityClasses(ownerState);
67
- const handleChange = React.useCallback(event => {
69
+ const handleChange = React.useCallback(async event => {
68
70
  const newFormattedDate = event.target.value;
69
71
  let newParsedDate;
70
72
 
@@ -83,6 +85,10 @@ export function GridEditDateCell(props) {
83
85
  }
84
86
  }
85
87
 
88
+ if (onValueChange) {
89
+ await onValueChange(event, newParsedDate);
90
+ }
91
+
86
92
  setValueState({
87
93
  parsed: newParsedDate,
88
94
  formatted: newFormattedDate
@@ -92,7 +98,7 @@ export function GridEditDateCell(props) {
92
98
  field,
93
99
  value: newParsedDate
94
100
  }, event);
95
- }, [api, field, id]);
101
+ }, [api, field, id, onValueChange]);
96
102
  React.useEffect(() => {
97
103
  setValueState(state => {
98
104
  var _valueTransformed$par, _state$parsed;
@@ -121,4 +127,92 @@ export function GridEditDateCell(props) {
121
127
  onChange: handleChange
122
128
  }, other));
123
129
  }
130
+
131
+ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes = {
132
+ // ----------------------------- Warning --------------------------------
133
+ // | These PropTypes are generated from the TypeScript type definitions |
134
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
135
+ // ----------------------------------------------------------------------
136
+
137
+ /**
138
+ * GridApi that let you manipulate the grid.
139
+ * @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
140
+ */
141
+ api: PropTypes.any.isRequired,
142
+
143
+ /**
144
+ * The mode of the cell.
145
+ */
146
+ cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
147
+
148
+ /**
149
+ * The column of the row that the current cell belongs to.
150
+ */
151
+ colDef: PropTypes.object.isRequired,
152
+
153
+ /**
154
+ * The column field of the cell that triggered the event.
155
+ */
156
+ field: PropTypes.string.isRequired,
157
+
158
+ /**
159
+ * The cell value formatted with the column valueFormatter.
160
+ */
161
+ formattedValue: PropTypes.any,
162
+
163
+ /**
164
+ * Get the cell value of a row and field.
165
+ * @param {GridRowId} id The row id.
166
+ * @param {string} field The field.
167
+ * @returns {any} The cell value.
168
+ * @deprecated Use `params.row` to directly access the fields you want instead.
169
+ */
170
+ getValue: PropTypes.func.isRequired,
171
+
172
+ /**
173
+ * If true, the cell is the active element.
174
+ */
175
+ hasFocus: PropTypes.bool.isRequired,
176
+
177
+ /**
178
+ * The grid row id.
179
+ */
180
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
181
+
182
+ /**
183
+ * If true, the cell is editable.
184
+ */
185
+ isEditable: PropTypes.bool,
186
+ isProcessingProps: PropTypes.bool,
187
+ isValidating: PropTypes.bool,
188
+
189
+ /**
190
+ * Callback called when the value is changed by the user.
191
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
192
+ * @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
193
+ * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
194
+ */
195
+ onValueChange: PropTypes.func,
196
+
197
+ /**
198
+ * The row model of the row that the current cell belongs to.
199
+ */
200
+ row: PropTypes.object.isRequired,
201
+
202
+ /**
203
+ * The node of the row that the current cell belongs to.
204
+ */
205
+ rowNode: PropTypes.object.isRequired,
206
+
207
+ /**
208
+ * the tabIndex value.
209
+ */
210
+ tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
211
+
212
+ /**
213
+ * The cell value, but if the column has valueGetter, use getValue.
214
+ */
215
+ value: PropTypes.any
216
+ } : void 0;
217
+ export { GridEditDateCell };
124
218
  export const renderEditDateCell = params => /*#__PURE__*/_jsx(GridEditDateCell, _extends({}, params));
@@ -1,13 +1,19 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { InputBaseProps } from '@mui/material/InputBase';
3
3
  import { GridRenderEditCellParams } from '../../models/params/gridCellParams';
4
- import { GridColDef } from '../../models/colDef/gridColDef';
5
- interface GridEditInputCellProps {
4
+ export interface GridEditInputCellProps extends GridRenderEditCellParams, Omit<InputBaseProps, 'id' | 'value' | 'tabIndex'> {
6
5
  debounceMs?: number;
6
+ /**
7
+ * Callback called when the value is changed by the user.
8
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
9
+ * @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
10
+ * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
11
+ */
12
+ onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: string) => Promise<void> | void;
7
13
  }
8
- declare function GridEditInputCell(props: GridEditInputCellProps & GridRenderEditCellParams & Omit<InputBaseProps, 'id'>): JSX.Element;
14
+ declare function GridEditInputCell(props: GridEditInputCellProps): JSX.Element;
9
15
  declare namespace GridEditInputCell {
10
16
  var propTypes: any;
11
17
  }
12
18
  export { GridEditInputCell };
13
- export declare const renderEditInputCell: GridColDef['renderEditCell'];
19
+ export declare const renderEditInputCell: (params: GridEditInputCellProps) => JSX.Element;