import { ElementRef } from '@angular/core'; import { Observable } from 'rxjs'; import { FormGroup } from '@angular/forms'; export declare type JhiFileLoadErrorType = 'not.image' | 'could.not.extract'; export interface JhiFileLoadError { message: string; key: JhiFileLoadErrorType; params?: any; } /** * An utility service for data. */ export declare class JhiDataUtils { constructor(); /** * Method to abbreviate the text given */ abbreviate(text: string, append?: string): string; /** * Method to find the byte size of the string provides */ byteSize(base64String: string): string; /** * Method to open file */ openFile(contentType: string, data: string): void; /** * Method to convert the file to base64 */ toBase64(file: File, cb: Function): void; /** * Method to clear the input */ clearInputImage(entity: any, elementRef: ElementRef, field: string, fieldContentType: string, idInput: string): void; /** * Sets the base 64 data & file type of the 1st file on the event (event.target.files[0]) in the passed entity object * and returns a promise. * * @param event the object containing the file (at event.target.files[0]) * @param entity the object to set the file's 'base 64 data' and 'file type' on * @param field the field name to set the file's 'base 64 data' on * @param isImage boolean representing if the file represented by the event is an image * @returns a promise that resolves to the modified entity if operation is successful, otherwise rejects with an error message */ setFileData(event: any, entity: any, field: string, isImage: boolean): Promise; /** * Sets the base 64 data & file type of the 1st file on the event (event.target.files[0]) in the passed entity object * and returns an observable. * * @param event the object containing the file (at event.target.files[0]) * @param editForm the form group where the input field is located * @param field the field name to set the file's 'base 64 data' on * @param isImage boolean representing if the file represented by the event is an image * @returns an observable that loads file to form field and completes if sussessful * or returns error as JhiFileLoadError on failure */ loadFileToForm(event: Event, editForm: FormGroup, field: string, isImage: boolean): Observable; /** * Method to download file */ downloadFile(contentType: string, data: string, fileName: string): void; private endsWith; private paddingSize; private size; private formatAsBytes; }