import React from 'react'; import { SaveResponse } from './api/save'; import { TableAttachInitResponse } from './api/tableAttachInit'; import { AttachmentRecord } from './api/tableAttachInit/attachmentRecord'; /** * 宿主环境 */ export declare enum HostEnv { /** h5 */ H5 = 0, /** 中建通 PC */ WECHAT_OFFICIAL_PC = 1, /** 中建通 MOBILE */ WECHAT_OFFICIAL_MOBILE = 2 } /** * 接受类型配置 */ export interface AcceptConfig { /** 唯一索引 */ id: string; /**标题 */ label: string; /** 图标 */ icon?: JSX.Element; /** 接受文件类型字段 */ accept: Record>; } /** * 文件类型枚举 */ export declare enum FileType { /** 图片 */ Image = 0, /** 视频 */ Video = 1, /** 音频 */ Audio = 2, /** Word */ Word = 3, /** PDF */ PDF = 4, /** Excel */ Excel = 5, /** PPT */ PPT = 6, /** 文本 */ Txt = 7, /** 未知类型 */ Unknow = 8, Zip = 9 } /** * 文件预览方式 */ export declare enum PreviewType { /** 图片 */ Image = 0, /** 视频 */ Video = 1, /** 音频 */ Audio = 2, /** PDF */ PDF = 3, /** 网页 */ Iframe = 4 } /** * 文件类型配置 */ export interface FileTypeConfig { /** 文件类型 */ type: FileType; /** 图标 */ icon: JSX.Element; /** 文件名过滤用后缀 */ suffix: string[]; /** 预览类型 */ previewType: PreviewType; } /** * 业务属性 */ export interface BusinessProps { /** 业务表 * @deprecated (移除,现在采用 fileTypeCode 字段) */ asrTable?: string; /** * 业务表主键 * @deprecated (移除,现在采用 fileTypeCode 字段) */ asrCode?: string; /** 附件表 */ asrAttachTable?: string; /** 录入人Id */ asrFill?: string; /** 录入人姓名 */ asrFillName?: string; /** 组织Id */ orgId?: string; /** 业务类型编码 */ busTypeCode?: string; /** 业务单据url */ busUrl?: string; /** 字段附件 */ colAttach?: 0 | 1; unitNo?: string; projectId?: string; fileTypeCode: string; } /** * 功能属性 */ export interface FunctionalProps { /** 文件类型选择 */ accept?: string[]; /** 是否多附件 */ multiple?: boolean; /** 是否禁用 */ disabled?: boolean; /** 最大上传数 */ maxCount?: number; /** 文件切片大小 */ chunkSize?: number; /** 上传并行线程数 */ threadCount?: number; /** 上传按钮 */ children?: React.ReactNode; /** 刷新附件会话Id */ refreshId?: string; } /** * 附件组件ref对外提供api */ export interface InstanceApi { /** 获取当前上传文件 */ getFileList: () => UploadFile[]; /** 获取附件会话Id */ getCursorId: () => string | undefined; /** 保存附件 */ saveAttachment: () => Promise; } /** * card 使用 卡片样式 * list 使用 列表样式 * button 使用 button按钮样式 * button-upload button 按钮样式,上传和查看互斥 */ export type AttachmentType = 'card' | 'list' | 'button' | 'button-upload'; /** * 附件组件Props */ export interface IProps extends Omit, FunctionalProps { type?: AttachmentType; acceptType?: string[]; /** 值 */ value?: string; /** 值变动回调 */ onChange?: (value: string) => void; } /** * 附件上传组件Props */ export interface UploadProps extends Omit, Pick { /** 附件初始化方法 */ attachInit?: () => Promise; acceptType?: string[]; /** 上传按钮 */ children?: React.ReactNode; } /** * 附件上传任务 */ export interface UploadTask { /** 文件唯一标识符 */ identifier: string; /** 上传文件 */ chunkFile: Blob; /** 上传地址 */ uploadUrl: string; /** 上传部分 */ partNumber: number; } /** * 附件上传组件State */ export interface UploadState { /** 选择文件类型弹出层显隐 */ popupVisible: boolean; /** 合计上传文件数 */ totalCount: number; /** 成功上传文件数 */ succeedCount: number; /** 失败上传文件数 */ failedCount: number; /** 上传进度百分比 */ percent: number; } /** * 附件列表组件Props */ export interface ListProps { /** 预览的附件类型 */ disabled?: boolean; previewFileType: string[]; children?: React.ReactNode; } /** * 附件列表组件State */ export interface ListState { /** 删除loading队列 */ loadingList: string[]; } /** * 第三方页面调用中建通原生功能 发送参数 */ export interface NativeSend { /** 类型 */ type: 'native'; /** 方法 */ method: string; /** 方法参数 */ params?: Record; /** 会话Id */ sessionId?: string; } /** * 第三发页面监听框架调用中建通原生功能 返回内容 */ export interface NativeReceive extends Omit { /** 调用状态 */ status: 'success' | 'fail' | 'complete' | 'cancel'; /** 返回值 */ data?: any; } /** * 指令式打开附件组件参数 */ export type openAttachmentParams = BusinessProps & Pick & { value?: string; }; /** * 指令式打开附件组件返回 */ export type openAttachmentReturn = InstanceApi; export type uploadFileParams = { chunkNumber: number; chunkSize: number; currentChunkSize: number; totalChunks: number; totalSize: number; fileName: string; md5: string; file: File | Blob | ArrayBuffer; busiType: string; cursorId?: string; ctlgId?: string; }; export type uploadWXFileParams = { cursorId: string; metiaId: string; busiType: string; }; export type UploadFileStatus = 'error' | 'done' | 'uploading' | 'removed'; export interface OriginFile extends File { uid: string; localId?: string; serverId?: string; } export interface UploadFile { uid: string; size?: number | string; name: string; fileName?: string; lastModified?: number; lastModifiedDate?: Date; status?: UploadFileStatus; percent?: number; fileParams?: uploadFileParams[] | uploadWXFileParams; record?: AttachmentRecord; originFile?: OriginFile; errorMessage?: string; preview?: string; fileType?: string; }