@flowgram-vue/fixed-layout-core 0.2.0

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 (54) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.cjs +2327 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.ts +61 -0
  5. package/dist/index.js +2323 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +56 -0
  8. package/src/activities/block-icon.ts +55 -0
  9. package/src/activities/block-order-icon.ts +64 -0
  10. package/src/activities/block.ts +192 -0
  11. package/src/activities/break.ts +14 -0
  12. package/src/activities/dynamic-split.ts +94 -0
  13. package/src/activities/empty.ts +35 -0
  14. package/src/activities/end.ts +26 -0
  15. package/src/activities/index.ts +24 -0
  16. package/src/activities/inline-blocks.ts +197 -0
  17. package/src/activities/input.ts +152 -0
  18. package/src/activities/loop-extends/constants.ts +25 -0
  19. package/src/activities/loop-extends/index.ts +10 -0
  20. package/src/activities/loop-extends/loop-empty-branch.ts +60 -0
  21. package/src/activities/loop-extends/loop-inline-blocks.ts +140 -0
  22. package/src/activities/loop-extends/loop-left-empty-block.ts +43 -0
  23. package/src/activities/loop-extends/loop-right-empty-block.ts +18 -0
  24. package/src/activities/loop.ts +198 -0
  25. package/src/activities/multi-inputs.ts +98 -0
  26. package/src/activities/multi-outputs.ts +65 -0
  27. package/src/activities/output.ts +18 -0
  28. package/src/activities/root.ts +23 -0
  29. package/src/activities/simple-split.ts +47 -0
  30. package/src/activities/slot/constants.ts +56 -0
  31. package/src/activities/slot/extends/index.ts +8 -0
  32. package/src/activities/slot/extends/slot-block.ts +229 -0
  33. package/src/activities/slot/extends/slot-icon.ts +32 -0
  34. package/src/activities/slot/extends/slot-inline-blocks.ts +102 -0
  35. package/src/activities/slot/index.ts +8 -0
  36. package/src/activities/slot/slot.ts +108 -0
  37. package/src/activities/slot/typings.ts +13 -0
  38. package/src/activities/slot/utils/create.ts +105 -0
  39. package/src/activities/slot/utils/layout.ts +49 -0
  40. package/src/activities/slot/utils/node.ts +38 -0
  41. package/src/activities/slot/utils/transition.ts +222 -0
  42. package/src/activities/start.ts +21 -0
  43. package/src/activities/static-split.ts +29 -0
  44. package/src/activities/try-catch-extends/catch-block.ts +78 -0
  45. package/src/activities/try-catch-extends/catch-inline-blocks.ts +122 -0
  46. package/src/activities/try-catch-extends/constants.ts +27 -0
  47. package/src/activities/try-catch-extends/index.ts +11 -0
  48. package/src/activities/try-catch-extends/main-inline-blocks.ts +147 -0
  49. package/src/activities/try-catch-extends/try-block.ts +26 -0
  50. package/src/activities/try-catch-extends/try-slot.ts +48 -0
  51. package/src/activities/try-catch.ts +176 -0
  52. package/src/fixed-layout-container-module.ts +20 -0
  53. package/src/flow-registers.ts +117 -0
  54. package/src/index.ts +45 -0
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import {
7
+ DEFAULT_SPACING,
8
+ FlowLayoutDefault,
9
+ FlowNodeBaseType,
10
+ type FlowNodeRegistry,
11
+ FlowTransitionLabelEnum,
12
+ type FlowTransitionLine,
13
+ FlowTransitionLineEnum,
14
+ LABEL_SIDE_TYPE,
15
+ } from '@flowgram-vue/document';
16
+
17
+ /**
18
+ * block, block 的输入输出点由子节点决定
19
+ */
20
+ export const BlockRegistry: FlowNodeRegistry = {
21
+ type: FlowNodeBaseType.BLOCK,
22
+ meta: {
23
+ spacing: DEFAULT_SPACING.NULL,
24
+ inlineSpacingAfter: DEFAULT_SPACING.INLINE_BLOCK_PADDING_BOTTOM,
25
+ hidden: true,
26
+ },
27
+ getLines(transition) {
28
+ const currentTransform = transition.transform;
29
+ const { isVertical } = transition.entity;
30
+ const lines: FlowTransitionLine[] = [
31
+ {
32
+ type: FlowTransitionLineEnum.DIVERGE_LINE,
33
+ from: currentTransform.parent!.inputPoint,
34
+ to: currentTransform.inputPoint,
35
+ side: LABEL_SIDE_TYPE.NORMAL_BRANCH,
36
+ },
37
+ ];
38
+
39
+ const hasBranchDraggingAdder =
40
+ currentTransform && currentTransform.entity.isInlineBlock && transition.renderData.draggable;
41
+
42
+ // 分支拖拽场景线条 push
43
+ // 当有其余分支的时候,绘制一条两个分支之间的线条
44
+ if (hasBranchDraggingAdder) {
45
+ if (isVertical) {
46
+ const currentOffsetRightX = currentTransform.firstChild
47
+ ? currentTransform.firstChild.bounds.right
48
+ : currentTransform.bounds.right;
49
+ const nextOffsetLeftX =
50
+ (currentTransform.next?.firstChild
51
+ ? currentTransform.next?.firstChild.bounds?.left
52
+ : currentTransform.next?.bounds?.left) || 0;
53
+ const currentInputPointY = currentTransform.inputPoint.y;
54
+ if (currentTransform?.next) {
55
+ lines.push({
56
+ type: FlowTransitionLineEnum.DRAGGING_LINE,
57
+ from: currentTransform.parent!.inputPoint,
58
+ to: {
59
+ x: (currentOffsetRightX + nextOffsetLeftX) / 2,
60
+ y: currentInputPointY,
61
+ },
62
+ side: LABEL_SIDE_TYPE.NORMAL_BRANCH,
63
+ });
64
+ }
65
+ } else {
66
+ const currentOffsetBottomX = currentTransform.firstChild
67
+ ? currentTransform.firstChild.bounds.bottom
68
+ : currentTransform.bounds.bottom;
69
+ const nextOffsetTopX =
70
+ (currentTransform.next?.firstChild
71
+ ? currentTransform.next?.firstChild.bounds?.top
72
+ : currentTransform.next?.bounds?.top) || 0;
73
+ const currentInputPointX = currentTransform.inputPoint.x;
74
+ if (currentTransform?.next) {
75
+ lines.push({
76
+ type: FlowTransitionLineEnum.DRAGGING_LINE,
77
+ from: currentTransform.parent!.inputPoint,
78
+ to: {
79
+ x: currentInputPointX,
80
+ y: (currentOffsetBottomX + nextOffsetTopX) / 2,
81
+ },
82
+ side: LABEL_SIDE_TYPE.NORMAL_BRANCH,
83
+ });
84
+ }
85
+ }
86
+ }
87
+
88
+ // 最后一个节点是 end 节点,不绘制 mergeLine
89
+ if (!transition.isNodeEnd) {
90
+ lines.push({
91
+ type: FlowTransitionLineEnum.MERGE_LINE,
92
+ from: currentTransform.outputPoint,
93
+ to: currentTransform.parent!.outputPoint,
94
+ side: LABEL_SIDE_TYPE.NORMAL_BRANCH,
95
+ });
96
+ }
97
+
98
+ return lines;
99
+ },
100
+ getInputPoint(trans) {
101
+ const child = trans.firstChild;
102
+ return child ? child.inputPoint : trans.defaultInputPoint;
103
+ },
104
+ getOutputPoint(trans, layout) {
105
+ const isVertical = FlowLayoutDefault.isVertical(layout);
106
+ const child = trans.lastChild;
107
+ if (isVertical) {
108
+ return {
109
+ x: child ? child.outputPoint.x : trans.bounds.bottomCenter.x,
110
+ y: trans.bounds.bottom,
111
+ };
112
+ }
113
+ return {
114
+ x: trans.bounds.right,
115
+ y: child ? child.outputPoint.y : trans.bounds.rightCenter.y,
116
+ };
117
+ },
118
+ getLabels(transition) {
119
+ const currentTransform = transition.transform;
120
+ const { isVertical } = transition.entity;
121
+
122
+ const draggingLabel = [];
123
+
124
+ const hasBranchDraggingAdder =
125
+ currentTransform && currentTransform.entity.isInlineBlock && transition.renderData.draggable;
126
+
127
+ // 获取两个分支节点中间点作为拖拽标签插入位置
128
+ if (hasBranchDraggingAdder) {
129
+ if (isVertical) {
130
+ const currentOffsetRightX = currentTransform.firstChild
131
+ ? currentTransform.firstChild.bounds.right
132
+ : currentTransform.bounds.right;
133
+ const nextOffsetLeftX =
134
+ (currentTransform.next?.firstChild
135
+ ? currentTransform.next.firstChild.bounds?.left
136
+ : currentTransform.next?.bounds?.left) || 0;
137
+ const currentInputPointY = currentTransform.inputPoint.y;
138
+ if (currentTransform?.next) {
139
+ draggingLabel.push({
140
+ offset: {
141
+ x: (currentOffsetRightX + nextOffsetLeftX) / 2,
142
+ y: currentInputPointY,
143
+ },
144
+ type: FlowTransitionLabelEnum.BRANCH_DRAGGING_LABEL,
145
+ width: nextOffsetLeftX - currentOffsetRightX,
146
+ props: {
147
+ side: LABEL_SIDE_TYPE.NORMAL_BRANCH,
148
+ },
149
+ });
150
+ }
151
+ } else {
152
+ const currentOffsetBottomX = currentTransform.firstChild
153
+ ? currentTransform.firstChild.bounds.bottom
154
+ : currentTransform.bounds.bottom;
155
+ const nextOffsetTopX =
156
+ (currentTransform.next?.firstChild
157
+ ? currentTransform.next.firstChild.bounds?.top
158
+ : currentTransform.next?.bounds?.top) || 0;
159
+ const currentInputPointX = currentTransform.inputPoint.x;
160
+ if (currentTransform?.next) {
161
+ draggingLabel.push({
162
+ offset: {
163
+ x: currentInputPointX,
164
+ y: (currentOffsetBottomX + nextOffsetTopX) / 2,
165
+ },
166
+ type: FlowTransitionLabelEnum.BRANCH_DRAGGING_LABEL,
167
+ width: nextOffsetTopX - currentOffsetBottomX,
168
+ props: {
169
+ side: LABEL_SIDE_TYPE.NORMAL_BRANCH,
170
+ },
171
+ });
172
+ }
173
+ }
174
+ }
175
+
176
+ return [...draggingLabel];
177
+ },
178
+
179
+ /**
180
+ * @depreacted
181
+ */
182
+ addChild(node, json, options = {}) {
183
+ const { index } = options;
184
+ const document = node.document;
185
+ return document.addNode({
186
+ ...json,
187
+ ...options,
188
+ parent: node,
189
+ index: typeof index === 'number' ? index + 1 : undefined,
190
+ });
191
+ },
192
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { FlowNodeBaseType, type FlowNodeRegistry } from '@flowgram-vue/document';
7
+
8
+ /**
9
+ * Break 节点, 用于分支断开
10
+ */
11
+ export const BreakRegistry: FlowNodeRegistry = {
12
+ type: FlowNodeBaseType.BREAK,
13
+ extend: FlowNodeBaseType.END,
14
+ };
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import {
7
+ FlowLayoutDefault,
8
+ type FlowNodeRegistry,
9
+ FlowNodeSplitType,
10
+ FlowTransitionLabelEnum,
11
+ ConstantKeys,
12
+ getDefaultSpacing,
13
+ } from '@flowgram-vue/document';
14
+
15
+ /**
16
+ * 可以动态添加分支的分支节点
17
+ * dynamicSplit: (最原始的 id)
18
+ * blockIcon
19
+ * inlineBlocks
20
+ * block1
21
+ * blockOrderIcon
22
+ * block2
23
+ * blockOrderIcon
24
+ */
25
+ export const DynamicSplitRegistry: FlowNodeRegistry = {
26
+ type: FlowNodeSplitType.DYNAMIC_SPLIT,
27
+ meta: {
28
+ hidden: true,
29
+ inlineSpacingAfter: (node) =>
30
+ node.collapsed && node.entity.collapsedChildren.length > 1 ? 21 : 0,
31
+ // 判断是否有分支节点
32
+ spacing: (node) => {
33
+ const spacing = getDefaultSpacing(node.entity, ConstantKeys.NODE_SPACING);
34
+ return node.children.length === 1 ? spacing : spacing / 2;
35
+ },
36
+ },
37
+ getLabels(transition) {
38
+ if (transition.isNodeEnd) {
39
+ return [];
40
+ }
41
+
42
+ return [
43
+ {
44
+ type: FlowTransitionLabelEnum.ADDER_LABEL,
45
+ offset: transition.transform.outputPoint,
46
+ },
47
+ ];
48
+ },
49
+ onCreate(node, json) {
50
+ return node.document.addInlineBlocks(node, json.blocks || []);
51
+ },
52
+ getInputPoint(transform) {
53
+ // block icon
54
+ return transform.firstChild?.inputPoint || transform.defaultInputPoint;
55
+ },
56
+ getOutputPoint(transform, layout) {
57
+ const isVertical = FlowLayoutDefault.isVertical(layout);
58
+ // 没有分支节点
59
+ const noInlineBlocks = transform.children.length === 1;
60
+ const lastChildOutput = transform.lastChild?.outputPoint;
61
+ const spacing = getDefaultSpacing(transform.entity, ConstantKeys.NODE_SPACING);
62
+
63
+ if (isVertical) {
64
+ return {
65
+ x: lastChildOutput ? lastChildOutput.x : transform.bounds.center.x,
66
+ y: transform.bounds.bottom + (noInlineBlocks ? spacing / 2 : 0),
67
+ };
68
+ }
69
+
70
+ return {
71
+ x: transform.bounds.right + (noInlineBlocks ? spacing / 2 : 0),
72
+ y: lastChildOutput ? lastChildOutput.y : transform.bounds.center.y,
73
+ };
74
+ },
75
+
76
+ /**
77
+ * @depreacted
78
+ */
79
+ addChild(node, json, options = {}) {
80
+ const { index } = options;
81
+ const document = node.document;
82
+ const parentId = `$inlineBlocks$${node.id}`;
83
+ let parent = document.getNode(parentId);
84
+ if (!parent) {
85
+ parent = document.addNode({
86
+ id: parentId,
87
+ type: 'inlineBlocks',
88
+ originParent: node,
89
+ parent: node,
90
+ });
91
+ }
92
+ return document.addBlock(node, json, undefined, undefined, index);
93
+ },
94
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import {
7
+ FlowNodeBaseType,
8
+ type FlowNodeRegistry,
9
+ FlowTransitionLabelEnum,
10
+ ConstantKeys,
11
+ getDefaultSpacing,
12
+ } from '@flowgram-vue/document';
13
+
14
+ /**
15
+ * 占位节点,宽高为 0, 该节点下边同样有 "添加 label"
16
+ */
17
+ export const EmptyRegistry: FlowNodeRegistry = {
18
+ type: FlowNodeBaseType.EMPTY,
19
+ meta: {
20
+ spacing: (node) => {
21
+ const spacing = getDefaultSpacing(node.entity, ConstantKeys.NODE_SPACING);
22
+ return spacing / 2;
23
+ },
24
+ size: { width: 0, height: 0 },
25
+ hidden: true,
26
+ },
27
+ getLabels(transition) {
28
+ return [
29
+ {
30
+ offset: transition.transform.bounds,
31
+ type: FlowTransitionLabelEnum.ADDER_LABEL,
32
+ },
33
+ ];
34
+ },
35
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { FlowNodeBaseType, type FlowNodeRegistry } from '@flowgram-vue/document';
7
+
8
+ /**
9
+ * 结束节点
10
+ */
11
+ export const EndRegistry: FlowNodeRegistry = {
12
+ type: FlowNodeBaseType.END,
13
+ meta: {
14
+ draggable: false,
15
+ isNodeEnd: true,
16
+ selectable: false,
17
+ copyDisable: true,
18
+ },
19
+ // 结束节点没有出边和 label
20
+ getLines() {
21
+ return [];
22
+ },
23
+ getLabels() {
24
+ return [];
25
+ },
26
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export * from './dynamic-split';
7
+ export * from './static-split';
8
+ export * from './block';
9
+ export * from './inline-blocks';
10
+ export * from './block-icon';
11
+ export * from './block-order-icon';
12
+ export * from './start';
13
+ export * from './try-catch';
14
+ export * from './loop';
15
+ export * from './root';
16
+ export * from './empty';
17
+ export * from './end';
18
+ export * from './simple-split';
19
+ export * from './break';
20
+ export * from './input';
21
+ export * from './output';
22
+ export * from './multi-outputs';
23
+ export * from './multi-inputs';
24
+ export * from './slot';
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { Point } from '@flowgram-vue/utils';
7
+ import { FlowRendererKey } from '@flowgram-vue/renderer';
8
+ import {
9
+ DEFAULT_SPACING,
10
+ FlowNodeBaseType,
11
+ type FlowNodeRegistry,
12
+ FlowNodeRenderData,
13
+ FlowNodeTransformData,
14
+ type FlowNodeTransitionData,
15
+ FlowTransitionLabelEnum,
16
+ FlowLayoutDefault,
17
+ ConstantKeys,
18
+ getDefaultSpacing,
19
+ } from '@flowgram-vue/document';
20
+
21
+ /**
22
+ * 水平 Block 的偏移
23
+ */
24
+ export const InlineBlocksRegistry: FlowNodeRegistry = {
25
+ type: FlowNodeBaseType.INLINE_BLOCKS,
26
+ meta: {
27
+ hidden: true,
28
+ spacing: (node) => getDefaultSpacing(node.entity, ConstantKeys.NODE_SPACING),
29
+ isInlineBlocks: true,
30
+ inlineSpacingPre: (transform) => {
31
+ if (transform.entity.blocks.length === 0) {
32
+ return 0;
33
+ }
34
+ return (
35
+ getDefaultSpacing(transform.entity, ConstantKeys.INLINE_BLOCKS_PADDING_TOP) ||
36
+ DEFAULT_SPACING.INLINE_BLOCKS_PADDING_TOP
37
+ );
38
+ },
39
+ inlineSpacingAfter: (transform) => {
40
+ if (transform.entity.blocks.length === 0) {
41
+ return 0;
42
+ }
43
+ return getDefaultSpacing(transform.entity, ConstantKeys.INLINE_BLOCKS_PADDING_BOTTOM);
44
+ },
45
+ },
46
+ /**
47
+ * 控制子分支的间距
48
+ * @param child
49
+ */
50
+ getChildDelta(child, layout) {
51
+ const isVertical = FlowLayoutDefault.isVertical(layout);
52
+ const preTransform = child.entity.pre?.getData(FlowNodeTransformData);
53
+ if (preTransform) {
54
+ const { localBounds: preBounds } = preTransform;
55
+ if (isVertical) {
56
+ const leftSpacing = preTransform.size.width + preTransform.originDeltaX;
57
+
58
+ // 如果小于最小宽度,偏移最小宽度的距离
59
+ const delta = Math.max(
60
+ child.parent!.minInlineBlockSpacing - leftSpacing,
61
+ getDefaultSpacing(child.entity, ConstantKeys.BRANCH_SPACING) - child.originDeltaX
62
+ );
63
+
64
+ return {
65
+ // 这里需要加上原点的偏移量,并加上水平间距
66
+ x: preBounds.right + delta,
67
+ y: 0,
68
+ };
69
+ } else {
70
+ const bottomSpacing = preTransform.size.height + preTransform.originDeltaY;
71
+
72
+ // 如果小于最小高度,偏移最小高度的距离
73
+ const delta = Math.max(
74
+ child.parent!.minInlineBlockSpacing - bottomSpacing,
75
+ getDefaultSpacing(child.entity, ConstantKeys.BRANCH_SPACING) - child.originDeltaY
76
+ );
77
+
78
+ return {
79
+ x: 0,
80
+ // 这里需要加上原点的偏移量,并加上垂直间距
81
+ y: preBounds.bottom + delta,
82
+ };
83
+ }
84
+ }
85
+ return {
86
+ x: 0,
87
+ y: 0,
88
+ };
89
+ },
90
+ /**
91
+ * 控制条件分支居中布局
92
+ * @param trans
93
+ */
94
+ getDelta(trans, layout) {
95
+ const isVertical = FlowLayoutDefault.isVertical(layout);
96
+ const { pre, collapsed } = trans;
97
+
98
+ if (collapsed) {
99
+ return { x: 0, y: 0 };
100
+ }
101
+
102
+ if (isVertical) {
103
+ const preCenter = pre!.localBounds.center.x;
104
+ const firstBlockX = trans.firstChild?.transform.position.x || 0;
105
+ const lastBlockX = trans.lastChild?.transform.position.x || 0;
106
+ const currentCenter = (lastBlockX - firstBlockX) / 2;
107
+
108
+ return {
109
+ x: preCenter - currentCenter,
110
+ y: 0,
111
+ };
112
+ }
113
+ const preCenter = pre!.localBounds.center.y;
114
+ const firstBlockY = trans.firstChild?.transform.position.y || 0;
115
+ const lastBlockY = trans.lastChild?.transform.position.y || 0;
116
+ const currentCenter = (lastBlockY - firstBlockY) / 2;
117
+
118
+ return {
119
+ x: 0,
120
+ y: preCenter - currentCenter,
121
+ };
122
+ },
123
+ getLabels(transition) {
124
+ return getBranchAdderLabel(transition);
125
+ },
126
+ getLines() {
127
+ return [];
128
+ },
129
+ // 和前序节点对齐
130
+ getInputPoint(transform, layout) {
131
+ const isVertical = FlowLayoutDefault.isVertical(layout);
132
+ if (isVertical) {
133
+ return {
134
+ x: transform.pre?.outputPoint.x || 0,
135
+ y: transform.bounds.top,
136
+ };
137
+ }
138
+ return {
139
+ x: transform.bounds.left,
140
+ y: transform.pre?.outputPoint.y || 0,
141
+ };
142
+ },
143
+ getOutputPoint(transform, layout) {
144
+ const isVertical = FlowLayoutDefault.isVertical(layout);
145
+ // 收缩时,出点为入点
146
+ if (transform.collapsed) {
147
+ return transform.inputPoint;
148
+ }
149
+
150
+ if (isVertical) {
151
+ return {
152
+ x: transform.pre?.outputPoint.x || 0,
153
+ y: transform.bounds.bottom,
154
+ };
155
+ }
156
+ return {
157
+ x: transform.bounds.right,
158
+ y: transform.pre?.outputPoint.y || 0,
159
+ };
160
+ },
161
+ };
162
+
163
+ /**
164
+ * inlineBlocks 获取 BranchAdder 和展开 label
165
+ */
166
+ export function getBranchAdderLabel(transition: FlowNodeTransitionData) {
167
+ const { isVertical } = transition.entity;
168
+ const currentTransform = transition.transform;
169
+
170
+ // 收起时展示收起 label
171
+ if (currentTransform.collapsed) {
172
+ return [
173
+ {
174
+ type: FlowTransitionLabelEnum.COLLAPSE_LABEL,
175
+ offset: Point.move(currentTransform.inputPoint, isVertical ? { y: 10 } : { x: 10 }),
176
+ props: {
177
+ activateNode: transition.entity.pre,
178
+ },
179
+ },
180
+ ];
181
+ }
182
+
183
+ return [
184
+ {
185
+ type: FlowTransitionLabelEnum.CUSTOM_LABEL,
186
+ renderKey: FlowRendererKey.BRANCH_ADDER,
187
+ offset: Point.move(currentTransform.inputPoint, isVertical ? { y: 10 } : { x: 10 }),
188
+ props: {
189
+ // 激活状态
190
+ activated: transition.entity.getData(FlowNodeRenderData)!.activated,
191
+ transform: currentTransform,
192
+ // 传给外部使用的 node 信息
193
+ node: currentTransform.originParent?.entity,
194
+ },
195
+ },
196
+ ];
197
+ }