@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
55 lines (51 loc) • 2.73 kB
TypeScript
import * as i0 from '@angular/core';
import { OnDestroy, EventEmitter, TemplateRef } from '@angular/core';
import * as i1 from '@c8y/ngx-components';
import { IFetchWithProgress, FilesService, AlertService, GainsightService } from '@c8y/ngx-components';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { IManagedObjectBinary, IFetchResponse } from '@c8y/client';
import { SafeUrl, DomSanitizer } from '@angular/platform-browser';
/**
* A component which shows a button that opens a modal with the preview of a binary managed object.
* This component requires CSP 'blob:' rule for img-src and media-src to be set.
*
* ```html
* <c8y-file-preview [mo]="managedObject">
* <button customButton>Preview</button>
* </c8y-file-preview>
* ```
* If no custom button provided, the component will use the default search icon button instead.
*
*/
declare class FilePreviewComponent implements OnDestroy {
private downloadEmitter;
modalRef: BsModalRef;
private modalService;
private sanitizer;
private filesService;
private alertService;
private gainsightService;
mo: i0.InputSignal<IManagedObjectBinary>;
downloadFn: i0.InputSignal<() => Promise<IFetchResponse>>;
contentType: i0.Signal<"image" | "video" | "text" | "json" | "unsupported">;
progress: IFetchWithProgress;
dataUrl: string;
safeDataUrl: SafeUrl;
BUFFERING_STATUS_TEXT: "{{speed}}/s - {{bufferedBytes}} of {{totalBytes}} buffered ({{percentage}}%)";
private destroy$;
constructor(downloadEmitter: EventEmitter<string>, modalRef: BsModalRef, modalService: BsModalService, sanitizer: DomSanitizer, filesService: FilesService, alertService: AlertService, gainsightService: GainsightService);
ngOnDestroy(): void;
openModal(template: TemplateRef<any>): Promise<void>;
private fetchWithDownloadFn;
private removeDownloadedFile;
private resolveContentType;
static ɵfac: i0.ɵɵFactoryDeclaration<FilePreviewComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<FilePreviewComponent, "c8y-file-preview", never, { "mo": { "alias": "mo"; "required": true; "isSignal": true; }; "downloadFn": { "alias": "downloadFn"; "required": false; "isSignal": true; }; }, {}, never, ["[customButton]"], true, never>;
}
declare class FilePreviewModule {
static ɵfac: i0.ɵɵFactoryDeclaration<FilePreviewModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<FilePreviewModule, never, [typeof i1.CoreModule, typeof i1.CommonModule, typeof FilePreviewComponent], [typeof FilePreviewComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<FilePreviewModule>;
}
export { FilePreviewComponent, FilePreviewModule };
//# sourceMappingURL=index.d.ts.map