workflow-editor 0.0.7-up → 0.0.8-up
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.
- package/package.json +12 -2
- package/index.html +0 -13
- package/packages/index.js +0 -34
- package/packages/plugins/formValidatorUtil.js +0 -533
- package/packages/plugins/index.js +0 -8
- package/packages/workflow-editor/index.js +0 -14
- package/packages/workflow-editor/src/api.js +0 -7
- package/packages/workflow-editor/src/assets/wf-editor-icons.js +0 -2
- package/packages/workflow-editor/src/constant.js +0 -8
- package/packages/workflow-editor/src/json-object-templates/auto-task.js +0 -70
- package/packages/workflow-editor/src/json-object-templates/copy-task.js +0 -72
- package/packages/workflow-editor/src/json-object-templates/decision.js +0 -11
- package/packages/workflow-editor/src/json-object-templates/end.js +0 -14
- package/packages/workflow-editor/src/json-object-templates/fork.js +0 -10
- package/packages/workflow-editor/src/json-object-templates/human-decision.js +0 -9
- package/packages/workflow-editor/src/json-object-templates/human-task.js +0 -199
- package/packages/workflow-editor/src/json-object-templates/join.js +0 -10
- package/packages/workflow-editor/src/json-object-templates/process.js +0 -98
- package/packages/workflow-editor/src/json-object-templates/start.js +0 -13
- package/packages/workflow-editor/src/json-object-templates/subprocess.js +0 -31
- package/packages/workflow-editor/src/json-object-templates/transition.js +0 -26
- package/packages/workflow-editor/src/main/admin-save-dialog.vue +0 -66
- package/packages/workflow-editor/src/main/canvas.vue +0 -483
- package/packages/workflow-editor/src/main/context-menu.vue +0 -132
- package/packages/workflow-editor/src/main/icon-svg.vue +0 -32
- package/packages/workflow-editor/src/main/selection-region.vue +0 -66
- package/packages/workflow-editor/src/main/tache-history-tooltip.vue +0 -38
- package/packages/workflow-editor/src/main/tache-name-input.vue +0 -19
- package/packages/workflow-editor/src/main/tache-subprocess-history-dialog.vue +0 -35
- package/packages/workflow-editor/src/main/toolbox.vue +0 -60
- package/packages/workflow-editor/src/main/wf-history-canvas.vue +0 -304
- package/packages/workflow-editor/src/process-json.js +0 -623
- package/packages/workflow-editor/src/process-service.js +0 -31
- package/packages/workflow-editor/src/properties-editors/auto-task/basic-properties.vue +0 -81
- package/packages/workflow-editor/src/properties-editors/auto-task/permission-settings.vue +0 -155
- package/packages/workflow-editor/src/properties-editors/auto-task.vue +0 -73
- package/packages/workflow-editor/src/properties-editors/common/additional-condition-utils.js +0 -531
- package/packages/workflow-editor/src/properties-editors/common/additional-condition.vue +0 -276
- package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields-utils.js +0 -34
- package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields.vue +0 -239
- package/packages/workflow-editor/src/properties-editors/common/common-notice-tool.vue +0 -67
- package/packages/workflow-editor/src/properties-editors/common/common-user-condition.vue +0 -241
- package/packages/workflow-editor/src/properties-editors/common/form-fields-utils.js +0 -23
- package/packages/workflow-editor/src/properties-editors/common/form-fields.vue +0 -116
- package/packages/workflow-editor/src/properties-editors/common/i18n-input.vue +0 -75
- package/packages/workflow-editor/src/properties-editors/common/i18n-set-dialog.vue +0 -125
- package/packages/workflow-editor/src/properties-editors/common/notice-reminder.vue +0 -72
- package/packages/workflow-editor/src/properties-editors/common/notice.vue +0 -101
- package/packages/workflow-editor/src/properties-editors/common/reminder.vue +0 -185
- package/packages/workflow-editor/src/properties-editors/common/select-mail-template.vue +0 -83
- package/packages/workflow-editor/src/properties-editors/common/standard-fields.vue +0 -65
- package/packages/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue +0 -347
- package/packages/workflow-editor/src/properties-editors/common/system-role-tree.vue +0 -63
- package/packages/workflow-editor/src/properties-editors/common/task-title.vue +0 -148
- package/packages/workflow-editor/src/properties-editors/common/transactor-settings.vue +0 -233
- package/packages/workflow-editor/src/properties-editors/common/user-selection.vue +0 -386
- package/packages/workflow-editor/src/properties-editors/common/value-selection-dialog.vue +0 -209
- package/packages/workflow-editor/src/properties-editors/common/variables.vue +0 -135
- package/packages/workflow-editor/src/properties-editors/copy-task/basic-properties.vue +0 -90
- package/packages/workflow-editor/src/properties-editors/copy-task/permission-settings.vue +0 -155
- package/packages/workflow-editor/src/properties-editors/copy-task.vue +0 -94
- package/packages/workflow-editor/src/properties-editors/decision.vue +0 -90
- package/packages/workflow-editor/src/properties-editors/fork.vue +0 -72
- package/packages/workflow-editor/src/properties-editors/human-decision.vue +0 -44
- package/packages/workflow-editor/src/properties-editors/human-task/additional-condition-dialog.vue +0 -60
- package/packages/workflow-editor/src/properties-editors/human-task/basic-properties.vue +0 -160
- package/packages/workflow-editor/src/properties-editors/human-task/componentsConfigUtil.js +0 -291
- package/packages/workflow-editor/src/properties-editors/human-task/custom-actions.vue +0 -249
- package/packages/workflow-editor/src/properties-editors/human-task/editable-child-field-setting.vue +0 -392
- package/packages/workflow-editor/src/properties-editors/human-task/editable-child-fields.vue +0 -241
- package/packages/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue +0 -220
- package/packages/workflow-editor/src/properties-editors/human-task/editable-fields.vue +0 -204
- package/packages/workflow-editor/src/properties-editors/human-task/events.vue +0 -59
- package/packages/workflow-editor/src/properties-editors/human-task/permission-settings.vue +0 -207
- package/packages/workflow-editor/src/properties-editors/human-task/selection-conditions.vue +0 -390
- package/packages/workflow-editor/src/properties-editors/human-task.vue +0 -109
- package/packages/workflow-editor/src/properties-editors/join.vue +0 -44
- package/packages/workflow-editor/src/properties-editors/process/basic-properties.vue +0 -273
- package/packages/workflow-editor/src/properties-editors/process/events.vue +0 -76
- package/packages/workflow-editor/src/properties-editors/process/notice-settings.vue +0 -60
- package/packages/workflow-editor/src/properties-editors/process/parameter-settings.vue +0 -95
- package/packages/workflow-editor/src/properties-editors/process/permission-settings.vue +0 -28
- package/packages/workflow-editor/src/properties-editors/process/selectPage.vue +0 -81
- package/packages/workflow-editor/src/properties-editors/process.vue +0 -115
- package/packages/workflow-editor/src/properties-editors/subprocess/basic-properties.vue +0 -199
- package/packages/workflow-editor/src/properties-editors/subprocess/events.vue +0 -26
- package/packages/workflow-editor/src/properties-editors/subprocess/field-mappings.vue +0 -206
- package/packages/workflow-editor/src/properties-editors/subprocess/transactor-settings.vue +0 -64
- package/packages/workflow-editor/src/properties-editors/subprocess.vue +0 -79
- package/packages/workflow-editor/src/properties-editors/transition/basic-properties.vue +0 -53
- package/packages/workflow-editor/src/properties-editors/transition.vue +0 -74
- package/packages/workflow-editor/src/properties-editors/user-condition.js +0 -177
- package/packages/workflow-editor/src/store/getters.js +0 -27
- package/packages/workflow-editor/src/store/workflow-editor.js +0 -125
- package/packages/workflow-editor/src/taches/auto-task.vue +0 -99
- package/packages/workflow-editor/src/taches/common-methods.js +0 -21
- package/packages/workflow-editor/src/taches/copy-task.vue +0 -99
- package/packages/workflow-editor/src/taches/custom-task.vue +0 -88
- package/packages/workflow-editor/src/taches/decision.vue +0 -102
- package/packages/workflow-editor/src/taches/end.vue +0 -76
- package/packages/workflow-editor/src/taches/fork.vue +0 -102
- package/packages/workflow-editor/src/taches/human-decision.vue +0 -102
- package/packages/workflow-editor/src/taches/human-task.vue +0 -113
- package/packages/workflow-editor/src/taches/join.vue +0 -91
- package/packages/workflow-editor/src/taches/joint.vue +0 -177
- package/packages/workflow-editor/src/taches/start.vue +0 -76
- package/packages/workflow-editor/src/taches/subprocess.vue +0 -99
- package/packages/workflow-editor/src/taches/tache-resizer.vue +0 -80
- package/packages/workflow-editor/src/transitions/broken-line.vue +0 -91
- package/packages/workflow-editor/src/transitions/curve-line.vue +0 -91
- package/packages/workflow-editor/src/transitions/straight-line.vue +0 -26
- package/packages/workflow-editor/src/transitions/transition.vue +0 -212
- package/packages/workflow-editor/src/transitions/virtual-transition.vue +0 -43
- package/packages/workflow-editor/src/util.js +0 -489
- package/packages/workflow-editor/src/workflow-editor.vue +0 -606
- package/packages/workflow-editor/src/workflow-history.vue +0 -153
- package/public/vite.svg +0 -1
- package/src/i18n/i18n.js +0 -16
- package/src/i18n/langs/cn.js +0 -509
- package/src/i18n/langs/en.js +0 -551
- package/vite.config.js +0 -36
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-dialog
|
|
3
|
-
visible
|
|
4
|
-
:title="$t('workflowEditorPublicModel.tipTitle')"
|
|
5
|
-
:center="true"
|
|
6
|
-
top="10vh"
|
|
7
|
-
append-to-body
|
|
8
|
-
@open="$emit('open')"
|
|
9
|
-
@opend="$emit('opend')"
|
|
10
|
-
@close="$emit('close')"
|
|
11
|
-
@closed="$emit('closed')"
|
|
12
|
-
>
|
|
13
|
-
<div>
|
|
14
|
-
{{ $t('workflowEditorMessage.adminSaveTip') }}
|
|
15
|
-
</div>
|
|
16
|
-
<ul>
|
|
17
|
-
<li>
|
|
18
|
-
{{ $t('workflowEditorMessage.adminSaveTip1') }}
|
|
19
|
-
</li>
|
|
20
|
-
<li>
|
|
21
|
-
{{ $t('workflowEditorMessage.adminSaveTip2') }}
|
|
22
|
-
</li>
|
|
23
|
-
<li>
|
|
24
|
-
{{ $t('workflowEditorMessage.adminSaveTip3') }}
|
|
25
|
-
</li>
|
|
26
|
-
<li>
|
|
27
|
-
{{ $t('workflowEditorMessage.adminSaveTip4') }}
|
|
28
|
-
</li>
|
|
29
|
-
</ul>
|
|
30
|
-
<div>
|
|
31
|
-
{{ $t('workflowEditorMessage.adminSaveTip5') }}
|
|
32
|
-
</div>
|
|
33
|
-
<div slot="footer" class="dialog-footer">
|
|
34
|
-
<el-button @click="updateWfVersion">
|
|
35
|
-
{{ $t('workflowEditorMessage.updateVersion') }}
|
|
36
|
-
</el-button>
|
|
37
|
-
<el-button type="primary" @click="addWfVersion">
|
|
38
|
-
{{ $t('workflowEditorMessage.addVersion') }}
|
|
39
|
-
</el-button>
|
|
40
|
-
<el-button @click="$emit('close')">
|
|
41
|
-
{{ $t('workflowEditorPublicModel.cancel') }}
|
|
42
|
-
</el-button>
|
|
43
|
-
</div>
|
|
44
|
-
</el-dialog>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
|
|
49
|
-
export default {
|
|
50
|
-
name: 'AdminSaveDialog',
|
|
51
|
-
data() {
|
|
52
|
-
return {
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
methods: {
|
|
57
|
-
updateWfVersion() {
|
|
58
|
-
this.$emit('update')
|
|
59
|
-
},
|
|
60
|
-
addWfVersion() {
|
|
61
|
-
this.$emit('add')
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
</script>
|
|
66
|
-
|
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="svgContainer" style="position:relative">
|
|
3
|
-
<svg
|
|
4
|
-
id="svg"
|
|
5
|
-
width="2000"
|
|
6
|
-
height="2000"
|
|
7
|
-
@mousedown="mousedown"
|
|
8
|
-
@mousemove="mousemove"
|
|
9
|
-
@mouseup="mouseup"
|
|
10
|
-
@mouseleave="mouseleave"
|
|
11
|
-
@dblclick="setPropertiesEditorFor('Process')"
|
|
12
|
-
>
|
|
13
|
-
<defs>
|
|
14
|
-
<marker id="arrow" markerWidth="10" markerHeight="10" refX="6" refY="2" orient="auto" markerUnits="strokeWidth">
|
|
15
|
-
<path d="M0,0 L0,4 L6,2 z" fill="#666" />
|
|
16
|
-
</marker>
|
|
17
|
-
</defs>
|
|
18
|
-
<component
|
|
19
|
-
:is="tache.type"
|
|
20
|
-
v-for="tache in taches"
|
|
21
|
-
:key="tache.id"
|
|
22
|
-
:model="tache"
|
|
23
|
-
@mouseenter.native="showTacheHistoryTooltip"
|
|
24
|
-
@mouseleave.native="hideTacheHistoryTooltip"
|
|
25
|
-
@mousemove.native="updateTacheHistoryTooltipPosition"
|
|
26
|
-
/>
|
|
27
|
-
<transition
|
|
28
|
-
v-for="transition in transitions"
|
|
29
|
-
:key="transition.id"
|
|
30
|
-
:model="transition"
|
|
31
|
-
/>
|
|
32
|
-
<virtual-transition :toPosition="currentPosition" />
|
|
33
|
-
<selection-region :region="region" />
|
|
34
|
-
</svg>
|
|
35
|
-
<component
|
|
36
|
-
:is="propertiesEditorFor+'PropertiesEditor'"
|
|
37
|
-
v-if="!showHistory&&propertiesEditorFor"
|
|
38
|
-
:model="selectedTaches[0]||selectedTransition||process"
|
|
39
|
-
@close="setPropertiesEditorFor('')"
|
|
40
|
-
/>
|
|
41
|
-
<tache-history-tooltip v-if="showHistory&&showTacheHistory" :style="tooltipPosition" />
|
|
42
|
-
</div>
|
|
43
|
-
</template>
|
|
44
|
-
|
|
45
|
-
<script>
|
|
46
|
-
import Start from '../taches/start'
|
|
47
|
-
import End from '../taches/end'
|
|
48
|
-
import HumanTask from '../taches/human-task'
|
|
49
|
-
import Decision from '../taches/decision'
|
|
50
|
-
import Subprocess from '../taches/subprocess'
|
|
51
|
-
import CustomTask from '../taches/custom-task'
|
|
52
|
-
import Fork from '../taches/fork'
|
|
53
|
-
import Join from '../taches/join'
|
|
54
|
-
import HumanDecision from '../taches/human-decision'
|
|
55
|
-
import CopyTask from '../taches/copy-task'
|
|
56
|
-
import AutoTask from '../taches/auto-task'
|
|
57
|
-
import Transition from '../transitions/transition'
|
|
58
|
-
import VirtualTransition from '../transitions/virtual-transition'
|
|
59
|
-
import SelectionRegion from './selection-region'
|
|
60
|
-
import HumanTaskPropertiesEditor from '../properties-editors/human-task'
|
|
61
|
-
import ProcessPropertiesEditor from '../properties-editors/process'
|
|
62
|
-
import DecisionPropertiesEditor from '../properties-editors/decision'
|
|
63
|
-
import TransitionPropertiesEditor from '../properties-editors/transition'
|
|
64
|
-
import ForkPropertiesEditor from '../properties-editors/fork'
|
|
65
|
-
import JoinPropertiesEditor from '../properties-editors/join'
|
|
66
|
-
import HumanDecisionPropertiesEditor from '../properties-editors/human-decision'
|
|
67
|
-
import CopyTaskPropertiesEditor from '../properties-editors/copy-task'
|
|
68
|
-
import AutoTaskPropertiesEditor from '../properties-editors/auto-task'
|
|
69
|
-
import SubprocessPropertiesEditor from '../properties-editors/subprocess'
|
|
70
|
-
import TacheHistoryTooltip from './tache-history-tooltip'
|
|
71
|
-
import { mapGetters, mapMutations } from 'vuex'
|
|
72
|
-
import { getMousePosition, getVirtualRegion, getRealRegion, clearAllSelectedComponents } from '../util'
|
|
73
|
-
|
|
74
|
-
export default {
|
|
75
|
-
name: 'Canvas',
|
|
76
|
-
components: {
|
|
77
|
-
Start,
|
|
78
|
-
End,
|
|
79
|
-
HumanTask,
|
|
80
|
-
Decision,
|
|
81
|
-
Subprocess,
|
|
82
|
-
CustomTask,
|
|
83
|
-
Fork,
|
|
84
|
-
Join,
|
|
85
|
-
HumanDecision,
|
|
86
|
-
CopyTask,
|
|
87
|
-
Transition,
|
|
88
|
-
VirtualTransition,
|
|
89
|
-
SelectionRegion,
|
|
90
|
-
HumanTaskPropertiesEditor,
|
|
91
|
-
ProcessPropertiesEditor,
|
|
92
|
-
DecisionPropertiesEditor,
|
|
93
|
-
TransitionPropertiesEditor,
|
|
94
|
-
ForkPropertiesEditor,
|
|
95
|
-
JoinPropertiesEditor,
|
|
96
|
-
HumanDecisionPropertiesEditor,
|
|
97
|
-
CopyTaskPropertiesEditor,
|
|
98
|
-
SubprocessPropertiesEditor,
|
|
99
|
-
TacheHistoryTooltip,
|
|
100
|
-
AutoTask,
|
|
101
|
-
AutoTaskPropertiesEditor
|
|
102
|
-
},
|
|
103
|
-
props: {
|
|
104
|
-
process: {
|
|
105
|
-
type: Object,
|
|
106
|
-
default: null
|
|
107
|
-
},
|
|
108
|
-
showHistory: {
|
|
109
|
-
type: Boolean,
|
|
110
|
-
default: false
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
data: function() {
|
|
114
|
-
return {
|
|
115
|
-
inputArea: null,
|
|
116
|
-
currentPosition: null,
|
|
117
|
-
originPosition: null,
|
|
118
|
-
offset: null,
|
|
119
|
-
startPoint: null,
|
|
120
|
-
region: null,
|
|
121
|
-
endPoint: null,
|
|
122
|
-
transitionsInRegion: [],
|
|
123
|
-
showTacheHistory: false,
|
|
124
|
-
tooltipPosition: null
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
computed: {
|
|
128
|
-
...mapGetters('wfEditor', [
|
|
129
|
-
'taches',
|
|
130
|
-
'transitions',
|
|
131
|
-
'isMovingTache',
|
|
132
|
-
'mouseDownPosition',
|
|
133
|
-
'startJoint',
|
|
134
|
-
'endJoint',
|
|
135
|
-
'isDrawingRegion',
|
|
136
|
-
'isMovingRegion',
|
|
137
|
-
'selectedTransition',
|
|
138
|
-
'selectedTaches',
|
|
139
|
-
'resizerToMove',
|
|
140
|
-
'draggerToMove',
|
|
141
|
-
'controlPointToMove',
|
|
142
|
-
'propertiesEditorFor',
|
|
143
|
-
'contextMenuVisible'
|
|
144
|
-
])
|
|
145
|
-
},
|
|
146
|
-
mounted: function() {
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
methods: {
|
|
150
|
-
...mapMutations('wfEditor', [
|
|
151
|
-
'setTaches',
|
|
152
|
-
'setTransitions',
|
|
153
|
-
'resetState',
|
|
154
|
-
'setMovingTache',
|
|
155
|
-
'stopDrawingLine',
|
|
156
|
-
'setSelectedTaches',
|
|
157
|
-
'setDrawingRegion',
|
|
158
|
-
'setResizerToMove',
|
|
159
|
-
'setDraggerToMove',
|
|
160
|
-
'setControlPointToMove',
|
|
161
|
-
'setPropertiesEditorFor'
|
|
162
|
-
]),
|
|
163
|
-
forbidSelection() {
|
|
164
|
-
return false
|
|
165
|
-
},
|
|
166
|
-
add: function() {
|
|
167
|
-
// const tache = new TacheUI(this.snap, 50, 50)
|
|
168
|
-
// tache.draw()
|
|
169
|
-
},
|
|
170
|
-
// 各个组件上的mousedown,组件会自行处理,不会传播到canvas上来,这里发生的mousedown表示点击了canvas的空白区域
|
|
171
|
-
mousedown(event) {
|
|
172
|
-
console.log('mousedown')
|
|
173
|
-
// 鼠标按下时先清除上次选中的环节
|
|
174
|
-
this.unselectAll()
|
|
175
|
-
|
|
176
|
-
// 准备画新的选择区域
|
|
177
|
-
// isDrawingRegion标识是否可以开始画选择区域了,当mouseup时会重置
|
|
178
|
-
this.setDrawingRegion(true)
|
|
179
|
-
// startPoint和endPoint记录选择区域的起点和终点,当mouseup的时候如果有选中的tache则保留值,没有选中则清空值
|
|
180
|
-
this.startPoint = getMousePosition(event)
|
|
181
|
-
},
|
|
182
|
-
mousemove(event) {
|
|
183
|
-
// console.log('mousemove')
|
|
184
|
-
// 显示流转历史的时候不需要拖动环节
|
|
185
|
-
if (this.showHistory) return
|
|
186
|
-
// 给起始位置附上初始值,这个起始位置是个相对概念,每次mousemove后,这个值就变成最新的鼠标位置,作为下一次mousemove的起点
|
|
187
|
-
if (!this.originPosition && this.mouseDownPosition) {
|
|
188
|
-
this.originPosition = this.mouseDownPosition
|
|
189
|
-
}
|
|
190
|
-
this.currentPosition = getMousePosition(event)
|
|
191
|
-
if (this.isMovingTache) {
|
|
192
|
-
this.moveTache(this.selectedTaches[0])
|
|
193
|
-
}
|
|
194
|
-
this.drawVirtualSelectionRegion()
|
|
195
|
-
|
|
196
|
-
this.moveSelectionRegion()
|
|
197
|
-
|
|
198
|
-
this.resizeSelectedTache()
|
|
199
|
-
|
|
200
|
-
this.moveTransition()
|
|
201
|
-
|
|
202
|
-
this.adjustCurveLine()
|
|
203
|
-
|
|
204
|
-
this.originPosition = this.currentPosition
|
|
205
|
-
},
|
|
206
|
-
// 有些组件上的mouseup,会传播到canvas上来
|
|
207
|
-
mouseup(event) {
|
|
208
|
-
console.log('mouseup')
|
|
209
|
-
if (this.isMovingTache) {
|
|
210
|
-
this.setMovingTache(false)
|
|
211
|
-
}
|
|
212
|
-
// 在画布的空白地方mouseup时,停止画虚拟的流向,此时没有找到任何endJoint(在joint上mouseup才会设置endJoint)
|
|
213
|
-
if (this.startJoint) {
|
|
214
|
-
this.stopDrawingLine()
|
|
215
|
-
}
|
|
216
|
-
// 鼠标起来时,需要判断是否选中了tache,并显示选择区域
|
|
217
|
-
this.drawRegionWhenNeeded()
|
|
218
|
-
|
|
219
|
-
// tache变到最小时,继续移动鼠标会从resizer上移出去,如果此时松开鼠标就不会触发resizer的mouseup
|
|
220
|
-
if (this.resizerToMove) {
|
|
221
|
-
this.setResizerToMove(null)
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
this.resetMovedTransition()
|
|
225
|
-
},
|
|
226
|
-
mouseleave(event) {
|
|
227
|
-
this.drawRegionWhenNeeded()
|
|
228
|
-
|
|
229
|
-
this.resetMovedTransition()
|
|
230
|
-
|
|
231
|
-
this.resetState()
|
|
232
|
-
},
|
|
233
|
-
drawRegionWhenNeeded() {
|
|
234
|
-
if (this.isDrawingRegion) {
|
|
235
|
-
this.selectComponents()
|
|
236
|
-
this.drawRealSelectionRegion()
|
|
237
|
-
this.setDrawingRegion(false)
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
resetMovedTransition() {
|
|
241
|
-
// 如果正在移动transition,那么要清除掉状态,并还原transition的位置
|
|
242
|
-
if (this.draggerToMove) {
|
|
243
|
-
this.draggerToMove.owner.startJoint = this.draggerToMove.originStartJoint
|
|
244
|
-
this.draggerToMove.owner.endJoint = this.draggerToMove.originEndJoint
|
|
245
|
-
this.setDraggerToMove(null)
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
unselectAll() {
|
|
249
|
-
clearAllSelectedComponents()
|
|
250
|
-
// 选中的线也清除掉,此时线的状态并不是selected,这个只是为了移动控制点而增加的组件变量
|
|
251
|
-
this.transitionsInRegion = []
|
|
252
|
-
this.startPoint = null
|
|
253
|
-
this.region = null
|
|
254
|
-
},
|
|
255
|
-
selectComponents() {
|
|
256
|
-
// 如果选择区域缺少起点或终点,那么不需要选中任何东西,同时清除已有起点或者终点信息
|
|
257
|
-
if (!this.startPoint || !this.region) {
|
|
258
|
-
this.startPoint = null
|
|
259
|
-
this.region = null
|
|
260
|
-
return
|
|
261
|
-
}
|
|
262
|
-
// 判断环节是否在选择区域里面,如果在就选中
|
|
263
|
-
for (const tache of this.taches) {
|
|
264
|
-
if (this.isInsideSelectionRegion(tache)) {
|
|
265
|
-
tache.isSelected = true
|
|
266
|
-
this.selectedTaches.push(tache)
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
for (const transition of this.transitions) {
|
|
271
|
-
if (transition.startJoint.parent.isSelected && transition.endJoint.parent.isSelected) {
|
|
272
|
-
this.transitionsInRegion.push(transition)
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
isInsideSelectionRegion(tache) {
|
|
277
|
-
const isLeftTopCornerInside = (tache.x >= this.region.x && tache.y >= this.region.y)
|
|
278
|
-
const isRightDownCornerInside = ((tache.x + tache.width) <= (this.region.x + this.region.width) && (tache.y + tache.height) <= (this.region.y + this.region.height))
|
|
279
|
-
return isLeftTopCornerInside && isRightDownCornerInside
|
|
280
|
-
},
|
|
281
|
-
moveTache(tache) {
|
|
282
|
-
const x = this.currentPosition.x - this.originPosition.x
|
|
283
|
-
const y = this.currentPosition.y - this.originPosition.y
|
|
284
|
-
tache.x += x
|
|
285
|
-
tache.y += y
|
|
286
|
-
if (tache.x < 0) {
|
|
287
|
-
tache.x = 2
|
|
288
|
-
}
|
|
289
|
-
if (tache.y < 0) {
|
|
290
|
-
tache.y = 2
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
drawVirtualSelectionRegion() {
|
|
295
|
-
if (this.isDrawingRegion && this.startPoint) {
|
|
296
|
-
this.region = getVirtualRegion(this.startPoint, this.currentPosition)
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
drawRealSelectionRegion() {
|
|
300
|
-
// 如果只选中了一个环节,那么选择区域也不需要显示了,这时把起点和region也重置了
|
|
301
|
-
if (this.selectedTaches.length <= 1) {
|
|
302
|
-
this.startPoint = null
|
|
303
|
-
this.region = null
|
|
304
|
-
return
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
this.region = getRealRegion(this.selectedTaches)
|
|
308
|
-
// this.startPoint = area.startPoint
|
|
309
|
-
},
|
|
310
|
-
moveSelectionRegion() {
|
|
311
|
-
if (!this.isMovingRegion) {
|
|
312
|
-
return
|
|
313
|
-
}
|
|
314
|
-
// 移动选择区域
|
|
315
|
-
let dx = this.currentPosition.x - this.originPosition.x
|
|
316
|
-
let dy = this.currentPosition.y - this.originPosition.y
|
|
317
|
-
// 控制不能移出canvas的边界,保留2像素的间距
|
|
318
|
-
if (this.region.x + dx < 0) {
|
|
319
|
-
dx = 2 - this.region.x
|
|
320
|
-
}
|
|
321
|
-
if (this.region.y + dy < 0) {
|
|
322
|
-
dy = 2 - this.region.y
|
|
323
|
-
}
|
|
324
|
-
this.region.x = this.region.x + dx
|
|
325
|
-
this.region.y = this.region.y + dy
|
|
326
|
-
|
|
327
|
-
this.moveTachesInRegion(dx, dy)
|
|
328
|
-
this.moveTransitionControlPoints(dx, dy)
|
|
329
|
-
},
|
|
330
|
-
moveTachesInRegion(dx, dy) {
|
|
331
|
-
for (const tache of this.selectedTaches) {
|
|
332
|
-
tache.x += dx
|
|
333
|
-
tache.y += dy
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
moveTransitionControlPoints(dx, dy) {
|
|
337
|
-
for (const transition of this.transitionsInRegion) {
|
|
338
|
-
if (transition.lineInfo.type === 'CurveLine') {
|
|
339
|
-
transition.lineInfo.controlPoint.x += dx
|
|
340
|
-
transition.lineInfo.controlPoint.y += dy
|
|
341
|
-
} else if (transition.lineInfo.type === 'BrokenLine') {
|
|
342
|
-
transition.lineInfo.controlPoint.forEach(point => {
|
|
343
|
-
point.x += dx
|
|
344
|
-
point.y += dy
|
|
345
|
-
})
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
resizeSelectedTache() {
|
|
350
|
-
if (!this.resizerToMove) {
|
|
351
|
-
return
|
|
352
|
-
}
|
|
353
|
-
let dx = this.currentPosition.x - this.originPosition.x
|
|
354
|
-
let dy = this.currentPosition.y - this.originPosition.y
|
|
355
|
-
const tache = this.resizerToMove.owner
|
|
356
|
-
/**
|
|
357
|
-
* 1.拖动某个resizer时,对角线上的另一个resizer是不动的
|
|
358
|
-
* 2.拖动不同的resizer时,dx,dy即使出现负数时也可能是变大,这个时候就得做减法了
|
|
359
|
-
*/
|
|
360
|
-
switch (this.resizerToMove.position) {
|
|
361
|
-
case 'NW':
|
|
362
|
-
if (tache.width - dx < 80) {
|
|
363
|
-
dx = tache.width - 80
|
|
364
|
-
}
|
|
365
|
-
if (tache.height - dy < 40) {
|
|
366
|
-
dy = tache.height - 40
|
|
367
|
-
}
|
|
368
|
-
tache.width -= dx
|
|
369
|
-
tache.height -= dy
|
|
370
|
-
tache.x += dx
|
|
371
|
-
tache.y += dy
|
|
372
|
-
break
|
|
373
|
-
case 'NE':
|
|
374
|
-
if (tache.width + dx < 80) {
|
|
375
|
-
dx = 80 - tache.width
|
|
376
|
-
}
|
|
377
|
-
if (tache.height - dy < 40) {
|
|
378
|
-
dy = tache.height - 40
|
|
379
|
-
}
|
|
380
|
-
tache.width += dx
|
|
381
|
-
tache.height -= dy
|
|
382
|
-
tache.y += dy
|
|
383
|
-
break
|
|
384
|
-
case 'SW':
|
|
385
|
-
if (tache.width - dx < 80) {
|
|
386
|
-
dx = tache.width - 80
|
|
387
|
-
}
|
|
388
|
-
if (tache.height + dy < 40) {
|
|
389
|
-
dy = 40 - tache.height
|
|
390
|
-
}
|
|
391
|
-
tache.width -= dx
|
|
392
|
-
tache.height += dy
|
|
393
|
-
tache.x += dx
|
|
394
|
-
break
|
|
395
|
-
case 'SE':
|
|
396
|
-
if (tache.width + dx < 80) {
|
|
397
|
-
dx = 80 - tache.width
|
|
398
|
-
}
|
|
399
|
-
if (tache.height + dy < 40) {
|
|
400
|
-
dy = 40 - tache.height
|
|
401
|
-
}
|
|
402
|
-
tache.width += dx
|
|
403
|
-
tache.height += dy
|
|
404
|
-
break
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
moveTransition() {
|
|
408
|
-
if (!this.draggerToMove) {
|
|
409
|
-
return
|
|
410
|
-
}
|
|
411
|
-
const transition = this.draggerToMove.owner
|
|
412
|
-
const position = this.draggerToMove.position
|
|
413
|
-
const virtualJoint = { parent: this.currentPosition, position: '' }
|
|
414
|
-
if (position === 'start') {
|
|
415
|
-
transition.startJoint = virtualJoint
|
|
416
|
-
} else {
|
|
417
|
-
transition.endJoint = virtualJoint
|
|
418
|
-
}
|
|
419
|
-
},
|
|
420
|
-
adjustCurveLine() {
|
|
421
|
-
if (!this.controlPointToMove) {
|
|
422
|
-
return
|
|
423
|
-
}
|
|
424
|
-
const transition = this.controlPointToMove.owner
|
|
425
|
-
if (transition.lineInfo && transition.lineInfo.type === 'CurveLine') {
|
|
426
|
-
transition.lineInfo.controlPoint = this.currentPosition
|
|
427
|
-
} else if (transition.lineInfo && transition.lineInfo.type === 'BrokenLine') {
|
|
428
|
-
const pointIndex = this.controlPointToMove.pointIndex
|
|
429
|
-
const controlPoints = transition.lineInfo.controlPoint
|
|
430
|
-
this.$set(controlPoints, pointIndex, this.currentPosition)
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
endDrag(event) {
|
|
434
|
-
|
|
435
|
-
},
|
|
436
|
-
showTacheHistoryTooltip(event) {
|
|
437
|
-
this.showTacheHistory = true
|
|
438
|
-
},
|
|
439
|
-
hideTacheHistoryTooltip() {
|
|
440
|
-
this.showTacheHistory = false
|
|
441
|
-
},
|
|
442
|
-
updateTacheHistoryTooltipPosition(event) {
|
|
443
|
-
const position = getMousePosition(event)
|
|
444
|
-
this.tooltipPosition = {
|
|
445
|
-
left: position.x + 'px',
|
|
446
|
-
top: position.y + 'px'
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
</script>
|
|
452
|
-
<style>
|
|
453
|
-
#svg{
|
|
454
|
-
/* border:1px solid red; */
|
|
455
|
-
background: white;
|
|
456
|
-
background-image:
|
|
457
|
-
linear-gradient(rgba(242,242,242,.7) 1px, transparent 0),
|
|
458
|
-
linear-gradient(90deg, rgba(242,242,242,.7) 1px, transparent 0),
|
|
459
|
-
linear-gradient(#e5e5e5 1px, transparent 0),
|
|
460
|
-
linear-gradient(90deg,#e5e5e5 1px, transparent 0);
|
|
461
|
-
background-size:
|
|
462
|
-
15px 15px,
|
|
463
|
-
15px 15px,
|
|
464
|
-
75px 75px,
|
|
465
|
-
75px 75px;
|
|
466
|
-
}
|
|
467
|
-
g{
|
|
468
|
-
font-size: 16px;
|
|
469
|
-
}
|
|
470
|
-
g text{
|
|
471
|
-
dominant-baseline: middle;
|
|
472
|
-
}
|
|
473
|
-
.selected{
|
|
474
|
-
fill: #fff;
|
|
475
|
-
stroke: #f00;
|
|
476
|
-
stroke-width: 2;
|
|
477
|
-
}
|
|
478
|
-
.task-tache{
|
|
479
|
-
fill: #fff;
|
|
480
|
-
stroke: #666;
|
|
481
|
-
stroke-width: 2;
|
|
482
|
-
}
|
|
483
|
-
</style>
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul class="context-menu">
|
|
3
|
-
<li v-for="menu in menus" :key="menu.name" @mousedown.stop="execute(menu.name)">
|
|
4
|
-
<icon-svg :icon="menu.icon" /><span>{{ menu.label }}</span>
|
|
5
|
-
</li>
|
|
6
|
-
</ul>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
import { mapGetters, mapMutations } from 'vuex'
|
|
11
|
-
import IconSvg from './icon-svg'
|
|
12
|
-
export default {
|
|
13
|
-
name: 'ContextMenu',
|
|
14
|
-
components: {
|
|
15
|
-
IconSvg
|
|
16
|
-
},
|
|
17
|
-
data() {
|
|
18
|
-
return {
|
|
19
|
-
menusForTransition: [
|
|
20
|
-
{ name: 'switch-line-type-StraightLine', label: this.$t('workflowEditor.main.straightLine'), icon: 'switch' },
|
|
21
|
-
{ name: 'switch-line-type-CurveLine', label: this.$t('workflowEditor.main.curveLine'), icon: 'switch' },
|
|
22
|
-
{ name: 'switch-line-type-BrokenLine', label: this.$t('workflowEditor.main.brokenLine'), icon: 'switch' },
|
|
23
|
-
{ name: 'remove', label: this.$t('workflowEditor.common.remove'), icon: 'delete' },
|
|
24
|
-
{ name: 'properties', label: this.$t('workflowEditor.common.attribute'), icon: 'properties' }
|
|
25
|
-
],
|
|
26
|
-
menusForTache: [
|
|
27
|
-
{ name: 'remove', label: this.$t('workflowEditor.common.remove'), icon: 'delete' },
|
|
28
|
-
{ name: 'properties', label: this.$t('workflowEditor.common.attribute'), icon: 'properties' }
|
|
29
|
-
],
|
|
30
|
-
menusForProcess: [
|
|
31
|
-
{ name: 'properties', label: this.$t('workflowEditor.common.attribute'), icon: 'properties' }
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
computed: {
|
|
36
|
-
...mapGetters('wfEditor', [
|
|
37
|
-
'taches',
|
|
38
|
-
'transitions',
|
|
39
|
-
'selectedTransition',
|
|
40
|
-
'selectedTaches'
|
|
41
|
-
]),
|
|
42
|
-
menuType() {
|
|
43
|
-
let type = ''
|
|
44
|
-
if (this.selectedTransition) {
|
|
45
|
-
type = 'Transition'
|
|
46
|
-
} else if (this.selectedTaches.length === 1) {
|
|
47
|
-
type = 'Tache'
|
|
48
|
-
}
|
|
49
|
-
if (this.selectedTransition === null && this.selectedTaches.length === 0) {
|
|
50
|
-
type = 'Process'
|
|
51
|
-
}
|
|
52
|
-
return type
|
|
53
|
-
},
|
|
54
|
-
menus() {
|
|
55
|
-
if (this.menuType) {
|
|
56
|
-
return this['menusFor' + this.menuType]
|
|
57
|
-
} else {
|
|
58
|
-
return []
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
methods: {
|
|
63
|
-
...mapMutations('wfEditor', [
|
|
64
|
-
'setPropertiesEditorFor',
|
|
65
|
-
'setContextMenuVisible'
|
|
66
|
-
]),
|
|
67
|
-
switchLineType(lineType) {
|
|
68
|
-
this.selectedTransition.lineInfo.controlPoint = null
|
|
69
|
-
this.selectedTransition.lineInfo.type = lineType
|
|
70
|
-
},
|
|
71
|
-
execute(menu) {
|
|
72
|
-
console.log('menu:' + menu)
|
|
73
|
-
if (menu.indexOf('switch-line-type-') >= 0) {
|
|
74
|
-
const lineType = menu.substring(menu.lastIndexOf('-') + 1)
|
|
75
|
-
this.switchLineType(lineType)
|
|
76
|
-
}
|
|
77
|
-
if (menu === 'remove') {
|
|
78
|
-
if (this.menuType === 'Tache') {
|
|
79
|
-
this.taches.splice(this.taches.indexOf(this.selectedTaches[0]), 1)
|
|
80
|
-
} else if (this.menuType === 'Transition') {
|
|
81
|
-
this.transitions.splice(this.transitions.indexOf(this.selectedTransition), 1)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const componentsWithoutPropertiesEditor = ['Start', 'End']
|
|
86
|
-
if (menu === 'properties') {
|
|
87
|
-
if (this.menuType === 'Tache') {
|
|
88
|
-
this.setPropertiesEditorFor(
|
|
89
|
-
componentsWithoutPropertiesEditor.indexOf(this.selectedTaches[0].type) >= 0 ? '' : this.selectedTaches[0].type
|
|
90
|
-
)
|
|
91
|
-
} else if (this.menuType === 'Transition') {
|
|
92
|
-
this.setPropertiesEditorFor('Transition')
|
|
93
|
-
} else {
|
|
94
|
-
this.setPropertiesEditorFor('Process')
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
this.setContextMenuVisible(false)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
</script>
|
|
102
|
-
<style lang="scss" scoped>
|
|
103
|
-
li {
|
|
104
|
-
color: #333;
|
|
105
|
-
}
|
|
106
|
-
.context-menu {
|
|
107
|
-
position: fixed;
|
|
108
|
-
background: #fff;
|
|
109
|
-
z-index: 999;
|
|
110
|
-
padding:5px;
|
|
111
|
-
margin:0
|
|
112
|
-
}
|
|
113
|
-
.context-menu li {
|
|
114
|
-
min-width: 75px;
|
|
115
|
-
height: 28px;
|
|
116
|
-
line-height: 28px;
|
|
117
|
-
text-align: left;
|
|
118
|
-
color: #1a1a1a;
|
|
119
|
-
}
|
|
120
|
-
.context-menu li:hover {
|
|
121
|
-
background: #42b983;
|
|
122
|
-
color: #fff;
|
|
123
|
-
}
|
|
124
|
-
.context-menu {
|
|
125
|
-
border: 1px solid #eee;
|
|
126
|
-
box-shadow: 0 0.5em 1em 0 rgba(0,0,0,.1);
|
|
127
|
-
border-radius: 5px;
|
|
128
|
-
}
|
|
129
|
-
li {
|
|
130
|
-
list-style-type:none;
|
|
131
|
-
}
|
|
132
|
-
</style>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg class="svg-icon" aria-hidden="true">
|
|
3
|
-
<use :xlink:href="iconName" />
|
|
4
|
-
</svg>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
export default {
|
|
9
|
-
name: 'IconSvg',
|
|
10
|
-
props: {
|
|
11
|
-
icon: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
computed: {
|
|
17
|
-
iconName() {
|
|
18
|
-
return `#icon-${this.icon}`
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<style>
|
|
25
|
-
.svg-icon {
|
|
26
|
-
width: 1em;
|
|
27
|
-
height: 1em;
|
|
28
|
-
vertical-align: -0.15em;
|
|
29
|
-
fill: currentColor;
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
}
|
|
32
|
-
</style>
|