@schneideress/dashboardframework 0.0.150 → 0.0.152

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