@schneideress/dashboardframework 0.0.266 → 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.
@@ -432,6 +432,7 @@ var RADashboardArea = /** @class */ (function () {
432
432
  this.domResized = false;
433
433
  this.showEmptyDashboard = false;
434
434
  this.isWidgetMgmnt = false;
435
+ this.initialWidgetCount = 10;
435
436
  this.widgetHeight = 2;
436
437
  this.widgetWidth = 4;
437
438
  this.hideDashboardBanner = new EventEmitter();
@@ -628,6 +629,8 @@ var RADashboardArea = /** @class */ (function () {
628
629
  /** To retrieve widgets based on userDashboardid and area name */
629
630
  RADashboardArea.prototype.loadWidgets = function (userDashboarId, areaKey) {
630
631
  var _this = this;
632
+ if (this.templateConfig && this.templateConfig.initialWidgetCount)
633
+ this.initialWidgetCount = this.templateConfig.initialWidgetCount;
631
634
  var widgetInfo = {
632
635
  dashboardId: userDashboarId.toString(),
633
636
  dashboardAreaKey: areaKey
@@ -656,6 +659,47 @@ var RADashboardArea = /** @class */ (function () {
656
659
  }
657
660
  });
658
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
+ };
682
+ RADashboardArea.prototype.loadWidgetData = function (widget) {
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);
694
+ };
695
+ RADashboardArea.prototype.dataLoaded = function () {
696
+ for (var i = 0; i < this.widgetList.length; i++) {
697
+ if (!this.widgetList[i].dataTriggered) {
698
+ this.loadWidgetData(this.widgetList[i]);
699
+ break;
700
+ }
701
+ }
702
+ };
659
703
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
660
704
  RADashboardArea.prototype.setAreaHeight = function () {
661
705
  var _this = this;
@@ -910,6 +954,10 @@ var RADashboardArea = /** @class */ (function () {
910
954
  Input('dashboard-info'),
911
955
  __metadata("design:type", Object)
912
956
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
957
+ __decorate([
958
+ Input(),
959
+ __metadata("design:type", Object)
960
+ ], RADashboardArea.prototype, "templateConfig", void 0);
913
961
  __decorate([
914
962
  Output(),
915
963
  __metadata("design:type", Object)
@@ -921,7 +969,7 @@ var RADashboardArea = /** @class */ (function () {
921
969
  RADashboardArea = __decorate([
922
970
  Component({
923
971
  selector: 'ra-dashboard-area',
924
- 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 [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>",
925
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}}"]
926
974
  }),
927
975
  __metadata("design:paramtypes", [RaDashboardService,
@@ -1025,8 +1073,11 @@ var RAWidgetContainer = /** @class */ (function () {
1025
1073
  this.showExcell = true;
1026
1074
  this.hideTitle = false;
1027
1075
  this.inapplicableFilters = [];
1076
+ this.canLoadData = false;
1028
1077
  this.widgetDeleted = new EventEmitter();
1029
1078
  this.updateAppliedFilters = new EventEmitter();
1079
+ this.dataLoaded = new EventEmitter();
1080
+ this.widgetLoaded = new EventEmitter();
1030
1081
  this.isWidgetStateApplicable = false;
1031
1082
  this.widgetEmptyState = '';
1032
1083
  this.lockVisible = false;
@@ -1086,7 +1137,7 @@ var RAWidgetContainer = /** @class */ (function () {
1086
1137
  this.refreshWidget(this.data.widgetInfo);
1087
1138
  }
1088
1139
  else {
1089
- this.refreshWidget(this.data.widgetInfo);
1140
+ //this.refreshWidget(this.data.widgetInfo);
1090
1141
  }
1091
1142
  }
1092
1143
  }
@@ -1095,6 +1146,10 @@ var RAWidgetContainer = /** @class */ (function () {
1095
1146
  this.invokeWidgetResizedEvent();
1096
1147
  }
1097
1148
  }
1149
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1150
+ if (this.canLoadData)
1151
+ this.refreshWidget(this.data.widgetInfo);
1152
+ }
1098
1153
  };
1099
1154
  RAWidgetContainer.prototype.invokeWidgetResizedEvent = function () {
1100
1155
  if (this.widgetElement) {
@@ -1285,6 +1340,10 @@ var RAWidgetContainer = /** @class */ (function () {
1285
1340
  _this.showPanel = true;
1286
1341
  else
1287
1342
  _this.showPanel = false;
1343
+ if (!_this.data.dataLoaded) {
1344
+ _this.data.dataLoaded = true;
1345
+ _this.dataLoaded.emit();
1346
+ }
1288
1347
  break;
1289
1348
  case 'onConfigEditClicked':
1290
1349
  _this.editWidget();
@@ -1358,7 +1417,8 @@ var RAWidgetContainer = /** @class */ (function () {
1358
1417
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1359
1418
  widgetConfigFilter.globalFilter = this.globalFilter;
1360
1419
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1361
- this.widgetElement.loadContent(widgetConfigFilter);
1420
+ // this.widgetElement.loadContent(widgetConfigFilter);
1421
+ this.widgetLoaded.emit();
1362
1422
  return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
1363
1423
  case 1:
1364
1424
  _a.sent();
@@ -1836,6 +1896,10 @@ var RAWidgetContainer = /** @class */ (function () {
1836
1896
  Input('bulk-action-data'),
1837
1897
  __metadata("design:type", Object)
1838
1898
  ], RAWidgetContainer.prototype, "bulkActionData", void 0);
1899
+ __decorate([
1900
+ Input(),
1901
+ __metadata("design:type", Boolean)
1902
+ ], RAWidgetContainer.prototype, "canLoadData", void 0);
1839
1903
  __decorate([
1840
1904
  Output(),
1841
1905
  __metadata("design:type", Object)
@@ -1844,6 +1908,14 @@ var RAWidgetContainer = /** @class */ (function () {
1844
1908
  Output(),
1845
1909
  __metadata("design:type", Object)
1846
1910
  ], RAWidgetContainer.prototype, "updateAppliedFilters", void 0);
1911
+ __decorate([
1912
+ Output(),
1913
+ __metadata("design:type", Object)
1914
+ ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1915
+ __decorate([
1916
+ Output(),
1917
+ __metadata("design:type", Object)
1918
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1847
1919
  __decorate([
1848
1920
  Input('dom-resized'),
1849
1921
  __metadata("design:type", Boolean),
@@ -4842,12 +4914,13 @@ var RaBaseDashboardTemplate = /** @class */ (function () {
4842
4914
  function RaBaseDashboardTemplate(ngZone) {
4843
4915
  var _this = this;
4844
4916
  this.ngZone = ngZone;
4845
- this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo) {
4917
+ this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) {
4846
4918
  _this.ngZone.run(function () {
4847
4919
  _this.userDashboardId = userDashboardId;
4848
4920
  _this.appConfig = appConfig;
4849
4921
  _this.raDashboardEventBus = eventBus;
4850
4922
  _this.dashboardInfo = dashboardInfo;
4923
+ _this.templateConfig = templateConfig;
4851
4924
  });
4852
4925
  _this.init();
4853
4926
  };