import * as React from 'react'; import { Option } from 'rc-select'; import { DisplayValueType, CustomTagProps, RenderNode, RenderDOMFunc } from 'rc-select/lib/BaseSelect'; import { OptGroupProps } from 'rc-select/lib/OptGroup'; import { OptionProps } from 'rc-select/lib/Option'; import { MenuItemProps } from 'rc-menu/lib/MenuItem'; import type { Mode } from 'rc-select/lib/interface'; import { ObjectInterface } from '../_utils/interfaces'; import { OnScrollParams } from 'react-virtualized'; import './style/index.css'; import { TooltipPlacement } from '../tooltip'; export declare type SingleType = MixType extends (infer Single)[] ? Single : MixType; export interface OptionData extends Omit { children?: React.ReactNode; } export declare type OptionGroupData = OptGroupProps; export declare type LabelValueType = DisplayValueType; export declare type OptionsType = (OptionGroupData | OptionData)[]; export declare const prefixCls = "dmc-select"; export declare const LIST_MAX_HEIGHT = 300; export declare const multiItemSelectedIcon: (props: MenuItemProps) => JSX.Element; export declare const singleItemIcon: JSX.Element; export declare const formateVal: (val: OptionData | OptionGroupData, valueKey?: string) => any[]; export declare const getCustomerSelectedIcon: (menuItemSelectedIcon: RenderNode, isMulti: boolean) => {}; export interface SelectProps { /** id标识 */ id?: string; /** 类名 */ className?: string; /** 样式 */ style?: React.CSSProperties; /** 配置项 */ options?: OptionsType; children?: React.ReactNode; /** 选择器的模式 */ mode?: Mode; /** 指定当前选中的条目,多选时为一个数组。 */ value?: ValueType; /** 指定默认选中的条目 */ defaultValue?: ValueType; /** 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 string 变为 { value: string, label: ReactNode } 的格式 */ labelInValue?: boolean; /** 控制搜索文本 */ searchValue?: string; /** 使单选模式可搜索 */ showSearch?: boolean; /** 自动清除搜索信息 */ autoClearSearchValue?: boolean; /** 文本框值变化时回调 */ onSearch?: (value: string) => void; /** 支持清除 */ allowClear?: boolean; /** 清除图标 */ clearIcon?: React.ReactNode; /** 是否显示下拉小箭头 */ showArrow?: boolean; /** 输入框图标 */ inputIcon?: RenderNode; /** 自定义的多选框清除图标 */ removeIcon?: React.ReactNode; /** 自定义多选时当前选中的条目图标 */ menuItemSelectedIcon?: RenderNode; /** 是否展开下拉菜单 */ open?: boolean; /** 默认是否展开下拉菜单 */ defaultOpen?: boolean; /** 设置弹窗滚动高度 */ listHeight?: number; /** 设置选项高度 */ listItemHeight?: number; /** 下拉菜单的 style 属性 */ dropdownStyle?: React.CSSProperties; /** 下拉菜单的类名 */ dropdownClassName?: string; /** 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动 */ dropdownMatchSelectWidth?: boolean | number; /** 自定义下拉框内容 */ dropdownRender?: (menu: React.ReactElement) => React.ReactElement; /** 覆盖默认的定位配置 */ dropdownAlign?: ObjectInterface; /** 菜单渲染父节点。默认渲染到 body 上 */ getPopupContainer?: RenderDOMFunc; /** 下拉菜单的方向 */ direction?: 'ltr' | 'rtl'; /** 失效状态 */ disabled?: boolean; /** 加载样式 */ loading?: boolean; /** 自动聚焦 */ autoFocus?: boolean; /** 当下拉列表为空时显示的内容 */ notFoundContent?: React.ReactNode; /** 选择框默认文本 */ placeholder?: React.ReactNode; /** 回填到选择框的 Option 的属性值 */ optionLabelProp?: string; /** 最大显示的 tag 文本长度 */ maxTagTextLength?: number; /** 最多显示多少个 tag */ maxTagCount?: number; /** 隐藏 tag 时显示的内容 */ maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabelValueType[]) => React.ReactNode); /** 自定义 tag 内容 render,仅在 mode 为 multiple 或 tags 时生效 */ tagRender?: (props: CustomTagProps) => React.ReactElement; /** 指示其元素是否可以聚焦 */ tabIndex?: number; onKeyUp?: React.KeyboardEventHandler; onKeyDown?: React.KeyboardEventHandler; /** 下拉列表滚动时的回调 */ onPopupScroll?: (params: OnScrollParams) => void; /** 展开下拉菜单的回调 */ onDropdownVisibleChange?: (open: boolean) => void; /** 被选中时调用,参数为选中项的 value (或 key) 值 */ onSelect?: (value: SingleType, option: OptionsType[number]) => void; /** 取消选中时调用,参数为选中项的 value (或 key) 值,仅在 multiple 或 tags 模式下生效 */ onDeselect?: (value: SingleType, option: OptionsType[number]) => void; /** 按键按下时回调 */ onInputKeyDown?: React.KeyboardEventHandler; /** 点击回调 */ onClick?: React.MouseEventHandler; /** 选中 option,或 input 的 value 变化时,调用此函数 */ onChange?: (value: ValueType, option: OptionsType[number] | OptionsType) => void; onBlur?: React.FocusEventHandler; onFocus?: React.FocusEventHandler; onMouseDown?: React.MouseEventHandler; onMouseEnter?: React.MouseEventHandler; onMouseLeave?: React.MouseEventHandler; /** 类型 */ type?: 'assist-bg' | 'menu-bg'; /** 大小 */ size?: 'compact' | 'mini'; /** label关键字 */ labelKey?: string; /** value关键字 */ valueKey?: string; /** 最大高度 */ maxHeight?: number; /** 需要撑满当前宽度 */ block?: boolean; /** 仅对createSelect有效 */ getNewOptionTemp?: (value: string) => React.ReactNode; /** 创建新标签 */ createAble?: boolean; /** 自动将新增的 Option 添加到当前组件中 */ autoCreateItem?: boolean; /** 校验规则 */ addValFormatter?: (value: string) => string | number | undefined; /** 是否显示tip提示 */ showTip?: boolean; /** 气泡框位置 */ tipPlacement?: TooltipPlacement; /** 自定义搜索条件 */ customSearchFilter?: (value: string, options: OptionsType) => OptionsType; /** 开启虚拟滚动后,单元是否自适应高度 */ dynamicRowHeight?: boolean; } export declare const SelectTag: React.FC; declare const Select: React.FC; declare const SelectMemo: React.NamedExoticComponent>; export { SelectMemo, Option }; export default Select;