import React from 'react'; import type { TreeSelectProps } from 'antd'; import { Service, Options, Result } from 'ahooks/lib/useRequest/src/types'; import { ProFormOtherProps } from '../ProForm/propsType'; export interface DataProps { label: string; value?: string; disabled?: boolean; disableCheckbox?: boolean; selectable?: boolean; checkable?: boolean; title?: string; } export interface DataOption { label: string; value?: string; disabled?: boolean; disableCheckbox?: boolean; selectable?: boolean; checkable?: boolean; children?: DataProps[]; title?: string; [key: string]: any; } export interface BaseOptionType { disabled?: boolean; checkable?: boolean; disableCheckbox?: boolean; children?: BaseOptionType[]; [name: string]: any; } export interface DefaultOptionType extends BaseOptionType { value?: any; title?: React.ReactNode; label: React.ReactNode; key?: React.Key; children?: DefaultOptionType[]; } export interface PropTreeSelectProps extends Omit { /** 是否查看模式 */ isView?: boolean; /** 是否根据输入项进行筛选, 默认true */ filterTreeNode?: boolean; /** 输入项过滤对应的 treeNode 属性, 默认label */ treeNodeFilterProp?: string; /** 是否展开所有树 */ treeDefaultExpandAll?: boolean; /** 是否支持复选、多选,默认多选 */ treeCheckable?: boolean; /** 输入框宽度,默认100% */ width?: any; /** 枚举code-从localStorage里面根据次code取枚举值 */ code?: string; /** 数据源 */ dataSource?: DataOption[]; /** 兼容 2.0 版本、3.0 使用view 模式,查看模式值 */ defaultDisableValue?: string; /** 格式化接口响应数据 */ transformResponse?: (data: any) => DataOption[]; /** 是否展示 tooltip、当 label 特别长的时候使用 */ tooltip?: boolean; /** 是否展示 code-label 形式 */ showCodeName?: boolean; /** 集成表单 form 的属性 */ otherProps?: ProFormOtherProps; onSearch?: (value: string, useRequest: Result) => void; /** 远程请求接口 */ useRequest?: { service: Service; options?: Options; }; defaultExpandAll?: boolean; expandedKeys?: any[]; } export interface ProSelectAction { /** 获取发生请求的 useRequest 的 ref */ useRequestRef: Result; } export interface TreeNodeData extends DataOption { title: string; value: string; children?: TreeNodeData[]; icon?: React.ReactNode; hideNodeClass?: string; } export interface TreeSelectFormProps { type: string; label: string; name?: string; fieldProps?: PropTreeSelectProps; [key: string]: any; } export interface ResponseData { status: number; message: string; data: any; success?: boolean; code?: number; }