@logicflow/extension 1.1.0-alpha.3 → 1.1.0-alpha.7
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 +9 -9
- package/cjs/NodeResize/Control/ControlGroup.js +8 -4
- package/cjs/NodeResize/Node/DiamondResize.js +21 -1
- package/cjs/NodeResize/Node/EllipseResize.js +15 -0
- package/cjs/NodeResize/Node/HtmlResize.js +15 -0
- package/cjs/NodeResize/Node/RectResize.js +19 -0
- package/cjs/NodeResize/index.js +2 -36
- package/cjs/materials/group/GroupNode.js +137 -7
- package/cjs/materials/group/index.js +1 -1
- package/cjs/tools/snapshot/index.js +7 -2
- package/es/NodeResize/Control/Control.js +9 -9
- package/es/NodeResize/Control/ControlGroup.js +8 -4
- package/es/NodeResize/Node/DiamondResize.d.ts +15 -0
- package/es/NodeResize/Node/DiamondResize.js +21 -1
- package/es/NodeResize/Node/EllipseResize.d.ts +11 -0
- package/es/NodeResize/Node/EllipseResize.js +15 -0
- package/es/NodeResize/Node/HtmlResize.d.ts +11 -0
- package/es/NodeResize/Node/HtmlResize.js +15 -0
- package/es/NodeResize/Node/RectResize.d.ts +13 -0
- package/es/NodeResize/Node/RectResize.js +19 -0
- package/es/NodeResize/index.d.ts +2 -28
- package/es/NodeResize/index.js +1 -36
- package/es/materials/group/GroupNode.d.ts +21 -4
- package/es/materials/group/GroupNode.js +137 -7
- package/es/materials/group/index.js +1 -1
- 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/package.json +2 -2
- package/types/NodeResize/Node/DiamondResize.d.ts +15 -0
- package/types/NodeResize/Node/EllipseResize.d.ts +11 -0
- package/types/NodeResize/Node/HtmlResize.d.ts +11 -0
- package/types/NodeResize/Node/RectResize.d.ts +13 -0
- package/types/NodeResize/index.d.ts +2 -28
- package/types/group-shrink/index.d.ts +28 -0
- package/types/materials/group/GroupNode.d.ts +21 -4
|
@@ -6,6 +6,17 @@ declare class EllipseResizeModel extends EllipseNodeModel {
|
|
|
6
6
|
maxHeight: number;
|
|
7
7
|
constructor(data: any, graphModel: any);
|
|
8
8
|
getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
|
|
9
|
+
getResizeOutlineStyle(): {
|
|
10
|
+
stroke: string;
|
|
11
|
+
strokeWidth: number;
|
|
12
|
+
strokeDasharray: string;
|
|
13
|
+
};
|
|
14
|
+
getControlPointStyle(): {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
fill: string;
|
|
18
|
+
stroke: string;
|
|
19
|
+
};
|
|
9
20
|
setAttributes(): void;
|
|
10
21
|
}
|
|
11
22
|
declare class EllipseResizeView extends EllipseNode {
|
|
@@ -33,6 +33,21 @@ var EllipseResizeModel = /** @class */ (function (_super) {
|
|
|
33
33
|
}
|
|
34
34
|
return style;
|
|
35
35
|
};
|
|
36
|
+
EllipseResizeModel.prototype.getResizeOutlineStyle = function () {
|
|
37
|
+
return {
|
|
38
|
+
stroke: '#000000',
|
|
39
|
+
strokeWidth: 1,
|
|
40
|
+
strokeDasharray: '3,3',
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
EllipseResizeModel.prototype.getControlPointStyle = function () {
|
|
44
|
+
return {
|
|
45
|
+
width: 7,
|
|
46
|
+
height: 7,
|
|
47
|
+
fill: '#FFFFFF',
|
|
48
|
+
stroke: '#000000',
|
|
49
|
+
};
|
|
50
|
+
};
|
|
36
51
|
EllipseResizeModel.prototype.setAttributes = function () {
|
|
37
52
|
// @ts-ignore
|
|
38
53
|
var nodeSize = this.properties.nodeSize;
|
|
@@ -5,6 +5,17 @@ declare class HtmlResizeModel extends HtmlNodeModel {
|
|
|
5
5
|
maxWidth: number;
|
|
6
6
|
maxHeight: number;
|
|
7
7
|
getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
|
|
8
|
+
getResizeOutlineStyle(): {
|
|
9
|
+
stroke: string;
|
|
10
|
+
strokeWidth: number;
|
|
11
|
+
strokeDasharray: string;
|
|
12
|
+
};
|
|
13
|
+
getControlPointStyle(): {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
fill: string;
|
|
17
|
+
stroke: string;
|
|
18
|
+
};
|
|
8
19
|
setAttributes(): void;
|
|
9
20
|
}
|
|
10
21
|
declare class HtmlResizeView extends HtmlNode {
|
|
@@ -31,6 +31,21 @@ var HtmlResizeModel = /** @class */ (function (_super) {
|
|
|
31
31
|
}
|
|
32
32
|
return style;
|
|
33
33
|
};
|
|
34
|
+
HtmlResizeModel.prototype.getResizeOutlineStyle = function () {
|
|
35
|
+
return {
|
|
36
|
+
stroke: '#000000',
|
|
37
|
+
strokeWidth: 1,
|
|
38
|
+
strokeDasharray: '3,3',
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
HtmlResizeModel.prototype.getControlPointStyle = function () {
|
|
42
|
+
return {
|
|
43
|
+
width: 7,
|
|
44
|
+
height: 7,
|
|
45
|
+
fill: '#FFFFFF',
|
|
46
|
+
stroke: '#000000',
|
|
47
|
+
};
|
|
48
|
+
};
|
|
34
49
|
HtmlResizeModel.prototype.setAttributes = function () {
|
|
35
50
|
// @ts-ignore
|
|
36
51
|
var nodeSize = this.properties.nodeSize;
|
|
@@ -5,7 +5,20 @@ declare class RectResizeModel extends RectNodeModel {
|
|
|
5
5
|
maxWidth: number;
|
|
6
6
|
maxHeight: number;
|
|
7
7
|
getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
|
|
8
|
+
getResizeOutlineStyle(): {
|
|
9
|
+
fill: string;
|
|
10
|
+
stroke: string;
|
|
11
|
+
strokeWidth: number;
|
|
12
|
+
strokeDasharray: string;
|
|
13
|
+
};
|
|
14
|
+
getControlPointStyle(): {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
fill: string;
|
|
18
|
+
stroke: string;
|
|
19
|
+
};
|
|
8
20
|
setAttributes(): void;
|
|
21
|
+
resize(deltaX: any, deltaY: any): void;
|
|
9
22
|
}
|
|
10
23
|
declare class RectResizeView extends RectNode {
|
|
11
24
|
getControlGroup(): h.JSX.Element;
|
|
@@ -31,6 +31,22 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
31
31
|
}
|
|
32
32
|
return style;
|
|
33
33
|
};
|
|
34
|
+
RectResizeModel.prototype.getResizeOutlineStyle = function () {
|
|
35
|
+
return {
|
|
36
|
+
fill: 'none',
|
|
37
|
+
stroke: '#000000',
|
|
38
|
+
strokeWidth: 1,
|
|
39
|
+
strokeDasharray: '3,3',
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
RectResizeModel.prototype.getControlPointStyle = function () {
|
|
43
|
+
return {
|
|
44
|
+
width: 7,
|
|
45
|
+
height: 7,
|
|
46
|
+
fill: '#FFFFFF',
|
|
47
|
+
stroke: '#000000',
|
|
48
|
+
};
|
|
49
|
+
};
|
|
34
50
|
RectResizeModel.prototype.setAttributes = function () {
|
|
35
51
|
// @ts-ignore
|
|
36
52
|
var nodeSize = this.properties.nodeSize;
|
|
@@ -39,6 +55,9 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
39
55
|
this.height = nodeSize.height;
|
|
40
56
|
}
|
|
41
57
|
};
|
|
58
|
+
RectResizeModel.prototype.resize = function (deltaX, deltaY) {
|
|
59
|
+
console.log(deltaX, deltaY);
|
|
60
|
+
};
|
|
42
61
|
return RectResizeModel;
|
|
43
62
|
}(RectNodeModel));
|
|
44
63
|
var RectResizeView = /** @class */ (function (_super) {
|
package/es/NodeResize/index.d.ts
CHANGED
|
@@ -1,37 +1,11 @@
|
|
|
1
1
|
import RectResize from './Node/RectResize';
|
|
2
2
|
import EllipseResize from './Node/EllipseResize';
|
|
3
3
|
import DiamondResize from './Node/DiamondResize';
|
|
4
|
+
import HtmlResize from './Node/HtmlResize';
|
|
4
5
|
declare const NodeResize: {
|
|
5
6
|
pluginName: string;
|
|
6
7
|
step: number;
|
|
7
|
-
style: {
|
|
8
|
-
outline: {
|
|
9
|
-
stroke: string;
|
|
10
|
-
strokeWidth: number;
|
|
11
|
-
strokeDasharray: string;
|
|
12
|
-
};
|
|
13
|
-
controlPoint: {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
fill: string;
|
|
17
|
-
stroke: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
sizeRange: {
|
|
21
|
-
ellipse: {
|
|
22
|
-
minRx: number;
|
|
23
|
-
minRy: number;
|
|
24
|
-
maxRx: number;
|
|
25
|
-
maxRy: number;
|
|
26
|
-
};
|
|
27
|
-
diamond: {
|
|
28
|
-
minRx: number;
|
|
29
|
-
minRy: number;
|
|
30
|
-
maxRx: number;
|
|
31
|
-
maxRy: number;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
8
|
install(lf: any): void;
|
|
35
9
|
};
|
|
36
10
|
export default NodeResize;
|
|
37
|
-
export { NodeResize, RectResize, EllipseResize, DiamondResize, };
|
|
11
|
+
export { NodeResize, RectResize, EllipseResize, DiamondResize, HtmlResize, };
|
package/es/NodeResize/index.js
CHANGED
|
@@ -6,41 +6,6 @@ var NodeResize = {
|
|
|
6
6
|
pluginName: 'nodeResize',
|
|
7
7
|
// 拖动step
|
|
8
8
|
step: 0,
|
|
9
|
-
// 边框和contol拖动点样式的设置
|
|
10
|
-
style: {
|
|
11
|
-
outline: {
|
|
12
|
-
stroke: '#000000',
|
|
13
|
-
strokeWidth: 1,
|
|
14
|
-
strokeDasharray: '3,3',
|
|
15
|
-
},
|
|
16
|
-
controlPoint: {
|
|
17
|
-
width: 7,
|
|
18
|
-
height: 7,
|
|
19
|
-
fill: '#FFFFFF',
|
|
20
|
-
stroke: '#000000',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
// 缩放范围
|
|
24
|
-
sizeRange: {
|
|
25
|
-
// rect: {
|
|
26
|
-
// minWidth: 30,
|
|
27
|
-
// minHeight: 30,
|
|
28
|
-
// maxWidth: 300,
|
|
29
|
-
// maxHeight: 300,
|
|
30
|
-
// },
|
|
31
|
-
ellipse: {
|
|
32
|
-
minRx: 15,
|
|
33
|
-
minRy: 15,
|
|
34
|
-
maxRx: 150,
|
|
35
|
-
maxRy: 150,
|
|
36
|
-
},
|
|
37
|
-
diamond: {
|
|
38
|
-
minRx: 15,
|
|
39
|
-
minRy: 15,
|
|
40
|
-
maxRx: 150,
|
|
41
|
-
maxRy: 150,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
9
|
install: function (lf) {
|
|
45
10
|
lf.register({
|
|
46
11
|
type: RectResize.type,
|
|
@@ -65,4 +30,4 @@ var NodeResize = {
|
|
|
65
30
|
},
|
|
66
31
|
};
|
|
67
32
|
export default NodeResize;
|
|
68
|
-
export { NodeResize, RectResize, EllipseResize, DiamondResize, };
|
|
33
|
+
export { NodeResize, RectResize, EllipseResize, DiamondResize, HtmlResize, };
|
|
@@ -5,7 +5,27 @@ declare class GroupNodeModel extends RectResize.model {
|
|
|
5
5
|
children: Set<string>;
|
|
6
6
|
isRestrict: boolean;
|
|
7
7
|
resizable: boolean;
|
|
8
|
+
foldable: boolean;
|
|
9
|
+
foldedWidth: number;
|
|
10
|
+
foldedHeight: number;
|
|
11
|
+
isFolded: boolean;
|
|
12
|
+
unfoldedWidth: number;
|
|
13
|
+
unfoldedHight: number;
|
|
8
14
|
initNodeData(data: any): void;
|
|
15
|
+
getResizeOutlineStyle(): {
|
|
16
|
+
fill: string;
|
|
17
|
+
stroke: string;
|
|
18
|
+
strokeWidth: number;
|
|
19
|
+
strokeDasharray: string;
|
|
20
|
+
};
|
|
21
|
+
foldGroup(isFolded: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* 折叠分组的时候,处理分组内部子节点上的连线
|
|
24
|
+
* 1. 为了保证校验规则不被打乱,所以只隐藏子节点上面的连线。
|
|
25
|
+
* 2. 重新创建一个属性一样的边。
|
|
26
|
+
* 3. 这个边拥有virtual=true的属性,表示不支持直接修改此边内容。
|
|
27
|
+
*/
|
|
28
|
+
private foldEdge;
|
|
9
29
|
isInRange({ x1, y1, x2, y2 }: {
|
|
10
30
|
x1: any;
|
|
11
31
|
y1: any;
|
|
@@ -32,12 +52,9 @@ declare class GroupNodeModel extends RectResize.model {
|
|
|
32
52
|
getData(): import("@logicflow/core").NodeData;
|
|
33
53
|
}
|
|
34
54
|
declare class GroupNode extends RectResize.view {
|
|
35
|
-
/**
|
|
36
|
-
* 重新toFront,阻止其置顶
|
|
37
|
-
*/
|
|
38
|
-
toFront(): void;
|
|
39
55
|
getControlGroup(): h.JSX.Element;
|
|
40
56
|
getAddedableShape(): import("preact").VNode<any>;
|
|
57
|
+
getFoldIcon(): import("preact").VNode<any>;
|
|
41
58
|
getResizeShape(): import("preact").VNode<any>;
|
|
42
59
|
}
|
|
43
60
|
declare const _default: {
|
|
@@ -44,11 +44,15 @@ var __spread = (this && this.__spread) || function () {
|
|
|
44
44
|
};
|
|
45
45
|
import { h } from '@logicflow/core';
|
|
46
46
|
import { RectResize } from '../../NodeResize';
|
|
47
|
+
var defaultWidth = 500;
|
|
48
|
+
var defaultHeight = 300;
|
|
47
49
|
var GroupNodeModel = /** @class */ (function (_super) {
|
|
48
50
|
__extends(GroupNodeModel, _super);
|
|
49
51
|
function GroupNodeModel() {
|
|
50
52
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
51
53
|
_this.isGroup = true;
|
|
54
|
+
_this.unfoldedWidth = defaultWidth;
|
|
55
|
+
_this.unfoldedHight = defaultHeight;
|
|
52
56
|
return _this;
|
|
53
57
|
}
|
|
54
58
|
GroupNodeModel.prototype.initNodeData = function (data) {
|
|
@@ -59,8 +63,10 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
59
63
|
}
|
|
60
64
|
// 初始化组的子节点
|
|
61
65
|
this.children = new Set(children);
|
|
62
|
-
this.width =
|
|
63
|
-
this.height =
|
|
66
|
+
this.width = defaultWidth;
|
|
67
|
+
this.height = defaultHeight;
|
|
68
|
+
this.foldedWidth = 80;
|
|
69
|
+
this.foldedHeight = 60;
|
|
64
70
|
// todo: 参考bpmn.js, 分组和未加入分组的节点重合时,未加入分组的节点在分组之下。方便标识。
|
|
65
71
|
this.zIndex = -1;
|
|
66
72
|
this.radius = 0;
|
|
@@ -68,6 +74,97 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
68
74
|
this.text.draggable = false;
|
|
69
75
|
this.isRestrict = false;
|
|
70
76
|
this.resizable = false;
|
|
77
|
+
this.autoToFront = false;
|
|
78
|
+
this.foldable = false;
|
|
79
|
+
this.properties.isFolded = false;
|
|
80
|
+
this.isFolded = this.properties.isFolded;
|
|
81
|
+
};
|
|
82
|
+
GroupNodeModel.prototype.getResizeOutlineStyle = function () {
|
|
83
|
+
var style = _super.prototype.getResizeOutlineStyle.call(this);
|
|
84
|
+
style.stroke = 'none';
|
|
85
|
+
return style;
|
|
86
|
+
};
|
|
87
|
+
GroupNodeModel.prototype.foldGroup = function (isFolded) {
|
|
88
|
+
var _this = this;
|
|
89
|
+
this.setProperty('isFolded', isFolded);
|
|
90
|
+
this.isFolded = isFolded;
|
|
91
|
+
if (isFolded) {
|
|
92
|
+
this.x = this.x - this.width / 2 + this.foldedWidth / 2;
|
|
93
|
+
this.y = this.y - this.height / 2 + this.foldedHeight / 2;
|
|
94
|
+
this.unfoldedWidth = this.width;
|
|
95
|
+
this.unfoldedHight = this.height;
|
|
96
|
+
this.width = this.foldedWidth;
|
|
97
|
+
this.height = this.foldedHeight;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.width = this.unfoldedWidth;
|
|
101
|
+
this.height = this.unfoldedHight;
|
|
102
|
+
this.x = this.x + this.width / 2 - this.foldedWidth / 2;
|
|
103
|
+
this.y = this.y + this.height / 2 - this.foldedHeight / 2;
|
|
104
|
+
}
|
|
105
|
+
// 移动分组上的连线
|
|
106
|
+
var inCommingEdges = this.graphModel.getNodeIncomingEdge(this.id);
|
|
107
|
+
var outgoingEdges = this.graphModel.getNodeOutgoingEdge(this.id);
|
|
108
|
+
inCommingEdges.concat(outgoingEdges).forEach(function (edgeModel) {
|
|
109
|
+
_this.graphModel.deleteEdgeById(edgeModel.id);
|
|
110
|
+
if (!edgeModel.isFoldedEdge) {
|
|
111
|
+
var isCommingEdge = edgeModel.targetNodeId === _this.id;
|
|
112
|
+
var data = edgeModel.getData();
|
|
113
|
+
if (isCommingEdge) {
|
|
114
|
+
data.endPoint = undefined;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
data.startPoint = undefined;
|
|
118
|
+
}
|
|
119
|
+
data.pointsList = undefined;
|
|
120
|
+
_this.graphModel.addEdge(data);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
this.children.forEach(function (elementId) {
|
|
124
|
+
var nodeModel = _this.graphModel.getElement(elementId);
|
|
125
|
+
nodeModel.visible = !isFolded;
|
|
126
|
+
_this.foldEdge(elementId, isFolded);
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* 折叠分组的时候,处理分组内部子节点上的连线
|
|
131
|
+
* 1. 为了保证校验规则不被打乱,所以只隐藏子节点上面的连线。
|
|
132
|
+
* 2. 重新创建一个属性一样的边。
|
|
133
|
+
* 3. 这个边拥有virtual=true的属性,表示不支持直接修改此边内容。
|
|
134
|
+
*/
|
|
135
|
+
GroupNodeModel.prototype.foldEdge = function (nodeId, isFolded) {
|
|
136
|
+
var _this = this;
|
|
137
|
+
var inCommingEdges = this.graphModel.getNodeIncomingEdge(nodeId);
|
|
138
|
+
var outgoingEdges = this.graphModel.getNodeOutgoingEdge(nodeId);
|
|
139
|
+
inCommingEdges.concat(outgoingEdges).forEach(function (edgeModel, index) {
|
|
140
|
+
var _a;
|
|
141
|
+
edgeModel.visible = !isFolded;
|
|
142
|
+
if (isFolded
|
|
143
|
+
&& (!_this.children.has(edgeModel.targetNodeId)
|
|
144
|
+
|| !_this.children.has(edgeModel.sourceNodeId))) {
|
|
145
|
+
var isCommingEdge = edgeModel.targetNodeId === nodeId;
|
|
146
|
+
if (isFolded) {
|
|
147
|
+
var data = edgeModel.getData();
|
|
148
|
+
data.id = data.id + "__" + index;
|
|
149
|
+
if (isCommingEdge) {
|
|
150
|
+
data.endPoint = undefined;
|
|
151
|
+
data.targetNodeId = _this.id;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
data.startPoint = undefined;
|
|
155
|
+
data.sourceNodeId = _this.id;
|
|
156
|
+
}
|
|
157
|
+
data.text = (_a = data.text) === null || _a === void 0 ? void 0 : _a.value;
|
|
158
|
+
data.pointsList = undefined;
|
|
159
|
+
var model = _this.graphModel.addEdge(data);
|
|
160
|
+
model.virtual = true;
|
|
161
|
+
// 强制不保存group连线数据
|
|
162
|
+
model.getData = function () { return null; };
|
|
163
|
+
model.text.editable = false;
|
|
164
|
+
model.isFoldedEdge = true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
71
168
|
};
|
|
72
169
|
GroupNodeModel.prototype.isInRange = function (_a) {
|
|
73
170
|
var x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
|
|
@@ -106,6 +203,7 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
106
203
|
data.children = __spread(this.children);
|
|
107
204
|
var properties = data.properties;
|
|
108
205
|
delete properties.groupAddable;
|
|
206
|
+
delete properties.isFolded;
|
|
109
207
|
return data;
|
|
110
208
|
};
|
|
111
209
|
return GroupNodeModel;
|
|
@@ -115,12 +213,9 @@ var GroupNode = /** @class */ (function (_super) {
|
|
|
115
213
|
function GroupNode() {
|
|
116
214
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
117
215
|
}
|
|
118
|
-
/**
|
|
119
|
-
* 重新toFront,阻止其置顶
|
|
120
|
-
*/
|
|
121
|
-
GroupNode.prototype.toFront = function () { };
|
|
122
216
|
GroupNode.prototype.getControlGroup = function () {
|
|
123
|
-
|
|
217
|
+
var _a = this.props.model, resizable = _a.resizable, properties = _a.properties;
|
|
218
|
+
return resizable && !properties.isFolded ? _super.prototype.getControlGroup.call(this) : null;
|
|
124
219
|
};
|
|
125
220
|
GroupNode.prototype.getAddedableShape = function () {
|
|
126
221
|
var _a = this.props.model, width = _a.width, height = _a.height, x = _a.x, y = _a.y, radius = _a.radius, properties = _a.properties;
|
|
@@ -132,10 +227,45 @@ var GroupNode = /** @class */ (function (_super) {
|
|
|
132
227
|
var newHeight = height + strokeWidth + 8;
|
|
133
228
|
return h('rect', __assign(__assign({}, style), { width: newWidth, height: newHeight, x: x - newWidth / 2, y: y - newHeight / 2, rx: radius, ry: radius }));
|
|
134
229
|
};
|
|
230
|
+
GroupNode.prototype.getFoldIcon = function () {
|
|
231
|
+
var model = this.props.model;
|
|
232
|
+
var foldX = model.x - model.width / 2 + 5;
|
|
233
|
+
var foldY = model.y - model.height / 2 + 5;
|
|
234
|
+
if (!model.foldable)
|
|
235
|
+
return null;
|
|
236
|
+
var iconIcon = h('path', {
|
|
237
|
+
fill: 'none',
|
|
238
|
+
stroke: '#818281',
|
|
239
|
+
strokeWidth: 2,
|
|
240
|
+
'pointer-events': 'none',
|
|
241
|
+
d: model.properties.isFolded
|
|
242
|
+
? "M " + (foldX + 3) + "," + (foldY + 6) + " " + (foldX + 11) + "," + (foldY + 6) + " M" + (foldX + 7) + "," + (foldY + 2) + " " + (foldX + 7) + "," + (foldY + 10)
|
|
243
|
+
: "M " + (foldX + 3) + "," + (foldY + 6) + " " + (foldX + 11) + "," + (foldY + 6) + " ",
|
|
244
|
+
});
|
|
245
|
+
return h('g', {}, [
|
|
246
|
+
h('rect', {
|
|
247
|
+
height: 12,
|
|
248
|
+
width: 14,
|
|
249
|
+
rx: 2,
|
|
250
|
+
ry: 2,
|
|
251
|
+
strokeWidth: 1,
|
|
252
|
+
fill: '#F4F5F6',
|
|
253
|
+
stroke: '#CECECE',
|
|
254
|
+
cursor: 'pointer',
|
|
255
|
+
x: model.x - model.width / 2 + 5,
|
|
256
|
+
y: model.y - model.height / 2 + 5,
|
|
257
|
+
onClick: function () {
|
|
258
|
+
model.foldGroup(!model.properties.isFolded);
|
|
259
|
+
},
|
|
260
|
+
}),
|
|
261
|
+
iconIcon,
|
|
262
|
+
]);
|
|
263
|
+
};
|
|
135
264
|
GroupNode.prototype.getResizeShape = function () {
|
|
136
265
|
return h('g', {}, [
|
|
137
266
|
this.getAddedableShape(),
|
|
138
267
|
_super.prototype.getResizeShape.call(this),
|
|
268
|
+
this.getFoldIcon(),
|
|
139
269
|
]);
|
|
140
270
|
};
|
|
141
271
|
return GroupNode;
|
|
@@ -94,7 +94,7 @@ var Group = /** @class */ (function () {
|
|
|
94
94
|
});
|
|
95
95
|
lf.on('node:add', this.appendNodeToGrop);
|
|
96
96
|
lf.on('node:drop', this.appendNodeToGrop);
|
|
97
|
-
lf.on('node:dnd-
|
|
97
|
+
lf.on('node:dnd-drag', this.setActiveGroup);
|
|
98
98
|
lf.on('node:drag', this.setActiveGroup);
|
|
99
99
|
lf.on('graph:rendered', this.graphRendered);
|
|
100
100
|
}
|
|
@@ -6,21 +6,25 @@ var Snapshot = {
|
|
|
6
6
|
install: function (lf) {
|
|
7
7
|
var _this = this;
|
|
8
8
|
this.lf = lf;
|
|
9
|
-
this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
10
|
-
this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
11
9
|
/* 下载快照 */
|
|
12
10
|
lf.getSnapshot = function (fileName, backgroundColor) {
|
|
11
|
+
_this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
12
|
+
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
13
13
|
_this.fileName = fileName || "logic-flow." + Date.now() + ".png";
|
|
14
14
|
var svgRootElement = _this.getSvgRootElement(lf);
|
|
15
15
|
_this.downloadSvg(svgRootElement, _this.fileName, backgroundColor);
|
|
16
16
|
};
|
|
17
17
|
/* 获取Blob对象,用户图片上传 */
|
|
18
18
|
lf.getSnapshotBlob = function (backgroundColor) {
|
|
19
|
+
_this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
20
|
+
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
19
21
|
var svgRootElement = _this.getSvgRootElement(lf);
|
|
20
22
|
return _this.getBlob(svgRootElement, backgroundColor);
|
|
21
23
|
};
|
|
22
24
|
/* 获取Base64对象,用户图片上传 */
|
|
23
25
|
lf.getSnapshotBase64 = function (backgroundColor) {
|
|
26
|
+
_this.offsetX = Number.MAX_SAFE_INTEGER;
|
|
27
|
+
_this.offsetY = Number.MAX_SAFE_INTEGER;
|
|
24
28
|
var svgRootElement = _this.getSvgRootElement(lf);
|
|
25
29
|
return _this.getBase64(svgRootElement, backgroundColor);
|
|
26
30
|
};
|
|
@@ -172,6 +176,7 @@ var Snapshot = {
|
|
|
172
176
|
canvas.width = bboxWidth * dpr + 80;
|
|
173
177
|
canvas.height = bboxHeight * dpr + 80;
|
|
174
178
|
var ctx = canvas.getContext('2d');
|
|
179
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
175
180
|
ctx.scale(dpr, dpr);
|
|
176
181
|
// 如果有背景色,设置流程图导出的背景色
|
|
177
182
|
if (backgroundColor) {
|