bpmn-js 11.0.5 → 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.5
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-08
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
  *
@@ -39668,6 +39706,7 @@
39668
39706
  var directEditing = injector.get('directEditing', false);
39669
39707
  var searchPad = injector.get('searchPad', false);
39670
39708
  var modeling = injector.get('modeling', false);
39709
+ var contextPad = injector.get('contextPad', false);
39671
39710
 
39672
39711
  // (2) check components and register actions
39673
39712
 
@@ -39791,6 +39830,12 @@
39791
39830
  });
39792
39831
  }
39793
39832
 
39833
+ if (selection && contextPad) {
39834
+ this._registerAction('replaceElement', function(event) {
39835
+ contextPad.triggerEntry('replace', 'click', event);
39836
+ });
39837
+ }
39838
+
39794
39839
  };
39795
39840
 
39796
39841
  var EditorActionsModule = {
@@ -40909,6 +40954,23 @@
40909
40954
  }
40910
40955
  });
40911
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
+
40912
40974
  };
40913
40975
 
40914
40976
  var KeyboardModule = {