@ucloud-fe/react-components
Version:
UCloud react components
43 lines (42 loc) • 1.57 kB
TypeScript
import React, { ReactNode } from 'react';
import { InputProps } from '../../components/Input';
interface Item {
value: string;
label?: ReactNode;
}
interface AutoCompleteProps extends Omit<InputProps, 'value' | 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'prefix' | 'onKeyDown' | 'suffix' | 'className' | 'block'> {
/** 待筛选选项 */
options?: Item[];
/** 值,controlled */
value?: string;
/** 默认值 */
defaultValue?: string;
/** 选中回调 */
onChange?: (v: string) => void;
/** 是否禁用 */
disabled?: boolean;
/** options 加载中状态 */
loading?: boolean;
/** 前缀 */
prefix?: ReactNode;
/** 展示变更为块占位 */
block?: boolean;
/** 自定义搜索,为 false 时不做搜索展示全部 */
handleSearch?: false | ((v: Item) => boolean);
/** 自定义 popover 的配置 */
popoverProps?: {
[key: string]: any;
};
/** 焦点回调 */
onFocus?: () => void;
/** 失焦回调 */
onBlur?: () => void;
/** 状态 */
status: InputProps['status'];
/** @ignore */
placeholder?: InputProps['placeholder'];
/** 尺寸 */
size?: InputProps['size'];
}
declare const _default: React.MemoExoticComponent<({ value: _value, defaultValue, onChange: _onChange, options, disabled, loading, prefix, block, handleSearch, popoverProps, onFocus, onBlur, style, className, status, placeholder, size, ...others }: AutoCompleteProps & Omit<InputProps, keyof AutoCompleteProps>) => JSX.Element>;
export default _default;