@logicflow/extension 1.0.0-alpha.0 → 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 -0
- 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.js +1 -0
- 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/materials/group/GroupNode.d.ts +0 -12
- package/types/tools/auto-layout/index.d.ts +4 -4
|
@@ -120,7 +120,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
120
120
|
beforeNode: beforeNode,
|
|
121
121
|
afterNode: afterNode,
|
|
122
122
|
};
|
|
123
|
-
//
|
|
123
|
+
// 更新边
|
|
124
124
|
var afterPoint;
|
|
125
125
|
edges.sourceEdges.forEach(function (item) {
|
|
126
126
|
params.point = item.startPoint;
|
|
@@ -183,7 +183,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
183
183
|
beforeNode: beforeNode,
|
|
184
184
|
afterNode: afterNode,
|
|
185
185
|
};
|
|
186
|
-
//
|
|
186
|
+
// 更新边
|
|
187
187
|
var afterPoint;
|
|
188
188
|
edges.sourceEdges.forEach(function (item) {
|
|
189
189
|
params.point = item.startPoint;
|
|
@@ -245,7 +245,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
245
245
|
beforeNode: beforeNode,
|
|
246
246
|
afterNode: afterNode,
|
|
247
247
|
};
|
|
248
|
-
//
|
|
248
|
+
// 更新边
|
|
249
249
|
var afterPoint;
|
|
250
250
|
var edges = _this.getNodeEdges(id);
|
|
251
251
|
edges.sourceEdges.forEach(function (item) {
|
|
@@ -281,7 +281,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
283
|
_this.index = props.index;
|
|
284
|
-
_this.nodeModel = props.
|
|
284
|
+
_this.nodeModel = props.model;
|
|
285
285
|
_this.graphModel = props.graphModel;
|
|
286
286
|
var gridSize = _this.graphModel.gridSize;
|
|
287
287
|
// 为保证对齐线功能正常使用,step默认是网格grid的两倍,
|
|
@@ -36,7 +36,8 @@ var ControlGroup = /** @class */ (function (_super) {
|
|
|
36
36
|
return _this;
|
|
37
37
|
}
|
|
38
38
|
ControlGroup.prototype.getResizeControl = function () {
|
|
39
|
-
var _a = this.props,
|
|
39
|
+
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
40
|
+
var x = model.x, y = model.y, width = model.width, height = model.height;
|
|
40
41
|
var box = {
|
|
41
42
|
minX: x - width / 2,
|
|
42
43
|
minY: y - height / 2,
|
|
@@ -62,11 +63,11 @@ var ControlGroup = /** @class */ (function (_super) {
|
|
|
62
63
|
y: maxY,
|
|
63
64
|
},
|
|
64
65
|
];
|
|
65
|
-
return controlList.map(function (control, index) { return (preact_1.h(Control_1.default, __assign({ index: index }, control, {
|
|
66
|
+
return controlList.map(function (control, index) { return (preact_1.h(Control_1.default, __assign({ index: index }, control, { model: model, graphModel: graphModel }))); });
|
|
66
67
|
};
|
|
67
68
|
// 一般节点被选中了会有outline, 先不用这个
|
|
68
69
|
ControlGroup.prototype.getGroupSolid = function () {
|
|
69
|
-
var _a = this.props, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
70
|
+
var _a = this.props.model, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
70
71
|
var _b = index_1.default.style.outline, stroke = _b.stroke, strokeWidth = _b.strokeWidth, strokeDasharray = _b.strokeDasharray;
|
|
71
72
|
return (preact_1.h(Rect_1.default, { fill: "none", x: x, y: y, width: width, height: height, stroke: stroke, strokeWidth: strokeWidth, strokeDasharray: strokeDasharray }));
|
|
72
73
|
};
|
|
@@ -48,21 +48,23 @@ var DiamondResizeView = /** @class */ (function (_super) {
|
|
|
48
48
|
function DiamondResizeView() {
|
|
49
49
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
50
50
|
}
|
|
51
|
-
DiamondResizeView.prototype.getControlGroup = function (
|
|
51
|
+
DiamondResizeView.prototype.getControlGroup = function () {
|
|
52
52
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
53
|
-
return (core_1.h(ControlGroup_1.default,
|
|
53
|
+
return (core_1.h(ControlGroup_1.default, { model: model, graphModel: graphModel }));
|
|
54
54
|
};
|
|
55
55
|
// getResizeShape绘制图形,功能等同于基础菱形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
56
|
-
DiamondResizeView.prototype.getResizeShape = function (
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
DiamondResizeView.prototype.getResizeShape = function () {
|
|
57
|
+
var model = this.props.model;
|
|
58
|
+
var points = model.points;
|
|
59
|
+
var style = model.getNodeStyle();
|
|
60
|
+
return (core_1.h("g", null,
|
|
61
|
+
core_1.h(Polygon_1.default, __assign({}, style, { points: points }))));
|
|
59
62
|
};
|
|
60
63
|
DiamondResizeView.prototype.getShape = function () {
|
|
61
|
-
var attributes = _super.prototype.getAttributes.call(this);
|
|
62
64
|
var isSelected = this.props.model.isSelected;
|
|
63
65
|
return (core_1.h("g", null,
|
|
64
|
-
this.getResizeShape(
|
|
65
|
-
isSelected ? this.getControlGroup(
|
|
66
|
+
this.getResizeShape(),
|
|
67
|
+
isSelected ? this.getControlGroup() : ''));
|
|
66
68
|
};
|
|
67
69
|
return DiamondResizeView;
|
|
68
70
|
}(core_1.DiamondNode));
|
|
@@ -53,21 +53,23 @@ var EllipseResizeView = /** @class */ (function (_super) {
|
|
|
53
53
|
function EllipseResizeView() {
|
|
54
54
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
55
55
|
}
|
|
56
|
-
EllipseResizeView.prototype.getControlGroup = function (
|
|
56
|
+
EllipseResizeView.prototype.getControlGroup = function () {
|
|
57
57
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
58
|
-
return (core_1.h(ControlGroup_1.default,
|
|
58
|
+
return (core_1.h(ControlGroup_1.default, { model: model, graphModel: graphModel }));
|
|
59
59
|
};
|
|
60
60
|
// getResizeShape绘制图形,功能等同于基础椭圆的getShape功能,可以通过复写此方法,进行节点自定义
|
|
61
|
-
EllipseResizeView.prototype.getResizeShape = function (
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
EllipseResizeView.prototype.getResizeShape = function () {
|
|
62
|
+
var model = this.props.model;
|
|
63
|
+
var rx = model.rx, ry = model.ry, x = model.x, y = model.y;
|
|
64
|
+
var style = model.getNodeStyle();
|
|
65
|
+
return (core_1.h("g", null,
|
|
66
|
+
core_1.h(Ellipse_1.default, __assign({}, style, { rx: rx, ry: ry, x: x, y: y }))));
|
|
64
67
|
};
|
|
65
68
|
EllipseResizeView.prototype.getShape = function () {
|
|
66
|
-
var
|
|
67
|
-
var isSelected = this.props.model.isSelected;
|
|
69
|
+
var model = this.props.model;
|
|
68
70
|
return (core_1.h("g", null,
|
|
69
|
-
this.getResizeShape(
|
|
70
|
-
isSelected ? this.getControlGroup(
|
|
71
|
+
this.getResizeShape(),
|
|
72
|
+
model.isSelected ? this.getControlGroup() : ''));
|
|
71
73
|
};
|
|
72
74
|
return EllipseResizeView;
|
|
73
75
|
}(core_1.EllipseNode));
|
|
@@ -12,17 +12,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
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
|
-
};
|
|
26
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
16
|
var core_1 = require("@logicflow/core");
|
|
28
17
|
var ControlGroup_1 = require("../Control/ControlGroup");
|
|
@@ -52,20 +41,19 @@ var RectResizeView = /** @class */ (function (_super) {
|
|
|
52
41
|
function RectResizeView() {
|
|
53
42
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
54
43
|
}
|
|
55
|
-
RectResizeView.prototype.getControlGroup = function (
|
|
44
|
+
RectResizeView.prototype.getControlGroup = function () {
|
|
56
45
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
57
|
-
return (core_1.h(ControlGroup_1.default,
|
|
46
|
+
return (core_1.h(ControlGroup_1.default, { model: model, graphModel: graphModel }));
|
|
58
47
|
};
|
|
59
48
|
// getResizeShape绘制图形,功能等同于基础矩形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
60
49
|
RectResizeView.prototype.getResizeShape = function () {
|
|
61
50
|
return _super.prototype.getShape.call(this);
|
|
62
51
|
};
|
|
63
52
|
RectResizeView.prototype.getShape = function () {
|
|
64
|
-
var attributes = _super.prototype.getAttributes.call(this);
|
|
65
53
|
var isSelected = this.props.model.isSelected;
|
|
66
54
|
return (core_1.h("g", null,
|
|
67
55
|
this.getResizeShape(),
|
|
68
|
-
isSelected ? this.getControlGroup(
|
|
56
|
+
isSelected ? this.getControlGroup() : ''));
|
|
69
57
|
};
|
|
70
58
|
return RectResizeView;
|
|
71
59
|
}(core_1.RectNode));
|
|
@@ -12,6 +12,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
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
|
+
};
|
|
15
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
27
|
exports.EndEventModel = exports.EndEventView = void 0;
|
|
17
28
|
var core_1 = require("@logicflow/core");
|
|
@@ -36,10 +47,13 @@ var EndEventModel = /** @class */ (function (_super) {
|
|
|
36
47
|
_this = _super.call(this, data, graphModel) || this;
|
|
37
48
|
return _this;
|
|
38
49
|
}
|
|
50
|
+
EndEventModel.prototype.setAttributes = function () {
|
|
51
|
+
this.r = 18;
|
|
52
|
+
};
|
|
39
53
|
EndEventModel.prototype.getConnectedSourceRules = function () {
|
|
40
54
|
var rules = _super.prototype.getConnectedSourceRules.call(this);
|
|
41
55
|
var notAsSource = {
|
|
42
|
-
message: '
|
|
56
|
+
message: '结束节点不能作为边的起点',
|
|
43
57
|
validate: function () { return false; },
|
|
44
58
|
};
|
|
45
59
|
rules.push(notAsSource);
|
|
@@ -60,16 +74,11 @@ var EndEventView = /** @class */ (function (_super) {
|
|
|
60
74
|
};
|
|
61
75
|
};
|
|
62
76
|
EndEventView.prototype.getShape = function () {
|
|
63
|
-
var
|
|
77
|
+
var model = this.props.model;
|
|
78
|
+
var style = model.getNodeStyle();
|
|
79
|
+
var x = model.x, y = model.y, r = model.r;
|
|
64
80
|
var outCircle = _super.prototype.getShape.call(this);
|
|
65
|
-
return core_1.h('g', {}, outCircle, core_1.h('circle', {
|
|
66
|
-
cx: x,
|
|
67
|
-
cy: y,
|
|
68
|
-
fill: fill,
|
|
69
|
-
stroke: stroke,
|
|
70
|
-
strokeWidth: strokeWidth,
|
|
71
|
-
r: r - 5,
|
|
72
|
-
}));
|
|
81
|
+
return core_1.h('g', {}, outCircle, core_1.h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 5 })));
|
|
73
82
|
};
|
|
74
83
|
EndEventView.extendKey = 'EndEventView';
|
|
75
84
|
return EndEventView;
|
|
@@ -12,17 +12,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
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
|
-
};
|
|
26
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
16
|
exports.StartEventView = exports.StartEventModel = void 0;
|
|
28
17
|
var core_1 = require("@logicflow/core");
|
|
@@ -49,10 +38,13 @@ var StartEventModel = /** @class */ (function (_super) {
|
|
|
49
38
|
_this = _super.call(this, data, graphModel) || this;
|
|
50
39
|
return _this;
|
|
51
40
|
}
|
|
41
|
+
StartEventModel.prototype.setAttributes = function () {
|
|
42
|
+
this.r = 18;
|
|
43
|
+
};
|
|
52
44
|
StartEventModel.prototype.getConnectedTargetRules = function () {
|
|
53
45
|
var rules = _super.prototype.getConnectedTargetRules.call(this);
|
|
54
46
|
var notAsTarget = {
|
|
55
|
-
message: '
|
|
47
|
+
message: '起始节点不能作为边的终点',
|
|
56
48
|
validate: function () { return false; },
|
|
57
49
|
};
|
|
58
50
|
rules.push(notAsTarget);
|
|
@@ -67,10 +59,6 @@ var StartEventView = /** @class */ (function (_super) {
|
|
|
67
59
|
function StartEventView() {
|
|
68
60
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
69
61
|
}
|
|
70
|
-
StartEventView.prototype.getAttributes = function () {
|
|
71
|
-
var attr = _super.prototype.getAttributes.call(this);
|
|
72
|
-
return __assign({}, attr);
|
|
73
|
-
};
|
|
74
62
|
StartEventView.extendKey = 'StartEventNode';
|
|
75
63
|
return StartEventView;
|
|
76
64
|
}(core_1.CircleNode));
|
|
@@ -12,6 +12,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
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
|
+
};
|
|
15
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
27
|
exports.ExclusiveGatewayModel = exports.ExclusiveGatewayView = void 0;
|
|
17
28
|
var core_1 = require("@logicflow/core");
|
|
@@ -52,23 +63,14 @@ var ExclusiveGatewayView = /** @class */ (function (_super) {
|
|
|
52
63
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
53
64
|
}
|
|
54
65
|
ExclusiveGatewayView.prototype.getShape = function () {
|
|
55
|
-
var
|
|
56
|
-
var x =
|
|
66
|
+
var model = this.props.model;
|
|
67
|
+
var x = model.x, y = model.y, width = model.width, height = model.height, points = model.points;
|
|
68
|
+
var style = model.getNodeStyle();
|
|
57
69
|
return core_1.h('g', {
|
|
58
70
|
transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
|
|
59
|
-
}, core_1.h('polygon', {
|
|
60
|
-
fill: fill,
|
|
61
|
-
x: x,
|
|
71
|
+
}, core_1.h('polygon', __assign(__assign({}, style), { x: x,
|
|
62
72
|
y: y,
|
|
63
|
-
|
|
64
|
-
strokeWidth: strokeWidth,
|
|
65
|
-
points: points,
|
|
66
|
-
}), core_1.h('path', {
|
|
67
|
-
fill: fill,
|
|
68
|
-
stroke: stroke,
|
|
69
|
-
strokeWidth: strokeWidth,
|
|
70
|
-
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',
|
|
71
|
-
}));
|
|
73
|
+
points: points })), core_1.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)));
|
|
72
74
|
};
|
|
73
75
|
ExclusiveGatewayView.extendKey = 'ExclusiveGatewayNode';
|
|
74
76
|
return ExclusiveGatewayView;
|
package/cjs/bpmn/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var BpmnElement = /** @class */ (function () {
|
|
|
31
31
|
lf.register(ExclusiveGateway_1.default);
|
|
32
32
|
lf.register(UserTask_1.default);
|
|
33
33
|
lf.register(ServiceTask_1.default);
|
|
34
|
-
// 支持自定义bpmn
|
|
34
|
+
// 支持自定义bpmn元素的边
|
|
35
35
|
if (!lf.options.customBpmnEdge) {
|
|
36
36
|
lf.register(SequenceFlow_1.default);
|
|
37
37
|
lf.setDefaultEdgeType('bpmn:sequenceFlow');
|
|
@@ -12,6 +12,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
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
|
+
};
|
|
15
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
27
|
exports.ServiceTaskModel = exports.ServiceTaskView = void 0;
|
|
17
28
|
var core_1 = require("@logicflow/core");
|
|
@@ -36,8 +47,9 @@ var ServiceTaskView = /** @class */ (function (_super) {
|
|
|
36
47
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
37
48
|
}
|
|
38
49
|
ServiceTaskView.prototype.getLabelShape = function () {
|
|
39
|
-
var
|
|
40
|
-
var x =
|
|
50
|
+
var model = this.props.model;
|
|
51
|
+
var x = model.x, y = model.y, width = model.width, height = model.height;
|
|
52
|
+
var style = model.getNodeStyle();
|
|
41
53
|
return core_1.h('svg', {
|
|
42
54
|
x: x - width / 2 + 5,
|
|
43
55
|
y: y - height / 2 + 5,
|
|
@@ -45,26 +57,17 @@ var ServiceTaskView = /** @class */ (function (_super) {
|
|
|
45
57
|
height: 30,
|
|
46
58
|
viewBox: '0 0 1274 1024',
|
|
47
59
|
}, core_1.h('path', {
|
|
48
|
-
fill: stroke,
|
|
60
|
+
fill: style.stroke,
|
|
49
61
|
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',
|
|
50
62
|
}));
|
|
51
63
|
};
|
|
52
64
|
ServiceTaskView.prototype.getShape = function () {
|
|
53
|
-
var
|
|
54
|
-
var x =
|
|
55
|
-
|
|
65
|
+
var model = this.props.model;
|
|
66
|
+
var x = model.x, y = model.y, width = model.width, height = model.height, radius = model.radius;
|
|
67
|
+
var style = model.getNodeStyle();
|
|
56
68
|
return core_1.h('g', {}, [
|
|
57
|
-
core_1.h('rect', {
|
|
58
|
-
|
|
59
|
-
y: y - height / 2,
|
|
60
|
-
rx: radius,
|
|
61
|
-
ry: radius,
|
|
62
|
-
fill: fill,
|
|
63
|
-
stroke: stroke,
|
|
64
|
-
strokeWidth: strokeWidth,
|
|
65
|
-
width: width,
|
|
66
|
-
height: height,
|
|
67
|
-
}),
|
|
69
|
+
core_1.h('rect', __assign({ x: x - width / 2, y: y - height / 2, rx: radius, ry: radius, width: width,
|
|
70
|
+
height: height }, style)),
|
|
68
71
|
this.getLabelShape(),
|
|
69
72
|
]);
|
|
70
73
|
};
|
|
@@ -12,6 +12,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
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
|
+
};
|
|
15
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
27
|
exports.UserTaskModel = exports.UserTaskView = void 0;
|
|
17
28
|
var core_1 = require("@logicflow/core");
|
|
@@ -36,8 +47,9 @@ var UserTaskView = /** @class */ (function (_super) {
|
|
|
36
47
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
37
48
|
}
|
|
38
49
|
UserTaskView.prototype.getLabelShape = function () {
|
|
39
|
-
var
|
|
40
|
-
var x =
|
|
50
|
+
var model = this.props.model;
|
|
51
|
+
var x = model.x, y = model.y, width = model.width, height = model.height;
|
|
52
|
+
var style = model.getNodeStyle();
|
|
41
53
|
return core_1.h('svg', {
|
|
42
54
|
x: x - width / 2 + 5,
|
|
43
55
|
y: y - height / 2 + 5,
|
|
@@ -45,26 +57,18 @@ var UserTaskView = /** @class */ (function (_super) {
|
|
|
45
57
|
height: 25,
|
|
46
58
|
viewBox: '0 0 1274 1024',
|
|
47
59
|
}, core_1.h('path', {
|
|
48
|
-
fill: stroke,
|
|
60
|
+
fill: style.stroke,
|
|
49
61
|
d: 'M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z',
|
|
50
62
|
}));
|
|
51
63
|
};
|
|
52
64
|
UserTaskView.prototype.getShape = function () {
|
|
53
|
-
var
|
|
54
|
-
var x =
|
|
65
|
+
var model = this.props.model;
|
|
66
|
+
var x = model.x, y = model.y, width = model.width, height = model.height, radius = model.radius;
|
|
67
|
+
var style = model.getNodeStyle();
|
|
55
68
|
// todo: 将basic-shape对外暴露,在这里可以直接用。现在纯手写有点麻烦。
|
|
56
69
|
return core_1.h('g', {}, [
|
|
57
|
-
core_1.h('rect', {
|
|
58
|
-
|
|
59
|
-
y: y - height / 2,
|
|
60
|
-
rx: radius,
|
|
61
|
-
ry: radius,
|
|
62
|
-
fill: fill,
|
|
63
|
-
stroke: stroke,
|
|
64
|
-
strokeWidth: strokeWidth,
|
|
65
|
-
width: width,
|
|
66
|
-
height: height,
|
|
67
|
-
}),
|
|
70
|
+
core_1.h('rect', __assign(__assign({}, style), { x: x - width / 2, y: y - height / 2, rx: radius, ry: radius, width: width,
|
|
71
|
+
height: height })),
|
|
68
72
|
this.getLabelShape(),
|
|
69
73
|
]);
|
|
70
74
|
};
|
|
@@ -360,7 +360,7 @@ function getEdgeConfig(edgeValue, processValue) {
|
|
|
360
360
|
var textVal = processValue['-name'];
|
|
361
361
|
if (textVal) {
|
|
362
362
|
var textBounds = edgeValue['bpmndi:BPMNLabel']['dc:Bounds'];
|
|
363
|
-
//
|
|
363
|
+
// 如果边文本换行,则其偏移量应该是最长一行的位置
|
|
364
364
|
var textLength_1 = 0;
|
|
365
365
|
textVal.split('\n').forEach(function (textSpan) {
|
|
366
366
|
if (textLength_1 < textSpan.length) {
|
|
@@ -100,7 +100,7 @@ var ContextMenu = /** @class */ (function () {
|
|
|
100
100
|
x = data.x + Model.width / 2;
|
|
101
101
|
y = data.y - Model.height / 2;
|
|
102
102
|
}
|
|
103
|
-
return this.lf.graphModel.
|
|
103
|
+
return this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([x, y]);
|
|
104
104
|
};
|
|
105
105
|
ContextMenu.prototype.createContextMenu = function () {
|
|
106
106
|
var _this = this;
|
|
@@ -148,7 +148,7 @@ var ContextMenu = /** @class */ (function () {
|
|
|
148
148
|
if (y === undefined) {
|
|
149
149
|
y = node.y;
|
|
150
150
|
}
|
|
151
|
-
var nodeModel = this.lf.
|
|
151
|
+
var nodeModel = this.lf.getNodeModelById(node.sourceId);
|
|
152
152
|
var leftTopX = node.x - nodeModel.width + NEXT_X_DISTANCE;
|
|
153
153
|
var leftTopY = y - node.y / 2 - 20;
|
|
154
154
|
var rightBottomX = node.x + nodeModel.width + NEXT_X_DISTANCE;
|
|
@@ -177,7 +177,7 @@ var ContextMenu = /** @class */ (function () {
|
|
|
177
177
|
y: newNode.y,
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
this.lf.
|
|
180
|
+
this.lf.addEdge({
|
|
181
181
|
sourceNodeId: node.sourceId,
|
|
182
182
|
targetNodeId: newNode.id,
|
|
183
183
|
startPoint: startPoint,
|
|
@@ -58,7 +58,7 @@ var Menu = /** @class */ (function () {
|
|
|
58
58
|
{
|
|
59
59
|
text: '编辑文本',
|
|
60
60
|
callback: function (node) {
|
|
61
|
-
_this.lf.graphModel.
|
|
61
|
+
_this.lf.graphModel.editText(node.id);
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
{
|
|
@@ -79,7 +79,7 @@ var Menu = /** @class */ (function () {
|
|
|
79
79
|
{
|
|
80
80
|
text: '编辑文本',
|
|
81
81
|
callback: function (edge) {
|
|
82
|
-
_this.lf.graphModel.
|
|
82
|
+
_this.lf.graphModel.editText(edge.id);
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
];
|
|
@@ -131,7 +131,7 @@ var Menu = /** @class */ (function () {
|
|
|
131
131
|
var data = _a.data, position = _a.position;
|
|
132
132
|
var _b = position.domOverlayPosition, x = _b.x, y = _b.y;
|
|
133
133
|
var id = data.id;
|
|
134
|
-
var model = _this.lf.graphModel.
|
|
134
|
+
var model = _this.lf.graphModel.getNodeModelById(id);
|
|
135
135
|
var menuList = [];
|
|
136
136
|
var typeMenus = _this.menuTypeMap.get(model.type);
|
|
137
137
|
// 如果单个节点自定义了节点,以单个节点自定义为准
|
|
@@ -151,14 +151,14 @@ var Menu = /** @class */ (function () {
|
|
|
151
151
|
var data = _a.data, position = _a.position;
|
|
152
152
|
var _b = position.domOverlayPosition, x = _b.x, y = _b.y;
|
|
153
153
|
var id = data.id;
|
|
154
|
-
var model = _this.lf.graphModel.
|
|
154
|
+
var model = _this.lf.graphModel.getEdgeModelById(id);
|
|
155
155
|
var menuList = [];
|
|
156
156
|
var typeMenus = _this.menuTypeMap.get(model.type);
|
|
157
|
-
//
|
|
157
|
+
// 如果单个节点自定义了边
|
|
158
158
|
if (model && model.menu && Array.isArray(model.menu)) {
|
|
159
159
|
menuList = model.menu;
|
|
160
160
|
}
|
|
161
|
-
else if (typeMenus) { //
|
|
161
|
+
else if (typeMenus) { // 如果定义当前边类型的元素
|
|
162
162
|
menuList = typeMenus;
|
|
163
163
|
}
|
|
164
164
|
else { // 最后取全局默认
|
|
@@ -42,8 +42,8 @@ var MiniMap = {
|
|
|
42
42
|
__disabledPlugins: ['minimap', 'control', 'selection-select'],
|
|
43
43
|
install: function (lf, LogicFlow) {
|
|
44
44
|
MiniMap.__lf = lf;
|
|
45
|
-
MiniMap.__miniMapWidth = lf.width;
|
|
46
|
-
MiniMap.__miniMapHeight = (lf.width * 220) / 150;
|
|
45
|
+
MiniMap.__miniMapWidth = lf.graphModel.width;
|
|
46
|
+
MiniMap.__miniMapHeight = (lf.graphModel.width * 220) / 150;
|
|
47
47
|
MiniMap.__LogicFlow = LogicFlow;
|
|
48
48
|
this.__init();
|
|
49
49
|
// 避免多次install的时候, _isShow状态被修改了
|
|
@@ -39,7 +39,7 @@ var SelectionSelect = /** @class */ (function () {
|
|
|
39
39
|
var rt = [Math.max(x, x1), Math.max(y, y1)];
|
|
40
40
|
var elements = _this.lf.getAreaElement(lt, rt);
|
|
41
41
|
elements.forEach(function (element) {
|
|
42
|
-
_this.lf.
|
|
42
|
+
_this.lf.selectElementById(element.id, true);
|
|
43
43
|
});
|
|
44
44
|
_this.lf.emit('selection:selected', elements);
|
|
45
45
|
};
|
package/cjs/index.js
CHANGED
|
@@ -60,19 +60,19 @@ var InsertNodeInPolyline = {
|
|
|
60
60
|
},
|
|
61
61
|
insetNode: function (nodeData) {
|
|
62
62
|
var edges = this._lf.graphModel.edges;
|
|
63
|
-
var nodeModel = this._lf.
|
|
63
|
+
var nodeModel = this._lf.getNodeModelById(nodeData.id);
|
|
64
64
|
for (var i = 0; i < edges.length; i++) {
|
|
65
65
|
// eslint-disable-next-line max-len
|
|
66
66
|
var _a = edge_1.isNodeInSegement(nodeModel, edges[i]), crossIndex = _a.crossIndex, crossPoints = _a.crossPoints;
|
|
67
67
|
if (crossIndex >= 0) {
|
|
68
68
|
var _b = edges[i], sourceNodeId = _b.sourceNodeId, targetNodeId = _b.targetNodeId, id = _b.id, type = _b.type, pointsList = _b.pointsList;
|
|
69
|
-
this._lf.
|
|
69
|
+
this._lf.addEdge({
|
|
70
70
|
type: type,
|
|
71
71
|
sourceNodeId: sourceNodeId,
|
|
72
72
|
targetNodeId: nodeData.id,
|
|
73
73
|
pointsList: __spread(pointsList.slice(0, crossIndex), [crossPoints.startCrossPoint]),
|
|
74
74
|
});
|
|
75
|
-
this._lf.
|
|
75
|
+
this._lf.addEdge({
|
|
76
76
|
type: type,
|
|
77
77
|
sourceNodeId: nodeData.id,
|
|
78
78
|
targetNodeId: targetNodeId,
|
|
@@ -37,7 +37,8 @@ var CurvedEdgeView = /** @class */ (function (_super) {
|
|
|
37
37
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
38
38
|
}
|
|
39
39
|
CurvedEdgeView.prototype.getEdge = function () {
|
|
40
|
-
var _a = this.
|
|
40
|
+
var _a = this.props.model.getEdgeStyle(), strokeWidth = _a.strokeWidth, stroke = _a.stroke, strokeDashArray = _a.strokeDashArray;
|
|
41
|
+
var points = this.props.model.points;
|
|
41
42
|
var points2 = points.split(' ').map(function (p) { return p.split(',').map(function (a) { return Number(a); }); });
|
|
42
43
|
var _b = __read(points2[0], 2), startX = _b[0], startY = _b[1];
|
|
43
44
|
var d = "M" + startX + " " + startY;
|
|
@@ -48,6 +48,7 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
48
48
|
this.height = 200;
|
|
49
49
|
this.strokeWidth = 1;
|
|
50
50
|
this.zIndex = 0;
|
|
51
|
+
this.radius = 0;
|
|
51
52
|
};
|
|
52
53
|
/**
|
|
53
54
|
* 设置是否允许子节点被拖动移除分组
|
|
@@ -93,11 +94,6 @@ var GroupNode = /** @class */ (function (_super) {
|
|
|
93
94
|
* 重新toFront,阻止其置顶
|
|
94
95
|
*/
|
|
95
96
|
GroupNode.prototype.toFront = function () { };
|
|
96
|
-
GroupNode.prototype.getShapeStyle = function () {
|
|
97
|
-
var shape = _super.prototype.getShapeStyle.call(this);
|
|
98
|
-
shape.radius = 0;
|
|
99
|
-
return shape;
|
|
100
|
-
};
|
|
101
97
|
return GroupNode;
|
|
102
98
|
}(core_1.RectNode));
|
|
103
99
|
exports.default = {
|