@zhangqingcq/vgce 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +35 -20
  2. package/dist/style.css +1 -1
  3. package/dist/vgce.js +147 -51
  4. package/dist/vgce.umd.cjs +2 -2
  5. package/package.json +1 -1
  6. package/src/assets/svgs/text-box.svg +1 -0
  7. package/src/config/files/text-box.vue +72 -0
  8. package/src/config/index.ts +5 -3
  9. package/src/config/svg/animation/index.ts +3 -2
  10. package/src/config/svg/animation/thermometer.ts +2 -1
  11. package/src/config/svg/custom/clock-a.ts +2 -1
  12. package/src/config/svg/custom/index.ts +6 -5
  13. package/src/config/svg/custom/light.ts +2 -1
  14. package/src/config/svg/custom/svg-text.ts +2 -1
  15. package/src/config/svg/custom/switch-r.ts +2 -1
  16. package/src/config/svg/index.ts +6 -10
  17. package/src/config/svg/stateful/alert-light.ts +2 -1
  18. package/src/config/svg/stateful/index.ts +3 -2
  19. package/src/config/svg/stateless/bot-2.ts +2 -1
  20. package/src/config/svg/stateless/bot-9.ts +2 -1
  21. package/src/config/svg/stateless/hamburger.ts +2 -1
  22. package/src/config/svg/stateless/hotpot.ts +2 -1
  23. package/src/config/svg/stateless/index.ts +6 -5
  24. package/src/config/vue/component/button.ts +2 -1
  25. package/src/config/vue/component/common-table.ts +2 -1
  26. package/src/config/vue/component/index.ts +9 -7
  27. package/src/config/vue/component/now-time.ts +2 -1
  28. package/src/config/vue/component/progress.ts +2 -1
  29. package/src/config/vue/component/tag.ts +2 -1
  30. package/src/config/vue/component/text-box.ts +66 -0
  31. package/src/config/vue/echarts/index.ts +3 -2
  32. package/src/config/vue/echarts/pie-charts.ts +2 -1
  33. package/src/config/vue/index.ts +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangqingcq/vgce",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Vector graphics configure editor. svg组态编辑器。基于vue3.3+ts+element-plus+vite",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -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>
@@ -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>
@@ -1,6 +1,6 @@
1
1
  import type { IConfig } from './types'
2
- import { svg_config } from './svg'
3
- import { vue_config } from './vue'
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 { thermometer } from './thermometer'
2
+ import thermometer from './thermometer'
3
3
 
4
- export const animation_group: IConfigComponentGroup = {
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
- export const thermometer: IConfigItem = {
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
@@ -1,7 +1,7 @@
1
1
  import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
2
2
  import type { IConfigItem } from '@/config/types'
3
3
 
4
- export const clock_a: IConfigItem = {
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 { 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'
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
- export const custom_svg_group: IConfigComponentGroup = {
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
- export const light_a: IConfigItem = {
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
- export const svg_text: IConfigItem = {
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
- export const switch_r: IConfigItem = {
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
@@ -1,12 +1,8 @@
1
1
  import type { IConfigComponentGroup } from '../types'
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'
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
- export const svg_config: IConfigComponentGroup[] = Object.seal([
8
- stateless_group,
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
- export const svg_alert_light: IConfigItem = {
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 { svg_alert_light } from './alert-light'
2
+ import svg_alert_light from './alert-light'
3
3
 
4
- export const stateful_group: IConfigComponentGroup = {
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
- export const svg_bot_2: IConfigItem = {
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
- export const svg_bot_9: IConfigItem = {
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
- export const svg_hamburger: IConfigItem = {
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
- export const svg_hotpot: IConfigItem = {
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 { 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'
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
- export const stateless_group: IConfigComponentGroup = {
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
- export const el_button: IConfigItem = {
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
- export const common_table: IConfigItem = {
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 { 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'
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
- export const components: IConfigComponentGroup = {
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
- export const now_time: IConfigItem = {
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
- export const progress_a: IConfigItem = {
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
- export const el_tag: IConfigItem = {
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 { pie_charts } from './pie-charts'
2
+ import pie_charts from './pie-charts'
3
3
 
4
- export const echarts_group: IConfigComponentGroup = {
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
- export const pie_charts: IConfigItem = {
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
@@ -1,5 +1,6 @@
1
1
  import type { IConfigComponentGroup } from '../types'
2
- import { components } from './component'
3
- import { echarts_group } from './echarts'
2
+ import components from './component'
3
+ import echarts_group from './echarts'
4
4
 
5
- export const vue_config: IConfigComponentGroup[] = Object.seal([components, echarts_group])
5
+ const t: IConfigComponentGroup[] = Object.seal([components, echarts_group])
6
+ export default t