kitchen-simulator 4.0.2-react-18 → 4.0.2

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.
Files changed (188) hide show
  1. package/README.md +3 -0
  2. package/es/AppContext.js +1 -1
  3. package/es/LiteKitchenConfigurator.js +165 -107
  4. package/es/LiteRenderer.js +161 -129
  5. package/es/actions/export.js +25 -12
  6. package/es/assets/gltf/door_sliding.bin +0 -0
  7. package/es/assets/img/png/helper/video_preview_start.png +0 -0
  8. package/es/assets/img/svg/bottombar/elevation.svg +12 -5
  9. package/es/catalog/catalog.js +21 -5
  10. package/es/catalog/holes/window-clear/planner-element.js +2 -2
  11. package/es/catalog/properties/export.js +21 -0
  12. package/es/catalog/properties/property-checkbox.js +68 -0
  13. package/es/catalog/properties/property-color.js +39 -0
  14. package/es/catalog/properties/property-enum.js +50 -0
  15. package/es/catalog/properties/property-hidden.js +19 -0
  16. package/es/catalog/properties/property-lenght-measure.js +100 -0
  17. package/es/catalog/properties/property-length-measure.js +84 -0
  18. package/es/catalog/properties/property-length-measure_hole.js +100 -0
  19. package/es/catalog/properties/property-number.js +48 -0
  20. package/es/catalog/properties/property-read-only.js +26 -0
  21. package/es/catalog/properties/property-string.js +48 -0
  22. package/es/catalog/properties/property-toggle.js +39 -0
  23. package/es/catalog/properties/shared-property-style.js +14 -0
  24. package/es/catalog/utils/exporter.js +1 -0
  25. package/es/catalog/utils/item-loader.js +18 -12
  26. package/es/class/hole.js +0 -2
  27. package/es/class/item.js +95 -69
  28. package/es/class/line.js +4 -8
  29. package/es/class/project.js +93 -80
  30. package/es/components/content.js +5 -93
  31. package/es/components/export.js +4 -6
  32. package/es/components/style/button.js +106 -0
  33. package/es/components/style/cancel-button.js +21 -0
  34. package/es/components/style/content-container.js +30 -0
  35. package/es/components/style/content-title.js +25 -0
  36. package/es/components/style/delete-button.js +24 -0
  37. package/es/components/style/export.js +28 -2
  38. package/es/components/style/form-block.js +20 -0
  39. package/es/components/style/form-color-input.js +26 -0
  40. package/es/components/style/form-label.js +22 -0
  41. package/es/components/style/form-number-input.js +11 -22
  42. package/es/components/style/form-number-input_2.js +200 -0
  43. package/es/components/style/form-select.js +19 -0
  44. package/es/components/style/form-slider.js +60 -0
  45. package/es/components/style/form-submit-button.js +25 -0
  46. package/es/components/style/form-text-input.js +69 -0
  47. package/es/components/viewer2d/group.js +5 -4
  48. package/es/components/viewer2d/item.js +155 -359
  49. package/es/components/viewer2d/layer.js +1 -1
  50. package/es/components/viewer2d/line.js +17 -47
  51. package/es/components/viewer2d/ruler.js +5 -3
  52. package/es/components/viewer2d/rulerDist.js +8 -7
  53. package/es/components/viewer2d/rulerX.js +4 -2
  54. package/es/components/viewer2d/rulerY.js +3 -0
  55. package/es/components/viewer2d/scene.js +4 -1
  56. package/es/components/viewer2d/state.js +1 -1
  57. package/es/components/viewer2d/utils.js +2 -2
  58. package/es/components/viewer2d/viewer2d.js +51 -84
  59. package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
  60. package/es/components/viewer3d/scene-creator.js +51 -15
  61. package/es/components/viewer3d/viewer3d-first-person.js +8 -0
  62. package/es/components/viewer3d/viewer3d.js +80 -88
  63. package/es/constants.js +6 -2
  64. package/es/devLiteRenderer.js +491 -150
  65. package/es/index.js +567 -25
  66. package/es/models.js +2 -1
  67. package/es/plugins/SVGLoader.js +1414 -0
  68. package/es/plugins/console-debugger.js +34 -0
  69. package/es/plugins/export.js +7 -0
  70. package/es/plugins/keyboard.js +110 -0
  71. package/es/reducers/project-reducer.js +3 -0
  72. package/es/styles/export.js +5 -0
  73. package/es/styles/tabs.css +40 -0
  74. package/es/utils/geometry.js +64 -106
  75. package/es/utils/helper.js +38 -1
  76. package/es/utils/isolate-event-handler.js +824 -605
  77. package/es/utils/molding.js +457 -11
  78. package/lib/AppContext.js +1 -1
  79. package/lib/LiteKitchenConfigurator.js +164 -107
  80. package/lib/LiteRenderer.js +160 -129
  81. package/lib/actions/export.js +35 -39
  82. package/lib/assets/gltf/door_sliding.bin +0 -0
  83. package/lib/assets/img/png/helper/video_preview_start.png +0 -0
  84. package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
  85. package/lib/catalog/catalog.js +20 -4
  86. package/lib/catalog/holes/window-clear/planner-element.js +2 -2
  87. package/lib/catalog/properties/export.js +81 -0
  88. package/lib/catalog/properties/property-checkbox.js +76 -0
  89. package/lib/catalog/properties/property-color.js +47 -0
  90. package/lib/catalog/properties/property-enum.js +58 -0
  91. package/lib/catalog/properties/property-hidden.js +27 -0
  92. package/lib/catalog/properties/property-lenght-measure.js +108 -0
  93. package/lib/catalog/properties/property-length-measure.js +92 -0
  94. package/lib/catalog/properties/property-length-measure_hole.js +108 -0
  95. package/lib/catalog/properties/property-number.js +56 -0
  96. package/lib/catalog/properties/property-read-only.js +34 -0
  97. package/lib/catalog/properties/property-string.js +56 -0
  98. package/lib/catalog/properties/property-toggle.js +47 -0
  99. package/lib/catalog/properties/shared-property-style.js +21 -0
  100. package/lib/catalog/utils/exporter.js +1 -0
  101. package/lib/catalog/utils/item-loader.js +18 -12
  102. package/lib/class/hole.js +0 -2
  103. package/lib/class/item.js +93 -67
  104. package/lib/class/line.js +3 -7
  105. package/lib/class/project.js +93 -80
  106. package/lib/components/content.js +5 -93
  107. package/lib/components/export.js +6 -26
  108. package/lib/components/style/button.js +115 -0
  109. package/lib/components/style/cancel-button.js +29 -0
  110. package/lib/components/style/content-container.js +38 -0
  111. package/lib/components/style/content-title.js +35 -0
  112. package/lib/components/style/delete-button.js +34 -0
  113. package/lib/components/style/export.js +105 -1
  114. package/lib/components/style/form-block.js +28 -0
  115. package/lib/components/style/form-color-input.js +34 -0
  116. package/lib/components/style/form-label.js +30 -0
  117. package/lib/components/style/form-number-input.js +11 -22
  118. package/lib/components/style/form-number-input_2.js +209 -0
  119. package/lib/components/style/form-select.js +29 -0
  120. package/lib/components/style/form-slider.js +68 -0
  121. package/lib/components/style/form-submit-button.js +35 -0
  122. package/lib/components/style/form-text-input.js +78 -0
  123. package/lib/components/viewer2d/group.js +5 -4
  124. package/lib/components/viewer2d/item.js +152 -356
  125. package/lib/components/viewer2d/layer.js +1 -1
  126. package/lib/components/viewer2d/line.js +17 -47
  127. package/lib/components/viewer2d/ruler.js +4 -2
  128. package/lib/components/viewer2d/rulerDist.js +8 -7
  129. package/lib/components/viewer2d/rulerX.js +4 -2
  130. package/lib/components/viewer2d/rulerY.js +3 -0
  131. package/lib/components/viewer2d/scene.js +4 -1
  132. package/lib/components/viewer2d/state.js +1 -1
  133. package/lib/components/viewer2d/utils.js +2 -2
  134. package/lib/components/viewer2d/viewer2d.js +49 -81
  135. package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
  136. package/lib/components/viewer3d/scene-creator.js +49 -13
  137. package/lib/components/viewer3d/viewer3d-first-person.js +8 -0
  138. package/lib/components/viewer3d/viewer3d.js +77 -84
  139. package/lib/constants.js +11 -7
  140. package/lib/devLiteRenderer.js +489 -148
  141. package/lib/index.js +567 -25
  142. package/lib/models.js +2 -1
  143. package/lib/plugins/SVGLoader.js +1419 -0
  144. package/lib/plugins/console-debugger.js +42 -0
  145. package/lib/plugins/export.js +25 -0
  146. package/lib/plugins/keyboard.js +117 -0
  147. package/lib/reducers/project-reducer.js +3 -0
  148. package/lib/styles/export.js +13 -0
  149. package/lib/styles/tabs.css +40 -0
  150. package/lib/utils/geometry.js +64 -106
  151. package/lib/utils/helper.js +40 -1
  152. package/lib/utils/isolate-event-handler.js +824 -604
  153. package/lib/utils/molding.js +458 -9
  154. package/package.json +21 -16
  155. package/es/mocks/appliancePayload.json +0 -27
  156. package/es/mocks/cabinetPayload.json +0 -1914
  157. package/es/mocks/cabinetPayload2.json +0 -76
  158. package/es/mocks/dataBundle2.json +0 -4
  159. package/es/mocks/distancePayload.json +0 -6
  160. package/es/mocks/doorStylePayload2.json +0 -84
  161. package/es/mocks/furnishingPayload.json +0 -23
  162. package/es/mocks/itemCDSPayload.json +0 -27
  163. package/es/mocks/lightingPayload.json +0 -23
  164. package/es/mocks/mockProps.json +0 -43
  165. package/es/mocks/mockProps2.json +0 -9
  166. package/es/mocks/moldingPayload.json +0 -19
  167. package/es/mocks/projectItemsCatalog.json +0 -133
  168. package/es/mocks/rectangleShape.json +0 -238
  169. package/es/mocks/replaceCabinetPayload.json +0 -81
  170. package/es/mocks/roomShapePayload.json +0 -5
  171. package/es/useAppContext.js +0 -8
  172. package/lib/mocks/appliancePayload.json +0 -27
  173. package/lib/mocks/cabinetPayload.json +0 -1914
  174. package/lib/mocks/cabinetPayload2.json +0 -76
  175. package/lib/mocks/dataBundle2.json +0 -4
  176. package/lib/mocks/distancePayload.json +0 -6
  177. package/lib/mocks/doorStylePayload2.json +0 -84
  178. package/lib/mocks/furnishingPayload.json +0 -23
  179. package/lib/mocks/itemCDSPayload.json +0 -27
  180. package/lib/mocks/lightingPayload.json +0 -23
  181. package/lib/mocks/mockProps.json +0 -43
  182. package/lib/mocks/mockProps2.json +0 -9
  183. package/lib/mocks/moldingPayload.json +0 -19
  184. package/lib/mocks/projectItemsCatalog.json +0 -133
  185. package/lib/mocks/rectangleShape.json +0 -238
  186. package/lib/mocks/replaceCabinetPayload.json +0 -81
  187. package/lib/mocks/roomShapePayload.json +0 -5
  188. package/lib/useAppContext.js +0 -16
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { FormLabel, FormColorInput } from "../../components/style/export";
4
+ import PropertyStyle from "./shared-property-style";
5
+ export default function PropertyColor(_ref) {
6
+ var value = _ref.value,
7
+ onUpdate = _ref.onUpdate,
8
+ configs = _ref.configs,
9
+ sourceElement = _ref.sourceElement,
10
+ internalState = _ref.internalState,
11
+ state = _ref.state;
12
+ var update = function update(val) {
13
+ if (configs.hook) {
14
+ return configs.hook(val, sourceElement, internalState, state).then(function (_val) {
15
+ return onUpdate(_val);
16
+ });
17
+ }
18
+ return onUpdate(val);
19
+ };
20
+ return /*#__PURE__*/React.createElement("table", {
21
+ className: "PropertyColor",
22
+ style: PropertyStyle.tableStyle
23
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
24
+ style: PropertyStyle.firstTdStyle
25
+ }, /*#__PURE__*/React.createElement(FormLabel, null, configs.label)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(FormColorInput, {
26
+ value: value,
27
+ onChange: function onChange(event) {
28
+ return update(event.target.value);
29
+ }
30
+ })))));
31
+ }
32
+ PropertyColor.propTypes = {
33
+ value: PropTypes.any.isRequired,
34
+ onUpdate: PropTypes.func.isRequired,
35
+ configs: PropTypes.object.isRequired,
36
+ sourceElement: PropTypes.object,
37
+ internalState: PropTypes.object,
38
+ state: PropTypes.object.isRequired
39
+ };
@@ -0,0 +1,50 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
3
+ var _templateObject, _templateObject2;
4
+ import React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { Seq } from 'immutable';
7
+ import { FormLabel, FormSelect } from "../../components/style/export";
8
+ import PropertyStyle from "./shared-property-style";
9
+ import styled from 'styled-components';
10
+ import { TEXT_COLOR_NEUTRAL_0, DEFAULT_FONT_FAMILY } from "../../constants";
11
+ var EnumWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin-top: 3px;\n"])));
12
+ var EnumTitle = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: auto;\n width: 110px;\n color: ", ";\n font-family: ", ";\n\n @media screen and (min-width: 1024) {\n font-size: 11px;\n }\n @media screen and (max-width: 1024) {\n font-size: 11px;\n }\n @media screen and (min-width: 1366) {\n font-size: 13px;\n }\n @media screen and (max-width: 1366) {\n font-size: 13px;\n }\n @media screen and (min-width: 1440) {\n font-size: 16px;\n }\n @media screen and (max-width: 1440) {\n font-size: 16px;\n }\n font-weight: 400;\n line-height: 15px;\n text-align: left;\n"])), TEXT_COLOR_NEUTRAL_0, DEFAULT_FONT_FAMILY);
13
+ export default function PropertyEnum(_ref) {
14
+ var value = _ref.value,
15
+ onUpdate = _ref.onUpdate,
16
+ configs = _ref.configs,
17
+ sourceElement = _ref.sourceElement,
18
+ internalState = _ref.internalState,
19
+ state = _ref.state;
20
+ var update = function update(val) {
21
+ if (configs.hook) {
22
+ return configs.hook(val, sourceElement, internalState, state).then(function (_val) {
23
+ return onUpdate(_val);
24
+ });
25
+ }
26
+ return onUpdate(val);
27
+ };
28
+ return /*#__PURE__*/React.createElement(EnumWrapper, null, /*#__PURE__*/React.createElement(EnumTitle, null, configs.label), /*#__PURE__*/React.createElement(FormSelect, {
29
+ value: value,
30
+ onChange: function onChange(event) {
31
+ return update(event.target.value);
32
+ }
33
+ }, Seq(configs.values).entrySeq().map(function (_ref2) {
34
+ var _ref3 = _slicedToArray(_ref2, 2),
35
+ key = _ref3[0],
36
+ value = _ref3[1];
37
+ return /*#__PURE__*/React.createElement("option", {
38
+ key: key,
39
+ value: key
40
+ }, value);
41
+ })));
42
+ }
43
+ PropertyEnum.propTypes = {
44
+ value: PropTypes.any.isRequired,
45
+ onUpdate: PropTypes.func.isRequired,
46
+ configs: PropTypes.object.isRequired,
47
+ sourceElement: PropTypes.object,
48
+ internalState: PropTypes.object,
49
+ state: PropTypes.object.isRequired
50
+ };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ export default function PropertyHidden(_ref) {
4
+ var value = _ref.value,
5
+ onUpdate = _ref.onUpdate,
6
+ configs = _ref.configs,
7
+ sourceElement = _ref.sourceElement,
8
+ internalState = _ref.internalState,
9
+ state = _ref.state;
10
+ return null;
11
+ }
12
+ PropertyHidden.propTypes = {
13
+ value: PropTypes.any.isRequired,
14
+ onUpdate: PropTypes.func.isRequired,
15
+ configs: PropTypes.object.isRequired,
16
+ sourceElement: PropTypes.object,
17
+ internalState: PropTypes.object,
18
+ state: PropTypes.object.isRequired
19
+ };
@@ -0,0 +1,100 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["hook", "label"];
4
+ import React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { BASE_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS, UNITS_LENGTH, UNIT_INCH } from "../../constants";
7
+ import { convert } from "../../utils/convert-units-lite";
8
+ import { FormLabel, FormNumberInput, FormSelect } from "../../components/style/export";
9
+ import { Map } from 'immutable';
10
+ import { toFixedFloat } from "../../utils/math";
11
+ import PropertyStyle from "./shared-property-style";
12
+ var internalTableStyle = {
13
+ borderCollapse: 'collapse'
14
+ };
15
+ var secondTdStyle = {
16
+ padding: 0
17
+ };
18
+ var unitContainerStyle = {
19
+ width: '5em'
20
+ };
21
+ export default function PropertyLengthMeasure(_ref, _ref2) {
22
+ var value = _ref.value,
23
+ onUpdate = _ref.onUpdate,
24
+ onValid = _ref.onValid,
25
+ configs = _ref.configs,
26
+ sourceElement = _ref.sourceElement,
27
+ internalState = _ref.internalState,
28
+ state = _ref.state;
29
+ var catalog = _ref2.catalog;
30
+ var length = value.get('length') || 0; // length in inch
31
+ var _length = value.get('_length') || length; // length in unit
32
+ var _unit = value.get('_unit') || UNIT_INCH;
33
+ var type = value.get('type') || BASE_CABINET_LAYOUTPOS;
34
+ var hook = configs.hook,
35
+ label = configs.label,
36
+ configRest = _objectWithoutProperties(configs, _excluded);
37
+ var update = function update(lengthInput, unitInput, type) {
38
+ var newLength = toFixedFloat(lengthInput);
39
+ var merged = null;
40
+ if (type === 0) {
41
+ merged = value.merge({
42
+ length: unitInput !== UNIT_INCH ? convert(newLength).from(unitInput).to(UNIT_INCH) : newLength,
43
+ _length: newLength
44
+ });
45
+ } else {
46
+ merged = value.merge({
47
+ _length: convert(newLength).from(UNIT_INCH).to(unitInput),
48
+ _unit: unitInput
49
+ });
50
+ }
51
+ if (hook) {
52
+ return hook(merged, sourceElement, internalState, state).then(function (val) {
53
+ return onUpdate(val);
54
+ });
55
+ }
56
+ return onUpdate(merged);
57
+ };
58
+ return /*#__PURE__*/React.createElement("table", {
59
+ className: "PropertyLengthMeasure",
60
+ style: PropertyStyle.tableStyle
61
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
62
+ style: PropertyStyle.firstTdStyle
63
+ }, /*#__PURE__*/React.createElement(FormLabel, null, label)), /*#__PURE__*/React.createElement("td", {
64
+ style: secondTdStyle
65
+ }, /*#__PURE__*/React.createElement("table", {
66
+ style: internalTableStyle
67
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(FormNumberInput, _extends({
68
+ disabled: type === TALL_CABINET_LAYOUTPOS,
69
+ value: _length,
70
+ onChange: function onChange(event) {
71
+ return update(event.target.value, _unit, 0);
72
+ },
73
+ onValid: onValid
74
+ }, configRest))), /*#__PURE__*/React.createElement("td", {
75
+ style: unitContainerStyle
76
+ }, /*#__PURE__*/React.createElement(FormSelect, {
77
+ disabled: type === TALL_CABINET_LAYOUTPOS,
78
+ value: _unit,
79
+ onChange: function onChange(event) {
80
+ return update(length, event.target.value, 1);
81
+ }
82
+ }, UNITS_LENGTH.map(function (el) {
83
+ return /*#__PURE__*/React.createElement("option", {
84
+ key: el,
85
+ value: el
86
+ }, el);
87
+ }))))))))));
88
+ }
89
+ PropertyLengthMeasure.propTypes = {
90
+ value: PropTypes.instanceOf(Map).isRequired,
91
+ onUpdate: PropTypes.func.isRequired,
92
+ onValid: PropTypes.func,
93
+ configs: PropTypes.object.isRequired,
94
+ sourceElement: PropTypes.object,
95
+ internalState: PropTypes.object,
96
+ state: PropTypes.object.isRequired
97
+ };
98
+ PropertyLengthMeasure.contextTypes = {
99
+ catalog: PropTypes.object.isRequired
100
+ };
@@ -0,0 +1,84 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
4
+ var _excluded = ["hook", "label"];
5
+ var _templateObject, _templateObject2;
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { BASE_CABINET_LAYOUTPOS, DEFAULT_FONT_FAMILY, TALL_CABINET_LAYOUTPOS, TEXT_COLOR_NEUTRAL_0, UNIT_CENTIMETER, UNIT_INCH } from "../../constants";
9
+ import { convert } from "../../utils/convert-units-lite";
10
+ import { FormNumberInput } from "../../components/style/export";
11
+ import { Map } from 'immutable';
12
+ import { toFixedFloat } from "../../utils/math";
13
+ import styled from 'styled-components';
14
+ var DistanceFloorWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin-top: 3px;\n"])));
15
+ var DistanceFloorTitle = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: auto;\n width: 110px;\n color: ", ";\n font-family: ", ";\n font-size: 16px;\n\n @media screen and (min-width: 1024) {\n font-size: 11px;\n }\n @media screen and (max-width: 1024) {\n font-size: 11px;\n }\n @media screen and (min-width: 1366) {\n font-size: 13px;\n }\n @media screen and (max-width: 1366) {\n font-size: 13px;\n }\n @media screen and (min-width: 1440) {\n font-size: 16px;\n }\n @media screen and (max-width: 1440) {\n font-size: 16px;\n }\n font-weight: 400;\n line-height: 15px;\n text-align: left;\n"])), TEXT_COLOR_NEUTRAL_0, DEFAULT_FONT_FAMILY);
16
+ export default function PropertyLengthMeasure(_ref, _ref2) {
17
+ var value = _ref.value,
18
+ onUpdate = _ref.onUpdate,
19
+ onValid = _ref.onValid,
20
+ configs = _ref.configs,
21
+ sourceElement = _ref.sourceElement,
22
+ internalState = _ref.internalState,
23
+ state = _ref.state;
24
+ var catalog = _ref2.catalog;
25
+ var _unit = value.get('_unit');
26
+ var unit = state.getIn(['scene', 'layers', state.scene.selectedLayer, 'unit']);
27
+ var length = value.get('length') || 0; // in centi
28
+ var _length = value.get('_length') || length; // in _unit
29
+ if (!_unit) {
30
+ _unit = UNIT_INCH;
31
+ _length = convert(length).from(UNIT_CENTIMETER).to(UNIT_INCH);
32
+ }
33
+ var type = value.get('type') || BASE_CABINET_LAYOUTPOS;
34
+ var hook = configs.hook,
35
+ label = configs.label,
36
+ configRest = _objectWithoutProperties(configs, _excluded);
37
+ var update = function update(lengthInput, unitInput, type) {
38
+ var newLength = toFixedFloat(lengthInput);
39
+ var merged = null;
40
+ if (type === 0) {
41
+ merged = value.merge({
42
+ _length: newLength,
43
+ _unit: unitInput,
44
+ length: convert(newLength).from(unitInput).to(UNIT_CENTIMETER)
45
+ });
46
+ } else {
47
+ merged = value.merge({
48
+ _length: convert(newLength).from(UNIT_CENTIMETER).to(unitInput),
49
+ _unit: unitInput,
50
+ length: newLength
51
+ });
52
+ }
53
+ if (hook) {
54
+ return hook(merged, sourceElement, internalState, state).then(function (val) {
55
+ return onUpdate(val);
56
+ });
57
+ }
58
+ return onUpdate(merged);
59
+ };
60
+ return /*#__PURE__*/React.createElement(DistanceFloorWrapper, null, /*#__PURE__*/React.createElement(DistanceFloorTitle, null, label), /*#__PURE__*/React.createElement(FormNumberInput, _extends({
61
+ disabled: type === TALL_CABINET_LAYOUTPOS,
62
+ value: convert(_length).from('in').to(unit),
63
+ onChange: function onChange(event) {
64
+ return update(event.target.value, _unit, 0);
65
+ },
66
+ onValid: onValid,
67
+ labelName: label,
68
+ style: {
69
+ paddingRight: '40px'
70
+ }
71
+ }, configRest)));
72
+ }
73
+ PropertyLengthMeasure.propTypes = {
74
+ value: PropTypes.instanceOf(Map).isRequired,
75
+ onUpdate: PropTypes.func.isRequired,
76
+ onValid: PropTypes.func,
77
+ configs: PropTypes.object.isRequired,
78
+ sourceElement: PropTypes.object,
79
+ internalState: PropTypes.object,
80
+ state: PropTypes.object.isRequired
81
+ };
82
+ PropertyLengthMeasure.contextTypes = {
83
+ catalog: PropTypes.object.isRequired
84
+ };
@@ -0,0 +1,100 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["hook", "label"];
4
+ import React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { BASE_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS, UNIT_INCH, UNITS_LENGTH } from "../../constants";
7
+ import { convert } from "../../utils/convert-units-lite";
8
+ import { FormLabel, FormNumberInput1, FormSelect } from "../../components/style/export";
9
+ import { Map } from 'immutable';
10
+ import { toFixedFloat } from "../../utils/math";
11
+ import PropertyStyle from "./shared-property-style";
12
+ var internalTableStyle = {
13
+ borderCollapse: 'collapse'
14
+ };
15
+ var secondTdStyle = {
16
+ padding: 0
17
+ };
18
+ var unitContainerStyle = {
19
+ width: '3em'
20
+ };
21
+ export default function PropertyLengthMeasureHole(_ref, _ref2) {
22
+ var value = _ref.value,
23
+ onUpdate = _ref.onUpdate,
24
+ onValid = _ref.onValid,
25
+ configs = _ref.configs,
26
+ sourceElement = _ref.sourceElement,
27
+ internalState = _ref.internalState,
28
+ state = _ref.state;
29
+ var catalog = _ref2.catalog;
30
+ var _unit = value.get('_unit') || UNIT_INCH;
31
+ var _length = value.get('_length') || 0;
32
+ var length = value.get('length') || _length;
33
+ var type = value.get('type') || BASE_CABINET_LAYOUTPOS;
34
+ var hook = configs.hook,
35
+ label = configs.label,
36
+ configRest = _objectWithoutProperties(configs, _excluded);
37
+ var update = function update(lengthInput, unitInput, type) {
38
+ var newLength = toFixedFloat(lengthInput);
39
+ var merged = null;
40
+ if (type === 0) {
41
+ merged = value.merge({
42
+ _length: newLength,
43
+ length: convert(newLength).from(unitInput).to('cm')
44
+ });
45
+ } else {
46
+ merged = value.merge({
47
+ _length: convert(newLength).from(UNIT_INCH).to(unitInput),
48
+ _unit: unitInput
49
+ });
50
+ }
51
+ if (hook) {
52
+ return hook(merged, sourceElement, internalState, state).then(function (val) {
53
+ return onUpdate(val);
54
+ });
55
+ }
56
+ return onUpdate(merged);
57
+ };
58
+ return /*#__PURE__*/React.createElement("table", {
59
+ className: "PropertyLengthMeasure",
60
+ style: PropertyStyle.tableStyle
61
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
62
+ style: PropertyStyle.firstTdStyle
63
+ }, /*#__PURE__*/React.createElement(FormLabel, null, label)), /*#__PURE__*/React.createElement("td", {
64
+ style: secondTdStyle
65
+ }, /*#__PURE__*/React.createElement("table", {
66
+ style: internalTableStyle
67
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(FormNumberInput1, _extends({
68
+ disabled: type === TALL_CABINET_LAYOUTPOS,
69
+ value: _length,
70
+ onChange: function onChange(event) {
71
+ return update(event.target.value, _unit, 0);
72
+ },
73
+ onValid: onValid
74
+ }, configRest))), /*#__PURE__*/React.createElement("td", {
75
+ style: unitContainerStyle
76
+ }, /*#__PURE__*/React.createElement(FormSelect, {
77
+ disabled: type === TALL_CABINET_LAYOUTPOS,
78
+ value: _unit,
79
+ onChange: function onChange(event) {
80
+ return update(length, event.target.value, 1);
81
+ }
82
+ }, UNITS_LENGTH.map(function (el) {
83
+ return /*#__PURE__*/React.createElement("option", {
84
+ key: el,
85
+ value: el
86
+ }, el);
87
+ }))))))))));
88
+ }
89
+ PropertyLengthMeasureHole.propTypes = {
90
+ value: PropTypes.instanceOf(Map).isRequired,
91
+ onUpdate: PropTypes.func.isRequired,
92
+ onValid: PropTypes.func,
93
+ configs: PropTypes.object.isRequired,
94
+ sourceElement: PropTypes.object,
95
+ internalState: PropTypes.object,
96
+ state: PropTypes.object.isRequired
97
+ };
98
+ PropertyLengthMeasureHole.contextTypes = {
99
+ catalog: PropTypes.object.isRequired
100
+ };
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { FormLabel, FormNumberInput } from "../../components/style/export";
4
+ import PropertyStyle from "./shared-property-style";
5
+ export default function PropertyNumber(_ref) {
6
+ var value = _ref.value,
7
+ onUpdate = _ref.onUpdate,
8
+ onValid = _ref.onValid,
9
+ configs = _ref.configs,
10
+ sourceElement = _ref.sourceElement,
11
+ internalState = _ref.internalState,
12
+ state = _ref.state;
13
+ var update = function update(val) {
14
+ var number = parseFloat(val);
15
+ if (isNaN(number)) {
16
+ number = 0;
17
+ }
18
+ if (configs.hook) {
19
+ return configs.hook(number, sourceElement, internalState, state).then(function (_val) {
20
+ return onUpdate(_val);
21
+ });
22
+ }
23
+ return onUpdate(number);
24
+ };
25
+ return /*#__PURE__*/React.createElement("table", {
26
+ className: "PropertyNumber",
27
+ style: PropertyStyle.tableStyle
28
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
29
+ style: PropertyStyle.firstTdStyle
30
+ }, /*#__PURE__*/React.createElement(FormLabel, null, configs.label)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(FormNumberInput, {
31
+ value: value,
32
+ onChange: function onChange(event) {
33
+ return update(event.target.value);
34
+ },
35
+ onValid: onValid,
36
+ min: configs.min,
37
+ max: configs.max
38
+ })))));
39
+ }
40
+ PropertyNumber.propTypes = {
41
+ value: PropTypes.any.isRequired,
42
+ onUpdate: PropTypes.func.isRequired,
43
+ onValid: PropTypes.func,
44
+ configs: PropTypes.object.isRequired,
45
+ sourceElement: PropTypes.object,
46
+ internalState: PropTypes.object,
47
+ state: PropTypes.object.isRequired
48
+ };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { FormLabel } from "../../components/style/export";
4
+ import PropertyStyle from "./shared-property-style";
5
+ export default function PropertyReadOnly(_ref) {
6
+ var value = _ref.value,
7
+ onUpdate = _ref.onUpdate,
8
+ configs = _ref.configs,
9
+ sourceElement = _ref.sourceElement,
10
+ internalState = _ref.internalState,
11
+ state = _ref.state;
12
+ return /*#__PURE__*/React.createElement("table", {
13
+ className: "PropertyReadOnly",
14
+ style: PropertyStyle.tableStyle
15
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
16
+ style: PropertyStyle.firstTdStyle
17
+ }, /*#__PURE__*/React.createElement(FormLabel, null, configs.label)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", null, value)))));
18
+ }
19
+ PropertyReadOnly.propTypes = {
20
+ value: PropTypes.any.isRequired,
21
+ onUpdate: PropTypes.func.isRequired,
22
+ configs: PropTypes.object.isRequired,
23
+ sourceElement: PropTypes.object,
24
+ internalState: PropTypes.object,
25
+ state: PropTypes.object.isRequired
26
+ };
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { FormLabel, FormTextInput } from "../../components/style/export";
4
+ import PropertyStyle from "./shared-property-style";
5
+ var tableStyle = {
6
+ width: '100%',
7
+ borderSpacing: '2px 0',
8
+ marginBottom: '2px'
9
+ };
10
+ var firstTdStyle = {
11
+ width: '6em',
12
+ textTransform: 'capitalize'
13
+ };
14
+ export default function PropertyString(_ref) {
15
+ var value = _ref.value,
16
+ onUpdate = _ref.onUpdate,
17
+ configs = _ref.configs,
18
+ sourceElement = _ref.sourceElement,
19
+ internalState = _ref.internalState,
20
+ state = _ref.state;
21
+ var update = function update(val) {
22
+ if (configs.hook) {
23
+ return configs.hook(val, sourceElement, internalState, state).then(function (_val) {
24
+ return onUpdate(_val);
25
+ });
26
+ }
27
+ return onUpdate(val);
28
+ };
29
+ return /*#__PURE__*/React.createElement("table", {
30
+ className: "PropertyString",
31
+ style: PropertyStyle.tableStyle
32
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
33
+ style: PropertyStyle.firstTdStyle
34
+ }, /*#__PURE__*/React.createElement(FormLabel, null, configs.label)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(FormTextInput, {
35
+ value: value,
36
+ onChange: function onChange(event) {
37
+ return update(event.target.value);
38
+ }
39
+ })))));
40
+ }
41
+ PropertyString.propTypes = {
42
+ value: PropTypes.any.isRequired,
43
+ onUpdate: PropTypes.func.isRequired,
44
+ configs: PropTypes.object.isRequired,
45
+ sourceElement: PropTypes.object,
46
+ internalState: PropTypes.object,
47
+ state: PropTypes.object.isRequired
48
+ };
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { FormLabel, Button } from "../../components/style/export";
4
+ import PropertyStyle from "./shared-property-style";
5
+ export default function PropertyToggle(_ref) {
6
+ var value = _ref.value,
7
+ onUpdate = _ref.onUpdate,
8
+ configs = _ref.configs,
9
+ sourceElement = _ref.sourceElement,
10
+ internalState = _ref.internalState,
11
+ state = _ref.state;
12
+ var update = function update(val) {
13
+ if (configs.hook) {
14
+ return configs.hook(val, sourceElement, internalState, state).then(function (_val) {
15
+ return onUpdate(_val);
16
+ });
17
+ }
18
+ return onUpdate(val);
19
+ };
20
+ return /*#__PURE__*/React.createElement("table", {
21
+ className: "PropertyToggle",
22
+ style: PropertyStyle.tableStyle
23
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
24
+ style: PropertyStyle.firstTdStyle
25
+ }, /*#__PURE__*/React.createElement(FormLabel, null, configs.label)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Button, {
26
+ onClick: function onClick(e) {
27
+ return update(!value);
28
+ },
29
+ size: "small"
30
+ }, configs.actionName)))));
31
+ }
32
+ PropertyToggle.propTypes = {
33
+ value: PropTypes.any.isRequired,
34
+ onUpdate: PropTypes.func.isRequired,
35
+ configs: PropTypes.object.isRequired,
36
+ sourceElement: PropTypes.object,
37
+ internalState: PropTypes.object,
38
+ state: PropTypes.object.isRequired
39
+ };
@@ -0,0 +1,14 @@
1
+ var tableStyle = {
2
+ width: '100%',
3
+ borderSpacing: '2px 0',
4
+ marginBottom: '2px'
5
+ };
6
+ var firstTdStyle = {
7
+ width: '6em',
8
+ textTransform: 'capitalize'
9
+ };
10
+ var PropertyStyle = {
11
+ tableStyle: tableStyle,
12
+ firstTdStyle: firstTdStyle
13
+ };
14
+ export default PropertyStyle;
@@ -137,6 +137,7 @@ export default function (_ref) {
137
137
  img: base,
138
138
  obj: obj_property,
139
139
  cds: cds,
140
+ structure_json: structure_json,
140
141
  render2D: function render2D(element, layer, scene) {
141
142
  return render2DItem.call(this, element, layer, scene, sizeinfo, layoutpos, is_corner, shape_svg);
142
143
  },
@@ -207,12 +207,17 @@ export function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corn
207
207
  transform: "translate(".concat(-transX, "px, ").concat(-transY, "px)")
208
208
  },
209
209
  onMouseEnter: function onMouseEnter(event) {
210
- var bbox = event.target.getBoundingClientRect();
211
- if (document.getElementById('warning_box_2d')) {
212
- document.getElementById('warning_box_2d').style.display = 'flex';
213
- document.getElementById('warning_box_2d').style.top = "".concat(bbox.top - 60, "px");
214
- document.getElementById('warning_box_2d').style.left = "".concat(bbox.left, "px");
215
- }
210
+ var target = event.currentTarget;
211
+ var tooltip = document.getElementById('warning_box_2d');
212
+ var parent = document.querySelector('#kitchen-simulator-container');
213
+ if (!tooltip || !parent) return;
214
+ var targetRect = target.getBoundingClientRect();
215
+ var parentRect = parent.getBoundingClientRect();
216
+ var left = targetRect.left - parentRect.left;
217
+ var top = targetRect.top - parentRect.top;
218
+ tooltip.style.display = 'flex';
219
+ tooltip.style.left = "".concat(left, "px");
220
+ tooltip.style.top = "".concat(top - 60, "px");
216
221
  },
217
222
  onMouseLeave: function onMouseLeave() {
218
223
  if (document.getElementById('warning_box_2d')) {
@@ -449,8 +454,9 @@ export function render3DItem(element, layer, scene, sizeinfo, structure_json, is
449
454
  var tempDoorStyles = doorStyles.toJS();
450
455
  var tempPlaceholders = structure.tempPlaceholders;
451
456
  var tPlaceholders = tempPlaceholders.find(function (el) {
452
- return el.id === tempDoorStyles.cabinet_door_style_id;
453
- // return el.id === tempDoorStyles.cds[0].cabinet_door_style_id;
457
+ var _tempDoorStyles$cds, _tempDoorStyles$cds$;
458
+ if (tempDoorStyles !== null && tempDoorStyles !== void 0 && tempDoorStyles.cabinet_door_style_id) return el.id === (tempDoorStyles === null || tempDoorStyles === void 0 ? void 0 : tempDoorStyles.cabinet_door_style_id);else if ((tempDoorStyles === null || tempDoorStyles === void 0 || (_tempDoorStyles$cds = tempDoorStyles.cds) === null || _tempDoorStyles$cds === void 0 ? void 0 : _tempDoorStyles$cds.length) > 0) return el.id === (tempDoorStyles === null || tempDoorStyles === void 0 || (_tempDoorStyles$cds$ = tempDoorStyles.cds[0]) === null || _tempDoorStyles$cds$ === void 0 ? void 0 : _tempDoorStyles$cds$.cabinet_door_style_id);
459
+ return false;
454
460
  });
455
461
  if (tPlaceholders !== undefined) {
456
462
  placeholders = tPlaceholders.placeholders;
@@ -641,10 +647,10 @@ export function render3DItem(element, layer, scene, sizeinfo, structure_json, is
641
647
  vLine3.material.depthTest = false;
642
648
  // translate vector to center of object
643
649
  var uVec = new Three.Vector3(-posVec.x / scalevec.x, -posVec.y / scalevec.y, -posVec.z / scalevec.z);
644
- vLine.translateY(0.1);
645
- vLine1.translateY(0.1);
646
- vLine2.translateY(0.1);
647
- vLine3.translateY(0.1);
650
+ vLine.translateY(_boundingBox.min.y + 0.1);
651
+ vLine1.translateY(_boundingBox.min.y + 0.1);
652
+ vLine2.translateY(_boundingBox.min.y + 0.1);
653
+ vLine3.translateY(_boundingBox.min.y + 0.1);
648
654
 
649
655
  //rotObj.translateOnAxis(uVec, 1);
650
656
  upObj.translateOnAxis(uVec, 1);
package/es/class/hole.js CHANGED
@@ -777,11 +777,9 @@ var Hole = /*#__PURE__*/function () {
777
777
  scene: scene.mergeIn(['layers', layerID, 'holes', holeID], hole)
778
778
  });
779
779
  state = state.updateIn(['scene', 'layers', layerID, 'lines', hole.line, 'holes'], function (holes) {
780
- console.log(holes, 'holes');
781
780
  var index = holes.findIndex(function (ID) {
782
781
  return holeID === ID;
783
782
  });
784
- console.log(index, 'index');
785
783
  return index === -1 ? holes.push(holeID) : holes;
786
784
  });
787
785
  return {