@logicflow/extension 1.1.12 → 1.2.0-alpha.1
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 +8 -8
- package/cjs/NodeResize/Control/Util.js +11 -11
- package/cjs/bpmn-adapter/index.js +124 -76
- package/cjs/bpmn-adapter/json2xml.js +5 -2
- package/cjs/bpmn-adapter/xml2json.js +38 -284
- package/cjs/components/context-menu/index.js +2 -2
- package/cjs/components/menu/index.js +23 -23
- package/cjs/components/mini-map/index.js +2 -2
- package/cjs/components/selection-select/index.js +5 -5
- package/cjs/insert-node-in-polyline/edge.js +4 -4
- package/cjs/insert-node-in-polyline/index.js +1 -1
- package/cjs/materials/group/GroupNode.js +2 -2
- package/cjs/materials/group/index.js +3 -3
- package/cjs/tools/auto-layout/index.js +9 -9
- package/cjs/tools/snapshot/index.js +47 -46
- package/cjs/turbo-adapter/index.js +2 -2
- package/es/NodeResize/Control/Control.d.ts +1 -1
- package/es/NodeResize/Control/Control.js +9 -9
- package/es/NodeResize/Control/Util.d.ts +3 -3
- package/es/NodeResize/Control/Util.js +7 -7
- package/es/bpmn-adapter/index.d.ts +41 -33
- package/es/bpmn-adapter/index.js +124 -76
- package/es/bpmn-adapter/json2xml.js +5 -2
- package/es/bpmn-adapter/xml2json.js +38 -284
- package/es/components/context-menu/index.js +2 -2
- package/es/components/menu/index.js +23 -23
- package/es/components/mini-map/index.js +2 -2
- package/es/components/selection-select/index.d.ts +1 -1
- package/es/components/selection-select/index.js +5 -5
- package/es/insert-node-in-polyline/edge.d.ts +3 -3
- package/es/insert-node-in-polyline/edge.js +3 -3
- package/es/insert-node-in-polyline/index.js +2 -2
- package/es/materials/group/GroupNode.d.ts +1 -1
- package/es/materials/group/GroupNode.js +2 -2
- package/es/materials/group/index.d.ts +1 -1
- package/es/materials/group/index.js +3 -3
- package/es/tools/auto-layout/index.d.ts +2 -2
- package/es/tools/auto-layout/index.js +9 -9
- package/es/tools/snapshot/index.d.ts +15 -7
- package/es/tools/snapshot/index.js +47 -46
- package/es/turbo-adapter/index.js +2 -2
- 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/lib/lfJson2Xml.js +1 -1
- package/lib/lfXml2Json.js +1 -1
- package/package.json +2 -2
- package/types/NodeResize/Control/Control.d.ts +1 -1
- package/types/NodeResize/Control/Util.d.ts +3 -3
- package/types/bpmn-adapter/index.d.ts +41 -33
- package/types/components/selection-select/index.d.ts +1 -1
- package/types/insert-node-in-polyline/edge.d.ts +3 -3
- package/types/materials/group/GroupNode.d.ts +1 -1
- package/types/materials/group/index.d.ts +1 -1
- package/types/tools/auto-layout/index.d.ts +2 -2
- package/types/tools/snapshot/index.d.ts +15 -7
|
@@ -40,7 +40,7 @@ var Group = /** @class */ (function () {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
this.
|
|
43
|
+
this.appendNodeToGroup = function (_a) {
|
|
44
44
|
var data = _a.data;
|
|
45
45
|
// 如果这个节点之前已经在group中了,则将其从之前的group中移除
|
|
46
46
|
var preGroupId = _this.nodeGroupMap.get(data.id);
|
|
@@ -114,9 +114,9 @@ var Group = /** @class */ (function () {
|
|
|
114
114
|
return true;
|
|
115
115
|
});
|
|
116
116
|
lf.graphModel.group = this;
|
|
117
|
-
lf.on('node:add', this.
|
|
117
|
+
lf.on('node:add', this.appendNodeToGroup);
|
|
118
118
|
lf.on('node:delete', this.deleteGroupChild);
|
|
119
|
-
lf.on('node:drop', this.
|
|
119
|
+
lf.on('node:drop', this.appendNodeToGroup);
|
|
120
120
|
lf.on('node:dnd-drag', this.setActiveGroup);
|
|
121
121
|
lf.on('node:drag', this.setActiveGroup);
|
|
122
122
|
lf.on('graph:rendered', this.graphRendered);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* 自动布局插件
|
|
4
|
-
* 依赖
|
|
4
|
+
* 依赖flow-path插件
|
|
5
5
|
* 未完善
|
|
6
6
|
*/
|
|
7
7
|
var __assign = (this && this.__assign) || function () {
|
|
@@ -141,7 +141,7 @@ var AutoLayout = /** @class */ (function () {
|
|
|
141
141
|
var target = this.newNodeMap.get(targetNodeId);
|
|
142
142
|
var _a = this.getShape(sourceNodeId), width = _a.width, height = _a.height;
|
|
143
143
|
var _b = this.getShape(targetNodeId), targetWidth = _b.width, targetHeight = _b.height;
|
|
144
|
-
var
|
|
144
|
+
var positionType = this.getRelativePosition(source, target);
|
|
145
145
|
var startPoint = {
|
|
146
146
|
x: source.x,
|
|
147
147
|
y: source.y,
|
|
@@ -150,7 +150,7 @@ var AutoLayout = /** @class */ (function () {
|
|
|
150
150
|
x: target.x,
|
|
151
151
|
y: target.y,
|
|
152
152
|
};
|
|
153
|
-
switch (
|
|
153
|
+
switch (positionType) {
|
|
154
154
|
case POSITION_TYPE.LEFT:
|
|
155
155
|
startPoint.x = source.x + width / 2;
|
|
156
156
|
endPoint.x = target.x - targetWidth / 2;
|
|
@@ -176,22 +176,22 @@ var AutoLayout = /** @class */ (function () {
|
|
|
176
176
|
* source一定在target左边。
|
|
177
177
|
* 1. 如果source和target在同一x, y坐标内容。
|
|
178
178
|
* 2. 如果source在target左上方。
|
|
179
|
-
* 3. 如果
|
|
179
|
+
* 3. 如果source在target左下方。
|
|
180
180
|
*/
|
|
181
181
|
AutoLayout.prototype.getRelativePosition = function (source, target) {
|
|
182
182
|
var y = source.y;
|
|
183
183
|
var y1 = target.y;
|
|
184
|
-
var
|
|
184
|
+
var positionType;
|
|
185
185
|
if (y < y1) {
|
|
186
|
-
|
|
186
|
+
positionType = -1;
|
|
187
187
|
}
|
|
188
188
|
else if (y === y1) {
|
|
189
|
-
|
|
189
|
+
positionType = 0;
|
|
190
190
|
}
|
|
191
191
|
else {
|
|
192
|
-
|
|
192
|
+
positionType = 1;
|
|
193
193
|
}
|
|
194
|
-
return
|
|
194
|
+
return positionType;
|
|
195
195
|
};
|
|
196
196
|
/**
|
|
197
197
|
* 获取边节点图形的宽高。
|
|
@@ -4,37 +4,27 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Snapshot = void 0;
|
|
7
|
-
var Snapshot = {
|
|
8
|
-
|
|
9
|
-
install: function (lf) {
|
|
7
|
+
var Snapshot = /** @class */ (function () {
|
|
8
|
+
function Snapshot(_a) {
|
|
10
9
|
var _this = this;
|
|
10
|
+
var lf = _a.lf;
|
|
11
11
|
this.lf = lf;
|
|
12
|
+
this.customCssRules = '';
|
|
13
|
+
this.useGlobalRules = true;
|
|
12
14
|
/* 下载快照 */
|
|
13
15
|
lf.getSnapshot = function (fileName, backgroundColor) {
|
|
14
|
-
_this.
|
|
15
|
-
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
16
|
-
_this.fileName = fileName || "logic-flow." + Date.now() + ".png";
|
|
17
|
-
var svgRootElement = _this.getSvgRootElement(lf);
|
|
18
|
-
_this.downloadSvg(svgRootElement, _this.fileName, backgroundColor);
|
|
16
|
+
_this.getSnapshot(fileName, backgroundColor);
|
|
19
17
|
};
|
|
20
18
|
/* 获取Blob对象,用户图片上传 */
|
|
21
|
-
lf.getSnapshotBlob = function (backgroundColor) {
|
|
22
|
-
_this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
23
|
-
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
24
|
-
var svgRootElement = _this.getSvgRootElement(lf);
|
|
25
|
-
return _this.getBlob(svgRootElement, backgroundColor);
|
|
26
|
-
};
|
|
19
|
+
lf.getSnapshotBlob = function (backgroundColor) { return _this.getSnapshotBlob(backgroundColor); };
|
|
27
20
|
/* 获取Base64对象,用户图片上传 */
|
|
28
|
-
lf.getSnapshotBase64 = function (backgroundColor) {
|
|
29
|
-
|
|
30
|
-
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
31
|
-
var svgRootElement = _this.getSvgRootElement(lf);
|
|
32
|
-
return _this.getBase64(svgRootElement, backgroundColor);
|
|
33
|
-
};
|
|
34
|
-
},
|
|
21
|
+
lf.getSnapshotBase64 = function (backgroundColor) { return _this.getSnapshotBase64(backgroundColor); };
|
|
22
|
+
}
|
|
35
23
|
/* 获取svgRoot对象 */
|
|
36
|
-
getSvgRootElement
|
|
24
|
+
Snapshot.prototype.getSvgRootElement = function (lf) {
|
|
37
25
|
var _this = this;
|
|
26
|
+
this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
27
|
+
this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
38
28
|
lf.graphModel.nodes.forEach(function (item) {
|
|
39
29
|
var x = item.x, width = item.width, y = item.y, height = item.height;
|
|
40
30
|
var offsetX = x - width / 2;
|
|
@@ -61,8 +51,8 @@ var Snapshot = {
|
|
|
61
51
|
});
|
|
62
52
|
var svgRootElement = lf.container.querySelector('.lf-canvas-overlay');
|
|
63
53
|
return svgRootElement;
|
|
64
|
-
}
|
|
65
|
-
triggerDownload
|
|
54
|
+
};
|
|
55
|
+
Snapshot.prototype.triggerDownload = function (imgURI) {
|
|
66
56
|
var evt = new MouseEvent('click', {
|
|
67
57
|
view: window,
|
|
68
58
|
bubbles: false,
|
|
@@ -73,8 +63,8 @@ var Snapshot = {
|
|
|
73
63
|
a.setAttribute('href', imgURI);
|
|
74
64
|
a.setAttribute('target', '_blank');
|
|
75
65
|
a.dispatchEvent(evt);
|
|
76
|
-
}
|
|
77
|
-
removeAnchor
|
|
66
|
+
};
|
|
67
|
+
Snapshot.prototype.removeAnchor = function (element) {
|
|
78
68
|
var childNodes = element.childNodes;
|
|
79
69
|
var childLength = element.childNodes && element.childNodes.length;
|
|
80
70
|
for (var i = 0; i < childLength; i++) {
|
|
@@ -86,20 +76,22 @@ var Snapshot = {
|
|
|
86
76
|
i--;
|
|
87
77
|
}
|
|
88
78
|
}
|
|
89
|
-
}
|
|
79
|
+
};
|
|
90
80
|
/* 下载图片 */
|
|
91
|
-
|
|
81
|
+
Snapshot.prototype.getSnapshot = function (fileName, backgroundColor) {
|
|
92
82
|
var _this = this;
|
|
83
|
+
this.fileName = fileName || "logic-flow." + Date.now() + ".png";
|
|
84
|
+
var svg = this.getSvgRootElement(this.lf);
|
|
93
85
|
this.getCanvasData(svg, backgroundColor).then(function (canvas) {
|
|
94
|
-
var imgURI = canvas
|
|
95
|
-
.toDataURL('image/png')
|
|
86
|
+
var imgURI = canvas.toDataURL('image/png')
|
|
96
87
|
.replace('image/png', 'image/octet-stream');
|
|
97
|
-
_this.triggerDownload(imgURI
|
|
88
|
+
_this.triggerDownload(imgURI);
|
|
98
89
|
});
|
|
99
|
-
}
|
|
90
|
+
};
|
|
100
91
|
/* 获取base64对象 */
|
|
101
|
-
|
|
92
|
+
Snapshot.prototype.getSnapshotBase64 = function (backgroundColor) {
|
|
102
93
|
var _this = this;
|
|
94
|
+
var svg = this.getSvgRootElement(this.lf);
|
|
103
95
|
return new Promise(function (resolve) {
|
|
104
96
|
_this.getCanvasData(svg, backgroundColor).then(function (canvas) {
|
|
105
97
|
var base64 = canvas.toDataURL('image/png');
|
|
@@ -107,10 +99,11 @@ var Snapshot = {
|
|
|
107
99
|
resolve({ data: base64, width: canvas.width, height: canvas.height });
|
|
108
100
|
});
|
|
109
101
|
});
|
|
110
|
-
}
|
|
102
|
+
};
|
|
111
103
|
/* 获取Blob对象 */
|
|
112
|
-
|
|
104
|
+
Snapshot.prototype.getSnapshotBlob = function (backgroundColor) {
|
|
113
105
|
var _this = this;
|
|
106
|
+
var svg = this.getSvgRootElement(this.lf);
|
|
114
107
|
return new Promise(function (resolve) {
|
|
115
108
|
_this.getCanvasData(svg, backgroundColor).then(function (canvas) {
|
|
116
109
|
canvas.toBlob(function (blob) {
|
|
@@ -119,20 +112,25 @@ var Snapshot = {
|
|
|
119
112
|
}, 'image/png');
|
|
120
113
|
});
|
|
121
114
|
});
|
|
122
|
-
}
|
|
123
|
-
getClassRules
|
|
115
|
+
};
|
|
116
|
+
Snapshot.prototype.getClassRules = function () {
|
|
124
117
|
var rules = '';
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
|
|
118
|
+
if (this.useGlobalRules) {
|
|
119
|
+
var styleSheets = document.styleSheets;
|
|
120
|
+
for (var i = 0; i < styleSheets.length; i++) {
|
|
121
|
+
var sheet = styleSheets[i];
|
|
122
|
+
for (var j = 0; j < sheet.cssRules.length; j++) {
|
|
123
|
+
rules += sheet.cssRules[j].cssText;
|
|
124
|
+
}
|
|
130
125
|
}
|
|
131
126
|
}
|
|
127
|
+
if (this.customCssRules) {
|
|
128
|
+
rules += this.customCssRules;
|
|
129
|
+
}
|
|
132
130
|
return rules;
|
|
133
|
-
}
|
|
131
|
+
};
|
|
134
132
|
// 获取图片生成中中间产物canvas对象,用户转换为其他需要的格式
|
|
135
|
-
getCanvasData
|
|
133
|
+
Snapshot.prototype.getCanvasData = function (svg, backgroundColor) {
|
|
136
134
|
var _this = this;
|
|
137
135
|
var copy = svg.cloneNode(true);
|
|
138
136
|
var graph = copy.lastChild;
|
|
@@ -204,12 +202,15 @@ var Snapshot = {
|
|
|
204
202
|
因为svg中存在dom存放在foreignObject元素中
|
|
205
203
|
SVG图形转成img对象
|
|
206
204
|
todo: 会导致一些清晰度问题这个需要再解决
|
|
205
|
+
fixme: XMLSerializer的中的css background url不会下载图片
|
|
207
206
|
*/
|
|
208
207
|
var svg2Img = "data:image/svg+xml;charset=utf-8," + new XMLSerializer().serializeToString(copy);
|
|
209
208
|
var imgSrc = svg2Img.replace(/\n/g, '').replace(/\t/g, '').replace(/#/g, '%23');
|
|
210
209
|
img.src = imgSrc;
|
|
211
210
|
});
|
|
212
|
-
}
|
|
213
|
-
|
|
211
|
+
};
|
|
212
|
+
Snapshot.pluginName = 'snapshot';
|
|
213
|
+
return Snapshot;
|
|
214
|
+
}());
|
|
214
215
|
exports.Snapshot = Snapshot;
|
|
215
216
|
exports.default = Snapshot;
|
|
@@ -54,7 +54,7 @@ function convertNodeToTurboElement(node) {
|
|
|
54
54
|
key: id,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
// 将LogicFlow中的
|
|
57
|
+
// 将LogicFlow中的Edge数据转换为Turbo元素数据
|
|
58
58
|
function convertEdgeToTurboElement(edge) {
|
|
59
59
|
var id = edge.id, type = edge.type, sourceNodeId = edge.sourceNodeId, targetNodeId = edge.targetNodeId, startPoint = edge.startPoint, endPoint = edge.endPoint, pointsList = edge.pointsList, _a = edge.text, text = _a === void 0 ? '' : _a, properties = edge.properties;
|
|
60
60
|
return {
|
|
@@ -91,7 +91,7 @@ function toTurboData(data) {
|
|
|
91
91
|
return turboData;
|
|
92
92
|
}
|
|
93
93
|
exports.toTurboData = toTurboData;
|
|
94
|
-
// 将Turbo元素数据转换为LogicFlow中的
|
|
94
|
+
// 将Turbo元素数据转换为LogicFlow中的Edge数据
|
|
95
95
|
function convertFlowElementToEdge(element) {
|
|
96
96
|
var incoming = element.incoming, outgoing = element.outgoing, properties = element.properties, key = element.key;
|
|
97
97
|
var text = properties.text, startPoint = properties.startPoint, endPoint = properties.endPoint, pointsList = properties.pointsList, logicFlowType = properties.logicFlowType;
|
|
@@ -25,7 +25,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
import { h, Component } from 'preact';
|
|
26
26
|
import { LogicFlowUtil } from '@logicflow/core';
|
|
27
27
|
import Rect from '../BasicShape/Rect';
|
|
28
|
-
import {
|
|
28
|
+
import { getDiamondResizeEdgePoint, getEllipseResizeEdgePoint, getRectResizeEdgePoint, ModelType } from './Util';
|
|
29
29
|
var StepDrag = LogicFlowUtil.StepDrag;
|
|
30
30
|
var Control = /** @class */ (function (_super) {
|
|
31
31
|
__extends(Control, _super);
|
|
@@ -123,12 +123,12 @@ var Control = /** @class */ (function (_super) {
|
|
|
123
123
|
var afterPoint;
|
|
124
124
|
edges.sourceEdges.forEach(function (item) {
|
|
125
125
|
params.point = item.startPoint;
|
|
126
|
-
afterPoint =
|
|
126
|
+
afterPoint = getRectResizeEdgePoint(params);
|
|
127
127
|
item.updateStartPoint(afterPoint);
|
|
128
128
|
});
|
|
129
129
|
edges.targetEdges.forEach(function (item) {
|
|
130
130
|
params.point = item.endPoint;
|
|
131
|
-
afterPoint =
|
|
131
|
+
afterPoint = getRectResizeEdgePoint(params);
|
|
132
132
|
item.updateEndPoint(afterPoint);
|
|
133
133
|
});
|
|
134
134
|
_this.eventEmit({ beforeNode: beforeNode, afterNode: afterNode });
|
|
@@ -187,12 +187,12 @@ var Control = /** @class */ (function (_super) {
|
|
|
187
187
|
var afterPoint;
|
|
188
188
|
edges.sourceEdges.forEach(function (item) {
|
|
189
189
|
params.point = item.startPoint;
|
|
190
|
-
afterPoint =
|
|
190
|
+
afterPoint = getEllipseResizeEdgePoint(params);
|
|
191
191
|
item.updateStartPoint(afterPoint);
|
|
192
192
|
});
|
|
193
193
|
edges.targetEdges.forEach(function (item) {
|
|
194
194
|
params.point = item.endPoint;
|
|
195
|
-
afterPoint =
|
|
195
|
+
afterPoint = getEllipseResizeEdgePoint(params);
|
|
196
196
|
item.updateEndPoint(afterPoint);
|
|
197
197
|
});
|
|
198
198
|
_this.eventEmit({ beforeNode: __assign(__assign({}, beforeNode), { rx: rx, ry: ry }), afterNode: afterNode });
|
|
@@ -251,12 +251,12 @@ var Control = /** @class */ (function (_super) {
|
|
|
251
251
|
var edges = _this.getNodeEdges(id);
|
|
252
252
|
edges.sourceEdges.forEach(function (item) {
|
|
253
253
|
params.point = item.startPoint;
|
|
254
|
-
afterPoint =
|
|
254
|
+
afterPoint = getDiamondResizeEdgePoint(params);
|
|
255
255
|
item.updateStartPoint(afterPoint);
|
|
256
256
|
});
|
|
257
257
|
edges.targetEdges.forEach(function (item) {
|
|
258
258
|
params.point = item.endPoint;
|
|
259
|
-
afterPoint =
|
|
259
|
+
afterPoint = getDiamondResizeEdgePoint(params);
|
|
260
260
|
item.updateEndPoint(afterPoint);
|
|
261
261
|
});
|
|
262
262
|
_this.eventEmit({ beforeNode: beforeNode, afterNode: afterNode });
|
|
@@ -268,7 +268,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
268
268
|
var newNodeSize = __assign({ id: id, modelType: modelType, type: type }, afterNode);
|
|
269
269
|
_this.graphModel.eventCenter.emit('node:resize', { oldNodeSize: oldNodeSize, newNodeSize: newNodeSize });
|
|
270
270
|
};
|
|
271
|
-
_this.
|
|
271
|
+
_this.onDragging = function (_a) {
|
|
272
272
|
var deltaX = _a.deltaX, deltaY = _a.deltaY;
|
|
273
273
|
var modelType = _this.nodeModel.modelType;
|
|
274
274
|
// html和矩形的计算方式是一样的,共用一个方法
|
|
@@ -298,7 +298,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
298
298
|
}
|
|
299
299
|
_this.state = {};
|
|
300
300
|
_this.dragHandler = new StepDrag({
|
|
301
|
-
|
|
301
|
+
onDragging: _this.onDragging,
|
|
302
302
|
step: step,
|
|
303
303
|
});
|
|
304
304
|
return _this;
|
|
@@ -13,7 +13,7 @@ export declare enum ModelType {
|
|
|
13
13
|
BEZIER_EDGE = "bezier-edge",
|
|
14
14
|
GRAPH = "graph"
|
|
15
15
|
}
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function getRectResizeEdgePoint({ point, beforeNode, afterNode }: {
|
|
17
17
|
point: any;
|
|
18
18
|
beforeNode: any;
|
|
19
19
|
afterNode: any;
|
|
@@ -21,12 +21,12 @@ export declare function getRectReizeEdgePoint({ point, beforeNode, afterNode }:
|
|
|
21
21
|
x: any;
|
|
22
22
|
y: any;
|
|
23
23
|
};
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function getEllipseResizeEdgePoint({ point, beforeNode, afterNode }: {
|
|
25
25
|
point: any;
|
|
26
26
|
beforeNode: any;
|
|
27
27
|
afterNode: any;
|
|
28
28
|
}): any;
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function getDiamondResizeEdgePoint({ point, beforeNode, afterNode }: {
|
|
30
30
|
point: any;
|
|
31
31
|
beforeNode: any;
|
|
32
32
|
afterNode: any;
|
|
@@ -25,7 +25,7 @@ function getNodeBox(node) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
// 计算矩形radius设置后,四个圆角的圆心
|
|
28
|
-
function
|
|
28
|
+
function getRadiusCenter(node) {
|
|
29
29
|
var nodeBox = getNodeBox(node);
|
|
30
30
|
var radius = node.radius;
|
|
31
31
|
var minX = nodeBox.minX, minY = nodeBox.minY, maxX = nodeBox.maxX, maxY = nodeBox.maxY;
|
|
@@ -49,7 +49,7 @@ function getRidusCenter(node) {
|
|
|
49
49
|
];
|
|
50
50
|
}
|
|
51
51
|
// 获取矩形resize之后,与矩形连接边的新端点
|
|
52
|
-
export function
|
|
52
|
+
export function getRectResizeEdgePoint(_a) {
|
|
53
53
|
var point = _a.point, beforeNode = _a.beforeNode, afterNode = _a.afterNode;
|
|
54
54
|
var x = point.x, y = point.y;
|
|
55
55
|
var afterPoint = {
|
|
@@ -104,8 +104,8 @@ export function getRectReizeEdgePoint(_a) {
|
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
106
|
// 在圆角部分
|
|
107
|
-
var
|
|
108
|
-
var afterCoc =
|
|
107
|
+
var beforeCoc = getRadiusCenter(beforeNode);
|
|
108
|
+
var afterCoc = getRadiusCenter(afterNode);
|
|
109
109
|
var nodeBox = getNodeBox(beforeNode);
|
|
110
110
|
var minX = nodeBox.minX, minY = nodeBox.minY, maxX = nodeBox.maxX, maxY = nodeBox.maxY;
|
|
111
111
|
var index = -1;
|
|
@@ -127,7 +127,7 @@ export function getRectReizeEdgePoint(_a) {
|
|
|
127
127
|
}
|
|
128
128
|
if (index > -1) {
|
|
129
129
|
// 根据夹角角度计算位置
|
|
130
|
-
var angle = Math.atan2((y -
|
|
130
|
+
var angle = Math.atan2((y - beforeCoc[index].y), (x - beforeCoc[index].x));
|
|
131
131
|
afterPoint.x = afterCoc[index].x + radius * Math.cos(angle);
|
|
132
132
|
afterPoint.y = afterCoc[index].y + radius * Math.sin(angle);
|
|
133
133
|
}
|
|
@@ -135,7 +135,7 @@ export function getRectReizeEdgePoint(_a) {
|
|
|
135
135
|
return afterPoint;
|
|
136
136
|
}
|
|
137
137
|
// 获取椭圆resize之后,与椭圆连接边的新端点
|
|
138
|
-
export function
|
|
138
|
+
export function getEllipseResizeEdgePoint(_a) {
|
|
139
139
|
var point = _a.point, beforeNode = _a.beforeNode, afterNode = _a.afterNode;
|
|
140
140
|
var rx = afterNode.rx, ry = afterNode.ry;
|
|
141
141
|
var afterPoint = point;
|
|
@@ -173,7 +173,7 @@ export function getEllipseReizeEdgePoint(_a) {
|
|
|
173
173
|
return afterPoint;
|
|
174
174
|
}
|
|
175
175
|
// 获取菱形resize之后,与菱形连接边的新端点
|
|
176
|
-
export function
|
|
176
|
+
export function getDiamondResizeEdgePoint(_a) {
|
|
177
177
|
var point = _a.point, beforeNode = _a.beforeNode, afterNode = _a.afterNode;
|
|
178
178
|
var afterPoint = point;
|
|
179
179
|
var x;
|
|
@@ -1,45 +1,53 @@
|
|
|
1
|
-
declare
|
|
2
|
-
pluginName: string;
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
declare class BpmnAdapter {
|
|
2
|
+
static pluginName: string;
|
|
3
|
+
static shapeConfigMap: Map<any, any>;
|
|
4
|
+
processAttributes: {
|
|
5
|
+
['-isExecutable']: string;
|
|
6
|
+
['-id']: string;
|
|
7
|
+
};
|
|
8
|
+
definitionAttributes: {
|
|
9
|
+
['-id']: string;
|
|
10
|
+
['-xmlns:xsi']: string;
|
|
11
|
+
['-xmlns:bpmn']: string;
|
|
12
|
+
['-xmlns:bpmndi']: string;
|
|
13
|
+
['-xmlns:dc']: string;
|
|
14
|
+
['-xmlns:di']: string;
|
|
15
|
+
['-targetNamespace']: string;
|
|
16
|
+
['-exporter']: string;
|
|
17
|
+
['-exporterVersion']: string;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
20
|
+
constructor({ lf }: {
|
|
21
|
+
lf: any;
|
|
22
|
+
});
|
|
5
23
|
setCustomShape(key: any, val: any): void;
|
|
6
|
-
adapterOut(data: any)
|
|
24
|
+
adapterOut: (data: any) => {
|
|
7
25
|
'bpmn:definitions': {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'-id': string;
|
|
19
|
-
'-isExecutable': string;
|
|
20
|
-
};
|
|
21
|
-
'bpmndi:BPMNDiagram': {
|
|
22
|
-
'-id': string;
|
|
23
|
-
'bpmndi:BPMNPlane': {
|
|
24
|
-
'-id': string;
|
|
25
|
-
'-bpmnElement': string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
"-id": string;
|
|
28
|
+
"-xmlns:xsi": string;
|
|
29
|
+
"-xmlns:bpmn": string;
|
|
30
|
+
"-xmlns:bpmndi": string;
|
|
31
|
+
"-xmlns:dc": string;
|
|
32
|
+
"-xmlns:di": string;
|
|
33
|
+
"-targetNamespace": string;
|
|
34
|
+
"-exporter": string;
|
|
35
|
+
"-exporterVersion": string;
|
|
28
36
|
};
|
|
29
37
|
};
|
|
30
|
-
adapterIn(bpmnData: any)
|
|
38
|
+
adapterIn: (bpmnData: any) => {
|
|
31
39
|
nodes: any[];
|
|
32
40
|
edges: any[];
|
|
33
41
|
};
|
|
34
|
-
}
|
|
35
|
-
declare
|
|
36
|
-
pluginName: string;
|
|
37
|
-
|
|
38
|
-
adapterXmlIn(bpmnData: any)
|
|
42
|
+
}
|
|
43
|
+
declare class BpmnXmlAdapter extends BpmnAdapter {
|
|
44
|
+
static pluginName: string;
|
|
45
|
+
constructor(data: any);
|
|
46
|
+
adapterXmlIn: (bpmnData: any) => {
|
|
39
47
|
nodes: any[];
|
|
40
48
|
edges: any[];
|
|
41
49
|
};
|
|
42
|
-
adapterXmlOut(data: any)
|
|
43
|
-
}
|
|
50
|
+
adapterXmlOut: (data: any) => string;
|
|
51
|
+
}
|
|
44
52
|
export { BpmnAdapter, BpmnXmlAdapter, };
|
|
45
53
|
export default BpmnAdapter;
|