@schneideress/dashboardframework 0.0.146 → 0.0.148
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 +334 -135
- package/bundles/schneideress-dashboardframework.umd.js.map +1 -1
- package/bundles/schneideress-dashboardframework.umd.min.js +11 -11
- package/bundles/schneideress-dashboardframework.umd.min.js.map +1 -1
- package/esm2015/lib/ra-dashboard-area/ra.dashboard.area.js +146 -87
- package/esm2015/lib/ra.base.dashboard.template.js +2 -20
- package/esm2015/lib/ra.dashboard.responsive.service.js +135 -0
- package/esm2015/lib/ra.event.enum.js +3 -1
- package/esm2015/public-api.js +2 -1
- package/esm2015/schneideress-dashboardframework.js +2 -2
- package/esm5/lib/ra-dashboard-area/ra.dashboard.area.js +158 -104
- package/esm5/lib/ra.base.dashboard.template.js +2 -20
- package/esm5/lib/ra.dashboard.responsive.service.js +167 -0
- package/esm5/lib/ra.event.enum.js +3 -1
- package/esm5/public-api.js +2 -1
- package/esm5/schneideress-dashboardframework.js +2 -2
- package/fesm2015/schneideress-dashboardframework.js +280 -103
- package/fesm2015/schneideress-dashboardframework.js.map +1 -1
- package/fesm5/schneideress-dashboardframework.js +323 -120
- package/fesm5/schneideress-dashboardframework.js.map +1 -1
- package/lib/ra-dashboard-area/ra.dashboard.area.d.ts +9 -5
- package/lib/ra.base.dashboard.template.d.ts +0 -3
- package/lib/ra.dashboard.responsive.service.d.ts +15 -0
- package/lib/ra.event.enum.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/schneideress-dashboardframework.metadata.json +1 -1
|
@@ -254,6 +254,8 @@ const RAEvent = {
|
|
|
254
254
|
ConfigAddClick: "configAddClick",
|
|
255
255
|
/** triggers when a user click on the save button in widget configuration window */
|
|
256
256
|
ConfigChanged: "configChanged",
|
|
257
|
+
/**To rearrange widgets in a dashboard */
|
|
258
|
+
RearrangeClicked: "rearrangeClicked",
|
|
257
259
|
/**dashboard customize button click */
|
|
258
260
|
DashboardCustomizeClick: "dashboardCustomizeClick",
|
|
259
261
|
/**triggers when user clicks on the dashboard change icon in header section */
|
|
@@ -571,6 +573,138 @@ const GridsterConfigDefaultSettings = {
|
|
|
571
573
|
//itemInitCallback: (item) => this.itemInitCallback(item)
|
|
572
574
|
};
|
|
573
575
|
|
|
576
|
+
/**
|
|
577
|
+
* @fileoverview added by tsickle
|
|
578
|
+
* Generated from: lib/ra.dashboard.responsive.service.ts
|
|
579
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
580
|
+
*/
|
|
581
|
+
/** @type {?} */
|
|
582
|
+
const DesktopViewStart = 1367;
|
|
583
|
+
class RADashboardResponsiveService {
|
|
584
|
+
constructor() {
|
|
585
|
+
this.resInfo = [
|
|
586
|
+
{ 'start': 0, 'end': 767, 'minCols': 1, 'maxCols': 1 },
|
|
587
|
+
{ 'start': 768, 'end': 1024, 'minCols': 1, 'maxCols': 2 },
|
|
588
|
+
{ 'start': 1025, 'end': DesktopViewStart - 1, 'minCols': 2, 'maxCols': 6 },
|
|
589
|
+
{ 'start': DesktopViewStart, 'end': 9999999999, 'minCols': 2, 'maxCols': 10 }
|
|
590
|
+
];
|
|
591
|
+
this.setScreenWidth();
|
|
592
|
+
window.addEventListener('resize', (/**
|
|
593
|
+
* @return {?}
|
|
594
|
+
*/
|
|
595
|
+
() => {
|
|
596
|
+
this.setScreenWidth();
|
|
597
|
+
}));
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* @private
|
|
601
|
+
* @return {?}
|
|
602
|
+
*/
|
|
603
|
+
setScreenWidth() {
|
|
604
|
+
this.screenWidth = screen.width;
|
|
605
|
+
this.currentResInfo = this.resInfo.filter((/**
|
|
606
|
+
* @param {?} item
|
|
607
|
+
* @return {?}
|
|
608
|
+
*/
|
|
609
|
+
(item) => {
|
|
610
|
+
return item.end >= this.screenWidth && item.start <= this.screenWidth;
|
|
611
|
+
}))[0];
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* @return {?}
|
|
615
|
+
*/
|
|
616
|
+
get IsDesktopView() {
|
|
617
|
+
return this.screenWidth >= DesktopViewStart;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* @return {?}
|
|
621
|
+
*/
|
|
622
|
+
get GridsterConfig() {
|
|
623
|
+
/** @type {?} */
|
|
624
|
+
let config = GridsterConfigDefaultSettings;
|
|
625
|
+
config.minCols = this.currentResInfo.maxCols;
|
|
626
|
+
config.maxCols = this.currentResInfo.maxCols;
|
|
627
|
+
config.minRows = this.currentResInfo.minCols;
|
|
628
|
+
config.maxItemCols = this.currentResInfo.maxCols;
|
|
629
|
+
config.minItemCols = this.currentResInfo.minCols;
|
|
630
|
+
config.minItemRows = this.currentResInfo.minCols;
|
|
631
|
+
config.minItemArea = this.currentResInfo.minCols * this.currentResInfo.minCols;
|
|
632
|
+
config.defaultItemCols = this.currentResInfo.minCols;
|
|
633
|
+
config.defaultItemRows = this.currentResInfo.minCols;
|
|
634
|
+
if (!this.IsDesktopView) {
|
|
635
|
+
config.resizable.enabled = false;
|
|
636
|
+
config.swap = false;
|
|
637
|
+
config.draggable.enabled = false;
|
|
638
|
+
}
|
|
639
|
+
return config;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* To map IwidgetInfo object to gridsterItem
|
|
643
|
+
* @param {?} widget
|
|
644
|
+
* @return {?}
|
|
645
|
+
*/
|
|
646
|
+
getGridsterItem(widget) {
|
|
647
|
+
/** @type {?} */
|
|
648
|
+
let gridsterItem = (/** @type {?} */ ({
|
|
649
|
+
cols: this.getWidth(widget.width),
|
|
650
|
+
rows: this.getHeight(widget.height),
|
|
651
|
+
x: this.IsDesktopView ? widget.position_x : 0,
|
|
652
|
+
y: this.IsDesktopView ? widget.position_y : 0,
|
|
653
|
+
widgetInfo: widget
|
|
654
|
+
}));
|
|
655
|
+
return gridsterItem;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* @private
|
|
659
|
+
* @param {?} width
|
|
660
|
+
* @return {?}
|
|
661
|
+
*/
|
|
662
|
+
getWidth(width) {
|
|
663
|
+
if (!this.IsDesktopView) {
|
|
664
|
+
width = Math.floor(width / 10 * this.currentResInfo.maxCols);
|
|
665
|
+
if (width < this.currentResInfo.minCols)
|
|
666
|
+
width = this.currentResInfo.minCols;
|
|
667
|
+
}
|
|
668
|
+
return width;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* @private
|
|
672
|
+
* @param {?} height
|
|
673
|
+
* @return {?}
|
|
674
|
+
*/
|
|
675
|
+
getHeight(height) {
|
|
676
|
+
if (!this.IsDesktopView) {
|
|
677
|
+
height = Math.floor(height / 10 * this.currentResInfo.maxCols);
|
|
678
|
+
if (height < this.currentResInfo.minCols)
|
|
679
|
+
height = this.currentResInfo.minCols;
|
|
680
|
+
}
|
|
681
|
+
return height;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
RADashboardResponsiveService.decorators = [
|
|
685
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
|
686
|
+
];
|
|
687
|
+
/** @nocollapse */
|
|
688
|
+
RADashboardResponsiveService.ctorParameters = () => [];
|
|
689
|
+
/** @nocollapse */ RADashboardResponsiveService.ngInjectableDef = ɵɵdefineInjectable({ factory: function RADashboardResponsiveService_Factory() { return new RADashboardResponsiveService(); }, token: RADashboardResponsiveService, providedIn: "root" });
|
|
690
|
+
if (false) {
|
|
691
|
+
/**
|
|
692
|
+
* @type {?}
|
|
693
|
+
* @private
|
|
694
|
+
*/
|
|
695
|
+
RADashboardResponsiveService.prototype.screenWidth;
|
|
696
|
+
/**
|
|
697
|
+
* @type {?}
|
|
698
|
+
* @private
|
|
699
|
+
*/
|
|
700
|
+
RADashboardResponsiveService.prototype.resInfo;
|
|
701
|
+
/**
|
|
702
|
+
* @type {?}
|
|
703
|
+
* @private
|
|
704
|
+
*/
|
|
705
|
+
RADashboardResponsiveService.prototype.currentResInfo;
|
|
706
|
+
}
|
|
707
|
+
|
|
574
708
|
/**
|
|
575
709
|
* @fileoverview added by tsickle
|
|
576
710
|
* Generated from: lib/ra-dashboard-area/ra.dashboard.area.ts
|
|
@@ -583,13 +717,15 @@ class RADashboardArea {
|
|
|
583
717
|
* @param {?} ngxService
|
|
584
718
|
* @param {?} translateService
|
|
585
719
|
* @param {?} notifier
|
|
720
|
+
* @param {?} responsiveService
|
|
586
721
|
*/
|
|
587
|
-
constructor(dashboardService, ngZone, ngxService, translateService, notifier) {
|
|
722
|
+
constructor(dashboardService, ngZone, ngxService, translateService, notifier, responsiveService) {
|
|
588
723
|
this.dashboardService = dashboardService;
|
|
589
724
|
this.ngZone = ngZone;
|
|
590
725
|
this.ngxService = ngxService;
|
|
591
726
|
this.translateService = translateService;
|
|
592
727
|
this.notifier = notifier;
|
|
728
|
+
this.responsiveService = responsiveService;
|
|
593
729
|
this.widgetList = Array();
|
|
594
730
|
this.gridheight = 300;
|
|
595
731
|
this.gridcellHeight = 0;
|
|
@@ -603,30 +739,28 @@ class RADashboardArea {
|
|
|
603
739
|
* @return {?}
|
|
604
740
|
*/
|
|
605
741
|
onResize(event) {
|
|
606
|
-
|
|
607
|
-
var areaContext = this;
|
|
742
|
+
this.widgetList = [];
|
|
608
743
|
setTimeout((/**
|
|
609
744
|
* @return {?}
|
|
610
745
|
*/
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
746
|
+
() => {
|
|
747
|
+
this.initiateGridsterConfig();
|
|
748
|
+
this.options.api.optionsChanged();
|
|
749
|
+
if (this.userWidgets) {
|
|
750
|
+
this.widgetList = this.mapObjectListToGridsterItemList(this.userWidgets);
|
|
751
|
+
this.setAreaHeight();
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
this.loadWidgets(this.userDashboardId, this.areaKey);
|
|
755
|
+
}
|
|
756
|
+
this.domResized = !this.domResized;
|
|
757
|
+
}));
|
|
615
758
|
}
|
|
616
759
|
/**
|
|
617
760
|
* @return {?}
|
|
618
761
|
*/
|
|
619
762
|
ngOnInit() {
|
|
620
763
|
this.initiateGridsterConfig();
|
|
621
|
-
this.widgetRearrangeSubject.subscribe((/**
|
|
622
|
-
* @param {?} event
|
|
623
|
-
* @return {?}
|
|
624
|
-
*/
|
|
625
|
-
event => {
|
|
626
|
-
console.log('in subscribe subject & value is');
|
|
627
|
-
console.log(event);
|
|
628
|
-
this.rearrangeWidgets();
|
|
629
|
-
}));
|
|
630
764
|
}
|
|
631
765
|
/**
|
|
632
766
|
* @param {?} changes
|
|
@@ -641,27 +775,24 @@ class RADashboardArea {
|
|
|
641
775
|
this.inititateEventBusSubscritions();
|
|
642
776
|
}
|
|
643
777
|
}
|
|
644
|
-
// public invokeResizeEvent() {
|
|
645
|
-
// this.widgetContainers.forEach(function(container,i){
|
|
646
|
-
// container.invokeWidgetResizedEvent();
|
|
647
|
-
// });
|
|
648
|
-
// }
|
|
649
778
|
/**
|
|
650
779
|
* To set GridsterConfig
|
|
651
780
|
* @return {?}
|
|
652
781
|
*/
|
|
653
782
|
initiateGridsterConfig() {
|
|
654
|
-
/** @type {?} */
|
|
655
|
-
let areaContext = this;
|
|
656
783
|
/**To override default configuration values to the gridster control */
|
|
657
|
-
this.options =
|
|
784
|
+
this.options = this.responsiveService.GridsterConfig;
|
|
658
785
|
this.options.itemChangeCallback = (/**
|
|
659
786
|
* @param {?} item
|
|
660
787
|
* @return {?}
|
|
661
788
|
*/
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
789
|
+
(item) => {
|
|
790
|
+
if (this.responsiveService.IsDesktopView) {
|
|
791
|
+
if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
|
|
792
|
+
this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
this.setAreaHeight();
|
|
665
796
|
});
|
|
666
797
|
}
|
|
667
798
|
/**
|
|
@@ -705,6 +836,18 @@ class RADashboardArea {
|
|
|
705
836
|
this.addWidget(e);
|
|
706
837
|
}));
|
|
707
838
|
}));
|
|
839
|
+
this.rearrangeWidgetClick = this.raDashboardEventBus.subscribe(RAEvent.RearrangeClicked).subscribe((/**
|
|
840
|
+
* @param {?} e
|
|
841
|
+
* @return {?}
|
|
842
|
+
*/
|
|
843
|
+
(e) => {
|
|
844
|
+
this.ngZone.run((/**
|
|
845
|
+
* @return {?}
|
|
846
|
+
*/
|
|
847
|
+
() => {
|
|
848
|
+
this.rearrangeWidgets();
|
|
849
|
+
}));
|
|
850
|
+
}));
|
|
708
851
|
this.widgetLibraryDoneClick = this.raDashboardEventBus.subscribe(RAEvent.widgetLibraryDoneClick).subscribe((/**
|
|
709
852
|
* @param {?} widgetList
|
|
710
853
|
* @return {?}
|
|
@@ -715,9 +858,6 @@ class RADashboardArea {
|
|
|
715
858
|
*/
|
|
716
859
|
() => {
|
|
717
860
|
if (widgetList) {
|
|
718
|
-
// widgetList.forEach(widgetInfo => {
|
|
719
|
-
// this.addWidget(widgetInfo);
|
|
720
|
-
// });
|
|
721
861
|
this.addWidgetListToGridster(widgetList, 0);
|
|
722
862
|
}
|
|
723
863
|
}));
|
|
@@ -765,8 +905,8 @@ class RADashboardArea {
|
|
|
765
905
|
this.widgetDeleteEvent.unsubscribe();
|
|
766
906
|
if (this.widgetLibraryDoneClick)
|
|
767
907
|
this.widgetLibraryDoneClick.unsubscribe();
|
|
768
|
-
if (this.
|
|
769
|
-
this.
|
|
908
|
+
if (this.rearrangeWidgetClick)
|
|
909
|
+
this.rearrangeWidgetClick.unsubscribe();
|
|
770
910
|
}
|
|
771
911
|
/**
|
|
772
912
|
* To update position/dimention of all widgets in the area
|
|
@@ -781,6 +921,57 @@ class RADashboardArea {
|
|
|
781
921
|
}));
|
|
782
922
|
return true;
|
|
783
923
|
}
|
|
924
|
+
/**
|
|
925
|
+
* To update widget dimensions
|
|
926
|
+
* @param {?} widgetInstanceId
|
|
927
|
+
* @return {?}
|
|
928
|
+
*/
|
|
929
|
+
updateWidgetPosition(widgetInstanceId) {
|
|
930
|
+
/** @type {?} */
|
|
931
|
+
let widgetFilteredList = [];
|
|
932
|
+
/** @type {?} */
|
|
933
|
+
let widget = this.widgetList.filter((/**
|
|
934
|
+
* @param {?} filtered
|
|
935
|
+
* @return {?}
|
|
936
|
+
*/
|
|
937
|
+
filtered => filtered.widgetInfo && filtered.widgetInfo.widgetInstanceId == widgetInstanceId));
|
|
938
|
+
if (widget && widget.length > 0) {
|
|
939
|
+
widgetFilteredList.push(widget[0]);
|
|
940
|
+
/** @type {?} */
|
|
941
|
+
let widgetList = this.mapGridsterListToObject(widgetFilteredList);
|
|
942
|
+
this.dashboardService.updateWidgets(this.formatWidgetDataForPositionDetails(widgetList), this.appConfig).subscribe((/**
|
|
943
|
+
* @param {?} widgets
|
|
944
|
+
* @return {?}
|
|
945
|
+
*/
|
|
946
|
+
widgets => {
|
|
947
|
+
}));
|
|
948
|
+
}
|
|
949
|
+
return true;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* To restrict request payload to be of min size (position & size details)
|
|
953
|
+
* @param {?} widgetItemList
|
|
954
|
+
* @return {?}
|
|
955
|
+
*/
|
|
956
|
+
formatWidgetDataForPositionDetails(widgetItemList) {
|
|
957
|
+
/** @type {?} */
|
|
958
|
+
let itemList = [];
|
|
959
|
+
widgetItemList.forEach((/**
|
|
960
|
+
* @param {?} widgetItem
|
|
961
|
+
* @return {?}
|
|
962
|
+
*/
|
|
963
|
+
function (widgetItem) {
|
|
964
|
+
/** @type {?} */
|
|
965
|
+
let item = (/** @type {?} */ ({}));
|
|
966
|
+
item.widgetInstanceId = widgetItem.widgetInstanceId;
|
|
967
|
+
item.position_x = widgetItem.position_x;
|
|
968
|
+
item.position_y = widgetItem.position_y;
|
|
969
|
+
item.width = widgetItem.width;
|
|
970
|
+
item.height = widgetItem.height;
|
|
971
|
+
itemList.push(item);
|
|
972
|
+
}));
|
|
973
|
+
return itemList;
|
|
974
|
+
}
|
|
784
975
|
/**
|
|
785
976
|
* To retrieve widgets based on userDashboardid and area name
|
|
786
977
|
* @param {?} userDashboarId
|
|
@@ -788,22 +979,37 @@ class RADashboardArea {
|
|
|
788
979
|
* @return {?}
|
|
789
980
|
*/
|
|
790
981
|
loadWidgets(userDashboarId, areaKey) {
|
|
791
|
-
/** @type {?} */
|
|
792
|
-
let areaContext = this;
|
|
793
982
|
/** @type {?} */
|
|
794
983
|
let widgetInfo = (/** @type {?} */ ({
|
|
795
984
|
dashboardId: userDashboarId.toString(),
|
|
796
985
|
dashboardAreaKey: areaKey
|
|
797
986
|
}));
|
|
798
|
-
|
|
987
|
+
this.widgetList = [];
|
|
799
988
|
this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe((/**
|
|
800
989
|
* @param {?} widgets
|
|
801
990
|
* @return {?}
|
|
802
991
|
*/
|
|
803
992
|
widgets => {
|
|
993
|
+
//sorting the widgets y, x
|
|
994
|
+
widgets = widgets.sort((/**
|
|
995
|
+
* @param {?} a
|
|
996
|
+
* @param {?} b
|
|
997
|
+
* @return {?}
|
|
998
|
+
*/
|
|
999
|
+
(a, b) => {
|
|
1000
|
+
if (a['position_y'] > b['position_y'])
|
|
1001
|
+
return 1;
|
|
1002
|
+
if (a['position_y'] < b['position_y'])
|
|
1003
|
+
return -1;
|
|
1004
|
+
if (a['position_x'] > b['position_x'])
|
|
1005
|
+
return 1;
|
|
1006
|
+
if (a['position_x'] < b['position_x'])
|
|
1007
|
+
return -1;
|
|
1008
|
+
}));
|
|
1009
|
+
this.userWidgets = widgets;
|
|
804
1010
|
if (widgets && widgets.length > 0) {
|
|
805
|
-
|
|
806
|
-
|
|
1011
|
+
this.widgetList = this.mapObjectListToGridsterItemList(widgets);
|
|
1012
|
+
this.setAreaHeight();
|
|
807
1013
|
}
|
|
808
1014
|
}));
|
|
809
1015
|
}
|
|
@@ -855,7 +1061,6 @@ class RADashboardArea {
|
|
|
855
1061
|
areaHeight = 600;
|
|
856
1062
|
}
|
|
857
1063
|
this.gridheight = areaHeight;
|
|
858
|
-
console.log('area height adjusted1');
|
|
859
1064
|
}
|
|
860
1065
|
/**
|
|
861
1066
|
* To remove a widget instance from dashboard and to save info in database
|
|
@@ -885,7 +1090,6 @@ class RADashboardArea {
|
|
|
885
1090
|
* @return {?}
|
|
886
1091
|
*/
|
|
887
1092
|
rearrangeWidgets() {
|
|
888
|
-
console.log('in rearrange widgets methd');
|
|
889
1093
|
this.options.compactType = 'compactUp&Left';
|
|
890
1094
|
this.options.api.optionsChanged();
|
|
891
1095
|
this.options.compactType = 'none';
|
|
@@ -898,20 +1102,11 @@ class RADashboardArea {
|
|
|
898
1102
|
* @return {?}
|
|
899
1103
|
*/
|
|
900
1104
|
addWidget(data) {
|
|
901
|
-
/** @type {?} */
|
|
902
|
-
let widgetid = data.widgetId;
|
|
903
1105
|
data.height = this.widgetHeight;
|
|
904
1106
|
data.width = this.widgetWidth;
|
|
905
1107
|
data.position_x = 0;
|
|
906
1108
|
data.position_y = 0;
|
|
907
|
-
/** @type {?} */
|
|
908
|
-
let gridsterItem = this.mapObjectsToGridsterItem(data);
|
|
909
1109
|
/** to find the available position in gridster, temp commenting the code-returning higher y value than normal */
|
|
910
|
-
// if (this.options.api) {
|
|
911
|
-
// gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
|
|
912
|
-
// }
|
|
913
|
-
// data.position_x = gridsterItem.x;
|
|
914
|
-
// data.position_y = gridsterItem.y;
|
|
915
1110
|
data.dashboardAreaKey = this.areaKey;
|
|
916
1111
|
data.dashboardId = this.userDashboardId;
|
|
917
1112
|
this.ngxService.start();
|
|
@@ -920,7 +1115,8 @@ class RADashboardArea {
|
|
|
920
1115
|
* @return {?}
|
|
921
1116
|
*/
|
|
922
1117
|
widget => {
|
|
923
|
-
|
|
1118
|
+
/** @type {?} */
|
|
1119
|
+
let gridsterItem = this.responsiveService.getGridsterItem(widget);
|
|
924
1120
|
this.widgetList.push(gridsterItem);
|
|
925
1121
|
this.setAreaHeight();
|
|
926
1122
|
if (this.options.api) {
|
|
@@ -931,13 +1127,18 @@ class RADashboardArea {
|
|
|
931
1127
|
this.gridcellHeight = curRowHeight;
|
|
932
1128
|
}
|
|
933
1129
|
}
|
|
934
|
-
/**
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
1130
|
+
/** @type {?} */
|
|
1131
|
+
var widgetInstanceId = 0;
|
|
1132
|
+
if (widget && widget.widgetInstanceId) {
|
|
1133
|
+
widgetInstanceId = widget.widgetInstanceId;
|
|
1134
|
+
/**To save added widget position in db */
|
|
1135
|
+
setTimeout((/**
|
|
1136
|
+
* @return {?}
|
|
1137
|
+
*/
|
|
1138
|
+
() => {
|
|
1139
|
+
this.updateWidgetPosition(widgetInstanceId);
|
|
1140
|
+
}), 1000);
|
|
1141
|
+
}
|
|
941
1142
|
this.raDashboardEventBus.publish(RAEvent.WidgetAdded, widget);
|
|
942
1143
|
}));
|
|
943
1144
|
}
|
|
@@ -947,33 +1148,13 @@ class RADashboardArea {
|
|
|
947
1148
|
* @return {?}
|
|
948
1149
|
*/
|
|
949
1150
|
copyWidget(data) {
|
|
1151
|
+
data.position_x = 0;
|
|
1152
|
+
data.position_y = 0;
|
|
950
1153
|
/** @type {?} */
|
|
951
|
-
let gridsterItem = this.
|
|
952
|
-
if (this.options.api) {
|
|
953
|
-
gridsterItem = this.options.api.getFirstPossiblePosition(gridsterItem);
|
|
954
|
-
}
|
|
955
|
-
data.position_x = gridsterItem.x;
|
|
956
|
-
data.position_y = gridsterItem.y;
|
|
957
|
-
gridsterItem = this.mapObjectsToGridsterItem(data);
|
|
1154
|
+
let gridsterItem = this.responsiveService.getGridsterItem(data);
|
|
958
1155
|
this.widgetList.push(gridsterItem);
|
|
959
1156
|
this.setAreaHeight();
|
|
960
1157
|
}
|
|
961
|
-
/**
|
|
962
|
-
* To map IwidgetInfo object to gridsterItem
|
|
963
|
-
* @param {?} widget
|
|
964
|
-
* @return {?}
|
|
965
|
-
*/
|
|
966
|
-
mapObjectsToGridsterItem(widget) {
|
|
967
|
-
/** @type {?} */
|
|
968
|
-
let gridsterItem = (/** @type {?} */ ({
|
|
969
|
-
cols: widget.width,
|
|
970
|
-
rows: widget.height,
|
|
971
|
-
x: widget.position_x,
|
|
972
|
-
y: widget.position_y,
|
|
973
|
-
widgetInfo: widget
|
|
974
|
-
}));
|
|
975
|
-
return gridsterItem;
|
|
976
|
-
}
|
|
977
1158
|
/**
|
|
978
1159
|
* @param {?} widgetList
|
|
979
1160
|
* @return {?}
|
|
@@ -986,7 +1167,7 @@ class RADashboardArea {
|
|
|
986
1167
|
* @return {?}
|
|
987
1168
|
*/
|
|
988
1169
|
widget => {
|
|
989
|
-
widgetArray.push(this.
|
|
1170
|
+
widgetArray.push(this.responsiveService.getGridsterItem(widget));
|
|
990
1171
|
}));
|
|
991
1172
|
return widgetArray;
|
|
992
1173
|
}
|
|
@@ -1035,7 +1216,8 @@ RADashboardArea.ctorParameters = () => [
|
|
|
1035
1216
|
{ type: NgZone },
|
|
1036
1217
|
{ type: NgxUiLoaderService },
|
|
1037
1218
|
{ type: RATranslateService },
|
|
1038
|
-
{ type: NotifierService }
|
|
1219
|
+
{ type: NotifierService },
|
|
1220
|
+
{ type: RADashboardResponsiveService }
|
|
1039
1221
|
];
|
|
1040
1222
|
RADashboardArea.propDecorators = {
|
|
1041
1223
|
userDashboardId: [{ type: Input, args: ['user-dashboard-id',] }],
|
|
@@ -1045,7 +1227,6 @@ RADashboardArea.propDecorators = {
|
|
|
1045
1227
|
widgetHeight: [{ type: Input, args: ['widget-height',] }],
|
|
1046
1228
|
widgetWidth: [{ type: Input, args: ['widget-width',] }],
|
|
1047
1229
|
appConfig: [{ type: Input, args: ['app-config',] }],
|
|
1048
|
-
widgetRearrangeSubject: [{ type: Input }],
|
|
1049
1230
|
gridWrapper: [{ type: ViewChild, args: ['gridWrapper', { static: false },] }],
|
|
1050
1231
|
onResize: [{ type: HostListener, args: ['window:resize', ['$event'],] }]
|
|
1051
1232
|
};
|
|
@@ -1058,11 +1239,21 @@ if (false) {
|
|
|
1058
1239
|
RADashboardArea.prototype.gridheight;
|
|
1059
1240
|
/** @type {?} */
|
|
1060
1241
|
RADashboardArea.prototype.gridcellHeight;
|
|
1242
|
+
/**
|
|
1243
|
+
* @type {?}
|
|
1244
|
+
* @private
|
|
1245
|
+
*/
|
|
1246
|
+
RADashboardArea.prototype.userWidgets;
|
|
1061
1247
|
/**
|
|
1062
1248
|
* @type {?}
|
|
1063
1249
|
* @private
|
|
1064
1250
|
*/
|
|
1065
1251
|
RADashboardArea.prototype.conifgAddClick;
|
|
1252
|
+
/**
|
|
1253
|
+
* @type {?}
|
|
1254
|
+
* @private
|
|
1255
|
+
*/
|
|
1256
|
+
RADashboardArea.prototype.rearrangeWidgetClick;
|
|
1066
1257
|
/**
|
|
1067
1258
|
* @type {?}
|
|
1068
1259
|
* @private
|
|
@@ -1100,8 +1291,6 @@ if (false) {
|
|
|
1100
1291
|
/** @type {?} */
|
|
1101
1292
|
RADashboardArea.prototype.appConfig;
|
|
1102
1293
|
/** @type {?} */
|
|
1103
|
-
RADashboardArea.prototype.widgetRearrangeSubject;
|
|
1104
|
-
/** @type {?} */
|
|
1105
1294
|
RADashboardArea.prototype.gridWrapper;
|
|
1106
1295
|
/**
|
|
1107
1296
|
* @type {?}
|
|
@@ -1128,6 +1317,11 @@ if (false) {
|
|
|
1128
1317
|
* @private
|
|
1129
1318
|
*/
|
|
1130
1319
|
RADashboardArea.prototype.notifier;
|
|
1320
|
+
/**
|
|
1321
|
+
* @type {?}
|
|
1322
|
+
* @private
|
|
1323
|
+
*/
|
|
1324
|
+
RADashboardArea.prototype.responsiveService;
|
|
1131
1325
|
}
|
|
1132
1326
|
|
|
1133
1327
|
/**
|
|
@@ -6437,7 +6631,6 @@ class RaBaseDashboardTemplate {
|
|
|
6437
6631
|
*/
|
|
6438
6632
|
constructor(ngZone) {
|
|
6439
6633
|
this.ngZone = ngZone;
|
|
6440
|
-
this.widgetRearrangeSubject = new Subject();
|
|
6441
6634
|
this.initialize = (/**
|
|
6442
6635
|
* @param {?} eventBus
|
|
6443
6636
|
* @param {?} userDashboardId
|
|
@@ -6455,17 +6648,6 @@ class RaBaseDashboardTemplate {
|
|
|
6455
6648
|
}));
|
|
6456
6649
|
this.init();
|
|
6457
6650
|
});
|
|
6458
|
-
this.rearrangeWidgets = (/**
|
|
6459
|
-
* @return {?}
|
|
6460
|
-
*/
|
|
6461
|
-
() => {
|
|
6462
|
-
this.ngZone.run((/**
|
|
6463
|
-
* @return {?}
|
|
6464
|
-
*/
|
|
6465
|
-
() => {
|
|
6466
|
-
this.widgetRearrangeSubject.next(true);
|
|
6467
|
-
}));
|
|
6468
|
-
});
|
|
6469
6651
|
}
|
|
6470
6652
|
/**
|
|
6471
6653
|
* @return {?}
|
|
@@ -6479,8 +6661,7 @@ class RaBaseDashboardTemplate {
|
|
|
6479
6661
|
RaBaseDashboardTemplate.propDecorators = {
|
|
6480
6662
|
dashboardId: [{ type: Input, args: ['dashboard-id',] }],
|
|
6481
6663
|
globalFilter: [{ type: Input, args: ['global-filter',] }],
|
|
6482
|
-
initialize: [{ type: Input }]
|
|
6483
|
-
rearrangeWidgets: [{ type: Input }]
|
|
6664
|
+
initialize: [{ type: Input }]
|
|
6484
6665
|
};
|
|
6485
6666
|
if (false) {
|
|
6486
6667
|
/** @type {?} */
|
|
@@ -6490,15 +6671,11 @@ if (false) {
|
|
|
6490
6671
|
/** @type {?} */
|
|
6491
6672
|
RaBaseDashboardTemplate.prototype.appConfig;
|
|
6492
6673
|
/** @type {?} */
|
|
6493
|
-
RaBaseDashboardTemplate.prototype.widgetRearrangeSubject;
|
|
6494
|
-
/** @type {?} */
|
|
6495
6674
|
RaBaseDashboardTemplate.prototype.dashboardId;
|
|
6496
6675
|
/** @type {?} */
|
|
6497
6676
|
RaBaseDashboardTemplate.prototype.globalFilter;
|
|
6498
6677
|
/** @type {?} */
|
|
6499
6678
|
RaBaseDashboardTemplate.prototype.initialize;
|
|
6500
|
-
/** @type {?} */
|
|
6501
|
-
RaBaseDashboardTemplate.prototype.rearrangeWidgets;
|
|
6502
6679
|
/**
|
|
6503
6680
|
* @type {?}
|
|
6504
6681
|
* @private
|
|
@@ -6612,5 +6789,5 @@ if (false) {
|
|
|
6612
6789
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6613
6790
|
*/
|
|
6614
6791
|
|
|
6615
|
-
export { DashboardFrameworkModule, RADashboardArea, RADashboardEventBus, RAEvent, RAEventKey, RAWidgetContainer, RaBaseDashboardFilter, RaBaseDashboardTemplate, RaDashboardService, GridsterModule as ɵa, GridsterComponent as ɵb, GridsterItemComponent as ɵc, GridsterPreviewComponent as ɵd, customNotifierOptions as ɵe };
|
|
6792
|
+
export { DashboardFrameworkModule, RADashboardArea, RADashboardEventBus, RADashboardResponsiveService, RAEvent, RAEventKey, RAWidgetContainer, RaBaseDashboardFilter, RaBaseDashboardTemplate, RaDashboardService, GridsterModule as ɵa, GridsterComponent as ɵb, GridsterItemComponent as ɵc, GridsterPreviewComponent as ɵd, customNotifierOptions as ɵe };
|
|
6616
6793
|
//# sourceMappingURL=schneideress-dashboardframework.js.map
|