workflow-editor 0.0.81-up → 0.0.81-up-tmp1

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