@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.
@@ -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.
@@ -114,9 +114,7 @@
114
114
  */
115
115
  function (widgetInfo, appConfig) {
116
116
  this.baseUrl = appConfig.apiBaseUrl;
117
- /** @type {?} */
118
- var url = 'widget/GetWidgetByArea';
119
- return this.post(url, widgetInfo);
117
+ return this.post('widget/GetWidgetByArea', widgetInfo);
120
118
  };
121
119
  /**
122
120
  * @param {?} widgetList
@@ -130,9 +128,7 @@
130
128
  */
131
129
  function (widgetList, appConfig) {
132
130
  this.baseUrl = appConfig.apiBaseUrl;
133
- /** @type {?} */
134
- var url = 'widget/UpdateAreaWidgets';
135
- return this.post(url, widgetList);
131
+ return this.post('widget/UpdateAreaWidgets', widgetList);
136
132
  };
137
133
  /**
138
134
  * @param {?} widgetInfo
@@ -181,9 +177,7 @@
181
177
  */
182
178
  function (widgetInfo, appConfig) {
183
179
  this.baseUrl = appConfig.apiBaseUrl;
184
- /** @type {?} */
185
- var url = 'widget/AddWidgetUser';
186
- return this.post(url, widgetInfo);
180
+ return this.post('widget/AddWidgetUser', widgetInfo);
187
181
  };
188
182
  /** To Delete current widget from DOM*/
189
183
  /**
@@ -200,9 +194,7 @@
200
194
  */
201
195
  function (widgetInfo, appConfig) {
202
196
  this.baseUrl = appConfig.apiBaseUrl;
203
- /** @type {?} */
204
- var url = 'widget/DeleteWidgetUser';
205
- return this.post(url, widgetInfo);
197
+ return this.post('widget/DeleteWidgetUser', widgetInfo);
206
198
  };
207
199
  /**To Update widgetInfo in database */
208
200
  /**
@@ -219,9 +211,7 @@
219
211
  */
220
212
  function (widgetInfo, appConfig) {
221
213
  this.baseUrl = appConfig.apiBaseUrl;
222
- /** @type {?} */
223
- var url = 'widget/UpdateUserWidget';
224
- return this.post(url, widgetInfo);
214
+ return this.post('widget/UpdateUserWidget', widgetInfo);
225
215
  };
226
216
  /** To Move or change position if current widget container*/
227
217
  /**
@@ -519,9 +509,10 @@
519
509
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
520
510
  */
521
511
  var RADashboardArea = /** @class */ (function () {
522
- function RADashboardArea(dashboardService, ngZone) {
512
+ function RADashboardArea(dashboardService, ngZone, ngxService) {
523
513
  this.dashboardService = dashboardService;
524
514
  this.ngZone = ngZone;
515
+ this.ngxService = ngxService;
525
516
  this.widgetList = Array();
526
517
  this.gridheight = 300;
527
518
  this.widgetHeight = 20;
@@ -534,18 +525,27 @@
534
525
  * @return {?}
535
526
  */
536
527
  function () {
537
- /**
538
- * To override default configuration values to the gridster control
539
- * @type {?}
540
- */
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 {?} */
541
541
  var areaContext = this;
542
+ /**To override default configuration values to the gridster control */
542
543
  this.options = GridsterConfigDefaultSettings;
543
544
  this.options.itemChangeCallback = (/**
544
545
  * @param {?} item
545
546
  * @return {?}
546
547
  */
547
548
  function (item) {
548
- console.log('in change call back');
549
549
  areaContext.setAreaHeight();
550
550
  areaContext.updateWidgets();
551
551
  });
@@ -575,6 +575,7 @@
575
575
  }));
576
576
  }
577
577
  if (this.raDashboardEventBus && this.userDashboardId && this.areaKey) {
578
+ this.initiateGridsterConfig();
578
579
  this.loadWidgets(this.userDashboardId, this.areaKey);
579
580
  }
580
581
  };
@@ -594,7 +595,6 @@
594
595
  * @return {?}
595
596
  */
596
597
  function () {
597
- console.log('in update widgets');
598
598
  this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
599
599
  * @param {?} widgets
600
600
  * @return {?}
@@ -619,19 +619,25 @@
619
619
  function (userDashboarId, areaKey) {
620
620
  var _this = this;
621
621
  /** @type {?} */
622
+ var areaContext = this;
623
+ /** @type {?} */
622
624
  var widgetInfo = (/** @type {?} */ ({
623
625
  dashboardId: userDashboarId.toString(),
624
626
  dashboardAreaKey: areaKey
625
627
  }));
626
- /** @type {?} */
627
- var widgets = this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe((/**
628
+ this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe((/**
628
629
  * @param {?} widgets
629
630
  * @return {?}
630
631
  */
631
632
  function (widgets) {
632
- if (widgets) {
633
- _this.widgetList = _this.mapObjectListToGridsterItemList(widgets);
634
- _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);
635
641
  }
636
642
  }));
637
643
  };
@@ -660,11 +666,17 @@
660
666
  areaScrollHeight = currentHeight;
661
667
  }
662
668
  }));
663
- areaHeight = areaScrollHeight * this.options.api.getCurrentRowHeight() + 2;
664
- if (areaHeight < 300) {
665
- 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);
666
679
  }
667
- this.gridheight = areaHeight;
668
680
  };
669
681
  /** To remove a widget instance from dashboard and to save info in database */
670
682
  /**
@@ -716,11 +728,14 @@
716
728
  data.position_y = 0;
717
729
  /** @type {?} */
718
730
  var gridsterItem = this.mapObjectsToGridsterItem(data);
719
- gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
731
+ if (this.options.api) {
732
+ gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
733
+ }
720
734
  data.position_x = gridsterItem.x;
721
735
  data.position_y = gridsterItem.y;
722
736
  data.dashboardAreaKey = this.areaKey;
723
737
  data.dashboardId = this.userDashboardId;
738
+ this.ngxService.start();
724
739
  this.dashboardService.addWidget(data, this.appConfig).subscribe((/**
725
740
  * @param {?} widget
726
741
  * @return {?}
@@ -729,6 +744,7 @@
729
744
  gridsterItem = _this.mapObjectsToGridsterItem(widget);
730
745
  _this.widgetList.push(gridsterItem);
731
746
  _this.setAreaHeight();
747
+ _this.ngxService.stop();
732
748
  }));
733
749
  };
734
750
  /**To map IwidgetInfo object to gridsterItem */
@@ -816,14 +832,15 @@
816
832
  RADashboardArea.decorators = [
817
833
  { type: core.Component, args: [{
818
834
  selector: 'ra-dashboard-area',
819
- 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",
820
- 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}"]
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",
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}"]
821
837
  }] }
822
838
  ];
823
839
  /** @nocollapse */
824
840
  RADashboardArea.ctorParameters = function () { return [
825
841
  { type: RaDashboardService },
826
- { type: core.NgZone }
842
+ { type: core.NgZone },
843
+ { type: ngxUiLoader.NgxUiLoaderService }
827
844
  ]; };
828
845
  RADashboardArea.propDecorators = {
829
846
  userDashboardId: [{ type: core.Input, args: ['user-dashboard-id',] }],
@@ -842,8 +859,9 @@
842
859
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
843
860
  */
844
861
  var RAWidgetContainer = /** @class */ (function () {
845
- function RAWidgetContainer(dashboardService) {
862
+ function RAWidgetContainer(dashboardService, ngxService) {
846
863
  this.dashboardService = dashboardService;
864
+ this.ngxService = ngxService;
847
865
  this.isIEOrEdge = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent);
848
866
  this.widgetDeleted = new core.EventEmitter();
849
867
  }
@@ -917,11 +935,13 @@
917
935
  */
918
936
  function () {
919
937
  var _this = this;
938
+ this.ngxService.start();
920
939
  this.dashboardService.deleteWidget(this.data.widgetInfo, this.appConfig).subscribe((/**
921
940
  * @param {?} status
922
941
  * @return {?}
923
942
  */
924
943
  function (status) {
944
+ _this.ngxService.stop();
925
945
  {
926
946
  _this.widgetDeleted.emit(_this.data.widgetInfo.widgetInstanceId);
927
947
  }
@@ -978,8 +998,6 @@
978
998
  * @return {?}
979
999
  */
980
1000
  function (config) {
981
- console.log('in config change config');
982
- console.log(config);
983
1001
  this.data.widgetInfo.widgetConfigInfo.config = config;
984
1002
  this.refreshWidget(this.data.widgetInfo);
985
1003
  this.updateWidget(this.data.widgetInfo);
@@ -1014,7 +1032,7 @@
1014
1032
  globalFilter: this.globalFilter
1015
1033
  }));
1016
1034
  /** @type {?} */
1017
- var widgetCOntainer = this;
1035
+ var widgetContainer = this;
1018
1036
  this.dashboardService.loadExternalScript(widgetInfo.scriptUrl, (/**
1019
1037
  * @return {?}
1020
1038
  */
@@ -1025,7 +1043,10 @@
1025
1043
  * @return {?}
1026
1044
  */
1027
1045
  function () {
1028
- widgetCOntainer.widgetElement.loadContent(widgetConfigFilter, _this.appConfig);
1046
+ widgetConfigFilter.appConfig = _this.appConfig;
1047
+ widgetConfigFilter.widgetInfo = (/** @type {?} */ ({}));
1048
+ widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1049
+ widgetContainer.widgetElement.loadContent(widgetConfigFilter, _this.appConfig);
1029
1050
  }), 2000);
1030
1051
  }));
1031
1052
  };
@@ -1057,7 +1078,8 @@
1057
1078
  ];
1058
1079
  /** @nocollapse */
1059
1080
  RAWidgetContainer.ctorParameters = function () { return [
1060
- { type: RaDashboardService }
1081
+ { type: RaDashboardService },
1082
+ { type: ngxUiLoader.NgxUiLoaderService }
1061
1083
  ]; };
1062
1084
  RAWidgetContainer.propDecorators = {
1063
1085
  ctlWidget: [{ type: core.ViewChild, args: ['ctlWidget', { static: false },] }],
@@ -3039,7 +3061,7 @@
3039
3061
  selector: 'gridster',
3040
3062
  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",
3041
3063
  encapsulation: core.ViewEncapsulation.None,
3042
- 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}"]
3064
+ 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}"]
3043
3065
  }] }
3044
3066
  ];
3045
3067
  /** @nocollapse */
@@ -5585,7 +5607,8 @@
5585
5607
  imports: [
5586
5608
  platformBrowser.BrowserModule,
5587
5609
  GridsterModule,
5588
- http.HttpClientModule
5610
+ http.HttpClientModule,
5611
+ ngxUiLoader.NgxUiLoaderModule
5589
5612
  ],
5590
5613
  exports: [
5591
5614
  RADashboardArea