@logicflow/extension 1.1.0-alpha.1 → 1.1.0-alpha.5
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/components/context-menu/index.js +4 -1
- package/cjs/components/menu/index.js +3 -3
- package/cjs/materials/group/GroupNode.js +191 -23
- package/cjs/materials/group/index.js +28 -9
- package/cjs/style/index.css +3 -2
- package/cjs/tools/snapshot/index.js +7 -2
- package/es/components/context-menu/index.d.ts +1 -0
- package/es/components/context-menu/index.js +4 -1
- package/es/components/menu/index.js +3 -3
- package/es/materials/group/GroupNode.d.ts +36 -11
- package/es/materials/group/GroupNode.js +192 -24
- package/es/materials/group/index.d.ts +3 -1
- package/es/materials/group/index.js +27 -9
- package/es/style/index.css +3 -2
- package/es/tools/snapshot/index.js +7 -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/lib/style/index.css +3 -2
- package/package.json +2 -2
- package/types/components/context-menu/index.d.ts +1 -0
- package/types/group-shrink/index.d.ts +28 -0
- package/types/materials/group/GroupNode.d.ts +36 -11
- package/types/materials/group/index.d.ts +3 -1
|
@@ -33,7 +33,7 @@ var ContextMenu = /** @class */ (function () {
|
|
|
33
33
|
this.__menuDOM.className = 'lf-inner-context';
|
|
34
34
|
this.menuTypeMap.set(COMMON_TYPE_KEY, []);
|
|
35
35
|
this.lf.setContextMenuByType = function (type, menus) {
|
|
36
|
-
_this.
|
|
36
|
+
_this.setContextMenuByType(type, menus);
|
|
37
37
|
};
|
|
38
38
|
this.lf.setContextMenuItems = function (menus) {
|
|
39
39
|
_this.setContextMenuItems(menus);
|
|
@@ -63,6 +63,9 @@ var ContextMenu = /** @class */ (function () {
|
|
|
63
63
|
_this.hideContextMenu();
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
|
+
ContextMenu.prototype.setContextMenuByType = function (type, menus) {
|
|
67
|
+
this.menuTypeMap.set(type, menus);
|
|
68
|
+
};
|
|
66
69
|
/**
|
|
67
70
|
* 隐藏菜单
|
|
68
71
|
*/
|
|
@@ -33,13 +33,13 @@ var Menu = /** @class */ (function () {
|
|
|
33
33
|
this.lf = lf;
|
|
34
34
|
this.menuTypeMap = new Map();
|
|
35
35
|
this.init();
|
|
36
|
-
this.lf.
|
|
36
|
+
this.lf.setMenuConfig = function (config) {
|
|
37
37
|
_this.setMenuConfig(config);
|
|
38
38
|
};
|
|
39
|
-
this.lf.
|
|
39
|
+
this.lf.addMenuConfig = function (config) {
|
|
40
40
|
_this.addMenuConfig(config);
|
|
41
41
|
};
|
|
42
|
-
this.lf.
|
|
42
|
+
this.lf.setMenuByType = function (config) {
|
|
43
43
|
_this.setMenuByType(config);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -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
|
var __read = (this && this.__read) || function (o, n) {
|
|
16
27
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
17
28
|
if (!m) return o;
|
|
@@ -34,27 +45,121 @@ var __spread = (this && this.__spread) || function () {
|
|
|
34
45
|
};
|
|
35
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
47
|
var core_1 = require("@logicflow/core");
|
|
48
|
+
var NodeResize_1 = require("../../NodeResize");
|
|
49
|
+
var defaultWidth = 500;
|
|
50
|
+
var defaultHeight = 300;
|
|
37
51
|
var GroupNodeModel = /** @class */ (function (_super) {
|
|
38
52
|
__extends(GroupNodeModel, _super);
|
|
39
53
|
function GroupNodeModel() {
|
|
40
54
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
41
55
|
_this.isGroup = true;
|
|
42
|
-
_this.
|
|
43
|
-
_this.
|
|
56
|
+
_this.unfoldedWidth = defaultWidth;
|
|
57
|
+
_this.unfoldedHight = defaultHeight;
|
|
44
58
|
return _this;
|
|
45
59
|
}
|
|
46
|
-
GroupNodeModel.prototype.
|
|
47
|
-
this
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
GroupNodeModel.prototype.initNodeData = function (data) {
|
|
61
|
+
_super.prototype.initNodeData.call(this, data);
|
|
62
|
+
var children = [];
|
|
63
|
+
if (Array.isArray(data.children)) {
|
|
64
|
+
children = data.children;
|
|
65
|
+
}
|
|
66
|
+
// 初始化组的子节点
|
|
67
|
+
this.children = new Set(children);
|
|
68
|
+
this.width = defaultWidth;
|
|
69
|
+
this.height = defaultHeight;
|
|
70
|
+
this.foldedWidth = 80;
|
|
71
|
+
this.foldedHeight = 60;
|
|
72
|
+
// todo: 参考bpmn.js, 分组和未加入分组的节点重合时,未加入分组的节点在分组之下。方便标识。
|
|
73
|
+
this.zIndex = -1;
|
|
51
74
|
this.radius = 0;
|
|
75
|
+
this.text.editable = false;
|
|
76
|
+
this.text.draggable = false;
|
|
77
|
+
this.isRestrict = false;
|
|
78
|
+
this.resizable = false;
|
|
79
|
+
this.autoToFront = false;
|
|
80
|
+
this.foldable = false;
|
|
81
|
+
this.properties.isFolded = false;
|
|
82
|
+
};
|
|
83
|
+
GroupNodeModel.prototype.foldGroup = function (isFolded) {
|
|
84
|
+
var _this = this;
|
|
85
|
+
this.setProperty('isFolded', isFolded);
|
|
86
|
+
if (isFolded) {
|
|
87
|
+
this.x = this.x - this.width / 2 + this.foldedWidth / 2;
|
|
88
|
+
this.y = this.y - this.height / 2 + this.foldedHeight / 2;
|
|
89
|
+
this.unfoldedWidth = this.width;
|
|
90
|
+
this.unfoldedHight = this.height;
|
|
91
|
+
this.width = this.foldedWidth;
|
|
92
|
+
this.height = this.foldedHeight;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.width = this.unfoldedWidth;
|
|
96
|
+
this.height = this.unfoldedHight;
|
|
97
|
+
this.x = this.x + this.width / 2 - this.foldedWidth / 2;
|
|
98
|
+
this.y = this.y + this.height / 2 - this.foldedHeight / 2;
|
|
99
|
+
}
|
|
100
|
+
// 移动分组上的连线
|
|
101
|
+
var inCommingEdges = this.graphModel.getNodeIncomingEdge(this.id);
|
|
102
|
+
var outgoingEdges = this.graphModel.getNodeOutgoingEdge(this.id);
|
|
103
|
+
inCommingEdges.concat(outgoingEdges).forEach(function (edgeModel) {
|
|
104
|
+
_this.graphModel.deleteEdgeById(edgeModel.id);
|
|
105
|
+
if (!edgeModel.isFoldedEdge) {
|
|
106
|
+
var isCommingEdge = edgeModel.targetNodeId === _this.id;
|
|
107
|
+
var data = edgeModel.getData();
|
|
108
|
+
if (isCommingEdge) {
|
|
109
|
+
data.endPoint = undefined;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
data.startPoint = undefined;
|
|
113
|
+
}
|
|
114
|
+
data.pointsList = undefined;
|
|
115
|
+
_this.graphModel.addEdge(data);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
this.children.forEach(function (elementId) {
|
|
119
|
+
var nodeModel = _this.graphModel.getElement(elementId);
|
|
120
|
+
nodeModel.visible = !isFolded;
|
|
121
|
+
_this.foldEdge(elementId, isFolded);
|
|
122
|
+
});
|
|
52
123
|
};
|
|
53
124
|
/**
|
|
54
|
-
*
|
|
125
|
+
* 折叠分组的时候,处理分组内部子节点上的连线
|
|
126
|
+
* 1. 为了保证校验规则不被打乱,所以只隐藏子节点上面的连线。
|
|
127
|
+
* 2. 重新创建一个属性一样的边。
|
|
128
|
+
* 3. 这个边拥有virtual=true的属性,表示不支持直接修改此边内容。
|
|
55
129
|
*/
|
|
56
|
-
GroupNodeModel.prototype.
|
|
57
|
-
|
|
130
|
+
GroupNodeModel.prototype.foldEdge = function (nodeId, isFolded) {
|
|
131
|
+
var _this = this;
|
|
132
|
+
var inCommingEdges = this.graphModel.getNodeIncomingEdge(nodeId);
|
|
133
|
+
var outgoingEdges = this.graphModel.getNodeOutgoingEdge(nodeId);
|
|
134
|
+
inCommingEdges.concat(outgoingEdges).forEach(function (edgeModel, index) {
|
|
135
|
+
var _a;
|
|
136
|
+
edgeModel.visible = !isFolded;
|
|
137
|
+
if (isFolded
|
|
138
|
+
&& (!_this.children.has(edgeModel.targetNodeId)
|
|
139
|
+
|| !_this.children.has(edgeModel.sourceNodeId))) {
|
|
140
|
+
var isCommingEdge = edgeModel.targetNodeId === nodeId;
|
|
141
|
+
if (isFolded) {
|
|
142
|
+
var data = edgeModel.getData();
|
|
143
|
+
data.id = data.id + "__" + index;
|
|
144
|
+
if (isCommingEdge) {
|
|
145
|
+
data.endPoint = undefined;
|
|
146
|
+
data.targetNodeId = _this.id;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
data.startPoint = undefined;
|
|
150
|
+
data.sourceNodeId = _this.id;
|
|
151
|
+
}
|
|
152
|
+
data.text = (_a = data.text) === null || _a === void 0 ? void 0 : _a.value;
|
|
153
|
+
data.pointsList = undefined;
|
|
154
|
+
var model = _this.graphModel.addEdge(data);
|
|
155
|
+
model.virtual = true;
|
|
156
|
+
// 强制不保存group连线数据
|
|
157
|
+
model.getData = function () { return null; };
|
|
158
|
+
model.text.editable = false;
|
|
159
|
+
model.isFoldedEdge = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
58
163
|
};
|
|
59
164
|
GroupNodeModel.prototype.isInRange = function (_a) {
|
|
60
165
|
var x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
|
|
@@ -63,39 +168,102 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
63
168
|
&& y1 >= (this.y - this.height / 2)
|
|
64
169
|
&& y2 <= (this.y + this.height / 2);
|
|
65
170
|
};
|
|
66
|
-
// todo: 更好的方式定义分组的样式
|
|
67
171
|
GroupNodeModel.prototype.setAllowAppendChild = function (isAllow) {
|
|
68
|
-
|
|
69
|
-
this.stroke = 'red';
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.stroke = 'rgb(24, 125, 255)';
|
|
73
|
-
}
|
|
172
|
+
this.setProperty('groupAddable', isAllow);
|
|
74
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* 添加分组子节点
|
|
176
|
+
* @param id 节点id
|
|
177
|
+
*/
|
|
75
178
|
GroupNodeModel.prototype.addChild = function (id) {
|
|
76
179
|
this.children.add(id);
|
|
77
180
|
};
|
|
181
|
+
/**
|
|
182
|
+
* 删除分组子节点
|
|
183
|
+
* @param id 节点id
|
|
184
|
+
*/
|
|
78
185
|
GroupNodeModel.prototype.removeChild = function (id) {
|
|
79
186
|
this.children.delete(id);
|
|
80
187
|
};
|
|
188
|
+
GroupNodeModel.prototype.getAddableOutlineStyle = function () {
|
|
189
|
+
return {
|
|
190
|
+
stroke: '#FEB663',
|
|
191
|
+
strokeWidth: 2,
|
|
192
|
+
strokeDasharray: '4 4',
|
|
193
|
+
fill: 'transparent',
|
|
194
|
+
};
|
|
195
|
+
};
|
|
81
196
|
GroupNodeModel.prototype.getData = function () {
|
|
82
197
|
var data = _super.prototype.getData.call(this);
|
|
83
198
|
data.children = __spread(this.children);
|
|
199
|
+
var properties = data.properties;
|
|
200
|
+
delete properties.groupAddable;
|
|
201
|
+
delete properties.isFolded;
|
|
84
202
|
return data;
|
|
85
203
|
};
|
|
86
204
|
return GroupNodeModel;
|
|
87
|
-
}(
|
|
205
|
+
}(NodeResize_1.RectResize.model));
|
|
88
206
|
var GroupNode = /** @class */ (function (_super) {
|
|
89
207
|
__extends(GroupNode, _super);
|
|
90
208
|
function GroupNode() {
|
|
91
209
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
92
210
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
GroupNode.prototype.
|
|
211
|
+
GroupNode.prototype.getControlGroup = function () {
|
|
212
|
+
return this.props.model.resizable ? _super.prototype.getControlGroup.call(this) : null;
|
|
213
|
+
};
|
|
214
|
+
GroupNode.prototype.getAddedableShape = function () {
|
|
215
|
+
var _a = this.props.model, width = _a.width, height = _a.height, x = _a.x, y = _a.y, radius = _a.radius, properties = _a.properties;
|
|
216
|
+
if (!properties.groupAddable)
|
|
217
|
+
return null;
|
|
218
|
+
var strokeWidth = this.props.model.getNodeStyle().strokeWidth;
|
|
219
|
+
var style = this.props.model.getAddableOutlineStyle();
|
|
220
|
+
var newWidth = width + strokeWidth + 8;
|
|
221
|
+
var newHeight = height + strokeWidth + 8;
|
|
222
|
+
return core_1.h('rect', __assign(__assign({}, style), { width: newWidth, height: newHeight, x: x - newWidth / 2, y: y - newHeight / 2, rx: radius, ry: radius }));
|
|
223
|
+
};
|
|
224
|
+
GroupNode.prototype.getFoldIcon = function () {
|
|
225
|
+
var model = this.props.model;
|
|
226
|
+
var foldX = model.x - model.width / 2 + 5;
|
|
227
|
+
var foldY = model.y - model.height / 2 + 5;
|
|
228
|
+
if (!model.foldable)
|
|
229
|
+
return null;
|
|
230
|
+
var iconIcon = core_1.h('path', {
|
|
231
|
+
fill: 'none',
|
|
232
|
+
stroke: '#818281',
|
|
233
|
+
strokeWidth: 2,
|
|
234
|
+
'pointer-events': 'none',
|
|
235
|
+
d: model.properties.isFolded
|
|
236
|
+
? "M " + (foldX + 3) + "," + (foldY + 6) + " " + (foldX + 11) + "," + (foldY + 6) + " M" + (foldX + 7) + "," + (foldY + 2) + " " + (foldX + 7) + "," + (foldY + 10)
|
|
237
|
+
: "M " + (foldX + 3) + "," + (foldY + 6) + " " + (foldX + 11) + "," + (foldY + 6) + " ",
|
|
238
|
+
});
|
|
239
|
+
return core_1.h('g', {}, [
|
|
240
|
+
core_1.h('rect', {
|
|
241
|
+
height: 12,
|
|
242
|
+
width: 14,
|
|
243
|
+
rx: 2,
|
|
244
|
+
ry: 2,
|
|
245
|
+
strokeWidth: 1,
|
|
246
|
+
fill: '#F4F5F6',
|
|
247
|
+
stroke: '#CECECE',
|
|
248
|
+
cursor: 'pointer',
|
|
249
|
+
x: model.x - model.width / 2 + 5,
|
|
250
|
+
y: model.y - model.height / 2 + 5,
|
|
251
|
+
onClick: function () {
|
|
252
|
+
model.foldGroup(!model.properties.isFolded);
|
|
253
|
+
},
|
|
254
|
+
}),
|
|
255
|
+
iconIcon,
|
|
256
|
+
]);
|
|
257
|
+
};
|
|
258
|
+
GroupNode.prototype.getResizeShape = function () {
|
|
259
|
+
return core_1.h('g', {}, [
|
|
260
|
+
this.getAddedableShape(),
|
|
261
|
+
_super.prototype.getResizeShape.call(this),
|
|
262
|
+
this.getFoldIcon(),
|
|
263
|
+
]);
|
|
264
|
+
};
|
|
97
265
|
return GroupNode;
|
|
98
|
-
}(
|
|
266
|
+
}(NodeResize_1.RectResize.view));
|
|
99
267
|
exports.default = {
|
|
100
268
|
type: 'group',
|
|
101
269
|
view: GroupNode,
|
|
@@ -20,13 +20,26 @@ var __spread = (this && this.__spread) || function () {
|
|
|
20
20
|
return ar;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.Group = void 0;
|
|
23
|
+
exports.GroupNode = exports.Group = void 0;
|
|
24
24
|
var GroupNode_1 = require("./GroupNode");
|
|
25
|
+
exports.GroupNode = GroupNode_1.default;
|
|
25
26
|
var Group = /** @class */ (function () {
|
|
26
27
|
function Group(_a) {
|
|
27
28
|
var _this = this;
|
|
28
29
|
var lf = _a.lf;
|
|
29
30
|
this.nodeGroupMap = new Map();
|
|
31
|
+
this.graphRendered = function (data) {
|
|
32
|
+
// 如果节点
|
|
33
|
+
if (data && data.nodes) {
|
|
34
|
+
data.nodes.forEach(function (node) {
|
|
35
|
+
if (node.children) {
|
|
36
|
+
node.children.forEach(function (nodeId) {
|
|
37
|
+
_this.nodeGroupMap.set(nodeId, node.id);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
30
43
|
this.appendNodeToGrop = function (_a) {
|
|
31
44
|
var data = _a.data;
|
|
32
45
|
// 如果这个节点之前已经在group中了,则将其从之前的group中移除
|
|
@@ -48,14 +61,19 @@ var Group = /** @class */ (function () {
|
|
|
48
61
|
};
|
|
49
62
|
this.setActiveGroup = function (_a) {
|
|
50
63
|
var data = _a.data;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
var nodeModel = _this.lf.getNodeModelById(data.id);
|
|
65
|
+
if (nodeModel.isGroup)
|
|
66
|
+
return;
|
|
67
|
+
var bounds = nodeModel.getBounds();
|
|
68
|
+
var newGroup = _this.getGroup(bounds);
|
|
69
|
+
if (newGroup || newGroup !== _this.activeGroup) {
|
|
70
|
+
if (_this.activeGroup) {
|
|
71
|
+
_this.activeGroup.setAllowAppendChild(false);
|
|
72
|
+
}
|
|
73
|
+
if (newGroup) {
|
|
74
|
+
_this.activeGroup = newGroup;
|
|
75
|
+
_this.activeGroup.setAllowAppendChild(true);
|
|
76
|
+
}
|
|
59
77
|
}
|
|
60
78
|
};
|
|
61
79
|
lf.register(GroupNode_1.default);
|
|
@@ -82,6 +100,7 @@ var Group = /** @class */ (function () {
|
|
|
82
100
|
lf.on('node:drop', this.appendNodeToGrop);
|
|
83
101
|
lf.on('node:dnd-move', this.setActiveGroup);
|
|
84
102
|
lf.on('node:drag', this.setActiveGroup);
|
|
103
|
+
lf.on('graph:rendered', this.graphRendered);
|
|
85
104
|
}
|
|
86
105
|
Group.prototype.getGroups = function () {
|
|
87
106
|
var groups = [];
|
package/cjs/style/index.css
CHANGED
|
@@ -9,21 +9,25 @@ var Snapshot = {
|
|
|
9
9
|
install: function (lf) {
|
|
10
10
|
var _this = this;
|
|
11
11
|
this.lf = lf;
|
|
12
|
-
this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
13
|
-
this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
14
12
|
/* 下载快照 */
|
|
15
13
|
lf.getSnapshot = function (fileName, backgroundColor) {
|
|
14
|
+
_this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
15
|
+
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
16
16
|
_this.fileName = fileName || "logic-flow." + Date.now() + ".png";
|
|
17
17
|
var svgRootElement = _this.getSvgRootElement(lf);
|
|
18
18
|
_this.downloadSvg(svgRootElement, _this.fileName, backgroundColor);
|
|
19
19
|
};
|
|
20
20
|
/* 获取Blob对象,用户图片上传 */
|
|
21
21
|
lf.getSnapshotBlob = function (backgroundColor) {
|
|
22
|
+
_this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
23
|
+
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
22
24
|
var svgRootElement = _this.getSvgRootElement(lf);
|
|
23
25
|
return _this.getBlob(svgRootElement, backgroundColor);
|
|
24
26
|
};
|
|
25
27
|
/* 获取Base64对象,用户图片上传 */
|
|
26
28
|
lf.getSnapshotBase64 = function (backgroundColor) {
|
|
29
|
+
_this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
30
|
+
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
27
31
|
var svgRootElement = _this.getSvgRootElement(lf);
|
|
28
32
|
return _this.getBase64(svgRootElement, backgroundColor);
|
|
29
33
|
};
|
|
@@ -175,6 +179,7 @@ var Snapshot = {
|
|
|
175
179
|
canvas.width = bboxWidth * dpr + 80;
|
|
176
180
|
canvas.height = bboxHeight * dpr + 80;
|
|
177
181
|
var ctx = canvas.getContext('2d');
|
|
182
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
178
183
|
ctx.scale(dpr, dpr);
|
|
179
184
|
// 如果有背景色,设置流程图导出的背景色
|
|
180
185
|
if (backgroundColor) {
|
|
@@ -30,7 +30,7 @@ var ContextMenu = /** @class */ (function () {
|
|
|
30
30
|
this.__menuDOM.className = 'lf-inner-context';
|
|
31
31
|
this.menuTypeMap.set(COMMON_TYPE_KEY, []);
|
|
32
32
|
this.lf.setContextMenuByType = function (type, menus) {
|
|
33
|
-
_this.
|
|
33
|
+
_this.setContextMenuByType(type, menus);
|
|
34
34
|
};
|
|
35
35
|
this.lf.setContextMenuItems = function (menus) {
|
|
36
36
|
_this.setContextMenuItems(menus);
|
|
@@ -60,6 +60,9 @@ var ContextMenu = /** @class */ (function () {
|
|
|
60
60
|
_this.hideContextMenu();
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
|
+
ContextMenu.prototype.setContextMenuByType = function (type, menus) {
|
|
64
|
+
this.menuTypeMap.set(type, menus);
|
|
65
|
+
};
|
|
63
66
|
/**
|
|
64
67
|
* 隐藏菜单
|
|
65
68
|
*/
|
|
@@ -30,13 +30,13 @@ var Menu = /** @class */ (function () {
|
|
|
30
30
|
this.lf = lf;
|
|
31
31
|
this.menuTypeMap = new Map();
|
|
32
32
|
this.init();
|
|
33
|
-
this.lf.
|
|
33
|
+
this.lf.setMenuConfig = function (config) {
|
|
34
34
|
_this.setMenuConfig(config);
|
|
35
35
|
};
|
|
36
|
-
this.lf.
|
|
36
|
+
this.lf.addMenuConfig = function (config) {
|
|
37
37
|
_this.addMenuConfig(config);
|
|
38
38
|
};
|
|
39
|
-
this.lf.
|
|
39
|
+
this.lf.setMenuByType = function (config) {
|
|
40
40
|
_this.setMenuByType(config);
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { h } from '@logicflow/core';
|
|
2
|
+
import { RectResize } from '../../NodeResize';
|
|
3
|
+
declare class GroupNodeModel extends RectResize.model {
|
|
3
4
|
readonly isGroup = true;
|
|
4
|
-
children: Set<
|
|
5
|
+
children: Set<string>;
|
|
5
6
|
isRestrict: boolean;
|
|
6
|
-
|
|
7
|
+
resizable: boolean;
|
|
8
|
+
foldable: boolean;
|
|
9
|
+
foldedWidth: number;
|
|
10
|
+
foldedHeight: number;
|
|
11
|
+
unfoldedWidth: number;
|
|
12
|
+
unfoldedHight: number;
|
|
13
|
+
initNodeData(data: any): void;
|
|
14
|
+
foldGroup(isFolded: any): void;
|
|
7
15
|
/**
|
|
8
|
-
*
|
|
16
|
+
* 折叠分组的时候,处理分组内部子节点上的连线
|
|
17
|
+
* 1. 为了保证校验规则不被打乱,所以只隐藏子节点上面的连线。
|
|
18
|
+
* 2. 重新创建一个属性一样的边。
|
|
19
|
+
* 3. 这个边拥有virtual=true的属性,表示不支持直接修改此边内容。
|
|
9
20
|
*/
|
|
10
|
-
|
|
21
|
+
private foldEdge;
|
|
11
22
|
isInRange({ x1, y1, x2, y2 }: {
|
|
12
23
|
x1: any;
|
|
13
24
|
y1: any;
|
|
@@ -15,15 +26,29 @@ declare class GroupNodeModel extends RectNodeModel {
|
|
|
15
26
|
y2: any;
|
|
16
27
|
}): boolean;
|
|
17
28
|
setAllowAppendChild(isAllow: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* 添加分组子节点
|
|
31
|
+
* @param id 节点id
|
|
32
|
+
*/
|
|
18
33
|
addChild(id: any): void;
|
|
34
|
+
/**
|
|
35
|
+
* 删除分组子节点
|
|
36
|
+
* @param id 节点id
|
|
37
|
+
*/
|
|
19
38
|
removeChild(id: any): void;
|
|
39
|
+
getAddableOutlineStyle(): {
|
|
40
|
+
stroke: string;
|
|
41
|
+
strokeWidth: number;
|
|
42
|
+
strokeDasharray: string;
|
|
43
|
+
fill: string;
|
|
44
|
+
};
|
|
20
45
|
getData(): import("@logicflow/core").NodeData;
|
|
21
46
|
}
|
|
22
|
-
declare class GroupNode extends
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
declare class GroupNode extends RectResize.view {
|
|
48
|
+
getControlGroup(): h.JSX.Element;
|
|
49
|
+
getAddedableShape(): import("preact").VNode<any>;
|
|
50
|
+
getFoldIcon(): import("preact").VNode<any>;
|
|
51
|
+
getResizeShape(): import("preact").VNode<any>;
|
|
27
52
|
}
|
|
28
53
|
declare const _default: {
|
|
29
54
|
type: string;
|