kitchen-simulator 1.1.1-test.49 → 1.1.1-test.50
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/es/@history.js +2 -0
- package/es/AppContext.js +3 -0
- package/es/KitchenConfigurator.js +645 -0
- package/es/KitchenConfiguratorApp.js +480 -0
- package/es/actions/area-actions.js +14 -0
- package/es/actions/export.js +23 -0
- package/es/actions/groups-actions.js +89 -0
- package/es/actions/holes-actions.js +119 -0
- package/es/actions/items-actions.js +313 -0
- package/es/actions/lines-actions.js +81 -0
- package/es/actions/project-actions.js +281 -0
- package/es/actions/scene-actions.js +33 -0
- package/es/actions/vertices-actions.js +27 -0
- package/es/actions/viewer2d-actions.js +58 -0
- package/es/actions/viewer3d-actions.js +23 -0
- package/es/catalog/areas/area/planner-element.js +40 -0
- package/es/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
- package/es/catalog/areas/area/textures/grass.jpg +0 -0
- package/es/catalog/areas/area/textures/parquet.jpg +0 -0
- package/es/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
- package/es/catalog/areas/area/textures/tile1.jpg +0 -0
- package/es/catalog/catalog.js +277 -0
- package/es/catalog/envMap/nx.hdr +0 -0
- package/es/catalog/envMap/ny.hdr +0 -0
- package/es/catalog/envMap/nz.hdr +0 -0
- package/es/catalog/envMap/px.hdr +0 -0
- package/es/catalog/envMap/py.hdr +0 -0
- package/es/catalog/envMap/pz.hdr +0 -0
- package/es/catalog/factories/area-factory-3d.js +181 -0
- package/es/catalog/factories/area-factory.js +81 -0
- package/es/catalog/factories/export.js +7 -0
- package/es/catalog/factories/wall-factory-3d.js +202 -0
- package/es/catalog/factories/wall-factory.js +268 -0
- package/es/catalog/holes/door-closet/planner-element.js +222 -0
- package/es/catalog/holes/door-double/door_double.png +0 -0
- package/es/catalog/holes/door-double/planner-element.js +315 -0
- package/es/catalog/holes/door-exterior/planner-element.js +215 -0
- package/es/catalog/holes/door-interior/planner-element.js +227 -0
- package/es/catalog/holes/door-panic/panicDoor.png +0 -0
- package/es/catalog/holes/door-panic/planner-element.js +503 -0
- package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
- package/es/catalog/holes/door-panic-double/planner-element.js +463 -0
- package/es/catalog/holes/door-sliding/planner-element.js +225 -0
- package/es/catalog/holes/doorway-framed/planner-element.js +145 -0
- package/es/catalog/holes/doorway-frameless/planner-element.js +104 -0
- package/es/catalog/holes/export.js +13 -0
- package/es/catalog/holes/gate/gate.jpg +0 -0
- package/es/catalog/holes/window-clear/planner-element.js +166 -0
- package/es/catalog/holes/window-clear/texture.png +0 -0
- package/es/catalog/holes/window-cross/planner-element.js +165 -0
- package/es/catalog/holes/window-cross/texture.png +0 -0
- package/es/catalog/holes/window-double-hung/planner-element.js +303 -0
- package/es/catalog/holes/window-double-hung/texture.png +0 -0
- package/es/catalog/holes/window-vertical/planner-element.js +276 -0
- package/es/catalog/holes/window-vertical/texture.png +0 -0
- package/es/catalog/lines/wall/planner-element.js +70 -0
- package/es/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster.jpg +0 -0
- package/es/catalog/lines/wall/wall.png +0 -0
- package/es/catalog/molding/molding-dcm/planner-element.js +28 -0
- package/es/catalog/molding/molding-dcm/texture.png +0 -0
- package/es/catalog/molding/molding-fbm/planner-element.js +28 -0
- package/es/catalog/molding/molding-fbm/texture.png +0 -0
- package/es/catalog/molding/molding-lrm/planner-element.js +28 -0
- package/es/catalog/molding/molding-lrm/texture.png +0 -0
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +116 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +97 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +101 -0
- package/es/catalog/properties/property-length-measure.js +134 -0
- package/es/catalog/properties/property-length-measure_hole.js +101 -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/FuseUtils.js +82 -0
- package/es/catalog/utils/exporter.js +148 -0
- package/es/catalog/utils/geom-utils.js +189 -0
- package/es/catalog/utils/item-loader.js +1521 -0
- package/es/catalog/utils/load-obj.js +91 -0
- package/es/catalog/utils/mtl-loader.js +358 -0
- package/es/catalog/utils/obj-loader.js +477 -0
- package/es/class/FuseUtils.js +82 -0
- package/es/class/area.js +145 -0
- package/es/class/export.js +24 -0
- package/es/class/group.js +440 -0
- package/es/class/guide.js +62 -0
- package/es/class/hole.js +929 -0
- package/es/class/item.js +1883 -0
- package/es/class/layer.js +667 -0
- package/es/class/line.js +1180 -0
- package/es/class/project.js +793 -0
- package/es/class/vertex.js +202 -0
- package/es/components/content.js +107 -0
- package/es/components/disclaimer/disclaimer.js +97 -0
- package/es/components/export.js +9 -0
- package/es/components/style/button.js +113 -0
- package/es/components/style/cancel-button.js +22 -0
- package/es/components/style/content-container.js +33 -0
- package/es/components/style/content-title.js +29 -0
- package/es/components/style/delete-button.js +25 -0
- package/es/components/style/export.js +31 -0
- package/es/components/style/form-block.js +24 -0
- package/es/components/style/form-color-input.js +27 -0
- package/es/components/style/form-label.js +26 -0
- package/es/components/style/form-number-input.js +213 -0
- package/es/components/style/form-number-input_2.js +206 -0
- package/es/components/style/form-select.js +68 -0
- package/es/components/style/form-slider.js +61 -0
- package/es/components/style/form-submit-button.js +26 -0
- package/es/components/style/form-text-input.js +95 -0
- package/es/components/viewer2d/area.js +81 -0
- package/es/components/viewer2d/export.js +31 -0
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +37 -0
- package/es/components/viewer2d/grids/grid-streak.js +37 -0
- package/es/components/viewer2d/grids/grid-vertical-streak.js +37 -0
- package/es/components/viewer2d/grids/grids.js +35 -0
- package/es/components/viewer2d/group.js +53 -0
- package/es/components/viewer2d/item.js +513 -0
- package/es/components/viewer2d/layer.js +164 -0
- package/es/components/viewer2d/line.js +882 -0
- package/es/components/viewer2d/ruler.js +100 -0
- package/es/components/viewer2d/rulerDist.js +146 -0
- package/es/components/viewer2d/rulerX.js +151 -0
- package/es/components/viewer2d/rulerY.js +153 -0
- package/es/components/viewer2d/scene.js +140 -0
- package/es/components/viewer2d/snap.js +74 -0
- package/es/components/viewer2d/state.js +78 -0
- package/es/components/viewer2d/utils.js +198 -0
- package/es/components/viewer2d/vertex.js +65 -0
- package/es/components/viewer2d/viewer2d.js +1398 -0
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +2592 -0
- package/es/components/viewer3d/dcm.js +401 -0
- package/es/components/viewer3d/fbm.js +414 -0
- package/es/components/viewer3d/front3D.js +66 -0
- package/es/components/viewer3d/grid-creator.js +25 -0
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +36 -0
- package/es/components/viewer3d/grids/grid-streak.js +27 -0
- package/es/components/viewer3d/grids/grid-vertical-streak.js +36 -0
- package/es/components/viewer3d/libs/first-person-controls.js +67 -0
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1281 -0
- package/es/components/viewer3d/libs/mtl-loader.js +357 -0
- package/es/components/viewer3d/libs/obj-loader.js +462 -0
- package/es/components/viewer3d/libs/orbit-controls.js +699 -0
- package/es/components/viewer3d/libs/pointer-lock-controls.js +46 -0
- package/es/components/viewer3d/lrm.js +305 -0
- package/es/components/viewer3d/model.js +708 -0
- package/es/components/viewer3d/pointer-lock-navigation.js +115 -0
- package/es/components/viewer3d/ruler-utils/itemRect.js +61 -0
- package/es/components/viewer3d/ruler-utils/layer3D.js +495 -0
- package/es/components/viewer3d/ruler-utils/ruler3D.js +227 -0
- package/es/components/viewer3d/ruler-utils/scene3D.js +60 -0
- package/es/components/viewer3d/ruler-utils/state3D.js +18 -0
- package/es/components/viewer3d/scene-creator.js +3608 -0
- package/es/components/viewer3d/three-memory-cleaner.js +51 -0
- package/es/components/viewer3d/viewer3d-first-person.js +315 -0
- package/es/components/viewer3d/viewer3d.js +2527 -0
- package/es/constants.js +636 -0
- package/es/index.js +16 -0
- package/es/models.js +510 -0
- package/es/plugins/SVGLoader.js +1412 -0
- package/es/plugins/autosave.js +33 -0
- package/es/plugins/console-debugger.js +37 -0
- package/es/plugins/export.js +9 -0
- package/es/plugins/keyboard.js +101 -0
- package/es/reducers/areas-reducer.js +12 -0
- package/es/reducers/export.js +25 -0
- package/es/reducers/groups-reducer.js +38 -0
- package/es/reducers/holes-reducer.js +62 -0
- package/es/reducers/items-reducer.js +140 -0
- package/es/reducers/lines-reducer.js +45 -0
- package/es/reducers/project-reducer.js +129 -0
- package/es/reducers/reducer.js +19 -0
- package/es/reducers/scene-reducer.js +28 -0
- package/es/reducers/user-reducer.js +40 -0
- package/es/reducers/vertices-reducer.js +19 -0
- package/es/reducers/viewer2d-reducer.js +75 -0
- package/es/reducers/viewer3d-reducer.js +56 -0
- package/es/shared-style.js +66 -0
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/translator/en.js +104 -0
- package/es/translator/it.js +79 -0
- package/es/translator/ru.js +79 -0
- package/es/translator/translator.js +84 -0
- package/es/utils/browser.js +33 -0
- package/es/utils/email-validator.js +4 -0
- package/es/utils/export.js +25 -0
- package/es/utils/geometry.js +2420 -0
- package/es/utils/get-edges-of-subgraphs.js +27 -0
- package/es/utils/graph-cycles.js +237 -0
- package/es/utils/graph-inner-cycles.js +46 -0
- package/es/utils/graph.js +150 -0
- package/es/utils/helper.js +268 -0
- package/es/utils/history.js +29 -0
- package/es/utils/id-broker.js +19 -0
- package/es/utils/logger.js +8 -0
- package/es/utils/math.js +50 -0
- package/es/utils/molding.js +871 -0
- package/es/utils/name-generator.js +18 -0
- package/es/utils/objects-utils.js +50 -0
- package/es/utils/phone-validator.js +4 -0
- package/es/utils/process-black-list.js +18 -0
- package/es/utils/react-if.js +18 -0
- package/es/utils/snap-scene.js +99 -0
- package/es/utils/snap.js +237 -0
- package/es/utils/summarizeCart.js +24 -0
- package/es/utils/threeCSG.es6.js +498 -0
- package/es/version.js +2 -0
- package/lib/catalog/properties/property-string.js +55 -0
- package/lib/catalog/properties/property-toggle.js +46 -0
- package/lib/catalog/properties/shared-property-style.js +20 -0
- package/lib/catalog/utils/FuseUtils.js +88 -0
- package/lib/catalog/utils/exporter.js +155 -0
- package/lib/catalog/utils/geom-utils.js +205 -0
- package/lib/catalog/utils/item-loader.js +1533 -0
- package/lib/catalog/utils/load-obj.js +99 -0
- package/lib/catalog/utils/mtl-loader.js +363 -0
- package/lib/catalog/utils/obj-loader.js +482 -0
- package/lib/class/FuseUtils.js +88 -0
- package/lib/class/area.js +150 -0
- package/lib/class/export.js +96 -0
- package/lib/class/group.js +445 -0
- package/lib/class/guide.js +67 -0
- package/lib/class/hole.js +934 -0
- package/lib/class/item.js +1889 -0
- package/lib/class/layer.js +672 -0
- package/lib/class/line.js +1186 -0
- package/lib/class/project.js +799 -0
- package/lib/class/vertex.js +207 -0
- package/lib/components/content.js +116 -0
- package/lib/components/disclaimer/disclaimer.js +105 -0
- package/lib/components/export.js +33 -0
- package/lib/components/style/button.js +120 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +40 -0
- package/lib/components/style/content-title.js +37 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +121 -0
- package/lib/components/style/form-block.js +31 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +33 -0
- package/lib/components/style/form-number-input.js +220 -0
- package/lib/components/style/form-number-input_2.js +213 -0
- package/lib/components/style/form-select.js +75 -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 +101 -0
- package/lib/components/viewer2d/area.js +88 -0
- package/lib/components/viewer2d/export.js +121 -0
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +44 -0
- package/lib/components/viewer2d/grids/grid-streak.js +44 -0
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +44 -0
- package/lib/components/viewer2d/grids/grids.js +44 -0
- package/lib/components/viewer2d/group.js +62 -0
- package/lib/components/viewer2d/item.js +521 -0
- package/lib/components/viewer2d/layer.js +171 -0
- package/lib/components/viewer2d/line.js +892 -0
- package/lib/components/viewer2d/ruler.js +107 -0
- package/lib/components/viewer2d/rulerDist.js +153 -0
- package/lib/components/viewer2d/rulerX.js +158 -0
- package/lib/components/viewer2d/rulerY.js +160 -0
- package/lib/components/viewer2d/scene.js +147 -0
- package/lib/components/viewer2d/snap.js +83 -0
- package/lib/components/viewer2d/state.js +87 -0
- package/lib/components/viewer2d/utils.js +210 -0
- package/lib/components/viewer2d/vertex.js +74 -0
- package/lib/components/viewer2d/viewer2d.js +1405 -0
- package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +2597 -0
- package/lib/components/viewer3d/dcm.js +407 -0
- package/lib/components/viewer3d/fbm.js +420 -0
- package/lib/components/viewer3d/front3D.js +75 -0
- package/lib/components/viewer3d/grid-creator.js +34 -0
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +44 -0
- package/lib/components/viewer3d/grids/grid-streak.js +35 -0
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +44 -0
- package/lib/components/viewer3d/libs/first-person-controls.js +74 -0
- package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js +1287 -0
- package/lib/components/viewer3d/libs/mtl-loader.js +363 -0
- package/lib/components/viewer3d/libs/obj-loader.js +468 -0
- package/lib/components/viewer3d/libs/orbit-controls.js +705 -0
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +52 -0
- package/lib/components/viewer3d/lrm.js +311 -0
- package/lib/components/viewer3d/model.js +714 -0
- package/lib/components/viewer3d/pointer-lock-navigation.js +122 -0
- package/lib/components/viewer3d/ruler-utils/itemRect.js +68 -0
- package/lib/components/viewer3d/ruler-utils/layer3D.js +502 -0
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +234 -0
- package/lib/components/viewer3d/ruler-utils/scene3D.js +68 -0
- package/lib/components/viewer3d/ruler-utils/state3D.js +25 -0
- package/lib/components/viewer3d/scene-creator.js +3642 -0
- package/lib/components/viewer3d/three-memory-cleaner.js +60 -0
- package/lib/components/viewer3d/viewer3d-first-person.js +320 -0
- package/lib/components/viewer3d/viewer3d.js +2532 -0
- package/lib/constants.js +645 -0
- package/lib/index.js +96 -0
- package/lib/models.js +517 -0
- package/lib/plugins/SVGLoader.js +1417 -0
- package/lib/plugins/autosave.js +39 -0
- package/lib/plugins/console-debugger.js +44 -0
- package/lib/plugins/export.js +33 -0
- package/lib/plugins/keyboard.js +107 -0
- package/lib/reducers/areas-reducer.js +18 -0
- package/lib/reducers/export.js +97 -0
- package/lib/reducers/groups-reducer.js +44 -0
- package/lib/reducers/holes-reducer.js +68 -0
- package/lib/reducers/items-reducer.js +146 -0
- package/lib/reducers/lines-reducer.js +51 -0
- package/lib/reducers/project-reducer.js +135 -0
- package/lib/reducers/reducer.js +26 -0
- package/lib/reducers/scene-reducer.js +34 -0
- package/lib/reducers/user-reducer.js +46 -0
- package/lib/reducers/vertices-reducer.js +25 -0
- package/lib/reducers/viewer2d-reducer.js +82 -0
- package/lib/reducers/viewer3d-reducer.js +63 -0
- package/lib/shared-style.js +72 -0
- package/lib/styles/export.js +13 -0
- package/lib/translator/en.js +110 -0
- package/lib/translator/it.js +85 -0
- package/lib/translator/ru.js +85 -0
- package/lib/translator/translator.js +90 -0
- package/lib/utils/browser.js +40 -0
- package/lib/utils/email-validator.js +10 -0
- package/lib/utils/export.js +56 -0
- package/lib/utils/geometry.js +2516 -0
- package/lib/utils/get-edges-of-subgraphs.js +34 -0
- package/lib/utils/graph-cycles.js +240 -0
- package/lib/utils/graph-inner-cycles.js +54 -0
- package/lib/utils/graph.js +157 -0
- package/lib/utils/helper.js +291 -0
- package/lib/utils/history.js +36 -0
- package/lib/utils/id-broker.js +25 -0
- package/lib/utils/logger.js +14 -0
- package/lib/utils/math.js +57 -0
- package/lib/utils/molding.js +895 -0
- package/lib/utils/name-generator.js +23 -0
- package/lib/utils/objects-utils.js +60 -0
- package/lib/utils/phone-validator.js +10 -0
- package/lib/utils/process-black-list.js +24 -0
- package/lib/utils/react-if.js +24 -0
- package/lib/utils/snap-scene.js +105 -0
- package/lib/utils/snap.js +249 -0
- package/lib/utils/summarizeCart.js +30 -0
- package/lib/utils/threeCSG.es6.js +503 -0
- package/lib/version.js +8 -0
- package/package.json +3 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Button from "./button";
|
|
2
|
+
import CancelButton from "./cancel-button";
|
|
3
|
+
import ContentContainer from "./content-container";
|
|
4
|
+
import ContentTitle from "./content-title";
|
|
5
|
+
import DeleteButton from "./delete-button";
|
|
6
|
+
import FormBlock from "./form-block";
|
|
7
|
+
import FormColorInput from "./form-color-input";
|
|
8
|
+
import FormLabel from "./form-label";
|
|
9
|
+
import FormNumberInput from "./form-number-input";
|
|
10
|
+
import FormSelect from "./form-select";
|
|
11
|
+
import FormSlider from "./form-slider";
|
|
12
|
+
import FormSubmitButton from "./form-submit-button";
|
|
13
|
+
import FormTextInput from "./form-text-input";
|
|
14
|
+
import FormNumberInput2 from "./form-number-input_2";
|
|
15
|
+
export { Button, CancelButton, ContentContainer, ContentTitle, DeleteButton, FormBlock, FormColorInput, FormLabel, FormNumberInput, FormSelect, FormSlider, FormSubmitButton, FormTextInput, FormNumberInput2 };
|
|
16
|
+
export default {
|
|
17
|
+
Button: Button,
|
|
18
|
+
CancelButton: CancelButton,
|
|
19
|
+
ContentContainer: ContentContainer,
|
|
20
|
+
ContentTitle: ContentTitle,
|
|
21
|
+
DeleteButton: DeleteButton,
|
|
22
|
+
FormBlock: FormBlock,
|
|
23
|
+
FormColorInput: FormColorInput,
|
|
24
|
+
FormLabel: FormLabel,
|
|
25
|
+
FormNumberInput: FormNumberInput,
|
|
26
|
+
FormSelect: FormSelect,
|
|
27
|
+
FormSlider: FormSlider,
|
|
28
|
+
FormSubmitButton: FormSubmitButton,
|
|
29
|
+
FormTextInput: FormTextInput,
|
|
30
|
+
FormNumberInput2: FormNumberInput2
|
|
31
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["children", "style"];
|
|
3
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
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
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
+
import React from 'react';
|
|
12
|
+
var BASE_STYLE = {
|
|
13
|
+
marginBottom: '16px'
|
|
14
|
+
};
|
|
15
|
+
export default function FormBlock(_ref) {
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
style = _ref.style,
|
|
18
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
20
|
+
style: _objectSpread(_objectSpread({}, BASE_STYLE), {}, {
|
|
21
|
+
style: style
|
|
22
|
+
})
|
|
23
|
+
}, rest), children);
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var _excluded = ["onChange"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import FormTextInput from "./form-text-input";
|
|
7
|
+
var STYLE = {
|
|
8
|
+
padding: 0,
|
|
9
|
+
border: 0
|
|
10
|
+
};
|
|
11
|
+
var EREG_NUMBER = /^.*$/;
|
|
12
|
+
export default function FormColorInput(_ref) {
|
|
13
|
+
var onChange = _ref.onChange,
|
|
14
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
var onChangeCustom = function onChangeCustom(event) {
|
|
16
|
+
var value = event.target.value;
|
|
17
|
+
if (EREG_NUMBER.test(value)) {
|
|
18
|
+
onChange(event);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/React.createElement(FormTextInput, _extends({
|
|
22
|
+
type: "color",
|
|
23
|
+
style: STYLE,
|
|
24
|
+
onChange: onChangeCustom,
|
|
25
|
+
autoComplete: "off"
|
|
26
|
+
}, rest));
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["children", "style"];
|
|
3
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
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
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
+
import React from 'react';
|
|
12
|
+
var BASE_STYLE = {
|
|
13
|
+
display: 'block',
|
|
14
|
+
marginBottom: '2px',
|
|
15
|
+
fontSize: '12px'
|
|
16
|
+
};
|
|
17
|
+
export default function FormLabel(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
style = _ref.style,
|
|
20
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
return /*#__PURE__*/React.createElement("label", _extends({
|
|
22
|
+
style: _objectSpread(_objectSpread({}, BASE_STYLE), {}, {
|
|
23
|
+
style: style
|
|
24
|
+
})
|
|
25
|
+
}, rest), children);
|
|
26
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
13
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
15
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
16
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
17
|
+
import React, { Component } from 'react';
|
|
18
|
+
import PropTypes from 'prop-types';
|
|
19
|
+
import { DEFAULT_FONT_FAMILY, KEYBOARD_BUTTON_CODE, SECONDARY_PURPLE_COLOR, TEXT_COLOR_NEUTRAL_0 } from "../../constants";
|
|
20
|
+
import { isValidNumber } from "../../utils/helper";
|
|
21
|
+
var styles = {
|
|
22
|
+
input: {
|
|
23
|
+
display: 'block',
|
|
24
|
+
padding: '15px 25px 12px 0px',
|
|
25
|
+
width: 120,
|
|
26
|
+
color: TEXT_COLOR_NEUTRAL_0,
|
|
27
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
28
|
+
border: '2px solid',
|
|
29
|
+
textAlign: 'right',
|
|
30
|
+
"float": 'right',
|
|
31
|
+
fontFamily: DEFAULT_FONT_FAMILY,
|
|
32
|
+
fontSize: 16,
|
|
33
|
+
fontWeight: 600,
|
|
34
|
+
lineHeight: '17px',
|
|
35
|
+
borderRadius: 5,
|
|
36
|
+
outline: 0,
|
|
37
|
+
transition: 'border-color 0.2s'
|
|
38
|
+
},
|
|
39
|
+
inputFocus: {
|
|
40
|
+
borderColor: SECONDARY_PURPLE_COLOR
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
44
|
+
function FormNumberInput(props, context) {
|
|
45
|
+
var _this;
|
|
46
|
+
_classCallCheck(this, FormNumberInput);
|
|
47
|
+
_this = _callSuper(this, FormNumberInput, [props, context]);
|
|
48
|
+
_this.state = {
|
|
49
|
+
focus: false,
|
|
50
|
+
valid: true,
|
|
51
|
+
showedValue: props.value,
|
|
52
|
+
focusOn: false,
|
|
53
|
+
flag: true
|
|
54
|
+
};
|
|
55
|
+
_this.input = /*#__PURE__*/React.createRef(null);
|
|
56
|
+
return _this;
|
|
57
|
+
}
|
|
58
|
+
_inherits(FormNumberInput, _Component);
|
|
59
|
+
return _createClass(FormNumberInput, [{
|
|
60
|
+
key: "componentDidMount",
|
|
61
|
+
value: function componentDidMount() {
|
|
62
|
+
if (this.input.current && ['width', 'length'].includes(this.props.labelName.toLowerCase())) {
|
|
63
|
+
this.input.current.focus();
|
|
64
|
+
this.input.current.select();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "componentWillReceiveProps",
|
|
69
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
70
|
+
if (this.props.value !== nextProps.value || this.props.focus !== nextProps.focus) {
|
|
71
|
+
this.setState({
|
|
72
|
+
showedValue: nextProps.value,
|
|
73
|
+
focusOn: nextProps.focus
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "componentDidUpdate",
|
|
79
|
+
value: function componentDidUpdate(prevProps, preprevState) {
|
|
80
|
+
if (this.props.value !== prevProps.value && prevProps.labelName !== 'Ceiling Height') {
|
|
81
|
+
this.input.current.focus();
|
|
82
|
+
this.input.current.select();
|
|
83
|
+
}
|
|
84
|
+
var showedValue = this.state.showedValue;
|
|
85
|
+
var _this$props = this.props,
|
|
86
|
+
min = _this$props.min,
|
|
87
|
+
max = _this$props.max,
|
|
88
|
+
isCeiling = _this$props.isCeiling;
|
|
89
|
+
if (!isCeiling) {
|
|
90
|
+
if (isValidNumber(min) && showedValue < min) {
|
|
91
|
+
this.setState({
|
|
92
|
+
showedValue: min
|
|
93
|
+
});
|
|
94
|
+
} else if (isValidNumber(max) && showedValue > max) {
|
|
95
|
+
this.setState({
|
|
96
|
+
showedValue: max
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "render",
|
|
104
|
+
value: function render() {
|
|
105
|
+
var _this2 = this;
|
|
106
|
+
var _this$props2 = this.props,
|
|
107
|
+
value = _this$props2.value,
|
|
108
|
+
min = _this$props2.min,
|
|
109
|
+
max = _this$props2.max,
|
|
110
|
+
precision = _this$props2.precision,
|
|
111
|
+
onChange = _this$props2.onChange,
|
|
112
|
+
onValid = _this$props2.onValid,
|
|
113
|
+
onInvalid = _this$props2.onInvalid,
|
|
114
|
+
style = _this$props2.style,
|
|
115
|
+
placeholder = _this$props2.placeholder,
|
|
116
|
+
isCeiling = _this$props2.isCeiling;
|
|
117
|
+
var regexp = new RegExp("^-?([0-9]+)?\\.?([0-9]{0,".concat(precision, "})?$"));
|
|
118
|
+
var currValue = regexp.test(this.state.showedValue) ? this.state.showedValue : parseFloat(this.state.showedValue).toFixed(precision);
|
|
119
|
+
var different = parseFloat(this.props.value).toFixed(precision) !== parseFloat(this.state.showedValue).toFixed(precision);
|
|
120
|
+
var saveFn = function saveFn(e) {
|
|
121
|
+
e.stopPropagation();
|
|
122
|
+
if (_this2.state.valid) {
|
|
123
|
+
var savedValue = _this2.state.showedValue !== '' && _this2.state.showedValue !== '-' ? parseFloat(_this2.state.showedValue) : 0;
|
|
124
|
+
_this2.setState({
|
|
125
|
+
showedValue: savedValue
|
|
126
|
+
});
|
|
127
|
+
onChange({
|
|
128
|
+
target: {
|
|
129
|
+
value: savedValue
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Merge base style, focus style, and custom style
|
|
136
|
+
var inputStyle = _objectSpread(_objectSpread(_objectSpread({}, styles.input), this.state.focusOn ? styles.inputFocus : {}), style);
|
|
137
|
+
return /*#__PURE__*/React.createElement("input", {
|
|
138
|
+
id: "form_number_input",
|
|
139
|
+
autoFocus: this.state.focusOn,
|
|
140
|
+
readOnly: !!this.props.disabled,
|
|
141
|
+
type: "text",
|
|
142
|
+
value: currValue,
|
|
143
|
+
style: inputStyle,
|
|
144
|
+
onChange: function onChange(evt) {
|
|
145
|
+
_this2.context.projectActions.copyProperties('ddddd');
|
|
146
|
+
var valid = regexp.test(evt.nativeEvent.target.value);
|
|
147
|
+
if (valid) {
|
|
148
|
+
_this2.setState({
|
|
149
|
+
showedValue: evt.nativeEvent.target.value,
|
|
150
|
+
flag: false
|
|
151
|
+
});
|
|
152
|
+
if (onValid) onValid(evt.nativeEvent);
|
|
153
|
+
} else {
|
|
154
|
+
if (onInvalid) onInvalid(evt.nativeEvent);
|
|
155
|
+
}
|
|
156
|
+
_this2.setState({
|
|
157
|
+
valid: valid
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
onFocus: function onFocus(e) {
|
|
161
|
+
return _this2.setState({
|
|
162
|
+
focusOn: true
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
onBlur: function onBlur(e) {
|
|
166
|
+
return _this2.setState({
|
|
167
|
+
focusOn: false
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
ref: this.input,
|
|
171
|
+
onKeyDown: function onKeyDown(e) {
|
|
172
|
+
var keyCode = e.keyCode || e.which;
|
|
173
|
+
if (keyCode == KEYBOARD_BUTTON_CODE.ENTER || keyCode == KEYBOARD_BUTTON_CODE.TAB) {
|
|
174
|
+
saveFn(e);
|
|
175
|
+
_this2.input.current.blur();
|
|
176
|
+
}
|
|
177
|
+
if (keyCode == KEYBOARD_BUTTON_CODE.ESC) {
|
|
178
|
+
_this2.context.projectActions.rollback();
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
placeholder: placeholder
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}]);
|
|
185
|
+
}(Component);
|
|
186
|
+
export { FormNumberInput as default };
|
|
187
|
+
FormNumberInput.propTypes = {
|
|
188
|
+
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
189
|
+
style: PropTypes.object,
|
|
190
|
+
onChange: PropTypes.func.isRequired,
|
|
191
|
+
onValid: PropTypes.func,
|
|
192
|
+
onInvalid: PropTypes.func,
|
|
193
|
+
min: PropTypes.number,
|
|
194
|
+
max: PropTypes.number,
|
|
195
|
+
precision: PropTypes.number,
|
|
196
|
+
placeholder: PropTypes.string,
|
|
197
|
+
labelName: PropTypes.string,
|
|
198
|
+
isCeiling: PropTypes.string
|
|
199
|
+
};
|
|
200
|
+
FormNumberInput.contextTypes = {
|
|
201
|
+
translator: PropTypes.object.isRequired,
|
|
202
|
+
projectActions: PropTypes.object.isRequired,
|
|
203
|
+
linesActions: PropTypes.object.isRequired
|
|
204
|
+
};
|
|
205
|
+
FormNumberInput.defaultProps = {
|
|
206
|
+
value: 0,
|
|
207
|
+
style: {},
|
|
208
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
209
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
210
|
+
precision: 2,
|
|
211
|
+
disabled: false,
|
|
212
|
+
labelName: 'default'
|
|
213
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
13
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
15
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
16
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
17
|
+
import React, { Component } from 'react';
|
|
18
|
+
import PropTypes from 'prop-types';
|
|
19
|
+
import * as SharedStyle from "../../shared-style";
|
|
20
|
+
import { MdUpdate } from 'react-icons/md';
|
|
21
|
+
import { KEYBOARD_BUTTON_CODE } from "../../constants";
|
|
22
|
+
var STYLE_INPUT = {
|
|
23
|
+
display: 'block',
|
|
24
|
+
width: '100%',
|
|
25
|
+
padding: '0 2px',
|
|
26
|
+
fontSize: '13px',
|
|
27
|
+
lineHeight: '1.25',
|
|
28
|
+
color: SharedStyle.PRIMARY_COLOR.input,
|
|
29
|
+
backgroundColor: SharedStyle.COLORS.white,
|
|
30
|
+
backgroundImage: 'none',
|
|
31
|
+
border: '1px solid rgba(0,0,0,.15)',
|
|
32
|
+
outline: 'none',
|
|
33
|
+
height: '30px'
|
|
34
|
+
};
|
|
35
|
+
var confirmStyle = {
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
width: '20px',
|
|
39
|
+
height: '20px',
|
|
40
|
+
right: '5px',
|
|
41
|
+
top: '5px',
|
|
42
|
+
backgroundColor: SharedStyle.SECONDARY_COLOR.main,
|
|
43
|
+
color: '#FFF',
|
|
44
|
+
transition: 'all 0.1s linear'
|
|
45
|
+
};
|
|
46
|
+
var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
47
|
+
function FormNumberInput(props, context) {
|
|
48
|
+
var _this;
|
|
49
|
+
_classCallCheck(this, FormNumberInput);
|
|
50
|
+
_this = _callSuper(this, FormNumberInput, [props, context]);
|
|
51
|
+
_this.state = {
|
|
52
|
+
focus: false,
|
|
53
|
+
valid: true,
|
|
54
|
+
showedValue: props.value,
|
|
55
|
+
disabled: props.disabled === true ? true : false,
|
|
56
|
+
focusOn: false
|
|
57
|
+
};
|
|
58
|
+
return _this;
|
|
59
|
+
}
|
|
60
|
+
_inherits(FormNumberInput, _Component);
|
|
61
|
+
return _createClass(FormNumberInput, [{
|
|
62
|
+
key: "componentWillReceiveProps",
|
|
63
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
64
|
+
if (this.props.value !== nextProps.value || this.props.focus !== nextProps.focus) {
|
|
65
|
+
this.setState({
|
|
66
|
+
showedValue: nextProps.value,
|
|
67
|
+
focusOn: nextProps.focus
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (this.props.focus !== nextProps.focus) {
|
|
71
|
+
this.Input.focus();
|
|
72
|
+
this.Input.select();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "render",
|
|
77
|
+
value: function render() {
|
|
78
|
+
var _this2 = this;
|
|
79
|
+
var _this$props = this.props,
|
|
80
|
+
value = _this$props.value,
|
|
81
|
+
min = _this$props.min,
|
|
82
|
+
max = _this$props.max,
|
|
83
|
+
precision = _this$props.precision,
|
|
84
|
+
onChange = _this$props.onChange,
|
|
85
|
+
onValid = _this$props.onValid,
|
|
86
|
+
onInvalid = _this$props.onInvalid,
|
|
87
|
+
style = _this$props.style,
|
|
88
|
+
placeholder = _this$props.placeholder;
|
|
89
|
+
var numericInputStyle = _objectSpread(_objectSpread({}, STYLE_INPUT), style);
|
|
90
|
+
if (this.state.focusOn) numericInputStyle.border = "1px solid ".concat(SharedStyle.SECONDARY_COLOR.main);
|
|
91
|
+
var regexp = new RegExp("^-?([0-9]+)?\\.?([0-9]{0,".concat(precision, "})?$"));
|
|
92
|
+
if (!isNaN(min) && isFinite(min) && this.state.showedValue < min) this.setState({
|
|
93
|
+
showedValue: min
|
|
94
|
+
}); // value = min;
|
|
95
|
+
if (!isNaN(max) && isFinite(max) && this.state.showedValue > max) this.setState({
|
|
96
|
+
showedValue: max
|
|
97
|
+
}); // value = max;
|
|
98
|
+
|
|
99
|
+
var currValue = regexp.test(this.state.showedValue) ? this.state.showedValue : parseFloat(this.state.showedValue).toFixed(precision);
|
|
100
|
+
var different = parseFloat(this.props.value).toFixed(precision) !== parseFloat(this.state.showedValue).toFixed(precision);
|
|
101
|
+
var saveFn = function saveFn(e) {
|
|
102
|
+
e.stopPropagation();
|
|
103
|
+
if (_this2.state.valid) {
|
|
104
|
+
var savedValue = _this2.state.showedValue !== '' && _this2.state.showedValue !== '-' ? parseFloat(_this2.state.showedValue) : 0;
|
|
105
|
+
_this2.setState({
|
|
106
|
+
showedValue: savedValue
|
|
107
|
+
});
|
|
108
|
+
onChange({
|
|
109
|
+
target: {
|
|
110
|
+
value: savedValue
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
style: {
|
|
117
|
+
position: 'relative'
|
|
118
|
+
}
|
|
119
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
120
|
+
autoFocus: this.state.focusOn,
|
|
121
|
+
readOnly: this.state.disabled,
|
|
122
|
+
type: "text",
|
|
123
|
+
value: currValue,
|
|
124
|
+
style: numericInputStyle,
|
|
125
|
+
onChange: function onChange(evt) {
|
|
126
|
+
var valid = regexp.test(evt.nativeEvent.target.value);
|
|
127
|
+
if (valid) {
|
|
128
|
+
_this2.setState({
|
|
129
|
+
showedValue: evt.nativeEvent.target.value
|
|
130
|
+
});
|
|
131
|
+
if (onValid) onValid(evt.nativeEvent);
|
|
132
|
+
} else {
|
|
133
|
+
if (onInvalid) onInvalid(evt.nativeEvent);
|
|
134
|
+
}
|
|
135
|
+
_this2.setState({
|
|
136
|
+
valid: valid
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
onFocus: function onFocus(e) {
|
|
140
|
+
return _this2.setState({
|
|
141
|
+
focusOn: true
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
onBlur: function onBlur(e) {
|
|
145
|
+
return _this2.setState({
|
|
146
|
+
focusOn: false
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
ref: function ref(ele) {
|
|
150
|
+
_this2.Input = ele;
|
|
151
|
+
},
|
|
152
|
+
onKeyDown: function onKeyDown(e) {
|
|
153
|
+
var keyCode = e.keyCode || e.which;
|
|
154
|
+
if (keyCode == KEYBOARD_BUTTON_CODE.ENTER || keyCode == KEYBOARD_BUTTON_CODE.TAB) {
|
|
155
|
+
saveFn(e);
|
|
156
|
+
_this2.Input.blur();
|
|
157
|
+
}
|
|
158
|
+
if (keyCode == KEYBOARD_BUTTON_CODE.ESC) {
|
|
159
|
+
_this2.context.projectActions.rollback();
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
placeholder: placeholder
|
|
163
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
onClick: function onClick(e) {
|
|
165
|
+
if (different) saveFn(e);
|
|
166
|
+
},
|
|
167
|
+
title: this.context.translator.t('Confirm'),
|
|
168
|
+
style: _objectSpread(_objectSpread({}, confirmStyle), {}, {
|
|
169
|
+
visibility: different ? 'visible' : 'hidden',
|
|
170
|
+
opacity: different ? '1' : '0'
|
|
171
|
+
})
|
|
172
|
+
}, /*#__PURE__*/React.createElement(MdUpdate, {
|
|
173
|
+
style: {
|
|
174
|
+
width: '100%',
|
|
175
|
+
height: '100%',
|
|
176
|
+
padding: '0.2em',
|
|
177
|
+
color: '#FFF'
|
|
178
|
+
}
|
|
179
|
+
})));
|
|
180
|
+
}
|
|
181
|
+
}]);
|
|
182
|
+
}(Component);
|
|
183
|
+
export { FormNumberInput as default };
|
|
184
|
+
FormNumberInput.propTypes = {
|
|
185
|
+
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
186
|
+
style: PropTypes.object,
|
|
187
|
+
onChange: PropTypes.func.isRequired,
|
|
188
|
+
onValid: PropTypes.func,
|
|
189
|
+
onInvalid: PropTypes.func,
|
|
190
|
+
min: PropTypes.number,
|
|
191
|
+
max: PropTypes.number,
|
|
192
|
+
precision: PropTypes.number,
|
|
193
|
+
placeholder: PropTypes.string
|
|
194
|
+
};
|
|
195
|
+
FormNumberInput.contextTypes = {
|
|
196
|
+
translator: PropTypes.object.isRequired,
|
|
197
|
+
projectActions: PropTypes.object.isRequired
|
|
198
|
+
};
|
|
199
|
+
FormNumberInput.defaultProps = {
|
|
200
|
+
value: 0,
|
|
201
|
+
style: {},
|
|
202
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
203
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
204
|
+
precision: 2,
|
|
205
|
+
disabled: false
|
|
206
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["children", "style"];
|
|
3
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
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
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR, TEXT_COLOR_NEUTRAL_3 } from "../../constants";
|
|
19
|
+
var styles = {
|
|
20
|
+
select: {
|
|
21
|
+
display: 'block',
|
|
22
|
+
width: 120,
|
|
23
|
+
"float": 'right',
|
|
24
|
+
padding: '15px 10px 12px 0px',
|
|
25
|
+
color: TEXT_COLOR_NEUTRAL_3,
|
|
26
|
+
border: '2px solid',
|
|
27
|
+
fontFamily: DEFAULT_FONT_FAMILY,
|
|
28
|
+
fontSize: 12,
|
|
29
|
+
fontWeight: 600,
|
|
30
|
+
lineHeight: '17px',
|
|
31
|
+
textAlign: 'right',
|
|
32
|
+
outline: 'none',
|
|
33
|
+
borderRadius: 5,
|
|
34
|
+
transition: 'border-color 0.2s'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export default function FormSelect(_ref) {
|
|
38
|
+
var children = _ref.children,
|
|
39
|
+
style = _ref.style,
|
|
40
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
var _React$useState = React.useState(false),
|
|
42
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
43
|
+
focus = _React$useState2[0],
|
|
44
|
+
setFocus = _React$useState2[1];
|
|
45
|
+
var _React$useState3 = React.useState(false),
|
|
46
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
47
|
+
hover = _React$useState4[0],
|
|
48
|
+
setHover = _React$useState4[1];
|
|
49
|
+
var borderColor = focus || hover ? SECONDARY_PURPLE_COLOR : undefined;
|
|
50
|
+
return /*#__PURE__*/React.createElement("select", _extends({
|
|
51
|
+
type: "text",
|
|
52
|
+
style: _objectSpread(_objectSpread({}, styles.select), {}, {
|
|
53
|
+
borderColor: borderColor
|
|
54
|
+
}, style),
|
|
55
|
+
onFocus: function onFocus() {
|
|
56
|
+
return setFocus(true);
|
|
57
|
+
},
|
|
58
|
+
onBlur: function onBlur() {
|
|
59
|
+
return setFocus(false);
|
|
60
|
+
},
|
|
61
|
+
onMouseEnter: function onMouseEnter() {
|
|
62
|
+
return setHover(true);
|
|
63
|
+
},
|
|
64
|
+
onMouseLeave: function onMouseLeave() {
|
|
65
|
+
return setHover(false);
|
|
66
|
+
}
|
|
67
|
+
}, rest), children);
|
|
68
|
+
}
|