@mui/x-data-grid 5.7.0 → 5.8.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 (298) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/DataGrid/DataGrid.d.ts +8 -3
  3. package/DataGrid/DataGrid.js +27 -4
  4. package/DataGrid/useDataGridComponent.js +2 -4
  5. package/DataGrid/useDataGridProps.d.ts +2 -1
  6. package/colDef/gridBooleanColDef.d.ts +1 -1
  7. package/colDef/gridBooleanOperators.d.ts +1 -1
  8. package/colDef/gridDateColDef.d.ts +5 -9
  9. package/colDef/gridDateColDef.js +2 -2
  10. package/colDef/gridDateOperators.d.ts +1 -1
  11. package/{models/colDef → colDef}/gridDefaultColumnTypes.d.ts +1 -1
  12. package/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
  13. package/colDef/gridNumericColDef.d.ts +1 -1
  14. package/colDef/gridNumericOperators.d.ts +2 -2
  15. package/colDef/gridStringColDef.d.ts +1 -1
  16. package/colDef/gridStringOperators.d.ts +1 -1
  17. package/colDef/index.d.ts +1 -0
  18. package/colDef/index.js +2 -1
  19. package/components/GridRow.js +1 -1
  20. package/components/cell/GridCell.d.ts +4 -4
  21. package/components/cell/GridCell.js +2 -2
  22. package/components/cell/GridEditInputCell.js +2 -2
  23. package/components/cell/GridEditSingleSelectCell.js +2 -2
  24. package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +12 -0
  25. package/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
  26. package/components/columnHeaders/GridColumnHeaderItem.js +5 -5
  27. package/components/columnHeaders/index.d.ts +1 -0
  28. package/components/columnHeaders/index.js +1 -0
  29. package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
  30. package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
  31. package/components/containers/GridRoot.js +29 -17
  32. package/components/menu/columnMenu/GridColumnMenu.js +1 -1
  33. package/components/panel/GridPanel.d.ts +2 -2
  34. package/components/panel/GridPreferencesPanel.js +1 -1
  35. package/constants/defaultGridSlotsComponents.js +2 -1
  36. package/constants/gridClasses.d.ts +15 -3
  37. package/hooks/core/index.d.ts +1 -1
  38. package/hooks/core/{preProcessing/gridPreProcessingApi.d.ts → pipeProcessing/gridPipeProcessingApi.d.ts} +19 -18
  39. package/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
  40. package/hooks/core/pipeProcessing/index.d.ts +3 -0
  41. package/hooks/core/pipeProcessing/index.js +3 -0
  42. package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +27 -0
  43. package/hooks/core/pipeProcessing/useGridPipeProcessing.js +74 -0
  44. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +7 -0
  45. package/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
  46. package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +27 -16
  47. package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
  48. package/hooks/core/useGridInitialization.js +2 -2
  49. package/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  50. package/hooks/features/columns/gridColumnsSelector.d.ts +6 -6
  51. package/hooks/features/columns/gridColumnsUtils.d.ts +3 -3
  52. package/hooks/features/columns/gridColumnsUtils.js +49 -17
  53. package/hooks/features/columns/useGridColumns.js +36 -27
  54. package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
  55. package/hooks/features/dimensions/useGridDimensions.js +2 -1
  56. package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
  57. package/hooks/features/editRows/useGridCellEditing.new.js +22 -7
  58. package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
  59. package/hooks/features/editRows/useGridRowEditing.new.js +22 -7
  60. package/hooks/features/events/useGridEvents.d.ts +1 -1
  61. package/hooks/features/events/useGridEvents.js +2 -0
  62. package/hooks/features/filter/gridFilterSelector.d.ts +3 -9
  63. package/hooks/features/filter/useGridFilter.js +4 -4
  64. package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.d.ts +2 -5
  65. package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
  66. package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -3
  67. package/hooks/features/pagination/useGridPage.js +9 -4
  68. package/hooks/features/pagination/useGridPageSize.js +3 -3
  69. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
  70. package/hooks/features/rows/gridRowsSelector.d.ts +1 -1
  71. package/hooks/features/rows/gridRowsUtils.d.ts +8 -0
  72. package/hooks/features/rows/gridRowsUtils.js +11 -0
  73. package/hooks/features/rows/index.d.ts +1 -0
  74. package/hooks/features/rows/index.js +1 -1
  75. package/hooks/features/rows/useGridRows.js +3 -3
  76. package/hooks/features/rows/useGridRowsMeta.js +3 -3
  77. package/hooks/features/scroll/useGridScroll.js +4 -13
  78. package/hooks/features/selection/gridSelectionSelector.d.ts +1 -3
  79. package/hooks/features/selection/useGridSelection.d.ts +4 -2
  80. package/hooks/features/selection/useGridSelection.js +72 -25
  81. package/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
  82. package/hooks/features/sorting/gridSortingSelector.d.ts +1 -3
  83. package/hooks/features/sorting/gridSortingUtils.d.ts +1 -2
  84. package/hooks/features/sorting/useGridSorting.js +3 -3
  85. package/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
  86. package/hooks/utils/useGridRootProps.d.ts +1 -1
  87. package/hooks/utils/useGridVisibleRows.d.ts +2 -2
  88. package/index.js +1 -1
  89. package/internals/index.d.ts +3 -6
  90. package/internals/index.js +2 -3
  91. package/legacy/DataGrid/DataGrid.js +27 -4
  92. package/legacy/DataGrid/useDataGridComponent.js +2 -4
  93. package/legacy/colDef/gridDateColDef.js +2 -2
  94. package/legacy/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
  95. package/legacy/colDef/index.js +2 -1
  96. package/legacy/components/GridRow.js +1 -1
  97. package/legacy/components/cell/GridCell.js +2 -2
  98. package/legacy/components/cell/GridEditInputCell.js +2 -2
  99. package/legacy/components/cell/GridEditSingleSelectCell.js +2 -2
  100. package/legacy/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
  101. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -5
  102. package/legacy/components/columnHeaders/index.js +1 -0
  103. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
  104. package/legacy/components/containers/GridRoot.js +34 -17
  105. package/legacy/components/menu/columnMenu/GridColumnMenu.js +1 -1
  106. package/legacy/components/panel/GridPreferencesPanel.js +1 -1
  107. package/legacy/constants/defaultGridSlotsComponents.js +2 -1
  108. package/legacy/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
  109. package/legacy/hooks/core/pipeProcessing/index.js +3 -0
  110. package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +83 -0
  111. package/legacy/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
  112. package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
  113. package/legacy/hooks/core/useGridInitialization.js +2 -2
  114. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  115. package/legacy/hooks/features/columns/gridColumnsUtils.js +49 -18
  116. package/legacy/hooks/features/columns/useGridColumns.js +36 -27
  117. package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -1
  118. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +22 -7
  119. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +22 -7
  120. package/legacy/hooks/features/events/useGridEvents.js +2 -0
  121. package/legacy/hooks/features/filter/useGridFilter.js +4 -4
  122. package/legacy/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
  123. package/legacy/hooks/features/pagination/useGridPage.js +11 -4
  124. package/legacy/hooks/features/pagination/useGridPageSize.js +3 -3
  125. package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
  126. package/legacy/hooks/features/rows/gridRowsUtils.js +13 -0
  127. package/legacy/hooks/features/rows/index.js +1 -1
  128. package/legacy/hooks/features/rows/useGridRows.js +5 -5
  129. package/legacy/hooks/features/rows/useGridRowsMeta.js +3 -3
  130. package/legacy/hooks/features/scroll/useGridScroll.js +4 -13
  131. package/legacy/hooks/features/selection/useGridSelection.js +74 -25
  132. package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
  133. package/legacy/hooks/features/sorting/useGridSorting.js +3 -3
  134. package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
  135. package/legacy/index.js +1 -1
  136. package/legacy/internals/index.js +2 -3
  137. package/legacy/locales/daDK.js +36 -32
  138. package/legacy/models/colDef/index.js +1 -2
  139. package/legacy/models/events/gridEvents.js +4 -2
  140. package/legacy/models/gridRows.js +1 -33
  141. package/legacy/models/index.js +2 -2
  142. package/{modern/hooks/core/preProcessing/gridPreProcessingApi.js → legacy/models/params/gridPreferencePanelParams.js} +0 -0
  143. package/legacy/models/params/index.js +2 -1
  144. package/locales/daDK.js +32 -32
  145. package/models/api/gridApiCommon.d.ts +2 -2
  146. package/models/api/gridEditingApi.d.ts +2 -2
  147. package/models/api/gridParamsApi.d.ts +5 -5
  148. package/models/api/gridRowApi.d.ts +2 -2
  149. package/models/colDef/gridColDef.d.ts +33 -28
  150. package/models/colDef/index.d.ts +0 -1
  151. package/models/colDef/index.js +1 -2
  152. package/models/events/gridEventLookup.d.ts +12 -6
  153. package/models/events/gridEvents.d.ts +11 -5
  154. package/models/events/gridEvents.js +4 -2
  155. package/models/gridCell.d.ts +1 -0
  156. package/models/gridEditRowModel.d.ts +1 -1
  157. package/models/gridFilterOperator.d.ts +3 -2
  158. package/models/gridRows.d.ts +10 -18
  159. package/models/gridRows.js +1 -31
  160. package/models/gridSlotsComponent.d.ts +5 -0
  161. package/models/gridSlotsComponentsProps.d.ts +1 -0
  162. package/models/gridSortModel.d.ts +3 -4
  163. package/models/index.d.ts +1 -1
  164. package/models/index.js +2 -2
  165. package/models/params/gridCellParams.d.ts +14 -14
  166. package/models/params/gridColumnHeaderParams.d.ts +3 -2
  167. package/models/params/gridEditCellParams.d.ts +2 -3
  168. package/models/params/gridPreferencePanelParams.d.ts +3 -0
  169. package/models/params/gridPreferencePanelParams.js +1 -0
  170. package/models/params/gridRowParams.d.ts +7 -8
  171. package/models/params/gridValueOptionsParams.d.ts +3 -3
  172. package/models/params/index.d.ts +1 -0
  173. package/models/params/index.js +2 -1
  174. package/models/props/DataGridProps.d.ts +36 -16
  175. package/modern/DataGrid/DataGrid.js +27 -4
  176. package/modern/DataGrid/useDataGridComponent.js +2 -4
  177. package/modern/colDef/gridDateColDef.js +2 -2
  178. package/modern/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
  179. package/modern/colDef/index.js +2 -1
  180. package/modern/components/GridRow.js +1 -1
  181. package/modern/components/cell/GridCell.js +2 -2
  182. package/modern/components/cell/GridEditInputCell.js +2 -2
  183. package/modern/components/cell/GridEditSingleSelectCell.js +2 -2
  184. package/modern/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
  185. package/modern/components/columnHeaders/GridColumnHeaderItem.js +3 -3
  186. package/modern/components/columnHeaders/index.js +1 -0
  187. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
  188. package/modern/components/containers/GridRoot.js +29 -17
  189. package/modern/components/menu/columnMenu/GridColumnMenu.js +1 -1
  190. package/modern/components/panel/GridPreferencesPanel.js +1 -1
  191. package/modern/constants/defaultGridSlotsComponents.js +2 -1
  192. package/modern/hooks/core/pipeProcessing/gridPipeProcessingApi.js +1 -0
  193. package/modern/hooks/core/pipeProcessing/index.js +3 -0
  194. package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +74 -0
  195. package/modern/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
  196. package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
  197. package/modern/hooks/core/useGridInitialization.js +2 -2
  198. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  199. package/modern/hooks/features/columns/gridColumnsUtils.js +49 -17
  200. package/modern/hooks/features/columns/useGridColumns.js +36 -27
  201. package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
  202. package/modern/hooks/features/editRows/useGridCellEditing.new.js +22 -7
  203. package/modern/hooks/features/editRows/useGridRowEditing.new.js +22 -7
  204. package/modern/hooks/features/events/useGridEvents.js +2 -0
  205. package/modern/hooks/features/filter/useGridFilter.js +4 -4
  206. package/modern/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
  207. package/modern/hooks/features/pagination/useGridPage.js +9 -4
  208. package/modern/hooks/features/pagination/useGridPageSize.js +3 -3
  209. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
  210. package/modern/hooks/features/rows/gridRowsUtils.js +11 -0
  211. package/modern/hooks/features/rows/index.js +1 -1
  212. package/modern/hooks/features/rows/useGridRows.js +1 -1
  213. package/modern/hooks/features/rows/useGridRowsMeta.js +3 -3
  214. package/modern/hooks/features/scroll/useGridScroll.js +4 -9
  215. package/modern/hooks/features/selection/useGridSelection.js +72 -25
  216. package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
  217. package/modern/hooks/features/sorting/useGridSorting.js +3 -3
  218. package/modern/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
  219. package/modern/index.js +1 -1
  220. package/modern/internals/index.js +2 -3
  221. package/modern/locales/daDK.js +32 -32
  222. package/modern/models/colDef/index.js +1 -2
  223. package/modern/models/events/gridEvents.js +4 -2
  224. package/modern/models/gridRows.js +1 -31
  225. package/modern/models/index.js +2 -2
  226. package/modern/models/params/gridPreferencePanelParams.js +1 -0
  227. package/modern/models/params/index.js +2 -1
  228. package/node/DataGrid/DataGrid.js +27 -4
  229. package/node/DataGrid/useDataGridComponent.js +2 -5
  230. package/node/colDef/gridDateColDef.js +2 -2
  231. package/node/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
  232. package/node/colDef/index.js +13 -0
  233. package/node/components/GridRow.js +1 -1
  234. package/node/components/cell/GridCell.js +2 -2
  235. package/node/components/cell/GridEditInputCell.js +2 -2
  236. package/node/components/cell/GridEditSingleSelectCell.js +2 -2
  237. package/node/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +23 -5
  238. package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -6
  239. package/node/components/columnHeaders/index.js +13 -0
  240. package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
  241. package/node/components/containers/GridRoot.js +28 -17
  242. package/node/components/menu/columnMenu/GridColumnMenu.js +1 -1
  243. package/node/components/panel/GridPreferencesPanel.js +1 -1
  244. package/node/constants/defaultGridSlotsComponents.js +1 -0
  245. package/node/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
  246. package/node/hooks/core/pipeProcessing/index.js +44 -0
  247. package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +93 -0
  248. package/node/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +4 -4
  249. package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
  250. package/node/hooks/core/useGridInitialization.js +2 -2
  251. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  252. package/node/hooks/features/columns/gridColumnsUtils.js +54 -21
  253. package/node/hooks/features/columns/useGridColumns.js +36 -27
  254. package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
  255. package/node/hooks/features/editRows/useGridCellEditing.new.js +24 -7
  256. package/node/hooks/features/editRows/useGridRowEditing.new.js +24 -7
  257. package/node/hooks/features/events/useGridEvents.js +2 -0
  258. package/node/hooks/features/filter/useGridFilter.js +4 -4
  259. package/node/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +29 -6
  260. package/node/hooks/features/pagination/useGridPage.js +8 -3
  261. package/node/hooks/features/pagination/useGridPageSize.js +3 -3
  262. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +20 -5
  263. package/node/hooks/features/rows/gridRowsUtils.js +18 -0
  264. package/node/hooks/features/rows/index.js +15 -1
  265. package/node/hooks/features/rows/useGridRows.js +5 -5
  266. package/node/hooks/features/rows/useGridRowsMeta.js +3 -3
  267. package/node/hooks/features/scroll/useGridScroll.js +3 -13
  268. package/node/hooks/features/selection/useGridSelection.js +71 -24
  269. package/node/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
  270. package/node/hooks/features/sorting/useGridSorting.js +3 -3
  271. package/node/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
  272. package/node/index.js +1 -1
  273. package/node/internals/index.js +4 -12
  274. package/node/locales/daDK.js +32 -32
  275. package/node/models/colDef/index.js +0 -13
  276. package/node/models/events/gridEvents.js +4 -2
  277. package/node/models/gridRows.js +1 -34
  278. package/node/models/index.js +13 -13
  279. package/node/models/params/gridPreferencePanelParams.js +5 -0
  280. package/node/models/params/index.js +13 -0
  281. package/package.json +1 -1
  282. package/components/columnHeaders/ColumnHeaderFilterIcon.d.ts +0 -5
  283. package/hooks/core/preProcessing/index.d.ts +0 -3
  284. package/hooks/core/preProcessing/index.js +0 -3
  285. package/hooks/core/preProcessing/useGridPreProcessing.d.ts +0 -6
  286. package/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
  287. package/hooks/core/preProcessing/useGridRegisterPreProcessor.d.ts +0 -7
  288. package/hooks/features/keyboard/useGridKeyboard.d.ts +0 -10
  289. package/hooks/features/keyboard/useGridKeyboard.js +0 -70
  290. package/legacy/hooks/core/preProcessing/index.js +0 -3
  291. package/legacy/hooks/core/preProcessing/useGridPreProcessing.js +0 -62
  292. package/legacy/hooks/features/keyboard/useGridKeyboard.js +0 -70
  293. package/modern/hooks/core/preProcessing/index.js +0 -3
  294. package/modern/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
  295. package/modern/hooks/features/keyboard/useGridKeyboard.js +0 -70
  296. package/node/hooks/core/preProcessing/index.js +0 -44
  297. package/node/hooks/core/preProcessing/useGridPreProcessing.js +0 -72
  298. package/node/hooks/features/keyboard/useGridKeyboard.js +0 -91
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
3
4
  import { unstable_composeClasses as composeClasses } from '@mui/material';
4
5
  import IconButton from '@mui/material/IconButton';
5
6
  import Badge from '@mui/material/Badge';
@@ -22,9 +23,11 @@ const useUtilityClasses = ownerState => {
22
23
  return composeClasses(slots, getDataGridUtilityClass, classes);
23
24
  };
24
25
 
25
- export function ColumnHeaderFilterIcon(props) {
26
+ function GridColumnHeaderFilterIconButton(props) {
26
27
  const {
27
- counter
28
+ counter,
29
+ field,
30
+ onClick
28
31
  } = props;
29
32
  const apiRef = useGridApiContext();
30
33
  const rootProps = useGridRootProps();
@@ -47,7 +50,11 @@ export function ColumnHeaderFilterIcon(props) {
47
50
  } else {
48
51
  apiRef.current.showFilterPanel();
49
52
  }
50
- }, [apiRef]);
53
+
54
+ if (onClick) {
55
+ onClick(apiRef.current.getColumnHeaderParams(field), event);
56
+ }
57
+ }, [apiRef, field, onClick]);
51
58
 
52
59
  if (!counter) {
53
60
  return null;
@@ -77,4 +84,15 @@ export function ColumnHeaderFilterIcon(props) {
77
84
  }), counter === 1 && iconButton]
78
85
  })
79
86
  }));
80
- }
87
+ }
88
+
89
+ process.env.NODE_ENV !== "production" ? GridColumnHeaderFilterIconButton.propTypes = {
90
+ // ----------------------------- Warning --------------------------------
91
+ // | These PropTypes are generated from the TypeScript type definitions |
92
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
93
+ // ----------------------------------------------------------------------
94
+ counter: PropTypes.number,
95
+ field: PropTypes.string.isRequired,
96
+ onClick: PropTypes.func
97
+ } : void 0;
98
+ export { GridColumnHeaderFilterIconButton };
@@ -10,7 +10,6 @@ import { GridColumnHeaderSortIcon } from './GridColumnHeaderSortIcon';
10
10
  import { GridColumnHeaderTitle } from './GridColumnHeaderTitle';
11
11
  import { GridColumnHeaderSeparator } from './GridColumnHeaderSeparator';
12
12
  import { ColumnHeaderMenuIcon } from './ColumnHeaderMenuIcon';
13
- import { ColumnHeaderFilterIcon } from './ColumnHeaderFilterIcon';
14
13
  import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
15
14
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
16
15
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
@@ -142,9 +141,10 @@ function GridColumnHeaderItem(props) {
142
141
  const sortingOrder = column.sortingOrder ?? rootProps.sortingOrder;
143
142
 
144
143
  const columnTitleIconButtons = /*#__PURE__*/_jsxs(React.Fragment, {
145
- children: [!rootProps.disableColumnFilter && /*#__PURE__*/_jsx(ColumnHeaderFilterIcon, {
144
+ children: [!rootProps.disableColumnFilter && /*#__PURE__*/_jsx(rootProps.components.ColumnHeaderFilterIconButton, _extends({
145
+ field: column.field,
146
146
  counter: filterItemsCounter
147
- }), column.sortable && !column.hideSortIcons && /*#__PURE__*/_jsx(GridColumnHeaderSortIcon, {
147
+ }, rootProps.componentsProps?.columnHeaderFilterIconButton)), column.sortable && !column.hideSortIcons && /*#__PURE__*/_jsx(GridColumnHeaderSortIcon, {
148
148
  direction: sortDirection,
149
149
  index: sortIndex,
150
150
  sortingOrder: sortingOrder
@@ -1,4 +1,5 @@
1
1
  export * from './GridColumnHeaderItem';
2
2
  export * from './GridColumnHeaderSeparator';
3
3
  export * from './GridColumnHeaderSortIcon';
4
+ export * from './GridColumnHeaderFilterIconButton';
4
5
  export * from './GridColumnHeaderTitle';
@@ -121,7 +121,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
121
121
  * Get the cell value of a row and field.
122
122
  * @param {GridRowId} id The row id.
123
123
  * @param {string} field The field.
124
- * @returns {GridCellValue} The cell value.
124
+ * @returns {any} The cell value.
125
125
  * @deprecated Use `params.row` to directly access the fields you want instead.
126
126
  */
127
127
  getValue: PropTypes.func.isRequired,
@@ -144,7 +144,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
144
144
  /**
145
145
  * The row model of the row that the current cell belongs to.
146
146
  */
147
- row: PropTypes.any.isRequired,
147
+ row: PropTypes.object.isRequired,
148
148
 
149
149
  /**
150
150
  * The node of the row that the current cell belongs to.
@@ -4,8 +4,7 @@ const _excluded = ["children", "className"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
- import { useForkRef } from '@mui/material/utils';
8
- import NoSsr from '@mui/material/NoSsr';
7
+ import { useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
9
8
  import { GridRootStyles } from './GridRootStyles';
10
9
  import { gridVisibleColumnDefinitionsSelector } from '../../hooks/features/columns/gridColumnsSelector';
11
10
  import { useGridSelector } from '../../hooks/utils/useGridSelector';
@@ -28,21 +27,34 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
28
27
  const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
29
28
  const rootContainerRef = React.useRef(null);
30
29
  const handleRef = useForkRef(rootContainerRef, ref);
31
- apiRef.current.rootElementRef = rootContainerRef;
32
- return /*#__PURE__*/_jsx(NoSsr, {
33
- children: /*#__PURE__*/_jsx(GridRootStyles, _extends({
34
- ref: handleRef,
35
- className: clsx(className, rootProps.classes?.root, gridClasses.root, rootProps.autoHeight && gridClasses.autoHeight),
36
- role: "grid",
37
- "aria-colcount": visibleColumns.length,
38
- "aria-rowcount": totalRowCount,
39
- "aria-multiselectable": !rootProps.disableMultipleSelection,
40
- "aria-label": rootProps['aria-label'],
41
- "aria-labelledby": rootProps['aria-labelledby']
42
- }, other, {
43
- children: children
44
- }))
45
- });
30
+ apiRef.current.rootElementRef = rootContainerRef; // Our implementation of <NoSsr />
31
+
32
+ const [mountedState, setMountedState] = React.useState(false);
33
+ useEnhancedEffect(() => {
34
+ setMountedState(true);
35
+ }, []);
36
+ useEnhancedEffect(() => {
37
+ if (mountedState) {
38
+ apiRef.current.unstable_updateGridDimensionsRef();
39
+ }
40
+ }, [apiRef, mountedState]);
41
+
42
+ if (!mountedState) {
43
+ return null;
44
+ }
45
+
46
+ return /*#__PURE__*/_jsx(GridRootStyles, _extends({
47
+ ref: handleRef,
48
+ className: clsx(className, rootProps.classes?.root, gridClasses.root, rootProps.autoHeight && gridClasses.autoHeight),
49
+ role: "grid",
50
+ "aria-colcount": visibleColumns.length,
51
+ "aria-rowcount": totalRowCount,
52
+ "aria-multiselectable": !rootProps.disableMultipleSelection,
53
+ "aria-label": rootProps['aria-label'],
54
+ "aria-labelledby": rootProps['aria-labelledby']
55
+ }, other, {
56
+ children: children
57
+ }));
46
58
  });
47
59
  process.env.NODE_ENV !== "production" ? GridRoot.propTypes = {
48
60
  // ----------------------------- Warning --------------------------------
@@ -30,7 +30,7 @@ const GridColumnMenu = /*#__PURE__*/React.forwardRef(function GridColumnMenu(pro
30
30
  onClick: hideMenu,
31
31
  column: currentColumn
32
32
  })];
33
- const preProcessedButtons = apiRef.current.unstable_applyPreProcessors('columnMenu', defaultButtons, currentColumn);
33
+ const preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('columnMenu', defaultButtons, currentColumn);
34
34
  return /*#__PURE__*/_jsx(GridColumnMenuContainer, _extends({
35
35
  ref: ref
36
36
  }, props, {
@@ -12,7 +12,7 @@ export const GridPreferencesPanel = /*#__PURE__*/React.forwardRef(function GridP
12
12
  const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
13
13
  const rootProps = useGridRootProps();
14
14
  const preferencePanelState = useGridSelector(apiRef, gridPreferencePanelStateSelector);
15
- const panelContent = apiRef.current.unstable_applyPreProcessors('preferencePanel', null, preferencePanelState.openedPanelValue ?? GridPreferencePanelsValue.filters);
15
+ const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, preferencePanelState.openedPanelValue ?? GridPreferencePanelsValue.filters);
16
16
  return /*#__PURE__*/_jsx(rootProps.components.Panel, _extends({
17
17
  ref: ref,
18
18
  as: rootProps.components.BasePopper,
@@ -7,7 +7,7 @@ import MUISwitch from '@mui/material/Switch';
7
7
  import MUIButton from '@mui/material/Button';
8
8
  import MUITooltip from '@mui/material/Tooltip';
9
9
  import MUIPopper from '@mui/material/Popper';
10
- import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnMenu, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridHeader, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon } from '../components';
10
+ import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnMenu, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridHeader, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon, GridColumnHeaderFilterIconButton } from '../components';
11
11
  import { GridColumnUnsortedIcon } from '../components/columnHeaders/GridColumnUnsortedIcon';
12
12
  import { ErrorOverlay } from '../components/ErrorOverlay';
13
13
  import { GridNoResultsOverlay } from '../components/GridNoResultsOverlay';
@@ -49,6 +49,7 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, DEFAULT_GRID_ICON
49
49
  BaseTooltip: MUITooltip,
50
50
  BasePopper: MUIPopper,
51
51
  Cell: GridCell,
52
+ ColumnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
52
53
  ColumnMenu: GridColumnMenu,
53
54
  ErrorOverlay,
54
55
  Footer: GridFooter,
@@ -0,0 +1,3 @@
1
+ export * from './gridPipeProcessingApi';
2
+ export * from './useGridPipeProcessing';
3
+ export * from './useGridRegisterPipeProcessor';
@@ -0,0 +1,74 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import { useGridApiMethod } from '../../utils/useGridApiMethod';
6
+ import { GridEvents } from '../../../models/events';
7
+ /**
8
+ * Implement the Pipeline Pattern
9
+ *
10
+ * More information and detailed example in (TODO add link to technical doc when ready)
11
+ *
12
+ * Some plugins contains custom logic to enrich data provided by other plugins or components.
13
+ * For instance, the row grouping plugin needs to add / remove the grouping columns when the grid columns are updated.
14
+ *
15
+ * =====================================================================================================================
16
+ *
17
+ * The plugin containing the custom logic must use:
18
+ *
19
+ * - `useGridRegisterPipeProcessor` to register their processor.
20
+ * When the processor changes, it will fire `GridEvents.pipeProcessorRegister` to re-apply the whole pipe.
21
+ *
22
+ * =====================================================================================================================
23
+ *
24
+ * The plugin or component that needs to enrich its data must use:
25
+ *
26
+ * - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.
27
+ *
28
+ * - `GridEvents.pipeProcessorRegister` to re-apply the whole pipe when a processor of this pipe changes.
29
+ *
30
+ */
31
+
32
+ export const useGridPipeProcessing = apiRef => {
33
+ const processorsCache = React.useRef({});
34
+ const registerPipeProcessor = React.useCallback((group, id, processor) => {
35
+ if (!processorsCache.current[group]) {
36
+ processorsCache.current[group] = {};
37
+ }
38
+
39
+ const groupProcessors = processorsCache.current[group];
40
+ const oldProcessor = groupProcessors[id];
41
+
42
+ if (oldProcessor !== processor) {
43
+ processorsCache.current[group] = _extends({}, groupProcessors, {
44
+ [id]: processor
45
+ });
46
+ apiRef.current.publishEvent(GridEvents.pipeProcessorRegister, group);
47
+ }
48
+
49
+ return () => {
50
+ const _ref = processorsCache.current[group],
51
+ otherProcessors = _objectWithoutPropertiesLoose(_ref, [id].map(_toPropertyKey));
52
+
53
+ processorsCache.current[group] = otherProcessors;
54
+ apiRef.current.publishEvent(GridEvents.pipeProcessorUnregister, group);
55
+ };
56
+ }, [apiRef]);
57
+ const applyPipeProcessors = React.useCallback((...args) => {
58
+ const [group, value, context] = args;
59
+
60
+ if (!processorsCache.current[group]) {
61
+ return value;
62
+ }
63
+
64
+ const preProcessors = Object.values(processorsCache.current[group]);
65
+ return preProcessors.reduce((acc, preProcessor) => {
66
+ return preProcessor(acc, context);
67
+ }, value);
68
+ }, []);
69
+ const preProcessingApi = {
70
+ unstable_registerPipeProcessor: registerPipeProcessor,
71
+ unstable_applyPipeProcessors: applyPipeProcessors
72
+ };
73
+ useGridApiMethod(apiRef, preProcessingApi, 'GridPipeProcessingApi');
74
+ };
@@ -4,11 +4,11 @@ import { useFirstRender } from '../../utils/useFirstRender';
4
4
  /**
5
5
  * TODO: Rename `useGridRegisterPipeProcessor`
6
6
  */
7
- export const useGridRegisterPreProcessor = (apiRef, group, callback) => {
7
+ export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
8
8
  const cleanup = React.useRef();
9
9
  const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
10
10
  const registerPreProcessor = React.useCallback(() => {
11
- cleanup.current = apiRef.current.unstable_registerPreProcessor(group, id.current, callback);
11
+ cleanup.current = apiRef.current.unstable_registerPipeProcessor(group, id.current, callback);
12
12
  }, [apiRef, callback, group]);
13
13
  useFirstRender(() => {
14
14
  registerPreProcessor();
@@ -13,31 +13,42 @@ export const GRID_STRATEGIES_PROCESSORS = {
13
13
  /**
14
14
  * Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
15
15
  *
16
- * Some plugins contain custom logic that must only be run if the right strategy is active.
17
- * For instance, the tree data plugin has:
18
- * - custom row tree creation algorithm.
19
- * - custom sorting algorithm.
20
- * - custom filtering algorithm.
16
+ * More information and detailed example in (TODO add link to technical doc when ready)
17
+ *
18
+ * Some plugins contains custom logic that must only be applied if the right strategy is active.
19
+ * For instance, the row grouping plugin has a custom filtering algorithm.
20
+ * This algorithm must be applied by the filtering plugin if the row grouping is the current way of grouping rows,
21
+ * but not if the tree data is the current way of grouping rows.
22
+ *
23
+ * =====================================================================================================================
24
+ *
25
+ * The plugin containing the custom logic must use:
26
+ *
27
+ * - `useGridRegisterStrategyProcessor` to register their processor.
28
+ * When the processor of the active strategy changes, it will fire `GridEvents.activeStrategyProcessorChange` to re-apply the processor.
21
29
  *
22
- * These plugins must use:
23
- * - `apiRef.current.unstable_registerStrategyProcessor` to register their processors.
24
30
  * - `apiRef.current.unstable_setStrategyAvailability` to tell if their strategy can be used.
25
31
  *
26
- * Some hooks need to run the custom logic of the active strategy.
27
- * For instance, the `useGridFiltering` wants to run:
28
- * - the tree data filtering if the tree data is the current way of grouping rows.
29
- * - the row grouping filtering if the row grouping is the current way of grouping rows.
30
- * - the flat filtering if there is no grouping of the rows (equivalent to the "none" strategy).
32
+ * =====================================================================================================================
33
+ *
34
+ * The plugin or component that needs to apply the custom logic of the current strategy must use:
35
+ *
36
+ * - `apiRef.current.unstable_applyStrategyProcessor` to run the processor of the active strategy for a given processor name.
31
37
  *
32
- * These hooks must use:
33
- * - `apiRef.current.unstable_applyStrategyProcessor` to run a processor.
34
38
  * - `GridEvents.strategyAvailabilityChange` to update something when the active strategy changes.
35
39
  * Warning: Be careful not to apply the processor several times.
36
40
  * For instance `GridEvents.rowsSet` is fired by `useGridRows` whenever the active strategy changes.
37
41
  * So listening to both would most likely run your logic twice.
38
- * - `GridEvents.activeStrategyProcessorChange` to update something when the processor of the active strategy changes
42
+ *
43
+ * - `GridEvents.activeStrategyProcessorChange` to update something when the processor of the active strategy changes.
44
+ *
45
+ * =====================================================================================================================
39
46
  *
40
47
  * Each processor name is part of a strategy group which can only have one active strategy at the time.
48
+ * For now, there is only one strategy group named `rowTree` which customize
49
+ * - row tree creation algorithm.
50
+ * - sorting algorithm.
51
+ * - filtering algorithm.
41
52
  */
42
53
  export const useGridStrategyProcessing = apiRef => {
43
54
  const availableStrategies = React.useRef(new Map());
@@ -2,7 +2,7 @@ import { useGridLoggerFactory } from './useGridLoggerFactory';
2
2
  import { useGridApiInitialization } from './useGridApiInitialization';
3
3
  import { useGridErrorHandler } from './useGridErrorHandler';
4
4
  import { useGridLocaleText } from './useGridLocaleText';
5
- import { useGridPreProcessing } from './preProcessing';
5
+ import { useGridPipeProcessing } from './pipeProcessing';
6
6
  import { useGridStrategyProcessing } from './strategyProcessing';
7
7
  import { useGridStateInitialization } from './useGridStateInitialization';
8
8
  /**
@@ -14,7 +14,7 @@ export const useGridInitialization = (inputApiRef, props) => {
14
14
  useGridLoggerFactory(apiRef, props);
15
15
  useGridErrorHandler(apiRef, props);
16
16
  useGridStateInitialization(apiRef, props);
17
- useGridPreProcessing(apiRef);
17
+ useGridPipeProcessing(apiRef);
18
18
  useGridStrategyProcessing(apiRef);
19
19
  useGridLocaleText(apiRef, props);
20
20
  return apiRef;
@@ -113,7 +113,7 @@ export const useGridColumnHeaders = props => {
113
113
  column: column,
114
114
  colIndex: columnIndex,
115
115
  isResizing: resizeCol === column.field,
116
- isLastColumn: columnIndex === columns.length - 1,
116
+ isLastColumn: columnIndex === visibleColumns.length - 1,
117
117
  extendRowFullWidth: !rootProps.disableExtendRowFullWidth,
118
118
  hasFocus: hasFocus,
119
119
  tabIndex: tabIndex
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { DEFAULT_GRID_COL_TYPE_KEY, getGridDefaultColumnTypes } from '../../../models';
2
+ import { DEFAULT_GRID_COL_TYPE_KEY, getGridDefaultColumnTypes } from '../../../colDef';
3
3
  import { gridColumnsSelector, gridColumnVisibilityModelSelector } from './gridColumnsSelector';
4
4
  import { clamp } from '../../../utils/utils';
5
5
  export const COLUMNS_DIMENSION_PROPERTIES = ['maxWidth', 'minWidth', 'width', 'flex'];
@@ -243,7 +243,7 @@ export const createColumnsState = ({
243
243
  apiRef,
244
244
  columnsToUpsert,
245
245
  initialState,
246
- columnsTypes,
246
+ columnTypes,
247
247
  currentColumnVisibilityModel = gridColumnVisibilityModelSelector(apiRef),
248
248
  shouldRegenColumnVisibilityModelFromColumns,
249
249
  keepOnlyColumnsToUpsert = false
@@ -251,7 +251,7 @@ export const createColumnsState = ({
251
251
  const isInsideStateInitializer = !apiRef.current.state.columns;
252
252
  let columnsStateWithoutColumnVisibilityModel;
253
253
 
254
- if (isInsideStateInitializer || keepOnlyColumnsToUpsert) {
254
+ if (isInsideStateInitializer) {
255
255
  columnsStateWithoutColumnVisibilityModel = {
256
256
  all: [],
257
257
  lookup: {}
@@ -259,33 +259,65 @@ export const createColumnsState = ({
259
259
  } else {
260
260
  const currentState = gridColumnsSelector(apiRef.current.state);
261
261
  columnsStateWithoutColumnVisibilityModel = {
262
- all: [...currentState.all],
263
- lookup: _extends({}, currentState.lookup)
262
+ all: keepOnlyColumnsToUpsert ? [] : [...currentState.all],
263
+ lookup: _extends({}, currentState.lookup) // Will be cleaned later if keepOnlyColumnsToUpsert=true
264
+
264
265
  };
265
266
  }
266
267
 
268
+ let columnsToKeep = {};
269
+
270
+ if (keepOnlyColumnsToUpsert && !isInsideStateInitializer) {
271
+ columnsToKeep = Object.keys(columnsStateWithoutColumnVisibilityModel.lookup).reduce((acc, key) => _extends({}, acc, {
272
+ [key]: false
273
+ }), {});
274
+ }
275
+
267
276
  const columnsToUpsertLookup = {};
268
277
  columnsToUpsert.forEach(newColumn => {
269
- columnsToUpsertLookup[newColumn.field] = true;
270
-
271
- if (columnsStateWithoutColumnVisibilityModel.lookup[newColumn.field] == null) {
278
+ const {
279
+ field
280
+ } = newColumn;
281
+ columnsToUpsertLookup[field] = true;
282
+ columnsToKeep[field] = true;
283
+ let existingState = columnsStateWithoutColumnVisibilityModel.lookup[field];
284
+
285
+ if (existingState == null) {
272
286
  // New Column
273
- columnsStateWithoutColumnVisibilityModel.lookup[newColumn.field] = _extends({}, getGridColDef(columnsTypes, newColumn.type), newColumn);
274
- columnsStateWithoutColumnVisibilityModel.all.push(newColumn.field);
275
- } else {
276
- const mergedColumn = _extends({}, columnsStateWithoutColumnVisibilityModel.lookup[newColumn.field], newColumn);
287
+ existingState = _extends({}, getGridColDef(columnTypes, newColumn.type), {
288
+ // TODO v6: Inline `getGridColDef`
289
+ field,
290
+ hasBeenResized: false
291
+ });
292
+ columnsStateWithoutColumnVisibilityModel.all.push(field);
293
+ } else if (keepOnlyColumnsToUpsert) {
294
+ columnsStateWithoutColumnVisibilityModel.all.push(field);
295
+ }
277
296
 
278
- if (!mergedColumn.hasBeenResized && COLUMNS_DIMENSION_PROPERTIES.some(propertyName => newColumn[propertyName] !== undefined)) {
279
- mergedColumn.hasBeenResized = true;
280
- }
297
+ let hasValidDimension = false;
281
298
 
282
- columnsStateWithoutColumnVisibilityModel.lookup[newColumn.field] = mergedColumn;
299
+ if (!existingState.hasBeenResized) {
300
+ hasValidDimension = COLUMNS_DIMENSION_PROPERTIES.some(key => newColumn[key] !== undefined);
283
301
  }
302
+
303
+ columnsStateWithoutColumnVisibilityModel.lookup[field] = _extends({}, existingState, {
304
+ hide: newColumn.hide == null ? false : newColumn.hide
305
+ }, newColumn, {
306
+ hasBeenResized: existingState.hasBeenResized || hasValidDimension
307
+ });
284
308
  });
285
309
 
310
+ if (keepOnlyColumnsToUpsert && !isInsideStateInitializer) {
311
+ Object.keys(columnsStateWithoutColumnVisibilityModel.lookup).forEach(field => {
312
+ if (!columnsToKeep[field]) {
313
+ delete columnsStateWithoutColumnVisibilityModel.lookup[field];
314
+ }
315
+ });
316
+ }
317
+
286
318
  const columnsLookupBeforePreProcessing = _extends({}, columnsStateWithoutColumnVisibilityModel.lookup);
287
319
 
288
- const columnsStateWithPreProcessing = apiRef.current.unstable_applyPreProcessors('hydrateColumns', columnsStateWithoutColumnVisibilityModel); // TODO v6: remove the sync between the columns `hide` option and the model.
320
+ const columnsStateWithPreProcessing = apiRef.current.unstable_applyPipeProcessors('hydrateColumns', columnsStateWithoutColumnVisibilityModel); // TODO v6: remove the sync between the columns `hide` option and the model.
289
321
 
290
322
  let columnVisibilityModel = {};
291
323