camunda-bpmn-js 0.24.0 → 1.0.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.
Files changed (27) hide show
  1. package/dist/assets/color-picker.css +10 -0
  2. package/dist/assets/diagram-js.css +26 -24
  3. package/dist/base-modeler.development.js +144 -48
  4. package/dist/base-modeler.production.min.js +39 -25
  5. package/dist/base-navigated-viewer.development.js +3 -0
  6. package/dist/base-navigated-viewer.production.min.js +1 -1
  7. package/dist/base-viewer.development.js +3 -0
  8. package/dist/base-viewer.production.min.js +1 -1
  9. package/dist/camunda-cloud-modeler.development.js +480 -144
  10. package/dist/camunda-cloud-modeler.production.min.js +50 -36
  11. package/dist/camunda-cloud-navigated-viewer.development.js +3 -0
  12. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  13. package/dist/camunda-cloud-viewer.development.js +3 -0
  14. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  15. package/dist/camunda-platform-modeler.development.js +534 -49
  16. package/dist/camunda-platform-modeler.production.min.js +41 -27
  17. package/dist/camunda-platform-navigated-viewer.development.js +3 -0
  18. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  19. package/dist/camunda-platform-viewer.development.js +3 -0
  20. package/dist/camunda-platform-viewer.production.min.js +1 -1
  21. package/lib/camunda-cloud/Modeler.js +5 -1
  22. package/lib/camunda-cloud/features/replace/ElementTemplatesReplaceProvider.js +4 -135
  23. package/lib/camunda-platform/Modeler.js +6 -1
  24. package/lib/shared/features/replace/UnlinkTemplateReplaceProvider.js +178 -0
  25. package/lib/shared/features/replace/index.js +8 -0
  26. package/lib/{camunda-cloud/features/replace → shared/features/replace/util}/ReplaceOptionsUtil.js +0 -0
  27. package/package.json +8 -6
@@ -0,0 +1,10 @@
1
+ /* COLOR PICKER */
2
+
3
+ .djs-popup.color-picker .entry {
4
+ margin: 0;
5
+ }
6
+
7
+ .djs-popup.color-picker .djs-popup-group {
8
+ display: grid;
9
+ grid: auto-flow / 1fr 1fr 1fr;
10
+ }
@@ -54,8 +54,9 @@
54
54
  --palette-background-color: var(--color-grey-225-10-97);
55
55
  --palette-border-color: var(--color-grey-225-10-75);
56
56
 
57
+ --popup-font-size: 14px;
57
58
  --popup-header-entry-selected-color: var(--color-blue-205-100-50);
58
- --popup-header-separator-color: var(--color-grey-225-10-75);
59
+ --popup-header-font-weight: bolder;
59
60
  --popup-background-color: var(--color-white);
60
61
  --popup-border-color: var(--color-grey-225-10-75);
61
62
  --popup-shadow-color: var(--color-grey-225-10-80);
@@ -536,12 +537,13 @@ marker.djs-dragger tspan {
536
537
  box-shadow: 0px 2px 10px var(--popup-shadow-color);
537
538
  min-width: 120px;
538
539
  outline: none;
540
+ font-size: var(--popup-font-size);
539
541
  }
540
542
 
541
543
  .djs-popup-search input {
542
544
  width: 100%;
543
545
  box-sizing: border-box;
544
- font-size: 14px;
546
+ font-size: var(--popup-font-size);
545
547
  padding: 3px 6px;
546
548
  border-radius: 2px;
547
549
  border: solid 1px var(--popup-search-border-color);
@@ -562,7 +564,6 @@ marker.djs-dragger tspan {
562
564
  }
563
565
 
564
566
  .djs-popup-header .entry {
565
- font-size: 19.5px;
566
567
  border-radius: 2px;
567
568
  }
568
569
 
@@ -579,11 +580,10 @@ marker.djs-dragger tspan {
579
580
  }
580
581
 
581
582
  .djs-popup-title {
582
- font-size: 14px;
583
- font-weight: 500;
583
+ font-size: var(--popup-font-size);
584
+ font-weight: var(--popup-header-font-weight);
584
585
  flex: 1;
585
586
  margin: 0;
586
- width: max-content;
587
587
  }
588
588
 
589
589
  .djs-popup-search {
@@ -620,19 +620,26 @@ marker.djs-dragger tspan {
620
620
  padding: 5px 7px;
621
621
  cursor: default;
622
622
  border-radius: 4px;
623
- font-size: 14px;
624
623
  }
625
624
 
626
625
  .djs-popup-body .entry-header {
627
- font-weight: 500;
626
+ font-weight: var(--popup-header-font-weight);
628
627
  color: var(--popup-entry-title-color);
629
628
  padding-left: 0;
630
629
  }
631
630
 
631
+ .djs-popup [class*="icon"] .djs-popup-label,
632
+ .djs-popup-label:not(:first-child) {
633
+ margin-left: .5em;
634
+ }
635
+
636
+ .djs-popup [class*="icon"]:before,
632
637
  .djs-popup-entry-icon {
633
- width: 16px;
634
- margin-right: 0.5rem;
635
- margin-bottom: -0.2rem;
638
+ width: 1em;
639
+ height: 1em;
640
+ display: inline-block;
641
+ font-size: 1.4em;
642
+ vertical-align: middle;
636
643
  }
637
644
 
638
645
  .djs-popup-body .entry-header:not(:first-child) {
@@ -666,10 +673,15 @@ marker.djs-dragger tspan {
666
673
  color: var(--popup-description-color);
667
674
  }
668
675
 
669
- .djs-popup-entry-name,
676
+ .djs-popup-label,
670
677
  .djs-popup-entry-description {
671
678
  line-height: 1.4em;
672
- display: block;
679
+ }
680
+
681
+ .djs-popup-title,
682
+ .djs-popup-label,
683
+ .djs-popup-entry-description,
684
+ .djs-popup .entry-header {
673
685
  overflow: hidden;
674
686
  text-overflow: ellipsis;
675
687
  white-space: nowrap;
@@ -686,15 +698,6 @@ marker.djs-dragger tspan {
686
698
  overflow: hidden;
687
699
  }
688
700
 
689
- .djs-popup-entry-name[class^="bpmn-icon-"]:before,
690
- .djs-popup-entry-name[class*=" bpmn-icon-"]:before,
691
- .djs-popup-entry-icon {
692
- display: inline-block;
693
- font-size: 1.4em;
694
- vertical-align: middle;
695
- margin-right: 0.5rem;
696
- }
697
-
698
701
  .djs-popup-body {
699
702
  flex-direction: column;
700
703
  width: auto;
@@ -711,13 +714,12 @@ marker.djs-dragger tspan {
711
714
 
712
715
  .djs-popup *::-webkit-scrollbar-track {
713
716
  box-shadow: none;
714
- background: transparent1;
717
+ background: transparent;
715
718
  margin: 0;
716
719
  padding: 5px;
717
720
  }
718
721
 
719
722
  .djs-popup-no-results {
720
- font-size: 14px;
721
723
  padding: 0 12px 12px 12px;
722
724
  color: var(--popup-no-results-color);
723
725
  }
@@ -22147,6 +22147,9 @@
22147
22147
 
22148
22148
  };
22149
22149
 
22150
+ Overlays.prototype.isShown = function() {
22151
+ return this._overlayRoot.style.display !== 'none';
22152
+ };
22150
22153
 
22151
22154
  Overlays.prototype.show = function() {
22152
22155
  setVisible$1(this._overlayRoot);
@@ -28053,7 +28056,9 @@
28053
28056
 
28054
28057
 
28055
28058
  /**
28056
- * Trigger context pad action.
28059
+ * Trigger context pad via DOM event.
28060
+ *
28061
+ * The entry to trigger is determined by the target element.
28057
28062
  *
28058
28063
  * @param {string} action
28059
28064
  * @param {Event} event
@@ -28061,10 +28066,7 @@
28061
28066
  */
28062
28067
  ContextPad.prototype.trigger = function(action, event, autoActivate) {
28063
28068
 
28064
- var target = this._current.target,
28065
- entries = this._current.entries,
28066
- entry,
28067
- handler,
28069
+ var entry,
28068
28070
  originalEvent,
28069
28071
  button = event.delegateTarget || event.target;
28070
28072
 
@@ -28072,19 +28074,45 @@
28072
28074
  return event.preventDefault();
28073
28075
  }
28074
28076
 
28075
- entry = entries[attr$1(button, 'data-action')];
28076
- handler = entry.action;
28077
-
28077
+ entry = attr$1(button, 'data-action');
28078
28078
  originalEvent = event.originalEvent || event;
28079
28079
 
28080
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
28081
+ };
28082
+
28083
+ /**
28084
+ * Trigger context pad entry entry.
28085
+ *
28086
+ * @param {string} entryId
28087
+ * @param {string} action
28088
+ * @param {Event} event
28089
+ * @param {boolean} [autoActivate=false]
28090
+ */
28091
+ ContextPad.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
28092
+
28093
+ if (!this.isShown()) {
28094
+ return;
28095
+ }
28096
+
28097
+ var target = this._current.target,
28098
+ entries = this._current.entries;
28099
+
28100
+ var entry = entries[entryId];
28101
+
28102
+ if (!entry) {
28103
+ return;
28104
+ }
28105
+
28106
+ var handler = entry.action;
28107
+
28080
28108
  // simple action (via callback function)
28081
28109
  if (isFunction(handler)) {
28082
28110
  if (action === 'click') {
28083
- return handler(originalEvent, target, autoActivate);
28111
+ return handler(event, target, autoActivate);
28084
28112
  }
28085
28113
  } else {
28086
28114
  if (handler[action]) {
28087
- return handler[action](originalEvent, target, autoActivate);
28115
+ return handler[action](event, target, autoActivate);
28088
28116
  }
28089
28117
  }
28090
28118
 
@@ -28285,6 +28313,16 @@
28285
28313
  };
28286
28314
 
28287
28315
 
28316
+ /**
28317
+ * Check if pad is open and not hidden.
28318
+ *
28319
+ * @return {boolean}
28320
+ */
28321
+ ContextPad.prototype.isShown = function() {
28322
+ return this.isOpen() && this._overlays.isShown();
28323
+ };
28324
+
28325
+
28288
28326
  /**
28289
28327
  * Get contex pad position.
28290
28328
  *
@@ -28364,14 +28402,11 @@
28364
28402
  onClick
28365
28403
  } = props;
28366
28404
 
28367
- const createImage = imageUrl => {
28368
- return m$2`<img src=${ imageUrl } class="djs-popup-entry-icon" />`;
28369
- };
28370
-
28371
28405
  return m$2`
28372
28406
  <li
28373
28407
  class=${ clsx('entry', { selected }) }
28374
28408
  data-id=${ entry.id }
28409
+ title=${ entry.title || entry.label }
28375
28410
  onClick=${ onClick }
28376
28411
  onMouseEnter=${ onMouseEnter }
28377
28412
  onMouseLeave=${ onMouseLeave }
@@ -28379,10 +28414,16 @@
28379
28414
  <div class="djs-popup-entry-content">
28380
28415
  <span
28381
28416
  class=${ clsx('djs-popup-entry-name', entry.className) }
28382
- title=${ entry.label || entry.name }
28383
28417
  >
28384
- ${ entry.imageUrl ? createImage(entry.imageUrl) : null }
28385
- ${ entry.label || entry.name }
28418
+ ${ entry.imageUrl ? m$2`
28419
+ <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28420
+ ` : null }
28421
+
28422
+ ${ entry.label ? m$2`
28423
+ <span class="djs-popup-label">
28424
+ ${ entry.label }
28425
+ </span>
28426
+ ` : null }
28386
28427
  </span>
28387
28428
  ${ entry.description && m$2`
28388
28429
  <span
@@ -28452,7 +28493,7 @@
28452
28493
  <div class="djs-popup-results" ref=${ resultsRef }>
28453
28494
  ${ groups.map(group => m$2`
28454
28495
  ${ group.name && m$2`
28455
- <div key=${ group.id } class="entry-header">
28496
+ <div key=${ group.id } class="entry-header" title=${ group.name }>
28456
28497
  ${ group.name }
28457
28498
  </div>
28458
28499
  ` }
@@ -28538,7 +28579,9 @@
28538
28579
  width,
28539
28580
  scale,
28540
28581
  search,
28541
- entries: originalEntries
28582
+ entries: originalEntries,
28583
+ onOpened,
28584
+ onClosed
28542
28585
  } = props;
28543
28586
 
28544
28587
  const searchable = F$2(() => {
@@ -28556,6 +28599,14 @@
28556
28599
  const [ entries, setEntries ] = p$3(originalEntries);
28557
28600
  const [ selectedEntry, setSelectedEntry ] = p$3(entries[0]);
28558
28601
 
28602
+ h$2(() => {
28603
+ onOpened();
28604
+
28605
+ return () => {
28606
+ onClosed();
28607
+ };
28608
+ }, []);
28609
+
28559
28610
  const updateEntries = T$3((newEntries) => {
28560
28611
 
28561
28612
  // select first entry if non is selected
@@ -28578,10 +28629,8 @@
28578
28629
  }
28579
28630
 
28580
28631
  const search = [
28581
- entry.name,
28582
28632
  entry.description || '',
28583
- entry.label || '',
28584
- entry.id || ''
28633
+ entry.label || ''
28585
28634
  ]
28586
28635
  .join('---')
28587
28636
  .toLowerCase();
@@ -28680,18 +28729,23 @@
28680
28729
  >
28681
28730
  ${ displayHeader && m$2`
28682
28731
  <div class="djs-popup-header">
28683
- <h3 class="djs-popup-title">${ title }</h3>
28732
+ <h3 class="djs-popup-title" title=${ title }>${ title }</h3>
28684
28733
  ${ headerEntries.map(entry => m$2`
28685
28734
  <span
28686
28735
  class=${ getHeaderClasses(entry, entry === selectedEntry) }
28687
28736
  onClick=${ event => onSelect(event, entry) }
28688
- title=${ entry.title }
28737
+ title=${ entry.title || entry.label }
28689
28738
  data-id=${ entry.id }
28690
28739
  onMouseEnter=${ () => setSelectedEntry(entry) }
28691
28740
  onMouseLeave=${ () => setSelectedEntry(null) }
28692
28741
  >
28693
- ${ entry.imageUrl ? m$2`<img src=${ entry.imageUrl } />` : null }
28694
- ${ entry.label ? entry.label : null }
28742
+ ${ entry.imageUrl ? m$2`
28743
+ <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28744
+ ` : null }
28745
+
28746
+ ${ entry.label ? m$2`
28747
+ <span class="djs-popup-label">${ entry.label }</span>
28748
+ ` : null }
28695
28749
  </span>
28696
28750
  `) }
28697
28751
  </div>
@@ -28911,6 +28965,8 @@
28911
28965
  entries=${ entriesArray }
28912
28966
  headerEntries=${ headerEntriesArray }
28913
28967
  scale=${ scale }
28968
+ onOpened=${ this._onOpened.bind(this) }
28969
+ onClosed=${ this._onClosed.bind(this) }
28914
28970
  ...${{ ...options }}
28915
28971
  />
28916
28972
  `,
@@ -29014,6 +29070,14 @@
29014
29070
  this._eventBus.fire(`popupMenu.${ event }`, payload);
29015
29071
  };
29016
29072
 
29073
+ PopupMenu.prototype._onOpened = function() {
29074
+ this._emit('opened');
29075
+ };
29076
+
29077
+ PopupMenu.prototype._onClosed = function() {
29078
+ this._emit('closed');
29079
+ };
29080
+
29017
29081
  PopupMenu.prototype._createContainer = function(config) {
29018
29082
 
29019
29083
  let parent = config && config.parent || 'body';
@@ -29145,7 +29209,7 @@
29145
29209
  *
29146
29210
  * @example
29147
29211
  * const popupMenuProvider = {
29148
- * getPopupMenuEntries: function(element) {
29212
+ * getPopupMenuEntries(element) {
29149
29213
  * return {
29150
29214
  * 'entry-1': {
29151
29215
  * label: 'My Entry',
@@ -29156,6 +29220,22 @@
29156
29220
  * };
29157
29221
  *
29158
29222
  * popupMenu.registerProvider('myMenuID', popupMenuProvider);
29223
+ *
29224
+ * @example
29225
+ * const replacingPopupMenuProvider = {
29226
+ * getPopupMenuEntries(element) {
29227
+ * return (entries) => {
29228
+ * const {
29229
+ * someEntry,
29230
+ * ...remainingEntries
29231
+ * } = entries;
29232
+ *
29233
+ * return remainingEntries;
29234
+ * };
29235
+ * }
29236
+ * };
29237
+ *
29238
+ * popupMenu.registerProvider('myMenuID', replacingPopupMenuProvider);
29159
29239
  */
29160
29240
  PopupMenu.prototype.registerProvider = function(id, priority, provider) {
29161
29241
  if (!provider) {
@@ -36913,7 +36993,9 @@
36913
36993
  );
36914
36994
 
36915
36995
  var isTriggeredByEventEqual = (
36916
- businessObject.triggeredByEvent === target.triggeredByEvent
36996
+
36997
+ // coherse to <false>
36998
+ !!target.triggeredByEvent === !!businessObject.triggeredByEvent
36917
36999
  );
36918
37000
 
36919
37001
  var isExpandedEqual = (
@@ -37329,6 +37411,15 @@
37329
37411
  ];
37330
37412
 
37331
37413
  var TRANSACTION = [
37414
+ {
37415
+ label: 'Transaction',
37416
+ actionName: 'replace-with-transaction',
37417
+ className: 'bpmn-icon-transaction',
37418
+ target: {
37419
+ type: 'bpmn:Transaction',
37420
+ isExpanded: true
37421
+ }
37422
+ },
37332
37423
  {
37333
37424
  label: 'Sub Process',
37334
37425
  actionName: 'replace-with-subprocess',
@@ -37350,26 +37441,7 @@
37350
37441
  }
37351
37442
  ];
37352
37443
 
37353
- var EVENT_SUB_PROCESS = [
37354
- {
37355
- label: 'Sub Process',
37356
- actionName: 'replace-with-subprocess',
37357
- className: 'bpmn-icon-subprocess-expanded',
37358
- target: {
37359
- type: 'bpmn:SubProcess',
37360
- isExpanded: true
37361
- }
37362
- },
37363
- {
37364
- label: 'Transaction',
37365
- actionName: 'replace-with-transaction',
37366
- className: 'bpmn-icon-transaction',
37367
- target: {
37368
- type: 'bpmn:Transaction',
37369
- isExpanded: true
37370
- }
37371
- }
37372
- ];
37444
+ var EVENT_SUB_PROCESS = TRANSACTION;
37373
37445
 
37374
37446
  var TASK = [
37375
37447
  {
@@ -39874,6 +39946,7 @@
39874
39946
  var directEditing = injector.get('directEditing', false);
39875
39947
  var searchPad = injector.get('searchPad', false);
39876
39948
  var modeling = injector.get('modeling', false);
39949
+ var contextPad = injector.get('contextPad', false);
39877
39950
 
39878
39951
  // (2) check components and register actions
39879
39952
 
@@ -39997,6 +40070,12 @@
39997
40070
  });
39998
40071
  }
39999
40072
 
40073
+ if (selection && contextPad) {
40074
+ this._registerAction('replaceElement', function(event) {
40075
+ contextPad.triggerEntry('replace', 'click', event);
40076
+ });
40077
+ }
40078
+
40000
40079
  };
40001
40080
 
40002
40081
  var EditorActionsModule = {
@@ -41115,6 +41194,23 @@
41115
41194
  }
41116
41195
  });
41117
41196
 
41197
+ // activate replace element
41198
+ // R
41199
+ addListener('replaceElement', function(context) {
41200
+
41201
+ var event = context.keyEvent;
41202
+
41203
+ if (keyboard.hasModifier(event)) {
41204
+ return;
41205
+ }
41206
+
41207
+ if (keyboard.isKey([ 'r', 'R' ], event)) {
41208
+ editorActions.trigger('replaceElement', event);
41209
+
41210
+ return true;
41211
+ }
41212
+ });
41213
+
41118
41214
  };
41119
41215
 
41120
41216
  var KeyboardModule = {