import * as i0 from '@angular/core'; import { TemplateRef, OnInit, ElementRef, OnChanges, AfterViewInit, EventEmitter } from '@angular/core'; import { Observable, Subscription } from 'rxjs'; import { NzSafeAny, IndexableObject, BooleanInput } from 'ng-zorro-antd/core/types'; import { Direction } from '@angular/cdk/bidi'; import { NzUploadI18nInterface } from 'ng-zorro-antd/i18n'; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /** Status */ type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed'; type NzUploadType = 'select' | 'drag'; /** Built-in styles of the uploading list. */ type NzUploadListType = 'text' | 'picture' | 'picture-card'; interface NzUploadFile { uid: string; size?: number; name: string; filename?: string; lastModified?: string; lastModifiedDate?: Date; url?: string; status?: UploadFileStatus; originFileObj?: File; percent?: number; thumbUrl?: string; response?: NzSafeAny; error?: NzSafeAny; linkProps?: { download: string; }; type?: string; [key: string]: NzSafeAny; } interface NzUploadChangeParam { file: NzUploadFile; fileList: NzUploadFile[]; event?: { percent: number; }; /** Callback type. */ type?: string; } interface NzShowUploadList { showRemoveIcon?: boolean; showPreviewIcon?: boolean; showDownloadIcon?: boolean; } type NzUploadTransformFileType = string | Blob | NzUploadFile | Observable; interface ZipButtonOptions { disabled?: boolean; accept?: string | string[]; action?: string | ((file: NzUploadFile) => string | Observable); directory?: boolean; openFileDialogOnClick?: boolean; beforeUpload?(file: NzUploadFile, fileList: NzUploadFile[]): boolean | Observable; customRequest?(item: NzSafeAny): Subscription; data?: {} | ((file: NzUploadFile) => {} | Observable<{}>); headers?: {} | ((file: NzUploadFile) => {} | Observable<{}>); name?: string; multiple?: boolean; withCredentials?: boolean; filters?: UploadFilter[]; transformFile?(file: NzUploadFile): NzUploadTransformFileType; onStart?(file: NzUploadFile): void; onProgress?(e: NzSafeAny, file: NzUploadFile): void; onSuccess?(ret: NzSafeAny, file: NzUploadFile, xhr: NzSafeAny): void; onError?(err: NzSafeAny, file: NzUploadFile): void; } interface UploadFilter { name: string; fn(fileList: NzUploadFile[]): NzUploadFile[] | Observable; } interface NzUploadXHRArgs { action?: string; name?: string; headers?: IndexableObject; file: NzUploadFile; postFile: string | Blob | File | NzUploadFile; data?: IndexableObject; withCredentials?: boolean; onProgress?(e: NzSafeAny, file: NzUploadFile): void; onSuccess?(ret: NzSafeAny, file: NzUploadFile, xhr: NzSafeAny): void; onError?(err: NzSafeAny, file: NzUploadFile): void; } type NzIconRenderTemplate = TemplateRef<{ $implicit: NzUploadFile; }>; declare class NzUploadBtnComponent implements OnInit { reqs: Record; private destroyed; file: ElementRef; options: ZipButtonOptions; onClick(): void; onFileDrop(e: DragEvent): void; onChange(e: Event): void; private traverseFileTree; private attrAccept; private attachUid; uploadFiles(fileList: FileList | File[]): void; private upload; private post; private xhr; private clean; abort(file?: NzUploadFile): void; private http; private elementRef; private destroyRef; constructor(); ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } type UploadListIconType = '' | 'uploading' | 'thumbnail'; interface UploadListFile extends NzUploadFile { isImageUrl?: boolean; isUploading?: boolean; iconType?: UploadListIconType; showDownload?: boolean; } declare class NzUploadListComponent implements OnChanges { list: UploadListFile[]; private get showPic(); locale: NzSafeAny; listType: NzUploadListType; set items(list: NzUploadFile[]); icons: NzShowUploadList; onPreview?: (file: NzUploadFile) => void; onRemove: (file: NzUploadFile) => void; onDownload?: (file: NzUploadFile) => void; previewFile?: (file: NzUploadFile) => Observable; previewIsImage?: (file: NzUploadFile) => boolean; iconRender: NzIconRenderTemplate | null; dir: Direction; private document; private destroyRef; private ngZone; private cdr; private platform; private genErr; private extname; isImageUrl(file: NzUploadFile): boolean; private getIconType; private previewImage; private genThumb; private showDownload; private fixData; handlePreview(file: NzUploadFile, e: Event): void; handleRemove(file: NzUploadFile, e: Event): void; handleDownload(file: NzUploadFile): void; detectChanges(): void; ngOnChanges(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare class NzUploadComponent implements OnInit, AfterViewInit, OnChanges { static ngAcceptInputType_nzShowUploadList: BooleanInput | NzShowUploadList; private cdr; private i18n; private directionality; private destroyRef; uploadComp: NzUploadBtnComponent; listComp: NzUploadListComponent; locale: NzUploadI18nInterface; dir: Direction; nzType: NzUploadType; nzLimit: number; nzSize: number; nzFileType?: string; nzAccept?: string | string[]; nzAction?: string | ((file: NzUploadFile) => string | Observable); nzDirectory: boolean; nzOpenFileDialogOnClick: boolean; nzBeforeUpload?: (file: NzUploadFile, fileList: NzUploadFile[]) => boolean | Observable; nzCustomRequest?: (item: NzUploadXHRArgs) => Subscription; nzData?: {} | ((file: NzUploadFile) => {} | Observable<{}>); nzFilter: UploadFilter[]; nzFileList: NzUploadFile[]; nzDisabled: boolean; nzHeaders?: {} | ((file: NzUploadFile) => {} | Observable<{}>); nzListType: NzUploadListType; nzMultiple: boolean; nzName: string; private _showUploadList; private document; set nzShowUploadList(value: boolean | NzShowUploadList); get nzShowUploadList(): boolean | NzShowUploadList; nzShowButton: boolean; nzWithCredentials: boolean; nzRemove?: (file: NzUploadFile) => boolean | Observable; nzPreview?: (file: NzUploadFile) => void; nzPreviewFile?: (file: NzUploadFile) => Observable; nzPreviewIsImage?: (file: NzUploadFile) => boolean; nzTransformFile?: (file: NzUploadFile) => NzUploadTransformFileType; nzDownload?: (file: NzUploadFile) => void; nzIconRender: NzIconRenderTemplate | null; nzFileListRender: TemplateRef<{ $implicit: NzUploadFile[]; }> | null; readonly nzChange: EventEmitter; readonly nzFileListChange: EventEmitter; _btnOptions?: ZipButtonOptions; private zipOptions; private readonly platform; private fileToObject; private getFileItem; private removeFileItem; private onStart; private onProgress; private onSuccess; private onError; private dragState?; fileDrop(e: DragEvent): void; private detectChangesList; onRemove: (file: NzUploadFile) => void; private prefixCls; classList: string[]; private setClassMap; ngOnInit(): void; ngAfterViewInit(): void; ngOnChanges(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_nzLimit: unknown; static ngAcceptInputType_nzSize: unknown; static ngAcceptInputType_nzDirectory: unknown; static ngAcceptInputType_nzOpenFileDialogOnClick: unknown; static ngAcceptInputType_nzDisabled: unknown; static ngAcceptInputType_nzMultiple: unknown; static ngAcceptInputType_nzShowButton: unknown; static ngAcceptInputType_nzWithCredentials: unknown; } declare class NzUploadModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { NzUploadBtnComponent, NzUploadComponent, NzUploadListComponent, NzUploadModule }; export type { NzIconRenderTemplate, NzShowUploadList, NzUploadChangeParam, NzUploadFile, NzUploadListType, NzUploadTransformFileType, NzUploadType, NzUploadXHRArgs, UploadFileStatus, UploadFilter, ZipButtonOptions };