@schneideress/dashboardframework 0.0.267 → 0.0.269

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.
@@ -610,6 +610,8 @@ let RADashboardArea = class RADashboardArea {
610
610
  }
611
611
  /** To retrieve widgets based on userDashboardid and area name */
612
612
  loadWidgets(userDashboarId, areaKey) {
613
+ if (this.templateConfig && this.templateConfig.initialWidgetCount)
614
+ this.initialWidgetCount = this.templateConfig.initialWidgetCount;
613
615
  let widgetInfo = {
614
616
  dashboardId: userDashboarId.toString(),
615
617
  dashboardAreaKey: areaKey
@@ -636,24 +638,43 @@ let RADashboardArea = class RADashboardArea {
636
638
  this.showEmptyDashboard = true;
637
639
  this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, this.showEmptyDashboard);
638
640
  }
639
- if (this.widgetList) {
640
- if (this.widgetList.length < this.initialWidgetCount) {
641
- for (let i = 0; i < this.widgetList.length; i++)
642
- this.loadWidgetData(this.widgetList[i]);
643
- }
644
- else
645
- for (let i = 0; i < this.initialWidgetCount; i++)
646
- this.loadWidgetData(this.widgetList[i]);
647
- }
648
641
  });
649
642
  }
643
+ widgetLoaded(widget) {
644
+ let lst = this.widgetList.filter((item) => {
645
+ return item.widgetLoaded == true;
646
+ });
647
+ widget.widgetLoaded = true;
648
+ if (lst.length == 0) {
649
+ this.startLoadWidgetData(this.widgetList);
650
+ }
651
+ if (widget.dataTriggered) {
652
+ this.loadWidgetData(widget);
653
+ }
654
+ }
655
+ startLoadWidgetData(lst) {
656
+ if (lst) {
657
+ if (lst.length < this.initialWidgetCount) {
658
+ for (let i = 0; i < lst.length; i++)
659
+ this.loadWidgetData(lst[i]);
660
+ }
661
+ else
662
+ for (let i = 0; i < this.initialWidgetCount; i++)
663
+ this.loadWidgetData(lst[i]);
664
+ }
665
+ }
650
666
  loadWidgetData(widget) {
651
- widget.canLoadData = true;
667
+ widget.dataTriggered = true;
668
+ if (widget.widgetLoaded) {
669
+ widget.canLoadData = true;
670
+ }
652
671
  }
653
672
  dataLoaded() {
654
- for (let i = this.initialWidgetCount; i < this.widgetList.length; i++) {
655
- if (!this.widgetList[i].canLoadData) {
656
- this.widgetList[i].canLoadData = true;
673
+ for (let i = 0; i < this.widgetList.length; i++) {
674
+ if (!this.widgetList[i].dataTriggered) {
675
+ setTimeout(() => {
676
+ this.loadWidgetData(this.widgetList[i]);
677
+ });
657
678
  break;
658
679
  }
659
680
  }
@@ -907,6 +928,10 @@ __decorate([
907
928
  Input('dashboard-info'),
908
929
  __metadata("design:type", Object)
909
930
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
931
+ __decorate([
932
+ Input(),
933
+ __metadata("design:type", Object)
934
+ ], RADashboardArea.prototype, "templateConfig", void 0);
910
935
  __decorate([
911
936
  Output(),
912
937
  __metadata("design:type", Object)
@@ -918,7 +943,7 @@ __decorate([
918
943
  RADashboardArea = __decorate([
919
944
  Component({
920
945
  selector: 'ra-dashboard-area',
921
- template: "<div #gridWrapper class=\"wrap gridster gridster-mobile\" [ngStyle]=\"{'height': userWidgets.length > 0 ? (gridheight + 'px') : 'unset'}\">\r\n <!-- <div #gridWrapper class=\"wrap gridster\"> -->\r\n <gridster [options]=\"options\" style=\"height:100%;\" *ngIf=\"userWidgets.length > 0\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetList\">\r\n <ra-widget-container (dataLoaded)=\"dataLoaded()\" [canLoadData]=\"item.canLoadData\" [bulk-action-data]=\"bulkActionData\" [dashboard-info]=\"dashboardInfo\" [app-config]=\"appConfig\" [event-bus]=\"raDashboardEventBus\"\r\n (widgetDeleted)=\"deleteWidget($event)\" [data]=\"item\" [global-filter]=\"globalFilter\"\r\n [grid-cell-height]=\"gridcellHeight\" *ngIf=\"gridcellHeight && gridcellHeight > 0\" [widget-width]=\"item.cols\"\r\n [widget-height]=\"item.rows\" [widget-instance-id]=\"item.widgetInstanceId\" [dom-resized]=\"domResized\"\r\n (updateAppliedFilters)=\"updateAppliedFilters($event)\">\r\n </ra-widget-container>\r\n </gridster-item>\r\n </gridster>\r\n\r\n <div class=\"empty-padding kiosk-hide\" *ngIf=\"showEmptyDashboard\">\r\n <div class=\"empty-wrapper\">\r\n <div></div>\r\n <div class=\"empty-prefix\">\r\n <!-- <i class=\"fal fa-edit edit-icon\"></i> -->\r\n <span>{{emptyDashboardTitle}}</span>\r\n </div>\r\n <hr class=\"horizontalLine-solid\" />\r\n <div class=\"empty-content light\">\r\n <div>\r\n <div class=\"col-sm-12 empty-msg\">\r\n {{emptyDashboardMsg1}} <br />\r\n {{emptyDashboardMsg2}}\r\n </div>\r\n <button *ngIf=\"isWidgetMgmnt\" class=\"btn btnLib btn-sm dashboard-button light\" (click)=\"buttonClick()\">\r\n <i class=\"{{emptyDashboardButtonIcon}}\"></i>{{emptyDashboardButtonText}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <notifier-container></notifier-container>\r\n</div>",
946
+ template: "<div #gridWrapper class=\"wrap gridster gridster-mobile\" [ngStyle]=\"{'height': userWidgets.length > 0 ? (gridheight + 'px') : 'unset'}\">\r\n <!-- <div #gridWrapper class=\"wrap gridster\"> -->\r\n <gridster [options]=\"options\" style=\"height:100%;\" *ngIf=\"userWidgets.length > 0\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetList\">\r\n <ra-widget-container (widgetLoaded)=\"widgetLoaded(item)\" (dataLoaded)=\"dataLoaded()\" [canLoadData]=\"item.canLoadData\" [bulk-action-data]=\"bulkActionData\" [dashboard-info]=\"dashboardInfo\" [app-config]=\"appConfig\" [event-bus]=\"raDashboardEventBus\"\r\n (widgetDeleted)=\"deleteWidget($event)\" [data]=\"item\" [global-filter]=\"globalFilter\"\r\n [grid-cell-height]=\"gridcellHeight\" *ngIf=\"gridcellHeight && gridcellHeight > 0\" [widget-width]=\"item.cols\"\r\n [widget-height]=\"item.rows\" [widget-instance-id]=\"item.widgetInstanceId\" [dom-resized]=\"domResized\"\r\n (updateAppliedFilters)=\"updateAppliedFilters($event)\">\r\n </ra-widget-container>\r\n </gridster-item>\r\n </gridster>\r\n\r\n <div class=\"empty-padding kiosk-hide\" *ngIf=\"showEmptyDashboard\">\r\n <div class=\"empty-wrapper\">\r\n <div></div>\r\n <div class=\"empty-prefix\">\r\n <!-- <i class=\"fal fa-edit edit-icon\"></i> -->\r\n <span>{{emptyDashboardTitle}}</span>\r\n </div>\r\n <hr class=\"horizontalLine-solid\" />\r\n <div class=\"empty-content light\">\r\n <div>\r\n <div class=\"col-sm-12 empty-msg\">\r\n {{emptyDashboardMsg1}} <br />\r\n {{emptyDashboardMsg2}}\r\n </div>\r\n <button *ngIf=\"isWidgetMgmnt\" class=\"btn btnLib btn-sm dashboard-button light\" (click)=\"buttonClick()\">\r\n <i class=\"{{emptyDashboardButtonIcon}}\"></i>{{emptyDashboardButtonText}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <notifier-container></notifier-container>\r\n</div>",
922
947
  styles: ["gridster{width:inherit;resize:height;display:flex;background-color:#fff;overflow-y:hidden!important}.dvheader{width:100%;height:35px;background:#000;color:#fff;padding:7px 3px 5px 6px;text-transform:uppercase}gridster-item{box-sizing:border-box;z-index:1;position:absolute;overflow:hidden;transition:.3s;display:none;background:#fff;-webkit-user-select:text;-moz-user-select:text;user-select:text;box-shadow:none}gridster-item:hover{box-shadow:0 1px 10px rgba(0,0,0,.15)!important}@media screen and (max-width:685px){.gridster-mobile{height:auto!important;margin-bottom:50px!important}}@media screen and (max-width:350px){.gridster-mobile{min-height:330px!important;margin-bottom:0!important}}.empty-padding{padding:15px 0;background-color:#fff;display:flex}.empty-wrapper{background-color:#fff;border:1px solid #9fa0a4;min-height:125px;width:100%}.empty-prefix{color:#32ad3c;font-size:18px;padding:15px}.empty-content{color:#626469;width:100%;padding:15px}.empty-msg{padding:0 0 15px;font-size:16px}.horizontalLine-solid{border-top:1px solid #cbcbcb;margin:0 15px}.dashboard-button{padding:5px 10px 5px 5px!important}.btnLib{background-color:#ededed;color:#333!important}.btn-group-sm>.btn,.btn-sm{padding:5px 20px 5px 5px}.edit-icon{color:#32ad3c;font-size:24px;margin-right:15px}.empty-title{margin-top:10px}@media screen and (max-width:600px){.empty-padding{padding:15px 0;background-color:#fff;width:100%;display:block}.empty-wrapper{display:flex;background-color:#fff;border:1px solid #9fa0a4;min-height:125px;width:100%}.empty-prefix{color:#32ad3c;font-size:16px;display:flex;height:40px;padding:15px}.empty-content{color:#333;display:flex;padding:15px}.empty-msg{padding:0 0 15px;font-size:14px}.edit-icon{color:#32ad3c;font-size:20px;margin-right:6px}.empty-title{margin-top:6px}}"]
923
948
  }),
924
949
  __metadata("design:paramtypes", [RaDashboardService,
@@ -1021,6 +1046,7 @@ let RAWidgetContainer = class RAWidgetContainer {
1021
1046
  this.widgetDeleted = new EventEmitter();
1022
1047
  this.updateAppliedFilters = new EventEmitter();
1023
1048
  this.dataLoaded = new EventEmitter();
1049
+ this.widgetLoaded = new EventEmitter();
1024
1050
  this.isWidgetStateApplicable = false;
1025
1051
  this.widgetEmptyState = '';
1026
1052
  this.lockVisible = false;
@@ -1080,7 +1106,7 @@ let RAWidgetContainer = class RAWidgetContainer {
1080
1106
  this.invokeWidgetResizedEvent();
1081
1107
  }
1082
1108
  }
1083
- if (changes.canLoadData && changes.width.currentValue != changes.width.previousValue) {
1109
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1084
1110
  if (this.canLoadData)
1085
1111
  this.refreshWidget(this.data.widgetInfo);
1086
1112
  }
@@ -1338,7 +1364,8 @@ let RAWidgetContainer = class RAWidgetContainer {
1338
1364
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1339
1365
  widgetConfigFilter.globalFilter = this.globalFilter;
1340
1366
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1341
- this.widgetElement.loadContent(widgetConfigFilter);
1367
+ // this.widgetElement.loadContent(widgetConfigFilter);
1368
+ this.widgetLoaded.emit();
1342
1369
  yield this.setLock(widgetConfigFilter.config);
1343
1370
  yield this.setDownloadIcon();
1344
1371
  }));
@@ -1795,6 +1822,10 @@ __decorate([
1795
1822
  Output(),
1796
1823
  __metadata("design:type", Object)
1797
1824
  ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1825
+ __decorate([
1826
+ Output(),
1827
+ __metadata("design:type", Object)
1828
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1798
1829
  __decorate([
1799
1830
  Input('dom-resized'),
1800
1831
  __metadata("design:type", Boolean),
@@ -4750,12 +4781,13 @@ DashboardFrameworkModule = __decorate([
4750
4781
  class RaBaseDashboardTemplate {
4751
4782
  constructor(ngZone) {
4752
4783
  this.ngZone = ngZone;
4753
- this.initialize = (eventBus, userDashboardId, appConfig, dashboardInfo) => {
4784
+ this.initialize = (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) => {
4754
4785
  this.ngZone.run(() => {
4755
4786
  this.userDashboardId = userDashboardId;
4756
4787
  this.appConfig = appConfig;
4757
4788
  this.raDashboardEventBus = eventBus;
4758
4789
  this.dashboardInfo = dashboardInfo;
4790
+ this.templateConfig = templateConfig;
4759
4791
  });
4760
4792
  this.init();
4761
4793
  };