@mui/x-data-grid 5.11.1 → 5.12.2

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 (331) hide show
  1. package/CHANGELOG.md +199 -20
  2. package/DataGrid/DataGrid.js +26 -1
  3. package/README.md +2 -2
  4. package/colDef/gridCheckboxSelectionColDef.d.ts +1 -0
  5. package/colDef/gridCheckboxSelectionColDef.js +2 -1
  6. package/colDef/gridDateOperators.d.ts +1 -1
  7. package/colDef/gridNumericColDef.js +1 -1
  8. package/components/GridRow.d.ts +1 -1
  9. package/components/GridRow.js +51 -12
  10. package/components/cell/GridActionsCellItem.d.ts +1 -1
  11. package/components/cell/GridCell.d.ts +2 -1
  12. package/components/cell/GridCell.js +12 -7
  13. package/components/columnHeaders/GridColumnHeaderItem.js +9 -6
  14. package/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
  15. package/components/columnSelection/GridHeaderCheckbox.js +0 -1
  16. package/components/containers/GridRootStyles.js +8 -3
  17. package/components/menu/GridMenu.js +9 -2
  18. package/components/panel/GridColumnsPanel.js +12 -7
  19. package/components/panel/GridPanelWrapper.d.ts +1 -1
  20. package/components/panel/GridPanelWrapper.js +3 -3
  21. package/components/panel/filterPanel/GridFilterForm.d.ts +61 -4
  22. package/components/panel/filterPanel/GridFilterForm.js +88 -8
  23. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  24. package/components/panel/filterPanel/GridFilterPanel.d.ts +8 -5
  25. package/components/panel/filterPanel/GridFilterPanel.js +26 -11
  26. package/components/toolbar/GridToolbarColumnsButton.js +0 -1
  27. package/components/toolbar/GridToolbarDensitySelector.js +0 -1
  28. package/components/toolbar/GridToolbarExportContainer.js +0 -1
  29. package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
  30. package/components/toolbar/GridToolbarFilterButton.js +0 -1
  31. package/components/toolbar/GridToolbarQuickFilter.d.ts +7 -0
  32. package/components/toolbar/GridToolbarQuickFilter.js +57 -4
  33. package/constants/defaultGridSlotsComponents.js +2 -1
  34. package/constants/gridClasses.d.ts +4 -0
  35. package/constants/gridClasses.js +1 -1
  36. package/constants/localeTextConstants.js +1 -0
  37. package/hooks/core/useGridStateInitialization.js +19 -6
  38. package/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
  39. package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -0
  40. package/hooks/features/columns/useGridColumnSpanning.d.ts +1 -1
  41. package/hooks/features/columns/useGridColumnSpanning.js +1 -1
  42. package/hooks/features/columns/useGridColumns.d.ts +1 -1
  43. package/hooks/features/columns/useGridColumns.js +13 -15
  44. package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
  45. package/hooks/features/dimensions/useGridDimensions.js +9 -8
  46. package/hooks/features/editRows/useGridCellEditing.new.js +11 -4
  47. package/hooks/features/editRows/useGridEditing.old.js +1 -1
  48. package/hooks/features/editRows/useGridRowEditing.new.js +10 -4
  49. package/hooks/features/events/useGridEvents.d.ts +1 -1
  50. package/hooks/features/events/useGridEvents.js +2 -0
  51. package/hooks/features/filter/gridFilterSelector.d.ts +5 -0
  52. package/hooks/features/filter/gridFilterSelector.js +6 -0
  53. package/hooks/features/filter/gridFilterState.d.ts +1 -1
  54. package/hooks/features/filter/gridFilterUtils.d.ts +10 -2
  55. package/hooks/features/filter/gridFilterUtils.js +3 -6
  56. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  57. package/hooks/features/filter/useGridFilter.js +29 -12
  58. package/hooks/features/pagination/useGridPage.js +1 -1
  59. package/hooks/features/pagination/useGridPageSize.js +1 -1
  60. package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
  61. package/hooks/features/rows/useGridRowsMeta.js +133 -67
  62. package/hooks/features/selection/useGridSelection.js +1 -1
  63. package/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
  64. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  65. package/hooks/features/sorting/useGridSorting.js +1 -1
  66. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -1
  67. package/hooks/features/virtualization/useGridVirtualScroller.js +65 -11
  68. package/index.js +1 -1
  69. package/internals/index.d.ts +1 -0
  70. package/legacy/DataGrid/DataGrid.js +26 -1
  71. package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -1
  72. package/legacy/colDef/gridNumericColDef.js +1 -1
  73. package/legacy/components/GridRow.js +56 -12
  74. package/legacy/components/cell/GridCell.js +12 -7
  75. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +11 -6
  76. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
  77. package/legacy/components/columnSelection/GridHeaderCheckbox.js +0 -1
  78. package/legacy/components/containers/GridRootStyles.js +10 -7
  79. package/legacy/components/menu/GridMenu.js +9 -2
  80. package/legacy/components/panel/GridColumnsPanel.js +14 -7
  81. package/legacy/components/panel/GridPanelWrapper.js +3 -3
  82. package/legacy/components/panel/filterPanel/GridFilterForm.js +89 -8
  83. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  84. package/legacy/components/panel/filterPanel/GridFilterPanel.js +28 -12
  85. package/legacy/components/toolbar/GridToolbarColumnsButton.js +0 -1
  86. package/legacy/components/toolbar/GridToolbarDensitySelector.js +0 -1
  87. package/legacy/components/toolbar/GridToolbarExportContainer.js +0 -1
  88. package/legacy/components/toolbar/GridToolbarFilterButton.js +0 -1
  89. package/legacy/components/toolbar/GridToolbarQuickFilter.js +67 -6
  90. package/legacy/constants/defaultGridSlotsComponents.js +2 -1
  91. package/legacy/constants/gridClasses.js +1 -1
  92. package/legacy/constants/localeTextConstants.js +1 -0
  93. package/legacy/hooks/core/useGridStateInitialization.js +18 -6
  94. package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
  95. package/legacy/hooks/features/columns/useGridColumnSpanning.js +1 -1
  96. package/legacy/hooks/features/columns/useGridColumns.js +13 -15
  97. package/legacy/hooks/features/dimensions/useGridDimensions.js +9 -8
  98. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -7
  99. package/legacy/hooks/features/editRows/useGridEditing.old.js +1 -1
  100. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +10 -4
  101. package/legacy/hooks/features/events/useGridEvents.js +2 -0
  102. package/legacy/hooks/features/filter/gridFilterSelector.js +8 -0
  103. package/legacy/hooks/features/filter/gridFilterUtils.js +4 -7
  104. package/legacy/hooks/features/filter/useGridFilter.js +33 -12
  105. package/legacy/hooks/features/pagination/useGridPage.js +1 -1
  106. package/legacy/hooks/features/pagination/useGridPageSize.js +1 -1
  107. package/legacy/hooks/features/rows/useGridRowsMeta.js +133 -66
  108. package/legacy/hooks/features/selection/useGridSelection.js +1 -1
  109. package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
  110. package/legacy/hooks/features/sorting/useGridSorting.js +1 -1
  111. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +84 -26
  112. package/legacy/index.js +1 -1
  113. package/legacy/locales/arSD.js +1 -0
  114. package/legacy/locales/bgBG.js +1 -0
  115. package/legacy/locales/csCZ.js +1 -0
  116. package/legacy/locales/daDK.js +1 -0
  117. package/legacy/locales/deDE.js +1 -0
  118. package/legacy/locales/elGR.js +1 -0
  119. package/legacy/locales/esES.js +1 -0
  120. package/legacy/locales/faIR.js +1 -0
  121. package/legacy/locales/fiFI.js +1 -0
  122. package/legacy/locales/frFR.js +1 -0
  123. package/legacy/locales/heIL.js +10 -9
  124. package/legacy/locales/huHU.js +1 -0
  125. package/legacy/locales/itIT.js +1 -0
  126. package/legacy/locales/jaJP.js +29 -24
  127. package/legacy/locales/koKR.js +1 -0
  128. package/legacy/locales/nbNO.js +128 -0
  129. package/legacy/locales/nlNL.js +1 -0
  130. package/legacy/locales/plPL.js +1 -0
  131. package/legacy/locales/ptBR.js +1 -0
  132. package/legacy/locales/ruRU.js +7 -6
  133. package/legacy/locales/skSK.js +1 -0
  134. package/legacy/locales/trTR.js +8 -7
  135. package/legacy/locales/ukUA.js +1 -0
  136. package/legacy/locales/viVN.js +1 -0
  137. package/legacy/locales/zhCN.js +1 -0
  138. package/legacy/models/events/gridEvents.js +2 -0
  139. package/legacy/models/gridApiCaches.js +1 -0
  140. package/legacy/models/params/gridMenuParams.js +1 -0
  141. package/legacy/models/params/index.js +2 -1
  142. package/locales/arSD.js +1 -0
  143. package/locales/bgBG.js +1 -0
  144. package/locales/csCZ.js +1 -0
  145. package/locales/daDK.js +1 -0
  146. package/locales/deDE.js +1 -0
  147. package/locales/elGR.js +1 -0
  148. package/locales/esES.js +1 -0
  149. package/locales/faIR.js +1 -0
  150. package/locales/fiFI.js +1 -0
  151. package/locales/frFR.js +1 -0
  152. package/locales/heIL.js +10 -9
  153. package/locales/huHU.js +1 -0
  154. package/locales/itIT.js +1 -0
  155. package/locales/jaJP.js +25 -24
  156. package/locales/koKR.js +1 -0
  157. package/locales/nbNO.d.ts +2 -0
  158. package/locales/nbNO.js +116 -0
  159. package/locales/nlNL.js +1 -0
  160. package/locales/plPL.js +1 -0
  161. package/locales/ptBR.js +1 -0
  162. package/locales/ruRU.js +7 -6
  163. package/locales/skSK.js +1 -0
  164. package/locales/trTR.js +8 -7
  165. package/locales/ukUA.js +1 -0
  166. package/locales/viVN.js +1 -0
  167. package/locales/zhCN.js +1 -0
  168. package/models/api/gridCallbackDetails.d.ts +6 -1
  169. package/models/api/gridCoreApi.d.ts +2 -6
  170. package/models/api/gridFilterApi.d.ts +8 -1
  171. package/models/api/gridLocaleTextApi.d.ts +1 -0
  172. package/models/api/gridRowsMetaApi.d.ts +24 -0
  173. package/models/api/gridStateApi.d.ts +14 -3
  174. package/models/colDef/gridColDef.d.ts +4 -4
  175. package/models/events/gridEventLookup.d.ts +16 -1
  176. package/models/events/gridEvents.d.ts +3 -1
  177. package/models/events/gridEvents.js +2 -0
  178. package/models/gridApiCaches.d.ts +6 -0
  179. package/models/gridApiCaches.js +1 -0
  180. package/models/gridIconSlotsComponent.d.ts +5 -0
  181. package/models/params/gridMenuParams.d.ts +7 -0
  182. package/models/params/gridMenuParams.js +1 -0
  183. package/models/params/gridRowParams.d.ts +1 -1
  184. package/models/params/index.d.ts +1 -0
  185. package/models/params/index.js +2 -1
  186. package/models/props/DataGridProps.d.ts +24 -2
  187. package/modern/DataGrid/DataGrid.js +26 -1
  188. package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
  189. package/modern/colDef/gridNumericColDef.js +1 -1
  190. package/modern/components/GridRow.js +51 -12
  191. package/modern/components/cell/GridCell.js +12 -7
  192. package/modern/components/columnHeaders/GridColumnHeaderItem.js +9 -6
  193. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
  194. package/modern/components/columnSelection/GridHeaderCheckbox.js +0 -1
  195. package/modern/components/containers/GridRootStyles.js +8 -3
  196. package/modern/components/menu/GridMenu.js +9 -2
  197. package/modern/components/panel/GridColumnsPanel.js +12 -7
  198. package/modern/components/panel/GridPanelWrapper.js +3 -3
  199. package/modern/components/panel/filterPanel/GridFilterForm.js +88 -8
  200. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  201. package/modern/components/panel/filterPanel/GridFilterPanel.js +26 -11
  202. package/modern/components/toolbar/GridToolbarColumnsButton.js +0 -1
  203. package/modern/components/toolbar/GridToolbarDensitySelector.js +0 -1
  204. package/modern/components/toolbar/GridToolbarExportContainer.js +0 -1
  205. package/modern/components/toolbar/GridToolbarFilterButton.js +0 -1
  206. package/modern/components/toolbar/GridToolbarQuickFilter.js +57 -4
  207. package/modern/constants/defaultGridSlotsComponents.js +2 -1
  208. package/modern/constants/gridClasses.js +1 -1
  209. package/modern/constants/localeTextConstants.js +1 -0
  210. package/modern/hooks/core/useGridStateInitialization.js +19 -6
  211. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
  212. package/modern/hooks/features/columns/useGridColumnSpanning.js +1 -1
  213. package/modern/hooks/features/columns/useGridColumns.js +12 -14
  214. package/modern/hooks/features/dimensions/useGridDimensions.js +9 -8
  215. package/modern/hooks/features/editRows/useGridCellEditing.new.js +10 -3
  216. package/modern/hooks/features/editRows/useGridEditing.old.js +1 -1
  217. package/modern/hooks/features/editRows/useGridRowEditing.new.js +9 -3
  218. package/modern/hooks/features/events/useGridEvents.js +2 -0
  219. package/modern/hooks/features/filter/gridFilterSelector.js +6 -0
  220. package/modern/hooks/features/filter/gridFilterUtils.js +3 -6
  221. package/modern/hooks/features/filter/useGridFilter.js +29 -12
  222. package/modern/hooks/features/pagination/useGridPage.js +1 -1
  223. package/modern/hooks/features/pagination/useGridPageSize.js +1 -1
  224. package/modern/hooks/features/rows/useGridRowsMeta.js +129 -59
  225. package/modern/hooks/features/selection/useGridSelection.js +1 -1
  226. package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
  227. package/modern/hooks/features/sorting/useGridSorting.js +1 -1
  228. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +65 -11
  229. package/modern/index.js +1 -1
  230. package/modern/locales/arSD.js +1 -0
  231. package/modern/locales/bgBG.js +1 -0
  232. package/modern/locales/csCZ.js +1 -0
  233. package/modern/locales/daDK.js +1 -0
  234. package/modern/locales/deDE.js +1 -0
  235. package/modern/locales/elGR.js +1 -0
  236. package/modern/locales/esES.js +1 -0
  237. package/modern/locales/faIR.js +1 -0
  238. package/modern/locales/fiFI.js +1 -0
  239. package/modern/locales/frFR.js +1 -0
  240. package/modern/locales/heIL.js +10 -9
  241. package/modern/locales/huHU.js +1 -0
  242. package/modern/locales/itIT.js +1 -0
  243. package/modern/locales/jaJP.js +25 -24
  244. package/modern/locales/koKR.js +1 -0
  245. package/modern/locales/nbNO.js +116 -0
  246. package/modern/locales/nlNL.js +1 -0
  247. package/modern/locales/plPL.js +1 -0
  248. package/modern/locales/ptBR.js +1 -0
  249. package/modern/locales/ruRU.js +7 -6
  250. package/modern/locales/skSK.js +1 -0
  251. package/modern/locales/trTR.js +8 -7
  252. package/modern/locales/ukUA.js +1 -0
  253. package/modern/locales/viVN.js +1 -0
  254. package/modern/locales/zhCN.js +1 -0
  255. package/modern/models/events/gridEvents.js +2 -0
  256. package/modern/models/gridApiCaches.js +1 -0
  257. package/modern/models/params/gridMenuParams.js +1 -0
  258. package/modern/models/params/index.js +2 -1
  259. package/node/DataGrid/DataGrid.js +26 -1
  260. package/node/colDef/gridCheckboxSelectionColDef.js +4 -2
  261. package/node/colDef/gridNumericColDef.js +1 -1
  262. package/node/components/GridRow.js +53 -12
  263. package/node/components/cell/GridCell.js +12 -7
  264. package/node/components/columnHeaders/GridColumnHeaderItem.js +9 -6
  265. package/node/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
  266. package/node/components/columnSelection/GridHeaderCheckbox.js +0 -1
  267. package/node/components/containers/GridRootStyles.js +8 -3
  268. package/node/components/menu/GridMenu.js +10 -2
  269. package/node/components/panel/GridColumnsPanel.js +12 -7
  270. package/node/components/panel/GridPanelWrapper.js +5 -3
  271. package/node/components/panel/filterPanel/GridFilterForm.js +91 -9
  272. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  273. package/node/components/panel/filterPanel/GridFilterPanel.js +28 -11
  274. package/node/components/toolbar/GridToolbarColumnsButton.js +0 -1
  275. package/node/components/toolbar/GridToolbarDensitySelector.js +0 -1
  276. package/node/components/toolbar/GridToolbarExportContainer.js +0 -1
  277. package/node/components/toolbar/GridToolbarFilterButton.js +0 -1
  278. package/node/components/toolbar/GridToolbarQuickFilter.js +61 -4
  279. package/node/constants/defaultGridSlotsComponents.js +2 -1
  280. package/node/constants/gridClasses.js +1 -1
  281. package/node/constants/localeTextConstants.js +1 -0
  282. package/node/hooks/core/useGridStateInitialization.js +19 -6
  283. package/node/hooks/features/columnMenu/useGridColumnMenu.js +23 -0
  284. package/node/hooks/features/columns/useGridColumnSpanning.js +11 -16
  285. package/node/hooks/features/columns/useGridColumns.js +13 -15
  286. package/node/hooks/features/dimensions/useGridDimensions.js +9 -8
  287. package/node/hooks/features/editRows/useGridCellEditing.new.js +11 -4
  288. package/node/hooks/features/editRows/useGridEditing.old.js +1 -1
  289. package/node/hooks/features/editRows/useGridRowEditing.new.js +10 -4
  290. package/node/hooks/features/events/useGridEvents.js +2 -0
  291. package/node/hooks/features/filter/gridFilterSelector.js +9 -2
  292. package/node/hooks/features/filter/gridFilterUtils.js +4 -5
  293. package/node/hooks/features/filter/useGridFilter.js +28 -11
  294. package/node/hooks/features/pagination/useGridPage.js +1 -1
  295. package/node/hooks/features/pagination/useGridPageSize.js +1 -1
  296. package/node/hooks/features/rows/useGridRowsMeta.js +136 -69
  297. package/node/hooks/features/selection/useGridSelection.js +1 -1
  298. package/node/hooks/features/selection/useGridSelectionPreProcessors.js +7 -5
  299. package/node/hooks/features/sorting/useGridSorting.js +1 -1
  300. package/node/hooks/features/virtualization/useGridVirtualScroller.js +65 -12
  301. package/node/index.js +1 -1
  302. package/node/locales/arSD.js +1 -0
  303. package/node/locales/bgBG.js +1 -0
  304. package/node/locales/csCZ.js +1 -0
  305. package/node/locales/daDK.js +1 -0
  306. package/node/locales/deDE.js +1 -0
  307. package/node/locales/elGR.js +1 -0
  308. package/node/locales/esES.js +1 -0
  309. package/node/locales/faIR.js +1 -0
  310. package/node/locales/fiFI.js +1 -0
  311. package/node/locales/frFR.js +1 -0
  312. package/node/locales/heIL.js +10 -9
  313. package/node/locales/huHU.js +1 -0
  314. package/node/locales/itIT.js +1 -0
  315. package/node/locales/jaJP.js +25 -24
  316. package/node/locales/koKR.js +1 -0
  317. package/node/locales/nbNO.js +126 -0
  318. package/node/locales/nlNL.js +1 -0
  319. package/node/locales/plPL.js +1 -0
  320. package/node/locales/ptBR.js +1 -0
  321. package/node/locales/ruRU.js +7 -6
  322. package/node/locales/skSK.js +1 -0
  323. package/node/locales/trTR.js +8 -7
  324. package/node/locales/ukUA.js +1 -0
  325. package/node/locales/viVN.js +1 -0
  326. package/node/locales/zhCN.js +1 -0
  327. package/node/models/events/gridEvents.js +2 -0
  328. package/node/models/gridApiCaches.js +5 -0
  329. package/node/models/params/gridMenuParams.js +5 -0
  330. package/node/models/params/index.js +13 -0
  331. package/package.json +6 -5
@@ -37,7 +37,7 @@ var isEnabled = function isEnabled() {
37
37
  return true;
38
38
  };
39
39
 
40
- function GridPanelWrapper(props) {
40
+ var GridPanelWrapper = /*#__PURE__*/React.forwardRef(function GridPanelWrapper(props, ref) {
41
41
  var className = props.className,
42
42
  other = _objectWithoutProperties(props, _excluded);
43
43
 
@@ -51,10 +51,10 @@ function GridPanelWrapper(props) {
51
51
  disableEnforceFocus: true,
52
52
  isEnabled: isEnabled,
53
53
  children: /*#__PURE__*/_jsx(GridPanelWrapperRoot, _extends({
54
+ ref: ref,
54
55
  tabIndex: -1,
55
56
  className: clsx(className, classes.root)
56
57
  }, other))
57
58
  });
58
- }
59
-
59
+ });
60
60
  export { GridPanelWrapper };
@@ -1,4 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"];
2
4
  import * as React from 'react';
3
5
  import PropTypes from 'prop-types';
4
6
  import { unstable_composeClasses as composeClasses } from '@mui/material';
@@ -116,8 +118,7 @@ var getColumnLabel = function getColumnLabel(col) {
116
118
  };
117
119
 
118
120
  var collator = new Intl.Collator();
119
-
120
- function GridFilterForm(props) {
121
+ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props, ref) {
121
122
  var _rootProps$components, _rootProps$components2, _baseSelectProps$nati, _rootProps$components3, _rootProps$components4, _rootProps$components5, _currentColumn$filter2;
122
123
 
123
124
  var item = props.item,
@@ -141,7 +142,10 @@ function GridFilterForm(props) {
141
142
  _props$columnInputPro = props.columnInputProps,
142
143
  columnInputProps = _props$columnInputPro === void 0 ? {} : _props$columnInputPro,
143
144
  _props$valueInputProp = props.valueInputProps,
144
- valueInputProps = _props$valueInputProp === void 0 ? {} : _props$valueInputProp;
145
+ valueInputProps = _props$valueInputProp === void 0 ? {} : _props$valueInputProp,
146
+ children = props.children,
147
+ other = _objectWithoutProperties(props, _excluded);
148
+
145
149
  var apiRef = useGridApiContext();
146
150
  var filterableColumns = useGridSelector(apiRef, gridFilterableColumnDefinitionsSelector);
147
151
  var columnSelectId = useId();
@@ -253,8 +257,10 @@ function GridFilterForm(props) {
253
257
  }
254
258
  };
255
259
  }, [currentOperator]);
256
- return /*#__PURE__*/_jsxs(GridFilterFormRoot, {
257
- className: classes.root,
260
+ return /*#__PURE__*/_jsxs(GridFilterFormRoot, _extends({
261
+ ref: ref,
262
+ className: classes.root
263
+ }, other, {
258
264
  children: [/*#__PURE__*/_jsx(FilterFormDeleteIcon, _extends({
259
265
  variant: "standard",
260
266
  as: rootProps.components.BaseFormControl
@@ -355,36 +361,111 @@ function GridFilterForm(props) {
355
361
  focusElementRef: valueRef
356
362
  }, currentOperator.InputComponentProps)) : null
357
363
  }))]
358
- });
359
- }
360
-
364
+ }));
365
+ });
361
366
  process.env.NODE_ENV !== "production" ? GridFilterForm.propTypes = {
362
367
  // ----------------------------- Warning --------------------------------
363
368
  // | These PropTypes are generated from the TypeScript type definitions |
364
369
  // | To update them edit the TypeScript types and run "yarn proptypes" |
365
370
  // ----------------------------------------------------------------------
371
+
372
+ /**
373
+ * Callback called when the operator, column field or value is changed.
374
+ * @param {GridFilterItem} item The updated [[GridFilterItem]].
375
+ */
366
376
  applyFilterChanges: PropTypes.func.isRequired,
377
+
378
+ /**
379
+ * Callback called when the logic operator is changed.
380
+ * @param {GridLinkOperator} operator The new logic operator.
381
+ */
367
382
  applyMultiFilterOperatorChanges: PropTypes.func.isRequired,
383
+
384
+ /**
385
+ * Props passed to the column input component.
386
+ * @default {}
387
+ */
368
388
  columnInputProps: PropTypes.any,
389
+
390
+ /**
391
+ * Changes how the options in the columns selector should be ordered.
392
+ * If not specified, the order is derived from the `columns` prop.
393
+ */
369
394
  columnsSort: PropTypes.oneOf(['asc', 'desc']),
395
+
396
+ /**
397
+ * Callback called when the delete button is clicked.
398
+ * @param {GridFilterItem} item The deleted [[GridFilterItem]].
399
+ */
370
400
  deleteFilter: PropTypes.func.isRequired,
401
+
402
+ /**
403
+ * Props passed to the delete icon.
404
+ * @default {}
405
+ */
371
406
  deleteIconProps: PropTypes.any,
407
+
408
+ /**
409
+ * If `true`, disables the logic operator field but still renders it.
410
+ */
372
411
  disableMultiFilterOperator: PropTypes.bool,
412
+
413
+ /**
414
+ * A ref allowing to set imperative focus.
415
+ * It can be passed to the el
416
+ */
373
417
  focusElementRef: PropTypes
374
418
  /* @typescript-to-proptypes-ignore */
375
419
  .oneOfType([PropTypes.func, PropTypes.object]),
420
+
421
+ /**
422
+ * If `true`, the logic operator field is rendered.
423
+ * The field will be invisible if `showMultiFilterOperators` is also `true`.
424
+ */
376
425
  hasMultipleFilters: PropTypes.bool.isRequired,
426
+
427
+ /**
428
+ * The [[GridFilterItem]] representing this form.
429
+ */
377
430
  item: PropTypes.shape({
378
431
  columnField: PropTypes.string.isRequired,
379
432
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
380
433
  operatorValue: PropTypes.string,
381
434
  value: PropTypes.any
382
435
  }).isRequired,
436
+
437
+ /**
438
+ * Props passed to the logic operator input component.
439
+ * @default {}
440
+ */
383
441
  linkOperatorInputProps: PropTypes.any,
442
+
443
+ /**
444
+ * Sets the available logic operators.
445
+ * @default [GridLinkOperator.And, GridLinkOperator.Or]
446
+ */
384
447
  linkOperators: PropTypes.arrayOf(PropTypes.oneOf(['and', 'or']).isRequired),
448
+
449
+ /**
450
+ * The current logic operator applied.
451
+ */
385
452
  multiFilterOperator: PropTypes.oneOf(['and', 'or']),
453
+
454
+ /**
455
+ * Props passed to the operator input component.
456
+ * @default {}
457
+ */
386
458
  operatorInputProps: PropTypes.any,
459
+
460
+ /**
461
+ * If `true`, the logic operator field is visible.
462
+ */
387
463
  showMultiFilterOperators: PropTypes.bool,
464
+
465
+ /**
466
+ * Props passed to the value input component.
467
+ * @default {}
468
+ */
388
469
  valueInputProps: PropTypes.any
389
470
  } : void 0;
390
471
  export { GridFilterForm };
@@ -93,7 +93,6 @@ function GridFilterInputMultipleSingleSelect(props) {
93
93
  }, [applyValue, item]);
94
94
  return /*#__PURE__*/_jsx(Autocomplete, _extends({
95
95
  multiple: true,
96
- freeSolo: false,
97
96
  limitTags: 1,
98
97
  options: resolvedValueOptions // TODO: avoid `any`?
99
98
  ,
@@ -1,7 +1,7 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["linkOperators", "columnsSort", "filterFormProps"];
4
+ var _excluded = ["linkOperators", "columnsSort", "filterFormProps", "children"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { GridLinkOperator } from '../../../models/gridFilterItem';
@@ -17,8 +17,7 @@ import { gridFilterModelSelector } from '../../../hooks/features/filter/gridFilt
17
17
  import { gridFilterableColumnDefinitionsSelector } from '../../../hooks/features/columns/gridColumnsSelector';
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
-
21
- function GridFilterPanel(props) {
20
+ var GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(props, ref) {
22
21
  var _rootProps$components;
23
22
 
24
23
  var apiRef = useGridApiContext();
@@ -31,6 +30,7 @@ function GridFilterPanel(props) {
31
30
  linkOperators = _props$linkOperators === void 0 ? [GridLinkOperator.And, GridLinkOperator.Or] : _props$linkOperators,
32
31
  columnsSort = props.columnsSort,
33
32
  filterFormProps = props.filterFormProps,
33
+ children = props.children,
34
34
  other = _objectWithoutProperties(props, _excluded);
35
35
 
36
36
  var applyFilter = React.useCallback(function (item) {
@@ -73,9 +73,7 @@ function GridFilterPanel(props) {
73
73
  return;
74
74
  }
75
75
 
76
- apiRef.current.setFilterModel(_extends({}, filterModel, {
77
- items: [].concat(_toConsumableArray(items), [defaultItem])
78
- }));
76
+ apiRef.current.upsertFilterItems([].concat(_toConsumableArray(items), [defaultItem]));
79
77
  };
80
78
 
81
79
  var deleteFilter = React.useCallback(function (item) {
@@ -96,7 +94,9 @@ function GridFilterPanel(props) {
96
94
  lastFilterRef.current.focus();
97
95
  }
98
96
  }, [items.length]);
99
- return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({}, other, {
97
+ return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({
98
+ ref: ref
99
+ }, other, {
100
100
  children: [/*#__PURE__*/_jsx(GridPanelContent, {
101
101
  children: items.map(function (item, index) {
102
102
  return /*#__PURE__*/_jsx(GridFilterForm, _extends({
@@ -116,21 +116,28 @@ function GridFilterPanel(props) {
116
116
  }), !rootProps.disableMultipleColumnsFiltering && /*#__PURE__*/_jsx(GridPanelFooter, {
117
117
  children: /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
118
118
  onClick: addNewFilter,
119
- startIcon: /*#__PURE__*/_jsx(GridAddIcon, {}),
120
- color: "primary"
119
+ startIcon: /*#__PURE__*/_jsx(GridAddIcon, {})
121
120
  }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseButton, {
122
121
  children: apiRef.current.getLocaleText('filterPanelAddFilter')
123
122
  }))
124
123
  })]
125
124
  }));
126
- }
127
-
125
+ });
128
126
  process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
129
127
  // ----------------------------- Warning --------------------------------
130
128
  // | These PropTypes are generated from the TypeScript type definitions |
131
129
  // | To update them edit the TypeScript types and run "yarn proptypes" |
132
130
  // ----------------------------------------------------------------------
131
+
132
+ /**
133
+ * Changes how the options in the columns selector should be ordered.
134
+ * If not specified, the order is derived from the `columns` prop.
135
+ */
133
136
  columnsSort: PropTypes.oneOf(['asc', 'desc']),
137
+
138
+ /**
139
+ * Props passed to each filter form.
140
+ */
134
141
  filterFormProps: PropTypes.shape({
135
142
  columnInputProps: PropTypes.any,
136
143
  columnsSort: PropTypes.oneOf(['asc', 'desc']),
@@ -139,7 +146,16 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
139
146
  operatorInputProps: PropTypes.any,
140
147
  valueInputProps: PropTypes.any
141
148
  }),
149
+
150
+ /**
151
+ * Sets the available logic operators.
152
+ * @default [GridLinkOperator.And, GridLinkOperator.Or]
153
+ */
142
154
  linkOperators: PropTypes.arrayOf(PropTypes.oneOf(['and', 'or']).isRequired),
155
+
156
+ /**
157
+ * The system prop that allows defining system overrides as well as additional CSS styles.
158
+ */
143
159
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
144
160
  } : void 0;
145
161
  export { GridFilterPanel };
@@ -39,7 +39,6 @@ export var GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function Gri
39
39
  return /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
40
40
  ref: ref,
41
41
  size: "small",
42
- color: "primary",
43
42
  "aria-label": apiRef.current.getLocaleText('toolbarColumnsLabel'),
44
43
  startIcon: /*#__PURE__*/_jsx(rootProps.components.ColumnSelectorIcon, {})
45
44
  }, other, {
@@ -105,7 +105,6 @@ export var GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function G
105
105
  return /*#__PURE__*/_jsxs(React.Fragment, {
106
106
  children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
107
107
  ref: handleRef,
108
- color: "primary",
109
108
  size: "small",
110
109
  startIcon: startIcon,
111
110
  "aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
@@ -58,7 +58,6 @@ export var GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function G
58
58
  return /*#__PURE__*/_jsxs(React.Fragment, {
59
59
  children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
60
60
  ref: handleRef,
61
- color: "primary",
62
61
  size: "small",
63
62
  startIcon: /*#__PURE__*/_jsx(rootProps.components.ExportIcon, {}),
64
63
  "aria-expanded": open ? 'true' : undefined,
@@ -110,7 +110,6 @@ var GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolbar
110
110
  children: /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
111
111
  ref: ref,
112
112
  size: "small",
113
- color: "primary",
114
113
  "aria-label": apiRef.current.getLocaleText('toolbarFiltersLabel'),
115
114
  startIcon: /*#__PURE__*/_jsx(Badge, {
116
115
  badgeContent: activeFilters.length,
@@ -1,14 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["quickFilterParser", "debounceMs"];
4
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
+ var _excluded = ["quickFilterParser", "quickFilterFormatter", "debounceMs"];
5
6
  import * as React from 'react';
6
7
  import PropTypes from 'prop-types';
7
8
  import TextField from '@mui/material/TextField';
9
+ import IconButton from '@mui/material/IconButton';
8
10
  import { styled } from '@mui/material/styles';
9
11
  import { debounce } from '@mui/material/utils';
10
12
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
11
13
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
14
+ import { useGridSelector } from '../../hooks/utils/useGridSelector';
15
+ import { gridQuickFilterValuesSelector } from '../../hooks/features/filter';
16
+ import { isDeepEqual } from '../../utils/utils';
12
17
  import { jsx as _jsx } from "react/jsx-runtime";
13
18
  var GridToolbarQuickFilterRoot = styled(TextField, {
14
19
  name: 'MuiDataGrid',
@@ -17,17 +22,27 @@ var GridToolbarQuickFilterRoot = styled(TextField, {
17
22
  return styles.toolbarQuickFilter;
18
23
  }
19
24
  })(function (_ref) {
25
+ var _ref2;
26
+
20
27
  var theme = _ref.theme;
21
- return {
28
+ return _ref2 = {
22
29
  width: 'auto',
23
30
  paddingBottom: theme.spacing(0.5),
24
- '& .MuiSvgIcon-root': {
25
- marginRight: theme.spacing(0.5)
31
+ '& input': {
32
+ marginLeft: theme.spacing(0.5)
26
33
  },
27
34
  '& .MuiInput-underline:before': {
28
35
  borderBottom: "1px solid ".concat(theme.palette.divider)
29
36
  }
30
- };
37
+ }, _defineProperty(_ref2, "& input[type=search]::-ms-clear,\n& input[type=search]::-ms-reveal", {
38
+ /* clears the 'X' icon from IE */
39
+ display: 'none',
40
+ width: 0,
41
+ height: 0
42
+ }), _defineProperty(_ref2, "& input[type=\"search\"]::-webkit-search-decoration,\n & input[type=\"search\"]::-webkit-search-cancel-button,\n & input[type=\"search\"]::-webkit-search-results-button,\n & input[type=\"search\"]::-webkit-search-results-decoration", {
43
+ /* clears the 'X' icon from Chrome */
44
+ display: 'none'
45
+ }), _ref2;
31
46
  });
32
47
 
33
48
  var defaultSearchValueParser = function defaultSearchValueParser(searchText) {
@@ -36,23 +51,47 @@ var defaultSearchValueParser = function defaultSearchValueParser(searchText) {
36
51
  });
37
52
  };
38
53
 
54
+ var defaultSearchValueFormatter = function defaultSearchValueFormatter(values) {
55
+ return values.join(' ');
56
+ };
57
+
39
58
  function GridToolbarQuickFilter(props) {
40
59
  var _rootProps$components;
41
60
 
42
61
  var _props$quickFilterPar = props.quickFilterParser,
43
62
  quickFilterParser = _props$quickFilterPar === void 0 ? defaultSearchValueParser : _props$quickFilterPar,
63
+ _props$quickFilterFor = props.quickFilterFormatter,
64
+ quickFilterFormatter = _props$quickFilterFor === void 0 ? defaultSearchValueFormatter : _props$quickFilterFor,
44
65
  _props$debounceMs = props.debounceMs,
45
66
  debounceMs = _props$debounceMs === void 0 ? 500 : _props$debounceMs,
46
67
  other = _objectWithoutProperties(props, _excluded);
47
68
 
48
69
  var apiRef = useGridApiContext();
49
70
  var rootProps = useGridRootProps();
71
+ var quickFilterValues = useGridSelector(apiRef, gridQuickFilterValuesSelector);
50
72
 
51
- var _React$useState = React.useState(''),
73
+ var _React$useState = React.useState(function () {
74
+ return quickFilterFormatter(quickFilterValues != null ? quickFilterValues : []);
75
+ }),
52
76
  _React$useState2 = _slicedToArray(_React$useState, 2),
53
77
  searchValue = _React$useState2[0],
54
78
  setSearchValue = _React$useState2[1];
55
79
 
80
+ var _React$useState3 = React.useState(quickFilterValues),
81
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
82
+ prevQuickFilterValues = _React$useState4[0],
83
+ setPrevQuickFilterValues = _React$useState4[1];
84
+
85
+ React.useEffect(function () {
86
+ if (!isDeepEqual(prevQuickFilterValues, quickFilterValues)) {
87
+ // The model of quick filter value has been updated
88
+ setPrevQuickFilterValues(quickFilterValues); // Update the input value if needed to match the new model
89
+
90
+ setSearchValue(function (prevSearchValue) {
91
+ return isDeepEqual(quickFilterParser(prevSearchValue), quickFilterValues) ? prevSearchValue : quickFilterFormatter(quickFilterValues != null ? quickFilterValues : []);
92
+ });
93
+ }
94
+ }, [prevQuickFilterValues, quickFilterValues, quickFilterFormatter, quickFilterParser]);
56
95
  var updateSearchValue = React.useCallback(function (newSearchValue) {
57
96
  apiRef.current.setQuickFilterValues(quickFilterParser(newSearchValue));
58
97
  }, [apiRef, quickFilterParser]);
@@ -64,6 +103,10 @@ function GridToolbarQuickFilter(props) {
64
103
  setSearchValue(newSearchValue);
65
104
  debouncedUpdateSearchValue(newSearchValue);
66
105
  }, [debouncedUpdateSearchValue]);
106
+ var handleSearchReset = React.useCallback(function () {
107
+ setSearchValue('');
108
+ updateSearchValue('');
109
+ }, [updateSearchValue]);
67
110
  return /*#__PURE__*/_jsx(GridToolbarQuickFilterRoot, _extends({
68
111
  as: rootProps.components.BaseTextField,
69
112
  variant: "standard",
@@ -75,6 +118,17 @@ function GridToolbarQuickFilter(props) {
75
118
  InputProps: {
76
119
  startAdornment: /*#__PURE__*/_jsx(rootProps.components.QuickFilterIcon, {
77
120
  fontSize: "small"
121
+ }),
122
+ endAdornment: /*#__PURE__*/_jsx(IconButton, {
123
+ "aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
124
+ size: "small",
125
+ sx: {
126
+ visibility: searchValue ? 'visible' : 'hidden'
127
+ },
128
+ onClick: handleSearchReset,
129
+ children: /*#__PURE__*/_jsx(rootProps.components.QuickFilterClearIcon, {
130
+ fontSize: "small"
131
+ })
78
132
  })
79
133
  }
80
134
  }, other, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
@@ -92,6 +146,13 @@ process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
92
146
  */
93
147
  debounceMs: PropTypes.number,
94
148
 
149
+ /**
150
+ * Function responsible for formatting values of quick filter in a string when the model is modified
151
+ * @param {any[]} values The new values passed to the quick filter model
152
+ * @returns {string} The string to display in the text field
153
+ */
154
+ quickFilterFormatter: PropTypes.func,
155
+
95
156
  /**
96
157
  * Function responsible for parsing text input in an array of independent values for quick filtering.
97
158
  * @param {string} input The value entered by the user
@@ -35,7 +35,8 @@ var DEFAULT_GRID_ICON_SLOTS_COMPONENTS = {
35
35
  DetailPanelExpandIcon: GridAddIcon,
36
36
  DetailPanelCollapseIcon: GridRemoveIcon,
37
37
  RowReorderIcon: GridDragIcon,
38
- QuickFilterIcon: GridSearchIcon
38
+ QuickFilterIcon: GridSearchIcon,
39
+ QuickFilterClearIcon: GridCloseIcon
39
40
  };
40
41
  /**
41
42
  * TODO: Differentiate community and pro value and interface
@@ -2,4 +2,4 @@ import { generateUtilityClasses, generateUtilityClass } from '@mui/material';
2
2
  export function getDataGridUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiDataGrid', slot);
4
4
  }
5
- export var gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
5
+ export var gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
@@ -117,6 +117,7 @@ export var GRID_DEFAULT_LOCALE_TEXT = {
117
117
  return "Stop grouping by ".concat(name);
118
118
  },
119
119
  // Master/detail
120
+ detailPanelToggle: 'Detail panel toggle',
120
121
  expandDetailPanel: 'Expand',
121
122
  collapseDetailPanel: 'Collapse',
122
123
  // Used core components translation keys
@@ -1,3 +1,4 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
2
  import _extends from "@babel/runtime/helpers/esm/extends";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
@@ -13,7 +14,7 @@ export var useGridStateInitialization = function useGridStateInitialization(apiR
13
14
  _React$useState2 = _slicedToArray(_React$useState, 2),
14
15
  rawForceUpdate = _React$useState2[1];
15
16
 
16
- var updateControlState = React.useCallback(function (controlStateItem) {
17
+ var registerControlState = React.useCallback(function (controlStateItem) {
17
18
  var stateId = controlStateItem.stateId,
18
19
  others = _objectWithoutProperties(controlStateItem, _excluded);
19
20
 
@@ -21,7 +22,7 @@ export var useGridStateInitialization = function useGridStateInitialization(apiR
21
22
  stateId: stateId
22
23
  });
23
24
  }, []);
24
- var setState = React.useCallback(function (state) {
25
+ var setState = React.useCallback(function (state, reason) {
25
26
  var newState;
26
27
 
27
28
  if (isFunction(state)) {
@@ -83,18 +84,28 @@ export var useGridStateInitialization = function useGridStateInitialization(apiR
83
84
 
84
85
  if (controlState.propOnChange && hasPropChanged) {
85
86
  var details = props.signature === GridSignature.DataGridPro ? {
86
- api: apiRef.current
87
- } : {};
87
+ api: apiRef.current,
88
+ reason: reason
89
+ } : {
90
+ reason: reason
91
+ };
88
92
  controlState.propOnChange(model, details);
89
93
  }
90
94
 
91
95
  if (!ignoreSetState) {
92
- apiRef.current.publishEvent(controlState.changeEvent, model);
96
+ apiRef.current.publishEvent(controlState.changeEvent, model, {
97
+ reason: reason
98
+ });
93
99
  }
94
100
  }
95
101
 
96
102
  return !ignoreSetState;
97
103
  }, [apiRef, props.signature]);
104
+ var updateControlState = React.useCallback(function (key, state, reason) {
105
+ return apiRef.current.setState(function (previousState) {
106
+ return _extends({}, previousState, _defineProperty({}, key, state(previousState[key])));
107
+ }, reason);
108
+ }, [apiRef]);
98
109
  var forceUpdate = React.useCallback(function () {
99
110
  return rawForceUpdate(function () {
100
111
  return apiRef.current.state;
@@ -103,7 +114,8 @@ export var useGridStateInitialization = function useGridStateInitialization(apiR
103
114
  var stateApi = {
104
115
  setState: setState,
105
116
  forceUpdate: forceUpdate,
106
- unstable_updateControlState: updateControlState
117
+ unstable_updateControlState: updateControlState,
118
+ unstable_registerControlState: registerControlState
107
119
  };
108
120
  useGridApiMethod(apiRef, stateApi, 'GridStateApi');
109
121
  };
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useGridLogger, useGridApiMethod, useGridApiEventHandler } from '../../utils';
4
4
  import { gridColumnMenuSelector } from './columnMenuSelector';
5
+ import { gridClasses } from '../../../constants/gridClasses';
5
6
  export var columnMenuStateInitializer = function columnMenuStateInitializer(state) {
6
7
  return _extends({}, state, {
7
8
  columnMenu: {
@@ -79,7 +80,28 @@ export var useGridColumnMenu = function useGridColumnMenu(apiRef) {
79
80
  * EVENTS
80
81
  */
81
82
 
83
+ var handleColumnHeaderFocus = React.useCallback(function (params, event) {
84
+ // Check if the column menu button received focus
85
+ if (!event.target.classList.contains(gridClasses.menuIconButton)) {
86
+ return;
87
+ } // Check if there's an element which lost focus
88
+
89
+
90
+ if (!event.relatedTarget) {
91
+ return;
92
+ } // `true` if the focus was on the column menu itself, not on any item
93
+
94
+
95
+ var columnMenuLostFocus = event.relatedTarget.classList.contains(gridClasses.menuList); // `true` if the focus was on an item from the column menu
96
+
97
+ var columnMenuItemLostFocus = event.relatedTarget.getAttribute('role') === 'menuitem';
98
+
99
+ if (columnMenuLostFocus || columnMenuItemLostFocus) {
100
+ apiRef.current.setColumnHeaderFocus(params.field);
101
+ }
102
+ }, [apiRef]);
82
103
  useGridApiEventHandler(apiRef, 'columnResizeStart', hideColumnMenu);
104
+ useGridApiEventHandler(apiRef, 'columnHeaderFocus', handleColumnHeaderFocus);
83
105
  useGridApiEventHandler(apiRef, 'virtualScrollerWheel', apiRef.current.hideColumnMenu);
84
106
  useGridApiEventHandler(apiRef, 'virtualScrollerTouchMove', apiRef.current.hideColumnMenu);
85
107
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
3
3
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
4
4