@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
54 lines (50 loc) • 2.53 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 } 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;
set _mo(mo: IManagedObjectBinary);
mo: IManagedObjectBinary;
contentType: '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 removeDownloadedFile;
private setContentType;
static ɵfac: i0.ɵɵFactoryDeclaration<FilePreviewComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<FilePreviewComponent, "c8y-file-preview", never, { "_mo": { "alias": "mo"; "required": false; }; }, {}, 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