kitchen-simulator 3.1.2 → 4.0.0-react-18
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/README.md +0 -3
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +15 -25
- package/es/LiteRenderer.js +2 -5
- package/es/actions/export.js +12 -25
- package/es/catalog/catalog.js +5 -21
- package/es/components/content.js +2 -5
- package/es/components/export.js +6 -4
- package/es/components/style/export.js +2 -28
- package/es/components/style/form-number-input.js +22 -11
- package/es/components/viewer2d/group.js +4 -5
- package/es/components/viewer2d/item.js +4 -5
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +47 -17
- package/es/components/viewer2d/rulerX.js +0 -3
- package/es/components/viewer2d/rulerY.js +0 -3
- package/es/components/viewer2d/scene.js +1 -4
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/viewer2d.js +43 -28
- package/es/components/viewer3d/viewer3d-first-person.js +0 -8
- package/es/components/viewer3d/viewer3d.js +0 -9
- package/es/devLiteRenderer.js +148 -317
- package/es/index.js +12 -4
- package/es/mocks/appliancePayload.json +27 -0
- package/es/mocks/cabinetPayload.json +1914 -0
- package/es/mocks/cabinetPayload2.json +76 -0
- package/es/mocks/dataBundle2.json +4 -0
- package/es/mocks/distancePayload.json +6 -0
- package/es/mocks/doorStylePayload2.json +84 -0
- package/es/mocks/furnishingPayload.json +23 -0
- package/es/mocks/itemCDSPayload.json +27 -0
- package/es/mocks/lightingPayload.json +23 -0
- package/es/mocks/mockProps.json +43 -0
- package/es/mocks/mockProps2.json +9 -0
- package/es/mocks/moldingPayload.json +19 -0
- package/es/mocks/projectItemsCatalog.json +133 -0
- package/es/mocks/rectangleShape.json +238 -0
- package/es/mocks/replaceCabinetPayload.json +81 -0
- package/es/mocks/roomShapePayload.json +5 -0
- package/es/useAppContext.js +8 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +15 -25
- package/lib/LiteRenderer.js +2 -5
- package/lib/actions/export.js +39 -35
- package/lib/catalog/catalog.js +4 -20
- package/lib/components/content.js +2 -5
- package/lib/components/export.js +26 -6
- package/lib/components/style/export.js +1 -105
- package/lib/components/style/form-number-input.js +22 -11
- package/lib/components/viewer2d/group.js +4 -5
- package/lib/components/viewer2d/item.js +4 -5
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +47 -17
- package/lib/components/viewer2d/rulerX.js +0 -3
- package/lib/components/viewer2d/rulerY.js +0 -3
- package/lib/components/viewer2d/scene.js +1 -4
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/viewer2d.js +42 -27
- package/lib/components/viewer3d/viewer3d-first-person.js +0 -8
- package/lib/components/viewer3d/viewer3d.js +0 -9
- package/lib/devLiteRenderer.js +147 -316
- package/lib/index.js +12 -4
- package/lib/mocks/appliancePayload.json +27 -0
- package/lib/mocks/cabinetPayload.json +1914 -0
- package/lib/mocks/cabinetPayload2.json +76 -0
- package/lib/mocks/dataBundle2.json +4 -0
- package/lib/mocks/distancePayload.json +6 -0
- package/lib/mocks/doorStylePayload2.json +84 -0
- package/lib/mocks/furnishingPayload.json +23 -0
- package/lib/mocks/itemCDSPayload.json +27 -0
- package/lib/mocks/lightingPayload.json +23 -0
- package/lib/mocks/mockProps.json +43 -0
- package/lib/mocks/mockProps2.json +9 -0
- package/lib/mocks/moldingPayload.json +19 -0
- package/lib/mocks/projectItemsCatalog.json +133 -0
- package/lib/mocks/rectangleShape.json +238 -0
- package/lib/mocks/replaceCabinetPayload.json +81 -0
- package/lib/mocks/roomShapePayload.json +5 -0
- package/lib/useAppContext.js +16 -0
- package/package.json +16 -21
- package/es/catalog/properties/export.js +0 -21
- package/es/catalog/properties/property-checkbox.js +0 -68
- package/es/catalog/properties/property-color.js +0 -39
- package/es/catalog/properties/property-enum.js +0 -50
- package/es/catalog/properties/property-hidden.js +0 -19
- package/es/catalog/properties/property-lenght-measure.js +0 -100
- package/es/catalog/properties/property-length-measure.js +0 -84
- package/es/catalog/properties/property-length-measure_hole.js +0 -100
- package/es/catalog/properties/property-number.js +0 -48
- package/es/catalog/properties/property-read-only.js +0 -26
- package/es/catalog/properties/property-string.js +0 -48
- package/es/catalog/properties/property-toggle.js +0 -39
- package/es/catalog/properties/shared-property-style.js +0 -14
- package/es/components/style/button.js +0 -106
- package/es/components/style/cancel-button.js +0 -21
- package/es/components/style/content-container.js +0 -30
- package/es/components/style/content-title.js +0 -25
- package/es/components/style/delete-button.js +0 -24
- package/es/components/style/form-block.js +0 -20
- package/es/components/style/form-color-input.js +0 -26
- package/es/components/style/form-label.js +0 -22
- package/es/components/style/form-number-input_2.js +0 -200
- package/es/components/style/form-select.js +0 -19
- package/es/components/style/form-slider.js +0 -60
- package/es/components/style/form-submit-button.js +0 -25
- package/es/components/style/form-text-input.js +0 -69
- package/es/plugins/SVGLoader.js +0 -1414
- package/es/styles/export.js +0 -5
- package/es/styles/tabs.css +0 -40
- package/lib/catalog/properties/export.js +0 -81
- package/lib/catalog/properties/property-checkbox.js +0 -76
- package/lib/catalog/properties/property-color.js +0 -47
- package/lib/catalog/properties/property-enum.js +0 -58
- package/lib/catalog/properties/property-hidden.js +0 -27
- package/lib/catalog/properties/property-lenght-measure.js +0 -108
- package/lib/catalog/properties/property-length-measure.js +0 -92
- package/lib/catalog/properties/property-length-measure_hole.js +0 -108
- package/lib/catalog/properties/property-number.js +0 -56
- package/lib/catalog/properties/property-read-only.js +0 -34
- package/lib/catalog/properties/property-string.js +0 -56
- package/lib/catalog/properties/property-toggle.js +0 -47
- package/lib/catalog/properties/shared-property-style.js +0 -21
- package/lib/components/style/button.js +0 -115
- package/lib/components/style/cancel-button.js +0 -29
- package/lib/components/style/content-container.js +0 -38
- package/lib/components/style/content-title.js +0 -35
- package/lib/components/style/delete-button.js +0 -34
- package/lib/components/style/form-block.js +0 -28
- package/lib/components/style/form-color-input.js +0 -34
- package/lib/components/style/form-label.js +0 -30
- package/lib/components/style/form-number-input_2.js +0 -209
- package/lib/components/style/form-select.js +0 -29
- package/lib/components/style/form-slider.js +0 -68
- package/lib/components/style/form-submit-button.js +0 -35
- package/lib/components/style/form-text-input.js +0 -78
- package/lib/plugins/SVGLoader.js +0 -1419
- package/lib/styles/export.js +0 -13
- package/lib/styles/tabs.css +0 -40
|
@@ -121,8 +121,5 @@ export { Scene as default };
|
|
|
121
121
|
Scene.propTypes = {
|
|
122
122
|
scene: PropTypes.object.isRequired,
|
|
123
123
|
catalog: PropTypes.object.isRequired,
|
|
124
|
-
relatedLines: PropTypes.
|
|
125
|
-
};
|
|
126
|
-
Scene.contextTypes = {
|
|
127
|
-
projectActions: PropTypes.object.isRequired
|
|
124
|
+
relatedLines: PropTypes.array.isRequired
|
|
128
125
|
};
|
|
@@ -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 React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { ReactSVGPanZoom, TOOL_AUTO, TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT } from 'react-svg-pan-zoom';
|
|
7
|
+
import { INITIAL_VALUE, POSITION_NONE, ReactSVGPanZoom, TOOL_AUTO, TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT } from 'react-svg-pan-zoom';
|
|
8
8
|
import * as constants from "../../constants";
|
|
9
9
|
import { DECIMAL_PLACES_2, LINE_THICKNESS, MIN_ANGLE_DISALLOW_DRAW_WALL, MODE_ELEVATION_VIEW, MODE_IDLE, UNIT_ANGLE, INTERNAL_EVENT_SELECT_ELEMENT, INTERNAL_EVENT_DRAG_ELEMENT, INTERNAL_EVENT_DRAW_ELEMENT, INTERNAL_EVENT_ROTATE_ELEMENT } from "../../constants";
|
|
10
10
|
import State from "./state";
|
|
@@ -18,6 +18,7 @@ import { formatNumber } from "../../utils/math";
|
|
|
18
18
|
import { isEmpty } from "../../utils/helper"; // variables
|
|
19
19
|
import { isWarningItem } from "./utils";
|
|
20
20
|
import { MoldingUtils } from "../../utils/export";
|
|
21
|
+
import { useAppContext } from "../../useAppContext";
|
|
21
22
|
// variables
|
|
22
23
|
var pinFlag = false;
|
|
23
24
|
var sFlag = false; //for all object move
|
|
@@ -121,21 +122,22 @@ function extractElementData(node) {
|
|
|
121
122
|
direct: node.attributes.getNamedItem('data-direct') ? node.attributes.getNamedItem('data-direct').value : 0
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
|
-
export default function Viewer2D(_ref
|
|
125
|
+
export default function Viewer2D(_ref) {
|
|
125
126
|
var state = _ref.state,
|
|
126
127
|
width = _ref.width,
|
|
127
128
|
height = _ref.height,
|
|
128
129
|
setToolbar = _ref.setToolbar,
|
|
129
130
|
replaceCabinet = _ref.replaceCabinet,
|
|
130
131
|
onInternalEvent = _ref.onInternalEvent;
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
var _useAppContext = useAppContext(),
|
|
133
|
+
viewer2DActions = _useAppContext.viewer2DActions,
|
|
134
|
+
linesActions = _useAppContext.linesActions,
|
|
135
|
+
holesActions = _useAppContext.holesActions,
|
|
136
|
+
verticesActions = _useAppContext.verticesActions,
|
|
137
|
+
itemsActions = _useAppContext.itemsActions,
|
|
138
|
+
areaActions = _useAppContext.areaActions,
|
|
139
|
+
projectActions = _useAppContext.projectActions,
|
|
140
|
+
catalog = _useAppContext.catalog;
|
|
139
141
|
var _useState = useState(null),
|
|
140
142
|
_useState2 = _slicedToArray(_useState, 2),
|
|
141
143
|
rulerEdit = _useState2[0],
|
|
@@ -158,6 +160,26 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
158
160
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
159
161
|
drawStart = _useState8[0],
|
|
160
162
|
setdrawStart = _useState8[1];
|
|
163
|
+
var _useState9 = useState(function () {
|
|
164
|
+
return viewer2D && !viewer2D.isEmpty() ? viewer2D.toJS() : INITIAL_VALUE;
|
|
165
|
+
}),
|
|
166
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
167
|
+
svgValue = _useState0[0],
|
|
168
|
+
setSvgValue = _useState0[1];
|
|
169
|
+
var _useState1 = useState(function () {
|
|
170
|
+
return mode2Tool(mode);
|
|
171
|
+
}),
|
|
172
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
173
|
+
svgTool = _useState10[0],
|
|
174
|
+
setSvgTool = _useState10[1];
|
|
175
|
+
useEffect(function () {
|
|
176
|
+
// keep tool controlled from app mode
|
|
177
|
+
setSvgTool(mode2Tool(mode));
|
|
178
|
+
}, [mode]);
|
|
179
|
+
useEffect(function () {
|
|
180
|
+
// keep value controlled from store, but never null
|
|
181
|
+
if (viewer2D && !viewer2D.isEmpty()) setSvgValue(viewer2D.toJS());
|
|
182
|
+
}, [viewer2D]);
|
|
161
183
|
useEffect(function () {
|
|
162
184
|
// move viewer point to center
|
|
163
185
|
var selectedLayer = state.scene.layers.get(state.scene.selectedLayer);
|
|
@@ -182,9 +204,9 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
182
204
|
var layerID = scene.selectedLayer;
|
|
183
205
|
var wall_thickness = LINE_THICKNESS / 2;
|
|
184
206
|
var layer = scene.getIn(['layers', layerID]);
|
|
185
|
-
var mapCursorPosition = function mapCursorPosition(
|
|
186
|
-
var x =
|
|
187
|
-
y =
|
|
207
|
+
var mapCursorPosition = function mapCursorPosition(_ref2) {
|
|
208
|
+
var x = _ref2.x,
|
|
209
|
+
y = _ref2.y;
|
|
188
210
|
return {
|
|
189
211
|
x: x,
|
|
190
212
|
y: -y + scene.height
|
|
@@ -1287,6 +1309,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1287
1309
|
};
|
|
1288
1310
|
var onChangeValue = function onChangeValue(value) {
|
|
1289
1311
|
if (sFlag) return;
|
|
1312
|
+
setSvgValue(value);
|
|
1290
1313
|
var _zoomValue = parseInt((value.a - 0.5) / constants.ZOOM_VARIABLE);
|
|
1291
1314
|
if (_zoomValue > constants.MAX_ZOOM_IN_SCALE) return;
|
|
1292
1315
|
if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
|
|
@@ -1318,6 +1341,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1318
1341
|
}
|
|
1319
1342
|
};
|
|
1320
1343
|
var onChangeTool = function onChangeTool(tool) {
|
|
1344
|
+
setSvgTool(tool);
|
|
1321
1345
|
switch (tool) {
|
|
1322
1346
|
case TOOL_NONE:
|
|
1323
1347
|
projectActions.selectToolEdit();
|
|
@@ -1416,19 +1440,20 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1416
1440
|
},
|
|
1417
1441
|
width: width - rulerSize,
|
|
1418
1442
|
height: height - rulerSize,
|
|
1419
|
-
value:
|
|
1443
|
+
value: svgValue,
|
|
1444
|
+
tool: svgTool,
|
|
1420
1445
|
onChangeValue: onChangeValue,
|
|
1421
|
-
tool: mode2Tool(mode),
|
|
1422
1446
|
onChangeTool: onChangeTool,
|
|
1423
1447
|
detectAutoPan: mode2DetectAutopan(mode),
|
|
1424
1448
|
onMouseDown: onMouseDown,
|
|
1425
1449
|
onMouseMove: onMouseMove,
|
|
1426
1450
|
onMouseUp: onMouseUp,
|
|
1427
|
-
miniaturePosition: "none",
|
|
1428
|
-
toolbarPosition: "none",
|
|
1429
1451
|
detectPinchGesture: false,
|
|
1430
1452
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1431
|
-
ref: Viewer
|
|
1453
|
+
ref: Viewer,
|
|
1454
|
+
toolbarProps: {
|
|
1455
|
+
position: POSITION_NONE
|
|
1456
|
+
}
|
|
1432
1457
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
1433
1458
|
width: scene.width,
|
|
1434
1459
|
height: scene.height
|
|
@@ -1463,14 +1488,4 @@ Viewer2D.propTypes = {
|
|
|
1463
1488
|
state: PropTypes.object.isRequired,
|
|
1464
1489
|
width: PropTypes.number.isRequired,
|
|
1465
1490
|
height: PropTypes.number.isRequired
|
|
1466
|
-
};
|
|
1467
|
-
Viewer2D.contextTypes = {
|
|
1468
|
-
viewer2DActions: PropTypes.object.isRequired,
|
|
1469
|
-
linesActions: PropTypes.object.isRequired,
|
|
1470
|
-
holesActions: PropTypes.object.isRequired,
|
|
1471
|
-
verticesActions: PropTypes.object.isRequired,
|
|
1472
|
-
itemsActions: PropTypes.object.isRequired,
|
|
1473
|
-
areaActions: PropTypes.object.isRequired,
|
|
1474
|
-
projectActions: PropTypes.object.isRequired,
|
|
1475
|
-
catalog: PropTypes.object.isRequired
|
|
1476
1491
|
};
|
|
@@ -298,12 +298,4 @@ Viewer3DFirstPerson.propTypes = {
|
|
|
298
298
|
state: PropTypes.object.isRequired,
|
|
299
299
|
width: PropTypes.number.isRequired,
|
|
300
300
|
height: PropTypes.number.isRequired
|
|
301
|
-
};
|
|
302
|
-
Viewer3DFirstPerson.contextTypes = {
|
|
303
|
-
areaActions: PropTypes.object.isRequired,
|
|
304
|
-
holesActions: PropTypes.object.isRequired,
|
|
305
|
-
itemsActions: PropTypes.object.isRequired,
|
|
306
|
-
linesActions: PropTypes.object.isRequired,
|
|
307
|
-
projectActions: PropTypes.object.isRequired,
|
|
308
|
-
catalog: PropTypes.object
|
|
309
301
|
};
|
|
@@ -2665,13 +2665,4 @@ Scene3DViewer.propTypes = {
|
|
|
2665
2665
|
width: PropTypes.number.isRequired,
|
|
2666
2666
|
height: PropTypes.number.isRequired,
|
|
2667
2667
|
replaceCabinet: PropTypes.func.isRequired
|
|
2668
|
-
};
|
|
2669
|
-
Scene3DViewer.contextTypes = {
|
|
2670
|
-
areaActions: PropTypes.object.isRequired,
|
|
2671
|
-
holesActions: PropTypes.object.isRequired,
|
|
2672
|
-
itemsActions: PropTypes.object.isRequired,
|
|
2673
|
-
linesActions: PropTypes.object.isRequired,
|
|
2674
|
-
sceneActions: PropTypes.object.isRequired,
|
|
2675
|
-
projectActions: PropTypes.object.isRequired,
|
|
2676
|
-
catalog: PropTypes.object
|
|
2677
2668
|
};
|