@mui/x-data-grid 5.8.0 → 5.9.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 +141 -63
- package/DataGrid/DataGrid.js +1 -1
- package/DataGrid/useDataGridComponent.js +3 -1
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/components/GridRow.d.ts +4 -0
- package/components/GridRow.js +49 -23
- package/components/base/GridOverlays.js +4 -3
- package/components/cell/GridActionsCell.d.ts +5 -1
- package/components/cell/GridActionsCell.js +170 -21
- package/components/cell/GridActionsCellItem.d.ts +66 -4
- package/components/cell/GridActionsCellItem.js +7 -5
- package/components/cell/GridCell.d.ts +1 -0
- package/components/cell/GridCell.js +28 -7
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/cell/GridEditSingleSelectCell.js +22 -13
- package/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/components/columnHeaders/GridColumnHeaders.d.ts +0 -1
- package/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +3 -3
- package/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/components/panel/GridPanel.js +1 -0
- package/components/panel/filterPanel/GridFilterForm.js +14 -10
- package/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -15
- package/components/panel/filterPanel/GridFilterInputValue.js +22 -15
- package/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.js +2 -0
- package/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/constants/gridDetailPanelToggleField.d.ts +1 -0
- package/constants/gridDetailPanelToggleField.js +2 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +32 -15
- package/hooks/core/pipeProcessing/index.d.ts +1 -0
- package/hooks/core/pipeProcessing/index.js +2 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +8 -3
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +3 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +0 -3
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +0 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +76 -10
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +19 -1
- package/hooks/features/columns/gridColumnsUtils.js +61 -8
- package/hooks/features/columns/useGridColumnSpanning.d.ts +7 -0
- package/hooks/features/columns/useGridColumnSpanning.js +109 -0
- package/hooks/features/columns/useGridColumns.js +24 -18
- package/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/hooks/features/editRows/useGridRowEditing.new.js +23 -15
- package/hooks/features/filter/useGridFilter.js +14 -9
- package/hooks/features/focus/useGridFocus.js +19 -9
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +39 -7
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -0
- package/hooks/features/rows/gridRowsSelector.js +1 -0
- package/hooks/features/rows/gridRowsState.d.ts +4 -0
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +5 -4
- package/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/hooks/features/scroll/useGridScroll.d.ts +2 -0
- package/hooks/features/scroll/useGridScroll.js +25 -3
- package/hooks/features/selection/useGridSelection.js +3 -2
- package/hooks/features/sorting/useGridSorting.js +10 -10
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +7 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +54 -27
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/legacy/DataGrid/DataGrid.js +1 -1
- package/legacy/DataGrid/useDataGridComponent.js +3 -1
- package/legacy/components/GridRow.js +47 -23
- package/legacy/components/base/GridOverlays.js +4 -3
- package/legacy/components/cell/GridActionsCell.js +188 -27
- package/legacy/components/cell/GridActionsCellItem.js +7 -5
- package/legacy/components/cell/GridCell.js +29 -7
- package/legacy/components/cell/GridEditInputCell.js +1 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +33 -24
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/legacy/components/columnHeaders/GridColumnHeaders.js +2 -3
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +21 -3
- package/legacy/components/panel/GridPanel.js +1 -0
- package/legacy/components/panel/filterPanel/GridFilterForm.js +14 -10
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -17
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +22 -17
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/legacy/components/virtualization/GridVirtualScroller.js +2 -0
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/legacy/constants/gridDetailPanelToggleField.js +2 -0
- package/legacy/hooks/core/pipeProcessing/index.js +2 -1
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +60 -24
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +89 -10
- package/legacy/hooks/features/columns/gridColumnsUtils.js +79 -22
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +107 -0
- package/legacy/hooks/features/columns/useGridColumns.js +24 -18
- package/legacy/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -8
- package/legacy/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +32 -24
- package/legacy/hooks/features/filter/useGridFilter.js +14 -9
- package/legacy/hooks/features/focus/useGridFocus.js +19 -9
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +39 -6
- package/legacy/hooks/features/rows/gridRowsSelector.js +3 -0
- package/legacy/hooks/features/rows/useGridRows.js +5 -4
- package/legacy/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/legacy/hooks/features/scroll/useGridScroll.js +25 -3
- package/legacy/hooks/features/selection/useGridSelection.js +3 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +5 -7
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +65 -37
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/locales/huHU.js +120 -0
- package/legacy/locales/index.js +1 -0
- package/legacy/models/api/gridColumnSpanning.js +1 -0
- package/legacy/models/events/gridEvents.js +2 -3
- package/legacy/models/gridColumnSpanning.js +1 -0
- package/locales/huHU.d.ts +2 -0
- package/locales/huHU.js +108 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/models/api/gridApiCommon.d.ts +2 -1
- package/models/api/gridColumnSpanning.d.ts +28 -0
- package/models/api/gridColumnSpanning.js +1 -0
- package/models/api/gridEditingApi.d.ts +49 -3
- package/models/colDef/gridColDef.d.ts +5 -0
- package/models/events/gridEventLookup.d.ts +3 -8
- package/models/events/gridEvents.d.ts +9 -14
- package/models/events/gridEvents.js +2 -3
- package/models/gridColumnSpanning.d.ts +12 -0
- package/models/gridColumnSpanning.js +1 -0
- package/models/gridEditRowModel.d.ts +1 -1
- package/models/params/gridCellParams.d.ts +12 -2
- package/models/params/gridRowParams.d.ts +5 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +1 -1
- package/modern/DataGrid/useDataGridComponent.js +3 -1
- package/modern/components/GridRow.js +47 -21
- package/modern/components/base/GridOverlays.js +4 -3
- package/modern/components/cell/GridActionsCell.js +168 -21
- package/modern/components/cell/GridActionsCellItem.js +7 -5
- package/modern/components/cell/GridCell.js +28 -7
- package/modern/components/cell/GridEditInputCell.js +1 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +20 -11
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/modern/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/modern/components/panel/GridPanel.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterForm.js +10 -6
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +11 -6
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +20 -13
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +20 -13
- package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +2 -0
- package/modern/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/modern/constants/gridDetailPanelToggleField.js +2 -0
- package/modern/hooks/core/pipeProcessing/index.js +2 -1
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +76 -10
- package/modern/hooks/features/columns/gridColumnsUtils.js +61 -8
- package/modern/hooks/features/columns/useGridColumnSpanning.js +107 -0
- package/modern/hooks/features/columns/useGridColumns.js +24 -18
- package/modern/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/modern/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +23 -15
- package/modern/hooks/features/filter/useGridFilter.js +14 -9
- package/modern/hooks/features/focus/useGridFocus.js +19 -9
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +37 -7
- package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
- package/modern/hooks/features/rows/useGridRows.js +5 -4
- package/modern/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/modern/hooks/features/scroll/useGridScroll.js +23 -3
- package/modern/hooks/features/selection/useGridSelection.js +3 -2
- package/modern/hooks/features/sorting/useGridSorting.js +10 -10
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +54 -23
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/locales/huHU.js +108 -0
- package/modern/locales/index.js +1 -0
- package/modern/models/api/gridColumnSpanning.js +1 -0
- package/modern/models/events/gridEvents.js +2 -3
- package/modern/models/gridColumnSpanning.js +1 -0
- package/node/DataGrid/DataGrid.js +1 -1
- package/node/DataGrid/useDataGridComponent.js +4 -1
- package/node/components/GridRow.js +50 -23
- package/node/components/base/GridOverlays.js +3 -2
- package/node/components/cell/GridActionsCell.js +172 -21
- package/node/components/cell/GridActionsCellItem.js +7 -4
- package/node/components/cell/GridCell.js +28 -7
- package/node/components/cell/GridEditInputCell.js +1 -1
- package/node/components/cell/GridEditSingleSelectCell.js +23 -13
- package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/node/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/node/components/panel/GridPanel.js +1 -0
- package/node/components/panel/filterPanel/GridFilterForm.js +15 -10
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +14 -8
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +23 -15
- package/node/components/panel/filterPanel/GridFilterInputValue.js +23 -15
- package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +2 -0
- package/node/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/node/constants/gridDetailPanelToggleField.js +9 -0
- package/node/hooks/core/pipeProcessing/index.js +13 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +51 -20
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +42 -0
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +80 -10
- package/node/hooks/features/columns/gridColumnsUtils.js +65 -9
- package/node/hooks/features/columns/useGridColumnSpanning.js +130 -0
- package/node/hooks/features/columns/useGridColumns.js +23 -17
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/node/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/node/hooks/features/editRows/useGridEditing.new.js +6 -2
- package/node/hooks/features/editRows/useGridRowEditing.new.js +21 -14
- package/node/hooks/features/filter/useGridFilter.js +14 -9
- package/node/hooks/features/focus/useGridFocus.js +19 -9
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +40 -7
- package/node/hooks/features/rows/gridRowsSelector.js +3 -1
- package/node/hooks/features/rows/useGridRows.js +5 -4
- package/node/hooks/features/rows/useGridRowsMeta.js +6 -14
- package/node/hooks/features/scroll/useGridScroll.js +26 -2
- package/node/hooks/features/selection/useGridSelection.js +4 -2
- package/node/hooks/features/sorting/useGridSorting.js +10 -10
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +59 -27
- package/node/index.js +1 -1
- package/node/internals/index.js +8 -0
- package/node/locales/huHU.js +118 -0
- package/node/locales/index.js +13 -0
- package/node/models/api/gridColumnSpanning.js +5 -0
- package/node/models/events/gridEvents.js +2 -3
- package/node/models/gridColumnSpanning.js +5 -0
- package/package.json +4 -4
- package/utils/domUtils.d.ts +2 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["colDef", "id", "api", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "getValue", "tabIndex", "position", "focusElementRef"];
|
|
3
5
|
import * as React from 'react';
|
|
4
6
|
import PropTypes from 'prop-types';
|
|
5
7
|
import IconButton from '@mui/material/IconButton';
|
|
@@ -8,6 +10,7 @@ import { unstable_useId as useId } from '@mui/material/utils';
|
|
|
8
10
|
import { gridClasses } from '../../constants/gridClasses';
|
|
9
11
|
import { GridMenu } from '../menu/GridMenu';
|
|
10
12
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
16
|
|
|
@@ -16,23 +19,42 @@ var hasActions = function hasActions(colDef) {
|
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
var GridActionsCell = function GridActionsCell(props) {
|
|
19
|
-
var
|
|
22
|
+
var colDef = props.colDef,
|
|
23
|
+
id = props.id,
|
|
24
|
+
api = props.api,
|
|
25
|
+
hasFocus = props.hasFocus,
|
|
26
|
+
isEditable = props.isEditable,
|
|
27
|
+
field = props.field,
|
|
28
|
+
value = props.value,
|
|
29
|
+
formattedValue = props.formattedValue,
|
|
30
|
+
row = props.row,
|
|
31
|
+
rowNode = props.rowNode,
|
|
32
|
+
cellMode = props.cellMode,
|
|
33
|
+
getValue = props.getValue,
|
|
34
|
+
tabIndex = props.tabIndex,
|
|
35
|
+
_props$position = props.position,
|
|
36
|
+
position = _props$position === void 0 ? 'bottom-end' : _props$position,
|
|
37
|
+
focusElementRef = props.focusElementRef,
|
|
38
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
39
|
+
|
|
40
|
+
var _React$useState = React.useState(-1),
|
|
20
41
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
21
|
-
|
|
22
|
-
|
|
42
|
+
focusedButtonIndex = _React$useState2[0],
|
|
43
|
+
setFocusedButtonIndex = _React$useState2[1];
|
|
44
|
+
|
|
45
|
+
var _React$useState3 = React.useState(false),
|
|
46
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
47
|
+
open = _React$useState4[0],
|
|
48
|
+
setOpen = _React$useState4[1];
|
|
23
49
|
|
|
50
|
+
var apiRef = useGridApiContext();
|
|
51
|
+
var rootRef = React.useRef(null);
|
|
24
52
|
var buttonRef = React.useRef(null);
|
|
53
|
+
var ignoreCallToFocus = React.useRef(false);
|
|
25
54
|
var touchRippleRefs = React.useRef({});
|
|
26
55
|
var menuId = useId();
|
|
27
56
|
var buttonId = useId();
|
|
28
57
|
var rootProps = useGridRootProps();
|
|
29
|
-
var colDef = props.colDef,
|
|
30
|
-
id = props.id,
|
|
31
|
-
api = props.api,
|
|
32
|
-
hasFocus = props.hasFocus,
|
|
33
|
-
_props$position = props.position,
|
|
34
|
-
position = _props$position === void 0 ? 'bottom-end' : _props$position; // TODO apply the rest to the root element
|
|
35
|
-
|
|
36
58
|
React.useLayoutEffect(function () {
|
|
37
59
|
if (!hasFocus) {
|
|
38
60
|
Object.entries(touchRippleRefs.current).forEach(function (_ref) {
|
|
@@ -46,26 +68,53 @@ var GridActionsCell = function GridActionsCell(props) {
|
|
|
46
68
|
});
|
|
47
69
|
}
|
|
48
70
|
}, [hasFocus]);
|
|
71
|
+
React.useEffect(function () {
|
|
72
|
+
if (focusedButtonIndex >= 0) {
|
|
73
|
+
var _rootRef$current;
|
|
74
|
+
|
|
75
|
+
var child = (_rootRef$current = rootRef.current) == null ? void 0 : _rootRef$current.children[focusedButtonIndex];
|
|
76
|
+
child.focus();
|
|
77
|
+
}
|
|
78
|
+
}, [focusedButtonIndex]);
|
|
79
|
+
React.useEffect(function () {
|
|
80
|
+
if (!hasFocus) {
|
|
81
|
+
setFocusedButtonIndex(-1);
|
|
82
|
+
ignoreCallToFocus.current = false;
|
|
83
|
+
}
|
|
84
|
+
}, [hasFocus]);
|
|
85
|
+
React.useImperativeHandle(focusElementRef, function () {
|
|
86
|
+
return {
|
|
87
|
+
focus: function focus() {
|
|
88
|
+
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
89
|
+
if (!ignoreCallToFocus.current) {
|
|
90
|
+
setFocusedButtonIndex(0);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}, []);
|
|
49
95
|
|
|
50
96
|
if (!hasActions(colDef)) {
|
|
51
97
|
throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
|
|
52
98
|
}
|
|
53
99
|
|
|
54
|
-
var
|
|
55
|
-
return setOpen(true);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var hideMenu = function hideMenu() {
|
|
59
|
-
return setOpen(false);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var options = colDef.getActions(api.getRowParams(id));
|
|
100
|
+
var options = colDef.getActions(apiRef.current.getRowParams(id));
|
|
63
101
|
var iconButtons = options.filter(function (option) {
|
|
64
102
|
return !option.props.showInMenu;
|
|
65
103
|
});
|
|
66
104
|
var menuButtons = options.filter(function (option) {
|
|
67
105
|
return option.props.showInMenu;
|
|
68
106
|
});
|
|
107
|
+
var numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
|
|
108
|
+
|
|
109
|
+
var showMenu = function showMenu() {
|
|
110
|
+
setOpen(true);
|
|
111
|
+
setFocusedButtonIndex(numberOfButtons - 1);
|
|
112
|
+
ignoreCallToFocus.current = true;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
var hideMenu = function hideMenu() {
|
|
116
|
+
setOpen(false);
|
|
117
|
+
};
|
|
69
118
|
|
|
70
119
|
var handleTouchRippleRef = function handleTouchRippleRef(index) {
|
|
71
120
|
return function (instance) {
|
|
@@ -73,35 +122,95 @@ var GridActionsCell = function GridActionsCell(props) {
|
|
|
73
122
|
};
|
|
74
123
|
};
|
|
75
124
|
|
|
76
|
-
|
|
125
|
+
var handleButtonClick = function handleButtonClick(index, onClick) {
|
|
126
|
+
return function (event) {
|
|
127
|
+
setFocusedButtonIndex(index);
|
|
128
|
+
ignoreCallToFocus.current = true;
|
|
129
|
+
|
|
130
|
+
if (onClick) {
|
|
131
|
+
onClick(event);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
var handleRootKeyDown = function handleRootKeyDown(event) {
|
|
137
|
+
if (numberOfButtons <= 1) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
var newIndex = focusedButtonIndex;
|
|
142
|
+
|
|
143
|
+
if (event.key === 'ArrowRight') {
|
|
144
|
+
newIndex += 1;
|
|
145
|
+
} else if (event.key === 'ArrowLeft') {
|
|
146
|
+
newIndex -= 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
150
|
+
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (newIndex !== focusedButtonIndex) {
|
|
154
|
+
event.preventDefault(); // Prevent scrolling
|
|
155
|
+
|
|
156
|
+
event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
|
|
157
|
+
|
|
158
|
+
setFocusedButtonIndex(newIndex);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
var handleListKeyDown = function handleListKeyDown(event) {
|
|
163
|
+
if (event.key === 'Tab') {
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
|
|
168
|
+
hideMenu();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return /*#__PURE__*/_jsxs("div", _extends({
|
|
173
|
+
role: "menu",
|
|
174
|
+
ref: rootRef,
|
|
175
|
+
tabIndex: -1,
|
|
77
176
|
className: gridClasses.actionsCell,
|
|
177
|
+
onKeyDown: handleRootKeyDown
|
|
178
|
+
}, other, {
|
|
78
179
|
children: [iconButtons.map(function (button, index) {
|
|
79
180
|
return /*#__PURE__*/React.cloneElement(button, {
|
|
80
181
|
key: index,
|
|
81
|
-
touchRippleRef: handleTouchRippleRef(index)
|
|
182
|
+
touchRippleRef: handleTouchRippleRef(index),
|
|
183
|
+
onClick: handleButtonClick(index, button.props.onClick),
|
|
184
|
+
tabIndex: focusedButtonIndex === index ? tabIndex : -1
|
|
82
185
|
});
|
|
83
|
-
}), menuButtons.length > 0 && /*#__PURE__*/_jsx(IconButton, {
|
|
186
|
+
}), menuButtons.length > 0 && buttonId && /*#__PURE__*/_jsx(IconButton, {
|
|
84
187
|
ref: buttonRef,
|
|
85
188
|
id: buttonId,
|
|
86
|
-
"aria-label":
|
|
189
|
+
"aria-label": apiRef.current.getLocaleText('actionsCellMore'),
|
|
87
190
|
"aria-controls": menuId,
|
|
88
191
|
"aria-expanded": open ? 'true' : undefined,
|
|
89
192
|
"aria-haspopup": "true",
|
|
193
|
+
role: "menuitem",
|
|
90
194
|
size: "small",
|
|
91
195
|
onClick: showMenu,
|
|
196
|
+
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
197
|
+
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1,
|
|
92
198
|
children: /*#__PURE__*/_jsx(rootProps.components.MoreActionsIcon, {
|
|
93
199
|
fontSize: "small"
|
|
94
200
|
})
|
|
95
201
|
}), menuButtons.length > 0 && /*#__PURE__*/_jsx(GridMenu, {
|
|
96
|
-
id: menuId,
|
|
97
202
|
onClickAway: hideMenu,
|
|
98
203
|
onClick: hideMenu,
|
|
99
204
|
open: open,
|
|
100
205
|
target: buttonRef.current,
|
|
101
206
|
position: position,
|
|
102
|
-
"aria-labelledby": buttonId,
|
|
103
207
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
208
|
+
id: menuId,
|
|
104
209
|
className: gridClasses.menuList,
|
|
210
|
+
onKeyDown: handleListKeyDown,
|
|
211
|
+
"aria-labelledby": buttonId,
|
|
212
|
+
variant: "menu",
|
|
213
|
+
autoFocusItem: true,
|
|
105
214
|
children: menuButtons.map(function (button, index) {
|
|
106
215
|
return /*#__PURE__*/React.cloneElement(button, {
|
|
107
216
|
key: index
|
|
@@ -109,7 +218,7 @@ var GridActionsCell = function GridActionsCell(props) {
|
|
|
109
218
|
})
|
|
110
219
|
})
|
|
111
220
|
})]
|
|
112
|
-
});
|
|
221
|
+
}));
|
|
113
222
|
};
|
|
114
223
|
|
|
115
224
|
process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
@@ -124,11 +233,42 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
124
233
|
*/
|
|
125
234
|
api: PropTypes.any.isRequired,
|
|
126
235
|
|
|
236
|
+
/**
|
|
237
|
+
* The mode of the cell.
|
|
238
|
+
*/
|
|
239
|
+
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
240
|
+
|
|
127
241
|
/**
|
|
128
242
|
* The column of the row that the current cell belongs to.
|
|
129
243
|
*/
|
|
130
244
|
colDef: PropTypes.object.isRequired,
|
|
131
245
|
|
|
246
|
+
/**
|
|
247
|
+
* The column field of the cell that triggered the event.
|
|
248
|
+
*/
|
|
249
|
+
field: PropTypes.string.isRequired,
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* A ref allowing to set imperative focus.
|
|
253
|
+
* It can be passed to the element that should receive focus.
|
|
254
|
+
* @ignore - do not document.
|
|
255
|
+
*/
|
|
256
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
257
|
+
current: PropTypes.shape({
|
|
258
|
+
focus: PropTypes.func.isRequired
|
|
259
|
+
})
|
|
260
|
+
})]),
|
|
261
|
+
formattedValue: PropTypes.any,
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Get the cell value of a row and field.
|
|
265
|
+
* @param {GridRowId} id The row id.
|
|
266
|
+
* @param {string} field The field.
|
|
267
|
+
* @returns {any} The cell value.
|
|
268
|
+
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
269
|
+
*/
|
|
270
|
+
getValue: PropTypes.func.isRequired,
|
|
271
|
+
|
|
132
272
|
/**
|
|
133
273
|
* If true, the cell is the active element.
|
|
134
274
|
*/
|
|
@@ -138,7 +278,28 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
138
278
|
* The grid row id.
|
|
139
279
|
*/
|
|
140
280
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
141
|
-
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* If true, the cell is editable.
|
|
284
|
+
*/
|
|
285
|
+
isEditable: PropTypes.bool,
|
|
286
|
+
position: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* The row model of the row that the current cell belongs to.
|
|
290
|
+
*/
|
|
291
|
+
row: PropTypes.object.isRequired,
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* The node of the row that the current cell belongs to.
|
|
295
|
+
*/
|
|
296
|
+
rowNode: PropTypes.object.isRequired,
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* the tabIndex value.
|
|
300
|
+
*/
|
|
301
|
+
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
302
|
+
value: PropTypes.any
|
|
142
303
|
} : void 0;
|
|
143
304
|
export { GridActionsCell };
|
|
144
305
|
export var renderActionsCell = function renderActionsCell(params) {
|
|
@@ -8,8 +8,7 @@ import MenuItem from '@mui/material/MenuItem';
|
|
|
8
8
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
|
|
12
|
-
var GridActionsCellItem = function GridActionsCellItem(props) {
|
|
11
|
+
var GridActionsCellItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
13
12
|
var label = props.label,
|
|
14
13
|
icon = props.icon,
|
|
15
14
|
showInMenu = props.showInMenu,
|
|
@@ -24,7 +23,9 @@ var GridActionsCellItem = function GridActionsCellItem(props) {
|
|
|
24
23
|
|
|
25
24
|
if (!showInMenu) {
|
|
26
25
|
return /*#__PURE__*/_jsx(IconButton, _extends({
|
|
26
|
+
ref: ref,
|
|
27
27
|
size: "small",
|
|
28
|
+
role: "menuitem",
|
|
28
29
|
"aria-label": label
|
|
29
30
|
}, other, {
|
|
30
31
|
onClick: handleClick,
|
|
@@ -34,14 +35,15 @@ var GridActionsCellItem = function GridActionsCellItem(props) {
|
|
|
34
35
|
}));
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
38
|
+
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
39
|
+
ref: ref
|
|
40
|
+
}, other, {
|
|
38
41
|
onClick: onClick,
|
|
39
42
|
children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
|
|
40
43
|
children: icon
|
|
41
44
|
}), label]
|
|
42
45
|
}));
|
|
43
|
-
};
|
|
44
|
-
|
|
46
|
+
});
|
|
45
47
|
process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
|
|
46
48
|
// ----------------------------- Warning --------------------------------
|
|
47
49
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["align", "children", "colIndex", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
|
|
3
|
+
var _excluded = ["align", "children", "colIndex", "colDef", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
|
|
4
4
|
|
|
5
5
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
6
6
|
import * as React from 'react';
|
|
@@ -51,6 +51,7 @@ function GridCell(props) {
|
|
|
51
51
|
var align = props.align,
|
|
52
52
|
children = props.children,
|
|
53
53
|
colIndex = props.colIndex,
|
|
54
|
+
colDef = props.colDef,
|
|
54
55
|
cellMode = props.cellMode,
|
|
55
56
|
field = props.field,
|
|
56
57
|
formattedValue = props.formattedValue,
|
|
@@ -65,6 +66,7 @@ function GridCell(props) {
|
|
|
65
66
|
showRightBorder = props.showRightBorder,
|
|
66
67
|
extendRowFullWidth = props.extendRowFullWidth,
|
|
67
68
|
row = props.row,
|
|
69
|
+
colSpan = props.colSpan,
|
|
68
70
|
onClick = props.onClick,
|
|
69
71
|
onDoubleClick = props.onDoubleClick,
|
|
70
72
|
onMouseDown = props.onMouseDown,
|
|
@@ -76,6 +78,7 @@ function GridCell(props) {
|
|
|
76
78
|
|
|
77
79
|
var valueToRender = formattedValue == null ? value : formattedValue;
|
|
78
80
|
var cellRef = React.useRef(null);
|
|
81
|
+
var focusElementRef = React.useRef(null);
|
|
79
82
|
var apiRef = useGridApiContext();
|
|
80
83
|
var rootProps = useGridRootProps();
|
|
81
84
|
var ownerState = {
|
|
@@ -130,7 +133,7 @@ function GridCell(props) {
|
|
|
130
133
|
|
|
131
134
|
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
132
135
|
var focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
133
|
-
var elementToFocus = focusableElement || cellRef.current;
|
|
136
|
+
var elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
|
|
134
137
|
|
|
135
138
|
if (doesSupportPreventScroll()) {
|
|
136
139
|
elementToFocus.focus({
|
|
@@ -164,6 +167,26 @@ function GridCell(props) {
|
|
|
164
167
|
};
|
|
165
168
|
}
|
|
166
169
|
|
|
170
|
+
var column = apiRef.current.getColumn(field);
|
|
171
|
+
var managesOwnFocus = column.type === 'actions';
|
|
172
|
+
|
|
173
|
+
var renderChildren = function renderChildren() {
|
|
174
|
+
if (children == null) {
|
|
175
|
+
return /*#__PURE__*/_jsx("div", {
|
|
176
|
+
className: classes.content,
|
|
177
|
+
children: valueToRender == null ? void 0 : valueToRender.toString()
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
|
|
182
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
183
|
+
focusElementRef: focusElementRef
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return children;
|
|
188
|
+
};
|
|
189
|
+
|
|
167
190
|
return /*#__PURE__*/_jsx("div", _extends({
|
|
168
191
|
ref: cellRef,
|
|
169
192
|
className: clsx(className, classes.root),
|
|
@@ -171,8 +194,9 @@ function GridCell(props) {
|
|
|
171
194
|
"data-field": field,
|
|
172
195
|
"data-colindex": colIndex,
|
|
173
196
|
"aria-colindex": colIndex + 1,
|
|
197
|
+
"aria-colspan": colSpan,
|
|
174
198
|
style: style,
|
|
175
|
-
tabIndex: cellMode === 'view' || !isEditable ? tabIndex : -1,
|
|
199
|
+
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
176
200
|
onClick: publish(GridEvents.cellClick, onClick),
|
|
177
201
|
onDoubleClick: publish(GridEvents.cellDoubleClick, onDoubleClick),
|
|
178
202
|
onMouseDown: publish(GridEvents.cellMouseDown, onMouseDown),
|
|
@@ -182,10 +206,7 @@ function GridCell(props) {
|
|
|
182
206
|
onDragOver: publish(GridEvents.cellDragOver, onDragOver)
|
|
183
207
|
}, other, {
|
|
184
208
|
onFocus: handleFocus,
|
|
185
|
-
children:
|
|
186
|
-
className: classes.content,
|
|
187
|
-
children: valueToRender == null ? void 0 : valueToRender.toString()
|
|
188
|
-
})
|
|
209
|
+
children: renderChildren()
|
|
189
210
|
}));
|
|
190
211
|
}
|
|
191
212
|
|
|
@@ -199,6 +220,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
199
220
|
children: PropTypes.node,
|
|
200
221
|
className: PropTypes.string,
|
|
201
222
|
colIndex: PropTypes.number.isRequired,
|
|
223
|
+
colSpan: PropTypes.number,
|
|
202
224
|
field: PropTypes.string.isRequired,
|
|
203
225
|
formattedValue: PropTypes.any,
|
|
204
226
|
hasFocus: PropTypes.bool,
|
|
@@ -134,7 +134,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
134
134
|
/**
|
|
135
135
|
* The cell value formatted with the column valueFormatter.
|
|
136
136
|
*/
|
|
137
|
-
formattedValue: PropTypes.any
|
|
137
|
+
formattedValue: PropTypes.any,
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Get the cell value of a row and field.
|
|
@@ -13,20 +13,22 @@ import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
|
13
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
14
14
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
15
15
|
import { GridEvents } from '../../models/events/gridEvents';
|
|
16
|
+
import { getValueFromValueOptions } from '../panel/filterPanel/filterPanelUtils';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
|
|
18
|
-
var renderSingleSelectOptions = function renderSingleSelectOptions(option) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
var renderSingleSelectOptions = function renderSingleSelectOptions(option, OptionComponent) {
|
|
20
|
+
var isOptionTypeObject = _typeof(option) === 'object';
|
|
21
|
+
var key = isOptionTypeObject ? option.value : option;
|
|
22
|
+
var value = isOptionTypeObject ? option.value : option;
|
|
23
|
+
var content = isOptionTypeObject ? option.label : option;
|
|
24
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
25
|
+
value: value,
|
|
26
|
+
children: content
|
|
27
|
+
}, key);
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
function GridEditSingleSelectCell(props) {
|
|
29
|
-
var _rootProps$components;
|
|
31
|
+
var _rootProps$components, _baseSelectProps$nati, _rootProps$components2;
|
|
30
32
|
|
|
31
33
|
var id = props.id,
|
|
32
34
|
value = props.value,
|
|
@@ -56,6 +58,8 @@ function GridEditSingleSelectCell(props) {
|
|
|
56
58
|
open = _React$useState2[0],
|
|
57
59
|
setOpen = _React$useState2[1];
|
|
58
60
|
|
|
61
|
+
var baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
62
|
+
var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : false;
|
|
59
63
|
var valueOptionsFormatted;
|
|
60
64
|
|
|
61
65
|
if (typeof colDef.valueOptions === 'function') {
|
|
@@ -90,46 +94,48 @@ function GridEditSingleSelectCell(props) {
|
|
|
90
94
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
91
95
|
var _rootProps$experiment;
|
|
92
96
|
|
|
93
|
-
var target, isValid, canCommit, params;
|
|
97
|
+
var target, formattedTargetValue, isValid, canCommit, params;
|
|
94
98
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
95
99
|
while (1) {
|
|
96
100
|
switch (_context.prev = _context.next) {
|
|
97
101
|
case 0:
|
|
98
102
|
setOpen(false);
|
|
99
|
-
target = event.target;
|
|
100
|
-
|
|
103
|
+
target = event.target; // NativeSelect casts the value to a string.
|
|
104
|
+
|
|
105
|
+
formattedTargetValue = getValueFromValueOptions(target.value, valueOptionsFormatted);
|
|
106
|
+
_context.next = 5;
|
|
101
107
|
return api.setEditCellValue({
|
|
102
108
|
id: id,
|
|
103
109
|
field: field,
|
|
104
|
-
value:
|
|
110
|
+
value: formattedTargetValue
|
|
105
111
|
}, event);
|
|
106
112
|
|
|
107
|
-
case
|
|
113
|
+
case 5:
|
|
108
114
|
isValid = _context.sent;
|
|
109
115
|
|
|
110
116
|
if (!((_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.newEditingApi)) {
|
|
111
|
-
_context.next =
|
|
117
|
+
_context.next = 8;
|
|
112
118
|
break;
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
return _context.abrupt("return");
|
|
116
122
|
|
|
117
|
-
case
|
|
123
|
+
case 8:
|
|
118
124
|
if (!(rootProps.editMode === GridEditModes.Row || isValid === false)) {
|
|
119
|
-
_context.next =
|
|
125
|
+
_context.next = 10;
|
|
120
126
|
break;
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
return _context.abrupt("return");
|
|
124
130
|
|
|
125
|
-
case
|
|
126
|
-
_context.next =
|
|
131
|
+
case 10:
|
|
132
|
+
_context.next = 12;
|
|
127
133
|
return Promise.resolve(api.commitCellChange({
|
|
128
134
|
id: id,
|
|
129
135
|
field: field
|
|
130
136
|
}, event));
|
|
131
137
|
|
|
132
|
-
case
|
|
138
|
+
case 12:
|
|
133
139
|
canCommit = _context.sent;
|
|
134
140
|
|
|
135
141
|
if (canCommit) {
|
|
@@ -142,7 +148,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
142
148
|
}
|
|
143
149
|
}
|
|
144
150
|
|
|
145
|
-
case
|
|
151
|
+
case 14:
|
|
146
152
|
case "end":
|
|
147
153
|
return _context.stop();
|
|
148
154
|
}
|
|
@@ -196,9 +202,12 @@ function GridEditSingleSelectCell(props) {
|
|
|
196
202
|
onClose: handleClose
|
|
197
203
|
},
|
|
198
204
|
error: error,
|
|
205
|
+
native: isSelectNative,
|
|
199
206
|
fullWidth: true
|
|
200
|
-
}, other, (_rootProps$
|
|
201
|
-
children: valueOptionsFormatted.map(
|
|
207
|
+
}, other, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect, {
|
|
208
|
+
children: valueOptionsFormatted.map(function (valueOptions) {
|
|
209
|
+
return renderSingleSelectOptions(valueOptions, isSelectNative ? 'option' : MenuItem);
|
|
210
|
+
})
|
|
202
211
|
}));
|
|
203
212
|
}
|
|
204
213
|
|
|
@@ -232,7 +241,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
232
241
|
/**
|
|
233
242
|
* The cell value formatted with the column valueFormatter.
|
|
234
243
|
*/
|
|
235
|
-
formattedValue: PropTypes.any
|
|
244
|
+
formattedValue: PropTypes.any,
|
|
236
245
|
|
|
237
246
|
/**
|
|
238
247
|
* Get the cell value of a row and field.
|
|
@@ -162,14 +162,11 @@ function GridColumnHeaderItem(props) {
|
|
|
162
162
|
|
|
163
163
|
if (hasFocus && !columnMenuState.open) {
|
|
164
164
|
var focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
} else {
|
|
169
|
-
headerCellRef.current.focus();
|
|
170
|
-
}
|
|
165
|
+
var elementToFocus = focusableElement || headerCellRef.current;
|
|
166
|
+
elementToFocus == null ? void 0 : elementToFocus.focus();
|
|
167
|
+
apiRef.current.columnHeadersContainerElementRef.current.scrollLeft = 0;
|
|
171
168
|
}
|
|
172
|
-
});
|
|
169
|
+
}, [apiRef, hasFocus]);
|
|
173
170
|
var headerClassName = typeof column.headerClassName === 'function' ? column.headerClassName({
|
|
174
171
|
field: column.field,
|
|
175
172
|
colDef: column
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["
|
|
3
|
+
var _excluded = ["className"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -40,8 +40,7 @@ var GridColumnHeadersRoot = styled('div', {
|
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
42
|
export var GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeaders(props, ref) {
|
|
43
|
-
var
|
|
44
|
-
className = props.className,
|
|
43
|
+
var className = props.className,
|
|
45
44
|
other = _objectWithoutProperties(props, _excluded);
|
|
46
45
|
|
|
47
46
|
var rootProps = useGridRootProps();
|