@mui/x-data-grid-pro 5.12.3 → 5.14.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.
- package/CHANGELOG.md +147 -1
- package/DataGridPro/DataGridPro.js +1 -1
- package/DataGridPro/useDataGridProComponent.js +1 -1
- package/components/DataGridProColumnHeaders.js +14 -7
- package/components/DataGridProVirtualScroller.js +7 -18
- package/components/GridDetailPanel.d.ts +19 -0
- package/components/GridDetailPanel.js +65 -0
- package/components/GridRowReorderCell.d.ts +1 -1
- package/components/GridRowReorderCell.js +7 -0
- package/hooks/features/columnPinning/useGridColumnPinning.d.ts +1 -1
- package/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
- package/hooks/features/detailPanel/gridDetailPanelInterface.d.ts +20 -1
- package/hooks/features/detailPanel/gridDetailPanelSelector.d.ts +14 -3
- package/hooks/features/detailPanel/gridDetailPanelSelector.js +9 -1
- package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
- package/hooks/features/detailPanel/index.d.ts +1 -1
- package/hooks/features/detailPanel/index.js +1 -1
- package/hooks/features/detailPanel/useGridDetailPanel.js +41 -7
- package/hooks/features/detailPanel/useGridDetailPanelCache.d.ts +4 -0
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +64 -0
- package/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
- package/hooks/features/treeData/gridTreeDataUtils.js +9 -0
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/legacy/DataGridPro/DataGridPro.js +1 -1
- package/legacy/DataGridPro/useDataGridProComponent.js +1 -1
- package/legacy/components/DataGridProColumnHeaders.js +14 -7
- package/legacy/components/DataGridProVirtualScroller.js +12 -26
- package/legacy/components/GridDetailPanel.js +72 -0
- package/legacy/components/GridRowReorderCell.js +7 -0
- package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
- package/legacy/hooks/features/detailPanel/gridDetailPanelSelector.js +15 -2
- package/legacy/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
- package/legacy/hooks/features/detailPanel/index.js +1 -1
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +40 -7
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +64 -0
- package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
- package/legacy/hooks/features/treeData/gridTreeDataUtils.js +9 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/utils/releaseInfo.js +1 -1
- package/legacy/utils/tree/sortRowTree.js +27 -14
- package/models/dataGridProProps.d.ts +2 -2
- package/modern/DataGridPro/DataGridPro.js +1 -1
- package/modern/DataGridPro/useDataGridProComponent.js +1 -1
- package/modern/components/DataGridProColumnHeaders.js +14 -7
- package/modern/components/DataGridProVirtualScroller.js +7 -18
- package/modern/components/GridDetailPanel.js +65 -0
- package/modern/components/GridRowReorderCell.js +5 -0
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +8 -3
- package/modern/hooks/features/detailPanel/gridDetailPanelSelector.js +9 -1
- package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
- package/modern/hooks/features/detailPanel/index.js +1 -1
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +39 -7
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +62 -0
- package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
- package/modern/hooks/features/treeData/gridTreeDataUtils.js +9 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/utils/releaseInfo.js +1 -1
- package/modern/utils/tree/sortRowTree.js +26 -11
- package/node/DataGridPro/DataGridPro.js +1 -1
- package/node/DataGridPro/useDataGridProComponent.js +1 -1
- package/node/components/DataGridProColumnHeaders.js +14 -7
- package/node/components/DataGridProVirtualScroller.js +8 -19
- package/node/components/GridDetailPanel.js +83 -0
- package/node/components/GridRowReorderCell.js +7 -0
- package/node/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
- package/node/hooks/features/detailPanel/gridDetailPanelSelector.js +12 -2
- package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
- package/node/hooks/features/detailPanel/index.js +25 -11
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +40 -6
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +81 -0
- package/node/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
- package/node/hooks/features/treeData/gridTreeDataUtils.js +9 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +9 -0
- package/node/utils/releaseInfo.js +1 -1
- package/node/utils/tree/sortRowTree.js +26 -11
- package/package.json +5 -5
- package/utils/releaseInfo.js +1 -1
- package/utils/tree/sortRowTree.js +26 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,152 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 5.14.0
|
|
7
|
+
|
|
8
|
+
_Jul 21, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
|
|
13
|
+
- ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
|
|
14
|
+
- 🌍 Improvements to different locales
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
- 🐞 Bugfixes
|
|
17
|
+
|
|
18
|
+
### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
|
|
19
|
+
|
|
20
|
+
#### Changes
|
|
21
|
+
|
|
22
|
+
- [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
|
|
23
|
+
- [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
|
|
24
|
+
- [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
|
|
25
|
+
- [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
|
|
26
|
+
- [DataGrid] Fix loading overlay position (#5558) @DanailH
|
|
27
|
+
- [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
|
|
28
|
+
- [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
|
|
29
|
+
- [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
|
|
30
|
+
- [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
|
|
31
|
+
|
|
32
|
+
### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
|
|
33
|
+
|
|
34
|
+
#### Changes
|
|
35
|
+
|
|
36
|
+
- [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
|
|
37
|
+
|
|
38
|
+
### Docs
|
|
39
|
+
|
|
40
|
+
- [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
|
|
41
|
+
- [docs] Remove blank line @oliviertassinari
|
|
42
|
+
|
|
43
|
+
### Core
|
|
44
|
+
|
|
45
|
+
- [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
|
|
46
|
+
- [core] Polish on the bug issue template (#5525) @oliviertassinari
|
|
47
|
+
- [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
|
|
48
|
+
|
|
49
|
+
## 5.13.1
|
|
50
|
+
|
|
51
|
+
_Jul 15, 2022_
|
|
52
|
+
|
|
53
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
54
|
+
|
|
55
|
+
- ✏️ Enter edit mode when pasting in a cell with Ctrl+V (Cmd+V on macOS) (#5405) @alexfauquette
|
|
56
|
+
- 🌍 Many improvements to the locales
|
|
57
|
+
- 📚 Documentation improvements
|
|
58
|
+
- 🐞 Bugfixes
|
|
59
|
+
|
|
60
|
+
### `@mui/x-data-grid@v5.13.1` / `@mui/x-data-grid-pro@v5.13.1` / `@mui/x-data-grid-premium@v5.13.1`
|
|
61
|
+
|
|
62
|
+
#### Changes
|
|
63
|
+
|
|
64
|
+
- [DataGrid] Fix blank space when using dynamic row height with pagination (#5315) @m4theushw
|
|
65
|
+
- [DataGrid] Start editing with uppercase letter and Ctrl+V (#5405) @alexfauquette
|
|
66
|
+
- [DataGrid] Fix some filters being removed from filter model on filter panel open (#5403) @cherniavskii
|
|
67
|
+
- [DataGridPro] Improve pinned column headers accessibility (#5370) @cherniavskii
|
|
68
|
+
- [l10n] Improve Dutch (nl-NL) locale (#5464) @developenguin
|
|
69
|
+
- [l10n] Improve French (fr-FR) locale (#3211) (#5420) @Zenoo
|
|
70
|
+
- [l10n] Improve German (de-DE) locale (#5448) @sebastianfrey
|
|
71
|
+
- [l10n] Improve Brazilian Portuguese (pt-BR) locale (#5394) @andrepxa
|
|
72
|
+
- [l10n] Improve Romanian (ro-RO) locale (#5449) @rolule
|
|
73
|
+
|
|
74
|
+
### `@mui/x-date-pickers@v5.0.0-beta.1` / `@mui/x-date-picker-pro@5.0.0-beta.1`
|
|
75
|
+
|
|
76
|
+
#### Changes
|
|
77
|
+
|
|
78
|
+
- [pickers] Add Italian (it-IT) locale (#5467) @felixh10r
|
|
79
|
+
- [pickers] Add Spanish (es-ES) locale (#5468) @felixh10r
|
|
80
|
+
- [pickers] Improve French (fr-FR) locale (#5446) @Zenoo
|
|
81
|
+
- [pickers] Improve German (de-DE) locale (#5447) @sebastianfrey
|
|
82
|
+
|
|
83
|
+
### Docs
|
|
84
|
+
|
|
85
|
+
- [docs] Fix typo in the sorting page (#5431) @JosephMarinier
|
|
86
|
+
- [docs] Fix description for "Striped rows" example (#5432) @lindapaiste
|
|
87
|
+
- [docs] Make a clear difference between the license and license key (#5316) @oliviertassinari
|
|
88
|
+
- [docs] Update pickers README files (#5456) @cherniavskii
|
|
89
|
+
- [docs] Clarify the scope of support for MUI X (#5423) @joserodolfofreitas
|
|
90
|
+
|
|
91
|
+
### Core
|
|
92
|
+
|
|
93
|
+
- [core] Add technical support link to \_redirects (#5428) @joserodolfofreitas
|
|
94
|
+
- [core] Improve GitHub bug reproduction template (#5067) @joserodolfofreitas
|
|
95
|
+
- [core] Include playground pages in tsconfig (#5367) @cherniavskii
|
|
96
|
+
- [core] Sort keys like in material-ui @oliviertassinari
|
|
97
|
+
- [test] Wait for flags to load on regression tests (#5473) @m4theushw
|
|
98
|
+
|
|
99
|
+
## 5.13.0
|
|
100
|
+
|
|
101
|
+
_Jul 7, 2022_
|
|
102
|
+
|
|
103
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
104
|
+
|
|
105
|
+
- 🎁 `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` are now in beta!
|
|
106
|
+
|
|
107
|
+
- ✨ Allow detail panel's height to match its content (#5163) @m4theushw
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<DataGridPro getDetailPanelHeight={() => 'auto'} />
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- 🌍 Add Romanian (ro-RO) locale on the data grid (#5345) @rolule
|
|
114
|
+
- 📚 Documentation improvements
|
|
115
|
+
- 🐞 Bugfixes
|
|
116
|
+
|
|
117
|
+
### `@mui/x-data-grid@v5.13.0` / `@mui/x-data-grid-pro@v5.13.0` / `@mui/x-data-grid-premium@v5.13.0`
|
|
118
|
+
|
|
119
|
+
#### Changes
|
|
120
|
+
|
|
121
|
+
- [DataGrid] Allows to customize variant of value input in filter panel (#4826) @alexfauquette
|
|
122
|
+
- [DataGrid] Add Romanian (ro-RO) locale (#5345) @rolule
|
|
123
|
+
- [DataGrid] Export Norwegian (nb-NO) locale (#5407) @cherniavskii
|
|
124
|
+
- [DataGrid] Fix broken "start editing" integration with Japanese (#5414) @mnajdova
|
|
125
|
+
- [DataGrid] Fix "stop editing" integration with IME e.g. Japanese (#5257) @Gumichocopengin8
|
|
126
|
+
- [DataGrid] Fix dimensions computation with `autoHeight` and scroll x (#5401) @flaviendelangle
|
|
127
|
+
- [DataGrid] Improve Slovak (sk-SK) locale (#5332) @msidlo
|
|
128
|
+
- [DataGrid] Mention Premium plan in error messages and docs warnings (#5328) @cherniavskii
|
|
129
|
+
- [DataGrid] Remove trailing spaces in filter input (#5279) @alexfauquette
|
|
130
|
+
- [DataGridPro] Allow to infer detail panel height from content (#5163) @m4theushw
|
|
131
|
+
- [DataGridPro] Fix the depth of nodes when switching from a non-flat tree to a flat tree (#5362) @flaviendelangle
|
|
132
|
+
|
|
133
|
+
### `@mui/x-date-pickers@v5.0.0-beta.0` / `@mui/x-date-picker-pro@5.0.0-beta.0`
|
|
134
|
+
|
|
135
|
+
#### Changes
|
|
136
|
+
|
|
137
|
+
- [DateRangePicker] Fix keyboard selection (#5265) @alexfauquette
|
|
138
|
+
- [DayPicker] Remove empty space at the bottom of the day view (#5073) @flaviendelangle
|
|
139
|
+
- [pickers] Add missing type dependencies (#5331) @Methuselah96
|
|
140
|
+
- [pickers] Pass the generics to the components in the theme augmentation (#5199) @toruticas
|
|
141
|
+
|
|
142
|
+
### Docs
|
|
143
|
+
|
|
144
|
+
- [docs] Explain how to use hooks inside a cell renderer (#5158) @flaviendelangle
|
|
145
|
+
- [docs] Fix server-side pagination demo (#5361) @cherniavskii
|
|
146
|
+
- [docs] Fix typo in the quick filter docs (#5313) @alexfauquette
|
|
147
|
+
- [docs] Improve the "Getting started" page (#5293) @alexfauquette
|
|
148
|
+
- [docs] New page for the pickers action bar customization (#5267) @flaviendelangle
|
|
149
|
+
- [docs] Revise and split up "Overview" page into "Introduction" (#4692) @samuelsycamore
|
|
150
|
+
- [docs] Use `useKeepGroupedColumnsHiddren` from the grid package on remaining demo (#5382) @flaviendelangle
|
|
151
|
+
|
|
6
152
|
## v5.12.3
|
|
7
153
|
|
|
8
154
|
_Jun 23, 2022_
|
|
@@ -1363,7 +1509,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
|
|
|
1363
1509
|
- [core] Fix `yarn prettier` script (#3292) @oliviertassinari
|
|
1364
1510
|
- [core] Improve tests for Tree Data (#3366) @flaviendelangle
|
|
1365
1511
|
- [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
|
|
1366
|
-
- [core] Transition to a new
|
|
1512
|
+
- [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
|
|
1367
1513
|
- [core] Update monorepo (#3370) @flaviendelangle
|
|
1368
1514
|
- [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
|
|
1369
1515
|
- [test] Replace `useFakeTimers` (#3323) @m4theushw
|
|
@@ -318,7 +318,7 @@ DataGridProRaw.propTypes = {
|
|
|
318
318
|
/**
|
|
319
319
|
* Function that returns the height of the row detail panel.
|
|
320
320
|
* @param {GridRowParams} params With all properties from [[GridRowParams]].
|
|
321
|
-
* @returns {number} The height in pixels.
|
|
321
|
+
* @returns {number | string} The height in pixels or "auto" to use the content height.
|
|
322
322
|
* @default "() => 500"
|
|
323
323
|
*/
|
|
324
324
|
getDetailPanelHeight: PropTypes.func,
|
|
@@ -59,7 +59,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
59
59
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
60
60
|
useGridEditing(apiRef, props);
|
|
61
61
|
useGridFocus(apiRef, props);
|
|
62
|
-
useGridPreferencesPanel(apiRef);
|
|
62
|
+
useGridPreferencesPanel(apiRef, props);
|
|
63
63
|
useGridFilter(apiRef, props);
|
|
64
64
|
useGridSorting(apiRef, props);
|
|
65
65
|
useGridDensity(apiRef, props);
|
|
@@ -117,15 +117,21 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
|
|
|
117
117
|
firstColumnIndex: visibleColumnFields.length - rightPinnedColumns.length,
|
|
118
118
|
lastColumnIndex: visibleColumnFields.length
|
|
119
119
|
}) : null;
|
|
120
|
+
const innerProps = getInnerProps();
|
|
121
|
+
const pinnedColumnHeadersProps = {
|
|
122
|
+
role: innerProps.role,
|
|
123
|
+
'aria-rowindex': innerProps['aria-rowindex']
|
|
124
|
+
};
|
|
120
125
|
return /*#__PURE__*/_jsxs(GridColumnHeaders, _extends({
|
|
121
126
|
ref: ref,
|
|
122
127
|
className: className
|
|
123
128
|
}, getRootProps(other), {
|
|
124
|
-
children: [leftRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, {
|
|
129
|
+
children: [leftRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, _extends({
|
|
125
130
|
className: classes.leftPinnedColumns,
|
|
126
131
|
ownerState: {
|
|
127
132
|
side: GridPinnedPosition.left
|
|
128
|
-
}
|
|
133
|
+
}
|
|
134
|
+
}, pinnedColumnHeadersProps, {
|
|
129
135
|
children: getColumns({
|
|
130
136
|
renderContext: leftRenderContext,
|
|
131
137
|
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
@@ -133,22 +139,23 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
|
|
|
133
139
|
}, {
|
|
134
140
|
disableReorder: true
|
|
135
141
|
})
|
|
136
|
-
}), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
|
|
142
|
+
})), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
|
|
137
143
|
isDragging: isDragging
|
|
138
|
-
},
|
|
144
|
+
}, innerProps, {
|
|
139
145
|
children: getColumns({
|
|
140
146
|
renderContext,
|
|
141
147
|
minFirstColumn: leftPinnedColumns.length,
|
|
142
148
|
maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
|
|
143
149
|
})
|
|
144
|
-
})), rightRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, {
|
|
150
|
+
})), rightRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, _extends({
|
|
145
151
|
ownerState: {
|
|
146
152
|
side: GridPinnedPosition.right
|
|
147
153
|
},
|
|
148
154
|
className: classes.rightPinnedColumns,
|
|
149
155
|
style: {
|
|
150
156
|
paddingRight: scrollbarSize
|
|
151
|
-
}
|
|
157
|
+
}
|
|
158
|
+
}, pinnedColumnHeadersProps, {
|
|
152
159
|
children: getColumns({
|
|
153
160
|
renderContext: rightRenderContext,
|
|
154
161
|
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
@@ -157,6 +164,6 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
|
|
|
157
164
|
disableReorder: true,
|
|
158
165
|
separatorSide: GridColumnHeaderSeparatorSides.Left
|
|
159
166
|
})
|
|
160
|
-
})]
|
|
167
|
+
}))]
|
|
161
168
|
}));
|
|
162
169
|
});
|
|
@@ -3,7 +3,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["className", "disableVirtualization"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { styled, alpha } from '@mui/material/styles';
|
|
6
|
-
import Box from '@mui/material/Box';
|
|
7
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
8
7
|
import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler } from '@mui/x-data-grid';
|
|
9
8
|
import { GridVirtualScroller, GridVirtualScrollerContent, GridVirtualScrollerRenderZone, useGridVirtualScroller } from '@mui/x-data-grid/internals';
|
|
@@ -11,6 +10,7 @@ import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
|
11
10
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
12
11
|
import { gridPinnedColumnsSelector, GridPinnedPosition } from '../hooks/features/columnPinning';
|
|
13
12
|
import { gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelExpandedRowIdsSelector } from '../hooks/features/detailPanel';
|
|
13
|
+
import { GridDetailPanel } from './GridDetailPanel';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
export const filterColumns = (pinnedColumns, columns) => {
|
|
@@ -74,19 +74,6 @@ const VirtualScrollerDetailPanels = styled('div', {
|
|
|
74
74
|
})({
|
|
75
75
|
position: 'relative'
|
|
76
76
|
});
|
|
77
|
-
const VirtualScrollerDetailPanel = styled(Box, {
|
|
78
|
-
name: 'MuiDataGrid',
|
|
79
|
-
slot: 'DetailPanel',
|
|
80
|
-
overridesResolver: (props, styles) => styles.detailPanel
|
|
81
|
-
})(({
|
|
82
|
-
theme
|
|
83
|
-
}) => ({
|
|
84
|
-
zIndex: 2,
|
|
85
|
-
width: '100%',
|
|
86
|
-
position: 'absolute',
|
|
87
|
-
backgroundColor: theme.palette.background.default,
|
|
88
|
-
overflow: 'auto'
|
|
89
|
-
}));
|
|
90
77
|
const VirtualScrollerPinnedColumns = styled('div', {
|
|
91
78
|
name: 'MuiDataGrid',
|
|
92
79
|
slot: 'PinnedColumns',
|
|
@@ -210,15 +197,17 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
210
197
|
const exists = rowIndex !== undefined;
|
|
211
198
|
|
|
212
199
|
if ( /*#__PURE__*/React.isValidElement(content) && exists) {
|
|
213
|
-
const
|
|
200
|
+
const hasAutoHeight = apiRef.current.unstable_detailPanelHasAutoHeight(id);
|
|
201
|
+
const height = hasAutoHeight ? 'auto' : detailPanelsHeights[id];
|
|
214
202
|
const sizes = apiRef.current.unstable_getRowInternalSizes(id);
|
|
215
203
|
const spacingTop = (sizes == null ? void 0 : sizes.spacingTop) || 0;
|
|
216
204
|
const top = rowsMeta.positions[rowIndex] + apiRef.current.unstable_getRowHeight(id) + spacingTop;
|
|
217
|
-
panels.push( /*#__PURE__*/_jsx(
|
|
205
|
+
panels.push( /*#__PURE__*/_jsx(GridDetailPanel, {
|
|
206
|
+
rowId: id,
|
|
218
207
|
style: {
|
|
219
|
-
top
|
|
220
|
-
height
|
|
208
|
+
top
|
|
221
209
|
},
|
|
210
|
+
height: height,
|
|
222
211
|
className: classes.detailPanel,
|
|
223
212
|
children: content
|
|
224
213
|
}, i));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { GridRowId } from '@mui/x-data-grid';
|
|
4
|
+
interface GridDetailPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
7
|
+
*/
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
/**
|
|
10
|
+
* The panel height.
|
|
11
|
+
*/
|
|
12
|
+
height: number | 'auto';
|
|
13
|
+
/**
|
|
14
|
+
* The row ID that this panel belongs to.
|
|
15
|
+
*/
|
|
16
|
+
rowId: GridRowId;
|
|
17
|
+
}
|
|
18
|
+
declare const GridDetailPanel: (props: GridDetailPanelProps) => JSX.Element;
|
|
19
|
+
export { GridDetailPanel };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["rowId", "height", "style"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import Box from '@mui/material/Box';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const DetailPanel = styled(Box, {
|
|
10
|
+
name: 'MuiDataGrid',
|
|
11
|
+
slot: 'DetailPanel',
|
|
12
|
+
overridesResolver: (props, styles) => styles.detailPanel
|
|
13
|
+
})(({
|
|
14
|
+
theme
|
|
15
|
+
}) => ({
|
|
16
|
+
zIndex: 2,
|
|
17
|
+
width: '100%',
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
backgroundColor: theme.palette.background.default,
|
|
20
|
+
overflow: 'auto'
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const GridDetailPanel = props => {
|
|
24
|
+
const {
|
|
25
|
+
rowId,
|
|
26
|
+
height,
|
|
27
|
+
style: styleProp = {}
|
|
28
|
+
} = props,
|
|
29
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
30
|
+
|
|
31
|
+
const apiRef = useGridApiContext();
|
|
32
|
+
const ref = React.useRef();
|
|
33
|
+
React.useLayoutEffect(() => {
|
|
34
|
+
if (height === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
35
|
+
// Fallback for IE
|
|
36
|
+
apiRef.current.unstable_storeDetailPanelHeight(rowId, ref.current.clientHeight);
|
|
37
|
+
}
|
|
38
|
+
}, [apiRef, height, rowId]);
|
|
39
|
+
React.useLayoutEffect(() => {
|
|
40
|
+
const hasFixedHeight = height !== 'auto';
|
|
41
|
+
|
|
42
|
+
if (!ref.current || hasFixedHeight || typeof ResizeObserver === 'undefined') {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
47
|
+
const [entry] = entries;
|
|
48
|
+
const observedHeight = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
49
|
+
apiRef.current.unstable_storeDetailPanelHeight(rowId, observedHeight);
|
|
50
|
+
});
|
|
51
|
+
resizeObserver.observe(ref.current);
|
|
52
|
+
return () => resizeObserver.disconnect();
|
|
53
|
+
}, [apiRef, height, rowId]);
|
|
54
|
+
|
|
55
|
+
const style = _extends({}, styleProp, {
|
|
56
|
+
height
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return /*#__PURE__*/_jsx(DetailPanel, _extends({
|
|
60
|
+
ref: ref,
|
|
61
|
+
style: style
|
|
62
|
+
}, other));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { GridDetailPanel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
|
-
declare const GridRowReorderCell: (params: GridRenderCellParams) => JSX.Element;
|
|
3
|
+
declare const GridRowReorderCell: (params: GridRenderCellParams) => JSX.Element | null;
|
|
4
4
|
export { GridRowReorderCell };
|
|
5
5
|
export declare const renderRowReorderCell: (params: GridRenderCellParams) => JSX.Element;
|
|
@@ -19,6 +19,8 @@ const useUtilityClasses = ownerState => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const GridRowReorderCell = params => {
|
|
22
|
+
var _params$rowNode$posit;
|
|
23
|
+
|
|
22
24
|
const apiRef = useGridApiContext();
|
|
23
25
|
const rootProps = useGridRootProps();
|
|
24
26
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
@@ -57,6 +59,11 @@ const GridRowReorderCell = params => {
|
|
|
57
59
|
onDragOver: publish('rowDragOver'),
|
|
58
60
|
onDragEnd: publish('rowDragEnd')
|
|
59
61
|
} : null;
|
|
62
|
+
|
|
63
|
+
if (((_params$rowNode$posit = params.rowNode.position) != null ? _params$rowNode$posit : 'body') !== 'body') {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
60
67
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
61
68
|
className: classes.root,
|
|
62
69
|
draggable: isDraggable
|
|
@@ -3,4 +3,4 @@ import { GridStateInitializer } from '@mui/x-data-grid/internals';
|
|
|
3
3
|
import { GridApiPro } from '../../../models/gridApiPro';
|
|
4
4
|
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
5
5
|
export declare const columnPinningStateInitializer: GridStateInitializer<Pick<DataGridProProcessedProps, 'pinnedColumns' | 'initialState' | 'disableColumnPinning'>>;
|
|
6
|
-
export declare const useGridColumnPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'disableColumnPinning' | 'pinnedColumns' | 'onPinnedColumnsChange'>) => void;
|
|
6
|
+
export declare const useGridColumnPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'disableColumnPinning' | 'initialState' | 'pinnedColumns' | 'onPinnedColumnsChange'>) => void;
|
|
@@ -43,6 +43,8 @@ const mergeStateWithPinnedColumns = pinnedColumns => state => _extends({}, state
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
export const useGridColumnPinning = (apiRef, props) => {
|
|
46
|
+
var _props$initialState4;
|
|
47
|
+
|
|
46
48
|
const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector); // Each visible row (not to be confused with a filter result) is composed of a central .MuiDataGrid-row element
|
|
47
49
|
// and up to two additional .MuiDataGrid-row's, one for the columns pinned to the left and another
|
|
48
50
|
// for those on the right side. When hovering any of these elements, the :hover styles are applied only to
|
|
@@ -164,17 +166,24 @@ export const useGridColumnPinning = (apiRef, props) => {
|
|
|
164
166
|
|
|
165
167
|
return initialValue;
|
|
166
168
|
}, [apiRef, pinnedColumns]);
|
|
167
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
169
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
170
|
+
var _props$initialState3, _pinnedColumnsToExpor, _pinnedColumnsToExpor2;
|
|
171
|
+
|
|
168
172
|
const pinnedColumnsToExport = gridPinnedColumnsSelector(apiRef.current.state);
|
|
173
|
+
const shouldExportPinnedColumns = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
174
|
+
!context.exportOnlyDirtyModels || // Always export if the model is controlled
|
|
175
|
+
props.pinnedColumns != null || // Always export if the model has been initialized
|
|
176
|
+
((_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.pinnedColumns) != null || // Export if the model is not empty
|
|
177
|
+
((_pinnedColumnsToExpor = pinnedColumnsToExport.left) != null ? _pinnedColumnsToExpor : []).length > 0 || ((_pinnedColumnsToExpor2 = pinnedColumnsToExport.right) != null ? _pinnedColumnsToExpor2 : []).length > 0;
|
|
169
178
|
|
|
170
|
-
if (
|
|
179
|
+
if (!shouldExportPinnedColumns) {
|
|
171
180
|
return prevState;
|
|
172
181
|
}
|
|
173
182
|
|
|
174
183
|
return _extends({}, prevState, {
|
|
175
184
|
pinnedColumns: pinnedColumnsToExport
|
|
176
185
|
});
|
|
177
|
-
}, [apiRef]);
|
|
186
|
+
}, [apiRef, props.pinnedColumns, (_props$initialState4 = props.initialState) == null ? void 0 : _props$initialState4.pinnedColumns]);
|
|
178
187
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
179
188
|
const newPinnedColumns = context.stateToRestore.pinnedColumns;
|
|
180
189
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridRowId } from '@mui/x-data-grid';
|
|
3
|
+
declare type DetailPanelHeightCache = Record<GridRowId, {
|
|
4
|
+
autoHeight: boolean;
|
|
5
|
+
height: number;
|
|
6
|
+
}>;
|
|
3
7
|
/**
|
|
4
8
|
* The master/detail API interface that is available in the grid [[apiRef]].
|
|
5
9
|
*/
|
|
@@ -19,10 +23,25 @@ export interface GridDetailPanelApi {
|
|
|
19
23
|
* @param {GridRowId[]} ids The ids of the rows to open the detail panel.
|
|
20
24
|
*/
|
|
21
25
|
setExpandedDetailPanels: (ids: GridRowId[]) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Stores the panel height measurement and triggers the row height pre-processing.
|
|
28
|
+
* @param {GridRowId} id The id of the row.
|
|
29
|
+
* @param {number} height The new height.
|
|
30
|
+
* @ignore - do not document.
|
|
31
|
+
*/
|
|
32
|
+
unstable_storeDetailPanelHeight: (id: GridRowId, height: number) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Determines if the height of a detail panel is "auto".
|
|
35
|
+
* @param {GridRowId} id The id of the row.
|
|
36
|
+
* @return {boolean} `true` if the detail panel height is "auto".
|
|
37
|
+
* @ignore - do not document.
|
|
38
|
+
*/
|
|
39
|
+
unstable_detailPanelHasAutoHeight: (id: GridRowId) => boolean;
|
|
22
40
|
}
|
|
23
41
|
export interface GridDetailPanelState {
|
|
24
42
|
expandedRowIds: GridRowId[];
|
|
25
43
|
contentCache: Record<GridRowId, React.ReactNode>;
|
|
26
|
-
heightCache:
|
|
44
|
+
heightCache: DetailPanelHeightCache;
|
|
27
45
|
}
|
|
28
46
|
export declare type GridDetailPanelInitialState = Pick<GridDetailPanelState, 'expandedRowIds'>;
|
|
47
|
+
export {};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { GridRowId } from '@mui/x-data-grid';
|
|
2
3
|
import { GridStatePro } from '../../../models/gridStatePro';
|
|
3
|
-
export declare const gridDetailPanelExpandedRowIdsSelector: (state: GridStatePro) =>
|
|
4
|
-
export declare const gridDetailPanelExpandedRowsContentCacheSelector: (state: GridStatePro) => Record<
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const gridDetailPanelExpandedRowIdsSelector: (state: GridStatePro) => GridRowId[];
|
|
5
|
+
export declare const gridDetailPanelExpandedRowsContentCacheSelector: (state: GridStatePro) => Record<GridRowId, import("react").ReactNode>;
|
|
6
|
+
export declare const gridDetailPanelRawHeightCacheSelector: (state: GridStatePro) => {
|
|
7
|
+
[x: string]: {
|
|
8
|
+
autoHeight: boolean;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
[x: number]: {
|
|
12
|
+
autoHeight: boolean;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const gridDetailPanelExpandedRowsHeightCacheSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, Record<GridRowId, number>>;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { createSelector } from '@mui/x-data-grid/internals';
|
|
1
2
|
export const gridDetailPanelExpandedRowIdsSelector = state => state.detailPanel.expandedRowIds;
|
|
2
3
|
export const gridDetailPanelExpandedRowsContentCacheSelector = state => state.detailPanel.contentCache;
|
|
3
|
-
export const
|
|
4
|
+
export const gridDetailPanelRawHeightCacheSelector = state => state.detailPanel.heightCache; // TODO v6: Make this selector return the full object, including the autoHeight flag
|
|
5
|
+
|
|
6
|
+
export const gridDetailPanelExpandedRowsHeightCacheSelector = createSelector(gridDetailPanelRawHeightCacheSelector, heightCache => Object.entries(heightCache).reduce((acc, [id, {
|
|
7
|
+
height
|
|
8
|
+
}]) => {
|
|
9
|
+
acc[id] = height || 0;
|
|
10
|
+
return acc;
|
|
11
|
+
}, {}));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './gridDetailPanelToggleColDef';
|
|
2
|
-
export
|
|
2
|
+
export { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, } from './gridDetailPanelSelector';
|
|
3
3
|
export * from './gridDetailPanelInterface';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './gridDetailPanelToggleColDef';
|
|
2
|
-
export
|
|
2
|
+
export { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector } from './gridDetailPanelSelector';
|
|
3
3
|
export * from './gridDetailPanelInterface';
|
|
@@ -3,18 +3,19 @@ import * as React from 'react';
|
|
|
3
3
|
import { useGridSelector, useGridApiEventHandler, useGridApiMethod, gridRowIdsSelector } from '@mui/x-data-grid';
|
|
4
4
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
5
5
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from './gridDetailPanelToggleColDef';
|
|
6
|
-
import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector } from './gridDetailPanelSelector';
|
|
6
|
+
import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelRawHeightCacheSelector } from './gridDetailPanelSelector';
|
|
7
7
|
export const detailPanelStateInitializer = (state, props) => {
|
|
8
8
|
var _ref, _props$detailPanelExp, _props$initialState, _props$initialState$d;
|
|
9
9
|
|
|
10
10
|
return _extends({}, state, {
|
|
11
11
|
detailPanel: {
|
|
12
|
+
heightCache: {},
|
|
12
13
|
expandedRowIds: (_ref = (_props$detailPanelExp = props.detailPanelExpandedRowIds) != null ? _props$detailPanelExp : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$d = _props$initialState.detailPanel) == null ? void 0 : _props$initialState$d.expandedRowIds) != null ? _ref : []
|
|
13
14
|
}
|
|
14
15
|
});
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeight) {
|
|
18
|
+
function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeight, previousHeightCache) {
|
|
18
19
|
if (typeof getDetailPanelContent !== 'function') {
|
|
19
20
|
return {};
|
|
20
21
|
} // TODO change to lazy approach using a Proxy
|
|
@@ -28,12 +29,19 @@ function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeig
|
|
|
28
29
|
return acc;
|
|
29
30
|
}, {});
|
|
30
31
|
const heightCache = rowIds.reduce((acc, id) => {
|
|
32
|
+
var _previousHeightCache$;
|
|
33
|
+
|
|
31
34
|
if (contentCache[id] == null) {
|
|
32
35
|
return acc;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
const params = apiRef.current.getRowParams(id);
|
|
36
|
-
|
|
39
|
+
const height = getDetailPanelHeight(params);
|
|
40
|
+
const autoHeight = height === 'auto';
|
|
41
|
+
acc[id] = {
|
|
42
|
+
autoHeight,
|
|
43
|
+
height: autoHeight ? (_previousHeightCache$ = previousHeightCache[id]) == null ? void 0 : _previousHeightCache$.height : height
|
|
44
|
+
};
|
|
37
45
|
return acc;
|
|
38
46
|
}, {});
|
|
39
47
|
return {
|
|
@@ -112,10 +120,36 @@ export const useGridDetailPanel = (apiRef, props) => {
|
|
|
112
120
|
});
|
|
113
121
|
apiRef.current.forceUpdate();
|
|
114
122
|
}, [apiRef]);
|
|
123
|
+
const storeDetailPanelHeight = React.useCallback((id, height) => {
|
|
124
|
+
const heightCache = gridDetailPanelRawHeightCacheSelector(apiRef.current.state);
|
|
125
|
+
|
|
126
|
+
if (!heightCache[id] || heightCache[id].height === height) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
apiRef.current.setState(state => {
|
|
131
|
+
return _extends({}, state, {
|
|
132
|
+
detailPanel: _extends({}, state.detailPanel, {
|
|
133
|
+
heightCache: _extends({}, heightCache, {
|
|
134
|
+
[id]: _extends({}, heightCache[id], {
|
|
135
|
+
height
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
apiRef.current.unstable_requestPipeProcessorsApplication('rowHeight');
|
|
142
|
+
}, [apiRef]);
|
|
143
|
+
const detailPanelHasAutoHeight = React.useCallback(id => {
|
|
144
|
+
const heightCache = gridDetailPanelRawHeightCacheSelector(apiRef.current.state);
|
|
145
|
+
return heightCache[id] ? heightCache[id].autoHeight : false;
|
|
146
|
+
}, [apiRef]);
|
|
115
147
|
const detailPanelApi = {
|
|
116
148
|
toggleDetailPanel,
|
|
117
149
|
getExpandedDetailPanels,
|
|
118
|
-
setExpandedDetailPanels
|
|
150
|
+
setExpandedDetailPanels,
|
|
151
|
+
unstable_storeDetailPanelHeight: storeDetailPanelHeight,
|
|
152
|
+
unstable_detailPanelHasAutoHeight: detailPanelHasAutoHeight
|
|
119
153
|
};
|
|
120
154
|
useGridApiMethod(apiRef, detailPanelApi, 'detailPanelApi');
|
|
121
155
|
React.useEffect(() => {
|
|
@@ -130,7 +164,7 @@ export const useGridDetailPanel = (apiRef, props) => {
|
|
|
130
164
|
const updateCachesAndForceUpdate = React.useCallback(() => {
|
|
131
165
|
apiRef.current.setState(state => {
|
|
132
166
|
return _extends({}, state, {
|
|
133
|
-
detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight))
|
|
167
|
+
detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
|
|
134
168
|
});
|
|
135
169
|
});
|
|
136
170
|
apiRef.current.forceUpdate();
|
|
@@ -145,7 +179,7 @@ export const useGridDetailPanel = (apiRef, props) => {
|
|
|
145
179
|
|
|
146
180
|
apiRef.current.setState(state => {
|
|
147
181
|
return _extends({}, state, {
|
|
148
|
-
detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight))
|
|
182
|
+
detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
|
|
149
183
|
});
|
|
150
184
|
});
|
|
151
185
|
previousGetDetailPanelContentProp.current = props.getDetailPanelContent;
|
|
@@ -161,7 +195,7 @@ export const useGridDetailPanel = (apiRef, props) => {
|
|
|
161
195
|
}
|
|
162
196
|
|
|
163
197
|
updateCachesIfNeeded();
|
|
164
|
-
const heightCache = gridDetailPanelExpandedRowsHeightCacheSelector(apiRef
|
|
198
|
+
const heightCache = gridDetailPanelExpandedRowsHeightCacheSelector(apiRef);
|
|
165
199
|
return _extends({}, initialValue, {
|
|
166
200
|
detail: (_heightCache$row$id = heightCache[row.id]) != null ? _heightCache$row$id : 0 // Fallback to zero because the cache might not be ready yet (e.g. page was changed)
|
|
167
201
|
|