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