@schneideress/dashboardframework 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -369,6 +369,7 @@ class RADashboardArea {
369
369
  this.notifier = notifier;
370
370
  this.widgetList = Array();
371
371
  this.gridheight = 300;
372
+ this.isWidgetLoaded = false;
372
373
  this.widgetHeight = 20;
373
374
  this.widgetWidth = 50;
374
375
  }
@@ -383,7 +384,8 @@ class RADashboardArea {
383
384
  * @return {?}
384
385
  */
385
386
  ngOnChanges(changes) {
386
- if (this.globalFilter && this.raDashboardEventBus && this.appConfig) {
387
+ if (this.raDashboardEventBus && this.appConfig && !this.isWidgetLoaded) {
388
+ this.isWidgetLoaded = true;
387
389
  this.loadWidgets(this.userDashboardId, this.areaKey);
388
390
  }
389
391
  if (changes.raDashboardEventBus && changes.raDashboardEventBus.currentValue != changes.raDashboardEventBus.previousValue) {
@@ -474,10 +476,14 @@ class RADashboardArea {
474
476
  * @return {?}
475
477
  */
476
478
  ngOnDestroy() {
477
- this.conifgAddClick.unsubscribe();
478
- this.widgetAddEvent.unsubscribe();
479
- this.widgetDeleteEvent.unsubscribe();
480
- this.widgetLibraryDoneClick.unsubscribe();
479
+ if (this.conifgAddClick)
480
+ this.conifgAddClick.unsubscribe();
481
+ if (this.widgetAddEvent)
482
+ this.widgetAddEvent.unsubscribe();
483
+ if (this.widgetDeleteEvent)
484
+ this.widgetDeleteEvent.unsubscribe();
485
+ if (this.widgetLibraryDoneClick)
486
+ this.widgetLibraryDoneClick.unsubscribe();
481
487
  }
482
488
  /**
483
489
  * To update position/dimention of all widgets in the area
@@ -756,7 +762,8 @@ class RAWidgetContainer {
756
762
  * @return {?}
757
763
  */
758
764
  ngOnDestroy() {
759
- this.configChanged.unsubscribe();
765
+ if (this.configChanged)
766
+ this.configChanged.unsubscribe();
760
767
  }
761
768
  /**
762
769
  * To Edit current widget configuration
@@ -836,9 +843,9 @@ class RAWidgetContainer {
836
843
  * @return {?}
837
844
  */
838
845
  () => {
839
- this.widgetElement = document.createElement(widgetInfo.customTag);
840
- this.ctlWidget.nativeElement.appendChild(this.widgetElement);
841
- setTimeout((/**
846
+ widgetContainer.widgetElement = document.createElement(widgetInfo.customTag);
847
+ widgetContainer.widgetElement.setAttribute("widget-instance-id", widgetInfo.widgetInstanceId);
848
+ document.body.addEventListener('widgetinitiated' + widgetInfo.widgetInstanceId, (/**
842
849
  * @return {?}
843
850
  */
844
851
  () => {
@@ -846,13 +853,8 @@ class RAWidgetContainer {
846
853
  widgetConfigFilter.widgetInfo = (/** @type {?} */ ({}));
847
854
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
848
855
  widgetContainer.widgetElement.loadContent(widgetConfigFilter);
849
- widgetContainer.widgetElement.addEventListener('load-data-initiated', (/**
850
- * @param {?} hidePanel
851
- * @return {?}
852
- */
853
- (hidePanel) => {
854
- }));
855
- }), 2000);
856
+ }));
857
+ this.ctlWidget.nativeElement.appendChild(this.widgetElement);
856
858
  }));
857
859
  }
858
860
  /**
@@ -861,13 +863,15 @@ class RAWidgetContainer {
861
863
  * @return {?}
862
864
  */
863
865
  refreshWidget(widgetInfo) {
866
+ /** @type {?} */
867
+ let widgetContainerContext = this;
864
868
  /** @type {?} */
865
869
  let widgetConfigFilter = (/** @type {?} */ ({
866
870
  config: widgetInfo.widgetConfigInfo.config,
867
871
  globalFilter: this.globalFilter,
868
872
  appConfig: this.appConfig
869
873
  }));
870
- this.widgetElement.loadContent(widgetConfigFilter);
874
+ widgetContainerContext.widgetElement.loadContent(widgetConfigFilter);
871
875
  }
872
876
  }
873
877
  RAWidgetContainer.decorators = [