@schneideress/dashboardframework 0.0.183 → 0.0.184
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 +121 -67
- package/bundles/schneideress-dashboardframework.umd.js.map +1 -1
- package/bundles/schneideress-dashboardframework.umd.min.js +12 -12
- package/bundles/schneideress-dashboardframework.umd.min.js.map +1 -1
- package/esm2015/lib/ra-dashboard-area/ra.dashboard.area.js +51 -38
- package/esm2015/lib/ra-widget-container/ra.widget.container.component.js +2 -3
- package/esm2015/lib/ra.dashboard.responsive.service.js +50 -9
- package/esm5/lib/ra-dashboard-area/ra.dashboard.area.js +53 -43
- package/esm5/lib/ra-widget-container/ra.widget.container.component.js +2 -3
- package/esm5/lib/ra.dashboard.responsive.service.js +60 -9
- package/fesm2015/schneideress-dashboardframework.js +99 -47
- package/fesm2015/schneideress-dashboardframework.js.map +1 -1
- package/fesm5/schneideress-dashboardframework.js +111 -52
- package/fesm5/schneideress-dashboardframework.js.map +1 -1
- package/lib/ra-dashboard-area/ra.dashboard.area.d.ts +0 -1
- package/lib/ra.dashboard.responsive.service.d.ts +5 -0
- package/package.json +1 -1
- package/schneideress-dashboardframework.metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __extends, __awaiter, __generator, __assign } from 'tslib';
|
|
2
|
-
import { Injectable, Injector, ɵɵdefineInjectable, ɵɵinject, INJECTOR, Component, NgZone, Input, ViewChild,
|
|
2
|
+
import { Injectable, Injector, ɵɵdefineInjectable, ɵɵinject, INJECTOR, Component, NgZone, Input, ViewChild, EventEmitter, Renderer2, Output, ViewEncapsulation, ElementRef, ChangeDetectorRef, Host, NgModule } from '@angular/core';
|
|
3
3
|
import { of, Subject } from 'rxjs';
|
|
4
4
|
import { BaseService, RATranslateService, RAPermissionService, RACommonModule } from '@schneideress/ra-common';
|
|
5
5
|
import { filter, map } from 'rxjs/operators';
|
|
@@ -475,11 +475,13 @@ var GridsterConfigDefaultSettings = {
|
|
|
475
475
|
var RADashboardResponsiveService = /** @class */ (function () {
|
|
476
476
|
function RADashboardResponsiveService() {
|
|
477
477
|
var _this = this;
|
|
478
|
+
this.resized = new Subject();
|
|
479
|
+
this.maxColsDesktop = 8;
|
|
478
480
|
this.resInfo = [
|
|
479
|
-
{ 'start': 0, 'end': 767, 'minCols': 1, 'maxCols': 1 },
|
|
480
|
-
{ 'start': 768, 'end': 1024, 'minCols': 1, 'maxCols': 2 },
|
|
481
|
-
{ 'start': 1025, 'end': 1366, 'minCols': 1, 'maxCols': 6 },
|
|
482
|
-
{ 'start': 1367, 'end': 9999999999, 'minCols': 1, 'maxCols':
|
|
481
|
+
{ 'id': 1, 'start': 0, 'end': 767, 'minCols': 1, 'maxCols': 1 },
|
|
482
|
+
{ 'id': 2, 'start': 768, 'end': 1024, 'minCols': 1, 'maxCols': 2 },
|
|
483
|
+
{ 'id': 3, 'start': 1025, 'end': 1366, 'minCols': 1, 'maxCols': 6 },
|
|
484
|
+
{ 'id': 4, 'start': 1367, 'end': 9999999999, 'minCols': 1, 'maxCols': this.maxColsDesktop }
|
|
483
485
|
];
|
|
484
486
|
this.setScreenWidth();
|
|
485
487
|
window.addEventListener('resize', (/**
|
|
@@ -504,13 +506,18 @@ var RADashboardResponsiveService = /** @class */ (function () {
|
|
|
504
506
|
this.currentResInfo = this.resInfo[3];
|
|
505
507
|
}
|
|
506
508
|
else {
|
|
507
|
-
|
|
509
|
+
/** @type {?} */
|
|
510
|
+
var resInfo = this.resInfo.filter((/**
|
|
508
511
|
* @param {?} item
|
|
509
512
|
* @return {?}
|
|
510
513
|
*/
|
|
511
514
|
function (item) {
|
|
512
515
|
return item.end >= _this.screenWidth && item.start <= _this.screenWidth;
|
|
513
516
|
}))[0];
|
|
517
|
+
if (!this.currentResInfo || this.currentResInfo.id != resInfo.id) {
|
|
518
|
+
this.currentResInfo = resInfo;
|
|
519
|
+
this.resized.next();
|
|
520
|
+
}
|
|
514
521
|
}
|
|
515
522
|
};
|
|
516
523
|
Object.defineProperty(RADashboardResponsiveService.prototype, "IsDesktopView", {
|
|
@@ -588,13 +595,18 @@ var RADashboardResponsiveService = /** @class */ (function () {
|
|
|
588
595
|
* @return {?}
|
|
589
596
|
*/
|
|
590
597
|
function (widget) {
|
|
598
|
+
if (widget.widgetSettings && typeof widget.widgetSettings === 'string') {
|
|
599
|
+
widget.widgetSettings = JSON.parse(widget.widgetSettings);
|
|
600
|
+
}
|
|
591
601
|
/** @type {?} */
|
|
592
602
|
var gridsterItem = (/** @type {?} */ ({
|
|
593
603
|
cols: this.getWidth(widget.width),
|
|
594
604
|
rows: this.getHeight(widget.height),
|
|
595
605
|
x: this.IsDesktopView ? widget.position_x : 0,
|
|
596
606
|
y: this.IsDesktopView ? widget.position_y : 0,
|
|
597
|
-
widgetInfo: widget
|
|
607
|
+
widgetInfo: widget,
|
|
608
|
+
minItemRows: this.getMinItemRows(widget),
|
|
609
|
+
minItemCols: this.getMinItemCols(widget)
|
|
598
610
|
}));
|
|
599
611
|
return gridsterItem;
|
|
600
612
|
};
|
|
@@ -610,12 +622,46 @@ var RADashboardResponsiveService = /** @class */ (function () {
|
|
|
610
622
|
*/
|
|
611
623
|
function (width) {
|
|
612
624
|
if (!this.IsDesktopView) {
|
|
613
|
-
width = Math.floor(width /
|
|
625
|
+
width = Math.floor(width / this.maxColsDesktop * this.currentResInfo.maxCols);
|
|
614
626
|
if (width < this.currentResInfo.minCols)
|
|
615
627
|
width = this.currentResInfo.minCols;
|
|
616
628
|
}
|
|
617
629
|
return width;
|
|
618
630
|
};
|
|
631
|
+
/**
|
|
632
|
+
* @private
|
|
633
|
+
* @param {?} widget
|
|
634
|
+
* @return {?}
|
|
635
|
+
*/
|
|
636
|
+
RADashboardResponsiveService.prototype.getMinItemRows = /**
|
|
637
|
+
* @private
|
|
638
|
+
* @param {?} widget
|
|
639
|
+
* @return {?}
|
|
640
|
+
*/
|
|
641
|
+
function (widget) {
|
|
642
|
+
if (this.IsDesktopView) {
|
|
643
|
+
if (widget.widgetSettings && widget.widgetSettings.minRows) {
|
|
644
|
+
return widget.widgetSettings.minRows;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* @private
|
|
650
|
+
* @param {?} widget
|
|
651
|
+
* @return {?}
|
|
652
|
+
*/
|
|
653
|
+
RADashboardResponsiveService.prototype.getMinItemCols = /**
|
|
654
|
+
* @private
|
|
655
|
+
* @param {?} widget
|
|
656
|
+
* @return {?}
|
|
657
|
+
*/
|
|
658
|
+
function (widget) {
|
|
659
|
+
if (this.IsDesktopView) {
|
|
660
|
+
if (widget.widgetSettings && widget.widgetSettings.minCols) {
|
|
661
|
+
return widget.widgetSettings.minCols;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
};
|
|
619
665
|
/**
|
|
620
666
|
* @private
|
|
621
667
|
* @param {?} height
|
|
@@ -628,7 +674,7 @@ var RADashboardResponsiveService = /** @class */ (function () {
|
|
|
628
674
|
*/
|
|
629
675
|
function (height) {
|
|
630
676
|
if (!this.IsDesktopView) {
|
|
631
|
-
height = Math.floor(height /
|
|
677
|
+
height = Math.floor(height / this.maxColsDesktop * this.currentResInfo.maxCols);
|
|
632
678
|
if (height < this.currentResInfo.minCols)
|
|
633
679
|
height = this.currentResInfo.minCols;
|
|
634
680
|
}
|
|
@@ -643,6 +689,10 @@ var RADashboardResponsiveService = /** @class */ (function () {
|
|
|
643
689
|
return RADashboardResponsiveService;
|
|
644
690
|
}());
|
|
645
691
|
if (false) {
|
|
692
|
+
/** @type {?} */
|
|
693
|
+
RADashboardResponsiveService.prototype.resized;
|
|
694
|
+
/** @type {?} */
|
|
695
|
+
RADashboardResponsiveService.prototype.maxColsDesktop;
|
|
646
696
|
/**
|
|
647
697
|
* @type {?}
|
|
648
698
|
* @private
|
|
@@ -682,46 +732,41 @@ var RADashboardArea = /** @class */ (function () {
|
|
|
682
732
|
this.widgetWidth = 4;
|
|
683
733
|
}
|
|
684
734
|
/**
|
|
685
|
-
* @param {?} event
|
|
686
735
|
* @return {?}
|
|
687
736
|
*/
|
|
688
|
-
RADashboardArea.prototype.
|
|
689
|
-
* @param {?} event
|
|
737
|
+
RADashboardArea.prototype.ngOnInit = /**
|
|
690
738
|
* @return {?}
|
|
691
739
|
*/
|
|
692
|
-
function (
|
|
740
|
+
function () {
|
|
693
741
|
var _this = this;
|
|
694
|
-
this.
|
|
695
|
-
|
|
742
|
+
this.initiateGridsterConfig();
|
|
743
|
+
this.responsiveService.resized.subscribe((/**
|
|
696
744
|
* @return {?}
|
|
697
745
|
*/
|
|
698
746
|
function () {
|
|
699
|
-
_this.
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
_this.
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
747
|
+
_this.widgetList = [];
|
|
748
|
+
setTimeout((/**
|
|
749
|
+
* @return {?}
|
|
750
|
+
*/
|
|
751
|
+
function () {
|
|
752
|
+
_this.initiateGridsterConfig();
|
|
753
|
+
_this.options.api.optionsChanged();
|
|
754
|
+
if (_this.userWidgets) {
|
|
755
|
+
_this.widgetList = _this.mapObjectListToGridsterItemList(_this.userWidgets);
|
|
756
|
+
setTimeout((/**
|
|
757
|
+
* @return {?}
|
|
758
|
+
*/
|
|
759
|
+
function () {
|
|
760
|
+
_this.setAreaHeight();
|
|
761
|
+
}));
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
_this.loadWidgets(_this.userDashboardId, _this.areaKey);
|
|
765
|
+
}
|
|
766
|
+
_this.domResized = !_this.domResized;
|
|
767
|
+
}));
|
|
714
768
|
}));
|
|
715
769
|
};
|
|
716
|
-
/**
|
|
717
|
-
* @return {?}
|
|
718
|
-
*/
|
|
719
|
-
RADashboardArea.prototype.ngOnInit = /**
|
|
720
|
-
* @return {?}
|
|
721
|
-
*/
|
|
722
|
-
function () {
|
|
723
|
-
this.initiateGridsterConfig();
|
|
724
|
-
};
|
|
725
770
|
/**
|
|
726
771
|
* @param {?} changes
|
|
727
772
|
* @return {?}
|
|
@@ -757,11 +802,8 @@ var RADashboardArea = /** @class */ (function () {
|
|
|
757
802
|
* @return {?}
|
|
758
803
|
*/
|
|
759
804
|
function (gridster) {
|
|
760
|
-
console.log('grid inititalized');
|
|
761
|
-
console.log(_this.options.api);
|
|
762
805
|
if (_this.options.api) {
|
|
763
806
|
_this.gridcellHeight = _this.options.api.getCurrentRowHeight();
|
|
764
|
-
console.log('cell height is' + _this.gridcellHeight);
|
|
765
807
|
}
|
|
766
808
|
});
|
|
767
809
|
this.options.itemChangeCallback = (/**
|
|
@@ -1133,10 +1175,18 @@ var RADashboardArea = /** @class */ (function () {
|
|
|
1133
1175
|
* @return {?}
|
|
1134
1176
|
*/
|
|
1135
1177
|
function () {
|
|
1136
|
-
|
|
1137
|
-
this.
|
|
1138
|
-
|
|
1139
|
-
|
|
1178
|
+
var _this = this;
|
|
1179
|
+
for (var i = 0; i < this.userWidgets.length; i++) {
|
|
1180
|
+
this.userWidgets[i].position_x = 0;
|
|
1181
|
+
this.userWidgets[i].position_y = 0;
|
|
1182
|
+
this.widgetList = this.mapObjectListToGridsterItemList(this.userWidgets);
|
|
1183
|
+
setTimeout((/**
|
|
1184
|
+
* @return {?}
|
|
1185
|
+
*/
|
|
1186
|
+
function () {
|
|
1187
|
+
_this.setAreaHeight();
|
|
1188
|
+
}));
|
|
1189
|
+
}
|
|
1140
1190
|
};
|
|
1141
1191
|
/**To add widget instance to the database with the next available position and to make changes in
|
|
1142
1192
|
* dashboard area.
|
|
@@ -1157,6 +1207,17 @@ var RADashboardArea = /** @class */ (function () {
|
|
|
1157
1207
|
var _this = this;
|
|
1158
1208
|
data.height = this.widgetHeight;
|
|
1159
1209
|
data.width = this.widgetWidth;
|
|
1210
|
+
if (data.widgetSettings) {
|
|
1211
|
+
if (typeof data.widgetSettings === 'string')
|
|
1212
|
+
data.widgetSettings = JSON.parse(data.widgetSettings);
|
|
1213
|
+
if (data.widgetSettings.defaultCols) {
|
|
1214
|
+
data.width = data.widgetSettings.defaultCols;
|
|
1215
|
+
}
|
|
1216
|
+
if (data.widgetSettings.defaultRows) {
|
|
1217
|
+
data.height = data.widgetSettings.defaultRows;
|
|
1218
|
+
}
|
|
1219
|
+
data.widgetSettings = null;
|
|
1220
|
+
}
|
|
1160
1221
|
data = this.setPositions(data);
|
|
1161
1222
|
/** to find the available position in gridster, temp commenting the code-returning higher y value than normal */
|
|
1162
1223
|
data.dashboardAreaKey = this.areaKey;
|
|
@@ -1214,12 +1275,12 @@ var RADashboardArea = /** @class */ (function () {
|
|
|
1214
1275
|
if (this.userWidgets.length > 0) {
|
|
1215
1276
|
/** @type {?} */
|
|
1216
1277
|
var widget = this.userWidgets[this.userWidgets.length - 1];
|
|
1217
|
-
if (widget.position_x + widget.width >
|
|
1278
|
+
if (widget.position_x + widget.width > (this.responsiveService.maxColsDesktop / 2)) {
|
|
1218
1279
|
data.position_y = widget.position_y + 1;
|
|
1219
1280
|
}
|
|
1220
1281
|
else {
|
|
1221
1282
|
data.position_y = widget.position_y;
|
|
1222
|
-
data.position_x =
|
|
1283
|
+
data.position_x = this.responsiveService.maxColsDesktop - (widget.position_x + widget.width);
|
|
1223
1284
|
}
|
|
1224
1285
|
}
|
|
1225
1286
|
}
|
|
@@ -1337,8 +1398,7 @@ var RADashboardArea = /** @class */ (function () {
|
|
|
1337
1398
|
widgetHeight: [{ type: Input, args: ['widget-height',] }],
|
|
1338
1399
|
widgetWidth: [{ type: Input, args: ['widget-width',] }],
|
|
1339
1400
|
appConfig: [{ type: Input, args: ['app-config',] }],
|
|
1340
|
-
gridWrapper: [{ type: ViewChild, args: ['gridWrapper', { static: false },] }]
|
|
1341
|
-
onResize: [{ type: HostListener, args: ['window:resize', ['$event'],] }]
|
|
1401
|
+
gridWrapper: [{ type: ViewChild, args: ['gridWrapper', { static: false },] }]
|
|
1342
1402
|
};
|
|
1343
1403
|
return RADashboardArea;
|
|
1344
1404
|
}());
|
|
@@ -1799,7 +1859,7 @@ var RAWidgetContainer = /** @class */ (function () {
|
|
|
1799
1859
|
globalFilter: this.globalFilter,
|
|
1800
1860
|
configChanges: this.getConfigChanges(false)
|
|
1801
1861
|
}));
|
|
1802
|
-
if (widgetInfo.widgetSettings
|
|
1862
|
+
if (widgetInfo.widgetSettings) {
|
|
1803
1863
|
this.widgetSettings = this.getParsedConfig(widgetInfo.widgetSettings);
|
|
1804
1864
|
this.applayWidgetSettings(this.widgetSettings);
|
|
1805
1865
|
}
|
|
@@ -1893,7 +1953,6 @@ var RAWidgetContainer = /** @class */ (function () {
|
|
|
1893
1953
|
widgetConfigFilter.widgetInfo = widgetInfo;
|
|
1894
1954
|
widgetConfigFilter.configChanges = this.getConfigChanges(false);
|
|
1895
1955
|
widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
|
|
1896
|
-
console.log(widgetConfigFilter);
|
|
1897
1956
|
widgetContainer.widgetElement.loadContent(widgetConfigFilter);
|
|
1898
1957
|
return [4 /*yield*/, widgetContainer.setLock(widgetConfigFilter.config)];
|
|
1899
1958
|
case 1:
|