@logicflow/extension 1.2.13 → 1.2.16
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/menu/index.js +15 -12
- package/cjs/materials/group/GroupNode.js +4 -1
- package/cjs/tools/snapshot/index.js +14 -0
- package/es/components/menu/index.js +15 -12
- package/es/materials/group/GroupNode.js +4 -1
- package/es/tools/snapshot/index.d.ts +1 -0
- package/es/tools/snapshot/index.js +14 -0
- package/lib/Group.js +1 -1
- package/lib/Menu.js +1 -1
- package/lib/Snapshot.js +1 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -1757
|
@@ -29,19 +29,22 @@ var Menu = /** @class */ (function () {
|
|
|
29
29
|
function Menu(_a) {
|
|
30
30
|
var _this = this;
|
|
31
31
|
var lf = _a.lf;
|
|
32
|
-
this.__menuDOM = document.createElement('ul');
|
|
33
32
|
this.lf = lf;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
var isSilentMode = lf.options.isSilentMode;
|
|
34
|
+
if (!isSilentMode) {
|
|
35
|
+
this.__menuDOM = document.createElement('ul');
|
|
36
|
+
this.menuTypeMap = new Map();
|
|
37
|
+
this.init();
|
|
38
|
+
this.lf.setMenuConfig = function (config) {
|
|
39
|
+
_this.setMenuConfig(config);
|
|
40
|
+
};
|
|
41
|
+
this.lf.addMenuConfig = function (config) {
|
|
42
|
+
_this.addMenuConfig(config);
|
|
43
|
+
};
|
|
44
|
+
this.lf.setMenuByType = function (config) {
|
|
45
|
+
_this.setMenuByType(config);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
/**
|
|
47
50
|
* 初始化设置默认内置菜单栏
|
|
@@ -138,7 +138,8 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
138
138
|
if (nodeModel.isGroup && !nodeModel.isFolded) {
|
|
139
139
|
// 正常情况下,parent折叠后,children应该折叠
|
|
140
140
|
// 因此当parent准备展开时,children的值目前肯定是折叠状态,也就是nodeModel.isFolded=true,这个代码块不会触发
|
|
141
|
-
// 只有当parent准备折叠时,children
|
|
141
|
+
// 只有当parent准备折叠时,children目前状态才有可能是展开,
|
|
142
|
+
// 即nodeModel.isFolded=false,这个代码块触发,此时isFolded=true,触发children也进行折叠
|
|
142
143
|
nodeModel.foldGroup(isFolded);
|
|
143
144
|
}
|
|
144
145
|
if (nodeModel.isGroup && !isFolded) {
|
|
@@ -279,6 +280,7 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
279
280
|
*/
|
|
280
281
|
GroupNodeModel.prototype.addChild = function (id) {
|
|
281
282
|
this.children.add(id);
|
|
283
|
+
this.graphModel.eventCenter.emit('group:add-node', { data: this.getData() });
|
|
282
284
|
};
|
|
283
285
|
/**
|
|
284
286
|
* 删除分组子节点
|
|
@@ -286,6 +288,7 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
286
288
|
*/
|
|
287
289
|
GroupNodeModel.prototype.removeChild = function (id) {
|
|
288
290
|
this.children.delete(id);
|
|
291
|
+
this.graphModel.eventCenter.emit('group:remove-node', { data: this.getData() });
|
|
289
292
|
};
|
|
290
293
|
GroupNodeModel.prototype.getAddableOutlineStyle = function () {
|
|
291
294
|
return {
|
|
@@ -56,6 +56,19 @@ var Snapshot = /** @class */ (function () {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
+
Snapshot.prototype.removeRotateControl = function (element) {
|
|
60
|
+
var childNodes = element.childNodes;
|
|
61
|
+
var childLength = element.childNodes && element.childNodes.length;
|
|
62
|
+
for (var i = 0; i < childLength; i++) {
|
|
63
|
+
var child = childNodes[i];
|
|
64
|
+
var classList = (child.classList && Array.from(child.classList)) || [];
|
|
65
|
+
if (classList.indexOf('lf-rotate-control') > -1) {
|
|
66
|
+
element.removeChild(element.childNodes[i]);
|
|
67
|
+
childLength--;
|
|
68
|
+
i--;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
59
72
|
/* 下载图片 */
|
|
60
73
|
Snapshot.prototype.getSnapshot = function (fileName, backgroundColor) {
|
|
61
74
|
var _this = this;
|
|
@@ -132,6 +145,7 @@ var Snapshot = /** @class */ (function () {
|
|
|
132
145
|
lfBase.childNodes.forEach(function (item) {
|
|
133
146
|
var element = item;
|
|
134
147
|
_this.removeAnchor(element.firstChild);
|
|
148
|
+
_this.removeRotateControl(element.firstChild);
|
|
135
149
|
});
|
|
136
150
|
}
|
|
137
151
|
}
|
|
@@ -26,19 +26,22 @@ var Menu = /** @class */ (function () {
|
|
|
26
26
|
function Menu(_a) {
|
|
27
27
|
var _this = this;
|
|
28
28
|
var lf = _a.lf;
|
|
29
|
-
this.__menuDOM = document.createElement('ul');
|
|
30
29
|
this.lf = lf;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
var isSilentMode = lf.options.isSilentMode;
|
|
31
|
+
if (!isSilentMode) {
|
|
32
|
+
this.__menuDOM = document.createElement('ul');
|
|
33
|
+
this.menuTypeMap = new Map();
|
|
34
|
+
this.init();
|
|
35
|
+
this.lf.setMenuConfig = function (config) {
|
|
36
|
+
_this.setMenuConfig(config);
|
|
37
|
+
};
|
|
38
|
+
this.lf.addMenuConfig = function (config) {
|
|
39
|
+
_this.addMenuConfig(config);
|
|
40
|
+
};
|
|
41
|
+
this.lf.setMenuByType = function (config) {
|
|
42
|
+
_this.setMenuByType(config);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* 初始化设置默认内置菜单栏
|
|
@@ -136,7 +136,8 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
136
136
|
if (nodeModel.isGroup && !nodeModel.isFolded) {
|
|
137
137
|
// 正常情况下,parent折叠后,children应该折叠
|
|
138
138
|
// 因此当parent准备展开时,children的值目前肯定是折叠状态,也就是nodeModel.isFolded=true,这个代码块不会触发
|
|
139
|
-
// 只有当parent准备折叠时,children
|
|
139
|
+
// 只有当parent准备折叠时,children目前状态才有可能是展开,
|
|
140
|
+
// 即nodeModel.isFolded=false,这个代码块触发,此时isFolded=true,触发children也进行折叠
|
|
140
141
|
nodeModel.foldGroup(isFolded);
|
|
141
142
|
}
|
|
142
143
|
if (nodeModel.isGroup && !isFolded) {
|
|
@@ -277,6 +278,7 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
277
278
|
*/
|
|
278
279
|
GroupNodeModel.prototype.addChild = function (id) {
|
|
279
280
|
this.children.add(id);
|
|
281
|
+
this.graphModel.eventCenter.emit('group:add-node', { data: this.getData() });
|
|
280
282
|
};
|
|
281
283
|
/**
|
|
282
284
|
* 删除分组子节点
|
|
@@ -284,6 +286,7 @@ var GroupNodeModel = /** @class */ (function (_super) {
|
|
|
284
286
|
*/
|
|
285
287
|
GroupNodeModel.prototype.removeChild = function (id) {
|
|
286
288
|
this.children.delete(id);
|
|
289
|
+
this.graphModel.eventCenter.emit('group:remove-node', { data: this.getData() });
|
|
287
290
|
};
|
|
288
291
|
GroupNodeModel.prototype.getAddableOutlineStyle = function () {
|
|
289
292
|
return {
|
|
@@ -15,6 +15,7 @@ declare class Snapshot {
|
|
|
15
15
|
getSvgRootElement(lf: any): any;
|
|
16
16
|
triggerDownload(imgURI: string): void;
|
|
17
17
|
removeAnchor(element: any): void;
|
|
18
|
+
removeRotateControl(element: any): void;
|
|
18
19
|
getSnapshot(fileName: string, backgroundColor: string): void;
|
|
19
20
|
getSnapshotBase64(backgroundColor: string): Promise<unknown>;
|
|
20
21
|
getSnapshotBlob(backgroundColor: string): Promise<unknown>;
|
|
@@ -53,6 +53,19 @@ var Snapshot = /** @class */ (function () {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
+
Snapshot.prototype.removeRotateControl = function (element) {
|
|
57
|
+
var childNodes = element.childNodes;
|
|
58
|
+
var childLength = element.childNodes && element.childNodes.length;
|
|
59
|
+
for (var i = 0; i < childLength; i++) {
|
|
60
|
+
var child = childNodes[i];
|
|
61
|
+
var classList = (child.classList && Array.from(child.classList)) || [];
|
|
62
|
+
if (classList.indexOf('lf-rotate-control') > -1) {
|
|
63
|
+
element.removeChild(element.childNodes[i]);
|
|
64
|
+
childLength--;
|
|
65
|
+
i--;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
56
69
|
/* 下载图片 */
|
|
57
70
|
Snapshot.prototype.getSnapshot = function (fileName, backgroundColor) {
|
|
58
71
|
var _this = this;
|
|
@@ -129,6 +142,7 @@ var Snapshot = /** @class */ (function () {
|
|
|
129
142
|
lfBase.childNodes.forEach(function (item) {
|
|
130
143
|
var element = item;
|
|
131
144
|
_this.removeAnchor(element.firstChild);
|
|
145
|
+
_this.removeRotateControl(element.firstChild);
|
|
132
146
|
});
|
|
133
147
|
}
|
|
134
148
|
}
|