@mui/x-data-grid 6.3.1 → 6.5.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 (349) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/DataGrid/DataGrid.js +20 -1
  3. package/DataGrid/useDataGridComponent.js +2 -2
  4. package/DataGrid/useDataGridProps.js +8 -13
  5. package/colDef/gridBooleanColDef.js +19 -1
  6. package/colDef/gridDateColDef.js +6 -2
  7. package/colDef/gridNumericOperators.js +0 -6
  8. package/colDef/gridSingleSelectColDef.js +21 -1
  9. package/components/base/GridBody.js +2 -1
  10. package/components/cell/GridEditInputCell.js +4 -1
  11. package/components/containers/GridRootStyles.js +1 -0
  12. package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +15 -2
  13. package/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
  14. package/components/panel/filterPanel/GridFilterInputDate.d.ts +8 -1
  15. package/components/panel/filterPanel/GridFilterInputDate.js +27 -6
  16. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
  17. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
  18. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +8 -1
  19. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
  20. package/components/panel/filterPanel/GridFilterInputValue.d.ts +11 -4
  21. package/components/panel/filterPanel/GridFilterInputValue.js +29 -6
  22. package/components/panel/filterPanel/GridFilterPanel.d.ts +2 -1
  23. package/components/panel/filterPanel/GridFilterPanel.js +1 -1
  24. package/components/panel/filterPanel/index.d.ts +3 -1
  25. package/components/panel/filterPanel/index.js +2 -1
  26. package/constants/localeTextConstants.js +26 -0
  27. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +12 -1
  28. package/hooks/features/clipboard/useGridClipboard.d.ts +2 -1
  29. package/hooks/features/clipboard/useGridClipboard.js +43 -26
  30. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +9 -2
  31. package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
  32. package/hooks/features/dimensions/useGridDimensions.js +4 -6
  33. package/hooks/features/editing/useGridCellEditing.js +7 -3
  34. package/hooks/features/editing/useGridEditing.js +0 -3
  35. package/hooks/features/editing/useGridRowEditing.js +7 -3
  36. package/hooks/features/export/serializers/csvSerializer.d.ts +5 -0
  37. package/hooks/features/export/serializers/csvSerializer.js +46 -6
  38. package/hooks/features/export/useGridCsvExport.d.ts +2 -1
  39. package/hooks/features/export/useGridCsvExport.js +7 -5
  40. package/hooks/features/focus/gridFocusState.d.ts +2 -0
  41. package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -0
  42. package/hooks/features/focus/gridFocusStateSelector.js +6 -0
  43. package/hooks/features/focus/useGridFocus.js +55 -9
  44. package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +4 -0
  45. package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
  46. package/hooks/features/headerFiltering/index.d.ts +1 -0
  47. package/hooks/features/headerFiltering/index.js +1 -0
  48. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +6 -0
  49. package/hooks/features/headerFiltering/useGridHeaderFiltering.js +91 -0
  50. package/hooks/features/index.d.ts +1 -0
  51. package/hooks/features/index.js +2 -1
  52. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  53. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +124 -4
  54. package/hooks/features/rows/useGridRows.js +16 -1
  55. package/index.js +1 -1
  56. package/internals/index.d.ts +9 -3
  57. package/internals/index.js +7 -2
  58. package/internals/utils/index.d.ts +1 -0
  59. package/internals/utils/index.js +2 -1
  60. package/internals/utils/useProps.d.ts +8 -0
  61. package/internals/utils/useProps.js +13 -0
  62. package/joy/icons.d.ts +33 -0
  63. package/joy/icons.js +433 -0
  64. package/joy/joySlots.js +114 -4
  65. package/legacy/DataGrid/DataGrid.js +20 -1
  66. package/legacy/DataGrid/useDataGridComponent.js +2 -2
  67. package/legacy/DataGrid/useDataGridProps.js +11 -9
  68. package/legacy/colDef/gridBooleanColDef.js +21 -1
  69. package/legacy/colDef/gridDateColDef.js +10 -2
  70. package/legacy/colDef/gridNumericOperators.js +0 -6
  71. package/legacy/colDef/gridSingleSelectColDef.js +21 -1
  72. package/legacy/components/base/GridBody.js +2 -1
  73. package/legacy/components/cell/GridEditInputCell.js +4 -1
  74. package/legacy/components/containers/GridRootStyles.js +1 -0
  75. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +79 -35
  76. package/legacy/components/panel/filterPanel/GridFilterInputDate.js +26 -5
  77. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
  78. package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
  79. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +54 -31
  80. package/legacy/components/panel/filterPanel/GridFilterInputValue.js +28 -5
  81. package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
  82. package/legacy/components/panel/filterPanel/index.js +2 -1
  83. package/legacy/constants/localeTextConstants.js +26 -0
  84. package/legacy/hooks/features/clipboard/useGridClipboard.js +44 -26
  85. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
  86. package/legacy/hooks/features/dimensions/useGridDimensions.js +4 -6
  87. package/legacy/hooks/features/editing/useGridCellEditing.js +7 -3
  88. package/legacy/hooks/features/editing/useGridEditing.js +0 -3
  89. package/legacy/hooks/features/editing/useGridRowEditing.js +7 -3
  90. package/legacy/hooks/features/export/serializers/csvSerializer.js +43 -6
  91. package/legacy/hooks/features/export/useGridCsvExport.js +8 -5
  92. package/legacy/hooks/features/focus/gridFocusStateSelector.js +10 -0
  93. package/legacy/hooks/features/focus/useGridFocus.js +58 -9
  94. package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +11 -0
  95. package/legacy/hooks/features/headerFiltering/index.js +1 -0
  96. package/legacy/hooks/features/headerFiltering/useGridHeaderFiltering.js +93 -0
  97. package/legacy/hooks/features/index.js +2 -1
  98. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +123 -4
  99. package/legacy/hooks/features/rows/useGridRows.js +16 -1
  100. package/legacy/index.js +1 -1
  101. package/legacy/internals/index.js +7 -2
  102. package/legacy/internals/utils/index.js +2 -1
  103. package/legacy/internals/utils/useProps.js +11 -0
  104. package/legacy/joy/icons.js +432 -0
  105. package/legacy/joy/joySlots.js +118 -4
  106. package/legacy/locales/arSD.js +28 -0
  107. package/legacy/locales/beBY.js +28 -0
  108. package/legacy/locales/bgBG.js +28 -0
  109. package/legacy/locales/csCZ.js +36 -8
  110. package/legacy/locales/daDK.js +28 -0
  111. package/legacy/locales/deDE.js +30 -2
  112. package/legacy/locales/elGR.js +27 -0
  113. package/legacy/locales/esES.js +28 -0
  114. package/legacy/locales/faIR.js +28 -0
  115. package/legacy/locales/fiFI.js +28 -0
  116. package/legacy/locales/frFR.js +34 -6
  117. package/legacy/locales/heIL.js +30 -2
  118. package/legacy/locales/huHU.js +28 -0
  119. package/legacy/locales/itIT.js +28 -0
  120. package/legacy/locales/jaJP.js +28 -0
  121. package/legacy/locales/koKR.js +28 -0
  122. package/legacy/locales/nbNO.js +28 -0
  123. package/legacy/locales/nlNL.js +28 -0
  124. package/legacy/locales/plPL.js +28 -0
  125. package/legacy/locales/ptBR.js +29 -1
  126. package/legacy/locales/roRO.js +28 -0
  127. package/legacy/locales/ruRU.js +28 -0
  128. package/legacy/locales/skSK.js +28 -0
  129. package/legacy/locales/svSE.js +28 -0
  130. package/legacy/locales/trTR.js +28 -0
  131. package/legacy/locales/ukUA.js +36 -9
  132. package/legacy/locales/urPK.js +28 -0
  133. package/legacy/locales/viVN.js +27 -0
  134. package/legacy/locales/zhCN.js +28 -0
  135. package/legacy/locales/zhTW.js +28 -0
  136. package/legacy/material/index.js +5 -1
  137. package/legacy/models/api/index.js +0 -1
  138. package/legacy/models/index.js +0 -1
  139. package/legacy/utils/domUtils.js +14 -1
  140. package/locales/arSD.js +28 -0
  141. package/locales/beBY.js +28 -0
  142. package/locales/bgBG.js +28 -0
  143. package/locales/csCZ.js +36 -8
  144. package/locales/daDK.js +28 -0
  145. package/locales/deDE.js +30 -2
  146. package/locales/elGR.js +27 -0
  147. package/locales/esES.js +28 -0
  148. package/locales/faIR.js +28 -0
  149. package/locales/fiFI.js +28 -0
  150. package/locales/frFR.js +34 -6
  151. package/locales/heIL.js +30 -2
  152. package/locales/huHU.js +28 -0
  153. package/locales/itIT.js +28 -0
  154. package/locales/jaJP.js +28 -0
  155. package/locales/koKR.js +28 -0
  156. package/locales/nbNO.js +28 -0
  157. package/locales/nlNL.js +28 -0
  158. package/locales/plPL.js +28 -0
  159. package/locales/ptBR.js +29 -1
  160. package/locales/roRO.js +28 -0
  161. package/locales/ruRU.js +28 -0
  162. package/locales/skSK.js +28 -0
  163. package/locales/svSE.js +28 -0
  164. package/locales/trTR.js +28 -0
  165. package/locales/ukUA.js +36 -9
  166. package/locales/urPK.js +28 -0
  167. package/locales/viVN.js +27 -0
  168. package/locales/zhCN.js +28 -0
  169. package/locales/zhTW.js +28 -0
  170. package/material/index.d.ts +3 -65
  171. package/material/index.js +5 -1
  172. package/models/api/gridApiCommon.d.ts +3 -3
  173. package/models/api/gridCoreApi.d.ts +8 -0
  174. package/models/api/gridFocusApi.d.ts +6 -0
  175. package/models/api/gridHeaderFilteringApi.d.ts +30 -0
  176. package/models/api/gridLocaleTextApi.d.ts +25 -0
  177. package/models/api/index.d.ts +0 -1
  178. package/models/api/index.js +0 -1
  179. package/models/events/gridEventLookup.d.ts +33 -1
  180. package/models/gridFilterOperator.d.ts +4 -0
  181. package/models/gridHeaderFilteringModel.d.ts +5 -0
  182. package/models/gridHeaderFilteringModel.js +1 -0
  183. package/models/gridSlotsComponent.d.ts +21 -4
  184. package/models/gridSlotsComponentsProps.d.ts +4 -0
  185. package/models/gridStateCommunity.d.ts +2 -0
  186. package/models/index.d.ts +1 -1
  187. package/models/index.js +0 -1
  188. package/models/props/DataGridProps.d.ts +19 -0
  189. package/modern/DataGrid/DataGrid.js +20 -1
  190. package/modern/DataGrid/useDataGridComponent.js +2 -2
  191. package/modern/DataGrid/useDataGridProps.js +8 -13
  192. package/modern/colDef/gridBooleanColDef.js +19 -1
  193. package/modern/colDef/gridDateColDef.js +6 -2
  194. package/modern/colDef/gridNumericOperators.js +0 -6
  195. package/modern/colDef/gridSingleSelectColDef.js +21 -1
  196. package/modern/components/base/GridBody.js +2 -1
  197. package/modern/components/cell/GridEditInputCell.js +4 -1
  198. package/modern/components/containers/GridRootStyles.js +1 -0
  199. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
  200. package/modern/components/panel/filterPanel/GridFilterInputDate.js +27 -6
  201. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
  202. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
  203. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
  204. package/modern/components/panel/filterPanel/GridFilterInputValue.js +29 -6
  205. package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
  206. package/modern/components/panel/filterPanel/index.js +2 -1
  207. package/modern/constants/localeTextConstants.js +26 -0
  208. package/modern/hooks/features/clipboard/useGridClipboard.js +43 -26
  209. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
  210. package/modern/hooks/features/dimensions/useGridDimensions.js +3 -5
  211. package/modern/hooks/features/editing/useGridCellEditing.js +7 -3
  212. package/modern/hooks/features/editing/useGridEditing.js +0 -3
  213. package/modern/hooks/features/editing/useGridRowEditing.js +7 -3
  214. package/modern/hooks/features/export/serializers/csvSerializer.js +44 -6
  215. package/modern/hooks/features/export/useGridCsvExport.js +7 -5
  216. package/modern/hooks/features/focus/gridFocusStateSelector.js +6 -0
  217. package/modern/hooks/features/focus/useGridFocus.js +55 -9
  218. package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
  219. package/modern/hooks/features/headerFiltering/index.js +1 -0
  220. package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +90 -0
  221. package/modern/hooks/features/index.js +2 -1
  222. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +124 -4
  223. package/modern/hooks/features/rows/useGridRows.js +16 -1
  224. package/modern/index.js +1 -1
  225. package/modern/internals/index.js +7 -2
  226. package/modern/internals/utils/index.js +2 -1
  227. package/modern/internals/utils/useProps.js +13 -0
  228. package/modern/joy/icons.js +433 -0
  229. package/modern/joy/joySlots.js +110 -4
  230. package/modern/locales/arSD.js +28 -0
  231. package/modern/locales/beBY.js +28 -0
  232. package/modern/locales/bgBG.js +28 -0
  233. package/modern/locales/csCZ.js +36 -8
  234. package/modern/locales/daDK.js +28 -0
  235. package/modern/locales/deDE.js +30 -2
  236. package/modern/locales/elGR.js +27 -0
  237. package/modern/locales/esES.js +28 -0
  238. package/modern/locales/faIR.js +28 -0
  239. package/modern/locales/fiFI.js +28 -0
  240. package/modern/locales/frFR.js +34 -6
  241. package/modern/locales/heIL.js +30 -2
  242. package/modern/locales/huHU.js +28 -0
  243. package/modern/locales/itIT.js +28 -0
  244. package/modern/locales/jaJP.js +28 -0
  245. package/modern/locales/koKR.js +28 -0
  246. package/modern/locales/nbNO.js +28 -0
  247. package/modern/locales/nlNL.js +28 -0
  248. package/modern/locales/plPL.js +28 -0
  249. package/modern/locales/ptBR.js +29 -1
  250. package/modern/locales/roRO.js +28 -0
  251. package/modern/locales/ruRU.js +28 -0
  252. package/modern/locales/skSK.js +28 -0
  253. package/modern/locales/svSE.js +28 -0
  254. package/modern/locales/trTR.js +28 -0
  255. package/modern/locales/ukUA.js +36 -9
  256. package/modern/locales/urPK.js +28 -0
  257. package/modern/locales/viVN.js +27 -0
  258. package/modern/locales/zhCN.js +28 -0
  259. package/modern/locales/zhTW.js +28 -0
  260. package/modern/material/index.js +5 -1
  261. package/modern/models/api/gridHeaderFilteringApi.js +1 -0
  262. package/modern/models/api/index.js +0 -1
  263. package/modern/models/gridHeaderFilteringModel.js +1 -0
  264. package/modern/models/index.js +0 -1
  265. package/modern/utils/domUtils.js +13 -1
  266. package/node/DataGrid/DataGrid.js +20 -1
  267. package/node/DataGrid/useDataGridComponent.js +2 -2
  268. package/node/DataGrid/useDataGridProps.js +7 -12
  269. package/node/colDef/gridBooleanColDef.js +19 -1
  270. package/node/colDef/gridDateColDef.js +6 -2
  271. package/node/colDef/gridNumericOperators.js +0 -6
  272. package/node/colDef/gridSingleSelectColDef.js +21 -1
  273. package/node/components/base/GridBody.js +2 -1
  274. package/node/components/cell/GridEditInputCell.js +4 -1
  275. package/node/components/containers/GridRootStyles.js +1 -0
  276. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +78 -35
  277. package/node/components/panel/filterPanel/GridFilterInputDate.js +27 -6
  278. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -2
  279. package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -2
  280. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -32
  281. package/node/components/panel/filterPanel/GridFilterInputValue.js +29 -6
  282. package/node/components/panel/filterPanel/GridFilterPanel.js +2 -1
  283. package/node/components/panel/filterPanel/index.js +26 -8
  284. package/node/constants/localeTextConstants.js +26 -0
  285. package/node/hooks/features/clipboard/useGridClipboard.js +42 -25
  286. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
  287. package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
  288. package/node/hooks/features/editing/useGridCellEditing.js +7 -3
  289. package/node/hooks/features/editing/useGridEditing.js +0 -3
  290. package/node/hooks/features/editing/useGridRowEditing.js +7 -3
  291. package/node/hooks/features/export/serializers/csvSerializer.js +46 -6
  292. package/node/hooks/features/export/useGridCsvExport.js +6 -3
  293. package/node/hooks/features/focus/gridFocusStateSelector.js +9 -1
  294. package/node/hooks/features/focus/useGridFocus.js +55 -9
  295. package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +15 -0
  296. package/node/hooks/features/headerFiltering/index.js +16 -0
  297. package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +101 -0
  298. package/node/hooks/features/index.js +11 -0
  299. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +124 -4
  300. package/node/hooks/features/rows/useGridRows.js +16 -1
  301. package/node/index.js +1 -1
  302. package/node/internals/index.js +69 -1
  303. package/node/internals/utils/index.js +11 -0
  304. package/node/internals/utils/useProps.js +22 -0
  305. package/node/joy/icons.js +471 -0
  306. package/node/joy/joySlots.js +110 -3
  307. package/node/locales/arSD.js +28 -0
  308. package/node/locales/beBY.js +28 -0
  309. package/node/locales/bgBG.js +28 -0
  310. package/node/locales/csCZ.js +36 -8
  311. package/node/locales/daDK.js +28 -0
  312. package/node/locales/deDE.js +30 -2
  313. package/node/locales/elGR.js +27 -0
  314. package/node/locales/esES.js +28 -0
  315. package/node/locales/faIR.js +28 -0
  316. package/node/locales/fiFI.js +28 -0
  317. package/node/locales/frFR.js +34 -6
  318. package/node/locales/heIL.js +30 -2
  319. package/node/locales/huHU.js +28 -0
  320. package/node/locales/itIT.js +28 -0
  321. package/node/locales/jaJP.js +28 -0
  322. package/node/locales/koKR.js +28 -0
  323. package/node/locales/nbNO.js +28 -0
  324. package/node/locales/nlNL.js +28 -0
  325. package/node/locales/plPL.js +28 -0
  326. package/node/locales/ptBR.js +29 -1
  327. package/node/locales/roRO.js +28 -0
  328. package/node/locales/ruRU.js +28 -0
  329. package/node/locales/skSK.js +28 -0
  330. package/node/locales/svSE.js +28 -0
  331. package/node/locales/trTR.js +28 -0
  332. package/node/locales/ukUA.js +36 -9
  333. package/node/locales/urPK.js +28 -0
  334. package/node/locales/viVN.js +27 -0
  335. package/node/locales/zhCN.js +28 -0
  336. package/node/locales/zhTW.js +28 -0
  337. package/node/material/index.js +5 -1
  338. package/node/models/api/index.js +0 -11
  339. package/node/models/gridHeaderFilteringModel.js +5 -0
  340. package/node/models/index.js +0 -11
  341. package/node/utils/domUtils.js +15 -1
  342. package/package.json +1 -1
  343. package/utils/domUtils.d.ts +1 -0
  344. package/utils/domUtils.js +13 -1
  345. package/models/api/gridClipboardApi.d.ts +0 -11
  346. /package/legacy/models/api/{gridClipboardApi.js → gridHeaderFilteringApi.js} +0 -0
  347. /package/{models/api/gridClipboardApi.js → legacy/models/gridHeaderFilteringModel.js} +0 -0
  348. /package/{modern/models/api/gridClipboardApi.js → models/api/gridHeaderFilteringApi.js} +0 -0
  349. /package/node/models/api/{gridClipboardApi.js → gridHeaderFilteringApi.js} +0 -0
@@ -1,17 +1,29 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
3
+ const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "headerFilterMenu", "isFilterActive", "clearButton", "tabIndex", "label"];
4
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
5
6
  import { unstable_useId as useId } from '@mui/utils';
7
+ import { styled } from '@mui/material/styles';
6
8
  import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
7
9
  import { jsx as _jsx } from "react/jsx-runtime";
8
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
- export function GridFilterInputBoolean(props) {
11
+ const BooleanOperatorContainer = styled('div')({
12
+ display: 'flex',
13
+ alignItems: 'flex-end',
14
+ width: '100%'
15
+ });
16
+ function GridFilterInputBoolean(props) {
10
17
  const {
11
18
  item,
12
19
  applyValue,
13
20
  apiRef,
14
- focusElementRef
21
+ focusElementRef,
22
+ headerFilterMenu,
23
+ isFilterActive,
24
+ clearButton,
25
+ tabIndex,
26
+ label: labelProp
15
27
  } = props,
16
28
  others = _objectWithoutPropertiesLoose(props, _excluded);
17
29
  const [filterValueState, setFilterValueState] = React.useState(item.value || '');
@@ -31,39 +43,71 @@ export function GridFilterInputBoolean(props) {
31
43
  React.useEffect(() => {
32
44
  setFilterValueState(item.value || '');
33
45
  }, [item.value]);
34
- const label = apiRef.current.getLocaleText('filterPanelInputLabel');
35
- return /*#__PURE__*/_jsxs(React.Fragment, {
36
- children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
37
- id: labelId,
38
- shrink: true,
39
- variant: "standard",
40
- children: label
41
- })), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
42
- labelId: labelId,
43
- id: selectId,
44
- label: label,
45
- value: filterValueState,
46
- onChange: onFilterChange,
47
- variant: "standard",
48
- native: isSelectNative,
49
- displayEmpty: true,
50
- inputProps: {
51
- ref: focusElementRef
52
- }
53
- }, others, baseSelectProps, {
54
- children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
46
+ const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
47
+ return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
48
+ children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
49
+ fullWidth: true,
50
+ children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
51
+ id: labelId,
52
+ shrink: true,
53
+ variant: "standard",
54
+ children: label
55
+ })), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
56
+ labelId: labelId,
57
+ id: selectId,
58
+ label: label,
59
+ value: filterValueState,
60
+ onChange: onFilterChange,
61
+ variant: "standard",
55
62
  native: isSelectNative,
56
- value: "",
57
- children: apiRef.current.getLocaleText('filterValueAny')
58
- })), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
59
- native: isSelectNative,
60
- value: "true",
61
- children: apiRef.current.getLocaleText('filterValueTrue')
62
- })), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
63
- native: isSelectNative,
64
- value: "false",
65
- children: apiRef.current.getLocaleText('filterValueFalse')
63
+ displayEmpty: true,
64
+ startAdornment: isFilterActive ? headerFilterMenu : null,
65
+ inputProps: {
66
+ ref: focusElementRef,
67
+ tabIndex
68
+ }
69
+ }, others, baseSelectProps, {
70
+ children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
71
+ native: isSelectNative,
72
+ value: "",
73
+ children: apiRef.current.getLocaleText('filterValueAny')
74
+ })), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
75
+ native: isSelectNative,
76
+ value: "true",
77
+ children: apiRef.current.getLocaleText('filterValueTrue')
78
+ })), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
79
+ native: isSelectNative,
80
+ value: "false",
81
+ children: apiRef.current.getLocaleText('filterValueFalse')
82
+ }))]
66
83
  }))]
67
- }))]
84
+ }), clearButton]
68
85
  });
69
- }
86
+ }
87
+ process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
88
+ // ----------------------------- Warning --------------------------------
89
+ // | These PropTypes are generated from the TypeScript type definitions |
90
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
91
+ // ----------------------------------------------------------------------
92
+ apiRef: PropTypes.shape({
93
+ current: PropTypes.object.isRequired
94
+ }).isRequired,
95
+ applyValue: PropTypes.func.isRequired,
96
+ clearButton: PropTypes.node,
97
+ focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
98
+ current: PropTypes.any.isRequired
99
+ })]),
100
+ headerFilterMenu: PropTypes.node,
101
+ /**
102
+ * It is `true` if the filter either has a value or an operator with no value
103
+ * required is selected (e.g. `isEmpty`)
104
+ */
105
+ isFilterActive: PropTypes.bool,
106
+ item: PropTypes.shape({
107
+ field: PropTypes.string.isRequired,
108
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
109
+ operator: PropTypes.string.isRequired,
110
+ value: PropTypes.any
111
+ }).isRequired
112
+ } : void 0;
113
+ export { GridFilterInputBoolean };
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps"];
3
+ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps", "headerFilterMenu", "isFilterActive", "clearButton", "tabIndex", "disabled"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_useId as useId } from '@mui/utils';
@@ -14,7 +14,12 @@ function GridFilterInputDate(props) {
14
14
  type,
15
15
  apiRef,
16
16
  focusElementRef,
17
- InputProps
17
+ InputProps,
18
+ headerFilterMenu,
19
+ isFilterActive,
20
+ clearButton,
21
+ tabIndex,
22
+ disabled
18
23
  } = props,
19
24
  other = _objectWithoutPropertiesLoose(props, _excluded);
20
25
  const filterTimeout = React.useRef();
@@ -44,6 +49,7 @@ function GridFilterInputDate(props) {
44
49
  setFilterValueState(String(itemValue));
45
50
  }, [item.value]);
46
51
  return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
52
+ fullWidth: true,
47
53
  id: id,
48
54
  label: apiRef.current.getLocaleText('filterPanelInputLabel'),
49
55
  placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
@@ -55,11 +61,19 @@ function GridFilterInputDate(props) {
55
61
  shrink: true
56
62
  },
57
63
  inputRef: focusElementRef,
58
- InputProps: _extends({}, applying ? {
59
- endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {})
60
- } : {}, InputProps, {
64
+ InputProps: _extends({}, applying || clearButton ? {
65
+ endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
66
+ fontSize: "small",
67
+ color: "action"
68
+ }) : clearButton
69
+ } : {}, headerFilterMenu && isFilterActive ? {
70
+ startAdornment: headerFilterMenu
71
+ } : {}, {
72
+ disabled
73
+ }, InputProps, {
61
74
  inputProps: _extends({
62
- max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31'
75
+ max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31',
76
+ tabIndex
63
77
  }, InputProps?.inputProps)
64
78
  })
65
79
  }, other, rootProps.slotProps?.baseTextField));
@@ -73,7 +87,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
73
87
  current: PropTypes.object.isRequired
74
88
  }).isRequired,
75
89
  applyValue: PropTypes.func.isRequired,
90
+ clearButton: PropTypes.node,
76
91
  focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
92
+ headerFilterMenu: PropTypes.node,
93
+ /**
94
+ * It is `true` if the filter either has a value or an operator with no value
95
+ * required is selected (e.g. `isEmpty`)
96
+ */
97
+ isFilterActive: PropTypes.bool,
77
98
  item: PropTypes.shape({
78
99
  field: PropTypes.string.isRequired,
79
100
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -4,7 +4,6 @@ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "c
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
7
- import Chip from '@mui/material/Chip';
8
7
  import { unstable_useId as useId } from '@mui/utils';
9
8
  import { isSingleSelectColDef } from './filterPanelUtils';
10
9
  import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
@@ -96,7 +95,7 @@ function GridFilterInputMultipleSingleSelect(props) {
96
95
  value: filteredValues,
97
96
  onChange: handleChange,
98
97
  getOptionLabel: getOptionLabel,
99
- renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(Chip, _extends({
98
+ renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
100
99
  variant: "outlined",
101
100
  size: "small",
102
101
  label: getOptionLabel(option)
@@ -4,7 +4,6 @@ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "c
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import Autocomplete from '@mui/material/Autocomplete';
7
- import Chip from '@mui/material/Chip';
8
7
  import { unstable_useId as useId } from '@mui/utils';
9
8
  import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -55,7 +54,7 @@ function GridFilterInputMultipleValue(props) {
55
54
  id: id,
56
55
  value: filterValueState,
57
56
  onChange: handleChange,
58
- renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(Chip, _extends({
57
+ renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
59
58
  variant: "outlined",
60
59
  size: "small",
61
60
  label: option
@@ -1,9 +1,10 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue"];
3
+ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue", "placeholder", "tabIndex", "label", "headerFilterMenu", "isFilterActive", "clearButton"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_useId as useId } from '@mui/utils';
7
+ import { styled } from '@mui/material/styles';
7
8
  import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
8
9
  import { getValueFromValueOptions, isSingleSelectColDef } from './filterPanelUtils';
9
10
  import { createElement as _createElement } from "react";
@@ -33,6 +34,11 @@ const renderSingleSelectOptions = ({
33
34
  }), label);
34
35
  });
35
36
  };
37
+ const SingleSelectOperatorContainer = styled('div')({
38
+ display: 'flex',
39
+ alignItems: 'flex-end',
40
+ width: '100%'
41
+ });
36
42
  function GridFilterInputSingleSelect(props) {
37
43
  const {
38
44
  item,
@@ -41,7 +47,13 @@ function GridFilterInputSingleSelect(props) {
41
47
  apiRef,
42
48
  focusElementRef,
43
49
  getOptionLabel: getOptionLabelProp,
44
- getOptionValue: getOptionValueProp
50
+ getOptionValue: getOptionValueProp,
51
+ placeholder,
52
+ tabIndex,
53
+ label: labelProp,
54
+ headerFilterMenu,
55
+ isFilterActive,
56
+ clearButton
45
57
  } = props,
46
58
  others = _objectWithoutPropertiesLoose(props, _excluded);
47
59
  const [filterValueState, setFilterValueState] = React.useState(item.value ?? '');
@@ -99,36 +111,40 @@ function GridFilterInputSingleSelect(props) {
99
111
  if (!isSingleSelectColDef(resolvedColumn)) {
100
112
  return null;
101
113
  }
102
- const label = apiRef.current.getLocaleText('filterPanelInputLabel');
103
- return /*#__PURE__*/_jsxs(React.Fragment, {
104
- children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
105
- id: labelId,
106
- shrink: true,
107
- variant: "standard",
108
- children: label
109
- })), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
110
- id: id,
111
- label: label,
112
- labelId: labelId,
113
- value: filterValueState,
114
- onChange: onFilterChange,
115
- variant: "standard",
116
- type: type || 'text',
117
- inputProps: {
118
- ref: focusElementRef,
119
- placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder')
120
- },
121
- native: isSelectNative
122
- }, others, rootProps.slotProps?.baseSelect, {
123
- children: renderSingleSelectOptions({
124
- column: resolvedColumn,
125
- OptionComponent: rootProps.slots.baseSelectOption,
126
- getOptionLabel,
127
- getOptionValue,
128
- isSelectNative,
129
- baseSelectOptionProps: rootProps.slotProps?.baseSelectOption
130
- })
131
- }))]
114
+ const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
115
+ return /*#__PURE__*/_jsxs(SingleSelectOperatorContainer, {
116
+ children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
117
+ children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
118
+ id: labelId,
119
+ shrink: true,
120
+ variant: "standard",
121
+ children: label
122
+ })), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
123
+ id: id,
124
+ label: label,
125
+ labelId: labelId,
126
+ value: filterValueState,
127
+ onChange: onFilterChange,
128
+ startAdornment: isFilterActive ? headerFilterMenu : null,
129
+ variant: "standard",
130
+ type: type || 'text',
131
+ inputProps: {
132
+ tabIndex,
133
+ ref: focusElementRef,
134
+ placeholder: placeholder ?? apiRef.current.getLocaleText('filterPanelInputPlaceholder')
135
+ },
136
+ native: isSelectNative
137
+ }, others, rootProps.slotProps?.baseSelect, {
138
+ children: renderSingleSelectOptions({
139
+ column: resolvedColumn,
140
+ OptionComponent: rootProps.slots.baseSelectOption,
141
+ getOptionLabel,
142
+ getOptionValue,
143
+ isSelectNative,
144
+ baseSelectOptionProps: rootProps.slotProps?.baseSelectOption
145
+ })
146
+ }))]
147
+ }), clearButton]
132
148
  });
133
149
  }
134
150
  process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
@@ -140,6 +156,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
140
156
  current: PropTypes.object.isRequired
141
157
  }).isRequired,
142
158
  applyValue: PropTypes.func.isRequired,
159
+ clearButton: PropTypes.node,
143
160
  focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
144
161
  /**
145
162
  * Used to determine the label displayed for a given value option.
@@ -153,6 +170,12 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
153
170
  * @returns {string} The value to be used.
154
171
  */
155
172
  getOptionValue: PropTypes.func,
173
+ headerFilterMenu: PropTypes.node,
174
+ /**
175
+ * It is `true` if the filter either has a value or an operator with no value
176
+ * required is selected (e.g. `isEmpty`)
177
+ */
178
+ isFilterActive: PropTypes.bool,
156
179
  item: PropTypes.shape({
157
180
  field: PropTypes.string.isRequired,
158
181
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
3
+ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "headerFilterMenu", "isFilterActive", "clearButton", "InputProps"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_useId as useId } from '@mui/utils';
@@ -13,7 +13,13 @@ function GridFilterInputValue(props) {
13
13
  applyValue,
14
14
  type,
15
15
  apiRef,
16
- focusElementRef
16
+ focusElementRef,
17
+ tabIndex,
18
+ disabled,
19
+ headerFilterMenu,
20
+ isFilterActive,
21
+ clearButton,
22
+ InputProps
17
23
  } = props,
18
24
  others = _objectWithoutPropertiesLoose(props, _excluded);
19
25
  const filterTimeout = React.useRef();
@@ -44,9 +50,6 @@ function GridFilterInputValue(props) {
44
50
  const itemValue = item.value ?? '';
45
51
  setFilterValueState(String(itemValue));
46
52
  }, [item.value]);
47
- const InputProps = applying ? {
48
- endAdornment: /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {})
49
- } : others.InputProps;
50
53
  return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
51
54
  id: id,
52
55
  label: apiRef.current.getLocaleText('filterPanelInputLabel'),
@@ -55,7 +58,20 @@ function GridFilterInputValue(props) {
55
58
  onChange: onFilterChange,
56
59
  variant: "standard",
57
60
  type: type || 'text',
58
- InputProps: InputProps,
61
+ InputProps: _extends({}, applying || clearButton ? {
62
+ endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
63
+ fontSize: "small",
64
+ color: "action"
65
+ }) : clearButton
66
+ } : {}, headerFilterMenu && isFilterActive ? {
67
+ startAdornment: headerFilterMenu
68
+ } : {}, {
69
+ disabled
70
+ }, InputProps, {
71
+ inputProps: _extends({
72
+ tabIndex
73
+ }, InputProps?.inputProps)
74
+ }),
59
75
  InputLabelProps: {
60
76
  shrink: true
61
77
  },
@@ -71,7 +87,14 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
71
87
  current: PropTypes.object.isRequired
72
88
  }).isRequired,
73
89
  applyValue: PropTypes.func.isRequired,
90
+ clearButton: PropTypes.node,
74
91
  focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
92
+ headerFilterMenu: PropTypes.node,
93
+ /**
94
+ * It is `true` if the filter either has a value or an operator with no value
95
+ * required is selected (e.g. `isEmpty`)
96
+ */
97
+ isFilterActive: PropTypes.bool,
75
98
  item: PropTypes.shape({
76
99
  field: PropTypes.string.isRequired,
77
100
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -205,4 +205,4 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
205
205
  */
206
206
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
207
207
  } : void 0;
208
- export { GridFilterPanel };
208
+ export { GridFilterPanel, getGridFilter };
@@ -2,7 +2,8 @@ export * from './GridFilterForm';
2
2
  export * from './GridFilterInputValue';
3
3
  export * from './GridFilterInputDate';
4
4
  export * from './GridFilterInputSingleSelect';
5
+ export * from './GridFilterInputBoolean';
5
6
  export * from './GridFilterInputValueProps';
6
- export * from './GridFilterPanel';
7
+ export { GridFilterPanel } from './GridFilterPanel';
7
8
  export * from './GridFilterInputMultipleValue';
8
9
  export * from './GridFilterInputMultipleSingleSelect';
@@ -58,6 +58,32 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
58
58
  filterOperatorIsEmpty: 'is empty',
59
59
  filterOperatorIsNotEmpty: 'is not empty',
60
60
  filterOperatorIsAnyOf: 'is any of',
61
+ 'filterOperator=': '=',
62
+ 'filterOperator!=': '!=',
63
+ 'filterOperator>': '>',
64
+ 'filterOperator>=': '>=',
65
+ 'filterOperator<': '<',
66
+ 'filterOperator<=': '<=',
67
+ // Header filter operators text
68
+ headerFilterOperatorContains: 'Contains',
69
+ headerFilterOperatorEquals: 'Equals',
70
+ headerFilterOperatorStartsWith: 'Starts with',
71
+ headerFilterOperatorEndsWith: 'Ends with',
72
+ headerFilterOperatorIs: 'Is',
73
+ headerFilterOperatorNot: 'Is not',
74
+ headerFilterOperatorAfter: 'Is after',
75
+ headerFilterOperatorOnOrAfter: 'Is on or after',
76
+ headerFilterOperatorBefore: 'Is before',
77
+ headerFilterOperatorOnOrBefore: 'Is on or before',
78
+ headerFilterOperatorIsEmpty: 'Is empty',
79
+ headerFilterOperatorIsNotEmpty: 'Is not empty',
80
+ headerFilterOperatorIsAnyOf: 'Is any of',
81
+ 'headerFilterOperator=': 'Equals',
82
+ 'headerFilterOperator!=': 'Not equals',
83
+ 'headerFilterOperator>': 'Is greater than',
84
+ 'headerFilterOperator>=': 'Is greater than or equal to',
85
+ 'headerFilterOperator<': 'Is less than',
86
+ 'headerFilterOperator<=': 'Is less than or equal to',
61
87
  // Filter values text
62
88
  filterValueAny: 'any',
63
89
  filterValueTrue: 'true',
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
- import { useGridApiMethod, useGridNativeEventListener } from '../../utils';
2
+ import { useGridApiOptionHandler, useGridNativeEventListener } from '../../utils';
3
+ import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
4
+ import { serializeCellValue } from '../export/serializers/csvSerializer';
3
5
  function writeToClipboardPolyfill(data) {
4
6
  const span = document.createElement('span');
5
7
  span.style.whiteSpace = 'pre';
@@ -18,6 +20,15 @@ function writeToClipboardPolyfill(data) {
18
20
  document.body.removeChild(span);
19
21
  }
20
22
  }
23
+ function copyToClipboard(data) {
24
+ if (navigator.clipboard) {
25
+ navigator.clipboard.writeText(data).catch(() => {
26
+ writeToClipboardPolyfill(data);
27
+ });
28
+ } else {
29
+ writeToClipboardPolyfill(data);
30
+ }
31
+ }
21
32
  function hasNativeSelection(element) {
22
33
  // When getSelection is called on an <iframe> that is not displayed Firefox will return null.
23
34
  if (window.getSelection()?.toString()) {
@@ -37,24 +48,11 @@ function hasNativeSelection(element) {
37
48
  * @requires useGridCsvExport (method)
38
49
  * @requires useGridSelection (method)
39
50
  */
40
- export const useGridClipboard = apiRef => {
41
- const copySelectedRowsToClipboard = React.useCallback(() => {
42
- if (apiRef.current.getSelectedRows().size === 0) {
43
- return;
44
- }
45
- const data = apiRef.current.getDataAsCsv({
46
- includeHeaders: false,
47
- delimiter: '\t'
48
- });
49
- if (navigator.clipboard) {
50
- navigator.clipboard.writeText(data).catch(() => {
51
- writeToClipboardPolyfill(data);
52
- });
53
- } else {
54
- writeToClipboardPolyfill(data);
55
- }
56
- }, [apiRef]);
57
- const handleKeydown = React.useCallback(event => {
51
+ export const useGridClipboard = (apiRef, props) => {
52
+ const ignoreValueFormatterProp = props.unstable_ignoreValueFormatterDuringExport;
53
+ const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.clipboardExport : ignoreValueFormatterProp) || false;
54
+ const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
55
+ const handleCopy = React.useCallback(event => {
58
56
  const isModifierKeyPressed = event.ctrlKey || event.metaKey;
59
57
  // event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
60
58
  // be wrong with a Dvorak keyboard (as if pressing J).
@@ -66,11 +64,30 @@ export const useGridClipboard = apiRef => {
66
64
  if (hasNativeSelection(event.target)) {
67
65
  return;
68
66
  }
69
- apiRef.current.unstable_copySelectedRowsToClipboard();
70
- }, [apiRef]);
71
- useGridNativeEventListener(apiRef, apiRef.current.rootElementRef, 'keydown', handleKeydown);
72
- const clipboardApi = {
73
- unstable_copySelectedRowsToClipboard: copySelectedRowsToClipboard
74
- };
75
- useGridApiMethod(apiRef, clipboardApi, 'public');
67
+ let textToCopy = '';
68
+ const selectedRows = apiRef.current.getSelectedRows();
69
+ if (selectedRows.size > 0) {
70
+ textToCopy = apiRef.current.getDataAsCsv({
71
+ includeHeaders: false,
72
+ // TODO: make it configurable
73
+ delimiter: clipboardCopyCellDelimiter
74
+ });
75
+ } else {
76
+ const focusedCell = gridFocusCellSelector(apiRef);
77
+ if (focusedCell) {
78
+ const cellParams = apiRef.current.getCellParams(focusedCell.id, focusedCell.field);
79
+ textToCopy = serializeCellValue(cellParams, {
80
+ delimiterCharacter: clipboardCopyCellDelimiter,
81
+ ignoreValueFormatter
82
+ });
83
+ }
84
+ }
85
+ textToCopy = apiRef.current.unstable_applyPipeProcessors('clipboardCopy', textToCopy);
86
+ if (textToCopy) {
87
+ copyToClipboard(textToCopy);
88
+ apiRef.current.publishEvent('clipboardCopy', textToCopy);
89
+ }
90
+ }, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
91
+ useGridNativeEventListener(apiRef, apiRef.current.rootElementRef, 'keydown', handleCopy);
92
+ useGridApiOptionHandler(apiRef, 'clipboardCopy', props.onClipboardCopy);
76
93
  };
@@ -260,7 +260,7 @@ export const useGridColumnHeaders = props => {
260
260
  const tabIndex = columnGroupHeaderTabIndexState !== null && columnGroupHeaderTabIndexState.depth === depth && columnFields.includes(columnGroupHeaderTabIndexState.field) ? 0 : -1;
261
261
  const headerInfo = {
262
262
  groupId,
263
- width: columnFields.map(field => apiRef.current.getColumn(field).computedWidth).reduce((acc, val) => acc + val, 0),
263
+ width: columnFields.reduce((acc, field) => acc + apiRef.current.getColumn(field).computedWidth, 0),
264
264
  fields: columnFields,
265
265
  colIndex: columnIndex,
266
266
  hasFocus,
@@ -316,6 +316,7 @@ export const useGridColumnHeaders = props => {
316
316
  return {
317
317
  renderContext,
318
318
  getColumnHeaders,
319
+ getColumnsToRender,
319
320
  getColumnGroupHeaders,
320
321
  isDragging: !!dragCol,
321
322
  getRootProps: (other = {}) => _extends({
@@ -324,6 +325,7 @@ export const useGridColumnHeaders = props => {
324
325
  getInnerProps: () => ({
325
326
  ref: handleInnerRef,
326
327
  role: 'rowgroup'
327
- })
328
+ }),
329
+ headerHeight
328
330
  };
329
331
  };
@@ -10,7 +10,6 @@ import { getVisibleRows } from '../../utils/useGridVisibleRows';
10
10
  import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
11
11
  import { calculatePinnedRowsHeight } from '../rows/gridRowsUtils';
12
12
  import { getTotalHeaderHeight } from '../columns/gridColumnsUtils';
13
- import { gridClasses } from '../../../constants/gridClasses';
14
13
  const isTestEnvironment = process.env.NODE_ENV === 'test';
15
14
  const hasScroll = ({
16
15
  content,
@@ -150,13 +149,12 @@ export function useGridDimensions(apiRef, props) {
150
149
  return Math.min(maximumPageSizeWithoutScrollBar, currentPage.rows.length);
151
150
  }, [apiRef, props.pagination, props.paginationMode, props.getRowHeight, rowHeight]);
152
151
  const computeSizeAndPublishResizeEvent = React.useCallback(() => {
153
- const rootEl = apiRef.current.rootElementRef?.current;
154
- const mainEl = rootEl?.querySelector(`.${gridClasses.main}`);
152
+ const mainEl = apiRef.current.mainElementRef?.current;
155
153
  if (!mainEl) {
156
154
  return;
157
155
  }
158
- const height = mainEl.offsetHeight || 0;
159
- const width = mainEl.offsetWidth || 0;
156
+ const height = mainEl.clientHeight || 0;
157
+ const width = mainEl.clientWidth || 0;
160
158
  const win = ownerWindow(mainEl);
161
159
  const computedStyle = win.getComputedStyle(mainEl);
162
160
  const paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0;
@@ -90,10 +90,14 @@ export const useGridCellEditing = (apiRef, props) => {
90
90
  }
91
91
  } else if (params.isEditable) {
92
92
  let reason;
93
- if (event.key === ' ') {
94
- return; // Space scrolls to the last row
93
+ const canStartEditing = apiRef.current.unstable_applyPipeProcessors('canStartEditing', true, {
94
+ event,
95
+ cellParams: params,
96
+ editMode: 'cell'
97
+ });
98
+ if (!canStartEditing) {
99
+ return;
95
100
  }
96
-
97
101
  if (isPrintableKey(event)) {
98
102
  reason = GridCellEditStartReasons.printableKeyDown;
99
103
  } else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {