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-navigated-viewer v18.3.1
2
+ * bpmn-js - bpmn-navigated-viewer 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() :
@@ -3182,8 +3182,8 @@
3182
3182
  var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
3183
3183
  xScaleFactor: 0.9,
3184
3184
  yScaleFactor: 0.9,
3185
- containerWidth: element.width,
3186
- containerHeight: element.height,
3185
+ containerWidth: attrs.width || element.width,
3186
+ containerHeight: attrs.height || element.height,
3187
3187
  position: {
3188
3188
  mx: 0.235,
3189
3189
  my: 0.315
@@ -3207,17 +3207,23 @@
3207
3207
  return messagePath;
3208
3208
  },
3209
3209
  'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
3210
- var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
3210
+ var baseWidth = attrs.width || element.width;
3211
+ var baseHeight = attrs.height || element.height;
3212
+
3213
+ // use a lighter stroke for event suprocess icons
3214
+ var strokeWidth = attrs.width ? 1 : 2;
3215
+
3216
+ var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
3211
3217
  fill: getFillColor(element, defaultFillColor, attrs.fill),
3212
3218
  stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3213
- strokeWidth: 2
3219
+ strokeWidth: strokeWidth
3214
3220
  });
3215
3221
 
3216
3222
  var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
3217
3223
  xScaleFactor: 0.75,
3218
3224
  yScaleFactor: 0.75,
3219
- containerWidth: element.width,
3220
- containerHeight: element.height,
3225
+ containerWidth: baseWidth,
3226
+ containerHeight: baseHeight,
3221
3227
  position: {
3222
3228
  mx: 0.5,
3223
3229
  my: 0.5
@@ -3226,23 +3232,23 @@
3226
3232
 
3227
3233
  drawPath(parentGfx, pathData, {
3228
3234
  stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3229
- strokeWidth: 2
3235
+ strokeWidth: strokeWidth
3230
3236
  });
3231
3237
 
3232
3238
  for (var i = 0; i < 12; i++) {
3233
3239
  var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
3234
3240
  xScaleFactor: 0.75,
3235
3241
  yScaleFactor: 0.75,
3236
- containerWidth: element.width,
3237
- containerHeight: element.height,
3242
+ containerWidth: baseWidth,
3243
+ containerHeight: baseHeight,
3238
3244
  position: {
3239
3245
  mx: 0.5,
3240
3246
  my: 0.5
3241
3247
  }
3242
3248
  });
3243
3249
 
3244
- var width = element.width / 2,
3245
- height = element.height / 2;
3250
+ var width = baseWidth / 2,
3251
+ height = baseHeight / 2;
3246
3252
 
3247
3253
  drawPath(parentGfx, linePathData, {
3248
3254
  strokeWidth: 1,
@@ -3257,8 +3263,8 @@
3257
3263
  var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
3258
3264
  xScaleFactor: 1,
3259
3265
  yScaleFactor: 1,
3260
- containerWidth: event.width,
3261
- containerHeight: event.height,
3266
+ containerWidth: attrs.width || event.width,
3267
+ containerHeight: attrs.height || event.height,
3262
3268
  position: {
3263
3269
  mx: 0.5,
3264
3270
  my: 0.2
@@ -3279,8 +3285,8 @@
3279
3285
  var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
3280
3286
  xScaleFactor: 1,
3281
3287
  yScaleFactor: 1,
3282
- containerWidth: event.width,
3283
- containerHeight: event.height,
3288
+ containerWidth: attrs.width || event.width,
3289
+ containerHeight: attrs.height || event.height,
3284
3290
  position: {
3285
3291
  mx: 0.5,
3286
3292
  my: 0.222
@@ -3319,8 +3325,8 @@
3319
3325
  var pathData = pathMap.getScaledPath('EVENT_ERROR', {
3320
3326
  xScaleFactor: 1.1,
3321
3327
  yScaleFactor: 1.1,
3322
- containerWidth: event.width,
3323
- containerHeight: event.height,
3328
+ containerWidth: attrs.width || event.width,
3329
+ containerHeight: attrs.height || event.height,
3324
3330
  position: {
3325
3331
  mx: 0.2,
3326
3332
  my: 0.722
@@ -3365,8 +3371,8 @@
3365
3371
  var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
3366
3372
  xScaleFactor: 1,
3367
3373
  yScaleFactor: 1,
3368
- containerWidth: event.width,
3369
- containerHeight: event.height,
3374
+ containerWidth: attrs.width || event.width,
3375
+ containerHeight: attrs.height || event.height,
3370
3376
  position: {
3371
3377
  mx: 0.22,
3372
3378
  my: 0.5
@@ -3387,8 +3393,8 @@
3387
3393
  var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
3388
3394
  xScaleFactor: 0.9,
3389
3395
  yScaleFactor: 0.9,
3390
- containerWidth: event.width,
3391
- containerHeight: event.height,
3396
+ containerWidth: attrs.width || event.width,
3397
+ containerHeight: attrs.height || event.height,
3392
3398
  position: {
3393
3399
  mx: 0.5,
3394
3400
  my: 0.2
@@ -3409,10 +3415,10 @@
3409
3415
  var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
3410
3416
  xScaleFactor: 1.1,
3411
3417
  yScaleFactor: 1.1,
3412
- containerWidth: event.width,
3413
- containerHeight: event.height,
3418
+ containerWidth: attrs.width || event.width,
3419
+ containerHeight: attrs.height || event.height,
3414
3420
  position: {
3415
- mx: 0.222,
3421
+ mx: 0.211,
3416
3422
  my: 0.36
3417
3423
  }
3418
3424
  });
@@ -3423,6 +3429,7 @@
3423
3429
 
3424
3430
  return drawPath(parentGfx, pathData, {
3425
3431
  fill,
3432
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3426
3433
  strokeWidth: 1
3427
3434
  });
3428
3435
  },
@@ -3430,8 +3437,8 @@
3430
3437
  var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
3431
3438
  xScaleFactor: 1.2,
3432
3439
  yScaleFactor: 1.2,
3433
- containerWidth: event.width,
3434
- containerHeight: event.height,
3440
+ containerWidth: attrs.width || event.width,
3441
+ containerHeight: attrs.height || event.height,
3435
3442
  position: {
3436
3443
  mx: 0.458,
3437
3444
  my: 0.194
@@ -3455,57 +3462,59 @@
3455
3462
  }
3456
3463
  };
3457
3464
 
3458
- function renderEventIcon(element, parentGfx, attrs = {}) {
3465
+ function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
3459
3466
  var semantic = getBusinessObject(element),
3460
3467
  isThrowing = isThrowEvent(semantic);
3461
3468
 
3469
+ var nodeElement = proxyElement || element;
3470
+
3462
3471
  if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
3463
3472
  if (semantic.get('parallelMultiple')) {
3464
- return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3473
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3465
3474
  }
3466
3475
  else {
3467
- return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3476
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3468
3477
  }
3469
3478
  }
3470
3479
 
3471
3480
  if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
3472
- return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing);
3481
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3473
3482
  }
3474
3483
 
3475
3484
  if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
3476
- return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing);
3485
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3477
3486
  }
3478
3487
 
3479
3488
  if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
3480
- return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3489
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3481
3490
  }
3482
3491
 
3483
3492
  if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
3484
- return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3493
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3485
3494
  }
3486
3495
 
3487
3496
  if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
3488
- return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing);
3497
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3489
3498
  }
3490
3499
 
3491
3500
  if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
3492
- return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing);
3501
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3493
3502
  }
3494
3503
 
3495
3504
  if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
3496
- return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing);
3505
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3497
3506
  }
3498
3507
 
3499
3508
  if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
3500
- return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing);
3509
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3501
3510
  }
3502
3511
 
3503
3512
  if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
3504
- return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3513
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3505
3514
  }
3506
3515
 
3507
3516
  if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
3508
- return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3517
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3509
3518
  }
3510
3519
 
3511
3520
  return null;
@@ -3927,14 +3936,23 @@
3927
3936
  function renderSubProcess(parentGfx, element, attrs = {}) {
3928
3937
  var activity = renderActivity(parentGfx, element, attrs);
3929
3938
 
3939
+ var expanded = isExpanded(element);
3940
+
3930
3941
  if (isEventSubProcess(element)) {
3931
3942
  attr$1(activity, {
3932
3943
  strokeDasharray: '0, 5.5',
3933
3944
  strokeWidth: 2.5
3934
3945
  });
3935
- }
3936
3946
 
3937
- var expanded = isExpanded(element);
3947
+ if (!expanded) {
3948
+ var flowElements = getBusinessObject(element).flowElements || [];
3949
+ var startEvents = flowElements.filter(e => is$1(e, 'bpmn:StartEvent'));
3950
+
3951
+ if (startEvents.length === 1) {
3952
+ renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
3953
+ }
3954
+ }
3955
+ }
3938
3956
 
3939
3957
  renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
3940
3958
 
@@ -3947,6 +3965,39 @@
3947
3965
  return activity;
3948
3966
  }
3949
3967
 
3968
+ function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
3969
+ var iconSize = 22;
3970
+
3971
+ // match the colors of the enclosing subprocess
3972
+ var proxyAttrs = {
3973
+ fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
3974
+ stroke: getStrokeColor(proxyElement, defaultStrokeColor, attrs.stroke),
3975
+ width: iconSize,
3976
+ height: iconSize
3977
+ };
3978
+
3979
+ var interrupting = getBusinessObject(startEvent).isInterrupting;
3980
+ var strokeDasharray = interrupting ? 0 : 3;
3981
+
3982
+ // better visibility for non-interrupting events
3983
+ var strokeWidth = interrupting ? 1 : 1.2;
3984
+
3985
+ // make the icon look larger by drawing a smaller circle
3986
+ var circleSize = 20;
3987
+ var shift = (iconSize - circleSize) / 2;
3988
+ var transform = 'translate(' + shift + ',' + shift + ')';
3989
+
3990
+ drawCircle(parentGfx, circleSize, circleSize, {
3991
+ fill: proxyAttrs.fill,
3992
+ stroke: proxyAttrs.stroke,
3993
+ strokeWidth,
3994
+ strokeDasharray,
3995
+ transform
3996
+ });
3997
+
3998
+ renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
3999
+ }
4000
+
3950
4001
  function renderTask(parentGfx, element, attrs = {}) {
3951
4002
  var activity = renderActivity(parentGfx, element, attrs);
3952
4003