kitchen-simulator 4.1.6-react-18 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +162 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/actions/project-actions.js +2 -1
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/factories/wall-factory.js +1 -1
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +24 -11
- package/es/catalog/utils/item-loader.js +224 -220
- package/es/class/hole.js +0 -2
- package/es/class/item.js +92 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +96 -81
- package/es/components/content.js +5 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +29 -29
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +22 -54
- package/es/components/viewer2d/ruler.js +16 -11
- package/es/components/viewer2d/rulerDist.js +38 -51
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +17 -12
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/vertex.js +3 -2
- package/es/components/viewer2d/viewer2d.js +76 -118
- package/es/components/viewer3d/front3D.js +2 -1
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +270 -69
- package/es/components/viewer3d/viewer3d-first-person.js +26 -32
- package/es/components/viewer3d/viewer3d.js +106 -130
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +589 -61
- package/es/models.js +13 -8
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +4 -1
- package/es/reducers/viewer2d-reducer.js +3 -1
- package/es/reducers/viewer3d-reducer.js +3 -1
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +77 -119
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +829 -609
- package/es/utils/molding.js +459 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +161 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/actions/project-actions.js +2 -1
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/factories/wall-factory.js +1 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +24 -11
- package/lib/catalog/utils/item-loader.js +221 -217
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +90 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +96 -81
- package/lib/components/content.js +5 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +29 -29
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +22 -54
- package/lib/components/viewer2d/ruler.js +15 -10
- package/lib/components/viewer2d/rulerDist.js +38 -51
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +17 -12
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/vertex.js +3 -2
- package/lib/components/viewer2d/viewer2d.js +74 -115
- package/lib/components/viewer3d/front3D.js +2 -1
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +267 -66
- package/lib/components/viewer3d/viewer3d-first-person.js +26 -32
- package/lib/components/viewer3d/viewer3d.js +103 -126
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +591 -61
- package/lib/models.js +13 -8
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +4 -1
- package/lib/reducers/viewer2d-reducer.js +3 -1
- package/lib/reducers/viewer3d-reducer.js +3 -1
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +77 -119
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +829 -608
- package/lib/utils/molding.js +460 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +21 -20
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
package/es/class/project.js
CHANGED
|
@@ -34,7 +34,8 @@ var Project = /*#__PURE__*/function () {
|
|
|
34
34
|
}, {
|
|
35
35
|
key: "newProject",
|
|
36
36
|
value: function newProject(state) {
|
|
37
|
-
var
|
|
37
|
+
var _state$toJS$doorStyle, _state;
|
|
38
|
+
var doorStyle = (_state$toJS$doorStyle = (_state = state) === null || _state === void 0 || (_state = _state.toJS()) === null || _state === void 0 ? void 0 : _state.doorStyle) !== null && _state$toJS$doorStyle !== void 0 ? _state$toJS$doorStyle : null;
|
|
38
39
|
// let counterTop = state.getIn(['scene', 'layers', layerID, 'counterTop']);
|
|
39
40
|
// let floorStyle = state.getIn(['scene', 'layers', layerID, 'floorStyle']);
|
|
40
41
|
var _viewer2D = state.viewer2D;
|
|
@@ -74,9 +75,9 @@ var Project = /*#__PURE__*/function () {
|
|
|
74
75
|
a: 0.99,
|
|
75
76
|
d: 0.99
|
|
76
77
|
});
|
|
77
|
-
var
|
|
78
|
-
oldScene =
|
|
79
|
-
oldSceneHistory =
|
|
78
|
+
var _state2 = state,
|
|
79
|
+
oldScene = _state2.scene,
|
|
80
|
+
oldSceneHistory = _state2.sceneHistory;
|
|
80
81
|
var json_items = sceneJSON.layers[sceneJSON.selectedLayer].items;
|
|
81
82
|
var elements = state.catalog.get('elements').toArray();
|
|
82
83
|
var _loop = function _loop(x) {
|
|
@@ -102,6 +103,8 @@ var Project = /*#__PURE__*/function () {
|
|
|
102
103
|
// sceneJSON && (sceneJSON.layers[layerID] = newlayer);
|
|
103
104
|
// }
|
|
104
105
|
|
|
106
|
+
// check type of ceilHeight and make it to Number
|
|
107
|
+
if (typeof sceneJSON.layers[layerID].ceilHeight !== 'number') sceneJSON.layers[layerID].ceilHeight = Number(sceneJSON.layers[layerID].ceilHeight);
|
|
105
108
|
var newScene = new Scene(sceneJSON);
|
|
106
109
|
state = new State({
|
|
107
110
|
scene: newScene.toJS(),
|
|
@@ -167,6 +170,8 @@ var Project = /*#__PURE__*/function () {
|
|
|
167
170
|
// Matching state.doorStyle with layer.doorStyle
|
|
168
171
|
if (state.getIn(['scene', 'layers', layerID, 'doorStyle'])) {
|
|
169
172
|
doorStyle = state.getIn(['scene', 'layers', layerID, 'doorStyle']);
|
|
173
|
+
} else if (!isEmpty(doorStyle)) {
|
|
174
|
+
state = state.setIn(['scene', 'layers', layerID, 'doorStyle'], doorStyle);
|
|
170
175
|
}
|
|
171
176
|
state = state.merge({
|
|
172
177
|
doorStyle: doorStyle,
|
|
@@ -827,91 +832,101 @@ var Project = /*#__PURE__*/function () {
|
|
|
827
832
|
}
|
|
828
833
|
}, {
|
|
829
834
|
key: "createRoomWithShape",
|
|
830
|
-
value: function createRoomWithShape(state, roomShapeType, width, height, doorStyle) {
|
|
835
|
+
value: function createRoomWithShape(state, roomShapeType, width, height, measurementUnit, doorStyle) {
|
|
831
836
|
var catalog = state.catalog;
|
|
837
|
+
// keep sceneHistory
|
|
838
|
+
var curLayerID = state.scene.selectedLayer;
|
|
839
|
+
var ceilHeight = state.getIn(['scene', 'layers', curLayerID, 'ceilHeight']);
|
|
840
|
+
var sceneHistory = state.getIn(['sceneHistory']);
|
|
832
841
|
state = this.newProject(state).updatedState;
|
|
833
842
|
state = state.merge({
|
|
834
843
|
catalog: catalog
|
|
835
844
|
});
|
|
836
|
-
var _viewer2D = state.viewer2D;
|
|
837
|
-
var viewer = _viewer2D.toJS();
|
|
838
|
-
width = convert(width).from('in').to('cm');
|
|
839
|
-
height = convert(height).from('in').to('cm');
|
|
840
|
-
var layerID = state.scene.selectedLayer;
|
|
841
845
|
state = Item.setInitialDoorStyle(state, doorStyle).updatedState;
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
846
|
+
var layerID = state.scene.selectedLayer;
|
|
847
|
+
if (roomShapeType !== constants.ROOM_SHAPE_TYPE.CUSTOM && !isEmpty(width) && !isEmpty(height) && width !== 0 && height !== 0) {
|
|
848
|
+
var _viewer2D = state.viewer2D;
|
|
849
|
+
var viewer = _viewer2D.toJS();
|
|
850
|
+
if (isEmpty(viewer)) return {
|
|
851
|
+
updatedState: state
|
|
852
|
+
};
|
|
853
|
+
width = convert(width).from(measurementUnit).to('cm');
|
|
854
|
+
height = convert(height).from(measurementUnit).to('cm');
|
|
855
|
+
var halfWidth = width / 2;
|
|
856
|
+
var halfHeight = height / 2;
|
|
857
|
+
var viewerWidth = viewer.SVGWidth;
|
|
858
|
+
var viewerHeight = viewer.SVGHeight;
|
|
859
|
+
var centerPos = {
|
|
860
|
+
x: viewerWidth / 2,
|
|
861
|
+
y: viewerHeight / 2
|
|
862
|
+
};
|
|
863
|
+
var vtLB = {
|
|
864
|
+
x: centerPos.x - halfWidth,
|
|
865
|
+
y: centerPos.y - halfHeight
|
|
866
|
+
};
|
|
867
|
+
var vtRB = {
|
|
868
|
+
x: centerPos.x + halfWidth,
|
|
869
|
+
y: centerPos.y - halfHeight
|
|
870
|
+
};
|
|
871
|
+
var vtRT = {
|
|
872
|
+
x: centerPos.x + halfWidth,
|
|
873
|
+
y: centerPos.y + halfHeight
|
|
874
|
+
};
|
|
875
|
+
var vtLT = {
|
|
876
|
+
x: centerPos.x - halfWidth,
|
|
877
|
+
y: centerPos.y + halfHeight
|
|
878
|
+
};
|
|
879
|
+
var vertices = [];
|
|
880
|
+
switch (roomShapeType) {
|
|
881
|
+
case 'rectangle':
|
|
882
|
+
vertices = [vtLB, vtLT, vtRT, vtRB];
|
|
883
|
+
break;
|
|
884
|
+
case constants.ROOM_SHAPE_TYPE.TWO_WALLS_RIGHT_BOTTOM:
|
|
885
|
+
vertices = [vtLB, vtRB, vtRT];
|
|
886
|
+
break;
|
|
887
|
+
case constants.ROOM_SHAPE_TYPE.TWO_WALLS_RIGHT_TOP:
|
|
888
|
+
vertices = [vtRB, vtRT, vtLT];
|
|
889
|
+
break;
|
|
890
|
+
case constants.ROOM_SHAPE_TYPE.TWO_WALLS_LEFT_TOP:
|
|
891
|
+
vertices = [vtRT, vtLT, vtLB];
|
|
892
|
+
break;
|
|
893
|
+
case constants.ROOM_SHAPE_TYPE.TWO_WALLS_LEFT_BOTTOM:
|
|
894
|
+
vertices = [vtLT, vtLB, vtRB];
|
|
895
|
+
break;
|
|
896
|
+
case constants.ROOM_SHAPE_TYPE.THREE_WALLS_LEFT_TOP_RIGHT:
|
|
897
|
+
vertices = [vtRB, vtRT, vtLT, vtLB];
|
|
898
|
+
break;
|
|
899
|
+
case constants.ROOM_SHAPE_TYPE.THREE_WALLS_TOP_RIGHT_BOTTOM:
|
|
900
|
+
vertices = [vtLB, vtRB, vtRT, vtLT];
|
|
901
|
+
break;
|
|
902
|
+
case constants.ROOM_SHAPE_TYPE.THREE_WALLS_RIGHT_BOTTOM_LEFT:
|
|
903
|
+
vertices = [vtLT, vtLB, vtRB, vtRT];
|
|
904
|
+
break;
|
|
905
|
+
case constants.ROOM_SHAPE_TYPE.THREE_WALLS_BOTTOM_LEFT_TOP:
|
|
906
|
+
vertices = [vtRT, vtLT, vtLB, vtRB];
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
for (var i = 0; i < vertices.length - 1; i++) {
|
|
910
|
+
state = Line.create(state, layerID, 'wall', vertices[i].x, vertices[i].y, vertices[i + 1].x, vertices[i + 1].y).updatedState;
|
|
911
|
+
}
|
|
912
|
+
if (roomShapeType === constants.ROOM_SHAPE_TYPE.RECTANGLE) {
|
|
913
|
+
state = Line.create(state, layerID, 'wall', vertices[vertices.length - 1].x, vertices[vertices.length - 1].y, vertices[0].x, vertices[0].y).updatedState;
|
|
914
|
+
}
|
|
915
|
+
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
916
|
+
var lines = layer.getIn(['lines']).toJS();
|
|
917
|
+
var drawingInfo = {};
|
|
918
|
+
var lineKey = Object.keys(lines);
|
|
919
|
+
for (var _i = 0; _i < lineKey.length; _i++) {
|
|
920
|
+
if (!isEmpty(lineKey)) {
|
|
921
|
+
drawingInfo.drawingLine = layer.getIn(['lines', lineKey[_i]]);
|
|
922
|
+
}
|
|
923
|
+
state = Layer.detectAndUpdateAreas(state, layerID, drawingInfo).updatedState;
|
|
912
924
|
}
|
|
913
|
-
state = Layer.detectAndUpdateAreas(state, layerID, drawingInfo).updatedState;
|
|
914
925
|
}
|
|
926
|
+
|
|
927
|
+
// copy keeped sceneHistory
|
|
928
|
+
state = state.setIn(['scene', 'layers', layerID, 'ceilHeight'], ceilHeight);
|
|
929
|
+
state = state.setIn(['sceneHistory'], sceneHistory);
|
|
915
930
|
state = centering2D(state);
|
|
916
931
|
return {
|
|
917
932
|
updatedState: state
|
package/es/components/content.js
CHANGED
|
@@ -7,8 +7,7 @@ import Viewer3DFirstPerson from "./viewer3d/viewer3d-first-person";
|
|
|
7
7
|
// import ProjectConfigurator from './configurator/project-configurator';
|
|
8
8
|
import * as constants from "../constants";
|
|
9
9
|
import Front3D from "./viewer3d/front3D";
|
|
10
|
-
|
|
11
|
-
export default function Content(_ref) {
|
|
10
|
+
export default function Content(_ref, _ref2) {
|
|
12
11
|
var width = _ref.width,
|
|
13
12
|
height = _ref.height,
|
|
14
13
|
state = _ref.state,
|
|
@@ -19,98 +18,8 @@ export default function Content(_ref) {
|
|
|
19
18
|
keyDownEnable = _ref.keyDownEnable,
|
|
20
19
|
catalog = _ref.catalog,
|
|
21
20
|
onInternalEvent = _ref.onInternalEvent;
|
|
21
|
+
var projectActions = _ref2.projectActions;
|
|
22
22
|
var mode = state.get('mode');
|
|
23
|
-
var _useAppContext = useAppContext(),
|
|
24
|
-
projectActions = _useAppContext.projectActions;
|
|
25
|
-
var rollback = projectActions.rollback,
|
|
26
|
-
undo = projectActions.undo,
|
|
27
|
-
redo = projectActions.redo,
|
|
28
|
-
toggleSnap = projectActions.toggleSnap,
|
|
29
|
-
copyProperties = projectActions.copyProperties,
|
|
30
|
-
pasteProperties = projectActions.pasteProperties,
|
|
31
|
-
recreate = projectActions.recreate,
|
|
32
|
-
uncreate = projectActions.uncreate,
|
|
33
|
-
shift2doff = projectActions.shift2doff,
|
|
34
|
-
shift2don = projectActions.shift2don;
|
|
35
|
-
useEffect(function () {
|
|
36
|
-
function handleKeyDown(event) {
|
|
37
|
-
switch (event.keyCode) {
|
|
38
|
-
case constants.KEYBOARD_BUTTON_CODE.ESC:
|
|
39
|
-
rollback();
|
|
40
|
-
break;
|
|
41
|
-
case constants.KEYBOARD_BUTTON_CODE.Z:
|
|
42
|
-
if (event.getModifierState('Control') || event.getModifierState('Meta')) undo();
|
|
43
|
-
break;
|
|
44
|
-
case constants.KEYBOARD_BUTTON_CODE.Q:
|
|
45
|
-
if (event.getModifierState('Control') || event.getModifierState('Meta')) redo();
|
|
46
|
-
break;
|
|
47
|
-
case constants.KEYBOARD_BUTTON_CODE.ALT:
|
|
48
|
-
if (constants.MODE_SNAPPING.includes(mode)) toggleSnap(state.snapMask.merge({
|
|
49
|
-
SNAP_POINT: false,
|
|
50
|
-
SNAP_LINE: false,
|
|
51
|
-
SNAP_SEGMENT: false,
|
|
52
|
-
SNAP_GRID: false,
|
|
53
|
-
SNAP_GUIDE: false,
|
|
54
|
-
tempSnapConfiguartion: state.snapMask.toJS()
|
|
55
|
-
}));
|
|
56
|
-
break;
|
|
57
|
-
case constants.KEYBOARD_BUTTON_CODE.C:
|
|
58
|
-
{
|
|
59
|
-
var selectedLayer = state.getIn(['scene', 'selectedLayer']);
|
|
60
|
-
var selected = state.getIn(['scene', 'layers', selectedLayer, 'selected']);
|
|
61
|
-
if ((mode === constants.MODE_IDLE || mode === constants.MODE_3D_VIEW) && (selected.holes.size || selected.areas.size || selected.items.size || selected.lines.size)) {
|
|
62
|
-
if (selected.holes.size) {
|
|
63
|
-
var hole = state.getIn(['scene', 'layers', selectedLayer, 'holes', selected.holes.get(0)]);
|
|
64
|
-
copyProperties(hole.get('properties'));
|
|
65
|
-
} else if (selected.areas.size) {
|
|
66
|
-
var area = state.getIn(['scene', 'layers', selectedLayer, 'areas', selected.areas.get(0)]);
|
|
67
|
-
copyProperties(area.properties);
|
|
68
|
-
} else if (selected.items.size) {
|
|
69
|
-
var item = state.getIn(['scene', 'layers', selectedLayer, 'items', selected.items.get(0)]);
|
|
70
|
-
copyProperties(item.properties);
|
|
71
|
-
} else if (selected.lines.size) {
|
|
72
|
-
var line = state.getIn(['scene', 'layers', selectedLayer, 'lines', selected.lines.get(0)]);
|
|
73
|
-
copyProperties(line.properties);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
case constants.KEYBOARD_BUTTON_CODE.V:
|
|
79
|
-
pasteProperties();
|
|
80
|
-
break;
|
|
81
|
-
case constants.KEYBOARD_BUTTON_CODE.SHIFT:
|
|
82
|
-
if (!['TEXTAREA', 'INPUT'].includes(document.activeElement.tagName)) {
|
|
83
|
-
if ([constants.MODE_DRAWING_ITEM_3D, constants.MODE_IDLE_3D].includes(mode)) recreate();else if ([constants.MODE_DRAWING_ITEM, constants.MODE_IDLE].includes(mode)) shift2doff();
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
default:
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function handleKeyUp(event) {
|
|
91
|
-
switch (event.keyCode) {
|
|
92
|
-
case constants.KEYBOARD_BUTTON_CODE.ALT:
|
|
93
|
-
if (constants.MODE_SNAPPING.includes(mode)) toggleSnap(state.snapMask.merge(state.snapMask.get('tempSnapConfiguartion')));
|
|
94
|
-
break;
|
|
95
|
-
case constants.KEYBOARD_BUTTON_CODE.CTRL:
|
|
96
|
-
// setAlterateState();
|
|
97
|
-
break;
|
|
98
|
-
case constants.KEYBOARD_BUTTON_CODE.SHIFT:
|
|
99
|
-
if (!['TEXTAREA', 'INPUT'].includes(document.activeElement.tagName)) {
|
|
100
|
-
if ([constants.MODE_DRAWING_ITEM_3D, constants.MODE_IDLE_3D].includes(mode)) uncreate();else if ([constants.MODE_DRAWING_ITEM, constants.MODE_IDLE].includes(mode)) shift2don();
|
|
101
|
-
}
|
|
102
|
-
break;
|
|
103
|
-
default:
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
108
|
-
window.addEventListener('keyup', handleKeyUp);
|
|
109
|
-
return function () {
|
|
110
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
111
|
-
window.removeEventListener('keyup', handleKeyUp);
|
|
112
|
-
};
|
|
113
|
-
}, [state, rollback, undo, redo, toggleSnap, copyProperties, pasteProperties, recreate, uncreate, shift2doff, shift2don]);
|
|
114
23
|
|
|
115
24
|
// Internal Event for unselect_all
|
|
116
25
|
useEffect(function () {
|
|
@@ -224,4 +133,7 @@ Content.propTypes = {
|
|
|
224
133
|
height: PropTypes.number.isRequired,
|
|
225
134
|
replaceCabinet: PropTypes.func.isRequired,
|
|
226
135
|
onInternalEvent: PropTypes.func.isRequired
|
|
136
|
+
};
|
|
137
|
+
Content.contextTypes = {
|
|
138
|
+
projectActions: PropTypes.object.isRequired
|
|
227
139
|
};
|
package/es/components/export.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import Content from "./content";
|
|
2
2
|
import Viewer2DComponents from "./viewer2d/export";
|
|
3
3
|
import StyleComponents from "./style/export";
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
StyleComponents: StyleComponents
|
|
9
|
-
};
|
|
4
|
+
|
|
5
|
+
export { Content, Viewer2DComponents, StyleComponents };
|
|
6
|
+
|
|
7
|
+
export default { Content, Viewer2DComponents, StyleComponents };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
var _excluded = ["type", "style", "styleHover", "children", "size"];
|
|
9
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
import React, { Component } from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import * as SharedStyle from "../../shared-style";
|
|
14
|
+
var BASE_STYLE = {
|
|
15
|
+
display: 'inline-block',
|
|
16
|
+
fontWeight: '400',
|
|
17
|
+
lineHeight: '1.25',
|
|
18
|
+
textAlign: 'center',
|
|
19
|
+
whiteSpace: 'nowrap',
|
|
20
|
+
verticalAlign: 'middle',
|
|
21
|
+
cursor: 'pointer',
|
|
22
|
+
WebkitUserSelect: 'none',
|
|
23
|
+
MozUserSelect: 'none',
|
|
24
|
+
MsUserSelect: 'none',
|
|
25
|
+
userSelect: 'none',
|
|
26
|
+
padding: '5px 14px',
|
|
27
|
+
fontSize: '14px',
|
|
28
|
+
color: SharedStyle.COLORS.black,
|
|
29
|
+
fonWeight: '400px',
|
|
30
|
+
transition: 'background-color 175ms ease, border 175ms ease',
|
|
31
|
+
outline: 'none',
|
|
32
|
+
borderRadius: '2px',
|
|
33
|
+
borderWidth: '1px',
|
|
34
|
+
borderType: 'solid',
|
|
35
|
+
width: '100%'
|
|
36
|
+
};
|
|
37
|
+
var BASE_STYLE_SIZE = {
|
|
38
|
+
small: {
|
|
39
|
+
fontSize: '12px',
|
|
40
|
+
padding: '3px 8px'
|
|
41
|
+
},
|
|
42
|
+
normal: {},
|
|
43
|
+
large: {
|
|
44
|
+
padding: '8px 20px'
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var Button = /*#__PURE__*/function (_Component) {
|
|
48
|
+
function Button(props) {
|
|
49
|
+
var _this;
|
|
50
|
+
_classCallCheck(this, Button);
|
|
51
|
+
_this = _callSuper(this, Button, [props]);
|
|
52
|
+
_this.state = {
|
|
53
|
+
hover: false
|
|
54
|
+
};
|
|
55
|
+
return _this;
|
|
56
|
+
}
|
|
57
|
+
_inherits(Button, _Component);
|
|
58
|
+
return _createClass(Button, [{
|
|
59
|
+
key: "render",
|
|
60
|
+
value: function render() {
|
|
61
|
+
var _this2 = this;
|
|
62
|
+
var hover = this.state.hover;
|
|
63
|
+
var _this$props = this.props,
|
|
64
|
+
type = _this$props.type,
|
|
65
|
+
customStyle = _this$props.style,
|
|
66
|
+
customStyleHover = _this$props.styleHover,
|
|
67
|
+
children = _this$props.children,
|
|
68
|
+
size = _this$props.size,
|
|
69
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
70
|
+
var styleMerged = Object.assign({}, BASE_STYLE, BASE_STYLE_SIZE[size], hover ? customStyleHover : customStyle);
|
|
71
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
72
|
+
type: type,
|
|
73
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
74
|
+
return _this2.setState({
|
|
75
|
+
hover: true
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
79
|
+
return _this2.setState({
|
|
80
|
+
hover: false
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
style: styleMerged
|
|
84
|
+
}, rest), children);
|
|
85
|
+
}
|
|
86
|
+
}]);
|
|
87
|
+
}(Component);
|
|
88
|
+
export { Button as default };
|
|
89
|
+
Button.defaultProps = {
|
|
90
|
+
type: 'button',
|
|
91
|
+
size: 'normal',
|
|
92
|
+
style: {
|
|
93
|
+
backgroundColor: '#e6e6e6',
|
|
94
|
+
borderColor: '#adadad'
|
|
95
|
+
},
|
|
96
|
+
styleHover: {
|
|
97
|
+
backgroundColor: '#d4d4d4',
|
|
98
|
+
borderColor: '#8c8c8c'
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
Button.propTypes = {
|
|
102
|
+
type: PropTypes.string,
|
|
103
|
+
style: PropTypes.object,
|
|
104
|
+
styleHover: PropTypes.object,
|
|
105
|
+
size: PropTypes.oneOf(['large', 'normal', 'small'])
|
|
106
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Button from "./button";
|
|
6
|
+
var STYLE = {
|
|
7
|
+
borderColor: '#adadad',
|
|
8
|
+
backgroundColor: '#e6e6e6'
|
|
9
|
+
};
|
|
10
|
+
var STYLE_HOVER = {
|
|
11
|
+
backgroundColor: '#d4d4d4',
|
|
12
|
+
borderColor: '#8c8c8c'
|
|
13
|
+
};
|
|
14
|
+
export default function CancelButton(_ref) {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
18
|
+
style: STYLE,
|
|
19
|
+
styleHover: STYLE_HOVER
|
|
20
|
+
}, rest), children);
|
|
21
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
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
|
+
import React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
var STYLE = {
|
|
7
|
+
padding: '0 20px',
|
|
8
|
+
overflowY: 'auto'
|
|
9
|
+
};
|
|
10
|
+
export default function ContentContainer(_ref) {
|
|
11
|
+
var children = _ref.children,
|
|
12
|
+
width = _ref.width,
|
|
13
|
+
height = _ref.height,
|
|
14
|
+
_ref$style = _ref.style,
|
|
15
|
+
style = _ref$style === void 0 ? {} : _ref$style;
|
|
16
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
style: _objectSpread(_objectSpread({
|
|
18
|
+
width: width,
|
|
19
|
+
height: height
|
|
20
|
+
}, STYLE), style),
|
|
21
|
+
onWheel: function onWheel(event) {
|
|
22
|
+
return event.stopPropagation();
|
|
23
|
+
}
|
|
24
|
+
}, children);
|
|
25
|
+
}
|
|
26
|
+
ContentContainer.propsType = {
|
|
27
|
+
width: PropTypes.number.isRequired,
|
|
28
|
+
height: PropTypes.number.isRequired,
|
|
29
|
+
style: PropTypes.object
|
|
30
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "style"];
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import * as SharedStyle from "../../shared-style";
|
|
10
|
+
var STYLE = {
|
|
11
|
+
color: SharedStyle.PRIMARY_COLOR.alt,
|
|
12
|
+
fontWeight: 300
|
|
13
|
+
};
|
|
14
|
+
export default function ContentTitle(_ref) {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
_ref$style = _ref.style,
|
|
17
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
|
18
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
return /*#__PURE__*/React.createElement("h1", _extends({
|
|
20
|
+
style: _objectSpread(_objectSpread({}, STYLE), style)
|
|
21
|
+
}, rest), children);
|
|
22
|
+
}
|
|
23
|
+
ContentTitle.propsType = {
|
|
24
|
+
style: PropTypes.object
|
|
25
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Button from "./button";
|
|
6
|
+
import * as SharedStyle from "../../shared-style";
|
|
7
|
+
var STYLE = {
|
|
8
|
+
borderColor: '#c12e2a',
|
|
9
|
+
backgroundColor: '#c9302c',
|
|
10
|
+
color: SharedStyle.COLORS.white
|
|
11
|
+
};
|
|
12
|
+
var STYLE_HOVER = {
|
|
13
|
+
backgroundColor: '#972726',
|
|
14
|
+
borderColor: '#c12e2a',
|
|
15
|
+
color: SharedStyle.COLORS.white
|
|
16
|
+
};
|
|
17
|
+
export default function FormDeleteButton(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
21
|
+
style: STYLE,
|
|
22
|
+
styleHover: STYLE_HOVER
|
|
23
|
+
}, rest), children);
|
|
24
|
+
}
|
|
@@ -1,5 +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";
|
|
1
9
|
import FormNumberInput from "./form-number-input";
|
|
2
|
-
|
|
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 };
|
|
3
16
|
export default {
|
|
4
|
-
|
|
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
|
|
5
31
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "style"];
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
var BASE_STYLE = {
|
|
9
|
+
marginBottom: '16px'
|
|
10
|
+
};
|
|
11
|
+
export default function FormBlock(_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
style = _ref.style,
|
|
14
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
16
|
+
style: _objectSpread(_objectSpread({}, BASE_STYLE), {}, {
|
|
17
|
+
style: style
|
|
18
|
+
})
|
|
19
|
+
}, rest), children);
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["onChange"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import FormTextInput from "./form-text-input";
|
|
6
|
+
var STYLE = {
|
|
7
|
+
padding: 0,
|
|
8
|
+
border: 0
|
|
9
|
+
};
|
|
10
|
+
var EREG_NUMBER = /^.*$/;
|
|
11
|
+
export default function FormColorInput(_ref) {
|
|
12
|
+
var onChange = _ref.onChange,
|
|
13
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
var onChangeCustom = function onChangeCustom(event) {
|
|
15
|
+
var value = event.target.value;
|
|
16
|
+
if (EREG_NUMBER.test(value)) {
|
|
17
|
+
onChange(event);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/React.createElement(FormTextInput, _extends({
|
|
21
|
+
type: "color",
|
|
22
|
+
style: STYLE,
|
|
23
|
+
onChange: onChangeCustom,
|
|
24
|
+
autoComplete: "off"
|
|
25
|
+
}, rest));
|
|
26
|
+
}
|