UNPKG

@mui/x-data-grid

Version:

The Community plan edition of the Data Grid components (MUI X).

109 lines 4.45 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; const _excluded = ["defaultSlots", "defaultSlotProps", "slots", "slotProps"]; import * as React from 'react'; import PropTypes from 'prop-types'; import { forwardRef } from '@mui/x-internals/forwardRef'; import { useGridColumnMenuSlots } from "../../../hooks/features/columnMenu/useGridColumnMenuSlots.js"; import { GridColumnMenuContainer } from "./GridColumnMenuContainer.js"; import { GridColumnMenuColumnsItem } from "./menuItems/GridColumnMenuColumnsItem.js"; import { GridColumnMenuFilterItem } from "./menuItems/GridColumnMenuFilterItem.js"; import { GridColumnMenuSortItem } from "./menuItems/GridColumnMenuSortItem.js"; import { jsx as _jsx } from "react/jsx-runtime"; export const GRID_COLUMN_MENU_SLOTS = { columnMenuSortItem: GridColumnMenuSortItem, columnMenuFilterItem: GridColumnMenuFilterItem, columnMenuColumnsItem: GridColumnMenuColumnsItem }; export const GRID_COLUMN_MENU_SLOT_PROPS = { columnMenuSortItem: { displayOrder: 10 }, columnMenuFilterItem: { displayOrder: 20 }, columnMenuColumnsItem: { displayOrder: 30 } }; const GridGenericColumnMenu = forwardRef(function GridGenericColumnMenu(props, ref) { const { defaultSlots, defaultSlotProps, slots, slotProps } = props, other = _objectWithoutPropertiesLoose(props, _excluded); const orderedSlots = useGridColumnMenuSlots(_extends({}, other, { defaultSlots, defaultSlotProps, slots, slotProps })); return /*#__PURE__*/_jsx(GridColumnMenuContainer, _extends({}, other, { ref: ref, children: orderedSlots.map(([Component, otherProps], index) => /*#__PURE__*/_jsx(Component, _extends({}, otherProps), index)) })); }); process.env.NODE_ENV !== "production" ? GridGenericColumnMenu.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the TypeScript types and run "pnpm proptypes" | // ---------------------------------------------------------------------- colDef: PropTypes.object.isRequired, /** * Initial `slotProps` - it is internal, to be overrriden by Pro or Premium packages * @ignore - do not document. */ defaultSlotProps: PropTypes.object.isRequired, /** * Initial `slots` - it is internal, to be overrriden by Pro or Premium packages * @ignore - do not document. */ defaultSlots: PropTypes.object.isRequired, hideMenu: PropTypes.func.isRequired, id: PropTypes.string, labelledby: PropTypes.string, open: PropTypes.bool.isRequired, /** * Could be used to pass new props or override props specific to a column menu component * e.g. `displayOrder` */ slotProps: PropTypes.object, /** * `slots` could be used to add new and (or) override default column menu items * If you register a nee component you must pass it's `displayOrder` in `slotProps` * or it will be placed in the end of the list */ slots: PropTypes.object } : void 0; const GridColumnMenu = forwardRef(function GridColumnMenu(props, ref) { return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({}, props, { ref: ref, defaultSlots: GRID_COLUMN_MENU_SLOTS, defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS })); }); process.env.NODE_ENV !== "production" ? GridColumnMenu.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the TypeScript types and run "pnpm proptypes" | // ---------------------------------------------------------------------- colDef: PropTypes.object.isRequired, hideMenu: PropTypes.func.isRequired, id: PropTypes.string, labelledby: PropTypes.string, open: PropTypes.bool.isRequired, /** * Could be used to pass new props or override props specific to a column menu component * e.g. `displayOrder` */ slotProps: PropTypes.object, /** * `slots` could be used to add new and (or) override default column menu items * If you register a nee component you must pass it's `displayOrder` in `slotProps` * or it will be placed in the end of the list */ slots: PropTypes.object } : void 0; export { GridColumnMenu, GridGenericColumnMenu };