import { Component } from 'react'; import Popover from '../popover'; import { ISelectTagListProps } from './TagList'; import { IDisabledContext } from '../disabled'; import { II18nLocaleSelect } from '../i18n'; import { reviveSelectItem } from './reviver'; export interface ISelectItem { key: Key; text: React.ReactNode; disabled?: boolean; type?: 'header' | 'divider' | 'reviver'; reviver?: (item: ISelectItem) => ISelectItem | null; } export interface IOptionRenderer = ISelectItem> { (item: Item, index: number): React.ReactNode; } export interface ISelectKeywordChangeMeta { source: 'user-clear' | 'user-change' | 'popup-close' | 'option-create'; } export declare type ISelectSize = 'xs' | 's' | 'm' | 'l' | 'xl'; export interface ISelectCommonProps = ISelectItem> { keyword?: string; onKeywordChange?: (keyword: string, meta: ISelectKeywordChangeMeta) => void; options: Item[]; isEqual?: (a: Item, b: Item) => boolean; placeholder?: string; notFoundContent?: string; inline?: boolean; width?: React.CSSProperties['width']; size?: ISelectSize; popupWidth?: React.CSSProperties['width']; filter?: ((keyword: string, item: Item) => boolean) | false; highlight?: (keyword: string, item: Item) => Item; disabled?: boolean; open?: boolean; onOpenChange?: (open: boolean) => void; renderValue?: (value: Item) => React.ReactNode; renderOptionList?: (options: Item[], renderOption: IOptionRenderer) => React.ReactNode; renderOptionContent?: (value: Item) => React.ReactNode; clearable?: boolean; loading?: boolean; creatable?: boolean; onCreate?: (text: string) => Promise; isValidNewOption?: (keyword: string, options: Item[]) => boolean; collapsable?: boolean; collapseAt?: number; hideCollapsePop?: boolean; className?: string; disableSearch?: boolean; renderCollapsedContent?: (collapsedValue: Item[]) => React.ReactNode; } export interface ISelectSingleProps = ISelectItem> extends ISelectCommonProps { multiple?: false; value?: Item | null; onChange?: (value: Item | null) => void; } export interface ISelectMultiProps = ISelectItem> extends ISelectCommonProps { multiple: true; value?: Item[]; onChange?: (value: Item[]) => void; renderTagList?: (props: ISelectTagListProps) => React.ReactNode; } export declare type ISelectProps = ISelectItem> = ISelectMultiProps | ISelectSingleProps; export interface ISelectState = ISelectItem> { open: boolean; active: boolean; keyword: string; value: null | Item | Item[]; activeIndex: null | number; prevOptions: Item[]; creating: boolean; triggerWidth: React.CSSProperties['width']; } declare function defaultIsEqual = ISelectItem>(a: Item, b: Item): boolean; declare function defaultFilter = ISelectItem>(keyword: string, option: Item): boolean; declare function defaultRenderOptionList = ISelectItem>(options: Item[], renderOption: IOptionRenderer): import("react").ReactNode[]; declare function defaultHighlight = ISelectItem>(keyword: string, option: Item): React.ReactNode; declare function defaultIsValidNewOption(keyword: string, options: ISelectItem[]): boolean; export declare class Select = ISelectItem> extends Component, ISelectState> { static defaultProps: { isEqual: typeof defaultIsEqual; renderOptionList: typeof defaultRenderOptionList; filter: typeof defaultFilter; isValidNewOption: typeof defaultIsValidNewOption; highlight: typeof defaultHighlight; size: string; multiple: boolean; clearable: boolean; loading: boolean; creatable: boolean; }; static contextType: import("react").Context; static reviveValue: typeof reviveSelectItem; context: IDisabledContext; triggerRef: import("react").RefObject; popoverRef: import("react").RefObject; inputRef: import("react").RefObject; constructor(props: ISelectProps); static getDerivedStateFromProps = ISelectItem>(props: ISelectProps, state: ISelectState): Partial> | null; componentDidMount(): void; componentDidUpdate(prevProps: ISelectProps): void; get disabled(): boolean; tryReviveOption(props: ISelectProps): void; onVisibleChange: (open: boolean) => void; onSelect: (item: Item) => void; onKeywordChange: React.ChangeEventHandler; resetKeyword(source: ISelectKeywordChangeMeta['source']): void; setKeyword(keyword: string, source: ISelectKeywordChangeMeta['source']): void; onRemove: (item: Item) => void; onOptionMouseEnter: (index: number) => void; onOptionMouseLeave: (index: number) => void; selectCurrentIndex: () => void; renderOption: IOptionRenderer; globalClick: (e: MouseEvent) => void; onIndexChange: (delta: 1 | -1) => void; renderValue(i18n: II18nLocaleSelect): import("react").ReactNode; renderTagCollapsedTrigger(value: Item[]): JSX.Element; renderTagList(value: Item[], i18n: II18nLocaleSelect): JSX.Element; getSearchPlaceholder(): string; onClear: (e: React.MouseEvent) => void; onCreateClick: () => void; filterOptions: (keyword: string, options: Item[], filter: false | ((keyword: string, item: Item) => boolean), creatable: boolean, isValidNewOption: (keyword: string, options: Item[]) => boolean, value: Item | Item[] | undefined) => Item[]; focusSearchInput: () => void; renderPopoverContent(i18n: II18nLocaleSelect): React.ReactNode; render(): JSX.Element; } export default Select;