@mui/x-data-grid 9.6.0 → 9.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 (239) hide show
  1. package/CHANGELOG.md +241 -2
  2. package/DataGrid/DataGrid.js +2 -2
  3. package/DataGrid/DataGrid.mjs +2 -2
  4. package/colDef/gridDateOperators.d.mts +1 -1
  5. package/colDef/gridDateOperators.d.ts +1 -1
  6. package/components/GridColumnHeaders.d.mts +1 -1
  7. package/components/GridColumnHeaders.d.ts +1 -1
  8. package/components/GridFooter.d.mts +1 -1
  9. package/components/GridFooter.d.ts +1 -1
  10. package/components/GridLoadingOverlay.d.mts +1 -1
  11. package/components/GridLoadingOverlay.d.ts +1 -1
  12. package/components/GridNoColumnsOverlay.d.mts +1 -1
  13. package/components/GridNoColumnsOverlay.d.ts +1 -1
  14. package/components/GridNoResultsOverlay.d.mts +1 -1
  15. package/components/GridNoResultsOverlay.d.ts +1 -1
  16. package/components/GridNoRowsOverlay.d.mts +1 -1
  17. package/components/GridNoRowsOverlay.d.ts +1 -1
  18. package/components/GridRowCount.d.mts +1 -1
  19. package/components/GridRowCount.d.ts +1 -1
  20. package/components/GridSelectedRowCount.d.mts +1 -1
  21. package/components/GridSelectedRowCount.d.ts +1 -1
  22. package/components/cell/GridActionsCell.d.mts +1 -1
  23. package/components/cell/GridActionsCell.d.ts +1 -1
  24. package/components/cell/GridCell.d.mts +1 -1
  25. package/components/cell/GridCell.d.ts +1 -1
  26. package/components/cell/GridCell.js +2 -10
  27. package/components/cell/GridCell.mjs +2 -10
  28. package/components/cell/GridFooterCell.d.mts +1 -1
  29. package/components/cell/GridFooterCell.d.ts +1 -1
  30. package/components/columnHeaders/GridBaseColumnHeaders.d.mts +1 -1
  31. package/components/columnHeaders/GridBaseColumnHeaders.d.ts +1 -1
  32. package/components/columnHeaders/GridColumnGroupHeader.js +2 -10
  33. package/components/columnHeaders/GridColumnGroupHeader.mjs +2 -10
  34. package/components/columnHeaders/GridColumnHeaderItem.js +2 -10
  35. package/components/columnHeaders/GridColumnHeaderItem.mjs +2 -10
  36. package/components/columnHeaders/GridColumnHeaderSortIcon.d.mts +1 -1
  37. package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -1
  38. package/components/columnHeaders/GridGenericColumnHeaderItem.d.mts +1 -1
  39. package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -1
  40. package/components/columnsPanel/ColumnsPanelTrigger.d.mts +1 -1
  41. package/components/columnsPanel/ColumnsPanelTrigger.d.ts +1 -1
  42. package/components/columnsPanel/ColumnsPanelTrigger.js +2 -2
  43. package/components/columnsPanel/ColumnsPanelTrigger.mjs +2 -2
  44. package/components/containers/GridFooterContainer.d.mts +1 -1
  45. package/components/containers/GridFooterContainer.d.ts +1 -1
  46. package/components/containers/GridOverlay.d.mts +1 -1
  47. package/components/containers/GridOverlay.d.ts +1 -1
  48. package/components/containers/GridToolbarContainer.d.mts +1 -1
  49. package/components/containers/GridToolbarContainer.d.ts +1 -1
  50. package/components/export/ExportCsv.d.mts +1 -1
  51. package/components/export/ExportCsv.d.ts +1 -1
  52. package/components/export/ExportPrint.d.mts +1 -1
  53. package/components/export/ExportPrint.d.ts +1 -1
  54. package/components/filterPanel/FilterPanelTrigger.d.mts +1 -1
  55. package/components/filterPanel/FilterPanelTrigger.d.ts +1 -1
  56. package/components/filterPanel/FilterPanelTrigger.js +2 -2
  57. package/components/filterPanel/FilterPanelTrigger.mjs +2 -2
  58. package/components/menu/columnMenu/GridColumnHeaderMenu.d.mts +1 -1
  59. package/components/menu/columnMenu/GridColumnHeaderMenu.d.ts +1 -1
  60. package/components/panel/GridColumnsPanel.d.mts +1 -1
  61. package/components/panel/GridColumnsPanel.d.ts +1 -1
  62. package/components/panel/GridPanelContent.d.mts +1 -1
  63. package/components/panel/GridPanelContent.d.ts +1 -1
  64. package/components/panel/GridPanelContext.d.mts +9 -3
  65. package/components/panel/GridPanelContext.d.ts +9 -3
  66. package/components/panel/GridPanelContext.js +40 -7
  67. package/components/panel/GridPanelContext.mjs +40 -7
  68. package/components/panel/GridPanelFooter.d.mts +1 -1
  69. package/components/panel/GridPanelFooter.d.ts +1 -1
  70. package/components/panel/GridPanelHeader.d.mts +1 -1
  71. package/components/panel/GridPanelHeader.d.ts +1 -1
  72. package/components/panel/GridPanelWrapper.d.mts +1 -1
  73. package/components/panel/GridPanelWrapper.d.ts +1 -1
  74. package/components/panel/GridPreferencesPanel.js +4 -6
  75. package/components/panel/GridPreferencesPanel.mjs +4 -6
  76. package/components/panel/filterPanel/GridFilterForm.d.mts +2 -1
  77. package/components/panel/filterPanel/GridFilterForm.d.ts +2 -1
  78. package/components/panel/filterPanel/GridFilterPanel.d.mts +2 -2
  79. package/components/panel/filterPanel/GridFilterPanel.d.ts +2 -2
  80. package/components/quickFilter/QuickFilter.d.mts +2 -2
  81. package/components/quickFilter/QuickFilter.d.ts +2 -2
  82. package/components/quickFilter/QuickFilterClear.d.mts +2 -2
  83. package/components/quickFilter/QuickFilterClear.d.ts +2 -2
  84. package/components/quickFilter/QuickFilterControl.d.mts +2 -2
  85. package/components/quickFilter/QuickFilterControl.d.ts +2 -2
  86. package/components/quickFilter/QuickFilterTrigger.d.mts +2 -2
  87. package/components/quickFilter/QuickFilterTrigger.d.ts +2 -2
  88. package/components/toolbar/GridToolbar.d.mts +3 -3
  89. package/components/toolbar/GridToolbar.d.ts +3 -3
  90. package/components/toolbar/GridToolbarColumnsButton.js +2 -2
  91. package/components/toolbar/GridToolbarColumnsButton.mjs +2 -2
  92. package/components/toolbar/GridToolbarFilterButton.js +2 -2
  93. package/components/toolbar/GridToolbarFilterButton.mjs +2 -2
  94. package/components/toolbarV8/Toolbar.d.mts +1 -1
  95. package/components/toolbarV8/Toolbar.d.ts +1 -1
  96. package/components/toolbarV8/ToolbarButton.d.mts +1 -1
  97. package/components/toolbarV8/ToolbarButton.d.ts +1 -1
  98. package/components/virtualization/GridVirtualScrollerContent.d.mts +1 -1
  99. package/components/virtualization/GridVirtualScrollerContent.d.ts +1 -1
  100. package/components/virtualization/GridVirtualScrollerRenderZone.d.mts +1 -1
  101. package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +1 -1
  102. package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.js +7 -1
  103. package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.mjs +7 -1
  104. package/hooks/features/columnGrouping/gridColumnGroupsUtils.d.mts +1 -1
  105. package/hooks/features/columnGrouping/gridColumnGroupsUtils.d.ts +1 -1
  106. package/hooks/features/columnHeaders/useGridColumnHeaders.d.mts +2 -1
  107. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +2 -1
  108. package/hooks/features/columnResize/useGridColumnResize.js +56 -2
  109. package/hooks/features/columnResize/useGridColumnResize.mjs +57 -3
  110. package/hooks/features/columns/gridColumnsSelector.d.mts +1 -1
  111. package/hooks/features/columns/gridColumnsSelector.d.ts +1 -1
  112. package/hooks/features/dimensions/useGridDimensions.js +3 -3
  113. package/hooks/features/dimensions/useGridDimensions.mjs +3 -3
  114. package/hooks/features/editing/gridEditingSelectors.d.mts +1 -1
  115. package/hooks/features/editing/gridEditingSelectors.d.ts +1 -1
  116. package/hooks/features/editing/gridEditingSelectors.mjs +0 -1
  117. package/hooks/features/editing/useGridCellEditing.js +14 -7
  118. package/hooks/features/editing/useGridCellEditing.mjs +14 -7
  119. package/hooks/features/editing/utils.d.mts +1 -1
  120. package/hooks/features/editing/utils.d.ts +1 -1
  121. package/hooks/features/editing/utils.js +1 -1
  122. package/hooks/features/editing/utils.mjs +1 -1
  123. package/hooks/features/filter/gridFilterState.d.mts +1 -1
  124. package/hooks/features/filter/gridFilterState.d.ts +1 -1
  125. package/hooks/features/filter/gridFilterUtils.d.mts +2 -2
  126. package/hooks/features/filter/gridFilterUtils.d.ts +2 -2
  127. package/hooks/features/focus/useGridFocus.js +2 -10
  128. package/hooks/features/focus/useGridFocus.mjs +2 -10
  129. package/hooks/features/rowSelection/useGridRowSelection.js +0 -3
  130. package/hooks/features/rowSelection/useGridRowSelection.mjs +0 -3
  131. package/hooks/features/rows/gridRowSpanningUtils.d.mts +1 -1
  132. package/hooks/features/rows/gridRowSpanningUtils.d.ts +1 -1
  133. package/hooks/features/rows/gridRowSpanningUtils.js +1 -1
  134. package/hooks/features/rows/gridRowSpanningUtils.mjs +1 -1
  135. package/hooks/features/rows/gridRowsUtils.d.mts +1 -1
  136. package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  137. package/hooks/features/rows/gridRowsUtils.js +6 -4
  138. package/hooks/features/rows/gridRowsUtils.mjs +6 -4
  139. package/hooks/features/virtualization/useGridVirtualization.d.mts +1 -1
  140. package/hooks/features/virtualization/useGridVirtualization.d.ts +1 -1
  141. package/hooks/features/virtualization/useGridVirtualization.js +2 -2
  142. package/hooks/features/virtualization/useGridVirtualization.mjs +2 -2
  143. package/hooks/utils/useGridEvent.js +1 -1
  144. package/hooks/utils/useGridEvent.mjs +1 -1
  145. package/index.js +1 -1
  146. package/index.mjs +1 -1
  147. package/locales/arSD.d.mts +1 -1
  148. package/locales/arSD.d.ts +1 -1
  149. package/locales/beBY.d.mts +1 -1
  150. package/locales/beBY.d.ts +1 -1
  151. package/locales/bgBG.d.mts +1 -1
  152. package/locales/bgBG.d.ts +1 -1
  153. package/locales/bnBD.d.mts +1 -1
  154. package/locales/bnBD.d.ts +1 -1
  155. package/locales/caES.d.mts +1 -1
  156. package/locales/caES.d.ts +1 -1
  157. package/locales/csCZ.d.mts +1 -1
  158. package/locales/csCZ.d.ts +1 -1
  159. package/locales/daDK.d.mts +1 -1
  160. package/locales/daDK.d.ts +1 -1
  161. package/locales/deDE.d.mts +1 -1
  162. package/locales/deDE.d.ts +1 -1
  163. package/locales/elGR.d.mts +1 -1
  164. package/locales/elGR.d.ts +1 -1
  165. package/locales/enUS.d.mts +1 -1
  166. package/locales/enUS.d.ts +1 -1
  167. package/locales/esES.d.mts +1 -1
  168. package/locales/esES.d.ts +1 -1
  169. package/locales/faIR.d.mts +1 -1
  170. package/locales/faIR.d.ts +1 -1
  171. package/locales/fiFI.d.mts +1 -1
  172. package/locales/fiFI.d.ts +1 -1
  173. package/locales/frFR.d.mts +1 -1
  174. package/locales/frFR.d.ts +1 -1
  175. package/locales/heIL.d.mts +1 -1
  176. package/locales/heIL.d.ts +1 -1
  177. package/locales/huHU.d.mts +1 -1
  178. package/locales/huHU.d.ts +1 -1
  179. package/locales/hyAM.d.mts +1 -1
  180. package/locales/hyAM.d.ts +1 -1
  181. package/locales/idID.d.mts +1 -1
  182. package/locales/idID.d.ts +1 -1
  183. package/locales/isIS.d.mts +1 -1
  184. package/locales/isIS.d.ts +1 -1
  185. package/locales/itIT.d.mts +1 -1
  186. package/locales/itIT.d.ts +1 -1
  187. package/locales/jaJP.d.mts +1 -1
  188. package/locales/jaJP.d.ts +1 -1
  189. package/locales/jaJP.js +4 -5
  190. package/locales/jaJP.mjs +4 -5
  191. package/locales/koKR.d.mts +1 -1
  192. package/locales/koKR.d.ts +1 -1
  193. package/locales/nbNO.d.mts +1 -1
  194. package/locales/nbNO.d.ts +1 -1
  195. package/locales/nlNL.d.mts +1 -1
  196. package/locales/nlNL.d.ts +1 -1
  197. package/locales/nnNO.d.mts +1 -1
  198. package/locales/nnNO.d.ts +1 -1
  199. package/locales/plPL.d.mts +1 -1
  200. package/locales/plPL.d.ts +1 -1
  201. package/locales/ptBR.d.mts +1 -1
  202. package/locales/ptBR.d.ts +1 -1
  203. package/locales/ptPT.d.mts +1 -1
  204. package/locales/ptPT.d.ts +1 -1
  205. package/locales/roRO.d.mts +1 -1
  206. package/locales/roRO.d.ts +1 -1
  207. package/locales/ruRU.d.mts +1 -1
  208. package/locales/ruRU.d.ts +1 -1
  209. package/locales/skSK.d.mts +1 -1
  210. package/locales/skSK.d.ts +1 -1
  211. package/locales/svSE.d.mts +1 -1
  212. package/locales/svSE.d.ts +1 -1
  213. package/locales/thTH.d.mts +1 -1
  214. package/locales/thTH.d.ts +1 -1
  215. package/locales/trTR.d.mts +1 -1
  216. package/locales/trTR.d.ts +1 -1
  217. package/locales/ukUA.d.mts +1 -1
  218. package/locales/ukUA.d.ts +1 -1
  219. package/locales/urPK.d.mts +1 -1
  220. package/locales/urPK.d.ts +1 -1
  221. package/locales/viVN.d.mts +1 -1
  222. package/locales/viVN.d.ts +1 -1
  223. package/locales/zhCN.d.mts +1 -1
  224. package/locales/zhCN.d.ts +1 -1
  225. package/locales/zhTW.d.mts +1 -1
  226. package/locales/zhTW.d.ts +1 -1
  227. package/material/variables.d.mts +1 -1
  228. package/material/variables.d.ts +1 -1
  229. package/package.json +5 -4
  230. package/utils/createSelector.d.mts +1 -1
  231. package/utils/createSelector.d.ts +1 -1
  232. package/utils/focusElement.d.mts +9 -0
  233. package/utils/focusElement.d.ts +9 -0
  234. package/utils/focusElement.js +24 -0
  235. package/utils/focusElement.mjs +19 -0
  236. package/utils/isJSDOM.d.mts +0 -1
  237. package/utils/isJSDOM.d.ts +0 -1
  238. package/utils/isJSDOM.js +0 -7
  239. package/utils/isJSDOM.mjs +0 -1
@@ -9,7 +9,7 @@ import capitalize from '@mui/utils/capitalize';
9
9
  import useId from '@mui/utils/useId';
10
10
  import { fastMemo } from '@mui/x-internals/fastMemo';
11
11
  import { useRtl } from '@mui/system/RtlProvider';
12
- import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.mjs";
12
+ import { focusElement } from "../../utils/focusElement.mjs";
13
13
  import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.mjs";
14
14
  import { getColumnMenuItemKeys } from "../../hooks/features/columnMenu/getColumnMenuItemKeys.mjs";
15
15
  import { ColumnHeaderMenuIcon } from "./ColumnHeaderMenuIcon.mjs";
@@ -202,15 +202,7 @@ function GridColumnHeaderItem(props) {
202
202
  if (!elementToFocus) {
203
203
  return;
204
204
  }
205
- if (doesSupportPreventScroll()) {
206
- elementToFocus.focus({
207
- preventScroll: true
208
- });
209
- } else {
210
- const scrollPosition = apiRef.current.getScrollPosition();
211
- elementToFocus.focus();
212
- apiRef.current.scroll(scrollPosition);
213
- }
205
+ focusElement(elementToFocus, apiRef);
214
206
  }
215
207
  }, [apiRef, hasFocus]);
216
208
  const headerClassName = typeof colDef.headerClassName === 'function' ? colDef.headerClassName({
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type GridColumnSortButtonProps } from "../GridColumnSortButton.mjs";
2
+ import type { GridColumnSortButtonProps } from "../GridColumnSortButton.mjs";
3
3
  export interface GridColumnHeaderSortIconProps extends GridColumnSortButtonProps {}
4
4
  declare function GridColumnHeaderSortIconRaw(props: GridColumnHeaderSortIconProps): import("react/jsx-runtime").JSX.Element;
5
5
  declare namespace GridColumnHeaderSortIconRaw {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type GridColumnSortButtonProps } from "../GridColumnSortButton.js";
2
+ import type { GridColumnSortButtonProps } from "../GridColumnSortButton.js";
3
3
  export interface GridColumnHeaderSortIconProps extends GridColumnSortButtonProps {}
4
4
  declare function GridColumnHeaderSortIconRaw(props: GridColumnHeaderSortIconProps): import("react/jsx-runtime").JSX.Element;
5
5
  declare namespace GridColumnHeaderSortIconRaw {
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { GridStateColDef } from "../../models/colDef/gridColDef.mjs";
3
3
  import type { GridSortDirection } from "../../models/gridSortModel.mjs";
4
- import { type GridColumnHeaderSeparatorProps } from "./GridColumnHeaderSeparator.mjs";
4
+ import type { GridColumnHeaderSeparatorProps } from "./GridColumnHeaderSeparator.mjs";
5
5
  import type { GridColumnGroup } from "../../models/gridColumnGrouping.mjs";
6
6
  interface GridGenericColumnHeaderItemProps extends Pick<GridStateColDef, 'headerClassName' | 'description' | 'resizable'> {
7
7
  classes: Record<'root' | 'draggableContainer' | 'titleContainer' | 'titleContainerContent', string>;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { GridStateColDef } from "../../models/colDef/gridColDef.js";
3
3
  import type { GridSortDirection } from "../../models/gridSortModel.js";
4
- import { type GridColumnHeaderSeparatorProps } from "./GridColumnHeaderSeparator.js";
4
+ import type { GridColumnHeaderSeparatorProps } from "./GridColumnHeaderSeparator.js";
5
5
  import type { GridColumnGroup } from "../../models/gridColumnGrouping.js";
6
6
  interface GridGenericColumnHeaderItemProps extends Pick<GridStateColDef, 'headerClassName' | 'description' | 'resizable'> {
7
7
  classes: Record<'root' | 'draggableContainer' | 'titleContainer' | 'titleContainerContent', string>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridSlotProps } from "../../models/index.mjs";
4
4
  export interface ColumnsPanelState {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridSlotProps } from "../../models/index.js";
4
4
  export interface ColumnsPanelState {
5
5
  /**
@@ -51,9 +51,9 @@ const ColumnsPanelTrigger = exports.ColumnsPanelTrigger = (0, _forwardRef.forwar
51
51
  };
52
52
  const resolvedClassName = typeof className === 'function' ? className(state) : className;
53
53
  const {
54
- columnsPanelTriggerRef
54
+ triggers
55
55
  } = (0, _GridPanelContext.useGridPanelContext)();
56
- const handleRef = (0, _useForkRef.default)(ref, columnsPanelTriggerRef);
56
+ const handleRef = (0, _useForkRef.default)(ref, triggers.columnsPanel.setRef);
57
57
  const handleClick = event => {
58
58
  if (open) {
59
59
  apiRef.current.hidePreferences();
@@ -43,9 +43,9 @@ const ColumnsPanelTrigger = forwardRef(function ColumnsPanelTrigger(props, ref)
43
43
  };
44
44
  const resolvedClassName = typeof className === 'function' ? className(state) : className;
45
45
  const {
46
- columnsPanelTriggerRef
46
+ triggers
47
47
  } = useGridPanelContext();
48
- const handleRef = useForkRef(ref, columnsPanelTriggerRef);
48
+ const handleRef = useForkRef(ref, triggers.columnsPanel.setRef);
49
49
  const handleClick = event => {
50
50
  if (open) {
51
51
  apiRef.current.hidePreferences();
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/system';
2
+ import type { SxProps, Theme } from '@mui/system';
3
3
  export type GridFooterContainerProps = React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/system';
2
+ import type { SxProps, Theme } from '@mui/system';
3
3
  export type GridFooterContainerProps = React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type Theme, type SxProps } from '@mui/system';
2
+ import type { Theme, SxProps } from '@mui/system';
3
3
  export type GridOverlayProps = React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type Theme, type SxProps } from '@mui/system';
2
+ import type { Theme, SxProps } from '@mui/system';
3
3
  export type GridOverlayProps = React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/system';
2
+ import type { SxProps, Theme } from '@mui/system';
3
3
  export type GridToolbarContainerProps = React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/system';
2
+ import type { SxProps, Theme } from '@mui/system';
3
3
  export type GridToolbarContainerProps = React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridCsvExportOptions } from "../../models/gridExport.mjs";
4
4
  import type { GridSlotProps } from "../../models/index.mjs";
5
5
  export type ExportCsvProps = GridSlotProps['baseButton'] & {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridCsvExportOptions } from "../../models/gridExport.js";
4
4
  import type { GridSlotProps } from "../../models/index.js";
5
5
  export type ExportCsvProps = GridSlotProps['baseButton'] & {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridPrintExportOptions } from "../../models/gridExport.mjs";
4
4
  import type { GridSlotProps } from "../../models/index.mjs";
5
5
  export type ExportPrintProps = GridSlotProps['baseButton'] & {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridPrintExportOptions } from "../../models/gridExport.js";
4
4
  import type { GridSlotProps } from "../../models/index.js";
5
5
  export type ExportPrintProps = GridSlotProps['baseButton'] & {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridSlotProps } from "../../models/index.mjs";
4
4
  export interface FilterPanelState {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridSlotProps } from "../../models/index.js";
4
4
  export interface FilterPanelState {
5
5
  /**
@@ -54,9 +54,9 @@ const FilterPanelTrigger = exports.FilterPanelTrigger = (0, _forwardRef.forwardR
54
54
  };
55
55
  const resolvedClassName = typeof className === 'function' ? className(state) : className;
56
56
  const {
57
- filterPanelTriggerRef
57
+ triggers
58
58
  } = (0, _GridPanelContext.useGridPanelContext)();
59
- const handleRef = (0, _useForkRef.default)(ref, filterPanelTriggerRef);
59
+ const handleRef = (0, _useForkRef.default)(ref, triggers.filterPanel.setRef);
60
60
  const handleClick = event => {
61
61
  if (open) {
62
62
  apiRef.current.hidePreferences();
@@ -46,9 +46,9 @@ const FilterPanelTrigger = forwardRef(function FilterPanelTrigger(props, ref) {
46
46
  };
47
47
  const resolvedClassName = typeof className === 'function' ? className(state) : className;
48
48
  const {
49
- filterPanelTriggerRef
49
+ triggers
50
50
  } = useGridPanelContext();
51
- const handleRef = useForkRef(ref, filterPanelTriggerRef);
51
+ const handleRef = useForkRef(ref, triggers.filterPanel.setRef);
52
52
  const handleClick = event => {
53
53
  if (open) {
54
54
  apiRef.current.hidePreferences();
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type GridMenuProps } from "../GridMenu.mjs";
2
+ import type { GridMenuProps } from "../GridMenu.mjs";
3
3
  export interface GridColumnHeaderMenuProps {
4
4
  columnMenuId?: string;
5
5
  columnMenuButtonId?: string;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type GridMenuProps } from "../GridMenu.js";
2
+ import type { GridMenuProps } from "../GridMenu.js";
3
3
  export interface GridColumnHeaderMenuProps {
4
4
  columnMenuId?: string;
5
5
  columnMenuButtonId?: string;
@@ -1,4 +1,4 @@
1
- import { type GridPanelWrapperProps } from "./GridPanelWrapper.mjs";
1
+ import type { GridPanelWrapperProps } from "./GridPanelWrapper.mjs";
2
2
  export interface GridColumnsPanelProps extends GridPanelWrapperProps {}
3
3
  declare function GridColumnsPanel(props: GridColumnsPanelProps): import("react/jsx-runtime").JSX.Element;
4
4
  export { GridColumnsPanel };
@@ -1,4 +1,4 @@
1
- import { type GridPanelWrapperProps } from "./GridPanelWrapper.js";
1
+ import type { GridPanelWrapperProps } from "./GridPanelWrapper.js";
2
2
  export interface GridColumnsPanelProps extends GridPanelWrapperProps {}
3
3
  declare function GridColumnsPanel(props: GridColumnsPanelProps): import("react/jsx-runtime").JSX.Element;
4
4
  export { GridColumnsPanel };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/system';
2
+ import type { SxProps, Theme } from '@mui/system';
3
3
  declare function GridPanelContent(props: React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/system';
2
+ import type { SxProps, Theme } from '@mui/system';
3
3
  declare function GridPanelContent(props: React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,14 @@
1
1
  import * as React from 'react';
2
+ export interface GridPanelTrigger {
3
+ setRef: (instance: HTMLElement | null) => void;
4
+ element: HTMLElement | null;
5
+ }
2
6
  export interface GridPanelContextValue {
3
- columnsPanelTriggerRef: React.RefObject<HTMLButtonElement | null>;
4
- filterPanelTriggerRef: React.RefObject<HTMLButtonElement | null>;
5
- aiAssistantPanelTriggerRef: React.RefObject<HTMLButtonElement | null>;
7
+ triggers: {
8
+ filterPanel: GridPanelTrigger;
9
+ aiAssistantPanel: GridPanelTrigger;
10
+ columnsPanel: GridPanelTrigger;
11
+ };
6
12
  }
7
13
  export declare const GridPanelContext: React.Context<GridPanelContextValue | undefined>;
8
14
  export declare function useGridPanelContext(): GridPanelContextValue;
@@ -1,8 +1,14 @@
1
1
  import * as React from 'react';
2
+ export interface GridPanelTrigger {
3
+ setRef: (instance: HTMLElement | null) => void;
4
+ element: HTMLElement | null;
5
+ }
2
6
  export interface GridPanelContextValue {
3
- columnsPanelTriggerRef: React.RefObject<HTMLButtonElement | null>;
4
- filterPanelTriggerRef: React.RefObject<HTMLButtonElement | null>;
5
- aiAssistantPanelTriggerRef: React.RefObject<HTMLButtonElement | null>;
7
+ triggers: {
8
+ filterPanel: GridPanelTrigger;
9
+ aiAssistantPanel: GridPanelTrigger;
10
+ columnsPanel: GridPanelTrigger;
11
+ };
6
12
  }
7
13
  export declare const GridPanelContext: React.Context<GridPanelContextValue | undefined>;
8
14
  export declare function useGridPanelContext(): GridPanelContextValue;
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.GridPanelContext = void 0;
10
10
  exports.GridPanelContextProvider = GridPanelContextProvider;
11
11
  exports.useGridPanelContext = useGridPanelContext;
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
13
  var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
13
14
  var React = _interopRequireWildcard(require("react"));
14
15
  var _jsxRuntime = require("react/jsx-runtime");
@@ -24,14 +25,46 @@ function useGridPanelContext() {
24
25
  function GridPanelContextProvider({
25
26
  children
26
27
  }) {
27
- const columnsPanelTriggerRef = React.useRef(null);
28
- const filterPanelTriggerRef = React.useRef(null);
29
- const aiAssistantPanelTriggerRef = React.useRef(null);
28
+ const [triggerElements, setTriggerElements] = React.useState({
29
+ columnsPanel: null,
30
+ filterPanel: null,
31
+ aiAssistantPanel: null
32
+ });
33
+ const updateTriggerElement = React.useCallback((key, instance) => {
34
+ setTriggerElements(prev => {
35
+ if (prev[key] === instance) {
36
+ return prev;
37
+ }
38
+ return (0, _extends2.default)({}, prev, {
39
+ [key]: instance
40
+ });
41
+ });
42
+ }, []);
43
+ const setColumnsPanelTrigger = React.useCallback(instance => {
44
+ updateTriggerElement('columnsPanel', instance);
45
+ }, [updateTriggerElement]);
46
+ const setFilterPanelTrigger = React.useCallback(instance => {
47
+ updateTriggerElement('filterPanel', instance);
48
+ }, [updateTriggerElement]);
49
+ const setAiAssistantPanelTrigger = React.useCallback(instance => {
50
+ updateTriggerElement('aiAssistantPanel', instance);
51
+ }, [updateTriggerElement]);
30
52
  const value = React.useMemo(() => ({
31
- columnsPanelTriggerRef,
32
- filterPanelTriggerRef,
33
- aiAssistantPanelTriggerRef
34
- }), []);
53
+ triggers: {
54
+ columnsPanel: {
55
+ element: triggerElements.columnsPanel,
56
+ setRef: setColumnsPanelTrigger
57
+ },
58
+ filterPanel: {
59
+ element: triggerElements.filterPanel,
60
+ setRef: setFilterPanelTrigger
61
+ },
62
+ aiAssistantPanel: {
63
+ element: triggerElements.aiAssistantPanel,
64
+ setRef: setAiAssistantPanelTrigger
65
+ }
66
+ }
67
+ }), [triggerElements, setColumnsPanelTrigger, setFilterPanelTrigger, setAiAssistantPanelTrigger]);
35
68
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelContext.Provider, {
36
69
  value: value,
37
70
  children: children
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
4
  import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
4
5
  import * as React from 'react';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -15,14 +16,46 @@ export function useGridPanelContext() {
15
16
  export function GridPanelContextProvider({
16
17
  children
17
18
  }) {
18
- const columnsPanelTriggerRef = React.useRef(null);
19
- const filterPanelTriggerRef = React.useRef(null);
20
- const aiAssistantPanelTriggerRef = React.useRef(null);
19
+ const [triggerElements, setTriggerElements] = React.useState({
20
+ columnsPanel: null,
21
+ filterPanel: null,
22
+ aiAssistantPanel: null
23
+ });
24
+ const updateTriggerElement = React.useCallback((key, instance) => {
25
+ setTriggerElements(prev => {
26
+ if (prev[key] === instance) {
27
+ return prev;
28
+ }
29
+ return _extends({}, prev, {
30
+ [key]: instance
31
+ });
32
+ });
33
+ }, []);
34
+ const setColumnsPanelTrigger = React.useCallback(instance => {
35
+ updateTriggerElement('columnsPanel', instance);
36
+ }, [updateTriggerElement]);
37
+ const setFilterPanelTrigger = React.useCallback(instance => {
38
+ updateTriggerElement('filterPanel', instance);
39
+ }, [updateTriggerElement]);
40
+ const setAiAssistantPanelTrigger = React.useCallback(instance => {
41
+ updateTriggerElement('aiAssistantPanel', instance);
42
+ }, [updateTriggerElement]);
21
43
  const value = React.useMemo(() => ({
22
- columnsPanelTriggerRef,
23
- filterPanelTriggerRef,
24
- aiAssistantPanelTriggerRef
25
- }), []);
44
+ triggers: {
45
+ columnsPanel: {
46
+ element: triggerElements.columnsPanel,
47
+ setRef: setColumnsPanelTrigger
48
+ },
49
+ filterPanel: {
50
+ element: triggerElements.filterPanel,
51
+ setRef: setFilterPanelTrigger
52
+ },
53
+ aiAssistantPanel: {
54
+ element: triggerElements.aiAssistantPanel,
55
+ setRef: setAiAssistantPanelTrigger
56
+ }
57
+ }
58
+ }), [triggerElements, setColumnsPanelTrigger, setFilterPanelTrigger, setAiAssistantPanelTrigger]);
26
59
  return /*#__PURE__*/_jsx(GridPanelContext.Provider, {
27
60
  value: value,
28
61
  children: children
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/material/styles';
2
+ import type { SxProps, Theme } from '@mui/material/styles';
3
3
  declare function GridPanelFooter(props: React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/material/styles';
2
+ import type { SxProps, Theme } from '@mui/material/styles';
3
3
  declare function GridPanelFooter(props: React.HTMLAttributes<HTMLDivElement> & {
4
4
  sx?: SxProps<Theme>;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/system';
2
+ import type { SxProps, Theme } from '@mui/system';
3
3
  /**
4
4
  * @deprecated This component is not used internally and will be removed in a future major release.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type SxProps, type Theme } from '@mui/system';
2
+ import type { SxProps, Theme } from '@mui/system';
3
3
  /**
4
4
  * @deprecated This component is not used internally and will be removed in a future major release.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type Theme } from '@mui/material/styles';
2
+ import type { Theme } from '@mui/material/styles';
3
3
  import type { MUIStyledCommonProps } from '@mui/system';
4
4
  export interface GridPanelWrapperProps extends React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>, MUIStyledCommonProps<Theme> {}
5
5
  declare const GridPanelWrapper: React.ForwardRefExoticComponent<GridPanelWrapperProps> | React.ForwardRefExoticComponent<GridPanelWrapperProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type Theme } from '@mui/material/styles';
2
+ import type { Theme } from '@mui/material/styles';
3
3
  import type { MUIStyledCommonProps } from '@mui/system';
4
4
  export interface GridPanelWrapperProps extends React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>, MUIStyledCommonProps<Theme> {}
5
5
  declare const GridPanelWrapper: React.ForwardRefExoticComponent<GridPanelWrapperProps> | React.ForwardRefExoticComponent<GridPanelWrapperProps & React.RefAttributes<HTMLDivElement>>;
@@ -20,21 +20,19 @@ function GridPreferencesPanel() {
20
20
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
21
21
  const preferencePanelState = (0, _useGridSelector.useGridSelector)(apiRef, _gridPreferencePanelSelector.gridPreferencePanelStateSelector);
22
22
  const {
23
- columnsPanelTriggerRef,
24
- filterPanelTriggerRef,
25
- aiAssistantPanelTriggerRef
23
+ triggers
26
24
  } = (0, _GridPanelContext.useGridPanelContext)();
27
25
  const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, preferencePanelState.openedPanelValue ?? _gridPreferencePanelsValue.GridPreferencePanelsValue.filters);
28
26
  let target = null;
29
27
  switch (preferencePanelState.openedPanelValue) {
30
28
  case _gridPreferencePanelsValue.GridPreferencePanelsValue.filters:
31
- target = filterPanelTriggerRef.current;
29
+ target = triggers.filterPanel.element;
32
30
  break;
33
31
  case _gridPreferencePanelsValue.GridPreferencePanelsValue.columns:
34
- target = columnsPanelTriggerRef.current;
32
+ target = triggers.columnsPanel.element;
35
33
  break;
36
34
  case _gridPreferencePanelsValue.GridPreferencePanelsValue.aiAssistant:
37
- target = aiAssistantPanelTriggerRef.current;
35
+ target = triggers.aiAssistantPanel.element;
38
36
  break;
39
37
  default:
40
38
  }
@@ -13,21 +13,19 @@ export function GridPreferencesPanel() {
13
13
  const rootProps = useGridRootProps();
14
14
  const preferencePanelState = useGridSelector(apiRef, gridPreferencePanelStateSelector);
15
15
  const {
16
- columnsPanelTriggerRef,
17
- filterPanelTriggerRef,
18
- aiAssistantPanelTriggerRef
16
+ triggers
19
17
  } = useGridPanelContext();
20
18
  const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, preferencePanelState.openedPanelValue ?? GridPreferencePanelsValue.filters);
21
19
  let target = null;
22
20
  switch (preferencePanelState.openedPanelValue) {
23
21
  case GridPreferencePanelsValue.filters:
24
- target = filterPanelTriggerRef.current;
22
+ target = triggers.filterPanel.element;
25
23
  break;
26
24
  case GridPreferencePanelsValue.columns:
27
- target = columnsPanelTriggerRef.current;
25
+ target = triggers.columnsPanel.element;
28
26
  break;
29
27
  case GridPreferencePanelsValue.aiAssistant:
30
- target = aiAssistantPanelTriggerRef.current;
28
+ target = triggers.aiAssistantPanel.element;
31
29
  break;
32
30
  default:
33
31
  }
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { type GridFilterItem, GridLogicOperator } from "../../../models/gridFilterItem.mjs";
2
+ import { GridLogicOperator } from "../../../models/gridFilterItem.mjs";
3
+ import type { GridFilterItem } from "../../../models/gridFilterItem.mjs";
3
4
  import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.mjs";
4
5
  export interface FilterColumnsArgs {
5
6
  field: GridColDef['field'];
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { type GridFilterItem, GridLogicOperator } from "../../../models/gridFilterItem.js";
2
+ import { GridLogicOperator } from "../../../models/gridFilterItem.js";
3
+ import type { GridFilterItem } from "../../../models/gridFilterItem.js";
3
4
  import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.js";
4
5
  export interface FilterColumnsArgs {
5
6
  field: GridColDef['field'];
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { SxProps, Theme } from '@mui/material/styles';
3
- import { type GridFilterItem } from "../../../models/gridFilterItem.mjs";
4
- import { type GridFilterFormProps } from "./GridFilterForm.mjs";
3
+ import type { GridFilterItem } from "../../../models/gridFilterItem.mjs";
4
+ import type { GridFilterFormProps } from "./GridFilterForm.mjs";
5
5
  import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.mjs";
6
6
  export interface GetColumnForNewFilterArgs {
7
7
  currentFilters: GridFilterItem[];
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { SxProps, Theme } from '@mui/material/styles';
3
- import { type GridFilterItem } from "../../../models/gridFilterItem.js";
4
- import { type GridFilterFormProps } from "./GridFilterForm.js";
3
+ import type { GridFilterItem } from "../../../models/gridFilterItem.js";
4
+ import type { GridFilterFormProps } from "./GridFilterForm.js";
5
5
  import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.js";
6
6
  export interface GetColumnForNewFilterArgs {
7
7
  currentFilters: GridFilterItem[];
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
3
- import { type QuickFilterState } from "./QuickFilterContext.mjs";
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
+ import type { QuickFilterState } from "./QuickFilterContext.mjs";
4
4
  import type { GridFilterModel } from "../../models/index.mjs";
5
5
  export type QuickFilterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> & {
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
3
- import { type QuickFilterState } from "./QuickFilterContext.js";
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
+ import type { QuickFilterState } from "./QuickFilterContext.js";
4
4
  import type { GridFilterModel } from "../../models/index.js";
5
5
  export type QuickFilterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> & {
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridSlotProps } from "../../models/index.mjs";
4
- import { type QuickFilterState } from "./QuickFilterContext.mjs";
4
+ import type { QuickFilterState } from "./QuickFilterContext.mjs";
5
5
  export type QuickFilterClearProps = Omit<GridSlotProps['baseIconButton'], 'className'> & {
6
6
  /**
7
7
  * A function to customize rendering of the component.