@logicflow/extension 1.2.9 → 1.2.11

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 (141) hide show
  1. package/CHANGELOG.md +1727 -0
  2. package/cjs/NodeResize/Control/Control.js +35 -49
  3. package/cjs/bpmn/getBpmnId.js +25 -2
  4. package/cjs/bpmn-elements/index.js +102 -0
  5. package/cjs/bpmn-elements/presets/Event/EndEventFactory.js +134 -0
  6. package/cjs/bpmn-elements/presets/Event/IntermediateCatchEvent.js +118 -0
  7. package/cjs/bpmn-elements/presets/Event/IntermediateThrowEvent.js +119 -0
  8. package/cjs/bpmn-elements/presets/Event/StartEventFactory.js +133 -0
  9. package/cjs/bpmn-elements/presets/Event/boundaryEventFactory.js +125 -0
  10. package/cjs/bpmn-elements/presets/Event/index.js +16 -0
  11. package/cjs/bpmn-elements/presets/Flow/index.js +9 -0
  12. package/cjs/bpmn-elements/presets/Flow/sequenceFlow.js +78 -0
  13. package/cjs/bpmn-elements/presets/Gateway/gateway.js +109 -0
  14. package/cjs/bpmn-elements/presets/Gateway/index.js +14 -0
  15. package/cjs/bpmn-elements/presets/Task/index.js +134 -0
  16. package/cjs/bpmn-elements/presets/Task/subProcess.js +190 -0
  17. package/cjs/bpmn-elements/presets/Task/task.js +190 -0
  18. package/cjs/bpmn-elements/presets/icons.js +116 -0
  19. package/cjs/bpmn-elements/utils.js +45 -0
  20. package/cjs/bpmn-elements-adapter/constant.js +69 -0
  21. package/cjs/bpmn-elements-adapter/index.js +1066 -0
  22. package/cjs/bpmn-elements-adapter/json2xml.js +91 -0
  23. package/cjs/bpmn-elements-adapter/xml2json.js +554 -0
  24. package/cjs/components/control/index.js +1 -1
  25. package/cjs/components/menu/index.js +76 -7
  26. package/cjs/index.js +3 -1
  27. package/cjs/materials/group/index.js +16 -7
  28. package/cjs/tools/snapshot/index.js +14 -0
  29. package/es/NodeResize/Control/Control.d.ts +1 -0
  30. package/es/NodeResize/Control/Control.js +36 -50
  31. package/es/bpmn/getBpmnId.js +25 -2
  32. package/es/bpmn-elements/index.d.ts +16 -0
  33. package/es/bpmn-elements/index.js +88 -0
  34. package/es/bpmn-elements/presets/Event/EndEventFactory.d.ts +5 -0
  35. package/es/bpmn-elements/presets/Event/EndEventFactory.js +130 -0
  36. package/es/bpmn-elements/presets/Event/IntermediateCatchEvent.d.ts +5 -0
  37. package/es/bpmn-elements/presets/Event/IntermediateCatchEvent.js +114 -0
  38. package/es/bpmn-elements/presets/Event/IntermediateThrowEvent.d.ts +5 -0
  39. package/es/bpmn-elements/presets/Event/IntermediateThrowEvent.js +115 -0
  40. package/es/bpmn-elements/presets/Event/StartEventFactory.d.ts +5 -0
  41. package/es/bpmn-elements/presets/Event/StartEventFactory.js +129 -0
  42. package/es/bpmn-elements/presets/Event/boundaryEventFactory.d.ts +5 -0
  43. package/es/bpmn-elements/presets/Event/boundaryEventFactory.js +121 -0
  44. package/es/bpmn-elements/presets/Event/index.d.ts +2 -0
  45. package/es/bpmn-elements/presets/Event/index.js +12 -0
  46. package/es/bpmn-elements/presets/Flow/index.d.ts +7 -0
  47. package/es/bpmn-elements/presets/Flow/index.js +5 -0
  48. package/es/bpmn-elements/presets/Flow/sequenceFlow.d.ts +5 -0
  49. package/es/bpmn-elements/presets/Flow/sequenceFlow.js +74 -0
  50. package/es/bpmn-elements/presets/Gateway/gateway.d.ts +17 -0
  51. package/es/bpmn-elements/presets/Gateway/gateway.js +105 -0
  52. package/es/bpmn-elements/presets/Gateway/index.d.ts +2 -0
  53. package/es/bpmn-elements/presets/Gateway/index.js +10 -0
  54. package/es/bpmn-elements/presets/Task/index.d.ts +2 -0
  55. package/es/bpmn-elements/presets/Task/index.js +130 -0
  56. package/es/bpmn-elements/presets/Task/subProcess.d.ts +5 -0
  57. package/es/bpmn-elements/presets/Task/subProcess.js +186 -0
  58. package/es/bpmn-elements/presets/Task/task.d.ts +12 -0
  59. package/es/bpmn-elements/presets/Task/task.js +186 -0
  60. package/es/bpmn-elements/presets/icons.d.ts +25 -0
  61. package/es/bpmn-elements/presets/icons.js +113 -0
  62. package/es/bpmn-elements/utils.d.ts +2 -0
  63. package/es/bpmn-elements/utils.js +40 -0
  64. package/{types/bpmn → es/bpmn-elements-adapter}/constant.d.ts +20 -0
  65. package/es/bpmn-elements-adapter/constant.js +66 -0
  66. package/es/bpmn-elements-adapter/index.d.ts +103 -0
  67. package/es/bpmn-elements-adapter/index.js +1060 -0
  68. package/es/bpmn-elements-adapter/json2xml.d.ts +3 -0
  69. package/es/bpmn-elements-adapter/json2xml.js +87 -0
  70. package/es/bpmn-elements-adapter/xml2json.js +551 -0
  71. package/es/components/control/index.js +1 -1
  72. package/es/components/menu/index.js +76 -7
  73. package/es/index.d.ts +3 -1
  74. package/es/index.js +3 -1
  75. package/es/materials/group/index.js +16 -7
  76. package/es/tools/snapshot/index.js +14 -0
  77. package/lib/AutoLayout.js +1 -1
  78. package/lib/BpmnAdapter.js +1 -1
  79. package/lib/BpmnElement.js +1 -1
  80. package/lib/ContextMenu.js +1 -1
  81. package/lib/Control.js +1 -1
  82. package/lib/CurvedEdge.js +1 -1
  83. package/lib/DndPanel.js +1 -1
  84. package/lib/FlowPath.js +1 -1
  85. package/lib/Group.js +1 -1
  86. package/lib/Highlight.js +1 -1
  87. package/lib/InsertNodeInPolyline.js +1 -1
  88. package/lib/Menu.js +1 -1
  89. package/lib/MiniMap.js +1 -1
  90. package/lib/NodeResize.js +1 -1
  91. package/lib/RectLabelNode.js +1 -1
  92. package/lib/SelectionSelect.js +1 -1
  93. package/lib/Snapshot.js +1 -1
  94. package/lib/TurboAdapter.js +1 -1
  95. package/lib/lfJson2Xml.js +1 -1
  96. package/lib/lfXml2Json.js +1 -1
  97. package/package.json +3 -3
  98. package/types/NodeResize/BasicShape/Polygon.d.ts +0 -10
  99. package/types/NodeResize/BasicShape/Rect.d.ts +0 -17
  100. package/types/NodeResize/Control/Control.d.ts +0 -65
  101. package/types/NodeResize/Control/ControlGroup.d.ts +0 -13
  102. package/types/NodeResize/Control/Util.d.ts +0 -33
  103. package/types/NodeResize/Node/DiamondResize.d.ts +0 -30
  104. package/types/NodeResize/Node/EllipseResize.d.ts +0 -30
  105. package/types/NodeResize/Node/HtmlResize.d.ts +0 -30
  106. package/types/NodeResize/Node/RectResize.d.ts +0 -32
  107. package/types/NodeResize/index.d.ts +0 -11
  108. package/types/bpmn/events/EndEvent.d.ts +0 -21
  109. package/types/bpmn/events/StartEvent.d.ts +0 -17
  110. package/types/bpmn/flow/SequenceFlow.d.ts +0 -15
  111. package/types/bpmn/gateways/ExclusiveGateway.d.ts +0 -16
  112. package/types/bpmn/getBpmnId.d.ts +0 -1
  113. package/types/bpmn/index.d.ts +0 -13
  114. package/types/bpmn/tasks/ServiceTask.d.ts +0 -17
  115. package/types/bpmn/tasks/UserTask.d.ts +0 -17
  116. package/types/bpmn-adapter/bpmnIds.d.ts +0 -1
  117. package/types/bpmn-adapter/index.d.ts +0 -63
  118. package/types/bpmn-adapter/json2xml.d.ts +0 -3
  119. package/types/components/context-menu/index.d.ts +0 -34
  120. package/types/components/control/index.d.ts +0 -26
  121. package/types/components/dnd-panel/index.d.ts +0 -25
  122. package/types/components/highlight/index.d.ts +0 -21
  123. package/types/components/menu/index.d.ts +0 -50
  124. package/types/components/mini-map/index.d.ts +0 -88
  125. package/types/components/selection-select/index.d.ts +0 -42
  126. package/types/index.d.ts +0 -19
  127. package/types/insert-node-in-polyline/edge.d.ts +0 -31
  128. package/types/insert-node-in-polyline/index.d.ts +0 -28
  129. package/types/locale/en-locale/en.d.ts +0 -19
  130. package/types/locale/en-locale/index.d.ts +0 -9
  131. package/types/locale/locale.d.ts +0 -6
  132. package/types/materials/curved-edge/index.d.ts +0 -8
  133. package/types/materials/curved-edge/searchMiddleIndex.d.ts +0 -1
  134. package/types/materials/group/GroupNode.d.ts +0 -125
  135. package/types/materials/group/index.d.ts +0 -56
  136. package/types/tools/auto-layout/index.d.ts +0 -40
  137. package/types/tools/flow-path/index.d.ts +0 -47
  138. package/types/tools/snapshot/index.d.ts +0 -25
  139. package/types/turbo-adapter/index.d.ts +0 -21
  140. package/types/type/index.d.ts +0 -6
  141. /package/{types/bpmn-adapter → es/bpmn-elements-adapter}/xml2json.d.ts +0 -0
@@ -0,0 +1,114 @@
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
+ var __assign = (this && this.__assign) || function () {
15
+ __assign = Object.assign || function(t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
+ t[p] = s[p];
20
+ }
21
+ return t;
22
+ };
23
+ return __assign.apply(this, arguments);
24
+ };
25
+ var __read = (this && this.__read) || function (o, n) {
26
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27
+ if (!m) return o;
28
+ var i = m.call(o), r, ar = [], e;
29
+ try {
30
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31
+ }
32
+ catch (error) { e = { error: error }; }
33
+ finally {
34
+ try {
35
+ if (r && !r.done && (m = i["return"])) m.call(i);
36
+ }
37
+ finally { if (e) throw e.error; }
38
+ }
39
+ return ar;
40
+ };
41
+ var __spread = (this && this.__spread) || function () {
42
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
43
+ return ar;
44
+ };
45
+ /* eslint-disable @typescript-eslint/naming-convention */
46
+ import { CircleNode, CircleNodeModel, h, } from '@logicflow/core';
47
+ import { genBpmnId, groupRule } from '../../utils';
48
+ export function IntermediateCatchEventFactory(lf) {
49
+ var _a = __read(lf.useDefinition(), 1), definition = _a[0];
50
+ var view = /** @class */ (function (_super) {
51
+ __extends(view, _super);
52
+ function view() {
53
+ return _super !== null && _super.apply(this, arguments) || this;
54
+ }
55
+ view.prototype.getAnchorStyle = function () {
56
+ return {
57
+ visibility: 'hidden',
58
+ };
59
+ };
60
+ view.prototype.getShape = function () {
61
+ var _a;
62
+ // @ts-ignore
63
+ var model = this.props.model;
64
+ var style = model.getNodeStyle();
65
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
66
+ var definitionType = properties.definitionType;
67
+ var icon = (((_a = definition.intermediateCatchEvent) === null || _a === void 0 ? void 0 : _a.get(definitionType)) || {}).icon;
68
+ var i = Array.isArray(icon)
69
+ ? h.apply(void 0, __spread(['g', {
70
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
71
+ }], icon)) : h('path', {
72
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
73
+ d: icon,
74
+ });
75
+ return h('g', {}, h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r, strokeWidth: 1.5 })), h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 3, strokeWidth: 1.5 })), i);
76
+ };
77
+ return view;
78
+ }(CircleNode));
79
+ var model = /** @class */ (function (_super) {
80
+ __extends(model, _super);
81
+ function model(data, graphModel) {
82
+ var _a, _b, _c;
83
+ var _this = this;
84
+ if (!data.id) {
85
+ data.id = "Event_" + genBpmnId();
86
+ }
87
+ if (!data.text) {
88
+ data.text = '';
89
+ }
90
+ if (data.text && typeof data.text === 'string') {
91
+ data.text = {
92
+ value: data.text,
93
+ x: data.x,
94
+ y: data.y + 40,
95
+ };
96
+ }
97
+ var _d = (((_a = definition.intermediateCatchEvent) === null || _a === void 0 ? void 0 : _a.get((_b = data.properties) === null || _b === void 0 ? void 0 : _b.definitionType)) || {}).properties, properties = _d === void 0 ? {} : _d;
98
+ data.properties = __assign(__assign({}, properties), data.properties);
99
+ ((_c = data.properties) === null || _c === void 0 ? void 0 : _c.definitionType) && (data.properties.definitionId = "Definition_" + genBpmnId());
100
+ _this = _super.call(this, data, graphModel) || this;
101
+ groupRule.call(_this);
102
+ return _this;
103
+ }
104
+ model.prototype.setAttributes = function () {
105
+ this.r = 18;
106
+ };
107
+ return model;
108
+ }(CircleNodeModel));
109
+ return {
110
+ type: 'bpmn:intermediateCatchEvent',
111
+ view: view,
112
+ model: model,
113
+ };
114
+ }
@@ -0,0 +1,5 @@
1
+ export declare function IntermediateThrowEventFactory(lf: any): {
2
+ type: string;
3
+ model: any;
4
+ view: any;
5
+ };
@@ -0,0 +1,115 @@
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
+ var __assign = (this && this.__assign) || function () {
15
+ __assign = Object.assign || function(t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
+ t[p] = s[p];
20
+ }
21
+ return t;
22
+ };
23
+ return __assign.apply(this, arguments);
24
+ };
25
+ var __read = (this && this.__read) || function (o, n) {
26
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27
+ if (!m) return o;
28
+ var i = m.call(o), r, ar = [], e;
29
+ try {
30
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31
+ }
32
+ catch (error) { e = { error: error }; }
33
+ finally {
34
+ try {
35
+ if (r && !r.done && (m = i["return"])) m.call(i);
36
+ }
37
+ finally { if (e) throw e.error; }
38
+ }
39
+ return ar;
40
+ };
41
+ var __spread = (this && this.__spread) || function () {
42
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
43
+ return ar;
44
+ };
45
+ /* eslint-disable @typescript-eslint/naming-convention */
46
+ import { CircleNode, CircleNodeModel, h, } from '@logicflow/core';
47
+ import { genBpmnId, groupRule } from '../../utils';
48
+ export function IntermediateThrowEventFactory(lf) {
49
+ var _a = __read(lf.useDefinition(), 1), definition = _a[0];
50
+ var view = /** @class */ (function (_super) {
51
+ __extends(view, _super);
52
+ function view() {
53
+ return _super !== null && _super.apply(this, arguments) || this;
54
+ }
55
+ view.prototype.getAnchorStyle = function () {
56
+ return {
57
+ visibility: 'hidden',
58
+ };
59
+ };
60
+ view.prototype.getShape = function () {
61
+ var _a;
62
+ // @ts-ignore
63
+ var model = this.props.model;
64
+ var style = model.getNodeStyle();
65
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
66
+ var definitionType = properties.definitionType;
67
+ var icon = (((_a = definition.intermediateThrowEvent) === null || _a === void 0 ? void 0 : _a.get(definitionType)) || {}).icon;
68
+ var i = Array.isArray(icon)
69
+ ? h.apply(void 0, __spread(['g', {
70
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
71
+ }], icon)) : h('path', {
72
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
73
+ d: icon,
74
+ style: 'fill: black',
75
+ });
76
+ return h('g', {}, h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r, strokeWidth: 1.5 })), h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 3, strokeWidth: 1.5 })), i);
77
+ };
78
+ return view;
79
+ }(CircleNode));
80
+ var model = /** @class */ (function (_super) {
81
+ __extends(model, _super);
82
+ function model(data, graphModel) {
83
+ var _a, _b, _c;
84
+ var _this = this;
85
+ if (!data.id) {
86
+ data.id = "Event_" + genBpmnId();
87
+ }
88
+ if (!data.text) {
89
+ data.text = '';
90
+ }
91
+ if (data.text && typeof data.text === 'string') {
92
+ data.text = {
93
+ value: data.text,
94
+ x: data.x,
95
+ y: data.y + 40,
96
+ };
97
+ }
98
+ var _d = (((_a = definition.intermediateThrowEvent) === null || _a === void 0 ? void 0 : _a.get((_b = data.properties) === null || _b === void 0 ? void 0 : _b.definitionType)) || {}).properties, properties = _d === void 0 ? {} : _d;
99
+ data.properties = __assign(__assign({}, properties), data.properties);
100
+ ((_c = data.properties) === null || _c === void 0 ? void 0 : _c.definitionType) && (data.properties.definitionId = "Definition_" + genBpmnId());
101
+ _this = _super.call(this, data, graphModel) || this;
102
+ groupRule.call(_this);
103
+ return _this;
104
+ }
105
+ model.prototype.setAttributes = function () {
106
+ this.r = 18;
107
+ };
108
+ return model;
109
+ }(CircleNodeModel));
110
+ return {
111
+ type: 'bpmn:intermediateThrowEvent',
112
+ view: view,
113
+ model: model,
114
+ };
115
+ }
@@ -0,0 +1,5 @@
1
+ export declare function StartEventFactory(lf: any): {
2
+ type: string;
3
+ model: any;
4
+ view: any;
5
+ };
@@ -0,0 +1,129 @@
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
+ var __assign = (this && this.__assign) || function () {
15
+ __assign = Object.assign || function(t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
+ t[p] = s[p];
20
+ }
21
+ return t;
22
+ };
23
+ return __assign.apply(this, arguments);
24
+ };
25
+ var __read = (this && this.__read) || function (o, n) {
26
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27
+ if (!m) return o;
28
+ var i = m.call(o), r, ar = [], e;
29
+ try {
30
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31
+ }
32
+ catch (error) { e = { error: error }; }
33
+ finally {
34
+ try {
35
+ if (r && !r.done && (m = i["return"])) m.call(i);
36
+ }
37
+ finally { if (e) throw e.error; }
38
+ }
39
+ return ar;
40
+ };
41
+ var __spread = (this && this.__spread) || function () {
42
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
43
+ return ar;
44
+ };
45
+ /* eslint-disable @typescript-eslint/naming-convention */
46
+ import { CircleNode, CircleNodeModel, h, } from '@logicflow/core';
47
+ import { genBpmnId } from '../../utils';
48
+ export function StartEventFactory(lf) {
49
+ var _a = __read(lf.useDefinition(), 1), definition = _a[0];
50
+ var view = /** @class */ (function (_super) {
51
+ __extends(view, _super);
52
+ function view() {
53
+ return _super !== null && _super.apply(this, arguments) || this;
54
+ }
55
+ view.prototype.getAnchorStyle = function () {
56
+ return {
57
+ visibility: 'hidden',
58
+ };
59
+ };
60
+ view.prototype.getShape = function () {
61
+ var _a;
62
+ // @ts-ignore
63
+ var model = this.props.model;
64
+ var style = model.getNodeStyle();
65
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
66
+ var definitionType = properties.definitionType, isInterrupting = properties.isInterrupting;
67
+ var icon = (((_a = definition.startEvent) === null || _a === void 0 ? void 0 : _a.get(definitionType)) || {}).icon;
68
+ var i = Array.isArray(icon)
69
+ ? h.apply(void 0, __spread(['g', {
70
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
71
+ }], icon)) : h('path', {
72
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
73
+ d: icon,
74
+ style: 'fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
75
+ });
76
+ return h('g', {}, h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r, strokeDasharray: isInterrupting ? '5,5' : '', strokeWidth: 2 })), i);
77
+ };
78
+ return view;
79
+ }(CircleNode));
80
+ var model = /** @class */ (function (_super) {
81
+ __extends(model, _super);
82
+ function model(data, graphModel) {
83
+ var _a, _b, _c;
84
+ var _this = this;
85
+ if (!data.id) {
86
+ data.id = "Event_" + genBpmnId();
87
+ }
88
+ if (!data.text) {
89
+ data.text = '';
90
+ }
91
+ if (data.text && typeof data.text === 'string') {
92
+ data.text = {
93
+ value: data.text,
94
+ x: data.x,
95
+ y: data.y + 40,
96
+ };
97
+ }
98
+ var _d = (((_a = definition.startEvent) === null || _a === void 0 ? void 0 : _a.get((_b = data.properties) === null || _b === void 0 ? void 0 : _b.definitionType)) || {}).properties, properties = _d === void 0 ? {} : _d;
99
+ data.properties = __assign(__assign({}, properties), data.properties);
100
+ ((_c = data.properties) === null || _c === void 0 ? void 0 : _c.definitionType) && (data.properties.definitionId = "Definition_" + genBpmnId());
101
+ _this = _super.call(this, data, graphModel) || this;
102
+ return _this;
103
+ }
104
+ model.prototype.setAttributes = function () {
105
+ this.r = 18;
106
+ };
107
+ model.prototype.getConnectedTargetRules = function () {
108
+ var _this = this;
109
+ var rules = _super.prototype.getConnectedTargetRules.call(this);
110
+ var notAsSource = {
111
+ message: '起始节点不能作为边的终点',
112
+ validate: function (_source, target) {
113
+ if (target === _this) {
114
+ return false;
115
+ }
116
+ return true;
117
+ },
118
+ };
119
+ rules.push(notAsSource);
120
+ return rules;
121
+ };
122
+ return model;
123
+ }(CircleNodeModel));
124
+ return {
125
+ type: 'bpmn:startEvent',
126
+ view: view,
127
+ model: model,
128
+ };
129
+ }
@@ -0,0 +1,5 @@
1
+ export declare function BoundaryEventFactory(lf: any): {
2
+ type: string;
3
+ model: any;
4
+ view: any;
5
+ };
@@ -0,0 +1,121 @@
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
+ var __assign = (this && this.__assign) || function () {
15
+ __assign = Object.assign || function(t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
+ t[p] = s[p];
20
+ }
21
+ return t;
22
+ };
23
+ return __assign.apply(this, arguments);
24
+ };
25
+ var __read = (this && this.__read) || function (o, n) {
26
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27
+ if (!m) return o;
28
+ var i = m.call(o), r, ar = [], e;
29
+ try {
30
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31
+ }
32
+ catch (error) { e = { error: error }; }
33
+ finally {
34
+ try {
35
+ if (r && !r.done && (m = i["return"])) m.call(i);
36
+ }
37
+ finally { if (e) throw e.error; }
38
+ }
39
+ return ar;
40
+ };
41
+ var __spread = (this && this.__spread) || function () {
42
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
43
+ return ar;
44
+ };
45
+ /* eslint-disable max-len */
46
+ /* eslint-disable @typescript-eslint/naming-convention */
47
+ import { CircleNode, CircleNodeModel, h, } from '@logicflow/core';
48
+ import { genBpmnId, groupRule } from '../../utils';
49
+ export function BoundaryEventFactory(lf) {
50
+ var _a = __read(lf.useDefinition(), 1), definition = _a[0];
51
+ var view = /** @class */ (function (_super) {
52
+ __extends(view, _super);
53
+ function view() {
54
+ return _super !== null && _super.apply(this, arguments) || this;
55
+ }
56
+ view.prototype.getAnchorStyle = function () {
57
+ return {
58
+ visibility: 'hidden',
59
+ };
60
+ };
61
+ view.prototype.getShape = function () {
62
+ var _a;
63
+ // @ts-ignore
64
+ var model = this.props.model;
65
+ var style = model.getNodeStyle();
66
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
67
+ var definitionType = properties.definitionType, cancelActivity = properties.cancelActivity;
68
+ var icon = (((_a = definition.boundaryEvent) === null || _a === void 0 ? void 0 : _a.get(definitionType)) || {}).icon;
69
+ var i = Array.isArray(icon)
70
+ ? h.apply(void 0, __spread(['g', {
71
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
72
+ }], icon)) : h('path', {
73
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
74
+ d: icon,
75
+ });
76
+ return h('g', {}, h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r, strokeDasharray: cancelActivity ? '5,5' : '', strokeWidth: 1.5 })), h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 3, strokeDasharray: cancelActivity ? '5,5' : '', strokeWidth: 1.5 })), i);
77
+ };
78
+ return view;
79
+ }(CircleNode));
80
+ var model = /** @class */ (function (_super) {
81
+ __extends(model, _super);
82
+ function model(data, graphModel) {
83
+ var _a, _b, _c;
84
+ var _this = this;
85
+ if (!data.id) {
86
+ data.id = "Event_" + genBpmnId();
87
+ }
88
+ if (!data.text) {
89
+ data.text = '';
90
+ }
91
+ if (data.text && typeof data.text === 'string') {
92
+ data.text = {
93
+ value: data.text,
94
+ x: data.x,
95
+ y: data.y + 40,
96
+ };
97
+ }
98
+ var _d = (((_a = definition.boundaryEvent) === null || _a === void 0 ? void 0 : _a.get((_b = data.properties) === null || _b === void 0 ? void 0 : _b.definitionType)) || {}).properties, properties = _d === void 0 ? {} : _d;
99
+ data.properties = __assign(__assign({ attachedToRef: '', cancelActivity: false }, properties), data.properties);
100
+ ((_c = data.properties) === null || _c === void 0 ? void 0 : _c.definitionType) && (data.properties.definitionId = "Definition_" + genBpmnId());
101
+ _this = _super.call(this, data, graphModel) || this;
102
+ groupRule.call(_this);
103
+ return _this;
104
+ }
105
+ model.prototype.initNodeData = function (data) {
106
+ _super.prototype.initNodeData.call(this, data);
107
+ this.r = 20;
108
+ this.autoToFront = false; // 不自动设置到最顶部,而是使用自己的zIndex
109
+ this.zIndex = 99999; // 保证边界事件节点用于在最上方
110
+ };
111
+ model.prototype.setAttributes = function () {
112
+ this.r = 18;
113
+ };
114
+ return model;
115
+ }(CircleNodeModel));
116
+ return {
117
+ type: 'bpmn:boundaryEvent',
118
+ view: view,
119
+ model: model,
120
+ };
121
+ }
@@ -0,0 +1,2 @@
1
+ import LogicFlow from '@logicflow/core';
2
+ export declare function registerEventNodes(lf: LogicFlow): void;
@@ -0,0 +1,12 @@
1
+ import { EndEventFactory } from './EndEventFactory';
2
+ import { IntermediateCatchEventFactory } from './IntermediateCatchEvent';
3
+ import { StartEventFactory } from './StartEventFactory';
4
+ import { BoundaryEventFactory } from './boundaryEventFactory';
5
+ import { IntermediateThrowEventFactory } from './IntermediateThrowEvent';
6
+ export function registerEventNodes(lf) {
7
+ lf.register(StartEventFactory(lf));
8
+ lf.register(EndEventFactory(lf));
9
+ lf.register(IntermediateCatchEventFactory(lf));
10
+ lf.register(IntermediateThrowEventFactory(lf));
11
+ lf.register(BoundaryEventFactory(lf));
12
+ }
@@ -0,0 +1,7 @@
1
+ import LogicFlow from '@logicflow/core';
2
+ export declare const SequenceFlow: {
3
+ type: string;
4
+ model: any;
5
+ view: any;
6
+ };
7
+ export declare function registerFlows(lf: LogicFlow): void;
@@ -0,0 +1,5 @@
1
+ import { sequenceFlowFactory } from './sequenceFlow';
2
+ export var SequenceFlow = sequenceFlowFactory();
3
+ export function registerFlows(lf) {
4
+ lf.register(SequenceFlow);
5
+ }
@@ -0,0 +1,5 @@
1
+ export declare function sequenceFlowFactory(props?: any): {
2
+ type: string;
3
+ model: any;
4
+ view: any;
5
+ };
@@ -0,0 +1,74 @@
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
+ var __assign = (this && this.__assign) || function () {
15
+ __assign = Object.assign || function(t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
+ t[p] = s[p];
20
+ }
21
+ return t;
22
+ };
23
+ return __assign.apply(this, arguments);
24
+ };
25
+ /* eslint-disable @typescript-eslint/naming-convention */
26
+ import { PolylineEdge, PolylineEdgeModel, h, } from '@logicflow/core';
27
+ import { genBpmnId } from '../../utils';
28
+ export function sequenceFlowFactory(props) {
29
+ var model = /** @class */ (function (_super) {
30
+ __extends(model, _super);
31
+ function model(data, graphModel) {
32
+ var _this = this;
33
+ if (!data.id) {
34
+ data.id = "Flow_" + genBpmnId();
35
+ }
36
+ var properties = __assign(__assign(__assign({}, (props || {})), data.properties), {
37
+ // panels: ['condition'],
38
+ isDefaultFlow: false });
39
+ data.properties = properties;
40
+ _this = _super.call(this, data, graphModel) || this;
41
+ return _this;
42
+ }
43
+ model.extendKey = 'SequenceFlowModel';
44
+ return model;
45
+ }(PolylineEdgeModel));
46
+ var view = /** @class */ (function (_super) {
47
+ __extends(view, _super);
48
+ function view() {
49
+ return _super !== null && _super.apply(this, arguments) || this;
50
+ }
51
+ view.prototype.getStartArrow = function () {
52
+ // eslint-disable-next-line no-shadow
53
+ var model = this.props.model;
54
+ var isDefaultFlow = model.properties.isDefaultFlow;
55
+ return isDefaultFlow
56
+ ? h('path', {
57
+ refX: 15,
58
+ stroke: '#000000',
59
+ strokeWidth: 2,
60
+ d: 'M 20 5 10 -5 z',
61
+ })
62
+ : h('path', {
63
+ d: '',
64
+ });
65
+ };
66
+ view.extendKey = 'SequenceFlowEdge';
67
+ return view;
68
+ }(PolylineEdge));
69
+ return {
70
+ type: 'bpmn:sequenceFlow',
71
+ view: view,
72
+ model: model,
73
+ };
74
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * index 0 排他网关
3
+ * index 1 包容网关
4
+ * index 2 并行网关
5
+ */
6
+ export declare const gatewayComposable: number[][];
7
+ /**
8
+ * @param type 网关节点的type, 对应其XML定义中的节点名,如<bpmn:inclusiveGateway /> 其type为bpmn:inclusiveGateway
9
+ * @param icon 网关节点左上角的图标,可以是svg path,也可以是h函数生成的svg
10
+ * @param props (可选) 网关节点的属性
11
+ * @returns { type: string, model: any, view: any }
12
+ */
13
+ export declare function GatewayNodeFactory(type: string, icon: string | object, props?: any): {
14
+ type: string;
15
+ model: any;
16
+ view: any;
17
+ };