@mui/x-data-grid 8.0.0-beta.1 → 8.0.0-beta.2
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 +94 -0
- package/DataGrid/DataGrid.js +2 -0
- package/components/GridRow.js +3 -8
- package/components/GridShadowScrollArea.js +43 -35
- package/components/cell/GridBooleanCell.d.ts +1 -2
- package/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/components/cell/GridEditSingleSelectCell.js +1 -1
- package/components/containers/GridToolbarContainer.js +5 -3
- package/components/quickFilter/QuickFilter.d.ts +26 -3
- package/components/quickFilter/QuickFilter.js +103 -19
- package/components/quickFilter/QuickFilterClear.js +10 -4
- package/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/components/quickFilter/QuickFilterControl.js +36 -10
- package/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/components/quickFilter/QuickFilterTrigger.js +211 -0
- package/components/quickFilter/index.d.ts +2 -1
- package/components/quickFilter/index.js +11 -0
- package/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/components/toolbar/GridToolbarQuickFilter.js +101 -41
- package/components/toolbarV8/GridToolbar.js +22 -19
- package/components/toolbarV8/Toolbar.d.ts +1 -1
- package/components/toolbarV8/Toolbar.js +76 -23
- package/components/toolbarV8/ToolbarButton.js +34 -14
- package/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/constants/gridClasses.d.ts +12 -0
- package/constants/gridClasses.js +1 -1
- package/esm/DataGrid/DataGrid.js +2 -0
- package/esm/components/GridRow.js +4 -9
- package/esm/components/GridShadowScrollArea.js +43 -35
- package/esm/components/cell/GridBooleanCell.d.ts +1 -2
- package/esm/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
- package/esm/components/containers/GridToolbarContainer.js +5 -3
- package/esm/components/quickFilter/QuickFilter.d.ts +26 -3
- package/esm/components/quickFilter/QuickFilter.js +101 -17
- package/esm/components/quickFilter/QuickFilterClear.js +10 -4
- package/esm/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/esm/components/quickFilter/QuickFilterControl.js +36 -10
- package/esm/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/esm/components/quickFilter/QuickFilterTrigger.js +204 -0
- package/esm/components/quickFilter/index.d.ts +2 -1
- package/esm/components/quickFilter/index.js +2 -1
- package/esm/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/esm/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/esm/components/toolbar/GridToolbarQuickFilter.js +102 -44
- package/esm/components/toolbarV8/GridToolbar.js +22 -19
- package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
- package/esm/components/toolbarV8/Toolbar.js +75 -22
- package/esm/components/toolbarV8/ToolbarButton.js +34 -14
- package/esm/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/esm/constants/gridClasses.d.ts +12 -0
- package/esm/constants/gridClasses.js +1 -1
- package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/esm/hooks/features/columns/useGridColumns.js +0 -1
- package/esm/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/esm/hooks/features/filter/useGridFilter.js +1 -1
- package/esm/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
- package/esm/index.js +1 -1
- package/esm/locales/deDE.js +13 -13
- package/esm/models/props/DataGridProps.d.ts +6 -2
- package/esm/utils/utils.d.ts +0 -27
- package/esm/utils/utils.js +0 -122
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +2 -2
- package/hooks/features/columns/useGridColumns.js +0 -1
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/filter/useGridFilter.js +3 -3
- package/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -0
- package/index.js +1 -1
- package/locales/deDE.js +13 -13
- package/models/props/DataGridProps.d.ts +6 -2
- package/modern/DataGrid/DataGrid.js +2 -0
- package/modern/components/GridRow.js +4 -9
- package/modern/components/GridShadowScrollArea.js +43 -35
- package/modern/components/cell/GridBooleanCell.d.ts +1 -2
- package/modern/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/modern/components/cell/GridEditSingleSelectCell.js +1 -1
- package/modern/components/containers/GridToolbarContainer.js +5 -3
- package/modern/components/quickFilter/QuickFilter.d.ts +26 -3
- package/modern/components/quickFilter/QuickFilter.js +101 -17
- package/modern/components/quickFilter/QuickFilterClear.js +10 -4
- package/modern/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/modern/components/quickFilter/QuickFilterControl.js +36 -10
- package/modern/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/modern/components/quickFilter/QuickFilterTrigger.js +204 -0
- package/modern/components/quickFilter/index.d.ts +2 -1
- package/modern/components/quickFilter/index.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/modern/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/modern/components/toolbar/GridToolbarQuickFilter.js +102 -44
- package/modern/components/toolbarV8/GridToolbar.js +22 -19
- package/modern/components/toolbarV8/Toolbar.d.ts +1 -1
- package/modern/components/toolbarV8/Toolbar.js +75 -22
- package/modern/components/toolbarV8/ToolbarButton.js +34 -14
- package/modern/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/modern/constants/gridClasses.d.ts +12 -0
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/modern/hooks/features/columns/useGridColumns.js +0 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
- package/modern/index.js +1 -1
- package/modern/locales/deDE.js +13 -13
- package/modern/models/props/DataGridProps.d.ts +6 -2
- package/modern/utils/utils.d.ts +0 -27
- package/modern/utils/utils.js +0 -122
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/utils.d.ts +0 -27
- package/utils/utils.js +0 -123
|
@@ -9,9 +9,9 @@ exports.GridToolbar = GridToolbar;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _Menu = _interopRequireDefault(require("@mui/material/Menu"));
|
|
13
12
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
14
13
|
var _system = require("@mui/system");
|
|
14
|
+
var _GridMenu = require("../menu/GridMenu");
|
|
15
15
|
var _Toolbar = require("./Toolbar");
|
|
16
16
|
var _ToolbarButton = require("./ToolbarButton");
|
|
17
17
|
var _filterPanel = require("../filterPanel");
|
|
@@ -82,30 +82,33 @@ function GridToolbar(props) {
|
|
|
82
82
|
"aria-controls": exportMenuId,
|
|
83
83
|
"aria-haspopup": "true",
|
|
84
84
|
"aria-expanded": exportMenuOpen ? 'true' : undefined,
|
|
85
|
-
onClick: () => setExportMenuOpen(
|
|
85
|
+
onClick: () => setExportMenuOpen(!exportMenuOpen),
|
|
86
86
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.exportIcon, {
|
|
87
87
|
fontSize: "small"
|
|
88
88
|
})
|
|
89
89
|
})
|
|
90
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
91
|
-
|
|
92
|
-
anchorEl: exportMenuTriggerRef.current,
|
|
90
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridMenu.GridMenu, {
|
|
91
|
+
target: exportMenuTriggerRef.current,
|
|
93
92
|
open: exportMenuOpen,
|
|
94
93
|
onClose: closeExportMenu,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
position: "bottom-start",
|
|
95
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(rootProps.slots.baseMenuList, (0, _extends2.default)({
|
|
96
|
+
id: exportMenuId,
|
|
97
|
+
"aria-labelledby": exportMenuTriggerId,
|
|
98
|
+
autoFocusItem: true
|
|
99
|
+
}, rootProps.slotProps?.baseMenuList, {
|
|
100
|
+
children: [!printOptions?.disableToolbarButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_export.ExportPrint, {
|
|
101
|
+
render: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseMenuItem, (0, _extends2.default)({}, rootProps.slotProps?.baseMenuItem)),
|
|
102
|
+
options: printOptions,
|
|
103
|
+
onClick: closeExportMenu,
|
|
104
|
+
children: apiRef.current.getLocaleText('toolbarExportPrint')
|
|
105
|
+
}), !csvOptions?.disableToolbarButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_export.ExportCsv, {
|
|
106
|
+
render: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseMenuItem, (0, _extends2.default)({}, rootProps.slotProps?.baseMenuItem)),
|
|
107
|
+
options: csvOptions,
|
|
108
|
+
onClick: closeExportMenu,
|
|
109
|
+
children: apiRef.current.getLocaleText('toolbarExportCSV')
|
|
110
|
+
}), additionalExportMenuItems?.(closeExportMenu)]
|
|
111
|
+
}))
|
|
109
112
|
})]
|
|
110
113
|
}), showQuickFilter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridToolbarQuickFilter.GridToolbarQuickFilter, (0, _extends2.default)({}, quickFilterProps))]
|
|
111
114
|
});
|
|
@@ -8,7 +8,7 @@ export type ToolbarProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
8
8
|
render?: RenderProp<React.ComponentProps<typeof ToolbarRoot>>;
|
|
9
9
|
};
|
|
10
10
|
type OwnerState = DataGridProcessedProps;
|
|
11
|
-
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/
|
|
11
|
+
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & {
|
|
12
12
|
ownerState: OwnerState;
|
|
13
13
|
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
14
14
|
/**
|
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var
|
|
13
|
+
var _system = require("@mui/system");
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
15
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
16
16
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
@@ -30,7 +30,7 @@ const useUtilityClasses = ownerState => {
|
|
|
30
30
|
};
|
|
31
31
|
return (0, _composeClasses.default)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
32
32
|
};
|
|
33
|
-
const ToolbarRoot = (0,
|
|
33
|
+
const ToolbarRoot = (0, _system.styled)('div', {
|
|
34
34
|
name: 'MuiDataGrid',
|
|
35
35
|
slot: 'Toolbar'
|
|
36
36
|
})({
|
|
@@ -39,6 +39,8 @@ const ToolbarRoot = (0, _styles.styled)('div', {
|
|
|
39
39
|
alignItems: 'center',
|
|
40
40
|
gap: _cssVariables.vars.spacing(0.25),
|
|
41
41
|
padding: _cssVariables.vars.spacing(0.75),
|
|
42
|
+
minHeight: 52,
|
|
43
|
+
boxSizing: 'border-box',
|
|
42
44
|
borderBottom: `1px solid ${_cssVariables.vars.colors.border.base}`
|
|
43
45
|
});
|
|
44
46
|
|
|
@@ -64,44 +66,95 @@ const Toolbar = exports.Toolbar = (0, _forwardRef.forwardRef)(function Toolbar(p
|
|
|
64
66
|
const classes = useUtilityClasses(rootProps);
|
|
65
67
|
const [focusableItemId, setFocusableItemId] = React.useState(null);
|
|
66
68
|
const [items, setItems] = React.useState([]);
|
|
67
|
-
const registerItem = React.useCallback(
|
|
68
|
-
setItems(prevItems => [...prevItems,
|
|
69
|
+
const registerItem = React.useCallback((id, itemRef) => {
|
|
70
|
+
setItems(prevItems => [...prevItems, {
|
|
71
|
+
id,
|
|
72
|
+
ref: itemRef
|
|
73
|
+
}]);
|
|
69
74
|
}, []);
|
|
70
|
-
const unregisterItem = React.useCallback(
|
|
71
|
-
setItems(prevItems => prevItems.filter(i => i !==
|
|
72
|
-
if (focusableItemId ===
|
|
75
|
+
const unregisterItem = React.useCallback(id => {
|
|
76
|
+
setItems(prevItems => prevItems.filter(i => i.id !== id));
|
|
77
|
+
if (focusableItemId === id) {
|
|
73
78
|
setFocusableItemId(null);
|
|
74
79
|
}
|
|
75
80
|
}, [focusableItemId]);
|
|
81
|
+
const findEnabledItem = React.useCallback((startIndex, step, wrap = true) => {
|
|
82
|
+
let index = startIndex;
|
|
83
|
+
const itemCount = items.length;
|
|
84
|
+
|
|
85
|
+
// Look for enabled items in the specified direction
|
|
86
|
+
for (let i = 0; i < itemCount; i += 1) {
|
|
87
|
+
index += step;
|
|
88
|
+
|
|
89
|
+
// Handle wrapping around the ends
|
|
90
|
+
if (index >= itemCount) {
|
|
91
|
+
if (!wrap) {
|
|
92
|
+
return -1;
|
|
93
|
+
}
|
|
94
|
+
index = 0;
|
|
95
|
+
} else if (index < 0) {
|
|
96
|
+
if (!wrap) {
|
|
97
|
+
return -1;
|
|
98
|
+
}
|
|
99
|
+
index = itemCount - 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Return if we found an enabled item
|
|
103
|
+
if (!items[index].ref.current?.disabled && items[index].ref.current?.ariaDisabled !== 'true') {
|
|
104
|
+
return index;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// If we've checked all items and found none enabled
|
|
109
|
+
return -1;
|
|
110
|
+
}, [items]);
|
|
76
111
|
const onItemKeyDown = React.useCallback(event => {
|
|
77
112
|
if (!focusableItemId) {
|
|
78
113
|
return;
|
|
79
114
|
}
|
|
115
|
+
const currentIndex = items.findIndex(item => item.id === focusableItemId);
|
|
116
|
+
let newIndex = -1;
|
|
80
117
|
if (event.key === 'ArrowRight') {
|
|
81
118
|
event.preventDefault();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
if (event.key === 'ArrowLeft') {
|
|
119
|
+
newIndex = findEnabledItem(currentIndex, 1);
|
|
120
|
+
} else if (event.key === 'ArrowLeft') {
|
|
86
121
|
event.preventDefault();
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
if (event.key === 'Home') {
|
|
122
|
+
newIndex = findEnabledItem(currentIndex, -1);
|
|
123
|
+
} else if (event.key === 'Home') {
|
|
91
124
|
event.preventDefault();
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
if (event.key === 'End') {
|
|
125
|
+
newIndex = findEnabledItem(-1, 1, false);
|
|
126
|
+
} else if (event.key === 'End') {
|
|
95
127
|
event.preventDefault();
|
|
96
|
-
|
|
128
|
+
newIndex = findEnabledItem(items.length, -1, false);
|
|
129
|
+
}
|
|
130
|
+
if (newIndex >= 0 && newIndex < items.length) {
|
|
131
|
+
const item = items[newIndex];
|
|
132
|
+
setFocusableItemId(item.id);
|
|
133
|
+
item.ref.current?.focus();
|
|
134
|
+
}
|
|
135
|
+
}, [items, focusableItemId, findEnabledItem]);
|
|
136
|
+
const onItemFocus = React.useCallback(id => {
|
|
137
|
+
if (focusableItemId !== id) {
|
|
138
|
+
setFocusableItemId(id);
|
|
139
|
+
}
|
|
140
|
+
}, [focusableItemId]);
|
|
141
|
+
const onItemDisabled = React.useCallback(id => {
|
|
142
|
+
const currentIndex = items.findIndex(item => item.id === id);
|
|
143
|
+
const newIndex = findEnabledItem(currentIndex, 1);
|
|
144
|
+
if (newIndex >= 0 && newIndex < items.length) {
|
|
145
|
+
const item = items[newIndex];
|
|
146
|
+
setFocusableItemId(item.id);
|
|
147
|
+
item.ref.current?.focus();
|
|
97
148
|
}
|
|
98
|
-
}, [items,
|
|
149
|
+
}, [items, findEnabledItem]);
|
|
99
150
|
const contextValue = React.useMemo(() => ({
|
|
100
151
|
focusableItemId,
|
|
101
152
|
registerItem,
|
|
102
153
|
unregisterItem,
|
|
103
|
-
onItemKeyDown
|
|
104
|
-
|
|
154
|
+
onItemKeyDown,
|
|
155
|
+
onItemFocus,
|
|
156
|
+
onItemDisabled
|
|
157
|
+
}), [focusableItemId, registerItem, unregisterItem, onItemKeyDown, onItemFocus, onItemDisabled]);
|
|
105
158
|
const element = (0, _useGridComponentRenderer.useGridComponentRenderer)(ToolbarRoot, render, (0, _extends2.default)({
|
|
106
159
|
role: 'toolbar',
|
|
107
160
|
'aria-orientation': 'horizontal',
|
|
@@ -112,7 +165,7 @@ const Toolbar = exports.Toolbar = (0, _forwardRef.forwardRef)(function Toolbar(p
|
|
|
112
165
|
}));
|
|
113
166
|
React.useEffect(() => {
|
|
114
167
|
if (items.length > 0) {
|
|
115
|
-
setFocusableItemId(items[0]);
|
|
168
|
+
setFocusableItemId(items[0].id);
|
|
116
169
|
}
|
|
117
170
|
}, [items]);
|
|
118
171
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarContext.ToolbarContext.Provider, {
|
|
@@ -17,7 +17,7 @@ var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
|
17
17
|
var _useGridComponentRenderer = require("../../hooks/utils/useGridComponentRenderer");
|
|
18
18
|
var _ToolbarContext = require("./ToolbarContext");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["render"];
|
|
20
|
+
const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"];
|
|
21
21
|
/**
|
|
22
22
|
* A button for performing actions from the toolbar.
|
|
23
23
|
* It renders the `baseIconButton` slot.
|
|
@@ -32,7 +32,11 @@ const _excluded = ["render"];
|
|
|
32
32
|
*/
|
|
33
33
|
const ToolbarButton = exports.ToolbarButton = (0, _forwardRef.forwardRef)(function ToolbarButton(props, ref) {
|
|
34
34
|
const {
|
|
35
|
-
render
|
|
35
|
+
render,
|
|
36
|
+
onKeyDown,
|
|
37
|
+
onFocus,
|
|
38
|
+
disabled,
|
|
39
|
+
'aria-disabled': ariaDisabled
|
|
36
40
|
} = props,
|
|
37
41
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
38
42
|
const id = (0, _useId.default)();
|
|
@@ -43,28 +47,44 @@ const ToolbarButton = exports.ToolbarButton = (0, _forwardRef.forwardRef)(functi
|
|
|
43
47
|
focusableItemId,
|
|
44
48
|
registerItem,
|
|
45
49
|
unregisterItem,
|
|
46
|
-
onItemKeyDown
|
|
50
|
+
onItemKeyDown,
|
|
51
|
+
onItemFocus,
|
|
52
|
+
onItemDisabled
|
|
47
53
|
} = (0, _ToolbarContext.useToolbarContext)();
|
|
54
|
+
const handleKeyDown = event => {
|
|
55
|
+
onItemKeyDown(event);
|
|
56
|
+
onKeyDown?.(event);
|
|
57
|
+
};
|
|
58
|
+
const handleFocus = event => {
|
|
59
|
+
onItemFocus(id);
|
|
60
|
+
onFocus?.(event);
|
|
61
|
+
};
|
|
48
62
|
React.useEffect(() => {
|
|
49
|
-
registerItem(id);
|
|
63
|
+
registerItem(id, buttonRef);
|
|
50
64
|
return () => unregisterItem(id);
|
|
51
65
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
66
|
}, []);
|
|
53
|
-
const
|
|
67
|
+
const previousDisabled = React.useRef(disabled);
|
|
54
68
|
React.useEffect(() => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
isInitialFocus.current = false;
|
|
58
|
-
return;
|
|
69
|
+
if (previousDisabled.current !== disabled && disabled === true) {
|
|
70
|
+
onItemDisabled(id, disabled);
|
|
59
71
|
}
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
previousDisabled.current = disabled;
|
|
73
|
+
}, [disabled, id, onItemDisabled]);
|
|
74
|
+
const previousAriaDisabled = React.useRef(ariaDisabled);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
if (previousAriaDisabled.current !== ariaDisabled && ariaDisabled === true) {
|
|
77
|
+
onItemDisabled(id, true);
|
|
62
78
|
}
|
|
63
|
-
|
|
79
|
+
previousAriaDisabled.current = ariaDisabled;
|
|
80
|
+
}, [ariaDisabled, id, onItemDisabled]);
|
|
64
81
|
const element = (0, _useGridComponentRenderer.useGridComponentRenderer)(rootProps.slots.baseIconButton, render, (0, _extends2.default)({}, rootProps.slotProps?.baseIconButton, {
|
|
65
|
-
tabIndex: focusableItemId === id ? 0 : -1
|
|
66
|
-
onKeyDown: onItemKeyDown
|
|
82
|
+
tabIndex: focusableItemId === id ? 0 : -1
|
|
67
83
|
}, other, {
|
|
84
|
+
disabled,
|
|
85
|
+
'aria-disabled': ariaDisabled,
|
|
86
|
+
onKeyDown: handleKeyDown,
|
|
87
|
+
onFocus: handleFocus,
|
|
68
88
|
ref: handleRef
|
|
69
89
|
}));
|
|
70
90
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface ToolbarContextValue {
|
|
3
3
|
focusableItemId: string | null;
|
|
4
|
-
registerItem: (
|
|
5
|
-
unregisterItem: (
|
|
4
|
+
registerItem: (id: string, ref: React.RefObject<HTMLButtonElement | null>) => void;
|
|
5
|
+
unregisterItem: (id: string) => void;
|
|
6
6
|
onItemKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
7
|
+
onItemFocus: (id: string) => void;
|
|
8
|
+
onItemDisabled: (id: string, disabled: boolean) => void;
|
|
7
9
|
}
|
|
8
10
|
export declare const ToolbarContext: React.Context<ToolbarContextValue | undefined>;
|
|
9
11
|
export declare function useToolbarContext(): ToolbarContextValue;
|
|
@@ -631,6 +631,18 @@ export interface GridClasses {
|
|
|
631
631
|
* Styles applied to the toolbar prompt control send button element.
|
|
632
632
|
*/
|
|
633
633
|
toolbarPromptControlSendButton: string;
|
|
634
|
+
/**
|
|
635
|
+
* Styles applied to the toolbar quick filter root element.
|
|
636
|
+
*/
|
|
637
|
+
toolbarQuickFilter: string;
|
|
638
|
+
/**
|
|
639
|
+
* Styles applied to the toolbar quick filter trigger element.
|
|
640
|
+
*/
|
|
641
|
+
toolbarQuickFilterTrigger: string;
|
|
642
|
+
/**
|
|
643
|
+
* Styles applied to the toolbar quick filter control element.
|
|
644
|
+
*/
|
|
645
|
+
toolbarQuickFilterControl: string;
|
|
634
646
|
/**
|
|
635
647
|
* Styles applied the grid if `showColumnVerticalBorder={true}`.
|
|
636
648
|
*/
|
package/constants/gridClasses.js
CHANGED
|
@@ -9,4 +9,4 @@ var _utils = require("@mui/utils");
|
|
|
9
9
|
function getDataGridUtilityClass(slot) {
|
|
10
10
|
return (0, _utils.unstable_generateUtilityClass)('MuiDataGrid', slot);
|
|
11
11
|
}
|
|
12
|
-
const gridClasses = exports.gridClasses = (0, _utils.unstable_generateUtilityClasses)('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', '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', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'shadowScrollArea', 'toolbarContainer', 'toolbarFilterList', 'toolbarPromptControl', 'toolbarPromptControl--recording', 'toolbarPromptControlRecordingIndicator', 'toolbarPromptControlRecordButton', 'toolbarPromptControlSendButton', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom']);
|
|
12
|
+
const gridClasses = exports.gridClasses = (0, _utils.unstable_generateUtilityClasses)('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', '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', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'shadowScrollArea', 'toolbarContainer', 'toolbarFilterList', 'toolbarPromptControl', 'toolbarPromptControl--recording', 'toolbarPromptControlRecordingIndicator', 'toolbarPromptControlRecordButton', 'toolbarPromptControlSendButton', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom']);
|
package/esm/DataGrid/DataGrid.js
CHANGED
|
@@ -110,6 +110,7 @@ DataGridRaw.propTypes = {
|
|
|
110
110
|
* Override or extend the styles applied to the component.
|
|
111
111
|
*/
|
|
112
112
|
classes: PropTypes.object,
|
|
113
|
+
className: PropTypes.string,
|
|
113
114
|
/**
|
|
114
115
|
* The character used to separate cell values when copying to the clipboard.
|
|
115
116
|
* @default '\t'
|
|
@@ -769,6 +770,7 @@ DataGridRaw.propTypes = {
|
|
|
769
770
|
field: PropTypes.string.isRequired,
|
|
770
771
|
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
771
772
|
})),
|
|
773
|
+
style: PropTypes.object,
|
|
772
774
|
/**
|
|
773
775
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
774
776
|
*/
|
|
@@ -23,7 +23,7 @@ import { GRID_CHECKBOX_SELECTION_COL_DEF } from "../colDef/gridCheckboxSelection
|
|
|
23
23
|
import { GRID_ACTIONS_COLUMN_TYPE } from "../colDef/gridActionsColDef.js";
|
|
24
24
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD, PinnedColumnPosition } from "../internals/constants.js";
|
|
25
25
|
import { gridSortModelSelector } from "../hooks/features/sorting/gridSortingSelector.js";
|
|
26
|
-
import { gridRowMaximumTreeDepthSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
26
|
+
import { gridRowMaximumTreeDepthSelector, gridRowNodeSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
27
27
|
import { gridEditRowsStateSelector, gridRowIsEditingSelector } from "../hooks/features/editing/gridEditingSelectors.js";
|
|
28
28
|
import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFillerCell.js";
|
|
29
29
|
import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
|
|
@@ -79,7 +79,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
79
79
|
const rowReordering = rootProps.rowReordering;
|
|
80
80
|
const isRowReorderingEnabled = useGridSelector(apiRef, isRowReorderingEnabledSelector, rowReordering);
|
|
81
81
|
const handleRef = useForkRef(ref, refProp);
|
|
82
|
-
const rowNode = apiRef
|
|
82
|
+
const rowNode = gridRowNodeSelector(apiRef, rowId);
|
|
83
83
|
const editing = useGridSelector(apiRef, gridRowIsEditingSelector, {
|
|
84
84
|
rowId,
|
|
85
85
|
editMode: rootProps.editMode
|
|
@@ -192,7 +192,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
192
192
|
return rowStyle;
|
|
193
193
|
}, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
|
|
194
194
|
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
195
|
-
const ariaAttributes =
|
|
195
|
+
const ariaAttributes = getRowAriaAttributes(rowNode, index);
|
|
196
196
|
if (typeof rootProps.getRowClassName === 'function') {
|
|
197
197
|
const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
|
|
198
198
|
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
@@ -202,11 +202,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
202
202
|
});
|
|
203
203
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
204
204
|
}
|
|
205
|
-
|
|
206
|
-
/* Start of rendering */
|
|
207
|
-
if (!rowNode) {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
205
|
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
|
|
211
206
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
212
207
|
if (cellColSpanInfo?.spannedByColSpan) {
|
|
@@ -215,7 +210,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
215
210
|
const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
|
|
216
211
|
const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
|
|
217
212
|
const pinnedOffset = getPinnedCellOffset(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
|
|
218
|
-
if (rowNode
|
|
213
|
+
if (rowNode.type === 'skeletonRow') {
|
|
219
214
|
return /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
220
215
|
type: column.type,
|
|
221
216
|
width: width,
|
|
@@ -17,48 +17,56 @@ const detectScroll = keyframes({
|
|
|
17
17
|
'--scrollable': '" "'
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
+
|
|
21
|
+
// This `styled()` function invokes keyframes. `styled-components` only supports keyframes
|
|
22
|
+
// in string templates. Do not convert these styles in JS object as it will break.
|
|
20
23
|
const ShadowScrollArea = styled('div', {
|
|
21
24
|
name: 'MuiDataGrid',
|
|
22
25
|
slot: 'ShadowScrollArea'
|
|
23
|
-
})
|
|
24
|
-
flex: 1
|
|
25
|
-
display:
|
|
26
|
-
|
|
27
|
-
animation: detectScroll
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
overflow:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
})`
|
|
27
|
+
flex: 1;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
animation: ${detectScroll};
|
|
31
|
+
animation-timeline: --scroll-timeline;
|
|
32
|
+
animation-fill-mode: none;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
overflow: auto;
|
|
35
|
+
scroll-timeline: --scroll-timeline block;
|
|
36
|
+
|
|
37
|
+
&::before,
|
|
38
|
+
&::after {
|
|
39
|
+
content: '';
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
display: block;
|
|
42
|
+
position: sticky;
|
|
43
|
+
left: 0;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 4px;
|
|
46
|
+
animation: ${reveal} linear both;
|
|
47
|
+
animation-timeline: --scroll-timeline;
|
|
48
|
+
|
|
43
49
|
// Custom property toggle trick:
|
|
44
50
|
// - Detects if the element is scrollable
|
|
45
51
|
// - https://css-tricks.com/the-css-custom-property-toggle-trick/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
visibility:
|
|
49
|
-
},
|
|
50
|
-
'&::before': {
|
|
51
|
-
top: 0,
|
|
52
|
-
background: 'linear-gradient(to bottom, rgba(0,0,0,0.05) 0, transparent 100%)',
|
|
53
|
-
animationRange: '0 4px'
|
|
54
|
-
},
|
|
55
|
-
'&::after': {
|
|
56
|
-
bottom: 0,
|
|
57
|
-
background: 'linear-gradient(to top, rgba(0,0,0,0.05) 0, transparent 100%)',
|
|
58
|
-
animationDirection: 'reverse',
|
|
59
|
-
animationRange: 'calc(100% - 4px) 100%'
|
|
52
|
+
--visibility-scrollable: var(--scrollable) visible;
|
|
53
|
+
--visibility-not-scrollable: hidden;
|
|
54
|
+
visibility: var(--visibility-scrollable, var(--visibility-not-scrollable));
|
|
60
55
|
}
|
|
61
|
-
|
|
56
|
+
|
|
57
|
+
&::before {
|
|
58
|
+
top: 0;
|
|
59
|
+
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0, transparent 100%);
|
|
60
|
+
animation-range: 0 4px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&::after {
|
|
64
|
+
bottom: 0;
|
|
65
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.05) 0, transparent 100%);
|
|
66
|
+
animation-direction: reverse;
|
|
67
|
+
animation-range: calc(100% - 4px) 100%;
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
62
70
|
|
|
63
71
|
/**
|
|
64
72
|
* Adds scroll shadows above and below content in a scrollable container.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SvgIconProps } from '@mui/material/SvgIcon';
|
|
3
2
|
import type { GridColDef } from '../../models/colDef/gridColDef';
|
|
4
3
|
import type { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
5
|
-
interface GridBooleanCellProps extends GridRenderCellParams
|
|
4
|
+
interface GridBooleanCellProps extends GridRenderCellParams {
|
|
6
5
|
hideDescendantCount?: boolean;
|
|
7
6
|
}
|
|
8
7
|
declare function GridBooleanCellRaw(props: GridBooleanCellProps): React.JSX.Element | null;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { GridSlotProps } from '../../models/gridSlotsComponentsProps';
|
|
3
3
|
import { GridRenderEditCellParams } from "../../models/params/gridCellParams.js";
|
|
4
|
-
export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams
|
|
4
|
+
export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams {
|
|
5
5
|
/**
|
|
6
6
|
* Callback called when the value is changed by the user.
|
|
7
|
-
* @param {
|
|
7
|
+
* @param {Event<any>} event The event source of the callback.
|
|
8
8
|
* @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
9
9
|
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
10
10
|
*/
|
|
11
|
-
onValueChange?: (event:
|
|
11
|
+
onValueChange?: (event: Parameters<NonNullable<GridSlotProps['baseSelect']['onOpen']>>[0], newValue: any) => Promise<void> | void;
|
|
12
12
|
/**
|
|
13
13
|
* If true, the select opens by default.
|
|
14
14
|
*/
|
|
@@ -162,7 +162,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
162
162
|
isValidating: PropTypes.bool,
|
|
163
163
|
/**
|
|
164
164
|
* Callback called when the value is changed by the user.
|
|
165
|
-
* @param {
|
|
165
|
+
* @param {Event<any>} event The event source of the callback.
|
|
166
166
|
* @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
167
167
|
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
168
168
|
*/
|
|
@@ -10,6 +10,7 @@ import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
|
10
10
|
import { vars } from "../../constants/cssVariables.js";
|
|
11
11
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
12
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
13
|
+
import { Toolbar } from "../toolbarV8/index.js";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const useUtilityClasses = ownerState => {
|
|
15
16
|
const {
|
|
@@ -20,16 +21,17 @@ const useUtilityClasses = ownerState => {
|
|
|
20
21
|
};
|
|
21
22
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
22
23
|
};
|
|
23
|
-
const GridToolbarContainerRoot = styled(
|
|
24
|
+
const GridToolbarContainerRoot = styled(Toolbar, {
|
|
24
25
|
name: 'MuiDataGrid',
|
|
25
26
|
slot: 'ToolbarContainer',
|
|
26
|
-
|
|
27
|
+
shouldForwardProp: prop => prop !== 'ownerState'
|
|
27
28
|
})({
|
|
28
29
|
display: 'flex',
|
|
29
30
|
alignItems: 'center',
|
|
30
31
|
flexWrap: 'wrap',
|
|
31
32
|
gap: vars.spacing(1),
|
|
32
|
-
padding: vars.spacing(0.5,
|
|
33
|
+
padding: vars.spacing(0.5),
|
|
34
|
+
minHeight: 'auto'
|
|
33
35
|
});
|
|
34
36
|
const GridToolbarContainer = forwardRef(function GridToolbarContainer(props, ref) {
|
|
35
37
|
const {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { QuickFilterState } from "./QuickFilterContext.js";
|
|
3
|
+
import { RenderProp } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
2
4
|
import type { GridFilterModel } from '../../models';
|
|
3
|
-
export type QuickFilterProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
+
export type QuickFilterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> & {
|
|
5
6
|
/**
|
|
6
7
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
7
8
|
* @param {string} input The value entered by the user
|
|
@@ -21,10 +22,32 @@ export type QuickFilterProps = {
|
|
|
21
22
|
* @default 150
|
|
22
23
|
*/
|
|
23
24
|
debounceMs?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The default expanded state of the quick filter control.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
defaultExpanded?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The expanded state of the quick filter control.
|
|
32
|
+
*/
|
|
33
|
+
expanded?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* A function to customize rendering of the component.
|
|
36
|
+
*/
|
|
37
|
+
render?: RenderProp<React.ComponentProps<'div'>, QuickFilterState>;
|
|
38
|
+
/**
|
|
39
|
+
* Override or extend the styles applied to the component.
|
|
40
|
+
*/
|
|
41
|
+
className?: string | ((state: QuickFilterState) => string);
|
|
42
|
+
/**
|
|
43
|
+
* Callback function that is called when the quick filter input is expanded or collapsed.
|
|
44
|
+
* @param {boolean} expanded The new expanded state of the quick filter control
|
|
45
|
+
*/
|
|
46
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
24
47
|
};
|
|
25
48
|
/**
|
|
26
49
|
* The top level Quick Filter component that provides context to child components.
|
|
27
|
-
* It
|
|
50
|
+
* It renders a `<div />` element.
|
|
28
51
|
*
|
|
29
52
|
* Demos:
|
|
30
53
|
*
|