camunda-bpmn-js 2.1.0 → 2.2.0
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.
- package/dist/base-modeler.development.js +5731 -2372
- package/dist/base-modeler.production.min.js +6 -6
- package/dist/base-navigated-viewer.development.js +1854 -741
- package/dist/base-navigated-viewer.production.min.js +1 -1
- package/dist/base-viewer.development.js +1745 -720
- package/dist/base-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-modeler.development.js +5811 -2421
- package/dist/camunda-cloud-modeler.production.min.js +23 -23
- package/dist/camunda-cloud-navigated-viewer.development.js +1876 -750
- package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-viewer.development.js +1764 -726
- package/dist/camunda-cloud-viewer.production.min.js +1 -1
- package/dist/camunda-platform-modeler.development.js +6595 -2615
- package/dist/camunda-platform-modeler.production.min.js +6 -6
- package/dist/camunda-platform-navigated-viewer.development.js +1867 -746
- package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-platform-viewer.development.js +1755 -722
- package/dist/camunda-platform-viewer.production.min.js +1 -1
- package/lib/base/Modeler.d.ts +15 -0
- package/lib/base/Modeler.js +16 -2
- package/lib/base/NavigatedViewer.d.ts +2 -0
- package/lib/base/Viewer.d.ts +2 -0
- package/lib/camunda-cloud/ElementTemplatesValidator.d.ts +1 -0
- package/lib/camunda-cloud/Modeler.d.ts +3 -0
- package/lib/camunda-cloud/Modeler.js +5 -2
- package/lib/camunda-cloud/NavigatedViewer.d.ts +3 -0
- package/lib/camunda-cloud/NavigatedViewer.js +4 -2
- package/lib/camunda-cloud/Viewer.d.ts +3 -0
- package/lib/camunda-cloud/Viewer.js +4 -2
- package/lib/camunda-cloud/features/rules/BpmnRules.d.ts +32 -0
- package/lib/camunda-cloud/features/rules/BpmnRules.js +110 -87
- package/lib/camunda-cloud/features/rules/index.d.ts +6 -0
- package/lib/camunda-cloud/util/commonModules.d.ts +9 -0
- package/lib/camunda-cloud/util/commonModules.js +5 -0
- package/lib/camunda-platform/Modeler.d.ts +3 -0
- package/lib/camunda-platform/Modeler.js +6 -2
- package/lib/camunda-platform/NavigatedViewer.d.ts +5 -0
- package/lib/camunda-platform/NavigatedViewer.js +4 -2
- package/lib/camunda-platform/Viewer.d.ts +5 -0
- package/lib/camunda-platform/Viewer.js +5 -2
- package/lib/camunda-platform/util/commonModules.d.ts +9 -0
- package/lib/camunda-platform/util/commonModules.js +5 -0
- package/lib/util/ExtensionElementsUtil.d.ts +24 -0
- package/lib/util/ExtensionElementsUtil.js +17 -8
- package/package.json +14 -7
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* Flatten array, one level deep.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
12
|
+
* @template T
|
|
13
13
|
*
|
|
14
|
-
* @
|
|
14
|
+
* @param {T[][]} arr
|
|
15
|
+
*
|
|
16
|
+
* @return {T[]}
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
19
|
const nativeToString$1 = Object.prototype.toString;
|
|
@@ -37,6 +39,11 @@
|
|
|
37
39
|
return nativeToString$1.call(obj) === '[object Number]';
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
/**
|
|
43
|
+
* @param {any} obj
|
|
44
|
+
*
|
|
45
|
+
* @return {boolean}
|
|
46
|
+
*/
|
|
40
47
|
function isFunction(obj) {
|
|
41
48
|
const tag = nativeToString$1.call(obj);
|
|
42
49
|
|
|
@@ -65,22 +72,74 @@
|
|
|
65
72
|
return nativeHasOwnProperty$1.call(target, key);
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @template T
|
|
77
|
+
* @typedef { (
|
|
78
|
+
* ((e: T) => boolean) |
|
|
79
|
+
* ((e: T, idx: number) => boolean) |
|
|
80
|
+
* ((e: T, key: string) => boolean) |
|
|
81
|
+
* string |
|
|
82
|
+
* number
|
|
83
|
+
* ) } Matcher
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @template T
|
|
88
|
+
* @template U
|
|
89
|
+
*
|
|
90
|
+
* @typedef { (
|
|
91
|
+
* ((e: T) => U) | string | number
|
|
92
|
+
* ) } Extractor
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @template T
|
|
98
|
+
* @typedef { (val: T, key: any) => boolean } MatchFn
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @template T
|
|
103
|
+
* @typedef { T[] } ArrayCollection
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @template T
|
|
108
|
+
* @typedef { { [key: string]: T } } StringKeyValueCollection
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @template T
|
|
113
|
+
* @typedef { { [key: number]: T } } NumberKeyValueCollection
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @template T
|
|
118
|
+
* @typedef { StringKeyValueCollection<T> | NumberKeyValueCollection<T> } KeyValueCollection
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @template T
|
|
123
|
+
* @typedef { KeyValueCollection<T> | ArrayCollection<T> } Collection
|
|
124
|
+
*/
|
|
125
|
+
|
|
68
126
|
/**
|
|
69
127
|
* Find element in collection.
|
|
70
128
|
*
|
|
71
|
-
* @
|
|
72
|
-
* @param
|
|
129
|
+
* @template T
|
|
130
|
+
* @param {Collection<T>} collection
|
|
131
|
+
* @param {Matcher<T>} matcher
|
|
73
132
|
*
|
|
74
133
|
* @return {Object}
|
|
75
134
|
*/
|
|
76
135
|
function find(collection, matcher) {
|
|
77
136
|
|
|
78
|
-
|
|
137
|
+
const matchFn = toMatcher(matcher);
|
|
79
138
|
|
|
80
139
|
let match;
|
|
81
140
|
|
|
82
141
|
forEach$1(collection, function(val, key) {
|
|
83
|
-
if (
|
|
142
|
+
if (matchFn(val, key)) {
|
|
84
143
|
match = val;
|
|
85
144
|
|
|
86
145
|
return false;
|
|
@@ -95,19 +154,20 @@
|
|
|
95
154
|
/**
|
|
96
155
|
* Find element index in collection.
|
|
97
156
|
*
|
|
98
|
-
* @
|
|
99
|
-
* @param
|
|
157
|
+
* @template T
|
|
158
|
+
* @param {Collection<T>} collection
|
|
159
|
+
* @param {Matcher<T>} matcher
|
|
100
160
|
*
|
|
101
|
-
* @return {
|
|
161
|
+
* @return {number}
|
|
102
162
|
*/
|
|
103
163
|
function findIndex(collection, matcher) {
|
|
104
164
|
|
|
105
|
-
|
|
165
|
+
const matchFn = toMatcher(matcher);
|
|
106
166
|
|
|
107
167
|
let idx = isArray$2(collection) ? -1 : undefined;
|
|
108
168
|
|
|
109
169
|
forEach$1(collection, function(val, key) {
|
|
110
|
-
if (
|
|
170
|
+
if (matchFn(val, key)) {
|
|
111
171
|
idx = key;
|
|
112
172
|
|
|
113
173
|
return false;
|
|
@@ -119,19 +179,22 @@
|
|
|
119
179
|
|
|
120
180
|
|
|
121
181
|
/**
|
|
122
|
-
*
|
|
182
|
+
* Filter elements in collection.
|
|
123
183
|
*
|
|
124
|
-
* @
|
|
125
|
-
* @param
|
|
184
|
+
* @template T
|
|
185
|
+
* @param {Collection<T>} collection
|
|
186
|
+
* @param {Matcher<T>} matcher
|
|
126
187
|
*
|
|
127
|
-
* @return {
|
|
188
|
+
* @return {T[]} result
|
|
128
189
|
*/
|
|
129
190
|
function filter(collection, matcher) {
|
|
130
191
|
|
|
192
|
+
const matchFn = toMatcher(matcher);
|
|
193
|
+
|
|
131
194
|
let result = [];
|
|
132
195
|
|
|
133
196
|
forEach$1(collection, function(val, key) {
|
|
134
|
-
if (
|
|
197
|
+
if (matchFn(val, key)) {
|
|
135
198
|
result.push(val);
|
|
136
199
|
}
|
|
137
200
|
});
|
|
@@ -144,10 +207,11 @@
|
|
|
144
207
|
* Iterate over collection; returning something
|
|
145
208
|
* (non-undefined) will stop iteration.
|
|
146
209
|
*
|
|
147
|
-
* @
|
|
148
|
-
* @param
|
|
210
|
+
* @template T
|
|
211
|
+
* @param {Collection<T>} collection
|
|
212
|
+
* @param { ((item: T, idx: number) => (boolean|void)) | ((item: T, key: string) => (boolean|void)) } iterator
|
|
149
213
|
*
|
|
150
|
-
* @return {
|
|
214
|
+
* @return {T} return result that stopped the iteration
|
|
151
215
|
*/
|
|
152
216
|
function forEach$1(collection, iterator) {
|
|
153
217
|
|
|
@@ -178,11 +242,14 @@
|
|
|
178
242
|
/**
|
|
179
243
|
* Reduce collection, returning a single result.
|
|
180
244
|
*
|
|
181
|
-
* @
|
|
182
|
-
* @
|
|
183
|
-
*
|
|
245
|
+
* @template T
|
|
246
|
+
* @template V
|
|
247
|
+
*
|
|
248
|
+
* @param {Collection<T>} collection
|
|
249
|
+
* @param {(result: V, entry: T, index: any) => V} iterator
|
|
250
|
+
* @param {V} result
|
|
184
251
|
*
|
|
185
|
-
* @return {
|
|
252
|
+
* @return {V} result returned from last iterator
|
|
186
253
|
*/
|
|
187
254
|
function reduce(collection, iterator, result) {
|
|
188
255
|
|
|
@@ -252,13 +319,17 @@
|
|
|
252
319
|
*
|
|
253
320
|
* @example
|
|
254
321
|
*
|
|
322
|
+
* ```javascript
|
|
255
323
|
* const matcher = matchPattern({ id: 1 });
|
|
256
324
|
*
|
|
257
325
|
* let element = find(elements, matcher);
|
|
326
|
+
* ```
|
|
327
|
+
*
|
|
328
|
+
* @template T
|
|
258
329
|
*
|
|
259
|
-
* @param
|
|
330
|
+
* @param {T} pattern
|
|
260
331
|
*
|
|
261
|
-
* @return {
|
|
332
|
+
* @return { (el: any) => boolean } matcherFn
|
|
262
333
|
*/
|
|
263
334
|
function matchPattern(pattern) {
|
|
264
335
|
|
|
@@ -272,6 +343,12 @@
|
|
|
272
343
|
}
|
|
273
344
|
|
|
274
345
|
|
|
346
|
+
/**
|
|
347
|
+
* @template T
|
|
348
|
+
* @param {Matcher<T>} matcher
|
|
349
|
+
*
|
|
350
|
+
* @return {MatchFn<T>}
|
|
351
|
+
*/
|
|
275
352
|
function toMatcher(matcher) {
|
|
276
353
|
return isFunction(matcher) ? matcher : (e) => {
|
|
277
354
|
return e === matcher;
|
|
@@ -287,6 +364,16 @@
|
|
|
287
364
|
return Number(arg);
|
|
288
365
|
}
|
|
289
366
|
|
|
367
|
+
/* global setTimeout clearTimeout */
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* @typedef { {
|
|
371
|
+
* (...args: any[]): any;
|
|
372
|
+
* flush: () => void;
|
|
373
|
+
* cancel: () => void;
|
|
374
|
+
* } } DebouncedFunction
|
|
375
|
+
*/
|
|
376
|
+
|
|
290
377
|
/**
|
|
291
378
|
* Debounce fn, calling it only once if the given time
|
|
292
379
|
* elapsed between calls.
|
|
@@ -297,7 +384,7 @@
|
|
|
297
384
|
* @param {Function} fn
|
|
298
385
|
* @param {Number} timeout
|
|
299
386
|
*
|
|
300
|
-
* @return {
|
|
387
|
+
* @return {DebouncedFunction} debounced function
|
|
301
388
|
*/
|
|
302
389
|
function debounce(fn, timeout) {
|
|
303
390
|
|
|
@@ -343,6 +430,9 @@
|
|
|
343
430
|
clear();
|
|
344
431
|
}
|
|
345
432
|
|
|
433
|
+
/**
|
|
434
|
+
* @type { DebouncedFunction }
|
|
435
|
+
*/
|
|
346
436
|
function callback(...args) {
|
|
347
437
|
lastNow = Date.now();
|
|
348
438
|
|
|
@@ -386,12 +476,15 @@
|
|
|
386
476
|
}
|
|
387
477
|
|
|
388
478
|
/**
|
|
389
|
-
* Pick
|
|
479
|
+
* Pick properties from the given target.
|
|
390
480
|
*
|
|
391
|
-
* @
|
|
392
|
-
* @
|
|
481
|
+
* @template T
|
|
482
|
+
* @template {any[]} V
|
|
483
|
+
*
|
|
484
|
+
* @param {T} target
|
|
485
|
+
* @param {V} properties
|
|
393
486
|
*
|
|
394
|
-
* @return
|
|
487
|
+
* @return Pick<T, V>
|
|
395
488
|
*/
|
|
396
489
|
function pick(target, properties) {
|
|
397
490
|
|
|
@@ -412,10 +505,13 @@
|
|
|
412
505
|
/**
|
|
413
506
|
* Pick all target properties, excluding the given ones.
|
|
414
507
|
*
|
|
415
|
-
* @
|
|
416
|
-
* @
|
|
508
|
+
* @template T
|
|
509
|
+
* @template {any[]} V
|
|
417
510
|
*
|
|
418
|
-
* @
|
|
511
|
+
* @param {T} target
|
|
512
|
+
* @param {V} properties
|
|
513
|
+
*
|
|
514
|
+
* @return {Omit<T, V>} target
|
|
419
515
|
*/
|
|
420
516
|
function omit(target, properties) {
|
|
421
517
|
|
|
@@ -436,9 +532,9 @@
|
|
|
436
532
|
var DEFAULT_RENDER_PRIORITY$1 = 1000;
|
|
437
533
|
|
|
438
534
|
/**
|
|
439
|
-
* @typedef {import('../
|
|
440
|
-
* @typedef {import('../
|
|
441
|
-
* @typedef {import('../
|
|
535
|
+
* @typedef {import('../core/Types').ElementLike} Element
|
|
536
|
+
* @typedef {import('../core/Types').ConnectionLike} Connection
|
|
537
|
+
* @typedef {import('../core/Types').ShapeLike} Shape
|
|
442
538
|
*
|
|
443
539
|
* @typedef {import('../core/EventBus').default} EventBus
|
|
444
540
|
*/
|
|
@@ -483,9 +579,9 @@
|
|
|
483
579
|
/**
|
|
484
580
|
* Checks whether an element can be rendered.
|
|
485
581
|
*
|
|
486
|
-
* @param {
|
|
582
|
+
* @param {Element} element The element to be rendered.
|
|
487
583
|
*
|
|
488
|
-
* @
|
|
584
|
+
* @return {boolean} Whether the element can be rendered.
|
|
489
585
|
*/
|
|
490
586
|
BaseRenderer.prototype.canRender = function(element) {};
|
|
491
587
|
|
|
@@ -495,7 +591,7 @@
|
|
|
495
591
|
* @param {SVGElement} visuals The SVG element to draw the shape into.
|
|
496
592
|
* @param {Shape} shape The shape to be drawn.
|
|
497
593
|
*
|
|
498
|
-
* @
|
|
594
|
+
* @return {SVGElement} The SVG element of the shape drawn.
|
|
499
595
|
*/
|
|
500
596
|
BaseRenderer.prototype.drawShape = function(visuals, shape) {};
|
|
501
597
|
|
|
@@ -505,7 +601,7 @@
|
|
|
505
601
|
* @param {SVGElement} visuals The SVG element to draw the connection into.
|
|
506
602
|
* @param {Connection} connection The connection to be drawn.
|
|
507
603
|
*
|
|
508
|
-
* @
|
|
604
|
+
* @return {SVGElement} The SVG element of the connection drawn.
|
|
509
605
|
*/
|
|
510
606
|
BaseRenderer.prototype.drawConnection = function(visuals, connection) {};
|
|
511
607
|
|
|
@@ -527,10 +623,15 @@
|
|
|
527
623
|
*/
|
|
528
624
|
BaseRenderer.prototype.getConnectionPath = function(connection) {};
|
|
529
625
|
|
|
626
|
+
/**
|
|
627
|
+
* @typedef { import('../model/Types').Element } Element
|
|
628
|
+
* @typedef { import('../model/Types').ModdleElement } ModdleElement
|
|
629
|
+
*/
|
|
630
|
+
|
|
530
631
|
/**
|
|
531
632
|
* Is an element of the given BPMN type?
|
|
532
633
|
*
|
|
533
|
-
* @param {
|
|
634
|
+
* @param {Element|ModdleElement} element
|
|
534
635
|
* @param {string} type
|
|
535
636
|
*
|
|
536
637
|
* @return {boolean}
|
|
@@ -545,8 +646,8 @@
|
|
|
545
646
|
/**
|
|
546
647
|
* Return true if element has any of the given types.
|
|
547
648
|
*
|
|
548
|
-
* @param {
|
|
549
|
-
* @param {
|
|
649
|
+
* @param {Element|ModdleElement} element
|
|
650
|
+
* @param {string[]} types
|
|
550
651
|
*
|
|
551
652
|
* @return {boolean}
|
|
552
653
|
*/
|
|
@@ -559,7 +660,7 @@
|
|
|
559
660
|
/**
|
|
560
661
|
* Return the business object for a given element.
|
|
561
662
|
*
|
|
562
|
-
* @param
|
|
663
|
+
* @param {Element|ModdleElement} element
|
|
563
664
|
*
|
|
564
665
|
* @return {ModdleElement}
|
|
565
666
|
*/
|
|
@@ -570,7 +671,7 @@
|
|
|
570
671
|
/**
|
|
571
672
|
* Return the di object for a given element.
|
|
572
673
|
*
|
|
573
|
-
* @param
|
|
674
|
+
* @param {Element} element
|
|
574
675
|
*
|
|
575
676
|
* @return {ModdleElement}
|
|
576
677
|
*/
|
|
@@ -578,6 +679,17 @@
|
|
|
578
679
|
return element && element.di;
|
|
579
680
|
}
|
|
580
681
|
|
|
682
|
+
/**
|
|
683
|
+
* @typedef {import('../model/Types').Element} Element
|
|
684
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
685
|
+
*/
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* @param {Element} element
|
|
689
|
+
* @param {ModdleElement} [di]
|
|
690
|
+
*
|
|
691
|
+
* @return {boolean}
|
|
692
|
+
*/
|
|
581
693
|
function isExpanded(element, di) {
|
|
582
694
|
|
|
583
695
|
if (is$1(element, 'bpmn:CallActivity')) {
|
|
@@ -601,10 +713,175 @@
|
|
|
601
713
|
return true;
|
|
602
714
|
}
|
|
603
715
|
|
|
716
|
+
/**
|
|
717
|
+
* @param {Element} element
|
|
718
|
+
*
|
|
719
|
+
* @return {boolean}
|
|
720
|
+
*/
|
|
604
721
|
function isEventSubProcess(element) {
|
|
605
722
|
return element && !!getBusinessObject(element).triggeredByEvent;
|
|
606
723
|
}
|
|
607
724
|
|
|
725
|
+
/**
|
|
726
|
+
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
727
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
728
|
+
*
|
|
729
|
+
* @typedef {import('../model/Types').Element} Element
|
|
730
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
731
|
+
*/
|
|
732
|
+
|
|
733
|
+
var DEFAULT_LABEL_SIZE$1 = {
|
|
734
|
+
width: 90,
|
|
735
|
+
height: 20
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
var FLOW_LABEL_INDENT = 15;
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Return true if the given semantic has an external label.
|
|
743
|
+
*
|
|
744
|
+
* @param {Element} semantic
|
|
745
|
+
*
|
|
746
|
+
* @return {boolean}
|
|
747
|
+
*/
|
|
748
|
+
function isLabelExternal(semantic) {
|
|
749
|
+
return is$1(semantic, 'bpmn:Event') ||
|
|
750
|
+
is$1(semantic, 'bpmn:Gateway') ||
|
|
751
|
+
is$1(semantic, 'bpmn:DataStoreReference') ||
|
|
752
|
+
is$1(semantic, 'bpmn:DataObjectReference') ||
|
|
753
|
+
is$1(semantic, 'bpmn:DataInput') ||
|
|
754
|
+
is$1(semantic, 'bpmn:DataOutput') ||
|
|
755
|
+
is$1(semantic, 'bpmn:SequenceFlow') ||
|
|
756
|
+
is$1(semantic, 'bpmn:MessageFlow') ||
|
|
757
|
+
is$1(semantic, 'bpmn:Group');
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Get the position of a sequence flow label.
|
|
762
|
+
*
|
|
763
|
+
* @param {Point[]} waypoints
|
|
764
|
+
*
|
|
765
|
+
* @return {Point}
|
|
766
|
+
*/
|
|
767
|
+
function getFlowLabelPosition(waypoints) {
|
|
768
|
+
|
|
769
|
+
// get the waypoints mid
|
|
770
|
+
var mid = waypoints.length / 2 - 1;
|
|
771
|
+
|
|
772
|
+
var first = waypoints[Math.floor(mid)];
|
|
773
|
+
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
774
|
+
|
|
775
|
+
// get position
|
|
776
|
+
var position = getWaypointsMid(waypoints);
|
|
777
|
+
|
|
778
|
+
// calculate angle
|
|
779
|
+
var angle = Math.atan((second.y - first.y) / (second.x - first.x));
|
|
780
|
+
|
|
781
|
+
var x = position.x,
|
|
782
|
+
y = position.y;
|
|
783
|
+
|
|
784
|
+
if (Math.abs(angle) < Math.PI / 2) {
|
|
785
|
+
y -= FLOW_LABEL_INDENT;
|
|
786
|
+
} else {
|
|
787
|
+
x += FLOW_LABEL_INDENT;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
return { x: x, y: y };
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Get the middle of a number of waypoints.
|
|
796
|
+
*
|
|
797
|
+
* @param {Point[]} waypoints
|
|
798
|
+
*
|
|
799
|
+
* @return {Point}
|
|
800
|
+
*/
|
|
801
|
+
function getWaypointsMid(waypoints) {
|
|
802
|
+
|
|
803
|
+
var mid = waypoints.length / 2 - 1;
|
|
804
|
+
|
|
805
|
+
var first = waypoints[Math.floor(mid)];
|
|
806
|
+
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
807
|
+
|
|
808
|
+
return {
|
|
809
|
+
x: first.x + (second.x - first.x) / 2,
|
|
810
|
+
y: first.y + (second.y - first.y) / 2
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Get the middle of the external label of an element.
|
|
816
|
+
*
|
|
817
|
+
* @param {Element} element
|
|
818
|
+
*
|
|
819
|
+
* @return {Point}
|
|
820
|
+
*/
|
|
821
|
+
function getExternalLabelMid(element) {
|
|
822
|
+
|
|
823
|
+
if (element.waypoints) {
|
|
824
|
+
return getFlowLabelPosition(element.waypoints);
|
|
825
|
+
} else if (is$1(element, 'bpmn:Group')) {
|
|
826
|
+
return {
|
|
827
|
+
x: element.x + element.width / 2,
|
|
828
|
+
y: element.y + DEFAULT_LABEL_SIZE$1.height / 2
|
|
829
|
+
};
|
|
830
|
+
} else {
|
|
831
|
+
return {
|
|
832
|
+
x: element.x + element.width / 2,
|
|
833
|
+
y: element.y + element.height + DEFAULT_LABEL_SIZE$1.height / 2
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Return the bounds of an elements label, parsed from the elements DI or
|
|
841
|
+
* generated from its bounds.
|
|
842
|
+
*
|
|
843
|
+
* @param {ModdleElement} di
|
|
844
|
+
* @param {Element} element
|
|
845
|
+
*
|
|
846
|
+
* @return {Rect}
|
|
847
|
+
*/
|
|
848
|
+
function getExternalLabelBounds(di, element) {
|
|
849
|
+
|
|
850
|
+
var mid,
|
|
851
|
+
size,
|
|
852
|
+
bounds,
|
|
853
|
+
label = di.label;
|
|
854
|
+
|
|
855
|
+
if (label && label.bounds) {
|
|
856
|
+
bounds = label.bounds;
|
|
857
|
+
|
|
858
|
+
size = {
|
|
859
|
+
width: Math.max(DEFAULT_LABEL_SIZE$1.width, bounds.width),
|
|
860
|
+
height: bounds.height
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
mid = {
|
|
864
|
+
x: bounds.x + bounds.width / 2,
|
|
865
|
+
y: bounds.y + bounds.height / 2
|
|
866
|
+
};
|
|
867
|
+
} else {
|
|
868
|
+
|
|
869
|
+
mid = getExternalLabelMid(element);
|
|
870
|
+
|
|
871
|
+
size = DEFAULT_LABEL_SIZE$1;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
return assign$1({
|
|
875
|
+
x: mid.x - size.width / 2,
|
|
876
|
+
y: mid.y - size.height / 2
|
|
877
|
+
}, size);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* @typedef { import('../model').DiagramElement } DiagramElement
|
|
883
|
+
*/
|
|
884
|
+
|
|
608
885
|
function getLabelAttr(semantic) {
|
|
609
886
|
if (
|
|
610
887
|
is$1(semantic, 'bpmn:FlowElement') ||
|
|
@@ -638,6 +915,11 @@
|
|
|
638
915
|
return categoryValueRef.value || '';
|
|
639
916
|
}
|
|
640
917
|
|
|
918
|
+
/**
|
|
919
|
+
* @param {DiagramElement} element
|
|
920
|
+
*
|
|
921
|
+
* @return {string} label
|
|
922
|
+
*/
|
|
641
923
|
function getLabel(element) {
|
|
642
924
|
var semantic = element.businessObject,
|
|
643
925
|
attr = getLabelAttr(semantic);
|
|
@@ -1338,7 +1620,7 @@
|
|
|
1338
1620
|
*/
|
|
1339
1621
|
|
|
1340
1622
|
/**
|
|
1341
|
-
* @param {Component[]} elements
|
|
1623
|
+
* @param {Component[] | Component[][]} elements
|
|
1342
1624
|
*
|
|
1343
1625
|
* @return {string}
|
|
1344
1626
|
*/
|
|
@@ -1346,18 +1628,40 @@
|
|
|
1346
1628
|
return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
|
|
1347
1629
|
}
|
|
1348
1630
|
|
|
1631
|
+
/**
|
|
1632
|
+
* @param {Point} point
|
|
1633
|
+
*
|
|
1634
|
+
* @return {Component[]}
|
|
1635
|
+
*/
|
|
1349
1636
|
function move(point) {
|
|
1350
1637
|
return [ 'M', point.x, point.y ];
|
|
1351
1638
|
}
|
|
1352
1639
|
|
|
1640
|
+
/**
|
|
1641
|
+
* @param {Point} point
|
|
1642
|
+
*
|
|
1643
|
+
* @return {Component[]}
|
|
1644
|
+
*/
|
|
1353
1645
|
function lineTo(point) {
|
|
1354
1646
|
return [ 'L', point.x, point.y ];
|
|
1355
1647
|
}
|
|
1356
1648
|
|
|
1649
|
+
/**
|
|
1650
|
+
* @param {Point} p1
|
|
1651
|
+
* @param {Point} p2
|
|
1652
|
+
* @param {Point} p3
|
|
1653
|
+
*
|
|
1654
|
+
* @return {Component[]}
|
|
1655
|
+
*/
|
|
1357
1656
|
function curveTo(p1, p2, p3) {
|
|
1358
1657
|
return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
|
|
1359
1658
|
}
|
|
1360
1659
|
|
|
1660
|
+
/**
|
|
1661
|
+
* @param {Point[]} waypoints
|
|
1662
|
+
* @param {number} [cornerRadius]
|
|
1663
|
+
* @return {Component[][]}
|
|
1664
|
+
*/
|
|
1361
1665
|
function drawPath(waypoints, cornerRadius) {
|
|
1362
1666
|
const pointCount = waypoints.length;
|
|
1363
1667
|
|
|
@@ -1421,7 +1725,7 @@
|
|
|
1421
1725
|
|
|
1422
1726
|
/**
|
|
1423
1727
|
* @param {Point[]} points
|
|
1424
|
-
* @param {
|
|
1728
|
+
* @param {number|Object} [attrs]
|
|
1425
1729
|
* @param {number} [radius]
|
|
1426
1730
|
*
|
|
1427
1731
|
* @return {SVGElement}
|
|
@@ -1470,54 +1774,75 @@
|
|
|
1470
1774
|
/**
|
|
1471
1775
|
* Checks if eventDefinition of the given element matches with semantic type.
|
|
1472
1776
|
*
|
|
1473
|
-
* @
|
|
1777
|
+
* @param {ModdleElement} event
|
|
1778
|
+
* @param {string} eventDefinitionType
|
|
1779
|
+
*
|
|
1780
|
+
* @return {boolean}
|
|
1474
1781
|
*/
|
|
1475
|
-
function isTypedEvent(event, eventDefinitionType
|
|
1476
|
-
|
|
1477
|
-
function matches(definition, filter) {
|
|
1478
|
-
return every(filter, function(val, key) {
|
|
1479
|
-
|
|
1480
|
-
// we want a == conversion here, to be able to catch
|
|
1481
|
-
// undefined == false and friends
|
|
1482
|
-
/* jshint -W116 */
|
|
1483
|
-
return definition[key] == val;
|
|
1484
|
-
});
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1782
|
+
function isTypedEvent(event, eventDefinitionType) {
|
|
1487
1783
|
return some(event.eventDefinitions, function(definition) {
|
|
1488
|
-
return definition.$type === eventDefinitionType
|
|
1784
|
+
return definition.$type === eventDefinitionType;
|
|
1489
1785
|
});
|
|
1490
1786
|
}
|
|
1491
1787
|
|
|
1788
|
+
/**
|
|
1789
|
+
* Check if element is a throw event.
|
|
1790
|
+
*
|
|
1791
|
+
* @param {ModdleElement} event
|
|
1792
|
+
*
|
|
1793
|
+
* @return {boolean}
|
|
1794
|
+
*/
|
|
1492
1795
|
function isThrowEvent(event) {
|
|
1493
1796
|
return (event.$type === 'bpmn:IntermediateThrowEvent') || (event.$type === 'bpmn:EndEvent');
|
|
1494
1797
|
}
|
|
1495
1798
|
|
|
1799
|
+
/**
|
|
1800
|
+
* Check if element is a throw event.
|
|
1801
|
+
*
|
|
1802
|
+
* @param {ModdleElement} element
|
|
1803
|
+
*
|
|
1804
|
+
* @return {boolean}
|
|
1805
|
+
*/
|
|
1496
1806
|
function isCollection(element) {
|
|
1497
1807
|
var dataObject = element.dataObjectRef;
|
|
1498
1808
|
|
|
1499
1809
|
return element.isCollection || (dataObject && dataObject.isCollection);
|
|
1500
1810
|
}
|
|
1501
1811
|
|
|
1502
|
-
function getSemantic(element) {
|
|
1503
|
-
return element.businessObject;
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
1812
|
|
|
1507
1813
|
// color access //////////////////////
|
|
1508
1814
|
|
|
1815
|
+
/**
|
|
1816
|
+
* @param {Element} element
|
|
1817
|
+
* @param {string} [defaultColor]
|
|
1818
|
+
*
|
|
1819
|
+
* @return {string}
|
|
1820
|
+
*/
|
|
1509
1821
|
function getFillColor(element, defaultColor) {
|
|
1510
1822
|
var di = getDi(element);
|
|
1511
1823
|
|
|
1512
1824
|
return di.get('color:background-color') || di.get('bioc:fill') || defaultColor || 'white';
|
|
1513
1825
|
}
|
|
1514
1826
|
|
|
1827
|
+
/**
|
|
1828
|
+
* @param {Element} element
|
|
1829
|
+
* @param {string} [defaultColor]
|
|
1830
|
+
*
|
|
1831
|
+
* @return {string}
|
|
1832
|
+
*/
|
|
1515
1833
|
function getStrokeColor(element, defaultColor) {
|
|
1516
1834
|
var di = getDi(element);
|
|
1517
1835
|
|
|
1518
1836
|
return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
|
|
1519
1837
|
}
|
|
1520
1838
|
|
|
1839
|
+
/**
|
|
1840
|
+
* @param {Element} element
|
|
1841
|
+
* @param {string} [defaultColor]
|
|
1842
|
+
* @param {string} [defaultStrokeColor]
|
|
1843
|
+
*
|
|
1844
|
+
* @return {string}
|
|
1845
|
+
*/
|
|
1521
1846
|
function getLabelColor(element, defaultColor, defaultStrokeColor) {
|
|
1522
1847
|
var di = getDi(element),
|
|
1523
1848
|
label = di.get('label');
|
|
@@ -1528,6 +1853,11 @@
|
|
|
1528
1853
|
|
|
1529
1854
|
// cropping path customizations //////////////////////
|
|
1530
1855
|
|
|
1856
|
+
/**
|
|
1857
|
+
* @param {ShapeLike} shape
|
|
1858
|
+
*
|
|
1859
|
+
* @return {string} path
|
|
1860
|
+
*/
|
|
1531
1861
|
function getCirclePath(shape) {
|
|
1532
1862
|
|
|
1533
1863
|
var cx = shape.x + shape.width / 2,
|
|
@@ -1545,6 +1875,12 @@
|
|
|
1545
1875
|
return componentsToPath(circlePath);
|
|
1546
1876
|
}
|
|
1547
1877
|
|
|
1878
|
+
/**
|
|
1879
|
+
* @param {ShapeLike} shape
|
|
1880
|
+
* @param {number} [borderRadius]
|
|
1881
|
+
*
|
|
1882
|
+
* @return {string} path
|
|
1883
|
+
*/
|
|
1548
1884
|
function getRoundRectPath(shape, borderRadius) {
|
|
1549
1885
|
|
|
1550
1886
|
var x = shape.x,
|
|
@@ -1568,6 +1904,11 @@
|
|
|
1568
1904
|
return componentsToPath(roundRectPath);
|
|
1569
1905
|
}
|
|
1570
1906
|
|
|
1907
|
+
/**
|
|
1908
|
+
* @param {ShapeLike} shape
|
|
1909
|
+
*
|
|
1910
|
+
* @return {string} path
|
|
1911
|
+
*/
|
|
1571
1912
|
function getDiamondPath(shape) {
|
|
1572
1913
|
|
|
1573
1914
|
var width = shape.width,
|
|
@@ -1588,6 +1929,11 @@
|
|
|
1588
1929
|
return componentsToPath(diamondPath);
|
|
1589
1930
|
}
|
|
1590
1931
|
|
|
1932
|
+
/**
|
|
1933
|
+
* @param {ShapeLike} shape
|
|
1934
|
+
*
|
|
1935
|
+
* @return {string} path
|
|
1936
|
+
*/
|
|
1591
1937
|
function getRectPath(shape) {
|
|
1592
1938
|
var x = shape.x,
|
|
1593
1939
|
y = shape.y,
|
|
@@ -2169,11 +2515,11 @@
|
|
|
2169
2515
|
}
|
|
2170
2516
|
|
|
2171
2517
|
/**
|
|
2172
|
-
* @param {SVGElement}
|
|
2518
|
+
* @param {SVGElement} gfx
|
|
2173
2519
|
* @param {number} x
|
|
2174
2520
|
* @param {number} y
|
|
2175
|
-
* @param {number} angle
|
|
2176
|
-
* @param {number} amount
|
|
2521
|
+
* @param {number} [angle]
|
|
2522
|
+
* @param {number} [amount]
|
|
2177
2523
|
*/
|
|
2178
2524
|
function transform(gfx, x, y, angle, amount) {
|
|
2179
2525
|
var translate = createTransform();
|
|
@@ -2190,7 +2536,7 @@
|
|
|
2190
2536
|
|
|
2191
2537
|
|
|
2192
2538
|
/**
|
|
2193
|
-
* @param {SVGElement}
|
|
2539
|
+
* @param {SVGElement} gfx
|
|
2194
2540
|
* @param {number} x
|
|
2195
2541
|
* @param {number} y
|
|
2196
2542
|
*/
|
|
@@ -2203,7 +2549,7 @@
|
|
|
2203
2549
|
|
|
2204
2550
|
|
|
2205
2551
|
/**
|
|
2206
|
-
* @param {SVGElement}
|
|
2552
|
+
* @param {SVGElement} gfx
|
|
2207
2553
|
* @param {number} angle
|
|
2208
2554
|
*/
|
|
2209
2555
|
function rotate(gfx, angle) {
|
|
@@ -2386,6 +2732,29 @@
|
|
|
2386
2732
|
|
|
2387
2733
|
var ELEMENT_LABEL_DISTANCE = 10;
|
|
2388
2734
|
|
|
2735
|
+
/**
|
|
2736
|
+
* @typedef { Partial<{
|
|
2737
|
+
* defaultFillColor: string,
|
|
2738
|
+
* defaultStrokeColor: string,
|
|
2739
|
+
* defaultLabelColor: string
|
|
2740
|
+
* }> } BpmnRendererConfig
|
|
2741
|
+
*/
|
|
2742
|
+
|
|
2743
|
+
/**
|
|
2744
|
+
* @typedef { import('../model').DiagramElement } DiagramElement
|
|
2745
|
+
*/
|
|
2746
|
+
|
|
2747
|
+
/**
|
|
2748
|
+
* A renderer for BPMN elements
|
|
2749
|
+
*
|
|
2750
|
+
* @param {BpmnRendererConfig} config
|
|
2751
|
+
* @param {import('diagram-js/lib/core/EventBus').default} eventBus
|
|
2752
|
+
* @param {import('diagram-js/lib/draw/Styles').default} styles
|
|
2753
|
+
* @param {import('./PathMap').default} pathMap
|
|
2754
|
+
* @param {import('diagram-js/lib/core/Canvas').default} canvas
|
|
2755
|
+
* @param {import('./TextRenderer').default} textRenderer
|
|
2756
|
+
* @param {number} [priority]
|
|
2757
|
+
*/
|
|
2389
2758
|
function BpmnRenderer(
|
|
2390
2759
|
config, eventBus, styles, pathMap,
|
|
2391
2760
|
canvas, textRenderer, priority) {
|
|
@@ -2745,7 +3114,7 @@
|
|
|
2745
3114
|
|
|
2746
3115
|
function renderEventContent(element, parentGfx) {
|
|
2747
3116
|
|
|
2748
|
-
var event =
|
|
3117
|
+
var event = getBusinessObject(element);
|
|
2749
3118
|
var isThrowing = isThrowEvent(event);
|
|
2750
3119
|
|
|
2751
3120
|
if (event.eventDefinitions && event.eventDefinitions.length > 1) {
|
|
@@ -2818,7 +3187,7 @@
|
|
|
2818
3187
|
}
|
|
2819
3188
|
|
|
2820
3189
|
function renderEmbeddedLabel(parentGfx, element, align) {
|
|
2821
|
-
var semantic =
|
|
3190
|
+
var semantic = getBusinessObject(element);
|
|
2822
3191
|
|
|
2823
3192
|
return renderLabel(parentGfx, semantic.name, {
|
|
2824
3193
|
box: element,
|
|
@@ -2884,7 +3253,7 @@
|
|
|
2884
3253
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2885
3254
|
};
|
|
2886
3255
|
|
|
2887
|
-
var semantic =
|
|
3256
|
+
var semantic = getBusinessObject(element);
|
|
2888
3257
|
|
|
2889
3258
|
if (!semantic.isInterrupting) {
|
|
2890
3259
|
attrs = {
|
|
@@ -3345,7 +3714,7 @@
|
|
|
3345
3714
|
return task;
|
|
3346
3715
|
},
|
|
3347
3716
|
'bpmn:ReceiveTask' : function(parentGfx, element) {
|
|
3348
|
-
var semantic =
|
|
3717
|
+
var semantic = getBusinessObject(element);
|
|
3349
3718
|
|
|
3350
3719
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3351
3720
|
var pathData;
|
|
@@ -3501,12 +3870,12 @@
|
|
|
3501
3870
|
stroke: getStrokeColor(element, defaultStrokeColor),
|
|
3502
3871
|
strokeWidth
|
|
3503
3872
|
});
|
|
3504
|
-
var text =
|
|
3873
|
+
var text = getBusinessObject(element).name;
|
|
3505
3874
|
renderLaneLabel(parentGfx, text, element);
|
|
3506
3875
|
} else {
|
|
3507
3876
|
|
|
3508
3877
|
// collapsed pool draw text inline
|
|
3509
|
-
var text2 =
|
|
3878
|
+
var text2 = getBusinessObject(element).name;
|
|
3510
3879
|
renderLabel(parentGfx, text2, {
|
|
3511
3880
|
box: element, align: 'center-middle',
|
|
3512
3881
|
style: {
|
|
@@ -3515,7 +3884,7 @@
|
|
|
3515
3884
|
});
|
|
3516
3885
|
}
|
|
3517
3886
|
|
|
3518
|
-
var participantMultiplicity = !!(
|
|
3887
|
+
var participantMultiplicity = !!(getBusinessObject(element).participantMultiplicity);
|
|
3519
3888
|
|
|
3520
3889
|
if (participantMultiplicity) {
|
|
3521
3890
|
renderer('ParticipantMultiplicityMarker')(parentGfx, element);
|
|
@@ -3532,7 +3901,7 @@
|
|
|
3532
3901
|
...attrs
|
|
3533
3902
|
});
|
|
3534
3903
|
|
|
3535
|
-
var semantic =
|
|
3904
|
+
var semantic = getBusinessObject(element);
|
|
3536
3905
|
|
|
3537
3906
|
if (semantic.$type === 'bpmn:Lane') {
|
|
3538
3907
|
var text = semantic.name;
|
|
@@ -3623,7 +3992,7 @@
|
|
|
3623
3992
|
},
|
|
3624
3993
|
'bpmn:EventBasedGateway': function(parentGfx, element) {
|
|
3625
3994
|
|
|
3626
|
-
var semantic =
|
|
3995
|
+
var semantic = getBusinessObject(element);
|
|
3627
3996
|
|
|
3628
3997
|
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
|
3629
3998
|
|
|
@@ -3705,7 +4074,7 @@
|
|
|
3705
4074
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3706
4075
|
});
|
|
3707
4076
|
|
|
3708
|
-
var sequenceFlow =
|
|
4077
|
+
var sequenceFlow = getBusinessObject(element);
|
|
3709
4078
|
|
|
3710
4079
|
var source;
|
|
3711
4080
|
|
|
@@ -3732,7 +4101,7 @@
|
|
|
3732
4101
|
},
|
|
3733
4102
|
'bpmn:Association': function(parentGfx, element, attrs) {
|
|
3734
4103
|
|
|
3735
|
-
var semantic =
|
|
4104
|
+
var semantic = getBusinessObject(element);
|
|
3736
4105
|
|
|
3737
4106
|
var fill = getFillColor(element, defaultFillColor),
|
|
3738
4107
|
stroke = getStrokeColor(element, defaultStrokeColor);
|
|
@@ -3772,7 +4141,7 @@
|
|
|
3772
4141
|
},
|
|
3773
4142
|
'bpmn:MessageFlow': function(parentGfx, element) {
|
|
3774
4143
|
|
|
3775
|
-
var semantic =
|
|
4144
|
+
var semantic = getBusinessObject(element),
|
|
3776
4145
|
di = getDi(element);
|
|
3777
4146
|
|
|
3778
4147
|
var fill = getFillColor(element, defaultFillColor),
|
|
@@ -3847,7 +4216,7 @@
|
|
|
3847
4216
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3848
4217
|
});
|
|
3849
4218
|
|
|
3850
|
-
var semantic =
|
|
4219
|
+
var semantic = getBusinessObject(element);
|
|
3851
4220
|
|
|
3852
4221
|
if (isCollection(semantic)) {
|
|
3853
4222
|
renderDataItemCollection(parentGfx, element);
|
|
@@ -3903,7 +4272,7 @@
|
|
|
3903
4272
|
},
|
|
3904
4273
|
'bpmn:BoundaryEvent': function(parentGfx, element) {
|
|
3905
4274
|
|
|
3906
|
-
var semantic =
|
|
4275
|
+
var semantic = getBusinessObject(element),
|
|
3907
4276
|
cancel = semantic.cancelActivity;
|
|
3908
4277
|
|
|
3909
4278
|
var attrs = {
|
|
@@ -3969,7 +4338,7 @@
|
|
|
3969
4338
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3970
4339
|
});
|
|
3971
4340
|
|
|
3972
|
-
var text =
|
|
4341
|
+
var text = getBusinessObject(element).text || '';
|
|
3973
4342
|
renderLabel(parentGfx, text, {
|
|
3974
4343
|
box: element,
|
|
3975
4344
|
align: 'left-top',
|
|
@@ -4118,7 +4487,7 @@
|
|
|
4118
4487
|
};
|
|
4119
4488
|
|
|
4120
4489
|
function attachTaskMarkers(parentGfx, element, taskMarkers) {
|
|
4121
|
-
var obj =
|
|
4490
|
+
var obj = getBusinessObject(element);
|
|
4122
4491
|
|
|
4123
4492
|
var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
|
|
4124
4493
|
var position;
|
|
@@ -4212,10 +4581,23 @@
|
|
|
4212
4581
|
];
|
|
4213
4582
|
|
|
4214
4583
|
|
|
4584
|
+
/**
|
|
4585
|
+
* @param {DiagramElement} element
|
|
4586
|
+
*
|
|
4587
|
+
* @return {boolean}
|
|
4588
|
+
*/
|
|
4215
4589
|
BpmnRenderer.prototype.canRender = function(element) {
|
|
4216
4590
|
return is$1(element, 'bpmn:BaseElement');
|
|
4217
4591
|
};
|
|
4218
4592
|
|
|
4593
|
+
/**
|
|
4594
|
+
* Draw shape into parentGfx.
|
|
4595
|
+
*
|
|
4596
|
+
* @param {SVGElement} parentGfx
|
|
4597
|
+
* @param {DiagramElement} element
|
|
4598
|
+
*
|
|
4599
|
+
* @return {SVGElement} mainGfx
|
|
4600
|
+
*/
|
|
4219
4601
|
BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
|
|
4220
4602
|
var type = element.type;
|
|
4221
4603
|
var h = this._renderer(type);
|
|
@@ -4224,6 +4606,14 @@
|
|
|
4224
4606
|
return h(parentGfx, element);
|
|
4225
4607
|
};
|
|
4226
4608
|
|
|
4609
|
+
/**
|
|
4610
|
+
* Draw connection into parentGfx.
|
|
4611
|
+
*
|
|
4612
|
+
* @param {SVGElement} parentGfx
|
|
4613
|
+
* @param {DiagramElement} element
|
|
4614
|
+
*
|
|
4615
|
+
* @return {SVGElement} mainGfx
|
|
4616
|
+
*/
|
|
4227
4617
|
BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
|
|
4228
4618
|
var type = element.type;
|
|
4229
4619
|
var h = this._renderer(type);
|
|
@@ -4232,6 +4622,13 @@
|
|
|
4232
4622
|
return h(parentGfx, element);
|
|
4233
4623
|
};
|
|
4234
4624
|
|
|
4625
|
+
/**
|
|
4626
|
+
* Get shape path.
|
|
4627
|
+
*
|
|
4628
|
+
* @param {DiagramElement} element
|
|
4629
|
+
*
|
|
4630
|
+
* @return {string} path
|
|
4631
|
+
*/
|
|
4235
4632
|
BpmnRenderer.prototype.getShapePath = function(element) {
|
|
4236
4633
|
|
|
4237
4634
|
if (is$1(element, 'bpmn:Event')) {
|
|
@@ -4251,16 +4648,55 @@
|
|
|
4251
4648
|
|
|
4252
4649
|
/**
|
|
4253
4650
|
* @typedef {import('../util/Types').Dimensions} Dimensions
|
|
4651
|
+
*
|
|
4652
|
+
* @typedef { {
|
|
4653
|
+
* top: number;
|
|
4654
|
+
* left: number;
|
|
4655
|
+
* right: number;
|
|
4656
|
+
* bottom: number;
|
|
4657
|
+
* } } Padding
|
|
4658
|
+
*
|
|
4659
|
+
* @typedef { number | Partial<Padding> } PaddingConfig
|
|
4660
|
+
*
|
|
4661
|
+
* @typedef { {
|
|
4662
|
+
* horizontal: 'center' | 'left';
|
|
4663
|
+
* vertical: 'top' | 'center';
|
|
4664
|
+
* } } Alignment
|
|
4665
|
+
*
|
|
4666
|
+
* @typedef { 'center-middle' | 'center-top' } AlignmentConfig
|
|
4667
|
+
*
|
|
4668
|
+
* @typedef { Partial<{
|
|
4669
|
+
* align: AlignmentConfig;
|
|
4670
|
+
* style: Record<string, number | string>;
|
|
4671
|
+
* padding: PaddingConfig;
|
|
4672
|
+
* }> } BaseTextConfig
|
|
4673
|
+
*
|
|
4674
|
+
* @typedef { BaseTextConfig & Partial<{
|
|
4675
|
+
* size: Dimensions;
|
|
4676
|
+
* }> } TextConfig
|
|
4677
|
+
*
|
|
4678
|
+
* @typedef { BaseTextConfig & Partial<{
|
|
4679
|
+
* box: Dimensions;
|
|
4680
|
+
* fitBox: boolean;
|
|
4681
|
+
* }> } TextLayoutConfig
|
|
4682
|
+
*
|
|
4683
|
+
* @typedef { Dimensions & {
|
|
4684
|
+
* text: string;
|
|
4685
|
+
* } } LineDescriptor
|
|
4254
4686
|
*/
|
|
4255
4687
|
|
|
4256
4688
|
var DEFAULT_BOX_PADDING = 0;
|
|
4257
4689
|
|
|
4258
|
-
var DEFAULT_LABEL_SIZE
|
|
4690
|
+
var DEFAULT_LABEL_SIZE = {
|
|
4259
4691
|
width: 150,
|
|
4260
4692
|
height: 50
|
|
4261
4693
|
};
|
|
4262
4694
|
|
|
4263
4695
|
|
|
4696
|
+
/**
|
|
4697
|
+
* @param {AlignmentConfig} align
|
|
4698
|
+
* @return {Alignment}
|
|
4699
|
+
*/
|
|
4264
4700
|
function parseAlign(align) {
|
|
4265
4701
|
|
|
4266
4702
|
var parts = align.split('-');
|
|
@@ -4271,6 +4707,11 @@
|
|
|
4271
4707
|
};
|
|
4272
4708
|
}
|
|
4273
4709
|
|
|
4710
|
+
/**
|
|
4711
|
+
* @param {PaddingConfig} padding
|
|
4712
|
+
*
|
|
4713
|
+
* @return {Padding}
|
|
4714
|
+
*/
|
|
4274
4715
|
function parsePadding(padding) {
|
|
4275
4716
|
|
|
4276
4717
|
if (isObject(padding)) {
|
|
@@ -4285,6 +4726,12 @@
|
|
|
4285
4726
|
}
|
|
4286
4727
|
}
|
|
4287
4728
|
|
|
4729
|
+
/**
|
|
4730
|
+
* @param {string} text
|
|
4731
|
+
* @param {SVGTextElement} fakeText
|
|
4732
|
+
*
|
|
4733
|
+
* @return {import('../util/Types').Dimensions}
|
|
4734
|
+
*/
|
|
4288
4735
|
function getTextBBox(text, fakeText) {
|
|
4289
4736
|
|
|
4290
4737
|
fakeText.textContent = text;
|
|
@@ -4327,8 +4774,10 @@
|
|
|
4327
4774
|
* Alters the lines passed.
|
|
4328
4775
|
*
|
|
4329
4776
|
* @param {string[]} lines
|
|
4777
|
+
* @param {number} maxWidth
|
|
4778
|
+
* @param {SVGTextElement} fakeText
|
|
4330
4779
|
*
|
|
4331
|
-
* @return {
|
|
4780
|
+
* @return {LineDescriptor} the line descriptor
|
|
4332
4781
|
*/
|
|
4333
4782
|
function layoutNext(lines, maxWidth, fakeText) {
|
|
4334
4783
|
|
|
@@ -4351,6 +4800,14 @@
|
|
|
4351
4800
|
}
|
|
4352
4801
|
}
|
|
4353
4802
|
|
|
4803
|
+
/**
|
|
4804
|
+
* @param {string[]} lines
|
|
4805
|
+
* @param {string} fitLine
|
|
4806
|
+
* @param {string} originalLine
|
|
4807
|
+
* @param {Dimensions} textBBox
|
|
4808
|
+
*
|
|
4809
|
+
* @return {LineDescriptor}
|
|
4810
|
+
*/
|
|
4354
4811
|
function fit(lines, fitLine, originalLine, textBBox) {
|
|
4355
4812
|
if (fitLine.length < originalLine.length) {
|
|
4356
4813
|
var remainder = originalLine.slice(fitLine.length).trim();
|
|
@@ -4414,6 +4871,13 @@
|
|
|
4414
4871
|
}
|
|
4415
4872
|
|
|
4416
4873
|
|
|
4874
|
+
/**
|
|
4875
|
+
* @param {string} line
|
|
4876
|
+
* @param {number} width
|
|
4877
|
+
* @param {number} maxWidth
|
|
4878
|
+
*
|
|
4879
|
+
* @return {string}
|
|
4880
|
+
*/
|
|
4417
4881
|
function shortenLine(line, width, maxWidth) {
|
|
4418
4882
|
var length = Math.max(line.length * (maxWidth / width), 1);
|
|
4419
4883
|
|
|
@@ -4430,6 +4894,9 @@
|
|
|
4430
4894
|
}
|
|
4431
4895
|
|
|
4432
4896
|
|
|
4897
|
+
/**
|
|
4898
|
+
* @return {SVGSVGElement}
|
|
4899
|
+
*/
|
|
4433
4900
|
function getHelperSvg() {
|
|
4434
4901
|
var helperSvg = document.getElementById('helper-svg');
|
|
4435
4902
|
|
|
@@ -4457,16 +4924,12 @@
|
|
|
4457
4924
|
/**
|
|
4458
4925
|
* Creates a new label utility
|
|
4459
4926
|
*
|
|
4460
|
-
* @param {
|
|
4461
|
-
* @param {Dimensions} config.size
|
|
4462
|
-
* @param {number} config.padding
|
|
4463
|
-
* @param {Object} config.style
|
|
4464
|
-
* @param {string} config.align
|
|
4927
|
+
* @param {TextConfig} config
|
|
4465
4928
|
*/
|
|
4466
4929
|
function Text(config) {
|
|
4467
4930
|
|
|
4468
4931
|
this._config = assign$1({}, {
|
|
4469
|
-
size: DEFAULT_LABEL_SIZE
|
|
4932
|
+
size: DEFAULT_LABEL_SIZE,
|
|
4470
4933
|
padding: DEFAULT_BOX_PADDING,
|
|
4471
4934
|
style: {},
|
|
4472
4935
|
align: 'center-top'
|
|
@@ -4477,7 +4940,7 @@
|
|
|
4477
4940
|
* Returns the layouted text as an SVG element.
|
|
4478
4941
|
*
|
|
4479
4942
|
* @param {string} text
|
|
4480
|
-
* @param {
|
|
4943
|
+
* @param {TextLayoutConfig} options
|
|
4481
4944
|
*
|
|
4482
4945
|
* @return {SVGElement}
|
|
4483
4946
|
*/
|
|
@@ -4489,7 +4952,7 @@
|
|
|
4489
4952
|
* Returns a labels layouted dimensions.
|
|
4490
4953
|
*
|
|
4491
4954
|
* @param {string} text to layout
|
|
4492
|
-
* @param {
|
|
4955
|
+
* @param {TextLayoutConfig} options
|
|
4493
4956
|
*
|
|
4494
4957
|
* @return {Dimensions}
|
|
4495
4958
|
*/
|
|
@@ -4500,18 +4963,13 @@
|
|
|
4500
4963
|
/**
|
|
4501
4964
|
* Creates and returns a label and its bounding box.
|
|
4502
4965
|
*
|
|
4503
|
-
* @method Text#createText
|
|
4504
|
-
*
|
|
4505
4966
|
* @param {string} text the text to render on the label
|
|
4506
|
-
* @param {
|
|
4507
|
-
* @param {string} options.align how to align in the bounding box.
|
|
4508
|
-
* Any of { 'center-middle', 'center-top' },
|
|
4509
|
-
* defaults to 'center-top'.
|
|
4510
|
-
* @param {string} options.style style to be applied to the text
|
|
4511
|
-
* @param {boolean} options.fitBox indicates if box will be recalculated to
|
|
4512
|
-
* fit text
|
|
4967
|
+
* @param {TextLayoutConfig} options
|
|
4513
4968
|
*
|
|
4514
|
-
* @return {
|
|
4969
|
+
* @return { {
|
|
4970
|
+
* element: SVGElement,
|
|
4971
|
+
* dimensions: Dimensions
|
|
4972
|
+
* } }
|
|
4515
4973
|
*/
|
|
4516
4974
|
Text.prototype.layoutText = function(text, options) {
|
|
4517
4975
|
var box = assign$1({}, this._config.size, options.box),
|
|
@@ -4627,7 +5085,30 @@
|
|
|
4627
5085
|
|
|
4628
5086
|
var MIN_TEXT_ANNOTATION_HEIGHT = 30;
|
|
4629
5087
|
|
|
5088
|
+
/**
|
|
5089
|
+
* @typedef { {
|
|
5090
|
+
* fontFamily: string;
|
|
5091
|
+
* fontSize: number;
|
|
5092
|
+
* fontWeight: string;
|
|
5093
|
+
* lineHeight: number;
|
|
5094
|
+
* } } TextRendererStyle
|
|
5095
|
+
*
|
|
5096
|
+
* @typedef { {
|
|
5097
|
+
* defaultStyle?: Partial<TextRendererStyle>;
|
|
5098
|
+
* externalStyle?: Partial<TextRendererStyle>;
|
|
5099
|
+
* } } TextRendererConfig
|
|
5100
|
+
*
|
|
5101
|
+
* @typedef { import('diagram-js/lib/util/Text').TextLayoutConfig } TextLayoutConfig
|
|
5102
|
+
*
|
|
5103
|
+
* @typedef { import('diagram-js/lib/util/Types').Rect } Rect
|
|
5104
|
+
*/
|
|
5105
|
+
|
|
4630
5106
|
|
|
5107
|
+
/**
|
|
5108
|
+
* Renders text and computes text bounding boxes.
|
|
5109
|
+
*
|
|
5110
|
+
* @param {TextRendererConfig} [config]
|
|
5111
|
+
*/
|
|
4631
5112
|
function TextRenderer(config) {
|
|
4632
5113
|
|
|
4633
5114
|
var defaultStyle = assign$1({
|
|
@@ -4651,19 +5132,17 @@
|
|
|
4651
5132
|
* Get the new bounds of an externally rendered,
|
|
4652
5133
|
* layouted label.
|
|
4653
5134
|
*
|
|
4654
|
-
* @param
|
|
4655
|
-
* @param
|
|
5135
|
+
* @param {Rect} bounds
|
|
5136
|
+
* @param {string} text
|
|
4656
5137
|
*
|
|
4657
|
-
* @return {
|
|
5138
|
+
* @return {Rect}
|
|
4658
5139
|
*/
|
|
4659
5140
|
this.getExternalLabelBounds = function(bounds, text) {
|
|
4660
5141
|
|
|
4661
5142
|
var layoutedDimensions = textUtil.getDimensions(text, {
|
|
4662
5143
|
box: {
|
|
4663
5144
|
width: 90,
|
|
4664
|
-
height: 30
|
|
4665
|
-
x: bounds.width / 2 + bounds.x,
|
|
4666
|
-
y: bounds.height / 2 + bounds.y
|
|
5145
|
+
height: 30
|
|
4667
5146
|
},
|
|
4668
5147
|
style: externalStyle
|
|
4669
5148
|
});
|
|
@@ -4681,10 +5160,10 @@
|
|
|
4681
5160
|
/**
|
|
4682
5161
|
* Get the new bounds of text annotation.
|
|
4683
5162
|
*
|
|
4684
|
-
* @param
|
|
4685
|
-
* @param
|
|
5163
|
+
* @param {Rect} bounds
|
|
5164
|
+
* @param {string} text
|
|
4686
5165
|
*
|
|
4687
|
-
* @return {
|
|
5166
|
+
* @return {Rect}
|
|
4688
5167
|
*/
|
|
4689
5168
|
this.getTextAnnotationBounds = function(bounds, text) {
|
|
4690
5169
|
|
|
@@ -4707,7 +5186,7 @@
|
|
|
4707
5186
|
* Create a layouted text element.
|
|
4708
5187
|
*
|
|
4709
5188
|
* @param {string} text
|
|
4710
|
-
* @param {
|
|
5189
|
+
* @param {TextLayoutConfig} [options]
|
|
4711
5190
|
*
|
|
4712
5191
|
* @return {SVGElement} rendered text
|
|
4713
5192
|
*/
|
|
@@ -4736,9 +5215,8 @@
|
|
|
4736
5215
|
];
|
|
4737
5216
|
|
|
4738
5217
|
/**
|
|
4739
|
-
* Map containing SVG paths needed by BpmnRenderer
|
|
5218
|
+
* Map containing SVG paths needed by BpmnRenderer
|
|
4740
5219
|
*/
|
|
4741
|
-
|
|
4742
5220
|
function PathMap() {
|
|
4743
5221
|
|
|
4744
5222
|
/**
|
|
@@ -5080,6 +5558,13 @@
|
|
|
5080
5558
|
}
|
|
5081
5559
|
};
|
|
5082
5560
|
|
|
5561
|
+
/**
|
|
5562
|
+
* Return raw path for the given ID.
|
|
5563
|
+
*
|
|
5564
|
+
* @param {string} pathId
|
|
5565
|
+
*
|
|
5566
|
+
* @return {string} raw path
|
|
5567
|
+
*/
|
|
5083
5568
|
this.getRawPath = function getRawPath(pathId) {
|
|
5084
5569
|
return this.pathMap[pathId].d;
|
|
5085
5570
|
};
|
|
@@ -5132,6 +5617,7 @@
|
|
|
5132
5617
|
* </ul>
|
|
5133
5618
|
* </p>
|
|
5134
5619
|
*
|
|
5620
|
+
* @return {string} scaled path
|
|
5135
5621
|
*/
|
|
5136
5622
|
this.getScaledPath = function getScaledPath(pathId, param) {
|
|
5137
5623
|
var rawPath = this.pathMap[pathId];
|
|
@@ -5215,7 +5701,9 @@
|
|
|
5215
5701
|
};
|
|
5216
5702
|
|
|
5217
5703
|
/**
|
|
5218
|
-
* @typedef {
|
|
5704
|
+
* @typedef { {
|
|
5705
|
+
* [key: string]: string;
|
|
5706
|
+
* } } TranslateReplacements
|
|
5219
5707
|
*/
|
|
5220
5708
|
|
|
5221
5709
|
/**
|
|
@@ -5225,14 +5713,16 @@
|
|
|
5225
5713
|
*
|
|
5226
5714
|
* @example
|
|
5227
5715
|
*
|
|
5716
|
+
* ```javascript
|
|
5228
5717
|
* // use it inside any diagram component by injecting `translate`.
|
|
5229
5718
|
*
|
|
5230
5719
|
* function MyService(translate) {
|
|
5231
5720
|
* alert(translate('HELLO {you}', { you: 'You!' }));
|
|
5232
5721
|
* }
|
|
5722
|
+
* ```
|
|
5233
5723
|
*
|
|
5234
5724
|
* @param {string} template to interpolate
|
|
5235
|
-
* @param {
|
|
5725
|
+
* @param {TranslateReplacements} [replacements] a map with substitutes
|
|
5236
5726
|
*
|
|
5237
5727
|
* @return {string} the translated string
|
|
5238
5728
|
*/
|
|
@@ -5245,150 +5735,22 @@
|
|
|
5245
5735
|
});
|
|
5246
5736
|
}
|
|
5247
5737
|
|
|
5738
|
+
/**
|
|
5739
|
+
* @type { import('didi').ModuleDeclaration }
|
|
5740
|
+
*/
|
|
5248
5741
|
var TranslateModule = {
|
|
5249
5742
|
translate: [ 'value', translate ]
|
|
5250
5743
|
};
|
|
5251
5744
|
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
height: 20
|
|
5255
|
-
};
|
|
5256
|
-
|
|
5257
|
-
var FLOW_LABEL_INDENT = 15;
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
/**
|
|
5261
|
-
* Returns true if the given semantic has an external label
|
|
5262
|
-
*
|
|
5263
|
-
* @param {BpmnElement} semantic
|
|
5264
|
-
* @return {boolean} true if has label
|
|
5265
|
-
*/
|
|
5266
|
-
function isLabelExternal(semantic) {
|
|
5267
|
-
return is$1(semantic, 'bpmn:Event') ||
|
|
5268
|
-
is$1(semantic, 'bpmn:Gateway') ||
|
|
5269
|
-
is$1(semantic, 'bpmn:DataStoreReference') ||
|
|
5270
|
-
is$1(semantic, 'bpmn:DataObjectReference') ||
|
|
5271
|
-
is$1(semantic, 'bpmn:DataInput') ||
|
|
5272
|
-
is$1(semantic, 'bpmn:DataOutput') ||
|
|
5273
|
-
is$1(semantic, 'bpmn:SequenceFlow') ||
|
|
5274
|
-
is$1(semantic, 'bpmn:MessageFlow') ||
|
|
5275
|
-
is$1(semantic, 'bpmn:Group');
|
|
5276
|
-
}
|
|
5277
|
-
|
|
5278
|
-
/**
|
|
5279
|
-
* Get the position for sequence flow labels
|
|
5280
|
-
*
|
|
5281
|
-
* @param {Array<Point>} waypoints
|
|
5282
|
-
* @return {Point} the label position
|
|
5283
|
-
*/
|
|
5284
|
-
function getFlowLabelPosition(waypoints) {
|
|
5285
|
-
|
|
5286
|
-
// get the waypoints mid
|
|
5287
|
-
var mid = waypoints.length / 2 - 1;
|
|
5288
|
-
|
|
5289
|
-
var first = waypoints[Math.floor(mid)];
|
|
5290
|
-
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
5291
|
-
|
|
5292
|
-
// get position
|
|
5293
|
-
var position = getWaypointsMid(waypoints);
|
|
5294
|
-
|
|
5295
|
-
// calculate angle
|
|
5296
|
-
var angle = Math.atan((second.y - first.y) / (second.x - first.x));
|
|
5297
|
-
|
|
5298
|
-
var x = position.x,
|
|
5299
|
-
y = position.y;
|
|
5300
|
-
|
|
5301
|
-
if (Math.abs(angle) < Math.PI / 2) {
|
|
5302
|
-
y -= FLOW_LABEL_INDENT;
|
|
5303
|
-
} else {
|
|
5304
|
-
x += FLOW_LABEL_INDENT;
|
|
5305
|
-
}
|
|
5306
|
-
|
|
5307
|
-
return { x: x, y: y };
|
|
5308
|
-
}
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
/**
|
|
5312
|
-
* Get the middle of a number of waypoints
|
|
5313
|
-
*
|
|
5314
|
-
* @param {Array<Point>} waypoints
|
|
5315
|
-
* @return {Point} the mid point
|
|
5316
|
-
*/
|
|
5317
|
-
function getWaypointsMid(waypoints) {
|
|
5318
|
-
|
|
5319
|
-
var mid = waypoints.length / 2 - 1;
|
|
5320
|
-
|
|
5321
|
-
var first = waypoints[Math.floor(mid)];
|
|
5322
|
-
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
5323
|
-
|
|
5324
|
-
return {
|
|
5325
|
-
x: first.x + (second.x - first.x) / 2,
|
|
5326
|
-
y: first.y + (second.y - first.y) / 2
|
|
5327
|
-
};
|
|
5328
|
-
}
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
function getExternalLabelMid(element) {
|
|
5332
|
-
|
|
5333
|
-
if (element.waypoints) {
|
|
5334
|
-
return getFlowLabelPosition(element.waypoints);
|
|
5335
|
-
} else if (is$1(element, 'bpmn:Group')) {
|
|
5336
|
-
return {
|
|
5337
|
-
x: element.x + element.width / 2,
|
|
5338
|
-
y: element.y + DEFAULT_LABEL_SIZE.height / 2
|
|
5339
|
-
};
|
|
5340
|
-
} else {
|
|
5341
|
-
return {
|
|
5342
|
-
x: element.x + element.width / 2,
|
|
5343
|
-
y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2
|
|
5344
|
-
};
|
|
5345
|
-
}
|
|
5745
|
+
function getDefaultExportFromCjs (x) {
|
|
5746
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5346
5747
|
}
|
|
5347
5748
|
|
|
5348
|
-
|
|
5349
5749
|
/**
|
|
5350
|
-
*
|
|
5351
|
-
* generated from its bounds.
|
|
5750
|
+
* @param {Point} point
|
|
5352
5751
|
*
|
|
5353
|
-
* @
|
|
5354
|
-
* @param {djs.model.Base} element
|
|
5752
|
+
* @returns {Point}
|
|
5355
5753
|
*/
|
|
5356
|
-
function getExternalLabelBounds(di, element) {
|
|
5357
|
-
|
|
5358
|
-
var mid,
|
|
5359
|
-
size,
|
|
5360
|
-
bounds,
|
|
5361
|
-
label = di.label;
|
|
5362
|
-
|
|
5363
|
-
if (label && label.bounds) {
|
|
5364
|
-
bounds = label.bounds;
|
|
5365
|
-
|
|
5366
|
-
size = {
|
|
5367
|
-
width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
|
|
5368
|
-
height: bounds.height
|
|
5369
|
-
};
|
|
5370
|
-
|
|
5371
|
-
mid = {
|
|
5372
|
-
x: bounds.x + bounds.width / 2,
|
|
5373
|
-
y: bounds.y + bounds.height / 2
|
|
5374
|
-
};
|
|
5375
|
-
} else {
|
|
5376
|
-
|
|
5377
|
-
mid = getExternalLabelMid(element);
|
|
5378
|
-
|
|
5379
|
-
size = DEFAULT_LABEL_SIZE;
|
|
5380
|
-
}
|
|
5381
|
-
|
|
5382
|
-
return assign$1({
|
|
5383
|
-
x: mid.x - size.width / 2,
|
|
5384
|
-
y: mid.y - size.height / 2
|
|
5385
|
-
}, size);
|
|
5386
|
-
}
|
|
5387
|
-
|
|
5388
|
-
function getDefaultExportFromCjs (x) {
|
|
5389
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5390
|
-
}
|
|
5391
|
-
|
|
5392
5754
|
function roundPoint(point) {
|
|
5393
5755
|
|
|
5394
5756
|
return {
|
|
@@ -5509,7 +5871,7 @@
|
|
|
5509
5871
|
/**
|
|
5510
5872
|
* Get the mid of the given Element.
|
|
5511
5873
|
*
|
|
5512
|
-
* @param {
|
|
5874
|
+
* @param {Element} element
|
|
5513
5875
|
*
|
|
5514
5876
|
* @return {Point}
|
|
5515
5877
|
*/
|
|
@@ -5539,6 +5901,23 @@
|
|
|
5539
5901
|
return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />';
|
|
5540
5902
|
}
|
|
5541
5903
|
|
|
5904
|
+
/**
|
|
5905
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
5906
|
+
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
5907
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
5908
|
+
* @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
|
|
5909
|
+
*
|
|
5910
|
+
* @typedef {import('../features/modeling/ElementFactory').default} ElementFactory
|
|
5911
|
+
* @typedef {import('../draw/TextRenderer').default} TextRenderer
|
|
5912
|
+
*
|
|
5913
|
+
* @typedef {import('../model/Types').Element} Element
|
|
5914
|
+
* @typedef {import('../model/Types').Label} Label
|
|
5915
|
+
* @typedef {import('../model/Types').Shape} Shape
|
|
5916
|
+
* @typedef {import('../model/Types').Connection} Connection
|
|
5917
|
+
* @typedef {import('../model/Types').Root} Root
|
|
5918
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
5919
|
+
*/
|
|
5920
|
+
|
|
5542
5921
|
/**
|
|
5543
5922
|
* @param {ModdleElement} semantic
|
|
5544
5923
|
* @param {ModdleElement} di
|
|
@@ -5610,8 +5989,14 @@
|
|
|
5610
5989
|
|
|
5611
5990
|
|
|
5612
5991
|
/**
|
|
5613
|
-
* Add
|
|
5614
|
-
*
|
|
5992
|
+
* Add a BPMN element (semantic) to the canvas making it a child of the
|
|
5993
|
+
* given parent.
|
|
5994
|
+
*
|
|
5995
|
+
* @param {ModdleElement} semantic
|
|
5996
|
+
* @param {ModdleElement} di
|
|
5997
|
+
* @param {Shape} parentElement
|
|
5998
|
+
*
|
|
5999
|
+
* @return {Shape | Root | Connection}
|
|
5615
6000
|
*/
|
|
5616
6001
|
BpmnImporter.prototype.add = function(semantic, di, parentElement) {
|
|
5617
6002
|
var element,
|
|
@@ -5720,10 +6105,10 @@
|
|
|
5720
6105
|
|
|
5721
6106
|
|
|
5722
6107
|
/**
|
|
5723
|
-
* Attach
|
|
6108
|
+
* Attach a boundary element to the given host.
|
|
5724
6109
|
*
|
|
5725
6110
|
* @param {ModdleElement} boundarySemantic
|
|
5726
|
-
* @param {
|
|
6111
|
+
* @param {Shape} boundaryElement
|
|
5727
6112
|
*/
|
|
5728
6113
|
BpmnImporter.prototype._attachBoundary = function(boundarySemantic, boundaryElement) {
|
|
5729
6114
|
var translate = this._translate;
|
|
@@ -5756,7 +6141,13 @@
|
|
|
5756
6141
|
|
|
5757
6142
|
|
|
5758
6143
|
/**
|
|
5759
|
-
*
|
|
6144
|
+
* Add a label to a given element.
|
|
6145
|
+
*
|
|
6146
|
+
* @param {ModdleElement} semantic
|
|
6147
|
+
* @param {ModdleElement} di
|
|
6148
|
+
* @param {Element} element
|
|
6149
|
+
*
|
|
6150
|
+
* @return {Label}
|
|
5760
6151
|
*/
|
|
5761
6152
|
BpmnImporter.prototype.addLabel = function(semantic, di, element) {
|
|
5762
6153
|
var bounds,
|
|
@@ -5788,11 +6179,14 @@
|
|
|
5788
6179
|
};
|
|
5789
6180
|
|
|
5790
6181
|
/**
|
|
5791
|
-
*
|
|
6182
|
+
* Get the source or target of the given connection.
|
|
6183
|
+
*
|
|
6184
|
+
* @param {ModdleElement} semantic
|
|
6185
|
+
* @param {'source' | 'target'} side
|
|
5792
6186
|
*
|
|
5793
|
-
* @
|
|
6187
|
+
* @return {Element}
|
|
5794
6188
|
*/
|
|
5795
|
-
BpmnImporter.prototype.
|
|
6189
|
+
BpmnImporter.prototype._getConnectedElement = function(semantic, side) {
|
|
5796
6190
|
|
|
5797
6191
|
var element,
|
|
5798
6192
|
refSemantic,
|
|
@@ -5830,11 +6224,11 @@
|
|
|
5830
6224
|
};
|
|
5831
6225
|
|
|
5832
6226
|
BpmnImporter.prototype._getSource = function(semantic) {
|
|
5833
|
-
return this.
|
|
6227
|
+
return this._getConnectedElement(semantic, 'source');
|
|
5834
6228
|
};
|
|
5835
6229
|
|
|
5836
6230
|
BpmnImporter.prototype._getTarget = function(semantic) {
|
|
5837
|
-
return this.
|
|
6231
|
+
return this._getConnectedElement(semantic, 'target');
|
|
5838
6232
|
};
|
|
5839
6233
|
|
|
5840
6234
|
|
|
@@ -5873,6 +6267,15 @@
|
|
|
5873
6267
|
]
|
|
5874
6268
|
};
|
|
5875
6269
|
|
|
6270
|
+
/**
|
|
6271
|
+
* @typedef {import('../util/Types').Point} Point
|
|
6272
|
+
*/
|
|
6273
|
+
|
|
6274
|
+
/**
|
|
6275
|
+
* @param {import('../core/EventBus').Event} event
|
|
6276
|
+
*
|
|
6277
|
+
* @return {Event}
|
|
6278
|
+
*/
|
|
5876
6279
|
function getOriginal(event) {
|
|
5877
6280
|
return event.originalEvent || event.srcEvent;
|
|
5878
6281
|
}
|
|
@@ -5881,22 +6284,43 @@
|
|
|
5881
6284
|
return (/mac/i).test(navigator.platform);
|
|
5882
6285
|
}
|
|
5883
6286
|
|
|
6287
|
+
/**
|
|
6288
|
+
* @param {MouseEvent} event
|
|
6289
|
+
* @param {string} button
|
|
6290
|
+
*
|
|
6291
|
+
* @return {boolean}
|
|
6292
|
+
*/
|
|
5884
6293
|
function isButton(event, button) {
|
|
5885
6294
|
return (getOriginal(event) || event).button === button;
|
|
5886
6295
|
}
|
|
5887
6296
|
|
|
6297
|
+
/**
|
|
6298
|
+
* @param {MouseEvent} event
|
|
6299
|
+
*
|
|
6300
|
+
* @return {boolean}
|
|
6301
|
+
*/
|
|
5888
6302
|
function isPrimaryButton(event) {
|
|
5889
6303
|
|
|
5890
6304
|
// button === 0 -> left áka primary mouse button
|
|
5891
6305
|
return isButton(event, 0);
|
|
5892
6306
|
}
|
|
5893
6307
|
|
|
6308
|
+
/**
|
|
6309
|
+
* @param {MouseEvent} event
|
|
6310
|
+
*
|
|
6311
|
+
* @return {boolean}
|
|
6312
|
+
*/
|
|
5894
6313
|
function isAuxiliaryButton(event) {
|
|
5895
6314
|
|
|
5896
6315
|
// button === 1 -> auxiliary áka wheel button
|
|
5897
6316
|
return isButton(event, 1);
|
|
5898
6317
|
}
|
|
5899
6318
|
|
|
6319
|
+
/**
|
|
6320
|
+
* @param {MouseEvent} event
|
|
6321
|
+
*
|
|
6322
|
+
* @return {boolean}
|
|
6323
|
+
*/
|
|
5900
6324
|
function hasPrimaryModifier(event) {
|
|
5901
6325
|
var originalEvent = getOriginal(event) || event;
|
|
5902
6326
|
|
|
@@ -5912,7 +6336,11 @@
|
|
|
5912
6336
|
}
|
|
5913
6337
|
}
|
|
5914
6338
|
|
|
5915
|
-
|
|
6339
|
+
/**
|
|
6340
|
+
* @param {MouseEvent} event
|
|
6341
|
+
*
|
|
6342
|
+
* @return {boolean}
|
|
6343
|
+
*/
|
|
5916
6344
|
function hasSecondaryModifier(event) {
|
|
5917
6345
|
var originalEvent = getOriginal(event) || event;
|
|
5918
6346
|
|
|
@@ -5920,11 +6348,13 @@
|
|
|
5920
6348
|
}
|
|
5921
6349
|
|
|
5922
6350
|
/**
|
|
5923
|
-
* @typedef {import('../../model').
|
|
6351
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
5924
6352
|
*
|
|
5925
6353
|
* @typedef {import('../../core/ElementRegistry').default} ElementRegistry
|
|
5926
6354
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
5927
6355
|
* @typedef {import('../../draw/Styles').default} Styles
|
|
6356
|
+
*
|
|
6357
|
+
* @typedef {import('../../util/Types').Point} Point
|
|
5928
6358
|
*/
|
|
5929
6359
|
|
|
5930
6360
|
function allowAll(event) { return true; }
|
|
@@ -5968,7 +6398,7 @@
|
|
|
5968
6398
|
*
|
|
5969
6399
|
* @param {string} type local event name, e.g. element.click.
|
|
5970
6400
|
* @param {MouseEvent|TouchEvent} event native event
|
|
5971
|
-
* @param {
|
|
6401
|
+
* @param {Element} [element] the diagram element to emit the event on;
|
|
5972
6402
|
* defaults to the event target
|
|
5973
6403
|
*/
|
|
5974
6404
|
function fire(type, event, element) {
|
|
@@ -6051,7 +6481,7 @@
|
|
|
6051
6481
|
*
|
|
6052
6482
|
* @param {string} eventName the name of the triggered DOM event
|
|
6053
6483
|
* @param {MouseEvent|TouchEvent} event
|
|
6054
|
-
* @param {
|
|
6484
|
+
* @param {Element} targetElement
|
|
6055
6485
|
*/
|
|
6056
6486
|
function triggerMouseEvent(eventName, event, targetElement) {
|
|
6057
6487
|
|
|
@@ -6217,7 +6647,7 @@
|
|
|
6217
6647
|
/**
|
|
6218
6648
|
* Create default hit for the given element.
|
|
6219
6649
|
*
|
|
6220
|
-
* @param {
|
|
6650
|
+
* @param {Element} element
|
|
6221
6651
|
* @param {SVGElement} gfx
|
|
6222
6652
|
*
|
|
6223
6653
|
* @return {SVGElement} created hit
|
|
@@ -6244,7 +6674,7 @@
|
|
|
6244
6674
|
* Create hits for the given waypoints.
|
|
6245
6675
|
*
|
|
6246
6676
|
* @param {SVGElement} gfx
|
|
6247
|
-
* @param {
|
|
6677
|
+
* @param {Point[]} waypoints
|
|
6248
6678
|
*
|
|
6249
6679
|
* @return {SVGElement}
|
|
6250
6680
|
*/
|
|
@@ -6263,7 +6693,7 @@
|
|
|
6263
6693
|
* Create hits for a box.
|
|
6264
6694
|
*
|
|
6265
6695
|
* @param {SVGElement} gfx
|
|
6266
|
-
* @param {string}
|
|
6696
|
+
* @param {string} type
|
|
6267
6697
|
* @param {Object} attrs
|
|
6268
6698
|
*
|
|
6269
6699
|
* @return {SVGElement}
|
|
@@ -6289,7 +6719,7 @@
|
|
|
6289
6719
|
/**
|
|
6290
6720
|
* Update default hit of the element.
|
|
6291
6721
|
*
|
|
6292
|
-
* @param {
|
|
6722
|
+
* @param {Element} element
|
|
6293
6723
|
* @param {SVGElement} gfx
|
|
6294
6724
|
*
|
|
6295
6725
|
* @return {SVGElement} updated hit
|
|
@@ -6338,7 +6768,7 @@
|
|
|
6338
6768
|
* @event element.hover
|
|
6339
6769
|
*
|
|
6340
6770
|
* @type {Object}
|
|
6341
|
-
* @property {
|
|
6771
|
+
* @property {Element} element
|
|
6342
6772
|
* @property {SVGElement} gfx
|
|
6343
6773
|
* @property {Event} originalEvent
|
|
6344
6774
|
*/
|
|
@@ -6349,7 +6779,7 @@
|
|
|
6349
6779
|
* @event element.out
|
|
6350
6780
|
*
|
|
6351
6781
|
* @type {Object}
|
|
6352
|
-
* @property {
|
|
6782
|
+
* @property {Element} element
|
|
6353
6783
|
* @property {SVGElement} gfx
|
|
6354
6784
|
* @property {Event} originalEvent
|
|
6355
6785
|
*/
|
|
@@ -6360,7 +6790,7 @@
|
|
|
6360
6790
|
* @event element.click
|
|
6361
6791
|
*
|
|
6362
6792
|
* @type {Object}
|
|
6363
|
-
* @property {
|
|
6793
|
+
* @property {Element} element
|
|
6364
6794
|
* @property {SVGElement} gfx
|
|
6365
6795
|
* @property {Event} originalEvent
|
|
6366
6796
|
*/
|
|
@@ -6371,7 +6801,7 @@
|
|
|
6371
6801
|
* @event element.dblclick
|
|
6372
6802
|
*
|
|
6373
6803
|
* @type {Object}
|
|
6374
|
-
* @property {
|
|
6804
|
+
* @property {Element} element
|
|
6375
6805
|
* @property {SVGElement} gfx
|
|
6376
6806
|
* @property {Event} originalEvent
|
|
6377
6807
|
*/
|
|
@@ -6382,7 +6812,7 @@
|
|
|
6382
6812
|
* @event element.mousedown
|
|
6383
6813
|
*
|
|
6384
6814
|
* @type {Object}
|
|
6385
|
-
* @property {
|
|
6815
|
+
* @property {Element} element
|
|
6386
6816
|
* @property {SVGElement} gfx
|
|
6387
6817
|
* @property {Event} originalEvent
|
|
6388
6818
|
*/
|
|
@@ -6393,7 +6823,7 @@
|
|
|
6393
6823
|
* @event element.mouseup
|
|
6394
6824
|
*
|
|
6395
6825
|
* @type {Object}
|
|
6396
|
-
* @property {
|
|
6826
|
+
* @property {Element} element
|
|
6397
6827
|
* @property {SVGElement} gfx
|
|
6398
6828
|
* @property {Event} originalEvent
|
|
6399
6829
|
*/
|
|
@@ -6405,11 +6835,14 @@
|
|
|
6405
6835
|
* @event element.contextmenu
|
|
6406
6836
|
*
|
|
6407
6837
|
* @type {Object}
|
|
6408
|
-
* @property {
|
|
6838
|
+
* @property {Element} element
|
|
6409
6839
|
* @property {SVGElement} gfx
|
|
6410
6840
|
* @property {Event} originalEvent
|
|
6411
6841
|
*/
|
|
6412
6842
|
|
|
6843
|
+
/**
|
|
6844
|
+
* @type { import('didi').ModuleDeclaration }
|
|
6845
|
+
*/
|
|
6413
6846
|
var InteractionEventsModule = {
|
|
6414
6847
|
__init__: [ 'interactionEvents' ],
|
|
6415
6848
|
interactionEvents: [ 'type', InteractionEvents ]
|
|
@@ -6419,7 +6852,7 @@
|
|
|
6419
6852
|
* Returns the surrounding bbox for all elements in
|
|
6420
6853
|
* the array or the element primitive.
|
|
6421
6854
|
*
|
|
6422
|
-
* @param {
|
|
6855
|
+
* @param {Element|Element[]} elements
|
|
6423
6856
|
* @param {boolean} [stopRecursion=false]
|
|
6424
6857
|
*
|
|
6425
6858
|
* @return {Rect}
|
|
@@ -6472,7 +6905,13 @@
|
|
|
6472
6905
|
};
|
|
6473
6906
|
}
|
|
6474
6907
|
|
|
6475
|
-
|
|
6908
|
+
/**
|
|
6909
|
+
* Get the element's type
|
|
6910
|
+
*
|
|
6911
|
+
* @param {Element} element
|
|
6912
|
+
*
|
|
6913
|
+
* @return {'connection' | 'shape' | 'root'}
|
|
6914
|
+
*/
|
|
6476
6915
|
function getType(element) {
|
|
6477
6916
|
|
|
6478
6917
|
if ('waypoints' in element) {
|
|
@@ -6486,15 +6925,19 @@
|
|
|
6486
6925
|
return 'root';
|
|
6487
6926
|
}
|
|
6488
6927
|
|
|
6928
|
+
/**
|
|
6929
|
+
* @param {Element} element
|
|
6930
|
+
*
|
|
6931
|
+
* @return {boolean}
|
|
6932
|
+
*/
|
|
6489
6933
|
function isFrameElement(element) {
|
|
6490
|
-
|
|
6491
6934
|
return !!(element && element.isFrame);
|
|
6492
6935
|
}
|
|
6493
6936
|
|
|
6494
6937
|
var LOW_PRIORITY$2 = 500;
|
|
6495
6938
|
|
|
6496
6939
|
/**
|
|
6497
|
-
* @typedef {import('../../model').
|
|
6940
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
6498
6941
|
*
|
|
6499
6942
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
6500
6943
|
* @typedef {import('../../draw/Styles').default} Styles
|
|
@@ -6568,7 +7011,7 @@
|
|
|
6568
7011
|
* element and an outline offset.
|
|
6569
7012
|
*
|
|
6570
7013
|
* @param {SVGElement} outline
|
|
6571
|
-
* @param {
|
|
7014
|
+
* @param {Element} element
|
|
6572
7015
|
*/
|
|
6573
7016
|
Outline.prototype.updateShapeOutline = function(outline, element) {
|
|
6574
7017
|
|
|
@@ -6587,7 +7030,7 @@
|
|
|
6587
7030
|
* the connection and an outline offset.
|
|
6588
7031
|
*
|
|
6589
7032
|
* @param {SVGElement} outline
|
|
6590
|
-
* @param {
|
|
7033
|
+
* @param {Element} connection
|
|
6591
7034
|
*/
|
|
6592
7035
|
Outline.prototype.updateConnectionOutline = function(outline, connection) {
|
|
6593
7036
|
|
|
@@ -6605,12 +7048,16 @@
|
|
|
6605
7048
|
|
|
6606
7049
|
Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
|
|
6607
7050
|
|
|
7051
|
+
/**
|
|
7052
|
+
* @type { import('didi').ModuleDeclaration }
|
|
7053
|
+
*/
|
|
6608
7054
|
var OutlineModule = {
|
|
6609
7055
|
__init__: [ 'outline' ],
|
|
6610
7056
|
outline: [ 'type', Outline ]
|
|
6611
7057
|
};
|
|
6612
7058
|
|
|
6613
7059
|
/**
|
|
7060
|
+
* @typedef {import('../../core/Canvas').default} Canvas
|
|
6614
7061
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
6615
7062
|
*/
|
|
6616
7063
|
|
|
@@ -6618,15 +7065,17 @@
|
|
|
6618
7065
|
* A service that offers the current selection in a diagram.
|
|
6619
7066
|
* Offers the api to control the selection, too.
|
|
6620
7067
|
*
|
|
6621
|
-
* @class
|
|
6622
|
-
*
|
|
6623
7068
|
* @param {EventBus} eventBus
|
|
7069
|
+
* @param {Canvas} canvas
|
|
6624
7070
|
*/
|
|
6625
7071
|
function Selection(eventBus, canvas) {
|
|
6626
7072
|
|
|
6627
7073
|
this._eventBus = eventBus;
|
|
6628
7074
|
this._canvas = canvas;
|
|
6629
7075
|
|
|
7076
|
+
/**
|
|
7077
|
+
* @type {Object[]}
|
|
7078
|
+
*/
|
|
6630
7079
|
this._selectedElements = [];
|
|
6631
7080
|
|
|
6632
7081
|
var self = this;
|
|
@@ -6643,7 +7092,11 @@
|
|
|
6643
7092
|
|
|
6644
7093
|
Selection.$inject = [ 'eventBus', 'canvas' ];
|
|
6645
7094
|
|
|
6646
|
-
|
|
7095
|
+
/**
|
|
7096
|
+
* Deselect an element.
|
|
7097
|
+
*
|
|
7098
|
+
* @param {Object} element The element to deselect.
|
|
7099
|
+
*/
|
|
6647
7100
|
Selection.prototype.deselect = function(element) {
|
|
6648
7101
|
var selectedElements = this._selectedElements;
|
|
6649
7102
|
|
|
@@ -6658,26 +7111,33 @@
|
|
|
6658
7111
|
}
|
|
6659
7112
|
};
|
|
6660
7113
|
|
|
6661
|
-
|
|
7114
|
+
/**
|
|
7115
|
+
* Get the selected elements.
|
|
7116
|
+
*
|
|
7117
|
+
* @return {Object[]} The selected elements.
|
|
7118
|
+
*/
|
|
6662
7119
|
Selection.prototype.get = function() {
|
|
6663
7120
|
return this._selectedElements;
|
|
6664
7121
|
};
|
|
6665
7122
|
|
|
7123
|
+
/**
|
|
7124
|
+
* Check whether an element is selected.
|
|
7125
|
+
*
|
|
7126
|
+
* @param {Object} element The element.
|
|
7127
|
+
*
|
|
7128
|
+
* @return {boolean} Whether the element is selected.
|
|
7129
|
+
*/
|
|
6666
7130
|
Selection.prototype.isSelected = function(element) {
|
|
6667
7131
|
return this._selectedElements.indexOf(element) !== -1;
|
|
6668
7132
|
};
|
|
6669
7133
|
|
|
6670
7134
|
|
|
6671
7135
|
/**
|
|
6672
|
-
*
|
|
6673
|
-
*
|
|
6674
|
-
* By passing an additional add parameter you can decide whether or not the element(s)
|
|
6675
|
-
* should be added to the already existing selection or not.
|
|
6676
|
-
*
|
|
6677
|
-
* @method Selection#select
|
|
7136
|
+
* Select one or many elements.
|
|
6678
7137
|
*
|
|
6679
|
-
* @param {Object|Object[]} elements element
|
|
6680
|
-
* @param {boolean} [add]
|
|
7138
|
+
* @param {Object|Object[]} elements The element(s) to select.
|
|
7139
|
+
* @param {boolean} [add] Whether to add the element(s) to the selected elements.
|
|
7140
|
+
* Defaults to `false`.
|
|
6681
7141
|
*/
|
|
6682
7142
|
Selection.prototype.select = function(elements, add) {
|
|
6683
7143
|
var selectedElements = this._selectedElements,
|
|
@@ -6963,6 +7423,9 @@
|
|
|
6963
7423
|
return !element.hidden;
|
|
6964
7424
|
}
|
|
6965
7425
|
|
|
7426
|
+
/**
|
|
7427
|
+
* @type { import('didi').ModuleDeclaration }
|
|
7428
|
+
*/
|
|
6966
7429
|
var SelectionModule = {
|
|
6967
7430
|
__init__: [ 'selectionVisuals', 'selectionBehavior' ],
|
|
6968
7431
|
__depends__: [
|
|
@@ -6982,7 +7445,7 @@
|
|
|
6982
7445
|
*
|
|
6983
7446
|
* The ids can be customized via a given prefix and contain a random value to avoid collisions.
|
|
6984
7447
|
*
|
|
6985
|
-
* @param {string} prefix a prefix to prepend to generated ids (for better readability)
|
|
7448
|
+
* @param {string} [prefix] a prefix to prepend to generated ids (for better readability)
|
|
6986
7449
|
*/
|
|
6987
7450
|
function IdGenerator(prefix) {
|
|
6988
7451
|
|
|
@@ -6993,7 +7456,7 @@
|
|
|
6993
7456
|
/**
|
|
6994
7457
|
* Returns a next unique ID.
|
|
6995
7458
|
*
|
|
6996
|
-
* @
|
|
7459
|
+
* @return {string} the id
|
|
6997
7460
|
*/
|
|
6998
7461
|
IdGenerator.prototype.next = function() {
|
|
6999
7462
|
return this._prefix + (++this._counter);
|
|
@@ -7009,12 +7472,54 @@
|
|
|
7009
7472
|
* @typedef {import('../../core/ElementRegistry').default} ElementRegistry
|
|
7010
7473
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
7011
7474
|
*
|
|
7012
|
-
* @typedef {import('
|
|
7013
|
-
*
|
|
7014
|
-
* @typedef {
|
|
7015
|
-
*
|
|
7016
|
-
*
|
|
7017
|
-
*
|
|
7475
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
7476
|
+
*
|
|
7477
|
+
* @typedef { {
|
|
7478
|
+
* minZoom?: number,
|
|
7479
|
+
* maxZoom?: number
|
|
7480
|
+
* } } OverlaysConfigShow
|
|
7481
|
+
*
|
|
7482
|
+
* @typedef { {
|
|
7483
|
+
* min?: number,
|
|
7484
|
+
* max?: number
|
|
7485
|
+
* } } OverlaysConfigScale
|
|
7486
|
+
*
|
|
7487
|
+
* @typedef { {
|
|
7488
|
+
* id: string,
|
|
7489
|
+
* type: string | null,
|
|
7490
|
+
* element: Element | string
|
|
7491
|
+
* } & OverlayAttrs } Overlay
|
|
7492
|
+
*
|
|
7493
|
+
* @typedef { {
|
|
7494
|
+
* html: HTMLElement | string,
|
|
7495
|
+
* position: {
|
|
7496
|
+
* top?: number,
|
|
7497
|
+
* right?: number,
|
|
7498
|
+
* bottom?: number,
|
|
7499
|
+
* left?: number
|
|
7500
|
+
* }
|
|
7501
|
+
* } & OverlaysConfigDefault } OverlayAttrs
|
|
7502
|
+
*
|
|
7503
|
+
* @typedef { {
|
|
7504
|
+
* html: HTMLElement,
|
|
7505
|
+
* element: Element,
|
|
7506
|
+
* overlays: Overlay[]
|
|
7507
|
+
* } } OverlayContainer
|
|
7508
|
+
*
|
|
7509
|
+
* @typedef {{
|
|
7510
|
+
* defaults?: OverlaysConfigDefault
|
|
7511
|
+
* }} OverlaysConfig
|
|
7512
|
+
*
|
|
7513
|
+
* @typedef { {
|
|
7514
|
+
* show?: OverlaysConfigShow,
|
|
7515
|
+
* scale?: OverlaysConfigScale | boolean
|
|
7516
|
+
* } } OverlaysConfigDefault
|
|
7517
|
+
*
|
|
7518
|
+
* @typedef { {
|
|
7519
|
+
* id?: string;
|
|
7520
|
+
* element?: Element | string;
|
|
7521
|
+
* type?: string;
|
|
7522
|
+
* } | string } OverlaysFilter
|
|
7018
7523
|
*/
|
|
7019
7524
|
|
|
7020
7525
|
/**
|
|
@@ -7024,6 +7529,7 @@
|
|
|
7024
7529
|
*
|
|
7025
7530
|
* @example
|
|
7026
7531
|
*
|
|
7532
|
+
* ```javascript
|
|
7027
7533
|
* // add a pink badge on the top left of the shape
|
|
7028
7534
|
*
|
|
7029
7535
|
* overlays.add(someShape, {
|
|
@@ -7053,8 +7559,9 @@
|
|
|
7053
7559
|
* }
|
|
7054
7560
|
* html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>'
|
|
7055
7561
|
* });
|
|
7562
|
+
* ```
|
|
7056
7563
|
*
|
|
7057
|
-
*
|
|
7564
|
+
* ```javascript
|
|
7058
7565
|
* // remove an overlay
|
|
7059
7566
|
*
|
|
7060
7567
|
* var id = overlays.add(...);
|
|
@@ -7076,6 +7583,7 @@
|
|
|
7076
7583
|
* }
|
|
7077
7584
|
* }
|
|
7078
7585
|
* }
|
|
7586
|
+
* ```
|
|
7079
7587
|
*
|
|
7080
7588
|
* @param {OverlaysConfig} config
|
|
7081
7589
|
* @param {EventBus} eventBus
|
|
@@ -7134,6 +7642,7 @@
|
|
|
7134
7642
|
*
|
|
7135
7643
|
* @example
|
|
7136
7644
|
*
|
|
7645
|
+
* ```javascript
|
|
7137
7646
|
* // return the single overlay with the given ID
|
|
7138
7647
|
* overlays.get('some-id');
|
|
7139
7648
|
*
|
|
@@ -7145,6 +7654,7 @@
|
|
|
7145
7654
|
*
|
|
7146
7655
|
* // shape can also be specified as ID
|
|
7147
7656
|
* overlays.get({ element: 'element-id', type: 'badge' });
|
|
7657
|
+
* ```
|
|
7148
7658
|
*
|
|
7149
7659
|
* @param {OverlaysFilter} search The filter to be used to find the overlay(s).
|
|
7150
7660
|
*
|
|
@@ -7182,7 +7692,7 @@
|
|
|
7182
7692
|
/**
|
|
7183
7693
|
* Adds an HTML overlay to an element.
|
|
7184
7694
|
*
|
|
7185
|
-
* @param {
|
|
7695
|
+
* @param {Element|string} element The element to add the overlay to.
|
|
7186
7696
|
* @param {string} [type] An optional type that can be used to filter.
|
|
7187
7697
|
* @param {OverlayAttrs} overlay The overlay.
|
|
7188
7698
|
*
|
|
@@ -7270,7 +7780,7 @@
|
|
|
7270
7780
|
/**
|
|
7271
7781
|
* Checks whether overlays are shown.
|
|
7272
7782
|
*
|
|
7273
|
-
* @
|
|
7783
|
+
* @return {boolean} Whether overlays are shown.
|
|
7274
7784
|
*/
|
|
7275
7785
|
Overlays.prototype.isShown = function() {
|
|
7276
7786
|
return this._overlayRoot.style.display !== 'none';
|
|
@@ -7663,6 +8173,9 @@
|
|
|
7663
8173
|
});
|
|
7664
8174
|
}
|
|
7665
8175
|
|
|
8176
|
+
/**
|
|
8177
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8178
|
+
*/
|
|
7666
8179
|
var OverlaysModule = {
|
|
7667
8180
|
__init__: [ 'overlays' ],
|
|
7668
8181
|
overlays: [ 'type', Overlays ]
|
|
@@ -7739,15 +8252,22 @@
|
|
|
7739
8252
|
'graphicsFactory'
|
|
7740
8253
|
];
|
|
7741
8254
|
|
|
8255
|
+
/**
|
|
8256
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8257
|
+
*/
|
|
7742
8258
|
var ChangeSupportModule = {
|
|
7743
8259
|
__init__: [ 'changeSupport' ],
|
|
7744
8260
|
changeSupport: [ 'type', ChangeSupport ]
|
|
7745
8261
|
};
|
|
7746
8262
|
|
|
7747
8263
|
/**
|
|
8264
|
+
* @typedef {import('../core/Types').ElementLike} ElementLike
|
|
7748
8265
|
* @typedef {import('../core/EventBus').default} EventBus
|
|
7749
|
-
* @typedef {import(./
|
|
7750
|
-
*
|
|
8266
|
+
* @typedef {import('./CommandStack').CommandContext} CommandContext
|
|
8267
|
+
*
|
|
8268
|
+
* @typedef {string|string[]} Events
|
|
8269
|
+
* @typedef { (context: CommandContext) => ElementLike[] | void } HandlerFunction
|
|
8270
|
+
* @typedef { (context: CommandContext) => void } ComposeHandlerFunction
|
|
7751
8271
|
*/
|
|
7752
8272
|
|
|
7753
8273
|
var DEFAULT_PRIORITY$1 = 1000;
|
|
@@ -7759,10 +8279,9 @@
|
|
|
7759
8279
|
* @class
|
|
7760
8280
|
* @constructor
|
|
7761
8281
|
*
|
|
7762
|
-
* @param {EventBus} eventBus
|
|
7763
|
-
*
|
|
7764
8282
|
* @example
|
|
7765
8283
|
*
|
|
8284
|
+
* ```javascript
|
|
7766
8285
|
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
7767
8286
|
*
|
|
7768
8287
|
* class CommandLogger extends CommandInterceptor {
|
|
@@ -7773,6 +8292,9 @@
|
|
|
7773
8292
|
* console.log('commandStack.shape-create.preExecute', event);
|
|
7774
8293
|
* });
|
|
7775
8294
|
* }
|
|
8295
|
+
* ```
|
|
8296
|
+
*
|
|
8297
|
+
* @param {EventBus} eventBus
|
|
7776
8298
|
*/
|
|
7777
8299
|
function CommandInterceptor(eventBus) {
|
|
7778
8300
|
|
|
@@ -7790,16 +8312,17 @@
|
|
|
7790
8312
|
};
|
|
7791
8313
|
}
|
|
7792
8314
|
|
|
8315
|
+
|
|
7793
8316
|
/**
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
8317
|
+
* Intercept a command during one of the phases.
|
|
8318
|
+
*
|
|
8319
|
+
* @param {Events} [events] command(s) to intercept
|
|
8320
|
+
* @param {string} [hook] phase to intercept
|
|
8321
|
+
* @param {number} [priority]
|
|
8322
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8323
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8324
|
+
* @param {any} [that]
|
|
8325
|
+
*/
|
|
7803
8326
|
CommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {
|
|
7804
8327
|
|
|
7805
8328
|
if (isFunction(hook) || isNumber(hook)) {
|
|
@@ -7841,35 +8364,130 @@
|
|
|
7841
8364
|
});
|
|
7842
8365
|
};
|
|
7843
8366
|
|
|
8367
|
+
/**
|
|
8368
|
+
* Add a <canExecute> phase of command interceptor.
|
|
8369
|
+
*
|
|
8370
|
+
* @param {Events} [events] command(s) to intercept
|
|
8371
|
+
* @param {number} [priority]
|
|
8372
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8373
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8374
|
+
* @param {any} [that]
|
|
8375
|
+
*/
|
|
8376
|
+
CommandInterceptor.prototype.canExecute = createHook('canExecute');
|
|
8377
|
+
|
|
8378
|
+
/**
|
|
8379
|
+
* Add a <preExecute> phase of command interceptor.
|
|
8380
|
+
*
|
|
8381
|
+
* @param {Events} [events] command(s) to intercept
|
|
8382
|
+
* @param {number} [priority]
|
|
8383
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8384
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8385
|
+
* @param {any} [that]
|
|
8386
|
+
*/
|
|
8387
|
+
CommandInterceptor.prototype.preExecute = createHook('preExecute');
|
|
7844
8388
|
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
8389
|
+
/**
|
|
8390
|
+
* Add a <preExecuted> phase of command interceptor.
|
|
8391
|
+
*
|
|
8392
|
+
* @param {Events} [events] command(s) to intercept
|
|
8393
|
+
* @param {number} [priority]
|
|
8394
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8395
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8396
|
+
* @param {any} [that]
|
|
8397
|
+
*/
|
|
8398
|
+
CommandInterceptor.prototype.preExecuted = createHook('preExecuted');
|
|
8399
|
+
|
|
8400
|
+
/**
|
|
8401
|
+
* Add a <execute> phase of command interceptor.
|
|
8402
|
+
*
|
|
8403
|
+
* @param {Events} [events] command(s) to intercept
|
|
8404
|
+
* @param {number} [priority]
|
|
8405
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8406
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8407
|
+
* @param {any} [that]
|
|
8408
|
+
*/
|
|
8409
|
+
CommandInterceptor.prototype.execute = createHook('execute');
|
|
8410
|
+
|
|
8411
|
+
/**
|
|
8412
|
+
* Add a <executed> phase of command interceptor.
|
|
8413
|
+
*
|
|
8414
|
+
* @param {Events} [events] command(s) to intercept
|
|
8415
|
+
* @param {number} [priority]
|
|
8416
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8417
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8418
|
+
* @param {any} [that]
|
|
8419
|
+
*/
|
|
8420
|
+
CommandInterceptor.prototype.executed = createHook('executed');
|
|
8421
|
+
|
|
8422
|
+
/**
|
|
8423
|
+
* Add a <postExecute> phase of command interceptor.
|
|
8424
|
+
*
|
|
8425
|
+
* @param {Events} [events] command(s) to intercept
|
|
8426
|
+
* @param {number} [priority]
|
|
8427
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8428
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8429
|
+
* @param {any} [that]
|
|
8430
|
+
*/
|
|
8431
|
+
CommandInterceptor.prototype.postExecute = createHook('postExecute');
|
|
8432
|
+
|
|
8433
|
+
/**
|
|
8434
|
+
* Add a <postExecuted> phase of command interceptor.
|
|
8435
|
+
*
|
|
8436
|
+
* @param {Events} [events] command(s) to intercept
|
|
8437
|
+
* @param {number} [priority]
|
|
8438
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8439
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8440
|
+
* @param {any} [that]
|
|
8441
|
+
*/
|
|
8442
|
+
CommandInterceptor.prototype.postExecuted = createHook('postExecuted');
|
|
8443
|
+
|
|
8444
|
+
/**
|
|
8445
|
+
* Add a <revert> phase of command interceptor.
|
|
8446
|
+
*
|
|
8447
|
+
* @param {Events} [events] command(s) to intercept
|
|
8448
|
+
* @param {number} [priority]
|
|
8449
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8450
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8451
|
+
* @param {any} [that]
|
|
8452
|
+
*/
|
|
8453
|
+
CommandInterceptor.prototype.revert = createHook('revert');
|
|
8454
|
+
|
|
8455
|
+
/**
|
|
8456
|
+
* Add a <reverted> phase of command interceptor.
|
|
8457
|
+
*
|
|
8458
|
+
* @param {Events} [events] command(s) to intercept
|
|
8459
|
+
* @param {number} [priority]
|
|
8460
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8461
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8462
|
+
* @param {any} [that]
|
|
8463
|
+
*/
|
|
8464
|
+
CommandInterceptor.prototype.reverted = createHook('reverted');
|
|
7856
8465
|
|
|
7857
8466
|
/*
|
|
7858
8467
|
* Add prototype methods for each phase of command execution (e.g. execute,
|
|
7859
8468
|
* revert).
|
|
8469
|
+
*
|
|
8470
|
+
* @param {string} hook
|
|
8471
|
+
*
|
|
8472
|
+
* @return { (
|
|
8473
|
+
* events?: Events,
|
|
8474
|
+
* priority?: number,
|
|
8475
|
+
* handlerFn: ComposeHandlerFunction|HandlerFunction,
|
|
8476
|
+
* unwrap?: boolean
|
|
8477
|
+
* ) => any }
|
|
7860
8478
|
*/
|
|
7861
|
-
|
|
8479
|
+
function createHook(hook) {
|
|
7862
8480
|
|
|
7863
8481
|
/**
|
|
7864
|
-
*
|
|
8482
|
+
* @this {CommandInterceptor}
|
|
7865
8483
|
*
|
|
7866
|
-
* @param {
|
|
7867
|
-
* @param {number} [priority]
|
|
7868
|
-
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
7869
|
-
* @param {boolean} [unwrap]
|
|
7870
|
-
* @param {
|
|
8484
|
+
* @param {Events} [events]
|
|
8485
|
+
* @param {number} [priority]
|
|
8486
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8487
|
+
* @param {boolean} [unwrap]
|
|
8488
|
+
* @param {any} [that]
|
|
7871
8489
|
*/
|
|
7872
|
-
|
|
8490
|
+
const hookFn = function(events, priority, handlerFn, unwrap, that) {
|
|
7873
8491
|
|
|
7874
8492
|
if (isFunction(events) || isNumber(events)) {
|
|
7875
8493
|
that = unwrap;
|
|
@@ -7881,7 +8499,9 @@
|
|
|
7881
8499
|
|
|
7882
8500
|
this.on(events, hook, priority, handlerFn, unwrap, that);
|
|
7883
8501
|
};
|
|
7884
|
-
|
|
8502
|
+
|
|
8503
|
+
return hookFn;
|
|
8504
|
+
}
|
|
7885
8505
|
|
|
7886
8506
|
/**
|
|
7887
8507
|
* @typedef {import('didi').Injector} Injector
|
|
@@ -7923,6 +8543,9 @@
|
|
|
7923
8543
|
|
|
7924
8544
|
RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
|
|
7925
8545
|
|
|
8546
|
+
/**
|
|
8547
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8548
|
+
*/
|
|
7926
8549
|
var RootElementsModule = {
|
|
7927
8550
|
__init__: [ 'rootElementsBehavior' ],
|
|
7928
8551
|
rootElementsBehavior: [ 'type', RootElementsBehavior ]
|
|
@@ -7930,7 +8553,8 @@
|
|
|
7930
8553
|
|
|
7931
8554
|
/**
|
|
7932
8555
|
* @param {string} str
|
|
7933
|
-
*
|
|
8556
|
+
*
|
|
8557
|
+
* @return {string}
|
|
7934
8558
|
*/
|
|
7935
8559
|
|
|
7936
8560
|
var HTML_ESCAPE_MAP = {
|
|
@@ -7941,6 +8565,11 @@
|
|
|
7941
8565
|
'\'': '''
|
|
7942
8566
|
};
|
|
7943
8567
|
|
|
8568
|
+
/**
|
|
8569
|
+
* @param {string} str
|
|
8570
|
+
*
|
|
8571
|
+
* @return {string}
|
|
8572
|
+
*/
|
|
7944
8573
|
function escapeHTML(str) {
|
|
7945
8574
|
str = '' + str;
|
|
7946
8575
|
|
|
@@ -7949,14 +8578,19 @@
|
|
|
7949
8578
|
});
|
|
7950
8579
|
}
|
|
7951
8580
|
|
|
8581
|
+
/**
|
|
8582
|
+
* @typedef {import('../model/Types').Element} Element
|
|
8583
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
8584
|
+
*/
|
|
8585
|
+
|
|
7952
8586
|
var planeSuffix = '_plane';
|
|
7953
8587
|
|
|
7954
8588
|
/**
|
|
7955
8589
|
* Get plane ID for a primary shape.
|
|
7956
8590
|
*
|
|
7957
|
-
* @param {
|
|
8591
|
+
* @param {Element|ModdleElement} element
|
|
7958
8592
|
*
|
|
7959
|
-
* @
|
|
8593
|
+
* @return {string}
|
|
7960
8594
|
*/
|
|
7961
8595
|
function getPlaneIdFromShape(element) {
|
|
7962
8596
|
var id = element.id;
|
|
@@ -7972,32 +8606,40 @@
|
|
|
7972
8606
|
return id + planeSuffix;
|
|
7973
8607
|
}
|
|
7974
8608
|
|
|
8609
|
+
/**
|
|
8610
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
8611
|
+
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
8612
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8613
|
+
*
|
|
8614
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
8615
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
8616
|
+
*/
|
|
8617
|
+
|
|
7975
8618
|
var OPEN_CLASS = 'bjs-breadcrumbs-shown';
|
|
7976
8619
|
|
|
7977
8620
|
|
|
7978
8621
|
/**
|
|
7979
8622
|
* Adds overlays that allow switching planes on collapsed subprocesses.
|
|
7980
8623
|
*
|
|
7981
|
-
* @param {
|
|
7982
|
-
* @param {
|
|
7983
|
-
* @param {
|
|
7984
|
-
* @param {canvas} canvas
|
|
8624
|
+
* @param {EventBus} eventBus
|
|
8625
|
+
* @param {ElementRegistry} elementRegistry
|
|
8626
|
+
* @param {Canvas} canvas
|
|
7985
8627
|
*/
|
|
7986
|
-
function DrilldownBreadcrumbs(eventBus, elementRegistry,
|
|
8628
|
+
function DrilldownBreadcrumbs(eventBus, elementRegistry, canvas) {
|
|
7987
8629
|
var breadcrumbs = domify$1('<ul class="bjs-breadcrumbs"></ul>');
|
|
7988
8630
|
var container = canvas.getContainer();
|
|
7989
8631
|
var containerClasses = classes(container);
|
|
7990
8632
|
container.appendChild(breadcrumbs);
|
|
7991
8633
|
|
|
7992
|
-
var
|
|
8634
|
+
var businessObjectParents = [];
|
|
7993
8635
|
|
|
7994
8636
|
// update breadcrumbs if name or ID of the primary shape changes
|
|
7995
|
-
eventBus.on('element.changed', function(
|
|
7996
|
-
var shape =
|
|
7997
|
-
|
|
8637
|
+
eventBus.on('element.changed', function(event) {
|
|
8638
|
+
var shape = event.element,
|
|
8639
|
+
businessObject = getBusinessObject(shape);
|
|
7998
8640
|
|
|
7999
|
-
var isPresent = find(
|
|
8000
|
-
return
|
|
8641
|
+
var isPresent = find(businessObjectParents, function(element) {
|
|
8642
|
+
return element === businessObject;
|
|
8001
8643
|
});
|
|
8002
8644
|
|
|
8003
8645
|
if (!isPresent) {
|
|
@@ -8011,14 +8653,14 @@
|
|
|
8011
8653
|
* Updates the displayed breadcrumbs. If no element is provided, only the
|
|
8012
8654
|
* labels are updated.
|
|
8013
8655
|
*
|
|
8014
|
-
* @param {
|
|
8656
|
+
* @param {Element} [element]
|
|
8015
8657
|
*/
|
|
8016
8658
|
function updateBreadcrumbs(element) {
|
|
8017
8659
|
if (element) {
|
|
8018
|
-
|
|
8660
|
+
businessObjectParents = getBusinessObjectParentChain(element);
|
|
8019
8661
|
}
|
|
8020
8662
|
|
|
8021
|
-
var path =
|
|
8663
|
+
var path = businessObjectParents.map(function(parent) {
|
|
8022
8664
|
var title = escapeHTML(parent.name || parent.id);
|
|
8023
8665
|
var link = domify$1('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
|
|
8024
8666
|
|
|
@@ -8028,8 +8670,9 @@
|
|
|
8028
8670
|
// element in the elementRegisty. Instead, we search for the corresponding participant
|
|
8029
8671
|
if (!parentPlane && is$1(parent, 'bpmn:Process')) {
|
|
8030
8672
|
var participant = elementRegistry.find(function(element) {
|
|
8031
|
-
var
|
|
8032
|
-
|
|
8673
|
+
var businessObject = getBusinessObject(element);
|
|
8674
|
+
|
|
8675
|
+
return businessObject && businessObject.get('processRef') && businessObject.get('processRef') === parent;
|
|
8033
8676
|
});
|
|
8034
8677
|
|
|
8035
8678
|
parentPlane = canvas.findRoot(participant.id);
|
|
@@ -8046,10 +8689,11 @@
|
|
|
8046
8689
|
|
|
8047
8690
|
// show breadcrumbs and expose state to .djs-container
|
|
8048
8691
|
var visible = path.length > 1;
|
|
8692
|
+
|
|
8049
8693
|
containerClasses.toggle(OPEN_CLASS, visible);
|
|
8050
8694
|
|
|
8051
|
-
path.forEach(function(
|
|
8052
|
-
breadcrumbs.appendChild(
|
|
8695
|
+
path.forEach(function(element) {
|
|
8696
|
+
breadcrumbs.appendChild(element);
|
|
8053
8697
|
});
|
|
8054
8698
|
}
|
|
8055
8699
|
|
|
@@ -8059,7 +8703,7 @@
|
|
|
8059
8703
|
|
|
8060
8704
|
}
|
|
8061
8705
|
|
|
8062
|
-
DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', '
|
|
8706
|
+
DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', 'canvas' ];
|
|
8063
8707
|
|
|
8064
8708
|
|
|
8065
8709
|
// helpers //////////
|
|
@@ -8068,16 +8712,16 @@
|
|
|
8068
8712
|
* Returns the parents for the element using the business object chain,
|
|
8069
8713
|
* starting with the root element.
|
|
8070
8714
|
*
|
|
8071
|
-
* @param {
|
|
8715
|
+
* @param {Shape} child
|
|
8072
8716
|
*
|
|
8073
|
-
* @
|
|
8717
|
+
* @return {Shape}
|
|
8074
8718
|
*/
|
|
8075
|
-
function
|
|
8076
|
-
var
|
|
8719
|
+
function getBusinessObjectParentChain(child) {
|
|
8720
|
+
var businessObject = getBusinessObject(child);
|
|
8077
8721
|
|
|
8078
8722
|
var parents = [];
|
|
8079
8723
|
|
|
8080
|
-
for (var element =
|
|
8724
|
+
for (var element = businessObject; element; element = element.$parent) {
|
|
8081
8725
|
if (is$1(element, 'bpmn:SubProcess') || is$1(element, 'bpmn:Process')) {
|
|
8082
8726
|
parents.push(element);
|
|
8083
8727
|
}
|
|
@@ -8086,13 +8730,18 @@
|
|
|
8086
8730
|
return parents.reverse();
|
|
8087
8731
|
}
|
|
8088
8732
|
|
|
8733
|
+
/**
|
|
8734
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
8735
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8736
|
+
*/
|
|
8737
|
+
|
|
8089
8738
|
/**
|
|
8090
8739
|
* Move collapsed subprocesses into view when drilling down.
|
|
8091
8740
|
*
|
|
8092
8741
|
* Zoom and scroll are saved in a session.
|
|
8093
8742
|
*
|
|
8094
|
-
* @param {
|
|
8095
|
-
* @param {
|
|
8743
|
+
* @param {EventBus} eventBus
|
|
8744
|
+
* @param {Canvas} canvas
|
|
8096
8745
|
*/
|
|
8097
8746
|
function DrilldownCentering(eventBus, canvas) {
|
|
8098
8747
|
|
|
@@ -8203,6 +8852,18 @@
|
|
|
8203
8852
|
};
|
|
8204
8853
|
}
|
|
8205
8854
|
|
|
8855
|
+
/**
|
|
8856
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8857
|
+
* @typedef {import('../../model/Types').Moddle} Moddle
|
|
8858
|
+
*
|
|
8859
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
8860
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
8861
|
+
*
|
|
8862
|
+
* @typedef {import('diagram-js/lib/core/Canvas').CanvasPlane} CanvasPlane
|
|
8863
|
+
*
|
|
8864
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
8865
|
+
*/
|
|
8866
|
+
|
|
8206
8867
|
var DEFAULT_POSITION = {
|
|
8207
8868
|
x: 180,
|
|
8208
8869
|
y: 160
|
|
@@ -8210,10 +8871,10 @@
|
|
|
8210
8871
|
|
|
8211
8872
|
/**
|
|
8212
8873
|
* Hook into `import.render.start` and create new planes for diagrams with
|
|
8213
|
-
* collapsed subprocesses and all
|
|
8874
|
+
* collapsed subprocesses and all DI elements on the same plane.
|
|
8214
8875
|
*
|
|
8215
|
-
* @param {
|
|
8216
|
-
* @param {
|
|
8876
|
+
* @param {EventBus} eventBus
|
|
8877
|
+
* @param {Moddle} moddle
|
|
8217
8878
|
*/
|
|
8218
8879
|
function SubprocessCompatibility(eventBus, moddle) {
|
|
8219
8880
|
this._eventBus = eventBus;
|
|
@@ -8222,11 +8883,14 @@
|
|
|
8222
8883
|
var self = this;
|
|
8223
8884
|
|
|
8224
8885
|
eventBus.on('import.render.start', 1500, function(e, context) {
|
|
8225
|
-
self.
|
|
8886
|
+
self._handleImport(context.definitions);
|
|
8226
8887
|
});
|
|
8227
8888
|
}
|
|
8228
8889
|
|
|
8229
|
-
|
|
8890
|
+
/**
|
|
8891
|
+
* @param {ModdleElement} definitions
|
|
8892
|
+
*/
|
|
8893
|
+
SubprocessCompatibility.prototype._handleImport = function(definitions) {
|
|
8230
8894
|
if (!definitions.diagrams) {
|
|
8231
8895
|
return;
|
|
8232
8896
|
}
|
|
@@ -8245,12 +8909,12 @@
|
|
|
8245
8909
|
|
|
8246
8910
|
var newDiagrams = [];
|
|
8247
8911
|
definitions.diagrams.forEach(function(diagram) {
|
|
8248
|
-
var createdDiagrams = self.
|
|
8912
|
+
var createdDiagrams = self._createNewDiagrams(diagram.plane);
|
|
8249
8913
|
Array.prototype.push.apply(newDiagrams, createdDiagrams);
|
|
8250
8914
|
});
|
|
8251
8915
|
|
|
8252
8916
|
newDiagrams.forEach(function(diagram) {
|
|
8253
|
-
self.
|
|
8917
|
+
self._movePlaneElementsToOrigin(diagram.plane);
|
|
8254
8918
|
});
|
|
8255
8919
|
};
|
|
8256
8920
|
|
|
@@ -8258,29 +8922,30 @@
|
|
|
8258
8922
|
/**
|
|
8259
8923
|
* Moves all DI elements from collapsed subprocesses to a new plane.
|
|
8260
8924
|
*
|
|
8261
|
-
* @param {
|
|
8262
|
-
*
|
|
8925
|
+
* @param {CanvasPlane} plane
|
|
8926
|
+
*
|
|
8927
|
+
* @return {ModdleElement[]} new diagrams created for the collapsed subprocesses
|
|
8263
8928
|
*/
|
|
8264
|
-
SubprocessCompatibility.prototype.
|
|
8929
|
+
SubprocessCompatibility.prototype._createNewDiagrams = function(plane) {
|
|
8265
8930
|
var self = this;
|
|
8266
8931
|
|
|
8267
8932
|
var collapsedElements = [];
|
|
8268
8933
|
var elementsToMove = [];
|
|
8269
8934
|
|
|
8270
8935
|
plane.get('planeElement').forEach(function(diElement) {
|
|
8271
|
-
var
|
|
8936
|
+
var businessObject = diElement.bpmnElement;
|
|
8272
8937
|
|
|
8273
|
-
if (!
|
|
8938
|
+
if (!businessObject) {
|
|
8274
8939
|
return;
|
|
8275
8940
|
}
|
|
8276
8941
|
|
|
8277
|
-
var parent =
|
|
8942
|
+
var parent = businessObject.$parent;
|
|
8278
8943
|
|
|
8279
|
-
if (is$1(
|
|
8280
|
-
collapsedElements.push(
|
|
8944
|
+
if (is$1(businessObject, 'bpmn:SubProcess') && !diElement.isExpanded) {
|
|
8945
|
+
collapsedElements.push(businessObject);
|
|
8281
8946
|
}
|
|
8282
8947
|
|
|
8283
|
-
if (shouldMoveToPlane(
|
|
8948
|
+
if (shouldMoveToPlane(businessObject, plane)) {
|
|
8284
8949
|
|
|
8285
8950
|
// don't change the array while we iterate over it
|
|
8286
8951
|
elementsToMove.push({ diElement: diElement, parent: parent });
|
|
@@ -8291,9 +8956,11 @@
|
|
|
8291
8956
|
|
|
8292
8957
|
// create new planes for all collapsed subprocesses, even when they are empty
|
|
8293
8958
|
collapsedElements.forEach(function(element) {
|
|
8294
|
-
if (!self._processToDiagramMap[element.id]) {
|
|
8295
|
-
var diagram = self.
|
|
8959
|
+
if (!self._processToDiagramMap[ element.id ]) {
|
|
8960
|
+
var diagram = self._createDiagram(element);
|
|
8961
|
+
|
|
8296
8962
|
self._processToDiagramMap[element.id] = diagram;
|
|
8963
|
+
|
|
8297
8964
|
newDiagrams.push(diagram);
|
|
8298
8965
|
}
|
|
8299
8966
|
});
|
|
@@ -8312,14 +8979,18 @@
|
|
|
8312
8979
|
return;
|
|
8313
8980
|
}
|
|
8314
8981
|
|
|
8315
|
-
var diagram = self._processToDiagramMap[parent.id];
|
|
8316
|
-
|
|
8982
|
+
var diagram = self._processToDiagramMap[ parent.id ];
|
|
8983
|
+
|
|
8984
|
+
self._moveToDiPlane(diElement, diagram.plane);
|
|
8317
8985
|
});
|
|
8318
8986
|
|
|
8319
8987
|
return newDiagrams;
|
|
8320
8988
|
};
|
|
8321
8989
|
|
|
8322
|
-
|
|
8990
|
+
/**
|
|
8991
|
+
* @param {CanvasPlane} plane
|
|
8992
|
+
*/
|
|
8993
|
+
SubprocessCompatibility.prototype._movePlaneElementsToOrigin = function(plane) {
|
|
8323
8994
|
var elements = plane.get('planeElement');
|
|
8324
8995
|
|
|
8325
8996
|
// get bounding box of all elements
|
|
@@ -8343,33 +9014,50 @@
|
|
|
8343
9014
|
});
|
|
8344
9015
|
};
|
|
8345
9016
|
|
|
8346
|
-
|
|
8347
|
-
|
|
9017
|
+
/**
|
|
9018
|
+
* @param {ModdleElement} diElement
|
|
9019
|
+
* @param {CanvasPlane} newPlane
|
|
9020
|
+
*/
|
|
9021
|
+
SubprocessCompatibility.prototype._moveToDiPlane = function(diElement, newPlane) {
|
|
8348
9022
|
var containingDiagram = findRootDiagram(diElement);
|
|
8349
9023
|
|
|
8350
9024
|
// remove DI from old Plane and add it to the new one
|
|
8351
9025
|
var parentPlaneElement = containingDiagram.plane.get('planeElement');
|
|
9026
|
+
|
|
8352
9027
|
parentPlaneElement.splice(parentPlaneElement.indexOf(diElement), 1);
|
|
9028
|
+
|
|
8353
9029
|
newPlane.get('planeElement').push(diElement);
|
|
8354
9030
|
};
|
|
8355
9031
|
|
|
9032
|
+
/**
|
|
9033
|
+
* @param {ModdleElement} businessObject
|
|
9034
|
+
*
|
|
9035
|
+
* @return {ModdleElement}
|
|
9036
|
+
*/
|
|
9037
|
+
SubprocessCompatibility.prototype._createDiagram = function(businessObject) {
|
|
9038
|
+
var plane = this._moddle.create('bpmndi:BPMNPlane', {
|
|
9039
|
+
bpmnElement: businessObject
|
|
9040
|
+
});
|
|
8356
9041
|
|
|
8357
|
-
SubprocessCompatibility.prototype.createDiagram = function(bo) {
|
|
8358
|
-
var plane = this._moddle.create('bpmndi:BPMNPlane', { bpmnElement: bo });
|
|
8359
9042
|
var diagram = this._moddle.create('bpmndi:BPMNDiagram', {
|
|
8360
9043
|
plane: plane
|
|
8361
9044
|
});
|
|
9045
|
+
|
|
8362
9046
|
plane.$parent = diagram;
|
|
8363
|
-
|
|
9047
|
+
|
|
9048
|
+
plane.bpmnElement = businessObject;
|
|
9049
|
+
|
|
8364
9050
|
diagram.$parent = this._definitions;
|
|
9051
|
+
|
|
8365
9052
|
this._definitions.diagrams.push(diagram);
|
|
9053
|
+
|
|
8366
9054
|
return diagram;
|
|
8367
9055
|
};
|
|
8368
9056
|
|
|
8369
9057
|
SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
|
|
8370
9058
|
|
|
8371
9059
|
|
|
8372
|
-
// helpers
|
|
9060
|
+
// helpers //////////
|
|
8373
9061
|
|
|
8374
9062
|
function findRootDiagram(element) {
|
|
8375
9063
|
if (is$1(element, 'bpmndi:BPMNDiagram')) {
|
|
@@ -8379,6 +9067,11 @@
|
|
|
8379
9067
|
}
|
|
8380
9068
|
}
|
|
8381
9069
|
|
|
9070
|
+
/**
|
|
9071
|
+
* @param {CanvasPlane} plane
|
|
9072
|
+
*
|
|
9073
|
+
* @return {Rect}
|
|
9074
|
+
*/
|
|
8382
9075
|
function getPlaneBounds(plane) {
|
|
8383
9076
|
var planeTrbl = {
|
|
8384
9077
|
top: Infinity,
|
|
@@ -8401,8 +9094,14 @@
|
|
|
8401
9094
|
return asBounds(planeTrbl);
|
|
8402
9095
|
}
|
|
8403
9096
|
|
|
8404
|
-
|
|
8405
|
-
|
|
9097
|
+
/**
|
|
9098
|
+
* @param {ModdleElement} businessObject
|
|
9099
|
+
* @param {CanvasPlane} plane
|
|
9100
|
+
*
|
|
9101
|
+
* @return {boolean}
|
|
9102
|
+
*/
|
|
9103
|
+
function shouldMoveToPlane(businessObject, plane) {
|
|
9104
|
+
var parent = businessObject.$parent;
|
|
8406
9105
|
|
|
8407
9106
|
// don't move elements that are already on the plane
|
|
8408
9107
|
if (!is$1(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
|
|
@@ -8411,18 +9110,35 @@
|
|
|
8411
9110
|
|
|
8412
9111
|
// dataAssociations are children of the subprocess but rendered on process level
|
|
8413
9112
|
// cf. https://github.com/bpmn-io/bpmn-js/issues/1619
|
|
8414
|
-
if (isAny(
|
|
9113
|
+
if (isAny(businessObject, [ 'bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation' ])) {
|
|
8415
9114
|
return false;
|
|
8416
9115
|
}
|
|
8417
9116
|
|
|
8418
9117
|
return true;
|
|
8419
9118
|
}
|
|
8420
9119
|
|
|
9120
|
+
/**
|
|
9121
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
9122
|
+
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
9123
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
9124
|
+
* @typedef {import('diagram-js/lib/features/overlays/Overlays').default} Overlays
|
|
9125
|
+
*
|
|
9126
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
9127
|
+
* @typedef {import('../../model/Types').Parent} Parent
|
|
9128
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
9129
|
+
*/
|
|
9130
|
+
|
|
8421
9131
|
var LOW_PRIORITY = 250;
|
|
8422
9132
|
var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
|
|
8423
9133
|
|
|
8424
9134
|
var EMPTY_MARKER = 'bjs-drilldown-empty';
|
|
8425
9135
|
|
|
9136
|
+
/**
|
|
9137
|
+
* @param {Canvas} canvas
|
|
9138
|
+
* @param {EventBus} eventBus
|
|
9139
|
+
* @param {ElementRegistry} elementRegistry
|
|
9140
|
+
* @param {Overlays} overlays
|
|
9141
|
+
*/
|
|
8426
9142
|
function DrilldownOverlayBehavior(
|
|
8427
9143
|
canvas, eventBus, elementRegistry, overlays
|
|
8428
9144
|
) {
|
|
@@ -8439,10 +9155,10 @@
|
|
|
8439
9155
|
var shape = context.shape;
|
|
8440
9156
|
|
|
8441
9157
|
// Add overlay to the collapsed shape
|
|
8442
|
-
if (self.
|
|
8443
|
-
self.
|
|
9158
|
+
if (self._canDrillDown(shape)) {
|
|
9159
|
+
self._addOverlay(shape);
|
|
8444
9160
|
} else {
|
|
8445
|
-
self.
|
|
9161
|
+
self._removeOverlay(shape);
|
|
8446
9162
|
}
|
|
8447
9163
|
}, true);
|
|
8448
9164
|
|
|
@@ -8451,10 +9167,10 @@
|
|
|
8451
9167
|
var shape = context.shape;
|
|
8452
9168
|
|
|
8453
9169
|
// Add overlay to the collapsed shape
|
|
8454
|
-
if (self.
|
|
8455
|
-
self.
|
|
9170
|
+
if (self._canDrillDown(shape)) {
|
|
9171
|
+
self._addOverlay(shape);
|
|
8456
9172
|
} else {
|
|
8457
|
-
self.
|
|
9173
|
+
self._removeOverlay(shape);
|
|
8458
9174
|
}
|
|
8459
9175
|
}, true);
|
|
8460
9176
|
|
|
@@ -8466,13 +9182,13 @@
|
|
|
8466
9182
|
shape = context.shape;
|
|
8467
9183
|
|
|
8468
9184
|
// Add overlay to the collapsed shape
|
|
8469
|
-
if (self.
|
|
8470
|
-
self.
|
|
9185
|
+
if (self._canDrillDown(shape)) {
|
|
9186
|
+
self._addOverlay(shape);
|
|
8471
9187
|
}
|
|
8472
9188
|
|
|
8473
|
-
self.
|
|
8474
|
-
self.
|
|
8475
|
-
self.
|
|
9189
|
+
self._updateDrilldownOverlay(oldParent);
|
|
9190
|
+
self._updateDrilldownOverlay(newParent);
|
|
9191
|
+
self._updateDrilldownOverlay(shape);
|
|
8476
9192
|
}, true);
|
|
8477
9193
|
|
|
8478
9194
|
|
|
@@ -8483,21 +9199,21 @@
|
|
|
8483
9199
|
shape = context.shape;
|
|
8484
9200
|
|
|
8485
9201
|
// Add overlay to the collapsed shape
|
|
8486
|
-
if (self.
|
|
8487
|
-
self.
|
|
9202
|
+
if (self._canDrillDown(shape)) {
|
|
9203
|
+
self._addOverlay(shape);
|
|
8488
9204
|
}
|
|
8489
9205
|
|
|
8490
|
-
self.
|
|
8491
|
-
self.
|
|
8492
|
-
self.
|
|
9206
|
+
self._updateDrilldownOverlay(oldParent);
|
|
9207
|
+
self._updateDrilldownOverlay(newParent);
|
|
9208
|
+
self._updateDrilldownOverlay(shape);
|
|
8493
9209
|
}, true);
|
|
8494
9210
|
|
|
8495
9211
|
|
|
8496
9212
|
eventBus.on('import.render.complete', function() {
|
|
8497
9213
|
elementRegistry.filter(function(e) {
|
|
8498
|
-
return self.
|
|
9214
|
+
return self._canDrillDown(e);
|
|
8499
9215
|
}).map(function(el) {
|
|
8500
|
-
self.
|
|
9216
|
+
self._addOverlay(el);
|
|
8501
9217
|
});
|
|
8502
9218
|
});
|
|
8503
9219
|
|
|
@@ -8505,7 +9221,10 @@
|
|
|
8505
9221
|
|
|
8506
9222
|
e(DrilldownOverlayBehavior, CommandInterceptor);
|
|
8507
9223
|
|
|
8508
|
-
|
|
9224
|
+
/**
|
|
9225
|
+
* @param {Shape} shape
|
|
9226
|
+
*/
|
|
9227
|
+
DrilldownOverlayBehavior.prototype._updateDrilldownOverlay = function(shape) {
|
|
8509
9228
|
var canvas = this._canvas;
|
|
8510
9229
|
|
|
8511
9230
|
if (!shape) {
|
|
@@ -8513,51 +9232,61 @@
|
|
|
8513
9232
|
}
|
|
8514
9233
|
|
|
8515
9234
|
var root = canvas.findRoot(shape);
|
|
9235
|
+
|
|
8516
9236
|
if (root) {
|
|
8517
|
-
this.
|
|
9237
|
+
this._updateOverlayVisibility(root);
|
|
8518
9238
|
}
|
|
8519
9239
|
};
|
|
8520
9240
|
|
|
8521
|
-
|
|
8522
|
-
|
|
9241
|
+
/**
|
|
9242
|
+
* @param {Element} element
|
|
9243
|
+
*
|
|
9244
|
+
* @return {boolean}
|
|
9245
|
+
*/
|
|
9246
|
+
DrilldownOverlayBehavior.prototype._canDrillDown = function(element) {
|
|
8523
9247
|
var canvas = this._canvas;
|
|
9248
|
+
|
|
8524
9249
|
return is$1(element, 'bpmn:SubProcess') && canvas.findRoot(getPlaneIdFromShape(element));
|
|
8525
9250
|
};
|
|
8526
9251
|
|
|
8527
9252
|
/**
|
|
8528
|
-
*
|
|
8529
|
-
* the drilldown will be
|
|
9253
|
+
* Update the visibility of the drilldown overlay. If the plane has no elements,
|
|
9254
|
+
* the drilldown will only be shown when the element is selected.
|
|
8530
9255
|
*
|
|
8531
|
-
* @param {
|
|
9256
|
+
* @param {Parent} element The collapsed root or shape.
|
|
8532
9257
|
*/
|
|
8533
|
-
DrilldownOverlayBehavior.prototype.
|
|
9258
|
+
DrilldownOverlayBehavior.prototype._updateOverlayVisibility = function(element) {
|
|
8534
9259
|
var overlays = this._overlays;
|
|
8535
9260
|
|
|
8536
|
-
var
|
|
9261
|
+
var businessObject = getBusinessObject(element);
|
|
8537
9262
|
|
|
8538
|
-
var overlay = overlays.get({ element:
|
|
9263
|
+
var overlay = overlays.get({ element: businessObject.id, type: 'drilldown' })[0];
|
|
8539
9264
|
|
|
8540
9265
|
if (!overlay) {
|
|
8541
9266
|
return;
|
|
8542
9267
|
}
|
|
8543
9268
|
|
|
8544
|
-
var
|
|
8545
|
-
|
|
9269
|
+
var hasFlowElements = businessObject
|
|
9270
|
+
&& businessObject.get('flowElements')
|
|
9271
|
+
&& businessObject.get('flowElements').length;
|
|
9272
|
+
|
|
9273
|
+
classes(overlay.html).toggle(EMPTY_MARKER, !hasFlowElements);
|
|
8546
9274
|
};
|
|
8547
9275
|
|
|
8548
9276
|
/**
|
|
8549
|
-
*
|
|
8550
|
-
*
|
|
9277
|
+
* Add a drilldown button to the given element assuming the plane has the same
|
|
9278
|
+
* ID as the element.
|
|
8551
9279
|
*
|
|
8552
|
-
* @param {
|
|
9280
|
+
* @param {Shape} element The collapsed shape.
|
|
8553
9281
|
*/
|
|
8554
|
-
DrilldownOverlayBehavior.prototype.
|
|
8555
|
-
var canvas = this._canvas
|
|
8556
|
-
|
|
9282
|
+
DrilldownOverlayBehavior.prototype._addOverlay = function(element) {
|
|
9283
|
+
var canvas = this._canvas,
|
|
9284
|
+
overlays = this._overlays;
|
|
8557
9285
|
|
|
8558
9286
|
var existingOverlays = overlays.get({ element: element, type: 'drilldown' });
|
|
9287
|
+
|
|
8559
9288
|
if (existingOverlays.length) {
|
|
8560
|
-
this.
|
|
9289
|
+
this._removeOverlay(element);
|
|
8561
9290
|
}
|
|
8562
9291
|
|
|
8563
9292
|
var button = domify$1('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
|
|
@@ -8574,10 +9303,10 @@
|
|
|
8574
9303
|
html: button
|
|
8575
9304
|
});
|
|
8576
9305
|
|
|
8577
|
-
this.
|
|
9306
|
+
this._updateOverlayVisibility(element);
|
|
8578
9307
|
};
|
|
8579
9308
|
|
|
8580
|
-
DrilldownOverlayBehavior.prototype.
|
|
9309
|
+
DrilldownOverlayBehavior.prototype._removeOverlay = function(element) {
|
|
8581
9310
|
var overlays = this._overlays;
|
|
8582
9311
|
|
|
8583
9312
|
overlays.remove({
|
|
@@ -9083,7 +9812,6 @@
|
|
|
9083
9812
|
*/
|
|
9084
9813
|
function DefaultRenderer(eventBus, styles) {
|
|
9085
9814
|
|
|
9086
|
-
//
|
|
9087
9815
|
BaseRenderer.call(this, eventBus, DEFAULT_RENDER_PRIORITY);
|
|
9088
9816
|
|
|
9089
9817
|
this.CONNECTION_STYLE = styles.style([ 'no-fill' ], { strokeWidth: 5, stroke: 'fuchsia' });
|
|
@@ -9094,10 +9822,16 @@
|
|
|
9094
9822
|
e(DefaultRenderer, BaseRenderer);
|
|
9095
9823
|
|
|
9096
9824
|
|
|
9825
|
+
/**
|
|
9826
|
+
* @private
|
|
9827
|
+
*/
|
|
9097
9828
|
DefaultRenderer.prototype.canRender = function() {
|
|
9098
9829
|
return true;
|
|
9099
9830
|
};
|
|
9100
9831
|
|
|
9832
|
+
/**
|
|
9833
|
+
* @private
|
|
9834
|
+
*/
|
|
9101
9835
|
DefaultRenderer.prototype.drawShape = function drawShape(visuals, element, attrs) {
|
|
9102
9836
|
var rect = create$1('rect');
|
|
9103
9837
|
|
|
@@ -9119,6 +9853,9 @@
|
|
|
9119
9853
|
return rect;
|
|
9120
9854
|
};
|
|
9121
9855
|
|
|
9856
|
+
/**
|
|
9857
|
+
* @private
|
|
9858
|
+
*/
|
|
9122
9859
|
DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
|
|
9123
9860
|
|
|
9124
9861
|
var line = createLine(connection.waypoints, assign$1({}, this.CONNECTION_STYLE, attrs || {}));
|
|
@@ -9127,6 +9864,9 @@
|
|
|
9127
9864
|
return line;
|
|
9128
9865
|
};
|
|
9129
9866
|
|
|
9867
|
+
/**
|
|
9868
|
+
* @private
|
|
9869
|
+
*/
|
|
9130
9870
|
DefaultRenderer.prototype.getShapePath = function getShapePath(shape) {
|
|
9131
9871
|
|
|
9132
9872
|
var x = shape.x,
|
|
@@ -9145,6 +9885,9 @@
|
|
|
9145
9885
|
return componentsToPath(shapePath);
|
|
9146
9886
|
};
|
|
9147
9887
|
|
|
9888
|
+
/**
|
|
9889
|
+
* @private
|
|
9890
|
+
*/
|
|
9148
9891
|
DefaultRenderer.prototype.getConnectionPath = function getConnectionPath(connection) {
|
|
9149
9892
|
var waypoints = connection.waypoints;
|
|
9150
9893
|
|
|
@@ -9162,7 +9905,6 @@
|
|
|
9162
9905
|
return componentsToPath(connectionPath);
|
|
9163
9906
|
};
|
|
9164
9907
|
|
|
9165
|
-
|
|
9166
9908
|
DefaultRenderer.$inject = [ 'eventBus', 'styles' ];
|
|
9167
9909
|
|
|
9168
9910
|
/**
|
|
@@ -9186,13 +9928,14 @@
|
|
|
9186
9928
|
var self = this;
|
|
9187
9929
|
|
|
9188
9930
|
/**
|
|
9189
|
-
* Builds a style definition from a className, a list of traits and an object
|
|
9931
|
+
* Builds a style definition from a className, a list of traits and an object
|
|
9932
|
+
* of additional attributes.
|
|
9190
9933
|
*
|
|
9191
9934
|
* @param {string} className
|
|
9192
|
-
* @param {
|
|
9193
|
-
* @param {Object} additionalAttrs
|
|
9935
|
+
* @param {string[]} [traits]
|
|
9936
|
+
* @param {Object} [additionalAttrs]
|
|
9194
9937
|
*
|
|
9195
|
-
* @return {Object} the style
|
|
9938
|
+
* @return {Object} the style definition
|
|
9196
9939
|
*/
|
|
9197
9940
|
this.cls = function(className, traits, additionalAttrs) {
|
|
9198
9941
|
var attrs = this.style(traits, additionalAttrs);
|
|
@@ -9201,12 +9944,13 @@
|
|
|
9201
9944
|
};
|
|
9202
9945
|
|
|
9203
9946
|
/**
|
|
9204
|
-
* Builds a style definition from a list of traits and an object of additional
|
|
9947
|
+
* Builds a style definition from a list of traits and an object of additional
|
|
9948
|
+
* attributes.
|
|
9205
9949
|
*
|
|
9206
|
-
* @param {
|
|
9950
|
+
* @param {string[]} [traits]
|
|
9207
9951
|
* @param {Object} additionalAttrs
|
|
9208
9952
|
*
|
|
9209
|
-
* @return {Object} the style
|
|
9953
|
+
* @return {Object} the style definition
|
|
9210
9954
|
*/
|
|
9211
9955
|
this.style = function(traits, additionalAttrs) {
|
|
9212
9956
|
|
|
@@ -9222,6 +9966,17 @@
|
|
|
9222
9966
|
return additionalAttrs ? assign$1(attrs, additionalAttrs) : attrs;
|
|
9223
9967
|
};
|
|
9224
9968
|
|
|
9969
|
+
|
|
9970
|
+
/**
|
|
9971
|
+
* Computes a style definition from a list of traits and an object of
|
|
9972
|
+
* additional attributes, with custom style definition object.
|
|
9973
|
+
*
|
|
9974
|
+
* @param {Object} custom
|
|
9975
|
+
* @param {string[]} [traits]
|
|
9976
|
+
* @param {Object} defaultStyles
|
|
9977
|
+
*
|
|
9978
|
+
* @return {Object} the style definition
|
|
9979
|
+
*/
|
|
9225
9980
|
this.computeStyle = function(custom, traits, defaultStyles) {
|
|
9226
9981
|
if (!isArray$2(traits)) {
|
|
9227
9982
|
defaultStyles = traits;
|
|
@@ -9232,6 +9987,9 @@
|
|
|
9232
9987
|
};
|
|
9233
9988
|
}
|
|
9234
9989
|
|
|
9990
|
+
/**
|
|
9991
|
+
* @type { import('didi').ModuleDeclaration }
|
|
9992
|
+
*/
|
|
9235
9993
|
var DrawModule = {
|
|
9236
9994
|
__init__: [ 'defaultRenderer' ],
|
|
9237
9995
|
defaultRenderer: [ 'type', DefaultRenderer ],
|
|
@@ -9267,7 +10025,7 @@
|
|
|
9267
10025
|
*
|
|
9268
10026
|
* @param {Array<Object>} collection
|
|
9269
10027
|
* @param {Object} element
|
|
9270
|
-
* @param {number} idx
|
|
10028
|
+
* @param {number} [idx]
|
|
9271
10029
|
*/
|
|
9272
10030
|
function add(collection, element, idx) {
|
|
9273
10031
|
|
|
@@ -9313,15 +10071,34 @@
|
|
|
9313
10071
|
}
|
|
9314
10072
|
|
|
9315
10073
|
/**
|
|
9316
|
-
* @typedef {import('
|
|
9317
|
-
* @typedef {import('
|
|
9318
|
-
* @typedef {import('
|
|
9319
|
-
*
|
|
9320
|
-
*
|
|
9321
|
-
* @typedef {
|
|
9322
|
-
*
|
|
9323
|
-
*
|
|
9324
|
-
*
|
|
10074
|
+
* @typedef {import('./Types').ConnectionLike} ConnectionLike
|
|
10075
|
+
* @typedef {import('./Types').RootLike} RootLike
|
|
10076
|
+
* @typedef {import('./Types').ParentLike } ParentLike
|
|
10077
|
+
* @typedef {import('./Types').ShapeLike} ShapeLike
|
|
10078
|
+
*
|
|
10079
|
+
* @typedef { {
|
|
10080
|
+
* container?: HTMLElement;
|
|
10081
|
+
* deferUpdate?: boolean;
|
|
10082
|
+
* width?: number;
|
|
10083
|
+
* height?: number;
|
|
10084
|
+
* } } CanvasConfig
|
|
10085
|
+
* @typedef { {
|
|
10086
|
+
* group: SVGElement;
|
|
10087
|
+
* index: number;
|
|
10088
|
+
* visible: boolean;
|
|
10089
|
+
* } } CanvasLayer
|
|
10090
|
+
* @typedef { {
|
|
10091
|
+
* [key: string]: CanvasLayer;
|
|
10092
|
+
* } } CanvasLayers
|
|
10093
|
+
* @typedef { {
|
|
10094
|
+
* rootElement: ShapeLike;
|
|
10095
|
+
* layer: CanvasLayer;
|
|
10096
|
+
* } } CanvasPlane
|
|
10097
|
+
* @typedef { {
|
|
10098
|
+
* scale: number;
|
|
10099
|
+
* inner: Rect;
|
|
10100
|
+
* outer: Dimensions;
|
|
10101
|
+
* } & Rect } CanvasViewbox
|
|
9325
10102
|
*
|
|
9326
10103
|
* @typedef {import('./ElementRegistry').default} ElementRegistry
|
|
9327
10104
|
* @typedef {import('./EventBus').default} EventBus
|
|
@@ -9662,7 +10439,7 @@
|
|
|
9662
10439
|
/**
|
|
9663
10440
|
* Shows a given layer.
|
|
9664
10441
|
*
|
|
9665
|
-
* @param {string}
|
|
10442
|
+
* @param {string} name The name of the layer.
|
|
9666
10443
|
*
|
|
9667
10444
|
* @return {SVGElement} The SVG element of the layer.
|
|
9668
10445
|
*/
|
|
@@ -9698,7 +10475,7 @@
|
|
|
9698
10475
|
/**
|
|
9699
10476
|
* Hides a given layer.
|
|
9700
10477
|
*
|
|
9701
|
-
* @param {string}
|
|
10478
|
+
* @param {string} name The name of the layer.
|
|
9702
10479
|
*
|
|
9703
10480
|
* @return {SVGElement} The SVG element of the layer.
|
|
9704
10481
|
*/
|
|
@@ -9840,7 +10617,7 @@
|
|
|
9840
10617
|
*
|
|
9841
10618
|
* @event element.marker.update
|
|
9842
10619
|
* @type {Object}
|
|
9843
|
-
* @property {
|
|
10620
|
+
* @property {Element} element the shape
|
|
9844
10621
|
* @property {SVGElement} gfx the graphical representation of the shape
|
|
9845
10622
|
* @property {string} marker
|
|
9846
10623
|
* @property {boolean} add true if the marker was added, false if it got removed
|
|
@@ -9857,11 +10634,13 @@
|
|
|
9857
10634
|
*
|
|
9858
10635
|
* @example
|
|
9859
10636
|
*
|
|
10637
|
+
* ```javascript
|
|
9860
10638
|
* canvas.addMarker('foo', 'some-marker');
|
|
9861
10639
|
*
|
|
9862
10640
|
* const fooGfx = canvas.getGraphics('foo');
|
|
9863
10641
|
*
|
|
9864
10642
|
* fooGfx; // <g class="... some-marker"> ... </g>
|
|
10643
|
+
* ```
|
|
9865
10644
|
*
|
|
9866
10645
|
* @param {ShapeLike|ConnectionLike|string} element The element or its ID.
|
|
9867
10646
|
* @param {string} marker The marker.
|
|
@@ -9946,7 +10725,7 @@
|
|
|
9946
10725
|
/**
|
|
9947
10726
|
* Adds a given root element and returns it.
|
|
9948
10727
|
*
|
|
9949
|
-
* @param {
|
|
10728
|
+
* @param {RootLike} [rootElement] The root element to be added.
|
|
9950
10729
|
*
|
|
9951
10730
|
* @return {RootLike} The added root element or an implicit root element.
|
|
9952
10731
|
*/
|
|
@@ -9982,9 +10761,9 @@
|
|
|
9982
10761
|
/**
|
|
9983
10762
|
* Removes a given root element and returns it.
|
|
9984
10763
|
*
|
|
9985
|
-
* @param {
|
|
10764
|
+
* @param {RootLike|string} rootElement element or element ID
|
|
9986
10765
|
*
|
|
9987
|
-
* @return {
|
|
10766
|
+
* @return {RootLike|undefined} removed element
|
|
9988
10767
|
*/
|
|
9989
10768
|
Canvas.prototype.removeRootElement = function(rootElement) {
|
|
9990
10769
|
|
|
@@ -10026,11 +10805,7 @@
|
|
|
10026
10805
|
*
|
|
10027
10806
|
* @return {RootLike} The set root element.
|
|
10028
10807
|
*/
|
|
10029
|
-
Canvas.prototype.setRootElement = function(rootElement
|
|
10030
|
-
|
|
10031
|
-
if (isDefined(override)) {
|
|
10032
|
-
throw new Error('override not supported');
|
|
10033
|
-
}
|
|
10808
|
+
Canvas.prototype.setRootElement = function(rootElement) {
|
|
10034
10809
|
|
|
10035
10810
|
if (rootElement === this._rootElement) {
|
|
10036
10811
|
return;
|
|
@@ -10187,7 +10962,7 @@
|
|
|
10187
10962
|
* Adds a shape to the canvas.
|
|
10188
10963
|
*
|
|
10189
10964
|
* @param {ShapeLike} shape The shape to be added
|
|
10190
|
-
* @param {
|
|
10965
|
+
* @param {ParentLike} [parent] The shape's parent.
|
|
10191
10966
|
* @param {number} [parentIndex] The index at which to add the shape to the parent's children.
|
|
10192
10967
|
*
|
|
10193
10968
|
* @return {ShapeLike} The added shape.
|
|
@@ -10200,7 +10975,7 @@
|
|
|
10200
10975
|
* Adds a connection to the canvas.
|
|
10201
10976
|
*
|
|
10202
10977
|
* @param {ConnectionLike} connection The connection to be added.
|
|
10203
|
-
* @param {
|
|
10978
|
+
* @param {ParentLike} [parent] The connection's parent.
|
|
10204
10979
|
* @param {number} [parentIndex] The index at which to add the connection to the parent's children.
|
|
10205
10980
|
*
|
|
10206
10981
|
* @return {ConnectionLike} The added connection.
|
|
@@ -10271,7 +11046,7 @@
|
|
|
10271
11046
|
*
|
|
10272
11047
|
* @memberOf Canvas
|
|
10273
11048
|
*
|
|
10274
|
-
* @event
|
|
11049
|
+
* @event ShapeRemovedEvent
|
|
10275
11050
|
* @type {Object}
|
|
10276
11051
|
* @property {ShapeLike} element The shape.
|
|
10277
11052
|
* @property {SVGElement} gfx The graphical element.
|
|
@@ -10308,7 +11083,7 @@
|
|
|
10308
11083
|
*
|
|
10309
11084
|
* @memberOf Canvas
|
|
10310
11085
|
*
|
|
10311
|
-
* @event
|
|
11086
|
+
* @event ConnectionRemovedEvent
|
|
10312
11087
|
* @type {Object}
|
|
10313
11088
|
* @property {ConnectionLike} element The connection.
|
|
10314
11089
|
* @property {SVGElement} gfx The graphical element.
|
|
@@ -10367,6 +11142,7 @@
|
|
|
10367
11142
|
*
|
|
10368
11143
|
* @example
|
|
10369
11144
|
*
|
|
11145
|
+
* ```javascript
|
|
10370
11146
|
* canvas.viewbox({ x: 100, y: 100, width: 500, height: 500 })
|
|
10371
11147
|
*
|
|
10372
11148
|
* // sets the visible area of the diagram to (100|100) -> (600|100)
|
|
@@ -10394,6 +11170,7 @@
|
|
|
10394
11170
|
* width: zoomedAndScrolledViewbox.outer.width,
|
|
10395
11171
|
* height: zoomedAndScrolledViewbox.outer.height
|
|
10396
11172
|
* });
|
|
11173
|
+
* ```
|
|
10397
11174
|
*
|
|
10398
11175
|
* @param {Rect} [box] The viewbox to be set.
|
|
10399
11176
|
*
|
|
@@ -10567,7 +11344,7 @@
|
|
|
10567
11344
|
* The getter may return a cached zoom level. Call it with `false` as the first
|
|
10568
11345
|
* argument to force recomputation of the current level.
|
|
10569
11346
|
*
|
|
10570
|
-
* @param {number|
|
|
11347
|
+
* @param {number|'fit-viewport'} [newScale] The new zoom level, either a number,
|
|
10571
11348
|
* i.e. 0.9, or `fit-viewport` to adjust the size to fit the current viewport.
|
|
10572
11349
|
* @param {Point} [center] The reference point { x: ..., y: ...} to zoom to.
|
|
10573
11350
|
*
|
|
@@ -10762,11 +11539,12 @@
|
|
|
10762
11539
|
var ELEMENT_ID = 'data-element-id';
|
|
10763
11540
|
|
|
10764
11541
|
/**
|
|
10765
|
-
* @typedef {import('
|
|
11542
|
+
* @typedef {import('./Types').ElementLike} ElementLike
|
|
10766
11543
|
*
|
|
10767
11544
|
* @typedef {import('./EventBus').default} EventBus
|
|
10768
11545
|
*
|
|
10769
|
-
* @typedef {
|
|
11546
|
+
* @typedef { (element: ElementLike, gfx: SVGElement) => boolean|any } ElementRegistryFilterCallback
|
|
11547
|
+
* @typedef { (element: ElementLike, gfx: SVGElement) => any } ElementRegistryForEachCallback
|
|
10770
11548
|
*/
|
|
10771
11549
|
|
|
10772
11550
|
/**
|
|
@@ -10778,6 +11556,16 @@
|
|
|
10778
11556
|
* @param {EventBus} eventBus
|
|
10779
11557
|
*/
|
|
10780
11558
|
function ElementRegistry(eventBus) {
|
|
11559
|
+
|
|
11560
|
+
/**
|
|
11561
|
+
* @type { {
|
|
11562
|
+
* [id: string]: {
|
|
11563
|
+
* element: ElementLike;
|
|
11564
|
+
* gfx?: SVGElement;
|
|
11565
|
+
* secondaryGfx?: SVGElement;
|
|
11566
|
+
* }
|
|
11567
|
+
* } }
|
|
11568
|
+
*/
|
|
10781
11569
|
this._elements = {};
|
|
10782
11570
|
|
|
10783
11571
|
this._eventBus = eventBus;
|
|
@@ -10863,7 +11651,7 @@
|
|
|
10863
11651
|
/**
|
|
10864
11652
|
* Update the graphical representation of an element.
|
|
10865
11653
|
*
|
|
10866
|
-
* @param {ElementLike|string}
|
|
11654
|
+
* @param {ElementLike|string} filter The element or its ID.
|
|
10867
11655
|
* @param {SVGElement} gfx The new graphical representation.
|
|
10868
11656
|
* @param {boolean} [secondary=false] Whether to update the secondary graphical representation.
|
|
10869
11657
|
*/
|
|
@@ -10890,9 +11678,11 @@
|
|
|
10890
11678
|
*
|
|
10891
11679
|
* @example
|
|
10892
11680
|
*
|
|
11681
|
+
* ```javascript
|
|
10893
11682
|
* elementRegistry.get('SomeElementId_1');
|
|
10894
11683
|
*
|
|
10895
11684
|
* elementRegistry.get(gfx);
|
|
11685
|
+
* ```
|
|
10896
11686
|
*
|
|
10897
11687
|
* @param {string|SVGElement} filter The elements ID or graphical representation.
|
|
10898
11688
|
*
|
|
@@ -10914,7 +11704,7 @@
|
|
|
10914
11704
|
/**
|
|
10915
11705
|
* Return all elements that match a given filter function.
|
|
10916
11706
|
*
|
|
10917
|
-
* @param {
|
|
11707
|
+
* @param {ElementRegistryFilterCallback} fn The filter function.
|
|
10918
11708
|
*
|
|
10919
11709
|
* @return {ElementLike[]} The matching elements.
|
|
10920
11710
|
*/
|
|
@@ -10934,7 +11724,7 @@
|
|
|
10934
11724
|
/**
|
|
10935
11725
|
* Return the first element that matches the given filter function.
|
|
10936
11726
|
*
|
|
10937
|
-
* @param {
|
|
11727
|
+
* @param {ElementRegistryFilterCallback} fn The filter function.
|
|
10938
11728
|
*
|
|
10939
11729
|
* @return {ElementLike|undefined} The matching element.
|
|
10940
11730
|
*/
|
|
@@ -10966,7 +11756,7 @@
|
|
|
10966
11756
|
/**
|
|
10967
11757
|
* Execute a given function for each element.
|
|
10968
11758
|
*
|
|
10969
|
-
* @param {
|
|
11759
|
+
* @param {ElementRegistryForEachCallback} fn The function to execute.
|
|
10970
11760
|
*/
|
|
10971
11761
|
ElementRegistry.prototype.forEach = function(fn) {
|
|
10972
11762
|
|
|
@@ -10986,11 +11776,13 @@
|
|
|
10986
11776
|
*
|
|
10987
11777
|
* @example
|
|
10988
11778
|
*
|
|
11779
|
+
* ```javascript
|
|
10989
11780
|
* elementRegistry.getGraphics('SomeElementId_1');
|
|
10990
11781
|
*
|
|
10991
11782
|
* elementRegistry.getGraphics(rootElement); // <g ...>
|
|
10992
11783
|
*
|
|
10993
11784
|
* elementRegistry.getGraphics(rootElement, true); // <svg ...>
|
|
11785
|
+
* ```
|
|
10994
11786
|
*
|
|
10995
11787
|
* @param {ElementLike|string} filter The element or its ID.
|
|
10996
11788
|
* @param {boolean} [secondary=false] Whether to return the secondary graphical representation.
|
|
@@ -11353,19 +12145,26 @@
|
|
|
11353
12145
|
outgoingRefs = new Refs({ name: 'outgoing', collection: true }, { name: 'source' }),
|
|
11354
12146
|
incomingRefs = new Refs({ name: 'incoming', collection: true }, { name: 'target' });
|
|
11355
12147
|
|
|
12148
|
+
/**
|
|
12149
|
+
* @typedef {import('./Types').Element} Element
|
|
12150
|
+
* @typedef {import('./Types').Shape} Shape
|
|
12151
|
+
* @typedef {import('./Types').Root} Root
|
|
12152
|
+
* @typedef {import('./Types').Label} Label
|
|
12153
|
+
* @typedef {import('./Types').Connection} Connection
|
|
12154
|
+
*/
|
|
12155
|
+
|
|
11356
12156
|
/**
|
|
11357
12157
|
* The basic graphical representation
|
|
11358
12158
|
*
|
|
11359
12159
|
* @class
|
|
11360
|
-
*
|
|
11361
|
-
* @abstract
|
|
12160
|
+
* @constructor
|
|
11362
12161
|
*/
|
|
11363
|
-
function
|
|
12162
|
+
function ElementImpl() {
|
|
11364
12163
|
|
|
11365
12164
|
/**
|
|
11366
12165
|
* The object that backs up the shape
|
|
11367
12166
|
*
|
|
11368
|
-
* @name
|
|
12167
|
+
* @name Element#businessObject
|
|
11369
12168
|
* @type Object
|
|
11370
12169
|
*/
|
|
11371
12170
|
Object.defineProperty(this, 'businessObject', {
|
|
@@ -11376,7 +12175,7 @@
|
|
|
11376
12175
|
/**
|
|
11377
12176
|
* Single label support, will mapped to multi label array
|
|
11378
12177
|
*
|
|
11379
|
-
* @name
|
|
12178
|
+
* @name Element#label
|
|
11380
12179
|
* @type Object
|
|
11381
12180
|
*/
|
|
11382
12181
|
Object.defineProperty(this, 'label', {
|
|
@@ -11399,7 +12198,7 @@
|
|
|
11399
12198
|
/**
|
|
11400
12199
|
* The parent shape
|
|
11401
12200
|
*
|
|
11402
|
-
* @name
|
|
12201
|
+
* @name Element#parent
|
|
11403
12202
|
* @type Shape
|
|
11404
12203
|
*/
|
|
11405
12204
|
parentRefs.bind(this, 'parent');
|
|
@@ -11407,7 +12206,7 @@
|
|
|
11407
12206
|
/**
|
|
11408
12207
|
* The list of labels
|
|
11409
12208
|
*
|
|
11410
|
-
* @name
|
|
12209
|
+
* @name Element#labels
|
|
11411
12210
|
* @type Label
|
|
11412
12211
|
*/
|
|
11413
12212
|
labelRefs.bind(this, 'labels');
|
|
@@ -11415,7 +12214,7 @@
|
|
|
11415
12214
|
/**
|
|
11416
12215
|
* The list of outgoing connections
|
|
11417
12216
|
*
|
|
11418
|
-
* @name
|
|
12217
|
+
* @name Element#outgoing
|
|
11419
12218
|
* @type Array<Connection>
|
|
11420
12219
|
*/
|
|
11421
12220
|
outgoingRefs.bind(this, 'outgoing');
|
|
@@ -11423,7 +12222,7 @@
|
|
|
11423
12222
|
/**
|
|
11424
12223
|
* The list of incoming connections
|
|
11425
12224
|
*
|
|
11426
|
-
* @name
|
|
12225
|
+
* @name Element#incoming
|
|
11427
12226
|
* @type Array<Connection>
|
|
11428
12227
|
*/
|
|
11429
12228
|
incomingRefs.bind(this, 'incoming');
|
|
@@ -11436,40 +12235,40 @@
|
|
|
11436
12235
|
* @class
|
|
11437
12236
|
* @constructor
|
|
11438
12237
|
*
|
|
11439
|
-
* @extends
|
|
12238
|
+
* @extends ElementImpl
|
|
11440
12239
|
*/
|
|
11441
|
-
function
|
|
11442
|
-
|
|
12240
|
+
function ShapeImpl() {
|
|
12241
|
+
ElementImpl.call(this);
|
|
11443
12242
|
|
|
11444
12243
|
/**
|
|
11445
12244
|
* Indicates frame shapes
|
|
11446
12245
|
*
|
|
11447
|
-
* @name
|
|
12246
|
+
* @name ShapeImpl#isFrame
|
|
11448
12247
|
* @type boolean
|
|
11449
12248
|
*/
|
|
11450
12249
|
|
|
11451
12250
|
/**
|
|
11452
12251
|
* The list of children
|
|
11453
12252
|
*
|
|
11454
|
-
* @name
|
|
11455
|
-
* @type
|
|
12253
|
+
* @name ShapeImpl#children
|
|
12254
|
+
* @type Element[]
|
|
11456
12255
|
*/
|
|
11457
12256
|
parentRefs.bind(this, 'children');
|
|
11458
12257
|
|
|
11459
12258
|
/**
|
|
11460
|
-
* @name
|
|
12259
|
+
* @name ShapeImpl#host
|
|
11461
12260
|
* @type Shape
|
|
11462
12261
|
*/
|
|
11463
12262
|
attacherRefs.bind(this, 'host');
|
|
11464
12263
|
|
|
11465
12264
|
/**
|
|
11466
|
-
* @name
|
|
12265
|
+
* @name ShapeImpl#attachers
|
|
11467
12266
|
* @type Shape
|
|
11468
12267
|
*/
|
|
11469
12268
|
attacherRefs.bind(this, 'attachers');
|
|
11470
12269
|
}
|
|
11471
12270
|
|
|
11472
|
-
e(
|
|
12271
|
+
e(ShapeImpl, ElementImpl);
|
|
11473
12272
|
|
|
11474
12273
|
|
|
11475
12274
|
/**
|
|
@@ -11478,13 +12277,21 @@
|
|
|
11478
12277
|
* @class
|
|
11479
12278
|
* @constructor
|
|
11480
12279
|
*
|
|
11481
|
-
* @extends
|
|
12280
|
+
* @extends ElementImpl
|
|
11482
12281
|
*/
|
|
11483
|
-
function
|
|
11484
|
-
|
|
12282
|
+
function RootImpl() {
|
|
12283
|
+
ElementImpl.call(this);
|
|
12284
|
+
|
|
12285
|
+
/**
|
|
12286
|
+
* The list of children
|
|
12287
|
+
*
|
|
12288
|
+
* @name RootImpl#children
|
|
12289
|
+
* @type Element[]
|
|
12290
|
+
*/
|
|
12291
|
+
parentRefs.bind(this, 'children');
|
|
11485
12292
|
}
|
|
11486
12293
|
|
|
11487
|
-
e(
|
|
12294
|
+
e(RootImpl, ShapeImpl);
|
|
11488
12295
|
|
|
11489
12296
|
|
|
11490
12297
|
/**
|
|
@@ -11493,21 +12300,21 @@
|
|
|
11493
12300
|
* @class
|
|
11494
12301
|
* @constructor
|
|
11495
12302
|
*
|
|
11496
|
-
* @extends
|
|
12303
|
+
* @extends ShapeImpl
|
|
11497
12304
|
*/
|
|
11498
|
-
function
|
|
11499
|
-
|
|
12305
|
+
function LabelImpl() {
|
|
12306
|
+
ShapeImpl.call(this);
|
|
11500
12307
|
|
|
11501
12308
|
/**
|
|
11502
12309
|
* The labeled element
|
|
11503
12310
|
*
|
|
11504
|
-
* @name
|
|
11505
|
-
* @type
|
|
12311
|
+
* @name LabelImpl#labelTarget
|
|
12312
|
+
* @type Element
|
|
11506
12313
|
*/
|
|
11507
12314
|
labelRefs.bind(this, 'labelTarget');
|
|
11508
12315
|
}
|
|
11509
12316
|
|
|
11510
|
-
e(
|
|
12317
|
+
e(LabelImpl, ShapeImpl);
|
|
11511
12318
|
|
|
11512
12319
|
|
|
11513
12320
|
/**
|
|
@@ -11516,45 +12323,69 @@
|
|
|
11516
12323
|
* @class
|
|
11517
12324
|
* @constructor
|
|
11518
12325
|
*
|
|
11519
|
-
* @extends
|
|
12326
|
+
* @extends ElementImpl
|
|
11520
12327
|
*/
|
|
11521
|
-
function
|
|
11522
|
-
|
|
12328
|
+
function ConnectionImpl() {
|
|
12329
|
+
ElementImpl.call(this);
|
|
11523
12330
|
|
|
11524
12331
|
/**
|
|
11525
12332
|
* The element this connection originates from
|
|
11526
12333
|
*
|
|
11527
|
-
* @name
|
|
11528
|
-
* @type
|
|
12334
|
+
* @name ConnectionImpl#source
|
|
12335
|
+
* @type Element
|
|
11529
12336
|
*/
|
|
11530
12337
|
outgoingRefs.bind(this, 'source');
|
|
11531
12338
|
|
|
11532
12339
|
/**
|
|
11533
12340
|
* The element this connection points to
|
|
11534
12341
|
*
|
|
11535
|
-
* @name
|
|
11536
|
-
* @type
|
|
12342
|
+
* @name ConnectionImpl#target
|
|
12343
|
+
* @type Element
|
|
11537
12344
|
*/
|
|
11538
12345
|
incomingRefs.bind(this, 'target');
|
|
11539
12346
|
}
|
|
11540
12347
|
|
|
11541
|
-
e(
|
|
12348
|
+
e(ConnectionImpl, ElementImpl);
|
|
11542
12349
|
|
|
11543
12350
|
|
|
11544
12351
|
var types$7 = {
|
|
11545
|
-
connection:
|
|
11546
|
-
shape:
|
|
11547
|
-
label:
|
|
11548
|
-
root:
|
|
12352
|
+
connection: ConnectionImpl,
|
|
12353
|
+
shape: ShapeImpl,
|
|
12354
|
+
label: LabelImpl,
|
|
12355
|
+
root: RootImpl
|
|
11549
12356
|
};
|
|
11550
12357
|
|
|
11551
12358
|
/**
|
|
11552
|
-
* Creates a
|
|
12359
|
+
* Creates a root element.
|
|
12360
|
+
*
|
|
12361
|
+
* @overlord
|
|
12362
|
+
*
|
|
12363
|
+
* @example
|
|
12364
|
+
*
|
|
12365
|
+
* ```javascript
|
|
12366
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12367
|
+
*
|
|
12368
|
+
* const root = Model.create('root', {
|
|
12369
|
+
* x: 100,
|
|
12370
|
+
* y: 100,
|
|
12371
|
+
* width: 100,
|
|
12372
|
+
* height: 100
|
|
12373
|
+
* });
|
|
12374
|
+
* ```
|
|
12375
|
+
*
|
|
12376
|
+
* @param {'root'} type
|
|
12377
|
+
* @param {any} [attrs]
|
|
12378
|
+
*
|
|
12379
|
+
* @return {Root}
|
|
12380
|
+
*/
|
|
12381
|
+
/**
|
|
12382
|
+
* Creates a connection.
|
|
11553
12383
|
*
|
|
11554
|
-
* @
|
|
12384
|
+
* @overlord
|
|
11555
12385
|
*
|
|
11556
12386
|
* @example
|
|
11557
12387
|
*
|
|
12388
|
+
* ```javascript
|
|
11558
12389
|
* import * as Model from 'diagram-js/lib/model';
|
|
11559
12390
|
*
|
|
11560
12391
|
* const connection = Model.create('connection', {
|
|
@@ -11563,33 +12394,56 @@
|
|
|
11563
12394
|
* { x: 200, y: 100 }
|
|
11564
12395
|
* ]
|
|
11565
12396
|
* });
|
|
12397
|
+
* ```
|
|
11566
12398
|
*
|
|
11567
|
-
*
|
|
11568
|
-
*
|
|
11569
|
-
* y: 100,
|
|
11570
|
-
* width: 100,
|
|
11571
|
-
* height: 100,
|
|
11572
|
-
* labelTarget: shape
|
|
11573
|
-
* });
|
|
12399
|
+
* @param {'connection'} type
|
|
12400
|
+
* @param {any} [attrs]
|
|
11574
12401
|
*
|
|
11575
|
-
*
|
|
12402
|
+
* @return {Connection}
|
|
12403
|
+
*/
|
|
12404
|
+
/**
|
|
12405
|
+
* Creates a shape.
|
|
12406
|
+
*
|
|
12407
|
+
* @overlord
|
|
12408
|
+
*
|
|
12409
|
+
* @example
|
|
12410
|
+
*
|
|
12411
|
+
* ```javascript
|
|
12412
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12413
|
+
*
|
|
12414
|
+
* const shape = Model.create('shape', {
|
|
11576
12415
|
* x: 100,
|
|
11577
12416
|
* y: 100,
|
|
11578
12417
|
* width: 100,
|
|
11579
12418
|
* height: 100
|
|
11580
12419
|
* });
|
|
12420
|
+
* ```
|
|
11581
12421
|
*
|
|
11582
|
-
*
|
|
12422
|
+
* @param {'shape'} type
|
|
12423
|
+
* @param {any} [attrs]
|
|
12424
|
+
*
|
|
12425
|
+
* @return {Shape}
|
|
12426
|
+
*/
|
|
12427
|
+
/**
|
|
12428
|
+
* Creates a label.
|
|
12429
|
+
*
|
|
12430
|
+
* @example
|
|
12431
|
+
*
|
|
12432
|
+
* ```javascript
|
|
12433
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12434
|
+
*
|
|
12435
|
+
* const label = Model.create('label', {
|
|
11583
12436
|
* x: 100,
|
|
11584
12437
|
* y: 100,
|
|
11585
12438
|
* width: 100,
|
|
11586
|
-
* height: 100
|
|
12439
|
+
* height: 100,
|
|
12440
|
+
* labelTarget: shape
|
|
11587
12441
|
* });
|
|
12442
|
+
* ```
|
|
11588
12443
|
*
|
|
11589
|
-
* @param {
|
|
11590
|
-
* @param {Object} attrs
|
|
11591
|
-
*
|
|
11592
|
-
* @return {Connection|Label|Root|Shape} The created model element.
|
|
12444
|
+
* @param {'label'} type
|
|
12445
|
+
* @param {Object} [attrs]
|
|
12446
|
+
* @return {Label}
|
|
11593
12447
|
*/
|
|
11594
12448
|
function create(type, attrs) {
|
|
11595
12449
|
var Type = types$7[type];
|
|
@@ -11600,22 +12454,20 @@
|
|
|
11600
12454
|
}
|
|
11601
12455
|
|
|
11602
12456
|
/**
|
|
11603
|
-
* @typedef {import('../model/
|
|
11604
|
-
* @typedef {import('../model/
|
|
11605
|
-
* @typedef {import('../model/
|
|
11606
|
-
* @typedef {import('../model/
|
|
11607
|
-
* @typedef {import('../model/
|
|
11608
|
-
* @typedef {import('../model/index').ModelAttrsConnection} ModelAttrsConnection
|
|
11609
|
-
* @typedef {import('../model/index').ModelAttrsLabel} ModelAttrsLabel
|
|
11610
|
-
* @typedef {import('../model/index').ModelAttrsRoot} ModelAttrsRoot
|
|
11611
|
-
* @typedef {import('../model/index').ModelAttrsShape} ModelAttrsShape
|
|
12457
|
+
* @typedef {import('../model/Types').Element} Element
|
|
12458
|
+
* @typedef {import('../model/Types').Connection} Connection
|
|
12459
|
+
* @typedef {import('../model/Types').Label} Label
|
|
12460
|
+
* @typedef {import('../model/Types').Root} Root
|
|
12461
|
+
* @typedef {import('../model/Types').Shape} Shape
|
|
11612
12462
|
*/
|
|
11613
12463
|
|
|
11614
12464
|
/**
|
|
11615
12465
|
* A factory for model elements.
|
|
11616
12466
|
*
|
|
11617
|
-
* @
|
|
11618
|
-
* @
|
|
12467
|
+
* @template {Connection} [T=Connection]
|
|
12468
|
+
* @template {Label} [U=Label]
|
|
12469
|
+
* @template {Root} [V=Root]
|
|
12470
|
+
* @template {Shape} [W=Shape]
|
|
11619
12471
|
*/
|
|
11620
12472
|
function ElementFactory() {
|
|
11621
12473
|
this._uid = 12;
|
|
@@ -11624,9 +12476,9 @@
|
|
|
11624
12476
|
/**
|
|
11625
12477
|
* Create a root element.
|
|
11626
12478
|
*
|
|
11627
|
-
* @param {
|
|
12479
|
+
* @param {Partial<Root>} [attrs]
|
|
11628
12480
|
*
|
|
11629
|
-
* @return {
|
|
12481
|
+
* @return {V} The created root element.
|
|
11630
12482
|
*/
|
|
11631
12483
|
ElementFactory.prototype.createRoot = function(attrs) {
|
|
11632
12484
|
return this.create('root', attrs);
|
|
@@ -11635,9 +12487,9 @@
|
|
|
11635
12487
|
/**
|
|
11636
12488
|
* Create a label.
|
|
11637
12489
|
*
|
|
11638
|
-
* @param {
|
|
12490
|
+
* @param {Partial<Label>} [attrs]
|
|
11639
12491
|
*
|
|
11640
|
-
* @return {
|
|
12492
|
+
* @return {U} The created label.
|
|
11641
12493
|
*/
|
|
11642
12494
|
ElementFactory.prototype.createLabel = function(attrs) {
|
|
11643
12495
|
return this.create('label', attrs);
|
|
@@ -11646,9 +12498,9 @@
|
|
|
11646
12498
|
/**
|
|
11647
12499
|
* Create a shape.
|
|
11648
12500
|
*
|
|
11649
|
-
* @param {
|
|
12501
|
+
* @param {Partial<Shape>} [attrs]
|
|
11650
12502
|
*
|
|
11651
|
-
* @return {
|
|
12503
|
+
* @return {W} The created shape.
|
|
11652
12504
|
*/
|
|
11653
12505
|
ElementFactory.prototype.createShape = function(attrs) {
|
|
11654
12506
|
return this.create('shape', attrs);
|
|
@@ -11657,21 +12509,44 @@
|
|
|
11657
12509
|
/**
|
|
11658
12510
|
* Create a connection.
|
|
11659
12511
|
*
|
|
11660
|
-
* @param {
|
|
12512
|
+
* @param {Partial<Connection>} [attrs]
|
|
11661
12513
|
*
|
|
11662
|
-
* @return {
|
|
12514
|
+
* @return {T} The created connection.
|
|
11663
12515
|
*/
|
|
11664
12516
|
ElementFactory.prototype.createConnection = function(attrs) {
|
|
11665
12517
|
return this.create('connection', attrs);
|
|
11666
12518
|
};
|
|
11667
12519
|
|
|
11668
12520
|
/**
|
|
11669
|
-
* Create a
|
|
12521
|
+
* Create a root element.
|
|
12522
|
+
*
|
|
12523
|
+
* @overlord
|
|
12524
|
+
* @param {'root'} type
|
|
12525
|
+
* @param {Partial<Root>} [attrs]
|
|
12526
|
+
* @return {V}
|
|
12527
|
+
*/
|
|
12528
|
+
/**
|
|
12529
|
+
* Create a shape.
|
|
12530
|
+
*
|
|
12531
|
+
* @overlord
|
|
12532
|
+
* @param {'shape'} type
|
|
12533
|
+
* @param {Partial<Shape>} [attrs]
|
|
12534
|
+
* @return {W}
|
|
12535
|
+
*/
|
|
12536
|
+
/**
|
|
12537
|
+
* Create a connection.
|
|
11670
12538
|
*
|
|
11671
|
-
* @
|
|
11672
|
-
* @param {
|
|
12539
|
+
* @overlord
|
|
12540
|
+
* @param {'connection'} type
|
|
12541
|
+
* @param {Partial<Connection>} [attrs]
|
|
12542
|
+
* @return {T}
|
|
12543
|
+
*/
|
|
12544
|
+
/**
|
|
12545
|
+
* Create a label.
|
|
11673
12546
|
*
|
|
11674
|
-
* @
|
|
12547
|
+
* @param {'label'} type
|
|
12548
|
+
* @param {Partial<Label>} [attrs]
|
|
12549
|
+
* @return {U}
|
|
11675
12550
|
*/
|
|
11676
12551
|
ElementFactory.prototype.create = function(type, attrs) {
|
|
11677
12552
|
|
|
@@ -11691,13 +12566,27 @@
|
|
|
11691
12566
|
var slice = Array.prototype.slice;
|
|
11692
12567
|
|
|
11693
12568
|
/**
|
|
11694
|
-
* @typedef {
|
|
11695
|
-
*
|
|
12569
|
+
* @typedef { {
|
|
12570
|
+
* stopPropagation(): void;
|
|
12571
|
+
* preventDefault(): void;
|
|
12572
|
+
* cancelBubble: boolean;
|
|
12573
|
+
* defaultPrevented: boolean;
|
|
12574
|
+
* returnValue: any;
|
|
12575
|
+
* } } Event
|
|
12576
|
+
*/
|
|
12577
|
+
|
|
12578
|
+
/**
|
|
12579
|
+
* @template E
|
|
11696
12580
|
*
|
|
11697
|
-
* @typedef {
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
12581
|
+
* @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
|
|
12582
|
+
*/
|
|
12583
|
+
|
|
12584
|
+
/**
|
|
12585
|
+
* @typedef { {
|
|
12586
|
+
* priority: number;
|
|
12587
|
+
* next: EventBusListener | null;
|
|
12588
|
+
* callback: EventBusEventCallback<any>;
|
|
12589
|
+
* } } EventBusListener
|
|
11701
12590
|
*/
|
|
11702
12591
|
|
|
11703
12592
|
/**
|
|
@@ -11784,6 +12673,10 @@
|
|
|
11784
12673
|
* ```
|
|
11785
12674
|
*/
|
|
11786
12675
|
function EventBus() {
|
|
12676
|
+
|
|
12677
|
+
/**
|
|
12678
|
+
* @type { Record<string, EventBusListener> }
|
|
12679
|
+
*/
|
|
11787
12680
|
this._listeners = {};
|
|
11788
12681
|
|
|
11789
12682
|
// cleanup on destroy on lowest priority to allow
|
|
@@ -11804,10 +12697,12 @@
|
|
|
11804
12697
|
*
|
|
11805
12698
|
* Returning anything but `undefined` from a listener will stop the listener propagation.
|
|
11806
12699
|
*
|
|
11807
|
-
* @
|
|
11808
|
-
*
|
|
11809
|
-
* @param {
|
|
11810
|
-
* @param {
|
|
12700
|
+
* @template T
|
|
12701
|
+
*
|
|
12702
|
+
* @param {string|string[]} events to subscribe to
|
|
12703
|
+
* @param {number} [priority=1000] listen priority
|
|
12704
|
+
* @param {EventBusEventCallback<T>} callback
|
|
12705
|
+
* @param {any} [that] callback context
|
|
11811
12706
|
*/
|
|
11812
12707
|
EventBus.prototype.on = function(events, priority, callback, that) {
|
|
11813
12708
|
|
|
@@ -11845,16 +12740,17 @@
|
|
|
11845
12740
|
});
|
|
11846
12741
|
};
|
|
11847
12742
|
|
|
11848
|
-
|
|
11849
12743
|
/**
|
|
11850
12744
|
* Register an event listener that is called only once.
|
|
11851
12745
|
*
|
|
11852
|
-
* @
|
|
11853
|
-
*
|
|
11854
|
-
* @param {
|
|
11855
|
-
* @param {
|
|
12746
|
+
* @template T
|
|
12747
|
+
*
|
|
12748
|
+
* @param {string|string[]} events to subscribe to
|
|
12749
|
+
* @param {number} [priority=1000] the listen priority
|
|
12750
|
+
* @param {EventBusEventCallback<T>} callback
|
|
12751
|
+
* @param {any} [that] callback context
|
|
11856
12752
|
*/
|
|
11857
|
-
EventBus.prototype.once = function(
|
|
12753
|
+
EventBus.prototype.once = function(events, priority, callback, that) {
|
|
11858
12754
|
var self = this;
|
|
11859
12755
|
|
|
11860
12756
|
if (isFunction(priority)) {
|
|
@@ -11872,7 +12768,7 @@
|
|
|
11872
12768
|
|
|
11873
12769
|
var result = callback.apply(that, arguments);
|
|
11874
12770
|
|
|
11875
|
-
self.off(
|
|
12771
|
+
self.off(events, wrappedCallback);
|
|
11876
12772
|
|
|
11877
12773
|
return result;
|
|
11878
12774
|
}
|
|
@@ -11882,7 +12778,7 @@
|
|
|
11882
12778
|
// callback
|
|
11883
12779
|
wrappedCallback[FN_REF] = callback;
|
|
11884
12780
|
|
|
11885
|
-
this.on(
|
|
12781
|
+
this.on(events, priority, wrappedCallback);
|
|
11886
12782
|
};
|
|
11887
12783
|
|
|
11888
12784
|
|
|
@@ -11891,8 +12787,8 @@
|
|
|
11891
12787
|
*
|
|
11892
12788
|
* If no callback is given, all listeners for a given event name are being removed.
|
|
11893
12789
|
*
|
|
11894
|
-
* @param {string|string[]} events
|
|
11895
|
-
* @param {
|
|
12790
|
+
* @param {string|string[]} events
|
|
12791
|
+
* @param {EventBusEventCallback} [callback]
|
|
11896
12792
|
*/
|
|
11897
12793
|
EventBus.prototype.off = function(events, callback) {
|
|
11898
12794
|
|
|
@@ -11928,6 +12824,7 @@
|
|
|
11928
12824
|
*
|
|
11929
12825
|
* @example
|
|
11930
12826
|
*
|
|
12827
|
+
* ```javascript
|
|
11931
12828
|
* // fire event by name
|
|
11932
12829
|
* events.fire('foo');
|
|
11933
12830
|
*
|
|
@@ -11945,12 +12842,13 @@
|
|
|
11945
12842
|
* });
|
|
11946
12843
|
*
|
|
11947
12844
|
* events.fire({ type: 'foo' }, 'I am bar!');
|
|
12845
|
+
* ```
|
|
11948
12846
|
*
|
|
11949
|
-
* @param {string} [type]
|
|
11950
|
-
* @param {Object} [data]
|
|
11951
|
-
* @param {
|
|
12847
|
+
* @param {string} [type] event type
|
|
12848
|
+
* @param {Object} [data] event or event data
|
|
12849
|
+
* @param {...any} [args] additional arguments the callback will be called with.
|
|
11952
12850
|
*
|
|
11953
|
-
* @return {
|
|
12851
|
+
* @return {any} The return value. Will be set to `false` if the default was prevented.
|
|
11954
12852
|
*/
|
|
11955
12853
|
EventBus.prototype.fire = function(type, data) {
|
|
11956
12854
|
var event,
|
|
@@ -12031,6 +12929,13 @@
|
|
|
12031
12929
|
this._listeners = {};
|
|
12032
12930
|
};
|
|
12033
12931
|
|
|
12932
|
+
/**
|
|
12933
|
+
* @param {Event} event
|
|
12934
|
+
* @param {any[]} args
|
|
12935
|
+
* @param {EventBusListener} listener
|
|
12936
|
+
*
|
|
12937
|
+
* @return {any}
|
|
12938
|
+
*/
|
|
12034
12939
|
EventBus.prototype._invokeListeners = function(event, args, listener) {
|
|
12035
12940
|
|
|
12036
12941
|
var returnValue;
|
|
@@ -12050,6 +12955,13 @@
|
|
|
12050
12955
|
return returnValue;
|
|
12051
12956
|
};
|
|
12052
12957
|
|
|
12958
|
+
/**
|
|
12959
|
+
* @param {Event} event
|
|
12960
|
+
* @param {any[]} args
|
|
12961
|
+
* @param {EventBusListener} listener
|
|
12962
|
+
*
|
|
12963
|
+
* @return {any}
|
|
12964
|
+
*/
|
|
12053
12965
|
EventBus.prototype._invokeListener = function(event, args, listener) {
|
|
12054
12966
|
|
|
12055
12967
|
var returnValue;
|
|
@@ -12098,7 +13010,7 @@
|
|
|
12098
13010
|
* * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
|
|
12099
13011
|
*
|
|
12100
13012
|
* @param {string} event
|
|
12101
|
-
* @param {
|
|
13013
|
+
* @param {EventBusListener} newListener
|
|
12102
13014
|
*/
|
|
12103
13015
|
EventBus.prototype._addListener = function(event, newListener) {
|
|
12104
13016
|
|
|
@@ -12138,10 +13050,19 @@
|
|
|
12138
13050
|
};
|
|
12139
13051
|
|
|
12140
13052
|
|
|
13053
|
+
/**
|
|
13054
|
+
* @param {string} name
|
|
13055
|
+
*
|
|
13056
|
+
* @return {EventBusListener}
|
|
13057
|
+
*/
|
|
12141
13058
|
EventBus.prototype._getListeners = function(name) {
|
|
12142
13059
|
return this._listeners[name];
|
|
12143
13060
|
};
|
|
12144
13061
|
|
|
13062
|
+
/**
|
|
13063
|
+
* @param {string} name
|
|
13064
|
+
* @param {EventBusListener} listener
|
|
13065
|
+
*/
|
|
12145
13066
|
EventBus.prototype._setListeners = function(name, listener) {
|
|
12146
13067
|
this._listeners[name] = listener;
|
|
12147
13068
|
};
|
|
@@ -12204,9 +13125,9 @@
|
|
|
12204
13125
|
* Invoke function. Be fast...
|
|
12205
13126
|
*
|
|
12206
13127
|
* @param {Function} fn
|
|
12207
|
-
* @param {
|
|
13128
|
+
* @param {any[]} args
|
|
12208
13129
|
*
|
|
12209
|
-
* @return {
|
|
13130
|
+
* @return {any}
|
|
12210
13131
|
*/
|
|
12211
13132
|
function invokeFunction(fn, args) {
|
|
12212
13133
|
return fn.apply(null, args);
|
|
@@ -12241,13 +13162,9 @@
|
|
|
12241
13162
|
}
|
|
12242
13163
|
|
|
12243
13164
|
/**
|
|
12244
|
-
* @typedef {import('
|
|
12245
|
-
* @typedef {import('
|
|
12246
|
-
* @typedef {import('
|
|
12247
|
-
*
|
|
12248
|
-
* @typedef {import('.').ConnectionLike} ConnectionLike
|
|
12249
|
-
* @typedef {import('.').ElementLike} ElementLike
|
|
12250
|
-
* @typedef {import('.').ShapeLike} ShapeLike
|
|
13165
|
+
* @typedef {import('./Types').ConnectionLike} ConnectionLike
|
|
13166
|
+
* @typedef {import('./Types').ElementLike} ElementLike
|
|
13167
|
+
* @typedef {import('./Types').ShapeLike} ShapeLike
|
|
12251
13168
|
*
|
|
12252
13169
|
* @typedef {import('./ElementRegistry').default} ElementRegistry
|
|
12253
13170
|
* @typedef {import('./EventBus').default} EventBus
|
|
@@ -12266,7 +13183,10 @@
|
|
|
12266
13183
|
|
|
12267
13184
|
GraphicsFactory.$inject = [ 'eventBus' , 'elementRegistry' ];
|
|
12268
13185
|
|
|
12269
|
-
|
|
13186
|
+
/**
|
|
13187
|
+
* @param { { parent?: any } } element
|
|
13188
|
+
* @return {SVGElement}
|
|
13189
|
+
*/
|
|
12270
13190
|
GraphicsFactory.prototype._getChildrenContainer = function(element) {
|
|
12271
13191
|
|
|
12272
13192
|
var gfx = this._elementRegistry.getGraphics(element);
|
|
@@ -12363,7 +13283,7 @@
|
|
|
12363
13283
|
/**
|
|
12364
13284
|
* Create a graphical element.
|
|
12365
13285
|
*
|
|
12366
|
-
* @param {
|
|
13286
|
+
* @param { 'shape' | 'connection' | 'label' | 'root' } type The type of the element.
|
|
12367
13287
|
* @param {ElementLike} element The element.
|
|
12368
13288
|
* @param {number} [parentIndex] The index at which to add the graphical element to its parent's children.
|
|
12369
13289
|
*
|
|
@@ -12419,6 +13339,8 @@
|
|
|
12419
13339
|
*
|
|
12420
13340
|
* @param {SVGElement} visual The graphical element.
|
|
12421
13341
|
* @param {ShapeLike} element The shape.
|
|
13342
|
+
*
|
|
13343
|
+
* @return {SVGElement}
|
|
12422
13344
|
*/
|
|
12423
13345
|
GraphicsFactory.prototype.drawShape = function(visual, element) {
|
|
12424
13346
|
var eventBus = this._eventBus;
|
|
@@ -12444,6 +13366,8 @@
|
|
|
12444
13366
|
*
|
|
12445
13367
|
* @param {SVGElement} visual The graphical element.
|
|
12446
13368
|
* @param {ConnectionLike} element The connection.
|
|
13369
|
+
*
|
|
13370
|
+
* @return {SVGElement}
|
|
12447
13371
|
*/
|
|
12448
13372
|
GraphicsFactory.prototype.drawConnection = function(visual, element) {
|
|
12449
13373
|
var eventBus = this._eventBus;
|
|
@@ -12454,7 +13378,7 @@
|
|
|
12454
13378
|
/**
|
|
12455
13379
|
* Get the path of a connection.
|
|
12456
13380
|
*
|
|
12457
|
-
* @param {ConnectionLike}
|
|
13381
|
+
* @param {ConnectionLike} connection The connection.
|
|
12458
13382
|
*
|
|
12459
13383
|
* @return {string} The path of the connection.
|
|
12460
13384
|
*/
|
|
@@ -12467,9 +13391,9 @@
|
|
|
12467
13391
|
/**
|
|
12468
13392
|
* Update an elements graphical representation.
|
|
12469
13393
|
*
|
|
12470
|
-
* @param {
|
|
12471
|
-
* @param {ElementLike} element
|
|
12472
|
-
* @param {SVGElement} gfx
|
|
13394
|
+
* @param {'shape'|'connection'} type
|
|
13395
|
+
* @param {ElementLike} element
|
|
13396
|
+
* @param {SVGElement} gfx
|
|
12473
13397
|
*/
|
|
12474
13398
|
GraphicsFactory.prototype.update = function(type, element, gfx) {
|
|
12475
13399
|
|
|
@@ -12527,6 +13451,9 @@
|
|
|
12527
13451
|
parentNode.insertBefore(newNode, node);
|
|
12528
13452
|
}
|
|
12529
13453
|
|
|
13454
|
+
/**
|
|
13455
|
+
* @type { import('didi').ModuleDeclaration }
|
|
13456
|
+
*/
|
|
12530
13457
|
var CoreModule = {
|
|
12531
13458
|
__depends__: [ DrawModule ],
|
|
12532
13459
|
__init__: [ 'canvas' ],
|
|
@@ -12542,7 +13469,9 @@
|
|
|
12542
13469
|
* @typedef {import('didi').LocalsMap} LocalsMap
|
|
12543
13470
|
* @typedef {import('didi').ModuleDeclaration} ModuleDeclaration
|
|
12544
13471
|
*
|
|
12545
|
-
* @typedef {
|
|
13472
|
+
* @typedef { {
|
|
13473
|
+
* modules?: ModuleDeclaration[];
|
|
13474
|
+
* } & Record<string, any> } DiagramOptions
|
|
12546
13475
|
*/
|
|
12547
13476
|
|
|
12548
13477
|
/**
|
|
@@ -12571,6 +13500,9 @@
|
|
|
12571
13500
|
|
|
12572
13501
|
options = options || {};
|
|
12573
13502
|
|
|
13503
|
+
/**
|
|
13504
|
+
* @type { ModuleDeclaration }
|
|
13505
|
+
*/
|
|
12574
13506
|
var configModule = {
|
|
12575
13507
|
'config': [ 'value', options ]
|
|
12576
13508
|
};
|
|
@@ -12590,11 +13522,10 @@
|
|
|
12590
13522
|
* @class
|
|
12591
13523
|
* @constructor
|
|
12592
13524
|
*
|
|
12593
|
-
* @example
|
|
12594
|
-
*
|
|
12595
|
-
* <caption>Creating a plug-in that logs whenever a shape is added to the canvas.</caption>
|
|
13525
|
+
* @example Creating a plug-in that logs whenever a shape is added to the canvas.
|
|
12596
13526
|
*
|
|
12597
|
-
*
|
|
13527
|
+
* ```javascript
|
|
13528
|
+
* // plug-in implementation
|
|
12598
13529
|
* function MyLoggingPlugin(eventBus) {
|
|
12599
13530
|
* eventBus.on('shape.added', function(event) {
|
|
12600
13531
|
* console.log('shape ', event.shape, ' was added to the diagram');
|
|
@@ -12606,10 +13537,11 @@
|
|
|
12606
13537
|
* __init__: [ 'myLoggingPlugin' ],
|
|
12607
13538
|
* myLoggingPlugin: [ 'type', MyLoggingPlugin ]
|
|
12608
13539
|
* };
|
|
13540
|
+
* ```
|
|
12609
13541
|
*
|
|
13542
|
+
* Use the plug-in in a Diagram instance:
|
|
12610
13543
|
*
|
|
12611
|
-
*
|
|
12612
|
-
*
|
|
13544
|
+
* ```javascript
|
|
12613
13545
|
* import MyLoggingModule from 'path-to-my-logging-plugin';
|
|
12614
13546
|
*
|
|
12615
13547
|
* var diagram = new Diagram({
|
|
@@ -12624,36 +13556,39 @@
|
|
|
12624
13556
|
* });
|
|
12625
13557
|
*
|
|
12626
13558
|
* // 'shape ... was added to the diagram' logged to console
|
|
13559
|
+
* ```
|
|
12627
13560
|
*
|
|
12628
13561
|
* @param {DiagramOptions} [options]
|
|
12629
|
-
* @param {ModuleDeclaration[]} [options.modules] External modules to instantiate with the diagram.
|
|
12630
13562
|
* @param {Injector} [injector] An (optional) injector to bootstrap the diagram with.
|
|
12631
13563
|
*/
|
|
12632
13564
|
function Diagram(options, injector) {
|
|
12633
13565
|
|
|
12634
|
-
|
|
12635
|
-
this.injector = injector = injector || createInjector(options);
|
|
13566
|
+
this._injector = injector = injector || createInjector(options);
|
|
12636
13567
|
|
|
12637
13568
|
// API
|
|
12638
13569
|
|
|
12639
13570
|
/**
|
|
12640
13571
|
* Resolves a diagram service.
|
|
12641
13572
|
*
|
|
12642
|
-
* @
|
|
13573
|
+
* @template T
|
|
12643
13574
|
*
|
|
12644
13575
|
* @param {string} name The name of the service to get.
|
|
12645
13576
|
* @param {boolean} [strict=true] If false, resolve missing services to null.
|
|
13577
|
+
*
|
|
13578
|
+
* @return {T|null}
|
|
12646
13579
|
*/
|
|
12647
13580
|
this.get = injector.get;
|
|
12648
13581
|
|
|
12649
13582
|
/**
|
|
12650
13583
|
* Executes a function with its dependencies injected.
|
|
12651
13584
|
*
|
|
12652
|
-
* @
|
|
13585
|
+
* @template T
|
|
12653
13586
|
*
|
|
12654
|
-
* @param {Function}
|
|
12655
|
-
* @param {InjectionContext} [context]
|
|
12656
|
-
* @param {LocalsMap} [locals]
|
|
13587
|
+
* @param {Function} func function to be invoked
|
|
13588
|
+
* @param {InjectionContext} [context] context of the invocation
|
|
13589
|
+
* @param {LocalsMap} [locals] locals provided
|
|
13590
|
+
*
|
|
13591
|
+
* @return {T|null}
|
|
12657
13592
|
*/
|
|
12658
13593
|
this.invoke = injector.invoke;
|
|
12659
13594
|
|
|
@@ -12673,9 +13608,11 @@
|
|
|
12673
13608
|
*
|
|
12674
13609
|
* @example
|
|
12675
13610
|
*
|
|
13611
|
+
* ```javascript
|
|
12676
13612
|
* eventBus.on('diagram.init', function() {
|
|
12677
13613
|
* eventBus.fire('my-custom-event', { foo: 'BAR' });
|
|
12678
13614
|
* });
|
|
13615
|
+
* ```
|
|
12679
13616
|
*
|
|
12680
13617
|
* @type {Object}
|
|
12681
13618
|
*/
|
|
@@ -12685,8 +13622,6 @@
|
|
|
12685
13622
|
|
|
12686
13623
|
/**
|
|
12687
13624
|
* Destroys the diagram
|
|
12688
|
-
*
|
|
12689
|
-
* @method Diagram#destroy
|
|
12690
13625
|
*/
|
|
12691
13626
|
Diagram.prototype.destroy = function() {
|
|
12692
13627
|
this.get('eventBus').fire('diagram.destroy');
|
|
@@ -20224,6 +21159,10 @@
|
|
|
20224
21159
|
return new BpmnModdle(pks, options);
|
|
20225
21160
|
}
|
|
20226
21161
|
|
|
21162
|
+
/**
|
|
21163
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
21164
|
+
*/
|
|
21165
|
+
|
|
20227
21166
|
// TODO(nikku): remove with future bpmn-js version
|
|
20228
21167
|
|
|
20229
21168
|
/**
|
|
@@ -20233,6 +21172,10 @@
|
|
|
20233
21172
|
* 2) If Promise class is implemented in current environment.
|
|
20234
21173
|
*
|
|
20235
21174
|
* @private
|
|
21175
|
+
*
|
|
21176
|
+
* @param {Function} api
|
|
21177
|
+
*
|
|
21178
|
+
* @return {Function}
|
|
20236
21179
|
*/
|
|
20237
21180
|
function wrapForCompatibility(api) {
|
|
20238
21181
|
|
|
@@ -20281,6 +21224,11 @@
|
|
|
20281
21224
|
|
|
20282
21225
|
var DI_ERROR_MESSAGE = 'Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472';
|
|
20283
21226
|
|
|
21227
|
+
/**
|
|
21228
|
+
* @private
|
|
21229
|
+
*
|
|
21230
|
+
* @param {ModdleElement} businessObject
|
|
21231
|
+
*/
|
|
20284
21232
|
function ensureCompatDiRef(businessObject) {
|
|
20285
21233
|
|
|
20286
21234
|
// bpmnElement can have multiple independent DIs
|
|
@@ -20295,10 +21243,16 @@
|
|
|
20295
21243
|
}
|
|
20296
21244
|
|
|
20297
21245
|
/**
|
|
20298
|
-
*
|
|
21246
|
+
* @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
|
|
20299
21247
|
*
|
|
20300
|
-
* @
|
|
20301
|
-
|
|
21248
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
21249
|
+
*/
|
|
21250
|
+
|
|
21251
|
+
/**
|
|
21252
|
+
* Returns true if an element is of the given meta-model type.
|
|
21253
|
+
*
|
|
21254
|
+
* @param {ModdleElement} element
|
|
21255
|
+
* @param {string} type
|
|
20302
21256
|
*
|
|
20303
21257
|
* @return {boolean}
|
|
20304
21258
|
*/
|
|
@@ -20310,6 +21264,10 @@
|
|
|
20310
21264
|
/**
|
|
20311
21265
|
* Find a suitable display candidate for definitions where the DI does not
|
|
20312
21266
|
* correctly specify one.
|
|
21267
|
+
*
|
|
21268
|
+
* @param {ModdleElement} definitions
|
|
21269
|
+
*
|
|
21270
|
+
* @return {ModdleElement}
|
|
20313
21271
|
*/
|
|
20314
21272
|
function findDisplayCandidate(definitions) {
|
|
20315
21273
|
return find(definitions.rootElements, function(e) {
|
|
@@ -20317,7 +21275,10 @@
|
|
|
20317
21275
|
});
|
|
20318
21276
|
}
|
|
20319
21277
|
|
|
20320
|
-
|
|
21278
|
+
/**
|
|
21279
|
+
* @param {Record<'element' | 'root' | 'error', Function>} handler
|
|
21280
|
+
* @param {Translate} translate
|
|
21281
|
+
*/
|
|
20321
21282
|
function BpmnTreeWalker(handler, translate) {
|
|
20322
21283
|
|
|
20323
21284
|
// list of containers already walked
|
|
@@ -20386,7 +21347,7 @@
|
|
|
20386
21347
|
|
|
20387
21348
|
// DI handling //////////////////////
|
|
20388
21349
|
|
|
20389
|
-
function registerDi(di) {
|
|
21350
|
+
var registerDi = this.registerDi = function registerDi(di) {
|
|
20390
21351
|
var bpmnElement = di.bpmnElement;
|
|
20391
21352
|
|
|
20392
21353
|
if (bpmnElement) {
|
|
@@ -20410,7 +21371,7 @@
|
|
|
20410
21371
|
{ element: di }
|
|
20411
21372
|
);
|
|
20412
21373
|
}
|
|
20413
|
-
}
|
|
21374
|
+
};
|
|
20414
21375
|
|
|
20415
21376
|
function handleDiagram(diagram) {
|
|
20416
21377
|
handlePlane(diagram.plane);
|
|
@@ -20430,14 +21391,14 @@
|
|
|
20430
21391
|
// Semantic handling //////////////////////
|
|
20431
21392
|
|
|
20432
21393
|
/**
|
|
20433
|
-
* Handle definitions and return the rendered diagram (if any)
|
|
21394
|
+
* Handle definitions and return the rendered diagram (if any).
|
|
20434
21395
|
*
|
|
20435
21396
|
* @param {ModdleElement} definitions to walk and import
|
|
20436
21397
|
* @param {ModdleElement} [diagram] specific diagram to import and display
|
|
20437
21398
|
*
|
|
20438
21399
|
* @throws {Error} if no diagram to display could be found
|
|
20439
21400
|
*/
|
|
20440
|
-
function handleDefinitions(definitions, diagram) {
|
|
21401
|
+
this.handleDefinitions = function handleDefinitions(definitions, diagram) {
|
|
20441
21402
|
|
|
20442
21403
|
// make sure we walk the correct bpmnElement
|
|
20443
21404
|
|
|
@@ -20514,10 +21475,10 @@
|
|
|
20514
21475
|
}
|
|
20515
21476
|
|
|
20516
21477
|
// handle all deferred elements
|
|
20517
|
-
handleDeferred();
|
|
20518
|
-
}
|
|
21478
|
+
handleDeferred(deferred);
|
|
21479
|
+
};
|
|
20519
21480
|
|
|
20520
|
-
function handleDeferred() {
|
|
21481
|
+
var handleDeferred = this.handleDeferred = function handleDeferred() {
|
|
20521
21482
|
|
|
20522
21483
|
var fn;
|
|
20523
21484
|
|
|
@@ -20527,7 +21488,7 @@
|
|
|
20527
21488
|
|
|
20528
21489
|
fn();
|
|
20529
21490
|
}
|
|
20530
|
-
}
|
|
21491
|
+
};
|
|
20531
21492
|
|
|
20532
21493
|
function handleProcess(process, context) {
|
|
20533
21494
|
handleFlowElementsContainer(process, context);
|
|
@@ -20603,10 +21564,10 @@
|
|
|
20603
21564
|
forEach$1(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
|
|
20604
21565
|
}
|
|
20605
21566
|
|
|
20606
|
-
function handleSubProcess(subProcess, context) {
|
|
21567
|
+
var handleSubProcess = this.handleSubProcess = function handleSubProcess(subProcess, context) {
|
|
20607
21568
|
handleFlowElementsContainer(subProcess, context);
|
|
20608
21569
|
handleArtifacts(subProcess.artifacts, context);
|
|
20609
|
-
}
|
|
21570
|
+
};
|
|
20610
21571
|
|
|
20611
21572
|
function handleFlowNode(flowNode, context) {
|
|
20612
21573
|
var childCtx = visitIfDi(flowNode, context);
|
|
@@ -20731,44 +21692,29 @@
|
|
|
20731
21692
|
}
|
|
20732
21693
|
});
|
|
20733
21694
|
}
|
|
20734
|
-
|
|
20735
|
-
// API //////////////////////
|
|
20736
|
-
|
|
20737
|
-
return {
|
|
20738
|
-
handleDeferred: handleDeferred,
|
|
20739
|
-
handleDefinitions: handleDefinitions,
|
|
20740
|
-
handleSubProcess: handleSubProcess,
|
|
20741
|
-
registerDi: registerDi
|
|
20742
|
-
};
|
|
20743
21695
|
}
|
|
20744
21696
|
|
|
20745
21697
|
/**
|
|
20746
|
-
*
|
|
21698
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
20747
21699
|
*
|
|
20748
|
-
* @typedef {
|
|
21700
|
+
* @typedef { {
|
|
21701
|
+
* warnings: string[];
|
|
21702
|
+
* } } ImportBPMNDiagramResult
|
|
20749
21703
|
*
|
|
20750
|
-
* @
|
|
21704
|
+
* @typedef {ImportBPMNDiagramResult & Error} ImportBPMNDiagramError
|
|
20751
21705
|
*/
|
|
20752
21706
|
|
|
20753
|
-
/**
|
|
20754
|
-
* The importBpmnDiagram error.
|
|
20755
|
-
*
|
|
20756
|
-
* @typedef {Error} ImportBPMNDiagramError
|
|
20757
|
-
*
|
|
20758
|
-
* @property {Array<string>} warnings
|
|
20759
|
-
*/
|
|
20760
|
-
|
|
20761
21707
|
/**
|
|
20762
21708
|
* Import the definitions into a diagram.
|
|
20763
21709
|
*
|
|
20764
21710
|
* Errors and warnings are reported through the specified callback.
|
|
20765
21711
|
*
|
|
20766
|
-
* @param
|
|
20767
|
-
* @param
|
|
20768
|
-
* @param
|
|
20769
|
-
*
|
|
21712
|
+
* @param {ModdleElement} diagram
|
|
21713
|
+
* @param {ModdleElement} definitions
|
|
21714
|
+
* @param {ModdleElement} [bpmnDiagram] The diagram to be rendered (if not
|
|
21715
|
+
* provided, the first one will be rendered).
|
|
20770
21716
|
*
|
|
20771
|
-
*
|
|
21717
|
+
* @return {Promise<ImportBPMNDiagramResult>}
|
|
20772
21718
|
*/
|
|
20773
21719
|
function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
20774
21720
|
|
|
@@ -20784,8 +21730,8 @@
|
|
|
20784
21730
|
* Walk the diagram semantically, importing (=drawing)
|
|
20785
21731
|
* all elements you encounter.
|
|
20786
21732
|
*
|
|
20787
|
-
* @param {ModdleElement
|
|
20788
|
-
* @param {ModdleElement
|
|
21733
|
+
* @param {ModdleElement} definitions
|
|
21734
|
+
* @param {ModdleElement} bpmnDiagram
|
|
20789
21735
|
*/
|
|
20790
21736
|
function render(definitions, bpmnDiagram) {
|
|
20791
21737
|
|
|
@@ -20860,10 +21806,10 @@
|
|
|
20860
21806
|
* Returns all diagrams in the same hierarchy as the requested diagram.
|
|
20861
21807
|
* Includes all parent and sub process diagrams.
|
|
20862
21808
|
*
|
|
20863
|
-
* @param {
|
|
20864
|
-
* @param {
|
|
21809
|
+
* @param {ModdleElement} definitions
|
|
21810
|
+
* @param {ModdleElement} bpmnDiagram
|
|
20865
21811
|
*
|
|
20866
|
-
* @
|
|
21812
|
+
* @return {ModdleElement[]}
|
|
20867
21813
|
*/
|
|
20868
21814
|
function getDiagramsToImport(definitions, bpmnDiagram) {
|
|
20869
21815
|
if (!bpmnDiagram) {
|
|
@@ -21015,7 +21961,7 @@
|
|
|
21015
21961
|
BPMNIO_IMG +
|
|
21016
21962
|
'</a>' +
|
|
21017
21963
|
'<span>' +
|
|
21018
|
-
'Web-based tooling for BPMN, DMN and
|
|
21964
|
+
'Web-based tooling for BPMN, DMN and forms ' +
|
|
21019
21965
|
'powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.' +
|
|
21020
21966
|
'</span>' +
|
|
21021
21967
|
'</div>' +
|
|
@@ -21057,22 +22003,89 @@
|
|
|
21057
22003
|
* @see http://bpmn.io/license for more information.
|
|
21058
22004
|
*/
|
|
21059
22005
|
|
|
22006
|
+
/**
|
|
22007
|
+
* @template T
|
|
22008
|
+
*
|
|
22009
|
+
* @typedef {import('diagram-js/lib/core/EventBus').EventBusEventCallback<T>} EventBusEventCallback
|
|
22010
|
+
*/
|
|
21060
22011
|
|
|
21061
22012
|
/**
|
|
21062
22013
|
* @typedef {import('didi').ModuleDeclaration} ModuleDeclaration
|
|
21063
22014
|
*
|
|
21064
|
-
* @typedef {import('./
|
|
21065
|
-
* @typedef {import('./
|
|
21066
|
-
* @typedef {import('./
|
|
21067
|
-
*
|
|
21068
|
-
* @typedef {
|
|
21069
|
-
*
|
|
21070
|
-
*
|
|
21071
|
-
*
|
|
21072
|
-
*
|
|
21073
|
-
*
|
|
21074
|
-
*
|
|
21075
|
-
*
|
|
22015
|
+
* @typedef {import('./model/Types').Moddle} Moddle
|
|
22016
|
+
* @typedef {import('./model/Types').ModdleElement} ModdleElement
|
|
22017
|
+
* @typedef {import('./model/Types').ModdleExtension} ModdleExtension
|
|
22018
|
+
*
|
|
22019
|
+
* @typedef { {
|
|
22020
|
+
* width?: number|string;
|
|
22021
|
+
* height?: number|string;
|
|
22022
|
+
* position?: string;
|
|
22023
|
+
* container?: string|HTMLElement;
|
|
22024
|
+
* moddleExtensions?: ModdleExtensions;
|
|
22025
|
+
* additionalModules?: ModuleDeclaration[];
|
|
22026
|
+
* } & Record<string, any> } BaseViewerOptions
|
|
22027
|
+
*
|
|
22028
|
+
* @typedef {Record<string, ModdleElement>} ModdleElementsById
|
|
22029
|
+
*
|
|
22030
|
+
* @typedef { {
|
|
22031
|
+
* [key: string]: ModdleExtension;
|
|
22032
|
+
* } } ModdleExtensions
|
|
22033
|
+
*
|
|
22034
|
+
* @typedef { {
|
|
22035
|
+
* warnings: string[];
|
|
22036
|
+
* } } ImportXMLResult
|
|
22037
|
+
*
|
|
22038
|
+
* @typedef {ImportXMLResult & Error} ImportXMLError
|
|
22039
|
+
*
|
|
22040
|
+
* @typedef {ImportXMLResult} ImportDefinitionsResult
|
|
22041
|
+
*
|
|
22042
|
+
* @typedef {ImportXMLError} ImportDefinitionsError
|
|
22043
|
+
*
|
|
22044
|
+
* @typedef {ImportXMLResult} OpenResult
|
|
22045
|
+
*
|
|
22046
|
+
* @typedef {ImportXMLError} OpenError
|
|
22047
|
+
*
|
|
22048
|
+
* @typedef { {
|
|
22049
|
+
* format?: boolean;
|
|
22050
|
+
* preamble?: boolean;
|
|
22051
|
+
* } } SaveXMLOptions
|
|
22052
|
+
*
|
|
22053
|
+
* @typedef { {
|
|
22054
|
+
* xml?: string;
|
|
22055
|
+
* error?: Error;
|
|
22056
|
+
* } } SaveXMLResult
|
|
22057
|
+
*
|
|
22058
|
+
* @typedef { {
|
|
22059
|
+
* svg: string;
|
|
22060
|
+
* } } SaveSVGResult
|
|
22061
|
+
*
|
|
22062
|
+
* @typedef { {
|
|
22063
|
+
* xml: string;
|
|
22064
|
+
* } } ImportParseStartEvent
|
|
22065
|
+
*
|
|
22066
|
+
* @typedef { {
|
|
22067
|
+
* error?: ImportXMLError;
|
|
22068
|
+
* definitions?: ModdleElement;
|
|
22069
|
+
* elementsById?: ModdleElementsById;
|
|
22070
|
+
* references?: ModdleElement[];
|
|
22071
|
+
* warnings: string[];
|
|
22072
|
+
* } } ImportParseCompleteEvent
|
|
22073
|
+
*
|
|
22074
|
+
* @typedef { {
|
|
22075
|
+
* error?: ImportXMLError;
|
|
22076
|
+
* warnings: string[];
|
|
22077
|
+
* } } ImportDoneEvent
|
|
22078
|
+
*
|
|
22079
|
+
* @typedef { {
|
|
22080
|
+
* definitions: ModdleElement;
|
|
22081
|
+
* } } SaveXMLStartEvent
|
|
22082
|
+
*
|
|
22083
|
+
* @typedef {SaveXMLResult} SaveXMLDoneEvent
|
|
22084
|
+
*
|
|
22085
|
+
* @typedef { {
|
|
22086
|
+
* error?: Error;
|
|
22087
|
+
* svg: string;
|
|
22088
|
+
* } } SaveSVGDoneEvent
|
|
21076
22089
|
*/
|
|
21077
22090
|
|
|
21078
22091
|
/**
|
|
@@ -21081,15 +22094,18 @@
|
|
|
21081
22094
|
* Have a look at {@link Viewer}, {@link NavigatedViewer} or {@link Modeler} for
|
|
21082
22095
|
* bundles that include actual features.
|
|
21083
22096
|
*
|
|
21084
|
-
* @param {
|
|
22097
|
+
* @param {BaseViewerOptions} [options] The options to configure the viewer.
|
|
21085
22098
|
*/
|
|
21086
22099
|
function BaseViewer(options) {
|
|
21087
22100
|
|
|
21088
22101
|
/**
|
|
21089
|
-
* @type {
|
|
22102
|
+
* @type {BaseViewerOptions}
|
|
21090
22103
|
*/
|
|
21091
22104
|
options = assign$1({}, DEFAULT_OPTIONS, options);
|
|
21092
22105
|
|
|
22106
|
+
/**
|
|
22107
|
+
* @type {Moddle}
|
|
22108
|
+
*/
|
|
21093
22109
|
this._moddle = this._createModdle(options);
|
|
21094
22110
|
|
|
21095
22111
|
/**
|
|
@@ -21128,18 +22144,18 @@
|
|
|
21128
22144
|
*
|
|
21129
22145
|
* @throws {ImportXMLError} An error thrown during the import of the XML.
|
|
21130
22146
|
*
|
|
21131
|
-
* @fires BaseViewer#
|
|
21132
|
-
* @fires BaseViewer#
|
|
21133
|
-
* @fires Importer#
|
|
21134
|
-
* @fires Importer#
|
|
21135
|
-
* @fires BaseViewer#
|
|
22147
|
+
* @fires BaseViewer#ImportParseStartEvent
|
|
22148
|
+
* @fires BaseViewer#ImportParseCompleteEvent
|
|
22149
|
+
* @fires Importer#ImportRenderStartEvent
|
|
22150
|
+
* @fires Importer#ImportRenderCompleteEvent
|
|
22151
|
+
* @fires BaseViewer#ImportDoneEvent
|
|
21136
22152
|
*
|
|
21137
22153
|
* @param {string} xml The BPMN 2.0 XML to be imported.
|
|
21138
22154
|
* @param {ModdleElement|string} [bpmnDiagram] The optional diagram or Id of the BPMN diagram to open.
|
|
21139
22155
|
*
|
|
21140
22156
|
* @return {Promise<ImportXMLResult>} A promise resolving with warnings that were produced during the import.
|
|
21141
22157
|
*/
|
|
21142
|
-
BaseViewer.prototype.importXML =
|
|
22158
|
+
BaseViewer.prototype.importXML = async function importXML(xml, bpmnDiagram) {
|
|
21143
22159
|
|
|
21144
22160
|
const self = this;
|
|
21145
22161
|
|
|
@@ -21177,9 +22193,8 @@
|
|
|
21177
22193
|
/**
|
|
21178
22194
|
* A `import.parse.start` event.
|
|
21179
22195
|
*
|
|
21180
|
-
* @event BaseViewer#
|
|
21181
|
-
* @type {
|
|
21182
|
-
* @property {string} xml The XML that is to be parsed.
|
|
22196
|
+
* @event BaseViewer#ImportParseStartEvent
|
|
22197
|
+
* @type {ImportParseStartEvent}
|
|
21183
22198
|
*/
|
|
21184
22199
|
xml = this._emit('import.parse.start', { xml: xml }) || xml;
|
|
21185
22200
|
|
|
@@ -21207,13 +22222,8 @@
|
|
|
21207
22222
|
/**
|
|
21208
22223
|
* A `import.parse.complete` event.
|
|
21209
22224
|
*
|
|
21210
|
-
* @event BaseViewer#
|
|
21211
|
-
* @type {
|
|
21212
|
-
* @property {Error|null} error An error thrown when parsing the XML.
|
|
21213
|
-
* @property {ModdleElement} definitions The definitions model element.
|
|
21214
|
-
* @property {ModdleElementsById} elementsById The model elements by ID.
|
|
21215
|
-
* @property {ModdleElement[]} references The referenced model elements.
|
|
21216
|
-
* @property {string[]} warnings The warnings produced when parsing the XML.
|
|
22225
|
+
* @event BaseViewer#ImportParseCompleteEvent
|
|
22226
|
+
* @type {ImportParseCompleteEvent}
|
|
21217
22227
|
*/
|
|
21218
22228
|
definitions = this._emit('import.parse.complete', ParseCompleteEvent({
|
|
21219
22229
|
error: null,
|
|
@@ -21230,10 +22240,8 @@
|
|
|
21230
22240
|
/**
|
|
21231
22241
|
* A `import.parse.complete` event.
|
|
21232
22242
|
*
|
|
21233
|
-
* @event BaseViewer#
|
|
21234
|
-
* @type {
|
|
21235
|
-
* @property {ImportXMLError|null} error An error thrown during import.
|
|
21236
|
-
* @property {string[]} warnings The warnings.
|
|
22243
|
+
* @event BaseViewer#ImportDoneEvent
|
|
22244
|
+
* @type {ImportDoneEvent}
|
|
21237
22245
|
*/
|
|
21238
22246
|
this._emit('import.done', { error: null, warnings: aggregatedWarnings });
|
|
21239
22247
|
|
|
@@ -21249,7 +22257,9 @@
|
|
|
21249
22257
|
|
|
21250
22258
|
throw error;
|
|
21251
22259
|
}
|
|
21252
|
-
}
|
|
22260
|
+
};
|
|
22261
|
+
|
|
22262
|
+
BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
|
|
21253
22263
|
|
|
21254
22264
|
|
|
21255
22265
|
/**
|
|
@@ -21274,12 +22284,14 @@
|
|
|
21274
22284
|
*
|
|
21275
22285
|
* @return {Promise<ImportDefinitionsResult>} A promise resolving with warnings that were produced during the import.
|
|
21276
22286
|
*/
|
|
21277
|
-
BaseViewer.prototype.importDefinitions =
|
|
22287
|
+
BaseViewer.prototype.importDefinitions = async function importDefinitions(definitions, bpmnDiagram) {
|
|
21278
22288
|
this._setDefinitions(definitions);
|
|
21279
22289
|
const result = await this.open(bpmnDiagram);
|
|
21280
22290
|
|
|
21281
22291
|
return { warnings: result.warnings };
|
|
21282
|
-
}
|
|
22292
|
+
};
|
|
22293
|
+
|
|
22294
|
+
BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
|
|
21283
22295
|
|
|
21284
22296
|
|
|
21285
22297
|
/**
|
|
@@ -21303,7 +22315,7 @@
|
|
|
21303
22315
|
*
|
|
21304
22316
|
* @return {Promise<OpenResult>} A promise resolving with warnings that were produced during opening.
|
|
21305
22317
|
*/
|
|
21306
|
-
BaseViewer.prototype.open =
|
|
22318
|
+
BaseViewer.prototype.open = async function open(bpmnDiagramOrId) {
|
|
21307
22319
|
|
|
21308
22320
|
const definitions = this._definitions;
|
|
21309
22321
|
let bpmnDiagram = bpmnDiagramOrId;
|
|
@@ -21340,7 +22352,9 @@
|
|
|
21340
22352
|
const { warnings } = await importBpmnDiagram(this, definitions, bpmnDiagram);
|
|
21341
22353
|
|
|
21342
22354
|
return { warnings };
|
|
21343
|
-
}
|
|
22355
|
+
};
|
|
22356
|
+
|
|
22357
|
+
BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
|
|
21344
22358
|
|
|
21345
22359
|
/**
|
|
21346
22360
|
* Export the currently displayed BPMN 2.0 diagram as
|
|
@@ -21365,7 +22379,7 @@
|
|
|
21365
22379
|
*
|
|
21366
22380
|
* @return {Promise<SaveXMLResult>} A promise resolving with the XML.
|
|
21367
22381
|
*/
|
|
21368
|
-
BaseViewer.prototype.saveXML =
|
|
22382
|
+
BaseViewer.prototype.saveXML = async function saveXML(options) {
|
|
21369
22383
|
|
|
21370
22384
|
options = options || {};
|
|
21371
22385
|
|
|
@@ -21382,9 +22396,8 @@
|
|
|
21382
22396
|
/**
|
|
21383
22397
|
* A `saveXML.start` event.
|
|
21384
22398
|
*
|
|
21385
|
-
* @event BaseViewer#
|
|
21386
|
-
* @type {
|
|
21387
|
-
* @property {ModdleElement} definitions The definitions model element.
|
|
22399
|
+
* @event BaseViewer#SaveXMLStartEvent
|
|
22400
|
+
* @type {SaveXMLStartEvent}
|
|
21388
22401
|
*/
|
|
21389
22402
|
definitions = this._emit('saveXML.start', {
|
|
21390
22403
|
definitions
|
|
@@ -21405,10 +22418,8 @@
|
|
|
21405
22418
|
/**
|
|
21406
22419
|
* A `saveXML.done` event.
|
|
21407
22420
|
*
|
|
21408
|
-
* @event BaseViewer#
|
|
21409
|
-
* @type {
|
|
21410
|
-
* @property {Error} [error] An error thrown when saving the XML.
|
|
21411
|
-
* @property {string} [xml] The saved XML.
|
|
22421
|
+
* @event BaseViewer#SaveXMLDoneEvent
|
|
22422
|
+
* @type {SaveXMLDoneEvent}
|
|
21412
22423
|
*/
|
|
21413
22424
|
this._emit('saveXML.done', result);
|
|
21414
22425
|
|
|
@@ -21417,7 +22428,9 @@
|
|
|
21417
22428
|
}
|
|
21418
22429
|
|
|
21419
22430
|
return result;
|
|
21420
|
-
}
|
|
22431
|
+
};
|
|
22432
|
+
|
|
22433
|
+
BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
|
|
21421
22434
|
|
|
21422
22435
|
|
|
21423
22436
|
/**
|
|
@@ -21439,7 +22452,7 @@
|
|
|
21439
22452
|
*
|
|
21440
22453
|
* @return {Promise<SaveSVGResult>} A promise resolving with the SVG.
|
|
21441
22454
|
*/
|
|
21442
|
-
BaseViewer.prototype.saveSVG =
|
|
22455
|
+
BaseViewer.prototype.saveSVG = async function saveSVG() {
|
|
21443
22456
|
this._emit('saveSVG.start');
|
|
21444
22457
|
|
|
21445
22458
|
let svg, err;
|
|
@@ -21471,10 +22484,8 @@
|
|
|
21471
22484
|
/**
|
|
21472
22485
|
* A `saveSVG.done` event.
|
|
21473
22486
|
*
|
|
21474
|
-
* @event BaseViewer#
|
|
21475
|
-
* @type {
|
|
21476
|
-
* @property {Error} [error] An error thrown when saving the SVG.
|
|
21477
|
-
* @property {string} [svg] The saved SVG.
|
|
22487
|
+
* @event BaseViewer#SaveSVGDoneEvent
|
|
22488
|
+
* @type {SaveSVGDoneEvent}
|
|
21478
22489
|
*/
|
|
21479
22490
|
this._emit('saveSVG.done', {
|
|
21480
22491
|
error: err,
|
|
@@ -21486,7 +22497,9 @@
|
|
|
21486
22497
|
}
|
|
21487
22498
|
|
|
21488
22499
|
return { svg };
|
|
21489
|
-
}
|
|
22500
|
+
};
|
|
22501
|
+
|
|
22502
|
+
BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
|
|
21490
22503
|
|
|
21491
22504
|
/**
|
|
21492
22505
|
* Get a named diagram service.
|
|
@@ -21568,10 +22581,12 @@
|
|
|
21568
22581
|
*
|
|
21569
22582
|
* Remove an event listener via {@link BaseViewer#off}.
|
|
21570
22583
|
*
|
|
22584
|
+
* @template T
|
|
22585
|
+
*
|
|
21571
22586
|
* @param {string|string[]} events The event(s) to listen to.
|
|
21572
22587
|
* @param {number} [priority] The priority with which to listen.
|
|
21573
|
-
* @param {
|
|
21574
|
-
* @param {
|
|
22588
|
+
* @param {EventBusEventCallback<T>} callback The callback.
|
|
22589
|
+
* @param {any} [that] Value of `this` the callback will be called with.
|
|
21575
22590
|
*/
|
|
21576
22591
|
BaseViewer.prototype.on = function(events, priority, callback, that) {
|
|
21577
22592
|
return this.get('eventBus').on(events, priority, callback, that);
|
|
@@ -21621,7 +22636,7 @@
|
|
|
21621
22636
|
/**
|
|
21622
22637
|
* Get the definitions model element.
|
|
21623
22638
|
*
|
|
21624
|
-
* @
|
|
22639
|
+
* @return {ModdleElement} The definitions model element.
|
|
21625
22640
|
*/
|
|
21626
22641
|
BaseViewer.prototype.getDefinitions = function() {
|
|
21627
22642
|
return this._definitions;
|
|
@@ -21690,6 +22705,11 @@
|
|
|
21690
22705
|
return this.get('eventBus').fire(type, event);
|
|
21691
22706
|
};
|
|
21692
22707
|
|
|
22708
|
+
/**
|
|
22709
|
+
* @param {BaseViewerOptions} options
|
|
22710
|
+
*
|
|
22711
|
+
* @return {HTMLElement}
|
|
22712
|
+
*/
|
|
21693
22713
|
BaseViewer.prototype._createContainer = function(options) {
|
|
21694
22714
|
|
|
21695
22715
|
const container = domify$1('<div class="bjs-container"></div>');
|
|
@@ -21703,6 +22723,11 @@
|
|
|
21703
22723
|
return container;
|
|
21704
22724
|
};
|
|
21705
22725
|
|
|
22726
|
+
/**
|
|
22727
|
+
* @param {BaseViewerOptions} options
|
|
22728
|
+
*
|
|
22729
|
+
* @return {Moddle}
|
|
22730
|
+
*/
|
|
21706
22731
|
BaseViewer.prototype._createModdle = function(options) {
|
|
21707
22732
|
const moddleOptions = assign$1({}, this._moddleExtensions, options.moddleExtensions);
|
|
21708
22733
|
|
|
@@ -23044,13 +24069,21 @@
|
|
|
23044
24069
|
emumerations: emumerations
|
|
23045
24070
|
};
|
|
23046
24071
|
|
|
24072
|
+
/**
|
|
24073
|
+
* @type { {
|
|
24074
|
+
* camunda: any
|
|
24075
|
+
* } }
|
|
24076
|
+
*/
|
|
23047
24077
|
const commonModdleExtensions = {
|
|
23048
24078
|
camunda: camundaModdle
|
|
23049
24079
|
};
|
|
23050
24080
|
|
|
23051
24081
|
/**
|
|
23052
|
-
*
|
|
23053
|
-
|
|
24082
|
+
* @typedef {import('bpmn-js/lib/BaseViewer').BaseViewerOptions} BaseViewerOptions
|
|
24083
|
+
*/
|
|
24084
|
+
|
|
24085
|
+
/**
|
|
24086
|
+
* @param {BaseViewerOptions} options
|
|
23054
24087
|
*/
|
|
23055
24088
|
function Viewer(options = {}) {
|
|
23056
24089
|
|