@flowgram.ai/free-layout-core 0.2.17 → 0.2.19
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 +37 -31
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +21 -15
- 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-D4-erSyq.d.ts → workflow-line-entity-BUokXoMi.d.ts} +3 -0
- package/dist/{workflow-line-entity-BpFc2Mu3.d.mts → workflow-line-entity-BuRLWUuf.d.mts} +3 -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-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
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';
|
|
@@ -77,7 +77,7 @@ declare class WorkflowDragService {
|
|
|
77
77
|
/**
|
|
78
78
|
* 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标
|
|
79
79
|
*/
|
|
80
|
-
adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint
|
|
80
|
+
adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint): IPoint;
|
|
81
81
|
/**
|
|
82
82
|
* 注册位置调整
|
|
83
83
|
*/
|
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-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
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';
|
|
@@ -77,7 +77,7 @@ declare class WorkflowDragService {
|
|
|
77
77
|
/**
|
|
78
78
|
* 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标
|
|
79
79
|
*/
|
|
80
|
-
adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint
|
|
80
|
+
adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint): IPoint;
|
|
81
81
|
/**
|
|
82
82
|
* 注册位置调整
|
|
83
83
|
*/
|
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
|
|
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
|
|
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;
|
|
@@ -2553,7 +2559,7 @@ var WorkflowDragService = class {
|
|
|
2553
2559
|
/**
|
|
2554
2560
|
* 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标
|
|
2555
2561
|
*/
|
|
2556
|
-
adjustSubNodePosition(subNodeType, containerNode, mousePos
|
|
2562
|
+
adjustSubNodePosition(subNodeType, containerNode, mousePos) {
|
|
2557
2563
|
if (!mousePos) {
|
|
2558
2564
|
return { x: 0, y: 0 };
|
|
2559
2565
|
}
|
|
@@ -2562,16 +2568,16 @@ var WorkflowDragService = class {
|
|
|
2562
2568
|
}
|
|
2563
2569
|
const isParentEmpty = !containerNode.children || containerNode.children.length === 0;
|
|
2564
2570
|
const parentPadding = this.document.layout.getPadding(containerNode);
|
|
2565
|
-
const
|
|
2566
|
-
if (isParentEmpty
|
|
2571
|
+
const containerWorldTransform = containerNode.transform.transform.worldTransform;
|
|
2572
|
+
if (isParentEmpty) {
|
|
2567
2573
|
return {
|
|
2568
2574
|
x: 0,
|
|
2569
2575
|
y: parentPadding.top
|
|
2570
2576
|
};
|
|
2571
2577
|
} else {
|
|
2572
2578
|
return {
|
|
2573
|
-
x: mousePos.x -
|
|
2574
|
-
y: mousePos.y -
|
|
2579
|
+
x: mousePos.x - containerWorldTransform.tx,
|
|
2580
|
+
y: mousePos.y - containerWorldTransform.ty
|
|
2575
2581
|
};
|
|
2576
2582
|
}
|
|
2577
2583
|
}
|