kitchen-simulator 5.0.0-test.18 → 5.0.0-test.19

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 (179) hide show
  1. package/package.json +8 -26
  2. package/src/@history.js +3 -0
  3. package/src/CrossSignOn.jsx +94 -0
  4. package/src/KitchenConfigurator.jsx +1526 -0
  5. package/src/KitchenConfiguratorApp.jsx +1 -1
  6. package/src/_KitchenConfigurator.jsx +3 -3
  7. package/src/components/catalog-view/catalog-breadcrumb.jsx +53 -0
  8. package/src/components/catalog-view/catalog-item.jsx +229 -0
  9. package/src/components/catalog-view/catalog-list.jsx +173 -0
  10. package/src/components/catalog-view/catalog-page-item.jsx +110 -0
  11. package/src/components/catalog-view/catalog-turn-back-page-item.jsx +80 -0
  12. package/src/components/configurator/custom-configurator.jsx +77 -0
  13. package/src/components/configurator/project-configurator.jsx +120 -0
  14. package/src/components/export.js +36 -0
  15. package/src/components/firstsetting/button/styles.js +223 -0
  16. package/src/components/firstsetting/export.js +9 -0
  17. package/src/components/firstsetting/firstsetting-content-button.jsx +198 -0
  18. package/src/components/firstsetting/firstsetting-toggle-button.jsx +101 -0
  19. package/src/components/firstsetting/firstsetting.jsx +814 -0
  20. package/src/components/footerbar/button/ControlButton.jsx +43 -0
  21. package/src/components/footerbar/button/DirectionButton.jsx +54 -0
  22. package/src/components/footerbar/button/DirectionPanSpinButton.jsx +36 -0
  23. package/src/components/footerbar/button/ToggleButton.jsx +58 -0
  24. package/src/components/footerbar/button/ToggleConvertButton.jsx +48 -0
  25. package/src/components/footerbar/button/ToggleMeasureButton.jsx +33 -0
  26. package/src/components/footerbar/button/styles.js +217 -0
  27. package/src/components/footerbar/export.js +9 -0
  28. package/src/components/footerbar/footer-content-button.jsx +198 -0
  29. package/src/components/footerbar/footer-toggle-button.jsx +101 -0
  30. package/src/components/footerbar/footerbar.jsx +1103 -0
  31. package/src/components/footerbar/styles.js +263 -0
  32. package/src/components/header/button/MenuButton.jsx +46 -0
  33. package/src/components/header/button/SaveButton.jsx +54 -0
  34. package/src/components/header/button/styles.js +181 -0
  35. package/src/components/header/export.js +5 -0
  36. package/src/components/header/header.jsx +631 -0
  37. package/src/components/header/header.style.css +47 -0
  38. package/src/components/header/styles.js +320 -0
  39. package/src/components/login/Login.js +77 -0
  40. package/src/components/login/LoginForm/index.js +108 -0
  41. package/src/components/login/Register.js +82 -0
  42. package/src/components/login/RegisterForm/index.js +171 -0
  43. package/src/components/login/jwtService.js +201 -0
  44. package/src/components/login/style.css +158 -0
  45. package/src/components/login/style.scss +260 -0
  46. package/src/components/myprojects/export.js +5 -0
  47. package/src/components/myprojects/index.jsx +445 -0
  48. package/src/components/myprojects/styles.js +241 -0
  49. package/src/components/sidebar/custom-accordion.jsx +48 -0
  50. package/src/components/sidebar/export.js +15 -0
  51. package/src/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.jsx +73 -0
  52. package/src/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.jsx +101 -0
  53. package/src/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.jsx +149 -0
  54. package/src/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.jsx +316 -0
  55. package/src/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.jsx +108 -0
  56. package/src/components/sidebar/panel-element-editor/element-editor.jsx +1070 -0
  57. package/src/components/sidebar/panel-element-editor/multi-elements-editor.jsx +0 -0
  58. package/src/components/sidebar/panel-element-editor/panel-element-editor.jsx +104 -0
  59. package/src/components/sidebar/panel-element-editor/panel-multi-elements-editor.jsx +155 -0
  60. package/src/components/sidebar/panel-group-editor.jsx +272 -0
  61. package/src/components/sidebar/panel-groups.jsx +310 -0
  62. package/src/components/sidebar/panel-guides.jsx +192 -0
  63. package/src/components/sidebar/panel-layer-elements.jsx +298 -0
  64. package/src/components/sidebar/panel-layers.jsx +381 -0
  65. package/src/components/sidebar/panel.jsx +71 -0
  66. package/src/components/sidebar/sidebar.jsx +106 -0
  67. package/src/components/sidebar/toolbar-panel.jsx +139 -0
  68. package/src/components/sign/export.js +7 -0
  69. package/src/components/sign/main/index.jsx +523 -0
  70. package/src/components/sign/main/styles.js +163 -0
  71. package/src/components/toolbar/button/ControlButton.jsx +41 -0
  72. package/src/components/toolbar/button/DirectionButton.jsx +34 -0
  73. package/src/components/toolbar/button/RightButton.jsx +103 -0
  74. package/src/components/toolbar/button/ToggleButton.jsx +41 -0
  75. package/src/components/toolbar/button/index.jsx +55 -0
  76. package/src/components/toolbar/button/styles.js +127 -0
  77. package/src/components/toolbar/components/DoorStyleMenu.jsx +103 -0
  78. package/src/components/toolbar/components/Pricing.jsx +126 -0
  79. package/src/components/toolbar/components/ReviewForQuote.jsx +635 -0
  80. package/src/components/toolbar/export.js +21 -0
  81. package/src/components/toolbar/main/Alert.js +122 -0
  82. package/src/components/toolbar/main/TakePictureModal.jsx +104 -0
  83. package/src/components/toolbar/main/confirm-popup.jsx +99 -0
  84. package/src/components/toolbar/main/index.jsx +5627 -0
  85. package/src/components/toolbar/main/lShaped.json +311 -0
  86. package/src/components/toolbar/main/longNarrow.json +238 -0
  87. package/src/components/toolbar/main/myComponents.js +123 -0
  88. package/src/components/toolbar/main/oRectangle.json +220 -0
  89. package/src/components/toolbar/main/rectangle.json +238 -0
  90. package/src/components/toolbar/main/style.css +107 -0
  91. package/src/components/toolbar/main/styles.js +696 -0
  92. package/src/components/toolbar/plugin-item.jsx +123 -0
  93. package/src/components/toolbar/popup/appliance/appliance-category/index.jsx +73 -0
  94. package/src/components/toolbar/popup/appliance/choose-appliance/index.jsx +102 -0
  95. package/src/components/toolbar/popup/appliance/index.jsx +83 -0
  96. package/src/components/toolbar/popup/autosaveprompt/index.jsx +150 -0
  97. package/src/components/toolbar/popup/autosaveprompt/styles.css +64 -0
  98. package/src/components/toolbar/popup/autosaveprompt/styles.js +40 -0
  99. package/src/components/toolbar/popup/cabinet/cabinet-category/index.jsx +73 -0
  100. package/src/components/toolbar/popup/cabinet/choose-product/index.jsx +119 -0
  101. package/src/components/toolbar/popup/cabinet/index.jsx +85 -0
  102. package/src/components/toolbar/popup/doorStyle/choose-style/index.jsx +63 -0
  103. package/src/components/toolbar/popup/doorStyle/index.jsx +71 -0
  104. package/src/components/toolbar/popup/doorStyle/style-category/index.jsx +139 -0
  105. package/src/components/toolbar/popup/downloadsummary/downloadSummaryContext.js +2 -0
  106. package/src/components/toolbar/popup/downloadsummary/downloadSummaryTemp.jsx +157 -0
  107. package/src/components/toolbar/popup/downloadsummary/index.jsx +643 -0
  108. package/src/components/toolbar/popup/downloadsummary/show2D/show2DView.jsx +51 -0
  109. package/src/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.jsx +175 -0
  110. package/src/components/toolbar/popup/downloadsummary/show3D/show3DView.jsx +283 -0
  111. package/src/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.jsx +2257 -0
  112. package/src/components/toolbar/popup/downloadsummary/showCabinetInfo.js +93 -0
  113. package/src/components/toolbar/popup/downloadsummary/showElevation/showElevationView.jsx +132 -0
  114. package/src/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.jsx +2198 -0
  115. package/src/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.jsx +152 -0
  116. package/src/components/toolbar/popup/downloadsummary/showWarranty.jsx +149 -0
  117. package/src/components/toolbar/popup/downloadsummary/styles.css +177 -0
  118. package/src/components/toolbar/popup/downloadsummary/styles.js +453 -0
  119. package/src/components/toolbar/popup/finishingtouch/category/index.jsx +34 -0
  120. package/src/components/toolbar/popup/finishingtouch/index.jsx +58 -0
  121. package/src/components/toolbar/popup/finishingtouch/material-edit.jsx +112 -0
  122. package/src/components/toolbar/popup/finishingtouch/product/index.jsx +116 -0
  123. package/src/components/toolbar/popup/floorplan/choose-floor/confirm-popup.jsx +101 -0
  124. package/src/components/toolbar/popup/floorplan/choose-floor/index.jsx +254 -0
  125. package/src/components/toolbar/popup/floorplan/choose-floor/lShaped.json +311 -0
  126. package/src/components/toolbar/popup/floorplan/choose-floor/longNarrow.json +238 -0
  127. package/src/components/toolbar/popup/floorplan/choose-floor/oRectangle.json +220 -0
  128. package/src/components/toolbar/popup/floorplan/choose-floor/rectangle.json +238 -0
  129. package/src/components/toolbar/popup/floorplan/choose-floor/styles.js +86 -0
  130. package/src/components/toolbar/popup/floorplan/floor-category/index.jsx +109 -0
  131. package/src/components/toolbar/popup/floorplan/index.jsx +60 -0
  132. package/src/components/toolbar/popup/index.jsx +241 -0
  133. package/src/components/toolbar/popup/newproject/index.jsx +59 -0
  134. package/src/components/toolbar/popup/newproject/styles.css +64 -0
  135. package/src/components/toolbar/popup/newproject/styles.js +41 -0
  136. package/src/components/toolbar/popup/product/appliance.jsx +54 -0
  137. package/src/components/toolbar/popup/product/cabinetproduct.jsx +15 -0
  138. package/src/components/toolbar/popup/product/doorstyle.jsx +58 -0
  139. package/src/components/toolbar/popup/product/doorstyleproduct.jsx +47 -0
  140. package/src/components/toolbar/popup/product/floor.jsx +36 -0
  141. package/src/components/toolbar/popup/product/floorproduct.jsx +42 -0
  142. package/src/components/toolbar/popup/product/index.jsx +36 -0
  143. package/src/components/toolbar/popup/product/primary.jsx +77 -0
  144. package/src/components/toolbar/popup/product/productline.jsx +93 -0
  145. package/src/components/toolbar/popup/product/reviewItem.jsx +427 -0
  146. package/src/components/toolbar/popup/product/reviewMolding.jsx +310 -0
  147. package/src/components/toolbar/popup/product/style.css +54 -0
  148. package/src/components/toolbar/popup/product/styles.js +260 -0
  149. package/src/components/toolbar/popup/savedesign/FullPictureForm.jsx +146 -0
  150. package/src/components/toolbar/popup/savedesign/index.jsx +495 -0
  151. package/src/components/toolbar/popup/savedesign/savedesign.style.css +16 -0
  152. package/src/components/toolbar/popup/savedesign/styles.js +151 -0
  153. package/src/components/toolbar/popup/setDoorStyleOption/index.jsx +87 -0
  154. package/src/components/toolbar/popup/styles.js +909 -0
  155. package/src/components/toolbar/popup/submitforquote/AddToCartOptions.jsx +192 -0
  156. package/src/components/toolbar/popup/submitforquote/CustomerRequestsForm.jsx +96 -0
  157. package/src/components/toolbar/popup/submitforquote/SkipDesignerReview.jsx +54 -0
  158. package/src/components/toolbar/popup/submitforquote/StepDots.jsx +25 -0
  159. package/src/components/toolbar/popup/submitforquote/cart-choice.jsx +116 -0
  160. package/src/components/toolbar/popup/submitforquote/doorstyle-menus.js +38 -0
  161. package/src/components/toolbar/popup/submitforquote/index.jsx +698 -0
  162. package/src/components/toolbar/popup/submitforquote/styles.css +105 -0
  163. package/src/components/toolbar/popup/submitforquote/styles.js +294 -0
  164. package/src/components/toolbar/popup/submitprompt/index.jsx +89 -0
  165. package/src/components/toolbar/popup/submitprompt/styles.css +64 -0
  166. package/src/components/toolbar/popup/submitprompt/styles.js +42 -0
  167. package/src/components/toolbar/toolbar-button.jsx +90 -0
  168. package/src/components/toolbar/toolbar-load-button.jsx +36 -0
  169. package/src/components/toolbar/toolbar-save-button.jsx +32 -0
  170. package/src/components/wizardstep/button/styles.js +677 -0
  171. package/src/components/wizardstep/export.js +5 -0
  172. package/src/components/wizardstep/index.jsx +1372 -0
  173. package/src/components/wizardstep/styles.js +688 -0
  174. package/src/components/wizardstep/wizardstep-content-button.jsx +198 -0
  175. package/src/components/wizardstep/wizardstep-toggle-button.jsx +101 -0
  176. package/src/{_index.js → index.js} +4 -4
  177. package/src/renderer.jsx +466 -0
  178. package/src/actions/_export.js +0 -35
  179. package/src/components/_export.js +0 -11
@@ -0,0 +1,316 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import FormNumberInput from '../../../style/form-number-input';
4
+ import convert from 'convert-units';
5
+ import ConfirmPopup from './confirm-popup';
6
+ import styled from 'styled-components';
7
+ import {
8
+ DEFAULT_FONT_FAMILY,
9
+ TEXT_COLOR_NEUTRAL_0,
10
+ TEXT_COLOR_NEUTRAL_2,
11
+ TEXT_COLOR_NEUTRAL_3
12
+ } from '../../../../constants';
13
+
14
+ const NumberInputWrapper = styled.div`
15
+ display: flex;
16
+ align-items: center;
17
+ margin-top: 5px;
18
+ position: relative;
19
+ `;
20
+
21
+ const NumberInputTitle = styled.span`
22
+ font-family: ${DEFAULT_FONT_FAMILY};
23
+ font-size: 16px;
24
+ font-weight: 400;
25
+ line-height: 15px;
26
+ text-align: left;
27
+ color: ${TEXT_COLOR_NEUTRAL_0};
28
+ margin-right: auto;
29
+ `;
30
+
31
+ const NumberInputMeasure = styled.span`
32
+ font-family: ${DEFAULT_FONT_FAMILY};
33
+ font-size: 16px;
34
+ font-weight: 600;
35
+ line-height: 17px;
36
+ color: ${TEXT_COLOR_NEUTRAL_3};
37
+ position: absolute;
38
+ right: 10px;
39
+ bottom: 14px;
40
+ `;
41
+
42
+ const Left = 0;
43
+ const Right = 180;
44
+ const Back = 90;
45
+ const Front = -90;
46
+
47
+ let newX, newY;
48
+
49
+ export default function ItemAttributesEditor(
50
+ {
51
+ element,
52
+ onUpdate,
53
+ propertiesFormData,
54
+ catalog,
55
+ attributeFormData,
56
+ onConfigUpdate,
57
+ state,
58
+ internalState,
59
+ filteredProperties,
60
+ shouldOnlyShowEditorOptions = false,
61
+ ...rest
62
+ },
63
+ { translator }
64
+ ) {
65
+ let [isPopupOpen, setPopupOpen] = useState(false);
66
+ // ✅ Cache element data from attributeFormData if available
67
+ const formElement = attributeFormData.has('element')
68
+ ? attributeFormData.get('element')
69
+ : null;
70
+
71
+ const name = formElement ? formElement.get('name') : element.name;
72
+ const renderedX = formElement ? formElement.get('x') : element.x;
73
+ const renderedY = formElement ? formElement.get('y') : element.y;
74
+ const renderedR = formElement
75
+ ? formElement.get('rotation')
76
+ : element.rotation;
77
+
78
+ // ✅ Initialize distances
79
+ let distBack = null,
80
+ distFront = null,
81
+ distLeft = null,
82
+ distRight = null;
83
+
84
+ // ✅ Detect if distArray uses Immutable-style or plain array
85
+ const isImmutable = typeof element.distArray?.get === 'function';
86
+
87
+ for (let i = 0; i < 4; i++) {
88
+ const entry = isImmutable
89
+ ? element.distArray.get(i)
90
+ : element.distArray?.[i];
91
+
92
+ if (!entry) continue;
93
+
94
+ const value = isImmutable ? entry.get(0) : entry[0];
95
+ const side = isImmutable ? entry.get(1) : entry[1];
96
+
97
+ // == null checks for both null and undefined (it’s a loose equality check).
98
+ if (value == null || side == null) continue;
99
+
100
+ const inches = convert(value).from('cm').to('in');
101
+
102
+ switch (side) {
103
+ case Left:
104
+ distLeft = inches;
105
+ break;
106
+ case Right:
107
+ distRight = inches;
108
+ break;
109
+ case Back:
110
+ distBack = inches;
111
+ break;
112
+ case Front:
113
+ distFront = inches;
114
+ break;
115
+ }
116
+ }
117
+
118
+ const moveCabinet = () => {
119
+ onUpdate('pos', { x: newX, y: newY });
120
+ };
121
+
122
+ const changeDistance = (oldVal, newVal, oldRot) => {
123
+ let rotRad = ((oldRot + renderedR) / 180) * Math.PI;
124
+ let dist;
125
+ switch (oldRot) {
126
+ case Left:
127
+ dist = distRight;
128
+ break;
129
+ case Right:
130
+ dist = distLeft;
131
+ break;
132
+ case Back:
133
+ dist = distFront;
134
+ break;
135
+ case Front:
136
+ dist = distBack;
137
+ break;
138
+ default:
139
+ break;
140
+ }
141
+ newX =
142
+ renderedX +
143
+ convert((oldVal - newVal) * Math.cos(rotRad))
144
+ .from('in')
145
+ .to('cm');
146
+ newY =
147
+ renderedY +
148
+ convert((oldVal - newVal) * Math.sin(rotRad))
149
+ .from('in')
150
+ .to('cm');
151
+ if (dist + (oldVal - newVal) <= 0 || newVal < 0) {
152
+ setPopupOpen(true);
153
+ return;
154
+ }
155
+ onUpdate('pos', { x: newX, y: newY });
156
+ };
157
+
158
+ let handleConfirmLoad = value => {
159
+ setPopupOpen(value);
160
+ };
161
+
162
+ const EditorOptions = () => {
163
+ return propertiesFormData.entrySeq().map(([propertyName, data]) => {
164
+ if (catalog.categoryHasElement('Windows', element.type)) {
165
+ if (['thickness', 'width', 'height'].includes(propertyName)) {
166
+ return null;
167
+ }
168
+ }
169
+ if (catalog.categoryHasElement('Doors', element.type)) {
170
+ if (
171
+ ['altitude', 'thickness', 'width', 'height'].includes(propertyName)
172
+ ) {
173
+ return null;
174
+ }
175
+ }
176
+ if (filteredProperties) {
177
+ if (filteredProperties.includes(propertyName)) return null;
178
+ }
179
+
180
+ let catalogElement = catalog.getElement(element.type);
181
+ // if ((catalogElement.info.has_single_door === undefined || catalogElement.info.has_single_door == false) && propertyName == 'flip_doorhandle') {
182
+ // return null;
183
+ // }
184
+
185
+ let currentValue = data.get('currentValue'),
186
+ configs = data.get('configs');
187
+ let { Editor } = catalog.getPropertyType(configs.type);
188
+ return (
189
+ configs.type === 'length-measure' && (
190
+ <div style={{ position: 'relative' }} key={propertyName}>
191
+ <Editor
192
+ propertyName={propertyName}
193
+ value={currentValue}
194
+ configs={configs}
195
+ onUpdate={value => onConfigUpdate(propertyName, value)}
196
+ state={state}
197
+ sourceElement={element}
198
+ internalState={internalState}
199
+ />
200
+ <NumberInputMeasure>{unit}</NumberInputMeasure>
201
+ </div>
202
+ )
203
+ );
204
+ });
205
+ };
206
+
207
+ if (shouldOnlyShowEditorOptions) return EditorOptions();
208
+
209
+ let unit = state.getIn([
210
+ 'scene',
211
+ 'layers',
212
+ state.scene.selectedLayer,
213
+ 'unit'
214
+ ]);
215
+
216
+ return (
217
+ <div>
218
+ <ConfirmPopup
219
+ visible={isPopupOpen}
220
+ handleConfirmLoad={handleConfirmLoad}
221
+ ok={moveCabinet}
222
+ />
223
+ <NumberInputWrapper>
224
+ <NumberInputTitle>Distance Left</NumberInputTitle>
225
+ <FormNumberInput
226
+ value={distLeft && convert(distLeft).from('in').to(unit)}
227
+ disabled={distLeft ? false : true}
228
+ onChange={event => changeDistance(distLeft, event.target.value, Left)}
229
+ state={state}
230
+ precision={2}
231
+ style={{ paddingRight: '40px' }}
232
+ {...rest}
233
+ />
234
+ <NumberInputMeasure>{unit}</NumberInputMeasure>
235
+ </NumberInputWrapper>
236
+ <NumberInputWrapper>
237
+ <NumberInputTitle>Distance Right</NumberInputTitle>
238
+ <FormNumberInput
239
+ disabled={distRight ? false : true}
240
+ value={distRight && convert(distRight).from('in').to(unit)}
241
+ onChange={event =>
242
+ changeDistance(distRight, event.target.value, Right)
243
+ }
244
+ state={state}
245
+ style={{ paddingRight: '40px' }}
246
+ precision={2}
247
+ {...rest}
248
+ />
249
+ <NumberInputMeasure>{unit}</NumberInputMeasure>
250
+ </NumberInputWrapper>
251
+ <NumberInputWrapper>
252
+ <NumberInputTitle>Distance Front</NumberInputTitle>
253
+ <FormNumberInput
254
+ disabled={distFront ? false : true}
255
+ value={distFront && convert(distFront).from('in').to(unit)}
256
+ onChange={event =>
257
+ changeDistance(distFront, event.target.value, Front)
258
+ }
259
+ state={state}
260
+ style={{ paddingRight: '40px' }}
261
+ precision={2}
262
+ {...rest}
263
+ />
264
+ <NumberInputMeasure>{unit}</NumberInputMeasure>
265
+ </NumberInputWrapper>
266
+ <NumberInputWrapper>
267
+ <NumberInputTitle>Distance Back</NumberInputTitle>
268
+ <FormNumberInput
269
+ disabled={distBack ? false : true}
270
+ value={distBack && convert(distBack).from('in').to(unit)}
271
+ onChange={event => changeDistance(distBack, event.target.value, Back)}
272
+ state={state}
273
+ style={{ paddingRight: '40px' }}
274
+ precision={2}
275
+ {...rest}
276
+ />
277
+ <NumberInputMeasure>{unit}</NumberInputMeasure>
278
+ </NumberInputWrapper>
279
+ {EditorOptions()}
280
+ <NumberInputWrapper>
281
+ <NumberInputTitle>Rotation</NumberInputTitle>
282
+ <FormNumberInput
283
+ value={renderedR}
284
+ onChange={event => onUpdate('rotation', event.target.value)}
285
+ state={state}
286
+ precision={2}
287
+ {...rest}
288
+ />
289
+ <div
290
+ style={{
291
+ position: 'absolute',
292
+ fontFamily: DEFAULT_FONT_FAMILY,
293
+ fontSize: 19,
294
+ right: 15,
295
+ top: 15,
296
+ border: `1px solid ${TEXT_COLOR_NEUTRAL_2}`,
297
+ height: 5,
298
+ width: 5,
299
+ borderRadius: '50%'
300
+ }}
301
+ />
302
+ </NumberInputWrapper>
303
+ </div>
304
+ );
305
+ }
306
+
307
+ ItemAttributesEditor.propTypes = {
308
+ element: PropTypes.object.isRequired,
309
+ onUpdate: PropTypes.func.isRequired,
310
+ attributeFormData: PropTypes.object.isRequired,
311
+ state: PropTypes.object.isRequired
312
+ };
313
+
314
+ ItemAttributesEditor.contextTypes = {
315
+ translator: PropTypes.object.isRequired
316
+ };
@@ -0,0 +1,108 @@
1
+ import React, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { FormNumberInput, FormTextInput } from '../../../style/export';
4
+ import { PropertyLengthMeasure } from '../../../../catalog/properties/export';
5
+ import styled from 'styled-components';
6
+ import {
7
+ DEFAULT_FONT_FAMILY,
8
+ TEXT_COLOR_NEUTRAL_2,
9
+ TEXT_COLOR_NEUTRAL_0,
10
+ TEXT_COLOR_NEUTRAL_3
11
+ } from '../../../../constants';
12
+
13
+ const NameInputWrapper = styled.div`
14
+ display: flex;
15
+ align-items: center;
16
+ margin-top: 3px;
17
+ `;
18
+
19
+ const NameInputTitle = styled.span`
20
+ font-family: ${DEFAULT_FONT_FAMILY};
21
+ font-weight: 400;
22
+ line-height: 22px;
23
+ text-align: left;
24
+ color: ${TEXT_COLOR_NEUTRAL_0};
25
+ margin-right: auto;
26
+ `;
27
+
28
+ const NumberInputMeasure = styled.span`
29
+ font-family: ${DEFAULT_FONT_FAMILY};
30
+ font-size: 12px;
31
+ font-weight: 600;
32
+ line-height: 17px;
33
+ color: ${TEXT_COLOR_NEUTRAL_3};
34
+ position: absolute;
35
+ right: 10px;
36
+ bottom: 12px;
37
+ `;
38
+
39
+ const tableStyle = { width: '100%' };
40
+ const firstTdStyle = { width: '6em' };
41
+ const inputStyle = { textAlign: 'left' };
42
+
43
+ export default function LineAttributesEditor(
44
+ { element, onUpdate, attributeFormData, state, ...rest },
45
+ { translator }
46
+ ) {
47
+ let name = attributeFormData.has('name')
48
+ ? attributeFormData.get('name')
49
+ : element.name;
50
+ let vertexOne = attributeFormData.has('vertexOne')
51
+ ? attributeFormData.get('vertexOne')
52
+ : null;
53
+ let vertexTwo = attributeFormData.has('vertexTwo')
54
+ ? attributeFormData.get('vertexTwo')
55
+ : null;
56
+ let lineLength = attributeFormData.has('lineLength')
57
+ ? attributeFormData.get('lineLength')
58
+ : null;
59
+ let focus = attributeFormData.has('focus')
60
+ ? attributeFormData.get('focus')
61
+ : false;
62
+ let unit = state.getIn([
63
+ 'scene',
64
+ 'layers',
65
+ state.scene.selectedLayer,
66
+ 'unit'
67
+ ]);
68
+ return (
69
+ <div>
70
+ <NameInputWrapper>
71
+ <NameInputTitle style={{ fontSize: 16 }}>
72
+ {translator.t('Name')}
73
+ </NameInputTitle>
74
+ <FormTextInput
75
+ value={name}
76
+ onChange={event => onUpdate('name', event.target.value)}
77
+ />
78
+ </NameInputWrapper>
79
+ <div style={{ position: 'relative' }}>
80
+ <PropertyLengthMeasure
81
+ value={lineLength}
82
+ onUpdate={mapped => onUpdate('lineLength', mapped)}
83
+ configs={{
84
+ label: 'Length',
85
+ min: 0,
86
+ max: Infinity,
87
+ precision: 2,
88
+ focus: focus
89
+ }}
90
+ state={state}
91
+ />
92
+ <NumberInputMeasure>{unit}</NumberInputMeasure>
93
+ </div>
94
+ </div>
95
+ );
96
+ }
97
+
98
+ LineAttributesEditor.propTypes = {
99
+ element: PropTypes.object.isRequired,
100
+ onUpdate: PropTypes.func.isRequired,
101
+ onValid: PropTypes.func,
102
+ attributeFormData: PropTypes.object.isRequired,
103
+ state: PropTypes.object.isRequired
104
+ };
105
+
106
+ LineAttributesEditor.contextTypes = {
107
+ translator: PropTypes.object.isRequired
108
+ };