@logicflow/extension 1.0.6 → 1.1.0-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/index.js +1 -1
- package/cjs/bpmn/index.js +1 -1
- package/cjs/bpmn-adapter/index.js +3 -4
- package/cjs/bpmn-adapter/json2xml.js +3 -2
- package/cjs/bpmn-adapter/xml2json.js +5 -1
- package/cjs/components/context-menu/index.js +34 -22
- package/cjs/components/control/index.js +83 -71
- package/cjs/components/dnd-panel/index.js +20 -11
- package/cjs/components/menu/index.js +10 -10
- package/cjs/components/mini-map/index.js +159 -156
- package/cjs/components/selection-select/index.js +27 -14
- package/cjs/index.js +2 -0
- package/cjs/insert-node-in-polyline/index.js +1 -1
- package/cjs/materials/curved-edge/index.js +1 -1
- package/cjs/tools/flow-path/index.js +1 -1
- package/cjs/turbo-adapter/index.js +1 -1
- package/es/NodeResize/index.js +1 -1
- package/es/bpmn/index.js +1 -1
- package/es/bpmn-adapter/index.js +5 -6
- package/es/bpmn-adapter/json2xml.d.ts +2 -1
- package/es/bpmn-adapter/json2xml.js +2 -1
- package/es/bpmn-adapter/xml2json.d.ts +2 -2
- package/es/bpmn-adapter/xml2json.js +4 -1
- package/es/components/context-menu/index.d.ts +10 -1
- package/es/components/context-menu/index.js +34 -22
- package/es/components/control/index.d.ts +15 -12
- package/es/components/control/index.js +84 -72
- package/es/components/dnd-panel/index.d.ts +4 -1
- package/es/components/dnd-panel/index.js +20 -11
- package/es/components/menu/index.d.ts +2 -2
- package/es/components/menu/index.js +10 -10
- package/es/components/mini-map/index.d.ts +73 -2
- package/es/components/mini-map/index.js +159 -156
- package/es/components/selection-select/index.d.ts +8 -0
- package/es/components/selection-select/index.js +27 -14
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/insert-node-in-polyline/index.js +1 -1
- package/es/materials/curved-edge/index.js +1 -1
- package/es/tools/flow-path/index.js +1 -1
- package/es/turbo-adapter/index.js +1 -1
- 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 -0
- package/lib/lfXml2Json.js +1 -0
- package/package.json +2 -2
- package/types/bpmn-adapter/json2xml.d.ts +2 -1
- package/types/bpmn-adapter/xml2json.d.ts +2 -2
- package/types/components/context-menu/index.d.ts +10 -1
- package/types/components/control/index.d.ts +15 -12
- package/types/components/dnd-panel/index.d.ts +4 -1
- package/types/components/menu/index.d.ts +2 -2
- package/types/components/mini-map/index.d.ts +73 -2
- package/types/components/selection-select/index.d.ts +8 -0
- package/types/index.d.ts +2 -0
- package/cjs/curved.js +0 -0
- package/es/curved.d.ts +0 -0
- package/es/curved.js +0 -0
|
@@ -23,29 +23,23 @@ var ContextMenu = /** @class */ (function () {
|
|
|
23
23
|
var lf = _a.lf;
|
|
24
24
|
this.menuTypeMap = new Map();
|
|
25
25
|
this.listenDelete = function () {
|
|
26
|
-
_this.
|
|
26
|
+
_this.hideContextMenu();
|
|
27
27
|
};
|
|
28
28
|
this.lf = lf;
|
|
29
29
|
this.__menuDOM = document.createElement('div');
|
|
30
30
|
this.__menuDOM.className = 'lf-inner-context';
|
|
31
|
-
// const commonMenu = [];
|
|
32
31
|
this.menuTypeMap.set(COMMON_TYPE_KEY, []);
|
|
33
32
|
this.lf.setContextMenuByType = function (type, menus) {
|
|
34
33
|
_this.menuTypeMap.set(type, menus);
|
|
35
34
|
};
|
|
36
35
|
this.lf.setContextMenuItems = function (menus) {
|
|
37
|
-
_this.
|
|
36
|
+
_this.setContextMenuItems(menus);
|
|
38
37
|
};
|
|
39
38
|
this.lf.showContextMenu = function (data) {
|
|
40
|
-
|
|
41
|
-
console.warn('请检查传入的参数');
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
_this._activeData = data;
|
|
45
|
-
_this.createContextMenu();
|
|
39
|
+
_this.showContextMenu(data);
|
|
46
40
|
};
|
|
47
41
|
this.lf.hideContextMenu = function () {
|
|
48
|
-
_this.
|
|
42
|
+
_this.hideContextMenu();
|
|
49
43
|
};
|
|
50
44
|
}
|
|
51
45
|
ContextMenu.prototype.render = function (lf, container) {
|
|
@@ -63,9 +57,36 @@ var ContextMenu = /** @class */ (function () {
|
|
|
63
57
|
_this.createContextMenu();
|
|
64
58
|
});
|
|
65
59
|
lf.on('blank:click', function () {
|
|
66
|
-
_this.
|
|
60
|
+
_this.hideContextMenu();
|
|
67
61
|
});
|
|
68
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* 隐藏菜单
|
|
65
|
+
*/
|
|
66
|
+
ContextMenu.prototype.hideContextMenu = function () {
|
|
67
|
+
this.__menuDOM.innerHTML = '';
|
|
68
|
+
this.__menuDOM.style.display = 'none';
|
|
69
|
+
if (this.isShow) {
|
|
70
|
+
this.container.removeChild(this.__menuDOM);
|
|
71
|
+
}
|
|
72
|
+
this.lf.off('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
|
|
73
|
+
this.isShow = false;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* 显示指定元素菜单
|
|
77
|
+
* @param data 节点id、节点类型、菜单位置
|
|
78
|
+
*/
|
|
79
|
+
ContextMenu.prototype.showContextMenu = function (data) {
|
|
80
|
+
if (!data || !data.id) {
|
|
81
|
+
console.warn('请检查传入的参数');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this._activeData = data;
|
|
85
|
+
this.createContextMenu();
|
|
86
|
+
};
|
|
87
|
+
ContextMenu.prototype.setContextMenuItems = function (menus) {
|
|
88
|
+
this.menuTypeMap.set(COMMON_TYPE_KEY, menus);
|
|
89
|
+
};
|
|
69
90
|
/**
|
|
70
91
|
* 获取新菜单位置
|
|
71
92
|
*/
|
|
@@ -119,7 +140,7 @@ var ContextMenu = /** @class */ (function () {
|
|
|
119
140
|
menuItem.className = menuItem.className + " " + item.className;
|
|
120
141
|
}
|
|
121
142
|
img.addEventListener('click', function () {
|
|
122
|
-
_this.
|
|
143
|
+
_this.hideContextMenu();
|
|
123
144
|
if (item.callback) {
|
|
124
145
|
item.callback(_this._activeData);
|
|
125
146
|
}
|
|
@@ -191,16 +212,7 @@ var ContextMenu = /** @class */ (function () {
|
|
|
191
212
|
!this.isShow && this.lf.on('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
|
|
192
213
|
this.isShow = true;
|
|
193
214
|
};
|
|
194
|
-
ContextMenu.
|
|
195
|
-
this.__menuDOM.innerHTML = '';
|
|
196
|
-
this.__menuDOM.style.display = 'none';
|
|
197
|
-
if (this.isShow) {
|
|
198
|
-
this.container.removeChild(this.__menuDOM);
|
|
199
|
-
}
|
|
200
|
-
this.lf.off('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
|
|
201
|
-
this.isShow = false;
|
|
202
|
-
};
|
|
203
|
-
ContextMenu.pluginName = 'ContextMenu';
|
|
215
|
+
ContextMenu.pluginName = 'contextMenu';
|
|
204
216
|
return ContextMenu;
|
|
205
217
|
}());
|
|
206
218
|
export default ContextMenu;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import LogicFlow, { Extension } from '@logicflow/core';
|
|
2
1
|
declare type ControlItem = {
|
|
3
2
|
key: string;
|
|
4
3
|
iconClass: string;
|
|
@@ -8,16 +7,20 @@ declare type ControlItem = {
|
|
|
8
7
|
onMouseEnter?: Function;
|
|
9
8
|
onMouseLeave?: Function;
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
declare class Control {
|
|
11
|
+
private lf;
|
|
12
|
+
static pluginName: string;
|
|
13
|
+
private controlItems;
|
|
14
|
+
private domContainer;
|
|
15
|
+
private toolEl;
|
|
16
|
+
constructor({ lf }: {
|
|
17
|
+
lf: any;
|
|
18
|
+
});
|
|
19
|
+
render(lf: any, domContainer: any): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
addItem(item: any): void;
|
|
22
|
+
removeItem(key: any): ControlItem;
|
|
23
|
+
private getControlTool;
|
|
20
24
|
}
|
|
21
|
-
declare const Control: ControlPlugin;
|
|
22
25
|
export default Control;
|
|
23
|
-
export { Control
|
|
26
|
+
export { Control };
|
|
@@ -18,83 +18,93 @@ var __spread = (this && this.__spread) || function () {
|
|
|
18
18
|
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
19
19
|
return ar;
|
|
20
20
|
};
|
|
21
|
-
var Control = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
21
|
+
var Control = /** @class */ (function () {
|
|
22
|
+
function Control(_a) {
|
|
23
|
+
var _this = this;
|
|
24
|
+
var lf = _a.lf;
|
|
25
|
+
this.controlItems = [
|
|
26
|
+
{
|
|
27
|
+
key: 'zoom-out',
|
|
28
|
+
iconClass: 'lf-control-zoomOut',
|
|
29
|
+
title: '缩小流程图',
|
|
30
|
+
text: '缩小',
|
|
31
|
+
onClick: function () {
|
|
32
|
+
_this.lf.zoom(false);
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: 'zoom-in',
|
|
37
|
+
iconClass: 'lf-control-zoomIn',
|
|
38
|
+
title: '放大流程图',
|
|
39
|
+
text: '放大',
|
|
40
|
+
onClick: function () {
|
|
41
|
+
_this.lf.zoom(true);
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: 'reset',
|
|
46
|
+
iconClass: 'lf-control-fit',
|
|
47
|
+
title: '恢复流程原有尺寸',
|
|
48
|
+
text: '适应',
|
|
49
|
+
onClick: function () {
|
|
50
|
+
_this.lf.resetZoom();
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: 'undo',
|
|
55
|
+
iconClass: 'lf-control-undo',
|
|
56
|
+
title: '回到上一步',
|
|
57
|
+
text: '上一步',
|
|
58
|
+
onClick: function () {
|
|
59
|
+
_this.lf.undo();
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: 'redo',
|
|
64
|
+
iconClass: 'lf-control-redo',
|
|
65
|
+
title: '移到下一步',
|
|
66
|
+
text: '下一步',
|
|
67
|
+
onClick: function () {
|
|
68
|
+
_this.lf.redo();
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
this.lf = lf;
|
|
73
|
+
}
|
|
74
|
+
Control.prototype.render = function (lf, domContainer) {
|
|
75
|
+
this.destroy();
|
|
76
|
+
var toolEl = this.getControlTool();
|
|
77
|
+
this.toolEl = toolEl;
|
|
78
|
+
domContainer.appendChild(toolEl);
|
|
79
|
+
this.domContainer = domContainer;
|
|
80
|
+
};
|
|
81
|
+
Control.prototype.destroy = function () {
|
|
82
|
+
if (this.domContainer && this.toolEl && this.domContainer.contains(this.toolEl)) {
|
|
83
|
+
this.domContainer.removeChild(this.toolEl);
|
|
79
84
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
+
};
|
|
86
|
+
Control.prototype.addItem = function (item) {
|
|
87
|
+
this.controlItems.push(item);
|
|
88
|
+
};
|
|
89
|
+
Control.prototype.removeItem = function (key) {
|
|
90
|
+
var index = this.controlItems.findIndex(function (item) { return item.key === key; });
|
|
91
|
+
return this.controlItems.splice(index, 1)[0];
|
|
92
|
+
};
|
|
93
|
+
Control.prototype.getControlTool = function () {
|
|
94
|
+
var _this = this;
|
|
85
95
|
var NORMAL = 'lf-control-item';
|
|
86
96
|
var DISABLED = 'lf-control-item disabled';
|
|
87
97
|
var controlTool = document.createElement('div');
|
|
88
98
|
var controlElements = [];
|
|
89
99
|
controlTool.className = 'lf-control';
|
|
90
|
-
|
|
100
|
+
this.controlItems.forEach(function (item) {
|
|
91
101
|
var itemContainer = document.createElement('div');
|
|
92
102
|
var icon = document.createElement('i');
|
|
93
103
|
var text = document.createElement('span');
|
|
94
104
|
itemContainer.className = DISABLED;
|
|
95
|
-
item.onClick && (itemContainer.onclick = item.onClick.bind(null,
|
|
96
|
-
item.onMouseEnter && (itemContainer.onmouseenter = item.onMouseEnter.bind(null,
|
|
97
|
-
item.onMouseLeave && (itemContainer.onmouseleave = item.onMouseLeave.bind(null,
|
|
105
|
+
item.onClick && (itemContainer.onclick = item.onClick.bind(null, _this.lf));
|
|
106
|
+
item.onMouseEnter && (itemContainer.onmouseenter = item.onMouseEnter.bind(null, _this.lf));
|
|
107
|
+
item.onMouseLeave && (itemContainer.onmouseleave = item.onMouseLeave.bind(null, _this.lf));
|
|
98
108
|
icon.className = item.iconClass;
|
|
99
109
|
text.className = 'lf-control-text';
|
|
100
110
|
text.title = item.title;
|
|
@@ -102,13 +112,13 @@ var Control = {
|
|
|
102
112
|
itemContainer.append(icon, text);
|
|
103
113
|
switch (item.text) {
|
|
104
114
|
case '上一步':
|
|
105
|
-
|
|
115
|
+
_this.lf.on('history:change', function (_a) {
|
|
106
116
|
var undoAble = _a.data.undoAble;
|
|
107
117
|
itemContainer.className = undoAble ? NORMAL : DISABLED;
|
|
108
118
|
});
|
|
109
119
|
break;
|
|
110
120
|
case '下一步':
|
|
111
|
-
|
|
121
|
+
_this.lf.on('history:change', function (_a) {
|
|
112
122
|
var redoAble = _a.data.redoAble;
|
|
113
123
|
itemContainer.className = redoAble ? NORMAL : DISABLED;
|
|
114
124
|
});
|
|
@@ -121,7 +131,9 @@ var Control = {
|
|
|
121
131
|
});
|
|
122
132
|
controlTool.append.apply(controlTool, __spread(controlElements));
|
|
123
133
|
return controlTool;
|
|
124
|
-
}
|
|
125
|
-
|
|
134
|
+
};
|
|
135
|
+
Control.pluginName = 'control';
|
|
136
|
+
return Control;
|
|
137
|
+
}());
|
|
126
138
|
export default Control;
|
|
127
|
-
export { Control
|
|
139
|
+
export { Control };
|
|
@@ -3,9 +3,10 @@ declare type ShapeItem = {
|
|
|
3
3
|
type?: string;
|
|
4
4
|
text?: string;
|
|
5
5
|
icon?: string;
|
|
6
|
+
label?: string;
|
|
6
7
|
className?: string;
|
|
7
8
|
properties?: Record<string, any>;
|
|
8
|
-
callback?: () => void;
|
|
9
|
+
callback?: (lf: LogicFlow, container: HTMLElement) => void;
|
|
9
10
|
};
|
|
10
11
|
declare class DndPanel {
|
|
11
12
|
lf: LogicFlow;
|
|
@@ -17,6 +18,8 @@ declare class DndPanel {
|
|
|
17
18
|
lf: any;
|
|
18
19
|
});
|
|
19
20
|
render(lf: any, domContainer: any): void;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
setPatternItems(shapeList: any): void;
|
|
20
23
|
private createDndItem;
|
|
21
24
|
}
|
|
22
25
|
export { DndPanel, };
|
|
@@ -4,20 +4,17 @@ var DndPanel = /** @class */ (function () {
|
|
|
4
4
|
var lf = _a.lf;
|
|
5
5
|
this.lf = lf;
|
|
6
6
|
this.lf.setPatternItems = function (shapeList) {
|
|
7
|
-
_this.shapeList
|
|
8
|
-
// 支持渲染后重新设置拖拽面板
|
|
9
|
-
if (_this.domContainer) {
|
|
10
|
-
_this.render(_this.lf, _this.domContainer);
|
|
11
|
-
}
|
|
7
|
+
_this.setPatternItems(shapeList);
|
|
12
8
|
};
|
|
13
9
|
}
|
|
14
10
|
DndPanel.prototype.render = function (lf, domContainer) {
|
|
15
11
|
var _this = this;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
this.destroy();
|
|
13
|
+
if (!this.shapeList || this.shapeList.length === 0) {
|
|
14
|
+
// 首次render后失败后,后续调用setPatternItems支持渲染
|
|
15
|
+
this.domContainer = domContainer;
|
|
20
16
|
return;
|
|
17
|
+
}
|
|
21
18
|
this.panelEl = document.createElement('div');
|
|
22
19
|
this.panelEl.className = 'lf-dndpanel';
|
|
23
20
|
this.shapeList.forEach(function (shapeItem) {
|
|
@@ -26,6 +23,18 @@ var DndPanel = /** @class */ (function () {
|
|
|
26
23
|
domContainer.appendChild(this.panelEl);
|
|
27
24
|
this.domContainer = domContainer;
|
|
28
25
|
};
|
|
26
|
+
DndPanel.prototype.destroy = function () {
|
|
27
|
+
if (this.domContainer && this.panelEl && this.domContainer.contains(this.panelEl)) {
|
|
28
|
+
this.domContainer.removeChild(this.panelEl);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
DndPanel.prototype.setPatternItems = function (shapeList) {
|
|
32
|
+
this.shapeList = shapeList;
|
|
33
|
+
// 支持渲染后重新设置拖拽面板
|
|
34
|
+
if (this.domContainer) {
|
|
35
|
+
this.render(this.lf, this.domContainer);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
29
38
|
DndPanel.prototype.createDndItem = function (shapeItem) {
|
|
30
39
|
var _this = this;
|
|
31
40
|
var el = document.createElement('div');
|
|
@@ -51,12 +60,12 @@ var DndPanel = /** @class */ (function () {
|
|
|
51
60
|
});
|
|
52
61
|
}
|
|
53
62
|
if (shapeItem.callback) {
|
|
54
|
-
shapeItem.callback();
|
|
63
|
+
shapeItem.callback(_this.lf, _this.domContainer);
|
|
55
64
|
}
|
|
56
65
|
};
|
|
57
66
|
return el;
|
|
58
67
|
};
|
|
59
|
-
DndPanel.pluginName = '
|
|
68
|
+
DndPanel.pluginName = 'dndPanel';
|
|
60
69
|
return DndPanel;
|
|
61
70
|
}());
|
|
62
71
|
export { DndPanel, };
|
|
@@ -30,13 +30,13 @@ var Menu = /** @class */ (function () {
|
|
|
30
30
|
this.lf = lf;
|
|
31
31
|
this.menuTypeMap = new Map();
|
|
32
32
|
this.init();
|
|
33
|
-
this.lf.setMenuConfig = function (config) {
|
|
34
|
-
_this.
|
|
33
|
+
this.lf.extension.menu.setMenuConfig = function (config) {
|
|
34
|
+
_this.setMenuConfig(config);
|
|
35
35
|
};
|
|
36
|
-
this.lf.addMenuConfig = function (config) {
|
|
37
|
-
_this.
|
|
36
|
+
this.lf.extension.menu.addMenuConfig = function (config) {
|
|
37
|
+
_this.addMenuConfig(config);
|
|
38
38
|
};
|
|
39
|
-
this.lf.setMenuByType = function (config) {
|
|
39
|
+
this.lf.extension.menu.setMenuByType = function (config) {
|
|
40
40
|
_this.setMenuByType(config);
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -247,7 +247,7 @@ var Menu = /** @class */ (function () {
|
|
|
247
247
|
return menuList;
|
|
248
248
|
};
|
|
249
249
|
// 复写菜单
|
|
250
|
-
Menu.prototype.
|
|
250
|
+
Menu.prototype.setMenuConfig = function (config) {
|
|
251
251
|
if (!config) {
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
@@ -262,7 +262,7 @@ var Menu = /** @class */ (function () {
|
|
|
262
262
|
&& this.menuTypeMap.set(DefalutGraphMenuKey, config.graphMenu ? config.graphMenu : []);
|
|
263
263
|
};
|
|
264
264
|
// 在默认菜单后面追加菜单项
|
|
265
|
-
Menu.prototype.
|
|
265
|
+
Menu.prototype.addMenuConfig = function (config) {
|
|
266
266
|
if (!config) {
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
@@ -286,14 +286,14 @@ var Menu = /** @class */ (function () {
|
|
|
286
286
|
*/
|
|
287
287
|
Menu.prototype.changeMenuItem = function (type, config) {
|
|
288
288
|
if (type === 'add')
|
|
289
|
-
this.
|
|
289
|
+
this.addMenuConfig(config);
|
|
290
290
|
else if (type === 'reset')
|
|
291
|
-
this.
|
|
291
|
+
this.setMenuConfig(config);
|
|
292
292
|
else {
|
|
293
293
|
throw new Error('The first parameter of changeMenuConfig should be \'add\' or \'reset\'');
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
|
-
Menu.pluginName = '
|
|
296
|
+
Menu.pluginName = 'menu';
|
|
297
297
|
return Menu;
|
|
298
298
|
}());
|
|
299
299
|
export default Menu;
|
|
@@ -1,4 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare class MiniMap {
|
|
2
|
+
static pluginName: string;
|
|
3
|
+
__lf: any;
|
|
4
|
+
__container: any;
|
|
5
|
+
__miniMapWrap: any;
|
|
6
|
+
__miniMapContainer: any;
|
|
7
|
+
__lfMap: any;
|
|
8
|
+
__viewport: any;
|
|
9
|
+
__width: number;
|
|
10
|
+
__height: number;
|
|
11
|
+
__miniMapWidth: number;
|
|
12
|
+
__miniMapHeight: number;
|
|
13
|
+
__viewPortTop: number;
|
|
14
|
+
__viewPortLeft: number;
|
|
15
|
+
__startPosition: any;
|
|
16
|
+
__viewPortScale: number;
|
|
17
|
+
__viewPortWidth: number;
|
|
18
|
+
__viewPortHeight: number;
|
|
19
|
+
__resetDataX: number;
|
|
20
|
+
__resetDataY: number;
|
|
21
|
+
__LogicFlow: any;
|
|
22
|
+
__isShow: boolean;
|
|
23
|
+
__disabledPlugins: string[];
|
|
24
|
+
constructor({ lf, LogicFlow }: {
|
|
25
|
+
lf: any;
|
|
26
|
+
LogicFlow: any;
|
|
27
|
+
});
|
|
28
|
+
render(lf: any, container: any): void;
|
|
29
|
+
init(option: any): void;
|
|
30
|
+
/**
|
|
31
|
+
* 显示mini map
|
|
32
|
+
*/
|
|
33
|
+
show: (leftPosition: any, topPosition: any) => void;
|
|
34
|
+
/**
|
|
35
|
+
* 隐藏mini map
|
|
36
|
+
*/
|
|
37
|
+
hide: () => void;
|
|
38
|
+
__init(): void;
|
|
39
|
+
__createMiniMap(left: any, top: any): void;
|
|
40
|
+
__removeMiniMap(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 计算所有图形一起,占领的区域范围。
|
|
43
|
+
* @param data
|
|
44
|
+
*/
|
|
45
|
+
__getBounds(data: any): {
|
|
46
|
+
left: number;
|
|
47
|
+
top: number;
|
|
48
|
+
bottom: number;
|
|
49
|
+
right: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* 将负值的平移转换为正值。
|
|
53
|
+
* 保证渲染的时候,minimap能完全展示。
|
|
54
|
+
* 获取将画布所有元素平移到0,0开始时,所有节点数据
|
|
55
|
+
*/
|
|
56
|
+
__resetData(data: any): any;
|
|
57
|
+
/**
|
|
58
|
+
* 显示导航
|
|
59
|
+
* 显示视口范围
|
|
60
|
+
* 1. 基于画布的范围比例,设置视口范围比例。宽度默认为导航宽度。
|
|
61
|
+
*/
|
|
62
|
+
__setView(): void;
|
|
63
|
+
__setViewPort(scale: any, { left, right, top, bottom }: {
|
|
64
|
+
left: any;
|
|
65
|
+
right: any;
|
|
66
|
+
top: any;
|
|
67
|
+
bottom: any;
|
|
68
|
+
}): void;
|
|
69
|
+
__createViewPort(): void;
|
|
70
|
+
__startDrag: (e: any) => void;
|
|
71
|
+
__drag: (e: any) => void;
|
|
72
|
+
__drop: () => void;
|
|
73
|
+
}
|
|
3
74
|
export default MiniMap;
|
|
4
75
|
export { MiniMap };
|