UNPKG

@mui/x-data-grid-premium

Version:

The Premium plan edition of the MUI X Data Grid Components.

52 lines 2.72 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; const _excluded = ["excelOptions"]; import * as React from 'react'; import { GridToolbar } from '@mui/x-data-grid-pro/internals'; import { ToolbarButton } from '@mui/x-data-grid-pro'; import { ExportExcel } from "./export/index.js"; import { useGridRootProps } from "../hooks/utils/useGridRootProps.js"; import { useGridApiContext } from "../hooks/utils/useGridApiContext.js"; import { PivotPanelTrigger } from "./pivotPanel/PivotPanelTrigger.js"; import { isPivotingAvailable } from "../hooks/features/pivoting/utils.js"; import { AiAssistantPanelTrigger } from "./aiAssistantPanel/index.js"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; export function GridPremiumToolbar(props) { const rootProps = useGridRootProps(); const apiRef = useGridApiContext(); const other = _objectWithoutPropertiesLoose(props, _excluded); const additionalItems = /*#__PURE__*/_jsxs(React.Fragment, { children: [isPivotingAvailable(rootProps) && /*#__PURE__*/_jsx(PivotPanelTrigger, { render: (triggerProps, state) => /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, { title: apiRef.current.getLocaleText('toolbarPivot'), children: /*#__PURE__*/_jsx(ToolbarButton, _extends({}, triggerProps, { color: state.active ? 'primary' : 'default', children: /*#__PURE__*/_jsx(rootProps.slots.pivotIcon, { fontSize: "small" }) })) }) }), rootProps.aiAssistant && /*#__PURE__*/_jsx(AiAssistantPanelTrigger, { render: triggerProps => /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, { title: apiRef.current.getLocaleText('toolbarAssistant'), children: /*#__PURE__*/_jsx(ToolbarButton, _extends({}, triggerProps, { color: "default", children: /*#__PURE__*/_jsx(rootProps.slots.aiAssistantIcon, { fontSize: "small" }) })) }) })] }); const additionalExportMenuItems = !props.excelOptions?.disableToolbarButton ? onMenuItemClick => /*#__PURE__*/_jsx(ExportExcel, { render: /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({}, rootProps.slotProps?.baseMenuItem)), options: props.excelOptions, onClick: onMenuItemClick, children: apiRef.current.getLocaleText('toolbarExportExcel') }) : undefined; if (process.env.NODE_ENV !== "production") additionalExportMenuItems.displayName = "additionalExportMenuItems"; return /*#__PURE__*/_jsx(GridToolbar, _extends({}, other, { additionalItems: additionalItems, additionalExportMenuItems: additionalExportMenuItems })); }