@logicflow/extension 2.0.9 → 2.0.10
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/.turbo/turbo-build.log +7 -34
- package/CHANGELOG.md +10 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/bpmn-elements/presets/Pool/index.js +7 -7
- package/es/bpmn-elements/presets/Task/subProcess.js +2 -2
- package/es/dynamic-group/index.d.ts +11 -5
- package/es/dynamic-group/index.js +125 -23
- package/es/dynamic-group/model.d.ts +6 -1
- package/es/dynamic-group/model.js +13 -3
- package/es/dynamic-group/node.d.ts +5 -0
- package/es/dynamic-group/node.js +57 -6
- package/es/tools/label/index.js +2 -2
- package/lib/bpmn-elements/presets/Pool/index.js +7 -7
- package/lib/bpmn-elements/presets/Task/subProcess.js +2 -2
- package/lib/dynamic-group/index.d.ts +11 -5
- package/lib/dynamic-group/index.js +125 -23
- package/lib/dynamic-group/model.d.ts +6 -1
- package/lib/dynamic-group/model.js +13 -3
- package/lib/dynamic-group/node.d.ts +5 -0
- package/lib/dynamic-group/node.js +57 -6
- package/lib/tools/label/index.js +2 -2
- package/package.json +3 -3
- package/src/dynamic-group/index.ts +146 -3
- package/src/dynamic-group/model.ts +17 -1
- package/src/dynamic-group/node.ts +18 -0
- package/stats.html +1 -1
|
@@ -49,6 +49,11 @@ export type IGroupNodeProperties = {
|
|
|
49
49
|
// expandWidth?: number
|
|
50
50
|
// expandHeight?: number
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* 缩放或旋转容器时,是否缩放或旋转组内节点
|
|
54
|
+
*/
|
|
55
|
+
transformWithContainer?: boolean
|
|
56
|
+
|
|
52
57
|
/**
|
|
53
58
|
* 当前分组元素的 zIndex
|
|
54
59
|
*/
|
|
@@ -79,6 +84,8 @@ export class DynamicGroupNodeModel extends RectNodeModel<IGroupNodeProperties> {
|
|
|
79
84
|
children!: Set<string>
|
|
80
85
|
// 是否限制组内节点的移动范围。默认不限制 TODO: 完善该功能
|
|
81
86
|
isRestrict: boolean = false
|
|
87
|
+
// isRestrict 模式启用时,如果同时设置 autoResize 为 true,那么子节点在父节点中移动时,父节点会自动调整大小
|
|
88
|
+
autoResize: boolean = false
|
|
82
89
|
// 分组节点是否可以折叠
|
|
83
90
|
collapsible: boolean = true
|
|
84
91
|
|
|
@@ -94,7 +101,7 @@ export class DynamicGroupNodeModel extends RectNodeModel<IGroupNodeProperties> {
|
|
|
94
101
|
// 当前分组是否在可添加状态 - 实时状态
|
|
95
102
|
@observable groupAddable: boolean = false
|
|
96
103
|
// 缩放或旋转容器时,是否缩放或旋转组内节点
|
|
97
|
-
@observable
|
|
104
|
+
@observable transformWithContainer: boolean = false
|
|
98
105
|
childrenLastCollapseStateDict: Map<string, boolean> = new Map()
|
|
99
106
|
|
|
100
107
|
constructor(data: NodeConfig<IGroupNodeProperties>, graphModel: GraphModel) {
|
|
@@ -121,6 +128,7 @@ export class DynamicGroupNodeModel extends RectNodeModel<IGroupNodeProperties> {
|
|
|
121
128
|
isRestrict,
|
|
122
129
|
autoResize,
|
|
123
130
|
autoToFront,
|
|
131
|
+
transformWithContainer,
|
|
124
132
|
} = data.properties ?? {}
|
|
125
133
|
|
|
126
134
|
this.children = children ? new Set(children) : new Set()
|
|
@@ -139,6 +147,7 @@ export class DynamicGroupNodeModel extends RectNodeModel<IGroupNodeProperties> {
|
|
|
139
147
|
this.collapsedHeight = collapsedHeight ?? DEFAULT_GROUP_COLLAPSE_HEIGHT
|
|
140
148
|
|
|
141
149
|
this.isRestrict = isRestrict ?? false
|
|
150
|
+
this.transformWithContainer = transformWithContainer ?? false
|
|
142
151
|
this.autoResize = autoResize ?? false
|
|
143
152
|
this.collapsible = collapsible ?? true
|
|
144
153
|
this.autoToFront = autoToFront ?? false
|
|
@@ -195,8 +204,15 @@ export class DynamicGroupNodeModel extends RectNodeModel<IGroupNodeProperties> {
|
|
|
195
204
|
isCollapsed,
|
|
196
205
|
} = this
|
|
197
206
|
if (isCollapsed) {
|
|
207
|
+
// 如果当前是折叠模式
|
|
208
|
+
// 存入history的时候,将坐标恢复到未折叠前的坐标数据
|
|
209
|
+
// 因为拿出history数据的时候,会触发collapse()进行坐标的折叠计算
|
|
198
210
|
data.x = x + expandWidth / 2 - collapsedWidth / 2
|
|
199
211
|
data.y = y + expandHeight / 2 - collapsedHeight / 2
|
|
212
|
+
if (data.text) {
|
|
213
|
+
data.text.x = data.text.x + expandWidth / 2 - collapsedWidth / 2
|
|
214
|
+
data.text.y = data.text.y + expandHeight / 2 - collapsedHeight / 2
|
|
215
|
+
}
|
|
200
216
|
}
|
|
201
217
|
return data
|
|
202
218
|
}
|
|
@@ -28,6 +28,16 @@ export class DynamicGroupNode<
|
|
|
28
28
|
|
|
29
29
|
// 在 group 旋转时,对组内的所有子节点也进行对应的旋转计算
|
|
30
30
|
eventCenter.on('node:rotate', ({ model }) => {
|
|
31
|
+
const { transformWithContainer, isRestrict } = this.props.model
|
|
32
|
+
if (!transformWithContainer || isRestrict) {
|
|
33
|
+
// isRestrict限制模式下,当前model resize时不能小于占地面积
|
|
34
|
+
// 由于parent:resize=>child:resize计算复杂,需要根据child:resize的判定结果来递归判断parent能否resize
|
|
35
|
+
// 不符合目前 parent:resize成功后emit事件 -> 触发child:resize 的代码交互模式
|
|
36
|
+
// 因此isRestrict限制模式下不支持联动(parent:resize=>child:resize)
|
|
37
|
+
// 由于transformWidthContainer是控制rotate+resize,为保持transformWidthContainer本来的含义
|
|
38
|
+
// parent:resize=>child:resize不支持,那么parent:rotate=>child:rotate也不支持
|
|
39
|
+
return
|
|
40
|
+
}
|
|
31
41
|
// DONE: 目前操作是对分组内节点以节点中心旋转节点本身,而按照正常逻辑,应该是以分组中心,旋转节点(跟 Label 旋转操作逻辑一致)
|
|
32
42
|
if (model.id === curGroup.id) {
|
|
33
43
|
const center = { x: curGroup.x, y: curGroup.y }
|
|
@@ -60,6 +70,14 @@ export class DynamicGroupNode<
|
|
|
60
70
|
eventCenter.on(
|
|
61
71
|
'node:resize',
|
|
62
72
|
({ deltaX, deltaY, index, model, preData }) => {
|
|
73
|
+
const { transformWithContainer, isRestrict } = this.props.model
|
|
74
|
+
if (!transformWithContainer || isRestrict) {
|
|
75
|
+
// isRestrict限制模式下,当前model resize时不能小于占地面积
|
|
76
|
+
// 由于parent:resize=>child:resize计算复杂,需要根据child:resize的判定结果来递归判断parent能否resize
|
|
77
|
+
// 不符合目前 parent:resize成功后emit事件 -> 触发child:resize 的代码交互模式
|
|
78
|
+
// 因此isRestrict限制模式下不支持联动(parent:resize=>child:resize)
|
|
79
|
+
return
|
|
80
|
+
}
|
|
63
81
|
if (model.id === curGroup.id) {
|
|
64
82
|
// node:resize是group已经改变width和height后的回调
|
|
65
83
|
// 因此这里一定得用preData(没resize改变width之前的值),而不是data/model
|