@logicflow/extension 0.7.5 → 0.7.9
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 +55 -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 +207 -0
- package/cjs/components/mini-map/index.js +5 -2
- package/cjs/index.js +1 -0
- package/cjs/style/index.css +24 -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 +204 -0
- package/es/components/mini-map/index.js +5 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/style/index.css +24 -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 +24 -0
- package/package.json +14 -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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,61 @@
|
|
|
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.9](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.8...@logicflow/extension@0.7.9) (2021-11-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* context menu edge icon position ([f06ead4](https://github.com/didi/LogicFlow/commit/f06ead4e687498550012e654765430d1fa1f48a2))
|
|
12
|
+
* nodeResize outline bugfix ([8e76f5f](https://github.com/didi/LogicFlow/commit/8e76f5f8e79a18189f48339b85904b06d29cfda2))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* context-menu use className ([e58eaea](https://github.com/didi/LogicFlow/commit/e58eaea67aaf7c8f420aed849a4f77b753a1bc6c))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [0.7.8](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.7...@logicflow/extension@0.7.8) (2021-11-22)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* nodeResize getResizeShape bugfix ([e617013](https://github.com/didi/LogicFlow/commit/e617013f979cd67dbe438dad141f0eef25690aa2))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* export context menu ([f0ff960](https://github.com/didi/LogicFlow/commit/f0ff960a2518cfe0e3f9d2a5abb843b87957def6))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [0.7.7](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.6...@logicflow/extension@0.7.7) (2021-11-19)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* add context menu plugin ([8c5d7a8](https://github.com/didi/LogicFlow/commit/8c5d7a84309ba8d07fbbb99dcebcae81b521bd06))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## [0.7.6](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.5...@logicflow/extension@0.7.6) (2021-11-11)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* minimap become invisible when repeat init ([ad488fd](https://github.com/didi/LogicFlow/commit/ad488fde9041834e9e809eb38904c013751d9cc8))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
6
61
|
## [0.7.5](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.4...@logicflow/extension@0.7.5) (2021-11-08)
|
|
7
62
|
|
|
8
63
|
**Note:** Version bump only for package @logicflow/extension
|
|
@@ -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,207 @@
|
|
|
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
|
+
img.addEventListener('click', function () {
|
|
122
|
+
_this.hideMenu();
|
|
123
|
+
if (item.callback) {
|
|
124
|
+
item.callback(_this._activeData);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
_this.addNode({
|
|
128
|
+
sourceId: _this._activeData.id,
|
|
129
|
+
x: _this._activeData.x,
|
|
130
|
+
y: _this._activeData.y,
|
|
131
|
+
properties: item.properties,
|
|
132
|
+
type: item.type,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
menuItem.appendChild(img);
|
|
137
|
+
menus.appendChild(menuItem);
|
|
138
|
+
});
|
|
139
|
+
this.__menuDOM.innerHTML = '';
|
|
140
|
+
this.__menuDOM.appendChild(menus);
|
|
141
|
+
this.showMenu();
|
|
142
|
+
};
|
|
143
|
+
ContextMenu.prototype.addNode = function (node, y) {
|
|
144
|
+
var isDeep = y !== undefined;
|
|
145
|
+
if (y === undefined) {
|
|
146
|
+
y = node.y;
|
|
147
|
+
}
|
|
148
|
+
var nodeModel = this.lf.getNodeModel(node.sourceId);
|
|
149
|
+
var leftTopX = node.x - nodeModel.width + NEXT_X_DISTANCE;
|
|
150
|
+
var leftTopY = y - node.y / 2 - 20;
|
|
151
|
+
var rightBottomX = node.x + nodeModel.width + NEXT_X_DISTANCE;
|
|
152
|
+
var rightBottomY = y + node.y / 2 + 20;
|
|
153
|
+
var exsitElements = this.lf.getAreaElement([leftTopX, leftTopY], [rightBottomX, rightBottomY]);
|
|
154
|
+
if (exsitElements.length) {
|
|
155
|
+
y = y + NEXT_Y_DISTANCE;
|
|
156
|
+
this.addNode(node, y);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
var newNode = this.lf.addNode({
|
|
160
|
+
type: node.type,
|
|
161
|
+
x: node.x + 200,
|
|
162
|
+
y: y,
|
|
163
|
+
properties: node.properties,
|
|
164
|
+
});
|
|
165
|
+
var startPoint;
|
|
166
|
+
var endPoint;
|
|
167
|
+
if (isDeep) {
|
|
168
|
+
startPoint = {
|
|
169
|
+
x: node.x,
|
|
170
|
+
y: node.y + nodeModel.height / 2,
|
|
171
|
+
};
|
|
172
|
+
endPoint = {
|
|
173
|
+
x: newNode.x - newNode.width / 2,
|
|
174
|
+
y: newNode.y,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
this.lf.createEdge({
|
|
178
|
+
sourceNodeId: node.sourceId,
|
|
179
|
+
targetNodeId: newNode.id,
|
|
180
|
+
startPoint: startPoint,
|
|
181
|
+
endPoint: endPoint,
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
ContextMenu.prototype.showMenu = function () {
|
|
185
|
+
var _a = __read(this.getContextMenuPosition(), 2), x = _a[0], y = _a[1];
|
|
186
|
+
this.__menuDOM.style.display = 'flex';
|
|
187
|
+
this.__menuDOM.style.top = y + "px";
|
|
188
|
+
this.__menuDOM.style.left = x + 10 + "px";
|
|
189
|
+
this.container.appendChild(this.__menuDOM);
|
|
190
|
+
// 菜单显示的时候,监听删除,同时隐藏
|
|
191
|
+
!this.isShow && this.lf.on('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
|
|
192
|
+
this.isShow = true;
|
|
193
|
+
};
|
|
194
|
+
ContextMenu.prototype.hideMenu = function () {
|
|
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';
|
|
204
|
+
return ContextMenu;
|
|
205
|
+
}());
|
|
206
|
+
exports.ContextMenu = ContextMenu;
|
|
207
|
+
exports.default = ContextMenu;
|
|
@@ -30,7 +30,6 @@ var MiniMap = {
|
|
|
30
30
|
__height: 220,
|
|
31
31
|
__miniMapWidth: 450,
|
|
32
32
|
__miniMapHeight: 660,
|
|
33
|
-
__isShow: false,
|
|
34
33
|
__viewPortTop: 0,
|
|
35
34
|
__viewPortLeft: 0,
|
|
36
35
|
__startPosition: null,
|
|
@@ -47,6 +46,8 @@ var MiniMap = {
|
|
|
47
46
|
MiniMap.__miniMapHeight = (lf.width * 220) / 150;
|
|
48
47
|
MiniMap.__LogicFlow = LogicFlow;
|
|
49
48
|
this.__init();
|
|
49
|
+
// 避免多次install的时候, _isShow状态被修改了
|
|
50
|
+
MiniMap.__isShow = false;
|
|
50
51
|
},
|
|
51
52
|
init: function (option) {
|
|
52
53
|
this.__disabledPlugins = this.__disabledPlugins.concat(option.disabledPlugins || []);
|
|
@@ -63,7 +64,9 @@ var MiniMap = {
|
|
|
63
64
|
];
|
|
64
65
|
events.forEach(function (eventName) {
|
|
65
66
|
MiniMap.__lf.on(eventName, function () {
|
|
66
|
-
MiniMap.
|
|
67
|
+
if (MiniMap.__isShow) {
|
|
68
|
+
MiniMap.__setView();
|
|
69
|
+
}
|
|
67
70
|
});
|
|
68
71
|
});
|
|
69
72
|
},
|
package/cjs/index.js
CHANGED
|
@@ -17,6 +17,7 @@ __exportStar(require("./turbo-adapter"), exports);
|
|
|
17
17
|
__exportStar(require("./insert-node-in-polyline"), exports);
|
|
18
18
|
__exportStar(require("./components/control"), exports);
|
|
19
19
|
__exportStar(require("./components/menu"), exports);
|
|
20
|
+
__exportStar(require("./components/context-menu"), exports);
|
|
20
21
|
__exportStar(require("./components/dnd-panel"), exports);
|
|
21
22
|
__exportStar(require("./components/selection-select"), exports);
|
|
22
23
|
__exportStar(require("./components/mini-map"), exports);
|
package/cjs/style/index.css
CHANGED
|
@@ -177,3 +177,27 @@
|
|
|
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
|
+
}
|
|
@@ -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, };
|