@logicflow/extension 0.7.6 → 0.7.10
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/CHANGELOG.md +56 -0
- package/cjs/NodeResize/Control/ControlGroup.js +3 -1
- package/cjs/NodeResize/Node/DiamondResize.js +1 -0
- package/cjs/NodeResize/Node/EllipseResize.js +1 -0
- package/cjs/NodeResize/Node/RectResize.js +6 -5
- package/cjs/NodeResize/index.js +0 -15
- package/cjs/bpmn/index.js +5 -2
- package/cjs/components/context-menu/index.js +210 -0
- package/cjs/components/mini-map/index.js +3 -1
- package/cjs/index.js +2 -0
- package/cjs/style/index.css +28 -0
- package/es/NodeResize/Control/ControlGroup.js +3 -1
- package/es/NodeResize/Node/DiamondResize.js +1 -0
- package/es/NodeResize/Node/EllipseResize.js +1 -0
- package/es/NodeResize/Node/RectResize.d.ts +1 -0
- package/es/NodeResize/Node/RectResize.js +6 -5
- package/es/NodeResize/index.js +0 -15
- package/es/bpmn/index.js +5 -2
- package/es/components/context-menu/index.d.ts +24 -0
- package/es/components/context-menu/index.js +207 -0
- package/es/components/mini-map/index.js +3 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/style/index.css +28 -0
- package/lib/AutoLayout.js +1 -1
- package/lib/BpmnAdapter.js +1 -1
- package/lib/BpmnElement.js +1 -1
- package/lib/ContextMenu.js +1 -0
- 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/style/index.css +28 -0
- package/package.json +3 -3
- package/types/NodeResize/Node/RectResize.d.ts +1 -0
- package/types/components/context-menu/index.d.ts +24 -0
- package/types/index.d.ts +1 -0
- package/types/mindmap/fakerRoot.d.ts +13 -0
- package/types/mindmap/index.d.ts +40 -0
- package/types/mindmap/markContent.d.ts +17 -0
- package/types/mindmap/markContentOption.d.ts +17 -0
- package/types/mindmap/markEntity.d.ts +17 -0
- package/types/mindmap/markRoot.d.ts +17 -0
- package/types/mindmap/mindNode.d.ts +16 -0
- package/types/mindmap/rootNode.d.ts +17 -0
- package/types/mindmap/theme.d.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,62 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.7.10](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.9...@logicflow/extension@0.7.10) (2021-11-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add mind map plugin ([11ae7e0](https://github.com/didi/LogicFlow/commit/11ae7e06f878cb6b8c82f2f73f74e8e4620fecb6))
|
|
12
|
+
* hide mind map ([2aa1120](https://github.com/didi/LogicFlow/commit/2aa112002023b87188c9b132dbeb6c77e92e17bf))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [0.7.9](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.8...@logicflow/extension@0.7.9) (2021-11-23)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* context menu edge icon position ([f06ead4](https://github.com/didi/LogicFlow/commit/f06ead4e687498550012e654765430d1fa1f48a2))
|
|
24
|
+
* nodeResize outline bugfix ([8e76f5f](https://github.com/didi/LogicFlow/commit/8e76f5f8e79a18189f48339b85904b06d29cfda2))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* context-menu use className ([e58eaea](https://github.com/didi/LogicFlow/commit/e58eaea67aaf7c8f420aed849a4f77b753a1bc6c))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [0.7.8](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.7...@logicflow/extension@0.7.8) (2021-11-22)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* nodeResize getResizeShape bugfix ([e617013](https://github.com/didi/LogicFlow/commit/e617013f979cd67dbe438dad141f0eef25690aa2))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
|
|
45
|
+
* export context menu ([f0ff960](https://github.com/didi/LogicFlow/commit/f0ff960a2518cfe0e3f9d2a5abb843b87957def6))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [0.7.7](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.6...@logicflow/extension@0.7.7) (2021-11-19)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* add context menu plugin ([8c5d7a8](https://github.com/didi/LogicFlow/commit/8c5d7a84309ba8d07fbbb99dcebcae81b521bd06))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
6
62
|
## [0.7.6](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.5...@logicflow/extension@0.7.6) (2021-11-11)
|
|
7
63
|
|
|
8
64
|
|
|
@@ -71,7 +71,9 @@ var ControlGroup = /** @class */ (function (_super) {
|
|
|
71
71
|
return (preact_1.h(Rect_1.default, { fill: "none", x: x, y: y, width: width, height: height, stroke: stroke, strokeWidth: strokeWidth, strokeDasharray: strokeDasharray }));
|
|
72
72
|
};
|
|
73
73
|
ControlGroup.prototype.render = function () {
|
|
74
|
-
return (preact_1.h("g", { className: "lf-resize-control" },
|
|
74
|
+
return (preact_1.h("g", { className: "lf-resize-control" },
|
|
75
|
+
this.getGroupSolid(),
|
|
76
|
+
this.getResizeControl()));
|
|
75
77
|
};
|
|
76
78
|
return ControlGroup;
|
|
77
79
|
}(preact_1.Component));
|
|
@@ -33,6 +33,7 @@ var DiamondResizeModel = /** @class */ (function (_super) {
|
|
|
33
33
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
34
|
}
|
|
35
35
|
DiamondResizeModel.prototype.setAttributes = function () {
|
|
36
|
+
this.hideOutline = true;
|
|
36
37
|
// @ts-ignore
|
|
37
38
|
var nodeSize = this.properties.nodeSize;
|
|
38
39
|
if (nodeSize) {
|
|
@@ -37,6 +37,7 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
37
37
|
return _this;
|
|
38
38
|
}
|
|
39
39
|
RectResizeModel.prototype.setAttributes = function () {
|
|
40
|
+
this.hideOutline = true;
|
|
40
41
|
// @ts-ignore
|
|
41
42
|
var nodeSize = this.properties.nodeSize;
|
|
42
43
|
if (nodeSize) {
|
|
@@ -55,15 +56,15 @@ var RectResizeView = /** @class */ (function (_super) {
|
|
|
55
56
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
56
57
|
return (core_1.h(ControlGroup_1.default, __assign({}, attributes, { nodeModel: model, graphModel: graphModel })));
|
|
57
58
|
};
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
// getResizeShape绘制图形,功能等同于基础矩形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
60
|
+
RectResizeView.prototype.getResizeShape = function () {
|
|
61
|
+
return _super.prototype.getShape.call(this);
|
|
62
|
+
};
|
|
62
63
|
RectResizeView.prototype.getShape = function () {
|
|
63
64
|
var attributes = _super.prototype.getAttributes.call(this);
|
|
64
65
|
var isSelected = this.props.model.isSelected;
|
|
65
66
|
return (core_1.h("g", null,
|
|
66
|
-
|
|
67
|
+
this.getResizeShape(),
|
|
67
68
|
isSelected ? this.getControlGroup(attributes) : ''));
|
|
68
69
|
};
|
|
69
70
|
return RectResizeView;
|
package/cjs/NodeResize/index.js
CHANGED
|
@@ -47,21 +47,6 @@ var NodeResize = {
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
install: function (lf) {
|
|
50
|
-
// 设置默认样式,主要将outlineColor设置为透明,不再core包中默认的节点外框
|
|
51
|
-
lf.setTheme({
|
|
52
|
-
rect: {
|
|
53
|
-
strokeWidth: 2,
|
|
54
|
-
outlineColor: 'transparent',
|
|
55
|
-
},
|
|
56
|
-
ellipse: {
|
|
57
|
-
strokeWidth: 2,
|
|
58
|
-
outlineColor: 'transparent',
|
|
59
|
-
},
|
|
60
|
-
diamond: {
|
|
61
|
-
strokeWidth: 2,
|
|
62
|
-
outlineColor: 'transparent',
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
50
|
lf.register({
|
|
66
51
|
type: RectResize_1.default.type,
|
|
67
52
|
view: RectResize_1.default.view,
|
package/cjs/bpmn/index.js
CHANGED
|
@@ -31,8 +31,11 @@ var BpmnElement = /** @class */ (function () {
|
|
|
31
31
|
lf.register(ExclusiveGateway_1.default);
|
|
32
32
|
lf.register(UserTask_1.default);
|
|
33
33
|
lf.register(ServiceTask_1.default);
|
|
34
|
-
|
|
35
|
-
lf.
|
|
34
|
+
// 支持自定义bpmn元素的连线
|
|
35
|
+
if (!lf.options.customBpmnEdge) {
|
|
36
|
+
lf.register(SequenceFlow_1.default);
|
|
37
|
+
lf.setDefaultEdgeType('bpmn:sequenceFlow');
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
BpmnElement.pluginName = 'BpmnElement';
|
|
38
41
|
return BpmnElement;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ContextMenu = void 0;
|
|
20
|
+
var COMMON_TYPE_KEY = 'menu-common';
|
|
21
|
+
var NEXT_X_DISTANCE = 200;
|
|
22
|
+
var NEXT_Y_DISTANCE = 100;
|
|
23
|
+
var ContextMenu = /** @class */ (function () {
|
|
24
|
+
function ContextMenu(_a) {
|
|
25
|
+
var _this = this;
|
|
26
|
+
var lf = _a.lf;
|
|
27
|
+
this.menuTypeMap = new Map();
|
|
28
|
+
this.listenDelete = function () {
|
|
29
|
+
_this.hideMenu();
|
|
30
|
+
};
|
|
31
|
+
this.lf = lf;
|
|
32
|
+
this.__menuDOM = document.createElement('div');
|
|
33
|
+
this.__menuDOM.className = 'lf-inner-context';
|
|
34
|
+
// const commonMenu = [];
|
|
35
|
+
this.menuTypeMap.set(COMMON_TYPE_KEY, []);
|
|
36
|
+
this.lf.setContextMenuByType = function (type, menus) {
|
|
37
|
+
_this.menuTypeMap.set(type, menus);
|
|
38
|
+
};
|
|
39
|
+
this.lf.setContextMenuItems = function (menus) {
|
|
40
|
+
_this.menuTypeMap.set(COMMON_TYPE_KEY, menus);
|
|
41
|
+
};
|
|
42
|
+
this.lf.showContextMenu = function (data) {
|
|
43
|
+
if (!data || !data.id) {
|
|
44
|
+
console.warn('请检查传入的参数');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
_this._activeData = data;
|
|
48
|
+
_this.createContextMenu();
|
|
49
|
+
};
|
|
50
|
+
this.lf.hideContextMenu = function () {
|
|
51
|
+
_this.hideMenu();
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
ContextMenu.prototype.render = function (lf, container) {
|
|
55
|
+
var _this = this;
|
|
56
|
+
this.container = container;
|
|
57
|
+
lf.on('node:click', function (_a) {
|
|
58
|
+
var data = _a.data;
|
|
59
|
+
_this._activeData = data;
|
|
60
|
+
_this.createContextMenu();
|
|
61
|
+
});
|
|
62
|
+
lf.on('edge:click', function (_a) {
|
|
63
|
+
var data = _a.data;
|
|
64
|
+
// 获取右上角坐标
|
|
65
|
+
_this._activeData = data;
|
|
66
|
+
_this.createContextMenu();
|
|
67
|
+
});
|
|
68
|
+
lf.on('blank:click', function () {
|
|
69
|
+
_this.hideMenu();
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* 获取新菜单位置
|
|
74
|
+
*/
|
|
75
|
+
ContextMenu.prototype.getContextMenuPosition = function () {
|
|
76
|
+
var data = this._activeData;
|
|
77
|
+
var Model = this.lf.graphModel.getElement(data.id);
|
|
78
|
+
if (!Model) {
|
|
79
|
+
console.warn("\u627E\u4E0D\u5230\u5143\u7D20" + data.id);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
var x;
|
|
83
|
+
var y;
|
|
84
|
+
if (Model.BaseType === 'edge') {
|
|
85
|
+
x = Number.MIN_SAFE_INTEGER;
|
|
86
|
+
y = Number.MAX_SAFE_INTEGER;
|
|
87
|
+
var edgeData = Model.getData();
|
|
88
|
+
x = Math.max(edgeData.startPoint.x, x);
|
|
89
|
+
y = Math.min(edgeData.startPoint.y, y);
|
|
90
|
+
x = Math.max(edgeData.endPoint.x, x);
|
|
91
|
+
y = Math.min(edgeData.endPoint.y, y);
|
|
92
|
+
if (edgeData.pointsList) {
|
|
93
|
+
edgeData.pointsList.forEach(function (point) {
|
|
94
|
+
x = Math.max(point.x, x);
|
|
95
|
+
y = Math.min(point.y, y);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (Model.BaseType === 'node') {
|
|
100
|
+
x = data.x + Model.width / 2;
|
|
101
|
+
y = data.y - Model.height / 2;
|
|
102
|
+
}
|
|
103
|
+
return this.lf.graphModel.transformMatrix.CanvasPointToHtmlPoint([x, y]);
|
|
104
|
+
};
|
|
105
|
+
ContextMenu.prototype.createContextMenu = function () {
|
|
106
|
+
var _this = this;
|
|
107
|
+
var isSilentMode = this.lf.options.isSilentMode;
|
|
108
|
+
// 静默模式不显示菜单
|
|
109
|
+
if (isSilentMode) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
var items = this.menuTypeMap.get(this._activeData.type) || [];
|
|
113
|
+
items = items.concat(this.menuTypeMap.get(COMMON_TYPE_KEY));
|
|
114
|
+
var menus = document.createDocumentFragment();
|
|
115
|
+
items.forEach(function (item) {
|
|
116
|
+
var menuItem = document.createElement('div');
|
|
117
|
+
menuItem.className = 'lf-context-item';
|
|
118
|
+
var img = document.createElement('img');
|
|
119
|
+
img.src = item.icon;
|
|
120
|
+
img.className = 'lf-context-img';
|
|
121
|
+
if (item.className) {
|
|
122
|
+
menuItem.className = menuItem.className + " " + item.className;
|
|
123
|
+
}
|
|
124
|
+
img.addEventListener('click', function () {
|
|
125
|
+
_this.hideMenu();
|
|
126
|
+
if (item.callback) {
|
|
127
|
+
item.callback(_this._activeData);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
_this.addNode({
|
|
131
|
+
sourceId: _this._activeData.id,
|
|
132
|
+
x: _this._activeData.x,
|
|
133
|
+
y: _this._activeData.y,
|
|
134
|
+
properties: item.properties,
|
|
135
|
+
type: item.type,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
menuItem.appendChild(img);
|
|
140
|
+
menus.appendChild(menuItem);
|
|
141
|
+
});
|
|
142
|
+
this.__menuDOM.innerHTML = '';
|
|
143
|
+
this.__menuDOM.appendChild(menus);
|
|
144
|
+
this.showMenu();
|
|
145
|
+
};
|
|
146
|
+
ContextMenu.prototype.addNode = function (node, y) {
|
|
147
|
+
var isDeep = y !== undefined;
|
|
148
|
+
if (y === undefined) {
|
|
149
|
+
y = node.y;
|
|
150
|
+
}
|
|
151
|
+
var nodeModel = this.lf.getNodeModel(node.sourceId);
|
|
152
|
+
var leftTopX = node.x - nodeModel.width + NEXT_X_DISTANCE;
|
|
153
|
+
var leftTopY = y - node.y / 2 - 20;
|
|
154
|
+
var rightBottomX = node.x + nodeModel.width + NEXT_X_DISTANCE;
|
|
155
|
+
var rightBottomY = y + node.y / 2 + 20;
|
|
156
|
+
var exsitElements = this.lf.getAreaElement([leftTopX, leftTopY], [rightBottomX, rightBottomY]);
|
|
157
|
+
if (exsitElements.length) {
|
|
158
|
+
y = y + NEXT_Y_DISTANCE;
|
|
159
|
+
this.addNode(node, y);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
var newNode = this.lf.addNode({
|
|
163
|
+
type: node.type,
|
|
164
|
+
x: node.x + 200,
|
|
165
|
+
y: y,
|
|
166
|
+
properties: node.properties,
|
|
167
|
+
});
|
|
168
|
+
var startPoint;
|
|
169
|
+
var endPoint;
|
|
170
|
+
if (isDeep) {
|
|
171
|
+
startPoint = {
|
|
172
|
+
x: node.x,
|
|
173
|
+
y: node.y + nodeModel.height / 2,
|
|
174
|
+
};
|
|
175
|
+
endPoint = {
|
|
176
|
+
x: newNode.x - newNode.width / 2,
|
|
177
|
+
y: newNode.y,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
this.lf.createEdge({
|
|
181
|
+
sourceNodeId: node.sourceId,
|
|
182
|
+
targetNodeId: newNode.id,
|
|
183
|
+
startPoint: startPoint,
|
|
184
|
+
endPoint: endPoint,
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
ContextMenu.prototype.showMenu = function () {
|
|
188
|
+
var _a = __read(this.getContextMenuPosition(), 2), x = _a[0], y = _a[1];
|
|
189
|
+
this.__menuDOM.style.display = 'flex';
|
|
190
|
+
this.__menuDOM.style.top = y + "px";
|
|
191
|
+
this.__menuDOM.style.left = x + 10 + "px";
|
|
192
|
+
this.container.appendChild(this.__menuDOM);
|
|
193
|
+
// 菜单显示的时候,监听删除,同时隐藏
|
|
194
|
+
!this.isShow && this.lf.on('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
|
|
195
|
+
this.isShow = true;
|
|
196
|
+
};
|
|
197
|
+
ContextMenu.prototype.hideMenu = function () {
|
|
198
|
+
this.__menuDOM.innerHTML = '';
|
|
199
|
+
this.__menuDOM.style.display = 'none';
|
|
200
|
+
if (this.isShow) {
|
|
201
|
+
this.container.removeChild(this.__menuDOM);
|
|
202
|
+
}
|
|
203
|
+
this.lf.off('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
|
|
204
|
+
this.isShow = false;
|
|
205
|
+
};
|
|
206
|
+
ContextMenu.pluginName = 'ContextMenu';
|
|
207
|
+
return ContextMenu;
|
|
208
|
+
}());
|
|
209
|
+
exports.ContextMenu = ContextMenu;
|
|
210
|
+
exports.default = ContextMenu;
|
package/cjs/index.js
CHANGED
|
@@ -11,12 +11,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./bpmn"), exports);
|
|
14
|
+
// export * from './~mindmap';
|
|
14
15
|
__exportStar(require("./tools/snapshot"), exports);
|
|
15
16
|
__exportStar(require("./bpmn-adapter"), exports);
|
|
16
17
|
__exportStar(require("./turbo-adapter"), exports);
|
|
17
18
|
__exportStar(require("./insert-node-in-polyline"), exports);
|
|
18
19
|
__exportStar(require("./components/control"), exports);
|
|
19
20
|
__exportStar(require("./components/menu"), exports);
|
|
21
|
+
__exportStar(require("./components/context-menu"), exports);
|
|
20
22
|
__exportStar(require("./components/dnd-panel"), exports);
|
|
21
23
|
__exportStar(require("./components/selection-select"), exports);
|
|
22
24
|
__exportStar(require("./components/mini-map"), exports);
|
package/cjs/style/index.css
CHANGED
|
@@ -177,3 +177,31 @@
|
|
|
177
177
|
.lf-resize-control-3{
|
|
178
178
|
cursor: sw-resize;
|
|
179
179
|
}
|
|
180
|
+
/* context-menu */
|
|
181
|
+
.lf-inner-context {
|
|
182
|
+
display: none;
|
|
183
|
+
position: absolute;
|
|
184
|
+
/* display: flex; */
|
|
185
|
+
flex-direction: column;
|
|
186
|
+
flex-wrap: wrap;
|
|
187
|
+
height: 90px;
|
|
188
|
+
}
|
|
189
|
+
.lf-context-item {
|
|
190
|
+
padding: 2px 3px;
|
|
191
|
+
width: 20px;
|
|
192
|
+
height: 20px;
|
|
193
|
+
margin: 0 2px 2px 0;
|
|
194
|
+
box-sizing: content-box;
|
|
195
|
+
}
|
|
196
|
+
.lf-context-item:hover {
|
|
197
|
+
background: rgba(201, 217, 216, 0.5);
|
|
198
|
+
}
|
|
199
|
+
.lf-context-img {
|
|
200
|
+
width: 20px;
|
|
201
|
+
height: 20px;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
}
|
|
204
|
+
/* mind map */
|
|
205
|
+
.lf-mindmap_addIcon {
|
|
206
|
+
margin-top: 10px;
|
|
207
|
+
}
|
|
@@ -69,7 +69,9 @@ var ControlGroup = /** @class */ (function (_super) {
|
|
|
69
69
|
return (h(Rect, { fill: "none", x: x, y: y, width: width, height: height, stroke: stroke, strokeWidth: strokeWidth, strokeDasharray: strokeDasharray }));
|
|
70
70
|
};
|
|
71
71
|
ControlGroup.prototype.render = function () {
|
|
72
|
-
return (h("g", { className: "lf-resize-control" },
|
|
72
|
+
return (h("g", { className: "lf-resize-control" },
|
|
73
|
+
this.getGroupSolid(),
|
|
74
|
+
this.getResizeControl()));
|
|
73
75
|
};
|
|
74
76
|
return ControlGroup;
|
|
75
77
|
}(Component));
|
|
@@ -31,6 +31,7 @@ var DiamondResizeModel = /** @class */ (function (_super) {
|
|
|
31
31
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
32
32
|
}
|
|
33
33
|
DiamondResizeModel.prototype.setAttributes = function () {
|
|
34
|
+
this.hideOutline = true;
|
|
34
35
|
// @ts-ignore
|
|
35
36
|
var nodeSize = this.properties.nodeSize;
|
|
36
37
|
if (nodeSize) {
|
|
@@ -35,6 +35,7 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
35
35
|
return _this;
|
|
36
36
|
}
|
|
37
37
|
RectResizeModel.prototype.setAttributes = function () {
|
|
38
|
+
this.hideOutline = true;
|
|
38
39
|
// @ts-ignore
|
|
39
40
|
var nodeSize = this.properties.nodeSize;
|
|
40
41
|
if (nodeSize) {
|
|
@@ -53,15 +54,15 @@ var RectResizeView = /** @class */ (function (_super) {
|
|
|
53
54
|
var _a = this.props, model = _a.model, graphModel = _a.graphModel;
|
|
54
55
|
return (h(ControlGroup, __assign({}, attributes, { nodeModel: model, graphModel: graphModel })));
|
|
55
56
|
};
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
// getResizeShape绘制图形,功能等同于基础矩形的getShape功能,可以通过复写此方法,进行节点自定义
|
|
58
|
+
RectResizeView.prototype.getResizeShape = function () {
|
|
59
|
+
return _super.prototype.getShape.call(this);
|
|
60
|
+
};
|
|
60
61
|
RectResizeView.prototype.getShape = function () {
|
|
61
62
|
var attributes = _super.prototype.getAttributes.call(this);
|
|
62
63
|
var isSelected = this.props.model.isSelected;
|
|
63
64
|
return (h("g", null,
|
|
64
|
-
|
|
65
|
+
this.getResizeShape(),
|
|
65
66
|
isSelected ? this.getControlGroup(attributes) : ''));
|
|
66
67
|
};
|
|
67
68
|
return RectResizeView;
|
package/es/NodeResize/index.js
CHANGED
|
@@ -41,21 +41,6 @@ var NodeResize = {
|
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
install: function (lf) {
|
|
44
|
-
// 设置默认样式,主要将outlineColor设置为透明,不再core包中默认的节点外框
|
|
45
|
-
lf.setTheme({
|
|
46
|
-
rect: {
|
|
47
|
-
strokeWidth: 2,
|
|
48
|
-
outlineColor: 'transparent',
|
|
49
|
-
},
|
|
50
|
-
ellipse: {
|
|
51
|
-
strokeWidth: 2,
|
|
52
|
-
outlineColor: 'transparent',
|
|
53
|
-
},
|
|
54
|
-
diamond: {
|
|
55
|
-
strokeWidth: 2,
|
|
56
|
-
outlineColor: 'transparent',
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
44
|
lf.register({
|
|
60
45
|
type: RectResize.type,
|
|
61
46
|
view: RectResize.view,
|
package/es/bpmn/index.js
CHANGED
|
@@ -16,8 +16,11 @@ var BpmnElement = /** @class */ (function () {
|
|
|
16
16
|
lf.register(ExclusiveGateway);
|
|
17
17
|
lf.register(UserTask);
|
|
18
18
|
lf.register(ServiceTask);
|
|
19
|
-
|
|
20
|
-
lf.
|
|
19
|
+
// 支持自定义bpmn元素的连线
|
|
20
|
+
if (!lf.options.customBpmnEdge) {
|
|
21
|
+
lf.register(SequenceFlow);
|
|
22
|
+
lf.setDefaultEdgeType('bpmn:sequenceFlow');
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
BpmnElement.pluginName = 'BpmnElement';
|
|
23
26
|
return BpmnElement;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare class ContextMenu {
|
|
2
|
+
static pluginName: string;
|
|
3
|
+
private __menuDOM;
|
|
4
|
+
private lf;
|
|
5
|
+
private _activeData;
|
|
6
|
+
private menuTypeMap;
|
|
7
|
+
container: any;
|
|
8
|
+
isShow: boolean;
|
|
9
|
+
constructor({ lf }: {
|
|
10
|
+
lf: any;
|
|
11
|
+
});
|
|
12
|
+
render(lf: any, container: any): void;
|
|
13
|
+
/**
|
|
14
|
+
* 获取新菜单位置
|
|
15
|
+
*/
|
|
16
|
+
private getContextMenuPosition;
|
|
17
|
+
private createContextMenu;
|
|
18
|
+
private addNode;
|
|
19
|
+
private showMenu;
|
|
20
|
+
listenDelete: () => void;
|
|
21
|
+
private hideMenu;
|
|
22
|
+
}
|
|
23
|
+
export default ContextMenu;
|
|
24
|
+
export { ContextMenu, };
|