import type { ElSizeType, BaseProps } from '../../types'; import type { PropsType as OptionsItem } from "./option"; import type { TipProps } from '../../hooks/useTip'; /** * @description 列表项插槽参数类型 * @template T 行数据类型 * @interface SelectSlotParamsType */ export type SelectSlotParamsType = { /** 行数据 */ row?: T; /** 行下标 */ index?: number; }; /** * @description 选项类型 * @typedef {OptionsItem} OptionsItemType */ export type OptionsItemType = OptionsItem; /** * @description 单值类型定义 * @typedef {string | number | object} SingleValueType */ export type SingleValueType = string | number | object; /** * @description 值类型定义,可以是单值或数组 * @typedef {SingleValueType | SingleValueType[]} ValueType */ export type ValueType = SingleValueType | SingleValueType[]; /** * @description 组件属性类型 * @interface PropsType * @extends {TipProps} * @extends {BaseProps} */ export interface PropsType extends TipProps, BaseProps { /** 选项列表 */ options: OptionsItemType[]; /** 选择器类型 */ type?: "input" | "text"; /** 是否可清空 */ clearable?: boolean; /** 是否禁用 */ disabled?: boolean; /** 空状态文本 */ emptyText?: string; /** 是否可过滤 */ filterable?: boolean; /** 是否多选 */ multiple?: boolean; /** 是否显示完整的级联路径,false则只显示最后一级 */ showAllLevels?: boolean; /** 是否启用严格选择模式,开启后只能选择叶子节点 */ checkStrictly?: boolean; /** 是否可选择父级 */ selectParent?: boolean; /** 是否显示loading */ loading?: boolean; /** 远程搜索方法(必须开启filterable) */ remoteMethod?: (query: string) => void; /** 自定义过滤方法 */ filterMethod?: (option: OptionsItemType, query: string) => boolean; } /** * @description 组件事件类型 * @interface EmitsType */ export interface EmitsType { /** 清空事件 */ clear: []; /** 选择事件 */ change: [OptionsItemType]; /** 下拉框展开事件 */ "visible-change": [boolean]; /** 获取焦点事件 */ focus: [FocusEvent]; /** 失去焦点事件 */ blur: [FocusEvent]; /** 移除选项事件(多选模式下) */ "remove-tag": [SingleValueType]; /** 输入值变化事件(filterable模式下) */ input: [string]; /** 级联菜单切换事件 */ "cascade-change": [OptionsItemType[]]; } /** * @description 组件插槽类型定义 * @interface SlotsType */ export interface SlotsType { /** 默认插槽 - 自定义选项内容 */ default?: (params: SelectSlotParamsType) => any; /** 空状态插槽 */ empty?: () => any; /** 前缀插槽 */ prefix?: () => any; } /** * @description 组件暴露方法类型定义 * @interface ExposesType */ export interface ExposesType { /** 获取焦点 */ focus: () => void; /** 失去焦点 */ blur: () => void; /** 清空选择 */ clear: () => void; } /** * @description 图标颜色 */ export declare const ICON_COLOR = "#656a6e56"; /** * @description 下拉框圆角 */ export declare const DROPDOWN_RADIUS = 6; /** * @description 图标尺寸映射 */ export declare const ICON_SIZES: Record; /** * @description 空选项 */ export declare const EMPTY_OPTION: OptionsItemType; /** * @description 选择器组件状态类型 * @interface SelectStateType */ export interface SelectStateType { /** 选中选项 */ selectedOption?: any; /** 下拉框是否显示 */ isDropdownVisible?: boolean; /** 过滤文本 */ filterText?: string; /** 是否聚焦 */ isFocused?: boolean; /** 临时模型值 */ temModel?: ValueType; /** 级联路径 */ cascadePath?: OptionsItemType[]; /** 级联菜单列表 */ cascadePanels?: OptionsItemType[][]; /** 是否显示级联面板 */ showCascadePanel?: boolean; /** 当前激活的级联菜单索引 */ activeMenuIndex?: number; }