@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.
@@ -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,24 +868,45 @@
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
+ };
882
+ RADashboardArea.prototype.startLoadWidgetData = function (lst) {
883
+ if (lst) {
884
+ if (lst.length < this.initialWidgetCount) {
885
+ for (var i = 0; i < lst.length; i++)
886
+ this.loadWidgetData(lst[i]);
887
+ }
888
+ else
889
+ for (var i = 0; i < this.initialWidgetCount; i++)
890
+ this.loadWidgetData(lst[i]);
891
+ }
892
+ };
880
893
  RADashboardArea.prototype.loadWidgetData = function (widget) {
881
- widget.canLoadData = true;
894
+ var _this = this;
895
+ widget.dataTriggered = true;
896
+ if (widget.widgetLoaded) {
897
+ setTimeout(function () {
898
+ widget.canLoadData = true;
899
+ });
900
+ }
901
+ else
902
+ setTimeout(function () {
903
+ _this.loadWidgetData(widget);
904
+ }, 1000);
882
905
  };
883
906
  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;
907
+ for (var i = 0; i < this.widgetList.length; i++) {
908
+ if (!this.widgetList[i].dataTriggered) {
909
+ this.loadWidgetData(this.widgetList[i]);
887
910
  break;
888
911
  }
889
912
  }
@@ -1142,6 +1165,10 @@
1142
1165
  core.Input('dashboard-info'),
1143
1166
  __metadata("design:type", Object)
1144
1167
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
1168
+ __decorate([
1169
+ core.Input(),
1170
+ __metadata("design:type", Object)
1171
+ ], RADashboardArea.prototype, "templateConfig", void 0);
1145
1172
  __decorate([
1146
1173
  core.Output(),
1147
1174
  __metadata("design:type", Object)
@@ -1153,7 +1180,7 @@
1153
1180
  RADashboardArea = __decorate([
1154
1181
  core.Component({
1155
1182
  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>",
1183
+ 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
1184
  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
1185
  }),
1159
1186
  __metadata("design:paramtypes", [RaDashboardService,
@@ -1261,6 +1288,7 @@
1261
1288
  this.widgetDeleted = new core.EventEmitter();
1262
1289
  this.updateAppliedFilters = new core.EventEmitter();
1263
1290
  this.dataLoaded = new core.EventEmitter();
1291
+ this.widgetLoaded = new core.EventEmitter();
1264
1292
  this.isWidgetStateApplicable = false;
1265
1293
  this.widgetEmptyState = '';
1266
1294
  this.lockVisible = false;
@@ -1329,7 +1357,7 @@
1329
1357
  this.invokeWidgetResizedEvent();
1330
1358
  }
1331
1359
  }
1332
- if (changes.canLoadData && changes.width.currentValue != changes.width.previousValue) {
1360
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1333
1361
  if (this.canLoadData)
1334
1362
  this.refreshWidget(this.data.widgetInfo);
1335
1363
  }
@@ -1600,7 +1628,8 @@
1600
1628
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1601
1629
  widgetConfigFilter.globalFilter = this.globalFilter;
1602
1630
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1603
- this.widgetElement.loadContent(widgetConfigFilter);
1631
+ // this.widgetElement.loadContent(widgetConfigFilter);
1632
+ this.widgetLoaded.emit();
1604
1633
  return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
1605
1634
  case 1:
1606
1635
  _a.sent();
@@ -2094,6 +2123,10 @@
2094
2123
  core.Output(),
2095
2124
  __metadata("design:type", Object)
2096
2125
  ], RAWidgetContainer.prototype, "dataLoaded", void 0);
2126
+ __decorate([
2127
+ core.Output(),
2128
+ __metadata("design:type", Object)
2129
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
2097
2130
  __decorate([
2098
2131
  core.Input('dom-resized'),
2099
2132
  __metadata("design:type", Boolean),
@@ -5092,12 +5125,13 @@
5092
5125
  function RaBaseDashboardTemplate(ngZone) {
5093
5126
  var _this = this;
5094
5127
  this.ngZone = ngZone;
5095
- this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo) {
5128
+ this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) {
5096
5129
  _this.ngZone.run(function () {
5097
5130
  _this.userDashboardId = userDashboardId;
5098
5131
  _this.appConfig = appConfig;
5099
5132
  _this.raDashboardEventBus = eventBus;
5100
5133
  _this.dashboardInfo = dashboardInfo;
5134
+ _this.templateConfig = templateConfig;
5101
5135
  });
5102
5136
  _this.init();
5103
5137
  };