kitchen-simulator 3.1.1 → 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.
Files changed (138) hide show
  1. package/README.md +0 -3
  2. package/es/AppContext.js +1 -1
  3. package/es/LiteKitchenConfigurator.js +15 -25
  4. package/es/LiteRenderer.js +2 -5
  5. package/es/actions/export.js +12 -25
  6. package/es/catalog/catalog.js +5 -21
  7. package/es/components/content.js +2 -5
  8. package/es/components/export.js +6 -4
  9. package/es/components/style/export.js +2 -28
  10. package/es/components/style/form-number-input.js +22 -11
  11. package/es/components/viewer2d/group.js +4 -5
  12. package/es/components/viewer2d/item.js +4 -5
  13. package/es/components/viewer2d/layer.js +1 -1
  14. package/es/components/viewer2d/line.js +47 -17
  15. package/es/components/viewer2d/rulerX.js +0 -3
  16. package/es/components/viewer2d/rulerY.js +0 -3
  17. package/es/components/viewer2d/scene.js +1 -4
  18. package/es/components/viewer2d/state.js +1 -1
  19. package/es/components/viewer2d/viewer2d.js +43 -28
  20. package/es/components/viewer3d/viewer3d-first-person.js +0 -8
  21. package/es/components/viewer3d/viewer3d.js +0 -9
  22. package/es/devLiteRenderer.js +148 -317
  23. package/es/index.js +12 -4
  24. package/es/mocks/appliancePayload.json +27 -0
  25. package/es/mocks/cabinetPayload.json +1914 -0
  26. package/es/mocks/cabinetPayload2.json +76 -0
  27. package/es/mocks/dataBundle2.json +4 -0
  28. package/es/mocks/distancePayload.json +6 -0
  29. package/es/mocks/doorStylePayload2.json +84 -0
  30. package/es/mocks/furnishingPayload.json +23 -0
  31. package/es/mocks/itemCDSPayload.json +27 -0
  32. package/es/mocks/lightingPayload.json +23 -0
  33. package/es/mocks/mockProps.json +43 -0
  34. package/es/mocks/mockProps2.json +9 -0
  35. package/es/mocks/moldingPayload.json +19 -0
  36. package/es/mocks/projectItemsCatalog.json +133 -0
  37. package/es/mocks/rectangleShape.json +238 -0
  38. package/es/mocks/replaceCabinetPayload.json +81 -0
  39. package/es/mocks/roomShapePayload.json +5 -0
  40. package/es/useAppContext.js +8 -0
  41. package/lib/AppContext.js +1 -1
  42. package/lib/LiteKitchenConfigurator.js +15 -25
  43. package/lib/LiteRenderer.js +2 -5
  44. package/lib/actions/export.js +39 -35
  45. package/lib/catalog/catalog.js +4 -20
  46. package/lib/components/content.js +2 -5
  47. package/lib/components/export.js +26 -6
  48. package/lib/components/style/export.js +1 -105
  49. package/lib/components/style/form-number-input.js +22 -11
  50. package/lib/components/viewer2d/group.js +4 -5
  51. package/lib/components/viewer2d/item.js +4 -5
  52. package/lib/components/viewer2d/layer.js +1 -1
  53. package/lib/components/viewer2d/line.js +47 -17
  54. package/lib/components/viewer2d/rulerX.js +0 -3
  55. package/lib/components/viewer2d/rulerY.js +0 -3
  56. package/lib/components/viewer2d/scene.js +1 -4
  57. package/lib/components/viewer2d/state.js +1 -1
  58. package/lib/components/viewer2d/viewer2d.js +42 -27
  59. package/lib/components/viewer3d/viewer3d-first-person.js +0 -8
  60. package/lib/components/viewer3d/viewer3d.js +0 -9
  61. package/lib/devLiteRenderer.js +147 -316
  62. package/lib/index.js +12 -4
  63. package/lib/mocks/appliancePayload.json +27 -0
  64. package/lib/mocks/cabinetPayload.json +1914 -0
  65. package/lib/mocks/cabinetPayload2.json +76 -0
  66. package/lib/mocks/dataBundle2.json +4 -0
  67. package/lib/mocks/distancePayload.json +6 -0
  68. package/lib/mocks/doorStylePayload2.json +84 -0
  69. package/lib/mocks/furnishingPayload.json +23 -0
  70. package/lib/mocks/itemCDSPayload.json +27 -0
  71. package/lib/mocks/lightingPayload.json +23 -0
  72. package/lib/mocks/mockProps.json +43 -0
  73. package/lib/mocks/mockProps2.json +9 -0
  74. package/lib/mocks/moldingPayload.json +19 -0
  75. package/lib/mocks/projectItemsCatalog.json +133 -0
  76. package/lib/mocks/rectangleShape.json +238 -0
  77. package/lib/mocks/replaceCabinetPayload.json +81 -0
  78. package/lib/mocks/roomShapePayload.json +5 -0
  79. package/lib/useAppContext.js +16 -0
  80. package/package.json +16 -21
  81. package/es/catalog/properties/export.js +0 -21
  82. package/es/catalog/properties/property-checkbox.js +0 -68
  83. package/es/catalog/properties/property-color.js +0 -39
  84. package/es/catalog/properties/property-enum.js +0 -50
  85. package/es/catalog/properties/property-hidden.js +0 -19
  86. package/es/catalog/properties/property-lenght-measure.js +0 -100
  87. package/es/catalog/properties/property-length-measure.js +0 -84
  88. package/es/catalog/properties/property-length-measure_hole.js +0 -100
  89. package/es/catalog/properties/property-number.js +0 -48
  90. package/es/catalog/properties/property-read-only.js +0 -26
  91. package/es/catalog/properties/property-string.js +0 -48
  92. package/es/catalog/properties/property-toggle.js +0 -39
  93. package/es/catalog/properties/shared-property-style.js +0 -14
  94. package/es/components/style/button.js +0 -106
  95. package/es/components/style/cancel-button.js +0 -21
  96. package/es/components/style/content-container.js +0 -30
  97. package/es/components/style/content-title.js +0 -25
  98. package/es/components/style/delete-button.js +0 -24
  99. package/es/components/style/form-block.js +0 -20
  100. package/es/components/style/form-color-input.js +0 -26
  101. package/es/components/style/form-label.js +0 -22
  102. package/es/components/style/form-number-input_2.js +0 -200
  103. package/es/components/style/form-select.js +0 -19
  104. package/es/components/style/form-slider.js +0 -60
  105. package/es/components/style/form-submit-button.js +0 -25
  106. package/es/components/style/form-text-input.js +0 -69
  107. package/es/plugins/SVGLoader.js +0 -1414
  108. package/es/styles/export.js +0 -5
  109. package/es/styles/tabs.css +0 -40
  110. package/lib/catalog/properties/export.js +0 -81
  111. package/lib/catalog/properties/property-checkbox.js +0 -76
  112. package/lib/catalog/properties/property-color.js +0 -47
  113. package/lib/catalog/properties/property-enum.js +0 -58
  114. package/lib/catalog/properties/property-hidden.js +0 -27
  115. package/lib/catalog/properties/property-lenght-measure.js +0 -108
  116. package/lib/catalog/properties/property-length-measure.js +0 -92
  117. package/lib/catalog/properties/property-length-measure_hole.js +0 -108
  118. package/lib/catalog/properties/property-number.js +0 -56
  119. package/lib/catalog/properties/property-read-only.js +0 -34
  120. package/lib/catalog/properties/property-string.js +0 -56
  121. package/lib/catalog/properties/property-toggle.js +0 -47
  122. package/lib/catalog/properties/shared-property-style.js +0 -21
  123. package/lib/components/style/button.js +0 -115
  124. package/lib/components/style/cancel-button.js +0 -29
  125. package/lib/components/style/content-container.js +0 -38
  126. package/lib/components/style/content-title.js +0 -35
  127. package/lib/components/style/delete-button.js +0 -34
  128. package/lib/components/style/form-block.js +0 -28
  129. package/lib/components/style/form-color-input.js +0 -34
  130. package/lib/components/style/form-label.js +0 -30
  131. package/lib/components/style/form-number-input_2.js +0 -209
  132. package/lib/components/style/form-select.js +0 -29
  133. package/lib/components/style/form-slider.js +0 -68
  134. package/lib/components/style/form-submit-button.js +0 -35
  135. package/lib/components/style/form-text-input.js +0 -78
  136. package/lib/plugins/SVGLoader.js +0 -1419
  137. package/lib/styles/export.js +0 -13
  138. package/lib/styles/tabs.css +0 -40
@@ -1,68 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
4
- 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; }
5
- 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; }
6
- import React from 'react';
7
- import PropTypes from 'prop-types';
8
- import { FormLabel } from "../../components/style/export";
9
- import PropertyStyle from "./shared-property-style";
10
- import styled from 'styled-components';
11
- import { DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR, TEXT_COLOR_NEUTRAL_0 } from "../../constants";
12
- var FlipWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin: 15px 0;\n justify-content: space-between;\n"])));
13
- var FlipTitle = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: auto;\n color: ", ";\n font-family: ", ";\n font-size: 16px;\n font-weight: 600;\n line-height: 18px;\n text-align: left;\n"])), SECONDARY_PURPLE_COLOR, DEFAULT_FONT_FAMILY);
14
- var FlipDescription = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-right: auto;\n color: ", ";\n font-family: ", ";\n font-size: 13px;\n font-weight: 400;\n line-height: 18px;\n text-align: left;\n"])), TEXT_COLOR_NEUTRAL_0, DEFAULT_FONT_FAMILY);
15
- var FlipInfoWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n"])));
16
- var FlipToggle = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n position: relative;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n"])));
17
- var FlipToggleIcon = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n top: 0;\n position: absolute;\n ", "\n img {\n font-size: 1.4rem;\n box-sizing: border-box;\n border-radius: 50%;\n }\n"])), '' /* transition-duration: .3s; */);
18
- export default function PropertyCheckbox(_ref) {
19
- var value = _ref.value,
20
- onUpdate = _ref.onUpdate,
21
- configs = _ref.configs,
22
- sourceElement = _ref.sourceElement,
23
- internalState = _ref.internalState,
24
- state = _ref.state;
25
- var update = function update(val) {
26
- if (configs.hook) {
27
- return configs.hook(val, sourceElement, internalState, state).then(function (_val) {
28
- return onUpdate(_val);
29
- });
30
- }
31
- return onUpdate(val);
32
- };
33
- var activeStyle = value == 0 ? {
34
- left: 0
35
- } : {
36
- right: 0
37
- };
38
- return /*#__PURE__*/React.createElement(FlipWrapper, null, /*#__PURE__*/React.createElement(FlipInfoWrapper, null, /*#__PURE__*/React.createElement(FlipTitle, null, configs.label), configs.description && /*#__PURE__*/React.createElement(FlipDescription, null, configs.description)), /*#__PURE__*/React.createElement(FlipToggle, {
39
- style: {
40
- color: 'black'
41
- },
42
- onClick: function onClick(e) {
43
- return update(!value);
44
- }
45
- }, /*#__PURE__*/React.createElement("img", {
46
- src: "/assets/img/svg/bottombar/".concat(value != 0 ? '2d3d_toggle_active.svg' : '2d3d_toggle.svg'),
47
- style: {
48
- width: '55px',
49
- height: '30px'
50
- }
51
- }), /*#__PURE__*/React.createElement(FlipToggleIcon, {
52
- style: _objectSpread({}, activeStyle)
53
- }, /*#__PURE__*/React.createElement("img", {
54
- src: "/assets/img/svg/bottombar/".concat(value != 0 ? '2d3d_button_active.svg' : '2d3d_button.svg'),
55
- style: {
56
- width: '30px',
57
- height: '30px'
58
- }
59
- }))));
60
- }
61
- PropertyCheckbox.propTypes = {
62
- value: PropTypes.any.isRequired,
63
- onUpdate: PropTypes.func.isRequired,
64
- configs: PropTypes.object.isRequired,
65
- sourceElement: PropTypes.object,
66
- internalState: PropTypes.object,
67
- state: PropTypes.object.isRequired
68
- };
@@ -1,39 +0,0 @@
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
- };
@@ -1,50 +0,0 @@
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
- };
@@ -1,19 +0,0 @@
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
- };
@@ -1,100 +0,0 @@
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
- };
@@ -1,84 +0,0 @@
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
- };
@@ -1,100 +0,0 @@
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
- };
@@ -1,48 +0,0 @@
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
- };
@@ -1,26 +0,0 @@
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
- };
@@ -1,48 +0,0 @@
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
- };
@@ -1,39 +0,0 @@
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
- };
@@ -1,14 +0,0 @@
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;