@schneideress/dashboardframework 0.0.148 → 0.0.149

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.
@@ -580,12 +580,14 @@ const GridsterConfigDefaultSettings = {
580
580
  */
581
581
  /** @type {?} */
582
582
  const DesktopViewStart = 1367;
583
+ /** @type {?} */
584
+ const GridLockViewEnd = 1024;
583
585
  class RADashboardResponsiveService {
584
586
  constructor() {
585
587
  this.resInfo = [
586
588
  { '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': 768, 'end': GridLockViewEnd, 'minCols': 1, 'maxCols': 2 },
590
+ { 'start': GridLockViewEnd + 1, 'end': DesktopViewStart - 1, 'minCols': 2, 'maxCols': 6 },
589
591
  { 'start': DesktopViewStart, 'end': 9999999999, 'minCols': 2, 'maxCols': 10 }
590
592
  ];
591
593
  this.setScreenWidth();
@@ -616,6 +618,12 @@ class RADashboardResponsiveService {
616
618
  get IsDesktopView() {
617
619
  return this.screenWidth >= DesktopViewStart;
618
620
  }
621
+ /**
622
+ * @return {?}
623
+ */
624
+ get IsGridLocked() {
625
+ return this.screenWidth <= GridLockViewEnd;
626
+ }
619
627
  /**
620
628
  * @return {?}
621
629
  */
@@ -650,6 +658,7 @@ class RADashboardResponsiveService {
650
658
  rows: this.getHeight(widget.height),
651
659
  x: this.IsDesktopView ? widget.position_x : 0,
652
660
  y: this.IsDesktopView ? widget.position_y : 0,
661
+ isInitialized: widget.isInitialized,
653
662
  widgetInfo: widget
654
663
  }));
655
664
  return gridsterItem;
@@ -787,12 +796,26 @@ class RADashboardArea {
787
796
  * @return {?}
788
797
  */
789
798
  (item) => {
790
- if (this.responsiveService.IsDesktopView) {
791
- if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
792
- this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
799
+ if (item.isInitialized) {
800
+ if (!this.responsiveService.IsGridLocked) {
801
+ if (!this.responsiveService.IsDesktopView) {
802
+ this.updateWidgets();
803
+ }
804
+ else {
805
+ if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
806
+ this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
807
+ }
808
+ }
793
809
  }
810
+ this.setAreaHeight();
794
811
  }
795
- this.setAreaHeight();
812
+ });
813
+ this.options.itemInitCallback = (/**
814
+ * @param {?} item
815
+ * @return {?}
816
+ */
817
+ (item) => {
818
+ item.isInitialized = true;
796
819
  });
797
820
  }
798
821
  /**
@@ -913,7 +936,7 @@ class RADashboardArea {
913
936
  * @return {?}
914
937
  */
915
938
  updateWidgets() {
916
- this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
939
+ this.dashboardService.updateWidgets(this.formatWidgetDataForPositionDetails(this.mapGridsterListToObject(this.widgetList)), this.appConfig).subscribe((/**
917
940
  * @param {?} widgets
918
941
  * @return {?}
919
942
  */
@@ -1106,6 +1129,7 @@ class RADashboardArea {
1106
1129
  data.width = this.widgetWidth;
1107
1130
  data.position_x = 0;
1108
1131
  data.position_y = 0;
1132
+ data.isInitialized = true;
1109
1133
  /** to find the available position in gridster, temp commenting the code-returning higher y value than normal */
1110
1134
  data.dashboardAreaKey = this.areaKey;
1111
1135
  data.dashboardId = this.userDashboardId;
@@ -1150,6 +1174,7 @@ class RADashboardArea {
1150
1174
  copyWidget(data) {
1151
1175
  data.position_x = 0;
1152
1176
  data.position_y = 0;
1177
+ data.isInitialized = true;
1153
1178
  /** @type {?} */
1154
1179
  let gridsterItem = this.responsiveService.getGridsterItem(data);
1155
1180
  this.widgetList.push(gridsterItem);