@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
@@ -137,6 +137,20 @@ var Snapshot = /** @class */ (function () {
137
137
  }
138
138
  }
139
139
  var dpr = window.devicePixelRatio || 1;
140
+ if (dpr < 1) {
141
+ // https://github.com/didi/LogicFlow/issues/1222
142
+ // canvas.width = bboxWidth * dpr配合ctx.scale(dpr, dpr)是为了解决绘制模糊
143
+ // 比如dpr=2,先让canvas.width放大到等同于屏幕的物理像素宽高,然后自适应缩放适配canvas.style.width
144
+ // 由于所有元素都缩放了一半,因此需要ctx.scale(dpr, dpr)放大2倍整体绘制的内容
145
+ // 当用户缩放浏览器时,window.devicePixelRatio会随着变小
146
+ // 当window.devicePixelRatio变小到一定程度,会导致canvas.width<canvas.style.width
147
+ // 由于导出图片的svg的大小是canvas.style.width+canvas.style.height
148
+ // 因此会导致导出的svg图片无法完整绘制到canvas(因为canvas.width小于svg的宽)
149
+ // 从而导致canvas导出图片是缺失的svg
150
+ // 而dpr>=1就能保证canvas.width>=canvas.style.width
151
+ // 当dpr小于1的时候,我们强制转化为1,并不会产生绘制模糊等问题
152
+ dpr = 1;
153
+ }
140
154
  var canvas = document.createElement('canvas');
141
155
  /*
142
156
  为了计算真实宽高需要取图的真实dom
@@ -1,5 +1,28 @@
1
- import Ids from 'ids';
2
- var ids = new Ids([32, 32, 1]);
1
+ /* eslint-disable no-bitwise */
2
+ var IDS = /** @class */ (function () {
3
+ function IDS() {
4
+ globalThis._ids = this;
5
+ this._ids = new Set();
6
+ }
7
+ IDS.prototype.generateId = function () {
8
+ var id = 'xxxxxxx'.replace(/[x]/g, function (c) {
9
+ var r = (Math.random() * 16) | 0;
10
+ var v = c === 'x' ? r : (r & 0x3) | 0x8;
11
+ return v.toString(16);
12
+ });
13
+ return id;
14
+ };
15
+ IDS.prototype.next = function () {
16
+ var id = this.generateId();
17
+ while (this._ids.has(id)) {
18
+ id = this.generateId();
19
+ }
20
+ this._ids.add(id);
21
+ return id;
22
+ };
23
+ return IDS;
24
+ }());
25
+ var ids = (globalThis === null || globalThis === void 0 ? void 0 : globalThis._ids) || new IDS();
3
26
  export function getBpmnId() {
4
27
  return ids.next();
5
28
  }
@@ -1,5 +1,28 @@
1
- import Ids from 'ids';
2
- var ids = new Ids([32, 32, 1]);
1
+ /* eslint-disable no-bitwise */
2
+ var IDS = /** @class */ (function () {
3
+ function IDS() {
4
+ globalThis._ids = this;
5
+ this._ids = new Set();
6
+ }
7
+ IDS.prototype.generateId = function () {
8
+ var id = 'xxxxxxx'.replace(/[x]/g, function (c) {
9
+ var r = (Math.random() * 16) | 0;
10
+ var v = c === 'x' ? r : (r & 0x3) | 0x8;
11
+ return v.toString(16);
12
+ });
13
+ return id;
14
+ };
15
+ IDS.prototype.next = function () {
16
+ var id = this.generateId();
17
+ while (this._ids.has(id)) {
18
+ id = this.generateId();
19
+ }
20
+ this._ids.add(id);
21
+ return id;
22
+ };
23
+ return IDS;
24
+ }());
25
+ var ids = (globalThis === null || globalThis === void 0 ? void 0 : globalThis._ids) || new IDS();
3
26
  export function getBpmnId() {
4
27
  return ids.next();
5
28
  }
@@ -0,0 +1,16 @@
1
+ export declare function useDefinition(definition: any): () => any[];
2
+ export declare class BPMNElements {
3
+ static pluginName: string;
4
+ constructor({ lf }: any);
5
+ }
6
+ export * from './presets/Event/EndEventFactory';
7
+ export * from './presets/Event/IntermediateCatchEvent';
8
+ export * from './presets/Event/StartEventFactory';
9
+ export * from './presets/Event/boundaryEventFactory';
10
+ export * from './presets/Event/IntermediateThrowEvent';
11
+ export * from './presets/Flow/sequenceFlow';
12
+ export * from './presets/Task/task';
13
+ export * from './presets/Task/subProcess';
14
+ export * from './presets/Gateway/gateway';
15
+ export * as icons from './presets/icons';
16
+ export * as bpmnUtils from './utils';
@@ -0,0 +1,88 @@
1
+ var __read = (this && this.__read) || function (o, n) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3
+ if (!m) return o;
4
+ var i = m.call(o), r, ar = [], e;
5
+ try {
6
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
+ }
8
+ catch (error) { e = { error: error }; }
9
+ finally {
10
+ try {
11
+ if (r && !r.done && (m = i["return"])) m.call(i);
12
+ }
13
+ finally { if (e) throw e.error; }
14
+ }
15
+ return ar;
16
+ };
17
+ /* eslint-disable @typescript-eslint/naming-convention */
18
+ /* eslint-disable react-hooks/rules-of-hooks */
19
+ import { registerEventNodes } from './presets/Event';
20
+ import { registerGatewayNodes } from './presets/Gateway';
21
+ import { registerTaskNodes } from './presets/Task';
22
+ // import { registerPoolNodes } from './presets/Pool';
23
+ import { registerFlows } from './presets/Flow';
24
+ import { timerIcon } from './presets/icons';
25
+ var definitionConfig = [
26
+ {
27
+ nodes: ['startEvent', 'intermediateCatchEvent', 'boundaryEvent'],
28
+ definition: [
29
+ {
30
+ type: 'bpmn:timerEventDefinition',
31
+ icon: timerIcon,
32
+ properties: {
33
+ definitionType: 'bpmn:timerEventDefinition',
34
+ timerValue: '',
35
+ timerType: '',
36
+ },
37
+ },
38
+ ],
39
+ },
40
+ ];
41
+ export function useDefinition(definition) {
42
+ function setDefinition(config) {
43
+ function set(nodes, definitions) {
44
+ nodes.forEach(function (name) {
45
+ if (!(definition === null || definition === void 0 ? void 0 : definition[name])) {
46
+ definition[name] = new Map();
47
+ }
48
+ var map = definition === null || definition === void 0 ? void 0 : definition[name];
49
+ definitions.forEach(function (define) {
50
+ map.set(define.type, define);
51
+ });
52
+ });
53
+ return definition;
54
+ }
55
+ config.forEach(function (define) {
56
+ set(define.nodes, define.definition);
57
+ });
58
+ }
59
+ return function () { return [definition, setDefinition]; };
60
+ }
61
+ var BPMNElements = /** @class */ (function () {
62
+ function BPMNElements(_a) {
63
+ var lf = _a.lf;
64
+ lf.definition = {};
65
+ lf.useDefinition = useDefinition(lf.definition);
66
+ var _b = __read(lf.useDefinition(), 2), _definition = _b[0], setDefinition = _b[1];
67
+ setDefinition(definitionConfig);
68
+ registerEventNodes(lf);
69
+ registerGatewayNodes(lf);
70
+ registerFlows(lf);
71
+ registerTaskNodes(lf);
72
+ lf.setDefaultEdgeType('bpmn:sequenceFlow');
73
+ }
74
+ BPMNElements.pluginName = 'BpmnElementsPlugin';
75
+ return BPMNElements;
76
+ }());
77
+ export { BPMNElements };
78
+ export * from './presets/Event/EndEventFactory';
79
+ export * from './presets/Event/IntermediateCatchEvent';
80
+ export * from './presets/Event/StartEventFactory';
81
+ export * from './presets/Event/boundaryEventFactory';
82
+ export * from './presets/Event/IntermediateThrowEvent';
83
+ export * from './presets/Flow/sequenceFlow';
84
+ export * from './presets/Task/task';
85
+ export * from './presets/Task/subProcess';
86
+ export * from './presets/Gateway/gateway';
87
+ export * as icons from './presets/icons';
88
+ export * as bpmnUtils from './utils';
@@ -0,0 +1,5 @@
1
+ export declare function EndEventFactory(lf: any): {
2
+ type: string;
3
+ model: any;
4
+ view: any;
5
+ };
@@ -0,0 +1,130 @@
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 EndEventFactory(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
+ var model = this.props.model;
63
+ var style = model.getNodeStyle();
64
+ var x = model.x, y = model.y, r = model.r, width = model.width, height = model.height, properties = model.properties;
65
+ var outCircle = _super.prototype.getShape.call(this);
66
+ var definitionType = properties.definitionType;
67
+ var icon = (((_a = definition.endEvent) === 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; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;',
75
+ });
76
+ return h('g', {}, outCircle, h('circle', __assign(__assign({}, style), { strokeWidth: 2, cx: x, cy: y, r: r - 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.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;
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
+ model.prototype.getConnectedSourceRules = function () {
109
+ var _this = this;
110
+ var rules = _super.prototype.getConnectedSourceRules.call(this);
111
+ var notAsSource = {
112
+ message: '结束节点不能作为边的起点',
113
+ validate: function (source, _target) {
114
+ if (source === _this) {
115
+ return false;
116
+ }
117
+ return true;
118
+ },
119
+ };
120
+ rules.push(notAsSource);
121
+ return rules;
122
+ };
123
+ return model;
124
+ }(CircleNodeModel));
125
+ return {
126
+ type: 'bpmn:endEvent',
127
+ view: view,
128
+ model: model,
129
+ };
130
+ }
@@ -0,0 +1,5 @@
1
+ export declare function IntermediateCatchEventFactory(lf: any): {
2
+ type: string;
3
+ model: any;
4
+ view: any;
5
+ };
@@ -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
+ };