@operato/scene-bpmn 1.1.1

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 (180) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE +21 -0
  3. package/README.md +13 -0
  4. package/assets/favicon.ico +0 -0
  5. package/assets/images/spinner.png +0 -0
  6. package/db.sqlite +0 -0
  7. package/dist/base/bpmn-activity.d.ts +5 -0
  8. package/dist/base/bpmn-activity.js +23 -0
  9. package/dist/base/bpmn-activity.js.map +1 -0
  10. package/dist/base/bpmn-container-base.d.ts +36 -0
  11. package/dist/base/bpmn-container-base.js +167 -0
  12. package/dist/base/bpmn-container-base.js.map +1 -0
  13. package/dist/base/bpmn-control-base.d.ts +36 -0
  14. package/dist/base/bpmn-control-base.js +167 -0
  15. package/dist/base/bpmn-control-base.js.map +1 -0
  16. package/dist/bpmn-call-activity.d.ts +11 -0
  17. package/dist/bpmn-call-activity.js +19 -0
  18. package/dist/bpmn-call-activity.js.map +1 -0
  19. package/dist/bpmn-comment.d.ts +14 -0
  20. package/dist/bpmn-comment.js +53 -0
  21. package/dist/bpmn-comment.js.map +1 -0
  22. package/dist/bpmn-data-object.d.ts +25 -0
  23. package/dist/bpmn-data-object.js +106 -0
  24. package/dist/bpmn-data-object.js.map +1 -0
  25. package/dist/bpmn-data-store.d.ts +11 -0
  26. package/dist/bpmn-data-store.js +36 -0
  27. package/dist/bpmn-data-store.js.map +1 -0
  28. package/dist/bpmn-event.d.ts +25 -0
  29. package/dist/bpmn-event.js +421 -0
  30. package/dist/bpmn-event.js.map +1 -0
  31. package/dist/bpmn-flow.d.ts +19 -0
  32. package/dist/bpmn-flow.js +26 -0
  33. package/dist/bpmn-flow.js.map +1 -0
  34. package/dist/bpmn-gateway.d.ts +25 -0
  35. package/dist/bpmn-gateway.js +146 -0
  36. package/dist/bpmn-gateway.js.map +1 -0
  37. package/dist/bpmn-group.d.ts +11 -0
  38. package/dist/bpmn-group.js +35 -0
  39. package/dist/bpmn-group.js.map +1 -0
  40. package/dist/bpmn-lane.d.ts +15 -0
  41. package/dist/bpmn-lane.js +25 -0
  42. package/dist/bpmn-lane.js.map +1 -0
  43. package/dist/bpmn-pool.d.ts +14 -0
  44. package/dist/bpmn-pool.js +22 -0
  45. package/dist/bpmn-pool.js.map +1 -0
  46. package/dist/bpmn-subprocess.d.ts +19 -0
  47. package/dist/bpmn-subprocess.js +146 -0
  48. package/dist/bpmn-subprocess.js.map +1 -0
  49. package/dist/bpmn-task.d.ts +32 -0
  50. package/dist/bpmn-task.js +311 -0
  51. package/dist/bpmn-task.js.map +1 -0
  52. package/dist/editors/index.d.ts +0 -0
  53. package/dist/editors/index.js +2 -0
  54. package/dist/editors/index.js.map +1 -0
  55. package/dist/groups/index.d.ts +7 -0
  56. package/dist/groups/index.js +3 -0
  57. package/dist/groups/index.js.map +1 -0
  58. package/dist/groups/process.d.ts +6 -0
  59. package/dist/groups/process.js +48 -0
  60. package/dist/groups/process.js.map +1 -0
  61. package/dist/index.d.ts +12 -0
  62. package/dist/index.js +13 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/templates/bpmn-call-activity.d.ts +17 -0
  65. package/dist/templates/bpmn-call-activity.js +18 -0
  66. package/dist/templates/bpmn-call-activity.js.map +1 -0
  67. package/dist/templates/bpmn-comment.d.ts +19 -0
  68. package/dist/templates/bpmn-comment.js +20 -0
  69. package/dist/templates/bpmn-comment.js.map +1 -0
  70. package/dist/templates/bpmn-data-object.d.ts +19 -0
  71. package/dist/templates/bpmn-data-object.js +20 -0
  72. package/dist/templates/bpmn-data-object.js.map +1 -0
  73. package/dist/templates/bpmn-data-store.d.ts +17 -0
  74. package/dist/templates/bpmn-data-store.js +18 -0
  75. package/dist/templates/bpmn-data-store.js.map +1 -0
  76. package/dist/templates/bpmn-event.d.ts +17 -0
  77. package/dist/templates/bpmn-event.js +18 -0
  78. package/dist/templates/bpmn-event.js.map +1 -0
  79. package/dist/templates/bpmn-flow.d.ts +15 -0
  80. package/dist/templates/bpmn-flow.js +16 -0
  81. package/dist/templates/bpmn-flow.js.map +1 -0
  82. package/dist/templates/bpmn-gateway.d.ts +17 -0
  83. package/dist/templates/bpmn-gateway.js +18 -0
  84. package/dist/templates/bpmn-gateway.js.map +1 -0
  85. package/dist/templates/bpmn-group.d.ts +15 -0
  86. package/dist/templates/bpmn-group.js +16 -0
  87. package/dist/templates/bpmn-group.js.map +1 -0
  88. package/dist/templates/bpmn-lane.d.ts +17 -0
  89. package/dist/templates/bpmn-lane.js +18 -0
  90. package/dist/templates/bpmn-lane.js.map +1 -0
  91. package/dist/templates/bpmn-pool.d.ts +15 -0
  92. package/dist/templates/bpmn-pool.js +16 -0
  93. package/dist/templates/bpmn-pool.js.map +1 -0
  94. package/dist/templates/bpmn-subprocess.d.ts +17 -0
  95. package/dist/templates/bpmn-subprocess.js +18 -0
  96. package/dist/templates/bpmn-subprocess.js.map +1 -0
  97. package/dist/templates/bpmn-task.d.ts +17 -0
  98. package/dist/templates/bpmn-task.js +18 -0
  99. package/dist/templates/bpmn-task.js.map +1 -0
  100. package/dist/templates/index.d.ts +15 -0
  101. package/dist/templates/index.js +28 -0
  102. package/dist/templates/index.js.map +1 -0
  103. package/helps/bpmn/gateway/complex-decision-gateway-example.png +0 -0
  104. package/helps/bpmn/gateway/complex-decision-gateway.png +0 -0
  105. package/helps/bpmn/gateway/event-based-gateway-example.webp +0 -0
  106. package/helps/bpmn/gateway/exclusive-event-based-gateway-example.png +0 -0
  107. package/helps/bpmn/gateway/exclusive-event-based-gateway.webp +0 -0
  108. package/helps/bpmn/gateway/exclusive-gateway-example.webp +0 -0
  109. package/helps/bpmn/gateway/exclusive-gateway.png +0 -0
  110. package/helps/bpmn/gateway/gateway-types.webp +0 -0
  111. package/helps/bpmn/gateway/gateway.md +111 -0
  112. package/helps/bpmn/gateway/inclusive-gateway-example.webp +0 -0
  113. package/helps/bpmn/gateway/inclusive-gateway.png +0 -0
  114. package/helps/bpmn/gateway/parallel-event-based-gateway-example.png +0 -0
  115. package/helps/bpmn/gateway/parallel-event-based-gateway.png +0 -0
  116. package/helps/bpmn/gateway/parallel-gateway-example.webp +0 -0
  117. package/helps/bpmn/gateway/parallel-gateway.png +0 -0
  118. package/icons/bpmn-group.png +0 -0
  119. package/icons/bpmn-lane.png +0 -0
  120. package/icons/bpmn-pool.png +0 -0
  121. package/icons/icon-bpmn-association-flow.png +0 -0
  122. package/icons/icon-bpmn-call-activity.png +0 -0
  123. package/icons/icon-bpmn-comment.png +0 -0
  124. package/icons/icon-bpmn-data-object.png +0 -0
  125. package/icons/icon-bpmn-data-store.png +0 -0
  126. package/icons/icon-bpmn-event.png +0 -0
  127. package/icons/icon-bpmn-flow.png +0 -0
  128. package/icons/icon-bpmn-gateway.png +0 -0
  129. package/icons/icon-bpmn-group.png +0 -0
  130. package/icons/icon-bpmn-lane.png +0 -0
  131. package/icons/icon-bpmn-message-flow.png +0 -0
  132. package/icons/icon-bpmn-pool.png +0 -0
  133. package/icons/icon-bpmn-subprocess.png +0 -0
  134. package/icons/icon-bpmn-task.png +0 -0
  135. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +20 -0
  136. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +20 -0
  137. package/logs/application-2022-11-03-10.log +22 -0
  138. package/logs/application-2022-11-03-11.log +18 -0
  139. package/logs/connections-2022-11-03-10.log +70 -0
  140. package/logs/connections-2022-11-03-11.log +105 -0
  141. package/package.json +60 -0
  142. package/src/base/bpmn-activity.ts +32 -0
  143. package/src/base/bpmn-container-base.ts +201 -0
  144. package/src/base/bpmn-control-base.ts +201 -0
  145. package/src/bpmn-call-activity.ts +22 -0
  146. package/src/bpmn-comment.ts +65 -0
  147. package/src/bpmn-data-object.ts +127 -0
  148. package/src/bpmn-data-store.ts +47 -0
  149. package/src/bpmn-event.ts +442 -0
  150. package/src/bpmn-flow.ts +28 -0
  151. package/src/bpmn-gateway.ts +165 -0
  152. package/src/bpmn-group.ts +39 -0
  153. package/src/bpmn-lane.ts +46 -0
  154. package/src/bpmn-pool.ts +25 -0
  155. package/src/bpmn-subprocess.ts +165 -0
  156. package/src/bpmn-task.ts +340 -0
  157. package/src/editors/index.ts +0 -0
  158. package/src/groups/index.ts +3 -0
  159. package/src/groups/process.ts +48 -0
  160. package/src/index.ts +12 -0
  161. package/src/templates/bpmn-call-activity.ts +18 -0
  162. package/src/templates/bpmn-comment.ts +20 -0
  163. package/src/templates/bpmn-data-object.ts +20 -0
  164. package/src/templates/bpmn-data-store.ts +18 -0
  165. package/src/templates/bpmn-event.ts +18 -0
  166. package/src/templates/bpmn-flow.ts +16 -0
  167. package/src/templates/bpmn-gateway.ts +18 -0
  168. package/src/templates/bpmn-group.ts +16 -0
  169. package/src/templates/bpmn-lane.ts +18 -0
  170. package/src/templates/bpmn-pool.ts +16 -0
  171. package/src/templates/bpmn-subprocess.ts +18 -0
  172. package/src/templates/bpmn-task.ts +18 -0
  173. package/src/templates/index.ts +29 -0
  174. package/things-scene.config.js +7 -0
  175. package/translations/en.json +11 -0
  176. package/translations/ko.json +11 -0
  177. package/translations/ms.json +11 -0
  178. package/translations/zh.json +11 -0
  179. package/tsconfig.json +22 -0
  180. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,46 @@
1
+ import { Component } from '@hatiolab/things-scene'
2
+
3
+ import BPMNContainerBase, { DIRECTION, INOUT, NODE, FLOW } from './base/bpmn-container-base'
4
+
5
+ const NATURE = {
6
+ mutable: false,
7
+ resizable: true,
8
+ rotatable: false,
9
+ properties: [
10
+ {
11
+ type: 'string',
12
+ name: 'participant',
13
+ label: 'participant'
14
+ }
15
+ ],
16
+ help: '/eipatterns/bpmn-lane/bpmn-lane'
17
+ }
18
+
19
+ export default class BPMNLane extends BPMNContainerBase {
20
+ get nature() {
21
+ return NATURE
22
+ }
23
+
24
+ get hasTextProperty() {
25
+ return true
26
+ }
27
+
28
+ // get text() {
29
+ // return this.state.name
30
+ // }
31
+
32
+ // get textBounds() {
33
+ // var { paddingTop = 0, paddingLeft = 0, paddingRight = 0, paddingBottom = 0 } = this.state
34
+
35
+ // var { left, top, width, height } = this.bounds
36
+
37
+ // return {
38
+ // left: left + paddingLeft,
39
+ // top: top + paddingTop,
40
+ // width: Math.max(width - paddingLeft - paddingRight, 0),
41
+ // height: Math.max(height - paddingTop - paddingBottom, 0)
42
+ // }
43
+ // }
44
+ }
45
+
46
+ Component.register('bpmn-lane', BPMNLane)
@@ -0,0 +1,25 @@
1
+ import { Component } from '@hatiolab/things-scene'
2
+
3
+ import BPMNContainerBase, { DIRECTION, INOUT, NODE, FLOW } from './base/bpmn-container-base'
4
+
5
+ const NATURE = {
6
+ mutable: false,
7
+ resizable: true,
8
+ rotatable: false,
9
+ properties: [
10
+ {
11
+ type: 'string',
12
+ name: 'name',
13
+ label: 'name'
14
+ }
15
+ ],
16
+ help: '/eipatterns/bpmn-pool/bpmn-pool'
17
+ }
18
+
19
+ export default class BPMNPool extends BPMNContainerBase {
20
+ get nature() {
21
+ return NATURE
22
+ }
23
+ }
24
+
25
+ Component.register('bpmn-pool', BPMNPool)
@@ -0,0 +1,165 @@
1
+ import { Component, Properties } from '@hatiolab/things-scene'
2
+
3
+ import BPMNControlBase from './base/bpmn-control-base'
4
+
5
+ const NATURE = {
6
+ mutable: false,
7
+ resizable: true,
8
+ rotatable: false,
9
+ properties: [
10
+ {
11
+ type: 'checkbox',
12
+ label: 'loop',
13
+ name: 'loop'
14
+ },
15
+ {
16
+ type: 'checkbox',
17
+ label: 'multi-instance',
18
+ name: 'multiInstance'
19
+ },
20
+ {
21
+ type: 'checkbox',
22
+ label: 'compensation',
23
+ name: 'compensation'
24
+ },
25
+ {
26
+ type: 'checkbox',
27
+ label: 'adhoc',
28
+ name: 'adhoc'
29
+ }
30
+ ],
31
+ help: '/eipatterns/bpmn-subprocess/bpmn-subprocess'
32
+ }
33
+
34
+ export default class BPMNSubprocess extends BPMNControlBase {
35
+ private markerImages?: HTMLImageElement[]
36
+
37
+ static get nature() {
38
+ return NATURE
39
+ }
40
+
41
+ render(ctx: CanvasRenderingContext2D) {
42
+ var { left, top, width, height } = this.bounds
43
+
44
+ ctx.translate(left, top)
45
+ ctx.beginPath()
46
+
47
+ var radius = 9
48
+
49
+ ctx.moveTo(radius, 0)
50
+ ctx.arcTo(width, 0, width, height, radius)
51
+ ctx.arcTo(width, height, 0, height, radius)
52
+ ctx.arcTo(0, height, 0, 0, radius)
53
+ ctx.arcTo(0, 0, width, 0, radius)
54
+
55
+ this.drawFill(ctx)
56
+ this.drawStroke(ctx)
57
+
58
+ ctx.beginPath()
59
+
60
+ const images = this.getMarkerImages() || []
61
+ const start = (width - images.length * 24) / 2
62
+
63
+ images.forEach((image, index) => {
64
+ this.drawImage(ctx, image, start + index * 24, height - 24, 24, 24)
65
+ })
66
+
67
+ ctx.translate(-left, -top)
68
+ }
69
+
70
+ onchange(after: Properties, before: Properties) {
71
+ if (['loop', 'multiInstance', 'adhoc', 'compensation', 'strokeStyle'].find(prop => prop in after)) {
72
+ delete this.markerImages
73
+ }
74
+ }
75
+
76
+ getMarkerImages(): HTMLImageElement[] | null | undefined {
77
+ if (!this.markerImages) {
78
+ const { strokeStyle } = this.state
79
+
80
+ this.markerImages = Object.keys(MARKERS)
81
+ .filter(key => key === 'subprocess' || this.state[key])
82
+ .map(key => {
83
+ let image = new Image()
84
+ image.src =
85
+ 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(MARKERS[key].replace(/{{strokeColor}}/g, strokeStyle))
86
+ return image
87
+ })
88
+ }
89
+
90
+ return this.markerImages
91
+ }
92
+ }
93
+
94
+ Component.register('bpmn-subprocess', BPMNSubprocess)
95
+
96
+ const MARKERS: { [type: string]: string } = {
97
+ loop: `
98
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
99
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
100
+ <style type="text/css">
101
+ .st0{fill:{{strokeColor}};}
102
+ </style>
103
+ <path class="st0" d="M9.5,5.2C4.3,9.7,3.7,17.5,8.1,22.8L5,25.4l7.8,0.6l0.6-7.8L10.2,21c-3.5-4.1-3-10.1,1-13.6s10.1-3,13.6,1
104
+ s3,10.1-1,13.6c-1.6,1.4-3.5,2.1-5.4,2.3l-0.2,2.8c2.6-0.2,5.3-1.1,7.4-3c5.2-4.5,5.8-12.3,1.3-17.5S14.7,0.8,9.5,5.2z"/>
105
+ </svg>
106
+ `,
107
+ multiInstance: `
108
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
109
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
110
+ <style type="text/css">
111
+ .st0{fill:{{strokeColor}};}
112
+ </style>
113
+ <g>
114
+ <rect x="5.5" y="1.9" class="st0" width="3.3" height="25.3"/>
115
+ <rect x="15.9" y="1.9" class="st0" width="3.3" height="25.3"/>
116
+ <rect x="26.2" y="1.9" class="st0" width="3.3" height="25.3"/>
117
+ </g>
118
+ </svg>
119
+ `,
120
+ compensation: `
121
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
122
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
123
+ <style type="text/css">
124
+ .st0{fill:{{strokeColor}};}
125
+ </style>
126
+ <g>
127
+ <path class="st0" d="M16.1,6.9v15.6l-7.8-7.8L16.1,6.9 M18.1,2.1L5.5,14.7l12.6,12.6V2.1L18.1,2.1z M5.5,14.7L5.5,14.7L5.5,14.7
128
+ L5.5,14.7L5.5,14.7z"/>
129
+ </g>
130
+ <g>
131
+ <path class="st0" d="M27.5,6.9v15.6l-7.8-7.8L27.5,6.9 M29.5,2.1L16.9,14.7l12.6,12.6V2.1L29.5,2.1z M16.9,14.7L16.9,14.7
132
+ L16.9,14.7L16.9,14.7L16.9,14.7z"/>
133
+ </g>
134
+ </svg>
135
+ `,
136
+ subprocess: `
137
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
138
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
139
+ <style type="text/css">
140
+ .st0{fill:none;stroke:{{strokeColor}};stroke-width:2;stroke-miterlimit:10;}
141
+ .st1{fill:{{strokeColor}};}
142
+ </style>
143
+ <rect x="5.5" y="2.5" class="st0" width="24" height="24"/>
144
+ <g>
145
+ <g>
146
+ <rect x="16.4" y="6" class="st1" width="2.1" height="17"/>
147
+ </g>
148
+ <g>
149
+ <rect x="9" y="13.4" class="st1" width="17" height="2.1"/>
150
+ </g>
151
+ </g>
152
+ </svg>
153
+ `,
154
+ adhoc: `
155
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
156
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
157
+ <style type="text/css">
158
+ .st0{fill:{{strokeColor}};}
159
+ </style>
160
+ <path class="st0" d="M29.2,10.3c-0.8,0.9-1.7,1.7-2.5,2.2c-0.8,0.5-1.6,0.8-2.4,0.8c-1,0-3-0.6-6.1-1.9C15,10.2,12.6,9.6,11,9.6
161
+ c-2.1,0-3.9,0.7-5.5,1.9v6.9c0.1,0,0.3-0.2,0.6-0.6C7.9,16,9.5,15,10.9,15c0.8,0,2.9,0.6,6.1,1.9c3.3,1.2,5.7,1.8,7.1,1.8
162
+ c2,0,3.8-0.6,5.3-1.8v-6.9C29.4,10.1,29.3,10.2,29.2,10.3z"/>
163
+ </svg>
164
+ `
165
+ }
@@ -0,0 +1,340 @@
1
+ import { Component, Properties } from '@hatiolab/things-scene'
2
+
3
+ import BPMNControlBase from './base/bpmn-control-base'
4
+
5
+ const NATURE = {
6
+ mutable: false,
7
+ resizable: true,
8
+ rotatable: false,
9
+ properties: [
10
+ {
11
+ type: 'select',
12
+ label: 'task-type',
13
+ name: 'taskType',
14
+ property: {
15
+ options: [
16
+ {
17
+ display: '',
18
+ value: ''
19
+ },
20
+ {
21
+ display: 'service',
22
+ value: 'service'
23
+ },
24
+ {
25
+ display: 'send',
26
+ value: 'send'
27
+ },
28
+ {
29
+ display: 'receive',
30
+ value: 'receive'
31
+ },
32
+ {
33
+ display: 'user',
34
+ value: 'user'
35
+ },
36
+ {
37
+ display: 'manual',
38
+ value: 'manual'
39
+ },
40
+ {
41
+ display: 'business rule',
42
+ value: 'business-rule'
43
+ },
44
+ {
45
+ display: 'script',
46
+ value: 'script'
47
+ }
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ type: 'select',
53
+ label: 'multi-instance',
54
+ name: 'multiInstance',
55
+ property: {
56
+ options: [
57
+ {
58
+ display: '',
59
+ value: ''
60
+ },
61
+ {
62
+ display: 'parallel',
63
+ value: 'parallel'
64
+ },
65
+ {
66
+ display: 'sequential',
67
+ value: 'sequential'
68
+ }
69
+ ]
70
+ }
71
+ },
72
+ {
73
+ type: 'checkbox',
74
+ label: 'loop',
75
+ name: 'loop'
76
+ }
77
+ ],
78
+ help: '/eipatterns/bpmn-task/bpmn-task'
79
+ }
80
+
81
+ export default class BPMNTask extends BPMNControlBase {
82
+ private imageElement?: HTMLImageElement
83
+ private markerImages?: HTMLImageElement[]
84
+
85
+ static get nature() {
86
+ return NATURE
87
+ }
88
+
89
+ render(ctx: CanvasRenderingContext2D) {
90
+ var { left, top, width, height } = this.bounds
91
+
92
+ ctx.translate(left, top)
93
+ ctx.beginPath()
94
+
95
+ var radius = 9
96
+
97
+ ctx.moveTo(radius, 0)
98
+ ctx.arcTo(width, 0, width, height, radius)
99
+ ctx.arcTo(width, height, 0, height, radius)
100
+ ctx.arcTo(0, height, 0, 0, radius)
101
+ ctx.arcTo(0, 0, width, 0, radius)
102
+
103
+ this.drawFill(ctx)
104
+ this.drawStroke(ctx)
105
+
106
+ ctx.beginPath()
107
+
108
+ const image = this.getImageElement()
109
+ if (image) {
110
+ this.drawImage(ctx, image, 0, 0, 24, 24)
111
+ }
112
+
113
+ const images = this.getMarkerImages() || []
114
+ const start = (width - images.length * 24) / 2
115
+
116
+ images.forEach((image, index) => {
117
+ this.drawImage(ctx, image, start + index * 24, height - 24, 24, 24)
118
+ })
119
+
120
+ ctx.translate(-left, -top)
121
+ }
122
+
123
+ onchange(after: Properties, before: Properties) {
124
+ if (['loop', 'multiInstance', 'taskType', 'strokeStyle'].find(prop => prop in after)) {
125
+ delete this.markerImages
126
+ delete this.imageElement
127
+ }
128
+ }
129
+
130
+ getImageElement(): HTMLImageElement | null | undefined {
131
+ if (!this.imageElement) {
132
+ const { taskType, strokeStyle } = this.state
133
+
134
+ if (!taskType) {
135
+ return
136
+ }
137
+
138
+ const src = IMAGES[taskType]
139
+ if (!src) {
140
+ return
141
+ }
142
+
143
+ this.imageElement = new Image()
144
+ this.imageElement.src =
145
+ 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(src.replace(/{{strokeColor}}/g, strokeStyle))
146
+ }
147
+
148
+ return this.imageElement
149
+ }
150
+
151
+ getMarkerImages(): HTMLImageElement[] | null | undefined {
152
+ if (!this.markerImages) {
153
+ const { loop, multiInstance, strokeStyle } = this.state
154
+
155
+ this.markerImages = []
156
+
157
+ if (loop) {
158
+ let image = new Image()
159
+ image.src =
160
+ 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(MARKERS['loop'].replace(/{{strokeColor}}/g, strokeStyle))
161
+ this.markerImages.push(image)
162
+ }
163
+
164
+ if (multiInstance) {
165
+ let image = new Image()
166
+ image.src =
167
+ 'data:image/svg+xml;charset=UTF-8;base64,' +
168
+ btoa(MARKERS[multiInstance].replace(/{{strokeColor}}/g, strokeStyle))
169
+ this.markerImages.push(image)
170
+ }
171
+ }
172
+
173
+ return this.markerImages
174
+ }
175
+ }
176
+
177
+ Component.register('bpmn-task', BPMNTask)
178
+
179
+ const IMAGES: { [type: string]: string } = {
180
+ service: `
181
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
182
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
183
+ <style type="text/css">
184
+ .st0{fill:{{strokeColor}};}
185
+ </style>
186
+ <g>
187
+ <g>
188
+ <path class="st0" d="M22.6,11.3l0.3,2.1l0.1,0.6l0.5,0.2c0.5,0.2,0.9,0.5,1.4,0.8l0.5,0.3l0.5-0.2l2-0.8l1.5,2.5l-1.7,1.3
189
+ l-0.5,0.4l0.1,0.6c0,0.2,0.1,0.5,0.1,0.8c0,0.3,0,0.5-0.1,0.8l-0.1,0.6l0.4,0.4l1.7,1.3l-1.5,2.5l-2-0.8l-0.5-0.2l-0.5,0.4
190
+ c-0.4,0.3-0.9,0.6-1.4,0.8L23,25.8l-0.1,0.6l-0.3,2.1h-2.9l-0.3-2.1l-0.1-0.6l-0.5-0.2c-0.5-0.2-0.9-0.5-1.4-0.8l-0.5-0.3
191
+ l-0.5,0.2l-2,0.8l-1.5-2.5l1.7-1.3l0.5-0.4L15,20.6c0-0.2-0.1-0.5-0.1-0.8c0-0.2,0-0.5,0.1-0.8l0.1-0.6l-0.5-0.4L13,16.8l1.5-2.5
192
+ l2,0.8l0.5,0.2l0.5-0.3c0.5-0.4,0.9-0.6,1.4-0.8l0.5-0.2l0.1-0.6l0.3-2.1H22.6 M21.1,24.5c2.5,0,4.6-2.1,4.6-4.6s-2.1-4.6-4.6-4.6
193
+ s-4.6,2.1-4.6,4.6S18.6,24.5,21.1,24.5 M23,10.3h-3.8c-0.2,0-0.4,0.2-0.5,0.4l-0.4,2.5c-0.6,0.2-1.1,0.6-1.6,0.9l-2.4-1
194
+ c-0.1,0-0.1,0-0.2,0c-0.2,0-0.3,0.1-0.4,0.3l-1.9,3.3c-0.1,0.2-0.1,0.5,0.1,0.6l2,1.6c-0.1,0.3-0.1,0.6-0.1,0.9s0,0.6,0.1,0.9
195
+ l-2,1.6c-0.2,0.1-0.2,0.4-0.1,0.6l1.9,3.3c0.1,0.2,0.3,0.2,0.4,0.2c0.1,0,0.1,0,0.2,0l2.4-1c0.5,0.4,1,0.7,1.6,0.9l0.4,2.5
196
+ c0,0.2,0.2,0.4,0.5,0.4H23c0.2,0,0.4-0.2,0.5-0.4l0.4-2.5c0.6-0.2,1.1-0.6,1.6-0.9l2.4,1c0.1,0,0.1,0,0.2,0c0.2,0,0.3-0.1,0.4-0.3
197
+ l1.9-3.3c0.1-0.2,0.1-0.5-0.1-0.6l-2-1.6c0-0.3,0.1-0.6,0.1-0.9c0-0.3,0-0.6-0.1-0.9l2-1.6c0.2-0.1,0.2-0.4,0.1-0.6l-1.9-3.3
198
+ c-0.1-0.2-0.3-0.2-0.4-0.2c-0.1,0-0.1,0-0.2,0l-2.4,1c-0.5-0.4-1-0.7-1.6-0.9l-0.4-2.5C23.5,10.4,23.3,10.3,23,10.3L23,10.3z
199
+ M21.1,23.5c-2,0-3.6-1.6-3.6-3.6s1.6-3.6,3.6-3.6s3.6,1.6,3.6,3.6S23.1,23.5,21.1,23.5L21.1,23.5z"/>
200
+ </g>
201
+ <g>
202
+ <g>
203
+ <path class="st0" d="M16.8,6.5L17.2,9l0.1,0.6l0.3,0.1l-1,1.9c-0.5-0.2-1-0.3-1.5-0.3c-2.8,0-5.1,2.3-5.1,5.1
204
+ c0,1.3,0.5,2.5,1.3,3.4l-1.2,1.9l-0.4,0.2l-2.3,0.9l-1.8-3.1l2-1.5l0.5-0.4L8,17.3c0-0.3-0.1-0.6-0.1-0.9c0-0.2,0-0.5,0.1-0.9
205
+ l0.1-0.6l-0.5-0.4l-2-1.5l1.8-3.1l2.3,0.9l0.5,0.2l0.5-0.3c0.5-0.4,1.1-0.7,1.6-0.9l0.5-0.2L13,9l0.3-2.5H16.8 M17.2,5.5h-4.3
206
+ c-0.3,0-0.5,0.2-0.5,0.5L12,8.9c-0.7,0.3-1.3,0.6-1.8,1.1L7.4,8.8c-0.1,0-0.1,0-0.2,0c-0.2,0-0.4,0.1-0.5,0.3l-2.2,3.7
207
+ c-0.1,0.2-0.1,0.5,0.1,0.7L7,15.3C7,15.6,6.9,16,6.9,16.4c0,0.3,0,0.7,0.1,1.1l-2.3,1.8c-0.2,0.2-0.3,0.5-0.1,0.7l2.2,3.7
208
+ c0.1,0.2,0.3,0.3,0.5,0.3c0.1,0,0.1,0,0.2,0l2.7-1.1c0.1,0.1,0.3,0.2,0.4,0.3l2.1-3.5c-1-0.7-1.6-1.9-1.6-3.2
209
+ c0-2.2,1.8-4.1,4.1-4.1c0.7,0,1.4,0.2,2,0.5l1.9-3.6c-0.2-0.1-0.5-0.3-0.8-0.4L17.8,6C17.7,5.7,17.5,5.5,17.2,5.5L17.2,5.5z"/>
210
+ </g>
211
+ </g>
212
+ </g>
213
+ </svg>
214
+ `,
215
+ send: `
216
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
217
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
218
+ <style type="text/css">
219
+ .st0{fill:{{strokeColor}};}
220
+ </style>
221
+ <path class="st0" d="M27.1,7.9H7.9c-1.3,0-2.4,1.1-2.4,2.4l0,14.4c0,1.3,1.1,2.4,2.4,2.4h19.2c1.3,0,2.4-1.1,2.4-2.4V10.3
222
+ C29.5,9,28.4,7.9,27.1,7.9z M27.1,12.7l-9.6,6l-9.6-6v-2.4l9.6,6l9.6-6V12.7z"/>
223
+ </svg>
224
+ `,
225
+ receive: `
226
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
227
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
228
+ <style type="text/css">
229
+ .st0{fill:{{strokeColor}};}
230
+ </style>
231
+ <path class="st0" d="M29.5,10.3c0-1.3-1.1-2.4-2.4-2.4H7.9c-1.3,0-2.4,1.1-2.4,2.4v14.4c0,1.3,1.1,2.4,2.4,2.4h19.2c1.3,0,2.4-1.1,2.4-2.4V10.3z
232
+ M27.1,9.3l-9.6,7l-9.6-7H27.1z M28.1,25.7H6.9v-16l10.6,8l10.6-8V25.7z"/>
233
+ </svg>
234
+ `,
235
+ user: `
236
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
237
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
238
+ <style type="text/css">
239
+ .st0{fill:{{strokeColor}};}
240
+ </style>
241
+ <g>
242
+ <g>
243
+ <path class="st0" d="M17.5,6.5c2.8,0,5,2.2,5,5s-2.2,5-5,5s-5-2.2-5-5S14.7,6.5,17.5,6.5 M17.4,20c3.6,0,10.1,3.3,10.1,6.5v2h-20v-2
244
+ C7.5,23.3,13.8,20,17.4,20 M17.5,5.5c-3.3,0-6,2.7-6,6s2.7,6,6,6s6-2.7,6-6S20.8,5.5,17.5,5.5L17.5,5.5z M17.4,19
245
+ c-4,0-10.9,3.6-10.9,7.5v3h22v-3C28.5,22.5,21.4,19,17.4,19L17.4,19z"/>
246
+ </g>
247
+ <path class="st0" d="M14.6,7.2c0,0,2,4.5,7.9,3.9C22.5,11.1,21.8,4.3,14.6,7.2z"/>
248
+ <path class="st0" d="M16.2,9.4c0,0-1.2,1.3-4,1.2l1.2-2.5L14.9,7L16.2,9.4z"/>
249
+ </g>
250
+ </svg>
251
+ `,
252
+ manual: `
253
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
254
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
255
+ <style type="text/css">
256
+ .st0{fill:none;stroke:{{strokeColor}};stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
257
+ </style>
258
+ <g>
259
+ <g>
260
+ <g>
261
+ <path class="st0" d="M24,28.5H9.5c-2.2,0-4-1.8-4-4v-7.3c0-1.1,0.4-2.1,1.2-2.9l8-7.9c0,0,1.2,1.3,1.2,1.3
262
+ c0.2,0.2,0.3,0.5,0.3,0.8c0,0.2-0.1,0.4-0.2,0.6c0,0-2.5,4.3-2.5,4.3h11.9c0.8,0,1.5,0.7,1.5,1.5s-0.7,1.5-1.5,1.5h-7v1H28
263
+ c0.8,0,1.5,0.7,1.5,1.5s-0.7,1.5-1.5,1.5h-9.5v1H27c0.8,0,1.5,0.7,1.5,1.5s-0.7,1.5-1.5,1.5h-8.5v1H24c0.8,0,1.5,0.7,1.5,1.5
264
+ S24.8,28.5,24,28.5z"/>
265
+ </g>
266
+ </g>
267
+ </g>
268
+ </svg>
269
+ `,
270
+ 'business-rule': `
271
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
272
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
273
+ <style type="text/css">
274
+ .st0{fill:{{strokeColor}};}
275
+ </style>
276
+ <g>
277
+ <g>
278
+ <path class="st0" d="M28.6,11.1v14.8H6.5V11.1h20.3 M26.8,8H8.2c-1.5,0-2.7,1-2.7,2.1v15.8c0,1.2,1.2,1.1,2.7,1.1h18.7c1.5,0,2.7,0.1,2.7-1.1
279
+ V10.1C29.5,8.9,28.3,8,26.8,8L26.8,8z"/>
280
+ </g>
281
+ <path class="st0" d="M29,21.4H6v-1h23V21.4z M28.8,16.4h-23v-1h23V16.4z M14.2,10.6v16h-1v-16H14.2z"/>
282
+ </g>
283
+ </svg>
284
+ `,
285
+ script: `
286
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
287
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
288
+ <style type="text/css">
289
+ .st0{fill:none;stroke:{{strokeColor}};stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
290
+ </style>
291
+ <g>
292
+ <path class="st0" d="M7.9,8h20.8c0,0-2.9,1.7-2.6,7.2c0.1,1,0.5,2,1.1,2.9c1.1,1.5,3,4.6,0.4,9h-21c0,0,3.2-5.5,1-9
293
+ C7.6,18,3.8,12.4,7.9,8z"/>
294
+ <rect class="st0" x="9.1" y="11.3" width="14" height="1"/>
295
+ <rect class="st0" x="9.7" y="15" width="14" height="1"/>
296
+ <rect class="st0" x="10.7" y="18.7" width="14" height="1"/>
297
+ <rect class="st0" x="11.7" y="22.3" width="14" height="1"/>
298
+ </g>
299
+ </svg>
300
+ `
301
+ }
302
+
303
+ const MARKERS: { [type: string]: string } = {
304
+ loop: `
305
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
306
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
307
+ <style type="text/css">
308
+ .st0{fill:{{strokeColor}};}
309
+ </style>
310
+ <path class="st0" d="M9.5,5.2C4.3,9.7,3.7,17.5,8.1,22.8L5,25.4l7.8,0.6l0.6-7.8L10.2,21c-3.5-4.1-3-10.1,1-13.6s10.1-3,13.6,1
311
+ s3,10.1-1,13.6c-1.6,1.4-3.5,2.1-5.4,2.3l-0.2,2.8c2.6-0.2,5.3-1.1,7.4-3c5.2-4.5,5.8-12.3,1.3-17.5S14.7,0.8,9.5,5.2z"/>
312
+ </svg>
313
+ `,
314
+ parallel: `
315
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
316
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
317
+ <style type="text/css">
318
+ .st0{fill:{{strokeColor}};}
319
+ </style>
320
+ <g>
321
+ <rect x="5.5" y="1.9" class="st0" width="3.3" height="25.3"/>
322
+ <rect x="15.9" y="1.9" class="st0" width="3.3" height="25.3"/>
323
+ <rect x="26.2" y="1.9" class="st0" width="3.3" height="25.3"/>
324
+ </g>
325
+ </svg>
326
+ `,
327
+ sequential: `
328
+ <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
329
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
330
+ <style type="text/css">
331
+ .st0{fill:{{strokeColor}};}
332
+ </style>
333
+ <g>
334
+ <rect x="4.8" y="2.6" width="25.3" height="3.3" class="st0"/>
335
+ <rect x="4.8" y="13" width="25.3" height="3.3" class="st0"/>
336
+ <rect x="4.8" y="23.3" width="25.3" height="3.3" class="st0"/>
337
+ </g>
338
+ </svg>
339
+ `
340
+ }
File without changes
@@ -0,0 +1,3 @@
1
+ import { process } from './process'
2
+
3
+ export default [process]
@@ -0,0 +1,48 @@
1
+ const icon = `
2
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
3
+ viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
4
+ <style type="text/css">
5
+ .st0{fill:{{strokeColor}};}
6
+ </style>
7
+ <g>
8
+ <g>
9
+ <path class="st0" d="M33.2,15.2v4.6h-4.6v-4.6H33.2 M34,14.4h-6.1v6.1H34V14.4L34,14.4z"/>
10
+ </g>
11
+ <g>
12
+ <g>
13
+ <path class="st0" d="M17.5,15.3l2.2,2.2l-2.2,2.2l-2.2-2.2L17.5,15.3 M17.5,14.2l-3.3,3.3l3.3,3.3l3.3-3.3L17.5,14.2L17.5,14.2z"
14
+ />
15
+ </g>
16
+ <g>
17
+ <path class="st0" d="M19.8,7.2v4.6h-4.6V7.2H19.8 M20.6,6.5h-6.1v6.1h6.1V6.5L20.6,6.5z"/>
18
+ </g>
19
+ <g>
20
+ <path class="st0" d="M19.8,23.1v4.6h-4.6v-4.6H19.8 M20.6,22.4h-6.1v6.1h6.1V22.4L20.6,22.4z"/>
21
+ </g>
22
+ </g>
23
+ <g>
24
+ <g>
25
+ <polygon class="st0" points="13.3,17.4 10.6,19.6 10.6,15.2 13.3,17.4 "/>
26
+ </g>
27
+ <rect x="8.2" y="16.9" class="st0" width="3.4" height="0.9"/>
28
+ </g>
29
+ <g>
30
+ <g>
31
+ <polygon class="st0" points="26.8,17.4 24,19.6 24,15.2 26.8,17.4 "/>
32
+ </g>
33
+ <rect x="21.7" y="16.9" class="st0" width="3.4" height="0.9"/>
34
+ </g>
35
+ <g>
36
+ <path class="st0" d="M4.1,15.2c1.3,0,2.3,1,2.3,2.3s-1,2.3-2.3,2.3s-2.3-1-2.3-2.3S2.8,15.2,4.1,15.2 M4.1,14.4
37
+ c-1.7,0-3.1,1.4-3.1,3.1c0,1.7,1.4,3.1,3.1,3.1s3.1-1.4,3.1-3.1C7.1,15.8,5.8,14.4,4.1,14.4L4.1,14.4z"/>
38
+ </g>
39
+ </g>
40
+ </svg>
41
+ `
42
+
43
+ export const process = {
44
+ name: 'process',
45
+ description: 'a group of Business Process Management Notation',
46
+ icon,
47
+ templates: []
48
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ export { default as BPMNCallActivity } from './bpmn-call-activity'
2
+ export { default as BPMNComment } from './bpmn-comment'
3
+ export { default as BPMNDataObject } from './bpmn-data-object'
4
+ export { default as BPMNDataStore } from './bpmn-data-store'
5
+ export { default as BPMNEvent } from './bpmn-event'
6
+ export { default as BPMNFlow } from './bpmn-flow'
7
+ export { default as BPMNGateway } from './bpmn-gateway'
8
+ export { default as BPMNGroup } from './bpmn-group'
9
+ export { default as BPMNLane } from './bpmn-lane'
10
+ export { default as BPMNPool } from './bpmn-pool'
11
+ export { default as BPMNSubprocess } from './bpmn-subprocess'
12
+ export { default as BPMNTask } from './bpmn-task'
@@ -0,0 +1,18 @@
1
+ const icon = new URL('../../icons/icon-bpmn-call-activity.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'bpmn-call-activity',
5
+ description: 'controls for BPMN call-activity',
6
+ group: 'process',
7
+ icon,
8
+ model: {
9
+ type: 'bpmn-call-activity',
10
+ left: 10,
11
+ top: 10,
12
+ width: 100,
13
+ height: 60,
14
+ strokeStyle: 'black',
15
+ lineWidth: 2
16
+ },
17
+ about: 'https://www.visual-paradigm.com/guide/bpmn/bpmn-activity-types-explained/'
18
+ }