@logicflow/extension 1.0.7 → 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 (61) 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 +1 -1
  4. package/cjs/components/context-menu/index.js +34 -22
  5. package/cjs/components/control/index.js +0 -14
  6. package/cjs/components/dnd-panel/index.js +9 -6
  7. package/cjs/components/menu/index.js +10 -10
  8. package/cjs/components/mini-map/index.js +159 -156
  9. package/cjs/components/selection-select/index.js +27 -14
  10. package/cjs/insert-node-in-polyline/index.js +1 -1
  11. package/cjs/materials/curved-edge/index.js +1 -1
  12. package/cjs/tools/flow-path/index.js +1 -1
  13. package/cjs/turbo-adapter/index.js +1 -1
  14. package/es/NodeResize/index.js +1 -1
  15. package/es/bpmn/index.js +1 -1
  16. package/es/bpmn-adapter/index.js +1 -1
  17. package/es/components/context-menu/index.d.ts +10 -1
  18. package/es/components/context-menu/index.js +34 -22
  19. package/es/components/control/index.d.ts +4 -5
  20. package/es/components/control/index.js +0 -14
  21. package/es/components/dnd-panel/index.d.ts +1 -0
  22. package/es/components/dnd-panel/index.js +9 -6
  23. package/es/components/menu/index.d.ts +2 -2
  24. package/es/components/menu/index.js +10 -10
  25. package/es/components/mini-map/index.d.ts +73 -2
  26. package/es/components/mini-map/index.js +159 -156
  27. package/es/components/selection-select/index.d.ts +8 -0
  28. package/es/components/selection-select/index.js +27 -14
  29. package/es/insert-node-in-polyline/index.js +1 -1
  30. package/es/materials/curved-edge/index.js +1 -1
  31. package/es/tools/flow-path/index.js +1 -1
  32. package/es/turbo-adapter/index.js +1 -1
  33. package/lib/AutoLayout.js +1 -1
  34. package/lib/BpmnAdapter.js +1 -1
  35. package/lib/BpmnElement.js +1 -1
  36. package/lib/ContextMenu.js +1 -1
  37. package/lib/Control.js +1 -1
  38. package/lib/CurvedEdge.js +1 -1
  39. package/lib/DndPanel.js +1 -1
  40. package/lib/FlowPath.js +1 -1
  41. package/lib/Group.js +1 -1
  42. package/lib/InsertNodeInPolyline.js +1 -1
  43. package/lib/Menu.js +1 -1
  44. package/lib/MiniMap.js +1 -1
  45. package/lib/NodeResize.js +1 -1
  46. package/lib/RectLabelNode.js +1 -1
  47. package/lib/SelectionSelect.js +1 -1
  48. package/lib/Snapshot.js +1 -1
  49. package/lib/TurboAdapter.js +1 -1
  50. package/lib/lfJson2Xml.js +1 -1
  51. package/lib/lfXml2Json.js +1 -1
  52. package/package.json +2 -2
  53. package/types/components/context-menu/index.d.ts +10 -1
  54. package/types/components/control/index.d.ts +4 -5
  55. package/types/components/dnd-panel/index.d.ts +1 -0
  56. package/types/components/menu/index.d.ts +2 -2
  57. package/types/components/mini-map/index.d.ts +73 -2
  58. package/types/components/selection-select/index.d.ts +8 -0
  59. package/cjs/curved.js +0 -0
  60. package/es/curved.d.ts +0 -0
  61. package/es/curved.js +0 -0
@@ -8,7 +8,7 @@ exports.EllipseResize = EllipseResize_1.default;
8
8
  var DiamondResize_1 = require("./Node/DiamondResize");
9
9
  exports.DiamondResize = DiamondResize_1.default;
10
10
  var NodeResize = {
11
- pluginName: 'node-resize',
11
+ pluginName: 'nodeResize',
12
12
  // 拖动step
13
13
  step: 0,
14
14
  // 边框和contol拖动点样式的设置
package/cjs/bpmn/index.js CHANGED
@@ -37,7 +37,7 @@ var BpmnElement = /** @class */ (function () {
37
37
  lf.setDefaultEdgeType('bpmn:sequenceFlow');
38
38
  }
39
39
  }
40
- BpmnElement.pluginName = 'BpmnElement';
40
+ BpmnElement.pluginName = 'bpmnElement';
41
41
  return BpmnElement;
42
42
  }());
43
43
  exports.BpmnElement = BpmnElement;
@@ -471,7 +471,7 @@ BpmnAdapter.shapeConfigMap.set(BpmnElements.USER, {
471
471
  height: constant_1.UserTaskConfig.height,
472
472
  });
473
473
  var BpmnXmlAdapter = {
474
- pluginName: 'bpmn-xml-adapter',
474
+ pluginName: 'bpmnXmlAdapter',
475
475
  install: function (lf) {
476
476
  lf.adapterIn = this.adapterXmlIn;
477
477
  lf.adapterOut = this.adapterXmlOut;
@@ -26,29 +26,23 @@ var ContextMenu = /** @class */ (function () {
26
26
  var lf = _a.lf;
27
27
  this.menuTypeMap = new Map();
28
28
  this.listenDelete = function () {
29
- _this.hideMenu();
29
+ _this.hideContextMenu();
30
30
  };
31
31
  this.lf = lf;
32
32
  this.__menuDOM = document.createElement('div');
33
33
  this.__menuDOM.className = 'lf-inner-context';
34
- // const commonMenu = [];
35
34
  this.menuTypeMap.set(COMMON_TYPE_KEY, []);
36
35
  this.lf.setContextMenuByType = function (type, menus) {
37
36
  _this.menuTypeMap.set(type, menus);
38
37
  };
39
38
  this.lf.setContextMenuItems = function (menus) {
40
- _this.menuTypeMap.set(COMMON_TYPE_KEY, menus);
39
+ _this.setContextMenuItems(menus);
41
40
  };
42
41
  this.lf.showContextMenu = function (data) {
43
- if (!data || !data.id) {
44
- console.warn('请检查传入的参数');
45
- return;
46
- }
47
- _this._activeData = data;
48
- _this.createContextMenu();
42
+ _this.showContextMenu(data);
49
43
  };
50
44
  this.lf.hideContextMenu = function () {
51
- _this.hideMenu();
45
+ _this.hideContextMenu();
52
46
  };
53
47
  }
54
48
  ContextMenu.prototype.render = function (lf, container) {
@@ -66,9 +60,36 @@ var ContextMenu = /** @class */ (function () {
66
60
  _this.createContextMenu();
67
61
  });
68
62
  lf.on('blank:click', function () {
69
- _this.hideMenu();
63
+ _this.hideContextMenu();
70
64
  });
71
65
  };
66
+ /**
67
+ * 隐藏菜单
68
+ */
69
+ ContextMenu.prototype.hideContextMenu = function () {
70
+ this.__menuDOM.innerHTML = '';
71
+ this.__menuDOM.style.display = 'none';
72
+ if (this.isShow) {
73
+ this.container.removeChild(this.__menuDOM);
74
+ }
75
+ this.lf.off('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
76
+ this.isShow = false;
77
+ };
78
+ /**
79
+ * 显示指定元素菜单
80
+ * @param data 节点id、节点类型、菜单位置
81
+ */
82
+ ContextMenu.prototype.showContextMenu = function (data) {
83
+ if (!data || !data.id) {
84
+ console.warn('请检查传入的参数');
85
+ return;
86
+ }
87
+ this._activeData = data;
88
+ this.createContextMenu();
89
+ };
90
+ ContextMenu.prototype.setContextMenuItems = function (menus) {
91
+ this.menuTypeMap.set(COMMON_TYPE_KEY, menus);
92
+ };
72
93
  /**
73
94
  * 获取新菜单位置
74
95
  */
@@ -122,7 +143,7 @@ var ContextMenu = /** @class */ (function () {
122
143
  menuItem.className = menuItem.className + " " + item.className;
123
144
  }
124
145
  img.addEventListener('click', function () {
125
- _this.hideMenu();
146
+ _this.hideContextMenu();
126
147
  if (item.callback) {
127
148
  item.callback(_this._activeData);
128
149
  }
@@ -194,16 +215,7 @@ var ContextMenu = /** @class */ (function () {
194
215
  !this.isShow && this.lf.on('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
195
216
  this.isShow = true;
196
217
  };
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';
218
+ ContextMenu.pluginName = 'contextMenu';
207
219
  return ContextMenu;
208
220
  }());
209
221
  exports.ContextMenu = ContextMenu;
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __read = (this && this.__read) || function (o, n) {
14
3
  var m = typeof Symbol === "function" && o[Symbol.iterator];
15
4
  if (!m) return o;
@@ -34,10 +23,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
34
23
  exports.Control = void 0;
35
24
  var Control = /** @class */ (function () {
36
25
  function Control(_a) {
37
- var _b;
38
26
  var _this = this;
39
27
  var lf = _a.lf;
40
- var _c;
41
28
  this.controlItems = [
42
29
  {
43
30
  key: 'zoom-out',
@@ -86,7 +73,6 @@ var Control = /** @class */ (function () {
86
73
  },
87
74
  ];
88
75
  this.lf = lf;
89
- this.lf.extension = __assign(__assign({}, ((_c = this.lf.extension) !== null && _c !== void 0 ? _c : {})), (_b = {}, _b[Control.pluginName] = this, _b));
90
76
  }
91
77
  Control.prototype.render = function (lf, domContainer) {
92
78
  this.destroy();
@@ -7,11 +7,7 @@ var DndPanel = /** @class */ (function () {
7
7
  var lf = _a.lf;
8
8
  this.lf = lf;
9
9
  this.lf.setPatternItems = function (shapeList) {
10
- _this.shapeList = shapeList;
11
- // 支持渲染后重新设置拖拽面板
12
- if (_this.domContainer) {
13
- _this.render(_this.lf, _this.domContainer);
14
- }
10
+ _this.setPatternItems(shapeList);
15
11
  };
16
12
  }
17
13
  DndPanel.prototype.render = function (lf, domContainer) {
@@ -35,6 +31,13 @@ var DndPanel = /** @class */ (function () {
35
31
  this.domContainer.removeChild(this.panelEl);
36
32
  }
37
33
  };
34
+ DndPanel.prototype.setPatternItems = function (shapeList) {
35
+ this.shapeList = shapeList;
36
+ // 支持渲染后重新设置拖拽面板
37
+ if (this.domContainer) {
38
+ this.render(this.lf, this.domContainer);
39
+ }
40
+ };
38
41
  DndPanel.prototype.createDndItem = function (shapeItem) {
39
42
  var _this = this;
40
43
  var el = document.createElement('div');
@@ -65,7 +68,7 @@ var DndPanel = /** @class */ (function () {
65
68
  };
66
69
  return el;
67
70
  };
68
- DndPanel.pluginName = 'DndPanel';
71
+ DndPanel.pluginName = 'dndPanel';
69
72
  return DndPanel;
70
73
  }());
71
74
  exports.DndPanel = DndPanel;
@@ -33,13 +33,13 @@ var Menu = /** @class */ (function () {
33
33
  this.lf = lf;
34
34
  this.menuTypeMap = new Map();
35
35
  this.init();
36
- this.lf.setMenuConfig = function (config) {
37
- _this.resetMenuItem(config);
36
+ this.lf.extension.menu.setMenuConfig = function (config) {
37
+ _this.setMenuConfig(config);
38
38
  };
39
- this.lf.addMenuConfig = function (config) {
40
- _this.addMenuItem(config);
39
+ this.lf.extension.menu.addMenuConfig = function (config) {
40
+ _this.addMenuConfig(config);
41
41
  };
42
- this.lf.setMenuByType = function (config) {
42
+ this.lf.extension.menu.setMenuByType = function (config) {
43
43
  _this.setMenuByType(config);
44
44
  };
45
45
  }
@@ -250,7 +250,7 @@ var Menu = /** @class */ (function () {
250
250
  return menuList;
251
251
  };
252
252
  // 复写菜单
253
- Menu.prototype.resetMenuItem = function (config) {
253
+ Menu.prototype.setMenuConfig = function (config) {
254
254
  if (!config) {
255
255
  return;
256
256
  }
@@ -265,7 +265,7 @@ var Menu = /** @class */ (function () {
265
265
  && this.menuTypeMap.set(DefalutGraphMenuKey, config.graphMenu ? config.graphMenu : []);
266
266
  };
267
267
  // 在默认菜单后面追加菜单项
268
- Menu.prototype.addMenuItem = function (config) {
268
+ Menu.prototype.addMenuConfig = function (config) {
269
269
  if (!config) {
270
270
  return;
271
271
  }
@@ -289,14 +289,14 @@ var Menu = /** @class */ (function () {
289
289
  */
290
290
  Menu.prototype.changeMenuItem = function (type, config) {
291
291
  if (type === 'add')
292
- this.addMenuItem(config);
292
+ this.addMenuConfig(config);
293
293
  else if (type === 'reset')
294
- this.resetMenuItem(config);
294
+ this.setMenuConfig(config);
295
295
  else {
296
296
  throw new Error('The first parameter of changeMenuConfig should be \'add\' or \'reset\'');
297
297
  }
298
298
  };
299
- Menu.pluginName = 'Menu';
299
+ Menu.pluginName = 'menu';
300
300
  return Menu;
301
301
  }());
302
302
  exports.Menu = Menu;