@alifd/meet-react
Version:
Fusion Mobile React UI System Component
55 lines (54 loc) • 1.93 kB
TypeScript
import { ReactNode } from 'react';
import { LocaledComponentProps } from '../locale';
import { SelectDrawerProps } from '../select-drawer';
import { BaseComponentAttributes, BaseFieldPreviewProps, BasicSizeType } from '../utils/types';
export type SelectMode = 'single' | 'multiple';
export interface SelectOptionProps extends BaseComponentAttributes {
value?: any;
label?: string;
title?: string;
disabled?: boolean;
selected?: boolean;
children?: ReactNode;
onClick?: (value: any) => void;
}
export interface LocaleType {
searchTipText?: string;
totalSuffixText?: string;
totalPrefixText?: string;
secondaryOkText?: string;
emptySearchText?: string;
searchToOptionBtnText?: string;
}
export interface SelectProps extends Omit<SelectDrawerProps, 'locale'>, Omit<BaseFieldPreviewProps, 'renderPreview'>, LocaledComponentProps<LocaleType> {
placeholder?: string;
value?: any;
defaultValue?: any;
useDetailValue?: boolean;
showIcon?: boolean;
hasClear?: boolean;
iconType?: string;
drawerClassName?: string;
filterLocal?: boolean;
autoConfirm?: boolean;
stickyOnTop?: boolean;
filter?: (key: string, item?: SelectOptionProps) => boolean;
dataSource?: SelectOptionProps[];
type?: 'normal' | 'inverse';
displayType?: 'normal' | 'tag' | 'tag-value';
mode?: SelectMode;
size?: BasicSizeType;
disabled?: boolean;
readOnly?: boolean;
hasSearch?: boolean;
showSearch?: boolean;
transferSearchToOption?: boolean;
align?: 'left' | 'right';
renderPreview?: (values: any, props: SelectProps) => ReactNode;
onSearch?: (value?: string) => void;
onChange?: (value?: any, actionType?: string, items?: any) => void;
onClear?: () => void;
onCancel?: (reason?: string) => void;
onSearchAdd?: (searchValue?: string) => void;
renderSelection?: (selectedOptions: any[]) => any;
}