@mui/x-data-grid-pro 8.5.0 → 8.5.1

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,118 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.5.1
9
+
10
+ <!-- generated comparing v8.5.0..master -->
11
+
12
+ _Jun 5, 2025_
13
+
14
+ We'd like to extend a big thank you to the 9 contributors who made this release possible. Here are some highlights ✨:
15
+
16
+ - 📊 Allow exporting pie charts
17
+ - 📚 Documentation improvements
18
+ - 🌎 Improve Portuguese (ptPT) translations on the Data Grid
19
+ - 🌎 Improve Portuguese (ptPT, ptBR) translations on Charts
20
+ - 🌎 Improve Arabic (ar-SD) locale
21
+ - 🐞 Bugfixes
22
+
23
+ Special thanks go out to the community members for their valuable contributions: @moosekebab, @TiagoPortfolio.
24
+ The following are all team members who have contributed to this release:
25
+ @alexfauquette, @bernardobelchior, @JCQuintas, @KenanYusuf, @LukasTy, @michelengelen, @arminmeh.
26
+
27
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
28
+
29
+ ### Data Grid
30
+
31
+ #### `@mui/x-data-grid@8.5.1`
32
+
33
+ - [DataGrid] Fix `registerPipeProcessor()` for Node v20 (#18241) @arminmeh
34
+ - [DataGrid] Fix background color in column header filler cells (#18188) @KenanYusuf
35
+ - [DataGrid] Keep pipe pre-processors execution order when callback reference changes (#17558) @arminmeh
36
+ - [DataGrid] Use `useComponentRenderer` from x-internals (#18203) @bernardobelchior
37
+ - [l10n] Improve Arabic (ar-SD) locale (#17959) @moosekebab
38
+ - [l10n] Improve Portuguese from Portugal (pt-PT) locale (#18064) @TiagoPortfolio
39
+
40
+ #### `@mui/x-data-grid-pro@8.5.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
41
+
42
+ Same changes as in `@mui/x-data-grid@8.5.1`, plus:
43
+
44
+ - [DataGridPro] Skip rendering detail panels of the rows turned into skeleton rows with lazy loading (#17958) @arminmeh
45
+
46
+ #### `@mui/x-data-grid-premium@8.5.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
47
+
48
+ Same changes as in `@mui/x-data-grid-pro@8.5.1`.
49
+
50
+ ### Date and Time Pickers
51
+
52
+ #### `@mui/x-date-pickers@8.5.1`
53
+
54
+ - [pickers] Fix `transformOrigin` resolving based on popper `placement` (#18206) @LukasTy
55
+
56
+ #### `@mui/x-date-pickers-pro@8.5.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
57
+
58
+ Same changes as in `@mui/x-date-pickers@8.5.1`.
59
+
60
+ ### Charts
61
+
62
+ #### `@mui/x-charts@8.5.1`
63
+
64
+ - [charts] Allow skipping tooltip render (#18050) @alexfauquette
65
+ - [charts] Fix act warnings in toolbar tests (#18212) @JCQuintas
66
+ - [charts] Fix prop typo in `extendVertically` (#18211) @JCQuintas
67
+ - [charts] Fix responsive height for ChartsWrapper (#18183) @alexfauquette
68
+ - [charts] Improve charts toolbar accessibility (#18056) @bernardobelchior
69
+ - [charts] Let line series propagate null from the dataset (#18223) @alexfauquette
70
+ - [l10n] Add Portuguese locales for charts (pt-PT, pt-BR) (#18069) @bernardobelchior
71
+
72
+ #### `@mui/x-charts-pro@8.5.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
73
+
74
+ Same changes as in `@mui/x-charts@8.5.1`, plus:
75
+
76
+ - [charts-pro] Add `linear-sharp` curve as alternative to square edge (#17966) @JCQuintas
77
+ - [charts-pro] Add correct classes to `FunnelSectionLabel` (#18061) @JCQuintas
78
+ - [charts-pro] Allow exporting a pie chart (#18063) @bernardobelchior
79
+ - [charts-pro] Fix initial render for zoom slider selection (#18208) @bernardobelchior
80
+ - [charts-pro] Fix props being passed to DOM in FunnelChart (#18192) @JCQuintas
81
+ - [charts-pro] Show axis value in zoom slider tooltip (#18054) @bernardobelchior
82
+ - [charts-pro] Render the toolbar in the heatmap chart (#18247) @bernardobelchior
83
+
84
+ ### Tree View
85
+
86
+ #### `@mui/x-tree-view@8.5.1`
87
+
88
+ Internal changes.
89
+
90
+ #### `@mui/x-tree-view-pro@8.5.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
91
+
92
+ Same changes as in `@mui/x-tree-view@8.5.1`.
93
+
94
+ ### Docs
95
+
96
+ - [docs] Update `valueFormatter` signature in migration guide (#18226) @michelengelen
97
+
98
+ ### Core
99
+
100
+ - chore(deps): bump @next/eslint-plugin-next to 15.3.3 (#18155) @renovate[bot]
101
+ - chore(deps): bump @types/lodash to ^4.17.17 (#17990) @renovate[bot]
102
+ - chore(deps): bump babel (#18157) @renovate[bot]
103
+ - chore(deps): bump eslint to ^9.28.0 (#17352) @renovate[bot]
104
+ - chore(deps): bump material ui (#17802) @renovate[bot]
105
+ - chore(deps): bump next to ^15.3.3 (#18159) @renovate[bot]
106
+ - chore(deps): bump ossf/scorecard-action action to v2.4.2 (#18160) @renovate[bot]
107
+ - chore(deps): bump react-router to ^7.6.1 (#18162) @renovate[bot]
108
+ - chore(deps): bump yargs to ^18.0.0 (#18169) @renovate[bot]
109
+ - [code-infra] Different approach to console testing for `processRowUpdate` (#18213) @JCQuintas
110
+ - [code-infra] Fix act warnings in DataGrid/toolbar (#18207) @JCQuintas
111
+ - [code-infra] Remove `istanbul` references (#18194) @JCQuintas
112
+ - [code-infra] Remove codesandbox:ci (#18179) @JCQuintas
113
+ - [code-infra] Replace `mocha` with `vitest` on e2e and regression tests (#18071) @JCQuintas
114
+ - [code-infra] Upgrade @mui/internal-test-utils (#18191) @JCQuintas
115
+ - [code-infra] Use vitest for `no-direct-state-access` tests (#18209) @JCQuintas
116
+ - [infra] Improve test setup (#18228) @LukasTy
117
+ - [infra] Update bug and feature request templates to standardize label types (#18198) @michelengelen
118
+ - [infra] Use `playwright` docker image (#18186) @LukasTy
119
+
8
120
  ## 8.5.0
9
121
 
10
122
  _May 29, 2025_
@@ -29,7 +29,7 @@ const configuration = {
29
29
  useCellAggregationResult: () => null
30
30
  }
31
31
  };
32
- const releaseInfo = "MTc0ODQ2OTYwMDAwMA==";
32
+ const releaseInfo = "MTc0OTA3MDgwMDAwMA==";
33
33
  const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
34
34
  packageName: "x-data-grid-pro",
35
35
  releaseInfo: releaseInfo
@@ -30,16 +30,20 @@ const useDataGridProComponent = (apiRef, props) => {
30
30
 
31
31
  /**
32
32
  * Register all pre-processors called during state initialization here.
33
+ * Some pre-processors are changing the same part of the state (like the order of the columns).
34
+ * Order them in descending order of priority.
35
+ * For example, left pinned columns should always render first from the left, so the `hydrateColumns` pre-processor from `useGridColumnPinningPreProcessors` should be called last (after all other `hydrateColumns` pre-processors).
36
+ * Similarly, the `hydrateColumns` pre-processor from `useGridRowSelectionPreProcessors` should be called after `useGridTreeDataPreProcessors` because the selection checkboxes should appear before the tree data.
37
+ * Desired autogenerated columns order is:
38
+ * left pinned columns -> row reordering column -> checkbox column -> tree data column -> master detail column -> rest of the columns
33
39
  */
34
- (0, _internals.useGridRowSelectionPreProcessors)(apiRef, props);
35
- (0, _useGridRowReorderPreProcessors.useGridRowReorderPreProcessors)(apiRef, props);
40
+ (0, _useGridDetailPanelPreProcessors.useGridDetailPanelPreProcessors)(apiRef, props);
36
41
  (0, _useGridTreeDataPreProcessors.useGridTreeDataPreProcessors)(apiRef, props);
37
42
  (0, _useGridDataSourceTreeDataPreProcessors.useGridDataSourceTreeDataPreProcessors)(apiRef, props);
43
+ (0, _internals.useGridRowSelectionPreProcessors)(apiRef, props);
38
44
  (0, _useGridLazyLoaderPreProcessors.useGridLazyLoaderPreProcessors)(apiRef, props);
39
45
  (0, _useGridRowPinningPreProcessors.useGridRowPinningPreProcessors)(apiRef);
40
- (0, _useGridDetailPanelPreProcessors.useGridDetailPanelPreProcessors)(apiRef, props);
41
- // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
42
- // Because it changes the order of the columns.
46
+ (0, _useGridRowReorderPreProcessors.useGridRowReorderPreProcessors)(apiRef, props);
43
47
  (0, _useGridColumnPinningPreProcessors.useGridColumnPinningPreProcessors)(apiRef, props);
44
48
  (0, _internals.useGridRowsPreProcessors)(apiRef);
45
49
 
@@ -10,5 +10,5 @@ interface GridDetailPanelProps extends Pick<React.HTMLAttributes<HTMLDivElement>
10
10
  */
11
11
  height: number | 'auto';
12
12
  }
13
- declare function GridDetailPanel(props: GridDetailPanelProps): React.JSX.Element;
13
+ declare function GridDetailPanel(props: GridDetailPanelProps): React.JSX.Element | null;
14
14
  export { GridDetailPanel };
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.GridDetailPanel = GridDetailPanel;
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
  var _styles = require("@mui/material/styles");
11
+ var _xDataGrid = require("@mui/x-data-grid");
11
12
  var _internals = require("@mui/x-data-grid/internals");
12
13
  var _useResizeObserver = require("@mui/x-internals/useResizeObserver");
13
14
  var _useGridRootProps = require("../hooks/utils/useGridRootProps");
@@ -33,6 +34,7 @@ function GridDetailPanel(props) {
33
34
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
34
35
  const ownerState = rootProps;
35
36
  const hasAutoHeight = height === 'auto';
37
+ const rowNode = (0, _xDataGrid.gridRowNodeSelector)(apiRef, rowId);
36
38
  React.useLayoutEffect(() => {
37
39
  if (hasAutoHeight && typeof ResizeObserver === 'undefined') {
38
40
  // Fallback for IE
@@ -44,6 +46,9 @@ function GridDetailPanel(props) {
44
46
  const observedHeight = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
45
47
  apiRef.current.storeDetailPanelHeight(rowId, observedHeight);
46
48
  }, hasAutoHeight);
49
+ if (rowNode?.type === 'skeletonRow') {
50
+ return null;
51
+ }
47
52
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(DetailPanel, {
48
53
  ref: ref,
49
54
  ownerState: ownerState,
@@ -22,7 +22,7 @@ const configuration = {
22
22
  useCellAggregationResult: () => null
23
23
  }
24
24
  };
25
- const releaseInfo = "MTc0ODQ2OTYwMDAwMA==";
25
+ const releaseInfo = "MTc0OTA3MDgwMDAwMA==";
26
26
  const watermark = /*#__PURE__*/_jsx(Watermark, {
27
27
  packageName: "x-data-grid-pro",
28
28
  releaseInfo: releaseInfo
@@ -23,16 +23,20 @@ export const useDataGridProComponent = (apiRef, props) => {
23
23
 
24
24
  /**
25
25
  * Register all pre-processors called during state initialization here.
26
+ * Some pre-processors are changing the same part of the state (like the order of the columns).
27
+ * Order them in descending order of priority.
28
+ * For example, left pinned columns should always render first from the left, so the `hydrateColumns` pre-processor from `useGridColumnPinningPreProcessors` should be called last (after all other `hydrateColumns` pre-processors).
29
+ * Similarly, the `hydrateColumns` pre-processor from `useGridRowSelectionPreProcessors` should be called after `useGridTreeDataPreProcessors` because the selection checkboxes should appear before the tree data.
30
+ * Desired autogenerated columns order is:
31
+ * left pinned columns -> row reordering column -> checkbox column -> tree data column -> master detail column -> rest of the columns
26
32
  */
27
- useGridRowSelectionPreProcessors(apiRef, props);
28
- useGridRowReorderPreProcessors(apiRef, props);
33
+ useGridDetailPanelPreProcessors(apiRef, props);
29
34
  useGridTreeDataPreProcessors(apiRef, props);
30
35
  useGridDataSourceTreeDataPreProcessors(apiRef, props);
36
+ useGridRowSelectionPreProcessors(apiRef, props);
31
37
  useGridLazyLoaderPreProcessors(apiRef, props);
32
38
  useGridRowPinningPreProcessors(apiRef);
33
- useGridDetailPanelPreProcessors(apiRef, props);
34
- // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
35
- // Because it changes the order of the columns.
39
+ useGridRowReorderPreProcessors(apiRef, props);
36
40
  useGridColumnPinningPreProcessors(apiRef, props);
37
41
  useGridRowsPreProcessors(apiRef);
38
42
 
@@ -10,5 +10,5 @@ interface GridDetailPanelProps extends Pick<React.HTMLAttributes<HTMLDivElement>
10
10
  */
11
11
  height: number | 'auto';
12
12
  }
13
- declare function GridDetailPanel(props: GridDetailPanelProps): React.JSX.Element;
13
+ declare function GridDetailPanel(props: GridDetailPanelProps): React.JSX.Element | null;
14
14
  export { GridDetailPanel };
@@ -2,6 +2,7 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
+ import { gridRowNodeSelector } from '@mui/x-data-grid';
5
6
  import { vars } from '@mui/x-data-grid/internals';
6
7
  import { useResizeObserver } from '@mui/x-internals/useResizeObserver';
7
8
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
@@ -27,6 +28,7 @@ function GridDetailPanel(props) {
27
28
  const rootProps = useGridRootProps();
28
29
  const ownerState = rootProps;
29
30
  const hasAutoHeight = height === 'auto';
31
+ const rowNode = gridRowNodeSelector(apiRef, rowId);
30
32
  React.useLayoutEffect(() => {
31
33
  if (hasAutoHeight && typeof ResizeObserver === 'undefined') {
32
34
  // Fallback for IE
@@ -38,6 +40,9 @@ function GridDetailPanel(props) {
38
40
  const observedHeight = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
39
41
  apiRef.current.storeDetailPanelHeight(rowId, observedHeight);
40
42
  }, hasAutoHeight);
43
+ if (rowNode?.type === 'skeletonRow') {
44
+ return null;
45
+ }
41
46
  return /*#__PURE__*/_jsx(DetailPanel, {
42
47
  ref: ref,
43
48
  ownerState: ownerState,
@@ -174,7 +174,7 @@ export const useGridDetailPanel = (apiRef, props) => {
174
174
  }
175
175
  updateCachesIfNeeded();
176
176
  const heightCache = gridDetailPanelRawHeightCacheSelector(apiRef);
177
- initialValue.detail = heightCache[row.id].height ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
177
+ initialValue.detail = heightCache[row.id]?.height ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
178
178
  return initialValue;
179
179
  }, [apiRef, updateCachesIfNeeded]);
180
180
  const enabled = props.getDetailPanelContent !== undefined;
@@ -6,28 +6,26 @@ import { GRID_DETAIL_PANEL_TOGGLE_FIELD, GRID_DETAIL_PANEL_TOGGLE_COL_DEF } from
6
6
  import { gridDetailPanelExpandedRowIdsSelector } from "./gridDetailPanelSelector.js";
7
7
  export const useGridDetailPanelPreProcessors = (privateApiRef, props) => {
8
8
  const addToggleColumn = React.useCallback(columnsState => {
9
- if (props.getDetailPanelContent == null) {
10
- // Remove the toggle column, when it exists
11
- if (columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD]) {
12
- delete columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD];
13
- columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== GRID_DETAIL_PANEL_TOGGLE_FIELD);
14
- }
15
- return columnsState;
16
- }
17
-
18
- // Don't add the toggle column if there's already one
19
- // The user might have manually added it to have it in a custom position
20
- if (columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD]) {
21
- return columnsState;
22
- }
23
-
24
- // Otherwise, add the toggle column at the beginning
25
- columnsState.orderedFields = [GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.orderedFields];
26
- columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] = _extends({}, GRID_DETAIL_PANEL_TOGGLE_COL_DEF, {
9
+ const detailPanelToggleColumn = _extends({}, GRID_DETAIL_PANEL_TOGGLE_COL_DEF, {
27
10
  headerName: privateApiRef.current.getLocaleText('detailPanelToggle')
28
11
  });
12
+ const shouldHaveToggleColumn = !!props.getDetailPanelContent;
13
+ const hasToggleColumn = columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] != null;
14
+ if (shouldHaveToggleColumn && !hasToggleColumn) {
15
+ columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] = detailPanelToggleColumn;
16
+ columnsState.orderedFields = [GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.orderedFields];
17
+ } else if (!shouldHaveToggleColumn && hasToggleColumn) {
18
+ delete columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD];
19
+ columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== GRID_DETAIL_PANEL_TOGGLE_FIELD);
20
+ } else if (shouldHaveToggleColumn && hasToggleColumn) {
21
+ columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] = _extends({}, detailPanelToggleColumn, columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD]);
22
+ // If the column is not in the columns array (not a custom detail panel toggle column), move it to the beginning of the column order
23
+ if (!props.columns.some(col => col.field === GRID_DETAIL_PANEL_TOGGLE_FIELD)) {
24
+ columnsState.orderedFields = [GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.orderedFields.filter(field => field !== GRID_DETAIL_PANEL_TOGGLE_FIELD)];
25
+ }
26
+ }
29
27
  return columnsState;
30
- }, [privateApiRef, props.getDetailPanelContent]);
28
+ }, [privateApiRef, props.columns, props.getDetailPanelContent]);
31
29
  const addExpandedClassToRow = React.useCallback((classes, id) => {
32
30
  if (props.getDetailPanelContent == null) {
33
31
  return classes;
@@ -28,19 +28,21 @@ export const useGridRowReorderPreProcessors = (privateApiRef, props) => {
28
28
  headerName: privateApiRef.current.getLocaleText('rowReorderingHeaderName')
29
29
  });
30
30
  const shouldHaveReorderColumn = props.rowReordering;
31
- const haveReorderColumn = columnsState.lookup[reorderColumn.field] != null;
32
- if (shouldHaveReorderColumn && haveReorderColumn) {
33
- columnsState.lookup[reorderColumn.field] = _extends({}, reorderColumn, columnsState.lookup[reorderColumn.field]);
34
- return columnsState;
35
- }
36
- if (shouldHaveReorderColumn && !haveReorderColumn) {
31
+ const hasReorderColumn = columnsState.lookup[reorderColumn.field] != null;
32
+ if (shouldHaveReorderColumn && !hasReorderColumn) {
37
33
  columnsState.lookup[reorderColumn.field] = reorderColumn;
38
34
  columnsState.orderedFields = [reorderColumn.field, ...columnsState.orderedFields];
39
- } else if (!shouldHaveReorderColumn && haveReorderColumn) {
35
+ } else if (!shouldHaveReorderColumn && hasReorderColumn) {
40
36
  delete columnsState.lookup[reorderColumn.field];
41
37
  columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== reorderColumn.field);
38
+ } else if (shouldHaveReorderColumn && hasReorderColumn) {
39
+ columnsState.lookup[reorderColumn.field] = _extends({}, reorderColumn, columnsState.lookup[reorderColumn.field]);
40
+ // If the column is not in the columns array (not a custom reorder column), move it to the beginning of the column order
41
+ if (!props.columns.some(col => col.field === GRID_REORDER_COL_DEF.field)) {
42
+ columnsState.orderedFields = [reorderColumn.field, ...columnsState.orderedFields.filter(field => field !== reorderColumn.field)];
43
+ }
42
44
  }
43
45
  return columnsState;
44
- }, [privateApiRef, classes, props.rowReordering]);
46
+ }, [privateApiRef, classes, props.columns, props.rowReordering]);
45
47
  useGridRegisterPipeProcessor(privateApiRef, 'hydrateColumns', updateReorderColumn);
46
48
  };
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["hideDescendantCount"];
4
4
  import * as React from 'react';
5
- import { gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid';
5
+ import { gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid';
6
6
  import { GridStrategyGroup, useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
7
7
  import { GRID_TREE_DATA_GROUPING_COL_DEF, GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES } from "../treeData/gridTreeDataGroupColDef.js";
8
8
  import { skipFiltering, skipSorting } from "./utils.js";
@@ -56,8 +56,7 @@ export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) =>
56
56
  }
57
57
  columnsState.lookup[groupingColDefField] = newGroupingColumn;
58
58
  if (prevGroupingColumn == null) {
59
- const index = columnsState.orderedFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
60
- columnsState.orderedFields = [...columnsState.orderedFields.slice(0, index), groupingColDefField, ...columnsState.orderedFields.slice(index)];
59
+ columnsState.orderedFields = [groupingColDefField, ...columnsState.orderedFields];
61
60
  }
62
61
  } else if (!shouldHaveGroupingColumn && prevGroupingColumn) {
63
62
  delete columnsState.lookup[groupingColDefField];
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["hideDescendantCount"];
4
4
  import * as React from 'react';
5
- import { gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid';
5
+ import { gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid';
6
6
  import { GridStrategyGroup, useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
7
7
  import { GRID_TREE_DATA_GROUPING_COL_DEF, GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES } from "./gridTreeDataGroupColDef.js";
8
8
  import { filterRowTreeFromTreeData, TreeDataStrategy } from "./gridTreeDataUtils.js";
@@ -56,8 +56,7 @@ export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
56
56
  }
57
57
  columnsState.lookup[groupingColDefField] = newGroupingColumn;
58
58
  if (prevGroupingColumn == null) {
59
- const index = columnsState.orderedFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
60
- columnsState.orderedFields = [...columnsState.orderedFields.slice(0, index), groupingColDefField, ...columnsState.orderedFields.slice(index)];
59
+ columnsState.orderedFields = [groupingColDefField, ...columnsState.orderedFields];
61
60
  }
62
61
  } else if (!shouldHaveGroupingColumn && prevGroupingColumn) {
63
62
  delete columnsState.lookup[groupingColDefField];
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v8.5.0
2
+ * @mui/x-data-grid-pro v8.5.1
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -183,7 +183,7 @@ const useGridDetailPanel = (apiRef, props) => {
183
183
  }
184
184
  updateCachesIfNeeded();
185
185
  const heightCache = (0, _gridDetailPanelSelector.gridDetailPanelRawHeightCacheSelector)(apiRef);
186
- initialValue.detail = heightCache[row.id].height ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
186
+ initialValue.detail = heightCache[row.id]?.height ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
187
187
  return initialValue;
188
188
  }, [apiRef, updateCachesIfNeeded]);
189
189
  const enabled = props.getDetailPanelContent !== undefined;
@@ -14,28 +14,26 @@ var _gridDetailPanelToggleColDef = require("./gridDetailPanelToggleColDef");
14
14
  var _gridDetailPanelSelector = require("./gridDetailPanelSelector");
15
15
  const useGridDetailPanelPreProcessors = (privateApiRef, props) => {
16
16
  const addToggleColumn = React.useCallback(columnsState => {
17
- if (props.getDetailPanelContent == null) {
18
- // Remove the toggle column, when it exists
19
- if (columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD]) {
20
- delete columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD];
21
- columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD);
22
- }
23
- return columnsState;
24
- }
25
-
26
- // Don't add the toggle column if there's already one
27
- // The user might have manually added it to have it in a custom position
28
- if (columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD]) {
29
- return columnsState;
30
- }
31
-
32
- // Otherwise, add the toggle column at the beginning
33
- columnsState.orderedFields = [_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.orderedFields];
34
- columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD] = (0, _extends2.default)({}, _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_COL_DEF, {
17
+ const detailPanelToggleColumn = (0, _extends2.default)({}, _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_COL_DEF, {
35
18
  headerName: privateApiRef.current.getLocaleText('detailPanelToggle')
36
19
  });
20
+ const shouldHaveToggleColumn = !!props.getDetailPanelContent;
21
+ const hasToggleColumn = columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD] != null;
22
+ if (shouldHaveToggleColumn && !hasToggleColumn) {
23
+ columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD] = detailPanelToggleColumn;
24
+ columnsState.orderedFields = [_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.orderedFields];
25
+ } else if (!shouldHaveToggleColumn && hasToggleColumn) {
26
+ delete columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD];
27
+ columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD);
28
+ } else if (shouldHaveToggleColumn && hasToggleColumn) {
29
+ columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD] = (0, _extends2.default)({}, detailPanelToggleColumn, columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD]);
30
+ // If the column is not in the columns array (not a custom detail panel toggle column), move it to the beginning of the column order
31
+ if (!props.columns.some(col => col.field === _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD)) {
32
+ columnsState.orderedFields = [_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.orderedFields.filter(field => field !== _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD)];
33
+ }
34
+ }
37
35
  return columnsState;
38
- }, [privateApiRef, props.getDetailPanelContent]);
36
+ }, [privateApiRef, props.columns, props.getDetailPanelContent]);
39
37
  const addExpandedClassToRow = React.useCallback((classes, id) => {
40
38
  if (props.getDetailPanelContent == null) {
41
39
  return classes;
@@ -36,20 +36,22 @@ const useGridRowReorderPreProcessors = (privateApiRef, props) => {
36
36
  headerName: privateApiRef.current.getLocaleText('rowReorderingHeaderName')
37
37
  });
38
38
  const shouldHaveReorderColumn = props.rowReordering;
39
- const haveReorderColumn = columnsState.lookup[reorderColumn.field] != null;
40
- if (shouldHaveReorderColumn && haveReorderColumn) {
41
- columnsState.lookup[reorderColumn.field] = (0, _extends2.default)({}, reorderColumn, columnsState.lookup[reorderColumn.field]);
42
- return columnsState;
43
- }
44
- if (shouldHaveReorderColumn && !haveReorderColumn) {
39
+ const hasReorderColumn = columnsState.lookup[reorderColumn.field] != null;
40
+ if (shouldHaveReorderColumn && !hasReorderColumn) {
45
41
  columnsState.lookup[reorderColumn.field] = reorderColumn;
46
42
  columnsState.orderedFields = [reorderColumn.field, ...columnsState.orderedFields];
47
- } else if (!shouldHaveReorderColumn && haveReorderColumn) {
43
+ } else if (!shouldHaveReorderColumn && hasReorderColumn) {
48
44
  delete columnsState.lookup[reorderColumn.field];
49
45
  columnsState.orderedFields = columnsState.orderedFields.filter(field => field !== reorderColumn.field);
46
+ } else if (shouldHaveReorderColumn && hasReorderColumn) {
47
+ columnsState.lookup[reorderColumn.field] = (0, _extends2.default)({}, reorderColumn, columnsState.lookup[reorderColumn.field]);
48
+ // If the column is not in the columns array (not a custom reorder column), move it to the beginning of the column order
49
+ if (!props.columns.some(col => col.field === _gridRowReorderColDef.GRID_REORDER_COL_DEF.field)) {
50
+ columnsState.orderedFields = [reorderColumn.field, ...columnsState.orderedFields.filter(field => field !== reorderColumn.field)];
51
+ }
50
52
  }
51
53
  return columnsState;
52
- }, [privateApiRef, classes, props.rowReordering]);
54
+ }, [privateApiRef, classes, props.columns, props.rowReordering]);
53
55
  (0, _internals.useGridRegisterPipeProcessor)(privateApiRef, 'hydrateColumns', updateReorderColumn);
54
56
  };
55
57
  exports.useGridRowReorderPreProcessors = useGridRowReorderPreProcessors;
@@ -64,8 +64,7 @@ const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) => {
64
64
  }
65
65
  columnsState.lookup[groupingColDefField] = newGroupingColumn;
66
66
  if (prevGroupingColumn == null) {
67
- const index = columnsState.orderedFields[0] === _xDataGrid.GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
68
- columnsState.orderedFields = [...columnsState.orderedFields.slice(0, index), groupingColDefField, ...columnsState.orderedFields.slice(index)];
67
+ columnsState.orderedFields = [groupingColDefField, ...columnsState.orderedFields];
69
68
  }
70
69
  } else if (!shouldHaveGroupingColumn && prevGroupingColumn) {
71
70
  delete columnsState.lookup[groupingColDefField];
@@ -64,8 +64,7 @@ const useGridTreeDataPreProcessors = (privateApiRef, props) => {
64
64
  }
65
65
  columnsState.lookup[groupingColDefField] = newGroupingColumn;
66
66
  if (prevGroupingColumn == null) {
67
- const index = columnsState.orderedFields[0] === _xDataGrid.GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
68
- columnsState.orderedFields = [...columnsState.orderedFields.slice(0, index), groupingColDefField, ...columnsState.orderedFields.slice(index)];
67
+ columnsState.orderedFields = [groupingColDefField, ...columnsState.orderedFields];
69
68
  }
70
69
  } else if (!shouldHaveGroupingColumn && prevGroupingColumn) {
71
70
  delete columnsState.lookup[groupingColDefField];
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v8.5.0
2
+ * @mui/x-data-grid-pro v8.5.1
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "8.5.0",
3
+ "version": "8.5.1",
4
4
  "author": "MUI Team",
5
5
  "description": "The Pro plan edition of the MUI X Data Grid components.",
6
6
  "main": "./index.js",
@@ -35,15 +35,15 @@
35
35
  "directory": "packages/x-data-grid-pro"
36
36
  },
37
37
  "dependencies": {
38
- "@babel/runtime": "^7.27.1",
39
- "@mui/utils": "^7.0.2",
38
+ "@babel/runtime": "^7.27.4",
39
+ "@mui/utils": "^7.1.1",
40
40
  "@types/format-util": "^1.0.4",
41
41
  "clsx": "^2.1.1",
42
42
  "prop-types": "^15.8.1",
43
43
  "reselect": "^5.1.1",
44
- "@mui/x-internals": "8.5.0",
45
- "@mui/x-license": "8.5.0",
46
- "@mui/x-data-grid": "8.5.0"
44
+ "@mui/x-internals": "8.5.1",
45
+ "@mui/x-data-grid": "8.5.1",
46
+ "@mui/x-license": "8.5.1"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@emotion/react": "^11.9.0",