import * as _angular_core from '@angular/core'; import { InjectionToken, ElementRef, OutputEmitterRef, OnInit } from '@angular/core'; import * as i1 from '@angular/common'; import { Observable } from 'rxjs'; interface ThyFileSizeExceedsContext { files: File[]; exceedsFiles: File[]; nativeEvent?: Event; sizeThreshold?: number; } type ThySizeExceedsHandler = (data: ThyFileSizeExceedsContext) => File[] | undefined | void; interface ThyFileSelectEvent { files: File[]; nativeEvent: Event; } interface ThyUploadConfig { sizeThreshold?: number; sizeExceedsHandler?: ThySizeExceedsHandler; acceptType?: string; } declare const THY_UPLOAD_DEFAULT_OPTIONS: InjectionToken; declare const THY_UPLOAD_DEFAULT_OPTIONS_PROVIDER: { provide: InjectionToken; useValue: { acceptType: string; sizeThreshold: number; sizeExceedsHandler: typeof sizeExceedsHandler; }; }; declare function sizeExceedsHandler(event: ThyFileSizeExceedsContext): void; /** * @private */ declare class FileSelectBaseDirective { elementRef: ElementRef; defaultConfig: ThyUploadConfig; readonly thySizeThreshold: _angular_core.InputSignalWithTransform; readonly thySizeExceedsHandler: _angular_core.InputSignalWithTransform; /** * 指定文件后缀类型(MIME_Map),例如".xls,xlsx","[".doc",".docx"]" */ thyAcceptType: _angular_core.InputSignalWithTransform; constructor(); handleSizeExceeds(event: Event, files: File[]): void | File[]; selectFiles(event: Event, files: File[], eventEmitter: OutputEmitterRef): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * 文件上传组件 * @name thy-file-select,[thyFileSelect] * @order 10 */ declare class ThyFileSelect extends FileSelectBaseDirective { /** * 文件选择事件 */ readonly thyOnFileSelect: _angular_core.OutputEmitterRef; protected readonly fileInput: _angular_core.Signal>; /** * 文件是否多选 * @default false */ readonly thyMultiple: _angular_core.InputSignalWithTransform; /** * 是否接受文件夹 */ readonly thyAcceptFolder: _angular_core.InputSignalWithTransform; private destroyRef; private ngZone; constructor(); selectFile($event: Event): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * @name thyFileDrop */ declare class ThyFileDropDirective extends FileSelectBaseDirective implements OnInit { protected isDragOver: _angular_core.WritableSignal; readonly thyFileDropClassName: _angular_core.InputSignal; readonly thyOnDrop: _angular_core.OutputEmitterRef; /** * 当拖拽的文件中有不符合 thyAcceptType 中定义的类型时触发 * @description.en-us It is triggered when there are files in the dragged files that do not conform to the types defined in thyAcceptType. */ readonly thyFilesReject: _angular_core.OutputEmitterRef; private destroyRef; private renderer; private ngZone; constructor(); ngOnInit(): void; private checkRejectFolderAndHtmlElement; private getAsEntry; private filterFilesOrItems; private toggleDropOverClassName; private resetDragOver; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } declare class ThyUploadModule { static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵmod: _angular_core.ɵɵNgModuleDeclaration; static ɵinj: _angular_core.ɵɵInjectorDeclaration; } declare enum ThyUploadStatus { pending = "pending", started = "started", uploading = "uploading", done = "done" } interface ThyUploadResponse { status: ThyUploadStatus; uploadFile?: ThyUploadFile; } /** * 文件上传进度 * @public * @order 40 */ interface ThyUploadFileProgress { /** * 上传状态 * @default pending */ status: ThyUploadStatus; /** * 进度百分比 */ percentage: number; /** * 上传速度 */ speed?: number; /** * 人类可读的上传速度,比如: 120 kb/s */ speedHuman?: string; /** * 开始上传时间 */ startTime: number | null; /** * 结束上传时间 */ endTime?: number | null; /** * 上传时间 */ estimatedTime?: number | null; /** * 人类可读的上传时间,比如: 00:12:23 */ estimatedTimeHuman?: string | null; } /** * 文件上传对象 * @public * @order 30 */ interface ThyUploadFile { /** * 文件唯一标识 */ identifier?: string; /** * 上传方法 */ method: string; /** * 远程上传地址 */ url: string; /** * 是否携带认证信息 */ withCredentials?: boolean; /** * 原始文件 */ nativeFile: File; /** * 文件字段 */ fileField?: string; /** * 文件名 */ fileName?: string; /** * 请求头 */ headers?: Record; /** * 请求数据 */ data?: Record; /** * 响应状态 */ responseStatus?: any; /** * 上传响应结果 */ response?: any; /** * 响应头 */ responseHeaders?: any; /** * 上传进度 */ progress?: ThyUploadFileProgress; } interface ThyUploadFilesOptions { onStarted?: (item: ThyUploadFile) => void; onDone?: (item: ThyUploadFile) => void; } /** * 文件远程上传服务 * @order 20 */ declare class ThyUploadService { private xhrFactory; private secondsToHuman; private normalizeUploadFiles; private uploadByXhr; private ensureFileName; /** * 上传单个文件 * @param uploadFile 上传文件对象 */ upload(uploadFile: ThyUploadFile): Observable; /** * 并发上传多个文件 * @param uploadFiles 上传文件列表 * @param concurrent 并发上传数, 默认 5 * @param options onStared, onDone 回调 */ uploadBulk(uploadFiles: ThyUploadFile[], concurrent?: number, options?: ThyUploadFilesOptions): Observable; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } export { THY_UPLOAD_DEFAULT_OPTIONS, THY_UPLOAD_DEFAULT_OPTIONS_PROVIDER, ThyFileDropDirective, ThyFileSelect, ThyUploadModule, ThyUploadService, ThyUploadStatus, sizeExceedsHandler }; export type { ThyFileSelectEvent, ThyFileSizeExceedsContext, ThySizeExceedsHandler, ThyUploadConfig, ThyUploadFile, ThyUploadFileProgress, ThyUploadFilesOptions, ThyUploadResponse };