@flowgram.ai/free-layout-core 0.4.15 → 0.4.17
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/index.js +75 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +47 -183
- package/dist/index.d.ts +47 -183
- package/dist/index.js +75 -16
- package/dist/index.js.map +1 -1
- package/dist/typings/index.d.mts +4 -5
- package/dist/typings/index.d.ts +4 -5
- package/dist/typings/workflow-drag.d.mts +1 -2
- package/dist/typings/workflow-drag.d.ts +1 -2
- package/dist/typings/workflow-json.d.mts +3 -4
- package/dist/typings/workflow-json.d.ts +3 -4
- package/dist/typings/workflow-line.d.mts +3 -4
- package/dist/typings/workflow-line.d.ts +3 -4
- package/dist/typings/workflow-node.d.mts +2 -3
- package/dist/typings/workflow-node.d.ts +2 -3
- package/dist/typings/workflow-registry.d.mts +3 -4
- package/dist/typings/workflow-registry.d.ts +3 -4
- package/dist/typings/workflow-sub-canvas.d.mts +6 -1
- package/dist/typings/workflow-sub-canvas.d.ts +6 -1
- package/dist/{workflow-line-entity-IbhMSbBs.d.mts → workflow-node-entity-DtPEYn6-.d.mts} +377 -212
- package/dist/{workflow-line-entity-DcecHiNc.d.ts → workflow-node-entity-GyY_PHY6.d.ts} +377 -212
- package/package.json +9 -9
- package/dist/workflow-sub-canvas-IQzlYvPD.d.mts +0 -25
- package/dist/workflow-sub-canvas-IQzlYvPD.d.ts +0 -25
|
@@ -1,11 +1,34 @@
|
|
|
1
|
+
import { FlowNodeJSON, FlowNodeMeta, FlowDocumentOptions, FlowNodeType, FlowLayout, FlowDocumentProvider, FlowDocument, FlowNodeEntity, AddNodeData } from '@flowgram.ai/document';
|
|
2
|
+
import { EntityManager, SelectionService, Playground, Entity, PlaygroundConfigEntity, PlaygroundContext, PlaygroundDragEvent, PlaygroundDrag, EntityOpts, EntityData } from '@flowgram.ai/core';
|
|
1
3
|
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
2
|
-
import { IPoint,
|
|
3
|
-
import
|
|
4
|
-
import { FlowNodeJSON, FlowNodeMeta, FlowNodeEntity, FlowDocumentOptions, FlowNodeType, FlowLayout, FlowDocumentProvider, FlowDocument, AddNodeData } from '@flowgram.ai/document';
|
|
5
|
-
import { W as WorkflowNodeEntity, a as WorkflowSubCanvas } from './workflow-sub-canvas-IQzlYvPD.mjs';
|
|
4
|
+
import { Rectangle, IPoint, Emitter, PositionSchema, Event, PaddingSchema, SizeSchema, ScrollSchema, DisposableCollection } from '@flowgram.ai/utils';
|
|
5
|
+
import React$1 from 'react';
|
|
6
6
|
import { NodeEngineContext } from '@flowgram.ai/form-core';
|
|
7
7
|
import { WorkflowEdgeJSON } from './typings/workflow-edge.mjs';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
11
|
+
* SPDX-License-Identifier: MIT
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type WorkflowPortType = 'input' | 'output';
|
|
15
|
+
declare const getPortEntityId: (node: WorkflowNodeEntity, portType: WorkflowPortType, portID?: string | number) => string;
|
|
16
|
+
declare const WORKFLOW_LINE_ENTITY = "WorkflowLineEntity";
|
|
17
|
+
declare function domReactToBounds(react: DOMRect): Rectangle;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
21
|
+
* SPDX-License-Identifier: MIT
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 子画布配置
|
|
26
|
+
*/
|
|
27
|
+
type WorkflowSubCanvas = {
|
|
28
|
+
isCanvas: boolean;
|
|
29
|
+
parentNode: WorkflowNodeEntity;
|
|
30
|
+
canvasNode: WorkflowNodeEntity;
|
|
31
|
+
};
|
|
9
32
|
|
|
10
33
|
/**
|
|
11
34
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -107,105 +130,6 @@ interface WorkflowContentChangeEvent {
|
|
|
107
130
|
entity: WorkflowNodeEntity | WorkflowLineEntity;
|
|
108
131
|
}
|
|
109
132
|
|
|
110
|
-
/**
|
|
111
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
112
|
-
* SPDX-License-Identifier: MIT
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
declare enum LineType {
|
|
116
|
-
BEZIER = 0,// 贝塞尔曲线
|
|
117
|
-
LINE_CHART = 1,// 折叠线
|
|
118
|
-
STRAIGHT = 2
|
|
119
|
-
}
|
|
120
|
-
type LineRenderType = LineType | string;
|
|
121
|
-
type LinePointLocation = 'left' | 'top' | 'right' | 'bottom';
|
|
122
|
-
interface LinePoint {
|
|
123
|
-
x: number;
|
|
124
|
-
y: number;
|
|
125
|
-
location: LinePointLocation;
|
|
126
|
-
}
|
|
127
|
-
interface LinePosition {
|
|
128
|
-
from: LinePoint;
|
|
129
|
-
to: LinePoint;
|
|
130
|
-
}
|
|
131
|
-
interface LineColor {
|
|
132
|
-
hidden: string;
|
|
133
|
-
default: string;
|
|
134
|
-
drawing: string;
|
|
135
|
-
hovered: string;
|
|
136
|
-
selected: string;
|
|
137
|
-
error: string;
|
|
138
|
-
flowing: string;
|
|
139
|
-
}
|
|
140
|
-
declare enum LineColors {
|
|
141
|
-
HIDDEN = "var(--g-workflow-line-color-hidden,transparent)",// 隐藏线条
|
|
142
|
-
DEFUALT = "var(--g-workflow-line-color-default,#4d53e8)",
|
|
143
|
-
DRAWING = "var(--g-workflow-line-color-drawing, #5DD6E3)",// '#b5bbf8', // '#9197F1',
|
|
144
|
-
HOVER = "var(--g-workflow-line-color-hover,#37d0ff)",
|
|
145
|
-
SELECTED = "var(--g-workflow-line-color-selected,#37d0ff)",
|
|
146
|
-
ERROR = "var(--g-workflow-line-color-error,red)",
|
|
147
|
-
FLOWING = "var(--g-workflow-line-color-flowing,#4d53e8)"
|
|
148
|
-
}
|
|
149
|
-
interface LineCenterPoint {
|
|
150
|
-
x: number;
|
|
151
|
-
y: number;
|
|
152
|
-
labelX: number;
|
|
153
|
-
labelY: number;
|
|
154
|
-
}
|
|
155
|
-
interface WorkflowLineRenderContribution {
|
|
156
|
-
entity: WorkflowLineEntity;
|
|
157
|
-
path: string;
|
|
158
|
-
center?: LineCenterPoint;
|
|
159
|
-
bounds: Rectangle;
|
|
160
|
-
update: (params: {
|
|
161
|
-
fromPos: LinePoint;
|
|
162
|
-
toPos: LinePoint;
|
|
163
|
-
}) => void;
|
|
164
|
-
calcDistance: (pos: IPoint) => number;
|
|
165
|
-
}
|
|
166
|
-
type WorkflowLineRenderContributionFactory = (new (entity: WorkflowLineEntity) => WorkflowLineRenderContribution) & {
|
|
167
|
-
type: LineRenderType;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
172
|
-
* SPDX-License-Identifier: MIT
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
|
-
interface LineEventProps {
|
|
176
|
-
type: 'onDrag' | 'onDragEnd';
|
|
177
|
-
onDragNodeId?: string;
|
|
178
|
-
event?: MouseEvent;
|
|
179
|
-
}
|
|
180
|
-
interface INodesDragEvent {
|
|
181
|
-
type: string;
|
|
182
|
-
nodes: FlowNodeEntity[];
|
|
183
|
-
startPositions: PositionSchema[];
|
|
184
|
-
dragEvent: PlaygroundDragEvent;
|
|
185
|
-
triggerEvent: MouseEvent | React$1.MouseEvent;
|
|
186
|
-
dragger: PlaygroundDrag;
|
|
187
|
-
}
|
|
188
|
-
interface NodesDragStartEvent extends INodesDragEvent {
|
|
189
|
-
type: 'onDragStart';
|
|
190
|
-
}
|
|
191
|
-
interface NodesDragEndEvent extends INodesDragEvent {
|
|
192
|
-
type: 'onDragEnd';
|
|
193
|
-
}
|
|
194
|
-
interface NodesDraggingEvent extends INodesDragEvent {
|
|
195
|
-
type: 'onDragging';
|
|
196
|
-
positions: PositionSchema[];
|
|
197
|
-
}
|
|
198
|
-
type NodesDragEvent = NodesDragStartEvent | NodesDraggingEvent | NodesDragEndEvent;
|
|
199
|
-
type onDragLineEndParams = {
|
|
200
|
-
fromPort: WorkflowPortEntity;
|
|
201
|
-
toPort?: WorkflowPortEntity;
|
|
202
|
-
mousePos: PositionSchema;
|
|
203
|
-
line?: WorkflowLineEntity;
|
|
204
|
-
originLine?: WorkflowLineEntity;
|
|
205
|
-
event: PlaygroundDragEvent;
|
|
206
|
-
};
|
|
207
|
-
type OnDragLineEnd = (params: onDragLineEndParams) => Promise<void>;
|
|
208
|
-
|
|
209
133
|
/**
|
|
210
134
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
211
135
|
* SPDX-License-Identifier: MIT
|
|
@@ -528,6 +452,105 @@ declare class WorkflowDocument extends FlowDocument {
|
|
|
528
452
|
private createWorkflowLine;
|
|
529
453
|
}
|
|
530
454
|
|
|
455
|
+
/**
|
|
456
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
457
|
+
* SPDX-License-Identifier: MIT
|
|
458
|
+
*/
|
|
459
|
+
|
|
460
|
+
declare enum LineType {
|
|
461
|
+
BEZIER = 0,// 贝塞尔曲线
|
|
462
|
+
LINE_CHART = 1,// 折叠线
|
|
463
|
+
STRAIGHT = 2
|
|
464
|
+
}
|
|
465
|
+
type LineRenderType = LineType | string;
|
|
466
|
+
type LinePointLocation = 'left' | 'top' | 'right' | 'bottom';
|
|
467
|
+
interface LinePoint {
|
|
468
|
+
x: number;
|
|
469
|
+
y: number;
|
|
470
|
+
location: LinePointLocation;
|
|
471
|
+
}
|
|
472
|
+
interface LinePosition {
|
|
473
|
+
from: LinePoint;
|
|
474
|
+
to: LinePoint;
|
|
475
|
+
}
|
|
476
|
+
interface LineColor {
|
|
477
|
+
hidden: string;
|
|
478
|
+
default: string;
|
|
479
|
+
drawing: string;
|
|
480
|
+
hovered: string;
|
|
481
|
+
selected: string;
|
|
482
|
+
error: string;
|
|
483
|
+
flowing: string;
|
|
484
|
+
}
|
|
485
|
+
declare enum LineColors {
|
|
486
|
+
HIDDEN = "var(--g-workflow-line-color-hidden,transparent)",// 隐藏线条
|
|
487
|
+
DEFUALT = "var(--g-workflow-line-color-default,#4d53e8)",
|
|
488
|
+
DRAWING = "var(--g-workflow-line-color-drawing, #5DD6E3)",// '#b5bbf8', // '#9197F1',
|
|
489
|
+
HOVER = "var(--g-workflow-line-color-hover,#37d0ff)",
|
|
490
|
+
SELECTED = "var(--g-workflow-line-color-selected,#37d0ff)",
|
|
491
|
+
ERROR = "var(--g-workflow-line-color-error,red)",
|
|
492
|
+
FLOWING = "var(--g-workflow-line-color-flowing,#4d53e8)"
|
|
493
|
+
}
|
|
494
|
+
interface LineCenterPoint {
|
|
495
|
+
x: number;
|
|
496
|
+
y: number;
|
|
497
|
+
labelX: number;
|
|
498
|
+
labelY: number;
|
|
499
|
+
}
|
|
500
|
+
interface WorkflowLineRenderContribution {
|
|
501
|
+
entity: WorkflowLineEntity;
|
|
502
|
+
path: string;
|
|
503
|
+
center?: LineCenterPoint;
|
|
504
|
+
bounds: Rectangle;
|
|
505
|
+
update: (params: {
|
|
506
|
+
fromPos: LinePoint;
|
|
507
|
+
toPos: LinePoint;
|
|
508
|
+
}) => void;
|
|
509
|
+
calcDistance: (pos: IPoint) => number;
|
|
510
|
+
}
|
|
511
|
+
type WorkflowLineRenderContributionFactory = (new (entity: WorkflowLineEntity) => WorkflowLineRenderContribution) & {
|
|
512
|
+
type: LineRenderType;
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
517
|
+
* SPDX-License-Identifier: MIT
|
|
518
|
+
*/
|
|
519
|
+
|
|
520
|
+
interface LineEventProps {
|
|
521
|
+
type: 'onDrag' | 'onDragEnd';
|
|
522
|
+
onDragNodeId?: string;
|
|
523
|
+
event?: MouseEvent;
|
|
524
|
+
}
|
|
525
|
+
interface INodesDragEvent {
|
|
526
|
+
type: string;
|
|
527
|
+
nodes: FlowNodeEntity[];
|
|
528
|
+
startPositions: PositionSchema[];
|
|
529
|
+
dragEvent: PlaygroundDragEvent;
|
|
530
|
+
triggerEvent: MouseEvent | React$1.MouseEvent;
|
|
531
|
+
dragger: PlaygroundDrag;
|
|
532
|
+
}
|
|
533
|
+
interface NodesDragStartEvent extends INodesDragEvent {
|
|
534
|
+
type: 'onDragStart';
|
|
535
|
+
}
|
|
536
|
+
interface NodesDragEndEvent extends INodesDragEvent {
|
|
537
|
+
type: 'onDragEnd';
|
|
538
|
+
}
|
|
539
|
+
interface NodesDraggingEvent extends INodesDragEvent {
|
|
540
|
+
type: 'onDragging';
|
|
541
|
+
positions: PositionSchema[];
|
|
542
|
+
}
|
|
543
|
+
type NodesDragEvent = NodesDragStartEvent | NodesDraggingEvent | NodesDragEndEvent;
|
|
544
|
+
type onDragLineEndParams = {
|
|
545
|
+
fromPort: WorkflowPortEntity;
|
|
546
|
+
toPort?: WorkflowPortEntity;
|
|
547
|
+
mousePos: PositionSchema;
|
|
548
|
+
line?: WorkflowLineEntity;
|
|
549
|
+
originLine?: WorkflowLineEntity;
|
|
550
|
+
event: PlaygroundDragEvent;
|
|
551
|
+
};
|
|
552
|
+
type OnDragLineEnd = (params: onDragLineEndParams) => Promise<void>;
|
|
553
|
+
|
|
531
554
|
/**
|
|
532
555
|
* 线条管理
|
|
533
556
|
*/
|
|
@@ -608,113 +631,6 @@ declare class WorkflowLinesManager {
|
|
|
608
631
|
private getNodeIndex;
|
|
609
632
|
}
|
|
610
633
|
|
|
611
|
-
/**
|
|
612
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
613
|
-
* SPDX-License-Identifier: MIT
|
|
614
|
-
*/
|
|
615
|
-
|
|
616
|
-
type WorkflowPortType = 'input' | 'output';
|
|
617
|
-
declare const getPortEntityId: (node: WorkflowNodeEntity, portType: WorkflowPortType, portID?: string | number) => string;
|
|
618
|
-
declare const WORKFLOW_LINE_ENTITY = "WorkflowLineEntity";
|
|
619
|
-
declare function domReactToBounds(react: DOMRect): Rectangle;
|
|
620
|
-
|
|
621
|
-
declare const PORT_SIZE = 24;
|
|
622
|
-
interface WorkflowPort {
|
|
623
|
-
/**
|
|
624
|
-
* 没有代表 默认连接点,默认 input 类型 为最左边中心,output 类型为最右边中心
|
|
625
|
-
*/
|
|
626
|
-
portID?: string | number;
|
|
627
|
-
/**
|
|
628
|
-
* 输入或者输出点
|
|
629
|
-
*/
|
|
630
|
-
type: WorkflowPortType;
|
|
631
|
-
/**
|
|
632
|
-
* 端口位置
|
|
633
|
-
*/
|
|
634
|
-
location?: LinePointLocation;
|
|
635
|
-
/**
|
|
636
|
-
* 端口热区大小
|
|
637
|
-
*/
|
|
638
|
-
size?: {
|
|
639
|
-
width: number;
|
|
640
|
-
height: number;
|
|
641
|
-
};
|
|
642
|
-
/**
|
|
643
|
-
* 相对于 position 的偏移
|
|
644
|
-
*/
|
|
645
|
-
offset?: IPoint;
|
|
646
|
-
/**
|
|
647
|
-
* 禁用端口
|
|
648
|
-
*/
|
|
649
|
-
disabled?: boolean;
|
|
650
|
-
/**
|
|
651
|
-
* 将点位渲染到该父节点上
|
|
652
|
-
*/
|
|
653
|
-
targetElement?: HTMLElement;
|
|
654
|
-
}
|
|
655
|
-
type WorkflowPorts = WorkflowPort[];
|
|
656
|
-
interface WorkflowPortEntityOpts extends EntityOpts, WorkflowPort {
|
|
657
|
-
/**
|
|
658
|
-
* port 属于哪个节点
|
|
659
|
-
*/
|
|
660
|
-
node: WorkflowNodeEntity;
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Port 抽象的 Entity
|
|
664
|
-
*/
|
|
665
|
-
declare class WorkflowPortEntity extends Entity<WorkflowPortEntityOpts> {
|
|
666
|
-
static type: string;
|
|
667
|
-
readonly node: WorkflowNodeEntity;
|
|
668
|
-
readonly portID: string | number;
|
|
669
|
-
readonly portType: WorkflowPortType;
|
|
670
|
-
private _disabled?;
|
|
671
|
-
private _hasError;
|
|
672
|
-
private _location?;
|
|
673
|
-
private _size?;
|
|
674
|
-
private _offset?;
|
|
675
|
-
protected readonly _onErrorChangedEmitter: Emitter<void>;
|
|
676
|
-
onErrorChanged: _flowgram_ai_utils.Event<void>;
|
|
677
|
-
targetElement?: HTMLElement;
|
|
678
|
-
static getPortEntityId(node: WorkflowNodeEntity, portType: WorkflowPortType, portID?: string | number): string;
|
|
679
|
-
get position(): LinePointLocation | undefined;
|
|
680
|
-
constructor(opts: WorkflowPortEntityOpts);
|
|
681
|
-
get hasError(): boolean;
|
|
682
|
-
set hasError(hasError: boolean);
|
|
683
|
-
validate(): void;
|
|
684
|
-
isErrorPort(): boolean;
|
|
685
|
-
get location(): LinePointLocation;
|
|
686
|
-
get point(): LinePoint;
|
|
687
|
-
/**
|
|
688
|
-
* 端口热区
|
|
689
|
-
*/
|
|
690
|
-
get bounds(): Rectangle;
|
|
691
|
-
isHovered(x: number, y: number): boolean;
|
|
692
|
-
/**
|
|
693
|
-
* 相对节点左上角的位置
|
|
694
|
-
*/
|
|
695
|
-
get relativePosition(): IPoint;
|
|
696
|
-
updateTargetElement(el?: HTMLElement): void;
|
|
697
|
-
/**
|
|
698
|
-
* 是否被禁用
|
|
699
|
-
*/
|
|
700
|
-
get disabled(): boolean;
|
|
701
|
-
/**
|
|
702
|
-
* 当前点位上连接的线条
|
|
703
|
-
* @deprecated use `availableLines` instead
|
|
704
|
-
*/
|
|
705
|
-
get lines(): WorkflowLineEntity[];
|
|
706
|
-
/**
|
|
707
|
-
* 当前有效的线条,不包含正在画的线条和隐藏的线条(这个出现在线条重连会先把原来的线条隐藏)
|
|
708
|
-
*/
|
|
709
|
-
get availableLines(): WorkflowLineEntity[];
|
|
710
|
-
/**
|
|
711
|
-
* 当前点位上连接的线条(包含 isDrawing === true 的线条)
|
|
712
|
-
*/
|
|
713
|
-
get allLines(): WorkflowLineEntity[];
|
|
714
|
-
update(data: Exclude<WorkflowPort, 'portID' | 'type'>): void;
|
|
715
|
-
dispose(): void;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
634
|
declare const LINE_HOVER_DISTANCE = 8;
|
|
719
635
|
declare const POINT_RADIUS = 10;
|
|
720
636
|
interface WorkflowLinePortInfo {
|
|
@@ -931,4 +847,253 @@ declare class WorkflowLineEntity extends Entity<WorkflowLineEntityOpts> {
|
|
|
931
847
|
fireRender(): void;
|
|
932
848
|
}
|
|
933
849
|
|
|
934
|
-
|
|
850
|
+
declare const PORT_SIZE = 24;
|
|
851
|
+
interface WorkflowPort {
|
|
852
|
+
/**
|
|
853
|
+
* 没有代表 默认连接点,默认 input 类型 为最左边中心,output 类型为最右边中心
|
|
854
|
+
*/
|
|
855
|
+
portID?: string | number;
|
|
856
|
+
/**
|
|
857
|
+
* 输入或者输出点
|
|
858
|
+
*/
|
|
859
|
+
type: WorkflowPortType;
|
|
860
|
+
/**
|
|
861
|
+
* 端口位置
|
|
862
|
+
*/
|
|
863
|
+
location?: LinePointLocation;
|
|
864
|
+
/**
|
|
865
|
+
* 端口热区大小
|
|
866
|
+
*/
|
|
867
|
+
size?: {
|
|
868
|
+
width: number;
|
|
869
|
+
height: number;
|
|
870
|
+
};
|
|
871
|
+
/**
|
|
872
|
+
* 相对于 position 的偏移
|
|
873
|
+
*/
|
|
874
|
+
offset?: IPoint;
|
|
875
|
+
/**
|
|
876
|
+
* 禁用端口
|
|
877
|
+
*/
|
|
878
|
+
disabled?: boolean;
|
|
879
|
+
/**
|
|
880
|
+
* 将点位渲染到该父节点上
|
|
881
|
+
*/
|
|
882
|
+
targetElement?: HTMLElement;
|
|
883
|
+
}
|
|
884
|
+
type WorkflowPorts = WorkflowPort[];
|
|
885
|
+
interface WorkflowPortEntityOpts extends EntityOpts, WorkflowPort {
|
|
886
|
+
/**
|
|
887
|
+
* port 属于哪个节点
|
|
888
|
+
*/
|
|
889
|
+
node: WorkflowNodeEntity;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Port 抽象的 Entity
|
|
893
|
+
*/
|
|
894
|
+
declare class WorkflowPortEntity extends Entity<WorkflowPortEntityOpts> {
|
|
895
|
+
static type: string;
|
|
896
|
+
readonly node: WorkflowNodeEntity;
|
|
897
|
+
readonly portID: string | number;
|
|
898
|
+
readonly portType: WorkflowPortType;
|
|
899
|
+
private _disabled?;
|
|
900
|
+
private _hasError;
|
|
901
|
+
private _location?;
|
|
902
|
+
private _size?;
|
|
903
|
+
private _offset?;
|
|
904
|
+
protected readonly _onErrorChangedEmitter: Emitter<void>;
|
|
905
|
+
onErrorChanged: _flowgram_ai_utils.Event<void>;
|
|
906
|
+
targetElement?: HTMLElement;
|
|
907
|
+
static getPortEntityId(node: WorkflowNodeEntity, portType: WorkflowPortType, portID?: string | number): string;
|
|
908
|
+
get position(): LinePointLocation | undefined;
|
|
909
|
+
constructor(opts: WorkflowPortEntityOpts);
|
|
910
|
+
get hasError(): boolean;
|
|
911
|
+
set hasError(hasError: boolean);
|
|
912
|
+
validate(): void;
|
|
913
|
+
isErrorPort(): boolean;
|
|
914
|
+
get location(): LinePointLocation;
|
|
915
|
+
get point(): LinePoint;
|
|
916
|
+
/**
|
|
917
|
+
* 端口热区
|
|
918
|
+
*/
|
|
919
|
+
get bounds(): Rectangle;
|
|
920
|
+
isHovered(x: number, y: number): boolean;
|
|
921
|
+
/**
|
|
922
|
+
* 相对节点左上角的位置
|
|
923
|
+
*/
|
|
924
|
+
get relativePosition(): IPoint;
|
|
925
|
+
updateTargetElement(el?: HTMLElement): void;
|
|
926
|
+
/**
|
|
927
|
+
* 是否被禁用
|
|
928
|
+
*/
|
|
929
|
+
get disabled(): boolean;
|
|
930
|
+
/**
|
|
931
|
+
* 当前点位上连接的线条
|
|
932
|
+
* @deprecated use `availableLines` instead
|
|
933
|
+
*/
|
|
934
|
+
get lines(): WorkflowLineEntity[];
|
|
935
|
+
/**
|
|
936
|
+
* 当前有效的线条,不包含正在画的线条和隐藏的线条(这个出现在线条重连会先把原来的线条隐藏)
|
|
937
|
+
*/
|
|
938
|
+
get availableLines(): WorkflowLineEntity[];
|
|
939
|
+
/**
|
|
940
|
+
* 当前点位上连接的线条(包含 isDrawing === true 的线条)
|
|
941
|
+
*/
|
|
942
|
+
get allLines(): WorkflowLineEntity[];
|
|
943
|
+
update(data: Exclude<WorkflowPort, 'portID' | 'type'>): void;
|
|
944
|
+
dispose(): void;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
949
|
+
* SPDX-License-Identifier: MIT
|
|
950
|
+
*/
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* 节点的点位信息
|
|
954
|
+
* portsData 只监听点位的数目和类型,不监听点位的 position 变化
|
|
955
|
+
*/
|
|
956
|
+
declare class WorkflowNodePortsData extends EntityData {
|
|
957
|
+
static readonly type = "WorkflowNodePortsData";
|
|
958
|
+
readonly entity: WorkflowNodeEntity;
|
|
959
|
+
/** 静态的 ports 数据 */
|
|
960
|
+
protected _staticPorts: WorkflowPorts;
|
|
961
|
+
/** 存储 port 实体的 id,用于判断 port 是否存在 */
|
|
962
|
+
protected _portIDSet: Set<string>;
|
|
963
|
+
/** 上一次的 ports 数据,用于判断 ports 是否发生变化 */
|
|
964
|
+
protected _prePorts: WorkflowPorts;
|
|
965
|
+
constructor(entity: WorkflowNodeEntity);
|
|
966
|
+
getDefaultData(): any;
|
|
967
|
+
/**
|
|
968
|
+
* Update all ports data, includes static ports and dynamic ports
|
|
969
|
+
* @param ports
|
|
970
|
+
*/
|
|
971
|
+
updateAllPorts(ports?: WorkflowPorts): void;
|
|
972
|
+
/**
|
|
973
|
+
* @deprecated use `updateAllPorts` instead
|
|
974
|
+
*/
|
|
975
|
+
updateStaticPorts(ports: WorkflowPorts): void;
|
|
976
|
+
/**
|
|
977
|
+
* 动态计算点位,通过 dom 的 data-port-key
|
|
978
|
+
*/
|
|
979
|
+
updateDynamicPorts(): void;
|
|
980
|
+
/**
|
|
981
|
+
* 根据 key 获取 port 实体
|
|
982
|
+
*/
|
|
983
|
+
getPortEntityByKey(portType: WorkflowPortType, portKey?: string | number): WorkflowPortEntity;
|
|
984
|
+
/**
|
|
985
|
+
* 更新 ports 数据
|
|
986
|
+
*/
|
|
987
|
+
protected updatePorts(ports: WorkflowPorts): void;
|
|
988
|
+
/**
|
|
989
|
+
* 获取所有 port entities
|
|
990
|
+
*/
|
|
991
|
+
get allPorts(): WorkflowPortEntity[];
|
|
992
|
+
/**
|
|
993
|
+
* 获取输入点位
|
|
994
|
+
*/
|
|
995
|
+
get inputPorts(): WorkflowPortEntity[];
|
|
996
|
+
/**
|
|
997
|
+
* 获取输出点位
|
|
998
|
+
*/
|
|
999
|
+
get outputPorts(): WorkflowPortEntity[];
|
|
1000
|
+
/**
|
|
1001
|
+
* 获取输入点位置
|
|
1002
|
+
*/
|
|
1003
|
+
get inputPoints(): LinePoint[];
|
|
1004
|
+
/**
|
|
1005
|
+
* 获取输出点位置
|
|
1006
|
+
*/
|
|
1007
|
+
get outputPoints(): LinePoint[];
|
|
1008
|
+
/**
|
|
1009
|
+
* 根据 key 获取 输入点位置
|
|
1010
|
+
*/
|
|
1011
|
+
getInputPoint(key?: string | number): LinePoint;
|
|
1012
|
+
/**
|
|
1013
|
+
* 根据 key 获取输出点位置
|
|
1014
|
+
*/
|
|
1015
|
+
getOutputPoint(key?: string | number): LinePoint;
|
|
1016
|
+
/**
|
|
1017
|
+
* 获取 port 实体
|
|
1018
|
+
*/
|
|
1019
|
+
protected getPortEntity(portId: string): WorkflowPortEntity | undefined;
|
|
1020
|
+
/**
|
|
1021
|
+
* 拼接 port 实体的 id
|
|
1022
|
+
*/
|
|
1023
|
+
protected getPortId(portType: WorkflowPortType, portKey?: string | number): string;
|
|
1024
|
+
/**
|
|
1025
|
+
* 创建 port 实体
|
|
1026
|
+
*/
|
|
1027
|
+
protected createPortEntity(portInfo: WorkflowPort): WorkflowPortEntity;
|
|
1028
|
+
/**
|
|
1029
|
+
* 获取或创建 port 实体
|
|
1030
|
+
*/
|
|
1031
|
+
protected getOrCreatePortEntity(portInfo: WorkflowPort): WorkflowPortEntity;
|
|
1032
|
+
/**
|
|
1033
|
+
* 更新 port 实体
|
|
1034
|
+
*/
|
|
1035
|
+
protected updatePortEntity(portInfo: WorkflowPort): WorkflowPortEntity;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
1040
|
+
* SPDX-License-Identifier: MIT
|
|
1041
|
+
*/
|
|
1042
|
+
|
|
1043
|
+
interface WorkflowNodeLines {
|
|
1044
|
+
inputLines: WorkflowLineEntity[];
|
|
1045
|
+
outputLines: WorkflowLineEntity[];
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* 节点的关联的线条
|
|
1049
|
+
*/
|
|
1050
|
+
declare class WorkflowNodeLinesData extends EntityData<WorkflowNodeLines> {
|
|
1051
|
+
static type: string;
|
|
1052
|
+
entity: WorkflowNodeEntity;
|
|
1053
|
+
getDefaultData(): WorkflowNodeLines;
|
|
1054
|
+
constructor(entity: WorkflowNodeEntity);
|
|
1055
|
+
/**
|
|
1056
|
+
* 输入线条
|
|
1057
|
+
*/
|
|
1058
|
+
get inputLines(): WorkflowLineEntity[];
|
|
1059
|
+
/**
|
|
1060
|
+
* 输出线条
|
|
1061
|
+
*/
|
|
1062
|
+
get outputLines(): WorkflowLineEntity[];
|
|
1063
|
+
get allLines(): WorkflowLineEntity[];
|
|
1064
|
+
get availableLines(): WorkflowLineEntity[];
|
|
1065
|
+
/**
|
|
1066
|
+
* 输入节点
|
|
1067
|
+
*/
|
|
1068
|
+
get inputNodes(): WorkflowNodeEntity[];
|
|
1069
|
+
/**
|
|
1070
|
+
* 所有输入节点
|
|
1071
|
+
*/
|
|
1072
|
+
get allInputNodes(): WorkflowNodeEntity[];
|
|
1073
|
+
/**
|
|
1074
|
+
* 输出节点
|
|
1075
|
+
*/
|
|
1076
|
+
get outputNodes(): WorkflowNodeEntity[];
|
|
1077
|
+
/**
|
|
1078
|
+
* 输入输出节点
|
|
1079
|
+
*/
|
|
1080
|
+
get allOutputNodes(): WorkflowNodeEntity[];
|
|
1081
|
+
addLine(line: WorkflowLineEntity): void;
|
|
1082
|
+
removeLine(line: WorkflowLineEntity): void;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
1087
|
+
* SPDX-License-Identifier: MIT
|
|
1088
|
+
*/
|
|
1089
|
+
|
|
1090
|
+
declare module '@flowgram.ai/document' {
|
|
1091
|
+
interface FlowNodeEntity {
|
|
1092
|
+
lines: WorkflowNodeLinesData;
|
|
1093
|
+
ports: WorkflowNodePortsData;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
type WorkflowNodeEntity = FlowNodeEntity;
|
|
1097
|
+
declare const WorkflowNodeEntity: typeof FlowNodeEntity;
|
|
1098
|
+
|
|
1099
|
+
export { type WorkflowSubCanvas as A, type NodesDragStartEvent as B, type NodesDragEndEvent as C, type NodesDraggingEvent as D, type onDragLineEndParams as E, LINE_HOVER_DISTANCE as F, type WorkflowLinePortInfo as G, type WorkflowLineEntityOpts as H, type WorkflowLineInfo as I, type WorkflowLineUIState as J, PORT_SIZE as K, type LineEventProps as L, type WorkflowPort as M, type NodesDragEvent as N, type OnDragLineEnd as O, POINT_RADIUS as P, type WorkflowPorts as Q, type WorkflowPortEntityOpts as R, WorkflowNodePortsData as S, type WorkflowNodeLines as T, WorkflowNodeLinesData as U, type WorkflowEntityHoverable as V, WorkflowHoverService as W, type HoverPosition as X, type WorkfloEntityHoverable as Y, WorkflowDocumentProvider as Z, WorkflowDocumentOptionsDefault as _, WorkflowDocument as a, WorkflowLinesManager as b, WorkflowSelectService as c, WorkflowDocumentOptions as d, type WorkflowNodeJSON as e, WorkflowNodeEntity as f, WorkflowPortEntity as g, WorkflowLineEntity as h, type LineRenderType as i, type WorkflowLineRenderContribution as j, type LinePosition as k, type LineCenterPoint as l, type WorkflowJSON as m, type WorkflowPortType as n, getPortEntityId as o, WORKFLOW_LINE_ENTITY as p, domReactToBounds as q, WorkflowContentChangeType as r, type WorkflowContentChangeEvent as s, type WorkflowNodeMeta as t, LineType as u, type LinePointLocation as v, type LinePoint as w, type LineColor as x, LineColors as y, type WorkflowLineRenderContributionFactory as z };
|