UNPKG

@adaptabletools/adaptable

Version:

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

20 lines (19 loc) 1.27 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { useAdaptable } from '../AdaptableContext'; import { SELECT_REPORT_STRING } from '../../Utilities/Constants/GeneralConstants'; import { Flex } from '../../components/Flex'; import { SingleSelect } from '../../components/NewSelect'; export const ReportNameSelector = (props) => { const { reportName, onReportNameSelected, size = 'normal' } = props; const adaptable = useAdaptable(); const exportApi = adaptable.api.exportApi; const allReportNames = exportApi.internalApi.getAllAvailableReportNames(); const reportItems = allReportNames.map((report) => { return { label: report, value: report, }; }); const elementType = props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel'; return (_jsx(Flex, { "data-name": "report-name-selector", className: "twa:min-w-[160px] twa:flex-1", children: _jsx(SingleSelect, { ariaLabel: SELECT_REPORT_STRING, size: size, "data-name": "report-name-selector", placeholder: SELECT_REPORT_STRING, disabled: !allReportNames.length, className: `ab-${elementType}__Export__report-select twa:w-full`, items: reportItems, onValueChange: (report) => onReportNameSelected(report), value: reportName }) })); };