@flowgram.ai/free-layout-core 0.1.0-alpha.2 → 0.1.0-alpha.21
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/dist/esm/chunk-3UW6BHP2.js +7 -0
- package/dist/esm/chunk-3UW6BHP2.js.map +1 -0
- package/dist/esm/chunk-5BT3ZR4D.js +23 -0
- package/dist/esm/chunk-5BT3ZR4D.js.map +1 -0
- package/dist/esm/{chunk-DE4324TR.js → chunk-IKQUOAWQ.js} +1 -1
- package/dist/esm/chunk-IKQUOAWQ.js.map +1 -0
- package/dist/esm/chunk-TQLT57GW.js +1 -0
- package/dist/esm/chunk-TQLT57GW.js.map +1 -0
- package/dist/esm/{chunk-J5FVRRUV.js → chunk-U2XMPOSL.js} +2 -1
- package/dist/esm/chunk-U2XMPOSL.js.map +1 -0
- package/dist/esm/index.js +1392 -642
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/typings/index.js +12 -7
- package/dist/esm/typings/workflow-drag.js +2 -0
- package/dist/esm/typings/workflow-drag.js.map +1 -0
- package/dist/esm/typings/workflow-json.js +1 -1
- package/dist/esm/typings/workflow-line.js +1 -1
- package/dist/esm/typings/workflow-operation.js +8 -0
- package/dist/esm/typings/workflow-operation.js.map +1 -0
- package/dist/index.d.mts +261 -189
- package/dist/index.d.ts +261 -189
- package/dist/index.js +1392 -644
- package/dist/index.js.map +1 -1
- package/dist/typings/index.d.mts +10 -5
- package/dist/typings/index.d.ts +10 -5
- package/dist/typings/index.js +16 -7
- package/dist/typings/index.js.map +1 -1
- package/dist/typings/workflow-drag.d.mts +7 -0
- package/dist/typings/workflow-drag.d.ts +7 -0
- package/dist/typings/workflow-drag.js +19 -0
- package/dist/typings/workflow-drag.js.map +1 -0
- package/dist/typings/workflow-edge.d.mts +5 -0
- package/dist/typings/workflow-edge.d.ts +5 -0
- package/dist/typings/workflow-edge.js.map +1 -1
- package/dist/typings/workflow-json.d.mts +3 -4
- package/dist/typings/workflow-json.d.ts +3 -4
- package/dist/typings/workflow-json.js +1 -0
- package/dist/typings/workflow-json.js.map +1 -1
- package/dist/typings/workflow-line.d.mts +3 -4
- package/dist/typings/workflow-line.d.ts +3 -4
- package/dist/typings/workflow-line.js +8 -5
- package/dist/typings/workflow-line.js.map +1 -1
- package/dist/typings/workflow-node.d.mts +2 -3
- package/dist/typings/workflow-node.d.ts +2 -3
- package/dist/typings/workflow-node.js.map +1 -1
- package/dist/typings/workflow-operation.d.mts +38 -0
- package/dist/typings/workflow-operation.d.ts +38 -0
- package/dist/typings/workflow-operation.js +31 -0
- package/dist/typings/workflow-operation.js.map +1 -0
- package/dist/typings/workflow-registry.d.mts +9 -4
- package/dist/typings/workflow-registry.d.ts +9 -4
- package/dist/typings/workflow-registry.js.map +1 -1
- package/dist/typings/workflow-sub-canvas.d.mts +6 -1
- package/dist/typings/workflow-sub-canvas.d.ts +6 -1
- package/dist/typings/workflow-sub-canvas.js.map +1 -1
- package/dist/workflow-node-entity-DH5qlw7I.d.mts +1147 -0
- package/dist/workflow-node-entity-DWVtlA2a.d.ts +1147 -0
- package/package.json +15 -15
- package/dist/esm/chunk-DE4324TR.js.map +0 -1
- package/dist/esm/chunk-J5FVRRUV.js.map +0 -1
- package/dist/esm/chunk-PT4ZVDZZ.js +0 -20
- package/dist/esm/chunk-PT4ZVDZZ.js.map +0 -1
- package/dist/workflow-line-entity-BJQBRDgJ.d.mts +0 -747
- package/dist/workflow-line-entity-CEitdjhk.d.ts +0 -747
- package/dist/workflow-sub-canvas-DOVla1mw.d.mts +0 -15
- package/dist/workflow-sub-canvas-DOVla1mw.d.ts +0 -15
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
URLParams
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-IKQUOAWQ.js";
|
|
4
|
+
import "../chunk-KNYZRMIO.js";
|
|
5
|
+
import "../chunk-NU6G5HF4.js";
|
|
6
|
+
import "../chunk-TQLT57GW.js";
|
|
4
7
|
import "../chunk-CGOMTQ3G.js";
|
|
5
8
|
import {
|
|
6
9
|
WorkflowContentChangeType
|
|
7
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-U2XMPOSL.js";
|
|
8
11
|
import {
|
|
9
12
|
LineColors,
|
|
10
13
|
LineType
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-EUXUH3YW.js";
|
|
14
|
+
} from "../chunk-5BT3ZR4D.js";
|
|
13
15
|
import "../chunk-DDJTYHXN.js";
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
+
import {
|
|
17
|
+
WorkflowOperationBaseService
|
|
18
|
+
} from "../chunk-3UW6BHP2.js";
|
|
19
|
+
import "../chunk-EUXUH3YW.js";
|
|
16
20
|
export {
|
|
17
21
|
LineColors,
|
|
18
22
|
LineType,
|
|
19
23
|
URLParams,
|
|
20
|
-
WorkflowContentChangeType
|
|
24
|
+
WorkflowContentChangeType,
|
|
25
|
+
WorkflowOperationBaseService
|
|
21
26
|
};
|
|
22
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import { PlaygroundConfigEntity, EntityData } from '@flowgram.ai/core';
|
|
2
|
-
export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext,
|
|
1
|
+
import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData } from '@flowgram.ai/core';
|
|
2
|
+
export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, useRefresh, useService } from '@flowgram.ai/core';
|
|
3
3
|
import { NodeFormProps } from '@flowgram.ai/node';
|
|
4
|
-
import { FlowNodeEntity } from '@flowgram.ai/document';
|
|
5
|
-
import { W as
|
|
6
|
-
export {
|
|
7
|
-
import { W as WorkflowNodeEntity } from './workflow-sub-canvas-DOVla1mw.mjs';
|
|
8
|
-
export { a as WorkflowSubCanvas } from './workflow-sub-canvas-DOVla1mw.mjs';
|
|
4
|
+
import { FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
|
|
5
|
+
import { W as WorkflowJSON, L as LineCenterPoint, a as WorkflowDocument, b as WorkflowNodeEntity, c as WorkflowHoverService, d as WorkflowLinesManager, e as WorkflowSelectService, f as WorkflowDocumentOptions, g as LineEventProps, N as NodesDragEvent, h as WorkflowNodeJSON, i as WorkflowPortEntity, j as WorkflowLineEntity, O as OnDragLineEnd, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-node-entity-DH5qlw7I.mjs';
|
|
6
|
+
export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-DH5qlw7I.mjs';
|
|
9
7
|
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
10
|
-
import { IPoint, Rectangle } from '@flowgram.ai/utils';
|
|
8
|
+
import { IPoint, Rectangle, DisposableCollection, Disposable } from '@flowgram.ai/utils';
|
|
11
9
|
export { compose, composeAsync, delay } from '@flowgram.ai/utils';
|
|
12
10
|
export { URLParams } from './typings/index.mjs';
|
|
11
|
+
import React$1 from 'react';
|
|
12
|
+
import { WorkflowOperationBaseService, NodePostionUpdateEvent } from './typings/workflow-operation.mjs';
|
|
13
13
|
import { ContainerModule } from 'inversify';
|
|
14
14
|
export { WorkflowEdgeJSON } from './typings/workflow-edge.mjs';
|
|
15
15
|
export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './typings/workflow-registry.mjs';
|
|
16
16
|
import '@flowgram.ai/form-core';
|
|
17
|
-
import 'react';
|
|
18
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
20
|
+
* SPDX-License-Identifier: MIT
|
|
21
|
+
*/
|
|
19
22
|
declare enum WorkflowCommands {
|
|
20
23
|
DELETE_NODES = "DELETE_NODES",
|
|
21
24
|
COPY_NODES = "COPY_NODES",
|
|
@@ -26,6 +29,162 @@ declare enum WorkflowCommands {
|
|
|
26
29
|
REDO = "REDO"
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
34
|
+
* SPDX-License-Identifier: MIT
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
declare const buildGroupJSON: (json: WorkflowJSON) => WorkflowJSON;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
41
|
+
* SPDX-License-Identifier: MIT
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
declare function getLineCenter(from: IPoint, to: IPoint, bbox: Rectangle, linePadding: number): LineCenterPoint;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
48
|
+
* SPDX-License-Identifier: MIT
|
|
49
|
+
*/
|
|
50
|
+
declare function nanoid(n?: number): string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
54
|
+
* SPDX-License-Identifier: MIT
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise<void>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
61
|
+
* SPDX-License-Identifier: MIT
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 获取没有碰撞的位置
|
|
66
|
+
* 距离很小时,xy 各偏移 30
|
|
67
|
+
* @param position
|
|
68
|
+
*/
|
|
69
|
+
declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint;
|
|
70
|
+
|
|
71
|
+
declare class WorkflowDragService {
|
|
72
|
+
protected playgroundConfig: PlaygroundConfigEntity;
|
|
73
|
+
protected hoverService: WorkflowHoverService;
|
|
74
|
+
protected document: WorkflowDocument;
|
|
75
|
+
protected linesManager: WorkflowLinesManager;
|
|
76
|
+
protected commandService: CommandService;
|
|
77
|
+
protected selectService: WorkflowSelectService;
|
|
78
|
+
protected operationService: WorkflowOperationBaseService;
|
|
79
|
+
readonly options: WorkflowDocumentOptions;
|
|
80
|
+
private _onDragLineEventEmitter;
|
|
81
|
+
readonly onDragLineEventChange: _flowgram_ai_utils.Event<LineEventProps>;
|
|
82
|
+
isDragging: boolean;
|
|
83
|
+
private _nodesDragEmitter;
|
|
84
|
+
readonly onNodesDrag: _flowgram_ai_utils.Event<NodesDragEvent>;
|
|
85
|
+
protected _toDispose: DisposableCollection;
|
|
86
|
+
private _droppableTransforms;
|
|
87
|
+
private _dropNode?;
|
|
88
|
+
private posAdjusters;
|
|
89
|
+
private _onDragLineEndCallbacks;
|
|
90
|
+
init(): void;
|
|
91
|
+
dispose(): void;
|
|
92
|
+
/**
|
|
93
|
+
* 拖拽选中节点
|
|
94
|
+
* @param triggerEvent
|
|
95
|
+
*/
|
|
96
|
+
startDragSelectedNodes(triggerEvent: MouseEvent | React$1.MouseEvent): Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* 通过拖入卡片添加
|
|
99
|
+
* @param type
|
|
100
|
+
* @param event
|
|
101
|
+
* @param data 节点数据
|
|
102
|
+
*/
|
|
103
|
+
dropCard(type: string, event: {
|
|
104
|
+
clientX: number;
|
|
105
|
+
clientY: number;
|
|
106
|
+
}, data?: Partial<WorkflowNodeJSON>, parent?: WorkflowNodeEntity): Promise<WorkflowNodeEntity | undefined>;
|
|
107
|
+
/**
|
|
108
|
+
* 拖拽卡片到画布
|
|
109
|
+
* 返回创建结果
|
|
110
|
+
* @param type
|
|
111
|
+
* @param event
|
|
112
|
+
*/
|
|
113
|
+
startDragCard(type: string, event: React$1.MouseEvent, data: Partial<WorkflowNodeJSON>, cloneNode?: (e: PlaygroundDragEvent) => HTMLDivElement): Promise<WorkflowNodeEntity | undefined>;
|
|
114
|
+
/**
|
|
115
|
+
* 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标
|
|
116
|
+
*/
|
|
117
|
+
adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint): IPoint;
|
|
118
|
+
/**
|
|
119
|
+
* 注册位置调整
|
|
120
|
+
*/
|
|
121
|
+
registerPosAdjuster(adjuster: (params: {
|
|
122
|
+
selectedNodes: WorkflowNodeEntity[];
|
|
123
|
+
position: IPoint;
|
|
124
|
+
}) => IPoint): {
|
|
125
|
+
dispose: () => boolean;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* 判断是否可以放置节点
|
|
129
|
+
*/
|
|
130
|
+
canDropToNode(params: {
|
|
131
|
+
dragNodeType?: FlowNodeType;
|
|
132
|
+
dragNode?: WorkflowNodeEntity;
|
|
133
|
+
dropNode?: WorkflowNodeEntity;
|
|
134
|
+
dropNodeType?: FlowNodeType;
|
|
135
|
+
}): {
|
|
136
|
+
allowDrop: boolean;
|
|
137
|
+
message?: string;
|
|
138
|
+
dropNode?: WorkflowNodeEntity;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* 获取拖拽偏移
|
|
142
|
+
*/
|
|
143
|
+
private getDragPosOffset;
|
|
144
|
+
private updateDroppableTransforms;
|
|
145
|
+
/** 是否容器节点 */
|
|
146
|
+
private isContainer;
|
|
147
|
+
/**
|
|
148
|
+
* 获取节点整体位置
|
|
149
|
+
*/
|
|
150
|
+
private getNodesPosition;
|
|
151
|
+
private nodeSelectable;
|
|
152
|
+
private updateDropNode;
|
|
153
|
+
private clearDrop;
|
|
154
|
+
private setLineColor;
|
|
155
|
+
private checkDraggingPort;
|
|
156
|
+
/**
|
|
157
|
+
* 容器内子节点总体位置重置为0
|
|
158
|
+
*/
|
|
159
|
+
private resetContainerInternalPosition;
|
|
160
|
+
private childrenOfContainer;
|
|
161
|
+
/**
|
|
162
|
+
* 绘制线条
|
|
163
|
+
* @param opts
|
|
164
|
+
* @param event
|
|
165
|
+
*/
|
|
166
|
+
startDrawingLine(port: WorkflowPortEntity, event: {
|
|
167
|
+
clientX: number;
|
|
168
|
+
clientY: number;
|
|
169
|
+
}, originLine?: WorkflowLineEntity): Promise<{
|
|
170
|
+
dragSuccess?: boolean;
|
|
171
|
+
newLine?: WorkflowLineEntity;
|
|
172
|
+
}>;
|
|
173
|
+
private updateDrawingLine;
|
|
174
|
+
/**
|
|
175
|
+
* 重新连接线条
|
|
176
|
+
* @param line
|
|
177
|
+
* @param e
|
|
178
|
+
*/
|
|
179
|
+
resetLine(line: WorkflowLineEntity, e: MouseEvent): Promise<void>;
|
|
180
|
+
/** 线条拖拽结束 */
|
|
181
|
+
onDragLineEnd(callback: OnDragLineEnd): Disposable;
|
|
182
|
+
/** 能否建立容器连线 */
|
|
183
|
+
private canBuildContainerLine;
|
|
184
|
+
/** 获取最近的 port */
|
|
185
|
+
private getNearestPort;
|
|
186
|
+
}
|
|
187
|
+
|
|
29
188
|
type PositionMap = Record<string, IPoint>;
|
|
30
189
|
/**
|
|
31
190
|
* 重置布局服务
|
|
@@ -67,11 +226,75 @@ declare class WorkflowResetLayoutService {
|
|
|
67
226
|
dispose(): void;
|
|
68
227
|
}
|
|
69
228
|
|
|
229
|
+
declare class WorkflowOperationBaseServiceImpl extends FlowOperationBaseServiceImpl implements WorkflowOperationBaseService {
|
|
230
|
+
protected document: WorkflowDocument;
|
|
231
|
+
linesManager: WorkflowLinesManager;
|
|
232
|
+
private onNodePostionUpdateEmitter;
|
|
233
|
+
readonly onNodePostionUpdate: _flowgram_ai_utils.Event<NodePostionUpdateEvent>;
|
|
234
|
+
updateNodePosition(nodeOrId: FlowNodeEntityOrId, position: IPoint): void;
|
|
235
|
+
fromJSON(json: WorkflowJSON): void;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
240
|
+
* SPDX-License-Identifier: MIT
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
interface WorkflowLineRenderDataSchema {
|
|
244
|
+
version: string;
|
|
245
|
+
contributions: Map<LineRenderType, WorkflowLineRenderContribution>;
|
|
246
|
+
position: LinePosition;
|
|
247
|
+
}
|
|
248
|
+
declare class WorkflowLineRenderData extends EntityData<WorkflowLineRenderDataSchema> {
|
|
249
|
+
static type: string;
|
|
250
|
+
entity: WorkflowLineEntity;
|
|
251
|
+
constructor(entity: WorkflowLineEntity);
|
|
252
|
+
getDefaultData(): WorkflowLineRenderDataSchema;
|
|
253
|
+
get renderVersion(): string;
|
|
254
|
+
get position(): LinePosition;
|
|
255
|
+
get path(): string;
|
|
256
|
+
calcDistance(pos: IPoint): number;
|
|
257
|
+
get bounds(): Rectangle;
|
|
258
|
+
/**
|
|
259
|
+
* 更新数据
|
|
260
|
+
* WARNING: 这个方法,必须在 requestAnimationFrame / useLayoutEffect 中调用,否则会引起浏览器强制重排
|
|
261
|
+
*/
|
|
262
|
+
update(): void;
|
|
263
|
+
private get lineType();
|
|
264
|
+
/**
|
|
265
|
+
* 获取 center 位置
|
|
266
|
+
*/
|
|
267
|
+
get center(): LineCenterPoint;
|
|
268
|
+
/**
|
|
269
|
+
* 更新版本
|
|
270
|
+
* WARNING: 这个方法,必须在 requestAnimationFrame / useLayoutEffect 中调用,否则会引起浏览器强制重排
|
|
271
|
+
*/
|
|
272
|
+
private updatePosition;
|
|
273
|
+
private get currentLine();
|
|
274
|
+
private syncContributions;
|
|
275
|
+
private registerContribution;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
280
|
+
* SPDX-License-Identifier: MIT
|
|
281
|
+
*/
|
|
282
|
+
|
|
70
283
|
interface NodeRenderReturnType {
|
|
284
|
+
id: string;
|
|
285
|
+
type: string | number;
|
|
71
286
|
/**
|
|
72
287
|
* 当前节点
|
|
73
288
|
*/
|
|
74
289
|
node: FlowNodeEntity;
|
|
290
|
+
/**
|
|
291
|
+
* 节点 data 数据
|
|
292
|
+
*/
|
|
293
|
+
data: any;
|
|
294
|
+
/**
|
|
295
|
+
* 更新节点 data 数据
|
|
296
|
+
*/
|
|
297
|
+
updateData: (newData: any) => void;
|
|
75
298
|
/**
|
|
76
299
|
* 节点选中
|
|
77
300
|
*/
|
|
@@ -134,7 +357,7 @@ interface NodeRenderReturnType {
|
|
|
134
357
|
* 更新节点的扩展数据
|
|
135
358
|
* @param extInfo
|
|
136
359
|
*/
|
|
137
|
-
updateExtInfo<T = any>(extInfo: T): void;
|
|
360
|
+
updateExtInfo<T = any>(extInfo: T, fullUpdate?: boolean): void;
|
|
138
361
|
/**
|
|
139
362
|
* 展开/收起节点
|
|
140
363
|
* @param expanded
|
|
@@ -142,36 +365,52 @@ interface NodeRenderReturnType {
|
|
|
142
365
|
toggleExpand(): void;
|
|
143
366
|
}
|
|
144
367
|
|
|
368
|
+
/**
|
|
369
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
370
|
+
* SPDX-License-Identifier: MIT
|
|
371
|
+
*/
|
|
372
|
+
|
|
145
373
|
declare function useNodeRender(nodeFromProps?: WorkflowNodeEntity): NodeRenderReturnType;
|
|
146
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
377
|
+
* SPDX-License-Identifier: MIT
|
|
378
|
+
*/
|
|
147
379
|
/**
|
|
148
380
|
* 获取当前渲染的 dom 节点
|
|
149
381
|
*/
|
|
150
382
|
declare function useCurrentDomNode(): HTMLDivElement;
|
|
151
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
386
|
+
* SPDX-License-Identifier: MIT
|
|
387
|
+
*/
|
|
388
|
+
|
|
152
389
|
/**
|
|
153
390
|
* 获取当前节点
|
|
154
391
|
*/
|
|
155
392
|
declare function useCurrentEntity(): WorkflowNodeEntity;
|
|
156
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
396
|
+
* SPDX-License-Identifier: MIT
|
|
397
|
+
*/
|
|
398
|
+
|
|
157
399
|
declare function useWorkflowDocument(): WorkflowDocument;
|
|
158
400
|
|
|
401
|
+
/**
|
|
402
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
403
|
+
* SPDX-License-Identifier: MIT
|
|
404
|
+
*/
|
|
159
405
|
/**
|
|
160
406
|
* 获取 readonly 状态
|
|
161
407
|
*/
|
|
162
408
|
declare function usePlaygroundReadonlyState(listenChange?: boolean): boolean;
|
|
163
409
|
|
|
164
|
-
declare function nanoid(n?: number): string;
|
|
165
|
-
|
|
166
|
-
declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise<void>;
|
|
167
|
-
|
|
168
410
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* @param position
|
|
411
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
412
|
+
* SPDX-License-Identifier: MIT
|
|
172
413
|
*/
|
|
173
|
-
declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint;
|
|
174
|
-
|
|
175
414
|
declare enum EditorCursorState {
|
|
176
415
|
GRAB = "GRAB",
|
|
177
416
|
SELECT = "SELECT"
|
|
@@ -184,177 +423,10 @@ declare enum InteractiveType {
|
|
|
184
423
|
}
|
|
185
424
|
|
|
186
425
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
426
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
427
|
+
* SPDX-License-Identifier: MIT
|
|
189
428
|
*/
|
|
190
|
-
declare class WorkflowNodePortsData extends EntityData {
|
|
191
|
-
static readonly type = "WorkflowNodePortsData";
|
|
192
|
-
readonly entity: WorkflowNodeEntity;
|
|
193
|
-
/** 静态的 ports 数据 */
|
|
194
|
-
protected _staticPorts: WorkflowPorts;
|
|
195
|
-
/** 存储 port 实体的 id,用于判断 port 是否存在 */
|
|
196
|
-
protected _portIDSet: Set<string>;
|
|
197
|
-
/** 上一次的 ports 数据,用于判断 ports 是否发生变化 */
|
|
198
|
-
protected _prePorts: WorkflowPorts;
|
|
199
|
-
constructor(entity: WorkflowNodeEntity);
|
|
200
|
-
getDefaultData(): any;
|
|
201
|
-
/**
|
|
202
|
-
* 更新静态的 ports 数据
|
|
203
|
-
*/
|
|
204
|
-
updateStaticPorts(ports: WorkflowPorts): void;
|
|
205
|
-
/**
|
|
206
|
-
* 动态计算点位,通过 dom 的 data-port-key
|
|
207
|
-
*/
|
|
208
|
-
updateDynamicPorts(): void;
|
|
209
|
-
/**
|
|
210
|
-
* 根据 key 获取 port 实体
|
|
211
|
-
*/
|
|
212
|
-
getPortEntityByKey(portType: WorkflowPortType, portKey?: string | number): WorkflowPortEntity;
|
|
213
|
-
/**
|
|
214
|
-
* 更新 ports 数据
|
|
215
|
-
*/
|
|
216
|
-
updatePorts(ports: WorkflowPorts): void;
|
|
217
|
-
/**
|
|
218
|
-
* 获取所有 port entities
|
|
219
|
-
*/
|
|
220
|
-
get allPorts(): WorkflowPortEntity[];
|
|
221
|
-
/**
|
|
222
|
-
* 获取输入点位
|
|
223
|
-
*/
|
|
224
|
-
get inputPorts(): WorkflowPortEntity[];
|
|
225
|
-
/**
|
|
226
|
-
* 获取输出点位
|
|
227
|
-
*/
|
|
228
|
-
get outputPorts(): WorkflowPortEntity[];
|
|
229
|
-
/**
|
|
230
|
-
* 获取输入点位置
|
|
231
|
-
*/
|
|
232
|
-
get inputPoints(): IPoint[];
|
|
233
|
-
/**
|
|
234
|
-
* 获取输出点位置
|
|
235
|
-
*/
|
|
236
|
-
get outputPoints(): IPoint[];
|
|
237
|
-
/**
|
|
238
|
-
* 根据 key 获取 输入点位置
|
|
239
|
-
*/
|
|
240
|
-
getInputPoint(key?: string | number): IPoint;
|
|
241
|
-
/**
|
|
242
|
-
* 根据 key 获取输出点位置
|
|
243
|
-
*/
|
|
244
|
-
getOutputPoint(key?: string | number): IPoint;
|
|
245
|
-
/**
|
|
246
|
-
* 获取 port 实体
|
|
247
|
-
*/
|
|
248
|
-
protected getPortEntity(portId: string): WorkflowPortEntity | undefined;
|
|
249
|
-
/**
|
|
250
|
-
* 拼接 port 实体的 id
|
|
251
|
-
*/
|
|
252
|
-
protected getPortId(portType: WorkflowPortType, portKey?: string | number): string;
|
|
253
|
-
/**
|
|
254
|
-
* 创建 port 实体
|
|
255
|
-
*/
|
|
256
|
-
protected createPortEntity(portInfo: WorkflowPort): WorkflowPortEntity;
|
|
257
|
-
/**
|
|
258
|
-
* 获取或创建 port 实体
|
|
259
|
-
*/
|
|
260
|
-
protected getOrCreatePortEntity(portInfo: WorkflowPort): WorkflowPortEntity;
|
|
261
|
-
/**
|
|
262
|
-
* 更新 port 实体
|
|
263
|
-
*/
|
|
264
|
-
protected updatePortEntity(portInfo: WorkflowPort): WorkflowPortEntity;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
interface WorkflowNodeLines {
|
|
268
|
-
inputLines: WorkflowLineEntity[];
|
|
269
|
-
outputLines: WorkflowLineEntity[];
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* 节点的关联的线条
|
|
273
|
-
*/
|
|
274
|
-
declare class WorkflowNodeLinesData extends EntityData<WorkflowNodeLines> {
|
|
275
|
-
static type: string;
|
|
276
|
-
entity: WorkflowNodeEntity;
|
|
277
|
-
getDefaultData(): WorkflowNodeLines;
|
|
278
|
-
constructor(entity: WorkflowNodeEntity);
|
|
279
|
-
/**
|
|
280
|
-
* 输入线条
|
|
281
|
-
*/
|
|
282
|
-
get inputLines(): WorkflowLineEntity[];
|
|
283
|
-
/**
|
|
284
|
-
* 输出线条
|
|
285
|
-
*/
|
|
286
|
-
get outputLines(): WorkflowLineEntity[];
|
|
287
|
-
/**
|
|
288
|
-
* 输入节点
|
|
289
|
-
*/
|
|
290
|
-
get inputNodes(): WorkflowNodeEntity[];
|
|
291
|
-
/**
|
|
292
|
-
* 所有输入节点
|
|
293
|
-
*/
|
|
294
|
-
get allInputNodes(): WorkflowNodeEntity[];
|
|
295
|
-
/**
|
|
296
|
-
* 输出节点
|
|
297
|
-
*/
|
|
298
|
-
get outputNodes(): WorkflowNodeEntity[];
|
|
299
|
-
/**
|
|
300
|
-
* 输入输出节点
|
|
301
|
-
*/
|
|
302
|
-
get allOutputNodes(): WorkflowNodeEntity[];
|
|
303
|
-
addLine(line: WorkflowLineEntity): void;
|
|
304
|
-
removeLine(line: WorkflowLineEntity): void;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
interface WorkflowLineRenderDataSchema {
|
|
308
|
-
version: string;
|
|
309
|
-
contributions: Map<LineRenderType, WorkflowLineRenderContribution>;
|
|
310
|
-
position: LinePosition;
|
|
311
|
-
}
|
|
312
|
-
declare class WorkflowLineRenderData extends EntityData<WorkflowLineRenderDataSchema> {
|
|
313
|
-
static type: string;
|
|
314
|
-
entity: WorkflowLineEntity;
|
|
315
|
-
constructor(entity: WorkflowLineEntity);
|
|
316
|
-
getDefaultData(): WorkflowLineRenderDataSchema;
|
|
317
|
-
get renderVersion(): string;
|
|
318
|
-
get position(): LinePosition;
|
|
319
|
-
get path(): string;
|
|
320
|
-
calcDistance(pos: IPoint): number;
|
|
321
|
-
get bounds(): Rectangle;
|
|
322
|
-
/**
|
|
323
|
-
* 更新数据
|
|
324
|
-
* WARNING: 这个方法,必须在 requestAnimationFrame / useLayoutEffect 中调用,否则会引起浏览器强制重排
|
|
325
|
-
*/
|
|
326
|
-
update(): void;
|
|
327
|
-
private get lineType();
|
|
328
|
-
/**
|
|
329
|
-
* 更新版本
|
|
330
|
-
* WARNING: 这个方法,必须在 requestAnimationFrame / useLayoutEffect 中调用,否则会引起浏览器强制重排
|
|
331
|
-
*/
|
|
332
|
-
private updatePosition;
|
|
333
|
-
private get currentLine();
|
|
334
|
-
private syncContributions;
|
|
335
|
-
private registerContribution;
|
|
336
|
-
}
|
|
337
429
|
|
|
338
430
|
declare const WorkflowDocumentContainerModule: ContainerModule;
|
|
339
431
|
|
|
340
|
-
|
|
341
|
-
points: IPoint[];
|
|
342
|
-
path: string;
|
|
343
|
-
bbox: Rectangle;
|
|
344
|
-
}
|
|
345
|
-
declare class WorkflowSimpleLineContribution implements WorkflowLineRenderContribution {
|
|
346
|
-
static type: string;
|
|
347
|
-
entity: WorkflowLineEntity;
|
|
348
|
-
constructor(entity: WorkflowLineEntity);
|
|
349
|
-
private data?;
|
|
350
|
-
get path(): string;
|
|
351
|
-
calcDistance(pos: IPoint): number;
|
|
352
|
-
get bounds(): Rectangle;
|
|
353
|
-
update(params: {
|
|
354
|
-
fromPos: IPoint;
|
|
355
|
-
toPos: IPoint;
|
|
356
|
-
}): void;
|
|
357
|
-
private projectPointOnLine;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
export { EditorCursorState, InteractiveType, LinePosition, LineRenderType, type NodeRenderReturnType, type PositionMap, type StraightData, WorkflowCommands, WorkflowDocument, WorkflowDocumentContainerModule, WorkflowLineEntity, WorkflowLineRenderContribution, WorkflowLineRenderData, type WorkflowLineRenderDataSchema, WorkflowNodeEntity, type WorkflowNodeLines, WorkflowNodeLinesData, WorkflowNodePortsData, WorkflowPort, WorkflowPortEntity, WorkflowPortType, WorkflowPorts, WorkflowResetLayoutService, WorkflowSimpleLineContribution, fitView, getAntiOverlapPosition, nanoid, useCurrentDomNode, useCurrentEntity, useNodeRender, usePlaygroundReadonlyState, useWorkflowDocument };
|
|
432
|
+
export { EditorCursorState, InteractiveType, LineCenterPoint, LineEventProps, LinePosition, LineRenderType, NodePostionUpdateEvent, type NodeRenderReturnType, NodesDragEvent, OnDragLineEnd, type PositionMap, WorkflowCommands, WorkflowDocument, WorkflowDocumentContainerModule, WorkflowDocumentOptions, WorkflowDragService, WorkflowHoverService, WorkflowJSON, WorkflowLineEntity, WorkflowLineRenderContribution, WorkflowLineRenderData, type WorkflowLineRenderDataSchema, WorkflowLinesManager, WorkflowNodeEntity, WorkflowNodeJSON, WorkflowOperationBaseService, WorkflowOperationBaseServiceImpl, WorkflowPortEntity, WorkflowResetLayoutService, WorkflowSelectService, buildGroupJSON, fitView, getAntiOverlapPosition, getLineCenter, nanoid, useCurrentDomNode, useCurrentEntity, useNodeRender, usePlaygroundReadonlyState, useWorkflowDocument };
|