{"version":3,"file":"nativescript-ui-charts-angular.mjs","sources":["../../../../../packages/ui-charts/angular/chart.directive.ts","../../../../../packages/ui-charts/angular/index.ts","../../../../../packages/ui-charts/angular/nativescript-ui-charts-angular.ts"],"sourcesContent":["import { Directive, ElementRef, Inject, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';\nimport { EventData } from '@nativescript/core';\nimport { UIChartsView } from '@nativescript/ui-charts';\n\n@Directive({\n  // tslint:disable-next-line: directive-selector\n  selector: 'UIChartsView',\n})\nexport class UIChartsViewDirective implements OnChanges, OnDestroy {\n  private _uiChartsView: UIChartsView = null;\n  private _chartViewLoaded = false;\n\n  @Input() options: any = null;\n  @Input() langOptions: any = null;\n  @Input() updateChartContent = false;\n  //////////////////////////////////////////////////////////////////////////////////////////////////\n  constructor(@Inject(ElementRef) _elementRef: ElementRef) {\n    this._uiChartsView = _elementRef.nativeElement;\n    this._uiChartsView.on('loaded', this.onChartViewLoaded, this);\n  }\n  //////////////////////////////////////////////////////////////////////////////////////////////////\n  public ngOnDestroy() {\n    this._uiChartsView.off('loaded', this.onChartViewLoaded, this);\n  }\n  //////////////////////////////////////////////////////////////////////////////////////////////////\n  onChartViewLoaded(args: EventData) {\n    this.setChartViewOptions();\n    this._chartViewLoaded = true;\n  }\n  //////////////////////////////////////////////////////////////////////////////////////////////////\n  ngOnChanges(changes: SimpleChanges) {\n    for (const propName in changes) {\n      if (changes.hasOwnProperty(propName)) {\n        switch (propName) {\n          case 'options':\n            if (changes.options.currentValue) {\n              this.options = changes.options.currentValue;\n              if (this._chartViewLoaded) {\n                this.setChartViewOptions();\n              }\n            }\n            break;\n          case 'langOptions':\n            if (changes.langOptions.currentValue) {\n              this.langOptions = changes.langOptions.currentValue;\n              if (this._chartViewLoaded) {\n                this._uiChartsView.setLangOptions(this.langOptions);\n              }\n            }\n            break;\n          case 'updateChartContent':\n            if (changes.updateChartContent) {\n              this.updateChartContent = changes.updateChartContent.currentValue === 'true';\n            }\n            break;\n        }\n      }\n    }\n  }\n  //////////////////////////////////////////////////////////////////////////////////////////////////\n  private setChartViewOptions() {\n    if (this.options !== null && this.options !== undefined) {\n      if (!(<any>this._uiChartsView)._chartInitialized) {\n        this._uiChartsView.setOptions(this.options);\n      } else {\n        if (this.updateChartContent) {\n          this._uiChartsView.updateOptions(this.options);\n        } else {\n          this._uiChartsView.setOptions(this.options);\n        }\n      }\n    }\n  }\n}\n","import { NgModule } from '@angular/core';\nimport { registerElement } from '@nativescript/angular';\nimport { UIChartsView } from '@nativescript/ui-charts';\nimport { UIChartsViewDirective } from './chart.directive';\n\nexport * from './chart.directive';\n\n@NgModule({\n  declarations: [UIChartsViewDirective],\n  exports: [UIChartsViewDirective],\n})\nexport class UIChartsViewModule {}\n\nregisterElement('UIChartsView', () => UIChartsView);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAQa,qBAAqB,CAAA;IACxB,aAAa,GAAiB,IAAI,CAAC;IACnC,gBAAgB,GAAG,KAAK,CAAC;IAExB,OAAO,GAAQ,IAAI,CAAC;IACpB,WAAW,GAAQ,IAAI,CAAC;IACxB,kBAAkB,GAAG,KAAK,CAAC;;AAEpC,IAAA,WAAA,CAAgC,WAAuB,EAAA;AACrD,QAAA,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC;AAC/C,QAAA,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;KAC/D;;IAEM,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;KAChE;;AAED,IAAA,iBAAiB,CAAC,IAAe,EAAA;QAC/B,IAAI,CAAC,mBAAmB,EAAE,CAAC;AAC3B,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;KAC9B;;AAED,IAAA,WA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