kitchen-simulator 4.1.1-react-18 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +162 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/factories/wall-factory.js +1 -1
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +24 -11
- package/es/catalog/utils/item-loader.js +222 -213
- package/es/class/hole.js +0 -2
- package/es/class/item.js +89 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +97 -80
- package/es/components/content.js +5 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +29 -27
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +22 -52
- package/es/components/viewer2d/ruler.js +16 -11
- package/es/components/viewer2d/rulerDist.js +38 -51
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +17 -12
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/vertex.js +3 -2
- package/es/components/viewer2d/viewer2d.js +56 -87
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +255 -58
- package/es/components/viewer3d/viewer3d-first-person.js +24 -26
- package/es/components/viewer3d/viewer3d.js +103 -124
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +588 -23
- package/es/models.js +13 -8
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +3 -0
- package/es/reducers/viewer2d-reducer.js +3 -1
- package/es/reducers/viewer3d-reducer.js +3 -1
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +77 -119
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +827 -607
- package/es/utils/molding.js +459 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +161 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/factories/wall-factory.js +1 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +24 -11
- package/lib/catalog/utils/item-loader.js +219 -210
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +87 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +97 -80
- package/lib/components/content.js +5 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +29 -27
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +22 -52
- package/lib/components/viewer2d/ruler.js +15 -10
- package/lib/components/viewer2d/rulerDist.js +38 -51
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +17 -12
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/vertex.js +3 -2
- package/lib/components/viewer2d/viewer2d.js +54 -84
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +252 -55
- package/lib/components/viewer3d/viewer3d-first-person.js +24 -26
- package/lib/components/viewer3d/viewer3d.js +100 -120
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +590 -23
- package/lib/models.js +13 -8
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +3 -0
- package/lib/reducers/viewer2d-reducer.js +3 -1
- package/lib/reducers/viewer3d-reducer.js +3 -1
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +77 -119
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +827 -606
- package/lib/utils/molding.js +460 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +20 -15
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "style"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
var BASE_STYLE = {
|
|
9
|
+
display: 'block',
|
|
10
|
+
marginBottom: '2px',
|
|
11
|
+
fontSize: '12px'
|
|
12
|
+
};
|
|
13
|
+
export default function FormLabel(_ref) {
|
|
14
|
+
var children = _ref.children,
|
|
15
|
+
style = _ref.style,
|
|
16
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
return /*#__PURE__*/React.createElement("label", _extends({
|
|
18
|
+
style: _objectSpread(_objectSpread({}, BASE_STYLE), {}, {
|
|
19
|
+
style: style
|
|
20
|
+
})
|
|
21
|
+
}, rest), children);
|
|
22
|
+
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
4
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
7
|
+
var _templateObject;
|
|
9
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
10
|
import React, { Component } from 'react';
|
|
12
11
|
import PropTypes from 'prop-types';
|
|
13
12
|
import { KEYBOARD_BUTTON_CODE, TEXT_COLOR_NEUTRAL_0, SECONDARY_PURPLE_COLOR, DEFAULT_FONT_FAMILY } from "../../constants";
|
|
13
|
+
import styled from 'styled-components';
|
|
14
14
|
import { isValidNumber } from "../../utils/helper";
|
|
15
|
+
var StyledInput = styled.input(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n padding: 15px 25px 12px 0px;\n width: 120px;\n color: ", ";\n background-color: rgb(255, 255, 255);\n border: 2px solid;\n text-align: right;\n float: right;\n font-family: ", ";\n font-size: 16px;\n font-weight: 600;\n line-height: 17px;\n border-radius: 5px;\n outline: 0;\n :focus {\n border-color: ", ";\n }\n"])), TEXT_COLOR_NEUTRAL_0, DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR);
|
|
15
16
|
var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
16
17
|
function FormNumberInput(props, context) {
|
|
17
18
|
var _this;
|
|
@@ -29,14 +30,26 @@ var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
|
29
30
|
}
|
|
30
31
|
_inherits(FormNumberInput, _Component);
|
|
31
32
|
return _createClass(FormNumberInput, [{
|
|
32
|
-
key: "
|
|
33
|
-
value: function
|
|
34
|
-
if (this.
|
|
33
|
+
key: "componentDidMount",
|
|
34
|
+
value: function componentDidMount() {
|
|
35
|
+
if (this.input.current && ['width', 'length'].includes(this.props.labelName.toLowerCase())) {
|
|
36
|
+
this.input.current.focus();
|
|
37
|
+
this.input.current.select();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "componentWillReceiveProps",
|
|
42
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
43
|
+
if (this.props.value !== nextProps.value || this.props.focus !== nextProps.focus) {
|
|
35
44
|
this.setState({
|
|
36
|
-
showedValue:
|
|
37
|
-
focusOn:
|
|
45
|
+
showedValue: nextProps.value,
|
|
46
|
+
focusOn: nextProps.focus
|
|
38
47
|
});
|
|
39
48
|
}
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "componentDidUpdate",
|
|
52
|
+
value: function componentDidUpdate(prevProps, preprevState) {
|
|
40
53
|
if (this.props.value !== prevProps.value && prevProps.labelName !== 'Ceiling Height') {
|
|
41
54
|
this.input.current.focus();
|
|
42
55
|
this.input.current.select();
|
|
@@ -57,6 +70,7 @@ var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
|
57
70
|
});
|
|
58
71
|
}
|
|
59
72
|
}
|
|
73
|
+
return null;
|
|
60
74
|
}
|
|
61
75
|
}, {
|
|
62
76
|
key: "render",
|
|
@@ -90,30 +104,13 @@ var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
|
90
104
|
});
|
|
91
105
|
}
|
|
92
106
|
};
|
|
93
|
-
|
|
94
|
-
display: 'block',
|
|
95
|
-
padding: '15px 25px 12px 0px',
|
|
96
|
-
width: '120px',
|
|
97
|
-
color: TEXT_COLOR_NEUTRAL_0,
|
|
98
|
-
backgroundColor: 'rgb(255, 255, 255)',
|
|
99
|
-
border: '2px solid',
|
|
100
|
-
textAlign: 'right',
|
|
101
|
-
"float": 'right',
|
|
102
|
-
fontFamily: DEFAULT_FONT_FAMILY,
|
|
103
|
-
fontSize: '16px',
|
|
104
|
-
fontWeight: 600,
|
|
105
|
-
lineHeight: '17px',
|
|
106
|
-
borderRadius: '5px',
|
|
107
|
-
outline: 0,
|
|
108
|
-
borderColor: this.state.focusOn ? SECONDARY_PURPLE_COLOR : undefined
|
|
109
|
-
};
|
|
110
|
-
return /*#__PURE__*/React.createElement("input", {
|
|
107
|
+
return /*#__PURE__*/React.createElement(StyledInput, {
|
|
111
108
|
id: "form_number_input",
|
|
112
109
|
autoFocus: this.state.focusOn,
|
|
113
110
|
readOnly: !!this.props.disabled,
|
|
114
111
|
type: "text",
|
|
115
112
|
value: currValue,
|
|
116
|
-
style:
|
|
113
|
+
style: style,
|
|
117
114
|
onChange: function onChange(evt) {
|
|
118
115
|
_this2.context.projectActions.copyProperties('ddddd');
|
|
119
116
|
var valid = regexp.test(evt.nativeEvent.target.value);
|
|
@@ -170,6 +167,11 @@ FormNumberInput.propTypes = {
|
|
|
170
167
|
labelName: PropTypes.string,
|
|
171
168
|
isCeiling: PropTypes.string
|
|
172
169
|
};
|
|
170
|
+
FormNumberInput.contextTypes = {
|
|
171
|
+
translator: PropTypes.object.isRequired,
|
|
172
|
+
projectActions: PropTypes.object.isRequired,
|
|
173
|
+
linesActions: PropTypes.object.isRequired
|
|
174
|
+
};
|
|
173
175
|
FormNumberInput.defaultProps = {
|
|
174
176
|
value: 0,
|
|
175
177
|
style: {},
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
import React, { Component } from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import * as SharedStyle from "../../shared-style";
|
|
14
|
+
import { MdUpdate } from 'react-icons/md';
|
|
15
|
+
import { KEYBOARD_BUTTON_CODE } from "../../constants";
|
|
16
|
+
var STYLE_INPUT = {
|
|
17
|
+
display: 'block',
|
|
18
|
+
width: '100%',
|
|
19
|
+
padding: '0 2px',
|
|
20
|
+
fontSize: '13px',
|
|
21
|
+
lineHeight: '1.25',
|
|
22
|
+
color: SharedStyle.PRIMARY_COLOR.input,
|
|
23
|
+
backgroundColor: SharedStyle.COLORS.white,
|
|
24
|
+
backgroundImage: 'none',
|
|
25
|
+
border: '1px solid rgba(0,0,0,.15)',
|
|
26
|
+
outline: 'none',
|
|
27
|
+
height: '30px'
|
|
28
|
+
};
|
|
29
|
+
var confirmStyle = {
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
cursor: 'pointer',
|
|
32
|
+
width: '20px',
|
|
33
|
+
height: '20px',
|
|
34
|
+
right: '5px',
|
|
35
|
+
top: '5px',
|
|
36
|
+
backgroundColor: SharedStyle.SECONDARY_COLOR.main,
|
|
37
|
+
color: '#FFF',
|
|
38
|
+
transition: 'all 0.1s linear'
|
|
39
|
+
};
|
|
40
|
+
var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
41
|
+
function FormNumberInput(props, context) {
|
|
42
|
+
var _this;
|
|
43
|
+
_classCallCheck(this, FormNumberInput);
|
|
44
|
+
_this = _callSuper(this, FormNumberInput, [props, context]);
|
|
45
|
+
_this.state = {
|
|
46
|
+
focus: false,
|
|
47
|
+
valid: true,
|
|
48
|
+
showedValue: props.value,
|
|
49
|
+
disabled: props.disabled === true ? true : false,
|
|
50
|
+
focusOn: false
|
|
51
|
+
};
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
_inherits(FormNumberInput, _Component);
|
|
55
|
+
return _createClass(FormNumberInput, [{
|
|
56
|
+
key: "componentWillReceiveProps",
|
|
57
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
58
|
+
if (this.props.value !== nextProps.value || this.props.focus !== nextProps.focus) {
|
|
59
|
+
this.setState({
|
|
60
|
+
showedValue: nextProps.value,
|
|
61
|
+
focusOn: nextProps.focus
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (this.props.focus !== nextProps.focus) {
|
|
65
|
+
this.Input.focus();
|
|
66
|
+
this.Input.select();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
key: "render",
|
|
71
|
+
value: function render() {
|
|
72
|
+
var _this2 = this;
|
|
73
|
+
var _this$props = this.props,
|
|
74
|
+
value = _this$props.value,
|
|
75
|
+
min = _this$props.min,
|
|
76
|
+
max = _this$props.max,
|
|
77
|
+
precision = _this$props.precision,
|
|
78
|
+
onChange = _this$props.onChange,
|
|
79
|
+
onValid = _this$props.onValid,
|
|
80
|
+
onInvalid = _this$props.onInvalid,
|
|
81
|
+
style = _this$props.style,
|
|
82
|
+
placeholder = _this$props.placeholder;
|
|
83
|
+
var numericInputStyle = _objectSpread(_objectSpread({}, STYLE_INPUT), style);
|
|
84
|
+
if (this.state.focusOn) numericInputStyle.border = "1px solid ".concat(SharedStyle.SECONDARY_COLOR.main);
|
|
85
|
+
var regexp = new RegExp("^-?([0-9]+)?\\.?([0-9]{0,".concat(precision, "})?$"));
|
|
86
|
+
if (!isNaN(min) && isFinite(min) && this.state.showedValue < min) this.setState({
|
|
87
|
+
showedValue: min
|
|
88
|
+
}); // value = min;
|
|
89
|
+
if (!isNaN(max) && isFinite(max) && this.state.showedValue > max) this.setState({
|
|
90
|
+
showedValue: max
|
|
91
|
+
}); // value = max;
|
|
92
|
+
|
|
93
|
+
var currValue = regexp.test(this.state.showedValue) ? this.state.showedValue : parseFloat(this.state.showedValue).toFixed(precision);
|
|
94
|
+
var different = parseFloat(this.props.value).toFixed(precision) !== parseFloat(this.state.showedValue).toFixed(precision);
|
|
95
|
+
var saveFn = function saveFn(e) {
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
if (_this2.state.valid) {
|
|
98
|
+
var savedValue = _this2.state.showedValue !== '' && _this2.state.showedValue !== '-' ? parseFloat(_this2.state.showedValue) : 0;
|
|
99
|
+
_this2.setState({
|
|
100
|
+
showedValue: savedValue
|
|
101
|
+
});
|
|
102
|
+
onChange({
|
|
103
|
+
target: {
|
|
104
|
+
value: savedValue
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
style: {
|
|
111
|
+
position: 'relative'
|
|
112
|
+
}
|
|
113
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
114
|
+
autoFocus: this.state.focusOn,
|
|
115
|
+
readOnly: this.state.disabled,
|
|
116
|
+
type: "text",
|
|
117
|
+
value: currValue,
|
|
118
|
+
style: numericInputStyle,
|
|
119
|
+
onChange: function onChange(evt) {
|
|
120
|
+
var valid = regexp.test(evt.nativeEvent.target.value);
|
|
121
|
+
if (valid) {
|
|
122
|
+
_this2.setState({
|
|
123
|
+
showedValue: evt.nativeEvent.target.value
|
|
124
|
+
});
|
|
125
|
+
if (onValid) onValid(evt.nativeEvent);
|
|
126
|
+
} else {
|
|
127
|
+
if (onInvalid) onInvalid(evt.nativeEvent);
|
|
128
|
+
}
|
|
129
|
+
_this2.setState({
|
|
130
|
+
valid: valid
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
onFocus: function onFocus(e) {
|
|
134
|
+
return _this2.setState({
|
|
135
|
+
focusOn: true
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
onBlur: function onBlur(e) {
|
|
139
|
+
return _this2.setState({
|
|
140
|
+
focusOn: false
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
ref: function ref(ele) {
|
|
144
|
+
_this2.Input = ele;
|
|
145
|
+
},
|
|
146
|
+
onKeyDown: function onKeyDown(e) {
|
|
147
|
+
var keyCode = e.keyCode || e.which;
|
|
148
|
+
if (keyCode == KEYBOARD_BUTTON_CODE.ENTER || keyCode == KEYBOARD_BUTTON_CODE.TAB) {
|
|
149
|
+
saveFn(e);
|
|
150
|
+
_this2.Input.blur();
|
|
151
|
+
}
|
|
152
|
+
if (keyCode == KEYBOARD_BUTTON_CODE.ESC) {
|
|
153
|
+
_this2.context.projectActions.rollback();
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
placeholder: placeholder
|
|
157
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
158
|
+
onClick: function onClick(e) {
|
|
159
|
+
if (different) saveFn(e);
|
|
160
|
+
},
|
|
161
|
+
title: this.context.translator.t('Confirm'),
|
|
162
|
+
style: _objectSpread(_objectSpread({}, confirmStyle), {}, {
|
|
163
|
+
visibility: different ? 'visible' : 'hidden',
|
|
164
|
+
opacity: different ? '1' : '0'
|
|
165
|
+
})
|
|
166
|
+
}, /*#__PURE__*/React.createElement(MdUpdate, {
|
|
167
|
+
style: {
|
|
168
|
+
width: '100%',
|
|
169
|
+
height: '100%',
|
|
170
|
+
padding: '0.2em',
|
|
171
|
+
color: '#FFF'
|
|
172
|
+
}
|
|
173
|
+
})));
|
|
174
|
+
}
|
|
175
|
+
}]);
|
|
176
|
+
}(Component);
|
|
177
|
+
export { FormNumberInput as default };
|
|
178
|
+
FormNumberInput.propTypes = {
|
|
179
|
+
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
180
|
+
style: PropTypes.object,
|
|
181
|
+
onChange: PropTypes.func.isRequired,
|
|
182
|
+
onValid: PropTypes.func,
|
|
183
|
+
onInvalid: PropTypes.func,
|
|
184
|
+
min: PropTypes.number,
|
|
185
|
+
max: PropTypes.number,
|
|
186
|
+
precision: PropTypes.number,
|
|
187
|
+
placeholder: PropTypes.string
|
|
188
|
+
};
|
|
189
|
+
FormNumberInput.contextTypes = {
|
|
190
|
+
translator: PropTypes.object.isRequired,
|
|
191
|
+
projectActions: PropTypes.object.isRequired
|
|
192
|
+
};
|
|
193
|
+
FormNumberInput.defaultProps = {
|
|
194
|
+
value: 0,
|
|
195
|
+
style: {},
|
|
196
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
197
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
198
|
+
precision: 2,
|
|
199
|
+
disabled: false
|
|
200
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 = ["children", "style"];
|
|
5
|
+
var _templateObject;
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import * as SharedStyle from "../../shared-style";
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { TEXT_COLOR_NEUTRAL_3, DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR } from "../../constants";
|
|
10
|
+
var StyledSelect = styled.select(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n width: 120px;\n float: right;\n padding: 15px 10px 12px 0px;\n color: ", ";\n border: 2px solid;\n font-family: ", ";\n font-size: 12px;\n font-weight: 600;\n line-height: 17px;\n text-align: right;\n outline: none;\n border-radius: 5px;\n :hover {\n border-color: ", ";\n }\n :focus {\n border-color: ", ";\n }\n"])), TEXT_COLOR_NEUTRAL_3, DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR, SECONDARY_PURPLE_COLOR);
|
|
11
|
+
export default function FormSelect(_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
style = _ref.style,
|
|
14
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
return /*#__PURE__*/React.createElement(StyledSelect, _extends({
|
|
16
|
+
type: "text",
|
|
17
|
+
style: style
|
|
18
|
+
}, rest), children);
|
|
19
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["value", "onChange", "min", "max", "step"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import FormTextInput from "./form-text-input";
|
|
6
|
+
var sliderContainerStyle = {
|
|
7
|
+
display: 'inline-block',
|
|
8
|
+
width: '80%',
|
|
9
|
+
marginRight: '5%'
|
|
10
|
+
};
|
|
11
|
+
var sliderStyle = {
|
|
12
|
+
display: 'block',
|
|
13
|
+
width: '100%',
|
|
14
|
+
height: '30px'
|
|
15
|
+
};
|
|
16
|
+
var textContainerStyle = {
|
|
17
|
+
display: 'inline-block',
|
|
18
|
+
width: '15%',
|
|
19
|
+
"float": 'right'
|
|
20
|
+
};
|
|
21
|
+
var textStyle = {
|
|
22
|
+
height: '34px',
|
|
23
|
+
textAlign: 'center'
|
|
24
|
+
};
|
|
25
|
+
export default function FormNumberInput(_ref) {
|
|
26
|
+
var value = _ref.value,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
_ref$min = _ref.min,
|
|
29
|
+
min = _ref$min === void 0 ? 0 : _ref$min,
|
|
30
|
+
_ref$max = _ref.max,
|
|
31
|
+
max = _ref$max === void 0 ? 100 : _ref$max,
|
|
32
|
+
_ref$step = _ref.step,
|
|
33
|
+
step = _ref$step === void 0 ? 1 : _ref$step,
|
|
34
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
+
// Handle both slider and text input changes
|
|
36
|
+
var handleSliderChange = function handleSliderChange(e) {
|
|
37
|
+
onChange(Number(e.target.value));
|
|
38
|
+
};
|
|
39
|
+
var handleTextChange = function handleTextChange(e) {
|
|
40
|
+
var val = e.target.value === '' ? '' : Number(e.target.value);
|
|
41
|
+
onChange(val);
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
style: sliderContainerStyle
|
|
45
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
46
|
+
type: "range",
|
|
47
|
+
style: sliderStyle,
|
|
48
|
+
min: min,
|
|
49
|
+
max: max,
|
|
50
|
+
step: step,
|
|
51
|
+
value: value,
|
|
52
|
+
onChange: handleSliderChange
|
|
53
|
+
}, rest))), /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
style: textContainerStyle
|
|
55
|
+
}, /*#__PURE__*/React.createElement(FormTextInput, {
|
|
56
|
+
value: value,
|
|
57
|
+
onChange: handleTextChange,
|
|
58
|
+
style: textStyle
|
|
59
|
+
})));
|
|
60
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Button from "./button";
|
|
6
|
+
import * as SharedStyle from "../../shared-style";
|
|
7
|
+
var STYLE = {
|
|
8
|
+
borderColor: '#415375',
|
|
9
|
+
backgroundColor: '#415375',
|
|
10
|
+
color: SharedStyle.COLORS.white
|
|
11
|
+
};
|
|
12
|
+
var STYLE_HOVER = {
|
|
13
|
+
borderColor: '#1f3149',
|
|
14
|
+
backgroundColor: '#1f3149',
|
|
15
|
+
color: SharedStyle.COLORS.white
|
|
16
|
+
};
|
|
17
|
+
export default function FormSubmitButton(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
21
|
+
type: "submit",
|
|
22
|
+
style: STYLE,
|
|
23
|
+
styleHover: STYLE_HOVER
|
|
24
|
+
}, rest), children);
|
|
25
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
9
|
+
var _excluded = ["style"];
|
|
10
|
+
var _templateObject;
|
|
11
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
|
+
import React, { Component } from 'react';
|
|
14
|
+
import * as SharedStyle from "../../shared-style";
|
|
15
|
+
import { PROJECT_NAME_LENGTH_LIMIT, TEXT_COLOR_NEUTRAL_3, BG_COLOR_0, DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR } from "../../constants";
|
|
16
|
+
import styled from 'styled-components';
|
|
17
|
+
var StyledInput = styled.input(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n padding: 15px 10px 12px 0px;\n width: 120px;\n font-family: ", ";\n font-size: 12px;\n font-weight: 600;\n line-height: 17px;\n color: ", ";\n background-color: ", ";\n border: 2px solid;\n text-align: right;\n float: right;\n border-radius: 5px;\n outline: 0;\n :focus {\n border-color: ", ";\n }\n"])), DEFAULT_FONT_FAMILY, TEXT_COLOR_NEUTRAL_3, BG_COLOR_0, SECONDARY_PURPLE_COLOR);
|
|
18
|
+
var FormTextInput = /*#__PURE__*/function (_Component) {
|
|
19
|
+
function FormTextInput(props) {
|
|
20
|
+
var _this;
|
|
21
|
+
_classCallCheck(this, FormTextInput);
|
|
22
|
+
_this = _callSuper(this, FormTextInput, [props]);
|
|
23
|
+
_this.state = {
|
|
24
|
+
focus: false
|
|
25
|
+
};
|
|
26
|
+
_this.input = /*#__PURE__*/React.createRef(null);
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
_inherits(FormTextInput, _Component);
|
|
30
|
+
return _createClass(FormTextInput, [{
|
|
31
|
+
key: "componentDidMount",
|
|
32
|
+
value: function componentDidMount() {
|
|
33
|
+
if (this.input.current) {
|
|
34
|
+
this.input.current.select();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: "render",
|
|
39
|
+
value: function render() {
|
|
40
|
+
var _this2 = this;
|
|
41
|
+
var _this$props = this.props,
|
|
42
|
+
style = _this$props.style,
|
|
43
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
44
|
+
return /*#__PURE__*/React.createElement(StyledInput, _extends({
|
|
45
|
+
ref: this.input,
|
|
46
|
+
onFocus: function onFocus(e) {
|
|
47
|
+
return _this2.setState({
|
|
48
|
+
focus: true
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
onBlur: function onBlur(e) {
|
|
52
|
+
return _this2.setState({
|
|
53
|
+
focus: false
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
style: style
|
|
57
|
+
// autoFocus
|
|
58
|
+
,
|
|
59
|
+
type: "text"
|
|
60
|
+
}, rest, {
|
|
61
|
+
maxLength: PROJECT_NAME_LENGTH_LIMIT
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
}]);
|
|
65
|
+
}(Component);
|
|
66
|
+
export { FormTextInput as default };
|
|
67
|
+
FormTextInput.defaultProps = {
|
|
68
|
+
style: {}
|
|
69
|
+
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import If from "../../utils/react-if";
|
|
4
4
|
import * as sharedStyles from "../../shared-style";
|
|
5
|
-
import { useAppContext } from "../../useAppContext";
|
|
6
5
|
var cx = 0;
|
|
7
6
|
var cy = 0;
|
|
8
7
|
var radius = 5;
|
|
@@ -11,13 +10,12 @@ var STYLE_CIRCLE = {
|
|
|
11
10
|
stroke: sharedStyles.MATERIAL_COLORS[500].orange,
|
|
12
11
|
cursor: 'default'
|
|
13
12
|
};
|
|
14
|
-
export default function Group(_ref) {
|
|
13
|
+
export default function Group(_ref, _ref2) {
|
|
15
14
|
var layer = _ref.layer,
|
|
16
15
|
group = _ref.group,
|
|
17
16
|
scene = _ref.scene,
|
|
18
17
|
catalog = _ref.catalog;
|
|
19
|
-
var
|
|
20
|
-
translator = _useAppContext.translator;
|
|
18
|
+
var translator = _ref2.translator;
|
|
21
19
|
return /*#__PURE__*/React.createElement("g", {
|
|
22
20
|
"data-element-root": true,
|
|
23
21
|
"data-prototype": group.prototype,
|
|
@@ -49,4 +47,7 @@ Group.propTypes = {
|
|
|
49
47
|
layer: PropTypes.object.isRequired,
|
|
50
48
|
scene: PropTypes.object.isRequired,
|
|
51
49
|
catalog: PropTypes.object.isRequired
|
|
50
|
+
};
|
|
51
|
+
Group.contextTypes = {
|
|
52
|
+
translator: PropTypes.object.isRequired
|
|
52
53
|
};
|