@logicflow/extension 1.1.20 → 1.2.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.
- package/cjs/NodeResize/Control/Control.js +21 -17
- package/cjs/NodeResize/Control/Util.js +11 -11
- package/cjs/NodeResize/Node/DiamondResize.js +10 -8
- package/cjs/NodeResize/Node/EllipseResize.js +10 -8
- package/cjs/NodeResize/Node/HtmlResize.js +10 -8
- package/cjs/NodeResize/Node/RectResize.js +10 -8
- 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/control/index.js +16 -16
- package/cjs/components/menu/index.js +32 -32
- package/cjs/components/mini-map/index.js +2 -2
- package/cjs/components/selection-select/index.js +27 -7
- package/cjs/index.js +1 -0
- package/cjs/insert-node-in-polyline/edge.js +4 -4
- package/cjs/insert-node-in-polyline/index.js +1 -1
- package/cjs/locale/en-locale/en.js +22 -0
- package/cjs/locale/en-locale/index.js +29 -0
- package/cjs/locale/locale.js +19 -0
- package/cjs/materials/group/GroupNode.js +24 -14
- package/cjs/materials/group/index.js +3 -3
- package/cjs/tools/auto-layout/index.js +9 -9
- package/es/NodeResize/Control/Control.d.ts +1 -1
- package/es/NodeResize/Control/Control.js +22 -18
- package/es/NodeResize/Control/Util.d.ts +3 -3
- package/es/NodeResize/Control/Util.js +7 -7
- package/es/NodeResize/Node/DiamondResize.d.ts +1 -1
- package/es/NodeResize/Node/DiamondResize.js +10 -8
- package/es/NodeResize/Node/EllipseResize.d.ts +1 -1
- package/es/NodeResize/Node/EllipseResize.js +10 -8
- package/es/NodeResize/Node/HtmlResize.d.ts +1 -1
- package/es/NodeResize/Node/HtmlResize.js +10 -8
- package/es/NodeResize/Node/RectResize.d.ts +1 -1
- package/es/NodeResize/Node/RectResize.js +10 -8
- 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/control/index.d.ts +2 -3
- package/es/components/control/index.js +16 -16
- package/es/components/menu/index.d.ts +2 -3
- package/es/components/menu/index.js +32 -32
- package/es/components/mini-map/index.js +2 -2
- package/es/components/selection-select/index.d.ts +2 -1
- package/es/components/selection-select/index.js +27 -7
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- 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/locale/en-locale/en.d.ts +19 -0
- package/es/locale/en-locale/en.js +19 -0
- package/es/locale/en-locale/index.d.ts +9 -0
- package/es/locale/en-locale/index.js +26 -0
- package/es/locale/locale.d.ts +6 -0
- package/es/locale/locale.js +16 -0
- package/es/materials/group/GroupNode.d.ts +1 -1
- package/es/materials/group/GroupNode.js +24 -14
- 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/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/EnLocale.js +1 -0
- package/lib/FlowPath.js +1 -1
- package/lib/Group.js +1 -1
- package/lib/Highlight.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/NodeResize/Node/DiamondResize.d.ts +1 -1
- package/types/NodeResize/Node/EllipseResize.d.ts +1 -1
- package/types/NodeResize/Node/HtmlResize.d.ts +1 -1
- package/types/NodeResize/Node/RectResize.d.ts +1 -1
- package/types/bpmn-adapter/index.d.ts +41 -33
- package/types/components/control/index.d.ts +2 -3
- package/types/components/menu/index.d.ts +2 -3
- package/types/components/selection-select/index.d.ts +2 -1
- package/types/index.d.ts +1 -0
- 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
|
@@ -37,9 +37,11 @@ var Control = /** @class */ (function (_super) {
|
|
|
37
37
|
_this.updatePosition = function (_a) {
|
|
38
38
|
var deltaX = _a.deltaX, deltaY = _a.deltaY;
|
|
39
39
|
var _b = _this.nodeModel, x = _b.x, y = _b.y;
|
|
40
|
-
_this.nodeModel.x = x + deltaX / 2;
|
|
41
|
-
_this.nodeModel.y = y + deltaY / 2;
|
|
42
40
|
_this.nodeModel.moveText(deltaX / 2, deltaY / 2);
|
|
41
|
+
_this.nodeModel.updateAttributes({
|
|
42
|
+
x: x + deltaX / 2,
|
|
43
|
+
y: y + deltaY / 2,
|
|
44
|
+
});
|
|
43
45
|
};
|
|
44
46
|
// 计算control拖动后,节点的宽高
|
|
45
47
|
_this.getResize = function (_a) {
|
|
@@ -55,7 +57,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
55
57
|
resize.height = height - deltaY * pct;
|
|
56
58
|
break;
|
|
57
59
|
case 2:
|
|
58
|
-
resize.width = width + deltaX;
|
|
60
|
+
resize.width = width + deltaX * pct;
|
|
59
61
|
resize.height = height + deltaY * pct;
|
|
60
62
|
break;
|
|
61
63
|
case 3:
|
|
@@ -93,14 +95,16 @@ var Control = /** @class */ (function (_super) {
|
|
|
93
95
|
}
|
|
94
96
|
_this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
|
|
95
97
|
// 更新宽高
|
|
96
|
-
_this.nodeModel.width = size.width;
|
|
97
|
-
_this.nodeModel.height = size.height;
|
|
98
98
|
_this.nodeModel.setProperties({
|
|
99
99
|
nodeSize: {
|
|
100
100
|
width: size.width,
|
|
101
101
|
height: size.height,
|
|
102
102
|
},
|
|
103
103
|
});
|
|
104
|
+
_this.nodeModel.updateAttributes({
|
|
105
|
+
width: size.width,
|
|
106
|
+
height: size.height,
|
|
107
|
+
});
|
|
104
108
|
var edges = _this.getNodeEdges(id);
|
|
105
109
|
var beforeNode = {
|
|
106
110
|
x: x,
|
|
@@ -125,12 +129,12 @@ var Control = /** @class */ (function (_super) {
|
|
|
125
129
|
var afterPoint;
|
|
126
130
|
edges.sourceEdges.forEach(function (item) {
|
|
127
131
|
params.point = item.startPoint;
|
|
128
|
-
afterPoint = Util_1.
|
|
132
|
+
afterPoint = Util_1.getRectResizeEdgePoint(params);
|
|
129
133
|
item.updateStartPoint(afterPoint);
|
|
130
134
|
});
|
|
131
135
|
edges.targetEdges.forEach(function (item) {
|
|
132
136
|
params.point = item.endPoint;
|
|
133
|
-
afterPoint = Util_1.
|
|
137
|
+
afterPoint = Util_1.getRectResizeEdgePoint(params);
|
|
134
138
|
item.updateEndPoint(afterPoint);
|
|
135
139
|
});
|
|
136
140
|
_this.eventEmit({ beforeNode: beforeNode, afterNode: afterNode });
|
|
@@ -163,9 +167,9 @@ var Control = /** @class */ (function (_super) {
|
|
|
163
167
|
_this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
|
|
164
168
|
// 更新rx ry,宽高为计算属性自动更新
|
|
165
169
|
// @ts-ignore
|
|
166
|
-
_this.nodeModel.rx =
|
|
170
|
+
_this.nodeModel.rx = size.width;
|
|
167
171
|
// @ts-ignore
|
|
168
|
-
_this.nodeModel.ry =
|
|
172
|
+
_this.nodeModel.ry = size.height;
|
|
169
173
|
_this.nodeModel.setProperties({
|
|
170
174
|
nodeSize: {
|
|
171
175
|
rx: size.width,
|
|
@@ -189,12 +193,12 @@ var Control = /** @class */ (function (_super) {
|
|
|
189
193
|
var afterPoint;
|
|
190
194
|
edges.sourceEdges.forEach(function (item) {
|
|
191
195
|
params.point = item.startPoint;
|
|
192
|
-
afterPoint = Util_1.
|
|
196
|
+
afterPoint = Util_1.getEllipseResizeEdgePoint(params);
|
|
193
197
|
item.updateStartPoint(afterPoint);
|
|
194
198
|
});
|
|
195
199
|
edges.targetEdges.forEach(function (item) {
|
|
196
200
|
params.point = item.endPoint;
|
|
197
|
-
afterPoint = Util_1.
|
|
201
|
+
afterPoint = Util_1.getEllipseResizeEdgePoint(params);
|
|
198
202
|
item.updateEndPoint(afterPoint);
|
|
199
203
|
});
|
|
200
204
|
_this.eventEmit({ beforeNode: __assign(__assign({}, beforeNode), { rx: rx, ry: ry }), afterNode: afterNode });
|
|
@@ -227,9 +231,9 @@ var Control = /** @class */ (function (_super) {
|
|
|
227
231
|
_this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
|
|
228
232
|
// 更新rx ry,宽高为计算属性自动更新
|
|
229
233
|
// @ts-ignore
|
|
230
|
-
_this.nodeModel.rx =
|
|
234
|
+
_this.nodeModel.rx = size.width;
|
|
231
235
|
// @ts-ignore
|
|
232
|
-
_this.nodeModel.ry =
|
|
236
|
+
_this.nodeModel.ry = size.height;
|
|
233
237
|
_this.nodeModel.setProperties({
|
|
234
238
|
nodeSize: {
|
|
235
239
|
rx: size.width,
|
|
@@ -253,12 +257,12 @@ var Control = /** @class */ (function (_super) {
|
|
|
253
257
|
var edges = _this.getNodeEdges(id);
|
|
254
258
|
edges.sourceEdges.forEach(function (item) {
|
|
255
259
|
params.point = item.startPoint;
|
|
256
|
-
afterPoint = Util_1.
|
|
260
|
+
afterPoint = Util_1.getDiamondResizeEdgePoint(params);
|
|
257
261
|
item.updateStartPoint(afterPoint);
|
|
258
262
|
});
|
|
259
263
|
edges.targetEdges.forEach(function (item) {
|
|
260
264
|
params.point = item.endPoint;
|
|
261
|
-
afterPoint = Util_1.
|
|
265
|
+
afterPoint = Util_1.getDiamondResizeEdgePoint(params);
|
|
262
266
|
item.updateEndPoint(afterPoint);
|
|
263
267
|
});
|
|
264
268
|
_this.eventEmit({ beforeNode: beforeNode, afterNode: afterNode });
|
|
@@ -270,7 +274,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
270
274
|
var newNodeSize = __assign({ id: id, modelType: modelType, type: type }, afterNode);
|
|
271
275
|
_this.graphModel.eventCenter.emit('node:resize', { oldNodeSize: oldNodeSize, newNodeSize: newNodeSize });
|
|
272
276
|
};
|
|
273
|
-
_this.
|
|
277
|
+
_this.onDragging = function (_a) {
|
|
274
278
|
var deltaX = _a.deltaX, deltaY = _a.deltaY;
|
|
275
279
|
var modelType = _this.nodeModel.modelType;
|
|
276
280
|
// html和矩形的计算方式是一样的,共用一个方法
|
|
@@ -300,7 +304,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
300
304
|
}
|
|
301
305
|
_this.state = {};
|
|
302
306
|
_this.dragHandler = new StepDrag({
|
|
303
|
-
|
|
307
|
+
onDragging: _this.onDragging,
|
|
304
308
|
step: step,
|
|
305
309
|
});
|
|
306
310
|
return _this;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getDiamondResizeEdgePoint = exports.getEllipseResizeEdgePoint = exports.getRectResizeEdgePoint = exports.ModelType = void 0;
|
|
4
4
|
var ModelType;
|
|
5
5
|
(function (ModelType) {
|
|
6
6
|
ModelType["NODE"] = "node";
|
|
@@ -28,7 +28,7 @@ function getNodeBox(node) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
// 计算矩形radius设置后,四个圆角的圆心
|
|
31
|
-
function
|
|
31
|
+
function getRadiusCenter(node) {
|
|
32
32
|
var nodeBox = getNodeBox(node);
|
|
33
33
|
var radius = node.radius;
|
|
34
34
|
var minX = nodeBox.minX, minY = nodeBox.minY, maxX = nodeBox.maxX, maxY = nodeBox.maxY;
|
|
@@ -52,7 +52,7 @@ function getRidusCenter(node) {
|
|
|
52
52
|
];
|
|
53
53
|
}
|
|
54
54
|
// 获取矩形resize之后,与矩形连接边的新端点
|
|
55
|
-
function
|
|
55
|
+
function getRectResizeEdgePoint(_a) {
|
|
56
56
|
var point = _a.point, beforeNode = _a.beforeNode, afterNode = _a.afterNode;
|
|
57
57
|
var x = point.x, y = point.y;
|
|
58
58
|
var afterPoint = {
|
|
@@ -107,8 +107,8 @@ function getRectReizeEdgePoint(_a) {
|
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
109
|
// 在圆角部分
|
|
110
|
-
var
|
|
111
|
-
var afterCoc =
|
|
110
|
+
var beforeCoc = getRadiusCenter(beforeNode);
|
|
111
|
+
var afterCoc = getRadiusCenter(afterNode);
|
|
112
112
|
var nodeBox = getNodeBox(beforeNode);
|
|
113
113
|
var minX = nodeBox.minX, minY = nodeBox.minY, maxX = nodeBox.maxX, maxY = nodeBox.maxY;
|
|
114
114
|
var index = -1;
|
|
@@ -130,16 +130,16 @@ function getRectReizeEdgePoint(_a) {
|
|
|
130
130
|
}
|
|
131
131
|
if (index > -1) {
|
|
132
132
|
// 根据夹角角度计算位置
|
|
133
|
-
var angle = Math.atan2((y -
|
|
133
|
+
var angle = Math.atan2((y - beforeCoc[index].y), (x - beforeCoc[index].x));
|
|
134
134
|
afterPoint.x = afterCoc[index].x + radius * Math.cos(angle);
|
|
135
135
|
afterPoint.y = afterCoc[index].y + radius * Math.sin(angle);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
return afterPoint;
|
|
139
139
|
}
|
|
140
|
-
exports.
|
|
140
|
+
exports.getRectResizeEdgePoint = getRectResizeEdgePoint;
|
|
141
141
|
// 获取椭圆resize之后,与椭圆连接边的新端点
|
|
142
|
-
function
|
|
142
|
+
function getEllipseResizeEdgePoint(_a) {
|
|
143
143
|
var point = _a.point, beforeNode = _a.beforeNode, afterNode = _a.afterNode;
|
|
144
144
|
var rx = afterNode.rx, ry = afterNode.ry;
|
|
145
145
|
var afterPoint = point;
|
|
@@ -176,9 +176,9 @@ function getEllipseReizeEdgePoint(_a) {
|
|
|
176
176
|
afterPoint = { x: x + afterNode.x, y: y + afterNode.y };
|
|
177
177
|
return afterPoint;
|
|
178
178
|
}
|
|
179
|
-
exports.
|
|
179
|
+
exports.getEllipseResizeEdgePoint = getEllipseResizeEdgePoint;
|
|
180
180
|
// 获取菱形resize之后,与菱形连接边的新端点
|
|
181
|
-
function
|
|
181
|
+
function getDiamondResizeEdgePoint(_a) {
|
|
182
182
|
var point = _a.point, beforeNode = _a.beforeNode, afterNode = _a.afterNode;
|
|
183
183
|
var afterPoint = point;
|
|
184
184
|
var x;
|
|
@@ -213,4 +213,4 @@ function getDiamondReizeEdgePoint(_a) {
|
|
|
213
213
|
};
|
|
214
214
|
return afterPoint;
|
|
215
215
|
}
|
|
216
|
-
exports.
|
|
216
|
+
exports.getDiamondResizeEdgePoint = getDiamondResizeEdgePoint;
|
|
@@ -29,14 +29,8 @@ var ControlGroup_1 = require("../Control/ControlGroup");
|
|
|
29
29
|
var Polygon_1 = require("../BasicShape/Polygon");
|
|
30
30
|
var DiamondResizeModel = /** @class */ (function (_super) {
|
|
31
31
|
__extends(DiamondResizeModel, _super);
|
|
32
|
-
function DiamondResizeModel(
|
|
33
|
-
|
|
34
|
-
var nodeSize = _this.properties.nodeSize;
|
|
35
|
-
if (nodeSize) {
|
|
36
|
-
_this.rx = nodeSize.rx;
|
|
37
|
-
_this.ry = nodeSize.ry;
|
|
38
|
-
}
|
|
39
|
-
return _this;
|
|
32
|
+
function DiamondResizeModel() {
|
|
33
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
40
34
|
}
|
|
41
35
|
DiamondResizeModel.prototype.initNodeData = function (data) {
|
|
42
36
|
_super.prototype.initNodeData.call(this, data);
|
|
@@ -46,6 +40,14 @@ var DiamondResizeModel = /** @class */ (function (_super) {
|
|
|
46
40
|
this.maxHeight = 2000;
|
|
47
41
|
this.gridSize = 1;
|
|
48
42
|
};
|
|
43
|
+
DiamondResizeModel.prototype.init = function () {
|
|
44
|
+
_super.prototype.init.call(this);
|
|
45
|
+
var nodeSize = this.properties.nodeSize;
|
|
46
|
+
if (nodeSize) {
|
|
47
|
+
this.rx = nodeSize.rx;
|
|
48
|
+
this.ry = nodeSize.ry;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
49
51
|
DiamondResizeModel.prototype.getOutlineStyle = function () {
|
|
50
52
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
51
53
|
style.stroke = 'none';
|
|
@@ -17,14 +17,8 @@ var core_1 = require("@logicflow/core");
|
|
|
17
17
|
var ControlGroup_1 = require("../Control/ControlGroup");
|
|
18
18
|
var EllipseResizeModel = /** @class */ (function (_super) {
|
|
19
19
|
__extends(EllipseResizeModel, _super);
|
|
20
|
-
function EllipseResizeModel(
|
|
21
|
-
|
|
22
|
-
var nodeSize = _this.properties.nodeSize;
|
|
23
|
-
if (nodeSize) {
|
|
24
|
-
_this.rx = nodeSize.rx;
|
|
25
|
-
_this.ry = nodeSize.ry;
|
|
26
|
-
}
|
|
27
|
-
return _this;
|
|
20
|
+
function EllipseResizeModel() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
22
|
}
|
|
29
23
|
EllipseResizeModel.prototype.initNodeData = function (data) {
|
|
30
24
|
_super.prototype.initNodeData.call(this, data);
|
|
@@ -33,6 +27,14 @@ var EllipseResizeModel = /** @class */ (function (_super) {
|
|
|
33
27
|
this.maxWidth = 2000;
|
|
34
28
|
this.maxHeight = 2000;
|
|
35
29
|
};
|
|
30
|
+
EllipseResizeModel.prototype.init = function () {
|
|
31
|
+
_super.prototype.init.call(this);
|
|
32
|
+
var nodeSize = this.properties.nodeSize;
|
|
33
|
+
if (nodeSize) {
|
|
34
|
+
this.rx = nodeSize.rx;
|
|
35
|
+
this.ry = nodeSize.ry;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
36
38
|
EllipseResizeModel.prototype.getOutlineStyle = function () {
|
|
37
39
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
38
40
|
style.stroke = 'none';
|
|
@@ -17,14 +17,8 @@ var core_1 = require("@logicflow/core");
|
|
|
17
17
|
var ControlGroup_1 = require("../Control/ControlGroup");
|
|
18
18
|
var HtmlResizeModel = /** @class */ (function (_super) {
|
|
19
19
|
__extends(HtmlResizeModel, _super);
|
|
20
|
-
function HtmlResizeModel(
|
|
21
|
-
|
|
22
|
-
var nodeSize = _this.properties.nodeSize;
|
|
23
|
-
if (nodeSize) {
|
|
24
|
-
_this.width = nodeSize.width;
|
|
25
|
-
_this.height = nodeSize.height;
|
|
26
|
-
}
|
|
27
|
-
return _this;
|
|
20
|
+
function HtmlResizeModel() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
22
|
}
|
|
29
23
|
HtmlResizeModel.prototype.initNodeData = function (data) {
|
|
30
24
|
_super.prototype.initNodeData.call(this, data);
|
|
@@ -33,6 +27,14 @@ var HtmlResizeModel = /** @class */ (function (_super) {
|
|
|
33
27
|
this.maxWidth = 2000;
|
|
34
28
|
this.maxHeight = 2000;
|
|
35
29
|
};
|
|
30
|
+
HtmlResizeModel.prototype.init = function () {
|
|
31
|
+
_super.prototype.init.call(this);
|
|
32
|
+
var nodeSize = this.properties.nodeSize;
|
|
33
|
+
if (nodeSize) {
|
|
34
|
+
this.width = nodeSize.width;
|
|
35
|
+
this.height = nodeSize.height;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
36
38
|
HtmlResizeModel.prototype.getOutlineStyle = function () {
|
|
37
39
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
38
40
|
style.stroke = 'none';
|
|
@@ -17,14 +17,8 @@ var core_1 = require("@logicflow/core");
|
|
|
17
17
|
var ControlGroup_1 = require("../Control/ControlGroup");
|
|
18
18
|
var RectResizeModel = /** @class */ (function (_super) {
|
|
19
19
|
__extends(RectResizeModel, _super);
|
|
20
|
-
function RectResizeModel(
|
|
21
|
-
|
|
22
|
-
var nodeSize = _this.properties.nodeSize;
|
|
23
|
-
if (nodeSize) {
|
|
24
|
-
_this.width = nodeSize.width;
|
|
25
|
-
_this.height = nodeSize.height;
|
|
26
|
-
}
|
|
27
|
-
return _this;
|
|
20
|
+
function RectResizeModel() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
22
|
}
|
|
29
23
|
RectResizeModel.prototype.initNodeData = function (data) {
|
|
30
24
|
_super.prototype.initNodeData.call(this, data);
|
|
@@ -33,6 +27,14 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
33
27
|
this.maxWidth = 2000;
|
|
34
28
|
this.maxHeight = 2000;
|
|
35
29
|
};
|
|
30
|
+
RectResizeModel.prototype.init = function () {
|
|
31
|
+
_super.prototype.init.call(this);
|
|
32
|
+
var nodeSize = this.properties.nodeSize;
|
|
33
|
+
if (nodeSize) {
|
|
34
|
+
this.width = nodeSize.width;
|
|
35
|
+
this.height = nodeSize.height;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
36
38
|
RectResizeModel.prototype.getOutlineStyle = function () {
|
|
37
39
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
38
40
|
style.stroke = 'none';
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
2
26
|
var __read = (this && this.__read) || function (o, n) {
|
|
3
27
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
28
|
if (!m) return o;
|
|
@@ -32,8 +56,8 @@ var BpmnElements;
|
|
|
32
56
|
})(BpmnElements || (BpmnElements = {}));
|
|
33
57
|
var defaultAttrs = ['-name', '-id', 'bpmn:incoming', 'bpmn:outgoing', '-sourceRef', '-targetRef'];
|
|
34
58
|
/**
|
|
35
|
-
* 将普通json转换为
|
|
36
|
-
*
|
|
59
|
+
* 将普通json转换为xmlJson
|
|
60
|
+
* xmlJson中property会以“-”开头
|
|
37
61
|
* 如果没有“-”表示为子节点
|
|
38
62
|
*/
|
|
39
63
|
function toXmlJson(json) {
|
|
@@ -117,8 +141,6 @@ function convertLf2ProcessData(bpmnProcessData, data) {
|
|
|
117
141
|
var sequenceFlow = data.edges.map(function (edge) {
|
|
118
142
|
var _a, _b;
|
|
119
143
|
var targetNode = nodeMap.get(edge.targetNodeId);
|
|
120
|
-
// @see https://github.com/didi/LogicFlow/issues/325
|
|
121
|
-
// 需要保证incomming在outgoing之前
|
|
122
144
|
if (!targetNode['bpmn:incoming']) {
|
|
123
145
|
targetNode['bpmn:incoming'] = edge.id;
|
|
124
146
|
}
|
|
@@ -131,19 +153,17 @@ function convertLf2ProcessData(bpmnProcessData, data) {
|
|
|
131
153
|
edge.id,
|
|
132
154
|
];
|
|
133
155
|
}
|
|
134
|
-
|
|
135
|
-
if (!sourceNode['bpmn:outgoing']) {
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
];
|
|
146
|
-
}
|
|
156
|
+
// const sourceNode = nodeMap.get(edge.sourceNodeId);
|
|
157
|
+
// if (!sourceNode['bpmn:outgoing']) {
|
|
158
|
+
// sourceNode['bpmn:outgoing'] = edge.id;
|
|
159
|
+
// } else if (Array.isArray(sourceNode['bpmn:outgoing'])) {
|
|
160
|
+
// sourceNode['bpmn:outgoing'].push(edge.id);
|
|
161
|
+
// } else { // 字符串转数组
|
|
162
|
+
// sourceNode['bpmn:outgoing'] = [
|
|
163
|
+
// sourceNode['bpmn:outgoing'],
|
|
164
|
+
// edge.id,
|
|
165
|
+
// ];
|
|
166
|
+
// }
|
|
147
167
|
var edgeConfig = {
|
|
148
168
|
'-id': edge.id,
|
|
149
169
|
'-sourceRef': edge.sourceNodeId,
|
|
@@ -158,6 +178,23 @@ function convertLf2ProcessData(bpmnProcessData, data) {
|
|
|
158
178
|
}
|
|
159
179
|
return edgeConfig;
|
|
160
180
|
});
|
|
181
|
+
// @see https://github.com/didi/LogicFlow/issues/325
|
|
182
|
+
// 需要保证incoming在outgoing之前
|
|
183
|
+
data.edges.forEach(function (edge) {
|
|
184
|
+
var sourceNode = nodeMap.get(edge.sourceNodeId);
|
|
185
|
+
if (!sourceNode['bpmn:outgoing']) {
|
|
186
|
+
sourceNode['bpmn:outgoing'] = edge.id;
|
|
187
|
+
}
|
|
188
|
+
else if (Array.isArray(sourceNode['bpmn:outgoing'])) {
|
|
189
|
+
sourceNode['bpmn:outgoing'].push(edge.id);
|
|
190
|
+
}
|
|
191
|
+
else { // 字符串转数组
|
|
192
|
+
sourceNode['bpmn:outgoing'] = [
|
|
193
|
+
sourceNode['bpmn:outgoing'],
|
|
194
|
+
edge.id,
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
161
198
|
bpmnProcessData[BpmnElements.FLOW] = sequenceFlow;
|
|
162
199
|
}
|
|
163
200
|
/**
|
|
@@ -402,53 +439,59 @@ function getEdgeConfig(edgeValue, processValue) {
|
|
|
402
439
|
}
|
|
403
440
|
return edge;
|
|
404
441
|
}
|
|
405
|
-
var BpmnAdapter = {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
lf
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
'
|
|
442
|
+
var BpmnAdapter = /** @class */ (function () {
|
|
443
|
+
function BpmnAdapter(_a) {
|
|
444
|
+
var _this = this;
|
|
445
|
+
var lf = _a.lf;
|
|
446
|
+
this.adapterOut = function (data) {
|
|
447
|
+
var bpmnProcessData = __assign({}, _this.processAttributes);
|
|
448
|
+
convertLf2ProcessData(bpmnProcessData, data);
|
|
449
|
+
var bpmnDiagramData = {
|
|
450
|
+
'-id': 'BPMNPlane_1',
|
|
451
|
+
'-bpmnElement': bpmnProcessData['-id'],
|
|
452
|
+
};
|
|
453
|
+
convertLf2DiagramData(bpmnDiagramData, data);
|
|
454
|
+
var definitions = _this.definitionAttributes;
|
|
455
|
+
definitions['bpmn:process'] = bpmnProcessData;
|
|
456
|
+
definitions['bpmndi:BPMNDiagram'] = {
|
|
457
|
+
'-id': 'BPMNDiagram_1',
|
|
458
|
+
'bpmndi:BPMNPlane': bpmnDiagramData,
|
|
459
|
+
};
|
|
460
|
+
var bpmnData = {
|
|
461
|
+
'bpmn:definitions': definitions,
|
|
462
|
+
};
|
|
463
|
+
return bpmnData;
|
|
464
|
+
};
|
|
465
|
+
this.adapterIn = function (bpmnData) {
|
|
466
|
+
if (bpmnData) {
|
|
467
|
+
return convertBpmn2LfData(bpmnData);
|
|
468
|
+
}
|
|
419
469
|
};
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
'-
|
|
470
|
+
lf.adapterIn = function (data) { return _this.adapterIn(data); };
|
|
471
|
+
lf.adapterOut = function (data) { return _this.adapterOut(data); };
|
|
472
|
+
this.processAttributes = {
|
|
473
|
+
'-isExecutable': 'true',
|
|
474
|
+
'-id': "Process_" + bpmnIds_1.getBpmnId(),
|
|
424
475
|
};
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
'
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
'-exporter': 'bpmn-js (https://demo.bpmn.io)',
|
|
436
|
-
'-exporterVersion': '7.3.0',
|
|
437
|
-
'bpmn:process': bpmnProcessData,
|
|
438
|
-
'bpmndi:BPMNDiagram': {
|
|
439
|
-
'-id': 'BPMNDiagram_1',
|
|
440
|
-
'bpmndi:BPMNPlane': bpmnDiagramData,
|
|
441
|
-
},
|
|
442
|
-
},
|
|
476
|
+
this.definitionAttributes = {
|
|
477
|
+
'-id': "Definitions_" + bpmnIds_1.getBpmnId(),
|
|
478
|
+
'-xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
|
479
|
+
'-xmlns:bpmn': 'http://www.omg.org/spec/BPMN/20100524/MODEL',
|
|
480
|
+
'-xmlns:bpmndi': 'http://www.omg.org/spec/BPMN/20100524/DI',
|
|
481
|
+
'-xmlns:dc': 'http://www.omg.org/spec/DD/20100524/DC',
|
|
482
|
+
'-xmlns:di': 'http://www.omg.org/spec/DD/20100524/DI',
|
|
483
|
+
'-targetNamespace': 'http://logic-flow.org',
|
|
484
|
+
'-exporter': 'logicflow',
|
|
485
|
+
'-exporterVersion': '1.2.0',
|
|
443
486
|
};
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
};
|
|
487
|
+
}
|
|
488
|
+
BpmnAdapter.prototype.setCustomShape = function (key, val) {
|
|
489
|
+
BpmnAdapter.shapeConfigMap.set(key, val);
|
|
490
|
+
};
|
|
491
|
+
BpmnAdapter.pluginName = 'bpmn-adapter';
|
|
492
|
+
BpmnAdapter.shapeConfigMap = new Map();
|
|
493
|
+
return BpmnAdapter;
|
|
494
|
+
}());
|
|
452
495
|
exports.BpmnAdapter = BpmnAdapter;
|
|
453
496
|
BpmnAdapter.shapeConfigMap.set(BpmnElements.START, {
|
|
454
497
|
width: constant_1.StartEventConfig.width,
|
|
@@ -470,20 +513,25 @@ BpmnAdapter.shapeConfigMap.set(BpmnElements.USER, {
|
|
|
470
513
|
width: constant_1.UserTaskConfig.width,
|
|
471
514
|
height: constant_1.UserTaskConfig.height,
|
|
472
515
|
});
|
|
473
|
-
var BpmnXmlAdapter = {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
516
|
+
var BpmnXmlAdapter = /** @class */ (function (_super) {
|
|
517
|
+
__extends(BpmnXmlAdapter, _super);
|
|
518
|
+
function BpmnXmlAdapter(data) {
|
|
519
|
+
var _this = _super.call(this, data) || this;
|
|
520
|
+
_this.adapterXmlIn = function (bpmnData) {
|
|
521
|
+
var json = xml2json_1.lfXml2Json(bpmnData);
|
|
522
|
+
return _this.adapterIn(json);
|
|
523
|
+
};
|
|
524
|
+
_this.adapterXmlOut = function (data) {
|
|
525
|
+
var outData = _this.adapterOut(data);
|
|
526
|
+
return json2xml_1.lfJson2Xml(outData);
|
|
527
|
+
};
|
|
528
|
+
var lf = data.lf;
|
|
529
|
+
lf.adapterIn = _this.adapterXmlIn;
|
|
530
|
+
lf.adapterOut = _this.adapterXmlOut;
|
|
531
|
+
return _this;
|
|
532
|
+
}
|
|
533
|
+
BpmnXmlAdapter.pluginName = 'bpmnXmlAdapter';
|
|
534
|
+
return BpmnXmlAdapter;
|
|
535
|
+
}(BpmnAdapter));
|
|
488
536
|
exports.BpmnXmlAdapter = BpmnXmlAdapter;
|
|
489
537
|
exports.default = BpmnAdapter;
|
|
@@ -25,10 +25,13 @@ function toXml(v, name, ind, deep) {
|
|
|
25
25
|
var hasChild = false;
|
|
26
26
|
xml += addIndSpace(ind, deep) + "<" + name;
|
|
27
27
|
for (var m in v) {
|
|
28
|
-
if (m.charAt(0) == "-")
|
|
28
|
+
if (m.charAt(0) == "-") {
|
|
29
|
+
console.log(m, v[m]);
|
|
29
30
|
xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\"";
|
|
30
|
-
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
31
33
|
hasChild = true;
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
xml += hasChild ? ">" : " />";
|
|
34
37
|
if (hasChild) {
|