@logicflow/extension 0.7.9 → 0.7.13-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/CHANGELOG.md +42 -0
- package/cjs/components/context-menu/index.js +3 -0
- package/cjs/components/dnd-panel/index.js +5 -0
- package/cjs/index.js +2 -0
- package/cjs/materials/node-selection/index.js +272 -0
- package/cjs/style/index.css +4 -0
- package/es/bpmn/events/StartEvent.d.ts +8 -11
- package/es/components/context-menu/index.js +3 -0
- package/es/components/dnd-panel/index.d.ts +1 -0
- package/es/components/dnd-panel/index.js +5 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/materials/group/GroupNode.d.ts +5 -5
- package/es/materials/node-selection/index.d.ts +33 -0
- package/es/materials/node-selection/index.js +269 -0
- package/es/style/index.css +4 -0
- 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/NodeSelection.js +10 -0
- 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 +4 -0
- package/package.json +3 -3
- package/types/bpmn/events/StartEvent.d.ts +8 -11
- package/types/components/dnd-panel/index.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/materials/group/GroupNode.d.ts +5 -5
- package/types/materials/node-selection/index.d.ts +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,48 @@
|
|
|
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.13-alpha.0](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.12...@logicflow/extension@0.7.13-alpha.0) (2021-12-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix addNodeSelection methods in node-selection plugin ([f75afd4](https://github.com/didi/LogicFlow/commit/f75afd4678de91c11d97aa1c628a0b8417f01ed9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.7.12](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.11...@logicflow/extension@0.7.12) (2021-12-04)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @logicflow/extension
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.7.11](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.10...@logicflow/extension@0.7.11) (2021-11-30)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* support disabled tool in core package ([1c7527f](https://github.com/didi/LogicFlow/commit/1c7527fc75929c444d9e5fb4b0b70b87086694c8))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [0.7.10](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.9...@logicflow/extension@0.7.10) (2021-11-26)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* add mind map plugin ([11ae7e0](https://github.com/didi/LogicFlow/commit/11ae7e06f878cb6b8c82f2f73f74e8e4620fecb6))
|
|
42
|
+
* hide mind map ([2aa1120](https://github.com/didi/LogicFlow/commit/2aa112002023b87188c9b132dbeb6c77e92e17bf))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
6
48
|
## [0.7.9](https://github.com/didi/LogicFlow/compare/@logicflow/extension@0.7.8...@logicflow/extension@0.7.9) (2021-11-23)
|
|
7
49
|
|
|
8
50
|
|
|
@@ -118,6 +118,9 @@ var ContextMenu = /** @class */ (function () {
|
|
|
118
118
|
var img = document.createElement('img');
|
|
119
119
|
img.src = item.icon;
|
|
120
120
|
img.className = 'lf-context-img';
|
|
121
|
+
if (item.className) {
|
|
122
|
+
menuItem.className = menuItem.className + " " + item.className;
|
|
123
|
+
}
|
|
121
124
|
img.addEventListener('click', function () {
|
|
122
125
|
_this.hideMenu();
|
|
123
126
|
if (item.callback) {
|
|
@@ -8,6 +8,10 @@ var DndPanel = /** @class */ (function () {
|
|
|
8
8
|
this.lf = lf;
|
|
9
9
|
this.lf.setPatternItems = function (shapeList) {
|
|
10
10
|
_this.shapeList = shapeList;
|
|
11
|
+
// 支持渲染后重新设置拖拽面板
|
|
12
|
+
if (_this.domContainer) {
|
|
13
|
+
_this.render(_this.lf, _this.domContainer);
|
|
14
|
+
}
|
|
11
15
|
};
|
|
12
16
|
}
|
|
13
17
|
DndPanel.prototype.render = function (lf, domContainer) {
|
|
@@ -23,6 +27,7 @@ var DndPanel = /** @class */ (function () {
|
|
|
23
27
|
_this.panelEl.appendChild(_this.createDndItem(shapeItem));
|
|
24
28
|
});
|
|
25
29
|
domContainer.appendChild(this.panelEl);
|
|
30
|
+
this.domContainer = domContainer;
|
|
26
31
|
};
|
|
27
32
|
DndPanel.prototype.createDndItem = function (shapeItem) {
|
|
28
33
|
var _this = this;
|
package/cjs/index.js
CHANGED
|
@@ -11,6 +11,7 @@ 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);
|
|
@@ -26,3 +27,4 @@ __exportStar(require("./materials/group"), exports);
|
|
|
26
27
|
__exportStar(require("./NodeResize"), exports);
|
|
27
28
|
__exportStar(require("./tools/flow-path"), exports);
|
|
28
29
|
__exportStar(require("./tools/auto-layout"), exports);
|
|
30
|
+
__exportStar(require("./materials/node-selection"), exports);
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.NodeSelection = void 0;
|
|
17
|
+
var lodash_es_1 = require("lodash-es");
|
|
18
|
+
var core_1 = require("@logicflow/core");
|
|
19
|
+
var NodeSelectionView = /** @class */ (function (_super) {
|
|
20
|
+
__extends(NodeSelectionView, _super);
|
|
21
|
+
function NodeSelectionView() {
|
|
22
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
+
_this.d = 10;
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
NodeSelectionView.prototype.getShapeStyle = function () {
|
|
27
|
+
// 设置边框为虚线
|
|
28
|
+
var style = _super.prototype.getShapeStyle.call(this);
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
style.strokeDashArray = '10 5';
|
|
31
|
+
return style;
|
|
32
|
+
};
|
|
33
|
+
NodeSelectionView.prototype.getLabelShape = function () {
|
|
34
|
+
var attributes = _super.prototype.getAttributes.call(this);
|
|
35
|
+
var x = attributes.x, // 元素中心点
|
|
36
|
+
y = attributes.y, // 元素中心点
|
|
37
|
+
width = attributes.width, height = attributes.height, stroke = attributes.stroke, id = attributes.id, labelText = attributes.properties.label_text;
|
|
38
|
+
return core_1.h('svg', {
|
|
39
|
+
x: x - width / 2,
|
|
40
|
+
y: y - height / 2,
|
|
41
|
+
style: 'z-index: 0; background: none; overflow: auto;',
|
|
42
|
+
}, labelText ? core_1.h('text', {
|
|
43
|
+
x: 0,
|
|
44
|
+
y: -5,
|
|
45
|
+
width: 50,
|
|
46
|
+
height: 24,
|
|
47
|
+
fontSize: '16px',
|
|
48
|
+
fill: stroke,
|
|
49
|
+
}, '方案') : '', labelText ? core_1.h('text', {
|
|
50
|
+
x: 50,
|
|
51
|
+
y: -5,
|
|
52
|
+
width: 50,
|
|
53
|
+
height: 24,
|
|
54
|
+
fontSize: '24px',
|
|
55
|
+
cursor: 'pointer',
|
|
56
|
+
fill: stroke,
|
|
57
|
+
onclick: this.handleCustomDeleteIconClick.bind(this, id),
|
|
58
|
+
}, 'x') : '');
|
|
59
|
+
};
|
|
60
|
+
NodeSelectionView.prototype.getShape = function () {
|
|
61
|
+
var attributes = _super.prototype.getAttributes.call(this);
|
|
62
|
+
var x = attributes.x, // 元素中心点
|
|
63
|
+
y = attributes.y, // 元素中心点
|
|
64
|
+
width = attributes.width, height = attributes.height, fill = attributes.fill, stroke = attributes.stroke, strokeWidth = attributes.strokeWidth, strokeDashArray = attributes.strokeDashArray, id = attributes.id;
|
|
65
|
+
return core_1.h('g', {}, [
|
|
66
|
+
core_1.h('rect', {
|
|
67
|
+
x: x - width / 2,
|
|
68
|
+
y: y - height / 2,
|
|
69
|
+
fill: fill,
|
|
70
|
+
stroke: stroke,
|
|
71
|
+
strokeWidth: strokeWidth,
|
|
72
|
+
width: width,
|
|
73
|
+
height: height,
|
|
74
|
+
strokeDashArray: strokeDashArray,
|
|
75
|
+
id: id,
|
|
76
|
+
}),
|
|
77
|
+
this.getLabelShape(),
|
|
78
|
+
]);
|
|
79
|
+
};
|
|
80
|
+
NodeSelectionView.prototype.toFront = function () { };
|
|
81
|
+
/**
|
|
82
|
+
* 点击删除
|
|
83
|
+
* @param id
|
|
84
|
+
*/
|
|
85
|
+
NodeSelectionView.prototype.handleCustomDeleteIconClick = function (id) {
|
|
86
|
+
var graphModel = this.props.graphModel;
|
|
87
|
+
graphModel.deleteNode(id);
|
|
88
|
+
};
|
|
89
|
+
return NodeSelectionView;
|
|
90
|
+
}(core_1.PolygonNode));
|
|
91
|
+
var NodeSelectionModel = /** @class */ (function (_super) {
|
|
92
|
+
__extends(NodeSelectionModel, _super);
|
|
93
|
+
function NodeSelectionModel() {
|
|
94
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
95
|
+
_this.d = 10;
|
|
96
|
+
return _this;
|
|
97
|
+
}
|
|
98
|
+
NodeSelectionModel.prototype.setAttributes = function () {
|
|
99
|
+
var _this = this;
|
|
100
|
+
// 默认不显示
|
|
101
|
+
this.points = [];
|
|
102
|
+
this.text = {
|
|
103
|
+
value: '',
|
|
104
|
+
x: 0,
|
|
105
|
+
y: 0,
|
|
106
|
+
draggable: false,
|
|
107
|
+
editable: false,
|
|
108
|
+
};
|
|
109
|
+
this.stroke = this.properties.active_color || '#008000';
|
|
110
|
+
this.zIndex = 0;
|
|
111
|
+
this.draggable = false;
|
|
112
|
+
this.anchorsOffset = [[0, 0]];
|
|
113
|
+
if (this.properties.node_selection_ids.length > 1) {
|
|
114
|
+
setTimeout(function () {
|
|
115
|
+
_this.updatePointsByNodes(_this.properties.node_selection_ids);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
NodeSelectionModel.prototype.getAnchorsByOffset = function () {
|
|
120
|
+
return [];
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* 更新points
|
|
124
|
+
* @param points
|
|
125
|
+
*/
|
|
126
|
+
NodeSelectionModel.prototype.updatePoints = function (points) {
|
|
127
|
+
this.points = points;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* 更新x y
|
|
131
|
+
*/
|
|
132
|
+
NodeSelectionModel.prototype.updateCoordinate = function (_a) {
|
|
133
|
+
var x = _a.x, y = _a.y;
|
|
134
|
+
this.x = x;
|
|
135
|
+
this.y = y;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* 更新points
|
|
139
|
+
*/
|
|
140
|
+
NodeSelectionModel.prototype.updatePointsByNodes = function (nodesIds) {
|
|
141
|
+
var _this = this;
|
|
142
|
+
// TODO: 临时方案矩形
|
|
143
|
+
var points = [];
|
|
144
|
+
var minX = Infinity;
|
|
145
|
+
var minY = Infinity;
|
|
146
|
+
var maxX = -Infinity;
|
|
147
|
+
var maxY = -Infinity;
|
|
148
|
+
nodesIds.forEach(function (id) {
|
|
149
|
+
var model = _this.graphModel.getNodeModel(id);
|
|
150
|
+
if (!model)
|
|
151
|
+
return;
|
|
152
|
+
var width = model.width, height = model.height, x = model.x, y = model.y;
|
|
153
|
+
minX = Math.min(minX, x - width / 2 - _this.d);
|
|
154
|
+
minY = Math.min(minY, y - height / 2 - _this.d);
|
|
155
|
+
maxX = Math.max(maxX, x + width / 2 + _this.d);
|
|
156
|
+
maxY = Math.max(maxY, y + height / 2 + _this.d);
|
|
157
|
+
});
|
|
158
|
+
points.push([minX, minY], [maxX, minY], [maxX, maxY], [minX, maxY]);
|
|
159
|
+
if ([minX, minY, maxX, maxY].some(function (n) { return Math.abs(n) === Infinity; }))
|
|
160
|
+
return;
|
|
161
|
+
this.updatePoints(points);
|
|
162
|
+
this.updateCoordinate({ x: ((maxX + minX) / 2), y: (maxY + minY) / 2 });
|
|
163
|
+
};
|
|
164
|
+
return NodeSelectionModel;
|
|
165
|
+
}(core_1.PolygonNodeModel));
|
|
166
|
+
var NodeSelection = /** @class */ (function () {
|
|
167
|
+
function NodeSelection(_a) {
|
|
168
|
+
var lf = _a.lf;
|
|
169
|
+
this.lf = null; // lf 实例
|
|
170
|
+
this.selectNodes = []; // 选择的nodes
|
|
171
|
+
this.currentClickNode = null; // 当前点击的节点,选中的节点是无序的
|
|
172
|
+
this.d = 10;
|
|
173
|
+
lf.register({
|
|
174
|
+
type: 'node-selection',
|
|
175
|
+
view: NodeSelectionView,
|
|
176
|
+
model: NodeSelectionModel,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
Object.defineProperty(NodeSelection.prototype, "selectNodesIds", {
|
|
180
|
+
/**
|
|
181
|
+
* 获取所选node的id数组
|
|
182
|
+
*/
|
|
183
|
+
get: function () {
|
|
184
|
+
return this.selectNodes.map(function (node) { return node.id; });
|
|
185
|
+
},
|
|
186
|
+
enumerable: false,
|
|
187
|
+
configurable: true
|
|
188
|
+
});
|
|
189
|
+
/**
|
|
190
|
+
* 新建node-selection节点
|
|
191
|
+
*/
|
|
192
|
+
NodeSelection.prototype.addNodeSelection = function () {
|
|
193
|
+
var node = this.lf.addNode({
|
|
194
|
+
type: 'node-selection',
|
|
195
|
+
text: '',
|
|
196
|
+
properties: {
|
|
197
|
+
node_selection_ids: this.selectNodesIds,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
node.updatePointsByNodes(this.selectNodesIds);
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* 删除node-selection节点
|
|
204
|
+
*/
|
|
205
|
+
NodeSelection.prototype.deleteNodeSelection = function () {
|
|
206
|
+
var nodeSelection = this.getNodeSelection();
|
|
207
|
+
if (!nodeSelection)
|
|
208
|
+
return;
|
|
209
|
+
this.lf.deleteNode(nodeSelection.id);
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* 更新node-selection节点
|
|
213
|
+
*/
|
|
214
|
+
NodeSelection.prototype.updateNodeSelection = function () {
|
|
215
|
+
var nodeSelection = this.getNodeSelection();
|
|
216
|
+
if (!nodeSelection)
|
|
217
|
+
return;
|
|
218
|
+
this.lf.setProperties(nodeSelection.id, {
|
|
219
|
+
node_selection_ids: this.selectNodesIds,
|
|
220
|
+
});
|
|
221
|
+
this.lf.getNodeModel(nodeSelection.id).updatePointsByNodes(this.selectNodesIds);
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* 获取所属的node-selection
|
|
225
|
+
*/
|
|
226
|
+
NodeSelection.prototype.getNodeSelection = function () {
|
|
227
|
+
var _this = this;
|
|
228
|
+
var ids = this.selectNodesIds;
|
|
229
|
+
var rawData = this.lf.getGraphRawData();
|
|
230
|
+
var oldIds = ids.filter(function (id) { return id !== _this.currentClickNode.id; });
|
|
231
|
+
return rawData.nodes.find(function (node) {
|
|
232
|
+
if (node.type === 'node-selection') {
|
|
233
|
+
var nodeSelectionIds_1 = lodash_es_1.default.get(node, 'properties.node_selection_ids', []);
|
|
234
|
+
return oldIds.every(function (id) { return nodeSelectionIds_1.includes(id); });
|
|
235
|
+
}
|
|
236
|
+
return false;
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
NodeSelection.prototype.render = function (lf) {
|
|
240
|
+
var _this = this;
|
|
241
|
+
this.lf = lf;
|
|
242
|
+
lf.on('node:click', function (val) {
|
|
243
|
+
if (!val.e.shiftKey)
|
|
244
|
+
return;
|
|
245
|
+
_this.currentClickNode = val.data;
|
|
246
|
+
// 如果selectNodesIds中已存在此节点,则取消选中次节点
|
|
247
|
+
var isUnSelected = false;
|
|
248
|
+
if (_this.selectNodesIds.includes(val.data.id)) {
|
|
249
|
+
_this.lf.getNodeModel(val.data.id).setSelected(false);
|
|
250
|
+
isUnSelected = true;
|
|
251
|
+
}
|
|
252
|
+
// 获取所有被选中的节点,获取到的数组是无序的
|
|
253
|
+
var nodes = lf.getSelectElements(true).nodes;
|
|
254
|
+
_this.selectNodes = nodes;
|
|
255
|
+
if (_this.selectNodes.length === 1) {
|
|
256
|
+
if (isUnSelected)
|
|
257
|
+
_this.deleteNodeSelection();
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
if (!isUnSelected && _this.selectNodes.length === 2) {
|
|
261
|
+
_this.addNodeSelection();
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
_this.updateNodeSelection();
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
NodeSelection.pluginName = 'node-selection';
|
|
269
|
+
return NodeSelection;
|
|
270
|
+
}());
|
|
271
|
+
exports.NodeSelection = NodeSelection;
|
|
272
|
+
exports.default = NodeSelection;
|
package/cjs/style/index.css
CHANGED
|
@@ -11,27 +11,24 @@ declare class StartEventView extends CircleNode {
|
|
|
11
11
|
width: number;
|
|
12
12
|
height: number;
|
|
13
13
|
fill: string;
|
|
14
|
-
fillOpacity
|
|
15
|
-
strokeWidth
|
|
14
|
+
fillOpacity?: number;
|
|
15
|
+
strokeWidth?: number;
|
|
16
16
|
stroke: string;
|
|
17
|
-
strokeOpacity
|
|
18
|
-
opacity
|
|
19
|
-
outlineColor
|
|
17
|
+
strokeOpacity?: number;
|
|
18
|
+
opacity?: number;
|
|
19
|
+
outlineColor?: string;
|
|
20
20
|
id: string;
|
|
21
|
-
properties:
|
|
22
|
-
[x: string]: any;
|
|
23
|
-
};
|
|
21
|
+
properties: Record<string, any>;
|
|
24
22
|
type: string;
|
|
25
23
|
x: number;
|
|
26
24
|
y: number;
|
|
27
25
|
isSelected: boolean;
|
|
28
26
|
isHovered: boolean;
|
|
29
27
|
text: {
|
|
30
|
-
|
|
28
|
+
[key: string]: any;
|
|
31
29
|
x: number;
|
|
32
30
|
y: number;
|
|
33
|
-
|
|
34
|
-
editable: boolean;
|
|
31
|
+
value: string;
|
|
35
32
|
};
|
|
36
33
|
};
|
|
37
34
|
}
|
|
@@ -115,6 +115,9 @@ var ContextMenu = /** @class */ (function () {
|
|
|
115
115
|
var img = document.createElement('img');
|
|
116
116
|
img.src = item.icon;
|
|
117
117
|
img.className = 'lf-context-img';
|
|
118
|
+
if (item.className) {
|
|
119
|
+
menuItem.className = menuItem.className + " " + item.className;
|
|
120
|
+
}
|
|
118
121
|
img.addEventListener('click', function () {
|
|
119
122
|
_this.hideMenu();
|
|
120
123
|
if (item.callback) {
|
|
@@ -5,6 +5,10 @@ var DndPanel = /** @class */ (function () {
|
|
|
5
5
|
this.lf = lf;
|
|
6
6
|
this.lf.setPatternItems = function (shapeList) {
|
|
7
7
|
_this.shapeList = shapeList;
|
|
8
|
+
// 支持渲染后重新设置拖拽面板
|
|
9
|
+
if (_this.domContainer) {
|
|
10
|
+
_this.render(_this.lf, _this.domContainer);
|
|
11
|
+
}
|
|
8
12
|
};
|
|
9
13
|
}
|
|
10
14
|
DndPanel.prototype.render = function (lf, domContainer) {
|
|
@@ -20,6 +24,7 @@ var DndPanel = /** @class */ (function () {
|
|
|
20
24
|
_this.panelEl.appendChild(_this.createDndItem(shapeItem));
|
|
21
25
|
});
|
|
22
26
|
domContainer.appendChild(this.panelEl);
|
|
27
|
+
this.domContainer = domContainer;
|
|
23
28
|
};
|
|
24
29
|
DndPanel.prototype.createDndItem = function (shapeItem) {
|
|
25
30
|
var _this = this;
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './bpmn';
|
|
2
|
+
// export * from './~mindmap';
|
|
2
3
|
export * from './tools/snapshot';
|
|
3
4
|
export * from './bpmn-adapter';
|
|
4
5
|
export * from './turbo-adapter';
|
|
@@ -14,3 +15,4 @@ export * from './materials/group';
|
|
|
14
15
|
export * from './NodeResize';
|
|
15
16
|
export * from './tools/flow-path';
|
|
16
17
|
export * from './tools/auto-layout';
|
|
18
|
+
export * from './materials/node-selection';
|
|
@@ -29,12 +29,12 @@ declare class GroupNode extends RectNode {
|
|
|
29
29
|
width: number;
|
|
30
30
|
height: number;
|
|
31
31
|
fill: string;
|
|
32
|
-
fillOpacity
|
|
33
|
-
strokeWidth
|
|
32
|
+
fillOpacity?: number;
|
|
33
|
+
strokeWidth?: number;
|
|
34
34
|
stroke: string;
|
|
35
|
-
strokeOpacity
|
|
36
|
-
opacity
|
|
37
|
-
outlineColor
|
|
35
|
+
strokeOpacity?: number;
|
|
36
|
+
opacity?: number;
|
|
37
|
+
outlineColor?: string;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
declare const _default: {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare class NodeSelection {
|
|
2
|
+
static pluginName: string;
|
|
3
|
+
lf: any;
|
|
4
|
+
selectNodes: any[];
|
|
5
|
+
currentClickNode: any;
|
|
6
|
+
d: number;
|
|
7
|
+
constructor({ lf }: {
|
|
8
|
+
lf: any;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* 获取所选node的id数组
|
|
12
|
+
*/
|
|
13
|
+
get selectNodesIds(): any[];
|
|
14
|
+
/**
|
|
15
|
+
* 新建node-selection节点
|
|
16
|
+
*/
|
|
17
|
+
addNodeSelection(): void;
|
|
18
|
+
/**
|
|
19
|
+
* 删除node-selection节点
|
|
20
|
+
*/
|
|
21
|
+
deleteNodeSelection(): void;
|
|
22
|
+
/**
|
|
23
|
+
* 更新node-selection节点
|
|
24
|
+
*/
|
|
25
|
+
updateNodeSelection(): void;
|
|
26
|
+
/**
|
|
27
|
+
* 获取所属的node-selection
|
|
28
|
+
*/
|
|
29
|
+
getNodeSelection(): any;
|
|
30
|
+
render(lf: any): void;
|
|
31
|
+
}
|
|
32
|
+
export default NodeSelection;
|
|
33
|
+
export { NodeSelection, };
|