@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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@schneideress/ess-util'), require('rxjs/operators'), require('@angular/platform-browser'), require('@angular/common/http'), require('@angular/common')) :
3
- typeof define === 'function' && define.amd ? define('@schneideress/dashboardframework', ['exports', '@angular/core', 'rxjs', '@schneideress/ess-util', 'rxjs/operators', '@angular/platform-browser', '@angular/common/http', '@angular/common'], factory) :
4
- (global = global || self, factory((global.schneideress = global.schneideress || {}, global.schneideress.dashboardframework = {}), global.ng.core, global.rxjs, global.essUtil, global.rxjs.operators, global.ng.platformBrowser, global.ng.common.http, global.ng.common));
5
- }(this, function (exports, core, rxjs, essUtil, operators, platformBrowser, http, common) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@schneideress/ess-util'), require('rxjs/operators'), require('ngx-ui-loader'), require('@angular/platform-browser'), require('@angular/common/http'), require('@angular/common')) :
3
+ typeof define === 'function' && define.amd ? define('@schneideress/dashboardframework', ['exports', '@angular/core', 'rxjs', '@schneideress/ess-util', 'rxjs/operators', 'ngx-ui-loader', '@angular/platform-browser', '@angular/common/http', '@angular/common'], factory) :
4
+ (global = global || self, factory((global.schneideress = global.schneideress || {}, global.schneideress.dashboardframework = {}), global.ng.core, global.rxjs, global.essUtil, global.rxjs.operators, global.ngxUiLoader, global.ng.platformBrowser, global.ng.common.http, global.ng.common));
5
+ }(this, function (exports, core, rxjs, essUtil, operators, ngxUiLoader, platformBrowser, http, common) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -509,9 +509,10 @@
509
509
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
510
510
  */
511
511
  var RADashboardArea = /** @class */ (function () {
512
- function RADashboardArea(dashboardService, ngZone) {
512
+ function RADashboardArea(dashboardService, ngZone, ngxService) {
513
513
  this.dashboardService = dashboardService;
514
514
  this.ngZone = ngZone;
515
+ this.ngxService = ngxService;
515
516
  this.widgetList = Array();
516
517
  this.gridheight = 300;
517
518
  this.widgetHeight = 20;
@@ -524,18 +525,27 @@
524
525
  * @return {?}
525
526
  */
526
527
  function () {
527
- /**
528
- * To override default configuration values to the gridster control
529
- * @type {?}
530
- */
528
+ this.initiateGridsterConfig();
529
+ };
530
+ /**To set GridsterConfig */
531
+ /**
532
+ * To set GridsterConfig
533
+ * @return {?}
534
+ */
535
+ RADashboardArea.prototype.initiateGridsterConfig = /**
536
+ * To set GridsterConfig
537
+ * @return {?}
538
+ */
539
+ function () {
540
+ /** @type {?} */
531
541
  var areaContext = this;
542
+ /**To override default configuration values to the gridster control */
532
543
  this.options = GridsterConfigDefaultSettings;
533
544
  this.options.itemChangeCallback = (/**
534
545
  * @param {?} item
535
546
  * @return {?}
536
547
  */
537
548
  function (item) {
538
- console.log('in change call back');
539
549
  areaContext.setAreaHeight();
540
550
  areaContext.updateWidgets();
541
551
  });
@@ -565,6 +575,7 @@
565
575
  }));
566
576
  }
567
577
  if (this.raDashboardEventBus && this.userDashboardId && this.areaKey) {
578
+ this.initiateGridsterConfig();
568
579
  this.loadWidgets(this.userDashboardId, this.areaKey);
569
580
  }
570
581
  };
@@ -584,7 +595,6 @@
584
595
  * @return {?}
585
596
  */
586
597
  function () {
587
- console.log('in update widgets');
588
598
  this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
589
599
  * @param {?} widgets
590
600
  * @return {?}
@@ -609,6 +619,8 @@
609
619
  function (userDashboarId, areaKey) {
610
620
  var _this = this;
611
621
  /** @type {?} */
622
+ var areaContext = this;
623
+ /** @type {?} */
612
624
  var widgetInfo = (/** @type {?} */ ({
613
625
  dashboardId: userDashboarId.toString(),
614
626
  dashboardAreaKey: areaKey
@@ -618,9 +630,14 @@
618
630
  * @return {?}
619
631
  */
620
632
  function (widgets) {
621
- if (widgets) {
622
- _this.widgetList = _this.mapObjectListToGridsterItemList(widgets);
623
- _this.setAreaHeight();
633
+ if (widgets && widgets.length > 0) {
634
+ areaContext.widgetList = _this.mapObjectListToGridsterItemList(widgets);
635
+ setTimeout((/**
636
+ * @return {?}
637
+ */
638
+ function () {
639
+ areaContext.setAreaHeight();
640
+ }), 2000);
624
641
  }
625
642
  }));
626
643
  };
@@ -649,11 +666,17 @@
649
666
  areaScrollHeight = currentHeight;
650
667
  }
651
668
  }));
652
- areaHeight = areaScrollHeight * this.options.api.getCurrentRowHeight() + 2;
653
- if (areaHeight < 300) {
654
- areaHeight = 300;
669
+ if (this.options.api) {
670
+ areaHeight = areaScrollHeight * this.options.api.getCurrentRowHeight() + 2;
671
+ if (areaHeight < 300) {
672
+ areaHeight = 300;
673
+ }
674
+ this.gridheight = areaHeight;
675
+ }
676
+ else {
677
+ console.log('api not defined');
678
+ console.log(this.options);
655
679
  }
656
- this.gridheight = areaHeight;
657
680
  };
658
681
  /** To remove a widget instance from dashboard and to save info in database */
659
682
  /**
@@ -705,11 +728,14 @@
705
728
  data.position_y = 0;
706
729
  /** @type {?} */
707
730
  var gridsterItem = this.mapObjectsToGridsterItem(data);
708
- gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
731
+ if (this.options.api) {
732
+ gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
733
+ }
709
734
  data.position_x = gridsterItem.x;
710
735
  data.position_y = gridsterItem.y;
711
736
  data.dashboardAreaKey = this.areaKey;
712
737
  data.dashboardId = this.userDashboardId;
738
+ this.ngxService.start();
713
739
  this.dashboardService.addWidget(data, this.appConfig).subscribe((/**
714
740
  * @param {?} widget
715
741
  * @return {?}
@@ -718,6 +744,7 @@
718
744
  gridsterItem = _this.mapObjectsToGridsterItem(widget);
719
745
  _this.widgetList.push(gridsterItem);
720
746
  _this.setAreaHeight();
747
+ _this.ngxService.stop();
721
748
  }));
722
749
  };
723
750
  /**To map IwidgetInfo object to gridsterItem */
@@ -805,14 +832,15 @@
805
832
  RADashboardArea.decorators = [
806
833
  { type: core.Component, args: [{
807
834
  selector: 'ra-dashboard-area',
808
- 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",
835
+ 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",
809
836
  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}"]
810
837
  }] }
811
838
  ];
812
839
  /** @nocollapse */
813
840
  RADashboardArea.ctorParameters = function () { return [
814
841
  { type: RaDashboardService },
815
- { type: core.NgZone }
842
+ { type: core.NgZone },
843
+ { type: ngxUiLoader.NgxUiLoaderService }
816
844
  ]; };
817
845
  RADashboardArea.propDecorators = {
818
846
  userDashboardId: [{ type: core.Input, args: ['user-dashboard-id',] }],
@@ -831,8 +859,9 @@
831
859
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
832
860
  */
833
861
  var RAWidgetContainer = /** @class */ (function () {
834
- function RAWidgetContainer(dashboardService) {
862
+ function RAWidgetContainer(dashboardService, ngxService) {
835
863
  this.dashboardService = dashboardService;
864
+ this.ngxService = ngxService;
836
865
  this.isIEOrEdge = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent);
837
866
  this.widgetDeleted = new core.EventEmitter();
838
867
  }
@@ -906,11 +935,13 @@
906
935
  */
907
936
  function () {
908
937
  var _this = this;
938
+ this.ngxService.start();
909
939
  this.dashboardService.deleteWidget(this.data.widgetInfo, this.appConfig).subscribe((/**
910
940
  * @param {?} status
911
941
  * @return {?}
912
942
  */
913
943
  function (status) {
944
+ _this.ngxService.stop();
914
945
  {
915
946
  _this.widgetDeleted.emit(_this.data.widgetInfo.widgetInstanceId);
916
947
  }
@@ -967,8 +998,6 @@
967
998
  * @return {?}
968
999
  */
969
1000
  function (config) {
970
- console.log('in config change config');
971
- console.log(config);
972
1001
  this.data.widgetInfo.widgetConfigInfo.config = config;
973
1002
  this.refreshWidget(this.data.widgetInfo);
974
1003
  this.updateWidget(this.data.widgetInfo);
@@ -1049,7 +1078,8 @@
1049
1078
  ];
1050
1079
  /** @nocollapse */
1051
1080
  RAWidgetContainer.ctorParameters = function () { return [
1052
- { type: RaDashboardService }
1081
+ { type: RaDashboardService },
1082
+ { type: ngxUiLoader.NgxUiLoaderService }
1053
1083
  ]; };
1054
1084
  RAWidgetContainer.propDecorators = {
1055
1085
  ctlWidget: [{ type: core.ViewChild, args: ['ctlWidget', { static: false },] }],
@@ -5577,7 +5607,8 @@
5577
5607
  imports: [
5578
5608
  platformBrowser.BrowserModule,
5579
5609
  GridsterModule,
5580
- http.HttpClientModule
5610
+ http.HttpClientModule,
5611
+ ngxUiLoader.NgxUiLoaderModule
5581
5612
  ],
5582
5613
  exports: [
5583
5614
  RADashboardArea