bpmn-js 9.0.0-subprocesses.3 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/dist/assets/bpmn-js.css +38 -4
- package/dist/assets/diagram-js.css +1 -1
- package/dist/bpmn-modeler.development.js +2411 -1110
- package/dist/bpmn-modeler.production.min.js +8 -8
- package/dist/bpmn-navigated-viewer.development.js +983 -315
- package/dist/bpmn-navigated-viewer.production.min.js +6 -6
- package/dist/bpmn-viewer.development.js +983 -315
- package/dist/bpmn-viewer.production.min.js +6 -6
- package/lib/BaseViewer.js +1 -1
- package/lib/draw/BpmnRenderer.js +8 -7
- 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 +87 -10
- package/lib/features/drilldown/DrilldownOverlayBehavior.js +181 -0
- package/lib/features/drilldown/SubprocessCompatibility.js +9 -6
- package/lib/features/drilldown/index.js +7 -4
- 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 +15 -9
- 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/lib/features/drilldown/DrilldownOverlays.js +0 -110
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-modeler v9.0.0
|
|
2
|
+
* bpmn-js - bpmn-modeler v9.0.0
|
|
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() :
|
|
@@ -564,7 +564,7 @@
|
|
|
564
564
|
*
|
|
565
565
|
* const matcher = matchPattern({ id: 1 });
|
|
566
566
|
*
|
|
567
|
-
*
|
|
567
|
+
* let element = find(elements, matcher);
|
|
568
568
|
*
|
|
569
569
|
* @param {Object} pattern
|
|
570
570
|
*
|
|
@@ -600,8 +600,11 @@
|
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
/**
|
|
603
|
-
* Debounce fn, calling it only once if
|
|
604
|
-
*
|
|
603
|
+
* Debounce fn, calling it only once if the given time
|
|
604
|
+
* elapsed between calls.
|
|
605
|
+
*
|
|
606
|
+
* Lodash-style the function exposes methods to `#clear`
|
|
607
|
+
* and `#flush` to control internal behavior.
|
|
605
608
|
*
|
|
606
609
|
* @param {Function} fn
|
|
607
610
|
* @param {Number} timeout
|
|
@@ -614,23 +617,39 @@
|
|
|
614
617
|
var lastThis;
|
|
615
618
|
var lastNow;
|
|
616
619
|
|
|
617
|
-
function fire() {
|
|
620
|
+
function fire(force) {
|
|
618
621
|
var now = Date.now();
|
|
619
|
-
var scheduledDiff = lastNow + timeout - now;
|
|
622
|
+
var scheduledDiff = force ? 0 : lastNow + timeout - now;
|
|
620
623
|
|
|
621
624
|
if (scheduledDiff > 0) {
|
|
622
625
|
return schedule(scheduledDiff);
|
|
623
626
|
}
|
|
624
627
|
|
|
625
628
|
fn.apply(lastThis, lastArgs);
|
|
626
|
-
|
|
629
|
+
clear();
|
|
627
630
|
}
|
|
628
631
|
|
|
629
632
|
function schedule(timeout) {
|
|
630
633
|
timer = setTimeout(fire, timeout);
|
|
631
634
|
}
|
|
632
635
|
|
|
633
|
-
|
|
636
|
+
function clear() {
|
|
637
|
+
if (timer) {
|
|
638
|
+
clearTimeout(timer);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
timer = lastNow = lastArgs = lastThis = undefined;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
function flush() {
|
|
645
|
+
if (timer) {
|
|
646
|
+
fire(true);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
clear();
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
function callback() {
|
|
634
653
|
lastNow = Date.now();
|
|
635
654
|
|
|
636
655
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -643,7 +662,11 @@
|
|
|
643
662
|
if (!timer) {
|
|
644
663
|
schedule(timeout);
|
|
645
664
|
}
|
|
646
|
-
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
callback.flush = flush;
|
|
668
|
+
callback.cancel = clear;
|
|
669
|
+
return callback;
|
|
647
670
|
}
|
|
648
671
|
/**
|
|
649
672
|
* Bind function against target <this>.
|
|
@@ -4364,7 +4387,6 @@
|
|
|
4364
4387
|
}
|
|
4365
4388
|
|
|
4366
4389
|
var BASE_LAYER = 'base';
|
|
4367
|
-
var HIDDEN_MARKER = 'djs-element-hidden';
|
|
4368
4390
|
|
|
4369
4391
|
// render plane contents behind utility layers
|
|
4370
4392
|
var PLANE_LAYER_INDEX = 0;
|
|
@@ -4395,6 +4417,12 @@
|
|
|
4395
4417
|
this._elementRegistry = elementRegistry;
|
|
4396
4418
|
this._graphicsFactory = graphicsFactory;
|
|
4397
4419
|
|
|
4420
|
+
this._rootsIdx = 0;
|
|
4421
|
+
|
|
4422
|
+
this._layers = {};
|
|
4423
|
+
this._planes = [];
|
|
4424
|
+
this._rootElement = null;
|
|
4425
|
+
|
|
4398
4426
|
this._init(config || {});
|
|
4399
4427
|
}
|
|
4400
4428
|
|
|
@@ -4432,9 +4460,6 @@
|
|
|
4432
4460
|
|
|
4433
4461
|
var viewport = this._viewport = createGroup(svg, 'viewport');
|
|
4434
4462
|
|
|
4435
|
-
this._layers = {};
|
|
4436
|
-
this._planes = {};
|
|
4437
|
-
|
|
4438
4463
|
// debounce canvas.viewbox.changed events
|
|
4439
4464
|
// for smoother diagram interaction
|
|
4440
4465
|
if (config.deferUpdate !== false) {
|
|
@@ -4469,7 +4494,7 @@
|
|
|
4469
4494
|
'shape.removed',
|
|
4470
4495
|
'connection.removed',
|
|
4471
4496
|
'elements.changed',
|
|
4472
|
-
'
|
|
4497
|
+
'root.set'
|
|
4473
4498
|
], function() {
|
|
4474
4499
|
delete this._cachedViewbox;
|
|
4475
4500
|
}, this);
|
|
@@ -4494,7 +4519,7 @@
|
|
|
4494
4519
|
delete this._container;
|
|
4495
4520
|
delete this._layers;
|
|
4496
4521
|
delete this._planes;
|
|
4497
|
-
delete this.
|
|
4522
|
+
delete this._rootElement;
|
|
4498
4523
|
delete this._viewport;
|
|
4499
4524
|
};
|
|
4500
4525
|
|
|
@@ -4509,15 +4534,15 @@
|
|
|
4509
4534
|
var type = getType(element);
|
|
4510
4535
|
|
|
4511
4536
|
if (type === 'root') {
|
|
4512
|
-
self.
|
|
4537
|
+
self.removeRootElement(element);
|
|
4513
4538
|
} else {
|
|
4514
4539
|
self._removeElement(element, type);
|
|
4515
4540
|
}
|
|
4516
4541
|
});
|
|
4517
4542
|
|
|
4518
4543
|
// remove all planes
|
|
4519
|
-
this.
|
|
4520
|
-
this.
|
|
4544
|
+
this._planes = [];
|
|
4545
|
+
this._rootElement = null;
|
|
4521
4546
|
|
|
4522
4547
|
// force recomputation of view box
|
|
4523
4548
|
delete this._cachedViewbox;
|
|
@@ -4598,140 +4623,75 @@
|
|
|
4598
4623
|
|
|
4599
4624
|
};
|
|
4600
4625
|
|
|
4601
|
-
/**
|
|
4602
|
-
* Returns a plane that is used to draw elements on it.
|
|
4603
|
-
*
|
|
4604
|
-
* @param {string} name
|
|
4605
|
-
*
|
|
4606
|
-
* @return {Object} plane descriptor with { layer, rootElement, name }
|
|
4607
|
-
*/
|
|
4608
|
-
Canvas.prototype.getPlane = function(name) {
|
|
4609
|
-
if (!name) {
|
|
4610
|
-
throw new Error('must specify a name');
|
|
4611
|
-
}
|
|
4612
|
-
|
|
4613
|
-
return this._planes[name];
|
|
4614
|
-
};
|
|
4615
|
-
|
|
4616
|
-
/**
|
|
4617
|
-
* Creates a plane that is used to draw elements on it. If no
|
|
4618
|
-
* root element is provided, an implicit root will be used.
|
|
4619
|
-
*
|
|
4620
|
-
* @param {string} name
|
|
4621
|
-
* @param {Object|djs.model.Root} [rootElement] optional root element
|
|
4622
|
-
*
|
|
4623
|
-
* @return {Object} plane descriptor with { layer, rootElement, name }
|
|
4624
|
-
*/
|
|
4625
|
-
Canvas.prototype.createPlane = function(name, rootElement) {
|
|
4626
|
-
if (!name) {
|
|
4627
|
-
throw new Error('must specify a name');
|
|
4628
|
-
}
|
|
4629
|
-
|
|
4630
|
-
if (this._planes[name]) {
|
|
4631
|
-
throw new Error('plane ' + name + ' already exists');
|
|
4632
|
-
}
|
|
4633
|
-
|
|
4634
|
-
if (!rootElement) {
|
|
4635
|
-
rootElement = {
|
|
4636
|
-
id: '__implicitroot' + name,
|
|
4637
|
-
children: [],
|
|
4638
|
-
isImplicit: true
|
|
4639
|
-
};
|
|
4640
|
-
}
|
|
4641
|
-
|
|
4642
|
-
var svgLayer = this.getLayer(name, PLANE_LAYER_INDEX);
|
|
4643
|
-
classes(svgLayer).add(HIDDEN_MARKER);
|
|
4644
|
-
|
|
4645
|
-
var plane = this._planes[name] = {
|
|
4646
|
-
layer: svgLayer,
|
|
4647
|
-
name: name,
|
|
4648
|
-
rootElement: null
|
|
4649
|
-
};
|
|
4650
|
-
|
|
4651
|
-
this.setRootElementForPlane(rootElement, plane);
|
|
4652
|
-
|
|
4653
|
-
return plane;
|
|
4654
|
-
};
|
|
4655
|
-
|
|
4656
|
-
/**
|
|
4657
|
-
* Sets the active plane and hides the previously active plane.
|
|
4658
|
-
*
|
|
4659
|
-
* @param {string|Object} plane
|
|
4660
|
-
*
|
|
4661
|
-
* @return {Object} plane descriptor with { layer, rootElement, name }
|
|
4662
|
-
*/
|
|
4663
|
-
Canvas.prototype.setActivePlane = function(plane) {
|
|
4664
|
-
if (!plane) {
|
|
4665
|
-
throw new Error('must specify a plane');
|
|
4666
|
-
}
|
|
4667
4626
|
|
|
4668
|
-
|
|
4669
|
-
plane = this.getPlane(plane);
|
|
4670
|
-
}
|
|
4671
|
-
|
|
4672
|
-
// hide previous Plane
|
|
4673
|
-
if (this._activePlane) {
|
|
4674
|
-
classes(this._activePlane.layer).add(HIDDEN_MARKER);
|
|
4675
|
-
}
|
|
4627
|
+
Canvas.prototype._removeLayer = function(name) {
|
|
4676
4628
|
|
|
4677
|
-
|
|
4629
|
+
var layer = this._layers[name];
|
|
4678
4630
|
|
|
4679
|
-
|
|
4680
|
-
|
|
4631
|
+
if (layer) {
|
|
4632
|
+
delete this._layers[name];
|
|
4681
4633
|
|
|
4682
|
-
|
|
4683
|
-
this._elementRegistry.updateGraphics(plane.rootElement, this._svg, true);
|
|
4634
|
+
remove$1(layer.group);
|
|
4684
4635
|
}
|
|
4685
|
-
|
|
4686
|
-
this._eventBus.fire('plane.set', { plane: plane });
|
|
4687
|
-
|
|
4688
|
-
return plane;
|
|
4689
4636
|
};
|
|
4690
4637
|
|
|
4691
4638
|
/**
|
|
4692
|
-
* Returns the currently active layer
|
|
4639
|
+
* Returns the currently active layer. Can be null.
|
|
4693
4640
|
*
|
|
4694
|
-
* @returns {SVGElement}
|
|
4641
|
+
* @returns {SVGElement|null}
|
|
4695
4642
|
*/
|
|
4696
|
-
|
|
4697
4643
|
Canvas.prototype.getActiveLayer = function() {
|
|
4698
|
-
|
|
4699
|
-
};
|
|
4644
|
+
var plane = this._findPlaneForRoot(this.getRootElement());
|
|
4700
4645
|
|
|
4701
|
-
/**
|
|
4702
|
-
* Returns the currently active plane.
|
|
4703
|
-
*
|
|
4704
|
-
* @return {Object} plane descriptor with { layer, rootElement, name }
|
|
4705
|
-
*/
|
|
4706
|
-
Canvas.prototype.getActivePlane = function() {
|
|
4707
|
-
var plane = this._activePlane;
|
|
4708
4646
|
if (!plane) {
|
|
4709
|
-
|
|
4710
|
-
this.setActivePlane(BASE_LAYER);
|
|
4647
|
+
return null;
|
|
4711
4648
|
}
|
|
4712
4649
|
|
|
4713
|
-
return plane;
|
|
4650
|
+
return plane.layer;
|
|
4714
4651
|
};
|
|
4715
4652
|
|
|
4653
|
+
|
|
4716
4654
|
/**
|
|
4717
4655
|
* Returns the plane which contains the given element.
|
|
4718
4656
|
*
|
|
4719
4657
|
* @param {string|djs.model.Base} element
|
|
4720
4658
|
*
|
|
4721
|
-
* @return {
|
|
4659
|
+
* @return {djs.model.Base} root for element
|
|
4722
4660
|
*/
|
|
4723
|
-
Canvas.prototype.
|
|
4661
|
+
Canvas.prototype.findRoot = function(element) {
|
|
4724
4662
|
if (typeof element === 'string') {
|
|
4725
4663
|
element = this._elementRegistry.get(element);
|
|
4726
4664
|
}
|
|
4727
4665
|
|
|
4728
|
-
|
|
4666
|
+
if (!element) {
|
|
4667
|
+
return;
|
|
4668
|
+
}
|
|
4669
|
+
|
|
4670
|
+
var plane = this._findPlaneForRoot(
|
|
4671
|
+
findRoot(element)
|
|
4672
|
+
) || {};
|
|
4729
4673
|
|
|
4674
|
+
return plane.rootElement;
|
|
4675
|
+
};
|
|
4676
|
+
|
|
4677
|
+
/**
|
|
4678
|
+
* Return a list of all root elements on the diagram.
|
|
4679
|
+
*
|
|
4680
|
+
* @return {djs.model.Root[]}
|
|
4681
|
+
*/
|
|
4682
|
+
Canvas.prototype.getRootElements = function() {
|
|
4683
|
+
return this._planes.map(function(plane) {
|
|
4684
|
+
return plane.rootElement;
|
|
4685
|
+
});
|
|
4686
|
+
};
|
|
4687
|
+
|
|
4688
|
+
Canvas.prototype._findPlaneForRoot = function(rootElement) {
|
|
4730
4689
|
return find(this._planes, function(plane) {
|
|
4731
|
-
return plane.rootElement ===
|
|
4690
|
+
return plane.rootElement === rootElement;
|
|
4732
4691
|
});
|
|
4733
4692
|
};
|
|
4734
4693
|
|
|
4694
|
+
|
|
4735
4695
|
/**
|
|
4736
4696
|
* Returns the html element that encloses the
|
|
4737
4697
|
* drawing canvas.
|
|
@@ -4852,95 +4812,205 @@
|
|
|
4852
4812
|
}
|
|
4853
4813
|
};
|
|
4854
4814
|
|
|
4815
|
+
/**
|
|
4816
|
+
* Returns the current root element.
|
|
4817
|
+
*
|
|
4818
|
+
* Supports two different modes for handling root elements:
|
|
4819
|
+
*
|
|
4820
|
+
* 1. if no root element has been added before, an implicit root will be added
|
|
4821
|
+
* and returned. This is used in applications that don't require explicit
|
|
4822
|
+
* root elements.
|
|
4823
|
+
*
|
|
4824
|
+
* 2. when root elements have been added before calling `getRootElement`,
|
|
4825
|
+
* root elements can be null. This is used for applications that want to manage
|
|
4826
|
+
* root elements themselves.
|
|
4827
|
+
*
|
|
4828
|
+
* @returns {Object|djs.model.Root|null} rootElement.
|
|
4829
|
+
*/
|
|
4855
4830
|
Canvas.prototype.getRootElement = function() {
|
|
4856
|
-
var
|
|
4831
|
+
var rootElement = this._rootElement;
|
|
4857
4832
|
|
|
4858
|
-
return
|
|
4833
|
+
// can return null if root elements are present but none was set yet
|
|
4834
|
+
if (rootElement || this._planes.length) {
|
|
4835
|
+
return rootElement;
|
|
4836
|
+
}
|
|
4837
|
+
|
|
4838
|
+
return this.setRootElement(this.addRootElement(null));
|
|
4859
4839
|
};
|
|
4860
4840
|
|
|
4841
|
+
/**
|
|
4842
|
+
* Adds a given root element and returns it.
|
|
4843
|
+
*
|
|
4844
|
+
* @param {Object|djs.model.Root} rootElement
|
|
4845
|
+
*
|
|
4846
|
+
* @return {Object|djs.model.Root} rootElement
|
|
4847
|
+
*/
|
|
4848
|
+
|
|
4849
|
+
Canvas.prototype.addRootElement = function(rootElement) {
|
|
4850
|
+
var idx = this._rootsIdx++;
|
|
4861
4851
|
|
|
4852
|
+
if (!rootElement) {
|
|
4853
|
+
rootElement = {
|
|
4854
|
+
id: '__implicitroot_' + idx,
|
|
4855
|
+
children: [],
|
|
4856
|
+
isImplicit: true
|
|
4857
|
+
};
|
|
4858
|
+
}
|
|
4862
4859
|
|
|
4863
|
-
|
|
4860
|
+
var layerName = rootElement.layer = 'root-' + idx;
|
|
4861
|
+
|
|
4862
|
+
this._ensureValid('root', rootElement);
|
|
4863
|
+
|
|
4864
|
+
var layer = this.getLayer(layerName, PLANE_LAYER_INDEX);
|
|
4865
|
+
|
|
4866
|
+
attr(layer, 'display', 'none');
|
|
4867
|
+
|
|
4868
|
+
this._addRoot(rootElement, layer);
|
|
4869
|
+
|
|
4870
|
+
this._planes.push({
|
|
4871
|
+
rootElement: rootElement,
|
|
4872
|
+
layer: layer
|
|
4873
|
+
});
|
|
4874
|
+
|
|
4875
|
+
return rootElement;
|
|
4876
|
+
};
|
|
4864
4877
|
|
|
4865
4878
|
/**
|
|
4866
|
-
*
|
|
4867
|
-
* and returns the new root element.
|
|
4879
|
+
* Removes a given rootElement and returns it.
|
|
4868
4880
|
*
|
|
4869
|
-
* @param {
|
|
4870
|
-
* @param {boolean} [override] whether to override the current root element, if any
|
|
4881
|
+
* @param {djs.model.Root|String} rootElement
|
|
4871
4882
|
*
|
|
4872
|
-
* @return {Object|djs.model.Root}
|
|
4883
|
+
* @return {Object|djs.model.Root} rootElement
|
|
4873
4884
|
*/
|
|
4874
|
-
Canvas.prototype.
|
|
4875
|
-
var activePlane = this._activePlane;
|
|
4885
|
+
Canvas.prototype.removeRootElement = function(rootElement) {
|
|
4876
4886
|
|
|
4877
|
-
if (
|
|
4878
|
-
|
|
4879
|
-
}
|
|
4880
|
-
|
|
4887
|
+
if (typeof rootElement === 'string') {
|
|
4888
|
+
rootElement = this._elementRegistry.get(rootElement);
|
|
4889
|
+
}
|
|
4890
|
+
|
|
4891
|
+
var plane = this._findPlaneForRoot(rootElement);
|
|
4892
|
+
|
|
4893
|
+
if (!plane) {
|
|
4894
|
+
return;
|
|
4895
|
+
}
|
|
4896
|
+
|
|
4897
|
+
// hook up life-cycle events
|
|
4898
|
+
this._removeRoot(rootElement);
|
|
4881
4899
|
|
|
4882
|
-
|
|
4900
|
+
// clean up layer
|
|
4901
|
+
this._removeLayer(rootElement.layer);
|
|
4883
4902
|
|
|
4884
|
-
|
|
4903
|
+
// clean up plane
|
|
4904
|
+
this._planes = this._planes.filter(function(plane) {
|
|
4905
|
+
return plane.rootElement !== rootElement;
|
|
4906
|
+
});
|
|
4907
|
+
|
|
4908
|
+
// clean up active root
|
|
4909
|
+
if (this._rootElement === rootElement) {
|
|
4910
|
+
this._rootElement = null;
|
|
4885
4911
|
}
|
|
4912
|
+
|
|
4913
|
+
return rootElement;
|
|
4886
4914
|
};
|
|
4887
4915
|
|
|
4888
4916
|
|
|
4917
|
+
// root element handling //////////////////////
|
|
4918
|
+
|
|
4889
4919
|
/**
|
|
4890
4920
|
* Sets a given element as the new root element for the canvas
|
|
4891
4921
|
* and returns the new root element.
|
|
4892
4922
|
*
|
|
4893
|
-
* @param {Object|djs.model.Root}
|
|
4894
|
-
* @param {Object|djs.model.Root} plane
|
|
4895
|
-
* @param {boolean} [override] whether to override the current root element, if any
|
|
4923
|
+
* @param {Object|djs.model.Root} rootElement
|
|
4896
4924
|
*
|
|
4897
4925
|
* @return {Object|djs.model.Root} new root element
|
|
4898
4926
|
*/
|
|
4899
|
-
Canvas.prototype.
|
|
4927
|
+
Canvas.prototype.setRootElement = function(rootElement, override) {
|
|
4900
4928
|
|
|
4901
|
-
if (
|
|
4902
|
-
|
|
4929
|
+
if (isDefined(override)) {
|
|
4930
|
+
throw new Error('override not supported');
|
|
4903
4931
|
}
|
|
4904
4932
|
|
|
4905
|
-
if (
|
|
4906
|
-
|
|
4933
|
+
if (rootElement === this._rootElement) {
|
|
4934
|
+
return;
|
|
4907
4935
|
}
|
|
4908
4936
|
|
|
4909
|
-
var
|
|
4910
|
-
elementRegistry = this._elementRegistry,
|
|
4911
|
-
eventBus = this._eventBus;
|
|
4937
|
+
var plane;
|
|
4912
4938
|
|
|
4913
|
-
if (
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
}
|
|
4939
|
+
if (!rootElement) {
|
|
4940
|
+
throw new Error('rootElement required');
|
|
4941
|
+
}
|
|
4917
4942
|
|
|
4918
|
-
|
|
4919
|
-
eventBus.fire('root.remove', { element: currentRoot });
|
|
4920
|
-
eventBus.fire('root.removed', { element: currentRoot });
|
|
4943
|
+
plane = this._findPlaneForRoot(rootElement);
|
|
4921
4944
|
|
|
4922
|
-
|
|
4945
|
+
// give set add semantics for backwards compatibility
|
|
4946
|
+
if (!plane) {
|
|
4947
|
+
rootElement = this.addRootElement(rootElement);
|
|
4923
4948
|
}
|
|
4924
4949
|
|
|
4925
|
-
|
|
4926
|
-
|
|
4950
|
+
this._setRoot(rootElement);
|
|
4951
|
+
|
|
4952
|
+
return rootElement;
|
|
4953
|
+
};
|
|
4954
|
+
|
|
4927
4955
|
|
|
4928
|
-
|
|
4929
|
-
|
|
4956
|
+
Canvas.prototype._removeRoot = function(element) {
|
|
4957
|
+
var elementRegistry = this._elementRegistry,
|
|
4958
|
+
eventBus = this._eventBus;
|
|
4959
|
+
|
|
4960
|
+
// simulate element remove event sequence
|
|
4961
|
+
eventBus.fire('root.remove', { element: element });
|
|
4962
|
+
eventBus.fire('root.removed', { element: element });
|
|
4963
|
+
|
|
4964
|
+
elementRegistry.remove(element);
|
|
4965
|
+
};
|
|
4966
|
+
|
|
4967
|
+
|
|
4968
|
+
Canvas.prototype._addRoot = function(element, gfx) {
|
|
4969
|
+
var elementRegistry = this._elementRegistry,
|
|
4970
|
+
eventBus = this._eventBus;
|
|
4930
4971
|
|
|
4931
|
-
|
|
4972
|
+
// resemble element add event sequence
|
|
4973
|
+
eventBus.fire('root.add', { element: element });
|
|
4974
|
+
|
|
4975
|
+
elementRegistry.add(element, gfx);
|
|
4976
|
+
|
|
4977
|
+
eventBus.fire('root.added', { element: element, gfx: gfx });
|
|
4978
|
+
};
|
|
4979
|
+
|
|
4980
|
+
|
|
4981
|
+
Canvas.prototype._setRoot = function(rootElement, layer) {
|
|
4982
|
+
|
|
4983
|
+
var currentRoot = this._rootElement;
|
|
4984
|
+
|
|
4985
|
+
var currentLayer;
|
|
4986
|
+
|
|
4987
|
+
if (currentRoot) {
|
|
4932
4988
|
|
|
4933
|
-
|
|
4989
|
+
// un-associate previous root element <svg>
|
|
4990
|
+
this._elementRegistry.updateGraphics(currentRoot, null, true);
|
|
4934
4991
|
|
|
4935
|
-
//
|
|
4936
|
-
|
|
4937
|
-
|
|
4992
|
+
// hide previous layer
|
|
4993
|
+
currentLayer = this._findPlaneForRoot(currentRoot).layer;
|
|
4994
|
+
|
|
4995
|
+
attr(currentLayer, 'display', 'none');
|
|
4996
|
+
}
|
|
4997
|
+
|
|
4998
|
+
if (rootElement) {
|
|
4999
|
+
|
|
5000
|
+
if (!layer) {
|
|
5001
|
+
layer = this._findPlaneForRoot(rootElement).layer;
|
|
4938
5002
|
}
|
|
5003
|
+
|
|
5004
|
+
// associate element with <svg>
|
|
5005
|
+
this._elementRegistry.updateGraphics(rootElement, this._svg, true);
|
|
5006
|
+
|
|
5007
|
+
// show root layer
|
|
5008
|
+
attr(layer, 'display', null);
|
|
4939
5009
|
}
|
|
4940
5010
|
|
|
4941
|
-
|
|
5011
|
+
this._rootElement = rootElement;
|
|
4942
5012
|
|
|
4943
|
-
|
|
5013
|
+
this._eventBus.fire('root.set', { element: rootElement });
|
|
4944
5014
|
};
|
|
4945
5015
|
|
|
4946
5016
|
// add functionality //////////////////////
|
|
@@ -4951,7 +5021,7 @@
|
|
|
4951
5021
|
}
|
|
4952
5022
|
|
|
4953
5023
|
if (this._elementRegistry.get(element.id)) {
|
|
4954
|
-
throw new Error('element
|
|
5024
|
+
throw new Error('element <' + element.id + '> already exists');
|
|
4955
5025
|
}
|
|
4956
5026
|
|
|
4957
5027
|
var requiredAttrs = REQUIRED_MODEL_ATTRS[type];
|
|
@@ -5241,6 +5311,7 @@
|
|
|
5241
5311
|
innerBox,
|
|
5242
5312
|
outerBox = this.getSize(),
|
|
5243
5313
|
matrix,
|
|
5314
|
+
activeLayer,
|
|
5244
5315
|
transform,
|
|
5245
5316
|
scale,
|
|
5246
5317
|
x, y;
|
|
@@ -5248,10 +5319,11 @@
|
|
|
5248
5319
|
if (!box) {
|
|
5249
5320
|
|
|
5250
5321
|
// compute the inner box based on the
|
|
5251
|
-
// diagrams active
|
|
5322
|
+
// diagrams active layer. This allows us to exclude
|
|
5252
5323
|
// external components, such as overlays
|
|
5253
5324
|
|
|
5254
|
-
|
|
5325
|
+
activeLayer = this._rootElement ? this.getActiveLayer() : null;
|
|
5326
|
+
innerBox = activeLayer && activeLayer.getBBox() || {};
|
|
5255
5327
|
|
|
5256
5328
|
transform = transform$1(viewport);
|
|
5257
5329
|
matrix = transform ? transform.matrix : createMatrix();
|
|
@@ -5334,10 +5406,11 @@
|
|
|
5334
5406
|
element = this._elementRegistry.get(element);
|
|
5335
5407
|
}
|
|
5336
5408
|
|
|
5337
|
-
//
|
|
5338
|
-
var
|
|
5339
|
-
|
|
5340
|
-
|
|
5409
|
+
// set to correct rootElement
|
|
5410
|
+
var rootElement = this.findRoot(element);
|
|
5411
|
+
|
|
5412
|
+
if (rootElement !== this.getRootElement()) {
|
|
5413
|
+
this.setRootElement(rootElement);
|
|
5341
5414
|
}
|
|
5342
5415
|
|
|
5343
5416
|
if (!padding) {
|
|
@@ -5700,7 +5773,9 @@
|
|
|
5700
5773
|
container.gfx = gfx;
|
|
5701
5774
|
}
|
|
5702
5775
|
|
|
5703
|
-
|
|
5776
|
+
if (gfx) {
|
|
5777
|
+
attr(gfx, ELEMENT_ID, id);
|
|
5778
|
+
}
|
|
5704
5779
|
|
|
5705
5780
|
return gfx;
|
|
5706
5781
|
};
|
|
@@ -15466,6 +15541,57 @@
|
|
|
15466
15541
|
};
|
|
15467
15542
|
}
|
|
15468
15543
|
|
|
15544
|
+
/**
|
|
15545
|
+
* Is an element of the given BPMN type?
|
|
15546
|
+
*
|
|
15547
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
15548
|
+
* @param {string} type
|
|
15549
|
+
*
|
|
15550
|
+
* @return {boolean}
|
|
15551
|
+
*/
|
|
15552
|
+
function is$1(element, type) {
|
|
15553
|
+
var bo = getBusinessObject(element);
|
|
15554
|
+
|
|
15555
|
+
return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
|
|
15556
|
+
}
|
|
15557
|
+
|
|
15558
|
+
|
|
15559
|
+
/**
|
|
15560
|
+
* Return true if element has any of the given types.
|
|
15561
|
+
*
|
|
15562
|
+
* @param {djs.model.Base} element
|
|
15563
|
+
* @param {Array<string>} types
|
|
15564
|
+
*
|
|
15565
|
+
* @return {boolean}
|
|
15566
|
+
*/
|
|
15567
|
+
function isAny(element, types) {
|
|
15568
|
+
return some(types, function(t) {
|
|
15569
|
+
return is$1(element, t);
|
|
15570
|
+
});
|
|
15571
|
+
}
|
|
15572
|
+
|
|
15573
|
+
/**
|
|
15574
|
+
* Return the business object for a given element.
|
|
15575
|
+
*
|
|
15576
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
15577
|
+
*
|
|
15578
|
+
* @return {ModdleElement}
|
|
15579
|
+
*/
|
|
15580
|
+
function getBusinessObject(element) {
|
|
15581
|
+
return (element && element.businessObject) || element;
|
|
15582
|
+
}
|
|
15583
|
+
|
|
15584
|
+
/**
|
|
15585
|
+
* Return the di object for a given element.
|
|
15586
|
+
*
|
|
15587
|
+
* @param {djs.model.Base} element
|
|
15588
|
+
*
|
|
15589
|
+
* @return {ModdleElement}
|
|
15590
|
+
*/
|
|
15591
|
+
function getDi(element) {
|
|
15592
|
+
return element && element.di;
|
|
15593
|
+
}
|
|
15594
|
+
|
|
15469
15595
|
/**
|
|
15470
15596
|
* The importBpmnDiagram result.
|
|
15471
15597
|
*
|
|
@@ -15530,18 +15656,29 @@
|
|
|
15530
15656
|
|
|
15531
15657
|
var walker = new BpmnTreeWalker(visitor, translate);
|
|
15532
15658
|
|
|
15659
|
+
|
|
15660
|
+
bpmnDiagram = bpmnDiagram || (definitions.diagrams && definitions.diagrams[0]);
|
|
15661
|
+
|
|
15662
|
+
var diagramsToImport = getDiagramsToImport(definitions, bpmnDiagram);
|
|
15663
|
+
|
|
15664
|
+
if (!diagramsToImport) {
|
|
15665
|
+
throw new Error(translate('no diagram to display'));
|
|
15666
|
+
}
|
|
15667
|
+
|
|
15533
15668
|
// traverse BPMN 2.0 document model,
|
|
15534
15669
|
// starting at definitions
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
walker.handleDefinitions(definitions, bpmnDiagram);
|
|
15541
|
-
}
|
|
15670
|
+
forEach(diagramsToImport, function(diagram) {
|
|
15671
|
+
walker.handleDefinitions(definitions, diagram);
|
|
15672
|
+
});
|
|
15673
|
+
|
|
15674
|
+
var rootId = bpmnDiagram.plane.bpmnElement.id;
|
|
15542
15675
|
|
|
15543
|
-
|
|
15544
|
-
|
|
15676
|
+
// we do need to account for different ways we create root elements
|
|
15677
|
+
// each nested imported <root> do have the `_plane` suffix, while
|
|
15678
|
+
// the root <root> is found under the business object ID
|
|
15679
|
+
canvas.setRootElement(
|
|
15680
|
+
canvas.findRoot(rootId + '_plane') || canvas.findRoot(rootId)
|
|
15681
|
+
);
|
|
15545
15682
|
}
|
|
15546
15683
|
|
|
15547
15684
|
return new Promise(function(resolve, reject) {
|
|
@@ -15569,6 +15706,107 @@
|
|
|
15569
15706
|
});
|
|
15570
15707
|
}
|
|
15571
15708
|
|
|
15709
|
+
/**
|
|
15710
|
+
* Returns all diagrams in the same hirarchy as the requested diagram.
|
|
15711
|
+
* Includes all parent and sub process diagrams.
|
|
15712
|
+
*
|
|
15713
|
+
* @param {Array} definitions
|
|
15714
|
+
* @param {Object} bpmnDiagram
|
|
15715
|
+
*
|
|
15716
|
+
* @returns {Array<Object>}
|
|
15717
|
+
*/
|
|
15718
|
+
function getDiagramsToImport(definitions, bpmnDiagram) {
|
|
15719
|
+
if (!bpmnDiagram) {
|
|
15720
|
+
return;
|
|
15721
|
+
}
|
|
15722
|
+
|
|
15723
|
+
var bpmnElement = bpmnDiagram.plane.bpmnElement,
|
|
15724
|
+
rootElement = bpmnElement;
|
|
15725
|
+
|
|
15726
|
+
if (!is$1(bpmnElement, 'bpmn:Process') && !is$1(bpmnElement, 'bpmn:Collaboration')) {
|
|
15727
|
+
rootElement = findRootProcess(bpmnElement);
|
|
15728
|
+
}
|
|
15729
|
+
|
|
15730
|
+
// in case the process is part of a collaboration, the plane references the
|
|
15731
|
+
// collaboration, not the process
|
|
15732
|
+
var collaboration;
|
|
15733
|
+
|
|
15734
|
+
if (is$1(rootElement, 'bpmn:Collaboration')) {
|
|
15735
|
+
collaboration = rootElement;
|
|
15736
|
+
} else {
|
|
15737
|
+
collaboration = find(definitions.rootElements, function(element) {
|
|
15738
|
+
if (!is$1(element, 'bpmn:Collaboration')) {
|
|
15739
|
+
return;
|
|
15740
|
+
}
|
|
15741
|
+
|
|
15742
|
+
return find(element.participants, function(participant) {
|
|
15743
|
+
return participant.processRef === rootElement;
|
|
15744
|
+
});
|
|
15745
|
+
});
|
|
15746
|
+
}
|
|
15747
|
+
|
|
15748
|
+
var rootElements = [ rootElement ];
|
|
15749
|
+
|
|
15750
|
+
// all collaboration processes can contain sub-diagrams
|
|
15751
|
+
if (collaboration) {
|
|
15752
|
+
rootElements = map$1(collaboration.participants, function(participant) {
|
|
15753
|
+
return participant.processRef;
|
|
15754
|
+
});
|
|
15755
|
+
|
|
15756
|
+
rootElements.push(collaboration);
|
|
15757
|
+
}
|
|
15758
|
+
|
|
15759
|
+
var allChildren = selfAndAllFlowElements(rootElements);
|
|
15760
|
+
|
|
15761
|
+
// if we have multiple diagrams referencing the same element, we
|
|
15762
|
+
// use the first in the file
|
|
15763
|
+
var diagramsToImport = [ bpmnDiagram ];
|
|
15764
|
+
var handledElements = [ bpmnElement ];
|
|
15765
|
+
|
|
15766
|
+
forEach(definitions.diagrams, function(diagram) {
|
|
15767
|
+
var businessObject = diagram.plane.bpmnElement;
|
|
15768
|
+
|
|
15769
|
+
if (
|
|
15770
|
+
allChildren.indexOf(businessObject) !== -1 &&
|
|
15771
|
+
handledElements.indexOf(businessObject) === -1
|
|
15772
|
+
) {
|
|
15773
|
+
diagramsToImport.push(diagram);
|
|
15774
|
+
handledElements.push(businessObject);
|
|
15775
|
+
}
|
|
15776
|
+
});
|
|
15777
|
+
|
|
15778
|
+
|
|
15779
|
+
return diagramsToImport;
|
|
15780
|
+
}
|
|
15781
|
+
|
|
15782
|
+
function selfAndAllFlowElements(elements) {
|
|
15783
|
+
var result = [];
|
|
15784
|
+
|
|
15785
|
+
forEach(elements, function(element) {
|
|
15786
|
+
if (!element) {
|
|
15787
|
+
return;
|
|
15788
|
+
}
|
|
15789
|
+
|
|
15790
|
+
result.push(element);
|
|
15791
|
+
|
|
15792
|
+
result = result.concat(selfAndAllFlowElements(element.flowElements));
|
|
15793
|
+
});
|
|
15794
|
+
|
|
15795
|
+
return result;
|
|
15796
|
+
}
|
|
15797
|
+
|
|
15798
|
+
function findRootProcess(element) {
|
|
15799
|
+
var parent = element;
|
|
15800
|
+
|
|
15801
|
+
while (parent) {
|
|
15802
|
+
if (is$1(parent, 'bpmn:Process')) {
|
|
15803
|
+
return parent;
|
|
15804
|
+
}
|
|
15805
|
+
|
|
15806
|
+
parent = parent.$parent;
|
|
15807
|
+
}
|
|
15808
|
+
}
|
|
15809
|
+
|
|
15572
15810
|
/**
|
|
15573
15811
|
* This file must not be changed or exchanged.
|
|
15574
15812
|
*
|
|
@@ -16059,7 +16297,7 @@
|
|
|
16059
16297
|
try {
|
|
16060
16298
|
var canvas = self.get('canvas');
|
|
16061
16299
|
|
|
16062
|
-
var contentNode = canvas.
|
|
16300
|
+
var contentNode = canvas.getActiveLayer(),
|
|
16063
16301
|
defsNode = query('defs', canvas._svg);
|
|
16064
16302
|
|
|
16065
16303
|
var contents = innerSVG(contentNode),
|
|
@@ -16450,43 +16688,6 @@
|
|
|
16450
16688
|
}
|
|
16451
16689
|
};
|
|
16452
16690
|
|
|
16453
|
-
/**
|
|
16454
|
-
* Is an element of the given BPMN type?
|
|
16455
|
-
*
|
|
16456
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
16457
|
-
* @param {string} type
|
|
16458
|
-
*
|
|
16459
|
-
* @return {boolean}
|
|
16460
|
-
*/
|
|
16461
|
-
function is$1(element, type) {
|
|
16462
|
-
var bo = getBusinessObject(element);
|
|
16463
|
-
|
|
16464
|
-
return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
|
|
16465
|
-
}
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
/**
|
|
16469
|
-
* Return the business object for a given element.
|
|
16470
|
-
*
|
|
16471
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
16472
|
-
*
|
|
16473
|
-
* @return {ModdleElement}
|
|
16474
|
-
*/
|
|
16475
|
-
function getBusinessObject(element) {
|
|
16476
|
-
return (element && element.businessObject) || element;
|
|
16477
|
-
}
|
|
16478
|
-
|
|
16479
|
-
/**
|
|
16480
|
-
* Return the di object for a given element.
|
|
16481
|
-
*
|
|
16482
|
-
* @param {djs.model.Base} element
|
|
16483
|
-
*
|
|
16484
|
-
* @return {ModdleElement}
|
|
16485
|
-
*/
|
|
16486
|
-
function getDi(element) {
|
|
16487
|
-
return element && element.di;
|
|
16488
|
-
}
|
|
16489
|
-
|
|
16490
16691
|
function isExpanded(element, di) {
|
|
16491
16692
|
|
|
16492
16693
|
if (is$1(element, 'bpmn:CallActivity')) {
|
|
@@ -17076,16 +17277,16 @@
|
|
|
17076
17277
|
return drawPath(parentGfx, path, assign({ 'data-marker': type }, attrs));
|
|
17077
17278
|
}
|
|
17078
17279
|
|
|
17280
|
+
function renderer(type) {
|
|
17281
|
+
return handlers[type];
|
|
17282
|
+
}
|
|
17283
|
+
|
|
17079
17284
|
function as(type) {
|
|
17080
17285
|
return function(parentGfx, element) {
|
|
17081
|
-
return
|
|
17286
|
+
return renderer(type)(parentGfx, element);
|
|
17082
17287
|
};
|
|
17083
17288
|
}
|
|
17084
17289
|
|
|
17085
|
-
function renderer(type) {
|
|
17086
|
-
return handlers[type];
|
|
17087
|
-
}
|
|
17088
|
-
|
|
17089
17290
|
function renderEventContent(element, parentGfx) {
|
|
17090
17291
|
|
|
17091
17292
|
var event = getSemantic(element);
|
|
@@ -18566,6 +18767,7 @@
|
|
|
18566
18767
|
// extension API, use at your own risk
|
|
18567
18768
|
this._drawPath = drawPath;
|
|
18568
18769
|
|
|
18770
|
+
this._renderer = renderer;
|
|
18569
18771
|
}
|
|
18570
18772
|
|
|
18571
18773
|
|
|
@@ -18587,7 +18789,7 @@
|
|
|
18587
18789
|
|
|
18588
18790
|
BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
|
|
18589
18791
|
var type = element.type;
|
|
18590
|
-
var h = this.
|
|
18792
|
+
var h = this._renderer(type);
|
|
18591
18793
|
|
|
18592
18794
|
/* jshint -W040 */
|
|
18593
18795
|
return h(parentGfx, element);
|
|
@@ -18595,7 +18797,7 @@
|
|
|
18595
18797
|
|
|
18596
18798
|
BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
|
|
18597
18799
|
var type = element.type;
|
|
18598
|
-
var h = this.
|
|
18800
|
+
var h = this._renderer(type);
|
|
18599
18801
|
|
|
18600
18802
|
/* jshint -W040 */
|
|
18601
18803
|
return h(parentGfx, element);
|
|
@@ -19754,6 +19956,13 @@
|
|
|
19754
19956
|
return element && !!element.labelTarget;
|
|
19755
19957
|
}
|
|
19756
19958
|
|
|
19959
|
+
/**
|
|
19960
|
+
* @param {ModdleElement} semantic
|
|
19961
|
+
* @param {ModdleElement} di
|
|
19962
|
+
* @param {Object} [attrs=null]
|
|
19963
|
+
*
|
|
19964
|
+
* @return {Object}
|
|
19965
|
+
*/
|
|
19757
19966
|
function elementData(semantic, di, attrs) {
|
|
19758
19967
|
return assign({
|
|
19759
19968
|
id: semantic.id,
|
|
@@ -19833,15 +20042,14 @@
|
|
|
19833
20042
|
// invisible root element (process, subprocess or collaboration)
|
|
19834
20043
|
if (is$1(di, 'bpmndi:BPMNPlane')) {
|
|
19835
20044
|
|
|
19836
|
-
|
|
19837
|
-
|
|
20045
|
+
var attrs = is$1(semantic, 'bpmn:SubProcess')
|
|
20046
|
+
? { id: semantic.id + '_plane' }
|
|
20047
|
+
: {};
|
|
19838
20048
|
|
|
19839
|
-
//
|
|
19840
|
-
|
|
19841
|
-
element.id = element.id + '_plane';
|
|
19842
|
-
}
|
|
20049
|
+
// add a virtual element (not being drawn)
|
|
20050
|
+
element = this._elementFactory.createRoot(elementData(semantic, di, attrs));
|
|
19843
20051
|
|
|
19844
|
-
this._canvas.
|
|
20052
|
+
this._canvas.addRootElement(element);
|
|
19845
20053
|
}
|
|
19846
20054
|
|
|
19847
20055
|
// SHAPE
|
|
@@ -19877,7 +20085,7 @@
|
|
|
19877
20085
|
|
|
19878
20086
|
// check whether data store is inside our outside of its semantic parent
|
|
19879
20087
|
if (!isPointInsideBBox$1(parentElement, getMid(bounds))) {
|
|
19880
|
-
parentElement = this._canvas.
|
|
20088
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
19881
20089
|
}
|
|
19882
20090
|
}
|
|
19883
20091
|
|
|
@@ -19905,7 +20113,7 @@
|
|
|
19905
20113
|
// are rendered correctly across different "hacks" people
|
|
19906
20114
|
// love to model such as cross participant / sub process
|
|
19907
20115
|
// associations
|
|
19908
|
-
parentElement = this._canvas.
|
|
20116
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
19909
20117
|
}
|
|
19910
20118
|
|
|
19911
20119
|
// insert sequence flows behind other flow nodes (cf. #727)
|
|
@@ -20171,7 +20379,7 @@
|
|
|
20171
20379
|
return isPrimaryButton(event) || isAuxiliaryButton(event);
|
|
20172
20380
|
}
|
|
20173
20381
|
|
|
20174
|
-
var LOW_PRIORITY$
|
|
20382
|
+
var LOW_PRIORITY$o = 500;
|
|
20175
20383
|
|
|
20176
20384
|
|
|
20177
20385
|
/**
|
|
@@ -20366,7 +20574,7 @@
|
|
|
20366
20574
|
eventBus.on([
|
|
20367
20575
|
'shape.changed',
|
|
20368
20576
|
'connection.changed'
|
|
20369
|
-
], LOW_PRIORITY$
|
|
20577
|
+
], LOW_PRIORITY$o, function(event) {
|
|
20370
20578
|
|
|
20371
20579
|
var element = event.element,
|
|
20372
20580
|
gfx = event.gfx;
|
|
@@ -20374,7 +20582,7 @@
|
|
|
20374
20582
|
eventBus.fire('interactionEvents.updateHit', { element: element, gfx: gfx });
|
|
20375
20583
|
});
|
|
20376
20584
|
|
|
20377
|
-
eventBus.on('interactionEvents.createHit', LOW_PRIORITY$
|
|
20585
|
+
eventBus.on('interactionEvents.createHit', LOW_PRIORITY$o, function(event) {
|
|
20378
20586
|
var element = event.element,
|
|
20379
20587
|
gfx = event.gfx;
|
|
20380
20588
|
|
|
@@ -20648,7 +20856,7 @@
|
|
|
20648
20856
|
interactionEvents: [ 'type', InteractionEvents ]
|
|
20649
20857
|
};
|
|
20650
20858
|
|
|
20651
|
-
var LOW_PRIORITY$
|
|
20859
|
+
var LOW_PRIORITY$n = 500;
|
|
20652
20860
|
|
|
20653
20861
|
|
|
20654
20862
|
/**
|
|
@@ -20686,7 +20894,7 @@
|
|
|
20686
20894
|
|
|
20687
20895
|
// A low priortity is necessary, because outlines of labels have to be updated
|
|
20688
20896
|
// after the label bounds have been updated in the renderer.
|
|
20689
|
-
eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$
|
|
20897
|
+
eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$n, function(event) {
|
|
20690
20898
|
var element = event.element,
|
|
20691
20899
|
gfx = event.gfx;
|
|
20692
20900
|
|
|
@@ -20783,7 +20991,7 @@
|
|
|
20783
20991
|
self.deselect(element);
|
|
20784
20992
|
});
|
|
20785
20993
|
|
|
20786
|
-
eventBus.on([ 'diagram.clear', '
|
|
20994
|
+
eventBus.on([ 'diagram.clear', 'root.set' ], function(e) {
|
|
20787
20995
|
self.select(null);
|
|
20788
20996
|
});
|
|
20789
20997
|
}
|
|
@@ -20836,10 +21044,12 @@
|
|
|
20836
21044
|
|
|
20837
21045
|
var canvas = this._canvas;
|
|
20838
21046
|
|
|
21047
|
+
var rootElement = canvas.getRootElement();
|
|
21048
|
+
|
|
20839
21049
|
elements = elements.filter(function(element) {
|
|
20840
|
-
var
|
|
21050
|
+
var elementRoot = canvas.findRoot(element);
|
|
20841
21051
|
|
|
20842
|
-
return
|
|
21052
|
+
return rootElement === elementRoot;
|
|
20843
21053
|
});
|
|
20844
21054
|
|
|
20845
21055
|
// selection may be cleared by passing an empty array or null
|
|
@@ -21080,7 +21290,7 @@
|
|
|
21080
21290
|
// document wide unique overlay ids
|
|
21081
21291
|
var ids$1 = new IdGenerator('ov');
|
|
21082
21292
|
|
|
21083
|
-
var LOW_PRIORITY$
|
|
21293
|
+
var LOW_PRIORITY$m = 500;
|
|
21084
21294
|
|
|
21085
21295
|
|
|
21086
21296
|
/**
|
|
@@ -21310,8 +21520,7 @@
|
|
|
21310
21520
|
*
|
|
21311
21521
|
* @see Overlays#get for filter options.
|
|
21312
21522
|
*
|
|
21313
|
-
* @param {string} [
|
|
21314
|
-
* @param {Object} [filter]
|
|
21523
|
+
* @param {string|object} [filter]
|
|
21315
21524
|
*/
|
|
21316
21525
|
Overlays.prototype.remove = function(filter) {
|
|
21317
21526
|
|
|
@@ -21427,6 +21636,7 @@
|
|
|
21427
21636
|
}
|
|
21428
21637
|
|
|
21429
21638
|
setPosition$1(htmlContainer, left || 0, top || 0);
|
|
21639
|
+
this._updateOverlayVisibilty(overlay, this._canvas.viewbox());
|
|
21430
21640
|
};
|
|
21431
21641
|
|
|
21432
21642
|
|
|
@@ -21510,12 +21720,10 @@
|
|
|
21510
21720
|
classes$1(htmlContainer).add('djs-overlay-' + overlay.type);
|
|
21511
21721
|
}
|
|
21512
21722
|
|
|
21513
|
-
var
|
|
21514
|
-
var
|
|
21515
|
-
|
|
21516
|
-
|
|
21517
|
-
setVisible$1(htmlContainer, false);
|
|
21518
|
-
}
|
|
21723
|
+
var elementRoot = this._canvas.findRoot(element);
|
|
21724
|
+
var activeRoot = this._canvas.getRootElement();
|
|
21725
|
+
|
|
21726
|
+
setVisible$1(htmlContainer, elementRoot === activeRoot);
|
|
21519
21727
|
|
|
21520
21728
|
overlay.htmlContainer = htmlContainer;
|
|
21521
21729
|
|
|
@@ -21531,14 +21739,14 @@
|
|
|
21531
21739
|
|
|
21532
21740
|
Overlays.prototype._updateOverlayVisibilty = function(overlay, viewbox) {
|
|
21533
21741
|
var show = overlay.show,
|
|
21534
|
-
|
|
21742
|
+
rootElement = this._canvas.findRoot(overlay.element),
|
|
21535
21743
|
minZoom = show && show.minZoom,
|
|
21536
21744
|
maxZoom = show && show.maxZoom,
|
|
21537
21745
|
htmlContainer = overlay.htmlContainer,
|
|
21538
|
-
|
|
21746
|
+
activeRootElement = this._canvas.getRootElement(),
|
|
21539
21747
|
visible = true;
|
|
21540
21748
|
|
|
21541
|
-
if (
|
|
21749
|
+
if (rootElement !== activeRootElement) {
|
|
21542
21750
|
visible = false;
|
|
21543
21751
|
} else if (show) {
|
|
21544
21752
|
if (
|
|
@@ -21649,7 +21857,7 @@
|
|
|
21649
21857
|
|
|
21650
21858
|
// move integration
|
|
21651
21859
|
|
|
21652
|
-
eventBus.on('element.changed', LOW_PRIORITY$
|
|
21860
|
+
eventBus.on('element.changed', LOW_PRIORITY$m, function(e) {
|
|
21653
21861
|
var element = e.element;
|
|
21654
21862
|
|
|
21655
21863
|
var container = self._getOverlayContainer(element, true);
|
|
@@ -21674,10 +21882,8 @@
|
|
|
21674
21882
|
});
|
|
21675
21883
|
|
|
21676
21884
|
|
|
21677
|
-
eventBus.on('
|
|
21678
|
-
|
|
21679
|
-
setVisible$1(el.htmlContainer, el.plane === e.plane);
|
|
21680
|
-
});
|
|
21885
|
+
eventBus.on('root.set', function() {
|
|
21886
|
+
self._updateOverlaysVisibilty(self._canvas.viewbox());
|
|
21681
21887
|
});
|
|
21682
21888
|
|
|
21683
21889
|
// clear overlays with diagram
|
|
@@ -21790,6 +21996,181 @@
|
|
|
21790
21996
|
changeSupport: [ 'type', ChangeSupport ]
|
|
21791
21997
|
};
|
|
21792
21998
|
|
|
21999
|
+
var DEFAULT_PRIORITY$4 = 1000;
|
|
22000
|
+
|
|
22001
|
+
/**
|
|
22002
|
+
* A utility that can be used to plug-in into the command execution for
|
|
22003
|
+
* extension and/or validation.
|
|
22004
|
+
*
|
|
22005
|
+
* @param {EventBus} eventBus
|
|
22006
|
+
*
|
|
22007
|
+
* @example
|
|
22008
|
+
*
|
|
22009
|
+
* import inherits from 'inherits';
|
|
22010
|
+
*
|
|
22011
|
+
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
22012
|
+
*
|
|
22013
|
+
* function CommandLogger(eventBus) {
|
|
22014
|
+
* CommandInterceptor.call(this, eventBus);
|
|
22015
|
+
*
|
|
22016
|
+
* this.preExecute(function(event) {
|
|
22017
|
+
* console.log('command pre-execute', event);
|
|
22018
|
+
* });
|
|
22019
|
+
* }
|
|
22020
|
+
*
|
|
22021
|
+
* inherits(CommandLogger, CommandInterceptor);
|
|
22022
|
+
*
|
|
22023
|
+
*/
|
|
22024
|
+
function CommandInterceptor(eventBus) {
|
|
22025
|
+
this._eventBus = eventBus;
|
|
22026
|
+
}
|
|
22027
|
+
|
|
22028
|
+
CommandInterceptor.$inject = [ 'eventBus' ];
|
|
22029
|
+
|
|
22030
|
+
function unwrapEvent(fn, that) {
|
|
22031
|
+
return function(event) {
|
|
22032
|
+
return fn.call(that || null, event.context, event.command, event);
|
|
22033
|
+
};
|
|
22034
|
+
}
|
|
22035
|
+
|
|
22036
|
+
/**
|
|
22037
|
+
* Register an interceptor for a command execution
|
|
22038
|
+
*
|
|
22039
|
+
* @param {string|Array<string>} [events] list of commands to register on
|
|
22040
|
+
* @param {string} [hook] command hook, i.e. preExecute, executed to listen on
|
|
22041
|
+
* @param {number} [priority] the priority on which to hook into the execution
|
|
22042
|
+
* @param {Function} handlerFn interceptor to be invoked with (event)
|
|
22043
|
+
* @param {boolean} unwrap if true, unwrap the event and pass (context, command, event) to the
|
|
22044
|
+
* listener instead
|
|
22045
|
+
* @param {Object} [that] Pass context (`this`) to the handler function
|
|
22046
|
+
*/
|
|
22047
|
+
CommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {
|
|
22048
|
+
|
|
22049
|
+
if (isFunction(hook) || isNumber(hook)) {
|
|
22050
|
+
that = unwrap;
|
|
22051
|
+
unwrap = handlerFn;
|
|
22052
|
+
handlerFn = priority;
|
|
22053
|
+
priority = hook;
|
|
22054
|
+
hook = null;
|
|
22055
|
+
}
|
|
22056
|
+
|
|
22057
|
+
if (isFunction(priority)) {
|
|
22058
|
+
that = unwrap;
|
|
22059
|
+
unwrap = handlerFn;
|
|
22060
|
+
handlerFn = priority;
|
|
22061
|
+
priority = DEFAULT_PRIORITY$4;
|
|
22062
|
+
}
|
|
22063
|
+
|
|
22064
|
+
if (isObject(unwrap)) {
|
|
22065
|
+
that = unwrap;
|
|
22066
|
+
unwrap = false;
|
|
22067
|
+
}
|
|
22068
|
+
|
|
22069
|
+
if (!isFunction(handlerFn)) {
|
|
22070
|
+
throw new Error('handlerFn must be a function');
|
|
22071
|
+
}
|
|
22072
|
+
|
|
22073
|
+
if (!isArray$2(events)) {
|
|
22074
|
+
events = [ events ];
|
|
22075
|
+
}
|
|
22076
|
+
|
|
22077
|
+
var eventBus = this._eventBus;
|
|
22078
|
+
|
|
22079
|
+
forEach(events, function(event) {
|
|
22080
|
+
|
|
22081
|
+
// concat commandStack(.event)?(.hook)?
|
|
22082
|
+
var fullEvent = [ 'commandStack', event, hook ].filter(function(e) { return e; }).join('.');
|
|
22083
|
+
|
|
22084
|
+
eventBus.on(fullEvent, priority, unwrap ? unwrapEvent(handlerFn, that) : handlerFn, that);
|
|
22085
|
+
});
|
|
22086
|
+
};
|
|
22087
|
+
|
|
22088
|
+
|
|
22089
|
+
var hooks = [
|
|
22090
|
+
'canExecute',
|
|
22091
|
+
'preExecute',
|
|
22092
|
+
'preExecuted',
|
|
22093
|
+
'execute',
|
|
22094
|
+
'executed',
|
|
22095
|
+
'postExecute',
|
|
22096
|
+
'postExecuted',
|
|
22097
|
+
'revert',
|
|
22098
|
+
'reverted'
|
|
22099
|
+
];
|
|
22100
|
+
|
|
22101
|
+
/*
|
|
22102
|
+
* Install hook shortcuts
|
|
22103
|
+
*
|
|
22104
|
+
* This will generate the CommandInterceptor#(preExecute|...|reverted) methods
|
|
22105
|
+
* which will in term forward to CommandInterceptor#on.
|
|
22106
|
+
*/
|
|
22107
|
+
forEach(hooks, function(hook) {
|
|
22108
|
+
|
|
22109
|
+
/**
|
|
22110
|
+
* {canExecute|preExecute|preExecuted|execute|executed|postExecute|postExecuted|revert|reverted}
|
|
22111
|
+
*
|
|
22112
|
+
* A named hook for plugging into the command execution
|
|
22113
|
+
*
|
|
22114
|
+
* @param {string|Array<string>} [events] list of commands to register on
|
|
22115
|
+
* @param {number} [priority] the priority on which to hook into the execution
|
|
22116
|
+
* @param {Function} handlerFn interceptor to be invoked with (event)
|
|
22117
|
+
* @param {boolean} [unwrap=false] if true, unwrap the event and pass (context, command, event) to the
|
|
22118
|
+
* listener instead
|
|
22119
|
+
* @param {Object} [that] Pass context (`this`) to the handler function
|
|
22120
|
+
*/
|
|
22121
|
+
CommandInterceptor.prototype[hook] = function(events, priority, handlerFn, unwrap, that) {
|
|
22122
|
+
|
|
22123
|
+
if (isFunction(events) || isNumber(events)) {
|
|
22124
|
+
that = unwrap;
|
|
22125
|
+
unwrap = handlerFn;
|
|
22126
|
+
handlerFn = priority;
|
|
22127
|
+
priority = events;
|
|
22128
|
+
events = null;
|
|
22129
|
+
}
|
|
22130
|
+
|
|
22131
|
+
this.on(events, hook, priority, handlerFn, unwrap, that);
|
|
22132
|
+
};
|
|
22133
|
+
});
|
|
22134
|
+
|
|
22135
|
+
/**
|
|
22136
|
+
* A modeling behavior that ensures we set the correct root element
|
|
22137
|
+
* as we undo and redo commands.
|
|
22138
|
+
*
|
|
22139
|
+
* @param {Canvas} canvas
|
|
22140
|
+
* @param {didi.Injector} injector
|
|
22141
|
+
*/
|
|
22142
|
+
function RootElementsBehavior(canvas, injector) {
|
|
22143
|
+
|
|
22144
|
+
injector.invoke(CommandInterceptor, this);
|
|
22145
|
+
|
|
22146
|
+
this.executed(function(event) {
|
|
22147
|
+
var context = event.context;
|
|
22148
|
+
|
|
22149
|
+
if (context.rootElement) {
|
|
22150
|
+
canvas.setRootElement(context.rootElement);
|
|
22151
|
+
} else {
|
|
22152
|
+
context.rootElement = canvas.getRootElement();
|
|
22153
|
+
}
|
|
22154
|
+
});
|
|
22155
|
+
|
|
22156
|
+
this.revert(function(event) {
|
|
22157
|
+
var context = event.context;
|
|
22158
|
+
|
|
22159
|
+
if (context.rootElement) {
|
|
22160
|
+
canvas.setRootElement(context.rootElement);
|
|
22161
|
+
}
|
|
22162
|
+
});
|
|
22163
|
+
}
|
|
22164
|
+
|
|
22165
|
+
inherits$1(RootElementsBehavior, CommandInterceptor);
|
|
22166
|
+
|
|
22167
|
+
RootElementsBehavior.$inject = [ 'canvas', 'injector'];
|
|
22168
|
+
|
|
22169
|
+
var RootElementsModule = {
|
|
22170
|
+
__init__: [ 'rootElementsBehavior' ],
|
|
22171
|
+
rootElementsBehavior: [ 'type', RootElementsBehavior ]
|
|
22172
|
+
};
|
|
22173
|
+
|
|
21793
22174
|
var css_escape = {exports: {}};
|
|
21794
22175
|
|
|
21795
22176
|
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
|
|
@@ -21914,39 +22295,135 @@
|
|
|
21914
22295
|
});
|
|
21915
22296
|
}
|
|
21916
22297
|
|
|
21917
|
-
var
|
|
22298
|
+
var planeSuffix = '_plane';
|
|
22299
|
+
|
|
22300
|
+
/**
|
|
22301
|
+
* Get primary shape ID for a plane.
|
|
22302
|
+
*
|
|
22303
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
22304
|
+
*
|
|
22305
|
+
* @returns {String}
|
|
22306
|
+
*/
|
|
22307
|
+
function getShapeIdFromPlane(element) {
|
|
22308
|
+
var id = element.id;
|
|
22309
|
+
|
|
22310
|
+
return removePlaneSuffix(id);
|
|
22311
|
+
}
|
|
22312
|
+
|
|
22313
|
+
/**
|
|
22314
|
+
* Get plane ID for a primary shape.
|
|
22315
|
+
*
|
|
22316
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
22317
|
+
*
|
|
22318
|
+
* @returns {String}
|
|
22319
|
+
*/
|
|
22320
|
+
function getPlaneIdFromShape(element) {
|
|
22321
|
+
var id = element.id;
|
|
22322
|
+
|
|
22323
|
+
if (is$1(element, 'bpmn:SubProcess')) {
|
|
22324
|
+
return addPlaneSuffix(id);
|
|
22325
|
+
}
|
|
22326
|
+
|
|
22327
|
+
return id;
|
|
22328
|
+
}
|
|
22329
|
+
|
|
22330
|
+
/**
|
|
22331
|
+
* Get plane ID for primary shape ID.
|
|
22332
|
+
*
|
|
22333
|
+
* @param {String} id
|
|
22334
|
+
*
|
|
22335
|
+
* @returns {String}
|
|
22336
|
+
*/
|
|
22337
|
+
function toPlaneId(id) {
|
|
22338
|
+
return addPlaneSuffix(id);
|
|
22339
|
+
}
|
|
22340
|
+
|
|
22341
|
+
/**
|
|
22342
|
+
* Check wether element is plane.
|
|
22343
|
+
*
|
|
22344
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
22345
|
+
*
|
|
22346
|
+
* @returns {Boolean}
|
|
22347
|
+
*/
|
|
22348
|
+
function isPlane(element) {
|
|
22349
|
+
var di = getDi(element);
|
|
22350
|
+
|
|
22351
|
+
return is$1(di, 'bpmndi:BPMNPlane');
|
|
22352
|
+
}
|
|
22353
|
+
|
|
22354
|
+
function addPlaneSuffix(id) {
|
|
22355
|
+
return id + planeSuffix;
|
|
22356
|
+
}
|
|
22357
|
+
|
|
22358
|
+
function removePlaneSuffix(id) {
|
|
22359
|
+
return id.replace(new RegExp(planeSuffix + '$'), '');
|
|
22360
|
+
}
|
|
21918
22361
|
|
|
21919
22362
|
var OPEN_CLASS = 'bjs-breadcrumbs-shown';
|
|
21920
22363
|
|
|
22364
|
+
|
|
21921
22365
|
/**
|
|
21922
|
-
* Adds
|
|
22366
|
+
* Adds overlays that allow switching planes on collapsed subprocesses.
|
|
21923
22367
|
*
|
|
21924
22368
|
* @param {eventBus} eventBus
|
|
21925
22369
|
* @param {elementRegistry} elementRegistry
|
|
21926
22370
|
* @param {overlays} overlays
|
|
21927
22371
|
* @param {canvas} canvas
|
|
21928
22372
|
*/
|
|
21929
|
-
function
|
|
22373
|
+
function DrilldownBreadcrumbs(eventBus, elementRegistry, overlays, canvas) {
|
|
21930
22374
|
var breadcrumbs = domify('<ul class="bjs-breadcrumbs"></ul>');
|
|
21931
22375
|
var container = canvas.getContainer();
|
|
21932
22376
|
var containerClasses = classes$1(container);
|
|
21933
22377
|
container.appendChild(breadcrumbs);
|
|
21934
22378
|
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
22379
|
+
var boParents = [];
|
|
22380
|
+
|
|
22381
|
+
// update breadcrumbs if name or ID of the primary shape changes
|
|
22382
|
+
eventBus.on('element.changed', function(e) {
|
|
22383
|
+
var shape = e.element,
|
|
22384
|
+
bo = getBusinessObject(shape);
|
|
21938
22385
|
|
|
21939
|
-
var
|
|
21940
|
-
|
|
22386
|
+
var isPresent = find(boParents, function(el) {
|
|
22387
|
+
return el === bo;
|
|
22388
|
+
});
|
|
22389
|
+
|
|
22390
|
+
if (!isPresent) {
|
|
22391
|
+
return;
|
|
22392
|
+
}
|
|
22393
|
+
|
|
22394
|
+
updateBreadcrumbs();
|
|
22395
|
+
});
|
|
22396
|
+
|
|
22397
|
+
/**
|
|
22398
|
+
* Updates the displayed breadcrumbs. If no element is provided, only the
|
|
22399
|
+
* labels are updated.
|
|
22400
|
+
*
|
|
22401
|
+
* @param {djs.model.Base} [element]
|
|
22402
|
+
*/
|
|
22403
|
+
function updateBreadcrumbs(element) {
|
|
22404
|
+
if (element) {
|
|
22405
|
+
boParents = getBoParentChain(element);
|
|
22406
|
+
}
|
|
22407
|
+
|
|
22408
|
+
var path = boParents.map(function(parent) {
|
|
22409
|
+
var title = escapeHTML(parent.name || parent.id);
|
|
21941
22410
|
var link = domify('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
|
|
21942
22411
|
|
|
22412
|
+
var parentPlane = canvas.findRoot(getPlaneIdFromShape(parent)) || canvas.findRoot(parent.id);
|
|
22413
|
+
|
|
22414
|
+
// when the root is a collaboration, the process does not have a corresponding
|
|
22415
|
+
// element in the elementRegisty. Instead, we search for the corresponding participant
|
|
22416
|
+
if (!parentPlane && is$1(parent, 'bpmn:Process')) {
|
|
22417
|
+
var participant = elementRegistry.find(function(element) {
|
|
22418
|
+
var bo = getBusinessObject(element);
|
|
22419
|
+
return bo && bo.processRef && bo.processRef === parent;
|
|
22420
|
+
});
|
|
22421
|
+
|
|
22422
|
+
parentPlane = canvas.findRoot(participant.id);
|
|
22423
|
+
}
|
|
22424
|
+
|
|
21943
22425
|
link.addEventListener('click', function() {
|
|
21944
|
-
|
|
21945
|
-
canvas.setActivePlane(el.id);
|
|
21946
|
-
} else {
|
|
21947
|
-
var plane = canvas.findPlane(el.id);
|
|
21948
|
-
canvas.setActivePlane(plane);
|
|
21949
|
-
}
|
|
22426
|
+
canvas.setRootElement(parentPlane);
|
|
21950
22427
|
});
|
|
21951
22428
|
|
|
21952
22429
|
return link;
|
|
@@ -21963,50 +22440,26 @@
|
|
|
21963
22440
|
});
|
|
21964
22441
|
}
|
|
21965
22442
|
|
|
21966
|
-
eventBus.on('
|
|
21967
|
-
|
|
21968
|
-
|
|
21969
|
-
updateBreadcrumbs(plane);
|
|
22443
|
+
eventBus.on('root.set', function(event) {
|
|
22444
|
+
updateBreadcrumbs(event.element);
|
|
21970
22445
|
});
|
|
21971
22446
|
|
|
21972
|
-
var createOverlay = function(element) {
|
|
21973
|
-
var html = domify('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
|
|
21974
|
-
|
|
21975
|
-
html.addEventListener('click', function() {
|
|
21976
|
-
canvas.setActivePlane(element.id);
|
|
21977
|
-
});
|
|
21978
|
-
|
|
21979
|
-
overlays.add(element, {
|
|
21980
|
-
position: {
|
|
21981
|
-
bottom: -7,
|
|
21982
|
-
right: -8
|
|
21983
|
-
},
|
|
21984
|
-
html: html
|
|
21985
|
-
});
|
|
21986
|
-
};
|
|
21987
|
-
|
|
21988
|
-
var addOverlays = function(elements) {
|
|
21989
|
-
elements.forEach(function(element) {
|
|
21990
|
-
if (is$1(element, 'bpmn:SubProcess')
|
|
21991
|
-
&& element.collapsed
|
|
21992
|
-
&& canvas.getPlane(element.id)) {
|
|
21993
|
-
createOverlay(element);
|
|
21994
|
-
}
|
|
21995
|
-
});
|
|
21996
|
-
};
|
|
21997
|
-
|
|
21998
|
-
eventBus.on('import.done', function() {
|
|
21999
|
-
addOverlays(elementRegistry.filter(function(el) {
|
|
22000
|
-
return is$1(el, 'bpmn:SubProcess');
|
|
22001
|
-
}));
|
|
22002
|
-
});
|
|
22003
22447
|
}
|
|
22004
22448
|
|
|
22005
|
-
|
|
22449
|
+
DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', 'overlays', 'canvas' ];
|
|
22006
22450
|
|
|
22007
22451
|
|
|
22008
|
-
// helpers
|
|
22009
|
-
|
|
22452
|
+
// helpers //////////
|
|
22453
|
+
|
|
22454
|
+
/**
|
|
22455
|
+
* Returns the parents for the element using the business object chain,
|
|
22456
|
+
* starting with the root element.
|
|
22457
|
+
*
|
|
22458
|
+
* @param {djs.model.Shape} child
|
|
22459
|
+
*
|
|
22460
|
+
* @returns {Array<djs.model.Shape>} parents
|
|
22461
|
+
*/
|
|
22462
|
+
function getBoParentChain(child) {
|
|
22010
22463
|
var bo = getBusinessObject(child);
|
|
22011
22464
|
|
|
22012
22465
|
var parents = [];
|
|
@@ -22018,29 +22471,40 @@
|
|
|
22018
22471
|
}
|
|
22019
22472
|
|
|
22020
22473
|
return parents.reverse();
|
|
22021
|
-
}
|
|
22474
|
+
}
|
|
22022
22475
|
|
|
22023
22476
|
/**
|
|
22024
|
-
* Move collapsed subprocesses into view when drilling down.
|
|
22025
|
-
*
|
|
22477
|
+
* Move collapsed subprocesses into view when drilling down.
|
|
22478
|
+
*
|
|
22479
|
+
* Zoom and scroll are saved in a session.
|
|
22026
22480
|
*
|
|
22027
22481
|
* @param {eventBus} eventBus
|
|
22028
22482
|
* @param {canvas} canvas
|
|
22029
22483
|
*/
|
|
22030
22484
|
function DrilldownCentering(eventBus, canvas) {
|
|
22031
|
-
var currentPlane = 'base';
|
|
22032
|
-
var positionMap = {};
|
|
22033
22485
|
|
|
22034
|
-
|
|
22486
|
+
var currentRoot = null;
|
|
22487
|
+
var positionMap = new Map();
|
|
22488
|
+
|
|
22489
|
+
eventBus.on('root.set', function(event) {
|
|
22490
|
+
var newRoot = event.element;
|
|
22035
22491
|
var currentViewbox = canvas.viewbox();
|
|
22036
|
-
|
|
22492
|
+
var storedViewbox = positionMap.get(newRoot);
|
|
22493
|
+
|
|
22494
|
+
positionMap.set(currentRoot, {
|
|
22037
22495
|
x: currentViewbox.x,
|
|
22038
22496
|
y: currentViewbox.y,
|
|
22039
22497
|
zoom: currentViewbox.scale
|
|
22040
|
-
};
|
|
22498
|
+
});
|
|
22499
|
+
|
|
22500
|
+
currentRoot = newRoot;
|
|
22501
|
+
|
|
22502
|
+
// current root was replaced with a collaboration, we don't update the viewbox
|
|
22503
|
+
if (is$1(newRoot, 'bpmn:Collaboration') && !storedViewbox) {
|
|
22504
|
+
return;
|
|
22505
|
+
}
|
|
22041
22506
|
|
|
22042
|
-
|
|
22043
|
-
var storedViewbox = positionMap[planeId] || { x: 0, y: 0, zoom: 1 };
|
|
22507
|
+
storedViewbox = storedViewbox || { x: 0, y: 0, zoom: 1 };
|
|
22044
22508
|
|
|
22045
22509
|
var dx = (currentViewbox.x - storedViewbox.x) * currentViewbox.scale,
|
|
22046
22510
|
dy = (currentViewbox.y - storedViewbox.y) * currentViewbox.scale;
|
|
@@ -22055,14 +22519,78 @@
|
|
|
22055
22519
|
if (storedViewbox.zoom !== currentViewbox.scale) {
|
|
22056
22520
|
canvas.zoom(storedViewbox.zoom, { x: 0, y: 0 });
|
|
22057
22521
|
}
|
|
22522
|
+
});
|
|
22058
22523
|
|
|
22059
|
-
|
|
22524
|
+
eventBus.on('diagram.clear', function() {
|
|
22525
|
+
positionMap.clear();
|
|
22526
|
+
currentRoot = null;
|
|
22060
22527
|
});
|
|
22528
|
+
|
|
22061
22529
|
}
|
|
22062
22530
|
|
|
22063
22531
|
DrilldownCentering.$inject = [ 'eventBus', 'canvas' ];
|
|
22064
22532
|
|
|
22065
|
-
|
|
22533
|
+
|
|
22534
|
+
/**
|
|
22535
|
+
* ES5 Map implementation. Works.
|
|
22536
|
+
*/
|
|
22537
|
+
function Map() {
|
|
22538
|
+
|
|
22539
|
+
this._entries = [];
|
|
22540
|
+
|
|
22541
|
+
this.set = function(key, value) {
|
|
22542
|
+
|
|
22543
|
+
var found = false;
|
|
22544
|
+
|
|
22545
|
+
for (var k in this._entries) {
|
|
22546
|
+
if (this._entries[k][0] === key) {
|
|
22547
|
+
this._entries[k][1] = value;
|
|
22548
|
+
|
|
22549
|
+
found = true;
|
|
22550
|
+
|
|
22551
|
+
break;
|
|
22552
|
+
}
|
|
22553
|
+
}
|
|
22554
|
+
|
|
22555
|
+
if (!found) {
|
|
22556
|
+
this._entries.push([ key, value ]);
|
|
22557
|
+
}
|
|
22558
|
+
};
|
|
22559
|
+
|
|
22560
|
+
this.get = function(key) {
|
|
22561
|
+
|
|
22562
|
+
for (var k in this._entries) {
|
|
22563
|
+
if (this._entries[k][0] === key) {
|
|
22564
|
+
return this._entries[k][1];
|
|
22565
|
+
}
|
|
22566
|
+
}
|
|
22567
|
+
|
|
22568
|
+
return null;
|
|
22569
|
+
};
|
|
22570
|
+
|
|
22571
|
+
this.clear = function() {
|
|
22572
|
+
this._entries.length = 0;
|
|
22573
|
+
};
|
|
22574
|
+
|
|
22575
|
+
this.remove = function(key) {
|
|
22576
|
+
|
|
22577
|
+
var idx = -1;
|
|
22578
|
+
|
|
22579
|
+
for (var k in this._entries) {
|
|
22580
|
+
if (this._entries[k][0] === key) {
|
|
22581
|
+
idx = k;
|
|
22582
|
+
|
|
22583
|
+
break;
|
|
22584
|
+
}
|
|
22585
|
+
}
|
|
22586
|
+
|
|
22587
|
+
if (idx !== -1) {
|
|
22588
|
+
this._entries.splice(idx, 1);
|
|
22589
|
+
}
|
|
22590
|
+
};
|
|
22591
|
+
}
|
|
22592
|
+
|
|
22593
|
+
var DEFAULT_POSITION$1 = {
|
|
22066
22594
|
x: 180,
|
|
22067
22595
|
y: 160
|
|
22068
22596
|
};
|
|
@@ -22143,6 +22671,15 @@
|
|
|
22143
22671
|
|
|
22144
22672
|
var newDiagrams = [];
|
|
22145
22673
|
|
|
22674
|
+
// create new planes for all collapsed subprocesses, even when they are empty
|
|
22675
|
+
collapsedElements.forEach(function(element) {
|
|
22676
|
+
if (!self._processToDiagramMap[element.id]) {
|
|
22677
|
+
var diagram = self.createDiagram(element);
|
|
22678
|
+
self._processToDiagramMap[element.id] = diagram;
|
|
22679
|
+
newDiagrams.push(diagram);
|
|
22680
|
+
}
|
|
22681
|
+
});
|
|
22682
|
+
|
|
22146
22683
|
elementsToMove.forEach(function(element) {
|
|
22147
22684
|
var diElement = element.diElement;
|
|
22148
22685
|
var parent = element.parent;
|
|
@@ -22158,12 +22695,6 @@
|
|
|
22158
22695
|
}
|
|
22159
22696
|
|
|
22160
22697
|
var diagram = self._processToDiagramMap[parent.id];
|
|
22161
|
-
if (!diagram) {
|
|
22162
|
-
diagram = self.createDiagram(parent);
|
|
22163
|
-
self._processToDiagramMap[parent.id] = diagram;
|
|
22164
|
-
newDiagrams.push(diagram);
|
|
22165
|
-
}
|
|
22166
|
-
|
|
22167
22698
|
self.moveToDiPlane(diElement, diagram.plane);
|
|
22168
22699
|
});
|
|
22169
22700
|
|
|
@@ -22177,8 +22708,8 @@
|
|
|
22177
22708
|
var planeBounds = getPlaneBounds(plane);
|
|
22178
22709
|
|
|
22179
22710
|
var offset = {
|
|
22180
|
-
x: planeBounds.x - DEFAULT_POSITION.x,
|
|
22181
|
-
y: planeBounds.y - DEFAULT_POSITION.y
|
|
22711
|
+
x: planeBounds.x - DEFAULT_POSITION$1.x,
|
|
22712
|
+
y: planeBounds.y - DEFAULT_POSITION$1.y
|
|
22182
22713
|
};
|
|
22183
22714
|
|
|
22184
22715
|
elements.forEach(function(diElement) {
|
|
@@ -22252,11 +22783,187 @@
|
|
|
22252
22783
|
return asBounds(planeTrbl);
|
|
22253
22784
|
}
|
|
22254
22785
|
|
|
22786
|
+
var LOW_PRIORITY$l = 250;
|
|
22787
|
+
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>';
|
|
22788
|
+
|
|
22789
|
+
var EMPTY_MARKER = 'bjs-drilldown-empty';
|
|
22790
|
+
|
|
22791
|
+
function DrilldownOverlayBehavior(
|
|
22792
|
+
canvas, eventBus, elementRegistry, overlays
|
|
22793
|
+
) {
|
|
22794
|
+
CommandInterceptor.call(this, eventBus);
|
|
22795
|
+
|
|
22796
|
+
this._canvas = canvas;
|
|
22797
|
+
this._eventBus = eventBus;
|
|
22798
|
+
this._elementRegistry = elementRegistry;
|
|
22799
|
+
this._overlays = overlays;
|
|
22800
|
+
|
|
22801
|
+
var self = this;
|
|
22802
|
+
|
|
22803
|
+
this.executed('shape.toggleCollapse', LOW_PRIORITY$l, function(context) {
|
|
22804
|
+
var shape = context.shape;
|
|
22805
|
+
|
|
22806
|
+
// Add overlay to the collapsed shape
|
|
22807
|
+
if (self.canDrillDown(shape)) {
|
|
22808
|
+
self.addOverlay(shape);
|
|
22809
|
+
} else {
|
|
22810
|
+
self.removeOverlay(shape);
|
|
22811
|
+
}
|
|
22812
|
+
}, true);
|
|
22813
|
+
|
|
22814
|
+
|
|
22815
|
+
this.reverted('shape.toggleCollapse', LOW_PRIORITY$l, function(context) {
|
|
22816
|
+
var shape = context.shape;
|
|
22817
|
+
|
|
22818
|
+
// Add overlay to the collapsed shape
|
|
22819
|
+
if (self.canDrillDown(shape)) {
|
|
22820
|
+
self.addOverlay(shape);
|
|
22821
|
+
} else {
|
|
22822
|
+
self.removeOverlay(shape);
|
|
22823
|
+
}
|
|
22824
|
+
}, true);
|
|
22825
|
+
|
|
22826
|
+
|
|
22827
|
+
this.executed(['shape.create', 'shape.move', 'shape.delete'], LOW_PRIORITY$l,
|
|
22828
|
+
function(context) {
|
|
22829
|
+
var oldParent = context.oldParent,
|
|
22830
|
+
newParent = context.newParent || context.parent,
|
|
22831
|
+
shape = context.shape;
|
|
22832
|
+
|
|
22833
|
+
// Add overlay to the collapsed shape
|
|
22834
|
+
if (self.canDrillDown(shape)) {
|
|
22835
|
+
self.addOverlay(shape);
|
|
22836
|
+
}
|
|
22837
|
+
|
|
22838
|
+
self.updateDrilldownOverlay(oldParent);
|
|
22839
|
+
self.updateDrilldownOverlay(newParent);
|
|
22840
|
+
self.updateDrilldownOverlay(shape);
|
|
22841
|
+
}, true);
|
|
22842
|
+
|
|
22843
|
+
|
|
22844
|
+
this.reverted(['shape.create', 'shape.move', 'shape.delete'], LOW_PRIORITY$l,
|
|
22845
|
+
function(context) {
|
|
22846
|
+
var oldParent = context.oldParent,
|
|
22847
|
+
newParent = context.newParent || context.parent,
|
|
22848
|
+
shape = context.shape;
|
|
22849
|
+
|
|
22850
|
+
// Add overlay to the collapsed shape
|
|
22851
|
+
if (self.canDrillDown(shape)) {
|
|
22852
|
+
self.addOverlay(shape);
|
|
22853
|
+
}
|
|
22854
|
+
|
|
22855
|
+
self.updateDrilldownOverlay(oldParent);
|
|
22856
|
+
self.updateDrilldownOverlay(newParent);
|
|
22857
|
+
self.updateDrilldownOverlay(shape);
|
|
22858
|
+
}, true);
|
|
22859
|
+
|
|
22860
|
+
|
|
22861
|
+
eventBus.on('import.done', function() {
|
|
22862
|
+
elementRegistry.filter(function(e) {
|
|
22863
|
+
return self.canDrillDown(e);
|
|
22864
|
+
}).map(function(el) {
|
|
22865
|
+
self.addOverlay(el);
|
|
22866
|
+
});
|
|
22867
|
+
});
|
|
22868
|
+
|
|
22869
|
+
}
|
|
22870
|
+
|
|
22871
|
+
inherits$1(DrilldownOverlayBehavior, CommandInterceptor);
|
|
22872
|
+
|
|
22873
|
+
DrilldownOverlayBehavior.prototype.updateDrilldownOverlay = function(shape) {
|
|
22874
|
+
var canvas = this._canvas;
|
|
22875
|
+
|
|
22876
|
+
if (!shape) {
|
|
22877
|
+
return;
|
|
22878
|
+
}
|
|
22879
|
+
|
|
22880
|
+
var root = canvas.findRoot(shape);
|
|
22881
|
+
if (root) {
|
|
22882
|
+
this.updateOverlayVisibility(root);
|
|
22883
|
+
}
|
|
22884
|
+
};
|
|
22885
|
+
|
|
22886
|
+
|
|
22887
|
+
DrilldownOverlayBehavior.prototype.canDrillDown = function(element) {
|
|
22888
|
+
var canvas = this._canvas;
|
|
22889
|
+
return is$1(element, 'bpmn:SubProcess') && canvas.findRoot(getPlaneIdFromShape(element));
|
|
22890
|
+
};
|
|
22891
|
+
|
|
22892
|
+
/**
|
|
22893
|
+
* Updates visibility of the drilldown overlay. If the plane has no elements,
|
|
22894
|
+
* the drilldown will be only shown when the element is selected.
|
|
22895
|
+
*
|
|
22896
|
+
* @param {djs.model.Shape|djs.model.Root} element collapsed shape or root element
|
|
22897
|
+
*/
|
|
22898
|
+
DrilldownOverlayBehavior.prototype.updateOverlayVisibility = function(element) {
|
|
22899
|
+
var overlays = this._overlays;
|
|
22900
|
+
|
|
22901
|
+
var bo = element.businessObject;
|
|
22902
|
+
|
|
22903
|
+
var overlay = overlays.get({ element: bo.id, type: 'drilldown' })[0];
|
|
22904
|
+
|
|
22905
|
+
if (!overlay) {
|
|
22906
|
+
return;
|
|
22907
|
+
}
|
|
22908
|
+
|
|
22909
|
+
var hasContent = bo && bo.flowElements && bo.flowElements.length;
|
|
22910
|
+
classes$1(overlay.html).toggle(EMPTY_MARKER, !hasContent);
|
|
22911
|
+
};
|
|
22912
|
+
|
|
22913
|
+
/**
|
|
22914
|
+
* Attaches a drilldown button to the given element. We assume that the plane has
|
|
22915
|
+
* the same id as the element.
|
|
22916
|
+
*
|
|
22917
|
+
* @param {djs.model.Shape} element collapsed shape
|
|
22918
|
+
*/
|
|
22919
|
+
DrilldownOverlayBehavior.prototype.addOverlay = function(element) {
|
|
22920
|
+
var canvas = this._canvas;
|
|
22921
|
+
var overlays = this._overlays;
|
|
22922
|
+
|
|
22923
|
+
var existingOverlays = overlays.get({ element: element, type: 'drilldown' });
|
|
22924
|
+
if (existingOverlays.length) {
|
|
22925
|
+
this.removeOverlay(element);
|
|
22926
|
+
}
|
|
22927
|
+
|
|
22928
|
+
var button = domify('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
|
|
22929
|
+
|
|
22930
|
+
button.addEventListener('click', function() {
|
|
22931
|
+
canvas.setRootElement(canvas.findRoot(getPlaneIdFromShape(element)));
|
|
22932
|
+
});
|
|
22933
|
+
|
|
22934
|
+
overlays.add(element, 'drilldown', {
|
|
22935
|
+
position: {
|
|
22936
|
+
bottom: -7,
|
|
22937
|
+
right: -8
|
|
22938
|
+
},
|
|
22939
|
+
html: button
|
|
22940
|
+
});
|
|
22941
|
+
|
|
22942
|
+
this.updateOverlayVisibility(element);
|
|
22943
|
+
};
|
|
22944
|
+
|
|
22945
|
+
DrilldownOverlayBehavior.prototype.removeOverlay = function(element) {
|
|
22946
|
+
var overlays = this._overlays;
|
|
22947
|
+
|
|
22948
|
+
overlays.remove({
|
|
22949
|
+
element: element,
|
|
22950
|
+
type: 'drilldown'
|
|
22951
|
+
});
|
|
22952
|
+
};
|
|
22953
|
+
|
|
22954
|
+
DrilldownOverlayBehavior.$inject = [
|
|
22955
|
+
'canvas',
|
|
22956
|
+
'eventBus',
|
|
22957
|
+
'elementRegistry',
|
|
22958
|
+
'overlays'
|
|
22959
|
+
];
|
|
22960
|
+
|
|
22255
22961
|
var DrilldownModdule = {
|
|
22256
|
-
__depends__: [ OverlaysModule, ChangeSupportModule ],
|
|
22257
|
-
__init__: [ '
|
|
22258
|
-
|
|
22962
|
+
__depends__: [ OverlaysModule, ChangeSupportModule, RootElementsModule ],
|
|
22963
|
+
__init__: [ 'drilldownBreadcrumbs', 'drilldownOverlayBehavior', 'drilldownCentering', 'subprocessCompatibility'],
|
|
22964
|
+
drilldownBreadcrumbs: [ 'type', DrilldownBreadcrumbs ],
|
|
22259
22965
|
drilldownCentering: [ 'type', DrilldownCentering ],
|
|
22966
|
+
drilldownOverlayBehavior: [ 'type', DrilldownOverlayBehavior ],
|
|
22260
22967
|
subprocessCompatibility: [ 'type', SubprocessCompatibility ]
|
|
22261
22968
|
};
|
|
22262
22969
|
|
|
@@ -22371,7 +23078,7 @@
|
|
|
22371
23078
|
|
|
22372
23079
|
var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
|
|
22373
23080
|
|
|
22374
|
-
var DEFAULT_PRIORITY$
|
|
23081
|
+
var DEFAULT_PRIORITY$3 = 1000;
|
|
22375
23082
|
|
|
22376
23083
|
/**
|
|
22377
23084
|
* A keyboard abstraction that may be activated and
|
|
@@ -22531,7 +23238,7 @@
|
|
|
22531
23238
|
if (isFunction(priority)) {
|
|
22532
23239
|
type = listener;
|
|
22533
23240
|
listener = priority;
|
|
22534
|
-
priority = DEFAULT_PRIORITY$
|
|
23241
|
+
priority = DEFAULT_PRIORITY$3;
|
|
22535
23242
|
}
|
|
22536
23243
|
|
|
22537
23244
|
this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
|
|
@@ -22554,7 +23261,7 @@
|
|
|
22554
23261
|
return target && (matchesSelector(target, 'input, textarea') || target.contentEditable === 'true');
|
|
22555
23262
|
}
|
|
22556
23263
|
|
|
22557
|
-
var LOW_PRIORITY$
|
|
23264
|
+
var LOW_PRIORITY$k = 500;
|
|
22558
23265
|
|
|
22559
23266
|
var KEYCODE_C = 67;
|
|
22560
23267
|
var KEYCODE_V = 86;
|
|
@@ -22580,7 +23287,7 @@
|
|
|
22580
23287
|
|
|
22581
23288
|
var self = this;
|
|
22582
23289
|
|
|
22583
|
-
eventBus.on('editorActions.init', LOW_PRIORITY$
|
|
23290
|
+
eventBus.on('editorActions.init', LOW_PRIORITY$k, function(event) {
|
|
22584
23291
|
|
|
22585
23292
|
var editorActions = event.editorActions;
|
|
22586
23293
|
|
|
@@ -26084,14 +26791,23 @@
|
|
|
26084
26791
|
// the touch recognizer
|
|
26085
26792
|
var recognizer;
|
|
26086
26793
|
|
|
26087
|
-
function handler(type) {
|
|
26794
|
+
function handler(type, buttonType) {
|
|
26088
26795
|
|
|
26089
26796
|
return function(event) {
|
|
26090
26797
|
|
|
26091
|
-
|
|
26798
|
+
var gfx = getGfx(event.target),
|
|
26799
|
+
element = gfx && elementRegistry.get(gfx);
|
|
26800
|
+
|
|
26801
|
+
// translate into an actual mouse click event
|
|
26802
|
+
if (buttonType) {
|
|
26803
|
+
event.srcEvent.button = buttonType;
|
|
26804
|
+
}
|
|
26805
|
+
|
|
26806
|
+
return interactionEvents.fire(type, event, element);
|
|
26092
26807
|
};
|
|
26093
26808
|
}
|
|
26094
26809
|
|
|
26810
|
+
|
|
26095
26811
|
function getGfx(target) {
|
|
26096
26812
|
var node = closest(target, 'svg, .djs-element', true);
|
|
26097
26813
|
return node;
|
|
@@ -26102,10 +26818,6 @@
|
|
|
26102
26818
|
// touch recognizer
|
|
26103
26819
|
recognizer = createTouchRecognizer(svg);
|
|
26104
26820
|
|
|
26105
|
-
recognizer.on('doubletap', handler('element.dblclick'));
|
|
26106
|
-
|
|
26107
|
-
recognizer.on('tap', handler('element.click'));
|
|
26108
|
-
|
|
26109
26821
|
function startGrabCanvas(event) {
|
|
26110
26822
|
|
|
26111
26823
|
var lx = 0, ly = 0;
|
|
@@ -26173,6 +26885,9 @@
|
|
|
26173
26885
|
recognizer.on('pinchcancel', end);
|
|
26174
26886
|
}
|
|
26175
26887
|
|
|
26888
|
+
recognizer.on('tap', handler('element.click'));
|
|
26889
|
+
recognizer.on('doubletap', handler('element.dblclick', 1));
|
|
26890
|
+
|
|
26176
26891
|
recognizer.on('panstart', startGrab);
|
|
26177
26892
|
recognizer.on('press', startGrab);
|
|
26178
26893
|
|
|
@@ -26793,7 +27508,7 @@
|
|
|
26793
27508
|
return true;
|
|
26794
27509
|
}
|
|
26795
27510
|
|
|
26796
|
-
var LOW_PRIORITY$
|
|
27511
|
+
var LOW_PRIORITY$j = 100;
|
|
26797
27512
|
|
|
26798
27513
|
|
|
26799
27514
|
/**
|
|
@@ -26805,7 +27520,7 @@
|
|
|
26805
27520
|
*/
|
|
26806
27521
|
function AutoPlace$1(eventBus, modeling, canvas) {
|
|
26807
27522
|
|
|
26808
|
-
eventBus.on('autoPlace', LOW_PRIORITY$
|
|
27523
|
+
eventBus.on('autoPlace', LOW_PRIORITY$j, function(context) {
|
|
26809
27524
|
var shape = context.shape,
|
|
26810
27525
|
source = context.source;
|
|
26811
27526
|
|
|
@@ -26910,21 +27625,6 @@
|
|
|
26910
27625
|
autoPlaceSelectionBehavior: [ 'type', AutoPlaceSelectionBehavior ]
|
|
26911
27626
|
};
|
|
26912
27627
|
|
|
26913
|
-
/**
|
|
26914
|
-
* Return true if element has any of the given types.
|
|
26915
|
-
*
|
|
26916
|
-
* @param {djs.model.Base} element
|
|
26917
|
-
* @param {Array<string>} types
|
|
26918
|
-
*
|
|
26919
|
-
* @return {boolean}
|
|
26920
|
-
*/
|
|
26921
|
-
function isAny(element, types) {
|
|
26922
|
-
return some(types, function(t) {
|
|
26923
|
-
return is$1(element, t);
|
|
26924
|
-
});
|
|
26925
|
-
}
|
|
26926
|
-
|
|
26927
|
-
|
|
26928
27628
|
/**
|
|
26929
27629
|
* Return the parent of the element with any of the given types.
|
|
26930
27630
|
*
|
|
@@ -27093,142 +27793,6 @@
|
|
|
27093
27793
|
bpmnAutoPlace: [ 'type', AutoPlace ]
|
|
27094
27794
|
};
|
|
27095
27795
|
|
|
27096
|
-
var DEFAULT_PRIORITY$3 = 1000;
|
|
27097
|
-
|
|
27098
|
-
/**
|
|
27099
|
-
* A utility that can be used to plug-in into the command execution for
|
|
27100
|
-
* extension and/or validation.
|
|
27101
|
-
*
|
|
27102
|
-
* @param {EventBus} eventBus
|
|
27103
|
-
*
|
|
27104
|
-
* @example
|
|
27105
|
-
*
|
|
27106
|
-
* import inherits from 'inherits';
|
|
27107
|
-
*
|
|
27108
|
-
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
27109
|
-
*
|
|
27110
|
-
* function CommandLogger(eventBus) {
|
|
27111
|
-
* CommandInterceptor.call(this, eventBus);
|
|
27112
|
-
*
|
|
27113
|
-
* this.preExecute(function(event) {
|
|
27114
|
-
* console.log('command pre-execute', event);
|
|
27115
|
-
* });
|
|
27116
|
-
* }
|
|
27117
|
-
*
|
|
27118
|
-
* inherits(CommandLogger, CommandInterceptor);
|
|
27119
|
-
*
|
|
27120
|
-
*/
|
|
27121
|
-
function CommandInterceptor(eventBus) {
|
|
27122
|
-
this._eventBus = eventBus;
|
|
27123
|
-
}
|
|
27124
|
-
|
|
27125
|
-
CommandInterceptor.$inject = [ 'eventBus' ];
|
|
27126
|
-
|
|
27127
|
-
function unwrapEvent(fn, that) {
|
|
27128
|
-
return function(event) {
|
|
27129
|
-
return fn.call(that || null, event.context, event.command, event);
|
|
27130
|
-
};
|
|
27131
|
-
}
|
|
27132
|
-
|
|
27133
|
-
/**
|
|
27134
|
-
* Register an interceptor for a command execution
|
|
27135
|
-
*
|
|
27136
|
-
* @param {string|Array<string>} [events] list of commands to register on
|
|
27137
|
-
* @param {string} [hook] command hook, i.e. preExecute, executed to listen on
|
|
27138
|
-
* @param {number} [priority] the priority on which to hook into the execution
|
|
27139
|
-
* @param {Function} handlerFn interceptor to be invoked with (event)
|
|
27140
|
-
* @param {boolean} unwrap if true, unwrap the event and pass (context, command, event) to the
|
|
27141
|
-
* listener instead
|
|
27142
|
-
* @param {Object} [that] Pass context (`this`) to the handler function
|
|
27143
|
-
*/
|
|
27144
|
-
CommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {
|
|
27145
|
-
|
|
27146
|
-
if (isFunction(hook) || isNumber(hook)) {
|
|
27147
|
-
that = unwrap;
|
|
27148
|
-
unwrap = handlerFn;
|
|
27149
|
-
handlerFn = priority;
|
|
27150
|
-
priority = hook;
|
|
27151
|
-
hook = null;
|
|
27152
|
-
}
|
|
27153
|
-
|
|
27154
|
-
if (isFunction(priority)) {
|
|
27155
|
-
that = unwrap;
|
|
27156
|
-
unwrap = handlerFn;
|
|
27157
|
-
handlerFn = priority;
|
|
27158
|
-
priority = DEFAULT_PRIORITY$3;
|
|
27159
|
-
}
|
|
27160
|
-
|
|
27161
|
-
if (isObject(unwrap)) {
|
|
27162
|
-
that = unwrap;
|
|
27163
|
-
unwrap = false;
|
|
27164
|
-
}
|
|
27165
|
-
|
|
27166
|
-
if (!isFunction(handlerFn)) {
|
|
27167
|
-
throw new Error('handlerFn must be a function');
|
|
27168
|
-
}
|
|
27169
|
-
|
|
27170
|
-
if (!isArray$2(events)) {
|
|
27171
|
-
events = [ events ];
|
|
27172
|
-
}
|
|
27173
|
-
|
|
27174
|
-
var eventBus = this._eventBus;
|
|
27175
|
-
|
|
27176
|
-
forEach(events, function(event) {
|
|
27177
|
-
|
|
27178
|
-
// concat commandStack(.event)?(.hook)?
|
|
27179
|
-
var fullEvent = [ 'commandStack', event, hook ].filter(function(e) { return e; }).join('.');
|
|
27180
|
-
|
|
27181
|
-
eventBus.on(fullEvent, priority, unwrap ? unwrapEvent(handlerFn, that) : handlerFn, that);
|
|
27182
|
-
});
|
|
27183
|
-
};
|
|
27184
|
-
|
|
27185
|
-
|
|
27186
|
-
var hooks = [
|
|
27187
|
-
'canExecute',
|
|
27188
|
-
'preExecute',
|
|
27189
|
-
'preExecuted',
|
|
27190
|
-
'execute',
|
|
27191
|
-
'executed',
|
|
27192
|
-
'postExecute',
|
|
27193
|
-
'postExecuted',
|
|
27194
|
-
'revert',
|
|
27195
|
-
'reverted'
|
|
27196
|
-
];
|
|
27197
|
-
|
|
27198
|
-
/*
|
|
27199
|
-
* Install hook shortcuts
|
|
27200
|
-
*
|
|
27201
|
-
* This will generate the CommandInterceptor#(preExecute|...|reverted) methods
|
|
27202
|
-
* which will in term forward to CommandInterceptor#on.
|
|
27203
|
-
*/
|
|
27204
|
-
forEach(hooks, function(hook) {
|
|
27205
|
-
|
|
27206
|
-
/**
|
|
27207
|
-
* {canExecute|preExecute|preExecuted|execute|executed|postExecute|postExecuted|revert|reverted}
|
|
27208
|
-
*
|
|
27209
|
-
* A named hook for plugging into the command execution
|
|
27210
|
-
*
|
|
27211
|
-
* @param {string|Array<string>} [events] list of commands to register on
|
|
27212
|
-
* @param {number} [priority] the priority on which to hook into the execution
|
|
27213
|
-
* @param {Function} handlerFn interceptor to be invoked with (event)
|
|
27214
|
-
* @param {boolean} [unwrap=false] if true, unwrap the event and pass (context, command, event) to the
|
|
27215
|
-
* listener instead
|
|
27216
|
-
* @param {Object} [that] Pass context (`this`) to the handler function
|
|
27217
|
-
*/
|
|
27218
|
-
CommandInterceptor.prototype[hook] = function(events, priority, handlerFn, unwrap, that) {
|
|
27219
|
-
|
|
27220
|
-
if (isFunction(events) || isNumber(events)) {
|
|
27221
|
-
that = unwrap;
|
|
27222
|
-
unwrap = handlerFn;
|
|
27223
|
-
handlerFn = priority;
|
|
27224
|
-
priority = events;
|
|
27225
|
-
events = null;
|
|
27226
|
-
}
|
|
27227
|
-
|
|
27228
|
-
this.on(events, hook, priority, handlerFn, unwrap, that);
|
|
27229
|
-
};
|
|
27230
|
-
});
|
|
27231
|
-
|
|
27232
27796
|
/**
|
|
27233
27797
|
* An auto resize component that takes care of expanding a parent element
|
|
27234
27798
|
* if child elements are created or moved close the parents edge.
|
|
@@ -27668,6 +28232,12 @@
|
|
|
27668
28232
|
*/
|
|
27669
28233
|
BpmnAutoResizeProvider.prototype.canResize = function(elements, target) {
|
|
27670
28234
|
|
|
28235
|
+
// do not resize plane elements:
|
|
28236
|
+
// root elements, collapsed sub-processes
|
|
28237
|
+
if (is$1(target.di, 'bpmndi:BPMNPlane')) {
|
|
28238
|
+
return false;
|
|
28239
|
+
}
|
|
28240
|
+
|
|
27671
28241
|
if (!is$1(target, 'bpmn:Participant') && !is$1(target, 'bpmn:Lane') && !(is$1(target, 'bpmn:SubProcess'))) {
|
|
27672
28242
|
return false;
|
|
27673
28243
|
}
|
|
@@ -27694,7 +28264,7 @@
|
|
|
27694
28264
|
bpmnAutoResizeProvider: [ 'type', BpmnAutoResizeProvider ]
|
|
27695
28265
|
};
|
|
27696
28266
|
|
|
27697
|
-
var HIGH_PRIORITY$
|
|
28267
|
+
var HIGH_PRIORITY$k = 1500;
|
|
27698
28268
|
|
|
27699
28269
|
|
|
27700
28270
|
/**
|
|
@@ -27762,7 +28332,7 @@
|
|
|
27762
28332
|
*/
|
|
27763
28333
|
eventBus.on('drag.start', function(event) {
|
|
27764
28334
|
|
|
27765
|
-
eventBus.once('drag.move', HIGH_PRIORITY$
|
|
28335
|
+
eventBus.once('drag.move', HIGH_PRIORITY$k, function(event) {
|
|
27766
28336
|
|
|
27767
28337
|
ensureHover(event);
|
|
27768
28338
|
|
|
@@ -27793,7 +28363,7 @@
|
|
|
27793
28363
|
hover = event.element;
|
|
27794
28364
|
});
|
|
27795
28365
|
|
|
27796
|
-
eventBus.on('element.hover', HIGH_PRIORITY$
|
|
28366
|
+
eventBus.on('element.hover', HIGH_PRIORITY$k, function(event) {
|
|
27797
28367
|
|
|
27798
28368
|
// (3) am I on an element still?
|
|
27799
28369
|
if (hover) {
|
|
@@ -29467,7 +30037,7 @@
|
|
|
29467
30037
|
MARKER_CONNECT_UPDATING$1 = 'djs-updating',
|
|
29468
30038
|
MARKER_ELEMENT_HIDDEN = 'djs-element-hidden';
|
|
29469
30039
|
|
|
29470
|
-
var HIGH_PRIORITY$
|
|
30040
|
+
var HIGH_PRIORITY$j = 1100;
|
|
29471
30041
|
|
|
29472
30042
|
/**
|
|
29473
30043
|
* Preview connection while moving bendpoints.
|
|
@@ -29530,7 +30100,7 @@
|
|
|
29530
30100
|
eventBus.on([
|
|
29531
30101
|
'bendpoint.move.out',
|
|
29532
30102
|
'bendpoint.move.cleanup'
|
|
29533
|
-
], HIGH_PRIORITY$
|
|
30103
|
+
], HIGH_PRIORITY$j, function(event) {
|
|
29534
30104
|
var context = event.context,
|
|
29535
30105
|
hover = context.hover,
|
|
29536
30106
|
target = context.target;
|
|
@@ -29616,7 +30186,7 @@
|
|
|
29616
30186
|
eventBus.on([
|
|
29617
30187
|
'bendpoint.move.end',
|
|
29618
30188
|
'bendpoint.move.cancel'
|
|
29619
|
-
], HIGH_PRIORITY$
|
|
30189
|
+
], HIGH_PRIORITY$j, function(event) {
|
|
29620
30190
|
var context = event.context,
|
|
29621
30191
|
connection = context.connection,
|
|
29622
30192
|
draggerGfx = context.draggerGfx,
|
|
@@ -30547,8 +31117,8 @@
|
|
|
30547
31117
|
return hover && source && hover === source && source !== target;
|
|
30548
31118
|
}
|
|
30549
31119
|
|
|
30550
|
-
var HIGH_PRIORITY$
|
|
30551
|
-
LOW_PRIORITY$
|
|
31120
|
+
var HIGH_PRIORITY$i = 1100,
|
|
31121
|
+
LOW_PRIORITY$i = 900;
|
|
30552
31122
|
|
|
30553
31123
|
var MARKER_OK$3 = 'connect-ok',
|
|
30554
31124
|
MARKER_NOT_OK$3 = 'connect-not-ok';
|
|
@@ -30592,7 +31162,7 @@
|
|
|
30592
31162
|
});
|
|
30593
31163
|
});
|
|
30594
31164
|
|
|
30595
|
-
eventBus.on('connect.hover', LOW_PRIORITY$
|
|
31165
|
+
eventBus.on('connect.hover', LOW_PRIORITY$i, function(event) {
|
|
30596
31166
|
var context = event.context,
|
|
30597
31167
|
hover = event.hover,
|
|
30598
31168
|
canExecute = context.canExecute;
|
|
@@ -30608,7 +31178,7 @@
|
|
|
30608
31178
|
eventBus.on([
|
|
30609
31179
|
'connect.out',
|
|
30610
31180
|
'connect.cleanup'
|
|
30611
|
-
], HIGH_PRIORITY$
|
|
31181
|
+
], HIGH_PRIORITY$i, function(event) {
|
|
30612
31182
|
var hover = event.hover;
|
|
30613
31183
|
|
|
30614
31184
|
if (hover) {
|
|
@@ -32160,7 +32730,7 @@
|
|
|
32160
32730
|
|
|
32161
32731
|
var PREFIX = 'create';
|
|
32162
32732
|
|
|
32163
|
-
var HIGH_PRIORITY$
|
|
32733
|
+
var HIGH_PRIORITY$h = 2000;
|
|
32164
32734
|
|
|
32165
32735
|
|
|
32166
32736
|
/**
|
|
@@ -32388,7 +32958,7 @@
|
|
|
32388
32958
|
eventBus.on('create.init', function() {
|
|
32389
32959
|
eventBus.on('elements.changed', cancel);
|
|
32390
32960
|
|
|
32391
|
-
eventBus.once([ 'create.cancel', 'create.end' ], HIGH_PRIORITY$
|
|
32961
|
+
eventBus.once([ 'create.cancel', 'create.end' ], HIGH_PRIORITY$h, function() {
|
|
32392
32962
|
eventBus.off('elements.changed', cancel);
|
|
32393
32963
|
});
|
|
32394
32964
|
});
|
|
@@ -32427,7 +32997,11 @@
|
|
|
32427
32997
|
}
|
|
32428
32998
|
});
|
|
32429
32999
|
|
|
32430
|
-
var
|
|
33000
|
+
var visibleElements = filter(elements, function(element) {
|
|
33001
|
+
return !element.hidden;
|
|
33002
|
+
});
|
|
33003
|
+
|
|
33004
|
+
var bbox = getBBox(visibleElements);
|
|
32431
33005
|
|
|
32432
33006
|
// center elements around cursor
|
|
32433
33007
|
forEach(elements, function(element) {
|
|
@@ -32505,7 +33079,7 @@
|
|
|
32505
33079
|
return !!element.labelTarget;
|
|
32506
33080
|
}
|
|
32507
33081
|
|
|
32508
|
-
var LOW_PRIORITY$
|
|
33082
|
+
var LOW_PRIORITY$h = 750;
|
|
32509
33083
|
|
|
32510
33084
|
|
|
32511
33085
|
function CreatePreview(
|
|
@@ -32550,7 +33124,7 @@
|
|
|
32550
33124
|
return dragGroup;
|
|
32551
33125
|
}
|
|
32552
33126
|
|
|
32553
|
-
eventBus.on('create.move', LOW_PRIORITY$
|
|
33127
|
+
eventBus.on('create.move', LOW_PRIORITY$h, function(event) {
|
|
32554
33128
|
|
|
32555
33129
|
var hover = event.hover,
|
|
32556
33130
|
context = event.context,
|
|
@@ -33298,6 +33872,14 @@
|
|
|
33298
33872
|
* @param {Array<djs.model.Base>} context.elements
|
|
33299
33873
|
*/
|
|
33300
33874
|
|
|
33875
|
+
/**
|
|
33876
|
+
* @typedef {Function} <copyPaste.createTree> listener
|
|
33877
|
+
*
|
|
33878
|
+
* @param {Object} context
|
|
33879
|
+
* @param {djs.model.Base} context.element
|
|
33880
|
+
* @param {Array<djs.model.Base>} context.children - Add children to be added to tree.
|
|
33881
|
+
*/
|
|
33882
|
+
|
|
33301
33883
|
/**
|
|
33302
33884
|
* @typedef {Function} <copyPaste.elementsCopied> listener
|
|
33303
33885
|
*
|
|
@@ -33766,7 +34348,19 @@
|
|
|
33766
34348
|
|
|
33767
34349
|
addElementData(element, depth);
|
|
33768
34350
|
|
|
33769
|
-
|
|
34351
|
+
var children = [];
|
|
34352
|
+
|
|
34353
|
+
if (element.children) {
|
|
34354
|
+
children = element.children.slice();
|
|
34355
|
+
}
|
|
34356
|
+
|
|
34357
|
+
// allow others to add children to tree
|
|
34358
|
+
self._eventBus.fire('copyPaste.createTree', {
|
|
34359
|
+
element: element,
|
|
34360
|
+
children: children
|
|
34361
|
+
});
|
|
34362
|
+
|
|
34363
|
+
return children;
|
|
33770
34364
|
});
|
|
33771
34365
|
|
|
33772
34366
|
elements = map$1(elementsData, function(elementData) {
|
|
@@ -33897,12 +34491,12 @@
|
|
|
33897
34491
|
});
|
|
33898
34492
|
}
|
|
33899
34493
|
|
|
33900
|
-
var LOW_PRIORITY$
|
|
34494
|
+
var LOW_PRIORITY$g = 750;
|
|
33901
34495
|
|
|
33902
34496
|
|
|
33903
34497
|
function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|
33904
34498
|
|
|
33905
|
-
eventBus.on('copyPaste.copyElement', LOW_PRIORITY$
|
|
34499
|
+
eventBus.on('copyPaste.copyElement', LOW_PRIORITY$g, function(context) {
|
|
33906
34500
|
var descriptor = context.descriptor,
|
|
33907
34501
|
element = context.element;
|
|
33908
34502
|
|
|
@@ -34006,6 +34600,7 @@
|
|
|
34006
34600
|
);
|
|
34007
34601
|
|
|
34008
34602
|
newDi = bpmnFactory.create(oldDi.$type);
|
|
34603
|
+
newDi.bpmnElement = newBusinessObject;
|
|
34009
34604
|
|
|
34010
34605
|
descriptor.di = moddleCopy.copyElement(
|
|
34011
34606
|
oldDi,
|
|
@@ -35644,7 +36239,7 @@
|
|
|
35644
36239
|
return this._createEntries(element, DATA_OBJECT_REFERENCE);
|
|
35645
36240
|
}
|
|
35646
36241
|
|
|
35647
|
-
if (is$1(businessObject, 'bpmn:DataStoreReference')) {
|
|
36242
|
+
if (is$1(businessObject, 'bpmn:DataStoreReference') && !is$1(element.parent, 'bpmn:Collaboration')) {
|
|
35648
36243
|
return this._createEntries(element, DATA_STORE_REFERENCE);
|
|
35649
36244
|
}
|
|
35650
36245
|
|
|
@@ -37709,7 +38304,7 @@
|
|
|
37709
38304
|
}
|
|
37710
38305
|
|
|
37711
38306
|
var LOWER_PRIORITY = 1200;
|
|
37712
|
-
var LOW_PRIORITY$
|
|
38307
|
+
var LOW_PRIORITY$f = 800;
|
|
37713
38308
|
|
|
37714
38309
|
/**
|
|
37715
38310
|
* Basic grid snapping that covers connecting, creating, moving, resizing shapes, moving bendpoints
|
|
@@ -37723,7 +38318,7 @@
|
|
|
37723
38318
|
|
|
37724
38319
|
var self = this;
|
|
37725
38320
|
|
|
37726
|
-
eventBus.on('diagram.init', LOW_PRIORITY$
|
|
38321
|
+
eventBus.on('diagram.init', LOW_PRIORITY$f, function() {
|
|
37727
38322
|
self.setActive(active);
|
|
37728
38323
|
});
|
|
37729
38324
|
|
|
@@ -38208,7 +38803,7 @@
|
|
|
38208
38803
|
return newBounds;
|
|
38209
38804
|
};
|
|
38210
38805
|
|
|
38211
|
-
var HIGH_PRIORITY$
|
|
38806
|
+
var HIGH_PRIORITY$g = 2000;
|
|
38212
38807
|
|
|
38213
38808
|
/**
|
|
38214
38809
|
* Integrates space tool with grid snapping.
|
|
@@ -38217,7 +38812,7 @@
|
|
|
38217
38812
|
eventBus.on([
|
|
38218
38813
|
'spaceTool.move',
|
|
38219
38814
|
'spaceTool.end'
|
|
38220
|
-
], HIGH_PRIORITY$
|
|
38815
|
+
], HIGH_PRIORITY$g, function(event) {
|
|
38221
38816
|
var context = event.context;
|
|
38222
38817
|
|
|
38223
38818
|
if (!context.initialized) {
|
|
@@ -38266,11 +38861,11 @@
|
|
|
38266
38861
|
gridSnapping: [ 'type', GridSnapping ]
|
|
38267
38862
|
};
|
|
38268
38863
|
|
|
38269
|
-
var HIGH_PRIORITY$
|
|
38864
|
+
var HIGH_PRIORITY$f = 2000;
|
|
38270
38865
|
|
|
38271
38866
|
|
|
38272
38867
|
function AutoPlaceBehavior(eventBus, gridSnapping) {
|
|
38273
|
-
eventBus.on('autoPlace', HIGH_PRIORITY$
|
|
38868
|
+
eventBus.on('autoPlace', HIGH_PRIORITY$f, function(context) {
|
|
38274
38869
|
var source = context.source,
|
|
38275
38870
|
sourceMid = getMid(source),
|
|
38276
38871
|
shape = context.shape;
|
|
@@ -38356,7 +38951,7 @@
|
|
|
38356
38951
|
'gridSnapping'
|
|
38357
38952
|
];
|
|
38358
38953
|
|
|
38359
|
-
var HIGH_PRIORITY$
|
|
38954
|
+
var HIGH_PRIORITY$e = 3000;
|
|
38360
38955
|
|
|
38361
38956
|
|
|
38362
38957
|
/**
|
|
@@ -38372,7 +38967,7 @@
|
|
|
38372
38967
|
this.postExecuted([
|
|
38373
38968
|
'connection.create',
|
|
38374
38969
|
'connection.layout'
|
|
38375
|
-
], HIGH_PRIORITY$
|
|
38970
|
+
], HIGH_PRIORITY$e, function(event) {
|
|
38376
38971
|
var context = event.context,
|
|
38377
38972
|
connection = context.connection,
|
|
38378
38973
|
hints = context.hints || {},
|
|
@@ -39200,7 +39795,7 @@
|
|
|
39200
39795
|
var MARKER_RESIZING$1 = 'djs-resizing',
|
|
39201
39796
|
MARKER_RESIZE_NOT_OK = 'resize-not-ok';
|
|
39202
39797
|
|
|
39203
|
-
var LOW_PRIORITY$
|
|
39798
|
+
var LOW_PRIORITY$e = 500;
|
|
39204
39799
|
|
|
39205
39800
|
|
|
39206
39801
|
/**
|
|
@@ -39261,7 +39856,7 @@
|
|
|
39261
39856
|
}
|
|
39262
39857
|
|
|
39263
39858
|
// add and update previews
|
|
39264
|
-
eventBus.on('resize.move', LOW_PRIORITY$
|
|
39859
|
+
eventBus.on('resize.move', LOW_PRIORITY$e, function(event) {
|
|
39265
39860
|
updateFrame(event.context);
|
|
39266
39861
|
});
|
|
39267
39862
|
|
|
@@ -39576,7 +40171,7 @@
|
|
|
39576
40171
|
|
|
39577
40172
|
function activateDirectEdit(element, force) {
|
|
39578
40173
|
if (force ||
|
|
39579
|
-
isAny(element, [ 'bpmn:Task', 'bpmn:TextAnnotation'
|
|
40174
|
+
isAny(element, [ 'bpmn:Task', 'bpmn:TextAnnotation' ]) ||
|
|
39580
40175
|
isCollapsedSubProcess(element)) {
|
|
39581
40176
|
|
|
39582
40177
|
directEditing.activate(element);
|
|
@@ -40358,7 +40953,7 @@
|
|
|
40358
40953
|
'modeling'
|
|
40359
40954
|
];
|
|
40360
40955
|
|
|
40361
|
-
var LOW_PRIORITY$
|
|
40956
|
+
var LOW_PRIORITY$d = 500;
|
|
40362
40957
|
|
|
40363
40958
|
|
|
40364
40959
|
/**
|
|
@@ -40371,7 +40966,7 @@
|
|
|
40371
40966
|
|
|
40372
40967
|
var self = this;
|
|
40373
40968
|
|
|
40374
|
-
this.postExecuted('elements.create', LOW_PRIORITY$
|
|
40969
|
+
this.postExecuted('elements.create', LOW_PRIORITY$d, function(context) {
|
|
40375
40970
|
var elements = context.elements;
|
|
40376
40971
|
|
|
40377
40972
|
elements = elements.filter(function(shape) {
|
|
@@ -40394,7 +40989,7 @@
|
|
|
40394
40989
|
}, true);
|
|
40395
40990
|
|
|
40396
40991
|
|
|
40397
|
-
this.preExecute('elements.move', LOW_PRIORITY$
|
|
40992
|
+
this.preExecute('elements.move', LOW_PRIORITY$d, function(context) {
|
|
40398
40993
|
var shapes = context.shapes,
|
|
40399
40994
|
host = context.newHost;
|
|
40400
40995
|
|
|
@@ -40447,7 +41042,7 @@
|
|
|
40447
41042
|
isAny(shape, [ 'bpmn:IntermediateThrowEvent', 'bpmn:IntermediateCatchEvent' ]) && !!host;
|
|
40448
41043
|
}
|
|
40449
41044
|
|
|
40450
|
-
var HIGH_PRIORITY$
|
|
41045
|
+
var HIGH_PRIORITY$d = 2000;
|
|
40451
41046
|
|
|
40452
41047
|
|
|
40453
41048
|
/**
|
|
@@ -40499,7 +41094,7 @@
|
|
|
40499
41094
|
});
|
|
40500
41095
|
|
|
40501
41096
|
// copy reference to root element on replace
|
|
40502
|
-
eventBus.on('moddleCopy.canCopyProperty', HIGH_PRIORITY$
|
|
41097
|
+
eventBus.on('moddleCopy.canCopyProperty', HIGH_PRIORITY$d, function(context) {
|
|
40503
41098
|
var parent = context.parent,
|
|
40504
41099
|
property = context.property,
|
|
40505
41100
|
propertyName = context.propertyName;
|
|
@@ -40520,167 +41115,6 @@
|
|
|
40520
41115
|
|
|
40521
41116
|
inherits$1(BoundaryEventBehavior, CommandInterceptor);
|
|
40522
41117
|
|
|
40523
|
-
var LOW_PRIORITY$b = 500;
|
|
40524
|
-
|
|
40525
|
-
|
|
40526
|
-
/**
|
|
40527
|
-
* Add referenced root elements (error, escalation, message, signal) if they don't exist.
|
|
40528
|
-
* Copy referenced root elements on copy & paste.
|
|
40529
|
-
*/
|
|
40530
|
-
function RootElementReferenceBehavior(
|
|
40531
|
-
bpmnjs, eventBus, injector, moddleCopy, bpmnFactory
|
|
40532
|
-
) {
|
|
40533
|
-
injector.invoke(CommandInterceptor, this);
|
|
40534
|
-
|
|
40535
|
-
function canHaveRootElementReference(element) {
|
|
40536
|
-
return isAny(element, [ 'bpmn:ReceiveTask', 'bpmn:SendTask' ]) ||
|
|
40537
|
-
hasAnyEventDefinition(element, [
|
|
40538
|
-
'bpmn:ErrorEventDefinition',
|
|
40539
|
-
'bpmn:EscalationEventDefinition',
|
|
40540
|
-
'bpmn:MessageEventDefinition',
|
|
40541
|
-
'bpmn:SignalEventDefinition'
|
|
40542
|
-
]);
|
|
40543
|
-
}
|
|
40544
|
-
|
|
40545
|
-
function hasRootElement(rootElement) {
|
|
40546
|
-
var definitions = bpmnjs.getDefinitions(),
|
|
40547
|
-
rootElements = definitions.get('rootElements');
|
|
40548
|
-
|
|
40549
|
-
return !!find(rootElements, matchPattern({ id: rootElement.id }));
|
|
40550
|
-
}
|
|
40551
|
-
|
|
40552
|
-
function getRootElementReferencePropertyName(eventDefinition) {
|
|
40553
|
-
if (is$1(eventDefinition, 'bpmn:ErrorEventDefinition')) {
|
|
40554
|
-
return 'errorRef';
|
|
40555
|
-
} else if (is$1(eventDefinition, 'bpmn:EscalationEventDefinition')) {
|
|
40556
|
-
return 'escalationRef';
|
|
40557
|
-
} else if (is$1(eventDefinition, 'bpmn:MessageEventDefinition')) {
|
|
40558
|
-
return 'messageRef';
|
|
40559
|
-
} else if (is$1(eventDefinition, 'bpmn:SignalEventDefinition')) {
|
|
40560
|
-
return 'signalRef';
|
|
40561
|
-
}
|
|
40562
|
-
}
|
|
40563
|
-
|
|
40564
|
-
function getRootElement(businessObject) {
|
|
40565
|
-
if (isAny(businessObject, [ 'bpmn:ReceiveTask', 'bpmn:SendTask' ])) {
|
|
40566
|
-
return businessObject.get('messageRef');
|
|
40567
|
-
}
|
|
40568
|
-
|
|
40569
|
-
var eventDefinitions = businessObject.get('eventDefinitions'),
|
|
40570
|
-
eventDefinition = eventDefinitions[ 0 ];
|
|
40571
|
-
|
|
40572
|
-
return eventDefinition.get(getRootElementReferencePropertyName(eventDefinition));
|
|
40573
|
-
}
|
|
40574
|
-
|
|
40575
|
-
function setRootElement(businessObject, rootElement) {
|
|
40576
|
-
if (isAny(businessObject, [ 'bpmn:ReceiveTask', 'bpmn:SendTask' ])) {
|
|
40577
|
-
return businessObject.set('messageRef', rootElement);
|
|
40578
|
-
}
|
|
40579
|
-
|
|
40580
|
-
var eventDefinitions = businessObject.get('eventDefinitions'),
|
|
40581
|
-
eventDefinition = eventDefinitions[ 0 ];
|
|
40582
|
-
|
|
40583
|
-
return eventDefinition.set(getRootElementReferencePropertyName(eventDefinition), rootElement);
|
|
40584
|
-
}
|
|
40585
|
-
|
|
40586
|
-
// create shape
|
|
40587
|
-
this.executed('shape.create', function(context) {
|
|
40588
|
-
var shape = context.shape;
|
|
40589
|
-
|
|
40590
|
-
if (!canHaveRootElementReference(shape)) {
|
|
40591
|
-
return;
|
|
40592
|
-
}
|
|
40593
|
-
|
|
40594
|
-
var businessObject = getBusinessObject(shape),
|
|
40595
|
-
rootElement = getRootElement(businessObject),
|
|
40596
|
-
rootElements;
|
|
40597
|
-
|
|
40598
|
-
if (rootElement && !hasRootElement(rootElement)) {
|
|
40599
|
-
rootElements = bpmnjs.getDefinitions().get('rootElements');
|
|
40600
|
-
|
|
40601
|
-
// add root element
|
|
40602
|
-
add(rootElements, rootElement);
|
|
40603
|
-
|
|
40604
|
-
context.addedRootElement = rootElement;
|
|
40605
|
-
}
|
|
40606
|
-
}, true);
|
|
40607
|
-
|
|
40608
|
-
this.reverted('shape.create', function(context) {
|
|
40609
|
-
var addedRootElement = context.addedRootElement;
|
|
40610
|
-
|
|
40611
|
-
if (!addedRootElement) {
|
|
40612
|
-
return;
|
|
40613
|
-
}
|
|
40614
|
-
|
|
40615
|
-
var rootElements = bpmnjs.getDefinitions().get('rootElements');
|
|
40616
|
-
|
|
40617
|
-
// remove root element
|
|
40618
|
-
remove(rootElements, addedRootElement);
|
|
40619
|
-
}, true);
|
|
40620
|
-
|
|
40621
|
-
eventBus.on('copyPaste.copyElement', function(context) {
|
|
40622
|
-
var descriptor = context.descriptor,
|
|
40623
|
-
element = context.element;
|
|
40624
|
-
|
|
40625
|
-
if (!canHaveRootElementReference(element)) {
|
|
40626
|
-
return;
|
|
40627
|
-
}
|
|
40628
|
-
|
|
40629
|
-
var businessObject = getBusinessObject(element),
|
|
40630
|
-
rootElement = getRootElement(businessObject);
|
|
40631
|
-
|
|
40632
|
-
if (rootElement) {
|
|
40633
|
-
descriptor.referencedRootElement = rootElement;
|
|
40634
|
-
}
|
|
40635
|
-
});
|
|
40636
|
-
|
|
40637
|
-
eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$b, function(context) {
|
|
40638
|
-
var descriptor = context.descriptor,
|
|
40639
|
-
businessObject = descriptor.businessObject;
|
|
40640
|
-
|
|
40641
|
-
if (!canHaveRootElementReference(businessObject)) {
|
|
40642
|
-
return;
|
|
40643
|
-
}
|
|
40644
|
-
|
|
40645
|
-
var referencedRootElement = descriptor.referencedRootElement;
|
|
40646
|
-
|
|
40647
|
-
if (!referencedRootElement) {
|
|
40648
|
-
return;
|
|
40649
|
-
}
|
|
40650
|
-
|
|
40651
|
-
if (!hasRootElement(referencedRootElement)) {
|
|
40652
|
-
referencedRootElement = moddleCopy.copyElement(
|
|
40653
|
-
referencedRootElement,
|
|
40654
|
-
bpmnFactory.create(referencedRootElement.$type)
|
|
40655
|
-
);
|
|
40656
|
-
}
|
|
40657
|
-
|
|
40658
|
-
setRootElement(businessObject, referencedRootElement);
|
|
40659
|
-
});
|
|
40660
|
-
}
|
|
40661
|
-
|
|
40662
|
-
RootElementReferenceBehavior.$inject = [
|
|
40663
|
-
'bpmnjs',
|
|
40664
|
-
'eventBus',
|
|
40665
|
-
'injector',
|
|
40666
|
-
'moddleCopy',
|
|
40667
|
-
'bpmnFactory'
|
|
40668
|
-
];
|
|
40669
|
-
|
|
40670
|
-
inherits$1(RootElementReferenceBehavior, CommandInterceptor);
|
|
40671
|
-
|
|
40672
|
-
// helpers //////////
|
|
40673
|
-
|
|
40674
|
-
function hasAnyEventDefinition(element, types) {
|
|
40675
|
-
if (!isArray$2(types)) {
|
|
40676
|
-
types = [ types ];
|
|
40677
|
-
}
|
|
40678
|
-
|
|
40679
|
-
return some(types, function(type) {
|
|
40680
|
-
return hasEventDefinition$2(element, type);
|
|
40681
|
-
});
|
|
40682
|
-
}
|
|
40683
|
-
|
|
40684
41118
|
function CreateBehavior(injector) {
|
|
40685
41119
|
injector.invoke(CommandInterceptor, this);
|
|
40686
41120
|
|
|
@@ -40701,118 +41135,6 @@
|
|
|
40701
41135
|
|
|
40702
41136
|
inherits$1(CreateBehavior, CommandInterceptor);
|
|
40703
41137
|
|
|
40704
|
-
var HIGH_PRIORITY$b = 1500;
|
|
40705
|
-
var HIGHEST_PRIORITY = 2000;
|
|
40706
|
-
|
|
40707
|
-
|
|
40708
|
-
/**
|
|
40709
|
-
* Correct hover targets in certain situations to improve diagram interaction.
|
|
40710
|
-
*
|
|
40711
|
-
* @param {ElementRegistry} elementRegistry
|
|
40712
|
-
* @param {EventBus} eventBus
|
|
40713
|
-
* @param {Canvas} canvas
|
|
40714
|
-
*/
|
|
40715
|
-
function FixHoverBehavior(elementRegistry, eventBus, canvas) {
|
|
40716
|
-
|
|
40717
|
-
eventBus.on([
|
|
40718
|
-
'create.hover',
|
|
40719
|
-
'create.move',
|
|
40720
|
-
'create.out',
|
|
40721
|
-
'create.end',
|
|
40722
|
-
'shape.move.hover',
|
|
40723
|
-
'shape.move.move',
|
|
40724
|
-
'shape.move.out',
|
|
40725
|
-
'shape.move.end'
|
|
40726
|
-
], HIGH_PRIORITY$b, function(event) {
|
|
40727
|
-
var context = event.context,
|
|
40728
|
-
shape = context.shape || event.shape,
|
|
40729
|
-
hover = event.hover;
|
|
40730
|
-
|
|
40731
|
-
// ensure elements are not dropped onto a bpmn:Lane but onto
|
|
40732
|
-
// the underlying bpmn:Participant
|
|
40733
|
-
if (is$1(hover, 'bpmn:Lane') && !isAny(shape, [ 'bpmn:Lane', 'bpmn:Participant' ])) {
|
|
40734
|
-
event.hover = getLanesRoot(hover);
|
|
40735
|
-
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
|
40736
|
-
}
|
|
40737
|
-
|
|
40738
|
-
var rootElement = canvas.getRootElement();
|
|
40739
|
-
|
|
40740
|
-
// ensure bpmn:Group and label elements are dropped
|
|
40741
|
-
// always onto the root
|
|
40742
|
-
if (hover !== rootElement && (shape.labelTarget || is$1(shape, 'bpmn:Group'))) {
|
|
40743
|
-
event.hover = rootElement;
|
|
40744
|
-
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
|
40745
|
-
}
|
|
40746
|
-
});
|
|
40747
|
-
|
|
40748
|
-
eventBus.on([
|
|
40749
|
-
'connect.hover',
|
|
40750
|
-
'connect.out',
|
|
40751
|
-
'connect.end',
|
|
40752
|
-
'connect.cleanup',
|
|
40753
|
-
'global-connect.hover',
|
|
40754
|
-
'global-connect.out',
|
|
40755
|
-
'global-connect.end',
|
|
40756
|
-
'global-connect.cleanup'
|
|
40757
|
-
], HIGH_PRIORITY$b, function(event) {
|
|
40758
|
-
var hover = event.hover;
|
|
40759
|
-
|
|
40760
|
-
// ensure connections start/end on bpmn:Participant,
|
|
40761
|
-
// not the underlying bpmn:Lane
|
|
40762
|
-
if (is$1(hover, 'bpmn:Lane')) {
|
|
40763
|
-
event.hover = getLanesRoot(hover) || hover;
|
|
40764
|
-
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
|
40765
|
-
}
|
|
40766
|
-
});
|
|
40767
|
-
|
|
40768
|
-
|
|
40769
|
-
eventBus.on([
|
|
40770
|
-
'bendpoint.move.hover'
|
|
40771
|
-
], HIGH_PRIORITY$b, function(event) {
|
|
40772
|
-
var context = event.context,
|
|
40773
|
-
hover = event.hover,
|
|
40774
|
-
type = context.type;
|
|
40775
|
-
|
|
40776
|
-
// ensure reconnect start/end on bpmn:Participant,
|
|
40777
|
-
// not the underlying bpmn:Lane
|
|
40778
|
-
if (is$1(hover, 'bpmn:Lane') && /reconnect/.test(type)) {
|
|
40779
|
-
event.hover = getLanesRoot(hover) || hover;
|
|
40780
|
-
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
|
40781
|
-
}
|
|
40782
|
-
});
|
|
40783
|
-
|
|
40784
|
-
|
|
40785
|
-
eventBus.on([
|
|
40786
|
-
'connect.start'
|
|
40787
|
-
], HIGH_PRIORITY$b, function(event) {
|
|
40788
|
-
var context = event.context,
|
|
40789
|
-
start = context.start;
|
|
40790
|
-
|
|
40791
|
-
// ensure connect start on bpmn:Participant,
|
|
40792
|
-
// not the underlying bpmn:Lane
|
|
40793
|
-
if (is$1(start, 'bpmn:Lane')) {
|
|
40794
|
-
context.start = getLanesRoot(start) || start;
|
|
40795
|
-
}
|
|
40796
|
-
});
|
|
40797
|
-
|
|
40798
|
-
|
|
40799
|
-
// allow movement of participants from lanes
|
|
40800
|
-
eventBus.on('shape.move.start', HIGHEST_PRIORITY, function(event) {
|
|
40801
|
-
var shape = event.shape;
|
|
40802
|
-
|
|
40803
|
-
if (is$1(shape, 'bpmn:Lane')) {
|
|
40804
|
-
event.shape = getLanesRoot(shape) || shape;
|
|
40805
|
-
}
|
|
40806
|
-
});
|
|
40807
|
-
|
|
40808
|
-
}
|
|
40809
|
-
|
|
40810
|
-
FixHoverBehavior.$inject = [
|
|
40811
|
-
'elementRegistry',
|
|
40812
|
-
'eventBus',
|
|
40813
|
-
'canvas'
|
|
40814
|
-
];
|
|
40815
|
-
|
|
40816
41138
|
/**
|
|
40817
41139
|
* BPMN specific create data object behavior
|
|
40818
41140
|
*/
|
|
@@ -40850,7 +41172,7 @@
|
|
|
40850
41172
|
|
|
40851
41173
|
var PARTICIPANT_BORDER_WIDTH = 30;
|
|
40852
41174
|
|
|
40853
|
-
var HIGH_PRIORITY$
|
|
41175
|
+
var HIGH_PRIORITY$c = 2000;
|
|
40854
41176
|
|
|
40855
41177
|
|
|
40856
41178
|
/**
|
|
@@ -40863,7 +41185,7 @@
|
|
|
40863
41185
|
eventBus.on([
|
|
40864
41186
|
'create.start',
|
|
40865
41187
|
'shape.move.start'
|
|
40866
|
-
], HIGH_PRIORITY$
|
|
41188
|
+
], HIGH_PRIORITY$c, function(event) {
|
|
40867
41189
|
var context = event.context,
|
|
40868
41190
|
shape = context.shape,
|
|
40869
41191
|
rootElement = canvas.getRootElement();
|
|
@@ -40898,7 +41220,7 @@
|
|
|
40898
41220
|
});
|
|
40899
41221
|
|
|
40900
41222
|
// force hovering process when creating first participant
|
|
40901
|
-
eventBus.on('create.start', HIGH_PRIORITY$
|
|
41223
|
+
eventBus.on('create.start', HIGH_PRIORITY$c, function(event) {
|
|
40902
41224
|
var context = event.context,
|
|
40903
41225
|
shape = context.shape,
|
|
40904
41226
|
rootElement = canvas.getRootElement(),
|
|
@@ -40910,7 +41232,7 @@
|
|
|
40910
41232
|
}
|
|
40911
41233
|
|
|
40912
41234
|
if (is$1(shape, 'bpmn:Participant') && is$1(rootElement, 'bpmn:Process')) {
|
|
40913
|
-
eventBus.on('element.hover', HIGH_PRIORITY$
|
|
41235
|
+
eventBus.on('element.hover', HIGH_PRIORITY$c, ensureHoveringProcess);
|
|
40914
41236
|
|
|
40915
41237
|
eventBus.once('create.cleanup', function() {
|
|
40916
41238
|
eventBus.off('element.hover', ensureHoveringProcess);
|
|
@@ -40918,122 +41240,97 @@
|
|
|
40918
41240
|
}
|
|
40919
41241
|
});
|
|
40920
41242
|
|
|
40921
|
-
|
|
40922
|
-
|
|
40923
|
-
collaboration;
|
|
40924
|
-
|
|
41243
|
+
// turn process into collaboration when creating first participant
|
|
41244
|
+
function getOrCreateCollaboration() {
|
|
40925
41245
|
var rootElement = canvas.getRootElement();
|
|
40926
41246
|
|
|
40927
41247
|
if (is$1(rootElement, 'bpmn:Collaboration')) {
|
|
40928
|
-
|
|
40929
|
-
} else {
|
|
40930
|
-
|
|
40931
|
-
// update root element by making collaboration
|
|
40932
|
-
collaboration = modeling.makeCollaboration();
|
|
40933
|
-
|
|
40934
|
-
// re-use process when creating first participant
|
|
40935
|
-
context.process = parent;
|
|
41248
|
+
return rootElement;
|
|
40936
41249
|
}
|
|
40937
41250
|
|
|
40938
|
-
|
|
41251
|
+
return modeling.makeCollaboration();
|
|
40939
41252
|
}
|
|
40940
41253
|
|
|
40941
|
-
//
|
|
40942
|
-
|
|
40943
|
-
|
|
40944
|
-
|
|
40945
|
-
|
|
40946
|
-
|
|
40947
|
-
|
|
40948
|
-
}
|
|
40949
|
-
}, true);
|
|
40950
|
-
|
|
40951
|
-
this.execute('shape.create', function(context) {
|
|
40952
|
-
var process = context.process,
|
|
40953
|
-
shape = context.shape;
|
|
40954
|
-
|
|
40955
|
-
if (process) {
|
|
40956
|
-
context.oldProcessRef = shape.businessObject.processRef;
|
|
40957
|
-
|
|
40958
|
-
// re-use process when creating first participant
|
|
40959
|
-
shape.businessObject.processRef = process.businessObject;
|
|
40960
|
-
}
|
|
40961
|
-
}, true);
|
|
41254
|
+
// when creating mutliple elements through `elements.create` parent must be set to collaboration
|
|
41255
|
+
// and passed to `shape.create` as hint
|
|
41256
|
+
this.preExecute('elements.create', HIGH_PRIORITY$c, function(context) {
|
|
41257
|
+
var elements = context.elements,
|
|
41258
|
+
parent = context.parent,
|
|
41259
|
+
participant = findParticipant(elements),
|
|
41260
|
+
hints;
|
|
40962
41261
|
|
|
40963
|
-
|
|
40964
|
-
|
|
40965
|
-
shape = context.shape;
|
|
41262
|
+
if (participant && is$1(parent, 'bpmn:Process')) {
|
|
41263
|
+
context.parent = getOrCreateCollaboration();
|
|
40966
41264
|
|
|
40967
|
-
|
|
41265
|
+
hints = context.hints = context.hints || {};
|
|
40968
41266
|
|
|
40969
|
-
|
|
40970
|
-
|
|
41267
|
+
hints.participant = participant;
|
|
41268
|
+
hints.process = parent;
|
|
41269
|
+
hints.processRef = getBusinessObject(participant).get('processRef');
|
|
40971
41270
|
}
|
|
40972
41271
|
}, true);
|
|
40973
41272
|
|
|
40974
|
-
|
|
40975
|
-
|
|
41273
|
+
// when creating single shape through `shape.create` parent must be set to collaboration
|
|
41274
|
+
// unless it was already set through `elements.create`
|
|
41275
|
+
this.preExecute('shape.create', function(context) {
|
|
41276
|
+
var parent = context.parent,
|
|
40976
41277
|
shape = context.shape;
|
|
40977
41278
|
|
|
40978
|
-
if (
|
|
40979
|
-
|
|
40980
|
-
// move children from process to participant
|
|
40981
|
-
var processChildren = process.children.slice();
|
|
41279
|
+
if (is$1(shape, 'bpmn:Participant') && is$1(parent, 'bpmn:Process')) {
|
|
41280
|
+
context.parent = getOrCreateCollaboration();
|
|
40982
41281
|
|
|
40983
|
-
|
|
41282
|
+
context.process = parent;
|
|
41283
|
+
context.processRef = getBusinessObject(shape).get('processRef');
|
|
40984
41284
|
}
|
|
40985
|
-
|
|
40986
41285
|
}, true);
|
|
40987
41286
|
|
|
40988
|
-
//
|
|
40989
|
-
this.
|
|
40990
|
-
var
|
|
40991
|
-
|
|
40992
|
-
|
|
40993
|
-
|
|
40994
|
-
var hasParticipants = findParticipant(elements);
|
|
40995
|
-
|
|
40996
|
-
if (hasParticipants && is$1(parent, 'bpmn:Process')) {
|
|
40997
|
-
ensureCollaboration(context);
|
|
40998
|
-
|
|
40999
|
-
participant = findParticipant(elements);
|
|
41287
|
+
// #execute necessary because #preExecute not called on CommandStack#redo
|
|
41288
|
+
this.execute('shape.create', function(context) {
|
|
41289
|
+
var hints = context.hints || {},
|
|
41290
|
+
process = context.process || hints.process,
|
|
41291
|
+
shape = context.shape,
|
|
41292
|
+
participant = hints.participant;
|
|
41000
41293
|
|
|
41001
|
-
|
|
41294
|
+
// both shape.create and elements.create must be handled
|
|
41295
|
+
if (process && (!participant || shape === participant)) {
|
|
41002
41296
|
|
|
41003
|
-
//
|
|
41004
|
-
|
|
41297
|
+
// monkey-patch process ref
|
|
41298
|
+
getBusinessObject(shape).set('processRef', getBusinessObject(process));
|
|
41005
41299
|
}
|
|
41006
41300
|
}, true);
|
|
41007
41301
|
|
|
41008
|
-
this.revert('
|
|
41009
|
-
var
|
|
41010
|
-
process = context.process,
|
|
41011
|
-
|
|
41302
|
+
this.revert('shape.create', function(context) {
|
|
41303
|
+
var hints = context.hints || {},
|
|
41304
|
+
process = context.process || hints.process,
|
|
41305
|
+
processRef = context.processRef || hints.processRef,
|
|
41306
|
+
shape = context.shape,
|
|
41307
|
+
participant = hints.participant;
|
|
41012
41308
|
|
|
41013
|
-
|
|
41014
|
-
|
|
41309
|
+
// both shape.create and elements.create must be handled
|
|
41310
|
+
if (process && (!participant || shape === participant)) {
|
|
41015
41311
|
|
|
41016
|
-
//
|
|
41017
|
-
|
|
41312
|
+
// monkey-patch process ref
|
|
41313
|
+
getBusinessObject(shape).set('processRef', processRef);
|
|
41018
41314
|
}
|
|
41019
41315
|
}, true);
|
|
41020
41316
|
|
|
41021
|
-
this.postExecute('
|
|
41022
|
-
var
|
|
41023
|
-
process = context.process,
|
|
41024
|
-
|
|
41317
|
+
this.postExecute('shape.create', function(context) {
|
|
41318
|
+
var hints = context.hints || {},
|
|
41319
|
+
process = context.process || context.hints.process,
|
|
41320
|
+
shape = context.shape,
|
|
41321
|
+
participant = hints.participant;
|
|
41025
41322
|
|
|
41026
41323
|
if (process) {
|
|
41027
|
-
|
|
41028
|
-
|
|
41029
|
-
// move children from process to first participant
|
|
41030
|
-
var processChildren = process.children.slice();
|
|
41324
|
+
var children = process.children.slice();
|
|
41031
41325
|
|
|
41032
|
-
|
|
41326
|
+
// both shape.create and elements.create must be handled
|
|
41327
|
+
if (!participant) {
|
|
41328
|
+
modeling.moveElements(children, { x: 0, y: 0 }, shape);
|
|
41329
|
+
} else if (shape === participant) {
|
|
41330
|
+
modeling.moveElements(children, { x: 0, y: 0 }, participant);
|
|
41331
|
+
}
|
|
41033
41332
|
}
|
|
41034
|
-
|
|
41035
41333
|
}, true);
|
|
41036
|
-
|
|
41037
41334
|
}
|
|
41038
41335
|
|
|
41039
41336
|
CreateParticipantBehavior.$inject = [
|
|
@@ -41460,7 +41757,7 @@
|
|
|
41460
41757
|
}
|
|
41461
41758
|
}
|
|
41462
41759
|
|
|
41463
|
-
var LOW_PRIORITY$
|
|
41760
|
+
var LOW_PRIORITY$c = 500;
|
|
41464
41761
|
|
|
41465
41762
|
|
|
41466
41763
|
/**
|
|
@@ -41529,7 +41826,7 @@
|
|
|
41529
41826
|
/**
|
|
41530
41827
|
* Adjust sizes of other lanes after lane deletion
|
|
41531
41828
|
*/
|
|
41532
|
-
this.postExecuted('shape.delete', LOW_PRIORITY$
|
|
41829
|
+
this.postExecuted('shape.delete', LOW_PRIORITY$c, function(event) {
|
|
41533
41830
|
|
|
41534
41831
|
var context = event.context,
|
|
41535
41832
|
hints = context.hints,
|
|
@@ -41558,7 +41855,7 @@
|
|
|
41558
41855
|
|
|
41559
41856
|
inherits$1(DeleteLaneBehavior, CommandInterceptor);
|
|
41560
41857
|
|
|
41561
|
-
var LOW_PRIORITY$
|
|
41858
|
+
var LOW_PRIORITY$b = 500;
|
|
41562
41859
|
|
|
41563
41860
|
|
|
41564
41861
|
/**
|
|
@@ -41571,7 +41868,7 @@
|
|
|
41571
41868
|
|
|
41572
41869
|
var self = this;
|
|
41573
41870
|
|
|
41574
|
-
this.postExecuted('elements.create', LOW_PRIORITY$
|
|
41871
|
+
this.postExecuted('elements.create', LOW_PRIORITY$b, function(context) {
|
|
41575
41872
|
var elements = context.elements;
|
|
41576
41873
|
|
|
41577
41874
|
elements.filter(function(shape) {
|
|
@@ -41585,7 +41882,7 @@
|
|
|
41585
41882
|
});
|
|
41586
41883
|
}, true);
|
|
41587
41884
|
|
|
41588
|
-
this.preExecute('elements.move', LOW_PRIORITY$
|
|
41885
|
+
this.preExecute('elements.move', LOW_PRIORITY$b, function(context) {
|
|
41589
41886
|
var shapes = context.shapes,
|
|
41590
41887
|
newHost = context.newHost;
|
|
41591
41888
|
|
|
@@ -41685,12 +41982,12 @@
|
|
|
41685
41982
|
dockingPoint = intersection.bendpoint ? waypoints[intersection.index] : mid;
|
|
41686
41983
|
|
|
41687
41984
|
// if last waypointBefore is inside shape's bounds, ignore docking point
|
|
41688
|
-
if (!isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length-1])) {
|
|
41985
|
+
if (waypointsBefore.length === 1 || !isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length-1])) {
|
|
41689
41986
|
waypointsBefore.push(copy(dockingPoint));
|
|
41690
41987
|
}
|
|
41691
41988
|
|
|
41692
41989
|
// if first waypointAfter is inside shape's bounds, ignore docking point
|
|
41693
|
-
if (!isPointInsideBBox(shape, waypointsAfter[0])) {
|
|
41990
|
+
if (waypointsAfter.length === 1 || !isPointInsideBBox(shape, waypointsAfter[0])) {
|
|
41694
41991
|
waypointsAfter.unshift(copy(dockingPoint));
|
|
41695
41992
|
}
|
|
41696
41993
|
}
|
|
@@ -41915,7 +42212,119 @@
|
|
|
41915
42212
|
return is$1(connection, 'bpmn:SequenceFlow');
|
|
41916
42213
|
}
|
|
41917
42214
|
|
|
41918
|
-
var HIGH_PRIORITY$
|
|
42215
|
+
var HIGH_PRIORITY$b = 1500;
|
|
42216
|
+
var HIGHEST_PRIORITY = 2000;
|
|
42217
|
+
|
|
42218
|
+
|
|
42219
|
+
/**
|
|
42220
|
+
* Correct hover targets in certain situations to improve diagram interaction.
|
|
42221
|
+
*
|
|
42222
|
+
* @param {ElementRegistry} elementRegistry
|
|
42223
|
+
* @param {EventBus} eventBus
|
|
42224
|
+
* @param {Canvas} canvas
|
|
42225
|
+
*/
|
|
42226
|
+
function FixHoverBehavior(elementRegistry, eventBus, canvas) {
|
|
42227
|
+
|
|
42228
|
+
eventBus.on([
|
|
42229
|
+
'create.hover',
|
|
42230
|
+
'create.move',
|
|
42231
|
+
'create.out',
|
|
42232
|
+
'create.end',
|
|
42233
|
+
'shape.move.hover',
|
|
42234
|
+
'shape.move.move',
|
|
42235
|
+
'shape.move.out',
|
|
42236
|
+
'shape.move.end'
|
|
42237
|
+
], HIGH_PRIORITY$b, function(event) {
|
|
42238
|
+
var context = event.context,
|
|
42239
|
+
shape = context.shape || event.shape,
|
|
42240
|
+
hover = event.hover;
|
|
42241
|
+
|
|
42242
|
+
// ensure elements are not dropped onto a bpmn:Lane but onto
|
|
42243
|
+
// the underlying bpmn:Participant
|
|
42244
|
+
if (is$1(hover, 'bpmn:Lane') && !isAny(shape, [ 'bpmn:Lane', 'bpmn:Participant' ])) {
|
|
42245
|
+
event.hover = getLanesRoot(hover);
|
|
42246
|
+
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
|
42247
|
+
}
|
|
42248
|
+
|
|
42249
|
+
var rootElement = canvas.getRootElement();
|
|
42250
|
+
|
|
42251
|
+
// ensure bpmn:Group and label elements are dropped
|
|
42252
|
+
// always onto the root
|
|
42253
|
+
if (hover !== rootElement && (shape.labelTarget || is$1(shape, 'bpmn:Group'))) {
|
|
42254
|
+
event.hover = rootElement;
|
|
42255
|
+
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
|
42256
|
+
}
|
|
42257
|
+
});
|
|
42258
|
+
|
|
42259
|
+
eventBus.on([
|
|
42260
|
+
'connect.hover',
|
|
42261
|
+
'connect.out',
|
|
42262
|
+
'connect.end',
|
|
42263
|
+
'connect.cleanup',
|
|
42264
|
+
'global-connect.hover',
|
|
42265
|
+
'global-connect.out',
|
|
42266
|
+
'global-connect.end',
|
|
42267
|
+
'global-connect.cleanup'
|
|
42268
|
+
], HIGH_PRIORITY$b, function(event) {
|
|
42269
|
+
var hover = event.hover;
|
|
42270
|
+
|
|
42271
|
+
// ensure connections start/end on bpmn:Participant,
|
|
42272
|
+
// not the underlying bpmn:Lane
|
|
42273
|
+
if (is$1(hover, 'bpmn:Lane')) {
|
|
42274
|
+
event.hover = getLanesRoot(hover) || hover;
|
|
42275
|
+
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
|
42276
|
+
}
|
|
42277
|
+
});
|
|
42278
|
+
|
|
42279
|
+
|
|
42280
|
+
eventBus.on([
|
|
42281
|
+
'bendpoint.move.hover'
|
|
42282
|
+
], HIGH_PRIORITY$b, function(event) {
|
|
42283
|
+
var context = event.context,
|
|
42284
|
+
hover = event.hover,
|
|
42285
|
+
type = context.type;
|
|
42286
|
+
|
|
42287
|
+
// ensure reconnect start/end on bpmn:Participant,
|
|
42288
|
+
// not the underlying bpmn:Lane
|
|
42289
|
+
if (is$1(hover, 'bpmn:Lane') && /reconnect/.test(type)) {
|
|
42290
|
+
event.hover = getLanesRoot(hover) || hover;
|
|
42291
|
+
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
|
42292
|
+
}
|
|
42293
|
+
});
|
|
42294
|
+
|
|
42295
|
+
|
|
42296
|
+
eventBus.on([
|
|
42297
|
+
'connect.start'
|
|
42298
|
+
], HIGH_PRIORITY$b, function(event) {
|
|
42299
|
+
var context = event.context,
|
|
42300
|
+
start = context.start;
|
|
42301
|
+
|
|
42302
|
+
// ensure connect start on bpmn:Participant,
|
|
42303
|
+
// not the underlying bpmn:Lane
|
|
42304
|
+
if (is$1(start, 'bpmn:Lane')) {
|
|
42305
|
+
context.start = getLanesRoot(start) || start;
|
|
42306
|
+
}
|
|
42307
|
+
});
|
|
42308
|
+
|
|
42309
|
+
|
|
42310
|
+
// allow movement of participants from lanes
|
|
42311
|
+
eventBus.on('shape.move.start', HIGHEST_PRIORITY, function(event) {
|
|
42312
|
+
var shape = event.shape;
|
|
42313
|
+
|
|
42314
|
+
if (is$1(shape, 'bpmn:Lane')) {
|
|
42315
|
+
event.shape = getLanesRoot(shape) || shape;
|
|
42316
|
+
}
|
|
42317
|
+
});
|
|
42318
|
+
|
|
42319
|
+
}
|
|
42320
|
+
|
|
42321
|
+
FixHoverBehavior.$inject = [
|
|
42322
|
+
'elementRegistry',
|
|
42323
|
+
'eventBus',
|
|
42324
|
+
'canvas'
|
|
42325
|
+
];
|
|
42326
|
+
|
|
42327
|
+
var HIGH_PRIORITY$a = 2000;
|
|
41919
42328
|
|
|
41920
42329
|
|
|
41921
42330
|
/**
|
|
@@ -42084,7 +42493,7 @@
|
|
|
42084
42493
|
});
|
|
42085
42494
|
|
|
42086
42495
|
// copy bpmn:CategoryValue when copying element
|
|
42087
|
-
eventBus.on('moddleCopy.canCopyProperty', HIGH_PRIORITY$
|
|
42496
|
+
eventBus.on('moddleCopy.canCopyProperty', HIGH_PRIORITY$a, function(context) {
|
|
42088
42497
|
var property = context.property,
|
|
42089
42498
|
categoryValue;
|
|
42090
42499
|
|
|
@@ -43509,6 +43918,151 @@
|
|
|
43509
43918
|
'translate'
|
|
43510
43919
|
];
|
|
43511
43920
|
|
|
43921
|
+
/**
|
|
43922
|
+
* BPMN specific behavior ensuring that bpmndi:Label's dc:Bounds are removed
|
|
43923
|
+
* when shape is resized.
|
|
43924
|
+
*/
|
|
43925
|
+
function RemoveEmbeddedLabelBoundsBehavior(eventBus, modeling) {
|
|
43926
|
+
CommandInterceptor.call(this, eventBus);
|
|
43927
|
+
|
|
43928
|
+
this.preExecute('shape.resize', function(context) {
|
|
43929
|
+
var shape = context.shape;
|
|
43930
|
+
|
|
43931
|
+
var di = getDi(shape),
|
|
43932
|
+
label = di && di.get('label'),
|
|
43933
|
+
bounds = label && label.get('bounds');
|
|
43934
|
+
|
|
43935
|
+
if (bounds) {
|
|
43936
|
+
modeling.updateModdleProperties(shape, label, {
|
|
43937
|
+
bounds: undefined
|
|
43938
|
+
});
|
|
43939
|
+
}
|
|
43940
|
+
}, true);
|
|
43941
|
+
}
|
|
43942
|
+
|
|
43943
|
+
inherits$1(RemoveEmbeddedLabelBoundsBehavior, CommandInterceptor);
|
|
43944
|
+
|
|
43945
|
+
RemoveEmbeddedLabelBoundsBehavior.$inject = [
|
|
43946
|
+
'eventBus',
|
|
43947
|
+
'modeling'
|
|
43948
|
+
];
|
|
43949
|
+
|
|
43950
|
+
function RemoveElementBehavior(eventBus, bpmnRules, modeling) {
|
|
43951
|
+
|
|
43952
|
+
CommandInterceptor.call(this, eventBus);
|
|
43953
|
+
|
|
43954
|
+
/**
|
|
43955
|
+
* Combine sequence flows when deleting an element
|
|
43956
|
+
* if there is one incoming and one outgoing
|
|
43957
|
+
* sequence flow
|
|
43958
|
+
*/
|
|
43959
|
+
this.preExecute('shape.delete', function(e) {
|
|
43960
|
+
|
|
43961
|
+
var shape = e.context.shape;
|
|
43962
|
+
|
|
43963
|
+
// only handle [a] -> [shape] -> [b] patterns
|
|
43964
|
+
if (shape.incoming.length !== 1 || shape.outgoing.length !== 1) {
|
|
43965
|
+
return;
|
|
43966
|
+
}
|
|
43967
|
+
|
|
43968
|
+
var inConnection = shape.incoming[0],
|
|
43969
|
+
outConnection = shape.outgoing[0];
|
|
43970
|
+
|
|
43971
|
+
// only handle sequence flows
|
|
43972
|
+
if (!is$1(inConnection, 'bpmn:SequenceFlow') || !is$1(outConnection, 'bpmn:SequenceFlow')) {
|
|
43973
|
+
return;
|
|
43974
|
+
}
|
|
43975
|
+
|
|
43976
|
+
if (bpmnRules.canConnect(inConnection.source, outConnection.target, inConnection)) {
|
|
43977
|
+
|
|
43978
|
+
// compute new, combined waypoints
|
|
43979
|
+
var newWaypoints = getNewWaypoints(inConnection.waypoints, outConnection.waypoints);
|
|
43980
|
+
|
|
43981
|
+
modeling.reconnectEnd(inConnection, outConnection.target, newWaypoints);
|
|
43982
|
+
}
|
|
43983
|
+
});
|
|
43984
|
+
|
|
43985
|
+
}
|
|
43986
|
+
|
|
43987
|
+
inherits$1(RemoveElementBehavior, CommandInterceptor);
|
|
43988
|
+
|
|
43989
|
+
RemoveElementBehavior.$inject = [
|
|
43990
|
+
'eventBus',
|
|
43991
|
+
'bpmnRules',
|
|
43992
|
+
'modeling'
|
|
43993
|
+
];
|
|
43994
|
+
|
|
43995
|
+
|
|
43996
|
+
// helpers //////////////////////
|
|
43997
|
+
|
|
43998
|
+
function getDocking$1(point) {
|
|
43999
|
+
return point.original || point;
|
|
44000
|
+
}
|
|
44001
|
+
|
|
44002
|
+
|
|
44003
|
+
function getNewWaypoints(inWaypoints, outWaypoints) {
|
|
44004
|
+
|
|
44005
|
+
var intersection = lineIntersect(
|
|
44006
|
+
getDocking$1(inWaypoints[inWaypoints.length - 2]),
|
|
44007
|
+
getDocking$1(inWaypoints[inWaypoints.length - 1]),
|
|
44008
|
+
getDocking$1(outWaypoints[1]),
|
|
44009
|
+
getDocking$1(outWaypoints[0]));
|
|
44010
|
+
|
|
44011
|
+
if (intersection) {
|
|
44012
|
+
return [].concat(
|
|
44013
|
+
inWaypoints.slice(0, inWaypoints.length - 1),
|
|
44014
|
+
[ intersection ],
|
|
44015
|
+
outWaypoints.slice(1));
|
|
44016
|
+
} else {
|
|
44017
|
+
return [
|
|
44018
|
+
getDocking$1(inWaypoints[0]),
|
|
44019
|
+
getDocking$1(outWaypoints[outWaypoints.length - 1])
|
|
44020
|
+
];
|
|
44021
|
+
}
|
|
44022
|
+
}
|
|
44023
|
+
|
|
44024
|
+
/**
|
|
44025
|
+
* BPMN specific remove behavior
|
|
44026
|
+
*/
|
|
44027
|
+
function RemoveParticipantBehavior(eventBus, modeling) {
|
|
44028
|
+
|
|
44029
|
+
CommandInterceptor.call(this, eventBus);
|
|
44030
|
+
|
|
44031
|
+
|
|
44032
|
+
/**
|
|
44033
|
+
* morph collaboration diagram into process diagram
|
|
44034
|
+
* after the last participant has been removed
|
|
44035
|
+
*/
|
|
44036
|
+
|
|
44037
|
+
this.preExecute('shape.delete', function(context) {
|
|
44038
|
+
|
|
44039
|
+
var shape = context.shape,
|
|
44040
|
+
parent = shape.parent;
|
|
44041
|
+
|
|
44042
|
+
// activate the behavior if the shape to be removed
|
|
44043
|
+
// is a participant
|
|
44044
|
+
if (is$1(shape, 'bpmn:Participant')) {
|
|
44045
|
+
context.collaborationRoot = parent;
|
|
44046
|
+
}
|
|
44047
|
+
}, true);
|
|
44048
|
+
|
|
44049
|
+
this.postExecute('shape.delete', function(context) {
|
|
44050
|
+
|
|
44051
|
+
var collaborationRoot = context.collaborationRoot;
|
|
44052
|
+
|
|
44053
|
+
if (collaborationRoot && !collaborationRoot.businessObject.participants.length) {
|
|
44054
|
+
|
|
44055
|
+
// replace empty collaboration with process diagram
|
|
44056
|
+
modeling.makeProcess();
|
|
44057
|
+
}
|
|
44058
|
+
}, true);
|
|
44059
|
+
|
|
44060
|
+
}
|
|
44061
|
+
|
|
44062
|
+
RemoveParticipantBehavior.$inject = [ 'eventBus', 'modeling' ];
|
|
44063
|
+
|
|
44064
|
+
inherits$1(RemoveParticipantBehavior, CommandInterceptor);
|
|
44065
|
+
|
|
43512
44066
|
function ReplaceConnectionBehavior(eventBus, modeling, bpmnRules, injector) {
|
|
43513
44067
|
|
|
43514
44068
|
CommandInterceptor.call(this, eventBus);
|
|
@@ -43681,48 +44235,6 @@
|
|
|
43681
44235
|
'injector'
|
|
43682
44236
|
];
|
|
43683
44237
|
|
|
43684
|
-
/**
|
|
43685
|
-
* BPMN specific remove behavior
|
|
43686
|
-
*/
|
|
43687
|
-
function RemoveParticipantBehavior(eventBus, modeling) {
|
|
43688
|
-
|
|
43689
|
-
CommandInterceptor.call(this, eventBus);
|
|
43690
|
-
|
|
43691
|
-
|
|
43692
|
-
/**
|
|
43693
|
-
* morph collaboration diagram into process diagram
|
|
43694
|
-
* after the last participant has been removed
|
|
43695
|
-
*/
|
|
43696
|
-
|
|
43697
|
-
this.preExecute('shape.delete', function(context) {
|
|
43698
|
-
|
|
43699
|
-
var shape = context.shape,
|
|
43700
|
-
parent = shape.parent;
|
|
43701
|
-
|
|
43702
|
-
// activate the behavior if the shape to be removed
|
|
43703
|
-
// is a participant
|
|
43704
|
-
if (is$1(shape, 'bpmn:Participant')) {
|
|
43705
|
-
context.collaborationRoot = parent;
|
|
43706
|
-
}
|
|
43707
|
-
}, true);
|
|
43708
|
-
|
|
43709
|
-
this.postExecute('shape.delete', function(context) {
|
|
43710
|
-
|
|
43711
|
-
var collaborationRoot = context.collaborationRoot;
|
|
43712
|
-
|
|
43713
|
-
if (collaborationRoot && !collaborationRoot.businessObject.participants.length) {
|
|
43714
|
-
|
|
43715
|
-
// replace empty collaboration with process diagram
|
|
43716
|
-
modeling.makeProcess();
|
|
43717
|
-
}
|
|
43718
|
-
}, true);
|
|
43719
|
-
|
|
43720
|
-
}
|
|
43721
|
-
|
|
43722
|
-
RemoveParticipantBehavior.$inject = [ 'eventBus', 'modeling' ];
|
|
43723
|
-
|
|
43724
|
-
inherits$1(RemoveParticipantBehavior, CommandInterceptor);
|
|
43725
|
-
|
|
43726
44238
|
/**
|
|
43727
44239
|
* BPMN-specific replace behavior.
|
|
43728
44240
|
*/
|
|
@@ -43840,7 +44352,7 @@
|
|
|
43840
44352
|
'selection'
|
|
43841
44353
|
];
|
|
43842
44354
|
|
|
43843
|
-
var HIGH_PRIORITY$
|
|
44355
|
+
var HIGH_PRIORITY$9 = 1500;
|
|
43844
44356
|
|
|
43845
44357
|
var LANE_MIN_DIMENSIONS = { width: 300, height: 60 };
|
|
43846
44358
|
|
|
@@ -43856,7 +44368,7 @@
|
|
|
43856
44368
|
* @param {EventBus} eventBus
|
|
43857
44369
|
*/
|
|
43858
44370
|
function ResizeBehavior(eventBus) {
|
|
43859
|
-
eventBus.on('resize.start', HIGH_PRIORITY$
|
|
44371
|
+
eventBus.on('resize.start', HIGH_PRIORITY$9, function(event) {
|
|
43860
44372
|
var context = event.context,
|
|
43861
44373
|
shape = context.shape,
|
|
43862
44374
|
direction = context.direction,
|
|
@@ -44056,78 +44568,165 @@
|
|
|
44056
44568
|
'modeling'
|
|
44057
44569
|
];
|
|
44058
44570
|
|
|
44059
|
-
|
|
44060
|
-
|
|
44061
|
-
|
|
44062
|
-
|
|
44063
|
-
|
|
44064
|
-
|
|
44065
|
-
|
|
44066
|
-
|
|
44067
|
-
|
|
44068
|
-
|
|
44069
|
-
|
|
44070
|
-
|
|
44071
|
-
|
|
44072
|
-
|
|
44073
|
-
|
|
44074
|
-
|
|
44075
|
-
|
|
44076
|
-
|
|
44077
|
-
|
|
44078
|
-
|
|
44079
|
-
|
|
44080
|
-
|
|
44081
|
-
|
|
44082
|
-
|
|
44083
|
-
|
|
44084
|
-
|
|
44085
|
-
|
|
44086
|
-
|
|
44087
|
-
|
|
44088
|
-
|
|
44089
|
-
|
|
44090
|
-
|
|
44091
|
-
}
|
|
44092
|
-
|
|
44093
|
-
|
|
44094
|
-
|
|
44095
|
-
|
|
44096
|
-
|
|
44097
|
-
|
|
44098
|
-
|
|
44099
|
-
|
|
44100
|
-
|
|
44101
|
-
|
|
44102
|
-
|
|
44103
|
-
|
|
44104
|
-
|
|
44105
|
-
|
|
44106
|
-
|
|
44107
|
-
|
|
44108
|
-
|
|
44109
|
-
|
|
44110
|
-
|
|
44111
|
-
|
|
44112
|
-
|
|
44113
|
-
|
|
44114
|
-
|
|
44115
|
-
|
|
44116
|
-
|
|
44117
|
-
|
|
44118
|
-
|
|
44119
|
-
|
|
44120
|
-
|
|
44121
|
-
|
|
44122
|
-
|
|
44123
|
-
|
|
44124
|
-
|
|
44125
|
-
|
|
44126
|
-
|
|
44127
|
-
|
|
44128
|
-
|
|
44129
|
-
|
|
44130
|
-
|
|
44571
|
+
var LOW_PRIORITY$a = 500;
|
|
44572
|
+
|
|
44573
|
+
|
|
44574
|
+
/**
|
|
44575
|
+
* Add referenced root elements (error, escalation, message, signal) if they don't exist.
|
|
44576
|
+
* Copy referenced root elements on copy & paste.
|
|
44577
|
+
*/
|
|
44578
|
+
function RootElementReferenceBehavior(
|
|
44579
|
+
bpmnjs, eventBus, injector, moddleCopy, bpmnFactory
|
|
44580
|
+
) {
|
|
44581
|
+
injector.invoke(CommandInterceptor, this);
|
|
44582
|
+
|
|
44583
|
+
function canHaveRootElementReference(element) {
|
|
44584
|
+
return isAny(element, [ 'bpmn:ReceiveTask', 'bpmn:SendTask' ]) ||
|
|
44585
|
+
hasAnyEventDefinition(element, [
|
|
44586
|
+
'bpmn:ErrorEventDefinition',
|
|
44587
|
+
'bpmn:EscalationEventDefinition',
|
|
44588
|
+
'bpmn:MessageEventDefinition',
|
|
44589
|
+
'bpmn:SignalEventDefinition'
|
|
44590
|
+
]);
|
|
44591
|
+
}
|
|
44592
|
+
|
|
44593
|
+
function hasRootElement(rootElement) {
|
|
44594
|
+
var definitions = bpmnjs.getDefinitions(),
|
|
44595
|
+
rootElements = definitions.get('rootElements');
|
|
44596
|
+
|
|
44597
|
+
return !!find(rootElements, matchPattern({ id: rootElement.id }));
|
|
44598
|
+
}
|
|
44599
|
+
|
|
44600
|
+
function getRootElementReferencePropertyName(eventDefinition) {
|
|
44601
|
+
if (is$1(eventDefinition, 'bpmn:ErrorEventDefinition')) {
|
|
44602
|
+
return 'errorRef';
|
|
44603
|
+
} else if (is$1(eventDefinition, 'bpmn:EscalationEventDefinition')) {
|
|
44604
|
+
return 'escalationRef';
|
|
44605
|
+
} else if (is$1(eventDefinition, 'bpmn:MessageEventDefinition')) {
|
|
44606
|
+
return 'messageRef';
|
|
44607
|
+
} else if (is$1(eventDefinition, 'bpmn:SignalEventDefinition')) {
|
|
44608
|
+
return 'signalRef';
|
|
44609
|
+
}
|
|
44610
|
+
}
|
|
44611
|
+
|
|
44612
|
+
function getRootElement(businessObject) {
|
|
44613
|
+
if (isAny(businessObject, [ 'bpmn:ReceiveTask', 'bpmn:SendTask' ])) {
|
|
44614
|
+
return businessObject.get('messageRef');
|
|
44615
|
+
}
|
|
44616
|
+
|
|
44617
|
+
var eventDefinitions = businessObject.get('eventDefinitions'),
|
|
44618
|
+
eventDefinition = eventDefinitions[ 0 ];
|
|
44619
|
+
|
|
44620
|
+
return eventDefinition.get(getRootElementReferencePropertyName(eventDefinition));
|
|
44621
|
+
}
|
|
44622
|
+
|
|
44623
|
+
function setRootElement(businessObject, rootElement) {
|
|
44624
|
+
if (isAny(businessObject, [ 'bpmn:ReceiveTask', 'bpmn:SendTask' ])) {
|
|
44625
|
+
return businessObject.set('messageRef', rootElement);
|
|
44626
|
+
}
|
|
44627
|
+
|
|
44628
|
+
var eventDefinitions = businessObject.get('eventDefinitions'),
|
|
44629
|
+
eventDefinition = eventDefinitions[ 0 ];
|
|
44630
|
+
|
|
44631
|
+
return eventDefinition.set(getRootElementReferencePropertyName(eventDefinition), rootElement);
|
|
44632
|
+
}
|
|
44633
|
+
|
|
44634
|
+
// create shape
|
|
44635
|
+
this.executed('shape.create', function(context) {
|
|
44636
|
+
var shape = context.shape;
|
|
44637
|
+
|
|
44638
|
+
if (!canHaveRootElementReference(shape)) {
|
|
44639
|
+
return;
|
|
44640
|
+
}
|
|
44641
|
+
|
|
44642
|
+
var businessObject = getBusinessObject(shape),
|
|
44643
|
+
rootElement = getRootElement(businessObject),
|
|
44644
|
+
rootElements;
|
|
44645
|
+
|
|
44646
|
+
if (rootElement && !hasRootElement(rootElement)) {
|
|
44647
|
+
rootElements = bpmnjs.getDefinitions().get('rootElements');
|
|
44648
|
+
|
|
44649
|
+
// add root element
|
|
44650
|
+
add(rootElements, rootElement);
|
|
44651
|
+
|
|
44652
|
+
context.addedRootElement = rootElement;
|
|
44653
|
+
}
|
|
44654
|
+
}, true);
|
|
44655
|
+
|
|
44656
|
+
this.reverted('shape.create', function(context) {
|
|
44657
|
+
var addedRootElement = context.addedRootElement;
|
|
44658
|
+
|
|
44659
|
+
if (!addedRootElement) {
|
|
44660
|
+
return;
|
|
44661
|
+
}
|
|
44662
|
+
|
|
44663
|
+
var rootElements = bpmnjs.getDefinitions().get('rootElements');
|
|
44664
|
+
|
|
44665
|
+
// remove root element
|
|
44666
|
+
remove(rootElements, addedRootElement);
|
|
44667
|
+
}, true);
|
|
44668
|
+
|
|
44669
|
+
eventBus.on('copyPaste.copyElement', function(context) {
|
|
44670
|
+
var descriptor = context.descriptor,
|
|
44671
|
+
element = context.element;
|
|
44672
|
+
|
|
44673
|
+
if (!canHaveRootElementReference(element)) {
|
|
44674
|
+
return;
|
|
44675
|
+
}
|
|
44676
|
+
|
|
44677
|
+
var businessObject = getBusinessObject(element),
|
|
44678
|
+
rootElement = getRootElement(businessObject);
|
|
44679
|
+
|
|
44680
|
+
if (rootElement) {
|
|
44681
|
+
descriptor.referencedRootElement = rootElement;
|
|
44682
|
+
}
|
|
44683
|
+
});
|
|
44684
|
+
|
|
44685
|
+
eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$a, function(context) {
|
|
44686
|
+
var descriptor = context.descriptor,
|
|
44687
|
+
businessObject = descriptor.businessObject;
|
|
44688
|
+
|
|
44689
|
+
if (!canHaveRootElementReference(businessObject)) {
|
|
44690
|
+
return;
|
|
44691
|
+
}
|
|
44692
|
+
|
|
44693
|
+
var referencedRootElement = descriptor.referencedRootElement;
|
|
44694
|
+
|
|
44695
|
+
if (!referencedRootElement) {
|
|
44696
|
+
return;
|
|
44697
|
+
}
|
|
44698
|
+
|
|
44699
|
+
if (!hasRootElement(referencedRootElement)) {
|
|
44700
|
+
referencedRootElement = moddleCopy.copyElement(
|
|
44701
|
+
referencedRootElement,
|
|
44702
|
+
bpmnFactory.create(referencedRootElement.$type)
|
|
44703
|
+
);
|
|
44704
|
+
}
|
|
44705
|
+
|
|
44706
|
+
setRootElement(businessObject, referencedRootElement);
|
|
44707
|
+
});
|
|
44708
|
+
}
|
|
44709
|
+
|
|
44710
|
+
RootElementReferenceBehavior.$inject = [
|
|
44711
|
+
'bpmnjs',
|
|
44712
|
+
'eventBus',
|
|
44713
|
+
'injector',
|
|
44714
|
+
'moddleCopy',
|
|
44715
|
+
'bpmnFactory'
|
|
44716
|
+
];
|
|
44717
|
+
|
|
44718
|
+
inherits$1(RootElementReferenceBehavior, CommandInterceptor);
|
|
44719
|
+
|
|
44720
|
+
// helpers //////////
|
|
44721
|
+
|
|
44722
|
+
function hasAnyEventDefinition(element, types) {
|
|
44723
|
+
if (!isArray$2(types)) {
|
|
44724
|
+
types = [ types ];
|
|
44725
|
+
}
|
|
44726
|
+
|
|
44727
|
+
return some(types, function(type) {
|
|
44728
|
+
return hasEventDefinition$2(element, type);
|
|
44729
|
+
});
|
|
44131
44730
|
}
|
|
44132
44731
|
|
|
44133
44732
|
var max$1 = Math.max;
|
|
@@ -44240,6 +44839,547 @@
|
|
|
44240
44839
|
}
|
|
44241
44840
|
}
|
|
44242
44841
|
|
|
44842
|
+
var LOW_PRIORITY$9 = 400;
|
|
44843
|
+
var HIGH_PRIORITY$8 = 600;
|
|
44844
|
+
|
|
44845
|
+
var DEFAULT_POSITION = {
|
|
44846
|
+
x: 180,
|
|
44847
|
+
y: 160
|
|
44848
|
+
};
|
|
44849
|
+
|
|
44850
|
+
|
|
44851
|
+
/**
|
|
44852
|
+
* Creates bpmndi:BPMNPlane elements and canvas planes when collapsed subprocesses are created.
|
|
44853
|
+
*
|
|
44854
|
+
*
|
|
44855
|
+
* @param {Canvas} canvas
|
|
44856
|
+
* @param {EventBus} eventBus
|
|
44857
|
+
* @param {Modeling} modeling
|
|
44858
|
+
* @param {ElementFactory} elementFactory
|
|
44859
|
+
* @param {BpmnFactory} bpmnFactory
|
|
44860
|
+
* @param {Bpmnjs} bpmnjs
|
|
44861
|
+
* @param {ElementRegistry} elementRegistry
|
|
44862
|
+
*/
|
|
44863
|
+
function SubProcessPlaneBehavior(
|
|
44864
|
+
canvas, eventBus, modeling,
|
|
44865
|
+
elementFactory, bpmnFactory, bpmnjs, elementRegistry) {
|
|
44866
|
+
|
|
44867
|
+
CommandInterceptor.call(this, eventBus);
|
|
44868
|
+
|
|
44869
|
+
this._canvas = canvas;
|
|
44870
|
+
this._eventBus = eventBus;
|
|
44871
|
+
this._modeling = modeling;
|
|
44872
|
+
this._elementFactory = elementFactory;
|
|
44873
|
+
this._bpmnFactory = bpmnFactory;
|
|
44874
|
+
this._bpmnjs = bpmnjs;
|
|
44875
|
+
this._elementRegistry = elementRegistry;
|
|
44876
|
+
|
|
44877
|
+
var self = this;
|
|
44878
|
+
|
|
44879
|
+
function isCollapsedSubProcess(element) {
|
|
44880
|
+
return is$1(element, 'bpmn:SubProcess') && !isExpanded(element);
|
|
44881
|
+
}
|
|
44882
|
+
|
|
44883
|
+
function createRoot(context) {
|
|
44884
|
+
var shape = context.shape,
|
|
44885
|
+
rootElement = context.newRootElement;
|
|
44886
|
+
|
|
44887
|
+
var businessObject = getBusinessObject(shape);
|
|
44888
|
+
|
|
44889
|
+
rootElement = self._addDiagram(rootElement || businessObject);
|
|
44890
|
+
|
|
44891
|
+
context.newRootElement = canvas.addRootElement(rootElement);
|
|
44892
|
+
}
|
|
44893
|
+
|
|
44894
|
+
function removeRoot(context) {
|
|
44895
|
+
var shape = context.shape;
|
|
44896
|
+
|
|
44897
|
+
var businessObject = getBusinessObject(shape);
|
|
44898
|
+
self._removeDiagram(businessObject);
|
|
44899
|
+
|
|
44900
|
+
var rootElement = context.newRootElement = elementRegistry.get(getPlaneIdFromShape(businessObject));
|
|
44901
|
+
|
|
44902
|
+
canvas.removeRootElement(rootElement);
|
|
44903
|
+
}
|
|
44904
|
+
|
|
44905
|
+
// add plane elements for newly created sub-processes
|
|
44906
|
+
// this ensures we can actually drill down into the element
|
|
44907
|
+
this.executed('shape.create', function(context) {
|
|
44908
|
+
var shape = context.shape;
|
|
44909
|
+
if (!isCollapsedSubProcess(shape)) {
|
|
44910
|
+
return;
|
|
44911
|
+
}
|
|
44912
|
+
|
|
44913
|
+
createRoot(context);
|
|
44914
|
+
}, true);
|
|
44915
|
+
|
|
44916
|
+
|
|
44917
|
+
this.postExecuted('shape.create', function(context) {
|
|
44918
|
+
var shape = context.shape,
|
|
44919
|
+
rootElement = context.newRootElement;
|
|
44920
|
+
|
|
44921
|
+
if (!rootElement || !shape.children) {
|
|
44922
|
+
return;
|
|
44923
|
+
}
|
|
44924
|
+
|
|
44925
|
+
self._showRecursively(shape.children);
|
|
44926
|
+
|
|
44927
|
+
self._moveChildrenToShape(shape, rootElement);
|
|
44928
|
+
}, true);
|
|
44929
|
+
|
|
44930
|
+
|
|
44931
|
+
this.reverted('shape.create', function(context) {
|
|
44932
|
+
var shape = context.shape;
|
|
44933
|
+
if (!isCollapsedSubProcess(shape)) {
|
|
44934
|
+
return;
|
|
44935
|
+
}
|
|
44936
|
+
|
|
44937
|
+
removeRoot(context);
|
|
44938
|
+
}, true);
|
|
44939
|
+
|
|
44940
|
+
|
|
44941
|
+
this.preExecuted('shape.delete', function(context) {
|
|
44942
|
+
var shape = context.shape;
|
|
44943
|
+
if (!isCollapsedSubProcess(shape)) {
|
|
44944
|
+
return;
|
|
44945
|
+
}
|
|
44946
|
+
|
|
44947
|
+
var attachedRoot = elementRegistry.get(getPlaneIdFromShape(shape));
|
|
44948
|
+
|
|
44949
|
+
if (!attachedRoot) {
|
|
44950
|
+
return;
|
|
44951
|
+
}
|
|
44952
|
+
|
|
44953
|
+
modeling.removeElements(attachedRoot.children.slice());
|
|
44954
|
+
}, true);
|
|
44955
|
+
|
|
44956
|
+
|
|
44957
|
+
this.executed('shape.delete', function(context) {
|
|
44958
|
+
var shape = context.shape;
|
|
44959
|
+
if (!isCollapsedSubProcess(shape)) {
|
|
44960
|
+
return;
|
|
44961
|
+
}
|
|
44962
|
+
removeRoot(context);
|
|
44963
|
+
}, true);
|
|
44964
|
+
|
|
44965
|
+
|
|
44966
|
+
this.reverted('shape.delete', function(context) {
|
|
44967
|
+
var shape = context.shape;
|
|
44968
|
+
if (!isCollapsedSubProcess(shape)) {
|
|
44969
|
+
return;
|
|
44970
|
+
}
|
|
44971
|
+
|
|
44972
|
+
createRoot(context);
|
|
44973
|
+
}, true);
|
|
44974
|
+
|
|
44975
|
+
|
|
44976
|
+
this.preExecuted('shape.replace', function(context) {
|
|
44977
|
+
var oldShape = context.oldShape;
|
|
44978
|
+
var newShape = context.newShape;
|
|
44979
|
+
|
|
44980
|
+
if (!isCollapsedSubProcess(oldShape) || !isCollapsedSubProcess(newShape)) {
|
|
44981
|
+
return;
|
|
44982
|
+
}
|
|
44983
|
+
|
|
44984
|
+
// old plane could have content,
|
|
44985
|
+
// we remove it so it is not recursively deleted from 'shape.delete'
|
|
44986
|
+
context.oldRoot = canvas.removeRootElement(getPlaneIdFromShape(oldShape));
|
|
44987
|
+
}, true);
|
|
44988
|
+
|
|
44989
|
+
|
|
44990
|
+
this.postExecuted('shape.replace', function(context) {
|
|
44991
|
+
var newShape = context.newShape,
|
|
44992
|
+
source = context.oldRoot,
|
|
44993
|
+
target = canvas.findRoot(getPlaneIdFromShape(newShape));
|
|
44994
|
+
|
|
44995
|
+
if (!source || !target) {
|
|
44996
|
+
return;
|
|
44997
|
+
}
|
|
44998
|
+
var elements = source.children;
|
|
44999
|
+
|
|
45000
|
+
modeling.moveElements(elements, { x: 0, y: 0 }, target);
|
|
45001
|
+
}, true);
|
|
45002
|
+
|
|
45003
|
+
|
|
45004
|
+
// rename primary elements when the secondary element changes
|
|
45005
|
+
// this ensures rootElement.id = element.id + '_plane'
|
|
45006
|
+
this.executed('element.updateProperties', function(context) {
|
|
45007
|
+
var shape = context.element;
|
|
45008
|
+
|
|
45009
|
+
if (!is$1(shape, 'bpmn:SubProcess')) {
|
|
45010
|
+
return;
|
|
45011
|
+
}
|
|
45012
|
+
|
|
45013
|
+
var properties = context.properties;
|
|
45014
|
+
var oldProperties = context.oldProperties;
|
|
45015
|
+
|
|
45016
|
+
var oldId = oldProperties.id,
|
|
45017
|
+
newId = properties.id;
|
|
45018
|
+
|
|
45019
|
+
if (oldId === newId) {
|
|
45020
|
+
return;
|
|
45021
|
+
}
|
|
45022
|
+
|
|
45023
|
+
if (isPlane(shape)) {
|
|
45024
|
+
elementRegistry.updateId(shape, toPlaneId(newId));
|
|
45025
|
+
elementRegistry.updateId(oldId, newId);
|
|
45026
|
+
|
|
45027
|
+
return;
|
|
45028
|
+
}
|
|
45029
|
+
|
|
45030
|
+
var planeElement = elementRegistry.get(toPlaneId(oldId));
|
|
45031
|
+
|
|
45032
|
+
if (!planeElement) {
|
|
45033
|
+
return;
|
|
45034
|
+
}
|
|
45035
|
+
|
|
45036
|
+
elementRegistry.updateId(toPlaneId(oldId), toPlaneId(newId));
|
|
45037
|
+
}, true);
|
|
45038
|
+
|
|
45039
|
+
|
|
45040
|
+
this.reverted('element.updateProperties', function(context) {
|
|
45041
|
+
var shape = context.element;
|
|
45042
|
+
|
|
45043
|
+
if (!is$1(shape, 'bpmn:SubProcess')) {
|
|
45044
|
+
return;
|
|
45045
|
+
}
|
|
45046
|
+
|
|
45047
|
+
var properties = context.properties;
|
|
45048
|
+
var oldProperties = context.oldProperties;
|
|
45049
|
+
|
|
45050
|
+
var oldId = oldProperties.id,
|
|
45051
|
+
newId = properties.id;
|
|
45052
|
+
|
|
45053
|
+
if (oldId === newId) {
|
|
45054
|
+
return;
|
|
45055
|
+
}
|
|
45056
|
+
|
|
45057
|
+
if (isPlane(shape)) {
|
|
45058
|
+
elementRegistry.updateId(shape, toPlaneId(oldId));
|
|
45059
|
+
elementRegistry.updateId(newId, oldId);
|
|
45060
|
+
|
|
45061
|
+
return;
|
|
45062
|
+
}
|
|
45063
|
+
|
|
45064
|
+
var planeElement = elementRegistry.get(toPlaneId(newId));
|
|
45065
|
+
|
|
45066
|
+
if (!planeElement) {
|
|
45067
|
+
return;
|
|
45068
|
+
}
|
|
45069
|
+
|
|
45070
|
+
elementRegistry.updateId(planeElement, toPlaneId(oldId));
|
|
45071
|
+
}, true);
|
|
45072
|
+
|
|
45073
|
+
// re-throw element.changed to re-render primary shape if associated plane has
|
|
45074
|
+
// changed (e.g. bpmn:name property has changed)
|
|
45075
|
+
eventBus.on('element.changed', function(context) {
|
|
45076
|
+
var element = context.element;
|
|
45077
|
+
|
|
45078
|
+
if (!isPlane(element)) {
|
|
45079
|
+
return;
|
|
45080
|
+
}
|
|
45081
|
+
|
|
45082
|
+
var plane = element;
|
|
45083
|
+
|
|
45084
|
+
var primaryShape = elementRegistry.get(getShapeIdFromPlane(plane));
|
|
45085
|
+
|
|
45086
|
+
// do not re-throw if no associated primary shape (e.g. bpmn:Process)
|
|
45087
|
+
if (!primaryShape || primaryShape === plane) {
|
|
45088
|
+
return;
|
|
45089
|
+
}
|
|
45090
|
+
|
|
45091
|
+
eventBus.fire('element.changed', { element: primaryShape });
|
|
45092
|
+
});
|
|
45093
|
+
|
|
45094
|
+
|
|
45095
|
+
// create/remove plane for the subprocess
|
|
45096
|
+
this.executed('shape.toggleCollapse', LOW_PRIORITY$9, function(context) {
|
|
45097
|
+
var shape = context.shape;
|
|
45098
|
+
|
|
45099
|
+
if (!is$1(shape, 'bpmn:SubProcess')) {
|
|
45100
|
+
return;
|
|
45101
|
+
}
|
|
45102
|
+
|
|
45103
|
+
if (!isExpanded(shape)) {
|
|
45104
|
+
createRoot(context);
|
|
45105
|
+
self._showRecursively(shape.children);
|
|
45106
|
+
} else {
|
|
45107
|
+
removeRoot(context);
|
|
45108
|
+
}
|
|
45109
|
+
|
|
45110
|
+
}, true);
|
|
45111
|
+
|
|
45112
|
+
|
|
45113
|
+
// create/remove plane for the subprocess
|
|
45114
|
+
this.reverted('shape.toggleCollapse', LOW_PRIORITY$9, function(context) {
|
|
45115
|
+
var shape = context.shape;
|
|
45116
|
+
|
|
45117
|
+
if (!is$1(shape, 'bpmn:SubProcess')) {
|
|
45118
|
+
return;
|
|
45119
|
+
}
|
|
45120
|
+
|
|
45121
|
+
if (!isExpanded(shape)) {
|
|
45122
|
+
createRoot(context);
|
|
45123
|
+
self._showRecursively(shape.children);
|
|
45124
|
+
} else {
|
|
45125
|
+
removeRoot(context);
|
|
45126
|
+
}
|
|
45127
|
+
|
|
45128
|
+
}, true);
|
|
45129
|
+
|
|
45130
|
+
// move elements between planes
|
|
45131
|
+
this.postExecuted('shape.toggleCollapse', HIGH_PRIORITY$8, function(context) {
|
|
45132
|
+
var shape = context.shape;
|
|
45133
|
+
|
|
45134
|
+
if (!is$1(shape, 'bpmn:SubProcess')) {
|
|
45135
|
+
return;
|
|
45136
|
+
}
|
|
45137
|
+
|
|
45138
|
+
var rootElement = context.newRootElement;
|
|
45139
|
+
|
|
45140
|
+
if (!rootElement) {
|
|
45141
|
+
return;
|
|
45142
|
+
}
|
|
45143
|
+
|
|
45144
|
+
if (!isExpanded(shape)) {
|
|
45145
|
+
|
|
45146
|
+
// collapsed
|
|
45147
|
+
self._moveChildrenToShape(shape, rootElement);
|
|
45148
|
+
|
|
45149
|
+
} else {
|
|
45150
|
+
self._moveChildrenToShape(rootElement, shape);
|
|
45151
|
+
}
|
|
45152
|
+
}, true);
|
|
45153
|
+
|
|
45154
|
+
|
|
45155
|
+
// copy-paste ///////////
|
|
45156
|
+
|
|
45157
|
+
// add elements in plane to tree
|
|
45158
|
+
eventBus.on('copyPaste.createTree', function(context) {
|
|
45159
|
+
var element = context.element,
|
|
45160
|
+
children = context.children;
|
|
45161
|
+
|
|
45162
|
+
if (!isCollapsedSubProcess(element)) {
|
|
45163
|
+
return;
|
|
45164
|
+
}
|
|
45165
|
+
|
|
45166
|
+
var id = getPlaneIdFromShape(element);
|
|
45167
|
+
var parent = elementRegistry.get(id);
|
|
45168
|
+
|
|
45169
|
+
if (parent) {
|
|
45170
|
+
|
|
45171
|
+
// do not copy invisible root element
|
|
45172
|
+
children.push.apply(children, parent.children);
|
|
45173
|
+
}
|
|
45174
|
+
});
|
|
45175
|
+
|
|
45176
|
+
// set plane children as direct children of collapsed shape
|
|
45177
|
+
eventBus.on('copyPaste.copyElement', function(context) {
|
|
45178
|
+
var descriptor = context.descriptor,
|
|
45179
|
+
element = context.element,
|
|
45180
|
+
elements = context.elements;
|
|
45181
|
+
|
|
45182
|
+
var parent = element.parent;
|
|
45183
|
+
|
|
45184
|
+
var isPlane = is$1(getDi(parent), 'bpmndi:BPMNPlane');
|
|
45185
|
+
if (!isPlane) {
|
|
45186
|
+
return;
|
|
45187
|
+
}
|
|
45188
|
+
|
|
45189
|
+
var parentId = getShapeIdFromPlane(parent);
|
|
45190
|
+
|
|
45191
|
+
var referencedShape = find(elements, function(element) {
|
|
45192
|
+
return element.id === parentId;
|
|
45193
|
+
});
|
|
45194
|
+
|
|
45195
|
+
if (!referencedShape) {
|
|
45196
|
+
return;
|
|
45197
|
+
}
|
|
45198
|
+
|
|
45199
|
+
descriptor.parent = referencedShape.id;
|
|
45200
|
+
});
|
|
45201
|
+
|
|
45202
|
+
// hide children during pasting
|
|
45203
|
+
eventBus.on('copyPaste.pasteElement', function(context) {
|
|
45204
|
+
var descriptor = context.descriptor;
|
|
45205
|
+
|
|
45206
|
+
if (!descriptor.parent) {
|
|
45207
|
+
return;
|
|
45208
|
+
}
|
|
45209
|
+
|
|
45210
|
+
if (isCollapsedSubProcess(descriptor.parent) || descriptor.parent.hidden) {
|
|
45211
|
+
descriptor.hidden = true;
|
|
45212
|
+
}
|
|
45213
|
+
});
|
|
45214
|
+
|
|
45215
|
+
}
|
|
45216
|
+
|
|
45217
|
+
inherits$1(SubProcessPlaneBehavior, CommandInterceptor);
|
|
45218
|
+
|
|
45219
|
+
/**
|
|
45220
|
+
* Moves the child elements from source to target.
|
|
45221
|
+
*
|
|
45222
|
+
* If the target is a plane, the children are moved to the top left corner.
|
|
45223
|
+
* Otherwise, the center of the target is used.
|
|
45224
|
+
*
|
|
45225
|
+
* @param {Object|djs.model.Base} source
|
|
45226
|
+
* @param {Object|djs.model.Base} target
|
|
45227
|
+
*/
|
|
45228
|
+
SubProcessPlaneBehavior.prototype._moveChildrenToShape = function(source, target) {
|
|
45229
|
+
var modeling = this._modeling;
|
|
45230
|
+
|
|
45231
|
+
var children = source.children;
|
|
45232
|
+
var offset;
|
|
45233
|
+
|
|
45234
|
+
if (!children) {
|
|
45235
|
+
return;
|
|
45236
|
+
}
|
|
45237
|
+
|
|
45238
|
+
// only change plane if there are no visible children, but don't move them
|
|
45239
|
+
var visibleChildren = children.filter(function(child) {
|
|
45240
|
+
return !child.hidden;
|
|
45241
|
+
});
|
|
45242
|
+
|
|
45243
|
+
if (!visibleChildren.length) {
|
|
45244
|
+
modeling.moveElements(children, { x: 0, y: 0 }, target, { autoResize: false });
|
|
45245
|
+
return;
|
|
45246
|
+
}
|
|
45247
|
+
|
|
45248
|
+
var childrenBounds = getBBox(visibleChildren);
|
|
45249
|
+
|
|
45250
|
+
// target is a plane
|
|
45251
|
+
if (!target.x) {
|
|
45252
|
+
offset = {
|
|
45253
|
+
x: DEFAULT_POSITION.x - childrenBounds.x,
|
|
45254
|
+
y: DEFAULT_POSITION.y - childrenBounds.y
|
|
45255
|
+
};
|
|
45256
|
+
}
|
|
45257
|
+
|
|
45258
|
+
// source is a plane
|
|
45259
|
+
else {
|
|
45260
|
+
|
|
45261
|
+
// move relative to the center of the shape
|
|
45262
|
+
var targetMid = getMid(target);
|
|
45263
|
+
var childrenMid = getMid(childrenBounds);
|
|
45264
|
+
|
|
45265
|
+
offset = {
|
|
45266
|
+
x: targetMid.x - childrenMid.x,
|
|
45267
|
+
y: targetMid.y - childrenMid.y
|
|
45268
|
+
};
|
|
45269
|
+
}
|
|
45270
|
+
|
|
45271
|
+
modeling.moveElements(children, offset, target, { autoResize: false });
|
|
45272
|
+
};
|
|
45273
|
+
|
|
45274
|
+
/**
|
|
45275
|
+
* Sets `hidden` property on all children of the given shape.
|
|
45276
|
+
*
|
|
45277
|
+
* @param {Array} elements
|
|
45278
|
+
* @param {Boolean} [hidden]
|
|
45279
|
+
* @returns {Array} all child elements
|
|
45280
|
+
*/
|
|
45281
|
+
SubProcessPlaneBehavior.prototype._showRecursively = function(elements, hidden) {
|
|
45282
|
+
var self = this;
|
|
45283
|
+
|
|
45284
|
+
var result = [];
|
|
45285
|
+
elements.forEach(function(element) {
|
|
45286
|
+
element.hidden = !!hidden;
|
|
45287
|
+
|
|
45288
|
+
result = result.concat(element);
|
|
45289
|
+
|
|
45290
|
+
if (element.children) {
|
|
45291
|
+
result = result.concat(
|
|
45292
|
+
self._showRecursively(element.children, element.collapsed || hidden)
|
|
45293
|
+
);
|
|
45294
|
+
}
|
|
45295
|
+
});
|
|
45296
|
+
|
|
45297
|
+
return result;
|
|
45298
|
+
};
|
|
45299
|
+
|
|
45300
|
+
/**
|
|
45301
|
+
* Adds a given rootElement to the bpmnDi diagrams.
|
|
45302
|
+
*
|
|
45303
|
+
* @param {Object} rootElement
|
|
45304
|
+
* @returns {Object} planeElement
|
|
45305
|
+
*/
|
|
45306
|
+
SubProcessPlaneBehavior.prototype._addDiagram = function(planeElement) {
|
|
45307
|
+
var bpmnjs = this._bpmnjs;
|
|
45308
|
+
var diagrams = bpmnjs.getDefinitions().diagrams;
|
|
45309
|
+
|
|
45310
|
+
if (!planeElement.businessObject) {
|
|
45311
|
+
planeElement = this._createNewDiagram(planeElement);
|
|
45312
|
+
}
|
|
45313
|
+
|
|
45314
|
+
diagrams.push(planeElement.di.$parent);
|
|
45315
|
+
|
|
45316
|
+
return planeElement;
|
|
45317
|
+
};
|
|
45318
|
+
|
|
45319
|
+
|
|
45320
|
+
/**
|
|
45321
|
+
* Creates a new plane element for the given sub process.
|
|
45322
|
+
*
|
|
45323
|
+
* @param {Object} bpmnElement
|
|
45324
|
+
*
|
|
45325
|
+
* @return {Object} new diagram element
|
|
45326
|
+
*/
|
|
45327
|
+
SubProcessPlaneBehavior.prototype._createNewDiagram = function(bpmnElement) {
|
|
45328
|
+
var bpmnFactory = this._bpmnFactory;
|
|
45329
|
+
var elementFactory = this._elementFactory;
|
|
45330
|
+
|
|
45331
|
+
var diPlane = bpmnFactory.create('bpmndi:BPMNPlane', {
|
|
45332
|
+
bpmnElement: bpmnElement
|
|
45333
|
+
});
|
|
45334
|
+
var diDiagram = bpmnFactory.create('bpmndi:BPMNDiagram', {
|
|
45335
|
+
plane: diPlane
|
|
45336
|
+
});
|
|
45337
|
+
diPlane.$parent = diDiagram;
|
|
45338
|
+
|
|
45339
|
+
// add a virtual element (not being drawn),
|
|
45340
|
+
// a copy cat of our BpmnImporter code
|
|
45341
|
+
var planeElement = elementFactory.createRoot({
|
|
45342
|
+
id: getPlaneIdFromShape(bpmnElement),
|
|
45343
|
+
type: bpmnElement.$type,
|
|
45344
|
+
di: diPlane,
|
|
45345
|
+
businessObject: bpmnElement,
|
|
45346
|
+
collapsed: true
|
|
45347
|
+
});
|
|
45348
|
+
|
|
45349
|
+
return planeElement;
|
|
45350
|
+
};
|
|
45351
|
+
|
|
45352
|
+
/**
|
|
45353
|
+
* Removes the diagram for a given root element
|
|
45354
|
+
*
|
|
45355
|
+
* @param {Object} rootElement
|
|
45356
|
+
* @returns {Object} removed bpmndi:BPMNDiagram
|
|
45357
|
+
*/
|
|
45358
|
+
SubProcessPlaneBehavior.prototype._removeDiagram = function(rootElement) {
|
|
45359
|
+
var bpmnjs = this._bpmnjs;
|
|
45360
|
+
|
|
45361
|
+
var diagrams = bpmnjs.getDefinitions().diagrams;
|
|
45362
|
+
|
|
45363
|
+
var removedDiagram = find(diagrams, function(diagram) {
|
|
45364
|
+
return diagram.plane.bpmnElement.id === rootElement.id;
|
|
45365
|
+
});
|
|
45366
|
+
|
|
45367
|
+
diagrams.splice(diagrams.indexOf(removedDiagram), 1);
|
|
45368
|
+
|
|
45369
|
+
return removedDiagram;
|
|
45370
|
+
};
|
|
45371
|
+
|
|
45372
|
+
|
|
45373
|
+
SubProcessPlaneBehavior.$inject = [
|
|
45374
|
+
'canvas',
|
|
45375
|
+
'eventBus',
|
|
45376
|
+
'modeling',
|
|
45377
|
+
'elementFactory',
|
|
45378
|
+
'bpmnFactory',
|
|
45379
|
+
'bpmnjs',
|
|
45380
|
+
'elementRegistry'
|
|
45381
|
+
];
|
|
45382
|
+
|
|
44243
45383
|
/**
|
|
44244
45384
|
* Add start event replacing element with expanded sub process.
|
|
44245
45385
|
*
|
|
@@ -44283,6 +45423,64 @@
|
|
|
44283
45423
|
};
|
|
44284
45424
|
}
|
|
44285
45425
|
|
|
45426
|
+
function ToggleCollapseConnectionBehaviour(
|
|
45427
|
+
eventBus, modeling
|
|
45428
|
+
) {
|
|
45429
|
+
|
|
45430
|
+
CommandInterceptor.call(this, eventBus);
|
|
45431
|
+
|
|
45432
|
+
this.postExecuted('shape.toggleCollapse', 1500, function(context) {
|
|
45433
|
+
|
|
45434
|
+
// var shape = context.shape;
|
|
45435
|
+
var shape = context.shape;
|
|
45436
|
+
|
|
45437
|
+
// only change connections when collapsing
|
|
45438
|
+
if (isExpanded(shape)) {
|
|
45439
|
+
return;
|
|
45440
|
+
}
|
|
45441
|
+
|
|
45442
|
+
var allChildren = selfAndAllChildren(shape);
|
|
45443
|
+
|
|
45444
|
+
allChildren.forEach(function(child) {
|
|
45445
|
+
|
|
45446
|
+
// Ensure that the connection array is not modified during iteration
|
|
45447
|
+
var incomingConnections = child.incoming.slice(),
|
|
45448
|
+
outgoingConnections = child.outgoing.slice();
|
|
45449
|
+
|
|
45450
|
+
forEach(incomingConnections, function(c) {
|
|
45451
|
+
handleConnection(c, true);
|
|
45452
|
+
});
|
|
45453
|
+
|
|
45454
|
+
forEach(outgoingConnections, function(c) {
|
|
45455
|
+
handleConnection(c, false);
|
|
45456
|
+
});
|
|
45457
|
+
});
|
|
45458
|
+
|
|
45459
|
+
|
|
45460
|
+
function handleConnection(c, incoming) {
|
|
45461
|
+
if (allChildren.includes(c.source) && allChildren.includes(c.target)) {
|
|
45462
|
+
return;
|
|
45463
|
+
}
|
|
45464
|
+
|
|
45465
|
+
if (incoming) {
|
|
45466
|
+
modeling.reconnectEnd(c, shape, getMid(shape));
|
|
45467
|
+
} else {
|
|
45468
|
+
modeling.reconnectStart(c, shape, getMid(shape));
|
|
45469
|
+
}
|
|
45470
|
+
|
|
45471
|
+
}
|
|
45472
|
+
|
|
45473
|
+
}, true);
|
|
45474
|
+
|
|
45475
|
+
}
|
|
45476
|
+
|
|
45477
|
+
inherits$1(ToggleCollapseConnectionBehaviour, CommandInterceptor);
|
|
45478
|
+
|
|
45479
|
+
ToggleCollapseConnectionBehaviour.$inject = [
|
|
45480
|
+
'eventBus',
|
|
45481
|
+
'modeling',
|
|
45482
|
+
];
|
|
45483
|
+
|
|
44286
45484
|
var LOW_PRIORITY$8 = 500;
|
|
44287
45485
|
|
|
44288
45486
|
|
|
@@ -44459,7 +45657,9 @@
|
|
|
44459
45657
|
var rootElement = canvas.getRootElement(),
|
|
44460
45658
|
rootElementBo = rootElement.businessObject;
|
|
44461
45659
|
|
|
44462
|
-
|
|
45660
|
+
if (is$1(rootElement, 'bpmn:Collaboration')) {
|
|
45661
|
+
moddle.ids.unclaim(rootElementBo.id);
|
|
45662
|
+
}
|
|
44463
45663
|
});
|
|
44464
45664
|
}
|
|
44465
45665
|
|
|
@@ -44467,6 +45667,54 @@
|
|
|
44467
45667
|
|
|
44468
45668
|
UnclaimIdBehavior.$inject = [ 'canvas', 'injector', 'moddle', 'modeling' ];
|
|
44469
45669
|
|
|
45670
|
+
/**
|
|
45671
|
+
* A behavior that unsets the Default property of
|
|
45672
|
+
* sequence flow source on element delete, if the
|
|
45673
|
+
* removed element is the Gateway or Task's default flow.
|
|
45674
|
+
*
|
|
45675
|
+
* @param {EventBus} eventBus
|
|
45676
|
+
* @param {Modeling} modeling
|
|
45677
|
+
*/
|
|
45678
|
+
function DeleteSequenceFlowBehavior(eventBus, modeling) {
|
|
45679
|
+
|
|
45680
|
+
CommandInterceptor.call(this, eventBus);
|
|
45681
|
+
|
|
45682
|
+
|
|
45683
|
+
this.preExecute('connection.delete', function(event) {
|
|
45684
|
+
var context = event.context,
|
|
45685
|
+
connection = context.connection,
|
|
45686
|
+
source = connection.source;
|
|
45687
|
+
|
|
45688
|
+
if (isDefaultFlow(connection, source)) {
|
|
45689
|
+
modeling.updateProperties(source, {
|
|
45690
|
+
'default': null
|
|
45691
|
+
});
|
|
45692
|
+
}
|
|
45693
|
+
});
|
|
45694
|
+
}
|
|
45695
|
+
|
|
45696
|
+
inherits$1(DeleteSequenceFlowBehavior, CommandInterceptor);
|
|
45697
|
+
|
|
45698
|
+
DeleteSequenceFlowBehavior.$inject = [
|
|
45699
|
+
'eventBus',
|
|
45700
|
+
'modeling'
|
|
45701
|
+
];
|
|
45702
|
+
|
|
45703
|
+
|
|
45704
|
+
// helpers //////////////////////
|
|
45705
|
+
|
|
45706
|
+
function isDefaultFlow(connection, source) {
|
|
45707
|
+
|
|
45708
|
+
if (!is$1(connection, 'bpmn:SequenceFlow')) {
|
|
45709
|
+
return false;
|
|
45710
|
+
}
|
|
45711
|
+
|
|
45712
|
+
var sourceBo = getBusinessObject(source),
|
|
45713
|
+
sequenceFlow = getBusinessObject(connection);
|
|
45714
|
+
|
|
45715
|
+
return sourceBo.get('default') === sequenceFlow;
|
|
45716
|
+
}
|
|
45717
|
+
|
|
44470
45718
|
var LOW_PRIORITY$7 = 500,
|
|
44471
45719
|
HIGH_PRIORITY$7 = 5000;
|
|
44472
45720
|
|
|
@@ -44618,54 +45866,6 @@
|
|
|
44618
45866
|
};
|
|
44619
45867
|
}
|
|
44620
45868
|
|
|
44621
|
-
/**
|
|
44622
|
-
* A behavior that unsets the Default property of
|
|
44623
|
-
* sequence flow source on element delete, if the
|
|
44624
|
-
* removed element is the Gateway or Task's default flow.
|
|
44625
|
-
*
|
|
44626
|
-
* @param {EventBus} eventBus
|
|
44627
|
-
* @param {Modeling} modeling
|
|
44628
|
-
*/
|
|
44629
|
-
function DeleteSequenceFlowBehavior(eventBus, modeling) {
|
|
44630
|
-
|
|
44631
|
-
CommandInterceptor.call(this, eventBus);
|
|
44632
|
-
|
|
44633
|
-
|
|
44634
|
-
this.preExecute('connection.delete', function(event) {
|
|
44635
|
-
var context = event.context,
|
|
44636
|
-
connection = context.connection,
|
|
44637
|
-
source = connection.source;
|
|
44638
|
-
|
|
44639
|
-
if (isDefaultFlow(connection, source)) {
|
|
44640
|
-
modeling.updateProperties(source, {
|
|
44641
|
-
'default': null
|
|
44642
|
-
});
|
|
44643
|
-
}
|
|
44644
|
-
});
|
|
44645
|
-
}
|
|
44646
|
-
|
|
44647
|
-
inherits$1(DeleteSequenceFlowBehavior, CommandInterceptor);
|
|
44648
|
-
|
|
44649
|
-
DeleteSequenceFlowBehavior.$inject = [
|
|
44650
|
-
'eventBus',
|
|
44651
|
-
'modeling'
|
|
44652
|
-
];
|
|
44653
|
-
|
|
44654
|
-
|
|
44655
|
-
// helpers //////////////////////
|
|
44656
|
-
|
|
44657
|
-
function isDefaultFlow(connection, source) {
|
|
44658
|
-
|
|
44659
|
-
if (!is$1(connection, 'bpmn:SequenceFlow')) {
|
|
44660
|
-
return false;
|
|
44661
|
-
}
|
|
44662
|
-
|
|
44663
|
-
var sourceBo = getBusinessObject(source),
|
|
44664
|
-
sequenceFlow = getBusinessObject(connection);
|
|
44665
|
-
|
|
44666
|
-
return sourceBo.get('default') === sequenceFlow;
|
|
44667
|
-
}
|
|
44668
|
-
|
|
44669
45869
|
var BehaviorModule = {
|
|
44670
45870
|
__init__: [
|
|
44671
45871
|
'adaptiveLabelPositioningBehavior',
|
|
@@ -44673,17 +45873,16 @@
|
|
|
44673
45873
|
'associationBehavior',
|
|
44674
45874
|
'attachEventBehavior',
|
|
44675
45875
|
'boundaryEventBehavior',
|
|
44676
|
-
'rootElementReferenceBehavior',
|
|
44677
45876
|
'createBehavior',
|
|
44678
|
-
'fixHoverBehavior',
|
|
44679
45877
|
'createDataObjectBehavior',
|
|
44680
45878
|
'createParticipantBehavior',
|
|
44681
|
-
'dataStoreBehavior',
|
|
44682
45879
|
'dataInputAssociationBehavior',
|
|
45880
|
+
'dataStoreBehavior',
|
|
44683
45881
|
'deleteLaneBehavior',
|
|
44684
45882
|
'detachEventBehavior',
|
|
44685
45883
|
'dropOnFlowBehavior',
|
|
44686
45884
|
'eventBasedGatewayBehavior',
|
|
45885
|
+
'fixHoverBehavior',
|
|
44687
45886
|
'groupBehavior',
|
|
44688
45887
|
'importDockingFix',
|
|
44689
45888
|
'isHorizontalFix',
|
|
@@ -44691,26 +45890,28 @@
|
|
|
44691
45890
|
'messageFlowBehavior',
|
|
44692
45891
|
'modelingFeedback',
|
|
44693
45892
|
'removeElementBehavior',
|
|
45893
|
+
'removeEmbeddedLabelBoundsBehavior',
|
|
44694
45894
|
'removeParticipantBehavior',
|
|
44695
45895
|
'replaceConnectionBehavior',
|
|
44696
45896
|
'replaceElementBehaviour',
|
|
44697
45897
|
'resizeBehavior',
|
|
44698
45898
|
'resizeLaneBehavior',
|
|
44699
|
-
'
|
|
45899
|
+
'rootElementReferenceBehavior',
|
|
44700
45900
|
'spaceToolBehavior',
|
|
45901
|
+
'subProcessPlaneBehavior',
|
|
44701
45902
|
'subProcessStartEventBehavior',
|
|
45903
|
+
'toggleCollapseConnectionBehaviour',
|
|
45904
|
+
'toggleElementCollapseBehaviour',
|
|
44702
45905
|
'unclaimIdBehavior',
|
|
44703
|
-
'
|
|
44704
|
-
'
|
|
45906
|
+
'updateFlowNodeRefsBehavior',
|
|
45907
|
+
'unsetDefaultFlowBehavior'
|
|
44705
45908
|
],
|
|
44706
45909
|
adaptiveLabelPositioningBehavior: [ 'type', AdaptiveLabelPositioningBehavior ],
|
|
44707
45910
|
appendBehavior: [ 'type', AppendBehavior ],
|
|
44708
45911
|
associationBehavior: [ 'type', AssociationBehavior ],
|
|
44709
45912
|
attachEventBehavior: [ 'type', AttachEventBehavior ],
|
|
44710
45913
|
boundaryEventBehavior: [ 'type', BoundaryEventBehavior ],
|
|
44711
|
-
rootElementReferenceBehavior: [ 'type', RootElementReferenceBehavior ],
|
|
44712
45914
|
createBehavior: [ 'type', CreateBehavior ],
|
|
44713
|
-
fixHoverBehavior: [ 'type', FixHoverBehavior ],
|
|
44714
45915
|
createDataObjectBehavior: [ 'type', CreateDataObjectBehavior ],
|
|
44715
45916
|
createParticipantBehavior: [ 'type', CreateParticipantBehavior ],
|
|
44716
45917
|
dataInputAssociationBehavior: [ 'type', DataInputAssociationBehavior ],
|
|
@@ -44719,24 +45920,29 @@
|
|
|
44719
45920
|
detachEventBehavior: [ 'type', DetachEventBehavior ],
|
|
44720
45921
|
dropOnFlowBehavior: [ 'type', DropOnFlowBehavior ],
|
|
44721
45922
|
eventBasedGatewayBehavior: [ 'type', EventBasedGatewayBehavior ],
|
|
45923
|
+
fixHoverBehavior: [ 'type', FixHoverBehavior ],
|
|
44722
45924
|
groupBehavior: [ 'type', GroupBehavior ],
|
|
44723
45925
|
importDockingFix: [ 'type', ImportDockingFix ],
|
|
44724
45926
|
isHorizontalFix: [ 'type', IsHorizontalFix ],
|
|
44725
45927
|
labelBehavior: [ 'type', LabelBehavior ],
|
|
44726
45928
|
messageFlowBehavior: [ 'type', MessageFlowBehavior ],
|
|
44727
45929
|
modelingFeedback: [ 'type', ModelingFeedback ],
|
|
44728
|
-
|
|
45930
|
+
removeElementBehavior: [ 'type', RemoveElementBehavior ],
|
|
45931
|
+
removeEmbeddedLabelBoundsBehavior: ['type', RemoveEmbeddedLabelBoundsBehavior ],
|
|
44729
45932
|
removeParticipantBehavior: [ 'type', RemoveParticipantBehavior ],
|
|
45933
|
+
replaceConnectionBehavior: [ 'type', ReplaceConnectionBehavior ],
|
|
44730
45934
|
replaceElementBehaviour: [ 'type', ReplaceElementBehaviour ],
|
|
44731
45935
|
resizeBehavior: [ 'type', ResizeBehavior ],
|
|
44732
45936
|
resizeLaneBehavior: [ 'type', ResizeLaneBehavior ],
|
|
44733
|
-
|
|
44734
|
-
toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
|
|
45937
|
+
rootElementReferenceBehavior: [ 'type', RootElementReferenceBehavior ],
|
|
44735
45938
|
spaceToolBehavior: [ 'type', SpaceToolBehavior ],
|
|
45939
|
+
subProcessPlaneBehavior: [ 'type', SubProcessPlaneBehavior ],
|
|
44736
45940
|
subProcessStartEventBehavior: [ 'type', SubProcessStartEventBehavior ],
|
|
45941
|
+
toggleCollapseConnectionBehaviour: [ 'type', ToggleCollapseConnectionBehaviour ],
|
|
45942
|
+
toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
|
|
44737
45943
|
unclaimIdBehavior: [ 'type', UnclaimIdBehavior ],
|
|
44738
|
-
|
|
44739
|
-
|
|
45944
|
+
unsetDefaultFlowBehavior: [ 'type', DeleteSequenceFlowBehavior ],
|
|
45945
|
+
updateFlowNodeRefsBehavior: [ 'type', UpdateFlowNodeRefsBehavior ]
|
|
44740
45946
|
};
|
|
44741
45947
|
|
|
44742
45948
|
function getBoundaryAttachment(position, targetBounds) {
|
|
@@ -45686,21 +46892,24 @@
|
|
|
45686
46892
|
eventBus.on('saveXML.start', HIGH_PRIORITY$6, orderDi);
|
|
45687
46893
|
|
|
45688
46894
|
function orderDi() {
|
|
45689
|
-
var
|
|
45690
|
-
rootDi = getDi(root),
|
|
45691
|
-
elements,
|
|
45692
|
-
diElements;
|
|
46895
|
+
var rootElements = canvas.getRootElements();
|
|
45693
46896
|
|
|
45694
|
-
|
|
46897
|
+
forEach(rootElements, function(root) {
|
|
46898
|
+
var rootDi = getDi(root),
|
|
46899
|
+
elements,
|
|
46900
|
+
diElements;
|
|
45695
46901
|
|
|
45696
|
-
|
|
45697
|
-
|
|
45698
|
-
|
|
45699
|
-
|
|
46902
|
+
elements = selfAndAllChildren([ root ], false);
|
|
46903
|
+
|
|
46904
|
+
// only bpmndi:Shape and bpmndi:Edge can be direct children of bpmndi:Plane
|
|
46905
|
+
elements = filter(elements, function(element) {
|
|
46906
|
+
return element !== root && !element.labelTarget;
|
|
46907
|
+
});
|
|
45700
46908
|
|
|
45701
|
-
|
|
46909
|
+
diElements = map$1(elements, getDi);
|
|
45702
46910
|
|
|
45703
|
-
|
|
46911
|
+
rootDi.set('planeElement', diElements);
|
|
46912
|
+
});
|
|
45704
46913
|
}
|
|
45705
46914
|
}
|
|
45706
46915
|
|
|
@@ -45834,7 +47043,7 @@
|
|
|
45834
47043
|
level: 9,
|
|
45835
47044
|
containers: [
|
|
45836
47045
|
'bpmn:Collaboration',
|
|
45837
|
-
'bpmn:
|
|
47046
|
+
'bpmn:FlowElementsContainer'
|
|
45838
47047
|
]
|
|
45839
47048
|
}
|
|
45840
47049
|
},
|
|
@@ -45862,7 +47071,7 @@
|
|
|
45862
47071
|
level: 10,
|
|
45863
47072
|
containers: [
|
|
45864
47073
|
'bpmn:Collaboration',
|
|
45865
|
-
'bpmn:
|
|
47074
|
+
'bpmn:FlowElementsContainer'
|
|
45866
47075
|
]
|
|
45867
47076
|
}
|
|
45868
47077
|
},
|
|
@@ -45923,7 +47132,7 @@
|
|
|
45923
47132
|
// render labels always on top
|
|
45924
47133
|
if (element.labelTarget) {
|
|
45925
47134
|
return {
|
|
45926
|
-
parent: canvas.getRootElement(),
|
|
47135
|
+
parent: canvas.findRoot(element.labelTarget) || canvas.getRootElement(),
|
|
45927
47136
|
index: -1
|
|
45928
47137
|
};
|
|
45929
47138
|
}
|
|
@@ -48407,6 +49616,10 @@
|
|
|
48407
49616
|
};
|
|
48408
49617
|
|
|
48409
49618
|
BpmnFactory.prototype._ensureId = function(element) {
|
|
49619
|
+
if (element.id) {
|
|
49620
|
+
this._model.ids.claim(element.id, element);
|
|
49621
|
+
return;
|
|
49622
|
+
}
|
|
48410
49623
|
|
|
48411
49624
|
// generate semantic ids for elements
|
|
48412
49625
|
// bpmn:SequenceFlow -> SequenceFlow_ID
|
|
@@ -48477,7 +49690,7 @@
|
|
|
48477
49690
|
BpmnFactory.prototype.createDiEdge = function(semantic, attrs) {
|
|
48478
49691
|
return this.create('bpmndi:BPMNEdge', assign({
|
|
48479
49692
|
bpmnElement: semantic,
|
|
48480
|
-
|
|
49693
|
+
waypoint: this.createDiWaypoints([])
|
|
48481
49694
|
}, attrs));
|
|
48482
49695
|
};
|
|
48483
49696
|
|
|
@@ -48805,7 +50018,18 @@
|
|
|
48805
50018
|
|
|
48806
50019
|
BpmnUpdater.prototype.updateBounds = function(shape) {
|
|
48807
50020
|
|
|
48808
|
-
var di = getDi(shape)
|
|
50021
|
+
var di = getDi(shape),
|
|
50022
|
+
embeddedLabelBounds = getEmbeddedLabelBounds(shape);
|
|
50023
|
+
|
|
50024
|
+
// update embedded label bounds if possible
|
|
50025
|
+
if (embeddedLabelBounds) {
|
|
50026
|
+
var embeddedLabelBoundsDelta = delta(embeddedLabelBounds, di.get('bounds'));
|
|
50027
|
+
|
|
50028
|
+
assign(embeddedLabelBounds, {
|
|
50029
|
+
x: shape.x + embeddedLabelBoundsDelta.x,
|
|
50030
|
+
y: shape.y + embeddedLabelBoundsDelta.y
|
|
50031
|
+
});
|
|
50032
|
+
}
|
|
48809
50033
|
|
|
48810
50034
|
var target = (shape instanceof Label) ? this._getLabel(di) : di;
|
|
48811
50035
|
|
|
@@ -49180,6 +50404,33 @@
|
|
|
49180
50404
|
};
|
|
49181
50405
|
}
|
|
49182
50406
|
|
|
50407
|
+
/**
|
|
50408
|
+
* Return dc:Bounds of bpmndi:BPMNLabel if exists.
|
|
50409
|
+
*
|
|
50410
|
+
* @param {djs.model.shape} shape
|
|
50411
|
+
*
|
|
50412
|
+
* @returns {Object|undefined}
|
|
50413
|
+
*/
|
|
50414
|
+
function getEmbeddedLabelBounds(shape) {
|
|
50415
|
+
if (!is$1(shape, 'bpmn:Activity')) {
|
|
50416
|
+
return;
|
|
50417
|
+
}
|
|
50418
|
+
|
|
50419
|
+
var di = getDi(shape);
|
|
50420
|
+
|
|
50421
|
+
if (!di) {
|
|
50422
|
+
return;
|
|
50423
|
+
}
|
|
50424
|
+
|
|
50425
|
+
var label = di.get('label');
|
|
50426
|
+
|
|
50427
|
+
if (!label) {
|
|
50428
|
+
return;
|
|
50429
|
+
}
|
|
50430
|
+
|
|
50431
|
+
return label.get('bounds');
|
|
50432
|
+
}
|
|
50433
|
+
|
|
49183
50434
|
/**
|
|
49184
50435
|
* A bpmn-aware factory for diagram-js shapes
|
|
49185
50436
|
*/
|
|
@@ -49266,6 +50517,10 @@
|
|
|
49266
50517
|
applyAttribute(di, attrs, 'isExpanded');
|
|
49267
50518
|
}
|
|
49268
50519
|
|
|
50520
|
+
if (is$1(businessObject, 'bpmn:SubProcess')) {
|
|
50521
|
+
attrs.collapsed = !isExpanded(businessObject, di);
|
|
50522
|
+
}
|
|
50523
|
+
|
|
49269
50524
|
if (is$1(businessObject, 'bpmn:ExclusiveGateway')) {
|
|
49270
50525
|
di.isMarkerVisible = true;
|
|
49271
50526
|
}
|
|
@@ -49637,7 +50892,11 @@
|
|
|
49637
50892
|
}
|
|
49638
50893
|
});
|
|
49639
50894
|
|
|
49640
|
-
var
|
|
50895
|
+
var visibleElements = filter(elements, function(element) {
|
|
50896
|
+
return !element.hidden;
|
|
50897
|
+
});
|
|
50898
|
+
|
|
50899
|
+
var bbox = getBBox(visibleElements);
|
|
49641
50900
|
|
|
49642
50901
|
// center elements around position
|
|
49643
50902
|
forEach(elements, function(element) {
|
|
@@ -52082,7 +53341,8 @@
|
|
|
52082
53341
|
diPlane = getDi(oldRoot);
|
|
52083
53342
|
|
|
52084
53343
|
// (1) replace process old <> new root
|
|
52085
|
-
canvas.setRootElement(newRoot
|
|
53344
|
+
canvas.setRootElement(newRoot);
|
|
53345
|
+
canvas.removeRootElement(oldRoot);
|
|
52086
53346
|
|
|
52087
53347
|
// (2) update root elements
|
|
52088
53348
|
add(bpmnDefinitions.rootElements, newRootBusinessObject);
|
|
@@ -52116,7 +53376,8 @@
|
|
|
52116
53376
|
diPlane = getDi(newRoot);
|
|
52117
53377
|
|
|
52118
53378
|
// (1) replace process old <> new root
|
|
52119
|
-
canvas.setRootElement(oldRoot
|
|
53379
|
+
canvas.setRootElement(oldRoot);
|
|
53380
|
+
canvas.removeRootElement(newRoot);
|
|
52120
53381
|
|
|
52121
53382
|
// (2) update root elements
|
|
52122
53383
|
remove(bpmnDefinitions.rootElements, newRootBusinessObject);
|
|
@@ -52686,12 +53947,26 @@
|
|
|
52686
53947
|
// TODO @barmac: remove once we drop bpmn.io properties
|
|
52687
53948
|
ensureLegacySupport(assignedDi);
|
|
52688
53949
|
|
|
52689
|
-
|
|
52690
|
-
|
|
52691
|
-
|
|
52692
|
-
|
|
52693
|
-
|
|
52694
|
-
|
|
53950
|
+
if (element.labelTarget) {
|
|
53951
|
+
|
|
53952
|
+
// set label colors as bpmndi:BPMNLabel#color
|
|
53953
|
+
self._commandStack.execute('element.updateModdleProperties', {
|
|
53954
|
+
element: element,
|
|
53955
|
+
moddleElement: getDi(element).label,
|
|
53956
|
+
properties: {
|
|
53957
|
+
color: di['background-color']
|
|
53958
|
+
}
|
|
53959
|
+
});
|
|
53960
|
+
} else {
|
|
53961
|
+
|
|
53962
|
+
// set colors bpmndi:BPMNEdge or bpmndi:BPMNShape
|
|
53963
|
+
self._commandStack.execute('element.updateProperties', {
|
|
53964
|
+
element: element,
|
|
53965
|
+
properties: {
|
|
53966
|
+
di: assignedDi
|
|
53967
|
+
}
|
|
53968
|
+
});
|
|
53969
|
+
}
|
|
52695
53970
|
});
|
|
52696
53971
|
|
|
52697
53972
|
};
|
|
@@ -52754,7 +54029,30 @@
|
|
|
52754
54029
|
/**
|
|
52755
54030
|
* A handler that updates the text of a BPMN element.
|
|
52756
54031
|
*/
|
|
52757
|
-
function UpdateLabelHandler(modeling, textRenderer) {
|
|
54032
|
+
function UpdateLabelHandler(modeling, textRenderer, bpmnFactory) {
|
|
54033
|
+
|
|
54034
|
+
/**
|
|
54035
|
+
* Creates an empty `diLabel` attribute for embedded labels.
|
|
54036
|
+
*
|
|
54037
|
+
* @param {djs.model.Base} element
|
|
54038
|
+
* @param {string} text
|
|
54039
|
+
*/
|
|
54040
|
+
function ensureInternalLabelDi(element, text) {
|
|
54041
|
+
if (isLabelExternal(element)) {
|
|
54042
|
+
return;
|
|
54043
|
+
}
|
|
54044
|
+
|
|
54045
|
+
var di = getDi(element);
|
|
54046
|
+
|
|
54047
|
+
if (text && !di.label) {
|
|
54048
|
+
di.label = bpmnFactory.create('bpmndi:BPMNLabel');
|
|
54049
|
+
}
|
|
54050
|
+
|
|
54051
|
+
if (!text && di.label) {
|
|
54052
|
+
di.label = null;
|
|
54053
|
+
}
|
|
54054
|
+
}
|
|
54055
|
+
|
|
52758
54056
|
|
|
52759
54057
|
/**
|
|
52760
54058
|
* Set the label and return the changed elements.
|
|
@@ -52773,6 +54071,8 @@
|
|
|
52773
54071
|
|
|
52774
54072
|
setLabel(label, text);
|
|
52775
54073
|
|
|
54074
|
+
ensureInternalLabelDi(element, text);
|
|
54075
|
+
|
|
52776
54076
|
return [ label, labelTarget ];
|
|
52777
54077
|
}
|
|
52778
54078
|
|
|
@@ -52858,7 +54158,8 @@
|
|
|
52858
54158
|
|
|
52859
54159
|
UpdateLabelHandler.$inject = [
|
|
52860
54160
|
'modeling',
|
|
52861
|
-
'textRenderer'
|
|
54161
|
+
'textRenderer',
|
|
54162
|
+
'bpmnFactory'
|
|
52862
54163
|
];
|
|
52863
54164
|
|
|
52864
54165
|
|
|
@@ -55903,7 +57204,7 @@
|
|
|
55903
57204
|
|
|
55904
57205
|
create.start(event, [ subProcess, startEvent ], {
|
|
55905
57206
|
hints: {
|
|
55906
|
-
autoSelect: [
|
|
57207
|
+
autoSelect: [ subProcess ]
|
|
55907
57208
|
}
|
|
55908
57209
|
});
|
|
55909
57210
|
}
|