@crystaldesign/web-planner-logic 25.14.0-beta.27 → 25.14.0-beta.29

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.
Files changed (52) hide show
  1. package/build/cjs/{DivaBoxPlanner-5e144865.js → DivaBoxPlanner-590fa04b.js} +228 -148
  2. package/build/cjs/{DivaStandardPlanner-ca043429.js → DivaStandardPlanner-14f641eb.js} +96 -87
  3. package/build/cjs/{DoorPlanner-5ded30b7.js → DoorPlanner-2fd36cbe.js} +1 -1
  4. package/build/cjs/{Host3DSignalR-715fa957.js → Host3DSignalR-01d03fbe.js} +1 -1
  5. package/build/cjs/{LiviqueWWSHandler-bfb1fab3.js → LiviqueWWSHandler-ce234c4d.js} +1 -1
  6. package/build/cjs/{PfisterWWSHandler-a2c9cd1f.js → PfisterWWSHandler-14763bec.js} +1 -1
  7. package/build/cjs/{PlannerHandler2D-7aa80b82.js → PlannerHandler2D-69bf367e.js} +2 -2
  8. package/build/cjs/{SeriousBasketHandler-7571d6f2.js → SeriousBasketHandler-3284d8e6.js} +1 -1
  9. package/build/cjs/{ShelfPlanner-56e90dab.js → ShelfPlanner-fdf5c5ea.js} +1 -1
  10. package/build/cjs/{StandardWWSHandler-2e0aa185.js → StandardWWSHandler-75b86bd6.js} +1 -1
  11. package/build/cjs/{index-cf35e4c3.js → index-d851c847.js} +102 -61
  12. package/build/cjs/index.js +1 -1
  13. package/build/esm/{DivaBoxPlanner-5c85ac91.js → DivaBoxPlanner-90c95fe0.js} +228 -148
  14. package/build/esm/{DivaStandardPlanner-a5f5ecaa.js → DivaStandardPlanner-15cc1700.js} +96 -87
  15. package/build/esm/{DoorPlanner-d1401be5.js → DoorPlanner-6e3a0841.js} +1 -1
  16. package/build/esm/{Host3DSignalR-73af84d1.js → Host3DSignalR-e8cf0b3e.js} +1 -1
  17. package/build/esm/{LiviqueWWSHandler-20d9ac88.js → LiviqueWWSHandler-108cb348.js} +1 -1
  18. package/build/esm/{PfisterWWSHandler-17e2bb0a.js → PfisterWWSHandler-41c995d8.js} +1 -1
  19. package/build/esm/{PlannerHandler2D-5f12e286.js → PlannerHandler2D-67320283.js} +2 -2
  20. package/build/esm/{SeriousBasketHandler-ab9e3806.js → SeriousBasketHandler-23209e7b.js} +1 -1
  21. package/build/esm/{ShelfPlanner-a7e63d56.js → ShelfPlanner-ac57278a.js} +1 -1
  22. package/build/esm/{StandardWWSHandler-fb4ba1bf.js → StandardWWSHandler-6959f79c.js} +1 -1
  23. package/build/esm/{index-b308b21a.js → index-8f6efc60.js} +102 -61
  24. package/build/esm/index.js +1 -1
  25. package/build/types/web-planner-logic/src/interface/AdditionalModelInfos.d.ts +1 -0
  26. package/build/types/web-planner-logic/src/interface/AdditionalModelInfos.d.ts.map +1 -1
  27. package/build/types/web-planner-logic/src/interface/Articles/CatalogArticleDataType.d.ts +5 -0
  28. package/build/types/web-planner-logic/src/interface/Articles/CatalogArticleDataType.d.ts.map +1 -1
  29. package/build/types/web-planner-logic/src/interface/DivaCatalogDataType.d.ts +1 -0
  30. package/build/types/web-planner-logic/src/interface/DivaCatalogDataType.d.ts.map +1 -1
  31. package/build/types/web-planner-logic/src/interface/webPlannerParams/WebPlannerParamsType.d.ts +1 -0
  32. package/build/types/web-planner-logic/src/interface/webPlannerParams/WebPlannerParamsType.d.ts.map +1 -1
  33. package/build/types/web-planner-logic/src/logic/Basket/DivaBasketHandler.d.ts +2 -1
  34. package/build/types/web-planner-logic/src/logic/Basket/DivaBasketHandler.d.ts.map +1 -1
  35. package/build/types/web-planner-logic/src/logic/DivaWebPlanner.d.ts +3 -2
  36. package/build/types/web-planner-logic/src/logic/DivaWebPlanner.d.ts.map +1 -1
  37. package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/BoxPlannerGrid.d.ts.map +1 -1
  38. package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/ConstructionRulesHandler.d.ts.map +1 -1
  39. package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/DivaBoxPlanner.d.ts +4 -1
  40. package/build/types/web-planner-logic/src/logic/Planner/BoxPlanner/DivaBoxPlanner.d.ts.map +1 -1
  41. package/build/types/web-planner-logic/src/logic/Planner/DivaPlannerHandler.d.ts +4 -1
  42. package/build/types/web-planner-logic/src/logic/Planner/DivaPlannerHandler.d.ts.map +1 -1
  43. package/build/types/web-planner-logic/src/logic/Planner/DivaStandardPlanner.d.ts +4 -1
  44. package/build/types/web-planner-logic/src/logic/Planner/DivaStandardPlanner.d.ts.map +1 -1
  45. package/build/types/web-planner-logic/src/logic/Set/DivaSetHandler.d.ts.map +1 -1
  46. package/build/types/web-planner-logic/src/model/Articles/Article/CatalogArticleData.d.ts +7 -1
  47. package/build/types/web-planner-logic/src/model/Articles/Article/CatalogArticleData.d.ts.map +1 -1
  48. package/build/types/web-planner-logic/src/model/Articles/Article/DivaCatalogArticle.d.ts.map +1 -1
  49. package/build/types/web-planner-logic/src/model/Catalog/CatalogData.d.ts.map +1 -1
  50. package/build/types/web-planner-logic/src/model/Catalog/DivaCatalogData.d.ts.map +1 -1
  51. package/build/types/web-planner-logic/src/model/Catalog/IDMCatalogData.d.ts.map +1 -1
  52. package/package.json +2 -2
@@ -3,11 +3,11 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
3
3
  import _createClass from '@babel/runtime/helpers/createClass';
4
4
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
5
5
  import _regeneratorRuntime from '@babel/runtime/regenerator';
6
- import { c as Vector2, V as Vector3, P as PlannerElementData, B as BoundingBox } from './index-b308b21a.js';
6
+ import { c as Vector2, V as Vector3, P as PlannerElementData, B as BoundingBox } from './index-8f6efc60.js';
7
7
  import DivaUtils, { DivaError, md5 } from '@crystaldesign/diva-utils';
8
8
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
9
9
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
10
- import { d as dockingPointHandlerInst, h as handler2D } from './PlannerHandler2D-5f12e286.js';
10
+ import { d as dockingPointHandlerInst, h as handler2D } from './PlannerHandler2D-67320283.js';
11
11
  import '@babel/runtime/helpers/objectWithoutProperties';
12
12
  import 'axios';
13
13
  import '@crystaldesign/basket-model';
@@ -2596,21 +2596,21 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
2596
2596
  }
2597
2597
  }, {
2598
2598
  key: "validateDimensionRule",
2599
- value: function validateDimensionRule(dimRule, boxPlannerSize) {
2599
+ value: function validateDimensionRule(dimension, dimensionLimit, boxPlannerSize, higherLimit, lowerLimit) {
2600
2600
  var isOver = false;
2601
2601
  var isEqual = false;
2602
- if (dimRule.dimension.toLowerCase() == 'height' && boxPlannerSize.y > dimRule.dimensionLimit) isOver = true;
2603
- if (dimRule.dimension.toLowerCase() == 'height' && boxPlannerSize.y == dimRule.dimensionLimit) isEqual = true;
2604
- if (dimRule.dimension.toLowerCase() == 'width' && boxPlannerSize.x > dimRule.dimensionLimit) isOver = true;
2605
- if (dimRule.dimension.toLowerCase() == 'width' && boxPlannerSize.x == dimRule.dimensionLimit) isEqual = true;
2606
- if (dimRule.dimension.toLowerCase() == 'depth' && boxPlannerSize.z > dimRule.dimensionLimit) isOver = true;
2607
- if (dimRule.dimension.toLowerCase() == 'depth' && boxPlannerSize.z == dimRule.dimensionLimit) isEqual = true;
2602
+ if (dimension.toLowerCase() == 'height' && boxPlannerSize.y > dimensionLimit) isOver = true;
2603
+ if (dimension.toLowerCase() == 'height' && boxPlannerSize.y == dimensionLimit) isEqual = true;
2604
+ if (dimension.toLowerCase() == 'width' && boxPlannerSize.x > dimensionLimit) isOver = true;
2605
+ if (dimension.toLowerCase() == 'width' && boxPlannerSize.x == dimensionLimit) isEqual = true;
2606
+ if (dimension.toLowerCase() == 'depth' && boxPlannerSize.z > dimensionLimit) isOver = true;
2607
+ if (dimension.toLowerCase() == 'depth' && boxPlannerSize.z == dimensionLimit) isEqual = true;
2608
2608
  if (isOver) {
2609
- return dimRule.higherLimit;
2609
+ return higherLimit;
2610
2610
  } else if (isEqual) {
2611
- return dimRule.higherLimit;
2611
+ return higherLimit;
2612
2612
  } else {
2613
- return dimRule.lowerLimit;
2613
+ return lowerLimit;
2614
2614
  }
2615
2615
  }
2616
2616
 
@@ -2636,15 +2636,19 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
2636
2636
  elements.forEach(function (element, idx) {
2637
2637
  if (idx < changedElementIdx) {
2638
2638
  //under the changed one
2639
- var rightNeighbours = boxPlannerGrid.getNeighborElements(element.ElementId, "RIGHT");
2639
+ var rightNeighbours = boxPlannerGrid.getNeighborElements(element.ElementId, 'RIGHT', false);
2640
2640
  var freeSpace = element.Width;
2641
2641
  rightNeighbours.forEach(function (n) {
2642
2642
  if (n.ElementId == changedElement.ElementId) return;
2643
- if (!boxPlannerGrid.getNeighborElements(n.ElementId, "TOP", false).find(function (n) {
2643
+ var topElements = boxPlannerGrid.getNeighborElements(n.ElementId, 'TOP', false).filter(function (n) {
2644
2644
  return n.ElementId != changedElement.ElementId;
2645
- })) freeSpace += n.Width;
2645
+ });
2646
+ var topWidth = topElements.reduce(function (totalwidth, e) {
2647
+ return totalwidth += e.Width;
2648
+ }, 0);
2649
+ if (topWidth < n.Width) freeSpace += n.Width - topWidth;
2646
2650
  });
2647
- if (changedElement.Width > freeSpace) _this2.setOptionValue(element.ElementId, opt, opv, optionHandler);
2651
+ if (Math.round(changedElement.Width) > Math.round(freeSpace)) _this2.setOptionValue(element.ElementId, opt, opv, optionHandler);
2648
2652
  } else {
2649
2653
  // over the changed one
2650
2654
  if (changedElement.Width < element.Width) _this2.setOptionValue(element.ElementId, opt, opv, optionHandler);
@@ -2657,7 +2661,10 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
2657
2661
  var _this3 = this;
2658
2662
  var elements = boxPlannerGrid.getAllElementsInFrontGrid();
2659
2663
  elements.forEach(function (e) {
2660
- if (boxPlannerGrid.getElementHasBottomElement(e.ElementId)) _this3.setOptionValue(e.ElementId, 'OPTFUSS_SYS', 'OPVOHNE', optionHandler);
2664
+ if (boxPlannerGrid.getElementHasBottomElement(e.ElementId)) {
2665
+ _this3.setOptionValue(e.ElementId, 'OPTFUSS_SYS', 'OPVOHNE', optionHandler);
2666
+ _this3.setOptionValue(e.ElementId, 'OPTPOSSIBILITY_FUSS_OHNE', 'OPVTRUE', optionHandler);
2667
+ }
2661
2668
  });
2662
2669
  }
2663
2670
 
@@ -2671,14 +2678,13 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
2671
2678
  if (!this.constructionRules.optionsInfluencedByDimensions) return;
2672
2679
  var boxPlannerSize = boxPlannerGrid.getSizeOfWholeSet(false);
2673
2680
  var allElements = boxPlannerGrid.getAllElementsInFrontGrid();
2674
- var setRule = function setRule(rule) {
2675
- var res = _this4.validateDimensionRule(rule, boxPlannerSize);
2681
+ var setRule = function setRule(option, res) {
2676
2682
  if (changedOPTs) {
2677
2683
  var changedOpt = Object.entries(changedOPTs).find(function (_ref) {
2678
2684
  var _ref2 = _slicedToArray(_ref, 2),
2679
2685
  key = _ref2[0];
2680
2686
  _ref2[1];
2681
- return key == rule.option;
2687
+ return key == option;
2682
2688
  });
2683
2689
  if (changedOpt) {
2684
2690
  allElements.forEach(function (element) {
@@ -2688,13 +2694,29 @@ var ConstructionRulesHandler = /*#__PURE__*/function () {
2688
2694
  }
2689
2695
  }
2690
2696
  allElements.forEach(function (element) {
2691
- return _this4.setOptionDoCustom(element.ElementId, res, rule.option, optionHandler);
2697
+ return _this4.setOptionDoCustom(element.ElementId, option, res, optionHandler);
2692
2698
  });
2693
2699
  };
2694
- this.constructionRules.optionsInfluencedByDimensions.forEach(function (dimRule) {
2695
- if (Array.isArray(dimRule)) dimRule.forEach(function (rule) {
2696
- return setRule(rule);
2697
- });else setRule(dimRule);
2700
+ var dim = this.constructionRules.optionsInfluencedByDimensions;
2701
+ dim.forEach(function (dimRule) {
2702
+ if (Array.isArray(dimRule)) {
2703
+ var res = dimRule.every(function (r) {
2704
+ return _this4.validateDimensionRule(r.dimension, r.dimensionLimit, boxPlannerSize, r.higherLimit, r.lowerLimit).toLowerCase() == 'doshow';
2705
+ });
2706
+ var t = dimRule[0];
2707
+ if (res) setRule(t.option, 'doShow');else setRule(t.option, 'doHide');
2708
+ } else {
2709
+ var seriesDimRule = dimRule;
2710
+ var baseDimRule = dimRule;
2711
+ if (seriesDimRule.series) {
2712
+ var _dimRule = seriesDimRule.series.findLast(function (r) {
2713
+ return _this4.validateDimensionRule(r.dimension, r.dimensionLimit, boxPlannerSize, '1', '2') == '1';
2714
+ });
2715
+ if (_dimRule) setRule(seriesDimRule.option, _dimRule.value);
2716
+ } else {
2717
+ setRule(baseDimRule.option, _this4.validateDimensionRule(baseDimRule.option, baseDimRule.dimensionLimit, boxPlannerSize, baseDimRule.higherLimit, baseDimRule.lowerLimit));
2718
+ }
2719
+ }
2698
2720
  });
2699
2721
  }
2700
2722
  }, {
@@ -3509,7 +3531,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
3509
3531
  key: "getGridColumnWidth",
3510
3532
  value: function getGridColumnWidth(x) {
3511
3533
  var frontGrid = this.generalPlanningState.grids[0].matrix;
3512
- for (var y = 0; x < frontGrid[y].length; x++) {
3534
+ for (var y = 0; y < frontGrid[y].length; y++) {
3513
3535
  var _plannedElement$size$, _plannedElement;
3514
3536
  var cell = frontGrid[x][y];
3515
3537
  if (cell) return (_plannedElement$size$ = (_plannedElement = cell.plannedElement) === null || _plannedElement === void 0 ? void 0 : _plannedElement.size.width) !== null && _plannedElement$size$ !== void 0 ? _plannedElement$size$ : 0;
@@ -4093,7 +4115,6 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4093
4115
  key: "getNeighborElements",
4094
4116
  value: function getNeighborElements(elementId, dir) {
4095
4117
  var _this = this,
4096
- _plannedElement3,
4097
4118
  _curGrid$area$fromX,
4098
4119
  _downNeighbour$planne;
4099
4120
  var clean = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
@@ -4105,22 +4126,32 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4105
4126
  var currentRow = curGrid[plannedElement.area.fromX];
4106
4127
  var startHeight = 0;
4107
4128
  var endHeight = 0;
4108
- currentRow.forEach(function (cell) {
4109
- if (cell.index.y < res.startRowIndex) startHeight = Math.round((startHeight + cell.plannedElement.size.height) * 1000);
4110
- if (cell.index.y < res.endRowIndex) endHeight = Math.round((endHeight + cell.plannedElement.size.height) * 1000);
4111
- });
4129
+ for (var y = 0; y < currentRow.length;) {
4130
+ var cell = currentRow[y];
4131
+ if (cell.index.y < res.startRowIndex) startHeight = Math.round((startHeight + cell.plannedElement.size.height) * 1000) / 1000;
4132
+ if (cell.index.y < res.endRowIndex) endHeight = Math.round((endHeight + cell.plannedElement.size.height) * 1000) / 1000;
4133
+ y = cell.plannedElement.area.toY;
4134
+ }
4135
+ var neighbourSize = 0;
4136
+ var neighbours = [];
4112
4137
  switch (dir) {
4113
4138
  case 'RIGHT':
4114
4139
  // only clean neighbours (for docking) add property if you also need clean ones
4115
4140
 
4116
- var neighbourRow = curGrid[plannedElement.area.toX];
4117
- if (!neighbourRow) break;
4118
- var neighbourSize = 0;
4119
- var neighbours = neighbourRow.filter(function (cell) {
4120
- if (clean && neighbourSize == startHeight) return true;else if (!clean && neighbourSize > endHeight) return true;
4121
- neighbourSize = Math.round((neighbourSize + cell.plannedElement.size.height) * 1000);
4122
- return false;
4123
- });
4141
+ for (var x = plannedElement.area.toX; x < curGrid.length;) {
4142
+ var _neighbourRow$0$plann, _neighbourRow$0$plann2;
4143
+ var neighbourRow = curGrid[x];
4144
+ for (var _y = 0; _y < neighbourRow.length;) {
4145
+ var _cell5$plannedElement, _cell5$plannedElement2;
4146
+ var _cell5 = neighbourRow[_y];
4147
+ if (neighbours.includes(_cell5)) continue;
4148
+ if (clean && neighbourSize == startHeight) neighbours.push(_cell5);else if (!clean && neighbourSize >= startHeight && neighbourSize <= endHeight) neighbours.push(_cell5);
4149
+ neighbourSize = Math.round((neighbourSize + _cell5.plannedElement.size.height) * 1000) / 1000;
4150
+ _y = (_cell5$plannedElement = (_cell5$plannedElement2 = _cell5.plannedElement) === null || _cell5$plannedElement2 === void 0 ? void 0 : _cell5$plannedElement2.area.toY) !== null && _cell5$plannedElement !== void 0 ? _cell5$plannedElement : _y + 1;
4151
+ }
4152
+ neighbourSize = 0;
4153
+ x = (_neighbourRow$0$plann = (_neighbourRow$0$plann2 = neighbourRow[0].plannedElement) === null || _neighbourRow$0$plann2 === void 0 ? void 0 : _neighbourRow$0$plann2.area.toX) !== null && _neighbourRow$0$plann !== void 0 ? _neighbourRow$0$plann : x + 1;
4154
+ }
4124
4155
  neighbours.forEach(function (n) {
4125
4156
  return !result.find(function (r) {
4126
4157
  return r.ElementId == n.plannedElement.elementId;
@@ -4128,25 +4159,40 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4128
4159
  });
4129
4160
  break;
4130
4161
  case 'LEFT':
4131
- var leftNeighbourRow = curGrid[plannedElement.area.fromX - 1];
4132
- if (!leftNeighbourRow) break;
4133
- var leftNeighbourSize = 0;
4134
- var leftStartElement = leftNeighbourRow.find(function (cell) {
4135
- if (leftNeighbourSize == startHeight) return true;
4136
- leftNeighbourSize = Math.round((leftNeighbourSize + cell.plannedElement.size.height) * 1000);
4137
- return false;
4162
+ for (var _x2 = plannedElement.area.fromX - 1; _x2 > 0;) {
4163
+ var _neighbourRow = curGrid[_x2];
4164
+ for (var _y2 = 0; _y2 < _neighbourRow.length;) {
4165
+ var _cell6$plannedElement, _cell6$plannedElement2;
4166
+ var _cell6 = _neighbourRow[_y2];
4167
+ if (neighbours.includes(_cell6)) continue;
4168
+ if (clean && neighbourSize == startHeight) neighbours.push(_cell6);else if (!clean && neighbourSize >= startHeight && neighbourSize <= endHeight) neighbours.push(_cell6);
4169
+ neighbourSize = Math.round((neighbourSize + _cell6.plannedElement.size.height) * 1000) / 1000;
4170
+ _y2 = (_cell6$plannedElement = (_cell6$plannedElement2 = _cell6.plannedElement) === null || _cell6$plannedElement2 === void 0 ? void 0 : _cell6$plannedElement2.area.toY) !== null && _cell6$plannedElement !== void 0 ? _cell6$plannedElement : _y2 + 1;
4171
+ }
4172
+ neighbourSize = 0;
4173
+ _x2 = _neighbourRow[0].plannedElement ? _neighbourRow[0].plannedElement.area.fromX - 1 : _x2 + 1;
4174
+ }
4175
+ neighbours.forEach(function (n) {
4176
+ return !result.find(function (r) {
4177
+ return r.ElementId == n.plannedElement.elementId;
4178
+ }) && result.push(_this.plannerElements.get(n.plannedElement.elementId));
4138
4179
  });
4139
- if (leftStartElement) result.push(this.plannerElements.get(leftStartElement.plannedElement.elementId));
4140
4180
  break;
4141
4181
  case 'TOP':
4142
- var topNeighbour = undefined;
4143
- for (var y = plannedElement.area.toY; y < curGrid[plannedElement.area.fromX].length; y++) {
4144
- topNeighbour = curGrid[plannedElement.area.fromX][y];
4145
- break;
4182
+ var topNeighbours = [];
4183
+ for (var _x3 = plannedElement.area.fromX; _x3 < plannedElement.area.toX;) {
4184
+ var _cell7 = curGrid[_x3][plannedElement.area.toY];
4185
+ if (!_cell7) break;
4186
+ topNeighbours.push(_cell7);
4187
+ if (clean) break;
4188
+ _x3 = _cell7.plannedElement.area.toX;
4146
4189
  }
4147
- if (!topNeighbour) break;
4148
- var tElementId = (_plannedElement3 = topNeighbour.plannedElement) === null || _plannedElement3 === void 0 ? void 0 : _plannedElement3.elementId;
4149
- if (tElementId) result.push(this.plannerElements.get(tElementId));
4190
+ if (topNeighbours.length == 0) break;
4191
+ topNeighbours.forEach(function (topNeighbour) {
4192
+ var _plannedElement3;
4193
+ var tElementId = (_plannedElement3 = topNeighbour.plannedElement) === null || _plannedElement3 === void 0 ? void 0 : _plannedElement3.elementId;
4194
+ if (tElementId) result.push(_this.plannerElements.get(tElementId));
4195
+ });
4150
4196
  break;
4151
4197
  case 'DOWN':
4152
4198
  var downNeighbour = (_curGrid$area$fromX = curGrid[plannedElement.area.fromX]) === null || _curGrid$area$fromX === void 0 ? void 0 : _curGrid$area$fromX[plannedElement.area.fromY - 1];
@@ -4219,12 +4265,12 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4219
4265
  var curHeight = 0;
4220
4266
  var row = frontGrid[x];
4221
4267
  for (var y = 0; y < row.length;) {
4222
- var _cell5, _cell$plannedElement$, _cell$plannedElement8;
4268
+ var _cell8, _cell$plannedElement$, _cell$plannedElement8;
4223
4269
  var cell = row[y];
4224
- var elementId = (_cell5 = cell) === null || _cell5 === void 0 || (_cell5 = _cell5.plannedElement) === null || _cell5 === void 0 ? void 0 : _cell5.elementId;
4270
+ var elementId = (_cell8 = cell) === null || _cell8 === void 0 || (_cell8 = _cell8.plannedElement) === null || _cell8 === void 0 ? void 0 : _cell8.elementId;
4225
4271
  if (elementId && cell && checkedElementIds.indexOf(elementId) == -1) {
4226
4272
  curHeight += this.plannerElements.get(elementId).getHeight();
4227
- if (x == 0 && y == 0) depth = this.plannerElements.get(elementId).getDepth();
4273
+ if (x == 0 && y == 0) depth = cell.plannedElement.size.depth;
4228
4274
  }
4229
4275
  y = (_cell$plannedElement$ = (_cell$plannedElement8 = cell.plannedElement) === null || _cell$plannedElement8 === void 0 ? void 0 : _cell$plannedElement8.area.toY) !== null && _cell$plannedElement$ !== void 0 ? _cell$plannedElement$ : y + 1;
4230
4276
  }
@@ -4264,9 +4310,9 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4264
4310
  }
4265
4311
  if (Math.round(height) == Math.round(lastHeight) || onBottom) {
4266
4312
  if (!result[result.length - 1]) result.push([]);
4267
- result[result.length - 1].push(grid[x][row.length - 1].plannedElement);
4313
+ result[result.length - 1].push(grid[x][onBottom ? 0 : row.length - 1].plannedElement);
4268
4314
  } else if (grid[x][row.length - 1].plannedElement.area.fromX == x) {
4269
- result.push([grid[x][row.length - 1].plannedElement]);
4315
+ result.push([grid[x][onBottom ? 0 : row.length - 1].plannedElement]);
4270
4316
  }
4271
4317
  lastHeight = height;
4272
4318
  var new_x = row[row.length - 1].plannedElement.area.toX;
@@ -4334,37 +4380,52 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4334
4380
  };
4335
4381
  var curGrid = curPos.backside ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
4336
4382
  var plannerIdsToFill = [];
4337
- var existingPlannerIds = [];
4338
- var lastFreeSpace = 0;
4339
- var _loop = function _loop(_y) {
4340
- var _curGrid$index$x$_y;
4341
- var elementToCopy = (_curGrid$index$x$_y = curGrid[index.x][_y]) === null || _curGrid$index$x$_y === void 0 ? void 0 : _curGrid$index$x$_y.plannedElement;
4342
- if (!elementToCopy) {
4343
- y = _y;
4344
- return 1;
4345
- } // break
4346
- var length = element.area.toX - element.area.fromX;
4347
- var d = dir == 'RIGHT' ? +length : -length;
4348
- var isPlanned = curGrid.find(function (x, idx) {
4349
- return idx == element.area.toX + d - 1 && x[x.length - 1].index.y >= elementToCopy.area.fromY;
4350
- });
4351
- var neighbours = _this2.getNeighborElements(elementToCopy.elementId, dir);
4352
- var freeSpace = 0;
4353
- neighbours.forEach(function (n) {
4354
- if (_this2.getNeighborElements(n.ElementId, "TOP").length == 0) freeSpace += n.Width;
4355
- });
4356
- if (neighbours.length == 0 && lastFreeSpace >= elementToCopy.size.width && !isPlanned && elementToCopy) plannerIdsToFill.push(elementToCopy.elementId);
4357
- if (neighbours.length > 0 && freeSpace > element.size.width) plannerIdsToFill.push(neighbours[neighbours.length - 1].ElementId);else if (elementToCopy) existingPlannerIds.push(elementToCopy.elementId);
4358
- _y = elementToCopy.area.toY;
4359
- lastFreeSpace = freeSpace;
4360
- y = _y;
4361
- };
4362
- for (var y = 0; y <= index.y;) {
4363
- if (_loop(y)) break;
4383
+ var length = element.area.toX - element.area.fromX;
4384
+ var d = dir == 'RIGHT' ? +length : -length;
4385
+ plannerIdsToFill.push(element.elementId);
4386
+ _objectSpread(_objectSpread({}, element.area), {}, {
4387
+ fromX: element.area.fromX + d,
4388
+ toX: element.area.toX + d
4389
+ });
4390
+ var _loop = function _loop(_y3) {
4391
+ var _curGrid$index$x$_y;
4392
+ var supportElement = (_curGrid$index$x$_y = curGrid[index.x][_y3]) === null || _curGrid$index$x$_y === void 0 ? void 0 : _curGrid$index$x$_y.plannedElement;
4393
+ if (!supportElement) {
4394
+ y = _y3;
4395
+ return 0;
4396
+ } // break
4397
+ var topElements = _this2.getNeighborElements(supportElement.elementId, 'TOP', false);
4398
+ var topWidth = 0;
4399
+ topElements.forEach(function (t) {
4400
+ return topWidth += t.Width;
4401
+ });
4402
+ var freeSpace = 0;
4403
+ if (supportElement.size.width > topWidth) freeSpace = supportElement.size.width - topWidth;
4404
+ var neighbours = _this2.getNeighborElements(supportElement.elementId, dir, false);
4405
+ neighbours.forEach(function (n) {
4406
+ if (_this2.getNeighborElements(n.ElementId, 'TOP').length > 0) return;
4407
+ freeSpace += n.Width;
4408
+ });
4409
+ if (freeSpace >= element.size.width) {
4410
+ y = _y3;
4411
+ return 0;
4412
+ } // break
4413
+ var missingWidth = element.size.width - freeSpace;
4414
+ while (missingWidth > 0) {
4415
+ plannerIdsToFill.push(supportElement.elementId);
4416
+ missingWidth = Math.round(missingWidth - supportElement.size.width);
4417
+ }
4418
+ _y3 = supportElement.area.fromY - 1;
4419
+ y = _y3;
4420
+ },
4421
+ _ret;
4422
+ for (var y = index.y - 1; y >= 0;) {
4423
+ _ret = _loop(y);
4424
+ if (_ret === 0) break;
4364
4425
  }
4365
4426
  // if there is nothing to fill we copy everyting
4366
4427
  return {
4367
- elements: plannerIdsToFill.length == 0 ? existingPlannerIds : plannerIdsToFill,
4428
+ elements: plannerIdsToFill.reverse(),
4368
4429
  backside: curPos.backside
4369
4430
  };
4370
4431
  }
@@ -4460,11 +4521,32 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4460
4521
  // [][] -> | [][][]
4461
4522
  // [][] | [][][]
4462
4523
  // [][][] | [][][][]
4463
- function moveGrid(plannedCells) {
4524
+ var moveGrid = function moveGrid(plannedCells) {
4464
4525
  var grid = new Array();
4465
4526
  var rightNeighbour = plannedCells.filter(function (c) {
4466
4527
  return c.index.x == element.area.toX;
4467
4528
  });
4529
+ var col = [];
4530
+ var support = [];
4531
+ var _loop2 = function _loop2() {
4532
+ var c = frontGrid[x][element.area.fromY];
4533
+ var s = frontGrid[x][element.area.fromY - 1];
4534
+ if (c && !col.find(function (_c) {
4535
+ return _c.plannedElement.elementId == c.plannedElement.elementId;
4536
+ })) col.push(frontGrid[x][element.area.fromY]);
4537
+ if (s && !support.find(function (_c) {
4538
+ return _c.plannedElement.elementId == s.plannedElement.elementId;
4539
+ })) support.push(frontGrid[x][element.area.fromY - 1]);
4540
+ };
4541
+ for (var x = 0; x < frontGrid.length; x++) {
4542
+ _loop2();
4543
+ }
4544
+ var sizeXTop = col.reduce(function (acc, n) {
4545
+ return acc += n.plannedElement.size.width;
4546
+ }, 0);
4547
+ var sizeXUnder = support ? support.reduce(function (acc, n) {
4548
+ return acc += n.plannedElement.size.width;
4549
+ }, 0) : 0;
4468
4550
  var rightNeighbourOfCopy = rightNeighbour.find(function (c) {
4469
4551
  return c.index.y == absoluteCopyIndex.y;
4470
4552
  });
@@ -4476,7 +4558,9 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4476
4558
  });
4477
4559
  plannedCells.forEach(function (cell) {
4478
4560
  // if we can't fill up (need to move the grid)
4479
- if (cell.index.x >= absoluteCopyIndex.x && (copyDirectionIsRight && (rightNeighbourOfCopy || rightNeighbour.length == 0) || !copyDirectionIsRight && (leftNeighbourOfCopy || leftNeighbour.length == 0) || absoluteCopyIndex.x == -1)) {
4561
+ if (cell.index.x >= absoluteCopyIndex.x && (copyDirectionIsRight && (rightNeighbourOfCopy || rightNeighbour.length == 0) && (
4562
+ // no free space or on the right height == move
4563
+ !(sizeXTop <= sizeXUnder - element.size.width) || cell.index.y >= element.area.fromY && cell.index.y < element.area.toY) || !copyDirectionIsRight && (leftNeighbourOfCopy || leftNeighbour.length == 0) || absoluteCopyIndex.x == -1)) {
4480
4564
  cell.index.x += widthCopyArea;
4481
4565
  cell.plannedElement.area.fromX += widthCopyArea;
4482
4566
  cell.plannedElement.area.toX += widthCopyArea;
@@ -4485,13 +4569,13 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4485
4569
  grid[cell.index.x][cell.index.y] = cell;
4486
4570
  });
4487
4571
  return grid;
4488
- }
4572
+ };
4489
4573
  frontGrid = moveGrid(this.getAllUsedCellsInGrid(false));
4490
4574
  for (var x = 0; x < widthCopyArea; x++) if (!frontGrid[absoluteCopyIndex.x + x]) frontGrid[absoluteCopyIndex.x + x] = [];
4491
4575
  this.generalPlanningState.grids[0].matrix = frontGrid;
4492
4576
  if (this.hasActiveBackside) {
4493
4577
  backGrid = moveGrid(this.getAllUsedCellsInGrid(true));
4494
- for (var _x2 = 0; _x2 < widthCopyArea; _x2++) if (!backGrid[absoluteCopyIndex.x + _x2]) backGrid[absoluteCopyIndex.x + _x2] = [];
4578
+ for (var _x4 = 0; _x4 < widthCopyArea; _x4++) if (!backGrid[absoluteCopyIndex.x + _x4]) backGrid[absoluteCopyIndex.x + _x4] = [];
4495
4579
  this.generalPlanningState.grids[1].matrix = backGrid;
4496
4580
  }
4497
4581
  }
@@ -4606,8 +4690,6 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4606
4690
  var backsideForCopy = copyIndex.z == -1 || curPos.backside == true;
4607
4691
  if (cellIndex.x < 0) cellIndex.x = 0; // can't plan to negative space see prepareGridForColCopy
4608
4692
  var curGrid = backsideForCopy ? this.generalPlanningState.grids[1].matrix : this.generalPlanningState.grids[0].matrix;
4609
- // can't float need to dock
4610
- if (curGrid[cellIndex.x].length < cellIndex.y) cellIndex.y = curGrid[cellIndex.x].length;
4611
4693
  var cells = this.createNewCells(newElement, cellIndex.x, cellIndex.y, backsideForCopy);
4612
4694
  for (var i = 0; i < cells.length; i++) {
4613
4695
  if (!curGrid[cells[i].index.x]) curGrid[cells[i].index.x] = [];
@@ -4656,6 +4738,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4656
4738
  var el = cell.plannedElement;
4657
4739
  el.size.width = elementData.width;
4658
4740
  el.size.height = elementData.height;
4741
+ el.size.depth = elementData.depth;
4659
4742
  el.area = {
4660
4743
  fromX: el.area.fromX,
4661
4744
  toX: !scpe ? Math.round(el.area.fromX + elementData.width / _this3.gridSetupParams.fixCellRasterWidth) : cell.index.x + 1,
@@ -4682,23 +4765,23 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4682
4765
  }
4683
4766
  }
4684
4767
  } else if (diff.x != 0) {
4685
- for (var _x3 = cell.plannedElement.area.fromX; _x3 < grid.length; _x3++) {
4686
- for (var _y2 = cell.plannedElement.area.fromY; _y2 < cell.plannedElement.area.toY; _y2++) {
4687
- var _cell6 = grid[_x3][_y2];
4688
- if (!_cell6 || _cell6.plannedElement.elementId == elementId) continue; //already corrected
4689
- _cell6.index.x += diff.x;
4690
- _cell6.plannedElement.area.fromX += diff.x;
4691
- _cell6.plannedElement.area.toX += diff.x;
4768
+ for (var _x5 = cell.plannedElement.area.fromX; _x5 < grid.length; _x5++) {
4769
+ for (var _y4 = cell.plannedElement.area.fromY; _y4 < cell.plannedElement.area.toY; _y4++) {
4770
+ var _cell9 = grid[_x5][_y4];
4771
+ if (!_cell9 || _cell9.plannedElement.elementId == elementId) continue; //already corrected
4772
+ _cell9.index.x += diff.x;
4773
+ _cell9.plannedElement.area.fromX += diff.x;
4774
+ _cell9.plannedElement.area.toX += diff.x;
4692
4775
  }
4693
4776
  }
4694
4777
  }
4695
4778
 
4696
4779
  // after indices/areas are corrected rebuild the grid
4697
4780
  if (scpe) return false;
4698
- var changedElementData = res.cells[0].plannedElement;
4781
+ res.cells[0].plannedElement;
4699
4782
  var newGrid = new Array();
4700
4783
  var plannedCells = this.getAllUsedCellsInGrid(false);
4701
- var _loop2 = function _loop2() {
4784
+ var _loop3 = function _loop3() {
4702
4785
  var cell = plannedCells[idx];
4703
4786
  var area = cell.plannedElement.area;
4704
4787
  if (newGrid.find(function (x) {
@@ -4707,16 +4790,15 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4707
4790
  return (y === null || y === void 0 || (_y$plannedElement3 = y.plannedElement) === null || _y$plannedElement3 === void 0 ? void 0 : _y$plannedElement3.elementId) == ((_cell$plannedElement9 = cell.plannedElement) === null || _cell$plannedElement9 === void 0 ? void 0 : _cell$plannedElement9.elementId);
4708
4791
  });
4709
4792
  })) return 0; // continue
4710
- for (var _x4 = area.fromX; _x4 < area.toX; _x4++) {
4711
- for (var _y3 = area.fromY; _y3 < area.toY; _y3++) {
4712
- var _support$plannedEleme;
4713
- if (!newGrid[_x4] && area.fromY == 0) newGrid[_x4] = [];
4793
+ for (var _x6 = area.fromX; _x6 < area.toX; _x6++) {
4794
+ for (var _y5 = area.fromY; _y5 < area.toY; _y5++) {
4795
+ if (!newGrid[_x6] && area.fromY == 0) newGrid[_x6] = [];
4714
4796
 
4715
4797
  // we have a so called overhanging element not so nice, let's correct:
4716
4798
  var support = plannedCells.find(function (c) {
4717
4799
  return c.plannedElement.area.toX >= cell.plannedElement.area.toX && c.plannedElement.area.toY == cell.index.y;
4718
4800
  });
4719
- if (!support && !newGrid[_x4]) {
4801
+ if (!support && !newGrid[_x6]) {
4720
4802
  _this3.generalPlanningState = backup;
4721
4803
  return {
4722
4804
  v: true
@@ -4724,19 +4806,19 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4724
4806
  }
4725
4807
 
4726
4808
  // the element below got smaller
4727
- if (!newGrid[_x4] && (!support || ((_support$plannedEleme = support.plannedElement) === null || _support$plannedEleme === void 0 ? void 0 : _support$plannedEleme.elementId) == changedElementData.elementId)) {
4809
+ if (!newGrid[_x6] && !support) {
4728
4810
  _this3.generalPlanningState = backup;
4729
4811
  return {
4730
4812
  v: true
4731
4813
  };
4732
- } else if (!newGrid[_x4]) newGrid[_x4] = [];
4814
+ } else if (!newGrid[_x6]) newGrid[_x6] = [];
4733
4815
  // when the element above starts early and goes over multiple ones
4734
4816
 
4735
4817
  // regular case
4736
- newGrid[_x4][_y3] = _objectSpread(_objectSpread({}, cell), {}, {
4818
+ newGrid[_x6][_y5] = _objectSpread(_objectSpread({}, cell), {}, {
4737
4819
  index: {
4738
- x: _x4,
4739
- y: _y3
4820
+ x: _x6,
4821
+ y: _y5
4740
4822
  },
4741
4823
  plannedElement: _objectSpread(_objectSpread({}, cell.plannedElement), {}, {
4742
4824
  area: {
@@ -4744,19 +4826,21 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4744
4826
  toX: cell.plannedElement.area.fromX + (cell.plannedElement.area.toX - cell.plannedElement.area.fromX),
4745
4827
  fromY: cell.plannedElement.area.fromY,
4746
4828
  toY: cell.plannedElement.area.fromY + (cell.plannedElement.area.toY - cell.plannedElement.area.fromY)
4747
- }
4829
+ },
4830
+ size: _objectSpread(_objectSpread({}, cell.plannedElement.size), {}, {
4831
+ depth: elementData.depth
4832
+ })
4748
4833
  })
4749
4834
  });
4750
4835
  }
4751
4836
  }
4752
4837
  },
4753
- _ret;
4838
+ _ret2;
4754
4839
  for (var idx = 0; idx < plannedCells.length; idx++) {
4755
- _ret = _loop2();
4756
- if (_ret === 0) continue;
4757
- if (_ret) return _ret.v;
4840
+ _ret2 = _loop3();
4841
+ if (_ret2 === 0) continue;
4842
+ if (_ret2) return _ret2.v;
4758
4843
  }
4759
- console.log('thoula 2 => ', newGrid);
4760
4844
  if (res.backside) this.generalPlanningState.grids[1].matrix = newGrid;else this.generalPlanningState.grids[0].matrix = newGrid;
4761
4845
  return false;
4762
4846
  }
@@ -4803,7 +4887,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4803
4887
  if (topNeighbors.length > 0) dockingPointHandlerInst.tryDockElement(element, 'AVO', [topNeighbors[0]]);
4804
4888
  if (leftNeighbors.length > 0) dockingPointHandlerInst.tryDockElement(element, 'AVL', [leftNeighbors[0]]);
4805
4889
  if (rightNeighbors.length > 0) dockingPointHandlerInst.tryDockElement(element, 'AVR', [rightNeighbors[0]]);
4806
- if (rightNeighbors.length == 0 && leftNeighbors.length == 0 && downNeighbors.length > 0) dockingPointHandlerInst.tryDockElement(element, 'AVU', [downNeighbors[0]]);
4890
+ if (downNeighbors.length > 0) dockingPointHandlerInst.tryDockElement(element, 'AVU', [downNeighbors[0]]);
4807
4891
  element.PosNr = posNr;
4808
4892
  posNr++;
4809
4893
  }
@@ -4811,9 +4895,9 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
4811
4895
  }
4812
4896
  for (var i = 0; i < backGrid.length; i++) {
4813
4897
  for (var j = 0; j < backGrid[i].length; j++) {
4814
- var _cell7$plannedElement;
4815
- var _cell7 = backGrid[i][j];
4816
- var _elementId6 = _cell7 === null || _cell7 === void 0 || (_cell7$plannedElement = _cell7.plannedElement) === null || _cell7$plannedElement === void 0 ? void 0 : _cell7$plannedElement.elementId;
4898
+ var _cell10$plannedElemen;
4899
+ var _cell10 = backGrid[i][j];
4900
+ var _elementId6 = _cell10 === null || _cell10 === void 0 || (_cell10$plannedElemen = _cell10.plannedElement) === null || _cell10$plannedElemen === void 0 ? void 0 : _cell10$plannedElemen.elementId;
4817
4901
  if (_elementId6 && allCheckedElementIds.indexOf(_elementId6) == -1) {
4818
4902
  var _element2 = this.plannerElements.get(_elementId6);
4819
4903
  allCheckedElementIds.push(_elementId6);
@@ -5151,9 +5235,9 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
5151
5235
  var targetRowIndex = endRowIndex + 1;
5152
5236
  var _copyPossible = false;
5153
5237
  // Iterate through columns within the element's width
5154
- for (var _x5 = endColIndex; _x5 >= startColIndex; _x5--) {
5155
- if (isValidCell(_x5, targetRowIndex)) {
5156
- copyStartColIndex = _x5;
5238
+ for (var _x7 = endColIndex; _x7 >= startColIndex; _x7--) {
5239
+ if (isValidCell(_x7, targetRowIndex)) {
5240
+ copyStartColIndex = _x7;
5157
5241
  _copyPossible = true;
5158
5242
  }
5159
5243
  }
@@ -5170,19 +5254,19 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
5170
5254
  var _targetColIndex = endColIndex;
5171
5255
  var _copyPossible2 = false;
5172
5256
  // Iterate through rows within the element's height
5173
- for (var _y4 = startRowIndex; _y4 <= endRowIndex; _y4++) {
5174
- if (isValidCell(_targetColIndex, _y4)) {
5175
- copyStartRowIndex = _y4;
5257
+ for (var _y6 = startRowIndex; _y6 <= endRowIndex; _y6++) {
5258
+ if (isValidCell(_targetColIndex, _y6)) {
5259
+ copyStartRowIndex = _y6;
5176
5260
  _copyPossible2 = true;
5177
5261
  break;
5178
5262
  }
5179
5263
  }
5180
5264
  if (!_copyPossible2) return undefined;
5181
5265
  _copyPossible2 = false;
5182
- for (var _x6 = endColIndex; _x6 <= endColIndex + elementCells.colCount; _x6++) {
5183
- if (isValidCell(_x6, copyStartRowIndex) && (copyStartRowIndex == 0 || !isValidCell(_x6, copyStartRowIndex - 1))) {
5266
+ for (var _x8 = endColIndex; _x8 <= endColIndex + elementCells.colCount; _x8++) {
5267
+ if (isValidCell(_x8, copyStartRowIndex) && (copyStartRowIndex == 0 || !isValidCell(_x8, copyStartRowIndex - 1))) {
5184
5268
  //check also for overhang
5185
- copyEndColIndex = _x6;
5269
+ copyEndColIndex = _x8;
5186
5270
  _copyPossible2 = true;
5187
5271
  } else {
5188
5272
  break; //when you find one situation where it is not valid skip outside.
@@ -5385,7 +5469,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
5385
5469
  //system 4 useacse
5386
5470
  var totalColCount = matrix[0].length;
5387
5471
  var colSizes = Array(totalColCount).fill(-1);
5388
- var _loop3 = function _loop3(i) {
5472
+ var _loop4 = function _loop4(i) {
5389
5473
  var _matrix$find;
5390
5474
  var cell = (_matrix$find = matrix.find(function (row) {
5391
5475
  var _row$i$plannedElement, _row$i$plannedElement2;
@@ -5399,7 +5483,7 @@ var BoxPlannerGrid = /*#__PURE__*/function () {
5399
5483
  if (colSizes[i] === -1) return 1; // break
5400
5484
  };
5401
5485
  for (var i = 0; i < totalColCount; i++) {
5402
- if (_loop3(i)) break;
5486
+ if (_loop4(i)) break;
5403
5487
  }
5404
5488
  if (colSizes.includes(-1)) LOG$1.error(new Error('Column sizes are not set'));
5405
5489
  return colSizes;
@@ -5787,11 +5871,10 @@ var DivaBoxPlanner = /*#__PURE__*/function () {
5787
5871
  value: (function () {
5788
5872
  var _copyPlannerElement = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(articleCopyRelation, copyInfo) {
5789
5873
  var _this = this;
5790
- var gridIsPrepared, plannerElementsToLoadSVG, that, i, cellPos, allDPs, j;
5874
+ var plannerElementsToLoadSVG, that, i, cellPos, allDPs, j;
5791
5875
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
5792
5876
  while (1) switch (_context5.prev = _context5.next) {
5793
5877
  case 0:
5794
- gridIsPrepared = false;
5795
5878
  if (copyInfo) {
5796
5879
  _context5.next = 3;
5797
5880
  break;
@@ -5801,25 +5884,22 @@ var DivaBoxPlanner = /*#__PURE__*/function () {
5801
5884
  if (copyInfo.copyType == 'STD') copyInfo.targetElements = [];
5802
5885
  plannerElementsToLoadSVG = [];
5803
5886
  that = this;
5804
- articleCopyRelation.forEach(function (basketIDNewArticle, elementToCopyId) {
5887
+ articleCopyRelation.forEach(function (val) {
5805
5888
  var _copyInfo$targetEleme;
5806
- if (!gridIsPrepared) {
5807
- if (copyInfo.copyIndex.z == -1) {
5808
- if (!_this.boxPlannerGrid.getPlannerHasActiveBackside()) _this.boxPlannerGrid.prepareGridForBackSideCopy();
5809
- } else {
5810
- _this.boxPlannerGrid.prepareGridForColCopy(elementToCopyId, copyInfo.copyIndex);
5811
- }
5889
+ if (copyInfo.copyIndex.z == -1) {
5890
+ if (!_this.boxPlannerGrid.getPlannerHasActiveBackside()) _this.boxPlannerGrid.prepareGridForBackSideCopy();
5891
+ } else {
5892
+ _this.boxPlannerGrid.prepareGridForColCopy(val.key, copyInfo.copyIndex);
5812
5893
  }
5813
- gridIsPrepared = true;
5814
5894
 
5815
5895
  //Init Planner Element
5816
- var plannerElement = new PlannerElementData(_this.set.getSetId(), basketIDNewArticle, _this.nextElementId, DivaBoxPlanner.plannerType);
5896
+ var plannerElement = new PlannerElementData(_this.set.getSetId(), val.value, _this.nextElementId, DivaBoxPlanner.plannerType);
5817
5897
  _this.nextElementId++;
5818
- _this.set.setElementId(basketIDNewArticle, plannerElement.ElementId);
5898
+ _this.set.setElementId(val.value, plannerElement.ElementId);
5819
5899
  var data = _this.set.getPlannerData(plannerElement.ElementId);
5820
5900
  plannerElement.updatePlannerData(data);
5821
- _this.boxPlannerGrid.addElementAsCopy(elementToCopyId, plannerElement, copyInfo.copyIndex);
5822
- _this.constructionRulesHandler.onElementCopy(elementToCopyId, plannerElement.getElementId());
5901
+ _this.boxPlannerGrid.addElementAsCopy(val.key, plannerElement, copyInfo.copyIndex);
5902
+ _this.constructionRulesHandler.onElementCopy(val.key, plannerElement.getElementId());
5823
5903
  plannerElementsToLoadSVG.push(plannerElement);
5824
5904
  if (copyInfo.copyType == 'STD') (_copyInfo$targetEleme = copyInfo.targetElements) === null || _copyInfo$targetEleme === void 0 || _copyInfo$targetEleme.push(plannerElement.getElementId());
5825
5905
  });
@@ -5950,7 +6030,7 @@ var DivaBoxPlanner = /*#__PURE__*/function () {
5950
6030
  }
5951
6031
  }
5952
6032
  //remove duplicate
5953
- return Array.from(new Set(allElementsToCopy));
6033
+ return allElementsToCopy;
5954
6034
  }
5955
6035
 
5956
6036
  /**