UNPKG

zent

Version:

一套前端设计语言和基于React的实现

75 lines (74 loc) 2.93 kB
import { Component } from 'react'; import { IInputChangeEvent } from '../input'; import SelectMenu, { ISelectMenuItem } from '../select-menu'; import { IDisabledContext } from '../disabled'; export interface IAutoCompleteMenuObjectItem extends Omit<ISelectMenuItem, 'items'> { value: string; valueField?: string; textField?: string; contentField?: string; searchContent?: string; } export declare type IAutoCompleteMenuItem = string | number | IAutoCompleteMenuObjectItem; export interface IAutoCompleteProps<Value> { value?: Value; initialValue?: Value; placeholder?: string; data?: IAutoCompleteMenuItem[]; items?: IAutoCompleteMenuItem[]; onChange?: (value: string | null) => void; onSelect?: (value: string | null) => void; onSearch?: (searchText: string) => void; filterOption?: (searchText: string, menuItem: IAutoCompleteMenuObjectItem) => boolean; valueFromOption?: boolean; className?: string; popupClassName?: string; width?: number | string; valueFromOptions?: boolean; valueField: string; contentField: string; textField: string; disabled?: boolean; inline?: boolean; } export interface IAutoCompleteState { open: boolean; value: unknown; searchText: string; } export declare class AutoComplete<Value> extends Component<IAutoCompleteProps<Value>, IAutoCompleteState> { static defaultProps: { filterOption: typeof import("../select-menu").caselessMatchFilterOption; valueFromOptions: boolean; valueField: string; contentField: string; textField: string; width: number; }; static contextType: import("react").Context<IDisabledContext>; context: IDisabledContext; blurHandlerPrevented: boolean; refMenuItemList: import("react").RefObject<SelectMenu>; constructor(props: IAutoCompleteProps<Value>); static getDerivedStateFromProps<Value>(props: IAutoCompleteProps<Value>, state: IAutoCompleteState): { value: Value; }; onSearchTextChange: (e: IInputChangeEvent) => void; onSearchKeyDown: React.KeyboardEventHandler<HTMLInputElement>; onSearchBlur: () => void; getSelectedValueFromSearchText: (searchText: string) => any; onSelect: (value: string) => void; getTransformedItemConfigs: (valueField: string, textField: string, contentField: string, items?: IAutoCompleteMenuItem[], data?: IAutoCompleteMenuItem[]) => IAutoCompleteMenuObjectItem[]; getTransformedItemConfigsFromProps(): IAutoCompleteMenuObjectItem[]; getDisplayText: () => string; open: () => void; close: () => void; togglePopoverOpen: () => void; iterateItems: (items: any, value: any) => any; getItemByValue: (value: any) => any; moveFocusIndexDown: () => void; moveFocusIndexUp: () => void; selectCurrentFocusIndex: (e: any) => void; render(): JSX.Element; } export default AutoComplete;