@flowgram.ai/free-layout-core 0.2.16 → 0.2.18

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/dist/esm/{chunk-J5FVRRUV.js → chunk-242F2JCI.js} +1 -1
  2. package/dist/esm/chunk-242F2JCI.js.map +1 -0
  3. package/dist/esm/{chunk-BJKYSQMI.js → chunk-CTGO4RKX.js} +1 -1
  4. package/dist/esm/chunk-CTGO4RKX.js.map +1 -0
  5. package/dist/esm/{chunk-IYUZVBAO.js → chunk-IKQUOAWQ.js} +1 -1
  6. package/dist/esm/chunk-IKQUOAWQ.js.map +1 -0
  7. package/dist/esm/{chunk-LJH3TSLZ.js → chunk-O4WKIIW2.js} +1 -1
  8. package/dist/esm/chunk-O4WKIIW2.js.map +1 -0
  9. package/dist/esm/index.js +55 -35
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/typings/index.js +4 -4
  12. package/dist/esm/typings/workflow-json.js +1 -1
  13. package/dist/esm/typings/workflow-line.js +1 -1
  14. package/dist/esm/typings/workflow-operation.js +1 -1
  15. package/dist/index.d.mts +82 -5
  16. package/dist/index.d.ts +82 -5
  17. package/dist/index.js +35 -15
  18. package/dist/index.js.map +1 -1
  19. package/dist/typings/index.d.mts +7 -2
  20. package/dist/typings/index.d.ts +7 -2
  21. package/dist/typings/index.js.map +1 -1
  22. package/dist/typings/workflow-drag.d.mts +2 -2
  23. package/dist/typings/workflow-drag.d.ts +2 -2
  24. package/dist/typings/workflow-drag.js.map +1 -1
  25. package/dist/typings/workflow-edge.d.mts +4 -0
  26. package/dist/typings/workflow-edge.d.ts +4 -0
  27. package/dist/typings/workflow-edge.js.map +1 -1
  28. package/dist/typings/workflow-json.d.mts +2 -2
  29. package/dist/typings/workflow-json.d.ts +2 -2
  30. package/dist/typings/workflow-json.js.map +1 -1
  31. package/dist/typings/workflow-line.d.mts +2 -2
  32. package/dist/typings/workflow-line.d.ts +2 -2
  33. package/dist/typings/workflow-line.js.map +1 -1
  34. package/dist/typings/workflow-node.d.mts +2 -2
  35. package/dist/typings/workflow-node.d.ts +2 -2
  36. package/dist/typings/workflow-node.js.map +1 -1
  37. package/dist/typings/workflow-operation.d.mts +5 -0
  38. package/dist/typings/workflow-operation.d.ts +5 -0
  39. package/dist/typings/workflow-operation.js.map +1 -1
  40. package/dist/typings/workflow-registry.d.mts +7 -2
  41. package/dist/typings/workflow-registry.d.ts +7 -2
  42. package/dist/typings/workflow-registry.js.map +1 -1
  43. package/dist/typings/workflow-sub-canvas.d.mts +1 -1
  44. package/dist/typings/workflow-sub-canvas.d.ts +1 -1
  45. package/dist/typings/workflow-sub-canvas.js.map +1 -1
  46. package/dist/{workflow-line-entity-B4Mfa03B.d.ts → workflow-line-entity-BUokXoMi.d.ts} +61 -2
  47. package/dist/{workflow-line-entity-B34FWw9W.d.mts → workflow-line-entity-BuRLWUuf.d.mts} +61 -2
  48. package/dist/{workflow-sub-canvas-DOVla1mw.d.mts → workflow-sub-canvas-IQzlYvPD.d.mts} +10 -0
  49. package/dist/{workflow-sub-canvas-DOVla1mw.d.ts → workflow-sub-canvas-IQzlYvPD.d.ts} +10 -0
  50. package/package.json +9 -9
  51. package/dist/esm/chunk-BJKYSQMI.js.map +0 -1
  52. package/dist/esm/chunk-IYUZVBAO.js.map +0 -1
  53. package/dist/esm/chunk-J5FVRRUV.js.map +0 -1
  54. package/dist/esm/chunk-LJH3TSLZ.js.map +0 -1
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  URLParams
3
- } from "../chunk-IYUZVBAO.js";
3
+ } from "../chunk-IKQUOAWQ.js";
4
4
  import "../chunk-KNYZRMIO.js";
5
5
  import "../chunk-NU6G5HF4.js";
6
6
  import "../chunk-TQLT57GW.js";
7
7
  import "../chunk-CGOMTQ3G.js";
8
8
  import {
9
9
  WorkflowContentChangeType
10
- } from "../chunk-J5FVRRUV.js";
10
+ } from "../chunk-242F2JCI.js";
11
11
  import {
12
12
  LineColors,
13
13
  LineType
14
- } from "../chunk-BJKYSQMI.js";
14
+ } from "../chunk-CTGO4RKX.js";
15
15
  import "../chunk-DDJTYHXN.js";
16
16
  import {
17
17
  WorkflowOperationBaseService
18
- } from "../chunk-LJH3TSLZ.js";
18
+ } from "../chunk-O4WKIIW2.js";
19
19
  import "../chunk-EUXUH3YW.js";
20
20
  export {
21
21
  LineColors,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WorkflowContentChangeType
3
- } from "../chunk-J5FVRRUV.js";
3
+ } from "../chunk-242F2JCI.js";
4
4
  import "../chunk-EUXUH3YW.js";
5
5
  export {
6
6
  WorkflowContentChangeType
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LineColors,
3
3
  LineType
4
- } from "../chunk-BJKYSQMI.js";
4
+ } from "../chunk-CTGO4RKX.js";
5
5
  import "../chunk-EUXUH3YW.js";
6
6
  export {
7
7
  LineColors,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WorkflowOperationBaseService
3
- } from "../chunk-LJH3TSLZ.js";
3
+ } from "../chunk-O4WKIIW2.js";
4
4
  import "../chunk-EUXUH3YW.js";
5
5
  export {
6
6
  WorkflowOperationBaseService
package/dist/index.d.mts CHANGED
@@ -2,10 +2,10 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
2
2
  export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, usePlaygroundLatest, useRefresh, useService } from '@flowgram.ai/core';
3
3
  import { NodeFormProps } from '@flowgram.ai/node';
4
4
  import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
5
- import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowPorts, i as WorkflowPortType, j as WorkflowPort, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-line-entity-B34FWw9W.mjs';
6
- export { J as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, G as PORT_SIZE, o as WORKFLOW_LINE_ENTITY, K as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, Q as WorkflowDocumentOptionsDefault, M as WorkflowDocumentProvider, I as WorkflowEntityHoverable, q as WorkflowJSON, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, t as WorkflowNodeMeta, H as WorkflowPortEntityOpts, p as domReactToBounds, n as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-B34FWw9W.mjs';
7
- import { W as WorkflowNodeEntity } from './workflow-sub-canvas-DOVla1mw.mjs';
8
- export { a as WorkflowSubCanvas } from './workflow-sub-canvas-DOVla1mw.mjs';
5
+ import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowPorts, i as WorkflowPortType, j as WorkflowPort, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-line-entity-BuRLWUuf.mjs';
6
+ export { J as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, G as PORT_SIZE, o as WORKFLOW_LINE_ENTITY, K as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, Q as WorkflowDocumentOptionsDefault, M as WorkflowDocumentProvider, I as WorkflowEntityHoverable, q as WorkflowJSON, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, t as WorkflowNodeMeta, H as WorkflowPortEntityOpts, p as domReactToBounds, n as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-BuRLWUuf.mjs';
7
+ import { W as WorkflowNodeEntity } from './workflow-sub-canvas-IQzlYvPD.mjs';
8
+ export { a as WorkflowSubCanvas } from './workflow-sub-canvas-IQzlYvPD.mjs';
9
9
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
10
10
  import { DisposableCollection, IPoint, Disposable, Rectangle } from '@flowgram.ai/utils';
11
11
  export { compose, composeAsync, delay } from '@flowgram.ai/utils';
@@ -17,6 +17,10 @@ export { WorkflowEdgeJSON } from './typings/workflow-edge.mjs';
17
17
  export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './typings/workflow-registry.mjs';
18
18
  import '@flowgram.ai/form-core';
19
19
 
20
+ /**
21
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
22
+ * SPDX-License-Identifier: MIT
23
+ */
20
24
  declare enum WorkflowCommands {
21
25
  DELETE_NODES = "DELETE_NODES",
22
26
  COPY_NODES = "COPY_NODES",
@@ -73,7 +77,7 @@ declare class WorkflowDragService {
73
77
  /**
74
78
  * 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标
75
79
  */
76
- adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint, resetEmptyPos?: boolean): IPoint;
80
+ adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint): IPoint;
77
81
  /**
78
82
  * 注册位置调整
79
83
  */
@@ -88,7 +92,9 @@ declare class WorkflowDragService {
88
92
  */
89
93
  canDropToNode(params: {
90
94
  dragNodeType?: FlowNodeType;
95
+ dragNode?: WorkflowNodeEntity;
91
96
  dropNode?: WorkflowNodeEntity;
97
+ dropNodeType?: FlowNodeType;
92
98
  }): {
93
99
  allowDrop: boolean;
94
100
  message?: string;
@@ -181,6 +187,11 @@ declare class WorkflowOperationBaseServiceImpl extends FlowOperationBaseServiceI
181
187
  updateNodePosition(nodeOrId: FlowNodeEntityOrId, position: IPoint): void;
182
188
  }
183
189
 
190
+ /**
191
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
192
+ * SPDX-License-Identifier: MIT
193
+ */
194
+
184
195
  interface NodeRenderReturnType {
185
196
  id: string;
186
197
  type: string | number;
@@ -266,29 +277,66 @@ interface NodeRenderReturnType {
266
277
  toggleExpand(): void;
267
278
  }
268
279
 
280
+ /**
281
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
282
+ * SPDX-License-Identifier: MIT
283
+ */
284
+
269
285
  declare function useNodeRender(nodeFromProps?: WorkflowNodeEntity): NodeRenderReturnType;
270
286
 
287
+ /**
288
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
289
+ * SPDX-License-Identifier: MIT
290
+ */
271
291
  /**
272
292
  * 获取当前渲染的 dom 节点
273
293
  */
274
294
  declare function useCurrentDomNode(): HTMLDivElement;
275
295
 
296
+ /**
297
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
298
+ * SPDX-License-Identifier: MIT
299
+ */
300
+
276
301
  /**
277
302
  * 获取当前节点
278
303
  */
279
304
  declare function useCurrentEntity(): WorkflowNodeEntity;
280
305
 
306
+ /**
307
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
308
+ * SPDX-License-Identifier: MIT
309
+ */
310
+
281
311
  declare function useWorkflowDocument(): WorkflowDocument;
282
312
 
313
+ /**
314
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
315
+ * SPDX-License-Identifier: MIT
316
+ */
283
317
  /**
284
318
  * 获取 readonly 状态
285
319
  */
286
320
  declare function usePlaygroundReadonlyState(listenChange?: boolean): boolean;
287
321
 
322
+ /**
323
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
324
+ * SPDX-License-Identifier: MIT
325
+ */
288
326
  declare function nanoid(n?: number): string;
289
327
 
328
+ /**
329
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
330
+ * SPDX-License-Identifier: MIT
331
+ */
332
+
290
333
  declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise<void>;
291
334
 
335
+ /**
336
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
337
+ * SPDX-License-Identifier: MIT
338
+ */
339
+
292
340
  /**
293
341
  * 获取没有碰撞的位置
294
342
  * 距离很小时,xy 各偏移 30
@@ -296,6 +344,10 @@ declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfi
296
344
  */
297
345
  declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint;
298
346
 
347
+ /**
348
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
349
+ * SPDX-License-Identifier: MIT
350
+ */
299
351
  declare enum EditorCursorState {
300
352
  GRAB = "GRAB",
301
353
  SELECT = "SELECT"
@@ -307,6 +359,11 @@ declare enum InteractiveType {
307
359
  PAD = "PAD"
308
360
  }
309
361
 
362
+ /**
363
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
364
+ * SPDX-License-Identifier: MIT
365
+ */
366
+
310
367
  /**
311
368
  * 节点的点位信息
312
369
  * portsData 只监听点位的数目和类型,不监听点位的 position 变化
@@ -388,6 +445,11 @@ declare class WorkflowNodePortsData extends EntityData {
388
445
  protected updatePortEntity(portInfo: WorkflowPort): WorkflowPortEntity;
389
446
  }
390
447
 
448
+ /**
449
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
450
+ * SPDX-License-Identifier: MIT
451
+ */
452
+
391
453
  interface WorkflowNodeLines {
392
454
  inputLines: WorkflowLineEntity[];
393
455
  outputLines: WorkflowLineEntity[];
@@ -428,6 +490,11 @@ declare class WorkflowNodeLinesData extends EntityData<WorkflowNodeLines> {
428
490
  removeLine(line: WorkflowLineEntity): void;
429
491
  }
430
492
 
493
+ /**
494
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
495
+ * SPDX-License-Identifier: MIT
496
+ */
497
+
431
498
  interface WorkflowLineRenderDataSchema {
432
499
  version: string;
433
500
  contributions: Map<LineRenderType, WorkflowLineRenderContribution>;
@@ -459,8 +526,18 @@ declare class WorkflowLineRenderData extends EntityData<WorkflowLineRenderDataSc
459
526
  private registerContribution;
460
527
  }
461
528
 
529
+ /**
530
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
531
+ * SPDX-License-Identifier: MIT
532
+ */
533
+
462
534
  declare const WorkflowDocumentContainerModule: ContainerModule;
463
535
 
536
+ /**
537
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
538
+ * SPDX-License-Identifier: MIT
539
+ */
540
+
464
541
  interface StraightData {
465
542
  points: IPoint[];
466
543
  path: string;
package/dist/index.d.ts CHANGED
@@ -2,10 +2,10 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
2
2
  export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, usePlaygroundLatest, useRefresh, useService } from '@flowgram.ai/core';
3
3
  import { NodeFormProps } from '@flowgram.ai/node';
4
4
  import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
5
- import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowPorts, i as WorkflowPortType, j as WorkflowPort, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-line-entity-B4Mfa03B.js';
6
- export { J as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, G as PORT_SIZE, o as WORKFLOW_LINE_ENTITY, K as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, Q as WorkflowDocumentOptionsDefault, M as WorkflowDocumentProvider, I as WorkflowEntityHoverable, q as WorkflowJSON, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, t as WorkflowNodeMeta, H as WorkflowPortEntityOpts, p as domReactToBounds, n as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-B4Mfa03B.js';
7
- import { W as WorkflowNodeEntity } from './workflow-sub-canvas-DOVla1mw.js';
8
- export { a as WorkflowSubCanvas } from './workflow-sub-canvas-DOVla1mw.js';
5
+ import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowPorts, i as WorkflowPortType, j as WorkflowPort, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-line-entity-BUokXoMi.js';
6
+ export { J as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, G as PORT_SIZE, o as WORKFLOW_LINE_ENTITY, K as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, Q as WorkflowDocumentOptionsDefault, M as WorkflowDocumentProvider, I as WorkflowEntityHoverable, q as WorkflowJSON, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, t as WorkflowNodeMeta, H as WorkflowPortEntityOpts, p as domReactToBounds, n as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-BUokXoMi.js';
7
+ import { W as WorkflowNodeEntity } from './workflow-sub-canvas-IQzlYvPD.js';
8
+ export { a as WorkflowSubCanvas } from './workflow-sub-canvas-IQzlYvPD.js';
9
9
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
10
10
  import { DisposableCollection, IPoint, Disposable, Rectangle } from '@flowgram.ai/utils';
11
11
  export { compose, composeAsync, delay } from '@flowgram.ai/utils';
@@ -17,6 +17,10 @@ export { WorkflowEdgeJSON } from './typings/workflow-edge.js';
17
17
  export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './typings/workflow-registry.js';
18
18
  import '@flowgram.ai/form-core';
19
19
 
20
+ /**
21
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
22
+ * SPDX-License-Identifier: MIT
23
+ */
20
24
  declare enum WorkflowCommands {
21
25
  DELETE_NODES = "DELETE_NODES",
22
26
  COPY_NODES = "COPY_NODES",
@@ -73,7 +77,7 @@ declare class WorkflowDragService {
73
77
  /**
74
78
  * 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标
75
79
  */
76
- adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint, resetEmptyPos?: boolean): IPoint;
80
+ adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint): IPoint;
77
81
  /**
78
82
  * 注册位置调整
79
83
  */
@@ -88,7 +92,9 @@ declare class WorkflowDragService {
88
92
  */
89
93
  canDropToNode(params: {
90
94
  dragNodeType?: FlowNodeType;
95
+ dragNode?: WorkflowNodeEntity;
91
96
  dropNode?: WorkflowNodeEntity;
97
+ dropNodeType?: FlowNodeType;
92
98
  }): {
93
99
  allowDrop: boolean;
94
100
  message?: string;
@@ -181,6 +187,11 @@ declare class WorkflowOperationBaseServiceImpl extends FlowOperationBaseServiceI
181
187
  updateNodePosition(nodeOrId: FlowNodeEntityOrId, position: IPoint): void;
182
188
  }
183
189
 
190
+ /**
191
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
192
+ * SPDX-License-Identifier: MIT
193
+ */
194
+
184
195
  interface NodeRenderReturnType {
185
196
  id: string;
186
197
  type: string | number;
@@ -266,29 +277,66 @@ interface NodeRenderReturnType {
266
277
  toggleExpand(): void;
267
278
  }
268
279
 
280
+ /**
281
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
282
+ * SPDX-License-Identifier: MIT
283
+ */
284
+
269
285
  declare function useNodeRender(nodeFromProps?: WorkflowNodeEntity): NodeRenderReturnType;
270
286
 
287
+ /**
288
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
289
+ * SPDX-License-Identifier: MIT
290
+ */
271
291
  /**
272
292
  * 获取当前渲染的 dom 节点
273
293
  */
274
294
  declare function useCurrentDomNode(): HTMLDivElement;
275
295
 
296
+ /**
297
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
298
+ * SPDX-License-Identifier: MIT
299
+ */
300
+
276
301
  /**
277
302
  * 获取当前节点
278
303
  */
279
304
  declare function useCurrentEntity(): WorkflowNodeEntity;
280
305
 
306
+ /**
307
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
308
+ * SPDX-License-Identifier: MIT
309
+ */
310
+
281
311
  declare function useWorkflowDocument(): WorkflowDocument;
282
312
 
313
+ /**
314
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
315
+ * SPDX-License-Identifier: MIT
316
+ */
283
317
  /**
284
318
  * 获取 readonly 状态
285
319
  */
286
320
  declare function usePlaygroundReadonlyState(listenChange?: boolean): boolean;
287
321
 
322
+ /**
323
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
324
+ * SPDX-License-Identifier: MIT
325
+ */
288
326
  declare function nanoid(n?: number): string;
289
327
 
328
+ /**
329
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
330
+ * SPDX-License-Identifier: MIT
331
+ */
332
+
290
333
  declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise<void>;
291
334
 
335
+ /**
336
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
337
+ * SPDX-License-Identifier: MIT
338
+ */
339
+
292
340
  /**
293
341
  * 获取没有碰撞的位置
294
342
  * 距离很小时,xy 各偏移 30
@@ -296,6 +344,10 @@ declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfi
296
344
  */
297
345
  declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint;
298
346
 
347
+ /**
348
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
349
+ * SPDX-License-Identifier: MIT
350
+ */
299
351
  declare enum EditorCursorState {
300
352
  GRAB = "GRAB",
301
353
  SELECT = "SELECT"
@@ -307,6 +359,11 @@ declare enum InteractiveType {
307
359
  PAD = "PAD"
308
360
  }
309
361
 
362
+ /**
363
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
364
+ * SPDX-License-Identifier: MIT
365
+ */
366
+
310
367
  /**
311
368
  * 节点的点位信息
312
369
  * portsData 只监听点位的数目和类型,不监听点位的 position 变化
@@ -388,6 +445,11 @@ declare class WorkflowNodePortsData extends EntityData {
388
445
  protected updatePortEntity(portInfo: WorkflowPort): WorkflowPortEntity;
389
446
  }
390
447
 
448
+ /**
449
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
450
+ * SPDX-License-Identifier: MIT
451
+ */
452
+
391
453
  interface WorkflowNodeLines {
392
454
  inputLines: WorkflowLineEntity[];
393
455
  outputLines: WorkflowLineEntity[];
@@ -428,6 +490,11 @@ declare class WorkflowNodeLinesData extends EntityData<WorkflowNodeLines> {
428
490
  removeLine(line: WorkflowLineEntity): void;
429
491
  }
430
492
 
493
+ /**
494
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
495
+ * SPDX-License-Identifier: MIT
496
+ */
497
+
431
498
  interface WorkflowLineRenderDataSchema {
432
499
  version: string;
433
500
  contributions: Map<LineRenderType, WorkflowLineRenderContribution>;
@@ -459,8 +526,18 @@ declare class WorkflowLineRenderData extends EntityData<WorkflowLineRenderDataSc
459
526
  private registerContribution;
460
527
  }
461
528
 
529
+ /**
530
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
531
+ * SPDX-License-Identifier: MIT
532
+ */
533
+
462
534
  declare const WorkflowDocumentContainerModule: ContainerModule;
463
535
 
536
+ /**
537
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
538
+ * SPDX-License-Identifier: MIT
539
+ */
540
+
464
541
  interface StraightData {
465
542
  points: IPoint[];
466
543
  path: string;
package/dist/index.js CHANGED
@@ -735,6 +735,7 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
735
735
  super(opts);
736
736
  this._processing = false;
737
737
  this._hasError = false;
738
+ this.stackIndex = 0;
738
739
  /**
739
740
  * 线条数据
740
741
  */
@@ -1551,7 +1552,8 @@ var WorkflowLinesManager = class {
1551
1552
  const allPorts = this.entityManager.getEntities(WorkflowPortEntity).filter((port) => port.node.flowNodeType !== "root");
1552
1553
  const targetPort = allPorts.find((port) => port.isHovered(pos.x, pos.y));
1553
1554
  if (targetPort) {
1554
- const targetNode = this.document.getAllNodes().slice().reverse().filter((node) => targetPort.node?.parent?.id !== node.id).find((node) => node.getData(import_core12.TransformData).contains(pos.x, pos.y));
1555
+ const containNodes = this.getContainNodesFromMousePos(pos);
1556
+ const targetNode = (0, import_lodash_es3.last)(containNodes);
1555
1557
  if (targetNode && targetNode !== targetPort.node) {
1556
1558
  return;
1557
1559
  }
@@ -1563,16 +1565,8 @@ var WorkflowLinesManager = class {
1563
1565
  * @param pos - 鼠标位置
1564
1566
  */
1565
1567
  getNodeFromMousePos(pos) {
1566
- const allNodes = this.document.getAllNodes().sort((a, b) => this.getNodeIndex(a) - this.getNodeIndex(b));
1567
- const containNodes = [];
1568
1568
  const { selection } = this.selectService;
1569
- const zoom = this.entityManager.getEntity(import_core12.PlaygroundConfigEntity)?.config?.zoom || 1;
1570
- allNodes.forEach((node) => {
1571
- const { bounds } = node.getData(import_document5.FlowNodeTransformData);
1572
- if (bounds.clone().pad(4 / zoom).contains(pos.x, pos.y)) {
1573
- containNodes.push(node);
1574
- }
1575
- });
1569
+ const containNodes = this.getContainNodesFromMousePos(pos);
1576
1570
  if (selection?.length) {
1577
1571
  const filteredNodes = containNodes.filter(
1578
1572
  (node) => selection.some((_node) => node.id === _node.id)
@@ -1590,6 +1584,18 @@ var WorkflowLinesManager = class {
1590
1584
  registerData(line) {
1591
1585
  line.addData(WorkflowLineRenderData);
1592
1586
  }
1587
+ /** 获取鼠标坐标位置的所有节点(stackIndex 从小到大排序) */
1588
+ getContainNodesFromMousePos(pos) {
1589
+ const allNodes = this.document.getAllNodes().sort((a, b) => this.getNodeIndex(a) - this.getNodeIndex(b));
1590
+ const zoom = this.entityManager.getEntity(import_core12.PlaygroundConfigEntity)?.config?.zoom || 1;
1591
+ const containNodes = allNodes.map((node) => {
1592
+ const { bounds } = node.getData(import_document5.FlowNodeTransformData);
1593
+ if (bounds.clone().pad(4 / zoom).contains(pos.x, pos.y)) {
1594
+ return node;
1595
+ }
1596
+ }).filter(Boolean);
1597
+ return containNodes;
1598
+ }
1593
1599
  getNodeIndex(node) {
1594
1600
  const nodeRenderData = node.getData(import_document5.FlowNodeRenderData);
1595
1601
  return nodeRenderData.stackIndex;
@@ -2528,6 +2534,7 @@ var WorkflowDragService = class {
2528
2534
  const dropNode = this._dropNode;
2529
2535
  const { allowDrop } = this.canDropToNode({
2530
2536
  dragNodeType: type,
2537
+ dropNodeType: dropNode?.flowNodeType,
2531
2538
  dropNode
2532
2539
  });
2533
2540
  const dragNode = allowDrop ? await this.dropCard(type, e, data, dropNode) : void 0;
@@ -2552,7 +2559,7 @@ var WorkflowDragService = class {
2552
2559
  /**
2553
2560
  * 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标
2554
2561
  */
2555
- adjustSubNodePosition(subNodeType, containerNode, mousePos, resetEmptyPos = true) {
2562
+ adjustSubNodePosition(subNodeType, containerNode, mousePos) {
2556
2563
  if (!mousePos) {
2557
2564
  return { x: 0, y: 0 };
2558
2565
  }
@@ -2561,16 +2568,16 @@ var WorkflowDragService = class {
2561
2568
  }
2562
2569
  const isParentEmpty = !containerNode.children || containerNode.children.length === 0;
2563
2570
  const parentPadding = this.document.layout.getPadding(containerNode);
2564
- const parentTransform = containerNode.getData(import_core15.TransformData);
2565
- if (isParentEmpty && resetEmptyPos) {
2571
+ const containerWorldTransform = containerNode.transform.transform.worldTransform;
2572
+ if (isParentEmpty) {
2566
2573
  return {
2567
2574
  x: 0,
2568
2575
  y: parentPadding.top
2569
2576
  };
2570
2577
  } else {
2571
2578
  return {
2572
- x: mousePos.x - parentTransform.position.x,
2573
- y: mousePos.y - parentTransform.position.y
2579
+ x: mousePos.x - containerWorldTransform.tx,
2580
+ y: mousePos.y - containerWorldTransform.ty
2574
2581
  };
2575
2582
  }
2576
2583
  }
@@ -2587,7 +2594,20 @@ var WorkflowDragService = class {
2587
2594
  * 判断是否可以放置节点
2588
2595
  */
2589
2596
  canDropToNode(params) {
2597
+ const { canDropToNode } = this.document.options;
2590
2598
  const { dragNodeType, dropNode } = params;
2599
+ if (canDropToNode) {
2600
+ const result = canDropToNode(params);
2601
+ if (result) {
2602
+ return {
2603
+ allowDrop: true,
2604
+ dropNode
2605
+ };
2606
+ }
2607
+ return {
2608
+ allowDrop: false
2609
+ };
2610
+ }
2591
2611
  if (!dragNodeType) {
2592
2612
  return {
2593
2613
  allowDrop: false,