vue-wiring-diagram 1.1.21 → 1.1.23

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 (32) hide show
  1. package/README.md +93 -93
  2. package/dist/style.css +1 -1
  3. package/dist/vue-wiring-diagram.es.js +6235 -5903
  4. package/dist/vue-wiring-diagram.umd.js +29 -29
  5. package/package.json +1 -1
  6. package/packages/components/Shortcuts.vue +31 -31
  7. package/packages/components/baseShape.js +62 -62
  8. package/packages/components/common.js +105 -105
  9. package/packages/components/edge-control/arrow-line.vue +292 -292
  10. package/packages/components/edge-control/condition.vue +110 -110
  11. package/packages/components/edge-control/default-line.vue +156 -156
  12. package/packages/components/edge-control/index.vue +94 -94
  13. package/packages/components/edge-control/pipe-line.vue +354 -354
  14. package/packages/components/editor/index.vue +590 -590
  15. package/packages/components/enums.js +80 -80
  16. package/packages/components/graph-control/index.vue +121 -121
  17. package/packages/components/image-control/group-form.vue +114 -114
  18. package/packages/components/image-control/image-condition.vue +117 -0
  19. package/packages/components/image-control/image-form.vue +184 -184
  20. package/packages/components/image-control/image-management.vue +213 -213
  21. package/packages/components/image-control/index.vue +290 -124
  22. package/packages/components/portsOptions.js +21 -21
  23. package/packages/components/preview/index.vue +399 -347
  24. package/packages/components/settings.js +262 -262
  25. package/packages/components/text-control/index.vue +457 -457
  26. package/packages/components/tools.js +256 -256
  27. package/packages/http.js +104 -104
  28. package/packages/index.js +43 -43
  29. package/packages/styles/animation.scss +27 -27
  30. package/packages/styles/dialog.scss +4 -4
  31. package/packages/styles/editor.scss +165 -165
  32. package/packages/styles/elPath.scss +257 -257
@@ -1,256 +1,256 @@
1
- import {Transform} from "@antv/x6-plugin-transform";
2
- import {Keyboard} from "@antv/x6-plugin-keyboard";
3
- import {Snapline} from "@antv/x6-plugin-snapline";
4
- import {Clipboard} from "@antv/x6-plugin-clipboard";
5
- import {History} from "@antv/x6-plugin-history";
6
- import {Selection} from "@antv/x6-plugin-selection";
7
- import {lineOptions} from "packages/components/settings.js";
8
- import {ARROWFORWARD, FLASHING, STOP} from "packages/components/enums.js";
9
- import {instance} from "packages/http.js";
10
-
11
- /**
12
- * 图形变换
13
- * @returns {Transform}
14
- */
15
- export const transform = () => {
16
- return new Transform({
17
- resizing: {
18
- enabled: true,
19
- preserveAspectRatio: false
20
- },
21
- rotating: true,
22
- })
23
- }
24
-
25
- /**
26
- * 快捷键
27
- * @returns {Keyboard}
28
- */
29
- export const keyboard = () => {
30
- return new Keyboard()
31
- }
32
-
33
- /**
34
- * 吸附线
35
- * @returns {Snapline}
36
- */
37
- export const snapLine = () => {
38
- return new Snapline()
39
- }
40
-
41
- /**
42
- * 复制粘贴
43
- * @returns {Clipboard|*}
44
- */
45
- export const clipboard = () => {
46
- return new Clipboard({
47
- format(key) {
48
- return key.replace(/\s/g, '').replace('cmd', 'command')
49
- },
50
- })
51
- }
52
-
53
- // 排除撤销重做的命令
54
- const excludeHistoryCommand = [
55
- 'tools',
56
- 'ports'
57
- ]
58
-
59
- /**
60
- * 撤销重做
61
- * @returns {History}
62
- */
63
- export const history = () => {
64
- return new History({
65
- beforeAddCommand: (name, args) => {
66
- if (excludeHistoryCommand.includes(args.key)) {
67
- return false
68
- }
69
- }
70
- })
71
- }
72
-
73
- /**
74
- * 框选
75
- * @returns {Selection}
76
- */
77
- export const selection = () => {
78
- return new Selection({
79
- enabled: true,
80
- multiple: true, //多选
81
- rubberband: true, //框选节点
82
- modifiers: ['alt'],
83
- showNodeSelectionBox: true,
84
- })
85
- }
86
-
87
- /**
88
- * 删除
89
- * @param graph
90
- * @returns {boolean}
91
- */
92
- export const deleteCell = (graph) => {
93
- const cells = graph.getSelectedCells()
94
- if (cells.length) {
95
- graph.removeCells(cells)
96
- }
97
- }
98
-
99
- /**
100
- * 复制
101
- * @param graph
102
- * @returns {boolean}
103
- */
104
- export const copyCell = (graph) => {
105
- const cells = graph.getSelectedCells()
106
- if (cells.length) {
107
- graph.copy(cells)
108
- }
109
- }
110
-
111
- /**
112
- * 粘贴
113
- * @param graph
114
- * @returns {boolean}
115
- */
116
- export const pasteCell = (graph) => {
117
- if (!graph.isClipboardEmpty()) {
118
- const cells = graph.paste({offset: 32})
119
- graph.cleanSelection()
120
- graph.select(cells)
121
- }
122
- }
123
-
124
- /**
125
- * 撤销
126
- * @param graph
127
- * @returns {boolean}
128
- */
129
- export const undoCell = (graph) => {
130
- if (graph.canUndo()) {
131
- graph.undo()
132
- }
133
- }
134
-
135
- /**
136
- * 重做
137
- * @param graph
138
- * @returns {boolean}
139
- */
140
- export const redoCell = (graph) => {
141
- if (graph.canRedo()) {
142
- graph.redo()
143
- }
144
- }
145
-
146
- /**
147
- * 添加线工具
148
- * @param cell
149
- */
150
- export const addLineTools = (cell) => {
151
- cell.addTools([
152
- {
153
- name: 'vertices',
154
- args: {
155
- snapRadius: 3,
156
- attrs: {
157
- r: 3,
158
- fill: '#239edd',
159
- cursor: 'move',
160
- 'stroke-width': 2
161
- },
162
- modifiers: ['shift']
163
- },
164
- },
165
- {
166
- name: 'segments',
167
- args: {
168
- attrs: {
169
- stroke: '#239edd',
170
- strokeWidth: 2,
171
- strokeDasharray: '5 5',
172
- },
173
- },
174
- },
175
- {
176
- name: 'source-arrowhead',
177
- args: {
178
- attrs: {
179
- stroke: '#239edd',
180
- },
181
- },
182
- },
183
- {
184
- name: 'target-arrowhead',
185
- args: {
186
- attrs: {
187
- stroke: '#239edd',
188
- },
189
- },
190
- },
191
- ]);
192
- }
193
-
194
- /**
195
- * 判断当前默认线的类型
196
- */
197
- export const isLineOrPipe = () => {
198
- if (lineOptions.attrs?.pipe) {
199
- return 'pipe'
200
- }
201
- if (lineOptions.attrs?.arrow) {
202
- return 'arrow'
203
- }
204
- return 'line'
205
- }
206
-
207
- /**
208
- * 设置管道方向
209
- * @param direction none无 forward-pipe正向 reverse-pipe反向
210
- */
211
- export const setPipeDirection = (direction) => {
212
- if (direction !== 'none') {
213
- return direction + ' 30s infinite linear'
214
- } else {
215
- return ''
216
- }
217
- }
218
-
219
- /**
220
- * 设置随机数
221
- * @returns {number}
222
- */
223
- export const setMathRandom = () => {
224
- return Math.random()
225
- }
226
-
227
- // 默认展示的字符串
228
- export const defaultText = '--'
229
-
230
- // 默认匹配字符串
231
- export const defaultMatch = /\$\{([^}]+)\}/g
232
-
233
- // 默认条件管道单个配置
234
- export const defaultPipeCondition = {
235
- min: 0,
236
- max: 0,
237
- direction: STOP,
238
- }
239
-
240
- /**
241
- * 设置SunCloud的图片地址
242
- * @param url
243
- * @returns {string}
244
- */
245
- export const setSunCloudImageUrl = (url) => {
246
- return instance.defaults.baseURL + url.replace('/cny','')
247
- }
248
-
249
- // 默认条件箭头线配置
250
- export const defaultArrowCondition = {
251
- min: 0,
252
- max: 0,
253
- animation: FLASHING,
254
- direction: ARROWFORWARD,
255
- display: 'block'
256
- }
1
+ import {Transform} from "@antv/x6-plugin-transform";
2
+ import {Keyboard} from "@antv/x6-plugin-keyboard";
3
+ import {Snapline} from "@antv/x6-plugin-snapline";
4
+ import {Clipboard} from "@antv/x6-plugin-clipboard";
5
+ import {History} from "@antv/x6-plugin-history";
6
+ import {Selection} from "@antv/x6-plugin-selection";
7
+ import {lineOptions} from "packages/components/settings.js";
8
+ import {ARROWFORWARD, FLASHING, STOP} from "packages/components/enums.js";
9
+ import {instance} from "packages/http.js";
10
+
11
+ /**
12
+ * 图形变换
13
+ * @returns {Transform}
14
+ */
15
+ export const transform = () => {
16
+ return new Transform({
17
+ resizing: {
18
+ enabled: true,
19
+ preserveAspectRatio: false
20
+ },
21
+ rotating: true,
22
+ })
23
+ }
24
+
25
+ /**
26
+ * 快捷键
27
+ * @returns {Keyboard}
28
+ */
29
+ export const keyboard = () => {
30
+ return new Keyboard()
31
+ }
32
+
33
+ /**
34
+ * 吸附线
35
+ * @returns {Snapline}
36
+ */
37
+ export const snapLine = () => {
38
+ return new Snapline()
39
+ }
40
+
41
+ /**
42
+ * 复制粘贴
43
+ * @returns {Clipboard|*}
44
+ */
45
+ export const clipboard = () => {
46
+ return new Clipboard({
47
+ format(key) {
48
+ return key.replace(/\s/g, '').replace('cmd', 'command')
49
+ },
50
+ })
51
+ }
52
+
53
+ // 排除撤销重做的命令
54
+ const excludeHistoryCommand = [
55
+ 'tools',
56
+ 'ports'
57
+ ]
58
+
59
+ /**
60
+ * 撤销重做
61
+ * @returns {History}
62
+ */
63
+ export const history = () => {
64
+ return new History({
65
+ beforeAddCommand: (name, args) => {
66
+ if (excludeHistoryCommand.includes(args.key)) {
67
+ return false
68
+ }
69
+ }
70
+ })
71
+ }
72
+
73
+ /**
74
+ * 框选
75
+ * @returns {Selection}
76
+ */
77
+ export const selection = () => {
78
+ return new Selection({
79
+ enabled: true,
80
+ multiple: true, //多选
81
+ rubberband: true, //框选节点
82
+ modifiers: ['alt'],
83
+ showNodeSelectionBox: true,
84
+ })
85
+ }
86
+
87
+ /**
88
+ * 删除
89
+ * @param graph
90
+ * @returns {boolean}
91
+ */
92
+ export const deleteCell = (graph) => {
93
+ const cells = graph.getSelectedCells()
94
+ if (cells.length) {
95
+ graph.removeCells(cells)
96
+ }
97
+ }
98
+
99
+ /**
100
+ * 复制
101
+ * @param graph
102
+ * @returns {boolean}
103
+ */
104
+ export const copyCell = (graph) => {
105
+ const cells = graph.getSelectedCells()
106
+ if (cells.length) {
107
+ graph.copy(cells)
108
+ }
109
+ }
110
+
111
+ /**
112
+ * 粘贴
113
+ * @param graph
114
+ * @returns {boolean}
115
+ */
116
+ export const pasteCell = (graph) => {
117
+ if (!graph.isClipboardEmpty()) {
118
+ const cells = graph.paste({offset: 32})
119
+ graph.cleanSelection()
120
+ graph.select(cells)
121
+ }
122
+ }
123
+
124
+ /**
125
+ * 撤销
126
+ * @param graph
127
+ * @returns {boolean}
128
+ */
129
+ export const undoCell = (graph) => {
130
+ if (graph.canUndo()) {
131
+ graph.undo()
132
+ }
133
+ }
134
+
135
+ /**
136
+ * 重做
137
+ * @param graph
138
+ * @returns {boolean}
139
+ */
140
+ export const redoCell = (graph) => {
141
+ if (graph.canRedo()) {
142
+ graph.redo()
143
+ }
144
+ }
145
+
146
+ /**
147
+ * 添加线工具
148
+ * @param cell
149
+ */
150
+ export const addLineTools = (cell) => {
151
+ cell.addTools([
152
+ {
153
+ name: 'vertices',
154
+ args: {
155
+ snapRadius: 3,
156
+ attrs: {
157
+ r: 3,
158
+ fill: '#239edd',
159
+ cursor: 'move',
160
+ 'stroke-width': 2
161
+ },
162
+ modifiers: ['shift']
163
+ },
164
+ },
165
+ {
166
+ name: 'segments',
167
+ args: {
168
+ attrs: {
169
+ stroke: '#239edd',
170
+ strokeWidth: 2,
171
+ strokeDasharray: '5 5',
172
+ },
173
+ },
174
+ },
175
+ {
176
+ name: 'source-arrowhead',
177
+ args: {
178
+ attrs: {
179
+ stroke: '#239edd',
180
+ },
181
+ },
182
+ },
183
+ {
184
+ name: 'target-arrowhead',
185
+ args: {
186
+ attrs: {
187
+ stroke: '#239edd',
188
+ },
189
+ },
190
+ },
191
+ ]);
192
+ }
193
+
194
+ /**
195
+ * 判断当前默认线的类型
196
+ */
197
+ export const isLineOrPipe = () => {
198
+ if (lineOptions.attrs?.pipe) {
199
+ return 'pipe'
200
+ }
201
+ if (lineOptions.attrs?.arrow) {
202
+ return 'arrow'
203
+ }
204
+ return 'line'
205
+ }
206
+
207
+ /**
208
+ * 设置管道方向
209
+ * @param direction none无 forward-pipe正向 reverse-pipe反向
210
+ */
211
+ export const setPipeDirection = (direction) => {
212
+ if (direction !== 'none') {
213
+ return direction + ' 30s infinite linear'
214
+ } else {
215
+ return ''
216
+ }
217
+ }
218
+
219
+ /**
220
+ * 设置随机数
221
+ * @returns {number}
222
+ */
223
+ export const setMathRandom = () => {
224
+ return Math.random()
225
+ }
226
+
227
+ // 默认展示的字符串
228
+ export const defaultText = '--'
229
+
230
+ // 默认匹配字符串
231
+ export const defaultMatch = /\$\{([^}]+)\}/g
232
+
233
+ // 默认条件管道单个配置
234
+ export const defaultPipeCondition = {
235
+ min: 0,
236
+ max: 0,
237
+ direction: STOP,
238
+ }
239
+
240
+ /**
241
+ * 设置SunCloud的图片地址
242
+ * @param url
243
+ * @returns {string}
244
+ */
245
+ export const setSunCloudImageUrl = (url) => {
246
+ return instance.defaults.baseURL + url.replace('/cny','')
247
+ }
248
+
249
+ // 默认条件箭头线配置
250
+ export const defaultArrowCondition = {
251
+ min: 0,
252
+ max: 0,
253
+ animation: FLASHING,
254
+ direction: ARROWFORWARD,
255
+ display: 'block'
256
+ }