@mui/x-data-grid-premium 8.0.0-beta.3 → 8.0.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 (486) hide show
  1. package/CHANGELOG.md +282 -96
  2. package/DataGridPremium/DataGridPremium.js +165 -9
  3. package/DataGridPremium/useDataGridPremiumComponent.d.ts +2 -2
  4. package/DataGridPremium/useDataGridPremiumComponent.js +22 -3
  5. package/DataGridPremium/useDataGridPremiumProps.js +5 -1
  6. package/components/GridColumnMenuPivotItem.d.ts +3 -0
  7. package/components/GridColumnMenuPivotItem.js +33 -0
  8. package/components/GridEmptyPivotOverlay.d.ts +6 -0
  9. package/components/GridEmptyPivotOverlay.js +29 -0
  10. package/components/GridGroupingCriteriaCell.js +8 -3
  11. package/components/GridPremiumColumnMenu.d.ts +5 -0
  12. package/components/GridPremiumColumnMenu.js +6 -1
  13. package/components/GridPremiumToolbar.d.ts +1 -1
  14. package/components/GridPremiumToolbar.js +29 -1
  15. package/components/aiAssistantPanel/AiAssistantPanelTrigger.d.ts +33 -0
  16. package/components/aiAssistantPanel/AiAssistantPanelTrigger.js +107 -0
  17. package/components/aiAssistantPanel/GridAiAssistantPanel.d.ts +3 -0
  18. package/components/aiAssistantPanel/GridAiAssistantPanel.js +195 -0
  19. package/components/aiAssistantPanel/GridAiAssistantPanelConversation.d.ts +7 -0
  20. package/components/aiAssistantPanel/GridAiAssistantPanelConversation.js +71 -0
  21. package/components/aiAssistantPanel/GridAiAssistantPanelConversationsMenu.d.ts +3 -0
  22. package/components/aiAssistantPanel/GridAiAssistantPanelConversationsMenu.js +92 -0
  23. package/components/aiAssistantPanel/GridAiAssistantPanelSuggestions.d.ts +7 -0
  24. package/components/aiAssistantPanel/GridAiAssistantPanelSuggestions.js +86 -0
  25. package/components/aiAssistantPanel/index.d.ts +2 -0
  26. package/components/aiAssistantPanel/index.js +27 -0
  27. package/components/collapsible/Collapsible.d.ts +4 -0
  28. package/components/collapsible/Collapsible.js +70 -0
  29. package/components/collapsible/CollapsibleContext.d.ts +8 -0
  30. package/components/collapsible/CollapsibleContext.js +17 -0
  31. package/components/collapsible/CollapsiblePanel.d.ts +4 -0
  32. package/components/collapsible/CollapsiblePanel.js +64 -0
  33. package/components/collapsible/CollapsibleTrigger.d.ts +4 -0
  34. package/components/collapsible/CollapsibleTrigger.js +106 -0
  35. package/components/collapsible/index.d.ts +4 -0
  36. package/components/collapsible/index.js +49 -0
  37. package/components/index.d.ts +5 -2
  38. package/components/index.js +40 -4
  39. package/components/pivotPanel/GridPivotPanel.d.ts +3 -0
  40. package/components/pivotPanel/GridPivotPanel.js +22 -0
  41. package/components/pivotPanel/GridPivotPanelBody.d.ts +11 -0
  42. package/components/pivotPanel/GridPivotPanelBody.js +368 -0
  43. package/components/pivotPanel/GridPivotPanelField.d.ts +22 -0
  44. package/components/pivotPanel/GridPivotPanelField.js +338 -0
  45. package/components/pivotPanel/GridPivotPanelFieldMenu.d.ts +8 -0
  46. package/components/pivotPanel/GridPivotPanelFieldMenu.js +177 -0
  47. package/components/pivotPanel/GridPivotPanelHeader.d.ts +7 -0
  48. package/components/pivotPanel/GridPivotPanelHeader.js +101 -0
  49. package/components/pivotPanel/GridPivotPanelSearch.d.ts +7 -0
  50. package/components/pivotPanel/GridPivotPanelSearch.js +77 -0
  51. package/components/pivotPanel/PivotPanelTrigger.d.ts +37 -0
  52. package/components/pivotPanel/PivotPanelTrigger.js +93 -0
  53. package/components/pivotPanel/index.d.ts +2 -0
  54. package/components/pivotPanel/index.js +27 -0
  55. package/components/prompt/GridPrompt.d.ts +7 -0
  56. package/components/prompt/GridPrompt.js +364 -0
  57. package/components/prompt/index.d.ts +1 -0
  58. package/components/prompt/index.js +12 -0
  59. package/components/promptField/GridPromptField.d.ts +4 -0
  60. package/components/promptField/GridPromptField.js +86 -0
  61. package/components/promptField/PromptField.d.ts +66 -0
  62. package/components/promptField/PromptField.js +95 -0
  63. package/components/promptField/PromptFieldContext.d.ts +16 -0
  64. package/components/promptField/PromptFieldContext.js +17 -0
  65. package/components/promptField/PromptFieldControl.d.ts +27 -0
  66. package/components/promptField/PromptFieldControl.js +102 -0
  67. package/components/promptField/PromptFieldRecord.d.ts +27 -0
  68. package/components/promptField/PromptFieldRecord.js +158 -0
  69. package/components/promptField/PromptFieldSend.d.ts +27 -0
  70. package/components/promptField/PromptFieldSend.js +83 -0
  71. package/components/promptField/index.d.ts +4 -0
  72. package/components/promptField/index.js +49 -0
  73. package/components/resizablePanel/ResizablePanel.d.ts +10 -0
  74. package/components/resizablePanel/ResizablePanel.js +59 -0
  75. package/components/resizablePanel/ResizablePanelContext.d.ts +7 -0
  76. package/components/resizablePanel/ResizablePanelContext.js +17 -0
  77. package/components/resizablePanel/ResizablePanelHandle.d.ts +4 -0
  78. package/components/resizablePanel/ResizablePanelHandle.js +115 -0
  79. package/components/resizablePanel/index.d.ts +3 -0
  80. package/components/resizablePanel/index.js +38 -0
  81. package/components/sidebar/Sidebar.d.ts +4 -0
  82. package/components/sidebar/Sidebar.js +54 -0
  83. package/components/sidebar/SidebarHeader.d.ts +4 -0
  84. package/components/sidebar/SidebarHeader.js +51 -0
  85. package/components/sidebar/index.d.ts +2 -0
  86. package/components/sidebar/index.js +27 -0
  87. package/constants/dataGridPremiumDefaultSlotsComponents.js +3 -0
  88. package/esm/DataGridPremium/DataGridPremium.js +167 -11
  89. package/esm/DataGridPremium/useDataGridPremiumComponent.d.ts +2 -2
  90. package/esm/DataGridPremium/useDataGridPremiumComponent.js +20 -3
  91. package/esm/DataGridPremium/useDataGridPremiumProps.js +5 -1
  92. package/esm/components/GridColumnMenuPivotItem.d.ts +3 -0
  93. package/esm/components/GridColumnMenuPivotItem.js +26 -0
  94. package/esm/components/GridEmptyPivotOverlay.d.ts +6 -0
  95. package/esm/components/GridEmptyPivotOverlay.js +22 -0
  96. package/esm/components/GridGroupingCriteriaCell.js +9 -4
  97. package/esm/components/GridPremiumColumnMenu.d.ts +5 -0
  98. package/esm/components/GridPremiumColumnMenu.js +6 -1
  99. package/esm/components/GridPremiumToolbar.d.ts +1 -1
  100. package/esm/components/GridPremiumToolbar.js +30 -2
  101. package/esm/components/aiAssistantPanel/AiAssistantPanelTrigger.d.ts +33 -0
  102. package/esm/components/aiAssistantPanel/AiAssistantPanelTrigger.js +100 -0
  103. package/esm/components/aiAssistantPanel/GridAiAssistantPanel.d.ts +3 -0
  104. package/esm/components/aiAssistantPanel/GridAiAssistantPanel.js +188 -0
  105. package/esm/components/aiAssistantPanel/GridAiAssistantPanelConversation.d.ts +7 -0
  106. package/esm/components/aiAssistantPanel/GridAiAssistantPanelConversation.js +64 -0
  107. package/esm/components/aiAssistantPanel/GridAiAssistantPanelConversationsMenu.d.ts +3 -0
  108. package/esm/components/aiAssistantPanel/GridAiAssistantPanelConversationsMenu.js +85 -0
  109. package/esm/components/aiAssistantPanel/GridAiAssistantPanelSuggestions.d.ts +7 -0
  110. package/esm/components/aiAssistantPanel/GridAiAssistantPanelSuggestions.js +80 -0
  111. package/esm/components/aiAssistantPanel/index.d.ts +2 -0
  112. package/esm/components/aiAssistantPanel/index.js +2 -0
  113. package/esm/components/collapsible/Collapsible.d.ts +4 -0
  114. package/esm/components/collapsible/Collapsible.js +63 -0
  115. package/esm/components/collapsible/CollapsibleContext.d.ts +8 -0
  116. package/esm/components/collapsible/CollapsibleContext.js +9 -0
  117. package/esm/components/collapsible/CollapsiblePanel.d.ts +4 -0
  118. package/esm/components/collapsible/CollapsiblePanel.js +57 -0
  119. package/esm/components/collapsible/CollapsibleTrigger.d.ts +4 -0
  120. package/esm/components/collapsible/CollapsibleTrigger.js +99 -0
  121. package/esm/components/collapsible/index.d.ts +4 -0
  122. package/esm/components/collapsible/index.js +4 -0
  123. package/esm/components/index.d.ts +5 -2
  124. package/esm/components/index.js +5 -2
  125. package/esm/components/pivotPanel/GridPivotPanel.d.ts +3 -0
  126. package/esm/components/pivotPanel/GridPivotPanel.js +16 -0
  127. package/esm/components/pivotPanel/GridPivotPanelBody.d.ts +11 -0
  128. package/esm/components/pivotPanel/GridPivotPanelBody.js +361 -0
  129. package/esm/components/pivotPanel/GridPivotPanelField.d.ts +22 -0
  130. package/esm/components/pivotPanel/GridPivotPanelField.js +331 -0
  131. package/esm/components/pivotPanel/GridPivotPanelFieldMenu.d.ts +8 -0
  132. package/esm/components/pivotPanel/GridPivotPanelFieldMenu.js +170 -0
  133. package/esm/components/pivotPanel/GridPivotPanelHeader.d.ts +7 -0
  134. package/esm/components/pivotPanel/GridPivotPanelHeader.js +94 -0
  135. package/esm/components/pivotPanel/GridPivotPanelSearch.d.ts +7 -0
  136. package/esm/components/pivotPanel/GridPivotPanelSearch.js +70 -0
  137. package/esm/components/pivotPanel/PivotPanelTrigger.d.ts +37 -0
  138. package/esm/components/pivotPanel/PivotPanelTrigger.js +86 -0
  139. package/esm/components/pivotPanel/index.d.ts +2 -0
  140. package/esm/components/pivotPanel/index.js +2 -0
  141. package/esm/components/prompt/GridPrompt.d.ts +7 -0
  142. package/esm/components/prompt/GridPrompt.js +357 -0
  143. package/esm/components/prompt/index.d.ts +1 -0
  144. package/esm/components/prompt/index.js +1 -0
  145. package/esm/components/promptField/GridPromptField.d.ts +4 -0
  146. package/esm/components/promptField/GridPromptField.js +79 -0
  147. package/esm/components/promptField/PromptField.d.ts +66 -0
  148. package/esm/components/promptField/PromptField.js +88 -0
  149. package/esm/components/promptField/PromptFieldContext.d.ts +16 -0
  150. package/esm/components/promptField/PromptFieldContext.js +9 -0
  151. package/esm/components/promptField/PromptFieldControl.d.ts +27 -0
  152. package/esm/components/promptField/PromptFieldControl.js +95 -0
  153. package/esm/components/promptField/PromptFieldRecord.d.ts +27 -0
  154. package/esm/components/promptField/PromptFieldRecord.js +151 -0
  155. package/esm/components/promptField/PromptFieldSend.d.ts +27 -0
  156. package/{modern/components/export/ExportExcel.js → esm/components/promptField/PromptFieldSend.js} +30 -38
  157. package/esm/components/promptField/index.d.ts +4 -0
  158. package/esm/components/promptField/index.js +4 -0
  159. package/esm/components/resizablePanel/ResizablePanel.d.ts +10 -0
  160. package/esm/components/resizablePanel/ResizablePanel.js +52 -0
  161. package/esm/components/resizablePanel/ResizablePanelContext.d.ts +7 -0
  162. package/esm/components/resizablePanel/ResizablePanelContext.js +9 -0
  163. package/esm/components/resizablePanel/ResizablePanelHandle.d.ts +4 -0
  164. package/esm/components/resizablePanel/ResizablePanelHandle.js +108 -0
  165. package/esm/components/resizablePanel/index.d.ts +3 -0
  166. package/esm/components/resizablePanel/index.js +3 -0
  167. package/esm/components/sidebar/Sidebar.d.ts +4 -0
  168. package/esm/components/sidebar/Sidebar.js +47 -0
  169. package/esm/components/sidebar/SidebarHeader.d.ts +4 -0
  170. package/esm/components/sidebar/SidebarHeader.js +44 -0
  171. package/esm/components/sidebar/index.d.ts +2 -0
  172. package/esm/components/sidebar/index.js +2 -0
  173. package/esm/constants/dataGridPremiumDefaultSlotsComponents.js +3 -0
  174. package/esm/hooks/features/aggregation/gridAggregationFunctions.js +13 -0
  175. package/esm/hooks/features/aggregation/gridAggregationSelectors.d.ts +10 -1
  176. package/esm/hooks/features/aggregation/gridAggregationSelectors.js +28 -1
  177. package/esm/hooks/features/aggregation/gridAggregationUtils.d.ts +1 -1
  178. package/esm/hooks/features/aggregation/index.d.ts +1 -1
  179. package/esm/hooks/features/aggregation/index.js +1 -1
  180. package/esm/hooks/features/aggregation/useGridAggregation.js +3 -7
  181. package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +2 -8
  182. package/esm/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +5 -25
  183. package/esm/hooks/features/aggregation/wrapColumnWithAggregation.js +23 -10
  184. package/esm/hooks/features/aiAssistant/api.d.ts +12 -0
  185. package/esm/hooks/features/aiAssistant/api.js +31 -0
  186. package/esm/hooks/features/aiAssistant/gridAiAssistantInterfaces.d.ts +82 -0
  187. package/esm/hooks/features/aiAssistant/gridAiAssistantSelectors.d.ts +5 -0
  188. package/esm/hooks/features/aiAssistant/gridAiAssistantSelectors.js +5 -0
  189. package/esm/hooks/features/aiAssistant/index.d.ts +2 -0
  190. package/esm/hooks/features/aiAssistant/useGridAiAssistant.d.ts +6 -0
  191. package/esm/hooks/features/aiAssistant/useGridAiAssistant.js +293 -0
  192. package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +4 -1
  193. package/esm/hooks/features/index.d.ts +1 -1
  194. package/esm/hooks/features/index.js +1 -1
  195. package/esm/hooks/features/pivoting/gridPivotingInterfaces.d.ts +69 -0
  196. package/esm/hooks/features/pivoting/gridPivotingSelectors.d.ts +4 -0
  197. package/esm/hooks/features/pivoting/gridPivotingSelectors.js +5 -0
  198. package/esm/hooks/features/pivoting/useGridPivoting.d.ts +7 -0
  199. package/esm/hooks/features/pivoting/useGridPivoting.js +339 -0
  200. package/esm/hooks/features/pivoting/utils.d.ts +21 -0
  201. package/esm/hooks/features/pivoting/utils.js +259 -0
  202. package/esm/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +1 -4
  203. package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +0 -1
  204. package/esm/hooks/utils/useResize.d.ts +9 -0
  205. package/esm/hooks/utils/useResize.js +52 -0
  206. package/esm/index.d.ts +4 -1
  207. package/esm/index.js +4 -2
  208. package/esm/material/icons.d.ts +15 -15
  209. package/esm/material/icons.js +32 -5
  210. package/esm/material/index.d.ts +31 -5
  211. package/esm/material/index.js +31 -3
  212. package/esm/models/dataGridPremiumProps.d.ts +96 -2
  213. package/esm/models/gridApiPremium.d.ts +4 -2
  214. package/esm/models/gridPremiumIconSlotsComponent.d.ts +141 -8
  215. package/esm/models/gridPremiumSlotsComponent.d.ts +13 -1
  216. package/esm/models/gridStatePremium.d.ts +6 -0
  217. package/esm/package.json +1 -1
  218. package/esm/setupExcelExportWebWorker/index.d.ts +1 -0
  219. package/esm/setupExcelExportWebWorker/index.js +1 -0
  220. package/esm/typeOverloads/modules.d.ts +32 -1
  221. package/esm/utils/speechRecognition.d.ts +2 -0
  222. package/esm/utils/speechRecognition.js +2 -0
  223. package/hooks/features/aggregation/gridAggregationFunctions.js +13 -0
  224. package/hooks/features/aggregation/gridAggregationSelectors.d.ts +10 -1
  225. package/hooks/features/aggregation/gridAggregationSelectors.js +29 -2
  226. package/hooks/features/aggregation/gridAggregationUtils.d.ts +1 -1
  227. package/hooks/features/aggregation/index.d.ts +1 -1
  228. package/hooks/features/aggregation/index.js +21 -11
  229. package/hooks/features/aggregation/useGridAggregation.js +3 -7
  230. package/hooks/features/aggregation/useGridAggregationPreProcessors.js +2 -8
  231. package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +5 -25
  232. package/hooks/features/aggregation/wrapColumnWithAggregation.js +24 -11
  233. package/hooks/features/aiAssistant/api.d.ts +12 -0
  234. package/hooks/features/aiAssistant/api.js +37 -0
  235. package/hooks/features/aiAssistant/gridAiAssistantInterfaces.d.ts +82 -0
  236. package/hooks/features/aiAssistant/gridAiAssistantSelectors.d.ts +5 -0
  237. package/hooks/features/aiAssistant/gridAiAssistantSelectors.js +11 -0
  238. package/hooks/features/aiAssistant/index.d.ts +2 -0
  239. package/hooks/features/aiAssistant/useGridAiAssistant.d.ts +6 -0
  240. package/hooks/features/aiAssistant/useGridAiAssistant.js +303 -0
  241. package/hooks/features/dataSource/useGridDataSourcePremium.js +3 -0
  242. package/hooks/features/index.d.ts +1 -1
  243. package/hooks/features/index.js +4 -4
  244. package/hooks/features/pivoting/gridPivotingInterfaces.d.ts +69 -0
  245. package/hooks/features/pivoting/gridPivotingInterfaces.js +5 -0
  246. package/hooks/features/pivoting/gridPivotingSelectors.d.ts +4 -0
  247. package/hooks/features/pivoting/gridPivotingSelectors.js +30 -0
  248. package/hooks/features/pivoting/useGridPivoting.d.ts +7 -0
  249. package/hooks/features/pivoting/useGridPivoting.js +349 -0
  250. package/hooks/features/pivoting/utils.d.ts +21 -0
  251. package/hooks/features/pivoting/utils.js +270 -0
  252. package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +1 -4
  253. package/hooks/features/rowGrouping/useGridRowGrouping.js +0 -1
  254. package/hooks/utils/useResize.d.ts +9 -0
  255. package/hooks/utils/useResize.js +60 -0
  256. package/index.d.ts +4 -1
  257. package/index.js +19 -3
  258. package/material/icons.d.ts +15 -15
  259. package/material/icons.js +36 -9
  260. package/material/index.d.ts +31 -5
  261. package/material/index.js +30 -2
  262. package/models/dataGridPremiumProps.d.ts +96 -2
  263. package/models/gridApiPremium.d.ts +4 -2
  264. package/models/gridPremiumIconSlotsComponent.d.ts +141 -8
  265. package/models/gridPremiumSlotsComponent.d.ts +13 -1
  266. package/models/gridStatePremium.d.ts +6 -0
  267. package/package.json +9 -15
  268. package/setupExcelExportWebWorker/index.d.ts +1 -0
  269. package/{setupExcelExportWebWorker.js → setupExcelExportWebWorker/index.js} +1 -1
  270. package/typeOverloads/modules.d.ts +32 -1
  271. package/utils/speechRecognition.d.ts +2 -0
  272. package/utils/speechRecognition.js +8 -0
  273. package/components/promptControl/GridToolbarPromptControl.d.ts +0 -26
  274. package/components/promptControl/GridToolbarPromptControl.js +0 -222
  275. package/components/promptControl/RecordButton.d.ts +0 -16
  276. package/components/promptControl/RecordButton.js +0 -119
  277. package/components/promptControl/index.d.ts +0 -1
  278. package/components/promptControl/index.js +0 -12
  279. package/esm/components/promptControl/GridToolbarPromptControl.d.ts +0 -26
  280. package/esm/components/promptControl/GridToolbarPromptControl.js +0 -215
  281. package/esm/components/promptControl/RecordButton.d.ts +0 -16
  282. package/esm/components/promptControl/RecordButton.js +0 -111
  283. package/esm/components/promptControl/index.d.ts +0 -1
  284. package/esm/components/promptControl/index.js +0 -1
  285. package/esm/hooks/features/promptControl/api.d.ts +0 -2
  286. package/esm/hooks/features/promptControl/api.js +0 -22
  287. package/esm/hooks/features/promptControl/index.d.ts +0 -2
  288. package/esm/hooks/features/promptControl/types.d.ts +0 -25
  289. package/esm/setupExcelExportWebWorker.d.ts +0 -1
  290. package/esm/setupExcelExportWebWorker.js +0 -1
  291. package/esm/utils/releaseInfo.d.ts +0 -1
  292. package/esm/utils/releaseInfo.js +0 -13
  293. package/hooks/features/promptControl/api.d.ts +0 -2
  294. package/hooks/features/promptControl/api.js +0 -28
  295. package/hooks/features/promptControl/index.d.ts +0 -2
  296. package/hooks/features/promptControl/types.d.ts +0 -25
  297. package/modern/DataGridPremium/DataGrid.d.ts +0 -8
  298. package/modern/DataGridPremium/DataGrid.js +0 -19
  299. package/modern/DataGridPremium/DataGridPremium.d.ts +0 -16
  300. package/modern/DataGridPremium/DataGridPremium.js +0 -1127
  301. package/modern/DataGridPremium/index.d.ts +0 -3
  302. package/modern/DataGridPremium/index.js +0 -3
  303. package/modern/DataGridPremium/useDataGridPremiumComponent.d.ts +0 -4
  304. package/modern/DataGridPremium/useDataGridPremiumComponent.js +0 -108
  305. package/modern/DataGridPremium/useDataGridPremiumProps.d.ts +0 -6
  306. package/modern/DataGridPremium/useDataGridPremiumProps.js +0 -54
  307. package/modern/components/GridAggregationHeader.d.ts +0 -7
  308. package/modern/components/GridAggregationHeader.js +0 -89
  309. package/modern/components/GridAggregationRowOverlay.d.ts +0 -3
  310. package/modern/components/GridAggregationRowOverlay.js +0 -37
  311. package/modern/components/GridBottomContainer.d.ts +0 -3
  312. package/modern/components/GridBottomContainer.js +0 -43
  313. package/modern/components/GridColumnMenuAggregationItem.d.ts +0 -7
  314. package/modern/components/GridColumnMenuAggregationItem.js +0 -124
  315. package/modern/components/GridColumnMenuRowGroupItem.d.ts +0 -3
  316. package/modern/components/GridColumnMenuRowGroupItem.js +0 -42
  317. package/modern/components/GridColumnMenuRowUngroupItem.d.ts +0 -3
  318. package/modern/components/GridColumnMenuRowUngroupItem.js +0 -44
  319. package/modern/components/GridDataSourceGroupingCriteriaCell.d.ts +0 -7
  320. package/modern/components/GridDataSourceGroupingCriteriaCell.js +0 -121
  321. package/modern/components/GridExcelExportMenuItem.d.ts +0 -9
  322. package/modern/components/GridExcelExportMenuItem.js +0 -48
  323. package/modern/components/GridFooterCell.d.ts +0 -9
  324. package/modern/components/GridFooterCell.js +0 -43
  325. package/modern/components/GridGroupingColumnFooterCell.d.ts +0 -4
  326. package/modern/components/GridGroupingColumnFooterCell.js +0 -23
  327. package/modern/components/GridGroupingColumnLeafCell.d.ts +0 -4
  328. package/modern/components/GridGroupingColumnLeafCell.js +0 -17
  329. package/modern/components/GridGroupingCriteriaCell.d.ts +0 -7
  330. package/modern/components/GridGroupingCriteriaCell.js +0 -87
  331. package/modern/components/GridPremiumColumnMenu.d.ts +0 -33
  332. package/modern/components/GridPremiumColumnMenu.js +0 -37
  333. package/modern/components/GridPremiumToolbar.d.ts +0 -3
  334. package/modern/components/GridPremiumToolbar.js +0 -23
  335. package/modern/components/export/ExportExcel.d.ts +0 -29
  336. package/modern/components/export/index.d.ts +0 -1
  337. package/modern/components/export/index.js +0 -1
  338. package/modern/components/index.d.ts +0 -6
  339. package/modern/components/index.js +0 -6
  340. package/modern/components/promptControl/GridToolbarPromptControl.d.ts +0 -26
  341. package/modern/components/promptControl/GridToolbarPromptControl.js +0 -215
  342. package/modern/components/promptControl/RecordButton.d.ts +0 -16
  343. package/modern/components/promptControl/RecordButton.js +0 -111
  344. package/modern/components/promptControl/index.d.ts +0 -1
  345. package/modern/components/promptControl/index.js +0 -1
  346. package/modern/components/reexports.d.ts +0 -1
  347. package/modern/components/reexports.js +0 -1
  348. package/modern/constants/dataGridPremiumDefaultSlotsComponents.d.ts +0 -2
  349. package/modern/constants/dataGridPremiumDefaultSlotsComponents.js +0 -11
  350. package/modern/hooks/features/aggregation/createAggregationLookup.d.ts +0 -17
  351. package/modern/hooks/features/aggregation/createAggregationLookup.js +0 -111
  352. package/modern/hooks/features/aggregation/gridAggregationFunctions.d.ts +0 -8
  353. package/modern/hooks/features/aggregation/gridAggregationFunctions.js +0 -93
  354. package/modern/hooks/features/aggregation/gridAggregationInterfaces.d.ts +0 -129
  355. package/modern/hooks/features/aggregation/gridAggregationSelectors.d.ts +0 -13
  356. package/modern/hooks/features/aggregation/gridAggregationSelectors.js +0 -15
  357. package/modern/hooks/features/aggregation/gridAggregationUtils.d.ts +0 -62
  358. package/modern/hooks/features/aggregation/gridAggregationUtils.js +0 -180
  359. package/modern/hooks/features/aggregation/index.d.ts +0 -4
  360. package/modern/hooks/features/aggregation/index.js +0 -3
  361. package/modern/hooks/features/aggregation/useGridAggregation.d.ts +0 -6
  362. package/modern/hooks/features/aggregation/useGridAggregation.js +0 -103
  363. package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +0 -4
  364. package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +0 -96
  365. package/modern/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +0 -81
  366. package/modern/hooks/features/aggregation/wrapColumnWithAggregation.js +0 -215
  367. package/modern/hooks/features/cellSelection/gridCellSelectionInterfaces.d.ts +0 -40
  368. package/modern/hooks/features/cellSelection/gridCellSelectionInterfaces.js +0 -1
  369. package/modern/hooks/features/cellSelection/gridCellSelectionSelector.d.ts +0 -2
  370. package/modern/hooks/features/cellSelection/gridCellSelectionSelector.js +0 -2
  371. package/modern/hooks/features/cellSelection/index.d.ts +0 -1
  372. package/modern/hooks/features/cellSelection/index.js +0 -1
  373. package/modern/hooks/features/cellSelection/useGridCellSelection.d.ts +0 -6
  374. package/modern/hooks/features/cellSelection/useGridCellSelection.js +0 -486
  375. package/modern/hooks/features/clipboard/useGridClipboardImport.d.ts +0 -4
  376. package/modern/hooks/features/clipboard/useGridClipboardImport.js +0 -335
  377. package/modern/hooks/features/dataSource/models.d.ts +0 -54
  378. package/modern/hooks/features/dataSource/models.js +0 -1
  379. package/modern/hooks/features/dataSource/useGridDataSourcePremium.d.ts +0 -4
  380. package/modern/hooks/features/dataSource/useGridDataSourcePremium.js +0 -59
  381. package/modern/hooks/features/export/gridExcelExportInterface.d.ts +0 -71
  382. package/modern/hooks/features/export/gridExcelExportInterface.js +0 -1
  383. package/modern/hooks/features/export/index.d.ts +0 -2
  384. package/modern/hooks/features/export/index.js +0 -2
  385. package/modern/hooks/features/export/serializer/excelSerializer.d.ts +0 -40
  386. package/modern/hooks/features/export/serializer/excelSerializer.js +0 -269
  387. package/modern/hooks/features/export/serializer/setupExcelExportWebWorker.d.ts +0 -2
  388. package/modern/hooks/features/export/serializer/setupExcelExportWebWorker.js +0 -53
  389. package/modern/hooks/features/export/serializer/utils.d.ts +0 -36
  390. package/modern/hooks/features/export/serializer/utils.js +0 -93
  391. package/modern/hooks/features/export/useGridExcelExport.d.ts +0 -11
  392. package/modern/hooks/features/export/useGridExcelExport.js +0 -139
  393. package/modern/hooks/features/index.d.ts +0 -5
  394. package/modern/hooks/features/index.js +0 -6
  395. package/modern/hooks/features/promptControl/api.d.ts +0 -2
  396. package/modern/hooks/features/promptControl/api.js +0 -22
  397. package/modern/hooks/features/promptControl/index.d.ts +0 -2
  398. package/modern/hooks/features/promptControl/index.js +0 -1
  399. package/modern/hooks/features/promptControl/types.d.ts +0 -25
  400. package/modern/hooks/features/promptControl/types.js +0 -1
  401. package/modern/hooks/features/rowGrouping/createGroupingColDef.d.ts +0 -57
  402. package/modern/hooks/features/rowGrouping/createGroupingColDef.js +0 -272
  403. package/modern/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +0 -44
  404. package/modern/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +0 -1
  405. package/modern/hooks/features/rowGrouping/gridRowGroupingSelector.d.ts +0 -3
  406. package/modern/hooks/features/rowGrouping/gridRowGroupingSelector.js +0 -5
  407. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +0 -54
  408. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +0 -173
  409. package/modern/hooks/features/rowGrouping/index.d.ts +0 -3
  410. package/modern/hooks/features/rowGrouping/index.js +0 -3
  411. package/modern/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +0 -4
  412. package/modern/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +0 -73
  413. package/modern/hooks/features/rowGrouping/useGridRowGrouping.d.ts +0 -11
  414. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +0 -182
  415. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +0 -4
  416. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +0 -157
  417. package/modern/hooks/features/rows/index.d.ts +0 -1
  418. package/modern/hooks/features/rows/index.js +0 -1
  419. package/modern/hooks/features/rows/useGridRowAriaAttributes.d.ts +0 -1
  420. package/modern/hooks/features/rows/useGridRowAriaAttributes.js +0 -8
  421. package/modern/hooks/index.d.ts +0 -2
  422. package/modern/hooks/index.js +0 -3
  423. package/modern/hooks/utils/index.d.ts +0 -1
  424. package/modern/hooks/utils/index.js +0 -1
  425. package/modern/hooks/utils/useGridApiContext.d.ts +0 -4
  426. package/modern/hooks/utils/useGridApiContext.js +0 -2
  427. package/modern/hooks/utils/useGridApiRef.d.ts +0 -4
  428. package/modern/hooks/utils/useGridApiRef.js +0 -2
  429. package/modern/hooks/utils/useGridAriaAttributes.d.ts +0 -2
  430. package/modern/hooks/utils/useGridAriaAttributes.js +0 -13
  431. package/modern/hooks/utils/useGridPrivateApiContext.d.ts +0 -2
  432. package/modern/hooks/utils/useGridPrivateApiContext.js +0 -2
  433. package/modern/hooks/utils/useGridRootProps.d.ts +0 -2
  434. package/modern/hooks/utils/useGridRootProps.js +0 -2
  435. package/modern/hooks/utils/useKeepGroupedColumnsHidden.d.ts +0 -12
  436. package/modern/hooks/utils/useKeepGroupedColumnsHidden.js +0 -43
  437. package/modern/index.d.ts +0 -23
  438. package/modern/index.js +0 -26
  439. package/modern/locales.d.ts +0 -1
  440. package/modern/locales.js +0 -1
  441. package/modern/material/icons.d.ts +0 -15
  442. package/modern/material/icons.js +0 -20
  443. package/modern/material/index.d.ts +0 -8
  444. package/modern/material/index.js +0 -11
  445. package/modern/models/dataGridPremiumProps.d.ts +0 -162
  446. package/modern/models/dataGridPremiumProps.js +0 -1
  447. package/modern/models/gridApiPremium.d.ts +0 -14
  448. package/modern/models/gridApiPremium.js +0 -1
  449. package/modern/models/gridGroupingValueGetter.d.ts +0 -4
  450. package/modern/models/gridGroupingValueGetter.js +0 -1
  451. package/modern/models/gridPastedValueParser.d.ts +0 -4
  452. package/modern/models/gridPastedValueParser.js +0 -1
  453. package/modern/models/gridPremiumIconSlotsComponent.d.ts +0 -28
  454. package/modern/models/gridPremiumIconSlotsComponent.js +0 -1
  455. package/modern/models/gridPremiumSlotsComponent.d.ts +0 -7
  456. package/modern/models/gridPremiumSlotsComponent.js +0 -1
  457. package/modern/models/gridStatePremium.d.ts +0 -18
  458. package/modern/models/gridStatePremium.js +0 -1
  459. package/modern/models/index.d.ts +0 -4
  460. package/modern/models/index.js +0 -4
  461. package/modern/package.json +0 -1
  462. package/modern/setupExcelExportWebWorker.d.ts +0 -1
  463. package/modern/setupExcelExportWebWorker.js +0 -1
  464. package/modern/themeAugmentation/index.d.ts +0 -2
  465. package/modern/themeAugmentation/index.js +0 -4
  466. package/modern/themeAugmentation/overrides.d.ts +0 -7
  467. package/modern/themeAugmentation/overrides.js +0 -1
  468. package/modern/themeAugmentation/props.d.ts +0 -15
  469. package/modern/themeAugmentation/props.js +0 -1
  470. package/modern/typeOverloads/index.d.ts +0 -2
  471. package/modern/typeOverloads/index.js +0 -2
  472. package/modern/typeOverloads/modules.d.ts +0 -97
  473. package/modern/typeOverloads/modules.js +0 -1
  474. package/modern/typeOverloads/reexports.d.ts +0 -17
  475. package/modern/typeOverloads/reexports.js +0 -15
  476. package/modern/utils/releaseInfo.d.ts +0 -1
  477. package/modern/utils/releaseInfo.js +0 -13
  478. package/setupExcelExportWebWorker.d.ts +0 -1
  479. package/tsconfig.build.tsbuildinfo +0 -1
  480. package/utils/releaseInfo.d.ts +0 -1
  481. package/utils/releaseInfo.js +0 -20
  482. /package/esm/hooks/features/{promptControl/types.js → aiAssistant/gridAiAssistantInterfaces.js} +0 -0
  483. /package/esm/hooks/features/{promptControl → aiAssistant}/index.js +0 -0
  484. /package/{modern/hooks/features/aggregation/gridAggregationInterfaces.js → esm/hooks/features/pivoting/gridPivotingInterfaces.js} +0 -0
  485. /package/hooks/features/{promptControl/types.js → aiAssistant/gridAiAssistantInterfaces.js} +0 -0
  486. /package/hooks/features/{promptControl → aiAssistant}/index.js +0 -0
@@ -1,486 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import * as React from 'react';
3
- import ownerDocument from '@mui/utils/ownerDocument';
4
- import useEventCallback from '@mui/utils/useEventCallback';
5
- import { getTotalHeaderHeight, getVisibleRows, isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor } from '@mui/x-data-grid-pro/internals';
6
- import { useGridEvent, useGridApiMethod, GRID_ACTIONS_COLUMN_TYPE, GRID_CHECKBOX_SELECTION_COL_DEF, GRID_DETAIL_PANEL_TOGGLE_FIELD, gridClasses, gridFocusCellSelector, GRID_REORDER_COL_DEF, gridSortedRowIdsSelector, gridDimensionsSelector } from '@mui/x-data-grid-pro';
7
- import { gridCellSelectionStateSelector } from "./gridCellSelectionSelector.js";
8
- export const cellSelectionStateInitializer = (state, props) => _extends({}, state, {
9
- cellSelection: _extends({}, props.cellSelectionModel ?? props.initialState?.cellSelection)
10
- });
11
- function isKeyboardEvent(event) {
12
- return !!event.key;
13
- }
14
- const AUTO_SCROLL_SENSITIVITY = 50; // The distance from the edge to start scrolling
15
- const AUTO_SCROLL_SPEED = 20; // The speed to scroll once the mouse enters the sensitivity area
16
-
17
- export const useGridCellSelection = (apiRef, props) => {
18
- const hasRootReference = apiRef.current.rootElementRef.current !== null;
19
- const cellWithVirtualFocus = React.useRef(null);
20
- const lastMouseDownCell = React.useRef(null);
21
- const mousePosition = React.useRef(null);
22
- const autoScrollRAF = React.useRef(null);
23
- const totalHeaderHeight = getTotalHeaderHeight(apiRef, props);
24
- const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
25
- const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.clipboardExport : ignoreValueFormatterProp) || false;
26
- const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
27
- apiRef.current.registerControlState({
28
- stateId: 'cellSelection',
29
- propModel: props.cellSelectionModel,
30
- propOnChange: props.onCellSelectionModelChange,
31
- stateSelector: gridCellSelectionStateSelector,
32
- changeEvent: 'cellSelectionChange'
33
- });
34
- const runIfCellSelectionIsEnabled = callback => (...args) => {
35
- if (props.cellSelection) {
36
- callback(...args);
37
- }
38
- };
39
- const isCellSelected = React.useCallback((id, field) => {
40
- if (!props.cellSelection) {
41
- return false;
42
- }
43
- const cellSelectionModel = gridCellSelectionStateSelector(apiRef);
44
- return cellSelectionModel[id] ? !!cellSelectionModel[id][field] : false;
45
- }, [apiRef, props.cellSelection]);
46
- const getCellSelectionModel = React.useCallback(() => {
47
- return gridCellSelectionStateSelector(apiRef);
48
- }, [apiRef]);
49
- const setCellSelectionModel = React.useCallback(newModel => {
50
- if (!props.cellSelection) {
51
- return;
52
- }
53
- apiRef.current.setState(prevState => _extends({}, prevState, {
54
- cellSelection: newModel
55
- }));
56
- }, [apiRef, props.cellSelection]);
57
- const selectCellRange = React.useCallback((start, end, keepOtherSelected = false) => {
58
- const startRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(start.id);
59
- const startColumnIndex = apiRef.current.getColumnIndex(start.field);
60
- const endRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(end.id);
61
- const endColumnIndex = apiRef.current.getColumnIndex(end.field);
62
- let finalStartRowIndex = startRowIndex;
63
- let finalStartColumnIndex = startColumnIndex;
64
- let finalEndRowIndex = endRowIndex;
65
- let finalEndColumnIndex = endColumnIndex;
66
- if (finalStartRowIndex > finalEndRowIndex) {
67
- finalStartRowIndex = endRowIndex;
68
- finalEndRowIndex = startRowIndex;
69
- }
70
- if (finalStartColumnIndex > finalEndColumnIndex) {
71
- finalStartColumnIndex = endColumnIndex;
72
- finalEndColumnIndex = startColumnIndex;
73
- }
74
- const visibleColumns = apiRef.current.getVisibleColumns();
75
- const visibleRows = getVisibleRows(apiRef);
76
- const rowsInRange = visibleRows.rows.slice(finalStartRowIndex, finalEndRowIndex + 1);
77
- const columnsInRange = visibleColumns.slice(finalStartColumnIndex, finalEndColumnIndex + 1);
78
- const newModel = keepOtherSelected ? _extends({}, apiRef.current.getCellSelectionModel()) : {};
79
- rowsInRange.forEach(row => {
80
- if (!newModel[row.id]) {
81
- newModel[row.id] = {};
82
- }
83
- columnsInRange.forEach(column => {
84
- newModel[row.id][column.field] = true;
85
- }, {});
86
- });
87
- apiRef.current.setCellSelectionModel(newModel);
88
- }, [apiRef]);
89
- const getSelectedCellsAsArray = React.useCallback(() => {
90
- const selectionModel = apiRef.current.getCellSelectionModel();
91
- const currentVisibleRows = getVisibleRows(apiRef, props);
92
- const sortedEntries = currentVisibleRows.rows.reduce((result, row) => {
93
- if (row.id in selectionModel) {
94
- result.push([row.id, selectionModel[row.id]]);
95
- }
96
- return result;
97
- }, []);
98
- return sortedEntries.reduce((selectedCells, [id, fields]) => {
99
- selectedCells.push(...Object.entries(fields).reduce((selectedFields, [field, isSelected]) => {
100
- if (isSelected) {
101
- selectedFields.push({
102
- id,
103
- field
104
- });
105
- }
106
- return selectedFields;
107
- }, []));
108
- return selectedCells;
109
- }, []);
110
- }, [apiRef, props]);
111
- const cellSelectionApi = {
112
- isCellSelected,
113
- getCellSelectionModel,
114
- setCellSelectionModel,
115
- selectCellRange,
116
- getSelectedCellsAsArray
117
- };
118
- useGridApiMethod(apiRef, cellSelectionApi, 'public');
119
- const hasClickedValidCellForRangeSelection = React.useCallback(params => {
120
- if (params.field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {
121
- return false;
122
- }
123
- if (params.field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {
124
- return false;
125
- }
126
- const column = apiRef.current.getColumn(params.field);
127
- if (column.type === GRID_ACTIONS_COLUMN_TYPE) {
128
- return false;
129
- }
130
- return params.rowNode.type !== 'pinnedRow';
131
- }, [apiRef]);
132
- const handleMouseUp = useEventCallback(() => {
133
- lastMouseDownCell.current = null;
134
- apiRef.current.rootElementRef?.current?.classList.remove(gridClasses['root--disableUserSelection']);
135
-
136
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
137
- stopAutoScroll();
138
- });
139
- const handleCellMouseDown = React.useCallback((params, event) => {
140
- // Skip if the click comes from the right-button or, only on macOS, Ctrl is pressed
141
- // Fix for https://github.com/mui/mui-x/pull/6567#issuecomment-1329155578
142
- const isMacOs = window.navigator.platform.toUpperCase().indexOf('MAC') >= 0;
143
- if (event.button !== 0 || event.ctrlKey && isMacOs) {
144
- return;
145
- }
146
- if (params.field === GRID_REORDER_COL_DEF.field) {
147
- return;
148
- }
149
- const focusedCell = gridFocusCellSelector(apiRef);
150
- if (hasClickedValidCellForRangeSelection(params) && event.shiftKey && focusedCell) {
151
- event.preventDefault();
152
- }
153
- lastMouseDownCell.current = {
154
- id: params.id,
155
- field: params.field
156
- };
157
- apiRef.current.rootElementRef?.current?.classList.add(gridClasses['root--disableUserSelection']);
158
- const document = ownerDocument(apiRef.current.rootElementRef?.current);
159
- document.addEventListener('mouseup', handleMouseUp, {
160
- once: true
161
- });
162
- }, [apiRef, handleMouseUp, hasClickedValidCellForRangeSelection]);
163
- const stopAutoScroll = React.useCallback(() => {
164
- if (autoScrollRAF.current) {
165
- cancelAnimationFrame(autoScrollRAF.current);
166
- autoScrollRAF.current = null;
167
- }
168
- }, []);
169
- const handleCellFocusIn = React.useCallback(params => {
170
- cellWithVirtualFocus.current = {
171
- id: params.id,
172
- field: params.field
173
- };
174
- }, []);
175
- const startAutoScroll = React.useCallback(() => {
176
- if (autoScrollRAF.current) {
177
- return;
178
- }
179
- if (!apiRef.current.virtualScrollerRef?.current) {
180
- return;
181
- }
182
- function autoScroll() {
183
- if (!mousePosition.current || !apiRef.current.virtualScrollerRef?.current) {
184
- return;
185
- }
186
- const dimensions = gridDimensionsSelector(apiRef);
187
- const {
188
- x: mouseX,
189
- y: mouseY
190
- } = mousePosition.current;
191
- const {
192
- width,
193
- height: viewportOuterHeight
194
- } = dimensions.viewportOuterSize;
195
- const height = viewportOuterHeight - totalHeaderHeight;
196
- let deltaX = 0;
197
- let deltaY = 0;
198
- let factor = 0;
199
- if (mouseY <= AUTO_SCROLL_SENSITIVITY && dimensions.hasScrollY) {
200
- // When scrolling up, the multiplier increases going closer to the top edge
201
- factor = (AUTO_SCROLL_SENSITIVITY - mouseY) / -AUTO_SCROLL_SENSITIVITY;
202
- deltaY = AUTO_SCROLL_SPEED;
203
- } else if (mouseY >= height - AUTO_SCROLL_SENSITIVITY && dimensions.hasScrollY) {
204
- // When scrolling down, the multiplier increases going closer to the bottom edge
205
- factor = (mouseY - (height - AUTO_SCROLL_SENSITIVITY)) / AUTO_SCROLL_SENSITIVITY;
206
- deltaY = AUTO_SCROLL_SPEED;
207
- } else if (mouseX <= AUTO_SCROLL_SENSITIVITY && dimensions.hasScrollX) {
208
- // When scrolling left, the multiplier increases going closer to the left edge
209
- factor = (AUTO_SCROLL_SENSITIVITY - mouseX) / -AUTO_SCROLL_SENSITIVITY;
210
- deltaX = AUTO_SCROLL_SPEED;
211
- } else if (mouseX >= width - AUTO_SCROLL_SENSITIVITY && dimensions.hasScrollX) {
212
- // When scrolling right, the multiplier increases going closer to the right edge
213
- factor = (mouseX - (width - AUTO_SCROLL_SENSITIVITY)) / AUTO_SCROLL_SENSITIVITY;
214
- deltaX = AUTO_SCROLL_SPEED;
215
- }
216
- if (deltaX !== 0 || deltaY !== 0) {
217
- const {
218
- scrollLeft,
219
- scrollTop
220
- } = apiRef.current.virtualScrollerRef.current;
221
- apiRef.current.scroll({
222
- top: scrollTop + deltaY * factor,
223
- left: scrollLeft + deltaX * factor
224
- });
225
- }
226
- autoScrollRAF.current = requestAnimationFrame(autoScroll);
227
- }
228
- autoScroll();
229
- }, [apiRef, totalHeaderHeight]);
230
- const handleCellMouseOver = React.useCallback((params, event) => {
231
- if (!lastMouseDownCell.current) {
232
- return;
233
- }
234
- const {
235
- id,
236
- field
237
- } = params;
238
- apiRef.current.selectCellRange(lastMouseDownCell.current, {
239
- id,
240
- field
241
- }, event.ctrlKey || event.metaKey);
242
- const virtualScrollerRect = apiRef.current.virtualScrollerRef?.current?.getBoundingClientRect();
243
- if (!virtualScrollerRect) {
244
- return;
245
- }
246
- const dimensions = gridDimensionsSelector(apiRef);
247
- const {
248
- x,
249
- y
250
- } = virtualScrollerRect;
251
- const {
252
- width,
253
- height: viewportOuterHeight
254
- } = dimensions.viewportOuterSize;
255
- const height = viewportOuterHeight - totalHeaderHeight;
256
- const mouseX = event.clientX - x;
257
- const mouseY = event.clientY - y - totalHeaderHeight;
258
- mousePosition.current = {
259
- x: mouseX,
260
- y: mouseY
261
- };
262
- const hasEnteredVerticalSensitivityArea = mouseY <= AUTO_SCROLL_SENSITIVITY || mouseY >= height - AUTO_SCROLL_SENSITIVITY;
263
- const hasEnteredHorizontalSensitivityArea = mouseX <= AUTO_SCROLL_SENSITIVITY || mouseX >= width - AUTO_SCROLL_SENSITIVITY;
264
- const hasEnteredSensitivityArea = hasEnteredVerticalSensitivityArea || hasEnteredHorizontalSensitivityArea;
265
- if (hasEnteredSensitivityArea) {
266
- // Mouse has entered the sensitity area for the first time
267
- startAutoScroll();
268
- } else {
269
- // Mouse has left the sensitivity area while auto scroll is on
270
- stopAutoScroll();
271
- }
272
- }, [apiRef, startAutoScroll, stopAutoScroll, totalHeaderHeight]);
273
- const handleCellClick = useEventCallback((params, event) => {
274
- const {
275
- id,
276
- field
277
- } = params;
278
- if (!hasClickedValidCellForRangeSelection(params)) {
279
- return;
280
- }
281
- const focusedCell = gridFocusCellSelector(apiRef);
282
- if (event.shiftKey && focusedCell) {
283
- apiRef.current.selectCellRange(focusedCell, {
284
- id,
285
- field
286
- });
287
- cellWithVirtualFocus.current = {
288
- id,
289
- field
290
- };
291
- return;
292
- }
293
- if (event.ctrlKey || event.metaKey) {
294
- // Add the clicked cell to the selection
295
- const prevModel = apiRef.current.getCellSelectionModel();
296
- apiRef.current.setCellSelectionModel(_extends({}, prevModel, {
297
- [id]: _extends({}, prevModel[id], {
298
- [field]: !apiRef.current.isCellSelected(id, field)
299
- })
300
- }));
301
- } else {
302
- // Clear the selection and keep only the clicked cell selected
303
- apiRef.current.setCellSelectionModel({
304
- [id]: {
305
- [field]: true
306
- }
307
- });
308
- }
309
- });
310
- const handleCellKeyDown = useEventCallback((params, event) => {
311
- if (!isNavigationKey(event.key) || !cellWithVirtualFocus.current) {
312
- return;
313
- }
314
- if (!event.shiftKey) {
315
- apiRef.current.setCellSelectionModel({});
316
- return;
317
- }
318
- const {
319
- current: otherCell
320
- } = cellWithVirtualFocus;
321
- let endRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(otherCell.id);
322
- let endColumnIndex = apiRef.current.getColumnIndex(otherCell.field);
323
- if (event.key === 'ArrowDown') {
324
- endRowIndex += 1;
325
- } else if (event.key === 'ArrowUp') {
326
- endRowIndex -= 1;
327
- } else if (event.key === 'ArrowRight') {
328
- endColumnIndex += 1;
329
- } else if (event.key === 'ArrowLeft') {
330
- endColumnIndex -= 1;
331
- }
332
- const visibleRows = getVisibleRows(apiRef);
333
- if (endRowIndex < 0 || endRowIndex >= visibleRows.rows.length) {
334
- return;
335
- }
336
- const visibleColumns = apiRef.current.getVisibleColumns();
337
- if (endColumnIndex < 0 || endColumnIndex >= visibleColumns.length) {
338
- return;
339
- }
340
- cellWithVirtualFocus.current = {
341
- id: visibleRows.rows[endRowIndex].id,
342
- field: visibleColumns[endColumnIndex].field
343
- };
344
- apiRef.current.scrollToIndexes({
345
- rowIndex: endRowIndex,
346
- colIndex: endColumnIndex
347
- });
348
- const {
349
- id,
350
- field
351
- } = params;
352
- apiRef.current.selectCellRange({
353
- id,
354
- field
355
- }, cellWithVirtualFocus.current);
356
- });
357
- useGridEvent(apiRef, 'cellClick', runIfCellSelectionIsEnabled(handleCellClick));
358
- useGridEvent(apiRef, 'cellFocusIn', runIfCellSelectionIsEnabled(handleCellFocusIn));
359
- useGridEvent(apiRef, 'cellKeyDown', runIfCellSelectionIsEnabled(handleCellKeyDown));
360
- useGridEvent(apiRef, 'cellMouseDown', runIfCellSelectionIsEnabled(handleCellMouseDown));
361
- useGridEvent(apiRef, 'cellMouseOver', runIfCellSelectionIsEnabled(handleCellMouseOver));
362
- React.useEffect(() => {
363
- if (props.cellSelectionModel) {
364
- apiRef.current.setCellSelectionModel(props.cellSelectionModel);
365
- }
366
- }, [apiRef, props.cellSelectionModel]);
367
- React.useEffect(() => {
368
- const rootRef = apiRef.current.rootElementRef?.current;
369
- return () => {
370
- stopAutoScroll();
371
- const document = ownerDocument(rootRef);
372
- document.removeEventListener('mouseup', handleMouseUp);
373
- };
374
- }, [apiRef, hasRootReference, handleMouseUp, stopAutoScroll]);
375
- const checkIfCellIsSelected = React.useCallback((isSelected, {
376
- id,
377
- field
378
- }) => {
379
- return apiRef.current.isCellSelected(id, field);
380
- }, [apiRef]);
381
- const addClassesToCells = React.useCallback((classes, {
382
- id,
383
- field
384
- }) => {
385
- const visibleRows = getVisibleRows(apiRef);
386
- if (!visibleRows.range || !apiRef.current.isCellSelected(id, field)) {
387
- return classes;
388
- }
389
- const newClasses = [...classes];
390
- const rowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(id);
391
- const columnIndex = apiRef.current.getColumnIndex(field);
392
- const visibleColumns = apiRef.current.getVisibleColumns();
393
- if (rowIndex > 0) {
394
- const {
395
- id: previousRowId
396
- } = visibleRows.rows[rowIndex - 1];
397
- if (!apiRef.current.isCellSelected(previousRowId, field)) {
398
- newClasses.push(gridClasses['cell--rangeTop']);
399
- }
400
- } else {
401
- newClasses.push(gridClasses['cell--rangeTop']);
402
- }
403
- if (rowIndex + visibleRows.range.firstRowIndex < visibleRows.range.lastRowIndex) {
404
- const {
405
- id: nextRowId
406
- } = visibleRows.rows[rowIndex + 1];
407
- if (!apiRef.current.isCellSelected(nextRowId, field)) {
408
- newClasses.push(gridClasses['cell--rangeBottom']);
409
- }
410
- } else {
411
- newClasses.push(gridClasses['cell--rangeBottom']);
412
- }
413
- if (columnIndex > 0) {
414
- const {
415
- field: previousColumnField
416
- } = visibleColumns[columnIndex - 1];
417
- if (!apiRef.current.isCellSelected(id, previousColumnField)) {
418
- newClasses.push(gridClasses['cell--rangeLeft']);
419
- }
420
- } else {
421
- newClasses.push(gridClasses['cell--rangeLeft']);
422
- }
423
- if (columnIndex < visibleColumns.length - 1) {
424
- const {
425
- field: nextColumnField
426
- } = visibleColumns[columnIndex + 1];
427
- if (!apiRef.current.isCellSelected(id, nextColumnField)) {
428
- newClasses.push(gridClasses['cell--rangeRight']);
429
- }
430
- } else {
431
- newClasses.push(gridClasses['cell--rangeRight']);
432
- }
433
- return newClasses;
434
- }, [apiRef]);
435
- const canUpdateFocus = React.useCallback((initialValue, {
436
- event,
437
- cell
438
- }) => {
439
- if (!cell || !props.cellSelection || !event.shiftKey) {
440
- return initialValue;
441
- }
442
- if (isKeyboardEvent(event)) {
443
- return isNavigationKey(event.key) ? false : initialValue;
444
- }
445
- const focusedCell = gridFocusCellSelector(apiRef);
446
- if (hasClickedValidCellForRangeSelection(cell) && focusedCell) {
447
- return false;
448
- }
449
- return initialValue;
450
- }, [apiRef, props.cellSelection, hasClickedValidCellForRangeSelection]);
451
- const handleClipboardCopy = React.useCallback(value => {
452
- if (apiRef.current.getSelectedCellsAsArray().length <= 1) {
453
- return value;
454
- }
455
- const sortedRowIds = gridSortedRowIdsSelector(apiRef);
456
- const cellSelectionModel = apiRef.current.getCellSelectionModel();
457
- const unsortedSelectedRowIds = Object.keys(cellSelectionModel);
458
- const sortedSelectedRowIds = sortedRowIds.filter(id => unsortedSelectedRowIds.includes(`${id}`));
459
- const copyData = sortedSelectedRowIds.reduce((acc, rowId) => {
460
- const fieldsMap = cellSelectionModel[rowId];
461
- const rowString = Object.keys(fieldsMap).reduce((acc2, field) => {
462
- let cellData;
463
- if (fieldsMap[field]) {
464
- const cellParams = apiRef.current.getCellParams(rowId, field);
465
- cellData = serializeCellValue(cellParams, {
466
- csvOptions: {
467
- delimiter: clipboardCopyCellDelimiter,
468
- shouldAppendQuotes: false,
469
- escapeFormulas: false
470
- },
471
- ignoreValueFormatter
472
- });
473
- } else {
474
- cellData = '';
475
- }
476
- return acc2 === '' ? cellData : [acc2, cellData].join(clipboardCopyCellDelimiter);
477
- }, '');
478
- return acc === '' ? rowString : [acc, rowString].join('\r\n');
479
- }, '');
480
- return copyData;
481
- }, [apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter]);
482
- useGridRegisterPipeProcessor(apiRef, 'isCellSelected', checkIfCellIsSelected);
483
- useGridRegisterPipeProcessor(apiRef, 'cellClassName', addClassesToCells);
484
- useGridRegisterPipeProcessor(apiRef, 'canUpdateFocus', canUpdateFocus);
485
- useGridRegisterPipeProcessor(apiRef, 'clipboardCopy', handleClipboardCopy);
486
- };
@@ -1,4 +0,0 @@
1
- import { RefObject } from '@mui/x-internals/types';
2
- import { GridPrivateApiPremium } from "../../../models/gridApiPremium.js";
3
- import type { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
4
- export declare const useGridClipboardImport: (apiRef: RefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "pagination" | "paginationMode" | "processRowUpdate" | "onProcessRowUpdateError" | "getRowId" | "onClipboardPasteStart" | "onClipboardPasteEnd" | "splitClipboardPastedText" | "disableClipboardPaste" | "onBeforeClipboardPasteStart">) => void;