bpmn-js 17.0.2 → 17.2.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.
@@ -5,7 +5,7 @@
5
5
  * bundles that include actual features.
6
6
  *
7
7
  */
8
- export default class BaseViewer extends Diagram {
8
+ export default class BaseViewer extends Diagram<null> {
9
9
  /**
10
10
  * @param options The options to configure the viewer.
11
11
  */
@@ -11,6 +11,7 @@ import {
11
11
 
12
12
  import {
13
13
  isExpanded,
14
+ isHorizontal,
14
15
  isEventSubProcess
15
16
  } from '../../util/DiUtil';
16
17
 
@@ -312,7 +313,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
312
313
 
313
314
  if (childLanes.length < 2) {
314
315
 
315
- if (element.height >= 120) {
316
+ if (isHorizontal(element) ? element.height >= 120 : element.width >= 120) {
316
317
  assign(actions, {
317
318
  'lane-divide-two': {
318
319
  group: 'lane-divide',
@@ -325,7 +326,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
325
326
  });
326
327
  }
327
328
 
328
- if (element.height >= 180) {
329
+ if (isHorizontal(element) ? element.height >= 180 : element.width >= 180) {
329
330
  assign(actions, {
330
331
  'lane-divide-three': {
331
332
  group: 'lane-divide',
@@ -3,6 +3,10 @@ import {
3
3
  LANE_INDENTATION
4
4
  } from '../util/LaneUtil';
5
5
 
6
+ import {
7
+ isHorizontal
8
+ } from '../../../util/DiUtil';
9
+
6
10
  /**
7
11
  * @typedef {import('diagram-js/lib/command/CommandHandler').default} CommandHandler
8
12
  *
@@ -45,36 +49,41 @@ SplitLaneHandler.prototype.preExecute = function(context) {
45
49
  throw new Error(translate('more than {count} child lanes', { count: newLanesCount }));
46
50
  }
47
51
 
48
- var newLanesHeight = Math.round(shape.height / newLanesCount);
52
+ var isHorizontalLane = isHorizontal(shape);
49
53
 
50
- // Iterate from top to bottom in child lane order,
54
+ var laneBaseSize = isHorizontalLane ? shape.height : shape.width;
55
+ var newLanesSize = Math.round(laneBaseSize / newLanesCount);
56
+
57
+ // Iterate from first to last in child lane order,
51
58
  // resizing existing lanes and creating new ones
52
59
  // so that they split the parent proportionally.
53
60
  //
54
- // Due to rounding related errors, the bottom lane
61
+ // Due to rounding related errors, the last lane
55
62
  // needs to take up all the remaining space.
56
- var laneY,
57
- laneHeight,
63
+ var laneSize,
58
64
  laneBounds,
59
65
  newLaneAttrs,
60
66
  idx;
61
67
 
62
68
  for (idx = 0; idx < newLanesCount; idx++) {
63
69
 
64
- laneY = shape.y + idx * newLanesHeight;
65
-
66
- // if bottom lane
70
+ // if last lane
67
71
  if (idx === newLanesCount - 1) {
68
- laneHeight = shape.height - (newLanesHeight * idx);
72
+ laneSize = laneBaseSize - (newLanesSize * idx);
69
73
  } else {
70
- laneHeight = newLanesHeight;
74
+ laneSize = newLanesSize;
71
75
  }
72
76
 
73
- laneBounds = {
77
+ laneBounds = isHorizontalLane ? {
74
78
  x: shape.x + LANE_INDENTATION,
75
- y: laneY,
79
+ y: shape.y + idx * newLanesSize,
76
80
  width: shape.width - LANE_INDENTATION,
77
- height: laneHeight
81
+ height: laneSize
82
+ } : {
83
+ x: shape.x + idx * newLanesSize,
84
+ y: shape.y + LANE_INDENTATION,
85
+ width: laneSize,
86
+ height: shape.height - LANE_INDENTATION
78
87
  };
79
88
 
80
89
  if (idx < existingLanesCount) {
@@ -85,7 +94,8 @@ SplitLaneHandler.prototype.preExecute = function(context) {
85
94
 
86
95
  // create a new lane at position
87
96
  newLaneAttrs = {
88
- type: 'bpmn:Lane'
97
+ type: 'bpmn:Lane',
98
+ isHorizontal: isHorizontalLane
89
99
  };
90
100
 
91
101
  modeling.createShape(newLaneAttrs, laneBounds, shape);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmn-js",
3
- "version": "17.0.2",
3
+ "version": "17.2.0",
4
4
  "description": "A bpmn 2.0 toolkit and web modeler",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -71,7 +71,7 @@
71
71
  "@rollup/plugin-terser": "^0.4.0",
72
72
  "babel-loader": "^9.1.0",
73
73
  "babel-plugin-istanbul": "^6.1.1",
74
- "bio-dts": "^0.8.1",
74
+ "bio-dts": "^0.11.0",
75
75
  "bpmn-font": "^0.12.1",
76
76
  "camunda-bpmn-moddle": "^4.0.1",
77
77
  "chai": "4.1.2",
@@ -111,8 +111,8 @@
111
111
  },
112
112
  "dependencies": {
113
113
  "bpmn-moddle": "^8.1.0",
114
- "diagram-js": "^14.0.0",
115
- "diagram-js-direct-editing": "^2.1.1",
114
+ "diagram-js": "^14.3.0",
115
+ "diagram-js-direct-editing": "^2.1.2",
116
116
  "ids": "^1.0.5",
117
117
  "inherits-browser": "^0.1.0",
118
118
  "min-dash": "^4.1.1",