@flowgram.ai/free-layout-core 0.2.23 → 0.2.25
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 +98 -39
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +98 -39
- 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-edge.d.mts +1 -0
- package/dist/typings/workflow-edge.d.ts +1 -0
- package/dist/typings/workflow-edge.js.map +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-CW8YIX-0.d.mts → workflow-line-entity-BmfC83KK.d.mts} +43 -12
- package/dist/{workflow-line-entity-B2J3fUO1.d.ts → workflow-line-entity-pkRs4Hgt.d.ts} +43 -12
- 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 {
|
|
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-BmfC83KK.mjs';
|
|
6
|
+
export { K 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, H as PORT_SIZE, o as WORKFLOW_LINE_ENTITY, M as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, R as WorkflowDocumentOptionsDefault, Q as WorkflowDocumentProvider, J as WorkflowEntityHoverable, q as WorkflowJSON, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, G as WorkflowLineUIState, t as WorkflowNodeMeta, I as WorkflowPortEntityOpts, p as domReactToBounds, n as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-BmfC83KK.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';
|
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 {
|
|
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-pkRs4Hgt.js';
|
|
6
|
+
export { K 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, H as PORT_SIZE, o as WORKFLOW_LINE_ENTITY, M as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, R as WorkflowDocumentOptionsDefault, Q as WorkflowDocumentProvider, J as WorkflowEntityHoverable, q as WorkflowJSON, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, G as WorkflowLineUIState, t as WorkflowNodeMeta, I as WorkflowPortEntityOpts, p as domReactToBounds, n as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-pkRs4Hgt.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';
|
package/dist/index.js
CHANGED
|
@@ -229,7 +229,7 @@ var WorkflowPortEntity = class extends import_core4.Entity {
|
|
|
229
229
|
this.hasError = anyLineHasError || isPortHasError;
|
|
230
230
|
}
|
|
231
231
|
isErrorPort() {
|
|
232
|
-
return this.node.document.isErrorPort(this);
|
|
232
|
+
return this.node.document.isErrorPort(this, this.hasError);
|
|
233
233
|
}
|
|
234
234
|
get point() {
|
|
235
235
|
const { targetElement } = this;
|
|
@@ -733,8 +733,16 @@ var POINT_RADIUS = 10;
|
|
|
733
733
|
var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity {
|
|
734
734
|
constructor(opts) {
|
|
735
735
|
super(opts);
|
|
736
|
-
this.
|
|
737
|
-
|
|
736
|
+
this._uiState = {
|
|
737
|
+
hasError: false,
|
|
738
|
+
flowing: false,
|
|
739
|
+
disabled: false,
|
|
740
|
+
vertical: false,
|
|
741
|
+
hideArrow: false,
|
|
742
|
+
reverse: false,
|
|
743
|
+
highlightColor: "",
|
|
744
|
+
lockedColor: ""
|
|
745
|
+
};
|
|
738
746
|
this.stackIndex = 0;
|
|
739
747
|
/**
|
|
740
748
|
* 线条数据
|
|
@@ -763,6 +771,43 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
|
|
|
763
771
|
const { from, to, fromPort, toPort } = info;
|
|
764
772
|
return `${from}_${fromPort || ""}-${to || ""}_${toPort || ""}`;
|
|
765
773
|
}
|
|
774
|
+
/**
|
|
775
|
+
* 线条的 UI 状态
|
|
776
|
+
*/
|
|
777
|
+
get uiState() {
|
|
778
|
+
return this._uiState;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* 更新线条的 ui 状态
|
|
782
|
+
* @param newState
|
|
783
|
+
*/
|
|
784
|
+
updateUIState(newState) {
|
|
785
|
+
let changed = false;
|
|
786
|
+
Object.keys(newState).forEach((key) => {
|
|
787
|
+
const value = newState[key];
|
|
788
|
+
if (this._uiState[key] !== value) {
|
|
789
|
+
this._uiState[key] = value;
|
|
790
|
+
changed = true;
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
if (changed) {
|
|
794
|
+
this.fireChange();
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* 线条的扩展数据
|
|
799
|
+
*/
|
|
800
|
+
get lineData() {
|
|
801
|
+
return this._lineData;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* 更新线条扩展数据
|
|
805
|
+
* @param data
|
|
806
|
+
*/
|
|
807
|
+
set lineData(data) {
|
|
808
|
+
this._lineData = data;
|
|
809
|
+
this.fireChange();
|
|
810
|
+
}
|
|
766
811
|
/**
|
|
767
812
|
* 获取线条的前置节点
|
|
768
813
|
*/
|
|
@@ -784,29 +829,30 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
|
|
|
784
829
|
}
|
|
785
830
|
/**
|
|
786
831
|
* 获取是否 testrun processing
|
|
832
|
+
* @deprecated use `uiState.flowing` instead
|
|
787
833
|
*/
|
|
788
834
|
get processing() {
|
|
789
|
-
return this.
|
|
835
|
+
return this._uiState.flowing;
|
|
790
836
|
}
|
|
791
837
|
/**
|
|
792
838
|
* 设置 testrun processing 状态
|
|
839
|
+
* @deprecated use `uiState.flowing` instead
|
|
793
840
|
*/
|
|
794
841
|
set processing(status) {
|
|
795
|
-
if (this.
|
|
796
|
-
this.
|
|
842
|
+
if (this._uiState.flowing !== status) {
|
|
843
|
+
this._uiState.flowing = status;
|
|
797
844
|
this.fireChange();
|
|
798
845
|
}
|
|
799
846
|
}
|
|
800
847
|
// 获取连线是否为错误态
|
|
801
848
|
get hasError() {
|
|
802
|
-
return this.
|
|
849
|
+
return this.uiState.hasError;
|
|
803
850
|
}
|
|
804
851
|
// 设置连线的错误态
|
|
805
852
|
set hasError(hasError) {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}
|
|
853
|
+
this.updateUIState({
|
|
854
|
+
hasError
|
|
855
|
+
});
|
|
810
856
|
if (this._node) {
|
|
811
857
|
this._node.dataset.hasError = this.hasError ? "true" : "false";
|
|
812
858
|
}
|
|
@@ -859,13 +905,20 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
|
|
|
859
905
|
return this.info.drawingTo;
|
|
860
906
|
}
|
|
861
907
|
get highlightColor() {
|
|
862
|
-
return this.
|
|
908
|
+
return this.uiState.highlightColor || "";
|
|
863
909
|
}
|
|
864
|
-
set highlightColor(
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
910
|
+
set highlightColor(highlightColor) {
|
|
911
|
+
this.updateUIState({
|
|
912
|
+
highlightColor
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
get lockedColor() {
|
|
916
|
+
return this.uiState.lockedColor;
|
|
917
|
+
}
|
|
918
|
+
set lockedColor(lockedColor) {
|
|
919
|
+
this.updateUIState({
|
|
920
|
+
lockedColor
|
|
921
|
+
});
|
|
869
922
|
}
|
|
870
923
|
/**
|
|
871
924
|
* 获取线条的边框位置大小
|
|
@@ -896,23 +949,23 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
|
|
|
896
949
|
}
|
|
897
950
|
/** 是否反转箭头 */
|
|
898
951
|
get reverse() {
|
|
899
|
-
return this.linesManager.isReverseLine(this);
|
|
952
|
+
return this.linesManager.isReverseLine(this, this.uiState.reverse);
|
|
900
953
|
}
|
|
901
954
|
/** 是否隐藏箭头 */
|
|
902
955
|
get hideArrow() {
|
|
903
|
-
return this.linesManager.isHideArrowLine(this);
|
|
956
|
+
return this.linesManager.isHideArrowLine(this, this.uiState.hideArrow);
|
|
904
957
|
}
|
|
905
958
|
/** 是否流动 */
|
|
906
959
|
get flowing() {
|
|
907
|
-
return this.linesManager.isFlowingLine(this);
|
|
960
|
+
return this.linesManager.isFlowingLine(this, this.uiState.flowing);
|
|
908
961
|
}
|
|
909
962
|
/** 是否禁用 */
|
|
910
963
|
get disabled() {
|
|
911
|
-
return this.linesManager.isDisabledLine(this);
|
|
964
|
+
return this.linesManager.isDisabledLine(this, this.uiState.disabled);
|
|
912
965
|
}
|
|
913
966
|
/** 是否竖向 */
|
|
914
967
|
get vertical() {
|
|
915
|
-
return this.linesManager.isVerticalLine(this);
|
|
968
|
+
return this.linesManager.isVerticalLine(this, this.uiState.vertical);
|
|
916
969
|
}
|
|
917
970
|
/** 获取线条渲染器类型 */
|
|
918
971
|
get renderType() {
|
|
@@ -947,7 +1000,7 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
|
|
|
947
1000
|
validateSelf() {
|
|
948
1001
|
const { fromPort, toPort } = this;
|
|
949
1002
|
if (fromPort) {
|
|
950
|
-
this.hasError = this.linesManager.isErrorLine(fromPort, toPort);
|
|
1003
|
+
this.hasError = this.linesManager.isErrorLine(fromPort, toPort, this.uiState.hasError);
|
|
951
1004
|
}
|
|
952
1005
|
}
|
|
953
1006
|
is(line) {
|
|
@@ -978,6 +1031,9 @@ var _WorkflowLineEntity = class _WorkflowLineEntity extends import_core8.Entity
|
|
|
978
1031
|
sourcePortID: this.info.fromPort,
|
|
979
1032
|
targetPortID: this.info.toPort
|
|
980
1033
|
};
|
|
1034
|
+
if (this._lineData !== void 0) {
|
|
1035
|
+
json.data = this._lineData;
|
|
1036
|
+
}
|
|
981
1037
|
if (!json.sourcePortID) {
|
|
982
1038
|
delete json.sourcePortID;
|
|
983
1039
|
}
|
|
@@ -1445,41 +1501,41 @@ var WorkflowLinesManager = class {
|
|
|
1445
1501
|
get disposed() {
|
|
1446
1502
|
return this.toDispose.disposed;
|
|
1447
1503
|
}
|
|
1448
|
-
isErrorLine(fromPort, toPort) {
|
|
1504
|
+
isErrorLine(fromPort, toPort, defaultValue) {
|
|
1449
1505
|
if (this.options.isErrorLine) {
|
|
1450
1506
|
return this.options.isErrorLine(fromPort, toPort, this);
|
|
1451
1507
|
}
|
|
1452
|
-
return
|
|
1508
|
+
return !!defaultValue;
|
|
1453
1509
|
}
|
|
1454
|
-
isReverseLine(line) {
|
|
1510
|
+
isReverseLine(line, defaultValue = false) {
|
|
1455
1511
|
if (this.options.isReverseLine) {
|
|
1456
1512
|
return this.options.isReverseLine(line);
|
|
1457
1513
|
}
|
|
1458
|
-
return
|
|
1514
|
+
return defaultValue;
|
|
1459
1515
|
}
|
|
1460
|
-
isHideArrowLine(line) {
|
|
1516
|
+
isHideArrowLine(line, defaultValue = false) {
|
|
1461
1517
|
if (this.options.isHideArrowLine) {
|
|
1462
1518
|
return this.options.isHideArrowLine(line);
|
|
1463
1519
|
}
|
|
1464
|
-
return
|
|
1520
|
+
return defaultValue;
|
|
1465
1521
|
}
|
|
1466
|
-
isFlowingLine(line) {
|
|
1522
|
+
isFlowingLine(line, defaultValue = false) {
|
|
1467
1523
|
if (this.options.isFlowingLine) {
|
|
1468
1524
|
return this.options.isFlowingLine(line);
|
|
1469
1525
|
}
|
|
1470
|
-
return
|
|
1526
|
+
return defaultValue;
|
|
1471
1527
|
}
|
|
1472
|
-
isDisabledLine(line) {
|
|
1528
|
+
isDisabledLine(line, defaultValue = false) {
|
|
1473
1529
|
if (this.options.isDisabledLine) {
|
|
1474
1530
|
return this.options.isDisabledLine(line);
|
|
1475
1531
|
}
|
|
1476
|
-
return
|
|
1532
|
+
return defaultValue;
|
|
1477
1533
|
}
|
|
1478
|
-
isVerticalLine(line) {
|
|
1534
|
+
isVerticalLine(line, defaultValue = false) {
|
|
1479
1535
|
if (this.options.isVerticalLine) {
|
|
1480
1536
|
return this.options.isVerticalLine(line);
|
|
1481
1537
|
}
|
|
1482
|
-
return
|
|
1538
|
+
return defaultValue;
|
|
1483
1539
|
}
|
|
1484
1540
|
setLineRenderType(line) {
|
|
1485
1541
|
if (this.options.setLineRenderType) {
|
|
@@ -1497,6 +1553,9 @@ var WorkflowLinesManager = class {
|
|
|
1497
1553
|
if (line.isHidden) {
|
|
1498
1554
|
return this.lineColor.hidden;
|
|
1499
1555
|
}
|
|
1556
|
+
if (line.lockedColor) {
|
|
1557
|
+
return line.lockedColor;
|
|
1558
|
+
}
|
|
1500
1559
|
if (line.hasError) {
|
|
1501
1560
|
return this.lineColor.error;
|
|
1502
1561
|
}
|
|
@@ -2220,11 +2279,11 @@ var WorkflowDocument = class extends import_document7.FlowDocument {
|
|
|
2220
2279
|
/**
|
|
2221
2280
|
* 判断端口是否为错误态
|
|
2222
2281
|
*/
|
|
2223
|
-
isErrorPort(port) {
|
|
2282
|
+
isErrorPort(port, defaultValue = false) {
|
|
2224
2283
|
if (typeof this.options.isErrorPort === "function") {
|
|
2225
2284
|
return this.options.isErrorPort(port);
|
|
2226
2285
|
}
|
|
2227
|
-
return
|
|
2286
|
+
return defaultValue;
|
|
2228
2287
|
}
|
|
2229
2288
|
/**
|
|
2230
2289
|
* 导出数据
|
|
@@ -2778,7 +2837,7 @@ var WorkflowDragService = class {
|
|
|
2778
2837
|
return;
|
|
2779
2838
|
}
|
|
2780
2839
|
config.updateCursor("grab");
|
|
2781
|
-
line.highlightColor = this.linesManager.lineColor.drawing;
|
|
2840
|
+
line.highlightColor = originLine?.lockedColor || this.linesManager.lineColor.drawing;
|
|
2782
2841
|
this.hoverService.updateHoveredKey("");
|
|
2783
2842
|
}
|
|
2784
2843
|
if (!line) {
|
|
@@ -2800,7 +2859,7 @@ var WorkflowDragService = class {
|
|
|
2800
2859
|
this._onDragLineEventEmitter.fire({
|
|
2801
2860
|
type: "onDrag"
|
|
2802
2861
|
});
|
|
2803
|
-
this.setLineColor(line, this.linesManager.lineColor.drawing);
|
|
2862
|
+
this.setLineColor(line, originLine?.lockedColor || this.linesManager.lineColor.drawing);
|
|
2804
2863
|
if (toNode && this.canBuildContainerLine(toNode, dragPos)) {
|
|
2805
2864
|
toPort = this.getNearestPort(toNode, dragPos);
|
|
2806
2865
|
const { hasError } = this.handleDragOnNode(toNode, fromPort, line, toPort, originLine);
|