/** * @author Hanz * @date 2021/8/19 下午1:47 * @description 接口 */ import React, { ReactNode } from 'react'; import { TableProps as ITableProps } from '../Table/interface'; import { TreeProps, TreeNodeProps } from '../Tree/interface'; import { Placement } from '../Dropdown'; import { LabelTooltipProps } from '../Label'; import { EmptyProps } from '../Empty'; import { HelperTextDetailProps } from '../HelperText'; type TableProps = ITableProps & { /** table 参数 */ params?: Object; /** 替换显示字段 */ replaceFields?: { key?: string; title?: string; }; }; export type { TableProps, TreeProps }; export type SelectOpt = { disabled?: boolean; closable?: boolean; [key: string]: any; }; export type SelectedOptions = Array; export type { TreeNodeProps }; export interface ComboSelectProps extends HelperTextDetailProps { /**选择器模式*/ mode?: 'table' | 'tree' | 'list'; /**占位符*/ placeholder?: string; /**search 占位符*/ searchPlaceholder?: string; /**最大显示数*/ /** @deprecated This attribute has been deprecated */ maxCount?: number; /** 超出换行 */ overLine?: boolean; /**禁用选择器*/ disabled?: boolean; /** 支持清除 */ allowClear?: boolean; /**cls*/ className?: string; /**样式*/ style?: React.CSSProperties; /**弹出层className*/ popoverClassName?: string; /**容器最大高度*/ maxHeight?: number; /**容器高度*/ height?: number; /**大小*/ size?: 'large' | 'medium' | 'small'; /**选择器footer actions*/ popoverActions?: React.ReactNode; /**是否显示footer actions*/ showPopoverActions?: boolean; /**是否默认打开*/ defaultOpen?: boolean; /**默认值 checkable为true SelectOpt[],为false SelectOpt */ defaultValue?: SelectOpt[] | SelectOpt; /**替换显示字段 {key: 'key', title: 'title', children: 'children'} */ replaceFields?: { key?: string; title?: string; children?: string; }; /**出参字段 {outputKey: 'key', outputTitle: 'label'} */ outputFields?: { outputKey?: string; outputTitle?: string; }; /**当前选中值 checkable为true SelectOpt[],为false SelectOpt*/ value?: SelectOpt[] | SelectOpt; /**刷新标识*/ refresh?: number; /**位置*/ placement?: Placement; /** 清除回调 */ onClear?: () => void; /**搜索回调*/ onSearch?: (searchKey: string) => void; /**footer actions 取消回调*/ onCancel?: () => void; /**footer actions 确定回调*/ onOk?: (options: SelectedOptions) => void; /** 关闭选择器回调 */ onClose?: () => void; /**value发生变化时回调*/ onChange?: (options: SelectOpt[] | SelectOpt, originData?: TreeNodeProps[] | TreeNodeProps) => void; /**table组件属性*/ TableProps?: TableProps; /**tree组件属性*/ TreeProps?: TreeProps; /**请求url*/ url?: string; /**请求上下文*/ ctx?: string; /**请求参数*/ params?: Object; /**请求方法*/ method?: 'Get' | 'Post'; /**单选或多选*/ checkable?: boolean; /**是否显示搜索*/ showSearch?: boolean; /** 是否实时搜索 */ realTimeSearch?: boolean; /**参数处理回调*/ paramsCallback?: (params: { [name: string]: any; }) => any; /**路径字段*/ fullPathKey?: string; /** 自定义路径节点 */ fullPathRender?: (node: TreeNodeProps) => React.ReactNode; /** 禁用弹框模式 */ disablePopup?: boolean; /** 自定义渲染tag */ tagRender?: (option: SelectOpt) => React.ReactNode; /** 删除tag与取消选中的回调,若返回 false 则无法删除与取消 */ onTagRemove?: (currentOpt?: SelectOpt) => void | boolean; /** 暴露给外部的行为,可扩展*/ action?: React.Ref<{ closePopup(): void; }>; /** 标题 */ label?: ReactNode; /** 帮助提示信息 */ labelTooltip?: LabelTooltipProps; /** 是否必填 */ required?: boolean; /** 空状态属性 */ emptyProps?: EmptyProps; /** 单选时可切换选中值,checkable 为 false 时有效 */ toggleSelectedOnSingle?: boolean; /** 自定义渲染列表option */ optionRender?: (nodeData: TreeNodeProps) => React.ReactNode; /** 获得option label */ getOptionLabel?: (nodeData: TreeNodeProps) => string; /** 下拉匹配选择框宽度 */ dropdownMatchSelectWidth?: boolean | number; /** 浮层渲染容器,默认body */ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; /** 最大显示的 tag 文本长度 */ maxTagTextLength?: number; /** 自定义渲染输入框内容 */ renderInputContent?: (options: SelectOpt | SelectOpt[]) => React.ReactNode; /** 渲染 tag label */ renderTagLabel?: (option: SelectOpt) => React.ReactNode; /** 渲染 more tag label */ renderMoreTagLabel?: (option: SelectOpt) => React.ReactNode; }