bpmn-js 13.0.3 → 13.0.5
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/bpmn-modeler.development.js +475 -272
- package/dist/bpmn-modeler.production.min.js +34 -34
- package/dist/bpmn-navigated-viewer.development.js +226 -55
- package/dist/bpmn-navigated-viewer.production.min.js +2 -2
- package/dist/bpmn-viewer.development.js +147 -47
- package/dist/bpmn-viewer.production.min.js +2 -2
- package/lib/draw/BpmnRenderUtil.d.ts +2 -2
- package/lib/draw/BpmnRenderUtil.js +6 -6
- package/lib/draw/BpmnRenderer.d.ts +7 -5
- package/lib/draw/BpmnRenderer.js +5 -5
- package/lib/features/align-elements/dist/align-bottom-tool.svg +1 -0
- package/lib/features/align-elements/dist/align-horizontal-center-tool.svg +1 -0
- package/lib/features/align-elements/dist/align-left-tool.svg +1 -0
- package/lib/features/align-elements/dist/align-right-tool.svg +1 -0
- package/lib/features/align-elements/dist/align-tool.svg +1 -0
- package/lib/features/align-elements/dist/align-top-tool.svg +1 -0
- package/lib/features/align-elements/dist/align-vertical-center-tool.svg +1 -0
- package/lib/features/palette/dist/create.svg +1 -0
- package/lib/util/LabelUtil.d.ts +4 -5
- package/lib/util/LabelUtil.js +12 -7
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-navigated-viewer v13.0.
|
|
2
|
+
* bpmn-js - bpmn-navigated-viewer v13.0.5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2014-present, camunda Services GmbH
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Source Code: https://github.com/bpmn-io/bpmn-js
|
|
10
10
|
*
|
|
11
|
-
* Date: 2023-
|
|
11
|
+
* Date: 2023-05-09
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -889,11 +889,11 @@
|
|
|
889
889
|
}, size);
|
|
890
890
|
}
|
|
891
891
|
|
|
892
|
-
|
|
893
892
|
/**
|
|
894
|
-
* @
|
|
893
|
+
* @param {ModdleElement} semantic
|
|
894
|
+
*
|
|
895
|
+
* @returns {string}
|
|
895
896
|
*/
|
|
896
|
-
|
|
897
897
|
function getLabelAttr(semantic) {
|
|
898
898
|
if (
|
|
899
899
|
is$1(semantic, 'bpmn:FlowElement') ||
|
|
@@ -916,6 +916,11 @@
|
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
918
|
|
|
919
|
+
/**
|
|
920
|
+
* @param {ModdleElement} semantic
|
|
921
|
+
*
|
|
922
|
+
* @returns {string}
|
|
923
|
+
*/
|
|
919
924
|
function getCategoryValue(semantic) {
|
|
920
925
|
var categoryValueRef = semantic['categoryValueRef'];
|
|
921
926
|
|
|
@@ -928,9 +933,9 @@
|
|
|
928
933
|
}
|
|
929
934
|
|
|
930
935
|
/**
|
|
931
|
-
* @param {
|
|
936
|
+
* @param {Element} element
|
|
932
937
|
*
|
|
933
|
-
* @return {string}
|
|
938
|
+
* @return {string}
|
|
934
939
|
*/
|
|
935
940
|
function getLabel(element) {
|
|
936
941
|
var semantic = element.businessObject,
|
|
@@ -1632,7 +1637,7 @@
|
|
|
1632
1637
|
*/
|
|
1633
1638
|
|
|
1634
1639
|
/**
|
|
1635
|
-
* @param {Component[]} elements
|
|
1640
|
+
* @param {Component[] | Component[][]} elements
|
|
1636
1641
|
*
|
|
1637
1642
|
* @return {string}
|
|
1638
1643
|
*/
|
|
@@ -1669,6 +1674,11 @@
|
|
|
1669
1674
|
return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
|
|
1670
1675
|
}
|
|
1671
1676
|
|
|
1677
|
+
/**
|
|
1678
|
+
* @param {Point[]} waypoints
|
|
1679
|
+
* @param {number} [cornerRadius]
|
|
1680
|
+
* @return {Component[][]}
|
|
1681
|
+
*/
|
|
1672
1682
|
function drawPath(waypoints, cornerRadius) {
|
|
1673
1683
|
const pointCount = waypoints.length;
|
|
1674
1684
|
|
|
@@ -1732,7 +1742,7 @@
|
|
|
1732
1742
|
|
|
1733
1743
|
/**
|
|
1734
1744
|
* @param {Point[]} points
|
|
1735
|
-
* @param {
|
|
1745
|
+
* @param {number|Object} [attrs]
|
|
1736
1746
|
* @param {number} [radius]
|
|
1737
1747
|
*
|
|
1738
1748
|
* @return {SVGElement}
|
|
@@ -1820,7 +1830,7 @@
|
|
|
1820
1830
|
// color access //////////////////////
|
|
1821
1831
|
|
|
1822
1832
|
/**
|
|
1823
|
-
* @param {
|
|
1833
|
+
* @param {Element} element
|
|
1824
1834
|
* @param {string} [defaultColor]
|
|
1825
1835
|
*
|
|
1826
1836
|
* @return {string}
|
|
@@ -1832,7 +1842,7 @@
|
|
|
1832
1842
|
}
|
|
1833
1843
|
|
|
1834
1844
|
/**
|
|
1835
|
-
* @param {
|
|
1845
|
+
* @param {Element} element
|
|
1836
1846
|
* @param {string} [defaultColor]
|
|
1837
1847
|
*
|
|
1838
1848
|
* @return {string}
|
|
@@ -1844,9 +1854,9 @@
|
|
|
1844
1854
|
}
|
|
1845
1855
|
|
|
1846
1856
|
/**
|
|
1847
|
-
* @param {
|
|
1848
|
-
* @param {string} defaultColor
|
|
1849
|
-
* @param {string} defaultStrokeColor
|
|
1857
|
+
* @param {Element} element
|
|
1858
|
+
* @param {string} [defaultColor]
|
|
1859
|
+
* @param {string} [defaultStrokeColor]
|
|
1850
1860
|
*
|
|
1851
1861
|
* @return {string}
|
|
1852
1862
|
*/
|
|
@@ -2525,8 +2535,8 @@
|
|
|
2525
2535
|
* @param {SVGElement} gfx
|
|
2526
2536
|
* @param {number} x
|
|
2527
2537
|
* @param {number} y
|
|
2528
|
-
* @param {number} angle
|
|
2529
|
-
* @param {number} amount
|
|
2538
|
+
* @param {number} [angle]
|
|
2539
|
+
* @param {number} [amount]
|
|
2530
2540
|
*/
|
|
2531
2541
|
function transform(gfx, x, y, angle, amount) {
|
|
2532
2542
|
var translate = createTransform();
|
|
@@ -2748,7 +2758,7 @@
|
|
|
2748
2758
|
*/
|
|
2749
2759
|
|
|
2750
2760
|
/**
|
|
2751
|
-
* @typedef { import('../model').
|
|
2761
|
+
* @typedef { import('../model/Types').Element } Element
|
|
2752
2762
|
*/
|
|
2753
2763
|
|
|
2754
2764
|
/**
|
|
@@ -4589,7 +4599,7 @@
|
|
|
4589
4599
|
|
|
4590
4600
|
|
|
4591
4601
|
/**
|
|
4592
|
-
* @param {
|
|
4602
|
+
* @param {Element} element
|
|
4593
4603
|
*
|
|
4594
4604
|
* @return {boolean}
|
|
4595
4605
|
*/
|
|
@@ -4601,7 +4611,7 @@
|
|
|
4601
4611
|
* Draw shape into parentGfx.
|
|
4602
4612
|
*
|
|
4603
4613
|
* @param {SVGElement} parentGfx
|
|
4604
|
-
* @param {
|
|
4614
|
+
* @param {Element} element
|
|
4605
4615
|
*
|
|
4606
4616
|
* @return {SVGElement} mainGfx
|
|
4607
4617
|
*/
|
|
@@ -4617,7 +4627,7 @@
|
|
|
4617
4627
|
* Draw connection into parentGfx.
|
|
4618
4628
|
*
|
|
4619
4629
|
* @param {SVGElement} parentGfx
|
|
4620
|
-
* @param {
|
|
4630
|
+
* @param {Element} element
|
|
4621
4631
|
*
|
|
4622
4632
|
* @return {SVGElement} mainGfx
|
|
4623
4633
|
*/
|
|
@@ -4632,7 +4642,7 @@
|
|
|
4632
4642
|
/**
|
|
4633
4643
|
* Get shape path.
|
|
4634
4644
|
*
|
|
4635
|
-
* @param {
|
|
4645
|
+
* @param {Element} element
|
|
4636
4646
|
*
|
|
4637
4647
|
* @return {string} path
|
|
4638
4648
|
*/
|
|
@@ -4674,7 +4684,7 @@
|
|
|
4674
4684
|
*
|
|
4675
4685
|
* @typedef { Partial<{
|
|
4676
4686
|
* align: AlignmentConfig;
|
|
4677
|
-
* style: Record<string,
|
|
4687
|
+
* style: Record<string, number | string>;
|
|
4678
4688
|
* padding: PaddingConfig;
|
|
4679
4689
|
* }> } BaseTextConfig
|
|
4680
4690
|
*
|
|
@@ -4781,6 +4791,8 @@
|
|
|
4781
4791
|
* Alters the lines passed.
|
|
4782
4792
|
*
|
|
4783
4793
|
* @param {string[]} lines
|
|
4794
|
+
* @param {number} maxWidth
|
|
4795
|
+
* @param {SVGTextElement} fakeText
|
|
4784
4796
|
*
|
|
4785
4797
|
* @return {LineDescriptor} the line descriptor
|
|
4786
4798
|
*/
|
|
@@ -5751,6 +5763,22 @@
|
|
|
5751
5763
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5752
5764
|
}
|
|
5753
5765
|
|
|
5766
|
+
/**
|
|
5767
|
+
* Checks whether a value is an instance of Connection.
|
|
5768
|
+
*
|
|
5769
|
+
* @param {any} value
|
|
5770
|
+
*
|
|
5771
|
+
* @return {boolean}
|
|
5772
|
+
*/
|
|
5773
|
+
function isConnection(value) {
|
|
5774
|
+
return isObject(value) && has$1(value, 'waypoints');
|
|
5775
|
+
}
|
|
5776
|
+
|
|
5777
|
+
/**
|
|
5778
|
+
* @param {Point} point
|
|
5779
|
+
*
|
|
5780
|
+
* @returns {Point}
|
|
5781
|
+
*/
|
|
5754
5782
|
function roundPoint(point) {
|
|
5755
5783
|
|
|
5756
5784
|
return {
|
|
@@ -5889,10 +5917,6 @@
|
|
|
5889
5917
|
return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
|
|
5890
5918
|
}
|
|
5891
5919
|
|
|
5892
|
-
function isConnection(element) {
|
|
5893
|
-
return !!element.waypoints;
|
|
5894
|
-
}
|
|
5895
|
-
|
|
5896
5920
|
function elementToString(e) {
|
|
5897
5921
|
if (!e) {
|
|
5898
5922
|
return '<null>';
|
|
@@ -6267,11 +6291,24 @@
|
|
|
6267
6291
|
]
|
|
6268
6292
|
};
|
|
6269
6293
|
|
|
6294
|
+
/**
|
|
6295
|
+
* @typedef {import('../util/Types').Point} Point
|
|
6296
|
+
*/
|
|
6297
|
+
|
|
6298
|
+
/**
|
|
6299
|
+
* @param {import('../core/EventBus').Event} event
|
|
6300
|
+
*
|
|
6301
|
+
* @return {Event}
|
|
6302
|
+
*/
|
|
6270
6303
|
function getOriginal(event) {
|
|
6271
6304
|
return event.originalEvent || event.srcEvent;
|
|
6272
6305
|
}
|
|
6273
6306
|
|
|
6274
|
-
|
|
6307
|
+
/**
|
|
6308
|
+
* @param {Event} event
|
|
6309
|
+
*
|
|
6310
|
+
* @return {Point|null}
|
|
6311
|
+
*/
|
|
6275
6312
|
function toPoint(event) {
|
|
6276
6313
|
|
|
6277
6314
|
if (event.pointers && event.pointers.length) {
|
|
@@ -6292,22 +6329,43 @@
|
|
|
6292
6329
|
return (/mac/i).test(navigator.platform);
|
|
6293
6330
|
}
|
|
6294
6331
|
|
|
6332
|
+
/**
|
|
6333
|
+
* @param {MouseEvent} event
|
|
6334
|
+
* @param {string} button
|
|
6335
|
+
*
|
|
6336
|
+
* @return {boolean}
|
|
6337
|
+
*/
|
|
6295
6338
|
function isButton(event, button) {
|
|
6296
6339
|
return (getOriginal(event) || event).button === button;
|
|
6297
6340
|
}
|
|
6298
6341
|
|
|
6342
|
+
/**
|
|
6343
|
+
* @param {MouseEvent} event
|
|
6344
|
+
*
|
|
6345
|
+
* @return {boolean}
|
|
6346
|
+
*/
|
|
6299
6347
|
function isPrimaryButton(event) {
|
|
6300
6348
|
|
|
6301
6349
|
// button === 0 -> left áka primary mouse button
|
|
6302
6350
|
return isButton(event, 0);
|
|
6303
6351
|
}
|
|
6304
6352
|
|
|
6353
|
+
/**
|
|
6354
|
+
* @param {MouseEvent} event
|
|
6355
|
+
*
|
|
6356
|
+
* @return {boolean}
|
|
6357
|
+
*/
|
|
6305
6358
|
function isAuxiliaryButton(event) {
|
|
6306
6359
|
|
|
6307
6360
|
// button === 1 -> auxiliary áka wheel button
|
|
6308
6361
|
return isButton(event, 1);
|
|
6309
6362
|
}
|
|
6310
6363
|
|
|
6364
|
+
/**
|
|
6365
|
+
* @param {MouseEvent} event
|
|
6366
|
+
*
|
|
6367
|
+
* @return {boolean}
|
|
6368
|
+
*/
|
|
6311
6369
|
function hasPrimaryModifier(event) {
|
|
6312
6370
|
var originalEvent = getOriginal(event) || event;
|
|
6313
6371
|
|
|
@@ -6323,7 +6381,11 @@
|
|
|
6323
6381
|
}
|
|
6324
6382
|
}
|
|
6325
6383
|
|
|
6326
|
-
|
|
6384
|
+
/**
|
|
6385
|
+
* @param {MouseEvent} event
|
|
6386
|
+
*
|
|
6387
|
+
* @return {boolean}
|
|
6388
|
+
*/
|
|
6327
6389
|
function hasSecondaryModifier(event) {
|
|
6328
6390
|
var originalEvent = getOriginal(event) || event;
|
|
6329
6391
|
|
|
@@ -6888,7 +6950,13 @@
|
|
|
6888
6950
|
};
|
|
6889
6951
|
}
|
|
6890
6952
|
|
|
6891
|
-
|
|
6953
|
+
/**
|
|
6954
|
+
* Get the element's type
|
|
6955
|
+
*
|
|
6956
|
+
* @param {Element} element
|
|
6957
|
+
*
|
|
6958
|
+
* @return {'connection' | 'shape' | 'root'}
|
|
6959
|
+
*/
|
|
6892
6960
|
function getType(element) {
|
|
6893
6961
|
|
|
6894
6962
|
if ('waypoints' in element) {
|
|
@@ -6902,8 +6970,12 @@
|
|
|
6902
6970
|
return 'root';
|
|
6903
6971
|
}
|
|
6904
6972
|
|
|
6973
|
+
/**
|
|
6974
|
+
* @param {Element} element
|
|
6975
|
+
*
|
|
6976
|
+
* @return {boolean}
|
|
6977
|
+
*/
|
|
6905
6978
|
function isFrameElement(element) {
|
|
6906
|
-
|
|
6907
6979
|
return !!(element && element.isFrame);
|
|
6908
6980
|
}
|
|
6909
6981
|
|
|
@@ -7418,7 +7490,7 @@
|
|
|
7418
7490
|
*
|
|
7419
7491
|
* The ids can be customized via a given prefix and contain a random value to avoid collisions.
|
|
7420
7492
|
*
|
|
7421
|
-
* @param {string} prefix a prefix to prepend to generated ids (for better readability)
|
|
7493
|
+
* @param {string} [prefix] a prefix to prepend to generated ids (for better readability)
|
|
7422
7494
|
*/
|
|
7423
7495
|
function IdGenerator(prefix) {
|
|
7424
7496
|
|
|
@@ -8526,6 +8598,7 @@
|
|
|
8526
8598
|
|
|
8527
8599
|
/**
|
|
8528
8600
|
* @param {string} str
|
|
8601
|
+
*
|
|
8529
8602
|
* @return {string}
|
|
8530
8603
|
*/
|
|
8531
8604
|
|
|
@@ -8537,6 +8610,11 @@
|
|
|
8537
8610
|
'\'': '''
|
|
8538
8611
|
};
|
|
8539
8612
|
|
|
8613
|
+
/**
|
|
8614
|
+
* @param {string} str
|
|
8615
|
+
*
|
|
8616
|
+
* @return {string}
|
|
8617
|
+
*/
|
|
8540
8618
|
function escapeHTML(str) {
|
|
8541
8619
|
str = '' + str;
|
|
8542
8620
|
|
|
@@ -9895,13 +9973,14 @@
|
|
|
9895
9973
|
var self = this;
|
|
9896
9974
|
|
|
9897
9975
|
/**
|
|
9898
|
-
* Builds a style definition from a className, a list of traits and an object
|
|
9976
|
+
* Builds a style definition from a className, a list of traits and an object
|
|
9977
|
+
* of additional attributes.
|
|
9899
9978
|
*
|
|
9900
9979
|
* @param {string} className
|
|
9901
|
-
* @param {string[]} traits
|
|
9902
|
-
* @param {Object} additionalAttrs
|
|
9980
|
+
* @param {string[]} [traits]
|
|
9981
|
+
* @param {Object} [additionalAttrs]
|
|
9903
9982
|
*
|
|
9904
|
-
* @return {Object} the style
|
|
9983
|
+
* @return {Object} the style definition
|
|
9905
9984
|
*/
|
|
9906
9985
|
this.cls = function(className, traits, additionalAttrs) {
|
|
9907
9986
|
var attrs = this.style(traits, additionalAttrs);
|
|
@@ -9910,12 +9989,13 @@
|
|
|
9910
9989
|
};
|
|
9911
9990
|
|
|
9912
9991
|
/**
|
|
9913
|
-
* Builds a style definition from a list of traits and an object of additional
|
|
9992
|
+
* Builds a style definition from a list of traits and an object of additional
|
|
9993
|
+
* attributes.
|
|
9914
9994
|
*
|
|
9915
|
-
* @param {string[]} traits
|
|
9995
|
+
* @param {string[]} [traits]
|
|
9916
9996
|
* @param {Object} additionalAttrs
|
|
9917
9997
|
*
|
|
9918
|
-
* @return {Object} the style
|
|
9998
|
+
* @return {Object} the style definition
|
|
9919
9999
|
*/
|
|
9920
10000
|
this.style = function(traits, additionalAttrs) {
|
|
9921
10001
|
|
|
@@ -9931,6 +10011,17 @@
|
|
|
9931
10011
|
return additionalAttrs ? assign$1(attrs, additionalAttrs) : attrs;
|
|
9932
10012
|
};
|
|
9933
10013
|
|
|
10014
|
+
|
|
10015
|
+
/**
|
|
10016
|
+
* Computes a style definition from a list of traits and an object of
|
|
10017
|
+
* additional attributes, with custom style definition object.
|
|
10018
|
+
*
|
|
10019
|
+
* @param {Object} custom
|
|
10020
|
+
* @param {string[]} [traits]
|
|
10021
|
+
* @param {Object} defaultStyles
|
|
10022
|
+
*
|
|
10023
|
+
* @return {Object} the style definition
|
|
10024
|
+
*/
|
|
9934
10025
|
this.computeStyle = function(custom, traits, defaultStyles) {
|
|
9935
10026
|
if (!isArray$2(traits)) {
|
|
9936
10027
|
defaultStyles = traits;
|
|
@@ -9979,7 +10070,7 @@
|
|
|
9979
10070
|
*
|
|
9980
10071
|
* @param {Array<Object>} collection
|
|
9981
10072
|
* @param {Object} element
|
|
9982
|
-
* @param {number} idx
|
|
10073
|
+
* @param {number} [idx]
|
|
9983
10074
|
*/
|
|
9984
10075
|
function add(collection, element, idx) {
|
|
9985
10076
|
|
|
@@ -10588,11 +10679,13 @@
|
|
|
10588
10679
|
*
|
|
10589
10680
|
* @example
|
|
10590
10681
|
*
|
|
10682
|
+
* ```javascript
|
|
10591
10683
|
* canvas.addMarker('foo', 'some-marker');
|
|
10592
10684
|
*
|
|
10593
10685
|
* const fooGfx = canvas.getGraphics('foo');
|
|
10594
10686
|
*
|
|
10595
10687
|
* fooGfx; // <g class="... some-marker"> ... </g>
|
|
10688
|
+
* ```
|
|
10596
10689
|
*
|
|
10597
10690
|
* @param {ShapeLike|ConnectionLike|string} element The element or its ID.
|
|
10598
10691
|
* @param {string} marker The marker.
|
|
@@ -10998,7 +11091,7 @@
|
|
|
10998
11091
|
*
|
|
10999
11092
|
* @memberOf Canvas
|
|
11000
11093
|
*
|
|
11001
|
-
* @event
|
|
11094
|
+
* @event ShapeRemovedEvent
|
|
11002
11095
|
* @type {Object}
|
|
11003
11096
|
* @property {ShapeLike} element The shape.
|
|
11004
11097
|
* @property {SVGElement} gfx The graphical element.
|
|
@@ -11035,7 +11128,7 @@
|
|
|
11035
11128
|
*
|
|
11036
11129
|
* @memberOf Canvas
|
|
11037
11130
|
*
|
|
11038
|
-
* @event
|
|
11131
|
+
* @event ConnectionRemovedEvent
|
|
11039
11132
|
* @type {Object}
|
|
11040
11133
|
* @property {ConnectionLike} element The connection.
|
|
11041
11134
|
* @property {SVGElement} gfx The graphical element.
|
|
@@ -11094,6 +11187,7 @@
|
|
|
11094
11187
|
*
|
|
11095
11188
|
* @example
|
|
11096
11189
|
*
|
|
11190
|
+
* ```javascript
|
|
11097
11191
|
* canvas.viewbox({ x: 100, y: 100, width: 500, height: 500 })
|
|
11098
11192
|
*
|
|
11099
11193
|
* // sets the visible area of the diagram to (100|100) -> (600|100)
|
|
@@ -11121,6 +11215,7 @@
|
|
|
11121
11215
|
* width: zoomedAndScrolledViewbox.outer.width,
|
|
11122
11216
|
* height: zoomedAndScrolledViewbox.outer.height
|
|
11123
11217
|
* });
|
|
11218
|
+
* ```
|
|
11124
11219
|
*
|
|
11125
11220
|
* @param {Rect} [box] The viewbox to be set.
|
|
11126
11221
|
*
|
|
@@ -11628,9 +11723,11 @@
|
|
|
11628
11723
|
*
|
|
11629
11724
|
* @example
|
|
11630
11725
|
*
|
|
11726
|
+
* ```javascript
|
|
11631
11727
|
* elementRegistry.get('SomeElementId_1');
|
|
11632
11728
|
*
|
|
11633
11729
|
* elementRegistry.get(gfx);
|
|
11730
|
+
* ```
|
|
11634
11731
|
*
|
|
11635
11732
|
* @param {string|SVGElement} filter The elements ID or graphical representation.
|
|
11636
11733
|
*
|
|
@@ -11724,11 +11821,13 @@
|
|
|
11724
11821
|
*
|
|
11725
11822
|
* @example
|
|
11726
11823
|
*
|
|
11824
|
+
* ```javascript
|
|
11727
11825
|
* elementRegistry.getGraphics('SomeElementId_1');
|
|
11728
11826
|
*
|
|
11729
11827
|
* elementRegistry.getGraphics(rootElement); // <g ...>
|
|
11730
11828
|
*
|
|
11731
11829
|
* elementRegistry.getGraphics(rootElement, true); // <svg ...>
|
|
11830
|
+
* ```
|
|
11732
11831
|
*
|
|
11733
11832
|
* @param {ElementLike|string} filter The element or its ID.
|
|
11734
11833
|
* @param {boolean} [secondary=false] Whether to return the secondary graphical representation.
|
|
@@ -12308,7 +12407,7 @@
|
|
|
12308
12407
|
*
|
|
12309
12408
|
* @example
|
|
12310
12409
|
*
|
|
12311
|
-
* ```
|
|
12410
|
+
* ```javascript
|
|
12312
12411
|
* import * as Model from 'diagram-js/lib/model';
|
|
12313
12412
|
*
|
|
12314
12413
|
* const root = Model.create('root', {
|
|
@@ -12324,6 +12423,7 @@
|
|
|
12324
12423
|
*
|
|
12325
12424
|
* @return {Root}
|
|
12326
12425
|
*/
|
|
12426
|
+
|
|
12327
12427
|
/**
|
|
12328
12428
|
* Creates a connection.
|
|
12329
12429
|
*
|
|
@@ -12331,7 +12431,7 @@
|
|
|
12331
12431
|
*
|
|
12332
12432
|
* @example
|
|
12333
12433
|
*
|
|
12334
|
-
* ```
|
|
12434
|
+
* ```javascript
|
|
12335
12435
|
* import * as Model from 'diagram-js/lib/model';
|
|
12336
12436
|
*
|
|
12337
12437
|
* const connection = Model.create('connection', {
|
|
@@ -12347,6 +12447,7 @@
|
|
|
12347
12447
|
*
|
|
12348
12448
|
* @return {Connection}
|
|
12349
12449
|
*/
|
|
12450
|
+
|
|
12350
12451
|
/**
|
|
12351
12452
|
* Creates a shape.
|
|
12352
12453
|
*
|
|
@@ -12354,7 +12455,7 @@
|
|
|
12354
12455
|
*
|
|
12355
12456
|
* @example
|
|
12356
12457
|
*
|
|
12357
|
-
* ```
|
|
12458
|
+
* ```javascript
|
|
12358
12459
|
* import * as Model from 'diagram-js/lib/model';
|
|
12359
12460
|
*
|
|
12360
12461
|
* const shape = Model.create('shape', {
|
|
@@ -12370,12 +12471,13 @@
|
|
|
12370
12471
|
*
|
|
12371
12472
|
* @return {Shape}
|
|
12372
12473
|
*/
|
|
12474
|
+
|
|
12373
12475
|
/**
|
|
12374
12476
|
* Creates a label.
|
|
12375
12477
|
*
|
|
12376
12478
|
* @example
|
|
12377
12479
|
*
|
|
12378
|
-
* ```
|
|
12480
|
+
* ```javascript
|
|
12379
12481
|
* import * as Model from 'diagram-js/lib/model';
|
|
12380
12482
|
*
|
|
12381
12483
|
* const label = Model.create('label', {
|
|
@@ -12388,7 +12490,8 @@
|
|
|
12388
12490
|
* ```
|
|
12389
12491
|
*
|
|
12390
12492
|
* @param {'label'} type
|
|
12391
|
-
* @param {
|
|
12493
|
+
* @param {Object} [attrs]
|
|
12494
|
+
*
|
|
12392
12495
|
* @return {Label}
|
|
12393
12496
|
*/
|
|
12394
12497
|
function create(type, attrs) {
|
|
@@ -12686,7 +12789,6 @@
|
|
|
12686
12789
|
});
|
|
12687
12790
|
};
|
|
12688
12791
|
|
|
12689
|
-
|
|
12690
12792
|
/**
|
|
12691
12793
|
* Register an event listener that is called only once.
|
|
12692
12794
|
*
|
|
@@ -12957,7 +13059,7 @@
|
|
|
12957
13059
|
* * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
|
|
12958
13060
|
*
|
|
12959
13061
|
* @param {string} event
|
|
12960
|
-
* @param {EventBusListener}
|
|
13062
|
+
* @param {EventBusListener} newListener
|
|
12961
13063
|
*/
|
|
12962
13064
|
EventBus.prototype._addListener = function(event, newListener) {
|
|
12963
13065
|
|
|
@@ -13555,9 +13657,11 @@
|
|
|
13555
13657
|
*
|
|
13556
13658
|
* @example
|
|
13557
13659
|
*
|
|
13660
|
+
* ```javascript
|
|
13558
13661
|
* eventBus.on('diagram.init', function() {
|
|
13559
13662
|
* eventBus.fire('my-custom-event', { foo: 'BAR' });
|
|
13560
13663
|
* });
|
|
13664
|
+
* ```
|
|
13561
13665
|
*
|
|
13562
13666
|
* @type {Object}
|
|
13563
13667
|
*/
|
|
@@ -22857,6 +22961,7 @@
|
|
|
22857
22961
|
|
|
22858
22962
|
/**
|
|
22859
22963
|
* @param {KeyboardEvent} event
|
|
22964
|
+
* @return {boolean}
|
|
22860
22965
|
*/
|
|
22861
22966
|
function isCmd(event) {
|
|
22862
22967
|
|
|
@@ -22874,6 +22979,7 @@
|
|
|
22874
22979
|
*
|
|
22875
22980
|
* @param {string|string[]} keys
|
|
22876
22981
|
* @param {KeyboardEvent} event
|
|
22982
|
+
* @return {boolean}
|
|
22877
22983
|
*/
|
|
22878
22984
|
function isKey(keys, event) {
|
|
22879
22985
|
keys = isArray$2(keys) ? keys : [ keys ];
|
|
@@ -22888,18 +22994,30 @@
|
|
|
22888
22994
|
return event.shiftKey;
|
|
22889
22995
|
}
|
|
22890
22996
|
|
|
22997
|
+
/**
|
|
22998
|
+
* @param {KeyboardEvent} event
|
|
22999
|
+
*/
|
|
22891
23000
|
function isCopy(event) {
|
|
22892
23001
|
return isCmd(event) && isKey(KEYS_COPY, event);
|
|
22893
23002
|
}
|
|
22894
23003
|
|
|
23004
|
+
/**
|
|
23005
|
+
* @param {KeyboardEvent} event
|
|
23006
|
+
*/
|
|
22895
23007
|
function isPaste(event) {
|
|
22896
23008
|
return isCmd(event) && isKey(KEYS_PASTE, event);
|
|
22897
23009
|
}
|
|
22898
23010
|
|
|
23011
|
+
/**
|
|
23012
|
+
* @param {KeyboardEvent} event
|
|
23013
|
+
*/
|
|
22899
23014
|
function isUndo(event) {
|
|
22900
23015
|
return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
|
|
22901
23016
|
}
|
|
22902
23017
|
|
|
23018
|
+
/**
|
|
23019
|
+
* @param {KeyboardEvent} event
|
|
23020
|
+
*/
|
|
22903
23021
|
function isRedo(event) {
|
|
22904
23022
|
return isCmd(event) && (
|
|
22905
23023
|
isKey(KEYS_REDO, event) || (
|
|
@@ -22910,6 +23028,8 @@
|
|
|
22910
23028
|
|
|
22911
23029
|
/**
|
|
22912
23030
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
23031
|
+
*
|
|
23032
|
+
* @typedef {({ keyEvent: KeyboardEvent }) => any} Listener
|
|
22913
23033
|
*/
|
|
22914
23034
|
|
|
22915
23035
|
var KEYDOWN_EVENT = 'keyboard.keydown',
|
|
@@ -22941,6 +23061,7 @@
|
|
|
22941
23061
|
* `keyboard.bindTo` configuration option.
|
|
22942
23062
|
*
|
|
22943
23063
|
* @param {Object} config
|
|
23064
|
+
* @param {EventTarget} [config.bindTo]
|
|
22944
23065
|
* @param {EventBus} eventBus
|
|
22945
23066
|
*/
|
|
22946
23067
|
function Keyboard(config, eventBus) {
|
|
@@ -23032,6 +23153,11 @@
|
|
|
23032
23153
|
return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
|
|
23033
23154
|
};
|
|
23034
23155
|
|
|
23156
|
+
/**
|
|
23157
|
+
* Bind keyboard events to the given DOM node.
|
|
23158
|
+
*
|
|
23159
|
+
* @param {EventTarget} node
|
|
23160
|
+
*/
|
|
23035
23161
|
Keyboard.prototype.bind = function(node) {
|
|
23036
23162
|
|
|
23037
23163
|
// make sure that the keyboard is only bound once to the DOM
|
|
@@ -23046,6 +23172,9 @@
|
|
|
23046
23172
|
this._fire('bind');
|
|
23047
23173
|
};
|
|
23048
23174
|
|
|
23175
|
+
/**
|
|
23176
|
+
* @return {EventTarget}
|
|
23177
|
+
*/
|
|
23049
23178
|
Keyboard.prototype.getBinding = function() {
|
|
23050
23179
|
return this._node;
|
|
23051
23180
|
};
|
|
@@ -23064,6 +23193,9 @@
|
|
|
23064
23193
|
this._node = null;
|
|
23065
23194
|
};
|
|
23066
23195
|
|
|
23196
|
+
/**
|
|
23197
|
+
* @param {string} event
|
|
23198
|
+
*/
|
|
23067
23199
|
Keyboard.prototype._fire = function(event) {
|
|
23068
23200
|
this._eventBus.fire('keyboard.' + event, { node: this._node });
|
|
23069
23201
|
};
|
|
@@ -23074,8 +23206,8 @@
|
|
|
23074
23206
|
* provided, the default value of 1000 is used.
|
|
23075
23207
|
*
|
|
23076
23208
|
* @param {number} [priority]
|
|
23077
|
-
* @param {
|
|
23078
|
-
* @param {string} type
|
|
23209
|
+
* @param {Listener} listener
|
|
23210
|
+
* @param {string} [type='keyboard.keydown']
|
|
23079
23211
|
*/
|
|
23080
23212
|
Keyboard.prototype.addListener = function(priority, listener, type) {
|
|
23081
23213
|
if (isFunction(priority)) {
|
|
@@ -23087,6 +23219,12 @@
|
|
|
23087
23219
|
this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
|
|
23088
23220
|
};
|
|
23089
23221
|
|
|
23222
|
+
/**
|
|
23223
|
+
* Remove a listener function.
|
|
23224
|
+
*
|
|
23225
|
+
* @param {Listener} listener
|
|
23226
|
+
* @param {string} [type='keyboard.keydown']
|
|
23227
|
+
*/
|
|
23090
23228
|
Keyboard.prototype.removeListener = function(listener, type) {
|
|
23091
23229
|
this._eventBus.off(type || KEYDOWN_EVENT, listener);
|
|
23092
23230
|
};
|
|
@@ -23359,15 +23497,21 @@
|
|
|
23359
23497
|
}
|
|
23360
23498
|
}
|
|
23361
23499
|
|
|
23362
|
-
|
|
23500
|
+
/**
|
|
23501
|
+
* @param {{
|
|
23502
|
+
* direction: 'up' | 'down' | 'left' | 'right';
|
|
23503
|
+
* speed: number;
|
|
23504
|
+
* }} options
|
|
23505
|
+
*/
|
|
23506
|
+
this.moveCanvas = function(options) {
|
|
23363
23507
|
|
|
23364
23508
|
var dx = 0,
|
|
23365
23509
|
dy = 0,
|
|
23366
|
-
speed =
|
|
23510
|
+
speed = options.speed;
|
|
23367
23511
|
|
|
23368
23512
|
var actualSpeed = speed / Math.min(Math.sqrt(canvas.viewbox().scale), 1);
|
|
23369
23513
|
|
|
23370
|
-
switch (
|
|
23514
|
+
switch (options.direction) {
|
|
23371
23515
|
case 'left': // Left
|
|
23372
23516
|
dx = actualSpeed;
|
|
23373
23517
|
break;
|
|
@@ -23410,7 +23554,9 @@
|
|
|
23410
23554
|
|
|
23411
23555
|
var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
|
|
23412
23556
|
|
|
23413
|
-
|
|
23557
|
+
/**
|
|
23558
|
+
* @param {string} mode
|
|
23559
|
+
*/
|
|
23414
23560
|
function set(mode) {
|
|
23415
23561
|
var classes$1 = classes(document.body);
|
|
23416
23562
|
|
|
@@ -23425,12 +23571,19 @@
|
|
|
23425
23571
|
set(null);
|
|
23426
23572
|
}
|
|
23427
23573
|
|
|
23574
|
+
/**
|
|
23575
|
+
* @typedef {import('../core/EventBus').EventBus} EventBus
|
|
23576
|
+
*/
|
|
23577
|
+
|
|
23428
23578
|
var TRAP_PRIORITY = 5000;
|
|
23429
23579
|
|
|
23430
23580
|
/**
|
|
23431
23581
|
* Installs a click trap that prevents a ghost click following a dragging operation.
|
|
23432
23582
|
*
|
|
23433
|
-
* @
|
|
23583
|
+
* @param {EventBus} eventBus
|
|
23584
|
+
* @param {string} [eventName='element.click']
|
|
23585
|
+
*
|
|
23586
|
+
* @return {() => void} a function to immediately remove the installed trap.
|
|
23434
23587
|
*/
|
|
23435
23588
|
function install(eventBus, eventName) {
|
|
23436
23589
|
|
|
@@ -23447,6 +23600,17 @@
|
|
|
23447
23600
|
};
|
|
23448
23601
|
}
|
|
23449
23602
|
|
|
23603
|
+
/**
|
|
23604
|
+
* @typedef {import('../util/Types').Point} Point
|
|
23605
|
+
* @typedef {import('../util/Types').Rect} Rect
|
|
23606
|
+
*/
|
|
23607
|
+
|
|
23608
|
+
|
|
23609
|
+
/**
|
|
23610
|
+
* @param {Point} a
|
|
23611
|
+
* @param {Point} b
|
|
23612
|
+
* @return {Point}
|
|
23613
|
+
*/
|
|
23450
23614
|
function delta(a, b) {
|
|
23451
23615
|
return {
|
|
23452
23616
|
x: a.x - b.x,
|
|
@@ -23595,6 +23759,7 @@
|
|
|
23595
23759
|
* @param {Object} range
|
|
23596
23760
|
* @param {number} range.min
|
|
23597
23761
|
* @param {number} range.max
|
|
23762
|
+
* @param {number} steps
|
|
23598
23763
|
*/
|
|
23599
23764
|
function getStepSize(range, steps) {
|
|
23600
23765
|
|
|
@@ -23606,6 +23771,12 @@
|
|
|
23606
23771
|
return absoluteLinearRange / steps;
|
|
23607
23772
|
}
|
|
23608
23773
|
|
|
23774
|
+
/**
|
|
23775
|
+
* @param {Object} range
|
|
23776
|
+
* @param {number} range.min
|
|
23777
|
+
* @param {number} range.max
|
|
23778
|
+
* @param {number} scale
|
|
23779
|
+
*/
|
|
23609
23780
|
function cap(range, scale) {
|
|
23610
23781
|
return Math.max(range.min, Math.min(range.max, scale));
|
|
23611
23782
|
}
|