import { ProFieldRenderProps, ProFieldDataSourceItem, ProFieldProps, ProFieldType } from '../field'; import { ActionGroupProps, ProActionButtonProps } from '../actions'; import { Method } from 'axios'; import React from 'react'; import { CommonRequestConfig } from '@teamix/utils'; import { ProCardProps } from '../card'; import { ProFormProps } from '../form'; /** 列record函数 */ declare type ProInfoCellFunProp = (value: any, record: any) => any; declare type FieldRenderProps = keyof ProFieldRenderProps; declare type ProInfoCellRender = { [key in FieldRenderProps]?: ProFieldRenderProps[key] | ProInfoCellFunProp; } | ((...other: any) => React.ReactNode); export declare type PropInfoRequestProps = { /** 请求地址 */ url?: string; /** 请求方法 */ method?: Method; /** 请求参数 */ params?: object; /** 对返回值的 data 进行映射处理 */ formatResult?: { [key: string]: any; } | ((res: any) => { [key: string]: any; }); /** 请求成功后经过 formatResult 转换后的回调 */ onFormatResult?: (data: any[]) => void; /** 内部请求每次成功后的回调 */ onSuccess?: (res: any) => void; /** 内部请求失败时的回调 */ onError?: (error: Error) => void; }; export interface ProInfoRequestProps extends Partial { } /** ProInfoBaseProps info 基础定义 */ export declare type ProInfoBaseProps = { /** ProColums 定义,取代 Table 的 columns */ columns: ProInfoColumnsProps[]; /** ProInfo action 的引用,便于手动触发一些方法 */ actionRef?: React.MutableRefObject; /** 标题区 推荐将header中的内容平铺到ProCard中。即将不支持此写法 */ header?: ProInfoHeaderProps; /** info 数据源 */ dataSource?: { [key: string]: any; }; /** 布局值 */ layout?: ProBaseInfoLayoutProps; /** 加载动画 */ loading?: boolean; /** 上下文传递 */ context?: object; /** 是否在获取宽度之后才渲染Info 是否忽略首次响应式计算 **/ disabledAutoSize?: boolean; } & ProInfoHeaderProps & ProInfoRequestProps; /** ProInfoColumnsProps info 单元格 定义 */ export declare type ProInfoItemProps = ProInfoColumnsProps; export interface ProInfoColumnsProps { /** 标题 */ title: string; /** 列表项展示的Tooltip */ tooltip?: string; /** * title 之后展示一个 icon 设置,可传 TeamixIcon 对应的 type,也可以是自定义 Icon */ tooltipIcon?: React.ReactNode; /** 对应 ProField 里面的 type */ valueType?: ProFieldType; /** 渲染单元格内容字段 */ render?: ProInfoCellRender; /** 枚举值 */ dataSource?: ProFieldDataSourceItem[] | ProInfoCellFunProp; /** 表头的筛选菜单项,当值为 true 时,自动使用 dataSource 生成 */ filters?: boolean; /** 操作组配置 */ actionSchema?: ActionGroupProps; /** 指定列对应的字段,支持`a.b`形式的快速取值 和 数组取值 */ dataIndex?: string | string[]; /** 合并行 */ colSpan?: number; /** 是否可被编辑 */ isEdit?: boolean | ProInfoCellFunProp; /** 点击确定的回调函数 */ editOnOk?: (form: any, e: React.MouseEvent) => void | Promise; /** 点击取消的回调函数 */ editOnCancel?: (form: any, e: React.MouseEvent) => void | Promise; /** 请求地址 */ editUrl?: string; /** 请求方法 */ editMethod?: Method; /** 如需自定义调用参数格式,则可以设定此值在请求前对 params 进行自定义,如果返回false则可以阻止请求 */ editFormatParams?: (params: any, record: any) => typeof params; /** edit ProForm 配置 */ editProFormProps?: ProFormProps | ProInfoCellFunProp; /** 编辑请求成功提示文案 */ successMessage?: string; /** 列 actions 配置 */ actions?: ProActionButtonProps[]; /** 追加在列后 */ extra?: React.ReactNode; /** 其他 ProField 配置 */ props?: any; /** 对齐方式 **/ alignItems?: 'center' | 'flex-start' | 'flex-end' | string; /** 是否隐藏 **/ hidden?: boolean | ProInfoCellFunProp | string; } export declare type ProInfoActionType = { /** 刷新Info */ refresh?: (params?: any) => void; }; /** FormItem 定义 */ export declare type IProProInfoItem = { /** label */ label: React.ReactNode; /** 值 */ value: React.ReactNode; /** 基础详情布局值 */ baseInfoLayout?: ProBaseInfoLayoutProps; /** 头部详情布局值 */ headerInfoLayout?: ProHeaderInfoLayoutProps; /** loading 状态 */ loading?: boolean; } & Pick; /** header info 定义 */ export declare type IProHeaderInfo = { /** 布局值 */ layout?: ProHeaderInfoLayoutProps; } & Omit; /** table info 定义 */ export declare type IProTableInfo = { /** 布局值 */ layout?: TableInfoLayoutProps; } & Omit; declare type ProInfoBasePropsOmitLayout = Omit; /** ProInfo */ export declare type ProInfoProps = { /** 布局值 */ layout?: TableInfoLayoutProps | ProHeaderInfoLayoutProps | ProBaseInfoLayoutProps; /** 类型 */ type?: 'base' | 'header' | 'table'; } & ProInfoBasePropsOmitLayout & ProInfoTransparentBase; export declare type IProHeaderInfoItem = {}; export declare type BaseInfoLayoutProps = ProBaseInfoLayoutProps; export declare type ProBaseInfoLayoutProps = { span?: number; labelCol?: { span: number; }; wrapperCol?: { span: number; }; }; export declare type headerInfoLayout = ProHeaderInfoLayoutProps; export declare type ProHeaderInfoLayoutProps = { /** label 间隔 */ labelGutter?: number | string; /** 列数 宽度 */ colNum?: number; }; /** infoGroup */ export declare type ProInfoGroupProps = { children?: React.ReactNode[] | React.ReactNode | ProInfoBaseProps[]; /** 是否有有分割线 */ divider?: boolean; /** 是否是紧凑模式 */ compacted?: ProCardProps['compacted']; /** 背景颜色 */ backgroundColor?: ProCardProps['backgroundColor']; /** 上下文 */ context?: object; } & ProInfoRequestProps & React.HTMLAttributes; export declare type TableInfoLayoutProps = {} & ProHeaderInfoLayoutProps; export declare type InfoValueItemProps = { infoItem: ProInfoColumnsProps; record: any; actionRef?: React.MutableRefObject; render?: ProInfoCellRender; dataSource?: ProFieldDataSourceItem[] | ProInfoCellFunProp; context?: object; props?: any; } & Omit; export declare type ProInfoHeaderProps = Omit; /** ProInfoGroupContextProps */ export declare type ProInfoGroupContextProps = { /** 因为其他数据都为异步。visible 只用作标识 */ visible?: boolean; layout?: ProInfoBaseProps['layout']; size?: { width?: number; height?: number; }; context?: object; } & ProInfoRequestProps; /** 基本透传类型 */ export declare type ProInfoTransparentBase = { /** * 键盘按下 */ onKeyDown?: (e: React.KeyboardEvent) => void; /** * 焦点获得 */ onFocus?: (e: React.FocusEvent) => void; /** * 焦点失去 */ onBlur?: (e: React.FocusEvent) => void; /** class name */ className?: string; /** style */ style?: React.CSSProperties; }; export declare type ProInfoTransRequestResult = { loading: boolean; result: any; refresh?: () => void; }; export {};