@mui/x-data-grid 7.8.0 → 7.10.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 +140 -0
- package/DataGrid/DataGrid.js +1 -0
- package/DataGrid/useDataGridProps.js +30 -22
- package/components/GridLoadingOverlay.d.ts +15 -3
- package/components/GridLoadingOverlay.js +48 -4
- package/components/GridRow.js +2 -1
- package/components/GridSkeletonLoadingOverlay.d.ts +3 -0
- package/components/GridSkeletonLoadingOverlay.js +181 -0
- package/components/base/GridOverlays.d.ts +11 -1
- package/components/base/GridOverlays.js +26 -40
- package/components/cell/GridSkeletonCell.d.ts +13 -6
- package/components/cell/GridSkeletonCell.js +61 -19
- package/components/containers/GridRoot.js +4 -16
- package/components/containers/GridRootStyles.js +11 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/components/virtualization/GridMainContainer.js +11 -3
- package/components/virtualization/GridVirtualScroller.js +10 -6
- package/components/virtualization/GridVirtualScrollerFiller.d.ts +5 -1
- package/components/virtualization/GridVirtualScrollerFiller.js +9 -6
- package/constants/gridClasses.d.ts +9 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +11 -0
- package/hooks/features/filter/gridFilterSelector.js +13 -0
- package/hooks/features/overlays/useGridOverlays.d.ts +11 -0
- package/hooks/features/overlays/useGridOverlays.js +35 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +4 -12
- package/hooks/utils/index.d.ts +0 -1
- package/hooks/utils/index.js +0 -1
- package/index.js +1 -1
- package/locales/esES.js +1 -2
- package/models/api/gridRowSelectionApi.d.ts +2 -2
- package/models/colDef/gridColDef.d.ts +4 -4
- package/models/gridRowSelectionModel.d.ts +2 -2
- package/models/gridSlotsComponentsProps.d.ts +2 -1
- package/models/props/DataGridProps.d.ts +5 -4
- package/modern/DataGrid/DataGrid.js +1 -0
- package/modern/DataGrid/useDataGridProps.js +30 -22
- package/modern/components/GridLoadingOverlay.js +48 -4
- package/modern/components/GridRow.js +2 -1
- package/modern/components/GridSkeletonLoadingOverlay.js +181 -0
- package/modern/components/base/GridOverlays.js +26 -40
- package/modern/components/cell/GridSkeletonCell.js +61 -19
- package/modern/components/containers/GridRoot.js +4 -16
- package/modern/components/containers/GridRootStyles.js +11 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/modern/components/virtualization/GridMainContainer.js +11 -3
- package/modern/components/virtualization/GridVirtualScroller.js +10 -6
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +9 -6
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/filter/gridFilterSelector.js +13 -0
- package/modern/hooks/features/overlays/useGridOverlays.js +35 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -12
- package/modern/hooks/utils/index.js +0 -1
- package/modern/index.js +1 -1
- package/modern/locales/esES.js +1 -2
- package/modern/utils/utils.js +10 -2
- package/node/DataGrid/DataGrid.js +1 -0
- package/node/DataGrid/useDataGridProps.js +30 -22
- package/node/components/GridLoadingOverlay.js +48 -4
- package/node/components/GridRow.js +2 -1
- package/node/components/GridSkeletonLoadingOverlay.js +189 -0
- package/node/components/base/GridOverlays.js +26 -40
- package/node/components/cell/GridSkeletonCell.js +60 -18
- package/node/components/containers/GridRoot.js +3 -15
- package/node/components/containers/GridRootStyles.js +11 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/node/components/virtualization/GridMainContainer.js +10 -2
- package/node/components/virtualization/GridVirtualScroller.js +9 -5
- package/node/components/virtualization/GridVirtualScrollerFiller.js +9 -6
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/filter/gridFilterSelector.js +14 -1
- package/node/hooks/features/overlays/useGridOverlays.js +42 -0
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -12
- package/node/hooks/utils/index.js +0 -12
- package/node/index.js +1 -1
- package/node/locales/esES.js +1 -2
- package/node/utils/utils.js +11 -3
- package/package.json +5 -4
- package/utils/utils.d.ts +8 -1
- package/utils/utils.js +10 -2
- package/hooks/utils/useResizeObserver.d.ts +0 -2
- package/hooks/utils/useResizeObserver.js +0 -36
- package/modern/hooks/utils/useResizeObserver.js +0 -36
- package/node/hooks/utils/useResizeObserver.js +0 -44
|
@@ -6,18 +6,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.GridLoadingOverlay = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
10
|
var React = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _LinearProgress = _interopRequireDefault(require("@mui/material/LinearProgress"));
|
|
11
13
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
12
14
|
var _GridOverlay = require("./containers/GridOverlay");
|
|
15
|
+
var _GridSkeletonLoadingOverlay = require("./GridSkeletonLoadingOverlay");
|
|
16
|
+
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
17
|
+
var _hooks = require("../hooks");
|
|
13
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["variant", "noRowsVariant", "style"];
|
|
14
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
const LOADING_VARIANTS = {
|
|
23
|
+
'circular-progress': {
|
|
24
|
+
component: _CircularProgress.default,
|
|
25
|
+
style: {}
|
|
26
|
+
},
|
|
27
|
+
'linear-progress': {
|
|
28
|
+
component: _LinearProgress.default,
|
|
29
|
+
style: {
|
|
30
|
+
display: 'block'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
skeleton: {
|
|
34
|
+
component: _GridSkeletonLoadingOverlay.GridSkeletonLoadingOverlay,
|
|
35
|
+
style: {
|
|
36
|
+
display: 'block'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
16
40
|
const GridLoadingOverlay = exports.GridLoadingOverlay = /*#__PURE__*/React.forwardRef(function GridLoadingOverlay(props, ref) {
|
|
41
|
+
const {
|
|
42
|
+
variant = 'circular-progress',
|
|
43
|
+
noRowsVariant = 'circular-progress',
|
|
44
|
+
style
|
|
45
|
+
} = props,
|
|
46
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
47
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
48
|
+
const rowsCount = (0, _hooks.useGridSelector)(apiRef, _hooks.gridRowCountSelector);
|
|
49
|
+
const activeVariant = LOADING_VARIANTS[rowsCount === 0 ? noRowsVariant : variant];
|
|
17
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridOverlay.GridOverlay, (0, _extends2.default)({
|
|
18
|
-
ref: ref
|
|
19
|
-
|
|
20
|
-
|
|
51
|
+
ref: ref,
|
|
52
|
+
style: (0, _extends2.default)({}, activeVariant.style, style)
|
|
53
|
+
}, other, {
|
|
54
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(activeVariant.component, {})
|
|
21
55
|
}));
|
|
22
56
|
});
|
|
23
57
|
process.env.NODE_ENV !== "production" ? GridLoadingOverlay.propTypes = {
|
|
@@ -25,5 +59,15 @@ process.env.NODE_ENV !== "production" ? GridLoadingOverlay.propTypes = {
|
|
|
25
59
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
26
60
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
27
61
|
// ----------------------------------------------------------------------
|
|
28
|
-
|
|
62
|
+
/**
|
|
63
|
+
* The variant of the overlay when no rows are displayed.
|
|
64
|
+
* @default 'circular-progress'
|
|
65
|
+
*/
|
|
66
|
+
noRowsVariant: _propTypes.default.oneOf(['circular-progress', 'linear-progress', 'skeleton']),
|
|
67
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
68
|
+
/**
|
|
69
|
+
* The variant of the overlay.
|
|
70
|
+
* @default 'circular-progress'
|
|
71
|
+
*/
|
|
72
|
+
variant: _propTypes.default.oneOf(['circular-progress', 'linear-progress', 'skeleton'])
|
|
29
73
|
} : void 0;
|
|
@@ -258,10 +258,11 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
258
258
|
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(_GridCell.gridPinnedColumnPositionLookup[pinnedPosition], column.computedWidth, indexRelativeToAllColumns, columnPositions, dimensions);
|
|
259
259
|
if (rowNode?.type === 'skeletonRow') {
|
|
260
260
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.skeletonCell, {
|
|
261
|
+
type: column.type,
|
|
261
262
|
width: width,
|
|
262
263
|
height: rowHeight,
|
|
263
264
|
field: column.field,
|
|
264
|
-
align: column.align
|
|
265
|
+
align: column.align
|
|
265
266
|
}, column.field);
|
|
266
267
|
}
|
|
267
268
|
const editCellState = editRowsState[rowId]?.[column.field] ?? null;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.GridSkeletonLoadingOverlay = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
+
var _system = require("@mui/system");
|
|
12
|
+
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
13
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
|
+
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
15
|
+
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
16
|
+
var _hooks = require("../hooks");
|
|
17
|
+
var _gridClasses = require("../constants/gridClasses");
|
|
18
|
+
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
19
|
+
var _cellBorderUtils = require("../utils/cellBorderUtils");
|
|
20
|
+
var _domUtils = require("../utils/domUtils");
|
|
21
|
+
var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
+
const SkeletonOverlay = (0, _system.styled)('div', {
|
|
26
|
+
name: 'MuiDataGrid',
|
|
27
|
+
slot: 'SkeletonLoadingOverlay',
|
|
28
|
+
overridesResolver: (props, styles) => styles.skeletonLoadingOverlay
|
|
29
|
+
})({
|
|
30
|
+
minWidth: '100%',
|
|
31
|
+
width: 'max-content',
|
|
32
|
+
// prevents overflow: clip; cutting off the x axis
|
|
33
|
+
height: '100%',
|
|
34
|
+
overflow: 'clip' // y axis is hidden while the x axis is allowed to overflow
|
|
35
|
+
});
|
|
36
|
+
const useUtilityClasses = ownerState => {
|
|
37
|
+
const {
|
|
38
|
+
classes
|
|
39
|
+
} = ownerState;
|
|
40
|
+
const slots = {
|
|
41
|
+
root: ['skeletonLoadingOverlay']
|
|
42
|
+
};
|
|
43
|
+
return (0, _composeClasses.default)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
44
|
+
};
|
|
45
|
+
const getColIndex = el => parseInt(el.getAttribute('data-colindex'), 10);
|
|
46
|
+
const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = /*#__PURE__*/React.forwardRef(function GridSkeletonLoadingOverlay(props, forwardedRef) {
|
|
47
|
+
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
48
|
+
const {
|
|
49
|
+
slots
|
|
50
|
+
} = rootProps;
|
|
51
|
+
const classes = useUtilityClasses({
|
|
52
|
+
classes: rootProps.classes
|
|
53
|
+
});
|
|
54
|
+
const ref = React.useRef(null);
|
|
55
|
+
const handleRef = (0, _useForkRef.default)(ref, forwardedRef);
|
|
56
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
57
|
+
const dimensions = (0, _hooks.useGridSelector)(apiRef, _hooks.gridDimensionsSelector);
|
|
58
|
+
const viewportHeight = dimensions?.viewportInnerSize.height ?? 0;
|
|
59
|
+
const skeletonRowsCount = Math.ceil(viewportHeight / dimensions.rowHeight);
|
|
60
|
+
const totalWidth = (0, _hooks.useGridSelector)(apiRef, _hooks.gridColumnsTotalWidthSelector);
|
|
61
|
+
const positions = (0, _hooks.useGridSelector)(apiRef, _hooks.gridColumnPositionsSelector);
|
|
62
|
+
const inViewportCount = React.useMemo(() => positions.filter(value => value <= totalWidth).length, [totalWidth, positions]);
|
|
63
|
+
const allVisibleColumns = (0, _hooks.useGridSelector)(apiRef, _hooks.gridVisibleColumnDefinitionsSelector);
|
|
64
|
+
const columns = React.useMemo(() => allVisibleColumns.slice(0, inViewportCount), [allVisibleColumns, inViewportCount]);
|
|
65
|
+
const pinnedColumns = (0, _hooks.useGridSelector)(apiRef, _hooks.gridVisiblePinnedColumnDefinitionsSelector);
|
|
66
|
+
const getPinnedStyle = React.useCallback((computedWidth, index, position) => {
|
|
67
|
+
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(position, computedWidth, index, positions, dimensions);
|
|
68
|
+
return {
|
|
69
|
+
[position]: pinnedOffset
|
|
70
|
+
};
|
|
71
|
+
}, [dimensions, positions]);
|
|
72
|
+
const getPinnedPosition = React.useCallback(field => {
|
|
73
|
+
if (pinnedColumns.left.findIndex(col => col.field === field) !== -1) {
|
|
74
|
+
return _hooks.GridPinnedColumnPosition.LEFT;
|
|
75
|
+
}
|
|
76
|
+
if (pinnedColumns.right.findIndex(col => col.field === field) !== -1) {
|
|
77
|
+
return _hooks.GridPinnedColumnPosition.RIGHT;
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}, [pinnedColumns.left, pinnedColumns.right]);
|
|
81
|
+
const children = React.useMemo(() => {
|
|
82
|
+
const array = [];
|
|
83
|
+
for (let i = 0; i < skeletonRowsCount; i += 1) {
|
|
84
|
+
const rowCells = [];
|
|
85
|
+
for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
|
|
86
|
+
const column = columns[colIndex];
|
|
87
|
+
const pinnedPosition = getPinnedPosition(column.field);
|
|
88
|
+
const isPinnedLeft = pinnedPosition === _hooks.GridPinnedColumnPosition.LEFT;
|
|
89
|
+
const isPinnedRight = pinnedPosition === _hooks.GridPinnedColumnPosition.RIGHT;
|
|
90
|
+
const sectionLength = pinnedPosition ? pinnedColumns[pinnedPosition].length // pinned section
|
|
91
|
+
: columns.length - pinnedColumns.left.length - pinnedColumns.right.length; // middle section
|
|
92
|
+
const sectionIndex = pinnedPosition ? pinnedColumns[pinnedPosition].findIndex(col => col.field === column.field) // pinned section
|
|
93
|
+
: colIndex - pinnedColumns.left.length; // middle section
|
|
94
|
+
const pinnedStyle = pinnedPosition && getPinnedStyle(column.computedWidth, colIndex, pinnedPosition);
|
|
95
|
+
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
96
|
+
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
97
|
+
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, sectionIndex);
|
|
98
|
+
const isLastColumn = colIndex === columns.length - 1;
|
|
99
|
+
const isFirstPinnedRight = isPinnedRight && sectionIndex === 0;
|
|
100
|
+
const hasFillerBefore = isFirstPinnedRight && gridHasFiller;
|
|
101
|
+
const hasFillerAfter = isLastColumn && !isFirstPinnedRight && gridHasFiller;
|
|
102
|
+
const expandedWidth = dimensions.viewportOuterSize.width - dimensions.columnsTotalWidth;
|
|
103
|
+
const emptyCellWidth = Math.max(0, expandedWidth);
|
|
104
|
+
const emptyCell = /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.skeletonCell, {
|
|
105
|
+
width: emptyCellWidth,
|
|
106
|
+
empty: true
|
|
107
|
+
}, `skeleton-filler-column-${i}`);
|
|
108
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
109
|
+
const hasScrollbarFiller = isLastColumn && scrollbarWidth !== 0;
|
|
110
|
+
if (hasFillerBefore) {
|
|
111
|
+
rowCells.push(emptyCell);
|
|
112
|
+
}
|
|
113
|
+
rowCells.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.skeletonCell, {
|
|
114
|
+
field: column.field,
|
|
115
|
+
type: column.type,
|
|
116
|
+
align: column.align,
|
|
117
|
+
width: "var(--width)",
|
|
118
|
+
height: dimensions.rowHeight,
|
|
119
|
+
"data-colindex": colIndex,
|
|
120
|
+
className: (0, _clsx.default)(isPinnedLeft && _gridClasses.gridClasses['cell--pinnedLeft'], isPinnedRight && _gridClasses.gridClasses['cell--pinnedRight'], showRightBorder && _gridClasses.gridClasses['cell--withRightBorder'], showLeftBorder && _gridClasses.gridClasses['cell--withLeftBorder']),
|
|
121
|
+
style: (0, _extends2.default)({
|
|
122
|
+
'--width': `${column.computedWidth}px`
|
|
123
|
+
}, pinnedStyle)
|
|
124
|
+
}, `skeleton-column-${i}-${column.field}`));
|
|
125
|
+
if (hasFillerAfter) {
|
|
126
|
+
rowCells.push(emptyCell);
|
|
127
|
+
}
|
|
128
|
+
if (hasScrollbarFiller) {
|
|
129
|
+
rowCells.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridScrollbarFillerCell.GridScrollbarFillerCell, {
|
|
130
|
+
pinnedRight: pinnedColumns.right.length > 0
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
array.push( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
135
|
+
className: (0, _clsx.default)(_gridClasses.gridClasses.row, _gridClasses.gridClasses.rowSkeleton, i === 0 && _gridClasses.gridClasses['row--firstVisible']),
|
|
136
|
+
children: rowCells
|
|
137
|
+
}, `skeleton-row-${i}`));
|
|
138
|
+
}
|
|
139
|
+
return array;
|
|
140
|
+
}, [slots, columns, pinnedColumns, skeletonRowsCount, rootProps.showCellVerticalBorder, dimensions.columnsTotalWidth, dimensions.viewportOuterSize.width, dimensions.rowHeight, dimensions.hasScrollY, dimensions.scrollbarSize, getPinnedPosition, getPinnedStyle]);
|
|
141
|
+
|
|
142
|
+
// Sync the column resize of the overlay columns with the grid
|
|
143
|
+
const handleColumnResize = params => {
|
|
144
|
+
const {
|
|
145
|
+
colDef,
|
|
146
|
+
width
|
|
147
|
+
} = params;
|
|
148
|
+
const cells = ref.current?.querySelectorAll(`[data-field="${(0, _domUtils.escapeOperandAttributeSelector)(colDef.field)}"]`);
|
|
149
|
+
if (!cells) {
|
|
150
|
+
throw new Error('MUI X: Expected skeleton cells to be defined with `data-field` attribute.');
|
|
151
|
+
}
|
|
152
|
+
const resizedColIndex = columns.findIndex(col => col.field === colDef.field);
|
|
153
|
+
const pinnedPosition = getPinnedPosition(colDef.field);
|
|
154
|
+
const isPinnedLeft = pinnedPosition === _hooks.GridPinnedColumnPosition.LEFT;
|
|
155
|
+
const isPinnedRight = pinnedPosition === _hooks.GridPinnedColumnPosition.RIGHT;
|
|
156
|
+
const currentWidth = getComputedStyle(cells[0]).getPropertyValue('--width');
|
|
157
|
+
const delta = parseInt(currentWidth, 10) - width;
|
|
158
|
+
if (cells) {
|
|
159
|
+
cells.forEach(element => {
|
|
160
|
+
element.style.setProperty('--width', `${width}px`);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (isPinnedLeft) {
|
|
164
|
+
const pinnedCells = ref.current?.querySelectorAll(`.${_gridClasses.gridClasses['cell--pinnedLeft']}`);
|
|
165
|
+
pinnedCells?.forEach(element => {
|
|
166
|
+
const colIndex = getColIndex(element);
|
|
167
|
+
if (colIndex > resizedColIndex) {
|
|
168
|
+
element.style.left = `${parseInt(getComputedStyle(element).left, 10) - delta}px`;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (isPinnedRight) {
|
|
173
|
+
const pinnedCells = ref.current?.querySelectorAll(`.${_gridClasses.gridClasses['cell--pinnedRight']}`);
|
|
174
|
+
pinnedCells?.forEach(element => {
|
|
175
|
+
const colIndex = getColIndex(element);
|
|
176
|
+
if (colIndex < resizedColIndex) {
|
|
177
|
+
element.style.right = `${parseInt(getComputedStyle(element).right, 10) + delta}px`;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
(0, _hooks.useGridApiEventHandler)(apiRef, 'columnResize', handleColumnResize);
|
|
183
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SkeletonOverlay, (0, _extends2.default)({
|
|
184
|
+
className: classes.root,
|
|
185
|
+
ref: handleRef
|
|
186
|
+
}, props, {
|
|
187
|
+
children: children
|
|
188
|
+
}));
|
|
189
|
+
});
|
|
@@ -12,8 +12,6 @@ var _system = require("@mui/system");
|
|
|
12
12
|
var _utils = require("@mui/utils");
|
|
13
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
14
|
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
15
|
-
var _gridFilterSelector = require("../../hooks/features/filter/gridFilterSelector");
|
|
16
|
-
var _gridRowsSelector = require("../../hooks/features/rows/gridRowsSelector");
|
|
17
15
|
var _dimensions = require("../../hooks/features/dimensions");
|
|
18
16
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
19
17
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
@@ -26,11 +24,14 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
26
24
|
const GridOverlayWrapperRoot = (0, _system.styled)('div', {
|
|
27
25
|
name: 'MuiDataGrid',
|
|
28
26
|
slot: 'OverlayWrapper',
|
|
29
|
-
shouldForwardProp: prop => prop !== 'overlayType',
|
|
27
|
+
shouldForwardProp: prop => prop !== 'overlayType' && prop !== 'loadingOverlayVariant',
|
|
30
28
|
overridesResolver: (props, styles) => styles.overlayWrapper
|
|
31
29
|
})(({
|
|
32
|
-
overlayType
|
|
33
|
-
|
|
30
|
+
overlayType,
|
|
31
|
+
loadingOverlayVariant
|
|
32
|
+
}) =>
|
|
33
|
+
// Skeleton overlay should flow with the scroll container and not be sticky
|
|
34
|
+
loadingOverlayVariant !== 'skeleton' ? {
|
|
34
35
|
position: 'sticky',
|
|
35
36
|
// To stay in place while scrolling
|
|
36
37
|
top: 'var(--DataGrid-headersTotalHeight)',
|
|
@@ -41,11 +42,11 @@ const GridOverlayWrapperRoot = (0, _system.styled)('div', {
|
|
|
41
42
|
// To stay above the content instead of shifting it down
|
|
42
43
|
zIndex: overlayType === 'loadingOverlay' ? 5 // Should be above pinned columns, pinned rows, and detail panel
|
|
43
44
|
: 4 // Should be above pinned columns and detail panel
|
|
44
|
-
})
|
|
45
|
+
} : {});
|
|
45
46
|
const GridOverlayWrapperInner = (0, _system.styled)('div', {
|
|
46
47
|
name: 'MuiDataGrid',
|
|
47
48
|
slot: 'OverlayWrapperInner',
|
|
48
|
-
shouldForwardProp: prop => prop !== 'overlayType',
|
|
49
|
+
shouldForwardProp: prop => prop !== 'overlayType' && prop !== 'loadingOverlayVariant',
|
|
49
50
|
overridesResolver: (props, styles) => styles.overlayWrapperInner
|
|
50
51
|
})({});
|
|
51
52
|
const useUtilityClasses = ownerState => {
|
|
@@ -63,16 +64,16 @@ function GridOverlayWrapper(props) {
|
|
|
63
64
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
64
65
|
const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, rootProps);
|
|
65
66
|
const dimensions = (0, _useGridSelector.useGridSelector)(apiRef, _dimensions.gridDimensionsSelector);
|
|
66
|
-
let height = dimensions.viewportOuterSize.height - dimensions.
|
|
67
|
+
let height = dimensions.viewportOuterSize.height - dimensions.topContainerHeight - dimensions.bottomContainerHeight - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
|
|
67
68
|
if (rootProps.autoHeight && currentPage.rows.length === 0 || height === 0) {
|
|
68
69
|
height = (0, _gridRowsUtils.getMinimalContentHeight)(apiRef);
|
|
69
70
|
}
|
|
70
71
|
const classes = useUtilityClasses((0, _extends2.default)({}, props, {
|
|
71
72
|
classes: rootProps.classes
|
|
72
73
|
}));
|
|
73
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridOverlayWrapperRoot, {
|
|
74
|
-
className: (0, _clsx.default)(classes.root)
|
|
75
|
-
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridOverlayWrapperRoot, (0, _extends2.default)({
|
|
75
|
+
className: (0, _clsx.default)(classes.root)
|
|
76
|
+
}, props, {
|
|
76
77
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridOverlayWrapperInner, (0, _extends2.default)({
|
|
77
78
|
className: (0, _clsx.default)(classes.inner),
|
|
78
79
|
style: {
|
|
@@ -80,42 +81,27 @@ function GridOverlayWrapper(props) {
|
|
|
80
81
|
width: dimensions.viewportOuterSize.width
|
|
81
82
|
}
|
|
82
83
|
}, props))
|
|
83
|
-
});
|
|
84
|
+
}));
|
|
84
85
|
}
|
|
85
|
-
process.env.NODE_ENV !== "production" ?
|
|
86
|
+
process.env.NODE_ENV !== "production" ? GridOverlays.propTypes = {
|
|
86
87
|
// ----------------------------- Warning --------------------------------
|
|
87
88
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
88
89
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
89
90
|
// ----------------------------------------------------------------------
|
|
90
|
-
|
|
91
|
+
loadingOverlayVariant: _propTypes.default.oneOf(['circular-progress', 'linear-progress', 'skeleton']),
|
|
92
|
+
overlayType: _propTypes.default.oneOf(['loadingOverlay', 'noResultsOverlay', 'noRowsOverlay'])
|
|
91
93
|
} : void 0;
|
|
92
|
-
function GridOverlays() {
|
|
93
|
-
const
|
|
94
|
+
function GridOverlays(props) {
|
|
95
|
+
const {
|
|
96
|
+
overlayType
|
|
97
|
+
} = props;
|
|
94
98
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
95
|
-
|
|
96
|
-
const visibleRowCount = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridExpandedRowCountSelector);
|
|
97
|
-
const loading = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowsLoadingSelector);
|
|
98
|
-
const showNoRowsOverlay = !loading && totalRowCount === 0;
|
|
99
|
-
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
100
|
-
let overlay = null;
|
|
101
|
-
let overlayType = '';
|
|
102
|
-
if (showNoRowsOverlay) {
|
|
103
|
-
overlay = /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.noRowsOverlay, (0, _extends2.default)({}, rootProps.slotProps?.noRowsOverlay));
|
|
104
|
-
overlayType = 'noRowsOverlay';
|
|
105
|
-
}
|
|
106
|
-
if (showNoResultsOverlay) {
|
|
107
|
-
overlay = /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.noResultsOverlay, (0, _extends2.default)({}, rootProps.slotProps?.noResultsOverlay));
|
|
108
|
-
overlayType = 'noResultsOverlay';
|
|
109
|
-
}
|
|
110
|
-
if (loading) {
|
|
111
|
-
overlay = /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.loadingOverlay, (0, _extends2.default)({}, rootProps.slotProps?.loadingOverlay));
|
|
112
|
-
overlayType = 'loadingOverlay';
|
|
113
|
-
}
|
|
114
|
-
if (overlay === null) {
|
|
99
|
+
if (!overlayType) {
|
|
115
100
|
return null;
|
|
116
101
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
102
|
+
const Overlay = rootProps.slots?.[overlayType];
|
|
103
|
+
const overlayProps = rootProps.slotProps?.[overlayType];
|
|
104
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridOverlayWrapper, (0, _extends2.default)({}, props, {
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Overlay, (0, _extends2.default)({}, overlayProps))
|
|
106
|
+
}));
|
|
121
107
|
}
|
|
@@ -11,51 +11,87 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
15
|
var _fastMemo = require("../../utils/fastMemo");
|
|
15
16
|
var _utils2 = require("../../utils/utils");
|
|
16
17
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
17
18
|
var _gridClasses = require("../../constants/gridClasses");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["field", "align", "width", "height"];
|
|
20
|
+
const _excluded = ["field", "type", "align", "width", "height", "empty", "style", "className"];
|
|
20
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
-
const
|
|
23
|
+
const CIRCULAR_CONTENT_SIZE = '1.3em';
|
|
24
|
+
const CONTENT_HEIGHT = '1.2em';
|
|
25
|
+
const DEFAULT_CONTENT_WIDTH_RANGE = [40, 80];
|
|
26
|
+
const CONTENT_WIDTH_RANGE_BY_TYPE = {
|
|
27
|
+
number: [40, 60],
|
|
28
|
+
string: [40, 80],
|
|
29
|
+
date: [40, 60],
|
|
30
|
+
dateTime: [60, 80],
|
|
31
|
+
singleSelect: [40, 80]
|
|
32
|
+
};
|
|
23
33
|
const useUtilityClasses = ownerState => {
|
|
24
34
|
const {
|
|
25
35
|
align,
|
|
26
|
-
classes
|
|
36
|
+
classes,
|
|
37
|
+
empty
|
|
27
38
|
} = ownerState;
|
|
28
39
|
const slots = {
|
|
29
|
-
root: ['cell', 'cellSkeleton', `cell--text${(0, _utils.unstable_capitalize)(align)}`, '
|
|
40
|
+
root: ['cell', 'cellSkeleton', `cell--text${align ? (0, _utils.unstable_capitalize)(align) : 'Left'}`, empty && 'cellEmpty']
|
|
30
41
|
};
|
|
31
42
|
return (0, _utils.unstable_composeClasses)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
32
43
|
};
|
|
44
|
+
const randomNumberGenerator = (0, _utils2.createRandomNumberGenerator)(12345);
|
|
33
45
|
function GridSkeletonCell(props) {
|
|
34
46
|
const {
|
|
47
|
+
field,
|
|
48
|
+
type,
|
|
35
49
|
align,
|
|
36
50
|
width,
|
|
37
|
-
height
|
|
51
|
+
height,
|
|
52
|
+
empty = false,
|
|
53
|
+
style,
|
|
54
|
+
className
|
|
38
55
|
} = props,
|
|
39
56
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
40
57
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
41
58
|
const ownerState = {
|
|
42
59
|
classes: rootProps.classes,
|
|
43
|
-
align
|
|
60
|
+
align,
|
|
61
|
+
empty
|
|
44
62
|
};
|
|
45
63
|
const classes = useUtilityClasses(ownerState);
|
|
46
|
-
|
|
64
|
+
|
|
65
|
+
// Memo prevents the non-circular skeleton widths changing to random widths on every render
|
|
66
|
+
const skeletonProps = React.useMemo(() => {
|
|
67
|
+
const isCircularContent = type === 'boolean' || type === 'actions';
|
|
68
|
+
if (isCircularContent) {
|
|
69
|
+
return {
|
|
70
|
+
variant: 'circular',
|
|
71
|
+
width: CIRCULAR_CONTENT_SIZE,
|
|
72
|
+
height: CIRCULAR_CONTENT_SIZE
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// The width of the skeleton is a random number between the min and max values
|
|
77
|
+
// The min and max values are determined by the type of the column
|
|
78
|
+
const [min, max] = type ? CONTENT_WIDTH_RANGE_BY_TYPE[type] ?? DEFAULT_CONTENT_WIDTH_RANGE : DEFAULT_CONTENT_WIDTH_RANGE;
|
|
79
|
+
return {
|
|
80
|
+
variant: 'text',
|
|
81
|
+
width: `${Math.round(randomNumberGenerator(min, max))}%`,
|
|
82
|
+
height: CONTENT_HEIGHT
|
|
83
|
+
};
|
|
84
|
+
}, [type]);
|
|
47
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _extends2.default)({
|
|
48
|
-
|
|
49
|
-
|
|
86
|
+
"data-field": field,
|
|
87
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
88
|
+
style: (0, _extends2.default)({
|
|
50
89
|
height,
|
|
51
90
|
maxWidth: width,
|
|
52
91
|
minWidth: width
|
|
53
|
-
}
|
|
92
|
+
}, style)
|
|
54
93
|
}, other, {
|
|
55
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.default, {
|
|
56
|
-
width: `${contentWidth}%`,
|
|
57
|
-
height: 25
|
|
58
|
-
})
|
|
94
|
+
children: !empty && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.default, (0, _extends2.default)({}, skeletonProps))
|
|
59
95
|
}));
|
|
60
96
|
}
|
|
61
97
|
process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
|
|
@@ -63,9 +99,15 @@ process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
|
|
|
63
99
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
100
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
65
101
|
// ----------------------------------------------------------------------
|
|
66
|
-
align: _propTypes.default.string
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
102
|
+
align: _propTypes.default.string,
|
|
103
|
+
/**
|
|
104
|
+
* If `true`, the cell will not display the skeleton but still reserve the cell space.
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
empty: _propTypes.default.bool,
|
|
108
|
+
field: _propTypes.default.string,
|
|
109
|
+
height: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
|
|
110
|
+
type: _propTypes.default.oneOf(['actions', 'boolean', 'custom', 'date', 'dateTime', 'number', 'singleSelect', 'string']),
|
|
111
|
+
width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
70
112
|
} : void 0;
|
|
71
113
|
const Memoized = exports.GridSkeletonCell = (0, _fastMemo.fastMemo)(GridSkeletonCell);
|
|
@@ -11,7 +11,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
|
-
var _system = require("@mui/system");
|
|
15
14
|
var _GridRootStyles = require("./GridRootStyles");
|
|
16
15
|
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
17
16
|
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
@@ -19,7 +18,7 @@ var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
|
19
18
|
var _gridClasses = require("../../constants/gridClasses");
|
|
20
19
|
var _densitySelector = require("../../hooks/features/density/densitySelector");
|
|
21
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _excluded = ["
|
|
21
|
+
const _excluded = ["className"];
|
|
23
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
24
|
const useUtilityClasses = ownerState => {
|
|
@@ -34,15 +33,9 @@ const useUtilityClasses = ownerState => {
|
|
|
34
33
|
};
|
|
35
34
|
return (0, _utils.unstable_composeClasses)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
36
35
|
};
|
|
37
|
-
const GridPanelAnchor = (0, _system.styled)('div')({
|
|
38
|
-
position: 'absolute',
|
|
39
|
-
top: `var(--DataGrid-headersTotalHeight)`,
|
|
40
|
-
left: 0
|
|
41
|
-
});
|
|
42
36
|
const GridRoot = exports.GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
43
37
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
44
38
|
const {
|
|
45
|
-
children,
|
|
46
39
|
className
|
|
47
40
|
} = props,
|
|
48
41
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
@@ -63,16 +56,11 @@ const GridRoot = exports.GridRoot = /*#__PURE__*/React.forwardRef(function GridR
|
|
|
63
56
|
if (!mountedState) {
|
|
64
57
|
return null;
|
|
65
58
|
}
|
|
66
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridRootStyles.GridRootStyles, (0, _extends2.default)({
|
|
67
60
|
ref: handleRef,
|
|
68
61
|
className: (0, _clsx.default)(className, classes.root),
|
|
69
62
|
ownerState: ownerState
|
|
70
|
-
}, other
|
|
71
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelAnchor, {
|
|
72
|
-
role: "presentation",
|
|
73
|
-
"data-id": "gridPanelAnchor"
|
|
74
|
-
}), children]
|
|
75
|
-
}));
|
|
63
|
+
}, other));
|
|
76
64
|
});
|
|
77
65
|
process.env.NODE_ENV !== "production" ? GridRoot.propTypes = {
|
|
78
66
|
// ----------------------------- Warning --------------------------------
|
|
@@ -168,7 +168,7 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
168
168
|
const selectedOpacity = (t.vars || t).palette.action.selectedOpacity;
|
|
169
169
|
const selectedBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / ${selectedOpacity})` : (0, _styles.alpha)(t.palette.primary.main, selectedOpacity);
|
|
170
170
|
const selectedHoverBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / calc(
|
|
171
|
-
${t.vars.palette.action.selectedOpacity} +
|
|
171
|
+
${t.vars.palette.action.selectedOpacity} +
|
|
172
172
|
${t.vars.palette.action.hoverOpacity}
|
|
173
173
|
))` : (0, _styles.alpha)(t.palette.primary.main, t.palette.action.selectedOpacity + t.palette.action.hoverOpacity);
|
|
174
174
|
const pinnedHoverBackground = t.vars ? hoverColor : blend(pinnedBackground, hoverColor, hoverOpacity);
|
|
@@ -432,6 +432,9 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
432
432
|
backgroundColor: 'transparent'
|
|
433
433
|
}
|
|
434
434
|
},
|
|
435
|
+
[`&.${_gridClasses.gridClasses.rowSkeleton}:hover`]: {
|
|
436
|
+
backgroundColor: 'transparent'
|
|
437
|
+
},
|
|
435
438
|
'&.Mui-selected': selectedStyles
|
|
436
439
|
},
|
|
437
440
|
[`& .${_gridClasses.gridClasses['container--top']}, & .${_gridClasses.gridClasses['container--bottom']}`]: {
|
|
@@ -638,7 +641,7 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
638
641
|
minWidth: 'calc(var(--DataGrid-hasScrollY) * var(--DataGrid-scrollbarSize))',
|
|
639
642
|
alignSelf: 'stretch',
|
|
640
643
|
[`&.${_gridClasses.gridClasses['scrollbarFiller--borderTop']}`]: {
|
|
641
|
-
borderTop: '1px solid var(--
|
|
644
|
+
borderTop: '1px solid var(--rowBorderColor)'
|
|
642
645
|
},
|
|
643
646
|
[`&.${_gridClasses.gridClasses['scrollbarFiller--pinnedRight']}`]: {
|
|
644
647
|
backgroundColor: 'var(--DataGrid-pinnedBackground)',
|
|
@@ -651,6 +654,12 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
651
654
|
},
|
|
652
655
|
[`& .${_gridClasses.gridClasses['filler--borderTop']}`]: {
|
|
653
656
|
borderTop: '1px solid var(--DataGrid-rowBorderColor)'
|
|
657
|
+
},
|
|
658
|
+
/* Hide grid rows and vertical scrollbar when skeleton overlay is visible */
|
|
659
|
+
[`& .${_gridClasses.gridClasses['main--hasSkeletonLoadingOverlay']}`]: {
|
|
660
|
+
[`& .${_gridClasses.gridClasses.virtualScrollerContent}, & .${_gridClasses.gridClasses['scrollbar--vertical']}, & .${_gridClasses.gridClasses.pinnedRows}`]: {
|
|
661
|
+
display: 'none'
|
|
662
|
+
}
|
|
654
663
|
}
|
|
655
664
|
});
|
|
656
665
|
return gridStyle;
|
|
@@ -13,6 +13,11 @@ var _useGridAriaAttributes = require("../../hooks/utils/useGridAriaAttributes");
|
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
const GridPanelAnchor = (0, _system.styled)('div')({
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
top: `var(--DataGrid-headersTotalHeight)`,
|
|
19
|
+
left: 0
|
|
20
|
+
});
|
|
16
21
|
const Element = (0, _system.styled)('div', {
|
|
17
22
|
name: 'MuiDataGrid',
|
|
18
23
|
slot: 'Main',
|
|
@@ -25,12 +30,15 @@ const Element = (0, _system.styled)('div', {
|
|
|
25
30
|
const GridMainContainer = exports.GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
26
31
|
const ariaAttributes = (0, _useGridAriaAttributes.useGridAriaAttributes)();
|
|
27
32
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
28
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Element, (0, _extends2.default)({
|
|
29
34
|
ref: ref,
|
|
30
35
|
ownerState: rootProps,
|
|
31
36
|
className: props.className,
|
|
32
37
|
tabIndex: -1
|
|
33
38
|
}, ariaAttributes, {
|
|
34
|
-
children:
|
|
39
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelAnchor, {
|
|
40
|
+
role: "presentation",
|
|
41
|
+
"data-id": "gridPanelAnchor"
|
|
42
|
+
}), props.children]
|
|
35
43
|
}));
|
|
36
44
|
});
|