bpmn-js 9.3.1 → 9.3.2

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,6 +1,6 @@
1
1
  import inherits from 'inherits-browser';
2
2
 
3
- import { forEach } from 'min-dash';
3
+ import { forEach, reduce } from 'min-dash';
4
4
 
5
5
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
6
6
 
@@ -30,10 +30,14 @@ export default function ReplaceElementBehaviour(
30
30
  target = context.parent,
31
31
  elements = context.elements;
32
32
 
33
- var canReplace = bpmnRules.canReplace(elements, target);
33
+ var elementReplacements = reduce(elements, function(replacements, element) {
34
+ var canReplace = bpmnRules.canReplace([ element ], element.host || element.parent || target);
34
35
 
35
- if (canReplace) {
36
- this.replaceElements(elements, canReplace.replacements);
36
+ return canReplace ? replacements.concat(canReplace.replacements) : replacements;
37
+ }, []);
38
+
39
+ if (elementReplacements.length) {
40
+ this.replaceElements(elements, elementReplacements);
37
41
  }
38
42
  }, this);
39
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmn-js",
3
- "version": "9.3.1",
3
+ "version": "9.3.2",
4
4
  "description": "A bpmn 2.0 toolkit and web modeler",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -100,7 +100,7 @@
100
100
  "dependencies": {
101
101
  "bpmn-moddle": "^7.1.2",
102
102
  "css.escape": "^1.5.1",
103
- "diagram-js": "^8.7.0",
103
+ "diagram-js": "^8.7.1",
104
104
  "diagram-js-direct-editing": "^1.7.0",
105
105
  "ids": "^1.0.0",
106
106
  "inherits-browser": "0.0.1",
@@ -267,6 +267,31 @@ export function createViewer(container, viewerInstance, xml, diagramId) {
267
267
  });
268
268
  }
269
269
 
270
+ function logConfigured(type, force) {
271
+ var url = new URL(window.location.href);
272
+
273
+ var log = ('searchParams' in url) && url.searchParams.get('log') || '';
274
+
275
+ return force || log.includes('save-xml');
276
+ }
277
+
278
+ /**
279
+ * Enable logging on a modeler instance.
280
+ *
281
+ * @param {import('bpmn-js')} modeler
282
+ * @param {boolean} [force=false]
283
+ */
284
+ export function enableLogging(modeler, force) {
285
+
286
+ var saveXML = logConfigured('save-xml', force);
287
+
288
+ saveXML && modeler.on('commandStack.changed', function() {
289
+ modeler.saveXML({ format: true }).then(function(result) {
290
+ console.log(result.xml);
291
+ });
292
+ });
293
+ }
294
+
270
295
  export function setBpmnJS(instance) {
271
296
  BPMN_JS = instance;
272
297
  }
@@ -1 +0,0 @@
1
- data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linejoin%3Around%22%20d%3D%22M450%20400V150h900v250%22%2F%3E%3Crect%20x%3D%22150%22%20y%3D%22450%22%20width%3D%22600%22%20height%3D%221200%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%221050%22%20y%3D%22450%22%20width%3D%22600%22%20height%3D%22800%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E
@@ -1 +0,0 @@
1
- data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linejoin%3Around%22%20d%3D%22M400%201350H150V450h250%22%2F%3E%3Crect%20x%3D%22450%22%20y%3D%22150%22%20width%3D%221200%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%22450%22%20y%3D%221050%22%20width%3D%22800%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E