UNPKG

@mui/x-data-grid

Version:

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

24 lines 1.5 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from 'react'; import { gridColumnDefinitionsSelector } from "../../hooks/features/columns/gridColumnsSelector.js"; import { useGridSelector } from "../../hooks/utils/useGridSelector.js"; import { gridPreferencePanelStateSelector } from "../../hooks/features/preferencesPanel/gridPreferencePanelSelector.js"; import { GridPreferencePanelsValue } from "../../hooks/features/preferencesPanel/gridPreferencePanelsValue.js"; import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js"; import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js"; import { jsx as _jsx } from "react/jsx-runtime"; export function GridPreferencesPanel() { const apiRef = useGridApiContext(); const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector); const rootProps = useGridRootProps(); const preferencePanelState = useGridSelector(apiRef, gridPreferencePanelStateSelector); const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, preferencePanelState.openedPanelValue ?? GridPreferencePanelsValue.filters); return /*#__PURE__*/_jsx(rootProps.slots.panel, _extends({ as: rootProps.slots.basePopper, open: columns.length > 0 && preferencePanelState.open, id: preferencePanelState.panelId, "aria-labelledby": preferencePanelState.labelId }, rootProps.slotProps?.panel, rootProps.slotProps?.basePopper, { children: panelContent })); }