@logicflow/extension 1.0.0-alpha.2 → 1.0.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/cjs/NodeResize/Control/Control.js +4 -4
- package/cjs/NodeResize/Control/ControlGroup.js +4 -3
- package/cjs/NodeResize/Node/DiamondResize.js +18 -8
- package/cjs/NodeResize/Node/EllipseResize.js +23 -11
- package/cjs/NodeResize/Node/RectResize.js +11 -15
- package/cjs/bpmn/events/EndEvent.js +19 -10
- package/cjs/bpmn/events/StartEvent.js +4 -16
- package/cjs/bpmn/gateways/ExclusiveGateway.js +16 -14
- package/cjs/bpmn/index.js +1 -1
- package/cjs/bpmn/tasks/ServiceTask.js +20 -17
- package/cjs/bpmn/tasks/UserTask.js +20 -16
- package/cjs/bpmn-adapter/index.js +1 -1
- package/cjs/components/context-menu/index.js +3 -3
- package/cjs/components/menu/index.js +6 -6
- package/cjs/components/mini-map/index.js +2 -2
- package/cjs/components/selection-select/index.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/insert-node-in-polyline/index.js +3 -3
- package/cjs/materials/curved-edge/index.js +2 -1
- package/cjs/materials/group/GroupNode.js +1 -5
- package/cjs/materials/group/index.js +4 -4
- package/cjs/tools/auto-layout/index.js +8 -8
- package/cjs/tools/snapshot/index.js +3 -3
- package/es/NodeResize/Control/Control.d.ts +1 -3
- package/es/NodeResize/Control/Control.js +4 -4
- package/es/NodeResize/Control/ControlGroup.d.ts +1 -8
- package/es/NodeResize/Control/ControlGroup.js +4 -3
- package/es/NodeResize/Node/DiamondResize.d.ts +3 -2
- package/es/NodeResize/Node/DiamondResize.js +18 -8
- package/es/NodeResize/Node/EllipseResize.d.ts +4 -2
- package/es/NodeResize/Node/EllipseResize.js +23 -11
- package/es/NodeResize/Node/RectResize.d.ts +2 -1
- package/es/NodeResize/Node/RectResize.js +11 -15
- package/es/bpmn/events/EndEvent.d.ts +1 -0
- package/es/bpmn/events/EndEvent.js +19 -10
- package/es/bpmn/events/StartEvent.d.ts +1 -25
- package/es/bpmn/events/StartEvent.js +4 -16
- package/es/bpmn/gateways/ExclusiveGateway.js +16 -14
- package/es/bpmn/index.js +1 -1
- package/es/bpmn/tasks/ServiceTask.js +20 -17
- package/es/bpmn/tasks/UserTask.js +20 -16
- package/es/bpmn-adapter/index.js +1 -1
- package/es/components/context-menu/index.js +3 -3
- package/es/components/menu/index.js +6 -6
- package/es/components/mini-map/index.js +2 -2
- package/es/components/selection-select/index.js +1 -1
- package/es/index.d.ts +0 -1
- package/es/index.js +1 -1
- package/es/insert-node-in-polyline/index.js +3 -3
- package/es/materials/curved-edge/index.js +2 -1
- package/es/materials/group/GroupNode.d.ts +0 -12
- package/es/materials/group/GroupNode.js +1 -5
- package/es/materials/group/index.js +4 -4
- package/es/tools/auto-layout/index.d.ts +4 -4
- package/es/tools/auto-layout/index.js +8 -8
- package/es/tools/snapshot/index.js +3 -3
- package/lib/AutoLayout.js +1 -1
- package/lib/BpmnAdapter.js +1 -1
- package/lib/BpmnElement.js +1 -1
- package/lib/ContextMenu.js +1 -1
- package/lib/Control.js +1 -1
- package/lib/CurvedEdge.js +1 -1
- package/lib/DndPanel.js +1 -1
- package/lib/FlowPath.js +1 -1
- package/lib/Group.js +1 -1
- package/lib/InsertNodeInPolyline.js +1 -1
- package/lib/Menu.js +1 -1
- package/lib/MiniMap.js +1 -1
- package/lib/NodeResize.js +1 -1
- package/lib/RectLabelNode.js +1 -1
- package/lib/SelectionSelect.js +1 -1
- package/lib/Snapshot.js +1 -1
- package/lib/TurboAdapter.js +1 -1
- package/package.json +2 -2
- package/types/NodeResize/Control/Control.d.ts +1 -3
- package/types/NodeResize/Control/ControlGroup.d.ts +1 -8
- package/types/NodeResize/Node/DiamondResize.d.ts +3 -2
- package/types/NodeResize/Node/EllipseResize.d.ts +4 -2
- package/types/NodeResize/Node/RectResize.d.ts +2 -1
- package/types/bpmn/events/EndEvent.d.ts +1 -0
- package/types/bpmn/events/StartEvent.d.ts +1 -25
- package/types/index.d.ts +0 -1
- package/types/materials/group/GroupNode.d.ts +0 -12
- package/types/tools/auto-layout/index.d.ts +4 -4
- package/cjs/materials/node-selection/index.js +0 -267
- package/es/materials/node-selection/index.d.ts +0 -29
- package/es/materials/node-selection/index.js +0 -264
- package/lib/NodeSelection.js +0 -10
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
158
|
-
var SCALE_X =
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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,
|
|
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, {
|
|
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(
|
|
7
|
-
getResizeShape(
|
|
7
|
+
getControlGroup(): h.JSX.Element;
|
|
8
|
+
getResizeShape(): h.JSX.Element;
|
|
8
9
|
getShape(): h.JSX.Element;
|
|
9
10
|
}
|
|
10
11
|
declare const EllipseResize: {
|
|
@@ -30,6 +30,14 @@ 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
42
|
this.hideOutline = true;
|
|
35
43
|
// @ts-ignore
|
|
@@ -46,21 +54,23 @@ var DiamondResizeView = /** @class */ (function (_super) {
|
|
|
46
54
|
function DiamondResizeView() {
|
|
47
55
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
48
56
|
}
|
|
49
|
-
DiamondResizeView.prototype.getControlGroup = function (
|
|
57
|
+
DiamondResizeView.prototype.getControlGroup = function () {
|
|
50
58
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
51
|
-
return (h(ControlGroup,
|
|
59
|
+
return (h(ControlGroup, { model: model, graphModel: graphModel }));
|
|
52
60
|
};
|
|
53
61
|
// getResizeShape绘制图形,功能等同于基础菱形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
54
|
-
DiamondResizeView.prototype.getResizeShape = function (
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
DiamondResizeView.prototype.getResizeShape = function () {
|
|
63
|
+
var model = this.props.model;
|
|
64
|
+
var points = model.points;
|
|
65
|
+
var style = model.getNodeStyle();
|
|
66
|
+
return (h("g", null,
|
|
67
|
+
h(Polygon, __assign({}, style, { points: points }))));
|
|
57
68
|
};
|
|
58
69
|
DiamondResizeView.prototype.getShape = function () {
|
|
59
|
-
var attributes = _super.prototype.getAttributes.call(this);
|
|
60
70
|
var isSelected = this.props.model.isSelected;
|
|
61
71
|
return (h("g", null,
|
|
62
|
-
this.getResizeShape(
|
|
63
|
-
isSelected ? this.getControlGroup(
|
|
72
|
+
this.getResizeShape(),
|
|
73
|
+
isSelected ? this.getControlGroup() : ''));
|
|
64
74
|
};
|
|
65
75
|
return DiamondResizeView;
|
|
66
76
|
}(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(
|
|
11
|
-
getResizeShape(
|
|
12
|
+
getControlGroup(): h.JSX.Element;
|
|
13
|
+
getResizeShape(): h.JSX.Element;
|
|
12
14
|
getShape(): h.JSX.Element;
|
|
13
15
|
}
|
|
14
16
|
declare const EllipseResize: {
|
|
@@ -27,14 +27,24 @@ 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
|
|
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
49
|
this.hideOutline = true;
|
|
40
50
|
// @ts-ignore
|
|
@@ -51,21 +61,23 @@ var EllipseResizeView = /** @class */ (function (_super) {
|
|
|
51
61
|
function EllipseResizeView() {
|
|
52
62
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
53
63
|
}
|
|
54
|
-
EllipseResizeView.prototype.getControlGroup = function (
|
|
64
|
+
EllipseResizeView.prototype.getControlGroup = function () {
|
|
55
65
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
56
|
-
return (h(ControlGroup,
|
|
66
|
+
return (h(ControlGroup, { model: model, graphModel: graphModel }));
|
|
57
67
|
};
|
|
58
68
|
// getResizeShape绘制图形,功能等同于基础椭圆的getShape功能,可以通过复写此方法,进行节点自定义
|
|
59
|
-
EllipseResizeView.prototype.getResizeShape = function (
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
EllipseResizeView.prototype.getResizeShape = function () {
|
|
70
|
+
var model = this.props.model;
|
|
71
|
+
var rx = model.rx, ry = model.ry, x = model.x, y = model.y;
|
|
72
|
+
var style = model.getNodeStyle();
|
|
73
|
+
return (h("g", null,
|
|
74
|
+
h(Ellipse, __assign({}, style, { rx: rx, ry: ry, x: x, y: y }))));
|
|
62
75
|
};
|
|
63
76
|
EllipseResizeView.prototype.getShape = function () {
|
|
64
|
-
var
|
|
65
|
-
var isSelected = this.props.model.isSelected;
|
|
77
|
+
var model = this.props.model;
|
|
66
78
|
return (h("g", null,
|
|
67
|
-
this.getResizeShape(
|
|
68
|
-
isSelected ? this.getControlGroup(
|
|
79
|
+
this.getResizeShape(),
|
|
80
|
+
model.isSelected ? this.getControlGroup() : ''));
|
|
69
81
|
};
|
|
70
82
|
return EllipseResizeView;
|
|
71
83
|
}(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(
|
|
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,6 +23,14 @@ 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
35
|
this.hideOutline = true;
|
|
39
36
|
// @ts-ignore
|
|
@@ -50,20 +47,19 @@ var RectResizeView = /** @class */ (function (_super) {
|
|
|
50
47
|
function RectResizeView() {
|
|
51
48
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
52
49
|
}
|
|
53
|
-
RectResizeView.prototype.getControlGroup = function (
|
|
50
|
+
RectResizeView.prototype.getControlGroup = function () {
|
|
54
51
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
55
|
-
return (h(ControlGroup,
|
|
52
|
+
return (h(ControlGroup, { model: model, graphModel: graphModel }));
|
|
56
53
|
};
|
|
57
54
|
// getResizeShape绘制图形,功能等同于基础矩形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
58
55
|
RectResizeView.prototype.getResizeShape = function () {
|
|
59
56
|
return _super.prototype.getShape.call(this);
|
|
60
57
|
};
|
|
61
58
|
RectResizeView.prototype.getShape = function () {
|
|
62
|
-
var attributes = _super.prototype.getAttributes.call(this);
|
|
63
59
|
var isSelected = this.props.model.isSelected;
|
|
64
60
|
return (h("g", null,
|
|
65
61
|
this.getResizeShape(),
|
|
66
|
-
isSelected ? this.getControlGroup(
|
|
62
|
+
isSelected ? this.getControlGroup() : ''));
|
|
67
63
|
};
|
|
68
64
|
return RectResizeView;
|
|
69
65
|
}(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
|
|
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));
|