camunda-bpmn-js 4.20.1 → 5.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.
- package/dist/assets/diagram-js.css +17 -8
- package/dist/assets/properties-panel.css +1509 -1505
- package/dist/base-modeler.development.js +1850 -1621
- package/dist/base-modeler.production.min.js +44 -43
- package/dist/base-navigated-viewer.development.js +305 -767
- package/dist/base-navigated-viewer.production.min.js +1 -1
- package/dist/base-viewer.development.js +277 -699
- package/dist/base-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-modeler.development.js +11460 -10467
- package/dist/camunda-cloud-modeler.production.min.js +46 -45
- package/dist/camunda-cloud-navigated-viewer.development.js +306 -759
- package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-viewer.development.js +278 -691
- package/dist/camunda-cloud-viewer.production.min.js +1 -1
- package/dist/camunda-platform-modeler.development.js +2367 -2117
- package/dist/camunda-platform-modeler.production.min.js +44 -43
- package/dist/camunda-platform-navigated-viewer.development.js +305 -767
- package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-platform-viewer.development.js +277 -699
- package/dist/camunda-platform-viewer.production.min.js +1 -1
- package/lib/camunda-cloud/Modeler.js +21 -0
- package/package.json +14 -14
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
* @return {Boolean}
|
|
74
74
|
*/
|
|
75
75
|
function has$1(target, key) {
|
|
76
|
-
return nativeHasOwnProperty$1.call(target, key);
|
|
76
|
+
return !isNil(target) && nativeHasOwnProperty$1.call(target, key);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
* @param {Collection<T>} collection
|
|
163
163
|
* @param {Matcher<T>} matcher
|
|
164
164
|
*
|
|
165
|
-
* @return {number}
|
|
165
|
+
* @return {number | string | undefined}
|
|
166
166
|
*/
|
|
167
167
|
function findIndex(collection, matcher) {
|
|
168
168
|
|
|
@@ -1348,26 +1348,6 @@
|
|
|
1348
1348
|
return this.list.contains(name);
|
|
1349
1349
|
};
|
|
1350
1350
|
|
|
1351
|
-
/**
|
|
1352
|
-
* Clear utility
|
|
1353
|
-
*/
|
|
1354
|
-
|
|
1355
|
-
/**
|
|
1356
|
-
* Removes all children from the given element
|
|
1357
|
-
*
|
|
1358
|
-
* @param {SVGElement} element
|
|
1359
|
-
* @return {Element} the element (for chaining)
|
|
1360
|
-
*/
|
|
1361
|
-
function clear$1(element) {
|
|
1362
|
-
var child;
|
|
1363
|
-
|
|
1364
|
-
while ((child = element.firstChild)) {
|
|
1365
|
-
element.removeChild(child);
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
return element;
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
1351
|
var ns = {
|
|
1372
1352
|
svg: 'http://www.w3.org/2000/svg'
|
|
1373
1353
|
};
|
|
@@ -2588,16 +2568,6 @@
|
|
|
2588
2568
|
|
|
2589
2569
|
var domify$1 = domify;
|
|
2590
2570
|
|
|
2591
|
-
/**
|
|
2592
|
-
* @param { HTMLElement } element
|
|
2593
|
-
* @param { String } selector
|
|
2594
|
-
*
|
|
2595
|
-
* @return { boolean }
|
|
2596
|
-
*/
|
|
2597
|
-
function matches(element, selector) {
|
|
2598
|
-
return element && typeof element.matches === 'function' && element.matches(selector) || false;
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
2571
|
function query(selector, el) {
|
|
2602
2572
|
el = el || document;
|
|
2603
2573
|
|
|
@@ -5205,6 +5175,8 @@
|
|
|
5205
5175
|
|
|
5206
5176
|
return bbox;
|
|
5207
5177
|
} catch (e) {
|
|
5178
|
+
console.log(e);
|
|
5179
|
+
|
|
5208
5180
|
return { width: 0, height: 0 };
|
|
5209
5181
|
}
|
|
5210
5182
|
}
|
|
@@ -6803,7 +6775,7 @@
|
|
|
6803
6775
|
// document wide unique overlay ids
|
|
6804
6776
|
var ids = new IdGenerator('ov');
|
|
6805
6777
|
|
|
6806
|
-
var LOW_PRIORITY$
|
|
6778
|
+
var LOW_PRIORITY$3 = 500;
|
|
6807
6779
|
|
|
6808
6780
|
/**
|
|
6809
6781
|
* @typedef {import('../../core/Canvas').default} Canvas
|
|
@@ -7433,7 +7405,7 @@
|
|
|
7433
7405
|
|
|
7434
7406
|
// move integration
|
|
7435
7407
|
|
|
7436
|
-
eventBus.on('element.changed', LOW_PRIORITY$
|
|
7408
|
+
eventBus.on('element.changed', LOW_PRIORITY$3, function(e) {
|
|
7437
7409
|
var element = e.element;
|
|
7438
7410
|
|
|
7439
7411
|
var container = self._getOverlayContainer(element, true);
|
|
@@ -7607,7 +7579,7 @@
|
|
|
7607
7579
|
* @typedef { (context: CommandContext) => void } ComposeHandlerFunction
|
|
7608
7580
|
*/
|
|
7609
7581
|
|
|
7610
|
-
var DEFAULT_PRIORITY$
|
|
7582
|
+
var DEFAULT_PRIORITY$2 = 1000;
|
|
7611
7583
|
|
|
7612
7584
|
/**
|
|
7613
7585
|
* A utility that can be used to plug into the command execution for
|
|
@@ -7674,7 +7646,7 @@
|
|
|
7674
7646
|
that = unwrap;
|
|
7675
7647
|
unwrap = handlerFn;
|
|
7676
7648
|
handlerFn = priority;
|
|
7677
|
-
priority = DEFAULT_PRIORITY$
|
|
7649
|
+
priority = DEFAULT_PRIORITY$2;
|
|
7678
7650
|
}
|
|
7679
7651
|
|
|
7680
7652
|
if (isObject(unwrap)) {
|
|
@@ -8471,7 +8443,7 @@
|
|
|
8471
8443
|
* @typedef {import('../../model/Types').Shape} Shape
|
|
8472
8444
|
*/
|
|
8473
8445
|
|
|
8474
|
-
var LOW_PRIORITY$
|
|
8446
|
+
var LOW_PRIORITY$2 = 250;
|
|
8475
8447
|
var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
|
|
8476
8448
|
|
|
8477
8449
|
var EMPTY_MARKER = 'bjs-drilldown-empty';
|
|
@@ -8496,7 +8468,7 @@
|
|
|
8496
8468
|
|
|
8497
8469
|
var self = this;
|
|
8498
8470
|
|
|
8499
|
-
this.executed('shape.toggleCollapse', LOW_PRIORITY$
|
|
8471
|
+
this.executed('shape.toggleCollapse', LOW_PRIORITY$2, function(context) {
|
|
8500
8472
|
var shape = context.shape;
|
|
8501
8473
|
|
|
8502
8474
|
// Add overlay to the collapsed shape
|
|
@@ -8508,7 +8480,7 @@
|
|
|
8508
8480
|
}, true);
|
|
8509
8481
|
|
|
8510
8482
|
|
|
8511
|
-
this.reverted('shape.toggleCollapse', LOW_PRIORITY$
|
|
8483
|
+
this.reverted('shape.toggleCollapse', LOW_PRIORITY$2, function(context) {
|
|
8512
8484
|
var shape = context.shape;
|
|
8513
8485
|
|
|
8514
8486
|
// Add overlay to the collapsed shape
|
|
@@ -8520,7 +8492,7 @@
|
|
|
8520
8492
|
}, true);
|
|
8521
8493
|
|
|
8522
8494
|
|
|
8523
|
-
this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$
|
|
8495
|
+
this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$2,
|
|
8524
8496
|
function(context) {
|
|
8525
8497
|
var oldParent = context.oldParent,
|
|
8526
8498
|
newParent = context.newParent || context.parent,
|
|
@@ -8537,7 +8509,7 @@
|
|
|
8537
8509
|
}, true);
|
|
8538
8510
|
|
|
8539
8511
|
|
|
8540
|
-
this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$
|
|
8512
|
+
this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$2,
|
|
8541
8513
|
function(context) {
|
|
8542
8514
|
var oldParent = context.oldParent,
|
|
8543
8515
|
newParent = context.newParent || context.parent,
|
|
@@ -8681,409 +8653,6 @@
|
|
|
8681
8653
|
subprocessCompatibility: [ 'type', SubprocessCompatibility ]
|
|
8682
8654
|
};
|
|
8683
8655
|
|
|
8684
|
-
var LOW_PRIORITY$2 = 500;
|
|
8685
|
-
|
|
8686
|
-
var DEFAULT_PRIORITY$2 = 1000;
|
|
8687
|
-
|
|
8688
|
-
/**
|
|
8689
|
-
* @typedef {import('../../model/Types').Element} Element
|
|
8690
|
-
*
|
|
8691
|
-
* @typedef {import('./OutlineProvider').default} OutlineProvider
|
|
8692
|
-
* @typedef {import('../../core/EventBus').default} EventBus
|
|
8693
|
-
* @typedef {import('../../draw/Styles').default} Styles
|
|
8694
|
-
*/
|
|
8695
|
-
|
|
8696
|
-
/**
|
|
8697
|
-
* @class
|
|
8698
|
-
*
|
|
8699
|
-
* A plugin that adds an outline to shapes and connections that may be activated and styled
|
|
8700
|
-
* via CSS classes.
|
|
8701
|
-
*
|
|
8702
|
-
* @param {EventBus} eventBus
|
|
8703
|
-
* @param {Styles} styles
|
|
8704
|
-
*/
|
|
8705
|
-
function Outline(eventBus, styles) {
|
|
8706
|
-
|
|
8707
|
-
this._eventBus = eventBus;
|
|
8708
|
-
|
|
8709
|
-
this.offset = 5;
|
|
8710
|
-
|
|
8711
|
-
var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
|
|
8712
|
-
|
|
8713
|
-
var self = this;
|
|
8714
|
-
|
|
8715
|
-
/**
|
|
8716
|
-
* @param {SVGElement} gfx
|
|
8717
|
-
*
|
|
8718
|
-
* @return {SVGElement} outline
|
|
8719
|
-
*/
|
|
8720
|
-
function createOutline(gfx) {
|
|
8721
|
-
var outline = create$1('rect');
|
|
8722
|
-
|
|
8723
|
-
attr$1(outline, assign$1({
|
|
8724
|
-
x: 0,
|
|
8725
|
-
y: 0,
|
|
8726
|
-
rx: 4,
|
|
8727
|
-
width: 100,
|
|
8728
|
-
height: 100
|
|
8729
|
-
}, OUTLINE_STYLE));
|
|
8730
|
-
|
|
8731
|
-
return outline;
|
|
8732
|
-
}
|
|
8733
|
-
|
|
8734
|
-
// A low priortity is necessary, because outlines of labels have to be updated
|
|
8735
|
-
// after the label bounds have been updated in the renderer.
|
|
8736
|
-
eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$2, function(event) {
|
|
8737
|
-
var element = event.element,
|
|
8738
|
-
gfx = event.gfx;
|
|
8739
|
-
|
|
8740
|
-
var outline = query('.djs-outline', gfx);
|
|
8741
|
-
|
|
8742
|
-
if (!outline) {
|
|
8743
|
-
outline = self.getOutline(element) || createOutline();
|
|
8744
|
-
append(gfx, outline);
|
|
8745
|
-
}
|
|
8746
|
-
|
|
8747
|
-
self.updateShapeOutline(outline, element);
|
|
8748
|
-
});
|
|
8749
|
-
|
|
8750
|
-
eventBus.on([ 'connection.added', 'connection.changed' ], function(event) {
|
|
8751
|
-
var element = event.element,
|
|
8752
|
-
gfx = event.gfx;
|
|
8753
|
-
|
|
8754
|
-
var outline = query('.djs-outline', gfx);
|
|
8755
|
-
|
|
8756
|
-
if (!outline) {
|
|
8757
|
-
outline = createOutline();
|
|
8758
|
-
append(gfx, outline);
|
|
8759
|
-
}
|
|
8760
|
-
|
|
8761
|
-
self.updateConnectionOutline(outline, element);
|
|
8762
|
-
});
|
|
8763
|
-
}
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
/**
|
|
8767
|
-
* Updates the outline of a shape respecting the dimension of the
|
|
8768
|
-
* element and an outline offset.
|
|
8769
|
-
*
|
|
8770
|
-
* @param {SVGElement} outline
|
|
8771
|
-
* @param {Element} element
|
|
8772
|
-
*/
|
|
8773
|
-
Outline.prototype.updateShapeOutline = function(outline, element) {
|
|
8774
|
-
|
|
8775
|
-
var updated = false;
|
|
8776
|
-
var providers = this._getProviders();
|
|
8777
|
-
|
|
8778
|
-
if (providers.length) {
|
|
8779
|
-
forEach$1(providers, function(provider) {
|
|
8780
|
-
updated = updated || provider.updateOutline(element, outline);
|
|
8781
|
-
});
|
|
8782
|
-
}
|
|
8783
|
-
|
|
8784
|
-
if (!updated) {
|
|
8785
|
-
attr$1(outline, {
|
|
8786
|
-
x: -this.offset,
|
|
8787
|
-
y: -this.offset,
|
|
8788
|
-
width: element.width + this.offset * 2,
|
|
8789
|
-
height: element.height + this.offset * 2
|
|
8790
|
-
});
|
|
8791
|
-
}
|
|
8792
|
-
};
|
|
8793
|
-
|
|
8794
|
-
/**
|
|
8795
|
-
* Updates the outline of a connection respecting the bounding box of
|
|
8796
|
-
* the connection and an outline offset.
|
|
8797
|
-
* Register an outline provider with the given priority.
|
|
8798
|
-
*
|
|
8799
|
-
* @param {SVGElement} outline
|
|
8800
|
-
* @param {Element} connection
|
|
8801
|
-
*/
|
|
8802
|
-
Outline.prototype.updateConnectionOutline = function(outline, connection) {
|
|
8803
|
-
var bbox = getBBox(connection);
|
|
8804
|
-
|
|
8805
|
-
attr$1(outline, {
|
|
8806
|
-
x: bbox.x - this.offset,
|
|
8807
|
-
y: bbox.y - this.offset,
|
|
8808
|
-
width: bbox.width + this.offset * 2,
|
|
8809
|
-
height: bbox.height + this.offset * 2
|
|
8810
|
-
});
|
|
8811
|
-
};
|
|
8812
|
-
|
|
8813
|
-
/**
|
|
8814
|
-
* Register an outline provider with the given priority.
|
|
8815
|
-
*
|
|
8816
|
-
* @param {number} priority
|
|
8817
|
-
* @param {OutlineProvider} provider
|
|
8818
|
-
*/
|
|
8819
|
-
Outline.prototype.registerProvider = function(priority, provider) {
|
|
8820
|
-
if (!provider) {
|
|
8821
|
-
provider = priority;
|
|
8822
|
-
priority = DEFAULT_PRIORITY$2;
|
|
8823
|
-
}
|
|
8824
|
-
|
|
8825
|
-
this._eventBus.on('outline.getProviders', priority, function(event) {
|
|
8826
|
-
event.providers.push(provider);
|
|
8827
|
-
});
|
|
8828
|
-
};
|
|
8829
|
-
|
|
8830
|
-
/**
|
|
8831
|
-
* Returns the registered outline providers.
|
|
8832
|
-
*
|
|
8833
|
-
* @returns {OutlineProvider[]}
|
|
8834
|
-
*/
|
|
8835
|
-
Outline.prototype._getProviders = function() {
|
|
8836
|
-
var event = this._eventBus.createEvent({
|
|
8837
|
-
type: 'outline.getProviders',
|
|
8838
|
-
providers: []
|
|
8839
|
-
});
|
|
8840
|
-
|
|
8841
|
-
this._eventBus.fire(event);
|
|
8842
|
-
|
|
8843
|
-
return event.providers;
|
|
8844
|
-
};
|
|
8845
|
-
|
|
8846
|
-
/**
|
|
8847
|
-
* Returns the outline for an element.
|
|
8848
|
-
*
|
|
8849
|
-
* @param {Element} element
|
|
8850
|
-
*/
|
|
8851
|
-
Outline.prototype.getOutline = function(element) {
|
|
8852
|
-
var outline;
|
|
8853
|
-
var providers = this._getProviders();
|
|
8854
|
-
|
|
8855
|
-
forEach$1(providers, function(provider) {
|
|
8856
|
-
|
|
8857
|
-
if (!isFunction(provider.getOutline)) {
|
|
8858
|
-
return;
|
|
8859
|
-
}
|
|
8860
|
-
|
|
8861
|
-
outline = outline || provider.getOutline(element);
|
|
8862
|
-
});
|
|
8863
|
-
|
|
8864
|
-
return outline;
|
|
8865
|
-
};
|
|
8866
|
-
|
|
8867
|
-
Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
|
|
8868
|
-
|
|
8869
|
-
/**
|
|
8870
|
-
* @type { import('didi').ModuleDeclaration }
|
|
8871
|
-
*/
|
|
8872
|
-
var OutlineModule$1 = {
|
|
8873
|
-
__init__: [ 'outline' ],
|
|
8874
|
-
outline: [ 'type', Outline ]
|
|
8875
|
-
};
|
|
8876
|
-
|
|
8877
|
-
const DATA_OBJECT_REFERENCE_OUTLINE_PATH = 'M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z';
|
|
8878
|
-
const DATA_STORE_REFERENCE_OUTLINE_PATH = 'M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z';
|
|
8879
|
-
|
|
8880
|
-
/**
|
|
8881
|
-
* @typedef { import('diagram-js/lib/util/Types').Dimensions} Dimensions
|
|
8882
|
-
*/
|
|
8883
|
-
|
|
8884
|
-
/**
|
|
8885
|
-
* @type {Dimensions}
|
|
8886
|
-
*/
|
|
8887
|
-
const DATA_OBJECT_REFERENCE_STANDARD_SIZE = { width: 36, height: 50 };
|
|
8888
|
-
|
|
8889
|
-
/**
|
|
8890
|
-
* @type {Dimensions}
|
|
8891
|
-
*/
|
|
8892
|
-
const DATA_STORE_REFERENCE_STANDARD_SIZE = { width: 50, height: 50 };
|
|
8893
|
-
|
|
8894
|
-
/**
|
|
8895
|
-
* Create a path element with given attributes.
|
|
8896
|
-
* @param {string} path
|
|
8897
|
-
* @param {Object} attrs
|
|
8898
|
-
* @param {Object} OUTLINE_STYLE
|
|
8899
|
-
* @return {SVGElement}
|
|
8900
|
-
*/
|
|
8901
|
-
function createPath(path, attrs, OUTLINE_STYLE) {
|
|
8902
|
-
return create$1('path', {
|
|
8903
|
-
d: path,
|
|
8904
|
-
strokeWidth: 2,
|
|
8905
|
-
transform: `translate(${attrs.x}, ${attrs.y})`,
|
|
8906
|
-
...OUTLINE_STYLE
|
|
8907
|
-
});
|
|
8908
|
-
}
|
|
8909
|
-
|
|
8910
|
-
/**
|
|
8911
|
-
* @typedef { import('diagram-js/lib/features/outline/OutlineProvider').default } BaseOutlineProvider
|
|
8912
|
-
*
|
|
8913
|
-
* @typedef { import('diagram-js/lib/features/outline/OutlineProvider').Outline } Outline
|
|
8914
|
-
*
|
|
8915
|
-
* @typedef { import('diagram-js/lib/draw/Styles').default } Styles
|
|
8916
|
-
*
|
|
8917
|
-
* @typedef { import('diagram-js/lib/model/Types').Element } Element
|
|
8918
|
-
*/
|
|
8919
|
-
|
|
8920
|
-
const DEFAULT_OFFSET = 5;
|
|
8921
|
-
|
|
8922
|
-
/**
|
|
8923
|
-
* BPMN-specific outline provider.
|
|
8924
|
-
*
|
|
8925
|
-
* @implements {BaseOutlineProvider}
|
|
8926
|
-
*
|
|
8927
|
-
* @param {Outline} outline
|
|
8928
|
-
* @param {Styles} styles
|
|
8929
|
-
*/
|
|
8930
|
-
function OutlineProvider(outline, styles) {
|
|
8931
|
-
|
|
8932
|
-
this._styles = styles;
|
|
8933
|
-
outline.registerProvider(this);
|
|
8934
|
-
}
|
|
8935
|
-
|
|
8936
|
-
OutlineProvider.$inject = [
|
|
8937
|
-
'outline',
|
|
8938
|
-
'styles'
|
|
8939
|
-
];
|
|
8940
|
-
|
|
8941
|
-
/**
|
|
8942
|
-
* Returns outline for a given element.
|
|
8943
|
-
*
|
|
8944
|
-
* @param {Element} element
|
|
8945
|
-
*
|
|
8946
|
-
* @return {Outline}
|
|
8947
|
-
*/
|
|
8948
|
-
OutlineProvider.prototype.getOutline = function(element) {
|
|
8949
|
-
|
|
8950
|
-
const OUTLINE_STYLE = this._styles.cls('djs-outline', [ 'no-fill' ]);
|
|
8951
|
-
|
|
8952
|
-
var outline;
|
|
8953
|
-
|
|
8954
|
-
if (isLabel(element)) {
|
|
8955
|
-
return;
|
|
8956
|
-
}
|
|
8957
|
-
|
|
8958
|
-
if (is$1(element, 'bpmn:Gateway')) {
|
|
8959
|
-
outline = create$1('rect');
|
|
8960
|
-
|
|
8961
|
-
assign$1(outline.style, {
|
|
8962
|
-
'transform-box': 'fill-box',
|
|
8963
|
-
'transform': 'rotate(45deg)',
|
|
8964
|
-
'transform-origin': 'center'
|
|
8965
|
-
});
|
|
8966
|
-
|
|
8967
|
-
attr$1(outline, assign$1({
|
|
8968
|
-
x: 2,
|
|
8969
|
-
y: 2,
|
|
8970
|
-
rx: 4,
|
|
8971
|
-
width: element.width - 4,
|
|
8972
|
-
height: element.height - 4,
|
|
8973
|
-
}, OUTLINE_STYLE));
|
|
8974
|
-
|
|
8975
|
-
} else if (isAny(element, [ 'bpmn:Task', 'bpmn:SubProcess', 'bpmn:Group', 'bpmn:CallActivity' ])) {
|
|
8976
|
-
outline = create$1('rect');
|
|
8977
|
-
|
|
8978
|
-
attr$1(outline, assign$1({
|
|
8979
|
-
x: -DEFAULT_OFFSET,
|
|
8980
|
-
y: -DEFAULT_OFFSET,
|
|
8981
|
-
rx: 14,
|
|
8982
|
-
width: element.width + DEFAULT_OFFSET * 2,
|
|
8983
|
-
height: element.height + DEFAULT_OFFSET * 2
|
|
8984
|
-
}, OUTLINE_STYLE));
|
|
8985
|
-
|
|
8986
|
-
} else if (is$1(element, 'bpmn:EndEvent')) {
|
|
8987
|
-
|
|
8988
|
-
outline = create$1('circle');
|
|
8989
|
-
|
|
8990
|
-
// Extra 1px offset needed due to increased stroke-width of end event
|
|
8991
|
-
// which makes it bigger than other events.
|
|
8992
|
-
|
|
8993
|
-
attr$1(outline, assign$1({
|
|
8994
|
-
cx: element.width / 2,
|
|
8995
|
-
cy: element.height / 2,
|
|
8996
|
-
r: element.width / 2 + DEFAULT_OFFSET + 1
|
|
8997
|
-
}, OUTLINE_STYLE));
|
|
8998
|
-
|
|
8999
|
-
} else if (is$1(element, 'bpmn:Event')) {
|
|
9000
|
-
outline = create$1('circle');
|
|
9001
|
-
|
|
9002
|
-
attr$1(outline, assign$1({
|
|
9003
|
-
cx: element.width / 2,
|
|
9004
|
-
cy: element.height / 2,
|
|
9005
|
-
r: element.width / 2 + DEFAULT_OFFSET
|
|
9006
|
-
}, OUTLINE_STYLE));
|
|
9007
|
-
|
|
9008
|
-
} else if (is$1(element, 'bpmn:DataObjectReference') && isStandardSize(element, 'bpmn:DataObjectReference')) {
|
|
9009
|
-
|
|
9010
|
-
outline = createPath(
|
|
9011
|
-
DATA_OBJECT_REFERENCE_OUTLINE_PATH,
|
|
9012
|
-
{ x: -6, y: -6 },
|
|
9013
|
-
OUTLINE_STYLE
|
|
9014
|
-
);
|
|
9015
|
-
|
|
9016
|
-
} else if (is$1(element, 'bpmn:DataStoreReference') && isStandardSize(element, 'bpmn:DataStoreReference')) {
|
|
9017
|
-
|
|
9018
|
-
outline = createPath(
|
|
9019
|
-
DATA_STORE_REFERENCE_OUTLINE_PATH,
|
|
9020
|
-
{ x: -6, y: -6 },
|
|
9021
|
-
OUTLINE_STYLE
|
|
9022
|
-
);
|
|
9023
|
-
}
|
|
9024
|
-
|
|
9025
|
-
return outline;
|
|
9026
|
-
};
|
|
9027
|
-
|
|
9028
|
-
/**
|
|
9029
|
-
* Updates the outline for a given element.
|
|
9030
|
-
* Returns true if the update for the given element was handled by this provider.
|
|
9031
|
-
*
|
|
9032
|
-
* @param {Element} element
|
|
9033
|
-
* @param {Outline} outline
|
|
9034
|
-
* @returns {boolean}
|
|
9035
|
-
*/
|
|
9036
|
-
OutlineProvider.prototype.updateOutline = function(element, outline) {
|
|
9037
|
-
|
|
9038
|
-
if (isLabel(element)) {
|
|
9039
|
-
return;
|
|
9040
|
-
}
|
|
9041
|
-
|
|
9042
|
-
if (isAny(element, [ 'bpmn:SubProcess', 'bpmn:Group' ])) {
|
|
9043
|
-
|
|
9044
|
-
attr$1(outline, {
|
|
9045
|
-
width: element.width + DEFAULT_OFFSET * 2,
|
|
9046
|
-
height: element.height + DEFAULT_OFFSET * 2
|
|
9047
|
-
});
|
|
9048
|
-
|
|
9049
|
-
return true;
|
|
9050
|
-
|
|
9051
|
-
} else if (isAny(element, [
|
|
9052
|
-
'bpmn:Event',
|
|
9053
|
-
'bpmn:Gateway',
|
|
9054
|
-
'bpmn:DataStoreReference',
|
|
9055
|
-
'bpmn:DataObjectReference'
|
|
9056
|
-
])) {
|
|
9057
|
-
return true;
|
|
9058
|
-
}
|
|
9059
|
-
|
|
9060
|
-
return false;
|
|
9061
|
-
};
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
// helpers //////////
|
|
9065
|
-
|
|
9066
|
-
function isStandardSize(element, type) {
|
|
9067
|
-
var standardSize;
|
|
9068
|
-
|
|
9069
|
-
if (type === 'bpmn:DataObjectReference') {
|
|
9070
|
-
standardSize = DATA_OBJECT_REFERENCE_STANDARD_SIZE;
|
|
9071
|
-
} else if (type === 'bpmn:DataStoreReference') {
|
|
9072
|
-
standardSize = DATA_STORE_REFERENCE_STANDARD_SIZE;
|
|
9073
|
-
}
|
|
9074
|
-
|
|
9075
|
-
return element.width === standardSize.width
|
|
9076
|
-
&& element.height === standardSize.height;
|
|
9077
|
-
}
|
|
9078
|
-
|
|
9079
|
-
var OutlineModule = {
|
|
9080
|
-
__depends__: [
|
|
9081
|
-
OutlineModule$1
|
|
9082
|
-
],
|
|
9083
|
-
__init__: [ 'outlineProvider' ],
|
|
9084
|
-
outlineProvider: [ 'type', OutlineProvider ]
|
|
9085
|
-
};
|
|
9086
|
-
|
|
9087
8656
|
/**
|
|
9088
8657
|
* @typedef {import('../util/Types').Point} Point
|
|
9089
8658
|
*/
|
|
@@ -9129,7 +8698,7 @@
|
|
|
9129
8698
|
*
|
|
9130
8699
|
* @return {boolean}
|
|
9131
8700
|
*/
|
|
9132
|
-
function isButton
|
|
8701
|
+
function isButton(event, button) {
|
|
9133
8702
|
return (getOriginal(event) || event).button === button;
|
|
9134
8703
|
}
|
|
9135
8704
|
|
|
@@ -9141,7 +8710,7 @@
|
|
|
9141
8710
|
function isPrimaryButton(event) {
|
|
9142
8711
|
|
|
9143
8712
|
// button === 0 -> left áka primary mouse button
|
|
9144
|
-
return isButton
|
|
8713
|
+
return isButton(event, 0);
|
|
9145
8714
|
}
|
|
9146
8715
|
|
|
9147
8716
|
/**
|
|
@@ -9152,7 +8721,7 @@
|
|
|
9152
8721
|
function isAuxiliaryButton(event) {
|
|
9153
8722
|
|
|
9154
8723
|
// button === 1 -> auxiliary áka wheel button
|
|
9155
|
-
return isButton
|
|
8724
|
+
return isButton(event, 1);
|
|
9156
8725
|
}
|
|
9157
8726
|
|
|
9158
8727
|
/**
|
|
@@ -9790,15 +9359,11 @@
|
|
|
9790
9359
|
/**
|
|
9791
9360
|
* @typedef {import('../../core/Canvas').default} Canvas
|
|
9792
9361
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
9793
|
-
* @typedef {import('./Selection').default} Selection
|
|
9794
9362
|
*/
|
|
9795
9363
|
|
|
9796
9364
|
var MARKER_HOVER = 'hover',
|
|
9797
9365
|
MARKER_SELECTED = 'selected';
|
|
9798
9366
|
|
|
9799
|
-
var SELECTION_OUTLINE_PADDING = 6;
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
9367
|
/**
|
|
9803
9368
|
* A plugin that adds a visible selection UI to shapes and connections
|
|
9804
9369
|
* by appending the <code>hover</code> and <code>selected</code> classes to them.
|
|
@@ -9809,15 +9374,10 @@
|
|
|
9809
9374
|
*
|
|
9810
9375
|
* @param {Canvas} canvas
|
|
9811
9376
|
* @param {EventBus} eventBus
|
|
9812
|
-
* @param {Selection} selection
|
|
9813
9377
|
*/
|
|
9814
|
-
function SelectionVisuals(canvas, eventBus
|
|
9378
|
+
function SelectionVisuals(canvas, eventBus) {
|
|
9815
9379
|
this._canvas = canvas;
|
|
9816
9380
|
|
|
9817
|
-
var self = this;
|
|
9818
|
-
|
|
9819
|
-
this._multiSelectionBox = null;
|
|
9820
|
-
|
|
9821
9381
|
function addMarker(e, cls) {
|
|
9822
9382
|
canvas.addMarker(e, cls);
|
|
9823
9383
|
}
|
|
@@ -9858,63 +9418,14 @@
|
|
|
9858
9418
|
select(e);
|
|
9859
9419
|
}
|
|
9860
9420
|
});
|
|
9861
|
-
|
|
9862
|
-
self._updateSelectionOutline(newSelection);
|
|
9863
|
-
});
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
eventBus.on('element.changed', function(event) {
|
|
9867
|
-
if (selection.isSelected(event.element)) {
|
|
9868
|
-
self._updateSelectionOutline(selection.get());
|
|
9869
|
-
}
|
|
9870
9421
|
});
|
|
9871
9422
|
}
|
|
9872
9423
|
|
|
9873
9424
|
SelectionVisuals.$inject = [
|
|
9874
9425
|
'canvas',
|
|
9875
|
-
'eventBus'
|
|
9876
|
-
'selection'
|
|
9426
|
+
'eventBus'
|
|
9877
9427
|
];
|
|
9878
9428
|
|
|
9879
|
-
SelectionVisuals.prototype._updateSelectionOutline = function(selection) {
|
|
9880
|
-
var layer = this._canvas.getLayer('selectionOutline');
|
|
9881
|
-
|
|
9882
|
-
clear$1(layer);
|
|
9883
|
-
|
|
9884
|
-
var enabled = selection.length > 1;
|
|
9885
|
-
|
|
9886
|
-
var container = this._canvas.getContainer();
|
|
9887
|
-
|
|
9888
|
-
classes$1(container)[enabled ? 'add' : 'remove']('djs-multi-select');
|
|
9889
|
-
|
|
9890
|
-
if (!enabled) {
|
|
9891
|
-
return;
|
|
9892
|
-
}
|
|
9893
|
-
|
|
9894
|
-
var bBox = addSelectionOutlinePadding(getBBox(selection));
|
|
9895
|
-
|
|
9896
|
-
var rect = create$1('rect');
|
|
9897
|
-
|
|
9898
|
-
attr$1(rect, assign$1({
|
|
9899
|
-
rx: 3
|
|
9900
|
-
}, bBox));
|
|
9901
|
-
|
|
9902
|
-
classes$1(rect).add('djs-selection-outline');
|
|
9903
|
-
|
|
9904
|
-
append(layer, rect);
|
|
9905
|
-
};
|
|
9906
|
-
|
|
9907
|
-
// helpers //////////
|
|
9908
|
-
|
|
9909
|
-
function addSelectionOutlinePadding(bBox) {
|
|
9910
|
-
return {
|
|
9911
|
-
x: bBox.x - SELECTION_OUTLINE_PADDING,
|
|
9912
|
-
y: bBox.y - SELECTION_OUTLINE_PADDING,
|
|
9913
|
-
width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
|
|
9914
|
-
height: bBox.height + SELECTION_OUTLINE_PADDING * 2
|
|
9915
|
-
};
|
|
9916
|
-
}
|
|
9917
|
-
|
|
9918
9429
|
/**
|
|
9919
9430
|
* @typedef {import('../../core/Canvas').default} Canvas
|
|
9920
9431
|
* @typedef {import('../../core/ElementRegistry').default} ElementRegistry
|
|
@@ -10041,7 +9552,6 @@
|
|
|
10041
9552
|
__init__: [ 'selectionVisuals', 'selectionBehavior' ],
|
|
10042
9553
|
__depends__: [
|
|
10043
9554
|
InteractionEventsModule,
|
|
10044
|
-
OutlineModule$1
|
|
10045
9555
|
],
|
|
10046
9556
|
selection: [ 'type', Selection ],
|
|
10047
9557
|
selectionVisuals: [ 'type', SelectionVisuals ],
|
|
@@ -10970,6 +10480,11 @@
|
|
|
10970
10480
|
*/
|
|
10971
10481
|
this._rootElement = null;
|
|
10972
10482
|
|
|
10483
|
+
/**
|
|
10484
|
+
* @type {boolean}
|
|
10485
|
+
*/
|
|
10486
|
+
this._focused = false;
|
|
10487
|
+
|
|
10973
10488
|
this._init(config || {});
|
|
10974
10489
|
}
|
|
10975
10490
|
|
|
@@ -10996,14 +10511,33 @@
|
|
|
10996
10511
|
* @param {CanvasConfig} config
|
|
10997
10512
|
*/
|
|
10998
10513
|
Canvas.prototype._init = function(config) {
|
|
10999
|
-
|
|
11000
10514
|
const eventBus = this._eventBus;
|
|
11001
10515
|
|
|
11002
10516
|
// html container
|
|
11003
10517
|
const container = this._container = createContainer(config);
|
|
11004
10518
|
|
|
11005
10519
|
const svg = this._svg = create$1('svg');
|
|
11006
|
-
|
|
10520
|
+
|
|
10521
|
+
attr$1(svg, {
|
|
10522
|
+
width: '100%',
|
|
10523
|
+
height: '100%'
|
|
10524
|
+
});
|
|
10525
|
+
|
|
10526
|
+
attr(svg, 'tabindex', 0);
|
|
10527
|
+
|
|
10528
|
+
eventBus.on('element.hover', () => {
|
|
10529
|
+
this.restoreFocus();
|
|
10530
|
+
});
|
|
10531
|
+
|
|
10532
|
+
svg.addEventListener('focusin', () => {
|
|
10533
|
+
this._focused = true;
|
|
10534
|
+
eventBus.fire('canvas.focus.changed', { focused: true });
|
|
10535
|
+
});
|
|
10536
|
+
|
|
10537
|
+
svg.addEventListener('focusout', () => {
|
|
10538
|
+
this._focused = false;
|
|
10539
|
+
eventBus.fire('canvas.focus.changed', { focused: false });
|
|
10540
|
+
});
|
|
11007
10541
|
|
|
11008
10542
|
append(container, svg);
|
|
11009
10543
|
|
|
@@ -11095,6 +10629,31 @@
|
|
|
11095
10629
|
delete this._cachedViewbox;
|
|
11096
10630
|
};
|
|
11097
10631
|
|
|
10632
|
+
/**
|
|
10633
|
+
* Sets focus on the canvas SVG element.
|
|
10634
|
+
*/
|
|
10635
|
+
Canvas.prototype.focus = function() {
|
|
10636
|
+
this._svg.focus({ preventScroll: true });
|
|
10637
|
+
};
|
|
10638
|
+
|
|
10639
|
+
/**
|
|
10640
|
+
* Sets focus on the canvas SVG element if `document.body` is currently focused.
|
|
10641
|
+
*/
|
|
10642
|
+
Canvas.prototype.restoreFocus = function() {
|
|
10643
|
+
if (document.activeElement === document.body) {
|
|
10644
|
+
this.focus();
|
|
10645
|
+
}
|
|
10646
|
+
};
|
|
10647
|
+
|
|
10648
|
+
/**
|
|
10649
|
+
* Returns true if the canvas is focused.
|
|
10650
|
+
*
|
|
10651
|
+
* @return {boolean}
|
|
10652
|
+
*/
|
|
10653
|
+
Canvas.prototype.isFocused = function() {
|
|
10654
|
+
return this._focused;
|
|
10655
|
+
};
|
|
10656
|
+
|
|
11098
10657
|
/**
|
|
11099
10658
|
* Returns the default layer on which
|
|
11100
10659
|
* all elements are drawn.
|
|
@@ -11934,7 +11493,7 @@
|
|
|
11934
11493
|
Canvas.prototype.viewbox = function(box) {
|
|
11935
11494
|
|
|
11936
11495
|
if (box === undefined && this._cachedViewbox) {
|
|
11937
|
-
return this._cachedViewbox;
|
|
11496
|
+
return structuredClone(this._cachedViewbox);
|
|
11938
11497
|
}
|
|
11939
11498
|
|
|
11940
11499
|
const viewport = this._viewport,
|
|
@@ -14562,13 +14121,15 @@
|
|
|
14562
14121
|
if (parts.length === 1) {
|
|
14563
14122
|
localName = name;
|
|
14564
14123
|
prefix = defaultPrefix;
|
|
14565
|
-
}
|
|
14124
|
+
}
|
|
14566
14125
|
|
|
14567
14126
|
// prefix + local name
|
|
14568
|
-
if (parts.length === 2) {
|
|
14127
|
+
else if (parts.length === 2) {
|
|
14569
14128
|
localName = parts[1];
|
|
14570
14129
|
prefix = parts[0];
|
|
14571
|
-
}
|
|
14130
|
+
}
|
|
14131
|
+
|
|
14132
|
+
else {
|
|
14572
14133
|
throw new Error('expected <prefix:localName> or <localName>, got ' + name);
|
|
14573
14134
|
}
|
|
14574
14135
|
|
|
@@ -15470,7 +15031,7 @@
|
|
|
15470
15031
|
* sub-set of reserved names (&) as well as
|
|
15471
15032
|
* hex (ય) and decimal (ӏ) encoded characters.
|
|
15472
15033
|
*
|
|
15473
|
-
* @param {string}
|
|
15034
|
+
* @param {string} s
|
|
15474
15035
|
*
|
|
15475
15036
|
* @return {string} decoded string
|
|
15476
15037
|
*/
|
|
@@ -15482,10 +15043,6 @@
|
|
|
15482
15043
|
return s;
|
|
15483
15044
|
}
|
|
15484
15045
|
|
|
15485
|
-
var XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';
|
|
15486
|
-
var XSI_PREFIX = 'xsi';
|
|
15487
|
-
var XSI_TYPE$1 = 'xsi:type';
|
|
15488
|
-
|
|
15489
15046
|
var NON_WHITESPACE_OUTSIDE_ROOT_NODE = 'non-whitespace outside of root node';
|
|
15490
15047
|
|
|
15491
15048
|
function error$1(msg) {
|
|
@@ -15530,7 +15087,7 @@
|
|
|
15530
15087
|
}
|
|
15531
15088
|
|
|
15532
15089
|
function noopGetContext() {
|
|
15533
|
-
return {
|
|
15090
|
+
return { line: 0, column: 0 };
|
|
15534
15091
|
}
|
|
15535
15092
|
|
|
15536
15093
|
function throwFunc(err) {
|
|
@@ -15696,9 +15253,6 @@
|
|
|
15696
15253
|
_nsUriToPrefix[k] = nsMap[k];
|
|
15697
15254
|
}
|
|
15698
15255
|
|
|
15699
|
-
// FORCE default mapping for schema instance
|
|
15700
|
-
_nsUriToPrefix[XSI_URI] = XSI_PREFIX;
|
|
15701
|
-
|
|
15702
15256
|
isNamespace = true;
|
|
15703
15257
|
nsUriToPrefix = _nsUriToPrefix;
|
|
15704
15258
|
|
|
@@ -16022,23 +15576,6 @@
|
|
|
16022
15576
|
|
|
16023
15577
|
// end: normalize ns attribute name
|
|
16024
15578
|
|
|
16025
|
-
// normalize xsi:type ns attribute value
|
|
16026
|
-
if (name === XSI_TYPE$1) {
|
|
16027
|
-
w = value.indexOf(':');
|
|
16028
|
-
|
|
16029
|
-
if (w !== -1) {
|
|
16030
|
-
nsName = value.substring(0, w);
|
|
16031
|
-
|
|
16032
|
-
// handle default prefixes, i.e. xs:String gracefully
|
|
16033
|
-
nsName = nsMatrix[nsName] || nsName;
|
|
16034
|
-
value = nsName + value.substring(w);
|
|
16035
|
-
} else {
|
|
16036
|
-
value = defaultAlias + ':' + value;
|
|
16037
|
-
}
|
|
16038
|
-
}
|
|
16039
|
-
|
|
16040
|
-
// end: normalize xsi:type ns attribute value
|
|
16041
|
-
|
|
16042
15579
|
attrs[name] = value;
|
|
16043
15580
|
}
|
|
16044
15581
|
|
|
@@ -16067,23 +15604,6 @@
|
|
|
16067
15604
|
: nsName + name.substr(w);
|
|
16068
15605
|
|
|
16069
15606
|
// end: normalize ns attribute name
|
|
16070
|
-
|
|
16071
|
-
// normalize xsi:type ns attribute value
|
|
16072
|
-
if (name === XSI_TYPE$1) {
|
|
16073
|
-
w = value.indexOf(':');
|
|
16074
|
-
|
|
16075
|
-
if (w !== -1) {
|
|
16076
|
-
nsName = value.substring(0, w);
|
|
16077
|
-
|
|
16078
|
-
// handle default prefixes, i.e. xs:String gracefully
|
|
16079
|
-
nsName = nsMatrix[nsName] || nsName;
|
|
16080
|
-
value = nsName + value.substring(w);
|
|
16081
|
-
} else {
|
|
16082
|
-
value = defaultAlias + ':' + value;
|
|
16083
|
-
}
|
|
16084
|
-
}
|
|
16085
|
-
|
|
16086
|
-
// end: normalize xsi:type ns attribute value
|
|
16087
15607
|
}
|
|
16088
15608
|
|
|
16089
15609
|
attrs[name] = value;
|
|
@@ -16224,11 +15744,11 @@
|
|
|
16224
15744
|
}
|
|
16225
15745
|
}
|
|
16226
15746
|
|
|
16227
|
-
w = xml.charCodeAt(i+1);
|
|
15747
|
+
w = xml.charCodeAt(i + 1);
|
|
16228
15748
|
|
|
16229
15749
|
// parse comments + CDATA
|
|
16230
15750
|
if (w === 33) { // "!"
|
|
16231
|
-
q = xml.charCodeAt(i+2);
|
|
15751
|
+
q = xml.charCodeAt(i + 2);
|
|
16232
15752
|
|
|
16233
15753
|
// CDATA section
|
|
16234
15754
|
if (q === 91 && xml.substr(i + 3, 6) === 'CDATA[') { // 91 == "["
|
|
@@ -16512,18 +16032,16 @@
|
|
|
16512
16032
|
'xml': 'http://www.w3.org/XML/1998/namespace'
|
|
16513
16033
|
};
|
|
16514
16034
|
|
|
16515
|
-
var
|
|
16035
|
+
var SERIALIZE_PROPERTY = 'property';
|
|
16516
16036
|
|
|
16517
|
-
function
|
|
16037
|
+
function getSerialization(element) {
|
|
16518
16038
|
return element.xml && element.xml.serialize;
|
|
16519
16039
|
}
|
|
16520
16040
|
|
|
16521
|
-
function
|
|
16522
|
-
|
|
16523
|
-
}
|
|
16041
|
+
function getSerializationType(element) {
|
|
16042
|
+
const type = getSerialization(element);
|
|
16524
16043
|
|
|
16525
|
-
|
|
16526
|
-
return serializeFormat(element) === 'property';
|
|
16044
|
+
return type !== SERIALIZE_PROPERTY && (type || null);
|
|
16527
16045
|
}
|
|
16528
16046
|
|
|
16529
16047
|
function capitalize(str) {
|
|
@@ -16539,12 +16057,20 @@
|
|
|
16539
16057
|
return aliasNs.prefix + ':' + capitalize(aliasNs.localName);
|
|
16540
16058
|
}
|
|
16541
16059
|
|
|
16060
|
+
/**
|
|
16061
|
+
* Un-prefix a potentially prefixed type name.
|
|
16062
|
+
*
|
|
16063
|
+
* @param {NsName} nameNs
|
|
16064
|
+
* @param {Object} [pkg]
|
|
16065
|
+
*
|
|
16066
|
+
* @return {string}
|
|
16067
|
+
*/
|
|
16542
16068
|
function prefixedToName(nameNs, pkg) {
|
|
16543
16069
|
|
|
16544
16070
|
var name = nameNs.name,
|
|
16545
16071
|
localName = nameNs.localName;
|
|
16546
16072
|
|
|
16547
|
-
var typePrefix = pkg.xml && pkg.xml.typePrefix;
|
|
16073
|
+
var typePrefix = pkg && pkg.xml && pkg.xml.typePrefix;
|
|
16548
16074
|
|
|
16549
16075
|
if (typePrefix && localName.indexOf(typePrefix) === 0) {
|
|
16550
16076
|
return nameNs.prefix + ':' + localName.slice(typePrefix.length);
|
|
@@ -16553,12 +16079,19 @@
|
|
|
16553
16079
|
}
|
|
16554
16080
|
}
|
|
16555
16081
|
|
|
16556
|
-
function
|
|
16082
|
+
function normalizeTypeName(name, nsMap, model) {
|
|
16557
16083
|
|
|
16558
|
-
|
|
16559
|
-
|
|
16084
|
+
// normalize against actual NS
|
|
16085
|
+
const nameNs = parseName(name, nsMap.xmlns);
|
|
16086
|
+
|
|
16087
|
+
const normalizedName = `${ nsMap[nameNs.prefix] || nameNs.prefix }:${ nameNs.localName }`;
|
|
16560
16088
|
|
|
16561
|
-
|
|
16089
|
+
const normalizedNameNs = parseName(normalizedName);
|
|
16090
|
+
|
|
16091
|
+
// determine actual type name, based on package-defined prefix
|
|
16092
|
+
var pkg = model.getPackage(normalizedNameNs.prefix);
|
|
16093
|
+
|
|
16094
|
+
return prefixedToName(normalizedNameNs, pkg);
|
|
16562
16095
|
}
|
|
16563
16096
|
|
|
16564
16097
|
function error(message) {
|
|
@@ -16847,8 +16380,9 @@
|
|
|
16847
16380
|
} else {
|
|
16848
16381
|
if (prop) {
|
|
16849
16382
|
value = coerceType(prop.type, value);
|
|
16850
|
-
} else
|
|
16851
|
-
|
|
16383
|
+
} else if (name === 'xmlns') {
|
|
16384
|
+
name = ':' + name;
|
|
16385
|
+
} else {
|
|
16852
16386
|
propNameNs = parseName(name, descriptor.ns.prefix);
|
|
16853
16387
|
|
|
16854
16388
|
// check whether attribute is defined in a well-known namespace
|
|
@@ -16881,26 +16415,27 @@
|
|
|
16881
16415
|
descriptor = getModdleDescriptor(type);
|
|
16882
16416
|
|
|
16883
16417
|
var propertyName = nameNs.name,
|
|
16884
|
-
property = descriptor.propertiesByName[propertyName]
|
|
16885
|
-
elementTypeName,
|
|
16886
|
-
elementType;
|
|
16418
|
+
property = descriptor.propertiesByName[propertyName];
|
|
16887
16419
|
|
|
16888
16420
|
// search for properties by name first
|
|
16889
16421
|
|
|
16890
16422
|
if (property && !property.isAttr) {
|
|
16891
16423
|
|
|
16892
|
-
|
|
16893
|
-
|
|
16424
|
+
const serializationType = getSerializationType(property);
|
|
16425
|
+
|
|
16426
|
+
if (serializationType) {
|
|
16427
|
+
const elementTypeName = node.attributes[serializationType];
|
|
16894
16428
|
|
|
16895
|
-
//
|
|
16429
|
+
// type is optional, if it does not exists the
|
|
16896
16430
|
// default type is assumed
|
|
16897
16431
|
if (elementTypeName) {
|
|
16898
16432
|
|
|
16433
|
+
// convert the prefix used to the mapped form, but also
|
|
16899
16434
|
// take possible type prefixes from XML
|
|
16900
|
-
// into account, i.e.: xsi:type="t{ActualType}"
|
|
16901
|
-
|
|
16435
|
+
// into account, i.e.: xsi:type="t{ActualType}",
|
|
16436
|
+
const normalizedTypeName = normalizeTypeName(elementTypeName, node.ns, model);
|
|
16902
16437
|
|
|
16903
|
-
elementType = model.getType(
|
|
16438
|
+
const elementType = model.getType(normalizedTypeName);
|
|
16904
16439
|
|
|
16905
16440
|
return assign$1({}, property, {
|
|
16906
16441
|
effectiveType: getModdleDescriptor(elementType).name
|
|
@@ -16915,8 +16450,8 @@
|
|
|
16915
16450
|
var pkg = model.getPackage(nameNs.prefix);
|
|
16916
16451
|
|
|
16917
16452
|
if (pkg) {
|
|
16918
|
-
elementTypeName = aliasToName(nameNs, pkg);
|
|
16919
|
-
elementType = model.getType(elementTypeName);
|
|
16453
|
+
const elementTypeName = aliasToName(nameNs, pkg);
|
|
16454
|
+
const elementType = model.getType(elementTypeName);
|
|
16920
16455
|
|
|
16921
16456
|
// search for collection members later
|
|
16922
16457
|
property = find(descriptor.properties, function(p) {
|
|
@@ -17338,9 +16873,12 @@
|
|
|
17338
16873
|
uriMap[p.uri] = p.prefix;
|
|
17339
16874
|
|
|
17340
16875
|
return uriMap;
|
|
17341
|
-
}, {
|
|
17342
|
-
|
|
17343
|
-
|
|
16876
|
+
}, Object.entries(DEFAULT_NS_MAP).reduce(function(map, [ prefix, url ]) {
|
|
16877
|
+
map[url] = prefix;
|
|
16878
|
+
|
|
16879
|
+
return map;
|
|
16880
|
+
}, model.config && model.config.nsMap || {}));
|
|
16881
|
+
|
|
17344
16882
|
parser
|
|
17345
16883
|
.ns(uriMap)
|
|
17346
16884
|
.on('openTag', function(obj, decodeStr, selfClosing, getContext) {
|
|
@@ -17441,75 +16979,82 @@
|
|
|
17441
16979
|
|
|
17442
16980
|
function Namespaces(parent) {
|
|
17443
16981
|
|
|
17444
|
-
|
|
17445
|
-
|
|
17446
|
-
|
|
16982
|
+
this.prefixMap = {};
|
|
16983
|
+
this.uriMap = {};
|
|
16984
|
+
this.used = {};
|
|
17447
16985
|
|
|
17448
|
-
|
|
17449
|
-
|
|
16986
|
+
this.wellknown = [];
|
|
16987
|
+
this.custom = [];
|
|
16988
|
+
this.parent = parent;
|
|
17450
16989
|
|
|
17451
|
-
|
|
16990
|
+
this.defaultPrefixMap = parent && parent.defaultPrefixMap || {};
|
|
16991
|
+
}
|
|
17452
16992
|
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
);
|
|
17457
|
-
};
|
|
16993
|
+
Namespaces.prototype.mapDefaultPrefixes = function(defaultPrefixMap) {
|
|
16994
|
+
this.defaultPrefixMap = defaultPrefixMap;
|
|
16995
|
+
};
|
|
17458
16996
|
|
|
17459
|
-
|
|
16997
|
+
Namespaces.prototype.defaultUriByPrefix = function(prefix) {
|
|
16998
|
+
return this.defaultPrefixMap[prefix];
|
|
16999
|
+
};
|
|
17460
17000
|
|
|
17461
|
-
|
|
17001
|
+
Namespaces.prototype.byUri = function(uri) {
|
|
17002
|
+
return this.uriMap[uri] || (
|
|
17003
|
+
this.parent && this.parent.byUri(uri)
|
|
17004
|
+
);
|
|
17005
|
+
};
|
|
17462
17006
|
|
|
17463
|
-
|
|
17464
|
-
wellknown.push(ns);
|
|
17465
|
-
} else {
|
|
17466
|
-
custom.push(ns);
|
|
17467
|
-
}
|
|
17007
|
+
Namespaces.prototype.add = function(ns, isWellknown) {
|
|
17468
17008
|
|
|
17469
|
-
|
|
17470
|
-
};
|
|
17009
|
+
this.uriMap[ns.uri] = ns;
|
|
17471
17010
|
|
|
17472
|
-
|
|
17473
|
-
|
|
17474
|
-
}
|
|
17011
|
+
if (isWellknown) {
|
|
17012
|
+
this.wellknown.push(ns);
|
|
17013
|
+
} else {
|
|
17014
|
+
this.custom.push(ns);
|
|
17015
|
+
}
|
|
17475
17016
|
|
|
17476
|
-
this.mapPrefix
|
|
17477
|
-
|
|
17478
|
-
};
|
|
17017
|
+
this.mapPrefix(ns.prefix, ns.uri);
|
|
17018
|
+
};
|
|
17479
17019
|
|
|
17480
|
-
|
|
17481
|
-
|
|
17482
|
-
|
|
17020
|
+
Namespaces.prototype.uriByPrefix = function(prefix) {
|
|
17021
|
+
return this.prefixMap[prefix || 'xmlns'] || (
|
|
17022
|
+
this.parent && this.parent.uriByPrefix(prefix)
|
|
17023
|
+
);
|
|
17024
|
+
};
|
|
17483
17025
|
|
|
17484
|
-
|
|
17026
|
+
Namespaces.prototype.mapPrefix = function(prefix, uri) {
|
|
17027
|
+
this.prefixMap[prefix || 'xmlns'] = uri;
|
|
17028
|
+
};
|
|
17485
17029
|
|
|
17486
|
-
|
|
17487
|
-
|
|
17030
|
+
Namespaces.prototype.getNSKey = function(ns) {
|
|
17031
|
+
return (ns.prefix !== undefined) ? (ns.uri + '|' + ns.prefix) : ns.uri;
|
|
17032
|
+
};
|
|
17488
17033
|
|
|
17489
|
-
|
|
17034
|
+
Namespaces.prototype.logUsed = function(ns) {
|
|
17490
17035
|
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
parent.logUsed(ns);
|
|
17494
|
-
}
|
|
17495
|
-
};
|
|
17036
|
+
var uri = ns.uri;
|
|
17037
|
+
var nsKey = this.getNSKey(ns);
|
|
17496
17038
|
|
|
17497
|
-
this.
|
|
17039
|
+
this.used[nsKey] = this.byUri(uri);
|
|
17498
17040
|
|
|
17499
|
-
|
|
17500
|
-
|
|
17041
|
+
// Inform parent recursively about the usage of this NS
|
|
17042
|
+
if (this.parent) {
|
|
17043
|
+
this.parent.logUsed(ns);
|
|
17044
|
+
}
|
|
17045
|
+
};
|
|
17501
17046
|
|
|
17502
|
-
|
|
17503
|
-
}
|
|
17047
|
+
Namespaces.prototype.getUsed = function(ns) {
|
|
17504
17048
|
|
|
17505
|
-
|
|
17049
|
+
var allNs = [].concat(this.wellknown, this.custom);
|
|
17506
17050
|
|
|
17507
|
-
|
|
17051
|
+
return allNs.filter(ns => {
|
|
17052
|
+
var nsKey = this.getNSKey(ns);
|
|
17508
17053
|
|
|
17509
|
-
return
|
|
17510
|
-
};
|
|
17054
|
+
return this.used[nsKey];
|
|
17055
|
+
});
|
|
17056
|
+
};
|
|
17511
17057
|
|
|
17512
|
-
}
|
|
17513
17058
|
|
|
17514
17059
|
function lower(string) {
|
|
17515
17060
|
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
@@ -17724,7 +17269,7 @@
|
|
|
17724
17269
|
var isGeneric = elementDescriptor.isGeneric;
|
|
17725
17270
|
|
|
17726
17271
|
if (isGeneric) {
|
|
17727
|
-
otherAttrs = this.
|
|
17272
|
+
otherAttrs = this.parseGenericNsAttributes(element);
|
|
17728
17273
|
} else {
|
|
17729
17274
|
otherAttrs = this.parseNsAttributes(element);
|
|
17730
17275
|
}
|
|
@@ -17738,7 +17283,9 @@
|
|
|
17738
17283
|
// compute tag name
|
|
17739
17284
|
this.tagName = this.addTagName(this.ns);
|
|
17740
17285
|
|
|
17741
|
-
if (
|
|
17286
|
+
if (isGeneric) {
|
|
17287
|
+
this.parseGenericContainments(element);
|
|
17288
|
+
} else {
|
|
17742
17289
|
properties = getSerializableProperties(element);
|
|
17743
17290
|
|
|
17744
17291
|
this.parseAttributes(filterAttributes(properties));
|
|
@@ -17801,35 +17348,29 @@
|
|
|
17801
17348
|
}
|
|
17802
17349
|
};
|
|
17803
17350
|
|
|
17804
|
-
ElementSerializer.prototype.
|
|
17805
|
-
|
|
17806
|
-
var self = this,
|
|
17807
|
-
body = this.body;
|
|
17351
|
+
ElementSerializer.prototype.parseGenericNsAttributes = function(element) {
|
|
17808
17352
|
|
|
17809
|
-
|
|
17353
|
+
return Object.entries(element).filter(
|
|
17354
|
+
([ key, value ]) => !key.startsWith('$') && this.parseNsAttribute(element, key, value)
|
|
17355
|
+
).map(
|
|
17356
|
+
([ key, value ]) => ({ name: key, value: value })
|
|
17357
|
+
);
|
|
17358
|
+
};
|
|
17810
17359
|
|
|
17811
|
-
|
|
17360
|
+
ElementSerializer.prototype.parseGenericContainments = function(element) {
|
|
17361
|
+
var body = element.$body;
|
|
17812
17362
|
|
|
17813
|
-
|
|
17363
|
+
if (body) {
|
|
17364
|
+
this.body.push(new BodySerializer().build({ type: 'String' }, body));
|
|
17365
|
+
}
|
|
17814
17366
|
|
|
17815
|
-
|
|
17816
|
-
body.push(new BodySerializer().build({ type: 'String' }, val));
|
|
17817
|
-
} else
|
|
17818
|
-
if (key === '$children') {
|
|
17819
|
-
forEach$1(val, function(child) {
|
|
17820
|
-
body.push(new ElementSerializer(self).build(child));
|
|
17821
|
-
});
|
|
17822
|
-
} else
|
|
17823
|
-
if (key.indexOf('$') !== 0) {
|
|
17824
|
-
nonNsAttr = self.parseNsAttribute(element, key, val);
|
|
17367
|
+
var children = element.$children;
|
|
17825
17368
|
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
}
|
|
17830
|
-
}
|
|
17831
|
-
|
|
17832
|
-
return attributes;
|
|
17369
|
+
if (children) {
|
|
17370
|
+
forEach$1(children, child => {
|
|
17371
|
+
this.body.push(new ElementSerializer(this).build(child));
|
|
17372
|
+
});
|
|
17373
|
+
}
|
|
17833
17374
|
};
|
|
17834
17375
|
|
|
17835
17376
|
ElementSerializer.prototype.parseNsAttribute = function(element, name, value) {
|
|
@@ -17876,7 +17417,7 @@
|
|
|
17876
17417
|
* @param {Object} element
|
|
17877
17418
|
* @return {Array<Object>}
|
|
17878
17419
|
*/
|
|
17879
|
-
ElementSerializer.prototype.parseNsAttributes = function(element
|
|
17420
|
+
ElementSerializer.prototype.parseNsAttributes = function(element) {
|
|
17880
17421
|
var self = this;
|
|
17881
17422
|
|
|
17882
17423
|
var genericAttrs = element.$attrs;
|
|
@@ -17904,21 +17445,16 @@
|
|
|
17904
17445
|
|
|
17905
17446
|
forEach$1(attributes, function(attr) {
|
|
17906
17447
|
|
|
17907
|
-
// do not serialize xsi:type attribute
|
|
17908
|
-
// it is set manually based on the actual implementation type
|
|
17909
|
-
if (attr.name === XSI_TYPE) {
|
|
17910
|
-
return;
|
|
17911
|
-
}
|
|
17912
|
-
|
|
17913
17448
|
try {
|
|
17914
17449
|
self.addAttribute(self.nsAttributeName(attr.name), attr.value);
|
|
17915
17450
|
} catch (e) {
|
|
17916
|
-
/* global console */
|
|
17917
17451
|
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17452
|
+
// eslint-disable-next-line no-undef
|
|
17453
|
+
typeof console !== 'undefined' && console.warn(
|
|
17454
|
+
`missing namespace information for <${
|
|
17455
|
+
attr.name
|
|
17456
|
+
}=${ attr.value }> on`, element, e
|
|
17457
|
+
);
|
|
17922
17458
|
}
|
|
17923
17459
|
});
|
|
17924
17460
|
};
|
|
@@ -17940,13 +17476,11 @@
|
|
|
17940
17476
|
|
|
17941
17477
|
if (p.isBody) {
|
|
17942
17478
|
body.push(new BodySerializer().build(p, value[0]));
|
|
17943
|
-
} else
|
|
17944
|
-
if (isSimple(p.type)) {
|
|
17479
|
+
} else if (isSimple(p.type)) {
|
|
17945
17480
|
forEach$1(value, function(v) {
|
|
17946
17481
|
body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
|
|
17947
17482
|
});
|
|
17948
|
-
} else
|
|
17949
|
-
if (isReference) {
|
|
17483
|
+
} else if (isReference) {
|
|
17950
17484
|
forEach$1(value, function(v) {
|
|
17951
17485
|
body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
|
|
17952
17486
|
});
|
|
@@ -17954,17 +17488,17 @@
|
|
|
17954
17488
|
|
|
17955
17489
|
// allow serialization via type
|
|
17956
17490
|
// rather than element name
|
|
17957
|
-
var
|
|
17958
|
-
asProperty = serializeAsProperty(p);
|
|
17491
|
+
var serialization = getSerialization(p);
|
|
17959
17492
|
|
|
17960
17493
|
forEach$1(value, function(v) {
|
|
17961
17494
|
var serializer;
|
|
17962
17495
|
|
|
17963
|
-
if (
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
|
|
17496
|
+
if (serialization) {
|
|
17497
|
+
if (serialization === SERIALIZE_PROPERTY) {
|
|
17498
|
+
serializer = new ElementSerializer(self, p);
|
|
17499
|
+
} else {
|
|
17500
|
+
serializer = new TypeSerializer(self, p, serialization);
|
|
17501
|
+
}
|
|
17968
17502
|
} else {
|
|
17969
17503
|
serializer = new ElementSerializer(self);
|
|
17970
17504
|
}
|
|
@@ -18012,9 +17546,7 @@
|
|
|
18012
17546
|
};
|
|
18013
17547
|
|
|
18014
17548
|
ElementSerializer.prototype.logNamespaceUsed = function(ns, local) {
|
|
18015
|
-
var
|
|
18016
|
-
model = element.$model,
|
|
18017
|
-
namespaces = this.getNamespaces(local);
|
|
17549
|
+
var namespaces = this.getNamespaces(local);
|
|
18018
17550
|
|
|
18019
17551
|
// ns may be
|
|
18020
17552
|
//
|
|
@@ -18032,7 +17564,7 @@
|
|
|
18032
17564
|
return { localName: ns.localName };
|
|
18033
17565
|
}
|
|
18034
17566
|
|
|
18035
|
-
wellknownUri =
|
|
17567
|
+
wellknownUri = namespaces.defaultUriByPrefix(prefix);
|
|
18036
17568
|
|
|
18037
17569
|
uri = uri || wellknownUri || namespaces.uriByPrefix(prefix);
|
|
18038
17570
|
|
|
@@ -18042,6 +17574,11 @@
|
|
|
18042
17574
|
|
|
18043
17575
|
ns = namespaces.byUri(uri);
|
|
18044
17576
|
|
|
17577
|
+
// register new default prefix <xmlns> in local scope
|
|
17578
|
+
if (!ns && !prefix) {
|
|
17579
|
+
ns = this.logNamespace({ uri }, wellknownUri === uri, true);
|
|
17580
|
+
}
|
|
17581
|
+
|
|
18045
17582
|
if (!ns) {
|
|
18046
17583
|
newPrefix = prefix;
|
|
18047
17584
|
idx = 1;
|
|
@@ -18073,8 +17610,7 @@
|
|
|
18073
17610
|
|
|
18074
17611
|
if (!p.isMany) {
|
|
18075
17612
|
value = value.id;
|
|
18076
|
-
}
|
|
18077
|
-
else {
|
|
17613
|
+
} else {
|
|
18078
17614
|
var values = [];
|
|
18079
17615
|
forEach$1(value, function(v) {
|
|
18080
17616
|
values.push(v.id);
|
|
@@ -18178,20 +17714,25 @@
|
|
|
18178
17714
|
/**
|
|
18179
17715
|
* A serializer for types that handles serialization of data types
|
|
18180
17716
|
*/
|
|
18181
|
-
function TypeSerializer(parent, propertyDescriptor) {
|
|
17717
|
+
function TypeSerializer(parent, propertyDescriptor, serialization) {
|
|
18182
17718
|
ElementSerializer.call(this, parent, propertyDescriptor);
|
|
17719
|
+
|
|
17720
|
+
this.serialization = serialization;
|
|
18183
17721
|
}
|
|
18184
17722
|
|
|
18185
17723
|
inherits(TypeSerializer, ElementSerializer);
|
|
18186
17724
|
|
|
18187
17725
|
TypeSerializer.prototype.parseNsAttributes = function(element) {
|
|
18188
17726
|
|
|
18189
|
-
// extracted attributes
|
|
18190
|
-
|
|
17727
|
+
// extracted attributes with serialization attribute
|
|
17728
|
+
// <type=typeName> stripped; it may be later
|
|
17729
|
+
var attributes = ElementSerializer.prototype.parseNsAttributes.call(this, element).filter(
|
|
17730
|
+
attr => attr.name !== this.serialization
|
|
17731
|
+
);
|
|
18191
17732
|
|
|
18192
17733
|
var descriptor = element.$descriptor;
|
|
18193
17734
|
|
|
18194
|
-
// only serialize
|
|
17735
|
+
// only serialize <type=typeName> if necessary
|
|
18195
17736
|
if (descriptor.name === this.propertyDescriptor.type) {
|
|
18196
17737
|
return attributes;
|
|
18197
17738
|
}
|
|
@@ -18206,7 +17747,7 @@
|
|
|
18206
17747
|
typePrefix = (pkg.xml && pkg.xml.typePrefix) || '';
|
|
18207
17748
|
|
|
18208
17749
|
this.addAttribute(
|
|
18209
|
-
this.nsAttributeName(
|
|
17750
|
+
this.nsAttributeName(this.serialization),
|
|
18210
17751
|
(typeNs.prefix ? typeNs.prefix + ':' : '') + typePrefix + descriptor.ns.localName
|
|
18211
17752
|
);
|
|
18212
17753
|
|
|
@@ -18279,7 +17820,13 @@
|
|
|
18279
17820
|
formatingWriter.append(XML_PREAMBLE);
|
|
18280
17821
|
}
|
|
18281
17822
|
|
|
18282
|
-
new ElementSerializer()
|
|
17823
|
+
var serializer = new ElementSerializer();
|
|
17824
|
+
|
|
17825
|
+
var model = tree.$model;
|
|
17826
|
+
|
|
17827
|
+
serializer.getNamespaces().mapDefaultPrefixes(getDefaultPrefixMappings(model));
|
|
17828
|
+
|
|
17829
|
+
serializer.build(tree).serializeTo(formatingWriter);
|
|
18283
17830
|
|
|
18284
17831
|
if (!writer) {
|
|
18285
17832
|
return internalWriter.value;
|
|
@@ -18291,6 +17838,39 @@
|
|
|
18291
17838
|
};
|
|
18292
17839
|
}
|
|
18293
17840
|
|
|
17841
|
+
|
|
17842
|
+
// helpers ///////////
|
|
17843
|
+
|
|
17844
|
+
/**
|
|
17845
|
+
* @param {Moddle} model
|
|
17846
|
+
*
|
|
17847
|
+
* @return { Record<string, string> } map from prefix to URI
|
|
17848
|
+
*/
|
|
17849
|
+
function getDefaultPrefixMappings(model) {
|
|
17850
|
+
|
|
17851
|
+
const nsMap = model.config && model.config.nsMap || {};
|
|
17852
|
+
|
|
17853
|
+
const prefixMap = {};
|
|
17854
|
+
|
|
17855
|
+
// { prefix -> uri }
|
|
17856
|
+
for (const prefix in DEFAULT_NS_MAP) {
|
|
17857
|
+
prefixMap[prefix] = DEFAULT_NS_MAP[prefix];
|
|
17858
|
+
}
|
|
17859
|
+
|
|
17860
|
+
// { uri -> prefix }
|
|
17861
|
+
for (const uri in nsMap) {
|
|
17862
|
+
const prefix = nsMap[uri];
|
|
17863
|
+
|
|
17864
|
+
prefixMap[prefix] = uri;
|
|
17865
|
+
}
|
|
17866
|
+
|
|
17867
|
+
for (const pkg of model.getPackages()) {
|
|
17868
|
+
prefixMap[pkg.prefix] = pkg.uri;
|
|
17869
|
+
}
|
|
17870
|
+
|
|
17871
|
+
return prefixMap;
|
|
17872
|
+
}
|
|
17873
|
+
|
|
18294
17874
|
/**
|
|
18295
17875
|
* A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
|
|
18296
17876
|
*
|
|
@@ -22017,7 +21597,7 @@
|
|
|
22017
21597
|
associations: associations$6
|
|
22018
21598
|
};
|
|
22019
21599
|
|
|
22020
|
-
|
|
21600
|
+
const packages = {
|
|
22021
21601
|
bpmn: BpmnPackage,
|
|
22022
21602
|
bpmndi: BpmnDiPackage,
|
|
22023
21603
|
dc: DcPackage,
|
|
@@ -22026,8 +21606,8 @@
|
|
|
22026
21606
|
color: BpmnInColorPackage
|
|
22027
21607
|
};
|
|
22028
21608
|
|
|
22029
|
-
function
|
|
22030
|
-
|
|
21609
|
+
function SimpleBpmnModdle(additionalPackages, options) {
|
|
21610
|
+
const pks = assign$1({}, packages, additionalPackages);
|
|
22031
21611
|
|
|
22032
21612
|
return new BpmnModdle(pks, options);
|
|
22033
21613
|
}
|
|
@@ -23518,7 +23098,7 @@
|
|
|
23518
23098
|
BaseViewer.prototype._createModdle = function(options) {
|
|
23519
23099
|
const moddleOptions = assign$1({}, this._moddleExtensions, options.moddleExtensions);
|
|
23520
23100
|
|
|
23521
|
-
return new
|
|
23101
|
+
return new SimpleBpmnModdle(moddleOptions);
|
|
23522
23102
|
};
|
|
23523
23103
|
|
|
23524
23104
|
BaseViewer.prototype._modules = [];
|
|
@@ -23680,7 +23260,6 @@
|
|
|
23680
23260
|
Viewer.prototype._modules = [
|
|
23681
23261
|
CoreModule$1,
|
|
23682
23262
|
DrilldownModdule,
|
|
23683
|
-
OutlineModule,
|
|
23684
23263
|
OverlaysModule,
|
|
23685
23264
|
SelectionModule,
|
|
23686
23265
|
TranslateModule
|
|
@@ -23778,10 +23357,11 @@
|
|
|
23778
23357
|
var KEYDOWN_EVENT = 'keyboard.keydown',
|
|
23779
23358
|
KEYUP_EVENT = 'keyboard.keyup';
|
|
23780
23359
|
|
|
23781
|
-
var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
|
|
23782
|
-
|
|
23783
23360
|
var DEFAULT_PRIORITY = 1000;
|
|
23784
23361
|
|
|
23362
|
+
var compatMessage = 'Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661';
|
|
23363
|
+
|
|
23364
|
+
|
|
23785
23365
|
/**
|
|
23786
23366
|
* A keyboard abstraction that may be activated and
|
|
23787
23367
|
* deactivated by users at will, consuming global key events
|
|
@@ -23800,8 +23380,8 @@
|
|
|
23800
23380
|
*
|
|
23801
23381
|
* All events contain one field which is node.
|
|
23802
23382
|
*
|
|
23803
|
-
*
|
|
23804
|
-
* `keyboard.
|
|
23383
|
+
* Specify the initial keyboard binding state via the
|
|
23384
|
+
* `keyboard.bind=true|false` configuration option.
|
|
23805
23385
|
*
|
|
23806
23386
|
* @param {Object} config
|
|
23807
23387
|
* @param {EventTarget} [config.bindTo]
|
|
@@ -23810,7 +23390,8 @@
|
|
|
23810
23390
|
function Keyboard(config, eventBus) {
|
|
23811
23391
|
var self = this;
|
|
23812
23392
|
|
|
23813
|
-
this._config = config || {};
|
|
23393
|
+
this._config = config = config || {};
|
|
23394
|
+
|
|
23814
23395
|
this._eventBus = eventBus;
|
|
23815
23396
|
|
|
23816
23397
|
this._keydownHandler = this._keydownHandler.bind(this);
|
|
@@ -23823,19 +23404,22 @@
|
|
|
23823
23404
|
self.unbind();
|
|
23824
23405
|
});
|
|
23825
23406
|
|
|
23826
|
-
|
|
23827
|
-
|
|
23828
|
-
}
|
|
23407
|
+
if (config.bindTo) {
|
|
23408
|
+
console.error('unsupported configuration <keyboard.bindTo>', new Error(compatMessage));
|
|
23409
|
+
}
|
|
23410
|
+
|
|
23411
|
+
var bind = config && config.bind !== false;
|
|
23829
23412
|
|
|
23830
|
-
eventBus.on('
|
|
23831
|
-
|
|
23832
|
-
|
|
23413
|
+
eventBus.on('canvas.init', function(event) {
|
|
23414
|
+
self._target = event.svg;
|
|
23415
|
+
|
|
23416
|
+
if (bind) {
|
|
23417
|
+
self.bind();
|
|
23833
23418
|
}
|
|
23834
|
-
});
|
|
23835
23419
|
|
|
23836
|
-
|
|
23837
|
-
self.unbind();
|
|
23420
|
+
self._fire('init');
|
|
23838
23421
|
});
|
|
23422
|
+
|
|
23839
23423
|
}
|
|
23840
23424
|
|
|
23841
23425
|
Keyboard.$inject = [
|
|
@@ -23870,34 +23454,7 @@
|
|
|
23870
23454
|
};
|
|
23871
23455
|
|
|
23872
23456
|
Keyboard.prototype._isEventIgnored = function(event) {
|
|
23873
|
-
|
|
23874
|
-
return true;
|
|
23875
|
-
}
|
|
23876
|
-
|
|
23877
|
-
return (
|
|
23878
|
-
isInput(event.target) || (
|
|
23879
|
-
isButton(event.target) && isKey([ ' ', 'Enter' ], event)
|
|
23880
|
-
)
|
|
23881
|
-
) && this._isModifiedKeyIgnored(event);
|
|
23882
|
-
};
|
|
23883
|
-
|
|
23884
|
-
Keyboard.prototype._isModifiedKeyIgnored = function(event) {
|
|
23885
|
-
if (!isCmd(event)) {
|
|
23886
|
-
return true;
|
|
23887
|
-
}
|
|
23888
|
-
|
|
23889
|
-
var allowedModifiers = this._getAllowedModifiers(event.target);
|
|
23890
|
-
return allowedModifiers.indexOf(event.key) === -1;
|
|
23891
|
-
};
|
|
23892
|
-
|
|
23893
|
-
Keyboard.prototype._getAllowedModifiers = function(element) {
|
|
23894
|
-
var modifierContainer = closest(element, '[' + HANDLE_MODIFIER_ATTRIBUTE + ']', true);
|
|
23895
|
-
|
|
23896
|
-
if (!modifierContainer || (this._node && !this._node.contains(modifierContainer))) {
|
|
23897
|
-
return [];
|
|
23898
|
-
}
|
|
23899
|
-
|
|
23900
|
-
return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
|
|
23457
|
+
return false;
|
|
23901
23458
|
};
|
|
23902
23459
|
|
|
23903
23460
|
/**
|
|
@@ -23907,10 +23464,14 @@
|
|
|
23907
23464
|
*/
|
|
23908
23465
|
Keyboard.prototype.bind = function(node) {
|
|
23909
23466
|
|
|
23467
|
+
if (node) {
|
|
23468
|
+
console.error('unsupported argument <node>', new Error(compatMessage));
|
|
23469
|
+
}
|
|
23470
|
+
|
|
23910
23471
|
// make sure that the keyboard is only bound once to the DOM
|
|
23911
23472
|
this.unbind();
|
|
23912
23473
|
|
|
23913
|
-
this._node =
|
|
23474
|
+
node = this._node = this._target;
|
|
23914
23475
|
|
|
23915
23476
|
// bind key events
|
|
23916
23477
|
event.bind(node, 'keydown', this._keydownHandler);
|
|
@@ -23981,18 +23542,6 @@
|
|
|
23981
23542
|
Keyboard.prototype.isShift = isShift;
|
|
23982
23543
|
Keyboard.prototype.isKey = isKey;
|
|
23983
23544
|
|
|
23984
|
-
|
|
23985
|
-
|
|
23986
|
-
// helpers ///////
|
|
23987
|
-
|
|
23988
|
-
function isInput(target) {
|
|
23989
|
-
return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
|
|
23990
|
-
}
|
|
23991
|
-
|
|
23992
|
-
function isButton(target) {
|
|
23993
|
-
return target && matches(target, 'button, input[type=submit], input[type=button], a[href], [aria-role=button]');
|
|
23994
|
-
}
|
|
23995
|
-
|
|
23996
23545
|
var LOW_PRIORITY = 500;
|
|
23997
23546
|
|
|
23998
23547
|
|
|
@@ -25090,9 +24639,7 @@
|
|
|
25090
24639
|
],
|
|
25091
24640
|
meta: {
|
|
25092
24641
|
allowedIn: [
|
|
25093
|
-
"
|
|
25094
|
-
"bpmn:ReceiveTask",
|
|
25095
|
-
"bpmn:SubProcess"
|
|
24642
|
+
"bpmn:MultiInstanceLoopCharacteristics"
|
|
25096
24643
|
]
|
|
25097
24644
|
},
|
|
25098
24645
|
properties: [
|