bpmn-js 16.4.0 → 16.5.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.
@@ -720,7 +720,7 @@ export default function BpmnRenderer(
720
720
  });
721
721
 
722
722
  return drawPath(parentGfx, pathData, {
723
- fill: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
723
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
724
724
  stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
725
725
  strokeWidth: 1
726
726
  });
@@ -420,8 +420,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
420
420
  'append.gateway': appendAction(
421
421
  'bpmn:ExclusiveGateway',
422
422
  'bpmn-icon-gateway-none',
423
- translate('Append gateway'),
424
- { isMarkerVisible: true }
423
+ translate('Append gateway')
425
424
  ),
426
425
  'append.append-task': appendAction(
427
426
  'bpmn:Task',
@@ -207,6 +207,10 @@ ElementFactory.prototype.createElement = function(elementType, attrs) {
207
207
  attrs = applyAttribute(di, attrs, 'isExpanded');
208
208
  }
209
209
 
210
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ])) {
211
+ attrs = applyAttribute(di, attrs, 'isHorizontal');
212
+ }
213
+
210
214
  if (is(businessObject, 'bpmn:SubProcess')) {
211
215
  attrs.collapsed = !isExpanded(businessObject, di);
212
216
  }
@@ -12,6 +12,10 @@ import {
12
12
  LANE_INDENTATION
13
13
  } from '../util/LaneUtil';
14
14
 
15
+ import {
16
+ isHorizontal
17
+ } from '../../../util/DiUtil';
18
+
15
19
  /**
16
20
  * @typedef {import('diagram-js/lib/command/CommandHandler').default} CommandHandler
17
21
  *
@@ -54,14 +58,47 @@ AddLaneHandler.prototype.preExecute = function(context) {
54
58
 
55
59
  var existingChildLanes = getChildLanes(laneParent);
56
60
 
61
+ var isHorizontalLane = isHorizontal(shape);
62
+
63
+ // never mix up horizontal/vertical lanes
64
+ if (isHorizontalLane) {
65
+ if (location === 'left') {
66
+ location = 'top';
67
+ } else
68
+ if (location === 'right') {
69
+ location = 'bottom';
70
+ }
71
+ } else {
72
+ if (location === 'top') {
73
+ location = 'left';
74
+ } else
75
+ if (location === 'bottom') {
76
+ location = 'right';
77
+ }
78
+ }
79
+
57
80
  // (0) add a lane if we currently got none and are adding to root
58
81
  if (!existingChildLanes.length) {
59
- modeling.createShape({ type: 'bpmn:Lane' }, {
82
+ var siblingPosition = isHorizontalLane ? {
60
83
  x: shape.x + LANE_INDENTATION,
61
84
  y: shape.y,
62
85
  width: shape.width - LANE_INDENTATION,
63
86
  height: shape.height
64
- }, laneParent);
87
+ } : {
88
+ x: shape.x,
89
+ y: shape.y + LANE_INDENTATION,
90
+ width: shape.width,
91
+ height: shape.height - LANE_INDENTATION
92
+ };
93
+
94
+ modeling.createShape(
95
+ {
96
+ type: 'bpmn:Lane',
97
+ isHorizontal: isHorizontalLane
98
+ },
99
+ siblingPosition,
100
+ laneParent
101
+ );
65
102
  }
66
103
 
67
104
  // (1) collect affected elements to create necessary space
@@ -84,26 +121,72 @@ AddLaneHandler.prototype.preExecute = function(context) {
84
121
  });
85
122
  });
86
123
 
87
- var offset = location === 'top' ? -120 : 120,
88
- lanePosition = location === 'top' ? shape.y : shape.y + shape.height,
89
- spacePos = lanePosition + (location === 'top' ? 10 : -10),
90
- direction = location === 'top' ? 'n' : 's';
124
+ var offset,
125
+ lanePosition,
126
+ spacePos,
127
+ direction,
128
+ axis;
129
+
130
+ if (location === 'top') {
131
+ offset = -120;
132
+ lanePosition = shape.y;
133
+ spacePos = lanePosition + 10;
134
+ direction = 'n';
135
+ axis = 'y';
136
+ } else
137
+ if (location === 'left') {
138
+ offset = -120;
139
+ lanePosition = shape.x;
140
+ spacePos = lanePosition + 10;
141
+ direction = 'w';
142
+ axis = 'x';
143
+ } else
144
+ if (location === 'bottom') {
145
+ offset = 120;
146
+ lanePosition = shape.y + shape.height;
147
+ spacePos = lanePosition - 10;
148
+ direction = 's';
149
+ axis = 'y';
150
+ } else
151
+ if (location === 'right') {
152
+ offset = 120;
153
+ lanePosition = shape.x + shape.width;
154
+ spacePos = lanePosition - 10;
155
+ direction = 'e';
156
+ axis = 'x';
157
+ }
91
158
 
92
- var adjustments = spaceTool.calculateAdjustments(allAffected, 'y', offset, spacePos);
159
+ var adjustments = spaceTool.calculateAdjustments(allAffected, axis, offset, spacePos);
160
+
161
+ var delta = isHorizontalLane ? { x: 0, y: offset } : { x: offset, y: 0 };
93
162
 
94
163
  spaceTool.makeSpace(
95
164
  adjustments.movingShapes,
96
165
  adjustments.resizingShapes,
97
- { x: 0, y: offset },
166
+ delta,
98
167
  direction,
99
168
  spacePos
100
169
  );
101
170
 
102
171
  // (2) create new lane at open space
103
- context.newLane = modeling.createShape({ type: 'bpmn:Lane' }, {
172
+ var newLanePosition = isHorizontalLane ? {
104
173
  x: shape.x + (isRoot ? LANE_INDENTATION : 0),
105
174
  y: lanePosition - (location === 'top' ? 120 : 0),
106
175
  width: shape.width - (isRoot ? LANE_INDENTATION : 0),
107
176
  height: 120
108
- }, laneParent);
177
+ } : {
178
+ x: lanePosition - (location === 'left' ? 120 : 0),
179
+ y: shape.y + (isRoot ? LANE_INDENTATION : 0),
180
+ width: 120,
181
+ height: shape.height - (isRoot ? LANE_INDENTATION : 0)
182
+ };
183
+
184
+ context.newLane = modeling.createShape(
185
+ {
186
+ type: 'bpmn:Lane',
187
+ isHorizontal: isHorizontalLane
188
+ },
189
+ newLanePosition,
190
+ laneParent
191
+ );
109
192
  };
@@ -7,6 +7,7 @@ export type BpmnAttributes = {
7
7
  cancelActivity: boolean;
8
8
  eventDefinitionType: string;
9
9
  isExpanded: boolean;
10
+ isHorizontal: boolean;
10
11
  isForCompensation: boolean;
11
12
  isInterrupting: boolean;
12
13
  processRef: ModdleElement;
@@ -17,6 +17,7 @@ export type BpmnAttributes = {
17
17
  cancelActivity: boolean;
18
18
  eventDefinitionType: string;
19
19
  isExpanded: boolean;
20
+ isHorizontal: boolean;
20
21
  isForCompensation: boolean;
21
22
  isInterrupting: boolean;
22
23
  processRef: ModdleElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmn-js",
3
- "version": "16.4.0",
3
+ "version": "16.5.0",
4
4
  "description": "A bpmn 2.0 toolkit and web modeler",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -97,7 +97,7 @@
97
97
  "karma-webpack": "^5.0.0",
98
98
  "mocha": "^10.1.0",
99
99
  "mocha-test-container-support": "0.2.0",
100
- "npm-run-all": "^4.1.2",
100
+ "npm-run-all2": "^5.0.0",
101
101
  "puppeteer": "^21.3.8",
102
102
  "remark-cli": "^12.0.0",
103
103
  "remark-preset-bpmn-io": "^0.2.1",