@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
|
@@ -1,52 +1,88 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["field", "align", "width", "height"];
|
|
3
|
+
const _excluded = ["field", "type", "align", "width", "height", "empty", "style", "className"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Skeleton from '@mui/material/Skeleton';
|
|
7
7
|
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import { fastMemo } from '../../utils/fastMemo';
|
|
9
|
-
import {
|
|
10
|
+
import { createRandomNumberGenerator } from '../../utils/utils';
|
|
10
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
12
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const
|
|
14
|
+
const CIRCULAR_CONTENT_SIZE = '1.3em';
|
|
15
|
+
const CONTENT_HEIGHT = '1.2em';
|
|
16
|
+
const DEFAULT_CONTENT_WIDTH_RANGE = [40, 80];
|
|
17
|
+
const CONTENT_WIDTH_RANGE_BY_TYPE = {
|
|
18
|
+
number: [40, 60],
|
|
19
|
+
string: [40, 80],
|
|
20
|
+
date: [40, 60],
|
|
21
|
+
dateTime: [60, 80],
|
|
22
|
+
singleSelect: [40, 80]
|
|
23
|
+
};
|
|
14
24
|
const useUtilityClasses = ownerState => {
|
|
15
25
|
const {
|
|
16
26
|
align,
|
|
17
|
-
classes
|
|
27
|
+
classes,
|
|
28
|
+
empty
|
|
18
29
|
} = ownerState;
|
|
19
30
|
const slots = {
|
|
20
|
-
root: ['cell', 'cellSkeleton', `cell--text${capitalize(align)}`, '
|
|
31
|
+
root: ['cell', 'cellSkeleton', `cell--text${align ? capitalize(align) : 'Left'}`, empty && 'cellEmpty']
|
|
21
32
|
};
|
|
22
33
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
23
34
|
};
|
|
35
|
+
const randomNumberGenerator = createRandomNumberGenerator(12345);
|
|
24
36
|
function GridSkeletonCell(props) {
|
|
25
37
|
const {
|
|
38
|
+
field,
|
|
39
|
+
type,
|
|
26
40
|
align,
|
|
27
41
|
width,
|
|
28
|
-
height
|
|
42
|
+
height,
|
|
43
|
+
empty = false,
|
|
44
|
+
style,
|
|
45
|
+
className
|
|
29
46
|
} = props,
|
|
30
47
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
48
|
const rootProps = useGridRootProps();
|
|
32
49
|
const ownerState = {
|
|
33
50
|
classes: rootProps.classes,
|
|
34
|
-
align
|
|
51
|
+
align,
|
|
52
|
+
empty
|
|
35
53
|
};
|
|
36
54
|
const classes = useUtilityClasses(ownerState);
|
|
37
|
-
|
|
55
|
+
|
|
56
|
+
// Memo prevents the non-circular skeleton widths changing to random widths on every render
|
|
57
|
+
const skeletonProps = React.useMemo(() => {
|
|
58
|
+
const isCircularContent = type === 'boolean' || type === 'actions';
|
|
59
|
+
if (isCircularContent) {
|
|
60
|
+
return {
|
|
61
|
+
variant: 'circular',
|
|
62
|
+
width: CIRCULAR_CONTENT_SIZE,
|
|
63
|
+
height: CIRCULAR_CONTENT_SIZE
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// The width of the skeleton is a random number between the min and max values
|
|
68
|
+
// The min and max values are determined by the type of the column
|
|
69
|
+
const [min, max] = type ? CONTENT_WIDTH_RANGE_BY_TYPE[type] ?? DEFAULT_CONTENT_WIDTH_RANGE : DEFAULT_CONTENT_WIDTH_RANGE;
|
|
70
|
+
return {
|
|
71
|
+
variant: 'text',
|
|
72
|
+
width: `${Math.round(randomNumberGenerator(min, max))}%`,
|
|
73
|
+
height: CONTENT_HEIGHT
|
|
74
|
+
};
|
|
75
|
+
}, [type]);
|
|
38
76
|
return /*#__PURE__*/_jsx("div", _extends({
|
|
39
|
-
|
|
40
|
-
|
|
77
|
+
"data-field": field,
|
|
78
|
+
className: clsx(classes.root, className),
|
|
79
|
+
style: _extends({
|
|
41
80
|
height,
|
|
42
81
|
maxWidth: width,
|
|
43
82
|
minWidth: width
|
|
44
|
-
}
|
|
83
|
+
}, style)
|
|
45
84
|
}, other, {
|
|
46
|
-
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
47
|
-
width: `${contentWidth}%`,
|
|
48
|
-
height: 25
|
|
49
|
-
})
|
|
85
|
+
children: !empty && /*#__PURE__*/_jsx(Skeleton, _extends({}, skeletonProps))
|
|
50
86
|
}));
|
|
51
87
|
}
|
|
52
88
|
process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
|
|
@@ -54,10 +90,16 @@ process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
|
|
|
54
90
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
55
91
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
56
92
|
// ----------------------------------------------------------------------
|
|
57
|
-
align: PropTypes.string
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
93
|
+
align: PropTypes.string,
|
|
94
|
+
/**
|
|
95
|
+
* If `true`, the cell will not display the skeleton but still reserve the cell space.
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
empty: PropTypes.bool,
|
|
99
|
+
field: PropTypes.string,
|
|
100
|
+
height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
101
|
+
type: PropTypes.oneOf(['actions', 'boolean', 'custom', 'date', 'dateTime', 'number', 'singleSelect', 'string']),
|
|
102
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
61
103
|
} : void 0;
|
|
62
104
|
const Memoized = fastMemo(GridSkeletonCell);
|
|
63
105
|
export { Memoized as GridSkeletonCell };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["className"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect, unstable_capitalize as capitalize, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
|
-
import { styled } from '@mui/system';
|
|
9
8
|
import { GridRootStyles } from './GridRootStyles';
|
|
10
9
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
11
10
|
import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
|
|
12
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
12
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
14
13
|
import { gridDensitySelector } from '../../hooks/features/density/densitySelector';
|
|
15
|
-
import { jsx as _jsx
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
const useUtilityClasses = ownerState => {
|
|
17
16
|
const {
|
|
18
17
|
autoHeight,
|
|
@@ -25,15 +24,9 @@ const useUtilityClasses = ownerState => {
|
|
|
25
24
|
};
|
|
26
25
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
27
26
|
};
|
|
28
|
-
const GridPanelAnchor = styled('div')({
|
|
29
|
-
position: 'absolute',
|
|
30
|
-
top: `var(--DataGrid-headersTotalHeight)`,
|
|
31
|
-
left: 0
|
|
32
|
-
});
|
|
33
27
|
const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
34
28
|
const rootProps = useGridRootProps();
|
|
35
29
|
const {
|
|
36
|
-
children,
|
|
37
30
|
className
|
|
38
31
|
} = props,
|
|
39
32
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
@@ -54,16 +47,11 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
54
47
|
if (!mountedState) {
|
|
55
48
|
return null;
|
|
56
49
|
}
|
|
57
|
-
return /*#__PURE__*/
|
|
50
|
+
return /*#__PURE__*/_jsx(GridRootStyles, _extends({
|
|
58
51
|
ref: handleRef,
|
|
59
52
|
className: clsx(className, classes.root),
|
|
60
53
|
ownerState: ownerState
|
|
61
|
-
}, other
|
|
62
|
-
children: [/*#__PURE__*/_jsx(GridPanelAnchor, {
|
|
63
|
-
role: "presentation",
|
|
64
|
-
"data-id": "gridPanelAnchor"
|
|
65
|
-
}), children]
|
|
66
|
-
}));
|
|
54
|
+
}, other));
|
|
67
55
|
});
|
|
68
56
|
process.env.NODE_ENV !== "production" ? GridRoot.propTypes = {
|
|
69
57
|
// ----------------------------- Warning --------------------------------
|
|
@@ -161,7 +161,7 @@ export const GridRootStyles = styled('div', {
|
|
|
161
161
|
const selectedOpacity = (t.vars || t).palette.action.selectedOpacity;
|
|
162
162
|
const selectedBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / ${selectedOpacity})` : alpha(t.palette.primary.main, selectedOpacity);
|
|
163
163
|
const selectedHoverBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / calc(
|
|
164
|
-
${t.vars.palette.action.selectedOpacity} +
|
|
164
|
+
${t.vars.palette.action.selectedOpacity} +
|
|
165
165
|
${t.vars.palette.action.hoverOpacity}
|
|
166
166
|
))` : alpha(t.palette.primary.main, t.palette.action.selectedOpacity + t.palette.action.hoverOpacity);
|
|
167
167
|
const pinnedHoverBackground = t.vars ? hoverColor : blend(pinnedBackground, hoverColor, hoverOpacity);
|
|
@@ -425,6 +425,9 @@ export const GridRootStyles = styled('div', {
|
|
|
425
425
|
backgroundColor: 'transparent'
|
|
426
426
|
}
|
|
427
427
|
},
|
|
428
|
+
[`&.${c.rowSkeleton}:hover`]: {
|
|
429
|
+
backgroundColor: 'transparent'
|
|
430
|
+
},
|
|
428
431
|
'&.Mui-selected': selectedStyles
|
|
429
432
|
},
|
|
430
433
|
[`& .${c['container--top']}, & .${c['container--bottom']}`]: {
|
|
@@ -631,7 +634,7 @@ export const GridRootStyles = styled('div', {
|
|
|
631
634
|
minWidth: 'calc(var(--DataGrid-hasScrollY) * var(--DataGrid-scrollbarSize))',
|
|
632
635
|
alignSelf: 'stretch',
|
|
633
636
|
[`&.${c['scrollbarFiller--borderTop']}`]: {
|
|
634
|
-
borderTop: '1px solid var(--
|
|
637
|
+
borderTop: '1px solid var(--rowBorderColor)'
|
|
635
638
|
},
|
|
636
639
|
[`&.${c['scrollbarFiller--pinnedRight']}`]: {
|
|
637
640
|
backgroundColor: 'var(--DataGrid-pinnedBackground)',
|
|
@@ -644,6 +647,12 @@ export const GridRootStyles = styled('div', {
|
|
|
644
647
|
},
|
|
645
648
|
[`& .${c['filler--borderTop']}`]: {
|
|
646
649
|
borderTop: '1px solid var(--DataGrid-rowBorderColor)'
|
|
650
|
+
},
|
|
651
|
+
/* Hide grid rows and vertical scrollbar when skeleton overlay is visible */
|
|
652
|
+
[`& .${c['main--hasSkeletonLoadingOverlay']}`]: {
|
|
653
|
+
[`& .${c.virtualScrollerContent}, & .${c['scrollbar--vertical']}, & .${c.pinnedRows}`]: {
|
|
654
|
+
display: 'none'
|
|
655
|
+
}
|
|
647
656
|
}
|
|
648
657
|
});
|
|
649
658
|
return gridStyle;
|
|
@@ -3,7 +3,12 @@ import * as React from 'react';
|
|
|
3
3
|
import { styled } from '@mui/system';
|
|
4
4
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
5
5
|
import { useGridAriaAttributes } from '../../hooks/utils/useGridAriaAttributes';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const GridPanelAnchor = styled('div')({
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
top: `var(--DataGrid-headersTotalHeight)`,
|
|
10
|
+
left: 0
|
|
11
|
+
});
|
|
7
12
|
const Element = styled('div', {
|
|
8
13
|
name: 'MuiDataGrid',
|
|
9
14
|
slot: 'Main',
|
|
@@ -16,12 +21,15 @@ const Element = styled('div', {
|
|
|
16
21
|
export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
17
22
|
const ariaAttributes = useGridAriaAttributes();
|
|
18
23
|
const rootProps = useGridRootProps();
|
|
19
|
-
return /*#__PURE__*/
|
|
24
|
+
return /*#__PURE__*/_jsxs(Element, _extends({
|
|
20
25
|
ref: ref,
|
|
21
26
|
ownerState: rootProps,
|
|
22
27
|
className: props.className,
|
|
23
28
|
tabIndex: -1
|
|
24
29
|
}, ariaAttributes, {
|
|
25
|
-
children:
|
|
30
|
+
children: [/*#__PURE__*/_jsx(GridPanelAnchor, {
|
|
31
|
+
role: "presentation",
|
|
32
|
+
"data-id": "gridPanelAnchor"
|
|
33
|
+
}), props.children]
|
|
26
34
|
}));
|
|
27
35
|
});
|
|
@@ -9,7 +9,8 @@ import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
|
9
9
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
10
|
import { gridDimensionsSelector } from '../../hooks/features/dimensions';
|
|
11
11
|
import { useGridVirtualScroller } from '../../hooks/features/virtualization/useGridVirtualScroller';
|
|
12
|
-
import {
|
|
12
|
+
import { useGridOverlays } from '../../hooks/features/overlays/useGridOverlays';
|
|
13
|
+
import { GridOverlays as Overlays } from '../base/GridOverlays';
|
|
13
14
|
import { GridHeaders } from '../GridHeaders';
|
|
14
15
|
import { GridMainContainer as Container } from './GridMainContainer';
|
|
15
16
|
import { GridTopContainer as TopContainer } from './GridTopContainer';
|
|
@@ -19,12 +20,12 @@ import { GridVirtualScrollerFiller as SpaceFiller } from './GridVirtualScrollerF
|
|
|
19
20
|
import { GridVirtualScrollerRenderZone as RenderZone } from './GridVirtualScrollerRenderZone';
|
|
20
21
|
import { GridVirtualScrollbar as Scrollbar } from './GridVirtualScrollbar';
|
|
21
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
const useUtilityClasses = (ownerState, dimensions) => {
|
|
23
|
+
const useUtilityClasses = (ownerState, dimensions, loadingOverlayVariant) => {
|
|
23
24
|
const {
|
|
24
25
|
classes
|
|
25
26
|
} = ownerState;
|
|
26
27
|
const slots = {
|
|
27
|
-
root: ['main', dimensions.rightPinnedWidth > 0 && 'main--hasPinnedRight'],
|
|
28
|
+
root: ['main', dimensions.rightPinnedWidth > 0 && 'main--hasPinnedRight', loadingOverlayVariant === 'skeleton' && 'main--hasSkeletonLoadingOverlay'],
|
|
28
29
|
scroller: ['virtualScroller']
|
|
29
30
|
};
|
|
30
31
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
@@ -51,7 +52,8 @@ function GridVirtualScroller(props) {
|
|
|
51
52
|
const apiRef = useGridApiContext();
|
|
52
53
|
const rootProps = useGridRootProps();
|
|
53
54
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
54
|
-
const
|
|
55
|
+
const overlaysProps = useGridOverlays();
|
|
56
|
+
const classes = useUtilityClasses(rootProps, dimensions, overlaysProps.loadingOverlayVariant);
|
|
55
57
|
const virtualScroller = useGridVirtualScroller();
|
|
56
58
|
const {
|
|
57
59
|
getContainerProps,
|
|
@@ -79,13 +81,15 @@ function GridVirtualScroller(props) {
|
|
|
79
81
|
position: "top",
|
|
80
82
|
virtualScroller: virtualScroller
|
|
81
83
|
})]
|
|
82
|
-
}), /*#__PURE__*/_jsx(
|
|
84
|
+
}), /*#__PURE__*/_jsx(Overlays, _extends({}, overlaysProps)), /*#__PURE__*/_jsx(Content, _extends({}, getContentProps(), {
|
|
83
85
|
children: /*#__PURE__*/_jsxs(RenderZone, _extends({}, getRenderZoneProps(), {
|
|
84
86
|
children: [rows, /*#__PURE__*/_jsx(rootProps.slots.detailPanels, {
|
|
85
87
|
virtualScroller: virtualScroller
|
|
86
88
|
})]
|
|
87
89
|
}))
|
|
88
|
-
})),
|
|
90
|
+
})), /*#__PURE__*/_jsx(SpaceFiller, {
|
|
91
|
+
rowsLength: rows.length
|
|
92
|
+
}), /*#__PURE__*/_jsx(BottomContainer, {
|
|
89
93
|
children: /*#__PURE__*/_jsx(rootProps.slots.pinnedRows, {
|
|
90
94
|
position: "bottom",
|
|
91
95
|
virtualScroller: virtualScroller
|
|
@@ -16,22 +16,24 @@ const Pinned = styled('div')({
|
|
|
16
16
|
position: 'sticky',
|
|
17
17
|
height: '100%',
|
|
18
18
|
boxSizing: 'border-box',
|
|
19
|
-
borderTop: '1px solid var(--
|
|
19
|
+
borderTop: '1px solid var(--rowBorderColor)',
|
|
20
20
|
backgroundColor: 'var(--DataGrid-pinnedBackground)'
|
|
21
21
|
});
|
|
22
22
|
const PinnedLeft = styled(Pinned)({
|
|
23
23
|
left: 0,
|
|
24
|
-
borderRight: '1px solid var(--
|
|
24
|
+
borderRight: '1px solid var(--rowBorderColor)'
|
|
25
25
|
});
|
|
26
26
|
const PinnedRight = styled(Pinned)({
|
|
27
27
|
right: 0,
|
|
28
|
-
borderLeft: '1px solid var(--
|
|
28
|
+
borderLeft: '1px solid var(--rowBorderColor)'
|
|
29
29
|
});
|
|
30
30
|
const Main = styled('div')({
|
|
31
31
|
flexGrow: 1,
|
|
32
|
-
borderTop: '1px solid var(--
|
|
32
|
+
borderTop: '1px solid var(--rowBorderColor)'
|
|
33
33
|
});
|
|
34
|
-
function GridVirtualScrollerFiller(
|
|
34
|
+
function GridVirtualScrollerFiller({
|
|
35
|
+
rowsLength
|
|
36
|
+
}) {
|
|
35
37
|
const apiRef = useGridApiContext();
|
|
36
38
|
const {
|
|
37
39
|
viewportOuterSize,
|
|
@@ -52,7 +54,8 @@ function GridVirtualScrollerFiller() {
|
|
|
52
54
|
className: gridClasses.filler,
|
|
53
55
|
role: "presentation",
|
|
54
56
|
style: {
|
|
55
|
-
height
|
|
57
|
+
height,
|
|
58
|
+
'--rowBorderColor': rowsLength === 0 ? 'transparent' : 'var(--DataGrid-rowBorderColor)'
|
|
56
59
|
},
|
|
57
60
|
children: [leftPinnedWidth > 0 && /*#__PURE__*/_jsx(PinnedLeft, {
|
|
58
61
|
className: gridClasses['filler--pinnedLeft'],
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderTop', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderTop', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -89,6 +89,19 @@ export const gridExpandedRowCountSelector = createSelector(gridExpandedSortedRow
|
|
|
89
89
|
*/
|
|
90
90
|
export const gridFilteredTopLevelRowCountSelector = createSelector(gridFilteredSortedTopLevelRowEntriesSelector, visibleSortedTopLevelRows => visibleSortedTopLevelRows.length);
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Get the amount of rows accessible after the filtering process.
|
|
94
|
+
* Includes top level and descendant rows.
|
|
95
|
+
* @category Filtering
|
|
96
|
+
*/
|
|
97
|
+
export const gridFilteredRowCountSelector = createSelector(gridFilteredSortedRowEntriesSelector, filteredSortedRowEntries => filteredSortedRowEntries.length);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Get the amount of descendant rows accessible after the filtering process.
|
|
101
|
+
* @category Filtering
|
|
102
|
+
*/
|
|
103
|
+
export const gridFilteredDescendantRowCountSelector = createSelector(gridFilteredRowCountSelector, gridFilteredTopLevelRowCountSelector, (totalRowCount, topLevelRowCount) => totalRowCount - topLevelRowCount);
|
|
104
|
+
|
|
92
105
|
/**
|
|
93
106
|
* @category Filtering
|
|
94
107
|
* @ignore - do not document.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useGridSelector } from '../../utils';
|
|
2
|
+
import { useGridApiContext } from '../../utils/useGridApiContext';
|
|
3
|
+
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
4
|
+
import { gridExpandedRowCountSelector } from '../filter';
|
|
5
|
+
import { gridRowCountSelector, gridRowsLoadingSelector } from '../rows';
|
|
6
|
+
/**
|
|
7
|
+
* Uses the grid state to determine which overlay to display.
|
|
8
|
+
* Returns the active overlay type and the active loading overlay variant.
|
|
9
|
+
*/
|
|
10
|
+
export const useGridOverlays = () => {
|
|
11
|
+
const apiRef = useGridApiContext();
|
|
12
|
+
const rootProps = useGridRootProps();
|
|
13
|
+
const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
14
|
+
const visibleRowCount = useGridSelector(apiRef, gridExpandedRowCountSelector);
|
|
15
|
+
const noRows = totalRowCount === 0;
|
|
16
|
+
const loading = useGridSelector(apiRef, gridRowsLoadingSelector);
|
|
17
|
+
const showNoRowsOverlay = !loading && noRows;
|
|
18
|
+
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
19
|
+
let overlayType = null;
|
|
20
|
+
let loadingOverlayVariant = null;
|
|
21
|
+
if (showNoRowsOverlay) {
|
|
22
|
+
overlayType = 'noRowsOverlay';
|
|
23
|
+
}
|
|
24
|
+
if (showNoResultsOverlay) {
|
|
25
|
+
overlayType = 'noResultsOverlay';
|
|
26
|
+
}
|
|
27
|
+
if (loading) {
|
|
28
|
+
overlayType = 'loadingOverlay';
|
|
29
|
+
loadingOverlayVariant = rootProps.slotProps?.loadingOverlay?.[noRows ? 'noRowsVariant' : 'variant'] || null;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
overlayType,
|
|
33
|
+
loadingOverlayVariant
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -4,11 +4,11 @@ import * as ReactDOM from 'react-dom';
|
|
|
4
4
|
import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
5
5
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
6
6
|
import useTimeout from '@mui/utils/useTimeout';
|
|
7
|
+
import { useResizeObserver } from '@mui/x-internals/useResizeObserver';
|
|
7
8
|
import { useTheme } from '@mui/material/styles';
|
|
8
9
|
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
9
10
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
10
11
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
11
|
-
import { useResizeObserver } from '../../utils/useResizeObserver';
|
|
12
12
|
import { useRunOnce } from '../../utils/useRunOnce';
|
|
13
13
|
import { gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridHasColSpanSelector } from '../columns/gridColumnsSelector';
|
|
14
14
|
import { gridDimensionsSelector } from '../dimensions/gridDimensionsSelectors';
|
|
@@ -361,20 +361,12 @@ export const useGridVirtualScroller = () => {
|
|
|
361
361
|
overflowY: rootProps.autoHeight ? 'hidden' : undefined
|
|
362
362
|
}), [needsHorizontalScrollbar, rootProps.autoHeight]);
|
|
363
363
|
const contentSize = React.useMemo(() => {
|
|
364
|
-
// In cases where the columns exceed the available width,
|
|
365
|
-
// the horizontal scrollbar should be shown even when there're no rows.
|
|
366
|
-
// Keeping 1px as minimum height ensures that the scrollbar will visible if necessary.
|
|
367
|
-
const height = Math.max(contentHeight, 1);
|
|
368
364
|
const size = {
|
|
369
365
|
width: needsHorizontalScrollbar ? columnsTotalWidth : 'auto',
|
|
370
|
-
height
|
|
366
|
+
height: contentHeight
|
|
371
367
|
};
|
|
372
|
-
if (rootProps.autoHeight) {
|
|
373
|
-
|
|
374
|
-
size.height = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
|
|
375
|
-
} else {
|
|
376
|
-
size.height = contentHeight;
|
|
377
|
-
}
|
|
368
|
+
if (rootProps.autoHeight && currentPage.rows.length === 0) {
|
|
369
|
+
size.height = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
|
|
378
370
|
}
|
|
379
371
|
return size;
|
|
380
372
|
}, [apiRef, columnsTotalWidth, contentHeight, needsHorizontalScrollbar, rootProps.autoHeight, currentPage.rows.length]);
|
package/modern/index.js
CHANGED
package/modern/locales/esES.js
CHANGED
|
@@ -33,8 +33,7 @@ const esESGrid = {
|
|
|
33
33
|
columnsManagementSearchTitle: 'Buscar',
|
|
34
34
|
columnsManagementNoColumns: 'Sin columnas',
|
|
35
35
|
columnsManagementShowHideAllText: 'Mostrar/Ocultar todas',
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
columnsManagementReset: 'Restablecer',
|
|
38
37
|
// Filter panel text
|
|
39
38
|
filterPanelAddFilter: 'Agregar filtro',
|
|
40
39
|
filterPanelRemoveAll: 'Remover todos',
|
package/modern/utils/utils.js
CHANGED
|
@@ -172,9 +172,17 @@ function mulberry32(a) {
|
|
|
172
172
|
/* eslint-enable */
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Create a random number generator from a seed. The seed
|
|
178
|
+
* ensures that the random number generator produces the
|
|
179
|
+
* same sequence of 'random' numbers on every render. It
|
|
180
|
+
* returns a function that generates a random number between
|
|
181
|
+
* a specified min and max.
|
|
182
|
+
*/
|
|
183
|
+
export function createRandomNumberGenerator(seed) {
|
|
176
184
|
const random = mulberry32(seed);
|
|
177
|
-
return () => min + (max - min) * random();
|
|
185
|
+
return (min, max) => min + (max - min) * random();
|
|
178
186
|
}
|
|
179
187
|
export function deepClone(obj) {
|
|
180
188
|
if (typeof structuredClone === 'function') {
|
|
@@ -32,54 +32,55 @@ const DATA_GRID_FORCED_PROPS = {
|
|
|
32
32
|
const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
33
33
|
autoHeight: false,
|
|
34
34
|
autoPageSize: false,
|
|
35
|
+
autosizeOnMount: false,
|
|
35
36
|
checkboxSelection: false,
|
|
36
37
|
checkboxSelectionVisibleOnly: false,
|
|
38
|
+
clipboardCopyCellDelimiter: '\t',
|
|
37
39
|
columnBufferPx: 150,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
rowSelection: true,
|
|
40
|
+
columnHeaderHeight: 56,
|
|
41
|
+
disableAutosize: false,
|
|
41
42
|
disableColumnFilter: false,
|
|
42
43
|
disableColumnMenu: false,
|
|
44
|
+
disableColumnReorder: false,
|
|
45
|
+
disableColumnResize: false,
|
|
43
46
|
disableColumnSelector: false,
|
|
47
|
+
disableColumnSorting: false,
|
|
44
48
|
disableDensitySelector: false,
|
|
45
49
|
disableEval: false,
|
|
46
50
|
disableMultipleColumnsFiltering: false,
|
|
47
|
-
disableMultipleRowSelection: false,
|
|
48
|
-
disableColumnSorting: false,
|
|
49
51
|
disableMultipleColumnsSorting: false,
|
|
52
|
+
disableMultipleRowSelection: false,
|
|
50
53
|
disableRowSelectionOnClick: false,
|
|
51
54
|
disableVirtualization: false,
|
|
52
55
|
editMode: _models.GridEditModes.Cell,
|
|
53
|
-
filterMode: 'client',
|
|
54
56
|
filterDebounceMs: 150,
|
|
55
|
-
|
|
57
|
+
filterMode: 'client',
|
|
56
58
|
hideFooter: false,
|
|
57
59
|
hideFooterPagination: false,
|
|
58
60
|
hideFooterRowCount: false,
|
|
59
61
|
hideFooterSelectedRowCount: false,
|
|
60
62
|
ignoreDiacritics: false,
|
|
63
|
+
ignoreValueFormatterDuringExport: false,
|
|
64
|
+
keepColumnPositionIfDraggedOutside: false,
|
|
65
|
+
keepNonExistentRowsSelected: false,
|
|
66
|
+
loading: false,
|
|
61
67
|
logger: console,
|
|
62
68
|
logLevel: process.env.NODE_ENV === 'production' ? 'error' : 'warn',
|
|
69
|
+
pageSizeOptions: [25, 50, 100],
|
|
63
70
|
pagination: false,
|
|
64
71
|
paginationMode: 'client',
|
|
65
|
-
rowHeight: 52,
|
|
66
72
|
resizeThrottleMs: 60,
|
|
67
|
-
|
|
73
|
+
rowBufferPx: 150,
|
|
74
|
+
rowHeight: 52,
|
|
75
|
+
rowPositionsDebounceMs: 166,
|
|
76
|
+
rows: [],
|
|
77
|
+
rowSelection: true,
|
|
68
78
|
rowSpacingType: 'margin',
|
|
69
79
|
showCellVerticalBorder: false,
|
|
70
80
|
showColumnVerticalBorder: false,
|
|
71
|
-
sortingOrder: ['asc', 'desc', null],
|
|
72
81
|
sortingMode: 'client',
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
disableColumnResize: false,
|
|
76
|
-
keepNonExistentRowsSelected: false,
|
|
77
|
-
keepColumnPositionIfDraggedOutside: false,
|
|
78
|
-
ignoreValueFormatterDuringExport: false,
|
|
79
|
-
clipboardCopyCellDelimiter: '\t',
|
|
80
|
-
rowPositionsDebounceMs: 166,
|
|
81
|
-
autosizeOnMount: false,
|
|
82
|
-
disableAutosize: false
|
|
82
|
+
sortingOrder: ['asc', 'desc', null],
|
|
83
|
+
throttleRowsMs: 0
|
|
83
84
|
};
|
|
84
85
|
const defaultSlots = _defaultGridSlotsComponents.DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
|
|
85
86
|
const useDataGridProps = inProps => {
|
|
@@ -94,9 +95,16 @@ const useDataGridProps = inProps => {
|
|
|
94
95
|
defaultSlots,
|
|
95
96
|
slots: themedProps.slots
|
|
96
97
|
}), [themedProps.slots]);
|
|
97
|
-
|
|
98
|
+
const injectDefaultProps = React.useMemo(() => {
|
|
99
|
+
return Object.keys(DATA_GRID_PROPS_DEFAULT_VALUES).reduce((acc, key) => {
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
acc[key] = themedProps[key] ?? DATA_GRID_PROPS_DEFAULT_VALUES[key];
|
|
102
|
+
return acc;
|
|
103
|
+
}, {});
|
|
104
|
+
}, [themedProps]);
|
|
105
|
+
return React.useMemo(() => (0, _extends2.default)({}, themedProps, injectDefaultProps, {
|
|
98
106
|
localeText,
|
|
99
107
|
slots
|
|
100
|
-
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots]);
|
|
108
|
+
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots, injectDefaultProps]);
|
|
101
109
|
};
|
|
102
110
|
exports.useDataGridProps = useDataGridProps;
|