UNPKG

ontime-components

Version:
96 lines (95 loc) 2.88 kB
import React, { PureComponent } from 'react'; import { IProps, IState } from '../../libs/interfaces'; import { TFuncClick, TFuncChange, TFuncFocus } from '../../libs/types'; import { TError } from '../InputErrors'; import { List } from './List'; import { Item } from './Item'; declare type TMapValue = string | Function; declare type TLabelPosition = 'top' | 'left' | 'right'; declare type TSize = 'large' | 'medium' | 'small' | 'smaller'; interface ISelectProps extends IProps { dataSource: Function; fetchParams?: any; autoFetch?: boolean; value?: any; multiple?: boolean; mapValue?: TMapValue; customItemTpl?: Function; label?: string; labelPosition?: TLabelPosition; required?: boolean; searchable?: boolean; clearable?: boolean; size?: TSize; id?: string; name?: string; placeholder?: string; autoFocus?: boolean; disabled?: boolean; tabIndex?: string | number; errors?: TError[] | null; onClick?: Function; onChange?: Function; onFocus?: Function; onBlur?: Function; onClear?: Function; } interface ISelectDefProps { labelPosition: TLabelPosition; size: TSize; multiple: boolean; clearable: boolean; autoFetch: boolean; } interface ISelectState extends IState { isFocused: boolean; value: any; isOpen: boolean; dataSource: Function; data: any[]; fetching: boolean; fetched: boolean; } declare class Select extends PureComponent<ISelectProps & ISelectDefProps, ISelectState> { static defaultProps: ISelectDefProps; static List: typeof List; static Item: typeof Item; readonly state: ISelectState; private _startHeight; private _domSelect; private _select; static getDerivedStateFromProps(nextProps: any, prevState: any): Record<string, any> | null; constructor(props: ISelectProps & ISelectDefProps); onClickOutside: (e: MouseEvent) => void; onChange: TFuncChange; onFocus: TFuncFocus; onBlur: TFuncFocus; onClick: TFuncClick; componentDidMount(): void; componentWillUnmount(): void; getFetchParams(params?: any): any; isMultiple(): boolean; isActive(): boolean; isClearable(): boolean; isSearchable(): boolean; isDisabled(): boolean; changeHandler(e?: React.ChangeEvent<HTMLElement>): void; clear(): void; calcHeight(): void; fixValue(value: any): any; value: any; addMultiValue(value: any[]): void; removeMultiValue(value: any[]): void; fetch(params?: {}): Promise<void>; showPopup(): void; hidePopup(): void; toggle(): void; focus(): void; blur(): void; renderLabel(): JSX.Element; renderErrors(): JSX.Element | null; renderTags(): JSX.Element; renderInput(): JSX.Element; render(): JSX.Element; } export { Select, ISelectProps, ISelectState, TLabelPosition, TSize };