@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.
Files changed (73) hide show
  1. package/cjs/NodeResize/index.js +1 -1
  2. package/cjs/bpmn/index.js +1 -1
  3. package/cjs/bpmn-adapter/index.js +3 -4
  4. package/cjs/bpmn-adapter/json2xml.js +3 -2
  5. package/cjs/bpmn-adapter/xml2json.js +5 -1
  6. package/cjs/components/context-menu/index.js +34 -22
  7. package/cjs/components/control/index.js +83 -71
  8. package/cjs/components/dnd-panel/index.js +20 -11
  9. package/cjs/components/menu/index.js +10 -10
  10. package/cjs/components/mini-map/index.js +159 -156
  11. package/cjs/components/selection-select/index.js +27 -14
  12. package/cjs/index.js +2 -0
  13. package/cjs/insert-node-in-polyline/index.js +1 -1
  14. package/cjs/materials/curved-edge/index.js +1 -1
  15. package/cjs/tools/flow-path/index.js +1 -1
  16. package/cjs/turbo-adapter/index.js +1 -1
  17. package/es/NodeResize/index.js +1 -1
  18. package/es/bpmn/index.js +1 -1
  19. package/es/bpmn-adapter/index.js +5 -6
  20. package/es/bpmn-adapter/json2xml.d.ts +2 -1
  21. package/es/bpmn-adapter/json2xml.js +2 -1
  22. package/es/bpmn-adapter/xml2json.d.ts +2 -2
  23. package/es/bpmn-adapter/xml2json.js +4 -1
  24. package/es/components/context-menu/index.d.ts +10 -1
  25. package/es/components/context-menu/index.js +34 -22
  26. package/es/components/control/index.d.ts +15 -12
  27. package/es/components/control/index.js +84 -72
  28. package/es/components/dnd-panel/index.d.ts +4 -1
  29. package/es/components/dnd-panel/index.js +20 -11
  30. package/es/components/menu/index.d.ts +2 -2
  31. package/es/components/menu/index.js +10 -10
  32. package/es/components/mini-map/index.d.ts +73 -2
  33. package/es/components/mini-map/index.js +159 -156
  34. package/es/components/selection-select/index.d.ts +8 -0
  35. package/es/components/selection-select/index.js +27 -14
  36. package/es/index.d.ts +2 -0
  37. package/es/index.js +2 -0
  38. package/es/insert-node-in-polyline/index.js +1 -1
  39. package/es/materials/curved-edge/index.js +1 -1
  40. package/es/tools/flow-path/index.js +1 -1
  41. package/es/turbo-adapter/index.js +1 -1
  42. package/lib/AutoLayout.js +1 -1
  43. package/lib/BpmnAdapter.js +1 -1
  44. package/lib/BpmnElement.js +1 -1
  45. package/lib/ContextMenu.js +1 -1
  46. package/lib/Control.js +1 -1
  47. package/lib/CurvedEdge.js +1 -1
  48. package/lib/DndPanel.js +1 -1
  49. package/lib/FlowPath.js +1 -1
  50. package/lib/Group.js +1 -1
  51. package/lib/InsertNodeInPolyline.js +1 -1
  52. package/lib/Menu.js +1 -1
  53. package/lib/MiniMap.js +1 -1
  54. package/lib/NodeResize.js +1 -1
  55. package/lib/RectLabelNode.js +1 -1
  56. package/lib/SelectionSelect.js +1 -1
  57. package/lib/Snapshot.js +1 -1
  58. package/lib/TurboAdapter.js +1 -1
  59. package/lib/lfJson2Xml.js +1 -0
  60. package/lib/lfXml2Json.js +1 -0
  61. package/package.json +2 -2
  62. package/types/bpmn-adapter/json2xml.d.ts +2 -1
  63. package/types/bpmn-adapter/xml2json.d.ts +2 -2
  64. package/types/components/context-menu/index.d.ts +10 -1
  65. package/types/components/control/index.d.ts +15 -12
  66. package/types/components/dnd-panel/index.d.ts +4 -1
  67. package/types/components/menu/index.d.ts +2 -2
  68. package/types/components/mini-map/index.d.ts +73 -2
  69. package/types/components/selection-select/index.d.ts +8 -0
  70. package/types/index.d.ts +2 -0
  71. package/cjs/curved.js +0 -0
  72. package/es/curved.d.ts +0 -0
  73. package/es/curved.js +0 -0
@@ -9,48 +9,92 @@ var __values = (this && this.__values) || function(o) {
9
9
  };
10
10
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
11
  };
12
- // interface MiniMapPlugin extends Extension {
13
- // init: (option) => void;
14
- // show: (leftPosition?: number, topPosition?: number) => void;
15
- // hide: () => void;
16
- // [x: string]: any;
17
- // }
18
- var MiniMap = {
19
- pluginName: 'minimap',
20
- __lf: null,
21
- __container: null,
22
- __miniMapWrap: null,
23
- __miniMapContainer: null,
24
- __lfMap: null,
25
- __viewport: null,
26
- __width: 150,
27
- __height: 220,
28
- __miniMapWidth: 450,
29
- __miniMapHeight: 660,
30
- __viewPortTop: 0,
31
- __viewPortLeft: 0,
32
- __startPosition: null,
33
- __viewPortScale: 1,
34
- __viewPortWidth: 150,
35
- __viewPortHeight: 75,
36
- __resetDataX: 0,
37
- __resetDataY: 0,
38
- __LogicFlow: null,
39
- __disabledPlugins: ['minimap', 'control', 'selection-select'],
40
- install: function (lf, LogicFlow) {
41
- MiniMap.__lf = lf;
42
- MiniMap.__miniMapWidth = lf.graphModel.width;
43
- MiniMap.__miniMapHeight = (lf.graphModel.width * 220) / 150;
44
- MiniMap.__LogicFlow = LogicFlow;
12
+ var MiniMap = /** @class */ (function () {
13
+ function MiniMap(_a) {
14
+ var _this = this;
15
+ var lf = _a.lf, LogicFlow = _a.LogicFlow;
16
+ this.__lf = null;
17
+ this.__container = null;
18
+ this.__miniMapWrap = null;
19
+ this.__miniMapContainer = null;
20
+ this.__lfMap = null;
21
+ this.__viewport = null;
22
+ this.__width = 150;
23
+ this.__height = 220;
24
+ this.__miniMapWidth = 450;
25
+ this.__miniMapHeight = 660;
26
+ this.__viewPortTop = 0;
27
+ this.__viewPortLeft = 0;
28
+ this.__startPosition = null;
29
+ this.__viewPortScale = 1;
30
+ this.__viewPortWidth = 150;
31
+ this.__viewPortHeight = 75;
32
+ this.__resetDataX = 0;
33
+ this.__resetDataY = 0;
34
+ this.__LogicFlow = null;
35
+ this.__isShow = false;
36
+ this.__disabledPlugins = ['miniMap', 'control', 'selectionSelect'];
37
+ /**
38
+ * 显示mini map
39
+ */
40
+ this.show = function (leftPosition, topPosition) {
41
+ _this.__setView();
42
+ if (!_this.__isShow) {
43
+ _this.__createMiniMap(leftPosition, topPosition);
44
+ }
45
+ _this.__isShow = true;
46
+ };
47
+ /**
48
+ * 隐藏mini map
49
+ */
50
+ this.hide = function () {
51
+ if (_this.__isShow) {
52
+ _this.__removeMiniMap();
53
+ }
54
+ _this.__isShow = false;
55
+ };
56
+ this.__startDrag = function (e) {
57
+ document.addEventListener('mousemove', _this.__drag);
58
+ document.addEventListener('mouseup', _this.__drop);
59
+ _this.__startPosition = {
60
+ x: e.x,
61
+ y: e.y,
62
+ };
63
+ };
64
+ this.__drag = function (e) {
65
+ var viewStyle = _this.__viewport.style;
66
+ _this.__viewPortTop += e.y - _this.__startPosition.y;
67
+ _this.__viewPortLeft += e.x - _this.__startPosition.x;
68
+ viewStyle.top = _this.__viewPortTop + "px";
69
+ viewStyle.left = _this.__viewPortLeft + "px";
70
+ _this.__startPosition = {
71
+ x: e.x,
72
+ y: e.y,
73
+ };
74
+ var centerX = (_this.__viewPortLeft + _this.__viewPortWidth / 2)
75
+ / _this.__viewPortScale;
76
+ var centerY = (_this.__viewPortTop + _this.__viewPortHeight / 2)
77
+ / _this.__viewPortScale;
78
+ _this.__lf.focusOn({
79
+ coordinate: {
80
+ x: centerX + _this.__resetDataX,
81
+ y: centerY + _this.__resetDataY,
82
+ },
83
+ });
84
+ };
85
+ this.__drop = function () {
86
+ document.removeEventListener('mousemove', _this.__drag);
87
+ document.removeEventListener('mouseup', _this.__drop);
88
+ };
89
+ this.__lf = lf;
90
+ this.__miniMapWidth = lf.graphModel.width;
91
+ this.__miniMapHeight = (lf.graphModel.width * 220) / 150;
92
+ this.__LogicFlow = LogicFlow;
45
93
  this.__init();
46
- // 避免多次install的时候, _isShow状态被修改了
47
- MiniMap.__isShow = false;
48
- },
49
- init: function (option) {
50
- this.__disabledPlugins = this.__disabledPlugins.concat(option.disabledPlugins || []);
51
- },
52
- render: function (lf, container) {
53
- MiniMap.__container = container;
94
+ }
95
+ MiniMap.prototype.render = function (lf, container) {
96
+ var _this = this;
97
+ this.__container = container;
54
98
  var events = [
55
99
  'node:add',
56
100
  'node:delete',
@@ -60,34 +104,24 @@ var MiniMap = {
60
104
  'blank:drop',
61
105
  ];
62
106
  events.forEach(function (eventName) {
63
- MiniMap.__lf.on(eventName, function () {
64
- if (MiniMap.__isShow) {
65
- MiniMap.__setView();
107
+ _this.__lf.on(eventName, function () {
108
+ if (_this.__isShow) {
109
+ _this.__setView();
66
110
  }
67
111
  });
68
112
  });
69
- },
70
- show: function (leftPosition, topPosition) {
71
- MiniMap.__setView();
72
- if (!MiniMap.__isShow) {
73
- MiniMap.__createMiniMap(leftPosition, topPosition);
74
- }
75
- MiniMap.__isShow = true;
76
- },
77
- hide: function () {
78
- if (MiniMap.__isShow) {
79
- MiniMap.__removeMiniMap();
80
- }
81
- MiniMap.__isShow = false;
82
- },
83
- __init: function () {
113
+ };
114
+ MiniMap.prototype.init = function (option) {
115
+ this.__disabledPlugins = this.__disabledPlugins.concat(option.disabledPlugins || []);
116
+ };
117
+ MiniMap.prototype.__init = function () {
84
118
  var miniMapWrap = document.createElement('div');
85
119
  miniMapWrap.className = 'lf-mini-map-graph';
86
- miniMapWrap.style.width = MiniMap.__width + "px";
87
- miniMapWrap.style.height = MiniMap.__height + "px";
88
- MiniMap.__lfMap = new MiniMap.__LogicFlow({
89
- width: MiniMap.__lf.graphModel.width,
90
- height: (MiniMap.__lf.graphModel.width * 220) / 150,
120
+ miniMapWrap.style.width = this.__width + "px";
121
+ miniMapWrap.style.height = this.__height + "px";
122
+ this.__lfMap = new this.__LogicFlow({
123
+ width: this.__lf.graphModel.width,
124
+ height: (this.__lf.graphModel.width * 220) / 150,
91
125
  container: miniMapWrap,
92
126
  isSilentMode: true,
93
127
  stopZoomGraph: true,
@@ -95,17 +129,17 @@ var MiniMap = {
95
129
  stopMoveGraph: true,
96
130
  hideAnchors: true,
97
131
  hoverOutline: false,
98
- disabledPlugins: MiniMap.__disabledPlugins,
132
+ disabledPlugins: this.__disabledPlugins,
99
133
  });
100
134
  // minimap中禁用adapter。
101
- MiniMap.__lfMap.adapterIn = function (a) { return a; };
102
- MiniMap.__lfMap.adapterOut = function (a) { return a; };
103
- MiniMap.__miniMapWrap = miniMapWrap;
104
- MiniMap.__createViewPort();
105
- },
106
- __createMiniMap: function (left, top) {
135
+ this.__lfMap.adapterIn = function (a) { return a; };
136
+ this.__lfMap.adapterOut = function (a) { return a; };
137
+ this.__miniMapWrap = miniMapWrap;
138
+ this.__createViewPort();
139
+ };
140
+ MiniMap.prototype.__createMiniMap = function (left, top) {
107
141
  var miniMapContainer = document.createElement('div');
108
- var miniMapWrap = MiniMap.__miniMapWrap;
142
+ var miniMapWrap = this.__miniMapWrap;
109
143
  miniMapContainer.appendChild(miniMapWrap);
110
144
  if (typeof left !== 'undefined' && typeof top !== 'undefined') {
111
145
  miniMapContainer.style.left = left + "px";
@@ -113,30 +147,30 @@ var MiniMap = {
113
147
  }
114
148
  miniMapContainer.style.position = 'absolute';
115
149
  miniMapContainer.className = 'lf-mini-map';
116
- MiniMap.__container.appendChild(miniMapContainer);
117
- MiniMap.__miniMapWrap.appendChild(MiniMap.__viewport);
150
+ this.__container.appendChild(miniMapContainer);
151
+ this.__miniMapWrap.appendChild(this.__viewport);
118
152
  var header = document.createElement('div');
119
153
  header.className = 'lf-mini-map-header';
120
154
  header.innerText = '导航';
121
155
  miniMapContainer.appendChild(header);
122
156
  var close = document.createElement('span');
123
157
  close.className = 'lf-mini-map-close';
124
- close.addEventListener('click', MiniMap.hide);
158
+ close.addEventListener('click', this.hide);
125
159
  miniMapContainer.appendChild(close);
126
- MiniMap.__miniMapContainer = miniMapContainer;
127
- },
128
- __removeMiniMap: function () {
129
- MiniMap.__container.removeChild(MiniMap.__miniMapContainer);
130
- },
160
+ this.__miniMapContainer = miniMapContainer;
161
+ };
162
+ MiniMap.prototype.__removeMiniMap = function () {
163
+ this.__container.removeChild(this.__miniMapContainer);
164
+ };
131
165
  /**
132
166
  * 计算所有图形一起,占领的区域范围。
133
167
  * @param data
134
168
  */
135
- __getBounds: function (data) {
169
+ MiniMap.prototype.__getBounds = function (data) {
136
170
  var left = 0;
137
- var right = MiniMap.__miniMapWidth;
171
+ var right = this.__miniMapWidth;
138
172
  var top = 0;
139
- var bottom = MiniMap.__miniMapHeight;
173
+ var bottom = this.__miniMapHeight;
140
174
  var nodes = data.nodes;
141
175
  if (nodes && nodes.length > 0) {
142
176
  // 因为获取的节点不知道真实的宽高,这里需要补充一点数值
@@ -158,13 +192,13 @@ var MiniMap = {
158
192
  bottom: bottom,
159
193
  right: right,
160
194
  };
161
- },
195
+ };
162
196
  /**
163
197
  * 将负值的平移转换为正值。
164
198
  * 保证渲染的时候,minimap能完全展示。
165
199
  * 获取将画布所有元素平移到0,0开始时,所有节点数据
166
200
  */
167
- __resetData: function (data) {
201
+ MiniMap.prototype.__resetData = function (data) {
168
202
  var nodes = data.nodes, edges = data.edges;
169
203
  var left = 0;
170
204
  var top = 0;
@@ -178,8 +212,8 @@ var MiniMap = {
178
212
  top = nodeTop < top ? nodeTop : top;
179
213
  });
180
214
  if (left < 0 || top < 0) {
181
- MiniMap.__resetDataX = left;
182
- MiniMap.__resetDataY = top;
215
+ this.__resetDataX = left;
216
+ this.__resetDataY = top;
183
217
  nodes.forEach(function (node) {
184
218
  node.x = node.x - left;
185
219
  node.y = node.y - top;
@@ -211,27 +245,27 @@ var MiniMap = {
211
245
  }
212
246
  }
213
247
  return data;
214
- },
248
+ };
215
249
  /**
216
250
  * 显示导航
217
251
  * 显示视口范围
218
252
  * 1. 基于画布的范围比例,设置视口范围比例。宽度默认为导航宽度。
219
253
  */
220
- __setView: function () {
254
+ MiniMap.prototype.__setView = function () {
221
255
  var e_1, _a;
222
256
  // 1. 获取到图中所有的节点中的位置,将其偏移到原点开始(避免节点位置为负的时候无法展示问题)。
223
- var data = MiniMap.__resetData(MiniMap.__lf.getGraphRawData());
257
+ var data = this.__resetData(this.__lf.getGraphRawData());
224
258
  // 由于随时都会有新节点注册进来,需要同步将注册的
225
- var viewMap = MiniMap.__lf.viewMap;
226
- var modelMap = MiniMap.__lf.graphModel.modelMap;
227
- var minimapViewMap = MiniMap.__lfMap.viewMap;
259
+ var viewMap = this.__lf.viewMap;
260
+ var modelMap = this.__lf.graphModel.modelMap;
261
+ var minimapViewMap = this.__lfMap.viewMap;
228
262
  try {
229
263
  // todo: no-restricted-syntax
230
264
  for (var _b = __values(viewMap.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
231
265
  var key = _c.value;
232
266
  if (!minimapViewMap.has(key)) {
233
- MiniMap.__lfMap.setView(key, viewMap.get(key));
234
- MiniMap.__lfMap.graphModel.modelMap.set(key, modelMap.get(key));
267
+ this.__lfMap.setView(key, viewMap.get(key));
268
+ this.__lfMap.graphModel.modelMap.set(key, modelMap.get(key));
235
269
  }
236
270
  }
237
271
  }
@@ -242,91 +276,60 @@ var MiniMap = {
242
276
  }
243
277
  finally { if (e_1) throw e_1.error; }
244
278
  }
245
- MiniMap.__lfMap.render(data);
279
+ this.__lfMap.render(data);
246
280
  // 2. 将偏移后的数据渲染到minimap画布上
247
281
  // 3. 计算出所有节点在一起的边界。
248
- var _d = MiniMap.__getBounds(data), left = _d.left, top = _d.top, right = _d.right, bottom = _d.bottom;
282
+ var _d = this.__getBounds(data), left = _d.left, top = _d.top, right = _d.right, bottom = _d.bottom;
249
283
  // 4. 计算所有节点的边界与minimap看板的边界的比例.
250
- var realWidthScale = MiniMap.__width / (right - left);
251
- var realHeightScale = MiniMap.__height / (bottom - top);
284
+ var realWidthScale = this.__width / (right - left);
285
+ var realHeightScale = this.__height / (bottom - top);
252
286
  // 5. 取比例最小的值,将渲染的画布缩小对应比例。
253
- var innerStyle = MiniMap.__miniMapWrap.firstChild.style;
287
+ var innerStyle = this.__miniMapWrap.firstChild.style;
254
288
  var scale = Math.min(realWidthScale, realHeightScale);
255
289
  innerStyle.transform = "matrix(" + scale + ", 0, 0, " + scale + ", 0, 0)";
256
290
  innerStyle.transformOrigin = 'left top';
257
291
  innerStyle.height = bottom - Math.min(top, 0) + "px";
258
292
  innerStyle.width = right - Math.min(left, 0) + "px";
259
- MiniMap.__viewPortScale = scale;
260
- MiniMap.__setViewPort(scale, {
293
+ this.__viewPortScale = scale;
294
+ this.__setViewPort(scale, {
261
295
  left: left,
262
296
  top: top,
263
297
  right: right,
264
298
  bottom: bottom,
265
299
  });
266
- },
300
+ };
267
301
  // 设置视口
268
- __setViewPort: function (scale, _a) {
269
- var left = _a.left, right = _a.right;
270
- var viewStyle = MiniMap.__viewport.style;
271
- viewStyle.width = MiniMap.__width - 4 + "px";
272
- viewStyle.height = (MiniMap.__width - 4) / (MiniMap.__lf.graphModel.width / MiniMap.__lf.graphModel.height) + "px";
302
+ MiniMap.prototype.__setViewPort = function (scale, _a) {
303
+ var left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom;
304
+ var viewStyle = this.__viewport.style;
305
+ viewStyle.width = this.__width - 4 + "px";
306
+ viewStyle.height = (this.__width - 4) / (this.__lf.graphModel.width / this.__lf.graphModel.height) + "px";
273
307
  // top
274
- var _b = MiniMap.__lf.getTransform(), TRANSLATE_X = _b.TRANSLATE_X, TRANSLATE_Y = _b.TRANSLATE_Y;
308
+ var _b = this.__lf.getTransform(), TRANSLATE_X = _b.TRANSLATE_X, TRANSLATE_Y = _b.TRANSLATE_Y;
275
309
  var realWidth = right - left;
276
310
  // 视口实际宽 = 视口默认宽 / (所有元素一起占据的真实宽 / 绘布宽)
277
- var realViewPortWidth = (MiniMap.__width - 4) / (realWidth / MiniMap.__lf.graphModel.width);
311
+ var realViewPortWidth = (this.__width - 4) / (realWidth / this.__lf.graphModel.width);
278
312
  // 视口实际高 = 视口实际宽 / (绘布宽 / 绘布高)
279
- var graphRatio = (MiniMap.__lf.graphModel.width / MiniMap.__lf.graphModel.height);
313
+ var graphRatio = (this.__lf.graphModel.width / this.__lf.graphModel.height);
280
314
  var realViewPortHeight = realViewPortWidth / graphRatio;
281
- MiniMap.__viewPortTop = TRANSLATE_Y > 0 ? 0 : -TRANSLATE_Y * scale;
282
- MiniMap.__viewPortLeft = -TRANSLATE_X * scale;
283
- MiniMap.__viewPortWidth = realViewPortWidth;
284
- MiniMap.__viewPortHeight = realViewPortHeight;
285
- viewStyle.top = MiniMap.__viewPortTop + "px";
286
- viewStyle.left = MiniMap.__viewPortLeft + "px";
315
+ this.__viewPortTop = TRANSLATE_Y > 0 ? 0 : -TRANSLATE_Y * scale;
316
+ this.__viewPortLeft = -TRANSLATE_X * scale;
317
+ this.__viewPortWidth = realViewPortWidth;
318
+ this.__viewPortHeight = realViewPortHeight;
319
+ viewStyle.top = this.__viewPortTop + "px";
320
+ viewStyle.left = this.__viewPortLeft + "px";
287
321
  viewStyle.width = realViewPortWidth + "px";
288
322
  viewStyle.height = realViewPortHeight + "px";
289
- },
323
+ };
290
324
  // 预览视窗
291
- __createViewPort: function () {
325
+ MiniMap.prototype.__createViewPort = function () {
292
326
  var div = document.createElement('div');
293
327
  div.className = 'lf-minimap-viewport';
294
- div.addEventListener('mousedown', MiniMap.__startDrag);
295
- MiniMap.__viewport = div;
296
- },
297
- __startDrag: function (e) {
298
- document.addEventListener('mousemove', MiniMap.__drag);
299
- document.addEventListener('mouseup', MiniMap.__drop);
300
- MiniMap.__startPosition = {
301
- x: e.x,
302
- y: e.y,
303
- };
304
- },
305
- __drag: function (e) {
306
- var viewStyle = MiniMap.__viewport.style;
307
- MiniMap.__viewPortTop += e.y - MiniMap.__startPosition.y;
308
- MiniMap.__viewPortLeft += e.x - MiniMap.__startPosition.x;
309
- viewStyle.top = MiniMap.__viewPortTop + "px";
310
- viewStyle.left = MiniMap.__viewPortLeft + "px";
311
- MiniMap.__startPosition = {
312
- x: e.x,
313
- y: e.y,
314
- };
315
- var centerX = (MiniMap.__viewPortLeft + MiniMap.__viewPortWidth / 2)
316
- / MiniMap.__viewPortScale;
317
- var centerY = (MiniMap.__viewPortTop + MiniMap.__viewPortHeight / 2)
318
- / MiniMap.__viewPortScale;
319
- MiniMap.__lf.focusOn({
320
- coordinate: {
321
- x: centerX + MiniMap.__resetDataX,
322
- y: centerY + MiniMap.__resetDataY,
323
- },
324
- });
325
- },
326
- __drop: function () {
327
- document.removeEventListener('mousemove', MiniMap.__drag);
328
- document.removeEventListener('mouseup', MiniMap.__drop);
329
- },
330
- };
328
+ div.addEventListener('mousedown', this.__startDrag);
329
+ this.__viewport = div;
330
+ };
331
+ MiniMap.pluginName = 'miniMap';
332
+ return MiniMap;
333
+ }());
331
334
  export default MiniMap;
332
335
  export { MiniMap };
@@ -18,6 +18,14 @@ declare class SelectionSelect {
18
18
  lf: any;
19
19
  });
20
20
  render(lf: any, domContainer: any): void;
21
+ /**
22
+ * 开启选区
23
+ */
24
+ openSelectionSelect(): void;
25
+ /**
26
+ * 关闭选区
27
+ */
28
+ closeSelectionSelect(): void;
21
29
  __draw: (ev: any) => void;
22
30
  __drawOff: () => void;
23
31
  open(): void;
@@ -45,21 +45,10 @@ var SelectionSelect = /** @class */ (function () {
45
45
  var stopMoveGraph = lf.getEditConfig().stopMoveGraph;
46
46
  this.isDefalutStopMoveGraph = stopMoveGraph;
47
47
  lf.openSelectionSelect = function () {
48
- if (!stopMoveGraph) {
49
- _this.isDefalutStopMoveGraph = false;
50
- lf.updateEditConfig({
51
- stopMoveGraph: true,
52
- });
53
- }
54
- _this.open();
48
+ _this.openSelectionSelect();
55
49
  };
56
50
  lf.closeSelectionSelect = function () {
57
- if (!_this.isDefalutStopMoveGraph) {
58
- lf.updateEditConfig({
59
- stopMoveGraph: false,
60
- });
61
- }
62
- _this.close();
51
+ _this.closeSelectionSelect();
63
52
  };
64
53
  }
65
54
  SelectionSelect.prototype.render = function (lf, domContainer) {
@@ -85,13 +74,37 @@ var SelectionSelect = /** @class */ (function () {
85
74
  document.addEventListener('mouseup', _this.__drawOff);
86
75
  });
87
76
  };
77
+ /**
78
+ * 开启选区
79
+ */
80
+ SelectionSelect.prototype.openSelectionSelect = function () {
81
+ var stopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
82
+ if (!stopMoveGraph) {
83
+ this.isDefalutStopMoveGraph = false;
84
+ this.lf.updateEditConfig({
85
+ stopMoveGraph: true,
86
+ });
87
+ }
88
+ this.open();
89
+ };
90
+ /**
91
+ * 关闭选区
92
+ */
93
+ SelectionSelect.prototype.closeSelectionSelect = function () {
94
+ if (!this.isDefalutStopMoveGraph) {
95
+ this.lf.updateEditConfig({
96
+ stopMoveGraph: false,
97
+ });
98
+ }
99
+ this.close();
100
+ };
88
101
  SelectionSelect.prototype.open = function () {
89
102
  this.__disabled = false;
90
103
  };
91
104
  SelectionSelect.prototype.close = function () {
92
105
  this.__disabled = true;
93
106
  };
94
- SelectionSelect.pluginName = 'selection-select';
107
+ SelectionSelect.pluginName = 'selectionSelect';
95
108
  return SelectionSelect;
96
109
  }());
97
110
  export { SelectionSelect };
package/es/index.d.ts CHANGED
@@ -14,3 +14,5 @@ export * from './materials/group';
14
14
  export * from './NodeResize';
15
15
  export * from './tools/flow-path';
16
16
  export * from './tools/auto-layout';
17
+ export * from './bpmn-adapter/xml2json';
18
+ export * from './bpmn-adapter/json2xml';
package/es/index.js CHANGED
@@ -15,3 +15,5 @@ export * from './materials/group';
15
15
  export * from './NodeResize';
16
16
  export * from './tools/flow-path';
17
17
  export * from './tools/auto-layout';
18
+ export * from './bpmn-adapter/xml2json';
19
+ export * from './bpmn-adapter/json2xml';
@@ -20,7 +20,7 @@ var __spread = (this && this.__spread) || function () {
20
20
  };
21
21
  import { isNodeInSegement } from './edge';
22
22
  var InsertNodeInPolyline = {
23
- pluginName: 'insert-node-in-polyline',
23
+ pluginName: 'insertNodeInPolyline',
24
24
  _lf: null,
25
25
  dndAdd: true,
26
26
  dropAdd: true,
@@ -78,7 +78,7 @@ var CurvedEdgeView = /** @class */ (function (_super) {
78
78
  strokeDashArray: strokeDashArray,
79
79
  });
80
80
  };
81
- CurvedEdgeView.extendKey = 'CurvedEdge';
81
+ CurvedEdgeView.extendKey = 'curvedEdge';
82
82
  return CurvedEdgeView;
83
83
  }(PolylineEdge));
84
84
  var CurvedEdgeModel = /** @class */ (function (_super) {
@@ -206,7 +206,7 @@ var FlowPath = /** @class */ (function () {
206
206
  var length = elements.length;
207
207
  return elements.indexOf(elements[length - 1]) !== length - 1 ? 1 : 0;
208
208
  };
209
- FlowPath.pluginName = 'FlowPath';
209
+ FlowPath.pluginName = 'flowPath';
210
210
  return FlowPath;
211
211
  }());
212
212
  export { FlowPath, };
@@ -152,7 +152,7 @@ export function toLogicflowData(data) {
152
152
  return lfData;
153
153
  }
154
154
  var TurboAdapter = {
155
- pluginName: 'TurboAdapter',
155
+ pluginName: 'turboAdapter',
156
156
  install: function (lf) {
157
157
  lf.adapterIn = this.adapterIn;
158
158
  lf.adapterOut = this.adapterOut;