@schneideress/dashboardframework 0.0.6 → 0.0.8

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.
@@ -3,6 +3,7 @@ import { Injectable, Injector, ɵɵdefineInjectable, ɵɵinject, INJECTOR, Compo
3
3
  import { of, Subject } from 'rxjs';
4
4
  import { BaseService } from '@schneideress/ess-util';
5
5
  import { filter, map } from 'rxjs/operators';
6
+ import { NgxUiLoaderService, NgxUiLoaderModule } from 'ngx-ui-loader';
6
7
  import { BrowserModule } from '@angular/platform-browser';
7
8
  import { HttpClientModule } from '@angular/common/http';
8
9
  import { CommonModule } from '@angular/common';
@@ -472,9 +473,10 @@ var GridsterConfigDefaultSettings = {
472
473
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
473
474
  */
474
475
  var RADashboardArea = /** @class */ (function () {
475
- function RADashboardArea(dashboardService, ngZone) {
476
+ function RADashboardArea(dashboardService, ngZone, ngxService) {
476
477
  this.dashboardService = dashboardService;
477
478
  this.ngZone = ngZone;
479
+ this.ngxService = ngxService;
478
480
  this.widgetList = Array();
479
481
  this.gridheight = 300;
480
482
  this.widgetHeight = 20;
@@ -487,18 +489,27 @@ var RADashboardArea = /** @class */ (function () {
487
489
  * @return {?}
488
490
  */
489
491
  function () {
490
- /**
491
- * To override default configuration values to the gridster control
492
- * @type {?}
493
- */
492
+ this.initiateGridsterConfig();
493
+ };
494
+ /**To set GridsterConfig */
495
+ /**
496
+ * To set GridsterConfig
497
+ * @return {?}
498
+ */
499
+ RADashboardArea.prototype.initiateGridsterConfig = /**
500
+ * To set GridsterConfig
501
+ * @return {?}
502
+ */
503
+ function () {
504
+ /** @type {?} */
494
505
  var areaContext = this;
506
+ /**To override default configuration values to the gridster control */
495
507
  this.options = GridsterConfigDefaultSettings;
496
508
  this.options.itemChangeCallback = (/**
497
509
  * @param {?} item
498
510
  * @return {?}
499
511
  */
500
512
  function (item) {
501
- console.log('in change call back');
502
513
  areaContext.setAreaHeight();
503
514
  areaContext.updateWidgets();
504
515
  });
@@ -528,6 +539,7 @@ var RADashboardArea = /** @class */ (function () {
528
539
  }));
529
540
  }
530
541
  if (this.raDashboardEventBus && this.userDashboardId && this.areaKey) {
542
+ this.initiateGridsterConfig();
531
543
  this.loadWidgets(this.userDashboardId, this.areaKey);
532
544
  }
533
545
  };
@@ -547,7 +559,6 @@ var RADashboardArea = /** @class */ (function () {
547
559
  * @return {?}
548
560
  */
549
561
  function () {
550
- console.log('in update widgets');
551
562
  this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
552
563
  * @param {?} widgets
553
564
  * @return {?}
@@ -572,6 +583,8 @@ var RADashboardArea = /** @class */ (function () {
572
583
  function (userDashboarId, areaKey) {
573
584
  var _this = this;
574
585
  /** @type {?} */
586
+ var areaContext = this;
587
+ /** @type {?} */
575
588
  var widgetInfo = (/** @type {?} */ ({
576
589
  dashboardId: userDashboarId.toString(),
577
590
  dashboardAreaKey: areaKey
@@ -581,9 +594,14 @@ var RADashboardArea = /** @class */ (function () {
581
594
  * @return {?}
582
595
  */
583
596
  function (widgets) {
584
- if (widgets) {
585
- _this.widgetList = _this.mapObjectListToGridsterItemList(widgets);
586
- _this.setAreaHeight();
597
+ if (widgets && widgets.length > 0) {
598
+ areaContext.widgetList = _this.mapObjectListToGridsterItemList(widgets);
599
+ setTimeout((/**
600
+ * @return {?}
601
+ */
602
+ function () {
603
+ areaContext.setAreaHeight();
604
+ }), 2000);
587
605
  }
588
606
  }));
589
607
  };
@@ -612,9 +630,11 @@ var RADashboardArea = /** @class */ (function () {
612
630
  areaScrollHeight = currentHeight;
613
631
  }
614
632
  }));
615
- areaHeight = areaScrollHeight * this.options.api.getCurrentRowHeight() + 2;
616
- if (areaHeight < 300) {
617
- areaHeight = 300;
633
+ if (this.options.api) {
634
+ areaHeight = areaScrollHeight * this.options.api.getCurrentRowHeight() + 2;
635
+ }
636
+ if (areaHeight < 600) {
637
+ areaHeight = 600;
618
638
  }
619
639
  this.gridheight = areaHeight;
620
640
  };
@@ -668,11 +688,14 @@ var RADashboardArea = /** @class */ (function () {
668
688
  data.position_y = 0;
669
689
  /** @type {?} */
670
690
  var gridsterItem = this.mapObjectsToGridsterItem(data);
671
- gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
691
+ if (this.options.api) {
692
+ gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
693
+ }
672
694
  data.position_x = gridsterItem.x;
673
695
  data.position_y = gridsterItem.y;
674
696
  data.dashboardAreaKey = this.areaKey;
675
697
  data.dashboardId = this.userDashboardId;
698
+ this.ngxService.start();
676
699
  this.dashboardService.addWidget(data, this.appConfig).subscribe((/**
677
700
  * @param {?} widget
678
701
  * @return {?}
@@ -681,6 +704,7 @@ var RADashboardArea = /** @class */ (function () {
681
704
  gridsterItem = _this.mapObjectsToGridsterItem(widget);
682
705
  _this.widgetList.push(gridsterItem);
683
706
  _this.setAreaHeight();
707
+ _this.ngxService.stop();
684
708
  }));
685
709
  };
686
710
  /**To map IwidgetInfo object to gridsterItem */
@@ -768,14 +792,15 @@ var RADashboardArea = /** @class */ (function () {
768
792
  RADashboardArea.decorators = [
769
793
  { type: Component, args: [{
770
794
  selector: 'ra-dashboard-area',
771
- template: "<div #gridWrapper class=\"wrap gridster\" [style.height.px]=\"gridheight\">\r\n<!-- <div #gridWrapper class=\"wrap gridster\"> -->\r\n <gridster [options]=\"options\" style=\"height:100%;\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetList\">\r\n <ra-widget-container [app-config]=\"appConfig\" [event-bus]=\"raDashboardEventBus\" (widgetDeleted)=\"deleteWidget($event)\" [data]=\"item\"\r\n [global-filter]=\"globalFilter\" [widget-instance-id]=\"item.widgetInstanceId\"></ra-widget-container>\r\n </gridster-item>\r\n </gridster>\r\n</div>\r\n",
772
- styles: ["gridster{width:inherit;resize:height;display:flex;min-height:300px}gridster-item{border:1px solid #ccc;background:#fff!important}.dvheader{width:100%;height:35px;background:#000;color:#fff;padding:7px 3px 5px 6px;text-transform:uppercase}"]
795
+ template: "<div #gridWrapper class=\"wrap gridster\" [style.height.px]=\"gridheight\">\r\n<!-- <div #gridWrapper class=\"wrap gridster\"> -->\r\n <gridster [options]=\"options\" style=\"height:100%;\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetList\">\r\n <ra-widget-container [app-config]=\"appConfig\" [event-bus]=\"raDashboardEventBus\" (widgetDeleted)=\"deleteWidget($event)\" [data]=\"item\"\r\n [global-filter]=\"globalFilter\" [widget-instance-id]=\"item.widgetInstanceId\"></ra-widget-container>\r\n </gridster-item>\r\n </gridster>\r\n</div>\r\n\r\n",
796
+ styles: ["gridster{width:inherit;resize:height;display:flex;min-height:600px}gridster-item{border:1px solid #ccc;background:#fff!important}.dvheader{width:100%;height:35px;background:#000;color:#fff;padding:7px 3px 5px 6px;text-transform:uppercase}"]
773
797
  }] }
774
798
  ];
775
799
  /** @nocollapse */
776
800
  RADashboardArea.ctorParameters = function () { return [
777
801
  { type: RaDashboardService },
778
- { type: NgZone }
802
+ { type: NgZone },
803
+ { type: NgxUiLoaderService }
779
804
  ]; };
780
805
  RADashboardArea.propDecorators = {
781
806
  userDashboardId: [{ type: Input, args: ['user-dashboard-id',] }],
@@ -794,8 +819,9 @@ var RADashboardArea = /** @class */ (function () {
794
819
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
795
820
  */
796
821
  var RAWidgetContainer = /** @class */ (function () {
797
- function RAWidgetContainer(dashboardService) {
822
+ function RAWidgetContainer(dashboardService, ngxService) {
798
823
  this.dashboardService = dashboardService;
824
+ this.ngxService = ngxService;
799
825
  this.isIEOrEdge = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent);
800
826
  this.widgetDeleted = new EventEmitter();
801
827
  }
@@ -869,13 +895,17 @@ var RAWidgetContainer = /** @class */ (function () {
869
895
  */
870
896
  function () {
871
897
  var _this = this;
872
- this.dashboardService.deleteWidget(this.data.widgetInfo, this.appConfig).subscribe((/**
898
+ /** @type {?} */
899
+ var widgetContainerContext = this;
900
+ widgetContainerContext.ngxService.start();
901
+ widgetContainerContext.dashboardService.deleteWidget(this.data.widgetInfo, this.appConfig).subscribe((/**
873
902
  * @param {?} status
874
903
  * @return {?}
875
904
  */
876
905
  function (status) {
906
+ widgetContainerContext.ngxService.stop();
877
907
  {
878
- _this.widgetDeleted.emit(_this.data.widgetInfo.widgetInstanceId);
908
+ widgetContainerContext.widgetDeleted.emit(_this.data.widgetInfo.widgetInstanceId);
879
909
  }
880
910
  }));
881
911
  };
@@ -930,8 +960,6 @@ var RAWidgetContainer = /** @class */ (function () {
930
960
  * @return {?}
931
961
  */
932
962
  function (config) {
933
- console.log('in config change config');
934
- console.log(config);
935
963
  this.data.widgetInfo.widgetConfigInfo.config = config;
936
964
  this.refreshWidget(this.data.widgetInfo);
937
965
  this.updateWidget(this.data.widgetInfo);
@@ -1006,13 +1034,14 @@ var RAWidgetContainer = /** @class */ (function () {
1006
1034
  RAWidgetContainer.decorators = [
1007
1035
  { type: Component, args: [{
1008
1036
  selector: 'ra-widget-container',
1009
- template: "<div class=\"wc-wrapper\">\r\n <div class=\"wcheader\">\r\n <div class=\"col-md-12 wc-mover\">\r\n <div class=\"row\">\r\n <div class=\"col-md-11 float-left\" style=\"width:96%;\">{{data.widgetInfo.title?data.widgetInfo.title:\"Title\"}}\r\n </div>\r\n <div class=\"col-md-1\">\r\n <div class=\"float-right\">\r\n <div class=\"dropdown\">\r\n <div class=\"dropbtn\"> <i class=\"fal fa-cog\"></i></div>\r\n <div class=\"dropdown-content\">\r\n <a (click)=\"editWidget()\">Edit</a>\r\n <a (click)=\"copyWidget(data)\">Copy</a>\r\n <a (click)=\"moveWidget(data)\">Move</a>\r\n <a (click)=\"collapse(data)\">Collapse</a>\r\n <hr class=\"hr\" style=\"\">\r\n <a (click)=\"deleteWidget()\">Delete</a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"wcBody\">\r\n <div class=\"wcBodyBorder\" #ctlWidget></div>\r\n </div>\r\n</div>\r\n",
1037
+ template: "<div class=\"wc-wrapper\">\r\n <div class=\"wcheader\">\r\n <div class=\"col-md-12 wc-mover\">\r\n <div class=\"row\">\r\n <div class=\"col-md-11 float-left\" style=\"width:96%;\">{{data.widgetInfo.title?data.widgetInfo.title:\"Title\"}}\r\n </div>\r\n <div class=\"col-md-1\">\r\n <div class=\"float-right\">\r\n <div class=\"dropdown\">\r\n <div class=\"dropbtn\"> <i class=\"fal fa-cog\"></i></div>\r\n <div class=\"dropdown-content\">\r\n <a (click)=\"editWidget()\">Edit</a>\r\n <a (click)=\"copyWidget(data)\">Copy</a>\r\n <a (click)=\"moveWidget(data)\">Move</a>\r\n <a (click)=\"collapse(data)\">Collapse</a>\r\n <hr class=\"hr\">\r\n <a (click)=\"deleteWidget()\">Delete</a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"wcBody\">\r\n <div class=\"wcBodyBorder\" #ctlWidget></div>\r\n </div>\r\n</div>\r\n",
1010
1038
  styles: [".wcheader{width:100%;height:26px;background:#fff;color:#3dcd58;padding:7px 7px 0 6px;font-family:\"Arial Rounded MT\";border-bottom:1px solid;border-color:#fff;font-size:16px}.wc-mover{cursor:all-scroll}.wcBody{padding:8px}.wcBodyBorder{border:1px dashed #e6e2e2}.sp_icon{float:left;margin:0 15% 0 0}.dropbtn{cursor:pointer;color:#42b4e6}.dropdown{display:none;position:relative}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:100px;box-shadow:0 8px 16px 8px rgba(0,0,0,.2);z-index:1;font-size:12px;font-family:\"Arial Rounded MT\"}.dropdown-content a{color:#000;padding:5px 16px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1}.dropdown:hover .dropdown-content,.wc-wrapper:hover .dropdown{display:block}.dropdown:hover .dropbtn{color:#2b7797}.hr{border:0;border-top:1px solid rgba(0,0,0,.1)}"]
1011
1039
  }] }
1012
1040
  ];
1013
1041
  /** @nocollapse */
1014
1042
  RAWidgetContainer.ctorParameters = function () { return [
1015
- { type: RaDashboardService }
1043
+ { type: RaDashboardService },
1044
+ { type: NgxUiLoaderService }
1016
1045
  ]; };
1017
1046
  RAWidgetContainer.propDecorators = {
1018
1047
  ctlWidget: [{ type: ViewChild, args: ['ctlWidget', { static: false },] }],
@@ -5540,7 +5569,8 @@ var DashboardFrameworkModule = /** @class */ (function () {
5540
5569
  imports: [
5541
5570
  BrowserModule,
5542
5571
  GridsterModule,
5543
- HttpClientModule
5572
+ HttpClientModule,
5573
+ NgxUiLoaderModule
5544
5574
  ],
5545
5575
  exports: [
5546
5576
  RADashboardArea