@flowgram.ai/free-layout-core 0.2.21 → 0.2.23
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 +17 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/typings/index.d.mts +1 -1
- package/dist/typings/index.d.ts +1 -1
- package/dist/typings/workflow-drag.d.mts +1 -1
- package/dist/typings/workflow-drag.d.ts +1 -1
- package/dist/typings/workflow-json.d.mts +1 -1
- package/dist/typings/workflow-json.d.ts +1 -1
- package/dist/typings/workflow-line.d.mts +1 -1
- package/dist/typings/workflow-line.d.ts +1 -1
- package/dist/typings/workflow-node.d.mts +1 -1
- package/dist/typings/workflow-node.d.ts +1 -1
- package/dist/typings/workflow-registry.d.mts +1 -1
- package/dist/typings/workflow-registry.d.ts +1 -1
- package/dist/{workflow-line-entity-BUokXoMi.d.ts → workflow-line-entity-B2J3fUO1.d.ts} +1 -0
- package/dist/{workflow-line-entity-BuRLWUuf.d.mts → workflow-line-entity-CW8YIX-0.d.mts} +1 -0
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ 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-
|
|
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-
|
|
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-CW8YIX-0.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-CW8YIX-0.mjs';
|
|
7
7
|
import { W as WorkflowNodeEntity } from './workflow-sub-canvas-IQzlYvPD.mjs';
|
|
8
8
|
export { a as WorkflowSubCanvas } from './workflow-sub-canvas-IQzlYvPD.mjs';
|
|
9
9
|
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
@@ -137,6 +137,8 @@ declare class WorkflowDragService {
|
|
|
137
137
|
resetLine(line: WorkflowLineEntity, e: MouseEvent): Promise<void>;
|
|
138
138
|
/** 线条拖拽结束 */
|
|
139
139
|
onDragLineEnd(callback: OnDragLineEnd): Disposable;
|
|
140
|
+
/** 能否建立容器连线 */
|
|
141
|
+
private canBuildContainerLine;
|
|
140
142
|
/** 获取最近的 port */
|
|
141
143
|
private getNearestPort;
|
|
142
144
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ 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-
|
|
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-
|
|
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-B2J3fUO1.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-B2J3fUO1.js';
|
|
7
7
|
import { W as WorkflowNodeEntity } from './workflow-sub-canvas-IQzlYvPD.js';
|
|
8
8
|
export { a as WorkflowSubCanvas } from './workflow-sub-canvas-IQzlYvPD.js';
|
|
9
9
|
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
@@ -137,6 +137,8 @@ declare class WorkflowDragService {
|
|
|
137
137
|
resetLine(line: WorkflowLineEntity, e: MouseEvent): Promise<void>;
|
|
138
138
|
/** 线条拖拽结束 */
|
|
139
139
|
onDragLineEnd(callback: OnDragLineEnd): Disposable;
|
|
140
|
+
/** 能否建立容器连线 */
|
|
141
|
+
private canBuildContainerLine;
|
|
140
142
|
/** 获取最近的 port */
|
|
141
143
|
private getNearestPort;
|
|
142
144
|
}
|
package/dist/index.js
CHANGED
|
@@ -1549,7 +1549,8 @@ var WorkflowLinesManager = class {
|
|
|
1549
1549
|
* @param pos
|
|
1550
1550
|
*/
|
|
1551
1551
|
getPortFromMousePos(pos) {
|
|
1552
|
-
const
|
|
1552
|
+
const allNodes = this.getSortedNodes().reverse();
|
|
1553
|
+
const allPorts = allNodes.map((node) => node.getData(WorkflowNodePortsData).allPorts).flat();
|
|
1553
1554
|
const targetPort = allPorts.find((port) => port.isHovered(pos.x, pos.y));
|
|
1554
1555
|
if (targetPort) {
|
|
1555
1556
|
const containNodes = this.getContainNodesFromMousePos(pos);
|
|
@@ -1584,9 +1585,12 @@ var WorkflowLinesManager = class {
|
|
|
1584
1585
|
registerData(line) {
|
|
1585
1586
|
line.addData(WorkflowLineRenderData);
|
|
1586
1587
|
}
|
|
1588
|
+
getSortedNodes() {
|
|
1589
|
+
return this.document.getAllNodes().sort((a, b) => this.getNodeIndex(a) - this.getNodeIndex(b));
|
|
1590
|
+
}
|
|
1587
1591
|
/** 获取鼠标坐标位置的所有节点(stackIndex 从小到大排序) */
|
|
1588
1592
|
getContainNodesFromMousePos(pos) {
|
|
1589
|
-
const allNodes = this.
|
|
1593
|
+
const allNodes = this.getSortedNodes();
|
|
1590
1594
|
const zoom = this.entityManager.getEntity(import_core12.PlaygroundConfigEntity)?.config?.zoom || 1;
|
|
1591
1595
|
const containNodes = allNodes.map((node) => {
|
|
1592
1596
|
const { bounds } = node.getData(import_document5.FlowNodeTransformData);
|
|
@@ -2797,7 +2801,7 @@ var WorkflowDragService = class {
|
|
|
2797
2801
|
type: "onDrag"
|
|
2798
2802
|
});
|
|
2799
2803
|
this.setLineColor(line, this.linesManager.lineColor.drawing);
|
|
2800
|
-
if (toNode) {
|
|
2804
|
+
if (toNode && this.canBuildContainerLine(toNode, dragPos)) {
|
|
2801
2805
|
toPort = this.getNearestPort(toNode, dragPos);
|
|
2802
2806
|
const { hasError } = this.handleDragOnNode(toNode, fromPort, line, toPort, originLine);
|
|
2803
2807
|
lineErrorReset = hasError;
|
|
@@ -2906,6 +2910,16 @@ var WorkflowDragService = class {
|
|
|
2906
2910
|
}
|
|
2907
2911
|
};
|
|
2908
2912
|
}
|
|
2913
|
+
/** 能否建立容器连线 */
|
|
2914
|
+
canBuildContainerLine(node, mousePos) {
|
|
2915
|
+
const isContainer = this.isContainer(node);
|
|
2916
|
+
if (!isContainer) {
|
|
2917
|
+
return true;
|
|
2918
|
+
}
|
|
2919
|
+
const { padding, bounds } = node.transform;
|
|
2920
|
+
const contentRect = new import_utils16.Rectangle(bounds.x, bounds.y, padding.left * 2 / 3, bounds.height);
|
|
2921
|
+
return contentRect.contains(mousePos.x, mousePos.y);
|
|
2922
|
+
}
|
|
2909
2923
|
/** 获取最近的 port */
|
|
2910
2924
|
getNearestPort(node, mousePos) {
|
|
2911
2925
|
const portsData = node.getData(WorkflowNodePortsData);
|