@mui/x-data-grid-pro 7.24.1 → 7.26.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 (55) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/DataGridPro/DataGridPro.js +5 -4
  3. package/DataGridPro/useDataGridProComponent.js +2 -2
  4. package/components/GridDetailPanelToggleCell.js +10 -1
  5. package/components/GridPinnedRows.js +3 -4
  6. package/esm/DataGridPro/DataGridPro.js +5 -4
  7. package/esm/DataGridPro/useDataGridProComponent.js +2 -2
  8. package/esm/components/GridDetailPanelToggleCell.js +11 -2
  9. package/esm/components/GridPinnedRows.js +4 -5
  10. package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -7
  11. package/esm/hooks/features/columnPinning/useGridColumnPinning.js +1 -1
  12. package/esm/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -9
  13. package/esm/hooks/features/dataSource/cache.js +1 -1
  14. package/esm/hooks/features/dataSource/useGridDataSource.js +6 -4
  15. package/esm/hooks/features/detailPanel/useGridDetailPanel.js +7 -12
  16. package/esm/hooks/features/index.js +1 -1
  17. package/esm/hooks/features/infiniteLoader/useGridInfiniteLoader.js +5 -5
  18. package/esm/hooks/features/serverSideTreeData/utils.js +2 -3
  19. package/esm/utils/releaseInfo.js +1 -1
  20. package/esm/utils/tree/utils.js +1 -1
  21. package/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -5
  22. package/hooks/features/columnPinning/useGridColumnPinning.js +1 -1
  23. package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +1 -8
  24. package/hooks/features/dataSource/cache.d.ts +1 -0
  25. package/hooks/features/dataSource/cache.js +1 -0
  26. package/hooks/features/dataSource/useGridDataSource.js +8 -6
  27. package/hooks/features/detailPanel/useGridDetailPanel.js +7 -12
  28. package/hooks/features/index.d.ts +1 -1
  29. package/hooks/features/index.js +17 -11
  30. package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +3 -3
  31. package/hooks/features/serverSideTreeData/utils.d.ts +5 -5
  32. package/hooks/features/serverSideTreeData/utils.js +1 -2
  33. package/hooks/utils/useGridApiContext.d.ts +3 -1
  34. package/hooks/utils/useGridApiRef.d.ts +3 -1
  35. package/index.js +1 -1
  36. package/modern/DataGridPro/DataGridPro.js +5 -4
  37. package/modern/DataGridPro/useDataGridProComponent.js +2 -2
  38. package/modern/components/GridDetailPanelToggleCell.js +11 -2
  39. package/modern/components/GridPinnedRows.js +4 -5
  40. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -7
  41. package/modern/hooks/features/columnPinning/useGridColumnPinning.js +1 -1
  42. package/modern/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -9
  43. package/modern/hooks/features/dataSource/cache.js +1 -1
  44. package/modern/hooks/features/dataSource/useGridDataSource.js +6 -4
  45. package/modern/hooks/features/detailPanel/useGridDetailPanel.js +7 -12
  46. package/modern/hooks/features/index.js +1 -1
  47. package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +5 -5
  48. package/modern/hooks/features/serverSideTreeData/utils.js +2 -3
  49. package/modern/index.js +1 -1
  50. package/modern/utils/releaseInfo.js +1 -1
  51. package/modern/utils/tree/utils.js +1 -1
  52. package/package.json +4 -4
  53. package/utils/releaseInfo.js +1 -1
  54. package/utils/tree/utils.d.ts +1 -1
  55. package/utils/tree/utils.js +1 -1
@@ -4,9 +4,6 @@ import { useGridSelector, useGridApiEventHandler, useGridApiMethod, gridDataRowI
4
4
  import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
5
5
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "./gridDetailPanelToggleColDef.js";
6
6
  import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelRawHeightCacheSelector } from "./gridDetailPanelSelector.js";
7
- // FIXME: calling `api.updateDimensions()` here triggers a cycle where `updateDimensions` is
8
- // called 3 times when opening/closing a panel.
9
-
10
7
  export const detailPanelStateInitializer = (state, props) => {
11
8
  return _extends({}, state, {
12
9
  detailPanel: {
@@ -101,8 +98,6 @@ export const useGridDetailPanel = (apiRef, props) => {
101
98
  })
102
99
  });
103
100
  });
104
- apiRef.current.updateDimensions();
105
- apiRef.current.forceUpdate();
106
101
  }, [apiRef]);
107
102
  const storeDetailPanelHeight = React.useCallback((id, height) => {
108
103
  const heightCache = gridDetailPanelRawHeightCacheSelector(apiRef.current.state);
@@ -120,7 +115,6 @@ export const useGridDetailPanel = (apiRef, props) => {
120
115
  })
121
116
  });
122
117
  });
123
- apiRef.current.updateDimensions();
124
118
  apiRef.current.requestPipeProcessorsApplication('rowHeight');
125
119
  }, [apiRef]);
126
120
  const detailPanelHasAutoHeight = React.useCallback(id => {
@@ -147,17 +141,19 @@ export const useGridDetailPanel = (apiRef, props) => {
147
141
  }
148
142
  }, [apiRef, props.detailPanelExpandedRowIds]);
149
143
  const updateCachesAndForceUpdate = React.useCallback(() => {
144
+ if (!props.getDetailPanelContent) {
145
+ return;
146
+ }
150
147
  apiRef.current.setState(state => {
151
148
  return _extends({}, state, {
152
149
  detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
153
150
  });
154
151
  });
155
- apiRef.current.updateDimensions?.();
156
152
  apiRef.current.forceUpdate();
157
153
  }, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
158
154
  useGridApiEventHandler(apiRef, 'sortedRowsSet', updateCachesAndForceUpdate);
159
- const previousGetDetailPanelContentProp = React.useRef(null);
160
- const previousGetDetailPanelHeightProp = React.useRef(null);
155
+ const previousGetDetailPanelContentProp = React.useRef(undefined);
156
+ const previousGetDetailPanelHeightProp = React.useRef(undefined);
161
157
  const updateCachesIfNeeded = React.useCallback(() => {
162
158
  if (props.getDetailPanelContent === previousGetDetailPanelContentProp.current && props.getDetailPanelHeight === previousGetDetailPanelHeightProp.current) {
163
159
  return;
@@ -167,7 +163,6 @@ export const useGridDetailPanel = (apiRef, props) => {
167
163
  detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
168
164
  });
169
165
  });
170
- apiRef.current.updateDimensions?.();
171
166
  previousGetDetailPanelContentProp.current = props.getDetailPanelContent;
172
167
  previousGetDetailPanelHeightProp.current = props.getDetailPanelHeight;
173
168
  }, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
@@ -181,7 +176,8 @@ export const useGridDetailPanel = (apiRef, props) => {
181
176
  initialValue.detail = heightCache[row.id] ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
182
177
  return initialValue;
183
178
  }, [apiRef, expandedRowIds, updateCachesIfNeeded]);
184
- useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
179
+ const enabled = props.getDetailPanelContent !== undefined;
180
+ useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight, enabled);
185
181
  const isFirstRender = React.useRef(true);
186
182
  if (isFirstRender.current) {
187
183
  updateCachesIfNeeded();
@@ -189,7 +185,6 @@ export const useGridDetailPanel = (apiRef, props) => {
189
185
  React.useEffect(() => {
190
186
  if (!isFirstRender.current) {
191
187
  updateCachesIfNeeded();
192
- apiRef.current.hydrateRowsMeta();
193
188
  }
194
189
  isFirstRender.current = false;
195
190
  }, [apiRef, updateCachesIfNeeded]);
@@ -6,4 +6,4 @@ export * from "./treeData/index.js";
6
6
  export * from "./detailPanel/index.js";
7
7
  export * from "./rowPinning/index.js";
8
8
  export * from "./dataSource/interfaces.js";
9
- export * from "./dataSource/cache.js";
9
+ export { GridDataSourceCacheDefault } from "./dataSource/cache.js";
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { useGridSelector, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, useGridApiMethod, gridDimensionsSelector } from '@mui/x-data-grid';
3
- import { useGridVisibleRows, useTimeout } from '@mui/x-data-grid/internals';
2
+ import { useGridSelector, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, useGridApiMethod } from '@mui/x-data-grid';
3
+ import { useGridVisibleRows, useTimeout, gridHorizontalScrollbarHeightSelector } from '@mui/x-data-grid/internals';
4
4
  import useEventCallback from '@mui/utils/useEventCallback';
5
5
  import { styled } from '@mui/system';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -40,8 +40,6 @@ export const useGridInfiniteLoader = (apiRef, props) => {
40
40
  }
41
41
  });
42
42
  const virtualScroller = apiRef.current.virtualScrollerRef.current;
43
- const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
44
- const marginBottom = props.scrollEndThreshold - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
45
43
  React.useEffect(() => {
46
44
  if (!isEnabled) {
47
45
  return;
@@ -50,6 +48,8 @@ export const useGridInfiniteLoader = (apiRef, props) => {
50
48
  return;
51
49
  }
52
50
  observer.current?.disconnect();
51
+ const horizontalScrollbarHeight = gridHorizontalScrollbarHeightSelector(apiRef.current.state);
52
+ const marginBottom = props.scrollEndThreshold - horizontalScrollbarHeight;
53
53
  observer.current = new IntersectionObserver(handleLoadMoreRows, {
54
54
  threshold: 1,
55
55
  root: virtualScroller,
@@ -58,7 +58,7 @@ export const useGridInfiniteLoader = (apiRef, props) => {
58
58
  if (triggerElement.current) {
59
59
  observer.current.observe(triggerElement.current);
60
60
  }
61
- }, [virtualScroller, handleLoadMoreRows, isEnabled, marginBottom]);
61
+ }, [apiRef, virtualScroller, handleLoadMoreRows, isEnabled, props.scrollEndThreshold]);
62
62
  const updateTarget = node => {
63
63
  if (triggerElement.current !== node) {
64
64
  observer.current?.disconnect();
@@ -1,9 +1,8 @@
1
1
  import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
2
- import { getTreeNodeDescendants } from '@mui/x-data-grid/internals';
2
+ import { defaultGridFilterLookup, getTreeNodeDescendants } from '@mui/x-data-grid/internals';
3
3
  export function skipFiltering(rowTree) {
4
4
  const filteredRowsLookup = {};
5
5
  const filteredChildrenCountLookup = {};
6
- const filteredDescendantCountLookup = {};
7
6
  const nodes = Object.values(rowTree);
8
7
  for (let i = 0; i < nodes.length; i += 1) {
9
8
  const node = nodes[i];
@@ -13,7 +12,7 @@ export function skipFiltering(rowTree) {
13
12
  return {
14
13
  filteredRowsLookup,
15
14
  filteredChildrenCountLookup,
16
- filteredDescendantCountLookup
15
+ filteredDescendantCountLookup: defaultGridFilterLookup.filteredDescendantCountLookup
17
16
  };
18
17
  }
19
18
  export function skipSorting(rowTree) {
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v7.24.1
2
+ * @mui/x-data-grid-pro v7.26.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczNzY1ODgwMDAwMA==";
3
+ const releaseInfo = "MTczODg4MjgwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -166,7 +166,7 @@ export const getVisibleRowsLookup = ({
166
166
  }
167
167
  const visibleRowsLookup = {};
168
168
  const handleTreeNode = (node, areAncestorsExpanded) => {
169
- const isPassingFiltering = filteredRowsLookup[node.id];
169
+ const isPassingFiltering = filteredRowsLookup[node.id] !== false;
170
170
  if (node.type === 'group') {
171
171
  node.children.forEach(childId => {
172
172
  const childNode = tree[childId];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "7.24.1",
3
+ "version": "7.26.0",
4
4
  "description": "The Pro plan edition of the Data Grid components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -39,9 +39,9 @@
39
39
  "clsx": "^2.1.1",
40
40
  "prop-types": "^15.8.1",
41
41
  "reselect": "^5.1.1",
42
- "@mui/x-internals": "7.24.1",
43
- "@mui/x-license": "7.24.1",
44
- "@mui/x-data-grid": "7.24.1"
42
+ "@mui/x-data-grid": "7.26.0",
43
+ "@mui/x-internals": "7.26.0",
44
+ "@mui/x-license": "7.26.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@emotion/react": "^11.9.0",
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getReleaseInfo = void 0;
7
7
  var _utils = require("@mui/utils");
8
8
  const getReleaseInfo = () => {
9
- const releaseInfo = "MTczNzY1ODgwMDAwMA==";
9
+ const releaseInfo = "MTczODg4MjgwMDAwMA==";
10
10
  if (process.env.NODE_ENV !== 'production') {
11
11
  // A simple hack to set the value in the test environment (has no build step).
12
12
  // eslint-disable-next-line no-useless-concat
@@ -35,4 +35,4 @@ export declare const createUpdatedGroupsManager: () => GridRowTreeUpdatedGroupsM
35
35
  export declare const getVisibleRowsLookup: ({ tree, filteredRowsLookup, }: {
36
36
  tree: GridRowsState["tree"];
37
37
  filteredRowsLookup: GridFilterState["filteredRowsLookup"];
38
- }) => Record<GridRowId, boolean>;
38
+ }) => import("@mui/x-data-grid/hooks/features/filter/gridFilterState").GridVisibleRowsLookupState;
@@ -181,7 +181,7 @@ const getVisibleRowsLookup = ({
181
181
  }
182
182
  const visibleRowsLookup = {};
183
183
  const handleTreeNode = (node, areAncestorsExpanded) => {
184
- const isPassingFiltering = filteredRowsLookup[node.id];
184
+ const isPassingFiltering = filteredRowsLookup[node.id] !== false;
185
185
  if (node.type === 'group') {
186
186
  node.children.forEach(childId => {
187
187
  const childNode = tree[childId];