@logicflow/extension 2.2.4-alpha.1 → 2.3.0-alpha.1
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 +10 -8
- package/es/dynamic-group/index.js +98 -19
- package/es/dynamic-group/model.d.ts +6 -8
- package/es/dynamic-group/model.js +9 -10
- package/lib/dynamic-group/index.d.ts +10 -8
- package/lib/dynamic-group/index.js +98 -19
- package/lib/dynamic-group/model.d.ts +6 -8
- package/lib/dynamic-group/model.js +10 -11
- package/package.json +3 -3
|
@@ -14,6 +14,12 @@ export declare const dynamicGroup: {
|
|
|
14
14
|
view: typeof DynamicGroupNode;
|
|
15
15
|
model: typeof DynamicGroupNodeModel;
|
|
16
16
|
};
|
|
17
|
+
export type SensorOutlineOptions = {
|
|
18
|
+
/** 拖拽感应外框描边颜色,默认 '#feb663' */
|
|
19
|
+
stroke?: string;
|
|
20
|
+
/** 拖拽感应外框线宽,默认 2 */
|
|
21
|
+
strokeWidth?: number;
|
|
22
|
+
};
|
|
17
23
|
export declare class DynamicGroup {
|
|
18
24
|
static pluginName: string;
|
|
19
25
|
private lf;
|
|
@@ -27,9 +33,10 @@ export declare class DynamicGroup {
|
|
|
27
33
|
* 默认 true,与 v1.1 以来行为一致;为 false 时仅删除分组,成员保留并解除归属。
|
|
28
34
|
*/
|
|
29
35
|
cascadeDeleteChildren: boolean;
|
|
30
|
-
|
|
36
|
+
/** 拖拽节点进入分组时的感应外框样式 */
|
|
37
|
+
sensorOutline?: SensorOutlineOptions;
|
|
31
38
|
topGroupZIndex: number;
|
|
32
|
-
|
|
39
|
+
activeGroups: Set<DynamicGroupNodeModel>;
|
|
33
40
|
nodeGroupMap: Map<string, string>;
|
|
34
41
|
/** 折叠态虚拟边 id → 所属分组与真实边 id */
|
|
35
42
|
collapsedVirtualEdges: Map<string, {
|
|
@@ -91,6 +98,7 @@ export declare class DynamicGroup {
|
|
|
91
98
|
removeNodeFromGroup: ({ data: node, model, }: CallbackArgs<'node:delete'>) => void;
|
|
92
99
|
onSelectionDrag: () => void;
|
|
93
100
|
onNodeDrag: ({ data: node }: CallbackArgs<'node:drag'>) => void;
|
|
101
|
+
private getTargetGroupForNode;
|
|
94
102
|
setActiveGroup: (node: LogicFlow.NodeData) => void;
|
|
95
103
|
/**
|
|
96
104
|
* 1. 分组节点默认在普通节点下面
|
|
@@ -148,12 +156,6 @@ export declare namespace DynamicGroup {
|
|
|
148
156
|
childNodes: BaseNodeModel[];
|
|
149
157
|
edgesData: EdgeData[];
|
|
150
158
|
};
|
|
151
|
-
type SensorOutlineOptions = {
|
|
152
|
-
/** 拖拽感应外框描边颜色,默认 '#feb663' */
|
|
153
|
-
stroke?: string;
|
|
154
|
-
/** 拖拽感应外框线宽,默认 2 */
|
|
155
|
-
strokeWidth?: number;
|
|
156
|
-
};
|
|
157
159
|
type DynamicGroupOptions = Partial<{
|
|
158
160
|
isCollapsed: boolean;
|
|
159
161
|
/** 为 true 时禁止手动将边连到/从分组节点;默认 false */
|
|
@@ -74,8 +74,9 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
74
74
|
* 默认 true,与 v1.1 以来行为一致;为 false 时仅删除分组,成员保留并解除归属。
|
|
75
75
|
*/
|
|
76
76
|
this.cascadeDeleteChildren = true;
|
|
77
|
-
this.sensorOutline = {};
|
|
78
77
|
this.topGroupZIndex = DEFAULT_BOTTOM_Z_INDEX;
|
|
78
|
+
// 激活态的 group 节点(支持多组同时高亮)
|
|
79
|
+
this.activeGroups = new Set();
|
|
79
80
|
// 存储节点与 group 的映射关系
|
|
80
81
|
this.nodeGroupMap = new Map();
|
|
81
82
|
/** 折叠态虚拟边 id → 所属分组与真实边 id */
|
|
@@ -276,32 +277,85 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
276
277
|
}
|
|
277
278
|
};
|
|
278
279
|
this.onSelectionDrag = function () {
|
|
280
|
+
var e_2, _a, e_3, _b;
|
|
279
281
|
var selectedNodes = _this.lf.graphModel.getSelectElements().nodes;
|
|
282
|
+
// 每个节点独立找目标组,合并为 Set,消除迭代顺序的影响
|
|
283
|
+
var next = new Set();
|
|
280
284
|
selectedNodes.forEach(function (node) {
|
|
281
|
-
_this.
|
|
285
|
+
var targetGroup = _this.getTargetGroupForNode(node);
|
|
286
|
+
if (targetGroup)
|
|
287
|
+
next.add(targetGroup);
|
|
282
288
|
});
|
|
289
|
+
try {
|
|
290
|
+
// diff 更新:只操作有变化的组,避免无谓的视觉抖动
|
|
291
|
+
for (var _c = __values(_this.activeGroups), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
292
|
+
var group = _d.value;
|
|
293
|
+
if (!next.has(group))
|
|
294
|
+
group.setAllowAppendChild(false);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
298
|
+
finally {
|
|
299
|
+
try {
|
|
300
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
301
|
+
}
|
|
302
|
+
finally { if (e_2) throw e_2.error; }
|
|
303
|
+
}
|
|
304
|
+
try {
|
|
305
|
+
for (var next_1 = __values(next), next_1_1 = next_1.next(); !next_1_1.done; next_1_1 = next_1.next()) {
|
|
306
|
+
var group = next_1_1.value;
|
|
307
|
+
if (!_this.activeGroups.has(group))
|
|
308
|
+
group.setAllowAppendChild(true);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
312
|
+
finally {
|
|
313
|
+
try {
|
|
314
|
+
if (next_1_1 && !next_1_1.done && (_b = next_1.return)) _b.call(next_1);
|
|
315
|
+
}
|
|
316
|
+
finally { if (e_3) throw e_3.error; }
|
|
317
|
+
}
|
|
318
|
+
_this.activeGroups = next;
|
|
283
319
|
};
|
|
284
320
|
this.onNodeDrag = function (_a) {
|
|
285
321
|
var node = _a.data;
|
|
286
322
|
_this.setActiveGroup(node);
|
|
287
323
|
};
|
|
288
324
|
this.setActiveGroup = function (node) {
|
|
289
|
-
var
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
325
|
+
var e_4, _a, e_5, _b;
|
|
326
|
+
var targetGroup = _this.getTargetGroupForNode(node);
|
|
327
|
+
var next = new Set();
|
|
328
|
+
if (targetGroup)
|
|
329
|
+
next.add(targetGroup);
|
|
330
|
+
try {
|
|
331
|
+
for (var _c = __values(_this.activeGroups), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
332
|
+
var group = _d.value;
|
|
333
|
+
if (!next.has(group))
|
|
334
|
+
group.setAllowAppendChild(false);
|
|
295
335
|
}
|
|
296
|
-
|
|
297
|
-
|
|
336
|
+
}
|
|
337
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
338
|
+
finally {
|
|
339
|
+
try {
|
|
340
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
298
341
|
}
|
|
299
|
-
|
|
300
|
-
if (!isAllowAppendIn)
|
|
301
|
-
return;
|
|
302
|
-
_this.activeGroup = targetGroup;
|
|
303
|
-
_this.activeGroup.setAllowAppendChild(true);
|
|
342
|
+
finally { if (e_4) throw e_4.error; }
|
|
304
343
|
}
|
|
344
|
+
try {
|
|
345
|
+
for (var next_2 = __values(next), next_2_1 = next_2.next(); !next_2_1.done; next_2_1 = next_2.next()) {
|
|
346
|
+
var group = next_2_1.value;
|
|
347
|
+
if (!_this.activeGroups.has(group))
|
|
348
|
+
group.setAllowAppendChild(true);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
352
|
+
finally {
|
|
353
|
+
try {
|
|
354
|
+
if (next_2_1 && !next_2_1.done && (_b = next_2.return)) _b.call(next_2);
|
|
355
|
+
}
|
|
356
|
+
finally { if (e_5) throw e_5.error; }
|
|
357
|
+
}
|
|
358
|
+
_this.activeGroups = next;
|
|
305
359
|
};
|
|
306
360
|
/**
|
|
307
361
|
* 1. 分组节点默认在普通节点下面
|
|
@@ -418,7 +472,7 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
418
472
|
_this.nodeGroupMap.clear();
|
|
419
473
|
_this.collapsedVirtualEdges.clear();
|
|
420
474
|
_this.collapsedRealEdgeToGroup.clear();
|
|
421
|
-
_this.
|
|
475
|
+
_this.activeGroups.clear();
|
|
422
476
|
_this.topGroupZIndex = DEFAULT_BOTTOM_Z_INDEX;
|
|
423
477
|
forEach(data.nodes, function (node) {
|
|
424
478
|
if (node.children) {
|
|
@@ -570,10 +624,35 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
570
624
|
this.topGroupZIndex = max;
|
|
571
625
|
};
|
|
572
626
|
DynamicGroup.prototype.clearDragTargetHighlight = function () {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
this.
|
|
627
|
+
var e_6, _a;
|
|
628
|
+
try {
|
|
629
|
+
for (var _b = __values(this.activeGroups), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
630
|
+
var group = _c.value;
|
|
631
|
+
group.setAllowAppendChild(false);
|
|
632
|
+
}
|
|
576
633
|
}
|
|
634
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
635
|
+
finally {
|
|
636
|
+
try {
|
|
637
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
638
|
+
}
|
|
639
|
+
finally { if (e_6) throw e_6.error; }
|
|
640
|
+
}
|
|
641
|
+
this.activeGroups.clear();
|
|
642
|
+
};
|
|
643
|
+
DynamicGroup.prototype.getTargetGroupForNode = function (node) {
|
|
644
|
+
var nodeModel = this.lf.getNodeModelById(node.id);
|
|
645
|
+
var bounds = nodeModel === null || nodeModel === void 0 ? void 0 : nodeModel.getBounds();
|
|
646
|
+
if (!nodeModel || !bounds)
|
|
647
|
+
return undefined;
|
|
648
|
+
var targetGroup = this.getGroupByBounds(bounds, node);
|
|
649
|
+
if (!targetGroup)
|
|
650
|
+
return undefined;
|
|
651
|
+
if (nodeModel.isGroup && targetGroup.id === node.id)
|
|
652
|
+
return undefined;
|
|
653
|
+
if (!targetGroup.isAllowAppendIn(node))
|
|
654
|
+
return undefined;
|
|
655
|
+
return targetGroup;
|
|
577
656
|
};
|
|
578
657
|
DynamicGroup.prototype.removeChildrenInGroupNodeData = function (nodeData) {
|
|
579
658
|
var _a;
|
|
@@ -2,12 +2,6 @@ import LogicFlow, { BaseEdgeModel, GraphModel, IRectNodeProperties, RectNodeMode
|
|
|
2
2
|
import NodeData = LogicFlow.NodeData;
|
|
3
3
|
import NodeConfig = LogicFlow.NodeConfig;
|
|
4
4
|
import EdgeConfig = LogicFlow.EdgeConfig;
|
|
5
|
-
/** 拖拽感应外框默认样式(可通过 pluginsOptions.dynamicGroup.sensorOutline 覆盖) */
|
|
6
|
-
export declare const DEFAULT_SENSOR_OUTLINE: {
|
|
7
|
-
readonly stroke: "#feb663";
|
|
8
|
-
readonly strokeWidth: 2;
|
|
9
|
-
};
|
|
10
|
-
export type SensorOutlineOptions = Partial<typeof DEFAULT_SENSOR_OUTLINE>;
|
|
11
5
|
export type IGroupNodeProperties = {
|
|
12
6
|
/**
|
|
13
7
|
* 当前分组中的节点 id
|
|
@@ -191,10 +185,14 @@ export declare class DynamicGroupNodeModel extends RectNodeModel<IGroupNodePrope
|
|
|
191
185
|
* 设置分组节点 drop 区域的样式
|
|
192
186
|
*/
|
|
193
187
|
getAddableOutlineStyle(): {
|
|
194
|
-
stroke:
|
|
195
|
-
strokeWidth:
|
|
188
|
+
stroke: string;
|
|
189
|
+
strokeWidth: number;
|
|
196
190
|
strokeDasharray: string;
|
|
197
191
|
fill: string;
|
|
198
192
|
};
|
|
199
193
|
}
|
|
194
|
+
export declare const DEFAULT_SENSOR_OUTLINE: {
|
|
195
|
+
stroke: string;
|
|
196
|
+
strokeWidth: number;
|
|
197
|
+
};
|
|
200
198
|
export default DynamicGroupNodeModel;
|
|
@@ -59,11 +59,6 @@ import { observable, ElementType, RectNodeModel, } from '@logicflow/core';
|
|
|
59
59
|
import { cloneDeep, forEach } from 'lodash-es';
|
|
60
60
|
import { ExtensionEventType } from '../constant/events';
|
|
61
61
|
import { DEFAULT_TITLE_TEXT_ALIGN, DEFAULT_TITLE_WRAP_PADDING, formatWrapPaddingCss, getTitleForeignObjectRect, parseWrapPadding, resolveTitleTextPosition, textAlignToAnchor, } from './utils';
|
|
62
|
-
/** 拖拽感应外框默认样式(可通过 pluginsOptions.dynamicGroup.sensorOutline 覆盖) */
|
|
63
|
-
export var DEFAULT_SENSOR_OUTLINE = {
|
|
64
|
-
stroke: '#feb663',
|
|
65
|
-
strokeWidth: 2,
|
|
66
|
-
};
|
|
67
62
|
// 分组节点默认展开时的大小
|
|
68
63
|
var DEFAULT_GROUP_EXPAND_WIDTH = 400;
|
|
69
64
|
var DEFAULT_GROUP_EXPAND_HEIGHT = 230;
|
|
@@ -567,12 +562,12 @@ var DynamicGroupNodeModel = /** @class */ (function (_super) {
|
|
|
567
562
|
* 设置分组节点 drop 区域的样式
|
|
568
563
|
*/
|
|
569
564
|
DynamicGroupNodeModel.prototype.getAddableOutlineStyle = function () {
|
|
570
|
-
var
|
|
571
|
-
|
|
572
|
-
var
|
|
565
|
+
var _a;
|
|
566
|
+
var plugin = this.graphModel.dynamicGroup;
|
|
567
|
+
var _b = (_a = plugin === null || plugin === void 0 ? void 0 : plugin.sensorOutline) !== null && _a !== void 0 ? _a : {}, stroke = _b.stroke, strokeWidth = _b.strokeWidth;
|
|
573
568
|
return {
|
|
574
|
-
stroke: stroke,
|
|
575
|
-
strokeWidth: strokeWidth,
|
|
569
|
+
stroke: stroke !== null && stroke !== void 0 ? stroke : DEFAULT_SENSOR_OUTLINE.stroke,
|
|
570
|
+
strokeWidth: strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : DEFAULT_SENSOR_OUTLINE.strokeWidth,
|
|
576
571
|
strokeDasharray: '4 4',
|
|
577
572
|
fill: 'transparent',
|
|
578
573
|
};
|
|
@@ -589,4 +584,8 @@ var DynamicGroupNodeModel = /** @class */ (function (_super) {
|
|
|
589
584
|
return DynamicGroupNodeModel;
|
|
590
585
|
}(RectNodeModel));
|
|
591
586
|
export { DynamicGroupNodeModel };
|
|
587
|
+
export var DEFAULT_SENSOR_OUTLINE = {
|
|
588
|
+
stroke: '#feb663',
|
|
589
|
+
strokeWidth: 2,
|
|
590
|
+
};
|
|
592
591
|
export default DynamicGroupNodeModel;
|
|
@@ -14,6 +14,12 @@ export declare const dynamicGroup: {
|
|
|
14
14
|
view: typeof DynamicGroupNode;
|
|
15
15
|
model: typeof DynamicGroupNodeModel;
|
|
16
16
|
};
|
|
17
|
+
export type SensorOutlineOptions = {
|
|
18
|
+
/** 拖拽感应外框描边颜色,默认 '#feb663' */
|
|
19
|
+
stroke?: string;
|
|
20
|
+
/** 拖拽感应外框线宽,默认 2 */
|
|
21
|
+
strokeWidth?: number;
|
|
22
|
+
};
|
|
17
23
|
export declare class DynamicGroup {
|
|
18
24
|
static pluginName: string;
|
|
19
25
|
private lf;
|
|
@@ -27,9 +33,10 @@ export declare class DynamicGroup {
|
|
|
27
33
|
* 默认 true,与 v1.1 以来行为一致;为 false 时仅删除分组,成员保留并解除归属。
|
|
28
34
|
*/
|
|
29
35
|
cascadeDeleteChildren: boolean;
|
|
30
|
-
|
|
36
|
+
/** 拖拽节点进入分组时的感应外框样式 */
|
|
37
|
+
sensorOutline?: SensorOutlineOptions;
|
|
31
38
|
topGroupZIndex: number;
|
|
32
|
-
|
|
39
|
+
activeGroups: Set<DynamicGroupNodeModel>;
|
|
33
40
|
nodeGroupMap: Map<string, string>;
|
|
34
41
|
/** 折叠态虚拟边 id → 所属分组与真实边 id */
|
|
35
42
|
collapsedVirtualEdges: Map<string, {
|
|
@@ -91,6 +98,7 @@ export declare class DynamicGroup {
|
|
|
91
98
|
removeNodeFromGroup: ({ data: node, model, }: CallbackArgs<'node:delete'>) => void;
|
|
92
99
|
onSelectionDrag: () => void;
|
|
93
100
|
onNodeDrag: ({ data: node }: CallbackArgs<'node:drag'>) => void;
|
|
101
|
+
private getTargetGroupForNode;
|
|
94
102
|
setActiveGroup: (node: LogicFlow.NodeData) => void;
|
|
95
103
|
/**
|
|
96
104
|
* 1. 分组节点默认在普通节点下面
|
|
@@ -148,12 +156,6 @@ export declare namespace DynamicGroup {
|
|
|
148
156
|
childNodes: BaseNodeModel[];
|
|
149
157
|
edgesData: EdgeData[];
|
|
150
158
|
};
|
|
151
|
-
type SensorOutlineOptions = {
|
|
152
|
-
/** 拖拽感应外框描边颜色,默认 '#feb663' */
|
|
153
|
-
stroke?: string;
|
|
154
|
-
/** 拖拽感应外框线宽,默认 2 */
|
|
155
|
-
strokeWidth?: number;
|
|
156
|
-
};
|
|
157
159
|
type DynamicGroupOptions = Partial<{
|
|
158
160
|
isCollapsed: boolean;
|
|
159
161
|
/** 为 true 时禁止手动将边连到/从分组节点;默认 false */
|
|
@@ -91,8 +91,9 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
91
91
|
* 默认 true,与 v1.1 以来行为一致;为 false 时仅删除分组,成员保留并解除归属。
|
|
92
92
|
*/
|
|
93
93
|
this.cascadeDeleteChildren = true;
|
|
94
|
-
this.sensorOutline = {};
|
|
95
94
|
this.topGroupZIndex = DEFAULT_BOTTOM_Z_INDEX;
|
|
95
|
+
// 激活态的 group 节点(支持多组同时高亮)
|
|
96
|
+
this.activeGroups = new Set();
|
|
96
97
|
// 存储节点与 group 的映射关系
|
|
97
98
|
this.nodeGroupMap = new Map();
|
|
98
99
|
/** 折叠态虚拟边 id → 所属分组与真实边 id */
|
|
@@ -293,32 +294,85 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
293
294
|
}
|
|
294
295
|
};
|
|
295
296
|
this.onSelectionDrag = function () {
|
|
297
|
+
var e_2, _a, e_3, _b;
|
|
296
298
|
var selectedNodes = _this.lf.graphModel.getSelectElements().nodes;
|
|
299
|
+
// 每个节点独立找目标组,合并为 Set,消除迭代顺序的影响
|
|
300
|
+
var next = new Set();
|
|
297
301
|
selectedNodes.forEach(function (node) {
|
|
298
|
-
_this.
|
|
302
|
+
var targetGroup = _this.getTargetGroupForNode(node);
|
|
303
|
+
if (targetGroup)
|
|
304
|
+
next.add(targetGroup);
|
|
299
305
|
});
|
|
306
|
+
try {
|
|
307
|
+
// diff 更新:只操作有变化的组,避免无谓的视觉抖动
|
|
308
|
+
for (var _c = __values(_this.activeGroups), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
309
|
+
var group = _d.value;
|
|
310
|
+
if (!next.has(group))
|
|
311
|
+
group.setAllowAppendChild(false);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
315
|
+
finally {
|
|
316
|
+
try {
|
|
317
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
318
|
+
}
|
|
319
|
+
finally { if (e_2) throw e_2.error; }
|
|
320
|
+
}
|
|
321
|
+
try {
|
|
322
|
+
for (var next_1 = __values(next), next_1_1 = next_1.next(); !next_1_1.done; next_1_1 = next_1.next()) {
|
|
323
|
+
var group = next_1_1.value;
|
|
324
|
+
if (!_this.activeGroups.has(group))
|
|
325
|
+
group.setAllowAppendChild(true);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
329
|
+
finally {
|
|
330
|
+
try {
|
|
331
|
+
if (next_1_1 && !next_1_1.done && (_b = next_1.return)) _b.call(next_1);
|
|
332
|
+
}
|
|
333
|
+
finally { if (e_3) throw e_3.error; }
|
|
334
|
+
}
|
|
335
|
+
_this.activeGroups = next;
|
|
300
336
|
};
|
|
301
337
|
this.onNodeDrag = function (_a) {
|
|
302
338
|
var node = _a.data;
|
|
303
339
|
_this.setActiveGroup(node);
|
|
304
340
|
};
|
|
305
341
|
this.setActiveGroup = function (node) {
|
|
306
|
-
var
|
|
307
|
-
var
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
342
|
+
var e_4, _a, e_5, _b;
|
|
343
|
+
var targetGroup = _this.getTargetGroupForNode(node);
|
|
344
|
+
var next = new Set();
|
|
345
|
+
if (targetGroup)
|
|
346
|
+
next.add(targetGroup);
|
|
347
|
+
try {
|
|
348
|
+
for (var _c = __values(_this.activeGroups), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
349
|
+
var group = _d.value;
|
|
350
|
+
if (!next.has(group))
|
|
351
|
+
group.setAllowAppendChild(false);
|
|
312
352
|
}
|
|
313
|
-
|
|
314
|
-
|
|
353
|
+
}
|
|
354
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
355
|
+
finally {
|
|
356
|
+
try {
|
|
357
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
315
358
|
}
|
|
316
|
-
|
|
317
|
-
if (!isAllowAppendIn)
|
|
318
|
-
return;
|
|
319
|
-
_this.activeGroup = targetGroup;
|
|
320
|
-
_this.activeGroup.setAllowAppendChild(true);
|
|
359
|
+
finally { if (e_4) throw e_4.error; }
|
|
321
360
|
}
|
|
361
|
+
try {
|
|
362
|
+
for (var next_2 = __values(next), next_2_1 = next_2.next(); !next_2_1.done; next_2_1 = next_2.next()) {
|
|
363
|
+
var group = next_2_1.value;
|
|
364
|
+
if (!_this.activeGroups.has(group))
|
|
365
|
+
group.setAllowAppendChild(true);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
369
|
+
finally {
|
|
370
|
+
try {
|
|
371
|
+
if (next_2_1 && !next_2_1.done && (_b = next_2.return)) _b.call(next_2);
|
|
372
|
+
}
|
|
373
|
+
finally { if (e_5) throw e_5.error; }
|
|
374
|
+
}
|
|
375
|
+
_this.activeGroups = next;
|
|
322
376
|
};
|
|
323
377
|
/**
|
|
324
378
|
* 1. 分组节点默认在普通节点下面
|
|
@@ -435,7 +489,7 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
435
489
|
_this.nodeGroupMap.clear();
|
|
436
490
|
_this.collapsedVirtualEdges.clear();
|
|
437
491
|
_this.collapsedRealEdgeToGroup.clear();
|
|
438
|
-
_this.
|
|
492
|
+
_this.activeGroups.clear();
|
|
439
493
|
_this.topGroupZIndex = DEFAULT_BOTTOM_Z_INDEX;
|
|
440
494
|
(0, lodash_es_1.forEach)(data.nodes, function (node) {
|
|
441
495
|
if (node.children) {
|
|
@@ -587,10 +641,35 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
587
641
|
this.topGroupZIndex = max;
|
|
588
642
|
};
|
|
589
643
|
DynamicGroup.prototype.clearDragTargetHighlight = function () {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
this.
|
|
644
|
+
var e_6, _a;
|
|
645
|
+
try {
|
|
646
|
+
for (var _b = __values(this.activeGroups), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
647
|
+
var group = _c.value;
|
|
648
|
+
group.setAllowAppendChild(false);
|
|
649
|
+
}
|
|
593
650
|
}
|
|
651
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
652
|
+
finally {
|
|
653
|
+
try {
|
|
654
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
655
|
+
}
|
|
656
|
+
finally { if (e_6) throw e_6.error; }
|
|
657
|
+
}
|
|
658
|
+
this.activeGroups.clear();
|
|
659
|
+
};
|
|
660
|
+
DynamicGroup.prototype.getTargetGroupForNode = function (node) {
|
|
661
|
+
var nodeModel = this.lf.getNodeModelById(node.id);
|
|
662
|
+
var bounds = nodeModel === null || nodeModel === void 0 ? void 0 : nodeModel.getBounds();
|
|
663
|
+
if (!nodeModel || !bounds)
|
|
664
|
+
return undefined;
|
|
665
|
+
var targetGroup = this.getGroupByBounds(bounds, node);
|
|
666
|
+
if (!targetGroup)
|
|
667
|
+
return undefined;
|
|
668
|
+
if (nodeModel.isGroup && targetGroup.id === node.id)
|
|
669
|
+
return undefined;
|
|
670
|
+
if (!targetGroup.isAllowAppendIn(node))
|
|
671
|
+
return undefined;
|
|
672
|
+
return targetGroup;
|
|
594
673
|
};
|
|
595
674
|
DynamicGroup.prototype.removeChildrenInGroupNodeData = function (nodeData) {
|
|
596
675
|
var _a;
|
|
@@ -2,12 +2,6 @@ import LogicFlow, { BaseEdgeModel, GraphModel, IRectNodeProperties, RectNodeMode
|
|
|
2
2
|
import NodeData = LogicFlow.NodeData;
|
|
3
3
|
import NodeConfig = LogicFlow.NodeConfig;
|
|
4
4
|
import EdgeConfig = LogicFlow.EdgeConfig;
|
|
5
|
-
/** 拖拽感应外框默认样式(可通过 pluginsOptions.dynamicGroup.sensorOutline 覆盖) */
|
|
6
|
-
export declare const DEFAULT_SENSOR_OUTLINE: {
|
|
7
|
-
readonly stroke: "#feb663";
|
|
8
|
-
readonly strokeWidth: 2;
|
|
9
|
-
};
|
|
10
|
-
export type SensorOutlineOptions = Partial<typeof DEFAULT_SENSOR_OUTLINE>;
|
|
11
5
|
export type IGroupNodeProperties = {
|
|
12
6
|
/**
|
|
13
7
|
* 当前分组中的节点 id
|
|
@@ -191,10 +185,14 @@ export declare class DynamicGroupNodeModel extends RectNodeModel<IGroupNodePrope
|
|
|
191
185
|
* 设置分组节点 drop 区域的样式
|
|
192
186
|
*/
|
|
193
187
|
getAddableOutlineStyle(): {
|
|
194
|
-
stroke:
|
|
195
|
-
strokeWidth:
|
|
188
|
+
stroke: string;
|
|
189
|
+
strokeWidth: number;
|
|
196
190
|
strokeDasharray: string;
|
|
197
191
|
fill: string;
|
|
198
192
|
};
|
|
199
193
|
}
|
|
194
|
+
export declare const DEFAULT_SENSOR_OUTLINE: {
|
|
195
|
+
stroke: string;
|
|
196
|
+
strokeWidth: number;
|
|
197
|
+
};
|
|
200
198
|
export default DynamicGroupNodeModel;
|
|
@@ -57,16 +57,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
57
57
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
58
58
|
};
|
|
59
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
exports.
|
|
60
|
+
exports.DEFAULT_SENSOR_OUTLINE = exports.DynamicGroupNodeModel = void 0;
|
|
61
61
|
var core_1 = require("@logicflow/core");
|
|
62
62
|
var lodash_es_1 = require("lodash-es");
|
|
63
63
|
var events_1 = require("../constant/events");
|
|
64
64
|
var utils_1 = require("./utils");
|
|
65
|
-
/** 拖拽感应外框默认样式(可通过 pluginsOptions.dynamicGroup.sensorOutline 覆盖) */
|
|
66
|
-
exports.DEFAULT_SENSOR_OUTLINE = {
|
|
67
|
-
stroke: '#feb663',
|
|
68
|
-
strokeWidth: 2,
|
|
69
|
-
};
|
|
70
65
|
// 分组节点默认展开时的大小
|
|
71
66
|
var DEFAULT_GROUP_EXPAND_WIDTH = 400;
|
|
72
67
|
var DEFAULT_GROUP_EXPAND_HEIGHT = 230;
|
|
@@ -570,12 +565,12 @@ var DynamicGroupNodeModel = /** @class */ (function (_super) {
|
|
|
570
565
|
* 设置分组节点 drop 区域的样式
|
|
571
566
|
*/
|
|
572
567
|
DynamicGroupNodeModel.prototype.getAddableOutlineStyle = function () {
|
|
573
|
-
var
|
|
574
|
-
|
|
575
|
-
var
|
|
568
|
+
var _a;
|
|
569
|
+
var plugin = this.graphModel.dynamicGroup;
|
|
570
|
+
var _b = (_a = plugin === null || plugin === void 0 ? void 0 : plugin.sensorOutline) !== null && _a !== void 0 ? _a : {}, stroke = _b.stroke, strokeWidth = _b.strokeWidth;
|
|
576
571
|
return {
|
|
577
|
-
stroke: stroke,
|
|
578
|
-
strokeWidth: strokeWidth,
|
|
572
|
+
stroke: stroke !== null && stroke !== void 0 ? stroke : exports.DEFAULT_SENSOR_OUTLINE.stroke,
|
|
573
|
+
strokeWidth: strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : exports.DEFAULT_SENSOR_OUTLINE.strokeWidth,
|
|
579
574
|
strokeDasharray: '4 4',
|
|
580
575
|
fill: 'transparent',
|
|
581
576
|
};
|
|
@@ -592,4 +587,8 @@ var DynamicGroupNodeModel = /** @class */ (function (_super) {
|
|
|
592
587
|
return DynamicGroupNodeModel;
|
|
593
588
|
}(core_1.RectNodeModel));
|
|
594
589
|
exports.DynamicGroupNodeModel = DynamicGroupNodeModel;
|
|
590
|
+
exports.DEFAULT_SENSOR_OUTLINE = {
|
|
591
|
+
stroke: '#feb663',
|
|
592
|
+
strokeWidth: 2,
|
|
593
|
+
};
|
|
595
594
|
exports.default = DynamicGroupNodeModel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/extension",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-alpha.1",
|
|
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.3-alpha.0"
|
|
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.3-alpha.0"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"dist",
|