@logicflow/extension 1.1.13 → 1.2.0-alpha.2
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/control/index.js +13 -13
- package/cjs/components/menu/index.js +32 -32
- package/cjs/components/mini-map/index.js +2 -2
- package/cjs/components/selection-select/index.js +5 -5
- 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 +2 -2
- package/cjs/materials/group/index.js +3 -3
- package/cjs/tools/auto-layout/index.js +9 -9
- 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/control/index.d.ts +2 -3
- package/es/components/control/index.js +13 -13
- 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 +1 -1
- package/es/components/selection-select/index.js +5 -5
- 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 +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/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/EnLocale.js +1 -0
- 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/control/index.d.ts +2 -3
- package/types/components/menu/index.d.ts +2 -3
- package/types/components/selection-select/index.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/insert-node-in-polyline/edge.d.ts +3 -3
- package/types/locale/en-locale/en.d.ts +19 -0
- package/types/locale/en-locale/index.d.ts +9 -0
- package/types/locale/locale.d.ts +6 -0
- 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
|
@@ -6,7 +6,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
6
6
|
var _this = this;
|
|
7
7
|
var lf = _a.lf;
|
|
8
8
|
this.__disabled = false;
|
|
9
|
-
this.
|
|
9
|
+
this.isDefaultStopMoveGraph = false;
|
|
10
10
|
this.isWholeNode = true;
|
|
11
11
|
this.isWholeEdge = true;
|
|
12
12
|
this.__draw = function (ev) {
|
|
@@ -50,9 +50,9 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
50
50
|
_this.lf.emit('selection:selected', elements);
|
|
51
51
|
};
|
|
52
52
|
this.lf = lf;
|
|
53
|
-
// 初始化
|
|
53
|
+
// 初始化isDefaultStopMoveGraph取值
|
|
54
54
|
var stopMoveGraph = lf.getEditConfig().stopMoveGraph;
|
|
55
|
-
this.
|
|
55
|
+
this.isDefaultStopMoveGraph = stopMoveGraph;
|
|
56
56
|
lf.openSelectionSelect = function () {
|
|
57
57
|
_this.openSelectionSelect();
|
|
58
58
|
};
|
|
@@ -100,7 +100,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
100
100
|
SelectionSelect.prototype.openSelectionSelect = function () {
|
|
101
101
|
var stopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
|
|
102
102
|
if (!stopMoveGraph) {
|
|
103
|
-
this.
|
|
103
|
+
this.isDefaultStopMoveGraph = false;
|
|
104
104
|
this.lf.updateEditConfig({
|
|
105
105
|
stopMoveGraph: true,
|
|
106
106
|
});
|
|
@@ -111,7 +111,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
111
111
|
* 关闭选区
|
|
112
112
|
*/
|
|
113
113
|
SelectionSelect.prototype.closeSelectionSelect = function () {
|
|
114
|
-
if (!this.
|
|
114
|
+
if (!this.isDefaultStopMoveGraph) {
|
|
115
115
|
this.lf.updateEditConfig({
|
|
116
116
|
stopMoveGraph: false,
|
|
117
117
|
});
|
package/cjs/index.js
CHANGED
|
@@ -29,3 +29,4 @@ __exportStar(require("./tools/flow-path"), exports);
|
|
|
29
29
|
__exportStar(require("./tools/auto-layout"), exports);
|
|
30
30
|
__exportStar(require("./bpmn-adapter/xml2json"), exports);
|
|
31
31
|
__exportStar(require("./bpmn-adapter/json2xml"), exports);
|
|
32
|
+
__exportStar(require("./locale/en-locale"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isNodeInSegment = exports.crossPointInSegment = exports.isInSegment = void 0;
|
|
4
4
|
// 这个里面的函数有些在core中已经存在,为了解耦关系,没有引用
|
|
5
5
|
var SegmentDirection;
|
|
6
6
|
(function (SegmentDirection) {
|
|
@@ -45,7 +45,7 @@ var segmentDirection = function (start, end) {
|
|
|
45
45
|
return direction;
|
|
46
46
|
};
|
|
47
47
|
// 节点是够在线段内,求出节点与线段的交点
|
|
48
|
-
exports.
|
|
48
|
+
exports.crossPointInSegment = function (node, start, end) {
|
|
49
49
|
var bBox = getNodeBBox(node);
|
|
50
50
|
var direction = segmentDirection(start, end);
|
|
51
51
|
var maxX = Math.max(start.x, end.x);
|
|
@@ -86,12 +86,12 @@ exports.corssPointInSegement = function (node, start, end) {
|
|
|
86
86
|
};
|
|
87
87
|
// 节点是否在线段内
|
|
88
88
|
// eslint-disable-next-line max-len
|
|
89
|
-
exports.
|
|
89
|
+
exports.isNodeInSegment = function (node, polyline) {
|
|
90
90
|
var x = node.x, y = node.y;
|
|
91
91
|
var pointsList = polyline.pointsList;
|
|
92
92
|
for (var i = 0; i < pointsList.length - 1; i++) {
|
|
93
93
|
if (exports.isInSegment({ x: x, y: y }, pointsList[i], pointsList[i + 1])) {
|
|
94
|
-
var bBoxCross = exports.
|
|
94
|
+
var bBoxCross = exports.crossPointInSegment(node, pointsList[i], pointsList[i + 1]);
|
|
95
95
|
if (bBoxCross) {
|
|
96
96
|
return {
|
|
97
97
|
crossIndex: i + 1,
|
|
@@ -62,7 +62,7 @@ var InsertNodeInPolyline = /** @class */ (function () {
|
|
|
62
62
|
var nodeModel = this._lf.getNodeModelById(nodeData.id);
|
|
63
63
|
for (var i = 0; i < edges.length; i++) {
|
|
64
64
|
// eslint-disable-next-line max-len
|
|
65
|
-
var _a = edge_1.
|
|
65
|
+
var _a = edge_1.isNodeInSegment(nodeModel, edges[i]), crossIndex = _a.crossIndex, crossPoints = _a.crossPoints;
|
|
66
66
|
if (crossIndex >= 0) {
|
|
67
67
|
var _b = edges[i], sourceNodeId = _b.sourceNodeId, targetNodeId = _b.targetNodeId, id = _b.id, type = _b.type, pointsList = _b.pointsList;
|
|
68
68
|
this._lf.addEdge({
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.en = void 0;
|
|
4
|
+
var en = {
|
|
5
|
+
文本: 'text',
|
|
6
|
+
开始: 'start',
|
|
7
|
+
缩小流程图: 'zoom in',
|
|
8
|
+
缩小: 'zoom in',
|
|
9
|
+
放大流程图: 'zoom out',
|
|
10
|
+
放大: 'zoom out',
|
|
11
|
+
恢复流程原有尺寸: 'adapt to original size',
|
|
12
|
+
适应: 'adapt',
|
|
13
|
+
回到上一步: 'undo',
|
|
14
|
+
上一步: 'undo',
|
|
15
|
+
移到下一步: 'redo',
|
|
16
|
+
下一步: 'redo',
|
|
17
|
+
删除: 'delete',
|
|
18
|
+
编辑文本: 'edit text',
|
|
19
|
+
复制: 'copy',
|
|
20
|
+
};
|
|
21
|
+
exports.en = en;
|
|
22
|
+
exports.default = en;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.EnLocale = void 0;
|
|
17
|
+
var locale_1 = require("../locale");
|
|
18
|
+
var en_1 = require("./en");
|
|
19
|
+
var EnLocale = /** @class */ (function (_super) {
|
|
20
|
+
__extends(EnLocale, _super);
|
|
21
|
+
function EnLocale(_a) {
|
|
22
|
+
var LogicFlow = _a.LogicFlow;
|
|
23
|
+
return _super.call(this, LogicFlow, en_1.default) || this;
|
|
24
|
+
}
|
|
25
|
+
EnLocale.pluginName = 'enLocale';
|
|
26
|
+
return EnLocale;
|
|
27
|
+
}(locale_1.Locale));
|
|
28
|
+
exports.EnLocale = EnLocale;
|
|
29
|
+
exports.default = EnLocale;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Locale = void 0;
|
|
4
|
+
var Locale = /** @class */ (function () {
|
|
5
|
+
function Locale(LogicFlow, map) {
|
|
6
|
+
if (LogicFlow && map) {
|
|
7
|
+
this.replaceTranslator(LogicFlow, map);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
Locale.prototype.replaceTranslator = function (LogicFlow, map) {
|
|
11
|
+
LogicFlow.t = function (text) { return (map[text] ? map[text] : text); };
|
|
12
|
+
};
|
|
13
|
+
Locale.prototype.setDefault = function (LogicFlow) {
|
|
14
|
+
LogicFlow.t = Locale.defaultTranslator;
|
|
15
|
+
};
|
|
16
|
+
Locale.defaultTranslator = function (text) { return text; };
|
|
17
|
+
return Locale;
|
|
18
|
+
}());
|
|
19
|
+
exports.Locale = Locale;
|
|
@@ -295,7 +295,7 @@ var GroupNode = /** @class */ (function (_super) {
|
|
|
295
295
|
var _a = this.props.model, resizable = _a.resizable, properties = _a.properties;
|
|
296
296
|
return resizable && !properties.isFolded ? _super.prototype.getControlGroup.call(this) : null;
|
|
297
297
|
};
|
|
298
|
-
GroupNode.prototype.
|
|
298
|
+
GroupNode.prototype.getAddAbleShape = function () {
|
|
299
299
|
var _a = this.props.model, width = _a.width, height = _a.height, x = _a.x, y = _a.y, radius = _a.radius, properties = _a.properties;
|
|
300
300
|
if (!properties.groupAddable)
|
|
301
301
|
return null;
|
|
@@ -341,7 +341,7 @@ var GroupNode = /** @class */ (function (_super) {
|
|
|
341
341
|
};
|
|
342
342
|
GroupNode.prototype.getResizeShape = function () {
|
|
343
343
|
return core_1.h('g', {}, [
|
|
344
|
-
this.
|
|
344
|
+
this.getAddAbleShape(),
|
|
345
345
|
_super.prototype.getResizeShape.call(this),
|
|
346
346
|
this.getFoldIcon(),
|
|
347
347
|
]);
|
|
@@ -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
|
* 获取边节点图形的宽高。
|
|
@@ -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;
|