@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.
@@ -720,13 +720,18 @@ var RADashboardResponsiveService = /** @class */ (function () {
720
720
  function () {
721
721
  var _this = this;
722
722
  this.screenWidth = screen.width;
723
- this.currentResInfo = this.resInfo.filter((/**
724
- * @param {?} item
725
- * @return {?}
726
- */
727
- function (item) {
728
- return item.end >= _this.screenWidth && item.start <= _this.screenWidth;
729
- }))[0];
723
+ if (this.IsDesktopView) {
724
+ this.currentResInfo = this.resInfo[3];
725
+ }
726
+ else {
727
+ this.currentResInfo = this.resInfo.filter((/**
728
+ * @param {?} item
729
+ * @return {?}
730
+ */
731
+ function (item) {
732
+ return item.end >= _this.screenWidth && item.start <= _this.screenWidth;
733
+ }))[0];
734
+ }
730
735
  };
731
736
  Object.defineProperty(RADashboardResponsiveService.prototype, "IsDesktopView", {
732
737
  get: /**
@@ -1347,8 +1352,7 @@ var RADashboardArea = /** @class */ (function () {
1347
1352
  var _this = this;
1348
1353
  data.height = this.widgetHeight;
1349
1354
  data.width = this.widgetWidth;
1350
- data.position_x = 0;
1351
- data.position_y = 0;
1355
+ data = this.setPositions(data);
1352
1356
  /** to find the available position in gridster, temp commenting the code-returning higher y value than normal */
1353
1357
  data.dashboardAreaKey = this.areaKey;
1354
1358
  data.dashboardId = this.userDashboardId;
@@ -1385,6 +1389,34 @@ var RADashboardArea = /** @class */ (function () {
1385
1389
  _this.raDashboardEventBus.publish(RAEvent.WidgetAdded, widget);
1386
1390
  }));
1387
1391
  };
1392
+ /**
1393
+ * @private
1394
+ * @param {?} data
1395
+ * @return {?}
1396
+ */
1397
+ RADashboardArea.prototype.setPositions = /**
1398
+ * @private
1399
+ * @param {?} data
1400
+ * @return {?}
1401
+ */
1402
+ function (data) {
1403
+ data.position_x = 0;
1404
+ data.position_y = 0;
1405
+ if (!this.responsiveService.IsDesktopView) {
1406
+ if (this.userWidgets.length > 0) {
1407
+ /** @type {?} */
1408
+ var widget = this.userWidgets[this.userWidgets.length - 1];
1409
+ if (widget.position_x + widget.width > 5) {
1410
+ data.position_y = widget.position_y + 1;
1411
+ }
1412
+ else {
1413
+ data.position_y = widget.position_y;
1414
+ data.position_x = 10 - (widget.position_x + widget.width);
1415
+ }
1416
+ }
1417
+ }
1418
+ return data;
1419
+ };
1388
1420
  /** To add widget to current widget list ,invoked from copy widget window*/
1389
1421
  /**
1390
1422
  * To add widget to current widget list ,invoked from copy widget window
@@ -1397,8 +1429,15 @@ var RADashboardArea = /** @class */ (function () {
1397
1429
  * @return {?}
1398
1430
  */
1399
1431
  function (data) {
1400
- data.position_x = 0;
1401
- data.position_y = 0;
1432
+ data = this.setPositions(data);
1433
+ if (!this.responsiveService.IsDesktopView) {
1434
+ this.dashboardService.updateWidgets(this.formatWidgetDataForPositionDetails([data]), this.appConfig).subscribe((/**
1435
+ * @param {?} widgets
1436
+ * @return {?}
1437
+ */
1438
+ function (widgets) {
1439
+ }));
1440
+ }
1402
1441
  /** @type {?} */
1403
1442
  var gridsterItem = this.responsiveService.getGridsterItem(data);
1404
1443
  this.widgetList.push(gridsterItem);