@operato/scene-bpmn 7.3.9 → 7.3.19

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 (39) hide show
  1. package/package.json +2 -2
  2. package/CHANGELOG.md +0 -374
  3. package/src/base/bpmn-activity.ts +0 -32
  4. package/src/base/bpmn-container-base.ts +0 -201
  5. package/src/base/bpmn-control-base.ts +0 -201
  6. package/src/bpmn-comment.ts +0 -64
  7. package/src/bpmn-data-object.ts +0 -181
  8. package/src/bpmn-data-store.ts +0 -63
  9. package/src/bpmn-event.ts +0 -468
  10. package/src/bpmn-expanded-subprocess.ts +0 -207
  11. package/src/bpmn-flow.ts +0 -37
  12. package/src/bpmn-gateway.ts +0 -181
  13. package/src/bpmn-group.ts +0 -39
  14. package/src/bpmn-lane.ts +0 -125
  15. package/src/bpmn-message.ts +0 -57
  16. package/src/bpmn-pool.ts +0 -25
  17. package/src/bpmn-subprocess.ts +0 -323
  18. package/src/bpmn-task.ts +0 -479
  19. package/src/characteristics/loop.ts +0 -0
  20. package/src/editors/index.ts +0 -0
  21. package/src/groups/index.ts +0 -3
  22. package/src/groups/process.ts +0 -48
  23. package/src/index.ts +0 -13
  24. package/src/templates/bpmn-comment.ts +0 -24
  25. package/src/templates/bpmn-data-object.ts +0 -21
  26. package/src/templates/bpmn-data-store.ts +0 -19
  27. package/src/templates/bpmn-event.ts +0 -19
  28. package/src/templates/bpmn-expanded-subprocess.ts +0 -24
  29. package/src/templates/bpmn-flow.ts +0 -23
  30. package/src/templates/bpmn-gateway.ts +0 -19
  31. package/src/templates/bpmn-group.ts +0 -20
  32. package/src/templates/bpmn-lane.ts +0 -20
  33. package/src/templates/bpmn-message.ts +0 -21
  34. package/src/templates/bpmn-pool.ts +0 -18
  35. package/src/templates/bpmn-subprocess.ts +0 -18
  36. package/src/templates/bpmn-task.ts +0 -18
  37. package/src/templates/index.ts +0 -31
  38. package/tsconfig.json +0 -24
  39. package/tsconfig.tsbuildinfo +0 -1
@@ -1,201 +0,0 @@
1
- import { Anchor, BOUNDS, Component, Connectable, LinkEnd, Properties, RectPath, Shape } from '@hatiolab/things-scene'
2
-
3
- export enum DIRECTION {
4
- NORTH = 'N',
5
- EAST = 'E',
6
- SOUTH = 'S',
7
- WEST = 'W'
8
- }
9
-
10
- export enum INOUT {
11
- IN = 'in',
12
- OUT = 'out',
13
- INOUT = 'inout'
14
- }
15
-
16
- export enum FLOW {
17
- MESSAGE = 'message',
18
- SEQUENCE = 'sequence',
19
- ASSOCIATION = 'association'
20
- }
21
-
22
- export type NODE = {
23
- name: string
24
- description: string
25
- inout: INOUT
26
- type: FLOW
27
- direction: DIRECTION
28
- multiplicity?: number
29
- }
30
-
31
- const STYLE_MAP = {
32
- message: {
33
- strokeStyle: 'black',
34
- fillStyle: 'black'
35
- },
36
- sequence: {
37
- strokeStyle: 'red',
38
- fillStyle: 'red',
39
- lineDash: 'long-dash-dot'
40
- },
41
- association: {
42
- strokeStyle: 'yellow',
43
- fillStyle: 'yellow',
44
- lineDash: 'dash',
45
- begin: 'none',
46
- beginSize: 'size1',
47
- end: 'none',
48
- endSize: 'size1'
49
- }
50
- }
51
-
52
- type FILTER_FUNCTION = (this: Anchor, counterEnd?: LinkEnd) => boolean
53
-
54
- const ANCHOR_LENGTH = 8
55
-
56
- const TEMPLATE = {
57
- type: 'bpmn-flow',
58
- lineWidth: 2,
59
- strokeStyle: 'black',
60
- begin: 'none',
61
- beginSize: 'size1',
62
- end: 'arrow',
63
- endSize: 'size9',
64
- round: 10
65
- }
66
-
67
- function linkFilter(this: Anchor, counterEnd?: LinkEnd) {
68
- if (!counterEnd) {
69
- return this.inout !== 'in'
70
- }
71
-
72
- const { component, anchor } = counterEnd || {}
73
- /* FIXME remove !anchor.type condition */
74
- return !anchor?.type || anchor.type === this.type
75
- }
76
-
77
- export default abstract class BPMNControlBase extends Connectable(RectPath(Shape)) {
78
- get anchors(): Array<Anchor> {
79
- var allNodes = this.nodes
80
- var { left, top, width, height } = this.bounds
81
-
82
- var right = left + width
83
- var bottom = top + height
84
-
85
- const dirs: Array<Array<Anchor>> = [DIRECTION.NORTH, DIRECTION.EAST, DIRECTION.SOUTH, DIRECTION.WEST].map(
86
- direction => {
87
- const nodes = allNodes.filter(node => node.direction === direction)
88
- if (nodes.length === 0) {
89
- return []
90
- }
91
-
92
- var dx = 0
93
- var dy = 0
94
- var sx = 0
95
- var sy = 0
96
-
97
- switch (direction) {
98
- case DIRECTION.NORTH:
99
- sx = left
100
- sy = top
101
- dx = width / (nodes.length + 1)
102
- dy = 0
103
-
104
- break
105
-
106
- case DIRECTION.EAST:
107
- sx = right
108
- sy = top
109
- dx = 0
110
- dy = height / (nodes.length + 1)
111
-
112
- break
113
-
114
- case DIRECTION.SOUTH:
115
- sx = left
116
- sy = bottom
117
- dx = width / (nodes.length + 1)
118
- dy = 0
119
-
120
- break
121
-
122
- case DIRECTION.WEST:
123
- sx = left
124
- sy = top
125
- dx = 0
126
- dy = height / (nodes.length + 1)
127
-
128
- break
129
-
130
- default:
131
- }
132
-
133
- return nodes.map((node, idx) => {
134
- const x = sx + dx * (idx + 1)
135
- const y = sy + dy * (idx + 1)
136
-
137
- return {
138
- type: node.type as string,
139
- name: node.name,
140
- inout: node.inout,
141
- position: {
142
- x,
143
- y
144
- },
145
- bounds: {
146
- left: x - ANCHOR_LENGTH / 2,
147
- top: y - ANCHOR_LENGTH / 2,
148
- width: ANCHOR_LENGTH,
149
- height: ANCHOR_LENGTH
150
- },
151
- filter: linkFilter,
152
- template: {
153
- ...TEMPLATE,
154
- ...(STYLE_MAP[node.type || 'message'] || STYLE_MAP['message'])
155
- },
156
- multiplicity: node.multiplicity
157
- }
158
- })
159
- }
160
- )
161
-
162
- return dirs.flat()
163
- }
164
-
165
- get nodes(): NODE[] {
166
- return [
167
- {
168
- name: 'Left',
169
- description: 'Left side message inout',
170
- inout: INOUT.INOUT,
171
- type: FLOW.MESSAGE,
172
- direction: DIRECTION.WEST,
173
- multiplicity: 1
174
- },
175
- {
176
- name: 'Top',
177
- description: 'Top side message inout',
178
- inout: INOUT.INOUT,
179
- type: FLOW.MESSAGE,
180
- direction: DIRECTION.NORTH,
181
- multiplicity: 1
182
- },
183
- {
184
- name: 'Right',
185
- description: 'Right side message inout',
186
- inout: INOUT.INOUT,
187
- type: FLOW.MESSAGE,
188
- direction: DIRECTION.EAST,
189
- multiplicity: 1
190
- },
191
- {
192
- name: 'Down',
193
- description: 'Down side message inout',
194
- inout: INOUT.INOUT,
195
- type: FLOW.MESSAGE,
196
- direction: DIRECTION.SOUTH,
197
- multiplicity: 1
198
- }
199
- ]
200
- }
201
- }
@@ -1,64 +0,0 @@
1
- import { BOUNDS, Component, ComponentNature } from '@hatiolab/things-scene'
2
-
3
- import BPMNControlBase, { DIRECTION, INOUT, NODE, FLOW } from './base/bpmn-control-base'
4
-
5
- const NATURE: ComponentNature = {
6
- mutable: false,
7
- resizable: true,
8
- rotatable: false,
9
- properties: [],
10
- help: '/bpmn/comment/comment'
11
- }
12
-
13
- export default class BPMNComment extends BPMNControlBase {
14
- static get nature() {
15
- return NATURE
16
- }
17
-
18
- get nodes(): NODE[] {
19
- return [
20
- {
21
- name: 'Left',
22
- description: 'Left side message inout',
23
- inout: INOUT.INOUT,
24
- type: FLOW.MESSAGE,
25
- direction: DIRECTION.WEST,
26
- multiplicity: 1
27
- }
28
- ]
29
- }
30
-
31
- render(ctx: CanvasRenderingContext2D) {
32
- const { left, top, width, height } = this.bounds
33
- const bracket = height / 3
34
-
35
- ctx.translate(left, top)
36
- ctx.beginPath()
37
-
38
- ctx.moveTo(bracket, 0)
39
- ctx.lineTo(0, 0)
40
- ctx.lineTo(0, height)
41
- ctx.lineTo(bracket, height)
42
- this.drawStroke(ctx)
43
-
44
- ctx.beginPath()
45
- ctx.rect(0, 0, width, height)
46
-
47
- ctx.translate(-left, -top)
48
-
49
- this.drawFill(ctx)
50
- }
51
-
52
- get textBounds(): BOUNDS {
53
- var { left, top, width, height } = this.bounds
54
-
55
- return {
56
- left: left + 10,
57
- top: top + 10,
58
- width: width - 10,
59
- height: height - 10
60
- }
61
- }
62
- }
63
-
64
- Component.register('bpmn-comment', BPMNComment)
@@ -1,181 +0,0 @@
1
- import { Component, Properties, BOUNDS, ComponentNature } from '@hatiolab/things-scene'
2
-
3
- import BPMNControlBase from './base/bpmn-control-base'
4
-
5
- const NATURE: ComponentNature = {
6
- mutable: false,
7
- resizable: true,
8
- rotatable: false,
9
- properties: [
10
- {
11
- type: 'select',
12
- name: 'inout',
13
- label: 'inout',
14
- property: {
15
- options: [
16
- {
17
- display: '',
18
- value: ''
19
- },
20
- {
21
- display: 'input',
22
- value: 'input'
23
- },
24
- {
25
- display: 'output',
26
- value: 'output'
27
- }
28
- ]
29
- }
30
- },
31
- {
32
- type: 'checkbox',
33
- name: 'collection',
34
- label: 'collection'
35
- }
36
- ],
37
- help: '/bpmn/data-object/data-object'
38
- }
39
-
40
- export default class BPMNDataObject extends BPMNControlBase {
41
- private imageElement?: HTMLImageElement
42
- private collectionImageElement?: HTMLImageElement
43
-
44
- static get nature() {
45
- return NATURE
46
- }
47
-
48
- get textBounds(): BOUNDS {
49
- var { left, top, width, height } = this.bounds
50
- var { paddingTop, paddingLeft, paddingRight } = this.state
51
-
52
- paddingTop ||= 0
53
- paddingLeft ||= 0
54
- paddingRight ||= 0
55
-
56
- return {
57
- left: left + paddingLeft,
58
- top: top + paddingTop + height + 10,
59
- width: Math.max(width - paddingLeft - paddingRight, 0),
60
- height: 0
61
- }
62
- }
63
-
64
- render(ctx: CanvasRenderingContext2D) {
65
- const { left, top, width, height } = this.bounds
66
- const { collection = false } = this.state
67
-
68
- const corner = (Math.min(width, height) * 2) / 5
69
-
70
- ctx.translate(left, top)
71
- ctx.beginPath()
72
-
73
- ctx.moveTo(width - corner, 0)
74
- ctx.lineTo(width - corner, corner)
75
- ctx.lineTo(width, corner)
76
- ctx.lineTo(width - corner, 0)
77
- this.drawStroke(ctx)
78
-
79
- ctx.beginPath()
80
- ctx.moveTo(0, 0)
81
- ctx.lineTo(width - corner, 0)
82
- ctx.lineTo(width - corner, corner)
83
- ctx.lineTo(width, corner)
84
- ctx.lineTo(width, height)
85
- ctx.lineTo(0, height)
86
- ctx.lineTo(0, 0)
87
-
88
- ctx.translate(-left, -top)
89
-
90
- this.drawFill(ctx)
91
- this.drawStroke(ctx)
92
-
93
- ctx.beginPath()
94
-
95
- const image = this.getImageElement()
96
- if (image) {
97
- this.drawImage(ctx, image, left, top, corner, corner)
98
- }
99
-
100
- if (collection) {
101
- this.drawImage(ctx, this.getCollectionImageElement()!, left + (width - 16) / 2, top + height - 16, 16, 16)
102
- }
103
- }
104
-
105
- onchange(after: Properties, before: Properties) {
106
- if ('inout' in after || 'collection' in after || 'strokeStyle' in after) {
107
- delete this.imageElement
108
- delete this.collectionImageElement
109
- }
110
- }
111
-
112
- getImageElement(): HTMLImageElement | undefined {
113
- if (!this.imageElement) {
114
- const { inout, strokeStyle } = this.state
115
-
116
- if (!inout) {
117
- return
118
- }
119
-
120
- const src: string = IMAGES[inout]
121
- if (!src) {
122
- return
123
- }
124
-
125
- this.imageElement = new Image()
126
- this.imageElement.src =
127
- 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(src.replace(/{{strokeColor}}/g, strokeStyle))
128
- }
129
-
130
- return this.imageElement
131
- }
132
-
133
- getCollectionImageElement(): HTMLImageElement | undefined {
134
- if (!this.collectionImageElement) {
135
- const { strokeStyle } = this.state
136
-
137
- this.collectionImageElement = new Image()
138
- this.collectionImageElement.src =
139
- 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(COLLECTION.replace(/{{strokeColor}}/g, strokeStyle))
140
- }
141
-
142
- return this.collectionImageElement
143
- }
144
- }
145
-
146
- Component.register('bpmn-data-object', BPMNDataObject)
147
-
148
- const IMAGES: { [type: string]: string } = {
149
- input: `
150
- <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"
151
- viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
152
- <style type="text/css">
153
- .st0{fill:none;stroke:{{strokeColor}};stroke-miterlimit:10;}
154
- </style>
155
- <path class="st0" d="M19,13.8V8l9.5,9.5L19,27v-5.8H6.5v-7.5H19z"/>
156
- </svg>
157
- `,
158
- output: `
159
- <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"
160
- viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
161
- <style type="text/css">
162
- .st0{fill:{{strokeColor}};}
163
- </style>
164
- <path class="st0" d="M19,13.8V8l9.5,9.5L19,27v-5.8H6.5v-7.5H19z"/>
165
- </svg>
166
- `
167
- }
168
-
169
- const COLLECTION: string = `
170
- <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"
171
- viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
172
- <style type="text/css">
173
- .st0{fill:{{strokeColor}};}
174
- </style>
175
- <g>
176
- <rect x="5.5" y="1.9" class="st0" width="3.3" height="25.3"/>
177
- <rect x="15.9" y="1.9" class="st0" width="3.3" height="25.3"/>
178
- <rect x="26.2" y="1.9" class="st0" width="3.3" height="25.3"/>
179
- </g>
180
- </svg>
181
- `
@@ -1,63 +0,0 @@
1
- import { Component, BOUNDS, ComponentNature } from '@hatiolab/things-scene'
2
-
3
- import BPMNControlBase from './base/bpmn-control-base'
4
-
5
- const NATURE: ComponentNature = {
6
- mutable: false,
7
- resizable: true,
8
- rotatable: false,
9
- properties: [],
10
- help: '/bpmn/data-store/data-store'
11
- }
12
-
13
- export default class BPMNDataStore extends BPMNControlBase {
14
- static get nature() {
15
- return NATURE
16
- }
17
-
18
- get textBounds(): BOUNDS {
19
- var { left, top, width, height } = this.bounds
20
- var { paddingTop, paddingLeft, paddingRight } = this.state
21
-
22
- paddingTop ||= 0
23
- paddingLeft ||= 0
24
- paddingRight ||= 0
25
-
26
- return {
27
- left: left + paddingLeft,
28
- top: top + paddingTop + height + 10,
29
- width: Math.max(width - paddingLeft - paddingRight, 0),
30
- height: 0
31
- }
32
- }
33
-
34
- render(ctx: CanvasRenderingContext2D) {
35
- const { left, top, width, height } = this.bounds
36
- const ry = Math.abs(height / 6)
37
- const startAngle = Math.PI
38
- const endAngle = 0
39
-
40
- ctx.translate(left, top)
41
- ctx.beginPath()
42
-
43
- ctx.ellipse(width / 2, ry, width / 2, ry, 0, startAngle, startAngle - Math.PI * 2, true)
44
-
45
- ctx.moveTo(0, ry + ry / 2)
46
- ctx.ellipse(width / 2, ry + ry / 2, width / 2, ry, 0, startAngle, endAngle, true)
47
-
48
- ctx.moveTo(0, ry + ry)
49
- ctx.ellipse(width / 2, ry + ry, width / 2, ry, 0, startAngle, endAngle, true)
50
-
51
- ctx.moveTo(0, ry)
52
- ctx.lineTo(0, height - ry)
53
- ctx.ellipse(width / 2, height - ry, width / 2, ry, 0, startAngle, endAngle, true)
54
- ctx.lineTo(width, ry)
55
-
56
- ctx.translate(-left, -top)
57
-
58
- this.drawFill(ctx)
59
- this.drawStroke(ctx)
60
- }
61
- }
62
-
63
- Component.register('bpmn-data-store', BPMNDataStore)