bpmn-js 9.0.0-subprocesses.1 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/assets/bpmn-js.css +69 -14
- package/dist/assets/diagram-js.css +81 -78
- package/dist/bpmn-modeler.development.js +2897 -1810
- package/dist/bpmn-modeler.production.min.js +8 -8
- package/dist/bpmn-navigated-viewer.development.js +1458 -1101
- package/dist/bpmn-navigated-viewer.production.min.js +6 -6
- package/dist/bpmn-viewer.development.js +1457 -1100
- package/dist/bpmn-viewer.production.min.js +6 -6
- package/lib/BaseViewer.js +1 -1
- package/lib/Viewer.js +2 -2
- package/lib/draw/BpmnRenderer.js +303 -373
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +6 -0
- package/lib/features/copy-paste/BpmnCopyPaste.js +1 -0
- package/lib/features/di-ordering/BpmnDiOrdering.js +15 -11
- package/lib/features/drilldown/DrilldownBreadcrumbs.js +122 -0
- package/lib/features/drilldown/DrilldownCentering.js +118 -0
- package/lib/features/drilldown/DrilldownOverlayBehavior.js +181 -0
- package/lib/features/drilldown/SubprocessCompatibility.js +201 -0
- package/lib/features/drilldown/index.js +17 -0
- package/lib/features/label-editing/LabelEditingProvider.js +1 -1
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +29 -2
- package/lib/features/modeling/BpmnFactory.js +5 -1
- package/lib/features/modeling/BpmnUpdater.js +43 -1
- package/lib/features/modeling/ElementFactory.js +4 -0
- package/lib/features/modeling/behavior/CreateParticipantBehavior.js +59 -84
- package/lib/features/modeling/behavior/DropOnFlowBehavior.js +2 -2
- package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js +34 -0
- package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +557 -0
- package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +74 -0
- package/lib/features/modeling/behavior/UnclaimIdBehavior.js +3 -1
- package/lib/features/modeling/behavior/index.js +27 -18
- package/lib/features/modeling/cmd/SetColorHandler.js +23 -6
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +4 -2
- package/lib/features/modeling/util/ModelingUtil.js +2 -20
- package/lib/features/ordering/BpmnOrderingProvider.js +3 -3
- package/lib/features/palette/PaletteProvider.js +1 -1
- package/lib/features/popup-menu/ReplaceMenuProvider.js +1 -1
- package/lib/import/BpmnImporter.js +17 -60
- package/lib/import/Importer.js +130 -10
- package/lib/util/DrilldownUtil.js +66 -0
- package/lib/util/ModelUtil.js +19 -0
- package/package.json +2 -2
- package/test/helper/index.js +1 -6
- package/lib/features/subprocess-navigation/SubprocessCentering.js +0 -55
- package/lib/features/subprocess-navigation/SubprocessCompatibility.js +0 -135
- package/lib/features/subprocess-navigation/SubprocessElements.js +0 -55
- package/lib/features/subprocess-navigation/SubprocessFlows.js +0 -109
- package/lib/features/subprocess-navigation/SubprocessOverlays.js +0 -104
- package/lib/features/subprocess-navigation/index.js +0 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-viewer v9.0.
|
|
2
|
+
* bpmn-js - bpmn-viewer v9.0.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2014-present, camunda Services GmbH
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Source Code: https://github.com/bpmn-io/bpmn-js
|
|
10
10
|
*
|
|
11
|
-
* Date:
|
|
11
|
+
* Date: 2022-02-18
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -207,6 +207,23 @@
|
|
|
207
207
|
function some(collection, matcher) {
|
|
208
208
|
return !!find(collection, matcher);
|
|
209
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Transform a collection into another collection
|
|
212
|
+
* by piping each member through the given fn.
|
|
213
|
+
*
|
|
214
|
+
* @param {Object|Array} collection
|
|
215
|
+
* @param {Function} fn
|
|
216
|
+
*
|
|
217
|
+
* @return {Array} transformed collection
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
function map$1(collection, fn) {
|
|
221
|
+
var result = [];
|
|
222
|
+
forEach(collection, function (val, key) {
|
|
223
|
+
result.push(fn(val, key));
|
|
224
|
+
});
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
210
227
|
/**
|
|
211
228
|
* Create an object pattern matcher.
|
|
212
229
|
*
|
|
@@ -214,7 +231,7 @@
|
|
|
214
231
|
*
|
|
215
232
|
* const matcher = matchPattern({ id: 1 });
|
|
216
233
|
*
|
|
217
|
-
*
|
|
234
|
+
* let element = find(elements, matcher);
|
|
218
235
|
*
|
|
219
236
|
* @param {Object} pattern
|
|
220
237
|
*
|
|
@@ -244,8 +261,11 @@
|
|
|
244
261
|
}
|
|
245
262
|
|
|
246
263
|
/**
|
|
247
|
-
* Debounce fn, calling it only once if
|
|
248
|
-
*
|
|
264
|
+
* Debounce fn, calling it only once if the given time
|
|
265
|
+
* elapsed between calls.
|
|
266
|
+
*
|
|
267
|
+
* Lodash-style the function exposes methods to `#clear`
|
|
268
|
+
* and `#flush` to control internal behavior.
|
|
249
269
|
*
|
|
250
270
|
* @param {Function} fn
|
|
251
271
|
* @param {Number} timeout
|
|
@@ -258,23 +278,39 @@
|
|
|
258
278
|
var lastThis;
|
|
259
279
|
var lastNow;
|
|
260
280
|
|
|
261
|
-
function fire() {
|
|
281
|
+
function fire(force) {
|
|
262
282
|
var now = Date.now();
|
|
263
|
-
var scheduledDiff = lastNow + timeout - now;
|
|
283
|
+
var scheduledDiff = force ? 0 : lastNow + timeout - now;
|
|
264
284
|
|
|
265
285
|
if (scheduledDiff > 0) {
|
|
266
286
|
return schedule(scheduledDiff);
|
|
267
287
|
}
|
|
268
288
|
|
|
269
289
|
fn.apply(lastThis, lastArgs);
|
|
270
|
-
|
|
290
|
+
clear();
|
|
271
291
|
}
|
|
272
292
|
|
|
273
293
|
function schedule(timeout) {
|
|
274
294
|
timer = setTimeout(fire, timeout);
|
|
275
295
|
}
|
|
276
296
|
|
|
277
|
-
|
|
297
|
+
function clear() {
|
|
298
|
+
if (timer) {
|
|
299
|
+
clearTimeout(timer);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
timer = lastNow = lastArgs = lastThis = undefined;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function flush() {
|
|
306
|
+
if (timer) {
|
|
307
|
+
fire(true);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
clear();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function callback() {
|
|
278
314
|
lastNow = Date.now();
|
|
279
315
|
|
|
280
316
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -287,7 +323,11 @@
|
|
|
287
323
|
if (!timer) {
|
|
288
324
|
schedule(timeout);
|
|
289
325
|
}
|
|
290
|
-
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
callback.flush = flush;
|
|
329
|
+
callback.cancel = clear;
|
|
330
|
+
return callback;
|
|
291
331
|
}
|
|
292
332
|
/**
|
|
293
333
|
* Bind function against target <this>.
|
|
@@ -476,7 +516,6 @@
|
|
|
476
516
|
return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
|
|
477
517
|
}
|
|
478
518
|
|
|
479
|
-
|
|
480
519
|
/**
|
|
481
520
|
* Return the business object for a given element.
|
|
482
521
|
*
|
|
@@ -2530,68 +2569,68 @@
|
|
|
2530
2569
|
return drawPath(parentGfx, path, assign({ 'data-marker': type }, attrs));
|
|
2531
2570
|
}
|
|
2532
2571
|
|
|
2533
|
-
function as(type) {
|
|
2534
|
-
return function(parentGfx, element, attrs) {
|
|
2535
|
-
return handlers[type](parentGfx, element, attrs);
|
|
2536
|
-
};
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
2572
|
function renderer(type) {
|
|
2540
2573
|
return handlers[type];
|
|
2541
2574
|
}
|
|
2542
2575
|
|
|
2543
|
-
function
|
|
2576
|
+
function as(type) {
|
|
2577
|
+
return function(parentGfx, element) {
|
|
2578
|
+
return renderer(type)(parentGfx, element);
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
function renderEventContent(element, parentGfx) {
|
|
2544
2583
|
|
|
2545
2584
|
var event = getSemantic(element);
|
|
2546
2585
|
var isThrowing = isThrowEvent(event);
|
|
2547
2586
|
|
|
2548
2587
|
if (event.eventDefinitions && event.eventDefinitions.length>1) {
|
|
2549
2588
|
if (event.parallelMultiple) {
|
|
2550
|
-
return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element,
|
|
2589
|
+
return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);
|
|
2551
2590
|
}
|
|
2552
2591
|
else {
|
|
2553
|
-
return renderer('bpmn:MultipleEventDefinition')(parentGfx, element,
|
|
2592
|
+
return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);
|
|
2554
2593
|
}
|
|
2555
2594
|
}
|
|
2556
2595
|
|
|
2557
2596
|
if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
|
|
2558
|
-
return renderer('bpmn:MessageEventDefinition')(parentGfx, element,
|
|
2597
|
+
return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);
|
|
2559
2598
|
}
|
|
2560
2599
|
|
|
2561
2600
|
if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
|
|
2562
|
-
return renderer('bpmn:TimerEventDefinition')(parentGfx, element,
|
|
2601
|
+
return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);
|
|
2563
2602
|
}
|
|
2564
2603
|
|
|
2565
2604
|
if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
|
|
2566
|
-
return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element
|
|
2605
|
+
return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);
|
|
2567
2606
|
}
|
|
2568
2607
|
|
|
2569
2608
|
if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
|
|
2570
|
-
return renderer('bpmn:SignalEventDefinition')(parentGfx, element,
|
|
2609
|
+
return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);
|
|
2571
2610
|
}
|
|
2572
2611
|
|
|
2573
2612
|
if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
|
|
2574
|
-
return renderer('bpmn:EscalationEventDefinition')(parentGfx, element,
|
|
2613
|
+
return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);
|
|
2575
2614
|
}
|
|
2576
2615
|
|
|
2577
2616
|
if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
|
|
2578
|
-
return renderer('bpmn:LinkEventDefinition')(parentGfx, element,
|
|
2617
|
+
return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);
|
|
2579
2618
|
}
|
|
2580
2619
|
|
|
2581
2620
|
if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
|
|
2582
|
-
return renderer('bpmn:ErrorEventDefinition')(parentGfx, element,
|
|
2621
|
+
return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);
|
|
2583
2622
|
}
|
|
2584
2623
|
|
|
2585
2624
|
if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
|
|
2586
|
-
return renderer('bpmn:CancelEventDefinition')(parentGfx, element,
|
|
2625
|
+
return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);
|
|
2587
2626
|
}
|
|
2588
2627
|
|
|
2589
2628
|
if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
|
|
2590
|
-
return renderer('bpmn:CompensateEventDefinition')(parentGfx, element,
|
|
2629
|
+
return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);
|
|
2591
2630
|
}
|
|
2592
2631
|
|
|
2593
2632
|
if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
|
|
2594
|
-
return renderer('bpmn:TerminateEventDefinition')(parentGfx, element,
|
|
2633
|
+
return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);
|
|
2595
2634
|
}
|
|
2596
2635
|
|
|
2597
2636
|
return null;
|
|
@@ -2614,20 +2653,20 @@
|
|
|
2614
2653
|
return text;
|
|
2615
2654
|
}
|
|
2616
2655
|
|
|
2617
|
-
function renderEmbeddedLabel(parentGfx, element, align
|
|
2656
|
+
function renderEmbeddedLabel(parentGfx, element, align) {
|
|
2618
2657
|
var semantic = getSemantic(element);
|
|
2619
2658
|
|
|
2620
2659
|
return renderLabel(parentGfx, semantic.name, {
|
|
2621
2660
|
box: element,
|
|
2622
2661
|
align: align,
|
|
2623
2662
|
padding: 5,
|
|
2624
|
-
style:
|
|
2663
|
+
style: {
|
|
2625
2664
|
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
|
|
2626
|
-
}
|
|
2665
|
+
}
|
|
2627
2666
|
});
|
|
2628
2667
|
}
|
|
2629
2668
|
|
|
2630
|
-
function renderExternalLabel(parentGfx, element
|
|
2669
|
+
function renderExternalLabel(parentGfx, element) {
|
|
2631
2670
|
|
|
2632
2671
|
var box = {
|
|
2633
2672
|
width: 90,
|
|
@@ -2644,22 +2683,21 @@
|
|
|
2644
2683
|
textRenderer.getExternalStyle(),
|
|
2645
2684
|
{
|
|
2646
2685
|
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
|
|
2647
|
-
}
|
|
2648
|
-
attrs
|
|
2686
|
+
}
|
|
2649
2687
|
)
|
|
2650
2688
|
});
|
|
2651
2689
|
}
|
|
2652
2690
|
|
|
2653
|
-
function renderLaneLabel(parentGfx, text, element
|
|
2691
|
+
function renderLaneLabel(parentGfx, text, element) {
|
|
2654
2692
|
var textBox = renderLabel(parentGfx, text, {
|
|
2655
2693
|
box: {
|
|
2656
2694
|
height: 30,
|
|
2657
2695
|
width: element.height
|
|
2658
2696
|
},
|
|
2659
2697
|
align: 'center-middle',
|
|
2660
|
-
style:
|
|
2698
|
+
style: {
|
|
2661
2699
|
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
|
|
2662
|
-
}
|
|
2700
|
+
}
|
|
2663
2701
|
});
|
|
2664
2702
|
|
|
2665
2703
|
var top = -1 * element.height;
|
|
@@ -2686,11 +2724,11 @@
|
|
|
2686
2724
|
|
|
2687
2725
|
return drawCircle(parentGfx, element.width, element.height, attrs);
|
|
2688
2726
|
},
|
|
2689
|
-
'bpmn:StartEvent': function(parentGfx, element
|
|
2690
|
-
attrs =
|
|
2727
|
+
'bpmn:StartEvent': function(parentGfx, element) {
|
|
2728
|
+
var attrs = {
|
|
2691
2729
|
fill: getFillColor(element, defaultFillColor),
|
|
2692
2730
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2693
|
-
}
|
|
2731
|
+
};
|
|
2694
2732
|
|
|
2695
2733
|
var semantic = getSemantic(element);
|
|
2696
2734
|
|
|
@@ -2709,7 +2747,7 @@
|
|
|
2709
2747
|
|
|
2710
2748
|
return circle;
|
|
2711
2749
|
},
|
|
2712
|
-
'bpmn:MessageEventDefinition': function(parentGfx, element,
|
|
2750
|
+
'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {
|
|
2713
2751
|
var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
|
|
2714
2752
|
xScaleFactor: 0.9,
|
|
2715
2753
|
yScaleFactor: 0.9,
|
|
@@ -2724,24 +2762,20 @@
|
|
|
2724
2762
|
var fill = isThrowing ? getStrokeColor(element, defaultStrokeColor) : getFillColor(element, defaultFillColor);
|
|
2725
2763
|
var stroke = isThrowing ? getFillColor(element, defaultFillColor) : getStrokeColor(element, defaultStrokeColor);
|
|
2726
2764
|
|
|
2727
|
-
|
|
2765
|
+
var messagePath = drawPath(parentGfx, pathData, {
|
|
2728
2766
|
strokeWidth: 1,
|
|
2729
2767
|
fill: fill,
|
|
2730
2768
|
stroke: stroke
|
|
2731
|
-
}
|
|
2732
|
-
|
|
2733
|
-
var messagePath = drawPath(parentGfx, pathData, attrs);
|
|
2769
|
+
});
|
|
2734
2770
|
|
|
2735
2771
|
return messagePath;
|
|
2736
2772
|
},
|
|
2737
|
-
'bpmn:TimerEventDefinition': function(parentGfx, element
|
|
2738
|
-
var
|
|
2773
|
+
'bpmn:TimerEventDefinition': function(parentGfx, element) {
|
|
2774
|
+
var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
|
|
2739
2775
|
strokeWidth: 2,
|
|
2740
2776
|
fill: getFillColor(element, defaultFillColor),
|
|
2741
2777
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2742
|
-
}
|
|
2743
|
-
|
|
2744
|
-
var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, outerAttrs);
|
|
2778
|
+
});
|
|
2745
2779
|
|
|
2746
2780
|
var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
|
|
2747
2781
|
xScaleFactor: 0.75,
|
|
@@ -2754,13 +2788,11 @@
|
|
|
2754
2788
|
}
|
|
2755
2789
|
});
|
|
2756
2790
|
|
|
2757
|
-
|
|
2791
|
+
drawPath(parentGfx, pathData, {
|
|
2758
2792
|
strokeWidth: 2,
|
|
2759
2793
|
strokeLinecap: 'square',
|
|
2760
2794
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2761
|
-
}
|
|
2762
|
-
|
|
2763
|
-
drawPath(parentGfx, pathData, innerAttrs);
|
|
2795
|
+
});
|
|
2764
2796
|
|
|
2765
2797
|
for (var i = 0;i < 12; i++) {
|
|
2766
2798
|
|
|
@@ -2778,25 +2810,17 @@
|
|
|
2778
2810
|
var width = element.width / 2;
|
|
2779
2811
|
var height = element.height / 2;
|
|
2780
2812
|
|
|
2781
|
-
|
|
2813
|
+
drawPath(parentGfx, linePathData, {
|
|
2782
2814
|
strokeWidth: 1,
|
|
2783
2815
|
strokeLinecap: 'square',
|
|
2784
2816
|
transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
|
|
2785
2817
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
|
-
drawPath(parentGfx, linePathData, lineAttrs);
|
|
2818
|
+
});
|
|
2789
2819
|
}
|
|
2790
2820
|
|
|
2791
2821
|
return circle;
|
|
2792
2822
|
},
|
|
2793
|
-
'bpmn:EscalationEventDefinition': function(parentGfx, event,
|
|
2794
|
-
attrs = assign({
|
|
2795
|
-
strokeWidth: 1,
|
|
2796
|
-
fill: fill,
|
|
2797
|
-
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2798
|
-
}, attrs);
|
|
2799
|
-
|
|
2823
|
+
'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {
|
|
2800
2824
|
var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
|
|
2801
2825
|
xScaleFactor: 1,
|
|
2802
2826
|
yScaleFactor: 1,
|
|
@@ -2810,14 +2834,13 @@
|
|
|
2810
2834
|
|
|
2811
2835
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
|
2812
2836
|
|
|
2813
|
-
return drawPath(parentGfx, pathData,
|
|
2814
|
-
},
|
|
2815
|
-
'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs) {
|
|
2816
|
-
attrs = assign({
|
|
2837
|
+
return drawPath(parentGfx, pathData, {
|
|
2817
2838
|
strokeWidth: 1,
|
|
2839
|
+
fill: fill,
|
|
2818
2840
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2841
|
+
});
|
|
2842
|
+
},
|
|
2843
|
+
'bpmn:ConditionalEventDefinition': function(parentGfx, event) {
|
|
2821
2844
|
var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
|
|
2822
2845
|
xScaleFactor: 1,
|
|
2823
2846
|
yScaleFactor: 1,
|
|
@@ -2829,9 +2852,12 @@
|
|
|
2829
2852
|
}
|
|
2830
2853
|
});
|
|
2831
2854
|
|
|
2832
|
-
return drawPath(parentGfx, pathData,
|
|
2855
|
+
return drawPath(parentGfx, pathData, {
|
|
2856
|
+
strokeWidth: 1,
|
|
2857
|
+
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2858
|
+
});
|
|
2833
2859
|
},
|
|
2834
|
-
'bpmn:LinkEventDefinition': function(parentGfx, event,
|
|
2860
|
+
'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {
|
|
2835
2861
|
var pathData = pathMap.getScaledPath('EVENT_LINK', {
|
|
2836
2862
|
xScaleFactor: 1,
|
|
2837
2863
|
yScaleFactor: 1,
|
|
@@ -2845,15 +2871,13 @@
|
|
|
2845
2871
|
|
|
2846
2872
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
|
2847
2873
|
|
|
2848
|
-
|
|
2874
|
+
return drawPath(parentGfx, pathData, {
|
|
2849
2875
|
strokeWidth: 1,
|
|
2850
2876
|
fill: fill,
|
|
2851
2877
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2854
|
-
return drawPath(parentGfx, pathData, attrs);
|
|
2878
|
+
});
|
|
2855
2879
|
},
|
|
2856
|
-
'bpmn:ErrorEventDefinition': function(parentGfx, event,
|
|
2880
|
+
'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {
|
|
2857
2881
|
var pathData = pathMap.getScaledPath('EVENT_ERROR', {
|
|
2858
2882
|
xScaleFactor: 1.1,
|
|
2859
2883
|
yScaleFactor: 1.1,
|
|
@@ -2867,15 +2891,13 @@
|
|
|
2867
2891
|
|
|
2868
2892
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
|
2869
2893
|
|
|
2870
|
-
|
|
2894
|
+
return drawPath(parentGfx, pathData, {
|
|
2871
2895
|
strokeWidth: 1,
|
|
2872
2896
|
fill: fill,
|
|
2873
2897
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2874
|
-
}
|
|
2875
|
-
|
|
2876
|
-
return drawPath(parentGfx, pathData, attrs);
|
|
2898
|
+
});
|
|
2877
2899
|
},
|
|
2878
|
-
'bpmn:CancelEventDefinition': function(parentGfx, event,
|
|
2900
|
+
'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {
|
|
2879
2901
|
var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
|
|
2880
2902
|
xScaleFactor: 1.0,
|
|
2881
2903
|
yScaleFactor: 1.0,
|
|
@@ -2889,19 +2911,17 @@
|
|
|
2889
2911
|
|
|
2890
2912
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
|
2891
2913
|
|
|
2892
|
-
|
|
2914
|
+
var path = drawPath(parentGfx, pathData, {
|
|
2893
2915
|
strokeWidth: 1,
|
|
2894
2916
|
fill: fill,
|
|
2895
2917
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2896
|
-
}
|
|
2897
|
-
|
|
2898
|
-
var path = drawPath(parentGfx, pathData, attrs);
|
|
2918
|
+
});
|
|
2899
2919
|
|
|
2900
2920
|
rotate(path, 45);
|
|
2901
2921
|
|
|
2902
2922
|
return path;
|
|
2903
2923
|
},
|
|
2904
|
-
'bpmn:CompensateEventDefinition': function(parentGfx, event,
|
|
2924
|
+
'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {
|
|
2905
2925
|
var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
|
|
2906
2926
|
xScaleFactor: 1,
|
|
2907
2927
|
yScaleFactor: 1,
|
|
@@ -2915,15 +2935,13 @@
|
|
|
2915
2935
|
|
|
2916
2936
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
|
2917
2937
|
|
|
2918
|
-
|
|
2938
|
+
return drawPath(parentGfx, pathData, {
|
|
2919
2939
|
strokeWidth: 1,
|
|
2920
2940
|
fill: fill,
|
|
2921
2941
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2922
|
-
}
|
|
2923
|
-
|
|
2924
|
-
return drawPath(parentGfx, pathData, attrs);
|
|
2942
|
+
});
|
|
2925
2943
|
},
|
|
2926
|
-
'bpmn:SignalEventDefinition': function(parentGfx, event,
|
|
2944
|
+
'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {
|
|
2927
2945
|
var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
|
|
2928
2946
|
xScaleFactor: 0.9,
|
|
2929
2947
|
yScaleFactor: 0.9,
|
|
@@ -2937,15 +2955,13 @@
|
|
|
2937
2955
|
|
|
2938
2956
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
|
2939
2957
|
|
|
2940
|
-
|
|
2958
|
+
return drawPath(parentGfx, pathData, {
|
|
2941
2959
|
strokeWidth: 1,
|
|
2942
2960
|
fill: fill,
|
|
2943
2961
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2944
|
-
}
|
|
2945
|
-
|
|
2946
|
-
return drawPath(parentGfx, pathData, attrs);
|
|
2962
|
+
});
|
|
2947
2963
|
},
|
|
2948
|
-
'bpmn:MultipleEventDefinition': function(parentGfx, event,
|
|
2964
|
+
'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {
|
|
2949
2965
|
var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
|
|
2950
2966
|
xScaleFactor: 1.1,
|
|
2951
2967
|
yScaleFactor: 1.1,
|
|
@@ -2959,14 +2975,12 @@
|
|
|
2959
2975
|
|
|
2960
2976
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
|
2961
2977
|
|
|
2962
|
-
|
|
2978
|
+
return drawPath(parentGfx, pathData, {
|
|
2963
2979
|
strokeWidth: 1,
|
|
2964
2980
|
fill: fill
|
|
2965
|
-
}
|
|
2966
|
-
|
|
2967
|
-
return drawPath(parentGfx, pathData, attrs);
|
|
2981
|
+
});
|
|
2968
2982
|
},
|
|
2969
|
-
'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event
|
|
2983
|
+
'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {
|
|
2970
2984
|
var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
|
|
2971
2985
|
xScaleFactor: 1.2,
|
|
2972
2986
|
yScaleFactor: 1.2,
|
|
@@ -2978,54 +2992,47 @@
|
|
|
2978
2992
|
}
|
|
2979
2993
|
});
|
|
2980
2994
|
|
|
2981
|
-
|
|
2995
|
+
return drawPath(parentGfx, pathData, {
|
|
2982
2996
|
strokeWidth: 1,
|
|
2983
2997
|
fill: getStrokeColor(event, defaultStrokeColor),
|
|
2984
2998
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
2985
|
-
}
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
return drawPath(parentGfx, pathData, attrs);
|
|
2999
|
+
});
|
|
2989
3000
|
},
|
|
2990
|
-
'bpmn:EndEvent': function(parentGfx, element
|
|
2991
|
-
var
|
|
3001
|
+
'bpmn:EndEvent': function(parentGfx, element) {
|
|
3002
|
+
var circle = renderer('bpmn:Event')(parentGfx, element, {
|
|
2992
3003
|
strokeWidth: 4,
|
|
2993
3004
|
fill: getFillColor(element, defaultFillColor),
|
|
2994
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2995
|
-
}
|
|
2996
|
-
|
|
2997
|
-
var circle = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
|
|
3005
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3006
|
+
});
|
|
2998
3007
|
|
|
2999
|
-
renderEventContent(element, parentGfx
|
|
3008
|
+
renderEventContent(element, parentGfx);
|
|
3000
3009
|
|
|
3001
3010
|
return circle;
|
|
3002
3011
|
},
|
|
3003
|
-
'bpmn:TerminateEventDefinition': function(parentGfx, element
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
var circle = drawCircle(parentGfx, element.width, element.height, 8, attrs);
|
|
3012
|
+
'bpmn:TerminateEventDefinition': function(parentGfx, element) {
|
|
3013
|
+
var circle = drawCircle(parentGfx, element.width, element.height, 8, {
|
|
3014
|
+
strokeWidth: 4,
|
|
3015
|
+
fill: getStrokeColor(element, defaultStrokeColor),
|
|
3016
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3017
|
+
});
|
|
3011
3018
|
|
|
3012
3019
|
return circle;
|
|
3013
3020
|
},
|
|
3014
|
-
'bpmn:IntermediateEvent': function(parentGfx, element
|
|
3015
|
-
var
|
|
3021
|
+
'bpmn:IntermediateEvent': function(parentGfx, element) {
|
|
3022
|
+
var outer = renderer('bpmn:Event')(parentGfx, element, {
|
|
3016
3023
|
strokeWidth: 1,
|
|
3017
3024
|
fill: getFillColor(element, defaultFillColor),
|
|
3018
3025
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3019
|
-
}
|
|
3020
|
-
|
|
3021
|
-
var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
|
|
3026
|
+
});
|
|
3022
3027
|
|
|
3023
3028
|
/* inner */
|
|
3024
|
-
drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST,
|
|
3029
|
+
drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
|
|
3030
|
+
strokeWidth: 1,
|
|
3025
3031
|
fill: getFillColor(element, 'none'),
|
|
3026
|
-
|
|
3032
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3033
|
+
});
|
|
3027
3034
|
|
|
3028
|
-
renderEventContent(element, parentGfx
|
|
3035
|
+
renderEventContent(element, parentGfx);
|
|
3029
3036
|
|
|
3030
3037
|
return outer;
|
|
3031
3038
|
},
|
|
@@ -3043,21 +3050,21 @@
|
|
|
3043
3050
|
return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
|
|
3044
3051
|
},
|
|
3045
3052
|
|
|
3046
|
-
'bpmn:Task': function(parentGfx, element
|
|
3047
|
-
attrs =
|
|
3053
|
+
'bpmn:Task': function(parentGfx, element) {
|
|
3054
|
+
var attrs = {
|
|
3048
3055
|
fill: getFillColor(element, defaultFillColor),
|
|
3049
3056
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3050
|
-
}
|
|
3057
|
+
};
|
|
3051
3058
|
|
|
3052
3059
|
var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
|
|
3053
3060
|
|
|
3054
3061
|
renderEmbeddedLabel(parentGfx, element, 'center-middle');
|
|
3055
|
-
attachTaskMarkers(parentGfx, element
|
|
3062
|
+
attachTaskMarkers(parentGfx, element);
|
|
3056
3063
|
|
|
3057
3064
|
return rect;
|
|
3058
3065
|
},
|
|
3059
|
-
'bpmn:ServiceTask': function(parentGfx, element
|
|
3060
|
-
var task = renderer('bpmn:Task')(parentGfx, element
|
|
3066
|
+
'bpmn:ServiceTask': function(parentGfx, element) {
|
|
3067
|
+
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3061
3068
|
|
|
3062
3069
|
var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
|
|
3063
3070
|
abspos: {
|
|
@@ -3066,12 +3073,11 @@
|
|
|
3066
3073
|
}
|
|
3067
3074
|
});
|
|
3068
3075
|
|
|
3069
|
-
|
|
3076
|
+
/* service bg */ drawPath(parentGfx, pathDataBG, {
|
|
3070
3077
|
strokeWidth: 1,
|
|
3071
3078
|
fill: getFillColor(element, defaultFillColor),
|
|
3072
3079
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3073
|
-
}
|
|
3074
|
-
/* service bg */ drawPath(parentGfx, pathDataBG, serviceAttrs);
|
|
3080
|
+
});
|
|
3075
3081
|
|
|
3076
3082
|
var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
|
|
3077
3083
|
abspos: {
|
|
@@ -3080,11 +3086,10 @@
|
|
|
3080
3086
|
}
|
|
3081
3087
|
});
|
|
3082
3088
|
|
|
3083
|
-
|
|
3089
|
+
/* service fill */ drawPath(parentGfx, fillPathData, {
|
|
3084
3090
|
strokeWidth: 0,
|
|
3085
3091
|
fill: getFillColor(element, defaultFillColor)
|
|
3086
|
-
}
|
|
3087
|
-
/* service fill */ drawPath(parentGfx, fillPathData, fillAttrs);
|
|
3092
|
+
});
|
|
3088
3093
|
|
|
3089
3094
|
var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
|
|
3090
3095
|
abspos: {
|
|
@@ -3093,12 +3098,16 @@
|
|
|
3093
3098
|
}
|
|
3094
3099
|
});
|
|
3095
3100
|
|
|
3096
|
-
/* service */ drawPath(parentGfx, pathData,
|
|
3101
|
+
/* service */ drawPath(parentGfx, pathData, {
|
|
3102
|
+
strokeWidth: 1,
|
|
3103
|
+
fill: getFillColor(element, defaultFillColor),
|
|
3104
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3105
|
+
});
|
|
3097
3106
|
|
|
3098
3107
|
return task;
|
|
3099
3108
|
},
|
|
3100
|
-
'bpmn:UserTask': function(parentGfx, element
|
|
3101
|
-
var task = renderer('bpmn:Task')(parentGfx, element
|
|
3109
|
+
'bpmn:UserTask': function(parentGfx, element) {
|
|
3110
|
+
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3102
3111
|
|
|
3103
3112
|
var x = 15;
|
|
3104
3113
|
var y = 12;
|
|
@@ -3110,12 +3119,11 @@
|
|
|
3110
3119
|
}
|
|
3111
3120
|
});
|
|
3112
3121
|
|
|
3113
|
-
|
|
3122
|
+
/* user path */ drawPath(parentGfx, pathData, {
|
|
3114
3123
|
strokeWidth: 0.5,
|
|
3115
3124
|
fill: getFillColor(element, defaultFillColor),
|
|
3116
3125
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3117
|
-
}
|
|
3118
|
-
/* user path */ drawPath(parentGfx, pathData, userAttrs);
|
|
3126
|
+
});
|
|
3119
3127
|
|
|
3120
3128
|
var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
|
|
3121
3129
|
abspos: {
|
|
@@ -3124,7 +3132,11 @@
|
|
|
3124
3132
|
}
|
|
3125
3133
|
});
|
|
3126
3134
|
|
|
3127
|
-
/* user2 path */ drawPath(parentGfx, pathData2,
|
|
3135
|
+
/* user2 path */ drawPath(parentGfx, pathData2, {
|
|
3136
|
+
strokeWidth: 0.5,
|
|
3137
|
+
fill: getFillColor(element, defaultFillColor),
|
|
3138
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3139
|
+
});
|
|
3128
3140
|
|
|
3129
3141
|
var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
|
|
3130
3142
|
abspos: {
|
|
@@ -3133,12 +3145,16 @@
|
|
|
3133
3145
|
}
|
|
3134
3146
|
});
|
|
3135
3147
|
|
|
3136
|
-
/* user3 path */ drawPath(parentGfx, pathData3,
|
|
3148
|
+
/* user3 path */ drawPath(parentGfx, pathData3, {
|
|
3149
|
+
strokeWidth: 0.5,
|
|
3150
|
+
fill: getStrokeColor(element, defaultStrokeColor),
|
|
3151
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3152
|
+
});
|
|
3137
3153
|
|
|
3138
3154
|
return task;
|
|
3139
3155
|
},
|
|
3140
|
-
'bpmn:ManualTask': function(parentGfx, element
|
|
3141
|
-
var task = renderer('bpmn:Task')(parentGfx, element
|
|
3156
|
+
'bpmn:ManualTask': function(parentGfx, element) {
|
|
3157
|
+
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3142
3158
|
|
|
3143
3159
|
var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
|
|
3144
3160
|
abspos: {
|
|
@@ -3147,17 +3163,16 @@
|
|
|
3147
3163
|
}
|
|
3148
3164
|
});
|
|
3149
3165
|
|
|
3150
|
-
|
|
3166
|
+
/* manual path */ drawPath(parentGfx, pathData, {
|
|
3151
3167
|
strokeWidth: 0.5, // 0.25,
|
|
3152
3168
|
fill: getFillColor(element, defaultFillColor),
|
|
3153
3169
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3154
|
-
}
|
|
3155
|
-
/* manual path */ drawPath(parentGfx, pathData, manualAttrs);
|
|
3170
|
+
});
|
|
3156
3171
|
|
|
3157
3172
|
return task;
|
|
3158
3173
|
},
|
|
3159
|
-
'bpmn:SendTask': function(parentGfx, element
|
|
3160
|
-
var task = renderer('bpmn:Task')(parentGfx, element
|
|
3174
|
+
'bpmn:SendTask': function(parentGfx, element) {
|
|
3175
|
+
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3161
3176
|
|
|
3162
3177
|
var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
|
|
3163
3178
|
xScaleFactor: 1,
|
|
@@ -3170,25 +3185,22 @@
|
|
|
3170
3185
|
}
|
|
3171
3186
|
});
|
|
3172
3187
|
|
|
3173
|
-
/* send path */
|
|
3174
|
-
var pathAttrs = assign({
|
|
3188
|
+
/* send path */ drawPath(parentGfx, pathData, {
|
|
3175
3189
|
strokeWidth: 1,
|
|
3176
3190
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
3177
3191
|
stroke: getFillColor(element, defaultFillColor)
|
|
3178
|
-
}
|
|
3179
|
-
|
|
3180
|
-
drawPath(parentGfx, pathData, pathAttrs);
|
|
3192
|
+
});
|
|
3181
3193
|
|
|
3182
3194
|
return task;
|
|
3183
3195
|
},
|
|
3184
|
-
'bpmn:ReceiveTask' : function(parentGfx, element
|
|
3196
|
+
'bpmn:ReceiveTask' : function(parentGfx, element) {
|
|
3185
3197
|
var semantic = getSemantic(element);
|
|
3186
3198
|
|
|
3187
|
-
var task = renderer('bpmn:Task')(parentGfx, element
|
|
3199
|
+
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3188
3200
|
var pathData;
|
|
3189
3201
|
|
|
3190
3202
|
if (semantic.instantiate) {
|
|
3191
|
-
drawCircle(parentGfx, 28, 28, 20 * 0.22,
|
|
3203
|
+
drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });
|
|
3192
3204
|
|
|
3193
3205
|
pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
|
|
3194
3206
|
abspos: {
|
|
@@ -3210,18 +3222,16 @@
|
|
|
3210
3222
|
});
|
|
3211
3223
|
}
|
|
3212
3224
|
|
|
3213
|
-
|
|
3225
|
+
/* receive path */ drawPath(parentGfx, pathData, {
|
|
3214
3226
|
strokeWidth: 1,
|
|
3215
3227
|
fill: getFillColor(element, defaultFillColor),
|
|
3216
3228
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3217
|
-
}
|
|
3218
|
-
|
|
3219
|
-
/* receive path */ drawPath(parentGfx, pathData, receiveAttrs);
|
|
3229
|
+
});
|
|
3220
3230
|
|
|
3221
3231
|
return task;
|
|
3222
3232
|
},
|
|
3223
|
-
'bpmn:ScriptTask': function(parentGfx, element
|
|
3224
|
-
var task = renderer('bpmn:Task')(parentGfx, element
|
|
3233
|
+
'bpmn:ScriptTask': function(parentGfx, element) {
|
|
3234
|
+
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3225
3235
|
|
|
3226
3236
|
var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
|
|
3227
3237
|
abspos: {
|
|
@@ -3230,16 +3240,15 @@
|
|
|
3230
3240
|
}
|
|
3231
3241
|
});
|
|
3232
3242
|
|
|
3233
|
-
|
|
3243
|
+
/* script path */ drawPath(parentGfx, pathData, {
|
|
3234
3244
|
strokeWidth: 1,
|
|
3235
3245
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3236
|
-
}
|
|
3237
|
-
/* script path */ drawPath(parentGfx, pathData, scriptAttrs);
|
|
3246
|
+
});
|
|
3238
3247
|
|
|
3239
3248
|
return task;
|
|
3240
3249
|
},
|
|
3241
|
-
'bpmn:BusinessRuleTask': function(parentGfx, element
|
|
3242
|
-
var task = renderer('bpmn:Task')(parentGfx, element
|
|
3250
|
+
'bpmn:BusinessRuleTask': function(parentGfx, element) {
|
|
3251
|
+
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3243
3252
|
|
|
3244
3253
|
var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
|
|
3245
3254
|
abspos: {
|
|
@@ -3248,12 +3257,12 @@
|
|
|
3248
3257
|
}
|
|
3249
3258
|
});
|
|
3250
3259
|
|
|
3251
|
-
var
|
|
3260
|
+
var businessHeaderPath = drawPath(parentGfx, headerPathData);
|
|
3261
|
+
attr$1(businessHeaderPath, {
|
|
3252
3262
|
strokeWidth: 1,
|
|
3253
3263
|
fill: getFillColor(element, '#aaaaaa'),
|
|
3254
3264
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3255
|
-
}
|
|
3256
|
-
drawPath(parentGfx, headerPathData, headerAttrs);
|
|
3265
|
+
});
|
|
3257
3266
|
|
|
3258
3267
|
var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
|
|
3259
3268
|
abspos: {
|
|
@@ -3262,11 +3271,11 @@
|
|
|
3262
3271
|
}
|
|
3263
3272
|
});
|
|
3264
3273
|
|
|
3265
|
-
var
|
|
3274
|
+
var businessPath = drawPath(parentGfx, headerData);
|
|
3275
|
+
attr$1(businessPath, {
|
|
3266
3276
|
strokeWidth: 1,
|
|
3267
3277
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3268
|
-
}
|
|
3269
|
-
drawPath(parentGfx, headerData, businessAttrs);
|
|
3278
|
+
});
|
|
3270
3279
|
|
|
3271
3280
|
return task;
|
|
3272
3281
|
},
|
|
@@ -3289,42 +3298,41 @@
|
|
|
3289
3298
|
renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle');
|
|
3290
3299
|
|
|
3291
3300
|
if (expanded) {
|
|
3292
|
-
attachTaskMarkers(parentGfx, element
|
|
3301
|
+
attachTaskMarkers(parentGfx, element);
|
|
3293
3302
|
} else {
|
|
3294
|
-
attachTaskMarkers(parentGfx, element,
|
|
3303
|
+
attachTaskMarkers(parentGfx, element, ['SubProcessMarker']);
|
|
3295
3304
|
}
|
|
3296
3305
|
|
|
3297
3306
|
return rect;
|
|
3298
3307
|
},
|
|
3299
|
-
'bpmn:AdHocSubProcess': function(parentGfx, element
|
|
3300
|
-
return renderer('bpmn:SubProcess')(parentGfx, element
|
|
3308
|
+
'bpmn:AdHocSubProcess': function(parentGfx, element) {
|
|
3309
|
+
return renderer('bpmn:SubProcess')(parentGfx, element);
|
|
3301
3310
|
},
|
|
3302
|
-
'bpmn:Transaction': function(parentGfx, element
|
|
3303
|
-
var outer = renderer('bpmn:SubProcess')(parentGfx, element
|
|
3311
|
+
'bpmn:Transaction': function(parentGfx, element) {
|
|
3312
|
+
var outer = renderer('bpmn:SubProcess')(parentGfx, element);
|
|
3304
3313
|
|
|
3305
3314
|
var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
|
|
3306
3315
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3307
3316
|
});
|
|
3308
3317
|
|
|
3309
|
-
/* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST,
|
|
3318
|
+
/* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
|
|
3310
3319
|
|
|
3311
3320
|
return outer;
|
|
3312
3321
|
},
|
|
3313
|
-
'bpmn:CallActivity': function(parentGfx, element
|
|
3314
|
-
|
|
3322
|
+
'bpmn:CallActivity': function(parentGfx, element) {
|
|
3323
|
+
return renderer('bpmn:SubProcess')(parentGfx, element, {
|
|
3315
3324
|
strokeWidth: 5
|
|
3316
|
-
}
|
|
3317
|
-
|
|
3318
|
-
return renderer('bpmn:SubProcess')(parentGfx, element, attrs);
|
|
3325
|
+
});
|
|
3319
3326
|
},
|
|
3320
|
-
'bpmn:Participant': function(parentGfx, element
|
|
3321
|
-
|
|
3327
|
+
'bpmn:Participant': function(parentGfx, element) {
|
|
3328
|
+
|
|
3329
|
+
var attrs = {
|
|
3322
3330
|
fillOpacity: DEFAULT_FILL_OPACITY,
|
|
3323
3331
|
fill: getFillColor(element, defaultFillColor),
|
|
3324
3332
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3325
|
-
}
|
|
3333
|
+
};
|
|
3326
3334
|
|
|
3327
|
-
var lane = renderer('bpmn:Lane')(parentGfx, element,
|
|
3335
|
+
var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
|
|
3328
3336
|
|
|
3329
3337
|
var expandedPool = isExpanded(element);
|
|
3330
3338
|
|
|
@@ -3332,9 +3340,9 @@
|
|
|
3332
3340
|
drawLine(parentGfx, [
|
|
3333
3341
|
{ x: 30, y: 0 },
|
|
3334
3342
|
{ x: 30, y: element.height }
|
|
3335
|
-
],
|
|
3343
|
+
], {
|
|
3336
3344
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3337
|
-
}
|
|
3345
|
+
});
|
|
3338
3346
|
var text = getSemantic(element).name;
|
|
3339
3347
|
renderLaneLabel(parentGfx, text, element);
|
|
3340
3348
|
} else {
|
|
@@ -3352,7 +3360,7 @@
|
|
|
3352
3360
|
var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
|
|
3353
3361
|
|
|
3354
3362
|
if (participantMultiplicity) {
|
|
3355
|
-
renderer('ParticipantMultiplicityMarker')(parentGfx, element
|
|
3363
|
+
renderer('ParticipantMultiplicityMarker')(parentGfx, element);
|
|
3356
3364
|
}
|
|
3357
3365
|
|
|
3358
3366
|
return lane;
|
|
@@ -3373,23 +3381,20 @@
|
|
|
3373
3381
|
|
|
3374
3382
|
return rect;
|
|
3375
3383
|
},
|
|
3376
|
-
'bpmn:InclusiveGateway': function(parentGfx, element
|
|
3377
|
-
var diamond = renderer('bpmn:Gateway')(parentGfx, element
|
|
3384
|
+
'bpmn:InclusiveGateway': function(parentGfx, element) {
|
|
3385
|
+
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
|
3378
3386
|
|
|
3379
|
-
|
|
3380
|
-
|
|
3387
|
+
/* circle path */
|
|
3388
|
+
drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
|
|
3381
3389
|
strokeWidth: 2.5,
|
|
3382
3390
|
fill: getFillColor(element, defaultFillColor),
|
|
3383
3391
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3384
|
-
}
|
|
3385
|
-
|
|
3386
|
-
/* circle path */
|
|
3387
|
-
drawCircle(parentGfx, element.width, element.height, element.height * 0.24, circleAttrs);
|
|
3392
|
+
});
|
|
3388
3393
|
|
|
3389
3394
|
return diamond;
|
|
3390
3395
|
},
|
|
3391
|
-
'bpmn:ExclusiveGateway': function(parentGfx, element
|
|
3392
|
-
var diamond = renderer('bpmn:Gateway')(parentGfx, element
|
|
3396
|
+
'bpmn:ExclusiveGateway': function(parentGfx, element) {
|
|
3397
|
+
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
|
3393
3398
|
|
|
3394
3399
|
var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
|
|
3395
3400
|
xScaleFactor: 0.4,
|
|
@@ -3403,17 +3408,17 @@
|
|
|
3403
3408
|
});
|
|
3404
3409
|
|
|
3405
3410
|
if ((getDi(element).isMarkerVisible)) {
|
|
3406
|
-
drawPath(parentGfx, pathData,
|
|
3411
|
+
drawPath(parentGfx, pathData, {
|
|
3407
3412
|
strokeWidth: 1,
|
|
3408
3413
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
3409
3414
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3410
|
-
}
|
|
3415
|
+
});
|
|
3411
3416
|
}
|
|
3412
3417
|
|
|
3413
3418
|
return diamond;
|
|
3414
3419
|
},
|
|
3415
|
-
'bpmn:ComplexGateway': function(parentGfx, element
|
|
3416
|
-
var diamond = renderer('bpmn:Gateway')(parentGfx, element
|
|
3420
|
+
'bpmn:ComplexGateway': function(parentGfx, element) {
|
|
3421
|
+
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
|
3417
3422
|
|
|
3418
3423
|
var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
|
|
3419
3424
|
xScaleFactor: 0.5,
|
|
@@ -3426,17 +3431,16 @@
|
|
|
3426
3431
|
}
|
|
3427
3432
|
});
|
|
3428
3433
|
|
|
3429
|
-
|
|
3434
|
+
/* complex path */ drawPath(parentGfx, pathData, {
|
|
3430
3435
|
strokeWidth: 1,
|
|
3431
3436
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
3432
3437
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3433
|
-
}
|
|
3434
|
-
/* complex path */ drawPath(parentGfx, pathData, innerAttrs);
|
|
3438
|
+
});
|
|
3435
3439
|
|
|
3436
3440
|
return diamond;
|
|
3437
3441
|
},
|
|
3438
|
-
'bpmn:ParallelGateway': function(parentGfx, element
|
|
3439
|
-
var diamond = renderer('bpmn:Gateway')(parentGfx, element
|
|
3442
|
+
'bpmn:ParallelGateway': function(parentGfx, element) {
|
|
3443
|
+
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
|
3440
3444
|
|
|
3441
3445
|
var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
|
|
3442
3446
|
xScaleFactor: 0.6,
|
|
@@ -3449,27 +3453,25 @@
|
|
|
3449
3453
|
}
|
|
3450
3454
|
});
|
|
3451
3455
|
|
|
3452
|
-
|
|
3456
|
+
/* parallel path */ drawPath(parentGfx, pathData, {
|
|
3453
3457
|
strokeWidth: 1,
|
|
3454
3458
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
3455
3459
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3456
|
-
}
|
|
3457
|
-
/* parallel path */ drawPath(parentGfx, pathData, innerAttrs);
|
|
3460
|
+
});
|
|
3458
3461
|
|
|
3459
3462
|
return diamond;
|
|
3460
3463
|
},
|
|
3461
|
-
'bpmn:EventBasedGateway': function(parentGfx, element
|
|
3464
|
+
'bpmn:EventBasedGateway': function(parentGfx, element) {
|
|
3462
3465
|
|
|
3463
3466
|
var semantic = getSemantic(element);
|
|
3464
3467
|
|
|
3465
|
-
var diamond = renderer('bpmn:Gateway')(parentGfx, element
|
|
3468
|
+
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
|
3466
3469
|
|
|
3467
|
-
|
|
3470
|
+
/* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
|
|
3468
3471
|
strokeWidth: 1,
|
|
3469
3472
|
fill: 'none',
|
|
3470
3473
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3471
|
-
}
|
|
3472
|
-
/* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, outerAttrs);
|
|
3474
|
+
});
|
|
3473
3475
|
|
|
3474
3476
|
var type = semantic.eventGatewayType;
|
|
3475
3477
|
var instantiate = !!semantic.instantiate;
|
|
@@ -3487,12 +3489,13 @@
|
|
|
3487
3489
|
}
|
|
3488
3490
|
});
|
|
3489
3491
|
|
|
3490
|
-
var
|
|
3492
|
+
var attrs = {
|
|
3491
3493
|
strokeWidth: 2,
|
|
3492
3494
|
fill: getFillColor(element, 'none'),
|
|
3493
3495
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3494
|
-
}
|
|
3495
|
-
|
|
3496
|
+
};
|
|
3497
|
+
|
|
3498
|
+
/* event path */ drawPath(parentGfx, pathData, attrs);
|
|
3496
3499
|
}
|
|
3497
3500
|
|
|
3498
3501
|
if (type === 'Parallel') {
|
|
@@ -3508,7 +3511,7 @@
|
|
|
3508
3511
|
}
|
|
3509
3512
|
});
|
|
3510
3513
|
|
|
3511
|
-
var parallelPath = drawPath(parentGfx, pathData
|
|
3514
|
+
var parallelPath = drawPath(parentGfx, pathData);
|
|
3512
3515
|
attr$1(parallelPath, {
|
|
3513
3516
|
strokeWidth: 1,
|
|
3514
3517
|
fill: 'none'
|
|
@@ -3516,12 +3519,12 @@
|
|
|
3516
3519
|
} else if (type === 'Exclusive') {
|
|
3517
3520
|
|
|
3518
3521
|
if (!instantiate) {
|
|
3519
|
-
var
|
|
3522
|
+
var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
|
|
3523
|
+
attr$1(innerCircle, {
|
|
3520
3524
|
strokeWidth: 1,
|
|
3521
3525
|
fill: 'none',
|
|
3522
3526
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3523
|
-
}
|
|
3524
|
-
drawCircle(parentGfx, element.width, element.height, element.height * 0.26, innerCircleAttrs);
|
|
3527
|
+
});
|
|
3525
3528
|
}
|
|
3526
3529
|
|
|
3527
3530
|
drawEvent();
|
|
@@ -3530,28 +3533,26 @@
|
|
|
3530
3533
|
|
|
3531
3534
|
return diamond;
|
|
3532
3535
|
},
|
|
3533
|
-
'bpmn:Gateway': function(parentGfx, element
|
|
3534
|
-
attrs =
|
|
3536
|
+
'bpmn:Gateway': function(parentGfx, element) {
|
|
3537
|
+
var attrs = {
|
|
3535
3538
|
fill: getFillColor(element, defaultFillColor),
|
|
3536
3539
|
fillOpacity: DEFAULT_FILL_OPACITY,
|
|
3537
3540
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3538
|
-
}
|
|
3541
|
+
};
|
|
3539
3542
|
|
|
3540
3543
|
return drawDiamond(parentGfx, element.width, element.height, attrs);
|
|
3541
3544
|
},
|
|
3542
|
-
'bpmn:SequenceFlow': function(parentGfx, element
|
|
3543
|
-
attrs = attrs || {};
|
|
3544
|
-
|
|
3545
|
+
'bpmn:SequenceFlow': function(parentGfx, element) {
|
|
3545
3546
|
var pathData = createPathFromConnection(element);
|
|
3546
3547
|
|
|
3547
|
-
var fill =
|
|
3548
|
-
stroke =
|
|
3548
|
+
var fill = getFillColor(element, defaultFillColor),
|
|
3549
|
+
stroke = getStrokeColor(element, defaultStrokeColor);
|
|
3549
3550
|
|
|
3550
|
-
attrs =
|
|
3551
|
+
var attrs = {
|
|
3551
3552
|
strokeLinejoin: 'round',
|
|
3552
3553
|
markerEnd: marker('sequenceflow-end', fill, stroke),
|
|
3553
3554
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3554
|
-
}
|
|
3555
|
+
};
|
|
3555
3556
|
|
|
3556
3557
|
var path = drawPath(parentGfx, pathData, attrs);
|
|
3557
3558
|
|
|
@@ -3605,56 +3606,41 @@
|
|
|
3605
3606
|
|
|
3606
3607
|
return drawLine(parentGfx, element.waypoints, attrs);
|
|
3607
3608
|
},
|
|
3608
|
-
'bpmn:DataInputAssociation': function(parentGfx, element
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
var fill = attrs.fill || getFillColor(element, defaultFillColor),
|
|
3612
|
-
stroke = attrs.stroke || getStrokeColor(element, defaultStrokeColor);
|
|
3609
|
+
'bpmn:DataInputAssociation': function(parentGfx, element) {
|
|
3610
|
+
var fill = getFillColor(element, defaultFillColor),
|
|
3611
|
+
stroke = getStrokeColor(element, defaultStrokeColor);
|
|
3613
3612
|
|
|
3614
|
-
|
|
3615
|
-
fill: fill,
|
|
3616
|
-
stroke: stroke,
|
|
3613
|
+
return renderer('bpmn:Association')(parentGfx, element, {
|
|
3617
3614
|
markerEnd: marker('association-end', fill, stroke)
|
|
3618
|
-
}
|
|
3619
|
-
|
|
3620
|
-
return renderer('bpmn:Association')(parentGfx, element, attrs);
|
|
3615
|
+
});
|
|
3621
3616
|
},
|
|
3622
|
-
'bpmn:DataOutputAssociation': function(parentGfx, element
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
var fill = attrs.fill || getFillColor(element, defaultFillColor),
|
|
3626
|
-
stroke = attrs.stroke || getStrokeColor(element, defaultStrokeColor);
|
|
3627
|
-
|
|
3617
|
+
'bpmn:DataOutputAssociation': function(parentGfx, element) {
|
|
3618
|
+
var fill = getFillColor(element, defaultFillColor),
|
|
3619
|
+
stroke = getStrokeColor(element, defaultStrokeColor);
|
|
3628
3620
|
|
|
3629
|
-
|
|
3630
|
-
fill: fill,
|
|
3631
|
-
stroke: stroke,
|
|
3621
|
+
return renderer('bpmn:Association')(parentGfx, element, {
|
|
3632
3622
|
markerEnd: marker('association-end', fill, stroke)
|
|
3633
|
-
}
|
|
3634
|
-
|
|
3635
|
-
return renderer('bpmn:Association')(parentGfx, element, attrs);
|
|
3623
|
+
});
|
|
3636
3624
|
},
|
|
3637
|
-
'bpmn:MessageFlow': function(parentGfx, element
|
|
3638
|
-
attrs = attrs || {};
|
|
3625
|
+
'bpmn:MessageFlow': function(parentGfx, element) {
|
|
3639
3626
|
|
|
3640
3627
|
var semantic = getSemantic(element),
|
|
3641
3628
|
di = getDi(element);
|
|
3642
3629
|
|
|
3643
|
-
var fill =
|
|
3644
|
-
stroke =
|
|
3630
|
+
var fill = getFillColor(element, defaultFillColor),
|
|
3631
|
+
stroke = getStrokeColor(element, defaultStrokeColor);
|
|
3645
3632
|
|
|
3646
3633
|
var pathData = createPathFromConnection(element);
|
|
3647
3634
|
|
|
3648
|
-
|
|
3649
|
-
attrs = assign({
|
|
3635
|
+
var attrs = {
|
|
3650
3636
|
markerEnd: marker('messageflow-end', fill, stroke),
|
|
3651
3637
|
markerStart: marker('messageflow-start', fill, stroke),
|
|
3652
3638
|
strokeDasharray: '10, 12',
|
|
3653
3639
|
strokeLinecap: 'round',
|
|
3654
3640
|
strokeLinejoin: 'round',
|
|
3655
3641
|
strokeWidth: '1.5px',
|
|
3656
|
-
stroke:
|
|
3657
|
-
}
|
|
3642
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3643
|
+
};
|
|
3658
3644
|
|
|
3659
3645
|
var path = drawPath(parentGfx, pathData, attrs);
|
|
3660
3646
|
|
|
@@ -3701,7 +3687,7 @@
|
|
|
3701
3687
|
|
|
3702
3688
|
return path;
|
|
3703
3689
|
},
|
|
3704
|
-
'bpmn:DataObject': function(parentGfx, element
|
|
3690
|
+
'bpmn:DataObject': function(parentGfx, element) {
|
|
3705
3691
|
var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
|
|
3706
3692
|
xScaleFactor: 1,
|
|
3707
3693
|
yScaleFactor: 1,
|
|
@@ -3713,56 +3699,46 @@
|
|
|
3713
3699
|
}
|
|
3714
3700
|
});
|
|
3715
3701
|
|
|
3716
|
-
var
|
|
3702
|
+
var elementObject = drawPath(parentGfx, pathData, {
|
|
3717
3703
|
fill: getFillColor(element, defaultFillColor),
|
|
3718
3704
|
fillOpacity: DEFAULT_FILL_OPACITY,
|
|
3719
3705
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3720
|
-
}
|
|
3721
|
-
var elementObject = drawPath(parentGfx, pathData, outerAttrs);
|
|
3706
|
+
});
|
|
3722
3707
|
|
|
3723
3708
|
var semantic = getSemantic(element);
|
|
3724
3709
|
|
|
3725
3710
|
if (isCollection(semantic)) {
|
|
3726
|
-
renderDataItemCollection(parentGfx, element
|
|
3711
|
+
renderDataItemCollection(parentGfx, element);
|
|
3727
3712
|
}
|
|
3728
3713
|
|
|
3729
3714
|
return elementObject;
|
|
3730
3715
|
},
|
|
3731
3716
|
'bpmn:DataObjectReference': as('bpmn:DataObject'),
|
|
3732
|
-
'bpmn:DataInput': function(parentGfx, element
|
|
3717
|
+
'bpmn:DataInput': function(parentGfx, element) {
|
|
3733
3718
|
|
|
3734
3719
|
var arrowPathData = pathMap.getRawPath('DATA_ARROW');
|
|
3735
3720
|
|
|
3736
3721
|
// page
|
|
3737
|
-
var elementObject = renderer('bpmn:DataObject')(parentGfx, element
|
|
3722
|
+
var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
|
|
3738
3723
|
|
|
3739
|
-
|
|
3740
|
-
/* input arrow path */ drawPath(parentGfx, arrowPathData, innerAttrs);
|
|
3724
|
+
/* input arrow path */ drawPath(parentGfx, arrowPathData, { strokeWidth: 1 });
|
|
3741
3725
|
|
|
3742
3726
|
return elementObject;
|
|
3743
3727
|
},
|
|
3744
|
-
'bpmn:DataOutput': function(parentGfx, element
|
|
3728
|
+
'bpmn:DataOutput': function(parentGfx, element) {
|
|
3745
3729
|
var arrowPathData = pathMap.getRawPath('DATA_ARROW');
|
|
3746
3730
|
|
|
3747
3731
|
// page
|
|
3748
|
-
var elementObject = renderer('bpmn:DataObject')(parentGfx, element
|
|
3732
|
+
var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
|
|
3749
3733
|
|
|
3750
|
-
|
|
3734
|
+
/* output arrow path */ drawPath(parentGfx, arrowPathData, {
|
|
3751
3735
|
strokeWidth: 1,
|
|
3752
3736
|
fill: 'black'
|
|
3753
|
-
}
|
|
3754
|
-
/* output arrow path */ drawPath(parentGfx, arrowPathData, arrowAttrs);
|
|
3737
|
+
});
|
|
3755
3738
|
|
|
3756
3739
|
return elementObject;
|
|
3757
3740
|
},
|
|
3758
|
-
'bpmn:DataStoreReference': function(parentGfx, element
|
|
3759
|
-
attrs = assign({
|
|
3760
|
-
strokeWidth: 2,
|
|
3761
|
-
fill: getFillColor(element, defaultFillColor),
|
|
3762
|
-
fillOpacity: DEFAULT_FILL_OPACITY,
|
|
3763
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3764
|
-
}, attrs);
|
|
3765
|
-
|
|
3741
|
+
'bpmn:DataStoreReference': function(parentGfx, element) {
|
|
3766
3742
|
var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
|
|
3767
3743
|
xScaleFactor: 1,
|
|
3768
3744
|
yScaleFactor: 1,
|
|
@@ -3774,20 +3750,25 @@
|
|
|
3774
3750
|
}
|
|
3775
3751
|
});
|
|
3776
3752
|
|
|
3777
|
-
var elementStore = drawPath(parentGfx, DATA_STORE_PATH,
|
|
3753
|
+
var elementStore = drawPath(parentGfx, DATA_STORE_PATH, {
|
|
3754
|
+
strokeWidth: 2,
|
|
3755
|
+
fill: getFillColor(element, defaultFillColor),
|
|
3756
|
+
fillOpacity: DEFAULT_FILL_OPACITY,
|
|
3757
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3758
|
+
});
|
|
3778
3759
|
|
|
3779
3760
|
return elementStore;
|
|
3780
3761
|
},
|
|
3781
|
-
'bpmn:BoundaryEvent': function(parentGfx, element
|
|
3762
|
+
'bpmn:BoundaryEvent': function(parentGfx, element) {
|
|
3782
3763
|
|
|
3783
3764
|
var semantic = getSemantic(element),
|
|
3784
3765
|
cancel = semantic.cancelActivity;
|
|
3785
3766
|
|
|
3786
|
-
attrs =
|
|
3767
|
+
var attrs = {
|
|
3787
3768
|
strokeWidth: 1,
|
|
3788
3769
|
fill: getFillColor(element, defaultFillColor),
|
|
3789
3770
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3790
|
-
}
|
|
3771
|
+
};
|
|
3791
3772
|
|
|
3792
3773
|
if (!cancel) {
|
|
3793
3774
|
attrs.strokeDasharray = '6';
|
|
@@ -3808,32 +3789,30 @@
|
|
|
3808
3789
|
|
|
3809
3790
|
/* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, innerAttrs);
|
|
3810
3791
|
|
|
3811
|
-
renderEventContent(element, parentGfx
|
|
3792
|
+
renderEventContent(element, parentGfx);
|
|
3812
3793
|
|
|
3813
3794
|
return outer;
|
|
3814
3795
|
},
|
|
3815
|
-
'bpmn:Group': function(parentGfx, element
|
|
3796
|
+
'bpmn:Group': function(parentGfx, element) {
|
|
3816
3797
|
|
|
3817
|
-
|
|
3798
|
+
var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
|
|
3818
3799
|
stroke: getStrokeColor(element, defaultStrokeColor),
|
|
3819
3800
|
strokeWidth: 1,
|
|
3820
3801
|
strokeDasharray: '8,3,1,3',
|
|
3821
3802
|
fill: 'none',
|
|
3822
3803
|
pointerEvents: 'none'
|
|
3823
|
-
}
|
|
3824
|
-
|
|
3825
|
-
var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
|
|
3804
|
+
});
|
|
3826
3805
|
|
|
3827
3806
|
return group;
|
|
3828
3807
|
},
|
|
3829
3808
|
'label': function(parentGfx, element) {
|
|
3830
3809
|
return renderExternalLabel(parentGfx, element);
|
|
3831
3810
|
},
|
|
3832
|
-
'bpmn:TextAnnotation': function(parentGfx, element
|
|
3833
|
-
var style =
|
|
3811
|
+
'bpmn:TextAnnotation': function(parentGfx, element) {
|
|
3812
|
+
var style = {
|
|
3834
3813
|
'fill': 'none',
|
|
3835
3814
|
'stroke': 'none'
|
|
3836
|
-
}
|
|
3815
|
+
};
|
|
3837
3816
|
|
|
3838
3817
|
var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
|
|
3839
3818
|
|
|
@@ -3848,10 +3827,9 @@
|
|
|
3848
3827
|
}
|
|
3849
3828
|
});
|
|
3850
3829
|
|
|
3851
|
-
|
|
3830
|
+
drawPath(parentGfx, textPathData, {
|
|
3852
3831
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3853
|
-
}
|
|
3854
|
-
drawPath(parentGfx, textPathData, pathAttrs);
|
|
3832
|
+
});
|
|
3855
3833
|
|
|
3856
3834
|
var text = getSemantic(element).text || '';
|
|
3857
3835
|
renderLabel(parentGfx, text, {
|
|
@@ -3865,13 +3843,7 @@
|
|
|
3865
3843
|
|
|
3866
3844
|
return textElement;
|
|
3867
3845
|
},
|
|
3868
|
-
'ParticipantMultiplicityMarker': function(parentGfx, element
|
|
3869
|
-
attrs = assign({
|
|
3870
|
-
strokeWidth: 2,
|
|
3871
|
-
fill: getFillColor(element, defaultFillColor),
|
|
3872
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3873
|
-
}, attrs);
|
|
3874
|
-
|
|
3846
|
+
'ParticipantMultiplicityMarker': function(parentGfx, element) {
|
|
3875
3847
|
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
|
3876
3848
|
xScaleFactor: 1,
|
|
3877
3849
|
yScaleFactor: 1,
|
|
@@ -3883,15 +3855,18 @@
|
|
|
3883
3855
|
}
|
|
3884
3856
|
});
|
|
3885
3857
|
|
|
3886
|
-
drawMarker('participant-multiplicity', parentGfx, markerPath,
|
|
3858
|
+
drawMarker('participant-multiplicity', parentGfx, markerPath, {
|
|
3859
|
+
strokeWidth: 2,
|
|
3860
|
+
fill: getFillColor(element, defaultFillColor),
|
|
3861
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3862
|
+
});
|
|
3887
3863
|
},
|
|
3888
|
-
'SubProcessMarker': function(parentGfx, element
|
|
3889
|
-
|
|
3864
|
+
'SubProcessMarker': function(parentGfx, element) {
|
|
3865
|
+
var markerRect = drawRect(parentGfx, 14, 14, 0, {
|
|
3866
|
+
strokeWidth: 1,
|
|
3890
3867
|
fill: getFillColor(element, defaultFillColor),
|
|
3891
3868
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3892
|
-
}
|
|
3893
|
-
|
|
3894
|
-
var markerRect = drawRect(parentGfx, 14, 14, 0, assign({ strokeWidth: 1 }, attrs));
|
|
3869
|
+
});
|
|
3895
3870
|
|
|
3896
3871
|
// Process marker is placed in the middle of the box
|
|
3897
3872
|
// therefore fixed values can be used here
|
|
@@ -3908,14 +3883,12 @@
|
|
|
3908
3883
|
}
|
|
3909
3884
|
});
|
|
3910
3885
|
|
|
3911
|
-
drawMarker('sub-process', parentGfx, markerPath,
|
|
3912
|
-
},
|
|
3913
|
-
'ParallelMarker': function(parentGfx, element, attrs, position) {
|
|
3914
|
-
attrs = assign({
|
|
3886
|
+
drawMarker('sub-process', parentGfx, markerPath, {
|
|
3915
3887
|
fill: getFillColor(element, defaultFillColor),
|
|
3916
3888
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3917
|
-
}
|
|
3918
|
-
|
|
3889
|
+
});
|
|
3890
|
+
},
|
|
3891
|
+
'ParallelMarker': function(parentGfx, element, position) {
|
|
3919
3892
|
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
|
3920
3893
|
xScaleFactor: 1,
|
|
3921
3894
|
yScaleFactor: 1,
|
|
@@ -3927,13 +3900,12 @@
|
|
|
3927
3900
|
}
|
|
3928
3901
|
});
|
|
3929
3902
|
|
|
3930
|
-
drawMarker('parallel', parentGfx, markerPath,
|
|
3931
|
-
},
|
|
3932
|
-
'SequentialMarker': function(parentGfx, element, attrs, position) {
|
|
3933
|
-
attrs = assign({
|
|
3903
|
+
drawMarker('parallel', parentGfx, markerPath, {
|
|
3934
3904
|
fill: getFillColor(element, defaultFillColor),
|
|
3935
3905
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3936
|
-
}
|
|
3906
|
+
});
|
|
3907
|
+
},
|
|
3908
|
+
'SequentialMarker': function(parentGfx, element, position) {
|
|
3937
3909
|
var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
|
|
3938
3910
|
xScaleFactor: 1,
|
|
3939
3911
|
yScaleFactor: 1,
|
|
@@ -3945,15 +3917,12 @@
|
|
|
3945
3917
|
}
|
|
3946
3918
|
});
|
|
3947
3919
|
|
|
3948
|
-
drawMarker('sequential', parentGfx, markerPath,
|
|
3949
|
-
},
|
|
3950
|
-
'CompensationMarker': function(parentGfx, element, attrs, position) {
|
|
3951
|
-
attrs = assign({
|
|
3952
|
-
strokeWidth: 1,
|
|
3920
|
+
drawMarker('sequential', parentGfx, markerPath, {
|
|
3953
3921
|
fill: getFillColor(element, defaultFillColor),
|
|
3954
3922
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3955
|
-
}
|
|
3956
|
-
|
|
3923
|
+
});
|
|
3924
|
+
},
|
|
3925
|
+
'CompensationMarker': function(parentGfx, element, position) {
|
|
3957
3926
|
var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
|
|
3958
3927
|
xScaleFactor: 1,
|
|
3959
3928
|
yScaleFactor: 1,
|
|
@@ -3965,17 +3934,13 @@
|
|
|
3965
3934
|
}
|
|
3966
3935
|
});
|
|
3967
3936
|
|
|
3968
|
-
drawMarker('compensation', parentGfx, markerMath,
|
|
3969
|
-
},
|
|
3970
|
-
'LoopMarker': function(parentGfx, element, attrs, position) {
|
|
3971
|
-
attrs = assign({
|
|
3937
|
+
drawMarker('compensation', parentGfx, markerMath, {
|
|
3972
3938
|
strokeWidth: 1,
|
|
3973
3939
|
fill: getFillColor(element, defaultFillColor),
|
|
3974
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3940
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3941
|
+
});
|
|
3942
|
+
},
|
|
3943
|
+
'LoopMarker': function(parentGfx, element, position) {
|
|
3979
3944
|
var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
|
|
3980
3945
|
xScaleFactor: 1,
|
|
3981
3946
|
yScaleFactor: 1,
|
|
@@ -3987,15 +3952,15 @@
|
|
|
3987
3952
|
}
|
|
3988
3953
|
});
|
|
3989
3954
|
|
|
3990
|
-
drawMarker('loop', parentGfx, markerPath,
|
|
3991
|
-
},
|
|
3992
|
-
'AdhocMarker': function(parentGfx, element, attrs, position) {
|
|
3993
|
-
attrs = assign({
|
|
3955
|
+
drawMarker('loop', parentGfx, markerPath, {
|
|
3994
3956
|
strokeWidth: 1,
|
|
3995
|
-
fill:
|
|
3996
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3997
|
-
|
|
3998
|
-
|
|
3957
|
+
fill: getFillColor(element, defaultFillColor),
|
|
3958
|
+
stroke: getStrokeColor(element, defaultStrokeColor),
|
|
3959
|
+
strokeLinecap: 'round',
|
|
3960
|
+
strokeMiterlimit: 0.5
|
|
3961
|
+
});
|
|
3962
|
+
},
|
|
3963
|
+
'AdhocMarker': function(parentGfx, element, position) {
|
|
3999
3964
|
var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
|
|
4000
3965
|
xScaleFactor: 1,
|
|
4001
3966
|
yScaleFactor: 1,
|
|
@@ -4007,11 +3972,15 @@
|
|
|
4007
3972
|
}
|
|
4008
3973
|
});
|
|
4009
3974
|
|
|
4010
|
-
drawMarker('adhoc', parentGfx, markerPath,
|
|
3975
|
+
drawMarker('adhoc', parentGfx, markerPath, {
|
|
3976
|
+
strokeWidth: 1,
|
|
3977
|
+
fill: getStrokeColor(element, defaultStrokeColor),
|
|
3978
|
+
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3979
|
+
});
|
|
4011
3980
|
}
|
|
4012
3981
|
};
|
|
4013
3982
|
|
|
4014
|
-
function attachTaskMarkers(parentGfx, element,
|
|
3983
|
+
function attachTaskMarkers(parentGfx, element, taskMarkers) {
|
|
4015
3984
|
var obj = getSemantic(element);
|
|
4016
3985
|
|
|
4017
3986
|
var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
|
|
@@ -4036,15 +4005,15 @@
|
|
|
4036
4005
|
}
|
|
4037
4006
|
|
|
4038
4007
|
forEach(taskMarkers, function(marker) {
|
|
4039
|
-
renderer(marker)(parentGfx, element,
|
|
4008
|
+
renderer(marker)(parentGfx, element, position);
|
|
4040
4009
|
});
|
|
4041
4010
|
|
|
4042
4011
|
if (obj.isForCompensation) {
|
|
4043
|
-
renderer('CompensationMarker')(parentGfx, element,
|
|
4012
|
+
renderer('CompensationMarker')(parentGfx, element, position);
|
|
4044
4013
|
}
|
|
4045
4014
|
|
|
4046
4015
|
if (obj.$type === 'bpmn:AdHocSubProcess') {
|
|
4047
|
-
renderer('AdhocMarker')(parentGfx, element,
|
|
4016
|
+
renderer('AdhocMarker')(parentGfx, element, position);
|
|
4048
4017
|
}
|
|
4049
4018
|
|
|
4050
4019
|
var loopCharacteristics = obj.loopCharacteristics,
|
|
@@ -4053,23 +4022,20 @@
|
|
|
4053
4022
|
if (loopCharacteristics) {
|
|
4054
4023
|
|
|
4055
4024
|
if (isSequential === undefined) {
|
|
4056
|
-
renderer('LoopMarker')(parentGfx, element,
|
|
4025
|
+
renderer('LoopMarker')(parentGfx, element, position);
|
|
4057
4026
|
}
|
|
4058
4027
|
|
|
4059
4028
|
if (isSequential === false) {
|
|
4060
|
-
renderer('ParallelMarker')(parentGfx, element,
|
|
4029
|
+
renderer('ParallelMarker')(parentGfx, element, position);
|
|
4061
4030
|
}
|
|
4062
4031
|
|
|
4063
4032
|
if (isSequential === true) {
|
|
4064
|
-
renderer('SequentialMarker')(parentGfx, element,
|
|
4033
|
+
renderer('SequentialMarker')(parentGfx, element, position);
|
|
4065
4034
|
}
|
|
4066
4035
|
}
|
|
4067
4036
|
}
|
|
4068
4037
|
|
|
4069
|
-
function renderDataItemCollection(parentGfx, element
|
|
4070
|
-
attrs = assign({
|
|
4071
|
-
strokeWidth: 2
|
|
4072
|
-
}, attrs);
|
|
4038
|
+
function renderDataItemCollection(parentGfx, element) {
|
|
4073
4039
|
|
|
4074
4040
|
var yPosition = (element.height - 18) / element.height;
|
|
4075
4041
|
|
|
@@ -4084,13 +4050,16 @@
|
|
|
4084
4050
|
}
|
|
4085
4051
|
});
|
|
4086
4052
|
|
|
4087
|
-
/* collection path */ drawPath(parentGfx, pathData,
|
|
4053
|
+
/* collection path */ drawPath(parentGfx, pathData, {
|
|
4054
|
+
strokeWidth: 2
|
|
4055
|
+
});
|
|
4088
4056
|
}
|
|
4089
4057
|
|
|
4090
4058
|
|
|
4091
4059
|
// extension API, use at your own risk
|
|
4092
4060
|
this._drawPath = drawPath;
|
|
4093
4061
|
|
|
4062
|
+
this._renderer = renderer;
|
|
4094
4063
|
}
|
|
4095
4064
|
|
|
4096
4065
|
|
|
@@ -4110,20 +4079,20 @@
|
|
|
4110
4079
|
return is$1(element, 'bpmn:BaseElement');
|
|
4111
4080
|
};
|
|
4112
4081
|
|
|
4113
|
-
BpmnRenderer.prototype.drawShape = function(parentGfx, element
|
|
4082
|
+
BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
|
|
4114
4083
|
var type = element.type;
|
|
4115
|
-
var h = this.
|
|
4084
|
+
var h = this._renderer(type);
|
|
4116
4085
|
|
|
4117
4086
|
/* jshint -W040 */
|
|
4118
|
-
return h(parentGfx, element
|
|
4087
|
+
return h(parentGfx, element);
|
|
4119
4088
|
};
|
|
4120
4089
|
|
|
4121
|
-
BpmnRenderer.prototype.drawConnection = function(parentGfx, element
|
|
4090
|
+
BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
|
|
4122
4091
|
var type = element.type;
|
|
4123
|
-
var h = this.
|
|
4092
|
+
var h = this._renderer(type);
|
|
4124
4093
|
|
|
4125
4094
|
/* jshint -W040 */
|
|
4126
|
-
return h(parentGfx, element
|
|
4095
|
+
return h(parentGfx, element);
|
|
4127
4096
|
};
|
|
4128
4097
|
|
|
4129
4098
|
BpmnRenderer.prototype.getShapePath = function(element) {
|
|
@@ -5330,6 +5299,13 @@
|
|
|
5330
5299
|
return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />';
|
|
5331
5300
|
}
|
|
5332
5301
|
|
|
5302
|
+
/**
|
|
5303
|
+
* @param {ModdleElement} semantic
|
|
5304
|
+
* @param {ModdleElement} di
|
|
5305
|
+
* @param {Object} [attrs=null]
|
|
5306
|
+
*
|
|
5307
|
+
* @return {Object}
|
|
5308
|
+
*/
|
|
5333
5309
|
function elementData(semantic, di, attrs) {
|
|
5334
5310
|
return assign({
|
|
5335
5311
|
id: semantic.id,
|
|
@@ -5352,32 +5328,6 @@
|
|
|
5352
5328
|
});
|
|
5353
5329
|
}
|
|
5354
5330
|
|
|
5355
|
-
var PLANE_PADDING = 50;
|
|
5356
|
-
|
|
5357
|
-
function getPlaneBounds(plane) {
|
|
5358
|
-
var planeTrbl = {
|
|
5359
|
-
top: Infinity,
|
|
5360
|
-
right: -Infinity,
|
|
5361
|
-
bottom: -Infinity,
|
|
5362
|
-
left: Infinity
|
|
5363
|
-
};
|
|
5364
|
-
|
|
5365
|
-
plane.planeElement.forEach(function(element) {
|
|
5366
|
-
if (!element.bounds) {
|
|
5367
|
-
return;
|
|
5368
|
-
}
|
|
5369
|
-
|
|
5370
|
-
var trbl = asTRBL(element.bounds);
|
|
5371
|
-
|
|
5372
|
-
planeTrbl.top = Math.min(trbl.top, planeTrbl.top);
|
|
5373
|
-
planeTrbl.left = Math.min(trbl.left, planeTrbl.left);
|
|
5374
|
-
planeTrbl.right = Math.max(trbl.right, planeTrbl.right);
|
|
5375
|
-
planeTrbl.bottom = Math.max(trbl.bottom, planeTrbl.bottom);
|
|
5376
|
-
});
|
|
5377
|
-
|
|
5378
|
-
return asBounds(planeTrbl);
|
|
5379
|
-
}
|
|
5380
|
-
|
|
5381
5331
|
function notYetDrawn(translate, semantic, refSemantic, property) {
|
|
5382
5332
|
return new Error(translate('element {element} referenced by {referenced}#{property} not yet drawn', {
|
|
5383
5333
|
element: elementToString(refSemantic),
|
|
@@ -5432,39 +5382,17 @@
|
|
|
5432
5382
|
|
|
5433
5383
|
// ROOT ELEMENT
|
|
5434
5384
|
// handle the special case that we deal with a
|
|
5435
|
-
// invisible root element (process or collaboration)
|
|
5385
|
+
// invisible root element (process, subprocess or collaboration)
|
|
5436
5386
|
if (is$1(di, 'bpmndi:BPMNPlane')) {
|
|
5437
5387
|
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
// Get size of expanded element
|
|
5442
|
-
var bounds = getPlaneBounds(di);
|
|
5443
|
-
|
|
5444
|
-
var primary = this._elementRegistry.get(semantic.id);
|
|
5445
|
-
element = this._elementFactory.createShape(elementData(semantic, di, {
|
|
5446
|
-
collapsed: false,
|
|
5447
|
-
hidden: false,
|
|
5448
|
-
x: bounds.x - PLANE_PADDING,
|
|
5449
|
-
y: bounds.y - PLANE_PADDING,
|
|
5450
|
-
width: bounds.width + PLANE_PADDING * 2,
|
|
5451
|
-
height: bounds.height + PLANE_PADDING * 2,
|
|
5452
|
-
isFrame: true
|
|
5453
|
-
}));
|
|
5454
|
-
|
|
5455
|
-
element.id = element.id + '_secondary';
|
|
5456
|
-
element.isSecondary = true;
|
|
5457
|
-
element.primaryShape = primary;
|
|
5388
|
+
var attrs = is$1(semantic, 'bpmn:SubProcess')
|
|
5389
|
+
? { id: semantic.id + '_plane' }
|
|
5390
|
+
: {};
|
|
5458
5391
|
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
else {
|
|
5462
|
-
|
|
5463
|
-
// add a virtual element (not being drawn)
|
|
5464
|
-
element = this._elementFactory.createRoot(elementData(semantic, di));
|
|
5392
|
+
// add a virtual element (not being drawn)
|
|
5393
|
+
element = this._elementFactory.createRoot(elementData(semantic, di, attrs));
|
|
5465
5394
|
|
|
5466
|
-
|
|
5467
|
-
}
|
|
5395
|
+
this._canvas.addRootElement(element);
|
|
5468
5396
|
}
|
|
5469
5397
|
|
|
5470
5398
|
// SHAPE
|
|
@@ -5475,7 +5403,7 @@
|
|
|
5475
5403
|
|
|
5476
5404
|
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
|
5477
5405
|
|
|
5478
|
-
bounds = di.bounds;
|
|
5406
|
+
var bounds = di.bounds;
|
|
5479
5407
|
|
|
5480
5408
|
element = this._elementFactory.createShape(elementData(semantic, di, {
|
|
5481
5409
|
collapsed: collapsed,
|
|
@@ -5500,7 +5428,7 @@
|
|
|
5500
5428
|
|
|
5501
5429
|
// check whether data store is inside our outside of its semantic parent
|
|
5502
5430
|
if (!isPointInsideBBox(parentElement, getMid(bounds))) {
|
|
5503
|
-
parentElement = this._canvas.
|
|
5431
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
5504
5432
|
}
|
|
5505
5433
|
}
|
|
5506
5434
|
|
|
@@ -5528,7 +5456,7 @@
|
|
|
5528
5456
|
// are rendered correctly across different "hacks" people
|
|
5529
5457
|
// love to model such as cross participant / sub process
|
|
5530
5458
|
// associations
|
|
5531
|
-
parentElement = this._canvas.
|
|
5459
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
5532
5460
|
}
|
|
5533
5461
|
|
|
5534
5462
|
// insert sequence flows behind other flow nodes (cf. #727)
|
|
@@ -5762,7 +5690,7 @@
|
|
|
5762
5690
|
return isPrimaryButton(event) || isAuxiliaryButton(event);
|
|
5763
5691
|
}
|
|
5764
5692
|
|
|
5765
|
-
var LOW_PRIORITY$
|
|
5693
|
+
var LOW_PRIORITY$3 = 500;
|
|
5766
5694
|
|
|
5767
5695
|
|
|
5768
5696
|
/**
|
|
@@ -5957,7 +5885,7 @@
|
|
|
5957
5885
|
eventBus.on([
|
|
5958
5886
|
'shape.changed',
|
|
5959
5887
|
'connection.changed'
|
|
5960
|
-
], LOW_PRIORITY$
|
|
5888
|
+
], LOW_PRIORITY$3, function(event) {
|
|
5961
5889
|
|
|
5962
5890
|
var element = event.element,
|
|
5963
5891
|
gfx = event.gfx;
|
|
@@ -5965,7 +5893,7 @@
|
|
|
5965
5893
|
eventBus.fire('interactionEvents.updateHit', { element: element, gfx: gfx });
|
|
5966
5894
|
});
|
|
5967
5895
|
|
|
5968
|
-
eventBus.on('interactionEvents.createHit', LOW_PRIORITY$
|
|
5896
|
+
eventBus.on('interactionEvents.createHit', LOW_PRIORITY$3, function(event) {
|
|
5969
5897
|
var element = event.element,
|
|
5970
5898
|
gfx = event.gfx;
|
|
5971
5899
|
|
|
@@ -6239,97 +6167,6 @@
|
|
|
6239
6167
|
interactionEvents: [ 'type', InteractionEvents ]
|
|
6240
6168
|
};
|
|
6241
6169
|
|
|
6242
|
-
/**
|
|
6243
|
-
* Adds an element to a collection and returns true if the
|
|
6244
|
-
* element was added.
|
|
6245
|
-
*
|
|
6246
|
-
* @param {Array<Object>} elements
|
|
6247
|
-
* @param {Object} e
|
|
6248
|
-
* @param {boolean} unique
|
|
6249
|
-
*/
|
|
6250
|
-
function add$1(elements, e, unique) {
|
|
6251
|
-
var canAdd = !unique || elements.indexOf(e) === -1;
|
|
6252
|
-
|
|
6253
|
-
if (canAdd) {
|
|
6254
|
-
elements.push(e);
|
|
6255
|
-
}
|
|
6256
|
-
|
|
6257
|
-
return canAdd;
|
|
6258
|
-
}
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
/**
|
|
6262
|
-
* Iterate over each element in a collection, calling the iterator function `fn`
|
|
6263
|
-
* with (element, index, recursionDepth).
|
|
6264
|
-
*
|
|
6265
|
-
* Recurse into all elements that are returned by `fn`.
|
|
6266
|
-
*
|
|
6267
|
-
* @param {Object|Array<Object>} elements
|
|
6268
|
-
* @param {Function} fn iterator function called with (element, index, recursionDepth)
|
|
6269
|
-
* @param {number} [depth] maximum recursion depth
|
|
6270
|
-
*/
|
|
6271
|
-
function eachElement(elements, fn, depth) {
|
|
6272
|
-
|
|
6273
|
-
depth = depth || 0;
|
|
6274
|
-
|
|
6275
|
-
if (!isArray$1(elements)) {
|
|
6276
|
-
elements = [ elements ];
|
|
6277
|
-
}
|
|
6278
|
-
|
|
6279
|
-
forEach(elements, function(s, i) {
|
|
6280
|
-
var filter = fn(s, i, depth);
|
|
6281
|
-
|
|
6282
|
-
if (isArray$1(filter) && filter.length) {
|
|
6283
|
-
eachElement(filter, fn, depth + 1);
|
|
6284
|
-
}
|
|
6285
|
-
});
|
|
6286
|
-
}
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
/**
|
|
6290
|
-
* Collects self + child elements up to a given depth from a list of elements.
|
|
6291
|
-
*
|
|
6292
|
-
* @param {djs.model.Base|Array<djs.model.Base>} elements the elements to select the children from
|
|
6293
|
-
* @param {boolean} unique whether to return a unique result set (no duplicates)
|
|
6294
|
-
* @param {number} maxDepth the depth to search through or -1 for infinite
|
|
6295
|
-
*
|
|
6296
|
-
* @return {Array<djs.model.Base>} found elements
|
|
6297
|
-
*/
|
|
6298
|
-
function selfAndChildren(elements, unique, maxDepth) {
|
|
6299
|
-
var result = [],
|
|
6300
|
-
processedChildren = [];
|
|
6301
|
-
|
|
6302
|
-
eachElement(elements, function(element, i, depth) {
|
|
6303
|
-
add$1(result, element, unique);
|
|
6304
|
-
|
|
6305
|
-
var children = element.children;
|
|
6306
|
-
|
|
6307
|
-
// max traversal depth not reached yet
|
|
6308
|
-
if (maxDepth === -1 || depth < maxDepth) {
|
|
6309
|
-
|
|
6310
|
-
// children exist && children not yet processed
|
|
6311
|
-
if (children && add$1(processedChildren, children, unique)) {
|
|
6312
|
-
return children;
|
|
6313
|
-
}
|
|
6314
|
-
}
|
|
6315
|
-
});
|
|
6316
|
-
|
|
6317
|
-
return result;
|
|
6318
|
-
}
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
/**
|
|
6322
|
-
* Return self + ALL children for a number of elements
|
|
6323
|
-
*
|
|
6324
|
-
* @param {Array<djs.model.Base>} elements to query
|
|
6325
|
-
* @param {boolean} allowDuplicates to allow duplicates in the result set
|
|
6326
|
-
*
|
|
6327
|
-
* @return {Array<djs.model.Base>} the collected elements
|
|
6328
|
-
*/
|
|
6329
|
-
function selfAndAllChildren(elements, allowDuplicates) {
|
|
6330
|
-
return selfAndChildren(elements, !allowDuplicates, -1);
|
|
6331
|
-
}
|
|
6332
|
-
|
|
6333
6170
|
/**
|
|
6334
6171
|
* Returns the surrounding bbox for all elements in
|
|
6335
6172
|
* the array or the element primitive.
|
|
@@ -6404,7 +6241,7 @@
|
|
|
6404
6241
|
return !!(element && element.isFrame);
|
|
6405
6242
|
}
|
|
6406
6243
|
|
|
6407
|
-
var LOW_PRIORITY$
|
|
6244
|
+
var LOW_PRIORITY$2 = 500;
|
|
6408
6245
|
|
|
6409
6246
|
|
|
6410
6247
|
/**
|
|
@@ -6442,7 +6279,7 @@
|
|
|
6442
6279
|
|
|
6443
6280
|
// A low priortity is necessary, because outlines of labels have to be updated
|
|
6444
6281
|
// after the label bounds have been updated in the renderer.
|
|
6445
|
-
eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$
|
|
6282
|
+
eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$2, function(event) {
|
|
6446
6283
|
var element = event.element,
|
|
6447
6284
|
gfx = event.gfx;
|
|
6448
6285
|
|
|
@@ -6539,7 +6376,7 @@
|
|
|
6539
6376
|
self.deselect(element);
|
|
6540
6377
|
});
|
|
6541
6378
|
|
|
6542
|
-
eventBus.on([ 'diagram.clear', '
|
|
6379
|
+
eventBus.on([ 'diagram.clear', 'root.set' ], function(e) {
|
|
6543
6380
|
self.select(null);
|
|
6544
6381
|
});
|
|
6545
6382
|
}
|
|
@@ -6592,10 +6429,12 @@
|
|
|
6592
6429
|
|
|
6593
6430
|
var canvas = this._canvas;
|
|
6594
6431
|
|
|
6432
|
+
var rootElement = canvas.getRootElement();
|
|
6433
|
+
|
|
6595
6434
|
elements = elements.filter(function(element) {
|
|
6596
|
-
var
|
|
6435
|
+
var elementRoot = canvas.findRoot(element);
|
|
6597
6436
|
|
|
6598
|
-
return
|
|
6437
|
+
return rootElement === elementRoot;
|
|
6599
6438
|
});
|
|
6600
6439
|
|
|
6601
6440
|
// selection may be cleared by passing an empty array or null
|
|
@@ -6836,7 +6675,7 @@
|
|
|
6836
6675
|
// document wide unique overlay ids
|
|
6837
6676
|
var ids = new IdGenerator('ov');
|
|
6838
6677
|
|
|
6839
|
-
var LOW_PRIORITY = 500;
|
|
6678
|
+
var LOW_PRIORITY$1 = 500;
|
|
6840
6679
|
|
|
6841
6680
|
|
|
6842
6681
|
/**
|
|
@@ -7066,8 +6905,7 @@
|
|
|
7066
6905
|
*
|
|
7067
6906
|
* @see Overlays#get for filter options.
|
|
7068
6907
|
*
|
|
7069
|
-
* @param {string} [
|
|
7070
|
-
* @param {Object} [filter]
|
|
6908
|
+
* @param {string|object} [filter]
|
|
7071
6909
|
*/
|
|
7072
6910
|
Overlays.prototype.remove = function(filter) {
|
|
7073
6911
|
|
|
@@ -7183,6 +7021,7 @@
|
|
|
7183
7021
|
}
|
|
7184
7022
|
|
|
7185
7023
|
setPosition(htmlContainer, left || 0, top || 0);
|
|
7024
|
+
this._updateOverlayVisibilty(overlay, this._canvas.viewbox());
|
|
7186
7025
|
};
|
|
7187
7026
|
|
|
7188
7027
|
|
|
@@ -7266,12 +7105,10 @@
|
|
|
7266
7105
|
classes(htmlContainer).add('djs-overlay-' + overlay.type);
|
|
7267
7106
|
}
|
|
7268
7107
|
|
|
7269
|
-
var
|
|
7270
|
-
var
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
setVisible(htmlContainer, false);
|
|
7274
|
-
}
|
|
7108
|
+
var elementRoot = this._canvas.findRoot(element);
|
|
7109
|
+
var activeRoot = this._canvas.getRootElement();
|
|
7110
|
+
|
|
7111
|
+
setVisible(htmlContainer, elementRoot === activeRoot);
|
|
7275
7112
|
|
|
7276
7113
|
overlay.htmlContainer = htmlContainer;
|
|
7277
7114
|
|
|
@@ -7287,14 +7124,14 @@
|
|
|
7287
7124
|
|
|
7288
7125
|
Overlays.prototype._updateOverlayVisibilty = function(overlay, viewbox) {
|
|
7289
7126
|
var show = overlay.show,
|
|
7290
|
-
|
|
7127
|
+
rootElement = this._canvas.findRoot(overlay.element),
|
|
7291
7128
|
minZoom = show && show.minZoom,
|
|
7292
7129
|
maxZoom = show && show.maxZoom,
|
|
7293
7130
|
htmlContainer = overlay.htmlContainer,
|
|
7294
|
-
|
|
7131
|
+
activeRootElement = this._canvas.getRootElement(),
|
|
7295
7132
|
visible = true;
|
|
7296
7133
|
|
|
7297
|
-
if (
|
|
7134
|
+
if (rootElement !== activeRootElement) {
|
|
7298
7135
|
visible = false;
|
|
7299
7136
|
} else if (show) {
|
|
7300
7137
|
if (
|
|
@@ -7405,7 +7242,7 @@
|
|
|
7405
7242
|
|
|
7406
7243
|
// move integration
|
|
7407
7244
|
|
|
7408
|
-
eventBus.on('element.changed', LOW_PRIORITY, function(e) {
|
|
7245
|
+
eventBus.on('element.changed', LOW_PRIORITY$1, function(e) {
|
|
7409
7246
|
var element = e.element;
|
|
7410
7247
|
|
|
7411
7248
|
var container = self._getOverlayContainer(element, true);
|
|
@@ -7430,10 +7267,8 @@
|
|
|
7430
7267
|
});
|
|
7431
7268
|
|
|
7432
7269
|
|
|
7433
|
-
eventBus.on('
|
|
7434
|
-
|
|
7435
|
-
setVisible(el.htmlContainer, el.plane === e.plane);
|
|
7436
|
-
});
|
|
7270
|
+
eventBus.on('root.set', function() {
|
|
7271
|
+
self._updateOverlaysVisibilty(self._canvas.viewbox());
|
|
7437
7272
|
});
|
|
7438
7273
|
|
|
7439
7274
|
// clear overlays with diagram
|
|
@@ -7546,250 +7381,184 @@
|
|
|
7546
7381
|
changeSupport: [ 'type', ChangeSupport ]
|
|
7547
7382
|
};
|
|
7548
7383
|
|
|
7549
|
-
|
|
7550
|
-
var attachBoundaries = function() {
|
|
7551
|
-
var secondaryShapes = elementRegistry.filter(function(el) {
|
|
7552
|
-
return is$1(el, 'bpmn:SubProcess') && el.isSecondary;
|
|
7553
|
-
});
|
|
7554
|
-
|
|
7555
|
-
secondaryShapes.forEach(function(process) {
|
|
7556
|
-
|
|
7557
|
-
// Add Boundary events
|
|
7558
|
-
if (process.primaryShape && process.primaryShape.attachers) {
|
|
7559
|
-
process.primaryShape.attachers.forEach(function(boundary) {
|
|
7560
|
-
var bo = getBusinessObject(boundary);
|
|
7561
|
-
|
|
7562
|
-
var primary = process.primaryShape;
|
|
7563
|
-
|
|
7564
|
-
var relativeXPos = (boundary.x + 15 - primary.x) / primary.width;
|
|
7565
|
-
var relativeYPos = (boundary.y + 15 - primary.y) / primary.height;
|
|
7566
|
-
|
|
7567
|
-
var dx = process.x + (process.width * relativeXPos) - 15;
|
|
7568
|
-
var dy = process.y + (process.height * relativeYPos) - 15;
|
|
7569
|
-
|
|
7570
|
-
var boundaryShape = elementFactory.createShape({
|
|
7571
|
-
id: bo.id + '_secondary',
|
|
7572
|
-
businessObject: bo,
|
|
7573
|
-
type: 'bpmn:BoundaryEvent',
|
|
7574
|
-
hidden: false,
|
|
7575
|
-
x: dx,
|
|
7576
|
-
y: dy,
|
|
7577
|
-
width: 30,
|
|
7578
|
-
height: 30,
|
|
7579
|
-
isFrame: false,
|
|
7580
|
-
isSecondary: true,
|
|
7581
|
-
primaryShape: boundary,
|
|
7582
|
-
di: boundary.di
|
|
7583
|
-
});
|
|
7384
|
+
var DEFAULT_PRIORITY$1 = 1000;
|
|
7584
7385
|
|
|
7585
|
-
|
|
7386
|
+
/**
|
|
7387
|
+
* A utility that can be used to plug-in into the command execution for
|
|
7388
|
+
* extension and/or validation.
|
|
7389
|
+
*
|
|
7390
|
+
* @param {EventBus} eventBus
|
|
7391
|
+
*
|
|
7392
|
+
* @example
|
|
7393
|
+
*
|
|
7394
|
+
* import inherits from 'inherits';
|
|
7395
|
+
*
|
|
7396
|
+
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
7397
|
+
*
|
|
7398
|
+
* function CommandLogger(eventBus) {
|
|
7399
|
+
* CommandInterceptor.call(this, eventBus);
|
|
7400
|
+
*
|
|
7401
|
+
* this.preExecute(function(event) {
|
|
7402
|
+
* console.log('command pre-execute', event);
|
|
7403
|
+
* });
|
|
7404
|
+
* }
|
|
7405
|
+
*
|
|
7406
|
+
* inherits(CommandLogger, CommandInterceptor);
|
|
7407
|
+
*
|
|
7408
|
+
*/
|
|
7409
|
+
function CommandInterceptor(eventBus) {
|
|
7410
|
+
this._eventBus = eventBus;
|
|
7411
|
+
}
|
|
7586
7412
|
|
|
7587
|
-
|
|
7588
|
-
process.attachers = [];
|
|
7589
|
-
}
|
|
7413
|
+
CommandInterceptor.$inject = [ 'eventBus' ];
|
|
7590
7414
|
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
});
|
|
7415
|
+
function unwrapEvent(fn, that) {
|
|
7416
|
+
return function(event) {
|
|
7417
|
+
return fn.call(that || null, event.context, event.command, event);
|
|
7595
7418
|
};
|
|
7596
|
-
|
|
7597
|
-
eventBus.on('import.done', attachBoundaries);
|
|
7598
7419
|
}
|
|
7599
7420
|
|
|
7421
|
+
/**
|
|
7422
|
+
* Register an interceptor for a command execution
|
|
7423
|
+
*
|
|
7424
|
+
* @param {string|Array<string>} [events] list of commands to register on
|
|
7425
|
+
* @param {string} [hook] command hook, i.e. preExecute, executed to listen on
|
|
7426
|
+
* @param {number} [priority] the priority on which to hook into the execution
|
|
7427
|
+
* @param {Function} handlerFn interceptor to be invoked with (event)
|
|
7428
|
+
* @param {boolean} unwrap if true, unwrap the event and pass (context, command, event) to the
|
|
7429
|
+
* listener instead
|
|
7430
|
+
* @param {Object} [that] Pass context (`this`) to the handler function
|
|
7431
|
+
*/
|
|
7432
|
+
CommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {
|
|
7600
7433
|
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7434
|
+
if (isFunction(hook) || isNumber(hook)) {
|
|
7435
|
+
that = unwrap;
|
|
7436
|
+
unwrap = handlerFn;
|
|
7437
|
+
handlerFn = priority;
|
|
7438
|
+
priority = hook;
|
|
7439
|
+
hook = null;
|
|
7440
|
+
}
|
|
7608
7441
|
|
|
7609
|
-
|
|
7442
|
+
if (isFunction(priority)) {
|
|
7443
|
+
that = unwrap;
|
|
7444
|
+
unwrap = handlerFn;
|
|
7445
|
+
handlerFn = priority;
|
|
7446
|
+
priority = DEFAULT_PRIORITY$1;
|
|
7447
|
+
}
|
|
7610
7448
|
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
zoom: currentViewbox.scale
|
|
7616
|
-
};
|
|
7449
|
+
if (isObject(unwrap)) {
|
|
7450
|
+
that = unwrap;
|
|
7451
|
+
unwrap = false;
|
|
7452
|
+
}
|
|
7617
7453
|
|
|
7618
|
-
|
|
7619
|
-
|
|
7454
|
+
if (!isFunction(handlerFn)) {
|
|
7455
|
+
throw new Error('handlerFn must be a function');
|
|
7456
|
+
}
|
|
7620
7457
|
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
x: 0,
|
|
7625
|
-
y: 0,
|
|
7626
|
-
zoom: 1
|
|
7627
|
-
};
|
|
7628
|
-
}
|
|
7629
|
-
else {
|
|
7630
|
-
var currentBoundingBox = canvas.getActiveLayer().getBBox();
|
|
7631
|
-
storedViewbox = {
|
|
7632
|
-
x: currentBoundingBox.x - defaultPosition.x,
|
|
7633
|
-
y: currentBoundingBox.y - defaultPosition.y,
|
|
7634
|
-
zoom: 1
|
|
7635
|
-
};
|
|
7636
|
-
}
|
|
7637
|
-
}
|
|
7458
|
+
if (!isArray$1(events)) {
|
|
7459
|
+
events = [ events ];
|
|
7460
|
+
}
|
|
7638
7461
|
|
|
7639
|
-
|
|
7640
|
-
dy = (currentViewbox.y - storedViewbox.y) * currentViewbox.scale;
|
|
7462
|
+
var eventBus = this._eventBus;
|
|
7641
7463
|
|
|
7642
|
-
|
|
7643
|
-
canvas.scroll({
|
|
7644
|
-
dx: dx,
|
|
7645
|
-
dy: dy
|
|
7646
|
-
});
|
|
7647
|
-
}
|
|
7464
|
+
forEach(events, function(event) {
|
|
7648
7465
|
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
}
|
|
7466
|
+
// concat commandStack(.event)?(.hook)?
|
|
7467
|
+
var fullEvent = [ 'commandStack', event, hook ].filter(function(e) { return e; }).join('.');
|
|
7652
7468
|
|
|
7653
|
-
|
|
7469
|
+
eventBus.on(fullEvent, priority, unwrap ? unwrapEvent(handlerFn, that) : handlerFn, that);
|
|
7654
7470
|
});
|
|
7655
|
-
}
|
|
7656
|
-
|
|
7657
|
-
SubprocessCentering.$inject = [ 'eventBus', 'canvas' ];
|
|
7658
|
-
|
|
7659
|
-
function SubprocessCompatibility(eventBus, elementRegistry, canvas, moddle, elementFactory, bpmnjs) {
|
|
7660
|
-
this._eventBus = eventBus;
|
|
7661
|
-
this._elementRegistry = elementRegistry;
|
|
7662
|
-
this._canvas = canvas;
|
|
7663
|
-
this._bpmnjs = bpmnjs;
|
|
7664
|
-
this._moddle = moddle;
|
|
7665
|
-
this._elementFactory = elementFactory;
|
|
7666
|
-
|
|
7667
|
-
var self = this;
|
|
7471
|
+
};
|
|
7668
7472
|
|
|
7669
|
-
eventBus.on('import.done', 1500, function() {
|
|
7670
|
-
self._handleImport();
|
|
7671
|
-
});
|
|
7672
|
-
}
|
|
7673
7473
|
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7474
|
+
var hooks = [
|
|
7475
|
+
'canExecute',
|
|
7476
|
+
'preExecute',
|
|
7477
|
+
'preExecuted',
|
|
7478
|
+
'execute',
|
|
7479
|
+
'executed',
|
|
7480
|
+
'postExecute',
|
|
7481
|
+
'postExecuted',
|
|
7482
|
+
'revert',
|
|
7483
|
+
'reverted'
|
|
7484
|
+
];
|
|
7682
7485
|
|
|
7683
|
-
|
|
7684
|
-
|
|
7486
|
+
/*
|
|
7487
|
+
* Install hook shortcuts
|
|
7488
|
+
*
|
|
7489
|
+
* This will generate the CommandInterceptor#(preExecute|...|reverted) methods
|
|
7490
|
+
* which will in term forward to CommandInterceptor#on.
|
|
7491
|
+
*/
|
|
7492
|
+
forEach(hooks, function(hook) {
|
|
7685
7493
|
|
|
7686
|
-
|
|
7494
|
+
/**
|
|
7495
|
+
* {canExecute|preExecute|preExecuted|execute|executed|postExecute|postExecuted|revert|reverted}
|
|
7496
|
+
*
|
|
7497
|
+
* A named hook for plugging into the command execution
|
|
7498
|
+
*
|
|
7499
|
+
* @param {string|Array<string>} [events] list of commands to register on
|
|
7500
|
+
* @param {number} [priority] the priority on which to hook into the execution
|
|
7501
|
+
* @param {Function} handlerFn interceptor to be invoked with (event)
|
|
7502
|
+
* @param {boolean} [unwrap=false] if true, unwrap the event and pass (context, command, event) to the
|
|
7503
|
+
* listener instead
|
|
7504
|
+
* @param {Object} [that] Pass context (`this`) to the handler function
|
|
7505
|
+
*/
|
|
7506
|
+
CommandInterceptor.prototype[hook] = function(events, priority, handlerFn, unwrap, that) {
|
|
7687
7507
|
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
);
|
|
7508
|
+
if (isFunction(events) || isNumber(events)) {
|
|
7509
|
+
that = unwrap;
|
|
7510
|
+
unwrap = handlerFn;
|
|
7511
|
+
handlerFn = priority;
|
|
7512
|
+
priority = events;
|
|
7513
|
+
events = null;
|
|
7514
|
+
}
|
|
7696
7515
|
|
|
7697
|
-
|
|
7516
|
+
this.on(events, hook, priority, handlerFn, unwrap, that);
|
|
7517
|
+
};
|
|
7518
|
+
});
|
|
7698
7519
|
|
|
7699
|
-
|
|
7520
|
+
/**
|
|
7521
|
+
* A modeling behavior that ensures we set the correct root element
|
|
7522
|
+
* as we undo and redo commands.
|
|
7523
|
+
*
|
|
7524
|
+
* @param {Canvas} canvas
|
|
7525
|
+
* @param {didi.Injector} injector
|
|
7526
|
+
*/
|
|
7527
|
+
function RootElementsBehavior(canvas, injector) {
|
|
7700
7528
|
|
|
7701
|
-
|
|
7702
|
-
return el !== oldParent;
|
|
7703
|
-
});
|
|
7529
|
+
injector.invoke(CommandInterceptor, this);
|
|
7704
7530
|
|
|
7705
|
-
|
|
7531
|
+
this.executed(function(event) {
|
|
7532
|
+
var context = event.context;
|
|
7706
7533
|
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7534
|
+
if (context.rootElement) {
|
|
7535
|
+
canvas.setRootElement(context.rootElement);
|
|
7536
|
+
} else {
|
|
7537
|
+
context.rootElement = canvas.getRootElement();
|
|
7538
|
+
}
|
|
7539
|
+
});
|
|
7712
7540
|
|
|
7713
|
-
|
|
7541
|
+
this.revert(function(event) {
|
|
7542
|
+
var context = event.context;
|
|
7714
7543
|
|
|
7715
|
-
|
|
7716
|
-
|
|
7544
|
+
if (context.rootElement) {
|
|
7545
|
+
canvas.setRootElement(context.rootElement);
|
|
7546
|
+
}
|
|
7717
7547
|
});
|
|
7548
|
+
}
|
|
7718
7549
|
|
|
7719
|
-
|
|
7550
|
+
inherits$1(RootElementsBehavior, CommandInterceptor);
|
|
7720
7551
|
|
|
7721
|
-
|
|
7722
|
-
var di = getDi(element);
|
|
7723
|
-
var containingDiagram = findRootDiagram(di);
|
|
7552
|
+
RootElementsBehavior.$inject = [ 'canvas', 'injector'];
|
|
7724
7553
|
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
newPlane.get('planeElement').push(di);
|
|
7554
|
+
var RootElementsModule = {
|
|
7555
|
+
__init__: [ 'rootElementsBehavior' ],
|
|
7556
|
+
rootElementsBehavior: [ 'type', RootElementsBehavior ]
|
|
7729
7557
|
};
|
|
7730
7558
|
|
|
7731
|
-
|
|
7732
|
-
var defaultPosition = { x: 180, y: 160 },
|
|
7733
|
-
minX = Infinity,
|
|
7734
|
-
minY = Infinity;
|
|
7735
|
-
|
|
7736
|
-
elements.forEach(function(el) {
|
|
7737
|
-
minX = Math.min(minX, el.x || Infinity);
|
|
7738
|
-
minY = Math.min(minY, el.y || Infinity);
|
|
7739
|
-
});
|
|
7559
|
+
var css_escape = {exports: {}};
|
|
7740
7560
|
|
|
7741
|
-
|
|
7742
|
-
var yOffset = defaultPosition.y - minY;
|
|
7743
|
-
|
|
7744
|
-
elements.forEach(function(el) {
|
|
7745
|
-
if (el.waypoints) {
|
|
7746
|
-
el.waypoints.forEach(function(waypoint) {
|
|
7747
|
-
waypoint.x = waypoint.x + xOffset;
|
|
7748
|
-
waypoint.y = waypoint.y + yOffset;
|
|
7749
|
-
});
|
|
7750
|
-
} else {
|
|
7751
|
-
el.x = el.x + xOffset;
|
|
7752
|
-
el.y = el.y + yOffset;
|
|
7753
|
-
}
|
|
7754
|
-
});
|
|
7755
|
-
};
|
|
7756
|
-
|
|
7757
|
-
SubprocessCompatibility.prototype.getDefinitions = function() {
|
|
7758
|
-
return this._bpmnjs._definitions || [];
|
|
7759
|
-
};
|
|
7760
|
-
|
|
7761
|
-
SubprocessCompatibility.prototype.getDiagrams = function() {
|
|
7762
|
-
return this.getDefinitions().diagrams || [];
|
|
7763
|
-
};
|
|
7764
|
-
|
|
7765
|
-
SubprocessCompatibility.prototype.createDiagram = function(bo) {
|
|
7766
|
-
var plane = this._moddle.create('bpmndi:BPMNPlane', { bpmnElement: bo });
|
|
7767
|
-
var diagram = this._moddle.create('bpmndi:BPMNDiagram', {
|
|
7768
|
-
plane: plane
|
|
7769
|
-
});
|
|
7770
|
-
plane.$parent = diagram;
|
|
7771
|
-
plane.bpmnElement = bo;
|
|
7772
|
-
diagram.$parent = this.getDefinitions();
|
|
7773
|
-
this.getDiagrams().push(diagram);
|
|
7774
|
-
return diagram;
|
|
7775
|
-
};
|
|
7776
|
-
|
|
7777
|
-
SubprocessCompatibility.$inject = [ 'eventBus', 'elementRegistry', 'canvas', 'moddle', 'elementFactory', 'bpmnjs' ];
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
// Util
|
|
7781
|
-
|
|
7782
|
-
var findRootDiagram = function(element) {
|
|
7783
|
-
if (is$1(element, 'bpmndi:BPMNDiagram')) {
|
|
7784
|
-
return element;
|
|
7785
|
-
} else {
|
|
7786
|
-
return findRootDiagram(element.$parent);
|
|
7787
|
-
}
|
|
7788
|
-
};
|
|
7789
|
-
|
|
7790
|
-
var css_escape = {exports: {}};
|
|
7791
|
-
|
|
7792
|
-
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
|
|
7561
|
+
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
|
|
7793
7562
|
|
|
7794
7563
|
(function (module, exports) {
|
|
7795
7564
|
(function(root, factory) {
|
|
@@ -7909,224 +7678,640 @@
|
|
|
7909
7678
|
});
|
|
7910
7679
|
}
|
|
7911
7680
|
|
|
7912
|
-
var
|
|
7913
|
-
var ARROW_UP_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M11.1819805,12.4926407 L5.5003106,6.8103106 L5.5,12 L4,12 L4,4 L12,4 L12,5.5 L6.3103106,5.5003106 L12.2426407,11.4319805 C12.5355339,11.7248737 12.5355339,12.1997475 12.2426407,12.4926407 C11.9497475,12.7855339 11.4748737,12.7855339 11.1819805,12.4926407 Z"/></svg>';
|
|
7681
|
+
var planeSuffix = '_plane';
|
|
7914
7682
|
|
|
7915
|
-
|
|
7683
|
+
/**
|
|
7684
|
+
* Get plane ID for a primary shape.
|
|
7685
|
+
*
|
|
7686
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
7687
|
+
*
|
|
7688
|
+
* @returns {String}
|
|
7689
|
+
*/
|
|
7690
|
+
function getPlaneIdFromShape(element) {
|
|
7691
|
+
var id = element.id;
|
|
7692
|
+
|
|
7693
|
+
if (is$1(element, 'bpmn:SubProcess')) {
|
|
7694
|
+
return addPlaneSuffix(id);
|
|
7695
|
+
}
|
|
7916
7696
|
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7697
|
+
return id;
|
|
7698
|
+
}
|
|
7699
|
+
|
|
7700
|
+
function addPlaneSuffix(id) {
|
|
7701
|
+
return id + planeSuffix;
|
|
7702
|
+
}
|
|
7703
|
+
|
|
7704
|
+
var OPEN_CLASS = 'bjs-breadcrumbs-shown';
|
|
7705
|
+
|
|
7706
|
+
|
|
7707
|
+
/**
|
|
7708
|
+
* Adds overlays that allow switching planes on collapsed subprocesses.
|
|
7709
|
+
*
|
|
7710
|
+
* @param {eventBus} eventBus
|
|
7711
|
+
* @param {elementRegistry} elementRegistry
|
|
7712
|
+
* @param {overlays} overlays
|
|
7713
|
+
* @param {canvas} canvas
|
|
7714
|
+
*/
|
|
7715
|
+
function DrilldownBreadcrumbs(eventBus, elementRegistry, overlays, canvas) {
|
|
7716
|
+
var breadcrumbs = domify('<ul class="bjs-breadcrumbs"></ul>');
|
|
7717
|
+
var container = canvas.getContainer();
|
|
7718
|
+
var containerClasses = classes(container);
|
|
7719
|
+
container.appendChild(breadcrumbs);
|
|
7720
|
+
|
|
7721
|
+
var boParents = [];
|
|
7722
|
+
|
|
7723
|
+
// update breadcrumbs if name or ID of the primary shape changes
|
|
7724
|
+
eventBus.on('element.changed', function(e) {
|
|
7725
|
+
var shape = e.element,
|
|
7726
|
+
bo = getBusinessObject(shape);
|
|
7727
|
+
|
|
7728
|
+
var isPresent = find(boParents, function(el) {
|
|
7729
|
+
return el === bo;
|
|
7923
7730
|
});
|
|
7924
7731
|
|
|
7925
|
-
|
|
7732
|
+
if (!isPresent) {
|
|
7733
|
+
return;
|
|
7734
|
+
}
|
|
7926
7735
|
|
|
7927
|
-
|
|
7736
|
+
updateBreadcrumbs();
|
|
7737
|
+
});
|
|
7928
7738
|
|
|
7929
|
-
|
|
7930
|
-
|
|
7739
|
+
/**
|
|
7740
|
+
* Updates the displayed breadcrumbs. If no element is provided, only the
|
|
7741
|
+
* labels are updated.
|
|
7742
|
+
*
|
|
7743
|
+
* @param {djs.model.Base} [element]
|
|
7744
|
+
*/
|
|
7745
|
+
function updateBreadcrumbs(element) {
|
|
7746
|
+
if (element) {
|
|
7747
|
+
boParents = getBoParentChain(element);
|
|
7748
|
+
}
|
|
7749
|
+
|
|
7750
|
+
var path = boParents.map(function(parent) {
|
|
7751
|
+
var title = escapeHTML(parent.name || parent.id);
|
|
7931
7752
|
var link = domify('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
|
|
7932
7753
|
|
|
7754
|
+
var parentPlane = canvas.findRoot(getPlaneIdFromShape(parent)) || canvas.findRoot(parent.id);
|
|
7755
|
+
|
|
7756
|
+
// when the root is a collaboration, the process does not have a corresponding
|
|
7757
|
+
// element in the elementRegisty. Instead, we search for the corresponding participant
|
|
7758
|
+
if (!parentPlane && is$1(parent, 'bpmn:Process')) {
|
|
7759
|
+
var participant = elementRegistry.find(function(element) {
|
|
7760
|
+
var bo = getBusinessObject(element);
|
|
7761
|
+
return bo && bo.processRef && bo.processRef === parent;
|
|
7762
|
+
});
|
|
7763
|
+
|
|
7764
|
+
parentPlane = canvas.findRoot(participant.id);
|
|
7765
|
+
}
|
|
7766
|
+
|
|
7933
7767
|
link.addEventListener('click', function() {
|
|
7934
|
-
|
|
7935
|
-
canvas.setActivePlane(el.id);
|
|
7936
|
-
} else {
|
|
7937
|
-
var plane = canvas.findPlane(el.id);
|
|
7938
|
-
canvas.setActivePlane(plane);
|
|
7939
|
-
}
|
|
7768
|
+
canvas.setRootElement(parentPlane);
|
|
7940
7769
|
});
|
|
7941
7770
|
|
|
7942
7771
|
return link;
|
|
7943
7772
|
});
|
|
7944
7773
|
|
|
7774
|
+
breadcrumbs.innerHTML = '';
|
|
7775
|
+
|
|
7776
|
+
// show breadcrumbs and expose state to .djs-container
|
|
7777
|
+
var visible = path.length > 1;
|
|
7778
|
+
containerClasses.toggle(OPEN_CLASS, visible);
|
|
7779
|
+
|
|
7945
7780
|
path.forEach(function(el) {
|
|
7946
7781
|
breadcrumbs.appendChild(el);
|
|
7947
7782
|
});
|
|
7783
|
+
}
|
|
7948
7784
|
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7785
|
+
eventBus.on('root.set', function(event) {
|
|
7786
|
+
updateBreadcrumbs(event.element);
|
|
7787
|
+
});
|
|
7788
|
+
|
|
7789
|
+
}
|
|
7790
|
+
|
|
7791
|
+
DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', 'overlays', 'canvas' ];
|
|
7792
|
+
|
|
7793
|
+
|
|
7794
|
+
// helpers //////////
|
|
7795
|
+
|
|
7796
|
+
/**
|
|
7797
|
+
* Returns the parents for the element using the business object chain,
|
|
7798
|
+
* starting with the root element.
|
|
7799
|
+
*
|
|
7800
|
+
* @param {djs.model.Shape} child
|
|
7801
|
+
*
|
|
7802
|
+
* @returns {Array<djs.model.Shape>} parents
|
|
7803
|
+
*/
|
|
7804
|
+
function getBoParentChain(child) {
|
|
7805
|
+
var bo = getBusinessObject(child);
|
|
7806
|
+
|
|
7807
|
+
var parents = [];
|
|
7808
|
+
|
|
7809
|
+
for (var element = bo; element; element = element.$parent) {
|
|
7810
|
+
if (is$1(element, 'bpmn:SubProcess') || is$1(element, 'bpmn:Process')) {
|
|
7811
|
+
parents.push(element);
|
|
7812
|
+
}
|
|
7956
7813
|
}
|
|
7957
7814
|
|
|
7958
|
-
|
|
7959
|
-
|
|
7815
|
+
return parents.reverse();
|
|
7816
|
+
}
|
|
7960
7817
|
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7818
|
+
/**
|
|
7819
|
+
* Move collapsed subprocesses into view when drilling down.
|
|
7820
|
+
*
|
|
7821
|
+
* Zoom and scroll are saved in a session.
|
|
7822
|
+
*
|
|
7823
|
+
* @param {eventBus} eventBus
|
|
7824
|
+
* @param {canvas} canvas
|
|
7825
|
+
*/
|
|
7826
|
+
function DrilldownCentering(eventBus, canvas) {
|
|
7964
7827
|
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7828
|
+
var currentRoot = null;
|
|
7829
|
+
var positionMap = new Map();
|
|
7830
|
+
|
|
7831
|
+
eventBus.on('root.set', function(event) {
|
|
7832
|
+
var newRoot = event.element;
|
|
7833
|
+
var currentViewbox = canvas.viewbox();
|
|
7834
|
+
var storedViewbox = positionMap.get(newRoot);
|
|
7835
|
+
|
|
7836
|
+
positionMap.set(currentRoot, {
|
|
7837
|
+
x: currentViewbox.x,
|
|
7838
|
+
y: currentViewbox.y,
|
|
7839
|
+
zoom: currentViewbox.scale
|
|
7971
7840
|
});
|
|
7841
|
+
|
|
7842
|
+
currentRoot = newRoot;
|
|
7843
|
+
|
|
7844
|
+
// current root was replaced with a collaboration, we don't update the viewbox
|
|
7845
|
+
if (is$1(newRoot, 'bpmn:Collaboration') && !storedViewbox) {
|
|
7846
|
+
return;
|
|
7847
|
+
}
|
|
7848
|
+
|
|
7849
|
+
storedViewbox = storedViewbox || { x: 0, y: 0, zoom: 1 };
|
|
7850
|
+
|
|
7851
|
+
var dx = (currentViewbox.x - storedViewbox.x) * currentViewbox.scale,
|
|
7852
|
+
dy = (currentViewbox.y - storedViewbox.y) * currentViewbox.scale;
|
|
7853
|
+
|
|
7854
|
+
if (dx !== 0 || dy !== 0) {
|
|
7855
|
+
canvas.scroll({
|
|
7856
|
+
dx: dx,
|
|
7857
|
+
dy: dy
|
|
7858
|
+
});
|
|
7859
|
+
}
|
|
7860
|
+
|
|
7861
|
+
if (storedViewbox.zoom !== currentViewbox.scale) {
|
|
7862
|
+
canvas.zoom(storedViewbox.zoom, { x: 0, y: 0 });
|
|
7863
|
+
}
|
|
7864
|
+
});
|
|
7865
|
+
|
|
7866
|
+
eventBus.on('diagram.clear', function() {
|
|
7867
|
+
positionMap.clear();
|
|
7868
|
+
currentRoot = null;
|
|
7869
|
+
});
|
|
7870
|
+
|
|
7871
|
+
}
|
|
7872
|
+
|
|
7873
|
+
DrilldownCentering.$inject = [ 'eventBus', 'canvas' ];
|
|
7874
|
+
|
|
7875
|
+
|
|
7876
|
+
/**
|
|
7877
|
+
* ES5 Map implementation. Works.
|
|
7878
|
+
*/
|
|
7879
|
+
function Map() {
|
|
7880
|
+
|
|
7881
|
+
this._entries = [];
|
|
7882
|
+
|
|
7883
|
+
this.set = function(key, value) {
|
|
7884
|
+
|
|
7885
|
+
var found = false;
|
|
7886
|
+
|
|
7887
|
+
for (var k in this._entries) {
|
|
7888
|
+
if (this._entries[k][0] === key) {
|
|
7889
|
+
this._entries[k][1] = value;
|
|
7890
|
+
|
|
7891
|
+
found = true;
|
|
7892
|
+
|
|
7893
|
+
break;
|
|
7894
|
+
}
|
|
7895
|
+
}
|
|
7896
|
+
|
|
7897
|
+
if (!found) {
|
|
7898
|
+
this._entries.push([ key, value ]);
|
|
7899
|
+
}
|
|
7972
7900
|
};
|
|
7973
7901
|
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
createDrilldown(element);
|
|
7902
|
+
this.get = function(key) {
|
|
7903
|
+
|
|
7904
|
+
for (var k in this._entries) {
|
|
7905
|
+
if (this._entries[k][0] === key) {
|
|
7906
|
+
return this._entries[k][1];
|
|
7980
7907
|
}
|
|
7908
|
+
}
|
|
7909
|
+
|
|
7910
|
+
return null;
|
|
7911
|
+
};
|
|
7912
|
+
|
|
7913
|
+
this.clear = function() {
|
|
7914
|
+
this._entries.length = 0;
|
|
7915
|
+
};
|
|
7916
|
+
|
|
7917
|
+
this.remove = function(key) {
|
|
7918
|
+
|
|
7919
|
+
var idx = -1;
|
|
7920
|
+
|
|
7921
|
+
for (var k in this._entries) {
|
|
7922
|
+
if (this._entries[k][0] === key) {
|
|
7923
|
+
idx = k;
|
|
7981
7924
|
|
|
7982
|
-
|
|
7983
|
-
createBreadcrumbs(element);
|
|
7925
|
+
break;
|
|
7984
7926
|
}
|
|
7985
|
-
}
|
|
7927
|
+
}
|
|
7928
|
+
|
|
7929
|
+
if (idx !== -1) {
|
|
7930
|
+
this._entries.splice(idx, 1);
|
|
7931
|
+
}
|
|
7986
7932
|
};
|
|
7933
|
+
}
|
|
7987
7934
|
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7935
|
+
var DEFAULT_POSITION = {
|
|
7936
|
+
x: 180,
|
|
7937
|
+
y: 160
|
|
7938
|
+
};
|
|
7939
|
+
|
|
7940
|
+
/**
|
|
7941
|
+
* Hook into `import.render.start` and create new planes for diagrams with
|
|
7942
|
+
* collapsed subprocesses and all dis on the same plane.
|
|
7943
|
+
*
|
|
7944
|
+
* @param {eventBus} eventBus
|
|
7945
|
+
* @param {moddle} moddle
|
|
7946
|
+
*/
|
|
7947
|
+
function SubprocessCompatibility(eventBus, moddle) {
|
|
7948
|
+
this._eventBus = eventBus;
|
|
7949
|
+
this._moddle = moddle;
|
|
7950
|
+
|
|
7951
|
+
var self = this;
|
|
7952
|
+
|
|
7953
|
+
eventBus.on('import.render.start', 1500, function(e, context) {
|
|
7954
|
+
self.handleImport(context.definitions);
|
|
7992
7955
|
});
|
|
7993
7956
|
}
|
|
7994
7957
|
|
|
7995
|
-
|
|
7958
|
+
SubprocessCompatibility.prototype.handleImport = function(definitions) {
|
|
7959
|
+
if (!definitions.diagrams) {
|
|
7960
|
+
return;
|
|
7961
|
+
}
|
|
7996
7962
|
|
|
7963
|
+
var self = this;
|
|
7964
|
+
this._definitions = definitions;
|
|
7965
|
+
this._processToDiagramMap = {};
|
|
7997
7966
|
|
|
7998
|
-
|
|
7999
|
-
|
|
7967
|
+
definitions.diagrams.forEach(function(diagram) {
|
|
7968
|
+
if (!diagram.plane || !diagram.plane.bpmnElement) {
|
|
7969
|
+
return;
|
|
7970
|
+
}
|
|
8000
7971
|
|
|
8001
|
-
|
|
7972
|
+
self._processToDiagramMap[diagram.plane.bpmnElement.id] = diagram;
|
|
7973
|
+
});
|
|
8002
7974
|
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
}
|
|
7975
|
+
var newDiagrams = [];
|
|
7976
|
+
definitions.diagrams.forEach(function(diagram) {
|
|
7977
|
+
var createdDiagrams = self.createNewDiagrams(diagram.plane);
|
|
7978
|
+
Array.prototype.push.apply(newDiagrams, createdDiagrams);
|
|
7979
|
+
});
|
|
8008
7980
|
|
|
8009
|
-
|
|
7981
|
+
newDiagrams.forEach(function(diagram) {
|
|
7982
|
+
self.movePlaneElementsToOrigin(diagram.plane);
|
|
7983
|
+
});
|
|
8010
7984
|
};
|
|
8011
7985
|
|
|
8012
|
-
var FLOW_LENGTH = 50;
|
|
8013
|
-
var HIGH_RENDER_PRIORITY = 2000;
|
|
8014
7986
|
|
|
8015
|
-
|
|
7987
|
+
/**
|
|
7988
|
+
* Moves all DI elements from collapsed subprocesses to a new plane.
|
|
7989
|
+
*
|
|
7990
|
+
* @param {Object} plane
|
|
7991
|
+
* @return {Array} new diagrams created for the collapsed subprocesses
|
|
7992
|
+
*/
|
|
7993
|
+
SubprocessCompatibility.prototype.createNewDiagrams = function(plane) {
|
|
7994
|
+
var self = this;
|
|
8016
7995
|
|
|
8017
|
-
var
|
|
7996
|
+
var collapsedElements = [];
|
|
7997
|
+
var elementsToMove = [];
|
|
8018
7998
|
|
|
8019
|
-
function
|
|
8020
|
-
var
|
|
7999
|
+
plane.get('planeElement').forEach(function(diElement) {
|
|
8000
|
+
var bo = diElement.bpmnElement;
|
|
8021
8001
|
|
|
8022
|
-
|
|
8002
|
+
if (!bo) {
|
|
8003
|
+
return;
|
|
8004
|
+
}
|
|
8023
8005
|
|
|
8024
|
-
|
|
8025
|
-
if (isOutgoing) {
|
|
8026
|
-
segment = connection.waypoints.slice(0, 2);
|
|
8006
|
+
var parent = bo.$parent;
|
|
8027
8007
|
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
segment = connection.waypoints.slice(connection.waypoints.length - 2);
|
|
8032
|
-
}
|
|
8008
|
+
if (is$1(bo, 'bpmn:SubProcess') && !diElement.isExpanded) {
|
|
8009
|
+
collapsedElements.push(bo);
|
|
8010
|
+
}
|
|
8033
8011
|
|
|
8034
|
-
|
|
8012
|
+
if (is$1(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
|
|
8035
8013
|
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8014
|
+
// don't change the array while we iterate over it
|
|
8015
|
+
elementsToMove.push({ diElement: diElement, parent: parent });
|
|
8016
|
+
}
|
|
8017
|
+
});
|
|
8040
8018
|
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8019
|
+
var newDiagrams = [];
|
|
8020
|
+
|
|
8021
|
+
// create new planes for all collapsed subprocesses, even when they are empty
|
|
8022
|
+
collapsedElements.forEach(function(element) {
|
|
8023
|
+
if (!self._processToDiagramMap[element.id]) {
|
|
8024
|
+
var diagram = self.createDiagram(element);
|
|
8025
|
+
self._processToDiagramMap[element.id] = diagram;
|
|
8026
|
+
newDiagrams.push(diagram);
|
|
8027
|
+
}
|
|
8028
|
+
});
|
|
8029
|
+
|
|
8030
|
+
elementsToMove.forEach(function(element) {
|
|
8031
|
+
var diElement = element.diElement;
|
|
8032
|
+
var parent = element.parent;
|
|
8033
|
+
|
|
8034
|
+
// parent is expanded, get nearest collapsed parent
|
|
8035
|
+
while (parent && collapsedElements.indexOf(parent) === -1) {
|
|
8036
|
+
parent = parent.$parent;
|
|
8037
|
+
}
|
|
8038
|
+
|
|
8039
|
+
// false positive, all parents are expanded
|
|
8040
|
+
if (!parent) {
|
|
8041
|
+
return;
|
|
8042
|
+
}
|
|
8043
|
+
|
|
8044
|
+
var diagram = self._processToDiagramMap[parent.id];
|
|
8045
|
+
self.moveToDiPlane(diElement, diagram.plane);
|
|
8046
|
+
});
|
|
8047
|
+
|
|
8048
|
+
return newDiagrams;
|
|
8049
|
+
};
|
|
8050
|
+
|
|
8051
|
+
SubprocessCompatibility.prototype.movePlaneElementsToOrigin = function(plane) {
|
|
8052
|
+
var elements = plane.get('planeElement');
|
|
8053
|
+
|
|
8054
|
+
// get bounding box of all elements
|
|
8055
|
+
var planeBounds = getPlaneBounds(plane);
|
|
8056
|
+
|
|
8057
|
+
var offset = {
|
|
8058
|
+
x: planeBounds.x - DEFAULT_POSITION.x,
|
|
8059
|
+
y: planeBounds.y - DEFAULT_POSITION.y
|
|
8060
|
+
};
|
|
8045
8061
|
|
|
8046
|
-
|
|
8047
|
-
|
|
8062
|
+
elements.forEach(function(diElement) {
|
|
8063
|
+
if (diElement.waypoint) {
|
|
8064
|
+
diElement.waypoint.forEach(function(waypoint) {
|
|
8065
|
+
waypoint.x = waypoint.x - offset.x;
|
|
8066
|
+
waypoint.y = waypoint.y - offset.y;
|
|
8048
8067
|
});
|
|
8068
|
+
} else if (diElement.bounds) {
|
|
8069
|
+
diElement.bounds.x = diElement.bounds.x - offset.x;
|
|
8070
|
+
diElement.bounds.y = diElement.bounds.y - offset.y;
|
|
8071
|
+
}
|
|
8072
|
+
});
|
|
8073
|
+
};
|
|
8049
8074
|
|
|
8050
|
-
newWaypoints[0] = normalizeLength(newWaypoints[1], newWaypoints[0], FLOW_LENGTH);
|
|
8051
8075
|
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
};
|
|
8076
|
+
SubprocessCompatibility.prototype.moveToDiPlane = function(diElement, newPlane) {
|
|
8077
|
+
var containingDiagram = findRootDiagram(diElement);
|
|
8055
8078
|
|
|
8056
|
-
|
|
8079
|
+
// remove DI from old Plane and add it to the new one
|
|
8080
|
+
var parentPlaneElement = containingDiagram.plane.get('planeElement');
|
|
8081
|
+
parentPlaneElement.splice(parentPlaneElement.indexOf(diElement), 1);
|
|
8082
|
+
newPlane.get('planeElement').push(diElement);
|
|
8083
|
+
};
|
|
8084
|
+
|
|
8085
|
+
|
|
8086
|
+
SubprocessCompatibility.prototype.createDiagram = function(bo) {
|
|
8087
|
+
var plane = this._moddle.create('bpmndi:BPMNPlane', { bpmnElement: bo });
|
|
8088
|
+
var diagram = this._moddle.create('bpmndi:BPMNDiagram', {
|
|
8089
|
+
plane: plane
|
|
8090
|
+
});
|
|
8091
|
+
plane.$parent = diagram;
|
|
8092
|
+
plane.bpmnElement = bo;
|
|
8093
|
+
diagram.$parent = this._definitions;
|
|
8094
|
+
this._definitions.diagrams.push(diagram);
|
|
8095
|
+
return diagram;
|
|
8096
|
+
};
|
|
8097
|
+
|
|
8098
|
+
SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
|
|
8099
|
+
|
|
8100
|
+
|
|
8101
|
+
// helpers
|
|
8102
|
+
|
|
8103
|
+
function findRootDiagram(element) {
|
|
8104
|
+
if (is$1(element, 'bpmndi:BPMNDiagram')) {
|
|
8105
|
+
return element;
|
|
8106
|
+
} else {
|
|
8107
|
+
return findRootDiagram(element.$parent);
|
|
8108
|
+
}
|
|
8109
|
+
}
|
|
8110
|
+
|
|
8111
|
+
function getPlaneBounds(plane) {
|
|
8112
|
+
var planeTrbl = {
|
|
8113
|
+
top: Infinity,
|
|
8114
|
+
right: -Infinity,
|
|
8115
|
+
bottom: -Infinity,
|
|
8116
|
+
left: Infinity
|
|
8117
|
+
};
|
|
8118
|
+
|
|
8119
|
+
plane.planeElement.forEach(function(element) {
|
|
8120
|
+
if (!element.bounds) {
|
|
8121
|
+
return;
|
|
8122
|
+
}
|
|
8123
|
+
|
|
8124
|
+
var trbl = asTRBL(element.bounds);
|
|
8125
|
+
|
|
8126
|
+
planeTrbl.top = Math.min(trbl.top, planeTrbl.top);
|
|
8127
|
+
planeTrbl.left = Math.min(trbl.left, planeTrbl.left);
|
|
8128
|
+
});
|
|
8129
|
+
|
|
8130
|
+
return asBounds(planeTrbl);
|
|
8131
|
+
}
|
|
8132
|
+
|
|
8133
|
+
var LOW_PRIORITY = 250;
|
|
8134
|
+
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>';
|
|
8135
|
+
|
|
8136
|
+
var EMPTY_MARKER = 'bjs-drilldown-empty';
|
|
8137
|
+
|
|
8138
|
+
function DrilldownOverlayBehavior(
|
|
8139
|
+
canvas, eventBus, elementRegistry, overlays
|
|
8140
|
+
) {
|
|
8141
|
+
CommandInterceptor.call(this, eventBus);
|
|
8142
|
+
|
|
8143
|
+
this._canvas = canvas;
|
|
8144
|
+
this._eventBus = eventBus;
|
|
8145
|
+
this._elementRegistry = elementRegistry;
|
|
8146
|
+
this._overlays = overlays;
|
|
8147
|
+
|
|
8148
|
+
var self = this;
|
|
8149
|
+
|
|
8150
|
+
this.executed('shape.toggleCollapse', LOW_PRIORITY, function(context) {
|
|
8151
|
+
var shape = context.shape;
|
|
8152
|
+
|
|
8153
|
+
// Add overlay to the collapsed shape
|
|
8154
|
+
if (self.canDrillDown(shape)) {
|
|
8155
|
+
self.addOverlay(shape);
|
|
8156
|
+
} else {
|
|
8157
|
+
self.removeOverlay(shape);
|
|
8158
|
+
}
|
|
8159
|
+
}, true);
|
|
8160
|
+
|
|
8161
|
+
|
|
8162
|
+
this.reverted('shape.toggleCollapse', LOW_PRIORITY, function(context) {
|
|
8163
|
+
var shape = context.shape;
|
|
8164
|
+
|
|
8165
|
+
// Add overlay to the collapsed shape
|
|
8166
|
+
if (self.canDrillDown(shape)) {
|
|
8167
|
+
self.addOverlay(shape);
|
|
8168
|
+
} else {
|
|
8169
|
+
self.removeOverlay(shape);
|
|
8170
|
+
}
|
|
8171
|
+
}, true);
|
|
8057
8172
|
|
|
8058
|
-
// Reverse order again for correct end marker position
|
|
8059
|
-
newWaypoints = newWaypoints.reverse();
|
|
8060
|
-
} else {
|
|
8061
8173
|
|
|
8062
|
-
|
|
8063
|
-
|
|
8174
|
+
this.executed(['shape.create', 'shape.move', 'shape.delete'], LOW_PRIORITY,
|
|
8175
|
+
function(context) {
|
|
8176
|
+
var oldParent = context.oldParent,
|
|
8177
|
+
newParent = context.newParent || context.parent,
|
|
8178
|
+
shape = context.shape;
|
|
8179
|
+
|
|
8180
|
+
// Add overlay to the collapsed shape
|
|
8181
|
+
if (self.canDrillDown(shape)) {
|
|
8182
|
+
self.addOverlay(shape);
|
|
8064
8183
|
}
|
|
8065
8184
|
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
};
|
|
8185
|
+
self.updateDrilldownOverlay(oldParent);
|
|
8186
|
+
self.updateDrilldownOverlay(newParent);
|
|
8187
|
+
self.updateDrilldownOverlay(shape);
|
|
8188
|
+
}, true);
|
|
8189
|
+
|
|
8190
|
+
|
|
8191
|
+
this.reverted(['shape.create', 'shape.move', 'shape.delete'], LOW_PRIORITY,
|
|
8192
|
+
function(context) {
|
|
8193
|
+
var oldParent = context.oldParent,
|
|
8194
|
+
newParent = context.newParent || context.parent,
|
|
8195
|
+
shape = context.shape;
|
|
8078
8196
|
|
|
8079
|
-
|
|
8080
|
-
|
|
8197
|
+
// Add overlay to the collapsed shape
|
|
8198
|
+
if (self.canDrillDown(shape)) {
|
|
8199
|
+
self.addOverlay(shape);
|
|
8200
|
+
}
|
|
8201
|
+
|
|
8202
|
+
self.updateDrilldownOverlay(oldParent);
|
|
8203
|
+
self.updateDrilldownOverlay(newParent);
|
|
8204
|
+
self.updateDrilldownOverlay(shape);
|
|
8205
|
+
}, true);
|
|
8206
|
+
|
|
8207
|
+
|
|
8208
|
+
eventBus.on('import.done', function() {
|
|
8209
|
+
elementRegistry.filter(function(e) {
|
|
8210
|
+
return self.canDrillDown(e);
|
|
8211
|
+
}).map(function(el) {
|
|
8212
|
+
self.addOverlay(el);
|
|
8081
8213
|
});
|
|
8214
|
+
});
|
|
8215
|
+
|
|
8216
|
+
}
|
|
8217
|
+
|
|
8218
|
+
inherits$1(DrilldownOverlayBehavior, CommandInterceptor);
|
|
8219
|
+
|
|
8220
|
+
DrilldownOverlayBehavior.prototype.updateDrilldownOverlay = function(shape) {
|
|
8221
|
+
var canvas = this._canvas;
|
|
8222
|
+
|
|
8223
|
+
if (!shape) {
|
|
8224
|
+
return;
|
|
8225
|
+
}
|
|
8226
|
+
|
|
8227
|
+
var root = canvas.findRoot(shape);
|
|
8228
|
+
if (root) {
|
|
8229
|
+
this.updateOverlayVisibility(root);
|
|
8230
|
+
}
|
|
8231
|
+
};
|
|
8232
|
+
|
|
8233
|
+
|
|
8234
|
+
DrilldownOverlayBehavior.prototype.canDrillDown = function(element) {
|
|
8235
|
+
var canvas = this._canvas;
|
|
8236
|
+
return is$1(element, 'bpmn:SubProcess') && canvas.findRoot(getPlaneIdFromShape(element));
|
|
8237
|
+
};
|
|
8238
|
+
|
|
8239
|
+
/**
|
|
8240
|
+
* Updates visibility of the drilldown overlay. If the plane has no elements,
|
|
8241
|
+
* the drilldown will be only shown when the element is selected.
|
|
8242
|
+
*
|
|
8243
|
+
* @param {djs.model.Shape|djs.model.Root} element collapsed shape or root element
|
|
8244
|
+
*/
|
|
8245
|
+
DrilldownOverlayBehavior.prototype.updateOverlayVisibility = function(element) {
|
|
8246
|
+
var overlays = this._overlays;
|
|
8247
|
+
|
|
8248
|
+
var bo = element.businessObject;
|
|
8249
|
+
|
|
8250
|
+
var overlay = overlays.get({ element: bo.id, type: 'drilldown' })[0];
|
|
8251
|
+
|
|
8252
|
+
if (!overlay) {
|
|
8253
|
+
return;
|
|
8254
|
+
}
|
|
8255
|
+
|
|
8256
|
+
var hasContent = bo && bo.flowElements && bo.flowElements.length;
|
|
8257
|
+
classes(overlay.html).toggle(EMPTY_MARKER, !hasContent);
|
|
8258
|
+
};
|
|
8259
|
+
|
|
8260
|
+
/**
|
|
8261
|
+
* Attaches a drilldown button to the given element. We assume that the plane has
|
|
8262
|
+
* the same id as the element.
|
|
8263
|
+
*
|
|
8264
|
+
* @param {djs.model.Shape} element collapsed shape
|
|
8265
|
+
*/
|
|
8266
|
+
DrilldownOverlayBehavior.prototype.addOverlay = function(element) {
|
|
8267
|
+
var canvas = this._canvas;
|
|
8268
|
+
var overlays = this._overlays;
|
|
8082
8269
|
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8270
|
+
var existingOverlays = overlays.get({ element: element, type: 'drilldown' });
|
|
8271
|
+
if (existingOverlays.length) {
|
|
8272
|
+
this.removeOverlay(element);
|
|
8086
8273
|
}
|
|
8087
8274
|
|
|
8088
|
-
|
|
8089
|
-
var element = context.element,
|
|
8090
|
-
visuals = context.gfx;
|
|
8091
|
-
|
|
8092
|
-
if (element.isSecondary && element.primaryShape) {
|
|
8093
|
-
drawFakeFlows(element, visuals);
|
|
8094
|
-
}
|
|
8275
|
+
var button = domify('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
|
|
8095
8276
|
|
|
8277
|
+
button.addEventListener('click', function() {
|
|
8278
|
+
canvas.setRootElement(canvas.findRoot(getPlaneIdFromShape(element)));
|
|
8096
8279
|
});
|
|
8097
8280
|
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8281
|
+
overlays.add(element, 'drilldown', {
|
|
8282
|
+
position: {
|
|
8283
|
+
bottom: -7,
|
|
8284
|
+
right: -8
|
|
8285
|
+
},
|
|
8286
|
+
html: button
|
|
8287
|
+
});
|
|
8104
8288
|
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
dy = fixedPoint.y - variablePoint.y,
|
|
8108
|
-
totalDistance = Math.abs(dx) + Math.abs(dy);
|
|
8289
|
+
this.updateOverlayVisibility(element);
|
|
8290
|
+
};
|
|
8109
8291
|
|
|
8110
|
-
|
|
8111
|
-
|
|
8292
|
+
DrilldownOverlayBehavior.prototype.removeOverlay = function(element) {
|
|
8293
|
+
var overlays = this._overlays;
|
|
8112
8294
|
|
|
8113
|
-
|
|
8114
|
-
|
|
8295
|
+
overlays.remove({
|
|
8296
|
+
element: element,
|
|
8297
|
+
type: 'drilldown'
|
|
8298
|
+
});
|
|
8299
|
+
};
|
|
8115
8300
|
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8301
|
+
DrilldownOverlayBehavior.$inject = [
|
|
8302
|
+
'canvas',
|
|
8303
|
+
'eventBus',
|
|
8304
|
+
'elementRegistry',
|
|
8305
|
+
'overlays'
|
|
8306
|
+
];
|
|
8121
8307
|
|
|
8122
|
-
var
|
|
8123
|
-
__depends__: [ OverlaysModule, ChangeSupportModule ],
|
|
8124
|
-
__init__: [ '
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
subprocessFlows: ['type', SubprocessFlows]
|
|
8308
|
+
var DrilldownModdule = {
|
|
8309
|
+
__depends__: [ OverlaysModule, ChangeSupportModule, RootElementsModule ],
|
|
8310
|
+
__init__: [ 'drilldownBreadcrumbs', 'drilldownOverlayBehavior', 'drilldownCentering', 'subprocessCompatibility'],
|
|
8311
|
+
drilldownBreadcrumbs: [ 'type', DrilldownBreadcrumbs ],
|
|
8312
|
+
drilldownCentering: [ 'type', DrilldownCentering ],
|
|
8313
|
+
drilldownOverlayBehavior: [ 'type', DrilldownOverlayBehavior ],
|
|
8314
|
+
subprocessCompatibility: [ 'type', SubprocessCompatibility ]
|
|
8130
8315
|
};
|
|
8131
8316
|
|
|
8132
8317
|
var CLASS_PATTERN = /^class /;
|
|
@@ -8766,7 +8951,10 @@
|
|
|
8766
8951
|
}
|
|
8767
8952
|
|
|
8768
8953
|
var BASE_LAYER = 'base';
|
|
8769
|
-
|
|
8954
|
+
|
|
8955
|
+
// render plane contents behind utility layers
|
|
8956
|
+
var PLANE_LAYER_INDEX = 0;
|
|
8957
|
+
var UTILITY_LAYER_INDEX = 1;
|
|
8770
8958
|
|
|
8771
8959
|
|
|
8772
8960
|
var REQUIRED_MODEL_ATTRS = {
|
|
@@ -8793,6 +8981,12 @@
|
|
|
8793
8981
|
this._elementRegistry = elementRegistry;
|
|
8794
8982
|
this._graphicsFactory = graphicsFactory;
|
|
8795
8983
|
|
|
8984
|
+
this._rootsIdx = 0;
|
|
8985
|
+
|
|
8986
|
+
this._layers = {};
|
|
8987
|
+
this._planes = [];
|
|
8988
|
+
this._rootElement = null;
|
|
8989
|
+
|
|
8796
8990
|
this._init(config || {});
|
|
8797
8991
|
}
|
|
8798
8992
|
|
|
@@ -8830,9 +9024,6 @@
|
|
|
8830
9024
|
|
|
8831
9025
|
var viewport = this._viewport = createGroup(svg, 'viewport');
|
|
8832
9026
|
|
|
8833
|
-
this._layers = {};
|
|
8834
|
-
this._planes = {};
|
|
8835
|
-
|
|
8836
9027
|
// debounce canvas.viewbox.changed events
|
|
8837
9028
|
// for smoother diagram interaction
|
|
8838
9029
|
if (config.deferUpdate !== false) {
|
|
@@ -8866,7 +9057,8 @@
|
|
|
8866
9057
|
'connection.added',
|
|
8867
9058
|
'shape.removed',
|
|
8868
9059
|
'connection.removed',
|
|
8869
|
-
'elements.changed'
|
|
9060
|
+
'elements.changed',
|
|
9061
|
+
'root.set'
|
|
8870
9062
|
], function() {
|
|
8871
9063
|
delete this._cachedViewbox;
|
|
8872
9064
|
}, this);
|
|
@@ -8891,7 +9083,7 @@
|
|
|
8891
9083
|
delete this._container;
|
|
8892
9084
|
delete this._layers;
|
|
8893
9085
|
delete this._planes;
|
|
8894
|
-
delete this.
|
|
9086
|
+
delete this._rootElement;
|
|
8895
9087
|
delete this._viewport;
|
|
8896
9088
|
};
|
|
8897
9089
|
|
|
@@ -8906,15 +9098,15 @@
|
|
|
8906
9098
|
var type = getType(element);
|
|
8907
9099
|
|
|
8908
9100
|
if (type === 'root') {
|
|
8909
|
-
self.
|
|
9101
|
+
self.removeRootElement(element);
|
|
8910
9102
|
} else {
|
|
8911
9103
|
self._removeElement(element, type);
|
|
8912
9104
|
}
|
|
8913
9105
|
});
|
|
8914
9106
|
|
|
8915
9107
|
// remove all planes
|
|
8916
|
-
this.
|
|
8917
|
-
this.
|
|
9108
|
+
this._planes = [];
|
|
9109
|
+
this._rootElement = null;
|
|
8918
9110
|
|
|
8919
9111
|
// force recomputation of view box
|
|
8920
9112
|
delete this._cachedViewbox;
|
|
@@ -8927,7 +9119,7 @@
|
|
|
8927
9119
|
* @returns {SVGElement}
|
|
8928
9120
|
*/
|
|
8929
9121
|
Canvas.prototype.getDefaultLayer = function() {
|
|
8930
|
-
return this.getLayer(BASE_LAYER);
|
|
9122
|
+
return this.getLayer(BASE_LAYER, PLANE_LAYER_INDEX);
|
|
8931
9123
|
};
|
|
8932
9124
|
|
|
8933
9125
|
/**
|
|
@@ -8976,8 +9168,8 @@
|
|
|
8976
9168
|
*/
|
|
8977
9169
|
Canvas.prototype._createLayer = function(name, index) {
|
|
8978
9170
|
|
|
8979
|
-
if (
|
|
8980
|
-
index =
|
|
9171
|
+
if (typeof index === 'undefined') {
|
|
9172
|
+
index = UTILITY_LAYER_INDEX;
|
|
8981
9173
|
}
|
|
8982
9174
|
|
|
8983
9175
|
var childIndex = reduce(this._layers, function(childIndex, layer) {
|
|
@@ -8995,142 +9187,75 @@
|
|
|
8995
9187
|
|
|
8996
9188
|
};
|
|
8997
9189
|
|
|
8998
|
-
/**
|
|
8999
|
-
* Returns a plane that is used to draw elements on it.
|
|
9000
|
-
*
|
|
9001
|
-
* @param {string} name
|
|
9002
|
-
*
|
|
9003
|
-
* @return {Object} plane descriptor with { layer, rootElement, name }
|
|
9004
|
-
*/
|
|
9005
|
-
Canvas.prototype.getPlane = function(name) {
|
|
9006
|
-
if (!name) {
|
|
9007
|
-
throw new Error('must specify a name');
|
|
9008
|
-
}
|
|
9009
|
-
|
|
9010
|
-
var plane = this._planes[name];
|
|
9011
|
-
|
|
9012
|
-
return plane;
|
|
9013
|
-
};
|
|
9014
|
-
|
|
9015
|
-
/**
|
|
9016
|
-
* Creates a plane that is used to draw elements on it. If no
|
|
9017
|
-
* root element is provided, an implicit root will be used.
|
|
9018
|
-
*
|
|
9019
|
-
* @param {string} name
|
|
9020
|
-
* @param {Object|djs.model.Root} [rootElement] optional root element
|
|
9021
|
-
*
|
|
9022
|
-
* @return {Object} plane descriptor with { layer, rootElement, name }
|
|
9023
|
-
*/
|
|
9024
|
-
Canvas.prototype.createPlane = function(name, rootElement) {
|
|
9025
|
-
if (!name) {
|
|
9026
|
-
throw new Error('must specify a name');
|
|
9027
|
-
}
|
|
9028
|
-
|
|
9029
|
-
if (this._planes[name]) {
|
|
9030
|
-
throw new Error('plane ' + name + ' already exists');
|
|
9031
|
-
}
|
|
9032
|
-
|
|
9033
|
-
if (!rootElement) {
|
|
9034
|
-
rootElement = {
|
|
9035
|
-
id: '__implicitroot' + name,
|
|
9036
|
-
children: [],
|
|
9037
|
-
isImplicit: true
|
|
9038
|
-
};
|
|
9039
|
-
}
|
|
9040
|
-
|
|
9041
|
-
var svgLayer = this.getLayer(name);
|
|
9042
|
-
classes$1(svgLayer).add(HIDDEN_MARKER);
|
|
9043
|
-
|
|
9044
|
-
var plane = this._planes[name] = {
|
|
9045
|
-
layer: svgLayer,
|
|
9046
|
-
name: name,
|
|
9047
|
-
rootElement: null
|
|
9048
|
-
};
|
|
9049
|
-
|
|
9050
|
-
this.setRootElementForPlane(rootElement, plane);
|
|
9051
|
-
|
|
9052
|
-
return plane;
|
|
9053
|
-
};
|
|
9054
|
-
|
|
9055
|
-
/**
|
|
9056
|
-
* Sets the active plane and hides the previously active plane.
|
|
9057
|
-
*
|
|
9058
|
-
* @param {string|Object} plane
|
|
9059
|
-
*
|
|
9060
|
-
* @return {Object} plane descriptor with { layer, rootElement, name }
|
|
9061
|
-
*/
|
|
9062
|
-
Canvas.prototype.setActivePlane = function(plane) {
|
|
9063
|
-
if (!plane) {
|
|
9064
|
-
throw new Error('must specify a plane');
|
|
9065
|
-
}
|
|
9066
|
-
|
|
9067
|
-
if (typeof plane === 'string') {
|
|
9068
|
-
plane = this.getPlane(plane);
|
|
9069
|
-
}
|
|
9070
9190
|
|
|
9071
|
-
|
|
9072
|
-
if (this._activePlane) {
|
|
9073
|
-
classes$1(this._activePlane.layer).add(HIDDEN_MARKER);
|
|
9074
|
-
}
|
|
9191
|
+
Canvas.prototype._removeLayer = function(name) {
|
|
9075
9192
|
|
|
9076
|
-
|
|
9193
|
+
var layer = this._layers[name];
|
|
9077
9194
|
|
|
9078
|
-
|
|
9079
|
-
|
|
9195
|
+
if (layer) {
|
|
9196
|
+
delete this._layers[name];
|
|
9080
9197
|
|
|
9081
|
-
|
|
9082
|
-
this._elementRegistry.updateGraphics(plane.rootElement, this._svg, true);
|
|
9198
|
+
remove$2(layer.group);
|
|
9083
9199
|
}
|
|
9084
|
-
|
|
9085
|
-
this._eventBus.fire('plane.set', { plane: plane });
|
|
9086
|
-
|
|
9087
|
-
return plane;
|
|
9088
9200
|
};
|
|
9089
9201
|
|
|
9090
9202
|
/**
|
|
9091
|
-
* Returns the currently active layer
|
|
9203
|
+
* Returns the currently active layer. Can be null.
|
|
9092
9204
|
*
|
|
9093
|
-
* @returns {SVGElement}
|
|
9205
|
+
* @returns {SVGElement|null}
|
|
9094
9206
|
*/
|
|
9095
|
-
|
|
9096
9207
|
Canvas.prototype.getActiveLayer = function() {
|
|
9097
|
-
|
|
9098
|
-
};
|
|
9208
|
+
var plane = this._findPlaneForRoot(this.getRootElement());
|
|
9099
9209
|
|
|
9100
|
-
/**
|
|
9101
|
-
* Returns the currently active plane.
|
|
9102
|
-
*
|
|
9103
|
-
* @return {Object} plane descriptor with { layer, rootElement, name }
|
|
9104
|
-
*/
|
|
9105
|
-
Canvas.prototype.getActivePlane = function() {
|
|
9106
|
-
var plane = this._activePlane;
|
|
9107
9210
|
if (!plane) {
|
|
9108
|
-
|
|
9109
|
-
this.setActivePlane(BASE_LAYER);
|
|
9211
|
+
return null;
|
|
9110
9212
|
}
|
|
9111
9213
|
|
|
9112
|
-
return plane;
|
|
9214
|
+
return plane.layer;
|
|
9113
9215
|
};
|
|
9114
9216
|
|
|
9217
|
+
|
|
9115
9218
|
/**
|
|
9116
9219
|
* Returns the plane which contains the given element.
|
|
9117
9220
|
*
|
|
9118
9221
|
* @param {string|djs.model.Base} element
|
|
9119
9222
|
*
|
|
9120
|
-
* @return {
|
|
9223
|
+
* @return {djs.model.Base} root for element
|
|
9121
9224
|
*/
|
|
9122
|
-
Canvas.prototype.
|
|
9225
|
+
Canvas.prototype.findRoot = function(element) {
|
|
9123
9226
|
if (typeof element === 'string') {
|
|
9124
9227
|
element = this._elementRegistry.get(element);
|
|
9125
9228
|
}
|
|
9126
9229
|
|
|
9127
|
-
|
|
9230
|
+
if (!element) {
|
|
9231
|
+
return;
|
|
9232
|
+
}
|
|
9233
|
+
|
|
9234
|
+
var plane = this._findPlaneForRoot(
|
|
9235
|
+
findRoot(element)
|
|
9236
|
+
) || {};
|
|
9237
|
+
|
|
9238
|
+
return plane.rootElement;
|
|
9239
|
+
};
|
|
9240
|
+
|
|
9241
|
+
/**
|
|
9242
|
+
* Return a list of all root elements on the diagram.
|
|
9243
|
+
*
|
|
9244
|
+
* @return {djs.model.Root[]}
|
|
9245
|
+
*/
|
|
9246
|
+
Canvas.prototype.getRootElements = function() {
|
|
9247
|
+
return this._planes.map(function(plane) {
|
|
9248
|
+
return plane.rootElement;
|
|
9249
|
+
});
|
|
9250
|
+
};
|
|
9128
9251
|
|
|
9252
|
+
Canvas.prototype._findPlaneForRoot = function(rootElement) {
|
|
9129
9253
|
return find(this._planes, function(plane) {
|
|
9130
|
-
return plane.rootElement ===
|
|
9254
|
+
return plane.rootElement === rootElement;
|
|
9131
9255
|
});
|
|
9132
9256
|
};
|
|
9133
9257
|
|
|
9258
|
+
|
|
9134
9259
|
/**
|
|
9135
9260
|
* Returns the html element that encloses the
|
|
9136
9261
|
* drawing canvas.
|
|
@@ -9251,95 +9376,205 @@
|
|
|
9251
9376
|
}
|
|
9252
9377
|
};
|
|
9253
9378
|
|
|
9379
|
+
/**
|
|
9380
|
+
* Returns the current root element.
|
|
9381
|
+
*
|
|
9382
|
+
* Supports two different modes for handling root elements:
|
|
9383
|
+
*
|
|
9384
|
+
* 1. if no root element has been added before, an implicit root will be added
|
|
9385
|
+
* and returned. This is used in applications that don't require explicit
|
|
9386
|
+
* root elements.
|
|
9387
|
+
*
|
|
9388
|
+
* 2. when root elements have been added before calling `getRootElement`,
|
|
9389
|
+
* root elements can be null. This is used for applications that want to manage
|
|
9390
|
+
* root elements themselves.
|
|
9391
|
+
*
|
|
9392
|
+
* @returns {Object|djs.model.Root|null} rootElement.
|
|
9393
|
+
*/
|
|
9254
9394
|
Canvas.prototype.getRootElement = function() {
|
|
9255
|
-
var
|
|
9395
|
+
var rootElement = this._rootElement;
|
|
9256
9396
|
|
|
9257
|
-
return
|
|
9397
|
+
// can return null if root elements are present but none was set yet
|
|
9398
|
+
if (rootElement || this._planes.length) {
|
|
9399
|
+
return rootElement;
|
|
9400
|
+
}
|
|
9401
|
+
|
|
9402
|
+
return this.setRootElement(this.addRootElement(null));
|
|
9258
9403
|
};
|
|
9259
9404
|
|
|
9405
|
+
/**
|
|
9406
|
+
* Adds a given root element and returns it.
|
|
9407
|
+
*
|
|
9408
|
+
* @param {Object|djs.model.Root} rootElement
|
|
9409
|
+
*
|
|
9410
|
+
* @return {Object|djs.model.Root} rootElement
|
|
9411
|
+
*/
|
|
9260
9412
|
|
|
9413
|
+
Canvas.prototype.addRootElement = function(rootElement) {
|
|
9414
|
+
var idx = this._rootsIdx++;
|
|
9261
9415
|
|
|
9262
|
-
|
|
9416
|
+
if (!rootElement) {
|
|
9417
|
+
rootElement = {
|
|
9418
|
+
id: '__implicitroot_' + idx,
|
|
9419
|
+
children: [],
|
|
9420
|
+
isImplicit: true
|
|
9421
|
+
};
|
|
9422
|
+
}
|
|
9423
|
+
|
|
9424
|
+
var layerName = rootElement.layer = 'root-' + idx;
|
|
9425
|
+
|
|
9426
|
+
this._ensureValid('root', rootElement);
|
|
9427
|
+
|
|
9428
|
+
var layer = this.getLayer(layerName, PLANE_LAYER_INDEX);
|
|
9429
|
+
|
|
9430
|
+
attr$1(layer, 'display', 'none');
|
|
9431
|
+
|
|
9432
|
+
this._addRoot(rootElement, layer);
|
|
9433
|
+
|
|
9434
|
+
this._planes.push({
|
|
9435
|
+
rootElement: rootElement,
|
|
9436
|
+
layer: layer
|
|
9437
|
+
});
|
|
9438
|
+
|
|
9439
|
+
return rootElement;
|
|
9440
|
+
};
|
|
9263
9441
|
|
|
9264
9442
|
/**
|
|
9265
|
-
*
|
|
9266
|
-
* and returns the new root element.
|
|
9443
|
+
* Removes a given rootElement and returns it.
|
|
9267
9444
|
*
|
|
9268
|
-
* @param {
|
|
9269
|
-
* @param {boolean} [override] whether to override the current root element, if any
|
|
9445
|
+
* @param {djs.model.Root|String} rootElement
|
|
9270
9446
|
*
|
|
9271
|
-
* @return {Object|djs.model.Root}
|
|
9447
|
+
* @return {Object|djs.model.Root} rootElement
|
|
9272
9448
|
*/
|
|
9273
|
-
Canvas.prototype.
|
|
9274
|
-
var activePlane = this._activePlane;
|
|
9449
|
+
Canvas.prototype.removeRootElement = function(rootElement) {
|
|
9275
9450
|
|
|
9276
|
-
if (
|
|
9277
|
-
|
|
9278
|
-
}
|
|
9279
|
-
|
|
9451
|
+
if (typeof rootElement === 'string') {
|
|
9452
|
+
rootElement = this._elementRegistry.get(rootElement);
|
|
9453
|
+
}
|
|
9454
|
+
|
|
9455
|
+
var plane = this._findPlaneForRoot(rootElement);
|
|
9456
|
+
|
|
9457
|
+
if (!plane) {
|
|
9458
|
+
return;
|
|
9459
|
+
}
|
|
9460
|
+
|
|
9461
|
+
// hook up life-cycle events
|
|
9462
|
+
this._removeRoot(rootElement);
|
|
9280
9463
|
|
|
9281
|
-
|
|
9464
|
+
// clean up layer
|
|
9465
|
+
this._removeLayer(rootElement.layer);
|
|
9466
|
+
|
|
9467
|
+
// clean up plane
|
|
9468
|
+
this._planes = this._planes.filter(function(plane) {
|
|
9469
|
+
return plane.rootElement !== rootElement;
|
|
9470
|
+
});
|
|
9282
9471
|
|
|
9283
|
-
|
|
9472
|
+
// clean up active root
|
|
9473
|
+
if (this._rootElement === rootElement) {
|
|
9474
|
+
this._rootElement = null;
|
|
9284
9475
|
}
|
|
9476
|
+
|
|
9477
|
+
return rootElement;
|
|
9285
9478
|
};
|
|
9286
9479
|
|
|
9287
9480
|
|
|
9481
|
+
// root element handling //////////////////////
|
|
9482
|
+
|
|
9288
9483
|
/**
|
|
9289
9484
|
* Sets a given element as the new root element for the canvas
|
|
9290
9485
|
* and returns the new root element.
|
|
9291
9486
|
*
|
|
9292
|
-
* @param {Object|djs.model.Root}
|
|
9293
|
-
* @param {Object|djs.model.Root} plane
|
|
9294
|
-
* @param {boolean} [override] whether to override the current root element, if any
|
|
9487
|
+
* @param {Object|djs.model.Root} rootElement
|
|
9295
9488
|
*
|
|
9296
9489
|
* @return {Object|djs.model.Root} new root element
|
|
9297
9490
|
*/
|
|
9298
|
-
Canvas.prototype.
|
|
9491
|
+
Canvas.prototype.setRootElement = function(rootElement, override) {
|
|
9299
9492
|
|
|
9300
|
-
if (
|
|
9301
|
-
|
|
9493
|
+
if (isDefined(override)) {
|
|
9494
|
+
throw new Error('override not supported');
|
|
9302
9495
|
}
|
|
9303
9496
|
|
|
9304
|
-
if (
|
|
9305
|
-
|
|
9497
|
+
if (rootElement === this._rootElement) {
|
|
9498
|
+
return;
|
|
9306
9499
|
}
|
|
9307
9500
|
|
|
9308
|
-
var
|
|
9309
|
-
elementRegistry = this._elementRegistry,
|
|
9310
|
-
eventBus = this._eventBus;
|
|
9501
|
+
var plane;
|
|
9311
9502
|
|
|
9312
|
-
if (
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
}
|
|
9503
|
+
if (!rootElement) {
|
|
9504
|
+
throw new Error('rootElement required');
|
|
9505
|
+
}
|
|
9316
9506
|
|
|
9317
|
-
|
|
9318
|
-
eventBus.fire('root.remove', { element: currentRoot });
|
|
9319
|
-
eventBus.fire('root.removed', { element: currentRoot });
|
|
9507
|
+
plane = this._findPlaneForRoot(rootElement);
|
|
9320
9508
|
|
|
9321
|
-
|
|
9509
|
+
// give set add semantics for backwards compatibility
|
|
9510
|
+
if (!plane) {
|
|
9511
|
+
rootElement = this.addRootElement(rootElement);
|
|
9322
9512
|
}
|
|
9323
9513
|
|
|
9324
|
-
|
|
9325
|
-
|
|
9514
|
+
this._setRoot(rootElement);
|
|
9515
|
+
|
|
9516
|
+
return rootElement;
|
|
9517
|
+
};
|
|
9518
|
+
|
|
9519
|
+
|
|
9520
|
+
Canvas.prototype._removeRoot = function(element) {
|
|
9521
|
+
var elementRegistry = this._elementRegistry,
|
|
9522
|
+
eventBus = this._eventBus;
|
|
9523
|
+
|
|
9524
|
+
// simulate element remove event sequence
|
|
9525
|
+
eventBus.fire('root.remove', { element: element });
|
|
9526
|
+
eventBus.fire('root.removed', { element: element });
|
|
9326
9527
|
|
|
9327
|
-
|
|
9328
|
-
|
|
9528
|
+
elementRegistry.remove(element);
|
|
9529
|
+
};
|
|
9530
|
+
|
|
9531
|
+
|
|
9532
|
+
Canvas.prototype._addRoot = function(element, gfx) {
|
|
9533
|
+
var elementRegistry = this._elementRegistry,
|
|
9534
|
+
eventBus = this._eventBus;
|
|
9535
|
+
|
|
9536
|
+
// resemble element add event sequence
|
|
9537
|
+
eventBus.fire('root.add', { element: element });
|
|
9538
|
+
|
|
9539
|
+
elementRegistry.add(element, gfx);
|
|
9540
|
+
|
|
9541
|
+
eventBus.fire('root.added', { element: element, gfx: gfx });
|
|
9542
|
+
};
|
|
9543
|
+
|
|
9544
|
+
|
|
9545
|
+
Canvas.prototype._setRoot = function(rootElement, layer) {
|
|
9546
|
+
|
|
9547
|
+
var currentRoot = this._rootElement;
|
|
9548
|
+
|
|
9549
|
+
var currentLayer;
|
|
9550
|
+
|
|
9551
|
+
if (currentRoot) {
|
|
9329
9552
|
|
|
9330
|
-
|
|
9553
|
+
// un-associate previous root element <svg>
|
|
9554
|
+
this._elementRegistry.updateGraphics(currentRoot, null, true);
|
|
9331
9555
|
|
|
9332
|
-
|
|
9556
|
+
// hide previous layer
|
|
9557
|
+
currentLayer = this._findPlaneForRoot(currentRoot).layer;
|
|
9333
9558
|
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9559
|
+
attr$1(currentLayer, 'display', 'none');
|
|
9560
|
+
}
|
|
9561
|
+
|
|
9562
|
+
if (rootElement) {
|
|
9563
|
+
|
|
9564
|
+
if (!layer) {
|
|
9565
|
+
layer = this._findPlaneForRoot(rootElement).layer;
|
|
9337
9566
|
}
|
|
9567
|
+
|
|
9568
|
+
// associate element with <svg>
|
|
9569
|
+
this._elementRegistry.updateGraphics(rootElement, this._svg, true);
|
|
9570
|
+
|
|
9571
|
+
// show root layer
|
|
9572
|
+
attr$1(layer, 'display', null);
|
|
9338
9573
|
}
|
|
9339
9574
|
|
|
9340
|
-
|
|
9575
|
+
this._rootElement = rootElement;
|
|
9341
9576
|
|
|
9342
|
-
|
|
9577
|
+
this._eventBus.fire('root.set', { element: rootElement });
|
|
9343
9578
|
};
|
|
9344
9579
|
|
|
9345
9580
|
// add functionality //////////////////////
|
|
@@ -9350,7 +9585,7 @@
|
|
|
9350
9585
|
}
|
|
9351
9586
|
|
|
9352
9587
|
if (this._elementRegistry.get(element.id)) {
|
|
9353
|
-
throw new Error('element
|
|
9588
|
+
throw new Error('element <' + element.id + '> already exists');
|
|
9354
9589
|
}
|
|
9355
9590
|
|
|
9356
9591
|
var requiredAttrs = REQUIRED_MODEL_ATTRS[type];
|
|
@@ -9640,6 +9875,7 @@
|
|
|
9640
9875
|
innerBox,
|
|
9641
9876
|
outerBox = this.getSize(),
|
|
9642
9877
|
matrix,
|
|
9878
|
+
activeLayer,
|
|
9643
9879
|
transform,
|
|
9644
9880
|
scale,
|
|
9645
9881
|
x, y;
|
|
@@ -9647,9 +9883,11 @@
|
|
|
9647
9883
|
if (!box) {
|
|
9648
9884
|
|
|
9649
9885
|
// compute the inner box based on the
|
|
9650
|
-
// diagrams
|
|
9886
|
+
// diagrams active layer. This allows us to exclude
|
|
9651
9887
|
// external components, such as overlays
|
|
9652
|
-
|
|
9888
|
+
|
|
9889
|
+
activeLayer = this._rootElement ? this.getActiveLayer() : null;
|
|
9890
|
+
innerBox = activeLayer && activeLayer.getBBox() || {};
|
|
9653
9891
|
|
|
9654
9892
|
transform = transform$1(viewport);
|
|
9655
9893
|
matrix = transform ? transform.matrix : createMatrix();
|
|
@@ -9665,10 +9903,10 @@
|
|
|
9665
9903
|
height: outerBox.height / scale,
|
|
9666
9904
|
scale: scale,
|
|
9667
9905
|
inner: {
|
|
9668
|
-
width: innerBox.width,
|
|
9669
|
-
height: innerBox.height,
|
|
9670
|
-
x: innerBox.x,
|
|
9671
|
-
y: innerBox.y
|
|
9906
|
+
width: innerBox.width || 0,
|
|
9907
|
+
height: innerBox.height || 0,
|
|
9908
|
+
x: innerBox.x || 0,
|
|
9909
|
+
y: innerBox.y || 0
|
|
9672
9910
|
},
|
|
9673
9911
|
outer: outerBox
|
|
9674
9912
|
};
|
|
@@ -9721,17 +9959,22 @@
|
|
|
9721
9959
|
* Scrolls the viewbox to contain the given element.
|
|
9722
9960
|
* Optionally specify a padding to be applied to the edges.
|
|
9723
9961
|
*
|
|
9724
|
-
* @param {Object} [element] the element to scroll to.
|
|
9962
|
+
* @param {Object|String} [element] the element to scroll to.
|
|
9725
9963
|
* @param {Object|Number} [padding=100] the padding to be applied. Can also specify top, bottom, left and right.
|
|
9726
9964
|
*
|
|
9727
9965
|
*/
|
|
9728
9966
|
Canvas.prototype.scrollToElement = function(element, padding) {
|
|
9729
9967
|
var defaultPadding = 100;
|
|
9730
9968
|
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9969
|
+
if (typeof element === 'string') {
|
|
9970
|
+
element = this._elementRegistry.get(element);
|
|
9971
|
+
}
|
|
9972
|
+
|
|
9973
|
+
// set to correct rootElement
|
|
9974
|
+
var rootElement = this.findRoot(element);
|
|
9975
|
+
|
|
9976
|
+
if (rootElement !== this.getRootElement()) {
|
|
9977
|
+
this.setRootElement(rootElement);
|
|
9735
9978
|
}
|
|
9736
9979
|
|
|
9737
9980
|
if (!padding) {
|
|
@@ -10094,7 +10337,9 @@
|
|
|
10094
10337
|
container.gfx = gfx;
|
|
10095
10338
|
}
|
|
10096
10339
|
|
|
10097
|
-
|
|
10340
|
+
if (gfx) {
|
|
10341
|
+
attr$1(gfx, ELEMENT_ID, id);
|
|
10342
|
+
}
|
|
10098
10343
|
|
|
10099
10344
|
return gfx;
|
|
10100
10345
|
};
|
|
@@ -19871,18 +20116,29 @@
|
|
|
19871
20116
|
|
|
19872
20117
|
var walker = new BpmnTreeWalker(visitor, translate);
|
|
19873
20118
|
|
|
20119
|
+
|
|
20120
|
+
bpmnDiagram = bpmnDiagram || (definitions.diagrams && definitions.diagrams[0]);
|
|
20121
|
+
|
|
20122
|
+
var diagramsToImport = getDiagramsToImport(definitions, bpmnDiagram);
|
|
20123
|
+
|
|
20124
|
+
if (!diagramsToImport) {
|
|
20125
|
+
throw new Error(translate('no diagram to display'));
|
|
20126
|
+
}
|
|
20127
|
+
|
|
19874
20128
|
// traverse BPMN 2.0 document model,
|
|
19875
20129
|
// starting at definitions
|
|
19876
|
-
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
}
|
|
19880
|
-
} else {
|
|
19881
|
-
walker.handleDefinitions(definitions, bpmnDiagram);
|
|
19882
|
-
}
|
|
20130
|
+
forEach(diagramsToImport, function(diagram) {
|
|
20131
|
+
walker.handleDefinitions(definitions, diagram);
|
|
20132
|
+
});
|
|
19883
20133
|
|
|
19884
|
-
var
|
|
19885
|
-
|
|
20134
|
+
var rootId = bpmnDiagram.plane.bpmnElement.id;
|
|
20135
|
+
|
|
20136
|
+
// we do need to account for different ways we create root elements
|
|
20137
|
+
// each nested imported <root> do have the `_plane` suffix, while
|
|
20138
|
+
// the root <root> is found under the business object ID
|
|
20139
|
+
canvas.setRootElement(
|
|
20140
|
+
canvas.findRoot(rootId + '_plane') || canvas.findRoot(rootId)
|
|
20141
|
+
);
|
|
19886
20142
|
}
|
|
19887
20143
|
|
|
19888
20144
|
return new Promise(function(resolve, reject) {
|
|
@@ -19910,6 +20166,107 @@
|
|
|
19910
20166
|
});
|
|
19911
20167
|
}
|
|
19912
20168
|
|
|
20169
|
+
/**
|
|
20170
|
+
* Returns all diagrams in the same hirarchy as the requested diagram.
|
|
20171
|
+
* Includes all parent and sub process diagrams.
|
|
20172
|
+
*
|
|
20173
|
+
* @param {Array} definitions
|
|
20174
|
+
* @param {Object} bpmnDiagram
|
|
20175
|
+
*
|
|
20176
|
+
* @returns {Array<Object>}
|
|
20177
|
+
*/
|
|
20178
|
+
function getDiagramsToImport(definitions, bpmnDiagram) {
|
|
20179
|
+
if (!bpmnDiagram) {
|
|
20180
|
+
return;
|
|
20181
|
+
}
|
|
20182
|
+
|
|
20183
|
+
var bpmnElement = bpmnDiagram.plane.bpmnElement,
|
|
20184
|
+
rootElement = bpmnElement;
|
|
20185
|
+
|
|
20186
|
+
if (!is$1(bpmnElement, 'bpmn:Process') && !is$1(bpmnElement, 'bpmn:Collaboration')) {
|
|
20187
|
+
rootElement = findRootProcess(bpmnElement);
|
|
20188
|
+
}
|
|
20189
|
+
|
|
20190
|
+
// in case the process is part of a collaboration, the plane references the
|
|
20191
|
+
// collaboration, not the process
|
|
20192
|
+
var collaboration;
|
|
20193
|
+
|
|
20194
|
+
if (is$1(rootElement, 'bpmn:Collaboration')) {
|
|
20195
|
+
collaboration = rootElement;
|
|
20196
|
+
} else {
|
|
20197
|
+
collaboration = find(definitions.rootElements, function(element) {
|
|
20198
|
+
if (!is$1(element, 'bpmn:Collaboration')) {
|
|
20199
|
+
return;
|
|
20200
|
+
}
|
|
20201
|
+
|
|
20202
|
+
return find(element.participants, function(participant) {
|
|
20203
|
+
return participant.processRef === rootElement;
|
|
20204
|
+
});
|
|
20205
|
+
});
|
|
20206
|
+
}
|
|
20207
|
+
|
|
20208
|
+
var rootElements = [ rootElement ];
|
|
20209
|
+
|
|
20210
|
+
// all collaboration processes can contain sub-diagrams
|
|
20211
|
+
if (collaboration) {
|
|
20212
|
+
rootElements = map$1(collaboration.participants, function(participant) {
|
|
20213
|
+
return participant.processRef;
|
|
20214
|
+
});
|
|
20215
|
+
|
|
20216
|
+
rootElements.push(collaboration);
|
|
20217
|
+
}
|
|
20218
|
+
|
|
20219
|
+
var allChildren = selfAndAllFlowElements(rootElements);
|
|
20220
|
+
|
|
20221
|
+
// if we have multiple diagrams referencing the same element, we
|
|
20222
|
+
// use the first in the file
|
|
20223
|
+
var diagramsToImport = [ bpmnDiagram ];
|
|
20224
|
+
var handledElements = [ bpmnElement ];
|
|
20225
|
+
|
|
20226
|
+
forEach(definitions.diagrams, function(diagram) {
|
|
20227
|
+
var businessObject = diagram.plane.bpmnElement;
|
|
20228
|
+
|
|
20229
|
+
if (
|
|
20230
|
+
allChildren.indexOf(businessObject) !== -1 &&
|
|
20231
|
+
handledElements.indexOf(businessObject) === -1
|
|
20232
|
+
) {
|
|
20233
|
+
diagramsToImport.push(diagram);
|
|
20234
|
+
handledElements.push(businessObject);
|
|
20235
|
+
}
|
|
20236
|
+
});
|
|
20237
|
+
|
|
20238
|
+
|
|
20239
|
+
return diagramsToImport;
|
|
20240
|
+
}
|
|
20241
|
+
|
|
20242
|
+
function selfAndAllFlowElements(elements) {
|
|
20243
|
+
var result = [];
|
|
20244
|
+
|
|
20245
|
+
forEach(elements, function(element) {
|
|
20246
|
+
if (!element) {
|
|
20247
|
+
return;
|
|
20248
|
+
}
|
|
20249
|
+
|
|
20250
|
+
result.push(element);
|
|
20251
|
+
|
|
20252
|
+
result = result.concat(selfAndAllFlowElements(element.flowElements));
|
|
20253
|
+
});
|
|
20254
|
+
|
|
20255
|
+
return result;
|
|
20256
|
+
}
|
|
20257
|
+
|
|
20258
|
+
function findRootProcess(element) {
|
|
20259
|
+
var parent = element;
|
|
20260
|
+
|
|
20261
|
+
while (parent) {
|
|
20262
|
+
if (is$1(parent, 'bpmn:Process')) {
|
|
20263
|
+
return parent;
|
|
20264
|
+
}
|
|
20265
|
+
|
|
20266
|
+
parent = parent.$parent;
|
|
20267
|
+
}
|
|
20268
|
+
}
|
|
20269
|
+
|
|
19913
20270
|
/**
|
|
19914
20271
|
* This file must not be changed or exchanged.
|
|
19915
20272
|
*
|
|
@@ -20400,7 +20757,7 @@
|
|
|
20400
20757
|
try {
|
|
20401
20758
|
var canvas = self.get('canvas');
|
|
20402
20759
|
|
|
20403
|
-
var contentNode = canvas.
|
|
20760
|
+
var contentNode = canvas.getActiveLayer(),
|
|
20404
20761
|
defsNode = query('defs', canvas._svg);
|
|
20405
20762
|
|
|
20406
20763
|
var contents = innerSVG(contentNode),
|
|
@@ -20782,7 +21139,7 @@
|
|
|
20782
21139
|
TranslateModule,
|
|
20783
21140
|
SelectionModule,
|
|
20784
21141
|
OverlaysModule,
|
|
20785
|
-
|
|
21142
|
+
DrilldownModdule
|
|
20786
21143
|
];
|
|
20787
21144
|
|
|
20788
21145
|
// default moddle extensions the viewer is composed of
|