Icard/angular-clarity-master(work.../node_modules/highcharts-angular/esm2020/lib/highcharts-chart.component.mjs

74 lines
8.4 KiB
JavaScript

import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
export class HighchartsChartComponent {
constructor(el, _zone // #75
) {
this.el = el;
this._zone = _zone;
this.updateChange = new EventEmitter(true);
this.chartInstance = new EventEmitter(); // #26
}
ngOnChanges(changes) {
const update = changes.update && changes.update.currentValue;
if (changes.options || update) {
this.wrappedUpdateOrCreateChart();
if (update) {
this.updateChange.emit(false); // clear the flag after update
}
}
}
wrappedUpdateOrCreateChart() {
if (this.runOutsideAngular) {
this._zone.runOutsideAngular(() => {
this.updateOrCreateChart();
});
}
else {
this.updateOrCreateChart();
}
}
updateOrCreateChart() {
if (this.chart && this.chart.update) {
this.chart.update(this.options, true, this.oneToOne || false);
}
else {
this.chart = this.Highcharts[this.constructorType || 'chart'](this.el.nativeElement, this.options, this.callbackFunction || null);
// emit chart instance on init
this.chartInstance.emit(this.chart);
}
}
ngOnDestroy() {
if (this.chart) { // #56
this.chart.destroy();
this.chart = null;
}
}
}
HighchartsChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: HighchartsChartComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
HighchartsChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: HighchartsChartComponent, selector: "highcharts-chart", inputs: { Highcharts: "Highcharts", constructorType: "constructorType", callbackFunction: "callbackFunction", oneToOne: "oneToOne", runOutsideAngular: "runOutsideAngular", options: "options", update: "update" }, outputs: { updateChange: "updateChange", chartInstance: "chartInstance" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: HighchartsChartComponent, decorators: [{
type: Component,
args: [{
selector: 'highcharts-chart',
template: ''
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { Highcharts: [{
type: Input
}], constructorType: [{
type: Input
}], callbackFunction: [{
type: Input
}], oneToOne: [{
type: Input
}], runOutsideAngular: [{
type: Input
}], options: [{
type: Input
}], update: [{
type: Input
}], updateChange: [{
type: Output
}], chartInstance: [{
type: Output
}] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGlnaGNoYXJ0cy1jaGFydC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9oaWdoY2hhcnRzLWFuZ3VsYXIvc3JjL2xpYi9oaWdoY2hhcnRzLWNoYXJ0LmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFjLFlBQVksRUFBRSxLQUFLLEVBQWEsTUFBTSxFQUFvQyxNQUFNLGVBQWUsQ0FBQzs7QUFRaEksTUFBTSxPQUFPLHdCQUF3QjtJQWNuQyxZQUNVLEVBQWMsRUFDZCxLQUFhLENBQUMsTUFBTTs7UUFEcEIsT0FBRSxHQUFGLEVBQUUsQ0FBWTtRQUNkLFVBQUssR0FBTCxLQUFLLENBQVE7UUFQYixpQkFBWSxHQUFHLElBQUksWUFBWSxDQUFVLElBQUksQ0FBQyxDQUFDO1FBQy9DLGtCQUFhLEdBQUcsSUFBSSxZQUFZLEVBQW9CLENBQUMsQ0FBQyxNQUFNO0lBT25FLENBQUM7SUFFSixXQUFXLENBQUMsT0FBc0I7UUFDaEMsTUFBTSxNQUFNLEdBQUcsT0FBTyxDQUFDLE1BQU0sSUFBSSxPQUFPLENBQUMsTUFBTSxDQUFDLFlBQVksQ0FBQztRQUM3RCxJQUFJLE9BQU8sQ0FBQyxPQUFPLElBQUksTUFBTSxFQUFFO1lBQzdCLElBQUksQ0FBQywwQkFBMEIsRUFBR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