@logicflow/extension 1.1.7-alpha.0 → 1.1.8-alpha.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/cjs/NodeResize/Control/Control.js +14 -7
- package/cjs/NodeResize/Node/DiamondResize.js +15 -14
- package/cjs/NodeResize/Node/EllipseResize.js +12 -14
- package/cjs/NodeResize/Node/HtmlResize.js +14 -14
- package/cjs/NodeResize/Node/RectResize.js +15 -15
- package/cjs/insert-node-in-polyline/index.js +20 -19
- package/cjs/materials/group/GroupNode.js +119 -53
- package/cjs/materials/group/index.js +20 -8
- package/es/NodeResize/Control/Control.d.ts +2 -2
- package/es/NodeResize/Control/Control.js +14 -7
- package/es/NodeResize/Node/DiamondResize.d.ts +2 -5
- package/es/NodeResize/Node/DiamondResize.js +15 -14
- package/es/NodeResize/Node/EllipseResize.d.ts +1 -5
- package/es/NodeResize/Node/EllipseResize.js +12 -14
- package/es/NodeResize/Node/HtmlResize.d.ts +2 -5
- package/es/NodeResize/Node/HtmlResize.js +14 -14
- package/es/NodeResize/Node/RectResize.d.ts +2 -5
- package/es/NodeResize/Node/RectResize.js +15 -15
- package/es/insert-node-in-polyline/index.d.ts +8 -5
- package/es/insert-node-in-polyline/index.js +20 -19
- package/es/materials/group/GroupNode.d.ts +43 -4
- package/es/materials/group/GroupNode.js +119 -53
- package/es/materials/group/index.d.ts +7 -1
- package/es/materials/group/index.js +20 -8
- 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/package.json +2 -2
- package/types/NodeResize/Control/Control.d.ts +2 -2
- package/types/NodeResize/Node/DiamondResize.d.ts +2 -5
- package/types/NodeResize/Node/EllipseResize.d.ts +1 -5
- package/types/NodeResize/Node/HtmlResize.d.ts +2 -5
- package/types/NodeResize/Node/RectResize.d.ts +2 -5
- package/types/insert-node-in-polyline/index.d.ts +8 -5
- package/types/materials/group/GroupNode.d.ts +43 -4
- package/types/materials/group/index.d.ts +7 -1
|
@@ -26,7 +26,7 @@ import { h, Component } from 'preact';
|
|
|
26
26
|
import { LogicFlowUtil } from '@logicflow/core';
|
|
27
27
|
import Rect from '../BasicShape/Rect';
|
|
28
28
|
import { getDiamondReizeEdgePoint, getEllipseReizeEdgePoint, getRectReizeEdgePoint, ModelType } from './Util';
|
|
29
|
-
var
|
|
29
|
+
var StepDrag = LogicFlowUtil.StepDrag;
|
|
30
30
|
var Control = /** @class */ (function (_super) {
|
|
31
31
|
__extends(Control, _super);
|
|
32
32
|
function Control(props) {
|
|
@@ -85,6 +85,8 @@ var Control = /** @class */ (function (_super) {
|
|
|
85
85
|
|| size.width > maxWidth
|
|
86
86
|
|| size.height < minHeight
|
|
87
87
|
|| size.height > maxHeight) {
|
|
88
|
+
// 为了避免放到和缩小位置和鼠标不一致的问题
|
|
89
|
+
_this.dragHandler.cancelDrag();
|
|
88
90
|
return;
|
|
89
91
|
}
|
|
90
92
|
_this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
|
|
@@ -152,15 +154,16 @@ var Control = /** @class */ (function (_super) {
|
|
|
152
154
|
|| size.width > (maxWidth / 2)
|
|
153
155
|
|| size.height < (minHeight / 2)
|
|
154
156
|
|| size.height > (maxHeight / 2)) {
|
|
157
|
+
_this.dragHandler.cancelDrag();
|
|
155
158
|
return;
|
|
156
159
|
}
|
|
157
160
|
// 更新中心点位置,更新文案位置
|
|
158
161
|
_this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
|
|
159
162
|
// 更新rx ry,宽高为计算属性自动更新
|
|
160
163
|
// @ts-ignore
|
|
161
|
-
_this.nodeModel.rx =
|
|
164
|
+
_this.nodeModel.rx = _this.nodeModel.rx + deltaX / 2;
|
|
162
165
|
// @ts-ignore
|
|
163
|
-
_this.nodeModel.ry =
|
|
166
|
+
_this.nodeModel.ry = _this.nodeModel.ry + deltaY / 2;
|
|
164
167
|
_this.nodeModel.setProperties({
|
|
165
168
|
nodeSize: {
|
|
166
169
|
rx: size.width,
|
|
@@ -215,15 +218,16 @@ var Control = /** @class */ (function (_super) {
|
|
|
215
218
|
|| size.width > (maxWidth / 2)
|
|
216
219
|
|| size.height < (minHeight / 2)
|
|
217
220
|
|| size.height > (maxHeight / 2)) {
|
|
221
|
+
_this.dragHandler.cancelDrag();
|
|
218
222
|
return;
|
|
219
223
|
}
|
|
220
224
|
// 更新中心点位置,更新文案位置
|
|
221
225
|
_this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
|
|
222
226
|
// 更新rx ry,宽高为计算属性自动更新
|
|
223
227
|
// @ts-ignore
|
|
224
|
-
_this.nodeModel.rx =
|
|
228
|
+
_this.nodeModel.rx = _this.nodeModel.rx + deltaX / 2;
|
|
225
229
|
// @ts-ignore
|
|
226
|
-
_this.nodeModel.ry =
|
|
230
|
+
_this.nodeModel.ry = _this.nodeModel.ry + deltaY / 2;
|
|
227
231
|
_this.nodeModel.setProperties({
|
|
228
232
|
nodeSize: {
|
|
229
233
|
rx: size.width,
|
|
@@ -289,8 +293,11 @@ var Control = /** @class */ (function (_super) {
|
|
|
289
293
|
if (gridSize > 1) {
|
|
290
294
|
step = 2 * gridSize;
|
|
291
295
|
}
|
|
296
|
+
if (_this.nodeModel.gridSize) {
|
|
297
|
+
step = 2 * _this.nodeModel.gridSize;
|
|
298
|
+
}
|
|
292
299
|
_this.state = {};
|
|
293
|
-
_this.dragHandler =
|
|
300
|
+
_this.dragHandler = new StepDrag({
|
|
294
301
|
onDraging: _this.onDraging,
|
|
295
302
|
step: step,
|
|
296
303
|
});
|
|
@@ -316,7 +323,7 @@ var Control = /** @class */ (function (_super) {
|
|
|
316
323
|
var _a = this.props, x = _a.x, y = _a.y, index = _a.index, model = _a.model;
|
|
317
324
|
var style = model.getControlPointStyle();
|
|
318
325
|
return (h("g", { className: "lf-resize-control-" + index },
|
|
319
|
-
h(Rect, __assign({ className: "lf-node-control" }, { x: x, y: y }, style, { onMouseDown: this.dragHandler }))));
|
|
326
|
+
h(Rect, __assign({ className: "lf-node-control" }, { x: x, y: y }, style, { onMouseDown: this.dragHandler.handleMouseDown }))));
|
|
320
327
|
};
|
|
321
328
|
return Control;
|
|
322
329
|
}(Component));
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { h, DiamondNode, DiamondNodeModel } from '@logicflow/core';
|
|
2
2
|
declare class DiamondResizeModel extends DiamondNodeModel {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
maxWidth: number;
|
|
6
|
-
maxHeight: number;
|
|
3
|
+
constructor(data: any, graphModel: any);
|
|
4
|
+
initNodeData(data: any): void;
|
|
7
5
|
getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
|
|
8
6
|
getResizeOutlineStyle(): {
|
|
9
7
|
stroke: string;
|
|
@@ -16,7 +14,6 @@ declare class DiamondResizeModel extends DiamondNodeModel {
|
|
|
16
14
|
fill: string;
|
|
17
15
|
stroke: string;
|
|
18
16
|
};
|
|
19
|
-
setAttributes(): void;
|
|
20
17
|
}
|
|
21
18
|
declare class DiamondResizeView extends DiamondNode {
|
|
22
19
|
getControlGroup(): h.JSX.Element;
|
|
@@ -27,14 +27,23 @@ import ControlGroup from '../Control/ControlGroup';
|
|
|
27
27
|
import Polygon from '../BasicShape/Polygon';
|
|
28
28
|
var DiamondResizeModel = /** @class */ (function (_super) {
|
|
29
29
|
__extends(DiamondResizeModel, _super);
|
|
30
|
-
function DiamondResizeModel() {
|
|
31
|
-
var _this = _super
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
function DiamondResizeModel(data, graphModel) {
|
|
31
|
+
var _this = _super.call(this, data, graphModel) || this;
|
|
32
|
+
var nodeSize = _this.properties.nodeSize;
|
|
33
|
+
if (nodeSize) {
|
|
34
|
+
_this.rx = nodeSize.rx;
|
|
35
|
+
_this.ry = nodeSize.ry;
|
|
36
|
+
}
|
|
36
37
|
return _this;
|
|
37
38
|
}
|
|
39
|
+
DiamondResizeModel.prototype.initNodeData = function (data) {
|
|
40
|
+
_super.prototype.initNodeData.call(this, data);
|
|
41
|
+
this.minWidth = 30;
|
|
42
|
+
this.minHeight = 30;
|
|
43
|
+
this.maxWidth = 2000;
|
|
44
|
+
this.maxHeight = 2000;
|
|
45
|
+
this.gridSize = 1;
|
|
46
|
+
};
|
|
38
47
|
DiamondResizeModel.prototype.getOutlineStyle = function () {
|
|
39
48
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
40
49
|
style.stroke = 'none';
|
|
@@ -58,14 +67,6 @@ var DiamondResizeModel = /** @class */ (function (_super) {
|
|
|
58
67
|
stroke: '#000000',
|
|
59
68
|
};
|
|
60
69
|
};
|
|
61
|
-
DiamondResizeModel.prototype.setAttributes = function () {
|
|
62
|
-
// @ts-ignore
|
|
63
|
-
var nodeSize = this.properties.nodeSize;
|
|
64
|
-
if (nodeSize) {
|
|
65
|
-
this.rx = nodeSize.rx;
|
|
66
|
-
this.ry = nodeSize.ry;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
70
|
return DiamondResizeModel;
|
|
70
71
|
}(DiamondNodeModel));
|
|
71
72
|
var DiamondResizeView = /** @class */ (function (_super) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { h, EllipseNode, EllipseNodeModel } from '@logicflow/core';
|
|
2
2
|
declare class EllipseResizeModel extends EllipseNodeModel {
|
|
3
|
-
minWidth: number;
|
|
4
|
-
minHeight: number;
|
|
5
|
-
maxWidth: number;
|
|
6
|
-
maxHeight: number;
|
|
7
3
|
constructor(data: any, graphModel: any);
|
|
4
|
+
initNodeData(data: any): void;
|
|
8
5
|
getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
|
|
9
6
|
getResizeOutlineStyle(): {
|
|
10
7
|
stroke: string;
|
|
@@ -17,7 +14,6 @@ declare class EllipseResizeModel extends EllipseNodeModel {
|
|
|
17
14
|
fill: string;
|
|
18
15
|
stroke: string;
|
|
19
16
|
};
|
|
20
|
-
setAttributes(): void;
|
|
21
17
|
}
|
|
22
18
|
declare class EllipseResizeView extends EllipseNode {
|
|
23
19
|
getControlGroup(): h.JSX.Element;
|
|
@@ -17,14 +17,20 @@ var EllipseResizeModel = /** @class */ (function (_super) {
|
|
|
17
17
|
__extends(EllipseResizeModel, _super);
|
|
18
18
|
function EllipseResizeModel(data, graphModel) {
|
|
19
19
|
var _this = _super.call(this, data, graphModel) || this;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_this.ry = 50;
|
|
20
|
+
var nodeSize = _this.properties.nodeSize;
|
|
21
|
+
if (nodeSize) {
|
|
22
|
+
_this.rx = nodeSize.rx;
|
|
23
|
+
_this.ry = nodeSize.ry;
|
|
24
|
+
}
|
|
26
25
|
return _this;
|
|
27
26
|
}
|
|
27
|
+
EllipseResizeModel.prototype.initNodeData = function (data) {
|
|
28
|
+
_super.prototype.initNodeData.call(this, data);
|
|
29
|
+
this.minWidth = 30;
|
|
30
|
+
this.minHeight = 30;
|
|
31
|
+
this.maxWidth = 2000;
|
|
32
|
+
this.maxHeight = 2000;
|
|
33
|
+
};
|
|
28
34
|
EllipseResizeModel.prototype.getOutlineStyle = function () {
|
|
29
35
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
30
36
|
style.stroke = 'none';
|
|
@@ -48,14 +54,6 @@ var EllipseResizeModel = /** @class */ (function (_super) {
|
|
|
48
54
|
stroke: '#000000',
|
|
49
55
|
};
|
|
50
56
|
};
|
|
51
|
-
EllipseResizeModel.prototype.setAttributes = function () {
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
var nodeSize = this.properties.nodeSize;
|
|
54
|
-
if (nodeSize) {
|
|
55
|
-
this.rx = nodeSize.rx;
|
|
56
|
-
this.ry = nodeSize.ry;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
57
|
return EllipseResizeModel;
|
|
60
58
|
}(EllipseNodeModel));
|
|
61
59
|
var EllipseResizeView = /** @class */ (function (_super) {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { h, HtmlNode, HtmlNodeModel } from '@logicflow/core';
|
|
2
2
|
declare class HtmlResizeModel extends HtmlNodeModel {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
maxWidth: number;
|
|
6
|
-
maxHeight: number;
|
|
3
|
+
constructor(data: any, graphModel: any);
|
|
4
|
+
initNodeData(data: any): void;
|
|
7
5
|
getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
|
|
8
6
|
getResizeOutlineStyle(): {
|
|
9
7
|
stroke: string;
|
|
@@ -16,7 +14,6 @@ declare class HtmlResizeModel extends HtmlNodeModel {
|
|
|
16
14
|
fill: string;
|
|
17
15
|
stroke: string;
|
|
18
16
|
};
|
|
19
|
-
setAttributes(): void;
|
|
20
17
|
}
|
|
21
18
|
declare class HtmlResizeView extends HtmlNode {
|
|
22
19
|
getControlGroup(): h.JSX.Element;
|
|
@@ -15,14 +15,22 @@ import { h, HtmlNode, HtmlNodeModel } from '@logicflow/core';
|
|
|
15
15
|
import ControlGroup from '../Control/ControlGroup';
|
|
16
16
|
var HtmlResizeModel = /** @class */ (function (_super) {
|
|
17
17
|
__extends(HtmlResizeModel, _super);
|
|
18
|
-
function HtmlResizeModel() {
|
|
19
|
-
var _this = _super
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
function HtmlResizeModel(data, graphModel) {
|
|
19
|
+
var _this = _super.call(this, data, graphModel) || this;
|
|
20
|
+
var nodeSize = _this.properties.nodeSize;
|
|
21
|
+
if (nodeSize) {
|
|
22
|
+
_this.width = nodeSize.width;
|
|
23
|
+
_this.height = nodeSize.height;
|
|
24
|
+
}
|
|
24
25
|
return _this;
|
|
25
26
|
}
|
|
27
|
+
HtmlResizeModel.prototype.initNodeData = function (data) {
|
|
28
|
+
_super.prototype.initNodeData.call(this, data);
|
|
29
|
+
this.minWidth = 30;
|
|
30
|
+
this.minHeight = 30;
|
|
31
|
+
this.maxWidth = 2000;
|
|
32
|
+
this.maxHeight = 2000;
|
|
33
|
+
};
|
|
26
34
|
HtmlResizeModel.prototype.getOutlineStyle = function () {
|
|
27
35
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
28
36
|
style.stroke = 'none';
|
|
@@ -46,14 +54,6 @@ var HtmlResizeModel = /** @class */ (function (_super) {
|
|
|
46
54
|
stroke: '#000000',
|
|
47
55
|
};
|
|
48
56
|
};
|
|
49
|
-
HtmlResizeModel.prototype.setAttributes = function () {
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
var nodeSize = this.properties.nodeSize;
|
|
52
|
-
if (nodeSize) {
|
|
53
|
-
this.width = nodeSize.width;
|
|
54
|
-
this.height = nodeSize.height;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
57
|
return HtmlResizeModel;
|
|
58
58
|
}(HtmlNodeModel));
|
|
59
59
|
var HtmlResizeView = /** @class */ (function (_super) {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { h, RectNode, RectNodeModel } from '@logicflow/core';
|
|
2
2
|
declare class RectResizeModel extends RectNodeModel {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
maxWidth: number;
|
|
6
|
-
maxHeight: number;
|
|
3
|
+
constructor(data: any, graphModel: any);
|
|
4
|
+
initNodeData(data: any): void;
|
|
7
5
|
getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
|
|
8
6
|
getResizeOutlineStyle(): {
|
|
9
7
|
fill: string;
|
|
@@ -17,7 +15,6 @@ declare class RectResizeModel extends RectNodeModel {
|
|
|
17
15
|
fill: string;
|
|
18
16
|
stroke: string;
|
|
19
17
|
};
|
|
20
|
-
setAttributes(): void;
|
|
21
18
|
resize(deltaX: any, deltaY: any): void;
|
|
22
19
|
}
|
|
23
20
|
declare class RectResizeView extends RectNode {
|
|
@@ -15,14 +15,22 @@ import { h, RectNode, RectNodeModel } from '@logicflow/core';
|
|
|
15
15
|
import ControlGroup from '../Control/ControlGroup';
|
|
16
16
|
var RectResizeModel = /** @class */ (function (_super) {
|
|
17
17
|
__extends(RectResizeModel, _super);
|
|
18
|
-
function RectResizeModel() {
|
|
19
|
-
var _this = _super
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
function RectResizeModel(data, graphModel) {
|
|
19
|
+
var _this = _super.call(this, data, graphModel) || this;
|
|
20
|
+
var nodeSize = _this.properties.nodeSize;
|
|
21
|
+
if (nodeSize) {
|
|
22
|
+
_this.width = nodeSize.width;
|
|
23
|
+
_this.height = nodeSize.height;
|
|
24
|
+
}
|
|
24
25
|
return _this;
|
|
25
26
|
}
|
|
27
|
+
RectResizeModel.prototype.initNodeData = function (data) {
|
|
28
|
+
_super.prototype.initNodeData.call(this, data);
|
|
29
|
+
this.minWidth = 30;
|
|
30
|
+
this.minHeight = 30;
|
|
31
|
+
this.maxWidth = 2000;
|
|
32
|
+
this.maxHeight = 2000;
|
|
33
|
+
};
|
|
26
34
|
RectResizeModel.prototype.getOutlineStyle = function () {
|
|
27
35
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
28
36
|
style.stroke = 'none';
|
|
@@ -34,7 +42,7 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
34
42
|
RectResizeModel.prototype.getResizeOutlineStyle = function () {
|
|
35
43
|
return {
|
|
36
44
|
fill: 'none',
|
|
37
|
-
stroke: '
|
|
45
|
+
stroke: 'transparent',
|
|
38
46
|
strokeWidth: 1,
|
|
39
47
|
strokeDasharray: '3,3',
|
|
40
48
|
};
|
|
@@ -47,14 +55,6 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
47
55
|
stroke: '#000000',
|
|
48
56
|
};
|
|
49
57
|
};
|
|
50
|
-
RectResizeModel.prototype.setAttributes = function () {
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
var nodeSize = this.properties.nodeSize;
|
|
53
|
-
if (nodeSize) {
|
|
54
|
-
this.width = nodeSize.width;
|
|
55
|
-
this.height = nodeSize.height;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
58
|
RectResizeModel.prototype.resize = function (deltaX, deltaY) {
|
|
59
59
|
console.log(deltaX, deltaY);
|
|
60
60
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import LogicFlow from '@logicflow/core';
|
|
2
|
+
declare class InsertNodeInPolyline {
|
|
3
|
+
static pluginName: string;
|
|
4
|
+
_lf: LogicFlow;
|
|
4
5
|
dndAdd: boolean;
|
|
5
6
|
dropAdd: boolean;
|
|
6
|
-
|
|
7
|
+
constructor({ lf }: {
|
|
8
|
+
lf: any;
|
|
9
|
+
});
|
|
7
10
|
eventHandler(): void;
|
|
8
11
|
insetNode(nodeData: any): void;
|
|
9
|
-
}
|
|
12
|
+
}
|
|
10
13
|
export { InsertNodeInPolyline };
|
|
11
14
|
export default InsertNodeInPolyline;
|
|
@@ -19,26 +19,25 @@ var __spread = (this && this.__spread) || function () {
|
|
|
19
19
|
return ar;
|
|
20
20
|
};
|
|
21
21
|
import { isNodeInSegement } from './edge';
|
|
22
|
-
var InsertNodeInPolyline = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
InsertNodeInPolyline._lf = lf;
|
|
22
|
+
var InsertNodeInPolyline = /** @class */ (function () {
|
|
23
|
+
function InsertNodeInPolyline(_a) {
|
|
24
|
+
var lf = _a.lf;
|
|
25
|
+
this._lf = lf;
|
|
26
|
+
this.dndAdd = true;
|
|
27
|
+
this.dropAdd = true;
|
|
29
28
|
this.eventHandler();
|
|
30
|
-
}
|
|
31
|
-
eventHandler
|
|
29
|
+
}
|
|
30
|
+
InsertNodeInPolyline.prototype.eventHandler = function () {
|
|
32
31
|
var _this = this;
|
|
33
32
|
// 监听事件
|
|
34
|
-
if (
|
|
35
|
-
|
|
33
|
+
if (this.dndAdd) {
|
|
34
|
+
this._lf.on('node:dnd-add', function (_a) {
|
|
36
35
|
var data = _a.data;
|
|
37
|
-
|
|
36
|
+
_this.insetNode(data);
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
|
-
if (
|
|
41
|
-
|
|
39
|
+
if (this.dropAdd) {
|
|
40
|
+
this._lf.on('node:drop', function (_a) {
|
|
42
41
|
var data = _a.data;
|
|
43
42
|
var edges = _this._lf.graphModel.edges;
|
|
44
43
|
var id = data.id;
|
|
@@ -50,12 +49,12 @@ var InsertNodeInPolyline = {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
if (pureNode) {
|
|
53
|
-
|
|
52
|
+
_this.insetNode(data);
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
|
-
}
|
|
58
|
-
insetNode
|
|
56
|
+
};
|
|
57
|
+
InsertNodeInPolyline.prototype.insetNode = function (nodeData) {
|
|
59
58
|
var edges = this._lf.graphModel.edges;
|
|
60
59
|
var nodeModel = this._lf.getNodeModelById(nodeData.id);
|
|
61
60
|
for (var i = 0; i < edges.length; i++) {
|
|
@@ -79,7 +78,9 @@ var InsertNodeInPolyline = {
|
|
|
79
78
|
break;
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
81
|
+
};
|
|
82
|
+
InsertNodeInPolyline.pluginName = 'insertNodeInPolyline';
|
|
83
|
+
return InsertNodeInPolyline;
|
|
84
|
+
}());
|
|
84
85
|
export { InsertNodeInPolyline };
|
|
85
86
|
export default InsertNodeInPolyline;
|
|
@@ -2,12 +2,33 @@ import { h } from '@logicflow/core';
|
|
|
2
2
|
import { RectResize } from '../../NodeResize';
|
|
3
3
|
declare class GroupNodeModel extends RectResize.model {
|
|
4
4
|
readonly isGroup = true;
|
|
5
|
+
/**
|
|
6
|
+
* 此分组的子节点Id
|
|
7
|
+
*/
|
|
5
8
|
children: Set<string>;
|
|
9
|
+
/**
|
|
10
|
+
* 其子节点是否被禁止通过拖拽移出分组。 默认false,允许拖拽移除分组。
|
|
11
|
+
*/
|
|
6
12
|
isRestrict: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 分组节点是否允许调整大小。
|
|
15
|
+
*/
|
|
7
16
|
resizable: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 分组节点是否允许折叠
|
|
19
|
+
*/
|
|
8
20
|
foldable: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 折叠后的宽度
|
|
23
|
+
*/
|
|
9
24
|
foldedWidth: number;
|
|
25
|
+
/**
|
|
26
|
+
* 折叠后的高度
|
|
27
|
+
*/
|
|
10
28
|
foldedHeight: number;
|
|
29
|
+
/**
|
|
30
|
+
* 分组折叠状态
|
|
31
|
+
*/
|
|
11
32
|
isFolded: boolean;
|
|
12
33
|
unfoldedWidth: number;
|
|
13
34
|
unfoldedHight: number;
|
|
@@ -18,14 +39,31 @@ declare class GroupNodeModel extends RectResize.model {
|
|
|
18
39
|
strokeWidth: number;
|
|
19
40
|
strokeDasharray: string;
|
|
20
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* 折叠分组
|
|
44
|
+
* 1. 折叠分组的宽高
|
|
45
|
+
* 2. 处理分组子节点
|
|
46
|
+
* 3. 处理连线
|
|
47
|
+
*/
|
|
21
48
|
foldGroup(isFolded: any): void;
|
|
49
|
+
getAnchorStyle(anchorInfo: any): Record<string, any>;
|
|
22
50
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
51
|
+
* 折叠分组的时候,处理分组自身的连线和分组内部子节点上的连线
|
|
52
|
+
* 边的分类:
|
|
53
|
+
* - 虚拟边:分组被收起时,表示分组本身与外部节点关系的边。
|
|
54
|
+
* - 真实边:分组本身或者分组内部节点与外部节点节点(非收起分组)关系的边。
|
|
55
|
+
* 如果一个分组,本身与外部节点有M条连线,且内部N个子节点与外部节点有连线,那么这个分组收起时会生成M+N条连线。
|
|
56
|
+
* 折叠分组时:
|
|
57
|
+
* - 原有的虚拟边删除;
|
|
58
|
+
* - 创建一个虚拟边;
|
|
59
|
+
* - 真实边则隐藏;
|
|
60
|
+
* 展开分组是:
|
|
61
|
+
* - 原有的虚拟边删除;
|
|
62
|
+
* - 如果目外部点是收起的分组,则创建虚拟边;
|
|
63
|
+
* - 如果外部节点是普通节点,则显示真实边;
|
|
27
64
|
*/
|
|
28
65
|
private foldEdge;
|
|
66
|
+
createVirtualEdge(edgeData: any): void;
|
|
29
67
|
isInRange({ x1, y1, x2, y2 }: {
|
|
30
68
|
x1: any;
|
|
31
69
|
y1: any;
|
|
@@ -50,6 +88,7 @@ declare class GroupNodeModel extends RectResize.model {
|
|
|
50
88
|
fill: string;
|
|
51
89
|
};
|
|
52
90
|
getData(): import("@logicflow/core").NodeData;
|
|
91
|
+
getHistoryData(): import("@logicflow/core").NodeData;
|
|
53
92
|
}
|
|
54
93
|
declare class GroupNode extends RectResize.view {
|
|
55
94
|
getControlGroup(): h.JSX.Element;
|