@schneideress/dashboardframework 0.0.267 → 0.0.268

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,44 @@ 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
+ }
652
+ startLoadWidgetData(lst) {
653
+ if (lst) {
654
+ if (lst.length < this.initialWidgetCount) {
655
+ for (let i = 0; i < lst.length; i++)
656
+ this.loadWidgetData(lst[i]);
657
+ }
658
+ else
659
+ for (let i = 0; i < this.initialWidgetCount; i++)
660
+ this.loadWidgetData(lst[i]);
661
+ }
662
+ }
650
663
  loadWidgetData(widget) {
651
- widget.canLoadData = true;
664
+ widget.dataTriggered = true;
665
+ if (widget.widgetLoaded) {
666
+ setTimeout(() => {
667
+ widget.canLoadData = true;
668
+ });
669
+ }
670
+ else
671
+ setTimeout(() => {
672
+ this.loadWidgetData(widget);
673
+ }, 1000);
652
674
  }
653
675
  dataLoaded() {
654
- for (let i = this.initialWidgetCount; i < this.widgetList.length; i++) {
655
- if (!this.widgetList[i].canLoadData) {
656
- this.widgetList[i].canLoadData = true;
676
+ for (let i = 0; i < this.widgetList.length; i++) {
677
+ if (!this.widgetList[i].dataTriggered) {
678
+ this.loadWidgetData(this.widgetList[i]);
657
679
  break;
658
680
  }
659
681
  }
@@ -907,6 +929,10 @@ __decorate([
907
929
  Input('dashboard-info'),
908
930
  __metadata("design:type", Object)
909
931
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
932
+ __decorate([
933
+ Input(),
934
+ __metadata("design:type", Object)
935
+ ], RADashboardArea.prototype, "templateConfig", void 0);
910
936
  __decorate([
911
937
  Output(),
912
938
  __metadata("design:type", Object)
@@ -918,7 +944,7 @@ __decorate([
918
944
  RADashboardArea = __decorate([
919
945
  Component({
920
946
  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>",
947
+ 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
948
  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
949
  }),
924
950
  __metadata("design:paramtypes", [RaDashboardService,
@@ -1021,6 +1047,7 @@ let RAWidgetContainer = class RAWidgetContainer {
1021
1047
  this.widgetDeleted = new EventEmitter();
1022
1048
  this.updateAppliedFilters = new EventEmitter();
1023
1049
  this.dataLoaded = new EventEmitter();
1050
+ this.widgetLoaded = new EventEmitter();
1024
1051
  this.isWidgetStateApplicable = false;
1025
1052
  this.widgetEmptyState = '';
1026
1053
  this.lockVisible = false;
@@ -1080,7 +1107,7 @@ let RAWidgetContainer = class RAWidgetContainer {
1080
1107
  this.invokeWidgetResizedEvent();
1081
1108
  }
1082
1109
  }
1083
- if (changes.canLoadData && changes.width.currentValue != changes.width.previousValue) {
1110
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1084
1111
  if (this.canLoadData)
1085
1112
  this.refreshWidget(this.data.widgetInfo);
1086
1113
  }
@@ -1338,7 +1365,8 @@ let RAWidgetContainer = class RAWidgetContainer {
1338
1365
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1339
1366
  widgetConfigFilter.globalFilter = this.globalFilter;
1340
1367
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1341
- this.widgetElement.loadContent(widgetConfigFilter);
1368
+ // this.widgetElement.loadContent(widgetConfigFilter);
1369
+ this.widgetLoaded.emit();
1342
1370
  yield this.setLock(widgetConfigFilter.config);
1343
1371
  yield this.setDownloadIcon();
1344
1372
  }));
@@ -1795,6 +1823,10 @@ __decorate([
1795
1823
  Output(),
1796
1824
  __metadata("design:type", Object)
1797
1825
  ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1826
+ __decorate([
1827
+ Output(),
1828
+ __metadata("design:type", Object)
1829
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1798
1830
  __decorate([
1799
1831
  Input('dom-resized'),
1800
1832
  __metadata("design:type", Boolean),
@@ -4750,12 +4782,13 @@ DashboardFrameworkModule = __decorate([
4750
4782
  class RaBaseDashboardTemplate {
4751
4783
  constructor(ngZone) {
4752
4784
  this.ngZone = ngZone;
4753
- this.initialize = (eventBus, userDashboardId, appConfig, dashboardInfo) => {
4785
+ this.initialize = (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) => {
4754
4786
  this.ngZone.run(() => {
4755
4787
  this.userDashboardId = userDashboardId;
4756
4788
  this.appConfig = appConfig;
4757
4789
  this.raDashboardEventBus = eventBus;
4758
4790
  this.dashboardInfo = dashboardInfo;
4791
+ this.templateConfig = templateConfig;
4759
4792
  });
4760
4793
  this.init();
4761
4794
  };