@mui/x-data-grid
Version:
The Community plan edition of the MUI X Data Grid components.
79 lines • 3.52 kB
TypeScript
import * as React from 'react';
import type { SxProps, Theme } from '@mui/material/styles';
import type { GridFilterItem } from "../../../models/gridFilterItem.js";
import type { GridFilterModel } from "../../../models/gridFilterModel.js";
import type { GridControlledStateReasonLookup } from "../../../models/events/index.js";
import type { GridFilterFormProps } from "./GridFilterFormBase.js";
import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.js";
export interface GetColumnForNewFilterArgs {
currentFilters: GridFilterItem[];
columns: GridStateColDef[];
}
export interface GridFilterPanelProps extends Pick<GridFilterFormProps, 'logicOperators' | 'columnsSort'> {
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
/**
* Function that returns the next filter item to be picked as default filter.
* @param {GetColumnForNewFilterArgs} args Currently configured filters and columns.
* @returns {GridColDef['field']} The field to be used for the next filter or `null` to prevent adding a filter.
*/
getColumnForNewFilter?: (args: GetColumnForNewFilterArgs) => GridColDef['field'] | null;
/**
* Props passed to each filter form.
*/
filterFormProps?: Pick<GridFilterFormProps, 'columnsSort' | 'deleteIconProps' | 'logicOperatorInputProps' | 'operatorInputProps' | 'columnInputProps' | 'valueInputProps' | 'filterColumns'>;
/**
* If `true`, the `Add filter` button will not be displayed.
* @default false
*/
disableAddFilterButton?: boolean;
/**
* If `true`, the `Remove all` button will be disabled
* @default false
*/
disableRemoveAllButton?: boolean;
/**
* @ignore - do not document.
*/
children?: React.ReactNode;
}
export interface GridFilterPanelBaseProps extends GridFilterPanelProps {
/**
* If `true`, filter value changes are applied immediately without debouncing.
* @default true
*/
disableDebounce?: boolean;
/**
* The filter model edited by the panel.
*/
filterModel: GridFilterModel;
/**
* Callback fired when the filter model is changed through the panel.
* @param {GridFilterModel} model The new filter model.
* @param {GridControlledStateReasonLookup['filter']} reason The reason for the model to have changed.
*/
onFilterModelChange: (model: GridFilterModel, reason?: GridControlledStateReasonLookup['filter']) => void;
/**
* Callback fired when the panel requests to be closed, e.g. after the last filter is removed.
* In `GridFilterPanel` it hides the grid filter panel; for standalone usage it is a no-op
* unless provided.
*/
onClose?: () => void;
}
declare const getGridFilter: (col: GridStateColDef) => GridFilterItem;
declare const GridFilterPanelBase: React.ForwardRefExoticComponent<GridFilterPanelBaseProps> | React.ForwardRefExoticComponent<GridFilterPanelBaseProps & React.RefAttributes<HTMLDivElement>>;
/**
* The lower-level filter panel used by `GridFilterPanel`.
* Unlike `GridFilterPanel`, it does not read or mutate the grid filter state — the model is
* provided through the `filterModel` prop and edits are reported through `onFilterModelChange`,
* which makes it usable with a controlled (draft) filter model.
*
* Demos:
* - [Filtering - overview](https://mui.com/x/react-data-grid/filtering/)
*
* API:
* - [GridFilterPanelBase API](https://mui.com/x/api/data-grid/grid-filter-panel-base/)
*/
export { GridFilterPanelBase, getGridFilter };