camunda-bpmn-js 5.6.2 → 5.7.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 (79) hide show
  1. package/dist/base-modeler.development.js +294 -147
  2. package/dist/base-modeler.production.min.js +2 -2
  3. package/dist/base-navigated-viewer.development.js +92 -41
  4. package/dist/base-navigated-viewer.production.min.js +1 -1
  5. package/dist/base-viewer.development.js +92 -41
  6. package/dist/base-viewer.production.min.js +1 -1
  7. package/dist/camunda-cloud-modeler.development.js +1578 -403
  8. package/dist/camunda-cloud-modeler.production.min.js +6 -6
  9. package/dist/camunda-cloud-navigated-viewer.development.js +92 -41
  10. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  11. package/dist/camunda-cloud-viewer.development.js +92 -41
  12. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  13. package/dist/camunda-platform-modeler.development.js +294 -147
  14. package/dist/camunda-platform-modeler.production.min.js +5 -5
  15. package/dist/camunda-platform-navigated-viewer.development.js +92 -41
  16. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  17. package/dist/camunda-platform-viewer.development.js +92 -41
  18. package/dist/camunda-platform-viewer.production.min.js +1 -1
  19. package/lib/camunda-cloud/Modeler.js +4 -1
  20. package/lib/camunda-cloud/features/external-resources/README.md +14 -0
  21. package/lib/camunda-cloud/features/external-resources/ResourceLoader.d.ts +6 -0
  22. package/lib/camunda-cloud/features/external-resources/ResourceLoader.js +24 -0
  23. package/lib/camunda-cloud/features/external-resources/Resources.d.ts +7 -0
  24. package/lib/camunda-cloud/features/external-resources/Resources.js +19 -0
  25. package/lib/camunda-cloud/features/external-resources/cmd/ComposedCommandHandler.d.ts +12 -0
  26. package/lib/camunda-cloud/features/external-resources/cmd/ComposedCommandHandler.js +16 -0
  27. package/lib/camunda-cloud/features/external-resources/cmd/index.d.ts +4 -0
  28. package/lib/camunda-cloud/features/external-resources/cmd/index.js +21 -0
  29. package/lib/camunda-cloud/features/external-resources/handlers/decision/AppendMenuProvider.d.ts +5 -0
  30. package/lib/camunda-cloud/features/external-resources/handlers/decision/AppendMenuProvider.js +19 -0
  31. package/lib/camunda-cloud/features/external-resources/handlers/decision/CreateMenuProvider.d.ts +5 -0
  32. package/lib/camunda-cloud/features/external-resources/handlers/decision/CreateMenuProvider.js +19 -0
  33. package/lib/camunda-cloud/features/external-resources/handlers/decision/ReplaceMenuProvider.d.ts +5 -0
  34. package/lib/camunda-cloud/features/external-resources/handlers/decision/ReplaceMenuProvider.js +19 -0
  35. package/lib/camunda-cloud/features/external-resources/handlers/decision/createElement.d.ts +13 -0
  36. package/lib/camunda-cloud/features/external-resources/handlers/decision/createElement.js +35 -0
  37. package/lib/camunda-cloud/features/external-resources/handlers/decision/index.d.ts +8 -0
  38. package/lib/camunda-cloud/features/external-resources/handlers/decision/index.js +14 -0
  39. package/lib/camunda-cloud/features/external-resources/handlers/decision/replaceElement.d.ts +15 -0
  40. package/lib/camunda-cloud/features/external-resources/handlers/decision/replaceElement.js +77 -0
  41. package/lib/camunda-cloud/features/external-resources/handlers/decision/searchTerms.d.ts +1 -0
  42. package/lib/camunda-cloud/features/external-resources/handlers/decision/searchTerms.js +6 -0
  43. package/lib/camunda-cloud/features/external-resources/handlers/form/AppendMenuProvider.d.ts +5 -0
  44. package/lib/camunda-cloud/features/external-resources/handlers/form/AppendMenuProvider.js +19 -0
  45. package/lib/camunda-cloud/features/external-resources/handlers/form/CreateMenuProvider.d.ts +5 -0
  46. package/lib/camunda-cloud/features/external-resources/handlers/form/CreateMenuProvider.js +19 -0
  47. package/lib/camunda-cloud/features/external-resources/handlers/form/ReplaceMenuProvider.d.ts +5 -0
  48. package/lib/camunda-cloud/features/external-resources/handlers/form/ReplaceMenuProvider.js +19 -0
  49. package/lib/camunda-cloud/features/external-resources/handlers/form/createElement.d.ts +9 -0
  50. package/lib/camunda-cloud/features/external-resources/handlers/form/createElement.js +39 -0
  51. package/lib/camunda-cloud/features/external-resources/handlers/form/index.d.ts +8 -0
  52. package/lib/camunda-cloud/features/external-resources/handlers/form/index.js +14 -0
  53. package/lib/camunda-cloud/features/external-resources/handlers/form/replaceElement.d.ts +15 -0
  54. package/lib/camunda-cloud/features/external-resources/handlers/form/replaceElement.js +82 -0
  55. package/lib/camunda-cloud/features/external-resources/handlers/form/searchTerms.d.ts +1 -0
  56. package/lib/camunda-cloud/features/external-resources/handlers/form/searchTerms.js +6 -0
  57. package/lib/camunda-cloud/features/external-resources/handlers/process/AppendMenuProvider.d.ts +5 -0
  58. package/lib/camunda-cloud/features/external-resources/handlers/process/AppendMenuProvider.js +19 -0
  59. package/lib/camunda-cloud/features/external-resources/handlers/process/CreateMenuProvider.d.ts +5 -0
  60. package/lib/camunda-cloud/features/external-resources/handlers/process/CreateMenuProvider.js +19 -0
  61. package/lib/camunda-cloud/features/external-resources/handlers/process/ReplaceMenuProvider.d.ts +5 -0
  62. package/lib/camunda-cloud/features/external-resources/handlers/process/ReplaceMenuProvider.js +19 -0
  63. package/lib/camunda-cloud/features/external-resources/handlers/process/createElement.d.ts +14 -0
  64. package/lib/camunda-cloud/features/external-resources/handlers/process/createElement.js +36 -0
  65. package/lib/camunda-cloud/features/external-resources/handlers/process/index.d.ts +8 -0
  66. package/lib/camunda-cloud/features/external-resources/handlers/process/index.js +14 -0
  67. package/lib/camunda-cloud/features/external-resources/handlers/process/replaceElement.d.ts +16 -0
  68. package/lib/camunda-cloud/features/external-resources/handlers/process/replaceElement.js +78 -0
  69. package/lib/camunda-cloud/features/external-resources/handlers/process/searchTerms.d.ts +1 -0
  70. package/lib/camunda-cloud/features/external-resources/handlers/process/searchTerms.js +6 -0
  71. package/lib/camunda-cloud/features/external-resources/handlers/util/BaseAppendMenuProvider.d.ts +18 -0
  72. package/lib/camunda-cloud/features/external-resources/handlers/util/BaseAppendMenuProvider.js +103 -0
  73. package/lib/camunda-cloud/features/external-resources/handlers/util/BaseCreateMenuProvider.d.ts +17 -0
  74. package/lib/camunda-cloud/features/external-resources/handlers/util/BaseCreateMenuProvider.js +84 -0
  75. package/lib/camunda-cloud/features/external-resources/handlers/util/BaseReplaceMenuProvider.d.ts +22 -0
  76. package/lib/camunda-cloud/features/external-resources/handlers/util/BaseReplaceMenuProvider.js +82 -0
  77. package/lib/camunda-cloud/features/external-resources/index.d.ts +23 -0
  78. package/lib/camunda-cloud/features/external-resources/index.js +27 -0
  79. package/package.json +4 -4
@@ -19001,8 +19001,8 @@
19001
19001
  var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
19002
19002
  xScaleFactor: 0.9,
19003
19003
  yScaleFactor: 0.9,
19004
- containerWidth: element.width,
19005
- containerHeight: element.height,
19004
+ containerWidth: attrs.width || element.width,
19005
+ containerHeight: attrs.height || element.height,
19006
19006
  position: {
19007
19007
  mx: 0.235,
19008
19008
  my: 0.315
@@ -19026,17 +19026,23 @@
19026
19026
  return messagePath;
19027
19027
  },
19028
19028
  'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
19029
- var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
19029
+ var baseWidth = attrs.width || element.width;
19030
+ var baseHeight = attrs.height || element.height;
19031
+
19032
+ // use a lighter stroke for event suprocess icons
19033
+ var strokeWidth = attrs.width ? 1 : 2;
19034
+
19035
+ var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
19030
19036
  fill: getFillColor(element, defaultFillColor, attrs.fill),
19031
19037
  stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19032
- strokeWidth: 2
19038
+ strokeWidth: strokeWidth
19033
19039
  });
19034
19040
 
19035
19041
  var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
19036
19042
  xScaleFactor: 0.75,
19037
19043
  yScaleFactor: 0.75,
19038
- containerWidth: element.width,
19039
- containerHeight: element.height,
19044
+ containerWidth: baseWidth,
19045
+ containerHeight: baseHeight,
19040
19046
  position: {
19041
19047
  mx: 0.5,
19042
19048
  my: 0.5
@@ -19045,23 +19051,23 @@
19045
19051
 
19046
19052
  drawPath(parentGfx, pathData, {
19047
19053
  stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19048
- strokeWidth: 2
19054
+ strokeWidth: strokeWidth
19049
19055
  });
19050
19056
 
19051
19057
  for (var i = 0; i < 12; i++) {
19052
19058
  var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
19053
19059
  xScaleFactor: 0.75,
19054
19060
  yScaleFactor: 0.75,
19055
- containerWidth: element.width,
19056
- containerHeight: element.height,
19061
+ containerWidth: baseWidth,
19062
+ containerHeight: baseHeight,
19057
19063
  position: {
19058
19064
  mx: 0.5,
19059
19065
  my: 0.5
19060
19066
  }
19061
19067
  });
19062
19068
 
19063
- var width = element.width / 2,
19064
- height = element.height / 2;
19069
+ var width = baseWidth / 2,
19070
+ height = baseHeight / 2;
19065
19071
 
19066
19072
  drawPath(parentGfx, linePathData, {
19067
19073
  strokeWidth: 1,
@@ -19076,8 +19082,8 @@
19076
19082
  var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
19077
19083
  xScaleFactor: 1,
19078
19084
  yScaleFactor: 1,
19079
- containerWidth: event.width,
19080
- containerHeight: event.height,
19085
+ containerWidth: attrs.width || event.width,
19086
+ containerHeight: attrs.height || event.height,
19081
19087
  position: {
19082
19088
  mx: 0.5,
19083
19089
  my: 0.2
@@ -19098,8 +19104,8 @@
19098
19104
  var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
19099
19105
  xScaleFactor: 1,
19100
19106
  yScaleFactor: 1,
19101
- containerWidth: event.width,
19102
- containerHeight: event.height,
19107
+ containerWidth: attrs.width || event.width,
19108
+ containerHeight: attrs.height || event.height,
19103
19109
  position: {
19104
19110
  mx: 0.5,
19105
19111
  my: 0.222
@@ -19138,8 +19144,8 @@
19138
19144
  var pathData = pathMap.getScaledPath('EVENT_ERROR', {
19139
19145
  xScaleFactor: 1.1,
19140
19146
  yScaleFactor: 1.1,
19141
- containerWidth: event.width,
19142
- containerHeight: event.height,
19147
+ containerWidth: attrs.width || event.width,
19148
+ containerHeight: attrs.height || event.height,
19143
19149
  position: {
19144
19150
  mx: 0.2,
19145
19151
  my: 0.722
@@ -19184,8 +19190,8 @@
19184
19190
  var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
19185
19191
  xScaleFactor: 1,
19186
19192
  yScaleFactor: 1,
19187
- containerWidth: event.width,
19188
- containerHeight: event.height,
19193
+ containerWidth: attrs.width || event.width,
19194
+ containerHeight: attrs.height || event.height,
19189
19195
  position: {
19190
19196
  mx: 0.22,
19191
19197
  my: 0.5
@@ -19206,8 +19212,8 @@
19206
19212
  var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
19207
19213
  xScaleFactor: 0.9,
19208
19214
  yScaleFactor: 0.9,
19209
- containerWidth: event.width,
19210
- containerHeight: event.height,
19215
+ containerWidth: attrs.width || event.width,
19216
+ containerHeight: attrs.height || event.height,
19211
19217
  position: {
19212
19218
  mx: 0.5,
19213
19219
  my: 0.2
@@ -19228,10 +19234,10 @@
19228
19234
  var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
19229
19235
  xScaleFactor: 1.1,
19230
19236
  yScaleFactor: 1.1,
19231
- containerWidth: event.width,
19232
- containerHeight: event.height,
19237
+ containerWidth: attrs.width || event.width,
19238
+ containerHeight: attrs.height || event.height,
19233
19239
  position: {
19234
- mx: 0.222,
19240
+ mx: 0.211,
19235
19241
  my: 0.36
19236
19242
  }
19237
19243
  });
@@ -19242,6 +19248,7 @@
19242
19248
 
19243
19249
  return drawPath(parentGfx, pathData, {
19244
19250
  fill,
19251
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19245
19252
  strokeWidth: 1
19246
19253
  });
19247
19254
  },
@@ -19249,8 +19256,8 @@
19249
19256
  var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
19250
19257
  xScaleFactor: 1.2,
19251
19258
  yScaleFactor: 1.2,
19252
- containerWidth: event.width,
19253
- containerHeight: event.height,
19259
+ containerWidth: attrs.width || event.width,
19260
+ containerHeight: attrs.height || event.height,
19254
19261
  position: {
19255
19262
  mx: 0.458,
19256
19263
  my: 0.194
@@ -19274,57 +19281,59 @@
19274
19281
  }
19275
19282
  };
19276
19283
 
19277
- function renderEventIcon(element, parentGfx, attrs = {}) {
19284
+ function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
19278
19285
  var semantic = getBusinessObject$1(element),
19279
19286
  isThrowing = isThrowEvent(semantic);
19280
19287
 
19288
+ var nodeElement = proxyElement || element;
19289
+
19281
19290
  if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
19282
19291
  if (semantic.get('parallelMultiple')) {
19283
- return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
19292
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19284
19293
  }
19285
19294
  else {
19286
- return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
19295
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19287
19296
  }
19288
19297
  }
19289
19298
 
19290
19299
  if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
19291
- return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing);
19300
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19292
19301
  }
19293
19302
 
19294
19303
  if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
19295
- return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing);
19304
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19296
19305
  }
19297
19306
 
19298
19307
  if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
19299
- return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing);
19308
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19300
19309
  }
19301
19310
 
19302
19311
  if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
19303
- return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing);
19312
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19304
19313
  }
19305
19314
 
19306
19315
  if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
19307
- return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing);
19316
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19308
19317
  }
19309
19318
 
19310
19319
  if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
19311
- return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing);
19320
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19312
19321
  }
19313
19322
 
19314
19323
  if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
19315
- return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing);
19324
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19316
19325
  }
19317
19326
 
19318
19327
  if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
19319
- return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing);
19328
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19320
19329
  }
19321
19330
 
19322
19331
  if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
19323
- return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing);
19332
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19324
19333
  }
19325
19334
 
19326
19335
  if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
19327
- return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing);
19336
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19328
19337
  }
19329
19338
 
19330
19339
  return null;
@@ -19746,14 +19755,23 @@
19746
19755
  function renderSubProcess(parentGfx, element, attrs = {}) {
19747
19756
  var activity = renderActivity(parentGfx, element, attrs);
19748
19757
 
19758
+ var expanded = isExpanded$1(element);
19759
+
19749
19760
  if (isEventSubProcess(element)) {
19750
19761
  attr(activity, {
19751
19762
  strokeDasharray: '0, 5.5',
19752
19763
  strokeWidth: 2.5
19753
19764
  });
19754
- }
19755
19765
 
19756
- var expanded = isExpanded$1(element);
19766
+ if (!expanded) {
19767
+ var flowElements = getBusinessObject$1(element).flowElements || [];
19768
+ var startEvents = flowElements.filter(e => is$5(e, 'bpmn:StartEvent'));
19769
+
19770
+ if (startEvents.length === 1) {
19771
+ renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
19772
+ }
19773
+ }
19774
+ }
19757
19775
 
19758
19776
  renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
19759
19777
 
@@ -19766,6 +19784,39 @@
19766
19784
  return activity;
19767
19785
  }
19768
19786
 
19787
+ function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
19788
+ var iconSize = 22;
19789
+
19790
+ // match the colors of the enclosing subprocess
19791
+ var proxyAttrs = {
19792
+ fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
19793
+ stroke: getStrokeColor$1(proxyElement, defaultStrokeColor, attrs.stroke),
19794
+ width: iconSize,
19795
+ height: iconSize
19796
+ };
19797
+
19798
+ var interrupting = getBusinessObject$1(startEvent).isInterrupting;
19799
+ var strokeDasharray = interrupting ? 0 : 3;
19800
+
19801
+ // better visibility for non-interrupting events
19802
+ var strokeWidth = interrupting ? 1 : 1.2;
19803
+
19804
+ // make the icon look larger by drawing a smaller circle
19805
+ var circleSize = 20;
19806
+ var shift = (iconSize - circleSize) / 2;
19807
+ var transform = 'translate(' + shift + ',' + shift + ')';
19808
+
19809
+ drawCircle(parentGfx, circleSize, circleSize, {
19810
+ fill: proxyAttrs.fill,
19811
+ stroke: proxyAttrs.stroke,
19812
+ strokeWidth,
19813
+ strokeDasharray,
19814
+ transform
19815
+ });
19816
+
19817
+ renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
19818
+ }
19819
+
19769
19820
  function renderTask(parentGfx, element, attrs = {}) {
19770
19821
  var activity = renderActivity(parentGfx, element, attrs);
19771
19822
 
@@ -105401,6 +105452,188 @@
105401
105452
  propertiesPanel: ['type', BpmnPropertiesPanelRenderer]
105402
105453
  };
105403
105454
 
105455
+ /**
105456
+ * Create a new element and (optionally) set its parent.
105457
+ *
105458
+ * @param {string} type
105459
+ * @param {Object} properties
105460
+ * @param {import('bpmn-js/lib/model/Types').ModdleElement} parent
105461
+ * @param {import('bpmn-js/lib/features/modeling/BpmnFactory').default} bpmnFactory
105462
+ *
105463
+ * @returns {import('bpmn-js/lib/model/Types').ModdleElement}
105464
+ */
105465
+ function createElement$1(type, properties, parent, bpmnFactory) {
105466
+ const element = bpmnFactory.create(type, properties);
105467
+ if (parent) {
105468
+ element.$parent = parent;
105469
+ }
105470
+ return element;
105471
+ }
105472
+
105473
+ /**
105474
+ * generate a semantic id with given prefix
105475
+ */
105476
+ function nextId$1(prefix) {
105477
+ const ids = new Ids$1([32, 32, 1]);
105478
+ return ids.nextPrefixed(prefix);
105479
+ }
105480
+ function getRoot$1(businessObject) {
105481
+ let parent = businessObject;
105482
+ while (parent.$parent) {
105483
+ parent = parent.$parent;
105484
+ }
105485
+ return parent;
105486
+ }
105487
+ function filterElementsByType(objectList, type) {
105488
+ const list = objectList || [];
105489
+ return list.filter(element => is$5(element, type));
105490
+ }
105491
+ function findRootElementsByType(businessObject, referencedType) {
105492
+ const root = getRoot$1(businessObject);
105493
+ return filterElementsByType(root.get('rootElements'), referencedType);
105494
+ }
105495
+ function findRootElementById(businessObject, type, id) {
105496
+ const elements = findRootElementsByType(businessObject, type);
105497
+ return elements.find(element => element.id === id);
105498
+ }
105499
+
105500
+ /**
105501
+ * createOrUpdateFormalExpression - upserts a specific formal expression
105502
+ *
105503
+ * If the value is falsy, the formal expression is removed.
105504
+ *
105505
+ * @param {djs.model.Base} element
105506
+ * @param {ModdleElement} moddleElement
105507
+ * @param {string} propertyName
105508
+ * @param {string} newValue
105509
+ * @param {BpmnFactory} bpmnFactory
105510
+ * @param {CommandStack} commandStack
105511
+ */
105512
+ function createOrUpdateFormalExpression(element, moddleElement, propertyName, newValue, bpmnFactory, commandStack) {
105513
+ return commandStack.execute('element.updateModdleProperties', createOrUpdateFormalExpressionCommand(element, moddleElement, propertyName, newValue, bpmnFactory));
105514
+ }
105515
+
105516
+ /**
105517
+ * createOrUpdateFormalExpressionCommand - creates a command to upsert a specific formal expression
105518
+ *
105519
+ * If the value is falsy, the formal expression is removed.
105520
+ *
105521
+ * @param {djs.model.Base} element
105522
+ * @param {ModdleElement} moddleElement
105523
+ * @param {string} propertyName
105524
+ * @param {string} newValue
105525
+ * @param {BpmnFactory} bpmnFactory
105526
+ */
105527
+ function createOrUpdateFormalExpressionCommand(element, moddleElement, propertyName, newValue, bpmnFactory) {
105528
+ const expressionProps = {};
105529
+ if (!newValue) {
105530
+ // remove formal expression
105531
+ expressionProps[propertyName] = undefined;
105532
+ return {
105533
+ element,
105534
+ moddleElement,
105535
+ properties: expressionProps
105536
+ };
105537
+ }
105538
+ const existingExpression = moddleElement.get(propertyName);
105539
+ if (existingExpression) {
105540
+ // edit existing formal expression
105541
+ return {
105542
+ element,
105543
+ moddleElement: existingExpression,
105544
+ properties: {
105545
+ body: newValue
105546
+ }
105547
+ };
105548
+ }
105549
+
105550
+ // add formal expression
105551
+ expressionProps[propertyName] = createElement$1('bpmn:FormalExpression', {
105552
+ body: newValue
105553
+ }, moddleElement, bpmnFactory);
105554
+ return {
105555
+ element,
105556
+ moddleElement,
105557
+ properties: expressionProps
105558
+ };
105559
+ }
105560
+
105561
+ /**
105562
+ * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry
105563
+ */
105564
+
105565
+ /**
105566
+ * @returns {Array<Entry>} entries
105567
+ */
105568
+ function AdHocCompletionProps$1(props) {
105569
+ const {
105570
+ element
105571
+ } = props;
105572
+ if (!is$5(element, 'bpmn:AdHocSubProcess')) {
105573
+ return [];
105574
+ }
105575
+ return [{
105576
+ id: 'completionCondition',
105577
+ component: CompletionCondition$3,
105578
+ isEdited: isEdited
105579
+ }, {
105580
+ id: 'cancelRemainingInstances',
105581
+ component: CancelRemainingInstances,
105582
+ isEdited: node => node && !node.checked // the default value is true
105583
+ }];
105584
+ }
105585
+ function CompletionCondition$3(props) {
105586
+ const {
105587
+ element
105588
+ } = props;
105589
+ const bpmnFactory = useService('bpmnFactory');
105590
+ const debounce = useService('debounceInput');
105591
+ const commandStack = useService('commandStack');
105592
+ const translate = useService('translate');
105593
+ const getValue = () => {
105594
+ const expression = getBusinessObject$1(element).get('completionCondition');
105595
+ return expression && expression.get('body');
105596
+ };
105597
+ const setValue = value => {
105598
+ return createOrUpdateFormalExpression(element, getBusinessObject$1(element), 'completionCondition', value, bpmnFactory, commandStack);
105599
+ };
105600
+ return TextfieldEntry({
105601
+ element,
105602
+ id: 'completionCondition',
105603
+ label: translate('Completion condition'),
105604
+ getValue,
105605
+ setValue,
105606
+ debounce
105607
+ });
105608
+ }
105609
+ function CancelRemainingInstances(props) {
105610
+ const {
105611
+ element
105612
+ } = props;
105613
+ const commandStack = useService('commandStack');
105614
+ const translate = useService('translate');
105615
+ const businessObject = getBusinessObject$1(element);
105616
+ const getValue = () => {
105617
+ return businessObject.get('cancelRemainingInstances');
105618
+ };
105619
+ const setValue = value => {
105620
+ commandStack.execute('element.updateModdleProperties', {
105621
+ element,
105622
+ moddleElement: businessObject,
105623
+ properties: {
105624
+ cancelRemainingInstances: value
105625
+ }
105626
+ });
105627
+ };
105628
+ return CheckboxEntry({
105629
+ element,
105630
+ id: 'cancelRemainingInstances',
105631
+ label: translate('Cancel remaining instances'),
105632
+ getValue,
105633
+ setValue
105634
+ });
105635
+ }
105636
+
105404
105637
  function ReferenceSelectEntry(props) {
105405
105638
  const {
105406
105639
  autoFocusEntry,
@@ -105832,51 +106065,6 @@
105832
106065
  };
105833
106066
  }
105834
106067
 
105835
- /**
105836
- * Create a new element and (optionally) set its parent.
105837
- *
105838
- * @param {string} type
105839
- * @param {Object} properties
105840
- * @param {import('bpmn-js/lib/model/Types').ModdleElement} parent
105841
- * @param {import('bpmn-js/lib/features/modeling/BpmnFactory').default} bpmnFactory
105842
- *
105843
- * @returns {import('bpmn-js/lib/model/Types').ModdleElement}
105844
- */
105845
- function createElement$1(type, properties, parent, bpmnFactory) {
105846
- const element = bpmnFactory.create(type, properties);
105847
- if (parent) {
105848
- element.$parent = parent;
105849
- }
105850
- return element;
105851
- }
105852
-
105853
- /**
105854
- * generate a semantic id with given prefix
105855
- */
105856
- function nextId$1(prefix) {
105857
- const ids = new Ids$1([32, 32, 1]);
105858
- return ids.nextPrefixed(prefix);
105859
- }
105860
- function getRoot$1(businessObject) {
105861
- let parent = businessObject;
105862
- while (parent.$parent) {
105863
- parent = parent.$parent;
105864
- }
105865
- return parent;
105866
- }
105867
- function filterElementsByType(objectList, type) {
105868
- const list = objectList || [];
105869
- return list.filter(element => is$5(element, type));
105870
- }
105871
- function findRootElementsByType(businessObject, referencedType) {
105872
- const root = getRoot$1(businessObject);
105873
- return filterElementsByType(root.get('rootElements'), referencedType);
105874
- }
105875
- function findRootElementById(businessObject, type, id) {
105876
- const elements = findRootElementsByType(businessObject, type);
105877
- return elements.find(element => element.id === id);
105878
- }
105879
-
105880
106068
  const EMPTY_OPTION$4 = '';
105881
106069
  const CREATE_NEW_OPTION$4 = 'create-new';
105882
106070
 
@@ -106618,7 +106806,7 @@
106618
106806
  isEdited: isEdited
106619
106807
  }, {
106620
106808
  id: 'completionCondition',
106621
- component: CompletionCondition$1,
106809
+ component: CompletionCondition$2,
106622
106810
  isEdited: isEdited
106623
106811
  }];
106624
106812
  return entries;
@@ -106635,7 +106823,7 @@
106635
106823
  return getLoopCardinalityValue(element);
106636
106824
  };
106637
106825
  const setValue = value => {
106638
- return commandStack.execute('element.updateModdleProperties', updateFormalExpression(element, 'loopCardinality', value, bpmnFactory));
106826
+ return createOrUpdateFormalExpression(element, getLoopCharacteristics$2(element), 'loopCardinality', value, bpmnFactory, commandStack);
106639
106827
  };
106640
106828
  return TextfieldEntry({
106641
106829
  element,
@@ -106646,7 +106834,7 @@
106646
106834
  debounce
106647
106835
  });
106648
106836
  }
106649
- function CompletionCondition$1(props) {
106837
+ function CompletionCondition$2(props) {
106650
106838
  const {
106651
106839
  element
106652
106840
  } = props;
@@ -106658,7 +106846,7 @@
106658
106846
  return getCompletionConditionValue(element);
106659
106847
  };
106660
106848
  const setValue = value => {
106661
- return commandStack.execute('element.updateModdleProperties', updateFormalExpression(element, 'completionCondition', value, bpmnFactory));
106849
+ return createOrUpdateFormalExpression(element, getLoopCharacteristics$2(element), 'completionCondition', value, bpmnFactory, commandStack);
106662
106850
  };
106663
106851
  return TextfieldEntry({
106664
106852
  element,
@@ -106719,62 +106907,6 @@
106719
106907
  return bo.loopCharacteristics;
106720
106908
  }
106721
106909
 
106722
- /**
106723
- * createFormalExpression - creates a 'bpmn:FormalExpression' element.
106724
- *
106725
- * @param {ModdleElement} parent
106726
- * @param {string} body
106727
- * @param {BpmnFactory} bpmnFactory
106728
- *
106729
- * @result {ModdleElement<bpmn:FormalExpression>} a formal expression
106730
- */
106731
- function createFormalExpression$1(parent, body, bpmnFactory) {
106732
- return createElement$1('bpmn:FormalExpression', {
106733
- body: body
106734
- }, parent, bpmnFactory);
106735
- }
106736
-
106737
- /**
106738
- * updateFormalExpression - updates a specific formal expression of the loop characteristics.
106739
- *
106740
- * @param {djs.model.Base} element
106741
- * @param {string} propertyName
106742
- * @param {string} newValue
106743
- * @param {BpmnFactory} bpmnFactory
106744
- */
106745
- function updateFormalExpression(element, propertyName, newValue, bpmnFactory) {
106746
- const loopCharacteristics = getLoopCharacteristics$2(element);
106747
- const expressionProps = {};
106748
- if (!newValue) {
106749
- // remove formal expression
106750
- expressionProps[propertyName] = undefined;
106751
- return {
106752
- element,
106753
- moddleElement: loopCharacteristics,
106754
- properties: expressionProps
106755
- };
106756
- }
106757
- const existingExpression = loopCharacteristics.get(propertyName);
106758
- if (!existingExpression) {
106759
- // add formal expression
106760
- expressionProps[propertyName] = createFormalExpression$1(loopCharacteristics, newValue, bpmnFactory);
106761
- return {
106762
- element,
106763
- moddleElement: loopCharacteristics,
106764
- properties: expressionProps
106765
- };
106766
- }
106767
-
106768
- // edit existing formal expression
106769
- return {
106770
- element,
106771
- moddleElement: existingExpression,
106772
- properties: {
106773
- body: newValue
106774
- }
106775
- };
106776
- }
106777
-
106778
106910
  // loopCardinality
106779
106911
 
106780
106912
  /**
@@ -107598,8 +107730,23 @@
107598
107730
  }
107599
107731
  return null;
107600
107732
  }
107733
+ function AdHocCompletionGroup(element, injector) {
107734
+ const translate = injector.get('translate');
107735
+ const group = {
107736
+ label: translate('Completion'),
107737
+ id: 'adHocCompletion',
107738
+ component: Group,
107739
+ entries: [...AdHocCompletionProps$1({
107740
+ element
107741
+ })]
107742
+ };
107743
+ if (group.entries.length) {
107744
+ return group;
107745
+ }
107746
+ return null;
107747
+ }
107601
107748
  function getGroups(element, injector) {
107602
- const groups = [GeneralGroup(element, injector), DocumentationGroup(element, injector), CompensationGroup(element, injector), ErrorGroup(element, injector), LinkGroup(element, injector), MessageGroup(element, injector), MultiInstanceGroup(element, injector), SignalGroup(element, injector), EscalationGroup(element, injector), TimerGroup(element, injector)];
107749
+ const groups = [GeneralGroup(element, injector), DocumentationGroup(element, injector), CompensationGroup(element, injector), ErrorGroup(element, injector), LinkGroup(element, injector), MessageGroup(element, injector), MultiInstanceGroup(element, injector), AdHocCompletionGroup(element, injector), SignalGroup(element, injector), EscalationGroup(element, injector), TimerGroup(element, injector)];
107603
107750
 
107604
107751
  // contract: if a group returns null, it should not be displayed at all
107605
107752
  return groups.filter(group => group !== null);