kitchen-simulator 10.14.0 → 10.16.0
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.
|
@@ -97,9 +97,9 @@ function parseTempPlaceholdersFromCabinetPayload(_x2) {
|
|
|
97
97
|
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
98
98
|
function _parseTempPlaceholdersFromCabinetPayload() {
|
|
99
99
|
_parseTempPlaceholdersFromCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(cabinetPayload) {
|
|
100
|
-
var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData,
|
|
101
|
-
return _regenerator["default"].wrap(function (
|
|
102
|
-
while (1) switch (
|
|
100
|
+
var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData, _loop3, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, k, _cabinetPayload$struc3, _t2, _t3, _t4;
|
|
101
|
+
return _regenerator["default"].wrap(function (_context5) {
|
|
102
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
103
103
|
case 0:
|
|
104
104
|
link = '';
|
|
105
105
|
keys = Object.keys(cabinetPayload.structure_json);
|
|
@@ -107,341 +107,356 @@ function _parseTempPlaceholdersFromCabinetPayload() {
|
|
|
107
107
|
i = 0;
|
|
108
108
|
case 1:
|
|
109
109
|
if (!(i < keys.length)) {
|
|
110
|
-
|
|
110
|
+
_context5.next = 4;
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
113
|
if (!((_cabinetPayload$struc = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc !== void 0 && (_cabinetPayload$struc = _cabinetPayload$struc.toString()) !== null && _cabinetPayload$struc !== void 0 && _cabinetPayload$struc.includes('.gltf') && (_cabinetPayload$struc2 = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc2 !== void 0 && (_cabinetPayload$struc2 = _cabinetPayload$struc2.toString()) !== null && _cabinetPayload$struc2 !== void 0 && _cabinetPayload$struc2.startsWith('http'))) {
|
|
114
|
-
|
|
114
|
+
_context5.next = 3;
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
117
|
link = cabinetPayload.structure_json[keys[i]];
|
|
118
118
|
_t2 = temp;
|
|
119
119
|
_t3 = keys[i];
|
|
120
|
-
|
|
120
|
+
_context5.next = 2;
|
|
121
121
|
return loadJSON(link);
|
|
122
122
|
case 2:
|
|
123
|
-
_t4 =
|
|
123
|
+
_t4 = _context5.sent;
|
|
124
124
|
_t2.push.call(_t2, {
|
|
125
125
|
name: _t3,
|
|
126
126
|
data: _t4
|
|
127
127
|
});
|
|
128
128
|
case 3:
|
|
129
129
|
i++;
|
|
130
|
-
|
|
130
|
+
_context5.next = 1;
|
|
131
131
|
break;
|
|
132
132
|
case 4:
|
|
133
133
|
tempPlaceholdersData = [];
|
|
134
|
-
|
|
135
|
-
el
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
134
|
+
_loop3 = /*#__PURE__*/_regenerator["default"].mark(function _loop3(k) {
|
|
135
|
+
var el;
|
|
136
|
+
return _regenerator["default"].wrap(function (_context4) {
|
|
137
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
138
|
+
case 0:
|
|
139
|
+
el = cabinetPayload.structure_json.tempPlaceholders[k].id;
|
|
140
|
+
tempData = {};
|
|
141
|
+
doorKey = 0;
|
|
142
|
+
drawerKey = 0;
|
|
143
|
+
fixedKey = 0;
|
|
144
|
+
doorPHs = 0;
|
|
145
|
+
drawerPHs = 0;
|
|
146
|
+
has_single_door = false;
|
|
147
|
+
fixedPHs = 0;
|
|
148
|
+
temp.forEach(function (t, index) {
|
|
149
|
+
var nodes = t.data.nodes;
|
|
150
|
+
if (nodes === undefined) {
|
|
151
|
+
nodes = [];
|
|
152
|
+
}
|
|
153
|
+
var tempPlaceholders = nodes.filter(function (element) {
|
|
154
|
+
return element.name.startsWith('ph_');
|
|
155
|
+
});
|
|
156
|
+
tempPlaceholders.sort(function (a, b) {
|
|
157
|
+
return a.name > b.name ? 1 : -1;
|
|
158
|
+
});
|
|
159
|
+
if (tempPlaceholders.length > 0) {
|
|
160
|
+
if (t.name === 'base') {
|
|
161
|
+
tempPlaceholders.map(function (element) {
|
|
162
|
+
var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
|
|
163
|
+
if (sink_match && sink_match.length >= 2) {
|
|
164
|
+
var _process$env$API_URL, _cabinetPayload$struc4;
|
|
165
|
+
tempData['sink'] = tempData['sink'] || [];
|
|
166
|
+
tempData['sink'].push(element.name);
|
|
167
|
+
var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
|
|
168
|
+
// server url from 3DTool env
|
|
169
|
+
import.meta.env.VITE_APP_API_URL + // server url from Host env
|
|
170
|
+
"/uploads/assets/default/".concat(sink_match[1], ".gltf");
|
|
171
|
+
if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc4 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc4 !== void 0 && (_cabinetPayload$struc4 = _cabinetPayload$struc4.tempPlaceholders[k]) !== null && _cabinetPayload$struc4 !== void 0 && _cabinetPayload$struc4.structure) cabinetPayload.structure_json.tempPlaceholders[k].structure.sink = sink_url;
|
|
172
|
+
} else if (temp.some(function (felement) {
|
|
173
|
+
return felement.name.includes('base_drawer');
|
|
174
|
+
}) && element.name.includes('interior_drawer')) {
|
|
175
|
+
var objCnt = temp.filter(function (felement) {
|
|
176
|
+
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
177
|
+
}).length;
|
|
178
|
+
var phCnt = tempPlaceholders.filter(function (felement) {
|
|
179
|
+
return felement.name.includes('interior');
|
|
180
|
+
}).length;
|
|
181
|
+
drawerPHs = phCnt;
|
|
182
|
+
if (objCnt === 1 || phCnt % objCnt !== 0) {
|
|
183
|
+
if (tempData['base_drawer_1'] === undefined) {
|
|
184
|
+
tempData['base_drawer_1'] = [];
|
|
185
|
+
}
|
|
186
|
+
tempData['base_drawer_1'].push(element.name);
|
|
187
|
+
drawerKey++;
|
|
188
|
+
} else if (objCnt > 1 && phCnt % objCnt === 0) {
|
|
189
|
+
if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
|
|
190
|
+
tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
|
|
191
|
+
}
|
|
192
|
+
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
193
|
+
drawerKey++;
|
|
194
|
+
}
|
|
195
|
+
} else if (temp.some(function (felement) {
|
|
196
|
+
return felement.name.includes('base_door');
|
|
197
|
+
}) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
|
|
198
|
+
var _objCnt = temp.filter(function (felement) {
|
|
199
|
+
return felement.name.includes('base_door');
|
|
200
|
+
}).length;
|
|
201
|
+
var _phCnt = tempPlaceholders.filter(function (felement) {
|
|
202
|
+
return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
|
|
203
|
+
}).length;
|
|
204
|
+
doorPHs = _phCnt;
|
|
205
|
+
if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
|
|
206
|
+
if (tempData['base_door_1'] === undefined) {
|
|
207
|
+
tempData['base_door_1'] = [];
|
|
208
|
+
}
|
|
209
|
+
tempData['base_door_1'].push(element.name);
|
|
210
|
+
doorKey++;
|
|
211
|
+
} else if (_objCnt > 1) {
|
|
212
|
+
if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
|
|
213
|
+
tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
|
|
214
|
+
}
|
|
215
|
+
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
216
|
+
doorKey++;
|
|
217
|
+
}
|
|
218
|
+
} else if (temp.some(function (felement) {
|
|
219
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
220
|
+
}) && element.name.includes('_drawer_door_fixed')) {
|
|
221
|
+
var _objCnt2 = temp.filter(function (felement) {
|
|
222
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
223
|
+
}).length;
|
|
224
|
+
var _phCnt2 = tempPlaceholders.filter(function (felement) {
|
|
225
|
+
return felement.name.includes('_drawer_door_fixed');
|
|
226
|
+
}).length;
|
|
227
|
+
fixedPHs = _phCnt2;
|
|
228
|
+
if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
|
|
229
|
+
if (tempData['base_fixed_drawer_door_1'] === undefined) {
|
|
230
|
+
tempData['base_fixed_drawer_door_1'] = [];
|
|
231
|
+
}
|
|
232
|
+
tempData['base_fixed_drawer_door_1'].push(element.name);
|
|
233
|
+
fixedKey++;
|
|
234
|
+
} else if (_objCnt2 > 1) {
|
|
235
|
+
if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
|
|
236
|
+
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
|
|
237
|
+
}
|
|
238
|
+
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
239
|
+
fixedKey++;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
176
244
|
var objCnt = temp.filter(function (felement) {
|
|
177
245
|
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
178
246
|
}).length;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
247
|
+
if (objCnt === 1 || drawerPHs % objCnt !== 0) {
|
|
248
|
+
if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
|
|
249
|
+
//get drawer door handle placeholders
|
|
250
|
+
var ph_temp = temp.find(function (felement) {
|
|
251
|
+
return felement.name === 'base_drawer_door_1';
|
|
252
|
+
});
|
|
253
|
+
if (ph_temp != undefined) {
|
|
254
|
+
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
255
|
+
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
256
|
+
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
257
|
+
});
|
|
258
|
+
for (var w = 0; w < drawerPHs; w++) {
|
|
259
|
+
if (!tempData['base_drawer_door_1'].some(function (el) {
|
|
260
|
+
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
261
|
+
})) {
|
|
262
|
+
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
263
|
+
//add drawer door handle placeholders
|
|
264
|
+
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
265
|
+
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
186
268
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
269
|
+
} else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
|
|
270
|
+
if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
|
|
271
|
+
//get drawer door handle placeholders
|
|
272
|
+
var ph_temp = temp.find(function (felement) {
|
|
273
|
+
return felement.name === 'base_drawer_door' + t.name.slice(-2);
|
|
274
|
+
});
|
|
275
|
+
if (ph_temp != undefined) {
|
|
276
|
+
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
277
|
+
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
278
|
+
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
279
|
+
});
|
|
280
|
+
tempPlaceholders.forEach(function (element) {
|
|
281
|
+
if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
|
|
282
|
+
return el === t.name + '/' + element.name;
|
|
283
|
+
})) {
|
|
284
|
+
tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
|
|
285
|
+
//add drawer door handle placeholders
|
|
286
|
+
if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
|
|
287
|
+
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle' + t.name.slice(-2)].push('base_drawer_door' + t.name.slice(-2) + '/' + ph_drawer_door_handle[0].name);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
192
290
|
}
|
|
193
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
194
|
-
drawerKey++;
|
|
195
291
|
}
|
|
196
|
-
} else if (
|
|
197
|
-
|
|
198
|
-
}) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
|
|
199
|
-
var _objCnt = temp.filter(function (felement) {
|
|
292
|
+
} else if (t.name.includes('base_door')) {
|
|
293
|
+
var _objCnt3 = temp.filter(function (felement) {
|
|
200
294
|
return felement.name.includes('base_door');
|
|
201
295
|
}).length;
|
|
202
|
-
|
|
203
|
-
return
|
|
204
|
-
})
|
|
205
|
-
doorPHs
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
tempData['base_door_1'] = [];
|
|
296
|
+
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
297
|
+
return el.name.includes('handle');
|
|
298
|
+
});
|
|
299
|
+
if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
|
|
300
|
+
if (tempData['door_handle_1'] === undefined) {
|
|
301
|
+
tempData['door_handle_1'] = [];
|
|
209
302
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
303
|
+
var _loop4 = function _loop4() {
|
|
304
|
+
var phname = tempPlaceholders[0].name;
|
|
305
|
+
var newph = undefined;
|
|
306
|
+
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
307
|
+
newph = tempPlaceholders.find(function (el) {
|
|
308
|
+
return el.name.isRightPlaceholder();
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
312
|
+
newph = tempPlaceholders.find(function (el) {
|
|
313
|
+
return el.name.isLeftPlaceholder();
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
if (newph != undefined) {
|
|
317
|
+
phname = newph.name;
|
|
318
|
+
}
|
|
319
|
+
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
320
|
+
return el.name.isLeftPlaceholder();
|
|
321
|
+
}) != undefined && tempPlaceholders.find(function (el) {
|
|
322
|
+
return el.name.isRightPlaceholder();
|
|
323
|
+
}) != undefined) {
|
|
324
|
+
has_single_door = true;
|
|
325
|
+
}
|
|
326
|
+
if (!tempData['door_handle_1'].some(function (el) {
|
|
327
|
+
return el === 'door_handle_1/' + phname;
|
|
328
|
+
})) {
|
|
329
|
+
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
for (var _w = 0; _w < doorPHs; _w++) {
|
|
333
|
+
_loop4();
|
|
334
|
+
}
|
|
335
|
+
} else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
|
|
336
|
+
if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
|
|
337
|
+
var phname = tempPlaceholders[0].name;
|
|
338
|
+
var newph = undefined;
|
|
339
|
+
var blAdd = true;
|
|
340
|
+
if (cabinetPayload.is_corner) {
|
|
341
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
342
|
+
newph = tempPlaceholders.find(function (el) {
|
|
343
|
+
return el.name.isLeftPlaceholder();
|
|
344
|
+
});
|
|
345
|
+
} else {
|
|
346
|
+
blAdd = false;
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
350
|
+
newph = tempPlaceholders.find(function (el) {
|
|
351
|
+
return el.name.isRightPlaceholder();
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
355
|
+
newph = tempPlaceholders.find(function (el) {
|
|
356
|
+
return el.name.isLeftPlaceholder();
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (blAdd) {
|
|
361
|
+
if (newph != undefined) {
|
|
362
|
+
phname = newph.name;
|
|
363
|
+
}
|
|
364
|
+
if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
|
|
365
|
+
return el === t.name + '/' + phname;
|
|
366
|
+
})) {
|
|
367
|
+
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
368
|
+
}
|
|
215
369
|
}
|
|
216
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
217
|
-
doorKey++;
|
|
218
370
|
}
|
|
219
|
-
} else if (
|
|
220
|
-
|
|
221
|
-
}) && element.name.includes('_drawer_door_fixed')) {
|
|
222
|
-
var _objCnt2 = temp.filter(function (felement) {
|
|
371
|
+
} else if (t.name.includes('base_fixed_drawer_door')) {
|
|
372
|
+
var _objCnt4 = temp.filter(function (felement) {
|
|
223
373
|
return felement.name.includes('base_fixed_drawer_door');
|
|
224
374
|
}).length;
|
|
225
|
-
|
|
226
|
-
return
|
|
227
|
-
})
|
|
228
|
-
fixedPHs
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
375
|
+
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
376
|
+
return el.name.includes('handle');
|
|
377
|
+
});
|
|
378
|
+
if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
|
|
379
|
+
if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
|
|
380
|
+
var _loop5 = function _loop5() {
|
|
381
|
+
var phname = tempPlaceholders[0].name;
|
|
382
|
+
var newph = undefined;
|
|
383
|
+
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
384
|
+
newph = tempPlaceholders.find(function (el) {
|
|
385
|
+
return el.name.isRightPlaceholder();
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
389
|
+
newph = tempPlaceholders.find(function (el) {
|
|
390
|
+
return el.name.isLeftPlaceholder();
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
if (newph != undefined) {
|
|
394
|
+
phname = newph.name;
|
|
395
|
+
}
|
|
396
|
+
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
397
|
+
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
398
|
+
})) {
|
|
399
|
+
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
403
|
+
_loop5();
|
|
232
404
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
405
|
+
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
406
|
+
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
407
|
+
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
408
|
+
}
|
|
409
|
+
var _phname = tempPlaceholders[0].name;
|
|
410
|
+
var _newph = undefined;
|
|
411
|
+
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
412
|
+
_newph = tempPlaceholders.find(function (el) {
|
|
413
|
+
return el.name.isRightPlaceholder();
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
417
|
+
_newph = tempPlaceholders.find(function (el) {
|
|
418
|
+
return el.name.isLeftPlaceholder();
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
if (_newph != undefined) {
|
|
422
|
+
_phname = _newph.name;
|
|
423
|
+
}
|
|
424
|
+
if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
|
|
425
|
+
return el === t.name + '/' + _phname;
|
|
426
|
+
})) {
|
|
427
|
+
tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
|
|
238
428
|
}
|
|
239
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
240
|
-
fixedKey++;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
246
|
-
var objCnt = temp.filter(function (felement) {
|
|
247
|
-
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
248
|
-
}).length;
|
|
249
|
-
if (objCnt === 1 || drawerPHs % objCnt !== 0) {
|
|
250
|
-
if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
|
|
251
|
-
//get drawer door handle placeholders
|
|
252
|
-
var ph_temp = temp.find(function (felement) {
|
|
253
|
-
return felement.name === 'base_drawer_door_1';
|
|
254
|
-
});
|
|
255
|
-
if (ph_temp != undefined) {
|
|
256
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
257
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
258
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
259
|
-
});
|
|
260
|
-
for (var w = 0; w < drawerPHs; w++) {
|
|
261
|
-
if (!tempData['base_drawer_door_1'].some(function (el) {
|
|
262
|
-
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
263
|
-
})) {
|
|
264
|
-
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
265
|
-
//add drawer door handle placeholders
|
|
266
|
-
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
267
|
-
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
268
429
|
}
|
|
269
430
|
}
|
|
270
431
|
}
|
|
271
|
-
} else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
|
|
272
|
-
if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
|
|
273
|
-
//get drawer door handle placeholders
|
|
274
|
-
var ph_temp = temp.find(function (felement) {
|
|
275
|
-
return felement.name === 'base_drawer_door' + t.name.slice(-2);
|
|
276
|
-
});
|
|
277
|
-
if (ph_temp != undefined) {
|
|
278
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
279
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
280
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
281
|
-
});
|
|
282
|
-
tempPlaceholders.forEach(function (element) {
|
|
283
|
-
if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
|
|
284
|
-
return el === t.name + '/' + element.name;
|
|
285
|
-
})) {
|
|
286
|
-
tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
|
|
287
|
-
//add drawer door handle placeholders
|
|
288
|
-
if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
|
|
289
|
-
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle' + t.name.slice(-2)].push('base_drawer_door' + t.name.slice(-2) + '/' + ph_drawer_door_handle[0].name);
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
} else if (t.name.includes('base_door')) {
|
|
295
|
-
var _objCnt3 = temp.filter(function (felement) {
|
|
296
|
-
return felement.name.includes('base_door');
|
|
297
|
-
}).length;
|
|
298
|
-
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
299
|
-
return el.name.includes('handle');
|
|
300
432
|
});
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
var _loop3 = function _loop3() {
|
|
306
|
-
var phname = tempPlaceholders[0].name;
|
|
307
|
-
var newph = undefined;
|
|
308
|
-
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
309
|
-
newph = tempPlaceholders.find(function (el) {
|
|
310
|
-
return el.name.isRightPlaceholder();
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
314
|
-
newph = tempPlaceholders.find(function (el) {
|
|
315
|
-
return el.name.isLeftPlaceholder();
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
if (newph != undefined) {
|
|
319
|
-
phname = newph.name;
|
|
320
|
-
}
|
|
321
|
-
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
322
|
-
return el.name.isLeftPlaceholder();
|
|
323
|
-
}) != undefined && tempPlaceholders.find(function (el) {
|
|
324
|
-
return el.name.isRightPlaceholder();
|
|
325
|
-
}) != undefined) {
|
|
326
|
-
has_single_door = true;
|
|
327
|
-
}
|
|
328
|
-
if (!tempData['door_handle_1'].some(function (el) {
|
|
329
|
-
return el === 'door_handle_1/' + phname;
|
|
330
|
-
})) {
|
|
331
|
-
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
for (var _w = 0; _w < doorPHs; _w++) {
|
|
335
|
-
_loop3();
|
|
336
|
-
}
|
|
337
|
-
} else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
|
|
338
|
-
if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
|
|
339
|
-
var phname = tempPlaceholders[0].name;
|
|
340
|
-
var newph = undefined;
|
|
341
|
-
var blAdd = true;
|
|
342
|
-
if (cabinetPayload.is_corner) {
|
|
343
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
344
|
-
newph = tempPlaceholders.find(function (el) {
|
|
345
|
-
return el.name.isLeftPlaceholder();
|
|
346
|
-
});
|
|
347
|
-
} else {
|
|
348
|
-
blAdd = false;
|
|
349
|
-
}
|
|
350
|
-
} else {
|
|
351
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
352
|
-
newph = tempPlaceholders.find(function (el) {
|
|
353
|
-
return el.name.isRightPlaceholder();
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
357
|
-
newph = tempPlaceholders.find(function (el) {
|
|
358
|
-
return el.name.isLeftPlaceholder();
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (blAdd) {
|
|
363
|
-
if (newph != undefined) {
|
|
364
|
-
phname = newph.name;
|
|
365
|
-
}
|
|
366
|
-
if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
|
|
367
|
-
return el === t.name + '/' + phname;
|
|
368
|
-
})) {
|
|
369
|
-
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
} else if (t.name.includes('base_fixed_drawer_door')) {
|
|
374
|
-
var _objCnt4 = temp.filter(function (felement) {
|
|
375
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
376
|
-
}).length;
|
|
377
|
-
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
378
|
-
return el.name.includes('handle');
|
|
433
|
+
tempPlaceholdersData.push({
|
|
434
|
+
id: parseInt(el, 10),
|
|
435
|
+
placeholders: tempData,
|
|
436
|
+
structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
|
|
379
437
|
});
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
var phname = tempPlaceholders[0].name;
|
|
384
|
-
var newph = undefined;
|
|
385
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
386
|
-
newph = tempPlaceholders.find(function (el) {
|
|
387
|
-
return el.name.isRightPlaceholder();
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
391
|
-
newph = tempPlaceholders.find(function (el) {
|
|
392
|
-
return el.name.isLeftPlaceholder();
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
if (newph != undefined) {
|
|
396
|
-
phname = newph.name;
|
|
397
|
-
}
|
|
398
|
-
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
399
|
-
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
400
|
-
})) {
|
|
401
|
-
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
405
|
-
_loop4();
|
|
406
|
-
}
|
|
407
|
-
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
408
|
-
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
409
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
410
|
-
}
|
|
411
|
-
var _phname = tempPlaceholders[0].name;
|
|
412
|
-
var _newph = undefined;
|
|
413
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
414
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
415
|
-
return el.name.isRightPlaceholder();
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
419
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
420
|
-
return el.name.isLeftPlaceholder();
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
if (_newph != undefined) {
|
|
424
|
-
_phname = _newph.name;
|
|
425
|
-
}
|
|
426
|
-
if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
|
|
427
|
-
return el === t.name + '/' + _phname;
|
|
428
|
-
})) {
|
|
429
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
438
|
+
case 1:
|
|
439
|
+
case "end":
|
|
440
|
+
return _context4.stop();
|
|
433
441
|
}
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
placeholders: tempData,
|
|
438
|
-
structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
return _context4.abrupt("return", tempPlaceholdersData);
|
|
442
|
+
}, _loop3);
|
|
443
|
+
});
|
|
444
|
+
k = 0;
|
|
442
445
|
case 5:
|
|
446
|
+
if (!(k < (cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$struc3 = cabinetPayload.structure_json) === null || _cabinetPayload$struc3 === void 0 || (_cabinetPayload$struc3 = _cabinetPayload$struc3.tempPlaceholders) === null || _cabinetPayload$struc3 === void 0 ? void 0 : _cabinetPayload$struc3.length))) {
|
|
447
|
+
_context5.next = 7;
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
return _context5.delegateYield(_loop3(k), "t0", 6);
|
|
451
|
+
case 6:
|
|
452
|
+
k++;
|
|
453
|
+
_context5.next = 5;
|
|
454
|
+
break;
|
|
455
|
+
case 7:
|
|
456
|
+
return _context5.abrupt("return", tempPlaceholdersData);
|
|
457
|
+
case 8:
|
|
443
458
|
case "end":
|
|
444
|
-
return
|
|
459
|
+
return _context5.stop();
|
|
445
460
|
}
|
|
446
461
|
}, _callee4);
|
|
447
462
|
}));
|
|
@@ -453,14 +468,14 @@ function updateCabinetPayload(_x3) {
|
|
|
453
468
|
function _updateCabinetPayload() {
|
|
454
469
|
_updateCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(cabinetPayload) {
|
|
455
470
|
var tempPlaceholders, cabinetPayloadKeys, i;
|
|
456
|
-
return _regenerator["default"].wrap(function (
|
|
457
|
-
while (1) switch (
|
|
471
|
+
return _regenerator["default"].wrap(function (_context6) {
|
|
472
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
458
473
|
case 0:
|
|
459
474
|
tempPlaceholders = [];
|
|
460
|
-
|
|
475
|
+
_context6.next = 1;
|
|
461
476
|
return parseTempPlaceholdersFromCabinetPayload(cabinetPayload);
|
|
462
477
|
case 1:
|
|
463
|
-
tempPlaceholders =
|
|
478
|
+
tempPlaceholders = _context6.sent;
|
|
464
479
|
cabinetPayloadKeys = Object.keys(cabinetPayload);
|
|
465
480
|
for (i = 0; i < cabinetPayloadKeys.length; i++) {
|
|
466
481
|
if (cabinetPayloadKeys[i] === 'structure_json') {
|
|
@@ -472,10 +487,10 @@ function _updateCabinetPayload() {
|
|
|
472
487
|
cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] = tempPlaceholders;
|
|
473
488
|
}
|
|
474
489
|
}
|
|
475
|
-
return
|
|
490
|
+
return _context6.abrupt("return", cabinetPayload);
|
|
476
491
|
case 2:
|
|
477
492
|
case "end":
|
|
478
|
-
return
|
|
493
|
+
return _context6.stop();
|
|
479
494
|
}
|
|
480
495
|
}, _callee5);
|
|
481
496
|
}));
|
|
@@ -579,22 +594,22 @@ function _addItemToCatalog() {
|
|
|
579
594
|
_addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(element, state, catalogInstance, projectActions) {
|
|
580
595
|
var _elementJs, _elementJs3;
|
|
581
596
|
var elementJs, outlineSVGData, _state$getIn, _elementJs$structure_, _elementJs$structure_2, _elementJs$structure_3, cds, _cds$find, _elementJs2, currentCdsId, cdsIdx, ttph, updatedStructureJson, catalogElements, catalogElementKeys, catalogItem, k, _catalogElements$cata, tempPlaceholderArray, _catalogItem$structur, newTempPlaceholderArray, mergedTempPlaceholder;
|
|
582
|
-
return _regenerator["default"].wrap(function (
|
|
583
|
-
while (1) switch (
|
|
597
|
+
return _regenerator["default"].wrap(function (_context7) {
|
|
598
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
584
599
|
case 0:
|
|
585
600
|
if (!(0, _helper.isEmpty)(element === null || element === void 0 ? void 0 : element.name)) {
|
|
586
|
-
|
|
601
|
+
_context7.next = 1;
|
|
587
602
|
break;
|
|
588
603
|
}
|
|
589
|
-
return
|
|
604
|
+
return _context7.abrupt("return");
|
|
590
605
|
case 1:
|
|
591
606
|
elementJs = populateCCDFList(element); // if (isEmpty(catalog?.elements[element.name])) {
|
|
592
|
-
|
|
607
|
+
_context7.next = 2;
|
|
593
608
|
return loadSVGsByItem(elementJs);
|
|
594
609
|
case 2:
|
|
595
|
-
outlineSVGData =
|
|
610
|
+
outlineSVGData = _context7.sent;
|
|
596
611
|
if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
|
|
597
|
-
|
|
612
|
+
_context7.next = 4;
|
|
598
613
|
break;
|
|
599
614
|
}
|
|
600
615
|
// move the tempPlaceholder of current door style to first of tempPlaceholders array
|
|
@@ -622,13 +637,13 @@ function _addItemToCatalog() {
|
|
|
622
637
|
}
|
|
623
638
|
});
|
|
624
639
|
if ((0, _helper.isEmpty)((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
|
|
625
|
-
|
|
640
|
+
_context7.next = 4;
|
|
626
641
|
break;
|
|
627
642
|
}
|
|
628
|
-
|
|
643
|
+
_context7.next = 3;
|
|
629
644
|
return updateCabinetPayload(elementJs);
|
|
630
645
|
case 3:
|
|
631
|
-
elementJs =
|
|
646
|
+
elementJs = _context7.sent;
|
|
632
647
|
case 4:
|
|
633
648
|
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
634
649
|
outlineSVGData: outlineSVGData,
|
|
@@ -645,18 +660,18 @@ function _addItemToCatalog() {
|
|
|
645
660
|
k = 0;
|
|
646
661
|
case 5:
|
|
647
662
|
if (!(k < catalogElementKeys.length)) {
|
|
648
|
-
|
|
663
|
+
_context7.next = 7;
|
|
649
664
|
break;
|
|
650
665
|
}
|
|
651
666
|
if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
|
|
652
|
-
|
|
667
|
+
_context7.next = 6;
|
|
653
668
|
break;
|
|
654
669
|
}
|
|
655
670
|
catalogItem = catalogElements[catalogElementKeys[k]];
|
|
656
|
-
return
|
|
671
|
+
return _context7.abrupt("continue", 7);
|
|
657
672
|
case 6:
|
|
658
673
|
k++;
|
|
659
|
-
|
|
674
|
+
_context7.next = 5;
|
|
660
675
|
break;
|
|
661
676
|
case 7:
|
|
662
677
|
// get old tempPlaceholder array from catalog item
|
|
@@ -687,7 +702,7 @@ function _addItemToCatalog() {
|
|
|
687
702
|
}
|
|
688
703
|
case 8:
|
|
689
704
|
case "end":
|
|
690
|
-
return
|
|
705
|
+
return _context7.stop();
|
|
691
706
|
}
|
|
692
707
|
}, _callee6);
|
|
693
708
|
}));
|
|
@@ -1054,10 +1069,10 @@ function loadMoldingSvg(_x9) {
|
|
|
1054
1069
|
}
|
|
1055
1070
|
function _loadMoldingSvg() {
|
|
1056
1071
|
_loadMoldingSvg = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(molding) {
|
|
1057
|
-
return _regenerator["default"].wrap(function (
|
|
1058
|
-
while (1) switch (
|
|
1072
|
+
return _regenerator["default"].wrap(function (_context8) {
|
|
1073
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1059
1074
|
case 0:
|
|
1060
|
-
return
|
|
1075
|
+
return _context8.abrupt("return", new Promise(function (resolve, reject) {
|
|
1061
1076
|
var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
|
|
1062
1077
|
if (!url) {
|
|
1063
1078
|
// Skip if no SVG URL available
|
|
@@ -1079,7 +1094,7 @@ function _loadMoldingSvg() {
|
|
|
1079
1094
|
}));
|
|
1080
1095
|
case 1:
|
|
1081
1096
|
case "end":
|
|
1082
|
-
return
|
|
1097
|
+
return _context8.stop();
|
|
1083
1098
|
}
|
|
1084
1099
|
}, _callee7);
|
|
1085
1100
|
}));
|