@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,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _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
|
+
const _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';
|
|
@@ -66,6 +66,7 @@ function GridCell(props) {
|
|
|
66
66
|
width,
|
|
67
67
|
className,
|
|
68
68
|
showRightBorder,
|
|
69
|
+
colSpan,
|
|
69
70
|
onClick,
|
|
70
71
|
onDoubleClick,
|
|
71
72
|
onMouseDown,
|
|
@@ -78,6 +79,7 @@ function GridCell(props) {
|
|
|
78
79
|
|
|
79
80
|
const valueToRender = formattedValue == null ? value : formattedValue;
|
|
80
81
|
const cellRef = React.useRef(null);
|
|
82
|
+
const focusElementRef = React.useRef(null);
|
|
81
83
|
const apiRef = useGridApiContext();
|
|
82
84
|
const rootProps = useGridRootProps();
|
|
83
85
|
const ownerState = {
|
|
@@ -128,7 +130,7 @@ function GridCell(props) {
|
|
|
128
130
|
|
|
129
131
|
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
130
132
|
const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
131
|
-
const elementToFocus = focusableElement || cellRef.current;
|
|
133
|
+
const elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
|
|
132
134
|
|
|
133
135
|
if (doesSupportPreventScroll()) {
|
|
134
136
|
elementToFocus.focus({
|
|
@@ -162,6 +164,26 @@ function GridCell(props) {
|
|
|
162
164
|
};
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
const column = apiRef.current.getColumn(field);
|
|
168
|
+
const managesOwnFocus = column.type === 'actions';
|
|
169
|
+
|
|
170
|
+
const renderChildren = () => {
|
|
171
|
+
if (children == null) {
|
|
172
|
+
return /*#__PURE__*/_jsx("div", {
|
|
173
|
+
className: classes.content,
|
|
174
|
+
children: valueToRender == null ? void 0 : valueToRender.toString()
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
|
|
179
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
180
|
+
focusElementRef
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return children;
|
|
185
|
+
};
|
|
186
|
+
|
|
165
187
|
return /*#__PURE__*/_jsx("div", _extends({
|
|
166
188
|
ref: cellRef,
|
|
167
189
|
className: clsx(className, classes.root),
|
|
@@ -169,8 +191,9 @@ function GridCell(props) {
|
|
|
169
191
|
"data-field": field,
|
|
170
192
|
"data-colindex": colIndex,
|
|
171
193
|
"aria-colindex": colIndex + 1,
|
|
194
|
+
"aria-colspan": colSpan,
|
|
172
195
|
style: style,
|
|
173
|
-
tabIndex: cellMode === 'view' || !isEditable ? tabIndex : -1,
|
|
196
|
+
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
174
197
|
onClick: publish(GridEvents.cellClick, onClick),
|
|
175
198
|
onDoubleClick: publish(GridEvents.cellDoubleClick, onDoubleClick),
|
|
176
199
|
onMouseDown: publish(GridEvents.cellMouseDown, onMouseDown),
|
|
@@ -180,10 +203,7 @@ function GridCell(props) {
|
|
|
180
203
|
onDragOver: publish(GridEvents.cellDragOver, onDragOver)
|
|
181
204
|
}, other, {
|
|
182
205
|
onFocus: handleFocus,
|
|
183
|
-
children:
|
|
184
|
-
className: classes.content,
|
|
185
|
-
children: valueToRender == null ? void 0 : valueToRender.toString()
|
|
186
|
-
})
|
|
206
|
+
children: renderChildren()
|
|
187
207
|
}));
|
|
188
208
|
}
|
|
189
209
|
|
|
@@ -197,6 +217,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
197
217
|
children: PropTypes.node,
|
|
198
218
|
className: PropTypes.string,
|
|
199
219
|
colIndex: PropTypes.number.isRequired,
|
|
220
|
+
colSpan: PropTypes.number,
|
|
200
221
|
field: PropTypes.string.isRequired,
|
|
201
222
|
formattedValue: PropTypes.any,
|
|
202
223
|
hasFocus: PropTypes.bool,
|
|
@@ -120,7 +120,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
120
120
|
/**
|
|
121
121
|
* The cell value formatted with the column valueFormatter.
|
|
122
122
|
*/
|
|
123
|
-
formattedValue: PropTypes.any
|
|
123
|
+
formattedValue: PropTypes.any,
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* Get the cell value of a row and field.
|
|
@@ -9,18 +9,22 @@ import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
11
11
|
import { GridEvents } from '../../models/events/gridEvents';
|
|
12
|
+
import { getValueFromValueOptions } from '../panel/filterPanel/filterPanelUtils';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
|
|
14
|
-
const renderSingleSelectOptions = option =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const renderSingleSelectOptions = (option, OptionComponent) => {
|
|
16
|
+
const isOptionTypeObject = typeof option === 'object';
|
|
17
|
+
const key = isOptionTypeObject ? option.value : option;
|
|
18
|
+
const value = isOptionTypeObject ? option.value : option;
|
|
19
|
+
const content = isOptionTypeObject ? option.label : option;
|
|
20
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
21
|
+
value: value,
|
|
22
|
+
children: content
|
|
23
|
+
}, key);
|
|
24
|
+
};
|
|
21
25
|
|
|
22
26
|
function GridEditSingleSelectCell(props) {
|
|
23
|
-
var _rootProps$components;
|
|
27
|
+
var _rootProps$components, _baseSelectProps$nati, _rootProps$components2;
|
|
24
28
|
|
|
25
29
|
const {
|
|
26
30
|
id,
|
|
@@ -38,6 +42,8 @@ function GridEditSingleSelectCell(props) {
|
|
|
38
42
|
const inputRef = React.useRef();
|
|
39
43
|
const rootProps = useGridRootProps();
|
|
40
44
|
const [open, setOpen] = React.useState(rootProps.editMode === 'cell');
|
|
45
|
+
const baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
46
|
+
const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : false;
|
|
41
47
|
let valueOptionsFormatted;
|
|
42
48
|
|
|
43
49
|
if (typeof colDef.valueOptions === 'function') {
|
|
@@ -72,11 +78,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
72
78
|
var _rootProps$experiment;
|
|
73
79
|
|
|
74
80
|
setOpen(false);
|
|
75
|
-
const target = event.target;
|
|
81
|
+
const target = event.target; // NativeSelect casts the value to a string.
|
|
82
|
+
|
|
83
|
+
const formattedTargetValue = getValueFromValueOptions(target.value, valueOptionsFormatted);
|
|
76
84
|
const isValid = await api.setEditCellValue({
|
|
77
85
|
id,
|
|
78
86
|
field,
|
|
79
|
-
value:
|
|
87
|
+
value: formattedTargetValue
|
|
80
88
|
}, event);
|
|
81
89
|
|
|
82
90
|
if ((_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.newEditingApi) {
|
|
@@ -145,9 +153,10 @@ function GridEditSingleSelectCell(props) {
|
|
|
145
153
|
onClose: handleClose
|
|
146
154
|
},
|
|
147
155
|
error: error,
|
|
156
|
+
native: isSelectNative,
|
|
148
157
|
fullWidth: true
|
|
149
|
-
}, other, (_rootProps$
|
|
150
|
-
children: valueOptionsFormatted.map(renderSingleSelectOptions)
|
|
158
|
+
}, other, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect, {
|
|
159
|
+
children: valueOptionsFormatted.map(valueOptions => renderSingleSelectOptions(valueOptions, isSelectNative ? 'option' : MenuItem))
|
|
151
160
|
}));
|
|
152
161
|
}
|
|
153
162
|
|
|
@@ -181,7 +190,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
181
190
|
/**
|
|
182
191
|
* The cell value formatted with the column valueFormatter.
|
|
183
192
|
*/
|
|
184
|
-
formattedValue: PropTypes.any
|
|
193
|
+
formattedValue: PropTypes.any,
|
|
185
194
|
|
|
186
195
|
/**
|
|
187
196
|
* Get the cell value of a row and field.
|
|
@@ -158,14 +158,11 @@ function GridColumnHeaderItem(props) {
|
|
|
158
158
|
|
|
159
159
|
if (hasFocus && !columnMenuState.open) {
|
|
160
160
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
} else {
|
|
165
|
-
headerCellRef.current.focus();
|
|
166
|
-
}
|
|
161
|
+
const elementToFocus = focusableElement || headerCellRef.current;
|
|
162
|
+
elementToFocus == null ? void 0 : elementToFocus.focus();
|
|
163
|
+
apiRef.current.columnHeadersContainerElementRef.current.scrollLeft = 0;
|
|
167
164
|
}
|
|
168
|
-
});
|
|
165
|
+
}, [apiRef, hasFocus]);
|
|
169
166
|
const headerClassName = typeof column.headerClassName === 'function' ? column.headerClassName({
|
|
170
167
|
field: column.field,
|
|
171
168
|
colDef: column
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface GridColumnHeadersProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
innerRef?: React.Ref<HTMLDivElement>;
|
|
4
3
|
}
|
|
5
4
|
export declare const GridColumnHeaders: React.ForwardRefExoticComponent<GridColumnHeadersProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
5
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["className"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare const GridCellCheckboxForwardRef: React.ForwardRefExoticComponent<
|
|
2
|
+
import { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
3
|
+
declare const GridCellCheckboxForwardRef: React.ForwardRefExoticComponent<GridRenderCellParams<any, any, any> & React.RefAttributes<HTMLInputElement>>;
|
|
4
4
|
export { GridCellCheckboxForwardRef };
|
|
5
|
-
export declare const GridCellCheckboxRenderer: React.MemoExoticComponent<React.ForwardRefExoticComponent<
|
|
5
|
+
export declare const GridCellCheckboxRenderer: React.MemoExoticComponent<React.ForwardRefExoticComponent<GridRenderCellParams<any, any, any> & React.RefAttributes<HTMLInputElement>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["field", "id", "value", "formattedValue", "row", "rowNode", "colDef", "isEditable", "cellMode", "hasFocus", "tabIndex", "getValue"];
|
|
3
|
+
const _excluded = ["field", "id", "value", "formattedValue", "row", "rowNode", "colDef", "isEditable", "cellMode", "hasFocus", "tabIndex", "getValue", "api"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -101,6 +101,12 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
101
101
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
102
102
|
// ----------------------------------------------------------------------
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* GridApi that let you manipulate the grid.
|
|
106
|
+
* @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
|
|
107
|
+
*/
|
|
108
|
+
api: PropTypes.any.isRequired,
|
|
109
|
+
|
|
104
110
|
/**
|
|
105
111
|
* The mode of the cell.
|
|
106
112
|
*/
|
|
@@ -116,10 +122,21 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
116
122
|
*/
|
|
117
123
|
field: PropTypes.string.isRequired,
|
|
118
124
|
|
|
125
|
+
/**
|
|
126
|
+
* A ref allowing to set imperative focus.
|
|
127
|
+
* It can be passed to the element that should receive focus.
|
|
128
|
+
* @ignore - do not document.
|
|
129
|
+
*/
|
|
130
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
131
|
+
current: PropTypes.shape({
|
|
132
|
+
focus: PropTypes.func.isRequired
|
|
133
|
+
})
|
|
134
|
+
})]),
|
|
135
|
+
|
|
119
136
|
/**
|
|
120
137
|
* The cell value formatted with the column valueFormatter.
|
|
121
138
|
*/
|
|
122
|
-
formattedValue: PropTypes.any
|
|
139
|
+
formattedValue: PropTypes.any,
|
|
123
140
|
|
|
124
141
|
/**
|
|
125
142
|
* Get the cell value of a row and field.
|
|
@@ -163,7 +180,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
163
180
|
/**
|
|
164
181
|
* The cell value, but if the column has valueGetter, use getValue.
|
|
165
182
|
*/
|
|
166
|
-
value: PropTypes.any
|
|
183
|
+
value: PropTypes.any
|
|
167
184
|
} : void 0;
|
|
168
185
|
export { GridCellCheckboxForwardRef };
|
|
169
186
|
export const GridCellCheckboxRenderer = /*#__PURE__*/React.memo(GridCellCheckboxForwardRef);
|
|
@@ -82,6 +82,7 @@ const GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
82
82
|
modifiers: modifiers
|
|
83
83
|
}, other, {
|
|
84
84
|
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
|
85
|
+
mouseEvent: "onMouseUp",
|
|
85
86
|
onClickAway: handleClickAway,
|
|
86
87
|
children: /*#__PURE__*/_jsx(GridPaperRoot, {
|
|
87
88
|
className: classes.paper,
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
5
5
|
import IconButton from '@mui/material/IconButton';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
6
7
|
import InputLabel from '@mui/material/InputLabel';
|
|
7
8
|
import FormControl from '@mui/material/FormControl';
|
|
8
9
|
import { capitalize, unstable_useId as useId } from '@mui/material/utils';
|
|
@@ -103,7 +104,7 @@ const getColumnLabel = col => col.headerName || col.field;
|
|
|
103
104
|
const collator = new Intl.Collator();
|
|
104
105
|
|
|
105
106
|
function GridFilterForm(props) {
|
|
106
|
-
var _rootProps$components, _rootProps$components2, _rootProps$components3, _rootProps$components4, _currentColumn$filter2;
|
|
107
|
+
var _rootProps$components, _rootProps$components2, _baseSelectProps$nati, _rootProps$components3, _rootProps$components4, _rootProps$components5, _currentColumn$filter2;
|
|
107
108
|
|
|
108
109
|
const {
|
|
109
110
|
item,
|
|
@@ -138,6 +139,9 @@ function GridFilterForm(props) {
|
|
|
138
139
|
const filterSelectorRef = React.useRef(null);
|
|
139
140
|
const hasLinkOperatorColumn = hasMultipleFilters && linkOperators.length > 0;
|
|
140
141
|
const baseFormControlProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseFormControl) || {};
|
|
142
|
+
const baseSelectProps = ((_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect) || {};
|
|
143
|
+
const isBaseSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
144
|
+
const OptionComponent = isBaseSelectNative ? 'option' : MenuItem;
|
|
141
145
|
const sortedFilterableColumns = React.useMemo(() => {
|
|
142
146
|
switch (columnsSort) {
|
|
143
147
|
case 'asc':
|
|
@@ -251,9 +255,9 @@ function GridFilterForm(props) {
|
|
|
251
255
|
value: multiFilterOperator,
|
|
252
256
|
onChange: changeLinkOperator,
|
|
253
257
|
disabled: !!disableMultiFilterOperator || linkOperators.length === 1,
|
|
254
|
-
native:
|
|
255
|
-
}, (_rootProps$
|
|
256
|
-
children: linkOperators.map(linkOperator => /*#__PURE__*/_jsx(
|
|
258
|
+
native: isBaseSelectNative
|
|
259
|
+
}, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseSelect, {
|
|
260
|
+
children: linkOperators.map(linkOperator => /*#__PURE__*/_jsx(OptionComponent, {
|
|
257
261
|
value: linkOperator.toString(),
|
|
258
262
|
children: apiRef.current.getLocaleText(getLinkOperatorLocaleKey(linkOperator))
|
|
259
263
|
}, linkOperator.toString()))
|
|
@@ -273,9 +277,9 @@ function GridFilterForm(props) {
|
|
|
273
277
|
label: apiRef.current.getLocaleText('filterPanelColumns'),
|
|
274
278
|
value: item.columnField || '',
|
|
275
279
|
onChange: changeColumn,
|
|
276
|
-
native:
|
|
277
|
-
}, (_rootProps$
|
|
278
|
-
children: sortedFilterableColumns.map(col => /*#__PURE__*/_jsx(
|
|
280
|
+
native: isBaseSelectNative
|
|
281
|
+
}, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseSelect, {
|
|
282
|
+
children: sortedFilterableColumns.map(col => /*#__PURE__*/_jsx(OptionComponent, {
|
|
279
283
|
value: col.field,
|
|
280
284
|
children: getColumnLabel(col)
|
|
281
285
|
}, col.field))
|
|
@@ -295,10 +299,10 @@ function GridFilterForm(props) {
|
|
|
295
299
|
id: operatorSelectId,
|
|
296
300
|
value: item.operatorValue,
|
|
297
301
|
onChange: changeOperator,
|
|
298
|
-
native:
|
|
302
|
+
native: isBaseSelectNative,
|
|
299
303
|
inputRef: filterSelectorRef
|
|
300
|
-
}, (_rootProps$
|
|
301
|
-
children: currentColumn == null ? void 0 : (_currentColumn$filter2 = currentColumn.filterOperators) == null ? void 0 : _currentColumn$filter2.map(operator => /*#__PURE__*/_jsx(
|
|
304
|
+
}, (_rootProps$components5 = rootProps.componentsProps) == null ? void 0 : _rootProps$components5.baseSelect, {
|
|
305
|
+
children: currentColumn == null ? void 0 : (_currentColumn$filter2 = currentColumn.filterOperators) == null ? void 0 : _currentColumn$filter2.map(operator => /*#__PURE__*/_jsx(OptionComponent, {
|
|
302
306
|
value: operator.value,
|
|
303
307
|
children: operator.label || apiRef.current.getLocaleText(`filterOperator${capitalize(operator.value)}`)
|
|
304
308
|
}, operator.value))
|
|
@@ -2,11 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
5
6
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
export function GridFilterInputBoolean(props) {
|
|
9
|
-
var _rootProps$components;
|
|
10
|
+
var _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
|
|
10
11
|
|
|
11
12
|
const {
|
|
12
13
|
item,
|
|
@@ -18,6 +19,9 @@ export function GridFilterInputBoolean(props) {
|
|
|
18
19
|
|
|
19
20
|
const [filterValueState, setFilterValueState] = React.useState(item.value || '');
|
|
20
21
|
const rootProps = useGridRootProps();
|
|
22
|
+
const baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
23
|
+
const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
24
|
+
const OptionComponent = isSelectNative ? 'option' : MenuItem;
|
|
21
25
|
const onFilterChange = React.useCallback(event => {
|
|
22
26
|
const value = event.target.value;
|
|
23
27
|
setFilterValueState(value);
|
|
@@ -34,21 +38,22 @@ export function GridFilterInputBoolean(props) {
|
|
|
34
38
|
onChange: onFilterChange,
|
|
35
39
|
variant: "standard",
|
|
36
40
|
select: true,
|
|
37
|
-
SelectProps: {
|
|
38
|
-
native:
|
|
39
|
-
|
|
41
|
+
SelectProps: _extends({
|
|
42
|
+
native: isSelectNative,
|
|
43
|
+
displayEmpty: true
|
|
44
|
+
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect),
|
|
40
45
|
InputLabelProps: {
|
|
41
46
|
shrink: true
|
|
42
47
|
},
|
|
43
48
|
inputRef: focusElementRef
|
|
44
|
-
}, others, (_rootProps$
|
|
45
|
-
children: [/*#__PURE__*/_jsx(
|
|
49
|
+
}, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField, {
|
|
50
|
+
children: [/*#__PURE__*/_jsx(OptionComponent, {
|
|
46
51
|
value: "",
|
|
47
52
|
children: apiRef.current.getLocaleText('filterValueAny')
|
|
48
|
-
}), /*#__PURE__*/_jsx(
|
|
53
|
+
}), /*#__PURE__*/_jsx(OptionComponent, {
|
|
49
54
|
value: "true",
|
|
50
55
|
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
51
|
-
}), /*#__PURE__*/_jsx(
|
|
56
|
+
}), /*#__PURE__*/_jsx(OptionComponent, {
|
|
52
57
|
value: "false",
|
|
53
58
|
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
54
59
|
})]
|
|
@@ -4,6 +4,7 @@ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
7
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
7
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
8
9
|
import { getValueFromValueOptions } from './filterPanelUtils';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -12,25 +13,29 @@ const renderSingleSelectOptions = ({
|
|
|
12
13
|
valueOptions,
|
|
13
14
|
valueFormatter,
|
|
14
15
|
field
|
|
15
|
-
}, api) => {
|
|
16
|
+
}, api, OptionComponent) => {
|
|
16
17
|
const iterableColumnValues = typeof valueOptions === 'function' ? ['', ...valueOptions({
|
|
17
18
|
field
|
|
18
19
|
})] : ['', ...(valueOptions || [])];
|
|
19
|
-
return iterableColumnValues.map(option =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
children: valueFormatter && option !== '' ? valueFormatter({
|
|
20
|
+
return iterableColumnValues.map(option => {
|
|
21
|
+
const isOptionTypeObject = typeof option === 'object';
|
|
22
|
+
const key = isOptionTypeObject ? option.value : option;
|
|
23
|
+
const value = isOptionTypeObject ? option.value : option;
|
|
24
|
+
const formattedValue = valueFormatter && option !== '' ? valueFormatter({
|
|
25
25
|
value: option,
|
|
26
26
|
field,
|
|
27
27
|
api
|
|
28
|
-
}) : option
|
|
29
|
-
|
|
28
|
+
}) : option;
|
|
29
|
+
const content = isOptionTypeObject ? option.label : formattedValue;
|
|
30
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
31
|
+
value: value,
|
|
32
|
+
children: content
|
|
33
|
+
}, key);
|
|
34
|
+
});
|
|
30
35
|
};
|
|
31
36
|
|
|
32
37
|
function GridFilterInputSingleSelect(props) {
|
|
33
|
-
var _item$value, _rootProps$components;
|
|
38
|
+
var _item$value, _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
|
|
34
39
|
|
|
35
40
|
const {
|
|
36
41
|
item,
|
|
@@ -44,6 +49,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
44
49
|
const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) != null ? _item$value : '');
|
|
45
50
|
const id = useId();
|
|
46
51
|
const rootProps = useGridRootProps();
|
|
52
|
+
const baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
53
|
+
const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
47
54
|
const currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
48
55
|
const currentValueOptions = React.useMemo(() => {
|
|
49
56
|
return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({
|
|
@@ -94,11 +101,11 @@ function GridFilterInputSingleSelect(props) {
|
|
|
94
101
|
},
|
|
95
102
|
inputRef: focusElementRef,
|
|
96
103
|
select: true,
|
|
97
|
-
SelectProps: {
|
|
98
|
-
native:
|
|
99
|
-
}
|
|
100
|
-
}, others, (_rootProps$
|
|
101
|
-
children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current)
|
|
104
|
+
SelectProps: _extends({
|
|
105
|
+
native: isSelectNative
|
|
106
|
+
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect)
|
|
107
|
+
}, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField, {
|
|
108
|
+
children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current, isSelectNative ? 'option' : MenuItem)
|
|
102
109
|
}));
|
|
103
110
|
}
|
|
104
111
|
|
|
@@ -4,6 +4,7 @@ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
7
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
7
8
|
import { GridLoadIcon } from '../../icons';
|
|
8
9
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
9
10
|
import { getValueFromValueOptions } from './filterPanelUtils';
|
|
@@ -19,27 +20,31 @@ const renderSingleSelectOptions = ({
|
|
|
19
20
|
valueOptions,
|
|
20
21
|
valueFormatter,
|
|
21
22
|
field
|
|
22
|
-
}, api) => {
|
|
23
|
+
}, api, OptionComponent) => {
|
|
23
24
|
const iterableColumnValues = typeof valueOptions === 'function' ? ['', ...valueOptions({
|
|
24
25
|
field
|
|
25
26
|
})] : ['', ...(valueOptions || [])];
|
|
26
|
-
return iterableColumnValues.map(option =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
children: valueFormatter && option !== '' ? valueFormatter({
|
|
27
|
+
return iterableColumnValues.map(option => {
|
|
28
|
+
const isOptionTypeObject = typeof option === 'object';
|
|
29
|
+
const key = isOptionTypeObject ? option.value : option;
|
|
30
|
+
const value = isOptionTypeObject ? option.value : option;
|
|
31
|
+
const formattedValue = valueFormatter && option !== '' ? valueFormatter({
|
|
32
32
|
value: option,
|
|
33
33
|
field,
|
|
34
34
|
api
|
|
35
|
-
}) : option
|
|
36
|
-
|
|
35
|
+
}) : option;
|
|
36
|
+
const content = isOptionTypeObject ? option.label : formattedValue;
|
|
37
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
38
|
+
value: value,
|
|
39
|
+
children: content
|
|
40
|
+
}, key);
|
|
41
|
+
});
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
export const SUBMIT_FILTER_STROKE_TIME = 500;
|
|
40
45
|
|
|
41
46
|
function GridFilterInputValue(props) {
|
|
42
|
-
var _item$value, _rootProps$components;
|
|
47
|
+
var _item$value, _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
|
|
43
48
|
|
|
44
49
|
const {
|
|
45
50
|
item,
|
|
@@ -59,12 +64,14 @@ function GridFilterInputValue(props) {
|
|
|
59
64
|
const [applying, setIsApplying] = React.useState(false);
|
|
60
65
|
const id = useId();
|
|
61
66
|
const rootProps = useGridRootProps();
|
|
67
|
+
const baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
68
|
+
const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
62
69
|
const singleSelectProps = type === 'singleSelect' ? {
|
|
63
70
|
select: true,
|
|
64
|
-
SelectProps: {
|
|
65
|
-
native:
|
|
66
|
-
},
|
|
67
|
-
children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current)
|
|
71
|
+
SelectProps: _extends({
|
|
72
|
+
native: isSelectNative
|
|
73
|
+
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect),
|
|
74
|
+
children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current, isSelectNative ? 'option' : MenuItem)
|
|
68
75
|
} : {};
|
|
69
76
|
const onFilterChange = React.useCallback(event => {
|
|
70
77
|
let value = event.target.value; // NativeSelect casts the value to a string.
|
|
@@ -115,7 +122,7 @@ function GridFilterInputValue(props) {
|
|
|
115
122
|
shrink: true
|
|
116
123
|
},
|
|
117
124
|
inputRef: focusElementRef
|
|
118
|
-
}, singleSelectProps, others, (_rootProps$
|
|
125
|
+
}, singleSelectProps, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField));
|
|
119
126
|
}
|
|
120
127
|
|
|
121
128
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
@@ -101,7 +101,7 @@ export const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function
|
|
|
101
101
|
"aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
102
102
|
"aria-expanded": open ? 'true' : undefined,
|
|
103
103
|
"aria-haspopup": "menu",
|
|
104
|
-
"aria-
|
|
104
|
+
"aria-controls": densityMenuId,
|
|
105
105
|
id: densityButtonId
|
|
106
106
|
}, other, {
|
|
107
107
|
onClick: handleDensitySelectorOpen
|
|
@@ -10,5 +10,5 @@ export interface GridToolbarFilterButtonProps extends Omit<TooltipProps, 'title'
|
|
|
10
10
|
button?: ButtonProps;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
declare const GridToolbarFilterButton: React.ForwardRefExoticComponent<Pick<GridToolbarFilterButtonProps, "hidden" | "color" | "style" | "open" | "translate" | "slot" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "classes" | "
|
|
13
|
+
declare const GridToolbarFilterButton: React.ForwardRefExoticComponent<Pick<GridToolbarFilterButtonProps, "hidden" | "color" | "style" | "open" | "translate" | "slot" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "classes" | "componentsProps" | "components" | "onClose" | "TransitionComponent" | "TransitionProps" | "onOpen" | "placement" | "arrow" | "describeChild" | "disableFocusListener" | "disableHoverListener" | "disableInteractive" | "disableTouchListener" | "enterDelay" | "enterNextDelay" | "enterTouchDelay" | "followCursor" | "leaveDelay" | "leaveTouchDelay" | "PopperComponent" | "PopperProps"> & React.RefAttributes<HTMLButtonElement>>;
|
|
14
14
|
export { GridToolbarFilterButton };
|
|
@@ -25,6 +25,8 @@ const VirtualScrollerRoot = styled('div', {
|
|
|
25
25
|
overridesResolver: (props, styles) => styles.virtualScroller
|
|
26
26
|
})({
|
|
27
27
|
overflow: 'auto',
|
|
28
|
+
// See https://github.com/mui/mui-x/issues/4360
|
|
29
|
+
position: 'relative',
|
|
28
30
|
'@media print': {
|
|
29
31
|
overflow: 'hidden'
|
|
30
32
|
}
|
|
@@ -24,9 +24,7 @@ const VirtualScrollerContentRoot = styled('div', {
|
|
|
24
24
|
name: 'MuiDataGrid',
|
|
25
25
|
slot: 'VirtualScrollerContent',
|
|
26
26
|
overridesResolver: (props, styles) => styles.virtualScrollerContent
|
|
27
|
-
})({
|
|
28
|
-
position: 'relative'
|
|
29
|
-
});
|
|
27
|
+
})({});
|
|
30
28
|
const GridVirtualScrollerContent = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerContent(props, ref) {
|
|
31
29
|
const {
|
|
32
30
|
className,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GRID_DETAIL_PANEL_TOGGLE_FIELD = "__detail_panel_toggle__";
|