bpmn-js 15.2.2 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-viewer v15.2.2
2
+ * bpmn-js - bpmn-viewer v16.0.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: 2023-11-27
11
+ * Date: 2023-12-11
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -725,6 +725,26 @@
725
725
  return true;
726
726
  }
727
727
 
728
+ /**
729
+ * @param {Element} element
730
+ *
731
+ * @return {boolean}
732
+ */
733
+ function isHorizontal(element) {
734
+
735
+ if (!is$1(element, 'bpmn:Participant') && !is$1(element, 'bpmn:Lane')) {
736
+ return undefined;
737
+ }
738
+
739
+ var isHorizontal = getDi(element).isHorizontal;
740
+
741
+ if (isHorizontal === undefined) {
742
+ return true;
743
+ }
744
+
745
+ return isHorizontal;
746
+ }
747
+
728
748
  /**
729
749
  * @param {Element} element
730
750
  *
@@ -3784,10 +3804,12 @@
3784
3804
  }
3785
3805
 
3786
3806
  function renderLaneLabel(parentGfx, text, element, attrs = {}) {
3807
+ var isHorizontalLane = isHorizontal(element);
3808
+
3787
3809
  var textBox = renderLabel(parentGfx, text, {
3788
3810
  box: {
3789
3811
  height: 30,
3790
- width: getHeight(element, attrs),
3812
+ width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
3791
3813
  },
3792
3814
  align: 'center-middle',
3793
3815
  style: {
@@ -3795,9 +3817,10 @@
3795
3817
  }
3796
3818
  });
3797
3819
 
3798
- var top = -1 * getHeight(element, attrs);
3799
-
3800
- transform(textBox, 0, -top, 270);
3820
+ if (isHorizontalLane) {
3821
+ var top = -1 * getHeight(element, attrs);
3822
+ transform(textBox, 0, -top, 270);
3823
+ }
3801
3824
  }
3802
3825
 
3803
3826
  function renderActivity(parentGfx, element, attrs = {}) {
@@ -4515,12 +4538,13 @@
4515
4538
  var participant = renderLane(parentGfx, element, attrs);
4516
4539
 
4517
4540
  var expandedParticipant = isExpanded(element);
4541
+ var horizontalParticipant = isHorizontal(element);
4518
4542
 
4519
4543
  var semantic = getBusinessObject(element),
4520
4544
  name = semantic.get('name');
4521
4545
 
4522
4546
  if (expandedParticipant) {
4523
- drawLine(parentGfx, [
4547
+ var waypoints = horizontalParticipant ? [
4524
4548
  {
4525
4549
  x: 30,
4526
4550
  y: 0
@@ -4529,20 +4553,43 @@
4529
4553
  x: 30,
4530
4554
  y: getHeight(element, attrs)
4531
4555
  }
4532
- ], {
4556
+ ] : [
4557
+ {
4558
+ x: 0,
4559
+ y: 30
4560
+ },
4561
+ {
4562
+ x: getWidth(element, attrs),
4563
+ y: 30
4564
+ }
4565
+ ];
4566
+
4567
+ drawLine(parentGfx, waypoints, {
4533
4568
  stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4534
4569
  strokeWidth: PARTICIPANT_STROKE_WIDTH
4535
4570
  });
4536
4571
 
4537
4572
  renderLaneLabel(parentGfx, name, element, attrs);
4538
4573
  } else {
4539
- renderLabel(parentGfx, name, {
4540
- box: getBounds(element, attrs),
4574
+ var bounds = getBounds(element, attrs);
4575
+
4576
+ if (!horizontalParticipant) {
4577
+ bounds.height = getWidth(element, attrs);
4578
+ bounds.width = getHeight(element, attrs);
4579
+ }
4580
+
4581
+ var textBox = renderLabel(parentGfx, name, {
4582
+ box: bounds,
4541
4583
  align: 'center-middle',
4542
4584
  style: {
4543
4585
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4544
4586
  }
4545
4587
  });
4588
+
4589
+ if (!horizontalParticipant) {
4590
+ var top = -1 * getHeight(element, attrs);
4591
+ transform(textBox, 0, -top, 270);
4592
+ }
4546
4593
  }
4547
4594
 
4548
4595
  if (semantic.get('participantMultiplicity')) {
@@ -9816,7 +9863,7 @@
9816
9863
  }
9817
9864
 
9818
9865
  /**
9819
- * @typedef {import('./index').InjectAnnotated } InjectAnnotated
9866
+ * @typedef {import('./index.js').InjectAnnotated } InjectAnnotated
9820
9867
  */
9821
9868
 
9822
9869
  /**
@@ -9886,9 +9933,9 @@
9886
9933
  }
9887
9934
 
9888
9935
  /**
9889
- * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
9890
- * @typedef { import('./index').ModuleDefinition } ModuleDefinition
9891
- * @typedef { import('./index').InjectorContext } InjectorContext
9936
+ * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9937
+ * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9938
+ * @typedef { import('./index.js').InjectorContext } InjectorContext
9892
9939
  */
9893
9940
 
9894
9941
  /**
@@ -9991,11 +10038,20 @@
9991
10038
  };
9992
10039
  }
9993
10040
 
9994
- function instantiate(Type) {
10041
+ /**
10042
+ * Instantiate the given type, injecting dependencies.
10043
+ *
10044
+ * @template T
10045
+ *
10046
+ * @param { Function | [...string[], Function ]} type
10047
+ *
10048
+ * @return T
10049
+ */
10050
+ function instantiate(type) {
9995
10051
  const {
9996
10052
  fn,
9997
10053
  dependencies
9998
- } = fnDef(Type);
10054
+ } = fnDef(type);
9999
10055
 
10000
10056
  // instantiate var args constructor
10001
10057
  const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
@@ -10003,6 +10059,17 @@
10003
10059
  return new Constructor();
10004
10060
  }
10005
10061
 
10062
+ /**
10063
+ * Invoke the given function, injecting dependencies. Return the result.
10064
+ *
10065
+ * @template T
10066
+ *
10067
+ * @param { Function | [...string[], Function ]} func
10068
+ * @param { Object } [context]
10069
+ * @param { Object } [locals]
10070
+ *
10071
+ * @return {T} invocation result
10072
+ */
10006
10073
  function invoke(func, context, locals) {
10007
10074
  const {
10008
10075
  fn,