@logicflow/extension 1.0.7 → 1.1.0-alpha.3

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 (87) hide show
  1. package/cjs/NodeResize/Control/Control.js +2 -1
  2. package/cjs/NodeResize/Control/Util.js +1 -0
  3. package/cjs/NodeResize/Node/EllipseResize.js +1 -17
  4. package/cjs/NodeResize/Node/HtmlResize.js +72 -0
  5. package/cjs/NodeResize/index.js +7 -1
  6. package/cjs/bpmn/index.js +1 -1
  7. package/cjs/bpmn-adapter/index.js +1 -1
  8. package/cjs/components/context-menu/index.js +38 -23
  9. package/cjs/components/control/index.js +0 -14
  10. package/cjs/components/dnd-panel/index.js +9 -6
  11. package/cjs/components/menu/index.js +7 -7
  12. package/cjs/components/mini-map/index.js +159 -156
  13. package/cjs/components/selection-select/index.js +27 -14
  14. package/cjs/insert-node-in-polyline/index.js +1 -1
  15. package/cjs/materials/curved-edge/index.js +1 -1
  16. package/cjs/materials/group/GroupNode.js +66 -20
  17. package/cjs/materials/group/index.js +28 -9
  18. package/cjs/style/index.css +3 -2
  19. package/cjs/tools/flow-path/index.js +1 -1
  20. package/cjs/turbo-adapter/index.js +1 -1
  21. package/es/NodeResize/Control/Control.js +2 -1
  22. package/es/NodeResize/Control/Util.d.ts +1 -0
  23. package/es/NodeResize/Control/Util.js +1 -0
  24. package/es/NodeResize/Node/EllipseResize.js +1 -17
  25. package/es/NodeResize/Node/HtmlResize.d.ts +20 -0
  26. package/es/NodeResize/Node/HtmlResize.js +70 -0
  27. package/es/NodeResize/index.js +7 -1
  28. package/es/bpmn/index.js +1 -1
  29. package/es/bpmn-adapter/index.js +1 -1
  30. package/es/components/context-menu/index.d.ts +11 -1
  31. package/es/components/context-menu/index.js +38 -23
  32. package/es/components/control/index.d.ts +4 -5
  33. package/es/components/control/index.js +0 -14
  34. package/es/components/dnd-panel/index.d.ts +1 -0
  35. package/es/components/dnd-panel/index.js +9 -6
  36. package/es/components/menu/index.d.ts +2 -2
  37. package/es/components/menu/index.js +7 -7
  38. package/es/components/mini-map/index.d.ts +73 -2
  39. package/es/components/mini-map/index.js +159 -156
  40. package/es/components/selection-select/index.d.ts +8 -0
  41. package/es/components/selection-select/index.js +27 -14
  42. package/es/insert-node-in-polyline/index.js +1 -1
  43. package/es/materials/curved-edge/index.js +1 -1
  44. package/es/materials/group/GroupNode.d.ts +24 -9
  45. package/es/materials/group/GroupNode.js +67 -21
  46. package/es/materials/group/index.d.ts +3 -1
  47. package/es/materials/group/index.js +27 -9
  48. package/es/style/index.css +3 -2
  49. package/es/tools/flow-path/index.js +1 -1
  50. package/es/turbo-adapter/index.js +1 -1
  51. package/lib/AutoLayout.js +1 -1
  52. package/lib/BpmnAdapter.js +1 -1
  53. package/lib/BpmnElement.js +1 -1
  54. package/lib/ContextMenu.js +1 -1
  55. package/lib/Control.js +1 -1
  56. package/lib/CurvedEdge.js +1 -1
  57. package/lib/DndPanel.js +1 -1
  58. package/lib/FlowPath.js +1 -1
  59. package/lib/Group.js +1 -1
  60. package/lib/InsertNodeInPolyline.js +1 -1
  61. package/lib/Menu.js +1 -1
  62. package/lib/MiniMap.js +1 -1
  63. package/lib/NodeResize.js +1 -1
  64. package/lib/RectLabelNode.js +1 -1
  65. package/lib/SelectionSelect.js +1 -1
  66. package/lib/Snapshot.js +1 -1
  67. package/lib/TurboAdapter.js +1 -1
  68. package/lib/lfJson2Xml.js +1 -1
  69. package/lib/lfXml2Json.js +1 -1
  70. package/lib/style/index.css +3 -2
  71. package/package.json +2 -2
  72. package/types/NodeResize/Control/Util.d.ts +1 -0
  73. package/types/NodeResize/Node/HtmlResize.d.ts +20 -0
  74. package/types/components/context-menu/index.d.ts +11 -1
  75. package/types/components/control/index.d.ts +4 -5
  76. package/types/components/dnd-panel/index.d.ts +1 -0
  77. package/types/components/menu/index.d.ts +2 -2
  78. package/types/components/mini-map/index.d.ts +73 -2
  79. package/types/components/selection-select/index.d.ts +8 -0
  80. package/types/materials/group/GroupNode.d.ts +24 -9
  81. package/types/materials/group/index.d.ts +3 -1
  82. package/cjs/NodeResize/BasicShape/Ellipse.js +0 -21
  83. package/cjs/curved.js +0 -0
  84. package/es/NodeResize/BasicShape/Ellipse.d.ts +0 -2
  85. package/es/NodeResize/BasicShape/Ellipse.js +0 -18
  86. package/es/curved.d.ts +0 -0
  87. package/es/curved.js +0 -0
@@ -20,13 +20,26 @@ var __spread = (this && this.__spread) || function () {
20
20
  return ar;
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.Group = void 0;
23
+ exports.GroupNode = exports.Group = void 0;
24
24
  var GroupNode_1 = require("./GroupNode");
25
+ exports.GroupNode = GroupNode_1.default;
25
26
  var Group = /** @class */ (function () {
26
27
  function Group(_a) {
27
28
  var _this = this;
28
29
  var lf = _a.lf;
29
30
  this.nodeGroupMap = new Map();
31
+ this.graphRendered = function (data) {
32
+ // 如果节点
33
+ if (data && data.nodes) {
34
+ data.nodes.forEach(function (node) {
35
+ if (node.children) {
36
+ node.children.forEach(function (nodeId) {
37
+ _this.nodeGroupMap.set(nodeId, node.id);
38
+ });
39
+ }
40
+ });
41
+ }
42
+ };
30
43
  this.appendNodeToGrop = function (_a) {
31
44
  var data = _a.data;
32
45
  // 如果这个节点之前已经在group中了,则将其从之前的group中移除
@@ -48,14 +61,19 @@ var Group = /** @class */ (function () {
48
61
  };
49
62
  this.setActiveGroup = function (_a) {
50
63
  var data = _a.data;
51
- if (_this.activeGroup) {
52
- _this.activeGroup.setAllowAppendChild(false);
53
- _this.activeGroup = undefined;
54
- }
55
- var bounds = _this.lf.getNodeModelById(data.id).getBounds();
56
- _this.activeGroup = _this.getGroup(bounds);
57
- if (_this.activeGroup && _this.activeGroup.id !== data.id) {
58
- _this.activeGroup.setAllowAppendChild(true);
64
+ var nodeModel = _this.lf.getNodeModelById(data.id);
65
+ if (nodeModel.isGroup)
66
+ return;
67
+ var bounds = nodeModel.getBounds();
68
+ var newGroup = _this.getGroup(bounds);
69
+ if (newGroup || newGroup !== _this.activeGroup) {
70
+ if (_this.activeGroup) {
71
+ _this.activeGroup.setAllowAppendChild(false);
72
+ }
73
+ if (newGroup) {
74
+ _this.activeGroup = newGroup;
75
+ _this.activeGroup.setAllowAppendChild(true);
76
+ }
59
77
  }
60
78
  };
61
79
  lf.register(GroupNode_1.default);
@@ -82,6 +100,7 @@ var Group = /** @class */ (function () {
82
100
  lf.on('node:drop', this.appendNodeToGrop);
83
101
  lf.on('node:dnd-move', this.setActiveGroup);
84
102
  lf.on('node:drag', this.setActiveGroup);
103
+ lf.on('graph:rendered', this.graphRendered);
85
104
  }
86
105
  Group.prototype.getGroups = function () {
87
106
  var groups = [];
@@ -22,8 +22,9 @@
22
22
  background: #efefef;
23
23
  }
24
24
  .lf-control-item.disabled {
25
- filter: opacity(0.6);
26
- cursor: not-allowed;
25
+ filter: opacity(0.5);
26
+ /* cursor: not-allowed; */
27
+ pointer-events: none;
27
28
  }
28
29
  .lf-control-item.disabled:hover {
29
30
  background: #fff;
@@ -209,7 +209,7 @@ var FlowPath = /** @class */ (function () {
209
209
  var length = elements.length;
210
210
  return elements.indexOf(elements[length - 1]) !== length - 1 ? 1 : 0;
211
211
  };
212
- FlowPath.pluginName = 'FlowPath';
212
+ FlowPath.pluginName = 'flowPath';
213
213
  return FlowPath;
214
214
  }());
215
215
  exports.FlowPath = FlowPath;
@@ -157,7 +157,7 @@ function toLogicflowData(data) {
157
157
  }
158
158
  exports.toLogicflowData = toLogicflowData;
159
159
  var TurboAdapter = {
160
- pluginName: 'TurboAdapter',
160
+ pluginName: 'turboAdapter',
161
161
  install: function (lf) {
162
162
  lf.adapterIn = this.adapterIn;
163
163
  lf.adapterOut = this.adapterOut;
@@ -268,7 +268,8 @@ var Control = /** @class */ (function (_super) {
268
268
  _this.onDraging = function (_a) {
269
269
  var deltaX = _a.deltaX, deltaY = _a.deltaY;
270
270
  var modelType = _this.nodeModel.modelType;
271
- if (modelType === ModelType.RECT_NODE) {
271
+ // html和矩形的计算方式是一样的,共用一个方法
272
+ if (modelType === ModelType.RECT_NODE || modelType === ModelType.HTML_NODE) {
272
273
  _this.updateRect({ deltaX: deltaX, deltaY: deltaY });
273
274
  }
274
275
  else if (modelType === ModelType.ELLIPSE_NODE) {
@@ -3,6 +3,7 @@ export declare enum ModelType {
3
3
  CIRCLE_NODE = "circle-node",
4
4
  POLYGON_NODE = "polygon-node",
5
5
  RECT_NODE = "rect-node",
6
+ HTML_NODE = "html-node",
6
7
  TEXT_NODE = "text-node",
7
8
  ELLIPSE_NODE = "ellipse-node",
8
9
  DIAMOND_NODE = "diamond-node",
@@ -4,6 +4,7 @@ export var ModelType;
4
4
  ModelType["CIRCLE_NODE"] = "circle-node";
5
5
  ModelType["POLYGON_NODE"] = "polygon-node";
6
6
  ModelType["RECT_NODE"] = "rect-node";
7
+ ModelType["HTML_NODE"] = "html-node";
7
8
  ModelType["TEXT_NODE"] = "text-node";
8
9
  ModelType["ELLIPSE_NODE"] = "ellipse-node";
9
10
  ModelType["DIAMOND_NODE"] = "diamond-node";
@@ -11,20 +11,8 @@ var __extends = (this && this.__extends) || (function () {
11
11
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
12
  };
13
13
  })();
14
- var __assign = (this && this.__assign) || function () {
15
- __assign = Object.assign || function(t) {
16
- for (var s, i = 1, n = arguments.length; i < n; i++) {
17
- s = arguments[i];
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
- t[p] = s[p];
20
- }
21
- return t;
22
- };
23
- return __assign.apply(this, arguments);
24
- };
25
14
  import { h, EllipseNode, EllipseNodeModel } from '@logicflow/core';
26
15
  import ControlGroup from '../Control/ControlGroup';
27
- import Ellipse from '../BasicShape/Ellipse';
28
16
  var EllipseResizeModel = /** @class */ (function (_super) {
29
17
  __extends(EllipseResizeModel, _super);
30
18
  function EllipseResizeModel(data, graphModel) {
@@ -66,11 +54,7 @@ var EllipseResizeView = /** @class */ (function (_super) {
66
54
  };
67
55
  // getResizeShape绘制图形,功能等同于基础椭圆的getShape功能,可以通过复写此方法,进行节点自定义
68
56
  EllipseResizeView.prototype.getResizeShape = function () {
69
- var model = this.props.model;
70
- var rx = model.rx, ry = model.ry, x = model.x, y = model.y;
71
- var style = model.getNodeStyle();
72
- return (h("g", null,
73
- h(Ellipse, __assign({}, style, { rx: rx, ry: ry, x: x, y: y }))));
57
+ return _super.prototype.getShape.call(this);
74
58
  };
75
59
  EllipseResizeView.prototype.getShape = function () {
76
60
  var model = this.props.model;
@@ -0,0 +1,20 @@
1
+ import { h, HtmlNode, HtmlNodeModel } from '@logicflow/core';
2
+ declare class HtmlResizeModel extends HtmlNodeModel {
3
+ minWidth: number;
4
+ minHeight: number;
5
+ maxWidth: number;
6
+ maxHeight: number;
7
+ getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
8
+ setAttributes(): void;
9
+ }
10
+ declare class HtmlResizeView extends HtmlNode {
11
+ getControlGroup(): h.JSX.Element;
12
+ getResizeShape(): h.JSX.Element;
13
+ getShape(): h.JSX.Element;
14
+ }
15
+ declare const HtmlResize: {
16
+ type: string;
17
+ view: typeof HtmlResizeView;
18
+ model: typeof HtmlResizeModel;
19
+ };
20
+ export default HtmlResize;
@@ -0,0 +1,70 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import { h, HtmlNode, HtmlNodeModel } from '@logicflow/core';
15
+ import ControlGroup from '../Control/ControlGroup';
16
+ var HtmlResizeModel = /** @class */ (function (_super) {
17
+ __extends(HtmlResizeModel, _super);
18
+ function HtmlResizeModel() {
19
+ var _this = _super !== null && _super.apply(this, arguments) || this;
20
+ _this.minWidth = 30;
21
+ _this.minHeight = 30;
22
+ _this.maxWidth = 2000;
23
+ _this.maxHeight = 2000;
24
+ return _this;
25
+ }
26
+ HtmlResizeModel.prototype.getOutlineStyle = function () {
27
+ var style = _super.prototype.getOutlineStyle.call(this);
28
+ style.stroke = 'none';
29
+ if (style.hover) {
30
+ style.hover.stroke = 'none';
31
+ }
32
+ return style;
33
+ };
34
+ HtmlResizeModel.prototype.setAttributes = function () {
35
+ // @ts-ignore
36
+ var nodeSize = this.properties.nodeSize;
37
+ if (nodeSize) {
38
+ this.width = nodeSize.width;
39
+ this.height = nodeSize.height;
40
+ }
41
+ };
42
+ return HtmlResizeModel;
43
+ }(HtmlNodeModel));
44
+ var HtmlResizeView = /** @class */ (function (_super) {
45
+ __extends(HtmlResizeView, _super);
46
+ function HtmlResizeView() {
47
+ return _super !== null && _super.apply(this, arguments) || this;
48
+ }
49
+ HtmlResizeView.prototype.getControlGroup = function () {
50
+ var _a = this.props, model = _a.model, graphModel = _a.graphModel;
51
+ return (h(ControlGroup, { model: model, graphModel: graphModel }));
52
+ };
53
+ // getResizeShape绘制图形,功能等同于基础矩形的getShape功能,可以通过复写此方法,进行节点自定义
54
+ HtmlResizeView.prototype.getResizeShape = function () {
55
+ return _super.prototype.getShape.call(this);
56
+ };
57
+ HtmlResizeView.prototype.getShape = function () {
58
+ var isSelected = this.props.model.isSelected;
59
+ return (h("g", null,
60
+ this.getResizeShape(),
61
+ isSelected ? this.getControlGroup() : ''));
62
+ };
63
+ return HtmlResizeView;
64
+ }(HtmlNode));
65
+ var HtmlResize = {
66
+ type: 'html',
67
+ view: HtmlResizeView,
68
+ model: HtmlResizeModel,
69
+ };
70
+ export default HtmlResize;
@@ -1,8 +1,9 @@
1
1
  import RectResize from './Node/RectResize';
2
2
  import EllipseResize from './Node/EllipseResize';
3
3
  import DiamondResize from './Node/DiamondResize';
4
+ import HtmlResize from './Node/HtmlResize';
4
5
  var NodeResize = {
5
- pluginName: 'node-resize',
6
+ pluginName: 'nodeResize',
6
7
  // 拖动step
7
8
  step: 0,
8
9
  // 边框和contol拖动点样式的设置
@@ -56,6 +57,11 @@ var NodeResize = {
56
57
  view: DiamondResize.view,
57
58
  model: DiamondResize.model,
58
59
  });
60
+ lf.register({
61
+ type: HtmlResize.type,
62
+ view: HtmlResize.view,
63
+ model: HtmlResize.model,
64
+ });
59
65
  },
60
66
  };
61
67
  export default NodeResize;
package/es/bpmn/index.js CHANGED
@@ -22,7 +22,7 @@ var BpmnElement = /** @class */ (function () {
22
22
  lf.setDefaultEdgeType('bpmn:sequenceFlow');
23
23
  }
24
24
  }
25
- BpmnElement.pluginName = 'BpmnElement';
25
+ BpmnElement.pluginName = 'bpmnElement';
26
26
  return BpmnElement;
27
27
  }());
28
28
  export { BpmnElement, StartEventModel, StartEventView, EndEventView, EndEventModel, ExclusiveGatewayView, ExclusiveGatewayModel, UserTaskView, UserTaskModel, ServiceTaskView, ServiceTaskModel, SequenceFlowView, SequenceFlowModel, };
@@ -467,7 +467,7 @@ BpmnAdapter.shapeConfigMap.set(BpmnElements.USER, {
467
467
  height: UserTaskConfig.height,
468
468
  });
469
469
  var BpmnXmlAdapter = {
470
- pluginName: 'bpmn-xml-adapter',
470
+ pluginName: 'bpmnXmlAdapter',
471
471
  install: function (lf) {
472
472
  lf.adapterIn = this.adapterXmlIn;
473
473
  lf.adapterOut = this.adapterXmlOut;
@@ -10,6 +10,17 @@ declare class ContextMenu {
10
10
  lf: any;
11
11
  });
12
12
  render(lf: any, container: any): void;
13
+ setContextMenuByType(type: any, menus: any): void;
14
+ /**
15
+ * 隐藏菜单
16
+ */
17
+ hideContextMenu(): void;
18
+ /**
19
+ * 显示指定元素菜单
20
+ * @param data 节点id、节点类型、菜单位置
21
+ */
22
+ showContextMenu(data: any): void;
23
+ setContextMenuItems(menus: any): void;
13
24
  /**
14
25
  * 获取新菜单位置
15
26
  */
@@ -18,7 +29,6 @@ declare class ContextMenu {
18
29
  private addNode;
19
30
  private showMenu;
20
31
  listenDelete: () => void;
21
- private hideMenu;
22
32
  }
23
33
  export default ContextMenu;
24
34
  export { ContextMenu, };
@@ -23,29 +23,23 @@ var ContextMenu = /** @class */ (function () {
23
23
  var lf = _a.lf;
24
24
  this.menuTypeMap = new Map();
25
25
  this.listenDelete = function () {
26
- _this.hideMenu();
26
+ _this.hideContextMenu();
27
27
  };
28
28
  this.lf = lf;
29
29
  this.__menuDOM = document.createElement('div');
30
30
  this.__menuDOM.className = 'lf-inner-context';
31
- // const commonMenu = [];
32
31
  this.menuTypeMap.set(COMMON_TYPE_KEY, []);
33
32
  this.lf.setContextMenuByType = function (type, menus) {
34
- _this.menuTypeMap.set(type, menus);
33
+ _this.setContextMenuByType(type, menus);
35
34
  };
36
35
  this.lf.setContextMenuItems = function (menus) {
37
- _this.menuTypeMap.set(COMMON_TYPE_KEY, menus);
36
+ _this.setContextMenuItems(menus);
38
37
  };
39
38
  this.lf.showContextMenu = function (data) {
40
- if (!data || !data.id) {
41
- console.warn('请检查传入的参数');
42
- return;
43
- }
44
- _this._activeData = data;
45
- _this.createContextMenu();
39
+ _this.showContextMenu(data);
46
40
  };
47
41
  this.lf.hideContextMenu = function () {
48
- _this.hideMenu();
42
+ _this.hideContextMenu();
49
43
  };
50
44
  }
51
45
  ContextMenu.prototype.render = function (lf, container) {
@@ -63,9 +57,39 @@ var ContextMenu = /** @class */ (function () {
63
57
  _this.createContextMenu();
64
58
  });
65
59
  lf.on('blank:click', function () {
66
- _this.hideMenu();
60
+ _this.hideContextMenu();
67
61
  });
68
62
  };
63
+ ContextMenu.prototype.setContextMenuByType = function (type, menus) {
64
+ this.menuTypeMap.set(type, menus);
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
+ };
69
93
  /**
70
94
  * 获取新菜单位置
71
95
  */
@@ -119,7 +143,7 @@ var ContextMenu = /** @class */ (function () {
119
143
  menuItem.className = menuItem.className + " " + item.className;
120
144
  }
121
145
  img.addEventListener('click', function () {
122
- _this.hideMenu();
146
+ _this.hideContextMenu();
123
147
  if (item.callback) {
124
148
  item.callback(_this._activeData);
125
149
  }
@@ -191,16 +215,7 @@ var ContextMenu = /** @class */ (function () {
191
215
  !this.isShow && this.lf.on('node:delete,edge:delete,node:drag,graph:transform', this.listenDelete);
192
216
  this.isShow = true;
193
217
  };
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';
218
+ ContextMenu.pluginName = 'contextMenu';
204
219
  return ContextMenu;
205
220
  }());
206
221
  export default ContextMenu;
@@ -1,4 +1,3 @@
1
- import LogicFlow from '@logicflow/core';
2
1
  declare type ControlItem = {
3
2
  key: string;
4
3
  iconClass: string;
@@ -9,11 +8,11 @@ declare type ControlItem = {
9
8
  onMouseLeave?: Function;
10
9
  };
11
10
  declare class Control {
12
- lf: LogicFlow;
11
+ private lf;
13
12
  static pluginName: string;
14
- controlItems: ControlItem[];
15
- domContainer: HTMLElement;
16
- toolEl: HTMLElement;
13
+ private controlItems;
14
+ private domContainer;
15
+ private toolEl;
17
16
  constructor({ lf }: {
18
17
  lf: any;
19
18
  });
@@ -1,14 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  var __read = (this && this.__read) || function (o, n) {
13
2
  var m = typeof Symbol === "function" && o[Symbol.iterator];
14
3
  if (!m) return o;
@@ -31,10 +20,8 @@ var __spread = (this && this.__spread) || function () {
31
20
  };
32
21
  var Control = /** @class */ (function () {
33
22
  function Control(_a) {
34
- var _b;
35
23
  var _this = this;
36
24
  var lf = _a.lf;
37
- var _c;
38
25
  this.controlItems = [
39
26
  {
40
27
  key: 'zoom-out',
@@ -83,7 +70,6 @@ var Control = /** @class */ (function () {
83
70
  },
84
71
  ];
85
72
  this.lf = lf;
86
- this.lf.extension = __assign(__assign({}, ((_c = this.lf.extension) !== null && _c !== void 0 ? _c : {})), (_b = {}, _b[Control.pluginName] = this, _b));
87
73
  }
88
74
  Control.prototype.render = function (lf, domContainer) {
89
75
  this.destroy();
@@ -19,6 +19,7 @@ declare class DndPanel {
19
19
  });
20
20
  render(lf: any, domContainer: any): void;
21
21
  destroy(): void;
22
+ setPatternItems(shapeList: any): void;
22
23
  private createDndItem;
23
24
  }
24
25
  export { DndPanel, };
@@ -4,11 +4,7 @@ var DndPanel = /** @class */ (function () {
4
4
  var lf = _a.lf;
5
5
  this.lf = lf;
6
6
  this.lf.setPatternItems = function (shapeList) {
7
- _this.shapeList = shapeList;
8
- // 支持渲染后重新设置拖拽面板
9
- if (_this.domContainer) {
10
- _this.render(_this.lf, _this.domContainer);
11
- }
7
+ _this.setPatternItems(shapeList);
12
8
  };
13
9
  }
14
10
  DndPanel.prototype.render = function (lf, domContainer) {
@@ -32,6 +28,13 @@ var DndPanel = /** @class */ (function () {
32
28
  this.domContainer.removeChild(this.panelEl);
33
29
  }
34
30
  };
31
+ DndPanel.prototype.setPatternItems = function (shapeList) {
32
+ this.shapeList = shapeList;
33
+ // 支持渲染后重新设置拖拽面板
34
+ if (this.domContainer) {
35
+ this.render(this.lf, this.domContainer);
36
+ }
37
+ };
35
38
  DndPanel.prototype.createDndItem = function (shapeItem) {
36
39
  var _this = this;
37
40
  var el = document.createElement('div');
@@ -62,7 +65,7 @@ var DndPanel = /** @class */ (function () {
62
65
  };
63
66
  return el;
64
67
  };
65
- DndPanel.pluginName = 'DndPanel';
68
+ DndPanel.pluginName = 'dndPanel';
66
69
  return DndPanel;
67
70
  }());
68
71
  export { DndPanel, };
@@ -38,8 +38,8 @@ declare class Menu {
38
38
  * @return 菜单项 DOM
39
39
  */
40
40
  private __getMenuDom;
41
- private resetMenuItem;
42
- private addMenuItem;
41
+ setMenuConfig(config: MenuConfig): void;
42
+ addMenuConfig(config: MenuConfig): void;
43
43
  /**
44
44
  * @deprecated
45
45
  * 复写添加
@@ -31,10 +31,10 @@ var Menu = /** @class */ (function () {
31
31
  this.menuTypeMap = new Map();
32
32
  this.init();
33
33
  this.lf.setMenuConfig = function (config) {
34
- _this.resetMenuItem(config);
34
+ _this.setMenuConfig(config);
35
35
  };
36
36
  this.lf.addMenuConfig = function (config) {
37
- _this.addMenuItem(config);
37
+ _this.addMenuConfig(config);
38
38
  };
39
39
  this.lf.setMenuByType = function (config) {
40
40
  _this.setMenuByType(config);
@@ -247,7 +247,7 @@ var Menu = /** @class */ (function () {
247
247
  return menuList;
248
248
  };
249
249
  // 复写菜单
250
- Menu.prototype.resetMenuItem = function (config) {
250
+ Menu.prototype.setMenuConfig = function (config) {
251
251
  if (!config) {
252
252
  return;
253
253
  }
@@ -262,7 +262,7 @@ var Menu = /** @class */ (function () {
262
262
  && this.menuTypeMap.set(DefalutGraphMenuKey, config.graphMenu ? config.graphMenu : []);
263
263
  };
264
264
  // 在默认菜单后面追加菜单项
265
- Menu.prototype.addMenuItem = function (config) {
265
+ Menu.prototype.addMenuConfig = function (config) {
266
266
  if (!config) {
267
267
  return;
268
268
  }
@@ -286,14 +286,14 @@ var Menu = /** @class */ (function () {
286
286
  */
287
287
  Menu.prototype.changeMenuItem = function (type, config) {
288
288
  if (type === 'add')
289
- this.addMenuItem(config);
289
+ this.addMenuConfig(config);
290
290
  else if (type === 'reset')
291
- this.resetMenuItem(config);
291
+ this.setMenuConfig(config);
292
292
  else {
293
293
  throw new Error('The first parameter of changeMenuConfig should be \'add\' or \'reset\'');
294
294
  }
295
295
  };
296
- Menu.pluginName = 'Menu';
296
+ Menu.pluginName = 'menu';
297
297
  return Menu;
298
298
  }());
299
299
  export default Menu;
@@ -1,4 +1,75 @@
1
- import { Extension } from '@logicflow/core';
2
- declare const MiniMap: Extension;
1
+ declare class MiniMap {
2
+ static pluginName: string;
3
+ __lf: any;
4
+ __container: any;
5
+ __miniMapWrap: any;
6
+ __miniMapContainer: any;
7
+ __lfMap: any;
8
+ __viewport: any;
9
+ __width: number;
10
+ __height: number;
11
+ __miniMapWidth: number;
12
+ __miniMapHeight: number;
13
+ __viewPortTop: number;
14
+ __viewPortLeft: number;
15
+ __startPosition: any;
16
+ __viewPortScale: number;
17
+ __viewPortWidth: number;
18
+ __viewPortHeight: number;
19
+ __resetDataX: number;
20
+ __resetDataY: number;
21
+ __LogicFlow: any;
22
+ __isShow: boolean;
23
+ __disabledPlugins: string[];
24
+ constructor({ lf, LogicFlow }: {
25
+ lf: any;
26
+ LogicFlow: any;
27
+ });
28
+ render(lf: any, container: any): void;
29
+ init(option: any): void;
30
+ /**
31
+ * 显示mini map
32
+ */
33
+ show: (leftPosition: any, topPosition: any) => void;
34
+ /**
35
+ * 隐藏mini map
36
+ */
37
+ hide: () => void;
38
+ __init(): void;
39
+ __createMiniMap(left: any, top: any): void;
40
+ __removeMiniMap(): void;
41
+ /**
42
+ * 计算所有图形一起,占领的区域范围。
43
+ * @param data
44
+ */
45
+ __getBounds(data: any): {
46
+ left: number;
47
+ top: number;
48
+ bottom: number;
49
+ right: number;
50
+ };
51
+ /**
52
+ * 将负值的平移转换为正值。
53
+ * 保证渲染的时候,minimap能完全展示。
54
+ * 获取将画布所有元素平移到0,0开始时,所有节点数据
55
+ */
56
+ __resetData(data: any): any;
57
+ /**
58
+ * 显示导航
59
+ * 显示视口范围
60
+ * 1. 基于画布的范围比例,设置视口范围比例。宽度默认为导航宽度。
61
+ */
62
+ __setView(): void;
63
+ __setViewPort(scale: any, { left, right, top, bottom }: {
64
+ left: any;
65
+ right: any;
66
+ top: any;
67
+ bottom: any;
68
+ }): void;
69
+ __createViewPort(): void;
70
+ __startDrag: (e: any) => void;
71
+ __drag: (e: any) => void;
72
+ __drop: () => void;
73
+ }
3
74
  export default MiniMap;
4
75
  export { MiniMap };