@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,197 +1,42 @@
|
|
|
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
|
-
exports.
|
|
9
|
+
exports.GridFilterPanel = void 0;
|
|
10
|
+
Object.defineProperty(exports, "getGridFilter", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _GridFilterPanelBase.getGridFilter;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
10
16
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
17
|
var React = _interopRequireWildcard(require("react"));
|
|
13
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
19
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
15
|
-
var _gridFilterItem = require("../../../models/gridFilterItem");
|
|
16
20
|
var _useGridApiContext = require("../../../hooks/utils/useGridApiContext");
|
|
17
|
-
var _GridPanelContent = require("../GridPanelContent");
|
|
18
|
-
var _GridPanelFooter = require("../GridPanelFooter");
|
|
19
|
-
var _GridPanelWrapper = require("../GridPanelWrapper");
|
|
20
|
-
var _GridFilterForm = require("./GridFilterForm");
|
|
21
|
-
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
22
21
|
var _useGridSelector = require("../../../hooks/utils/useGridSelector");
|
|
23
22
|
var _gridFilterSelector = require("../../../hooks/features/filter/gridFilterSelector");
|
|
24
|
-
var
|
|
23
|
+
var _GridFilterPanelBase = require("./GridFilterPanelBase");
|
|
25
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
const _excluded = ["logicOperators", "columnsSort", "filterFormProps", "getColumnForNewFilter", "children", "disableAddFilterButton", "disableRemoveAllButton"];
|
|
27
|
-
const getGridFilter = col => ({
|
|
28
|
-
field: col.field,
|
|
29
|
-
operator: col.filterOperators[0].value,
|
|
30
|
-
id: Math.round(Math.random() * 1e5)
|
|
31
|
-
});
|
|
32
|
-
exports.getGridFilter = getGridFilter;
|
|
33
25
|
const GridFilterPanel = exports.GridFilterPanel = (0, _forwardRef.forwardRef)(function GridFilterPanel(props, ref) {
|
|
34
26
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
35
|
-
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
36
27
|
const filterModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridFilterModelSelector);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const lastFilterRef = React.useRef(null);
|
|
40
|
-
const placeholderFilter = React.useRef(null);
|
|
41
|
-
const {
|
|
42
|
-
logicOperators = [_gridFilterItem.GridLogicOperator.And, _gridFilterItem.GridLogicOperator.Or],
|
|
43
|
-
columnsSort,
|
|
44
|
-
filterFormProps,
|
|
45
|
-
getColumnForNewFilter,
|
|
46
|
-
disableAddFilterButton = false,
|
|
47
|
-
disableRemoveAllButton = false
|
|
48
|
-
} = props,
|
|
49
|
-
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
50
|
-
const applyFilter = apiRef.current.upsertFilterItem;
|
|
51
|
-
const applyFilterLogicOperator = React.useCallback(operator => {
|
|
52
|
-
apiRef.current.setFilterLogicOperator(operator);
|
|
28
|
+
const handleFilterModelChange = React.useCallback((model, reason) => {
|
|
29
|
+
apiRef.current.setFilterModel(model, reason);
|
|
53
30
|
}, [apiRef]);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
if (nextFieldName === null) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
nextColumnWithOperator = filterableColumns.find(({
|
|
66
|
-
field
|
|
67
|
-
}) => field === nextFieldName);
|
|
68
|
-
} else {
|
|
69
|
-
nextColumnWithOperator = filterableColumns.find(colDef => colDef.filterOperators?.length);
|
|
70
|
-
}
|
|
71
|
-
if (!nextColumnWithOperator) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
return getGridFilter(nextColumnWithOperator);
|
|
75
|
-
}, [filterModel?.items, filterableColumns, getColumnForNewFilter]);
|
|
76
|
-
const getNewFilter = React.useCallback(() => {
|
|
77
|
-
if (getColumnForNewFilter === undefined || typeof getColumnForNewFilter !== 'function') {
|
|
78
|
-
return getDefaultFilter();
|
|
79
|
-
}
|
|
80
|
-
const currentFilters = filterModel.items.length ? filterModel.items : [getDefaultFilter()].filter(Boolean);
|
|
81
|
-
|
|
82
|
-
// If no items are there in filterModel, we have to pass defaultFilter
|
|
83
|
-
const nextColumnFieldName = getColumnForNewFilter({
|
|
84
|
-
currentFilters: currentFilters,
|
|
85
|
-
columns: filterableColumns
|
|
86
|
-
});
|
|
87
|
-
if (nextColumnFieldName === null) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
const nextColumnWithOperator = filterableColumns.find(({
|
|
91
|
-
field
|
|
92
|
-
}) => field === nextColumnFieldName);
|
|
93
|
-
if (!nextColumnWithOperator) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return getGridFilter(nextColumnWithOperator);
|
|
97
|
-
}, [filterModel.items, filterableColumns, getColumnForNewFilter, getDefaultFilter]);
|
|
98
|
-
const items = React.useMemo(() => {
|
|
99
|
-
if (filterModel.items.length) {
|
|
100
|
-
return filterModel.items;
|
|
101
|
-
}
|
|
102
|
-
if (!placeholderFilter.current) {
|
|
103
|
-
placeholderFilter.current = getDefaultFilter();
|
|
104
|
-
}
|
|
105
|
-
return placeholderFilter.current ? [placeholderFilter.current] : [];
|
|
106
|
-
}, [filterModel.items, getDefaultFilter]);
|
|
107
|
-
const hasMultipleFilters = items.length > 1;
|
|
108
|
-
const {
|
|
109
|
-
readOnlyFilters,
|
|
110
|
-
validFilters
|
|
111
|
-
} = React.useMemo(() => items.reduce((acc, item) => {
|
|
112
|
-
if (filterableColumnsLookup[item.field]) {
|
|
113
|
-
acc.validFilters.push(item);
|
|
114
|
-
} else {
|
|
115
|
-
acc.readOnlyFilters.push(item);
|
|
116
|
-
}
|
|
117
|
-
return acc;
|
|
118
|
-
}, {
|
|
119
|
-
readOnlyFilters: [],
|
|
120
|
-
validFilters: []
|
|
121
|
-
}), [items, filterableColumnsLookup]);
|
|
122
|
-
const addNewFilter = React.useCallback(() => {
|
|
123
|
-
const newFilter = getNewFilter();
|
|
124
|
-
if (!newFilter) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
apiRef.current.upsertFilterItems([...items, newFilter]);
|
|
128
|
-
}, [apiRef, getNewFilter, items]);
|
|
129
|
-
const deleteFilter = React.useCallback(item => {
|
|
130
|
-
const shouldCloseFilterPanel = validFilters.length === 1;
|
|
131
|
-
apiRef.current.deleteFilterItem(item);
|
|
132
|
-
if (shouldCloseFilterPanel) {
|
|
133
|
-
apiRef.current.hideFilterPanel();
|
|
134
|
-
}
|
|
135
|
-
}, [apiRef, validFilters.length]);
|
|
136
|
-
const handleRemoveAll = React.useCallback(() => {
|
|
137
|
-
if (validFilters.length === 1 && validFilters[0].value === undefined) {
|
|
138
|
-
apiRef.current.deleteFilterItem(validFilters[0]);
|
|
139
|
-
return apiRef.current.hideFilterPanel();
|
|
140
|
-
}
|
|
141
|
-
return apiRef.current.setFilterModel((0, _extends2.default)({}, filterModel, {
|
|
142
|
-
items: readOnlyFilters
|
|
143
|
-
}), 'removeAllFilterItems');
|
|
144
|
-
}, [apiRef, readOnlyFilters, filterModel, validFilters]);
|
|
145
|
-
React.useEffect(() => {
|
|
146
|
-
if (logicOperators.length > 0 && filterModel.logicOperator && !logicOperators.includes(filterModel.logicOperator)) {
|
|
147
|
-
applyFilterLogicOperator(logicOperators[0]);
|
|
148
|
-
}
|
|
149
|
-
}, [logicOperators, applyFilterLogicOperator, filterModel.logicOperator]);
|
|
150
|
-
React.useEffect(() => {
|
|
151
|
-
if (validFilters.length > 0) {
|
|
152
|
-
lastFilterRef.current.focus();
|
|
153
|
-
}
|
|
154
|
-
}, [validFilters.length]);
|
|
155
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridPanelWrapper.GridPanelWrapper, (0, _extends2.default)({}, other, {
|
|
31
|
+
const handleClose = React.useCallback(() => {
|
|
32
|
+
apiRef.current.hideFilterPanel();
|
|
33
|
+
}, [apiRef]);
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridFilterPanelBase.GridFilterPanelBase, (0, _extends2.default)({}, props, {
|
|
35
|
+
filterModel: filterModel,
|
|
36
|
+
onFilterModelChange: handleFilterModelChange,
|
|
37
|
+
onClose: handleClose,
|
|
156
38
|
ref: ref,
|
|
157
|
-
|
|
158
|
-
children: [readOnlyFilters.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridFilterForm.GridFilterForm, (0, _extends2.default)({
|
|
159
|
-
item: item,
|
|
160
|
-
applyFilterChanges: applyFilter,
|
|
161
|
-
deleteFilter: deleteFilter,
|
|
162
|
-
hasMultipleFilters: hasMultipleFilters,
|
|
163
|
-
showMultiFilterOperators: index > 0,
|
|
164
|
-
disableMultiFilterOperator: index !== 1,
|
|
165
|
-
applyMultiFilterOperatorChanges: applyFilterLogicOperator,
|
|
166
|
-
focusElementRef: null,
|
|
167
|
-
readOnly: true,
|
|
168
|
-
logicOperators: logicOperators,
|
|
169
|
-
columnsSort: columnsSort
|
|
170
|
-
}, filterFormProps), item.id == null ? index : item.id)), validFilters.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridFilterForm.GridFilterForm, (0, _extends2.default)({
|
|
171
|
-
item: item,
|
|
172
|
-
applyFilterChanges: applyFilter,
|
|
173
|
-
deleteFilter: deleteFilter,
|
|
174
|
-
hasMultipleFilters: hasMultipleFilters,
|
|
175
|
-
showMultiFilterOperators: readOnlyFilters.length + index > 0,
|
|
176
|
-
disableMultiFilterOperator: readOnlyFilters.length + index !== 1,
|
|
177
|
-
applyMultiFilterOperatorChanges: applyFilterLogicOperator,
|
|
178
|
-
focusElementRef: index === validFilters.length - 1 ? lastFilterRef : null,
|
|
179
|
-
logicOperators: logicOperators,
|
|
180
|
-
columnsSort: columnsSort
|
|
181
|
-
}, filterFormProps), item.id == null ? index + readOnlyFilters.length : item.id))]
|
|
182
|
-
}), !rootProps.disableMultipleColumnsFiltering && !(disableAddFilterButton && disableRemoveAllButton) ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridPanelFooter.GridPanelFooter, {
|
|
183
|
-
children: [!disableAddFilterButton ? /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseButton, (0, _extends2.default)({
|
|
184
|
-
onClick: addNewFilter,
|
|
185
|
-
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.filterPanelAddIcon, {})
|
|
186
|
-
}, rootProps.slotProps?.baseButton, {
|
|
187
|
-
children: apiRef.current.getLocaleText('filterPanelAddFilter')
|
|
188
|
-
})) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}), !disableRemoveAllButton && validFilters.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseButton, (0, _extends2.default)({
|
|
189
|
-
onClick: handleRemoveAll,
|
|
190
|
-
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.filterPanelRemoveAllIcon, {})
|
|
191
|
-
}, rootProps.slotProps?.baseButton, {
|
|
192
|
-
children: apiRef.current.getLocaleText('filterPanelRemoveAll')
|
|
193
|
-
})) : null]
|
|
194
|
-
}) : null]
|
|
39
|
+
disableDebounce: false
|
|
195
40
|
}));
|
|
196
41
|
});
|
|
197
42
|
if (process.env.NODE_ENV !== "production") GridFilterPanel.displayName = "GridFilterPanel";
|
|
@@ -1,189 +1,29 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["logicOperators", "columnsSort", "filterFormProps", "getColumnForNewFilter", "children", "disableAddFilterButton", "disableRemoveAllButton"];
|
|
6
4
|
import * as React from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
6
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
9
|
-
import { GridLogicOperator } from "../../../models/gridFilterItem.mjs";
|
|
10
7
|
import { useGridApiContext } from "../../../hooks/utils/useGridApiContext.mjs";
|
|
11
|
-
import { GridPanelContent } from "../GridPanelContent.mjs";
|
|
12
|
-
import { GridPanelFooter } from "../GridPanelFooter.mjs";
|
|
13
|
-
import { GridPanelWrapper } from "../GridPanelWrapper.mjs";
|
|
14
|
-
import { GridFilterForm } from "./GridFilterForm.mjs";
|
|
15
|
-
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.mjs";
|
|
16
8
|
import { useGridSelector } from "../../../hooks/utils/useGridSelector.mjs";
|
|
17
9
|
import { gridFilterModelSelector } from "../../../hooks/features/filter/gridFilterSelector.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { jsx as _jsx
|
|
20
|
-
const getGridFilter = col => ({
|
|
21
|
-
field: col.field,
|
|
22
|
-
operator: col.filterOperators[0].value,
|
|
23
|
-
id: Math.round(Math.random() * 1e5)
|
|
24
|
-
});
|
|
10
|
+
import { GridFilterPanelBase } from "./GridFilterPanelBase.mjs";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
12
|
const GridFilterPanel = forwardRef(function GridFilterPanel(props, ref) {
|
|
26
13
|
const apiRef = useGridApiContext();
|
|
27
|
-
const rootProps = useGridRootProps();
|
|
28
14
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const lastFilterRef = React.useRef(null);
|
|
32
|
-
const placeholderFilter = React.useRef(null);
|
|
33
|
-
const {
|
|
34
|
-
logicOperators = [GridLogicOperator.And, GridLogicOperator.Or],
|
|
35
|
-
columnsSort,
|
|
36
|
-
filterFormProps,
|
|
37
|
-
getColumnForNewFilter,
|
|
38
|
-
disableAddFilterButton = false,
|
|
39
|
-
disableRemoveAllButton = false
|
|
40
|
-
} = props,
|
|
41
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
42
|
-
const applyFilter = apiRef.current.upsertFilterItem;
|
|
43
|
-
const applyFilterLogicOperator = React.useCallback(operator => {
|
|
44
|
-
apiRef.current.setFilterLogicOperator(operator);
|
|
15
|
+
const handleFilterModelChange = React.useCallback((model, reason) => {
|
|
16
|
+
apiRef.current.setFilterModel(model, reason);
|
|
45
17
|
}, [apiRef]);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
if (nextFieldName === null) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
nextColumnWithOperator = filterableColumns.find(({
|
|
58
|
-
field
|
|
59
|
-
}) => field === nextFieldName);
|
|
60
|
-
} else {
|
|
61
|
-
nextColumnWithOperator = filterableColumns.find(colDef => colDef.filterOperators?.length);
|
|
62
|
-
}
|
|
63
|
-
if (!nextColumnWithOperator) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
return getGridFilter(nextColumnWithOperator);
|
|
67
|
-
}, [filterModel?.items, filterableColumns, getColumnForNewFilter]);
|
|
68
|
-
const getNewFilter = React.useCallback(() => {
|
|
69
|
-
if (getColumnForNewFilter === undefined || typeof getColumnForNewFilter !== 'function') {
|
|
70
|
-
return getDefaultFilter();
|
|
71
|
-
}
|
|
72
|
-
const currentFilters = filterModel.items.length ? filterModel.items : [getDefaultFilter()].filter(Boolean);
|
|
73
|
-
|
|
74
|
-
// If no items are there in filterModel, we have to pass defaultFilter
|
|
75
|
-
const nextColumnFieldName = getColumnForNewFilter({
|
|
76
|
-
currentFilters: currentFilters,
|
|
77
|
-
columns: filterableColumns
|
|
78
|
-
});
|
|
79
|
-
if (nextColumnFieldName === null) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
const nextColumnWithOperator = filterableColumns.find(({
|
|
83
|
-
field
|
|
84
|
-
}) => field === nextColumnFieldName);
|
|
85
|
-
if (!nextColumnWithOperator) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
return getGridFilter(nextColumnWithOperator);
|
|
89
|
-
}, [filterModel.items, filterableColumns, getColumnForNewFilter, getDefaultFilter]);
|
|
90
|
-
const items = React.useMemo(() => {
|
|
91
|
-
if (filterModel.items.length) {
|
|
92
|
-
return filterModel.items;
|
|
93
|
-
}
|
|
94
|
-
if (!placeholderFilter.current) {
|
|
95
|
-
placeholderFilter.current = getDefaultFilter();
|
|
96
|
-
}
|
|
97
|
-
return placeholderFilter.current ? [placeholderFilter.current] : [];
|
|
98
|
-
}, [filterModel.items, getDefaultFilter]);
|
|
99
|
-
const hasMultipleFilters = items.length > 1;
|
|
100
|
-
const {
|
|
101
|
-
readOnlyFilters,
|
|
102
|
-
validFilters
|
|
103
|
-
} = React.useMemo(() => items.reduce((acc, item) => {
|
|
104
|
-
if (filterableColumnsLookup[item.field]) {
|
|
105
|
-
acc.validFilters.push(item);
|
|
106
|
-
} else {
|
|
107
|
-
acc.readOnlyFilters.push(item);
|
|
108
|
-
}
|
|
109
|
-
return acc;
|
|
110
|
-
}, {
|
|
111
|
-
readOnlyFilters: [],
|
|
112
|
-
validFilters: []
|
|
113
|
-
}), [items, filterableColumnsLookup]);
|
|
114
|
-
const addNewFilter = React.useCallback(() => {
|
|
115
|
-
const newFilter = getNewFilter();
|
|
116
|
-
if (!newFilter) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
apiRef.current.upsertFilterItems([...items, newFilter]);
|
|
120
|
-
}, [apiRef, getNewFilter, items]);
|
|
121
|
-
const deleteFilter = React.useCallback(item => {
|
|
122
|
-
const shouldCloseFilterPanel = validFilters.length === 1;
|
|
123
|
-
apiRef.current.deleteFilterItem(item);
|
|
124
|
-
if (shouldCloseFilterPanel) {
|
|
125
|
-
apiRef.current.hideFilterPanel();
|
|
126
|
-
}
|
|
127
|
-
}, [apiRef, validFilters.length]);
|
|
128
|
-
const handleRemoveAll = React.useCallback(() => {
|
|
129
|
-
if (validFilters.length === 1 && validFilters[0].value === undefined) {
|
|
130
|
-
apiRef.current.deleteFilterItem(validFilters[0]);
|
|
131
|
-
return apiRef.current.hideFilterPanel();
|
|
132
|
-
}
|
|
133
|
-
return apiRef.current.setFilterModel(_extends({}, filterModel, {
|
|
134
|
-
items: readOnlyFilters
|
|
135
|
-
}), 'removeAllFilterItems');
|
|
136
|
-
}, [apiRef, readOnlyFilters, filterModel, validFilters]);
|
|
137
|
-
React.useEffect(() => {
|
|
138
|
-
if (logicOperators.length > 0 && filterModel.logicOperator && !logicOperators.includes(filterModel.logicOperator)) {
|
|
139
|
-
applyFilterLogicOperator(logicOperators[0]);
|
|
140
|
-
}
|
|
141
|
-
}, [logicOperators, applyFilterLogicOperator, filterModel.logicOperator]);
|
|
142
|
-
React.useEffect(() => {
|
|
143
|
-
if (validFilters.length > 0) {
|
|
144
|
-
lastFilterRef.current.focus();
|
|
145
|
-
}
|
|
146
|
-
}, [validFilters.length]);
|
|
147
|
-
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({}, other, {
|
|
18
|
+
const handleClose = React.useCallback(() => {
|
|
19
|
+
apiRef.current.hideFilterPanel();
|
|
20
|
+
}, [apiRef]);
|
|
21
|
+
return /*#__PURE__*/_jsx(GridFilterPanelBase, _extends({}, props, {
|
|
22
|
+
filterModel: filterModel,
|
|
23
|
+
onFilterModelChange: handleFilterModelChange,
|
|
24
|
+
onClose: handleClose,
|
|
148
25
|
ref: ref,
|
|
149
|
-
|
|
150
|
-
children: [readOnlyFilters.map((item, index) => /*#__PURE__*/_jsx(GridFilterForm, _extends({
|
|
151
|
-
item: item,
|
|
152
|
-
applyFilterChanges: applyFilter,
|
|
153
|
-
deleteFilter: deleteFilter,
|
|
154
|
-
hasMultipleFilters: hasMultipleFilters,
|
|
155
|
-
showMultiFilterOperators: index > 0,
|
|
156
|
-
disableMultiFilterOperator: index !== 1,
|
|
157
|
-
applyMultiFilterOperatorChanges: applyFilterLogicOperator,
|
|
158
|
-
focusElementRef: null,
|
|
159
|
-
readOnly: true,
|
|
160
|
-
logicOperators: logicOperators,
|
|
161
|
-
columnsSort: columnsSort
|
|
162
|
-
}, filterFormProps), item.id == null ? index : item.id)), validFilters.map((item, index) => /*#__PURE__*/_jsx(GridFilterForm, _extends({
|
|
163
|
-
item: item,
|
|
164
|
-
applyFilterChanges: applyFilter,
|
|
165
|
-
deleteFilter: deleteFilter,
|
|
166
|
-
hasMultipleFilters: hasMultipleFilters,
|
|
167
|
-
showMultiFilterOperators: readOnlyFilters.length + index > 0,
|
|
168
|
-
disableMultiFilterOperator: readOnlyFilters.length + index !== 1,
|
|
169
|
-
applyMultiFilterOperatorChanges: applyFilterLogicOperator,
|
|
170
|
-
focusElementRef: index === validFilters.length - 1 ? lastFilterRef : null,
|
|
171
|
-
logicOperators: logicOperators,
|
|
172
|
-
columnsSort: columnsSort
|
|
173
|
-
}, filterFormProps), item.id == null ? index + readOnlyFilters.length : item.id))]
|
|
174
|
-
}), !rootProps.disableMultipleColumnsFiltering && !(disableAddFilterButton && disableRemoveAllButton) ? /*#__PURE__*/_jsxs(GridPanelFooter, {
|
|
175
|
-
children: [!disableAddFilterButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
176
|
-
onClick: addNewFilter,
|
|
177
|
-
startIcon: /*#__PURE__*/_jsx(rootProps.slots.filterPanelAddIcon, {})
|
|
178
|
-
}, rootProps.slotProps?.baseButton, {
|
|
179
|
-
children: apiRef.current.getLocaleText('filterPanelAddFilter')
|
|
180
|
-
})) : /*#__PURE__*/_jsx("span", {}), !disableRemoveAllButton && validFilters.length > 0 ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
181
|
-
onClick: handleRemoveAll,
|
|
182
|
-
startIcon: /*#__PURE__*/_jsx(rootProps.slots.filterPanelRemoveAllIcon, {})
|
|
183
|
-
}, rootProps.slotProps?.baseButton, {
|
|
184
|
-
children: apiRef.current.getLocaleText('filterPanelRemoveAll')
|
|
185
|
-
})) : null]
|
|
186
|
-
}) : null]
|
|
26
|
+
disableDebounce: false
|
|
187
27
|
}));
|
|
188
28
|
});
|
|
189
29
|
if (process.env.NODE_ENV !== "production") GridFilterPanel.displayName = "GridFilterPanel";
|
|
@@ -247,4 +87,5 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes /* remove-prop
|
|
|
247
87
|
* API:
|
|
248
88
|
* - [GridFilterPanel API](https://mui.com/x/api/data-grid/grid-filter-panel/)
|
|
249
89
|
*/
|
|
250
|
-
export { GridFilterPanel
|
|
90
|
+
export { GridFilterPanel };
|
|
91
|
+
export { getGridFilter } from "./GridFilterPanelBase.mjs";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import type { GridFilterItem } from "../../../models/gridFilterItem.mjs";
|
|
4
|
+
import type { GridFilterModel } from "../../../models/gridFilterModel.mjs";
|
|
5
|
+
import type { GridControlledStateReasonLookup } from "../../../models/events/index.mjs";
|
|
6
|
+
import type { GridFilterFormProps } from "./GridFilterFormBase.mjs";
|
|
7
|
+
import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.mjs";
|
|
8
|
+
export interface GetColumnForNewFilterArgs {
|
|
9
|
+
currentFilters: GridFilterItem[];
|
|
10
|
+
columns: GridStateColDef[];
|
|
11
|
+
}
|
|
12
|
+
export interface GridFilterPanelProps extends Pick<GridFilterFormProps, 'logicOperators' | 'columnsSort'> {
|
|
13
|
+
/**
|
|
14
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
15
|
+
*/
|
|
16
|
+
sx?: SxProps<Theme>;
|
|
17
|
+
/**
|
|
18
|
+
* Function that returns the next filter item to be picked as default filter.
|
|
19
|
+
* @param {GetColumnForNewFilterArgs} args Currently configured filters and columns.
|
|
20
|
+
* @returns {GridColDef['field']} The field to be used for the next filter or `null` to prevent adding a filter.
|
|
21
|
+
*/
|
|
22
|
+
getColumnForNewFilter?: (args: GetColumnForNewFilterArgs) => GridColDef['field'] | null;
|
|
23
|
+
/**
|
|
24
|
+
* Props passed to each filter form.
|
|
25
|
+
*/
|
|
26
|
+
filterFormProps?: Pick<GridFilterFormProps, 'columnsSort' | 'deleteIconProps' | 'logicOperatorInputProps' | 'operatorInputProps' | 'columnInputProps' | 'valueInputProps' | 'filterColumns'>;
|
|
27
|
+
/**
|
|
28
|
+
* If `true`, the `Add filter` button will not be displayed.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
disableAddFilterButton?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* If `true`, the `Remove all` button will be disabled
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
disableRemoveAllButton?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @ignore - do not document.
|
|
39
|
+
*/
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
export interface GridFilterPanelBaseProps extends GridFilterPanelProps {
|
|
43
|
+
/**
|
|
44
|
+
* If `true`, filter value changes are applied immediately without debouncing.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
disableDebounce?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The filter model edited by the panel.
|
|
50
|
+
*/
|
|
51
|
+
filterModel: GridFilterModel;
|
|
52
|
+
/**
|
|
53
|
+
* Callback fired when the filter model is changed through the panel.
|
|
54
|
+
* @param {GridFilterModel} model The new filter model.
|
|
55
|
+
* @param {GridControlledStateReasonLookup['filter']} reason The reason for the model to have changed.
|
|
56
|
+
*/
|
|
57
|
+
onFilterModelChange: (model: GridFilterModel, reason?: GridControlledStateReasonLookup['filter']) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Callback fired when the panel requests to be closed, e.g. after the last filter is removed.
|
|
60
|
+
* In `GridFilterPanel` it hides the grid filter panel; for standalone usage it is a no-op
|
|
61
|
+
* unless provided.
|
|
62
|
+
*/
|
|
63
|
+
onClose?: () => void;
|
|
64
|
+
}
|
|
65
|
+
declare const getGridFilter: (col: GridStateColDef) => GridFilterItem;
|
|
66
|
+
declare const GridFilterPanelBase: React.ForwardRefExoticComponent<GridFilterPanelBaseProps> | React.ForwardRefExoticComponent<GridFilterPanelBaseProps & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
/**
|
|
68
|
+
* The lower-level filter panel used by `GridFilterPanel`.
|
|
69
|
+
* Unlike `GridFilterPanel`, it does not read or mutate the grid filter state — the model is
|
|
70
|
+
* provided through the `filterModel` prop and edits are reported through `onFilterModelChange`,
|
|
71
|
+
* which makes it usable with a controlled (draft) filter model.
|
|
72
|
+
*
|
|
73
|
+
* Demos:
|
|
74
|
+
* - [Filtering - overview](https://mui.com/x/react-data-grid/filtering/)
|
|
75
|
+
*
|
|
76
|
+
* API:
|
|
77
|
+
* - [GridFilterPanelBase API](https://mui.com/x/api/data-grid/grid-filter-panel-base/)
|
|
78
|
+
*/
|
|
79
|
+
export { GridFilterPanelBase, getGridFilter };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import type { GridFilterItem } from "../../../models/gridFilterItem.js";
|
|
4
|
+
import type { GridFilterModel } from "../../../models/gridFilterModel.js";
|
|
5
|
+
import type { GridControlledStateReasonLookup } from "../../../models/events/index.js";
|
|
6
|
+
import type { GridFilterFormProps } from "./GridFilterFormBase.js";
|
|
7
|
+
import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.js";
|
|
8
|
+
export interface GetColumnForNewFilterArgs {
|
|
9
|
+
currentFilters: GridFilterItem[];
|
|
10
|
+
columns: GridStateColDef[];
|
|
11
|
+
}
|
|
12
|
+
export interface GridFilterPanelProps extends Pick<GridFilterFormProps, 'logicOperators' | 'columnsSort'> {
|
|
13
|
+
/**
|
|
14
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
15
|
+
*/
|
|
16
|
+
sx?: SxProps<Theme>;
|
|
17
|
+
/**
|
|
18
|
+
* Function that returns the next filter item to be picked as default filter.
|
|
19
|
+
* @param {GetColumnForNewFilterArgs} args Currently configured filters and columns.
|
|
20
|
+
* @returns {GridColDef['field']} The field to be used for the next filter or `null` to prevent adding a filter.
|
|
21
|
+
*/
|
|
22
|
+
getColumnForNewFilter?: (args: GetColumnForNewFilterArgs) => GridColDef['field'] | null;
|
|
23
|
+
/**
|
|
24
|
+
* Props passed to each filter form.
|
|
25
|
+
*/
|
|
26
|
+
filterFormProps?: Pick<GridFilterFormProps, 'columnsSort' | 'deleteIconProps' | 'logicOperatorInputProps' | 'operatorInputProps' | 'columnInputProps' | 'valueInputProps' | 'filterColumns'>;
|
|
27
|
+
/**
|
|
28
|
+
* If `true`, the `Add filter` button will not be displayed.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
disableAddFilterButton?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* If `true`, the `Remove all` button will be disabled
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
disableRemoveAllButton?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @ignore - do not document.
|
|
39
|
+
*/
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
export interface GridFilterPanelBaseProps extends GridFilterPanelProps {
|
|
43
|
+
/**
|
|
44
|
+
* If `true`, filter value changes are applied immediately without debouncing.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
disableDebounce?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The filter model edited by the panel.
|
|
50
|
+
*/
|
|
51
|
+
filterModel: GridFilterModel;
|
|
52
|
+
/**
|
|
53
|
+
* Callback fired when the filter model is changed through the panel.
|
|
54
|
+
* @param {GridFilterModel} model The new filter model.
|
|
55
|
+
* @param {GridControlledStateReasonLookup['filter']} reason The reason for the model to have changed.
|
|
56
|
+
*/
|
|
57
|
+
onFilterModelChange: (model: GridFilterModel, reason?: GridControlledStateReasonLookup['filter']) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Callback fired when the panel requests to be closed, e.g. after the last filter is removed.
|
|
60
|
+
* In `GridFilterPanel` it hides the grid filter panel; for standalone usage it is a no-op
|
|
61
|
+
* unless provided.
|
|
62
|
+
*/
|
|
63
|
+
onClose?: () => void;
|
|
64
|
+
}
|
|
65
|
+
declare const getGridFilter: (col: GridStateColDef) => GridFilterItem;
|
|
66
|
+
declare const GridFilterPanelBase: React.ForwardRefExoticComponent<GridFilterPanelBaseProps> | React.ForwardRefExoticComponent<GridFilterPanelBaseProps & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
/**
|
|
68
|
+
* The lower-level filter panel used by `GridFilterPanel`.
|
|
69
|
+
* Unlike `GridFilterPanel`, it does not read or mutate the grid filter state — the model is
|
|
70
|
+
* provided through the `filterModel` prop and edits are reported through `onFilterModelChange`,
|
|
71
|
+
* which makes it usable with a controlled (draft) filter model.
|
|
72
|
+
*
|
|
73
|
+
* Demos:
|
|
74
|
+
* - [Filtering - overview](https://mui.com/x/react-data-grid/filtering/)
|
|
75
|
+
*
|
|
76
|
+
* API:
|
|
77
|
+
* - [GridFilterPanelBase API](https://mui.com/x/api/data-grid/grid-filter-panel-base/)
|
|
78
|
+
*/
|
|
79
|
+
export { GridFilterPanelBase, getGridFilter };
|