@logicflow/extension 1.2.10 → 1.2.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 (136) hide show
  1. package/CHANGELOG.md +1745 -0
  2. package/cjs/bpmn/getBpmnId.js +25 -2
  3. package/cjs/bpmn-adapter/bpmnIds.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/index.js +3 -1
  25. package/cjs/materials/group/index.js +16 -7
  26. package/cjs/tools/snapshot/index.js +14 -0
  27. package/es/bpmn/getBpmnId.js +25 -2
  28. package/es/bpmn-adapter/bpmnIds.js +25 -2
  29. package/es/bpmn-elements/index.d.ts +16 -0
  30. package/es/bpmn-elements/index.js +88 -0
  31. package/es/bpmn-elements/presets/Event/EndEventFactory.d.ts +5 -0
  32. package/es/bpmn-elements/presets/Event/EndEventFactory.js +130 -0
  33. package/es/bpmn-elements/presets/Event/IntermediateCatchEvent.d.ts +5 -0
  34. package/es/bpmn-elements/presets/Event/IntermediateCatchEvent.js +114 -0
  35. package/es/bpmn-elements/presets/Event/IntermediateThrowEvent.d.ts +5 -0
  36. package/es/bpmn-elements/presets/Event/IntermediateThrowEvent.js +115 -0
  37. package/es/bpmn-elements/presets/Event/StartEventFactory.d.ts +5 -0
  38. package/es/bpmn-elements/presets/Event/StartEventFactory.js +129 -0
  39. package/es/bpmn-elements/presets/Event/boundaryEventFactory.d.ts +5 -0
  40. package/es/bpmn-elements/presets/Event/boundaryEventFactory.js +121 -0
  41. package/es/bpmn-elements/presets/Event/index.d.ts +2 -0
  42. package/es/bpmn-elements/presets/Event/index.js +12 -0
  43. package/es/bpmn-elements/presets/Flow/index.d.ts +7 -0
  44. package/es/bpmn-elements/presets/Flow/index.js +5 -0
  45. package/es/bpmn-elements/presets/Flow/sequenceFlow.d.ts +5 -0
  46. package/es/bpmn-elements/presets/Flow/sequenceFlow.js +74 -0
  47. package/es/bpmn-elements/presets/Gateway/gateway.d.ts +17 -0
  48. package/es/bpmn-elements/presets/Gateway/gateway.js +105 -0
  49. package/es/bpmn-elements/presets/Gateway/index.d.ts +2 -0
  50. package/es/bpmn-elements/presets/Gateway/index.js +10 -0
  51. package/es/bpmn-elements/presets/Task/index.d.ts +2 -0
  52. package/es/bpmn-elements/presets/Task/index.js +130 -0
  53. package/es/bpmn-elements/presets/Task/subProcess.d.ts +5 -0
  54. package/es/bpmn-elements/presets/Task/subProcess.js +186 -0
  55. package/es/bpmn-elements/presets/Task/task.d.ts +12 -0
  56. package/es/bpmn-elements/presets/Task/task.js +186 -0
  57. package/es/bpmn-elements/presets/icons.d.ts +25 -0
  58. package/es/bpmn-elements/presets/icons.js +113 -0
  59. package/es/bpmn-elements/utils.d.ts +2 -0
  60. package/es/bpmn-elements/utils.js +40 -0
  61. package/{types/bpmn → es/bpmn-elements-adapter}/constant.d.ts +20 -0
  62. package/es/bpmn-elements-adapter/constant.js +66 -0
  63. package/es/bpmn-elements-adapter/index.d.ts +103 -0
  64. package/es/bpmn-elements-adapter/index.js +1060 -0
  65. package/es/bpmn-elements-adapter/json2xml.d.ts +3 -0
  66. package/es/bpmn-elements-adapter/json2xml.js +87 -0
  67. package/es/bpmn-elements-adapter/xml2json.js +551 -0
  68. package/es/index.d.ts +3 -1
  69. package/es/index.js +3 -1
  70. package/es/materials/group/index.js +16 -7
  71. package/es/tools/snapshot/index.js +14 -0
  72. package/lib/AutoLayout.js +1 -1
  73. package/lib/BpmnAdapter.js +1 -1
  74. package/lib/BpmnElement.js +1 -1
  75. package/lib/ContextMenu.js +1 -1
  76. package/lib/Control.js +1 -1
  77. package/lib/CurvedEdge.js +1 -1
  78. package/lib/DndPanel.js +1 -1
  79. package/lib/FlowPath.js +1 -1
  80. package/lib/Group.js +1 -1
  81. package/lib/Highlight.js +1 -1
  82. package/lib/InsertNodeInPolyline.js +1 -1
  83. package/lib/Menu.js +1 -1
  84. package/lib/MiniMap.js +1 -1
  85. package/lib/NodeResize.js +1 -1
  86. package/lib/RectLabelNode.js +1 -1
  87. package/lib/SelectionSelect.js +1 -1
  88. package/lib/Snapshot.js +1 -1
  89. package/lib/TurboAdapter.js +1 -1
  90. package/lib/lfJson2Xml.js +1 -1
  91. package/lib/lfXml2Json.js +1 -1
  92. package/package.json +3 -4
  93. package/types/NodeResize/BasicShape/Polygon.d.ts +0 -10
  94. package/types/NodeResize/BasicShape/Rect.d.ts +0 -17
  95. package/types/NodeResize/Control/Control.d.ts +0 -66
  96. package/types/NodeResize/Control/ControlGroup.d.ts +0 -13
  97. package/types/NodeResize/Control/Util.d.ts +0 -33
  98. package/types/NodeResize/Node/DiamondResize.d.ts +0 -30
  99. package/types/NodeResize/Node/EllipseResize.d.ts +0 -30
  100. package/types/NodeResize/Node/HtmlResize.d.ts +0 -30
  101. package/types/NodeResize/Node/RectResize.d.ts +0 -32
  102. package/types/NodeResize/index.d.ts +0 -11
  103. package/types/bpmn/events/EndEvent.d.ts +0 -21
  104. package/types/bpmn/events/StartEvent.d.ts +0 -17
  105. package/types/bpmn/flow/SequenceFlow.d.ts +0 -15
  106. package/types/bpmn/gateways/ExclusiveGateway.d.ts +0 -16
  107. package/types/bpmn/getBpmnId.d.ts +0 -1
  108. package/types/bpmn/index.d.ts +0 -13
  109. package/types/bpmn/tasks/ServiceTask.d.ts +0 -17
  110. package/types/bpmn/tasks/UserTask.d.ts +0 -17
  111. package/types/bpmn-adapter/bpmnIds.d.ts +0 -1
  112. package/types/bpmn-adapter/index.d.ts +0 -63
  113. package/types/bpmn-adapter/json2xml.d.ts +0 -3
  114. package/types/components/context-menu/index.d.ts +0 -34
  115. package/types/components/control/index.d.ts +0 -26
  116. package/types/components/dnd-panel/index.d.ts +0 -25
  117. package/types/components/highlight/index.d.ts +0 -21
  118. package/types/components/menu/index.d.ts +0 -50
  119. package/types/components/mini-map/index.d.ts +0 -88
  120. package/types/components/selection-select/index.d.ts +0 -42
  121. package/types/index.d.ts +0 -19
  122. package/types/insert-node-in-polyline/edge.d.ts +0 -31
  123. package/types/insert-node-in-polyline/index.d.ts +0 -28
  124. package/types/locale/en-locale/en.d.ts +0 -19
  125. package/types/locale/en-locale/index.d.ts +0 -9
  126. package/types/locale/locale.d.ts +0 -6
  127. package/types/materials/curved-edge/index.d.ts +0 -8
  128. package/types/materials/curved-edge/searchMiddleIndex.d.ts +0 -1
  129. package/types/materials/group/GroupNode.d.ts +0 -125
  130. package/types/materials/group/index.d.ts +0 -56
  131. package/types/tools/auto-layout/index.d.ts +0 -40
  132. package/types/tools/flow-path/index.d.ts +0 -47
  133. package/types/tools/snapshot/index.d.ts +0 -25
  134. package/types/turbo-adapter/index.d.ts +0 -21
  135. package/types/type/index.d.ts +0 -6
  136. /package/{types/bpmn-adapter → es/bpmn-elements-adapter}/xml2json.d.ts +0 -0
@@ -1,8 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBpmnId = void 0;
4
- var ids_1 = require("ids");
5
- var ids = new ids_1.default([32, 32, 1]);
4
+ /* eslint-disable no-bitwise */
5
+ var IDS = /** @class */ (function () {
6
+ function IDS() {
7
+ globalThis._ids = this;
8
+ this._ids = new Set();
9
+ }
10
+ IDS.prototype.generateId = function () {
11
+ var id = 'xxxxxxx'.replace(/[x]/g, function (c) {
12
+ var r = (Math.random() * 16) | 0;
13
+ var v = c === 'x' ? r : (r & 0x3) | 0x8;
14
+ return v.toString(16);
15
+ });
16
+ return id;
17
+ };
18
+ IDS.prototype.next = function () {
19
+ var id = this.generateId();
20
+ while (this._ids.has(id)) {
21
+ id = this.generateId();
22
+ }
23
+ this._ids.add(id);
24
+ return id;
25
+ };
26
+ return IDS;
27
+ }());
28
+ var ids = (globalThis === null || globalThis === void 0 ? void 0 : globalThis._ids) || new IDS();
6
29
  function getBpmnId() {
7
30
  return ids.next();
8
31
  }
@@ -1,8 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBpmnId = void 0;
4
- var ids_1 = require("ids");
5
- var ids = new ids_1.default([32, 32, 1]);
4
+ /* eslint-disable no-bitwise */
5
+ var IDS = /** @class */ (function () {
6
+ function IDS() {
7
+ globalThis._ids = this;
8
+ this._ids = new Set();
9
+ }
10
+ IDS.prototype.generateId = function () {
11
+ var id = 'xxxxxxx'.replace(/[x]/g, function (c) {
12
+ var r = (Math.random() * 16) | 0;
13
+ var v = c === 'x' ? r : (r & 0x3) | 0x8;
14
+ return v.toString(16);
15
+ });
16
+ return id;
17
+ };
18
+ IDS.prototype.next = function () {
19
+ var id = this.generateId();
20
+ while (this._ids.has(id)) {
21
+ id = this.generateId();
22
+ }
23
+ this._ids.add(id);
24
+ return id;
25
+ };
26
+ return IDS;
27
+ }());
28
+ var ids = (globalThis === null || globalThis === void 0 ? void 0 : globalThis._ids) || new IDS();
6
29
  function getBpmnId() {
7
30
  return ids.next();
8
31
  }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
12
+ var __read = (this && this.__read) || function (o, n) {
13
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
14
+ if (!m) return o;
15
+ var i = m.call(o), r, ar = [], e;
16
+ try {
17
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
+ }
19
+ catch (error) { e = { error: error }; }
20
+ finally {
21
+ try {
22
+ if (r && !r.done && (m = i["return"])) m.call(i);
23
+ }
24
+ finally { if (e) throw e.error; }
25
+ }
26
+ return ar;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.BPMNElements = exports.useDefinition = void 0;
30
+ /* eslint-disable @typescript-eslint/naming-convention */
31
+ /* eslint-disable react-hooks/rules-of-hooks */
32
+ var Event_1 = require("./presets/Event");
33
+ var Gateway_1 = require("./presets/Gateway");
34
+ var Task_1 = require("./presets/Task");
35
+ // import { registerPoolNodes } from './presets/Pool';
36
+ var Flow_1 = require("./presets/Flow");
37
+ var icons_1 = require("./presets/icons");
38
+ var definitionConfig = [
39
+ {
40
+ nodes: ['startEvent', 'intermediateCatchEvent', 'boundaryEvent'],
41
+ definition: [
42
+ {
43
+ type: 'bpmn:timerEventDefinition',
44
+ icon: icons_1.timerIcon,
45
+ properties: {
46
+ definitionType: 'bpmn:timerEventDefinition',
47
+ timerValue: '',
48
+ timerType: '',
49
+ },
50
+ },
51
+ ],
52
+ },
53
+ ];
54
+ function useDefinition(definition) {
55
+ function setDefinition(config) {
56
+ function set(nodes, definitions) {
57
+ nodes.forEach(function (name) {
58
+ if (!(definition === null || definition === void 0 ? void 0 : definition[name])) {
59
+ definition[name] = new Map();
60
+ }
61
+ var map = definition === null || definition === void 0 ? void 0 : definition[name];
62
+ definitions.forEach(function (define) {
63
+ map.set(define.type, define);
64
+ });
65
+ });
66
+ return definition;
67
+ }
68
+ config.forEach(function (define) {
69
+ set(define.nodes, define.definition);
70
+ });
71
+ }
72
+ return function () { return [definition, setDefinition]; };
73
+ }
74
+ exports.useDefinition = useDefinition;
75
+ var BPMNElements = /** @class */ (function () {
76
+ function BPMNElements(_a) {
77
+ var lf = _a.lf;
78
+ lf.definition = {};
79
+ lf.useDefinition = useDefinition(lf.definition);
80
+ var _b = __read(lf.useDefinition(), 2), _definition = _b[0], setDefinition = _b[1];
81
+ setDefinition(definitionConfig);
82
+ Event_1.registerEventNodes(lf);
83
+ Gateway_1.registerGatewayNodes(lf);
84
+ Flow_1.registerFlows(lf);
85
+ Task_1.registerTaskNodes(lf);
86
+ lf.setDefaultEdgeType('bpmn:sequenceFlow');
87
+ }
88
+ BPMNElements.pluginName = 'BpmnElementsPlugin';
89
+ return BPMNElements;
90
+ }());
91
+ exports.BPMNElements = BPMNElements;
92
+ __exportStar(require("./presets/Event/EndEventFactory"), exports);
93
+ __exportStar(require("./presets/Event/IntermediateCatchEvent"), exports);
94
+ __exportStar(require("./presets/Event/StartEventFactory"), exports);
95
+ __exportStar(require("./presets/Event/boundaryEventFactory"), exports);
96
+ __exportStar(require("./presets/Event/IntermediateThrowEvent"), exports);
97
+ __exportStar(require("./presets/Flow/sequenceFlow"), exports);
98
+ __exportStar(require("./presets/Task/task"), exports);
99
+ __exportStar(require("./presets/Task/subProcess"), exports);
100
+ __exportStar(require("./presets/Gateway/gateway"), exports);
101
+ exports.icons = require("./presets/icons");
102
+ exports.bpmnUtils = require("./utils");
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __read = (this && this.__read) || function (o, n) {
27
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
28
+ if (!m) return o;
29
+ var i = m.call(o), r, ar = [], e;
30
+ try {
31
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
32
+ }
33
+ catch (error) { e = { error: error }; }
34
+ finally {
35
+ try {
36
+ if (r && !r.done && (m = i["return"])) m.call(i);
37
+ }
38
+ finally { if (e) throw e.error; }
39
+ }
40
+ return ar;
41
+ };
42
+ var __spread = (this && this.__spread) || function () {
43
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
44
+ return ar;
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.EndEventFactory = void 0;
48
+ /* eslint-disable @typescript-eslint/naming-convention */
49
+ var core_1 = require("@logicflow/core");
50
+ var utils_1 = require("../../utils");
51
+ function EndEventFactory(lf) {
52
+ var _a = __read(lf.useDefinition(), 1), definition = _a[0];
53
+ var view = /** @class */ (function (_super) {
54
+ __extends(view, _super);
55
+ function view() {
56
+ return _super !== null && _super.apply(this, arguments) || this;
57
+ }
58
+ view.prototype.getAnchorStyle = function () {
59
+ return {
60
+ visibility: 'hidden',
61
+ };
62
+ };
63
+ view.prototype.getShape = function () {
64
+ var _a;
65
+ var model = this.props.model;
66
+ var style = model.getNodeStyle();
67
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
68
+ var outCircle = _super.prototype.getShape.call(this);
69
+ var definitionType = properties.definitionType;
70
+ var icon = (((_a = definition.endEvent) === null || _a === void 0 ? void 0 : _a.get(definitionType)) || {}).icon;
71
+ var i = Array.isArray(icon)
72
+ ? core_1.h.apply(void 0, __spread(['g', {
73
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
74
+ }], icon)) : core_1.h('path', {
75
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
76
+ d: icon,
77
+ style: 'fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;',
78
+ });
79
+ return core_1.h('g', {}, outCircle, core_1.h('circle', __assign(__assign({}, style), { strokeWidth: 2, cx: x, cy: y, r: r - 2 })), i);
80
+ };
81
+ return view;
82
+ }(core_1.CircleNode));
83
+ var model = /** @class */ (function (_super) {
84
+ __extends(model, _super);
85
+ function model(data, graphModel) {
86
+ var _a, _b, _c;
87
+ var _this = this;
88
+ if (!data.id) {
89
+ data.id = "Event_" + utils_1.genBpmnId();
90
+ }
91
+ if (!data.text) {
92
+ data.text = '';
93
+ }
94
+ if (data.text && typeof data.text === 'string') {
95
+ data.text = {
96
+ value: data.text,
97
+ x: data.x,
98
+ y: data.y + 40,
99
+ };
100
+ }
101
+ var _d = (((_a = definition.endEvent) === 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;
102
+ data.properties = __assign(__assign({}, properties), data.properties);
103
+ ((_c = data.properties) === null || _c === void 0 ? void 0 : _c.definitionType) && (data.properties.definitionId = "Definition_" + utils_1.genBpmnId());
104
+ _this = _super.call(this, data, graphModel) || this;
105
+ utils_1.groupRule.call(_this);
106
+ return _this;
107
+ }
108
+ model.prototype.setAttributes = function () {
109
+ this.r = 18;
110
+ };
111
+ model.prototype.getConnectedSourceRules = function () {
112
+ var _this = this;
113
+ var rules = _super.prototype.getConnectedSourceRules.call(this);
114
+ var notAsSource = {
115
+ message: '结束节点不能作为边的起点',
116
+ validate: function (source, _target) {
117
+ if (source === _this) {
118
+ return false;
119
+ }
120
+ return true;
121
+ },
122
+ };
123
+ rules.push(notAsSource);
124
+ return rules;
125
+ };
126
+ return model;
127
+ }(core_1.CircleNodeModel));
128
+ return {
129
+ type: 'bpmn:endEvent',
130
+ view: view,
131
+ model: model,
132
+ };
133
+ }
134
+ exports.EndEventFactory = EndEventFactory;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __read = (this && this.__read) || function (o, n) {
27
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
28
+ if (!m) return o;
29
+ var i = m.call(o), r, ar = [], e;
30
+ try {
31
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
32
+ }
33
+ catch (error) { e = { error: error }; }
34
+ finally {
35
+ try {
36
+ if (r && !r.done && (m = i["return"])) m.call(i);
37
+ }
38
+ finally { if (e) throw e.error; }
39
+ }
40
+ return ar;
41
+ };
42
+ var __spread = (this && this.__spread) || function () {
43
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
44
+ return ar;
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.IntermediateCatchEventFactory = void 0;
48
+ /* eslint-disable @typescript-eslint/naming-convention */
49
+ var core_1 = require("@logicflow/core");
50
+ var utils_1 = require("../../utils");
51
+ function IntermediateCatchEventFactory(lf) {
52
+ var _a = __read(lf.useDefinition(), 1), definition = _a[0];
53
+ var view = /** @class */ (function (_super) {
54
+ __extends(view, _super);
55
+ function view() {
56
+ return _super !== null && _super.apply(this, arguments) || this;
57
+ }
58
+ view.prototype.getAnchorStyle = function () {
59
+ return {
60
+ visibility: 'hidden',
61
+ };
62
+ };
63
+ view.prototype.getShape = function () {
64
+ var _a;
65
+ // @ts-ignore
66
+ var model = this.props.model;
67
+ var style = model.getNodeStyle();
68
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
69
+ var definitionType = properties.definitionType;
70
+ var icon = (((_a = definition.intermediateCatchEvent) === null || _a === void 0 ? void 0 : _a.get(definitionType)) || {}).icon;
71
+ var i = Array.isArray(icon)
72
+ ? core_1.h.apply(void 0, __spread(['g', {
73
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
74
+ }], icon)) : core_1.h('path', {
75
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
76
+ d: icon,
77
+ });
78
+ return core_1.h('g', {}, core_1.h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r, strokeWidth: 1.5 })), core_1.h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 3, strokeWidth: 1.5 })), i);
79
+ };
80
+ return view;
81
+ }(core_1.CircleNode));
82
+ var model = /** @class */ (function (_super) {
83
+ __extends(model, _super);
84
+ function model(data, graphModel) {
85
+ var _a, _b, _c;
86
+ var _this = this;
87
+ if (!data.id) {
88
+ data.id = "Event_" + utils_1.genBpmnId();
89
+ }
90
+ if (!data.text) {
91
+ data.text = '';
92
+ }
93
+ if (data.text && typeof data.text === 'string') {
94
+ data.text = {
95
+ value: data.text,
96
+ x: data.x,
97
+ y: data.y + 40,
98
+ };
99
+ }
100
+ 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;
101
+ data.properties = __assign(__assign({}, properties), data.properties);
102
+ ((_c = data.properties) === null || _c === void 0 ? void 0 : _c.definitionType) && (data.properties.definitionId = "Definition_" + utils_1.genBpmnId());
103
+ _this = _super.call(this, data, graphModel) || this;
104
+ utils_1.groupRule.call(_this);
105
+ return _this;
106
+ }
107
+ model.prototype.setAttributes = function () {
108
+ this.r = 18;
109
+ };
110
+ return model;
111
+ }(core_1.CircleNodeModel));
112
+ return {
113
+ type: 'bpmn:intermediateCatchEvent',
114
+ view: view,
115
+ model: model,
116
+ };
117
+ }
118
+ exports.IntermediateCatchEventFactory = IntermediateCatchEventFactory;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __read = (this && this.__read) || function (o, n) {
27
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
28
+ if (!m) return o;
29
+ var i = m.call(o), r, ar = [], e;
30
+ try {
31
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
32
+ }
33
+ catch (error) { e = { error: error }; }
34
+ finally {
35
+ try {
36
+ if (r && !r.done && (m = i["return"])) m.call(i);
37
+ }
38
+ finally { if (e) throw e.error; }
39
+ }
40
+ return ar;
41
+ };
42
+ var __spread = (this && this.__spread) || function () {
43
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
44
+ return ar;
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.IntermediateThrowEventFactory = void 0;
48
+ /* eslint-disable @typescript-eslint/naming-convention */
49
+ var core_1 = require("@logicflow/core");
50
+ var utils_1 = require("../../utils");
51
+ function IntermediateThrowEventFactory(lf) {
52
+ var _a = __read(lf.useDefinition(), 1), definition = _a[0];
53
+ var view = /** @class */ (function (_super) {
54
+ __extends(view, _super);
55
+ function view() {
56
+ return _super !== null && _super.apply(this, arguments) || this;
57
+ }
58
+ view.prototype.getAnchorStyle = function () {
59
+ return {
60
+ visibility: 'hidden',
61
+ };
62
+ };
63
+ view.prototype.getShape = function () {
64
+ var _a;
65
+ // @ts-ignore
66
+ var model = this.props.model;
67
+ var style = model.getNodeStyle();
68
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
69
+ var definitionType = properties.definitionType;
70
+ var icon = (((_a = definition.intermediateThrowEvent) === null || _a === void 0 ? void 0 : _a.get(definitionType)) || {}).icon;
71
+ var i = Array.isArray(icon)
72
+ ? core_1.h.apply(void 0, __spread(['g', {
73
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
74
+ }], icon)) : core_1.h('path', {
75
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
76
+ d: icon,
77
+ style: 'fill: black',
78
+ });
79
+ return core_1.h('g', {}, core_1.h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r, strokeWidth: 1.5 })), core_1.h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 3, strokeWidth: 1.5 })), i);
80
+ };
81
+ return view;
82
+ }(core_1.CircleNode));
83
+ var model = /** @class */ (function (_super) {
84
+ __extends(model, _super);
85
+ function model(data, graphModel) {
86
+ var _a, _b, _c;
87
+ var _this = this;
88
+ if (!data.id) {
89
+ data.id = "Event_" + utils_1.genBpmnId();
90
+ }
91
+ if (!data.text) {
92
+ data.text = '';
93
+ }
94
+ if (data.text && typeof data.text === 'string') {
95
+ data.text = {
96
+ value: data.text,
97
+ x: data.x,
98
+ y: data.y + 40,
99
+ };
100
+ }
101
+ 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;
102
+ data.properties = __assign(__assign({}, properties), data.properties);
103
+ ((_c = data.properties) === null || _c === void 0 ? void 0 : _c.definitionType) && (data.properties.definitionId = "Definition_" + utils_1.genBpmnId());
104
+ _this = _super.call(this, data, graphModel) || this;
105
+ utils_1.groupRule.call(_this);
106
+ return _this;
107
+ }
108
+ model.prototype.setAttributes = function () {
109
+ this.r = 18;
110
+ };
111
+ return model;
112
+ }(core_1.CircleNodeModel));
113
+ return {
114
+ type: 'bpmn:intermediateThrowEvent',
115
+ view: view,
116
+ model: model,
117
+ };
118
+ }
119
+ exports.IntermediateThrowEventFactory = IntermediateThrowEventFactory;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __read = (this && this.__read) || function (o, n) {
27
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
28
+ if (!m) return o;
29
+ var i = m.call(o), r, ar = [], e;
30
+ try {
31
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
32
+ }
33
+ catch (error) { e = { error: error }; }
34
+ finally {
35
+ try {
36
+ if (r && !r.done && (m = i["return"])) m.call(i);
37
+ }
38
+ finally { if (e) throw e.error; }
39
+ }
40
+ return ar;
41
+ };
42
+ var __spread = (this && this.__spread) || function () {
43
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
44
+ return ar;
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.StartEventFactory = void 0;
48
+ /* eslint-disable @typescript-eslint/naming-convention */
49
+ var core_1 = require("@logicflow/core");
50
+ var utils_1 = require("../../utils");
51
+ function StartEventFactory(lf) {
52
+ var _a = __read(lf.useDefinition(), 1), definition = _a[0];
53
+ var view = /** @class */ (function (_super) {
54
+ __extends(view, _super);
55
+ function view() {
56
+ return _super !== null && _super.apply(this, arguments) || this;
57
+ }
58
+ view.prototype.getAnchorStyle = function () {
59
+ return {
60
+ visibility: 'hidden',
61
+ };
62
+ };
63
+ view.prototype.getShape = function () {
64
+ var _a;
65
+ // @ts-ignore
66
+ var model = this.props.model;
67
+ var style = model.getNodeStyle();
68
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
69
+ var definitionType = properties.definitionType, isInterrupting = properties.isInterrupting;
70
+ var icon = (((_a = definition.startEvent) === null || _a === void 0 ? void 0 : _a.get(definitionType)) || {}).icon;
71
+ var i = Array.isArray(icon)
72
+ ? core_1.h.apply(void 0, __spread(['g', {
73
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
74
+ }], icon)) : core_1.h('path', {
75
+ transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
76
+ d: icon,
77
+ style: 'fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
78
+ });
79
+ return core_1.h('g', {}, core_1.h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r, strokeDasharray: isInterrupting ? '5,5' : '', strokeWidth: 2 })), i);
80
+ };
81
+ return view;
82
+ }(core_1.CircleNode));
83
+ var model = /** @class */ (function (_super) {
84
+ __extends(model, _super);
85
+ function model(data, graphModel) {
86
+ var _a, _b, _c;
87
+ var _this = this;
88
+ if (!data.id) {
89
+ data.id = "Event_" + utils_1.genBpmnId();
90
+ }
91
+ if (!data.text) {
92
+ data.text = '';
93
+ }
94
+ if (data.text && typeof data.text === 'string') {
95
+ data.text = {
96
+ value: data.text,
97
+ x: data.x,
98
+ y: data.y + 40,
99
+ };
100
+ }
101
+ 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;
102
+ data.properties = __assign(__assign({}, properties), data.properties);
103
+ ((_c = data.properties) === null || _c === void 0 ? void 0 : _c.definitionType) && (data.properties.definitionId = "Definition_" + utils_1.genBpmnId());
104
+ _this = _super.call(this, data, graphModel) || this;
105
+ return _this;
106
+ }
107
+ model.prototype.setAttributes = function () {
108
+ this.r = 18;
109
+ };
110
+ model.prototype.getConnectedTargetRules = function () {
111
+ var _this = this;
112
+ var rules = _super.prototype.getConnectedTargetRules.call(this);
113
+ var notAsSource = {
114
+ message: '起始节点不能作为边的终点',
115
+ validate: function (_source, target) {
116
+ if (target === _this) {
117
+ return false;
118
+ }
119
+ return true;
120
+ },
121
+ };
122
+ rules.push(notAsSource);
123
+ return rules;
124
+ };
125
+ return model;
126
+ }(core_1.CircleNodeModel));
127
+ return {
128
+ type: 'bpmn:startEvent',
129
+ view: view,
130
+ model: model,
131
+ };
132
+ }
133
+ exports.StartEventFactory = StartEventFactory;