import React from 'react'; import type { LocalKeys } from '../../I18n'; import { AttachmentButtonPopoverProps } from './AttachmentButtonPopover'; import { AttachmentFile, UploadResponse } from './types'; export * from './AttachmentButtonPopover'; export type { AttachmentFile, UploadResponse } from './types'; /** * `upLoadFileToServer` 已迁移至 `src/MarkdownInputField/utils/uploadFile.ts`, * 此处保留 re-export 兼容层,确保 `src/index.ts` 的公开 API 与下游调用方 * (`FileUploadManager`、`hooks/usePasteHandler` 等)的导入路径不发生破坏性变更。 */ export { upLoadFileToServer } from '../utils/uploadFile'; /** * 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; /** 国际化文案,会传递给 AttachmentButtonPopover。支持 `input.supportedFormatMessage` 等 */ locale?: Partial; /** 自定义渲染函数,用于替换默认的 Popover */ render?: (props: { children: React.ReactNode; supportedFormat?: AttachmentButtonPopoverProps['supportedFormat']; locale?: Partial; }) => React.ReactElement; /** 删除文件回调 */ onDelete?: (file: AttachmentFile) => Promise; /** 预览文件回调 */ onPreview?: (file: AttachmentFile) => void | Promise; /** 下载文件回调 */ onDownload?: (file: AttachmentFile) => Promise; /** 单个文件最大大小(字节) */ maxFileSize?: number; /** 最大文件数量 */ maxFileCount?: number; /** 最小文件数量 */ minFileCount?: number; /** 是否允许一次选择多个文件(默认:true) */ allowMultiple?: boolean; /** 文件数量超出 maxFileCount 限制时的回调 */ onExceedMaxCount?: (info: { maxCount: number; currentCount: number; selectedCount: number; }) => void; /** 文件超出 maxFileSize 大小限制时的回调 */ onExceedMaxSize?: (info: { file: AttachmentFile; maxSize: number; }) => void; /** 文件上传失败时的回调 */ onUploadError?: (info: { file: AttachmentFile; error: unknown; }) => void; /** * 上传失败时自动将文件从列表中移除(退回),不显示错误状态 * @default false */ removeFileOnUploadError?: boolean; }; /** * 附件上传按钮组件 * * 提供文件附件上传功能,支持图片、文档、音频、视频等多种格式 * * @example * ```tsx * * ``` */ export declare const AttachmentButton: React.FC; /** 按钮标题文本 */ title?: React.ReactNode; }>;