@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.
@@ -629,6 +629,8 @@ var RADashboardArea = /** @class */ (function () {
629
629
  /** To retrieve widgets based on userDashboardid and area name */
630
630
  RADashboardArea.prototype.loadWidgets = function (userDashboarId, areaKey) {
631
631
  var _this = this;
632
+ if (this.templateConfig && this.templateConfig.initialWidgetCount)
633
+ this.initialWidgetCount = this.templateConfig.initialWidgetCount;
632
634
  var widgetInfo = {
633
635
  dashboardId: userDashboarId.toString(),
634
636
  dashboardAreaKey: areaKey
@@ -655,24 +657,45 @@ var RADashboardArea = /** @class */ (function () {
655
657
  _this.showEmptyDashboard = true;
656
658
  _this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, _this.showEmptyDashboard);
657
659
  }
658
- if (_this.widgetList) {
659
- if (_this.widgetList.length < _this.initialWidgetCount) {
660
- for (var i = 0; i < _this.widgetList.length; i++)
661
- _this.loadWidgetData(_this.widgetList[i]);
662
- }
663
- else
664
- for (var i = 0; i < _this.initialWidgetCount; i++)
665
- _this.loadWidgetData(_this.widgetList[i]);
666
- }
667
660
  });
668
661
  };
662
+ RADashboardArea.prototype.widgetLoaded = function (widget) {
663
+ var lst = this.widgetList.filter(function (item) {
664
+ return item.widgetLoaded == true;
665
+ });
666
+ widget.widgetLoaded = true;
667
+ if (lst.length == 0) {
668
+ this.startLoadWidgetData(this.widgetList);
669
+ }
670
+ };
671
+ RADashboardArea.prototype.startLoadWidgetData = function (lst) {
672
+ if (lst) {
673
+ if (lst.length < this.initialWidgetCount) {
674
+ for (var i = 0; i < lst.length; i++)
675
+ this.loadWidgetData(lst[i]);
676
+ }
677
+ else
678
+ for (var i = 0; i < this.initialWidgetCount; i++)
679
+ this.loadWidgetData(lst[i]);
680
+ }
681
+ };
669
682
  RADashboardArea.prototype.loadWidgetData = function (widget) {
670
- widget.canLoadData = true;
683
+ var _this = this;
684
+ widget.dataTriggered = true;
685
+ if (widget.widgetLoaded) {
686
+ setTimeout(function () {
687
+ widget.canLoadData = true;
688
+ });
689
+ }
690
+ else
691
+ setTimeout(function () {
692
+ _this.loadWidgetData(widget);
693
+ }, 1000);
671
694
  };
672
695
  RADashboardArea.prototype.dataLoaded = function () {
673
- for (var i = this.initialWidgetCount; i < this.widgetList.length; i++) {
674
- if (!this.widgetList[i].canLoadData) {
675
- this.widgetList[i].canLoadData = true;
696
+ for (var i = 0; i < this.widgetList.length; i++) {
697
+ if (!this.widgetList[i].dataTriggered) {
698
+ this.loadWidgetData(this.widgetList[i]);
676
699
  break;
677
700
  }
678
701
  }
@@ -931,6 +954,10 @@ var RADashboardArea = /** @class */ (function () {
931
954
  Input('dashboard-info'),
932
955
  __metadata("design:type", Object)
933
956
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
957
+ __decorate([
958
+ Input(),
959
+ __metadata("design:type", Object)
960
+ ], RADashboardArea.prototype, "templateConfig", void 0);
934
961
  __decorate([
935
962
  Output(),
936
963
  __metadata("design:type", Object)
@@ -942,7 +969,7 @@ var RADashboardArea = /** @class */ (function () {
942
969
  RADashboardArea = __decorate([
943
970
  Component({
944
971
  selector: 'ra-dashboard-area',
945
- 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>",
972
+ 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>",
946
973
  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}}"]
947
974
  }),
948
975
  __metadata("design:paramtypes", [RaDashboardService,
@@ -1050,6 +1077,7 @@ var RAWidgetContainer = /** @class */ (function () {
1050
1077
  this.widgetDeleted = new EventEmitter();
1051
1078
  this.updateAppliedFilters = new EventEmitter();
1052
1079
  this.dataLoaded = new EventEmitter();
1080
+ this.widgetLoaded = new EventEmitter();
1053
1081
  this.isWidgetStateApplicable = false;
1054
1082
  this.widgetEmptyState = '';
1055
1083
  this.lockVisible = false;
@@ -1118,7 +1146,7 @@ var RAWidgetContainer = /** @class */ (function () {
1118
1146
  this.invokeWidgetResizedEvent();
1119
1147
  }
1120
1148
  }
1121
- if (changes.canLoadData && changes.width.currentValue != changes.width.previousValue) {
1149
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1122
1150
  if (this.canLoadData)
1123
1151
  this.refreshWidget(this.data.widgetInfo);
1124
1152
  }
@@ -1389,7 +1417,8 @@ var RAWidgetContainer = /** @class */ (function () {
1389
1417
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1390
1418
  widgetConfigFilter.globalFilter = this.globalFilter;
1391
1419
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1392
- this.widgetElement.loadContent(widgetConfigFilter);
1420
+ // this.widgetElement.loadContent(widgetConfigFilter);
1421
+ this.widgetLoaded.emit();
1393
1422
  return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
1394
1423
  case 1:
1395
1424
  _a.sent();
@@ -1883,6 +1912,10 @@ var RAWidgetContainer = /** @class */ (function () {
1883
1912
  Output(),
1884
1913
  __metadata("design:type", Object)
1885
1914
  ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1915
+ __decorate([
1916
+ Output(),
1917
+ __metadata("design:type", Object)
1918
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1886
1919
  __decorate([
1887
1920
  Input('dom-resized'),
1888
1921
  __metadata("design:type", Boolean),
@@ -4881,12 +4914,13 @@ var RaBaseDashboardTemplate = /** @class */ (function () {
4881
4914
  function RaBaseDashboardTemplate(ngZone) {
4882
4915
  var _this = this;
4883
4916
  this.ngZone = ngZone;
4884
- this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo) {
4917
+ this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) {
4885
4918
  _this.ngZone.run(function () {
4886
4919
  _this.userDashboardId = userDashboardId;
4887
4920
  _this.appConfig = appConfig;
4888
4921
  _this.raDashboardEventBus = eventBus;
4889
4922
  _this.dashboardInfo = dashboardInfo;
4923
+ _this.templateConfig = templateConfig;
4890
4924
  });
4891
4925
  _this.init();
4892
4926
  };