@logicflow/extension 1.2.0-alpha.2 → 1.2.0-alpha.5

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 (50) hide show
  1. package/cjs/NodeResize/Control/Control.js +8 -4
  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 +3 -3
  8. package/cjs/turbo-adapter/index.js +71 -41
  9. package/es/NodeResize/Control/Control.js +8 -4
  10. package/es/NodeResize/Node/DiamondResize.d.ts +1 -1
  11. package/es/NodeResize/Node/DiamondResize.js +10 -8
  12. package/es/NodeResize/Node/EllipseResize.d.ts +1 -1
  13. package/es/NodeResize/Node/EllipseResize.js +10 -8
  14. package/es/NodeResize/Node/HtmlResize.d.ts +1 -1
  15. package/es/NodeResize/Node/HtmlResize.js +10 -8
  16. package/es/NodeResize/Node/RectResize.d.ts +1 -1
  17. package/es/NodeResize/Node/RectResize.js +10 -8
  18. package/es/bpmn-adapter/index.js +1 -1
  19. package/es/components/control/index.js +3 -3
  20. package/es/turbo-adapter/index.d.ts +6 -7
  21. package/es/turbo-adapter/index.js +70 -40
  22. package/lib/AutoLayout.js +1 -1
  23. package/lib/BpmnAdapter.js +1 -1
  24. package/lib/BpmnElement.js +1 -1
  25. package/lib/ContextMenu.js +1 -1
  26. package/lib/Control.js +1 -1
  27. package/lib/CurvedEdge.js +1 -1
  28. package/lib/DndPanel.js +1 -1
  29. package/lib/EnLocale.js +1 -1
  30. package/lib/FlowPath.js +1 -1
  31. package/lib/Group.js +1 -1
  32. package/lib/InsertNodeInPolyline.js +1 -1
  33. package/lib/Menu.js +1 -1
  34. package/lib/MiniMap.js +1 -1
  35. package/lib/NodeResize.js +1 -1
  36. package/lib/RectLabelNode.js +1 -1
  37. package/lib/SelectionSelect.js +1 -1
  38. package/lib/Snapshot.js +1 -1
  39. package/lib/TurboAdapter.js +1 -1
  40. package/lib/lfJson2Xml.js +1 -1
  41. package/lib/lfXml2Json.js +1 -1
  42. package/package.json +2 -2
  43. package/types/NodeResize/Node/DiamondResize.d.ts +1 -1
  44. package/types/NodeResize/Node/EllipseResize.d.ts +1 -1
  45. package/types/NodeResize/Node/HtmlResize.d.ts +1 -1
  46. package/types/NodeResize/Node/RectResize.d.ts +1 -1
  47. package/types/turbo-adapter/index.d.ts +6 -7
  48. package/types/NodeResize/BasicShape/Ellipse.d.ts +0 -2
  49. package/types/curved.d.ts +0 -0
  50. package/types/group-shrink/index.d.ts +0 -28
@@ -37,9 +37,11 @@ var Control = /** @class */ (function (_super) {
37
37
  _this.updatePosition = function (_a) {
38
38
  var deltaX = _a.deltaX, deltaY = _a.deltaY;
39
39
  var _b = _this.nodeModel, x = _b.x, y = _b.y;
40
- _this.nodeModel.x = x + deltaX / 2;
41
- _this.nodeModel.y = y + deltaY / 2;
42
40
  _this.nodeModel.moveText(deltaX / 2, deltaY / 2);
41
+ _this.nodeModel.updateAttributes({
42
+ x: x + deltaX / 2,
43
+ y: y + deltaY / 2,
44
+ });
43
45
  };
44
46
  // 计算control拖动后,节点的宽高
45
47
  _this.getResize = function (_a) {
@@ -93,14 +95,16 @@ var Control = /** @class */ (function (_super) {
93
95
  }
94
96
  _this.updatePosition({ deltaX: deltaX, deltaY: deltaY });
95
97
  // 更新宽高
96
- _this.nodeModel.width = size.width;
97
- _this.nodeModel.height = size.height;
98
98
  _this.nodeModel.setProperties({
99
99
  nodeSize: {
100
100
  width: size.width,
101
101
  height: size.height,
102
102
  },
103
103
  });
104
+ _this.nodeModel.updateAttributes({
105
+ width: size.width,
106
+ height: size.height,
107
+ });
104
108
  var edges = _this.getNodeEdges(id);
105
109
  var beforeNode = {
106
110
  x: x,
@@ -29,14 +29,8 @@ var ControlGroup_1 = require("../Control/ControlGroup");
29
29
  var Polygon_1 = require("../BasicShape/Polygon");
30
30
  var DiamondResizeModel = /** @class */ (function (_super) {
31
31
  __extends(DiamondResizeModel, _super);
32
- function DiamondResizeModel(data, graphModel) {
33
- var _this = _super.call(this, data, graphModel) || this;
34
- var nodeSize = _this.properties.nodeSize;
35
- if (nodeSize) {
36
- _this.rx = nodeSize.rx;
37
- _this.ry = nodeSize.ry;
38
- }
39
- return _this;
32
+ function DiamondResizeModel() {
33
+ return _super !== null && _super.apply(this, arguments) || this;
40
34
  }
41
35
  DiamondResizeModel.prototype.initNodeData = function (data) {
42
36
  _super.prototype.initNodeData.call(this, data);
@@ -46,6 +40,14 @@ var DiamondResizeModel = /** @class */ (function (_super) {
46
40
  this.maxHeight = 2000;
47
41
  this.gridSize = 1;
48
42
  };
43
+ DiamondResizeModel.prototype.init = function () {
44
+ _super.prototype.init.call(this);
45
+ var nodeSize = this.properties.nodeSize;
46
+ if (nodeSize) {
47
+ this.rx = nodeSize.rx;
48
+ this.ry = nodeSize.ry;
49
+ }
50
+ };
49
51
  DiamondResizeModel.prototype.getOutlineStyle = function () {
50
52
  var style = _super.prototype.getOutlineStyle.call(this);
51
53
  style.stroke = 'none';
@@ -17,14 +17,8 @@ var core_1 = require("@logicflow/core");
17
17
  var ControlGroup_1 = require("../Control/ControlGroup");
18
18
  var EllipseResizeModel = /** @class */ (function (_super) {
19
19
  __extends(EllipseResizeModel, _super);
20
- function EllipseResizeModel(data, graphModel) {
21
- var _this = _super.call(this, data, graphModel) || this;
22
- var nodeSize = _this.properties.nodeSize;
23
- if (nodeSize) {
24
- _this.rx = nodeSize.rx;
25
- _this.ry = nodeSize.ry;
26
- }
27
- return _this;
20
+ function EllipseResizeModel() {
21
+ return _super !== null && _super.apply(this, arguments) || this;
28
22
  }
29
23
  EllipseResizeModel.prototype.initNodeData = function (data) {
30
24
  _super.prototype.initNodeData.call(this, data);
@@ -33,6 +27,14 @@ var EllipseResizeModel = /** @class */ (function (_super) {
33
27
  this.maxWidth = 2000;
34
28
  this.maxHeight = 2000;
35
29
  };
30
+ EllipseResizeModel.prototype.init = function () {
31
+ _super.prototype.init.call(this);
32
+ var nodeSize = this.properties.nodeSize;
33
+ if (nodeSize) {
34
+ this.rx = nodeSize.rx;
35
+ this.ry = nodeSize.ry;
36
+ }
37
+ };
36
38
  EllipseResizeModel.prototype.getOutlineStyle = function () {
37
39
  var style = _super.prototype.getOutlineStyle.call(this);
38
40
  style.stroke = 'none';
@@ -17,14 +17,8 @@ var core_1 = require("@logicflow/core");
17
17
  var ControlGroup_1 = require("../Control/ControlGroup");
18
18
  var HtmlResizeModel = /** @class */ (function (_super) {
19
19
  __extends(HtmlResizeModel, _super);
20
- function HtmlResizeModel(data, graphModel) {
21
- var _this = _super.call(this, data, graphModel) || this;
22
- var nodeSize = _this.properties.nodeSize;
23
- if (nodeSize) {
24
- _this.width = nodeSize.width;
25
- _this.height = nodeSize.height;
26
- }
27
- return _this;
20
+ function HtmlResizeModel() {
21
+ return _super !== null && _super.apply(this, arguments) || this;
28
22
  }
29
23
  HtmlResizeModel.prototype.initNodeData = function (data) {
30
24
  _super.prototype.initNodeData.call(this, data);
@@ -33,6 +27,14 @@ var HtmlResizeModel = /** @class */ (function (_super) {
33
27
  this.maxWidth = 2000;
34
28
  this.maxHeight = 2000;
35
29
  };
30
+ HtmlResizeModel.prototype.init = function () {
31
+ _super.prototype.init.call(this);
32
+ var nodeSize = this.properties.nodeSize;
33
+ if (nodeSize) {
34
+ this.width = nodeSize.width;
35
+ this.height = nodeSize.height;
36
+ }
37
+ };
36
38
  HtmlResizeModel.prototype.getOutlineStyle = function () {
37
39
  var style = _super.prototype.getOutlineStyle.call(this);
38
40
  style.stroke = 'none';
@@ -17,14 +17,8 @@ var core_1 = require("@logicflow/core");
17
17
  var ControlGroup_1 = require("../Control/ControlGroup");
18
18
  var RectResizeModel = /** @class */ (function (_super) {
19
19
  __extends(RectResizeModel, _super);
20
- function RectResizeModel(data, graphModel) {
21
- var _this = _super.call(this, data, graphModel) || this;
22
- var nodeSize = _this.properties.nodeSize;
23
- if (nodeSize) {
24
- _this.width = nodeSize.width;
25
- _this.height = nodeSize.height;
26
- }
27
- return _this;
20
+ function RectResizeModel() {
21
+ return _super !== null && _super.apply(this, arguments) || this;
28
22
  }
29
23
  RectResizeModel.prototype.initNodeData = function (data) {
30
24
  _super.prototype.initNodeData.call(this, data);
@@ -33,6 +27,14 @@ var RectResizeModel = /** @class */ (function (_super) {
33
27
  this.maxWidth = 2000;
34
28
  this.maxHeight = 2000;
35
29
  };
30
+ RectResizeModel.prototype.init = function () {
31
+ _super.prototype.init.call(this);
32
+ var nodeSize = this.properties.nodeSize;
33
+ if (nodeSize) {
34
+ this.width = nodeSize.width;
35
+ this.height = nodeSize.height;
36
+ }
37
+ };
36
38
  RectResizeModel.prototype.getOutlineStyle = function () {
37
39
  var style = _super.prototype.getOutlineStyle.call(this);
38
40
  style.stroke = 'none';
@@ -179,7 +179,7 @@ function convertLf2ProcessData(bpmnProcessData, data) {
179
179
  return edgeConfig;
180
180
  });
181
181
  // @see https://github.com/didi/LogicFlow/issues/325
182
- // 需要保证incomming在outgoing之前
182
+ // 需要保证incoming在outgoing之前
183
183
  data.edges.forEach(function (edge) {
184
184
  var sourceNode = nodeMap.get(edge.sourceNodeId);
185
185
  if (!sourceNode['bpmn:outgoing']) {
@@ -113,14 +113,14 @@ var Control = /** @class */ (function () {
113
113
  text.title = item.title;
114
114
  text.innerText = item.text;
115
115
  itemContainer.append(icon, text);
116
- switch (item.text) {
117
- case '上一步':
116
+ switch (item.key) {
117
+ case 'undo':
118
118
  _this.lf.on('history:change', function (_a) {
119
119
  var undoAble = _a.data.undoAble;
120
120
  itemContainer.className = undoAble ? NORMAL : DISABLED;
121
121
  });
122
122
  break;
123
- case '下一步':
123
+ case 'redo':
124
124
  _this.lf.on('history:change', function (_a) {
125
125
  var redoAble = _a.data.redoAble;
126
126
  itemContainer.className = redoAble ? NORMAL : DISABLED;
@@ -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) {
@@ -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,
@@ -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']) {
@@ -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;
@@ -5,11 +5,11 @@ export declare function toLogicflowData(data: any): {
5
5
  nodes: any[];
6
6
  edges: any[];
7
7
  };
8
- declare const TurboAdapter: {
9
- pluginName: string;
10
- install(lf: any): void;
11
- shapeConfigMap: Map<any, any>;
12
- setCustomShape(key: any, val: any): void;
8
+ declare class TurboAdapter {
9
+ static pluginName: string;
10
+ constructor({ lf }: {
11
+ lf: any;
12
+ });
13
13
  adapterOut(logicflowData: any): {
14
14
  flowElementList: any[];
15
15
  };
@@ -17,6 +17,5 @@ declare const TurboAdapter: {
17
17
  nodes: any[];
18
18
  edges: any[];
19
19
  };
20
- };
21
- export { TurboAdapter };
20
+ }
22
21
  export default TurboAdapter;