bpmn-js 18.3.1 → 18.4.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 v18.3.1
2
+ * bpmn-js - bpmn-modeler v18.4.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: 2025-02-21
11
+ * Date: 2025-03-19
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -18984,8 +18984,8 @@
18984
18984
  var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
18985
18985
  xScaleFactor: 0.9,
18986
18986
  yScaleFactor: 0.9,
18987
- containerWidth: element.width,
18988
- containerHeight: element.height,
18987
+ containerWidth: attrs.width || element.width,
18988
+ containerHeight: attrs.height || element.height,
18989
18989
  position: {
18990
18990
  mx: 0.235,
18991
18991
  my: 0.315
@@ -19009,17 +19009,23 @@
19009
19009
  return messagePath;
19010
19010
  },
19011
19011
  'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
19012
- var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
19012
+ var baseWidth = attrs.width || element.width;
19013
+ var baseHeight = attrs.height || element.height;
19014
+
19015
+ // use a lighter stroke for event suprocess icons
19016
+ var strokeWidth = attrs.width ? 1 : 2;
19017
+
19018
+ var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
19013
19019
  fill: getFillColor(element, defaultFillColor, attrs.fill),
19014
19020
  stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19015
- strokeWidth: 2
19021
+ strokeWidth: strokeWidth
19016
19022
  });
19017
19023
 
19018
19024
  var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
19019
19025
  xScaleFactor: 0.75,
19020
19026
  yScaleFactor: 0.75,
19021
- containerWidth: element.width,
19022
- containerHeight: element.height,
19027
+ containerWidth: baseWidth,
19028
+ containerHeight: baseHeight,
19023
19029
  position: {
19024
19030
  mx: 0.5,
19025
19031
  my: 0.5
@@ -19028,23 +19034,23 @@
19028
19034
 
19029
19035
  drawPath(parentGfx, pathData, {
19030
19036
  stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19031
- strokeWidth: 2
19037
+ strokeWidth: strokeWidth
19032
19038
  });
19033
19039
 
19034
19040
  for (var i = 0; i < 12; i++) {
19035
19041
  var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
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
19043
19049
  }
19044
19050
  });
19045
19051
 
19046
- var width = element.width / 2,
19047
- height = element.height / 2;
19052
+ var width = baseWidth / 2,
19053
+ height = baseHeight / 2;
19048
19054
 
19049
19055
  drawPath(parentGfx, linePathData, {
19050
19056
  strokeWidth: 1,
@@ -19059,8 +19065,8 @@
19059
19065
  var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
19060
19066
  xScaleFactor: 1,
19061
19067
  yScaleFactor: 1,
19062
- containerWidth: event.width,
19063
- containerHeight: event.height,
19068
+ containerWidth: attrs.width || event.width,
19069
+ containerHeight: attrs.height || event.height,
19064
19070
  position: {
19065
19071
  mx: 0.5,
19066
19072
  my: 0.2
@@ -19081,8 +19087,8 @@
19081
19087
  var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
19082
19088
  xScaleFactor: 1,
19083
19089
  yScaleFactor: 1,
19084
- containerWidth: event.width,
19085
- containerHeight: event.height,
19090
+ containerWidth: attrs.width || event.width,
19091
+ containerHeight: attrs.height || event.height,
19086
19092
  position: {
19087
19093
  mx: 0.5,
19088
19094
  my: 0.222
@@ -19121,8 +19127,8 @@
19121
19127
  var pathData = pathMap.getScaledPath('EVENT_ERROR', {
19122
19128
  xScaleFactor: 1.1,
19123
19129
  yScaleFactor: 1.1,
19124
- containerWidth: event.width,
19125
- containerHeight: event.height,
19130
+ containerWidth: attrs.width || event.width,
19131
+ containerHeight: attrs.height || event.height,
19126
19132
  position: {
19127
19133
  mx: 0.2,
19128
19134
  my: 0.722
@@ -19167,8 +19173,8 @@
19167
19173
  var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
19168
19174
  xScaleFactor: 1,
19169
19175
  yScaleFactor: 1,
19170
- containerWidth: event.width,
19171
- containerHeight: event.height,
19176
+ containerWidth: attrs.width || event.width,
19177
+ containerHeight: attrs.height || event.height,
19172
19178
  position: {
19173
19179
  mx: 0.22,
19174
19180
  my: 0.5
@@ -19189,8 +19195,8 @@
19189
19195
  var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
19190
19196
  xScaleFactor: 0.9,
19191
19197
  yScaleFactor: 0.9,
19192
- containerWidth: event.width,
19193
- containerHeight: event.height,
19198
+ containerWidth: attrs.width || event.width,
19199
+ containerHeight: attrs.height || event.height,
19194
19200
  position: {
19195
19201
  mx: 0.5,
19196
19202
  my: 0.2
@@ -19211,10 +19217,10 @@
19211
19217
  var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
19212
19218
  xScaleFactor: 1.1,
19213
19219
  yScaleFactor: 1.1,
19214
- containerWidth: event.width,
19215
- containerHeight: event.height,
19220
+ containerWidth: attrs.width || event.width,
19221
+ containerHeight: attrs.height || event.height,
19216
19222
  position: {
19217
- mx: 0.222,
19223
+ mx: 0.211,
19218
19224
  my: 0.36
19219
19225
  }
19220
19226
  });
@@ -19225,6 +19231,7 @@
19225
19231
 
19226
19232
  return drawPath(parentGfx, pathData, {
19227
19233
  fill,
19234
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19228
19235
  strokeWidth: 1
19229
19236
  });
19230
19237
  },
@@ -19232,8 +19239,8 @@
19232
19239
  var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
19233
19240
  xScaleFactor: 1.2,
19234
19241
  yScaleFactor: 1.2,
19235
- containerWidth: event.width,
19236
- containerHeight: event.height,
19242
+ containerWidth: attrs.width || event.width,
19243
+ containerHeight: attrs.height || event.height,
19237
19244
  position: {
19238
19245
  mx: 0.458,
19239
19246
  my: 0.194
@@ -19257,57 +19264,59 @@
19257
19264
  }
19258
19265
  };
19259
19266
 
19260
- function renderEventIcon(element, parentGfx, attrs = {}) {
19267
+ function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
19261
19268
  var semantic = getBusinessObject(element),
19262
19269
  isThrowing = isThrowEvent(semantic);
19263
19270
 
19271
+ var nodeElement = proxyElement || element;
19272
+
19264
19273
  if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
19265
19274
  if (semantic.get('parallelMultiple')) {
19266
- return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
19275
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19267
19276
  }
19268
19277
  else {
19269
- return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
19278
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19270
19279
  }
19271
19280
  }
19272
19281
 
19273
19282
  if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
19274
- return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing);
19283
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19275
19284
  }
19276
19285
 
19277
19286
  if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
19278
- return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing);
19287
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19279
19288
  }
19280
19289
 
19281
19290
  if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
19282
- return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing);
19291
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19283
19292
  }
19284
19293
 
19285
19294
  if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
19286
- return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing);
19295
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19287
19296
  }
19288
19297
 
19289
19298
  if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
19290
- return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing);
19299
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19291
19300
  }
19292
19301
 
19293
19302
  if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
19294
- return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing);
19303
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19295
19304
  }
19296
19305
 
19297
19306
  if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
19298
- return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing);
19307
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19299
19308
  }
19300
19309
 
19301
19310
  if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
19302
- return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing);
19311
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19303
19312
  }
19304
19313
 
19305
19314
  if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
19306
- return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing);
19315
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19307
19316
  }
19308
19317
 
19309
19318
  if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
19310
- return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing);
19319
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19311
19320
  }
19312
19321
 
19313
19322
  return null;
@@ -19729,14 +19738,23 @@
19729
19738
  function renderSubProcess(parentGfx, element, attrs = {}) {
19730
19739
  var activity = renderActivity(parentGfx, element, attrs);
19731
19740
 
19741
+ var expanded = isExpanded(element);
19742
+
19732
19743
  if (isEventSubProcess(element)) {
19733
19744
  attr(activity, {
19734
19745
  strokeDasharray: '0, 5.5',
19735
19746
  strokeWidth: 2.5
19736
19747
  });
19737
- }
19738
19748
 
19739
- var expanded = isExpanded(element);
19749
+ if (!expanded) {
19750
+ var flowElements = getBusinessObject(element).flowElements || [];
19751
+ var startEvents = flowElements.filter(e => is$1(e, 'bpmn:StartEvent'));
19752
+
19753
+ if (startEvents.length === 1) {
19754
+ renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
19755
+ }
19756
+ }
19757
+ }
19740
19758
 
19741
19759
  renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
19742
19760
 
@@ -19749,6 +19767,39 @@
19749
19767
  return activity;
19750
19768
  }
19751
19769
 
19770
+ function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
19771
+ var iconSize = 22;
19772
+
19773
+ // match the colors of the enclosing subprocess
19774
+ var proxyAttrs = {
19775
+ fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
19776
+ stroke: getStrokeColor$1(proxyElement, defaultStrokeColor, attrs.stroke),
19777
+ width: iconSize,
19778
+ height: iconSize
19779
+ };
19780
+
19781
+ var interrupting = getBusinessObject(startEvent).isInterrupting;
19782
+ var strokeDasharray = interrupting ? 0 : 3;
19783
+
19784
+ // better visibility for non-interrupting events
19785
+ var strokeWidth = interrupting ? 1 : 1.2;
19786
+
19787
+ // make the icon look larger by drawing a smaller circle
19788
+ var circleSize = 20;
19789
+ var shift = (iconSize - circleSize) / 2;
19790
+ var transform = 'translate(' + shift + ',' + shift + ')';
19791
+
19792
+ drawCircle(parentGfx, circleSize, circleSize, {
19793
+ fill: proxyAttrs.fill,
19794
+ stroke: proxyAttrs.stroke,
19795
+ strokeWidth,
19796
+ strokeDasharray,
19797
+ transform
19798
+ });
19799
+
19800
+ renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
19801
+ }
19802
+
19752
19803
  function renderTask(parentGfx, element, attrs = {}) {
19753
19804
  var activity = renderActivity(parentGfx, element, attrs);
19754
19805
 
@@ -40718,6 +40769,7 @@
40718
40769
 
40719
40770
  if (
40720
40771
  !is$1(newShape, 'bpmn:SubProcess') ||
40772
+ is$1(newShape,'bpmn:AdHocSubProcess') ||
40721
40773
  ! (is$1(oldShape, 'bpmn:Task') || is$1(oldShape, 'bpmn:CallActivity')) ||
40722
40774
  !isExpanded(newShape)
40723
40775
  ) {
@@ -61634,6 +61686,7 @@
61634
61686
  */
61635
61687
 
61636
61688
  var COLLAB_ERR_MSG = 'flow elements must be children of pools/participants';
61689
+ var DATA_OBJECT_ERR_MSG = 'Data object must be placed within a pool/participant.';
61637
61690
 
61638
61691
  /**
61639
61692
  * @param {EventBus} eventBus
@@ -61659,8 +61712,12 @@
61659
61712
  shape = context.shape,
61660
61713
  target = context.target;
61661
61714
 
61662
- if (is$1(target, 'bpmn:Collaboration') && is$1(shape, 'bpmn:FlowNode')) {
61663
- showError(event, translate(COLLAB_ERR_MSG));
61715
+ if (is$1(target, 'bpmn:Collaboration')) {
61716
+ if (is$1(shape, 'bpmn:FlowNode')) {
61717
+ showError(event, translate(COLLAB_ERR_MSG));
61718
+ } else if (is$1(shape, 'bpmn:DataObjectReference')) {
61719
+ showError(event, translate(DATA_OBJECT_ERR_MSG));
61720
+ }
61664
61721
  }
61665
61722
  });
61666
61723