@mui/x-data-grid-pro 5.12.2 → 5.13.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 +160 -6
- package/DataGridPro/DataGridPro.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/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/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/index.js +1 -1
- package/legacy/DataGridPro/DataGridPro.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/hooks/features/detailPanel/gridDetailPanelSelector.js +15 -2
- 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/index.js +1 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridProProps.d.ts +2 -2
- package/modern/DataGridPro/DataGridPro.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/hooks/features/detailPanel/gridDetailPanelSelector.js +9 -1
- 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/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPro/DataGridPro.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/hooks/features/detailPanel/gridDetailPanelSelector.js +12 -2
- 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/index.js +1 -1
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +6 -6
- package/utils/releaseInfo.js +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useGridDetailPanelCache = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _xDataGrid = require("@mui/x-data-grid");
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeight, previousHeightCache) {
|
|
21
|
+
if (typeof getDetailPanelContent !== 'function') {
|
|
22
|
+
return {};
|
|
23
|
+
} // TODO change to lazy approach using a Proxy
|
|
24
|
+
// only call getDetailPanelContent when asked for an id
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const rowIds = (0, _xDataGrid.gridRowIdsSelector)(apiRef);
|
|
28
|
+
const contentCache = rowIds.reduce((acc, id) => {
|
|
29
|
+
const params = apiRef.current.getRowParams(id);
|
|
30
|
+
acc[id] = getDetailPanelContent(params);
|
|
31
|
+
return acc;
|
|
32
|
+
}, {});
|
|
33
|
+
const heightCache = rowIds.reduce((acc, id) => {
|
|
34
|
+
var _previousHeightCache$;
|
|
35
|
+
|
|
36
|
+
if (contentCache[id] == null) {
|
|
37
|
+
return acc;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const params = apiRef.current.getRowParams(id);
|
|
41
|
+
const height = getDetailPanelHeight(params);
|
|
42
|
+
const autoHeight = height === 'auto';
|
|
43
|
+
acc[id] = {
|
|
44
|
+
autoHeight,
|
|
45
|
+
height: !autoHeight ? height : (_previousHeightCache$ = previousHeightCache[id]) == null ? void 0 : _previousHeightCache$.height
|
|
46
|
+
};
|
|
47
|
+
return acc;
|
|
48
|
+
}, {});
|
|
49
|
+
return {
|
|
50
|
+
contentCache,
|
|
51
|
+
heightCache
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const useGridDetailPanelCache = (apiRef, props) => {
|
|
56
|
+
const updateCaches = React.useCallback(() => {
|
|
57
|
+
apiRef.current.setState(state => {
|
|
58
|
+
return (0, _extends2.default)({}, state, {
|
|
59
|
+
detailPanel: (0, _extends2.default)({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
apiRef.current.forceUpdate();
|
|
63
|
+
}, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
|
|
64
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'sortedRowsSet', updateCaches);
|
|
65
|
+
const isFirstRender = React.useRef(true);
|
|
66
|
+
|
|
67
|
+
if (isFirstRender.current) {
|
|
68
|
+
isFirstRender.current = false;
|
|
69
|
+
updateCaches();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
if (isFirstRender.current) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
updateCaches();
|
|
78
|
+
}, [updateCaches]);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.useGridDetailPanelCache = useGridDetailPanelCache;
|
package/node/index.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
|
|
|
8
8
|
var _utils = require("@mui/utils");
|
|
9
9
|
|
|
10
10
|
const getReleaseInfo = () => {
|
|
11
|
-
const releaseInfo = "
|
|
11
|
+
const releaseInfo = "MTY1Nzg1NDAwMDAwMA==";
|
|
12
12
|
|
|
13
13
|
if (process.env.NODE_ENV !== 'production') {
|
|
14
14
|
// A simple hack to set the value in the test environment (has no build step).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-pro",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.13.1",
|
|
4
4
|
"description": "The Pro plan edition of the data grid component (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"directory": "packages/grid/x-data-grid-pro"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@babel/runtime": "^7.
|
|
34
|
+
"@babel/runtime": "^7.18.6",
|
|
35
35
|
"@mui/utils": "^5.4.1",
|
|
36
|
-
"@mui/x-data-grid": "5.
|
|
37
|
-
"@mui/x-license-pro": "5.
|
|
36
|
+
"@mui/x-data-grid": "5.13.1",
|
|
37
|
+
"@mui/x-license-pro": "5.13.1",
|
|
38
38
|
"@types/format-util": "^1.0.2",
|
|
39
|
-
"clsx": "^1.
|
|
39
|
+
"clsx": "^1.2.1",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
|
-
"reselect": "^4.1.
|
|
41
|
+
"reselect": "^4.1.6"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@mui/material": "^5.4.1",
|
package/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY1Nzg1NDAwMDAwMA==";
|
|
4
4
|
|
|
5
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
6
6
|
// A simple hack to set the value in the test environment (has no build step).
|