kitchen-simulator 4.0.6-react-18 → 4.0.6

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 (192) hide show
  1. package/README.md +3 -0
  2. package/es/AppContext.js +1 -1
  3. package/es/LiteKitchenConfigurator.js +162 -107
  4. package/es/LiteRenderer.js +162 -137
  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 +35 -26
  26. package/es/class/hole.js +0 -2
  27. package/es/class/item.js +96 -70
  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 +29 -27
  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/grids/grid-streak.js +1 -1
  48. package/es/components/viewer2d/group.js +5 -4
  49. package/es/components/viewer2d/item.js +155 -359
  50. package/es/components/viewer2d/layer.js +1 -1
  51. package/es/components/viewer2d/line.js +17 -47
  52. package/es/components/viewer2d/ruler.js +5 -3
  53. package/es/components/viewer2d/rulerDist.js +8 -7
  54. package/es/components/viewer2d/rulerX.js +4 -2
  55. package/es/components/viewer2d/rulerY.js +3 -0
  56. package/es/components/viewer2d/scene.js +17 -12
  57. package/es/components/viewer2d/state.js +1 -1
  58. package/es/components/viewer2d/utils.js +2 -2
  59. package/es/components/viewer2d/vertex.js +3 -2
  60. package/es/components/viewer2d/viewer2d.js +51 -87
  61. package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
  62. package/es/components/viewer3d/scene-creator.js +59 -18
  63. package/es/components/viewer3d/viewer3d-first-person.js +24 -26
  64. package/es/components/viewer3d/viewer3d.js +100 -112
  65. package/es/constants.js +6 -2
  66. package/es/devLiteRenderer.js +491 -150
  67. package/es/index.js +606 -1
  68. package/es/models.js +3 -2
  69. package/es/plugins/SVGLoader.js +1414 -0
  70. package/es/plugins/console-debugger.js +34 -0
  71. package/es/plugins/export.js +7 -0
  72. package/es/plugins/keyboard.js +110 -0
  73. package/es/reducers/project-reducer.js +3 -0
  74. package/es/styles/export.js +5 -0
  75. package/es/styles/tabs.css +40 -0
  76. package/es/utils/geometry.js +72 -114
  77. package/es/utils/helper.js +38 -1
  78. package/es/utils/isolate-event-handler.js +826 -606
  79. package/es/utils/molding.js +457 -11
  80. package/lib/AppContext.js +1 -1
  81. package/lib/LiteKitchenConfigurator.js +161 -107
  82. package/lib/LiteRenderer.js +161 -137
  83. package/lib/actions/export.js +35 -39
  84. package/lib/assets/gltf/door_sliding.bin +0 -0
  85. package/lib/assets/img/png/helper/video_preview_start.png +0 -0
  86. package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
  87. package/lib/catalog/catalog.js +20 -4
  88. package/lib/catalog/holes/window-clear/planner-element.js +2 -2
  89. package/lib/catalog/properties/export.js +81 -0
  90. package/lib/catalog/properties/property-checkbox.js +76 -0
  91. package/lib/catalog/properties/property-color.js +47 -0
  92. package/lib/catalog/properties/property-enum.js +58 -0
  93. package/lib/catalog/properties/property-hidden.js +27 -0
  94. package/lib/catalog/properties/property-lenght-measure.js +108 -0
  95. package/lib/catalog/properties/property-length-measure.js +92 -0
  96. package/lib/catalog/properties/property-length-measure_hole.js +108 -0
  97. package/lib/catalog/properties/property-number.js +56 -0
  98. package/lib/catalog/properties/property-read-only.js +34 -0
  99. package/lib/catalog/properties/property-string.js +56 -0
  100. package/lib/catalog/properties/property-toggle.js +47 -0
  101. package/lib/catalog/properties/shared-property-style.js +21 -0
  102. package/lib/catalog/utils/exporter.js +1 -0
  103. package/lib/catalog/utils/item-loader.js +35 -26
  104. package/lib/class/hole.js +0 -2
  105. package/lib/class/item.js +94 -68
  106. package/lib/class/line.js +3 -7
  107. package/lib/class/project.js +93 -80
  108. package/lib/components/content.js +5 -93
  109. package/lib/components/export.js +6 -26
  110. package/lib/components/style/button.js +115 -0
  111. package/lib/components/style/cancel-button.js +29 -0
  112. package/lib/components/style/content-container.js +38 -0
  113. package/lib/components/style/content-title.js +35 -0
  114. package/lib/components/style/delete-button.js +34 -0
  115. package/lib/components/style/export.js +105 -1
  116. package/lib/components/style/form-block.js +28 -0
  117. package/lib/components/style/form-color-input.js +34 -0
  118. package/lib/components/style/form-label.js +30 -0
  119. package/lib/components/style/form-number-input.js +29 -27
  120. package/lib/components/style/form-number-input_2.js +209 -0
  121. package/lib/components/style/form-select.js +29 -0
  122. package/lib/components/style/form-slider.js +68 -0
  123. package/lib/components/style/form-submit-button.js +35 -0
  124. package/lib/components/style/form-text-input.js +78 -0
  125. package/lib/components/viewer2d/grids/grid-streak.js +1 -1
  126. package/lib/components/viewer2d/group.js +5 -4
  127. package/lib/components/viewer2d/item.js +152 -356
  128. package/lib/components/viewer2d/layer.js +1 -1
  129. package/lib/components/viewer2d/line.js +17 -47
  130. package/lib/components/viewer2d/ruler.js +4 -2
  131. package/lib/components/viewer2d/rulerDist.js +8 -7
  132. package/lib/components/viewer2d/rulerX.js +4 -2
  133. package/lib/components/viewer2d/rulerY.js +3 -0
  134. package/lib/components/viewer2d/scene.js +17 -12
  135. package/lib/components/viewer2d/state.js +1 -1
  136. package/lib/components/viewer2d/utils.js +2 -2
  137. package/lib/components/viewer2d/vertex.js +3 -2
  138. package/lib/components/viewer2d/viewer2d.js +49 -84
  139. package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
  140. package/lib/components/viewer3d/scene-creator.js +57 -16
  141. package/lib/components/viewer3d/viewer3d-first-person.js +24 -26
  142. package/lib/components/viewer3d/viewer3d.js +97 -108
  143. package/lib/constants.js +11 -7
  144. package/lib/devLiteRenderer.js +489 -148
  145. package/lib/index.js +607 -6
  146. package/lib/models.js +3 -2
  147. package/lib/plugins/SVGLoader.js +1419 -0
  148. package/lib/plugins/console-debugger.js +42 -0
  149. package/lib/plugins/export.js +25 -0
  150. package/lib/plugins/keyboard.js +117 -0
  151. package/lib/reducers/project-reducer.js +3 -0
  152. package/lib/styles/export.js +13 -0
  153. package/lib/styles/tabs.css +40 -0
  154. package/lib/utils/geometry.js +72 -114
  155. package/lib/utils/helper.js +40 -1
  156. package/lib/utils/isolate-event-handler.js +826 -605
  157. package/lib/utils/molding.js +458 -9
  158. package/package.json +21 -20
  159. package/es/mocks/appliancePayload.json +0 -27
  160. package/es/mocks/cabinetPayload.json +0 -1914
  161. package/es/mocks/cabinetPayload2.json +0 -76
  162. package/es/mocks/dataBundle2.json +0 -4
  163. package/es/mocks/distancePayload.json +0 -6
  164. package/es/mocks/doorStylePayload2.json +0 -84
  165. package/es/mocks/furnishingPayload.json +0 -23
  166. package/es/mocks/itemCDSPayload.json +0 -27
  167. package/es/mocks/lightingPayload.json +0 -23
  168. package/es/mocks/mockProps.json +0 -43
  169. package/es/mocks/mockProps2.json +0 -9
  170. package/es/mocks/moldingPayload.json +0 -19
  171. package/es/mocks/projectItemsCatalog.json +0 -133
  172. package/es/mocks/rectangleShape.json +0 -238
  173. package/es/mocks/replaceCabinetPayload.json +0 -81
  174. package/es/mocks/roomShapePayload.json +0 -5
  175. package/es/useAppContext.js +0 -8
  176. package/lib/mocks/appliancePayload.json +0 -27
  177. package/lib/mocks/cabinetPayload.json +0 -1914
  178. package/lib/mocks/cabinetPayload2.json +0 -76
  179. package/lib/mocks/dataBundle2.json +0 -4
  180. package/lib/mocks/distancePayload.json +0 -6
  181. package/lib/mocks/doorStylePayload2.json +0 -84
  182. package/lib/mocks/furnishingPayload.json +0 -23
  183. package/lib/mocks/itemCDSPayload.json +0 -27
  184. package/lib/mocks/lightingPayload.json +0 -23
  185. package/lib/mocks/mockProps.json +0 -43
  186. package/lib/mocks/mockProps2.json +0 -9
  187. package/lib/mocks/moldingPayload.json +0 -19
  188. package/lib/mocks/projectItemsCatalog.json +0 -133
  189. package/lib/mocks/rectangleShape.json +0 -238
  190. package/lib/mocks/replaceCabinetPayload.json +0 -81
  191. package/lib/mocks/roomShapePayload.json +0 -5
  192. 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
  },