@logicflow/extension 2.3.0-alpha.1 → 2.3.0
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/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/dynamic-group/index.d.ts +1 -1
- package/es/dynamic-group/index.js +36 -100
- package/es/dynamic-group/titleText.js +2 -2
- package/es/pool/index.d.ts +5 -1
- package/es/pool/index.js +59 -18
- package/lib/dynamic-group/index.d.ts +1 -1
- package/lib/dynamic-group/index.js +36 -100
- package/lib/dynamic-group/titleText.js +2 -2
- package/lib/pool/index.d.ts +5 -1
- package/lib/pool/index.js +59 -18
- package/package.json +3 -3
package/lib/pool/index.js
CHANGED
|
@@ -60,6 +60,8 @@ var PoolElements = /** @class */ (function () {
|
|
|
60
60
|
function PoolElements(_a) {
|
|
61
61
|
var lf = _a.lf, options = _a.options;
|
|
62
62
|
var _this = this;
|
|
63
|
+
// 激活态的泳道节点(支持多泳道同时高亮)
|
|
64
|
+
this.activeGroups = new Set();
|
|
63
65
|
// 存储节点与 group 的映射关系
|
|
64
66
|
this.nodeLaneMap = new Map();
|
|
65
67
|
/**
|
|
@@ -150,32 +152,46 @@ var PoolElements = /** @class */ (function () {
|
|
|
150
152
|
};
|
|
151
153
|
this.onSelectionDrag = function () {
|
|
152
154
|
var selectedNodes = _this.lf.graphModel.getSelectElements().nodes;
|
|
155
|
+
var next = new Set();
|
|
153
156
|
selectedNodes.forEach(function (node) {
|
|
154
|
-
_this.
|
|
157
|
+
var targetLane = _this.getTargetLaneForNode(node);
|
|
158
|
+
if (targetLane)
|
|
159
|
+
next.add(targetLane);
|
|
155
160
|
});
|
|
161
|
+
_this.activeGroups.forEach(function (lane) {
|
|
162
|
+
if (!next.has(lane))
|
|
163
|
+
lane.setAllowAppendChild(false);
|
|
164
|
+
});
|
|
165
|
+
next.forEach(function (lane) {
|
|
166
|
+
if (!_this.activeGroups.has(lane))
|
|
167
|
+
lane.setAllowAppendChild(true);
|
|
168
|
+
});
|
|
169
|
+
_this.activeGroups = next;
|
|
156
170
|
};
|
|
157
171
|
this.onNodeDrag = function (_a) {
|
|
158
172
|
var node = _a.data;
|
|
159
173
|
_this.setActiveGroup(node);
|
|
160
174
|
};
|
|
161
175
|
this.setActiveGroup = function (node) {
|
|
162
|
-
var
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
var targetLane = _this.getTargetLaneForNode(node);
|
|
177
|
+
var next = new Set();
|
|
178
|
+
if (targetLane)
|
|
179
|
+
next.add(targetLane);
|
|
180
|
+
_this.activeGroups.forEach(function (lane) {
|
|
181
|
+
if (!next.has(lane))
|
|
182
|
+
lane.setAllowAppendChild(false);
|
|
183
|
+
});
|
|
184
|
+
next.forEach(function (lane) {
|
|
185
|
+
if (!_this.activeGroups.has(lane))
|
|
186
|
+
lane.setAllowAppendChild(true);
|
|
187
|
+
});
|
|
188
|
+
_this.activeGroups = next;
|
|
189
|
+
};
|
|
190
|
+
this.onNodeDrop = function () {
|
|
191
|
+
_this.clearDragTargetHighlight();
|
|
192
|
+
};
|
|
193
|
+
this.onNodeMouseUp = function () {
|
|
194
|
+
_this.clearDragTargetHighlight();
|
|
179
195
|
};
|
|
180
196
|
/**
|
|
181
197
|
* @param node
|
|
@@ -256,6 +272,7 @@ var PoolElements = /** @class */ (function () {
|
|
|
256
272
|
groupModel.width = newGroupWidth;
|
|
257
273
|
groupModel.height = newGroupHeight;
|
|
258
274
|
groupModel.updateExpandedSize(newGroupWidth, newGroupHeight);
|
|
275
|
+
groupModel.setTextPosition();
|
|
259
276
|
};
|
|
260
277
|
this.onGraphRendered = function (_a) {
|
|
261
278
|
var data = _a.data;
|
|
@@ -311,6 +328,26 @@ var PoolElements = /** @class */ (function () {
|
|
|
311
328
|
return topZIndexLane;
|
|
312
329
|
}
|
|
313
330
|
};
|
|
331
|
+
PoolElements.prototype.getTargetLaneForNode = function (node) {
|
|
332
|
+
var nodeModel = this.lf.getNodeModelById(node.id);
|
|
333
|
+
var bounds = nodeModel === null || nodeModel === void 0 ? void 0 : nodeModel.getBounds();
|
|
334
|
+
if (!nodeModel || !bounds)
|
|
335
|
+
return undefined;
|
|
336
|
+
var targetLane = this.getLaneByBounds(bounds, node);
|
|
337
|
+
if (!targetLane)
|
|
338
|
+
return undefined;
|
|
339
|
+
if (nodeModel.isGroup && targetLane.id === node.id)
|
|
340
|
+
return undefined;
|
|
341
|
+
if (!targetLane.isAllowAppendIn(node))
|
|
342
|
+
return undefined;
|
|
343
|
+
return targetLane;
|
|
344
|
+
};
|
|
345
|
+
PoolElements.prototype.clearDragTargetHighlight = function () {
|
|
346
|
+
this.activeGroups.forEach(function (lane) {
|
|
347
|
+
lane.setAllowAppendChild(false);
|
|
348
|
+
});
|
|
349
|
+
this.activeGroups.clear();
|
|
350
|
+
};
|
|
314
351
|
PoolElements.prototype.removeChildrenInGroupNodeData = function (nodeData) {
|
|
315
352
|
var _a;
|
|
316
353
|
var newNodeData = (0, lodash_es_1.cloneDeep)(nodeData);
|
|
@@ -450,6 +487,8 @@ var PoolElements = /** @class */ (function () {
|
|
|
450
487
|
lf.on(core_1.EventType.NODE_DELETE, this.removeNodeFromGroup);
|
|
451
488
|
lf.on(events_1.NODE_DRAG_EVENTS, this.onNodeDrag);
|
|
452
489
|
lf.on(core_1.EventType.SELECTION_DRAG, this.onSelectionDrag);
|
|
490
|
+
lf.on(core_1.EventType.NODE_DROP, this.onNodeDrop);
|
|
491
|
+
lf.on(core_1.EventType.NODE_MOUSEUP, this.onNodeMouseUp);
|
|
453
492
|
lf.on(core_1.EventType.NODE_CLICK, this.onNodeSelect);
|
|
454
493
|
lf.on(core_1.EventType.NODE_MOUSEMOVE, this.onNodeMove);
|
|
455
494
|
lf.on(core_1.EventType.GRAPH_RENDERED, this.onGraphRendered);
|
|
@@ -499,6 +538,8 @@ var PoolElements = /** @class */ (function () {
|
|
|
499
538
|
this.lf.off(core_1.EventType.NODE_DELETE, this.removeNodeFromGroup);
|
|
500
539
|
this.lf.off(events_1.NODE_DRAG_EVENTS, this.onNodeDrag);
|
|
501
540
|
this.lf.off(core_1.EventType.SELECTION_DRAG, this.onSelectionDrag);
|
|
541
|
+
this.lf.off(core_1.EventType.NODE_DROP, this.onNodeDrop);
|
|
542
|
+
this.lf.off(core_1.EventType.NODE_MOUSEUP, this.onNodeMouseUp);
|
|
502
543
|
this.lf.off(core_1.EventType.NODE_CLICK, this.onNodeSelect);
|
|
503
544
|
this.lf.off(core_1.EventType.NODE_MOUSEMOVE, this.onNodeMove);
|
|
504
545
|
this.lf.off(core_1.EventType.GRAPH_RENDERED, this.onGraphRendered);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/extension",
|
|
3
|
-
"version": "2.3.0
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "LogicFlow Extensions",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "Logicflow-Team",
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@logicflow/core": "2.2.
|
|
23
|
+
"@logicflow/core": "2.2.4"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@antv/hierarchy": "^0.6.11",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"postcss-url": "^10.1.3",
|
|
38
38
|
"postcss-import": "^16.1.0",
|
|
39
39
|
"rollup-plugin-postcss": "^4.0.2",
|
|
40
|
-
"@logicflow/core": "2.2.
|
|
40
|
+
"@logicflow/core": "2.2.4"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"dist",
|