@logicflow/core 1.2.2 → 1.2.4
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 +25 -22
- package/dist/logic-flow.min.js +1 -1
- package/package.json +1 -1
package/dist/logic-flow.js
CHANGED
|
@@ -23386,11 +23386,12 @@ var formateAnchorConnectValidateData = function formateAnchorConnectValidateData
|
|
|
23386
23386
|
return data;
|
|
23387
23387
|
};
|
|
23388
23388
|
// CONCATENATED MODULE: ./src/util/compatible.ts
|
|
23389
|
-
// 需要进行兼容操作,提供的方法
|
|
23389
|
+
// 需要进行兼容操作,提供的方法
|
|
23390
23390
|
// vue中data会进行Observe, 深拷贝的原始数据对象。
|
|
23391
|
-
|
|
23391
|
+
|
|
23392
|
+
var compatible_formatData = function formatData(data) {
|
|
23392
23393
|
try {
|
|
23393
|
-
return
|
|
23394
|
+
return lodash_es_cloneDeep(data);
|
|
23394
23395
|
} catch (_unused) {
|
|
23395
23396
|
return data;
|
|
23396
23397
|
}
|
|
@@ -23829,7 +23830,7 @@ var BaseEdgeModel_BaseEdgeModel = (BaseEdgeModel_class = /*#__PURE__*/function (
|
|
|
23829
23830
|
}, {
|
|
23830
23831
|
key: "setProperty",
|
|
23831
23832
|
value: function setProperty(key, val) {
|
|
23832
|
-
this.properties[key] =
|
|
23833
|
+
this.properties[key] = compatible_formatData(val);
|
|
23833
23834
|
this.setAttributes();
|
|
23834
23835
|
}
|
|
23835
23836
|
/**
|
|
@@ -23852,7 +23853,7 @@ var BaseEdgeModel_BaseEdgeModel = (BaseEdgeModel_class = /*#__PURE__*/function (
|
|
|
23852
23853
|
}, {
|
|
23853
23854
|
key: "setProperties",
|
|
23854
23855
|
value: function setProperties(properties) {
|
|
23855
|
-
this.properties = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.properties),
|
|
23856
|
+
this.properties = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, Object(mobx_module["I" /* toJS */])(this.properties)), compatible_formatData(properties));
|
|
23856
23857
|
this.setAttributes();
|
|
23857
23858
|
}
|
|
23858
23859
|
/**
|
|
@@ -23884,7 +23885,7 @@ var BaseEdgeModel_BaseEdgeModel = (BaseEdgeModel_class = /*#__PURE__*/function (
|
|
|
23884
23885
|
}, {
|
|
23885
23886
|
key: "setStyle",
|
|
23886
23887
|
value: function setStyle(key, val) {
|
|
23887
|
-
this.style = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.style), {}, BaseEdgeModel_defineProperty({}, key,
|
|
23888
|
+
this.style = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.style), {}, BaseEdgeModel_defineProperty({}, key, compatible_formatData(val)));
|
|
23888
23889
|
}
|
|
23889
23890
|
/**
|
|
23890
23891
|
* 设置边样式,用于插件开发时跳过自定义边的渲染。大多数情况下,不需要使用此方法。
|
|
@@ -23894,7 +23895,7 @@ var BaseEdgeModel_BaseEdgeModel = (BaseEdgeModel_class = /*#__PURE__*/function (
|
|
|
23894
23895
|
}, {
|
|
23895
23896
|
key: "setStyles",
|
|
23896
23897
|
value: function setStyles(styles) {
|
|
23897
|
-
this.style = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.style),
|
|
23898
|
+
this.style = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.style), compatible_formatData(styles));
|
|
23898
23899
|
}
|
|
23899
23900
|
/**
|
|
23900
23901
|
* 设置边样式,用于插件开发时跳过自定义边的渲染。大多数情况下,不需要使用此方法。
|
|
@@ -23904,7 +23905,7 @@ var BaseEdgeModel_BaseEdgeModel = (BaseEdgeModel_class = /*#__PURE__*/function (
|
|
|
23904
23905
|
}, {
|
|
23905
23906
|
key: "updateStyles",
|
|
23906
23907
|
value: function updateStyles(styles) {
|
|
23907
|
-
this.style = BaseEdgeModel_objectSpread({},
|
|
23908
|
+
this.style = BaseEdgeModel_objectSpread({}, compatible_formatData(styles));
|
|
23908
23909
|
}
|
|
23909
23910
|
/**
|
|
23910
23911
|
* 内部方法,处理初始化文本格式
|
|
@@ -23993,7 +23994,7 @@ var BaseEdgeModel_BaseEdgeModel = (BaseEdgeModel_class = /*#__PURE__*/function (
|
|
|
23993
23994
|
}, {
|
|
23994
23995
|
key: "updateText",
|
|
23995
23996
|
value: function updateText(value) {
|
|
23996
|
-
this.text = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, this.text), {}, {
|
|
23997
|
+
this.text = BaseEdgeModel_objectSpread(BaseEdgeModel_objectSpread({}, Object(mobx_module["I" /* toJS */])(this.text)), {}, {
|
|
23997
23998
|
value: value
|
|
23998
23999
|
});
|
|
23999
24000
|
}
|
|
@@ -27235,7 +27236,7 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
|
|
|
27235
27236
|
key: "addNode",
|
|
27236
27237
|
value: function addNode(nodeConfig) {
|
|
27237
27238
|
var eventType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EventType.NODE_ADD;
|
|
27238
|
-
var nodeOriginData =
|
|
27239
|
+
var nodeOriginData = compatible_formatData(nodeConfig); // 添加节点的时候,如果这个节点Id已经存在,则采用新的id
|
|
27239
27240
|
|
|
27240
27241
|
if (nodeOriginData.id && this.nodesMap[nodeConfig.id]) {
|
|
27241
27242
|
delete nodeOriginData.id;
|
|
@@ -27356,7 +27357,7 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
|
|
|
27356
27357
|
}, {
|
|
27357
27358
|
key: "addEdge",
|
|
27358
27359
|
value: function addEdge(edgeConfig) {
|
|
27359
|
-
var edgeOriginData =
|
|
27360
|
+
var edgeOriginData = compatible_formatData(edgeConfig); // 边的类型优先级:自定义>全局>默认
|
|
27360
27361
|
|
|
27361
27362
|
var type = edgeOriginData.type;
|
|
27362
27363
|
|
|
@@ -27663,7 +27664,7 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
|
|
|
27663
27664
|
edgeModel.moveStartPoint(textDistanceX, textDistanceY);
|
|
27664
27665
|
}
|
|
27665
27666
|
|
|
27666
|
-
var targetMoveDistance = nodeIdMap[edgeModel.
|
|
27667
|
+
var targetMoveDistance = nodeIdMap[edgeModel.targetNodeId];
|
|
27667
27668
|
|
|
27668
27669
|
if (targetMoveDistance) {
|
|
27669
27670
|
var _targetMoveDistance = GraphModel_slicedToArray(targetMoveDistance, 2);
|
|
@@ -30081,6 +30082,8 @@ var BezierEdgeModel_BezierEdgeModel = (BezierEdgeModel_class = /*#__PURE__*/func
|
|
|
30081
30082
|
}, {
|
|
30082
30083
|
key: "updatePath",
|
|
30083
30084
|
value: function updatePath(sNext, ePre) {
|
|
30085
|
+
sNext = lodash_es_cloneDeep(sNext);
|
|
30086
|
+
ePre = lodash_es_cloneDeep(ePre);
|
|
30084
30087
|
var start = {
|
|
30085
30088
|
x: this.startPoint.x,
|
|
30086
30089
|
y: this.startPoint.y
|
|
@@ -30936,7 +30939,7 @@ var BaseNodeModel_BaseNodeModel = (BaseNodeModel_class = /*#__PURE__*/function (
|
|
|
30936
30939
|
}, {
|
|
30937
30940
|
key: "updateText",
|
|
30938
30941
|
value: function updateText(value) {
|
|
30939
|
-
this.text = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.text), {}, {
|
|
30942
|
+
this.text = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, Object(mobx_module["I" /* toJS */])(this.text)), {}, {
|
|
30940
30943
|
value: value
|
|
30941
30944
|
});
|
|
30942
30945
|
}
|
|
@@ -30974,13 +30977,13 @@ var BaseNodeModel_BaseNodeModel = (BaseNodeModel_class = /*#__PURE__*/function (
|
|
|
30974
30977
|
}, {
|
|
30975
30978
|
key: "setProperty",
|
|
30976
30979
|
value: function setProperty(key, val) {
|
|
30977
|
-
this.properties = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.properties), {}, BaseNodeModel_defineProperty({}, key,
|
|
30980
|
+
this.properties = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, Object(mobx_module["I" /* toJS */])(this.properties)), {}, BaseNodeModel_defineProperty({}, key, compatible_formatData(val)));
|
|
30978
30981
|
this.setAttributes();
|
|
30979
30982
|
}
|
|
30980
30983
|
}, {
|
|
30981
30984
|
key: "setProperties",
|
|
30982
30985
|
value: function setProperties(properties) {
|
|
30983
|
-
this.properties = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.properties),
|
|
30986
|
+
this.properties = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, Object(mobx_module["I" /* toJS */])(this.properties)), compatible_formatData(properties));
|
|
30984
30987
|
this.setAttributes();
|
|
30985
30988
|
}
|
|
30986
30989
|
}, {
|
|
@@ -30992,17 +30995,17 @@ var BaseNodeModel_BaseNodeModel = (BaseNodeModel_class = /*#__PURE__*/function (
|
|
|
30992
30995
|
}, {
|
|
30993
30996
|
key: "setStyle",
|
|
30994
30997
|
value: function setStyle(key, val) {
|
|
30995
|
-
this.style = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.style), {}, BaseNodeModel_defineProperty({}, key,
|
|
30998
|
+
this.style = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.style), {}, BaseNodeModel_defineProperty({}, key, compatible_formatData(val)));
|
|
30996
30999
|
}
|
|
30997
31000
|
}, {
|
|
30998
31001
|
key: "setStyles",
|
|
30999
31002
|
value: function setStyles(styles) {
|
|
31000
|
-
this.style = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.style),
|
|
31003
|
+
this.style = BaseNodeModel_objectSpread(BaseNodeModel_objectSpread({}, this.style), compatible_formatData(styles));
|
|
31001
31004
|
}
|
|
31002
31005
|
}, {
|
|
31003
31006
|
key: "updateStyles",
|
|
31004
31007
|
value: function updateStyles(styles) {
|
|
31005
|
-
this.style = BaseNodeModel_objectSpread({},
|
|
31008
|
+
this.style = BaseNodeModel_objectSpread({}, compatible_formatData(styles));
|
|
31006
31009
|
}
|
|
31007
31010
|
}, {
|
|
31008
31011
|
key: "setZIndex",
|
|
@@ -38991,7 +38994,7 @@ var LogicFlow_LogicFlow = /*#__PURE__*/function () {
|
|
|
38991
38994
|
value: function setProperties(id, properties) {
|
|
38992
38995
|
var _this$graphModel$getE2;
|
|
38993
38996
|
|
|
38994
|
-
(_this$graphModel$getE2 = this.graphModel.getElement(id)) === null || _this$graphModel$getE2 === void 0 ? void 0 : _this$graphModel$getE2.setProperties(
|
|
38997
|
+
(_this$graphModel$getE2 = this.graphModel.getElement(id)) === null || _this$graphModel$getE2 === void 0 ? void 0 : _this$graphModel$getE2.setProperties(compatible_formatData(properties));
|
|
38995
38998
|
}
|
|
38996
38999
|
}, {
|
|
38997
39000
|
key: "deleteProperty",
|
|
@@ -39205,7 +39208,7 @@ var LogicFlow_LogicFlow = /*#__PURE__*/function () {
|
|
|
39205
39208
|
value: function undo() {
|
|
39206
39209
|
if (!this.history.undoAble()) return; // formatData兼容vue数据
|
|
39207
39210
|
|
|
39208
|
-
var graphData =
|
|
39211
|
+
var graphData = compatible_formatData(this.history.undo());
|
|
39209
39212
|
this.clearSelectElements();
|
|
39210
39213
|
this.graphModel.graphDataToModel(graphData);
|
|
39211
39214
|
}
|
|
@@ -39219,7 +39222,7 @@ var LogicFlow_LogicFlow = /*#__PURE__*/function () {
|
|
|
39219
39222
|
value: function redo() {
|
|
39220
39223
|
if (!this.history.redoAble()) return; // formatData兼容vue数据
|
|
39221
39224
|
|
|
39222
|
-
var graphData =
|
|
39225
|
+
var graphData = compatible_formatData(this.history.redo());
|
|
39223
39226
|
this.clearSelectElements();
|
|
39224
39227
|
this.graphModel.graphDataToModel(graphData);
|
|
39225
39228
|
}
|
|
@@ -39529,7 +39532,7 @@ var LogicFlow_LogicFlow = /*#__PURE__*/function () {
|
|
|
39529
39532
|
}, {
|
|
39530
39533
|
key: "renderRawData",
|
|
39531
39534
|
value: function renderRawData(graphRawData) {
|
|
39532
|
-
this.graphModel.graphDataToModel(
|
|
39535
|
+
this.graphModel.graphDataToModel(compatible_formatData(graphRawData));
|
|
39533
39536
|
|
|
39534
39537
|
if (this.options.history !== false) {
|
|
39535
39538
|
this.history.watch(this.graphModel);
|