@logicflow/vue-node-registry 1.2.0-alpha.7 → 1.2.1
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/README.md +6 -3
- package/es/registry.d.ts +14 -3
- package/es/registry.js +28 -5
- package/es/registry.js.map +1 -1
- package/es/view.js +18 -2
- package/es/view.js.map +1 -1
- package/lib/registry.d.ts +14 -3
- package/lib/registry.js +30 -6
- package/lib/registry.js.map +1 -1
- package/lib/view.js +17 -1
- package/lib/view.js.map +1 -1
- package/package.json +10 -5
- package/.turbo/turbo-build$colon$dev.log +0 -10
- package/.turbo/turbo-build.log +0 -34
- package/CHANGELOG.md +0 -272
- package/rollup.config.js +0 -52
- package/src/assets/arrow.svg +0 -10
- package/src/components/container.ts +0 -36
- package/src/components/titleBar.ts +0 -189
- package/src/index.less +0 -1
- package/src/index.ts +0 -4
- package/src/model.ts +0 -141
- package/src/registry.ts +0 -43
- package/src/style/index.less +0 -140
- package/src/style/raw.ts +0 -129
- package/src/teleport.ts +0 -155
- package/src/utils/size.ts +0 -22
- package/src/view.ts +0 -238
- package/stats.html +0 -4842
- package/tsconfig.json +0 -20
package/CHANGELOG.md
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
# @logicflow/vue-node-registry
|
|
2
|
-
|
|
3
|
-
## 1.2.0-alpha.7
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- fix: 修复issue反馈的问题
|
|
8
|
-
- fix: 修复vue2自定义节点获取props错误
|
|
9
|
-
- Updated dependencies
|
|
10
|
-
- @logicflow/core@2.2.0-alpha.7
|
|
11
|
-
|
|
12
|
-
## 1.2.0-alpha.6
|
|
13
|
-
|
|
14
|
-
### Patch Changes
|
|
15
|
-
|
|
16
|
-
- Updated dependencies
|
|
17
|
-
- @logicflow/core@2.2.0-alpha.6
|
|
18
|
-
|
|
19
|
-
## 1.2.0-alpha.5
|
|
20
|
-
|
|
21
|
-
### Patch Changes
|
|
22
|
-
|
|
23
|
-
- fix: 修复已知问题
|
|
24
|
-
- 删除多余console.log
|
|
25
|
-
- 修复拖拽创建vue-node-registry节点时控制台报错问题
|
|
26
|
-
- Updated dependencies
|
|
27
|
-
- @logicflow/core@2.2.0
|
|
28
|
-
|
|
29
|
-
## 1.2.0-alpha.4
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
- Updated dependencies
|
|
34
|
-
- @logicflow/core@2.2.0-alpha.4
|
|
35
|
-
|
|
36
|
-
## 1.2.0-alpha.3
|
|
37
|
-
|
|
38
|
-
### Patch Changes
|
|
39
|
-
|
|
40
|
-
- feat: 整体UI美化,并丰富可配置的UI项
|
|
41
|
-
- Updated dependencies
|
|
42
|
-
- @logicflow/core@2.2.0-alpha.3
|
|
43
|
-
|
|
44
|
-
## 1.2.0-alpha.2
|
|
45
|
-
|
|
46
|
-
### Patch Changes
|
|
47
|
-
|
|
48
|
-
- Updated dependencies
|
|
49
|
-
- @logicflow/core@2.2.0-alpha.2
|
|
50
|
-
|
|
51
|
-
## 1.2.0-alpha.1
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- Updated dependencies
|
|
56
|
-
- @logicflow/core@2.2.0
|
|
57
|
-
|
|
58
|
-
## 1.2.0-alpha.0
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
- Updated dependencies
|
|
63
|
-
- @logicflow/core@2.2.0-alpha.0
|
|
64
|
-
|
|
65
|
-
## 1.1.5
|
|
66
|
-
|
|
67
|
-
### Patch Changes
|
|
68
|
-
|
|
69
|
-
- fix: 修复issue反馈的问题
|
|
70
|
-
- fix: 修复extension包引入vue包问题 fix #2277
|
|
71
|
-
- Updated dependencies
|
|
72
|
-
- @logicflow/core@2.1.4
|
|
73
|
-
|
|
74
|
-
## 1.1.4
|
|
75
|
-
|
|
76
|
-
### Patch Changes
|
|
77
|
-
|
|
78
|
-
- Updated dependencies
|
|
79
|
-
- @logicflow/core@2.1.3
|
|
80
|
-
|
|
81
|
-
## 1.1.3
|
|
82
|
-
|
|
83
|
-
### Patch Changes
|
|
84
|
-
|
|
85
|
-
- fix: 修复小地图在vue自定义节点删除一个小地图中全部vue节点消失问题
|
|
86
|
-
|
|
87
|
-
## 1.1.2
|
|
88
|
-
|
|
89
|
-
### Patch Changes
|
|
90
|
-
|
|
91
|
-
- Updated dependencies
|
|
92
|
-
- @logicflow/core@2.1.2
|
|
93
|
-
|
|
94
|
-
## 1.1.1
|
|
95
|
-
|
|
96
|
-
### Patch Changes
|
|
97
|
-
|
|
98
|
-
- fix: 修复点击节点会触发多选的问题和vue-node-registry引入报错问题
|
|
99
|
-
- Updated dependencies
|
|
100
|
-
- @logicflow/core@2.1.1
|
|
101
|
-
|
|
102
|
-
## 1.1.0
|
|
103
|
-
|
|
104
|
-
### Patch Changes
|
|
105
|
-
|
|
106
|
-
- fix: 修复issue反馈的bug&支持小地图展示vue节点
|
|
107
|
-
|
|
108
|
-
## 1.0.18
|
|
109
|
-
|
|
110
|
-
### Patch Changes
|
|
111
|
-
|
|
112
|
-
- Updated dependencies
|
|
113
|
-
- @logicflow/core@2.0.16
|
|
114
|
-
|
|
115
|
-
## 1.0.17
|
|
116
|
-
|
|
117
|
-
### Patch Changes
|
|
118
|
-
|
|
119
|
-
- Updated dependencies
|
|
120
|
-
- @logicflow/core@2.0.15
|
|
121
|
-
|
|
122
|
-
## 1.0.16
|
|
123
|
-
|
|
124
|
-
### Patch Changes
|
|
125
|
-
|
|
126
|
-
- Updated dependencies
|
|
127
|
-
- @logicflow/core@2.0.14
|
|
128
|
-
|
|
129
|
-
## 1.0.15
|
|
130
|
-
|
|
131
|
-
### Patch Changes
|
|
132
|
-
|
|
133
|
-
- Updated dependencies
|
|
134
|
-
- @logicflow/core@2.0.13
|
|
135
|
-
|
|
136
|
-
## 1.0.14
|
|
137
|
-
|
|
138
|
-
### Patch Changes
|
|
139
|
-
|
|
140
|
-
- Updated dependencies
|
|
141
|
-
- @logicflow/core@2.0.12
|
|
142
|
-
|
|
143
|
-
## 1.0.13
|
|
144
|
-
|
|
145
|
-
### Patch Changes
|
|
146
|
-
|
|
147
|
-
- Updated dependencies
|
|
148
|
-
- @logicflow/core@2.0.11
|
|
149
|
-
|
|
150
|
-
## 1.0.12
|
|
151
|
-
|
|
152
|
-
### Patch Changes
|
|
153
|
-
|
|
154
|
-
- fix: 修复issue反馈的bug
|
|
155
|
-
- Updated dependencies
|
|
156
|
-
- @logicflow/core@2.0.10
|
|
157
|
-
|
|
158
|
-
## 1.0.11
|
|
159
|
-
|
|
160
|
-
### Patch Changes
|
|
161
|
-
|
|
162
|
-
- Updated dependencies
|
|
163
|
-
- @logicflow/core@2.0.9
|
|
164
|
-
|
|
165
|
-
## 1.0.10
|
|
166
|
-
|
|
167
|
-
### Patch Changes
|
|
168
|
-
|
|
169
|
-
- release react/vue-node-registry
|
|
170
|
-
|
|
171
|
-
## 1.0.9
|
|
172
|
-
|
|
173
|
-
### Patch Changes
|
|
174
|
-
|
|
175
|
-
- Updated dependencies
|
|
176
|
-
- @logicflow/core@2.0.8
|
|
177
|
-
|
|
178
|
-
## 1.0.8
|
|
179
|
-
|
|
180
|
-
### Patch Changes
|
|
181
|
-
|
|
182
|
-
- fix: 修复一些问题
|
|
183
|
-
- fix: 修复一些问题
|
|
184
|
-
- fix: 修复文本拖拽不符合预期的问题 by ChangeSuger
|
|
185
|
-
- feat: 支持动态修改 Grid 的配置 by ChangeSuger
|
|
186
|
-
- fix: 修复 2.x 与 1.x 下相同的网格线宽,Grid 表现不一致的问题 by ChangeSuger
|
|
187
|
-
- fix: node:dnd-drag 增加事件数据 by HeatonZ
|
|
188
|
-
- fix(extension): 【dynamic-group】修复mousemove和isCollapsed相关问题 by wbccb
|
|
189
|
-
- fix: 修复 windows 系统 node20 环境下样式文件打包失败的问题 by ChangeSuger
|
|
190
|
-
- fix: 修复 node:dnd-drag 事件的类型检查问题 by ChangeSuger
|
|
191
|
-
- fix(example): 修复文档中vue3自定义组件不能正常显示bug by zkt2002
|
|
192
|
-
- fix(core): 在没有拖拽的情况下,Control组件突然销毁,不触发cancelDrag(#1926) by wbccb
|
|
193
|
-
- fix(core): 修复笔记本触摸板点击边事件失效 by wuchenguang1998
|
|
194
|
-
- feat(examples): 添加动画边demo by DymoneLewis
|
|
195
|
-
- fix(core): 类型定义 properties:change 改为 node:properties-change by HeatonZ
|
|
196
|
-
- feat: node-registry 自定义properties类型 by HeatonZ
|
|
197
|
-
- fix(core): 修复 polyline 与多边形节点的交点不正确的问题 by Yuan-ZW
|
|
198
|
-
- Updated dependencies
|
|
199
|
-
- @logicflow/core@2.0.7
|
|
200
|
-
|
|
201
|
-
## 1.0.7
|
|
202
|
-
|
|
203
|
-
### Patch Changes
|
|
204
|
-
|
|
205
|
-
- fix(vue-node-registry): 修复Teleport+KeepAlive场景下DOM重复渲染的问题 close #1768 #1862
|
|
206
|
-
|
|
207
|
-
- Updated dependencies
|
|
208
|
-
- @logicflow/core@2.0.6
|
|
209
|
-
|
|
210
|
-
## 1.0.6
|
|
211
|
-
|
|
212
|
-
### Patch Changes
|
|
213
|
-
|
|
214
|
-
- Updated dependencies
|
|
215
|
-
- @logicflow/core@2.0.5
|
|
216
|
-
|
|
217
|
-
## 1.0.5
|
|
218
|
-
|
|
219
|
-
### Patch Changes
|
|
220
|
-
|
|
221
|
-
- Updated dependencies
|
|
222
|
-
- Updated dependencies
|
|
223
|
-
- @logicflow/core@2.0.4
|
|
224
|
-
|
|
225
|
-
## 1.0.4
|
|
226
|
-
|
|
227
|
-
### Patch Changes
|
|
228
|
-
|
|
229
|
-
- fix: bugs from issues
|
|
230
|
-
|
|
231
|
-
- fix: 移除 vue-node-registry view 中无用 console,close #1856
|
|
232
|
-
|
|
233
|
-
## 1.0.3
|
|
234
|
-
|
|
235
|
-
### Patch Changes: Release 1.0.3 Version
|
|
236
|
-
|
|
237
|
-
- Updated dependencies
|
|
238
|
-
- @logicflow/core@2.0.3
|
|
239
|
-
|
|
240
|
-
## 1.0.2
|
|
241
|
-
|
|
242
|
-
### Patch Changes
|
|
243
|
-
|
|
244
|
-
- Release New Version,移除多余 console
|
|
245
|
-
|
|
246
|
-
- Updated dependencies
|
|
247
|
-
- @logicflow/core@2.0.2
|
|
248
|
-
|
|
249
|
-
## 1.0.1
|
|
250
|
-
|
|
251
|
-
### Patch Changes
|
|
252
|
-
|
|
253
|
-
- Updated dependencies
|
|
254
|
-
- @logicflow/core@2.0.1
|
|
255
|
-
|
|
256
|
-
## 1.0.0
|
|
257
|
-
|
|
258
|
-
### Patch Changes
|
|
259
|
-
|
|
260
|
-
- Release 2.0 New Version 🎉🎉🎉🎉
|
|
261
|
-
- Updated dependencies
|
|
262
|
-
|
|
263
|
-
- @logicflow/core@2.0.0
|
|
264
|
-
|
|
265
|
-
- feat: 开发 vue-node-registry 包用于用户自定义 vue 节点
|
|
266
|
-
|
|
267
|
-
- 通过监听 properties 变化的事件,触发节点的更新
|
|
268
|
-
- 利用 Teleport 将组件内部的一部分模板传送到组件的 DOM 结构外层的位置去
|
|
269
|
-
- 修复 vue-node-registry 包在 vue2 项目中渲染失效的问题
|
|
270
|
-
- 更新 extension 包的 package.json
|
|
271
|
-
- 修复 vue-node-registry 渲染顺序,先 appendChild,再 new Vue
|
|
272
|
-
- 修复渲染自定义节点 new Vue2 实例时未传 el 的问题
|
package/rollup.config.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
import postcss from 'rollup-plugin-postcss'
|
|
3
|
-
import postcssUrl from 'postcss-url'
|
|
4
|
-
import postcssImport from 'postcss-import'
|
|
5
|
-
import { rollupConfig } from '../../rollup.config'
|
|
6
|
-
|
|
7
|
-
export default [
|
|
8
|
-
{
|
|
9
|
-
input: 'src/index.less',
|
|
10
|
-
output: [
|
|
11
|
-
{
|
|
12
|
-
file: 'dist/index.css',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
file: 'lib/index.css',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
file: 'lib/style/index.css',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
file: 'es/index.css',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
file: 'es/style/index.css',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
plugins: [
|
|
28
|
-
postcss({
|
|
29
|
-
plugins: [
|
|
30
|
-
postcssImport({
|
|
31
|
-
resolve: (id) => {
|
|
32
|
-
if (id.startsWith('~')) {
|
|
33
|
-
return path.resolve('node_modules', id.slice(1))
|
|
34
|
-
}
|
|
35
|
-
return id
|
|
36
|
-
},
|
|
37
|
-
}),
|
|
38
|
-
postcssUrl({
|
|
39
|
-
url: 'inline', // 选择 'inline' 选项将外部资源内联到最终的 CSS 文件中
|
|
40
|
-
// maxSize: 10, // 以KB为单位的最大文件大小,超过此大小的文件将不会被内联
|
|
41
|
-
}),
|
|
42
|
-
],
|
|
43
|
-
use: [['less', { javascriptEnabled: true }]],
|
|
44
|
-
extract: true,
|
|
45
|
-
// extract: 'index.css', // 提取到一个单独的 CSS 文件
|
|
46
|
-
// extract: path.resolve('dist/index.css'), // 提取到一个单独的 CSS 文件
|
|
47
|
-
minimize: true,
|
|
48
|
-
}),
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
rollupConfig(),
|
|
52
|
-
]
|
package/src/assets/arrow.svg
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="14" height="12.5" viewBox="0 0 14 12.5">
|
|
2
|
-
<g>
|
|
3
|
-
<g>
|
|
4
|
-
<path d="M0.5201124,5.47988755C0.23603013,5.7639699,0.24460429,6.2271326,0.53900635,6.5005059L6.3195491,11.8681526C6.7032304,12.2244282,7.2967696,12.2244282,7.6804514,11.8681526L13.460994,6.5005059C13.755396,6.2271326,13.76397,5.7639699,13.479888,5.47988755C13.211547,5.21154633,12.779465,5.20215771,12.499721,5.45858961L7.3378625,10.1902928C7.1467018,10.3655233,6.8532982,10.3655233,6.6621375,10.1902928L1.5002797,5.45858967C1.2205358,5.20215771,0.78845364,5.21154633,0.5201124,5.47988755Z" fill="#474747" fill-opacity="1"/>
|
|
5
|
-
</g>
|
|
6
|
-
<g>
|
|
7
|
-
<path d="M0.5201124,0.47988755C0.23603013,0.7639699,0.24460429,1.2271326,0.53900635,1.5005059L6.3195491,6.8681526C6.7032304,7.2244282,7.2967696,7.2244282,7.6804514,6.8681526L13.460994,1.5005059C13.755396,1.2271326,13.76397,0.7639699,13.479888,0.47988755C13.211547,0.21154633,12.779465,0.20215771,12.499721,0.45858961L7.3378625,5.1902928C7.1467018,5.3655233,6.8532982,5.3655233,6.6621375,5.1902928L1.5002797,0.45858967C1.2205358,0.20215771,0.78845364,0.21154633,0.5201124,0.47988755Z" fill="#9B9B9B" fill-opacity="1"/>
|
|
8
|
-
</g>
|
|
9
|
-
</g>
|
|
10
|
-
</svg>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue-demi'
|
|
2
|
-
import { TitleBar } from './titleBar'
|
|
3
|
-
|
|
4
|
-
export const Container = defineComponent({
|
|
5
|
-
name: 'LFVueNodeContainer',
|
|
6
|
-
props: {
|
|
7
|
-
node: { type: Object, required: true },
|
|
8
|
-
graph: { type: Object, required: true },
|
|
9
|
-
},
|
|
10
|
-
render(this: any) {
|
|
11
|
-
const props = this.node?.properties || {}
|
|
12
|
-
const children: any[] = []
|
|
13
|
-
const titleColor = props.style.titleColor || '#E5EEFC'
|
|
14
|
-
if (props._showTitle) {
|
|
15
|
-
children.push(h(TitleBar, { node: this.node, graph: this.graph }))
|
|
16
|
-
}
|
|
17
|
-
console.log('props._expanded', props._expanded)
|
|
18
|
-
if (props._expanded === true) {
|
|
19
|
-
children.push(
|
|
20
|
-
h(
|
|
21
|
-
'div',
|
|
22
|
-
{ class: 'lf-vue-node-content-wrap' },
|
|
23
|
-
this.$slots?.default ? this.$slots.default() : [],
|
|
24
|
-
),
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
return h(
|
|
28
|
-
'div',
|
|
29
|
-
{
|
|
30
|
-
class: 'lf-vue-node-container',
|
|
31
|
-
style: ` background: linear-gradient(180deg, ${titleColor} 0%, #FFFFFF 24px)`,
|
|
32
|
-
},
|
|
33
|
-
children,
|
|
34
|
-
)
|
|
35
|
-
},
|
|
36
|
-
})
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue-demi'
|
|
2
|
-
import { isNumber, isEmpty } from 'lodash-es'
|
|
3
|
-
|
|
4
|
-
export const TitleBar = defineComponent({
|
|
5
|
-
name: 'LFVueNodeTitleBar',
|
|
6
|
-
props: {
|
|
7
|
-
node: { type: Object, required: true },
|
|
8
|
-
graph: { type: Object, required: true },
|
|
9
|
-
},
|
|
10
|
-
data() {
|
|
11
|
-
return {
|
|
12
|
-
showTooltip: false as boolean,
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
mounted() {
|
|
16
|
-
const trigger =
|
|
17
|
-
(this as any).node?.properties?.titleTrigger === 'hover'
|
|
18
|
-
? 'hover'
|
|
19
|
-
: 'click'
|
|
20
|
-
const moreBtn: HTMLElement | null = (this.$refs as any).moreBtn || null
|
|
21
|
-
const tooltip: HTMLElement | null = (this.$refs as any).tooltip || null
|
|
22
|
-
const onDoc = (e: MouseEvent) => {
|
|
23
|
-
if (!tooltip || !moreBtn) return
|
|
24
|
-
const t = e.target as Node
|
|
25
|
-
if (this.showTooltip && !tooltip.contains(t) && !moreBtn.contains(t)) {
|
|
26
|
-
this.showTooltip = false
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (trigger === 'hover' && moreBtn && tooltip) {
|
|
30
|
-
moreBtn.addEventListener('mouseenter', () => {
|
|
31
|
-
this.showTooltip = true
|
|
32
|
-
})
|
|
33
|
-
moreBtn.addEventListener('mouseleave', () => {
|
|
34
|
-
this.showTooltip = false
|
|
35
|
-
})
|
|
36
|
-
} else if (trigger === 'click' && moreBtn) {
|
|
37
|
-
moreBtn.addEventListener('click', (e) => {
|
|
38
|
-
e.stopPropagation()
|
|
39
|
-
this.showTooltip = !this.showTooltip
|
|
40
|
-
})
|
|
41
|
-
document.addEventListener('click', onDoc)
|
|
42
|
-
;(this as any).$once &&
|
|
43
|
-
(this as any).$once('hook:beforeDestroy', () => {
|
|
44
|
-
document.removeEventListener('click', onDoc)
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
methods: {
|
|
49
|
-
toggleExpand() {
|
|
50
|
-
const cur = !!this.node?.properties?._expanded
|
|
51
|
-
this.node?.setProperty('_expanded', !cur)
|
|
52
|
-
},
|
|
53
|
-
runAction(act: any) {
|
|
54
|
-
try {
|
|
55
|
-
typeof act?.callback === 'function' &&
|
|
56
|
-
act.callback((this as any).node, (this as any).graph)
|
|
57
|
-
} finally {
|
|
58
|
-
this.showTooltip = false
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
render(this: any) {
|
|
63
|
-
const props = this.node?.properties || {}
|
|
64
|
-
const icon = props._icon
|
|
65
|
-
const title = props._title || ''
|
|
66
|
-
const expanded = !!props._expanded
|
|
67
|
-
const _titleHeight = isNumber(props._titleHeight) ? props._titleHeight : 28
|
|
68
|
-
const actions = (this as any).node?.__actions || []
|
|
69
|
-
const showMoreAction = !isEmpty(actions)
|
|
70
|
-
console.log('showMoreAction', actions, props._titleActions)
|
|
71
|
-
const bar = h(
|
|
72
|
-
'div',
|
|
73
|
-
{
|
|
74
|
-
class: expanded
|
|
75
|
-
? 'lf-vue-node-title lf-vue-node-title-expanded'
|
|
76
|
-
: 'lf-vue-node-title',
|
|
77
|
-
style: `height:${expanded ? _titleHeight : 18}px;`,
|
|
78
|
-
title,
|
|
79
|
-
},
|
|
80
|
-
[
|
|
81
|
-
h('div', { class: 'lf-vue-node-title-left' }, [
|
|
82
|
-
icon
|
|
83
|
-
? h(
|
|
84
|
-
'i',
|
|
85
|
-
{
|
|
86
|
-
class: 'lf-vue-node-title-icon',
|
|
87
|
-
},
|
|
88
|
-
icon,
|
|
89
|
-
)
|
|
90
|
-
: null,
|
|
91
|
-
h(
|
|
92
|
-
'span',
|
|
93
|
-
{
|
|
94
|
-
class: 'lf-vue-node-title-text',
|
|
95
|
-
},
|
|
96
|
-
title,
|
|
97
|
-
),
|
|
98
|
-
]),
|
|
99
|
-
h('div', { class: 'lf-vue-node-title-actions' }, [
|
|
100
|
-
h(
|
|
101
|
-
'button',
|
|
102
|
-
{
|
|
103
|
-
ref: 'expandBtn',
|
|
104
|
-
class: 'lf-vue-node-title-expand',
|
|
105
|
-
onClick: (e: MouseEvent) => {
|
|
106
|
-
console.log('expandClicked')
|
|
107
|
-
e.stopPropagation()
|
|
108
|
-
this.toggleExpand()
|
|
109
|
-
},
|
|
110
|
-
on: {
|
|
111
|
-
click: (e: MouseEvent) => {
|
|
112
|
-
console.log('expandClicked')
|
|
113
|
-
e.stopPropagation()
|
|
114
|
-
this.toggleExpand()
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
[
|
|
119
|
-
h(
|
|
120
|
-
'svg',
|
|
121
|
-
{
|
|
122
|
-
width: 14,
|
|
123
|
-
height: 12,
|
|
124
|
-
viewBox: '0 0 14 12',
|
|
125
|
-
xmlns: 'http://www.w3.org/2000/svg',
|
|
126
|
-
class: 'lf-vue-node-title-expand-icon',
|
|
127
|
-
style: `transform:${expanded ? 'rotate(180deg)' : 'rotate(0deg)'};`,
|
|
128
|
-
},
|
|
129
|
-
[
|
|
130
|
-
h('path', {
|
|
131
|
-
d: 'M0.5201124,5.47988755C0.23603013,5.7639699,0.24460429,6.2271326,0.53900635,6.5005059L6.3195491,11.8681526C6.7032304,12.2244282,7.2967696,12.2244282,7.6804514,11.8681526L13.460994,6.5005059C13.755396,6.2271326,13.76397,5.7639699,13.479888,5.47988755C13.211547,5.21154633,12.779465,5.20215771,12.499721,5.45858961L7.3378625,10.1902928C7.1467018,10.3655233,6.8532982,10.3655233,6.6621375,10.1902928L1.5002797,5.45858967C1.2205358,5.20215771,0.78845364,5.21154633,0.5201124,5.47988755Z',
|
|
132
|
-
fill: '#474747',
|
|
133
|
-
}),
|
|
134
|
-
h('path', {
|
|
135
|
-
d: 'M0.5201124,0.47988755C0.23603013,0.7639699,0.24460429,1.2271326,0.53900635,1.5005059L6.3195491,6.8681526C6.7032304,7.2244282,7.2967696,7.2244282,7.6804514,6.8681526L13.460994,1.5005059C13.755396,1.2271326,13.76397,0.7639699,13.479888,0.47988755C13.211547,0.21154633,12.779465,0.20215771,12.499721,0.45858961L7.3378625,5.1902928C7.1467018,5.3655233,6.8532982,5.3655233,6.6621375,5.1902928L1.5002797,0.45858967C1.2205358,0.20215771,0.78845364,0.21154633,0.5201124,0.47988755Z',
|
|
136
|
-
fill: '#9B9B9B',
|
|
137
|
-
}),
|
|
138
|
-
],
|
|
139
|
-
),
|
|
140
|
-
],
|
|
141
|
-
),
|
|
142
|
-
showMoreAction &&
|
|
143
|
-
h(
|
|
144
|
-
'button',
|
|
145
|
-
{
|
|
146
|
-
ref: 'moreBtn',
|
|
147
|
-
class: 'lf-vue-node-title-more',
|
|
148
|
-
},
|
|
149
|
-
[h('i', { class: 'lf-vue-node-title-more-icon' }, '⋯')],
|
|
150
|
-
),
|
|
151
|
-
h(
|
|
152
|
-
'div',
|
|
153
|
-
{
|
|
154
|
-
ref: 'tooltip',
|
|
155
|
-
class: 'lf-vue-node-title-tooltip',
|
|
156
|
-
style: `opacity:${this.showTooltip ? 1 : 0};pointer-events:${this.showTooltip ? 'auto' : 'none'};`,
|
|
157
|
-
},
|
|
158
|
-
[
|
|
159
|
-
h(
|
|
160
|
-
'div',
|
|
161
|
-
{ class: 'lf-vue-node-title-tooltip-list' },
|
|
162
|
-
actions.map((act: any) =>
|
|
163
|
-
h(
|
|
164
|
-
'div',
|
|
165
|
-
{
|
|
166
|
-
class: 'lf-vue-node-title-tooltip-item',
|
|
167
|
-
onClick: (e: MouseEvent) => {
|
|
168
|
-
e.stopPropagation()
|
|
169
|
-
this.runAction(act)
|
|
170
|
-
},
|
|
171
|
-
on: {
|
|
172
|
-
click: (e: MouseEvent) => {
|
|
173
|
-
e.stopPropagation()
|
|
174
|
-
this.runAction(act)
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
act?.name || '',
|
|
179
|
-
),
|
|
180
|
-
),
|
|
181
|
-
),
|
|
182
|
-
],
|
|
183
|
-
),
|
|
184
|
-
]),
|
|
185
|
-
],
|
|
186
|
-
)
|
|
187
|
-
return bar
|
|
188
|
-
},
|
|
189
|
-
})
|
package/src/index.less
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import url('./style/index.less');
|
package/src/index.ts
DELETED
package/src/model.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import LogicFlow, {
|
|
2
|
-
GraphModel,
|
|
3
|
-
BaseNodeModel,
|
|
4
|
-
HtmlNodeModel,
|
|
5
|
-
IHtmlNodeProperties,
|
|
6
|
-
} from '@logicflow/core'
|
|
7
|
-
import { cloneDeep, isNil, isArray, isEmpty } from 'lodash-es'
|
|
8
|
-
|
|
9
|
-
import NodeConfig = LogicFlow.NodeConfig
|
|
10
|
-
|
|
11
|
-
export type NodeAction = {
|
|
12
|
-
name: string
|
|
13
|
-
callback?: (node: BaseNodeModel, graph: GraphModel) => void
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface VueCustomProperties extends IHtmlNodeProperties {
|
|
17
|
-
// 形状属性
|
|
18
|
-
width?: number
|
|
19
|
-
height?: number
|
|
20
|
-
radius?: number
|
|
21
|
-
|
|
22
|
-
// 文字位置属性
|
|
23
|
-
refX?: number
|
|
24
|
-
refY?: number
|
|
25
|
-
|
|
26
|
-
// 样式属性
|
|
27
|
-
style?: LogicFlow.CommonTheme
|
|
28
|
-
textStyle?: LogicFlow.TextNodeTheme
|
|
29
|
-
|
|
30
|
-
// 标题配置
|
|
31
|
-
_showTitle?: boolean
|
|
32
|
-
_title?: string
|
|
33
|
-
_icon?: string
|
|
34
|
-
_titleHeight?: number
|
|
35
|
-
_expanded?: boolean
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class VueNodeModel<
|
|
39
|
-
P extends VueCustomProperties = VueCustomProperties,
|
|
40
|
-
> extends HtmlNodeModel<P> {
|
|
41
|
-
private __baseHeight?: number
|
|
42
|
-
public __actions?: {
|
|
43
|
-
name: string
|
|
44
|
-
callback?: (node: BaseNodeModel, graph: GraphModel) => void
|
|
45
|
-
}[]
|
|
46
|
-
constructor(data: NodeConfig<P>, graphModel: GraphModel) {
|
|
47
|
-
super(data, graphModel)
|
|
48
|
-
const { properties } = data
|
|
49
|
-
// 如果需要展示标题,则重新设置一个能把节点内容都展示出来的最小宽高
|
|
50
|
-
if (properties) {
|
|
51
|
-
const { _showTitle = false, style = {} } = properties
|
|
52
|
-
if (_showTitle) {
|
|
53
|
-
this.minWidth = 160
|
|
54
|
-
this.minHeight = 80
|
|
55
|
-
this.text.editable = false
|
|
56
|
-
// 判断当前节点宽高是否小于最小宽高,如果是,强制设置为最小宽高
|
|
57
|
-
const newWidth = this.width < this.minWidth ? this.minWidth : this.width
|
|
58
|
-
const newHeight =
|
|
59
|
-
this.height < this.minHeight ? this.minHeight : this.height
|
|
60
|
-
|
|
61
|
-
this.setProperties({
|
|
62
|
-
_expanded: false,
|
|
63
|
-
...properties,
|
|
64
|
-
style: {
|
|
65
|
-
overflow: 'visible',
|
|
66
|
-
...cloneDeep(style),
|
|
67
|
-
},
|
|
68
|
-
width: newWidth + 8,
|
|
69
|
-
height: newHeight + 8,
|
|
70
|
-
})
|
|
71
|
-
this.setNodeActions([
|
|
72
|
-
{
|
|
73
|
-
name: '复制',
|
|
74
|
-
callback: (nodeModel, graphModel) => {
|
|
75
|
-
graphModel.cloneNode(nodeModel.id)
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: '删除',
|
|
80
|
-
callback: (nodeModel, graphModel) => {
|
|
81
|
-
graphModel.deleteNode(nodeModel.id)
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
])
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
setAttributes() {
|
|
89
|
-
// DONE: 解决 width、height、radius 为 0 时的问题
|
|
90
|
-
const { width, height, radius, _showTitle, _titleHeight } = this.properties
|
|
91
|
-
if (!isNil(width)) {
|
|
92
|
-
this.width = width
|
|
93
|
-
}
|
|
94
|
-
if (!isNil(height)) {
|
|
95
|
-
this.height = height
|
|
96
|
-
}
|
|
97
|
-
if (!isNil(radius)) {
|
|
98
|
-
this.radius = radius
|
|
99
|
-
}
|
|
100
|
-
if (this.__baseHeight === undefined) {
|
|
101
|
-
this.__baseHeight = isNil(height) ? this.height : height
|
|
102
|
-
}
|
|
103
|
-
const extra = _showTitle ? (_titleHeight ?? 28) : 0
|
|
104
|
-
const base = isNil(height) ? (this.__baseHeight as number) : height
|
|
105
|
-
this.height = base + extra
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
getTextStyle(): LogicFlow.TextNodeTheme {
|
|
109
|
-
const { refX = 0, refY = 0, textStyle } = this.properties
|
|
110
|
-
const style = super.getTextStyle()
|
|
111
|
-
|
|
112
|
-
// 通过 transform 重新设置 text 的位置
|
|
113
|
-
return {
|
|
114
|
-
...style,
|
|
115
|
-
...(cloneDeep(textStyle) || {}),
|
|
116
|
-
transform: `matrix(1 0 0 1 ${refX} ${refY})`,
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
getNodeStyle(): LogicFlow.CommonTheme {
|
|
121
|
-
const style = super.getNodeStyle()
|
|
122
|
-
const {
|
|
123
|
-
style: customNodeStyle,
|
|
124
|
-
// radius = 0, // 第二种方式,设置圆角
|
|
125
|
-
} = this.properties
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
...style,
|
|
129
|
-
...(cloneDeep(customNodeStyle) || {}),
|
|
130
|
-
// rx: radius,
|
|
131
|
-
// ry: radius,
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
setNodeActions(actions: NodeAction[]) {
|
|
136
|
-
this.__actions =
|
|
137
|
-
isArray(actions) && !isEmpty(actions) ? cloneDeep(actions) : []
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export default VueNodeModel
|