workflow-editor 0.9.66-dw → 0.9.66-pv3

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 (114) hide show
  1. package/lib/workflow-editor.css +1 -1
  2. package/lib/workflow-editor.umd.min.js +11 -11
  3. package/package.json +2 -2
  4. package/packages/index.js +34 -0
  5. package/packages/plugins/formValidatorUtil.js +528 -0
  6. package/packages/plugins/index.js +8 -0
  7. package/packages/workflow-editor/index.js +14 -0
  8. package/packages/workflow-editor/src/api.js +7 -0
  9. package/packages/workflow-editor/src/assets/wf-editor-icons.js +2 -0
  10. package/packages/workflow-editor/src/constant.js +8 -0
  11. package/packages/workflow-editor/src/json-object-templates/copy-task.js +67 -0
  12. package/packages/workflow-editor/src/json-object-templates/decision.js +11 -0
  13. package/packages/workflow-editor/src/json-object-templates/end.js +14 -0
  14. package/packages/workflow-editor/src/json-object-templates/fork.js +10 -0
  15. package/packages/workflow-editor/src/json-object-templates/human-decision.js +9 -0
  16. package/packages/workflow-editor/src/json-object-templates/human-task.js +199 -0
  17. package/packages/workflow-editor/src/json-object-templates/join.js +10 -0
  18. package/packages/workflow-editor/src/json-object-templates/process.js +98 -0
  19. package/packages/workflow-editor/src/json-object-templates/start.js +13 -0
  20. package/packages/workflow-editor/src/json-object-templates/subprocess.js +30 -0
  21. package/packages/workflow-editor/src/json-object-templates/transition.js +26 -0
  22. package/packages/workflow-editor/src/main/admin-save-dialog.vue +66 -0
  23. package/packages/workflow-editor/src/main/canvas.vue +479 -0
  24. package/packages/workflow-editor/src/main/context-menu.vue +132 -0
  25. package/packages/workflow-editor/src/main/icon-svg.vue +32 -0
  26. package/packages/workflow-editor/src/main/selection-region.vue +66 -0
  27. package/packages/workflow-editor/src/main/tache-history-tooltip.vue +38 -0
  28. package/packages/workflow-editor/src/main/tache-name-input.vue +19 -0
  29. package/packages/workflow-editor/src/main/tache-subprocess-history-dialog.vue +35 -0
  30. package/packages/workflow-editor/src/main/toolbox.vue +60 -0
  31. package/packages/workflow-editor/src/main/wf-history-canvas.vue +302 -0
  32. package/packages/workflow-editor/src/process-json.js +622 -0
  33. package/packages/workflow-editor/src/process-service.js +31 -0
  34. package/packages/workflow-editor/src/properties-editors/common/additional-condition-utils.js +531 -0
  35. package/packages/workflow-editor/src/properties-editors/common/additional-condition.vue +276 -0
  36. package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields-utils.js +34 -0
  37. package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields.vue +239 -0
  38. package/packages/workflow-editor/src/properties-editors/common/common-notice-tool.vue +47 -0
  39. package/packages/workflow-editor/src/properties-editors/common/common-user-condition.vue +241 -0
  40. package/packages/workflow-editor/src/properties-editors/common/form-fields-utils.js +23 -0
  41. package/packages/workflow-editor/src/properties-editors/common/form-fields.vue +116 -0
  42. package/packages/workflow-editor/src/properties-editors/common/i18n-input.vue +75 -0
  43. package/packages/workflow-editor/src/properties-editors/common/i18n-set-dialog.vue +125 -0
  44. package/packages/workflow-editor/src/properties-editors/common/notice.vue +98 -0
  45. package/packages/workflow-editor/src/properties-editors/common/reminder.vue +179 -0
  46. package/packages/workflow-editor/src/properties-editors/common/select-mail-template.vue +83 -0
  47. package/packages/workflow-editor/src/properties-editors/common/standard-fields.vue +65 -0
  48. package/packages/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue +355 -0
  49. package/packages/workflow-editor/src/properties-editors/common/system-role-tree.vue +63 -0
  50. package/packages/workflow-editor/src/properties-editors/common/task-title.vue +148 -0
  51. package/packages/workflow-editor/src/properties-editors/common/transactor-settings.vue +233 -0
  52. package/packages/workflow-editor/src/properties-editors/common/user-selection.vue +386 -0
  53. package/packages/workflow-editor/src/properties-editors/common/value-selection-dialog.vue +209 -0
  54. package/packages/workflow-editor/src/properties-editors/common/variables.vue +135 -0
  55. package/packages/workflow-editor/src/properties-editors/copy-task/basic-properties.vue +90 -0
  56. package/packages/workflow-editor/src/properties-editors/copy-task/permission-settings.vue +155 -0
  57. package/packages/workflow-editor/src/properties-editors/copy-task.vue +80 -0
  58. package/packages/workflow-editor/src/properties-editors/decision.vue +90 -0
  59. package/packages/workflow-editor/src/properties-editors/fork.vue +72 -0
  60. package/packages/workflow-editor/src/properties-editors/human-decision.vue +44 -0
  61. package/packages/workflow-editor/src/properties-editors/human-task/additional-condition-dialog.vue +60 -0
  62. package/packages/workflow-editor/src/properties-editors/human-task/basic-properties.vue +156 -0
  63. package/packages/workflow-editor/src/properties-editors/human-task/componentsConfigUtil.js +291 -0
  64. package/packages/workflow-editor/src/properties-editors/human-task/custom-actions.vue +249 -0
  65. package/packages/workflow-editor/src/properties-editors/human-task/editable-child-field-setting.vue +392 -0
  66. package/packages/workflow-editor/src/properties-editors/human-task/editable-child-fields.vue +241 -0
  67. package/packages/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue +220 -0
  68. package/packages/workflow-editor/src/properties-editors/human-task/editable-fields.vue +204 -0
  69. package/packages/workflow-editor/src/properties-editors/human-task/events.vue +59 -0
  70. package/packages/workflow-editor/src/properties-editors/human-task/permission-settings.vue +207 -0
  71. package/packages/workflow-editor/src/properties-editors/human-task/selection-conditions.vue +390 -0
  72. package/packages/workflow-editor/src/properties-editors/human-task.vue +103 -0
  73. package/packages/workflow-editor/src/properties-editors/join.vue +44 -0
  74. package/packages/workflow-editor/src/properties-editors/process/basic-properties.vue +324 -0
  75. package/packages/workflow-editor/src/properties-editors/process/events.vue +76 -0
  76. package/packages/workflow-editor/src/properties-editors/process/notice-settings.vue +60 -0
  77. package/packages/workflow-editor/src/properties-editors/process/parameter-settings.vue +95 -0
  78. package/packages/workflow-editor/src/properties-editors/process/permission-settings.vue +28 -0
  79. package/packages/workflow-editor/src/properties-editors/process/selectPage.vue +87 -0
  80. package/packages/workflow-editor/src/properties-editors/process.vue +109 -0
  81. package/packages/workflow-editor/src/properties-editors/subprocess/basic-properties.vue +187 -0
  82. package/packages/workflow-editor/src/properties-editors/subprocess/events.vue +26 -0
  83. package/packages/workflow-editor/src/properties-editors/subprocess/field-mappings.vue +206 -0
  84. package/packages/workflow-editor/src/properties-editors/subprocess/transactor-settings.vue +64 -0
  85. package/packages/workflow-editor/src/properties-editors/subprocess.vue +79 -0
  86. package/packages/workflow-editor/src/properties-editors/transition/basic-properties.vue +53 -0
  87. package/packages/workflow-editor/src/properties-editors/transition.vue +74 -0
  88. package/packages/workflow-editor/src/properties-editors/user-condition.js +177 -0
  89. package/packages/workflow-editor/src/store/getters.js +28 -0
  90. package/packages/workflow-editor/src/store/workflow-editor.js +128 -0
  91. package/packages/workflow-editor/src/taches/common-methods.js +21 -0
  92. package/packages/workflow-editor/src/taches/copy-task.vue +99 -0
  93. package/packages/workflow-editor/src/taches/custom-task.vue +88 -0
  94. package/packages/workflow-editor/src/taches/decision.vue +102 -0
  95. package/packages/workflow-editor/src/taches/end.vue +76 -0
  96. package/packages/workflow-editor/src/taches/fork.vue +102 -0
  97. package/packages/workflow-editor/src/taches/human-decision.vue +102 -0
  98. package/packages/workflow-editor/src/taches/human-task.vue +113 -0
  99. package/packages/workflow-editor/src/taches/join.vue +91 -0
  100. package/packages/workflow-editor/src/taches/joint.vue +177 -0
  101. package/packages/workflow-editor/src/taches/start.vue +76 -0
  102. package/packages/workflow-editor/src/taches/subprocess.vue +99 -0
  103. package/packages/workflow-editor/src/taches/tache-resizer.vue +80 -0
  104. package/packages/workflow-editor/src/transitions/broken-line.vue +91 -0
  105. package/packages/workflow-editor/src/transitions/curve-line.vue +91 -0
  106. package/packages/workflow-editor/src/transitions/straight-line.vue +26 -0
  107. package/packages/workflow-editor/src/transitions/transition.vue +212 -0
  108. package/packages/workflow-editor/src/transitions/virtual-transition.vue +43 -0
  109. package/packages/workflow-editor/src/util.js +493 -0
  110. package/packages/workflow-editor/src/workflow-editor.vue +625 -0
  111. package/packages/workflow-editor/src/workflow-history.vue +153 -0
  112. package/src/i18n/i18n.js +1 -1
  113. package/src/i18n/langs/cn.js +7 -1
  114. package/src/i18n/langs/en.js +7 -1
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <rect
3
+ v-if="owner.isSelected&&selectedTaches.length==1"
4
+ :x="area.x"
5
+ :y="area.y"
6
+ :width="area.width"
7
+ :height="area.height"
8
+ :style="{cursor:area.cursor}"
9
+ class="resizer"
10
+ @mousedown.stop="setContextMenuVisible(false);setResizerToMove({owner,position})"
11
+ @mouseup.stop="setResizerToMove(null)"
12
+ />
13
+ </template>
14
+ <script>
15
+ import { mapGetters, mapMutations } from 'vuex'
16
+ export default {
17
+ name: 'TacheResizer',
18
+ props: {
19
+ owner: {
20
+ type: Object,
21
+ default: null
22
+ },
23
+ position: {
24
+ type: String,
25
+ default: ''
26
+ }
27
+ },
28
+ computed: {
29
+ ...mapGetters('wfEditor', [
30
+ 'selectedTaches'
31
+ ]),
32
+ area() {
33
+ const width = 8
34
+ const height = 8
35
+ let x, y
36
+ switch (this.position) {
37
+ case 'NW':
38
+ x = this.owner.x
39
+ y = this.owner.y
40
+ break
41
+ case 'NE':
42
+ x = this.owner.x + this.owner.width
43
+ y = this.owner.y
44
+ break
45
+ case 'SW':
46
+ x = this.owner.x
47
+ y = this.owner.y + this.owner.height
48
+ break
49
+ case 'SE':
50
+ x = this.owner.x + this.owner.width
51
+ y = this.owner.y + this.owner.height
52
+ break
53
+ }
54
+ // 环节的四个顶点是resizer的中心点
55
+ x = x - width / 2
56
+ y = y - height / 2
57
+ const cursor = this.position.toLowerCase() + '-resize'
58
+ return {
59
+ x, y, width, height, cursor
60
+ }
61
+ }
62
+ },
63
+ methods: {
64
+ ...mapMutations('wfEditor', [
65
+ 'setMovingResizer',
66
+ 'setResizerToMove',
67
+ 'setContextMenuVisible'
68
+ ])
69
+
70
+ }
71
+ }
72
+ </script>
73
+ <style>
74
+ .resizer{
75
+ stroke: blue;
76
+ stroke-width: 1;
77
+ fill: white;
78
+ }
79
+ </style>
80
+
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <g>
3
+ <path
4
+ :d="path"
5
+ marker-end="url(#arrow)"
6
+ />
7
+ <template v-if="owner.isSelected">
8
+ <template v-if="controlPoint">
9
+ <circle
10
+ v-for="(point,index) in controlPoint"
11
+ :key="point.x+point.y"
12
+ :cx="point.x"
13
+ :cy="point.y"
14
+ r="3"
15
+ class="control-point"
16
+ @mousedown.stop="startDrag(index, $event)"
17
+ @mouseup.stop="endDrag"
18
+ />
19
+ </template>
20
+ </template>
21
+ </g>
22
+ </template>
23
+ <script>
24
+ import { getJoint } from '../util'
25
+ import { mapMutations } from 'vuex'
26
+ export default {
27
+ name: 'BrokenLine',
28
+ props: {
29
+ owner: {
30
+ type: Object,
31
+ default: null
32
+ }
33
+ },
34
+ computed: {
35
+ // 二次贝塞尔曲线由两个端点和一个控制点组成,Q命令就是用来画二次曲线的
36
+ startPoint() {
37
+ return getJoint(this.owner.startJoint.parent, this.owner.startJoint.position)
38
+ },
39
+ endPoint() {
40
+ return getJoint(this.owner.endJoint.parent, this.owner.endJoint.position)
41
+ },
42
+ controlPoint() {
43
+ return this.owner.lineInfo.controlPoint
44
+ },
45
+ path() {
46
+ let myPath = 'M ' + this.startPoint.x + ' ' + this.startPoint.y + ' '
47
+ if (this.controlPoint) {
48
+ this.controlPoint.forEach(point => {
49
+ myPath += 'L ' + point.x + ' ' + point.y
50
+ })
51
+ }
52
+ myPath += 'L ' + this.endPoint.x + ' ' + this.endPoint.y
53
+ return myPath
54
+ }
55
+ },
56
+ created: function() {
57
+ console.log('this.owner.lineInfo=', this.owner.lineInfo)
58
+ // controlPoint没有值是需要给一个初始值:默认的控制点是起点的x坐标和终点的y坐标结合
59
+ if (!this.owner.lineInfo.controlPoint) {
60
+ const x = this.startPoint.x + (this.endPoint.x - this.startPoint.x) / 2
61
+ const y = this.startPoint.y + (this.endPoint.y - this.startPoint.y) / 2
62
+ this.owner.lineInfo.controlPoint = [{ x, y }]
63
+ }
64
+ },
65
+ methods: {
66
+ ...mapMutations('wfEditor', [
67
+ 'setControlPointToMove'
68
+ ]),
69
+ startDrag(pointIndex, $event) {
70
+ console.log('brokenLine--startDrag-----')
71
+ this.setControlPointToMove({
72
+ owner: this.owner,
73
+ pointIndex: pointIndex
74
+ })
75
+ },
76
+ endDrag() {
77
+ this.setControlPointToMove(null)
78
+ }
79
+ }
80
+ }
81
+ </script>
82
+ <style scoped>
83
+ .control-point{
84
+ fill: #fff;
85
+ cursor: move;
86
+ }
87
+ .control-line {
88
+ stroke-dasharray: 2 2
89
+ }
90
+ </style>
91
+
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <g>
3
+ <path
4
+ :d="path"
5
+ marker-end="url(#arrow)"
6
+ />
7
+ <template v-if="owner.isSelected">
8
+ <path :d="pathToStartPoint" class="control-line" />
9
+ <path :d="pathToEndPoint" class="control-line" />
10
+ <circle
11
+ :cx="controlPoint.x"
12
+ :cy="controlPoint.y"
13
+ r="3"
14
+ class="control-point"
15
+ @mousedown.stop="startDrag"
16
+ @mouseup.stop="endDrag"
17
+ />
18
+ </template>
19
+ </g>
20
+ </template>
21
+ <script>
22
+ import { getJoint } from '../util'
23
+ import { mapMutations } from 'vuex'
24
+ export default {
25
+ name: 'CurveLine',
26
+ props: {
27
+ owner: {
28
+ type: Object,
29
+ default: null
30
+ }
31
+ },
32
+ computed: {
33
+ // 二次贝塞尔曲线由两个端点和一个控制点组成,Q命令就是用来画二次曲线的
34
+ startPoint() {
35
+ return getJoint(this.owner.startJoint.parent, this.owner.startJoint.position)
36
+ },
37
+ endPoint() {
38
+ return getJoint(this.owner.endJoint.parent, this.owner.endJoint.position)
39
+ },
40
+ controlPoint() {
41
+ return this.owner.lineInfo.controlPoint
42
+ },
43
+ path() {
44
+ return 'M ' + this.startPoint.x + ' ' + this.startPoint.y + ' ' +
45
+ 'Q ' + this.controlPoint.x + ' ' + this.controlPoint.y + ' ' +
46
+ this.endPoint.x + ' ' + this.endPoint.y
47
+ },
48
+ pathToStartPoint() {
49
+ return 'M ' + this.controlPoint.x + ' ' + this.controlPoint.y +
50
+ 'L ' + this.startPoint.x + ' ' + this.startPoint.y
51
+ },
52
+ pathToEndPoint() {
53
+ return 'M ' + this.controlPoint.x + ' ' + this.controlPoint.y +
54
+ 'L ' + this.endPoint.x + ' ' + this.endPoint.y
55
+ }
56
+ },
57
+ created: function() {
58
+ // controlPoint没有值是需要给一个初始值:默认的控制点是起点的x坐标和终点的y坐标结合
59
+ if (!this.owner.lineInfo.controlPoint) {
60
+ let x = this.startPoint.x + (this.endPoint.x - this.startPoint.x) / 2
61
+ if (x + 10 < this.startPoint.x || x < this.startPoint.x + 10) {
62
+ x = this.startPoint.x + 30
63
+ }
64
+ this.owner.lineInfo.controlPoint = { x, y: this.endPoint.y }
65
+ }
66
+ },
67
+ methods: {
68
+ ...mapMutations('wfEditor', [
69
+ 'setControlPointToMove'
70
+ ]),
71
+ startDrag(event) {
72
+ this.setControlPointToMove({
73
+ owner: this.owner
74
+ })
75
+ },
76
+ endDrag() {
77
+ this.setControlPointToMove(null)
78
+ }
79
+ }
80
+ }
81
+ </script>
82
+ <style scoped>
83
+ .control-point{
84
+ fill: #fff;
85
+ cursor: move;
86
+ }
87
+ .control-line {
88
+ stroke-dasharray: 2 2
89
+ }
90
+ </style>
91
+
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <path
3
+ :d="path"
4
+ marker-end="url(#arrow)"
5
+ />
6
+ </template>
7
+ <script>
8
+ import { getJoint } from '../util'
9
+ export default {
10
+ name: 'StraightLine',
11
+ props: {
12
+ owner: {
13
+ type: Object,
14
+ default: null
15
+ }
16
+ },
17
+ computed: {
18
+ path() {
19
+ const startPoint = getJoint(this.owner.startJoint.parent, this.owner.startJoint.position)
20
+ const endPoint = getJoint(this.owner.endJoint.parent, this.owner.endJoint.position)
21
+ return 'M' + startPoint.x + ' ' + startPoint.y + ' L' + endPoint.x + ' ' + endPoint.y
22
+ }
23
+ }
24
+ }
25
+ </script>
26
+
@@ -0,0 +1,212 @@
1
+ <template>
2
+ <g
3
+ :class="{'no-events': draggerToMove!=null}"
4
+ @mousedown.stop="select"
5
+ @dblclick.stop="showPropertiesEditor"
6
+ >
7
+ <text
8
+ :x="text.x"
9
+ :y="text.y"
10
+ text-anchor="middle"
11
+ class="draggable"
12
+ >
13
+ {{ name }}
14
+ </text>
15
+ <component :is="model.lineInfo.type" :owner="model" :class="{'transition':true,'selected':model.isSelected||(model.startJoint.parent.isSelected&&model.endJoint.parent.isSelected)}" />
16
+ <!-- <straight-line :owner="model" :class="{'transition':true,'selected':model.isSelected||(model.startJoint.parent.isSelected&&model.endJoint.parent.isSelected)}"/> -->
17
+ <g v-if="model.isSelected">
18
+ <circle
19
+ v-for="dragger in draggers"
20
+ :key="dragger.position"
21
+ :cx="dragger.x"
22
+ :cy="dragger.y"
23
+ class="transition-dragger"
24
+ r="4"
25
+ @mousedown.stop="startDrag($event,dragger.position)"
26
+ @mouseup="endDrag"
27
+ />
28
+ </g>
29
+ </g>
30
+ </template>
31
+ <script>
32
+ import { getJoint, getMousePosition, clearAllSelectedComponents, watchShowName } from '../util'
33
+ import { mapGetters, mapMutations } from 'vuex'
34
+ import StraightLine from './straight-line'
35
+ import CurveLine from './curve-line'
36
+ import BrokenLine from './broken-line'
37
+ export default {
38
+ name: 'Transition',
39
+ components: {
40
+ StraightLine,
41
+ CurveLine,
42
+ BrokenLine
43
+ },
44
+ props: {
45
+ model: {
46
+ type: Object,
47
+ default: null
48
+ }
49
+ },
50
+ data() {
51
+ const point = this.getTextPoint()
52
+ return {
53
+ text: {
54
+ x: point.x,
55
+ y: point.y
56
+ },
57
+ name: this.model.remark
58
+ }
59
+ },
60
+ computed: {
61
+ ...mapGetters('wfEditor', [
62
+ 'draggerToMove',
63
+ 'processI18n'
64
+ ]),
65
+ draggers() {
66
+ const startPoint = getJoint(this.model.startJoint.parent, this.model.startJoint.position)
67
+ startPoint.position = 'start'
68
+ const endPoint = getJoint(this.model.endJoint.parent, this.model.endJoint.position)
69
+ endPoint.position = 'end'
70
+ return [startPoint, endPoint]
71
+ },
72
+ path() {
73
+ return 'M' + this.draggers[0].x + ' ' + this.draggers[0].y + ' L' + this.draggers[1].x + ' ' + this.draggers[1].y
74
+ }
75
+ },
76
+ created() {
77
+ this.name = watchShowName(this, this.name)
78
+ },
79
+ mounted() {
80
+ // 线条名称内容修改时
81
+ this.$watch('model.remark', function(newVal) {
82
+ this.name = watchShowName(this, newVal)
83
+ if (this.name && this.name !== '') {
84
+ // 计算文本框的x、y坐标
85
+ const point = this.getTextPoint()
86
+ this.text.x = point.x
87
+ this.text.y = point.y
88
+ }
89
+ })
90
+ // 右键菜单更改线条方式时
91
+ this.$watch('model.lineInfo.type', function(newVal) {
92
+ // 计算文本框的x、y坐标
93
+ const point = this.getTextPoint()
94
+ this.text.x = point.x
95
+ this.text.y = point.y
96
+ })
97
+ // 拖动控制点的位置时
98
+ this.$watch('model.lineInfo.controlPoint', function(newVal) {
99
+ // 计算文本框的x、y坐标
100
+ const point = this.getTextPoint()
101
+ this.text.x = point.x
102
+ this.text.y = point.y
103
+ })
104
+ // 水平拖动起点节点
105
+ this.$watch('model.startJoint.parent.x', function(newVal) {
106
+ // 计算文本框的x、y坐标
107
+ const point = this.getTextPoint()
108
+ this.text.x = point.x
109
+ this.text.y = point.y
110
+ })
111
+ // 垂直拖动起点节点
112
+ this.$watch('model.startJoint.parent.y', function(newVal) {
113
+ // 计算文本框的x、y坐标
114
+ const point = this.getTextPoint()
115
+ this.text.x = point.x
116
+ this.text.y = point.y
117
+ })
118
+ // 水平拖动终点节点
119
+ this.$watch('model.endJoint.parent.x', function(newVal) {
120
+ // 计算文本框的x、y坐标
121
+ const point = this.getTextPoint()
122
+ this.text.x = point.x
123
+ this.text.y = point.y
124
+ })
125
+ // 垂直拖动终点节点
126
+ this.$watch('model.endJoint.parent.y', function(newVal) {
127
+ // 计算文本框的x、y坐标
128
+ const point = this.getTextPoint()
129
+ this.text.x = point.x
130
+ this.text.y = point.y
131
+ })
132
+ },
133
+ methods: {
134
+ ...mapMutations('wfEditor', [
135
+ 'setMouseDownPosition',
136
+ 'setDraggerToMove',
137
+ 'setSelectedTransition',
138
+ 'setPropertiesEditorFor'
139
+ ]),
140
+ getTextPoint() {
141
+ const startPoint = getJoint(this.model.startJoint.parent, this.model.startJoint.position)
142
+ const endPoint = getJoint(this.model.endJoint.parent, this.model.endJoint.position)
143
+ let minX = startPoint.x < endPoint.x ? startPoint.x : endPoint.x
144
+ let minY = startPoint.y < endPoint.y ? startPoint.y : endPoint.y
145
+ let textX = minX + Math.abs(startPoint.x - endPoint.x) / 2
146
+ let textY = minY + Math.abs(startPoint.y - endPoint.y) / 2
147
+ if (this.model.lineInfo.type === 'CurveLine') {
148
+ // 曲线
149
+ const point = this.model.lineInfo.controlPoint
150
+ if (point) {
151
+ minX = startPoint.x < point.x ? startPoint.x : parseFloat(point.x)
152
+ minY = startPoint.y < point.y ? startPoint.y : parseFloat(point.y)
153
+ textX = minX + Math.abs(startPoint.x - point.x) / 2 + 10
154
+ textY = minY + Math.abs(startPoint.y - point.y) / 2 - 10
155
+ }
156
+ } else if (this.model.lineInfo.type === 'BrokenLine') {
157
+ const point = this.model.lineInfo.controlPoint[0]
158
+ if (point) {
159
+ minX = startPoint.x < point.x ? startPoint.x : parseFloat(point.x)
160
+ minY = startPoint.y < point.y ? startPoint.y : parseFloat(point.y)
161
+ textX = minX + Math.abs(startPoint.x - point.x) / 2
162
+ textY = minY + Math.abs(startPoint.y - point.y) / 2 - 10
163
+ }
164
+ }
165
+ return { x: textX, y: textY }
166
+ },
167
+ select(event) {
168
+ clearAllSelectedComponents()
169
+ this.model.isSelected = true
170
+ this.setSelectedTransition(this.model)
171
+ },
172
+ startDrag(event, position) {
173
+ console.log('start dragging line')
174
+ this.setMouseDownPosition(getMousePosition(event))
175
+ this.setDraggerToMove({
176
+ owner: this.model,
177
+ position,
178
+ originStartJoint: this.model.startJoint,
179
+ originEndJoint: this.model.endJoint
180
+ })
181
+ },
182
+ endDrag() {
183
+ // this.setSe
184
+ },
185
+ showPropertiesEditor() {
186
+ if (this.model.endJoint.parent.type !== 'Decision') {
187
+ this.setPropertiesEditorFor('Transition')
188
+ }
189
+ }
190
+ }
191
+ }
192
+ </script>
193
+ <style scoped>
194
+ .transition{
195
+ stroke-width: 2;
196
+ stroke:#666;
197
+ fill: none;
198
+ cursor: pointer;
199
+ }
200
+ .selected{
201
+ stroke:red;
202
+ }
203
+ .transition-dragger{
204
+ stroke: red;
205
+ stroke-width: 1;
206
+ fill: white;
207
+ cursor:move;
208
+ }
209
+ .no-events{
210
+ pointer-events: none;
211
+ }
212
+ </style>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <g>
3
+ <path v-show="path" :d="path" class="virtual-transition" marker-end="url(#arrow)" />
4
+ </g>
5
+ </template>
6
+ <script>
7
+ import { getJoint } from '../util'
8
+ import { mapGetters } from 'vuex'
9
+ export default {
10
+ name: 'VirtualTransition',
11
+ props: {
12
+ toPosition: {
13
+ type: Object,
14
+ default: null
15
+ }
16
+ },
17
+ computed: {
18
+ ...mapGetters('wfEditor', [
19
+ 'startJoint'
20
+ ]),
21
+ path() {
22
+ if (!this.startJoint) {
23
+ return null
24
+ }
25
+ const startJoint = getJoint(this.startJoint.parent, this.startJoint.position)
26
+ // 虚线的endJoint存的就是鼠标的当前位置,此时还没有连接到任何环节上
27
+ const endJoint = this.toPosition
28
+ return 'M' + startJoint.x + ' ' + startJoint.y + ' L' + endJoint.x + ' ' + endJoint.y
29
+ }
30
+ },
31
+ methods: {
32
+
33
+ }
34
+ }
35
+ </script>
36
+ <style>
37
+ .virtual-transition{
38
+ stroke-width: 2;
39
+ stroke:#000;
40
+ stroke-dasharray: 2 2;
41
+ fill: none;
42
+ }
43
+ </style>