import { type GetProp, type UploadProps } from 'antd'; import React from 'react'; import { type FileListProps } from './FileList'; import FileListCard from './FileList/FileListCard'; import ImageCard from './FileList/ImageCard'; import { type PlaceholderType } from './PlaceholderUploader'; export type SemanticType = 'list' | 'item' | 'placeholder'; export type Attachment = GetProp[number] & { description?: React.ReactNode; }; export interface AttachmentsProps extends Omit { /** * @description 自定义CSS类名前缀,用于样式隔离和主题定制 * @descriptionEn Custom CSS class name prefix for style isolation and theme customization */ prefixCls?: string; /** * @description 自定义根容器的CSS类名,用于覆盖默认样式 * @descriptionEn Custom CSS class name for the root container to override default styles */ rootClassName?: string; /** * @description 根容器的内联样式对象 * @descriptionEn Inline style object for the root container */ rootStyle?: React.CSSProperties; /** * @description 组件容器的内联样式对象 * @descriptionEn Inline style object for the component container */ style?: React.CSSProperties; /** * @description 组件的CSS类名 * @descriptionEn CSS class name for the component */ className?: string; /** * @description 语义化CSS类名,用于为不同区域添加自定义类名 * @descriptionEn Semantic CSS class names for adding custom classes to different areas */ classNames?: Partial>; /** * @description 语义化样式对象,用于精确控制不同区域的样式 * @descriptionEn Semantic style object for precise control of different area styles */ styles?: Partial>; /** * @description 自定义子元素,用于扩展组件功能 * @descriptionEn Custom child elements for extending component functionality */ children?: React.ReactElement; /** * @description 是否禁用整个附件组件,包括拖拽和点击上传 * @descriptionEn Whether to disable the entire attachment component, including drag and click upload */ disabled?: boolean; /** * @description 占位符配置,支持静态内容或动态函数返回 * @descriptionEn Placeholder configuration, supports static content or dynamic function return */ placeholder?: PlaceholderType | ((type: 'inline' | 'drop') => PlaceholderType); /** * @description 获取拖拽容器的函数,用于自定义拖拽区域 * @descriptionEn Function to get drag container for customizing drag area */ getDropContainer?: null | (() => HTMLElement | null | undefined); /** * @description 附件列表数据,用于显示已上传的文件 * @descriptionEn Attachment list data for displaying uploaded files */ items?: Attachment[]; /** * @description 文件列表溢出处理方式,影响多文件的显示效果 * @descriptionEn File list overflow handling method, affects display effect of multiple files */ overflow?: FileListProps['overflow']; /** * @description 渲染类型,目前仅支持默认渲染模式 * @descriptionEn Render type, currently only supports default render mode */ renderType?: 'default'; /** * @description 图片类型文件是否支持点击刷新按钮直接替换上传 * @descriptionEn Whether image files support direct replacement upload via the refresh button */ replaceable?: boolean; } export interface AttachmentsRef { /** * @description 组件的原生DOM元素引用,用于直接操作DOM * @descriptionEn Native DOM element reference of the component for direct DOM manipulation */ nativeElement: HTMLDivElement | null; /** * @description 手动触发文件上传的方法,接收File对象作为参数 * @descriptionEn Method to manually trigger file upload, accepts File object as parameter */ upload: (file: File) => void; } declare const ForwardAttachments: React.ForwardRefExoticComponent> & { FileCard: typeof FileListCard; ImageCard: typeof ImageCard; }; export default ForwardAttachments;