@logicflow/core 1.1.29 → 1.1.30

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.
@@ -22413,7 +22413,7 @@ var defaultTheme = {
22413
22413
  stroke: 'red',
22414
22414
  strokeDasharray: '10 10',
22415
22415
  strokeDashoffset: '100%',
22416
- animationName: 'dash',
22416
+ animationName: 'lf_animate_dash',
22417
22417
  animationDuration: '20s',
22418
22418
  animationIterationCount: 'infinite',
22419
22419
  animationTimingFunction: 'linear',
@@ -24797,7 +24797,7 @@ var PolylineEdgeModel_PolylineEdgeModel = (PolylineEdgeModel_class = /*#__PURE__
24797
24797
  });
24798
24798
  }
24799
24799
 
24800
- this.updatePointsAfterDrage(draginngPointList);
24800
+ this.updatePointsAfterDrag(draginngPointList);
24801
24801
  this.draginngPointList = draginngPointList;
24802
24802
  this.setText(Object.assign({}, this.text, this.textPosition));
24803
24803
  return {
@@ -24872,10 +24872,9 @@ var PolylineEdgeModel_PolylineEdgeModel = (PolylineEdgeModel_class = /*#__PURE__
24872
24872
  }
24873
24873
  }
24874
24874
 
24875
- draginngPointList = pointFilter(draginngPointList);
24876
- this.updatePointsAfterDrage(draginngPointList); // step3: 调整到对应外框的位置后,执行updatePointsAfterDrage,找到当前线段和图形的准确交点
24875
+ this.updatePointsAfterDrag(draginngPointList); // step3: 调整到对应外框的位置后,执行updatePointsAfterDrag,找到当前线段和图形的准确交点
24877
24876
 
24878
- this.draginngPointList = draginngPointList;
24877
+ this.draggingPointList = draginngPointList;
24879
24878
  } else if (direction === SegmentDirection.VERTICAL) {
24880
24879
  // 垂直,仅调整x坐标, 与水平调整同理
24881
24880
  pointsList[startIndex] = {
@@ -24923,9 +24922,8 @@ var PolylineEdgeModel_PolylineEdgeModel = (PolylineEdgeModel_class = /*#__PURE__
24923
24922
  }
24924
24923
  }
24925
24924
 
24926
- _draginngPointList = pointFilter(_draginngPointList);
24927
- this.updatePointsAfterDrage(_draginngPointList);
24928
- this.draginngPointList = _draginngPointList;
24925
+ this.updatePointsAfterDrag(_draginngPointList);
24926
+ this.draggingPointList = _draginngPointList;
24929
24927
  }
24930
24928
 
24931
24929
  this.setText(Object.assign({}, this.text, this.textPosition));
@@ -24941,7 +24939,7 @@ var PolylineEdgeModel_PolylineEdgeModel = (PolylineEdgeModel_class = /*#__PURE__
24941
24939
  key: "dragAppendEnd",
24942
24940
  value: function dragAppendEnd() {
24943
24941
  if (this.draginngPointList) {
24944
- var pointsList = points2PointsList(this.points); // 更新pointsList,重新渲染appendWidth
24942
+ var pointsList = pointFilter(points2PointsList(this.points)); // 更新pointsList,重新渲染appendWidth
24945
24943
 
24946
24944
  this.pointsList = pointsList.map(function (i) {
24947
24945
  return i;
@@ -24963,8 +24961,8 @@ var PolylineEdgeModel_PolylineEdgeModel = (PolylineEdgeModel_class = /*#__PURE__
24963
24961
  */
24964
24962
 
24965
24963
  }, {
24966
- key: "updatePointsAfterDrage",
24967
- value: function updatePointsAfterDrage(pointsList) {
24964
+ key: "updatePointsAfterDrag",
24965
+ value: function updatePointsAfterDrag(pointsList) {
24968
24966
  // 找到准确的连接点后,更新points, 更新边,同时更新依赖points的箭头
24969
24967
  var list = this.updateCrossPoints(pointsList);
24970
24968
  this.points = list.map(function (point) {
@@ -25010,7 +25008,7 @@ var PolylineEdgeModel_PolylineEdgeModel = (PolylineEdgeModel_class = /*#__PURE__
25010
25008
  enumerable: true,
25011
25009
  writable: true,
25012
25010
  initializer: null
25013
- }), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "initPoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "initPoints"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updatePoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updatePoints"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateStartPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "moveStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "moveStartPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateEndPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "moveEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "moveEndPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendStart", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendStart"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendSimple", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendSimple"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppend", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppend"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendEnd"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updatePointsAfterDrage", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updatePointsAfterDrage"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "getAdjustStart", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "getAdjustStart"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "getAdjustEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "getAdjustEnd"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd"), PolylineEdgeModel_class.prototype)), PolylineEdgeModel_class);
25011
+ }), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "initPoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "initPoints"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updatePoints", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updatePoints"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateStartPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "moveStartPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "moveStartPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateEndPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "moveEndPoint", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "moveEndPoint"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendStart", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendStart"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendSimple", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendSimple"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppend", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppend"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "dragAppendEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "dragAppendEnd"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updatePointsAfterDrag", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updatePointsAfterDrag"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "getAdjustStart", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "getAdjustStart"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "getAdjustEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "getAdjustEnd"), PolylineEdgeModel_class.prototype), PolylineEdgeModel_applyDecoratedDescriptor(PolylineEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd", [mobx_module["k" /* action */]], Object.getOwnPropertyDescriptor(PolylineEdgeModel_class.prototype, "updateAfterAdjustStartAndEnd"), PolylineEdgeModel_class.prototype)), PolylineEdgeModel_class);
25014
25012
 
25015
25013
  // CONCATENATED MODULE: ./src/algorithm/index.ts
25016
25014
  // 各类算法的实现
@@ -26525,8 +26523,7 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
26525
26523
  return a.zIndex - b.zIndex;
26526
26524
  }); // 只显示可见区域的节点和边
26527
26525
 
26528
- var showElements = [];
26529
- var topElementIdx = -1; // todo: 缓存, 优化计算效率
26526
+ var showElements = []; // todo: 缓存, 优化计算效率
26530
26527
 
26531
26528
  var visibleLt = [-VisibleMoreSpace, -VisibleMoreSpace];
26532
26529
  var visibleRb = [this.width + VisibleMoreSpace, this.height + VisibleMoreSpace];
@@ -26535,20 +26532,10 @@ var GraphModel_GraphModel = (GraphModel_class = /*#__PURE__*/function () {
26535
26532
  var currentItem = elements[i]; // 如果节点不在可见区域,且不是全元素显示模式,则隐藏节点。
26536
26533
 
26537
26534
  if (currentItem.visible && (!this.partial || currentItem.isSelected || this.isElementInArea(currentItem, visibleLt, visibleRb, false, false))) {
26538
- if (currentItem.zIndex === ElementMaxzIndex) {
26539
- topElementIdx = showElements.length;
26540
- }
26541
-
26542
26535
  showElements.push(currentItem);
26543
26536
  }
26544
26537
  }
26545
26538
 
26546
- if (topElementIdx !== -1) {
26547
- var lastElement = showElements[showElements.length - 1];
26548
- showElements[showElements.length - 1] = showElements[topElementIdx];
26549
- showElements[topElementIdx] = lastElement;
26550
- }
26551
-
26552
26539
  return showElements;
26553
26540
  }
26554
26541
  /**
@@ -35334,7 +35321,7 @@ var BaseEdge_BaseEdge = /*#__PURE__*/function (_Component) {
35334
35321
  _this.toFront();
35335
35322
  });
35336
35323
 
35337
- BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "getIsDraging", function () {
35324
+ BaseEdge_defineProperty(BaseEdge_assertThisInitialized(_this), "getIsDragging", function () {
35338
35325
  return false;
35339
35326
  });
35340
35327
 
@@ -35519,7 +35506,7 @@ var BaseEdge_BaseEdge = /*#__PURE__*/function (_Component) {
35519
35506
  isSelected = _this$props8$model.isSelected,
35520
35507
  isHitable = _this$props8$model.isHitable,
35521
35508
  graphModel = _this$props8.graphModel;
35522
- var isDraging = this.getIsDraging();
35509
+ var isDragging = this.getIsDragging();
35523
35510
  var adjustEdgeStartAndEnd = graphModel.editConfigModel.adjustEdgeStartAndEnd,
35524
35511
  animation = graphModel.animation; // performance 只允许出现一条edge有动画
35525
35512
 
@@ -35532,7 +35519,7 @@ var BaseEdge_BaseEdge = /*#__PURE__*/function (_Component) {
35532
35519
  onMouseOver: this.setHoverON,
35533
35520
  onMouseEnter: this.setHoverON,
35534
35521
  onMouseLeave: this.setHoverOFF
35535
- }, this.getShape(), this.getAppend(), isShowAnimation && this.getAnimation(), this.getText(), this.getArrow()), adjustEdgeStartAndEnd && isSelected && !isDraging ? this.getAdjustPoints() : '');
35522
+ }, this.getShape(), this.getAppend(), isShowAnimation && this.getAnimation(), this.getText(), this.getArrow()), adjustEdgeStartAndEnd && isSelected && !isDragging ? this.getAdjustPoints() : '');
35536
35523
  }
35537
35524
  }]);
35538
35525
 
@@ -35953,7 +35940,7 @@ var PolylineEdge_PolylineEdge = /*#__PURE__*/function (_BaseEdge) {
35953
35940
  _this.appendInfo = appendInfo;
35954
35941
  });
35955
35942
 
35956
- PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "getIsDraging", function () {
35943
+ PolylineEdge_defineProperty(PolylineEdge_assertThisInitialized(_this), "getIsDragging", function () {
35957
35944
  return _this.isDraging;
35958
35945
  });
35959
35946
 
@@ -37119,18 +37106,17 @@ var TextEditTool_TextEdit = src_observer(TextEditTool_class = (_temp = _class2 =
37119
37106
 
37120
37107
 
37121
37108
  var graphModel = this.props.graphModel;
37122
- var eventCenter = graphModel.eventCenter,
37123
- _graphModel$editConfi = graphModel.editConfigModel,
37124
- edgeTextEdit = _graphModel$editConfi.edgeTextEdit,
37125
- nodeTextEdit = _graphModel$editConfi.nodeTextEdit;
37109
+ var eventCenter = graphModel.eventCenter;
37110
+ eventCenter.on("".concat(EventType.GRAPH_TRANSFORM, ",").concat(EventType.NODE_CLICK, ",").concat(EventType.BLANK_CLICK, " "), function () {
37111
+ var textEditElement = graphModel.textEditElement,
37112
+ _graphModel$editConfi = graphModel.editConfigModel,
37113
+ edgeTextEdit = _graphModel$editConfi.edgeTextEdit,
37114
+ nodeTextEdit = _graphModel$editConfi.nodeTextEdit; // fix #826, 保留之前的文本可以编辑点击空白才设置为不可编辑。如果以后有其他需求再改。
37126
37115
 
37127
- if (edgeTextEdit || nodeTextEdit) {
37128
- eventCenter.on("".concat(EventType.GRAPH_TRANSFORM, ",").concat(EventType.NODE_CLICK, ",").concat(EventType.BLANK_CLICK, " "), function () {
37129
- if (graphModel.textEditElement) {
37130
- graphModel.textEditElement.setElementState(ElementState.DEFAULT);
37131
- }
37132
- });
37133
- }
37116
+ if ((edgeTextEdit || nodeTextEdit) && textEditElement) {
37117
+ graphModel.textEditElement.setElementState(ElementState.DEFAULT);
37118
+ }
37119
+ });
37134
37120
  }
37135
37121
  }, {
37136
37122
  key: "componentDidUpdate",
@@ -38216,15 +38202,17 @@ var LogicFlow_LogicFlow = /*#__PURE__*/function () {
38216
38202
  * 将图形选中
38217
38203
  * @param id 选择元素ID
38218
38204
  * @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置
38205
+ * @param toFront 是否将选中的元素置顶,默认为true
38219
38206
  */
38220
38207
 
38221
38208
  }, {
38222
38209
  key: "selectElementById",
38223
38210
  value: function selectElementById(id) {
38224
38211
  var multiple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
38212
+ var toFront = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
38225
38213
  this.graphModel.selectElementById(id, multiple);
38226
38214
 
38227
- if (!multiple) {
38215
+ if (!multiple && toFront) {
38228
38216
  this.graphModel.toFront(id);
38229
38217
  }
38230
38218
  }