UNPKG

@adaptabletools/adaptable

Version:

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

18 lines (17 loc) 913 B
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import * as React from 'react'; import { useAdaptable } from '../../AdaptableContext'; import { SingleCombobox } from '../../../components/Combobox'; export const FieldSelector = (props) => { const { api } = useAdaptable(); const fields = React.useMemo(() => { return api.expressionApi.internalApi.getFieldsOfType(props.type); }, [props.type, api.expressionApi.internalApi]); const options = fields.map((field) => ({ label: field.label ?? field.name, value: field.name, })); return (_jsx(_Fragment, { children: _jsx(SingleCombobox, { "data-name": "column-selector", disabled: props.disabled, value: props.value || undefined, placeholder: props.placeholder ?? 'Select Field', onValueChange: (fieldValue) => { props.onChange(fieldValue); }, items: options }) })); };