bpmn-js 18.31.0 → 18.32.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 +1 @@
1
- {"version":3,"file":"LabelBehavior.d.ts","mappings":";;;;;;;;;;AAiSA,uDANW,KAAK,aACL,IAAI,aACJ,IAAI,GAEH,KAAK;;;;;;;;qBA5NjBA;;;;;;;IAAAC;;;gBArBa,OAAO,8BAA8B,EAAE;gBACvC,OAAO,aAAa,EAAE;mBACtB,OAAO,gBAAgB,EAAE;oBACzB,OAAO,4BAA4B,EAAE;aAErC,OAAO,2BAA2B,EAAE;YACpC,OAAO,2BAA2B,EAAE;mBAEpC,KAAK,EAAE;+BAhCW,2CAA2C","names":["LabelBehavior class","LabelBehavior constructor"],"ignoreList":[],"sources":["LabelBehavior.js"]}
1
+ {"version":3,"file":"LabelBehavior.d.ts","mappings":";;;;;;;;;;AAyTA,uDANW,KAAK,aACL,IAAI,aACJ,IAAI,GAEH,KAAK;;;;;;;;qBAhPjBA;;;;;;;IAAAC;;;gBArBa,OAAO,8BAA8B,EAAE;gBACvC,OAAO,aAAa,EAAE;mBACtB,OAAO,gBAAgB,EAAE;oBACzB,OAAO,4BAA4B,EAAE;aAErC,OAAO,2BAA2B,EAAE;YACpC,OAAO,2BAA2B,EAAE;mBAEpC,KAAK,EAAE;+BApCW,2CAA2C","names":["LabelBehavior class","LabelBehavior constructor"],"ignoreList":[],"sources":["LabelBehavior.js"]}
@@ -26,6 +26,10 @@ import {
26
26
  getNewAttachPoint
27
27
  } from 'diagram-js/lib/util/AttachUtil';
28
28
 
29
+ import {
30
+ getClosure
31
+ } from 'diagram-js/lib/util/Elements';
32
+
29
33
  import {
30
34
  getMid,
31
35
  roundPoint
@@ -163,6 +167,26 @@ export default function LabelBehavior(
163
167
  return getLabelAdjustment(label, newWaypoints, oldWaypoints, hints);
164
168
  }
165
169
 
170
+ // connection labels follow their connection if only one end moves
171
+ this.preExecute('elements.move', function(event) {
172
+ var context = event.context,
173
+ movedShapes = getClosure(context.shapes).allShapes;
174
+
175
+ function isMoved(shape) {
176
+ return !!(movedShapes[shape.id] || (shape.host && movedShapes[shape.host.id]));
177
+ }
178
+
179
+ context.shapes = context.shapes.filter(function(shape) {
180
+ var connection = shape.labelTarget;
181
+
182
+ return !(
183
+ connection &&
184
+ connection.waypoints &&
185
+ isMoved(connection.source) !== isMoved(connection.target)
186
+ );
187
+ });
188
+ });
189
+
166
190
  this.postExecute([
167
191
  'connection.layout',
168
192
  'connection.updateWaypoints'
@@ -181,12 +181,21 @@ BpmnCreateMoveSnapping.prototype.addSnapTargetPoints = function(snapPoints, shap
181
181
  * @return {Shape[]}
182
182
  */
183
183
  BpmnCreateMoveSnapping.prototype.getSnapTargets = function(shape, target) {
184
- return CreateMoveSnapping.prototype.getSnapTargets.call(this, shape, target)
185
- .filter(function(snapTarget) {
184
+ var snapTargets = CreateMoveSnapping.prototype.getSnapTargets.call(this, shape, target);
186
185
 
187
- // do not snap to lanes
188
- return !is(snapTarget, 'bpmn:Lane');
189
- });
186
+ if (shape.labelTarget && shape.labelTarget.parent && shape.labelTarget.parent !== target) {
187
+
188
+ // labels stay at root, so include their target's peers
189
+ snapTargets = snapTargets.concat(
190
+ CreateMoveSnapping.prototype.getSnapTargets.call(this, shape, shape.labelTarget.parent)
191
+ );
192
+ }
193
+
194
+ return snapTargets.filter(function(snapTarget, index) {
195
+
196
+ // do not snap to lanes
197
+ return !is(snapTarget, 'bpmn:Lane') && snapTargets.indexOf(snapTarget) === index;
198
+ });
190
199
  };
191
200
 
192
201
  // helpers //////////
@@ -269,7 +269,18 @@ BpmnImporter.prototype.addLabel = function(semantic, di, element) {
269
269
 
270
270
  text = getLabel(element);
271
271
 
272
- if (text) {
272
+ if (text && di.label && di.label.bounds && bounds.width > 0) {
273
+
274
+ // keep the persisted width, it may have been set by the user
275
+ var dimensions = this._textRenderer.getDimensions(text, {
276
+ box: bounds,
277
+ style: this._textRenderer.getExternalStyle()
278
+ });
279
+
280
+ bounds = assign({}, bounds, {
281
+ height: Math.ceil(dimensions.height)
282
+ });
283
+ } else if (text) {
273
284
 
274
285
  // get corrected bounds from actual layouted text
275
286
  bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
@@ -153,7 +153,7 @@ export function getExternalLabelBounds(di, element) {
153
153
  bounds = label.bounds;
154
154
 
155
155
  size = {
156
- width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
156
+ width: bounds.width,
157
157
  height: bounds.height
158
158
  };
159
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmn-js",
3
- "version": "18.31.0",
3
+ "version": "18.32.0",
4
4
  "description": "A bpmn 2.0 toolkit and web modeler",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -65,28 +65,28 @@
65
65
  "*.css"
66
66
  ],
67
67
  "devDependencies": {
68
- "@babel/core": "^8.0.5",
68
+ "@babel/core": "^8.1.0",
69
69
  "@bpmn-io/a11y": "^0.1.0",
70
70
  "@bpmn-io/theme": "^0.1.0",
71
71
  "@rollup/plugin-commonjs": "^29.0.3",
72
72
  "@rollup/plugin-json": "^6.1.0",
73
73
  "@rollup/plugin-node-resolve": "^16.0.3",
74
74
  "@rollup/plugin-replace": "^6.0.3",
75
- "@rollup/plugin-terser": "^1.0.0",
75
+ "@rollup/plugin-terser": "^1.0.2",
76
76
  "babel-loader": "^10.1.1",
77
77
  "babel-plugin-istanbul": "^8.0.0",
78
78
  "bio-dts": "^0.15.3",
79
79
  "bpmn-font": "^0.13.0",
80
80
  "camunda-bpmn-moddle": "^4.0.1",
81
- "chai": "^6.2.2",
81
+ "chai": "^6.3.0",
82
82
  "chai-match": "^1.1.1",
83
83
  "cpy": "^13.2.3",
84
84
  "cross-env": "^10.1.0",
85
- "del": "^8.0.0",
86
- "del-cli": "^7.0.0",
85
+ "del": "^9.0.0",
86
+ "del-cli": "^8.0.0",
87
87
  "eslint": "^9.39.5",
88
88
  "eslint-plugin-bpmn-io": "^2.4.0",
89
- "execa": "^10.0.1",
89
+ "execa": "^10.2.1",
90
90
  "file-drops": "^0.7.0",
91
91
  "karma": "^6.4.4",
92
92
  "karma-chrome-launcher-2": "^3.3.0",
@@ -98,22 +98,22 @@
98
98
  "karma-safari-launcher": "^1.0.0",
99
99
  "karma-tldr-reporter": "^1.0.0",
100
100
  "karma-webpack": "^5.0.1",
101
- "mocha": "^12.0.2",
101
+ "mocha": "^12.0.3",
102
102
  "mocha-test-container-support": "0.2.0",
103
- "npm-run-all2": "^9.0.3",
103
+ "npm-run-all2": "^9.0.4",
104
104
  "remark-cli": "^12.0.1",
105
105
  "remark-preset-bpmn-io": "^0.4.0",
106
- "rollup": "^4.63.3",
106
+ "rollup": "^4.68.0",
107
107
  "rollup-plugin-license": "^3.7.1",
108
108
  "sinon": "^22.1.0",
109
109
  "sinon-chai": "^4.0.0",
110
110
  "ts-expect": "^1.3.0",
111
111
  "typescript": "^5.9.3",
112
- "webpack": "^5.111.1"
112
+ "webpack": "^5.112.2"
113
113
  },
114
114
  "dependencies": {
115
115
  "bpmn-moddle": "^10.3.1",
116
- "diagram-js": "^15.28.0",
116
+ "diagram-js": "^15.29.1",
117
117
  "diagram-js-direct-editing": "^3.6.0",
118
118
  "ids": "^3.0.2",
119
119
  "inherits-browser": "^0.1.0",