@schneideress/dashboardframework 0.0.5 → 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';
@@ -77,9 +78,7 @@ var RaDashboardService = /** @class */ (function (_super) {
77
78
  */
78
79
  function (widgetInfo, appConfig) {
79
80
  this.baseUrl = appConfig.apiBaseUrl;
80
- /** @type {?} */
81
- var url = 'widget/GetWidgetByArea';
82
- return this.post(url, widgetInfo);
81
+ return this.post('widget/GetWidgetByArea', widgetInfo);
83
82
  };
84
83
  /**
85
84
  * @param {?} widgetList
@@ -93,9 +92,7 @@ var RaDashboardService = /** @class */ (function (_super) {
93
92
  */
94
93
  function (widgetList, appConfig) {
95
94
  this.baseUrl = appConfig.apiBaseUrl;
96
- /** @type {?} */
97
- var url = 'widget/UpdateAreaWidgets';
98
- return this.post(url, widgetList);
95
+ return this.post('widget/UpdateAreaWidgets', widgetList);
99
96
  };
100
97
  /**
101
98
  * @param {?} widgetInfo
@@ -144,9 +141,7 @@ var RaDashboardService = /** @class */ (function (_super) {
144
141
  */
145
142
  function (widgetInfo, appConfig) {
146
143
  this.baseUrl = appConfig.apiBaseUrl;
147
- /** @type {?} */
148
- var url = 'widget/AddWidgetUser';
149
- return this.post(url, widgetInfo);
144
+ return this.post('widget/AddWidgetUser', widgetInfo);
150
145
  };
151
146
  /** To Delete current widget from DOM*/
152
147
  /**
@@ -163,9 +158,7 @@ var RaDashboardService = /** @class */ (function (_super) {
163
158
  */
164
159
  function (widgetInfo, appConfig) {
165
160
  this.baseUrl = appConfig.apiBaseUrl;
166
- /** @type {?} */
167
- var url = 'widget/DeleteWidgetUser';
168
- return this.post(url, widgetInfo);
161
+ return this.post('widget/DeleteWidgetUser', widgetInfo);
169
162
  };
170
163
  /**To Update widgetInfo in database */
171
164
  /**
@@ -182,9 +175,7 @@ var RaDashboardService = /** @class */ (function (_super) {
182
175
  */
183
176
  function (widgetInfo, appConfig) {
184
177
  this.baseUrl = appConfig.apiBaseUrl;
185
- /** @type {?} */
186
- var url = 'widget/UpdateUserWidget';
187
- return this.post(url, widgetInfo);
178
+ return this.post('widget/UpdateUserWidget', widgetInfo);
188
179
  };
189
180
  /** To Move or change position if current widget container*/
190
181
  /**
@@ -482,9 +473,10 @@ var GridsterConfigDefaultSettings = {
482
473
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
483
474
  */
484
475
  var RADashboardArea = /** @class */ (function () {
485
- function RADashboardArea(dashboardService, ngZone) {
476
+ function RADashboardArea(dashboardService, ngZone, ngxService) {
486
477
  this.dashboardService = dashboardService;
487
478
  this.ngZone = ngZone;
479
+ this.ngxService = ngxService;
488
480
  this.widgetList = Array();
489
481
  this.gridheight = 300;
490
482
  this.widgetHeight = 20;
@@ -497,18 +489,27 @@ var RADashboardArea = /** @class */ (function () {
497
489
  * @return {?}
498
490
  */
499
491
  function () {
500
- /**
501
- * To override default configuration values to the gridster control
502
- * @type {?}
503
- */
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 {?} */
504
505
  var areaContext = this;
506
+ /**To override default configuration values to the gridster control */
505
507
  this.options = GridsterConfigDefaultSettings;
506
508
  this.options.itemChangeCallback = (/**
507
509
  * @param {?} item
508
510
  * @return {?}
509
511
  */
510
512
  function (item) {
511
- console.log('in change call back');
512
513
  areaContext.setAreaHeight();
513
514
  areaContext.updateWidgets();
514
515
  });
@@ -538,6 +539,7 @@ var RADashboardArea = /** @class */ (function () {
538
539
  }));
539
540
  }
540
541
  if (this.raDashboardEventBus && this.userDashboardId && this.areaKey) {
542
+ this.initiateGridsterConfig();
541
543
  this.loadWidgets(this.userDashboardId, this.areaKey);
542
544
  }
543
545
  };
@@ -557,7 +559,6 @@ var RADashboardArea = /** @class */ (function () {
557
559
  * @return {?}
558
560
  */
559
561
  function () {
560
- console.log('in update widgets');
561
562
  this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
562
563
  * @param {?} widgets
563
564
  * @return {?}
@@ -582,19 +583,25 @@ var RADashboardArea = /** @class */ (function () {
582
583
  function (userDashboarId, areaKey) {
583
584
  var _this = this;
584
585
  /** @type {?} */
586
+ var areaContext = this;
587
+ /** @type {?} */
585
588
  var widgetInfo = (/** @type {?} */ ({
586
589
  dashboardId: userDashboarId.toString(),
587
590
  dashboardAreaKey: areaKey
588
591
  }));
589
- /** @type {?} */
590
- var widgets = this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe((/**
592
+ this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe((/**
591
593
  * @param {?} widgets
592
594
  * @return {?}
593
595
  */
594
596
  function (widgets) {
595
- if (widgets) {
596
- _this.widgetList = _this.mapObjectListToGridsterItemList(widgets);
597
- _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);
598
605
  }
599
606
  }));
600
607
  };
@@ -623,11 +630,17 @@ var RADashboardArea = /** @class */ (function () {
623
630
  areaScrollHeight = currentHeight;
624
631
  }
625
632
  }));
626
- areaHeight = areaScrollHeight * this.options.api.getCurrentRowHeight() + 2;
627
- if (areaHeight < 300) {
628
- 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);
629
643
  }
630
- this.gridheight = areaHeight;
631
644
  };
632
645
  /** To remove a widget instance from dashboard and to save info in database */
633
646
  /**
@@ -679,11 +692,14 @@ var RADashboardArea = /** @class */ (function () {
679
692
  data.position_y = 0;
680
693
  /** @type {?} */
681
694
  var gridsterItem = this.mapObjectsToGridsterItem(data);
682
- gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
695
+ if (this.options.api) {
696
+ gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
697
+ }
683
698
  data.position_x = gridsterItem.x;
684
699
  data.position_y = gridsterItem.y;
685
700
  data.dashboardAreaKey = this.areaKey;
686
701
  data.dashboardId = this.userDashboardId;
702
+ this.ngxService.start();
687
703
  this.dashboardService.addWidget(data, this.appConfig).subscribe((/**
688
704
  * @param {?} widget
689
705
  * @return {?}
@@ -692,6 +708,7 @@ var RADashboardArea = /** @class */ (function () {
692
708
  gridsterItem = _this.mapObjectsToGridsterItem(widget);
693
709
  _this.widgetList.push(gridsterItem);
694
710
  _this.setAreaHeight();
711
+ _this.ngxService.stop();
695
712
  }));
696
713
  };
697
714
  /**To map IwidgetInfo object to gridsterItem */
@@ -779,14 +796,15 @@ var RADashboardArea = /** @class */ (function () {
779
796
  RADashboardArea.decorators = [
780
797
  { type: Component, args: [{
781
798
  selector: 'ra-dashboard-area',
782
- 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",
783
- styles: ["gridster{width:inherit;background:#f1f1f1;border:1px solid #ccc;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}"]
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",
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}"]
784
801
  }] }
785
802
  ];
786
803
  /** @nocollapse */
787
804
  RADashboardArea.ctorParameters = function () { return [
788
805
  { type: RaDashboardService },
789
- { type: NgZone }
806
+ { type: NgZone },
807
+ { type: NgxUiLoaderService }
790
808
  ]; };
791
809
  RADashboardArea.propDecorators = {
792
810
  userDashboardId: [{ type: Input, args: ['user-dashboard-id',] }],
@@ -805,8 +823,9 @@ var RADashboardArea = /** @class */ (function () {
805
823
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
806
824
  */
807
825
  var RAWidgetContainer = /** @class */ (function () {
808
- function RAWidgetContainer(dashboardService) {
826
+ function RAWidgetContainer(dashboardService, ngxService) {
809
827
  this.dashboardService = dashboardService;
828
+ this.ngxService = ngxService;
810
829
  this.isIEOrEdge = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent);
811
830
  this.widgetDeleted = new EventEmitter();
812
831
  }
@@ -880,11 +899,13 @@ var RAWidgetContainer = /** @class */ (function () {
880
899
  */
881
900
  function () {
882
901
  var _this = this;
902
+ this.ngxService.start();
883
903
  this.dashboardService.deleteWidget(this.data.widgetInfo, this.appConfig).subscribe((/**
884
904
  * @param {?} status
885
905
  * @return {?}
886
906
  */
887
907
  function (status) {
908
+ _this.ngxService.stop();
888
909
  {
889
910
  _this.widgetDeleted.emit(_this.data.widgetInfo.widgetInstanceId);
890
911
  }
@@ -941,8 +962,6 @@ var RAWidgetContainer = /** @class */ (function () {
941
962
  * @return {?}
942
963
  */
943
964
  function (config) {
944
- console.log('in config change config');
945
- console.log(config);
946
965
  this.data.widgetInfo.widgetConfigInfo.config = config;
947
966
  this.refreshWidget(this.data.widgetInfo);
948
967
  this.updateWidget(this.data.widgetInfo);
@@ -977,7 +996,7 @@ var RAWidgetContainer = /** @class */ (function () {
977
996
  globalFilter: this.globalFilter
978
997
  }));
979
998
  /** @type {?} */
980
- var widgetCOntainer = this;
999
+ var widgetContainer = this;
981
1000
  this.dashboardService.loadExternalScript(widgetInfo.scriptUrl, (/**
982
1001
  * @return {?}
983
1002
  */
@@ -988,7 +1007,10 @@ var RAWidgetContainer = /** @class */ (function () {
988
1007
  * @return {?}
989
1008
  */
990
1009
  function () {
991
- widgetCOntainer.widgetElement.loadContent(widgetConfigFilter, _this.appConfig);
1010
+ widgetConfigFilter.appConfig = _this.appConfig;
1011
+ widgetConfigFilter.widgetInfo = (/** @type {?} */ ({}));
1012
+ widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1013
+ widgetContainer.widgetElement.loadContent(widgetConfigFilter, _this.appConfig);
992
1014
  }), 2000);
993
1015
  }));
994
1016
  };
@@ -1020,7 +1042,8 @@ var RAWidgetContainer = /** @class */ (function () {
1020
1042
  ];
1021
1043
  /** @nocollapse */
1022
1044
  RAWidgetContainer.ctorParameters = function () { return [
1023
- { type: RaDashboardService }
1045
+ { type: RaDashboardService },
1046
+ { type: NgxUiLoaderService }
1024
1047
  ]; };
1025
1048
  RAWidgetContainer.propDecorators = {
1026
1049
  ctlWidget: [{ type: ViewChild, args: ['ctlWidget', { static: false },] }],
@@ -3002,7 +3025,7 @@ var GridsterComponent = /** @class */ (function () {
3002
3025
  selector: 'gridster',
3003
3026
  template: "<div class=\"gridster-column\" *ngFor=\"let column of gridColumns; let i = index;\"\r\n [ngStyle]=\"gridRenderer.getGridColumnStyle(i)\"></div>\r\n<div class=\"gridster-row\" *ngFor=\"let row of gridRows; let i = index;\"\r\n [ngStyle]=\"gridRenderer.getGridRowStyle(i)\"></div>\r\n<ng-content></ng-content>\r\n<gridster-preview class=\"gridster-preview\"></gridster-preview>\r\n",
3004
3027
  encapsulation: ViewEncapsulation.None,
3005
- styles: ["gridster{clear:both;position:relative;box-sizing:border-box;background:grey;width:100%;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:block;overflow:auto}gridster.fit{overflow-x:hidden;overflow-y:hidden}gridster.scrollVertical{overflow-x:hidden;overflow-y:auto}gridster.scrollHorizontal{overflow-x:auto;overflow-y:hidden}gridster.fixed{overflow:auto}gridster.mobile{overflow-x:hidden;overflow-y:auto}gridster.mobile gridster-item{position:relative}gridster .gridster-column,gridster .gridster-row{position:absolute;display:none;transition:.3s;box-sizing:border-box}gridster.display-grid .gridster-column,gridster.display-grid .gridster-row{display:block}gridster .gridster-column{border-left:1px solid #ccc;border-right:1px solid #ccc}gridster .gridster-row{border-top:1px solid #ccc;border-bottom:1px solid #ccc}"]
3028
+ styles: ["gridster{clear:both;position:relative;box-sizing:border-box;background:#fff;width:100%;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:block;overflow:auto}gridster.fit{overflow-x:hidden;overflow-y:hidden}gridster.scrollVertical{overflow-x:hidden;overflow-y:auto}gridster.scrollHorizontal{overflow-x:auto;overflow-y:hidden}gridster.fixed{overflow:auto}gridster.mobile{overflow-x:hidden;overflow-y:auto}gridster.mobile gridster-item{position:relative}gridster .gridster-column,gridster .gridster-row{position:absolute;display:none;transition:.3s;box-sizing:border-box}gridster.display-grid .gridster-column,gridster.display-grid .gridster-row{display:block}gridster .gridster-column{border-left:1px solid #ccc;border-right:1px solid #ccc}gridster .gridster-row{border-top:1px solid #ccc;border-bottom:1px solid #ccc}"]
3006
3029
  }] }
3007
3030
  ];
3008
3031
  /** @nocollapse */
@@ -5548,7 +5571,8 @@ var DashboardFrameworkModule = /** @class */ (function () {
5548
5571
  imports: [
5549
5572
  BrowserModule,
5550
5573
  GridsterModule,
5551
- HttpClientModule
5574
+ HttpClientModule,
5575
+ NgxUiLoaderModule
5552
5576
  ],
5553
5577
  exports: [
5554
5578
  RADashboardArea