@logicflow/core 1.1.22 → 1.1.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/logic-flow.js +65 -12
- package/dist/logic-flow.min.js +1 -1
- package/package.json +1 -1
- package/types/LogicFlow.d.ts +1 -1
- package/types/model/BaseModel.d.ts +7 -0
- package/types/model/GraphModel.d.ts +2 -1
- package/types/model/edge/BaseEdgeModel.d.ts +1 -0
- package/types/model/node/BaseNodeModel.d.ts +4 -2
- package/types/util/vector.d.ts +4 -0
- package/types/algorithm/vector.d.ts +0 -11
package/dist/logic-flow.js
CHANGED
|
@@ -23478,6 +23478,8 @@ var BaseEdgeModel_BaseEdgeModel = (BaseEdgeModel_class = /*#__PURE__*/function (
|
|
|
23478
23478
|
|
|
23479
23479
|
BaseEdgeModel_initializerDefineProperty(this, "visible", BaseEdgeModel_descriptor14, this);
|
|
23480
23480
|
|
|
23481
|
+
BaseEdgeModel_defineProperty(this, "virtual", false);
|
|
23482
|
+
|
|
23481
23483
|
BaseEdgeModel_initializerDefineProperty(this, "isAnimation", BaseEdgeModel_descriptor15, this);
|
|
23482
23484
|
|
|
23483
23485
|
BaseEdgeModel_defineProperty(this, "graphModel", void 0);
|
|
@@ -26521,6 +26523,7 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
|
|
|
26521
26523
|
* @param rightBottomPoint 表示区域右下角的点
|
|
26522
26524
|
* @param wholeEdge 是否要整个边都在区域内部
|
|
26523
26525
|
* @param wholeNode 是否要整个节点都在区域内部
|
|
26526
|
+
* @param ignoreHideElement 是否忽略隐藏的节点
|
|
26524
26527
|
*/
|
|
26525
26528
|
|
|
26526
26529
|
}, {
|
|
@@ -26528,6 +26531,7 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
|
|
|
26528
26531
|
value: function getAreaElement(leftTopPoint, rightBottomPoint) {
|
|
26529
26532
|
var wholeEdge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
26530
26533
|
var wholeNode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
26534
|
+
var ignoreHideElement = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
26531
26535
|
var areaElements = [];
|
|
26532
26536
|
var elements = [];
|
|
26533
26537
|
this.nodes.forEach(function (node) {
|
|
@@ -26540,7 +26544,7 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
|
|
|
26540
26544
|
for (var i = 0; i < elements.length; i++) {
|
|
26541
26545
|
var currentItem = elements[i];
|
|
26542
26546
|
|
|
26543
|
-
if (this.isElementInArea(currentItem, leftTopPoint, rightBottomPoint, wholeEdge, wholeNode)) {
|
|
26547
|
+
if ((!ignoreHideElement || currentItem.visible) && this.isElementInArea(currentItem, leftTopPoint, rightBottomPoint, wholeEdge, wholeNode)) {
|
|
26544
26548
|
areaElements.push(currentItem);
|
|
26545
26549
|
}
|
|
26546
26550
|
}
|
|
@@ -26732,12 +26736,12 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
|
|
|
26732
26736
|
var edges = [];
|
|
26733
26737
|
this.edges.forEach(function (edge) {
|
|
26734
26738
|
var data = edge.getData();
|
|
26735
|
-
if (data) edges.push(data);
|
|
26739
|
+
if (data && !edge.virtual) edges.push(data);
|
|
26736
26740
|
});
|
|
26737
26741
|
var nodes = [];
|
|
26738
26742
|
this.nodes.forEach(function (node) {
|
|
26739
26743
|
var data = node.getData();
|
|
26740
|
-
if (data) nodes.push(data);
|
|
26744
|
+
if (data && !node.virtual) nodes.push(data);
|
|
26741
26745
|
});
|
|
26742
26746
|
return {
|
|
26743
26747
|
nodes: nodes,
|
|
@@ -27123,9 +27127,15 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
|
|
|
27123
27127
|
}
|
|
27124
27128
|
|
|
27125
27129
|
var nodeModel = node.model;
|
|
27126
|
-
var r = nodeModel.move(deltaX, deltaY, isignoreRule); // 2) 移动边
|
|
27127
27130
|
|
|
27128
|
-
|
|
27131
|
+
var _nodeModel$getMoveDis = nodeModel.getMoveDistance(deltaX, deltaY, isignoreRule);
|
|
27132
|
+
|
|
27133
|
+
var _nodeModel$getMoveDis2 = GraphModel_slicedToArray(_nodeModel$getMoveDis, 2);
|
|
27134
|
+
|
|
27135
|
+
deltaX = _nodeModel$getMoveDis2[0];
|
|
27136
|
+
deltaY = _nodeModel$getMoveDis2[1];
|
|
27137
|
+
// 2) 移动边
|
|
27138
|
+
this.moveEdge(nodeId, deltaX, deltaY);
|
|
27129
27139
|
}
|
|
27130
27140
|
/**
|
|
27131
27141
|
* 移动节点-绝对位置
|
|
@@ -30107,6 +30117,8 @@ var BaseNodeModel_BaseNodeModel = (BaseNodeModel_class = /*#__PURE__*/function (
|
|
|
30107
30117
|
|
|
30108
30118
|
BaseNodeModel_initializerDefineProperty(this, "visible", BaseNodeModel_descriptor14, this);
|
|
30109
30119
|
|
|
30120
|
+
BaseNodeModel_defineProperty(this, "virtual", false);
|
|
30121
|
+
|
|
30110
30122
|
BaseNodeModel_defineProperty(this, "graphModel", void 0);
|
|
30111
30123
|
|
|
30112
30124
|
BaseNodeModel_initializerDefineProperty(this, "zIndex", BaseNodeModel_descriptor15, this);
|
|
@@ -30590,11 +30602,11 @@ var BaseNodeModel_BaseNodeModel = (BaseNodeModel_class = /*#__PURE__*/function (
|
|
|
30590
30602
|
}, {
|
|
30591
30603
|
key: "move",
|
|
30592
30604
|
value: function move(deltaX, deltaY) {
|
|
30593
|
-
var
|
|
30605
|
+
var isIgnoreRule = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
30594
30606
|
var isAllowMoveX = false;
|
|
30595
30607
|
var isAllowMoveY = false;
|
|
30596
30608
|
|
|
30597
|
-
if (
|
|
30609
|
+
if (isIgnoreRule) {
|
|
30598
30610
|
isAllowMoveX = true;
|
|
30599
30611
|
isAllowMoveY = true;
|
|
30600
30612
|
} else {
|
|
@@ -30623,13 +30635,53 @@ var BaseNodeModel_BaseNodeModel = (BaseNodeModel_class = /*#__PURE__*/function (
|
|
|
30623
30635
|
|
|
30624
30636
|
return isAllowMoveX || isAllowMoveY;
|
|
30625
30637
|
}
|
|
30638
|
+
}, {
|
|
30639
|
+
key: "getMoveDistance",
|
|
30640
|
+
value: function getMoveDistance(deltaX, deltaY) {
|
|
30641
|
+
var isIgnoreRule = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
30642
|
+
var isAllowMoveX = false;
|
|
30643
|
+
var isAllowMoveY = false;
|
|
30644
|
+
var moveX = 0;
|
|
30645
|
+
var moveY = 0;
|
|
30646
|
+
|
|
30647
|
+
if (isIgnoreRule) {
|
|
30648
|
+
isAllowMoveX = true;
|
|
30649
|
+
isAllowMoveY = true;
|
|
30650
|
+
} else {
|
|
30651
|
+
var r = this.isAllowMoveNode(deltaX, deltaY);
|
|
30652
|
+
|
|
30653
|
+
if (typeof r === 'boolean') {
|
|
30654
|
+
isAllowMoveX = r;
|
|
30655
|
+
isAllowMoveY = r;
|
|
30656
|
+
} else {
|
|
30657
|
+
isAllowMoveX = r.x;
|
|
30658
|
+
isAllowMoveY = r.y;
|
|
30659
|
+
}
|
|
30660
|
+
}
|
|
30661
|
+
|
|
30662
|
+
if (isAllowMoveX && deltaX) {
|
|
30663
|
+
var targetX = this.x + deltaX;
|
|
30664
|
+
this.x = targetX;
|
|
30665
|
+
this.text && this.moveText(deltaX, 0);
|
|
30666
|
+
moveX = deltaX;
|
|
30667
|
+
}
|
|
30668
|
+
|
|
30669
|
+
if (isAllowMoveY && deltaY) {
|
|
30670
|
+
var targetY = this.y + deltaY;
|
|
30671
|
+
this.y = targetY;
|
|
30672
|
+
this.text && this.moveText(0, deltaY);
|
|
30673
|
+
moveY = deltaY;
|
|
30674
|
+
}
|
|
30675
|
+
|
|
30676
|
+
return [moveX, moveY];
|
|
30677
|
+
}
|
|
30626
30678
|
}, {
|
|
30627
30679
|
key: "moveTo",
|
|
30628
30680
|
value: function moveTo(x, y) {
|
|
30629
|
-
var
|
|
30681
|
+
var isIgnoreRule = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
30630
30682
|
var deltaX = x - this.x;
|
|
30631
30683
|
var deltaY = y - this.y;
|
|
30632
|
-
if (!
|
|
30684
|
+
if (!isIgnoreRule && !this.isAllowMoveNode(deltaX, deltaY)) return false;
|
|
30633
30685
|
|
|
30634
30686
|
if (this.text) {
|
|
30635
30687
|
this.text && this.moveText(deltaX, deltaY);
|
|
@@ -30860,7 +30912,7 @@ var BaseNodeModel_BaseNodeModel = (BaseNodeModel_class = /*#__PURE__*/function (
|
|
|
30860
30912
|
initializer: function initializer() {
|
|
30861
30913
|
return {};
|
|
30862
30914
|
}
|
|
30863
|
-
}), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "incoming", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "incoming"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "outgoing", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "outgoing"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "addNodeMoveRules", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "addNodeMoveRules"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "move", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "move"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "moveTo", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "moveTo"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "moveText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "moveText"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateText"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setSelected", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setSelected"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setHovered", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setHovered"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setHitable", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setHitable"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setElementState", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setElementState"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setProperty", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setProperty"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setProperties", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setProperties"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setStyle", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setStyle"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setStyles", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setStyles"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateStyles", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateStyles"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setZIndex", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setZIndex"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateAttributes", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateAttributes"), BaseNodeModel_class.prototype)), BaseNodeModel_class);
|
|
30915
|
+
}), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "incoming", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "incoming"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "outgoing", [mobx_module["m" /* computed */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "outgoing"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "addNodeMoveRules", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "addNodeMoveRules"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "move", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "move"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "getMoveDistance", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "getMoveDistance"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "moveTo", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "moveTo"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "moveText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "moveText"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateText", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateText"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setSelected", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setSelected"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setHovered", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setHovered"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setHitable", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setHitable"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setElementState", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setElementState"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setProperty", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setProperty"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setProperties", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setProperties"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setStyle", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setStyle"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setStyles", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setStyles"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateStyles", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateStyles"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "setZIndex", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "setZIndex"), BaseNodeModel_class.prototype), BaseNodeModel_applyDecoratedDescriptor(BaseNodeModel_class.prototype, "updateAttributes", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(BaseNodeModel_class.prototype, "updateAttributes"), BaseNodeModel_class.prototype)), BaseNodeModel_class);
|
|
30864
30916
|
|
|
30865
30917
|
// CONCATENATED MODULE: ./src/model/node/CircleNodeModel.ts
|
|
30866
30918
|
function CircleNodeModel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { CircleNodeModel_typeof = function _typeof(obj) { return typeof obj; }; } else { CircleNodeModel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return CircleNodeModel_typeof(obj); }
|
|
@@ -32480,7 +32532,7 @@ var Anchor_Anchor = /*#__PURE__*/function (_Component) {
|
|
|
32480
32532
|
|
|
32481
32533
|
Anchor_defineProperty(Anchor_assertThisInitialized(_this), "onDragEnd", function (event) {
|
|
32482
32534
|
if (_this.t) {
|
|
32483
|
-
|
|
32535
|
+
cancelRaf(_this.t);
|
|
32484
32536
|
}
|
|
32485
32537
|
|
|
32486
32538
|
_this.checkEnd(event);
|
|
@@ -38624,7 +38676,8 @@ var LogicFlow_LogicFlow = /*#__PURE__*/function () {
|
|
|
38624
38676
|
value: function getAreaElement(leftTopPoint, rightBottomPoint) {
|
|
38625
38677
|
var wholeEdge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
38626
38678
|
var wholeNode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
38627
|
-
|
|
38679
|
+
var ignoreHideElement = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
38680
|
+
return this.graphModel.getAreaElement(leftTopPoint, rightBottomPoint, wholeEdge, wholeNode, ignoreHideElement).map(function (element) {
|
|
38628
38681
|
return element.getData();
|
|
38629
38682
|
});
|
|
38630
38683
|
}
|