camunda-bpmn-js 5.6.2 → 5.7.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 (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 +1577 -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 +81 -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(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(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(element);
19766
+ if (!expanded) {
19767
+ var flowElements = getBusinessObject(element).flowElements || [];
19768
+ var startEvents = flowElements.filter(e => is$1(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(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
 
@@ -104008,6 +104059,188 @@
104008
104059
  propertiesPanel: ['type', BpmnPropertiesPanelRenderer]
104009
104060
  };
104010
104061
 
104062
+ /**
104063
+ * Create a new element and (optionally) set its parent.
104064
+ *
104065
+ * @param {string} type
104066
+ * @param {Object} properties
104067
+ * @param {import('bpmn-js/lib/model/Types').ModdleElement} parent
104068
+ * @param {import('bpmn-js/lib/features/modeling/BpmnFactory').default} bpmnFactory
104069
+ *
104070
+ * @returns {import('bpmn-js/lib/model/Types').ModdleElement}
104071
+ */
104072
+ function createElement(type, properties, parent, bpmnFactory) {
104073
+ const element = bpmnFactory.create(type, properties);
104074
+ if (parent) {
104075
+ element.$parent = parent;
104076
+ }
104077
+ return element;
104078
+ }
104079
+
104080
+ /**
104081
+ * generate a semantic id with given prefix
104082
+ */
104083
+ function nextId(prefix) {
104084
+ const ids = new Ids$1([32, 32, 1]);
104085
+ return ids.nextPrefixed(prefix);
104086
+ }
104087
+ function getRoot(businessObject) {
104088
+ let parent = businessObject;
104089
+ while (parent.$parent) {
104090
+ parent = parent.$parent;
104091
+ }
104092
+ return parent;
104093
+ }
104094
+ function filterElementsByType(objectList, type) {
104095
+ const list = objectList || [];
104096
+ return list.filter(element => is$1(element, type));
104097
+ }
104098
+ function findRootElementsByType(businessObject, referencedType) {
104099
+ const root = getRoot(businessObject);
104100
+ return filterElementsByType(root.get('rootElements'), referencedType);
104101
+ }
104102
+ function findRootElementById(businessObject, type, id) {
104103
+ const elements = findRootElementsByType(businessObject, type);
104104
+ return elements.find(element => element.id === id);
104105
+ }
104106
+
104107
+ /**
104108
+ * createOrUpdateFormalExpression - upserts a specific formal expression
104109
+ *
104110
+ * If the value is falsy, the formal expression is removed.
104111
+ *
104112
+ * @param {djs.model.Base} element
104113
+ * @param {ModdleElement} moddleElement
104114
+ * @param {string} propertyName
104115
+ * @param {string} newValue
104116
+ * @param {BpmnFactory} bpmnFactory
104117
+ * @param {CommandStack} commandStack
104118
+ */
104119
+ function createOrUpdateFormalExpression(element, moddleElement, propertyName, newValue, bpmnFactory, commandStack) {
104120
+ return commandStack.execute('element.updateModdleProperties', createOrUpdateFormalExpressionCommand(element, moddleElement, propertyName, newValue, bpmnFactory));
104121
+ }
104122
+
104123
+ /**
104124
+ * createOrUpdateFormalExpressionCommand - creates a command to upsert a specific formal expression
104125
+ *
104126
+ * If the value is falsy, the formal expression is removed.
104127
+ *
104128
+ * @param {djs.model.Base} element
104129
+ * @param {ModdleElement} moddleElement
104130
+ * @param {string} propertyName
104131
+ * @param {string} newValue
104132
+ * @param {BpmnFactory} bpmnFactory
104133
+ */
104134
+ function createOrUpdateFormalExpressionCommand(element, moddleElement, propertyName, newValue, bpmnFactory) {
104135
+ const expressionProps = {};
104136
+ if (!newValue) {
104137
+ // remove formal expression
104138
+ expressionProps[propertyName] = undefined;
104139
+ return {
104140
+ element,
104141
+ moddleElement,
104142
+ properties: expressionProps
104143
+ };
104144
+ }
104145
+ const existingExpression = moddleElement.get(propertyName);
104146
+ if (existingExpression) {
104147
+ // edit existing formal expression
104148
+ return {
104149
+ element,
104150
+ moddleElement: existingExpression,
104151
+ properties: {
104152
+ body: newValue
104153
+ }
104154
+ };
104155
+ }
104156
+
104157
+ // add formal expression
104158
+ expressionProps[propertyName] = createElement('bpmn:FormalExpression', {
104159
+ body: newValue
104160
+ }, moddleElement, bpmnFactory);
104161
+ return {
104162
+ element,
104163
+ moddleElement,
104164
+ properties: expressionProps
104165
+ };
104166
+ }
104167
+
104168
+ /**
104169
+ * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry
104170
+ */
104171
+
104172
+ /**
104173
+ * @returns {Array<Entry>} entries
104174
+ */
104175
+ function AdHocCompletionProps$1(props) {
104176
+ const {
104177
+ element
104178
+ } = props;
104179
+ if (!is$1(element, 'bpmn:AdHocSubProcess')) {
104180
+ return [];
104181
+ }
104182
+ return [{
104183
+ id: 'completionCondition',
104184
+ component: CompletionCondition$3,
104185
+ isEdited: isEdited
104186
+ }, {
104187
+ id: 'cancelRemainingInstances',
104188
+ component: CancelRemainingInstances,
104189
+ isEdited: node => node && !node.checked // the default value is true
104190
+ }];
104191
+ }
104192
+ function CompletionCondition$3(props) {
104193
+ const {
104194
+ element
104195
+ } = props;
104196
+ const bpmnFactory = useService('bpmnFactory');
104197
+ const debounce = useService('debounceInput');
104198
+ const commandStack = useService('commandStack');
104199
+ const translate = useService('translate');
104200
+ const getValue = () => {
104201
+ const expression = getBusinessObject(element).get('completionCondition');
104202
+ return expression && expression.get('body');
104203
+ };
104204
+ const setValue = value => {
104205
+ return createOrUpdateFormalExpression(element, getBusinessObject(element), 'completionCondition', value, bpmnFactory, commandStack);
104206
+ };
104207
+ return TextfieldEntry({
104208
+ element,
104209
+ id: 'completionCondition',
104210
+ label: translate('Completion condition'),
104211
+ getValue,
104212
+ setValue,
104213
+ debounce
104214
+ });
104215
+ }
104216
+ function CancelRemainingInstances(props) {
104217
+ const {
104218
+ element
104219
+ } = props;
104220
+ const commandStack = useService('commandStack');
104221
+ const translate = useService('translate');
104222
+ const businessObject = getBusinessObject(element);
104223
+ const getValue = () => {
104224
+ return businessObject.get('cancelRemainingInstances');
104225
+ };
104226
+ const setValue = value => {
104227
+ commandStack.execute('element.updateModdleProperties', {
104228
+ element,
104229
+ moddleElement: businessObject,
104230
+ properties: {
104231
+ cancelRemainingInstances: value
104232
+ }
104233
+ });
104234
+ };
104235
+ return CheckboxEntry({
104236
+ element,
104237
+ id: 'cancelRemainingInstances',
104238
+ label: translate('Cancel remaining instances'),
104239
+ getValue,
104240
+ setValue
104241
+ });
104242
+ }
104243
+
104011
104244
  function ReferenceSelectEntry(props) {
104012
104245
  const {
104013
104246
  autoFocusEntry,
@@ -104436,51 +104669,6 @@
104436
104669
  };
104437
104670
  }
104438
104671
 
104439
- /**
104440
- * Create a new element and (optionally) set its parent.
104441
- *
104442
- * @param {string} type
104443
- * @param {Object} properties
104444
- * @param {import('bpmn-js/lib/model/Types').ModdleElement} parent
104445
- * @param {import('bpmn-js/lib/features/modeling/BpmnFactory').default} bpmnFactory
104446
- *
104447
- * @returns {import('bpmn-js/lib/model/Types').ModdleElement}
104448
- */
104449
- function createElement(type, properties, parent, bpmnFactory) {
104450
- const element = bpmnFactory.create(type, properties);
104451
- if (parent) {
104452
- element.$parent = parent;
104453
- }
104454
- return element;
104455
- }
104456
-
104457
- /**
104458
- * generate a semantic id with given prefix
104459
- */
104460
- function nextId(prefix) {
104461
- const ids = new Ids$1([32, 32, 1]);
104462
- return ids.nextPrefixed(prefix);
104463
- }
104464
- function getRoot(businessObject) {
104465
- let parent = businessObject;
104466
- while (parent.$parent) {
104467
- parent = parent.$parent;
104468
- }
104469
- return parent;
104470
- }
104471
- function filterElementsByType(objectList, type) {
104472
- const list = objectList || [];
104473
- return list.filter(element => is$1(element, type));
104474
- }
104475
- function findRootElementsByType(businessObject, referencedType) {
104476
- const root = getRoot(businessObject);
104477
- return filterElementsByType(root.get('rootElements'), referencedType);
104478
- }
104479
- function findRootElementById(businessObject, type, id) {
104480
- const elements = findRootElementsByType(businessObject, type);
104481
- return elements.find(element => element.id === id);
104482
- }
104483
-
104484
104672
  const EMPTY_OPTION$4 = '';
104485
104673
  const CREATE_NEW_OPTION$4 = 'create-new';
104486
104674
 
@@ -105222,7 +105410,7 @@
105222
105410
  isEdited: isEdited
105223
105411
  }, {
105224
105412
  id: 'completionCondition',
105225
- component: CompletionCondition$1,
105413
+ component: CompletionCondition$2,
105226
105414
  isEdited: isEdited
105227
105415
  }];
105228
105416
  return entries;
@@ -105239,7 +105427,7 @@
105239
105427
  return getLoopCardinalityValue(element);
105240
105428
  };
105241
105429
  const setValue = value => {
105242
- return commandStack.execute('element.updateModdleProperties', updateFormalExpression(element, 'loopCardinality', value, bpmnFactory));
105430
+ return createOrUpdateFormalExpression(element, getLoopCharacteristics$2(element), 'loopCardinality', value, bpmnFactory, commandStack);
105243
105431
  };
105244
105432
  return TextfieldEntry({
105245
105433
  element,
@@ -105250,7 +105438,7 @@
105250
105438
  debounce
105251
105439
  });
105252
105440
  }
105253
- function CompletionCondition$1(props) {
105441
+ function CompletionCondition$2(props) {
105254
105442
  const {
105255
105443
  element
105256
105444
  } = props;
@@ -105262,7 +105450,7 @@
105262
105450
  return getCompletionConditionValue(element);
105263
105451
  };
105264
105452
  const setValue = value => {
105265
- return commandStack.execute('element.updateModdleProperties', updateFormalExpression(element, 'completionCondition', value, bpmnFactory));
105453
+ return createOrUpdateFormalExpression(element, getLoopCharacteristics$2(element), 'completionCondition', value, bpmnFactory, commandStack);
105266
105454
  };
105267
105455
  return TextfieldEntry({
105268
105456
  element,
@@ -105323,62 +105511,6 @@
105323
105511
  return bo.loopCharacteristics;
105324
105512
  }
105325
105513
 
105326
- /**
105327
- * createFormalExpression - creates a 'bpmn:FormalExpression' element.
105328
- *
105329
- * @param {ModdleElement} parent
105330
- * @param {string} body
105331
- * @param {BpmnFactory} bpmnFactory
105332
- *
105333
- * @result {ModdleElement<bpmn:FormalExpression>} a formal expression
105334
- */
105335
- function createFormalExpression$1(parent, body, bpmnFactory) {
105336
- return createElement('bpmn:FormalExpression', {
105337
- body: body
105338
- }, parent, bpmnFactory);
105339
- }
105340
-
105341
- /**
105342
- * updateFormalExpression - updates a specific formal expression of the loop characteristics.
105343
- *
105344
- * @param {djs.model.Base} element
105345
- * @param {string} propertyName
105346
- * @param {string} newValue
105347
- * @param {BpmnFactory} bpmnFactory
105348
- */
105349
- function updateFormalExpression(element, propertyName, newValue, bpmnFactory) {
105350
- const loopCharacteristics = getLoopCharacteristics$2(element);
105351
- const expressionProps = {};
105352
- if (!newValue) {
105353
- // remove formal expression
105354
- expressionProps[propertyName] = undefined;
105355
- return {
105356
- element,
105357
- moddleElement: loopCharacteristics,
105358
- properties: expressionProps
105359
- };
105360
- }
105361
- const existingExpression = loopCharacteristics.get(propertyName);
105362
- if (!existingExpression) {
105363
- // add formal expression
105364
- expressionProps[propertyName] = createFormalExpression$1(loopCharacteristics, newValue, bpmnFactory);
105365
- return {
105366
- element,
105367
- moddleElement: loopCharacteristics,
105368
- properties: expressionProps
105369
- };
105370
- }
105371
-
105372
- // edit existing formal expression
105373
- return {
105374
- element,
105375
- moddleElement: existingExpression,
105376
- properties: {
105377
- body: newValue
105378
- }
105379
- };
105380
- }
105381
-
105382
105514
  // loopCardinality
105383
105515
 
105384
105516
  /**
@@ -106202,8 +106334,23 @@
106202
106334
  }
106203
106335
  return null;
106204
106336
  }
106337
+ function AdHocCompletionGroup(element, injector) {
106338
+ const translate = injector.get('translate');
106339
+ const group = {
106340
+ label: translate('Completion'),
106341
+ id: 'adHocCompletion',
106342
+ component: Group,
106343
+ entries: [...AdHocCompletionProps$1({
106344
+ element
106345
+ })]
106346
+ };
106347
+ if (group.entries.length) {
106348
+ return group;
106349
+ }
106350
+ return null;
106351
+ }
106205
106352
  function getGroups(element, injector) {
106206
- 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)];
106353
+ 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)];
106207
106354
 
106208
106355
  // contract: if a group returns null, it should not be displayed at all
106209
106356
  return groups.filter(group => group !== null);