UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

123 lines (122 loc) 4.36 kB
import React, { Component, CSSProperties, KeyboardEvent, MouseEvent, ReactElement, ReactNode } from 'react'; import { Size } from '../_util/enum'; import { SelectMode } from './enum'; import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext'; export interface AbstractSelectProps { prefixCls?: string; spinPrefixCls?: string; className?: string; size?: Size; notFoundContent?: ReactNode | null; transitionName?: string; choiceTransitionName?: string; showSearch?: boolean; allowClear?: boolean; disabled?: boolean; showArrow?: boolean; style?: CSSProperties; tabIndex?: number; placeholder?: ReactNode; defaultActiveFirstOption?: boolean; dropdownClassName?: string; dropdownStyle?: CSSProperties; dropdownMenuStyle?: CSSProperties; dropdownMatchSelectWidth?: boolean; onDropdownMouseDown?: (e: MouseEvent<any>) => void; onSearch?: (value: string) => any; filterOption?: boolean | ((inputValue: string, option: ReactElement<OptionProps>) => any); id?: string; blurChange?: boolean; showCheckAll?: boolean; autoClearSearchValue?: boolean; dropdownMenuRippleDisabled?: boolean; dropdownMenuItemCheckable?: boolean; choiceRemove?: boolean; border?: boolean; builtinPlacements?: object; labelLayout?: 'none' | 'float'; } export interface LabeledValue { key: string; label: ReactNode; } export declare type SelectValue = string | number | any[] | LabeledValue | LabeledValue[]; export interface SelectProps extends AbstractSelectProps { form?: any; value?: SelectValue; defaultValue?: SelectValue; mode?: SelectMode | string; optionLabelProp?: string; firstActiveValue?: string | string[]; onInput?: (value: SelectValue) => void; onChange?: (value: SelectValue, option: ReactElement<any> | ReactElement<any>[]) => void; onSelect?: (value: SelectValue, option: ReactElement<any>) => any; onDeselect?: (value: SelectValue) => any; onBlur?: () => any; onFocus?: () => any; onPopupScroll?: () => any; onInputKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void; onMouseEnter?: (e: MouseEvent<HTMLInputElement>) => any; onMouseLeave?: (e: MouseEvent<HTMLInputElement>) => any; onChoiceItemClick?: (value: SelectValue, option: ReactElement<any>) => void; onClear?: () => any; maxTagCount?: number; maxTagPlaceholder?: ReactNode | ((omittedValues: SelectValue[]) => ReactNode); optionFilterProp?: string; labelInValue?: boolean; getPopupContainer?: (triggerNode: Element) => HTMLElement; tokenSeparators?: string[]; getInputElement?: () => ReactElement<any>; autoFocus?: boolean; showNotFindInputItem?: boolean; showNotFindSelectedItem?: boolean; getRootDomNode?: () => HTMLElement; filter?: boolean; footer?: ReactNode | string; choiceRender?: (label: ReactElement<any>, value: SelectValue) => any; loading?: boolean | object; onFilterChange?: (value: string) => void; filterValue?: string; children?: ReactNode; } export interface OptionProps { disabled?: boolean; value?: string | number; title?: string; children?: ReactNode; className?: string; style?: object; } export interface OptGroupProps { label?: ReactNode; } export interface SelectLocale { notFoundContent?: string; filterPlaceholder?: string; } export default class Select extends Component<SelectProps, {}> { static get contextType(): typeof ConfigContext; static displayName: string; static Option: React.ClassicComponentClass<OptionProps>; static OptGroup: React.ClassicComponentClass<OptGroupProps>; static SECRET_COMBOBOX_MODE_DO_NOT_USE: string; static defaultProps: { blurChange: boolean; showSearch: boolean; transitionName: string; choiceTransitionName: string; filter: boolean; showCheckAll: boolean; choiceRemove: boolean; border: boolean; }; context: ConfigContextValue; private rcSelect; focus(): void; blur(): void; saveSelect: (node: any) => void; getNotFoundContent(locale: SelectLocale): {} | null | undefined; isCombobox(): boolean; renderSelect: (locale: SelectLocale) => JSX.Element; render(): JSX.Element; }