@schneideress/dashboardframework 0.0.6 → 0.0.7

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,11 +630,17 @@ 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
+ if (areaHeight < 300) {
636
+ areaHeight = 300;
637
+ }
638
+ this.gridheight = areaHeight;
639
+ }
640
+ else {
641
+ console.log('api not defined');
642
+ console.log(this.options);
618
643
  }
619
- this.gridheight = areaHeight;
620
644
  };
621
645
  /** To remove a widget instance from dashboard and to save info in database */
622
646
  /**
@@ -668,11 +692,14 @@ var RADashboardArea = /** @class */ (function () {
668
692
  data.position_y = 0;
669
693
  /** @type {?} */
670
694
  var gridsterItem = this.mapObjectsToGridsterItem(data);
671
- gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
695
+ if (this.options.api) {
696
+ gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
697
+ }
672
698
  data.position_x = gridsterItem.x;
673
699
  data.position_y = gridsterItem.y;
674
700
  data.dashboardAreaKey = this.areaKey;
675
701
  data.dashboardId = this.userDashboardId;
702
+ this.ngxService.start();
676
703
  this.dashboardService.addWidget(data, this.appConfig).subscribe((/**
677
704
  * @param {?} widget
678
705
  * @return {?}
@@ -681,6 +708,7 @@ var RADashboardArea = /** @class */ (function () {
681
708
  gridsterItem = _this.mapObjectsToGridsterItem(widget);
682
709
  _this.widgetList.push(gridsterItem);
683
710
  _this.setAreaHeight();
711
+ _this.ngxService.stop();
684
712
  }));
685
713
  };
686
714
  /**To map IwidgetInfo object to gridsterItem */
@@ -768,14 +796,15 @@ var RADashboardArea = /** @class */ (function () {
768
796
  RADashboardArea.decorators = [
769
797
  { type: Component, args: [{
770
798
  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",
799
+ 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",
772
800
  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}"]
773
801
  }] }
774
802
  ];
775
803
  /** @nocollapse */
776
804
  RADashboardArea.ctorParameters = function () { return [
777
805
  { type: RaDashboardService },
778
- { type: NgZone }
806
+ { type: NgZone },
807
+ { type: NgxUiLoaderService }
779
808
  ]; };
780
809
  RADashboardArea.propDecorators = {
781
810
  userDashboardId: [{ type: Input, args: ['user-dashboard-id',] }],
@@ -794,8 +823,9 @@ var RADashboardArea = /** @class */ (function () {
794
823
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
795
824
  */
796
825
  var RAWidgetContainer = /** @class */ (function () {
797
- function RAWidgetContainer(dashboardService) {
826
+ function RAWidgetContainer(dashboardService, ngxService) {
798
827
  this.dashboardService = dashboardService;
828
+ this.ngxService = ngxService;
799
829
  this.isIEOrEdge = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent);
800
830
  this.widgetDeleted = new EventEmitter();
801
831
  }
@@ -869,11 +899,13 @@ var RAWidgetContainer = /** @class */ (function () {
869
899
  */
870
900
  function () {
871
901
  var _this = this;
902
+ this.ngxService.start();
872
903
  this.dashboardService.deleteWidget(this.data.widgetInfo, this.appConfig).subscribe((/**
873
904
  * @param {?} status
874
905
  * @return {?}
875
906
  */
876
907
  function (status) {
908
+ _this.ngxService.stop();
877
909
  {
878
910
  _this.widgetDeleted.emit(_this.data.widgetInfo.widgetInstanceId);
879
911
  }
@@ -930,8 +962,6 @@ var RAWidgetContainer = /** @class */ (function () {
930
962
  * @return {?}
931
963
  */
932
964
  function (config) {
933
- console.log('in config change config');
934
- console.log(config);
935
965
  this.data.widgetInfo.widgetConfigInfo.config = config;
936
966
  this.refreshWidget(this.data.widgetInfo);
937
967
  this.updateWidget(this.data.widgetInfo);
@@ -1012,7 +1042,8 @@ var RAWidgetContainer = /** @class */ (function () {
1012
1042
  ];
1013
1043
  /** @nocollapse */
1014
1044
  RAWidgetContainer.ctorParameters = function () { return [
1015
- { type: RaDashboardService }
1045
+ { type: RaDashboardService },
1046
+ { type: NgxUiLoaderService }
1016
1047
  ]; };
1017
1048
  RAWidgetContainer.propDecorators = {
1018
1049
  ctlWidget: [{ type: ViewChild, args: ['ctlWidget', { static: false },] }],
@@ -5540,7 +5571,8 @@ var DashboardFrameworkModule = /** @class */ (function () {
5540
5571
  imports: [
5541
5572
  BrowserModule,
5542
5573
  GridsterModule,
5543
- HttpClientModule
5574
+ HttpClientModule,
5575
+ NgxUiLoaderModule
5544
5576
  ],
5545
5577
  exports: [
5546
5578
  RADashboardArea