import * as i0 from '@angular/core'; import { OnInit, OnDestroy } from '@angular/core'; import { HttpEvent } from '@angular/common/http'; import { ControlValueAccessor } from '@angular/forms'; import { Observable, Subscription, Subject } from 'rxjs'; /** * This type represents a file or form item that has been sent as part of a multipart/form-data POST request. */ declare class FileUploadItem { /** The original filename in the client's filesystem, as provided by the browser. */ name: string; /** The size of the file item. */ size: number; /** An alpha-numeric string that uniquely identifies the file item. */ id: string; /** The content type (MIME type) of the file. */ type: string; /** @internal */ constructor(_id: string, _name: string, _size: number, _type: string); } /** * This is an API for processing file upload requests. * * A sub class of this type handles multiple file requests, sent using multipart/form-data encoding type, as specified by RFC 1867. * * Please extend this type and provide it in an injector at the same level, or ancestral to that, of the `FileUploadComponent`. */ declare abstract class FileUploadService { /** * Upload a list of selected files from the browser. The returned `Observable` array provides the update of the uploading progress * through HTTP events. */ abstract upload(files: File[]): Array>>; /** List all the uploaded file items in the current HTTP session. This list excludes the files still in the process of being uploaded*/ abstract list(): Observable; /** Get the content of an uploaded file item as a `Blob`. */ abstract get(id: string): Observable; /** Delete an uploaded file item from the server. */ abstract delete(id: string): Observable; /** Delete all uploaded file items in the current HTTP session. */ abstract clear?(): Observable; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** @ignore */ declare class UploadingItem { private oncancel?; progress: number; uploadedItem: FileUploadItem | null | undefined; downloadingSubs?: Subscription; private subscription; private file?; constructor(item: FileUploadItem, oncancel: (item: UploadingItem) => void); constructor(event$: Observable> | FileUploadItem, file: File, oncomplete: () => void, oncancel: (item: UploadingItem) => void); cancel(): void; get done(): boolean; get name(): string | undefined; get downloading(): boolean | undefined; } /** * A control value accessor component to provide the user interface for uploading files. * * The application that integrates this UI must provide an implementation of `FileUploadService`. * * The control's value is a list of alpha-numerical strings, which are the identifiers to the uploaded files. * * Example: * * ```html *
* *
* ``` * * @see FileUploadService */ declare class FileUploadComponent implements OnInit, OnDestroy, ControlValueAccessor { private _service; /** @ignore */ _value: string[] | null; /** * The caption of the button for opening file selection dialog. */ uploadActionText: string; /** * The label for listing successful uploaded files. */ fileUploadedLabel: string; /** * The text to be displayed when the user starts to drag file items over the browser window. */ dragHint: string; /** * The text to be displayed when the user is dragging the file items over the drop zone. */ dropHint: string; /** Specifies the total number of files accepted. A falsy value removes the limit.*/ limit: number; /** * specify the number of maximum bytes that can be uploaded. * if number is specified, bytes are assumed, otherwise enter a string for specific size type. */ fileSize: number | string; /** * Accepted MIME types * * @example ['text/*', 'image/png'] */ get types(): string[]; set types(types: string[]); /** @ignore */ _fileSizeExceedMsg: string; /** @ignore */ _uploadingItems: UploadingItem[]; /** @ignore */ _accept: string; /** @ignore */ _itemAnimationStart: Subject; /** @ignore */ _itemAnimationDone: Subject; /** @ignore */ _itemAnimationInProgress: boolean; private _onChange; private _onTouch; private _frameDndEnter; private _frameDndLeave; private _frameDndOver; private _frameDndStop; private _overFrameCounter; private _overCounter; private _typeRegExps; private _types; private _initSubs?; protected _numberOfFilesDragged: number; private _fileInput; constructor(_service: FileUploadService); /** @internal */ ngOnInit(): void; ngOnDestroy(): void; /** @internal */ writeValue(obj: any): void; /** @internal */ registerOnChange(fn: any): void; /** @internal */ registerOnTouched(fn: any): void; /** @internal */ onDragEnter(event: DragEvent): void; /** @internal */ onDragOver(event: Event): void; /** @internal */ onDragLeave(event: Event): void; /** @internal */ onDndDrop(event: DragEvent): void; /** Open the file selection dialog */ selectFiles(): void; /** @ignore */ _openItem(item: UploadingItem): void; /** @ignore */ get _overFrame(): boolean; /** @ignore */ get _overDropZone(): boolean; /** Whether file uploading is in progress */ get uploading(): boolean; /** The remaining number of files allowed.*/ get remaining(): number; /** @ignore */ _handleFileSelection(): void; /** @ignore */ get _invalidFilesDragged(): boolean; /** @ignore */ get _initialising(): boolean; private returnFileSize; private _validateFileSize; private _getMaxBytes; private _uploadFiles; private _onDndEnterFrame; private _onDndLeaveFrame; private _onDndStopFrame; private _acceptChange; private _updateItems; private _deleteItem; private _updateValue; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class FileUploadModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { FileUploadComponent, FileUploadItem, FileUploadModule, FileUploadService };