@schneideress/dashboardframework 0.0.150 → 0.0.151

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.
@@ -926,13 +926,18 @@
926
926
  function () {
927
927
  var _this = this;
928
928
  this.screenWidth = screen.width;
929
- this.currentResInfo = this.resInfo.filter((/**
930
- * @param {?} item
931
- * @return {?}
932
- */
933
- function (item) {
934
- return item.end >= _this.screenWidth && item.start <= _this.screenWidth;
935
- }))[0];
929
+ if (this.IsDesktopView) {
930
+ this.currentResInfo = this.resInfo[3];
931
+ }
932
+ else {
933
+ this.currentResInfo = this.resInfo.filter((/**
934
+ * @param {?} item
935
+ * @return {?}
936
+ */
937
+ function (item) {
938
+ return item.end >= _this.screenWidth && item.start <= _this.screenWidth;
939
+ }))[0];
940
+ }
936
941
  };
937
942
  Object.defineProperty(RADashboardResponsiveService.prototype, "IsDesktopView", {
938
943
  get: /**
@@ -1553,8 +1558,7 @@
1553
1558
  var _this = this;
1554
1559
  data.height = this.widgetHeight;
1555
1560
  data.width = this.widgetWidth;
1556
- data.position_x = 0;
1557
- data.position_y = 0;
1561
+ data = this.setPositions(data);
1558
1562
  /** to find the available position in gridster, temp commenting the code-returning higher y value than normal */
1559
1563
  data.dashboardAreaKey = this.areaKey;
1560
1564
  data.dashboardId = this.userDashboardId;
@@ -1591,6 +1595,34 @@
1591
1595
  _this.raDashboardEventBus.publish(RAEvent.WidgetAdded, widget);
1592
1596
  }));
1593
1597
  };
1598
+ /**
1599
+ * @private
1600
+ * @param {?} data
1601
+ * @return {?}
1602
+ */
1603
+ RADashboardArea.prototype.setPositions = /**
1604
+ * @private
1605
+ * @param {?} data
1606
+ * @return {?}
1607
+ */
1608
+ function (data) {
1609
+ data.position_x = 0;
1610
+ data.position_y = 0;
1611
+ if (!this.responsiveService.IsDesktopView) {
1612
+ if (this.userWidgets.length > 0) {
1613
+ /** @type {?} */
1614
+ var widget = this.userWidgets[this.userWidgets.length - 1];
1615
+ if (widget.position_x + widget.width > 5) {
1616
+ data.position_y = widget.position_y + 1;
1617
+ }
1618
+ else {
1619
+ data.position_y = widget.position_y;
1620
+ data.position_x = 10 - (widget.position_x + widget.width);
1621
+ }
1622
+ }
1623
+ }
1624
+ return data;
1625
+ };
1594
1626
  /** To add widget to current widget list ,invoked from copy widget window*/
1595
1627
  /**
1596
1628
  * To add widget to current widget list ,invoked from copy widget window
@@ -1603,8 +1635,15 @@
1603
1635
  * @return {?}
1604
1636
  */
1605
1637
  function (data) {
1606
- data.position_x = 0;
1607
- data.position_y = 0;
1638
+ data = this.setPositions(data);
1639
+ if (!this.responsiveService.IsDesktopView) {
1640
+ this.dashboardService.updateWidgets(this.formatWidgetDataForPositionDetails([data]), this.appConfig).subscribe((/**
1641
+ * @param {?} widgets
1642
+ * @return {?}
1643
+ */
1644
+ function (widgets) {
1645
+ }));
1646
+ }
1608
1647
  /** @type {?} */
1609
1648
  var gridsterItem = this.responsiveService.getGridsterItem(data);
1610
1649
  this.widgetList.push(gridsterItem);