@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.
Files changed (66) hide show
  1. package/dist/esm/chunk-3UW6BHP2.js +7 -0
  2. package/dist/esm/chunk-3UW6BHP2.js.map +1 -0
  3. package/dist/esm/chunk-5BT3ZR4D.js +23 -0
  4. package/dist/esm/chunk-5BT3ZR4D.js.map +1 -0
  5. package/dist/esm/{chunk-DE4324TR.js → chunk-IKQUOAWQ.js} +1 -1
  6. package/dist/esm/chunk-IKQUOAWQ.js.map +1 -0
  7. package/dist/esm/chunk-TQLT57GW.js +1 -0
  8. package/dist/esm/chunk-TQLT57GW.js.map +1 -0
  9. package/dist/esm/{chunk-J5FVRRUV.js → chunk-U2XMPOSL.js} +2 -1
  10. package/dist/esm/chunk-U2XMPOSL.js.map +1 -0
  11. package/dist/esm/index.js +1392 -642
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/typings/index.js +12 -7
  14. package/dist/esm/typings/workflow-drag.js +2 -0
  15. package/dist/esm/typings/workflow-drag.js.map +1 -0
  16. package/dist/esm/typings/workflow-json.js +1 -1
  17. package/dist/esm/typings/workflow-line.js +1 -1
  18. package/dist/esm/typings/workflow-operation.js +8 -0
  19. package/dist/esm/typings/workflow-operation.js.map +1 -0
  20. package/dist/index.d.mts +261 -189
  21. package/dist/index.d.ts +261 -189
  22. package/dist/index.js +1392 -644
  23. package/dist/index.js.map +1 -1
  24. package/dist/typings/index.d.mts +10 -5
  25. package/dist/typings/index.d.ts +10 -5
  26. package/dist/typings/index.js +16 -7
  27. package/dist/typings/index.js.map +1 -1
  28. package/dist/typings/workflow-drag.d.mts +7 -0
  29. package/dist/typings/workflow-drag.d.ts +7 -0
  30. package/dist/typings/workflow-drag.js +19 -0
  31. package/dist/typings/workflow-drag.js.map +1 -0
  32. package/dist/typings/workflow-edge.d.mts +5 -0
  33. package/dist/typings/workflow-edge.d.ts +5 -0
  34. package/dist/typings/workflow-edge.js.map +1 -1
  35. package/dist/typings/workflow-json.d.mts +3 -4
  36. package/dist/typings/workflow-json.d.ts +3 -4
  37. package/dist/typings/workflow-json.js +1 -0
  38. package/dist/typings/workflow-json.js.map +1 -1
  39. package/dist/typings/workflow-line.d.mts +3 -4
  40. package/dist/typings/workflow-line.d.ts +3 -4
  41. package/dist/typings/workflow-line.js +8 -5
  42. package/dist/typings/workflow-line.js.map +1 -1
  43. package/dist/typings/workflow-node.d.mts +2 -3
  44. package/dist/typings/workflow-node.d.ts +2 -3
  45. package/dist/typings/workflow-node.js.map +1 -1
  46. package/dist/typings/workflow-operation.d.mts +38 -0
  47. package/dist/typings/workflow-operation.d.ts +38 -0
  48. package/dist/typings/workflow-operation.js +31 -0
  49. package/dist/typings/workflow-operation.js.map +1 -0
  50. package/dist/typings/workflow-registry.d.mts +9 -4
  51. package/dist/typings/workflow-registry.d.ts +9 -4
  52. package/dist/typings/workflow-registry.js.map +1 -1
  53. package/dist/typings/workflow-sub-canvas.d.mts +6 -1
  54. package/dist/typings/workflow-sub-canvas.d.ts +6 -1
  55. package/dist/typings/workflow-sub-canvas.js.map +1 -1
  56. package/dist/workflow-node-entity-DH5qlw7I.d.mts +1147 -0
  57. package/dist/workflow-node-entity-DWVtlA2a.d.ts +1147 -0
  58. package/package.json +15 -15
  59. package/dist/esm/chunk-DE4324TR.js.map +0 -1
  60. package/dist/esm/chunk-J5FVRRUV.js.map +0 -1
  61. package/dist/esm/chunk-PT4ZVDZZ.js +0 -20
  62. package/dist/esm/chunk-PT4ZVDZZ.js.map +0 -1
  63. package/dist/workflow-line-entity-BJQBRDgJ.d.mts +0 -747
  64. package/dist/workflow-line-entity-CEitdjhk.d.ts +0 -747
  65. package/dist/workflow-sub-canvas-DOVla1mw.d.mts +0 -15
  66. package/dist/workflow-sub-canvas-DOVla1mw.d.ts +0 -15
package/dist/index.d.ts CHANGED
@@ -1,21 +1,24 @@
1
- import { PlaygroundConfigEntity, EntityData } from '@flowgram.ai/core';
2
- export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, usePlaygroundLatest, useRefresh, useService } from '@flowgram.ai/core';
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 WorkflowPortEntity, a as WorkflowDocument, b as WorkflowPorts, c as WorkflowPortType, d as WorkflowPort, e as WorkflowLineEntity, L as LineRenderType, f as WorkflowLineRenderContribution, g as LinePosition } from './workflow-line-entity-CEitdjhk.js';
6
- export { t as LINE_HOVER_DISTANCE, q as LineColor, r as LineColors, p as LineType, N as NodesDragEndEvent, C as NodesDragEvent, O as OnDragLineEnd, P as POINT_RADIUS, x as PORT_SIZE, i as WORKFLOW_LINE_ENTITY, A as WorkfloEntityHoverable, m as WorkflowContentChangeEvent, l as WorkflowContentChangeType, H as WorkflowDocumentOptions, I as WorkflowDocumentOptionsDefault, F as WorkflowDocumentProvider, E as WorkflowDragService, B as WorkflowHoverService, k as WorkflowJSON, v as WorkflowLineEntityOpts, w as WorkflowLineInfo, u as WorkflowLinePortInfo, s as WorkflowLineRenderContributionFactory, G as WorkflowLinesManager, o as WorkflowNodeJSON, n as WorkflowNodeMeta, y as WorkflowPortEntityOpts, z as WorkflowSelectService, j as domReactToBounds, h as getPortEntityId, D as onDragLineEndParams } from './workflow-line-entity-CEitdjhk.js';
7
- import { W as WorkflowNodeEntity } from './workflow-sub-canvas-DOVla1mw.js';
8
- export { a as WorkflowSubCanvas } from './workflow-sub-canvas-DOVla1mw.js';
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-DWVtlA2a.js';
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-DWVtlA2a.js';
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.js';
11
+ import React$1 from 'react';
12
+ import { WorkflowOperationBaseService, NodePostionUpdateEvent } from './typings/workflow-operation.js';
13
13
  import { ContainerModule } from 'inversify';
14
14
  export { WorkflowEdgeJSON } from './typings/workflow-edge.js';
15
15
  export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './typings/workflow-registry.js';
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
- * 距离很小时,xy 各偏移 30
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
- * portsData 只监听点位的数目和类型,不监听点位的 position 变化
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
- interface StraightData {
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 };