import { ReactNode } from 'react'; import type { SelectProps } from 'antd'; import { Service, Options, Result } from 'ahooks/lib/useRequest/src/types'; import { ProFormOtherProps } from '../ProForm/propsType'; export interface DataOption { label?: string; value?: string; [key: string]: any; } export interface PropSelectProps extends Omit { /** 是否查看模式 */ isView?: boolean; /** 默认数组第一项 */ defaultOne?: boolean; /** 数据源 */ dataSource?: DataOption[]; /** @deprecated 兼容 2.0 版本、3.0 使用view 模式 */ defaultDisableValue?: string; /** 是否展示 tooltip、当 label 特别长的时候使用 */ tooltip?: boolean; /** 是否展示 code-label 形式 */ showCodeName?: boolean; /** 集成表单 form 的属性 */ otherProps?: ProFormOtherProps; /** 下拉框滚动是否跟随父级 */ scrollFollowParent?: boolean; /** 远程请求接口 */ useRequest?: { service?: Service; options?: Options; }; /** * @deprecated 兼容 2.0 版本、3.0 使用 transformResponse * @param data * @param setSelectList * @returns */ updateDataSource?: (data: any, setSelectList: any) => void; /** 格式化数据 */ transformResponse?: (data: any) => DataOption[]; /** 点击搜索执行 */ onSearch?: (value: string, useRequest: Result) => void; /** 自定义展示 */ optionRender?: (value: DataOption) => string | ReactNode; } export interface ProSelectAction { /** 实例方法、根据 code | code[] 批量获取数据 */ getValueObject: (code: string | string[], key?: string) => any; /** 获取发生请求的 useRequest 的 ref */ useRequestRef: Result; } export interface ResponseData { status: number; message: string; data: any; success?: boolean; code?: number; }