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
|
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
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; }
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import { fromJS, List, Map, Record } from 'immutable';
|
|
7
|
-
import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT } from "../constants";
|
|
7
|
+
import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_SET_INITIAL_DATA, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, ZOOM_VARIABLE, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING } from "../constants";
|
|
8
8
|
import { isEmpty } from "./helper";
|
|
9
9
|
import exporter from "../catalog/utils/exporter";
|
|
10
10
|
import { render2DItem, render3DItem } from "../catalog/utils/item-loader";
|
|
@@ -62,42 +62,46 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
62
62
|
return _ref.apply(this, arguments);
|
|
63
63
|
};
|
|
64
64
|
}();
|
|
65
|
-
|
|
65
|
+
var compareSVGRect = function compareSVGRect(value) {
|
|
66
|
+
return value.e <= 10 && value.e + value.a * value.SVGWidth + 10 >= value.viewerWidth && value.f <= 80 && value.f + value.d * value.SVGHeight + 10 >= value.viewerHeight ? true : false;
|
|
67
|
+
};
|
|
68
|
+
export function handleExternalEvent(_x2) {
|
|
66
69
|
return _handleExternalEvent.apply(this, arguments);
|
|
67
70
|
}
|
|
68
71
|
function _handleExternalEvent() {
|
|
69
|
-
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(
|
|
70
|
-
var state, sLineCnt, element, catalog, outlineSVGData, catalogInstance, elementJs, _evt$payload, moveType, moveValue, value, defaulTitle, _t2, _t3;
|
|
72
|
+
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props) {
|
|
73
|
+
var evt, state, sLineCnt, element, catalog, outlineSVGData, catalogInstance, elementJs, _evt$payload, moveType, moveValue, value, defaulTitle, _evt$payload2, doorStyle, itemCDS, isAll, _doorStyle, _value, _zoomValue, _value2, _zoomValue2, _evt$payload3, moldingInfo, isGlobal, _t2, _t3;
|
|
71
74
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
72
75
|
while (1) switch (_context2.prev = _context2.next) {
|
|
73
76
|
case 0:
|
|
74
|
-
|
|
77
|
+
evt = props.externalEvent;
|
|
78
|
+
state = props.state.get('KitchenConfigurator');
|
|
75
79
|
_t2 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
76
|
-
_context2.next = _t2 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 1 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 2 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 3 : _t2 === EXTERNAL_EVENT_ADD_WALL ? 4 : _t2 === EXTERNAL_EVENT_ADD_ITEM ? 5 : _t2 === EXTERNAL_EVENT_MOVE_PAN ? 9 : _t2 === EXTERNAL_EVENT_NEW_PROJECT ? 15 : 16;
|
|
80
|
+
_context2.next = _t2 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 1 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 2 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 3 : _t2 === EXTERNAL_EVENT_ADD_WALL ? 4 : _t2 === EXTERNAL_EVENT_ADD_ITEM ? 5 : _t2 === EXTERNAL_EVENT_MOVE_PAN ? 9 : _t2 === EXTERNAL_EVENT_NEW_PROJECT ? 15 : _t2 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 16 : _t2 === EXTERNAL_EVENT_SET_INITIAL_DATA ? 17 : _t2 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 18 : _t2 === EXTERNAL_EVENT_ZOOM_IN ? 19 : _t2 === EXTERNAL_EVENT_ZOOM_OUT ? 22 : _t2 === EXTERNAL_EVENT_UNDO ? 25 : _t2 === EXTERNAL_EVENT_REDO ? 26 : _t2 === EXTERNAL_EVENT_SET_MOLDING ? 27 : 28;
|
|
77
81
|
break;
|
|
78
82
|
case 1:
|
|
79
83
|
props.projectActions.setMode(MODE_IDLE_3D);
|
|
80
|
-
return _context2.abrupt("continue",
|
|
84
|
+
return _context2.abrupt("continue", 28);
|
|
81
85
|
case 2:
|
|
82
86
|
props.projectActions.setMode(MODE_IDLE);
|
|
83
|
-
return _context2.abrupt("continue",
|
|
87
|
+
return _context2.abrupt("continue", 28);
|
|
84
88
|
case 3:
|
|
85
|
-
sLineCnt = state.getIn(['
|
|
89
|
+
sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
|
|
86
90
|
if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
|
|
87
|
-
return _context2.abrupt("continue",
|
|
91
|
+
return _context2.abrupt("continue", 28);
|
|
88
92
|
case 4:
|
|
89
93
|
if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
90
94
|
props.projectActions.setMode(MODE_IDLE);
|
|
91
95
|
props.linesActions.selectToolDrawingLine('wall');
|
|
92
96
|
}
|
|
93
|
-
return _context2.abrupt("continue",
|
|
97
|
+
return _context2.abrupt("continue", 28);
|
|
94
98
|
case 5:
|
|
95
99
|
if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
96
100
|
_context2.next = 8;
|
|
97
101
|
break;
|
|
98
102
|
}
|
|
99
103
|
element = evt.payload;
|
|
100
|
-
catalog = state.getIn(['
|
|
104
|
+
catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
|
|
101
105
|
if (!isEmpty(catalog === null || catalog === void 0 ? void 0 : catalog.elements[element.name])) {
|
|
102
106
|
_context2.next = 7;
|
|
103
107
|
break;
|
|
@@ -114,6 +118,7 @@ function _handleExternalEvent() {
|
|
|
114
118
|
render3DItem: render3DItem
|
|
115
119
|
}));
|
|
116
120
|
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
121
|
+
catalogInstance.registerElement(elementJs);
|
|
117
122
|
props.projectActions.addElementToCatalog(elementJs);
|
|
118
123
|
}
|
|
119
124
|
case 7:
|
|
@@ -122,10 +127,10 @@ function _handleExternalEvent() {
|
|
|
122
127
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
123
128
|
props.projectActions.setIsCabinetDrawing(true);
|
|
124
129
|
case 8:
|
|
125
|
-
return _context2.abrupt("continue",
|
|
130
|
+
return _context2.abrupt("continue", 28);
|
|
126
131
|
case 9:
|
|
127
132
|
_evt$payload = evt.payload, moveType = _evt$payload.moveType, moveValue = _evt$payload.moveValue;
|
|
128
|
-
value = state.getIn(['
|
|
133
|
+
value = state.getIn(['viewer2D']).toJS();
|
|
129
134
|
_t3 = moveType;
|
|
130
135
|
_context2.next = _t3 === TOP ? 10 : _t3 === BOTTOM ? 11 : _t3 === RIGHT ? 12 : _t3 === LEFT ? 13 : 14;
|
|
131
136
|
break;
|
|
@@ -142,14 +147,89 @@ function _handleExternalEvent() {
|
|
|
142
147
|
value.e -= moveValue;
|
|
143
148
|
return _context2.abrupt("continue", 14);
|
|
144
149
|
case 14:
|
|
145
|
-
if (value
|
|
146
|
-
return _context2.abrupt("continue",
|
|
150
|
+
if (compareSVGRect(value)) props.viewer2DActions.updateCameraView(value);
|
|
151
|
+
return _context2.abrupt("continue", 28);
|
|
147
152
|
case 15:
|
|
148
153
|
defaulTitle = 'Untitle';
|
|
149
154
|
props.projectActions.newProject();
|
|
150
155
|
props.projectActions.rename(defaulTitle);
|
|
151
|
-
return _context2.abrupt("continue",
|
|
156
|
+
return _context2.abrupt("continue", 28);
|
|
152
157
|
case 16:
|
|
158
|
+
_evt$payload2 = evt.payload, doorStyle = _evt$payload2.doorStyle, itemCDS = _evt$payload2.itemCDS, isAll = _evt$payload2.isAll;
|
|
159
|
+
props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
160
|
+
return _context2.abrupt("continue", 28);
|
|
161
|
+
case 17:
|
|
162
|
+
_doorStyle = evt.payload.doorStyle;
|
|
163
|
+
props.itemsActions.setInitialDoorStyle(_doorStyle.doorStyle);
|
|
164
|
+
return _context2.abrupt("continue", 28);
|
|
165
|
+
case 18:
|
|
166
|
+
props.projectActions.loadProject(evt.payload);
|
|
167
|
+
return _context2.abrupt("continue", 28);
|
|
168
|
+
case 19:
|
|
169
|
+
_value = state.getIn(['viewer2D']).toJS();
|
|
170
|
+
_value.a -= 0.1;
|
|
171
|
+
_value.d -= 0.1;
|
|
172
|
+
_value.e += _value.SVGWidth * 0.1 / 2;
|
|
173
|
+
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
174
|
+
_zoomValue = parseInt((_value.a - 0.5) / ZOOM_VARIABLE);
|
|
175
|
+
if (!(_zoomValue > 404)) {
|
|
176
|
+
_context2.next = 20;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
return _context2.abrupt("return");
|
|
180
|
+
case 20:
|
|
181
|
+
if (!(_zoomValue < 35 || Number.isNaN(_zoomValue))) {
|
|
182
|
+
_context2.next = 21;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
return _context2.abrupt("return");
|
|
186
|
+
case 21:
|
|
187
|
+
while (!(_value.e <= 10)) {
|
|
188
|
+
_value.e -= 0.1;
|
|
189
|
+
}
|
|
190
|
+
while (!(_value.e + _value.a * _value.SVGWidth + 10 >= _value.viewerWidth)) {
|
|
191
|
+
_value.e += 0.1;
|
|
192
|
+
}
|
|
193
|
+
while (!(_value.f <= 80)) {
|
|
194
|
+
_value.f -= 0.1;
|
|
195
|
+
}
|
|
196
|
+
while (!(_value.f + _value.a * _value.SVGHeight + 10 >= _value.viewerHeight)) {
|
|
197
|
+
_value.f += 0.1;
|
|
198
|
+
}
|
|
199
|
+
if (compareSVGRect(_value)) props.viewer2DActions.updateCameraView(_value);
|
|
200
|
+
return _context2.abrupt("continue", 28);
|
|
201
|
+
case 22:
|
|
202
|
+
_value2 = state.getIn(['viewer2D']).toJS();
|
|
203
|
+
_value2.a += 0.1;
|
|
204
|
+
_value2.d += 0.1;
|
|
205
|
+
_value2.e -= _value2.SVGWidth * 0.1 / 2;
|
|
206
|
+
_value2.f -= _value2.SVGHeight * 0.1 / 2;
|
|
207
|
+
_zoomValue2 = parseInt((_value2.a - 0.5) / ZOOM_VARIABLE);
|
|
208
|
+
if (!(_zoomValue2 > 404)) {
|
|
209
|
+
_context2.next = 23;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
return _context2.abrupt("return");
|
|
213
|
+
case 23:
|
|
214
|
+
if (!(_zoomValue2 < 35 || Number.isNaN(_zoomValue2))) {
|
|
215
|
+
_context2.next = 24;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
return _context2.abrupt("return");
|
|
219
|
+
case 24:
|
|
220
|
+
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
221
|
+
return _context2.abrupt("continue", 28);
|
|
222
|
+
case 25:
|
|
223
|
+
props.projectActions.undo();
|
|
224
|
+
return _context2.abrupt("continue", 28);
|
|
225
|
+
case 26:
|
|
226
|
+
props.projectActions.redo();
|
|
227
|
+
return _context2.abrupt("continue", 28);
|
|
228
|
+
case 27:
|
|
229
|
+
_evt$payload3 = evt.payload, moldingInfo = _evt$payload3.moldingInfo, isGlobal = _evt$payload3.isGlobal;
|
|
230
|
+
props.itemsActions.setMolding(moldingInfo, isGlobal);
|
|
231
|
+
return _context2.abrupt("continue", 28);
|
|
232
|
+
case 28:
|
|
153
233
|
case "end":
|
|
154
234
|
return _context2.stop();
|
|
155
235
|
}
|
|
@@ -8,15 +8,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
16
15
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
18
17
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
18
|
var _axios = _interopRequireDefault(require("axios"));
|
|
21
19
|
var _convertUnitsLite = require("./utils/convert-units-lite");
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -33,7 +31,7 @@ var _objectsUtils = require("./utils/objects-utils");
|
|
|
33
31
|
var _version = require("./version");
|
|
34
32
|
var _isolateEventHandler = require("./utils/isolate-event-handler");
|
|
35
33
|
var _excluded = ["width", "height", "state", "stateExtractor"];
|
|
36
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
34
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
37
35
|
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; }
|
|
38
36
|
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) { (0, _defineProperty2["default"])(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; }
|
|
39
37
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
@@ -51,23 +49,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
51
49
|
_this = _callSuper(this, LiteKitchenConfigurator, [props]);
|
|
52
50
|
|
|
53
51
|
// utm tracking
|
|
54
|
-
(0, _defineProperty2["default"])(_this, "handleBeforeUnload", function (e) {
|
|
55
|
-
var areas = _this.props.stateExtractor(_this.props.state).getIn(['scene', 'layers', _this.props.stateExtractor(_this.props.state).scene.selectedLayer, 'areas']);
|
|
56
|
-
if (!_this.state.isSaved && areas.size > 0) {
|
|
57
|
-
setTimeout(function () {
|
|
58
|
-
_this.setState({
|
|
59
|
-
savePromptVisible: true,
|
|
60
|
-
isLeaving: true
|
|
61
|
-
});
|
|
62
|
-
}, 500);
|
|
63
|
-
_this.saveProjectToStorage();
|
|
64
|
-
|
|
65
|
-
// This line is required to trigger the browser confirmation dialog
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
e.returnValue = '';
|
|
68
|
-
return '';
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
52
|
var utmDetailParams = new URLSearchParams(_this.props.location && _this.props.location.search);
|
|
72
53
|
var utmStrEncoded = utmDetailParams.get('details');
|
|
73
54
|
var utmRequestData = null;
|
|
@@ -112,7 +93,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
112
93
|
redirectURL: '',
|
|
113
94
|
snackBarMessage: '',
|
|
114
95
|
isSaved: false,
|
|
115
|
-
isLeaving: false
|
|
96
|
+
isLeaving: false,
|
|
97
|
+
stateCatalog: _this.props.catalog
|
|
116
98
|
};
|
|
117
99
|
|
|
118
100
|
// For UTM tracking
|
|
@@ -353,129 +335,20 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
353
335
|
}, {
|
|
354
336
|
key: "componentDidMount",
|
|
355
337
|
value: function componentDidMount() {
|
|
356
|
-
var _this3 = this;
|
|
357
|
-
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
358
|
-
console.log('context =>', this.context);
|
|
359
338
|
window.forRedo = [];
|
|
360
339
|
var store = this.context.store;
|
|
361
340
|
var _this$props2 = this.props,
|
|
362
|
-
projectActions = _this$props2.projectActions,
|
|
363
|
-
catalog = _this$props2.catalog,
|
|
364
341
|
stateExtractor = _this$props2.stateExtractor,
|
|
365
|
-
state = _this$props2.state,
|
|
366
342
|
plugins = _this$props2.plugins;
|
|
367
|
-
projectActions.initCatalog(catalog);
|
|
368
|
-
var match = this.props.match;
|
|
369
|
-
if (sessionStorage.getItem(window.location.href)) {
|
|
370
|
-
var jsonData = sessionStorage.getItem(window.location.href);
|
|
371
|
-
projectActions.loadProject(JSON.parse(jsonData), this.props.categoryData);
|
|
372
|
-
sessionStorage.removeItem(window.location.href);
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
343
|
var newplugins = (0, _toConsumableArray2["default"])(plugins);
|
|
376
344
|
newplugins.forEach(function (newplugin) {
|
|
377
345
|
return newplugin(store, stateExtractor);
|
|
378
346
|
});
|
|
379
|
-
if (match && match.params.pid === undefined) {
|
|
380
|
-
projectActions.newProject();
|
|
381
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
382
|
-
projectActions.rename('Untitled');
|
|
383
|
-
sessionStorage.removeItem('projectId');
|
|
384
|
-
sessionStorage.removeItem('email');
|
|
385
|
-
sessionStorage.removeItem('firstName');
|
|
386
|
-
sessionStorage.removeItem('lastName');
|
|
387
|
-
sessionStorage.removeItem('usedObjects');
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
if (match && match.params.pid !== undefined) {
|
|
391
|
-
if (match.params.pid === 'new') {
|
|
392
|
-
projectActions.newProject();
|
|
393
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
394
|
-
projectActions.rename('Untitled');
|
|
395
|
-
sessionStorage.removeItem('projectId');
|
|
396
|
-
sessionStorage.removeItem('email');
|
|
397
|
-
sessionStorage.removeItem('firstName');
|
|
398
|
-
sessionStorage.removeItem('lastName');
|
|
399
|
-
sessionStorage.removeItem('usedObjects');
|
|
400
|
-
} else {
|
|
401
|
-
_axios["default"].post("".concat(constants.API_SERVER_URL, "/api/project/loadPidProject"), {
|
|
402
|
-
pid: match.params.pid,
|
|
403
|
-
visualizerName: sessionStorage.getItem('visualizerName')
|
|
404
|
-
}).then(/*#__PURE__*/function () {
|
|
405
|
-
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(response) {
|
|
406
|
-
var projectElement, jsonData, _t;
|
|
407
|
-
return _regenerator["default"].wrap(function (_context) {
|
|
408
|
-
while (1) switch (_context.prev = _context.next) {
|
|
409
|
-
case 0:
|
|
410
|
-
projectElement = response.data.projectElement;
|
|
411
|
-
if (!(projectElement.length === 0)) {
|
|
412
|
-
_context.next = 1;
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
415
|
-
return _context.abrupt("return");
|
|
416
|
-
case 1:
|
|
417
|
-
sessionStorage.setItem('projectTitle', projectElement[0].title);
|
|
418
|
-
projectActions.rename(projectElement[0].title);
|
|
419
|
-
sessionStorage.setItem('projectId', projectElement[0].id);
|
|
420
|
-
sessionStorage.setItem('email', projectElement[0].email);
|
|
421
|
-
sessionStorage.setItem('firstName', projectElement[0].firstName);
|
|
422
|
-
sessionStorage.setItem('lastName', projectElement[0].lastName);
|
|
423
|
-
sessionStorage.setItem('phone', projectElement[0].phone);
|
|
424
|
-
if (!projectElement[0].project_data) {
|
|
425
|
-
_context.next = 2;
|
|
426
|
-
break;
|
|
427
|
-
}
|
|
428
|
-
jsonData = JSON.parse(projectElement[0].project_data);
|
|
429
|
-
_context.next = 5;
|
|
430
|
-
break;
|
|
431
|
-
case 2:
|
|
432
|
-
_context.prev = 2;
|
|
433
|
-
_context.next = 3;
|
|
434
|
-
return _axios["default"].post("".concat(constants.API_SERVER_URL, "/api/project/loadPidData"), {
|
|
435
|
-
pid: match.params.pid
|
|
436
|
-
}).data.data;
|
|
437
|
-
case 3:
|
|
438
|
-
jsonData = _context.sent;
|
|
439
|
-
_context.next = 5;
|
|
440
|
-
break;
|
|
441
|
-
case 4:
|
|
442
|
-
_context.prev = 4;
|
|
443
|
-
_t = _context["catch"](2);
|
|
444
|
-
_this3.setState({
|
|
445
|
-
isSnackBarOpen: true,
|
|
446
|
-
snackBarMessage: _t
|
|
447
|
-
});
|
|
448
|
-
case 5:
|
|
449
|
-
jsonData.isLoadingCabinet = false;
|
|
450
|
-
projectActions.loadProject(jsonData, _this3.props.categoryData);
|
|
451
|
-
case 6:
|
|
452
|
-
case "end":
|
|
453
|
-
return _context.stop();
|
|
454
|
-
}
|
|
455
|
-
}, _callee, null, [[2, 4]]);
|
|
456
|
-
}));
|
|
457
|
-
return function (_x) {
|
|
458
|
-
return _ref.apply(this, arguments);
|
|
459
|
-
};
|
|
460
|
-
}());
|
|
461
|
-
}
|
|
462
|
-
sessionStorage.removeItem('user_type');
|
|
463
|
-
sessionStorage.removeItem('project_type');
|
|
464
|
-
sessionStorage.removeItem('project_timeline');
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}, {
|
|
468
|
-
key: "componentWillUnmount",
|
|
469
|
-
value: function componentWillUnmount() {
|
|
470
|
-
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
471
|
-
window.onbeforeunload = null;
|
|
472
347
|
}
|
|
473
|
-
}, {
|
|
474
|
-
key: "componentWillMount",
|
|
475
|
-
value: function componentWillMount() {}
|
|
476
348
|
}, {
|
|
477
349
|
key: "componentWillReceiveProps",
|
|
478
350
|
value: function componentWillReceiveProps(nextProps) {
|
|
351
|
+
var _oldState$catalog, _plannerState$catalog;
|
|
479
352
|
var stateExtractor = nextProps.stateExtractor,
|
|
480
353
|
state = nextProps.state,
|
|
481
354
|
projectActions = nextProps.projectActions,
|
|
@@ -484,9 +357,18 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
484
357
|
|
|
485
358
|
// handle external events
|
|
486
359
|
if (this.props.externalEvent !== externalEvent) {
|
|
487
|
-
(0, _isolateEventHandler.handleExternalEvent)(
|
|
360
|
+
(0, _isolateEventHandler.handleExternalEvent)(nextProps);
|
|
488
361
|
}
|
|
489
362
|
var plannerState = stateExtractor(state);
|
|
363
|
+
var oldState = stateExtractor(this.props.state);
|
|
364
|
+
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)) {
|
|
365
|
+
// copy state.catalog to the props.catalog
|
|
366
|
+
// let catalog = this.state.stateCatalog;
|
|
367
|
+
// console.log('111111', plannerState?.catalog?.elements.toJS());
|
|
368
|
+
// catalog.elements = plannerState?.catalog?.elements.toJS();
|
|
369
|
+
// console.log('222222', catalog);
|
|
370
|
+
// this.setState({ stateCatalog: catalog });
|
|
371
|
+
}
|
|
490
372
|
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
491
373
|
if (!catalogReady) {
|
|
492
374
|
projectActions.initCatalog(catalog);
|
|
@@ -516,8 +398,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
516
398
|
signOpen = _this$state.signOpen,
|
|
517
399
|
myProjectsOpen = _this$state.myProjectsOpen;
|
|
518
400
|
var contentW = width - toolbarW;
|
|
519
|
-
var categoryData = this.props.categoryData;
|
|
520
|
-
// console.log(categoryData);
|
|
521
401
|
// let contentW = width - toolbarW - sidebarW;
|
|
522
402
|
// let toolbarH = height - footerBarH;
|
|
523
403
|
// let contentH = height - footerBarH;
|
|
@@ -528,27 +408,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
528
408
|
var headerW = width;
|
|
529
409
|
var headerH = 60;
|
|
530
410
|
var extractedState = stateExtractor(state);
|
|
531
|
-
var doorStyle = extractedState.get('doorStyle');
|
|
532
|
-
if (extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']) !== undefined && extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']) !== null) {
|
|
533
|
-
var extractedStateData = extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']);
|
|
534
|
-
var doorIdAvailable = false;
|
|
535
|
-
if (this.props.categoryData.doorStyles && this.props.categoryData.doorStyles.items) {
|
|
536
|
-
this.props.categoryData.doorStyles.items.find(function (category) {
|
|
537
|
-
doorIdAvailable = category.items.find(function (style) {
|
|
538
|
-
var item = style.items.find(function (it) {
|
|
539
|
-
return it.id === extractedStateData.id;
|
|
540
|
-
});
|
|
541
|
-
if (item) {
|
|
542
|
-
colorItem = item;
|
|
543
|
-
return true;
|
|
544
|
-
} else {
|
|
545
|
-
return false;
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
if (doorIdAvailable) doorStyle = extractedStateData;
|
|
551
|
-
}
|
|
552
411
|
var firstVisit = this.state.wizardStepOpend && this.isProjectEmpty(extractedState.scene);
|
|
553
412
|
var allVisible = firstVisit || signOpen || myProjectsOpen;
|
|
554
413
|
var _scene = extractedState.getIn(['scene']);
|
|
@@ -582,7 +441,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
582
441
|
}, /*#__PURE__*/_react["default"].createElement(_export2.Content, (0, _extends2["default"])({
|
|
583
442
|
width: contentW,
|
|
584
443
|
height: contentH,
|
|
585
|
-
catalog: this.
|
|
444
|
+
catalog: this.state.stateCatalog,
|
|
586
445
|
state: extractedState,
|
|
587
446
|
toolBar: this.state.toolbar,
|
|
588
447
|
setToolbar: this.setToolbar,
|