moh-common-lib
Version:
A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).
52 lines (51 loc) • 1.92 kB
TypeScript
import { ElementRef, EventEmitter, NgZone } from '@angular/core';
import { ControlContainer } from '@angular/forms';
import { CommonImage } from '../../models/images.model';
import { Base } from '../../models/base';
export interface FileUploaderMsg {
required: string;
}
export declare class FileUploaderComponent extends Base {
private zone;
private controlContainer;
browseFileRef: ElementRef;
images: Array<CommonImage>;
id: string;
showError: boolean;
required: boolean;
instructionText: string;
errorMessages: FileUploaderMsg;
imagesChange: EventEmitter<Array<CommonImage>>;
errorDocument: EventEmitter<CommonImage>;
constructor(zone: NgZone, controlContainer: ControlContainer);
/** Opens the file upload dialog from the browser. */
openFileDialog(): void;
handleDragOver(event: any): void;
handleDrop(event: any): void;
handleChangeFile(event: any): void;
private processFile;
private processPDFFile;
private getPageImage;
private processImageFile;
private scaleImage;
private createImage;
private addFileImages;
deleteImage(image: CommonImage): void;
private resetFileInput;
/**
* This is created as a workaround to access the form control that binds to
* the input[type='file']. We can't access it via the template name bindings
* as that isn't working, so instead we access the parent form and then find
* the input by name.
*/
readonly fileControl: any;
private handleError;
private getConstrainedSize;
/**
* A special method to force the rendering of this component. This is a workaround
* because for some unknown reason, AngularJS2 change detector does not detect the
* change of the images Array.
*/
forceRender(): void;
handleKeyDownFileBrowse(event: KeyboardEvent): void;
}