UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

106 lines 4.65 kB
import { ElementRef, AfterViewInit, OnInit, Injector, EventEmitter } from '@angular/core'; import { Observable } from 'rxjs'; import { FilesService, IFetchWithProgress } from '../common'; import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator } from '@angular/forms'; import * as i0 from "@angular/core"; interface IAvailableValidators { fileMaxSize?: boolean; fileNonEmpty?: boolean; fileNameMaxLength?: boolean; } /** File uploader */ export declare class FilePickerFormControlComponent implements OnInit, AfterViewInit, ControlValueAccessor, Validator { private filesService; private injector; filePlaceholder: ElementRef<HTMLElement>; /** Specifies a filter for what file types the user can pick from the file input dialog box. * By default all types are accepted. * * Specify file types by extensions: * ```html * ... * [accept]="'.zip,.7z'" * ... * ``` * * Specify file types by extensions and generic types [GENERIC_FILE_TYPE]{@link GENERIC_FILE_TYPE}: * ```html * ... * [accept]="'.pdf,archive'" * ... * ``` * * Specify file types by generic types [GENERIC_FILE_TYPE]{@link GENERIC_FILE_TYPE}: * ```html * ... * [accept]="'archive,video'" * ... * * ``` */ accept?: string; /** * Sets how many files can be submitted, accepts only numbers. */ maxAllowedFiles?: number; /** * Sets the minimum number of files to be uploaded, accepts only numbers. */ minRequiredFiles?: number; /** * Allows to disable default validators. Accepts object with following optional properties: - fileMaxSize - Providing `true` disables default validation for file size, accepts only boolean - fileNonEmpty - Providing `true` disables default validation for empty files, accepts only boolean - fileNameMaxLength - Providing `true` disables default validation for file name length, accepts only boolean */ disableValidators: IAvailableValidators; /** * Displays upload progress bar, accepts only boolean. */ uploadInProgress: boolean; /** The array of progress state objects for each selected file (matched by index). */ uploadProgress: IFetchWithProgress[]; /** Display warning if any file dragged over the drop area has unsupported extension. */ validateExtensionOnDrag: boolean; /** Emits an event with the array of File objects representing the dropped files. */ dropped: EventEmitter<File[]>; droppedFiles: File[]; isDraggingFiles$: Observable<boolean>; isDraggingOverFilePlaceholder$: Observable<boolean>; isExtensionAllowed$: Observable<boolean>; isDropAreaEnlarged$: Observable<boolean>; isDraggedFileUnsupported$: Observable<boolean>; acceptedExts: string[]; valid: boolean; errors: ValidationErrors; controlInstance: AbstractControl; disabled: boolean; disabledValidators: IAvailableValidators; loadingMessage: "Upload in progress"; private isExtensionAllowed; private fileSizeLimit; constructor(filesService: FilesService, injector: Injector); ngOnInit(): void; ngAfterViewInit(): void; afterValueChanged(): void; onDrop(e: DragEvent): void; filesSelected(ev: Event): void; deleteAt(index: number): void; registerOnChange(fn: never): void; registerOnTouched(fn: never): void; setDisabledState(isDisabled: boolean): void; registerOnValidatorChange(fn: () => void): void; writeValue(files: File[] | null): void; onDragOver(e: any): void; onWindowDrop(e: any): void; validate(control: AbstractControl): ValidationErrors | null; private onChange; private onTouched; private onValidatorChange; static ɵfac: i0.ɵɵFactoryDeclaration<FilePickerFormControlComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FilePickerFormControlComponent, "c8y-file-picker-form-control", never, { "accept": { "alias": "accept"; "required": false; }; "maxAllowedFiles": { "alias": "maxAllowedFiles"; "required": false; }; "minRequiredFiles": { "alias": "minRequiredFiles"; "required": false; }; "disableValidators": { "alias": "disableValidators"; "required": false; }; "uploadInProgress": { "alias": "uploadInProgress"; "required": false; }; "uploadProgress": { "alias": "uploadProgress"; "required": false; }; "validateExtensionOnDrag": { "alias": "validateExtensionOnDrag"; "required": false; }; }, { "dropped": "dropped"; }, never, never, true, never>; } export {}; //# sourceMappingURL=file-picker-form-control.component.d.ts.map