@logicflow/extension 1.0.0-alpha.3 → 1.0.0-alpha.6
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 +10 -8
- package/cjs/NodeResize/Node/EllipseResize.js +11 -9
- package/cjs/NodeResize/Node/RectResize.js +3 -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 +2 -2
- package/es/NodeResize/Node/DiamondResize.js +10 -8
- package/es/NodeResize/Node/EllipseResize.d.ts +2 -2
- package/es/NodeResize/Node/EllipseResize.js +11 -9
- package/es/NodeResize/Node/RectResize.d.ts +1 -1
- package/es/NodeResize/Node/RectResize.js +3 -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 +2 -2
- package/types/NodeResize/Node/EllipseResize.d.ts +2 -2
- package/types/NodeResize/Node/RectResize.d.ts +1 -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
|
@@ -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
|
};
|
|
@@ -3,8 +3,8 @@ declare class DiamondResizeModel extends DiamondNodeModel {
|
|
|
3
3
|
setAttributes(): void;
|
|
4
4
|
}
|
|
5
5
|
declare class DiamondResizeView extends DiamondNode {
|
|
6
|
-
getControlGroup(
|
|
7
|
-
getResizeShape(
|
|
6
|
+
getControlGroup(): h.JSX.Element;
|
|
7
|
+
getResizeShape(): h.JSX.Element;
|
|
8
8
|
getShape(): h.JSX.Element;
|
|
9
9
|
}
|
|
10
10
|
declare const EllipseResize: {
|
|
@@ -46,21 +46,23 @@ var DiamondResizeView = /** @class */ (function (_super) {
|
|
|
46
46
|
function DiamondResizeView() {
|
|
47
47
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
48
48
|
}
|
|
49
|
-
DiamondResizeView.prototype.getControlGroup = function (
|
|
49
|
+
DiamondResizeView.prototype.getControlGroup = function () {
|
|
50
50
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
51
|
-
return (h(ControlGroup,
|
|
51
|
+
return (h(ControlGroup, { model: model, graphModel: graphModel }));
|
|
52
52
|
};
|
|
53
53
|
// getResizeShape绘制图形,功能等同于基础菱形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
54
|
-
DiamondResizeView.prototype.getResizeShape = function (
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
DiamondResizeView.prototype.getResizeShape = function () {
|
|
55
|
+
var model = this.props.model;
|
|
56
|
+
var points = model.points;
|
|
57
|
+
var style = model.getNodeStyle();
|
|
58
|
+
return (h("g", null,
|
|
59
|
+
h(Polygon, __assign({}, style, { points: points }))));
|
|
57
60
|
};
|
|
58
61
|
DiamondResizeView.prototype.getShape = function () {
|
|
59
|
-
var attributes = _super.prototype.getAttributes.call(this);
|
|
60
62
|
var isSelected = this.props.model.isSelected;
|
|
61
63
|
return (h("g", null,
|
|
62
|
-
this.getResizeShape(
|
|
63
|
-
isSelected ? this.getControlGroup(
|
|
64
|
+
this.getResizeShape(),
|
|
65
|
+
isSelected ? this.getControlGroup() : ''));
|
|
64
66
|
};
|
|
65
67
|
return DiamondResizeView;
|
|
66
68
|
}(DiamondNode));
|
|
@@ -7,8 +7,8 @@ declare class EllipseResizeModel extends EllipseNodeModel {
|
|
|
7
7
|
setAttributes(): void;
|
|
8
8
|
}
|
|
9
9
|
declare class EllipseResizeView extends EllipseNode {
|
|
10
|
-
getControlGroup(
|
|
11
|
-
getResizeShape(
|
|
10
|
+
getControlGroup(): h.JSX.Element;
|
|
11
|
+
getResizeShape(): h.JSX.Element;
|
|
12
12
|
getShape(): h.JSX.Element;
|
|
13
13
|
}
|
|
14
14
|
declare const EllipseResize: {
|
|
@@ -51,21 +51,23 @@ var EllipseResizeView = /** @class */ (function (_super) {
|
|
|
51
51
|
function EllipseResizeView() {
|
|
52
52
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
53
53
|
}
|
|
54
|
-
EllipseResizeView.prototype.getControlGroup = function (
|
|
54
|
+
EllipseResizeView.prototype.getControlGroup = function () {
|
|
55
55
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
56
|
-
return (h(ControlGroup,
|
|
56
|
+
return (h(ControlGroup, { model: model, graphModel: graphModel }));
|
|
57
57
|
};
|
|
58
58
|
// getResizeShape绘制图形,功能等同于基础椭圆的getShape功能,可以通过复写此方法,进行节点自定义
|
|
59
|
-
EllipseResizeView.prototype.getResizeShape = function (
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
EllipseResizeView.prototype.getResizeShape = function () {
|
|
60
|
+
var model = this.props.model;
|
|
61
|
+
var rx = model.rx, ry = model.ry, x = model.x, y = model.y;
|
|
62
|
+
var style = model.getNodeStyle();
|
|
63
|
+
return (h("g", null,
|
|
64
|
+
h(Ellipse, __assign({}, style, { rx: rx, ry: ry, x: x, y: y }))));
|
|
62
65
|
};
|
|
63
66
|
EllipseResizeView.prototype.getShape = function () {
|
|
64
|
-
var
|
|
65
|
-
var isSelected = this.props.model.isSelected;
|
|
67
|
+
var model = this.props.model;
|
|
66
68
|
return (h("g", null,
|
|
67
|
-
this.getResizeShape(
|
|
68
|
-
isSelected ? this.getControlGroup(
|
|
69
|
+
this.getResizeShape(),
|
|
70
|
+
model.isSelected ? this.getControlGroup() : ''));
|
|
69
71
|
};
|
|
70
72
|
return EllipseResizeView;
|
|
71
73
|
}(EllipseNode));
|
|
@@ -7,7 +7,7 @@ declare class RectResizeModel extends RectNodeModel {
|
|
|
7
7
|
setAttributes(): void;
|
|
8
8
|
}
|
|
9
9
|
declare class RectResizeView extends RectNode {
|
|
10
|
-
getControlGroup(
|
|
10
|
+
getControlGroup(): h.JSX.Element;
|
|
11
11
|
getResizeShape(): h.JSX.Element;
|
|
12
12
|
getShape(): h.JSX.Element;
|
|
13
13
|
}
|
|
@@ -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) {
|
|
@@ -50,20 +39,19 @@ var RectResizeView = /** @class */ (function (_super) {
|
|
|
50
39
|
function RectResizeView() {
|
|
51
40
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
52
41
|
}
|
|
53
|
-
RectResizeView.prototype.getControlGroup = function (
|
|
42
|
+
RectResizeView.prototype.getControlGroup = function () {
|
|
54
43
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
55
|
-
return (h(ControlGroup,
|
|
44
|
+
return (h(ControlGroup, { model: model, graphModel: graphModel }));
|
|
56
45
|
};
|
|
57
46
|
// getResizeShape绘制图形,功能等同于基础矩形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
58
47
|
RectResizeView.prototype.getResizeShape = function () {
|
|
59
48
|
return _super.prototype.getShape.call(this);
|
|
60
49
|
};
|
|
61
50
|
RectResizeView.prototype.getShape = function () {
|
|
62
|
-
var attributes = _super.prototype.getAttributes.call(this);
|
|
63
51
|
var isSelected = this.props.model.isSelected;
|
|
64
52
|
return (h("g", null,
|
|
65
53
|
this.getResizeShape(),
|
|
66
|
-
isSelected ? this.getControlGroup(
|
|
54
|
+
isSelected ? this.getControlGroup() : ''));
|
|
67
55
|
};
|
|
68
56
|
return RectResizeView;
|
|
69
57
|
}(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));
|
|
@@ -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 { h, PolygonNode, PolygonNodeModel } from '@logicflow/core';
|
|
15
26
|
import { getBpmnId } from '../getBpmnId';
|
|
16
27
|
var ExclusiveGatewayModel = /** @class */ (function (_super) {
|
|
@@ -48,23 +59,14 @@ var ExclusiveGatewayView = /** @class */ (function (_super) {
|
|
|
48
59
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
49
60
|
}
|
|
50
61
|
ExclusiveGatewayView.prototype.getShape = function () {
|
|
51
|
-
var
|
|
52
|
-
var x =
|
|
62
|
+
var model = this.props.model;
|
|
63
|
+
var x = model.x, y = model.y, width = model.width, height = model.height, points = model.points;
|
|
64
|
+
var style = model.getNodeStyle();
|
|
53
65
|
return h('g', {
|
|
54
66
|
transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
|
|
55
|
-
}, h('polygon', {
|
|
56
|
-
fill: fill,
|
|
57
|
-
x: x,
|
|
67
|
+
}, h('polygon', __assign(__assign({}, style), { x: x,
|
|
58
68
|
y: y,
|
|
59
|
-
|
|
60
|
-
strokeWidth: strokeWidth,
|
|
61
|
-
points: points,
|
|
62
|
-
}), h('path', {
|
|
63
|
-
fill: fill,
|
|
64
|
-
stroke: stroke,
|
|
65
|
-
strokeWidth: strokeWidth,
|
|
66
|
-
d: 'm 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z',
|
|
67
|
-
}));
|
|
69
|
+
points: points })), h('path', __assign({ d: 'm 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z' }, style)));
|
|
68
70
|
};
|
|
69
71
|
ExclusiveGatewayView.extendKey = 'ExclusiveGatewayNode';
|
|
70
72
|
return ExclusiveGatewayView;
|
package/es/bpmn/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var BpmnElement = /** @class */ (function () {
|
|
|
16
16
|
lf.register(ExclusiveGateway);
|
|
17
17
|
lf.register(UserTask);
|
|
18
18
|
lf.register(ServiceTask);
|
|
19
|
-
// 支持自定义bpmn
|
|
19
|
+
// 支持自定义bpmn元素的边
|
|
20
20
|
if (!lf.options.customBpmnEdge) {
|
|
21
21
|
lf.register(SequenceFlow);
|
|
22
22
|
lf.setDefaultEdgeType('bpmn:sequenceFlow');
|
|
@@ -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 { h, RectNodeModel, RectNode } from '@logicflow/core';
|
|
15
26
|
import { getBpmnId } from '../getBpmnId';
|
|
16
27
|
var ServiceTaskModel = /** @class */ (function (_super) {
|
|
@@ -32,8 +43,9 @@ var ServiceTaskView = /** @class */ (function (_super) {
|
|
|
32
43
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
33
44
|
}
|
|
34
45
|
ServiceTaskView.prototype.getLabelShape = function () {
|
|
35
|
-
var
|
|
36
|
-
var x =
|
|
46
|
+
var model = this.props.model;
|
|
47
|
+
var x = model.x, y = model.y, width = model.width, height = model.height;
|
|
48
|
+
var style = model.getNodeStyle();
|
|
37
49
|
return h('svg', {
|
|
38
50
|
x: x - width / 2 + 5,
|
|
39
51
|
y: y - height / 2 + 5,
|
|
@@ -41,26 +53,17 @@ var ServiceTaskView = /** @class */ (function (_super) {
|
|
|
41
53
|
height: 30,
|
|
42
54
|
viewBox: '0 0 1274 1024',
|
|
43
55
|
}, h('path', {
|
|
44
|
-
fill: stroke,
|
|
56
|
+
fill: style.stroke,
|
|
45
57
|
d: 'M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z',
|
|
46
58
|
}));
|
|
47
59
|
};
|
|
48
60
|
ServiceTaskView.prototype.getShape = function () {
|
|
49
|
-
var
|
|
50
|
-
var x =
|
|
51
|
-
|
|
61
|
+
var model = this.props.model;
|
|
62
|
+
var x = model.x, y = model.y, width = model.width, height = model.height, radius = model.radius;
|
|
63
|
+
var style = model.getNodeStyle();
|
|
52
64
|
return h('g', {}, [
|
|
53
|
-
h('rect', {
|
|
54
|
-
|
|
55
|
-
y: y - height / 2,
|
|
56
|
-
rx: radius,
|
|
57
|
-
ry: radius,
|
|
58
|
-
fill: fill,
|
|
59
|
-
stroke: stroke,
|
|
60
|
-
strokeWidth: strokeWidth,
|
|
61
|
-
width: width,
|
|
62
|
-
height: height,
|
|
63
|
-
}),
|
|
65
|
+
h('rect', __assign({ x: x - width / 2, y: y - height / 2, rx: radius, ry: radius, width: width,
|
|
66
|
+
height: height }, style)),
|
|
64
67
|
this.getLabelShape(),
|
|
65
68
|
]);
|
|
66
69
|
};
|