@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.
@@ -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,26 +657,52 @@ 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
+ if (widget.dataTriggered) {
671
+ this.loadWidgetData(widget);
672
+ }
673
+ };
674
+ RADashboardArea.prototype.startLoadWidgetData = function (lst) {
675
+ if (lst) {
676
+ if (lst.length < this.initialWidgetCount) {
677
+ for (var i = 0; i < lst.length; i++)
678
+ this.loadWidgetData(lst[i]);
679
+ }
680
+ else
681
+ for (var i = 0; i < this.initialWidgetCount; i++)
682
+ this.loadWidgetData(lst[i]);
683
+ }
684
+ };
669
685
  RADashboardArea.prototype.loadWidgetData = function (widget) {
670
- widget.canLoadData = true;
686
+ widget.dataTriggered = true;
687
+ if (widget.widgetLoaded) {
688
+ widget.canLoadData = true;
689
+ }
671
690
  };
672
691
  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;
676
- break;
692
+ var _this = this;
693
+ var _loop_1 = function (i) {
694
+ if (!this_1.widgetList[i].dataTriggered) {
695
+ setTimeout(function () {
696
+ _this.loadWidgetData(_this.widgetList[i]);
697
+ });
698
+ return "break";
677
699
  }
700
+ };
701
+ var this_1 = this;
702
+ for (var i = 0; i < this.widgetList.length; i++) {
703
+ var state_1 = _loop_1(i);
704
+ if (state_1 === "break")
705
+ break;
678
706
  }
679
707
  };
680
708
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
@@ -931,6 +959,10 @@ var RADashboardArea = /** @class */ (function () {
931
959
  Input('dashboard-info'),
932
960
  __metadata("design:type", Object)
933
961
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
962
+ __decorate([
963
+ Input(),
964
+ __metadata("design:type", Object)
965
+ ], RADashboardArea.prototype, "templateConfig", void 0);
934
966
  __decorate([
935
967
  Output(),
936
968
  __metadata("design:type", Object)
@@ -942,7 +974,7 @@ var RADashboardArea = /** @class */ (function () {
942
974
  RADashboardArea = __decorate([
943
975
  Component({
944
976
  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>",
977
+ 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
978
  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
979
  }),
948
980
  __metadata("design:paramtypes", [RaDashboardService,
@@ -1050,6 +1082,7 @@ var RAWidgetContainer = /** @class */ (function () {
1050
1082
  this.widgetDeleted = new EventEmitter();
1051
1083
  this.updateAppliedFilters = new EventEmitter();
1052
1084
  this.dataLoaded = new EventEmitter();
1085
+ this.widgetLoaded = new EventEmitter();
1053
1086
  this.isWidgetStateApplicable = false;
1054
1087
  this.widgetEmptyState = '';
1055
1088
  this.lockVisible = false;
@@ -1118,7 +1151,7 @@ var RAWidgetContainer = /** @class */ (function () {
1118
1151
  this.invokeWidgetResizedEvent();
1119
1152
  }
1120
1153
  }
1121
- if (changes.canLoadData && changes.width.currentValue != changes.width.previousValue) {
1154
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1122
1155
  if (this.canLoadData)
1123
1156
  this.refreshWidget(this.data.widgetInfo);
1124
1157
  }
@@ -1389,7 +1422,8 @@ var RAWidgetContainer = /** @class */ (function () {
1389
1422
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1390
1423
  widgetConfigFilter.globalFilter = this.globalFilter;
1391
1424
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1392
- this.widgetElement.loadContent(widgetConfigFilter);
1425
+ // this.widgetElement.loadContent(widgetConfigFilter);
1426
+ this.widgetLoaded.emit();
1393
1427
  return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
1394
1428
  case 1:
1395
1429
  _a.sent();
@@ -1883,6 +1917,10 @@ var RAWidgetContainer = /** @class */ (function () {
1883
1917
  Output(),
1884
1918
  __metadata("design:type", Object)
1885
1919
  ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1920
+ __decorate([
1921
+ Output(),
1922
+ __metadata("design:type", Object)
1923
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1886
1924
  __decorate([
1887
1925
  Input('dom-resized'),
1888
1926
  __metadata("design:type", Boolean),
@@ -4881,12 +4919,13 @@ var RaBaseDashboardTemplate = /** @class */ (function () {
4881
4919
  function RaBaseDashboardTemplate(ngZone) {
4882
4920
  var _this = this;
4883
4921
  this.ngZone = ngZone;
4884
- this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo) {
4922
+ this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) {
4885
4923
  _this.ngZone.run(function () {
4886
4924
  _this.userDashboardId = userDashboardId;
4887
4925
  _this.appConfig = appConfig;
4888
4926
  _this.raDashboardEventBus = eventBus;
4889
4927
  _this.dashboardInfo = dashboardInfo;
4928
+ _this.templateConfig = templateConfig;
4890
4929
  });
4891
4930
  _this.init();
4892
4931
  };