kitchen-simulator 4.4.2 → 4.4.4
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.
- package/es/catalog/utils/item-loader.js +3 -18
- package/es/constants/catalog/skinPanel.js +9 -0
- package/es/constants.js +0 -9
- package/es/utils/helper.js +18 -9
- package/es/utils/isolate-event-handler.js +1 -1
- package/es/utils/skinPanelEngine.js +212 -26
- package/lib/catalog/utils/item-loader.js +2 -17
- package/lib/constants/catalog/skinPanel.js +15 -0
- package/lib/constants.js +2 -11
- package/lib/utils/helper.js +20 -9
- package/lib/utils/isolate-event-handler.js +1 -1
- package/lib/utils/skinPanelEngine.js +214 -28
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ import { ARROW_COLOR, BASE_CABINET_LAYOUTPOS, OBJTYPE_GROUP, OBJTYPE_MESH, SHADE
|
|
|
12
12
|
import { Item } from "../../models";
|
|
13
13
|
import * as GeomUtils from "./geom-utils";
|
|
14
14
|
import { loadGLTF } from "./load-obj";
|
|
15
|
-
import { animateDoor, isEmpty, translateDrawer } from "../../utils/helper";
|
|
15
|
+
import { animateDoor, getSkuAliasFromCatalogElement, isEmpty, translateDrawer } from "../../utils/helper";
|
|
16
16
|
import { isWarningItem } from "../../components/viewer2d/utils";
|
|
17
17
|
var INITIAL_NORMAL_MAP = '';
|
|
18
18
|
|
|
@@ -122,23 +122,8 @@ export function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corn
|
|
|
122
122
|
var lineCount = 0; //parseInt(((newWidth) / 8 - 0.51).toFixed(), 10) - 1;
|
|
123
123
|
var rowCount = 0; //parseInt((element.type.length / lineCount - 0.51).toFixed(), 10);
|
|
124
124
|
|
|
125
|
-
// Get
|
|
126
|
-
var objSKU = this
|
|
127
|
-
if (objSKU.length !== 0) {
|
|
128
|
-
var dcId,
|
|
129
|
-
doorStyle = element.doorStyle;
|
|
130
|
-
if (doorStyle instanceof Map) {
|
|
131
|
-
dcId = doorStyle.get('id');
|
|
132
|
-
} else {
|
|
133
|
-
dcId = doorStyle.id;
|
|
134
|
-
}
|
|
135
|
-
var skuItem = this.obj.skuArray.find(function (el) {
|
|
136
|
-
return el.door_color_id === dcId;
|
|
137
|
-
});
|
|
138
|
-
if (skuItem !== undefined) {
|
|
139
|
-
objSKU = skuItem.sku;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
125
|
+
// Get SKU Alias
|
|
126
|
+
var objSKU = getSkuAliasFromCatalogElement(this, element);
|
|
142
127
|
if (rowCount > 0) {
|
|
143
128
|
for (var _x = 0; _x < rowCount; _x++) {
|
|
144
129
|
splitStr.push(objSKU.slice(lineCount * _x, lineCount * (_x + 1)));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// skin panel SKU
|
|
2
|
+
export var SKIN_SKU_BSV_24 = 'BSV'; // 23.25" x 34.5" : For base cabinets
|
|
3
|
+
export var SKIN_SKU_BSV_48 = 'BSV48'; // 48" x 34.5" : For base cabinets back-to-back or island backs
|
|
4
|
+
export var SKIN_SKU_WSV_1242 = 'WSV1242'; // 11.25" x 42" : For 12" deep wall cabinets
|
|
5
|
+
export var SKIN_SKU_WSV_2442 = 'WSV2442'; // 23.25" x 42" : For 24" deep wall cabinets
|
|
6
|
+
export var SKIN_SKU_WSV_2460 = 'WSV2460'; // Usually used for CT3DR or CT2DR SKUs + stacked wall cabinets
|
|
7
|
+
export var SKIN_SKU_USV245325 = 'USV2453.25'; // 23.25" x 53.25" : For tall cabinets
|
|
8
|
+
|
|
9
|
+
export var SKIN_HEIGHT_53_25 = 53.25; // in inch, height of the skin with SKU USV245325
|
package/es/constants.js
CHANGED
|
@@ -771,13 +771,4 @@ export var ROOM_SHAPE_TYPE = {
|
|
|
771
771
|
export var DOORSTYLE_SCOPE_ALL = 'all';
|
|
772
772
|
export var DOORSTYLE_SCOPE_SINGLE = 'single';
|
|
773
773
|
export var DOORSTYLE_SCOPE_MULTIPLE = 'multiple';
|
|
774
|
-
|
|
775
|
-
// skin panel SKU
|
|
776
|
-
export var SKIN_SKU_BSV_24 = 'BSV24'; // 23.25" x 34.5" : For base cabinets
|
|
777
|
-
export var SKIN_SKU_BSV_48 = 'BSV48'; // 48" x 34.5" : For base cabinets back-to-back or island backs
|
|
778
|
-
export var SKIN_SKU_WSV_1242 = 'WSV1242'; // 11.25" x 42" : For 12" deep wall cabinets
|
|
779
|
-
export var SKIN_SKU_WSV_2442 = 'WSV2442'; // 23.25" x 42" : For 24" deep wall cabinets
|
|
780
|
-
export var SKIN_SKU_WSV_2460 = 'WSV2460'; // Usually used for CT3DR or CT2DR SKUs + stacked wall cabinets
|
|
781
|
-
export var SKIN_SKU_USV245325 = 'USV2453.25'; // 23.25" x 53.25" : For tall cabinets
|
|
782
|
-
|
|
783
774
|
export var DEFAULT_MOLDING_PIECE_LENGTH = 96; // in inch, 8 feet, standard length for molding pieces
|
package/es/utils/helper.js
CHANGED
|
@@ -413,7 +413,6 @@ export function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
|
413
413
|
updatedPayload.length = _length;
|
|
414
414
|
//////////////////////////////////////
|
|
415
415
|
} else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'items') {
|
|
416
|
-
var _catalog$elements$cur;
|
|
417
416
|
// check this cabinet has warning box
|
|
418
417
|
updatedPayload.isWarning = isWarningItem(currentObject);
|
|
419
418
|
// check this item is available molding
|
|
@@ -424,14 +423,7 @@ export function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
|
424
423
|
if (pointArray) updatedPayload.distArray = pointArray;
|
|
425
424
|
|
|
426
425
|
// update sku_number using sku_array
|
|
427
|
-
|
|
428
|
-
var skuArray = catalog === null || catalog === void 0 || (_catalog$elements$cur = catalog.elements[currentObject.get('name')]) === null || _catalog$elements$cur === void 0 || (_catalog$elements$cur = _catalog$elements$cur.obj) === null || _catalog$elements$cur === void 0 ? void 0 : _catalog$elements$cur.skuArray;
|
|
429
|
-
var correctSKU = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
|
|
430
|
-
return sku.door_color_id === currentDoorColorId;
|
|
431
|
-
});
|
|
432
|
-
if (correctSKU) {
|
|
433
|
-
updatedPayload.sku_number = correctSKU.sku;
|
|
434
|
-
}
|
|
426
|
+
updatedPayload.sku_number = getSkuAliasFromCatalog(catalog, currentObject);
|
|
435
427
|
} else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'holes') {
|
|
436
428
|
var _calcDistancesFromHol = calcDistancesFromHoleToNearestOneOrWall(currentObject, layer),
|
|
437
429
|
distLeft = _calcDistancesFromHol.distLeft,
|
|
@@ -448,4 +440,21 @@ export function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
|
448
440
|
};
|
|
449
441
|
}
|
|
450
442
|
return updatedPayload;
|
|
443
|
+
}
|
|
444
|
+
export function getSkuAliasFromCatalog(catalog, sceneObject) {
|
|
445
|
+
var _catalog$elements;
|
|
446
|
+
var sceneObjectJS = typeof (sceneObject === null || sceneObject === void 0 ? void 0 : sceneObject.toJS) === 'function' ? sceneObject.toJS() : sceneObject;
|
|
447
|
+
var elementName = sceneObjectJS === null || sceneObjectJS === void 0 ? void 0 : sceneObjectJS.name;
|
|
448
|
+
var catalogElement = catalog === null || catalog === void 0 || (_catalog$elements = catalog.elements) === null || _catalog$elements === void 0 ? void 0 : _catalog$elements[elementName];
|
|
449
|
+
return getSkuAliasFromCatalogElement(catalogElement, sceneObjectJS);
|
|
450
|
+
}
|
|
451
|
+
export function getSkuAliasFromCatalogElement(catalogElement, sceneObject) {
|
|
452
|
+
var _sceneObjectJS$doorSt, _catalogElement$obj, _skuAlias$sku;
|
|
453
|
+
var sceneObjectJS = typeof (sceneObject === null || sceneObject === void 0 ? void 0 : sceneObject.toJS) === 'function' ? sceneObject.toJS() : sceneObject;
|
|
454
|
+
var doorColorId = sceneObjectJS === null || sceneObjectJS === void 0 || (_sceneObjectJS$doorSt = sceneObjectJS.doorStyle) === null || _sceneObjectJS$doorSt === void 0 ? void 0 : _sceneObjectJS$doorSt.id;
|
|
455
|
+
var skuArray = catalogElement === null || catalogElement === void 0 || (_catalogElement$obj = catalogElement.obj) === null || _catalogElement$obj === void 0 ? void 0 : _catalogElement$obj.skuArray;
|
|
456
|
+
var skuAlias = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
|
|
457
|
+
return sku.door_color_id === doorColorId;
|
|
458
|
+
});
|
|
459
|
+
return (_skuAlias$sku = skuAlias === null || skuAlias === void 0 ? void 0 : skuAlias.sku) !== null && _skuAlias$sku !== void 0 ? _skuAlias$sku : sceneObjectJS === null || sceneObjectJS === void 0 ? void 0 : sceneObjectJS.sku_number;
|
|
451
460
|
}
|
|
@@ -1612,7 +1612,7 @@ function _handleExternalEvent() {
|
|
|
1612
1612
|
|
|
1613
1613
|
// get skin panel data
|
|
1614
1614
|
skinPanelExclusionSKUs = (_props$configData$ski = props === null || props === void 0 || (_props$configData2 = props.configData) === null || _props$configData2 === void 0 ? void 0 : _props$configData2.skinPanelExclusionSKUs) !== null && _props$configData$ski !== void 0 ? _props$configData$ski : [];
|
|
1615
|
-
sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs);
|
|
1615
|
+
sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs, props.catalog);
|
|
1616
1616
|
|
|
1617
1617
|
// send scene object from 3DTool to HostApp using internalEvent
|
|
1618
1618
|
(_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
|
|
@@ -2,11 +2,12 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
3
3
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
4
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
-
import { BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS, OVERLAP_INCLUDED, OVERLAP_SAME, OVERLAP_LINK, OVERLAP_SOME, EPSILON
|
|
5
|
+
import { BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS, OVERLAP_INCLUDED, OVERLAP_SAME, OVERLAP_LINK, OVERLAP_SOME, EPSILON } from "../constants";
|
|
6
6
|
import { buildRectFromLines, getAllLines, pointsDistance, relationshipOfTwoOverlappedLines, rotatePointAroundPoint } from "./geometry";
|
|
7
7
|
import { MathUtils } from "./export";
|
|
8
8
|
import { convert } from "./convert-units-lite";
|
|
9
|
-
import { isEmpty } from "./helper";
|
|
9
|
+
import { getSkuAliasFromCatalog, isEmpty } from "./helper";
|
|
10
|
+
import { SKIN_SKU_BSV_24, SKIN_SKU_BSV_48, SKIN_SKU_WSV_1242, SKIN_SKU_WSV_2442, SKIN_SKU_WSV_2460, SKIN_SKU_USV245325, SKIN_HEIGHT_53_25 } from "../constants/catalog/skinPanel";
|
|
10
11
|
function toCm(item, prop) {
|
|
11
12
|
var unit = item.properties.get(prop).get('_unit') || 'cm';
|
|
12
13
|
var value = item.properties.get(prop).get('_length');
|
|
@@ -30,7 +31,8 @@ export function getSideFaces(item, layer) {
|
|
|
30
31
|
var overlapList = [OVERLAP_INCLUDED, OVERLAP_SAME, OVERLAP_SOME];
|
|
31
32
|
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
32
33
|
for (var i = 0; i < 4; i++) {
|
|
33
|
-
if (i === 0
|
|
34
|
+
if (i === 0) continue; // only left & right & base cabinet's back
|
|
35
|
+
if (i === 2 && item.layoutpos !== BASE_CABINET_LAYOUTPOS) continue;
|
|
34
36
|
var isSnappedToWall = false;
|
|
35
37
|
var v0 = rotateCorner(pos[i], item, widthCm, depthCm);
|
|
36
38
|
var v1 = rotateCorner(pos[(i + 1) % 4], item, widthCm, depthCm);
|
|
@@ -64,7 +66,7 @@ export function getSideFaces(item, layer) {
|
|
|
64
66
|
var skinPanelSKU = 'unknown';
|
|
65
67
|
switch (item.layoutpos) {
|
|
66
68
|
case BASE_CABINET_LAYOUTPOS:
|
|
67
|
-
skinPanelSKU = SKIN_SKU_BSV_24;
|
|
69
|
+
skinPanelSKU = i === 2 ? 'unknown' : SKIN_SKU_BSV_24;
|
|
68
70
|
break;
|
|
69
71
|
case WALL_CABINET_LAYOUTPOS:
|
|
70
72
|
if (Math.abs(depthInch - 12) <= 1) skinPanelSKU = SKIN_SKU_WSV_1242;else if (Math.abs(depthInch - 24) <= 1) skinPanelSKU = SKIN_SKU_WSV_2442;
|
|
@@ -84,6 +86,7 @@ export function getSideFaces(item, layer) {
|
|
|
84
86
|
// inch unit
|
|
85
87
|
height: heightInch,
|
|
86
88
|
// inch unit
|
|
89
|
+
isBackFace: i === 2 ? true : false,
|
|
87
90
|
skinPanelSKU: skinPanelSKU,
|
|
88
91
|
itemInfo: item.toJS()
|
|
89
92
|
});
|
|
@@ -113,26 +116,138 @@ function collectFaces(items, layer) {
|
|
|
113
116
|
}
|
|
114
117
|
return faces;
|
|
115
118
|
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @param {*} faceSegs
|
|
122
|
+
* @param {*} otherFaces
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
function getTrimmedFaceSegs(faceSegs, otherFaces, cnt) {
|
|
126
|
+
try {
|
|
127
|
+
cnt++;
|
|
128
|
+
if (cnt > 5000) {
|
|
129
|
+
console.log('getTrimmedFaceSegs has limited!');
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
var returnSegs = [];
|
|
133
|
+
var _loop = function _loop() {
|
|
134
|
+
var iFace = faceSegs[i];
|
|
135
|
+
var srcLine = iFace.sectionLine;
|
|
136
|
+
var bContourSeg = true;
|
|
137
|
+
var _loop2 = function _loop2(j) {
|
|
138
|
+
var destLine = otherFaces[j].sectionLine;
|
|
139
|
+
var rst = relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
140
|
+
if (rst.result == OVERLAP_SAME || rst.result == OVERLAP_INCLUDED) {
|
|
141
|
+
bContourSeg = false;
|
|
142
|
+
return 0; // break
|
|
143
|
+
} else if (rst.result == OVERLAP_SOME) {
|
|
144
|
+
var trimmedFaceSegs = [];
|
|
145
|
+
rst.trimmedSegs.forEach(function (lineSeg) {
|
|
146
|
+
trimmedFaceSegs.push({
|
|
147
|
+
sectionLine: lineSeg,
|
|
148
|
+
// cm unit
|
|
149
|
+
zBottom: iFace.zBottom,
|
|
150
|
+
// cm unit
|
|
151
|
+
zTop: iFace.zTop,
|
|
152
|
+
// cm unit
|
|
153
|
+
depth: iFace.depthInch,
|
|
154
|
+
// inch unit
|
|
155
|
+
height: iFace.heightInch,
|
|
156
|
+
// inch unit
|
|
157
|
+
isBackFace: iFace.isBackFace,
|
|
158
|
+
skinPanelSKU: iFace.skinPanelSKU,
|
|
159
|
+
itemInfo: iFace.itemInfo
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
var tFaceSegs = getTrimmedFaceSegs(trimmedFaceSegs, otherFaces.filter(function (v, idx) {
|
|
163
|
+
return idx !== j;
|
|
164
|
+
}), cnt);
|
|
165
|
+
if (tFaceSegs.length > 0) returnSegs = [].concat(_toConsumableArray(returnSegs), _toConsumableArray(tFaceSegs));
|
|
166
|
+
bContourSeg = false;
|
|
167
|
+
return 0; // break
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
_ret;
|
|
171
|
+
for (var j = 0; j < otherFaces.length; j++) {
|
|
172
|
+
_ret = _loop2(j);
|
|
173
|
+
if (_ret === 0) break;
|
|
174
|
+
}
|
|
175
|
+
if (bContourSeg) returnSegs.push(faceSegs[i]);
|
|
176
|
+
};
|
|
177
|
+
for (var i = 0; i < faceSegs.length; i++) {
|
|
178
|
+
_loop();
|
|
179
|
+
}
|
|
180
|
+
return returnSegs;
|
|
181
|
+
} catch (e) {
|
|
182
|
+
console.log('getTrimmedFaceSegs catched :', e);
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
116
186
|
function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
117
187
|
var overlapList = [OVERLAP_INCLUDED, OVERLAP_SAME];
|
|
118
188
|
var removeIdxs = [];
|
|
189
|
+
var newFaces = []; // new countour edge segment that except the overlapped part
|
|
190
|
+
|
|
119
191
|
for (var i = 0; i < sourceFaces.length; i++) {
|
|
120
192
|
var iFace = sourceFaces[i];
|
|
121
193
|
for (var j = 0; j < blockingFaces.length; j++) {
|
|
194
|
+
var _relationship$trimmed;
|
|
122
195
|
if (sourceFaces === blockingFaces && i === j) continue;
|
|
123
196
|
var jFace = blockingFaces[j];
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
197
|
+
var verticallyIncluded = (iFace.zBottom > jFace.zBottom || Math.abs(iFace.zBottom - jFace.zBottom) < EPSILON) && (iFace.zTop < jFace.zTop || Math.abs(iFace.zTop - jFace.zTop) < EPSILON);
|
|
198
|
+
var verticallyOverlappedTopPart = jFace.zBottom < iFace.zTop && jFace.zBottom > iFace.zBottom && Math.abs(jFace.zBottom - iFace.zTop) > EPSILON && Math.abs(jFace.zBottom - iFace.zBottom) > EPSILON;
|
|
199
|
+
var verticallyOverlappedBottomPart = jFace.zTop < iFace.zTop && jFace.zTop > iFace.zBottom && Math.abs(jFace.zTop - iFace.zTop) > EPSILON && Math.abs(jFace.zTop - iFace.zBottom) > EPSILON;
|
|
200
|
+
var relationship = relationshipOfTwoOverlappedLines(iFace.sectionLine, jFace.sectionLine);
|
|
201
|
+
if (overlapList.includes(relationship.result)) {
|
|
202
|
+
if (verticallyIncluded) removeIdxs.push(i);else if (verticallyOverlappedTopPart) {
|
|
127
203
|
removeIdxs.push(i);
|
|
128
|
-
|
|
204
|
+
newFaces.push({
|
|
205
|
+
sectionLine: iFace.sectionLine,
|
|
206
|
+
// cm unit
|
|
207
|
+
zBottom: iFace.zBottom,
|
|
208
|
+
// cm unit
|
|
209
|
+
zTop: jFace.zBottom,
|
|
210
|
+
// cm unit
|
|
211
|
+
depth: iFace.depthInch,
|
|
212
|
+
// inch unit
|
|
213
|
+
height: toIn(jFace.zBottom - iFace.zBottom),
|
|
214
|
+
// inch unit
|
|
215
|
+
isBackFace: iFace.isBackFace,
|
|
216
|
+
skinPanelSKU: iFace.skinPanelSKU,
|
|
217
|
+
itemInfo: iFace.itemInfo
|
|
218
|
+
});
|
|
219
|
+
} else if (verticallyOverlappedBottomPart) {
|
|
220
|
+
removeIdxs.push(i);
|
|
221
|
+
newFaces.push({
|
|
222
|
+
sectionLine: iFace.sectionLine,
|
|
223
|
+
// cm unit
|
|
224
|
+
zBottom: jFace.zTop,
|
|
225
|
+
// cm unit
|
|
226
|
+
zTop: iFace.zTop,
|
|
227
|
+
// cm unit
|
|
228
|
+
depth: iFace.depthInch,
|
|
229
|
+
// inch unit
|
|
230
|
+
height: toIn(iFace.zTop - jFace.zTop),
|
|
231
|
+
// inch unit
|
|
232
|
+
isBackFace: iFace.isBackFace,
|
|
233
|
+
skinPanelSKU: iFace.skinPanelSKU,
|
|
234
|
+
itemInfo: iFace.itemInfo
|
|
235
|
+
});
|
|
129
236
|
}
|
|
237
|
+
break;
|
|
238
|
+
} else if (relationship.result === OVERLAP_SOME && ((_relationship$trimmed = relationship.trimmedSegs) === null || _relationship$trimmed === void 0 ? void 0 : _relationship$trimmed.length) > 0 && verticallyIncluded) {
|
|
239
|
+
removeIdxs.push(i);
|
|
240
|
+
var tFaceSegs = getTrimmedFaceSegs([iFace], blockingFaces, 0);
|
|
241
|
+
if (tFaceSegs.length > 0) newFaces = [].concat(_toConsumableArray(newFaces), _toConsumableArray(tFaceSegs));
|
|
242
|
+
break;
|
|
130
243
|
}
|
|
131
244
|
}
|
|
132
245
|
}
|
|
133
|
-
|
|
246
|
+
sourceFaces = sourceFaces.filter(function (face, idx) {
|
|
134
247
|
return !removeIdxs.includes(idx);
|
|
135
248
|
});
|
|
249
|
+
if (newFaces.length > 0) sourceFaces = [].concat(_toConsumableArray(sourceFaces), _toConsumableArray(newFaces));
|
|
250
|
+
return sourceFaces;
|
|
136
251
|
}
|
|
137
252
|
function applyGroupingRules(faces) {
|
|
138
253
|
var _applyHorizontalGroup = applyHorizontalGrouping(faces),
|
|
@@ -173,7 +288,8 @@ function applyHorizontalGrouping(faces) {
|
|
|
173
288
|
// inch unit
|
|
174
289
|
height: jFace.height,
|
|
175
290
|
// inch unit
|
|
176
|
-
|
|
291
|
+
isBackFace: jFace.isBackFace,
|
|
292
|
+
skinPanelSKU: jFace.isBackFace ? 'unknown' : SKIN_SKU_BSV_48,
|
|
177
293
|
itemInfo: jFace.itemInfo // [TODO] how to select the doorstyle of grouped skin
|
|
178
294
|
});
|
|
179
295
|
removeIdxs.push(i);
|
|
@@ -216,6 +332,7 @@ function applyVerticalGrouping(faces) {
|
|
|
216
332
|
// inch unit
|
|
217
333
|
height: jFace.height,
|
|
218
334
|
// inch unit
|
|
335
|
+
isBackFace: jFace.isBackFace,
|
|
219
336
|
skinPanelSKU: SKIN_SKU_WSV_2460,
|
|
220
337
|
itemInfo: jFace.itemInfo // [TODO] how to select the doorstyle of grouped skin
|
|
221
338
|
});
|
|
@@ -243,9 +360,10 @@ function resolveTallCabinetBundle(face) {
|
|
|
243
360
|
if (isMP3TallCabinet(item.sku_number)) {
|
|
244
361
|
return [SKIN_SKU_BSV_24, SKIN_SKU_BSV_24, SKIN_SKU_WSV_2442];
|
|
245
362
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
363
|
+
if (face.height > SKIN_HEIGHT_53_25) {
|
|
364
|
+
return [SKIN_SKU_USV245325, SKIN_SKU_WSV_2442];
|
|
365
|
+
}
|
|
366
|
+
return face !== null && face !== void 0 && face.skinPanelSKU ? [face.skinPanelSKU] : [];
|
|
249
367
|
}
|
|
250
368
|
|
|
251
369
|
/**
|
|
@@ -263,34 +381,38 @@ function resolveSkinPanelSKU(face) {
|
|
|
263
381
|
* Make skin panel data with grouping skinPanelSKU & doorStyle
|
|
264
382
|
*/
|
|
265
383
|
function buildSkinPanelData(faces) {
|
|
266
|
-
var
|
|
267
|
-
var
|
|
384
|
+
var tempResult = [];
|
|
385
|
+
var _loop3 = function _loop3() {
|
|
268
386
|
var sf = faces[i];
|
|
269
387
|
var skus = resolveSkinPanelSKU(sf);
|
|
270
388
|
var _iterator = _createForOfIteratorHelper(skus),
|
|
271
389
|
_step;
|
|
272
390
|
try {
|
|
273
|
-
var
|
|
391
|
+
var _loop5 = function _loop5() {
|
|
274
392
|
var sku = _step.value;
|
|
275
|
-
var idx =
|
|
393
|
+
var idx = tempResult.findIndex(function (v) {
|
|
276
394
|
var _sf$itemInfo;
|
|
277
|
-
return v.itemSKU === sku && v.doorStyleId === ((_sf$itemInfo = sf.itemInfo) === null || _sf$itemInfo === void 0 || (_sf$itemInfo = _sf$itemInfo.doorStyle) === null || _sf$itemInfo === void 0 ? void 0 : _sf$itemInfo.id);
|
|
395
|
+
return v.itemSKU === sku && v.doorStyleId === ((_sf$itemInfo = sf.itemInfo) === null || _sf$itemInfo === void 0 || (_sf$itemInfo = _sf$itemInfo.doorStyle) === null || _sf$itemInfo === void 0 ? void 0 : _sf$itemInfo.id) && v.isBackFace === sf.isBackFace;
|
|
278
396
|
});
|
|
279
397
|
if (idx < 0) {
|
|
280
398
|
var _sf$itemInfo$doorStyl, _sf$itemInfo2, _sf$itemInfo$doorStyl2, _sf$itemInfo3;
|
|
281
|
-
|
|
399
|
+
tempResult.push({
|
|
282
400
|
itemSKU: sku,
|
|
283
401
|
doorStyle: (_sf$itemInfo$doorStyl = (_sf$itemInfo2 = sf.itemInfo) === null || _sf$itemInfo2 === void 0 || (_sf$itemInfo2 = _sf$itemInfo2.doorStyle) === null || _sf$itemInfo2 === void 0 ? void 0 : _sf$itemInfo2.name) !== null && _sf$itemInfo$doorStyl !== void 0 ? _sf$itemInfo$doorStyl : '',
|
|
284
402
|
doorStyleId: (_sf$itemInfo$doorStyl2 = (_sf$itemInfo3 = sf.itemInfo) === null || _sf$itemInfo3 === void 0 || (_sf$itemInfo3 = _sf$itemInfo3.doorStyle) === null || _sf$itemInfo3 === void 0 ? void 0 : _sf$itemInfo3.id) !== null && _sf$itemInfo$doorStyl2 !== void 0 ? _sf$itemInfo$doorStyl2 : '',
|
|
285
403
|
installationType: 'standard',
|
|
286
|
-
quantity: 1
|
|
404
|
+
quantity: 1,
|
|
405
|
+
totalLength: toIn(pointsDistance(sf.sectionLine.x1, sf.sectionLine.y1, sf.sectionLine.x2, sf.sectionLine.y2)),
|
|
406
|
+
isBackFace: sf.isBackFace
|
|
287
407
|
});
|
|
288
408
|
} else {
|
|
289
|
-
|
|
409
|
+
var faceLength = pointsDistance(sf.sectionLine.x1, sf.sectionLine.y1, sf.sectionLine.x2, sf.sectionLine.y2);
|
|
410
|
+
tempResult[idx].totalLength += toIn(faceLength);
|
|
411
|
+
tempResult[idx].quantity += 1;
|
|
290
412
|
}
|
|
291
413
|
};
|
|
292
414
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
293
|
-
|
|
415
|
+
_loop5();
|
|
294
416
|
}
|
|
295
417
|
} catch (err) {
|
|
296
418
|
_iterator.e(err);
|
|
@@ -299,19 +421,83 @@ function buildSkinPanelData(faces) {
|
|
|
299
421
|
}
|
|
300
422
|
};
|
|
301
423
|
for (var i = 0; i < faces.length; i++) {
|
|
302
|
-
|
|
424
|
+
_loop3();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// calculate back face panel quantity of island base cabinets
|
|
428
|
+
var removeIdxs = [];
|
|
429
|
+
var newDatas = [];
|
|
430
|
+
var _loop4 = function _loop4() {
|
|
431
|
+
var iData = tempResult[_i];
|
|
432
|
+
if (iData.isBackFace) {
|
|
433
|
+
removeIdxs.push(_i);
|
|
434
|
+
var count48 = Math.floor(iData.totalLength / 48);
|
|
435
|
+
var count24 = iData.totalLength % 48 > 0 ? 1 : 0;
|
|
436
|
+
var idx48 = tempResult.findIndex(function (v) {
|
|
437
|
+
return v.itemSKU === SKIN_SKU_BSV_48 && v.doorStyleId === iData.doorStyleId;
|
|
438
|
+
});
|
|
439
|
+
var idx24 = tempResult.findIndex(function (v) {
|
|
440
|
+
return v.itemSKU === SKIN_SKU_BSV_24 && v.doorStyleId === iData.doorStyleId;
|
|
441
|
+
});
|
|
442
|
+
if (idx48 < 0) {
|
|
443
|
+
if (count48 > 0) newDatas.push({
|
|
444
|
+
itemSKU: SKIN_SKU_BSV_48,
|
|
445
|
+
doorStyle: iData.doorStyle,
|
|
446
|
+
doorStyleId: iData.doorStyleId,
|
|
447
|
+
installationType: iData.installationType,
|
|
448
|
+
quantity: count48,
|
|
449
|
+
totalLength: count48 * 48,
|
|
450
|
+
isBackFace: iData.isBackFace
|
|
451
|
+
});
|
|
452
|
+
} else {
|
|
453
|
+
tempResult[idx48].quantity += count48;
|
|
454
|
+
tempResult[idx48].totalLength += count48 * 48;
|
|
455
|
+
}
|
|
456
|
+
if (idx24 < 0) {
|
|
457
|
+
if (count24 > 0) newDatas.push({
|
|
458
|
+
itemSKU: SKIN_SKU_BSV_24,
|
|
459
|
+
doorStyle: iData.doorStyle,
|
|
460
|
+
doorStyleId: iData.doorStyleId,
|
|
461
|
+
installationType: iData.installationType,
|
|
462
|
+
quantity: count24,
|
|
463
|
+
totalLength: count24 * 24,
|
|
464
|
+
isBackFace: iData.isBackFace
|
|
465
|
+
});
|
|
466
|
+
} else {
|
|
467
|
+
tempResult[idx24].quantity += count24;
|
|
468
|
+
tempResult[idx24].totalLength += count24 * 24;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
for (var _i = 0; _i < tempResult.length; _i++) {
|
|
473
|
+
_loop4();
|
|
303
474
|
}
|
|
475
|
+
tempResult = tempResult.filter(function (data, idx) {
|
|
476
|
+
return !removeIdxs.includes(idx);
|
|
477
|
+
});
|
|
478
|
+
if (newDatas.length > 0) tempResult = [].concat(_toConsumableArray(tempResult), newDatas);
|
|
479
|
+
var result = [];
|
|
480
|
+
tempResult.forEach(function (v) {
|
|
481
|
+
return result.push({
|
|
482
|
+
itemSKU: v.itemSKU,
|
|
483
|
+
doorStyle: v.doorStyle,
|
|
484
|
+
doorStyleId: v.doorStyleId,
|
|
485
|
+
installationType: v.installationType,
|
|
486
|
+
quantity: v.quantity
|
|
487
|
+
});
|
|
488
|
+
});
|
|
304
489
|
return result;
|
|
305
490
|
}
|
|
306
|
-
function shouldExcludeSkinPanel(itemJS, exclusionSet) {
|
|
491
|
+
function shouldExcludeSkinPanel(itemJS, exclusionSet, catalog) {
|
|
307
492
|
var _itemJS$doorStyle;
|
|
308
|
-
var cabinetSku =
|
|
493
|
+
var cabinetSku = getSkuAliasFromCatalog(catalog, itemJS);
|
|
309
494
|
var doorColorSku = itemJS === null || itemJS === void 0 || (_itemJS$doorStyle = itemJS.doorStyle) === null || _itemJS$doorStyle === void 0 ? void 0 : _itemJS$doorStyle.sku;
|
|
310
495
|
if (!cabinetSku || !doorColorSku) return false;
|
|
311
496
|
return exclusionSet.has("".concat(cabinetSku, "-").concat(doorColorSku));
|
|
312
497
|
}
|
|
313
498
|
export function computeSkinPanels(layer) {
|
|
314
499
|
var skinPanelExclusionSKUs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
500
|
+
var catalog = arguments.length > 2 ? arguments[2] : undefined;
|
|
315
501
|
var exclusionSet = new Set(skinPanelExclusionSKUs);
|
|
316
502
|
|
|
317
503
|
// Get candidate skin panel items and other items
|
|
@@ -319,7 +505,7 @@ export function computeSkinPanels(layer) {
|
|
|
319
505
|
skinPanelItems = _collectLayerItems.skinPanelItems,
|
|
320
506
|
otherItems = _collectLayerItems.otherItems;
|
|
321
507
|
var filteredSkinPanelItems = skinPanelItems.filter(function (item) {
|
|
322
|
-
return !shouldExcludeSkinPanel(item.toJS(), exclusionSet);
|
|
508
|
+
return !shouldExcludeSkinPanel(item.toJS(), exclusionSet, catalog);
|
|
323
509
|
});
|
|
324
510
|
|
|
325
511
|
// Get all skin face list of [skinPanelItems] & [otherItems]
|
|
@@ -136,23 +136,8 @@ function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corner, sha
|
|
|
136
136
|
var lineCount = 0; //parseInt(((newWidth) / 8 - 0.51).toFixed(), 10) - 1;
|
|
137
137
|
var rowCount = 0; //parseInt((element.type.length / lineCount - 0.51).toFixed(), 10);
|
|
138
138
|
|
|
139
|
-
// Get
|
|
140
|
-
var objSKU = this
|
|
141
|
-
if (objSKU.length !== 0) {
|
|
142
|
-
var dcId,
|
|
143
|
-
doorStyle = element.doorStyle;
|
|
144
|
-
if (doorStyle instanceof _immutable.Map) {
|
|
145
|
-
dcId = doorStyle.get('id');
|
|
146
|
-
} else {
|
|
147
|
-
dcId = doorStyle.id;
|
|
148
|
-
}
|
|
149
|
-
var skuItem = this.obj.skuArray.find(function (el) {
|
|
150
|
-
return el.door_color_id === dcId;
|
|
151
|
-
});
|
|
152
|
-
if (skuItem !== undefined) {
|
|
153
|
-
objSKU = skuItem.sku;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
139
|
+
// Get SKU Alias
|
|
140
|
+
var objSKU = (0, _helper.getSkuAliasFromCatalogElement)(this, element);
|
|
156
141
|
if (rowCount > 0) {
|
|
157
142
|
for (var _x = 0; _x < rowCount; _x++) {
|
|
158
143
|
splitStr.push(objSKU.slice(lineCount * _x, lineCount * (_x + 1)));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SKIN_SKU_WSV_2460 = exports.SKIN_SKU_WSV_2442 = exports.SKIN_SKU_WSV_1242 = exports.SKIN_SKU_USV245325 = exports.SKIN_SKU_BSV_48 = exports.SKIN_SKU_BSV_24 = exports.SKIN_HEIGHT_53_25 = void 0;
|
|
7
|
+
// skin panel SKU
|
|
8
|
+
var SKIN_SKU_BSV_24 = exports.SKIN_SKU_BSV_24 = 'BSV'; // 23.25" x 34.5" : For base cabinets
|
|
9
|
+
var SKIN_SKU_BSV_48 = exports.SKIN_SKU_BSV_48 = 'BSV48'; // 48" x 34.5" : For base cabinets back-to-back or island backs
|
|
10
|
+
var SKIN_SKU_WSV_1242 = exports.SKIN_SKU_WSV_1242 = 'WSV1242'; // 11.25" x 42" : For 12" deep wall cabinets
|
|
11
|
+
var SKIN_SKU_WSV_2442 = exports.SKIN_SKU_WSV_2442 = 'WSV2442'; // 23.25" x 42" : For 24" deep wall cabinets
|
|
12
|
+
var SKIN_SKU_WSV_2460 = exports.SKIN_SKU_WSV_2460 = 'WSV2460'; // Usually used for CT3DR or CT2DR SKUs + stacked wall cabinets
|
|
13
|
+
var SKIN_SKU_USV245325 = exports.SKIN_SKU_USV245325 = 'USV2453.25'; // 23.25" x 53.25" : For tall cabinets
|
|
14
|
+
|
|
15
|
+
var SKIN_HEIGHT_53_25 = exports.SKIN_HEIGHT_53_25 = 53.25; // in inch, height of the skin with SKU USV245325
|
package/lib/constants.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.END_DRAWING_ITEM = exports.END_DRAWING_HOLE_3D = exports.END_DRAWING_HOLE = exports.END_DRAGGING_VERTEX = exports.END_DRAGGING_LINE = exports.END_DRAGGING_ITEM_3D = exports.END_DRAGGING_ITEM = exports.END_DRAGGING_HOLE_3D = exports.END_DRAGGING_HOLE = exports.END_CREATING_HOLE = exports.END_CREATING_CABINET = exports.ELEVATION_VIEW_TITLE = exports.ELEVATION_VIEW_RIGHT = exports.ELEVATION_VIEW_LEFT = exports.ELEVATION_VIEW_KEYWORD = exports.ELEVATION_VIEW_FRONT = exports.ELEVATION_VIEW_BACK = exports.ELEVATION_VIEW = exports.ELEMENT_VERTEX = exports.ELEMENT_LINE = exports.ELEMENT_ITEM = exports.ELEMENT_HOLE = exports.ELEMENT_AREA = exports.EDIT_WIDTH = exports.EDIT = exports.DUPLICATE_SELECTED = exports.DOORSTYLE_SCOPE_SINGLE = exports.DOORSTYLE_SCOPE_MULTIPLE = exports.DOORSTYLE_SCOPE_ALL = exports.DISTANCE_MEASUREMENT_LINE_COLOR = exports.DISTANCE_EPSILON = exports.DIFFERENT_VALUES_PATH_LENGTH = exports.DELTA = exports.DEFAULT_MOLDING_PIECE_LENGTH = exports.DEFAULT_FONT_FAMILY = exports.DECIMAL_PLACES_3 = exports.DECIMAL_PLACES_2 = exports.DASH_LINE_COLOR = exports.CREATE_ROOM_WITH_SHAPE = exports.COPY_PROPERTIES = exports.CLIENTS_NAME = exports.CHANGE_WINDOW_DOOR_MEASURE = exports.CHANGE_WALL_LENGTH_MEASURE = exports.CHANGE_WALL_CABINET_MEASURE = exports.CHANGE_MEASUREMENT_UNIT = exports.CHANGE_CATALOG_PAGE = exports.CHANGE_BASE_CABINET_MEASURE = exports.CEIL_UNITS_LENGTH = exports.BROWN_COLOR = exports.BOTTOM_MOLDING_LOCATION = exports.BOTTOM = exports.BG_COLOR_OVERLAY = exports.BG_COLOR_HOVER = exports.BG_COLOR_1 = exports.BG_COLOR_0 = exports.BEGIN_UPLOADING_IMAGE = exports.BEGIN_ROTATING_ITEM_3D = exports.BEGIN_ROTATING_ITEM = exports.BEGIN_FITTING_IMAGE = exports.BEGIN_DRAWING_LINE = exports.BEGIN_DRAGGING_VERTEX = exports.BEGIN_DRAGGING_LINE = exports.BEGIN_DRAGGING_ITEM_3D = exports.BEGIN_DRAGGING_ITEM = exports.BEGIN_DRAGGING_HOLE_3D = exports.BEGIN_DRAGGING_HOLE = exports.BASE_ITEM_MEASUREMENT_LINE_COLOR = exports.BASE_CABINET_LAYOUTPOS = exports.BACK_DIST_ANG = exports.ATT_VERTEXT_TWO = exports.ATT_VERTEXT_ONE = exports.ATT_LINE_LENGTH = exports.ATT_ITEM_ROTATION = exports.ATT_ITEM_POS = exports.ATT_HOLE_OFFSET_B = exports.ATT_HOLE_OFFSET_A = exports.ARROW_TEXT_FORECOLOR = exports.ARROW_TEXT_FONTFACE = exports.ARROW_TEXT_BACKCOLOR = exports.ARROW_COLOR = exports.ARRAY_ELEVATION_VIEW_MODES = exports.ARRAY_3D_MODES = exports.AREA_ACTIONS = exports.API_SERVER_URL = exports.ANIMATE_STEP_MIN = exports.ANIMATE_STEP_MAX = exports.ANIMATE_OBJECT_OPEN_DOOR_ROTATION_UNIT = exports.ANIMATE_OBJECT = exports.ALTERATE_STATE = exports.ADD_VERTICAL_GUIDE = exports.ADD_TO_GROUP = exports.ADD_LAYER = exports.ADD_HORIZONTAL_GUIDE = exports.ADD_GROUP_FROM_SELECTED = exports.ADD_GROUP = exports.ADD_ELEMENT_TO_CATALOG = exports.ADD_CIRCULAR_GUIDE = exports.ADD_CABINETS = exports.ADD_APPLIANCES = exports.ACCENT_COLOR = void 0;
|
|
7
7
|
exports.MODE_DRAGGING_LINE = exports.MODE_DRAGGING_ITEM_3D = exports.MODE_DRAGGING_ITEM = exports.MODE_DRAGGING_HOLE_3D = exports.MODE_DRAGGING_HOLE = exports.MODE_CONFIGURING_PROJECT = exports.MODE_BACK_ELEVATION_VIEW = exports.MODE_3D_VIEW = exports.MODE_3D_FIRST_PERSON = exports.MODE_2D_ZOOM_OUT = exports.MODE_2D_ZOOM_IN = exports.MODE_2D_PAN = exports.MODE = exports.MIN_ANGLE_DISALLOW_DRAW_WALL = exports.MIDDLE_MOLDING_LOCATION = exports.MEPSILON = exports.MAX_ZOOM_IN_SCALE = exports.MAX_ANGLE_SCALE = exports.MAKE_FLOOR_PLAN = exports.LOGOUT = exports.LOGIN_SUCCESS = exports.LOGIN_ERROR = exports.LOCAL_STORAGE_TOKEN_VALUE = exports.LOCAL_STORAGE_TOKEN_NAME = exports.LOCAL_STORAGE_ORIGINAL_TOKEN = exports.LOCAL_STORAGE_CUSTOMER_INFO = exports.LOCAL_STORAGE_CART_ACTION = exports.LOAD_PROJECT = exports.LIST_QUANTITIES = exports.LIST_PARTS = exports.LINE_THICKNESS = exports.LINE_ACTIONS = exports.LEFT_DIST_ANG = exports.LEFT = exports.LABEL_COLOR = exports.KITCHEN_KONFIGURATOR = exports.KEYBOARD_BUTTON_CODE = exports.ITEM_TYPE = exports.ITEM_MOVE_UP = exports.ITEMS_ACTIONS = exports.INVERT = exports.INTERNAL_EVENT_UNSELECT_ALL = exports.INTERNAL_EVENT_TOGGLE_TO_ELEVATION = exports.INTERNAL_EVENT_SYNC_SCENE = exports.INTERNAL_EVENT_START_DRAW_WALL = exports.INTERNAL_EVENT_SELECT_ELEMENT = exports.INTERNAL_EVENT_ROTATE_ELEMENT = exports.INTERNAL_EVENT_REPLACE_CABINET = exports.INTERNAL_EVENT_ITEMS_CATALOG = exports.INTERNAL_EVENT_DRAW_ELEMENT = exports.INTERNAL_EVENT_DRAG_ELEMENT = exports.INSTALLATION_TYPE_SKU_SUFFIX = exports.INSTALLATION_TYPE_NAME = exports.INSTALLATION_SUFFIX_TYPE = exports.INIT_CATALOG = exports.HOLE_NAMES = exports.HOLE_ACTIONS = exports.HDR_URLS = exports.HAS_LOADINGBAR = exports.GROUP_TRANSLATE = exports.GROUP_ROTATE = exports.GROUP_ACTIONS = exports.GO_BACK_TO_CATALOG_PAGE = exports.FRONT_DIST_ANG = exports.FINISHING_TYPE = exports.FINISHING_TOUCH = exports.EXTERNAL_EVENT_ZOOM_OUT = exports.EXTERNAL_EVENT_ZOOM_IN = exports.EXTERNAL_EVENT_UPDATE_PROPERTY = exports.EXTERNAL_EVENT_UPDATE_ATTRIBUTE = exports.EXTERNAL_EVENT_UNDO = exports.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION = exports.EXTERNAL_EVENT_TOGGLE_TO_3D = exports.EXTERNAL_EVENT_TOGGLE_TO_2D = exports.EXTERNAL_EVENT_SYNC_SCENE = exports.EXTERNAL_EVENT_SET_MOLDING = exports.EXTERNAL_EVENT_SET_FINISHING = exports.EXTERNAL_EVENT_ROTATE_PAN = exports.EXTERNAL_EVENT_REPLACE_CABINET = exports.EXTERNAL_EVENT_REDO = exports.EXTERNAL_EVENT_PROJECT_SETTING = exports.EXTERNAL_EVENT_NEW_PROJECT = exports.EXTERNAL_EVENT_MOVE_PAN = exports.EXTERNAL_EVENT_LOAD_PROJECT = exports.EXTERNAL_EVENT_DUPLICATE_ELEMENT = exports.EXTERNAL_EVENT_DELETE_ELEMENT = exports.EXTERNAL_EVENT_CHANGE_DOORSTYLE = exports.EXTERNAL_EVENT_CENTERING_2D = exports.EXTERNAL_EVENT_ADD_WALL = exports.EXTERNAL_EVENT_ADD_ROOM_SHAPE = exports.EXTERNAL_EVENT_ADD_ITEM = exports.EXTERNAL_EVENT_ADD_HOLE = exports.ERROR_DATABASE = exports.EPSILON = exports.END_UPLOADING_IMAGE = exports.END_ROTATING_ITEM_3D = exports.END_ROTATING_ITEM = exports.END_LOADING = exports.END_FITTING_IMAGE = exports.END_DRAWING_LINE = void 0;
|
|
8
8
|
exports.SET_BACKSPLASH = exports.SET_APPLIANCE_MATERIAL = exports.SELECT_TOOL_ZOOM_OUT = exports.SELECT_TOOL_ZOOM_IN = exports.SELECT_TOOL_UPLOAD_IMAGE = exports.SELECT_TOOL_PAN = exports.SELECT_TOOL_EDIT = exports.SELECT_TOOL_DRAWING_LINE = exports.SELECT_TOOL_DRAWING_ITEM_3D = exports.SELECT_TOOL_DRAWING_ITEM = exports.SELECT_TOOL_DRAWING_HOLE_3D = exports.SELECT_TOOL_DRAWING_HOLE = exports.SELECT_TOOL_3D_VIEW = exports.SELECT_TOOL_3D_FIRST_PERSON = exports.SELECT_LINE = exports.SELECT_LAYER = exports.SELECT_ITEM = exports.SELECT_HOLE = exports.SELECT_GROUP = exports.SELECT_DOOR_STYLE = exports.SELECT_AREA = exports.SELECT_ALL = exports.SELECTALL = exports.SECONDARY_PURPLE_COLOR = exports.SECONDARY_BLUE_COLOR = exports.SCENE_ACTIONS = exports.SAVE_PROJECT = exports.SAVE_DESIGN = exports.ROOM_SHAPE_TYPE = exports.ROOM_SHAPE_MEASUREMENT_LINE_COLOR = exports.ROOM_ELEMENT_MEASUREMENT_LINE_COLOR = exports.ROLLBACK = exports.RIGHT_DIST_ANG = exports.RIGHT = exports.REVIEW_AND_QUOTE = exports.REQUEST_ASSISTANCE = exports.REPLACE_SUBMODULE = exports.REPLACE_ITEM = exports.REMOVE_VERTICAL_GUIDE = exports.REMOVE_REPLACE_SUBMODULE = exports.REMOVE_LINEAR = exports.REMOVE_LAYER = exports.REMOVE_HORIZONTAL_GUIDE = exports.REMOVE_GROUP_AND_DELETE_ELEMENTS = exports.REMOVE_GROUP = exports.REMOVE_FROM_GROUP = exports.REMOVE_DRAWING_SUPPORT = exports.REMOVE_CIRCULAR_GUIDE = exports.REMOVE = exports.REDO = exports.RECREATE = exports.PUSH_LAST_SELECTED_CATALOG_ELEMENT_TO_HISTORY = exports.PROP_RESIZE_WIDTH = exports.PROP_RESIZE_HEIGHT = exports.PROP_RESIZE_DEPTH = exports.PROP_OPEN_DOORS = exports.PROP_FLIP_DOOR_HANDLE = exports.PROP_ALTITUDE = exports.PROJECT_SETTING_OPTION = exports.PROJECT_RE_NAME = exports.PROJECT_NAME_LENGTH_LIMIT = exports.PROJECT_ACTIONS = exports.PRODUCT = exports.PRIMARY_GREEN_COLOR = exports.PASTE_PROPERTIES = exports.OVERLAP_SOME = exports.OVERLAP_SAME = exports.OVERLAP_NONE = exports.OVERLAP_LINK = exports.OVERLAP_INCLUDED = exports.OPEN_PROJECT_CONFIGURATOR = exports.OPEN_CATALOG = exports.OBJTYPE_MESH = exports.OBJTYPE_GROUP = exports.NO_DATA_DATABASE = exports.NEW_PROJECT_BTN = exports.NEW_PROJECT = exports.NEW_DESIGN = exports.MOVE_COMPONENT = exports.MOLDING_LOCATIONS = exports.MODE_WAITING_DRAWING_LINE = exports.MODE_VIEWING_CATALOG = exports.MODE_UPLOADING_IMAGE = exports.MODE_SNAPPING = exports.MODE_ROTATING_ITEM_3D = exports.MODE_ROTATING_ITEM = exports.MODE_RIGHT_ELEVATION_VIEW = exports.MODE_LEFT_ELEVATION_VIEW = exports.MODE_IDLE_3D = exports.MODE_IDLE = exports.MODE_FRONT_VIEW = exports.MODE_FRONT_ELEVATION_VIEW = exports.MODE_FITTING_IMAGE = exports.MODE_ELEVATION_VIEW = exports.MODE_DRAWING_LINE = exports.MODE_DRAWING_ITEM_3D = exports.MODE_DRAWING_ITEM = exports.MODE_DRAWING_HOLE_3D = exports.MODE_DRAWING_HOLE = exports.MODE_DRAGGING_VERTEX = void 0;
|
|
9
|
-
exports.UPDATE_3D_CEIL_HEIGHT = exports.UPDATE_2D_CAMERA = exports.UNSELECT_GROUP = exports.UNSELECT_ALL = exports.UNIT_MILLIMETER = exports.UNIT_MILE = exports.UNIT_METER = exports.UNIT_INCH_LONG = exports.UNIT_INCH = exports.UNIT_FOOT = exports.UNIT_CENTIMETER = exports.UNIT_ANGLE = exports.UNITS_LENGTH = exports.UNDO = exports.UNCREATE = exports.TWO_D_FLOOR_PLAN = exports.TOP_MOLDING_LOCATION = exports.TOP = exports.TOGGLE_SNAP = exports.TOGGLE_LOADING_CABINET = exports.TOE_KICK_MOLDING = exports.TITLE_SMALL_COLOR = exports.TITLE_COLOR = exports.THROW_WARNING = exports.THROW_ERROR = exports.TEXT_COLOR_NEUTRAL_7 = exports.TEXT_COLOR_NEUTRAL_6 = exports.TEXT_COLOR_NEUTRAL_5 = exports.TEXT_COLOR_NEUTRAL_4 = exports.TEXT_COLOR_NEUTRAL_3 = exports.TEXT_COLOR_NEUTRAL_2 = exports.TEXT_COLOR_NEUTRAL_1 = exports.TEXT_COLOR_NEUTRAL_0 = exports.TEXT_COLOR = exports.TECHNICAL_VIEW = exports.TALL_CABINET_LAYOUTPOS = exports.TAKE_PICTURE = exports.SUBTOTAL = exports.SUBMIT_REQUEST_ASSIST = exports.SUBMIT_DESIGN = exports.SUBMIT_ADD_CART = exports.STORE_DIST_ARRAY = exports.STOP_DRAWING_LINE = exports.STEP_CABINET_CHOOSE_PRODUCT = exports.STATUS_WARNING_LIGHT_COLOR = exports.STATUS_WARNING_COLOR = exports.STATUS_POSITIVE_LIGHT_COLOR = exports.STATUS_POSITIVE_COLOR = exports.STATUS_OVERDUE_LIGHT_COLOR = exports.STATUS_OVERDUE_COLOR = exports.STATUS_NEGATIVE_LIGHT_COLOR = exports.STATUS_NEGATIVE_COLOR = exports.STATUS_INFO_LIGHT_COLOR = exports.STATUS_INFO_COLOR = exports.
|
|
10
|
-
exports.ZOOM_VARIABLE = exports.WARRANTY_VIEW = exports.WARRANTY_SUPPORT = exports.WARNING_MESSAGE = exports.WALL_ITEM_MEASUREMENT_LINE_COLOR = exports.WALL_CABINET_LAYOUTPOS = exports.VIEWER3D_ACTIONS = exports.VIEWER2D_ACTIONS = exports.VERTEX_ACTIONS = exports.VANITY_CABINET_LAYOUTPOS = exports.VALIDATE_ITEM_POSTIONS = exports.USER_ACTIONS = exports.UPDATE_ZOOM_SCALE = exports.UPDATE_ROTATING_ITEM_CHANGED = exports.UPDATE_ROTATING_ITEM = exports.UPDATE_ROTATING = exports.UPDATE_POPUP_OPEN = exports.UPDATE_MOVING_STATE = exports.UPDATE_MOUSE_COORDS = exports.UPDATE_MOLDING = exports.UPDATE_ITEM_POSITION = exports.UPDATE_DRAWING_LINE = exports.UPDATE_DRAWING_ITEM = exports.UPDATE_DRAWING_HOLE_3D = exports.UPDATE_DRAWING_HOLE = exports.UPDATE_DRAGGING_VERTEX = exports.UPDATE_DRAGGING_LINE = exports.UPDATE_DRAGGING_ITEM_CHANGED = exports.UPDATE_DRAGGING_ITEM_3DY = exports.UPDATE_DRAGGING_ITEM_3DX = exports.UPDATE_DRAGGING_ITEM = exports.UPDATE_DRAGGING_HOLE_RULER_CHANGED =
|
|
9
|
+
exports.UPDATE_DRAGGING_HOLE_CHANGED = exports.UPDATE_DRAGGING_HOLE_3D = exports.UPDATE_DRAGGING_HOLE = exports.UPDATE_CEIL_HEIGHT_UNIT = exports.UPDATE_CEIL_HEIGHT = exports.UPDATE_3D_CEIL_HEIGHT_UNIT = exports.UPDATE_3D_CEIL_HEIGHT = exports.UPDATE_2D_CAMERA = exports.UNSELECT_GROUP = exports.UNSELECT_ALL = exports.UNIT_MILLIMETER = exports.UNIT_MILE = exports.UNIT_METER = exports.UNIT_INCH_LONG = exports.UNIT_INCH = exports.UNIT_FOOT = exports.UNIT_CENTIMETER = exports.UNIT_ANGLE = exports.UNITS_LENGTH = exports.UNDO = exports.UNCREATE = exports.TWO_D_FLOOR_PLAN = exports.TOP_MOLDING_LOCATION = exports.TOP = exports.TOGGLE_SNAP = exports.TOGGLE_LOADING_CABINET = exports.TOE_KICK_MOLDING = exports.TITLE_SMALL_COLOR = exports.TITLE_COLOR = exports.THROW_WARNING = exports.THROW_ERROR = exports.TEXT_COLOR_NEUTRAL_7 = exports.TEXT_COLOR_NEUTRAL_6 = exports.TEXT_COLOR_NEUTRAL_5 = exports.TEXT_COLOR_NEUTRAL_4 = exports.TEXT_COLOR_NEUTRAL_3 = exports.TEXT_COLOR_NEUTRAL_2 = exports.TEXT_COLOR_NEUTRAL_1 = exports.TEXT_COLOR_NEUTRAL_0 = exports.TEXT_COLOR = exports.TECHNICAL_VIEW = exports.TALL_CABINET_LAYOUTPOS = exports.TAKE_PICTURE = exports.SUBTOTAL = exports.SUBMIT_REQUEST_ASSIST = exports.SUBMIT_DESIGN = exports.SUBMIT_ADD_CART = exports.STORE_DIST_ARRAY = exports.STOP_DRAWING_LINE = exports.STEP_CABINET_CHOOSE_PRODUCT = exports.STATUS_WARNING_LIGHT_COLOR = exports.STATUS_WARNING_COLOR = exports.STATUS_POSITIVE_LIGHT_COLOR = exports.STATUS_POSITIVE_COLOR = exports.STATUS_OVERDUE_LIGHT_COLOR = exports.STATUS_OVERDUE_COLOR = exports.STATUS_NEGATIVE_LIGHT_COLOR = exports.STATUS_NEGATIVE_COLOR = exports.STATUS_INFO_LIGHT_COLOR = exports.STATUS_INFO_COLOR = exports.SHIFT2DON = exports.SHIFT2DOFF = exports.SHAPE_SVG_WIDTH = exports.SHAPE_SVG_PADDING = exports.SHAPE_SVG_DEPTH = exports.SHADE_LIGHT_PURPLE_COLOR = exports.SHADE_LIGHT_GREEN_COLOR = exports.SHADE_LIGHT_BLUE_COLOR = exports.SHADE_DARK_PURPLE_COLOR = exports.SHADE_DARK_GREEN_COLOR = exports.SHADE_DARK_BLUE_COLOR = exports.SET_WALL_COLOR = exports.SET_USER_DATA = exports.SET_STATE_PROPERTIES = exports.SET_ROTATE_STATUS = exports.SET_RELATED_LINE = exports.SET_PROPERTIES = exports.SET_PROJECT_PROPERTIES = exports.SET_PROJECT_ID = exports.SET_MOVE_STATUS = exports.SET_MOLDING = exports.SET_MODELLING = exports.SET_MODE = exports.SET_LINES_ATTRIBUTES = exports.SET_LAYER_PROPERTIES = exports.SET_ITEMS_ATTRIBUTES = exports.SET_IS_HELP = exports.SET_IS_CABINET_DRAWING = exports.SET_INITIAL_DOOR_STYLE = exports.SET_HOLES_ATTRIBUTES = exports.SET_HANDLE_MATERIAL = exports.SET_GROUP_PROPERTIES = exports.SET_GROUP_BARYCENTER = exports.SET_GROUP_ATTRIBUTES = exports.SET_FLOOR_STYLES = exports.SET_DOOR_STYLE = exports.SET_DOOR_HANDLE = exports.SET_DISTANT = exports.SET_COUNTER_TOP = exports.SET_BACKSPLASH_VISIBLE = void 0;
|
|
10
|
+
exports.ZOOM_VARIABLE = exports.WARRANTY_VIEW = exports.WARRANTY_SUPPORT = exports.WARNING_MESSAGE = exports.WALL_ITEM_MEASUREMENT_LINE_COLOR = exports.WALL_CABINET_LAYOUTPOS = exports.VIEWER3D_ACTIONS = exports.VIEWER2D_ACTIONS = exports.VERTEX_ACTIONS = exports.VANITY_CABINET_LAYOUTPOS = exports.VALIDATE_ITEM_POSTIONS = exports.USER_ACTIONS = exports.UPDATE_ZOOM_SCALE = exports.UPDATE_ROTATING_ITEM_CHANGED = exports.UPDATE_ROTATING_ITEM = exports.UPDATE_ROTATING = exports.UPDATE_POPUP_OPEN = exports.UPDATE_MOVING_STATE = exports.UPDATE_MOUSE_COORDS = exports.UPDATE_MOLDING = exports.UPDATE_ITEM_POSITION = exports.UPDATE_DRAWING_LINE = exports.UPDATE_DRAWING_ITEM = exports.UPDATE_DRAWING_HOLE_3D = exports.UPDATE_DRAWING_HOLE = exports.UPDATE_DRAGGING_VERTEX = exports.UPDATE_DRAGGING_LINE = exports.UPDATE_DRAGGING_ITEM_CHANGED = exports.UPDATE_DRAGGING_ITEM_3DY = exports.UPDATE_DRAGGING_ITEM_3DX = exports.UPDATE_DRAGGING_ITEM = exports.UPDATE_DRAGGING_HOLE_RULER_CHANGED = void 0;
|
|
11
11
|
//API server
|
|
12
12
|
// export const API_SERVER = 'http://localhost:3000/';
|
|
13
13
|
// ACTIONS project
|
|
@@ -781,13 +781,4 @@ var ROOM_SHAPE_TYPE = exports.ROOM_SHAPE_TYPE = {
|
|
|
781
781
|
var DOORSTYLE_SCOPE_ALL = exports.DOORSTYLE_SCOPE_ALL = 'all';
|
|
782
782
|
var DOORSTYLE_SCOPE_SINGLE = exports.DOORSTYLE_SCOPE_SINGLE = 'single';
|
|
783
783
|
var DOORSTYLE_SCOPE_MULTIPLE = exports.DOORSTYLE_SCOPE_MULTIPLE = 'multiple';
|
|
784
|
-
|
|
785
|
-
// skin panel SKU
|
|
786
|
-
var SKIN_SKU_BSV_24 = exports.SKIN_SKU_BSV_24 = 'BSV24'; // 23.25" x 34.5" : For base cabinets
|
|
787
|
-
var SKIN_SKU_BSV_48 = exports.SKIN_SKU_BSV_48 = 'BSV48'; // 48" x 34.5" : For base cabinets back-to-back or island backs
|
|
788
|
-
var SKIN_SKU_WSV_1242 = exports.SKIN_SKU_WSV_1242 = 'WSV1242'; // 11.25" x 42" : For 12" deep wall cabinets
|
|
789
|
-
var SKIN_SKU_WSV_2442 = exports.SKIN_SKU_WSV_2442 = 'WSV2442'; // 23.25" x 42" : For 24" deep wall cabinets
|
|
790
|
-
var SKIN_SKU_WSV_2460 = exports.SKIN_SKU_WSV_2460 = 'WSV2460'; // Usually used for CT3DR or CT2DR SKUs + stacked wall cabinets
|
|
791
|
-
var SKIN_SKU_USV245325 = exports.SKIN_SKU_USV245325 = 'USV2453.25'; // 23.25" x 53.25" : For tall cabinets
|
|
792
|
-
|
|
793
784
|
var DEFAULT_MOLDING_PIECE_LENGTH = exports.DEFAULT_MOLDING_PIECE_LENGTH = 96; // in inch, 8 feet, standard length for molding pieces
|
package/lib/utils/helper.js
CHANGED
|
@@ -12,6 +12,8 @@ exports.centering2D = centering2D;
|
|
|
12
12
|
exports.compareSVGRect = void 0;
|
|
13
13
|
exports.debugUtil = debugUtil;
|
|
14
14
|
exports.getSignedUrl = exports.getPathInfo = exports.getPath = void 0;
|
|
15
|
+
exports.getSkuAliasFromCatalog = getSkuAliasFromCatalog;
|
|
16
|
+
exports.getSkuAliasFromCatalogElement = getSkuAliasFromCatalogElement;
|
|
15
17
|
exports.handleCamRect = handleCamRect;
|
|
16
18
|
exports.isCeilLimitation = isCeilLimitation;
|
|
17
19
|
exports.isElevationView = isElevationView;
|
|
@@ -441,7 +443,6 @@ function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
|
441
443
|
updatedPayload.length = _length;
|
|
442
444
|
//////////////////////////////////////
|
|
443
445
|
} else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'items') {
|
|
444
|
-
var _catalog$elements$cur;
|
|
445
446
|
// check this cabinet has warning box
|
|
446
447
|
updatedPayload.isWarning = (0, _utils.isWarningItem)(currentObject);
|
|
447
448
|
// check this item is available molding
|
|
@@ -452,14 +453,7 @@ function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
|
452
453
|
if (pointArray) updatedPayload.distArray = pointArray;
|
|
453
454
|
|
|
454
455
|
// update sku_number using sku_array
|
|
455
|
-
|
|
456
|
-
var skuArray = catalog === null || catalog === void 0 || (_catalog$elements$cur = catalog.elements[currentObject.get('name')]) === null || _catalog$elements$cur === void 0 || (_catalog$elements$cur = _catalog$elements$cur.obj) === null || _catalog$elements$cur === void 0 ? void 0 : _catalog$elements$cur.skuArray;
|
|
457
|
-
var correctSKU = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
|
|
458
|
-
return sku.door_color_id === currentDoorColorId;
|
|
459
|
-
});
|
|
460
|
-
if (correctSKU) {
|
|
461
|
-
updatedPayload.sku_number = correctSKU.sku;
|
|
462
|
-
}
|
|
456
|
+
updatedPayload.sku_number = getSkuAliasFromCatalog(catalog, currentObject);
|
|
463
457
|
} else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'holes') {
|
|
464
458
|
var _calcDistancesFromHol = (0, _geometry.calcDistancesFromHoleToNearestOneOrWall)(currentObject, layer),
|
|
465
459
|
distLeft = _calcDistancesFromHol.distLeft,
|
|
@@ -476,4 +470,21 @@ function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
|
476
470
|
};
|
|
477
471
|
}
|
|
478
472
|
return updatedPayload;
|
|
473
|
+
}
|
|
474
|
+
function getSkuAliasFromCatalog(catalog, sceneObject) {
|
|
475
|
+
var _catalog$elements;
|
|
476
|
+
var sceneObjectJS = typeof (sceneObject === null || sceneObject === void 0 ? void 0 : sceneObject.toJS) === 'function' ? sceneObject.toJS() : sceneObject;
|
|
477
|
+
var elementName = sceneObjectJS === null || sceneObjectJS === void 0 ? void 0 : sceneObjectJS.name;
|
|
478
|
+
var catalogElement = catalog === null || catalog === void 0 || (_catalog$elements = catalog.elements) === null || _catalog$elements === void 0 ? void 0 : _catalog$elements[elementName];
|
|
479
|
+
return getSkuAliasFromCatalogElement(catalogElement, sceneObjectJS);
|
|
480
|
+
}
|
|
481
|
+
function getSkuAliasFromCatalogElement(catalogElement, sceneObject) {
|
|
482
|
+
var _sceneObjectJS$doorSt, _catalogElement$obj, _skuAlias$sku;
|
|
483
|
+
var sceneObjectJS = typeof (sceneObject === null || sceneObject === void 0 ? void 0 : sceneObject.toJS) === 'function' ? sceneObject.toJS() : sceneObject;
|
|
484
|
+
var doorColorId = sceneObjectJS === null || sceneObjectJS === void 0 || (_sceneObjectJS$doorSt = sceneObjectJS.doorStyle) === null || _sceneObjectJS$doorSt === void 0 ? void 0 : _sceneObjectJS$doorSt.id;
|
|
485
|
+
var skuArray = catalogElement === null || catalogElement === void 0 || (_catalogElement$obj = catalogElement.obj) === null || _catalogElement$obj === void 0 ? void 0 : _catalogElement$obj.skuArray;
|
|
486
|
+
var skuAlias = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
|
|
487
|
+
return sku.door_color_id === doorColorId;
|
|
488
|
+
});
|
|
489
|
+
return (_skuAlias$sku = skuAlias === null || skuAlias === void 0 ? void 0 : skuAlias.sku) !== null && _skuAlias$sku !== void 0 ? _skuAlias$sku : sceneObjectJS === null || sceneObjectJS === void 0 ? void 0 : sceneObjectJS.sku_number;
|
|
479
490
|
}
|
|
@@ -1620,7 +1620,7 @@ function _handleExternalEvent() {
|
|
|
1620
1620
|
|
|
1621
1621
|
// get skin panel data
|
|
1622
1622
|
skinPanelExclusionSKUs = (_props$configData$ski = props === null || props === void 0 || (_props$configData2 = props.configData) === null || _props$configData2 === void 0 ? void 0 : _props$configData2.skinPanelExclusionSKUs) !== null && _props$configData$ski !== void 0 ? _props$configData$ski : [];
|
|
1623
|
-
sceneData.layers[layerId].skinPanelData = (0, _skinPanelEngine.computeSkinPanels)(layer, skinPanelExclusionSKUs);
|
|
1623
|
+
sceneData.layers[layerId].skinPanelData = (0, _skinPanelEngine.computeSkinPanels)(layer, skinPanelExclusionSKUs, props.catalog);
|
|
1624
1624
|
|
|
1625
1625
|
// send scene object from 3DTool to HostApp using internalEvent
|
|
1626
1626
|
(_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
|
|
@@ -12,6 +12,7 @@ var _geometry = require("./geometry");
|
|
|
12
12
|
var _export = require("./export");
|
|
13
13
|
var _convertUnitsLite = require("./convert-units-lite");
|
|
14
14
|
var _helper = require("./helper");
|
|
15
|
+
var _skinPanel = require("../constants/catalog/skinPanel");
|
|
15
16
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
16
17
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
18
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -38,7 +39,8 @@ function getSideFaces(item, layer) {
|
|
|
38
39
|
var overlapList = [_constants.OVERLAP_INCLUDED, _constants.OVERLAP_SAME, _constants.OVERLAP_SOME];
|
|
39
40
|
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
40
41
|
for (var i = 0; i < 4; i++) {
|
|
41
|
-
if (i === 0
|
|
42
|
+
if (i === 0) continue; // only left & right & base cabinet's back
|
|
43
|
+
if (i === 2 && item.layoutpos !== _constants.BASE_CABINET_LAYOUTPOS) continue;
|
|
42
44
|
var isSnappedToWall = false;
|
|
43
45
|
var v0 = rotateCorner(pos[i], item, widthCm, depthCm);
|
|
44
46
|
var v1 = rotateCorner(pos[(i + 1) % 4], item, widthCm, depthCm);
|
|
@@ -72,13 +74,13 @@ function getSideFaces(item, layer) {
|
|
|
72
74
|
var skinPanelSKU = 'unknown';
|
|
73
75
|
switch (item.layoutpos) {
|
|
74
76
|
case _constants.BASE_CABINET_LAYOUTPOS:
|
|
75
|
-
skinPanelSKU =
|
|
77
|
+
skinPanelSKU = i === 2 ? 'unknown' : _skinPanel.SKIN_SKU_BSV_24;
|
|
76
78
|
break;
|
|
77
79
|
case _constants.WALL_CABINET_LAYOUTPOS:
|
|
78
|
-
if (Math.abs(depthInch - 12) <= 1) skinPanelSKU =
|
|
80
|
+
if (Math.abs(depthInch - 12) <= 1) skinPanelSKU = _skinPanel.SKIN_SKU_WSV_1242;else if (Math.abs(depthInch - 24) <= 1) skinPanelSKU = _skinPanel.SKIN_SKU_WSV_2442;
|
|
79
81
|
break;
|
|
80
82
|
case _constants.TALL_CABINET_LAYOUTPOS:
|
|
81
|
-
skinPanelSKU =
|
|
83
|
+
skinPanelSKU = _skinPanel.SKIN_SKU_USV245325;
|
|
82
84
|
break;
|
|
83
85
|
}
|
|
84
86
|
sideFaces.push({
|
|
@@ -92,6 +94,7 @@ function getSideFaces(item, layer) {
|
|
|
92
94
|
// inch unit
|
|
93
95
|
height: heightInch,
|
|
94
96
|
// inch unit
|
|
97
|
+
isBackFace: i === 2 ? true : false,
|
|
95
98
|
skinPanelSKU: skinPanelSKU,
|
|
96
99
|
itemInfo: item.toJS()
|
|
97
100
|
});
|
|
@@ -121,26 +124,138 @@ function collectFaces(items, layer) {
|
|
|
121
124
|
}
|
|
122
125
|
return faces;
|
|
123
126
|
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param {*} faceSegs
|
|
130
|
+
* @param {*} otherFaces
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
function getTrimmedFaceSegs(faceSegs, otherFaces, cnt) {
|
|
134
|
+
try {
|
|
135
|
+
cnt++;
|
|
136
|
+
if (cnt > 5000) {
|
|
137
|
+
console.log('getTrimmedFaceSegs has limited!');
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
var returnSegs = [];
|
|
141
|
+
var _loop = function _loop() {
|
|
142
|
+
var iFace = faceSegs[i];
|
|
143
|
+
var srcLine = iFace.sectionLine;
|
|
144
|
+
var bContourSeg = true;
|
|
145
|
+
var _loop2 = function _loop2(j) {
|
|
146
|
+
var destLine = otherFaces[j].sectionLine;
|
|
147
|
+
var rst = (0, _geometry.relationshipOfTwoOverlappedLines)(srcLine, destLine);
|
|
148
|
+
if (rst.result == _constants.OVERLAP_SAME || rst.result == _constants.OVERLAP_INCLUDED) {
|
|
149
|
+
bContourSeg = false;
|
|
150
|
+
return 0; // break
|
|
151
|
+
} else if (rst.result == _constants.OVERLAP_SOME) {
|
|
152
|
+
var trimmedFaceSegs = [];
|
|
153
|
+
rst.trimmedSegs.forEach(function (lineSeg) {
|
|
154
|
+
trimmedFaceSegs.push({
|
|
155
|
+
sectionLine: lineSeg,
|
|
156
|
+
// cm unit
|
|
157
|
+
zBottom: iFace.zBottom,
|
|
158
|
+
// cm unit
|
|
159
|
+
zTop: iFace.zTop,
|
|
160
|
+
// cm unit
|
|
161
|
+
depth: iFace.depthInch,
|
|
162
|
+
// inch unit
|
|
163
|
+
height: iFace.heightInch,
|
|
164
|
+
// inch unit
|
|
165
|
+
isBackFace: iFace.isBackFace,
|
|
166
|
+
skinPanelSKU: iFace.skinPanelSKU,
|
|
167
|
+
itemInfo: iFace.itemInfo
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
var tFaceSegs = getTrimmedFaceSegs(trimmedFaceSegs, otherFaces.filter(function (v, idx) {
|
|
171
|
+
return idx !== j;
|
|
172
|
+
}), cnt);
|
|
173
|
+
if (tFaceSegs.length > 0) returnSegs = [].concat((0, _toConsumableArray2["default"])(returnSegs), (0, _toConsumableArray2["default"])(tFaceSegs));
|
|
174
|
+
bContourSeg = false;
|
|
175
|
+
return 0; // break
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
_ret;
|
|
179
|
+
for (var j = 0; j < otherFaces.length; j++) {
|
|
180
|
+
_ret = _loop2(j);
|
|
181
|
+
if (_ret === 0) break;
|
|
182
|
+
}
|
|
183
|
+
if (bContourSeg) returnSegs.push(faceSegs[i]);
|
|
184
|
+
};
|
|
185
|
+
for (var i = 0; i < faceSegs.length; i++) {
|
|
186
|
+
_loop();
|
|
187
|
+
}
|
|
188
|
+
return returnSegs;
|
|
189
|
+
} catch (e) {
|
|
190
|
+
console.log('getTrimmedFaceSegs catched :', e);
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
124
194
|
function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
125
195
|
var overlapList = [_constants.OVERLAP_INCLUDED, _constants.OVERLAP_SAME];
|
|
126
196
|
var removeIdxs = [];
|
|
197
|
+
var newFaces = []; // new countour edge segment that except the overlapped part
|
|
198
|
+
|
|
127
199
|
for (var i = 0; i < sourceFaces.length; i++) {
|
|
128
200
|
var iFace = sourceFaces[i];
|
|
129
201
|
for (var j = 0; j < blockingFaces.length; j++) {
|
|
202
|
+
var _relationship$trimmed;
|
|
130
203
|
if (sourceFaces === blockingFaces && i === j) continue;
|
|
131
204
|
var jFace = blockingFaces[j];
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
205
|
+
var verticallyIncluded = (iFace.zBottom > jFace.zBottom || Math.abs(iFace.zBottom - jFace.zBottom) < _constants.EPSILON) && (iFace.zTop < jFace.zTop || Math.abs(iFace.zTop - jFace.zTop) < _constants.EPSILON);
|
|
206
|
+
var verticallyOverlappedTopPart = jFace.zBottom < iFace.zTop && jFace.zBottom > iFace.zBottom && Math.abs(jFace.zBottom - iFace.zTop) > _constants.EPSILON && Math.abs(jFace.zBottom - iFace.zBottom) > _constants.EPSILON;
|
|
207
|
+
var verticallyOverlappedBottomPart = jFace.zTop < iFace.zTop && jFace.zTop > iFace.zBottom && Math.abs(jFace.zTop - iFace.zTop) > _constants.EPSILON && Math.abs(jFace.zTop - iFace.zBottom) > _constants.EPSILON;
|
|
208
|
+
var relationship = (0, _geometry.relationshipOfTwoOverlappedLines)(iFace.sectionLine, jFace.sectionLine);
|
|
209
|
+
if (overlapList.includes(relationship.result)) {
|
|
210
|
+
if (verticallyIncluded) removeIdxs.push(i);else if (verticallyOverlappedTopPart) {
|
|
135
211
|
removeIdxs.push(i);
|
|
136
|
-
|
|
212
|
+
newFaces.push({
|
|
213
|
+
sectionLine: iFace.sectionLine,
|
|
214
|
+
// cm unit
|
|
215
|
+
zBottom: iFace.zBottom,
|
|
216
|
+
// cm unit
|
|
217
|
+
zTop: jFace.zBottom,
|
|
218
|
+
// cm unit
|
|
219
|
+
depth: iFace.depthInch,
|
|
220
|
+
// inch unit
|
|
221
|
+
height: toIn(jFace.zBottom - iFace.zBottom),
|
|
222
|
+
// inch unit
|
|
223
|
+
isBackFace: iFace.isBackFace,
|
|
224
|
+
skinPanelSKU: iFace.skinPanelSKU,
|
|
225
|
+
itemInfo: iFace.itemInfo
|
|
226
|
+
});
|
|
227
|
+
} else if (verticallyOverlappedBottomPart) {
|
|
228
|
+
removeIdxs.push(i);
|
|
229
|
+
newFaces.push({
|
|
230
|
+
sectionLine: iFace.sectionLine,
|
|
231
|
+
// cm unit
|
|
232
|
+
zBottom: jFace.zTop,
|
|
233
|
+
// cm unit
|
|
234
|
+
zTop: iFace.zTop,
|
|
235
|
+
// cm unit
|
|
236
|
+
depth: iFace.depthInch,
|
|
237
|
+
// inch unit
|
|
238
|
+
height: toIn(iFace.zTop - jFace.zTop),
|
|
239
|
+
// inch unit
|
|
240
|
+
isBackFace: iFace.isBackFace,
|
|
241
|
+
skinPanelSKU: iFace.skinPanelSKU,
|
|
242
|
+
itemInfo: iFace.itemInfo
|
|
243
|
+
});
|
|
137
244
|
}
|
|
245
|
+
break;
|
|
246
|
+
} else if (relationship.result === _constants.OVERLAP_SOME && ((_relationship$trimmed = relationship.trimmedSegs) === null || _relationship$trimmed === void 0 ? void 0 : _relationship$trimmed.length) > 0 && verticallyIncluded) {
|
|
247
|
+
removeIdxs.push(i);
|
|
248
|
+
var tFaceSegs = getTrimmedFaceSegs([iFace], blockingFaces, 0);
|
|
249
|
+
if (tFaceSegs.length > 0) newFaces = [].concat((0, _toConsumableArray2["default"])(newFaces), (0, _toConsumableArray2["default"])(tFaceSegs));
|
|
250
|
+
break;
|
|
138
251
|
}
|
|
139
252
|
}
|
|
140
253
|
}
|
|
141
|
-
|
|
254
|
+
sourceFaces = sourceFaces.filter(function (face, idx) {
|
|
142
255
|
return !removeIdxs.includes(idx);
|
|
143
256
|
});
|
|
257
|
+
if (newFaces.length > 0) sourceFaces = [].concat((0, _toConsumableArray2["default"])(sourceFaces), (0, _toConsumableArray2["default"])(newFaces));
|
|
258
|
+
return sourceFaces;
|
|
144
259
|
}
|
|
145
260
|
function applyGroupingRules(faces) {
|
|
146
261
|
var _applyHorizontalGroup = applyHorizontalGrouping(faces),
|
|
@@ -181,7 +296,8 @@ function applyHorizontalGrouping(faces) {
|
|
|
181
296
|
// inch unit
|
|
182
297
|
height: jFace.height,
|
|
183
298
|
// inch unit
|
|
184
|
-
|
|
299
|
+
isBackFace: jFace.isBackFace,
|
|
300
|
+
skinPanelSKU: jFace.isBackFace ? 'unknown' : _skinPanel.SKIN_SKU_BSV_48,
|
|
185
301
|
itemInfo: jFace.itemInfo // [TODO] how to select the doorstyle of grouped skin
|
|
186
302
|
});
|
|
187
303
|
removeIdxs.push(i);
|
|
@@ -224,7 +340,8 @@ function applyVerticalGrouping(faces) {
|
|
|
224
340
|
// inch unit
|
|
225
341
|
height: jFace.height,
|
|
226
342
|
// inch unit
|
|
227
|
-
|
|
343
|
+
isBackFace: jFace.isBackFace,
|
|
344
|
+
skinPanelSKU: _skinPanel.SKIN_SKU_WSV_2460,
|
|
228
345
|
itemInfo: jFace.itemInfo // [TODO] how to select the doorstyle of grouped skin
|
|
229
346
|
});
|
|
230
347
|
removeIdxs.push(i);
|
|
@@ -249,11 +366,12 @@ function isMP3TallCabinet(sku) {
|
|
|
249
366
|
function resolveTallCabinetBundle(face) {
|
|
250
367
|
var item = face.itemInfo;
|
|
251
368
|
if (isMP3TallCabinet(item.sku_number)) {
|
|
252
|
-
return [
|
|
369
|
+
return [_skinPanel.SKIN_SKU_BSV_24, _skinPanel.SKIN_SKU_BSV_24, _skinPanel.SKIN_SKU_WSV_2442];
|
|
253
370
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
371
|
+
if (face.height > _skinPanel.SKIN_HEIGHT_53_25) {
|
|
372
|
+
return [_skinPanel.SKIN_SKU_USV245325, _skinPanel.SKIN_SKU_WSV_2442];
|
|
373
|
+
}
|
|
374
|
+
return face !== null && face !== void 0 && face.skinPanelSKU ? [face.skinPanelSKU] : [];
|
|
257
375
|
}
|
|
258
376
|
|
|
259
377
|
/**
|
|
@@ -271,34 +389,38 @@ function resolveSkinPanelSKU(face) {
|
|
|
271
389
|
* Make skin panel data with grouping skinPanelSKU & doorStyle
|
|
272
390
|
*/
|
|
273
391
|
function buildSkinPanelData(faces) {
|
|
274
|
-
var
|
|
275
|
-
var
|
|
392
|
+
var tempResult = [];
|
|
393
|
+
var _loop3 = function _loop3() {
|
|
276
394
|
var sf = faces[i];
|
|
277
395
|
var skus = resolveSkinPanelSKU(sf);
|
|
278
396
|
var _iterator = _createForOfIteratorHelper(skus),
|
|
279
397
|
_step;
|
|
280
398
|
try {
|
|
281
|
-
var
|
|
399
|
+
var _loop5 = function _loop5() {
|
|
282
400
|
var sku = _step.value;
|
|
283
|
-
var idx =
|
|
401
|
+
var idx = tempResult.findIndex(function (v) {
|
|
284
402
|
var _sf$itemInfo;
|
|
285
|
-
return v.itemSKU === sku && v.doorStyleId === ((_sf$itemInfo = sf.itemInfo) === null || _sf$itemInfo === void 0 || (_sf$itemInfo = _sf$itemInfo.doorStyle) === null || _sf$itemInfo === void 0 ? void 0 : _sf$itemInfo.id);
|
|
403
|
+
return v.itemSKU === sku && v.doorStyleId === ((_sf$itemInfo = sf.itemInfo) === null || _sf$itemInfo === void 0 || (_sf$itemInfo = _sf$itemInfo.doorStyle) === null || _sf$itemInfo === void 0 ? void 0 : _sf$itemInfo.id) && v.isBackFace === sf.isBackFace;
|
|
286
404
|
});
|
|
287
405
|
if (idx < 0) {
|
|
288
406
|
var _sf$itemInfo$doorStyl, _sf$itemInfo2, _sf$itemInfo$doorStyl2, _sf$itemInfo3;
|
|
289
|
-
|
|
407
|
+
tempResult.push({
|
|
290
408
|
itemSKU: sku,
|
|
291
409
|
doorStyle: (_sf$itemInfo$doorStyl = (_sf$itemInfo2 = sf.itemInfo) === null || _sf$itemInfo2 === void 0 || (_sf$itemInfo2 = _sf$itemInfo2.doorStyle) === null || _sf$itemInfo2 === void 0 ? void 0 : _sf$itemInfo2.name) !== null && _sf$itemInfo$doorStyl !== void 0 ? _sf$itemInfo$doorStyl : '',
|
|
292
410
|
doorStyleId: (_sf$itemInfo$doorStyl2 = (_sf$itemInfo3 = sf.itemInfo) === null || _sf$itemInfo3 === void 0 || (_sf$itemInfo3 = _sf$itemInfo3.doorStyle) === null || _sf$itemInfo3 === void 0 ? void 0 : _sf$itemInfo3.id) !== null && _sf$itemInfo$doorStyl2 !== void 0 ? _sf$itemInfo$doorStyl2 : '',
|
|
293
411
|
installationType: 'standard',
|
|
294
|
-
quantity: 1
|
|
412
|
+
quantity: 1,
|
|
413
|
+
totalLength: toIn((0, _geometry.pointsDistance)(sf.sectionLine.x1, sf.sectionLine.y1, sf.sectionLine.x2, sf.sectionLine.y2)),
|
|
414
|
+
isBackFace: sf.isBackFace
|
|
295
415
|
});
|
|
296
416
|
} else {
|
|
297
|
-
|
|
417
|
+
var faceLength = (0, _geometry.pointsDistance)(sf.sectionLine.x1, sf.sectionLine.y1, sf.sectionLine.x2, sf.sectionLine.y2);
|
|
418
|
+
tempResult[idx].totalLength += toIn(faceLength);
|
|
419
|
+
tempResult[idx].quantity += 1;
|
|
298
420
|
}
|
|
299
421
|
};
|
|
300
422
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
301
|
-
|
|
423
|
+
_loop5();
|
|
302
424
|
}
|
|
303
425
|
} catch (err) {
|
|
304
426
|
_iterator.e(err);
|
|
@@ -307,19 +429,83 @@ function buildSkinPanelData(faces) {
|
|
|
307
429
|
}
|
|
308
430
|
};
|
|
309
431
|
for (var i = 0; i < faces.length; i++) {
|
|
310
|
-
|
|
432
|
+
_loop3();
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// calculate back face panel quantity of island base cabinets
|
|
436
|
+
var removeIdxs = [];
|
|
437
|
+
var newDatas = [];
|
|
438
|
+
var _loop4 = function _loop4() {
|
|
439
|
+
var iData = tempResult[_i];
|
|
440
|
+
if (iData.isBackFace) {
|
|
441
|
+
removeIdxs.push(_i);
|
|
442
|
+
var count48 = Math.floor(iData.totalLength / 48);
|
|
443
|
+
var count24 = iData.totalLength % 48 > 0 ? 1 : 0;
|
|
444
|
+
var idx48 = tempResult.findIndex(function (v) {
|
|
445
|
+
return v.itemSKU === _skinPanel.SKIN_SKU_BSV_48 && v.doorStyleId === iData.doorStyleId;
|
|
446
|
+
});
|
|
447
|
+
var idx24 = tempResult.findIndex(function (v) {
|
|
448
|
+
return v.itemSKU === _skinPanel.SKIN_SKU_BSV_24 && v.doorStyleId === iData.doorStyleId;
|
|
449
|
+
});
|
|
450
|
+
if (idx48 < 0) {
|
|
451
|
+
if (count48 > 0) newDatas.push({
|
|
452
|
+
itemSKU: _skinPanel.SKIN_SKU_BSV_48,
|
|
453
|
+
doorStyle: iData.doorStyle,
|
|
454
|
+
doorStyleId: iData.doorStyleId,
|
|
455
|
+
installationType: iData.installationType,
|
|
456
|
+
quantity: count48,
|
|
457
|
+
totalLength: count48 * 48,
|
|
458
|
+
isBackFace: iData.isBackFace
|
|
459
|
+
});
|
|
460
|
+
} else {
|
|
461
|
+
tempResult[idx48].quantity += count48;
|
|
462
|
+
tempResult[idx48].totalLength += count48 * 48;
|
|
463
|
+
}
|
|
464
|
+
if (idx24 < 0) {
|
|
465
|
+
if (count24 > 0) newDatas.push({
|
|
466
|
+
itemSKU: _skinPanel.SKIN_SKU_BSV_24,
|
|
467
|
+
doorStyle: iData.doorStyle,
|
|
468
|
+
doorStyleId: iData.doorStyleId,
|
|
469
|
+
installationType: iData.installationType,
|
|
470
|
+
quantity: count24,
|
|
471
|
+
totalLength: count24 * 24,
|
|
472
|
+
isBackFace: iData.isBackFace
|
|
473
|
+
});
|
|
474
|
+
} else {
|
|
475
|
+
tempResult[idx24].quantity += count24;
|
|
476
|
+
tempResult[idx24].totalLength += count24 * 24;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
for (var _i = 0; _i < tempResult.length; _i++) {
|
|
481
|
+
_loop4();
|
|
311
482
|
}
|
|
483
|
+
tempResult = tempResult.filter(function (data, idx) {
|
|
484
|
+
return !removeIdxs.includes(idx);
|
|
485
|
+
});
|
|
486
|
+
if (newDatas.length > 0) tempResult = [].concat((0, _toConsumableArray2["default"])(tempResult), newDatas);
|
|
487
|
+
var result = [];
|
|
488
|
+
tempResult.forEach(function (v) {
|
|
489
|
+
return result.push({
|
|
490
|
+
itemSKU: v.itemSKU,
|
|
491
|
+
doorStyle: v.doorStyle,
|
|
492
|
+
doorStyleId: v.doorStyleId,
|
|
493
|
+
installationType: v.installationType,
|
|
494
|
+
quantity: v.quantity
|
|
495
|
+
});
|
|
496
|
+
});
|
|
312
497
|
return result;
|
|
313
498
|
}
|
|
314
|
-
function shouldExcludeSkinPanel(itemJS, exclusionSet) {
|
|
499
|
+
function shouldExcludeSkinPanel(itemJS, exclusionSet, catalog) {
|
|
315
500
|
var _itemJS$doorStyle;
|
|
316
|
-
var cabinetSku =
|
|
501
|
+
var cabinetSku = (0, _helper.getSkuAliasFromCatalog)(catalog, itemJS);
|
|
317
502
|
var doorColorSku = itemJS === null || itemJS === void 0 || (_itemJS$doorStyle = itemJS.doorStyle) === null || _itemJS$doorStyle === void 0 ? void 0 : _itemJS$doorStyle.sku;
|
|
318
503
|
if (!cabinetSku || !doorColorSku) return false;
|
|
319
504
|
return exclusionSet.has("".concat(cabinetSku, "-").concat(doorColorSku));
|
|
320
505
|
}
|
|
321
506
|
function computeSkinPanels(layer) {
|
|
322
507
|
var skinPanelExclusionSKUs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
508
|
+
var catalog = arguments.length > 2 ? arguments[2] : undefined;
|
|
323
509
|
var exclusionSet = new Set(skinPanelExclusionSKUs);
|
|
324
510
|
|
|
325
511
|
// Get candidate skin panel items and other items
|
|
@@ -327,7 +513,7 @@ function computeSkinPanels(layer) {
|
|
|
327
513
|
skinPanelItems = _collectLayerItems.skinPanelItems,
|
|
328
514
|
otherItems = _collectLayerItems.otherItems;
|
|
329
515
|
var filteredSkinPanelItems = skinPanelItems.filter(function (item) {
|
|
330
|
-
return !shouldExcludeSkinPanel(item.toJS(), exclusionSet);
|
|
516
|
+
return !shouldExcludeSkinPanel(item.toJS(), exclusionSet, catalog);
|
|
331
517
|
});
|
|
332
518
|
|
|
333
519
|
// Get all skin face list of [skinPanelItems] & [otherItems]
|