bpmn-js 13.0.1 → 13.0.3
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 +219 -267
- package/dist/bpmn-modeler.production.min.js +6 -6
- package/dist/bpmn-navigated-viewer.development.js +161 -160
- package/dist/bpmn-navigated-viewer.production.min.js +4 -4
- package/dist/bpmn-viewer.development.js +161 -160
- package/dist/bpmn-viewer.production.min.js +4 -4
- package/lib/draw/BpmnRenderer.js +1 -1
- package/lib/features/label-editing/LabelEditingProvider.js +1 -1
- package/lib/features/label-editing/LabelUtil.d.ts +1 -14
- package/lib/features/label-editing/LabelUtil.js +4 -82
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +2 -28
- package/lib/features/modeling/BpmnUpdater.js +28 -2
- package/lib/features/modeling/behavior/LabelBehavior.js +15 -66
- package/lib/features/search/BpmnSearchProvider.js +1 -1
- package/lib/import/BpmnImporter.js +2 -5
- package/lib/model/Types.d.ts +1 -1
- package/lib/model/Types.ts +1 -1
- package/lib/util/LabelUtil.d.ts +16 -0
- package/lib/util/LabelUtil.js +82 -0
- package/package.json +2 -2
- package/lib/icons/dist/append.svg +0 -1
- package/lib/icons/dist/connect-context-pad.svg +0 -1
- package/lib/icons/dist/connect-palette.svg +0 -1
- package/lib/icons/dist/create.svg +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-modeler v13.0.
|
|
2
|
+
* bpmn-js - bpmn-modeler v13.0.3
|
|
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-04-
|
|
11
|
+
* Date: 2023-04-24
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -17859,7 +17859,183 @@
|
|
|
17859
17859
|
}
|
|
17860
17860
|
|
|
17861
17861
|
/**
|
|
17862
|
-
* @typedef {
|
|
17862
|
+
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
17863
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
17864
|
+
*
|
|
17865
|
+
* @typedef {import('../model/Types').Element} Element
|
|
17866
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
17867
|
+
*/
|
|
17868
|
+
|
|
17869
|
+
var DEFAULT_LABEL_SIZE$1 = {
|
|
17870
|
+
width: 90,
|
|
17871
|
+
height: 20
|
|
17872
|
+
};
|
|
17873
|
+
|
|
17874
|
+
var FLOW_LABEL_INDENT = 15;
|
|
17875
|
+
|
|
17876
|
+
|
|
17877
|
+
/**
|
|
17878
|
+
* Return true if the given semantic has an external label.
|
|
17879
|
+
*
|
|
17880
|
+
* @param {Element} semantic
|
|
17881
|
+
*
|
|
17882
|
+
* @return {boolean}
|
|
17883
|
+
*/
|
|
17884
|
+
function isLabelExternal(semantic) {
|
|
17885
|
+
return is$1(semantic, 'bpmn:Event') ||
|
|
17886
|
+
is$1(semantic, 'bpmn:Gateway') ||
|
|
17887
|
+
is$1(semantic, 'bpmn:DataStoreReference') ||
|
|
17888
|
+
is$1(semantic, 'bpmn:DataObjectReference') ||
|
|
17889
|
+
is$1(semantic, 'bpmn:DataInput') ||
|
|
17890
|
+
is$1(semantic, 'bpmn:DataOutput') ||
|
|
17891
|
+
is$1(semantic, 'bpmn:SequenceFlow') ||
|
|
17892
|
+
is$1(semantic, 'bpmn:MessageFlow') ||
|
|
17893
|
+
is$1(semantic, 'bpmn:Group');
|
|
17894
|
+
}
|
|
17895
|
+
|
|
17896
|
+
/**
|
|
17897
|
+
* Return true if the given element has an external label.
|
|
17898
|
+
*
|
|
17899
|
+
* @param {Element} element
|
|
17900
|
+
*
|
|
17901
|
+
* @return {boolean}
|
|
17902
|
+
*/
|
|
17903
|
+
function hasExternalLabel(element) {
|
|
17904
|
+
return isLabel$5(element.label);
|
|
17905
|
+
}
|
|
17906
|
+
|
|
17907
|
+
/**
|
|
17908
|
+
* Get the position of a sequence flow label.
|
|
17909
|
+
*
|
|
17910
|
+
* @param {Point[]} waypoints
|
|
17911
|
+
*
|
|
17912
|
+
* @return {Point}
|
|
17913
|
+
*/
|
|
17914
|
+
function getFlowLabelPosition(waypoints) {
|
|
17915
|
+
|
|
17916
|
+
// get the waypoints mid
|
|
17917
|
+
var mid = waypoints.length / 2 - 1;
|
|
17918
|
+
|
|
17919
|
+
var first = waypoints[Math.floor(mid)];
|
|
17920
|
+
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
17921
|
+
|
|
17922
|
+
// get position
|
|
17923
|
+
var position = getWaypointsMid(waypoints);
|
|
17924
|
+
|
|
17925
|
+
// calculate angle
|
|
17926
|
+
var angle = Math.atan((second.y - first.y) / (second.x - first.x));
|
|
17927
|
+
|
|
17928
|
+
var x = position.x,
|
|
17929
|
+
y = position.y;
|
|
17930
|
+
|
|
17931
|
+
if (Math.abs(angle) < Math.PI / 2) {
|
|
17932
|
+
y -= FLOW_LABEL_INDENT;
|
|
17933
|
+
} else {
|
|
17934
|
+
x += FLOW_LABEL_INDENT;
|
|
17935
|
+
}
|
|
17936
|
+
|
|
17937
|
+
return { x: x, y: y };
|
|
17938
|
+
}
|
|
17939
|
+
|
|
17940
|
+
|
|
17941
|
+
/**
|
|
17942
|
+
* Get the middle of a number of waypoints.
|
|
17943
|
+
*
|
|
17944
|
+
* @param {Point[]} waypoints
|
|
17945
|
+
*
|
|
17946
|
+
* @return {Point}
|
|
17947
|
+
*/
|
|
17948
|
+
function getWaypointsMid(waypoints) {
|
|
17949
|
+
|
|
17950
|
+
var mid = waypoints.length / 2 - 1;
|
|
17951
|
+
|
|
17952
|
+
var first = waypoints[Math.floor(mid)];
|
|
17953
|
+
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
17954
|
+
|
|
17955
|
+
return {
|
|
17956
|
+
x: first.x + (second.x - first.x) / 2,
|
|
17957
|
+
y: first.y + (second.y - first.y) / 2
|
|
17958
|
+
};
|
|
17959
|
+
}
|
|
17960
|
+
|
|
17961
|
+
/**
|
|
17962
|
+
* Get the middle of the external label of an element.
|
|
17963
|
+
*
|
|
17964
|
+
* @param {Element} element
|
|
17965
|
+
*
|
|
17966
|
+
* @return {Point}
|
|
17967
|
+
*/
|
|
17968
|
+
function getExternalLabelMid(element) {
|
|
17969
|
+
|
|
17970
|
+
if (element.waypoints) {
|
|
17971
|
+
return getFlowLabelPosition(element.waypoints);
|
|
17972
|
+
} else if (is$1(element, 'bpmn:Group')) {
|
|
17973
|
+
return {
|
|
17974
|
+
x: element.x + element.width / 2,
|
|
17975
|
+
y: element.y + DEFAULT_LABEL_SIZE$1.height / 2
|
|
17976
|
+
};
|
|
17977
|
+
} else {
|
|
17978
|
+
return {
|
|
17979
|
+
x: element.x + element.width / 2,
|
|
17980
|
+
y: element.y + element.height + DEFAULT_LABEL_SIZE$1.height / 2
|
|
17981
|
+
};
|
|
17982
|
+
}
|
|
17983
|
+
}
|
|
17984
|
+
|
|
17985
|
+
|
|
17986
|
+
/**
|
|
17987
|
+
* Return the bounds of an elements label, parsed from the elements DI or
|
|
17988
|
+
* generated from its bounds.
|
|
17989
|
+
*
|
|
17990
|
+
* @param {ModdleElement} di
|
|
17991
|
+
* @param {Element} element
|
|
17992
|
+
*
|
|
17993
|
+
* @return {Rect}
|
|
17994
|
+
*/
|
|
17995
|
+
function getExternalLabelBounds(di, element) {
|
|
17996
|
+
|
|
17997
|
+
var mid,
|
|
17998
|
+
size,
|
|
17999
|
+
bounds,
|
|
18000
|
+
label = di.label;
|
|
18001
|
+
|
|
18002
|
+
if (label && label.bounds) {
|
|
18003
|
+
bounds = label.bounds;
|
|
18004
|
+
|
|
18005
|
+
size = {
|
|
18006
|
+
width: Math.max(DEFAULT_LABEL_SIZE$1.width, bounds.width),
|
|
18007
|
+
height: bounds.height
|
|
18008
|
+
};
|
|
18009
|
+
|
|
18010
|
+
mid = {
|
|
18011
|
+
x: bounds.x + bounds.width / 2,
|
|
18012
|
+
y: bounds.y + bounds.height / 2
|
|
18013
|
+
};
|
|
18014
|
+
} else {
|
|
18015
|
+
|
|
18016
|
+
mid = getExternalLabelMid(element);
|
|
18017
|
+
|
|
18018
|
+
size = DEFAULT_LABEL_SIZE$1;
|
|
18019
|
+
}
|
|
18020
|
+
|
|
18021
|
+
return assign$1({
|
|
18022
|
+
x: mid.x - size.width / 2,
|
|
18023
|
+
y: mid.y - size.height / 2
|
|
18024
|
+
}, size);
|
|
18025
|
+
}
|
|
18026
|
+
|
|
18027
|
+
/**
|
|
18028
|
+
* @param {Element} element
|
|
18029
|
+
*
|
|
18030
|
+
* @return {boolean}
|
|
18031
|
+
*/
|
|
18032
|
+
function isLabel$5(element) {
|
|
18033
|
+
return element && !!element.labelTarget;
|
|
18034
|
+
}
|
|
18035
|
+
|
|
18036
|
+
|
|
18037
|
+
/**
|
|
18038
|
+
* @typedef { import('../model').DiagramElement } DiagramElement
|
|
17863
18039
|
*/
|
|
17864
18040
|
|
|
17865
18041
|
function getLabelAttr(semantic) {
|
|
@@ -20088,7 +20264,7 @@
|
|
|
20088
20264
|
|
|
20089
20265
|
var DEFAULT_BOX_PADDING = 0;
|
|
20090
20266
|
|
|
20091
|
-
var DEFAULT_LABEL_SIZE
|
|
20267
|
+
var DEFAULT_LABEL_SIZE = {
|
|
20092
20268
|
width: 150,
|
|
20093
20269
|
height: 50
|
|
20094
20270
|
};
|
|
@@ -20328,7 +20504,7 @@
|
|
|
20328
20504
|
function Text(config) {
|
|
20329
20505
|
|
|
20330
20506
|
this._config = assign$1({}, {
|
|
20331
|
-
size: DEFAULT_LABEL_SIZE
|
|
20507
|
+
size: DEFAULT_LABEL_SIZE,
|
|
20332
20508
|
padding: DEFAULT_BOX_PADDING,
|
|
20333
20509
|
style: {},
|
|
20334
20510
|
align: 'center-top'
|
|
@@ -21141,181 +21317,6 @@
|
|
|
21141
21317
|
translate: [ 'value', translate$1 ]
|
|
21142
21318
|
};
|
|
21143
21319
|
|
|
21144
|
-
/**
|
|
21145
|
-
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
21146
|
-
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
21147
|
-
*
|
|
21148
|
-
* @typedef {import('../model/Types').Element} Element
|
|
21149
|
-
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
21150
|
-
*/
|
|
21151
|
-
|
|
21152
|
-
var DEFAULT_LABEL_SIZE = {
|
|
21153
|
-
width: 90,
|
|
21154
|
-
height: 20
|
|
21155
|
-
};
|
|
21156
|
-
|
|
21157
|
-
var FLOW_LABEL_INDENT = 15;
|
|
21158
|
-
|
|
21159
|
-
|
|
21160
|
-
/**
|
|
21161
|
-
* Return true if the given semantic has an external label.
|
|
21162
|
-
*
|
|
21163
|
-
* @param {Element} semantic
|
|
21164
|
-
*
|
|
21165
|
-
* @return {boolean}
|
|
21166
|
-
*/
|
|
21167
|
-
function isLabelExternal(semantic) {
|
|
21168
|
-
return is$1(semantic, 'bpmn:Event') ||
|
|
21169
|
-
is$1(semantic, 'bpmn:Gateway') ||
|
|
21170
|
-
is$1(semantic, 'bpmn:DataStoreReference') ||
|
|
21171
|
-
is$1(semantic, 'bpmn:DataObjectReference') ||
|
|
21172
|
-
is$1(semantic, 'bpmn:DataInput') ||
|
|
21173
|
-
is$1(semantic, 'bpmn:DataOutput') ||
|
|
21174
|
-
is$1(semantic, 'bpmn:SequenceFlow') ||
|
|
21175
|
-
is$1(semantic, 'bpmn:MessageFlow') ||
|
|
21176
|
-
is$1(semantic, 'bpmn:Group');
|
|
21177
|
-
}
|
|
21178
|
-
|
|
21179
|
-
/**
|
|
21180
|
-
* Return true if the given element has an external label.
|
|
21181
|
-
*
|
|
21182
|
-
* @param {Element} element
|
|
21183
|
-
*
|
|
21184
|
-
* @return {boolean}
|
|
21185
|
-
*/
|
|
21186
|
-
function hasExternalLabel(element) {
|
|
21187
|
-
return isLabel$5(element.label);
|
|
21188
|
-
}
|
|
21189
|
-
|
|
21190
|
-
/**
|
|
21191
|
-
* Get the position of a sequence flow label.
|
|
21192
|
-
*
|
|
21193
|
-
* @param {Point[]} waypoints
|
|
21194
|
-
*
|
|
21195
|
-
* @return {Point}
|
|
21196
|
-
*/
|
|
21197
|
-
function getFlowLabelPosition(waypoints) {
|
|
21198
|
-
|
|
21199
|
-
// get the waypoints mid
|
|
21200
|
-
var mid = waypoints.length / 2 - 1;
|
|
21201
|
-
|
|
21202
|
-
var first = waypoints[Math.floor(mid)];
|
|
21203
|
-
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
21204
|
-
|
|
21205
|
-
// get position
|
|
21206
|
-
var position = getWaypointsMid(waypoints);
|
|
21207
|
-
|
|
21208
|
-
// calculate angle
|
|
21209
|
-
var angle = Math.atan((second.y - first.y) / (second.x - first.x));
|
|
21210
|
-
|
|
21211
|
-
var x = position.x,
|
|
21212
|
-
y = position.y;
|
|
21213
|
-
|
|
21214
|
-
if (Math.abs(angle) < Math.PI / 2) {
|
|
21215
|
-
y -= FLOW_LABEL_INDENT;
|
|
21216
|
-
} else {
|
|
21217
|
-
x += FLOW_LABEL_INDENT;
|
|
21218
|
-
}
|
|
21219
|
-
|
|
21220
|
-
return { x: x, y: y };
|
|
21221
|
-
}
|
|
21222
|
-
|
|
21223
|
-
|
|
21224
|
-
/**
|
|
21225
|
-
* Get the middle of a number of waypoints.
|
|
21226
|
-
*
|
|
21227
|
-
* @param {Point[]} waypoints
|
|
21228
|
-
*
|
|
21229
|
-
* @return {Point}
|
|
21230
|
-
*/
|
|
21231
|
-
function getWaypointsMid(waypoints) {
|
|
21232
|
-
|
|
21233
|
-
var mid = waypoints.length / 2 - 1;
|
|
21234
|
-
|
|
21235
|
-
var first = waypoints[Math.floor(mid)];
|
|
21236
|
-
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
21237
|
-
|
|
21238
|
-
return {
|
|
21239
|
-
x: first.x + (second.x - first.x) / 2,
|
|
21240
|
-
y: first.y + (second.y - first.y) / 2
|
|
21241
|
-
};
|
|
21242
|
-
}
|
|
21243
|
-
|
|
21244
|
-
/**
|
|
21245
|
-
* Get the middle of the external label of an element.
|
|
21246
|
-
*
|
|
21247
|
-
* @param {Element} element
|
|
21248
|
-
*
|
|
21249
|
-
* @return {Point}
|
|
21250
|
-
*/
|
|
21251
|
-
function getExternalLabelMid(element) {
|
|
21252
|
-
|
|
21253
|
-
if (element.waypoints) {
|
|
21254
|
-
return getFlowLabelPosition(element.waypoints);
|
|
21255
|
-
} else if (is$1(element, 'bpmn:Group')) {
|
|
21256
|
-
return {
|
|
21257
|
-
x: element.x + element.width / 2,
|
|
21258
|
-
y: element.y + DEFAULT_LABEL_SIZE.height / 2
|
|
21259
|
-
};
|
|
21260
|
-
} else {
|
|
21261
|
-
return {
|
|
21262
|
-
x: element.x + element.width / 2,
|
|
21263
|
-
y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2
|
|
21264
|
-
};
|
|
21265
|
-
}
|
|
21266
|
-
}
|
|
21267
|
-
|
|
21268
|
-
|
|
21269
|
-
/**
|
|
21270
|
-
* Return the bounds of an elements label, parsed from the elements DI or
|
|
21271
|
-
* generated from its bounds.
|
|
21272
|
-
*
|
|
21273
|
-
* @param {ModdleElement} di
|
|
21274
|
-
* @param {Element} element
|
|
21275
|
-
*
|
|
21276
|
-
* @return {Rect}
|
|
21277
|
-
*/
|
|
21278
|
-
function getExternalLabelBounds(di, element) {
|
|
21279
|
-
|
|
21280
|
-
var mid,
|
|
21281
|
-
size,
|
|
21282
|
-
bounds,
|
|
21283
|
-
label = di.label;
|
|
21284
|
-
|
|
21285
|
-
if (label && label.bounds) {
|
|
21286
|
-
bounds = label.bounds;
|
|
21287
|
-
|
|
21288
|
-
size = {
|
|
21289
|
-
width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
|
|
21290
|
-
height: bounds.height
|
|
21291
|
-
};
|
|
21292
|
-
|
|
21293
|
-
mid = {
|
|
21294
|
-
x: bounds.x + bounds.width / 2,
|
|
21295
|
-
y: bounds.y + bounds.height / 2
|
|
21296
|
-
};
|
|
21297
|
-
} else {
|
|
21298
|
-
|
|
21299
|
-
mid = getExternalLabelMid(element);
|
|
21300
|
-
|
|
21301
|
-
size = DEFAULT_LABEL_SIZE;
|
|
21302
|
-
}
|
|
21303
|
-
|
|
21304
|
-
return assign$1({
|
|
21305
|
-
x: mid.x - size.width / 2,
|
|
21306
|
-
y: mid.y - size.height / 2
|
|
21307
|
-
}, size);
|
|
21308
|
-
}
|
|
21309
|
-
|
|
21310
|
-
/**
|
|
21311
|
-
* @param {Element} element
|
|
21312
|
-
*
|
|
21313
|
-
* @return {boolean}
|
|
21314
|
-
*/
|
|
21315
|
-
function isLabel$5(element) {
|
|
21316
|
-
return element && !!element.labelTarget;
|
|
21317
|
-
}
|
|
21318
|
-
|
|
21319
21320
|
/**
|
|
21320
21321
|
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
21321
21322
|
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
@@ -47630,11 +47631,6 @@
|
|
|
47630
47631
|
return oldTRBL.top !== newTRBL.top && oldTRBL.bottom !== newTRBL.bottom;
|
|
47631
47632
|
}
|
|
47632
47633
|
|
|
47633
|
-
var DEFAULT_LABEL_DIMENSIONS = {
|
|
47634
|
-
width: 90,
|
|
47635
|
-
height: 20
|
|
47636
|
-
};
|
|
47637
|
-
|
|
47638
47634
|
var NAME_PROPERTY = 'name';
|
|
47639
47635
|
var TEXT_PROPERTY = 'text';
|
|
47640
47636
|
|
|
@@ -47667,7 +47663,16 @@
|
|
|
47667
47663
|
CommandInterceptor.call(this, eventBus);
|
|
47668
47664
|
|
|
47669
47665
|
// update label if name property was updated
|
|
47670
|
-
this.postExecute('element.updateProperties',
|
|
47666
|
+
this.postExecute('element.updateProperties', onPropertyUpdate);
|
|
47667
|
+
this.postExecute('element.updateModdleProperties', e => {
|
|
47668
|
+
const elementBo = getBusinessObject(e.context.element);
|
|
47669
|
+
|
|
47670
|
+
if (elementBo === e.context.moddleElement) {
|
|
47671
|
+
onPropertyUpdate(e);
|
|
47672
|
+
}
|
|
47673
|
+
});
|
|
47674
|
+
|
|
47675
|
+
function onPropertyUpdate(e) {
|
|
47671
47676
|
var context = e.context,
|
|
47672
47677
|
element = context.element,
|
|
47673
47678
|
properties = context.properties;
|
|
@@ -47691,7 +47696,7 @@
|
|
|
47691
47696
|
|
|
47692
47697
|
modeling.updateLabel(element, properties.text, newBounds);
|
|
47693
47698
|
}
|
|
47694
|
-
}
|
|
47699
|
+
}
|
|
47695
47700
|
|
|
47696
47701
|
// create label shape after shape/connection was created
|
|
47697
47702
|
this.postExecute([ 'shape.create', 'connection.create' ], function(e) {
|
|
@@ -47702,8 +47707,7 @@
|
|
|
47702
47707
|
return;
|
|
47703
47708
|
}
|
|
47704
47709
|
|
|
47705
|
-
var element = context.shape || context.connection
|
|
47706
|
-
businessObject = element.businessObject;
|
|
47710
|
+
var element = context.shape || context.connection;
|
|
47707
47711
|
|
|
47708
47712
|
if (isLabel$5(element) || !isLabelExternal(element)) {
|
|
47709
47713
|
return;
|
|
@@ -47714,20 +47718,7 @@
|
|
|
47714
47718
|
return;
|
|
47715
47719
|
}
|
|
47716
47720
|
|
|
47717
|
-
|
|
47718
|
-
|
|
47719
|
-
// we don't care about x and y
|
|
47720
|
-
var labelDimensions = textRenderer.getExternalLabelBounds(
|
|
47721
|
-
DEFAULT_LABEL_DIMENSIONS,
|
|
47722
|
-
getLabel(element)
|
|
47723
|
-
);
|
|
47724
|
-
|
|
47725
|
-
modeling.createLabel(element, labelCenter, {
|
|
47726
|
-
id: businessObject.id + '_label',
|
|
47727
|
-
businessObject: businessObject,
|
|
47728
|
-
width: labelDimensions.width,
|
|
47729
|
-
height: labelDimensions.height
|
|
47730
|
-
});
|
|
47721
|
+
modeling.updateLabel(element, getLabel(element));
|
|
47731
47722
|
});
|
|
47732
47723
|
|
|
47733
47724
|
// update label after label shape was deleted
|
|
@@ -47742,42 +47733,6 @@
|
|
|
47742
47733
|
}
|
|
47743
47734
|
});
|
|
47744
47735
|
|
|
47745
|
-
// update di information on label creation
|
|
47746
|
-
this.postExecute([ 'label.create' ], function(event) {
|
|
47747
|
-
|
|
47748
|
-
var context = event.context,
|
|
47749
|
-
element = context.shape,
|
|
47750
|
-
labelTarget = context.labelTarget,
|
|
47751
|
-
di;
|
|
47752
|
-
|
|
47753
|
-
// we want to trigger on real labels only
|
|
47754
|
-
if (!labelTarget) {
|
|
47755
|
-
return;
|
|
47756
|
-
}
|
|
47757
|
-
|
|
47758
|
-
// we want to trigger on BPMN elements only
|
|
47759
|
-
if (!is$1(labelTarget, 'bpmn:BaseElement')) {
|
|
47760
|
-
return;
|
|
47761
|
-
}
|
|
47762
|
-
|
|
47763
|
-
di = getDi(labelTarget);
|
|
47764
|
-
|
|
47765
|
-
if (!di.label) {
|
|
47766
|
-
di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
|
|
47767
|
-
bounds: bpmnFactory.create('dc:Bounds')
|
|
47768
|
-
});
|
|
47769
|
-
|
|
47770
|
-
element.di = di;
|
|
47771
|
-
}
|
|
47772
|
-
|
|
47773
|
-
assign$1(di.label.bounds, {
|
|
47774
|
-
x: element.x,
|
|
47775
|
-
y: element.y,
|
|
47776
|
-
width: element.width,
|
|
47777
|
-
height: element.height
|
|
47778
|
-
});
|
|
47779
|
-
});
|
|
47780
|
-
|
|
47781
47736
|
function getVisibleLabelAdjustment(event) {
|
|
47782
47737
|
|
|
47783
47738
|
var context = event.context,
|
|
@@ -55277,6 +55232,28 @@
|
|
|
55277
55232
|
|
|
55278
55233
|
this.executed([ 'element.updateAttachment' ], ifBpmn(updateAttachment));
|
|
55279
55234
|
this.reverted([ 'element.updateAttachment' ], ifBpmn(updateAttachment));
|
|
55235
|
+
|
|
55236
|
+
|
|
55237
|
+
// update BPMNLabel
|
|
55238
|
+
this.executed('element.updateLabel', ifBpmn(updateBPMNLabel));
|
|
55239
|
+
this.reverted('element.updateLabel', ifBpmn(updateBPMNLabel));
|
|
55240
|
+
|
|
55241
|
+
function updateBPMNLabel(event) {
|
|
55242
|
+
const { element } = event.context,
|
|
55243
|
+
label = getLabel(element);
|
|
55244
|
+
const di = getDi(element),
|
|
55245
|
+
diLabel = di && di.get('label');
|
|
55246
|
+
|
|
55247
|
+
if (isLabelExternal(element)) {
|
|
55248
|
+
return;
|
|
55249
|
+
}
|
|
55250
|
+
|
|
55251
|
+
if (label && !diLabel) {
|
|
55252
|
+
di.set('label', bpmnFactory.create('bpmndi:BPMNLabel'));
|
|
55253
|
+
} else if (!label && diLabel) {
|
|
55254
|
+
di.set('label', undefined);
|
|
55255
|
+
}
|
|
55256
|
+
}
|
|
55280
55257
|
}
|
|
55281
55258
|
|
|
55282
55259
|
e$3(BpmnUpdater, CommandInterceptor);
|
|
@@ -55777,7 +55754,7 @@
|
|
|
55777
55754
|
return function(event) {
|
|
55778
55755
|
|
|
55779
55756
|
var context = event.context,
|
|
55780
|
-
element = context.shape || context.connection;
|
|
55757
|
+
element = context.shape || context.connection || context.element;
|
|
55781
55758
|
|
|
55782
55759
|
if (is$1(element, 'bpmn:BaseElement')) {
|
|
55783
55760
|
fn(event);
|
|
@@ -55902,7 +55879,7 @@
|
|
|
55902
55879
|
// and wired via attrs
|
|
55903
55880
|
if (elementType === 'label') {
|
|
55904
55881
|
var di = attrs.di || this._bpmnFactory.createDiLabel();
|
|
55905
|
-
return this._baseCreate(elementType, assign$1({ type: 'label', di: di }, DEFAULT_LABEL_SIZE, attrs));
|
|
55882
|
+
return this._baseCreate(elementType, assign$1({ type: 'label', di: di }, DEFAULT_LABEL_SIZE$1, attrs));
|
|
55906
55883
|
}
|
|
55907
55884
|
|
|
55908
55885
|
return this.createElement(elementType, attrs);
|
|
@@ -60088,29 +60065,6 @@
|
|
|
60088
60065
|
*/
|
|
60089
60066
|
function UpdateLabelHandler(modeling, textRenderer, bpmnFactory) {
|
|
60090
60067
|
|
|
60091
|
-
/**
|
|
60092
|
-
* Creates an empty `diLabel` attribute for embedded labels.
|
|
60093
|
-
*
|
|
60094
|
-
* @param {Element} element
|
|
60095
|
-
* @param {string} text
|
|
60096
|
-
*/
|
|
60097
|
-
function ensureInternalLabelDi(element, text) {
|
|
60098
|
-
if (isLabelExternal(element)) {
|
|
60099
|
-
return;
|
|
60100
|
-
}
|
|
60101
|
-
|
|
60102
|
-
var di = getDi(element);
|
|
60103
|
-
|
|
60104
|
-
if (text && !di.label) {
|
|
60105
|
-
di.label = bpmnFactory.create('bpmndi:BPMNLabel');
|
|
60106
|
-
}
|
|
60107
|
-
|
|
60108
|
-
if (!text && di.label) {
|
|
60109
|
-
delete di.label;
|
|
60110
|
-
}
|
|
60111
|
-
}
|
|
60112
|
-
|
|
60113
|
-
|
|
60114
60068
|
/**
|
|
60115
60069
|
* Set the label and return the changed elements.
|
|
60116
60070
|
*
|
|
@@ -60128,8 +60082,6 @@
|
|
|
60128
60082
|
|
|
60129
60083
|
setLabel(label, text);
|
|
60130
60084
|
|
|
60131
|
-
ensureInternalLabelDi(element, text);
|
|
60132
|
-
|
|
60133
60085
|
return [ label, labelTarget ];
|
|
60134
60086
|
}
|
|
60135
60087
|
|
|
@@ -60191,7 +60143,7 @@
|
|
|
60191
60143
|
return;
|
|
60192
60144
|
}
|
|
60193
60145
|
|
|
60194
|
-
var text = getLabel(
|
|
60146
|
+
var text = getLabel(element);
|
|
60195
60147
|
|
|
60196
60148
|
// resize element based on label _or_ pre-defined bounds
|
|
60197
60149
|
if (typeof newBounds === 'undefined') {
|