@logicflow/extension 1.2.0-alpha.1 → 1.2.0-alpha.12

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 (85) hide show
  1. package/cjs/NodeResize/Control/Control.js +13 -9
  2. package/cjs/NodeResize/Node/DiamondResize.js +10 -8
  3. package/cjs/NodeResize/Node/EllipseResize.js +10 -8
  4. package/cjs/NodeResize/Node/HtmlResize.js +10 -8
  5. package/cjs/NodeResize/Node/RectResize.js +10 -8
  6. package/cjs/bpmn-adapter/index.js +1 -1
  7. package/cjs/components/control/index.js +16 -16
  8. package/cjs/components/highlight/index.js +187 -0
  9. package/cjs/components/menu/index.js +9 -9
  10. package/cjs/components/mini-map/index.js +5 -0
  11. package/cjs/components/selection-select/index.js +22 -2
  12. package/cjs/index.js +2 -0
  13. package/cjs/locale/en-locale/en.js +22 -0
  14. package/cjs/locale/en-locale/index.js +29 -0
  15. package/cjs/locale/locale.js +19 -0
  16. package/cjs/materials/group/GroupNode.js +22 -12
  17. package/cjs/turbo-adapter/index.js +71 -41
  18. package/es/NodeResize/Control/Control.js +13 -9
  19. package/es/NodeResize/Node/DiamondResize.d.ts +1 -1
  20. package/es/NodeResize/Node/DiamondResize.js +10 -8
  21. package/es/NodeResize/Node/EllipseResize.d.ts +1 -1
  22. package/es/NodeResize/Node/EllipseResize.js +10 -8
  23. package/es/NodeResize/Node/HtmlResize.d.ts +1 -1
  24. package/es/NodeResize/Node/HtmlResize.js +10 -8
  25. package/es/NodeResize/Node/RectResize.d.ts +1 -1
  26. package/es/NodeResize/Node/RectResize.js +10 -8
  27. package/es/bpmn-adapter/index.js +1 -1
  28. package/es/components/control/index.d.ts +2 -3
  29. package/es/components/control/index.js +16 -16
  30. package/es/components/highlight/index.d.ts +21 -0
  31. package/es/components/highlight/index.js +184 -0
  32. package/es/components/menu/index.d.ts +2 -3
  33. package/es/components/menu/index.js +9 -9
  34. package/es/components/mini-map/index.js +5 -0
  35. package/es/components/selection-select/index.d.ts +1 -0
  36. package/es/components/selection-select/index.js +22 -2
  37. package/es/index.d.ts +2 -0
  38. package/es/index.js +2 -0
  39. package/es/locale/en-locale/en.d.ts +19 -0
  40. package/es/locale/en-locale/en.js +19 -0
  41. package/es/locale/en-locale/index.d.ts +9 -0
  42. package/es/locale/en-locale/index.js +26 -0
  43. package/es/locale/locale.d.ts +6 -0
  44. package/es/locale/locale.js +16 -0
  45. package/es/materials/group/GroupNode.js +22 -12
  46. package/es/turbo-adapter/index.d.ts +6 -7
  47. package/es/turbo-adapter/index.js +70 -40
  48. package/lib/AutoLayout.js +1 -1
  49. package/lib/BpmnAdapter.js +1 -1
  50. package/lib/BpmnElement.js +1 -1
  51. package/lib/ContextMenu.js +1 -1
  52. package/lib/Control.js +1 -1
  53. package/lib/CurvedEdge.js +1 -1
  54. package/lib/DndPanel.js +1 -1
  55. package/lib/EnLocale.js +1 -0
  56. package/lib/FlowPath.js +1 -1
  57. package/lib/Group.js +1 -1
  58. package/lib/Highlight.js +1 -0
  59. package/lib/InsertNodeInPolyline.js +1 -1
  60. package/lib/Menu.js +1 -1
  61. package/lib/MiniMap.js +1 -1
  62. package/lib/NodeResize.js +1 -1
  63. package/lib/RectLabelNode.js +1 -1
  64. package/lib/SelectionSelect.js +1 -1
  65. package/lib/Snapshot.js +1 -1
  66. package/lib/TurboAdapter.js +1 -1
  67. package/lib/lfJson2Xml.js +1 -1
  68. package/lib/lfXml2Json.js +1 -1
  69. package/package.json +2 -2
  70. package/types/NodeResize/Node/DiamondResize.d.ts +1 -1
  71. package/types/NodeResize/Node/EllipseResize.d.ts +1 -1
  72. package/types/NodeResize/Node/HtmlResize.d.ts +1 -1
  73. package/types/NodeResize/Node/RectResize.d.ts +1 -1
  74. package/types/components/control/index.d.ts +2 -3
  75. package/types/components/highlight/index.d.ts +21 -0
  76. package/types/components/menu/index.d.ts +2 -3
  77. package/types/components/selection-select/index.d.ts +1 -0
  78. package/types/index.d.ts +2 -0
  79. package/types/locale/en-locale/en.d.ts +19 -0
  80. package/types/locale/en-locale/index.d.ts +9 -0
  81. package/types/locale/locale.d.ts +6 -0
  82. package/types/turbo-adapter/index.d.ts +6 -7
  83. package/types/NodeResize/BasicShape/Ellipse.d.ts +0 -2
  84. package/types/curved.d.ts +0 -0
  85. package/types/group-shrink/index.d.ts +0 -28
@@ -107,24 +107,30 @@ var GroupNodeModel = /** @class */ (function (_super) {
107
107
  this.isFolded = isFolded;
108
108
  // step 1
109
109
  if (isFolded) {
110
- this.x = this.x - this.width / 2 + this.foldedWidth / 2;
111
- this.y = this.y - this.height / 2 + this.foldedHeight / 2;
112
110
  this.unfoldedWidth = this.width;
113
111
  this.unfoldedHight = this.height;
114
- this.width = this.foldedWidth;
115
- this.height = this.foldedHeight;
112
+ this.updateAttributes({
113
+ x: this.x - this.width / 2 + this.foldedWidth / 2,
114
+ y: this.y - this.height / 2 + this.foldedHeight / 2,
115
+ width: this.foldedWidth,
116
+ height: this.foldedHeight,
117
+ });
116
118
  }
117
119
  else {
118
- this.width = this.unfoldedWidth;
119
- this.height = this.unfoldedHight;
120
- this.x = this.x + this.width / 2 - this.foldedWidth / 2;
121
- this.y = this.y + this.height / 2 - this.foldedHeight / 2;
120
+ this.updateAttributes({
121
+ width: this.unfoldedWidth,
122
+ height: this.unfoldedHight,
123
+ x: this.x + this.unfoldedWidth / 2 - this.foldedWidth / 2,
124
+ y: this.y + this.unfoldedHight / 2 - this.foldedHeight / 2,
125
+ });
122
126
  }
123
127
  // step 2
124
128
  var allEdges = this.incoming.edges.concat(this.outgoing.edges);
125
129
  this.children.forEach(function (elementId) {
126
130
  var nodeModel = _this.graphModel.getElement(elementId);
127
- nodeModel.visible = !isFolded;
131
+ nodeModel.updateAttributes({
132
+ visible: !isFolded,
133
+ });
128
134
  allEdges = allEdges.concat(nodeModel.incoming.edges.concat(nodeModel.outgoing.edges));
129
135
  });
130
136
  // step 3
@@ -196,7 +202,9 @@ var GroupNodeModel = /** @class */ (function (_super) {
196
202
  if (targetNodeIdGroup.id !== _this.id || sourceNodeIdGroup.id !== _this.id) {
197
203
  _this.createVirtualEdge(data);
198
204
  }
199
- edgeModel.visible = false;
205
+ edgeModel.updateAttributes({
206
+ visible: false,
207
+ });
200
208
  }
201
209
  // 展开时,处理被隐藏的边的逻辑
202
210
  if (!isFolded && edgeModel.visible === false) {
@@ -212,7 +220,9 @@ var GroupNodeModel = /** @class */ (function (_super) {
212
220
  _this.createVirtualEdge(data);
213
221
  }
214
222
  else {
215
- edgeModel.visible = true;
223
+ edgeModel.updateAttributes({
224
+ visible: true,
225
+ });
216
226
  }
217
227
  }
218
228
  });
@@ -222,7 +232,7 @@ var GroupNodeModel = /** @class */ (function (_super) {
222
232
  var model = this.graphModel.addEdge(edgeData);
223
233
  model.virtual = true;
224
234
  // 强制不保存group连线数据
225
- model.getData = function () { return null; };
235
+ // model.getData = () => null;
226
236
  model.text.editable = false;
227
237
  model.isFoldedEdge = true;
228
238
  };
@@ -10,17 +10,39 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __read = (this && this.__read) || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o), r, ar = [], e;
17
+ try {
18
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
+ }
20
+ catch (error) { e = { error: error }; }
21
+ finally {
22
+ try {
23
+ if (r && !r.done && (m = i["return"])) m.call(i);
24
+ }
25
+ finally { if (e) throw e.error; }
26
+ }
27
+ return ar;
28
+ };
13
29
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.TurboAdapter = exports.toLogicflowData = exports.toTurboData = void 0;
15
- var TurboType;
16
- (function (TurboType) {
17
- TurboType[TurboType["SEQUENCE_FLOW"] = 1] = "SEQUENCE_FLOW";
18
- TurboType[TurboType["START_EVENT"] = 2] = "START_EVENT";
19
- TurboType[TurboType["END_EVENT"] = 3] = "END_EVENT";
20
- TurboType[TurboType["USER_TASK"] = 4] = "USER_TASK";
30
+ exports.toLogicflowData = exports.toTurboData = void 0;
31
+ var TurboType = {
32
+ SEQUENCE_FLOW: 1,
33
+ START_EVENT: 2,
34
+ END_EVENT: 3,
35
+ USER_TASK: 4,
21
36
  // SERVICE_TASK = 5, 暂不支持
22
- TurboType[TurboType["EXCLUSIVE_GATEWAY"] = 6] = "EXCLUSIVE_GATEWAY";
23
- })(TurboType || (TurboType = {}));
37
+ EXCLUSIVE_GATEWAY: 6,
38
+ };
39
+ var TurboTypeMap = {
40
+ 1: 'bpmn:sequenceFlow',
41
+ 2: 'bpmn:startEvent',
42
+ 3: 'bpmn:endEvent',
43
+ 4: 'bpmn:userTask',
44
+ 6: 'bpmn:exclusiveGateway',
45
+ };
24
46
  // 转换Turbo识别的类型
25
47
  function getTurboType(type) {
26
48
  switch (type) {
@@ -50,7 +72,7 @@ function convertNodeToTurboElement(node) {
50
72
  type: getTurboType(node.type),
51
73
  properties: __assign(__assign({}, properties), { name: (text && text.value) || '', x: x,
52
74
  y: y,
53
- text: text, logicFlowType: type }),
75
+ text: text }),
54
76
  key: id,
55
77
  };
56
78
  }
@@ -62,10 +84,7 @@ function convertEdgeToTurboElement(edge) {
62
84
  outgoing: [targetNodeId],
63
85
  type: getTurboType(type),
64
86
  dockers: [],
65
- properties: __assign(__assign({}, properties), { name: (text && text.value) || '', text: text,
66
- startPoint: startPoint,
67
- endPoint: endPoint,
68
- pointsList: pointsList, logicFlowType: type }),
87
+ properties: __assign(__assign({}, properties), { name: (text && text.value) || '', text: text, startPoint: JSON.stringify(startPoint), endPoint: JSON.stringify(endPoint), pointsList: JSON.stringify(text) }),
69
88
  key: id,
70
89
  };
71
90
  }
@@ -93,21 +112,30 @@ function toTurboData(data) {
93
112
  exports.toTurboData = toTurboData;
94
113
  // 将Turbo元素数据转换为LogicFlow中的Edge数据
95
114
  function convertFlowElementToEdge(element) {
96
- var incoming = element.incoming, outgoing = element.outgoing, properties = element.properties, key = element.key;
97
- var text = properties.text, startPoint = properties.startPoint, endPoint = properties.endPoint, pointsList = properties.pointsList, logicFlowType = properties.logicFlowType;
115
+ var incoming = element.incoming, outgoing = element.outgoing, properties = element.properties, key = element.key, type = element.type;
116
+ var text = properties.text, name = properties.name, startPoint = properties.startPoint, endPoint = properties.endPoint, pointsList = properties.pointsList;
98
117
  var edge = {
99
118
  id: key,
100
- type: logicFlowType,
119
+ type: TurboTypeMap[type],
101
120
  sourceNodeId: incoming[0],
102
121
  targetNodeId: outgoing[0],
103
- text: text,
104
- startPoint: startPoint,
105
- endPoint: endPoint,
106
- pointsList: pointsList,
122
+ text: text || name,
107
123
  properties: {},
108
124
  };
125
+ if (startPoint) {
126
+ // @ts-ignore
127
+ edge.startPoint = JSON.parse(startPoint);
128
+ }
129
+ if (endPoint) {
130
+ // @ts-ignore
131
+ edge.endPoint = JSON.parse(endPoint);
132
+ }
133
+ if (pointsList) {
134
+ // @ts-ignore
135
+ edge.endPoint = JSON.parse(pointsList);
136
+ }
109
137
  // 这种转换方式,在自定义属性中不能与excludeProperties中的属性重名,否则将在转换过程中丢失
110
- var excludeProperties = ['startPoint', 'endPoint', 'pointsList', 'text', 'logicFlowType'];
138
+ var excludeProperties = ['startPoint', 'endPoint', 'pointsList', 'text'];
111
139
  Object.keys(element.properties).forEach(function (property) {
112
140
  if (excludeProperties.indexOf(property) === -1) {
113
141
  edge.properties[property] = element.properties[property];
@@ -117,18 +145,23 @@ function convertFlowElementToEdge(element) {
117
145
  }
118
146
  // 将Turbo元素数据转换为LogicFlow中的Node数据
119
147
  function convertFlowElementToNode(element) {
120
- var properties = element.properties, key = element.key;
121
- var x = properties.x, y = properties.y, text = properties.text, logicFlowType = properties.logicFlowType;
148
+ var properties = element.properties, key = element.key, type = element.type, bounds = element.bounds;
149
+ var x = properties.x, y = properties.y;
150
+ if (x === undefined) {
151
+ var _a = __read(bounds, 2), _b = _a[0], x1 = _b.x, y1 = _b.y, _c = _a[1], x2 = _c.x, y2 = _c.y;
152
+ x = (x1 + x2) / 2;
153
+ y = (y1 + y2) / 2;
154
+ }
122
155
  var node = {
123
156
  id: key,
124
- type: logicFlowType,
157
+ type: TurboTypeMap[type],
125
158
  x: x,
126
159
  y: y,
127
- text: text,
160
+ text: properties.text,
128
161
  properties: {},
129
162
  };
130
163
  // 这种转换方式,在自定义属性中不能与excludeProperties中的属性重名,否则将在转换过程中丢失
131
- var excludeProperties = ['x', 'y', 'text', 'logicFlowType'];
164
+ var excludeProperties = ['x', 'y', 'text'];
132
165
  Object.keys(element.properties).forEach(function (property) {
133
166
  if (excludeProperties.indexOf(property) === -1) {
134
167
  node.properties[property] = element.properties[property];
@@ -156,26 +189,23 @@ function toLogicflowData(data) {
156
189
  return lfData;
157
190
  }
158
191
  exports.toLogicflowData = toLogicflowData;
159
- var TurboAdapter = {
160
- pluginName: 'turboAdapter',
161
- install: function (lf) {
192
+ var TurboAdapter = /** @class */ (function () {
193
+ function TurboAdapter(_a) {
194
+ var lf = _a.lf;
162
195
  lf.adapterIn = this.adapterIn;
163
196
  lf.adapterOut = this.adapterOut;
164
- },
165
- shapeConfigMap: new Map(),
166
- setCustomShape: function (key, val) {
167
- this.shapeConfigMap.set(key, val);
168
- },
169
- adapterOut: function (logicflowData) {
197
+ }
198
+ TurboAdapter.prototype.adapterOut = function (logicflowData) {
170
199
  if (logicflowData) {
171
200
  return toTurboData(logicflowData);
172
201
  }
173
- },
174
- adapterIn: function (turboData) {
202
+ };
203
+ TurboAdapter.prototype.adapterIn = function (turboData) {
175
204
  if (turboData) {
176
205
  return toLogicflowData(turboData);
177
206
  }
178
- },
179
- };
180
- exports.TurboAdapter = TurboAdapter;
207
+ };
208
+ TurboAdapter.pluginName = 'turboAdapter';
209
+ return TurboAdapter;
210
+ }());
181
211
  exports.default = TurboAdapter;
@@ -35,9 +35,11 @@ var Control = /** @class */ (function (_super) {
35
35
  _this.updatePosition = function (_a) {
36
36
  var deltaX = _a.deltaX, deltaY = _a.deltaY;
37
37
  var _b = _this.nodeModel, x = _b.x, y = _b.y;
38
- _this.nodeModel.x = x + deltaX / 2;
39
- _this.nodeModel.y = y + deltaY / 2;
40
38
  _this.nodeModel.moveText(deltaX / 2, deltaY / 2);
39
+ _this.nodeModel.updateAttributes({
40
+ x: x + deltaX / 2,
41
+ y: y + deltaY / 2,
42
+ });
41
43
  };
42
44
  // 计算control拖动后,节点的宽高
43
45
  _this.getResize = function (_a) {
@@ -53,7 +55,7 @@ var Control = /** @class */ (function (_super) {
53
55
  resize.height = height - deltaY * pct;
54
56
  break;
55
57
  case 2:
56
- resize.width = width + deltaX;
58
+ resize.width = width + deltaX * pct;
57
59
  resize.height = height + deltaY * pct;
58
60
  break;
59
61
  case 3:
@@ -91,14 +93,16 @@ var Control = /** @class */ (function (_super) {
91
93
  }
92
94
  _this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
93
95
  // 更新宽高
94
- _this.nodeModel.width = size.width;
95
- _this.nodeModel.height = size.height;
96
96
  _this.nodeModel.setProperties({
97
97
  nodeSize: {
98
98
  width: size.width,
99
99
  height: size.height,
100
100
  },
101
101
  });
102
+ _this.nodeModel.updateAttributes({
103
+ width: size.width,
104
+ height: size.height,
105
+ });
102
106
  var edges = _this.getNodeEdges(id);
103
107
  var beforeNode = {
104
108
  x: x,
@@ -161,9 +165,9 @@ var Control = /** @class */ (function (_super) {
161
165
  _this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
162
166
  // 更新rx ry,宽高为计算属性自动更新
163
167
  // @ts-ignore
164
- _this.nodeModel.rx = _this.nodeModel.rx + deltaX / 2;
168
+ _this.nodeModel.rx = size.width;
165
169
  // @ts-ignore
166
- _this.nodeModel.ry = _this.nodeModel.ry + deltaY / 2;
170
+ _this.nodeModel.ry = size.height;
167
171
  _this.nodeModel.setProperties({
168
172
  nodeSize: {
169
173
  rx: size.width,
@@ -225,9 +229,9 @@ var Control = /** @class */ (function (_super) {
225
229
  _this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
226
230
  // 更新rx ry,宽高为计算属性自动更新
227
231
  // @ts-ignore
228
- _this.nodeModel.rx = _this.nodeModel.rx + deltaX / 2;
232
+ _this.nodeModel.rx = size.width;
229
233
  // @ts-ignore
230
- _this.nodeModel.ry = _this.nodeModel.ry + deltaY / 2;
234
+ _this.nodeModel.ry = size.height;
231
235
  _this.nodeModel.setProperties({
232
236
  nodeSize: {
233
237
  rx: size.width,
@@ -1,7 +1,7 @@
1
1
  import { h, DiamondNode, DiamondNodeModel } from '@logicflow/core';
2
2
  declare class DiamondResizeModel extends DiamondNodeModel {
3
- constructor(data: any, graphModel: any);
4
3
  initNodeData(data: any): void;
4
+ init(): void;
5
5
  getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
6
6
  getResizeOutlineStyle(): {
7
7
  stroke: string;
@@ -27,14 +27,8 @@ import ControlGroup from '../Control/ControlGroup';
27
27
  import Polygon from '../BasicShape/Polygon';
28
28
  var DiamondResizeModel = /** @class */ (function (_super) {
29
29
  __extends(DiamondResizeModel, _super);
30
- function DiamondResizeModel(data, graphModel) {
31
- var _this = _super.call(this, data, graphModel) || this;
32
- var nodeSize = _this.properties.nodeSize;
33
- if (nodeSize) {
34
- _this.rx = nodeSize.rx;
35
- _this.ry = nodeSize.ry;
36
- }
37
- return _this;
30
+ function DiamondResizeModel() {
31
+ return _super !== null && _super.apply(this, arguments) || this;
38
32
  }
39
33
  DiamondResizeModel.prototype.initNodeData = function (data) {
40
34
  _super.prototype.initNodeData.call(this, data);
@@ -44,6 +38,14 @@ var DiamondResizeModel = /** @class */ (function (_super) {
44
38
  this.maxHeight = 2000;
45
39
  this.gridSize = 1;
46
40
  };
41
+ DiamondResizeModel.prototype.init = function () {
42
+ _super.prototype.init.call(this);
43
+ var nodeSize = this.properties.nodeSize;
44
+ if (nodeSize) {
45
+ this.rx = nodeSize.rx;
46
+ this.ry = nodeSize.ry;
47
+ }
48
+ };
47
49
  DiamondResizeModel.prototype.getOutlineStyle = function () {
48
50
  var style = _super.prototype.getOutlineStyle.call(this);
49
51
  style.stroke = 'none';
@@ -1,7 +1,7 @@
1
1
  import { h, EllipseNode, EllipseNodeModel } from '@logicflow/core';
2
2
  declare class EllipseResizeModel extends EllipseNodeModel {
3
- constructor(data: any, graphModel: any);
4
3
  initNodeData(data: any): void;
4
+ init(): void;
5
5
  getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
6
6
  getResizeOutlineStyle(): {
7
7
  stroke: string;
@@ -15,14 +15,8 @@ import { h, EllipseNode, EllipseNodeModel } from '@logicflow/core';
15
15
  import ControlGroup from '../Control/ControlGroup';
16
16
  var EllipseResizeModel = /** @class */ (function (_super) {
17
17
  __extends(EllipseResizeModel, _super);
18
- function EllipseResizeModel(data, graphModel) {
19
- var _this = _super.call(this, data, graphModel) || this;
20
- var nodeSize = _this.properties.nodeSize;
21
- if (nodeSize) {
22
- _this.rx = nodeSize.rx;
23
- _this.ry = nodeSize.ry;
24
- }
25
- return _this;
18
+ function EllipseResizeModel() {
19
+ return _super !== null && _super.apply(this, arguments) || this;
26
20
  }
27
21
  EllipseResizeModel.prototype.initNodeData = function (data) {
28
22
  _super.prototype.initNodeData.call(this, data);
@@ -31,6 +25,14 @@ var EllipseResizeModel = /** @class */ (function (_super) {
31
25
  this.maxWidth = 2000;
32
26
  this.maxHeight = 2000;
33
27
  };
28
+ EllipseResizeModel.prototype.init = function () {
29
+ _super.prototype.init.call(this);
30
+ var nodeSize = this.properties.nodeSize;
31
+ if (nodeSize) {
32
+ this.rx = nodeSize.rx;
33
+ this.ry = nodeSize.ry;
34
+ }
35
+ };
34
36
  EllipseResizeModel.prototype.getOutlineStyle = function () {
35
37
  var style = _super.prototype.getOutlineStyle.call(this);
36
38
  style.stroke = 'none';
@@ -1,7 +1,7 @@
1
1
  import { h, HtmlNode, HtmlNodeModel } from '@logicflow/core';
2
2
  declare class HtmlResizeModel extends HtmlNodeModel {
3
- constructor(data: any, graphModel: any);
4
3
  initNodeData(data: any): void;
4
+ init(): void;
5
5
  getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
6
6
  getResizeOutlineStyle(): {
7
7
  stroke: string;
@@ -15,14 +15,8 @@ import { h, HtmlNode, HtmlNodeModel } from '@logicflow/core';
15
15
  import ControlGroup from '../Control/ControlGroup';
16
16
  var HtmlResizeModel = /** @class */ (function (_super) {
17
17
  __extends(HtmlResizeModel, _super);
18
- function HtmlResizeModel(data, graphModel) {
19
- var _this = _super.call(this, data, graphModel) || this;
20
- var nodeSize = _this.properties.nodeSize;
21
- if (nodeSize) {
22
- _this.width = nodeSize.width;
23
- _this.height = nodeSize.height;
24
- }
25
- return _this;
18
+ function HtmlResizeModel() {
19
+ return _super !== null && _super.apply(this, arguments) || this;
26
20
  }
27
21
  HtmlResizeModel.prototype.initNodeData = function (data) {
28
22
  _super.prototype.initNodeData.call(this, data);
@@ -31,6 +25,14 @@ var HtmlResizeModel = /** @class */ (function (_super) {
31
25
  this.maxWidth = 2000;
32
26
  this.maxHeight = 2000;
33
27
  };
28
+ HtmlResizeModel.prototype.init = function () {
29
+ _super.prototype.init.call(this);
30
+ var nodeSize = this.properties.nodeSize;
31
+ if (nodeSize) {
32
+ this.width = nodeSize.width;
33
+ this.height = nodeSize.height;
34
+ }
35
+ };
34
36
  HtmlResizeModel.prototype.getOutlineStyle = function () {
35
37
  var style = _super.prototype.getOutlineStyle.call(this);
36
38
  style.stroke = 'none';
@@ -1,7 +1,7 @@
1
1
  import { h, RectNode, RectNodeModel } from '@logicflow/core';
2
2
  declare class RectResizeModel extends RectNodeModel {
3
- constructor(data: any, graphModel: any);
4
3
  initNodeData(data: any): void;
4
+ init(): void;
5
5
  getOutlineStyle(): import("@logicflow/core/types/constant/DefaultTheme").OutlineTheme;
6
6
  getResizeOutlineStyle(): {
7
7
  fill: string;
@@ -15,14 +15,8 @@ import { h, RectNode, RectNodeModel } from '@logicflow/core';
15
15
  import ControlGroup from '../Control/ControlGroup';
16
16
  var RectResizeModel = /** @class */ (function (_super) {
17
17
  __extends(RectResizeModel, _super);
18
- function RectResizeModel(data, graphModel) {
19
- var _this = _super.call(this, data, graphModel) || this;
20
- var nodeSize = _this.properties.nodeSize;
21
- if (nodeSize) {
22
- _this.width = nodeSize.width;
23
- _this.height = nodeSize.height;
24
- }
25
- return _this;
18
+ function RectResizeModel() {
19
+ return _super !== null && _super.apply(this, arguments) || this;
26
20
  }
27
21
  RectResizeModel.prototype.initNodeData = function (data) {
28
22
  _super.prototype.initNodeData.call(this, data);
@@ -31,6 +25,14 @@ var RectResizeModel = /** @class */ (function (_super) {
31
25
  this.maxWidth = 2000;
32
26
  this.maxHeight = 2000;
33
27
  };
28
+ RectResizeModel.prototype.init = function () {
29
+ _super.prototype.init.call(this);
30
+ var nodeSize = this.properties.nodeSize;
31
+ if (nodeSize) {
32
+ this.width = nodeSize.width;
33
+ this.height = nodeSize.height;
34
+ }
35
+ };
34
36
  RectResizeModel.prototype.getOutlineStyle = function () {
35
37
  var style = _super.prototype.getOutlineStyle.call(this);
36
38
  style.stroke = 'none';
@@ -176,7 +176,7 @@ function convertLf2ProcessData(bpmnProcessData, data) {
176
176
  return edgeConfig;
177
177
  });
178
178
  // @see https://github.com/didi/LogicFlow/issues/325
179
- // 需要保证incomming在outgoing之前
179
+ // 需要保证incoming在outgoing之前
180
180
  data.edges.forEach(function (edge) {
181
181
  var sourceNode = nodeMap.get(edge.sourceNodeId);
182
182
  if (!sourceNode['bpmn:outgoing']) {
@@ -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();
@@ -110,14 +110,14 @@ var Control = /** @class */ (function () {
110
110
  text.title = item.title;
111
111
  text.innerText = item.text;
112
112
  itemContainer.append(icon, text);
113
- switch (item.text) {
114
- case '上一步':
113
+ switch (item.key) {
114
+ case 'undo':
115
115
  _this.lf.on('history:change', function (_a) {
116
116
  var undoAble = _a.data.undoAble;
117
117
  itemContainer.className = undoAble ? NORMAL : DISABLED;
118
118
  });
119
119
  break;
120
- case '下一步':
120
+ case 'redo':
121
121
  _this.lf.on('history:change', function (_a) {
122
122
  var redoAble = _a.data.redoAble;
123
123
  itemContainer.className = redoAble ? NORMAL : DISABLED;
@@ -0,0 +1,21 @@
1
+ import LogicFlow from '@logicflow/core';
2
+ declare type IMode = 'single' | 'path';
3
+ declare class Highlight {
4
+ lf: LogicFlow;
5
+ static pluginName: string;
6
+ mode: IMode;
7
+ manual: boolean;
8
+ tempStyles: {};
9
+ constructor({ lf }: {
10
+ lf: any;
11
+ });
12
+ setMode(mode: IMode): void;
13
+ setManual(manual: boolean): void;
14
+ private highlightSingle;
15
+ private highlightPath;
16
+ highlight(id: string, mode?: IMode): void;
17
+ restoreHighlight(): void;
18
+ render(lf: any, domContainer: any): void;
19
+ destroy(): void;
20
+ }
21
+ export { Highlight };