@logicflow/extension 1.2.0-alpha.4 → 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.
@@ -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']) {
@@ -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']) {