bpmn-js 11.0.4 → 11.1.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v11.0.4
2
+ * bpmn-js - bpmn-modeler v11.1.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: 2022-12-07
11
+ * Date: 2022-12-12
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -21907,6 +21907,9 @@
21907
21907
 
21908
21908
  };
21909
21909
 
21910
+ Overlays.prototype.isShown = function() {
21911
+ return this._overlayRoot.style.display !== 'none';
21912
+ };
21910
21913
 
21911
21914
  Overlays.prototype.show = function() {
21912
21915
  setVisible$1(this._overlayRoot);
@@ -27813,7 +27816,9 @@
27813
27816
 
27814
27817
 
27815
27818
  /**
27816
- * Trigger context pad action.
27819
+ * Trigger context pad via DOM event.
27820
+ *
27821
+ * The entry to trigger is determined by the target element.
27817
27822
  *
27818
27823
  * @param {string} action
27819
27824
  * @param {Event} event
@@ -27821,10 +27826,7 @@
27821
27826
  */
27822
27827
  ContextPad.prototype.trigger = function(action, event, autoActivate) {
27823
27828
 
27824
- var target = this._current.target,
27825
- entries = this._current.entries,
27826
- entry,
27827
- handler,
27829
+ var entry,
27828
27830
  originalEvent,
27829
27831
  button = event.delegateTarget || event.target;
27830
27832
 
@@ -27832,19 +27834,45 @@
27832
27834
  return event.preventDefault();
27833
27835
  }
27834
27836
 
27835
- entry = entries[attr$1(button, 'data-action')];
27836
- handler = entry.action;
27837
-
27837
+ entry = attr$1(button, 'data-action');
27838
27838
  originalEvent = event.originalEvent || event;
27839
27839
 
27840
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
27841
+ };
27842
+
27843
+ /**
27844
+ * Trigger context pad entry entry.
27845
+ *
27846
+ * @param {string} entryId
27847
+ * @param {string} action
27848
+ * @param {Event} event
27849
+ * @param {boolean} [autoActivate=false]
27850
+ */
27851
+ ContextPad.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
27852
+
27853
+ if (!this.isShown()) {
27854
+ return;
27855
+ }
27856
+
27857
+ var target = this._current.target,
27858
+ entries = this._current.entries;
27859
+
27860
+ var entry = entries[entryId];
27861
+
27862
+ if (!entry) {
27863
+ return;
27864
+ }
27865
+
27866
+ var handler = entry.action;
27867
+
27840
27868
  // simple action (via callback function)
27841
27869
  if (isFunction(handler)) {
27842
27870
  if (action === 'click') {
27843
- return handler(originalEvent, target, autoActivate);
27871
+ return handler(event, target, autoActivate);
27844
27872
  }
27845
27873
  } else {
27846
27874
  if (handler[action]) {
27847
- return handler[action](originalEvent, target, autoActivate);
27875
+ return handler[action](event, target, autoActivate);
27848
27876
  }
27849
27877
  }
27850
27878
 
@@ -28045,6 +28073,16 @@
28045
28073
  };
28046
28074
 
28047
28075
 
28076
+ /**
28077
+ * Check if pad is open and not hidden.
28078
+ *
28079
+ * @return {boolean}
28080
+ */
28081
+ ContextPad.prototype.isShown = function() {
28082
+ return this.isOpen() && this._overlays.isShown();
28083
+ };
28084
+
28085
+
28048
28086
  /**
28049
28087
  * Get contex pad position.
28050
28088
  *
@@ -28301,7 +28339,9 @@
28301
28339
  width,
28302
28340
  scale,
28303
28341
  search,
28304
- entries: originalEntries
28342
+ entries: originalEntries,
28343
+ onOpened,
28344
+ onClosed
28305
28345
  } = props;
28306
28346
 
28307
28347
  const searchable = F(() => {
@@ -28319,6 +28359,14 @@
28319
28359
  const [ entries, setEntries ] = p(originalEntries);
28320
28360
  const [ selectedEntry, setSelectedEntry ] = p(entries[0]);
28321
28361
 
28362
+ h(() => {
28363
+ onOpened();
28364
+
28365
+ return () => {
28366
+ onClosed();
28367
+ };
28368
+ }, []);
28369
+
28322
28370
  const updateEntries = T((newEntries) => {
28323
28371
 
28324
28372
  // select first entry if non is selected
@@ -28341,10 +28389,8 @@
28341
28389
  }
28342
28390
 
28343
28391
  const search = [
28344
- entry.name,
28345
28392
  entry.description || '',
28346
- entry.label || '',
28347
- entry.id || ''
28393
+ entry.label || ''
28348
28394
  ]
28349
28395
  .join('---')
28350
28396
  .toLowerCase();
@@ -28679,6 +28725,8 @@
28679
28725
  entries=${ entriesArray }
28680
28726
  headerEntries=${ headerEntriesArray }
28681
28727
  scale=${ scale }
28728
+ onOpened=${ this._onOpened.bind(this) }
28729
+ onClosed=${ this._onClosed.bind(this) }
28682
28730
  ...${{ ...options }}
28683
28731
  />
28684
28732
  `,
@@ -28782,6 +28830,14 @@
28782
28830
  this._eventBus.fire(`popupMenu.${ event }`, payload);
28783
28831
  };
28784
28832
 
28833
+ PopupMenu.prototype._onOpened = function() {
28834
+ this._emit('opened');
28835
+ };
28836
+
28837
+ PopupMenu.prototype._onClosed = function() {
28838
+ this._emit('closed');
28839
+ };
28840
+
28785
28841
  PopupMenu.prototype._createContainer = function(config) {
28786
28842
 
28787
28843
  let parent = config && config.parent || 'body';
@@ -39650,6 +39706,7 @@
39650
39706
  var directEditing = injector.get('directEditing', false);
39651
39707
  var searchPad = injector.get('searchPad', false);
39652
39708
  var modeling = injector.get('modeling', false);
39709
+ var contextPad = injector.get('contextPad', false);
39653
39710
 
39654
39711
  // (2) check components and register actions
39655
39712
 
@@ -39773,6 +39830,12 @@
39773
39830
  });
39774
39831
  }
39775
39832
 
39833
+ if (selection && contextPad) {
39834
+ this._registerAction('replaceElement', function(event) {
39835
+ contextPad.triggerEntry('replace', 'click', event);
39836
+ });
39837
+ }
39838
+
39776
39839
  };
39777
39840
 
39778
39841
  var EditorActionsModule = {
@@ -40891,6 +40954,23 @@
40891
40954
  }
40892
40955
  });
40893
40956
 
40957
+ // activate replace element
40958
+ // R
40959
+ addListener('replaceElement', function(context) {
40960
+
40961
+ var event = context.keyEvent;
40962
+
40963
+ if (keyboard.hasModifier(event)) {
40964
+ return;
40965
+ }
40966
+
40967
+ if (keyboard.isKey([ 'r', 'R' ], event)) {
40968
+ editorActions.trigger('replaceElement', event);
40969
+
40970
+ return true;
40971
+ }
40972
+ });
40973
+
40894
40974
  };
40895
40975
 
40896
40976
  var KeyboardModule = {