bpmn-js 8.8.3 → 9.0.0-alpha.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 +14 -0
- package/dist/assets/bpmn-js.css +105 -0
- package/dist/assets/diagram-js.css +80 -78
- package/dist/bpmn-modeler.development.js +1249 -692
- package/dist/bpmn-modeler.production.min.js +9 -8
- package/dist/bpmn-navigated-viewer.development.js +20684 -19981
- package/dist/bpmn-navigated-viewer.production.min.js +22 -20
- package/dist/bpmn-viewer.development.js +19885 -19182
- package/dist/bpmn-viewer.production.min.js +22 -20
- package/lib/BaseViewer.js +0 -13
- package/lib/Viewer.js +3 -1
- package/lib/draw/BpmnRenderUtil.js +6 -4
- package/lib/features/context-pad/ContextPadProvider.js +1 -1
- package/lib/features/copy-paste/BpmnCopyPaste.js +13 -13
- package/lib/features/di-ordering/BpmnDiOrdering.js +2 -3
- package/lib/features/drilldown/DrilldownCentering.js +114 -0
- package/lib/features/drilldown/DrilldownOverlays.js +113 -0
- package/lib/features/drilldown/SubprocessCompatibility.js +193 -0
- package/lib/features/drilldown/index.js +14 -0
- package/lib/features/label-editing/LabelEditingPreview.js +3 -3
- package/lib/features/label-editing/LabelEditingProvider.js +1 -1
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +2 -1
- package/lib/features/modeling/BpmnFactory.js +8 -8
- package/lib/features/modeling/BpmnUpdater.js +35 -27
- package/lib/features/modeling/ElementFactory.js +64 -37
- package/lib/features/modeling/behavior/DataStoreBehavior.js +3 -1
- package/lib/features/modeling/behavior/IsHorizontalFix.js +7 -4
- package/lib/features/modeling/behavior/LabelBehavior.js +8 -7
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +6 -6
- package/lib/features/modeling/cmd/SetColorHandler.js +23 -6
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +12 -8
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +19 -12
- package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +5 -3
- package/lib/features/modeling/util/ModelingUtil.js +2 -20
- package/lib/features/palette/PaletteProvider.js +4 -2
- package/lib/features/popup-menu/ReplaceMenuProvider.js +5 -5
- package/lib/features/popup-menu/util/TypeUtil.js +1 -1
- package/lib/features/replace/BpmnReplace.js +29 -29
- package/lib/import/BpmnImporter.js +27 -22
- package/lib/import/BpmnTreeWalker.js +19 -17
- package/lib/import/Importer.js +25 -6
- package/lib/util/CompatibilityUtil.js +21 -1
- package/lib/util/DiUtil.js +10 -3
- package/lib/util/LabelUtil.js +2 -3
- package/lib/util/ModelUtil.js +30 -0
- package/package.json +2 -2
- package/test/matchers/BoundsMatchers.js +10 -10
- package/test/matchers/ConnectionMatchers.js +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-modeler
|
|
2
|
+
* bpmn-js - bpmn-modeler v9.0.0-alpha.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-01-11
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -4364,7 +4364,6 @@
|
|
|
4364
4364
|
}
|
|
4365
4365
|
|
|
4366
4366
|
var BASE_LAYER = 'base';
|
|
4367
|
-
var HIDDEN_MARKER = 'djs-element-hidden';
|
|
4368
4367
|
|
|
4369
4368
|
// render plane contents behind utility layers
|
|
4370
4369
|
var PLANE_LAYER_INDEX = 0;
|
|
@@ -4395,6 +4394,12 @@
|
|
|
4395
4394
|
this._elementRegistry = elementRegistry;
|
|
4396
4395
|
this._graphicsFactory = graphicsFactory;
|
|
4397
4396
|
|
|
4397
|
+
this._rootsIdx = 0;
|
|
4398
|
+
|
|
4399
|
+
this._layers = {};
|
|
4400
|
+
this._planes = [];
|
|
4401
|
+
this._rootElement = null;
|
|
4402
|
+
|
|
4398
4403
|
this._init(config || {});
|
|
4399
4404
|
}
|
|
4400
4405
|
|
|
@@ -4432,9 +4437,6 @@
|
|
|
4432
4437
|
|
|
4433
4438
|
var viewport = this._viewport = createGroup(svg, 'viewport');
|
|
4434
4439
|
|
|
4435
|
-
this._layers = {};
|
|
4436
|
-
this._planes = {};
|
|
4437
|
-
|
|
4438
4440
|
// debounce canvas.viewbox.changed events
|
|
4439
4441
|
// for smoother diagram interaction
|
|
4440
4442
|
if (config.deferUpdate !== false) {
|
|
@@ -4469,7 +4471,7 @@
|
|
|
4469
4471
|
'shape.removed',
|
|
4470
4472
|
'connection.removed',
|
|
4471
4473
|
'elements.changed',
|
|
4472
|
-
'
|
|
4474
|
+
'root.set'
|
|
4473
4475
|
], function() {
|
|
4474
4476
|
delete this._cachedViewbox;
|
|
4475
4477
|
}, this);
|
|
@@ -4494,7 +4496,7 @@
|
|
|
4494
4496
|
delete this._container;
|
|
4495
4497
|
delete this._layers;
|
|
4496
4498
|
delete this._planes;
|
|
4497
|
-
delete this.
|
|
4499
|
+
delete this._rootElement;
|
|
4498
4500
|
delete this._viewport;
|
|
4499
4501
|
};
|
|
4500
4502
|
|
|
@@ -4509,15 +4511,15 @@
|
|
|
4509
4511
|
var type = getType(element);
|
|
4510
4512
|
|
|
4511
4513
|
if (type === 'root') {
|
|
4512
|
-
self.
|
|
4514
|
+
self.removeRootElement(element);
|
|
4513
4515
|
} else {
|
|
4514
4516
|
self._removeElement(element, type);
|
|
4515
4517
|
}
|
|
4516
4518
|
});
|
|
4517
4519
|
|
|
4518
4520
|
// remove all planes
|
|
4519
|
-
this.
|
|
4520
|
-
this.
|
|
4521
|
+
this._planes = [];
|
|
4522
|
+
this._rootElement = null;
|
|
4521
4523
|
|
|
4522
4524
|
// force recomputation of view box
|
|
4523
4525
|
delete this._cachedViewbox;
|
|
@@ -4598,94 +4600,16 @@
|
|
|
4598
4600
|
|
|
4599
4601
|
};
|
|
4600
4602
|
|
|
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
|
-
|
|
4668
|
-
if (typeof plane === 'string') {
|
|
4669
|
-
plane = this.getPlane(plane);
|
|
4670
|
-
}
|
|
4671
4603
|
|
|
4672
|
-
|
|
4673
|
-
if (this._activePlane) {
|
|
4674
|
-
classes(this._activePlane.layer).add(HIDDEN_MARKER);
|
|
4675
|
-
}
|
|
4604
|
+
Canvas.prototype._removeLayer = function(name) {
|
|
4676
4605
|
|
|
4677
|
-
|
|
4606
|
+
var layer = this._layers[name];
|
|
4678
4607
|
|
|
4679
|
-
|
|
4680
|
-
|
|
4608
|
+
if (layer) {
|
|
4609
|
+
delete this._layers[name];
|
|
4681
4610
|
|
|
4682
|
-
|
|
4683
|
-
this._elementRegistry.updateGraphics(plane.rootElement, this._svg, true);
|
|
4611
|
+
remove$1(layer.group);
|
|
4684
4612
|
}
|
|
4685
|
-
|
|
4686
|
-
this._eventBus.fire('plane.set', { plane: plane });
|
|
4687
|
-
|
|
4688
|
-
return plane;
|
|
4689
4613
|
};
|
|
4690
4614
|
|
|
4691
4615
|
/**
|
|
@@ -4693,45 +4617,52 @@
|
|
|
4693
4617
|
*
|
|
4694
4618
|
* @returns {SVGElement}
|
|
4695
4619
|
*/
|
|
4696
|
-
|
|
4697
4620
|
Canvas.prototype.getActiveLayer = function() {
|
|
4698
|
-
return this.
|
|
4621
|
+
return this._findPlaneForRoot(this.getRootElement()).layer;
|
|
4699
4622
|
};
|
|
4700
4623
|
|
|
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
|
-
if (!plane) {
|
|
4709
|
-
plane = this.createPlane(BASE_LAYER);
|
|
4710
|
-
this.setActivePlane(BASE_LAYER);
|
|
4711
|
-
}
|
|
4712
|
-
|
|
4713
|
-
return plane;
|
|
4714
|
-
};
|
|
4715
4624
|
|
|
4716
4625
|
/**
|
|
4717
4626
|
* Returns the plane which contains the given element.
|
|
4718
4627
|
*
|
|
4719
4628
|
* @param {string|djs.model.Base} element
|
|
4720
4629
|
*
|
|
4721
|
-
* @return {
|
|
4630
|
+
* @return {djs.model.Base} root for element
|
|
4722
4631
|
*/
|
|
4723
|
-
Canvas.prototype.
|
|
4632
|
+
Canvas.prototype.findRoot = function(element) {
|
|
4724
4633
|
if (typeof element === 'string') {
|
|
4725
4634
|
element = this._elementRegistry.get(element);
|
|
4726
4635
|
}
|
|
4727
4636
|
|
|
4728
|
-
|
|
4637
|
+
if (!element) {
|
|
4638
|
+
return;
|
|
4639
|
+
}
|
|
4640
|
+
|
|
4641
|
+
var plane = this._findPlaneForRoot(
|
|
4642
|
+
findRoot(element)
|
|
4643
|
+
) || {};
|
|
4644
|
+
|
|
4645
|
+
return plane.rootElement;
|
|
4646
|
+
};
|
|
4729
4647
|
|
|
4648
|
+
/**
|
|
4649
|
+
* Return a list of all root elements on the diagram.
|
|
4650
|
+
*
|
|
4651
|
+
* @return {djs.model.Root[]}
|
|
4652
|
+
*/
|
|
4653
|
+
Canvas.prototype.getRootElements = function() {
|
|
4654
|
+
return this._planes.map(function(plane) {
|
|
4655
|
+
return plane.rootElement;
|
|
4656
|
+
});
|
|
4657
|
+
};
|
|
4658
|
+
|
|
4659
|
+
Canvas.prototype._findPlaneForRoot = function(rootElement) {
|
|
4730
4660
|
return find(this._planes, function(plane) {
|
|
4731
|
-
return plane.rootElement ===
|
|
4661
|
+
return plane.rootElement === rootElement;
|
|
4732
4662
|
});
|
|
4733
4663
|
};
|
|
4734
4664
|
|
|
4665
|
+
|
|
4735
4666
|
/**
|
|
4736
4667
|
* Returns the html element that encloses the
|
|
4737
4668
|
* drawing canvas.
|
|
@@ -4852,95 +4783,189 @@
|
|
|
4852
4783
|
}
|
|
4853
4784
|
};
|
|
4854
4785
|
|
|
4786
|
+
/**
|
|
4787
|
+
* Returns the current root element.
|
|
4788
|
+
*
|
|
4789
|
+
* @returns {Object|djs.model.Root} rootElement.
|
|
4790
|
+
*/
|
|
4855
4791
|
Canvas.prototype.getRootElement = function() {
|
|
4856
|
-
var
|
|
4792
|
+
var rootElement = this._rootElement;
|
|
4857
4793
|
|
|
4858
|
-
|
|
4794
|
+
if (rootElement) {
|
|
4795
|
+
return rootElement;
|
|
4796
|
+
}
|
|
4797
|
+
|
|
4798
|
+
return this.setRootElement(this.addRootElement(null));
|
|
4859
4799
|
};
|
|
4860
4800
|
|
|
4801
|
+
/**
|
|
4802
|
+
* Adds a given root element and returns it.
|
|
4803
|
+
*
|
|
4804
|
+
* @param {Object|djs.model.Root} rootElement
|
|
4805
|
+
*
|
|
4806
|
+
* @return {Object|djs.model.Root} rootElement
|
|
4807
|
+
*/
|
|
4861
4808
|
|
|
4809
|
+
Canvas.prototype.addRootElement = function(rootElement) {
|
|
4810
|
+
var idx = this._rootsIdx++;
|
|
4862
4811
|
|
|
4863
|
-
|
|
4812
|
+
if (!rootElement) {
|
|
4813
|
+
rootElement = {
|
|
4814
|
+
id: '__implicitroot_' + idx,
|
|
4815
|
+
children: [],
|
|
4816
|
+
isImplicit: true
|
|
4817
|
+
};
|
|
4818
|
+
}
|
|
4819
|
+
|
|
4820
|
+
var layerName = rootElement.layer = 'root-' + idx;
|
|
4821
|
+
|
|
4822
|
+
this._ensureValid('root', rootElement);
|
|
4823
|
+
|
|
4824
|
+
var layer = this.getLayer(layerName, PLANE_LAYER_INDEX);
|
|
4825
|
+
|
|
4826
|
+
attr(layer, 'display', 'none');
|
|
4827
|
+
|
|
4828
|
+
this._addRoot(rootElement, layer);
|
|
4829
|
+
|
|
4830
|
+
this._planes.push({
|
|
4831
|
+
rootElement: rootElement,
|
|
4832
|
+
layer: layer
|
|
4833
|
+
});
|
|
4834
|
+
|
|
4835
|
+
return rootElement;
|
|
4836
|
+
};
|
|
4864
4837
|
|
|
4865
4838
|
/**
|
|
4866
|
-
*
|
|
4867
|
-
* and returns the new root element.
|
|
4839
|
+
* Removes a given rootElement and returns it.
|
|
4868
4840
|
*
|
|
4869
|
-
* @param {
|
|
4870
|
-
* @param {boolean} [override] whether to override the current root element, if any
|
|
4841
|
+
* @param {djs.model.Root|String} rootElement
|
|
4871
4842
|
*
|
|
4872
|
-
* @return {Object|djs.model.Root}
|
|
4843
|
+
* @return {Object|djs.model.Root} rootElement
|
|
4873
4844
|
*/
|
|
4874
|
-
Canvas.prototype.
|
|
4875
|
-
var activePlane = this._activePlane;
|
|
4845
|
+
Canvas.prototype.removeRootElement = function(rootElement) {
|
|
4876
4846
|
|
|
4877
|
-
if (
|
|
4878
|
-
|
|
4879
|
-
}
|
|
4880
|
-
var basePlane = this.createPlane(BASE_LAYER, element);
|
|
4847
|
+
if (typeof rootElement === 'string') {
|
|
4848
|
+
rootElement = this._elementRegistry.get(rootElement);
|
|
4849
|
+
}
|
|
4881
4850
|
|
|
4882
|
-
|
|
4851
|
+
var plane = this._findPlaneForRoot(rootElement);
|
|
4883
4852
|
|
|
4884
|
-
|
|
4853
|
+
if (!plane) {
|
|
4854
|
+
return;
|
|
4885
4855
|
}
|
|
4856
|
+
|
|
4857
|
+
// hook up life-cycle events
|
|
4858
|
+
this._removeRoot(rootElement);
|
|
4859
|
+
|
|
4860
|
+
// cleanup layer
|
|
4861
|
+
this._removeLayer(rootElement.layer);
|
|
4862
|
+
|
|
4863
|
+
// clean up plane
|
|
4864
|
+
this._planes = this._planes.filter(function(plane) {
|
|
4865
|
+
return plane.rootElement !== rootElement;
|
|
4866
|
+
});
|
|
4867
|
+
|
|
4868
|
+
return rootElement;
|
|
4886
4869
|
};
|
|
4887
4870
|
|
|
4888
4871
|
|
|
4872
|
+
// root element handling //////////////////////
|
|
4873
|
+
|
|
4889
4874
|
/**
|
|
4890
4875
|
* Sets a given element as the new root element for the canvas
|
|
4891
4876
|
* and returns the new root element.
|
|
4892
4877
|
*
|
|
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
|
|
4878
|
+
* @param {Object|djs.model.Root} rootElement
|
|
4896
4879
|
*
|
|
4897
4880
|
* @return {Object|djs.model.Root} new root element
|
|
4898
4881
|
*/
|
|
4899
|
-
Canvas.prototype.
|
|
4882
|
+
Canvas.prototype.setRootElement = function(rootElement, override) {
|
|
4900
4883
|
|
|
4901
|
-
if (
|
|
4902
|
-
|
|
4884
|
+
if (isDefined(override)) {
|
|
4885
|
+
throw new Error('override not supported');
|
|
4903
4886
|
}
|
|
4904
4887
|
|
|
4905
|
-
if (
|
|
4906
|
-
|
|
4888
|
+
if (rootElement === this._rootElement) {
|
|
4889
|
+
return;
|
|
4907
4890
|
}
|
|
4908
4891
|
|
|
4909
|
-
var
|
|
4910
|
-
elementRegistry = this._elementRegistry,
|
|
4911
|
-
eventBus = this._eventBus;
|
|
4892
|
+
var plane;
|
|
4912
4893
|
|
|
4913
|
-
if (
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
}
|
|
4894
|
+
if (!rootElement) {
|
|
4895
|
+
throw new Error('rootElement required');
|
|
4896
|
+
}
|
|
4917
4897
|
|
|
4918
|
-
|
|
4919
|
-
eventBus.fire('root.remove', { element: currentRoot });
|
|
4920
|
-
eventBus.fire('root.removed', { element: currentRoot });
|
|
4898
|
+
plane = this._findPlaneForRoot(rootElement);
|
|
4921
4899
|
|
|
4922
|
-
|
|
4900
|
+
// give set add semantics for backwards compatibility
|
|
4901
|
+
if (!plane) {
|
|
4902
|
+
rootElement = this.addRootElement(rootElement);
|
|
4923
4903
|
}
|
|
4924
4904
|
|
|
4925
|
-
|
|
4926
|
-
|
|
4905
|
+
this._setRoot(rootElement);
|
|
4906
|
+
|
|
4907
|
+
return rootElement;
|
|
4908
|
+
};
|
|
4909
|
+
|
|
4910
|
+
|
|
4911
|
+
Canvas.prototype._removeRoot = function(element) {
|
|
4912
|
+
var elementRegistry = this._elementRegistry,
|
|
4913
|
+
eventBus = this._eventBus;
|
|
4914
|
+
|
|
4915
|
+
// simulate element remove event sequence
|
|
4916
|
+
eventBus.fire('root.remove', { element: element });
|
|
4917
|
+
eventBus.fire('root.removed', { element: element });
|
|
4918
|
+
|
|
4919
|
+
elementRegistry.remove(element);
|
|
4920
|
+
};
|
|
4921
|
+
|
|
4922
|
+
|
|
4923
|
+
Canvas.prototype._addRoot = function(element, gfx) {
|
|
4924
|
+
var elementRegistry = this._elementRegistry,
|
|
4925
|
+
eventBus = this._eventBus;
|
|
4926
|
+
|
|
4927
|
+
// resemble element add event sequence
|
|
4928
|
+
eventBus.fire('root.add', { element: element });
|
|
4929
|
+
|
|
4930
|
+
elementRegistry.add(element, gfx);
|
|
4931
|
+
|
|
4932
|
+
eventBus.fire('root.added', { element: element, gfx: gfx });
|
|
4933
|
+
};
|
|
4927
4934
|
|
|
4928
|
-
// resemble element add event sequence
|
|
4929
|
-
eventBus.fire('root.add', { element: element });
|
|
4930
4935
|
|
|
4931
|
-
|
|
4936
|
+
Canvas.prototype._setRoot = function(rootElement, layer) {
|
|
4932
4937
|
|
|
4933
|
-
|
|
4938
|
+
var currentRoot = this._rootElement;
|
|
4934
4939
|
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4940
|
+
var currentLayer;
|
|
4941
|
+
|
|
4942
|
+
if (currentRoot) {
|
|
4943
|
+
|
|
4944
|
+
// un-associate previous root element <svg>
|
|
4945
|
+
this._elementRegistry.updateGraphics(currentRoot, null, true);
|
|
4946
|
+
|
|
4947
|
+
// hide previous layer
|
|
4948
|
+
currentLayer = this._findPlaneForRoot(currentRoot).layer;
|
|
4949
|
+
|
|
4950
|
+
attr(currentLayer, 'display', 'none');
|
|
4951
|
+
}
|
|
4952
|
+
|
|
4953
|
+
if (rootElement) {
|
|
4954
|
+
|
|
4955
|
+
if (!layer) {
|
|
4956
|
+
layer = this._findPlaneForRoot(rootElement).layer;
|
|
4938
4957
|
}
|
|
4958
|
+
|
|
4959
|
+
// associate element with <svg>
|
|
4960
|
+
this._elementRegistry.updateGraphics(rootElement, this._svg, true);
|
|
4961
|
+
|
|
4962
|
+
// show root layer
|
|
4963
|
+
attr(layer, 'display', null);
|
|
4939
4964
|
}
|
|
4940
4965
|
|
|
4941
|
-
|
|
4966
|
+
this._rootElement = rootElement;
|
|
4942
4967
|
|
|
4943
|
-
|
|
4968
|
+
this._eventBus.fire('root.set', { element: rootElement });
|
|
4944
4969
|
};
|
|
4945
4970
|
|
|
4946
4971
|
// add functionality //////////////////////
|
|
@@ -4951,7 +4976,7 @@
|
|
|
4951
4976
|
}
|
|
4952
4977
|
|
|
4953
4978
|
if (this._elementRegistry.get(element.id)) {
|
|
4954
|
-
throw new Error('element
|
|
4979
|
+
throw new Error('element <' + element.id + '> already exists');
|
|
4955
4980
|
}
|
|
4956
4981
|
|
|
4957
4982
|
var requiredAttrs = REQUIRED_MODEL_ATTRS[type];
|
|
@@ -5241,6 +5266,7 @@
|
|
|
5241
5266
|
innerBox,
|
|
5242
5267
|
outerBox = this.getSize(),
|
|
5243
5268
|
matrix,
|
|
5269
|
+
activeLayer,
|
|
5244
5270
|
transform,
|
|
5245
5271
|
scale,
|
|
5246
5272
|
x, y;
|
|
@@ -5248,10 +5274,11 @@
|
|
|
5248
5274
|
if (!box) {
|
|
5249
5275
|
|
|
5250
5276
|
// compute the inner box based on the
|
|
5251
|
-
// diagrams active
|
|
5277
|
+
// diagrams active layer. This allows us to exclude
|
|
5252
5278
|
// external components, such as overlays
|
|
5253
5279
|
|
|
5254
|
-
|
|
5280
|
+
activeLayer = this._rootElement ? this.getActiveLayer() : null;
|
|
5281
|
+
innerBox = activeLayer && activeLayer.getBBox() || {};
|
|
5255
5282
|
|
|
5256
5283
|
transform = transform$1(viewport);
|
|
5257
5284
|
matrix = transform ? transform.matrix : createMatrix();
|
|
@@ -5323,17 +5350,22 @@
|
|
|
5323
5350
|
* Scrolls the viewbox to contain the given element.
|
|
5324
5351
|
* Optionally specify a padding to be applied to the edges.
|
|
5325
5352
|
*
|
|
5326
|
-
* @param {Object} [element] the element to scroll to.
|
|
5353
|
+
* @param {Object|String} [element] the element to scroll to.
|
|
5327
5354
|
* @param {Object|Number} [padding=100] the padding to be applied. Can also specify top, bottom, left and right.
|
|
5328
5355
|
*
|
|
5329
5356
|
*/
|
|
5330
5357
|
Canvas.prototype.scrollToElement = function(element, padding) {
|
|
5331
5358
|
var defaultPadding = 100;
|
|
5332
5359
|
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5360
|
+
if (typeof element === 'string') {
|
|
5361
|
+
element = this._elementRegistry.get(element);
|
|
5362
|
+
}
|
|
5363
|
+
|
|
5364
|
+
// set to correct rootElement
|
|
5365
|
+
var rootElement = this.findRoot(element);
|
|
5366
|
+
|
|
5367
|
+
if (rootElement !== this.getRootElement()) {
|
|
5368
|
+
this.setRootElement(rootElement);
|
|
5337
5369
|
}
|
|
5338
5370
|
|
|
5339
5371
|
if (!padding) {
|
|
@@ -5696,7 +5728,9 @@
|
|
|
5696
5728
|
container.gfx = gfx;
|
|
5697
5729
|
}
|
|
5698
5730
|
|
|
5699
|
-
|
|
5731
|
+
if (gfx) {
|
|
5732
|
+
attr(gfx, ELEMENT_ID, id);
|
|
5733
|
+
}
|
|
5700
5734
|
|
|
5701
5735
|
return gfx;
|
|
5702
5736
|
};
|
|
@@ -14945,10 +14979,74 @@
|
|
|
14945
14979
|
return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />';
|
|
14946
14980
|
}
|
|
14947
14981
|
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
|
|
14982
|
+
// TODO(nikku): remove with future bpmn-js version
|
|
14983
|
+
|
|
14984
|
+
/**
|
|
14985
|
+
* Wraps APIs to check:
|
|
14986
|
+
*
|
|
14987
|
+
* 1) If a callback is passed -> Warn users about callback deprecation.
|
|
14988
|
+
* 2) If Promise class is implemented in current environment.
|
|
14989
|
+
*
|
|
14990
|
+
* @private
|
|
14991
|
+
*/
|
|
14992
|
+
function wrapForCompatibility(api) {
|
|
14993
|
+
|
|
14994
|
+
return function() {
|
|
14995
|
+
|
|
14996
|
+
if (!window.Promise) {
|
|
14997
|
+
throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
|
|
14998
|
+
}
|
|
14999
|
+
|
|
15000
|
+
var argLen = arguments.length;
|
|
15001
|
+
if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
|
|
15002
|
+
|
|
15003
|
+
var callback = arguments[argLen - 1];
|
|
15004
|
+
|
|
15005
|
+
console.warn(new Error(
|
|
15006
|
+
'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
|
|
15007
|
+
'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
|
|
15008
|
+
));
|
|
15009
|
+
|
|
15010
|
+
var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
|
|
15011
|
+
|
|
15012
|
+
api.apply(this, argsWithoutCallback).then(function(result) {
|
|
15013
|
+
|
|
15014
|
+
var firstKey = Object.keys(result)[0];
|
|
15015
|
+
|
|
15016
|
+
// The APIs we are wrapping all resolve a single item depending on the API.
|
|
15017
|
+
// For instance, importXML resolves { warnings } and saveXML returns { xml }.
|
|
15018
|
+
// That's why we can call the callback with the first item of result.
|
|
15019
|
+
return callback(null, result[firstKey]);
|
|
15020
|
+
|
|
15021
|
+
// Passing a second paramter instead of catch because we don't want to
|
|
15022
|
+
// catch errors thrown by callback().
|
|
15023
|
+
}, function(err) {
|
|
15024
|
+
|
|
15025
|
+
return callback(err, err.warnings);
|
|
15026
|
+
});
|
|
15027
|
+
} else {
|
|
15028
|
+
|
|
15029
|
+
return api.apply(this, arguments);
|
|
15030
|
+
}
|
|
15031
|
+
};
|
|
15032
|
+
}
|
|
15033
|
+
|
|
15034
|
+
|
|
15035
|
+
// TODO(nikku): remove with future bpmn-js version
|
|
15036
|
+
|
|
15037
|
+
var DI_ERROR_MESSAGE = 'Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472';
|
|
15038
|
+
|
|
15039
|
+
function ensureCompatDiRef(businessObject) {
|
|
15040
|
+
|
|
15041
|
+
// bpmnElement can have multiple independent DIs
|
|
15042
|
+
if (!has(businessObject, 'di')) {
|
|
15043
|
+
Object.defineProperty(businessObject, 'di', {
|
|
15044
|
+
get: function() {
|
|
15045
|
+
throw new Error(DI_ERROR_MESSAGE);
|
|
15046
|
+
}
|
|
15047
|
+
});
|
|
15048
|
+
}
|
|
15049
|
+
}
|
|
14952
15050
|
|
|
14953
15051
|
/**
|
|
14954
15052
|
* Returns true if an element has the given meta-model type
|
|
@@ -14983,6 +15081,8 @@
|
|
|
14983
15081
|
// prerequisites are drawn
|
|
14984
15082
|
var deferred = [];
|
|
14985
15083
|
|
|
15084
|
+
var diMap = {};
|
|
15085
|
+
|
|
14986
15086
|
// Helpers //////////////////////
|
|
14987
15087
|
|
|
14988
15088
|
function contextual(fn, ctx) {
|
|
@@ -15011,17 +15111,17 @@
|
|
|
15011
15111
|
}
|
|
15012
15112
|
|
|
15013
15113
|
// call handler
|
|
15014
|
-
return handler.element(element, ctx);
|
|
15114
|
+
return handler.element(element, diMap[element.id], ctx);
|
|
15015
15115
|
}
|
|
15016
15116
|
|
|
15017
15117
|
function visitRoot(element, diagram) {
|
|
15018
|
-
return handler.root(element, diagram);
|
|
15118
|
+
return handler.root(element, diMap[element.id], diagram);
|
|
15019
15119
|
}
|
|
15020
15120
|
|
|
15021
15121
|
function visitIfDi(element, ctx) {
|
|
15022
15122
|
|
|
15023
15123
|
try {
|
|
15024
|
-
var gfx = element.
|
|
15124
|
+
var gfx = diMap[element.id] && visit(element, ctx);
|
|
15025
15125
|
|
|
15026
15126
|
handled(element);
|
|
15027
15127
|
|
|
@@ -15044,7 +15144,7 @@
|
|
|
15044
15144
|
var bpmnElement = di.bpmnElement;
|
|
15045
15145
|
|
|
15046
15146
|
if (bpmnElement) {
|
|
15047
|
-
if (bpmnElement.
|
|
15147
|
+
if (diMap[bpmnElement.id]) {
|
|
15048
15148
|
logError(
|
|
15049
15149
|
translate('multiple DI elements defined for {element}', {
|
|
15050
15150
|
element: elementToString(bpmnElement)
|
|
@@ -15052,8 +15152,9 @@
|
|
|
15052
15152
|
{ element: bpmnElement }
|
|
15053
15153
|
);
|
|
15054
15154
|
} else {
|
|
15055
|
-
|
|
15056
|
-
|
|
15155
|
+
diMap[bpmnElement.id] = di;
|
|
15156
|
+
|
|
15157
|
+
ensureCompatDiRef(bpmnElement);
|
|
15057
15158
|
}
|
|
15058
15159
|
} else {
|
|
15059
15160
|
logError(
|
|
@@ -15110,6 +15211,7 @@
|
|
|
15110
15211
|
}
|
|
15111
15212
|
|
|
15112
15213
|
// load DI from selected diagram only
|
|
15214
|
+
diMap = {};
|
|
15113
15215
|
handleDiagram(diagram);
|
|
15114
15216
|
|
|
15115
15217
|
|
|
@@ -15149,10 +15251,10 @@
|
|
|
15149
15251
|
|
|
15150
15252
|
var ctx = visitRoot(rootElement, plane);
|
|
15151
15253
|
|
|
15152
|
-
if (is$2(rootElement, 'bpmn:Process')) {
|
|
15254
|
+
if (is$2(rootElement, 'bpmn:Process') || is$2(rootElement, 'bpmn:SubProcess')) {
|
|
15153
15255
|
handleProcess(rootElement, ctx);
|
|
15154
15256
|
} else if (is$2(rootElement, 'bpmn:Collaboration')) {
|
|
15155
|
-
handleCollaboration(rootElement);
|
|
15257
|
+
handleCollaboration(rootElement, ctx);
|
|
15156
15258
|
|
|
15157
15259
|
// force drawing of everything not yet drawn that is part of the target DI
|
|
15158
15260
|
handleUnhandledProcesses(definitions.rootElements, ctx);
|
|
@@ -15359,15 +15461,15 @@
|
|
|
15359
15461
|
}
|
|
15360
15462
|
}
|
|
15361
15463
|
|
|
15362
|
-
function handleCollaboration(collaboration) {
|
|
15464
|
+
function handleCollaboration(collaboration, context) {
|
|
15363
15465
|
|
|
15364
|
-
forEach(collaboration.participants, contextual(handleParticipant));
|
|
15466
|
+
forEach(collaboration.participants, contextual(handleParticipant, context));
|
|
15365
15467
|
|
|
15366
|
-
handleArtifacts(collaboration.artifacts);
|
|
15468
|
+
handleArtifacts(collaboration.artifacts, context);
|
|
15367
15469
|
|
|
15368
15470
|
// handle message flows latest in the process
|
|
15369
15471
|
deferred.push(function() {
|
|
15370
|
-
handleMessageFlows(collaboration.messageFlows);
|
|
15472
|
+
handleMessageFlows(collaboration.messageFlows, context);
|
|
15371
15473
|
});
|
|
15372
15474
|
}
|
|
15373
15475
|
|
|
@@ -15426,7 +15528,8 @@
|
|
|
15426
15528
|
|
|
15427
15529
|
var importer,
|
|
15428
15530
|
eventBus,
|
|
15429
|
-
translate
|
|
15531
|
+
translate,
|
|
15532
|
+
canvas;
|
|
15430
15533
|
|
|
15431
15534
|
var error,
|
|
15432
15535
|
warnings = [];
|
|
@@ -15442,12 +15545,12 @@
|
|
|
15442
15545
|
|
|
15443
15546
|
var visitor = {
|
|
15444
15547
|
|
|
15445
|
-
root: function(element) {
|
|
15446
|
-
return importer.add(element);
|
|
15548
|
+
root: function(element, di) {
|
|
15549
|
+
return importer.add(element, di);
|
|
15447
15550
|
},
|
|
15448
15551
|
|
|
15449
|
-
element: function(element, parentShape) {
|
|
15450
|
-
return importer.add(element, parentShape);
|
|
15552
|
+
element: function(element, di, parentShape) {
|
|
15553
|
+
return importer.add(element, di, parentShape);
|
|
15451
15554
|
},
|
|
15452
15555
|
|
|
15453
15556
|
error: function(message, context) {
|
|
@@ -15459,7 +15562,24 @@
|
|
|
15459
15562
|
|
|
15460
15563
|
// traverse BPMN 2.0 document model,
|
|
15461
15564
|
// starting at definitions
|
|
15462
|
-
|
|
15565
|
+
if (!bpmnDiagram && definitions.diagrams) {
|
|
15566
|
+
for (var i = 0; i < definitions.diagrams.length; i++) {
|
|
15567
|
+
walker.handleDefinitions(definitions, definitions.diagrams[i]);
|
|
15568
|
+
}
|
|
15569
|
+
} else {
|
|
15570
|
+
walker.handleDefinitions(definitions, bpmnDiagram);
|
|
15571
|
+
}
|
|
15572
|
+
|
|
15573
|
+
var mainDiagram = bpmnDiagram || definitions.diagrams[0];
|
|
15574
|
+
|
|
15575
|
+
var rootId = mainDiagram.plane.bpmnElement.id;
|
|
15576
|
+
|
|
15577
|
+
// we do need to account for different ways we create root elements
|
|
15578
|
+
// each nested imported <root> do have the `_plane` suffix, while
|
|
15579
|
+
// the root <root> is found under the business object ID
|
|
15580
|
+
canvas.setRootElement(
|
|
15581
|
+
canvas.findRoot(rootId + '_plane') || canvas.findRoot(rootId)
|
|
15582
|
+
);
|
|
15463
15583
|
}
|
|
15464
15584
|
|
|
15465
15585
|
return new Promise(function(resolve, reject) {
|
|
@@ -15467,6 +15587,7 @@
|
|
|
15467
15587
|
importer = diagram.get('bpmnImporter');
|
|
15468
15588
|
eventBus = diagram.get('eventBus');
|
|
15469
15589
|
translate = diagram.get('translate');
|
|
15590
|
+
canvas = diagram.get('canvas');
|
|
15470
15591
|
|
|
15471
15592
|
eventBus.fire('import.render.start', { definitions: definitions });
|
|
15472
15593
|
|
|
@@ -15486,58 +15607,6 @@
|
|
|
15486
15607
|
});
|
|
15487
15608
|
}
|
|
15488
15609
|
|
|
15489
|
-
// TODO(nikku): remove with future bpmn-js version
|
|
15490
|
-
|
|
15491
|
-
/**
|
|
15492
|
-
* Wraps APIs to check:
|
|
15493
|
-
*
|
|
15494
|
-
* 1) If a callback is passed -> Warn users about callback deprecation.
|
|
15495
|
-
* 2) If Promise class is implemented in current environment.
|
|
15496
|
-
*
|
|
15497
|
-
* @private
|
|
15498
|
-
*/
|
|
15499
|
-
function wrapForCompatibility(api) {
|
|
15500
|
-
|
|
15501
|
-
return function() {
|
|
15502
|
-
|
|
15503
|
-
if (!window.Promise) {
|
|
15504
|
-
throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
|
|
15505
|
-
}
|
|
15506
|
-
|
|
15507
|
-
var argLen = arguments.length;
|
|
15508
|
-
if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
|
|
15509
|
-
|
|
15510
|
-
var callback = arguments[argLen - 1];
|
|
15511
|
-
|
|
15512
|
-
console.warn(new Error(
|
|
15513
|
-
'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
|
|
15514
|
-
'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
|
|
15515
|
-
));
|
|
15516
|
-
|
|
15517
|
-
var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
|
|
15518
|
-
|
|
15519
|
-
api.apply(this, argsWithoutCallback).then(function(result) {
|
|
15520
|
-
|
|
15521
|
-
var firstKey = Object.keys(result)[0];
|
|
15522
|
-
|
|
15523
|
-
// The APIs we are wrapping all resolve a single item depending on the API.
|
|
15524
|
-
// For instance, importXML resolves { warnings } and saveXML returns { xml }.
|
|
15525
|
-
// That's why we can call the callback with the first item of result.
|
|
15526
|
-
return callback(null, result[firstKey]);
|
|
15527
|
-
|
|
15528
|
-
// Passing a second paramter instead of catch because we don't want to
|
|
15529
|
-
// catch errors thrown by callback().
|
|
15530
|
-
}, function(err) {
|
|
15531
|
-
|
|
15532
|
-
return callback(err, err.warnings);
|
|
15533
|
-
});
|
|
15534
|
-
} else {
|
|
15535
|
-
|
|
15536
|
-
return api.apply(this, arguments);
|
|
15537
|
-
}
|
|
15538
|
-
};
|
|
15539
|
-
}
|
|
15540
|
-
|
|
15541
15610
|
/**
|
|
15542
15611
|
* This file must not be changed or exchanged.
|
|
15543
15612
|
*
|
|
@@ -16117,19 +16186,6 @@
|
|
|
16117
16186
|
return;
|
|
16118
16187
|
}
|
|
16119
16188
|
|
|
16120
|
-
// remove businessObject#di binding
|
|
16121
|
-
//
|
|
16122
|
-
// this is necessary, as we establish the bindings
|
|
16123
|
-
// in the BpmnTreeWalker (and assume none are given
|
|
16124
|
-
// on reimport)
|
|
16125
|
-
this.get('elementRegistry').forEach(function(element) {
|
|
16126
|
-
var bo = element.businessObject;
|
|
16127
|
-
|
|
16128
|
-
if (bo && bo.di) {
|
|
16129
|
-
delete bo.di;
|
|
16130
|
-
}
|
|
16131
|
-
});
|
|
16132
|
-
|
|
16133
16189
|
// remove drawn elements
|
|
16134
16190
|
Diagram.prototype.clear.call(this);
|
|
16135
16191
|
};
|
|
@@ -16447,6 +16503,20 @@
|
|
|
16447
16503
|
}
|
|
16448
16504
|
|
|
16449
16505
|
|
|
16506
|
+
/**
|
|
16507
|
+
* Return true if element has any of the given types.
|
|
16508
|
+
*
|
|
16509
|
+
* @param {djs.model.Base} element
|
|
16510
|
+
* @param {Array<string>} types
|
|
16511
|
+
*
|
|
16512
|
+
* @return {boolean}
|
|
16513
|
+
*/
|
|
16514
|
+
function isAny(element, types) {
|
|
16515
|
+
return some(types, function(t) {
|
|
16516
|
+
return is$1(element, t);
|
|
16517
|
+
});
|
|
16518
|
+
}
|
|
16519
|
+
|
|
16450
16520
|
/**
|
|
16451
16521
|
* Return the business object for a given element.
|
|
16452
16522
|
*
|
|
@@ -16458,14 +16528,31 @@
|
|
|
16458
16528
|
return (element && element.businessObject) || element;
|
|
16459
16529
|
}
|
|
16460
16530
|
|
|
16461
|
-
|
|
16531
|
+
/**
|
|
16532
|
+
* Return the di object for a given element.
|
|
16533
|
+
*
|
|
16534
|
+
* @param {djs.model.Base} element
|
|
16535
|
+
*
|
|
16536
|
+
* @return {ModdleElement}
|
|
16537
|
+
*/
|
|
16538
|
+
function getDi(element) {
|
|
16539
|
+
return element && element.di;
|
|
16540
|
+
}
|
|
16541
|
+
|
|
16542
|
+
function isExpanded(element, di) {
|
|
16462
16543
|
|
|
16463
16544
|
if (is$1(element, 'bpmn:CallActivity')) {
|
|
16464
16545
|
return false;
|
|
16465
16546
|
}
|
|
16466
16547
|
|
|
16467
16548
|
if (is$1(element, 'bpmn:SubProcess')) {
|
|
16468
|
-
|
|
16549
|
+
di = di || getDi(element);
|
|
16550
|
+
|
|
16551
|
+
if (di && is$1(di, 'bpmndi:BPMNPlane')) {
|
|
16552
|
+
return true;
|
|
16553
|
+
}
|
|
16554
|
+
|
|
16555
|
+
return di && !!di.isExpanded;
|
|
16469
16556
|
}
|
|
16470
16557
|
|
|
16471
16558
|
if (is$1(element, 'bpmn:Participant')) {
|
|
@@ -16610,10 +16697,6 @@
|
|
|
16610
16697
|
return element.isCollection || (dataObject && dataObject.isCollection);
|
|
16611
16698
|
}
|
|
16612
16699
|
|
|
16613
|
-
function getDi(element) {
|
|
16614
|
-
return element.businessObject.di;
|
|
16615
|
-
}
|
|
16616
|
-
|
|
16617
16700
|
function getSemantic(element) {
|
|
16618
16701
|
return element.businessObject;
|
|
16619
16702
|
}
|
|
@@ -19684,15 +19767,14 @@
|
|
|
19684
19767
|
* Returns the bounds of an elements label, parsed from the elements DI or
|
|
19685
19768
|
* generated from its bounds.
|
|
19686
19769
|
*
|
|
19687
|
-
* @param {
|
|
19770
|
+
* @param {BpmndDi} di
|
|
19688
19771
|
* @param {djs.model.Base} element
|
|
19689
19772
|
*/
|
|
19690
|
-
function getExternalLabelBounds(
|
|
19773
|
+
function getExternalLabelBounds(di, element) {
|
|
19691
19774
|
|
|
19692
19775
|
var mid,
|
|
19693
19776
|
size,
|
|
19694
19777
|
bounds,
|
|
19695
|
-
di = semantic.di,
|
|
19696
19778
|
label = di.label;
|
|
19697
19779
|
|
|
19698
19780
|
if (label && label.bounds) {
|
|
@@ -19724,17 +19806,18 @@
|
|
|
19724
19806
|
return element && !!element.labelTarget;
|
|
19725
19807
|
}
|
|
19726
19808
|
|
|
19727
|
-
function elementData(semantic, attrs) {
|
|
19809
|
+
function elementData(semantic, di, attrs) {
|
|
19728
19810
|
return assign({
|
|
19729
19811
|
id: semantic.id,
|
|
19730
19812
|
type: semantic.$type,
|
|
19731
|
-
businessObject: semantic
|
|
19813
|
+
businessObject: semantic,
|
|
19814
|
+
di: di
|
|
19732
19815
|
}, attrs);
|
|
19733
19816
|
}
|
|
19734
19817
|
|
|
19735
|
-
function getWaypoints(
|
|
19818
|
+
function getWaypoints(di, source, target) {
|
|
19736
19819
|
|
|
19737
|
-
var waypoints =
|
|
19820
|
+
var waypoints = di.waypoint;
|
|
19738
19821
|
|
|
19739
19822
|
if (!waypoints || waypoints.length < 2) {
|
|
19740
19823
|
return [ getMid(source), getMid(target) ];
|
|
@@ -19790,10 +19873,8 @@
|
|
|
19790
19873
|
* Add bpmn element (semantic) to the canvas onto the
|
|
19791
19874
|
* specified parent shape.
|
|
19792
19875
|
*/
|
|
19793
|
-
BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
19794
|
-
|
|
19795
|
-
var di = semantic.di,
|
|
19796
|
-
element,
|
|
19876
|
+
BpmnImporter.prototype.add = function(semantic, di, parentElement) {
|
|
19877
|
+
var element,
|
|
19797
19878
|
translate = this._translate,
|
|
19798
19879
|
hidden;
|
|
19799
19880
|
|
|
@@ -19801,25 +19882,31 @@
|
|
|
19801
19882
|
|
|
19802
19883
|
// ROOT ELEMENT
|
|
19803
19884
|
// handle the special case that we deal with a
|
|
19804
|
-
// invisible root element (process or collaboration)
|
|
19885
|
+
// invisible root element (process, subprocess or collaboration)
|
|
19805
19886
|
if (is$1(di, 'bpmndi:BPMNPlane')) {
|
|
19806
19887
|
|
|
19807
19888
|
// add a virtual element (not being drawn)
|
|
19808
|
-
element = this._elementFactory.createRoot(elementData(semantic));
|
|
19889
|
+
element = this._elementFactory.createRoot(elementData(semantic, di));
|
|
19890
|
+
|
|
19891
|
+
// for subprocesses, the id is already defined on the collapsed shape
|
|
19892
|
+
if (is$1(semantic, 'bpmn:SubProcess')) {
|
|
19893
|
+
element.id = element.id + '_plane';
|
|
19894
|
+
}
|
|
19809
19895
|
|
|
19810
|
-
this._canvas.
|
|
19896
|
+
this._canvas.addRootElement(element);
|
|
19811
19897
|
}
|
|
19812
19898
|
|
|
19813
19899
|
// SHAPE
|
|
19814
19900
|
else if (is$1(di, 'bpmndi:BPMNShape')) {
|
|
19815
19901
|
|
|
19816
|
-
var collapsed = !isExpanded(semantic),
|
|
19902
|
+
var collapsed = !isExpanded(semantic, di),
|
|
19817
19903
|
isFrame = isFrameElement(semantic);
|
|
19904
|
+
|
|
19818
19905
|
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
|
19819
19906
|
|
|
19820
|
-
var bounds =
|
|
19907
|
+
var bounds = di.bounds;
|
|
19821
19908
|
|
|
19822
|
-
element = this._elementFactory.createShape(elementData(semantic, {
|
|
19909
|
+
element = this._elementFactory.createShape(elementData(semantic, di, {
|
|
19823
19910
|
collapsed: collapsed,
|
|
19824
19911
|
hidden: hidden,
|
|
19825
19912
|
x: Math.round(bounds.x),
|
|
@@ -19842,7 +19929,7 @@
|
|
|
19842
19929
|
|
|
19843
19930
|
// check whether data store is inside our outside of its semantic parent
|
|
19844
19931
|
if (!isPointInsideBBox$1(parentElement, getMid(bounds))) {
|
|
19845
|
-
parentElement = this._canvas.
|
|
19932
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
19846
19933
|
}
|
|
19847
19934
|
}
|
|
19848
19935
|
|
|
@@ -19857,11 +19944,11 @@
|
|
|
19857
19944
|
|
|
19858
19945
|
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
|
19859
19946
|
|
|
19860
|
-
element = this._elementFactory.createConnection(elementData(semantic, {
|
|
19947
|
+
element = this._elementFactory.createConnection(elementData(semantic, di, {
|
|
19861
19948
|
hidden: hidden,
|
|
19862
19949
|
source: source,
|
|
19863
19950
|
target: target,
|
|
19864
|
-
waypoints: getWaypoints(
|
|
19951
|
+
waypoints: getWaypoints(di, source, target)
|
|
19865
19952
|
}));
|
|
19866
19953
|
|
|
19867
19954
|
if (is$1(semantic, 'bpmn:DataAssociation')) {
|
|
@@ -19870,7 +19957,7 @@
|
|
|
19870
19957
|
// are rendered correctly across different "hacks" people
|
|
19871
19958
|
// love to model such as cross participant / sub process
|
|
19872
19959
|
// associations
|
|
19873
|
-
parentElement =
|
|
19960
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
19874
19961
|
}
|
|
19875
19962
|
|
|
19876
19963
|
// insert sequence flows behind other flow nodes (cf. #727)
|
|
@@ -19888,7 +19975,7 @@
|
|
|
19888
19975
|
|
|
19889
19976
|
// (optional) LABEL
|
|
19890
19977
|
if (isLabelExternal(semantic) && getLabel(element)) {
|
|
19891
|
-
this.addLabel(semantic, element);
|
|
19978
|
+
this.addLabel(semantic, di, element);
|
|
19892
19979
|
}
|
|
19893
19980
|
|
|
19894
19981
|
|
|
@@ -19937,12 +20024,12 @@
|
|
|
19937
20024
|
/**
|
|
19938
20025
|
* add label for an element
|
|
19939
20026
|
*/
|
|
19940
|
-
BpmnImporter.prototype.addLabel = function(semantic, element) {
|
|
20027
|
+
BpmnImporter.prototype.addLabel = function(semantic, di, element) {
|
|
19941
20028
|
var bounds,
|
|
19942
20029
|
text,
|
|
19943
20030
|
label;
|
|
19944
20031
|
|
|
19945
|
-
bounds = getExternalLabelBounds(
|
|
20032
|
+
bounds = getExternalLabelBounds(di, element);
|
|
19946
20033
|
|
|
19947
20034
|
text = getLabel(element);
|
|
19948
20035
|
|
|
@@ -19952,7 +20039,7 @@
|
|
|
19952
20039
|
bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
|
|
19953
20040
|
}
|
|
19954
20041
|
|
|
19955
|
-
label = this._elementFactory.createLabel(elementData(semantic, {
|
|
20042
|
+
label = this._elementFactory.createLabel(elementData(semantic, di, {
|
|
19956
20043
|
id: semantic.id + '_label',
|
|
19957
20044
|
labelTarget: element,
|
|
19958
20045
|
type: 'label',
|
|
@@ -20748,7 +20835,7 @@
|
|
|
20748
20835
|
self.deselect(element);
|
|
20749
20836
|
});
|
|
20750
20837
|
|
|
20751
|
-
eventBus.on([ 'diagram.clear', '
|
|
20838
|
+
eventBus.on([ 'diagram.clear', 'root.set' ], function(e) {
|
|
20752
20839
|
self.select(null);
|
|
20753
20840
|
});
|
|
20754
20841
|
}
|
|
@@ -20801,10 +20888,12 @@
|
|
|
20801
20888
|
|
|
20802
20889
|
var canvas = this._canvas;
|
|
20803
20890
|
|
|
20891
|
+
var rootElement = canvas.getRootElement();
|
|
20892
|
+
|
|
20804
20893
|
elements = elements.filter(function(element) {
|
|
20805
|
-
var
|
|
20894
|
+
var elementRoot = canvas.findRoot(element);
|
|
20806
20895
|
|
|
20807
|
-
return
|
|
20896
|
+
return rootElement === elementRoot;
|
|
20808
20897
|
});
|
|
20809
20898
|
|
|
20810
20899
|
// selection may be cleared by passing an empty array or null
|
|
@@ -21275,8 +21364,7 @@
|
|
|
21275
21364
|
*
|
|
21276
21365
|
* @see Overlays#get for filter options.
|
|
21277
21366
|
*
|
|
21278
|
-
* @param {string} [
|
|
21279
|
-
* @param {Object} [filter]
|
|
21367
|
+
* @param {string|object} [filter]
|
|
21280
21368
|
*/
|
|
21281
21369
|
Overlays.prototype.remove = function(filter) {
|
|
21282
21370
|
|
|
@@ -21392,6 +21480,7 @@
|
|
|
21392
21480
|
}
|
|
21393
21481
|
|
|
21394
21482
|
setPosition$1(htmlContainer, left || 0, top || 0);
|
|
21483
|
+
this._updateOverlayVisibilty(overlay, this._canvas.viewbox());
|
|
21395
21484
|
};
|
|
21396
21485
|
|
|
21397
21486
|
|
|
@@ -21475,12 +21564,10 @@
|
|
|
21475
21564
|
classes$1(htmlContainer).add('djs-overlay-' + overlay.type);
|
|
21476
21565
|
}
|
|
21477
21566
|
|
|
21478
|
-
var
|
|
21479
|
-
var
|
|
21480
|
-
|
|
21481
|
-
|
|
21482
|
-
setVisible$1(htmlContainer, false);
|
|
21483
|
-
}
|
|
21567
|
+
var elementRoot = this._canvas.findRoot(element);
|
|
21568
|
+
var activeRoot = this._canvas.getRootElement();
|
|
21569
|
+
|
|
21570
|
+
setVisible$1(htmlContainer, elementRoot === activeRoot);
|
|
21484
21571
|
|
|
21485
21572
|
overlay.htmlContainer = htmlContainer;
|
|
21486
21573
|
|
|
@@ -21496,14 +21583,14 @@
|
|
|
21496
21583
|
|
|
21497
21584
|
Overlays.prototype._updateOverlayVisibilty = function(overlay, viewbox) {
|
|
21498
21585
|
var show = overlay.show,
|
|
21499
|
-
|
|
21586
|
+
rootElement = this._canvas.findRoot(overlay.element),
|
|
21500
21587
|
minZoom = show && show.minZoom,
|
|
21501
21588
|
maxZoom = show && show.maxZoom,
|
|
21502
21589
|
htmlContainer = overlay.htmlContainer,
|
|
21503
|
-
|
|
21590
|
+
activeRootElement = this._canvas.getRootElement(),
|
|
21504
21591
|
visible = true;
|
|
21505
21592
|
|
|
21506
|
-
if (
|
|
21593
|
+
if (rootElement !== activeRootElement) {
|
|
21507
21594
|
visible = false;
|
|
21508
21595
|
} else if (show) {
|
|
21509
21596
|
if (
|
|
@@ -21639,10 +21726,8 @@
|
|
|
21639
21726
|
});
|
|
21640
21727
|
|
|
21641
21728
|
|
|
21642
|
-
eventBus.on('
|
|
21643
|
-
|
|
21644
|
-
setVisible$1(el.htmlContainer, el.plane === e.plane);
|
|
21645
|
-
});
|
|
21729
|
+
eventBus.on('root.set', function() {
|
|
21730
|
+
self._updateOverlaysVisibilty();
|
|
21646
21731
|
});
|
|
21647
21732
|
|
|
21648
21733
|
// clear overlays with diagram
|
|
@@ -21686,6 +21771,621 @@
|
|
|
21686
21771
|
overlays: [ 'type', Overlays ]
|
|
21687
21772
|
};
|
|
21688
21773
|
|
|
21774
|
+
/**
|
|
21775
|
+
* Adds change support to the diagram, including
|
|
21776
|
+
*
|
|
21777
|
+
* <ul>
|
|
21778
|
+
* <li>redrawing shapes and connections on change</li>
|
|
21779
|
+
* </ul>
|
|
21780
|
+
*
|
|
21781
|
+
* @param {EventBus} eventBus
|
|
21782
|
+
* @param {Canvas} canvas
|
|
21783
|
+
* @param {ElementRegistry} elementRegistry
|
|
21784
|
+
* @param {GraphicsFactory} graphicsFactory
|
|
21785
|
+
*/
|
|
21786
|
+
function ChangeSupport(
|
|
21787
|
+
eventBus, canvas, elementRegistry,
|
|
21788
|
+
graphicsFactory) {
|
|
21789
|
+
|
|
21790
|
+
|
|
21791
|
+
// redraw shapes / connections on change
|
|
21792
|
+
|
|
21793
|
+
eventBus.on('element.changed', function(event) {
|
|
21794
|
+
|
|
21795
|
+
var element = event.element;
|
|
21796
|
+
|
|
21797
|
+
// element might have been deleted and replaced by new element with same ID
|
|
21798
|
+
// thus check for parent of element except for root element
|
|
21799
|
+
if (element.parent || element === canvas.getRootElement()) {
|
|
21800
|
+
event.gfx = elementRegistry.getGraphics(element);
|
|
21801
|
+
}
|
|
21802
|
+
|
|
21803
|
+
// shape + gfx may have been deleted
|
|
21804
|
+
if (!event.gfx) {
|
|
21805
|
+
return;
|
|
21806
|
+
}
|
|
21807
|
+
|
|
21808
|
+
eventBus.fire(getType(element) + '.changed', event);
|
|
21809
|
+
});
|
|
21810
|
+
|
|
21811
|
+
eventBus.on('elements.changed', function(event) {
|
|
21812
|
+
|
|
21813
|
+
var elements = event.elements;
|
|
21814
|
+
|
|
21815
|
+
elements.forEach(function(e) {
|
|
21816
|
+
eventBus.fire('element.changed', { element: e });
|
|
21817
|
+
});
|
|
21818
|
+
|
|
21819
|
+
graphicsFactory.updateContainments(elements);
|
|
21820
|
+
});
|
|
21821
|
+
|
|
21822
|
+
eventBus.on('shape.changed', function(event) {
|
|
21823
|
+
graphicsFactory.update('shape', event.element, event.gfx);
|
|
21824
|
+
});
|
|
21825
|
+
|
|
21826
|
+
eventBus.on('connection.changed', function(event) {
|
|
21827
|
+
graphicsFactory.update('connection', event.element, event.gfx);
|
|
21828
|
+
});
|
|
21829
|
+
}
|
|
21830
|
+
|
|
21831
|
+
ChangeSupport.$inject = [
|
|
21832
|
+
'eventBus',
|
|
21833
|
+
'canvas',
|
|
21834
|
+
'elementRegistry',
|
|
21835
|
+
'graphicsFactory'
|
|
21836
|
+
];
|
|
21837
|
+
|
|
21838
|
+
var ChangeSupportModule = {
|
|
21839
|
+
__init__: [ 'changeSupport'],
|
|
21840
|
+
changeSupport: [ 'type', ChangeSupport ]
|
|
21841
|
+
};
|
|
21842
|
+
|
|
21843
|
+
var css_escape = {exports: {}};
|
|
21844
|
+
|
|
21845
|
+
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
|
|
21846
|
+
|
|
21847
|
+
(function (module, exports) {
|
|
21848
|
+
(function(root, factory) {
|
|
21849
|
+
// https://github.com/umdjs/umd/blob/master/returnExports.js
|
|
21850
|
+
{
|
|
21851
|
+
// For Node.js.
|
|
21852
|
+
module.exports = factory(root);
|
|
21853
|
+
}
|
|
21854
|
+
}(typeof commonjsGlobal != 'undefined' ? commonjsGlobal : commonjsGlobal, function(root) {
|
|
21855
|
+
|
|
21856
|
+
if (root.CSS && root.CSS.escape) {
|
|
21857
|
+
return root.CSS.escape;
|
|
21858
|
+
}
|
|
21859
|
+
|
|
21860
|
+
// https://drafts.csswg.org/cssom/#serialize-an-identifier
|
|
21861
|
+
var cssEscape = function(value) {
|
|
21862
|
+
if (arguments.length == 0) {
|
|
21863
|
+
throw new TypeError('`CSS.escape` requires an argument.');
|
|
21864
|
+
}
|
|
21865
|
+
var string = String(value);
|
|
21866
|
+
var length = string.length;
|
|
21867
|
+
var index = -1;
|
|
21868
|
+
var codeUnit;
|
|
21869
|
+
var result = '';
|
|
21870
|
+
var firstCodeUnit = string.charCodeAt(0);
|
|
21871
|
+
while (++index < length) {
|
|
21872
|
+
codeUnit = string.charCodeAt(index);
|
|
21873
|
+
// Note: there’s no need to special-case astral symbols, surrogate
|
|
21874
|
+
// pairs, or lone surrogates.
|
|
21875
|
+
|
|
21876
|
+
// If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
|
|
21877
|
+
// (U+FFFD).
|
|
21878
|
+
if (codeUnit == 0x0000) {
|
|
21879
|
+
result += '\uFFFD';
|
|
21880
|
+
continue;
|
|
21881
|
+
}
|
|
21882
|
+
|
|
21883
|
+
if (
|
|
21884
|
+
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
|
|
21885
|
+
// U+007F, […]
|
|
21886
|
+
(codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
|
|
21887
|
+
// If the character is the first character and is in the range [0-9]
|
|
21888
|
+
// (U+0030 to U+0039), […]
|
|
21889
|
+
(index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
|
21890
|
+
// If the character is the second character and is in the range [0-9]
|
|
21891
|
+
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
|
|
21892
|
+
(
|
|
21893
|
+
index == 1 &&
|
|
21894
|
+
codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
|
|
21895
|
+
firstCodeUnit == 0x002D
|
|
21896
|
+
)
|
|
21897
|
+
) {
|
|
21898
|
+
// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
|
|
21899
|
+
result += '\\' + codeUnit.toString(16) + ' ';
|
|
21900
|
+
continue;
|
|
21901
|
+
}
|
|
21902
|
+
|
|
21903
|
+
if (
|
|
21904
|
+
// If the character is the first character and is a `-` (U+002D), and
|
|
21905
|
+
// there is no second character, […]
|
|
21906
|
+
index == 0 &&
|
|
21907
|
+
length == 1 &&
|
|
21908
|
+
codeUnit == 0x002D
|
|
21909
|
+
) {
|
|
21910
|
+
result += '\\' + string.charAt(index);
|
|
21911
|
+
continue;
|
|
21912
|
+
}
|
|
21913
|
+
|
|
21914
|
+
// If the character is not handled by one of the above rules and is
|
|
21915
|
+
// greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
|
|
21916
|
+
// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
|
|
21917
|
+
// U+005A), or [a-z] (U+0061 to U+007A), […]
|
|
21918
|
+
if (
|
|
21919
|
+
codeUnit >= 0x0080 ||
|
|
21920
|
+
codeUnit == 0x002D ||
|
|
21921
|
+
codeUnit == 0x005F ||
|
|
21922
|
+
codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
|
|
21923
|
+
codeUnit >= 0x0041 && codeUnit <= 0x005A ||
|
|
21924
|
+
codeUnit >= 0x0061 && codeUnit <= 0x007A
|
|
21925
|
+
) {
|
|
21926
|
+
// the character itself
|
|
21927
|
+
result += string.charAt(index);
|
|
21928
|
+
continue;
|
|
21929
|
+
}
|
|
21930
|
+
|
|
21931
|
+
// Otherwise, the escaped character.
|
|
21932
|
+
// https://drafts.csswg.org/cssom/#escape-a-character
|
|
21933
|
+
result += '\\' + string.charAt(index);
|
|
21934
|
+
|
|
21935
|
+
}
|
|
21936
|
+
return result;
|
|
21937
|
+
};
|
|
21938
|
+
|
|
21939
|
+
if (!root.CSS) {
|
|
21940
|
+
root.CSS = {};
|
|
21941
|
+
}
|
|
21942
|
+
|
|
21943
|
+
root.CSS.escape = cssEscape;
|
|
21944
|
+
return cssEscape;
|
|
21945
|
+
|
|
21946
|
+
}));
|
|
21947
|
+
}(css_escape));
|
|
21948
|
+
|
|
21949
|
+
var cssEscape = css_escape.exports;
|
|
21950
|
+
|
|
21951
|
+
var HTML_ESCAPE_MAP = {
|
|
21952
|
+
'&': '&',
|
|
21953
|
+
'<': '<',
|
|
21954
|
+
'>': '>',
|
|
21955
|
+
'"': '"',
|
|
21956
|
+
'\'': '''
|
|
21957
|
+
};
|
|
21958
|
+
|
|
21959
|
+
function escapeHTML(str) {
|
|
21960
|
+
str = '' + str;
|
|
21961
|
+
|
|
21962
|
+
return str && str.replace(/[&<>"']/g, function(match) {
|
|
21963
|
+
return HTML_ESCAPE_MAP[match];
|
|
21964
|
+
});
|
|
21965
|
+
}
|
|
21966
|
+
|
|
21967
|
+
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>';
|
|
21968
|
+
|
|
21969
|
+
var OPEN_CLASS = 'bjs-breadcrumbs-shown';
|
|
21970
|
+
|
|
21971
|
+
|
|
21972
|
+
/**
|
|
21973
|
+
* Adds Overlays that allow switching planes on collapsed subprocesses.
|
|
21974
|
+
*
|
|
21975
|
+
* @param {eventBus} eventBus
|
|
21976
|
+
* @param {elementRegistry} elementRegistry
|
|
21977
|
+
* @param {overlays} overlays
|
|
21978
|
+
* @param {canvas} canvas
|
|
21979
|
+
*/
|
|
21980
|
+
function DrilldownOverlays(eventBus, elementRegistry, overlays, canvas) {
|
|
21981
|
+
var breadcrumbs = domify('<ul class="bjs-breadcrumbs"></ul>');
|
|
21982
|
+
var container = canvas.getContainer();
|
|
21983
|
+
var containerClasses = classes$1(container);
|
|
21984
|
+
container.appendChild(breadcrumbs);
|
|
21985
|
+
|
|
21986
|
+
function updateBreadcrumbs(element) {
|
|
21987
|
+
var parents = getParentChain(element);
|
|
21988
|
+
|
|
21989
|
+
var path = parents.map(function(el) {
|
|
21990
|
+
var title = escapeHTML(el.name || el.id);
|
|
21991
|
+
var link = domify('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
|
|
21992
|
+
|
|
21993
|
+
link.addEventListener('click', function() {
|
|
21994
|
+
canvas.setRootElement(canvas.findRoot(planeId(el)) || canvas.findRoot(el.id));
|
|
21995
|
+
});
|
|
21996
|
+
|
|
21997
|
+
return link;
|
|
21998
|
+
});
|
|
21999
|
+
|
|
22000
|
+
breadcrumbs.innerHTML = '';
|
|
22001
|
+
|
|
22002
|
+
// show breadcrumbs and expose state to .djs-container
|
|
22003
|
+
var visible = path.length > 1;
|
|
22004
|
+
containerClasses.toggle(OPEN_CLASS, visible);
|
|
22005
|
+
|
|
22006
|
+
path.forEach(function(el) {
|
|
22007
|
+
breadcrumbs.appendChild(el);
|
|
22008
|
+
});
|
|
22009
|
+
}
|
|
22010
|
+
|
|
22011
|
+
eventBus.on('root.set', function(event) {
|
|
22012
|
+
updateBreadcrumbs(event.element);
|
|
22013
|
+
});
|
|
22014
|
+
|
|
22015
|
+
var createOverlay = function(element) {
|
|
22016
|
+
var html = domify('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
|
|
22017
|
+
|
|
22018
|
+
html.addEventListener('click', function() {
|
|
22019
|
+
canvas.setRootElement(canvas.findRoot(planeId(element)));
|
|
22020
|
+
});
|
|
22021
|
+
|
|
22022
|
+
overlays.add(element, {
|
|
22023
|
+
position: {
|
|
22024
|
+
bottom: -7,
|
|
22025
|
+
right: -8
|
|
22026
|
+
},
|
|
22027
|
+
html: html
|
|
22028
|
+
});
|
|
22029
|
+
};
|
|
22030
|
+
|
|
22031
|
+
var addOverlays = function(elements) {
|
|
22032
|
+
elements.forEach(function(element) {
|
|
22033
|
+
|
|
22034
|
+
if (is$1(element, 'bpmn:SubProcess')
|
|
22035
|
+
&& element.collapsed
|
|
22036
|
+
&& canvas.findRoot(planeId(element))) {
|
|
22037
|
+
createOverlay(element);
|
|
22038
|
+
}
|
|
22039
|
+
});
|
|
22040
|
+
};
|
|
22041
|
+
|
|
22042
|
+
eventBus.on('import.done', function() {
|
|
22043
|
+
addOverlays(elementRegistry.filter(function(el) {
|
|
22044
|
+
return is$1(el, 'bpmn:SubProcess');
|
|
22045
|
+
}));
|
|
22046
|
+
});
|
|
22047
|
+
}
|
|
22048
|
+
|
|
22049
|
+
DrilldownOverlays.$inject = [ 'eventBus', 'elementRegistry', 'overlays', 'canvas' ];
|
|
22050
|
+
|
|
22051
|
+
|
|
22052
|
+
// helpers
|
|
22053
|
+
function getParentChain(child) {
|
|
22054
|
+
var bo = getBusinessObject(child);
|
|
22055
|
+
|
|
22056
|
+
var parents = [];
|
|
22057
|
+
|
|
22058
|
+
for (var element = bo; element; element = element.$parent) {
|
|
22059
|
+
if (is$1(element, 'bpmn:SubProcess') || is$1(element, 'bpmn:Process')) {
|
|
22060
|
+
parents.push(element);
|
|
22061
|
+
}
|
|
22062
|
+
}
|
|
22063
|
+
|
|
22064
|
+
return parents.reverse();
|
|
22065
|
+
}
|
|
22066
|
+
|
|
22067
|
+
|
|
22068
|
+
function planeId(element) {
|
|
22069
|
+
if (is$1(element, 'bpmn:SubProcess')) {
|
|
22070
|
+
return element.id + '_plane';
|
|
22071
|
+
}
|
|
22072
|
+
|
|
22073
|
+
return element.id;
|
|
22074
|
+
}
|
|
22075
|
+
|
|
22076
|
+
/**
|
|
22077
|
+
* Move collapsed subprocesses into view when drilling down.
|
|
22078
|
+
*
|
|
22079
|
+
* Zoom and scroll are saved in a session.
|
|
22080
|
+
*
|
|
22081
|
+
* @param {eventBus} eventBus
|
|
22082
|
+
* @param {canvas} canvas
|
|
22083
|
+
*/
|
|
22084
|
+
function DrilldownCentering(eventBus, canvas) {
|
|
22085
|
+
|
|
22086
|
+
var currentRoot = null;
|
|
22087
|
+
var positionMap = new Map();
|
|
22088
|
+
|
|
22089
|
+
eventBus.on('root.set', function(event) {
|
|
22090
|
+
var currentViewbox = canvas.viewbox();
|
|
22091
|
+
|
|
22092
|
+
positionMap.set(currentRoot, {
|
|
22093
|
+
x: currentViewbox.x,
|
|
22094
|
+
y: currentViewbox.y,
|
|
22095
|
+
zoom: currentViewbox.scale
|
|
22096
|
+
});
|
|
22097
|
+
|
|
22098
|
+
var newRoot = event.element;
|
|
22099
|
+
var storedViewbox = positionMap.get(newRoot) || { x: 0, y: 0, zoom: 1 };
|
|
22100
|
+
|
|
22101
|
+
var dx = (currentViewbox.x - storedViewbox.x) * currentViewbox.scale,
|
|
22102
|
+
dy = (currentViewbox.y - storedViewbox.y) * currentViewbox.scale;
|
|
22103
|
+
|
|
22104
|
+
if (dx !== 0 || dy !== 0) {
|
|
22105
|
+
canvas.scroll({
|
|
22106
|
+
dx: dx,
|
|
22107
|
+
dy: dy
|
|
22108
|
+
});
|
|
22109
|
+
}
|
|
22110
|
+
|
|
22111
|
+
if (storedViewbox.zoom !== currentViewbox.scale) {
|
|
22112
|
+
canvas.zoom(storedViewbox.zoom, { x: 0, y: 0 });
|
|
22113
|
+
}
|
|
22114
|
+
|
|
22115
|
+
currentRoot = newRoot;
|
|
22116
|
+
});
|
|
22117
|
+
|
|
22118
|
+
eventBus.on('root.remove', function(event) {
|
|
22119
|
+
positionMap.remove(event.element);
|
|
22120
|
+
});
|
|
22121
|
+
|
|
22122
|
+
eventBus.on('diagram.clear', function() {
|
|
22123
|
+
positionMap.clear();
|
|
22124
|
+
currentRoot = null;
|
|
22125
|
+
});
|
|
22126
|
+
|
|
22127
|
+
}
|
|
22128
|
+
|
|
22129
|
+
DrilldownCentering.$inject = [ 'eventBus', 'canvas' ];
|
|
22130
|
+
|
|
22131
|
+
|
|
22132
|
+
/**
|
|
22133
|
+
* ES5 Map implementation. Works.
|
|
22134
|
+
*/
|
|
22135
|
+
function Map() {
|
|
22136
|
+
|
|
22137
|
+
this._entries = [];
|
|
22138
|
+
|
|
22139
|
+
this.set = function(key, value) {
|
|
22140
|
+
|
|
22141
|
+
var found = false;
|
|
22142
|
+
|
|
22143
|
+
for (var k in this._entries) {
|
|
22144
|
+
if (this._entries[k][0] === key) {
|
|
22145
|
+
this._entries[k][1] = value;
|
|
22146
|
+
|
|
22147
|
+
found = true;
|
|
22148
|
+
|
|
22149
|
+
break;
|
|
22150
|
+
}
|
|
22151
|
+
}
|
|
22152
|
+
|
|
22153
|
+
if (!found) {
|
|
22154
|
+
this._entries.push([ key, value ]);
|
|
22155
|
+
}
|
|
22156
|
+
};
|
|
22157
|
+
|
|
22158
|
+
this.get = function(key) {
|
|
22159
|
+
|
|
22160
|
+
for (var k in this._entries) {
|
|
22161
|
+
if (this._entries[k][0] === key) {
|
|
22162
|
+
return this._entries[k][1];
|
|
22163
|
+
}
|
|
22164
|
+
}
|
|
22165
|
+
|
|
22166
|
+
return null;
|
|
22167
|
+
};
|
|
22168
|
+
|
|
22169
|
+
this.clear = function() {
|
|
22170
|
+
this._entries.length = 0;
|
|
22171
|
+
};
|
|
22172
|
+
|
|
22173
|
+
this.remove = function(key) {
|
|
22174
|
+
|
|
22175
|
+
var idx = -1;
|
|
22176
|
+
|
|
22177
|
+
for (var k in this._entries) {
|
|
22178
|
+
if (this._entries[k][0] === key) {
|
|
22179
|
+
idx = k;
|
|
22180
|
+
|
|
22181
|
+
break;
|
|
22182
|
+
}
|
|
22183
|
+
}
|
|
22184
|
+
|
|
22185
|
+
if (idx !== -1) {
|
|
22186
|
+
this._entries.splice(idx, 1);
|
|
22187
|
+
}
|
|
22188
|
+
};
|
|
22189
|
+
}
|
|
22190
|
+
|
|
22191
|
+
var DEFAULT_POSITION = {
|
|
22192
|
+
x: 180,
|
|
22193
|
+
y: 160
|
|
22194
|
+
};
|
|
22195
|
+
|
|
22196
|
+
/**
|
|
22197
|
+
* Hook into `import.render.start` and create new planes for diagrams with
|
|
22198
|
+
* collapsed subprocesses and all dis on the same plane.
|
|
22199
|
+
*
|
|
22200
|
+
* @param {eventBus} eventBus
|
|
22201
|
+
* @param {moddle} moddle
|
|
22202
|
+
*/
|
|
22203
|
+
function SubprocessCompatibility(eventBus, moddle) {
|
|
22204
|
+
this._eventBus = eventBus;
|
|
22205
|
+
this._moddle = moddle;
|
|
22206
|
+
|
|
22207
|
+
var self = this;
|
|
22208
|
+
|
|
22209
|
+
eventBus.on('import.render.start', 1500, function(e, context) {
|
|
22210
|
+
self.handleImport(context.definitions);
|
|
22211
|
+
});
|
|
22212
|
+
}
|
|
22213
|
+
|
|
22214
|
+
SubprocessCompatibility.prototype.handleImport = function(definitions) {
|
|
22215
|
+
if (!definitions.diagrams) {
|
|
22216
|
+
return;
|
|
22217
|
+
}
|
|
22218
|
+
|
|
22219
|
+
var self = this;
|
|
22220
|
+
this._definitions = definitions;
|
|
22221
|
+
this._processToDiagramMap = {};
|
|
22222
|
+
|
|
22223
|
+
definitions.diagrams.forEach(function(diagram) {
|
|
22224
|
+
if (!diagram.plane || !diagram.plane.bpmnElement) {
|
|
22225
|
+
return;
|
|
22226
|
+
}
|
|
22227
|
+
|
|
22228
|
+
self._processToDiagramMap[diagram.plane.bpmnElement.id] = diagram;
|
|
22229
|
+
});
|
|
22230
|
+
|
|
22231
|
+
var newDiagrams = [];
|
|
22232
|
+
definitions.diagrams.forEach(function(diagram) {
|
|
22233
|
+
var createdDiagrams = self.createNewDiagrams(diagram.plane);
|
|
22234
|
+
Array.prototype.push.apply(newDiagrams, createdDiagrams);
|
|
22235
|
+
});
|
|
22236
|
+
|
|
22237
|
+
newDiagrams.forEach(function(diagram) {
|
|
22238
|
+
self.movePlaneElementsToOrigin(diagram.plane);
|
|
22239
|
+
});
|
|
22240
|
+
};
|
|
22241
|
+
|
|
22242
|
+
|
|
22243
|
+
/**
|
|
22244
|
+
* Moves all DI elements from collapsed subprocesses to a new plane.
|
|
22245
|
+
*
|
|
22246
|
+
* @param {Object} plane
|
|
22247
|
+
* @return {Array} new diagrams created for the collapsed subprocesses
|
|
22248
|
+
*/
|
|
22249
|
+
SubprocessCompatibility.prototype.createNewDiagrams = function(plane) {
|
|
22250
|
+
var self = this;
|
|
22251
|
+
|
|
22252
|
+
var collapsedElements = [];
|
|
22253
|
+
var elementsToMove = [];
|
|
22254
|
+
|
|
22255
|
+
plane.get('planeElement').forEach(function(diElement) {
|
|
22256
|
+
var bo = diElement.bpmnElement;
|
|
22257
|
+
var parent = bo.$parent;
|
|
22258
|
+
|
|
22259
|
+
if (is$1(bo, 'bpmn:SubProcess') && !diElement.isExpanded) {
|
|
22260
|
+
collapsedElements.push(bo);
|
|
22261
|
+
}
|
|
22262
|
+
|
|
22263
|
+
if (is$1(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
|
|
22264
|
+
|
|
22265
|
+
// don't change the array while we iterate over it
|
|
22266
|
+
elementsToMove.push({ diElement: diElement, parent: parent });
|
|
22267
|
+
}
|
|
22268
|
+
});
|
|
22269
|
+
|
|
22270
|
+
var newDiagrams = [];
|
|
22271
|
+
|
|
22272
|
+
elementsToMove.forEach(function(element) {
|
|
22273
|
+
var diElement = element.diElement;
|
|
22274
|
+
var parent = element.parent;
|
|
22275
|
+
|
|
22276
|
+
// parent is expanded, get nearest collapsed parent
|
|
22277
|
+
while (parent && !collapsedElements.includes(parent)) {
|
|
22278
|
+
parent = parent.$parent;
|
|
22279
|
+
}
|
|
22280
|
+
|
|
22281
|
+
// false positive, all parents are expanded
|
|
22282
|
+
if (!parent) {
|
|
22283
|
+
return;
|
|
22284
|
+
}
|
|
22285
|
+
|
|
22286
|
+
var diagram = self._processToDiagramMap[parent.id];
|
|
22287
|
+
if (!diagram) {
|
|
22288
|
+
diagram = self.createDiagram(parent);
|
|
22289
|
+
self._processToDiagramMap[parent.id] = diagram;
|
|
22290
|
+
newDiagrams.push(diagram);
|
|
22291
|
+
}
|
|
22292
|
+
|
|
22293
|
+
self.moveToDiPlane(diElement, diagram.plane);
|
|
22294
|
+
});
|
|
22295
|
+
|
|
22296
|
+
return newDiagrams;
|
|
22297
|
+
};
|
|
22298
|
+
|
|
22299
|
+
SubprocessCompatibility.prototype.movePlaneElementsToOrigin = function(plane) {
|
|
22300
|
+
var elements = plane.get('planeElement');
|
|
22301
|
+
|
|
22302
|
+
// get bounding box of all elements
|
|
22303
|
+
var planeBounds = getPlaneBounds(plane);
|
|
22304
|
+
|
|
22305
|
+
var offset = {
|
|
22306
|
+
x: planeBounds.x - DEFAULT_POSITION.x,
|
|
22307
|
+
y: planeBounds.y - DEFAULT_POSITION.y
|
|
22308
|
+
};
|
|
22309
|
+
|
|
22310
|
+
elements.forEach(function(diElement) {
|
|
22311
|
+
if (diElement.waypoint) {
|
|
22312
|
+
diElement.waypoint.forEach(function(waypoint) {
|
|
22313
|
+
waypoint.x = waypoint.x - offset.x;
|
|
22314
|
+
waypoint.y = waypoint.y - offset.y;
|
|
22315
|
+
});
|
|
22316
|
+
} else if (diElement.bounds) {
|
|
22317
|
+
diElement.bounds.x = diElement.bounds.x - offset.x;
|
|
22318
|
+
diElement.bounds.y = diElement.bounds.y - offset.y;
|
|
22319
|
+
}
|
|
22320
|
+
});
|
|
22321
|
+
};
|
|
22322
|
+
|
|
22323
|
+
|
|
22324
|
+
SubprocessCompatibility.prototype.moveToDiPlane = function(diElement, newPlane) {
|
|
22325
|
+
var containingDiagram = findRootDiagram(diElement);
|
|
22326
|
+
|
|
22327
|
+
// remove DI from old Plane and add it to the new one
|
|
22328
|
+
var parentPlaneElement = containingDiagram.plane.get('planeElement');
|
|
22329
|
+
parentPlaneElement.splice(parentPlaneElement.indexOf(diElement), 1);
|
|
22330
|
+
newPlane.get('planeElement').push(diElement);
|
|
22331
|
+
};
|
|
22332
|
+
|
|
22333
|
+
|
|
22334
|
+
SubprocessCompatibility.prototype.createDiagram = function(bo) {
|
|
22335
|
+
var plane = this._moddle.create('bpmndi:BPMNPlane', { bpmnElement: bo });
|
|
22336
|
+
var diagram = this._moddle.create('bpmndi:BPMNDiagram', {
|
|
22337
|
+
plane: plane
|
|
22338
|
+
});
|
|
22339
|
+
plane.$parent = diagram;
|
|
22340
|
+
plane.bpmnElement = bo;
|
|
22341
|
+
diagram.$parent = this._definitions;
|
|
22342
|
+
this._definitions.diagrams.push(diagram);
|
|
22343
|
+
return diagram;
|
|
22344
|
+
};
|
|
22345
|
+
|
|
22346
|
+
SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
|
|
22347
|
+
|
|
22348
|
+
|
|
22349
|
+
// helpers
|
|
22350
|
+
|
|
22351
|
+
function findRootDiagram(element) {
|
|
22352
|
+
if (is$1(element, 'bpmndi:BPMNDiagram')) {
|
|
22353
|
+
return element;
|
|
22354
|
+
} else {
|
|
22355
|
+
return findRootDiagram(element.$parent);
|
|
22356
|
+
}
|
|
22357
|
+
}
|
|
22358
|
+
|
|
22359
|
+
function getPlaneBounds(plane) {
|
|
22360
|
+
var planeTrbl = {
|
|
22361
|
+
top: Infinity,
|
|
22362
|
+
right: -Infinity,
|
|
22363
|
+
bottom: -Infinity,
|
|
22364
|
+
left: Infinity
|
|
22365
|
+
};
|
|
22366
|
+
|
|
22367
|
+
plane.planeElement.forEach(function(element) {
|
|
22368
|
+
if (!element.bounds) {
|
|
22369
|
+
return;
|
|
22370
|
+
}
|
|
22371
|
+
|
|
22372
|
+
var trbl = asTRBL(element.bounds);
|
|
22373
|
+
|
|
22374
|
+
planeTrbl.top = Math.min(trbl.top, planeTrbl.top);
|
|
22375
|
+
planeTrbl.left = Math.min(trbl.left, planeTrbl.left);
|
|
22376
|
+
});
|
|
22377
|
+
|
|
22378
|
+
return asBounds(planeTrbl);
|
|
22379
|
+
}
|
|
22380
|
+
|
|
22381
|
+
var DrilldownModdule = {
|
|
22382
|
+
__depends__: [ OverlaysModule, ChangeSupportModule ],
|
|
22383
|
+
__init__: [ 'drilldownOverlays', 'drilldownCentering', 'subprocessCompatibility'],
|
|
22384
|
+
drilldownOverlays: [ 'type', DrilldownOverlays ],
|
|
22385
|
+
drilldownCentering: [ 'type', DrilldownCentering ],
|
|
22386
|
+
subprocessCompatibility: [ 'type', SubprocessCompatibility ]
|
|
22387
|
+
};
|
|
22388
|
+
|
|
21689
22389
|
/**
|
|
21690
22390
|
* A viewer for BPMN 2.0 diagrams.
|
|
21691
22391
|
*
|
|
@@ -21744,7 +22444,8 @@
|
|
|
21744
22444
|
CoreModule,
|
|
21745
22445
|
translate,
|
|
21746
22446
|
SelectionModule,
|
|
21747
|
-
OverlaysModule
|
|
22447
|
+
OverlaysModule,
|
|
22448
|
+
DrilldownModdule
|
|
21748
22449
|
];
|
|
21749
22450
|
|
|
21750
22451
|
// default moddle extensions the viewer is composed of
|
|
@@ -25509,14 +26210,23 @@
|
|
|
25509
26210
|
// the touch recognizer
|
|
25510
26211
|
var recognizer;
|
|
25511
26212
|
|
|
25512
|
-
function handler(type) {
|
|
26213
|
+
function handler(type, buttonType) {
|
|
25513
26214
|
|
|
25514
26215
|
return function(event) {
|
|
25515
26216
|
|
|
25516
|
-
|
|
26217
|
+
var gfx = getGfx(event.target),
|
|
26218
|
+
element = gfx && elementRegistry.get(gfx);
|
|
26219
|
+
|
|
26220
|
+
// translate into an actual mouse click event
|
|
26221
|
+
if (buttonType) {
|
|
26222
|
+
event.srcEvent.button = buttonType;
|
|
26223
|
+
}
|
|
26224
|
+
|
|
26225
|
+
return interactionEvents.fire(type, event, element);
|
|
25517
26226
|
};
|
|
25518
26227
|
}
|
|
25519
26228
|
|
|
26229
|
+
|
|
25520
26230
|
function getGfx(target) {
|
|
25521
26231
|
var node = closest(target, 'svg, .djs-element', true);
|
|
25522
26232
|
return node;
|
|
@@ -25527,10 +26237,6 @@
|
|
|
25527
26237
|
// touch recognizer
|
|
25528
26238
|
recognizer = createTouchRecognizer(svg);
|
|
25529
26239
|
|
|
25530
|
-
recognizer.on('doubletap', handler('element.dblclick'));
|
|
25531
|
-
|
|
25532
|
-
recognizer.on('tap', handler('element.click'));
|
|
25533
|
-
|
|
25534
26240
|
function startGrabCanvas(event) {
|
|
25535
26241
|
|
|
25536
26242
|
var lx = 0, ly = 0;
|
|
@@ -25598,6 +26304,9 @@
|
|
|
25598
26304
|
recognizer.on('pinchcancel', end);
|
|
25599
26305
|
}
|
|
25600
26306
|
|
|
26307
|
+
recognizer.on('tap', handler('element.click'));
|
|
26308
|
+
recognizer.on('doubletap', handler('element.dblclick', 1));
|
|
26309
|
+
|
|
25601
26310
|
recognizer.on('panstart', startGrab);
|
|
25602
26311
|
recognizer.on('press', startGrab);
|
|
25603
26312
|
|
|
@@ -26335,21 +27044,6 @@
|
|
|
26335
27044
|
autoPlaceSelectionBehavior: [ 'type', AutoPlaceSelectionBehavior ]
|
|
26336
27045
|
};
|
|
26337
27046
|
|
|
26338
|
-
/**
|
|
26339
|
-
* Return true if element has any of the given types.
|
|
26340
|
-
*
|
|
26341
|
-
* @param {djs.model.Base} element
|
|
26342
|
-
* @param {Array<string>} types
|
|
26343
|
-
*
|
|
26344
|
-
* @return {boolean}
|
|
26345
|
-
*/
|
|
26346
|
-
function isAny(element, types) {
|
|
26347
|
-
return some(types, function(t) {
|
|
26348
|
-
return is$1(element, t);
|
|
26349
|
-
});
|
|
26350
|
-
}
|
|
26351
|
-
|
|
26352
|
-
|
|
26353
27047
|
/**
|
|
26354
27048
|
* Return the parent of the element with any of the given types.
|
|
26355
27049
|
*
|
|
@@ -28272,130 +28966,6 @@
|
|
|
28272
28966
|
calculateSegmentMoveRegion(segmentLengthYAxis);
|
|
28273
28967
|
}
|
|
28274
28968
|
|
|
28275
|
-
var css_escape = {exports: {}};
|
|
28276
|
-
|
|
28277
|
-
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
|
|
28278
|
-
|
|
28279
|
-
(function (module, exports) {
|
|
28280
|
-
(function(root, factory) {
|
|
28281
|
-
// https://github.com/umdjs/umd/blob/master/returnExports.js
|
|
28282
|
-
{
|
|
28283
|
-
// For Node.js.
|
|
28284
|
-
module.exports = factory(root);
|
|
28285
|
-
}
|
|
28286
|
-
}(typeof commonjsGlobal != 'undefined' ? commonjsGlobal : commonjsGlobal, function(root) {
|
|
28287
|
-
|
|
28288
|
-
if (root.CSS && root.CSS.escape) {
|
|
28289
|
-
return root.CSS.escape;
|
|
28290
|
-
}
|
|
28291
|
-
|
|
28292
|
-
// https://drafts.csswg.org/cssom/#serialize-an-identifier
|
|
28293
|
-
var cssEscape = function(value) {
|
|
28294
|
-
if (arguments.length == 0) {
|
|
28295
|
-
throw new TypeError('`CSS.escape` requires an argument.');
|
|
28296
|
-
}
|
|
28297
|
-
var string = String(value);
|
|
28298
|
-
var length = string.length;
|
|
28299
|
-
var index = -1;
|
|
28300
|
-
var codeUnit;
|
|
28301
|
-
var result = '';
|
|
28302
|
-
var firstCodeUnit = string.charCodeAt(0);
|
|
28303
|
-
while (++index < length) {
|
|
28304
|
-
codeUnit = string.charCodeAt(index);
|
|
28305
|
-
// Note: there’s no need to special-case astral symbols, surrogate
|
|
28306
|
-
// pairs, or lone surrogates.
|
|
28307
|
-
|
|
28308
|
-
// If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
|
|
28309
|
-
// (U+FFFD).
|
|
28310
|
-
if (codeUnit == 0x0000) {
|
|
28311
|
-
result += '\uFFFD';
|
|
28312
|
-
continue;
|
|
28313
|
-
}
|
|
28314
|
-
|
|
28315
|
-
if (
|
|
28316
|
-
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
|
|
28317
|
-
// U+007F, […]
|
|
28318
|
-
(codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
|
|
28319
|
-
// If the character is the first character and is in the range [0-9]
|
|
28320
|
-
// (U+0030 to U+0039), […]
|
|
28321
|
-
(index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
|
28322
|
-
// If the character is the second character and is in the range [0-9]
|
|
28323
|
-
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
|
|
28324
|
-
(
|
|
28325
|
-
index == 1 &&
|
|
28326
|
-
codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
|
|
28327
|
-
firstCodeUnit == 0x002D
|
|
28328
|
-
)
|
|
28329
|
-
) {
|
|
28330
|
-
// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
|
|
28331
|
-
result += '\\' + codeUnit.toString(16) + ' ';
|
|
28332
|
-
continue;
|
|
28333
|
-
}
|
|
28334
|
-
|
|
28335
|
-
if (
|
|
28336
|
-
// If the character is the first character and is a `-` (U+002D), and
|
|
28337
|
-
// there is no second character, […]
|
|
28338
|
-
index == 0 &&
|
|
28339
|
-
length == 1 &&
|
|
28340
|
-
codeUnit == 0x002D
|
|
28341
|
-
) {
|
|
28342
|
-
result += '\\' + string.charAt(index);
|
|
28343
|
-
continue;
|
|
28344
|
-
}
|
|
28345
|
-
|
|
28346
|
-
// If the character is not handled by one of the above rules and is
|
|
28347
|
-
// greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
|
|
28348
|
-
// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
|
|
28349
|
-
// U+005A), or [a-z] (U+0061 to U+007A), […]
|
|
28350
|
-
if (
|
|
28351
|
-
codeUnit >= 0x0080 ||
|
|
28352
|
-
codeUnit == 0x002D ||
|
|
28353
|
-
codeUnit == 0x005F ||
|
|
28354
|
-
codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
|
|
28355
|
-
codeUnit >= 0x0041 && codeUnit <= 0x005A ||
|
|
28356
|
-
codeUnit >= 0x0061 && codeUnit <= 0x007A
|
|
28357
|
-
) {
|
|
28358
|
-
// the character itself
|
|
28359
|
-
result += string.charAt(index);
|
|
28360
|
-
continue;
|
|
28361
|
-
}
|
|
28362
|
-
|
|
28363
|
-
// Otherwise, the escaped character.
|
|
28364
|
-
// https://drafts.csswg.org/cssom/#escape-a-character
|
|
28365
|
-
result += '\\' + string.charAt(index);
|
|
28366
|
-
|
|
28367
|
-
}
|
|
28368
|
-
return result;
|
|
28369
|
-
};
|
|
28370
|
-
|
|
28371
|
-
if (!root.CSS) {
|
|
28372
|
-
root.CSS = {};
|
|
28373
|
-
}
|
|
28374
|
-
|
|
28375
|
-
root.CSS.escape = cssEscape;
|
|
28376
|
-
return cssEscape;
|
|
28377
|
-
|
|
28378
|
-
}));
|
|
28379
|
-
}(css_escape));
|
|
28380
|
-
|
|
28381
|
-
var cssEscape = css_escape.exports;
|
|
28382
|
-
|
|
28383
|
-
var HTML_ESCAPE_MAP = {
|
|
28384
|
-
'&': '&',
|
|
28385
|
-
'<': '<',
|
|
28386
|
-
'>': '>',
|
|
28387
|
-
'"': '"',
|
|
28388
|
-
'\'': '''
|
|
28389
|
-
};
|
|
28390
|
-
|
|
28391
|
-
function escapeHTML(str) {
|
|
28392
|
-
str = '' + str;
|
|
28393
|
-
|
|
28394
|
-
return str && str.replace(/[&<>"']/g, function(match) {
|
|
28395
|
-
return HTML_ESCAPE_MAP[match];
|
|
28396
|
-
});
|
|
28397
|
-
}
|
|
28398
|
-
|
|
28399
28969
|
/**
|
|
28400
28970
|
* A service that adds editable bendpoints to connections.
|
|
28401
28971
|
*/
|
|
@@ -33456,23 +34026,13 @@
|
|
|
33456
34026
|
element = context.element;
|
|
33457
34027
|
|
|
33458
34028
|
var businessObject = descriptor.oldBusinessObject = getBusinessObject(element);
|
|
34029
|
+
var di = descriptor.oldDi = getDi(element);
|
|
33459
34030
|
|
|
33460
34031
|
descriptor.type = element.type;
|
|
33461
34032
|
|
|
33462
34033
|
copyProperties$1(businessObject, descriptor, 'name');
|
|
33463
34034
|
|
|
33464
|
-
|
|
33465
|
-
|
|
33466
|
-
// colors will be set to DI
|
|
33467
|
-
copyProperties$1(businessObject.di, descriptor.di, [
|
|
33468
|
-
'fill',
|
|
33469
|
-
'stroke',
|
|
33470
|
-
'background-color',
|
|
33471
|
-
'border-color',
|
|
33472
|
-
'color'
|
|
33473
|
-
]);
|
|
33474
|
-
|
|
33475
|
-
copyProperties$1(businessObject.di, descriptor, 'isExpanded');
|
|
34035
|
+
copyProperties$1(di, descriptor, 'isExpanded');
|
|
33476
34036
|
|
|
33477
34037
|
if (isLabel$3(descriptor)) {
|
|
33478
34038
|
return descriptor;
|
|
@@ -33546,11 +34106,13 @@
|
|
|
33546
34106
|
var cache = context.cache,
|
|
33547
34107
|
descriptor = context.descriptor,
|
|
33548
34108
|
oldBusinessObject = descriptor.oldBusinessObject,
|
|
33549
|
-
|
|
34109
|
+
oldDi = descriptor.oldDi,
|
|
34110
|
+
newBusinessObject, newDi;
|
|
33550
34111
|
|
|
33551
34112
|
// do NOT copy business object if external label
|
|
33552
34113
|
if (isLabel$3(descriptor)) {
|
|
33553
34114
|
descriptor.businessObject = getBusinessObject(cache[ descriptor.labelTarget ]);
|
|
34115
|
+
descriptor.di = getDi(cache[ descriptor.labelTarget ]);
|
|
33554
34116
|
|
|
33555
34117
|
return;
|
|
33556
34118
|
}
|
|
@@ -33562,6 +34124,13 @@
|
|
|
33562
34124
|
newBusinessObject
|
|
33563
34125
|
);
|
|
33564
34126
|
|
|
34127
|
+
newDi = bpmnFactory.create(oldDi.$type);
|
|
34128
|
+
|
|
34129
|
+
descriptor.di = moddleCopy.copyElement(
|
|
34130
|
+
oldDi,
|
|
34131
|
+
newDi
|
|
34132
|
+
);
|
|
34133
|
+
|
|
33565
34134
|
// resolve references e.g. default sequence flow
|
|
33566
34135
|
resolveReferences(descriptor, cache);
|
|
33567
34136
|
|
|
@@ -33953,6 +34522,7 @@
|
|
|
33953
34522
|
});
|
|
33954
34523
|
}
|
|
33955
34524
|
|
|
34525
|
+
|
|
33956
34526
|
var CUSTOM_PROPERTIES = [
|
|
33957
34527
|
'cancelActivity',
|
|
33958
34528
|
'instantiate',
|
|
@@ -33961,8 +34531,10 @@
|
|
|
33961
34531
|
'isInterrupting'
|
|
33962
34532
|
];
|
|
33963
34533
|
|
|
33964
|
-
|
|
33965
|
-
|
|
34534
|
+
/**
|
|
34535
|
+
* Check if element should be collapsed or expanded.
|
|
34536
|
+
*/
|
|
34537
|
+
function shouldToggleCollapsed(element, targetElement) {
|
|
33966
34538
|
|
|
33967
34539
|
var oldCollapsed = (
|
|
33968
34540
|
element && has(element, 'collapsed') ? element.collapsed : !isExpanded(element)
|
|
@@ -33970,11 +34542,11 @@
|
|
|
33970
34542
|
|
|
33971
34543
|
var targetCollapsed;
|
|
33972
34544
|
|
|
33973
|
-
if (
|
|
34545
|
+
if (targetElement && (has(targetElement, 'collapsed') || has(targetElement, 'isExpanded'))) {
|
|
33974
34546
|
|
|
33975
34547
|
// property is explicitly set so use it
|
|
33976
34548
|
targetCollapsed = (
|
|
33977
|
-
has(
|
|
34549
|
+
has(targetElement, 'collapsed') ? targetElement.collapsed : !targetElement.isExpanded
|
|
33978
34550
|
);
|
|
33979
34551
|
} else {
|
|
33980
34552
|
|
|
@@ -33983,7 +34555,6 @@
|
|
|
33983
34555
|
}
|
|
33984
34556
|
|
|
33985
34557
|
if (oldCollapsed !== targetCollapsed) {
|
|
33986
|
-
element.collapsed = oldCollapsed;
|
|
33987
34558
|
return true;
|
|
33988
34559
|
}
|
|
33989
34560
|
|
|
@@ -33991,7 +34562,6 @@
|
|
|
33991
34562
|
}
|
|
33992
34563
|
|
|
33993
34564
|
|
|
33994
|
-
|
|
33995
34565
|
/**
|
|
33996
34566
|
* This module takes care of replacing BPMN elements
|
|
33997
34567
|
*/
|
|
@@ -34022,15 +34592,13 @@
|
|
|
34022
34592
|
var type = target.type,
|
|
34023
34593
|
oldBusinessObject = element.businessObject;
|
|
34024
34594
|
|
|
34025
|
-
if (isSubProcess(oldBusinessObject)) {
|
|
34026
|
-
if (
|
|
34027
|
-
if (toggeling(element, target)) {
|
|
34595
|
+
if (isSubProcess(oldBusinessObject) && type === 'bpmn:SubProcess') {
|
|
34596
|
+
if (shouldToggleCollapsed(element, target)) {
|
|
34028
34597
|
|
|
34029
|
-
|
|
34030
|
-
|
|
34598
|
+
// expanding or collapsing process
|
|
34599
|
+
modeling.toggleCollapse(element);
|
|
34031
34600
|
|
|
34032
|
-
|
|
34033
|
-
}
|
|
34601
|
+
return element;
|
|
34034
34602
|
}
|
|
34035
34603
|
}
|
|
34036
34604
|
|
|
@@ -34038,9 +34606,20 @@
|
|
|
34038
34606
|
|
|
34039
34607
|
var newElement = {
|
|
34040
34608
|
type: type,
|
|
34041
|
-
businessObject: newBusinessObject
|
|
34609
|
+
businessObject: newBusinessObject,
|
|
34042
34610
|
};
|
|
34043
34611
|
|
|
34612
|
+
newElement.di = {};
|
|
34613
|
+
|
|
34614
|
+
// colors will be set to DI
|
|
34615
|
+
copyProperties(element.di, newElement.di, [
|
|
34616
|
+
'fill',
|
|
34617
|
+
'stroke',
|
|
34618
|
+
'background-color',
|
|
34619
|
+
'border-color',
|
|
34620
|
+
'color'
|
|
34621
|
+
]);
|
|
34622
|
+
|
|
34044
34623
|
var elementProps = getPropertyNames(oldBusinessObject.$descriptor),
|
|
34045
34624
|
newElementProps = getPropertyNames(newBusinessObject.$descriptor, true),
|
|
34046
34625
|
copyProps = intersection(elementProps, newElementProps);
|
|
@@ -34100,7 +34679,7 @@
|
|
|
34100
34679
|
if (isSubProcess(oldBusinessObject)) {
|
|
34101
34680
|
|
|
34102
34681
|
// no toggeling, so keep old state
|
|
34103
|
-
newElement.isExpanded = isExpanded(
|
|
34682
|
+
newElement.isExpanded = isExpanded(element);
|
|
34104
34683
|
}
|
|
34105
34684
|
|
|
34106
34685
|
// else if property is explicitly set, use it
|
|
@@ -34111,7 +34690,7 @@
|
|
|
34111
34690
|
// TODO: need also to respect min/max Size
|
|
34112
34691
|
// copy size, from an expanded subprocess to an expanded alternative subprocess
|
|
34113
34692
|
// except bpmn:Task, because Task is always expanded
|
|
34114
|
-
if ((isExpanded(
|
|
34693
|
+
if ((isExpanded(element) && !is$1(oldBusinessObject, 'bpmn:Task')) && newElement.isExpanded) {
|
|
34115
34694
|
newElement.width = element.width;
|
|
34116
34695
|
newElement.height = element.height;
|
|
34117
34696
|
}
|
|
@@ -34136,12 +34715,12 @@
|
|
|
34136
34715
|
|
|
34137
34716
|
// apply same width and default height
|
|
34138
34717
|
newElement.width = element.width;
|
|
34139
|
-
newElement.height = elementFactory.
|
|
34718
|
+
newElement.height = elementFactory.getDefaultSize(newElement).height;
|
|
34140
34719
|
}
|
|
34141
34720
|
|
|
34142
34721
|
if (!rules.allowed('shape.resize', { shape: newBusinessObject })) {
|
|
34143
|
-
newElement.height = elementFactory.
|
|
34144
|
-
newElement.width = elementFactory.
|
|
34722
|
+
newElement.height = elementFactory.getDefaultSize(newElement).height;
|
|
34723
|
+
newElement.width = elementFactory.getDefaultSize(newElement).width;
|
|
34145
34724
|
}
|
|
34146
34725
|
|
|
34147
34726
|
newBusinessObject.name = oldBusinessObject.name;
|
|
@@ -34179,16 +34758,6 @@
|
|
|
34179
34758
|
newElement.x = element.x + (element.width - newElement.width) / 2;
|
|
34180
34759
|
}
|
|
34181
34760
|
|
|
34182
|
-
newElement.di = {};
|
|
34183
|
-
|
|
34184
|
-
// colors will be set to DI
|
|
34185
|
-
copyProperties(oldBusinessObject.di, newElement.di, [
|
|
34186
|
-
'fill',
|
|
34187
|
-
'stroke',
|
|
34188
|
-
'background-color',
|
|
34189
|
-
'border-color',
|
|
34190
|
-
'color'
|
|
34191
|
-
]);
|
|
34192
34761
|
|
|
34193
34762
|
newElement = replace.replaceElement(element, newElement, hints);
|
|
34194
34763
|
|
|
@@ -34273,7 +34842,7 @@
|
|
|
34273
34842
|
|
|
34274
34843
|
var isExpandedEqual = (
|
|
34275
34844
|
target.isExpanded === undefined ||
|
|
34276
|
-
target.isExpanded === isExpanded(
|
|
34845
|
+
target.isExpanded === isExpanded(element)
|
|
34277
34846
|
);
|
|
34278
34847
|
|
|
34279
34848
|
return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual || !isExpandedEqual;
|
|
@@ -35210,7 +35779,7 @@
|
|
|
35210
35779
|
if (is$1(businessObject, 'bpmn:Participant')) {
|
|
35211
35780
|
|
|
35212
35781
|
entries = filter(PARTICIPANT, function(entry) {
|
|
35213
|
-
return isExpanded(
|
|
35782
|
+
return isExpanded(element) !== entry.target.isExpanded;
|
|
35214
35783
|
});
|
|
35215
35784
|
|
|
35216
35785
|
return this._createEntries(element, entries);
|
|
@@ -35306,7 +35875,7 @@
|
|
|
35306
35875
|
}
|
|
35307
35876
|
|
|
35308
35877
|
// expanded event sub processes
|
|
35309
|
-
if (isEventSubProcess(businessObject) && isExpanded(
|
|
35878
|
+
if (isEventSubProcess(businessObject) && isExpanded(element)) {
|
|
35310
35879
|
|
|
35311
35880
|
entries = filter(EVENT_SUB_PROCESS, differentType);
|
|
35312
35881
|
|
|
@@ -35314,7 +35883,7 @@
|
|
|
35314
35883
|
}
|
|
35315
35884
|
|
|
35316
35885
|
// expanded sub processes
|
|
35317
|
-
if (is$1(businessObject, 'bpmn:SubProcess') && isExpanded(
|
|
35886
|
+
if (is$1(businessObject, 'bpmn:SubProcess') && isExpanded(element)) {
|
|
35318
35887
|
|
|
35319
35888
|
entries = filter(SUBPROCESS_EXPANDED, differentType);
|
|
35320
35889
|
|
|
@@ -35322,7 +35891,7 @@
|
|
|
35322
35891
|
}
|
|
35323
35892
|
|
|
35324
35893
|
// collapsed ad hoc sub processes
|
|
35325
|
-
if (is$1(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(
|
|
35894
|
+
if (is$1(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
|
|
35326
35895
|
|
|
35327
35896
|
entries = filter(TASK, function(entry) {
|
|
35328
35897
|
|
|
@@ -35348,7 +35917,7 @@
|
|
|
35348
35917
|
entries = filter(TASK, differentType);
|
|
35349
35918
|
|
|
35350
35919
|
// collapsed SubProcess can not be replaced with itself
|
|
35351
|
-
if (is$1(businessObject, 'bpmn:SubProcess') && !isExpanded(
|
|
35920
|
+
if (is$1(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
|
|
35352
35921
|
entries = filter(entries, function(entry) {
|
|
35353
35922
|
return entry.label !== 'Sub Process (collapsed)';
|
|
35354
35923
|
});
|
|
@@ -36254,7 +36823,7 @@
|
|
|
36254
36823
|
}
|
|
36255
36824
|
|
|
36256
36825
|
|
|
36257
|
-
if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(
|
|
36826
|
+
if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
|
|
36258
36827
|
|
|
36259
36828
|
var childLanes = getChildLanes(element);
|
|
36260
36829
|
|
|
@@ -38481,75 +39050,6 @@
|
|
|
38481
39050
|
keyboardMoveSelection: [ 'type', KeyboardMoveSelection ]
|
|
38482
39051
|
};
|
|
38483
39052
|
|
|
38484
|
-
/**
|
|
38485
|
-
* Adds change support to the diagram, including
|
|
38486
|
-
*
|
|
38487
|
-
* <ul>
|
|
38488
|
-
* <li>redrawing shapes and connections on change</li>
|
|
38489
|
-
* </ul>
|
|
38490
|
-
*
|
|
38491
|
-
* @param {EventBus} eventBus
|
|
38492
|
-
* @param {Canvas} canvas
|
|
38493
|
-
* @param {ElementRegistry} elementRegistry
|
|
38494
|
-
* @param {GraphicsFactory} graphicsFactory
|
|
38495
|
-
*/
|
|
38496
|
-
function ChangeSupport(
|
|
38497
|
-
eventBus, canvas, elementRegistry,
|
|
38498
|
-
graphicsFactory) {
|
|
38499
|
-
|
|
38500
|
-
|
|
38501
|
-
// redraw shapes / connections on change
|
|
38502
|
-
|
|
38503
|
-
eventBus.on('element.changed', function(event) {
|
|
38504
|
-
|
|
38505
|
-
var element = event.element;
|
|
38506
|
-
|
|
38507
|
-
// element might have been deleted and replaced by new element with same ID
|
|
38508
|
-
// thus check for parent of element except for root element
|
|
38509
|
-
if (element.parent || element === canvas.getRootElement()) {
|
|
38510
|
-
event.gfx = elementRegistry.getGraphics(element);
|
|
38511
|
-
}
|
|
38512
|
-
|
|
38513
|
-
// shape + gfx may have been deleted
|
|
38514
|
-
if (!event.gfx) {
|
|
38515
|
-
return;
|
|
38516
|
-
}
|
|
38517
|
-
|
|
38518
|
-
eventBus.fire(getType(element) + '.changed', event);
|
|
38519
|
-
});
|
|
38520
|
-
|
|
38521
|
-
eventBus.on('elements.changed', function(event) {
|
|
38522
|
-
|
|
38523
|
-
var elements = event.elements;
|
|
38524
|
-
|
|
38525
|
-
elements.forEach(function(e) {
|
|
38526
|
-
eventBus.fire('element.changed', { element: e });
|
|
38527
|
-
});
|
|
38528
|
-
|
|
38529
|
-
graphicsFactory.updateContainments(elements);
|
|
38530
|
-
});
|
|
38531
|
-
|
|
38532
|
-
eventBus.on('shape.changed', function(event) {
|
|
38533
|
-
graphicsFactory.update('shape', event.element, event.gfx);
|
|
38534
|
-
});
|
|
38535
|
-
|
|
38536
|
-
eventBus.on('connection.changed', function(event) {
|
|
38537
|
-
graphicsFactory.update('connection', event.element, event.gfx);
|
|
38538
|
-
});
|
|
38539
|
-
}
|
|
38540
|
-
|
|
38541
|
-
ChangeSupport.$inject = [
|
|
38542
|
-
'eventBus',
|
|
38543
|
-
'canvas',
|
|
38544
|
-
'elementRegistry',
|
|
38545
|
-
'graphicsFactory'
|
|
38546
|
-
];
|
|
38547
|
-
|
|
38548
|
-
var ChangeSupportModule = {
|
|
38549
|
-
__init__: [ 'changeSupport'],
|
|
38550
|
-
changeSupport: [ 'type', ChangeSupport ]
|
|
38551
|
-
};
|
|
38552
|
-
|
|
38553
39053
|
var DEFAULT_MIN_WIDTH = 10;
|
|
38554
39054
|
|
|
38555
39055
|
|
|
@@ -39195,7 +39695,7 @@
|
|
|
39195
39695
|
|
|
39196
39696
|
function activateDirectEdit(element, force) {
|
|
39197
39697
|
if (force ||
|
|
39198
|
-
isAny(element, [ 'bpmn:Task', 'bpmn:TextAnnotation'
|
|
39698
|
+
isAny(element, [ 'bpmn:Task', 'bpmn:TextAnnotation' ]) ||
|
|
39199
39699
|
isCollapsedSubProcess(element)) {
|
|
39200
39700
|
|
|
39201
39701
|
directEditing.activate(element);
|
|
@@ -39641,9 +40141,9 @@
|
|
|
39641
40141
|
// helpers ///////////////////
|
|
39642
40142
|
|
|
39643
40143
|
function getStrokeColor(element, defaultColor) {
|
|
39644
|
-
var
|
|
40144
|
+
var di = getDi(element);
|
|
39645
40145
|
|
|
39646
|
-
return
|
|
40146
|
+
return di.get('stroke') || defaultColor || 'black';
|
|
39647
40147
|
}
|
|
39648
40148
|
|
|
39649
40149
|
var LabelEditingModule = {
|
|
@@ -40854,21 +41354,23 @@
|
|
|
40854
41354
|
|
|
40855
41355
|
UpdateSemanticParentHandler.prototype.execute = function(context) {
|
|
40856
41356
|
var dataStoreBo = context.dataStoreBo,
|
|
41357
|
+
dataStoreDi = context.dataStoreDi,
|
|
40857
41358
|
newSemanticParent = context.newSemanticParent,
|
|
40858
41359
|
newDiParent = context.newDiParent;
|
|
40859
41360
|
|
|
40860
41361
|
context.oldSemanticParent = dataStoreBo.$parent;
|
|
40861
|
-
context.oldDiParent =
|
|
41362
|
+
context.oldDiParent = dataStoreDi.$parent;
|
|
40862
41363
|
|
|
40863
41364
|
// update semantic parent
|
|
40864
41365
|
this._bpmnUpdater.updateSemanticParent(dataStoreBo, newSemanticParent);
|
|
40865
41366
|
|
|
40866
41367
|
// update DI parent
|
|
40867
|
-
this._bpmnUpdater.updateDiParent(
|
|
41368
|
+
this._bpmnUpdater.updateDiParent(dataStoreDi, newDiParent);
|
|
40868
41369
|
};
|
|
40869
41370
|
|
|
40870
41371
|
UpdateSemanticParentHandler.prototype.revert = function(context) {
|
|
40871
41372
|
var dataStoreBo = context.dataStoreBo,
|
|
41373
|
+
dataStoreDi = context.dataStoreDi,
|
|
40872
41374
|
oldSemanticParent = context.oldSemanticParent,
|
|
40873
41375
|
oldDiParent = context.oldDiParent;
|
|
40874
41376
|
|
|
@@ -40876,7 +41378,7 @@
|
|
|
40876
41378
|
this._bpmnUpdater.updateSemanticParent(dataStoreBo, oldSemanticParent);
|
|
40877
41379
|
|
|
40878
41380
|
// update DI parent
|
|
40879
|
-
this._bpmnUpdater.updateDiParent(
|
|
41381
|
+
this._bpmnUpdater.updateDiParent(dataStoreDi, oldDiParent);
|
|
40880
41382
|
};
|
|
40881
41383
|
|
|
40882
41384
|
/**
|
|
@@ -40912,8 +41414,9 @@
|
|
|
40912
41414
|
|
|
40913
41415
|
commandStack.execute('dataStore.updateContainment', {
|
|
40914
41416
|
dataStoreBo: dataStoreBo,
|
|
41417
|
+
dataStoreDi: getDi(dataStore),
|
|
40915
41418
|
newSemanticParent: newDataStoreParentBo.processRef || newDataStoreParentBo,
|
|
40916
|
-
newDiParent:
|
|
41419
|
+
newDiParent: getDi(newDataStoreParent)
|
|
40917
41420
|
});
|
|
40918
41421
|
}
|
|
40919
41422
|
}
|
|
@@ -41853,12 +42356,14 @@
|
|
|
41853
42356
|
];
|
|
41854
42357
|
|
|
41855
42358
|
this.executed([ 'shape.move', 'shape.create', 'shape.resize' ], function(event) {
|
|
41856
|
-
var
|
|
42359
|
+
var shape = event.context.shape,
|
|
42360
|
+
bo = getBusinessObject(shape),
|
|
42361
|
+
di = getDi(shape);
|
|
41857
42362
|
|
|
41858
|
-
if (isAny(bo, elementTypesToUpdate) && !
|
|
42363
|
+
if (isAny(bo, elementTypesToUpdate) && !di.get('isHorizontal')) {
|
|
41859
42364
|
|
|
41860
42365
|
// set attribute directly to avoid modeling#updateProperty side effects
|
|
41861
|
-
|
|
42366
|
+
di.set('isHorizontal', true);
|
|
41862
42367
|
}
|
|
41863
42368
|
});
|
|
41864
42369
|
|
|
@@ -42664,27 +43169,27 @@
|
|
|
42664
43169
|
|
|
42665
43170
|
var context = event.context,
|
|
42666
43171
|
element = context.shape,
|
|
42667
|
-
|
|
43172
|
+
labelTarget = context.labelTarget,
|
|
42668
43173
|
di;
|
|
42669
43174
|
|
|
42670
43175
|
// we want to trigger on real labels only
|
|
42671
|
-
if (!
|
|
43176
|
+
if (!labelTarget) {
|
|
42672
43177
|
return;
|
|
42673
43178
|
}
|
|
42674
43179
|
|
|
42675
43180
|
// we want to trigger on BPMN elements only
|
|
42676
|
-
if (!is$1(
|
|
43181
|
+
if (!is$1(labelTarget, 'bpmn:BaseElement')) {
|
|
42677
43182
|
return;
|
|
42678
43183
|
}
|
|
42679
43184
|
|
|
42680
|
-
|
|
42681
|
-
di = businessObject.di;
|
|
42682
|
-
|
|
43185
|
+
di = getDi(labelTarget);
|
|
42683
43186
|
|
|
42684
43187
|
if (!di.label) {
|
|
42685
43188
|
di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
|
|
42686
43189
|
bounds: bpmnFactory.create('dc:Bounds')
|
|
42687
43190
|
});
|
|
43191
|
+
|
|
43192
|
+
element.di = di;
|
|
42688
43193
|
}
|
|
42689
43194
|
|
|
42690
43195
|
assign(di.label.bounds, {
|
|
@@ -43970,11 +44475,11 @@
|
|
|
43970
44475
|
hideEmptyLabels(shape.children);
|
|
43971
44476
|
|
|
43972
44477
|
// remove collapsed marker
|
|
43973
|
-
|
|
44478
|
+
getDi(shape).isExpanded = true;
|
|
43974
44479
|
} else {
|
|
43975
44480
|
|
|
43976
44481
|
// place collapsed marker
|
|
43977
|
-
|
|
44482
|
+
getDi(shape).isExpanded = false;
|
|
43978
44483
|
}
|
|
43979
44484
|
});
|
|
43980
44485
|
|
|
@@ -43986,16 +44491,16 @@
|
|
|
43986
44491
|
|
|
43987
44492
|
// revert removing/placing collapsed marker
|
|
43988
44493
|
if (!shape.collapsed) {
|
|
43989
|
-
|
|
44494
|
+
getDi(shape).isExpanded = true;
|
|
43990
44495
|
|
|
43991
44496
|
} else {
|
|
43992
|
-
|
|
44497
|
+
getDi(shape).isExpanded = false;
|
|
43993
44498
|
}
|
|
43994
44499
|
});
|
|
43995
44500
|
|
|
43996
44501
|
this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY$8, function(e) {
|
|
43997
44502
|
var shape = e.context.shape,
|
|
43998
|
-
defaultSize = elementFactory.
|
|
44503
|
+
defaultSize = elementFactory.getDefaultSize(shape),
|
|
43999
44504
|
newBounds;
|
|
44000
44505
|
|
|
44001
44506
|
if (shape.collapsed) {
|
|
@@ -45301,7 +45806,7 @@
|
|
|
45301
45806
|
|
|
45302
45807
|
function orderDi() {
|
|
45303
45808
|
var root = canvas.getRootElement(),
|
|
45304
|
-
rootDi =
|
|
45809
|
+
rootDi = getDi(root),
|
|
45305
45810
|
elements,
|
|
45306
45811
|
diElements;
|
|
45307
45812
|
|
|
@@ -48062,11 +48567,10 @@
|
|
|
48062
48567
|
};
|
|
48063
48568
|
|
|
48064
48569
|
|
|
48065
|
-
BpmnFactory.prototype.createDiShape = function(semantic,
|
|
48066
|
-
|
|
48570
|
+
BpmnFactory.prototype.createDiShape = function(semantic, attrs) {
|
|
48067
48571
|
return this.create('bpmndi:BPMNShape', assign({
|
|
48068
48572
|
bpmnElement: semantic,
|
|
48069
|
-
bounds: this.createDiBounds(
|
|
48573
|
+
bounds: this.createDiBounds()
|
|
48070
48574
|
}, attrs));
|
|
48071
48575
|
};
|
|
48072
48576
|
|
|
@@ -48089,16 +48593,17 @@
|
|
|
48089
48593
|
};
|
|
48090
48594
|
|
|
48091
48595
|
|
|
48092
|
-
BpmnFactory.prototype.createDiEdge = function(semantic,
|
|
48596
|
+
BpmnFactory.prototype.createDiEdge = function(semantic, attrs) {
|
|
48093
48597
|
return this.create('bpmndi:BPMNEdge', assign({
|
|
48094
|
-
bpmnElement: semantic
|
|
48598
|
+
bpmnElement: semantic,
|
|
48599
|
+
waypoint: this.createDiWaypoints([])
|
|
48095
48600
|
}, attrs));
|
|
48096
48601
|
};
|
|
48097
48602
|
|
|
48098
|
-
BpmnFactory.prototype.createDiPlane = function(semantic) {
|
|
48099
|
-
return this.create('bpmndi:BPMNPlane', {
|
|
48603
|
+
BpmnFactory.prototype.createDiPlane = function(semantic, attrs) {
|
|
48604
|
+
return this.create('bpmndi:BPMNPlane', assign({
|
|
48100
48605
|
bpmnElement: semantic
|
|
48101
|
-
});
|
|
48606
|
+
}, attrs));
|
|
48102
48607
|
};
|
|
48103
48608
|
|
|
48104
48609
|
/**
|
|
@@ -48383,8 +48888,9 @@
|
|
|
48383
48888
|
var parentShape = element.parent;
|
|
48384
48889
|
|
|
48385
48890
|
var businessObject = element.businessObject,
|
|
48891
|
+
di = getDi(element),
|
|
48386
48892
|
parentBusinessObject = parentShape && parentShape.businessObject,
|
|
48387
|
-
parentDi =
|
|
48893
|
+
parentDi = getDi(parentShape);
|
|
48388
48894
|
|
|
48389
48895
|
if (is$1(element, 'bpmn:FlowNode')) {
|
|
48390
48896
|
this.updateFlowNodeRefs(businessObject, parentBusinessObject, oldParent && oldParent.businessObject);
|
|
@@ -48412,13 +48918,13 @@
|
|
|
48412
48918
|
this.updateSemanticParent(businessObject.dataObjectRef, parentBusinessObject);
|
|
48413
48919
|
}
|
|
48414
48920
|
|
|
48415
|
-
this.updateDiParent(
|
|
48921
|
+
this.updateDiParent(di, parentDi);
|
|
48416
48922
|
};
|
|
48417
48923
|
|
|
48418
48924
|
|
|
48419
48925
|
BpmnUpdater.prototype.updateBounds = function(shape) {
|
|
48420
48926
|
|
|
48421
|
-
var di = shape
|
|
48927
|
+
var di = getDi(shape);
|
|
48422
48928
|
|
|
48423
48929
|
var target = (shape instanceof Label) ? this._getLabel(di) : di;
|
|
48424
48930
|
|
|
@@ -48458,14 +48964,17 @@
|
|
|
48458
48964
|
|
|
48459
48965
|
|
|
48460
48966
|
// update existing sourceElement and targetElement di information
|
|
48461
|
-
BpmnUpdater.prototype.updateDiConnection = function(
|
|
48967
|
+
BpmnUpdater.prototype.updateDiConnection = function(connection, newSource, newTarget) {
|
|
48968
|
+
var connectionDi = getDi(connection),
|
|
48969
|
+
newSourceDi = getDi(newSource),
|
|
48970
|
+
newTargetDi = getDi(newTarget);
|
|
48462
48971
|
|
|
48463
|
-
if (
|
|
48464
|
-
|
|
48972
|
+
if (connectionDi.sourceElement && connectionDi.sourceElement.bpmnElement !== getBusinessObject(newSource)) {
|
|
48973
|
+
connectionDi.sourceElement = newSource && newSourceDi;
|
|
48465
48974
|
}
|
|
48466
48975
|
|
|
48467
|
-
if (
|
|
48468
|
-
|
|
48976
|
+
if (connectionDi.targetElement && connectionDi.targetElement.bpmnElement !== getBusinessObject(newTarget)) {
|
|
48977
|
+
connectionDi.targetElement = newTarget && newTargetDi;
|
|
48469
48978
|
}
|
|
48470
48979
|
|
|
48471
48980
|
};
|
|
@@ -48690,69 +49199,72 @@
|
|
|
48690
49199
|
|
|
48691
49200
|
|
|
48692
49201
|
BpmnUpdater.prototype.updateConnectionWaypoints = function(connection) {
|
|
48693
|
-
|
|
49202
|
+
var di = getDi(connection);
|
|
49203
|
+
|
|
49204
|
+
di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
|
|
48694
49205
|
};
|
|
48695
49206
|
|
|
48696
49207
|
|
|
48697
49208
|
BpmnUpdater.prototype.updateConnection = function(context) {
|
|
48698
|
-
|
|
48699
49209
|
var connection = context.connection,
|
|
48700
49210
|
businessObject = getBusinessObject(connection),
|
|
48701
|
-
newSource =
|
|
48702
|
-
|
|
49211
|
+
newSource = connection.source,
|
|
49212
|
+
newSourceBo = getBusinessObject(newSource),
|
|
49213
|
+
newTarget = connection.target,
|
|
49214
|
+
newTargetBo = getBusinessObject(connection.target),
|
|
48703
49215
|
visualParent;
|
|
48704
49216
|
|
|
48705
49217
|
if (!is$1(businessObject, 'bpmn:DataAssociation')) {
|
|
48706
49218
|
|
|
48707
49219
|
var inverseSet = is$1(businessObject, 'bpmn:SequenceFlow');
|
|
48708
49220
|
|
|
48709
|
-
if (businessObject.sourceRef !==
|
|
49221
|
+
if (businessObject.sourceRef !== newSourceBo) {
|
|
48710
49222
|
if (inverseSet) {
|
|
48711
49223
|
remove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
|
|
48712
49224
|
|
|
48713
|
-
if (
|
|
48714
|
-
|
|
49225
|
+
if (newSourceBo && newSourceBo.get('outgoing')) {
|
|
49226
|
+
newSourceBo.get('outgoing').push(businessObject);
|
|
48715
49227
|
}
|
|
48716
49228
|
}
|
|
48717
49229
|
|
|
48718
|
-
businessObject.sourceRef =
|
|
49230
|
+
businessObject.sourceRef = newSourceBo;
|
|
48719
49231
|
}
|
|
48720
49232
|
|
|
48721
|
-
if (businessObject.targetRef !==
|
|
49233
|
+
if (businessObject.targetRef !== newTargetBo) {
|
|
48722
49234
|
if (inverseSet) {
|
|
48723
49235
|
remove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
|
|
48724
49236
|
|
|
48725
|
-
if (
|
|
48726
|
-
|
|
49237
|
+
if (newTargetBo && newTargetBo.get('incoming')) {
|
|
49238
|
+
newTargetBo.get('incoming').push(businessObject);
|
|
48727
49239
|
}
|
|
48728
49240
|
}
|
|
48729
49241
|
|
|
48730
|
-
businessObject.targetRef =
|
|
49242
|
+
businessObject.targetRef = newTargetBo;
|
|
48731
49243
|
}
|
|
48732
49244
|
} else
|
|
48733
49245
|
|
|
48734
49246
|
if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
|
|
48735
49247
|
|
|
48736
49248
|
// handle obnoxious isMsome sourceRef
|
|
48737
|
-
businessObject.get('sourceRef')[0] =
|
|
49249
|
+
businessObject.get('sourceRef')[0] = newSourceBo;
|
|
48738
49250
|
|
|
48739
|
-
visualParent = context.parent || context.newParent ||
|
|
49251
|
+
visualParent = context.parent || context.newParent || newTargetBo;
|
|
48740
49252
|
|
|
48741
|
-
this.updateSemanticParent(businessObject,
|
|
49253
|
+
this.updateSemanticParent(businessObject, newTargetBo, visualParent);
|
|
48742
49254
|
} else
|
|
48743
49255
|
|
|
48744
49256
|
if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
|
|
48745
|
-
visualParent = context.parent || context.newParent ||
|
|
49257
|
+
visualParent = context.parent || context.newParent || newSourceBo;
|
|
48746
49258
|
|
|
48747
|
-
this.updateSemanticParent(businessObject,
|
|
49259
|
+
this.updateSemanticParent(businessObject, newSourceBo, visualParent);
|
|
48748
49260
|
|
|
48749
49261
|
// targetRef = new target
|
|
48750
|
-
businessObject.targetRef =
|
|
49262
|
+
businessObject.targetRef = newTargetBo;
|
|
48751
49263
|
}
|
|
48752
49264
|
|
|
48753
49265
|
this.updateConnectionWaypoints(connection);
|
|
48754
49266
|
|
|
48755
|
-
this.updateDiConnection(
|
|
49267
|
+
this.updateDiConnection(connection, newSource, newTarget);
|
|
48756
49268
|
};
|
|
48757
49269
|
|
|
48758
49270
|
|
|
@@ -48814,7 +49326,8 @@
|
|
|
48814
49326
|
// we assume their businessObjects have already been created
|
|
48815
49327
|
// and wired via attrs
|
|
48816
49328
|
if (elementType === 'label') {
|
|
48817
|
-
|
|
49329
|
+
var di = attrs.di || this._bpmnFactory.createDiLabel();
|
|
49330
|
+
return this.baseCreate(elementType, assign({ type: 'label', di: di }, DEFAULT_LABEL_SIZE, attrs));
|
|
48818
49331
|
}
|
|
48819
49332
|
|
|
48820
49333
|
return this.createBpmnElement(elementType, attrs);
|
|
@@ -48826,7 +49339,8 @@
|
|
|
48826
49339
|
|
|
48827
49340
|
attrs = attrs || {};
|
|
48828
49341
|
|
|
48829
|
-
var businessObject = attrs.businessObject
|
|
49342
|
+
var businessObject = attrs.businessObject,
|
|
49343
|
+
di = attrs.di;
|
|
48830
49344
|
|
|
48831
49345
|
if (!businessObject) {
|
|
48832
49346
|
if (!attrs.type) {
|
|
@@ -48834,22 +49348,23 @@
|
|
|
48834
49348
|
}
|
|
48835
49349
|
|
|
48836
49350
|
businessObject = this._bpmnFactory.create(attrs.type);
|
|
49351
|
+
|
|
49352
|
+
ensureCompatDiRef(businessObject);
|
|
48837
49353
|
}
|
|
48838
49354
|
|
|
48839
|
-
if (!
|
|
49355
|
+
if (!isModdleDi(di)) {
|
|
49356
|
+
var diAttrs = assign(
|
|
49357
|
+
di || {},
|
|
49358
|
+
{ id: businessObject.id + '_di' }
|
|
49359
|
+
);
|
|
49360
|
+
|
|
48840
49361
|
if (elementType === 'root') {
|
|
48841
|
-
|
|
48842
|
-
id: businessObject.id + '_di'
|
|
48843
|
-
});
|
|
49362
|
+
di = this._bpmnFactory.createDiPlane(businessObject, diAttrs);
|
|
48844
49363
|
} else
|
|
48845
49364
|
if (elementType === 'connection') {
|
|
48846
|
-
|
|
48847
|
-
id: businessObject.id + '_di'
|
|
48848
|
-
});
|
|
49365
|
+
di = this._bpmnFactory.createDiEdge(businessObject, diAttrs);
|
|
48849
49366
|
} else {
|
|
48850
|
-
|
|
48851
|
-
id: businessObject.id + '_di'
|
|
48852
|
-
});
|
|
49367
|
+
di = this._bpmnFactory.createDiShape(businessObject, diAttrs);
|
|
48853
49368
|
}
|
|
48854
49369
|
}
|
|
48855
49370
|
|
|
@@ -48859,12 +49374,6 @@
|
|
|
48859
49374
|
}, attrs);
|
|
48860
49375
|
}
|
|
48861
49376
|
|
|
48862
|
-
if (attrs.di) {
|
|
48863
|
-
assign(businessObject.di, attrs.di);
|
|
48864
|
-
|
|
48865
|
-
delete attrs.di;
|
|
48866
|
-
}
|
|
48867
|
-
|
|
48868
49377
|
applyAttributes(businessObject, attrs, [
|
|
48869
49378
|
'processRef',
|
|
48870
49379
|
'isInterrupting',
|
|
@@ -48873,11 +49382,15 @@
|
|
|
48873
49382
|
]);
|
|
48874
49383
|
|
|
48875
49384
|
if (attrs.isExpanded) {
|
|
48876
|
-
applyAttribute(
|
|
49385
|
+
applyAttribute(di, attrs, 'isExpanded');
|
|
49386
|
+
}
|
|
49387
|
+
|
|
49388
|
+
if (is$1(businessObject, 'bpmn:SubProcess')) {
|
|
49389
|
+
attrs.collapsed = !isExpanded(businessObject, di);
|
|
48877
49390
|
}
|
|
48878
49391
|
|
|
48879
49392
|
if (is$1(businessObject, 'bpmn:ExclusiveGateway')) {
|
|
48880
|
-
|
|
49393
|
+
di.isMarkerVisible = true;
|
|
48881
49394
|
}
|
|
48882
49395
|
|
|
48883
49396
|
var eventDefinitions,
|
|
@@ -48899,65 +49412,69 @@
|
|
|
48899
49412
|
delete attrs.eventDefinitionType;
|
|
48900
49413
|
}
|
|
48901
49414
|
|
|
48902
|
-
size = this.
|
|
49415
|
+
size = this.getDefaultSize(businessObject, di);
|
|
48903
49416
|
|
|
48904
49417
|
attrs = assign({
|
|
48905
|
-
businessObject: businessObject,
|
|
48906
49418
|
id: businessObject.id
|
|
48907
|
-
}, size, attrs
|
|
49419
|
+
}, size, attrs, {
|
|
49420
|
+
businessObject: businessObject,
|
|
49421
|
+
di: di
|
|
49422
|
+
});
|
|
48908
49423
|
|
|
48909
49424
|
return this.baseCreate(elementType, attrs);
|
|
48910
49425
|
};
|
|
48911
49426
|
|
|
48912
49427
|
|
|
48913
|
-
ElementFactory.prototype.
|
|
49428
|
+
ElementFactory.prototype.getDefaultSize = function(element, di) {
|
|
48914
49429
|
|
|
48915
|
-
|
|
49430
|
+
var bo = getBusinessObject(element);
|
|
49431
|
+
di = di || getDi(element);
|
|
48916
49432
|
|
|
48917
|
-
|
|
49433
|
+
if (is$1(bo, 'bpmn:SubProcess')) {
|
|
49434
|
+
if (isExpanded(bo, di)) {
|
|
48918
49435
|
return { width: 350, height: 200 };
|
|
48919
49436
|
} else {
|
|
48920
49437
|
return { width: 100, height: 80 };
|
|
48921
49438
|
}
|
|
48922
49439
|
}
|
|
48923
49440
|
|
|
48924
|
-
if (is$1(
|
|
49441
|
+
if (is$1(bo, 'bpmn:Task')) {
|
|
48925
49442
|
return { width: 100, height: 80 };
|
|
48926
49443
|
}
|
|
48927
49444
|
|
|
48928
|
-
if (is$1(
|
|
49445
|
+
if (is$1(bo, 'bpmn:Gateway')) {
|
|
48929
49446
|
return { width: 50, height: 50 };
|
|
48930
49447
|
}
|
|
48931
49448
|
|
|
48932
|
-
if (is$1(
|
|
49449
|
+
if (is$1(bo, 'bpmn:Event')) {
|
|
48933
49450
|
return { width: 36, height: 36 };
|
|
48934
49451
|
}
|
|
48935
49452
|
|
|
48936
|
-
if (is$1(
|
|
48937
|
-
if (isExpanded(
|
|
49453
|
+
if (is$1(bo, 'bpmn:Participant')) {
|
|
49454
|
+
if (isExpanded(bo, di)) {
|
|
48938
49455
|
return { width: 600, height: 250 };
|
|
48939
49456
|
} else {
|
|
48940
49457
|
return { width: 400, height: 60 };
|
|
48941
49458
|
}
|
|
48942
49459
|
}
|
|
48943
49460
|
|
|
48944
|
-
if (is$1(
|
|
49461
|
+
if (is$1(bo, 'bpmn:Lane')) {
|
|
48945
49462
|
return { width: 400, height: 100 };
|
|
48946
49463
|
}
|
|
48947
49464
|
|
|
48948
|
-
if (is$1(
|
|
49465
|
+
if (is$1(bo, 'bpmn:DataObjectReference')) {
|
|
48949
49466
|
return { width: 36, height: 50 };
|
|
48950
49467
|
}
|
|
48951
49468
|
|
|
48952
|
-
if (is$1(
|
|
49469
|
+
if (is$1(bo, 'bpmn:DataStoreReference')) {
|
|
48953
49470
|
return { width: 50, height: 50 };
|
|
48954
49471
|
}
|
|
48955
49472
|
|
|
48956
|
-
if (is$1(
|
|
49473
|
+
if (is$1(bo, 'bpmn:TextAnnotation')) {
|
|
48957
49474
|
return { width: 100, height: 30 };
|
|
48958
49475
|
}
|
|
48959
49476
|
|
|
48960
|
-
if (is$1(
|
|
49477
|
+
if (is$1(bo, 'bpmn:Group')) {
|
|
48961
49478
|
return { width: 300, height: 300 };
|
|
48962
49479
|
}
|
|
48963
49480
|
|
|
@@ -49022,6 +49539,16 @@
|
|
|
49022
49539
|
delete attrs[attributeName];
|
|
49023
49540
|
}
|
|
49024
49541
|
|
|
49542
|
+
|
|
49543
|
+
function isModdleDi(element) {
|
|
49544
|
+
return isAny(element, [
|
|
49545
|
+
'bpmndi:BPMNShape',
|
|
49546
|
+
'bpmndi:BPMNEdge',
|
|
49547
|
+
'bpmndi:BPMNDiagram',
|
|
49548
|
+
'bpmndi:BPMNPlane',
|
|
49549
|
+
]);
|
|
49550
|
+
}
|
|
49551
|
+
|
|
49025
49552
|
/**
|
|
49026
49553
|
* A handler that align elements in a certain way.
|
|
49027
49554
|
*
|
|
@@ -51489,7 +52016,7 @@
|
|
|
51489
52016
|
|
|
51490
52017
|
var businessObject = element.businessObject,
|
|
51491
52018
|
properties = unwrapBusinessObjects(context.properties),
|
|
51492
|
-
oldProperties = context.oldProperties || getProperties(
|
|
52019
|
+
oldProperties = context.oldProperties || getProperties(element, properties);
|
|
51493
52020
|
|
|
51494
52021
|
if (isIdChange(properties, businessObject)) {
|
|
51495
52022
|
ids.unclaim(businessObject[ID]);
|
|
@@ -51512,7 +52039,7 @@
|
|
|
51512
52039
|
}
|
|
51513
52040
|
|
|
51514
52041
|
// update properties
|
|
51515
|
-
setProperties(
|
|
52042
|
+
setProperties(element, properties);
|
|
51516
52043
|
|
|
51517
52044
|
// store old values
|
|
51518
52045
|
context.oldProperties = oldProperties;
|
|
@@ -51557,7 +52084,7 @@
|
|
|
51557
52084
|
ids = this._moddle.ids;
|
|
51558
52085
|
|
|
51559
52086
|
// update properties
|
|
51560
|
-
setProperties(
|
|
52087
|
+
setProperties(element, oldProperties);
|
|
51561
52088
|
|
|
51562
52089
|
if (isIdChange(properties, businessObject)) {
|
|
51563
52090
|
ids.unclaim(properties[ID]);
|
|
@@ -51576,16 +52103,19 @@
|
|
|
51576
52103
|
}
|
|
51577
52104
|
|
|
51578
52105
|
|
|
51579
|
-
function getProperties(
|
|
51580
|
-
var propertyNames = keys(properties)
|
|
52106
|
+
function getProperties(element, properties) {
|
|
52107
|
+
var propertyNames = keys(properties),
|
|
52108
|
+
businessObject = element.businessObject,
|
|
52109
|
+
di = getDi(element);
|
|
51581
52110
|
|
|
51582
52111
|
return reduce(propertyNames, function(result, key) {
|
|
51583
52112
|
|
|
51584
52113
|
// handle DI separately
|
|
51585
52114
|
if (key !== DI) {
|
|
51586
52115
|
result[key] = businessObject.get(key);
|
|
52116
|
+
|
|
51587
52117
|
} else {
|
|
51588
|
-
result[key] = getDiProperties(
|
|
52118
|
+
result[key] = getDiProperties(di, keys(properties.di));
|
|
51589
52119
|
}
|
|
51590
52120
|
|
|
51591
52121
|
return result;
|
|
@@ -51595,23 +52125,26 @@
|
|
|
51595
52125
|
|
|
51596
52126
|
function getDiProperties(di, propertyNames) {
|
|
51597
52127
|
return reduce(propertyNames, function(result, key) {
|
|
51598
|
-
result[key] = di.get(key);
|
|
52128
|
+
result[key] = di && di.get(key);
|
|
51599
52129
|
|
|
51600
52130
|
return result;
|
|
51601
52131
|
}, {});
|
|
51602
52132
|
}
|
|
51603
52133
|
|
|
51604
52134
|
|
|
51605
|
-
function setProperties(
|
|
52135
|
+
function setProperties(element, properties) {
|
|
52136
|
+
var businessObject = element.businessObject,
|
|
52137
|
+
di = getDi(element);
|
|
52138
|
+
|
|
51606
52139
|
forEach(properties, function(value, key) {
|
|
51607
52140
|
|
|
51608
52141
|
if (key !== DI) {
|
|
51609
52142
|
businessObject.set(key, value);
|
|
51610
52143
|
} else {
|
|
51611
52144
|
|
|
51612
|
-
// only update, if
|
|
51613
|
-
if (
|
|
51614
|
-
setDiProperties(
|
|
52145
|
+
// only update, if di exists
|
|
52146
|
+
if (di) {
|
|
52147
|
+
setDiProperties(di, value);
|
|
51615
52148
|
}
|
|
51616
52149
|
}
|
|
51617
52150
|
});
|
|
@@ -51669,10 +52202,11 @@
|
|
|
51669
52202
|
oldRoot = canvas.getRootElement(),
|
|
51670
52203
|
oldRootBusinessObject = oldRoot.businessObject,
|
|
51671
52204
|
bpmnDefinitions = oldRootBusinessObject.$parent,
|
|
51672
|
-
diPlane =
|
|
52205
|
+
diPlane = getDi(oldRoot);
|
|
51673
52206
|
|
|
51674
52207
|
// (1) replace process old <> new root
|
|
51675
|
-
canvas.setRootElement(newRoot
|
|
52208
|
+
canvas.setRootElement(newRoot);
|
|
52209
|
+
canvas.removeRootElement(oldRoot);
|
|
51676
52210
|
|
|
51677
52211
|
// (2) update root elements
|
|
51678
52212
|
add(bpmnDefinitions.rootElements, newRootBusinessObject);
|
|
@@ -51682,10 +52216,10 @@
|
|
|
51682
52216
|
oldRootBusinessObject.$parent = null;
|
|
51683
52217
|
|
|
51684
52218
|
// (3) wire di
|
|
51685
|
-
|
|
52219
|
+
oldRoot.di = null;
|
|
51686
52220
|
|
|
51687
52221
|
diPlane.bpmnElement = newRootBusinessObject;
|
|
51688
|
-
|
|
52222
|
+
newRoot.di = diPlane;
|
|
51689
52223
|
|
|
51690
52224
|
context.oldRoot = oldRoot;
|
|
51691
52225
|
|
|
@@ -51703,10 +52237,11 @@
|
|
|
51703
52237
|
oldRoot = context.oldRoot,
|
|
51704
52238
|
oldRootBusinessObject = oldRoot.businessObject,
|
|
51705
52239
|
bpmnDefinitions = newRootBusinessObject.$parent,
|
|
51706
|
-
diPlane =
|
|
52240
|
+
diPlane = getDi(newRoot);
|
|
51707
52241
|
|
|
51708
52242
|
// (1) replace process old <> new root
|
|
51709
|
-
canvas.setRootElement(oldRoot
|
|
52243
|
+
canvas.setRootElement(oldRoot);
|
|
52244
|
+
canvas.removeRootElement(newRoot);
|
|
51710
52245
|
|
|
51711
52246
|
// (2) update root elements
|
|
51712
52247
|
remove(bpmnDefinitions.rootElements, newRootBusinessObject);
|
|
@@ -51716,10 +52251,10 @@
|
|
|
51716
52251
|
oldRootBusinessObject.$parent = bpmnDefinitions;
|
|
51717
52252
|
|
|
51718
52253
|
// (3) wire di
|
|
51719
|
-
|
|
52254
|
+
newRoot.di = null;
|
|
51720
52255
|
|
|
51721
52256
|
diPlane.bpmnElement = oldRootBusinessObject;
|
|
51722
|
-
|
|
52257
|
+
oldRoot.di = diPlane;
|
|
51723
52258
|
|
|
51724
52259
|
// TODO(nikku): return changed elements?
|
|
51725
52260
|
// return [ newRoot, oldRoot ];
|
|
@@ -52276,12 +52811,26 @@
|
|
|
52276
52811
|
// TODO @barmac: remove once we drop bpmn.io properties
|
|
52277
52812
|
ensureLegacySupport(assignedDi);
|
|
52278
52813
|
|
|
52279
|
-
|
|
52280
|
-
|
|
52281
|
-
|
|
52282
|
-
|
|
52283
|
-
|
|
52284
|
-
|
|
52814
|
+
if (element.labelTarget) {
|
|
52815
|
+
|
|
52816
|
+
// set label colors as bpmndi:BPMNLabel#color
|
|
52817
|
+
self._commandStack.execute('element.updateModdleProperties', {
|
|
52818
|
+
element: element,
|
|
52819
|
+
moddleElement: getDi(element).label,
|
|
52820
|
+
properties: {
|
|
52821
|
+
color: di['background-color']
|
|
52822
|
+
}
|
|
52823
|
+
});
|
|
52824
|
+
} else {
|
|
52825
|
+
|
|
52826
|
+
// set colors bpmndi:BPMNEdge or bpmndi:BPMNShape
|
|
52827
|
+
self._commandStack.execute('element.updateProperties', {
|
|
52828
|
+
element: element,
|
|
52829
|
+
properties: {
|
|
52830
|
+
di: assignedDi
|
|
52831
|
+
}
|
|
52832
|
+
});
|
|
52833
|
+
}
|
|
52285
52834
|
});
|
|
52286
52835
|
|
|
52287
52836
|
};
|
|
@@ -52388,7 +52937,8 @@
|
|
|
52388
52937
|
|
|
52389
52938
|
modeling.createLabel(element, labelCenter, {
|
|
52390
52939
|
id: businessObject.id + '_label',
|
|
52391
|
-
businessObject: businessObject
|
|
52940
|
+
businessObject: businessObject,
|
|
52941
|
+
di: element.di
|
|
52392
52942
|
});
|
|
52393
52943
|
}
|
|
52394
52944
|
}
|
|
@@ -54391,7 +54941,9 @@
|
|
|
54391
54941
|
ENTRY_SELECTOR = '.entry',
|
|
54392
54942
|
ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
|
|
54393
54943
|
|
|
54394
|
-
var
|
|
54944
|
+
var PALETTE_PREFIX = 'djs-palette-',
|
|
54945
|
+
PALETTE_SHOWN_CLS = 'shown',
|
|
54946
|
+
PALETTE_OPEN_CLS = 'open',
|
|
54395
54947
|
PALETTE_TWO_COLUMN_CLS = 'two-column';
|
|
54396
54948
|
|
|
54397
54949
|
var DEFAULT_PRIORITY = 1000;
|
|
@@ -54509,6 +55061,7 @@
|
|
|
54509
55061
|
var container = this._container = domify(Palette.HTML_MARKUP);
|
|
54510
55062
|
|
|
54511
55063
|
parentContainer.appendChild(container);
|
|
55064
|
+
classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
|
|
54512
55065
|
|
|
54513
55066
|
delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
|
|
54514
55067
|
|
|
@@ -54566,7 +55119,8 @@
|
|
|
54566
55119
|
|
|
54567
55120
|
var twoColumn;
|
|
54568
55121
|
|
|
54569
|
-
var cls = classes$1(container)
|
|
55122
|
+
var cls = classes$1(container),
|
|
55123
|
+
parentCls = classes$1(parent);
|
|
54570
55124
|
|
|
54571
55125
|
if ('twoColumn' in state) {
|
|
54572
55126
|
twoColumn = state.twoColumn;
|
|
@@ -54576,9 +55130,11 @@
|
|
|
54576
55130
|
|
|
54577
55131
|
// always update two column
|
|
54578
55132
|
cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
|
|
55133
|
+
parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
|
|
54579
55134
|
|
|
54580
55135
|
if ('open' in state) {
|
|
54581
55136
|
cls.toggle(PALETTE_OPEN_CLS, state.open);
|
|
55137
|
+
parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
|
|
54582
55138
|
}
|
|
54583
55139
|
|
|
54584
55140
|
eventBus.fire('palette.changed', {
|
|
@@ -55449,7 +56005,8 @@
|
|
|
55449
56005
|
var shape = elementFactory.createShape(assign({ type: type }, options));
|
|
55450
56006
|
|
|
55451
56007
|
if (options) {
|
|
55452
|
-
|
|
56008
|
+
var di = getDi(shape);
|
|
56009
|
+
di.isExpanded = options.isExpanded;
|
|
55453
56010
|
}
|
|
55454
56011
|
|
|
55455
56012
|
create.start(event, shape);
|
|
@@ -55485,7 +56042,7 @@
|
|
|
55485
56042
|
|
|
55486
56043
|
create.start(event, [ subProcess, startEvent ], {
|
|
55487
56044
|
hints: {
|
|
55488
|
-
autoSelect: [
|
|
56045
|
+
autoSelect: [ subProcess ]
|
|
55489
56046
|
}
|
|
55490
56047
|
});
|
|
55491
56048
|
}
|