@logicflow/extension 1.1.13 → 1.2.0-alpha.2

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 (89) hide show
  1. package/cjs/NodeResize/Control/Control.js +8 -8
  2. package/cjs/NodeResize/Control/Util.js +11 -11
  3. package/cjs/bpmn-adapter/index.js +124 -76
  4. package/cjs/bpmn-adapter/json2xml.js +5 -2
  5. package/cjs/bpmn-adapter/xml2json.js +38 -284
  6. package/cjs/components/context-menu/index.js +2 -2
  7. package/cjs/components/control/index.js +13 -13
  8. package/cjs/components/menu/index.js +32 -32
  9. package/cjs/components/mini-map/index.js +2 -2
  10. package/cjs/components/selection-select/index.js +5 -5
  11. package/cjs/index.js +1 -0
  12. package/cjs/insert-node-in-polyline/edge.js +4 -4
  13. package/cjs/insert-node-in-polyline/index.js +1 -1
  14. package/cjs/locale/en-locale/en.js +22 -0
  15. package/cjs/locale/en-locale/index.js +29 -0
  16. package/cjs/locale/locale.js +19 -0
  17. package/cjs/materials/group/GroupNode.js +2 -2
  18. package/cjs/materials/group/index.js +3 -3
  19. package/cjs/tools/auto-layout/index.js +9 -9
  20. package/cjs/turbo-adapter/index.js +2 -2
  21. package/es/NodeResize/Control/Control.d.ts +1 -1
  22. package/es/NodeResize/Control/Control.js +9 -9
  23. package/es/NodeResize/Control/Util.d.ts +3 -3
  24. package/es/NodeResize/Control/Util.js +7 -7
  25. package/es/bpmn-adapter/index.d.ts +41 -33
  26. package/es/bpmn-adapter/index.js +124 -76
  27. package/es/bpmn-adapter/json2xml.js +5 -2
  28. package/es/bpmn-adapter/xml2json.js +38 -284
  29. package/es/components/context-menu/index.js +2 -2
  30. package/es/components/control/index.d.ts +2 -3
  31. package/es/components/control/index.js +13 -13
  32. package/es/components/menu/index.d.ts +2 -3
  33. package/es/components/menu/index.js +32 -32
  34. package/es/components/mini-map/index.js +2 -2
  35. package/es/components/selection-select/index.d.ts +1 -1
  36. package/es/components/selection-select/index.js +5 -5
  37. package/es/index.d.ts +1 -0
  38. package/es/index.js +1 -0
  39. package/es/insert-node-in-polyline/edge.d.ts +3 -3
  40. package/es/insert-node-in-polyline/edge.js +3 -3
  41. package/es/insert-node-in-polyline/index.js +2 -2
  42. package/es/locale/en-locale/en.d.ts +19 -0
  43. package/es/locale/en-locale/en.js +19 -0
  44. package/es/locale/en-locale/index.d.ts +9 -0
  45. package/es/locale/en-locale/index.js +26 -0
  46. package/es/locale/locale.d.ts +6 -0
  47. package/es/locale/locale.js +16 -0
  48. package/es/materials/group/GroupNode.d.ts +1 -1
  49. package/es/materials/group/GroupNode.js +2 -2
  50. package/es/materials/group/index.d.ts +1 -1
  51. package/es/materials/group/index.js +3 -3
  52. package/es/tools/auto-layout/index.d.ts +2 -2
  53. package/es/tools/auto-layout/index.js +9 -9
  54. package/es/turbo-adapter/index.js +2 -2
  55. package/lib/AutoLayout.js +1 -1
  56. package/lib/BpmnAdapter.js +1 -1
  57. package/lib/BpmnElement.js +1 -1
  58. package/lib/ContextMenu.js +1 -1
  59. package/lib/Control.js +1 -1
  60. package/lib/CurvedEdge.js +1 -1
  61. package/lib/DndPanel.js +1 -1
  62. package/lib/EnLocale.js +1 -0
  63. package/lib/FlowPath.js +1 -1
  64. package/lib/Group.js +1 -1
  65. package/lib/InsertNodeInPolyline.js +1 -1
  66. package/lib/Menu.js +1 -1
  67. package/lib/MiniMap.js +1 -1
  68. package/lib/NodeResize.js +1 -1
  69. package/lib/RectLabelNode.js +1 -1
  70. package/lib/SelectionSelect.js +1 -1
  71. package/lib/Snapshot.js +1 -1
  72. package/lib/TurboAdapter.js +1 -1
  73. package/lib/lfJson2Xml.js +1 -1
  74. package/lib/lfXml2Json.js +1 -1
  75. package/package.json +2 -2
  76. package/types/NodeResize/Control/Control.d.ts +1 -1
  77. package/types/NodeResize/Control/Util.d.ts +3 -3
  78. package/types/bpmn-adapter/index.d.ts +41 -33
  79. package/types/components/control/index.d.ts +2 -3
  80. package/types/components/menu/index.d.ts +2 -3
  81. package/types/components/selection-select/index.d.ts +1 -1
  82. package/types/index.d.ts +1 -0
  83. package/types/insert-node-in-polyline/edge.d.ts +3 -3
  84. package/types/locale/en-locale/en.d.ts +19 -0
  85. package/types/locale/en-locale/index.d.ts +9 -0
  86. package/types/locale/locale.d.ts +6 -0
  87. package/types/materials/group/GroupNode.d.ts +1 -1
  88. package/types/materials/group/index.d.ts +1 -1
  89. package/types/tools/auto-layout/index.d.ts +2 -2
@@ -174,8 +174,8 @@ var ContextMenu = /** @class */ (function () {
174
174
  var leftTopY = y - node.y / 2 - 20;
175
175
  var rightBottomX = node.x + nodeModel.width + NEXT_X_DISTANCE;
176
176
  var rightBottomY = y + node.y / 2 + 20;
177
- var exsitElements = this.lf.getAreaElement([leftTopX, leftTopY], [rightBottomX, rightBottomY]);
178
- if (exsitElements.length) {
177
+ var existElements = this.lf.getAreaElement([leftTopX, leftTopY], [rightBottomX, rightBottomY]);
178
+ if (existElements.length) {
179
179
  y = y + NEXT_Y_DISTANCE;
180
180
  this.addNode(node, y);
181
181
  return;
@@ -9,13 +9,12 @@ declare type ControlItem = {
9
9
  };
10
10
  declare class Control {
11
11
  private lf;
12
+ private LogicFlow;
12
13
  static pluginName: string;
13
14
  private controlItems;
14
15
  private domContainer;
15
16
  private toolEl;
16
- constructor({ lf }: {
17
- lf: any;
18
- });
17
+ constructor(args: any);
19
18
  render(lf: any, domContainer: any): void;
20
19
  destroy(): void;
21
20
  addItem(item: any): void;
@@ -19,15 +19,16 @@ var __spread = (this && this.__spread) || function () {
19
19
  return ar;
20
20
  };
21
21
  var Control = /** @class */ (function () {
22
- function Control(_a) {
22
+ function Control(args) {
23
23
  var _this = this;
24
- var lf = _a.lf;
24
+ this.lf = args.lf;
25
+ this.LogicFlow = args.LogicFlow;
25
26
  this.controlItems = [
26
27
  {
27
28
  key: 'zoom-out',
28
29
  iconClass: 'lf-control-zoomOut',
29
- title: '缩小流程图',
30
- text: '缩小',
30
+ title: this.LogicFlow.t('缩小流程图'),
31
+ text: this.LogicFlow.t('缩小'),
31
32
  onClick: function () {
32
33
  _this.lf.zoom(false);
33
34
  },
@@ -35,8 +36,8 @@ var Control = /** @class */ (function () {
35
36
  {
36
37
  key: 'zoom-in',
37
38
  iconClass: 'lf-control-zoomIn',
38
- title: '放大流程图',
39
- text: '放大',
39
+ title: this.LogicFlow.t('放大流程图'),
40
+ text: this.LogicFlow.t('放大'),
40
41
  onClick: function () {
41
42
  _this.lf.zoom(true);
42
43
  },
@@ -44,8 +45,8 @@ var Control = /** @class */ (function () {
44
45
  {
45
46
  key: 'reset',
46
47
  iconClass: 'lf-control-fit',
47
- title: '恢复流程原有尺寸',
48
- text: '适应',
48
+ title: this.LogicFlow.t('恢复流程原有尺寸'),
49
+ text: this.LogicFlow.t('适应'),
49
50
  onClick: function () {
50
51
  _this.lf.resetZoom();
51
52
  },
@@ -53,8 +54,8 @@ var Control = /** @class */ (function () {
53
54
  {
54
55
  key: 'undo',
55
56
  iconClass: 'lf-control-undo',
56
- title: '回到上一步',
57
- text: '上一步',
57
+ title: this.LogicFlow.t('回到上一步'),
58
+ text: this.LogicFlow.t('上一步'),
58
59
  onClick: function () {
59
60
  _this.lf.undo();
60
61
  },
@@ -62,14 +63,13 @@ var Control = /** @class */ (function () {
62
63
  {
63
64
  key: 'redo',
64
65
  iconClass: 'lf-control-redo',
65
- title: '移到下一步',
66
- text: '下一步',
66
+ title: this.LogicFlow.t('移到下一步'),
67
+ text: this.LogicFlow.t('下一步'),
67
68
  onClick: function () {
68
69
  _this.lf.redo();
69
70
  },
70
71
  },
71
72
  ];
72
- this.lf = lf;
73
73
  }
74
74
  Control.prototype.render = function (lf, domContainer) {
75
75
  this.destroy();
@@ -13,14 +13,13 @@ export declare type MenuConfig = {
13
13
  };
14
14
  declare class Menu {
15
15
  lf: LogicFlow;
16
+ LogicFlow: any;
16
17
  private __container;
17
18
  private __menuDOM;
18
19
  private menuTypeMap;
19
20
  private __currentData;
20
21
  static pluginName: string;
21
- constructor({ lf }: {
22
- lf: any;
23
- });
22
+ constructor(args: any);
24
23
  /**
25
24
  * 初始化设置默认内置菜单栏
26
25
  */
@@ -18,16 +18,16 @@ var __spread = (this && this.__spread) || function () {
18
18
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
19
19
  return ar;
20
20
  };
21
- var DefalutNodeMenuKey = 'lf:defaultNodeMenu';
22
- var DefalutEdgeMenuKey = 'lf:defaultEdgeMenu';
23
- var DefalutGraphMenuKey = 'lf:defaultGraphMenu';
24
- var DefalutSelectionMenuKey = 'lf:defaultSelectionMenu';
21
+ var DefaultNodeMenuKey = 'lf:defaultNodeMenu';
22
+ var DefaultEdgeMenuKey = 'lf:defaultEdgeMenu';
23
+ var DefaultGraphMenuKey = 'lf:defaultGraphMenu';
24
+ var DefaultSelectionMenuKey = 'lf:defaultSelectionMenu';
25
25
  var Menu = /** @class */ (function () {
26
- function Menu(_a) {
26
+ function Menu(args) {
27
27
  var _this = this;
28
- var lf = _a.lf;
29
28
  this.__menuDOM = document.createElement('ul');
30
- this.lf = lf;
29
+ this.lf = args.lf;
30
+ this.LogicFlow = args.LogicFlow;
31
31
  this.menuTypeMap = new Map();
32
32
  this.init();
33
33
  this.lf.setMenuConfig = function (config) {
@@ -45,46 +45,46 @@ var Menu = /** @class */ (function () {
45
45
  */
46
46
  Menu.prototype.init = function () {
47
47
  var _this = this;
48
- var defalutNodeMenu = [
48
+ var defaultNodeMenu = [
49
49
  {
50
- text: '删除',
50
+ text: this.LogicFlow.t('删除'),
51
51
  callback: function (node) {
52
52
  _this.lf.deleteNode(node.id);
53
53
  },
54
54
  },
55
55
  {
56
- text: '编辑文本',
56
+ text: this.LogicFlow.t('编辑文本'),
57
57
  callback: function (node) {
58
58
  _this.lf.graphModel.editText(node.id);
59
59
  },
60
60
  },
61
61
  {
62
- text: '复制',
62
+ text: this.LogicFlow.t('复制'),
63
63
  callback: function (node) {
64
64
  _this.lf.cloneNode(node.id);
65
65
  },
66
66
  },
67
67
  ];
68
- this.menuTypeMap.set(DefalutNodeMenuKey, defalutNodeMenu);
68
+ this.menuTypeMap.set(DefaultNodeMenuKey, defaultNodeMenu);
69
69
  var defaultEdgeMenu = [
70
70
  {
71
- text: '删除',
71
+ text: this.LogicFlow.t('删除'),
72
72
  callback: function (edge) {
73
73
  _this.lf.deleteEdge(edge.id);
74
74
  },
75
75
  },
76
76
  {
77
- text: '编辑文本',
77
+ text: this.LogicFlow.t('编辑文本'),
78
78
  callback: function (edge) {
79
79
  _this.lf.graphModel.editText(edge.id);
80
80
  },
81
81
  },
82
82
  ];
83
- this.menuTypeMap.set(DefalutEdgeMenuKey, defaultEdgeMenu);
84
- this.menuTypeMap.set(DefalutGraphMenuKey, []);
85
- var DefalutSelectionMenu = [
83
+ this.menuTypeMap.set(DefaultEdgeMenuKey, defaultEdgeMenu);
84
+ this.menuTypeMap.set(DefaultGraphMenuKey, []);
85
+ var DefaultSelectionMenu = [
86
86
  {
87
- text: '删除',
87
+ text: this.LogicFlow.t('删除'),
88
88
  callback: function (elements) {
89
89
  _this.lf.clearSelectElements();
90
90
  elements.edges.forEach(function (edge) { return _this.lf.deleteEdge(edge.id); });
@@ -92,7 +92,7 @@ var Menu = /** @class */ (function () {
92
92
  },
93
93
  },
94
94
  ];
95
- this.menuTypeMap.set(DefalutSelectionMenuKey, DefalutSelectionMenu);
95
+ this.menuTypeMap.set(DefaultSelectionMenuKey, DefaultSelectionMenu);
96
96
  };
97
97
  Menu.prototype.render = function (lf, container) {
98
98
  var _this = this;
@@ -139,7 +139,7 @@ var Menu = /** @class */ (function () {
139
139
  menuList = typeMenus;
140
140
  }
141
141
  else { // 最后取全局默认
142
- menuList = _this.menuTypeMap.get(DefalutNodeMenuKey);
142
+ menuList = _this.menuTypeMap.get(DefaultNodeMenuKey);
143
143
  }
144
144
  _this.__currentData = data;
145
145
  _this.showMenu(x, y, menuList);
@@ -159,20 +159,20 @@ var Menu = /** @class */ (function () {
159
159
  menuList = typeMenus;
160
160
  }
161
161
  else { // 最后取全局默认
162
- menuList = _this.menuTypeMap.get(DefalutEdgeMenuKey);
162
+ menuList = _this.menuTypeMap.get(DefaultEdgeMenuKey);
163
163
  }
164
164
  _this.__currentData = data;
165
165
  _this.showMenu(x, y, menuList);
166
166
  });
167
167
  this.lf.on('blank:contextmenu', function (_a) {
168
168
  var position = _a.position;
169
- var menuList = _this.menuTypeMap.get(DefalutGraphMenuKey);
169
+ var menuList = _this.menuTypeMap.get(DefaultGraphMenuKey);
170
170
  var _b = position.domOverlayPosition, x = _b.x, y = _b.y;
171
171
  _this.showMenu(x, y, menuList);
172
172
  });
173
173
  this.lf.on('selection:contextmenu', function (_a) {
174
174
  var data = _a.data, position = _a.position;
175
- var menuList = _this.menuTypeMap.get(DefalutSelectionMenuKey);
175
+ var menuList = _this.menuTypeMap.get(DefaultSelectionMenuKey);
176
176
  var _b = position.domOverlayPosition, x = _b.x, y = _b.y;
177
177
  _this.__currentData = data;
178
178
  _this.showMenu(x, y, menuList);
@@ -253,13 +253,13 @@ var Menu = /** @class */ (function () {
253
253
  }
254
254
  // node
255
255
  config.nodeMenu !== undefined
256
- && this.menuTypeMap.set(DefalutNodeMenuKey, config.nodeMenu ? config.nodeMenu : []);
256
+ && this.menuTypeMap.set(DefaultNodeMenuKey, config.nodeMenu ? config.nodeMenu : []);
257
257
  // edge
258
258
  config.edgeMenu !== undefined
259
- && this.menuTypeMap.set(DefalutEdgeMenuKey, config.edgeMenu ? config.edgeMenu : []);
259
+ && this.menuTypeMap.set(DefaultEdgeMenuKey, config.edgeMenu ? config.edgeMenu : []);
260
260
  // graph
261
261
  config.graphMenu !== undefined
262
- && this.menuTypeMap.set(DefalutGraphMenuKey, config.graphMenu ? config.graphMenu : []);
262
+ && this.menuTypeMap.set(DefaultGraphMenuKey, config.graphMenu ? config.graphMenu : []);
263
263
  };
264
264
  // 在默认菜单后面追加菜单项
265
265
  Menu.prototype.addMenuConfig = function (config) {
@@ -268,16 +268,16 @@ var Menu = /** @class */ (function () {
268
268
  }
269
269
  // 追加项时,只支持数组类型,对false不做操作
270
270
  if (Array.isArray(config.nodeMenu)) {
271
- var menuList = this.menuTypeMap.get(DefalutNodeMenuKey);
272
- this.menuTypeMap.set(DefalutNodeMenuKey, menuList.concat(config.nodeMenu));
271
+ var menuList = this.menuTypeMap.get(DefaultNodeMenuKey);
272
+ this.menuTypeMap.set(DefaultNodeMenuKey, menuList.concat(config.nodeMenu));
273
273
  }
274
274
  if (Array.isArray(config.edgeMenu)) {
275
- var menuList = this.menuTypeMap.get(DefalutEdgeMenuKey);
276
- this.menuTypeMap.set(DefalutEdgeMenuKey, menuList.concat(config.edgeMenu));
275
+ var menuList = this.menuTypeMap.get(DefaultEdgeMenuKey);
276
+ this.menuTypeMap.set(DefaultEdgeMenuKey, menuList.concat(config.edgeMenu));
277
277
  }
278
278
  if (Array.isArray(config.graphMenu)) {
279
- var menuList = this.menuTypeMap.get(DefalutGraphMenuKey);
280
- this.menuTypeMap.set(DefalutGraphMenuKey, menuList.concat(config.graphMenu));
279
+ var menuList = this.menuTypeMap.get(DefaultGraphMenuKey);
280
+ this.menuTypeMap.set(DefaultGraphMenuKey, menuList.concat(config.graphMenu));
281
281
  }
282
282
  };
283
283
  /**
@@ -167,11 +167,11 @@ var MiniMap = /** @class */ (function () {
167
167
  nodes.forEach(function (_a) {
168
168
  var x = _a.x, y = _a.y, _b = _a.width, width = _b === void 0 ? 200 : _b, _c = _a.height, height = _c === void 0 ? 200 : _c;
169
169
  var nodeLeft = x - width / 2;
170
- var noderight = x + width / 2;
170
+ var nodeRight = x + width / 2;
171
171
  var nodeTop = y - height / 2;
172
172
  var nodeBottom = y + height / 2;
173
173
  left = nodeLeft < left ? nodeLeft : left;
174
- right = noderight > right ? noderight : right;
174
+ right = nodeRight > right ? nodeRight : right;
175
175
  top = nodeTop < top ? nodeTop : top;
176
176
  bottom = nodeBottom > bottom ? nodeBottom : bottom;
177
177
  });
@@ -12,7 +12,7 @@ declare class SelectionSelect {
12
12
  y: number;
13
13
  };
14
14
  __disabled: boolean;
15
- isDefalutStopMoveGraph: boolean;
15
+ isDefaultStopMoveGraph: boolean;
16
16
  isWholeNode: boolean;
17
17
  isWholeEdge: boolean;
18
18
  static pluginName: string;
@@ -3,7 +3,7 @@ var SelectionSelect = /** @class */ (function () {
3
3
  var _this = this;
4
4
  var lf = _a.lf;
5
5
  this.__disabled = false;
6
- this.isDefalutStopMoveGraph = false;
6
+ this.isDefaultStopMoveGraph = false;
7
7
  this.isWholeNode = true;
8
8
  this.isWholeEdge = true;
9
9
  this.__draw = function (ev) {
@@ -47,9 +47,9 @@ var SelectionSelect = /** @class */ (function () {
47
47
  _this.lf.emit('selection:selected', elements);
48
48
  };
49
49
  this.lf = lf;
50
- // 初始化isDefalutStopMoveGraph取值
50
+ // 初始化isDefaultStopMoveGraph取值
51
51
  var stopMoveGraph = lf.getEditConfig().stopMoveGraph;
52
- this.isDefalutStopMoveGraph = stopMoveGraph;
52
+ this.isDefaultStopMoveGraph = stopMoveGraph;
53
53
  lf.openSelectionSelect = function () {
54
54
  _this.openSelectionSelect();
55
55
  };
@@ -97,7 +97,7 @@ var SelectionSelect = /** @class */ (function () {
97
97
  SelectionSelect.prototype.openSelectionSelect = function () {
98
98
  var stopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
99
99
  if (!stopMoveGraph) {
100
- this.isDefalutStopMoveGraph = false;
100
+ this.isDefaultStopMoveGraph = false;
101
101
  this.lf.updateEditConfig({
102
102
  stopMoveGraph: true,
103
103
  });
@@ -108,7 +108,7 @@ var SelectionSelect = /** @class */ (function () {
108
108
  * 关闭选区
109
109
  */
110
110
  SelectionSelect.prototype.closeSelectionSelect = function () {
111
- if (!this.isDefalutStopMoveGraph) {
111
+ if (!this.isDefaultStopMoveGraph) {
112
112
  this.lf.updateEditConfig({
113
113
  stopMoveGraph: false,
114
114
  });
package/es/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export * from './tools/flow-path';
16
16
  export * from './tools/auto-layout';
17
17
  export * from './bpmn-adapter/xml2json';
18
18
  export * from './bpmn-adapter/json2xml';
19
+ export * from './locale/en-locale';
package/es/index.js CHANGED
@@ -17,3 +17,4 @@ export * from './tools/flow-path';
17
17
  export * from './tools/auto-layout';
18
18
  export * from './bpmn-adapter/xml2json';
19
19
  export * from './bpmn-adapter/json2xml';
20
+ export * from './locale/en-locale';
@@ -1,6 +1,6 @@
1
1
  import { Point, PolylineEdgeModel, BaseNodeModel } from '@logicflow/core';
2
2
  export declare const isInSegment: (point: any, start: any, end: any) => boolean;
3
- export declare const corssPointInSegement: (node: BaseNodeModel, start: Point, end: Point) => {
3
+ export declare const crossPointInSegment: (node: BaseNodeModel, start: Point, end: Point) => {
4
4
  startCrossPoint: {
5
5
  x: number;
6
6
  y: number;
@@ -10,12 +10,12 @@ export declare const corssPointInSegement: (node: BaseNodeModel, start: Point, e
10
10
  y: number;
11
11
  };
12
12
  };
13
- interface SegementCross {
13
+ interface SegmentCross {
14
14
  crossIndex: number;
15
15
  crossPoints: {
16
16
  startCrossPoint: Point;
17
17
  endCrossPoint: Point;
18
18
  };
19
19
  }
20
- export declare const isNodeInSegement: (node: BaseNodeModel, polyline: PolylineEdgeModel) => SegementCross;
20
+ export declare const isNodeInSegment: (node: BaseNodeModel, polyline: PolylineEdgeModel) => SegmentCross;
21
21
  export {};
@@ -42,7 +42,7 @@ var segmentDirection = function (start, end) {
42
42
  return direction;
43
43
  };
44
44
  // 节点是够在线段内,求出节点与线段的交点
45
- export var corssPointInSegement = function (node, start, end) {
45
+ export var crossPointInSegment = function (node, start, end) {
46
46
  var bBox = getNodeBBox(node);
47
47
  var direction = segmentDirection(start, end);
48
48
  var maxX = Math.max(start.x, end.x);
@@ -83,12 +83,12 @@ export var corssPointInSegement = function (node, start, end) {
83
83
  };
84
84
  // 节点是否在线段内
85
85
  // eslint-disable-next-line max-len
86
- export var isNodeInSegement = function (node, polyline) {
86
+ export var isNodeInSegment = function (node, polyline) {
87
87
  var x = node.x, y = node.y;
88
88
  var pointsList = polyline.pointsList;
89
89
  for (var i = 0; i < pointsList.length - 1; i++) {
90
90
  if (isInSegment({ x: x, y: y }, pointsList[i], pointsList[i + 1])) {
91
- var bBoxCross = corssPointInSegement(node, pointsList[i], pointsList[i + 1]);
91
+ var bBoxCross = crossPointInSegment(node, pointsList[i], pointsList[i + 1]);
92
92
  if (bBoxCross) {
93
93
  return {
94
94
  crossIndex: i + 1,
@@ -18,7 +18,7 @@ var __spread = (this && this.__spread) || function () {
18
18
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
19
19
  return ar;
20
20
  };
21
- import { isNodeInSegement } from './edge';
21
+ import { isNodeInSegment } from './edge';
22
22
  var InsertNodeInPolyline = /** @class */ (function () {
23
23
  function InsertNodeInPolyline(_a) {
24
24
  var lf = _a.lf;
@@ -59,7 +59,7 @@ var InsertNodeInPolyline = /** @class */ (function () {
59
59
  var nodeModel = this._lf.getNodeModelById(nodeData.id);
60
60
  for (var i = 0; i < edges.length; i++) {
61
61
  // eslint-disable-next-line max-len
62
- var _a = isNodeInSegement(nodeModel, edges[i]), crossIndex = _a.crossIndex, crossPoints = _a.crossPoints;
62
+ var _a = isNodeInSegment(nodeModel, edges[i]), crossIndex = _a.crossIndex, crossPoints = _a.crossPoints;
63
63
  if (crossIndex >= 0) {
64
64
  var _b = edges[i], sourceNodeId = _b.sourceNodeId, targetNodeId = _b.targetNodeId, id = _b.id, type = _b.type, pointsList = _b.pointsList;
65
65
  this._lf.addEdge({
@@ -0,0 +1,19 @@
1
+ declare const en: {
2
+ 文本: string;
3
+ 开始: string;
4
+ 缩小流程图: string;
5
+ 缩小: string;
6
+ 放大流程图: string;
7
+ 放大: string;
8
+ 恢复流程原有尺寸: string;
9
+ 适应: string;
10
+ 回到上一步: string;
11
+ 上一步: string;
12
+ 移到下一步: string;
13
+ 下一步: string;
14
+ 删除: string;
15
+ 编辑文本: string;
16
+ 复制: string;
17
+ };
18
+ export default en;
19
+ export { en };
@@ -0,0 +1,19 @@
1
+ var en = {
2
+ 文本: 'text',
3
+ 开始: 'start',
4
+ 缩小流程图: 'zoom in',
5
+ 缩小: 'zoom in',
6
+ 放大流程图: 'zoom out',
7
+ 放大: 'zoom out',
8
+ 恢复流程原有尺寸: 'adapt to original size',
9
+ 适应: 'adapt',
10
+ 回到上一步: 'undo',
11
+ 上一步: 'undo',
12
+ 移到下一步: 'redo',
13
+ 下一步: 'redo',
14
+ 删除: 'delete',
15
+ 编辑文本: 'edit text',
16
+ 复制: 'copy',
17
+ };
18
+ export default en;
19
+ export { en };
@@ -0,0 +1,9 @@
1
+ import { Locale } from '../locale';
2
+ declare class EnLocale extends Locale {
3
+ static pluginName: string;
4
+ constructor({ LogicFlow }: {
5
+ LogicFlow: any;
6
+ });
7
+ }
8
+ export default EnLocale;
9
+ export { EnLocale };
@@ -0,0 +1,26 @@
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 { Locale } from '../locale';
15
+ import en from './en';
16
+ var EnLocale = /** @class */ (function (_super) {
17
+ __extends(EnLocale, _super);
18
+ function EnLocale(_a) {
19
+ var LogicFlow = _a.LogicFlow;
20
+ return _super.call(this, LogicFlow, en) || this;
21
+ }
22
+ EnLocale.pluginName = 'enLocale';
23
+ return EnLocale;
24
+ }(Locale));
25
+ export default EnLocale;
26
+ export { EnLocale };
@@ -0,0 +1,6 @@
1
+ export declare class Locale {
2
+ constructor(LogicFlow?: any, map?: Object);
3
+ replaceTranslator(LogicFlow: any, map: Object): void;
4
+ setDefault(LogicFlow: any): void;
5
+ static defaultTranslator: (text: string) => string;
6
+ }
@@ -0,0 +1,16 @@
1
+ var Locale = /** @class */ (function () {
2
+ function Locale(LogicFlow, map) {
3
+ if (LogicFlow && map) {
4
+ this.replaceTranslator(LogicFlow, map);
5
+ }
6
+ }
7
+ Locale.prototype.replaceTranslator = function (LogicFlow, map) {
8
+ LogicFlow.t = function (text) { return (map[text] ? map[text] : text); };
9
+ };
10
+ Locale.prototype.setDefault = function (LogicFlow) {
11
+ LogicFlow.t = Locale.defaultTranslator;
12
+ };
13
+ Locale.defaultTranslator = function (text) { return text; };
14
+ return Locale;
15
+ }());
16
+ export { Locale };
@@ -101,7 +101,7 @@ declare class GroupNodeModel extends RectResize.model {
101
101
  }
102
102
  declare class GroupNode extends RectResize.view {
103
103
  getControlGroup(): h.JSX.Element;
104
- getAddedableShape(): import("preact").VNode<any>;
104
+ getAddAbleShape(): import("preact").VNode<any>;
105
105
  getFoldIcon(): import("preact").VNode<any>;
106
106
  getResizeShape(): import("preact").VNode<any>;
107
107
  }
@@ -293,7 +293,7 @@ var GroupNode = /** @class */ (function (_super) {
293
293
  var _a = this.props.model, resizable = _a.resizable, properties = _a.properties;
294
294
  return resizable && !properties.isFolded ? _super.prototype.getControlGroup.call(this) : null;
295
295
  };
296
- GroupNode.prototype.getAddedableShape = function () {
296
+ GroupNode.prototype.getAddAbleShape = function () {
297
297
  var _a = this.props.model, width = _a.width, height = _a.height, x = _a.x, y = _a.y, radius = _a.radius, properties = _a.properties;
298
298
  if (!properties.groupAddable)
299
299
  return null;
@@ -339,7 +339,7 @@ var GroupNode = /** @class */ (function (_super) {
339
339
  };
340
340
  GroupNode.prototype.getResizeShape = function () {
341
341
  return h('g', {}, [
342
- this.getAddedableShape(),
342
+ this.getAddAbleShape(),
343
343
  _super.prototype.getResizeShape.call(this),
344
344
  this.getFoldIcon(),
345
345
  ]);
@@ -17,7 +17,7 @@ declare class Group {
17
17
  lf: any;
18
18
  });
19
19
  graphRendered: (data: any) => void;
20
- appendNodeToGrop: ({ data }: {
20
+ appendNodeToGroup: ({ data }: {
21
21
  data: any;
22
22
  }) => void;
23
23
  deleteGroupChild: ({ data }: {
@@ -36,7 +36,7 @@ var Group = /** @class */ (function () {
36
36
  });
37
37
  }
38
38
  };
39
- this.appendNodeToGrop = function (_a) {
39
+ this.appendNodeToGroup = function (_a) {
40
40
  var data = _a.data;
41
41
  // 如果这个节点之前已经在group中了,则将其从之前的group中移除
42
42
  var preGroupId = _this.nodeGroupMap.get(data.id);
@@ -110,9 +110,9 @@ var Group = /** @class */ (function () {
110
110
  return true;
111
111
  });
112
112
  lf.graphModel.group = this;
113
- lf.on('node:add', this.appendNodeToGrop);
113
+ lf.on('node:add', this.appendNodeToGroup);
114
114
  lf.on('node:delete', this.deleteGroupChild);
115
- lf.on('node:drop', this.appendNodeToGrop);
115
+ lf.on('node:drop', this.appendNodeToGroup);
116
116
  lf.on('node:dnd-drag', this.setActiveGroup);
117
117
  lf.on('node:drag', this.setActiveGroup);
118
118
  lf.on('graph:rendered', this.graphRendered);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 自动布局插件
3
- * 依赖flowpath插件
3
+ * 依赖flow-path插件
4
4
  * 未完善
5
5
  */
6
6
  import LogicFlow from '@logicflow/core';
@@ -26,7 +26,7 @@ declare class AutoLayout {
26
26
  * source一定在target左边。
27
27
  * 1. 如果source和target在同一x, y坐标内容。
28
28
  * 2. 如果source在target左上方。
29
- * 3. 如果souce在target左下方。
29
+ * 3. 如果source在target左下方。
30
30
  */
31
31
  private getRelativePosition;
32
32
  /**