UNPKG

stimulsoft-dashboards-js-angular

Version:

Stimulsoft Dashboards.JS is a dashboards tool for Angular

138 lines (129 loc) 5.1 kB
import * as i0 from "@angular/core"; import { EventEmitter } from "@angular/core"; import { } from "./stimulsoft.reports.engine.mjs"; import { } from "./stimulsoft.reports.chart.mjs"; import { } from "./stimulsoft.reports.export.mjs"; import { } from "./stimulsoft.reports.import.xlsx.mjs"; import { } from "./stimulsoft.reports.maps.mjs"; import { } from "./stimulsoft.dashboards.mjs"; import { Stimulsoft } from "./stimulsoft.viewer.mjs"; export { Stimulsoft }; export class Viewer { #viewer; #parentRef; #createViewer() { this.#viewer = new Stimulsoft.Viewer.StiViewer(this.options, this.id, false); this.#viewer.renderHtml(this.#parentRef.nativeElement); this.#bindEvents(); this.#viewer.visible = this.visible; } #bindEvents() { if (this.#viewer) { this.#viewer.onPrepareVariables = (args) => this.onPrepareVariables.emit(args); this.#viewer.onBeginProcessData = (args) => this.onBeginProcessData.emit(args); this.#viewer.onEndProcessData = (args) => this.onEndProcessData.emit(args); this.#viewer.onPrintReport = (args) => this.onPrintReport.emit(args); this.#viewer.onBeginExportReport = (args) => this.onBeginExportReport.emit(args); this.#viewer.onEndExportReport = (args) => this.onEndExportReport.emit(args); this.#viewer.onInteraction = (args) => this.onInteraction.emit(args); this.#viewer.onEmailReport = (args) => this.onEmailReport.emit(args); this.#viewer.onDesignReport = (args) => this.onDesignReport.emit(args); this.#viewer.onShowReport = (args) => this.onShowReport.emit(args); this.#viewer.onOpenReport = (args) => { args.preventDefault = false; this.onOpenReport.emit(args); } this.#viewer.onOpenedReport = (args) => this.onOpenedReport.emit(args); } } ngAfterViewInit() { this.#createViewer(); this.#viewer.report = this.report; } ngOnChanges(changes) { for (let propName in changes) { switch (propName) { case "options": { if (this.#viewer) { this.#createViewer(); this.#viewer.report = this.report; } break; } case "report": { if (this.#viewer) this.#viewer.report = changes[propName].currentValue; break; } case "visible": { if (this.#viewer) this.#viewer.visible = changes[propName].currentValue; break; } case "id": { if (this.#viewer) { this.#createViewer(); this.#viewer.report = this.report; } break; } } } } ngOnDestroy() { if (this.#viewer != null) this.#viewer.dispose(); } report = undefined; visible = true; options = undefined; id = undefined; onPrepareVariables = new EventEmitter(); onBeginProcessData = new EventEmitter(); onEndProcessData = new EventEmitter(); onPrintReport = new EventEmitter(); onBeginExportReport = new EventEmitter(); onEndExportReport = new EventEmitter(); onInteraction = new EventEmitter(); onEmailReport = new EventEmitter(); onDesignReport = new EventEmitter(); onShowReport = new EventEmitter(); onOpenReport = new EventEmitter(); onOpenedReport = new EventEmitter(); static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: Viewer, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: Viewer, isStandalone: true, selector: "sti-viewer", inputs: { report: "report", visible: "visible", options: "options", id: "id" }, outputs: { onPrepareVariables: "onPrepareVariables", onBeginProcessData: "onBeginProcessData", onEndProcessData: "onEndProcessData", onPrintReport: "onPrintReport", onBeginExportReport: "onBeginExportReport", onEndExportReport: "onEndExportReport", onInteraction: "onInteraction", onEmailReport: "onEmailReport", onDesignReport: "onDesignReport", onShowReport: "onShowReport", onOpenReport: "onOpenReport", onOpenedReport: "onOpenedReport" }, viewQueries: [{ propertyName: "#parentRef", first: true, predicate: ["parentRef"], descendants: true }], usesOnChanges: true, template: `<div #parentRef></div>`, isInline: true }); }