UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

20 lines (19 loc) 1.25 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { useAdaptable } from '../AdaptableContext'; import { SELECT_REPORT_FORMAT_STRING } from '../../Utilities/Constants/GeneralConstants'; import { Flex } from '../../components/Flex'; import { SingleSelect } from '../../components/NewSelect'; export const ReportFormatSelector = (props) => { const { reportName, reportFormat, onReportFormatSelected } = props; const adaptable = useAdaptable(); const exportApi = adaptable.api.exportApi; const allFormats = exportApi.getAvailableSystemFormats(); const formatItems = allFormats.map((format) => { return { label: format, value: format, }; }); const elementType = props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel'; return (_jsx(Flex, { "data-name": "report-format-selector", className: "twa:min-w-[140px] twa:flex-1", children: _jsx(SingleSelect, { ariaLabel: SELECT_REPORT_FORMAT_STRING, placeholder: SELECT_REPORT_FORMAT_STRING, disabled: !allFormats.length || reportName == undefined, className: `ab-${elementType}__Export__format-select twa:w-full`, items: formatItems, onValueChange: (format) => onReportFormatSelected(format), value: reportFormat }) })); };