@mui/x-data-grid 7.0.0-beta.7 → 7.0.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 +195 -12
- package/DataGrid/DataGrid.js +13 -17
- package/DataGrid/useDataGridProps.js +3 -5
- package/README.md +1 -1
- package/components/GridFooter.js +2 -3
- package/components/GridHeader.js +1 -2
- package/components/GridPagination.d.ts +6 -5
- package/components/GridPagination.js +12 -4
- package/components/GridRow.js +13 -17
- package/components/base/GridFooterPlaceholder.js +1 -2
- package/components/base/GridOverlays.js +3 -6
- package/components/cell/GridActionsCell.js +4 -6
- package/components/cell/GridActionsCellItem.d.ts +8 -25
- package/components/cell/GridActionsCellItem.js +8 -5
- package/components/cell/GridBooleanCell.d.ts +1 -0
- package/components/cell/GridBooleanCell.js +3 -2
- package/components/cell/GridCell.js +7 -8
- package/components/cell/GridEditBooleanCell.js +1 -2
- package/components/cell/GridEditDateCell.js +2 -3
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +5 -8
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -3
- package/components/columnHeaders/GridColumnGroupHeader.js +4 -5
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +2 -3
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -6
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +3 -5
- package/components/columnSelection/GridHeaderCheckbox.js +1 -2
- package/components/columnsManagement/GridColumnsManagement.js +17 -21
- package/components/containers/GridRoot.js +3 -3
- package/components/menu/GridMenu.js +4 -6
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -3
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanel.d.ts +1 -10
- package/components/panel/GridPanel.js +1 -2
- package/components/panel/GridPreferencesPanel.js +2 -3
- package/components/panel/filterPanel/GridFilterForm.js +24 -27
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +3 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +11 -15
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +10 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +10 -11
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +5 -7
- package/components/panel/filterPanel/GridFilterPanel.js +5 -9
- package/components/panel/filterPanel/filterPanelUtils.js +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -5
- package/components/toolbar/GridToolbarDensitySelector.js +8 -10
- package/components/toolbar/GridToolbarExport.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +3 -5
- package/components/toolbar/GridToolbarFilterButton.js +3 -5
- package/components/toolbar/GridToolbarQuickFilter.js +4 -5
- package/components/virtualization/GridVirtualScrollerContent.js +1 -2
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +1 -2
- package/hooks/core/useGridApiInitialization.js +4 -6
- package/hooks/features/clipboard/useGridClipboard.js +6 -5
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -16
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +4 -8
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +12 -23
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -8
- package/hooks/features/columnMenu/useGridColumnMenuSlots.js +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +9 -19
- package/hooks/features/columns/gridColumnsSelector.js +1 -2
- package/hooks/features/columns/gridColumnsUtils.d.ts +0 -9
- package/hooks/features/columns/gridColumnsUtils.js +2 -22
- package/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/hooks/features/columns/useGridColumns.js +11 -19
- package/hooks/features/density/densitySelector.d.ts +4 -2
- package/hooks/features/density/densitySelector.js +8 -2
- package/hooks/features/density/densityState.d.ts +1 -4
- package/hooks/features/density/useGridDensity.d.ts +2 -4
- package/hooks/features/density/useGridDensity.js +21 -29
- package/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/hooks/features/editing/useGridCellEditing.js +4 -6
- package/hooks/features/editing/useGridEditing.js +1 -2
- package/hooks/features/editing/useGridRowEditing.js +4 -6
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -0
- package/hooks/features/export/serializers/csvSerializer.js +25 -16
- package/hooks/features/export/useGridCsvExport.js +9 -10
- package/hooks/features/export/useGridPrintExport.js +9 -15
- package/hooks/features/export/utils.js +2 -3
- package/hooks/features/filter/gridFilterSelector.js +15 -22
- package/hooks/features/filter/gridFilterUtils.js +10 -16
- package/hooks/features/filter/useGridFilter.js +9 -15
- package/hooks/features/focus/useGridFocus.js +5 -6
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +1 -4
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +12 -17
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -2
- package/hooks/features/pagination/gridPaginationSelector.js +1 -2
- package/hooks/features/pagination/useGridPagination.js +2 -3
- package/hooks/features/pagination/useGridPaginationModel.js +6 -11
- package/hooks/features/pagination/useGridRowCount.js +3 -6
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +7 -12
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -16
- package/hooks/features/rows/gridRowsSelector.js +11 -19
- package/hooks/features/rows/gridRowsUtils.js +7 -9
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +4 -13
- package/hooks/features/rows/useGridRowsMeta.js +7 -13
- package/hooks/features/scroll/useGridScroll.js +2 -3
- package/hooks/features/sorting/gridSortingSelector.js +4 -7
- package/hooks/features/sorting/useGridSorting.js +8 -14
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +220 -71
- package/hooks/utils/useGridApiEventHandler.js +5 -10
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +1 -0
- package/internals/utils/useProps.js +1 -2
- package/joy/joySlots.js +7 -13
- package/models/api/gridRowsMetaApi.d.ts +1 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +7 -0
- package/models/gridExport.d.ts +6 -0
- package/models/gridStateCommunity.d.ts +1 -0
- package/models/props/DataGridProps.d.ts +23 -27
- package/modern/DataGrid/DataGrid.js +13 -17
- package/modern/DataGrid/useDataGridProps.js +3 -5
- package/modern/components/GridPagination.js +11 -2
- package/modern/components/cell/GridActionsCell.js +1 -1
- package/modern/components/cell/GridActionsCellItem.js +4 -0
- package/modern/components/cell/GridBooleanCell.js +3 -2
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +5 -5
- package/modern/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +1 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +0 -19
- package/modern/hooks/features/density/densitySelector.js +8 -2
- package/modern/hooks/features/density/useGridDensity.js +21 -29
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/modern/hooks/features/export/useGridCsvExport.js +2 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/models/api/index.js +0 -1
- package/modern/utils/createSelector.js +1 -1
- package/modern/utils/domUtils.js +1 -1
- package/modern/utils/keyboardUtils.js +1 -1
- package/node/DataGrid/DataGrid.js +13 -17
- package/node/DataGrid/useDataGridProps.js +3 -5
- package/node/components/GridPagination.js +9 -1
- package/node/components/cell/GridActionsCell.js +1 -1
- package/node/components/cell/GridActionsCellItem.js +4 -0
- package/node/components/cell/GridBooleanCell.js +3 -2
- package/node/components/containers/GridRoot.js +2 -2
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +4 -4
- package/node/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +1 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +0 -20
- package/node/hooks/features/density/densitySelector.js +9 -3
- package/node/hooks/features/density/useGridDensity.js +22 -30
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/node/hooks/features/export/useGridCsvExport.js +2 -1
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/node/index.js +1 -1
- package/node/internals/index.js +12 -0
- package/node/models/api/index.js +0 -11
- package/node/utils/createSelector.js +1 -1
- package/node/utils/domUtils.js +1 -1
- package/node/utils/keyboardUtils.js +1 -1
- package/package.json +4 -4
- package/utils/createSelector.js +9 -9
- package/utils/domUtils.js +4 -7
- package/utils/getGridLocalization.js +9 -12
- package/utils/keyboardUtils.js +1 -1
|
@@ -28,7 +28,6 @@ const useUtilityClasses = ownerState => {
|
|
|
28
28
|
};
|
|
29
29
|
const collator = new Intl.Collator();
|
|
30
30
|
function GridColumnsManagement(props) {
|
|
31
|
-
var _rootProps$slotProps, _rootProps$slotProps3, _rootProps$slotProps4;
|
|
32
31
|
const apiRef = useGridApiContext();
|
|
33
32
|
const searchInputRef = React.useRef(null);
|
|
34
33
|
const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
@@ -132,27 +131,24 @@ function GridColumnsManagement(props) {
|
|
|
132
131
|
}
|
|
133
132
|
},
|
|
134
133
|
fullWidth: true
|
|
135
|
-
},
|
|
134
|
+
}, rootProps.slotProps?.baseTextField))
|
|
136
135
|
}), /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
|
|
137
136
|
className: classes.root,
|
|
138
137
|
ownerState: rootProps,
|
|
139
|
-
children: [currentColumns.map(column => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
label: column.headerName || column.field
|
|
154
|
-
}, column.field);
|
|
155
|
-
}), currentColumns.length === 0 && /*#__PURE__*/_jsx(GridColumnsManagementEmptyText, {
|
|
138
|
+
children: [currentColumns.map(column => /*#__PURE__*/_jsx(FormControlLabel, {
|
|
139
|
+
className: classes.row,
|
|
140
|
+
control: /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
141
|
+
disabled: column.hideable === false,
|
|
142
|
+
checked: columnVisibilityModel[column.field] !== false,
|
|
143
|
+
onClick: toggleColumn,
|
|
144
|
+
name: column.field,
|
|
145
|
+
sx: {
|
|
146
|
+
p: 0.5
|
|
147
|
+
},
|
|
148
|
+
inputRef: isFirstHideableColumn(column) ? firstSwitchRef : undefined
|
|
149
|
+
}, rootProps.slotProps?.baseCheckbox)),
|
|
150
|
+
label: column.headerName || column.field
|
|
151
|
+
}, column.field)), currentColumns.length === 0 && /*#__PURE__*/_jsx(GridColumnsManagementEmptyText, {
|
|
156
152
|
ownerState: rootProps,
|
|
157
153
|
children: apiRef.current.getLocaleText('columnsManagementNoColumns')
|
|
158
154
|
})]
|
|
@@ -169,12 +165,12 @@ function GridColumnsManagement(props) {
|
|
|
169
165
|
sx: {
|
|
170
166
|
p: 0.5
|
|
171
167
|
}
|
|
172
|
-
},
|
|
168
|
+
}, rootProps.slotProps?.baseCheckbox)),
|
|
173
169
|
label: apiRef.current.getLocaleText('columnsManagementShowHideAllText')
|
|
174
170
|
}) : /*#__PURE__*/_jsx("span", {}), !disableResetButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
175
171
|
onClick: () => apiRef.current.setColumnVisibilityModel(initialColumnVisibilityModel),
|
|
176
172
|
disabled: isResetDisabled
|
|
177
|
-
},
|
|
173
|
+
}, rootProps.slotProps?.baseButton, {
|
|
178
174
|
children: "Reset"
|
|
179
175
|
})) : null]
|
|
180
176
|
}) : null]
|
|
@@ -11,7 +11,7 @@ import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
|
11
11
|
import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
|
|
12
12
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
13
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
14
|
-
import {
|
|
14
|
+
import { gridDensitySelector } from '../../hooks/features/density/densitySelector';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const useUtilityClasses = ownerState => {
|
|
@@ -39,11 +39,11 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
39
39
|
} = props,
|
|
40
40
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
41
41
|
const apiRef = useGridPrivateApiContext();
|
|
42
|
-
const
|
|
42
|
+
const density = useGridSelector(apiRef, gridDensitySelector);
|
|
43
43
|
const rootElementRef = apiRef.current.rootElementRef;
|
|
44
44
|
const handleRef = useForkRef(rootElementRef, ref);
|
|
45
45
|
const ownerState = _extends({}, rootProps, {
|
|
46
|
-
density
|
|
46
|
+
density
|
|
47
47
|
});
|
|
48
48
|
const classes = useUtilityClasses(ownerState);
|
|
49
49
|
|
|
@@ -40,7 +40,6 @@ const transformOrigin = {
|
|
|
40
40
|
'bottom-end': 'top right'
|
|
41
41
|
};
|
|
42
42
|
function GridMenu(props) {
|
|
43
|
-
var _rootProps$slotProps;
|
|
44
43
|
const {
|
|
45
44
|
open,
|
|
46
45
|
target,
|
|
@@ -59,8 +58,7 @@ function GridMenu(props) {
|
|
|
59
58
|
if (open) {
|
|
60
59
|
savedFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
61
60
|
} else {
|
|
62
|
-
|
|
63
|
-
(_savedFocusRef$curren = savedFocusRef.current) == null || (_savedFocusRef$curren2 = _savedFocusRef$curren.focus) == null || _savedFocusRef$curren2.call(_savedFocusRef$curren);
|
|
61
|
+
savedFocusRef.current?.focus?.();
|
|
64
62
|
savedFocusRef.current = null;
|
|
65
63
|
}
|
|
66
64
|
}, [open]);
|
|
@@ -80,7 +78,7 @@ function GridMenu(props) {
|
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
80
|
const handleClickAway = event => {
|
|
83
|
-
if (event.target && (target === event.target || target
|
|
81
|
+
if (event.target && (target === event.target || target?.contains(event.target))) {
|
|
84
82
|
return;
|
|
85
83
|
}
|
|
86
84
|
onClose(event);
|
|
@@ -93,7 +91,7 @@ function GridMenu(props) {
|
|
|
93
91
|
anchorEl: target,
|
|
94
92
|
transition: true,
|
|
95
93
|
placement: position
|
|
96
|
-
}, other,
|
|
94
|
+
}, other, rootProps.slotProps?.basePopper, {
|
|
97
95
|
children: ({
|
|
98
96
|
TransitionProps,
|
|
99
97
|
placement
|
|
@@ -104,7 +102,7 @@ function GridMenu(props) {
|
|
|
104
102
|
style: {
|
|
105
103
|
transformOrigin: transformOrigin[placement]
|
|
106
104
|
},
|
|
107
|
-
onExited: handleExited(TransitionProps
|
|
105
|
+
onExited: handleExited(TransitionProps?.onExited),
|
|
108
106
|
children: /*#__PURE__*/_jsx(Paper, {
|
|
109
107
|
children: children
|
|
110
108
|
})
|
|
@@ -10,7 +10,6 @@ import { useGridRootProps } from '../../../../hooks/utils/useGridRootProps';
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
function GridColumnMenuSortItem(props) {
|
|
13
|
-
var _colDef$sortingOrder;
|
|
14
13
|
const {
|
|
15
14
|
colDef,
|
|
16
15
|
onClick
|
|
@@ -23,9 +22,9 @@ function GridColumnMenuSortItem(props) {
|
|
|
23
22
|
return null;
|
|
24
23
|
}
|
|
25
24
|
const sortItem = sortModel.find(item => item.field === colDef.field);
|
|
26
|
-
return sortItem
|
|
25
|
+
return sortItem?.sort;
|
|
27
26
|
}, [colDef, sortModel]);
|
|
28
|
-
const sortingOrder =
|
|
27
|
+
const sortingOrder = colDef.sortingOrder ?? rootProps.sortingOrder;
|
|
29
28
|
const onSortMenuItemClick = React.useCallback(event => {
|
|
30
29
|
onClick(event);
|
|
31
30
|
const direction = event.currentTarget.getAttribute('data-value') || null;
|
|
@@ -6,10 +6,9 @@ import { GridColumnsManagement } from '../columnsManagement';
|
|
|
6
6
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
function GridColumnsPanel(props) {
|
|
9
|
-
var _rootProps$slotProps;
|
|
10
9
|
const rootProps = useGridRootProps();
|
|
11
10
|
return /*#__PURE__*/_jsx(GridPanelWrapper, _extends({}, props, {
|
|
12
|
-
children: /*#__PURE__*/_jsx(GridColumnsManagement, _extends({},
|
|
11
|
+
children: /*#__PURE__*/_jsx(GridColumnsManagement, _extends({}, rootProps.slotProps?.columnsManagement))
|
|
13
12
|
}));
|
|
14
13
|
}
|
|
15
14
|
process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
@@ -16,16 +16,7 @@ export interface GridPanelProps extends Partial<React.ComponentProps<typeof Grid
|
|
|
16
16
|
open: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const gridPanelClasses: Record<keyof GridPanelClasses, string>;
|
|
19
|
-
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<
|
|
20
|
-
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
21
|
-
components?: {
|
|
22
|
-
Root?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
23
|
-
} | undefined;
|
|
24
|
-
componentsProps?: {
|
|
25
|
-
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperRootSlotPropsOverrides, import("@mui/base").PopperOwnProps> | undefined;
|
|
26
|
-
} | undefined;
|
|
27
|
-
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
28
|
-
} & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "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-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "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" | "onResize" | "onResizeCapture" | "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" | "component" | "sx" | "components" | "slotProps" | "slots" | "placement" | "disablePortal" | "keepMounted" | "modifiers" | "anchorEl" | "popperOptions" | "popperRef" | "componentsProps" | keyof React.RefAttributes<HTMLDivElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
19
|
+
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Popper").PopperProps & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "ref" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "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-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "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" | "onResize" | "onResizeCapture" | "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" | "component" | "sx" | "components" | "slotProps" | "slots" | "placement" | "disablePortal" | "keepMounted" | "modifiers" | "anchorEl" | "popperOptions" | "popperRef" | "componentsProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
29
20
|
ownerState: OwnerState;
|
|
30
21
|
}, {}, {}>;
|
|
31
22
|
declare const GridPanel: React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -69,8 +69,7 @@ const GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
69
69
|
}], []);
|
|
70
70
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
71
71
|
React.useEffect(() => {
|
|
72
|
-
|
|
73
|
-
const panelAnchor = (_apiRef$current$rootE = apiRef.current.rootElementRef) == null || (_apiRef$current$rootE = _apiRef$current$rootE.current) == null ? void 0 : _apiRef$current$rootE.querySelector('[data-id="gridPanelAnchor"]');
|
|
72
|
+
const panelAnchor = apiRef.current.rootElementRef?.current?.querySelector('[data-id="gridPanelAnchor"]');
|
|
74
73
|
if (panelAnchor) {
|
|
75
74
|
setAnchorEl(panelAnchor);
|
|
76
75
|
}
|
|
@@ -8,19 +8,18 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
export const GridPreferencesPanel = /*#__PURE__*/React.forwardRef(function GridPreferencesPanel(props, ref) {
|
|
11
|
-
var _preferencePanelState, _rootProps$slotProps, _rootProps$slotProps2;
|
|
12
11
|
const apiRef = useGridApiContext();
|
|
13
12
|
const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
14
13
|
const rootProps = useGridRootProps();
|
|
15
14
|
const preferencePanelState = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
16
|
-
const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null,
|
|
15
|
+
const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, preferencePanelState.openedPanelValue ?? GridPreferencePanelsValue.filters);
|
|
17
16
|
return /*#__PURE__*/_jsx(rootProps.slots.panel, _extends({
|
|
18
17
|
ref: ref,
|
|
19
18
|
as: rootProps.slots.basePopper,
|
|
20
19
|
open: columns.length > 0 && preferencePanelState.open,
|
|
21
20
|
id: preferencePanelState.panelId,
|
|
22
21
|
"aria-labelledby": preferencePanelState.labelId
|
|
23
|
-
},
|
|
22
|
+
}, rootProps.slotProps?.panel, props, rootProps.slotProps?.basePopper, {
|
|
24
23
|
children: panelContent
|
|
25
24
|
}));
|
|
26
25
|
});
|
|
@@ -97,7 +97,6 @@ const getLogicOperatorLocaleKey = logicOperator => {
|
|
|
97
97
|
const getColumnLabel = col => col.headerName || col.field;
|
|
98
98
|
const collator = new Intl.Collator();
|
|
99
99
|
const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props, ref) {
|
|
100
|
-
var _filterModel$logicOpe, _rootProps$slotProps, _rootProps$slotProps2, _baseSelectProps$nati, _rootProps$slotProps3, _rootProps$slotProps4, _rootProps$slotProps5, _rootProps$slotProps6, _rootProps$slotProps7, _rootProps$slotProps8, _currentColumn$filter2;
|
|
101
100
|
const {
|
|
102
101
|
item,
|
|
103
102
|
hasMultipleFilters,
|
|
@@ -130,13 +129,13 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
130
129
|
const classes = useUtilityClasses(rootProps);
|
|
131
130
|
const valueRef = React.useRef(null);
|
|
132
131
|
const filterSelectorRef = React.useRef(null);
|
|
133
|
-
const multiFilterOperator =
|
|
132
|
+
const multiFilterOperator = filterModel.logicOperator ?? GridLogicOperator.And;
|
|
134
133
|
const hasLogicOperatorColumn = hasMultipleFilters && logicOperators.length > 0;
|
|
135
|
-
const baseFormControlProps =
|
|
136
|
-
const baseSelectProps =
|
|
137
|
-
const isBaseSelectNative =
|
|
138
|
-
const baseInputLabelProps =
|
|
139
|
-
const baseSelectOptionProps =
|
|
134
|
+
const baseFormControlProps = rootProps.slotProps?.baseFormControl || {};
|
|
135
|
+
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
136
|
+
const isBaseSelectNative = baseSelectProps.native ?? false;
|
|
137
|
+
const baseInputLabelProps = rootProps.slotProps?.baseInputLabel || {};
|
|
138
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
140
139
|
const {
|
|
141
140
|
InputComponentProps
|
|
142
141
|
} = valueInputProps,
|
|
@@ -164,7 +163,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
164
163
|
const filteredFields = filterColumns({
|
|
165
164
|
field: item.field,
|
|
166
165
|
columns: filterableColumns,
|
|
167
|
-
currentFilters:
|
|
166
|
+
currentFilters: filterModel?.items || []
|
|
168
167
|
});
|
|
169
168
|
return {
|
|
170
169
|
filteredColumns: filterableColumns.filter(column => {
|
|
@@ -176,7 +175,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
176
175
|
}),
|
|
177
176
|
selectedField: itemField
|
|
178
177
|
};
|
|
179
|
-
}, [filterColumns, filterModel
|
|
178
|
+
}, [filterColumns, filterModel?.items, filterableColumns, item.field, columnLookup]);
|
|
180
179
|
const sortedFilteredColumns = React.useMemo(() => {
|
|
181
180
|
switch (columnsSort) {
|
|
182
181
|
case 'asc':
|
|
@@ -189,11 +188,10 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
189
188
|
}, [filteredColumns, columnsSort]);
|
|
190
189
|
const currentColumn = item.field ? apiRef.current.getColumn(item.field) : null;
|
|
191
190
|
const currentOperator = React.useMemo(() => {
|
|
192
|
-
var _currentColumn$filter;
|
|
193
191
|
if (!item.operator || !currentColumn) {
|
|
194
192
|
return null;
|
|
195
193
|
}
|
|
196
|
-
return
|
|
194
|
+
return currentColumn.filterOperators?.find(operator => operator.value === item.operator);
|
|
197
195
|
}, [item, currentColumn]);
|
|
198
196
|
const changeColumn = React.useCallback(event => {
|
|
199
197
|
const field = event.target.value;
|
|
@@ -207,7 +205,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
207
205
|
const newOperator = column.filterOperators.find(operator => operator.value === item.operator) || column.filterOperators[0];
|
|
208
206
|
|
|
209
207
|
// Erase filter value if the input component or filtered column type is modified
|
|
210
|
-
const eraseFilterValue = !newOperator.InputComponent || newOperator.InputComponent !==
|
|
208
|
+
const eraseFilterValue = !newOperator.InputComponent || newOperator.InputComponent !== currentOperator?.InputComponent || column.type !== currentColumn.type;
|
|
211
209
|
let filterValue = eraseFilterValue ? undefined : item.value;
|
|
212
210
|
|
|
213
211
|
// Check filter value against the new valueOptions
|
|
@@ -218,10 +216,10 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
218
216
|
filterValue = filterValue.filter(val => {
|
|
219
217
|
return (
|
|
220
218
|
// Only keep values that are in the new value options
|
|
221
|
-
getValueFromValueOptions(val, valueOptions, colDef
|
|
219
|
+
getValueFromValueOptions(val, valueOptions, colDef?.getOptionValue) !== undefined
|
|
222
220
|
);
|
|
223
221
|
});
|
|
224
|
-
} else if (getValueFromValueOptions(item.value, valueOptions, colDef
|
|
222
|
+
} else if (getValueFromValueOptions(item.value, valueOptions, colDef?.getOptionValue) === undefined) {
|
|
225
223
|
// Reset the filter value if it is not in the new value options
|
|
226
224
|
filterValue = undefined;
|
|
227
225
|
}
|
|
@@ -234,8 +232,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
234
232
|
}, [apiRef, applyFilterChanges, item, currentColumn, currentOperator]);
|
|
235
233
|
const changeOperator = React.useCallback(event => {
|
|
236
234
|
const operator = event.target.value;
|
|
237
|
-
const newOperator = currentColumn
|
|
238
|
-
const eraseItemValue = !
|
|
235
|
+
const newOperator = currentColumn?.filterOperators.find(op => op.value === operator);
|
|
236
|
+
const eraseItemValue = !newOperator?.InputComponent || newOperator?.InputComponent !== currentOperator?.InputComponent;
|
|
239
237
|
applyFilterChanges(_extends({}, item, {
|
|
240
238
|
operator,
|
|
241
239
|
value: eraseItemValue ? undefined : item.value
|
|
@@ -261,9 +259,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
261
259
|
};
|
|
262
260
|
React.useImperativeHandle(focusElementRef, () => ({
|
|
263
261
|
focus: () => {
|
|
264
|
-
if (currentOperator
|
|
265
|
-
|
|
266
|
-
valueRef == null || (_valueRef$current = valueRef.current) == null || _valueRef$current.focus();
|
|
262
|
+
if (currentOperator?.InputComponent) {
|
|
263
|
+
valueRef?.current?.focus();
|
|
267
264
|
} else {
|
|
268
265
|
filterSelectorRef.current.focus();
|
|
269
266
|
}
|
|
@@ -287,7 +284,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
287
284
|
onClick: handleDeleteFilter,
|
|
288
285
|
size: "small",
|
|
289
286
|
disabled: readOnly
|
|
290
|
-
},
|
|
287
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
291
288
|
children: /*#__PURE__*/_jsx(rootProps.slots.filterPanelDeleteIcon, {
|
|
292
289
|
fontSize: "small"
|
|
293
290
|
})
|
|
@@ -306,11 +303,11 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
306
303
|
inputProps: {
|
|
307
304
|
'aria-label': apiRef.current.getLocaleText('filterPanelLogicOperator')
|
|
308
305
|
},
|
|
309
|
-
value: multiFilterOperator
|
|
306
|
+
value: multiFilterOperator ?? '',
|
|
310
307
|
onChange: changeLogicOperator,
|
|
311
308
|
disabled: !!disableMultiFilterOperator || logicOperators.length === 1,
|
|
312
309
|
native: isBaseSelectNative
|
|
313
|
-
},
|
|
310
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
314
311
|
children: logicOperators.map(logicOperator => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
315
312
|
native: isBaseSelectNative,
|
|
316
313
|
key: logicOperator.toString(),
|
|
@@ -331,11 +328,11 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
331
328
|
labelId: columnSelectLabelId,
|
|
332
329
|
id: columnSelectId,
|
|
333
330
|
label: apiRef.current.getLocaleText('filterPanelColumns'),
|
|
334
|
-
value: selectedField
|
|
331
|
+
value: selectedField ?? '',
|
|
335
332
|
onChange: changeColumn,
|
|
336
333
|
native: isBaseSelectNative,
|
|
337
334
|
disabled: readOnly
|
|
338
|
-
},
|
|
335
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
339
336
|
children: sortedFilteredColumns.map(col => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
340
337
|
native: isBaseSelectNative,
|
|
341
338
|
key: col.field,
|
|
@@ -361,8 +358,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
361
358
|
native: isBaseSelectNative,
|
|
362
359
|
inputRef: filterSelectorRef,
|
|
363
360
|
disabled: readOnly
|
|
364
|
-
},
|
|
365
|
-
children: currentColumn
|
|
361
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
362
|
+
children: currentColumn?.filterOperators?.map(operator => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
366
363
|
native: isBaseSelectNative,
|
|
367
364
|
key: operator.value,
|
|
368
365
|
value: operator.value
|
|
@@ -374,7 +371,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
374
371
|
}, baseFormControlProps, valueInputPropsOther, {
|
|
375
372
|
className: clsx(classes.valueInput, baseFormControlProps.className, valueInputPropsOther.className),
|
|
376
373
|
ownerState: rootProps,
|
|
377
|
-
children: currentOperator
|
|
374
|
+
children: currentOperator?.InputComponent ? /*#__PURE__*/_jsx(currentOperator.InputComponent, _extends({
|
|
378
375
|
apiRef: apiRef,
|
|
379
376
|
item: item,
|
|
380
377
|
applyValue: applyFilterChanges,
|
|
@@ -5,7 +5,7 @@ export type GridFilterInputBooleanProps = GridFilterInputValueProps & TextFieldP
|
|
|
5
5
|
clearButton?: React.ReactNode | null;
|
|
6
6
|
/**
|
|
7
7
|
* It is `true` if the filter either has a value or an operator with no value
|
|
8
|
-
* required is selected (
|
|
8
|
+
* required is selected (for example `isEmpty`)
|
|
9
9
|
*/
|
|
10
10
|
isFilterActive?: boolean;
|
|
11
11
|
};
|
|
@@ -17,7 +17,6 @@ const BooleanOperatorContainer = styled('div')({
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
function GridFilterInputBoolean(props) {
|
|
20
|
-
var _rootProps$slotProps, _baseSelectProps$nati, _rootProps$slotProps2, _rootProps$slotProps3;
|
|
21
20
|
const {
|
|
22
21
|
item,
|
|
23
22
|
applyValue,
|
|
@@ -33,9 +32,9 @@ function GridFilterInputBoolean(props) {
|
|
|
33
32
|
const rootProps = useGridRootProps();
|
|
34
33
|
const labelId = useId();
|
|
35
34
|
const selectId = useId();
|
|
36
|
-
const baseSelectProps =
|
|
37
|
-
const isSelectNative =
|
|
38
|
-
const baseSelectOptionProps =
|
|
35
|
+
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
36
|
+
const isSelectNative = baseSelectProps.native ?? false;
|
|
37
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
39
38
|
const onFilterChange = React.useCallback(event => {
|
|
40
39
|
const value = event.target.value;
|
|
41
40
|
setFilterValueState(value);
|
|
@@ -46,11 +45,11 @@ function GridFilterInputBoolean(props) {
|
|
|
46
45
|
React.useEffect(() => {
|
|
47
46
|
setFilterValueState(item.value || '');
|
|
48
47
|
}, [item.value]);
|
|
49
|
-
const label = labelProp
|
|
48
|
+
const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
50
49
|
return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
|
|
51
50
|
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
52
51
|
fullWidth: true,
|
|
53
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({},
|
|
52
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
|
|
54
53
|
id: labelId,
|
|
55
54
|
shrink: true,
|
|
56
55
|
variant: variant,
|
|
@@ -100,7 +99,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
|
|
|
100
99
|
focusElementRef: refType,
|
|
101
100
|
/**
|
|
102
101
|
* It is `true` if the filter either has a value or an operator with no value
|
|
103
|
-
* required is selected (
|
|
102
|
+
* required is selected (for example `isEmpty`)
|
|
104
103
|
*/
|
|
105
104
|
isFilterActive: PropTypes.bool,
|
|
106
105
|
item: PropTypes.shape({
|
|
@@ -6,7 +6,7 @@ export type GridFilterInputDateProps = GridFilterInputValueProps & TextFieldProp
|
|
|
6
6
|
clearButton?: React.ReactNode | null;
|
|
7
7
|
/**
|
|
8
8
|
* It is `true` if the filter either has a value or an operator with no value
|
|
9
|
-
* required is selected (
|
|
9
|
+
* required is selected (for example `isEmpty`)
|
|
10
10
|
*/
|
|
11
11
|
isFilterActive?: boolean;
|
|
12
12
|
};
|
|
@@ -25,7 +25,6 @@ function convertFilterItemValueToInputValue(itemValue, inputType) {
|
|
|
25
25
|
return dateCopy.toISOString().substring(0, 10);
|
|
26
26
|
}
|
|
27
27
|
function GridFilterInputDate(props) {
|
|
28
|
-
var _rootProps$slotProps;
|
|
29
28
|
const {
|
|
30
29
|
item,
|
|
31
30
|
applyValue,
|
|
@@ -83,9 +82,9 @@ function GridFilterInputDate(props) {
|
|
|
83
82
|
inputProps: _extends({
|
|
84
83
|
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31',
|
|
85
84
|
tabIndex
|
|
86
|
-
}, InputProps
|
|
85
|
+
}, InputProps?.inputProps)
|
|
87
86
|
})
|
|
88
|
-
}, other,
|
|
87
|
+
}, other, rootProps.slotProps?.baseTextField));
|
|
89
88
|
}
|
|
90
89
|
process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
91
90
|
// ----------------------------- Warning --------------------------------
|
|
@@ -100,7 +99,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
|
100
99
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
101
100
|
/**
|
|
102
101
|
* It is `true` if the filter either has a value or an operator with no value
|
|
103
|
-
* required is selected (
|
|
102
|
+
* required is selected (for example `isEmpty`)
|
|
104
103
|
*/
|
|
105
104
|
isFilterActive: PropTypes.bool,
|
|
106
105
|
item: PropTypes.shape({
|
|
@@ -10,7 +10,6 @@ import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const filter = createFilterOptions();
|
|
12
12
|
function GridFilterInputMultipleSingleSelect(props) {
|
|
13
|
-
var _resolvedColumn, _resolvedColumn2;
|
|
14
13
|
const {
|
|
15
14
|
item,
|
|
16
15
|
applyValue,
|
|
@@ -39,8 +38,8 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
39
38
|
resolvedColumn = column;
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
|
-
const getOptionValue =
|
|
43
|
-
const getOptionLabel =
|
|
41
|
+
const getOptionValue = resolvedColumn?.getOptionValue;
|
|
42
|
+
const getOptionLabel = resolvedColumn?.getOptionLabel;
|
|
44
43
|
const isOptionEqualToValue = React.useCallback((option, value) => getOptionValue(option) === getOptionValue(value), [getOptionValue]);
|
|
45
44
|
const resolvedValueOptions = React.useMemo(() => {
|
|
46
45
|
return getValueOptions(resolvedColumn) || [];
|
|
@@ -81,18 +80,15 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
81
80
|
}, getTagProps({
|
|
82
81
|
index
|
|
83
82
|
})))),
|
|
84
|
-
renderInput: params => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
type: "singleSelect"
|
|
94
|
-
}, TextFieldProps, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField));
|
|
95
|
-
}
|
|
83
|
+
renderInput: params => /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({}, params, {
|
|
84
|
+
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
85
|
+
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
86
|
+
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
87
|
+
shrink: true
|
|
88
|
+
}),
|
|
89
|
+
inputRef: focusElementRef,
|
|
90
|
+
type: "singleSelect"
|
|
91
|
+
}, TextFieldProps, rootProps.slotProps?.baseTextField))
|
|
96
92
|
}, other));
|
|
97
93
|
}
|
|
98
94
|
process.env.NODE_ENV !== "production" ? GridFilterInputMultipleSingleSelect.propTypes = {
|
|
@@ -32,8 +32,7 @@ function GridFilterInputMultipleValue(props) {
|
|
|
32
32
|
const id = useId();
|
|
33
33
|
const rootProps = useGridRootProps();
|
|
34
34
|
React.useEffect(() => {
|
|
35
|
-
|
|
36
|
-
const itemValue = (_item$value = item.value) != null ? _item$value : [];
|
|
35
|
+
const itemValue = item.value ?? [];
|
|
37
36
|
setFilterValueState(itemValue.map(String));
|
|
38
37
|
}, [item.value]);
|
|
39
38
|
const handleChange = React.useCallback((event, value) => {
|
|
@@ -62,18 +61,15 @@ function GridFilterInputMultipleValue(props) {
|
|
|
62
61
|
}, getTagProps({
|
|
63
62
|
index
|
|
64
63
|
})))),
|
|
65
|
-
renderInput: params => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
type: type || 'text'
|
|
75
|
-
}, TextFieldProps, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField));
|
|
76
|
-
}
|
|
64
|
+
renderInput: params => /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({}, params, {
|
|
65
|
+
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
66
|
+
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
67
|
+
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
68
|
+
shrink: true
|
|
69
|
+
}),
|
|
70
|
+
inputRef: focusElementRef,
|
|
71
|
+
type: type || 'text'
|
|
72
|
+
}, TextFieldProps, rootProps.slotProps?.baseTextField))
|
|
77
73
|
}, other));
|
|
78
74
|
}
|
|
79
75
|
process.env.NODE_ENV !== "production" ? GridFilterInputMultipleValue.propTypes = {
|
|
@@ -5,7 +5,7 @@ export type GridFilterInputSingleSelectProps = GridFilterInputValueProps & TextF
|
|
|
5
5
|
clearButton?: React.ReactNode | null;
|
|
6
6
|
/**
|
|
7
7
|
* It is `true` if the filter either has a value or an operator with no value
|
|
8
|
-
* required is selected (
|
|
8
|
+
* required is selected (for example `isEmpty`)
|
|
9
9
|
*/
|
|
10
10
|
isFilterActive?: boolean;
|
|
11
11
|
type?: 'singleSelect';
|