import * as React from 'react'; import { IBindableEditorProps } from '../PropTypes'; import { Data } from '@singularsystems/neo-core'; import { DropDownBase, ICommonDropDownProps } from './DropDownBase'; import { FormContext } from '../FormContext'; export interface IDropDownSpecificProps extends ICommonDropDownProps { items?: T[] | Promise; itemSource?: Data.IAsyncDataSource | Data.IArrayCacheEntry; valueMember?: NoInfer; displayMember?: NoInfer; /** * Same as `allowDefault`. * Set to true if the user should be able to de-select an item, and set the bound value to the `defaultValue`. This will show a default item in the list. */ allowNulls?: boolean; /** * Set to true if the user should be able to de-select an item, and set the bound value to the `defaultValue`. This will show a default item in the list. */ allowDefault?: boolean; /** * Value considered default. E.g. if allowDefault is true, then selecting the default item will set the bound value to this value. Defaults to `null`. */ defaultValue?: any; /** Function used to filter items out of the datasource. */ filterPredicate?: (item: TChild, itemParent?: T) => boolean; /** Callback which fires when an item is selected. */ onItemSelected?: (item?: TChild, parent?: T) => void; /** * True if the display member of the selected item should display as plain text. * Use this if you need a readonly display, and don't want a form control rendered. */ renderAsText?: boolean; /** Text to display when the bound value is the default value, and there is no item with this value. */ nullText?: string; /** Text to display as the first item in the drop down list when the user is allowed to select a default item. */ deSelectText?: string; /** Set to true if the property should be sorted by value instead of display text. */ sortByValue?: boolean; } export interface IDropDownProps extends IBindableEditorProps { select: IDropDownSpecificProps; } export default class DropDown extends DropDownBase> { static contextType: React.Context; context: React.ContextType; private filteredOptions; private selectedOption; private sortByValue?; constructor(props: IDropDownProps); protected get commonProps(): ICommonDropDownProps; private getSelectedOption; private onItemSelected; render(): React.ReactElement> | React.JSX.Element; }