@mui/x-data-grid 6.6.0 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/CHANGELOG.md +147 -13
  2. package/components/GridColumnHeaders.d.ts +2 -2
  3. package/components/GridColumnHeaders.js +3 -1
  4. package/components/GridRow.d.ts +2 -2
  5. package/components/GridRow.js +23 -69
  6. package/components/cell/GridCell.d.ts +24 -15
  7. package/components/cell/GridCell.js +422 -45
  8. package/components/cell/index.d.ts +2 -1
  9. package/components/cell/index.js +1 -1
  10. package/components/containers/GridRootStyles.js +38 -17
  11. package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  12. package/components/panel/GridColumnsPanel.d.ts +14 -0
  13. package/components/panel/GridColumnsPanel.js +14 -0
  14. package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +0 -1
  15. package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
  16. package/components/panel/filterPanel/GridFilterInputDate.d.ts +0 -1
  17. package/components/panel/filterPanel/GridFilterInputDate.js +1 -6
  18. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +0 -1
  19. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +5 -6
  20. package/components/panel/filterPanel/GridFilterInputValue.d.ts +0 -1
  21. package/components/panel/filterPanel/GridFilterInputValue.js +1 -6
  22. package/components/panel/filterPanel/GridFilterPanel.d.ts +8 -0
  23. package/components/panel/filterPanel/GridFilterPanel.js +8 -0
  24. package/components/toolbar/GridToolbar.js +2 -2
  25. package/components/virtualization/GridVirtualScroller.js +4 -9
  26. package/components/virtualization/GridVirtualScrollerContent.js +11 -20
  27. package/constants/defaultGridSlotsComponents.js +6 -2
  28. package/constants/gridClasses.d.ts +4 -0
  29. package/constants/gridClasses.js +1 -1
  30. package/constants/localeTextConstants.js +4 -4
  31. package/hooks/core/useGridApiInitialization.js +4 -1
  32. package/hooks/core/useGridStateInitialization.js +2 -9
  33. package/hooks/features/clipboard/useGridClipboard.js +1 -4
  34. package/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  35. package/hooks/features/editing/useGridCellEditing.js +5 -3
  36. package/hooks/features/editing/useGridRowEditing.js +14 -6
  37. package/hooks/features/filter/gridFilterUtils.d.ts +4 -1
  38. package/hooks/features/filter/gridFilterUtils.js +19 -13
  39. package/hooks/features/filter/useGridFilter.js +4 -2
  40. package/hooks/features/focus/useGridFocus.js +10 -4
  41. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  42. package/hooks/features/rows/useGridParamsApi.d.ts +2 -0
  43. package/hooks/features/rows/useGridParamsApi.js +7 -15
  44. package/hooks/features/rows/useGridRowsMeta.js +1 -1
  45. package/hooks/features/sorting/useGridSorting.js +2 -1
  46. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -816
  47. package/hooks/features/virtualization/useGridVirtualScroller.js +42 -40
  48. package/hooks/utils/index.d.ts +1 -1
  49. package/hooks/utils/index.js +1 -1
  50. package/hooks/utils/useGridSelector.d.ts +3 -1
  51. package/hooks/utils/useGridSelector.js +37 -6
  52. package/hooks/utils/useLazyRef.d.ts +2 -0
  53. package/hooks/utils/useLazyRef.js +9 -0
  54. package/hooks/utils/useOnMount.d.ts +2 -0
  55. package/hooks/utils/useOnMount.js +7 -0
  56. package/index.js +1 -1
  57. package/legacy/components/GridColumnHeaders.js +3 -1
  58. package/legacy/components/GridRow.js +25 -69
  59. package/legacy/components/cell/GridCell.js +425 -46
  60. package/legacy/components/cell/index.js +1 -1
  61. package/legacy/components/containers/GridRootStyles.js +25 -18
  62. package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  63. package/legacy/components/panel/GridColumnsPanel.js +14 -0
  64. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +7 -7
  65. package/legacy/components/panel/filterPanel/GridFilterInputDate.js +1 -5
  66. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -6
  67. package/legacy/components/panel/filterPanel/GridFilterInputValue.js +1 -5
  68. package/legacy/components/panel/filterPanel/GridFilterPanel.js +8 -0
  69. package/legacy/components/toolbar/GridToolbar.js +2 -2
  70. package/legacy/components/virtualization/GridVirtualScroller.js +4 -7
  71. package/legacy/components/virtualization/GridVirtualScrollerContent.js +10 -17
  72. package/legacy/constants/defaultGridSlotsComponents.js +6 -2
  73. package/legacy/constants/gridClasses.js +1 -1
  74. package/legacy/constants/localeTextConstants.js +4 -4
  75. package/legacy/hooks/core/useGridApiInitialization.js +4 -1
  76. package/legacy/hooks/core/useGridStateInitialization.js +2 -7
  77. package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -4
  78. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  79. package/legacy/hooks/features/editing/useGridCellEditing.js +5 -3
  80. package/legacy/hooks/features/editing/useGridRowEditing.js +15 -7
  81. package/legacy/hooks/features/filter/gridFilterUtils.js +23 -19
  82. package/legacy/hooks/features/filter/useGridFilter.js +4 -2
  83. package/legacy/hooks/features/focus/useGridFocus.js +10 -4
  84. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  85. package/legacy/hooks/features/rows/useGridParamsApi.js +23 -15
  86. package/legacy/hooks/features/rows/useGridRowsMeta.js +1 -1
  87. package/legacy/hooks/features/sorting/useGridSorting.js +2 -1
  88. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +40 -36
  89. package/legacy/hooks/utils/index.js +1 -1
  90. package/legacy/hooks/utils/useGridSelector.js +43 -5
  91. package/legacy/hooks/utils/useLazyRef.js +9 -0
  92. package/legacy/hooks/utils/useOnMount.js +7 -0
  93. package/legacy/index.js +1 -1
  94. package/legacy/locales/arSD.js +4 -4
  95. package/legacy/locales/beBY.js +4 -4
  96. package/legacy/locales/bgBG.js +4 -4
  97. package/legacy/locales/csCZ.js +25 -27
  98. package/legacy/locales/daDK.js +4 -4
  99. package/legacy/locales/deDE.js +25 -27
  100. package/legacy/locales/elGR.js +70 -79
  101. package/legacy/locales/esES.js +4 -4
  102. package/legacy/locales/faIR.js +4 -4
  103. package/legacy/locales/fiFI.js +4 -4
  104. package/legacy/locales/heIL.js +4 -4
  105. package/legacy/locales/huHU.js +4 -4
  106. package/legacy/locales/itIT.js +4 -4
  107. package/legacy/locales/jaJP.js +4 -4
  108. package/legacy/locales/koKR.js +4 -4
  109. package/legacy/locales/nbNO.js +4 -4
  110. package/legacy/locales/plPL.js +4 -4
  111. package/legacy/locales/ptBR.js +4 -4
  112. package/legacy/locales/roRO.js +4 -4
  113. package/legacy/locales/ruRU.js +4 -4
  114. package/legacy/locales/skSK.js +4 -4
  115. package/legacy/locales/svSE.js +4 -4
  116. package/legacy/locales/trTR.js +16 -17
  117. package/legacy/locales/ukUA.js +4 -4
  118. package/legacy/locales/urPK.js +4 -4
  119. package/legacy/locales/viVN.js +4 -4
  120. package/legacy/locales/zhCN.js +4 -4
  121. package/legacy/locales/zhTW.js +4 -4
  122. package/legacy/utils/EventManager.js +2 -2
  123. package/legacy/utils/Store.js +34 -0
  124. package/legacy/utils/doesSupportPreventScroll.js +13 -0
  125. package/legacy/utils/fastMemo.js +5 -0
  126. package/legacy/utils/fastObjectShallowCompare.js +32 -0
  127. package/legacy/utils/keyboardUtils.js +4 -2
  128. package/locales/arSD.js +4 -4
  129. package/locales/beBY.js +4 -4
  130. package/locales/bgBG.js +4 -4
  131. package/locales/csCZ.js +25 -27
  132. package/locales/daDK.js +4 -4
  133. package/locales/deDE.js +25 -27
  134. package/locales/elGR.js +66 -79
  135. package/locales/esES.js +4 -4
  136. package/locales/faIR.js +4 -4
  137. package/locales/fiFI.js +4 -4
  138. package/locales/heIL.js +4 -4
  139. package/locales/huHU.js +4 -4
  140. package/locales/itIT.js +4 -4
  141. package/locales/jaJP.js +4 -4
  142. package/locales/koKR.js +4 -4
  143. package/locales/nbNO.js +4 -4
  144. package/locales/plPL.js +4 -4
  145. package/locales/ptBR.js +4 -4
  146. package/locales/roRO.js +4 -4
  147. package/locales/ruRU.js +4 -4
  148. package/locales/skSK.js +4 -4
  149. package/locales/svSE.js +4 -4
  150. package/locales/trTR.js +16 -17
  151. package/locales/ukUA.js +4 -4
  152. package/locales/urPK.js +4 -4
  153. package/locales/viVN.js +4 -4
  154. package/locales/zhCN.js +4 -4
  155. package/locales/zhTW.js +4 -4
  156. package/models/api/gridCoreApi.d.ts +6 -0
  157. package/models/colDef/gridColDef.d.ts +4 -3
  158. package/models/colDef/gridColType.d.ts +3 -1
  159. package/models/events/gridEventLookup.d.ts +11 -3
  160. package/modern/components/GridColumnHeaders.js +3 -1
  161. package/modern/components/GridRow.js +22 -69
  162. package/modern/components/cell/GridCell.js +421 -45
  163. package/modern/components/cell/index.js +1 -1
  164. package/modern/components/containers/GridRootStyles.js +38 -17
  165. package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  166. package/modern/components/panel/GridColumnsPanel.js +14 -0
  167. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
  168. package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -6
  169. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +5 -6
  170. package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -6
  171. package/modern/components/panel/filterPanel/GridFilterPanel.js +8 -0
  172. package/modern/components/toolbar/GridToolbar.js +2 -2
  173. package/modern/components/virtualization/GridVirtualScroller.js +4 -9
  174. package/modern/components/virtualization/GridVirtualScrollerContent.js +10 -20
  175. package/modern/constants/defaultGridSlotsComponents.js +6 -2
  176. package/modern/constants/gridClasses.js +1 -1
  177. package/modern/constants/localeTextConstants.js +4 -4
  178. package/modern/hooks/core/useGridApiInitialization.js +4 -1
  179. package/modern/hooks/core/useGridStateInitialization.js +2 -9
  180. package/modern/hooks/features/clipboard/useGridClipboard.js +1 -4
  181. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  182. package/modern/hooks/features/editing/useGridCellEditing.js +5 -3
  183. package/modern/hooks/features/editing/useGridRowEditing.js +14 -6
  184. package/modern/hooks/features/filter/gridFilterUtils.js +17 -12
  185. package/modern/hooks/features/filter/useGridFilter.js +4 -2
  186. package/modern/hooks/features/focus/useGridFocus.js +9 -4
  187. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  188. package/modern/hooks/features/rows/useGridParamsApi.js +7 -15
  189. package/modern/hooks/features/rows/useGridRowsMeta.js +1 -1
  190. package/modern/hooks/features/sorting/useGridSorting.js +2 -1
  191. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +42 -40
  192. package/modern/hooks/utils/index.js +1 -1
  193. package/modern/hooks/utils/useGridSelector.js +37 -6
  194. package/modern/hooks/utils/useLazyRef.js +9 -0
  195. package/modern/hooks/utils/useOnMount.js +7 -0
  196. package/modern/index.js +1 -1
  197. package/modern/locales/arSD.js +4 -4
  198. package/modern/locales/beBY.js +4 -4
  199. package/modern/locales/bgBG.js +4 -4
  200. package/modern/locales/csCZ.js +25 -27
  201. package/modern/locales/daDK.js +4 -4
  202. package/modern/locales/deDE.js +25 -27
  203. package/modern/locales/elGR.js +66 -79
  204. package/modern/locales/esES.js +4 -4
  205. package/modern/locales/faIR.js +4 -4
  206. package/modern/locales/fiFI.js +4 -4
  207. package/modern/locales/heIL.js +4 -4
  208. package/modern/locales/huHU.js +4 -4
  209. package/modern/locales/itIT.js +4 -4
  210. package/modern/locales/jaJP.js +4 -4
  211. package/modern/locales/koKR.js +4 -4
  212. package/modern/locales/nbNO.js +4 -4
  213. package/modern/locales/plPL.js +4 -4
  214. package/modern/locales/ptBR.js +4 -4
  215. package/modern/locales/roRO.js +4 -4
  216. package/modern/locales/ruRU.js +4 -4
  217. package/modern/locales/skSK.js +4 -4
  218. package/modern/locales/svSE.js +4 -4
  219. package/modern/locales/trTR.js +16 -17
  220. package/modern/locales/ukUA.js +4 -4
  221. package/modern/locales/urPK.js +4 -4
  222. package/modern/locales/viVN.js +4 -4
  223. package/modern/locales/zhCN.js +4 -4
  224. package/modern/locales/zhTW.js +4 -4
  225. package/modern/utils/EventManager.js +2 -2
  226. package/modern/utils/Store.js +24 -0
  227. package/modern/utils/doesSupportPreventScroll.js +13 -0
  228. package/modern/utils/fastMemo.js +5 -0
  229. package/modern/utils/fastObjectShallowCompare.js +32 -0
  230. package/modern/utils/keyboardUtils.js +4 -2
  231. package/node/components/GridColumnHeaders.js +4 -2
  232. package/node/components/GridRow.js +22 -69
  233. package/node/components/cell/GridCell.js +424 -47
  234. package/node/components/cell/index.js +17 -10
  235. package/node/components/containers/GridRootStyles.js +38 -17
  236. package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  237. package/node/components/panel/GridColumnsPanel.js +14 -0
  238. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
  239. package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -6
  240. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +5 -6
  241. package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -6
  242. package/node/components/panel/filterPanel/GridFilterPanel.js +8 -0
  243. package/node/components/toolbar/GridToolbar.js +2 -2
  244. package/node/components/virtualization/GridVirtualScroller.js +4 -9
  245. package/node/components/virtualization/GridVirtualScrollerContent.js +10 -20
  246. package/node/constants/defaultGridSlotsComponents.js +4 -1
  247. package/node/constants/gridClasses.js +1 -1
  248. package/node/constants/localeTextConstants.js +4 -4
  249. package/node/hooks/core/useGridApiInitialization.js +4 -1
  250. package/node/hooks/core/useGridStateInitialization.js +2 -9
  251. package/node/hooks/features/clipboard/useGridClipboard.js +1 -4
  252. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -2
  253. package/node/hooks/features/editing/useGridCellEditing.js +5 -3
  254. package/node/hooks/features/editing/useGridRowEditing.js +14 -6
  255. package/node/hooks/features/filter/gridFilterUtils.js +17 -12
  256. package/node/hooks/features/filter/useGridFilter.js +7 -5
  257. package/node/hooks/features/focus/useGridFocus.js +9 -4
  258. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  259. package/node/hooks/features/rows/useGridParamsApi.js +9 -15
  260. package/node/hooks/features/rows/useGridRowsMeta.js +1 -1
  261. package/node/hooks/features/sorting/useGridSorting.js +2 -1
  262. package/node/hooks/features/virtualization/useGridVirtualScroller.js +42 -38
  263. package/node/hooks/utils/index.js +14 -10
  264. package/node/hooks/utils/useGridSelector.js +41 -7
  265. package/node/hooks/utils/useLazyRef.js +17 -0
  266. package/node/hooks/utils/useOnMount.js +15 -0
  267. package/node/index.js +1 -1
  268. package/node/locales/arSD.js +4 -4
  269. package/node/locales/beBY.js +4 -4
  270. package/node/locales/bgBG.js +4 -4
  271. package/node/locales/csCZ.js +25 -27
  272. package/node/locales/daDK.js +4 -4
  273. package/node/locales/deDE.js +25 -27
  274. package/node/locales/elGR.js +66 -79
  275. package/node/locales/esES.js +4 -4
  276. package/node/locales/faIR.js +4 -4
  277. package/node/locales/fiFI.js +4 -4
  278. package/node/locales/heIL.js +4 -4
  279. package/node/locales/huHU.js +4 -4
  280. package/node/locales/itIT.js +4 -4
  281. package/node/locales/jaJP.js +4 -4
  282. package/node/locales/koKR.js +4 -4
  283. package/node/locales/nbNO.js +4 -4
  284. package/node/locales/plPL.js +4 -4
  285. package/node/locales/ptBR.js +4 -4
  286. package/node/locales/roRO.js +4 -4
  287. package/node/locales/ruRU.js +4 -4
  288. package/node/locales/skSK.js +4 -4
  289. package/node/locales/svSE.js +4 -4
  290. package/node/locales/trTR.js +16 -17
  291. package/node/locales/ukUA.js +4 -4
  292. package/node/locales/urPK.js +4 -4
  293. package/node/locales/viVN.js +4 -4
  294. package/node/locales/zhCN.js +4 -4
  295. package/node/locales/zhTW.js +4 -4
  296. package/node/utils/EventManager.js +2 -2
  297. package/node/utils/Store.js +31 -0
  298. package/node/utils/doesSupportPreventScroll.js +19 -0
  299. package/node/utils/fastMemo.js +13 -0
  300. package/node/utils/fastObjectShallowCompare.js +38 -0
  301. package/node/utils/keyboardUtils.js +4 -2
  302. package/package.json +1 -1
  303. package/themeAugmentation/overrides.d.ts +1 -1
  304. package/utils/EventManager.js +2 -2
  305. package/utils/Store.d.ts +11 -0
  306. package/utils/Store.js +24 -0
  307. package/utils/doesSupportPreventScroll.d.ts +1 -0
  308. package/utils/doesSupportPreventScroll.js +13 -0
  309. package/utils/fastMemo.d.ts +1 -0
  310. package/utils/fastMemo.js +5 -0
  311. package/utils/fastObjectShallowCompare.d.ts +1 -0
  312. package/utils/fastObjectShallowCompare.js +32 -0
  313. package/utils/keyboardUtils.js +4 -2
@@ -183,22 +183,26 @@ export const buildAggregatedFilterApplier = (filterModel, apiRef) => {
183
183
  passingQuickFilterValues: isRowMatchingQuickFilter && isRowMatchingQuickFilter(rowId, shouldApplyFilter)
184
184
  });
185
185
  };
186
- export const passFilterLogic = (allFilterItemResults, allQuickFilterResults, filterModel, apiRef) => {
187
- var _filterModel$quickFil, _filterModel$logicOpe;
188
- const cleanedFilterItems = filterModel.items.filter(item => getFilterCallbackFromItem(item, apiRef) !== null);
189
- const cleanedAllFilterItemResults = allFilterItemResults.filter(result => result != null);
190
- const cleanedAllQuickFilterResults = allQuickFilterResults.filter(result => result != null);
191
-
192
- // Defaultize operators
193
- const quickFilterLogicOperator = (_filterModel$quickFil = filterModel.quickFilterLogicOperator) != null ? _filterModel$quickFil : getDefaultGridFilterModel().quickFilterLogicOperator;
194
- const logicOperator = (_filterModel$logicOpe = filterModel.logicOperator) != null ? _filterModel$logicOpe : getDefaultGridFilterModel().logicOperator;
186
+ const isNotNull = result => result != null;
187
+ const filterModelItems = (cache, apiRef, items) => {
188
+ if (!cache.cleanedFilterItems) {
189
+ cache.cleanedFilterItems = items.filter(item => getFilterCallbackFromItem(item, apiRef) !== null);
190
+ }
191
+ return cache.cleanedFilterItems;
192
+ };
193
+ export const passFilterLogic = (allFilterItemResults, allQuickFilterResults, filterModel, apiRef, cache) => {
194
+ const cleanedFilterItems = filterModelItems(cache, apiRef, filterModel.items);
195
+ const cleanedFilterItemResults = allFilterItemResults.filter(isNotNull);
196
+ const cleanedQuickFilterResults = allQuickFilterResults.filter(isNotNull);
195
197
 
196
198
  // get result for filter items model
197
- if (cleanedAllFilterItemResults.length > 0) {
199
+ if (cleanedFilterItemResults.length > 0) {
200
+ var _filterModel$logicOpe;
198
201
  // Return true if the item pass with one of the rows
199
202
  const filterItemPredicate = item => {
200
- return cleanedAllFilterItemResults.some(filterItemResult => filterItemResult[item.id]);
203
+ return cleanedFilterItemResults.some(filterItemResult => filterItemResult[item.id]);
201
204
  };
205
+ const logicOperator = (_filterModel$logicOpe = filterModel.logicOperator) != null ? _filterModel$logicOpe : getDefaultGridFilterModel().logicOperator;
202
206
  if (logicOperator === GridLogicOperator.And) {
203
207
  const passesAllFilters = cleanedFilterItems.every(filterItemPredicate);
204
208
  if (!passesAllFilters) {
@@ -213,11 +217,13 @@ export const passFilterLogic = (allFilterItemResults, allQuickFilterResults, fil
213
217
  }
214
218
 
215
219
  // get result for quick filter model
216
- if (cleanedAllQuickFilterResults.length > 0 && filterModel.quickFilterValues != null) {
220
+ if (cleanedQuickFilterResults.length > 0 && filterModel.quickFilterValues != null) {
221
+ var _filterModel$quickFil;
217
222
  // Return true if the item pass with one of the rows
218
223
  const quickFilterValuePredicate = value => {
219
- return cleanedAllQuickFilterResults.some(quickFilterValueResult => quickFilterValueResult[value]);
224
+ return cleanedQuickFilterResults.some(quickFilterValueResult => quickFilterValueResult[value]);
220
225
  };
226
+ const quickFilterLogicOperator = (_filterModel$quickFil = filterModel.quickFilterLogicOperator) != null ? _filterModel$quickFil : getDefaultGridFilterModel().quickFilterLogicOperator;
221
227
  if (quickFilterLogicOperator === GridLogicOperator.And) {
222
228
  const passesAllQuickFilterValues = filterModel.quickFilterValues.every(quickFilterValuePredicate);
223
229
  if (!passesAllQuickFilterValues) {
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
3
4
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
4
5
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
5
6
  import { useGridLogger } from '../../utils/useGridLogger';
@@ -260,6 +261,7 @@ export const useGridFilter = (apiRef, props) => {
260
261
  const tree = gridRowTreeSelector(apiRef);
261
262
  const rowIds = tree[GRID_ROOT_GROUP_ID].children;
262
263
  const filteredRowsLookup = {};
264
+ const filterCache = {};
263
265
  for (let i = 0; i < rowIds.length; i += 1) {
264
266
  const rowId = rowIds[i];
265
267
  let isRowPassing;
@@ -270,7 +272,7 @@ export const useGridFilter = (apiRef, props) => {
270
272
  passingFilterItems,
271
273
  passingQuickFilterValues
272
274
  } = params.isRowMatchingFilters(rowId);
273
- isRowPassing = passFilterLogic([passingFilterItems], [passingQuickFilterValues], params.filterModel, apiRef);
275
+ isRowPassing = passFilterLogic([passingFilterItems], [passingQuickFilterValues], params.filterModel, apiRef, filterCache);
274
276
  }
275
277
  filteredRowsLookup[rowId] = isRowPassing;
276
278
  }
@@ -336,7 +338,7 @@ export const useGridFilter = (apiRef, props) => {
336
338
  /**
337
339
  * EFFECTS
338
340
  */
339
- React.useEffect(() => {
341
+ useEnhancedEffect(() => {
340
342
  if (props.filterModel !== undefined) {
341
343
  apiRef.current.setFilterModel(props.filterModel);
342
344
  }
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { unstable_ownerDocument as ownerDocument } from '@mui/utils';
4
+ import { gridClasses } from '../../../constants/gridClasses';
4
5
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
5
6
  import { useGridLogger } from '../../utils/useGridLogger';
6
7
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
@@ -236,7 +237,6 @@ export const useGridFocus = (apiRef, props) => {
236
237
  }
237
238
  apiRef.current.setColumnHeaderFocus(field, event);
238
239
  }, [apiRef]);
239
- const focussedColumnGroup = unstable_gridFocusColumnGroupHeaderSelector(apiRef);
240
240
  const handleColumnGroupHeaderFocus = React.useCallback(({
241
241
  fields,
242
242
  depth
@@ -244,13 +244,18 @@ export const useGridFocus = (apiRef, props) => {
244
244
  if (event.target !== event.currentTarget) {
245
245
  return;
246
246
  }
247
- if (focussedColumnGroup !== null && focussedColumnGroup.depth === depth && fields.includes(focussedColumnGroup.field)) {
247
+ const focusedColumnGroup = unstable_gridFocusColumnGroupHeaderSelector(apiRef);
248
+ if (focusedColumnGroup !== null && focusedColumnGroup.depth === depth && fields.includes(focusedColumnGroup.field)) {
248
249
  // This group cell has already been focused
249
250
  return;
250
251
  }
251
252
  apiRef.current.setColumnGroupHeaderFocus(fields[0], depth, event);
252
- }, [apiRef, focussedColumnGroup]);
253
- const handleBlur = React.useCallback(() => {
253
+ }, [apiRef]);
254
+ const handleBlur = React.useCallback((_, event) => {
255
+ var _event$relatedTarget;
256
+ if ((_event$relatedTarget = event.relatedTarget) != null && _event$relatedTarget.className.includes(gridClasses.columnHeader)) {
257
+ return;
258
+ }
254
259
  logger.debug(`Clearing focus`);
255
260
  apiRef.current.setState(state => _extends({}, state, {
256
261
  focus: {
@@ -350,6 +355,7 @@ export const useGridFocus = (apiRef, props) => {
350
355
  };
351
356
  }, [apiRef, handleDocumentClick]);
352
357
  useGridApiEventHandler(apiRef, 'columnHeaderBlur', handleBlur);
358
+ useGridApiEventHandler(apiRef, 'headerFilterBlur', handleBlur);
353
359
  useGridApiEventHandler(apiRef, 'cellDoubleClick', handleCellDoubleClick);
354
360
  useGridApiEventHandler(apiRef, 'cellMouseDown', handleCellMouseDown);
355
361
  useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
@@ -13,7 +13,6 @@ import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPan
13
13
  import { gridPinnedRowsSelector } from '../rows/gridRowsSelector';
14
14
  import { unstable_gridFocusColumnGroupHeaderSelector } from '../focus';
15
15
  import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
16
- import { useGridSelector } from '../../utils/useGridSelector';
17
16
  import { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
18
17
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
19
18
  function enrichPageRowsWithPinnedRows(apiRef, rows) {
@@ -322,12 +321,12 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
322
321
  event.preventDefault();
323
322
  }
324
323
  }, [apiRef, currentPageRows.length, goToHeaderFilter, theme.direction, goToHeader, goToCell, getRowIdFromIndex]);
325
- const focusedColumnGroup = useGridSelector(apiRef, unstable_gridFocusColumnGroupHeaderSelector);
326
324
  const handleColumnGroupHeaderKeyDown = React.useCallback((params, event) => {
327
325
  const dimensions = apiRef.current.getRootDimensions();
328
326
  if (!dimensions) {
329
327
  return;
330
328
  }
329
+ const focusedColumnGroup = unstable_gridFocusColumnGroupHeaderSelector(apiRef);
331
330
  if (focusedColumnGroup === null) {
332
331
  return;
333
332
  }
@@ -411,7 +410,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
411
410
  if (shouldPreventDefault) {
412
411
  event.preventDefault();
413
412
  }
414
- }, [apiRef, focusedColumnGroup, currentPageRows.length, goToHeader, goToGroupHeader, goToCell, getRowIdFromIndex]);
413
+ }, [apiRef, currentPageRows.length, goToHeader, goToGroupHeader, goToCell, getRowIdFromIndex]);
415
414
  const handleCellKeyDown = React.useCallback((params, event) => {
416
415
  // Ignore portal
417
416
  if (!event.currentTarget.contains(event.target)) {
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
+ export declare class MissingRowIdError extends Error {
4
+ }
3
5
  /**
4
6
  * @requires useGridColumns (method)
5
7
  * @requires useGridRows (method)
@@ -2,11 +2,7 @@ import * as React from 'react';
2
2
  import { getGridCellElement, getGridColumnHeaderElement, getGridRowElement } from '../../../utils/domUtils';
3
3
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
4
4
  import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
5
- let warnedOnceMissingColumn = false;
6
- function warnMissingColumn(field) {
7
- console.warn([`MUI: You are calling getValue('${field}') but the column \`${field}\` is not defined.`, `Instead, you can access the data from \`params.row.${field}\`.`].join('\n'));
8
- warnedOnceMissingColumn = true;
9
- }
5
+ export class MissingRowIdError extends Error {}
10
6
 
11
7
  /**
12
8
  * @requires useGridColumns (method)
@@ -24,7 +20,7 @@ export function useGridParamsApi(apiRef) {
24
20
  const getRowParams = React.useCallback(id => {
25
21
  const row = apiRef.current.getRow(id);
26
22
  if (!row) {
27
- throw new Error(`No row with id #${id} found`);
23
+ throw new MissingRowIdError(`No row with id #${id} found`);
28
24
  }
29
25
  const params = {
30
26
  id,
@@ -37,7 +33,7 @@ export function useGridParamsApi(apiRef) {
37
33
  const row = apiRef.current.getRow(id);
38
34
  const rowNode = apiRef.current.getRowNode(id);
39
35
  if (!row || !rowNode) {
40
- throw new Error(`No row with id #${id} found`);
36
+ throw new MissingRowIdError(`No row with id #${id} found`);
41
37
  }
42
38
  const cellFocus = gridFocusCellSelector(apiRef);
43
39
  const cellTabIndex = gridTabIndexCellSelector(apiRef);
@@ -61,7 +57,7 @@ export function useGridParamsApi(apiRef) {
61
57
  const row = apiRef.current.getRow(id);
62
58
  const rowNode = apiRef.current.getRowNode(id);
63
59
  if (!row || !rowNode) {
64
- throw new Error(`No row with id #${id} found`);
60
+ throw new MissingRowIdError(`No row with id #${id} found`);
65
61
  }
66
62
  const cellFocus = gridFocusCellSelector(apiRef);
67
63
  const cellTabIndex = gridTabIndexCellSelector(apiRef);
@@ -75,7 +71,8 @@ export function useGridParamsApi(apiRef) {
75
71
  hasFocus: cellFocus !== null && cellFocus.field === field && cellFocus.id === id,
76
72
  tabIndex: cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === id ? 0 : -1,
77
73
  value,
78
- formattedValue: value
74
+ formattedValue: value,
75
+ isEditable: false
79
76
  };
80
77
  if (colDef && colDef.valueFormatter) {
81
78
  params.formattedValue = colDef.valueFormatter({
@@ -90,15 +87,10 @@ export function useGridParamsApi(apiRef) {
90
87
  }, [apiRef]);
91
88
  const getCellValue = React.useCallback((id, field) => {
92
89
  const colDef = apiRef.current.getColumn(field);
93
- if (process.env.NODE_ENV !== 'production') {
94
- if (!colDef && !warnedOnceMissingColumn) {
95
- warnMissingColumn(field);
96
- }
97
- }
98
90
  if (!colDef || !colDef.valueGetter) {
99
91
  const rowModel = apiRef.current.getRow(id);
100
92
  if (!rowModel) {
101
- throw new Error(`No row with id #${id} found`);
93
+ throw new MissingRowIdError(`No row with id #${id} found`);
102
94
  }
103
95
  return rowModel[field];
104
96
  }
@@ -41,7 +41,7 @@ export const useGridRowsMeta = (apiRef, props) => {
41
41
  getRowSpacing,
42
42
  getEstimatedRowHeight
43
43
  } = props;
44
- const rowsHeightLookup = React.useRef({});
44
+ const rowsHeightLookup = React.useRef(Object.create(null));
45
45
 
46
46
  // Inspired by https://github.com/bvaughn/react-virtualized/blob/master/source/Grid/utils/CellSizeAndPositionManager.js
47
47
  const lastMeasuredRowIndex = React.useRef(-1);
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
3
4
  import { isEnterKey } from '../../../utils/keyboardUtils';
4
5
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
5
6
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
@@ -244,7 +245,7 @@ export const useGridSorting = (apiRef, props) => {
244
245
  /**
245
246
  * EFFECTS
246
247
  */
247
- React.useEffect(() => {
248
+ useEnhancedEffect(() => {
248
249
  if (props.sortModel !== undefined) {
249
250
  apiRef.current.setSortModel(props.sortModel);
250
251
  }