@logicflow/core 1.2.0-alpha.7 → 1.2.0-alpha.8
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/logic-flow.js
CHANGED
|
@@ -11337,7 +11337,7 @@ module.exports.f = function (C) {
|
|
|
11337
11337
|
/* 161 */
|
|
11338
11338
|
/***/ (function(module) {
|
|
11339
11339
|
|
|
11340
|
-
module.exports = JSON.parse("{\"a\":\"1.2.0-alpha.
|
|
11340
|
+
module.exports = JSON.parse("{\"a\":\"1.2.0-alpha.8\"}");
|
|
11341
11341
|
|
|
11342
11342
|
/***/ }),
|
|
11343
11343
|
/* 162 */
|
|
@@ -19782,9 +19782,10 @@ var SilentConfig = {
|
|
|
19782
19782
|
nodeTextEdit: false,
|
|
19783
19783
|
edgeTextEdit: false,
|
|
19784
19784
|
nodeTextDraggable: false,
|
|
19785
|
-
edgeTextDraggable: false
|
|
19785
|
+
edgeTextDraggable: false,
|
|
19786
|
+
autoExpand: false
|
|
19786
19787
|
};
|
|
19787
|
-
var EditConfigModel_keys = ['isSilentMode', 'stopZoomGraph', 'stopScrollGraph', 'stopMoveGraph', 'adjustEdge', 'adjustEdgeMiddle', 'adjustEdgeStartAndEnd', 'adjustNodePosition', 'hideAnchors', 'hoverOutline', 'nodeSelectedOutline', 'edgeSelectedOutline', 'nodeTextEdit', 'edgeTextEdit', 'nodeTextDraggable', 'edgeTextDraggable', 'multipleSelectKey'];
|
|
19788
|
+
var EditConfigModel_keys = ['isSilentMode', 'stopZoomGraph', 'stopScrollGraph', 'stopMoveGraph', 'adjustEdge', 'adjustEdgeMiddle', 'adjustEdgeStartAndEnd', 'adjustNodePosition', 'hideAnchors', 'hoverOutline', 'nodeSelectedOutline', 'edgeSelectedOutline', 'nodeTextEdit', 'edgeTextEdit', 'nodeTextDraggable', 'edgeTextDraggable', 'multipleSelectKey', 'autoExpand'];
|
|
19788
19789
|
/**
|
|
19789
19790
|
* 页面编辑配置
|
|
19790
19791
|
*/
|
|
@@ -19826,6 +19827,8 @@ var EditConfigModel_EditConfigModel = /*#__PURE__*/function () {
|
|
|
19826
19827
|
|
|
19827
19828
|
EditConfigModel_defineProperty(this, "edgeTextDraggable", false);
|
|
19828
19829
|
|
|
19830
|
+
EditConfigModel_defineProperty(this, "autoExpand", false);
|
|
19831
|
+
|
|
19829
19832
|
EditConfigModel_defineProperty(this, "multipleSelectKey", '');
|
|
19830
19833
|
|
|
19831
19834
|
EditConfigModel_defineProperty(this, "defaultConfig", {});
|
|
@@ -19847,6 +19850,7 @@ var EditConfigModel_EditConfigModel = /*#__PURE__*/function () {
|
|
|
19847
19850
|
edgeTextEdit: mobx_esm["observable"],
|
|
19848
19851
|
nodeTextDraggable: mobx_esm["observable"],
|
|
19849
19852
|
edgeTextDraggable: mobx_esm["observable"],
|
|
19853
|
+
autoExpand: mobx_esm["observable"],
|
|
19850
19854
|
updateEditConfig: mobx_esm["action"]
|
|
19851
19855
|
});
|
|
19852
19856
|
lodash_es_assign(this, this.getConfigDetail(config));
|
|
@@ -19888,7 +19892,8 @@ var EditConfigModel_EditConfigModel = /*#__PURE__*/function () {
|
|
|
19888
19892
|
nodeTextEdit: this.nodeTextEdit,
|
|
19889
19893
|
edgeTextEdit: this.edgeTextEdit,
|
|
19890
19894
|
nodeTextDraggable: this.nodeTextDraggable,
|
|
19891
|
-
edgeTextDraggable: this.edgeTextDraggable
|
|
19895
|
+
edgeTextDraggable: this.edgeTextDraggable,
|
|
19896
|
+
autoExpand: this.autoExpand
|
|
19892
19897
|
};
|
|
19893
19898
|
lodash_es_assign(conf, silentConfig);
|
|
19894
19899
|
} // 如果不传,默认undefined表示允许文本编辑
|
|
@@ -23509,9 +23514,7 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
23509
23514
|
PolylineEdgeModel_defineProperty(PolylineEdgeModel_assertThisInitialized(_this), "dbClickPosition", void 0);
|
|
23510
23515
|
|
|
23511
23516
|
Object(mobx_esm["makeObservable"])(PolylineEdgeModel_assertThisInitialized(_this), {
|
|
23512
|
-
dbClickPosition: mobx_esm["observable"]
|
|
23513
|
-
dragAppend: mobx_esm["action"],
|
|
23514
|
-
dragAppendEnd: mobx_esm["action"]
|
|
23517
|
+
dbClickPosition: mobx_esm["observable"]
|
|
23515
23518
|
});
|
|
23516
23519
|
return _this;
|
|
23517
23520
|
}
|
|
@@ -23582,7 +23585,6 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
23582
23585
|
anchor = item;
|
|
23583
23586
|
}
|
|
23584
23587
|
});
|
|
23585
|
-
console.log(444, JSON.stringify(anchor));
|
|
23586
23588
|
return anchor;
|
|
23587
23589
|
}
|
|
23588
23590
|
/* 获取拖拽过程中产生的交点 */
|
|
@@ -23865,8 +23867,13 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
23865
23867
|
key: "dragAppendStart",
|
|
23866
23868
|
value: function dragAppendStart() {
|
|
23867
23869
|
// mobx observer 对象被iterator处理会有问题
|
|
23868
|
-
this.draggingPointList = this.pointsList.map(function (
|
|
23869
|
-
|
|
23870
|
+
this.draggingPointList = this.pointsList.map(function (_ref2) {
|
|
23871
|
+
var x = _ref2.x,
|
|
23872
|
+
y = _ref2.y;
|
|
23873
|
+
return {
|
|
23874
|
+
x: x,
|
|
23875
|
+
y: y
|
|
23876
|
+
};
|
|
23870
23877
|
});
|
|
23871
23878
|
}
|
|
23872
23879
|
}, {
|
|
@@ -23881,42 +23888,43 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
23881
23888
|
endIndex = appendInfo.endIndex,
|
|
23882
23889
|
direction = appendInfo.direction;
|
|
23883
23890
|
var pointsList = this.pointsList;
|
|
23884
|
-
var
|
|
23891
|
+
var pointsListNew = pointsList.map(function (_ref3) {
|
|
23892
|
+
var x = _ref3.x,
|
|
23893
|
+
y = _ref3.y;
|
|
23894
|
+
return {
|
|
23895
|
+
x: x,
|
|
23896
|
+
y: y
|
|
23897
|
+
};
|
|
23898
|
+
});
|
|
23885
23899
|
|
|
23886
23900
|
if (direction === SegmentDirection.HORIZONTAL) {
|
|
23887
23901
|
// 水平,仅调整y坐标,拿到当前线段两个端点移动后的坐标
|
|
23888
|
-
|
|
23902
|
+
pointsListNew[startIndex] = {
|
|
23889
23903
|
x: start.x,
|
|
23890
23904
|
y: start.y + dragInfo.y
|
|
23891
23905
|
};
|
|
23892
|
-
|
|
23906
|
+
pointsListNew[endIndex] = {
|
|
23893
23907
|
x: end.x,
|
|
23894
23908
|
y: end.y + dragInfo.y
|
|
23895
23909
|
};
|
|
23896
|
-
draggingPointList = this.pointsList.map(function (i) {
|
|
23897
|
-
return i;
|
|
23898
|
-
});
|
|
23899
23910
|
} else if (direction === SegmentDirection.VERTICAL) {
|
|
23900
23911
|
// 垂直,仅调整x坐标, 与水平调整同理
|
|
23901
|
-
|
|
23912
|
+
pointsListNew[startIndex] = {
|
|
23902
23913
|
x: start.x + dragInfo.x,
|
|
23903
23914
|
y: start.y
|
|
23904
23915
|
};
|
|
23905
|
-
|
|
23916
|
+
pointsListNew[endIndex] = {
|
|
23906
23917
|
x: end.x + dragInfo.x,
|
|
23907
23918
|
y: end.y
|
|
23908
23919
|
};
|
|
23909
|
-
draggingPointList = this.pointsList.map(function (i) {
|
|
23910
|
-
return i;
|
|
23911
|
-
});
|
|
23912
23920
|
}
|
|
23913
23921
|
|
|
23914
|
-
this.updatePointsAfterDrag(
|
|
23915
|
-
this.draggingPointList =
|
|
23922
|
+
this.updatePointsAfterDrag(pointsListNew);
|
|
23923
|
+
this.draggingPointList = pointsListNew;
|
|
23916
23924
|
this.setText(Object.assign({}, this.text, this.textPosition));
|
|
23917
23925
|
return {
|
|
23918
|
-
start: Object.assign({},
|
|
23919
|
-
end: Object.assign({},
|
|
23926
|
+
start: Object.assign({}, pointsListNew[startIndex]),
|
|
23927
|
+
end: Object.assign({}, pointsListNew[endIndex]),
|
|
23920
23928
|
startIndex: startIndex,
|
|
23921
23929
|
endIndex: endIndex,
|
|
23922
23930
|
direction: direction
|
|
@@ -23932,27 +23940,33 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
23932
23940
|
endIndex = appendInfo.endIndex,
|
|
23933
23941
|
direction = appendInfo.direction;
|
|
23934
23942
|
var pointsList = this.pointsList;
|
|
23943
|
+
var pointsListNew = pointsList.map(function (_ref4) {
|
|
23944
|
+
var x = _ref4.x,
|
|
23945
|
+
y = _ref4.y;
|
|
23946
|
+
return {
|
|
23947
|
+
x: x,
|
|
23948
|
+
y: y
|
|
23949
|
+
};
|
|
23950
|
+
});
|
|
23935
23951
|
|
|
23936
23952
|
if (direction === SegmentDirection.HORIZONTAL) {
|
|
23937
23953
|
// 水平,仅调整y坐标
|
|
23938
23954
|
// step1: 拿到当前线段两个端点移动后的坐标
|
|
23939
|
-
|
|
23955
|
+
pointsListNew[startIndex] = {
|
|
23940
23956
|
x: start.x,
|
|
23941
23957
|
y: start.y + dragInfo.y
|
|
23942
23958
|
};
|
|
23943
|
-
|
|
23959
|
+
pointsListNew[endIndex] = {
|
|
23944
23960
|
x: end.x,
|
|
23945
23961
|
y: end.y + dragInfo.y
|
|
23946
23962
|
}; // step2: 计算拖拽后,两个端点与节点外框的交点
|
|
23947
23963
|
// 定义一个拖住中节点list
|
|
23948
23964
|
|
|
23949
|
-
var draggingPointList =
|
|
23950
|
-
return i;
|
|
23951
|
-
});
|
|
23965
|
+
var draggingPointList = pointsListNew;
|
|
23952
23966
|
|
|
23953
|
-
if (startIndex !== 0 && endIndex !==
|
|
23967
|
+
if (startIndex !== 0 && endIndex !== pointsListNew.length - 1) {
|
|
23954
23968
|
// 2.1)如果线段没有连接起终点,过滤会穿插在图形内部的线段,取整个图形离线段最近的点
|
|
23955
|
-
draggingPointList = this.removeCrossPoints(startIndex, endIndex,
|
|
23969
|
+
draggingPointList = this.removeCrossPoints(startIndex, endIndex, pointsListNew);
|
|
23956
23970
|
}
|
|
23957
23971
|
|
|
23958
23972
|
if (startIndex === 0) {
|
|
@@ -23970,7 +23984,7 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
23970
23984
|
}
|
|
23971
23985
|
}
|
|
23972
23986
|
|
|
23973
|
-
if (endIndex ===
|
|
23987
|
+
if (endIndex === pointsListNew.length - 1) {
|
|
23974
23988
|
// 2.2)如果线段连接了终点, 判断起点是否在节点内部
|
|
23975
23989
|
var endPosition = {
|
|
23976
23990
|
x: end.x,
|
|
@@ -23992,20 +24006,17 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
23992
24006
|
this.draggingPointList = draggingPointList;
|
|
23993
24007
|
} else if (direction === SegmentDirection.VERTICAL) {
|
|
23994
24008
|
// 垂直,仅调整x坐标, 与水平调整同理
|
|
23995
|
-
|
|
24009
|
+
pointsListNew[startIndex] = {
|
|
23996
24010
|
x: start.x + dragInfo.x,
|
|
23997
24011
|
y: start.y
|
|
23998
24012
|
};
|
|
23999
|
-
|
|
24013
|
+
pointsListNew[endIndex] = {
|
|
24000
24014
|
x: end.x + dragInfo.x,
|
|
24001
24015
|
y: end.y
|
|
24002
24016
|
};
|
|
24017
|
+
var _draggingPointList = pointsListNew;
|
|
24003
24018
|
|
|
24004
|
-
|
|
24005
|
-
return i;
|
|
24006
|
-
});
|
|
24007
|
-
|
|
24008
|
-
if (startIndex !== 0 && endIndex !== this.pointsList.length - 1) {
|
|
24019
|
+
if (startIndex !== 0 && endIndex !== pointsListNew.length - 1) {
|
|
24009
24020
|
_draggingPointList = this.removeCrossPoints(startIndex, endIndex, _draggingPointList);
|
|
24010
24021
|
}
|
|
24011
24022
|
|
|
@@ -24024,7 +24035,7 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
24024
24035
|
}
|
|
24025
24036
|
}
|
|
24026
24037
|
|
|
24027
|
-
if (endIndex ===
|
|
24038
|
+
if (endIndex === pointsListNew.length - 1) {
|
|
24028
24039
|
var _endPosition = {
|
|
24029
24040
|
x: end.x + dragInfo.x,
|
|
24030
24041
|
y: end.y
|
|
@@ -24045,8 +24056,8 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
24045
24056
|
|
|
24046
24057
|
this.setText(Object.assign({}, this.text, this.textPosition));
|
|
24047
24058
|
return {
|
|
24048
|
-
start: Object.assign({},
|
|
24049
|
-
end: Object.assign({},
|
|
24059
|
+
start: Object.assign({}, pointsListNew[startIndex]),
|
|
24060
|
+
end: Object.assign({}, pointsListNew[endIndex]),
|
|
24050
24061
|
startIndex: startIndex,
|
|
24051
24062
|
endIndex: endIndex,
|
|
24052
24063
|
direction: direction
|
|
@@ -24056,18 +24067,17 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
24056
24067
|
key: "dragAppendEnd",
|
|
24057
24068
|
value: function dragAppendEnd() {
|
|
24058
24069
|
if (this.draggingPointList) {
|
|
24059
|
-
var pointsList = points2PointsList(this.points); //
|
|
24060
|
-
|
|
24061
|
-
this.pointsList = pointsList.map(function (i) {
|
|
24062
|
-
return i;
|
|
24063
|
-
}); // draggingPointList清空
|
|
24070
|
+
var pointsList = points2PointsList(this.points); // draggingPointList清空
|
|
24064
24071
|
|
|
24065
24072
|
this.draggingPointList = []; // 更新起终点
|
|
24066
24073
|
|
|
24067
24074
|
var startPoint = pointsList[0];
|
|
24068
|
-
this.startPoint = Object.assign({}, startPoint);
|
|
24069
24075
|
var endPoint = pointsList[pointsList.length - 1];
|
|
24070
|
-
this.
|
|
24076
|
+
this.updateAttributes({
|
|
24077
|
+
startPoint: lodash_es_cloneDeep(startPoint),
|
|
24078
|
+
endPoint: lodash_es_cloneDeep(endPoint),
|
|
24079
|
+
pointsList: lodash_es_cloneDeep(pointsList)
|
|
24080
|
+
});
|
|
24071
24081
|
}
|
|
24072
24082
|
|
|
24073
24083
|
this.isDragging = false;
|
|
@@ -24082,9 +24092,11 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
24082
24092
|
value: function updatePointsAfterDrag(pointsList) {
|
|
24083
24093
|
// 找到准确的连接点后,更新points, 更新边,同时更新依赖points的箭头
|
|
24084
24094
|
var list = this.updateCrossPoints(pointsList);
|
|
24085
|
-
this.
|
|
24086
|
-
|
|
24087
|
-
|
|
24095
|
+
this.updateAttributes({
|
|
24096
|
+
points: list.map(function (point) {
|
|
24097
|
+
return "".concat(point.x, ",").concat(point.y);
|
|
24098
|
+
}).join(' ')
|
|
24099
|
+
});
|
|
24088
24100
|
} // 获取边调整的起点
|
|
24089
24101
|
|
|
24090
24102
|
}, {
|
|
@@ -24102,11 +24114,11 @@ var PolylineEdgeModel_PolylineEdgeModel = /*#__PURE__*/function (_BaseEdgeModel)
|
|
|
24102
24114
|
|
|
24103
24115
|
}, {
|
|
24104
24116
|
key: "updateAfterAdjustStartAndEnd",
|
|
24105
|
-
value: function updateAfterAdjustStartAndEnd(
|
|
24106
|
-
var startPoint =
|
|
24107
|
-
endPoint =
|
|
24108
|
-
sourceNode =
|
|
24109
|
-
targetNode =
|
|
24117
|
+
value: function updateAfterAdjustStartAndEnd(_ref5) {
|
|
24118
|
+
var startPoint = _ref5.startPoint,
|
|
24119
|
+
endPoint = _ref5.endPoint,
|
|
24120
|
+
sourceNode = _ref5.sourceNode,
|
|
24121
|
+
targetNode = _ref5.targetNode;
|
|
24110
24122
|
var pointsList = getPolylinePoints({
|
|
24111
24123
|
x: startPoint.x,
|
|
24112
24124
|
y: startPoint.y
|
|
@@ -25620,6 +25632,10 @@ var GraphModel_GraphModel = /*#__PURE__*/function () {
|
|
|
25620
25632
|
options.height = container.getBoundingClientRect().height;
|
|
25621
25633
|
}
|
|
25622
25634
|
|
|
25635
|
+
if (!options.width || !options.height) {
|
|
25636
|
+
console.warn('画布初始化确实宽高');
|
|
25637
|
+
}
|
|
25638
|
+
|
|
25623
25639
|
this.width = options.width;
|
|
25624
25640
|
this.height = options.height;
|
|
25625
25641
|
this.animation = animation_updateAnimation(animation);
|
|
@@ -32269,7 +32285,7 @@ var BaseNode_BaseNode = /*#__PURE__*/function (_Component) {
|
|
|
32269
32285
|
cancelRaf(_this.t);
|
|
32270
32286
|
}
|
|
32271
32287
|
|
|
32272
|
-
if (nearBoundary.length > 0 && !editConfigModel.stopMoveGraph) {
|
|
32288
|
+
if (nearBoundary.length > 0 && !editConfigModel.stopMoveGraph && editConfigModel.autoExpand) {
|
|
32273
32289
|
_this.t = raf_createRaf(function () {
|
|
32274
32290
|
var _nearBoundary = nearBoundary,
|
|
32275
32291
|
_nearBoundary2 = BaseNode_slicedToArray(_nearBoundary, 2),
|