@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.
- package/bundles/schneideress-dashboardframework.umd.js +70 -47
- package/bundles/schneideress-dashboardframework.umd.js.map +1 -1
- package/bundles/schneideress-dashboardframework.umd.min.js +1 -1
- package/bundles/schneideress-dashboardframework.umd.min.js.map +1 -1
- package/esm2015/gridster/lib/gridster.component.js +1 -1
- package/esm2015/lib/ra-dashboard-area/ra.dashboard.area.js +50 -21
- package/esm2015/lib/ra-widget-container/ra.widget.container.component.js +19 -7
- package/esm2015/lib/ra.dashboard.module.js +4 -2
- package/esm2015/lib/ra.dashboard.service.js +6 -16
- package/esm5/gridster/lib/gridster.component.js +1 -1
- package/esm5/lib/ra-dashboard-area/ra.dashboard.area.js +54 -21
- package/esm5/lib/ra-widget-container/ra.widget.container.component.js +18 -7
- package/esm5/lib/ra.dashboard.module.js +4 -2
- package/esm5/lib/ra.dashboard.service.js +6 -16
- package/fesm2015/schneideress-dashboardframework.js +64 -43
- package/fesm2015/schneideress-dashboardframework.js.map +1 -1
- package/fesm5/schneideress-dashboardframework.js +67 -43
- package/fesm5/schneideress-dashboardframework.js.map +1 -1
- package/lib/ra-dashboard-area/ra.dashboard.area.d.ts +5 -1
- package/lib/ra-widget-container/ra.widget.container.component.d.ts +3 -1
- package/package.json +1 -1
- package/schneideress-dashboardframework.metadata.json +1 -1
|
@@ -2,6 +2,7 @@ import { Injectable, Injector, ɵɵdefineInjectable, ɵɵinject, INJECTOR, Compo
|
|
|
2
2
|
import { of, Subject } from 'rxjs';
|
|
3
3
|
import { BaseService } from '@schneideress/ess-util';
|
|
4
4
|
import { filter, map } from 'rxjs/operators';
|
|
5
|
+
import { NgxUiLoaderService, NgxUiLoaderModule } from 'ngx-ui-loader';
|
|
5
6
|
import { BrowserModule } from '@angular/platform-browser';
|
|
6
7
|
import { HttpClientModule } from '@angular/common/http';
|
|
7
8
|
import { CommonModule } from '@angular/common';
|
|
@@ -55,9 +56,7 @@ class RaDashboardService extends BaseService {
|
|
|
55
56
|
*/
|
|
56
57
|
getWidgetsByDashboardArea(widgetInfo, appConfig) {
|
|
57
58
|
this.baseUrl = appConfig.apiBaseUrl;
|
|
58
|
-
|
|
59
|
-
var url = 'widget/GetWidgetByArea';
|
|
60
|
-
return this.post(url, widgetInfo);
|
|
59
|
+
return this.post('widget/GetWidgetByArea', widgetInfo);
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
63
62
|
* @param {?} widgetList
|
|
@@ -66,9 +65,7 @@ class RaDashboardService extends BaseService {
|
|
|
66
65
|
*/
|
|
67
66
|
updateWidgets(widgetList, appConfig) {
|
|
68
67
|
this.baseUrl = appConfig.apiBaseUrl;
|
|
69
|
-
|
|
70
|
-
var url = 'widget/UpdateAreaWidgets';
|
|
71
|
-
return this.post(url, widgetList);
|
|
68
|
+
return this.post('widget/UpdateAreaWidgets', widgetList);
|
|
72
69
|
}
|
|
73
70
|
/**
|
|
74
71
|
* @param {?} widgetInfo
|
|
@@ -95,9 +92,7 @@ class RaDashboardService extends BaseService {
|
|
|
95
92
|
*/
|
|
96
93
|
addWidget(widgetInfo, appConfig) {
|
|
97
94
|
this.baseUrl = appConfig.apiBaseUrl;
|
|
98
|
-
|
|
99
|
-
var url = 'widget/AddWidgetUser';
|
|
100
|
-
return this.post(url, widgetInfo);
|
|
95
|
+
return this.post('widget/AddWidgetUser', widgetInfo);
|
|
101
96
|
}
|
|
102
97
|
/**
|
|
103
98
|
* To Delete current widget from DOM
|
|
@@ -107,9 +102,7 @@ class RaDashboardService extends BaseService {
|
|
|
107
102
|
*/
|
|
108
103
|
deleteWidget(widgetInfo, appConfig) {
|
|
109
104
|
this.baseUrl = appConfig.apiBaseUrl;
|
|
110
|
-
|
|
111
|
-
var url = 'widget/DeleteWidgetUser';
|
|
112
|
-
return this.post(url, widgetInfo);
|
|
105
|
+
return this.post('widget/DeleteWidgetUser', widgetInfo);
|
|
113
106
|
}
|
|
114
107
|
/**
|
|
115
108
|
* To Update widgetInfo in database
|
|
@@ -119,9 +112,7 @@ class RaDashboardService extends BaseService {
|
|
|
119
112
|
*/
|
|
120
113
|
updateWidget(widgetInfo, appConfig) {
|
|
121
114
|
this.baseUrl = appConfig.apiBaseUrl;
|
|
122
|
-
|
|
123
|
-
var url = 'widget/UpdateUserWidget';
|
|
124
|
-
return this.post(url, widgetInfo);
|
|
115
|
+
return this.post('widget/UpdateUserWidget', widgetInfo);
|
|
125
116
|
}
|
|
126
117
|
/**
|
|
127
118
|
* To Move or change position if current widget container
|
|
@@ -364,10 +355,12 @@ class RADashboardArea {
|
|
|
364
355
|
/**
|
|
365
356
|
* @param {?} dashboardService
|
|
366
357
|
* @param {?} ngZone
|
|
358
|
+
* @param {?} ngxService
|
|
367
359
|
*/
|
|
368
|
-
constructor(dashboardService, ngZone) {
|
|
360
|
+
constructor(dashboardService, ngZone, ngxService) {
|
|
369
361
|
this.dashboardService = dashboardService;
|
|
370
362
|
this.ngZone = ngZone;
|
|
363
|
+
this.ngxService = ngxService;
|
|
371
364
|
this.widgetList = Array();
|
|
372
365
|
this.gridheight = 300;
|
|
373
366
|
this.widgetHeight = 20;
|
|
@@ -377,18 +370,22 @@ class RADashboardArea {
|
|
|
377
370
|
* @return {?}
|
|
378
371
|
*/
|
|
379
372
|
ngOnInit() {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
373
|
+
this.initiateGridsterConfig();
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* To set GridsterConfig
|
|
377
|
+
* @return {?}
|
|
378
|
+
*/
|
|
379
|
+
initiateGridsterConfig() {
|
|
380
|
+
/** @type {?} */
|
|
384
381
|
let areaContext = this;
|
|
382
|
+
/**To override default configuration values to the gridster control */
|
|
385
383
|
this.options = GridsterConfigDefaultSettings;
|
|
386
384
|
this.options.itemChangeCallback = (/**
|
|
387
385
|
* @param {?} item
|
|
388
386
|
* @return {?}
|
|
389
387
|
*/
|
|
390
388
|
function (item) {
|
|
391
|
-
console.log('in change call back');
|
|
392
389
|
areaContext.setAreaHeight();
|
|
393
390
|
areaContext.updateWidgets();
|
|
394
391
|
});
|
|
@@ -413,6 +410,7 @@ class RADashboardArea {
|
|
|
413
410
|
}));
|
|
414
411
|
}
|
|
415
412
|
if (this.raDashboardEventBus && this.userDashboardId && this.areaKey) {
|
|
413
|
+
this.initiateGridsterConfig();
|
|
416
414
|
this.loadWidgets(this.userDashboardId, this.areaKey);
|
|
417
415
|
}
|
|
418
416
|
}
|
|
@@ -426,7 +424,6 @@ class RADashboardArea {
|
|
|
426
424
|
* @return {?}
|
|
427
425
|
*/
|
|
428
426
|
updateWidgets() {
|
|
429
|
-
console.log('in update widgets');
|
|
430
427
|
this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
|
|
431
428
|
* @param {?} widgets
|
|
432
429
|
* @return {?}
|
|
@@ -442,20 +439,26 @@ class RADashboardArea {
|
|
|
442
439
|
* @return {?}
|
|
443
440
|
*/
|
|
444
441
|
loadWidgets(userDashboarId, areaKey) {
|
|
442
|
+
/** @type {?} */
|
|
443
|
+
let areaContext = this;
|
|
445
444
|
/** @type {?} */
|
|
446
445
|
let widgetInfo = (/** @type {?} */ ({
|
|
447
446
|
dashboardId: userDashboarId.toString(),
|
|
448
447
|
dashboardAreaKey: areaKey
|
|
449
448
|
}));
|
|
450
|
-
/**
|
|
451
|
-
let widgets = this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe((/**
|
|
449
|
+
this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe((/**
|
|
452
450
|
* @param {?} widgets
|
|
453
451
|
* @return {?}
|
|
454
452
|
*/
|
|
455
453
|
widgets => {
|
|
456
|
-
if (widgets) {
|
|
457
|
-
|
|
458
|
-
|
|
454
|
+
if (widgets && widgets.length > 0) {
|
|
455
|
+
areaContext.widgetList = this.mapObjectListToGridsterItemList(widgets);
|
|
456
|
+
setTimeout((/**
|
|
457
|
+
* @return {?}
|
|
458
|
+
*/
|
|
459
|
+
() => {
|
|
460
|
+
areaContext.setAreaHeight();
|
|
461
|
+
}), 2000);
|
|
459
462
|
}
|
|
460
463
|
}));
|
|
461
464
|
}
|
|
@@ -479,11 +482,17 @@ class RADashboardArea {
|
|
|
479
482
|
areaScrollHeight = currentHeight;
|
|
480
483
|
}
|
|
481
484
|
}));
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
areaHeight
|
|
485
|
+
if (this.options.api) {
|
|
486
|
+
areaHeight = areaScrollHeight * this.options.api.getCurrentRowHeight() + 2;
|
|
487
|
+
if (areaHeight < 300) {
|
|
488
|
+
areaHeight = 300;
|
|
489
|
+
}
|
|
490
|
+
this.gridheight = areaHeight;
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
console.log('api not defined');
|
|
494
|
+
console.log(this.options);
|
|
485
495
|
}
|
|
486
|
-
this.gridheight = areaHeight;
|
|
487
496
|
}
|
|
488
497
|
/**
|
|
489
498
|
* To remove a widget instance from dashboard and to save info in database
|
|
@@ -519,11 +528,14 @@ class RADashboardArea {
|
|
|
519
528
|
data.position_y = 0;
|
|
520
529
|
/** @type {?} */
|
|
521
530
|
let gridsterItem = this.mapObjectsToGridsterItem(data);
|
|
522
|
-
|
|
531
|
+
if (this.options.api) {
|
|
532
|
+
gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
|
|
533
|
+
}
|
|
523
534
|
data.position_x = gridsterItem.x;
|
|
524
535
|
data.position_y = gridsterItem.y;
|
|
525
536
|
data.dashboardAreaKey = this.areaKey;
|
|
526
537
|
data.dashboardId = this.userDashboardId;
|
|
538
|
+
this.ngxService.start();
|
|
527
539
|
this.dashboardService.addWidget(data, this.appConfig).subscribe((/**
|
|
528
540
|
* @param {?} widget
|
|
529
541
|
* @return {?}
|
|
@@ -532,6 +544,7 @@ class RADashboardArea {
|
|
|
532
544
|
gridsterItem = this.mapObjectsToGridsterItem(widget);
|
|
533
545
|
this.widgetList.push(gridsterItem);
|
|
534
546
|
this.setAreaHeight();
|
|
547
|
+
this.ngxService.stop();
|
|
535
548
|
}));
|
|
536
549
|
}
|
|
537
550
|
/**
|
|
@@ -600,14 +613,15 @@ class RADashboardArea {
|
|
|
600
613
|
RADashboardArea.decorators = [
|
|
601
614
|
{ type: Component, args: [{
|
|
602
615
|
selector: 'ra-dashboard-area',
|
|
603
|
-
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",
|
|
604
|
-
styles: ["gridster{width:inherit;
|
|
616
|
+
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",
|
|
617
|
+
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}"]
|
|
605
618
|
}] }
|
|
606
619
|
];
|
|
607
620
|
/** @nocollapse */
|
|
608
621
|
RADashboardArea.ctorParameters = () => [
|
|
609
622
|
{ type: RaDashboardService },
|
|
610
|
-
{ type: NgZone }
|
|
623
|
+
{ type: NgZone },
|
|
624
|
+
{ type: NgxUiLoaderService }
|
|
611
625
|
];
|
|
612
626
|
RADashboardArea.propDecorators = {
|
|
613
627
|
userDashboardId: [{ type: Input, args: ['user-dashboard-id',] }],
|
|
@@ -626,9 +640,11 @@ RADashboardArea.propDecorators = {
|
|
|
626
640
|
class RAWidgetContainer {
|
|
627
641
|
/**
|
|
628
642
|
* @param {?} dashboardService
|
|
643
|
+
* @param {?} ngxService
|
|
629
644
|
*/
|
|
630
|
-
constructor(dashboardService) {
|
|
645
|
+
constructor(dashboardService, ngxService) {
|
|
631
646
|
this.dashboardService = dashboardService;
|
|
647
|
+
this.ngxService = ngxService;
|
|
632
648
|
this.isIEOrEdge = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent);
|
|
633
649
|
this.widgetDeleted = new EventEmitter();
|
|
634
650
|
}
|
|
@@ -679,11 +695,13 @@ class RAWidgetContainer {
|
|
|
679
695
|
* @return {?}
|
|
680
696
|
*/
|
|
681
697
|
deleteWidget() {
|
|
698
|
+
this.ngxService.start();
|
|
682
699
|
this.dashboardService.deleteWidget(this.data.widgetInfo, this.appConfig).subscribe((/**
|
|
683
700
|
* @param {?} status
|
|
684
701
|
* @return {?}
|
|
685
702
|
*/
|
|
686
703
|
status => {
|
|
704
|
+
this.ngxService.stop();
|
|
687
705
|
{
|
|
688
706
|
this.widgetDeleted.emit(this.data.widgetInfo.widgetInstanceId);
|
|
689
707
|
}
|
|
@@ -718,8 +736,6 @@ class RAWidgetContainer {
|
|
|
718
736
|
* @return {?}
|
|
719
737
|
*/
|
|
720
738
|
configChangeEventHandler(config) {
|
|
721
|
-
console.log('in config change config');
|
|
722
|
-
console.log(config);
|
|
723
739
|
this.data.widgetInfo.widgetConfigInfo.config = config;
|
|
724
740
|
this.refreshWidget(this.data.widgetInfo);
|
|
725
741
|
this.updateWidget(this.data.widgetInfo);
|
|
@@ -743,7 +759,7 @@ class RAWidgetContainer {
|
|
|
743
759
|
globalFilter: this.globalFilter
|
|
744
760
|
}));
|
|
745
761
|
/** @type {?} */
|
|
746
|
-
let
|
|
762
|
+
let widgetContainer = this;
|
|
747
763
|
this.dashboardService.loadExternalScript(widgetInfo.scriptUrl, (/**
|
|
748
764
|
* @return {?}
|
|
749
765
|
*/
|
|
@@ -754,7 +770,10 @@ class RAWidgetContainer {
|
|
|
754
770
|
* @return {?}
|
|
755
771
|
*/
|
|
756
772
|
() => {
|
|
757
|
-
|
|
773
|
+
widgetConfigFilter.appConfig = this.appConfig;
|
|
774
|
+
widgetConfigFilter.widgetInfo = (/** @type {?} */ ({}));
|
|
775
|
+
widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
|
|
776
|
+
widgetContainer.widgetElement.loadContent(widgetConfigFilter, this.appConfig);
|
|
758
777
|
}), 2000);
|
|
759
778
|
}));
|
|
760
779
|
}
|
|
@@ -781,7 +800,8 @@ RAWidgetContainer.decorators = [
|
|
|
781
800
|
];
|
|
782
801
|
/** @nocollapse */
|
|
783
802
|
RAWidgetContainer.ctorParameters = () => [
|
|
784
|
-
{ type: RaDashboardService }
|
|
803
|
+
{ type: RaDashboardService },
|
|
804
|
+
{ type: NgxUiLoaderService }
|
|
785
805
|
];
|
|
786
806
|
RAWidgetContainer.propDecorators = {
|
|
787
807
|
ctlWidget: [{ type: ViewChild, args: ['ctlWidget', { static: false },] }],
|
|
@@ -2503,7 +2523,7 @@ GridsterComponent.decorators = [
|
|
|
2503
2523
|
selector: 'gridster',
|
|
2504
2524
|
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",
|
|
2505
2525
|
encapsulation: ViewEncapsulation.None,
|
|
2506
|
-
styles: ["gridster{clear:both;position:relative;box-sizing:border-box;background
|
|
2526
|
+
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}"]
|
|
2507
2527
|
}] }
|
|
2508
2528
|
];
|
|
2509
2529
|
/** @nocollapse */
|
|
@@ -4736,7 +4756,8 @@ DashboardFrameworkModule.decorators = [
|
|
|
4736
4756
|
imports: [
|
|
4737
4757
|
BrowserModule,
|
|
4738
4758
|
GridsterModule,
|
|
4739
|
-
HttpClientModule
|
|
4759
|
+
HttpClientModule,
|
|
4760
|
+
NgxUiLoaderModule
|
|
4740
4761
|
],
|
|
4741
4762
|
exports: [
|
|
4742
4763
|
RADashboardArea
|