workflow-editor 0.0.86-upPocCdn1 → 0.0.87-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "workflow-editor",
3
3
  "private": false,
4
- "version": "0.0.86-upPocCdn1",
4
+ "version": "0.0.87-up",
5
5
  "type": "module",
6
6
  "main": "./lib/workflow-editor.js",
7
7
  "scripts": {
@@ -16,12 +16,13 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@vitejs/plugin-vue": "^4.2.3",
19
- "agilebuilder-ui": "1.1.88-pocCdn5",
19
+ "agilebuilder-ui": "1.1.92",
20
20
  "axios": "^1.5.1",
21
21
  "element-plus": "^2.4.1",
22
22
  "font-awesome": "^4.7.0",
23
23
  "nprogress": "^0.2.0",
24
24
  "sass": "^1.69.4",
25
+ "sortablejs": "^1.15.2",
25
26
  "vite": "^4.4.5",
26
27
  "vite-plugin-svg-icons": "^2.0.1",
27
28
  "vue": "^3.3.4",
package/packages/index.js CHANGED
@@ -22,9 +22,9 @@ const install = function(Vue) {
22
22
  }
23
23
 
24
24
  // 判断是否是直接引入vue的js文件,即全局引用可自动安装所有组件
25
- // if (typeof window !== 'undefined' && window.Vue) {
26
- // install(window.Vue)
27
- // }
25
+ if (typeof window !== 'undefined' && window.Vue) {
26
+ install(window.Vue)
27
+ }
28
28
 
29
29
  export default {
30
30
  // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <span>
3
3
  <div style="float: left; padding-right: 5px">
4
- <el-input v-model="zh">
4
+ <el-input v-model="zh" @keydown.native.enter.prevent="onEnter">
5
5
  <template #append>
6
6
  <i class="fa fa-cog" @click="i18nSet"></i>
7
7
  </template>
@@ -79,6 +79,11 @@ export default {
79
79
  this.$emit('setI18n', i18nSet)
80
80
  }
81
81
  this.isShowI18n = false
82
+ },
83
+ onEnter(e) {
84
+ // 阻塞 Enter 键在输入框中的默认行为,防止冒泡到表单提交等外部逻辑
85
+ e.preventDefault()
86
+ e.stopPropagation()
82
87
  }
83
88
  }
84
89
  }
@@ -1,17 +1,21 @@
1
1
  <template>
2
2
  <div>
3
- <el-tag
4
- v-for="(tag, index) in dynamicTags"
5
- :key="index + tag"
6
- :type="getType(tag)"
7
- closable
8
- :disable-transitions="false"
9
- @close="handleClose(tag)"
10
- >
11
- <el-tooltip :content="showText(tag)" placement="top">
12
- <span class="tag-text">{{ showText(tag) }}</span>
13
- </el-tooltip>
14
- </el-tag>
3
+ <span ref="tagContainer" class="tag-container">
4
+ <el-tag
5
+ v-for="(tag, index) in dynamicTags"
6
+ :key="tag"
7
+ :data-index="index"
8
+ :data-tag-key="tag"
9
+ :type="getType(tag)"
10
+ closable
11
+ :disable-transitions="false"
12
+ @close="handleClose(tag)"
13
+ >
14
+ <el-tooltip :content="showText(tag)" placement="top">
15
+ <span class="tag-text">{{ showText(tag) }}</span>
16
+ </el-tooltip>
17
+ </el-tag>
18
+ </span>
15
19
  <el-input
16
20
  v-if="inputVisible || isShowAdditionalParam"
17
21
  ref="saveTagInput"
@@ -38,6 +42,7 @@
38
42
  <script>
39
43
  import FormFields from './form-fields'
40
44
  import { getFormFieldLabel } from './form-fields-utils.js'
45
+ import Sortable from 'sortablejs'
41
46
  export default {
42
47
  name: 'TaskTitle',
43
48
  components: {
@@ -73,7 +78,34 @@ export default {
73
78
  // this.$emit('update:modelValue', this.dynamicTags.join(''))
74
79
  // }
75
80
  // },
76
- mounted() {},
81
+ mounted() {
82
+ this._sortable = Sortable.create(this.$refs.tagContainer, {
83
+ animation: 150,
84
+ draggable: '.el-tag',
85
+ dragClass: 'wf-tag-drag',
86
+ onEnd: () => {
87
+ const container = this.$refs.tagContainer
88
+ if (!container) return
89
+ // 从 DOM 当前真实顺序读取 tag 值,彻底避免索引偏移问题
90
+ const newOrder = Array.from(container.querySelectorAll('.el-tag[data-tag-key]')).map((el) =>
91
+ el.getAttribute('data-tag-key')
92
+ )
93
+ // 还原 Sortable 对 DOM 的移动,交由 Vue 重新渲染
94
+ container.querySelectorAll('.el-tag[data-tag-key]').forEach((el, i) => {
95
+ const original = this.dynamicTags[i]
96
+ const originalEl = container.querySelector(`.el-tag[data-tag-key="${original}"]`)
97
+ if (originalEl) container.appendChild(originalEl)
98
+ })
99
+ this.dynamicTags = newOrder
100
+ this.$emit('update:modelValue', newOrder.join(''))
101
+ }
102
+ })
103
+ },
104
+ beforeUnmount() {
105
+ if (this._sortable) {
106
+ this._sortable.destroy()
107
+ }
108
+ },
77
109
  methods: {
78
110
  showText(value) {
79
111
  let result = value
@@ -140,8 +172,14 @@ export default {
140
172
  }
141
173
  </script>
142
174
  <style scoped>
175
+ .tag-container {
176
+ display: inline-flex;
177
+ flex-wrap: wrap;
178
+ gap: 6px;
179
+ cursor: grab;
180
+ }
143
181
  .el-tag + .el-tag {
144
- margin-left: 10px;
182
+ margin-left: 0;
145
183
  }
146
184
  .tag-text {
147
185
  display: inline-block;
@@ -170,3 +208,14 @@ select {
170
208
  line-height: 32px;
171
209
  }
172
210
  </style>
211
+
212
+ <!-- 非 scoped:覆盖 Sortable 追加到 body 的拖拽克隆元素样式 -->
213
+ <style>
214
+ .wf-tag-drag {
215
+ display: inline-flex !important;
216
+ pointer-events: auto !important;
217
+ opacity: 0.85;
218
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
219
+ background: #fff;
220
+ }
221
+ </style>