@mui/x-data-grid 9.8.0 → 9.10.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 +230 -0
- package/DataGrid/DataGrid.js +7 -0
- package/DataGrid/DataGrid.mjs +7 -0
- package/colDef/gridNumericOperators.d.mts +1 -1
- package/colDef/gridNumericOperators.d.ts +1 -1
- package/components/GridColumnSortButton.d.mts +1 -1
- package/components/GridColumnSortButton.d.ts +1 -1
- package/components/GridColumnUnsortedIcon.d.mts +2 -1
- package/components/GridColumnUnsortedIcon.d.ts +2 -1
- package/components/GridHeader.d.mts +2 -1
- package/components/GridHeader.d.ts +2 -1
- package/components/GridHeaders.d.mts +1 -1
- package/components/GridHeaders.d.ts +1 -1
- package/components/GridPagination.d.mts +2 -1
- package/components/GridPagination.d.ts +2 -1
- package/components/GridRowDragAndDropOverlay.d.mts +1 -1
- package/components/GridRowDragAndDropOverlay.d.ts +1 -1
- package/components/GridScrollArea.d.mts +2 -1
- package/components/GridScrollArea.d.ts +2 -1
- package/components/GridScrollShadows.d.mts +2 -1
- package/components/GridScrollShadows.d.ts +2 -1
- package/components/GridScrollbarFillerCell.d.mts +1 -1
- package/components/GridScrollbarFillerCell.d.ts +1 -1
- package/components/GridSkeletonLoadingOverlay.d.mts +1 -1
- package/components/GridSkeletonLoadingOverlay.d.ts +1 -1
- package/components/base/GridFooterPlaceholder.d.mts +1 -1
- package/components/base/GridFooterPlaceholder.d.ts +1 -1
- package/components/base/GridFooterPlaceholder.js +1 -1
- package/components/base/GridFooterPlaceholder.mjs +1 -1
- package/components/base/GridOverlays.d.mts +1 -1
- package/components/base/GridOverlays.d.ts +1 -1
- package/components/cell/GridActionsCell.d.mts +2 -2
- package/components/cell/GridActionsCell.d.ts +2 -2
- package/components/cell/GridActionsCellItem.d.mts +10 -10
- package/components/cell/GridActionsCellItem.d.ts +10 -10
- package/components/cell/GridActionsCellItem.js +1 -58
- package/components/cell/GridActionsCellItem.mjs +1 -58
- package/components/cell/GridBooleanCell.d.mts +1 -4
- package/components/cell/GridBooleanCell.d.ts +1 -4
- package/components/cell/GridEditBooleanCell.d.mts +2 -2
- package/components/cell/GridEditBooleanCell.d.ts +2 -2
- package/components/cell/GridEditDateCell.d.mts +2 -2
- package/components/cell/GridEditDateCell.d.ts +2 -2
- package/components/cell/GridEditInputCell.d.mts +1 -1
- package/components/cell/GridEditInputCell.d.ts +1 -1
- package/components/cell/GridEditLongTextCell.d.mts +2 -2
- package/components/cell/GridEditLongTextCell.d.ts +2 -2
- package/components/cell/GridEditSingleSelectCell.d.mts +3 -2
- package/components/cell/GridEditSingleSelectCell.d.ts +3 -2
- package/components/cell/GridFooterCell.d.mts +1 -1
- package/components/cell/GridFooterCell.d.ts +1 -1
- package/components/cell/GridLongTextCell.d.mts +2 -2
- package/components/cell/GridLongTextCell.d.ts +2 -2
- package/components/cell/GridSkeletonCell.d.mts +1 -4
- package/components/cell/GridSkeletonCell.d.ts +1 -4
- package/components/columnHeaders/ColumnHeaderMenuIcon.d.mts +1 -1
- package/components/columnHeaders/ColumnHeaderMenuIcon.d.ts +1 -1
- package/components/columnHeaders/GridColumnGroupHeader.d.mts +1 -1
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.mts +1 -1
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderItem.d.mts +1 -4
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +1 -4
- package/components/columnHeaders/GridColumnHeaderSeparator.d.mts +1 -4
- package/components/columnHeaders/GridColumnHeaderSeparator.d.ts +1 -4
- package/components/columnHeaders/GridColumnHeaderSortIcon.d.mts +1 -4
- package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -4
- package/components/columnHeaders/GridColumnHeaderTitle.d.mts +1 -1
- package/components/columnHeaders/GridColumnHeaderTitle.d.ts +1 -1
- package/components/columnsManagement/GridColumnsManagement.d.mts +2 -1
- package/components/columnsManagement/GridColumnsManagement.d.ts +2 -1
- package/components/menu/GridMenu.d.mts +1 -1
- package/components/menu/GridMenu.d.ts +1 -1
- package/components/menu/columnMenu/GridColumnHeaderMenu.d.mts +1 -1
- package/components/menu/columnMenu/GridColumnHeaderMenu.d.ts +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.d.mts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.d.ts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.d.mts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.d.ts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.d.mts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.d.ts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.d.mts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.d.ts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.d.mts +2 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.d.ts +2 -1
- package/components/panel/GridColumnsPanel.d.mts +1 -1
- package/components/panel/GridColumnsPanel.d.ts +1 -1
- package/components/panel/GridPanelContent.d.mts +1 -1
- package/components/panel/GridPanelContent.d.ts +1 -1
- package/components/panel/GridPanelContext.d.mts +1 -1
- package/components/panel/GridPanelContext.d.ts +1 -1
- package/components/panel/GridPanelFooter.d.mts +1 -1
- package/components/panel/GridPanelFooter.d.ts +1 -1
- package/components/panel/GridPanelHeader.d.mts +1 -1
- package/components/panel/GridPanelHeader.d.ts +1 -1
- package/components/panel/GridPreferencesPanel.d.mts +1 -1
- package/components/panel/GridPreferencesPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.d.mts +1 -98
- package/components/panel/filterPanel/GridFilterForm.d.ts +1 -98
- package/components/panel/filterPanel/GridFilterForm.js +9 -355
- package/components/panel/filterPanel/GridFilterForm.mjs +8 -354
- package/components/panel/filterPanel/GridFilterFormBase.d.mts +119 -0
- package/components/panel/filterPanel/GridFilterFormBase.d.ts +119 -0
- package/components/panel/filterPanel/GridFilterFormBase.js +497 -0
- package/components/panel/filterPanel/GridFilterFormBase.mjs +491 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.d.mts +2 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.mjs +6 -1
- package/components/panel/filterPanel/GridFilterInputDate.d.mts +2 -1
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +21 -9
- package/components/panel/filterPanel/GridFilterInputDate.mjs +21 -9
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.mts +2 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.mjs +6 -1
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.mts +2 -1
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +6 -1
- package/components/panel/filterPanel/GridFilterInputMultipleValue.mjs +6 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.mts +2 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.mjs +6 -1
- package/components/panel/filterPanel/GridFilterInputValue.d.mts +2 -1
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +19 -8
- package/components/panel/filterPanel/GridFilterInputValue.mjs +19 -8
- package/components/panel/filterPanel/GridFilterPanel.d.mts +3 -40
- package/components/panel/filterPanel/GridFilterPanel.d.ts +3 -40
- package/components/panel/filterPanel/GridFilterPanel.js +19 -174
- package/components/panel/filterPanel/GridFilterPanel.mjs +14 -173
- package/components/panel/filterPanel/GridFilterPanelBase.d.mts +79 -0
- package/components/panel/filterPanel/GridFilterPanelBase.d.ts +79 -0
- package/components/panel/filterPanel/GridFilterPanelBase.js +304 -0
- package/components/panel/filterPanel/GridFilterPanelBase.mjs +297 -0
- package/components/panel/filterPanel/index.d.mts +3 -1
- package/components/panel/filterPanel/index.d.ts +3 -1
- package/components/panel/filterPanel/index.js +9 -1
- package/components/panel/filterPanel/index.mjs +3 -0
- package/components/quickFilter/QuickFilter.d.mts +1 -1
- package/components/quickFilter/QuickFilter.d.ts +1 -1
- package/components/toolbar/GridToolbarExport.d.mts +2 -2
- package/components/toolbar/GridToolbarExport.d.ts +2 -2
- package/components/toolbar/GridToolbarQuickFilter.d.mts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.d.ts +1 -1
- package/components/toolbarV8/GridToolbar.d.mts +3 -3
- package/components/toolbarV8/GridToolbar.d.ts +3 -3
- package/components/toolbarV8/utils.d.mts +1 -1
- package/components/toolbarV8/utils.d.ts +1 -1
- package/components/virtualization/GridBottomContainer.d.mts +1 -1
- package/components/virtualization/GridBottomContainer.d.ts +1 -1
- package/components/virtualization/GridTopContainer.d.mts +1 -1
- package/components/virtualization/GridTopContainer.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.d.mts +1 -1
- package/components/virtualization/GridVirtualScroller.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollerFiller.d.mts +2 -1
- package/components/virtualization/GridVirtualScrollerFiller.d.ts +2 -1
- package/constants/cssVariables.d.mts +120 -120
- package/constants/cssVariables.d.ts +120 -120
- package/constants/dataGridPropsDefaultValues.js +1 -0
- package/constants/dataGridPropsDefaultValues.mjs +1 -0
- package/context/GridContextProvider.d.mts +1 -1
- package/context/GridContextProvider.d.ts +1 -1
- package/hooks/core/useGridLocaleText.d.mts +1 -1
- package/hooks/core/useGridLocaleText.d.ts +1 -1
- package/hooks/core/useGridLoggerFactory.d.mts +1 -1
- package/hooks/core/useGridLoggerFactory.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.d.mts +1 -1
- package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.mts +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.mts +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +4 -4
- package/hooks/features/columnResize/useGridColumnResize.d.mts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.d.mts +1 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.d.mts +2 -2
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +2 -2
- package/hooks/features/dataSource/useGridDataSourceBase.js +39 -10
- package/hooks/features/dataSource/useGridDataSourceBase.mjs +39 -10
- package/hooks/features/density/useGridDensity.d.mts +1 -1
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/editing/useGridCellEditing.d.mts +1 -1
- package/hooks/features/editing/useGridCellEditing.d.ts +1 -1
- package/hooks/features/editing/useGridEditing.d.mts +1 -1
- package/hooks/features/editing/useGridEditing.d.ts +1 -1
- package/hooks/features/editing/useGridRowEditing.d.mts +1 -1
- package/hooks/features/editing/useGridRowEditing.d.ts +1 -1
- package/hooks/features/editing/utils.d.mts +1 -1
- package/hooks/features/editing/utils.d.ts +1 -1
- package/hooks/features/export/useGridCsvExport.d.mts +1 -1
- package/hooks/features/export/useGridCsvExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.d.mts +1 -1
- package/hooks/features/export/useGridPrintExport.d.ts +1 -1
- package/hooks/features/filter/gridFilterUtils.d.mts +13 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +13 -1
- package/hooks/features/filter/gridFilterUtils.js +56 -1
- package/hooks/features/filter/gridFilterUtils.mjs +52 -0
- package/hooks/features/filter/useGridFilter.d.mts +1 -1
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +4 -35
- package/hooks/features/filter/useGridFilter.mjs +5 -36
- package/hooks/features/focus/useGridFocus.d.mts +1 -1
- package/hooks/features/focus/useGridFocus.d.ts +1 -1
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.mts +1 -1
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.mts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/overlays/useGridOverlays.d.mts +1 -1
- package/hooks/features/overlays/useGridOverlays.d.ts +1 -1
- package/hooks/features/pagination/gridPaginationUtils.d.mts +1 -1
- package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationMeta.d.mts +1 -1
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationModel.d.mts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridRowCount.d.mts +1 -1
- package/hooks/features/pagination/useGridRowCount.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.mts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.d.mts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.d.mts +4 -4
- package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
- package/hooks/features/rows/useGridRowSpanning.d.mts +1 -1
- package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
- package/hooks/features/rows/useGridRows.d.mts +1 -1
- package/hooks/features/rows/useGridRows.d.ts +1 -1
- package/hooks/features/rows/useGridRowsMeta.d.mts +1 -1
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.d.mts +1 -1
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.d.mts +1 -1
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.mts +2 -2
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +2 -2
- package/hooks/utils/useGridEvent.d.mts +1 -1
- package/hooks/utils/useGridEvent.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.mts +2 -2
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/demo/TailwindDemoContainer.d.mts +1 -1
- package/internals/demo/TailwindDemoContainer.d.ts +1 -1
- package/models/api/gridApiCommon.d.mts +1 -1
- package/models/api/gridApiCommon.d.ts +1 -1
- package/models/gridFilterInputComponent.d.mts +5 -0
- package/models/gridFilterInputComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.mts +1 -1
- package/models/gridSlotsComponentsProps.d.ts +1 -1
- package/models/props/DataGridProps.d.mts +7 -0
- package/models/props/DataGridProps.d.ts +7 -0
- package/package.json +5 -5
- package/utils/cellBorderUtils.d.mts +2 -2
- package/utils/cellBorderUtils.d.ts +2 -2
- package/utils/css/context.d.mts +3 -3
- package/utils/css/context.d.ts +3 -3
- package/utils/getPublicApiRef.d.mts +1 -1
- package/utils/getPublicApiRef.d.ts +1 -1
- package/utils/keyboardUtils.d.mts +1 -1
- package/utils/keyboardUtils.d.ts +1 -1
- package/utils/rtlFlipSide.d.mts +1 -1
- package/utils/rtlFlipSide.d.ts +1 -1
|
@@ -1,374 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.GridFilterForm = void 0;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
var
|
|
12
|
-
var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
|
|
13
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
-
var React = _react;
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
15
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
|
-
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
18
|
-
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
19
|
-
var _capitalize = _interopRequireDefault(require("@mui/utils/capitalize"));
|
|
20
|
-
var _styles = require("@mui/material/styles");
|
|
21
13
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
22
|
-
var _cssVariables = require("../../../constants/cssVariables");
|
|
23
|
-
var _gridColumnsSelector = require("../../../hooks/features/columns/gridColumnsSelector");
|
|
24
|
-
var _gridFilterSelector = require("../../../hooks/features/filter/gridFilterSelector");
|
|
25
|
-
var _useGridSelector = require("../../../hooks/utils/useGridSelector");
|
|
26
|
-
var _gridFilterItem = require("../../../models/gridFilterItem");
|
|
27
14
|
var _useGridApiContext = require("../../../hooks/utils/useGridApiContext");
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var _pivoting = require("../../../hooks/features/pivoting");
|
|
15
|
+
var _useGridSelector = require("../../../hooks/utils/useGridSelector");
|
|
16
|
+
var _gridFilterSelector = require("../../../hooks/features/filter/gridFilterSelector");
|
|
17
|
+
var _GridFilterFormBase = require("./GridFilterFormBase");
|
|
32
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
-
const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "logicOperators", "columnsSort", "filterColumns", "deleteIconProps", "logicOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "readOnly", "children"],
|
|
34
|
-
_excluded2 = ["InputComponentProps"];
|
|
35
|
-
const useUtilityClasses = ownerState => {
|
|
36
|
-
const {
|
|
37
|
-
classes
|
|
38
|
-
} = ownerState;
|
|
39
|
-
const slots = {
|
|
40
|
-
root: ['filterForm'],
|
|
41
|
-
deleteIcon: ['filterFormDeleteIcon'],
|
|
42
|
-
logicOperatorInput: ['filterFormLogicOperatorInput'],
|
|
43
|
-
columnInput: ['filterFormColumnInput'],
|
|
44
|
-
operatorInput: ['filterFormOperatorInput'],
|
|
45
|
-
valueInput: ['filterFormValueInput']
|
|
46
|
-
};
|
|
47
|
-
return (0, _composeClasses.default)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
48
|
-
};
|
|
49
|
-
const GridFilterFormRoot = (0, _styles.styled)('div', {
|
|
50
|
-
name: 'MuiDataGrid',
|
|
51
|
-
slot: 'FilterForm'
|
|
52
|
-
})({
|
|
53
|
-
display: 'flex',
|
|
54
|
-
gap: _cssVariables.vars.spacing(1.5)
|
|
55
|
-
});
|
|
56
|
-
const FilterFormDeleteIcon = (0, _styles.styled)('div', {
|
|
57
|
-
name: 'MuiDataGrid',
|
|
58
|
-
slot: 'FilterFormDeleteIcon'
|
|
59
|
-
})({
|
|
60
|
-
flexShrink: 0,
|
|
61
|
-
display: 'flex',
|
|
62
|
-
justifyContent: 'center',
|
|
63
|
-
alignItems: 'center'
|
|
64
|
-
});
|
|
65
|
-
const FilterFormLogicOperatorInput = (0, _styles.styled)('div', {
|
|
66
|
-
name: 'MuiDataGrid',
|
|
67
|
-
slot: 'FilterFormLogicOperatorInput'
|
|
68
|
-
})({
|
|
69
|
-
minWidth: 75,
|
|
70
|
-
justifyContent: 'end'
|
|
71
|
-
});
|
|
72
|
-
const FilterFormColumnInput = (0, _styles.styled)('div', {
|
|
73
|
-
name: 'MuiDataGrid',
|
|
74
|
-
slot: 'FilterFormColumnInput'
|
|
75
|
-
})({
|
|
76
|
-
width: 150
|
|
77
|
-
});
|
|
78
|
-
const FilterFormOperatorInput = (0, _styles.styled)('div', {
|
|
79
|
-
name: 'MuiDataGrid',
|
|
80
|
-
slot: 'FilterFormOperatorInput'
|
|
81
|
-
})({
|
|
82
|
-
width: 150
|
|
83
|
-
});
|
|
84
|
-
const FilterFormValueInput = (0, _styles.styled)('div', {
|
|
85
|
-
name: 'MuiDataGrid',
|
|
86
|
-
slot: 'FilterFormValueInput'
|
|
87
|
-
})({
|
|
88
|
-
width: 190
|
|
89
|
-
});
|
|
90
|
-
const getLogicOperatorLocaleKey = logicOperator => {
|
|
91
|
-
switch (logicOperator) {
|
|
92
|
-
case _gridFilterItem.GridLogicOperator.And:
|
|
93
|
-
return 'filterPanelOperatorAnd';
|
|
94
|
-
case _gridFilterItem.GridLogicOperator.Or:
|
|
95
|
-
return 'filterPanelOperatorOr';
|
|
96
|
-
default:
|
|
97
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: Invalid `logicOperator` property in the `GridFilterPanel`.' : (0, _formatErrorMessage2.default)(71));
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
const getColumnLabel = col => col.headerName || col.field;
|
|
101
|
-
const collator = new Intl.Collator();
|
|
102
19
|
const GridFilterForm = exports.GridFilterForm = (0, _forwardRef.forwardRef)(function GridFilterForm(props, ref) {
|
|
103
|
-
const {
|
|
104
|
-
item,
|
|
105
|
-
hasMultipleFilters,
|
|
106
|
-
deleteFilter,
|
|
107
|
-
applyFilterChanges,
|
|
108
|
-
showMultiFilterOperators,
|
|
109
|
-
disableMultiFilterOperator,
|
|
110
|
-
applyMultiFilterOperatorChanges,
|
|
111
|
-
focusElementRef,
|
|
112
|
-
logicOperators = [_gridFilterItem.GridLogicOperator.And, _gridFilterItem.GridLogicOperator.Or],
|
|
113
|
-
columnsSort,
|
|
114
|
-
filterColumns,
|
|
115
|
-
deleteIconProps = {},
|
|
116
|
-
logicOperatorInputProps = {},
|
|
117
|
-
operatorInputProps = {},
|
|
118
|
-
columnInputProps = {},
|
|
119
|
-
valueInputProps = {},
|
|
120
|
-
readOnly
|
|
121
|
-
} = props,
|
|
122
|
-
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
123
20
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
124
|
-
const columnLookup = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridColumnLookupSelector);
|
|
125
|
-
const filterableColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridFilterableColumnDefinitionsSelector);
|
|
126
21
|
const filterModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridFilterModelSelector);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
132
|
-
const classes = useUtilityClasses(rootProps);
|
|
133
|
-
const valueRef = React.useRef(null);
|
|
134
|
-
const filterSelectorRef = React.useRef(null);
|
|
135
|
-
const multiFilterOperator = filterModel.logicOperator ?? _gridFilterItem.GridLogicOperator.And;
|
|
136
|
-
const hasLogicOperatorColumn = hasMultipleFilters && logicOperators.length > 0;
|
|
137
|
-
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
138
|
-
const isBaseSelectNative = baseSelectProps.native ?? false;
|
|
139
|
-
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
140
|
-
const {
|
|
141
|
-
InputComponentProps
|
|
142
|
-
} = valueInputProps,
|
|
143
|
-
valueInputPropsOther = (0, _objectWithoutPropertiesLoose2.default)(valueInputProps, _excluded2);
|
|
144
|
-
const pivotActive = (0, _useGridSelector.useGridSelector)(apiRef, _pivoting.gridPivotActiveSelector);
|
|
145
|
-
const initialColumns = (0, _useGridSelector.useGridSelector)(apiRef, _pivoting.gridPivotInitialColumnsSelector);
|
|
146
|
-
const {
|
|
147
|
-
filteredColumns,
|
|
148
|
-
selectedField
|
|
149
|
-
} = React.useMemo(() => {
|
|
150
|
-
let itemField = item.field;
|
|
151
|
-
|
|
152
|
-
// Yields a valid value if the current filter belongs to a column that is not filterable
|
|
153
|
-
const selectedNonFilterableColumn = columnLookup[item.field].filterable === false ? columnLookup[item.field] : null;
|
|
154
|
-
if (selectedNonFilterableColumn) {
|
|
155
|
-
return {
|
|
156
|
-
filteredColumns: [selectedNonFilterableColumn],
|
|
157
|
-
selectedField: itemField
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
if (pivotActive) {
|
|
161
|
-
return {
|
|
162
|
-
filteredColumns: filterableColumns.filter(column => initialColumns.get(column.field) !== undefined),
|
|
163
|
-
selectedField: itemField
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
if (filterColumns === undefined || typeof filterColumns !== 'function') {
|
|
167
|
-
return {
|
|
168
|
-
filteredColumns: filterableColumns,
|
|
169
|
-
selectedField: itemField
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
const filteredFields = filterColumns({
|
|
173
|
-
field: item.field,
|
|
174
|
-
columns: filterableColumns,
|
|
175
|
-
currentFilters: filterModel?.items || []
|
|
176
|
-
});
|
|
177
|
-
return {
|
|
178
|
-
filteredColumns: filterableColumns.filter(column => {
|
|
179
|
-
const isFieldIncluded = filteredFields.includes(column.field);
|
|
180
|
-
if (column.field === item.field && !isFieldIncluded) {
|
|
181
|
-
itemField = undefined;
|
|
182
|
-
}
|
|
183
|
-
return isFieldIncluded;
|
|
184
|
-
}),
|
|
185
|
-
selectedField: itemField
|
|
186
|
-
};
|
|
187
|
-
}, [item.field, columnLookup, pivotActive, filterColumns, filterableColumns, filterModel?.items, initialColumns]);
|
|
188
|
-
const sortedFilteredColumns = React.useMemo(() => {
|
|
189
|
-
switch (columnsSort) {
|
|
190
|
-
case 'asc':
|
|
191
|
-
return filteredColumns.sort((a, b) => collator.compare(getColumnLabel(a), getColumnLabel(b)));
|
|
192
|
-
case 'desc':
|
|
193
|
-
return filteredColumns.sort((a, b) => -collator.compare(getColumnLabel(a), getColumnLabel(b)));
|
|
194
|
-
default:
|
|
195
|
-
return filteredColumns;
|
|
196
|
-
}
|
|
197
|
-
}, [filteredColumns, columnsSort]);
|
|
198
|
-
const currentColumn = item.field ? apiRef.current.getColumn(item.field) : null;
|
|
199
|
-
const currentOperator = React.useMemo(() => {
|
|
200
|
-
if (!item.operator || !currentColumn) {
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
return currentColumn.filterOperators?.find(operator => operator.value === item.operator);
|
|
204
|
-
}, [item, currentColumn]);
|
|
205
|
-
const changeColumn = React.useCallback(event => {
|
|
206
|
-
const field = event.target.value;
|
|
207
|
-
const column = apiRef.current.getColumn(field);
|
|
208
|
-
if (column.field === currentColumn.field) {
|
|
209
|
-
// column did not change
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// try to keep the same operator when column change
|
|
214
|
-
const newOperator = column.filterOperators.find(operator => operator.value === item.operator) || column.filterOperators[0];
|
|
215
|
-
|
|
216
|
-
// Erase filter value if the input component or filtered column type is modified
|
|
217
|
-
const eraseFilterValue = !newOperator.InputComponent || newOperator.InputComponent !== currentOperator?.InputComponent || column.type !== currentColumn.type;
|
|
218
|
-
let filterValue = eraseFilterValue ? undefined : item.value;
|
|
219
|
-
|
|
220
|
-
// Check filter value against the new valueOptions
|
|
221
|
-
if (column.type === 'singleSelect' && filterValue !== undefined) {
|
|
222
|
-
const colDef = column;
|
|
223
|
-
const valueOptions = (0, _filterPanelUtils.getValueOptions)(colDef);
|
|
224
|
-
if (Array.isArray(filterValue)) {
|
|
225
|
-
filterValue = filterValue.filter(val => {
|
|
226
|
-
return (
|
|
227
|
-
// Only keep values that are in the new value options
|
|
228
|
-
(0, _filterPanelUtils.getValueFromValueOptions)(val, valueOptions, colDef?.getOptionValue) !== undefined
|
|
229
|
-
);
|
|
230
|
-
});
|
|
231
|
-
} else if ((0, _filterPanelUtils.getValueFromValueOptions)(item.value, valueOptions, colDef?.getOptionValue) === undefined) {
|
|
232
|
-
// Reset the filter value if it is not in the new value options
|
|
233
|
-
filterValue = undefined;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
applyFilterChanges((0, _extends2.default)({}, item, {
|
|
237
|
-
field,
|
|
238
|
-
operator: newOperator.value,
|
|
239
|
-
value: filterValue
|
|
240
|
-
}));
|
|
241
|
-
}, [apiRef, applyFilterChanges, item, currentColumn, currentOperator]);
|
|
242
|
-
const changeOperator = React.useCallback(event => {
|
|
243
|
-
const operator = event.target.value;
|
|
244
|
-
const newOperator = currentColumn?.filterOperators.find(op => op.value === operator);
|
|
245
|
-
const eraseItemValue = !newOperator?.InputComponent || newOperator?.InputComponent !== currentOperator?.InputComponent;
|
|
246
|
-
applyFilterChanges((0, _extends2.default)({}, item, {
|
|
247
|
-
operator,
|
|
248
|
-
value: eraseItemValue ? undefined : item.value
|
|
249
|
-
}));
|
|
250
|
-
}, [applyFilterChanges, item, currentColumn, currentOperator]);
|
|
251
|
-
const changeLogicOperator = React.useCallback(event => {
|
|
252
|
-
const logicOperator = event.target.value === _gridFilterItem.GridLogicOperator.And.toString() ? _gridFilterItem.GridLogicOperator.And : _gridFilterItem.GridLogicOperator.Or;
|
|
253
|
-
applyMultiFilterOperatorChanges(logicOperator);
|
|
254
|
-
}, [applyMultiFilterOperatorChanges]);
|
|
255
|
-
const handleDeleteFilter = () => {
|
|
256
|
-
deleteFilter(item);
|
|
257
|
-
};
|
|
258
|
-
React.useImperativeHandle(focusElementRef, () => ({
|
|
259
|
-
focus: () => {
|
|
260
|
-
if (currentOperator?.InputComponent) {
|
|
261
|
-
valueRef?.current?.focus();
|
|
262
|
-
} else {
|
|
263
|
-
filterSelectorRef.current.focus();
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}), [currentOperator]);
|
|
267
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GridFilterFormRoot, (0, _extends2.default)({
|
|
268
|
-
className: classes.root,
|
|
269
|
-
"data-id": item.id,
|
|
270
|
-
ownerState: rootProps
|
|
271
|
-
}, other, {
|
|
272
|
-
ref: ref,
|
|
273
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormDeleteIcon, (0, _extends2.default)({}, deleteIconProps, {
|
|
274
|
-
className: (0, _clsx.default)(classes.deleteIcon, deleteIconProps.className),
|
|
275
|
-
ownerState: rootProps,
|
|
276
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, (0, _extends2.default)({
|
|
277
|
-
"aria-label": apiRef.current.getLocaleText('filterPanelDeleteIconLabel'),
|
|
278
|
-
title: apiRef.current.getLocaleText('filterPanelDeleteIconLabel'),
|
|
279
|
-
onClick: handleDeleteFilter,
|
|
280
|
-
size: "small",
|
|
281
|
-
disabled: readOnly
|
|
282
|
-
}, rootProps.slotProps?.baseIconButton, {
|
|
283
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.filterPanelDeleteIcon, {
|
|
284
|
-
fontSize: "small"
|
|
285
|
-
})
|
|
286
|
-
}))
|
|
287
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormLogicOperatorInput, (0, _extends2.default)({
|
|
288
|
-
as: rootProps.slots.baseSelect,
|
|
289
|
-
sx: [hasLogicOperatorColumn ? {
|
|
290
|
-
display: 'flex'
|
|
291
|
-
} : {
|
|
292
|
-
display: 'none'
|
|
293
|
-
}, showMultiFilterOperators ? {
|
|
294
|
-
visibility: 'visible'
|
|
295
|
-
} : {
|
|
296
|
-
visibility: 'hidden'
|
|
297
|
-
}, logicOperatorInputProps.sx],
|
|
298
|
-
className: (0, _clsx.default)(classes.logicOperatorInput, logicOperatorInputProps.className),
|
|
299
|
-
ownerState: rootProps
|
|
300
|
-
}, logicOperatorInputProps, {
|
|
301
|
-
size: "small",
|
|
302
|
-
slotProps: {
|
|
303
|
-
htmlInput: {
|
|
304
|
-
'aria-label': apiRef.current.getLocaleText('filterPanelLogicOperator')
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
value: multiFilterOperator ?? '',
|
|
308
|
-
onChange: changeLogicOperator,
|
|
309
|
-
disabled: !!disableMultiFilterOperator || logicOperators.length === 1,
|
|
310
|
-
native: isBaseSelectNative
|
|
311
|
-
}, rootProps.slotProps?.baseSelect, {
|
|
312
|
-
children: logicOperators.map(logicOperator => /*#__PURE__*/(0, _react.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
313
|
-
native: isBaseSelectNative,
|
|
314
|
-
key: logicOperator.toString(),
|
|
315
|
-
value: logicOperator.toString()
|
|
316
|
-
}), apiRef.current.getLocaleText(getLogicOperatorLocaleKey(logicOperator))))
|
|
317
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormColumnInput, (0, _extends2.default)({
|
|
318
|
-
as: rootProps.slots.baseSelect
|
|
319
|
-
}, columnInputProps, {
|
|
320
|
-
className: (0, _clsx.default)(classes.columnInput, columnInputProps.className),
|
|
321
|
-
ownerState: rootProps,
|
|
322
|
-
size: "small",
|
|
323
|
-
labelId: columnSelectLabelId,
|
|
324
|
-
id: columnSelectId,
|
|
325
|
-
label: apiRef.current.getLocaleText('filterPanelColumn'),
|
|
326
|
-
value: selectedField ?? '',
|
|
327
|
-
onChange: changeColumn,
|
|
328
|
-
native: isBaseSelectNative,
|
|
329
|
-
disabled: readOnly
|
|
330
|
-
}, rootProps.slotProps?.baseSelect, {
|
|
331
|
-
children: sortedFilteredColumns.map(col => /*#__PURE__*/(0, _react.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
332
|
-
native: isBaseSelectNative,
|
|
333
|
-
key: col.field,
|
|
334
|
-
value: col.field
|
|
335
|
-
}), getColumnLabel(col)))
|
|
336
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormOperatorInput, (0, _extends2.default)({
|
|
337
|
-
as: rootProps.slots.baseSelect,
|
|
338
|
-
size: "small"
|
|
339
|
-
}, operatorInputProps, {
|
|
340
|
-
className: (0, _clsx.default)(classes.operatorInput, operatorInputProps.className),
|
|
341
|
-
ownerState: rootProps,
|
|
342
|
-
labelId: operatorSelectLabelId,
|
|
343
|
-
label: apiRef.current.getLocaleText('filterPanelOperator'),
|
|
344
|
-
id: operatorSelectId,
|
|
345
|
-
value: item.operator,
|
|
346
|
-
onChange: changeOperator,
|
|
347
|
-
native: isBaseSelectNative,
|
|
348
|
-
inputRef: filterSelectorRef,
|
|
349
|
-
disabled: readOnly
|
|
350
|
-
}, rootProps.slotProps?.baseSelect, {
|
|
351
|
-
children: currentColumn?.filterOperators?.map(operator => /*#__PURE__*/(0, _react.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
352
|
-
native: isBaseSelectNative,
|
|
353
|
-
key: operator.value,
|
|
354
|
-
value: operator.value
|
|
355
|
-
}), operator.label || apiRef.current.getLocaleText(`filterOperator${(0, _capitalize.default)(operator.value)}`)))
|
|
356
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormValueInput, (0, _extends2.default)({}, valueInputPropsOther, {
|
|
357
|
-
className: (0, _clsx.default)(classes.valueInput, valueInputPropsOther.className),
|
|
358
|
-
ownerState: rootProps,
|
|
359
|
-
children: currentOperator?.InputComponent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(currentOperator.InputComponent, (0, _extends2.default)({
|
|
360
|
-
apiRef: apiRef,
|
|
361
|
-
item: item,
|
|
362
|
-
applyValue: applyFilterChanges,
|
|
363
|
-
focusElementRef: valueRef,
|
|
364
|
-
disabled: readOnly,
|
|
365
|
-
slotProps: {
|
|
366
|
-
root: {
|
|
367
|
-
size: 'small'
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}, currentOperator.InputComponentProps, InputComponentProps), item.field) : null
|
|
371
|
-
}))]
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridFilterFormBase.GridFilterFormBase, (0, _extends2.default)({
|
|
23
|
+
filterModel: filterModel
|
|
24
|
+
}, props, {
|
|
25
|
+
ref: ref
|
|
372
26
|
}));
|
|
373
27
|
});
|
|
374
28
|
if (process.env.NODE_ENV !== "production") GridFilterForm.displayName = "GridFilterForm";
|