@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.
@@ -840,6 +840,8 @@
840
840
  /** To retrieve widgets based on userDashboardid and area name */
841
841
  RADashboardArea.prototype.loadWidgets = function (userDashboarId, areaKey) {
842
842
  var _this = this;
843
+ if (this.templateConfig && this.templateConfig.initialWidgetCount)
844
+ this.initialWidgetCount = this.templateConfig.initialWidgetCount;
843
845
  var widgetInfo = {
844
846
  dashboardId: userDashboarId.toString(),
845
847
  dashboardAreaKey: areaKey
@@ -866,26 +868,52 @@
866
868
  _this.showEmptyDashboard = true;
867
869
  _this.raDashboardEventBus.publish(exports.RAEvent.HideDashboardBanner, _this.showEmptyDashboard);
868
870
  }
869
- if (_this.widgetList) {
870
- if (_this.widgetList.length < _this.initialWidgetCount) {
871
- for (var i = 0; i < _this.widgetList.length; i++)
872
- _this.loadWidgetData(_this.widgetList[i]);
873
- }
874
- else
875
- for (var i = 0; i < _this.initialWidgetCount; i++)
876
- _this.loadWidgetData(_this.widgetList[i]);
877
- }
878
871
  });
879
872
  };
873
+ RADashboardArea.prototype.widgetLoaded = function (widget) {
874
+ var lst = this.widgetList.filter(function (item) {
875
+ return item.widgetLoaded == true;
876
+ });
877
+ widget.widgetLoaded = true;
878
+ if (lst.length == 0) {
879
+ this.startLoadWidgetData(this.widgetList);
880
+ }
881
+ if (widget.dataTriggered) {
882
+ this.loadWidgetData(widget);
883
+ }
884
+ };
885
+ RADashboardArea.prototype.startLoadWidgetData = function (lst) {
886
+ if (lst) {
887
+ if (lst.length < this.initialWidgetCount) {
888
+ for (var i = 0; i < lst.length; i++)
889
+ this.loadWidgetData(lst[i]);
890
+ }
891
+ else
892
+ for (var i = 0; i < this.initialWidgetCount; i++)
893
+ this.loadWidgetData(lst[i]);
894
+ }
895
+ };
880
896
  RADashboardArea.prototype.loadWidgetData = function (widget) {
881
- widget.canLoadData = true;
897
+ widget.dataTriggered = true;
898
+ if (widget.widgetLoaded) {
899
+ widget.canLoadData = true;
900
+ }
882
901
  };
883
902
  RADashboardArea.prototype.dataLoaded = function () {
884
- for (var i = this.initialWidgetCount; i < this.widgetList.length; i++) {
885
- if (!this.widgetList[i].canLoadData) {
886
- this.widgetList[i].canLoadData = true;
887
- break;
903
+ var _this = this;
904
+ var _loop_1 = function (i) {
905
+ if (!this_1.widgetList[i].dataTriggered) {
906
+ setTimeout(function () {
907
+ _this.loadWidgetData(_this.widgetList[i]);
908
+ });
909
+ return "break";
888
910
  }
911
+ };
912
+ var this_1 = this;
913
+ for (var i = 0; i < this.widgetList.length; i++) {
914
+ var state_1 = _loop_1(i);
915
+ if (state_1 === "break")
916
+ break;
889
917
  }
890
918
  };
891
919
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
@@ -1142,6 +1170,10 @@
1142
1170
  core.Input('dashboard-info'),
1143
1171
  __metadata("design:type", Object)
1144
1172
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
1173
+ __decorate([
1174
+ core.Input(),
1175
+ __metadata("design:type", Object)
1176
+ ], RADashboardArea.prototype, "templateConfig", void 0);
1145
1177
  __decorate([
1146
1178
  core.Output(),
1147
1179
  __metadata("design:type", Object)
@@ -1153,7 +1185,7 @@
1153
1185
  RADashboardArea = __decorate([
1154
1186
  core.Component({
1155
1187
  selector: 'ra-dashboard-area',
1156
- 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>",
1188
+ 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>",
1157
1189
  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}}"]
1158
1190
  }),
1159
1191
  __metadata("design:paramtypes", [RaDashboardService,
@@ -1261,6 +1293,7 @@
1261
1293
  this.widgetDeleted = new core.EventEmitter();
1262
1294
  this.updateAppliedFilters = new core.EventEmitter();
1263
1295
  this.dataLoaded = new core.EventEmitter();
1296
+ this.widgetLoaded = new core.EventEmitter();
1264
1297
  this.isWidgetStateApplicable = false;
1265
1298
  this.widgetEmptyState = '';
1266
1299
  this.lockVisible = false;
@@ -1329,7 +1362,7 @@
1329
1362
  this.invokeWidgetResizedEvent();
1330
1363
  }
1331
1364
  }
1332
- if (changes.canLoadData && changes.width.currentValue != changes.width.previousValue) {
1365
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1333
1366
  if (this.canLoadData)
1334
1367
  this.refreshWidget(this.data.widgetInfo);
1335
1368
  }
@@ -1600,7 +1633,8 @@
1600
1633
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1601
1634
  widgetConfigFilter.globalFilter = this.globalFilter;
1602
1635
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1603
- this.widgetElement.loadContent(widgetConfigFilter);
1636
+ // this.widgetElement.loadContent(widgetConfigFilter);
1637
+ this.widgetLoaded.emit();
1604
1638
  return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
1605
1639
  case 1:
1606
1640
  _a.sent();
@@ -2094,6 +2128,10 @@
2094
2128
  core.Output(),
2095
2129
  __metadata("design:type", Object)
2096
2130
  ], RAWidgetContainer.prototype, "dataLoaded", void 0);
2131
+ __decorate([
2132
+ core.Output(),
2133
+ __metadata("design:type", Object)
2134
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
2097
2135
  __decorate([
2098
2136
  core.Input('dom-resized'),
2099
2137
  __metadata("design:type", Boolean),
@@ -5092,12 +5130,13 @@
5092
5130
  function RaBaseDashboardTemplate(ngZone) {
5093
5131
  var _this = this;
5094
5132
  this.ngZone = ngZone;
5095
- this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo) {
5133
+ this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) {
5096
5134
  _this.ngZone.run(function () {
5097
5135
  _this.userDashboardId = userDashboardId;
5098
5136
  _this.appConfig = appConfig;
5099
5137
  _this.raDashboardEventBus = eventBus;
5100
5138
  _this.dashboardInfo = dashboardInfo;
5139
+ _this.templateConfig = templateConfig;
5101
5140
  });
5102
5141
  _this.init();
5103
5142
  };