@logicflow/extension 0.7.16 → 1.0.0-alpha.10

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.
Files changed (82) hide show
  1. package/cjs/NodeResize/Control/Control.js +4 -4
  2. package/cjs/NodeResize/Control/ControlGroup.js +4 -3
  3. package/cjs/NodeResize/Node/DiamondResize.js +18 -9
  4. package/cjs/NodeResize/Node/EllipseResize.js +23 -12
  5. package/cjs/NodeResize/Node/RectResize.js +11 -16
  6. package/cjs/bpmn/events/EndEvent.js +19 -10
  7. package/cjs/bpmn/events/StartEvent.js +4 -16
  8. package/cjs/bpmn/gateways/ExclusiveGateway.js +16 -14
  9. package/cjs/bpmn/index.js +1 -1
  10. package/cjs/bpmn/tasks/ServiceTask.js +20 -17
  11. package/cjs/bpmn/tasks/UserTask.js +20 -16
  12. package/cjs/bpmn-adapter/index.js +1 -1
  13. package/cjs/components/context-menu/index.js +3 -3
  14. package/cjs/components/menu/index.js +6 -6
  15. package/cjs/components/mini-map/index.js +2 -2
  16. package/cjs/components/selection-select/index.js +1 -1
  17. package/cjs/index.js +1 -0
  18. package/cjs/insert-node-in-polyline/index.js +3 -3
  19. package/cjs/materials/curved-edge/index.js +2 -1
  20. package/cjs/materials/group/GroupNode.js +1 -5
  21. package/cjs/materials/group/index.js +4 -4
  22. package/cjs/tools/auto-layout/index.js +8 -8
  23. package/cjs/tools/snapshot/index.js +3 -3
  24. package/es/NodeResize/Control/Control.d.ts +1 -3
  25. package/es/NodeResize/Control/Control.js +4 -4
  26. package/es/NodeResize/Control/ControlGroup.d.ts +1 -8
  27. package/es/NodeResize/Control/ControlGroup.js +4 -3
  28. package/es/NodeResize/Node/DiamondResize.d.ts +3 -2
  29. package/es/NodeResize/Node/DiamondResize.js +18 -9
  30. package/es/NodeResize/Node/EllipseResize.d.ts +4 -2
  31. package/es/NodeResize/Node/EllipseResize.js +23 -12
  32. package/es/NodeResize/Node/RectResize.d.ts +2 -1
  33. package/es/NodeResize/Node/RectResize.js +11 -16
  34. package/es/bpmn/events/EndEvent.d.ts +1 -0
  35. package/es/bpmn/events/EndEvent.js +19 -10
  36. package/es/bpmn/events/StartEvent.d.ts +1 -25
  37. package/es/bpmn/events/StartEvent.js +4 -16
  38. package/es/bpmn/gateways/ExclusiveGateway.js +16 -14
  39. package/es/bpmn/index.js +1 -1
  40. package/es/bpmn/tasks/ServiceTask.js +20 -17
  41. package/es/bpmn/tasks/UserTask.js +20 -16
  42. package/es/bpmn-adapter/index.js +1 -1
  43. package/es/components/context-menu/index.js +3 -3
  44. package/es/components/menu/index.js +6 -6
  45. package/es/components/mini-map/index.js +2 -2
  46. package/es/components/selection-select/index.js +1 -1
  47. package/es/index.js +1 -0
  48. package/es/insert-node-in-polyline/index.js +3 -3
  49. package/es/materials/curved-edge/index.js +2 -1
  50. package/es/materials/group/GroupNode.d.ts +0 -12
  51. package/es/materials/group/GroupNode.js +1 -5
  52. package/es/materials/group/index.js +4 -4
  53. package/es/tools/auto-layout/index.d.ts +4 -4
  54. package/es/tools/auto-layout/index.js +8 -8
  55. package/es/tools/snapshot/index.js +3 -3
  56. package/lib/AutoLayout.js +1 -1
  57. package/lib/BpmnAdapter.js +1 -1
  58. package/lib/BpmnElement.js +1 -1
  59. package/lib/ContextMenu.js +1 -1
  60. package/lib/Control.js +1 -1
  61. package/lib/CurvedEdge.js +1 -1
  62. package/lib/DndPanel.js +1 -1
  63. package/lib/FlowPath.js +1 -1
  64. package/lib/Group.js +1 -1
  65. package/lib/InsertNodeInPolyline.js +1 -1
  66. package/lib/Menu.js +1 -1
  67. package/lib/MiniMap.js +1 -1
  68. package/lib/NodeResize.js +1 -1
  69. package/lib/RectLabelNode.js +1 -1
  70. package/lib/SelectionSelect.js +1 -1
  71. package/lib/Snapshot.js +1 -1
  72. package/lib/TurboAdapter.js +1 -1
  73. package/package.json +2 -2
  74. package/types/NodeResize/Control/Control.d.ts +1 -3
  75. package/types/NodeResize/Control/ControlGroup.d.ts +1 -8
  76. package/types/NodeResize/Node/DiamondResize.d.ts +3 -2
  77. package/types/NodeResize/Node/EllipseResize.d.ts +4 -2
  78. package/types/NodeResize/Node/RectResize.d.ts +2 -1
  79. package/types/bpmn/events/EndEvent.d.ts +1 -0
  80. package/types/bpmn/events/StartEvent.d.ts +1 -25
  81. package/types/materials/group/GroupNode.d.ts +0 -12
  82. package/types/tools/auto-layout/index.d.ts +4 -4
@@ -60,19 +60,19 @@ var InsertNodeInPolyline = {
60
60
  },
61
61
  insetNode: function (nodeData) {
62
62
  var edges = this._lf.graphModel.edges;
63
- var nodeModel = this._lf.getNodeModel(nodeData.id);
63
+ var nodeModel = this._lf.getNodeModelById(nodeData.id);
64
64
  for (var i = 0; i < edges.length; i++) {
65
65
  // eslint-disable-next-line max-len
66
66
  var _a = edge_1.isNodeInSegement(nodeModel, edges[i]), crossIndex = _a.crossIndex, crossPoints = _a.crossPoints;
67
67
  if (crossIndex >= 0) {
68
68
  var _b = edges[i], sourceNodeId = _b.sourceNodeId, targetNodeId = _b.targetNodeId, id = _b.id, type = _b.type, pointsList = _b.pointsList;
69
- this._lf.createEdge({
69
+ this._lf.addEdge({
70
70
  type: type,
71
71
  sourceNodeId: sourceNodeId,
72
72
  targetNodeId: nodeData.id,
73
73
  pointsList: __spread(pointsList.slice(0, crossIndex), [crossPoints.startCrossPoint]),
74
74
  });
75
- this._lf.createEdge({
75
+ this._lf.addEdge({
76
76
  type: type,
77
77
  sourceNodeId: nodeData.id,
78
78
  targetNodeId: targetNodeId,
@@ -37,7 +37,8 @@ var CurvedEdgeView = /** @class */ (function (_super) {
37
37
  return _super !== null && _super.apply(this, arguments) || this;
38
38
  }
39
39
  CurvedEdgeView.prototype.getEdge = function () {
40
- var _a = this.getAttributes(), points = _a.points, strokeWidth = _a.strokeWidth, stroke = _a.stroke, strokeDashArray = _a.strokeDashArray;
40
+ var _a = this.props.model.getEdgeStyle(), strokeWidth = _a.strokeWidth, stroke = _a.stroke, strokeDashArray = _a.strokeDashArray;
41
+ var points = this.props.model.points;
41
42
  var points2 = points.split(' ').map(function (p) { return p.split(',').map(function (a) { return Number(a); }); });
42
43
  var _b = __read(points2[0], 2), startX = _b[0], startY = _b[1];
43
44
  var d = "M" + startX + " " + startY;
@@ -48,6 +48,7 @@ var GroupNodeModel = /** @class */ (function (_super) {
48
48
  this.height = 200;
49
49
  this.strokeWidth = 1;
50
50
  this.zIndex = 0;
51
+ this.radius = 0;
51
52
  };
52
53
  /**
53
54
  * 设置是否允许子节点被拖动移除分组
@@ -93,11 +94,6 @@ var GroupNode = /** @class */ (function (_super) {
93
94
  * 重新toFront,阻止其置顶
94
95
  */
95
96
  GroupNode.prototype.toFront = function () { };
96
- GroupNode.prototype.getShapeStyle = function () {
97
- var shape = _super.prototype.getShapeStyle.call(this);
98
- shape.radius = 0;
99
- return shape;
100
- };
101
97
  return GroupNode;
102
98
  }(core_1.RectNode));
103
99
  exports.default = {
@@ -32,13 +32,13 @@ var Group = /** @class */ (function () {
32
32
  // 如果这个节点之前已经在group中了,则将其从之前的group中移除
33
33
  var preGroupId = _this.nodeGroupMap.get(data.id);
34
34
  if (preGroupId) {
35
- var preGroup = _this.lf.getNodeModel(preGroupId);
35
+ var preGroup = _this.lf.getNodeModelById(preGroupId);
36
36
  preGroup.removeChild(data.id);
37
37
  _this.nodeGroupMap.delete(data.id);
38
38
  preGroup.setAllowAppendChild(false);
39
39
  }
40
40
  // 然后再判断这个节点是否在某个group中,如果在,则将其添加到对应的group中
41
- var bounds = _this.lf.getNodeModel(data.id).getBounds();
41
+ var bounds = _this.lf.getNodeModelById(data.id).getBounds();
42
42
  var group = _this.getGroup(bounds);
43
43
  if (group && data.id !== group.id) {
44
44
  group.addChild(data.id);
@@ -52,7 +52,7 @@ var Group = /** @class */ (function () {
52
52
  _this.activeGroup.setAllowAppendChild(false);
53
53
  _this.activeGroup = undefined;
54
54
  }
55
- var bounds = _this.lf.getNodeModel(data.id).getBounds();
55
+ var bounds = _this.lf.getNodeModelById(data.id).getBounds();
56
56
  _this.activeGroup = _this.getGroup(bounds);
57
57
  if (_this.activeGroup && _this.activeGroup.id !== data.id) {
58
58
  _this.activeGroup.setAllowAppendChild(true);
@@ -65,7 +65,7 @@ var Group = /** @class */ (function () {
65
65
  lf.graphModel.moveNodes(__spread(model.children), deltaX, deltaY, true);
66
66
  return true;
67
67
  }
68
- var groupModel = lf.getNodeModel(_this.nodeGroupMap.get(model.id));
68
+ var groupModel = lf.getNodeModelById(_this.nodeGroupMap.get(model.id));
69
69
  if (groupModel && groupModel.isRestrict) { // 如果移动的节点存在分组中,且这个分组禁止子节点移出去。
70
70
  var _a = model.getBounds(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
71
71
  var r = groupModel.isInRange({
@@ -37,7 +37,7 @@ var AutoLayout = /** @class */ (function () {
37
37
  return _this.layout(data, path);
38
38
  };
39
39
  }
40
- // 1) 将所有节点和连线的坐标删除。节点上的文本改成偏移量。
40
+ // 1) 将所有节点和边的坐标删除。节点上的文本改成偏移量。
41
41
  // 2) 找到长度最长的路径,作为基准路径。
42
42
  // 3) 依次计算
43
43
  // 拿到最长的路径。
@@ -97,9 +97,9 @@ var AutoLayout = /** @class */ (function () {
97
97
  _this.setNodePosition(nextInfo.nodeId, nodeMap, newGraphData, xLevel + 1, nextYLevel + 1);
98
98
  }
99
99
  else {
100
- // todo: 如果下一个节点是已经定位的,则需要考虑连线的规避
100
+ // todo: 如果下一个节点是已经定位的,则需要考虑边的规避
101
101
  }
102
- // 设置连接到下一个节点的连线
102
+ // 设置连接到下一个节点的边
103
103
  // 1) 起始位置为source节点的下方,结束位置为target节点左边。
104
104
  // 2) 计算折线
105
105
  newGraphData.edges.push(__assign({ id: nextInfo.edgeId, type: nextInfo.edgeType, sourceNodeId: nodeId, targetNodeId: nextInfo.nodeId, properties: nextInfo.properties, text: nextInfo.text }, _this.getEdgeDataPoints(nodeId, nextInfo.nodeId)));
@@ -108,8 +108,8 @@ var AutoLayout = /** @class */ (function () {
108
108
  return nodeData;
109
109
  };
110
110
  /**
111
- * 1. 处理连线上的文本
112
- * 2. 主干节点之间直接的连线
111
+ * 1. 处理边上的文本
112
+ * 2. 主干节点之间直接的边
113
113
  * 3. 一个节点被多个连接作为目标节点,合理分配锚点位置。
114
114
  */
115
115
  AutoLayout.prototype.getEdgeDataPoints = function (sourceNodeId, targetNodeId) {
@@ -148,7 +148,7 @@ var AutoLayout = /** @class */ (function () {
148
148
  };
149
149
  };
150
150
  /**
151
- * 获取连线的连接节点相对位置。
151
+ * 获取边的连接节点相对位置。
152
152
  * source一定在target左边。
153
153
  * 1. 如果source和target在同一x, y坐标内容。
154
154
  * 2. 如果source在target左上方。
@@ -170,10 +170,10 @@ var AutoLayout = /** @class */ (function () {
170
170
  return postionType;
171
171
  };
172
172
  /**
173
- * 获取连线节点图形的宽高。
173
+ * 获取边节点图形的宽高。
174
174
  */
175
175
  AutoLayout.prototype.getShape = function (nodeId) {
176
- var nodeModel = this.lf.getNodeModel(nodeId);
176
+ var nodeModel = this.lf.getNodeModelById(nodeId);
177
177
  return {
178
178
  height: nodeModel.height,
179
179
  width: nodeModel.width,
@@ -125,7 +125,7 @@ var Snapshot = {
125
125
  if (childLength) {
126
126
  for (var i = 0; i < childLength; i++) {
127
127
  var lfLayer = graph.childNodes[i];
128
- // 只保留包含节点和连线的基础图层进行下载,其他图层删除
128
+ // 只保留包含节点和边的基础图层进行下载,其他图层删除
129
129
  var layerClassList = lfLayer.classList && Array.from(lfLayer.classList);
130
130
  if (layerClassList && layerClassList.indexOf('lf-base') < 0) {
131
131
  graph.removeChild(graph.childNodes[i]);
@@ -154,8 +154,8 @@ var Snapshot = {
154
154
  var base = document.getElementsByClassName('lf-base')[0];
155
155
  var bbox = base.getBoundingClientRect();
156
156
  var graphModel = this.lf.graphModel;
157
- var transformMatrix = graphModel.transformMatrix;
158
- var SCALE_X = transformMatrix.SCALE_X, SCALE_Y = transformMatrix.SCALE_Y;
157
+ var transformModel = graphModel.transformModel;
158
+ var SCALE_X = transformModel.SCALE_X, SCALE_Y = transformModel.SCALE_Y;
159
159
  var bboxWidth = Math.ceil(bbox.width / SCALE_X);
160
160
  var bboxHeight = Math.ceil(bbox.height / SCALE_Y);
161
161
  // width,height 值加40,保证图形不会紧贴着下载图片的右边和下边
@@ -4,11 +4,9 @@ interface IProps {
4
4
  index: number;
5
5
  x: number;
6
6
  y: number;
7
- nodeModel: BaseNodeModel;
7
+ model: BaseNodeModel;
8
8
  graphModel: GraphModel;
9
9
  style?: CSSStyleDeclaration;
10
- hoverStyle?: CSSStyleDeclaration;
11
- edgeStyle?: CSSStyleDeclaration;
12
10
  }
13
11
  declare class Control extends Component<IProps> {
14
12
  dragHandler: Function;
@@ -118,7 +118,7 @@ var Control = /** @class */ (function (_super) {
118
118
  beforeNode: beforeNode,
119
119
  afterNode: afterNode,
120
120
  };
121
- // 更新连线
121
+ // 更新边
122
122
  var afterPoint;
123
123
  edges.sourceEdges.forEach(function (item) {
124
124
  params.point = item.startPoint;
@@ -181,7 +181,7 @@ var Control = /** @class */ (function (_super) {
181
181
  beforeNode: beforeNode,
182
182
  afterNode: afterNode,
183
183
  };
184
- // 更新连线
184
+ // 更新边
185
185
  var afterPoint;
186
186
  edges.sourceEdges.forEach(function (item) {
187
187
  params.point = item.startPoint;
@@ -243,7 +243,7 @@ var Control = /** @class */ (function (_super) {
243
243
  beforeNode: beforeNode,
244
244
  afterNode: afterNode,
245
245
  };
246
- // 更新连线
246
+ // 更新边
247
247
  var afterPoint;
248
248
  var edges = _this.getNodeEdges(id);
249
249
  edges.sourceEdges.forEach(function (item) {
@@ -279,7 +279,7 @@ var Control = /** @class */ (function (_super) {
279
279
  }
280
280
  };
281
281
  _this.index = props.index;
282
- _this.nodeModel = props.nodeModel;
282
+ _this.nodeModel = props.model;
283
283
  _this.graphModel = props.graphModel;
284
284
  var gridSize = _this.graphModel.gridSize;
285
285
  // 为保证对齐线功能正常使用,step默认是网格grid的两倍,
@@ -1,15 +1,8 @@
1
1
  import { h, Component } from 'preact';
2
2
  import { BaseNodeModel, GraphModel } from '@logicflow/core';
3
3
  interface IProps {
4
- x: number;
5
- y: number;
6
- width: number;
7
- height: number;
8
- nodeModel: BaseNodeModel;
4
+ model: BaseNodeModel;
9
5
  graphModel: GraphModel;
10
- style?: CSSStyleDeclaration;
11
- hoverStyle?: CSSStyleDeclaration;
12
- edgeStyle?: CSSStyleDeclaration;
13
6
  }
14
7
  declare class ControlGroup extends Component<IProps> {
15
8
  constructor();
@@ -34,7 +34,8 @@ var ControlGroup = /** @class */ (function (_super) {
34
34
  return _this;
35
35
  }
36
36
  ControlGroup.prototype.getResizeControl = function () {
37
- var _a = this.props, x = _a.x, y = _a.y, width = _a.width, height = _a.height, nodeModel = _a.nodeModel, graphModel = _a.graphModel;
37
+ var _a = this.props, model = _a.model, graphModel = _a.graphModel;
38
+ var x = model.x, y = model.y, width = model.width, height = model.height;
38
39
  var box = {
39
40
  minX: x - width / 2,
40
41
  minY: y - height / 2,
@@ -60,11 +61,11 @@ var ControlGroup = /** @class */ (function (_super) {
60
61
  y: maxY,
61
62
  },
62
63
  ];
63
- return controlList.map(function (control, index) { return (h(Control, __assign({ index: index }, control, { nodeModel: nodeModel, graphModel: graphModel }))); });
64
+ return controlList.map(function (control, index) { return (h(Control, __assign({ index: index }, control, { model: model, graphModel: graphModel }))); });
64
65
  };
65
66
  // 一般节点被选中了会有outline, 先不用这个
66
67
  ControlGroup.prototype.getGroupSolid = function () {
67
- var _a = this.props, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
68
+ var _a = this.props.model, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
68
69
  var _b = NodeResize.style.outline, stroke = _b.stroke, strokeWidth = _b.strokeWidth, strokeDasharray = _b.strokeDasharray;
69
70
  return (h(Rect, { fill: "none", x: x, y: y, width: width, height: height, stroke: stroke, strokeWidth: strokeWidth, strokeDasharray: strokeDasharray }));
70
71
  };
@@ -1,10 +1,11 @@
1
1
  import { h, DiamondNode, DiamondNodeModel } from '@logicflow/core';
2
2
  declare class DiamondResizeModel extends DiamondNodeModel {
3
+ getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
3
4
  setAttributes(): void;
4
5
  }
5
6
  declare class DiamondResizeView extends DiamondNode {
6
- getControlGroup(attributes: any): h.JSX.Element;
7
- getResizeShape(arrt: any): h.JSX.Element;
7
+ getControlGroup(): h.JSX.Element;
8
+ getResizeShape(): h.JSX.Element;
8
9
  getShape(): h.JSX.Element;
9
10
  }
10
11
  declare const EllipseResize: {
@@ -30,8 +30,15 @@ var DiamondResizeModel = /** @class */ (function (_super) {
30
30
  function DiamondResizeModel() {
31
31
  return _super !== null && _super.apply(this, arguments) || this;
32
32
  }
33
+ DiamondResizeModel.prototype.getOutlineStyle = function () {
34
+ var style = _super.prototype.getOutlineStyle.call(this);
35
+ style.stroke = 'none';
36
+ if (style.hover) {
37
+ style.hover.stroke = 'none';
38
+ }
39
+ return style;
40
+ };
33
41
  DiamondResizeModel.prototype.setAttributes = function () {
34
- this.hideOutline = true;
35
42
  // @ts-ignore
36
43
  var nodeSize = this.properties.nodeSize;
37
44
  if (nodeSize) {
@@ -46,21 +53,23 @@ var DiamondResizeView = /** @class */ (function (_super) {
46
53
  function DiamondResizeView() {
47
54
  return _super !== null && _super.apply(this, arguments) || this;
48
55
  }
49
- DiamondResizeView.prototype.getControlGroup = function (attributes) {
56
+ DiamondResizeView.prototype.getControlGroup = function () {
50
57
  var _a = this.props, model = _a.model, graphModel = _a.graphModel;
51
- return (h(ControlGroup, __assign({}, attributes, { nodeModel: model, graphModel: graphModel })));
58
+ return (h(ControlGroup, { model: model, graphModel: graphModel }));
52
59
  };
53
60
  // getResizeShape绘制图形,功能等同于基础菱形的getShape功能,可以通过复写此方法,进行节点自定义
54
- DiamondResizeView.prototype.getResizeShape = function (arrt) {
55
- return h("g", null,
56
- h(Polygon, __assign({}, arrt)));
61
+ DiamondResizeView.prototype.getResizeShape = function () {
62
+ var model = this.props.model;
63
+ var points = model.points;
64
+ var style = model.getNodeStyle();
65
+ return (h("g", null,
66
+ h(Polygon, __assign({}, style, { points: points }))));
57
67
  };
58
68
  DiamondResizeView.prototype.getShape = function () {
59
- var attributes = _super.prototype.getAttributes.call(this);
60
69
  var isSelected = this.props.model.isSelected;
61
70
  return (h("g", null,
62
- this.getResizeShape(attributes),
63
- isSelected ? this.getControlGroup(attributes) : ''));
71
+ this.getResizeShape(),
72
+ isSelected ? this.getControlGroup() : ''));
64
73
  };
65
74
  return DiamondResizeView;
66
75
  }(DiamondNode));
@@ -4,11 +4,13 @@ declare class EllipseResizeModel extends EllipseNodeModel {
4
4
  minHeight: number;
5
5
  maxWidth: number;
6
6
  maxHeight: number;
7
+ constructor(data: any, graphModel: any);
8
+ getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
7
9
  setAttributes(): void;
8
10
  }
9
11
  declare class EllipseResizeView extends EllipseNode {
10
- getControlGroup(attributes: any): h.JSX.Element;
11
- getResizeShape(arrt: any): h.JSX.Element;
12
+ getControlGroup(): h.JSX.Element;
13
+ getResizeShape(): h.JSX.Element;
12
14
  getShape(): h.JSX.Element;
13
15
  }
14
16
  declare const EllipseResize: {
@@ -27,16 +27,25 @@ import ControlGroup from '../Control/ControlGroup';
27
27
  import Ellipse from '../BasicShape/Ellipse';
28
28
  var EllipseResizeModel = /** @class */ (function (_super) {
29
29
  __extends(EllipseResizeModel, _super);
30
- function EllipseResizeModel() {
31
- var _this = _super !== null && _super.apply(this, arguments) || this;
30
+ function EllipseResizeModel(data, graphModel) {
31
+ var _this = _super.call(this, data, graphModel) || this;
32
32
  _this.minWidth = 30;
33
33
  _this.minHeight = 30;
34
34
  _this.maxWidth = 2000;
35
35
  _this.maxHeight = 2000;
36
+ _this.rx = 50;
37
+ _this.ry = 50;
36
38
  return _this;
37
39
  }
40
+ EllipseResizeModel.prototype.getOutlineStyle = function () {
41
+ var style = _super.prototype.getOutlineStyle.call(this);
42
+ style.stroke = 'none';
43
+ if (style.hover) {
44
+ style.hover.stroke = 'none';
45
+ }
46
+ return style;
47
+ };
38
48
  EllipseResizeModel.prototype.setAttributes = function () {
39
- this.hideOutline = true;
40
49
  // @ts-ignore
41
50
  var nodeSize = this.properties.nodeSize;
42
51
  if (nodeSize) {
@@ -51,21 +60,23 @@ var EllipseResizeView = /** @class */ (function (_super) {
51
60
  function EllipseResizeView() {
52
61
  return _super !== null && _super.apply(this, arguments) || this;
53
62
  }
54
- EllipseResizeView.prototype.getControlGroup = function (attributes) {
63
+ EllipseResizeView.prototype.getControlGroup = function () {
55
64
  var _a = this.props, model = _a.model, graphModel = _a.graphModel;
56
- return (h(ControlGroup, __assign({}, attributes, { nodeModel: model, graphModel: graphModel })));
65
+ return (h(ControlGroup, { model: model, graphModel: graphModel }));
57
66
  };
58
67
  // getResizeShape绘制图形,功能等同于基础椭圆的getShape功能,可以通过复写此方法,进行节点自定义
59
- EllipseResizeView.prototype.getResizeShape = function (arrt) {
60
- return h("g", null,
61
- h(Ellipse, __assign({}, arrt)));
68
+ EllipseResizeView.prototype.getResizeShape = function () {
69
+ var model = this.props.model;
70
+ var rx = model.rx, ry = model.ry, x = model.x, y = model.y;
71
+ var style = model.getNodeStyle();
72
+ return (h("g", null,
73
+ h(Ellipse, __assign({}, style, { rx: rx, ry: ry, x: x, y: y }))));
62
74
  };
63
75
  EllipseResizeView.prototype.getShape = function () {
64
- var attributes = _super.prototype.getAttributes.call(this);
65
- var isSelected = this.props.model.isSelected;
76
+ var model = this.props.model;
66
77
  return (h("g", null,
67
- this.getResizeShape(attributes),
68
- isSelected ? this.getControlGroup(attributes) : ''));
78
+ this.getResizeShape(),
79
+ model.isSelected ? this.getControlGroup() : ''));
69
80
  };
70
81
  return EllipseResizeView;
71
82
  }(EllipseNode));
@@ -4,10 +4,11 @@ declare class RectResizeModel extends RectNodeModel {
4
4
  minHeight: number;
5
5
  maxWidth: number;
6
6
  maxHeight: number;
7
+ getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
7
8
  setAttributes(): void;
8
9
  }
9
10
  declare class RectResizeView extends RectNode {
10
- getControlGroup(attributes: any): h.JSX.Element;
11
+ getControlGroup(): h.JSX.Element;
11
12
  getResizeShape(): h.JSX.Element;
12
13
  getShape(): h.JSX.Element;
13
14
  }
@@ -11,17 +11,6 @@ var __extends = (this && this.__extends) || (function () {
11
11
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
12
  };
13
13
  })();
14
- var __assign = (this && this.__assign) || function () {
15
- __assign = Object.assign || function(t) {
16
- for (var s, i = 1, n = arguments.length; i < n; i++) {
17
- s = arguments[i];
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
- t[p] = s[p];
20
- }
21
- return t;
22
- };
23
- return __assign.apply(this, arguments);
24
- };
25
14
  import { h, RectNode, RectNodeModel } from '@logicflow/core';
26
15
  import ControlGroup from '../Control/ControlGroup';
27
16
  var RectResizeModel = /** @class */ (function (_super) {
@@ -34,8 +23,15 @@ var RectResizeModel = /** @class */ (function (_super) {
34
23
  _this.maxHeight = 2000;
35
24
  return _this;
36
25
  }
26
+ RectResizeModel.prototype.getOutlineStyle = function () {
27
+ var style = _super.prototype.getOutlineStyle.call(this);
28
+ style.stroke = 'none';
29
+ if (style.hover) {
30
+ style.hover.stroke = 'none';
31
+ }
32
+ return style;
33
+ };
37
34
  RectResizeModel.prototype.setAttributes = function () {
38
- this.hideOutline = true;
39
35
  // @ts-ignore
40
36
  var nodeSize = this.properties.nodeSize;
41
37
  if (nodeSize) {
@@ -50,20 +46,19 @@ var RectResizeView = /** @class */ (function (_super) {
50
46
  function RectResizeView() {
51
47
  return _super !== null && _super.apply(this, arguments) || this;
52
48
  }
53
- RectResizeView.prototype.getControlGroup = function (attributes) {
49
+ RectResizeView.prototype.getControlGroup = function () {
54
50
  var _a = this.props, model = _a.model, graphModel = _a.graphModel;
55
- return (h(ControlGroup, __assign({}, attributes, { nodeModel: model, graphModel: graphModel })));
51
+ return (h(ControlGroup, { model: model, graphModel: graphModel }));
56
52
  };
57
53
  // getResizeShape绘制图形,功能等同于基础矩形的getShape功能,可以通过复写此方法,进行节点自定义
58
54
  RectResizeView.prototype.getResizeShape = function () {
59
55
  return _super.prototype.getShape.call(this);
60
56
  };
61
57
  RectResizeView.prototype.getShape = function () {
62
- var attributes = _super.prototype.getAttributes.call(this);
63
58
  var isSelected = this.props.model.isSelected;
64
59
  return (h("g", null,
65
60
  this.getResizeShape(),
66
- isSelected ? this.getControlGroup(attributes) : ''));
61
+ isSelected ? this.getControlGroup() : ''));
67
62
  };
68
63
  return RectResizeView;
69
64
  }(RectNode));
@@ -2,6 +2,7 @@ import { CircleNode, CircleNodeModel } from '@logicflow/core';
2
2
  declare class EndEventModel extends CircleNodeModel {
3
3
  static extendKey: string;
4
4
  constructor(data: any, graphModel: any);
5
+ setAttributes(): void;
5
6
  getConnectedSourceRules(): import("@logicflow/core").ConnectRule[];
6
7
  }
7
8
  declare class EndEventView extends CircleNode {
@@ -11,6 +11,17 @@ var __extends = (this && this.__extends) || (function () {
11
11
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
12
  };
13
13
  })();
14
+ var __assign = (this && this.__assign) || function () {
15
+ __assign = Object.assign || function(t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
+ t[p] = s[p];
20
+ }
21
+ return t;
22
+ };
23
+ return __assign.apply(this, arguments);
24
+ };
14
25
  import { CircleNode, CircleNodeModel, h } from '@logicflow/core';
15
26
  import { getBpmnId } from '../getBpmnId';
16
27
  var EndEventModel = /** @class */ (function (_super) {
@@ -33,10 +44,13 @@ var EndEventModel = /** @class */ (function (_super) {
33
44
  _this = _super.call(this, data, graphModel) || this;
34
45
  return _this;
35
46
  }
47
+ EndEventModel.prototype.setAttributes = function () {
48
+ this.r = 18;
49
+ };
36
50
  EndEventModel.prototype.getConnectedSourceRules = function () {
37
51
  var rules = _super.prototype.getConnectedSourceRules.call(this);
38
52
  var notAsSource = {
39
- message: '结束节点不能作为连线的起点',
53
+ message: '结束节点不能作为边的起点',
40
54
  validate: function () { return false; },
41
55
  };
42
56
  rules.push(notAsSource);
@@ -56,16 +70,11 @@ var EndEventView = /** @class */ (function (_super) {
56
70
  };
57
71
  };
58
72
  EndEventView.prototype.getShape = function () {
59
- var _a = this.getAttributes(), x = _a.x, y = _a.y, fill = _a.fill, stroke = _a.stroke, strokeWidth = _a.strokeWidth, r = _a.r;
73
+ var model = this.props.model;
74
+ var style = model.getNodeStyle();
75
+ var x = model.x, y = model.y, r = model.r;
60
76
  var outCircle = _super.prototype.getShape.call(this);
61
- return h('g', {}, outCircle, h('circle', {
62
- cx: x,
63
- cy: y,
64
- fill: fill,
65
- stroke: stroke,
66
- strokeWidth: strokeWidth,
67
- r: r - 5,
68
- }));
77
+ return h('g', {}, outCircle, h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 5 })));
69
78
  };
70
79
  EndEventView.extendKey = 'EndEventView';
71
80
  return EndEventView;
@@ -2,35 +2,11 @@ import { CircleNode, CircleNodeModel } from '@logicflow/core';
2
2
  declare class StartEventModel extends CircleNodeModel {
3
3
  static extendKey: string;
4
4
  constructor(data: any, graphModel: any);
5
+ setAttributes(): void;
5
6
  getConnectedTargetRules(): import("@logicflow/core").ConnectRule[];
6
7
  }
7
8
  declare class StartEventView extends CircleNode {
8
9
  static extendKey: string;
9
- getAttributes(): {
10
- r: number;
11
- width: number;
12
- height: number;
13
- fill: string;
14
- fillOpacity?: number;
15
- strokeWidth?: number;
16
- stroke: string;
17
- strokeOpacity?: number;
18
- opacity?: number;
19
- outlineColor?: string;
20
- id: string;
21
- properties: Record<string, any>;
22
- type: string;
23
- x: number;
24
- y: number;
25
- isSelected: boolean;
26
- isHovered: boolean;
27
- text: {
28
- [key: string]: any;
29
- x: number;
30
- y: number;
31
- value: string;
32
- };
33
- };
34
10
  }
35
11
  declare const StartEvent: {
36
12
  type: string;
@@ -11,17 +11,6 @@ var __extends = (this && this.__extends) || (function () {
11
11
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
12
  };
13
13
  })();
14
- var __assign = (this && this.__assign) || function () {
15
- __assign = Object.assign || function(t) {
16
- for (var s, i = 1, n = arguments.length; i < n; i++) {
17
- s = arguments[i];
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
- t[p] = s[p];
20
- }
21
- return t;
22
- };
23
- return __assign.apply(this, arguments);
24
- };
25
14
  import { CircleNode, CircleNodeModel } from '@logicflow/core';
26
15
  import { getBpmnId } from '../getBpmnId';
27
16
  var StartEventModel = /** @class */ (function (_super) {
@@ -46,10 +35,13 @@ var StartEventModel = /** @class */ (function (_super) {
46
35
  _this = _super.call(this, data, graphModel) || this;
47
36
  return _this;
48
37
  }
38
+ StartEventModel.prototype.setAttributes = function () {
39
+ this.r = 18;
40
+ };
49
41
  StartEventModel.prototype.getConnectedTargetRules = function () {
50
42
  var rules = _super.prototype.getConnectedTargetRules.call(this);
51
43
  var notAsTarget = {
52
- message: '起始节点不能作为连线的终点',
44
+ message: '起始节点不能作为边的终点',
53
45
  validate: function () { return false; },
54
46
  };
55
47
  rules.push(notAsTarget);
@@ -63,10 +55,6 @@ var StartEventView = /** @class */ (function (_super) {
63
55
  function StartEventView() {
64
56
  return _super !== null && _super.apply(this, arguments) || this;
65
57
  }
66
- StartEventView.prototype.getAttributes = function () {
67
- var attr = _super.prototype.getAttributes.call(this);
68
- return __assign({}, attr);
69
- };
70
58
  StartEventView.extendKey = 'StartEventNode';
71
59
  return StartEventView;
72
60
  }(CircleNode));