@mui/x-data-grid 7.23.2 → 7.23.4
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 +86 -0
- package/DataGrid/DataGrid.js +7 -4
- package/README.md +1 -1
- package/components/GridColumnHeaders.d.ts +1 -1
- package/components/GridColumnHeaders.js +4 -4
- package/components/GridFooter.d.ts +2 -1
- package/components/GridFooter.js +4 -4
- package/components/GridLoadingOverlay.d.ts +1 -1
- package/components/GridLoadingOverlay.js +3 -2
- package/components/GridNoResultsOverlay.d.ts +2 -1
- package/components/GridNoResultsOverlay.js +4 -4
- package/components/GridNoRowsOverlay.d.ts +2 -1
- package/components/GridNoRowsOverlay.js +4 -4
- package/components/GridPagination.d.ts +1 -1
- package/components/GridPagination.js +5 -3
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +15 -3
- package/components/GridRowCount.d.ts +1 -1
- package/components/GridRowCount.js +3 -2
- package/components/GridSelectedRowCount.d.ts +4 -1
- package/components/GridSelectedRowCount.js +3 -2
- package/components/GridSkeletonLoadingOverlay.d.ts +1 -1
- package/components/GridSkeletonLoadingOverlay.js +4 -3
- package/components/cell/GridActionsCell.js +8 -1
- package/components/cell/GridActionsCellItem.d.ts +1 -1
- package/components/cell/GridActionsCellItem.js +3 -2
- package/components/cell/GridCell.d.ts +1 -1
- package/components/cell/GridCell.js +3 -2
- package/components/cell/GridEditInputCell.d.ts +1 -1
- package/components/cell/GridEditInputCell.js +72 -3
- package/components/columnHeaders/GridBaseColumnHeaders.d.ts +1 -1
- package/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -1
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/components/columnHeaders/GridIconButtonContainer.d.ts +1 -1
- package/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
- package/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/columnSelection/GridHeaderCheckbox.js +6 -4
- package/components/containers/GridFooterContainer.d.ts +1 -1
- package/components/containers/GridFooterContainer.js +5 -3
- package/components/containers/GridOverlay.d.ts +1 -1
- package/components/containers/GridOverlay.js +5 -3
- package/components/containers/GridRoot.d.ts +1 -1
- package/components/containers/GridRoot.js +5 -3
- package/components/containers/GridToolbarContainer.d.ts +1 -1
- package/components/containers/GridToolbarContainer.js +3 -2
- package/components/menu/columnMenu/GridColumnMenu.d.ts +2 -2
- package/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/components/menu/columnMenu/GridColumnMenuContainer.d.ts +1 -1
- package/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +3 -2
- package/components/panel/GridPanelWrapper.d.ts +1 -1
- package/components/panel/GridPanelWrapper.js +5 -3
- package/components/panel/filterPanel/GridFilterForm.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/components/panel/filterPanel/GridFilterPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/components/toolbar/GridToolbar.d.ts +1 -1
- package/components/toolbar/GridToolbar.js +4 -4
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/components/toolbar/GridToolbarExport.d.ts +1 -1
- package/components/toolbar/GridToolbarExport.js +2 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/components/virtualization/GridMainContainer.d.ts +3 -1
- package/components/virtualization/GridMainContainer.js +4 -3
- package/components/virtualization/GridVirtualScrollbar.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/components/virtualization/GridVirtualScrollerContent.d.ts +2 -0
- package/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +2 -0
- package/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +6 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/index.js +1 -1
- package/internals/utils/useProps.js +3 -0
- package/locales/koKR.js +36 -39
- package/locales/nlNL.js +5 -6
- package/models/gridSlotsComponentsProps.d.ts +10 -0
- package/models/props/DataGridProps.d.ts +1 -0
- package/modern/DataGrid/DataGrid.js +7 -4
- package/modern/components/GridColumnHeaders.js +4 -4
- package/modern/components/GridFooter.js +4 -4
- package/modern/components/GridLoadingOverlay.js +3 -2
- package/modern/components/GridNoResultsOverlay.js +4 -4
- package/modern/components/GridNoRowsOverlay.js +4 -4
- package/modern/components/GridPagination.js +5 -3
- package/modern/components/GridRow.js +15 -3
- package/modern/components/GridRowCount.js +3 -2
- package/modern/components/GridSelectedRowCount.js +3 -2
- package/modern/components/GridSkeletonLoadingOverlay.js +4 -3
- package/modern/components/cell/GridActionsCell.js +8 -1
- package/modern/components/cell/GridActionsCellItem.js +3 -2
- package/modern/components/cell/GridCell.js +3 -2
- package/modern/components/cell/GridEditInputCell.js +72 -3
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/modern/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/modern/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
- package/modern/components/columnSelection/GridHeaderCheckbox.js +6 -4
- package/modern/components/containers/GridFooterContainer.js +5 -3
- package/modern/components/containers/GridOverlay.js +5 -3
- package/modern/components/containers/GridRoot.js +5 -3
- package/modern/components/containers/GridToolbarContainer.js +3 -2
- package/modern/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/modern/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/modern/components/panel/GridPanel.js +3 -2
- package/modern/components/panel/GridPanelWrapper.js +5 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/modern/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/modern/components/toolbar/GridToolbar.js +4 -4
- package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/modern/components/toolbar/GridToolbarExport.js +2 -1
- package/modern/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/modern/components/virtualization/GridMainContainer.js +4 -3
- package/modern/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/modern/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/modern/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/modern/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/modern/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/modern/index.js +1 -1
- package/modern/internals/utils/useProps.js +3 -0
- package/modern/locales/koKR.js +36 -39
- package/modern/locales/nlNL.js +5 -6
- package/node/DataGrid/DataGrid.js +7 -4
- package/node/components/GridColumnHeaders.js +4 -4
- package/node/components/GridFooter.js +4 -4
- package/node/components/GridLoadingOverlay.js +3 -2
- package/node/components/GridNoResultsOverlay.js +4 -4
- package/node/components/GridNoRowsOverlay.js +4 -4
- package/node/components/GridPagination.js +5 -3
- package/node/components/GridRow.js +15 -3
- package/node/components/GridRowCount.js +3 -2
- package/node/components/GridSelectedRowCount.js +3 -2
- package/node/components/GridSkeletonLoadingOverlay.js +4 -3
- package/node/components/cell/GridActionsCell.js +8 -1
- package/node/components/cell/GridActionsCellItem.js +3 -2
- package/node/components/cell/GridCell.js +3 -2
- package/node/components/cell/GridEditInputCell.js +72 -3
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/node/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/node/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
- package/node/components/columnSelection/GridHeaderCheckbox.js +6 -4
- package/node/components/containers/GridFooterContainer.js +5 -3
- package/node/components/containers/GridOverlay.js +5 -3
- package/node/components/containers/GridRoot.js +5 -3
- package/node/components/containers/GridToolbarContainer.js +3 -2
- package/node/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/node/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/node/components/panel/GridPanel.js +3 -2
- package/node/components/panel/GridPanelWrapper.js +5 -3
- package/node/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/node/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/node/components/toolbar/GridToolbar.js +4 -4
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/node/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/node/components/toolbar/GridToolbarExport.js +2 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/node/components/virtualization/GridMainContainer.js +4 -3
- package/node/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/node/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/node/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/node/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/node/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/node/index.js +1 -1
- package/node/internals/utils/useProps.js +3 -0
- package/node/locales/koKR.js +36 -39
- package/node/locales/nlNL.js +5 -6
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { styled } from '@mui/system';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
9
10
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
10
11
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -31,7 +32,7 @@ const GridToolbarContainerRoot = styled('div', {
|
|
|
31
32
|
gap: theme.spacing(1),
|
|
32
33
|
padding: theme.spacing(0.5, 0.5, 0)
|
|
33
34
|
}));
|
|
34
|
-
const GridToolbarContainer =
|
|
35
|
+
const GridToolbarContainer = forwardRef(function GridToolbarContainer(props, ref) {
|
|
35
36
|
const {
|
|
36
37
|
className,
|
|
37
38
|
children
|
|
@@ -43,10 +44,10 @@ const GridToolbarContainer = /*#__PURE__*/React.forwardRef(function GridToolbarC
|
|
|
43
44
|
return null;
|
|
44
45
|
}
|
|
45
46
|
return /*#__PURE__*/_jsx(GridToolbarContainerRoot, _extends({
|
|
46
|
-
ref: ref,
|
|
47
47
|
className: clsx(classes.root, className),
|
|
48
48
|
ownerState: rootProps
|
|
49
49
|
}, other, {
|
|
50
|
+
ref: ref,
|
|
50
51
|
children: children
|
|
51
52
|
}));
|
|
52
53
|
});
|
|
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["defaultSlots", "defaultSlotProps", "slots", "slotProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
6
7
|
import { useGridColumnMenuSlots } from "../../../hooks/features/columnMenu/useGridColumnMenuSlots.js";
|
|
7
8
|
import { GridColumnMenuContainer } from "./GridColumnMenuContainer.js";
|
|
8
9
|
import { GridColumnMenuColumnsItem } from "./menuItems/GridColumnMenuColumnsItem.js";
|
|
@@ -25,7 +26,7 @@ export const GRID_COLUMN_MENU_SLOT_PROPS = {
|
|
|
25
26
|
displayOrder: 30
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
|
-
const GridGenericColumnMenu =
|
|
29
|
+
const GridGenericColumnMenu = forwardRef(function GridGenericColumnMenu(props, ref) {
|
|
29
30
|
const {
|
|
30
31
|
defaultSlots,
|
|
31
32
|
defaultSlotProps,
|
|
@@ -39,9 +40,8 @@ const GridGenericColumnMenu = /*#__PURE__*/React.forwardRef(function GridGeneric
|
|
|
39
40
|
slots,
|
|
40
41
|
slotProps
|
|
41
42
|
}));
|
|
42
|
-
return /*#__PURE__*/_jsx(GridColumnMenuContainer, _extends({
|
|
43
|
-
ref: ref
|
|
44
|
-
}, other, {
|
|
43
|
+
return /*#__PURE__*/_jsx(GridColumnMenuContainer, _extends({}, other, {
|
|
44
|
+
ref: ref,
|
|
45
45
|
children: orderedSlots.map(([Component, otherProps], index) => /*#__PURE__*/_jsx(Component, _extends({}, otherProps), index))
|
|
46
46
|
}));
|
|
47
47
|
});
|
|
@@ -77,7 +77,7 @@ process.env.NODE_ENV !== "production" ? GridGenericColumnMenu.propTypes = {
|
|
|
77
77
|
*/
|
|
78
78
|
slots: PropTypes.object
|
|
79
79
|
} : void 0;
|
|
80
|
-
const GridColumnMenu =
|
|
80
|
+
const GridColumnMenu = forwardRef(function GridColumnMenu(props, ref) {
|
|
81
81
|
return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({}, props, {
|
|
82
82
|
ref: ref,
|
|
83
83
|
defaultSlots: GRID_COLUMN_MENU_SLOTS,
|
|
@@ -6,13 +6,14 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import MenuList from '@mui/material/MenuList';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
9
10
|
import { isHideMenuKey } from "../../../utils/keyboardUtils.js";
|
|
10
11
|
import { gridClasses } from "../../../constants/gridClasses.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
const StyledMenuList = styled(MenuList)(() => ({
|
|
13
14
|
minWidth: 248
|
|
14
15
|
}));
|
|
15
|
-
const GridColumnMenuContainer =
|
|
16
|
+
const GridColumnMenuContainer = forwardRef(function GridColumnMenuContainer(props, ref) {
|
|
16
17
|
const {
|
|
17
18
|
hideMenu,
|
|
18
19
|
id,
|
|
@@ -32,12 +33,12 @@ const GridColumnMenuContainer = /*#__PURE__*/React.forwardRef(function GridColum
|
|
|
32
33
|
}, [hideMenu]);
|
|
33
34
|
return /*#__PURE__*/_jsx(StyledMenuList, _extends({
|
|
34
35
|
id: id,
|
|
35
|
-
ref: ref,
|
|
36
36
|
className: clsx(gridClasses.menuList, className),
|
|
37
37
|
"aria-labelledby": labelledby,
|
|
38
38
|
onKeyDown: handleListKeyDown,
|
|
39
39
|
autoFocus: open
|
|
40
40
|
}, other, {
|
|
41
|
+
ref: ref,
|
|
41
42
|
children: children
|
|
42
43
|
}));
|
|
43
44
|
});
|
|
@@ -9,6 +9,7 @@ import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/
|
|
|
9
9
|
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
10
10
|
import Paper from '@mui/material/Paper';
|
|
11
11
|
import Popper from '@mui/material/Popper';
|
|
12
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
12
13
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
13
14
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -36,7 +37,7 @@ const GridPaperRoot = styled(Paper, {
|
|
|
36
37
|
maxWidth: `calc(100vw - ${theme.spacing(0.5)})`,
|
|
37
38
|
overflow: 'auto'
|
|
38
39
|
}));
|
|
39
|
-
const GridPanel =
|
|
40
|
+
const GridPanel = forwardRef((props, ref) => {
|
|
40
41
|
const {
|
|
41
42
|
children,
|
|
42
43
|
className
|
|
@@ -82,13 +83,13 @@ const GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
82
83
|
return null;
|
|
83
84
|
}
|
|
84
85
|
return /*#__PURE__*/_jsx(GridPanelRoot, _extends({
|
|
85
|
-
ref: ref,
|
|
86
86
|
placement: "bottom-start",
|
|
87
87
|
className: clsx(classes.panel, className),
|
|
88
88
|
ownerState: rootProps,
|
|
89
89
|
anchorEl: anchorEl,
|
|
90
90
|
modifiers: modifiers
|
|
91
91
|
}, other, {
|
|
92
|
+
ref: ref,
|
|
92
93
|
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
|
93
94
|
mouseEvent: "onMouseUp",
|
|
94
95
|
onClickAway: handleClickAway,
|
|
@@ -7,6 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
import FocusTrap from '@mui/material/Unstable_TrapFocus';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
11
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
11
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -32,7 +33,7 @@ const GridPanelWrapperRoot = styled('div', {
|
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
const isEnabled = () => true;
|
|
35
|
-
const GridPanelWrapper =
|
|
36
|
+
const GridPanelWrapper = forwardRef(function GridPanelWrapper(props, ref) {
|
|
36
37
|
const {
|
|
37
38
|
className,
|
|
38
39
|
slotProps = {}
|
|
@@ -46,11 +47,12 @@ const GridPanelWrapper = /*#__PURE__*/React.forwardRef(function GridPanelWrapper
|
|
|
46
47
|
isEnabled: isEnabled
|
|
47
48
|
}, slotProps.TrapFocus, {
|
|
48
49
|
children: /*#__PURE__*/_jsx(GridPanelWrapperRoot, _extends({
|
|
49
|
-
ref: ref,
|
|
50
50
|
tabIndex: -1,
|
|
51
51
|
className: clsx(classes.root, className),
|
|
52
52
|
ownerState: rootProps
|
|
53
|
-
}, other
|
|
53
|
+
}, other, {
|
|
54
|
+
ref: ref
|
|
55
|
+
}))
|
|
54
56
|
}));
|
|
55
57
|
});
|
|
56
58
|
process.env.NODE_ENV !== "production" ? GridPanelWrapper.propTypes = {
|
|
@@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId, unstable_capitalize as capitalize } from '@mui/utils';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
11
|
import { gridFilterableColumnDefinitionsSelector, gridColumnLookupSelector } from "../../../hooks/features/columns/gridColumnsSelector.js";
|
|
11
12
|
import { gridFilterModelSelector } from "../../../hooks/features/filter/gridFilterSelector.js";
|
|
12
13
|
import { useGridSelector } from "../../../hooks/utils/useGridSelector.js";
|
|
@@ -95,7 +96,7 @@ const getLogicOperatorLocaleKey = logicOperator => {
|
|
|
95
96
|
};
|
|
96
97
|
const getColumnLabel = col => col.headerName || col.field;
|
|
97
98
|
const collator = new Intl.Collator();
|
|
98
|
-
const GridFilterForm =
|
|
99
|
+
const GridFilterForm = forwardRef(function GridFilterForm(props, ref) {
|
|
99
100
|
const {
|
|
100
101
|
item,
|
|
101
102
|
hasMultipleFilters,
|
|
@@ -255,11 +256,11 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
255
256
|
}
|
|
256
257
|
}), [currentOperator]);
|
|
257
258
|
return /*#__PURE__*/_jsxs(GridFilterFormRoot, _extends({
|
|
258
|
-
ref: ref,
|
|
259
259
|
className: classes.root,
|
|
260
260
|
"data-id": item.id,
|
|
261
261
|
ownerState: rootProps
|
|
262
262
|
}, other, {
|
|
263
|
+
ref: ref,
|
|
263
264
|
children: [/*#__PURE__*/_jsx(FilterFormDeleteIcon, _extends({
|
|
264
265
|
variant: "standard",
|
|
265
266
|
as: rootProps.slots.baseFormControl
|
|
@@ -22,19 +22,17 @@ function GridFilterInputValue(props) {
|
|
|
22
22
|
} = props,
|
|
23
23
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
24
24
|
const filterTimeout = useTimeout();
|
|
25
|
-
const [filterValueState, setFilterValueState] = React.useState(item.value
|
|
25
|
+
const [filterValueState, setFilterValueState] = React.useState(sanitizeFilterItemValue(item.value, type));
|
|
26
26
|
const [applying, setIsApplying] = React.useState(false);
|
|
27
27
|
const id = useId();
|
|
28
28
|
const rootProps = useGridRootProps();
|
|
29
29
|
const onFilterChange = React.useCallback(event => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
} = event.target;
|
|
33
|
-
setFilterValueState(String(value));
|
|
30
|
+
const value = sanitizeFilterItemValue(event.target.value, type);
|
|
31
|
+
setFilterValueState(value);
|
|
34
32
|
setIsApplying(true);
|
|
35
33
|
filterTimeout.start(rootProps.filterDebounceMs, () => {
|
|
36
34
|
const newItem = _extends({}, item, {
|
|
37
|
-
value
|
|
35
|
+
value,
|
|
38
36
|
fromInput: id
|
|
39
37
|
});
|
|
40
38
|
applyValue(newItem);
|
|
@@ -43,15 +41,15 @@ function GridFilterInputValue(props) {
|
|
|
43
41
|
}, [filterTimeout, rootProps.filterDebounceMs, item, type, id, applyValue]);
|
|
44
42
|
React.useEffect(() => {
|
|
45
43
|
const itemPlusTag = item;
|
|
46
|
-
if (itemPlusTag.fromInput !== id || item.value
|
|
47
|
-
setFilterValueState(
|
|
44
|
+
if (itemPlusTag.fromInput !== id || item.value == null) {
|
|
45
|
+
setFilterValueState(sanitizeFilterItemValue(item.value, type));
|
|
48
46
|
}
|
|
49
|
-
}, [id, item]);
|
|
47
|
+
}, [id, item, type]);
|
|
50
48
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
51
49
|
id: id,
|
|
52
50
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
53
51
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
54
|
-
value: filterValueState,
|
|
52
|
+
value: filterValueState === undefined ? '' : String(filterValueState),
|
|
55
53
|
onChange: onFilterChange,
|
|
56
54
|
variant: variant,
|
|
57
55
|
type: type || 'text',
|
|
@@ -73,6 +71,15 @@ function GridFilterInputValue(props) {
|
|
|
73
71
|
inputRef: focusElementRef
|
|
74
72
|
}, others, rootProps.slotProps?.baseTextField));
|
|
75
73
|
}
|
|
74
|
+
function sanitizeFilterItemValue(value, type) {
|
|
75
|
+
if (value == null || value === '') {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
if (type === 'number') {
|
|
79
|
+
return Number(value);
|
|
80
|
+
}
|
|
81
|
+
return String(value);
|
|
82
|
+
}
|
|
76
83
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
77
84
|
// ----------------------------- Warning --------------------------------
|
|
78
85
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["logicOperators", "columnsSort", "filterFormProps", "getColumnForNewFilter", "children", "disableAddFilterButton", "disableRemoveAllButton"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
6
7
|
import { GridLogicOperator } from "../../../models/gridFilterItem.js";
|
|
7
8
|
import { useGridApiContext } from "../../../hooks/utils/useGridApiContext.js";
|
|
8
9
|
import { GridPanelContent } from "../GridPanelContent.js";
|
|
@@ -19,7 +20,7 @@ const getGridFilter = col => ({
|
|
|
19
20
|
operator: col.filterOperators[0].value,
|
|
20
21
|
id: Math.round(Math.random() * 1e5)
|
|
21
22
|
});
|
|
22
|
-
const GridFilterPanel =
|
|
23
|
+
const GridFilterPanel = forwardRef(function GridFilterPanel(props, ref) {
|
|
23
24
|
const apiRef = useGridApiContext();
|
|
24
25
|
const rootProps = useGridRootProps();
|
|
25
26
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
@@ -141,9 +142,8 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
141
142
|
lastFilterRef.current.focus();
|
|
142
143
|
}
|
|
143
144
|
}, [validFilters.length]);
|
|
144
|
-
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({
|
|
145
|
-
ref: ref
|
|
146
|
-
}, other, {
|
|
145
|
+
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({}, other, {
|
|
146
|
+
ref: ref,
|
|
147
147
|
children: [/*#__PURE__*/_jsxs(GridPanelContent, {
|
|
148
148
|
children: [readOnlyFilters.map((item, index) => /*#__PURE__*/_jsx(GridFilterForm, _extends({
|
|
149
149
|
item: item,
|
|
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["className", "csvOptions", "printOptions", "excelOptions", "showQuickFilter", "quickFilterProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
6
7
|
import { GridToolbarContainer } from "../containers/GridToolbarContainer.js";
|
|
7
8
|
import { GridToolbarColumnsButton } from "./GridToolbarColumnsButton.js";
|
|
8
9
|
import { GridToolbarDensitySelector } from "./GridToolbarDensitySelector.js";
|
|
@@ -11,7 +12,7 @@ import { GridToolbarExport } from "./GridToolbarExport.js";
|
|
|
11
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
12
13
|
import { GridToolbarQuickFilter } from "./GridToolbarQuickFilter.js";
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const GridToolbar =
|
|
15
|
+
const GridToolbar = forwardRef(function GridToolbar(props, ref) {
|
|
15
16
|
// TODO v7: think about where export option should be passed.
|
|
16
17
|
// from slotProps={{ toolbarExport: { ...exportOption } }} seems to be more appropriate
|
|
17
18
|
const _ref = props,
|
|
@@ -27,9 +28,8 @@ const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, re
|
|
|
27
28
|
if (rootProps.disableColumnFilter && rootProps.disableColumnSelector && rootProps.disableDensitySelector && !showQuickFilter) {
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
|
-
return /*#__PURE__*/_jsxs(GridToolbarContainer, _extends({
|
|
31
|
-
ref: ref
|
|
32
|
-
}, other, {
|
|
31
|
+
return /*#__PURE__*/_jsxs(GridToolbarContainer, _extends({}, other, {
|
|
32
|
+
ref: ref,
|
|
33
33
|
children: [/*#__PURE__*/_jsx(GridToolbarColumnsButton, {}), /*#__PURE__*/_jsx(GridToolbarFilterButton, {}), /*#__PURE__*/_jsx(GridToolbarDensitySelector, {}), /*#__PURE__*/_jsx(GridToolbarExport, {
|
|
34
34
|
csvOptions: csvOptions,
|
|
35
35
|
printOptions: printOptions
|
|
@@ -2,13 +2,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
5
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
5
6
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
6
7
|
import { gridPreferencePanelStateSelector } from "../../hooks/features/preferencesPanel/gridPreferencePanelSelector.js";
|
|
7
8
|
import { GridPreferencePanelsValue } from "../../hooks/features/preferencesPanel/gridPreferencePanelsValue.js";
|
|
8
9
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
9
10
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const GridToolbarColumnsButton =
|
|
12
|
+
const GridToolbarColumnsButton = forwardRef(function GridToolbarColumnsButton(props, ref) {
|
|
12
13
|
const {
|
|
13
14
|
slotProps = {}
|
|
14
15
|
} = props;
|
|
@@ -38,7 +39,6 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
38
39
|
enterDelay: 1000
|
|
39
40
|
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
40
41
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
41
|
-
ref: ref,
|
|
42
42
|
id: columnButtonId,
|
|
43
43
|
size: "small",
|
|
44
44
|
"aria-label": apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
@@ -48,6 +48,7 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
48
48
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {}),
|
|
49
49
|
onClick: showColumns
|
|
50
50
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
51
|
+
ref: ref,
|
|
51
52
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
52
53
|
}))
|
|
53
54
|
}));
|
|
@@ -5,6 +5,7 @@ import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui
|
|
|
5
5
|
import MenuList from '@mui/material/MenuList';
|
|
6
6
|
import MenuItem from '@mui/material/MenuItem';
|
|
7
7
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
8
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
9
|
import { gridDensitySelector } from "../../hooks/features/density/densitySelector.js";
|
|
9
10
|
import { isHideMenuKey } from "../../utils/keyboardUtils.js";
|
|
10
11
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
@@ -13,7 +14,7 @@ import { GridMenu } from "../menu/GridMenu.js";
|
|
|
13
14
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
14
15
|
import { gridClasses } from "../../constants/gridClasses.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
const GridToolbarDensitySelector =
|
|
17
|
+
const GridToolbarDensitySelector = forwardRef(function GridToolbarDensitySelector(props, ref) {
|
|
17
18
|
const {
|
|
18
19
|
slotProps = {}
|
|
19
20
|
} = props;
|
|
@@ -87,7 +88,6 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
87
88
|
enterDelay: 1000
|
|
88
89
|
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
89
90
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
90
|
-
ref: handleRef,
|
|
91
91
|
size: "small",
|
|
92
92
|
startIcon: startIcon,
|
|
93
93
|
"aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
@@ -97,6 +97,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
97
97
|
id: densityButtonId,
|
|
98
98
|
onClick: handleDensitySelectorOpen
|
|
99
99
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
100
|
+
ref: handleRef,
|
|
100
101
|
children: apiRef.current.getLocaleText('toolbarDensity')
|
|
101
102
|
}))
|
|
102
103
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
@@ -6,6 +6,7 @@ const _excluded = ["hideMenu", "options"],
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import MenuItem from '@mui/material/MenuItem';
|
|
9
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
9
10
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
10
11
|
import { GridToolbarExportContainer } from "./GridToolbarExportContainer.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -81,7 +82,7 @@ process.env.NODE_ENV !== "production" ? GridPrintExportMenuItem.propTypes = {
|
|
|
81
82
|
pageStyle: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
|
|
82
83
|
})
|
|
83
84
|
} : void 0;
|
|
84
|
-
const GridToolbarExport =
|
|
85
|
+
const GridToolbarExport = forwardRef(function GridToolbarExport(props, ref) {
|
|
85
86
|
const _ref = props,
|
|
86
87
|
{
|
|
87
88
|
csvOptions = {},
|
|
@@ -3,13 +3,14 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
5
5
|
import MenuList from '@mui/material/MenuList';
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
6
7
|
import { isHideMenuKey } from "../../utils/keyboardUtils.js";
|
|
7
8
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
8
9
|
import { GridMenu } from "../menu/GridMenu.js";
|
|
9
10
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
10
11
|
import { gridClasses } from "../../constants/gridClasses.js";
|
|
11
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const GridToolbarExportContainer =
|
|
13
|
+
const GridToolbarExportContainer = forwardRef(function GridToolbarExportContainer(props, ref) {
|
|
13
14
|
const {
|
|
14
15
|
children,
|
|
15
16
|
slotProps = {}
|
|
@@ -45,7 +46,6 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
45
46
|
enterDelay: 1000
|
|
46
47
|
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
47
48
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
48
|
-
ref: handleRef,
|
|
49
49
|
size: "small",
|
|
50
50
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.exportIcon, {}),
|
|
51
51
|
"aria-expanded": open,
|
|
@@ -55,6 +55,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
55
55
|
id: exportButtonId,
|
|
56
56
|
onClick: handleMenuOpen
|
|
57
57
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
58
|
+
ref: handleRef,
|
|
58
59
|
children: apiRef.current.getLocaleText('toolbarExport')
|
|
59
60
|
}))
|
|
60
61
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize, unstable_useId as useId } from '@mui/utils';
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
6
7
|
import { gridColumnLookupSelector } from "../../hooks/features/columns/gridColumnsSelector.js";
|
|
7
8
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
8
9
|
import { gridFilterActiveItemsSelector } from "../../hooks/features/filter/gridFilterSelector.js";
|
|
@@ -31,7 +32,7 @@ const GridToolbarFilterListRoot = styled('ul', {
|
|
|
31
32
|
margin: theme.spacing(1, 1, 0.5),
|
|
32
33
|
padding: theme.spacing(0, 1)
|
|
33
34
|
}));
|
|
34
|
-
const GridToolbarFilterButton =
|
|
35
|
+
const GridToolbarFilterButton = forwardRef(function GridToolbarFilterButton(props, ref) {
|
|
35
36
|
const {
|
|
36
37
|
slotProps = {}
|
|
37
38
|
} = props;
|
|
@@ -97,7 +98,6 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
97
98
|
enterDelay: 1000
|
|
98
99
|
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
99
100
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
100
|
-
ref: ref,
|
|
101
101
|
id: filterButtonId,
|
|
102
102
|
size: "small",
|
|
103
103
|
"aria-label": apiRef.current.getLocaleText('toolbarFiltersLabel'),
|
|
@@ -112,6 +112,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
112
112
|
})),
|
|
113
113
|
onClick: toggleFilter
|
|
114
114
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
115
|
+
ref: ref,
|
|
115
116
|
children: apiRef.current.getLocaleText('toolbarFilters')
|
|
116
117
|
}))
|
|
117
118
|
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { styled } from '@mui/system';
|
|
4
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
4
5
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
5
6
|
import { useGridConfiguration } from "../../hooks/utils/useGridConfiguration.js";
|
|
6
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -21,16 +22,16 @@ const Element = styled('div', {
|
|
|
21
22
|
display: 'flex',
|
|
22
23
|
flexDirection: 'column'
|
|
23
24
|
});
|
|
24
|
-
export const GridMainContainer =
|
|
25
|
+
export const GridMainContainer = forwardRef((props, ref) => {
|
|
25
26
|
const rootProps = useGridRootProps();
|
|
26
27
|
const configuration = useGridConfiguration();
|
|
27
28
|
const ariaAttributes = configuration.hooks.useGridAriaAttributes();
|
|
28
29
|
return /*#__PURE__*/_jsxs(Element, _extends({
|
|
29
|
-
ref: ref,
|
|
30
30
|
ownerState: rootProps,
|
|
31
31
|
className: props.className,
|
|
32
32
|
tabIndex: -1
|
|
33
|
-
}, ariaAttributes, {
|
|
33
|
+
}, ariaAttributes, rootProps.slotProps?.main, {
|
|
34
|
+
ref: ref,
|
|
34
35
|
children: [/*#__PURE__*/_jsx(GridPanelAnchor, {
|
|
35
36
|
role: "presentation",
|
|
36
37
|
"data-id": "gridPanelAnchor"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { styled } from '@mui/system';
|
|
3
3
|
import { unstable_composeClasses as composeClasses, unstable_useForkRef as useForkRef, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
4
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
4
5
|
import { useOnMount } from "../../hooks/utils/useOnMount.js";
|
|
5
6
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
6
7
|
import { gridDimensionsSelector, useGridSelector } from "../../hooks/index.js";
|
|
@@ -52,7 +53,7 @@ const ScrollbarHorizontal = styled(Scrollbar)({
|
|
|
52
53
|
},
|
|
53
54
|
bottom: '0px'
|
|
54
55
|
});
|
|
55
|
-
const GridVirtualScrollbar =
|
|
56
|
+
const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref) {
|
|
56
57
|
const apiRef = useGridPrivateApiContext();
|
|
57
58
|
const rootProps = useGridRootProps();
|
|
58
59
|
const isLocked = React.useRef(false);
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { styled } from '@mui/system';
|
|
5
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
6
7
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
7
8
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -20,15 +21,14 @@ const VirtualScrollerContentRoot = styled('div', {
|
|
|
20
21
|
slot: 'VirtualScrollerContent',
|
|
21
22
|
overridesResolver: (props, styles) => styles.virtualScrollerContent
|
|
22
23
|
})({});
|
|
23
|
-
const GridVirtualScrollerContent =
|
|
24
|
+
const GridVirtualScrollerContent = forwardRef(function GridVirtualScrollerContent(props, ref) {
|
|
24
25
|
const rootProps = useGridRootProps();
|
|
25
26
|
const overflowedContent = !rootProps.autoHeight && props.style?.minHeight === 'auto';
|
|
26
27
|
const classes = useUtilityClasses(rootProps, overflowedContent);
|
|
27
|
-
return /*#__PURE__*/_jsx(VirtualScrollerContentRoot, _extends({
|
|
28
|
-
ref: ref
|
|
29
|
-
}, props, {
|
|
28
|
+
return /*#__PURE__*/_jsx(VirtualScrollerContentRoot, _extends({}, props, {
|
|
30
29
|
ownerState: rootProps,
|
|
31
|
-
className: clsx(classes.root, props.className)
|
|
30
|
+
className: clsx(classes.root, props.className),
|
|
31
|
+
ref: ref
|
|
32
32
|
}));
|
|
33
33
|
});
|
|
34
34
|
export { GridVirtualScrollerContent };
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { styled } from '@mui/system';
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
9
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
9
10
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
10
11
|
import { gridRowsMetaSelector } from "../../hooks/features/rows/index.js";
|
|
@@ -31,7 +32,7 @@ const VirtualScrollerRenderZoneRoot = styled('div', {
|
|
|
31
32
|
// Prevents margin collapsing when using `getRowSpacing`
|
|
32
33
|
flexDirection: 'column'
|
|
33
34
|
});
|
|
34
|
-
const GridVirtualScrollerRenderZone =
|
|
35
|
+
const GridVirtualScrollerRenderZone = forwardRef(function GridVirtualScrollerRenderZone(props, ref) {
|
|
35
36
|
const {
|
|
36
37
|
className
|
|
37
38
|
} = props,
|
|
@@ -45,12 +46,13 @@ const GridVirtualScrollerRenderZone = /*#__PURE__*/React.forwardRef(function Gri
|
|
|
45
46
|
return rowsMeta.positions[renderContext.firstRowIndex] ?? 0;
|
|
46
47
|
});
|
|
47
48
|
return /*#__PURE__*/_jsx(VirtualScrollerRenderZoneRoot, _extends({
|
|
48
|
-
ref: ref,
|
|
49
49
|
className: clsx(classes.root, className),
|
|
50
50
|
ownerState: rootProps,
|
|
51
51
|
style: {
|
|
52
52
|
transform: `translate3d(0, ${offsetTop}px, 0)`
|
|
53
53
|
}
|
|
54
|
-
}, other
|
|
54
|
+
}, other, {
|
|
55
|
+
ref: ref
|
|
56
|
+
}));
|
|
55
57
|
});
|
|
56
58
|
export { GridVirtualScrollerRenderZone };
|
|
@@ -47,7 +47,7 @@ export const useGridColumnHeaders = props => {
|
|
|
47
47
|
const isRtl = useRtl();
|
|
48
48
|
const rootProps = useGridRootProps();
|
|
49
49
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
50
|
-
const
|
|
50
|
+
const hasColumnVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
51
51
|
const columnGroupsModel = useGridSelector(apiRef, gridColumnGroupsUnwrappedModelSelector);
|
|
52
52
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
53
53
|
const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
|
|
@@ -87,8 +87,15 @@ export const useGridColumnHeaders = props => {
|
|
|
87
87
|
renderContext: currentContext = renderContext,
|
|
88
88
|
maxLastColumn = visibleColumns.length
|
|
89
89
|
} = params || {};
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
let firstColumnToRender;
|
|
91
|
+
let lastColumnToRender;
|
|
92
|
+
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
93
|
+
firstColumnToRender = 0;
|
|
94
|
+
lastColumnToRender = maxLastColumn;
|
|
95
|
+
} else {
|
|
96
|
+
firstColumnToRender = currentContext.firstColumnIndex;
|
|
97
|
+
lastColumnToRender = currentContext.lastColumnIndex;
|
|
98
|
+
}
|
|
92
99
|
const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
93
100
|
return {
|
|
94
101
|
renderedColumns,
|
|
@@ -458,6 +458,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
460
|
apiRef.current.autosizeColumns(_extends({}, props.autosizeOptions, {
|
|
461
|
+
disableColumnVirtualization: false,
|
|
461
462
|
columns: [column.field]
|
|
462
463
|
}));
|
|
463
464
|
});
|
|
@@ -484,8 +485,10 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
484
485
|
options.columns = options.columns.filter(c => state.columnVisibilityModel[c] !== false);
|
|
485
486
|
const columns = options.columns.map(c => apiRef.current.state.columns.lookup[c]);
|
|
486
487
|
try {
|
|
487
|
-
|
|
488
|
-
|
|
488
|
+
if (!props.disableVirtualization && options.disableColumnVirtualization) {
|
|
489
|
+
apiRef.current.unstable_setColumnVirtualization(false);
|
|
490
|
+
await columnVirtualizationDisabled();
|
|
491
|
+
}
|
|
489
492
|
const widthByField = extractColumnWidths(apiRef, options, columns);
|
|
490
493
|
const newColumns = columns.map(column => _extends({}, column, {
|
|
491
494
|
width: widthByField[column.field],
|
|
@@ -517,10 +520,12 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
517
520
|
}
|
|
518
521
|
});
|
|
519
522
|
} finally {
|
|
520
|
-
|
|
523
|
+
if (!props.disableVirtualization) {
|
|
524
|
+
apiRef.current.unstable_setColumnVirtualization(true);
|
|
525
|
+
}
|
|
521
526
|
isAutosizingRef.current = false;
|
|
522
527
|
}
|
|
523
|
-
}, [apiRef, columnVirtualizationDisabled]);
|
|
528
|
+
}, [apiRef, columnVirtualizationDisabled, props.disableVirtualization]);
|
|
524
529
|
|
|
525
530
|
/**
|
|
526
531
|
* EFFECTS
|