import React from 'react'; import { AttachmentButtonPopoverProps } from './AttachmentButtonPopover'; import { AttachmentFile, UploadResponse } from './types'; export * from './AttachmentButtonPopover'; export type { AttachmentFile, UploadResponse } from './types'; /** * AttachmentButton 组件属性 */ export type AttachmentButtonProps = { /** 文件上传处理函数,返回文件 URL */ upload?: (file: AttachmentFile, index: number) => Promise; /** 文件上传处理函数(返回完整响应),优先级高于 upload */ uploadWithResponse?: (file: AttachmentFile, index: number) => Promise; /** 文件映射表,用于存储已上传的文件 */ fileMap?: Map; /** 文件映射表变更时的回调 */ onFileMapChange?: (files?: Map) => void; /** 支持的文件格式配置 */ supportedFormat?: AttachmentButtonPopoverProps['supportedFormat']; /** 是否禁用按钮 */ disabled?: boolean; /** 自定义渲染函数,用于替换默认的 Popover */ render?: (props: { children: React.ReactNode; supportedFormat?: AttachmentButtonPopoverProps['supportedFormat']; }) => React.ReactElement; /** 删除文件回调 */ onDelete?: (file: AttachmentFile) => Promise; /** 预览文件回调 */ onPreview?: (file: AttachmentFile) => Promise; /** 下载文件回调 */ onDownload?: (file: AttachmentFile) => Promise; /** 单个文件最大大小(字节) */ maxFileSize?: number; /** 最大文件数量 */ maxFileCount?: number; /** 最小文件数量 */ minFileCount?: number; /** 是否允许一次选择多个文件(默认:true) */ allowMultiple?: boolean; }; /** * 文件上传配置 */ type UploadProps = { /** 文件映射表 */ fileMap?: Map; /** 文件映射变更回调 */ onFileMapChange?: (files?: Map) => void; /** 上传函数,返回文件 URL */ upload?: (file: AttachmentFile, index: number) => Promise; /** 上传函数(返回完整响应) */ uploadWithResponse?: (file: AttachmentFile, index: number) => Promise; /** 单文件最大大小(字节) */ maxFileSize?: number; /** 最大文件数量 */ maxFileCount?: number; /** 最小文件数量 */ minFileCount?: number; /** 国际化文案 */ locale?: any; }; /** * 上传文件到服务器 * * @param files - 要上传的文件列表 * @param props - 上传配置项 * @param props.upload - 上传函数,返回文件 URL * @param props.uploadWithResponse - 上传函数(返回完整响应) * @param props.fileMap - 文件映射表 * @param props.onFileMapChange - 文件映射变更回调 * @param props.maxFileSize - 单文件最大大小(字节) * @param props.maxFileCount - 最大文件数量 * @param props.minFileCount - 最小文件数量 * @param props.locale - 国际化文案 */ export declare const upLoadFileToServer: (files: ArrayLike, props: UploadProps) => Promise; /** * 附件上传按钮组件 * * 提供文件附件上传功能,支持图片、文档、音频、视频等多种格式 * * @example * ```tsx * * ``` */ export declare const AttachmentButton: React.FC; /** 按钮标题文本 */ title?: React.ReactNode; }>;