UNPKG

chowa

Version:

UI component library based on React

65 lines (64 loc) 2.09 kB
/** * @license chowa v1.1.3 * * Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn). * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import * as React from 'react'; import * as PropTypes from 'prop-types'; import { OmitProps } from '../utils'; import { InputProps } from '../input'; export interface Option { value: string; [key: string]: any; } export interface OptionGroup { title: string; extra?: React.ReactNode; children: Options; } export declare type Options = [(React.ReactText | Option | OptionGroup)?]; export declare type Mode = 'concat' | 'search' | 'remote'; export interface AutoCompleteProps extends OmitProps<InputProps, 'onChange' | 'defaultValue' | 'value'> { defaultValue?: string; value?: string; mode?: Mode; concatExempt?: string; options: Options; formatter: (option: React.ReactText | Option, value: string) => React.ReactNode; onChange: (value: string) => void; externalWheelHide?: boolean; } export interface AutoCompleteState { result: string; hasChange: boolean; activeValue: React.ReactText; renderOptions: Options; } declare class AutoComplete extends React.PureComponent<AutoCompleteProps, AutoCompleteState> { static propTypes: { mode: PropTypes.Requireable<string>; concatExempt: PropTypes.Requireable<string>; options: PropTypes.Validator<any[]>; externalWheelHide: PropTypes.Requireable<boolean>; formatter: PropTypes.Requireable<(...args: any[]) => any>; }; static defaultProps: { mode: string; externalWheelHide: boolean; }; private inputIns; constructor(props: AutoCompleteProps); componentDidUpdate(preProps: AutoCompleteProps): void; private onInputChangeHandler; private onKeyDownHandler; private onVisibleChangeHandler; private triggerChange; private updateActiveValue; private onSelectValue; private renderDrop; render(): JSX.Element; } export default AutoComplete;