@mui/x-data-grid 5.13.1 → 5.14.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 (269) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/DataGrid/useDataGridComponent.js +1 -1
  3. package/colDef/gridActionsColDef.js +2 -0
  4. package/colDef/gridBooleanColDef.js +3 -1
  5. package/colDef/gridCheckboxSelectionColDef.js +2 -0
  6. package/colDef/gridDateOperators.d.ts +1 -1
  7. package/colDef/gridStringColDef.d.ts +3 -0
  8. package/colDef/gridStringColDef.js +6 -0
  9. package/components/base/GridOverlays.js +4 -1
  10. package/components/cell/GridBooleanCell.d.ts +5 -2
  11. package/components/cell/GridBooleanCell.js +93 -2
  12. package/components/cell/GridEditDateCell.js +5 -1
  13. package/components/cell/index.d.ts +1 -0
  14. package/components/cell/index.js +1 -0
  15. package/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
  16. package/components/containers/GridRootStyles.js +10 -0
  17. package/components/toolbar/GridToolbarExport.js +20 -10
  18. package/constants/gridClasses.d.ts +25 -1
  19. package/constants/gridClasses.js +1 -1
  20. package/constants/localeTextConstants.js +8 -1
  21. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +2 -1
  22. package/hooks/features/columns/useGridColumnSpanning.js +9 -7
  23. package/hooks/features/columns/useGridColumns.d.ts +1 -1
  24. package/hooks/features/columns/useGridColumns.js +13 -6
  25. package/hooks/features/export/utils.d.ts +1 -1
  26. package/hooks/features/export/utils.js +9 -2
  27. package/hooks/features/filter/gridFilterUtils.js +6 -0
  28. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  29. package/hooks/features/filter/useGridFilter.js +11 -4
  30. package/hooks/features/pagination/useGridPage.js +4 -3
  31. package/hooks/features/pagination/useGridPageSize.js +4 -3
  32. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
  33. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
  34. package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  35. package/hooks/features/selection/useGridSelection.js +24 -10
  36. package/hooks/features/sorting/gridSortingUtils.d.ts +1 -0
  37. package/hooks/features/sorting/gridSortingUtils.js +10 -11
  38. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  39. package/hooks/features/sorting/useGridSorting.js +34 -6
  40. package/hooks/features/statePersistence/gridStatePersistenceInterface.d.ts +12 -1
  41. package/hooks/features/statePersistence/index.d.ts +1 -1
  42. package/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
  43. package/hooks/features/virtualization/useGridVirtualScroller.js +3 -4
  44. package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
  45. package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
  46. package/hooks/utils/useGridNativeEventListener.js +1 -1
  47. package/index.js +1 -1
  48. package/internals/index.d.ts +2 -2
  49. package/internals/index.js +2 -2
  50. package/legacy/DataGrid/useDataGridComponent.js +1 -1
  51. package/legacy/colDef/gridActionsColDef.js +2 -0
  52. package/legacy/colDef/gridBooleanColDef.js +3 -1
  53. package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -0
  54. package/legacy/colDef/gridStringColDef.js +6 -0
  55. package/legacy/components/base/GridOverlays.js +4 -1
  56. package/legacy/components/cell/GridBooleanCell.js +93 -2
  57. package/legacy/components/cell/GridEditDateCell.js +5 -1
  58. package/legacy/components/cell/index.js +1 -0
  59. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +6 -1
  60. package/legacy/components/containers/GridRootStyles.js +3 -3
  61. package/legacy/components/toolbar/GridToolbarExport.js +20 -10
  62. package/legacy/constants/gridClasses.js +1 -1
  63. package/legacy/constants/localeTextConstants.js +8 -1
  64. package/legacy/hooks/features/columns/useGridColumnSpanning.js +9 -7
  65. package/legacy/hooks/features/columns/useGridColumns.js +13 -8
  66. package/legacy/hooks/features/export/utils.js +9 -2
  67. package/legacy/hooks/features/filter/gridFilterUtils.js +6 -0
  68. package/legacy/hooks/features/filter/useGridFilter.js +11 -4
  69. package/legacy/hooks/features/pagination/useGridPage.js +4 -3
  70. package/legacy/hooks/features/pagination/useGridPageSize.js +4 -3
  71. package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
  72. package/legacy/hooks/features/selection/useGridSelection.js +26 -12
  73. package/legacy/hooks/features/sorting/gridSortingUtils.js +11 -12
  74. package/legacy/hooks/features/sorting/useGridSorting.js +34 -6
  75. package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +2 -1
  76. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +3 -4
  77. package/legacy/hooks/utils/useGridNativeEventListener.js +1 -1
  78. package/legacy/index.js +1 -1
  79. package/legacy/internals/index.js +2 -2
  80. package/legacy/locales/arSD.js +7 -0
  81. package/legacy/locales/bgBG.js +7 -0
  82. package/legacy/locales/csCZ.js +7 -0
  83. package/legacy/locales/daDK.js +7 -0
  84. package/legacy/locales/deDE.js +8 -1
  85. package/legacy/locales/elGR.js +7 -0
  86. package/legacy/locales/esES.js +7 -0
  87. package/legacy/locales/faIR.js +7 -0
  88. package/legacy/locales/fiFI.js +7 -0
  89. package/legacy/locales/frFR.js +8 -1
  90. package/legacy/locales/heIL.js +8 -1
  91. package/legacy/locales/huHU.js +7 -0
  92. package/legacy/locales/index.js +2 -1
  93. package/legacy/locales/itIT.js +7 -0
  94. package/legacy/locales/jaJP.js +8 -1
  95. package/legacy/locales/koKR.js +7 -0
  96. package/legacy/locales/nbNO.js +8 -1
  97. package/legacy/locales/nlNL.js +8 -1
  98. package/legacy/locales/plPL.js +7 -0
  99. package/legacy/locales/ptBR.js +8 -1
  100. package/legacy/locales/roRO.js +8 -1
  101. package/legacy/locales/ruRU.js +7 -0
  102. package/legacy/locales/skSK.js +8 -1
  103. package/legacy/locales/svSE.js +8 -1
  104. package/legacy/locales/trTR.js +7 -0
  105. package/legacy/locales/ukUA.js +7 -0
  106. package/legacy/locales/viVN.js +7 -0
  107. package/legacy/locales/zhCN.js +7 -0
  108. package/legacy/locales/zhTW.js +135 -0
  109. package/legacy/models/events/gridEvents.js +1 -0
  110. package/locales/arSD.js +7 -0
  111. package/locales/bgBG.js +7 -0
  112. package/locales/csCZ.js +7 -0
  113. package/locales/daDK.js +7 -0
  114. package/locales/deDE.js +8 -1
  115. package/locales/elGR.js +7 -0
  116. package/locales/esES.js +7 -0
  117. package/locales/faIR.js +7 -0
  118. package/locales/fiFI.js +7 -0
  119. package/locales/frFR.js +8 -1
  120. package/locales/heIL.js +8 -1
  121. package/locales/huHU.js +7 -0
  122. package/locales/index.d.ts +1 -0
  123. package/locales/index.js +2 -1
  124. package/locales/itIT.js +7 -0
  125. package/locales/jaJP.js +8 -1
  126. package/locales/koKR.js +7 -0
  127. package/locales/nbNO.js +8 -1
  128. package/locales/nlNL.js +8 -1
  129. package/locales/plPL.js +7 -0
  130. package/locales/ptBR.js +8 -1
  131. package/locales/roRO.js +8 -1
  132. package/locales/ruRU.js +7 -0
  133. package/locales/skSK.js +8 -1
  134. package/locales/svSE.js +8 -1
  135. package/locales/trTR.js +7 -0
  136. package/locales/ukUA.js +7 -0
  137. package/locales/viVN.js +7 -0
  138. package/locales/zhCN.js +7 -0
  139. package/locales/zhTW.d.ts +2 -0
  140. package/locales/zhTW.js +123 -0
  141. package/models/api/gridColumnSpanning.d.ts +2 -0
  142. package/models/api/gridLocaleTextApi.d.ts +8 -2
  143. package/models/api/gridSelectionApi.d.ts +6 -0
  144. package/models/events/gridEvents.d.ts +1 -0
  145. package/models/events/gridEvents.js +1 -0
  146. package/models/gridRows.d.ts +10 -1
  147. package/models/params/gridCellParams.d.ts +4 -4
  148. package/modern/DataGrid/useDataGridComponent.js +1 -1
  149. package/modern/colDef/gridActionsColDef.js +2 -0
  150. package/modern/colDef/gridBooleanColDef.js +3 -1
  151. package/modern/colDef/gridCheckboxSelectionColDef.js +2 -0
  152. package/modern/colDef/gridStringColDef.js +6 -0
  153. package/modern/components/base/GridOverlays.js +4 -1
  154. package/modern/components/cell/GridBooleanCell.js +93 -2
  155. package/modern/components/cell/GridEditDateCell.js +5 -1
  156. package/modern/components/cell/index.js +1 -0
  157. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
  158. package/modern/components/containers/GridRootStyles.js +10 -0
  159. package/modern/components/toolbar/GridToolbarExport.js +20 -10
  160. package/modern/constants/gridClasses.js +1 -1
  161. package/modern/constants/localeTextConstants.js +8 -1
  162. package/modern/hooks/features/columns/useGridColumnSpanning.js +9 -7
  163. package/modern/hooks/features/columns/useGridColumns.js +10 -5
  164. package/modern/hooks/features/export/utils.js +5 -2
  165. package/modern/hooks/features/filter/gridFilterUtils.js +6 -0
  166. package/modern/hooks/features/filter/useGridFilter.js +8 -3
  167. package/modern/hooks/features/pagination/useGridPage.js +4 -3
  168. package/modern/hooks/features/pagination/useGridPageSize.js +4 -3
  169. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +8 -4
  170. package/modern/hooks/features/selection/useGridSelection.js +22 -10
  171. package/modern/hooks/features/sorting/gridSortingUtils.js +10 -11
  172. package/modern/hooks/features/sorting/useGridSorting.js +30 -6
  173. package/modern/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
  174. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +3 -4
  175. package/modern/hooks/utils/useGridNativeEventListener.js +1 -1
  176. package/modern/index.js +1 -1
  177. package/modern/internals/index.js +2 -2
  178. package/modern/locales/arSD.js +7 -0
  179. package/modern/locales/bgBG.js +7 -0
  180. package/modern/locales/csCZ.js +7 -0
  181. package/modern/locales/daDK.js +7 -0
  182. package/modern/locales/deDE.js +8 -1
  183. package/modern/locales/elGR.js +7 -0
  184. package/modern/locales/esES.js +7 -0
  185. package/modern/locales/faIR.js +7 -0
  186. package/modern/locales/fiFI.js +7 -0
  187. package/modern/locales/frFR.js +8 -1
  188. package/modern/locales/heIL.js +8 -1
  189. package/modern/locales/huHU.js +7 -0
  190. package/modern/locales/index.js +2 -1
  191. package/modern/locales/itIT.js +7 -0
  192. package/modern/locales/jaJP.js +8 -1
  193. package/modern/locales/koKR.js +7 -0
  194. package/modern/locales/nbNO.js +8 -1
  195. package/modern/locales/nlNL.js +8 -1
  196. package/modern/locales/plPL.js +7 -0
  197. package/modern/locales/ptBR.js +8 -1
  198. package/modern/locales/roRO.js +8 -1
  199. package/modern/locales/ruRU.js +7 -0
  200. package/modern/locales/skSK.js +8 -1
  201. package/modern/locales/svSE.js +8 -1
  202. package/modern/locales/trTR.js +7 -0
  203. package/modern/locales/ukUA.js +7 -0
  204. package/modern/locales/viVN.js +7 -0
  205. package/modern/locales/zhCN.js +7 -0
  206. package/modern/locales/zhTW.js +123 -0
  207. package/modern/models/events/gridEvents.js +1 -0
  208. package/node/DataGrid/useDataGridComponent.js +1 -1
  209. package/node/colDef/gridActionsColDef.js +2 -0
  210. package/node/colDef/gridBooleanColDef.js +3 -1
  211. package/node/colDef/gridCheckboxSelectionColDef.js +2 -0
  212. package/node/colDef/gridStringColDef.js +5 -0
  213. package/node/components/base/GridOverlays.js +4 -1
  214. package/node/components/cell/GridBooleanCell.js +93 -2
  215. package/node/components/cell/GridEditDateCell.js +7 -1
  216. package/node/components/cell/index.js +13 -0
  217. package/node/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
  218. package/node/components/containers/GridRootStyles.js +10 -0
  219. package/node/components/toolbar/GridToolbarExport.js +16 -10
  220. package/node/constants/gridClasses.js +1 -1
  221. package/node/constants/localeTextConstants.js +8 -1
  222. package/node/hooks/features/columns/useGridColumnSpanning.js +9 -7
  223. package/node/hooks/features/columns/useGridColumns.js +13 -6
  224. package/node/hooks/features/export/utils.js +10 -2
  225. package/node/hooks/features/filter/gridFilterUtils.js +7 -0
  226. package/node/hooks/features/filter/useGridFilter.js +11 -4
  227. package/node/hooks/features/pagination/useGridPage.js +4 -3
  228. package/node/hooks/features/pagination/useGridPageSize.js +4 -3
  229. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
  230. package/node/hooks/features/selection/useGridSelection.js +24 -10
  231. package/node/hooks/features/sorting/gridSortingUtils.js +10 -11
  232. package/node/hooks/features/sorting/useGridSorting.js +34 -6
  233. package/node/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
  234. package/node/hooks/features/virtualization/useGridVirtualScroller.js +3 -4
  235. package/node/hooks/utils/useGridNativeEventListener.js +1 -1
  236. package/node/index.js +1 -1
  237. package/node/internals/index.js +18 -0
  238. package/node/locales/arSD.js +7 -0
  239. package/node/locales/bgBG.js +7 -0
  240. package/node/locales/csCZ.js +7 -0
  241. package/node/locales/daDK.js +7 -0
  242. package/node/locales/deDE.js +8 -1
  243. package/node/locales/elGR.js +7 -0
  244. package/node/locales/esES.js +7 -0
  245. package/node/locales/faIR.js +7 -0
  246. package/node/locales/fiFI.js +7 -0
  247. package/node/locales/frFR.js +8 -1
  248. package/node/locales/heIL.js +8 -1
  249. package/node/locales/huHU.js +7 -0
  250. package/node/locales/index.js +13 -0
  251. package/node/locales/itIT.js +7 -0
  252. package/node/locales/jaJP.js +8 -1
  253. package/node/locales/koKR.js +7 -0
  254. package/node/locales/nbNO.js +8 -1
  255. package/node/locales/nlNL.js +8 -1
  256. package/node/locales/plPL.js +7 -0
  257. package/node/locales/ptBR.js +8 -1
  258. package/node/locales/roRO.js +8 -1
  259. package/node/locales/ruRU.js +7 -0
  260. package/node/locales/skSK.js +8 -1
  261. package/node/locales/svSE.js +8 -1
  262. package/node/locales/trTR.js +7 -0
  263. package/node/locales/ukUA.js +7 -0
  264. package/node/locales/viVN.js +7 -0
  265. package/node/locales/zhCN.js +7 -0
  266. package/node/locales/zhTW.js +133 -0
  267. package/node/models/events/gridEvents.js +1 -0
  268. package/package.json +1 -1
  269. package/utils/getGridLocalization.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 5.14.0
7
+
8
+ _Jul 21, 2022_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
13
+ - ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
14
+ - 🌍 Improvements to different locales
15
+ - 📚 Documentation improvements
16
+ - 🐞 Bugfixes
17
+
18
+ ### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
19
+
20
+ #### Changes
21
+
22
+ - [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
23
+ - [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
24
+ - [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
25
+ - [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
26
+ - [DataGrid] Fix loading overlay position (#5558) @DanailH
27
+ - [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
28
+ - [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
29
+ - [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
30
+ - [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
31
+
32
+ ### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
33
+
34
+ #### Changes
35
+
36
+ - [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
37
+
38
+ ### Docs
39
+
40
+ - [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
41
+ - [docs] Remove blank line @oliviertassinari
42
+
43
+ ### Core
44
+
45
+ - [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
46
+ - [core] Polish on the bug issue template (#5525) @oliviertassinari
47
+ - [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
48
+
6
49
  ## 5.13.1
7
50
 
8
51
  _Jul 15, 2022_
@@ -1466,7 +1509,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
1466
1509
  - [core] Fix `yarn prettier` script (#3292) @oliviertassinari
1467
1510
  - [core] Improve tests for Tree Data (#3366) @flaviendelangle
1468
1511
  - [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
1469
- - [core] Transition to a new StackOverflow tag (#3308) @oliviertassinari
1512
+ - [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
1470
1513
  - [core] Update monorepo (#3370) @flaviendelangle
1471
1514
  - [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
1472
1515
  - [test] Replace `useFakeTimers` (#3323) @m4theushw
@@ -60,7 +60,7 @@ export const useDataGridComponent = props => {
60
60
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
61
61
  useGridEditing(apiRef, props);
62
62
  useGridFocus(apiRef, props);
63
- useGridPreferencesPanel(apiRef);
63
+ useGridPreferencesPanel(apiRef, props);
64
64
  useGridFilter(apiRef, props);
65
65
  useGridSorting(apiRef, props);
66
66
  useGridDensity(apiRef, props);
@@ -5,6 +5,8 @@ export const GRID_ACTIONS_COLUMN_TYPE = 'actions';
5
5
  export const GRID_ACTIONS_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
6
6
  sortable: false,
7
7
  filterable: false,
8
+ // @ts-ignore
9
+ aggregable: false,
8
10
  width: 100,
9
11
  align: 'center',
10
12
  headerAlign: 'center',
@@ -21,5 +21,7 @@ export const GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
21
21
  sortComparator: gridNumberComparator,
22
22
  valueFormatter: gridBooleanFormatter,
23
23
  filterOperators: getGridBooleanOperators(),
24
- getApplyQuickFilterFn: undefined
24
+ getApplyQuickFilterFn: undefined,
25
+ // @ts-ignore
26
+ aggregable: false
25
27
  });
@@ -13,6 +13,8 @@ export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF
13
13
  resizable: false,
14
14
  sortable: false,
15
15
  filterable: false,
16
+ // @ts-ignore
17
+ aggregable: false,
16
18
  disableColumnMenu: true,
17
19
  disableReorder: true,
18
20
  disableExport: true,
@@ -1,2 +1,2 @@
1
1
  import { GridFilterOperator } from '../models/gridFilterOperator';
2
- export declare const getGridDateOperators: (showTime?: boolean | undefined) => GridFilterOperator<any, string | Date, any>[];
2
+ export declare const getGridDateOperators: (showTime?: boolean) => GridFilterOperator<any, string | Date, any>[];
@@ -1,2 +1,5 @@
1
1
  import { GridColTypeDef } from '../models/colDef/gridColDef';
2
+ /**
3
+ * TODO: Move pro and premium properties outside of this Community file
4
+ */
2
5
  export declare const GRID_STRING_COL_DEF: GridColTypeDef<any, any>;
@@ -1,6 +1,10 @@
1
1
  import { renderEditInputCell } from '../components/cell/GridEditInputCell';
2
2
  import { gridStringOrNumberComparator } from '../hooks/features/sorting/gridSortingUtils';
3
3
  import { getGridStringOperators, getGridStringQuickFilterFn } from './gridStringOperators';
4
+ /**
5
+ * TODO: Move pro and premium properties outside of this Community file
6
+ */
7
+
4
8
  export const GRID_STRING_COL_DEF = {
5
9
  width: 100,
6
10
  minWidth: 50,
@@ -12,6 +16,8 @@ export const GRID_STRING_COL_DEF = {
12
16
  filterable: true,
13
17
  groupable: true,
14
18
  pinnable: true,
19
+ // @ts-ignore
20
+ private_aggregable: true,
15
21
  editable: false,
16
22
  sortComparator: gridStringOrNumberComparator,
17
23
  type: 'string',
@@ -44,7 +44,10 @@ function GridOverlayWrapper(props) {
44
44
  width: (_viewportInnerSize$wi = viewportInnerSize == null ? void 0 : viewportInnerSize.width) != null ? _viewportInnerSize$wi : 0,
45
45
  position: 'absolute',
46
46
  top: headerHeight,
47
- bottom: height === 'auto' ? 0 : undefined
47
+ bottom: height === 'auto' ? 0 : undefined,
48
+ zIndex: 3,
49
+ // should be above pinned columns and detail panel
50
+ pointerEvents: 'none'
48
51
  }
49
52
  }, props));
50
53
  }
@@ -4,6 +4,9 @@ import { GridRenderCellParams } from '../../models/params/gridCellParams';
4
4
  import { GridColDef } from '../../models/colDef/gridColDef';
5
5
  interface GridBooleanCellProps extends GridRenderCellParams, Omit<SvgIconProps, 'tabIndex' | 'id'> {
6
6
  }
7
- export declare const GridBooleanCell: React.MemoExoticComponent<(props: GridBooleanCellProps) => JSX.Element>;
7
+ declare const GridBooleanCell: React.MemoExoticComponent<{
8
+ (props: GridBooleanCellProps): JSX.Element;
9
+ propTypes: any;
10
+ }>;
11
+ export { GridBooleanCell };
8
12
  export declare const renderBooleanCell: GridColDef['renderCell'];
9
- export {};
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex", "getValue"];
4
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
5
6
  import { unstable_composeClasses as composeClasses } from '@mui/material';
6
7
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
7
8
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
@@ -18,7 +19,7 @@ const useUtilityClasses = ownerState => {
18
19
  return composeClasses(slots, getDataGridUtilityClass, classes);
19
20
  };
20
21
 
21
- export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
22
+ const GridBooleanCellRaw = props => {
22
23
  const {
23
24
  value
24
25
  } = props,
@@ -37,7 +38,97 @@ export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
37
38
  titleAccess: apiRef.current.getLocaleText(value ? 'booleanCellTrueLabel' : 'booleanCellFalseLabel'),
38
39
  "data-value": Boolean(value)
39
40
  }, other));
40
- });
41
+ };
42
+
43
+ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
44
+ // ----------------------------- Warning --------------------------------
45
+ // | These PropTypes are generated from the TypeScript type definitions |
46
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
47
+ // ----------------------------------------------------------------------
48
+
49
+ /**
50
+ * GridApi that let you manipulate the grid.
51
+ * @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
52
+ */
53
+ api: PropTypes.any.isRequired,
54
+
55
+ /**
56
+ * The mode of the cell.
57
+ */
58
+ cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
59
+
60
+ /**
61
+ * The column of the row that the current cell belongs to.
62
+ */
63
+ colDef: PropTypes.object.isRequired,
64
+
65
+ /**
66
+ * The column field of the cell that triggered the event.
67
+ */
68
+ field: PropTypes.string.isRequired,
69
+
70
+ /**
71
+ * A ref allowing to set imperative focus.
72
+ * It can be passed to the element that should receive focus.
73
+ * @ignore - do not document.
74
+ */
75
+ focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
76
+ current: PropTypes.shape({
77
+ focus: PropTypes.func.isRequired
78
+ })
79
+ })]),
80
+
81
+ /**
82
+ * The cell value formatted with the column valueFormatter.
83
+ */
84
+ formattedValue: PropTypes.any,
85
+
86
+ /**
87
+ * Get the cell value of a row and field.
88
+ * @param {GridRowId} id The row id.
89
+ * @param {string} field The field.
90
+ * @returns {any} The cell value.
91
+ * @deprecated Use `params.row` to directly access the fields you want instead.
92
+ */
93
+ getValue: PropTypes.func.isRequired,
94
+
95
+ /**
96
+ * If true, the cell is the active element.
97
+ */
98
+ hasFocus: PropTypes.bool.isRequired,
99
+
100
+ /**
101
+ * The grid row id.
102
+ */
103
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
104
+
105
+ /**
106
+ * If true, the cell is editable.
107
+ */
108
+ isEditable: PropTypes.bool,
109
+
110
+ /**
111
+ * The row model of the row that the current cell belongs to.
112
+ */
113
+ row: PropTypes.object.isRequired,
114
+
115
+ /**
116
+ * The node of the row that the current cell belongs to.
117
+ */
118
+ rowNode: PropTypes.object.isRequired,
119
+
120
+ /**
121
+ * the tabIndex value.
122
+ */
123
+ tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
124
+
125
+ /**
126
+ * The cell value, but if the column has valueGetter, use getValue.
127
+ */
128
+ value: PropTypes.any
129
+ } : void 0;
130
+ const GridBooleanCell = /*#__PURE__*/React.memo(GridBooleanCellRaw);
131
+ export { GridBooleanCell };
41
132
  export const renderBooleanCell = params => {
42
133
  if (params.rowNode.isAutoGenerated) {
43
134
  return '';
@@ -6,10 +6,14 @@ import PropTypes from 'prop-types';
6
6
  import { unstable_composeClasses as composeClasses } from '@mui/material';
7
7
  import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
8
8
  import InputBase from '@mui/material/InputBase';
9
+ import { styled } from '@mui/material/styles';
9
10
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
10
11
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
11
12
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
+ const StyledInputBase = styled(InputBase)({
15
+ fontSize: 'inherit'
16
+ });
13
17
 
14
18
  const useUtilityClasses = ownerState => {
15
19
  const {
@@ -116,7 +120,7 @@ function GridEditDateCell(props) {
116
120
  inputRef.current.focus();
117
121
  }
118
122
  }, [hasFocus]);
119
- return /*#__PURE__*/_jsx(InputBase, _extends({
123
+ return /*#__PURE__*/_jsx(StyledInputBase, _extends({
120
124
  inputRef: inputRef,
121
125
  fullWidth: true,
122
126
  className: classes.root,
@@ -1,4 +1,5 @@
1
1
  export * from './GridCell';
2
+ export * from './GridBooleanCell';
2
3
  export * from './GridEditBooleanCell';
3
4
  export * from './GridEditDateCell';
4
5
  export * from './GridEditInputCell';
@@ -1,4 +1,5 @@
1
1
  export * from './GridCell';
2
+ export * from './GridBooleanCell';
2
3
  export * from './GridEditBooleanCell';
3
4
  export * from './GridEditDateCell';
4
5
  export * from './GridEditInputCell';
@@ -28,6 +28,7 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
28
28
  field,
29
29
  id,
30
30
  value: isChecked,
31
+ rowNode,
31
32
  hasFocus,
32
33
  tabIndex
33
34
  } = props,
@@ -77,7 +78,12 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
77
78
  apiRef.current.publishEvent('cellNavigationKeyDown', props, event);
78
79
  }
79
80
  }, [apiRef, props]);
80
- const isSelectable = !rootProps.isRowSelectable || rootProps.isRowSelectable(apiRef.current.getRowParams(id));
81
+
82
+ if (rowNode.position === 'footer') {
83
+ return null;
84
+ }
85
+
86
+ const isSelectable = apiRef.current.isRowSelectable(id);
81
87
  const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
82
88
  return /*#__PURE__*/_jsx(rootProps.components.BaseCheckbox, _extends({
83
89
  ref: handleRef,
@@ -6,6 +6,16 @@ export const GridRootStyles = styled('div', {
6
6
  slot: 'Root',
7
7
  overridesResolver: (props, styles) => [{
8
8
  [`&.${gridClasses.autoHeight}`]: styles.autoHeight
9
+ }, {
10
+ [`&.${gridClasses.aggregationColumnHeader}`]: styles.aggregationColumnHeader
11
+ }, {
12
+ [`&.${gridClasses['aggregationColumnHeader--alignLeft']}`]: styles['aggregationColumnHeader--alignLeft']
13
+ }, {
14
+ [`&.${gridClasses['aggregationColumnHeader--alignCenter']}`]: styles['aggregationColumnHeader--alignCenter']
15
+ }, {
16
+ [`&.${gridClasses['aggregationColumnHeader--alignRight']}`]: styles['aggregationColumnHeader--alignRight']
17
+ }, {
18
+ [`&.${gridClasses.aggregationColumnHeaderLabel}`]: styles.aggregationColumnHeaderLabel
9
19
  }, {
10
20
  [`& .${gridClasses.editBooleanCell}`]: styles.editBooleanCell
11
21
  }, {
@@ -1,6 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["csvOptions", "printOptions", "excelOptions"];
3
+ const _excluded = ["hideMenu", "options"],
4
+ _excluded2 = ["hideMenu", "options"],
5
+ _excluded3 = ["csvOptions", "printOptions", "excelOptions"];
4
6
  import * as React from 'react';
5
7
  import PropTypes from 'prop-types';
6
8
  import MenuItem from '@mui/material/MenuItem';
@@ -9,31 +11,39 @@ import { GridToolbarExportContainer } from './GridToolbarExportContainer';
9
11
  import { jsx as _jsx } from "react/jsx-runtime";
10
12
  export const GridCsvExportMenuItem = props => {
11
13
  const apiRef = useGridApiContext();
14
+
12
15
  const {
13
16
  hideMenu,
14
17
  options
15
- } = props;
16
- return /*#__PURE__*/_jsx(MenuItem, {
18
+ } = props,
19
+ other = _objectWithoutPropertiesLoose(props, _excluded);
20
+
21
+ return /*#__PURE__*/_jsx(MenuItem, _extends({
17
22
  onClick: () => {
18
23
  apiRef.current.exportDataAsCsv(options);
19
24
  hideMenu == null ? void 0 : hideMenu();
20
- },
25
+ }
26
+ }, other, {
21
27
  children: apiRef.current.getLocaleText('toolbarExportCSV')
22
- });
28
+ }));
23
29
  };
24
30
  export const GridPrintExportMenuItem = props => {
25
31
  const apiRef = useGridApiContext();
32
+
26
33
  const {
27
34
  hideMenu,
28
35
  options
29
- } = props;
30
- return /*#__PURE__*/_jsx(MenuItem, {
36
+ } = props,
37
+ other = _objectWithoutPropertiesLoose(props, _excluded2);
38
+
39
+ return /*#__PURE__*/_jsx(MenuItem, _extends({
31
40
  onClick: () => {
32
41
  apiRef.current.exportDataAsPrint(options);
33
42
  hideMenu == null ? void 0 : hideMenu();
34
- },
43
+ }
44
+ }, other, {
35
45
  children: apiRef.current.getLocaleText('toolbarExportPrint')
36
- });
46
+ }));
37
47
  };
38
48
  const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExport(props, ref) {
39
49
  const {
@@ -41,7 +51,7 @@ const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExpo
41
51
  printOptions = {},
42
52
  excelOptions
43
53
  } = props,
44
- other = _objectWithoutPropertiesLoose(props, _excluded);
54
+ other = _objectWithoutPropertiesLoose(props, _excluded3);
45
55
 
46
56
  const apiRef = useGridApiContext();
47
57
  const preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('exportMenu', [], {
@@ -1,8 +1,28 @@
1
1
  export interface GridClasses {
2
2
  /**
3
- * Styles applied to the root element of the cell with type="actions"
3
+ * Styles applied to the root element of the cell with type="actions".
4
4
  */
5
5
  actionsCell: string;
6
+ /**
7
+ * Styles applied to the root element of the column header when aggregated.
8
+ */
9
+ aggregationColumnHeader: string;
10
+ /**
11
+ * Styles applied to the root element of the header when aggregation if `headerAlign="left"`.
12
+ */
13
+ 'aggregationColumnHeader--alignLeft': string;
14
+ /**
15
+ * Styles applied to the root element of the header when aggregation if `headerAlign="center"`.
16
+ */
17
+ 'aggregationColumnHeader--alignCenter': string;
18
+ /**
19
+ * Styles applied to the root element of the header when aggregation if `headerAlign="right"`.
20
+ */
21
+ 'aggregationColumnHeader--alignRight': string;
22
+ /**
23
+ * Styles applied to the aggregation label in the column header when aggregated.
24
+ */
25
+ aggregationColumnHeaderLabel: string;
6
26
  /**
7
27
  * Styles applied to the root element if `autoHeight={true}`.
8
28
  */
@@ -175,6 +195,10 @@ export interface GridClasses {
175
195
  * Styles applied to the detail panel toggle cell element if expanded.
176
196
  */
177
197
  'detailPanelToggleCell--expanded': string;
198
+ /**
199
+ * Styles applied to the root element of the cell inside a footer row.
200
+ */
201
+ footerCell: string;
178
202
  /**
179
203
  * Styles applied to the panel element.
180
204
  */
@@ -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 const 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']);
5
+ export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', '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', 'footerCell', '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']);
@@ -111,5 +111,12 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
111
111
  // Used core components translation keys
112
112
  MuiTablePagination: {},
113
113
  // Row reordering text
114
- rowReorderingHeaderName: 'Row reordering'
114
+ rowReorderingHeaderName: 'Row reordering',
115
+ // Aggregation
116
+ aggregationMenuItemHeader: 'Aggregation',
117
+ aggregationFunctionLabelSum: 'sum',
118
+ aggregationFunctionLabelAvg: 'avg',
119
+ aggregationFunctionLabelMin: 'min',
120
+ aggregationFunctionLabelMax: 'max',
121
+ aggregationFunctionLabelSize: 'size'
115
122
  };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { GridCellIndexCoordinates, GridScrollParams, GridColDef } from '../../../models';
3
3
  import { GridInitialStateCommunity } from '../../../models/gridStateCommunity';
4
- import { GridRestoreStatePreProcessingContext, GridRestoreStatePreProcessingValue } from '../../features/statePersistence/gridStatePersistenceInterface';
4
+ import { GridExportStateParams, GridRestoreStatePreProcessingContext, GridRestoreStatePreProcessingValue } from '../../features/statePersistence/gridStatePersistenceInterface';
5
5
  import { GridHydrateColumnsValue } from '../../features/columns/gridColumnsInterfaces';
6
6
  import { GridRowEntry } from '../../../models/gridRows';
7
7
  import { GridHydrateRowsValue } from '../../features/rows/gridRowsState';
@@ -14,6 +14,7 @@ export interface GridPipeProcessingLookup {
14
14
  };
15
15
  exportState: {
16
16
  value: GridInitialStateCommunity;
17
+ context: GridExportStateParams;
17
18
  };
18
19
  hydrateColumns: {
19
20
  value: GridHydrateColumnsValue;
@@ -28,11 +28,11 @@ export const useGridColumnSpanning = apiRef => {
28
28
  columnIndex,
29
29
  rowId,
30
30
  minFirstColumnIndex,
31
- maxLastColumnIndex
31
+ maxLastColumnIndex,
32
+ columns
32
33
  } = params;
33
- const visibleColumns = apiRef.current.getVisibleColumns();
34
- const columnsLength = visibleColumns.length;
35
- const column = visibleColumns[columnIndex];
34
+ const columnsLength = columns.length;
35
+ const column = columns[columnIndex];
36
36
  const colSpan = typeof column.colSpan === 'function' ? column.colSpan(apiRef.current.getCellParams(rowId, column.field)) : column.colSpan;
37
37
 
38
38
  if (!colSpan || colSpan === 1) {
@@ -54,7 +54,7 @@ export const useGridColumnSpanning = apiRef => {
54
54
  const nextColumnIndex = columnIndex + j; // Cells should be spanned only within their column section (left-pinned, right-pinned and unpinned).
55
55
 
56
56
  if (nextColumnIndex >= minFirstColumnIndex && nextColumnIndex < maxLastColumnIndex) {
57
- const nextColumn = visibleColumns[nextColumnIndex];
57
+ const nextColumn = columns[nextColumnIndex];
58
58
  width += nextColumn.computedWidth;
59
59
  setCellColSpanInfo(rowId, columnIndex + j, {
60
60
  spannedByColSpan: true,
@@ -80,14 +80,16 @@ export const useGridColumnSpanning = apiRef => {
80
80
  const calculateColSpan = React.useCallback(({
81
81
  rowId,
82
82
  minFirstColumn,
83
- maxLastColumn
83
+ maxLastColumn,
84
+ columns
84
85
  }) => {
85
86
  for (let i = minFirstColumn; i < maxLastColumn; i += 1) {
86
87
  const cellProps = calculateCellColSpan({
87
88
  columnIndex: i,
88
89
  rowId,
89
90
  minFirstColumnIndex: minFirstColumn,
90
- maxLastColumnIndex: maxLastColumn
91
+ maxLastColumnIndex: maxLastColumn,
92
+ columns
91
93
  });
92
94
 
93
95
  if (cellProps.colSpan > 1) {
@@ -8,4 +8,4 @@ export declare const columnsStateInitializer: GridStateInitializer<Pick<DataGrid
8
8
  * @requires useGridDimensions (method, event) - can be after
9
9
  * TODO: Impossible priority - useGridParamsApi also needs to be after useGridColumns
10
10
  */
11
- export declare function useGridColumns(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'columns' | 'onColumnVisibilityChange' | 'columnVisibilityModel' | 'onColumnVisibilityModelChange' | 'columnTypes' | 'components' | 'componentsProps'>): void;
11
+ export declare function useGridColumns(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState' | 'columns' | 'onColumnVisibilityChange' | 'columnVisibilityModel' | 'onColumnVisibilityModelChange' | 'columnTypes' | 'components' | 'componentsProps'>): void;
@@ -36,7 +36,7 @@ export const columnsStateInitializer = (state, props, apiRef) => {
36
36
  */
37
37
 
38
38
  export function useGridColumns(apiRef, props) {
39
- var _props$componentsProp2;
39
+ var _props$initialState5, _props$componentsProp2;
40
40
 
41
41
  const logger = useGridLogger(apiRef, 'useGridColumns');
42
42
  const columnTypes = React.useMemo(() => computeColumnTypes(props.columnTypes), [props.columnTypes]);
@@ -192,14 +192,21 @@ export function useGridColumns(apiRef, props) {
192
192
  * PRE-PROCESSING
193
193
  */
194
194
 
195
- const stateExportPreProcessing = React.useCallback(prevState => {
195
+ const stateExportPreProcessing = React.useCallback((prevState, context) => {
196
196
  const columnsStateToExport = {};
197
197
 
198
198
  if (apiRef.current.unstable_caches.columns.isUsingColumnVisibilityModel) {
199
- const columnVisibilityModelToExport = gridColumnVisibilityModelSelector(apiRef);
200
- const hasHiddenColumns = Object.values(columnVisibilityModelToExport).some(value => value === false);
199
+ var _props$initialState$c2, _props$initialState4, _props$initialState4$;
201
200
 
202
- if (hasHiddenColumns) {
201
+ const columnVisibilityModelToExport = gridColumnVisibilityModelSelector(apiRef);
202
+ const shouldExportColumnVisibilityModel = // Always export if the `exportOnlyDirtyModels` property is activated
203
+ !context.exportOnlyDirtyModels || // Always export if the model is controlled
204
+ props.columnVisibilityModel != null || // Always export if the model has been initialized
205
+ // TODO v6 Do a nullish check instead to export even if the initial model equals "{}"
206
+ Object.keys((_props$initialState$c2 = (_props$initialState4 = props.initialState) == null ? void 0 : (_props$initialState4$ = _props$initialState4.columns) == null ? void 0 : _props$initialState4$.columnVisibilityModel) != null ? _props$initialState$c2 : {}).length > 0 || // Always export if the model is not empty
207
+ Object.keys(columnVisibilityModelToExport).length > 0;
208
+
209
+ if (shouldExportColumnVisibilityModel) {
203
210
  columnsStateToExport.columnVisibilityModel = columnVisibilityModelToExport;
204
211
  }
205
212
  }
@@ -230,7 +237,7 @@ export function useGridColumns(apiRef, props) {
230
237
  return _extends({}, prevState, {
231
238
  columns: columnsStateToExport
232
239
  });
233
- }, [apiRef]);
240
+ }, [apiRef, props.columnVisibilityModel, (_props$initialState5 = props.initialState) == null ? void 0 : _props$initialState5.columns]);
234
241
  const stateRestorePreProcessing = React.useCallback((params, context) => {
235
242
  var _context$stateToResto;
236
243
 
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { GridExportOptions, GridCsvGetRowsToExportParams } from '../../../models/gridExport';
4
4
  import { GridStateColDef } from '../../../models/colDef/gridColDef';
@@ -1,5 +1,6 @@
1
1
  import { gridColumnDefinitionsSelector, gridVisibleColumnDefinitionsSelector } from '../columns';
2
2
  import { gridFilteredSortedRowIdsSelector } from '../filter';
3
+ import { gridRowTreeSelector } from '../rows/gridRowsSelector';
3
4
  export const getColumnsToExport = ({
4
5
  apiRef,
5
6
  options
@@ -17,11 +18,17 @@ export const defaultGetRowsToExport = ({
17
18
  apiRef
18
19
  }) => {
19
20
  const filteredSortedRowIds = gridFilteredSortedRowIdsSelector(apiRef);
21
+ const rowTree = gridRowTreeSelector(apiRef);
20
22
  const selectedRows = apiRef.current.getSelectedRows();
23
+ const bodyRows = filteredSortedRowIds.filter(id => {
24
+ var _rowTree$id$position;
25
+
26
+ return ((_rowTree$id$position = rowTree[id].position) != null ? _rowTree$id$position : 'body') === 'body';
27
+ });
21
28
 
22
29
  if (selectedRows.size > 0) {
23
- return filteredSortedRowIds.filter(id => selectedRows.has(id));
30
+ return bodyRows.filter(id => selectedRows.has(id));
24
31
  }
25
32
 
26
- return filteredSortedRowIds;
33
+ return bodyRows;
27
34
  };