@mui/x-data-grid
Version:
The Community plan edition of the MUI X Data Grid components.
91 lines (89 loc) • 3.69 kB
JavaScript
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import * as React from 'react';
import PropTypes from 'prop-types';
import { forwardRef } from '@mui/x-internals/forwardRef';
import { useGridApiContext } from "../../../hooks/utils/useGridApiContext.mjs";
import { useGridSelector } from "../../../hooks/utils/useGridSelector.mjs";
import { gridFilterModelSelector } from "../../../hooks/features/filter/gridFilterSelector.mjs";
import { GridFilterPanelBase } from "./GridFilterPanelBase.mjs";
import { jsx as _jsx } from "react/jsx-runtime";
const GridFilterPanel = forwardRef(function GridFilterPanel(props, ref) {
const apiRef = useGridApiContext();
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
const handleFilterModelChange = React.useCallback((model, reason) => {
apiRef.current.setFilterModel(model, reason);
}, [apiRef]);
const handleClose = React.useCallback(() => {
apiRef.current.hideFilterPanel();
}, [apiRef]);
return /*#__PURE__*/_jsx(GridFilterPanelBase, _extends({}, props, {
filterModel: filterModel,
onFilterModelChange: handleFilterModelChange,
onClose: handleClose,
ref: ref,
disableDebounce: false
}));
});
if (process.env.NODE_ENV !== "production") GridFilterPanel.displayName = "GridFilterPanel";
process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes /* remove-proptypes */ = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "pnpm proptypes" |
// ----------------------------------------------------------------------
/**
* @ignore - do not document.
*/
children: PropTypes.node,
/**
* Changes how the options in the columns selector should be ordered.
* If not specified, the order is derived from the `columns` prop.
*/
columnsSort: PropTypes.oneOf(['asc', 'desc']),
/**
* If `true`, the `Add filter` button will not be displayed.
* @default false
*/
disableAddFilterButton: PropTypes.bool,
/**
* If `true`, the `Remove all` button will be disabled
* @default false
*/
disableRemoveAllButton: PropTypes.bool,
/**
* Props passed to each filter form.
*/
filterFormProps: PropTypes.shape({
columnInputProps: PropTypes.any,
columnsSort: PropTypes.oneOf(['asc', 'desc']),
deleteIconProps: PropTypes.any,
filterColumns: PropTypes.func,
logicOperatorInputProps: PropTypes.any,
operatorInputProps: PropTypes.any,
valueInputProps: PropTypes.any
}),
/**
* 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: PropTypes.func,
/**
* Sets the available logic operators.
* @default [GridLogicOperator.And, GridLogicOperator.Or]
*/
logicOperators: PropTypes.arrayOf(PropTypes.oneOf(['and', 'or']).isRequired),
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
} : void 0;
/**
* Demos:
* - [Filtering - overview](https://mui.com/x/react-data-grid/filtering/)
*
* API:
* - [GridFilterPanel API](https://mui.com/x/api/data-grid/grid-filter-panel/)
*/
export { GridFilterPanel };
export { getGridFilter } from "./GridFilterPanelBase.mjs";