camunda-bpmn-js 0.11.3 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/assets/properties-panel.css +780 -0
  3. package/dist/base-modeler.development.js +383 -104
  4. package/dist/base-modeler.production.min.js +3 -3
  5. package/dist/camunda-cloud-modeler.development.js +952 -609
  6. package/dist/camunda-cloud-modeler.production.min.js +3 -3
  7. package/dist/camunda-platform-modeler.development.js +561 -374
  8. package/dist/camunda-platform-modeler.production.min.js +3 -3
  9. package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +112 -0
  10. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +51 -55
  11. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +56 -59
  12. package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +69 -127
  13. package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +76 -128
  14. package/lib/camunda-cloud/features/modeling/behavior/index.js +3 -0
  15. package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutput.js +21 -7
  16. package/lib/camunda-cloud/features/rules/BpmnRules.js +1 -1
  17. package/lib/camunda-cloud/helper/CalledElementHelper.js +43 -41
  18. package/lib/camunda-cloud/helper/FormsHelper.js +38 -50
  19. package/lib/camunda-cloud/helper/InputOutputHelper.js +92 -106
  20. package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +24 -47
  21. package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +39 -81
  22. package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +31 -65
  23. package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +42 -76
  24. package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +21 -26
  25. package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +16 -10
  26. package/lib/camunda-platform/helper/InputOutputHelper.js +29 -0
  27. package/package.json +6 -6
@@ -4512,6 +4512,14 @@
4512
4512
  return isNumber(number) ? number + 'px' : number;
4513
4513
  }
4514
4514
 
4515
+ function findRoot(element) {
4516
+ while (element.parent) {
4517
+ element = element.parent;
4518
+ }
4519
+
4520
+ return element;
4521
+ }
4522
+
4515
4523
  /**
4516
4524
  * Creates a HTML container element for a SVG element with
4517
4525
  * the given configuration
@@ -4557,6 +4565,7 @@
4557
4565
  }
4558
4566
 
4559
4567
  var BASE_LAYER = 'base';
4568
+ var HIDDEN_MARKER = 'djs-element-hidden';
4560
4569
 
4561
4570
 
4562
4571
  var REQUIRED_MODEL_ATTRS = {
@@ -4593,23 +4602,23 @@
4593
4602
  'elementRegistry'
4594
4603
  ];
4595
4604
 
4605
+ /**
4606
+ * Creates a <svg> element that is wrapped into a <div>.
4607
+ * This way we are always able to correctly figure out the size of the svg element
4608
+ * by querying the parent node.
4609
+
4610
+ * (It is not possible to get the size of a svg element cross browser @ 2014-04-01)
4596
4611
 
4612
+ * <div class="djs-container" style="width: {desired-width}, height: {desired-height}">
4613
+ * <svg width="100%" height="100%">
4614
+ * ...
4615
+ * </svg>
4616
+ * </div>
4617
+ */
4597
4618
  Canvas.prototype._init = function(config) {
4598
4619
 
4599
4620
  var eventBus = this._eventBus;
4600
4621
 
4601
- // Creates a <svg> element that is wrapped into a <div>.
4602
- // This way we are always able to correctly figure out the size of the svg element
4603
- // by querying the parent node.
4604
- //
4605
- // (It is not possible to get the size of a svg element cross browser @ 2014-04-01)
4606
- //
4607
- // <div class="djs-container" style="width: {desired-width}, height: {desired-height}">
4608
- // <svg width="100%" height="100%">
4609
- // ...
4610
- // </svg>
4611
- // </div>
4612
-
4613
4622
  // html container
4614
4623
  var container = this._container = createContainer(config);
4615
4624
 
@@ -4621,6 +4630,7 @@
4621
4630
  var viewport = this._viewport = createGroup(svg, 'viewport');
4622
4631
 
4623
4632
  this._layers = {};
4633
+ this._planes = {};
4624
4634
 
4625
4635
  // debounce canvas.viewbox.changed events
4626
4636
  // for smoother diagram interaction
@@ -4679,7 +4689,8 @@
4679
4689
  delete this._svg;
4680
4690
  delete this._container;
4681
4691
  delete this._layers;
4682
- delete this._rootElement;
4692
+ delete this._planes;
4693
+ delete this._activePlane;
4683
4694
  delete this._viewport;
4684
4695
  };
4685
4696
 
@@ -4694,12 +4705,16 @@
4694
4705
  var type = getType(element);
4695
4706
 
4696
4707
  if (type === 'root') {
4697
- self.setRootElement(null, true);
4708
+ self.setRootElementForPlane(null, self.findPlane(element), true);
4698
4709
  } else {
4699
4710
  self._removeElement(element, type);
4700
4711
  }
4701
4712
  });
4702
4713
 
4714
+ // remove all planes
4715
+ this._activePlane = null;
4716
+ this._planes = {};
4717
+
4703
4718
  // force recomputation of view box
4704
4719
  delete this._cachedViewbox;
4705
4720
  };
@@ -4711,7 +4726,7 @@
4711
4726
  * @returns {SVGElement}
4712
4727
  */
4713
4728
  Canvas.prototype.getDefaultLayer = function() {
4714
- return this.getLayer(BASE_LAYER, 0);
4729
+ return this.getLayer(BASE_LAYER);
4715
4730
  };
4716
4731
 
4717
4732
  /**
@@ -4779,6 +4794,142 @@
4779
4794
 
4780
4795
  };
4781
4796
 
4797
+ /**
4798
+ * Returns a plane that is used to draw elements on it.
4799
+ *
4800
+ * @param {string} name
4801
+ *
4802
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4803
+ */
4804
+ Canvas.prototype.getPlane = function(name) {
4805
+ if (!name) {
4806
+ throw new Error('must specify a name');
4807
+ }
4808
+
4809
+ var plane = this._planes[name];
4810
+
4811
+ return plane;
4812
+ };
4813
+
4814
+ /**
4815
+ * Creates a plane that is used to draw elements on it. If no
4816
+ * root element is provided, an implicit root will be used.
4817
+ *
4818
+ * @param {string} name
4819
+ * @param {Object|djs.model.Root} [rootElement] optional root element
4820
+ *
4821
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4822
+ */
4823
+ Canvas.prototype.createPlane = function(name, rootElement) {
4824
+ if (!name) {
4825
+ throw new Error('must specify a name');
4826
+ }
4827
+
4828
+ if (this._planes[name]) {
4829
+ throw new Error('plane ' + name + ' already exists');
4830
+ }
4831
+
4832
+ if (!rootElement) {
4833
+ rootElement = {
4834
+ id: '__implicitroot' + name,
4835
+ children: [],
4836
+ isImplicit: true
4837
+ };
4838
+ }
4839
+
4840
+ var svgLayer = this.getLayer(name);
4841
+ classes$1(svgLayer).add(HIDDEN_MARKER);
4842
+
4843
+ var plane = this._planes[name] = {
4844
+ layer: svgLayer,
4845
+ name: name,
4846
+ rootElement: null
4847
+ };
4848
+
4849
+ this.setRootElementForPlane(rootElement, plane);
4850
+
4851
+ return plane;
4852
+ };
4853
+
4854
+ /**
4855
+ * Sets the active plane and hides the previously active plane.
4856
+ *
4857
+ * @param {string|Object} plane
4858
+ *
4859
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4860
+ */
4861
+ Canvas.prototype.setActivePlane = function(plane) {
4862
+ if (!plane) {
4863
+ throw new Error('must specify a plane');
4864
+ }
4865
+
4866
+ if (typeof plane === 'string') {
4867
+ plane = this.getPlane(plane);
4868
+ }
4869
+
4870
+ // hide previous Plane
4871
+ if (this._activePlane) {
4872
+ classes$1(this._activePlane.layer).add(HIDDEN_MARKER);
4873
+ }
4874
+
4875
+ this._activePlane = plane;
4876
+
4877
+ // show current Plane
4878
+ classes$1(plane.layer).remove(HIDDEN_MARKER);
4879
+
4880
+ if (plane.rootElement) {
4881
+ this._elementRegistry.updateGraphics(plane.rootElement, this._svg, true);
4882
+ }
4883
+
4884
+ this._eventBus.fire('plane.set', { plane: plane });
4885
+
4886
+ return plane;
4887
+ };
4888
+
4889
+ /**
4890
+ * Returns the currently active layer
4891
+ *
4892
+ * @returns {SVGElement}
4893
+ */
4894
+
4895
+ Canvas.prototype.getActiveLayer = function() {
4896
+ return this.getActivePlane().layer;
4897
+ };
4898
+
4899
+ /**
4900
+ * Returns the currently active plane.
4901
+ *
4902
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4903
+ */
4904
+ Canvas.prototype.getActivePlane = function() {
4905
+ var plane = this._activePlane;
4906
+ if (!plane) {
4907
+ plane = this.createPlane(BASE_LAYER);
4908
+ this.setActivePlane(BASE_LAYER);
4909
+ }
4910
+
4911
+ return plane;
4912
+ };
4913
+
4914
+ /**
4915
+ * Returns the plane which contains the given element.
4916
+ *
4917
+ * @param {string|djs.model.Base} element
4918
+ *
4919
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4920
+ */
4921
+ Canvas.prototype.findPlane = function(element) {
4922
+ if (typeof element === 'string') {
4923
+ element = this._elementRegistry.get(element);
4924
+ }
4925
+
4926
+ var root = findRoot(element);
4927
+
4928
+ return find(this._planes, function(plane) {
4929
+ return plane.rootElement === root;
4930
+ });
4931
+ };
4932
+
4782
4933
  /**
4783
4934
  * Returns the html element that encloses the
4784
4935
  * drawing canvas.
@@ -4900,11 +5051,9 @@
4900
5051
  };
4901
5052
 
4902
5053
  Canvas.prototype.getRootElement = function() {
4903
- if (!this._rootElement) {
4904
- this.setRootElement({ id: '__implicitroot', children: [] });
4905
- }
5054
+ var plane = this.getActivePlane();
4906
5055
 
4907
- return this._rootElement;
5056
+ return plane.rootElement;
4908
5057
  };
4909
5058
 
4910
5059
 
@@ -4921,12 +5070,41 @@
4921
5070
  * @return {Object|djs.model.Root} new root element
4922
5071
  */
4923
5072
  Canvas.prototype.setRootElement = function(element, override) {
5073
+ var activePlane = this._activePlane;
5074
+
5075
+ if (activePlane) {
5076
+ return this.setRootElementForPlane(element, activePlane, override);
5077
+ } else {
5078
+ var basePlane = this.createPlane(BASE_LAYER, element);
5079
+
5080
+ this.setActivePlane(basePlane);
5081
+
5082
+ return basePlane.rootElement;
5083
+ }
5084
+ };
5085
+
5086
+
5087
+ /**
5088
+ * Sets a given element as the new root element for the canvas
5089
+ * and returns the new root element.
5090
+ *
5091
+ * @param {Object|djs.model.Root} element
5092
+ * @param {Object|djs.model.Root} plane
5093
+ * @param {boolean} [override] whether to override the current root element, if any
5094
+ *
5095
+ * @return {Object|djs.model.Root} new root element
5096
+ */
5097
+ Canvas.prototype.setRootElementForPlane = function(element, plane, override) {
5098
+
5099
+ if (typeof plane === 'string') {
5100
+ plane = this.getPlane(plane);
5101
+ }
4924
5102
 
4925
5103
  if (element) {
4926
5104
  this._ensureValid('root', element);
4927
5105
  }
4928
5106
 
4929
- var currentRoot = this._rootElement,
5107
+ var currentRoot = plane.rootElement,
4930
5108
  elementRegistry = this._elementRegistry,
4931
5109
  eventBus = this._eventBus;
4932
5110
 
@@ -4943,23 +5121,26 @@
4943
5121
  }
4944
5122
 
4945
5123
  if (element) {
4946
- var gfx = this.getDefaultLayer();
5124
+ var gfx = plane.layer;
4947
5125
 
4948
5126
  // resemble element add event sequence
4949
5127
  eventBus.fire('root.add', { element: element });
4950
5128
 
4951
- elementRegistry.add(element, gfx, this._svg);
5129
+ elementRegistry.add(element, gfx);
4952
5130
 
4953
5131
  eventBus.fire('root.added', { element: element, gfx: gfx });
5132
+
5133
+ // associate SVG with root element when active
5134
+ if (plane === this._activePlane) {
5135
+ this._elementRegistry.updateGraphics(element, this._svg, true);
5136
+ }
4954
5137
  }
4955
5138
 
4956
- this._rootElement = element;
5139
+ plane.rootElement = element;
4957
5140
 
4958
5141
  return element;
4959
5142
  };
4960
5143
 
4961
-
4962
-
4963
5144
  // add functionality //////////////////////
4964
5145
 
4965
5146
  Canvas.prototype._ensureValid = function(type, element) {
@@ -5345,6 +5526,13 @@
5345
5526
  */
5346
5527
  Canvas.prototype.scrollToElement = function(element, padding) {
5347
5528
  var defaultPadding = 100;
5529
+
5530
+ // switch to correct Plane
5531
+ var targetPlane = this.findPlane(element);
5532
+ if (targetPlane !== this._activePlane) {
5533
+ this.setActivePlane(targetPlane);
5534
+ }
5535
+
5348
5536
  if (!padding) {
5349
5537
  padding = {};
5350
5538
  }
@@ -5365,7 +5553,7 @@
5365
5553
  zoom = this.zoom(),
5366
5554
  dx, dy;
5367
5555
 
5368
- // Shrink viewboxBounds with padding
5556
+ // shrink viewboxBounds with padding
5369
5557
  viewboxBounds.y += padding.top / zoom;
5370
5558
  viewboxBounds.x += padding.left / zoom;
5371
5559
  viewboxBounds.width -= (padding.right + padding.left) / zoom;
@@ -5687,6 +5875,29 @@
5687
5875
  this.add(element, gfx, secondaryGfx);
5688
5876
  };
5689
5877
 
5878
+ /**
5879
+ * Update the graphics of an element
5880
+ *
5881
+ * @param {djs.model.Base} element
5882
+ * @param {SVGElement} gfx
5883
+ * @param {boolean} [secondary=false] whether to update the secondary connected element
5884
+ */
5885
+ ElementRegistry.prototype.updateGraphics = function(filter, gfx, secondary) {
5886
+ var id = filter.id || filter;
5887
+
5888
+ var container = this._elements[id];
5889
+
5890
+ if (secondary) {
5891
+ container.secondaryGfx = gfx;
5892
+ } else {
5893
+ container.gfx = gfx;
5894
+ }
5895
+
5896
+ attr$1(gfx, ELEMENT_ID, id);
5897
+
5898
+ return gfx;
5899
+ };
5900
+
5690
5901
  /**
5691
5902
  * Return the model element for a given id or graphics.
5692
5903
  *
@@ -6792,12 +7003,11 @@
6792
7003
  if (returnValue === false) {
6793
7004
  event.preventDefault();
6794
7005
  }
6795
- } catch (e) {
6796
- if (!this.handleError(e)) {
6797
- console.error('unhandled error in event listener');
6798
- console.error(e.stack);
7006
+ } catch (error) {
7007
+ if (!this.handleError(error)) {
7008
+ console.error('unhandled error in event listener', error);
6799
7009
 
6800
- throw e;
7010
+ throw error;
6801
7011
  }
6802
7012
  }
6803
7013
 
@@ -19511,8 +19721,8 @@
19511
19721
 
19512
19722
  // helpers //////////////////////
19513
19723
 
19514
- // copied from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
19515
- var tokenRegex = /\{([^}]+)\}/g,
19724
+ // copied and adjusted from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
19725
+ var tokenRegex = /\{([^{}]+)\}/g,
19516
19726
  objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g; // matches .xxxxx or ["xxxxx"] to run over object properties
19517
19727
 
19518
19728
  function replacer(all, key, obj) {
@@ -20741,9 +20951,10 @@
20741
20951
  *
20742
20952
  * @param {EventBus} eventBus the event bus
20743
20953
  */
20744
- function Selection(eventBus) {
20954
+ function Selection(eventBus, canvas) {
20745
20955
 
20746
20956
  this._eventBus = eventBus;
20957
+ this._canvas = canvas;
20747
20958
 
20748
20959
  this._selectedElements = [];
20749
20960
 
@@ -20754,12 +20965,12 @@
20754
20965
  self.deselect(element);
20755
20966
  });
20756
20967
 
20757
- eventBus.on([ 'diagram.clear' ], function(e) {
20968
+ eventBus.on([ 'diagram.clear', 'plane.set' ], function(e) {
20758
20969
  self.select(null);
20759
20970
  });
20760
20971
  }
20761
20972
 
20762
- Selection.$inject = [ 'eventBus' ];
20973
+ Selection.$inject = [ 'eventBus', 'canvas' ];
20763
20974
 
20764
20975
 
20765
20976
  Selection.prototype.deselect = function(element) {
@@ -20805,6 +21016,14 @@
20805
21016
  elements = elements ? [ elements ] : [];
20806
21017
  }
20807
21018
 
21019
+ var canvas = this._canvas;
21020
+
21021
+ elements = elements.filter(function(element) {
21022
+ var plane = canvas.findPlane(element);
21023
+
21024
+ return plane === canvas.getActivePlane();
21025
+ });
21026
+
20808
21027
  // selection may be cleared by passing an empty array or null
20809
21028
  // to the method
20810
21029
  if (add) {
@@ -21473,6 +21692,13 @@
21473
21692
  classes(htmlContainer).add('djs-overlay-' + overlay.type);
21474
21693
  }
21475
21694
 
21695
+ var plane = this._canvas.findPlane(element);
21696
+ var activePlane = this._canvas.getActivePlane();
21697
+ overlay.plane = plane;
21698
+ if (plane !== activePlane) {
21699
+ setVisible(htmlContainer, false);
21700
+ }
21701
+
21476
21702
  overlay.htmlContainer = htmlContainer;
21477
21703
 
21478
21704
  overlayContainer.overlays.push(overlay);
@@ -21626,6 +21852,12 @@
21626
21852
  });
21627
21853
 
21628
21854
 
21855
+ eventBus.on('plane.set', function(e) {
21856
+ forEach(self._overlays, function(el) {
21857
+ setVisible(el.htmlContainer, el.plane === e.plane);
21858
+ });
21859
+ });
21860
+
21629
21861
  // clear overlays with diagram
21630
21862
 
21631
21863
  eventBus.on('diagram.clear', this.clear, this);
@@ -21775,8 +22007,9 @@
21775
22007
  var KEYDOWN_EVENT = 'keyboard.keydown',
21776
22008
  KEYUP_EVENT = 'keyboard.keyup';
21777
22009
 
21778
- var DEFAULT_PRIORITY$1 = 1000;
22010
+ var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
21779
22011
 
22012
+ var DEFAULT_PRIORITY$1 = 1000;
21780
22013
 
21781
22014
  /**
21782
22015
  * A keyboard abstraction that may be activated and
@@ -21847,10 +22080,9 @@
21847
22080
  };
21848
22081
 
21849
22082
  Keyboard.prototype._keyHandler = function(event, type) {
21850
- var target = event.target,
21851
- eventBusResult;
22083
+ var eventBusResult;
21852
22084
 
21853
- if (isInput(target)) {
22085
+ if (this._isEventIgnored(event)) {
21854
22086
  return;
21855
22087
  }
21856
22088
 
@@ -21865,6 +22097,29 @@
21865
22097
  }
21866
22098
  };
21867
22099
 
22100
+ Keyboard.prototype._isEventIgnored = function(event) {
22101
+ return isInput(event.target) && this._isModifiedKeyIgnored(event);
22102
+ };
22103
+
22104
+ Keyboard.prototype._isModifiedKeyIgnored = function(event) {
22105
+ if (!isCmd(event)) {
22106
+ return true;
22107
+ }
22108
+
22109
+ var allowedModifiers = this._getAllowedModifiers(event.target);
22110
+ return !allowedModifiers.includes(event.key);
22111
+ };
22112
+
22113
+ Keyboard.prototype._getAllowedModifiers = function(element) {
22114
+ var modifierContainer = closest(element, '[' + HANDLE_MODIFIER_ATTRIBUTE + ']', true);
22115
+
22116
+ if (!modifierContainer || (this._node && !this._node.contains(modifierContainer))) {
22117
+ return [];
22118
+ }
22119
+
22120
+ return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
22121
+ };
22122
+
21868
22123
  Keyboard.prototype.bind = function(node) {
21869
22124
 
21870
22125
  // make sure that the keyboard is only bound once to the DOM
@@ -25857,7 +26112,7 @@
25857
26112
  /**
25858
26113
  * Executes the alignment of a selection of elements
25859
26114
  *
25860
- * @param {Array} elements [description]
26115
+ * @param {Array} elements
25861
26116
  * @param {string} type left|right|center|top|bottom|middle
25862
26117
  */
25863
26118
  AlignElements.prototype.trigger = function(elements, type) {
@@ -30355,7 +30610,7 @@
30355
30610
 
30356
30611
  classes$1(gfx).add(MARKER_CONNECTION_PREVIEW);
30357
30612
 
30358
- append(this._canvas.getDefaultLayer(), gfx);
30613
+ append(this._canvas.getActiveLayer(), gfx);
30359
30614
 
30360
30615
  return gfx;
30361
30616
  };
@@ -32072,13 +32327,13 @@
32072
32327
  dragGroup = context.dragGroup = createDragGroup(elements);
32073
32328
  }
32074
32329
 
32075
- var defaultLayer;
32330
+ var activeLayer;
32076
32331
 
32077
32332
  if (hover) {
32078
32333
  if (!dragGroup.parentNode) {
32079
- defaultLayer = canvas.getDefaultLayer();
32334
+ activeLayer = canvas.getActiveLayer();
32080
32335
 
32081
- append(defaultLayer, dragGroup);
32336
+ append(activeLayer, dragGroup);
32082
32337
  }
32083
32338
 
32084
32339
  translate(dragGroup, event.x, event.y);
@@ -33754,11 +34009,16 @@
33754
34009
 
33755
34010
  var propertyDescriptor = this._moddle.getPropertyDescriptor(parent, propertyName);
33756
34011
 
33757
- // do NOT copy Ids and references
33758
- if (propertyDescriptor.isId || propertyDescriptor.isReference) {
34012
+ // do NOT copy references
34013
+ if (propertyDescriptor.isReference) {
33759
34014
  return;
33760
34015
  }
33761
34016
 
34017
+ // copy id
34018
+ if (propertyDescriptor.isId) {
34019
+ return this._copyId(property, parent);
34020
+ }
34021
+
33762
34022
  // copy arrays
33763
34023
  if (isArray(property)) {
33764
34024
  return reduce(property, function(childProperties, childProperty) {
@@ -33797,6 +34057,18 @@
33797
34057
  return property;
33798
34058
  };
33799
34059
 
34060
+ ModdleCopy.prototype._copyId = function(id, element) {
34061
+
34062
+ // disallow if already taken
34063
+ if (this._moddle.ids.assigned(id)) {
34064
+ return;
34065
+ } else {
34066
+
34067
+ this._moddle.ids.claim(id, element);
34068
+ return id;
34069
+ }
34070
+ };
34071
+
33800
34072
  // helpers //////////
33801
34073
 
33802
34074
  function getPropertyNames(descriptor, keepDefaultProperties) {
@@ -36546,8 +36818,8 @@
36546
36818
  /**
36547
36819
  * Distributes the elements with a given orientation
36548
36820
  *
36549
- * @param {Array} elements [description]
36550
- * @param {string} orientation [description]
36821
+ * @param {Array} elements
36822
+ * @param {string} orientation
36551
36823
  */
36552
36824
  DistributeElements.prototype.trigger = function(elements, orientation) {
36553
36825
  var modeling = this._modeling;
@@ -36681,11 +36953,11 @@
36681
36953
  /**
36682
36954
  * Returns the min and max values for an element
36683
36955
  *
36684
- * @param {[type]} element [description]
36685
- * @param {[type]} axis [description]
36686
- * @param {[type]} dimension [description]
36956
+ * @param {Bounds} element
36957
+ * @param {string} axis
36958
+ * @param {string} dimension
36687
36959
  *
36688
- * @return {[type]} [description]
36960
+ * @return {{ min: number, max: number }}
36689
36961
  */
36690
36962
  DistributeElements.prototype._findRange = function(element) {
36691
36963
  var axis = element[this._axis],
@@ -38787,7 +39059,7 @@
38787
39059
  frame = context.frame;
38788
39060
 
38789
39061
  if (!frame) {
38790
- frame = context.frame = previewSupport.addFrame(shape, canvas.getDefaultLayer());
39062
+ frame = context.frame = previewSupport.addFrame(shape, canvas.getActiveLayer());
38791
39063
 
38792
39064
  canvas.addMarker(shape, MARKER_RESIZING);
38793
39065
  }
@@ -43398,6 +43670,49 @@
43398
43670
  'selection'
43399
43671
  ];
43400
43672
 
43673
+ var HIGH_PRIORITY$b = 1500;
43674
+
43675
+ var LANE_MIN_DIMENSIONS = { width: 300, height: 60 };
43676
+
43677
+ var PARTICIPANT_MIN_DIMENSIONS = { width: 300, height: 150 };
43678
+
43679
+ var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
43680
+
43681
+ var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
43682
+
43683
+ /**
43684
+ * Set minimum bounds/resize constraints on resize.
43685
+ *
43686
+ * @param {EventBus} eventBus
43687
+ */
43688
+ function ResizeBehavior$1(eventBus) {
43689
+ eventBus.on('resize.start', HIGH_PRIORITY$b, function(event) {
43690
+ var context = event.context,
43691
+ shape = context.shape,
43692
+ direction = context.direction,
43693
+ balanced = context.balanced;
43694
+
43695
+ if (is$1(shape, 'bpmn:Lane') || is$1(shape, 'bpmn:Participant')) {
43696
+ context.resizeConstraints = getParticipantResizeConstraints(shape, direction, balanced);
43697
+ }
43698
+
43699
+ if (is$1(shape, 'bpmn:Participant')) {
43700
+ context.minDimensions = PARTICIPANT_MIN_DIMENSIONS;
43701
+ }
43702
+
43703
+ if (is$1(shape, 'bpmn:SubProcess') && isExpanded(shape)) {
43704
+ context.minDimensions = SUB_PROCESS_MIN_DIMENSIONS;
43705
+ }
43706
+
43707
+ if (is$1(shape, 'bpmn:TextAnnotation')) {
43708
+ context.minDimensions = TEXT_ANNOTATION_MIN_DIMENSIONS;
43709
+ }
43710
+ });
43711
+ }
43712
+
43713
+ ResizeBehavior$1.$inject = [ 'eventBus' ];
43714
+
43715
+
43401
43716
  var abs$5 = Math.abs,
43402
43717
  min$3 = Math.min,
43403
43718
  max$4 = Math.max;
@@ -43425,7 +43740,6 @@
43425
43740
  LANE_TOP_PADDING = 20,
43426
43741
  LANE_BOTTOM_PADDING = 20;
43427
43742
 
43428
-
43429
43743
  function getParticipantResizeConstraints(laneShape, resizeDirection, balanced) {
43430
43744
  var lanesRoot = getLanesRoot(laneShape);
43431
43745
 
@@ -43518,49 +43832,6 @@
43518
43832
  };
43519
43833
  }
43520
43834
 
43521
- var HIGH_PRIORITY$b = 1500;
43522
-
43523
- var LANE_MIN_DIMENSIONS = { width: 300, height: 60 };
43524
-
43525
- var PARTICIPANT_MIN_DIMENSIONS = { width: 300, height: 150 };
43526
-
43527
- var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
43528
-
43529
- var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
43530
-
43531
-
43532
- /**
43533
- * Set minimum bounds/resize constraints on resize.
43534
- *
43535
- * @param {EventBus} eventBus
43536
- */
43537
- function ResizeBehavior$1(eventBus) {
43538
- eventBus.on('resize.start', HIGH_PRIORITY$b, function(event) {
43539
- var context = event.context,
43540
- shape = context.shape,
43541
- direction = context.direction,
43542
- balanced = context.balanced;
43543
-
43544
- if (is$1(shape, 'bpmn:Lane') || is$1(shape, 'bpmn:Participant')) {
43545
- context.resizeConstraints = getParticipantResizeConstraints(shape, direction, balanced);
43546
- }
43547
-
43548
- if (is$1(shape, 'bpmn:Participant')) {
43549
- context.minDimensions = PARTICIPANT_MIN_DIMENSIONS;
43550
- }
43551
-
43552
- if (is$1(shape, 'bpmn:SubProcess') && isExpanded(shape)) {
43553
- context.minDimensions = SUB_PROCESS_MIN_DIMENSIONS;
43554
- }
43555
-
43556
- if (is$1(shape, 'bpmn:TextAnnotation')) {
43557
- context.minDimensions = TEXT_ANNOTATION_MIN_DIMENSIONS;
43558
- }
43559
- });
43560
- }
43561
-
43562
- ResizeBehavior$1.$inject = [ 'eventBus' ];
43563
-
43564
43835
  var SLIGHTLY_HIGHER_PRIORITY = 1001;
43565
43836
 
43566
43837
 
@@ -47737,7 +48008,7 @@
47737
48008
  var dragGroup = create('g');
47738
48009
  attr$1(dragGroup, styles.cls('djs-drag-group', [ 'no-events' ]));
47739
48010
 
47740
- append(canvas.getDefaultLayer(), dragGroup);
48011
+ append(canvas.getActiveLayer(), dragGroup);
47741
48012
 
47742
48013
  // shapes
47743
48014
  addPreviewGfx(movingShapes, dragGroup);
@@ -47799,7 +48070,7 @@
47799
48070
  var frameGroup = create('g');
47800
48071
  attr$1(frameGroup, styles.cls('djs-frame-group', [ 'no-events' ]));
47801
48072
 
47802
- append(canvas.getDefaultLayer(), frameGroup);
48073
+ append(canvas.getActiveLayer(), frameGroup);
47803
48074
 
47804
48075
  var frames = [];
47805
48076
 
@@ -54176,9 +54447,9 @@
54176
54447
 
54177
54448
  attr$1(dragGroup, styles.cls('djs-drag-group', [ 'no-events' ]));
54178
54449
 
54179
- var defaultLayer = canvas.getDefaultLayer();
54450
+ var activeLayer = canvas.getActiveLayer();
54180
54451
 
54181
- append(defaultLayer, dragGroup);
54452
+ append(activeLayer, dragGroup);
54182
54453
 
54183
54454
  context.dragGroup = dragGroup;
54184
54455
  }
@@ -54801,7 +55072,7 @@
54801
55072
  var visuals = {
54802
55073
 
54803
55074
  create: function(context) {
54804
- var container = canvas.getDefaultLayer(),
55075
+ var container = canvas.getActiveLayer(),
54805
55076
  frame;
54806
55077
 
54807
55078
  frame = context.frame = create('rect');
@@ -65692,6 +65963,14 @@
65692
65963
  priority = DEFAULT_PRIORITY$6;
65693
65964
  }
65694
65965
 
65966
+ if (typeof provider.getTabs !== 'function') {
65967
+ console.error(
65968
+ 'Properties provider does not impement #getTabs(element) API'
65969
+ );
65970
+
65971
+ return;
65972
+ }
65973
+
65695
65974
  this._eventBus.on('propertiesPanel.getProviders', priority, function(event) {
65696
65975
  event.providers.push(provider);
65697
65976
  });
@@ -65803,7 +66082,7 @@
65803
66082
  self.detach();
65804
66083
  });
65805
66084
 
65806
- this._container = domify$2('<div class="bpp-properties-panel"></div>');
66085
+ this._container = domify$2('<div class="bpp-properties-panel" input-handle-modified-keys="z,y"></div>');
65807
66086
 
65808
66087
  this._bindListeners(this._container);
65809
66088
 
@@ -71799,18 +72078,19 @@
71799
72078
 
71800
72079
 
71801
72080
  /**
71802
- * Camunda BPMN specific `camunda:errorEventDefinition` behavior.
71803
- *
71804
- * When `camunda:type` is set to something different than `external`
71805
- * on an element, then `camunda:errorEventDefinition` extension elements
71806
- * shall be removed.
72081
+ * Camunda BPMN specific camunda:ErrorEventDefinition behavior.
71807
72082
  */
71808
- function DeleteErrorEventDefinitionBehavior(eventBus) {
71809
-
71810
- CommandInterceptor.call(this, eventBus);
72083
+ class DeleteErrorEventDefinitionBehavior extends CommandInterceptor {
72084
+ constructor(eventBus, modeling) {
72085
+ super(eventBus);
71811
72086
 
71812
- this.executed([ 'properties-panel.update-businessobject', 'element.updateProperties' ],
71813
- HIGH_PRIORITY$l, function(context) {
72087
+ /**
72088
+ * Remove camunda:ErrorEventDefinitions on camunda:type set to external.
72089
+ */
72090
+ this.postExecute([
72091
+ 'element.updateProperties',
72092
+ 'properties-panel.update-businessobject'
72093
+ ], HIGH_PRIORITY$l, function(context) {
71814
72094
  const {
71815
72095
  element,
71816
72096
  oldProperties,
@@ -71818,52 +72098,30 @@
71818
72098
  } = context;
71819
72099
 
71820
72100
  const businessObject = getBusinessObject(element),
71821
- extensionElements = businessObject.extensionElements;
72101
+ extensionElements = businessObject.get('extensionElements');
71822
72102
 
71823
- // (1) Check whether behavior is suitable
71824
- if (
71825
- is$1(element, 'camunda:ExternalCapable') &&
71826
- extensionElements &&
71827
- externalTypeChanged(oldProperties, properties)
71828
- ) {
72103
+ if (is$1(element, 'camunda:ExternalCapable')
72104
+ && extensionElements
72105
+ && externalTypeChanged(oldProperties, properties)) {
71829
72106
 
71830
- // (2) Delete camunda:ErrorEventDefinition elements and save them for revert
71831
- context.deletedErrorEventDefinitions = extensionElements.values;
72107
+ const values = extensionElements.get('values').filter((element) => {
72108
+ return !is$1(element, 'camunda:ErrorEventDefinition');
72109
+ });
71832
72110
 
71833
- extensionElements.values = extensionElements.values.filter(
71834
- element => !is$1(element, 'camunda:ErrorEventDefinition')
71835
- );
72111
+ modeling.updateModdleProperties(element, extensionElements, { values });
71836
72112
  }
71837
-
71838
72113
  }, true);
71839
72114
 
71840
- this.reverted([ 'properties-panel.update-businessobject', 'element.updateProperties' ],
71841
- HIGH_PRIORITY$l, function({ context }) {
71842
- const {
71843
- element,
71844
- deletedErrorEventDefinitions: oldExtensionElements
71845
- } = context;
71846
-
71847
- const businessObject = getBusinessObject(element);
71848
-
71849
- // Only intercept the revert, if the behavior became active
71850
- if (oldExtensionElements) {
71851
- const extensionElements = businessObject.extensionElements;
71852
-
71853
- extensionElements.values = oldExtensionElements;
71854
- }
71855
- });
72115
+ }
71856
72116
  }
71857
72117
 
71858
-
71859
72118
  DeleteErrorEventDefinitionBehavior.$inject = [
71860
- 'eventBus'
72119
+ 'eventBus',
72120
+ 'modeling'
71861
72121
  ];
71862
72122
 
71863
- inherits_browser(DeleteErrorEventDefinitionBehavior, CommandInterceptor);
71864
72123
 
71865
-
71866
- // helper //////////////////
72124
+ // helpers //////////
71867
72125
 
71868
72126
  function externalTypeChanged(oldProperties, updatesProperties) {
71869
72127
  const {
@@ -71877,22 +72135,23 @@
71877
72135
  return oldType === 'external' && newType !== 'external';
71878
72136
  }
71879
72137
 
71880
- const HIGH_PRIORITY$m = 15000;
72138
+ const HIGH_PRIORITY$m = 5000;
71881
72139
 
71882
72140
 
71883
72141
  /**
71884
- * Camunda BPMN specific `camunda:FailedJobRetryTimeCycle` behavior.
71885
- *
71886
- * When `camunda:asyncAfter` or `camunda:asyncBefore` are set to false
71887
- * on an element, then `camunda:FailedJobRetryTimeCycle` shall be removed. This ensures
71888
- * that the BPMN diagram XML reflects the behavior of Camunda Platform engine.
72142
+ * Camunda BPMN specific camunda:FailedJobRetryTimeCycle behavior.
71889
72143
  */
71890
- function DeleteRetryTimeCycleBehavior(eventBus) {
71891
-
71892
- CommandInterceptor.call(this, eventBus);
72144
+ class DeleteRetryTimeCycleBehavior extends CommandInterceptor {
72145
+ constructor(eventBus, modeling) {
72146
+ super(eventBus);
71893
72147
 
71894
- this.executed([ 'properties-panel.update-businessobject', 'element.updateProperties' ],
71895
- HIGH_PRIORITY$m, function(context) {
72148
+ /**
72149
+ * Remove camunda:FailedJobRetryTimeCycle if camunda:asyncAfter or camunda:asyncBefore is set to false.
72150
+ */
72151
+ this.postExecute([
72152
+ 'element.updateProperties',
72153
+ 'properties-panel.update-businessobject'
72154
+ ], HIGH_PRIORITY$m, function(context) {
71896
72155
  const {
71897
72156
  element,
71898
72157
  properties
@@ -71901,112 +72160,76 @@
71901
72160
  const businessObject = getBusinessObject(element),
71902
72161
  extensionElements = businessObject.extensionElements;
71903
72162
 
71904
- // (1.1) Execute if...
71905
- if (is$1(element, 'camunda:AsyncCapable') && // ...asyncCapable
71906
- properties && // ...properties updated
71907
- (properties['camunda:asyncBefore'] === false || // ...update async (1)
71908
- properties['camunda:asyncAfter'] === false) && // ...update async (2)
71909
- (extensionElements && extensionElements.values.length) && // ...we have extensionElements
71910
- (extensionElements.values.find(ele => is$1(ele, 'camunda:FailedJobRetryTimeCycle'))) && // ...we have retryTimeCycle
71911
- !getTimerEventDefinition(element) // ...we don't have a TimerEventDefinition
72163
+ if (
72164
+ !is$1(element, 'camunda:AsyncCapable')
72165
+ || (properties[ 'camunda:asyncBefore' ] !== false && properties[ 'camunda:asyncAfter' ] !== false)
72166
+ || !extensionElements
72167
+ || !extensionElements.get('values').length
72168
+ || !extensionElements.get('values').find((value) => is$1(value, 'camunda:FailedJobRetryTimeCycle'))
72169
+ || getTimerEventDefinition(element)
72170
+ || isAsyncBefore(businessObject)
72171
+ || isAsyncAfter(businessObject)
71912
72172
  ) {
71913
-
71914
- // (1.2) ... but don't execute if one async is still true
71915
- if (isAsyncBefore(businessObject) || isAsyncAfter(businessObject)) {
71916
- return;
71917
- }
71918
-
71919
- // (2) Delete the camunda:FailedJobRetryTimeCycle and save them for revert
71920
- context.deleteRetryCycleOldExtElements = extensionElements.values;
71921
-
71922
- extensionElements.values = extensionElements.values.filter(
71923
- ele => !is$1(ele, 'camunda:FailedJobRetryTimeCycle'));
72173
+ return;
71924
72174
  }
71925
72175
 
71926
- }, true);
71927
-
71928
- this.reverted([ 'properties-panel.update-businessobject', 'element.updateProperties' ],
71929
- HIGH_PRIORITY$m, function({ context }) {
71930
- const {
71931
- element,
71932
- deleteRetryCycleOldExtElements: oldExtensionElements
71933
- } = context;
71934
-
71935
- const businessObject = getBusinessObject(element);
72176
+ const values = extensionElements.get('values').filter((element) => {
72177
+ return !is$1(element, 'camunda:FailedJobRetryTimeCycle');
72178
+ });
71936
72179
 
71937
- // Only intercept the revert, if the behavior became active
71938
- if (oldExtensionElements) {
71939
- const extensionElements = businessObject.extensionElements;
72180
+ modeling.updateModdleProperties(element, extensionElements, { values });
72181
+ }, true);
71940
72182
 
71941
- extensionElements.values = oldExtensionElements;
71942
- }
71943
- });
72183
+ }
71944
72184
  }
71945
72185
 
71946
-
71947
72186
  DeleteRetryTimeCycleBehavior.$inject = [
71948
- 'eventBus'
72187
+ 'eventBus',
72188
+ 'modeling'
71949
72189
  ];
71950
72190
 
71951
- inherits_browser(DeleteRetryTimeCycleBehavior, CommandInterceptor);
71952
-
71953
72191
 
71954
- // helper //////////////////
72192
+ // helpers //////////
71955
72193
 
71956
- /**
71957
- * Returns true if the attribute 'camunda:asyncBefore' is set
71958
- * to true.
71959
- *
71960
- * @param {ModdleElement} bo
71961
- *
71962
- * @return {boolean} a boolean value
71963
- */
71964
- function isAsyncBefore(bo) {
71965
- return !!(bo.get('camunda:asyncBefore') || bo.get('camunda:async'));
72194
+ function isAsyncBefore(businessObject) {
72195
+ return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
71966
72196
  }
71967
72197
 
71968
- /**
71969
- * Returns true if the attribute 'camunda:asyncAfter' is set
71970
- * to true.
71971
- *
71972
- * @param {ModdleElement} bo
71973
- *
71974
- * @return {boolean} a boolean value
71975
- */
71976
- function isAsyncAfter(bo) {
71977
- return !!bo.get('camunda:asyncAfter');
72198
+ function isAsyncAfter(businessObject) {
72199
+ return !!businessObject.get('camunda:asyncAfter');
71978
72200
  }
71979
72201
 
71980
72202
  function getTimerEventDefinition(element) {
71981
72203
  return getEventDefinition$2(element, 'bpmn:TimerEventDefinition');
71982
72204
  }
71983
72205
 
71984
- function getEventDefinition$2(element, eventType) {
72206
+ function getEventDefinition$2(element, type) {
71985
72207
  const businessObject = getBusinessObject(element);
71986
72208
 
71987
72209
  const eventDefinitions = businessObject.get('eventDefinitions') || [];
71988
72210
 
71989
- return find(eventDefinitions, function(definition) {
71990
- return is$1(definition, eventType);
72211
+ return eventDefinitions.find((eventDefinition) => {
72212
+ return is$1(eventDefinition, type);
71991
72213
  });
71992
72214
  }
71993
72215
 
71994
- const HIGH_PRIORITY$n = 15000;
72216
+ const HIGH_PRIORITY$n = 5000;
71995
72217
 
71996
72218
 
71997
72219
  /**
71998
- * Camunda BPMN specific `camunda:exclusive` behavior.
71999
- *
72000
- * When `camunda:asyncAfter` or `camunda:asyncBefore` are set to false
72001
- * on an element, then `camunda:exclusive` shall be set to true. This ensures
72002
- * that the BPMN diagram XML reflects the behavior of Camunda Platform engine.
72220
+ * Camunda BPMN specific camunda:exclusive behavior.
72003
72221
  */
72004
- function UpdateCamundaExclusiveBehavior(eventBus) {
72005
-
72006
- CommandInterceptor.call(this, eventBus);
72222
+ class UpdateCamundaExclusiveBehavior extends CommandInterceptor {
72223
+ constructor(eventBus) {
72224
+ super(eventBus);
72007
72225
 
72008
- this.preExecute([ 'properties-panel.update-businessobject', 'element.updateProperties' ],
72009
- HIGH_PRIORITY$n, function(context) {
72226
+ /**
72227
+ * Set camunda:exclusive to true on camunda:asyncBefore or camunda:asyncAfter set to false.
72228
+ */
72229
+ this.preExecute([
72230
+ 'element.updateProperties',
72231
+ 'properties-panel.update-businessobject'
72232
+ ], HIGH_PRIORITY$n, function(context) {
72010
72233
  const {
72011
72234
  element,
72012
72235
  properties
@@ -72014,125 +72237,53 @@
72014
72237
 
72015
72238
  const businessObject = getBusinessObject(element);
72016
72239
 
72017
- // (1.1) Execute if...
72018
- if (is$1(element, 'camunda:AsyncCapable') && // ...asyncCapable
72019
- properties && // ...properties updated
72020
- (properties['camunda:asyncBefore'] === false || // ...update async before or (1)
72021
- properties['camunda:asyncAfter'] === false) && // ...update async after (2)
72022
- !isExclusive(businessObject) // ...is currently not exclusive
72240
+ if (!is$1(element, 'camunda:AsyncCapable')
72241
+ || (properties[ 'camunda:asyncBefore' ] !== false && properties[ 'camunda:asyncAfter' ] !== false)
72242
+ || isExclusive(businessObject)
72243
+ || (isAsyncAfter$1(businessObject) && properties[ 'camunda:asyncAfter' ] !== false)
72244
+ || (isAsyncBefore$1(businessObject) && properties[ 'camunda:asyncBefore' ] !== false)
72245
+ || (properties[ 'camunda:asyncBefore' ] === true || properties[ 'camunda:asyncAfter' ] === true)
72023
72246
  ) {
72024
-
72025
- // (1.2) ...but don't execute if...
72026
- if ((isAsyncAfter$1(businessObject) && properties['camunda:asyncAfter'] !== false) || // ...asyncAfter will stay
72027
- (isAsyncBefore$1(businessObject) && properties['camunda:asyncBefore'] !== false) || // ...asyncBefore will stay
72028
- (properties['camunda:asyncBefore'] || properties['camunda:asyncAfter']) // one is set to true
72029
- ) {
72030
- return;
72031
- }
72032
-
72033
- // (2) Update the context
72034
- properties['camunda:exclusive'] = true;
72247
+ return;
72035
72248
  }
72249
+
72250
+ properties[ 'camunda:exclusive' ] = true;
72036
72251
  }, true);
72037
- }
72038
72252
 
72253
+ }
72254
+ }
72039
72255
 
72040
72256
  UpdateCamundaExclusiveBehavior.$inject = [
72041
72257
  'eventBus'
72042
72258
  ];
72043
72259
 
72044
- inherits_browser(UpdateCamundaExclusiveBehavior, CommandInterceptor);
72045
72260
 
72261
+ // helpers //////////
72046
72262
 
72047
- // helper //////////////////
72048
-
72049
- /**
72050
- * Returns true if the attribute 'camunda:asyncBefore' is set
72051
- * to true.
72052
- *
72053
- * @param {ModdleElement} bo
72054
- *
72055
- * @return {boolean} a boolean value
72056
- */
72057
- function isAsyncBefore$1(bo) {
72058
- return !!(bo.get('camunda:asyncBefore') || bo.get('camunda:async'));
72263
+ function isAsyncBefore$1(businessObject) {
72264
+ return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
72059
72265
  }
72060
72266
 
72061
- /**
72062
- * Returns true if the attribute 'camunda:asyncAfter' is set
72063
- * to true.
72064
- *
72065
- * @param {ModdleElement} bo
72066
- *
72067
- * @return {boolean} a boolean value
72068
- */
72069
- function isAsyncAfter$1(bo) {
72070
- return !!bo.get('camunda:asyncAfter');
72267
+ function isAsyncAfter$1(businessObject) {
72268
+ return !!businessObject.get('camunda:asyncAfter');
72071
72269
  }
72072
72270
 
72073
- /**
72074
- * Returns true if the attribute 'camunda:exclusive' is set
72075
- * to true.
72076
- *
72077
- * @param {ModdleElement} bo
72078
- *
72079
- * @return {boolean} a boolean value
72080
- */
72081
- function isExclusive(bo) {
72082
- return !!bo.get('camunda:exclusive');
72271
+ function isExclusive(businessObject) {
72272
+ return !!businessObject.get('camunda:exclusive');
72083
72273
  }
72084
72274
 
72085
- /**
72086
- * Camunda BPMN specific `camunda:inputOutput` behavior.
72087
- */
72088
- function UpdateInputOutputBehavior(eventBus, modeling) {
72089
-
72090
- CommandInterceptor.call(this, eventBus);
72091
-
72092
- this.postExecute([
72093
- 'element.updateProperties',
72094
- 'element.updateModdleProperties',
72095
- 'properties-panel.update-businessobject-list'
72096
- ], function(context) {
72097
- const {
72098
- element,
72099
- oldProperties,
72100
- propertyName
72101
- } = context;
72102
-
72103
- const businessObject = getBusinessObject(element);
72104
- const inputOutput = getInputOutput(businessObject);
72105
- const extensionElements = businessObject.get('extensionElements');
72106
-
72107
- // do not apply if inputOutput got recently added
72108
- if (!oldProperties && propertyName === 'values') {
72109
- return;
72110
- }
72275
+ function getInputOutput(businessObject) {
72276
+ const extensionElements = businessObject.get('extensionElements');
72111
72277
 
72112
- // remove camunda:inputOutput if there are no input/output parameters anymore
72113
- if (inputOutput && isEmpty$1(inputOutput)) {
72114
- const filtered = extensionElements.values.filter(function(element) {
72115
- return element !== inputOutput;
72116
- });
72278
+ if (!extensionElements) {
72279
+ return;
72280
+ }
72117
72281
 
72118
- modeling.updateModdleProperties(element, extensionElements, {
72119
- values: filtered
72120
- });
72121
- }
72122
- }, true);
72282
+ return extensionElements.get('values').find((value) => {
72283
+ return is$1(value, 'camunda:InputOutput');
72284
+ });
72123
72285
  }
72124
72286
 
72125
-
72126
- UpdateInputOutputBehavior.$inject = [
72127
- 'eventBus',
72128
- 'modeling'
72129
- ];
72130
-
72131
- inherits_browser(UpdateInputOutputBehavior, CommandInterceptor);
72132
-
72133
-
72134
- // helper //////////////////
72135
-
72136
72287
  function getInputParameters(inputOutput) {
72137
72288
  return inputOutput.get('inputParameters');
72138
72289
  }
@@ -72141,81 +72292,117 @@
72141
72292
  return inputOutput.get('outputParameters');
72142
72293
  }
72143
72294
 
72144
- function getInputOutput(businessObject) {
72145
- const extensionElements = businessObject.get('extensionElements');
72295
+ function isInputOutputEmpty(inputOutput) {
72296
+ const inputParameters = getInputParameters(inputOutput);
72297
+ const outputParameters = getOutputParameters(inputOutput);
72146
72298
 
72147
- if (!extensionElements) {
72148
- return;
72149
- }
72299
+ return !inputParameters.length && !outputParameters.length;
72300
+ }
72150
72301
 
72151
- const values = extensionElements.get('values');
72302
+ /**
72303
+ * Camunda BPMN specific camunda:InputOutput behavior.
72304
+ */
72305
+ class UpdateInputOutputBehavior extends CommandInterceptor {
72306
+ constructor(eventBus, modeling) {
72307
+ super(eventBus);
72152
72308
 
72153
- return values.find((value) => {
72154
- return is$1(value, 'camunda:InputOutput');
72155
- });
72156
- }
72309
+ /**
72310
+ * Remove empty camunda:InputOutput on update.
72311
+ */
72312
+ this.postExecute([
72313
+ 'element.updateProperties',
72314
+ 'element.updateModdleProperties',
72315
+ 'properties-panel.update-businessobject-list'
72316
+ ], function(context) {
72317
+ const {
72318
+ element,
72319
+ oldProperties,
72320
+ propertyName
72321
+ } = context;
72157
72322
 
72158
- function isEmpty$1(inputOutput) {
72159
- const inputParameters = getInputParameters(inputOutput);
72160
- const outputParameters = getOutputParameters(inputOutput);
72323
+ const businessObject = getBusinessObject(element),
72324
+ inputOutput = getInputOutput(businessObject),
72325
+ extensionElements = businessObject.get('extensionElements');
72161
72326
 
72162
- return inputParameters.length === 0 && outputParameters.length === 0;
72327
+ // do not remove newly added camunda:InputOutput
72328
+ if (!oldProperties && propertyName === 'values') {
72329
+ return;
72330
+ }
72331
+
72332
+ if (inputOutput && isInputOutputEmpty(inputOutput)) {
72333
+ const values = extensionElements.get('values').filter(function(element) {
72334
+ return element !== inputOutput;
72335
+ });
72336
+
72337
+ modeling.updateModdleProperties(element, extensionElements, { values });
72338
+ }
72339
+ }, true);
72340
+ }
72163
72341
  }
72164
72342
 
72343
+ UpdateInputOutputBehavior.$inject = [
72344
+ 'eventBus',
72345
+ 'modeling'
72346
+ ];
72347
+
72165
72348
  const HIGH_PRIORITY$o = 5000;
72166
72349
 
72167
72350
 
72168
72351
  /**
72169
- * Camunda BPMN specific `camunda:resultVariable` behavior.
72170
- *
72171
- * When `camunda:resultVariable` is removed from a service task like element
72172
- * `camunda:mapDecisionResult` for the element will be cleaned up.
72352
+ * Camunda BPMN specific camunda:resultVariable behavior.
72173
72353
  */
72174
- function UpdateResultVariableBehavior(eventBus) {
72175
-
72176
- CommandInterceptor.call(this, eventBus);
72354
+ class UpdateResultVariableBehavior extends CommandInterceptor {
72355
+ constructor(eventBus) {
72356
+ super(eventBus);
72177
72357
 
72178
- this.preExecute([ 'properties-panel.update-businessobject', 'element.updateProperties' ],
72179
- HIGH_PRIORITY$o, function(context) {
72358
+ /**
72359
+ * Remove camunda:mapDecisionResult on camunda:resultVariable removed.
72360
+ */
72361
+ this.preExecute([
72362
+ 'element.updateProperties',
72363
+ 'properties-panel.update-businessobject'
72364
+ ], HIGH_PRIORITY$o, function(context) {
72180
72365
  const {
72181
72366
  element,
72182
72367
  properties
72183
72368
  } = context;
72184
72369
 
72185
72370
  if (
72186
- is$1(element, 'camunda:DmnCapable') &&
72187
- has(properties, 'camunda:resultVariable') &&
72188
- isEmpty$2(properties['camunda:resultVariable'])
72371
+ is$1(element, 'camunda:DmnCapable')
72372
+ && has(properties, 'camunda:resultVariable')
72373
+ && isEmpty$1(properties[ 'camunda:resultVariable' ])
72189
72374
  ) {
72190
- properties['camunda:mapDecisionResult'] = null;
72375
+ properties[ 'camunda:mapDecisionResult' ] = null;
72191
72376
  }
72192
72377
  }, true);
72193
- }
72194
72378
 
72379
+ }
72380
+ }
72195
72381
 
72196
72382
  UpdateResultVariableBehavior.$inject = [
72197
72383
  'eventBus'
72198
72384
  ];
72199
72385
 
72200
- inherits_browser(UpdateResultVariableBehavior, CommandInterceptor);
72201
-
72202
72386
 
72203
- // helper //////////////////
72387
+ // helpers //////////
72204
72388
 
72205
- function isEmpty$2(value) {
72389
+ function isEmpty$1(value) {
72206
72390
  return value == undefined || value === '';
72207
72391
  }
72208
72392
 
72209
72393
  /**
72210
- * Camunda BPMN specific user task forms behavior ensuring that only one of the following options is configured:
72211
- *
72212
- * 1. embedded, external or Camunda forms using camunda:formKey
72213
- * 2. Camunda forms using camunda:formRef
72394
+ * Camunda BPMN specific user task forms behavior.
72214
72395
  */
72215
72396
  class UserTaskFormsBehavior extends CommandInterceptor {
72216
72397
  constructor(eventBus) {
72217
72398
  super(eventBus);
72218
72399
 
72400
+ /**
72401
+ * Ensure that only one of the following options is configured:
72402
+ *
72403
+ * 1. embedded, external or Camunda forms using camunda:formKey
72404
+ * 2. Camunda forms using camunda:formRef
72405
+ */
72219
72406
  this.preExecute([
72220
72407
  'element.updateProperties',
72221
72408
  'element.updateModdleProperties',
@@ -72229,13 +72416,13 @@
72229
72416
  context.element.businessObject
72230
72417
  );
72231
72418
 
72232
- if ('camunda:formKey' in properties) {
72419
+ if (has(properties, 'camunda:formKey')) {
72233
72420
  Object.assign(properties, {
72234
72421
  'camunda:formRef': undefined,
72235
72422
  'camunda:formRefBinding': undefined,
72236
72423
  'camunda:formRefVersion': undefined
72237
72424
  });
72238
- } else if ('camunda:formRef' in properties) {
72425
+ } else if (has(properties, 'camunda:formRef')) {
72239
72426
  Object.assign(properties, {
72240
72427
  'camunda:formKey': undefined
72241
72428
  });
@@ -72247,23 +72434,23 @@
72247
72434
  });
72248
72435
  }
72249
72436
 
72250
- if (!('camunda:formRefBinding' in properties) && isUndefined(businessObject.get('camunda:formRefBinding'))) {
72437
+ if (!has(properties, 'camunda:formRefBinding') && isUndefined(businessObject.get('camunda:formRefBinding'))) {
72251
72438
  Object.assign(properties, {
72252
72439
  'camunda:formRefBinding': 'latest'
72253
72440
  });
72254
72441
  }
72255
72442
  }
72256
72443
 
72257
- if ('camunda:formRefBinding' in properties && properties[ 'camunda:formRefBinding' ] !== 'version') {
72444
+ if (has(properties, 'camunda:formRefBinding') && properties[ 'camunda:formRefBinding' ] !== 'version') {
72258
72445
  Object.assign(properties, {
72259
72446
  'camunda:formRefVersion': undefined
72260
72447
  });
72261
72448
  }
72262
72449
  }, true);
72450
+
72263
72451
  }
72264
72452
  }
72265
72453
 
72266
-
72267
72454
  UserTaskFormsBehavior.$inject = [ 'eventBus' ];
72268
72455
 
72269
72456
  /**
@@ -85088,7 +85275,7 @@
85088
85275
 
85089
85276
  var constraints = property.constraints || {};
85090
85277
 
85091
- if (constraints.notEmpty && isEmpty$3(value)) {
85278
+ if (constraints.notEmpty && isEmpty$2(value)) {
85092
85279
  return translate('Must not be empty');
85093
85280
  }
85094
85281
 
@@ -85165,7 +85352,7 @@
85165
85352
  return regexp.test(str);
85166
85353
  }
85167
85354
 
85168
- function isEmpty$3(str) {
85355
+ function isEmpty$2(str) {
85169
85356
  return !str || /^\s*$/.test(str);
85170
85357
  }
85171
85358