@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.
@@ -417,6 +417,7 @@ let RADashboardArea = class RADashboardArea {
417
417
  this.domResized = false;
418
418
  this.showEmptyDashboard = false;
419
419
  this.isWidgetMgmnt = false;
420
+ this.initialWidgetCount = 10;
420
421
  this.widgetHeight = 2;
421
422
  this.widgetWidth = 4;
422
423
  this.hideDashboardBanner = new EventEmitter();
@@ -609,6 +610,8 @@ let RADashboardArea = class RADashboardArea {
609
610
  }
610
611
  /** To retrieve widgets based on userDashboardid and area name */
611
612
  loadWidgets(userDashboarId, areaKey) {
613
+ if (this.templateConfig && this.templateConfig.initialWidgetCount)
614
+ this.initialWidgetCount = this.templateConfig.initialWidgetCount;
612
615
  let widgetInfo = {
613
616
  dashboardId: userDashboarId.toString(),
614
617
  dashboardAreaKey: areaKey
@@ -637,6 +640,46 @@ let RADashboardArea = class RADashboardArea {
637
640
  }
638
641
  });
639
642
  }
643
+ widgetLoaded(widget) {
644
+ let lst = this.widgetList.filter((item) => {
645
+ return item.widgetLoaded == true;
646
+ });
647
+ widget.widgetLoaded = true;
648
+ if (lst.length == 0) {
649
+ this.startLoadWidgetData(this.widgetList);
650
+ }
651
+ }
652
+ startLoadWidgetData(lst) {
653
+ if (lst) {
654
+ if (lst.length < this.initialWidgetCount) {
655
+ for (let i = 0; i < lst.length; i++)
656
+ this.loadWidgetData(lst[i]);
657
+ }
658
+ else
659
+ for (let i = 0; i < this.initialWidgetCount; i++)
660
+ this.loadWidgetData(lst[i]);
661
+ }
662
+ }
663
+ loadWidgetData(widget) {
664
+ widget.dataTriggered = true;
665
+ if (widget.widgetLoaded) {
666
+ setTimeout(() => {
667
+ widget.canLoadData = true;
668
+ });
669
+ }
670
+ else
671
+ setTimeout(() => {
672
+ this.loadWidgetData(widget);
673
+ }, 1000);
674
+ }
675
+ dataLoaded() {
676
+ for (let i = 0; i < this.widgetList.length; i++) {
677
+ if (!this.widgetList[i].dataTriggered) {
678
+ this.loadWidgetData(this.widgetList[i]);
679
+ break;
680
+ }
681
+ }
682
+ }
640
683
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
641
684
  setAreaHeight() {
642
685
  setTimeout(() => {
@@ -886,6 +929,10 @@ __decorate([
886
929
  Input('dashboard-info'),
887
930
  __metadata("design:type", Object)
888
931
  ], RADashboardArea.prototype, "dashboardInfo", void 0);
932
+ __decorate([
933
+ Input(),
934
+ __metadata("design:type", Object)
935
+ ], RADashboardArea.prototype, "templateConfig", void 0);
889
936
  __decorate([
890
937
  Output(),
891
938
  __metadata("design:type", Object)
@@ -897,7 +944,7 @@ __decorate([
897
944
  RADashboardArea = __decorate([
898
945
  Component({
899
946
  selector: 'ra-dashboard-area',
900
- 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>",
947
+ 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>",
901
948
  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}}"]
902
949
  }),
903
950
  __metadata("design:paramtypes", [RaDashboardService,
@@ -996,8 +1043,11 @@ let RAWidgetContainer = class RAWidgetContainer {
996
1043
  this.showExcell = true;
997
1044
  this.hideTitle = false;
998
1045
  this.inapplicableFilters = [];
1046
+ this.canLoadData = false;
999
1047
  this.widgetDeleted = new EventEmitter();
1000
1048
  this.updateAppliedFilters = new EventEmitter();
1049
+ this.dataLoaded = new EventEmitter();
1050
+ this.widgetLoaded = new EventEmitter();
1001
1051
  this.isWidgetStateApplicable = false;
1002
1052
  this.widgetEmptyState = '';
1003
1053
  this.lockVisible = false;
@@ -1048,7 +1098,7 @@ let RAWidgetContainer = class RAWidgetContainer {
1048
1098
  this.refreshWidget(this.data.widgetInfo);
1049
1099
  }
1050
1100
  else {
1051
- this.refreshWidget(this.data.widgetInfo);
1101
+ //this.refreshWidget(this.data.widgetInfo);
1052
1102
  }
1053
1103
  }
1054
1104
  }
@@ -1057,6 +1107,10 @@ let RAWidgetContainer = class RAWidgetContainer {
1057
1107
  this.invokeWidgetResizedEvent();
1058
1108
  }
1059
1109
  }
1110
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1111
+ if (this.canLoadData)
1112
+ this.refreshWidget(this.data.widgetInfo);
1113
+ }
1060
1114
  }
1061
1115
  invokeWidgetResizedEvent() {
1062
1116
  if (this.widgetElement) {
@@ -1234,6 +1288,10 @@ let RAWidgetContainer = class RAWidgetContainer {
1234
1288
  this.showPanel = true;
1235
1289
  else
1236
1290
  this.showPanel = false;
1291
+ if (!this.data.dataLoaded) {
1292
+ this.data.dataLoaded = true;
1293
+ this.dataLoaded.emit();
1294
+ }
1237
1295
  break;
1238
1296
  case 'onConfigEditClicked':
1239
1297
  this.editWidget();
@@ -1307,7 +1365,8 @@ let RAWidgetContainer = class RAWidgetContainer {
1307
1365
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1308
1366
  widgetConfigFilter.globalFilter = this.globalFilter;
1309
1367
  widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1310
- this.widgetElement.loadContent(widgetConfigFilter);
1368
+ // this.widgetElement.loadContent(widgetConfigFilter);
1369
+ this.widgetLoaded.emit();
1311
1370
  yield this.setLock(widgetConfigFilter.config);
1312
1371
  yield this.setDownloadIcon();
1313
1372
  }));
@@ -1748,6 +1807,10 @@ __decorate([
1748
1807
  Input('bulk-action-data'),
1749
1808
  __metadata("design:type", Object)
1750
1809
  ], RAWidgetContainer.prototype, "bulkActionData", void 0);
1810
+ __decorate([
1811
+ Input(),
1812
+ __metadata("design:type", Boolean)
1813
+ ], RAWidgetContainer.prototype, "canLoadData", void 0);
1751
1814
  __decorate([
1752
1815
  Output(),
1753
1816
  __metadata("design:type", Object)
@@ -1756,6 +1819,14 @@ __decorate([
1756
1819
  Output(),
1757
1820
  __metadata("design:type", Object)
1758
1821
  ], RAWidgetContainer.prototype, "updateAppliedFilters", void 0);
1822
+ __decorate([
1823
+ Output(),
1824
+ __metadata("design:type", Object)
1825
+ ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1826
+ __decorate([
1827
+ Output(),
1828
+ __metadata("design:type", Object)
1829
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1759
1830
  __decorate([
1760
1831
  Input('dom-resized'),
1761
1832
  __metadata("design:type", Boolean),
@@ -4711,12 +4782,13 @@ DashboardFrameworkModule = __decorate([
4711
4782
  class RaBaseDashboardTemplate {
4712
4783
  constructor(ngZone) {
4713
4784
  this.ngZone = ngZone;
4714
- this.initialize = (eventBus, userDashboardId, appConfig, dashboardInfo) => {
4785
+ this.initialize = (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) => {
4715
4786
  this.ngZone.run(() => {
4716
4787
  this.userDashboardId = userDashboardId;
4717
4788
  this.appConfig = appConfig;
4718
4789
  this.raDashboardEventBus = eventBus;
4719
4790
  this.dashboardInfo = dashboardInfo;
4791
+ this.templateConfig = templateConfig;
4720
4792
  });
4721
4793
  this.init();
4722
4794
  };