@zhangqingcq/vgce 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +75 -22
- package/dist/style.css +1 -1
- package/dist/vgce.js +406 -299
- package/dist/vgce.umd.cjs +4 -4
- package/package.json +1 -1
- package/src/assets/svgs/text-box.svg +1 -0
- package/src/components/svg-editor/center-panel.vue +146 -147
- package/src/components/svg-editor/index.vue +5 -1
- package/src/components/svg-viewer.vue +68 -69
- package/src/config/files/text-box.vue +72 -0
- package/src/config/index.ts +5 -3
- package/src/config/svg/animation/index.ts +3 -2
- package/src/config/svg/animation/thermometer.ts +2 -1
- package/src/config/svg/custom/clock-a.ts +2 -1
- package/src/config/svg/custom/index.ts +6 -5
- package/src/config/svg/custom/light.ts +2 -1
- package/src/config/svg/custom/svg-text.ts +2 -1
- package/src/config/svg/custom/switch-r.ts +2 -1
- package/src/config/svg/index.ts +6 -10
- package/src/config/svg/stateful/alert-light.ts +2 -1
- package/src/config/svg/stateful/index.ts +3 -2
- package/src/config/svg/stateless/bot-2.ts +2 -1
- package/src/config/svg/stateless/bot-9.ts +2 -1
- package/src/config/svg/stateless/hamburger.ts +2 -1
- package/src/config/svg/stateless/hotpot.ts +2 -1
- package/src/config/svg/stateless/index.ts +6 -5
- package/src/config/vue/component/button.ts +2 -1
- package/src/config/vue/component/common-table.ts +2 -1
- package/src/config/vue/component/index.ts +9 -7
- package/src/config/vue/component/now-time.ts +2 -1
- package/src/config/vue/component/progress.ts +2 -1
- package/src/config/vue/component/tag.ts +2 -1
- package/src/config/vue/component/text-box.ts +66 -0
- package/src/config/vue/echarts/index.ts +3 -2
- package/src/config/vue/echarts/pie-charts.ts +2 -1
- package/src/config/vue/index.ts +4 -3
- package/src/views/EditorS.vue +21 -21
- package/src/views/Preview.vue +38 -38
package/package.json
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1723449312323" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4279" width="48" height="48" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M938.666667 955.733333h-85.333334a17.066667 17.066667 0 0 1-17.066666-17.066666v-17.066667H187.733333v17.066667a17.066667 17.066667 0 0 1-17.066666 17.066666H85.333333a17.066667 17.066667 0 0 1-17.066666-17.066666v-85.333334a17.066667 17.066667 0 0 1 17.066666-17.066666h17.066667V187.733333H85.333333a17.066667 17.066667 0 0 1-17.066666-17.066666V85.333333a17.066667 17.066667 0 0 1 17.066666-17.066666h85.333334a17.066667 17.066667 0 0 1 17.066666 17.066666v17.066667h648.533334V85.333333a17.066667 17.066667 0 0 1 17.066666-17.066666h85.333334a17.066667 17.066667 0 0 1 17.066666 17.066666v85.333334a17.066667 17.066667 0 0 1-17.066666 17.066666h-17.066667v648.533334h17.066667a17.066667 17.066667 0 0 1 17.066666 17.066666v85.333334a17.066667 17.066667 0 0 1-17.066666 17.066666z m-68.266667-34.133333h51.2v-51.2h-51.2v51.2zM102.4 921.6h51.2v-51.2H102.4v51.2z m85.333333-34.133333h648.533334v-34.133334a17.066667 17.066667 0 0 1 17.066666-17.066666h34.133334V187.733333h-34.133334a17.066667 17.066667 0 0 1-17.066666-17.066666V136.533333H187.733333v34.133334a17.066667 17.066667 0 0 1-17.066666 17.066666H136.533333v648.533334h34.133334a17.066667 17.066667 0 0 1 17.066666 17.066666v34.133334zM904.533333 153.6h17.066667V102.4h-51.2v51.2h34.133333zM119.466667 153.6h34.133333V102.4H102.4v51.2h17.066667z" p-id="4280"></path></svg>
|
@@ -944,9 +944,10 @@
|
|
944
944
|
|
945
945
|
<template>
|
946
946
|
<div
|
947
|
+
ref="canvasRef"
|
947
948
|
class="canvas"
|
949
|
+
:style="{ backgroundColor: configStore.svg.background_color, position: 'relative' }"
|
948
950
|
tabindex="0"
|
949
|
-
ref="canvasRef"
|
950
951
|
@drop="dropEvent"
|
951
952
|
@dragenter="dragEnterEvent"
|
952
953
|
@dragover="dragOverEvent"
|
@@ -957,171 +958,169 @@
|
|
957
958
|
@keydown="onHandleKeyDown"
|
958
959
|
@mousewheel="onMousewheel"
|
959
960
|
>
|
960
|
-
<
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
</pattern>
|
973
|
-
</defs>
|
974
|
-
<rect v-if="configStore.svg.grid" width="100%" height="100%" fill="url(#pattern_grid)" />
|
975
|
-
<g
|
976
|
-
:transform="`translate(${svgEditLayoutStore.center_offset.x * configStore.svg.scale},${
|
977
|
-
svgEditLayoutStore.center_offset.y * configStore.svg.scale
|
978
|
-
})rotate(${0})scale(${configStore.svg.scale})`"
|
979
|
-
>
|
961
|
+
<slot name="background" />
|
962
|
+
<div style="position: absolute; left: 0; top: 0; bottom: 0; right: 0">
|
963
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
|
964
|
+
<defs>
|
965
|
+
<pattern id="pattern_grid" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20">
|
966
|
+
<line x1="0" y1="0" x2="0" y2="20" :stroke="configStore.svg.grid_color" />
|
967
|
+
<line x1="10" y1="0" x2="10" y2="20" :stroke="configStore.svg.grid_color" />
|
968
|
+
<line x1="0" y1="0" x2="20" y2="0" :stroke="configStore.svg.grid_color" />
|
969
|
+
<line x1="0" y1="10" x2="20" y2="10" :stroke="configStore.svg.grid_color" />
|
970
|
+
</pattern>
|
971
|
+
</defs>
|
972
|
+
<rect v-if="configStore.svg.grid" width="100%" height="100%" fill="url(#pattern_grid)" />
|
980
973
|
<g
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
v-show="item.display"
|
985
|
-
@mousewheel="stopEvent"
|
974
|
+
:transform="`translate(${svgEditLayoutStore.center_offset.x * configStore.svg.scale},${
|
975
|
+
svgEditLayoutStore.center_offset.y * configStore.svg.scale
|
976
|
+
})rotate(${0})scale(${configStore.svg.scale})`"
|
986
977
|
>
|
987
|
-
<g
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
@mouseup="onSvgMouseUp(item, index, $event)"
|
997
|
-
@mouseenter="onSvgMouseEnter(item, index, $event)"
|
998
|
-
@mouseleave="onSvgMouseLeave(item, index, $event)"
|
999
|
-
@contextmenu="onSvgContextMenuEvent(item, index, $event)"
|
1000
|
-
>
|
1001
|
-
<connection-line
|
1002
|
-
v-if="item.type === EDoneJsonType.ConnectionLine"
|
1003
|
-
:item-info="item"
|
1004
|
-
:point-visible="visible_info.connection_line && visible_info.select_item.info?.id == item.id"
|
1005
|
-
/>
|
1006
|
-
<use
|
1007
|
-
v-else-if="item.type === EDoneJsonType.File"
|
1008
|
-
:xlink:href="`#svg-${item.name}`"
|
1009
|
-
v-bind="prosToVBind(item, ['height', 'width'])"
|
1010
|
-
:width="item.props?.width?.val ?? 100"
|
1011
|
-
:height="item.props?.height?.val ?? 100"
|
1012
|
-
:id="item.id"
|
1013
|
-
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
1014
|
-
item.actual_bound.y + item.actual_bound.height / 2
|
1015
|
-
}) scale(${item.scale_x},${item.scale_y}) translate(${-(
|
1016
|
-
item.actual_bound.x +
|
1017
|
-
item.actual_bound.width / 2
|
1018
|
-
)},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
|
1019
|
-
/>
|
1020
|
-
<component
|
1021
|
-
v-else-if="item.type === EDoneJsonType.CustomSvg"
|
1022
|
-
:is="item.tag"
|
1023
|
-
v-bind="prosToVBind(item, ['height', 'width'])"
|
1024
|
-
:width="item.props?.width?.val ?? 100"
|
1025
|
-
:height="item.props?.height?.val ?? 100"
|
1026
|
-
:id="item.id"
|
1027
|
-
@resize="resizeBox"
|
978
|
+
<g
|
979
|
+
v-for="(item, index) in globalStore.done_json"
|
980
|
+
:key="item.id"
|
981
|
+
:transform="`translate(${item.x},${item.y})rotate(0)scale(1)`"
|
982
|
+
v-show="item.display"
|
983
|
+
@mousewheel="stopEvent"
|
984
|
+
>
|
985
|
+
<g :class="`${getCommonClass(item)}`">
|
986
|
+
<g
|
1028
987
|
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
1029
988
|
item.actual_bound.y + item.actual_bound.height / 2
|
1030
|
-
})
|
1031
|
-
item.actual_bound.
|
1032
|
-
item.actual_bound.
|
1033
|
-
)}
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
class="foreignObject"
|
989
|
+
})rotate(${item.rotate}) scale(1) translate(${-(item.actual_bound.x + item.actual_bound.width / 2)},${-(
|
990
|
+
item.actual_bound.y +
|
991
|
+
item.actual_bound.height / 2
|
992
|
+
)})`"
|
993
|
+
@mousedown="onSvgMouseDown(item, index, $event)"
|
994
|
+
@mouseup="onSvgMouseUp(item, index, $event)"
|
995
|
+
@mouseenter="onSvgMouseEnter(item, index, $event)"
|
996
|
+
@mouseleave="onSvgMouseLeave(item, index, $event)"
|
997
|
+
@contextmenu="onSvgContextMenuEvent(item, index, $event)"
|
1040
998
|
>
|
999
|
+
<connection-line
|
1000
|
+
v-if="item.type === EDoneJsonType.ConnectionLine"
|
1001
|
+
:item-info="item"
|
1002
|
+
:point-visible="visible_info.connection_line && visible_info.select_item.info?.id == item.id"
|
1003
|
+
/>
|
1004
|
+
<use
|
1005
|
+
v-else-if="item.type === EDoneJsonType.File"
|
1006
|
+
:xlink:href="`#svg-${item.name}`"
|
1007
|
+
v-bind="prosToVBind(item, ['height', 'width'])"
|
1008
|
+
:width="item.props?.width?.val ?? 100"
|
1009
|
+
:height="item.props?.height?.val ?? 100"
|
1010
|
+
:id="item.id"
|
1011
|
+
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
1012
|
+
item.actual_bound.y + item.actual_bound.height / 2
|
1013
|
+
}) scale(${item.scale_x},${item.scale_y}) translate(${-(
|
1014
|
+
item.actual_bound.x +
|
1015
|
+
item.actual_bound.width / 2
|
1016
|
+
)},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
|
1017
|
+
/>
|
1041
1018
|
<component
|
1019
|
+
v-else-if="item.type === EDoneJsonType.CustomSvg"
|
1042
1020
|
:is="item.tag"
|
1043
|
-
v-bind="prosToVBind(item)"
|
1021
|
+
v-bind="prosToVBind(item, ['height', 'width'])"
|
1022
|
+
:width="item.props?.width?.val ?? 100"
|
1023
|
+
:height="item.props?.height?.val ?? 100"
|
1044
1024
|
:id="item.id"
|
1025
|
+
@resize="resizeBox"
|
1045
1026
|
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
1046
1027
|
item.actual_bound.y + item.actual_bound.height / 2
|
1047
1028
|
}) scale(${item.scale_x},${item.scale_y}) translate(${-(
|
1048
1029
|
item.actual_bound.x +
|
1049
1030
|
item.actual_bound.width / 2
|
1050
1031
|
)},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1032
|
+
/>
|
1033
|
+
<foreignObject
|
1034
|
+
v-else-if="item.type === EDoneJsonType.Vue"
|
1035
|
+
v-bind="getActualBoundScale(item.actual_bound, item.scale_x, item.scale_y)"
|
1036
|
+
:id="`foreign-object${item.id}`"
|
1037
|
+
class="foreignObject"
|
1038
|
+
>
|
1039
|
+
<component
|
1040
|
+
:is="item.tag"
|
1041
|
+
v-bind="prosToVBind(item)"
|
1042
|
+
:id="item.id"
|
1043
|
+
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
1044
|
+
item.actual_bound.y + item.actual_bound.height / 2
|
1045
|
+
}) scale(${item.scale_x},${item.scale_y}) translate(${-(
|
1046
|
+
item.actual_bound.x +
|
1047
|
+
item.actual_bound.width / 2
|
1048
|
+
)},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
|
1049
|
+
>{{ item.tag_slot }}
|
1050
|
+
</component>
|
1051
|
+
</foreignObject>
|
1054
1052
|
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1053
|
+
<line
|
1054
|
+
v-else-if="item.type === EDoneJsonType.StraightLine"
|
1055
|
+
:id="item.id"
|
1056
|
+
:x1="item.props.start_x.val"
|
1057
|
+
:y1="item.props.start_y.val"
|
1058
|
+
:x2="item.props.end_x.val"
|
1059
|
+
:y2="item.props.end_y.val"
|
1060
|
+
fill="#FF0000"
|
1061
|
+
stroke="#FF0000"
|
1062
|
+
stroke-width="2"
|
1063
|
+
/>
|
1064
|
+
<rect
|
1065
|
+
v-if="item.config.actual_rect"
|
1066
|
+
:id="`rect${item.id}`"
|
1067
|
+
fill="black"
|
1068
|
+
fill-opacity="0"
|
1069
|
+
v-bind="getActualBoundScale(item.actual_bound, item.scale_x, item.scale_y)"
|
1070
|
+
style="stroke: none; stroke-width: 2; stroke-miterlimit: 10"
|
1071
|
+
:class="{
|
1072
|
+
'svg-item-none':
|
1073
|
+
!item.selected &&
|
1074
|
+
(globalStore.intention == EGlobalStoreIntention.None ||
|
1075
|
+
globalStore.intention == EGlobalStoreIntention.Select),
|
1076
|
+
'svg-item-move':
|
1077
|
+
globalStore.intention == EGlobalStoreIntention.Move &&
|
1078
|
+
globalStore.handle_svg_info?.info.id == item.id,
|
1079
|
+
'svg-item-select':
|
1080
|
+
globalStore.intention == EGlobalStoreIntention.Select &&
|
1081
|
+
globalStore.handle_svg_info?.info.id == item.id,
|
1082
|
+
'svg-item-in-group': item.selected
|
1083
|
+
}"
|
1084
|
+
/>
|
1087
1085
|
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1086
|
+
<handle-panel
|
1087
|
+
v-if="
|
1088
|
+
globalStore.handle_svg_info?.info.id === item.id &&
|
1089
|
+
visible_info.handle_panel &&
|
1090
|
+
item.type !== EDoneJsonType.ConnectionLine
|
1091
|
+
"
|
1092
|
+
:item-info="item"
|
1093
|
+
/>
|
1094
|
+
<connection-panel
|
1095
|
+
@contextmenu="onCanvasContextMenuEvent"
|
1096
|
+
v-if="
|
1097
|
+
!item.selected &&
|
1098
|
+
visible_info.select_item.info?.id == item.id &&
|
1099
|
+
visible_info.connection_panel &&
|
1100
|
+
item.config.have_anchor &&
|
1101
|
+
globalStore.intention !== EGlobalStoreIntention.SelectArea &&
|
1102
|
+
(globalStore.intention === EGlobalStoreIntention.Select
|
1103
|
+
? item.id !== globalStore.handle_svg_info?.info.id
|
1104
|
+
: true)
|
1105
|
+
"
|
1106
|
+
:item-info="item"
|
1107
|
+
/>
|
1108
|
+
</g>
|
1110
1109
|
</g>
|
1111
1110
|
</g>
|
1111
|
+
<!--框选-->
|
1112
|
+
<rect
|
1113
|
+
:x="selectRect.x"
|
1114
|
+
:y="selectRect.y"
|
1115
|
+
:height="selectRect.height"
|
1116
|
+
:width="selectRect.with"
|
1117
|
+
stroke="#107cec"
|
1118
|
+
fill="#107cec"
|
1119
|
+
fill-opacity=".2"
|
1120
|
+
/>
|
1112
1121
|
</g>
|
1113
|
-
|
1114
|
-
|
1115
|
-
:x="selectRect.x"
|
1116
|
-
:y="selectRect.y"
|
1117
|
-
:height="selectRect.height"
|
1118
|
-
:width="selectRect.with"
|
1119
|
-
stroke="#107cec"
|
1120
|
-
fill="#107cec"
|
1121
|
-
fill-opacity=".2"
|
1122
|
-
/>
|
1123
|
-
</g>
|
1124
|
-
</svg>
|
1122
|
+
</svg>
|
1123
|
+
</div>
|
1125
1124
|
</div>
|
1126
1125
|
<!-- 右键菜单 -->
|
1127
1126
|
<ul ref="contextMenuRef" class="contextMenu" v-show="contextMenuStore.display">
|
@@ -154,7 +154,11 @@
|
|
154
154
|
<el-main class="middle main">
|
155
155
|
<div class="canvas-main-pc">
|
156
156
|
<Vue3RulerTool class="canvas-main-pc" :visible="configStore.svg.ruler" @onLineMouseUp="onLineMouseUp">
|
157
|
-
<center-panel ref="centerRef" :vueComp="props.vueComp"
|
157
|
+
<center-panel ref="centerRef" :vueComp="props.vueComp">
|
158
|
+
<template #background>
|
159
|
+
<slot name="background" />
|
160
|
+
</template>
|
161
|
+
</center-panel>
|
158
162
|
</Vue3RulerTool>
|
159
163
|
</div>
|
160
164
|
</el-main>
|
@@ -279,83 +279,63 @@
|
|
279
279
|
<template>
|
280
280
|
<div
|
281
281
|
class="canvas"
|
282
|
+
:style="{ backgroundColor: preview_data.config.svg.background_color, position: 'relative' }"
|
282
283
|
@mousedown="onCanvasMouseDown"
|
283
284
|
@mousemove="onCanvasMouseMove"
|
284
285
|
@mouseup="onCanvasMouseUp"
|
285
286
|
@mousewheel="onMousewheel"
|
286
287
|
@contextmenu="preventDefault"
|
287
288
|
>
|
288
|
-
<
|
289
|
-
|
290
|
-
|
291
|
-
width="100%"
|
292
|
-
height="100%"
|
293
|
-
>
|
294
|
-
<g
|
295
|
-
:transform="`translate(${preview_data.layout_center.x},${preview_data.layout_center.y})rotate(${0})scale(${
|
296
|
-
preview_data.config.svg.scale
|
297
|
-
})`"
|
298
|
-
>
|
289
|
+
<slot name="background" />
|
290
|
+
<div style="position: absolute; left: 0; top: 0; bottom: 0; right: 0">
|
291
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
|
299
292
|
<g
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
v-show="item.display"
|
304
|
-
:style="getStyle(item)"
|
305
|
-
@click="eventHandle(item, EEventType.Click)"
|
306
|
-
@mousedown="stopEvent"
|
307
|
-
@mousemove="stopEvent"
|
308
|
-
@mouseup="stopEvent"
|
309
|
-
@mousewheel="stopEvent"
|
293
|
+
:transform="`translate(${preview_data.layout_center.x},${preview_data.layout_center.y})rotate(${0})scale(${
|
294
|
+
preview_data.config.svg.scale
|
295
|
+
})`"
|
310
296
|
>
|
311
|
-
<g
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
:width="item.props?.width?.val ?? 100"
|
326
|
-
:height="item.props?.height?.val ?? 100"
|
327
|
-
:id="item.id"
|
297
|
+
<g
|
298
|
+
v-for="item in preview_data.done_json"
|
299
|
+
:key="item.id"
|
300
|
+
:transform="`translate(${item.x},${item.y})rotate(0)scale(1)`"
|
301
|
+
v-show="item.display"
|
302
|
+
:style="getStyle(item)"
|
303
|
+
@click="eventHandle(item, EEventType.Click)"
|
304
|
+
@mousedown="stopEvent"
|
305
|
+
@mousemove="stopEvent"
|
306
|
+
@mouseup="stopEvent"
|
307
|
+
@mousewheel="stopEvent"
|
308
|
+
>
|
309
|
+
<g :class="`${getCommonClass(item)}`">
|
310
|
+
<g
|
328
311
|
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
329
312
|
item.actual_bound.y + item.actual_bound.height / 2
|
330
|
-
})
|
331
|
-
item.actual_bound.
|
332
|
-
item.actual_bound.
|
333
|
-
)}
|
334
|
-
/>
|
335
|
-
<component
|
336
|
-
v-else-if="item.type === EDoneJsonType.CustomSvg"
|
337
|
-
:is="item.tag"
|
338
|
-
v-bind="prosToVBind(item, ['height', 'width'])"
|
339
|
-
:width="item.props?.width?.val ?? 100"
|
340
|
-
:height="item.props?.height?.val ?? 100"
|
341
|
-
:id="item.id"
|
342
|
-
@on-change="eventHandle(item, EEventType.Change)"
|
343
|
-
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
344
|
-
item.actual_bound.y + item.actual_bound.height / 2
|
345
|
-
}) scale(${item.scale_x},${item.scale_y}) translate(${-(
|
346
|
-
item.actual_bound.x +
|
347
|
-
item.actual_bound.width / 2
|
348
|
-
)},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
|
349
|
-
/>
|
350
|
-
<foreignObject
|
351
|
-
v-else-if="item.type === EDoneJsonType.Vue"
|
352
|
-
v-bind="getActualBoundScale(item.actual_bound, item.scale_x, item.scale_y)"
|
353
|
-
:id="`foreign-object${item.id}`"
|
354
|
-
class="foreignObject"
|
313
|
+
})rotate(${item.rotate}) scale(1) translate(${-(item.actual_bound.x + item.actual_bound.width / 2)},${-(
|
314
|
+
item.actual_bound.y +
|
315
|
+
item.actual_bound.height / 2
|
316
|
+
)})`"
|
355
317
|
>
|
318
|
+
<connection-line v-if="item.type === EDoneJsonType.ConnectionLine" :item-info="item" />
|
319
|
+
<use
|
320
|
+
v-else-if="item.type === EDoneJsonType.File"
|
321
|
+
:xlink:href="`#svg-${item.name}`"
|
322
|
+
v-bind="prosToVBind(item, ['height', 'width'])"
|
323
|
+
:width="item.props?.width?.val ?? 100"
|
324
|
+
:height="item.props?.height?.val ?? 100"
|
325
|
+
:id="item.id"
|
326
|
+
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
327
|
+
item.actual_bound.y + item.actual_bound.height / 2
|
328
|
+
}) scale(${item.scale_x},${item.scale_y}) translate(${-(
|
329
|
+
item.actual_bound.x +
|
330
|
+
item.actual_bound.width / 2
|
331
|
+
)},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
|
332
|
+
/>
|
356
333
|
<component
|
334
|
+
v-else-if="item.type === EDoneJsonType.CustomSvg"
|
357
335
|
:is="item.tag"
|
358
|
-
v-bind="prosToVBind(item)"
|
336
|
+
v-bind="prosToVBind(item, ['height', 'width'])"
|
337
|
+
:width="item.props?.width?.val ?? 100"
|
338
|
+
:height="item.props?.height?.val ?? 100"
|
359
339
|
:id="item.id"
|
360
340
|
@on-change="eventHandle(item, EEventType.Change)"
|
361
341
|
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
@@ -364,14 +344,33 @@
|
|
364
344
|
item.actual_bound.x +
|
365
345
|
item.actual_bound.width / 2
|
366
346
|
)},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
|
367
|
-
|
368
|
-
|
369
|
-
|
347
|
+
/>
|
348
|
+
<foreignObject
|
349
|
+
v-else-if="item.type === EDoneJsonType.Vue"
|
350
|
+
v-bind="getActualBoundScale(item.actual_bound, item.scale_x, item.scale_y)"
|
351
|
+
:id="`foreign-object${item.id}`"
|
352
|
+
class="foreignObject"
|
353
|
+
>
|
354
|
+
<component
|
355
|
+
:is="item.tag"
|
356
|
+
v-bind="prosToVBind(item)"
|
357
|
+
:id="item.id"
|
358
|
+
@on-change="eventHandle(item, EEventType.Change)"
|
359
|
+
:transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
|
360
|
+
item.actual_bound.y + item.actual_bound.height / 2
|
361
|
+
}) scale(${item.scale_x},${item.scale_y}) translate(${-(
|
362
|
+
item.actual_bound.x +
|
363
|
+
item.actual_bound.width / 2
|
364
|
+
)},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
|
365
|
+
>{{ item.tag_slot }}
|
366
|
+
</component>
|
367
|
+
</foreignObject>
|
368
|
+
</g>
|
370
369
|
</g>
|
371
370
|
</g>
|
372
371
|
</g>
|
373
|
-
</
|
374
|
-
</
|
372
|
+
</svg>
|
373
|
+
</div>
|
375
374
|
</div>
|
376
375
|
</template>
|
377
376
|
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import { computed } from 'vue'
|
3
|
+
|
4
|
+
const props = withDefaults(
|
5
|
+
defineProps<{
|
6
|
+
width: number
|
7
|
+
height: number
|
8
|
+
bgColor: string
|
9
|
+
bgOpacity: number
|
10
|
+
borderColor: string
|
11
|
+
borderWidth: number
|
12
|
+
borderRadius: number
|
13
|
+
borderOpacity: number
|
14
|
+
}>(),
|
15
|
+
{
|
16
|
+
width: 250,
|
17
|
+
height: 150,
|
18
|
+
bgColor: '#ffffff',
|
19
|
+
bgOpacity: 50,
|
20
|
+
borderColor: '#000000',
|
21
|
+
borderWidth: 1,
|
22
|
+
borderRadius: 5,
|
23
|
+
borderOpacity: 100
|
24
|
+
}
|
25
|
+
)
|
26
|
+
const styleOut = computed(() => {
|
27
|
+
return {
|
28
|
+
width: (props.width > 0 ? props.width : 0) + 'px',
|
29
|
+
height: (props.height > 0 ? props.height : 0) + 'px',
|
30
|
+
borderRadius: (props.borderRadius > 0 ? props.borderRadius : 0) + 'px'
|
31
|
+
}
|
32
|
+
})
|
33
|
+
const styleBorder = computed(() => {
|
34
|
+
return {
|
35
|
+
border: `${props.borderWidth > 0 ? props.borderWidth : 0}px solid ${props.borderColor}`,
|
36
|
+
borderRadius: (props.borderRadius > 0 ? props.borderRadius : 0) + 'px',
|
37
|
+
opacity: (props.borderOpacity > 0 ? (props.borderOpacity < 100 ? props.borderOpacity : 100) : 0) / 100
|
38
|
+
}
|
39
|
+
})
|
40
|
+
const styleM = computed(() => {
|
41
|
+
return {
|
42
|
+
backgroundColor: props.bgColor,
|
43
|
+
opacity: (props.bgOpacity > 0 ? (props.bgOpacity < 100 ? props.bgOpacity : 100) : 0) / 100,
|
44
|
+
borderRadius: props.borderRadius + 'px'
|
45
|
+
}
|
46
|
+
})
|
47
|
+
</script>
|
48
|
+
|
49
|
+
<template>
|
50
|
+
<div class="outM" :style="styleOut">
|
51
|
+
<div class="wallI" :style="styleM"></div>
|
52
|
+
<div class="borderB" :style="styleBorder"></div>
|
53
|
+
</div>
|
54
|
+
</template>
|
55
|
+
|
56
|
+
<style scoped lang="less">
|
57
|
+
.outM {
|
58
|
+
position: relative;
|
59
|
+
}
|
60
|
+
|
61
|
+
.borderB,
|
62
|
+
.wallI {
|
63
|
+
height: 100%;
|
64
|
+
}
|
65
|
+
|
66
|
+
.borderB {
|
67
|
+
position: absolute;
|
68
|
+
width: 100%;
|
69
|
+
top: 0;
|
70
|
+
left: 0;
|
71
|
+
}
|
72
|
+
</style>
|
package/src/config/index.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { IConfig } from './types'
|
2
|
-
import
|
3
|
-
import
|
2
|
+
import svg_config from './svg'
|
3
|
+
import vue_config from './vue'
|
4
4
|
|
5
5
|
import { ElButton, ElTag } from 'element-plus'
|
6
6
|
import Progress from '@/config/files/progress.vue'
|
@@ -11,6 +11,7 @@ import NowTime from '@/config/files/now-time.vue'
|
|
11
11
|
import PieCharts from '@/config/files/pie-charts.vue'
|
12
12
|
import LightA from '@/config/files/light-a.vue'
|
13
13
|
import ClockA from '@/config/files/clock-a.vue'
|
14
|
+
import TextBox from '@/config/files/text-box.vue'
|
14
15
|
|
15
16
|
export const vueComp: Record<string, any> = {
|
16
17
|
'svg-text': SvgText,
|
@@ -22,7 +23,8 @@ export const vueComp: Record<string, any> = {
|
|
22
23
|
'switch-r': SwitchR,
|
23
24
|
'now-time': NowTime,
|
24
25
|
'light-a': LightA,
|
25
|
-
'clock-a': ClockA
|
26
|
+
'clock-a': ClockA,
|
27
|
+
'text-box': TextBox
|
26
28
|
}
|
27
29
|
|
28
30
|
export const config: IConfig = [...svg_config, ...vue_config]
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import type { IConfigComponentGroup } from '../../types'
|
2
|
-
import
|
2
|
+
import thermometer from './thermometer'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigComponentGroup = {
|
5
5
|
groupType: 'have_animation',
|
6
6
|
title: '动画SVG',
|
7
7
|
list: [thermometer]
|
8
8
|
}
|
9
|
+
export default t
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
|
-
|
3
|
+
const t: IConfigItem = {
|
4
4
|
name: 'thermometer',
|
5
5
|
title: '温度计',
|
6
6
|
type: EDoneJsonType.File,
|
@@ -19,3 +19,4 @@ export const thermometer: IConfigItem = {
|
|
19
19
|
},
|
20
20
|
events: []
|
21
21
|
}
|
22
|
+
export default t
|