@schneideress/dashboardframework 0.0.152 → 0.0.154

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.
@@ -1211,22 +1211,6 @@ var RADashboardArea = /** @class */ (function () {
1211
1211
  * @return {?}
1212
1212
  */
1213
1213
  function (widgets) {
1214
- //sorting the widgets y, x
1215
- widgets = widgets.sort((/**
1216
- * @param {?} a
1217
- * @param {?} b
1218
- * @return {?}
1219
- */
1220
- function (a, b) {
1221
- if (a['position_y'] > b['position_y'])
1222
- return 1;
1223
- if (a['position_y'] < b['position_y'])
1224
- return -1;
1225
- if (a['position_x'] > b['position_x'])
1226
- return 1;
1227
- if (a['position_x'] < b['position_x'])
1228
- return -1;
1229
- }));
1230
1214
  _this.userWidgets = widgets;
1231
1215
  if (widgets && widgets.length > 0) {
1232
1216
  _this.widgetList = _this.mapObjectListToGridsterItemList(widgets);
@@ -1305,18 +1289,29 @@ var RADashboardArea = /** @class */ (function () {
1305
1289
  function (widgetInstanceId, isalertDisabled) {
1306
1290
  if (isalertDisabled === void 0) { isalertDisabled = false; }
1307
1291
  /** @type {?} */
1308
- var widget = this.widgetList.filter((/**
1292
+ var gridsterItem = this.widgetList.filter((/**
1309
1293
  * @param {?} item
1310
1294
  * @return {?}
1311
1295
  */
1312
1296
  function (item) {
1313
1297
  return item.widgetInfo.widgetInstanceId === widgetInstanceId;
1314
1298
  }));
1315
- if (widget.length > 0) {
1316
- this.widgetList.splice(this.widgetList.indexOf(widget[0]), 1);
1299
+ if (gridsterItem.length > 0) {
1300
+ /** @type {?} */
1301
+ var widget = this.userWidgets.filter((/**
1302
+ * @param {?} item
1303
+ * @return {?}
1304
+ */
1305
+ function (item) {
1306
+ return item.widgetInstanceId === widgetInstanceId;
1307
+ }));
1308
+ if (widget.length > 0) {
1309
+ this.userWidgets.splice(this.userWidgets.indexOf(widget[0]), 1);
1310
+ }
1311
+ this.widgetList.splice(this.widgetList.indexOf(gridsterItem[0]), 1);
1317
1312
  this.setAreaHeight();
1318
1313
  if (!isalertDisabled) {
1319
- this.notifier.notify('success', " " + this.translateService.translate('Common.Widgettext') + " " + widget[0].widgetInfo.widgetTitle + " " + this.translateService.translate('Common.deletedSuccesfully') + " ");
1314
+ this.notifier.notify('success', " " + this.translateService.translate('Common.Widgettext') + " " + gridsterItem[0].widgetInfo.widgetTitle + " " + this.translateService.translate('Common.deletedSuccesfully') + " ");
1320
1315
  }
1321
1316
  }
1322
1317
  };
@@ -1364,6 +1359,7 @@ var RADashboardArea = /** @class */ (function () {
1364
1359
  * @return {?}
1365
1360
  */
1366
1361
  function (widget) {
1362
+ _this.userWidgets.push(widget);
1367
1363
  /** @type {?} */
1368
1364
  var gridsterItem = _this.responsiveService.getGridsterItem(widget);
1369
1365
  _this.widgetList.push(gridsterItem);
@@ -1381,12 +1377,14 @@ var RADashboardArea = /** @class */ (function () {
1381
1377
  if (widget && widget.widgetInstanceId) {
1382
1378
  widgetInstanceId = widget.widgetInstanceId;
1383
1379
  /**To save added widget position in db */
1384
- setTimeout((/**
1385
- * @return {?}
1386
- */
1387
- function () {
1388
- _this.updateWidgetPosition(widgetInstanceId);
1389
- }), 1000);
1380
+ if (_this.responsiveService.IsDesktopView) {
1381
+ setTimeout((/**
1382
+ * @return {?}
1383
+ */
1384
+ function () {
1385
+ _this.updateWidgetPosition(widgetInstanceId);
1386
+ }));
1387
+ }
1390
1388
  }
1391
1389
  _this.raDashboardEventBus.publish(RAEvent.WidgetAdded, widget);
1392
1390
  }));
@@ -1440,6 +1438,7 @@ var RADashboardArea = /** @class */ (function () {
1440
1438
  function (widgets) {
1441
1439
  }));
1442
1440
  }
1441
+ this.userWidgets.push(data);
1443
1442
  /** @type {?} */
1444
1443
  var gridsterItem = this.responsiveService.getGridsterItem(data);
1445
1444
  this.widgetList.push(gridsterItem);