import { ReactNode, CSSProperties } from 'react'; import { Service, Options } from 'ahooks/lib/useRequest/src/types'; import { ProFormOtherProps } from '../ProForm/propsType'; export interface TreeDataProps { label: string; value: string; children?: TreeDataProps[]; /** 禁用不可操作 */ disabled?: boolean; /** 处理固定场景 */ fixed?: 'left' | 'right'; checkable?: boolean; [key: string]: any; } export type AllValueType = string | number; export interface ProTreeModalAction { onChange: () => AllValueType[]; } export interface FieldNamesType { label: string; value: string; children?: string; } export type TreeModalMode = 'tree' | 'list' | 'Cascader' | 'Tree' | 'List'; export interface ProTreeModalProps { /** value */ value?: AllValueType | string[]; /** 默认 label、value、children */ fieldNames?: FieldNamesType; /** 自定义控制 modal、此时没有 trigger */ open?: boolean; /** 列表时候一行放几个 */ span?: number; /** 展示类型、默认list 列表展示形式、appoint 指定模式展示形式会不一样 */ mode?: TreeModalMode; /** 是否开启指定模式 */ appoint?: boolean; /** 开启后、提交给后端 [{ label:xx, value: ""}] 形式 */ labelInValue?: boolean; /** 查看模式、同 disabled 一样 */ isView?: boolean; /** 使用ProEnum 的数据源 */ code?: string; /** 触发弹框展开的容器 */ trigger?: string | ReactNode; /** 是否展示 code-label 形式 */ showCodeName?: boolean; /** 静态数据源 */ dataSource?: TreeDataProps[]; /** 最小选择个数 */ min?: number; /** 最大选择个数 */ max?: number; /** 超过最大数量的提示信息 */ maxMessage?: string; /** 当为列表时可开启右侧拖动 */ draggable?: boolean; /** 禁用 */ disabled?: boolean; /** 弹框的 title */ title?: string | ReactNode; /** 全选的标识给后端 */ allValue?: string | number; /** 提示语 */ placeholder?: string; /** 父子节点选中状态不再关联 */ checkStrictly?: boolean; /** trigger 样式设置 */ style?: CSSProperties; /** tags 集合 */ tags?: string[]; otherProps?: ProFormOtherProps; /** 远程请求接口 */ useRequest?: { service?: Service; options?: Options; }; /** value 的回调 */ onChange?: (values: AllValueType[] | AllValueType) => void; /** 自定义展示 */ optionRender?: (item: any, searchStr: string) => string | ReactNode; /** 对后台返回数据进行格式化 */ transformResponse?: (data: any) => TreeDataProps[]; /** 弹框打开/关闭回调 */ openChange?: (open: boolean) => void; }