kitchen-simulator 1.0.0-alin.9 → 1.0.0-clark.55
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/LiteKitchenConfigurator.js +15 -156
- package/es/LiteRenderer.js +25 -113
- package/es/actions/items-actions.js +4 -5
- package/es/actions/project-actions.js +2 -3
- package/es/catalog/catalog.js +1 -4
- package/es/catalog/utils/exporter.js +3 -1
- package/es/class/item.js +57 -120
- package/es/class/project.js +9 -23
- package/es/components/viewer2d/item.js +10 -10
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +20 -17
- package/es/components/viewer2d/viewer2d.js +20 -56
- package/es/components/viewer3d/viewer3d.js +5 -17
- package/es/constants.js +10 -1
- package/es/devLiteRenderer.js +116 -9
- package/es/index.js +58 -3
- package/es/models.js +2 -1
- package/es/reducers/items-reducer.js +3 -3
- package/es/reducers/project-reducer.js +1 -1
- package/es/utils/geometry.js +6 -6
- package/es/utils/isolate-event-handler.js +97 -17
- package/lib/LiteKitchenConfigurator.js +16 -157
- package/lib/LiteRenderer.js +25 -113
- package/lib/actions/items-actions.js +4 -5
- package/lib/actions/project-actions.js +2 -3
- package/lib/catalog/catalog.js +1 -4
- package/lib/catalog/utils/exporter.js +3 -1
- package/lib/class/item.js +57 -120
- package/lib/class/project.js +9 -23
- package/lib/components/viewer2d/item.js +10 -10
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +19 -16
- package/lib/components/viewer2d/viewer2d.js +19 -55
- package/lib/components/viewer3d/viewer3d.js +5 -17
- package/lib/constants.js +14 -5
- package/lib/devLiteRenderer.js +115 -8
- package/lib/index.js +57 -3
- package/lib/models.js +2 -1
- package/lib/reducers/items-reducer.js +3 -3
- package/lib/reducers/project-reducer.js +1 -1
- package/lib/utils/geometry.js +6 -6
- package/lib/utils/isolate-event-handler.js +96 -16
- package/package.json +5 -9
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
5
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
6
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
9
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
10
|
var _excluded = ["width", "height", "state", "stateExtractor"];
|
|
12
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
13
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -42,23 +40,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
42
40
|
_this = _callSuper(this, LiteKitchenConfigurator, [props]);
|
|
43
41
|
|
|
44
42
|
// utm tracking
|
|
45
|
-
_defineProperty(_this, "handleBeforeUnload", function (e) {
|
|
46
|
-
var areas = _this.props.stateExtractor(_this.props.state).getIn(['scene', 'layers', _this.props.stateExtractor(_this.props.state).scene.selectedLayer, 'areas']);
|
|
47
|
-
if (!_this.state.isSaved && areas.size > 0) {
|
|
48
|
-
setTimeout(function () {
|
|
49
|
-
_this.setState({
|
|
50
|
-
savePromptVisible: true,
|
|
51
|
-
isLeaving: true
|
|
52
|
-
});
|
|
53
|
-
}, 500);
|
|
54
|
-
_this.saveProjectToStorage();
|
|
55
|
-
|
|
56
|
-
// This line is required to trigger the browser confirmation dialog
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
e.returnValue = '';
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
43
|
var utmDetailParams = new URLSearchParams(_this.props.location && _this.props.location.search);
|
|
63
44
|
var utmStrEncoded = utmDetailParams.get('details');
|
|
64
45
|
var utmRequestData = null;
|
|
@@ -103,7 +84,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
103
84
|
redirectURL: '',
|
|
104
85
|
snackBarMessage: '',
|
|
105
86
|
isSaved: false,
|
|
106
|
-
isLeaving: false
|
|
87
|
+
isLeaving: false,
|
|
88
|
+
stateCatalog: _this.props.catalog
|
|
107
89
|
};
|
|
108
90
|
|
|
109
91
|
// For UTM tracking
|
|
@@ -344,129 +326,20 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
344
326
|
}, {
|
|
345
327
|
key: "componentDidMount",
|
|
346
328
|
value: function componentDidMount() {
|
|
347
|
-
var _this3 = this;
|
|
348
|
-
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
349
|
-
console.log('context =>', this.context);
|
|
350
329
|
window.forRedo = [];
|
|
351
330
|
var store = this.context.store;
|
|
352
331
|
var _this$props2 = this.props,
|
|
353
|
-
projectActions = _this$props2.projectActions,
|
|
354
|
-
catalog = _this$props2.catalog,
|
|
355
332
|
stateExtractor = _this$props2.stateExtractor,
|
|
356
|
-
state = _this$props2.state,
|
|
357
333
|
plugins = _this$props2.plugins;
|
|
358
|
-
projectActions.initCatalog(catalog);
|
|
359
|
-
var match = this.props.match;
|
|
360
|
-
if (sessionStorage.getItem(window.location.href)) {
|
|
361
|
-
var jsonData = sessionStorage.getItem(window.location.href);
|
|
362
|
-
projectActions.loadProject(JSON.parse(jsonData), this.props.categoryData);
|
|
363
|
-
sessionStorage.removeItem(window.location.href);
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
334
|
var newplugins = _toConsumableArray(plugins);
|
|
367
335
|
newplugins.forEach(function (newplugin) {
|
|
368
336
|
return newplugin(store, stateExtractor);
|
|
369
337
|
});
|
|
370
|
-
if (match && match.params.pid === undefined) {
|
|
371
|
-
projectActions.newProject();
|
|
372
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
373
|
-
projectActions.rename('Untitled');
|
|
374
|
-
sessionStorage.removeItem('projectId');
|
|
375
|
-
sessionStorage.removeItem('email');
|
|
376
|
-
sessionStorage.removeItem('firstName');
|
|
377
|
-
sessionStorage.removeItem('lastName');
|
|
378
|
-
sessionStorage.removeItem('usedObjects');
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
if (match && match.params.pid !== undefined) {
|
|
382
|
-
if (match.params.pid === 'new') {
|
|
383
|
-
projectActions.newProject();
|
|
384
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
385
|
-
projectActions.rename('Untitled');
|
|
386
|
-
sessionStorage.removeItem('projectId');
|
|
387
|
-
sessionStorage.removeItem('email');
|
|
388
|
-
sessionStorage.removeItem('firstName');
|
|
389
|
-
sessionStorage.removeItem('lastName');
|
|
390
|
-
sessionStorage.removeItem('usedObjects');
|
|
391
|
-
} else {
|
|
392
|
-
axios.post("".concat(constants.API_SERVER_URL, "/api/project/loadPidProject"), {
|
|
393
|
-
pid: match.params.pid,
|
|
394
|
-
visualizerName: sessionStorage.getItem('visualizerName')
|
|
395
|
-
}).then(/*#__PURE__*/function () {
|
|
396
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
|
|
397
|
-
var projectElement, jsonData, _t;
|
|
398
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
399
|
-
while (1) switch (_context.prev = _context.next) {
|
|
400
|
-
case 0:
|
|
401
|
-
projectElement = response.data.projectElement;
|
|
402
|
-
if (!(projectElement.length === 0)) {
|
|
403
|
-
_context.next = 1;
|
|
404
|
-
break;
|
|
405
|
-
}
|
|
406
|
-
return _context.abrupt("return");
|
|
407
|
-
case 1:
|
|
408
|
-
sessionStorage.setItem('projectTitle', projectElement[0].title);
|
|
409
|
-
projectActions.rename(projectElement[0].title);
|
|
410
|
-
sessionStorage.setItem('projectId', projectElement[0].id);
|
|
411
|
-
sessionStorage.setItem('email', projectElement[0].email);
|
|
412
|
-
sessionStorage.setItem('firstName', projectElement[0].firstName);
|
|
413
|
-
sessionStorage.setItem('lastName', projectElement[0].lastName);
|
|
414
|
-
sessionStorage.setItem('phone', projectElement[0].phone);
|
|
415
|
-
if (!projectElement[0].project_data) {
|
|
416
|
-
_context.next = 2;
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
jsonData = JSON.parse(projectElement[0].project_data);
|
|
420
|
-
_context.next = 5;
|
|
421
|
-
break;
|
|
422
|
-
case 2:
|
|
423
|
-
_context.prev = 2;
|
|
424
|
-
_context.next = 3;
|
|
425
|
-
return axios.post("".concat(constants.API_SERVER_URL, "/api/project/loadPidData"), {
|
|
426
|
-
pid: match.params.pid
|
|
427
|
-
}).data.data;
|
|
428
|
-
case 3:
|
|
429
|
-
jsonData = _context.sent;
|
|
430
|
-
_context.next = 5;
|
|
431
|
-
break;
|
|
432
|
-
case 4:
|
|
433
|
-
_context.prev = 4;
|
|
434
|
-
_t = _context["catch"](2);
|
|
435
|
-
_this3.setState({
|
|
436
|
-
isSnackBarOpen: true,
|
|
437
|
-
snackBarMessage: _t
|
|
438
|
-
});
|
|
439
|
-
case 5:
|
|
440
|
-
jsonData.isLoadingCabinet = false;
|
|
441
|
-
projectActions.loadProject(jsonData, _this3.props.categoryData);
|
|
442
|
-
case 6:
|
|
443
|
-
case "end":
|
|
444
|
-
return _context.stop();
|
|
445
|
-
}
|
|
446
|
-
}, _callee, null, [[2, 4]]);
|
|
447
|
-
}));
|
|
448
|
-
return function (_x) {
|
|
449
|
-
return _ref.apply(this, arguments);
|
|
450
|
-
};
|
|
451
|
-
}());
|
|
452
|
-
}
|
|
453
|
-
sessionStorage.removeItem('user_type');
|
|
454
|
-
sessionStorage.removeItem('project_type');
|
|
455
|
-
sessionStorage.removeItem('project_timeline');
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}, {
|
|
459
|
-
key: "componentWillUnmount",
|
|
460
|
-
value: function componentWillUnmount() {
|
|
461
|
-
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
462
|
-
window.onbeforeunload = null;
|
|
463
338
|
}
|
|
464
|
-
}, {
|
|
465
|
-
key: "componentWillMount",
|
|
466
|
-
value: function componentWillMount() {}
|
|
467
339
|
}, {
|
|
468
340
|
key: "componentWillReceiveProps",
|
|
469
341
|
value: function componentWillReceiveProps(nextProps) {
|
|
342
|
+
var _oldState$catalog, _plannerState$catalog;
|
|
470
343
|
var stateExtractor = nextProps.stateExtractor,
|
|
471
344
|
state = nextProps.state,
|
|
472
345
|
projectActions = nextProps.projectActions,
|
|
@@ -475,9 +348,18 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
475
348
|
|
|
476
349
|
// handle external events
|
|
477
350
|
if (this.props.externalEvent !== externalEvent) {
|
|
478
|
-
handleExternalEvent(
|
|
351
|
+
handleExternalEvent(nextProps);
|
|
479
352
|
}
|
|
480
353
|
var plannerState = stateExtractor(state);
|
|
354
|
+
var oldState = stateExtractor(this.props.state);
|
|
355
|
+
if ((oldState === null || oldState === void 0 || (_oldState$catalog = oldState.catalog) === null || _oldState$catalog === void 0 ? void 0 : _oldState$catalog.elements) !== (plannerState === null || plannerState === void 0 || (_plannerState$catalog = plannerState.catalog) === null || _plannerState$catalog === void 0 ? void 0 : _plannerState$catalog.elements)) {
|
|
356
|
+
// copy state.catalog to the props.catalog
|
|
357
|
+
// let catalog = this.state.stateCatalog;
|
|
358
|
+
// console.log('111111', plannerState?.catalog?.elements.toJS());
|
|
359
|
+
// catalog.elements = plannerState?.catalog?.elements.toJS();
|
|
360
|
+
// console.log('222222', catalog);
|
|
361
|
+
// this.setState({ stateCatalog: catalog });
|
|
362
|
+
}
|
|
481
363
|
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
482
364
|
if (!catalogReady) {
|
|
483
365
|
projectActions.initCatalog(catalog);
|
|
@@ -507,8 +389,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
507
389
|
signOpen = _this$state.signOpen,
|
|
508
390
|
myProjectsOpen = _this$state.myProjectsOpen;
|
|
509
391
|
var contentW = width - toolbarW;
|
|
510
|
-
var categoryData = this.props.categoryData;
|
|
511
|
-
// console.log(categoryData);
|
|
512
392
|
// let contentW = width - toolbarW - sidebarW;
|
|
513
393
|
// let toolbarH = height - footerBarH;
|
|
514
394
|
// let contentH = height - footerBarH;
|
|
@@ -519,27 +399,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
519
399
|
var headerW = width;
|
|
520
400
|
var headerH = 60;
|
|
521
401
|
var extractedState = stateExtractor(state);
|
|
522
|
-
var doorStyle = extractedState.get('doorStyle');
|
|
523
|
-
if (extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']) !== undefined && extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']) !== null) {
|
|
524
|
-
var extractedStateData = extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']);
|
|
525
|
-
var doorIdAvailable = false;
|
|
526
|
-
if (this.props.categoryData.doorStyles && this.props.categoryData.doorStyles.items) {
|
|
527
|
-
this.props.categoryData.doorStyles.items.find(function (category) {
|
|
528
|
-
doorIdAvailable = category.items.find(function (style) {
|
|
529
|
-
var item = style.items.find(function (it) {
|
|
530
|
-
return it.id === extractedStateData.id;
|
|
531
|
-
});
|
|
532
|
-
if (item) {
|
|
533
|
-
colorItem = item;
|
|
534
|
-
return true;
|
|
535
|
-
} else {
|
|
536
|
-
return false;
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
if (doorIdAvailable) doorStyle = extractedStateData;
|
|
542
|
-
}
|
|
543
402
|
var firstVisit = this.state.wizardStepOpend && this.isProjectEmpty(extractedState.scene);
|
|
544
403
|
var allVisible = firstVisit || signOpen || myProjectsOpen;
|
|
545
404
|
var _scene = extractedState.getIn(['scene']);
|
|
@@ -573,7 +432,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
573
432
|
}, /*#__PURE__*/React.createElement(Content, _extends({
|
|
574
433
|
width: contentW,
|
|
575
434
|
height: contentH,
|
|
576
|
-
catalog: this.
|
|
435
|
+
catalog: this.state.stateCatalog,
|
|
577
436
|
state: extractedState,
|
|
578
437
|
toolBar: this.state.toolbar,
|
|
579
438
|
setToolbar: this.setToolbar,
|
package/es/LiteRenderer.js
CHANGED
|
@@ -8,7 +8,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
8
8
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
9
9
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
10
10
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
11
|
-
var _excluded = ["width", "height", "projectElement", "
|
|
11
|
+
var _excluded = ["width", "height", "projectElement", "dataBundle", "configData", "options", "user", "auth", "featureFlags", "sentry", "analytics", "externalEvent", "onError"];
|
|
12
12
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -33,7 +33,6 @@ import { render2DItem, render3DApplianceItem, render3DItem, render3DLightingItem
|
|
|
33
33
|
import { ConsoleDebugger, Keyboard } from "./plugins/export";
|
|
34
34
|
import { Map } from 'immutable';
|
|
35
35
|
import * as Sentry from '@sentry/react';
|
|
36
|
-
import { loadProject, rename } from "./actions/project-actions";
|
|
37
36
|
import exporter from "./catalog/utils/exporter";
|
|
38
37
|
import * as THREE from 'three';
|
|
39
38
|
import LiteKitchenConfigurator from "./LiteKitchenConfigurator";
|
|
@@ -145,7 +144,6 @@ export default function LiteRenderer(props) {
|
|
|
145
144
|
var width = props.width,
|
|
146
145
|
height = props.height,
|
|
147
146
|
projectElement = props.projectElement,
|
|
148
|
-
categoryData = props.categoryData,
|
|
149
147
|
dataBundle = props.dataBundle,
|
|
150
148
|
configData = props.configData,
|
|
151
149
|
options = props.options,
|
|
@@ -244,21 +242,15 @@ export default function LiteRenderer(props) {
|
|
|
244
242
|
emit(lastExternalEventRef.current, last.errors);
|
|
245
243
|
}
|
|
246
244
|
}, [externalEvent, emit]);
|
|
247
|
-
var _ref =
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
_ref2$furnishing = _ref2.furnishing,
|
|
257
|
-
furnishing = _ref2$furnishing === void 0 ? [] : _ref2$furnishing,
|
|
258
|
-
_ref2$lighting = _ref2.lighting,
|
|
259
|
-
lighting = _ref2$lighting === void 0 ? [] : _ref2$lighting;
|
|
260
|
-
var _projectElement = _slicedToArray(projectElement, 1),
|
|
261
|
-
project_data = _projectElement[0].project_data;
|
|
245
|
+
var _ref = dataBundle || {},
|
|
246
|
+
_ref$data = _ref.data,
|
|
247
|
+
data = _ref$data === void 0 ? [] : _ref$data,
|
|
248
|
+
_ref$appliances = _ref.appliances,
|
|
249
|
+
appliances = _ref$appliances === void 0 ? [] : _ref$appliances,
|
|
250
|
+
_ref$furnishing = _ref.furnishing,
|
|
251
|
+
furnishing = _ref$furnishing === void 0 ? [] : _ref$furnishing,
|
|
252
|
+
_ref$lighting = _ref.lighting,
|
|
253
|
+
lighting = _ref$lighting === void 0 ? [] : _ref$lighting;
|
|
262
254
|
var id = configData.id,
|
|
263
255
|
logoImg = configData.logoImg,
|
|
264
256
|
companyUrl = configData.companyUrl;
|
|
@@ -266,13 +258,9 @@ export default function LiteRenderer(props) {
|
|
|
266
258
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
267
259
|
outlineSVGData = _React$useState2[0],
|
|
268
260
|
setOutlineSVGData = _React$useState2[1];
|
|
269
|
-
var _React$useState3 = React.useState(false),
|
|
270
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
271
|
-
catalogInitiated = _React$useState4[0],
|
|
272
|
-
setCatalogInitiated = _React$useState4[1];
|
|
273
261
|
useEffect(function () {
|
|
274
262
|
var initMyCatalog = /*#__PURE__*/function () {
|
|
275
|
-
var
|
|
263
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
276
264
|
var x, _x, _x2;
|
|
277
265
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
278
266
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -289,75 +277,19 @@ export default function LiteRenderer(props) {
|
|
|
289
277
|
}, _callee);
|
|
290
278
|
}));
|
|
291
279
|
return function initMyCatalog() {
|
|
292
|
-
return
|
|
280
|
+
return _ref2.apply(this, arguments);
|
|
293
281
|
};
|
|
294
282
|
}();
|
|
295
283
|
var loadMoldings = /*#__PURE__*/function () {
|
|
296
|
-
var
|
|
297
|
-
var
|
|
284
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
285
|
+
var molding, toeMoldingData, moldingData, promises;
|
|
298
286
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
299
287
|
while (1) switch (_context2.prev = _context2.next) {
|
|
300
288
|
case 0:
|
|
301
|
-
door_color_alias = [];
|
|
302
|
-
subgroup_ids = catalogs.filter(function (item) {
|
|
303
|
-
return item.id == id;
|
|
304
|
-
})[0].manufacturer_subgroup_ids.split(',');
|
|
305
|
-
door_color_alias_ids = [];
|
|
306
|
-
subgroups.forEach(function (subgroup) {
|
|
307
|
-
if (subgroup_ids.some(function (id) {
|
|
308
|
-
return id == subgroup.id.toString();
|
|
309
|
-
})) {
|
|
310
|
-
subgroup.door_color_alias_ids.split(',').forEach(function (item) {
|
|
311
|
-
item != '' && door_color_alias_ids.push(item);
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
colorAlias.forEach(function (color) {
|
|
316
|
-
return door_color_alias_ids.some(function (id) {
|
|
317
|
-
return id == color.id.toString();
|
|
318
|
-
}) && door_color_alias.push(color);
|
|
319
|
-
});
|
|
320
|
-
doorStyleData = categoryData.data.doorStyles.items;
|
|
321
|
-
categoryData.data.doorStyles.items = doorStyleData.treeStruct;
|
|
322
|
-
door_color_alias.forEach(function (dca) {
|
|
323
|
-
doorStyleData.doorColorData.forEach(function (dc) {
|
|
324
|
-
dc.door_style_id = parseInt(dc.door_style_id);
|
|
325
|
-
if (dc.id !== dca.door_color_id) return;
|
|
326
|
-
dc.name = dca.alias_name;
|
|
327
|
-
dc.color_sku_alias = dca.sku_alias_name;
|
|
328
|
-
doorStyleData.treeStruct.forEach(function (el) {
|
|
329
|
-
el.items.forEach(function (elem) {
|
|
330
|
-
return dc.door_style_id === elem.id && (dc.door_style_name = elem.name);
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
dca.alias_installation_type = isEmpty(dca.alias_installation_type) ? [] : dca.alias_installation_type.split(',').map(function (n) {
|
|
334
|
-
return parseInt(n);
|
|
335
|
-
});
|
|
336
|
-
categoryData.data.doorStyles.items.forEach(function (item) {
|
|
337
|
-
if (dca.alias_installation_type.some(function (ait) {
|
|
338
|
-
return ait === item.id;
|
|
339
|
-
})) item.items.forEach(function (ds) {
|
|
340
|
-
if (ds.name === dc.door_style_name) ds.items.push(dc);
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
289
|
molding = [];
|
|
346
|
-
toeMoldingData =
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if (index.name.toLowerCase().includes('molding')) {
|
|
350
|
-
index.items.forEach(function (item) {
|
|
351
|
-
return molding.push(item);
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
if (index.name.includes(TOE_KICK_MOLDING)) {
|
|
355
|
-
index.items.forEach(function (item) {
|
|
356
|
-
return toeMoldingData.push(item);
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
categoryData.data.toeMoldingData = toeMoldingData;
|
|
290
|
+
toeMoldingData = {};
|
|
291
|
+
moldingData = {};
|
|
292
|
+
if (moldingData.name = TOE_KICK_MOLDING) toeMoldingData = moldingData;
|
|
361
293
|
promises = molding.map(function (child) {
|
|
362
294
|
return new Promise(function (resolve, reject) {
|
|
363
295
|
var url = child === null || child === void 0 ? void 0 : child.shape_svg;
|
|
@@ -385,17 +317,17 @@ export default function LiteRenderer(props) {
|
|
|
385
317
|
}, _callee2);
|
|
386
318
|
}));
|
|
387
319
|
return function loadMoldings() {
|
|
388
|
-
return
|
|
320
|
+
return _ref3.apply(this, arguments);
|
|
389
321
|
};
|
|
390
322
|
}();
|
|
391
323
|
var loadSVGs = /*#__PURE__*/function () {
|
|
392
|
-
var
|
|
324
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
393
325
|
var svgLoadPromises, outlineData;
|
|
394
326
|
return _regeneratorRuntime.wrap(function (_context4) {
|
|
395
327
|
while (1) switch (_context4.prev = _context4.next) {
|
|
396
328
|
case 0:
|
|
397
329
|
svgLoadPromises = data.map(/*#__PURE__*/function () {
|
|
398
|
-
var
|
|
330
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(item) {
|
|
399
331
|
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
400
332
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
401
333
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -443,7 +375,7 @@ export default function LiteRenderer(props) {
|
|
|
443
375
|
}, _callee3, null, [[1, 5]]);
|
|
444
376
|
}));
|
|
445
377
|
return function (_x3) {
|
|
446
|
-
return
|
|
378
|
+
return _ref5.apply(this, arguments);
|
|
447
379
|
};
|
|
448
380
|
}());
|
|
449
381
|
_context4.next = 1;
|
|
@@ -458,15 +390,14 @@ export default function LiteRenderer(props) {
|
|
|
458
390
|
}, _callee4);
|
|
459
391
|
}));
|
|
460
392
|
return function loadSVGs() {
|
|
461
|
-
return
|
|
393
|
+
return _ref4.apply(this, arguments);
|
|
462
394
|
};
|
|
463
395
|
}();
|
|
464
396
|
var initCatalog = /*#__PURE__*/function () {
|
|
465
|
-
var
|
|
397
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
466
398
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
467
399
|
while (1) switch (_context5.prev = _context5.next) {
|
|
468
400
|
case 0:
|
|
469
|
-
setCatalogInitiated(false);
|
|
470
401
|
_context5.next = 1;
|
|
471
402
|
return initMyCatalog();
|
|
472
403
|
case 1:
|
|
@@ -476,20 +407,18 @@ export default function LiteRenderer(props) {
|
|
|
476
407
|
_context5.next = 3;
|
|
477
408
|
return loadSVGs();
|
|
478
409
|
case 3:
|
|
479
|
-
setCatalogInitiated(true);
|
|
480
|
-
case 4:
|
|
481
410
|
case "end":
|
|
482
411
|
return _context5.stop();
|
|
483
412
|
}
|
|
484
413
|
}, _callee5);
|
|
485
414
|
}));
|
|
486
415
|
return function initCatalog() {
|
|
487
|
-
return
|
|
416
|
+
return _ref6.apply(this, arguments);
|
|
488
417
|
};
|
|
489
418
|
}();
|
|
490
419
|
initCatalog();
|
|
491
420
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
492
|
-
}, [
|
|
421
|
+
}, [data, id]);
|
|
493
422
|
|
|
494
423
|
// Register items once SVGs are loaded
|
|
495
424
|
useEffect(function () {
|
|
@@ -526,21 +455,6 @@ export default function LiteRenderer(props) {
|
|
|
526
455
|
});
|
|
527
456
|
for (var x in Item) MyCatalog.registerElement(Item[x]);
|
|
528
457
|
}, [outlineSVGData, data, appliances, furnishing, lighting]);
|
|
529
|
-
useEffect(function () {
|
|
530
|
-
if (projectElement.length === 0) return;
|
|
531
|
-
if (!catalogInitiated) return;
|
|
532
|
-
sessionStorage.setItem('projectTitle', projectElement[0].title);
|
|
533
|
-
store.dispatch(rename(projectElement[0].title));
|
|
534
|
-
sessionStorage.setItem('projectId', projectElement[0].id);
|
|
535
|
-
sessionStorage.setItem('email', projectElement[0].email);
|
|
536
|
-
sessionStorage.setItem('firstName', projectElement[0].firstName);
|
|
537
|
-
sessionStorage.setItem('lastName', projectElement[0].lastName);
|
|
538
|
-
sessionStorage.setItem('phone', projectElement[0].phone);
|
|
539
|
-
var jsonData;
|
|
540
|
-
jsonData = JSON.parse(projectElement[0].project_data);
|
|
541
|
-
jsonData.isLoadingCabinet = false;
|
|
542
|
-
store.dispatch(loadProject(jsonData, categoryData));
|
|
543
|
-
}, [project_data, catalogInitiated]);
|
|
544
458
|
return /*#__PURE__*/React.createElement(AppContext.Provider, null, /*#__PURE__*/React.createElement(Provider, {
|
|
545
459
|
store: store
|
|
546
460
|
}, /*#__PURE__*/React.createElement(ToolErrorBoundary, {
|
|
@@ -555,7 +469,6 @@ export default function LiteRenderer(props) {
|
|
|
555
469
|
stateExtractor: function stateExtractor(state) {
|
|
556
470
|
return state.get('KitchenConfigurator');
|
|
557
471
|
},
|
|
558
|
-
categoryData: categoryData,
|
|
559
472
|
data: data,
|
|
560
473
|
configData: configData,
|
|
561
474
|
externalEvent: externalEvent
|
|
@@ -568,7 +481,6 @@ LiteRenderer.propTypes = {
|
|
|
568
481
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
569
482
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
570
483
|
projectElement: PropTypes.arrayOf(PropTypes.object),
|
|
571
|
-
categoryData: PropTypes.any,
|
|
572
484
|
dataBundle: PropTypes.any,
|
|
573
485
|
configData: PropTypes.any,
|
|
574
486
|
catalog: PropTypes.oneOfType([PropTypes.object, PropTypes.instanceOf(Models.Catalog)]),
|
|
@@ -223,11 +223,11 @@ export function updateItemsAltitude(layerID, itemID, value) {
|
|
|
223
223
|
value: value
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
export function setDoorStyle(doorStyle,
|
|
226
|
+
export function setDoorStyle(doorStyle, itemCDS, isAll) {
|
|
227
227
|
return {
|
|
228
228
|
type: SET_DOOR_STYLE,
|
|
229
229
|
doorStyle: doorStyle,
|
|
230
|
-
|
|
230
|
+
itemCDS: itemCDS,
|
|
231
231
|
isAll: isAll
|
|
232
232
|
};
|
|
233
233
|
}
|
|
@@ -292,11 +292,10 @@ export function setModelling(model) {
|
|
|
292
292
|
model: model
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
|
-
export function setInitialDoorStyle(doorStyle
|
|
295
|
+
export function setInitialDoorStyle(doorStyle) {
|
|
296
296
|
return {
|
|
297
297
|
type: SET_INITIAL_DOOR_STYLE,
|
|
298
|
-
doorStyle: doorStyle
|
|
299
|
-
oStyle: oStyle
|
|
298
|
+
doorStyle: doorStyle
|
|
300
299
|
};
|
|
301
300
|
}
|
|
302
301
|
export function setMoveStatus(status) {
|
|
@@ -17,11 +17,10 @@ export function setStateProperties(properties) {
|
|
|
17
17
|
properties: properties
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
export function loadProject(sceneJSON
|
|
20
|
+
export function loadProject(sceneJSON) {
|
|
21
21
|
return {
|
|
22
22
|
type: LOAD_PROJECT,
|
|
23
|
-
sceneJSON: sceneJSON
|
|
24
|
-
categoryData: categoryData
|
|
23
|
+
sceneJSON: sceneJSON
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
export function newProject() {
|
package/es/catalog/catalog.js
CHANGED
|
@@ -247,10 +247,7 @@ var Catalog = /*#__PURE__*/function () {
|
|
|
247
247
|
if (name === '') {
|
|
248
248
|
throw new Error('Category has empty name');
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
throw new Error('Category has already been registered');
|
|
252
|
-
}
|
|
253
|
-
return true;
|
|
250
|
+
return !this.hasCategory(name);
|
|
254
251
|
}
|
|
255
252
|
|
|
256
253
|
/**
|
|
@@ -19,7 +19,8 @@ export default function (_ref) {
|
|
|
19
19
|
is_corner = _ref.is_corner,
|
|
20
20
|
alti = _ref.alti,
|
|
21
21
|
obj_property = _ref.obj_property,
|
|
22
|
-
outlineSVGData = _ref.outlineSVGData
|
|
22
|
+
outlineSVGData = _ref.outlineSVGData,
|
|
23
|
+
cds = _ref.cds;
|
|
23
24
|
var _length = alti || 0;
|
|
24
25
|
// const length = convert(_length).from("in").to("cm");
|
|
25
26
|
var length = _length;
|
|
@@ -134,6 +135,7 @@ export default function (_ref) {
|
|
|
134
135
|
}),
|
|
135
136
|
img: base,
|
|
136
137
|
obj: obj_property,
|
|
138
|
+
cds: cds,
|
|
137
139
|
render2D: function render2D(element, layer, scene) {
|
|
138
140
|
return render2DItem.call(this, element, layer, scene, sizeinfo, layoutpos, is_corner, shape_svg);
|
|
139
141
|
},
|