@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.
@@ -643,6 +643,7 @@
643
643
  this.domResized = false;
644
644
  this.showEmptyDashboard = false;
645
645
  this.isWidgetMgmnt = false;
646
+ this.initialWidgetCount = 10;
646
647
  this.widgetHeight = 2;
647
648
  this.widgetWidth = 4;
648
649
  this.hideDashboardBanner = new core.EventEmitter();
@@ -839,6 +840,8 @@
839
840
  /** To retrieve widgets based on userDashboardid and area name */
840
841
  RADashboardArea.prototype.loadWidgets = function (userDashboarId, areaKey) {
841
842
  var _this = this;
843
+ if (this.templateConfig && this.templateConfig.initialWidgetCount)
844
+ this.initialWidgetCount = this.templateConfig.initialWidgetCount;
842
845
  var widgetInfo = {
843
846
  dashboardId: userDashboarId.toString(),
844
847
  dashboardAreaKey: areaKey
@@ -867,6 +870,47 @@
867
870
  }
868
871
  });
869
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
+ };
893
+ RADashboardArea.prototype.loadWidgetData = function (widget) {
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);
905
+ };
906
+ RADashboardArea.prototype.dataLoaded = function () {
907
+ for (var i = 0; i < this.widgetList.length; i++) {
908
+ if (!this.widgetList[i].dataTriggered) {
909
+ this.loadWidgetData(this.widgetList[i]);
910
+ break;
911
+ }
912
+ }
913
+ };
870
914
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
871
915
  RADashboardArea.prototype.setAreaHeight = function () {
872
916
  var _this = this;
@@ -1121,6 +1165,10 @@
1121
1165
  core.Input('dashboard-info'),
1122
1166
  __metadata("design:type", Object)
1123
1167
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
1168
+ __decorate([
1169
+ core.Input(),
1170
+ __metadata("design:type", Object)
1171
+ ], RADashboardArea.prototype, "templateConfig", void 0);
1124
1172
  __decorate([
1125
1173
  core.Output(),
1126
1174
  __metadata("design:type", Object)
@@ -1132,7 +1180,7 @@
1132
1180
  RADashboardArea = __decorate([
1133
1181
  core.Component({
1134
1182
  selector: 'ra-dashboard-area',
1135
- 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>",
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>",
1136
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}}"]
1137
1185
  }),
1138
1186
  __metadata("design:paramtypes", [RaDashboardService,
@@ -1236,8 +1284,11 @@
1236
1284
  this.showExcell = true;
1237
1285
  this.hideTitle = false;
1238
1286
  this.inapplicableFilters = [];
1287
+ this.canLoadData = false;
1239
1288
  this.widgetDeleted = new core.EventEmitter();
1240
1289
  this.updateAppliedFilters = new core.EventEmitter();
1290
+ this.dataLoaded = new core.EventEmitter();
1291
+ this.widgetLoaded = new core.EventEmitter();
1241
1292
  this.isWidgetStateApplicable = false;
1242
1293
  this.widgetEmptyState = '';
1243
1294
  this.lockVisible = false;
@@ -1297,7 +1348,7 @@
1297
1348
  this.refreshWidget(this.data.widgetInfo);
1298
1349
  }
1299
1350
  else {
1300
- this.refreshWidget(this.data.widgetInfo);
1351
+ //this.refreshWidget(this.data.widgetInfo);
1301
1352
  }
1302
1353
  }
1303
1354
  }
@@ -1306,6 +1357,10 @@
1306
1357
  this.invokeWidgetResizedEvent();
1307
1358
  }
1308
1359
  }
1360
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1361
+ if (this.canLoadData)
1362
+ this.refreshWidget(this.data.widgetInfo);
1363
+ }
1309
1364
  };
1310
1365
  RAWidgetContainer.prototype.invokeWidgetResizedEvent = function () {
1311
1366
  if (this.widgetElement) {
@@ -1496,6 +1551,10 @@
1496
1551
  _this.showPanel = true;
1497
1552
  else
1498
1553
  _this.showPanel = false;
1554
+ if (!_this.data.dataLoaded) {
1555
+ _this.data.dataLoaded = true;
1556
+ _this.dataLoaded.emit();
1557
+ }
1499
1558
  break;
1500
1559
  case 'onConfigEditClicked':
1501
1560
  _this.editWidget();
@@ -1569,7 +1628,8 @@
1569
1628
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1570
1629
  widgetConfigFilter.globalFilter = this.globalFilter;
1571
1630
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1572
- this.widgetElement.loadContent(widgetConfigFilter);
1631
+ // this.widgetElement.loadContent(widgetConfigFilter);
1632
+ this.widgetLoaded.emit();
1573
1633
  return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
1574
1634
  case 1:
1575
1635
  _a.sent();
@@ -2047,6 +2107,10 @@
2047
2107
  core.Input('bulk-action-data'),
2048
2108
  __metadata("design:type", Object)
2049
2109
  ], RAWidgetContainer.prototype, "bulkActionData", void 0);
2110
+ __decorate([
2111
+ core.Input(),
2112
+ __metadata("design:type", Boolean)
2113
+ ], RAWidgetContainer.prototype, "canLoadData", void 0);
2050
2114
  __decorate([
2051
2115
  core.Output(),
2052
2116
  __metadata("design:type", Object)
@@ -2055,6 +2119,14 @@
2055
2119
  core.Output(),
2056
2120
  __metadata("design:type", Object)
2057
2121
  ], RAWidgetContainer.prototype, "updateAppliedFilters", void 0);
2122
+ __decorate([
2123
+ core.Output(),
2124
+ __metadata("design:type", Object)
2125
+ ], RAWidgetContainer.prototype, "dataLoaded", void 0);
2126
+ __decorate([
2127
+ core.Output(),
2128
+ __metadata("design:type", Object)
2129
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
2058
2130
  __decorate([
2059
2131
  core.Input('dom-resized'),
2060
2132
  __metadata("design:type", Boolean),
@@ -5053,12 +5125,13 @@
5053
5125
  function RaBaseDashboardTemplate(ngZone) {
5054
5126
  var _this = this;
5055
5127
  this.ngZone = ngZone;
5056
- this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo) {
5128
+ this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) {
5057
5129
  _this.ngZone.run(function () {
5058
5130
  _this.userDashboardId = userDashboardId;
5059
5131
  _this.appConfig = appConfig;
5060
5132
  _this.raDashboardEventBus = eventBus;
5061
5133
  _this.dashboardInfo = dashboardInfo;
5134
+ _this.templateConfig = templateConfig;
5062
5135
  });
5063
5136
  _this.init();
5064
5137
  };