1 | import { getDi, is } from './ModelUtil';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export var planeSuffix = '_plane';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export function getShapeIdFromPlane(element) {
|
18 | var id = element.id;
|
19 |
|
20 | return removePlaneSuffix(id);
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export function getPlaneIdFromShape(element) {
|
31 | var id = element.id;
|
32 |
|
33 | if (is(element, 'bpmn:SubProcess')) {
|
34 | return addPlaneSuffix(id);
|
35 | }
|
36 |
|
37 | return id;
|
38 | }
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | export function toPlaneId(id) {
|
48 | return addPlaneSuffix(id);
|
49 | }
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | export function isPlane(element) {
|
59 | var di = getDi(element);
|
60 |
|
61 | return is(di, 'bpmndi:BPMNPlane');
|
62 | }
|
63 |
|
64 | function addPlaneSuffix(id) {
|
65 | return id + planeSuffix;
|
66 | }
|
67 |
|
68 | function removePlaneSuffix(id) {
|
69 | return id.replace(new RegExp(planeSuffix + '$'), '');
|
70 | } |
\ | No newline at end of file |