kitchen-simulator 5.0.0-test.17 → 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 (206) hide show
  1. package/package.json +8 -18
  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 -91
  7. package/src/components/atoms/Snackbar/index.jsx +43 -0
  8. package/src/components/atoms/radio-button/index.jsx +20 -0
  9. package/src/components/atoms/radio-button/styles.js +56 -0
  10. package/src/components/button/MainButton.jsx +157 -0
  11. package/src/components/button/ToggleMeasureButton.jsx +65 -0
  12. package/src/components/catalog-view/catalog-breadcrumb.jsx +53 -0
  13. package/src/components/catalog-view/catalog-item.jsx +229 -0
  14. package/src/components/catalog-view/catalog-list.jsx +173 -0
  15. package/src/components/catalog-view/catalog-page-item.jsx +110 -0
  16. package/src/components/catalog-view/catalog-turn-back-page-item.jsx +80 -0
  17. package/src/components/configurator/custom-configurator.jsx +77 -0
  18. package/src/components/configurator/project-configurator.jsx +120 -0
  19. package/src/components/content.jsx +136 -0
  20. package/src/components/export.js +36 -0
  21. package/src/components/firstsetting/button/styles.js +223 -0
  22. package/src/components/firstsetting/export.js +9 -0
  23. package/src/components/firstsetting/firstsetting-content-button.jsx +198 -0
  24. package/src/components/firstsetting/firstsetting-toggle-button.jsx +101 -0
  25. package/src/components/firstsetting/firstsetting.jsx +814 -0
  26. package/src/components/footerbar/button/ControlButton.jsx +43 -0
  27. package/src/components/footerbar/button/DirectionButton.jsx +54 -0
  28. package/src/components/footerbar/button/DirectionPanSpinButton.jsx +36 -0
  29. package/src/components/footerbar/button/ToggleButton.jsx +58 -0
  30. package/src/components/footerbar/button/ToggleConvertButton.jsx +48 -0
  31. package/src/components/footerbar/button/ToggleMeasureButton.jsx +33 -0
  32. package/src/components/footerbar/button/styles.js +217 -0
  33. package/src/components/footerbar/export.js +9 -0
  34. package/src/components/footerbar/footer-content-button.jsx +198 -0
  35. package/src/components/footerbar/footer-toggle-button.jsx +101 -0
  36. package/src/components/footerbar/footerbar.jsx +1103 -0
  37. package/src/components/footerbar/styles.js +263 -0
  38. package/src/components/header/button/MenuButton.jsx +46 -0
  39. package/src/components/header/button/SaveButton.jsx +54 -0
  40. package/src/components/header/button/styles.js +181 -0
  41. package/src/components/header/export.js +5 -0
  42. package/src/components/header/header.jsx +631 -0
  43. package/src/components/header/header.style.css +47 -0
  44. package/src/components/header/styles.js +320 -0
  45. package/src/components/login/Login.js +77 -0
  46. package/src/components/login/LoginForm/index.js +108 -0
  47. package/src/components/login/Register.js +82 -0
  48. package/src/components/login/RegisterForm/index.js +171 -0
  49. package/src/components/login/jwtService.js +201 -0
  50. package/src/components/login/style.css +158 -0
  51. package/src/components/login/style.scss +260 -0
  52. package/src/components/molecules/slider/index.jsx +15 -0
  53. package/src/components/molecules/slider/styles.js +0 -0
  54. package/src/components/molecules/slider/styles.scss +3 -0
  55. package/src/components/myprojects/export.js +5 -0
  56. package/src/components/myprojects/index.jsx +445 -0
  57. package/src/components/myprojects/styles.js +241 -0
  58. package/src/components/sidebar/custom-accordion.jsx +48 -0
  59. package/src/components/sidebar/export.js +15 -0
  60. package/src/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.jsx +73 -0
  61. package/src/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.jsx +101 -0
  62. package/src/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.jsx +149 -0
  63. package/src/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.jsx +316 -0
  64. package/src/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.jsx +108 -0
  65. package/src/components/sidebar/panel-element-editor/element-editor.jsx +1070 -0
  66. package/src/components/sidebar/panel-element-editor/multi-elements-editor.jsx +0 -0
  67. package/src/components/sidebar/panel-element-editor/panel-element-editor.jsx +104 -0
  68. package/src/components/sidebar/panel-element-editor/panel-multi-elements-editor.jsx +155 -0
  69. package/src/components/sidebar/panel-group-editor.jsx +272 -0
  70. package/src/components/sidebar/panel-groups.jsx +310 -0
  71. package/src/components/sidebar/panel-guides.jsx +192 -0
  72. package/src/components/sidebar/panel-layer-elements.jsx +298 -0
  73. package/src/components/sidebar/panel-layers.jsx +381 -0
  74. package/src/components/sidebar/panel.jsx +71 -0
  75. package/src/components/sidebar/sidebar.jsx +106 -0
  76. package/src/components/sidebar/toolbar-panel.jsx +139 -0
  77. package/src/components/sign/export.js +7 -0
  78. package/src/components/sign/main/index.jsx +523 -0
  79. package/src/components/sign/main/styles.js +163 -0
  80. package/src/components/style/button.jsx +95 -0
  81. package/src/components/style/cancel-button.jsx +20 -0
  82. package/src/components/style/content-container.jsx +29 -0
  83. package/src/components/style/content-title.jsx +20 -0
  84. package/src/components/style/delete-button.jsx +23 -0
  85. package/src/components/style/export.jsx +48 -0
  86. package/src/components/style/form-block.jsx +13 -0
  87. package/src/components/style/form-color-input.jsx +27 -0
  88. package/src/components/style/form-label.jsx +15 -0
  89. package/src/components/style/form-number-input.jsx +196 -0
  90. package/src/components/style/form-number-input_2.jsx +191 -0
  91. package/src/components/style/form-select.jsx +38 -0
  92. package/src/components/style/form-slider.jsx +36 -0
  93. package/src/components/style/form-submit-button.jsx +23 -0
  94. package/src/components/style/form-text-input.jsx +65 -0
  95. package/src/components/toolbar/button/ControlButton.jsx +41 -0
  96. package/src/components/toolbar/button/DirectionButton.jsx +34 -0
  97. package/src/components/toolbar/button/RightButton.jsx +103 -0
  98. package/src/components/toolbar/button/ToggleButton.jsx +41 -0
  99. package/src/components/toolbar/button/index.jsx +55 -0
  100. package/src/components/toolbar/button/styles.js +127 -0
  101. package/src/components/toolbar/components/DoorStyleMenu.jsx +103 -0
  102. package/src/components/toolbar/components/Pricing.jsx +126 -0
  103. package/src/components/toolbar/components/ReviewForQuote.jsx +635 -0
  104. package/src/components/toolbar/export.js +21 -0
  105. package/src/components/toolbar/main/Alert.js +122 -0
  106. package/src/components/toolbar/main/TakePictureModal.jsx +104 -0
  107. package/src/components/toolbar/main/confirm-popup.jsx +99 -0
  108. package/src/components/toolbar/main/index.jsx +5627 -0
  109. package/src/components/toolbar/main/lShaped.json +311 -0
  110. package/src/components/toolbar/main/longNarrow.json +238 -0
  111. package/src/components/toolbar/main/myComponents.js +123 -0
  112. package/src/components/toolbar/main/oRectangle.json +220 -0
  113. package/src/components/toolbar/main/rectangle.json +238 -0
  114. package/src/components/toolbar/main/style.css +107 -0
  115. package/src/components/toolbar/main/styles.js +696 -0
  116. package/src/components/toolbar/plugin-item.jsx +123 -0
  117. package/src/components/toolbar/popup/appliance/appliance-category/index.jsx +73 -0
  118. package/src/components/toolbar/popup/appliance/choose-appliance/index.jsx +102 -0
  119. package/src/components/toolbar/popup/appliance/index.jsx +83 -0
  120. package/src/components/toolbar/popup/autosaveprompt/index.jsx +150 -0
  121. package/src/components/toolbar/popup/autosaveprompt/styles.css +64 -0
  122. package/src/components/toolbar/popup/autosaveprompt/styles.js +40 -0
  123. package/src/components/toolbar/popup/cabinet/cabinet-category/index.jsx +73 -0
  124. package/src/components/toolbar/popup/cabinet/choose-product/index.jsx +119 -0
  125. package/src/components/toolbar/popup/cabinet/index.jsx +85 -0
  126. package/src/components/toolbar/popup/doorStyle/choose-style/index.jsx +63 -0
  127. package/src/components/toolbar/popup/doorStyle/index.jsx +71 -0
  128. package/src/components/toolbar/popup/doorStyle/style-category/index.jsx +139 -0
  129. package/src/components/toolbar/popup/downloadsummary/downloadSummaryContext.js +2 -0
  130. package/src/components/toolbar/popup/downloadsummary/downloadSummaryTemp.jsx +157 -0
  131. package/src/components/toolbar/popup/downloadsummary/index.jsx +643 -0
  132. package/src/components/toolbar/popup/downloadsummary/show2D/show2DView.jsx +51 -0
  133. package/src/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.jsx +175 -0
  134. package/src/components/toolbar/popup/downloadsummary/show3D/show3DView.jsx +283 -0
  135. package/src/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.jsx +2257 -0
  136. package/src/components/toolbar/popup/downloadsummary/showCabinetInfo.js +93 -0
  137. package/src/components/toolbar/popup/downloadsummary/showElevation/showElevationView.jsx +132 -0
  138. package/src/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.jsx +2198 -0
  139. package/src/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.jsx +152 -0
  140. package/src/components/toolbar/popup/downloadsummary/showWarranty.jsx +149 -0
  141. package/src/components/toolbar/popup/downloadsummary/styles.css +177 -0
  142. package/src/components/toolbar/popup/downloadsummary/styles.js +453 -0
  143. package/src/components/toolbar/popup/finishingtouch/category/index.jsx +34 -0
  144. package/src/components/toolbar/popup/finishingtouch/index.jsx +58 -0
  145. package/src/components/toolbar/popup/finishingtouch/material-edit.jsx +112 -0
  146. package/src/components/toolbar/popup/finishingtouch/product/index.jsx +116 -0
  147. package/src/components/toolbar/popup/floorplan/choose-floor/confirm-popup.jsx +101 -0
  148. package/src/components/toolbar/popup/floorplan/choose-floor/index.jsx +254 -0
  149. package/src/components/toolbar/popup/floorplan/choose-floor/lShaped.json +311 -0
  150. package/src/components/toolbar/popup/floorplan/choose-floor/longNarrow.json +238 -0
  151. package/src/components/toolbar/popup/floorplan/choose-floor/oRectangle.json +220 -0
  152. package/src/components/toolbar/popup/floorplan/choose-floor/rectangle.json +238 -0
  153. package/src/components/toolbar/popup/floorplan/choose-floor/styles.js +86 -0
  154. package/src/components/toolbar/popup/floorplan/floor-category/index.jsx +109 -0
  155. package/src/components/toolbar/popup/floorplan/index.jsx +60 -0
  156. package/src/components/toolbar/popup/index.jsx +241 -0
  157. package/src/components/toolbar/popup/newproject/index.jsx +59 -0
  158. package/src/components/toolbar/popup/newproject/styles.css +64 -0
  159. package/src/components/toolbar/popup/newproject/styles.js +41 -0
  160. package/src/components/toolbar/popup/product/appliance.jsx +54 -0
  161. package/src/components/toolbar/popup/product/cabinetproduct.jsx +15 -0
  162. package/src/components/toolbar/popup/product/doorstyle.jsx +58 -0
  163. package/src/components/toolbar/popup/product/doorstyleproduct.jsx +47 -0
  164. package/src/components/toolbar/popup/product/floor.jsx +36 -0
  165. package/src/components/toolbar/popup/product/floorproduct.jsx +42 -0
  166. package/src/components/toolbar/popup/product/index.jsx +36 -0
  167. package/src/components/toolbar/popup/product/primary.jsx +77 -0
  168. package/src/components/toolbar/popup/product/productline.jsx +93 -0
  169. package/src/components/toolbar/popup/product/reviewItem.jsx +427 -0
  170. package/src/components/toolbar/popup/product/reviewMolding.jsx +310 -0
  171. package/src/components/toolbar/popup/product/style.css +54 -0
  172. package/src/components/toolbar/popup/product/styles.js +260 -0
  173. package/src/components/toolbar/popup/savedesign/FullPictureForm.jsx +146 -0
  174. package/src/components/toolbar/popup/savedesign/index.jsx +495 -0
  175. package/src/components/toolbar/popup/savedesign/savedesign.style.css +16 -0
  176. package/src/components/toolbar/popup/savedesign/styles.js +151 -0
  177. package/src/components/toolbar/popup/setDoorStyleOption/index.jsx +87 -0
  178. package/src/components/toolbar/popup/styles.js +909 -0
  179. package/src/components/toolbar/popup/submitforquote/AddToCartOptions.jsx +192 -0
  180. package/src/components/toolbar/popup/submitforquote/CustomerRequestsForm.jsx +96 -0
  181. package/src/components/toolbar/popup/submitforquote/SkipDesignerReview.jsx +54 -0
  182. package/src/components/toolbar/popup/submitforquote/StepDots.jsx +25 -0
  183. package/src/components/toolbar/popup/submitforquote/cart-choice.jsx +116 -0
  184. package/src/components/toolbar/popup/submitforquote/doorstyle-menus.js +38 -0
  185. package/src/components/toolbar/popup/submitforquote/index.jsx +698 -0
  186. package/src/components/toolbar/popup/submitforquote/styles.css +105 -0
  187. package/src/components/toolbar/popup/submitforquote/styles.js +294 -0
  188. package/src/components/toolbar/popup/submitprompt/index.jsx +89 -0
  189. package/src/components/toolbar/popup/submitprompt/styles.css +64 -0
  190. package/src/components/toolbar/popup/submitprompt/styles.js +42 -0
  191. package/src/components/toolbar/toolbar-button.jsx +90 -0
  192. package/src/components/toolbar/toolbar-load-button.jsx +36 -0
  193. package/src/components/toolbar/toolbar-save-button.jsx +32 -0
  194. package/src/components/tutorial-view/Modal.jsx +584 -0
  195. package/src/components/tutorial-view/style.css +111 -0
  196. package/src/components/tutorial-view/styles.js +65 -0
  197. package/src/components/wizardstep/button/styles.js +677 -0
  198. package/src/components/wizardstep/export.js +5 -0
  199. package/src/components/wizardstep/index.jsx +1372 -0
  200. package/src/components/wizardstep/styles.js +688 -0
  201. package/src/components/wizardstep/wizardstep-content-button.jsx +198 -0
  202. package/src/components/wizardstep/wizardstep-toggle-button.jsx +101 -0
  203. package/src/{_index.js → index.js} +4 -4
  204. package/src/renderer.jsx +466 -0
  205. package/src/actions/_export.js +0 -35
  206. package/src/components/_export.js +0 -11
@@ -0,0 +1,310 @@
1
+ import React, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Panel from './panel';
4
+ import * as SharedStyle from '../../shared-style';
5
+ import { TiPlus, TiDelete } from 'react-icons/ti';
6
+ import { FaTrash, FaEye, FaLink, FaUnlink } from 'react-icons/fa';
7
+ import { Map } from 'immutable';
8
+
9
+ import {
10
+ MODE_IDLE,
11
+ MODE_2D_ZOOM_IN,
12
+ MODE_2D_ZOOM_OUT,
13
+ MODE_2D_PAN,
14
+ MODE_3D_VIEW,
15
+ MODE_3D_FIRST_PERSON,
16
+ MODE_WAITING_DRAWING_LINE,
17
+ MODE_DRAWING_LINE,
18
+ MODE_DRAWING_HOLE,
19
+ MODE_DRAWING_ITEM,
20
+ MODE_DRAGGING_LINE,
21
+ MODE_DRAGGING_VERTEX,
22
+ MODE_DRAGGING_ITEM,
23
+ MODE_DRAGGING_HOLE,
24
+ MODE_FITTING_IMAGE,
25
+ MODE_UPLOADING_IMAGE,
26
+ MODE_ROTATING_ITEM,
27
+ MODE_IDLE_3D,
28
+ MODE_DRAGGING_ITEM_3D,
29
+ MODE_ROTATING_ITEM_3D
30
+ } from '../../constants';
31
+
32
+ const VISIBILITY_MODE = {
33
+ MODE_IDLE,
34
+ MODE_2D_ZOOM_IN,
35
+ MODE_2D_ZOOM_OUT,
36
+ MODE_2D_PAN,
37
+ MODE_3D_VIEW,
38
+ MODE_3D_FIRST_PERSON,
39
+ MODE_WAITING_DRAWING_LINE,
40
+ MODE_DRAWING_LINE,
41
+ MODE_DRAWING_HOLE,
42
+ MODE_DRAWING_ITEM,
43
+ MODE_DRAGGING_LINE,
44
+ MODE_DRAGGING_VERTEX,
45
+ MODE_DRAGGING_ITEM,
46
+ MODE_DRAGGING_HOLE,
47
+ MODE_FITTING_IMAGE,
48
+ MODE_UPLOADING_IMAGE,
49
+ MODE_ROTATING_ITEM,
50
+ MODE_IDLE_3D,
51
+ MODE_DRAGGING_ITEM_3D,
52
+ MODE_ROTATING_ITEM_3D
53
+ };
54
+
55
+ const styleEditButton = {
56
+ marginLeft: '5px',
57
+ border: '0px',
58
+ background: 'none',
59
+ color: SharedStyle.COLORS.white,
60
+ fontSize: '14px',
61
+ outline: '0px'
62
+ };
63
+
64
+ const tablegroupStyle = {
65
+ width: '100%',
66
+ cursor: 'pointer',
67
+ maxHeight: '20em',
68
+ padding: '0 1em',
69
+ marginLeft: '1px'
70
+ };
71
+
72
+ const iconColStyle = { width: '2em', textAlign: 'center' };
73
+ const styleHoverColor = { color: SharedStyle.SECONDARY_COLOR.main };
74
+ const styleEditButtonHover = { ...styleEditButton, ...styleHoverColor };
75
+ const styleAddLabel = { fontSize: '10px', marginLeft: '5px' };
76
+ const styleEyeVisible = { fontSize: '1.25em' };
77
+ const styleEyeHidden = { ...styleEyeVisible, color: '#a5a1a1' };
78
+ const newLayerLableStyle = {
79
+ fontSize: '1.3em',
80
+ cursor: 'pointer',
81
+ textAlign: 'center'
82
+ };
83
+ const newLayerLableHoverStyle = { ...newLayerLableStyle, ...styleHoverColor };
84
+
85
+ export default class PanelGroups extends Component {
86
+ constructor(props, context) {
87
+ super(props, context);
88
+
89
+ this.state = {
90
+ newEmptyHover: false,
91
+ newSelectedHover: false
92
+ };
93
+ }
94
+
95
+ shouldComponentUpdate(nextProps, nextState) {
96
+ return (
97
+ this.props.groups.hashCode() !== nextProps.groups.hashCode() ||
98
+ this.props.layers.hashCode() !== nextProps.layers.hashCode() ||
99
+ this.props.mode !== nextProps.mode
100
+ );
101
+ }
102
+
103
+ render() {
104
+ let { mode, groups, layers } = this.props;
105
+
106
+ if (!VISIBILITY_MODE[mode]) return null;
107
+
108
+ return (
109
+ <Panel
110
+ name={this.context.translator.t('Groups')}
111
+ opened={groups.size > 0}
112
+ >
113
+ {groups.size ? (
114
+ <table style={tablegroupStyle}>
115
+ <thead>
116
+ <tr>
117
+ <th colSpan="4"></th>
118
+ <th>{this.context.translator.t('Elements')}</th>
119
+ <th>{this.context.translator.t('Name')}</th>
120
+ </tr>
121
+ </thead>
122
+ <tbody>
123
+ {groups.entrySeq().map(([groupID, group]) => {
124
+ let selectClick = e =>
125
+ this.context.groupsActions.selectGroup(groupID);
126
+
127
+ let swapVisibility = e => {
128
+ e.stopPropagation();
129
+ this.context.groupsActions.setGroupProperties(
130
+ groupID,
131
+ new Map({ visible: !group.get('visible') })
132
+ );
133
+ };
134
+
135
+ let chainToGroup = e => {
136
+ layers.forEach(layer => {
137
+ let layerID = layer.get('id');
138
+ let layerElements = {
139
+ lines: layer.get('lines'),
140
+ items: layer.get('items'),
141
+ holes: layer.get('holes'),
142
+ areas: layer.get('areas')
143
+ };
144
+
145
+ for (let elementPrototype in layerElements) {
146
+ let ElementList = layerElements[elementPrototype];
147
+ ElementList.filter(el => el.get('selected')).forEach(
148
+ element => {
149
+ this.context.groupsActions.addToGroup(
150
+ groupID,
151
+ layerID,
152
+ elementPrototype,
153
+ element.get('id')
154
+ );
155
+ }
156
+ );
157
+ }
158
+ });
159
+
160
+ selectClick(e);
161
+ };
162
+
163
+ let isCurrentgroup = group.get('selected');
164
+ let shouldHighlight = isCurrentgroup;
165
+ let rowStyle = !shouldHighlight ? null : styleHoverColor;
166
+
167
+ let dimension = group.get('elements').reduce((sum, layer) => {
168
+ return (
169
+ sum + layer.reduce((lSum, elProt) => lSum + elProt.size, 0)
170
+ );
171
+ }, 0);
172
+
173
+ return (
174
+ <tr key={groupID} style={rowStyle}>
175
+ <td
176
+ style={iconColStyle}
177
+ title={this.context.translator.t(
178
+ 'Toggle Group Visibility'
179
+ )}
180
+ >
181
+ <FaEye
182
+ onClick={swapVisibility}
183
+ style={
184
+ !group.get('visible')
185
+ ? styleEyeHidden
186
+ : styleEyeVisible
187
+ }
188
+ />
189
+ </td>
190
+ <td
191
+ style={iconColStyle}
192
+ title={this.context.translator.t(
193
+ 'Chain selected Elements to Group'
194
+ )}
195
+ >
196
+ <FaLink
197
+ onClick={chainToGroup}
198
+ style={
199
+ !shouldHighlight
200
+ ? styleEditButton
201
+ : styleEditButtonHover
202
+ }
203
+ />
204
+ </td>
205
+ <td
206
+ style={iconColStyle}
207
+ title={this.context.translator.t(
208
+ "Un-chain all Group's Elements and remove Group"
209
+ )}
210
+ >
211
+ <FaUnlink
212
+ onClick={e =>
213
+ this.context.groupsActions.removeGroup(groupID)
214
+ }
215
+ style={
216
+ !shouldHighlight
217
+ ? styleEditButton
218
+ : styleEditButtonHover
219
+ }
220
+ />
221
+ </td>
222
+ <td
223
+ style={iconColStyle}
224
+ title={this.context.translator.t(
225
+ 'Delete group and all Elements'
226
+ )}
227
+ >
228
+ <FaTrash
229
+ onClick={e =>
230
+ this.context.groupsActions.removeGroupAndDeleteElements(
231
+ groupID
232
+ )
233
+ }
234
+ style={
235
+ !shouldHighlight
236
+ ? styleEditButton
237
+ : styleEditButtonHover
238
+ }
239
+ />
240
+ </td>
241
+ <td
242
+ onClick={selectClick}
243
+ style={{ width: '0em', textAlign: 'center' }}
244
+ >
245
+ {dimension}
246
+ </td>
247
+ <td onClick={selectClick}>{group.get('name')}</td>
248
+ </tr>
249
+ );
250
+ })}
251
+ </tbody>
252
+ </table>
253
+ ) : null}
254
+
255
+ <table style={{ width: '100%', marginTop: '0.1em' }}>
256
+ <tbody>
257
+ <tr>
258
+ <td
259
+ style={
260
+ !this.state.newEmptyHover
261
+ ? newLayerLableStyle
262
+ : newLayerLableHoverStyle
263
+ }
264
+ onMouseOver={() => this.setState({ newEmptyHover: true })}
265
+ onMouseOut={() => this.setState({ newEmptyHover: false })}
266
+ onClick={e => this.context.groupsActions.addGroup()}
267
+ >
268
+ <TiPlus />
269
+ <b style={styleAddLabel}>
270
+ {this.context.translator.t('New Empty Group')}
271
+ </b>
272
+ </td>
273
+ <td
274
+ style={
275
+ !this.state.newSelectedHover
276
+ ? newLayerLableStyle
277
+ : newLayerLableHoverStyle
278
+ }
279
+ onMouseOver={() => this.setState({ newSelectedHover: true })}
280
+ onMouseOut={() => this.setState({ newSelectedHover: false })}
281
+ onClick={e => this.context.groupsActions.addGroupFromSelected()}
282
+ >
283
+ <TiPlus />
284
+ <b style={styleAddLabel}>
285
+ {this.context.translator.t('New Group from selected')}
286
+ </b>
287
+ </td>
288
+ </tr>
289
+ </tbody>
290
+ </table>
291
+ </Panel>
292
+ );
293
+ }
294
+ }
295
+
296
+ PanelGroups.propTypes = {
297
+ mode: PropTypes.string.isRequired,
298
+ groups: PropTypes.object.isRequired,
299
+ layers: PropTypes.object.isRequired
300
+ };
301
+
302
+ PanelGroups.contextTypes = {
303
+ catalog: PropTypes.object.isRequired,
304
+ translator: PropTypes.object.isRequired,
305
+ itemsActions: PropTypes.object.isRequired,
306
+ linesActions: PropTypes.object.isRequired,
307
+ holesActions: PropTypes.object.isRequired,
308
+ groupsActions: PropTypes.object.isRequired,
309
+ projectActions: PropTypes.object.isRequired
310
+ };
@@ -0,0 +1,192 @@
1
+ import React, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Panel from './panel';
4
+ import * as SharedStyle from '../../shared-style';
5
+ import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
6
+ import { FaPencil, FaTrash, FaTimes } from 'react-icons/fa';
7
+ import { FormNumberInput } from '../../components/style/export';
8
+
9
+ const tabStyle = { margin: '1em' };
10
+
11
+ const iconStyle = {
12
+ fontSize: '14px',
13
+ margin: '2px',
14
+ cursor: 'pointer'
15
+ };
16
+
17
+ const addGuideStyle = {
18
+ cursor: 'pointer',
19
+ height: '2em'
20
+ };
21
+
22
+ const tableTabStyle = {
23
+ width: '100%',
24
+ textAlign: 'center'
25
+ };
26
+
27
+ export default class PanelGuides extends Component {
28
+ constructor(props, context) {
29
+ super(props, context);
30
+
31
+ this.state = {
32
+ addHGVisible: true,
33
+ addVGVisible: true,
34
+ addCGVisible: true
35
+ };
36
+ }
37
+
38
+ shouldComponentUpdate(nextProps, nextState) {
39
+ return (
40
+ this.state.addHGVisible !== nextState.addHGVisible ||
41
+ this.state.addVGVisible !== nextState.addVGVisible ||
42
+ this.state.addCGVisible !== nextState.addCGVisible ||
43
+ this.props.state.getIn(['scene', 'guides']).hashCode() !==
44
+ nextProps.state.getIn(['scene', 'guides']).hashCode()
45
+ );
46
+ }
47
+
48
+ render() {
49
+ let { state } = this.props;
50
+ let { projectActions, translator } = this.context;
51
+ let { guides } = state.scene;
52
+
53
+ return (
54
+ <Panel name={translator.t('Guides')}>
55
+ <Tabs id="guidesTabs" style={tabStyle}>
56
+ <TabList>
57
+ <Tab>{translator.t('Horizontal')}</Tab>
58
+ <Tab>{translator.t('Vertical')}</Tab>
59
+ {/*<Tab>{translator.t('Circular')}</Tab>*/}
60
+ </TabList>
61
+
62
+ <TabPanel>
63
+ <table style={tableTabStyle}>
64
+ <tbody>
65
+ {guides
66
+ .get('horizontal')
67
+ .entrySeq()
68
+ .map(([hgKey, hgVal], ind) => {
69
+ return (
70
+ <tr key={hgKey}>
71
+ <td style={{ width: '2em' }}>{ind + 1}</td>
72
+ <td>{hgVal}</td>
73
+ <td style={{ width: '5em' }}>
74
+ {/*<FaPencil style={iconStyle} />*/}
75
+ <FaTrash
76
+ style={iconStyle}
77
+ onClick={e =>
78
+ projectActions.removeHorizontalGuide(hgKey)
79
+ }
80
+ />
81
+ </td>
82
+ </tr>
83
+ );
84
+ })}
85
+ {this.state.addHGVisible ? (
86
+ <tr>
87
+ <td
88
+ colSpan="3"
89
+ style={addGuideStyle}
90
+ onClick={e => this.setState({ addHGVisible: false })}
91
+ >
92
+ {translator.t('+ Add Horizontal Giude')}
93
+ </td>
94
+ </tr>
95
+ ) : (
96
+ <tr>
97
+ <td colSpan="2">
98
+ <FormNumberInput
99
+ value={0}
100
+ onChange={e => {
101
+ projectActions.addHorizontalGuide(e.target.value);
102
+ return this.setState({ addHGVisible: true });
103
+ }}
104
+ min={0}
105
+ max={this.props.state.getIn(['scene', 'height'])}
106
+ />
107
+ </td>
108
+ <td>
109
+ <FaTimes
110
+ style={iconStyle}
111
+ onClick={e => this.setState({ addHGVisible: true })}
112
+ />
113
+ </td>
114
+ </tr>
115
+ )}
116
+ </tbody>
117
+ </table>
118
+ </TabPanel>
119
+ <TabPanel>
120
+ <table style={tableTabStyle}>
121
+ <tbody>
122
+ {guides
123
+ .get('vertical')
124
+ .entrySeq()
125
+ .map(([hgKey, hgVal], ind) => {
126
+ return (
127
+ <tr key={hgKey}>
128
+ <td style={{ width: '2em' }}>{ind + 1}</td>
129
+ <td>{hgVal}</td>
130
+ <td style={{ width: '5em' }}>
131
+ {/*<FaPencil style={iconStyle} />*/}
132
+ <FaTrash
133
+ style={iconStyle}
134
+ onClick={e =>
135
+ projectActions.removeVerticalGuide(hgKey)
136
+ }
137
+ />
138
+ </td>
139
+ </tr>
140
+ );
141
+ })}
142
+ {this.state.addVGVisible ? (
143
+ <tr>
144
+ <td
145
+ colSpan="3"
146
+ style={addGuideStyle}
147
+ onClick={e => this.setState({ addVGVisible: false })}
148
+ >
149
+ {translator.t('+ Add Vertical Giude')}
150
+ </td>
151
+ </tr>
152
+ ) : (
153
+ <tr>
154
+ <td colSpan="2">
155
+ <FormNumberInput
156
+ value={0}
157
+ onChange={e => {
158
+ projectActions.addVerticalGuide(e.target.value);
159
+ return this.setState({ addVGVisible: true });
160
+ }}
161
+ min={0}
162
+ max={this.props.state.getIn(['scene', 'height'])}
163
+ />
164
+ </td>
165
+ <td>
166
+ <FaTimes
167
+ style={iconStyle}
168
+ onClick={e => this.setState({ addVGVisible: true })}
169
+ />
170
+ </td>
171
+ </tr>
172
+ )}
173
+ </tbody>
174
+ </table>
175
+ </TabPanel>
176
+ {/*<TabPanel>
177
+ <b>TODO Circular Giudes</b>
178
+ </TabPanel>*/}
179
+ </Tabs>
180
+ </Panel>
181
+ );
182
+ }
183
+ }
184
+
185
+ PanelGuides.propTypes = {
186
+ state: PropTypes.object.isRequired
187
+ };
188
+
189
+ PanelGuides.contextTypes = {
190
+ translator: PropTypes.object.isRequired,
191
+ projectActions: PropTypes.object.isRequired
192
+ };