@mui/x-data-grid 5.8.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (626) hide show
  1. package/CHANGELOG.md +333 -66
  2. package/DataGrid/DataGrid.js +36 -2
  3. package/DataGrid/useDataGridComponent.js +3 -1
  4. package/DataGrid/useDataGridProps.js +2 -1
  5. package/LICENSE +21 -0
  6. package/README.md +7 -5
  7. package/colDef/gridActionsColDef.js +2 -1
  8. package/colDef/gridBooleanColDef.js +2 -1
  9. package/colDef/gridCheckboxSelectionColDef.js +1 -0
  10. package/colDef/gridDateColDef.js +4 -2
  11. package/colDef/gridNumericColDef.js +3 -2
  12. package/colDef/gridNumericOperators.d.ts +2 -0
  13. package/colDef/gridNumericOperators.js +11 -0
  14. package/colDef/gridSingleSelectColDef.js +3 -2
  15. package/colDef/gridSingleSelectOperators.d.ts +3 -0
  16. package/colDef/gridSingleSelectOperators.js +52 -0
  17. package/colDef/gridStringColDef.js +3 -2
  18. package/colDef/gridStringOperators.d.ts +2 -0
  19. package/colDef/gridStringOperators.js +12 -0
  20. package/components/GridFooter.d.ts +4 -2
  21. package/components/GridFooter.js +11 -2
  22. package/components/GridRow.d.ts +4 -0
  23. package/components/GridRow.js +58 -28
  24. package/components/GridRowCount.d.ts +4 -1
  25. package/components/GridRowCount.js +1 -0
  26. package/components/GridScrollArea.js +3 -4
  27. package/components/GridSelectedRowCount.d.ts +4 -1
  28. package/components/GridSelectedRowCount.js +2 -1
  29. package/components/base/GridBody.js +1 -2
  30. package/components/base/GridOverlays.js +5 -5
  31. package/components/cell/GridActionsCell.d.ts +5 -1
  32. package/components/cell/GridActionsCell.js +179 -21
  33. package/components/cell/GridActionsCellItem.d.ts +66 -4
  34. package/components/cell/GridActionsCellItem.js +7 -5
  35. package/components/cell/GridCell.d.ts +1 -0
  36. package/components/cell/GridCell.js +36 -15
  37. package/components/cell/GridEditBooleanCell.d.ts +15 -3
  38. package/components/cell/GridEditBooleanCell.js +101 -6
  39. package/components/cell/GridEditDateCell.d.ts +16 -4
  40. package/components/cell/GridEditDateCell.js +99 -5
  41. package/components/cell/GridEditInputCell.d.ts +11 -5
  42. package/components/cell/GridEditInputCell.js +30 -6
  43. package/components/cell/GridEditSingleSelectCell.d.ts +12 -4
  44. package/components/cell/GridEditSingleSelectCell.js +50 -18
  45. package/components/cell/index.d.ts +2 -0
  46. package/components/cell/index.js +2 -0
  47. package/components/columnHeaders/GridColumnHeaderItem.js +19 -23
  48. package/components/columnHeaders/GridColumnHeaders.d.ts +2 -1
  49. package/components/columnHeaders/GridColumnHeaders.js +1 -1
  50. package/components/columnHeaders/GridColumnHeadersInner.d.ts +2 -0
  51. package/components/columnSelection/GridCellCheckboxRenderer.d.ts +3 -3
  52. package/components/columnSelection/GridCellCheckboxRenderer.js +22 -6
  53. package/components/columnSelection/GridHeaderCheckbox.js +4 -5
  54. package/components/containers/GridFooterContainer.d.ts +8 -2
  55. package/components/containers/GridFooterContainer.js +11 -2
  56. package/components/containers/GridRootStyles.js +36 -1
  57. package/components/containers/GridToolbarContainer.d.ts +8 -2
  58. package/components/containers/GridToolbarContainer.js +12 -2
  59. package/components/menu/GridMenu.js +1 -0
  60. package/components/panel/GridPanel.js +1 -0
  61. package/components/panel/GridPanelContent.d.ts +8 -1
  62. package/components/panel/GridPanelContent.js +13 -2
  63. package/components/panel/GridPanelFooter.d.ts +8 -1
  64. package/components/panel/GridPanelFooter.js +13 -2
  65. package/components/panel/GridPanelHeader.d.ts +8 -1
  66. package/components/panel/GridPanelHeader.js +13 -2
  67. package/components/panel/filterPanel/GridFilterForm.js +14 -10
  68. package/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
  69. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -15
  70. package/components/panel/filterPanel/GridFilterInputValue.js +22 -15
  71. package/components/toolbar/GridToolbar.d.ts +12 -2
  72. package/components/toolbar/GridToolbar.js +30 -7
  73. package/components/toolbar/GridToolbarDensitySelector.js +1 -1
  74. package/components/toolbar/GridToolbarExport.d.ts +5 -4
  75. package/components/toolbar/GridToolbarExport.js +15 -20
  76. package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
  77. package/components/toolbar/GridToolbarQuickFilter.d.ts +20 -0
  78. package/components/toolbar/GridToolbarQuickFilter.js +88 -0
  79. package/components/toolbar/index.d.ts +3 -1
  80. package/components/toolbar/index.js +3 -2
  81. package/components/virtualization/GridVirtualScroller.d.ts +4 -1
  82. package/components/virtualization/GridVirtualScroller.js +2 -0
  83. package/components/virtualization/GridVirtualScrollerContent.d.ts +4 -1
  84. package/components/virtualization/GridVirtualScrollerContent.js +1 -3
  85. package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +4 -1
  86. package/constants/defaultGridSlotsComponents.js +3 -2
  87. package/constants/gridClasses.d.ts +20 -0
  88. package/constants/gridClasses.js +1 -1
  89. package/constants/gridDetailPanelToggleField.d.ts +1 -0
  90. package/constants/gridDetailPanelToggleField.js +2 -0
  91. package/constants/localeTextConstants.js +8 -1
  92. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +39 -15
  93. package/hooks/core/pipeProcessing/index.d.ts +1 -0
  94. package/hooks/core/pipeProcessing/index.js +2 -1
  95. package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +8 -3
  96. package/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
  97. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +3 -0
  98. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
  99. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +0 -3
  100. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
  101. package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +4 -4
  102. package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
  103. package/hooks/core/useGridApiInitialization.js +3 -3
  104. package/hooks/core/useGridErrorHandler.js +1 -2
  105. package/hooks/core/useGridStateInitialization.js +1 -2
  106. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +0 -1
  107. package/hooks/features/columnHeaders/useGridColumnHeaders.js +81 -16
  108. package/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
  109. package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -1
  110. package/hooks/features/columns/gridColumnsUtils.d.ts +19 -1
  111. package/hooks/features/columns/gridColumnsUtils.js +61 -8
  112. package/hooks/features/columns/useGridColumnSpanning.d.ts +7 -0
  113. package/hooks/features/columns/useGridColumnSpanning.js +108 -0
  114. package/hooks/features/columns/useGridColumns.d.ts +1 -1
  115. package/hooks/features/columns/useGridColumns.js +30 -25
  116. package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
  117. package/hooks/features/dimensions/useGridDimensions.js +10 -11
  118. package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
  119. package/hooks/features/editRows/useGridCellEditing.new.js +151 -42
  120. package/hooks/features/editRows/useGridCellEditing.old.js +20 -21
  121. package/hooks/features/editRows/useGridEditing.new.js +7 -3
  122. package/hooks/features/editRows/useGridEditing.old.js +4 -5
  123. package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
  124. package/hooks/features/editRows/useGridRowEditing.new.js +145 -57
  125. package/hooks/features/editRows/useGridRowEditing.old.js +21 -22
  126. package/hooks/features/events/useGridEvents.js +17 -18
  127. package/hooks/features/export/serializers/csvSerializer.js +5 -5
  128. package/hooks/features/export/useGridCsvExport.js +23 -16
  129. package/hooks/features/export/useGridPrintExport.js +22 -0
  130. package/hooks/features/export/utils.d.ts +3 -1
  131. package/hooks/features/export/utils.js +13 -0
  132. package/hooks/features/filter/gridFilterState.d.ts +1 -2
  133. package/hooks/features/filter/gridFilterState.js +3 -1
  134. package/hooks/features/filter/gridFilterUtils.d.ts +8 -0
  135. package/hooks/features/filter/gridFilterUtils.js +84 -2
  136. package/hooks/features/filter/useGridFilter.js +32 -15
  137. package/hooks/features/focus/useGridFocus.d.ts +1 -1
  138. package/hooks/features/focus/useGridFocus.js +48 -42
  139. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -0
  140. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +43 -12
  141. package/hooks/features/pagination/useGridPage.js +3 -4
  142. package/hooks/features/pagination/useGridPageSize.js +2 -3
  143. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
  144. package/hooks/features/rows/gridRowsSelector.d.ts +2 -0
  145. package/hooks/features/rows/gridRowsSelector.js +2 -0
  146. package/hooks/features/rows/gridRowsState.d.ts +7 -7
  147. package/hooks/features/rows/gridRowsUtils.d.ts +2 -1
  148. package/hooks/features/rows/gridRowsUtils.js +25 -1
  149. package/hooks/features/rows/useGridRows.d.ts +2 -2
  150. package/hooks/features/rows/useGridRows.js +121 -61
  151. package/hooks/features/rows/useGridRowsMeta.js +6 -13
  152. package/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
  153. package/hooks/features/scroll/useGridScroll.d.ts +2 -0
  154. package/hooks/features/scroll/useGridScroll.js +31 -4
  155. package/hooks/features/selection/useGridSelection.d.ts +1 -1
  156. package/hooks/features/selection/useGridSelection.js +15 -11
  157. package/hooks/features/sorting/useGridSorting.js +17 -18
  158. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +9 -0
  159. package/hooks/features/virtualization/useGridVirtualScroller.js +68 -32
  160. package/hooks/utils/useGridApiEventHandler.d.ts +4 -1
  161. package/hooks/utils/useGridApiEventHandler.js +22 -9
  162. package/hooks/utils/useGridNativeEventListener.js +1 -2
  163. package/hooks/utils/useGridSelector.js +1 -1
  164. package/index.d.ts +2 -0
  165. package/index.js +1 -1
  166. package/internals/index.d.ts +5 -1
  167. package/internals/index.js +6 -2
  168. package/legacy/DataGrid/DataGrid.js +36 -2
  169. package/legacy/DataGrid/useDataGridComponent.js +3 -1
  170. package/legacy/DataGrid/useDataGridProps.js +2 -1
  171. package/legacy/colDef/gridActionsColDef.js +2 -1
  172. package/legacy/colDef/gridBooleanColDef.js +2 -1
  173. package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -0
  174. package/legacy/colDef/gridDateColDef.js +4 -2
  175. package/legacy/colDef/gridNumericColDef.js +3 -2
  176. package/legacy/colDef/gridNumericOperators.js +28 -18
  177. package/legacy/colDef/gridSingleSelectColDef.js +3 -2
  178. package/legacy/colDef/gridSingleSelectOperators.js +55 -6
  179. package/legacy/colDef/gridStringColDef.js +3 -2
  180. package/legacy/colDef/gridStringOperators.js +25 -14
  181. package/legacy/components/GridFooter.js +11 -2
  182. package/legacy/components/GridRow.js +56 -28
  183. package/legacy/components/GridRowCount.js +1 -0
  184. package/legacy/components/GridScrollArea.js +3 -4
  185. package/legacy/components/GridSelectedRowCount.js +2 -1
  186. package/legacy/components/base/GridBody.js +1 -2
  187. package/legacy/components/base/GridOverlays.js +5 -5
  188. package/legacy/components/cell/GridActionsCell.js +197 -27
  189. package/legacy/components/cell/GridActionsCellItem.js +7 -5
  190. package/legacy/components/cell/GridCell.js +37 -15
  191. package/legacy/components/cell/GridEditBooleanCell.js +132 -11
  192. package/legacy/components/cell/GridEditDateCell.js +148 -42
  193. package/legacy/components/cell/GridEditInputCell.js +62 -13
  194. package/legacy/components/cell/GridEditSingleSelectCell.js +65 -28
  195. package/legacy/components/cell/index.js +2 -0
  196. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +19 -23
  197. package/legacy/components/columnHeaders/GridColumnHeaders.js +2 -3
  198. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +23 -6
  199. package/legacy/components/columnSelection/GridHeaderCheckbox.js +4 -5
  200. package/legacy/components/containers/GridFooterContainer.js +11 -2
  201. package/legacy/components/containers/GridRootStyles.js +26 -5
  202. package/legacy/components/containers/GridToolbarContainer.js +12 -2
  203. package/legacy/components/menu/GridMenu.js +1 -0
  204. package/legacy/components/panel/GridPanel.js +1 -0
  205. package/legacy/components/panel/GridPanelContent.js +13 -2
  206. package/legacy/components/panel/GridPanelFooter.js +13 -2
  207. package/legacy/components/panel/GridPanelHeader.js +13 -2
  208. package/legacy/components/panel/filterPanel/GridFilterForm.js +14 -10
  209. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
  210. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -17
  211. package/legacy/components/panel/filterPanel/GridFilterInputValue.js +22 -17
  212. package/legacy/components/toolbar/GridToolbar.js +31 -6
  213. package/legacy/components/toolbar/GridToolbarDensitySelector.js +1 -1
  214. package/legacy/components/toolbar/GridToolbarExport.js +18 -19
  215. package/legacy/components/toolbar/GridToolbarQuickFilter.js +103 -0
  216. package/legacy/components/toolbar/index.js +3 -2
  217. package/legacy/components/virtualization/GridVirtualScroller.js +2 -0
  218. package/legacy/components/virtualization/GridVirtualScrollerContent.js +1 -3
  219. package/legacy/constants/defaultGridSlotsComponents.js +3 -2
  220. package/legacy/constants/gridClasses.js +1 -1
  221. package/legacy/constants/gridDetailPanelToggleField.js +2 -0
  222. package/legacy/constants/localeTextConstants.js +8 -1
  223. package/legacy/hooks/core/pipeProcessing/index.js +2 -1
  224. package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +60 -24
  225. package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
  226. package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
  227. package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
  228. package/legacy/hooks/core/useGridApiInitialization.js +3 -3
  229. package/legacy/hooks/core/useGridErrorHandler.js +1 -2
  230. package/legacy/hooks/core/useGridStateInitialization.js +1 -2
  231. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +94 -16
  232. package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
  233. package/legacy/hooks/features/columns/gridColumnsUtils.js +79 -22
  234. package/legacy/hooks/features/columns/useGridColumnSpanning.js +106 -0
  235. package/legacy/hooks/features/columns/useGridColumns.js +30 -25
  236. package/legacy/hooks/features/dimensions/useGridDimensions.js +10 -11
  237. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +225 -89
  238. package/legacy/hooks/features/editRows/useGridCellEditing.old.js +20 -21
  239. package/legacy/hooks/features/editRows/useGridEditing.new.js +7 -3
  240. package/legacy/hooks/features/editRows/useGridEditing.old.js +4 -5
  241. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +157 -65
  242. package/legacy/hooks/features/editRows/useGridRowEditing.old.js +20 -21
  243. package/legacy/hooks/features/events/useGridEvents.js +17 -18
  244. package/legacy/hooks/features/export/serializers/csvSerializer.js +5 -5
  245. package/legacy/hooks/features/export/useGridCsvExport.js +24 -17
  246. package/legacy/hooks/features/export/useGridPrintExport.js +22 -0
  247. package/legacy/hooks/features/export/utils.js +14 -0
  248. package/legacy/hooks/features/filter/gridFilterState.js +3 -1
  249. package/legacy/hooks/features/filter/gridFilterUtils.js +96 -2
  250. package/legacy/hooks/features/filter/useGridFilter.js +32 -15
  251. package/legacy/hooks/features/focus/useGridFocus.js +50 -44
  252. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +43 -11
  253. package/legacy/hooks/features/pagination/useGridPage.js +3 -4
  254. package/legacy/hooks/features/pagination/useGridPageSize.js +2 -3
  255. package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
  256. package/legacy/hooks/features/rows/gridRowsSelector.js +6 -0
  257. package/legacy/hooks/features/rows/gridRowsUtils.js +27 -1
  258. package/legacy/hooks/features/rows/useGridRows.js +131 -61
  259. package/legacy/hooks/features/rows/useGridRowsMeta.js +6 -13
  260. package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
  261. package/legacy/hooks/features/scroll/useGridScroll.js +31 -4
  262. package/legacy/hooks/features/selection/useGridSelection.js +15 -11
  263. package/legacy/hooks/features/sorting/useGridSorting.js +12 -15
  264. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +79 -42
  265. package/legacy/hooks/utils/useGridApiEventHandler.js +20 -9
  266. package/legacy/hooks/utils/useGridNativeEventListener.js +1 -2
  267. package/legacy/hooks/utils/useGridSelector.js +1 -1
  268. package/legacy/index.js +1 -1
  269. package/legacy/internals/index.js +6 -2
  270. package/legacy/locales/arSD.js +8 -1
  271. package/legacy/locales/bgBG.js +8 -1
  272. package/legacy/locales/csCZ.js +7 -0
  273. package/legacy/locales/daDK.js +8 -1
  274. package/legacy/locales/deDE.js +10 -3
  275. package/legacy/locales/elGR.js +7 -0
  276. package/legacy/locales/esES.js +7 -0
  277. package/legacy/locales/faIR.js +8 -1
  278. package/legacy/locales/fiFI.js +7 -0
  279. package/legacy/locales/frFR.js +7 -0
  280. package/legacy/locales/heIL.js +8 -1
  281. package/legacy/locales/huHU.js +127 -0
  282. package/legacy/locales/index.js +1 -0
  283. package/legacy/locales/itIT.js +7 -0
  284. package/legacy/locales/jaJP.js +7 -0
  285. package/legacy/locales/koKR.js +7 -0
  286. package/legacy/locales/nlNL.js +7 -0
  287. package/legacy/locales/plPL.js +8 -1
  288. package/legacy/locales/ptBR.js +8 -1
  289. package/legacy/locales/ruRU.js +7 -0
  290. package/legacy/locales/skSK.js +7 -0
  291. package/legacy/locales/trTR.js +8 -1
  292. package/legacy/locales/ukUA.js +7 -0
  293. package/legacy/locales/viVN.js +7 -0
  294. package/legacy/locales/zhCN.js +7 -0
  295. package/legacy/models/api/gridColumnSpanning.js +1 -0
  296. package/legacy/models/events/gridEvents.js +10 -3
  297. package/legacy/models/gridColumnSpanning.js +1 -0
  298. package/legacy/models/index.js +4 -3
  299. package/legacy/utils/createSelector.js +18 -2
  300. package/legacy/utils/exportAs.js +1 -1
  301. package/locales/arSD.js +8 -1
  302. package/locales/bgBG.js +8 -1
  303. package/locales/csCZ.js +7 -0
  304. package/locales/daDK.js +8 -1
  305. package/locales/deDE.js +10 -3
  306. package/locales/elGR.js +7 -0
  307. package/locales/esES.js +7 -0
  308. package/locales/faIR.js +8 -1
  309. package/locales/fiFI.js +7 -0
  310. package/locales/frFR.js +7 -0
  311. package/locales/heIL.js +8 -1
  312. package/locales/huHU.d.ts +2 -0
  313. package/locales/huHU.js +115 -0
  314. package/locales/index.d.ts +1 -0
  315. package/locales/index.js +1 -0
  316. package/locales/itIT.js +7 -0
  317. package/locales/jaJP.js +7 -0
  318. package/locales/koKR.js +7 -0
  319. package/locales/nlNL.js +7 -0
  320. package/locales/plPL.js +8 -1
  321. package/locales/ptBR.js +8 -1
  322. package/locales/ruRU.js +7 -0
  323. package/locales/skSK.js +7 -0
  324. package/locales/trTR.js +8 -1
  325. package/locales/ukUA.js +7 -0
  326. package/locales/viVN.js +7 -0
  327. package/locales/zhCN.js +7 -0
  328. package/models/api/gridApiCommon.d.ts +2 -1
  329. package/models/api/gridColumnSpanning.d.ts +28 -0
  330. package/models/api/gridColumnSpanning.js +1 -0
  331. package/models/api/gridCoreApi.d.ts +10 -0
  332. package/models/api/gridEditingApi.d.ts +72 -7
  333. package/models/api/gridFilterApi.d.ts +5 -0
  334. package/models/api/gridFocusApi.d.ts +1 -0
  335. package/models/api/gridLocaleTextApi.d.ts +5 -0
  336. package/models/api/gridRowApi.d.ts +34 -0
  337. package/models/api/index.d.ts +1 -1
  338. package/models/colDef/gridColDef.d.ts +18 -0
  339. package/models/events/gridEventLookup.d.ts +296 -11
  340. package/models/events/gridEvents.d.ts +10 -258
  341. package/models/events/gridEvents.js +10 -3
  342. package/models/gridColumnSpanning.d.ts +12 -0
  343. package/models/gridColumnSpanning.js +1 -0
  344. package/models/gridEditRowModel.d.ts +1 -1
  345. package/models/gridExport.d.ts +29 -2
  346. package/models/gridFilterModel.d.ts +11 -0
  347. package/models/gridFilterOperator.d.ts +1 -1
  348. package/models/gridIconSlotsComponent.d.ts +5 -0
  349. package/models/gridStateCommunity.d.ts +0 -2
  350. package/models/index.d.ts +1 -1
  351. package/models/index.js +4 -3
  352. package/models/params/gridCellParams.d.ts +12 -2
  353. package/models/params/gridRowParams.d.ts +5 -0
  354. package/models/props/DataGridProps.d.ts +57 -29
  355. package/modern/DataGrid/DataGrid.js +36 -2
  356. package/modern/DataGrid/useDataGridComponent.js +3 -1
  357. package/modern/DataGrid/useDataGridProps.js +2 -1
  358. package/modern/colDef/gridActionsColDef.js +2 -1
  359. package/modern/colDef/gridBooleanColDef.js +2 -1
  360. package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
  361. package/modern/colDef/gridDateColDef.js +4 -2
  362. package/modern/colDef/gridNumericColDef.js +3 -2
  363. package/modern/colDef/gridNumericOperators.js +11 -0
  364. package/modern/colDef/gridSingleSelectColDef.js +3 -2
  365. package/modern/colDef/gridSingleSelectOperators.js +52 -0
  366. package/modern/colDef/gridStringColDef.js +3 -2
  367. package/modern/colDef/gridStringOperators.js +12 -0
  368. package/modern/components/GridFooter.js +11 -2
  369. package/modern/components/GridRow.js +56 -26
  370. package/modern/components/GridRowCount.js +1 -0
  371. package/modern/components/GridScrollArea.js +3 -4
  372. package/modern/components/GridSelectedRowCount.js +2 -1
  373. package/modern/components/base/GridBody.js +1 -2
  374. package/modern/components/base/GridOverlays.js +5 -5
  375. package/modern/components/cell/GridActionsCell.js +179 -21
  376. package/modern/components/cell/GridActionsCellItem.js +7 -5
  377. package/modern/components/cell/GridCell.js +36 -15
  378. package/modern/components/cell/GridEditBooleanCell.js +101 -6
  379. package/modern/components/cell/GridEditDateCell.js +99 -5
  380. package/modern/components/cell/GridEditInputCell.js +30 -6
  381. package/modern/components/cell/GridEditSingleSelectCell.js +48 -16
  382. package/modern/components/cell/index.js +2 -0
  383. package/modern/components/columnHeaders/GridColumnHeaderItem.js +19 -23
  384. package/modern/components/columnHeaders/GridColumnHeaders.js +1 -1
  385. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +22 -6
  386. package/modern/components/columnSelection/GridHeaderCheckbox.js +4 -5
  387. package/modern/components/containers/GridFooterContainer.js +11 -2
  388. package/modern/components/containers/GridRootStyles.js +36 -1
  389. package/modern/components/containers/GridToolbarContainer.js +12 -2
  390. package/modern/components/menu/GridMenu.js +1 -0
  391. package/modern/components/panel/GridPanel.js +1 -0
  392. package/modern/components/panel/GridPanelContent.js +13 -2
  393. package/modern/components/panel/GridPanelFooter.js +13 -2
  394. package/modern/components/panel/GridPanelHeader.js +13 -2
  395. package/modern/components/panel/filterPanel/GridFilterForm.js +10 -6
  396. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +11 -6
  397. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +20 -13
  398. package/modern/components/panel/filterPanel/GridFilterInputValue.js +20 -13
  399. package/modern/components/toolbar/GridToolbar.js +30 -7
  400. package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -1
  401. package/modern/components/toolbar/GridToolbarExport.js +15 -20
  402. package/modern/components/toolbar/GridToolbarQuickFilter.js +86 -0
  403. package/modern/components/toolbar/index.js +3 -2
  404. package/modern/components/virtualization/GridVirtualScroller.js +2 -0
  405. package/modern/components/virtualization/GridVirtualScrollerContent.js +1 -3
  406. package/modern/constants/defaultGridSlotsComponents.js +3 -2
  407. package/modern/constants/gridClasses.js +1 -1
  408. package/modern/constants/gridDetailPanelToggleField.js +2 -0
  409. package/modern/constants/localeTextConstants.js +8 -1
  410. package/modern/hooks/core/pipeProcessing/index.js +2 -1
  411. package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
  412. package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
  413. package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
  414. package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
  415. package/modern/hooks/core/useGridApiInitialization.js +3 -3
  416. package/modern/hooks/core/useGridErrorHandler.js +1 -2
  417. package/modern/hooks/core/useGridStateInitialization.js +1 -2
  418. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +81 -16
  419. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
  420. package/modern/hooks/features/columns/gridColumnsUtils.js +61 -8
  421. package/modern/hooks/features/columns/useGridColumnSpanning.js +106 -0
  422. package/modern/hooks/features/columns/useGridColumns.js +30 -25
  423. package/modern/hooks/features/dimensions/useGridDimensions.js +10 -11
  424. package/modern/hooks/features/editRows/useGridCellEditing.new.js +149 -42
  425. package/modern/hooks/features/editRows/useGridCellEditing.old.js +20 -21
  426. package/modern/hooks/features/editRows/useGridEditing.new.js +7 -3
  427. package/modern/hooks/features/editRows/useGridEditing.old.js +4 -5
  428. package/modern/hooks/features/editRows/useGridRowEditing.new.js +143 -57
  429. package/modern/hooks/features/editRows/useGridRowEditing.old.js +21 -22
  430. package/modern/hooks/features/events/useGridEvents.js +17 -18
  431. package/modern/hooks/features/export/serializers/csvSerializer.js +5 -5
  432. package/modern/hooks/features/export/useGridCsvExport.js +21 -16
  433. package/modern/hooks/features/export/useGridPrintExport.js +20 -0
  434. package/modern/hooks/features/export/utils.js +13 -0
  435. package/modern/hooks/features/filter/gridFilterState.js +3 -1
  436. package/modern/hooks/features/filter/gridFilterUtils.js +80 -2
  437. package/modern/hooks/features/filter/useGridFilter.js +32 -15
  438. package/modern/hooks/features/focus/useGridFocus.js +48 -42
  439. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +41 -12
  440. package/modern/hooks/features/pagination/useGridPage.js +3 -4
  441. package/modern/hooks/features/pagination/useGridPageSize.js +2 -3
  442. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
  443. package/modern/hooks/features/rows/gridRowsSelector.js +2 -0
  444. package/modern/hooks/features/rows/gridRowsUtils.js +23 -1
  445. package/modern/hooks/features/rows/useGridRows.js +121 -61
  446. package/modern/hooks/features/rows/useGridRowsMeta.js +6 -13
  447. package/modern/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
  448. package/modern/hooks/features/scroll/useGridScroll.js +29 -4
  449. package/modern/hooks/features/selection/useGridSelection.js +15 -11
  450. package/modern/hooks/features/sorting/useGridSorting.js +17 -18
  451. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +68 -28
  452. package/modern/hooks/utils/useGridApiEventHandler.js +20 -9
  453. package/modern/hooks/utils/useGridNativeEventListener.js +1 -2
  454. package/modern/hooks/utils/useGridSelector.js +1 -1
  455. package/modern/index.js +1 -1
  456. package/modern/internals/index.js +6 -2
  457. package/modern/locales/arSD.js +8 -1
  458. package/modern/locales/bgBG.js +8 -1
  459. package/modern/locales/csCZ.js +7 -0
  460. package/modern/locales/daDK.js +8 -1
  461. package/modern/locales/deDE.js +10 -3
  462. package/modern/locales/elGR.js +7 -0
  463. package/modern/locales/esES.js +7 -0
  464. package/modern/locales/faIR.js +8 -1
  465. package/modern/locales/fiFI.js +7 -0
  466. package/modern/locales/frFR.js +7 -0
  467. package/modern/locales/heIL.js +8 -1
  468. package/modern/locales/huHU.js +115 -0
  469. package/modern/locales/index.js +1 -0
  470. package/modern/locales/itIT.js +7 -0
  471. package/modern/locales/jaJP.js +7 -0
  472. package/modern/locales/koKR.js +7 -0
  473. package/modern/locales/nlNL.js +7 -0
  474. package/modern/locales/plPL.js +8 -1
  475. package/modern/locales/ptBR.js +8 -1
  476. package/modern/locales/ruRU.js +7 -0
  477. package/modern/locales/skSK.js +7 -0
  478. package/modern/locales/trTR.js +8 -1
  479. package/modern/locales/ukUA.js +7 -0
  480. package/modern/locales/viVN.js +7 -0
  481. package/modern/locales/zhCN.js +7 -0
  482. package/modern/models/api/gridColumnSpanning.js +1 -0
  483. package/modern/models/events/gridEvents.js +10 -3
  484. package/modern/models/gridColumnSpanning.js +1 -0
  485. package/modern/models/index.js +4 -3
  486. package/modern/utils/createSelector.js +20 -2
  487. package/modern/utils/exportAs.js +1 -1
  488. package/node/DataGrid/DataGrid.js +36 -2
  489. package/node/DataGrid/useDataGridComponent.js +4 -1
  490. package/node/DataGrid/useDataGridProps.js +2 -1
  491. package/node/colDef/gridActionsColDef.js +2 -1
  492. package/node/colDef/gridBooleanColDef.js +2 -1
  493. package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
  494. package/node/colDef/gridDateColDef.js +4 -2
  495. package/node/colDef/gridNumericColDef.js +2 -1
  496. package/node/colDef/gridNumericOperators.js +15 -1
  497. package/node/colDef/gridSingleSelectColDef.js +2 -1
  498. package/node/colDef/gridSingleSelectOperators.js +56 -1
  499. package/node/colDef/gridStringColDef.js +2 -1
  500. package/node/colDef/gridStringOperators.js +16 -1
  501. package/node/components/GridFooter.js +10 -1
  502. package/node/components/GridRow.js +59 -29
  503. package/node/components/GridRowCount.js +1 -0
  504. package/node/components/GridScrollArea.js +3 -5
  505. package/node/components/GridSelectedRowCount.js +2 -1
  506. package/node/components/base/GridBody.js +1 -3
  507. package/node/components/base/GridOverlays.js +4 -5
  508. package/node/components/cell/GridActionsCell.js +181 -21
  509. package/node/components/cell/GridActionsCellItem.js +7 -4
  510. package/node/components/cell/GridCell.js +35 -14
  511. package/node/components/cell/GridEditBooleanCell.js +100 -5
  512. package/node/components/cell/GridEditDateCell.js +98 -4
  513. package/node/components/cell/GridEditInputCell.js +30 -6
  514. package/node/components/cell/GridEditSingleSelectCell.js +50 -18
  515. package/node/components/cell/index.js +26 -0
  516. package/node/components/columnHeaders/GridColumnHeaderItem.js +19 -24
  517. package/node/components/columnHeaders/GridColumnHeaders.js +1 -1
  518. package/node/components/columnSelection/GridCellCheckboxRenderer.js +22 -7
  519. package/node/components/columnSelection/GridHeaderCheckbox.js +4 -6
  520. package/node/components/containers/GridFooterContainer.js +10 -1
  521. package/node/components/containers/GridRootStyles.js +36 -1
  522. package/node/components/containers/GridToolbarContainer.js +11 -1
  523. package/node/components/menu/GridMenu.js +1 -0
  524. package/node/components/panel/GridPanel.js +1 -0
  525. package/node/components/panel/GridPanelContent.js +11 -1
  526. package/node/components/panel/GridPanelFooter.js +11 -1
  527. package/node/components/panel/GridPanelHeader.js +11 -1
  528. package/node/components/panel/filterPanel/GridFilterForm.js +15 -10
  529. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +14 -8
  530. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +23 -15
  531. package/node/components/panel/filterPanel/GridFilterInputValue.js +23 -15
  532. package/node/components/toolbar/GridToolbar.js +32 -7
  533. package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
  534. package/node/components/toolbar/GridToolbarExport.js +14 -19
  535. package/node/components/toolbar/GridToolbarQuickFilter.js +111 -0
  536. package/node/components/toolbar/index.js +42 -11
  537. package/node/components/virtualization/GridVirtualScroller.js +2 -0
  538. package/node/components/virtualization/GridVirtualScrollerContent.js +1 -3
  539. package/node/constants/defaultGridSlotsComponents.js +2 -1
  540. package/node/constants/gridClasses.js +1 -1
  541. package/node/constants/gridDetailPanelToggleField.js +9 -0
  542. package/node/constants/localeTextConstants.js +8 -1
  543. package/node/hooks/core/pipeProcessing/index.js +13 -0
  544. package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +51 -20
  545. package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +42 -0
  546. package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -3
  547. package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -8
  548. package/node/hooks/core/useGridApiInitialization.js +3 -4
  549. package/node/hooks/core/useGridErrorHandler.js +1 -3
  550. package/node/hooks/core/useGridStateInitialization.js +1 -3
  551. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +85 -17
  552. package/node/hooks/features/columnMenu/useGridColumnMenu.js +3 -4
  553. package/node/hooks/features/columns/gridColumnsUtils.js +65 -9
  554. package/node/hooks/features/columns/useGridColumnSpanning.js +128 -0
  555. package/node/hooks/features/columns/useGridColumns.js +29 -25
  556. package/node/hooks/features/dimensions/useGridDimensions.js +10 -12
  557. package/node/hooks/features/editRows/useGridCellEditing.new.js +151 -42
  558. package/node/hooks/features/editRows/useGridCellEditing.old.js +20 -22
  559. package/node/hooks/features/editRows/useGridEditing.new.js +6 -2
  560. package/node/hooks/features/editRows/useGridEditing.old.js +4 -6
  561. package/node/hooks/features/editRows/useGridRowEditing.new.js +143 -57
  562. package/node/hooks/features/editRows/useGridRowEditing.old.js +21 -23
  563. package/node/hooks/features/events/useGridEvents.js +17 -19
  564. package/node/hooks/features/export/serializers/csvSerializer.js +5 -5
  565. package/node/hooks/features/export/useGridCsvExport.js +26 -17
  566. package/node/hooks/features/export/useGridPrintExport.js +25 -0
  567. package/node/hooks/features/export/utils.js +19 -2
  568. package/node/hooks/features/filter/gridFilterState.js +3 -1
  569. package/node/hooks/features/filter/gridFilterUtils.js +92 -3
  570. package/node/hooks/features/filter/useGridFilter.js +33 -16
  571. package/node/hooks/features/focus/useGridFocus.js +48 -43
  572. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +44 -13
  573. package/node/hooks/features/pagination/useGridPage.js +3 -5
  574. package/node/hooks/features/pagination/useGridPageSize.js +2 -4
  575. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -8
  576. package/node/hooks/features/rows/gridRowsSelector.js +5 -1
  577. package/node/hooks/features/rows/gridRowsUtils.js +29 -1
  578. package/node/hooks/features/rows/useGridRows.js +122 -61
  579. package/node/hooks/features/rows/useGridRowsMeta.js +6 -14
  580. package/node/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
  581. package/node/hooks/features/scroll/useGridScroll.js +32 -3
  582. package/node/hooks/features/selection/useGridSelection.js +16 -12
  583. package/node/hooks/features/sorting/useGridSorting.js +17 -19
  584. package/node/hooks/features/virtualization/useGridVirtualScroller.js +73 -33
  585. package/node/hooks/utils/useGridApiEventHandler.js +22 -10
  586. package/node/hooks/utils/useGridNativeEventListener.js +1 -3
  587. package/node/hooks/utils/useGridSelector.js +1 -1
  588. package/node/index.js +1 -1
  589. package/node/internals/index.js +47 -3
  590. package/node/locales/arSD.js +8 -1
  591. package/node/locales/bgBG.js +8 -1
  592. package/node/locales/csCZ.js +7 -0
  593. package/node/locales/daDK.js +8 -1
  594. package/node/locales/deDE.js +10 -3
  595. package/node/locales/elGR.js +7 -0
  596. package/node/locales/esES.js +7 -0
  597. package/node/locales/faIR.js +8 -1
  598. package/node/locales/fiFI.js +7 -0
  599. package/node/locales/frFR.js +7 -0
  600. package/node/locales/heIL.js +8 -1
  601. package/node/locales/huHU.js +125 -0
  602. package/node/locales/index.js +13 -0
  603. package/node/locales/itIT.js +7 -0
  604. package/node/locales/jaJP.js +7 -0
  605. package/node/locales/koKR.js +7 -0
  606. package/node/locales/nlNL.js +7 -0
  607. package/node/locales/plPL.js +8 -1
  608. package/node/locales/ptBR.js +8 -1
  609. package/node/locales/ruRU.js +7 -0
  610. package/node/locales/skSK.js +7 -0
  611. package/node/locales/trTR.js +8 -1
  612. package/node/locales/ukUA.js +7 -0
  613. package/node/locales/viVN.js +7 -0
  614. package/node/locales/zhCN.js +7 -0
  615. package/node/models/api/gridColumnSpanning.js +5 -0
  616. package/node/models/events/gridEvents.js +10 -3
  617. package/node/models/gridColumnSpanning.js +5 -0
  618. package/node/models/index.js +0 -13
  619. package/node/utils/createSelector.js +25 -4
  620. package/node/utils/exportAs.js +1 -1
  621. package/package.json +4 -4
  622. package/utils/createSelector.d.ts +2 -1
  623. package/utils/createSelector.js +20 -2
  624. package/utils/domUtils.d.ts +2 -2
  625. package/utils/exportAs.d.ts +2 -2
  626. package/utils/exportAs.js +1 -1
@@ -9,6 +9,8 @@ exports.renderActionsCell = exports.GridActionsCell = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
+
12
14
  var React = _interopRequireWildcard(require("react"));
13
15
 
14
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -25,8 +27,12 @@ var _GridMenu = require("../menu/GridMenu");
25
27
 
26
28
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
27
29
 
30
+ var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
31
+
28
32
  var _jsxRuntime = require("react/jsx-runtime");
29
33
 
34
+ const _excluded = ["colDef", "id", "api", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "getValue", "tabIndex", "position", "focusElementRef"];
35
+
30
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
37
 
32
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -34,20 +40,25 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
34
40
  const hasActions = colDef => typeof colDef.getActions === 'function';
35
41
 
36
42
  const GridActionsCell = props => {
43
+ const {
44
+ colDef,
45
+ id,
46
+ hasFocus,
47
+ tabIndex,
48
+ position = 'bottom-end',
49
+ focusElementRef
50
+ } = props,
51
+ other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
52
+ const [focusedButtonIndex, setFocusedButtonIndex] = React.useState(-1);
37
53
  const [open, setOpen] = React.useState(false);
54
+ const apiRef = (0, _useGridApiContext.useGridApiContext)();
55
+ const rootRef = React.useRef(null);
38
56
  const buttonRef = React.useRef(null);
57
+ const ignoreCallToFocus = React.useRef(false);
39
58
  const touchRippleRefs = React.useRef({});
40
59
  const menuId = (0, _utils.unstable_useId)();
41
60
  const buttonId = (0, _utils.unstable_useId)();
42
61
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
43
- const {
44
- colDef,
45
- id,
46
- api,
47
- hasFocus,
48
- position = 'bottom-end'
49
- } = props; // TODO apply the rest to the root element
50
-
51
62
  React.useLayoutEffect(() => {
52
63
  if (!hasFocus) {
53
64
  Object.entries(touchRippleRefs.current).forEach(([index, ref]) => {
@@ -57,56 +68,153 @@ const GridActionsCell = props => {
57
68
  });
58
69
  }
59
70
  }, [hasFocus]);
71
+ React.useEffect(() => {
72
+ if (focusedButtonIndex < 0 || !rootRef.current) {
73
+ return;
74
+ }
75
+
76
+ if (focusedButtonIndex >= rootRef.current.children.length) {
77
+ return;
78
+ }
79
+
80
+ const child = rootRef.current.children[focusedButtonIndex];
81
+ child.focus();
82
+ }, [focusedButtonIndex]);
83
+ React.useEffect(() => {
84
+ if (!hasFocus) {
85
+ setFocusedButtonIndex(-1);
86
+ ignoreCallToFocus.current = false;
87
+ }
88
+ }, [hasFocus]);
89
+ React.useImperativeHandle(focusElementRef, () => ({
90
+ focus() {
91
+ // If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
92
+ if (!ignoreCallToFocus.current) {
93
+ setFocusedButtonIndex(0);
94
+ }
95
+ }
96
+
97
+ }), []);
60
98
 
61
99
  if (!hasActions(colDef)) {
62
100
  throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
63
101
  }
64
102
 
65
- const showMenu = () => setOpen(true);
66
-
67
- const hideMenu = () => setOpen(false);
68
-
69
- const options = colDef.getActions(api.getRowParams(id));
103
+ const options = colDef.getActions(apiRef.current.getRowParams(id));
70
104
  const iconButtons = options.filter(option => !option.props.showInMenu);
71
105
  const menuButtons = options.filter(option => option.props.showInMenu);
106
+ const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
107
+ React.useEffect(() => {
108
+ if (focusedButtonIndex >= numberOfButtons) {
109
+ setFocusedButtonIndex(numberOfButtons - 1);
110
+ }
111
+ }, [focusedButtonIndex, numberOfButtons]);
112
+
113
+ const showMenu = () => {
114
+ setOpen(true);
115
+ setFocusedButtonIndex(numberOfButtons - 1);
116
+ ignoreCallToFocus.current = true;
117
+ };
118
+
119
+ const hideMenu = () => {
120
+ setOpen(false);
121
+ };
72
122
 
73
123
  const handleTouchRippleRef = index => instance => {
74
124
  touchRippleRefs.current[index] = instance;
75
125
  };
76
126
 
77
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
127
+ const handleButtonClick = (index, onClick) => event => {
128
+ setFocusedButtonIndex(index);
129
+ ignoreCallToFocus.current = true;
130
+
131
+ if (onClick) {
132
+ onClick(event);
133
+ }
134
+ };
135
+
136
+ const handleRootKeyDown = event => {
137
+ if (numberOfButtons <= 1) {
138
+ return;
139
+ }
140
+
141
+ let newIndex = focusedButtonIndex;
142
+
143
+ if (event.key === 'ArrowRight') {
144
+ newIndex += 1;
145
+ } else if (event.key === 'ArrowLeft') {
146
+ newIndex -= 1;
147
+ }
148
+
149
+ if (newIndex < 0 || newIndex >= numberOfButtons) {
150
+ return; // We're already in the first or last item = do nothing and let the grid listen the event
151
+ }
152
+
153
+ if (newIndex !== focusedButtonIndex) {
154
+ event.preventDefault(); // Prevent scrolling
155
+
156
+ event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
157
+
158
+ setFocusedButtonIndex(newIndex);
159
+ }
160
+ };
161
+
162
+ const handleListKeyDown = event => {
163
+ if (event.key === 'Tab') {
164
+ event.preventDefault();
165
+ }
166
+
167
+ if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
168
+ hideMenu();
169
+ }
170
+ };
171
+
172
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
173
+ role: "menu",
174
+ ref: rootRef,
175
+ tabIndex: -1,
78
176
  className: _gridClasses.gridClasses.actionsCell,
177
+ onKeyDown: handleRootKeyDown
178
+ }, other, {
79
179
  children: [iconButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
80
180
  key: index,
81
- touchRippleRef: handleTouchRippleRef(index)
82
- })), menuButtons.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
181
+ touchRippleRef: handleTouchRippleRef(index),
182
+ onClick: handleButtonClick(index, button.props.onClick),
183
+ tabIndex: focusedButtonIndex === index ? tabIndex : -1
184
+ })), menuButtons.length > 0 && buttonId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
83
185
  ref: buttonRef,
84
186
  id: buttonId,
85
- "aria-label": api.getLocaleText('actionsCellMore'),
187
+ "aria-label": apiRef.current.getLocaleText('actionsCellMore'),
86
188
  "aria-controls": menuId,
87
189
  "aria-expanded": open ? 'true' : undefined,
88
190
  "aria-haspopup": "true",
191
+ role: "menuitem",
89
192
  size: "small",
90
193
  onClick: showMenu,
194
+ touchRippleRef: handleTouchRippleRef(buttonId),
195
+ tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1,
91
196
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.MoreActionsIcon, {
92
197
  fontSize: "small"
93
198
  })
94
199
  }), menuButtons.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridMenu.GridMenu, {
95
- id: menuId,
96
200
  onClickAway: hideMenu,
97
201
  onClick: hideMenu,
98
202
  open: open,
99
203
  target: buttonRef.current,
100
204
  position: position,
101
- "aria-labelledby": buttonId,
102
205
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuList.default, {
206
+ id: menuId,
103
207
  className: _gridClasses.gridClasses.menuList,
208
+ onKeyDown: handleListKeyDown,
209
+ "aria-labelledby": buttonId,
210
+ variant: "menu",
211
+ autoFocusItem: true,
104
212
  children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
105
213
  key: index
106
214
  }))
107
215
  })
108
216
  })]
109
- });
217
+ }));
110
218
  };
111
219
 
112
220
  exports.GridActionsCell = GridActionsCell;
@@ -122,11 +230,42 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
122
230
  */
123
231
  api: _propTypes.default.any.isRequired,
124
232
 
233
+ /**
234
+ * The mode of the cell.
235
+ */
236
+ cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
237
+
125
238
  /**
126
239
  * The column of the row that the current cell belongs to.
127
240
  */
128
241
  colDef: _propTypes.default.object.isRequired,
129
242
 
243
+ /**
244
+ * The column field of the cell that triggered the event.
245
+ */
246
+ field: _propTypes.default.string.isRequired,
247
+
248
+ /**
249
+ * A ref allowing to set imperative focus.
250
+ * It can be passed to the element that should receive focus.
251
+ * @ignore - do not document.
252
+ */
253
+ focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
254
+ current: _propTypes.default.shape({
255
+ focus: _propTypes.default.func.isRequired
256
+ })
257
+ })]),
258
+ formattedValue: _propTypes.default.any,
259
+
260
+ /**
261
+ * Get the cell value of a row and field.
262
+ * @param {GridRowId} id The row id.
263
+ * @param {string} field The field.
264
+ * @returns {any} The cell value.
265
+ * @deprecated Use `params.row` to directly access the fields you want instead.
266
+ */
267
+ getValue: _propTypes.default.func.isRequired,
268
+
130
269
  /**
131
270
  * If true, the cell is the active element.
132
271
  */
@@ -136,7 +275,28 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
136
275
  * The grid row id.
137
276
  */
138
277
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
139
- position: _propTypes.default.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top'])
278
+
279
+ /**
280
+ * If true, the cell is editable.
281
+ */
282
+ isEditable: _propTypes.default.bool,
283
+ position: _propTypes.default.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
284
+
285
+ /**
286
+ * The row model of the row that the current cell belongs to.
287
+ */
288
+ row: _propTypes.default.object.isRequired,
289
+
290
+ /**
291
+ * The node of the row that the current cell belongs to.
292
+ */
293
+ rowNode: _propTypes.default.object.isRequired,
294
+
295
+ /**
296
+ * the tabIndex value.
297
+ */
298
+ tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
299
+ value: _propTypes.default.any
140
300
  } : void 0;
141
301
 
142
302
  const renderActionsCell = params => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridActionsCell, (0, _extends2.default)({}, params));
@@ -29,7 +29,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
29
29
 
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
31
 
32
- const GridActionsCellItem = props => {
32
+ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
33
33
  const {
34
34
  label,
35
35
  icon,
@@ -46,7 +46,9 @@ const GridActionsCellItem = props => {
46
46
 
47
47
  if (!showInMenu) {
48
48
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, (0, _extends2.default)({
49
+ ref: ref,
49
50
  size: "small",
51
+ role: "menuitem",
50
52
  "aria-label": label
51
53
  }, other, {
52
54
  onClick: handleClick,
@@ -56,14 +58,15 @@ const GridActionsCellItem = props => {
56
58
  }));
57
59
  }
58
60
 
59
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, (0, _extends2.default)({}, other, {
61
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, (0, _extends2.default)({
62
+ ref: ref
63
+ }, other, {
60
64
  onClick: onClick,
61
65
  children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
62
66
  children: icon
63
67
  }), label]
64
68
  }));
65
- };
66
-
69
+ });
67
70
  exports.GridActionsCellItem = GridActionsCellItem;
68
71
  process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
69
72
  // ----------------------------- Warning --------------------------------
@@ -33,7 +33,7 @@ var _gridFocusStateSelector = require("../../hooks/features/focus/gridFocusState
33
33
 
34
34
  var _jsxRuntime = require("react/jsx-runtime");
35
35
 
36
- const _excluded = ["align", "children", "colIndex", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
36
+ const _excluded = ["align", "children", "colIndex", "colDef", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
37
37
 
38
38
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
39
 
@@ -91,6 +91,7 @@ function GridCell(props) {
91
91
  width,
92
92
  className,
93
93
  showRightBorder,
94
+ colSpan,
94
95
  onClick,
95
96
  onDoubleClick,
96
97
  onMouseDown,
@@ -102,6 +103,7 @@ function GridCell(props) {
102
103
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
103
104
  const valueToRender = formattedValue == null ? value : formattedValue;
104
105
  const cellRef = React.useRef(null);
106
+ const focusElementRef = React.useRef(null);
105
107
  const apiRef = (0, _useGridApiContext.useGridApiContext)();
106
108
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
107
109
  const ownerState = {
@@ -152,7 +154,7 @@ function GridCell(props) {
152
154
 
153
155
  if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
154
156
  const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
155
- const elementToFocus = focusableElement || cellRef.current;
157
+ const elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
156
158
 
157
159
  if (doesSupportPreventScroll()) {
158
160
  elementToFocus.focus({
@@ -186,6 +188,26 @@ function GridCell(props) {
186
188
  };
187
189
  }
188
190
 
191
+ const column = apiRef.current.getColumn(field);
192
+ const managesOwnFocus = column.type === 'actions';
193
+
194
+ const renderChildren = () => {
195
+ if (children == null) {
196
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
197
+ className: classes.content,
198
+ children: valueToRender == null ? void 0 : valueToRender.toString()
199
+ });
200
+ }
201
+
202
+ if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
203
+ return /*#__PURE__*/React.cloneElement(children, {
204
+ focusElementRef
205
+ });
206
+ }
207
+
208
+ return children;
209
+ };
210
+
189
211
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _extends2.default)({
190
212
  ref: cellRef,
191
213
  className: (0, _clsx.default)(className, classes.root),
@@ -193,21 +215,19 @@ function GridCell(props) {
193
215
  "data-field": field,
194
216
  "data-colindex": colIndex,
195
217
  "aria-colindex": colIndex + 1,
218
+ "aria-colspan": colSpan,
196
219
  style: style,
197
- tabIndex: cellMode === 'view' || !isEditable ? tabIndex : -1,
198
- onClick: publish(_models.GridEvents.cellClick, onClick),
199
- onDoubleClick: publish(_models.GridEvents.cellDoubleClick, onDoubleClick),
200
- onMouseDown: publish(_models.GridEvents.cellMouseDown, onMouseDown),
201
- onMouseUp: publishMouseUp(_models.GridEvents.cellMouseUp),
202
- onKeyDown: publish(_models.GridEvents.cellKeyDown, onKeyDown),
203
- onDragEnter: publish(_models.GridEvents.cellDragEnter, onDragEnter),
204
- onDragOver: publish(_models.GridEvents.cellDragOver, onDragOver)
220
+ tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
221
+ onClick: publish('cellClick', onClick),
222
+ onDoubleClick: publish('cellDoubleClick', onDoubleClick),
223
+ onMouseDown: publish('cellMouseDown', onMouseDown),
224
+ onMouseUp: publishMouseUp('cellMouseUp'),
225
+ onKeyDown: publish('cellKeyDown', onKeyDown),
226
+ onDragEnter: publish('cellDragEnter', onDragEnter),
227
+ onDragOver: publish('cellDragOver', onDragOver)
205
228
  }, other, {
206
229
  onFocus: handleFocus,
207
- children: children != null ? children : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
208
- className: classes.content,
209
- children: valueToRender == null ? void 0 : valueToRender.toString()
210
- })
230
+ children: renderChildren()
211
231
  }));
212
232
  }
213
233
 
@@ -221,6 +241,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
221
241
  children: _propTypes.default.node,
222
242
  className: _propTypes.default.string,
223
243
  colIndex: _propTypes.default.number.isRequired,
244
+ colSpan: _propTypes.default.number,
224
245
  field: _propTypes.default.string.isRequired,
225
246
  formattedValue: _propTypes.default.any,
226
247
  hasFocus: _propTypes.default.bool,
@@ -14,6 +14,8 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
14
14
 
15
15
  var React = _interopRequireWildcard(require("react"));
16
16
 
17
+ var _propTypes = _interopRequireDefault(require("prop-types"));
18
+
17
19
  var _clsx = _interopRequireDefault(require("clsx"));
18
20
 
19
21
  var _material = require("@mui/material");
@@ -26,7 +28,7 @@ var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
26
28
 
27
29
  var _jsxRuntime = require("react/jsx-runtime");
28
30
 
29
- const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "getValue", "hasFocus", "isValidating", "isProcessingProps", "error"];
31
+ const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "getValue", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange"];
30
32
 
31
33
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
34
 
@@ -51,7 +53,8 @@ function GridEditBooleanCell(props) {
51
53
  api,
52
54
  field,
53
55
  className,
54
- hasFocus
56
+ hasFocus,
57
+ onValueChange
55
58
  } = props,
56
59
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
57
60
  const inputRef = React.useRef(null);
@@ -62,15 +65,20 @@ function GridEditBooleanCell(props) {
62
65
  classes: rootProps.classes
63
66
  };
64
67
  const classes = useUtilityClasses(ownerState);
65
- const handleChange = React.useCallback(event => {
68
+ const handleChange = React.useCallback(async event => {
66
69
  const newValue = event.target.checked;
70
+
71
+ if (onValueChange) {
72
+ await onValueChange(event, newValue);
73
+ }
74
+
67
75
  setValueState(newValue);
68
- api.setEditCellValue({
76
+ await api.setEditCellValue({
69
77
  id: idProp,
70
78
  field,
71
79
  value: newValue
72
80
  }, event);
73
- }, [api, field, idProp]);
81
+ }, [api, field, idProp, onValueChange]);
74
82
  React.useEffect(() => {
75
83
  setValueState(value);
76
84
  }, [value]);
@@ -93,6 +101,93 @@ function GridEditBooleanCell(props) {
93
101
  }));
94
102
  }
95
103
 
104
+ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
105
+ // ----------------------------- Warning --------------------------------
106
+ // | These PropTypes are generated from the TypeScript type definitions |
107
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
108
+ // ----------------------------------------------------------------------
109
+
110
+ /**
111
+ * GridApi that let you manipulate the grid.
112
+ * @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
113
+ */
114
+ api: _propTypes.default.any.isRequired,
115
+
116
+ /**
117
+ * The mode of the cell.
118
+ */
119
+ cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
120
+
121
+ /**
122
+ * The column of the row that the current cell belongs to.
123
+ */
124
+ colDef: _propTypes.default.object.isRequired,
125
+
126
+ /**
127
+ * The column field of the cell that triggered the event.
128
+ */
129
+ field: _propTypes.default.string.isRequired,
130
+
131
+ /**
132
+ * The cell value formatted with the column valueFormatter.
133
+ */
134
+ formattedValue: _propTypes.default.any,
135
+
136
+ /**
137
+ * Get the cell value of a row and field.
138
+ * @param {GridRowId} id The row id.
139
+ * @param {string} field The field.
140
+ * @returns {any} The cell value.
141
+ * @deprecated Use `params.row` to directly access the fields you want instead.
142
+ */
143
+ getValue: _propTypes.default.func.isRequired,
144
+
145
+ /**
146
+ * If true, the cell is the active element.
147
+ */
148
+ hasFocus: _propTypes.default.bool.isRequired,
149
+
150
+ /**
151
+ * The grid row id.
152
+ */
153
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
154
+
155
+ /**
156
+ * If true, the cell is editable.
157
+ */
158
+ isEditable: _propTypes.default.bool,
159
+ isProcessingProps: _propTypes.default.bool,
160
+ isValidating: _propTypes.default.bool,
161
+
162
+ /**
163
+ * Callback called when the value is changed by the user.
164
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
165
+ * @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
166
+ * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
167
+ */
168
+ onValueChange: _propTypes.default.func,
169
+
170
+ /**
171
+ * The row model of the row that the current cell belongs to.
172
+ */
173
+ row: _propTypes.default.object.isRequired,
174
+
175
+ /**
176
+ * The node of the row that the current cell belongs to.
177
+ */
178
+ rowNode: _propTypes.default.object.isRequired,
179
+
180
+ /**
181
+ * the tabIndex value.
182
+ */
183
+ tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
184
+
185
+ /**
186
+ * The cell value, but if the column has valueGetter, use getValue.
187
+ */
188
+ value: _propTypes.default.any
189
+ } : void 0;
190
+
96
191
  const renderEditBooleanCell = params => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridEditBooleanCell, (0, _extends2.default)({}, params));
97
192
 
98
193
  exports.renderEditBooleanCell = renderEditBooleanCell;