@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
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'clock-a',
|
6
6
|
title: '时钟',
|
7
7
|
tag: 'clock-a',
|
@@ -62,3 +62,4 @@ export const clock_a: IConfigItem = {
|
|
62
62
|
},
|
63
63
|
events: []
|
64
64
|
}
|
65
|
+
export default t
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import type { IConfigComponentGroup } from '../../types'
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
2
|
+
import svg_text from './svg-text'
|
3
|
+
import switch_r from './switch-r'
|
4
|
+
import light_a from '@/config/svg/custom/light'
|
5
|
+
import clock_a from '@/config/svg/custom/clock-a'
|
6
6
|
|
7
|
-
|
7
|
+
const t: IConfigComponentGroup = {
|
8
8
|
groupType: 'custom_svg_group',
|
9
9
|
title: 'SVG组件',
|
10
10
|
list: [svg_text, switch_r, light_a, clock_a]
|
11
11
|
}
|
12
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'light',
|
6
6
|
tag: 'light-a',
|
7
7
|
title: '灯',
|
@@ -37,3 +37,4 @@ export const light_a: IConfigItem = {
|
|
37
37
|
},
|
38
38
|
events: []
|
39
39
|
}
|
40
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'svg-text',
|
6
6
|
title: '文字',
|
7
7
|
tag: 'svg-text',
|
@@ -81,3 +81,4 @@ export const svg_text: IConfigItem = {
|
|
81
81
|
},
|
82
82
|
events: []
|
83
83
|
}
|
84
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'switch-r',
|
6
6
|
title: '开关',
|
7
7
|
tag: 'switch-r',
|
@@ -27,3 +27,4 @@ export const switch_r: IConfigItem = {
|
|
27
27
|
},
|
28
28
|
events: []
|
29
29
|
}
|
30
|
+
export default t
|
package/src/config/svg/index.ts
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
import type { IConfigComponentGroup } from '../types'
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
2
|
+
import stateful_group from './stateful'
|
3
|
+
import stateless_group from './stateless'
|
4
|
+
import animation_group from './animation'
|
5
|
+
import custom_svg_group from './custom'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
stateful_group,
|
10
|
-
animation_group,
|
11
|
-
custom_svg_group
|
12
|
-
])
|
7
|
+
const t: IConfigComponentGroup[] = Object.seal([stateless_group, stateful_group, animation_group, custom_svg_group])
|
8
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'alert-light',
|
6
6
|
title: '警示灯',
|
7
7
|
type: EDoneJsonType.File,
|
@@ -31,3 +31,4 @@ export const svg_alert_light: IConfigItem = {
|
|
31
31
|
},
|
32
32
|
events: []
|
33
33
|
}
|
34
|
+
export default t
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import type { IConfigComponentGroup } from '../../types'
|
2
|
-
import
|
2
|
+
import svg_alert_light from './alert-light'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigComponentGroup = {
|
5
5
|
groupType: 'stateful',
|
6
6
|
title: '状态SVG',
|
7
7
|
list: [svg_alert_light]
|
8
8
|
}
|
9
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'bot-2',
|
6
6
|
title: '2号机',
|
7
7
|
type: EDoneJsonType.File,
|
@@ -31,3 +31,4 @@ export const svg_bot_2: IConfigItem = {
|
|
31
31
|
},
|
32
32
|
events: []
|
33
33
|
}
|
34
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'bot-9',
|
6
6
|
title: '9号机',
|
7
7
|
type: EDoneJsonType.File,
|
@@ -20,3 +20,4 @@ export const svg_bot_9: IConfigItem = {
|
|
20
20
|
},
|
21
21
|
events: []
|
22
22
|
}
|
23
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'hamburger',
|
6
6
|
title: '汉堡',
|
7
7
|
type: EDoneJsonType.File,
|
@@ -20,3 +20,4 @@ export const svg_hamburger: IConfigItem = {
|
|
20
20
|
},
|
21
21
|
events: []
|
22
22
|
}
|
23
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'hotpot',
|
6
6
|
title: '火锅',
|
7
7
|
type: EDoneJsonType.File,
|
@@ -20,3 +20,4 @@ export const svg_hotpot: IConfigItem = {
|
|
20
20
|
},
|
21
21
|
events: []
|
22
22
|
}
|
23
|
+
export default t
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import type { IConfigComponentGroup } from '@/config/types'
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
2
|
+
import svg_bot_2 from './bot-2'
|
3
|
+
import svg_bot_9 from './bot-9'
|
4
|
+
import svg_hotpot from './hotpot'
|
5
|
+
import svg_hamburger from './hamburger'
|
6
6
|
|
7
|
-
|
7
|
+
const t: IConfigComponentGroup = {
|
8
8
|
groupType: 'stateless',
|
9
9
|
title: '静态SVG',
|
10
10
|
list: [svg_hamburger, svg_hotpot, svg_bot_2, svg_bot_9]
|
11
11
|
}
|
12
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'el-button',
|
6
6
|
tag: 'el-button',
|
7
7
|
title: '按钮',
|
@@ -55,3 +55,4 @@ export const el_button: IConfigItem = {
|
|
55
55
|
},
|
56
56
|
events: []
|
57
57
|
}
|
58
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'common-table',
|
6
6
|
title: '通用表格',
|
7
7
|
tag: 'common-table',
|
@@ -127,3 +127,4 @@ export const common_table: IConfigItem = {
|
|
127
127
|
},
|
128
128
|
events: []
|
129
129
|
}
|
130
|
+
export default t
|
@@ -1,13 +1,15 @@
|
|
1
1
|
import type { IConfigComponentGroup } from '@/config/types'
|
2
2
|
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
3
|
+
import el_button from './button'
|
4
|
+
import common_table from './common-table'
|
5
|
+
import now_time from './now-time'
|
6
|
+
import el_tag from './tag'
|
7
|
+
import progress_a from './progress'
|
8
|
+
import textBox from './text-box'
|
8
9
|
|
9
|
-
|
10
|
+
const t: IConfigComponentGroup = {
|
10
11
|
groupType: 'custom-vue',
|
11
12
|
title: 'VUE组件',
|
12
|
-
list: [el_button, progress_a, common_table, now_time, el_tag]
|
13
|
+
list: [el_button, progress_a, common_table, now_time, el_tag, textBox]
|
13
14
|
}
|
15
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'now-time',
|
6
6
|
title: '当前时间',
|
7
7
|
tag: 'now-time',
|
@@ -61,3 +61,4 @@ export const now_time: IConfigItem = {
|
|
61
61
|
},
|
62
62
|
events: []
|
63
63
|
}
|
64
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'progress-a',
|
6
6
|
tag: 'progress-a',
|
7
7
|
title: '进度条',
|
@@ -27,3 +27,4 @@ export const progress_a: IConfigItem = {
|
|
27
27
|
},
|
28
28
|
events: []
|
29
29
|
}
|
30
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'el-tag',
|
6
6
|
tag: 'el-tag',
|
7
7
|
title: '标签',
|
@@ -44,3 +44,4 @@ export const el_tag: IConfigItem = {
|
|
44
44
|
},
|
45
45
|
events: []
|
46
46
|
}
|
47
|
+
export default t
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
|
+
import type { IConfigItem } from '@/config/types'
|
3
|
+
|
4
|
+
const t: IConfigItem = {
|
5
|
+
name: 'text-box',
|
6
|
+
title: '文字背景框',
|
7
|
+
tag: 'text-box',
|
8
|
+
type: EDoneJsonType.Vue,
|
9
|
+
config: {
|
10
|
+
can_zoom: false,
|
11
|
+
have_anchor: false,
|
12
|
+
actual_rect: true
|
13
|
+
},
|
14
|
+
display: true,
|
15
|
+
props: {
|
16
|
+
width: {
|
17
|
+
title: '宽度',
|
18
|
+
type: EConfigItemPropsType.InputNumber,
|
19
|
+
val: 250
|
20
|
+
},
|
21
|
+
height: {
|
22
|
+
title: '高度',
|
23
|
+
type: EConfigItemPropsType.InputNumber,
|
24
|
+
val: 150
|
25
|
+
},
|
26
|
+
bgColor: {
|
27
|
+
title: '背景颜色',
|
28
|
+
type: EConfigItemPropsType.Color,
|
29
|
+
val: '#000000'
|
30
|
+
},
|
31
|
+
bgOpacity: {
|
32
|
+
title: '背景透明度(%)',
|
33
|
+
type: EConfigItemPropsType.InputNumber,
|
34
|
+
val: 1
|
35
|
+
},
|
36
|
+
borderColor: {
|
37
|
+
title: '边框颜色',
|
38
|
+
type: EConfigItemPropsType.Color,
|
39
|
+
val: '#cccccc'
|
40
|
+
},
|
41
|
+
borderWidth: {
|
42
|
+
title: '边框宽度',
|
43
|
+
type: EConfigItemPropsType.InputNumber,
|
44
|
+
val: 1
|
45
|
+
},
|
46
|
+
borderRadius: {
|
47
|
+
title: '边框圆角',
|
48
|
+
type: EConfigItemPropsType.InputNumber,
|
49
|
+
val: 5
|
50
|
+
},
|
51
|
+
borderOpacity: {
|
52
|
+
title: '边框透明度(%)',
|
53
|
+
type: EConfigItemPropsType.InputNumber,
|
54
|
+
val: 100
|
55
|
+
}
|
56
|
+
},
|
57
|
+
common_animations: {
|
58
|
+
val: '',
|
59
|
+
delay: 'delay-0s',
|
60
|
+
speed: 'slow',
|
61
|
+
repeat: 'infinite'
|
62
|
+
},
|
63
|
+
events: []
|
64
|
+
}
|
65
|
+
|
66
|
+
export default t
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import type { IConfigComponentGroup } from '@/config/types'
|
2
|
-
import
|
2
|
+
import pie_charts from './pie-charts'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigComponentGroup = {
|
5
5
|
groupType: 'echarts',
|
6
6
|
title: '图表',
|
7
7
|
list: [pie_charts]
|
8
8
|
}
|
9
|
+
export default t
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
2
|
import type { IConfigItem } from '@/config/types'
|
3
3
|
|
4
|
-
|
4
|
+
const t: IConfigItem = {
|
5
5
|
name: 'pie-charts',
|
6
6
|
tag: 'pie-charts',
|
7
7
|
title: '饼图',
|
@@ -58,3 +58,4 @@ export const pie_charts: IConfigItem = {
|
|
58
58
|
},
|
59
59
|
events: []
|
60
60
|
}
|
61
|
+
export default t
|
package/src/config/vue/index.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { IConfigComponentGroup } from '../types'
|
2
|
-
import
|
3
|
-
import
|
2
|
+
import components from './component'
|
3
|
+
import echarts_group from './echarts'
|
4
4
|
|
5
|
-
|
5
|
+
const t: IConfigComponentGroup[] = Object.seal([components, echarts_group])
|
6
|
+
export default t
|
package/src/views/EditorS.vue
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import SvgEditor from '@/components/svg-editor/index.vue'
|
3
|
-
import { useStore } from '@/stores/main'
|
4
|
-
import type { IDataModel } from '@/components/svg-editor/types'
|
5
|
-
import Preview from './Preview.vue'
|
6
|
-
|
7
|
-
const store = useStore()
|
8
|
-
|
9
|
-
const previewShow = ref(false)
|
10
|
-
function previewHandle(d: IDataModel) {
|
11
|
-
store.data = d
|
12
|
-
nextTick(function () {
|
13
|
-
previewShow.value = true
|
14
|
-
})
|
15
|
-
}
|
16
|
-
</script>
|
17
|
-
|
18
|
-
<template>
|
19
|
-
<SvgEditor :data="(store.data && JSON.stringify(store.data)) || ''" @onPreview="previewHandle" saveFile />
|
20
|
-
<Preview v-if="previewShow" @back="previewShow = false" />
|
21
|
-
</template>
|
1
|
+
<script setup lang="ts">
|
2
|
+
import SvgEditor from '@/components/svg-editor/index.vue'
|
3
|
+
import { useStore } from '@/stores/main'
|
4
|
+
import type { IDataModel } from '@/components/svg-editor/types'
|
5
|
+
import Preview from './Preview.vue'
|
6
|
+
|
7
|
+
const store = useStore()
|
8
|
+
|
9
|
+
const previewShow = ref(false)
|
10
|
+
function previewHandle(d: IDataModel) {
|
11
|
+
store.data = d
|
12
|
+
nextTick(function () {
|
13
|
+
previewShow.value = true
|
14
|
+
})
|
15
|
+
}
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<template>
|
19
|
+
<SvgEditor :data="(store.data && JSON.stringify(store.data)) || ''" @onPreview="previewHandle" saveFile />
|
20
|
+
<Preview v-if="previewShow" @back="previewShow = false" />
|
21
|
+
</template>
|
package/src/views/Preview.vue
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import SvgViewer from '@/components/svg-viewer.vue'
|
3
|
-
import { ElButton } from 'element-plus'
|
4
|
-
import { ArrowLeftBold } from '@element-plus/icons-vue'
|
5
|
-
import { useStore } from '@/stores/main'
|
6
|
-
|
7
|
-
const emit = defineEmits(['back'])
|
8
|
-
const store = useStore()
|
9
|
-
|
10
|
-
function back() {
|
11
|
-
emit('back')
|
12
|
-
}
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<template>
|
16
|
-
<div class="previewPage">
|
17
|
-
<svg-viewer :data="store.data" />
|
18
|
-
<el-button @click="back" class="backBtn" :icon="ArrowLeftBold">返回</el-button>
|
19
|
-
</div>
|
20
|
-
</template>
|
21
|
-
|
22
|
-
<style lang="less" scoped>
|
23
|
-
.previewPage {
|
24
|
-
position: fixed;
|
25
|
-
z-index: 1000;
|
26
|
-
left: 0;
|
27
|
-
right: 0;
|
28
|
-
top: 0;
|
29
|
-
bottom: 0;
|
30
|
-
|
31
|
-
.backBtn {
|
32
|
-
position: absolute;
|
33
|
-
top: 20px;
|
34
|
-
right: 30px;
|
35
|
-
z-index: 100;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
</style>
|
1
|
+
<script setup lang="ts">
|
2
|
+
import SvgViewer from '@/components/svg-viewer.vue'
|
3
|
+
import { ElButton } from 'element-plus'
|
4
|
+
import { ArrowLeftBold } from '@element-plus/icons-vue'
|
5
|
+
import { useStore } from '@/stores/main'
|
6
|
+
|
7
|
+
const emit = defineEmits(['back'])
|
8
|
+
const store = useStore()
|
9
|
+
|
10
|
+
function back() {
|
11
|
+
emit('back')
|
12
|
+
}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<template>
|
16
|
+
<div class="previewPage">
|
17
|
+
<svg-viewer :data="store.data" />
|
18
|
+
<el-button @click="back" class="backBtn" :icon="ArrowLeftBold">返回</el-button>
|
19
|
+
</div>
|
20
|
+
</template>
|
21
|
+
|
22
|
+
<style lang="less" scoped>
|
23
|
+
.previewPage {
|
24
|
+
position: fixed;
|
25
|
+
z-index: 1000;
|
26
|
+
left: 0;
|
27
|
+
right: 0;
|
28
|
+
top: 0;
|
29
|
+
bottom: 0;
|
30
|
+
|
31
|
+
.backBtn {
|
32
|
+
position: absolute;
|
33
|
+
top: 20px;
|
34
|
+
right: 30px;
|
35
|
+
z-index: 100;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
</style>
|