bpmn-js 8.9.0 → 8.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ All notable changes to [bpmn-js](https://github.com/bpmn-io/bpmn-js) are documen
6
6
 
7
7
  ___Note:__ Yet to be released changes appear here._
8
8
 
9
+ ## 8.9.1
10
+
11
+ * `FIX`: re-use process for redo of first participant ([#1439](https://github.com/bpmn-io/bpmn-js/issues/1439))
12
+ * `FIX`: ensure IDs are claimed when used ([#1555](https://github.com/bpmn-io/bpmn-js/issues/1555))
13
+ * `FIX`: prevent morphing data stores outside participants ([#1508](https://github.com/bpmn-io/bpmn-js/issues/1508))
14
+
9
15
  ## 8.9.0
10
16
 
11
17
  * `FEAT`: select newly created sub-process ([`6214772b`](https://github.com/bpmn-io/bpmn-js/commit/6214772b8519cb82f61c4867b16c112bc6344922))
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v8.9.0
2
+ * bpmn-js - bpmn-modeler v8.9.1
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2022-01-14
11
+ * Date: 2022-01-24
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -35206,7 +35206,7 @@
35206
35206
  return this._createEntries(element, DATA_OBJECT_REFERENCE);
35207
35207
  }
35208
35208
 
35209
- if (is$1(businessObject, 'bpmn:DataStoreReference')) {
35209
+ if (is$1(businessObject, 'bpmn:DataStoreReference') && !is$1(element.parent, 'bpmn:Collaboration')) {
35210
35210
  return this._createEntries(element, DATA_STORE_REFERENCE);
35211
35211
  }
35212
35212
 
@@ -40549,122 +40549,97 @@
40549
40549
  }
40550
40550
  });
40551
40551
 
40552
- function ensureCollaboration(context) {
40553
- var parent = context.parent,
40554
- collaboration;
40555
-
40552
+ // turn process into collaboration when creating first participant
40553
+ function getOrCreateCollaboration() {
40556
40554
  var rootElement = canvas.getRootElement();
40557
40555
 
40558
40556
  if (is$1(rootElement, 'bpmn:Collaboration')) {
40559
- collaboration = rootElement;
40560
- } else {
40561
-
40562
- // update root element by making collaboration
40563
- collaboration = modeling.makeCollaboration();
40564
-
40565
- // re-use process when creating first participant
40566
- context.process = parent;
40557
+ return rootElement;
40567
40558
  }
40568
40559
 
40569
- context.parent = collaboration;
40560
+ return modeling.makeCollaboration();
40570
40561
  }
40571
40562
 
40572
- // turn process into collaboration before adding participant
40573
- this.preExecute('shape.create', function(context) {
40574
- var parent = context.parent,
40575
- shape = context.shape;
40576
-
40577
- if (is$1(shape, 'bpmn:Participant') && is$1(parent, 'bpmn:Process')) {
40578
- ensureCollaboration(context);
40579
- }
40580
- }, true);
40581
-
40582
- this.execute('shape.create', function(context) {
40583
- var process = context.process,
40584
- shape = context.shape;
40585
-
40586
- if (process) {
40587
- context.oldProcessRef = shape.businessObject.processRef;
40588
-
40589
- // re-use process when creating first participant
40590
- shape.businessObject.processRef = process.businessObject;
40591
- }
40592
- }, true);
40563
+ // when creating mutliple elements through `elements.create` parent must be set to collaboration
40564
+ // and passed to `shape.create` as hint
40565
+ this.preExecute('elements.create', HIGH_PRIORITY$a, function(context) {
40566
+ var elements = context.elements,
40567
+ parent = context.parent,
40568
+ participant = findParticipant(elements),
40569
+ hints;
40593
40570
 
40594
- this.revert('shape.create', function(context) {
40595
- var process = context.process,
40596
- shape = context.shape;
40571
+ if (participant && is$1(parent, 'bpmn:Process')) {
40572
+ context.parent = getOrCreateCollaboration();
40597
40573
 
40598
- if (process) {
40574
+ hints = context.hints = context.hints || {};
40599
40575
 
40600
- // re-use process when creating first participant
40601
- shape.businessObject.processRef = context.oldProcessRef;
40576
+ hints.participant = participant;
40577
+ hints.process = parent;
40578
+ hints.processRef = getBusinessObject(participant).get('processRef');
40602
40579
  }
40603
40580
  }, true);
40604
40581
 
40605
- this.postExecute('shape.create', function(context) {
40606
- var process = context.process,
40582
+ // when creating single shape through `shape.create` parent must be set to collaboration
40583
+ // unless it was already set through `elements.create`
40584
+ this.preExecute('shape.create', function(context) {
40585
+ var parent = context.parent,
40607
40586
  shape = context.shape;
40608
40587
 
40609
- if (process) {
40610
-
40611
- // move children from process to participant
40612
- var processChildren = process.children.slice();
40588
+ if (is$1(shape, 'bpmn:Participant') && is$1(parent, 'bpmn:Process')) {
40589
+ context.parent = getOrCreateCollaboration();
40613
40590
 
40614
- modeling.moveElements(processChildren, { x: 0, y: 0 }, shape);
40591
+ context.process = parent;
40592
+ context.processRef = getBusinessObject(shape).get('processRef');
40615
40593
  }
40616
-
40617
40594
  }, true);
40618
40595
 
40619
- // turn process into collaboration when creating participants
40620
- this.preExecute('elements.create', HIGH_PRIORITY$a, function(context) {
40621
- var elements = context.elements,
40622
- parent = context.parent,
40623
- participant;
40624
-
40625
- var hasParticipants = findParticipant(elements);
40626
-
40627
- if (hasParticipants && is$1(parent, 'bpmn:Process')) {
40628
- ensureCollaboration(context);
40629
-
40630
- participant = findParticipant(elements);
40596
+ // #execute necessary because #preExecute not called on CommandStack#redo
40597
+ this.execute('shape.create', function(context) {
40598
+ var hints = context.hints || {},
40599
+ process = context.process || hints.process,
40600
+ shape = context.shape,
40601
+ participant = hints.participant;
40631
40602
 
40632
- context.oldProcessRef = participant.businessObject.processRef;
40603
+ // both shape.create and elements.create must be handled
40604
+ if (process && (!participant || shape === participant)) {
40633
40605
 
40634
- // re-use process when creating first participant
40635
- participant.businessObject.processRef = parent.businessObject;
40606
+ // monkey-patch process ref
40607
+ getBusinessObject(shape).set('processRef', getBusinessObject(process));
40636
40608
  }
40637
40609
  }, true);
40638
40610
 
40639
- this.revert('elements.create', function(context) {
40640
- var elements = context.elements,
40641
- process = context.process,
40642
- participant;
40611
+ this.revert('shape.create', function(context) {
40612
+ var hints = context.hints || {},
40613
+ process = context.process || hints.process,
40614
+ processRef = context.processRef || hints.processRef,
40615
+ shape = context.shape,
40616
+ participant = hints.participant;
40643
40617
 
40644
- if (process) {
40645
- participant = findParticipant(elements);
40618
+ // both shape.create and elements.create must be handled
40619
+ if (process && (!participant || shape === participant)) {
40646
40620
 
40647
- // re-use process when creating first participant
40648
- participant.businessObject.processRef = context.oldProcessRef;
40621
+ // monkey-patch process ref
40622
+ getBusinessObject(shape).set('processRef', processRef);
40649
40623
  }
40650
40624
  }, true);
40651
40625
 
40652
- this.postExecute('elements.create', function(context) {
40653
- var elements = context.elements,
40654
- process = context.process,
40655
- participant;
40626
+ this.postExecute('shape.create', function(context) {
40627
+ var hints = context.hints || {},
40628
+ process = context.process || context.hints.process,
40629
+ shape = context.shape,
40630
+ participant = hints.participant;
40656
40631
 
40657
40632
  if (process) {
40658
- participant = findParticipant(elements);
40659
-
40660
- // move children from process to first participant
40661
- var processChildren = process.children.slice();
40633
+ var children = process.children.slice();
40662
40634
 
40663
- modeling.moveElements(processChildren, { x: 0, y: 0 }, participant);
40635
+ // both shape.create and elements.create must be handled
40636
+ if (!participant) {
40637
+ modeling.moveElements(children, { x: 0, y: 0 }, shape);
40638
+ } else if (shape === participant) {
40639
+ modeling.moveElements(children, { x: 0, y: 0 }, participant);
40640
+ }
40664
40641
  }
40665
-
40666
40642
  }, true);
40667
-
40668
40643
  }
40669
40644
 
40670
40645
  CreateParticipantBehavior.$inject = [
@@ -44085,7 +44060,9 @@
44085
44060
  var rootElement = canvas.getRootElement(),
44086
44061
  rootElementBo = rootElement.businessObject;
44087
44062
 
44088
- moddle.ids.unclaim(rootElementBo.id);
44063
+ if (is$1(rootElement, 'bpmn:Collaboration')) {
44064
+ moddle.ids.unclaim(rootElementBo.id);
44065
+ }
44089
44066
  });
44090
44067
  }
44091
44068
 
@@ -48033,6 +48010,10 @@
48033
48010
  };
48034
48011
 
48035
48012
  BpmnFactory.prototype._ensureId = function(element) {
48013
+ if (element.id) {
48014
+ this._model.ids.claim(element.id, element);
48015
+ return;
48016
+ }
48036
48017
 
48037
48018
  // generate semantic ids for elements
48038
48019
  // bpmn:SequenceFlow -> SequenceFlow_ID