@zhangqingcq/vgce 0.0.14 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +38 -3
- package/dist/vgce.js +5040 -5305
- package/dist/vgce.umd.cjs +43 -143
- package/package.json +3 -2
- package/src/App.vue +11 -0
- package/src/assets/base.less +49 -0
- package/src/assets/icons/add.svg +1 -0
- package/src/assets/icons/delete.svg +12 -0
- package/src/assets/icons/export.svg +1 -0
- package/src/assets/icons/group.svg +13 -0
- package/src/assets/icons/import.svg +1 -0
- package/src/assets/icons/lock.svg +7 -0
- package/src/assets/icons/menu-fold.svg +9 -0
- package/src/assets/icons/menu-unfold.svg +9 -0
- package/src/assets/icons/preview.svg +6 -0
- package/src/assets/icons/redo.svg +8 -0
- package/src/assets/icons/return.svg +8 -0
- package/src/assets/icons/rotate.svg +1 -0
- package/src/assets/icons/save.svg +9 -0
- package/src/assets/icons/setting.svg +6 -0
- package/src/assets/icons/undo.svg +7 -0
- package/src/assets/icons/ungroup.svg +16 -0
- package/src/assets/icons/unlock.svg +7 -0
- package/src/assets/main.less +6 -0
- package/src/assets/svgs/alternator.svg +8 -0
- package/src/assets/svgs/bot-2.svg +1 -0
- package/src/assets/svgs/circuit-breaker.svg +11 -0
- package/src/assets/svgs/clock-a.svg +23 -0
- package/src/assets/svgs/common-table.svg +7 -0
- package/src/assets/svgs/el-button.svg +10 -0
- package/src/assets/svgs/el-tag.svg +13 -0
- package/src/assets/svgs/house.svg +1 -0
- package/src/assets/svgs/light.svg +24 -0
- package/src/assets/svgs/now-time.svg +9 -0
- package/src/assets/svgs/package.svg +1 -0
- package/src/assets/svgs/pie-charts.svg +10 -0
- package/src/assets/svgs/progress-a.svg +1 -0
- package/src/assets/svgs/reservoir.svg +10 -0
- package/src/assets/svgs/svg-text.svg +5 -0
- package/src/assets/svgs/switch-a.svg +5 -0
- package/src/components/ace-edit/index.ts +27 -0
- package/src/components/config/index.ts +450 -0
- package/src/components/config/types.ts +25 -0
- package/src/components/svg-analysis/index.vue +11 -0
- package/src/components/svg-editor/center-panel/index.vue +867 -0
- package/src/components/svg-editor/center-panel/types.ts +11 -0
- package/src/components/svg-editor/component-tree/index.vue +33 -0
- package/src/components/svg-editor/connection-line/index.vue +125 -0
- package/src/components/svg-editor/connection-panel/index.vue +198 -0
- package/src/components/svg-editor/export-json/index.vue +37 -0
- package/src/components/svg-editor/handle-panel/index.vue +342 -0
- package/src/components/svg-editor/import-json/index.vue +37 -0
- package/src/components/svg-editor/index.vue +280 -0
- package/src/components/svg-editor/left-panel/index.vue +83 -0
- package/src/components/svg-editor/right-panel/code-edit-modal.vue +50 -0
- package/src/components/svg-editor/right-panel/common-animate.vue +96 -0
- package/src/components/svg-editor/right-panel/condition.vue +101 -0
- package/src/components/svg-editor/right-panel/dynamic-el-form-item.vue +97 -0
- package/src/components/svg-editor/right-panel/index.vue +304 -0
- package/src/components/svg-editor/right-panel/list.vue +86 -0
- package/src/components/svg-editor/top-panel/index.vue +139 -0
- package/src/components/svg-editor/types.ts +22 -0
- package/src/components/svg-viewer/index.vue +340 -0
- package/src/components/vue3-ruler-tool/index.vue +506 -0
- package/src/config/files/clock-a.vue +66 -0
- package/src/config/files/common-table.vue +49 -0
- package/src/config/files/light-a.vue +72 -0
- package/src/config/files/now-time.vue +53 -0
- package/src/config/files/pie-charts.vue +72 -0
- package/src/config/files/progress.vue +40 -0
- package/src/config/files/svg-text.vue +39 -0
- package/src/config/files/switch-a.vue +45 -0
- package/src/config/index.ts +28 -0
- package/src/config/svg/animation/index.ts +8 -0
- package/src/config/svg/animation/reservoir.ts +32 -0
- package/src/config/svg/custom/clock-a.ts +23 -0
- package/src/config/svg/custom/index.ts +11 -0
- package/src/config/svg/custom/light.ts +29 -0
- package/src/config/svg/custom/svg-text.ts +54 -0
- package/src/config/svg/custom/switch-a.ts +29 -0
- package/src/config/svg/index.ts +12 -0
- package/src/config/svg/stateful/circuit-breaker.ts +38 -0
- package/src/config/svg/stateful/index.ts +8 -0
- package/src/config/svg/stateless/alternator.ts +28 -0
- package/src/config/svg/stateless/bot-2.ts +22 -0
- package/src/config/svg/stateless/house.ts +22 -0
- package/src/config/svg/stateless/index.ts +14 -0
- package/src/config/types.ts +126 -0
- package/src/config/vue/component/button.ts +57 -0
- package/src/config/vue/component/common-table.ts +124 -0
- package/src/config/vue/component/index.ts +13 -0
- package/src/config/vue/component/now-time.ts +29 -0
- package/src/config/vue/component/progress.ts +29 -0
- package/src/config/vue/component/tag.ts +46 -0
- package/src/config/vue/echarts/index.ts +8 -0
- package/src/config/vue/echarts/pie-charts.ts +60 -0
- package/src/config/vue/index.ts +5 -0
- package/src/hooks.ts +47 -0
- package/src/index.ts +14 -0
- package/src/main.ts +15 -0
- package/src/router.ts +24 -0
- package/src/stores/config/index.ts +44 -0
- package/src/stores/config/types.ts +27 -0
- package/src/stores/global/index.ts +109 -0
- package/src/stores/global/types.ts +115 -0
- package/src/stores/main.ts +10 -0
- package/src/stores/svg-edit-layout/index.ts +17 -0
- package/src/stores/svg-edit-layout/types.ts +8 -0
- package/src/stores/system/index.ts +174 -0
- package/src/stores/system/types.ts +43 -0
- package/src/utils/fetch.ts +351 -0
- package/src/utils/file-read-write.ts +26 -0
- package/src/utils/index.ts +397 -0
- package/src/utils/mqtt-net.ts +48 -0
- package/src/utils/proxy.ts +7 -0
- package/src/utils/scale-core.ts +214 -0
- package/src/utils/types.ts +13 -0
- package/src/views/EditorS.vue +18 -0
- package/src/views/Preview.vue +12 -0
@@ -0,0 +1,126 @@
|
|
1
|
+
/**
|
2
|
+
* 组件分组数据格式
|
3
|
+
* @property {string} groupType 组件分组类型
|
4
|
+
* @property {string} title 组件分组标题
|
5
|
+
* @property {Array} list 分组包含的组件项列表
|
6
|
+
* @export
|
7
|
+
* @interface IConfigComponentGroup
|
8
|
+
*/
|
9
|
+
export interface IConfigComponentGroup {
|
10
|
+
groupType: string
|
11
|
+
title: string
|
12
|
+
list: Array<IConfigItem>
|
13
|
+
}
|
14
|
+
|
15
|
+
export type IConfig = IConfigComponentGroup[]
|
16
|
+
|
17
|
+
export interface IConfigItem {
|
18
|
+
name: string
|
19
|
+
title: string
|
20
|
+
display: boolean
|
21
|
+
props: IConfigItemProps
|
22
|
+
type: EDoneJsonType
|
23
|
+
config: IDoneJsonConfig
|
24
|
+
common_animations?: IAnimations
|
25
|
+
animations?: IConfigItemProps //自定义动画效果
|
26
|
+
tag?: any
|
27
|
+
state?: IConfigItemState //通过一个属性去控制多个属性就是有状态组件
|
28
|
+
tag_slot?: string
|
29
|
+
events: Array<IEventsItem>
|
30
|
+
}
|
31
|
+
|
32
|
+
export interface IAnimations {
|
33
|
+
val: string
|
34
|
+
delay: string
|
35
|
+
speed: string
|
36
|
+
repeat: string
|
37
|
+
}
|
38
|
+
|
39
|
+
export interface IConfigItemProps {
|
40
|
+
[key: string]: {
|
41
|
+
title: string
|
42
|
+
type: EConfigItemPropsType
|
43
|
+
val: any
|
44
|
+
options?: any
|
45
|
+
disabled?: boolean
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
export enum EConfigAnimationsType {
|
50
|
+
None = 'None',
|
51
|
+
Electricity = 'Electricity', //电流效果
|
52
|
+
WaterDrop = 'WaterDrop', //水珠
|
53
|
+
Track = 'Track' //轨迹
|
54
|
+
}
|
55
|
+
|
56
|
+
export enum EConfigItemPropsType {
|
57
|
+
Input = 'Input',
|
58
|
+
Color = 'Color',
|
59
|
+
InputNumber = 'InputNumber',
|
60
|
+
Switch = 'Switch', //此类型option默认索引0为关闭
|
61
|
+
JsonEdit = 'JsonEdit',
|
62
|
+
Select = 'Select'
|
63
|
+
}
|
64
|
+
|
65
|
+
export enum EDoneJsonType {
|
66
|
+
File = 'File',
|
67
|
+
StraightLine = 'StraightLine',
|
68
|
+
ConnectionLine = 'ConnectionLine',
|
69
|
+
CustomSvg = 'CustomSvg',
|
70
|
+
Vue = 'Vue'
|
71
|
+
}
|
72
|
+
|
73
|
+
interface IDoneJsonConfig {
|
74
|
+
can_zoom: boolean
|
75
|
+
have_anchor: boolean
|
76
|
+
actual_rect: boolean
|
77
|
+
}
|
78
|
+
|
79
|
+
export interface IConfigItemState {
|
80
|
+
OnOff?: {
|
81
|
+
title: string
|
82
|
+
default: false
|
83
|
+
props: { [key: string]: { openVal: any; closeVal: any } }
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
export enum EEventType {
|
88
|
+
Click = 'Click',
|
89
|
+
Change = 'Change',
|
90
|
+
Null = ''
|
91
|
+
}
|
92
|
+
|
93
|
+
export enum EEventAction {
|
94
|
+
ChangeAttr = 'ChangeAttr',
|
95
|
+
JavaScript = 'JavaScript',
|
96
|
+
Null = ''
|
97
|
+
}
|
98
|
+
|
99
|
+
export enum EConditionType {
|
100
|
+
None = 'None',
|
101
|
+
Relation = 'Relation'
|
102
|
+
}
|
103
|
+
|
104
|
+
export interface IAttrItem {
|
105
|
+
key: string
|
106
|
+
val: string
|
107
|
+
}
|
108
|
+
|
109
|
+
export interface ICondition {
|
110
|
+
type: EConditionType
|
111
|
+
Relation?: {
|
112
|
+
key: string
|
113
|
+
relation: string
|
114
|
+
val: string
|
115
|
+
val2?: string
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
export interface IEventsItem {
|
120
|
+
type: EEventType
|
121
|
+
action: EEventAction
|
122
|
+
target: string
|
123
|
+
attrs?: IAttrItem[]
|
124
|
+
scripts: string
|
125
|
+
condition?: ICondition
|
126
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
|
+
import type { IConfigItem } from '@/config/types'
|
3
|
+
|
4
|
+
export const el_button: IConfigItem = {
|
5
|
+
name: 'el-button',
|
6
|
+
tag: 'el-button',
|
7
|
+
title: '按钮',
|
8
|
+
type: EDoneJsonType.Vue,
|
9
|
+
config: {
|
10
|
+
can_zoom: true,
|
11
|
+
have_anchor: true,
|
12
|
+
actual_rect: true
|
13
|
+
},
|
14
|
+
display: true,
|
15
|
+
props: {
|
16
|
+
size: {
|
17
|
+
title: '尺寸',
|
18
|
+
type: EConfigItemPropsType.Select,
|
19
|
+
val: 'default',
|
20
|
+
options: [
|
21
|
+
{ label: '大', value: 'large' },
|
22
|
+
{ label: '默认', value: 'default' },
|
23
|
+
{ label: '小', value: 'small' }
|
24
|
+
]
|
25
|
+
},
|
26
|
+
type: {
|
27
|
+
title: '类型',
|
28
|
+
type: EConfigItemPropsType.Select,
|
29
|
+
val: 'primary',
|
30
|
+
options: [
|
31
|
+
{ label: '主要按钮', value: 'primary' },
|
32
|
+
{ label: '成功按钮', value: 'success' },
|
33
|
+
{ label: '警告按钮', value: 'warning' },
|
34
|
+
{ label: '危险按钮', value: 'danger' },
|
35
|
+
{ label: '信息按钮', value: 'info' }
|
36
|
+
]
|
37
|
+
},
|
38
|
+
plain: {
|
39
|
+
title: '朴素按钮',
|
40
|
+
type: EConfigItemPropsType.Switch,
|
41
|
+
val: false
|
42
|
+
},
|
43
|
+
text: {
|
44
|
+
title: '文字按钮',
|
45
|
+
type: EConfigItemPropsType.Switch,
|
46
|
+
val: false
|
47
|
+
}
|
48
|
+
},
|
49
|
+
tag_slot: '按钮',
|
50
|
+
common_animations: {
|
51
|
+
val: '',
|
52
|
+
delay: 'delay-0s',
|
53
|
+
speed: 'slow',
|
54
|
+
repeat: 'infinite'
|
55
|
+
},
|
56
|
+
events: []
|
57
|
+
}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
|
+
import type { IConfigItem } from '@/config/types'
|
3
|
+
|
4
|
+
export const common_table: IConfigItem = {
|
5
|
+
name: 'common-table',
|
6
|
+
title: '通用表格',
|
7
|
+
tag: 'common-table',
|
8
|
+
type: EDoneJsonType.Vue,
|
9
|
+
config: {
|
10
|
+
can_zoom: true,
|
11
|
+
have_anchor: true,
|
12
|
+
actual_rect: true
|
13
|
+
},
|
14
|
+
display: true,
|
15
|
+
props: {
|
16
|
+
'col-config': {
|
17
|
+
title: '列配置',
|
18
|
+
type: EConfigItemPropsType.JsonEdit,
|
19
|
+
val: [
|
20
|
+
{
|
21
|
+
prop: 'date',
|
22
|
+
label: '第一列',
|
23
|
+
width: '120px',
|
24
|
+
fixed: false,
|
25
|
+
sortable: false,
|
26
|
+
'show-overflow-tooltip': false
|
27
|
+
},
|
28
|
+
{
|
29
|
+
prop: 'name',
|
30
|
+
label: '第二列',
|
31
|
+
width: '120px',
|
32
|
+
fixed: false,
|
33
|
+
sortable: false,
|
34
|
+
'show-overflow-tooltip': false
|
35
|
+
},
|
36
|
+
{
|
37
|
+
prop: 'address',
|
38
|
+
label: '第三列测试',
|
39
|
+
width: '280px',
|
40
|
+
fixed: false,
|
41
|
+
sortable: false,
|
42
|
+
'show-overflow-tooltip': false
|
43
|
+
}
|
44
|
+
]
|
45
|
+
},
|
46
|
+
data: {
|
47
|
+
title: '表格数据',
|
48
|
+
type: EConfigItemPropsType.JsonEdit,
|
49
|
+
val: [
|
50
|
+
{
|
51
|
+
date: '2016-05-03',
|
52
|
+
name: 'Tom',
|
53
|
+
address: 'No. 189, Grove St, Los Angeles'
|
54
|
+
},
|
55
|
+
{
|
56
|
+
date: '2016-05-02',
|
57
|
+
name: 'Tom',
|
58
|
+
address: 'No. 189, Grove St, Los Angeles'
|
59
|
+
},
|
60
|
+
{
|
61
|
+
date: '2016-05-04',
|
62
|
+
name: 'Tom',
|
63
|
+
address: 'No. 189, Grove St, Los Angeles'
|
64
|
+
},
|
65
|
+
{
|
66
|
+
date: '2016-05-01',
|
67
|
+
name: 'Tom',
|
68
|
+
address: 'No. 189, Grove St, Los Angeles'
|
69
|
+
}
|
70
|
+
]
|
71
|
+
},
|
72
|
+
height: {
|
73
|
+
title: '高度',
|
74
|
+
type: EConfigItemPropsType.InputNumber,
|
75
|
+
val: null
|
76
|
+
},
|
77
|
+
'max-height': {
|
78
|
+
title: '最大高度',
|
79
|
+
type: EConfigItemPropsType.InputNumber,
|
80
|
+
val: null
|
81
|
+
},
|
82
|
+
stripe: {
|
83
|
+
title: '斑马纹',
|
84
|
+
type: EConfigItemPropsType.Switch,
|
85
|
+
val: false
|
86
|
+
},
|
87
|
+
border: {
|
88
|
+
title: '纵向边框',
|
89
|
+
type: EConfigItemPropsType.Switch,
|
90
|
+
val: false
|
91
|
+
},
|
92
|
+
size: {
|
93
|
+
title: '尺寸',
|
94
|
+
type: EConfigItemPropsType.Select,
|
95
|
+
val: 'default',
|
96
|
+
options: [
|
97
|
+
{
|
98
|
+
label: '大',
|
99
|
+
value: 'large'
|
100
|
+
},
|
101
|
+
{
|
102
|
+
label: '默认',
|
103
|
+
value: 'default'
|
104
|
+
},
|
105
|
+
{
|
106
|
+
label: '小',
|
107
|
+
value: 'small'
|
108
|
+
}
|
109
|
+
]
|
110
|
+
},
|
111
|
+
fit: {
|
112
|
+
title: '列宽自撑开',
|
113
|
+
type: EConfigItemPropsType.Switch,
|
114
|
+
val: false
|
115
|
+
}
|
116
|
+
},
|
117
|
+
common_animations: {
|
118
|
+
val: '',
|
119
|
+
delay: 'delay-0s',
|
120
|
+
speed: 'slow',
|
121
|
+
repeat: 'infinite'
|
122
|
+
},
|
123
|
+
events: []
|
124
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { IConfigComponentGroup } from '@/config/types'
|
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'
|
8
|
+
|
9
|
+
export const components: IConfigComponentGroup = {
|
10
|
+
groupType: 'custom-vue',
|
11
|
+
title: 'VUE组件',
|
12
|
+
list: [el_button, progress_a, common_table, now_time, el_tag]
|
13
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
|
+
import type { IConfigItem } from '@/config/types'
|
3
|
+
|
4
|
+
export const now_time: IConfigItem = {
|
5
|
+
name: 'now-time',
|
6
|
+
title: '当前时间',
|
7
|
+
tag: 'now-time',
|
8
|
+
type: EDoneJsonType.Vue,
|
9
|
+
config: {
|
10
|
+
can_zoom: true,
|
11
|
+
have_anchor: false,
|
12
|
+
actual_rect: true
|
13
|
+
},
|
14
|
+
display: true,
|
15
|
+
props: {
|
16
|
+
fontColor: {
|
17
|
+
title: '文字颜色',
|
18
|
+
type: EConfigItemPropsType.Color,
|
19
|
+
val: '#000000'
|
20
|
+
}
|
21
|
+
},
|
22
|
+
common_animations: {
|
23
|
+
val: '',
|
24
|
+
delay: 'delay-0s',
|
25
|
+
speed: 'slow',
|
26
|
+
repeat: 'infinite'
|
27
|
+
},
|
28
|
+
events: []
|
29
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
|
+
import type { IConfigItem } from '@/config/types'
|
3
|
+
|
4
|
+
export const progress_a: IConfigItem = {
|
5
|
+
name: 'progress-a',
|
6
|
+
tag: 'progress-a',
|
7
|
+
title: '进度条',
|
8
|
+
type: EDoneJsonType.Vue,
|
9
|
+
config: {
|
10
|
+
can_zoom: true,
|
11
|
+
have_anchor: true,
|
12
|
+
actual_rect: true
|
13
|
+
},
|
14
|
+
display: true,
|
15
|
+
props: {
|
16
|
+
percentage: {
|
17
|
+
title: '进度',
|
18
|
+
type: EConfigItemPropsType.InputNumber,
|
19
|
+
val: 10
|
20
|
+
}
|
21
|
+
},
|
22
|
+
common_animations: {
|
23
|
+
val: '',
|
24
|
+
delay: 'delay-0s',
|
25
|
+
speed: 'slow',
|
26
|
+
repeat: 'infinite'
|
27
|
+
},
|
28
|
+
events: []
|
29
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
|
+
import type { IConfigItem } from '@/config/types'
|
3
|
+
|
4
|
+
export const el_tag: IConfigItem = {
|
5
|
+
name: 'el-tag',
|
6
|
+
tag: 'el-tag',
|
7
|
+
title: '标签',
|
8
|
+
type: EDoneJsonType.Vue,
|
9
|
+
config: {
|
10
|
+
can_zoom: true,
|
11
|
+
have_anchor: true,
|
12
|
+
actual_rect: true
|
13
|
+
},
|
14
|
+
display: true,
|
15
|
+
props: {
|
16
|
+
type: {
|
17
|
+
title: '类型',
|
18
|
+
type: EConfigItemPropsType.Select,
|
19
|
+
val: 'success',
|
20
|
+
options: [
|
21
|
+
{ label: '成功', value: 'success' },
|
22
|
+
{ label: '警告', value: 'warning' },
|
23
|
+
{ label: '危险', value: 'danger' },
|
24
|
+
{ label: '信息', value: 'info' }
|
25
|
+
]
|
26
|
+
},
|
27
|
+
closable: {
|
28
|
+
title: '可关闭',
|
29
|
+
type: EConfigItemPropsType.Switch,
|
30
|
+
val: true
|
31
|
+
},
|
32
|
+
'disable-transitions': {
|
33
|
+
title: '渐变',
|
34
|
+
type: EConfigItemPropsType.Switch,
|
35
|
+
val: false
|
36
|
+
}
|
37
|
+
},
|
38
|
+
tag_slot: '标签',
|
39
|
+
common_animations: {
|
40
|
+
val: '',
|
41
|
+
delay: 'delay-0s',
|
42
|
+
speed: 'slow',
|
43
|
+
repeat: 'infinite'
|
44
|
+
},
|
45
|
+
events: []
|
46
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
|
2
|
+
import type { IConfigItem } from '@/config/types'
|
3
|
+
|
4
|
+
export const pie_charts: IConfigItem = {
|
5
|
+
name: 'pie-charts',
|
6
|
+
tag: 'pie-charts',
|
7
|
+
title: '饼图',
|
8
|
+
type: EDoneJsonType.Vue,
|
9
|
+
config: {
|
10
|
+
can_zoom: true,
|
11
|
+
have_anchor: true,
|
12
|
+
actual_rect: true
|
13
|
+
},
|
14
|
+
display: true,
|
15
|
+
props: {
|
16
|
+
title: {
|
17
|
+
title: '标题',
|
18
|
+
type: EConfigItemPropsType.Input,
|
19
|
+
val: '默认标题'
|
20
|
+
},
|
21
|
+
seriesName: {
|
22
|
+
title: '详情',
|
23
|
+
type: EConfigItemPropsType.Input,
|
24
|
+
val: '详情标题'
|
25
|
+
},
|
26
|
+
seriesData: {
|
27
|
+
title: 'legendData',
|
28
|
+
type: EConfigItemPropsType.JsonEdit,
|
29
|
+
val: [
|
30
|
+
{
|
31
|
+
value: 1048,
|
32
|
+
name: '办公楼A'
|
33
|
+
},
|
34
|
+
{
|
35
|
+
value: 735,
|
36
|
+
name: '办公楼B'
|
37
|
+
},
|
38
|
+
{
|
39
|
+
value: 580,
|
40
|
+
name: '保安室'
|
41
|
+
},
|
42
|
+
{
|
43
|
+
value: 484,
|
44
|
+
name: '地下车库'
|
45
|
+
},
|
46
|
+
{
|
47
|
+
value: 300,
|
48
|
+
name: '食堂'
|
49
|
+
}
|
50
|
+
]
|
51
|
+
}
|
52
|
+
},
|
53
|
+
common_animations: {
|
54
|
+
val: '',
|
55
|
+
delay: 'delay-0s',
|
56
|
+
speed: 'slow',
|
57
|
+
repeat: 'infinite'
|
58
|
+
},
|
59
|
+
events: []
|
60
|
+
}
|
package/src/hooks.ts
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
import type { IDataModel } from '@/components/svg-editor/types'
|
2
|
+
import { createPinia } from 'pinia'
|
3
|
+
import { useConfigStore } from '@/stores/config'
|
4
|
+
import { useGlobalStore } from '@/stores/global'
|
5
|
+
import type { IDoneJson } from '@/stores/global/types'
|
6
|
+
import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
|
7
|
+
import { useEditPrivateStore } from '@/stores/system'
|
8
|
+
|
9
|
+
import { ElMessage } from 'element-plus'
|
10
|
+
|
11
|
+
export const pinia = createPinia()
|
12
|
+
|
13
|
+
export const useHistoryRecord = (done_json: IDoneJson[]) => {
|
14
|
+
const edit_private_store = useEditPrivateStore()
|
15
|
+
if (edit_private_store.is_record_history) {
|
16
|
+
if (edit_private_store.history_now_index + 1 < edit_private_store.history_doneComponent.length) {
|
17
|
+
edit_private_store.history_doneComponent.splice(edit_private_store.history_now_index + 1)
|
18
|
+
}
|
19
|
+
edit_private_store.history_doneComponent.push(done_json)
|
20
|
+
edit_private_store.history_now_index = edit_private_store.history_doneComponent.length - 1
|
21
|
+
if (edit_private_store.history_doneComponent.length > edit_private_store.max_record_times) {
|
22
|
+
edit_private_store.history_doneComponent.shift()
|
23
|
+
edit_private_store.history_now_index = edit_private_store.history_doneComponent.length - 1
|
24
|
+
}
|
25
|
+
}
|
26
|
+
edit_private_store.is_record_history = true
|
27
|
+
}
|
28
|
+
export const useImportDataModel = (model_str: string) => {
|
29
|
+
try {
|
30
|
+
const json: IDataModel = JSON.parse(model_str)
|
31
|
+
if (!json.config || !json.layout_center || !json.done_json) {
|
32
|
+
ElMessage.error('请导入正确的数据模型!')
|
33
|
+
return false
|
34
|
+
}
|
35
|
+
const globalStore = useGlobalStore(pinia)
|
36
|
+
const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
|
37
|
+
const configStore = useConfigStore(pinia)
|
38
|
+
configStore.$state = json.config
|
39
|
+
svgEditLayoutStore.center_offset = json.layout_center
|
40
|
+
globalStore.setDoneJson(json.done_json)
|
41
|
+
return true
|
42
|
+
} catch (error) {
|
43
|
+
ElMessage.error('请导入正确的数据模型!')
|
44
|
+
console.error(error)
|
45
|
+
return false
|
46
|
+
}
|
47
|
+
}
|
package/src/index.ts
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* @description 库vgce入口
|
3
|
+
* @author Ricky email:zhangqingcq@foxmail.com
|
4
|
+
* @created 2023.07.10
|
5
|
+
*/
|
6
|
+
|
7
|
+
import 'virtual:windi.css'
|
8
|
+
import 'virtual:svg-icons-register'
|
9
|
+
import './assets/main.less'
|
10
|
+
|
11
|
+
import SvgEditor from '@/components/svg-editor/index.vue'
|
12
|
+
import SvgViewer from '@/components/svg-viewer/index.vue'
|
13
|
+
|
14
|
+
export { SvgEditor, SvgViewer }
|
package/src/main.ts
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
import { createApp } from 'vue'
|
2
|
+
import { pinia } from '@/hooks'
|
3
|
+
|
4
|
+
import App from './App.vue'
|
5
|
+
import router from './router'
|
6
|
+
import 'virtual:windi.css'
|
7
|
+
import 'virtual:svg-icons-register'
|
8
|
+
import './assets/main.less'
|
9
|
+
|
10
|
+
const app = createApp(App)
|
11
|
+
|
12
|
+
app.use(router)
|
13
|
+
app.use(pinia)
|
14
|
+
|
15
|
+
app.mount('#app')
|
package/src/router.ts
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
2
|
+
import EditorS from '@/views/EditorS.vue'
|
3
|
+
|
4
|
+
const router = createRouter({
|
5
|
+
history: createWebHistory(import.meta.env.BASE_URL),
|
6
|
+
routes: [
|
7
|
+
{
|
8
|
+
path: '/',
|
9
|
+
redirect: '/EditorS'
|
10
|
+
},
|
11
|
+
{
|
12
|
+
path: '/EditorS',
|
13
|
+
name: 'EditorS',
|
14
|
+
component: EditorS
|
15
|
+
},
|
16
|
+
{
|
17
|
+
path: '/Preview',
|
18
|
+
name: 'Preview',
|
19
|
+
component: () => import('@/views/Preview.vue')
|
20
|
+
}
|
21
|
+
]
|
22
|
+
})
|
23
|
+
|
24
|
+
export default router
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { defineStore } from 'pinia'
|
2
|
+
import { objectDeepClone } from '@/utils'
|
3
|
+
import { connection_line_system } from '@/components/config'
|
4
|
+
|
5
|
+
let l = localStorage.getItem('svg-editor-config')
|
6
|
+
let s: any
|
7
|
+
let t: any
|
8
|
+
|
9
|
+
if (l) {
|
10
|
+
let b = JSON.parse(l)
|
11
|
+
t = b.connection_line
|
12
|
+
s = b.svg
|
13
|
+
} else {
|
14
|
+
t = objectDeepClone(connection_line_system)
|
15
|
+
s = {
|
16
|
+
background_color: '#fff',
|
17
|
+
scale: 1,
|
18
|
+
position_center: {
|
19
|
+
x: -333,
|
20
|
+
y: -113
|
21
|
+
},
|
22
|
+
svg_position_center: {
|
23
|
+
x: 50,
|
24
|
+
y: 50
|
25
|
+
},
|
26
|
+
grid: true,
|
27
|
+
ruler: true
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* 配置文件
|
33
|
+
*/
|
34
|
+
export const useConfigStore = defineStore('config-store', {
|
35
|
+
state: () => {
|
36
|
+
return {
|
37
|
+
svg: s,
|
38
|
+
connection_line: t,
|
39
|
+
net: { mqtt: { url: '', user: '', pwd: '', topics: '' } }
|
40
|
+
}
|
41
|
+
},
|
42
|
+
getters: {},
|
43
|
+
actions: {}
|
44
|
+
})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
export interface IPositionCenter {
|
2
|
+
svg: IPositionCenterSvg
|
3
|
+
}
|
4
|
+
|
5
|
+
export interface IPositionCenterSvg {
|
6
|
+
background_color: string
|
7
|
+
scale: number
|
8
|
+
position_center: {
|
9
|
+
x: number
|
10
|
+
y: number
|
11
|
+
}
|
12
|
+
svg_position_center: {
|
13
|
+
x: number
|
14
|
+
y: number
|
15
|
+
}
|
16
|
+
grid: boolean
|
17
|
+
ruler: boolean
|
18
|
+
}
|
19
|
+
|
20
|
+
export interface INet {
|
21
|
+
mqtt: {
|
22
|
+
url: string
|
23
|
+
user: string
|
24
|
+
pwd: string
|
25
|
+
topics: string
|
26
|
+
}
|
27
|
+
}
|