bpmn-js 13.2.2 → 14.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/bpmn-font/css/bpmn.css +1 -0
- package/dist/assets/bpmn-js.css +1 -0
- package/dist/bpmn-modeler.development.js +494 -594
- package/dist/bpmn-modeler.production.min.js +38 -38
- package/dist/bpmn-navigated-viewer.development.js +30 -148
- package/dist/bpmn-navigated-viewer.production.min.js +5 -5
- package/dist/bpmn-viewer.development.js +30 -148
- package/dist/bpmn-viewer.production.min.js +5 -5
- package/lib/BaseViewer.d.ts +125 -5
- package/lib/BaseViewer.js +1 -68
- package/lib/Modeler.d.ts +9 -1
- package/lib/Modeler.js +2 -6
- package/lib/features/context-pad/ContextPadProvider.js +9 -3
- package/lib/features/copy-paste/BpmnCopyPaste.js +1 -1
- package/lib/features/modeling/behavior/EventBasedGatewayBehavior.js +11 -5
- package/lib/features/modeling/behavior/index.js +0 -3
- package/lib/features/modeling/index.js +0 -2
- package/lib/features/{modeling/behavior → modeling-feedback}/ModelingFeedback.js +1 -1
- package/lib/features/modeling-feedback/index.d.ts +7 -0
- package/lib/features/modeling-feedback/index.js +13 -0
- package/lib/util/CompatibilityUtil.d.ts +0 -14
- package/lib/util/CompatibilityUtil.js +1 -58
- package/package.json +9 -10
- /package/lib/features/{modeling/behavior → modeling-feedback}/ModelingFeedback.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-modeler
|
|
2
|
+
* bpmn-js - bpmn-modeler v14.0.0
|
|
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-08-30
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
function e$3(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}));}
|
|
20
20
|
|
|
21
|
-
function createCommonjsModule(fn
|
|
22
|
-
|
|
21
|
+
function createCommonjsModule(fn) {
|
|
22
|
+
var module = { exports: {} };
|
|
23
|
+
return fn(module, module.exports), module.exports;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
var hat_1 = createCommonjsModule(function (module) {
|
|
@@ -87,22 +88,25 @@
|
|
|
87
88
|
};
|
|
88
89
|
});
|
|
89
90
|
|
|
91
|
+
/**
|
|
92
|
+
* @typedef { [ number, number ] | [ number, number, number ] } Seed
|
|
93
|
+
*/
|
|
94
|
+
|
|
90
95
|
/**
|
|
91
96
|
* Create a new id generator / cache instance.
|
|
92
97
|
*
|
|
93
98
|
* You may optionally provide a seed that is used internally.
|
|
94
99
|
*
|
|
95
|
-
* @param {Seed} seed
|
|
100
|
+
* @param {Seed} [seed]
|
|
96
101
|
*/
|
|
97
|
-
|
|
98
102
|
function Ids(seed) {
|
|
99
103
|
if (!(this instanceof Ids)) {
|
|
100
104
|
return new Ids(seed);
|
|
101
105
|
}
|
|
102
|
-
|
|
103
106
|
seed = seed || [128, 36, 1];
|
|
104
107
|
this._seed = seed.length ? hat_1.rack(seed[0], seed[1], seed[2]) : seed;
|
|
105
108
|
}
|
|
109
|
+
|
|
106
110
|
/**
|
|
107
111
|
* Generate a next id.
|
|
108
112
|
*
|
|
@@ -110,10 +114,10 @@
|
|
|
110
114
|
*
|
|
111
115
|
* @return {String} id
|
|
112
116
|
*/
|
|
113
|
-
|
|
114
117
|
Ids.prototype.next = function (element) {
|
|
115
118
|
return this._seed(element || true);
|
|
116
119
|
};
|
|
120
|
+
|
|
117
121
|
/**
|
|
118
122
|
* Generate a next id with a given prefix.
|
|
119
123
|
*
|
|
@@ -121,61 +125,54 @@
|
|
|
121
125
|
*
|
|
122
126
|
* @return {String} id
|
|
123
127
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
128
|
Ids.prototype.nextPrefixed = function (prefix, element) {
|
|
127
129
|
var id;
|
|
128
|
-
|
|
129
130
|
do {
|
|
130
131
|
id = prefix + this.next(true);
|
|
131
|
-
} while (this.assigned(id));
|
|
132
|
+
} while (this.assigned(id));
|
|
132
133
|
|
|
134
|
+
// claim {prefix}{random}
|
|
135
|
+
this.claim(id, element);
|
|
133
136
|
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
// return
|
|
136
138
|
return id;
|
|
137
139
|
};
|
|
140
|
+
|
|
138
141
|
/**
|
|
139
142
|
* Manually claim an existing id.
|
|
140
143
|
*
|
|
141
144
|
* @param {String} id
|
|
142
145
|
* @param {String} [element] element the id is claimed by
|
|
143
146
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
147
|
Ids.prototype.claim = function (id, element) {
|
|
147
148
|
this._seed.set(id, element || true);
|
|
148
149
|
};
|
|
150
|
+
|
|
149
151
|
/**
|
|
150
152
|
* Returns true if the given id has already been assigned.
|
|
151
153
|
*
|
|
152
154
|
* @param {String} id
|
|
153
155
|
* @return {Boolean}
|
|
154
156
|
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
157
|
Ids.prototype.assigned = function (id) {
|
|
158
158
|
return this._seed.get(id) || false;
|
|
159
159
|
};
|
|
160
|
+
|
|
160
161
|
/**
|
|
161
162
|
* Unclaim an id.
|
|
162
163
|
*
|
|
163
164
|
* @param {String} id the id to unclaim
|
|
164
165
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
166
|
Ids.prototype.unclaim = function (id) {
|
|
168
167
|
delete this._seed.hats[id];
|
|
169
168
|
};
|
|
169
|
+
|
|
170
170
|
/**
|
|
171
171
|
* Clear all claimed ids.
|
|
172
172
|
*/
|
|
173
|
-
|
|
174
|
-
|
|
175
173
|
Ids.prototype.clear = function () {
|
|
176
174
|
var hats = this._seed.hats,
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
id;
|
|
179
176
|
for (id in hats) {
|
|
180
177
|
this.unclaim(id);
|
|
181
178
|
}
|
|
@@ -5076,9 +5073,9 @@
|
|
|
5076
5073
|
|
|
5077
5074
|
const viewport = this._viewport = createGroup(svg, 'viewport');
|
|
5078
5075
|
|
|
5079
|
-
// debounce canvas.viewbox.changed events
|
|
5080
|
-
//
|
|
5081
|
-
if (config.deferUpdate
|
|
5076
|
+
// debounce canvas.viewbox.changed events when deferUpdate is set
|
|
5077
|
+
// to help with potential performance issues
|
|
5078
|
+
if (config.deferUpdate) {
|
|
5082
5079
|
this._viewboxChanged = debounce(bind$2(this._viewboxChanged, this), 300);
|
|
5083
5080
|
}
|
|
5084
5081
|
|
|
@@ -6102,6 +6099,11 @@
|
|
|
6102
6099
|
this.setRootElement(rootElement);
|
|
6103
6100
|
}
|
|
6104
6101
|
|
|
6102
|
+
// element is rootElement, do not change viewport
|
|
6103
|
+
if (rootElement === element) {
|
|
6104
|
+
return;
|
|
6105
|
+
}
|
|
6106
|
+
|
|
6105
6107
|
if (!padding) {
|
|
6106
6108
|
padding = {};
|
|
6107
6109
|
}
|
|
@@ -13203,7 +13205,6 @@
|
|
|
13203
13205
|
{
|
|
13204
13206
|
name: "target",
|
|
13205
13207
|
type: "LinkEventDefinition",
|
|
13206
|
-
isAttr: true,
|
|
13207
13208
|
isReference: true
|
|
13208
13209
|
},
|
|
13209
13210
|
{
|
|
@@ -16042,62 +16043,6 @@
|
|
|
16042
16043
|
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
16043
16044
|
*/
|
|
16044
16045
|
|
|
16045
|
-
// TODO(nikku): remove with future bpmn-js version
|
|
16046
|
-
|
|
16047
|
-
/**
|
|
16048
|
-
* Wraps APIs to check:
|
|
16049
|
-
*
|
|
16050
|
-
* 1) If a callback is passed -> Warn users about callback deprecation.
|
|
16051
|
-
* 2) If Promise class is implemented in current environment.
|
|
16052
|
-
*
|
|
16053
|
-
* @private
|
|
16054
|
-
*
|
|
16055
|
-
* @param {Function} api
|
|
16056
|
-
*
|
|
16057
|
-
* @return {Function}
|
|
16058
|
-
*/
|
|
16059
|
-
function wrapForCompatibility(api) {
|
|
16060
|
-
|
|
16061
|
-
return function() {
|
|
16062
|
-
|
|
16063
|
-
if (!window.Promise) {
|
|
16064
|
-
throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
|
|
16065
|
-
}
|
|
16066
|
-
|
|
16067
|
-
var argLen = arguments.length;
|
|
16068
|
-
if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
|
|
16069
|
-
|
|
16070
|
-
var callback = arguments[argLen - 1];
|
|
16071
|
-
|
|
16072
|
-
console.warn(new Error(
|
|
16073
|
-
'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
|
|
16074
|
-
'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
|
|
16075
|
-
));
|
|
16076
|
-
|
|
16077
|
-
var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
|
|
16078
|
-
|
|
16079
|
-
api.apply(this, argsWithoutCallback).then(function(result) {
|
|
16080
|
-
|
|
16081
|
-
var firstKey = Object.keys(result)[0];
|
|
16082
|
-
|
|
16083
|
-
// The APIs we are wrapping all resolve a single item depending on the API.
|
|
16084
|
-
// For instance, importXML resolves { warnings } and saveXML returns { xml }.
|
|
16085
|
-
// That's why we can call the callback with the first item of result.
|
|
16086
|
-
return callback(null, result[firstKey]);
|
|
16087
|
-
|
|
16088
|
-
// Passing a second paramter instead of catch because we don't want to
|
|
16089
|
-
// catch errors thrown by callback().
|
|
16090
|
-
}, function(err) {
|
|
16091
|
-
|
|
16092
|
-
return callback(err, err.warnings);
|
|
16093
|
-
});
|
|
16094
|
-
} else {
|
|
16095
|
-
|
|
16096
|
-
return api.apply(this, arguments);
|
|
16097
|
-
}
|
|
16098
|
-
};
|
|
16099
|
-
}
|
|
16100
|
-
|
|
16101
16046
|
|
|
16102
16047
|
// TODO(nikku): remove with future bpmn-js version
|
|
16103
16048
|
|
|
@@ -17095,28 +17040,7 @@
|
|
|
17095
17040
|
const self = this;
|
|
17096
17041
|
|
|
17097
17042
|
function ParseCompleteEvent(data) {
|
|
17098
|
-
|
|
17099
|
-
const event = self.get('eventBus').createEvent(data);
|
|
17100
|
-
|
|
17101
|
-
// TODO(nikku): remove with future bpmn-js version
|
|
17102
|
-
Object.defineProperty(event, 'context', {
|
|
17103
|
-
enumerable: true,
|
|
17104
|
-
get: function() {
|
|
17105
|
-
|
|
17106
|
-
console.warn(new Error(
|
|
17107
|
-
'import.parse.complete <context> is deprecated ' +
|
|
17108
|
-
'and will be removed in future library versions'
|
|
17109
|
-
));
|
|
17110
|
-
|
|
17111
|
-
return {
|
|
17112
|
-
warnings: data.warnings,
|
|
17113
|
-
references: data.references,
|
|
17114
|
-
elementsById: data.elementsById
|
|
17115
|
-
};
|
|
17116
|
-
}
|
|
17117
|
-
});
|
|
17118
|
-
|
|
17119
|
-
return event;
|
|
17043
|
+
return self.get('eventBus').createEvent(data);
|
|
17120
17044
|
}
|
|
17121
17045
|
|
|
17122
17046
|
let aggregatedWarnings = [];
|
|
@@ -17194,8 +17118,6 @@
|
|
|
17194
17118
|
}
|
|
17195
17119
|
};
|
|
17196
17120
|
|
|
17197
|
-
BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
|
|
17198
|
-
|
|
17199
17121
|
|
|
17200
17122
|
/**
|
|
17201
17123
|
* Import parsed definitions and render a BPMN 2.0 diagram.
|
|
@@ -17226,8 +17148,6 @@
|
|
|
17226
17148
|
return { warnings: result.warnings };
|
|
17227
17149
|
};
|
|
17228
17150
|
|
|
17229
|
-
BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
|
|
17230
|
-
|
|
17231
17151
|
|
|
17232
17152
|
/**
|
|
17233
17153
|
* Open diagram of previously imported XML.
|
|
@@ -17289,8 +17209,6 @@
|
|
|
17289
17209
|
return { warnings };
|
|
17290
17210
|
};
|
|
17291
17211
|
|
|
17292
|
-
BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
|
|
17293
|
-
|
|
17294
17212
|
/**
|
|
17295
17213
|
* Export the currently displayed BPMN 2.0 diagram as
|
|
17296
17214
|
* a BPMN 2.0 XML document.
|
|
@@ -17365,8 +17283,6 @@
|
|
|
17365
17283
|
return result;
|
|
17366
17284
|
};
|
|
17367
17285
|
|
|
17368
|
-
BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
|
|
17369
|
-
|
|
17370
17286
|
|
|
17371
17287
|
/**
|
|
17372
17288
|
* Export the currently displayed BPMN 2.0 diagram as
|
|
@@ -17434,40 +17350,6 @@
|
|
|
17434
17350
|
return { svg };
|
|
17435
17351
|
};
|
|
17436
17352
|
|
|
17437
|
-
BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
|
|
17438
|
-
|
|
17439
|
-
/**
|
|
17440
|
-
* Get a named diagram service.
|
|
17441
|
-
*
|
|
17442
|
-
* @example
|
|
17443
|
-
*
|
|
17444
|
-
* const elementRegistry = viewer.get('elementRegistry');
|
|
17445
|
-
* const startEventShape = elementRegistry.get('StartEvent_1');
|
|
17446
|
-
*
|
|
17447
|
-
* @param {string} name
|
|
17448
|
-
*
|
|
17449
|
-
* @return {Object} diagram service instance
|
|
17450
|
-
*
|
|
17451
|
-
* @method BaseViewer#get
|
|
17452
|
-
*/
|
|
17453
|
-
|
|
17454
|
-
/**
|
|
17455
|
-
* Invoke a function in the context of this viewer.
|
|
17456
|
-
*
|
|
17457
|
-
* @example
|
|
17458
|
-
*
|
|
17459
|
-
* viewer.invoke(function(elementRegistry) {
|
|
17460
|
-
* const startEventShape = elementRegistry.get('StartEvent_1');
|
|
17461
|
-
* });
|
|
17462
|
-
*
|
|
17463
|
-
* @param {Function} fn to be invoked
|
|
17464
|
-
*
|
|
17465
|
-
* @return {Object} the functions return value
|
|
17466
|
-
*
|
|
17467
|
-
* @method BaseViewer#invoke
|
|
17468
|
-
*/
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
17353
|
BaseViewer.prototype._setDefinitions = function(definitions) {
|
|
17472
17354
|
this._definitions = definitions;
|
|
17473
17355
|
};
|
|
@@ -38090,7 +37972,7 @@
|
|
|
38090
37972
|
property = reference.property;
|
|
38091
37973
|
|
|
38092
37974
|
if (key === descriptor.id) {
|
|
38093
|
-
element
|
|
37975
|
+
element.set(property, businessObject);
|
|
38094
37976
|
|
|
38095
37977
|
array.push(descriptor.id);
|
|
38096
37978
|
}
|
|
@@ -41298,7 +41180,8 @@
|
|
|
41298
41180
|
assign$1(actions, {
|
|
41299
41181
|
'append.text-annotation': appendAction(
|
|
41300
41182
|
'bpmn:TextAnnotation',
|
|
41301
|
-
'bpmn-icon-text-annotation'
|
|
41183
|
+
'bpmn-icon-text-annotation',
|
|
41184
|
+
translate('Append TextAnnotation')
|
|
41302
41185
|
)
|
|
41303
41186
|
});
|
|
41304
41187
|
}
|
|
@@ -41314,7 +41197,8 @@
|
|
|
41314
41197
|
assign$1(actions, {
|
|
41315
41198
|
'append.text-annotation': appendAction(
|
|
41316
41199
|
'bpmn:TextAnnotation',
|
|
41317
|
-
'bpmn-icon-text-annotation'
|
|
41200
|
+
'bpmn-icon-text-annotation',
|
|
41201
|
+
translate('Append TextAnnotation')
|
|
41318
41202
|
),
|
|
41319
41203
|
|
|
41320
41204
|
'connect': {
|
|
@@ -41365,7 +41249,11 @@
|
|
|
41365
41249
|
|
|
41366
41250
|
if (is$1(businessObject, 'bpmn:Group')) {
|
|
41367
41251
|
assign$1(actions, {
|
|
41368
|
-
'append.text-annotation': appendAction(
|
|
41252
|
+
'append.text-annotation': appendAction(
|
|
41253
|
+
'bpmn:TextAnnotation',
|
|
41254
|
+
'bpmn-icon-text-annotation',
|
|
41255
|
+
translate('Append TextAnnotation')
|
|
41256
|
+
)
|
|
41369
41257
|
});
|
|
41370
41258
|
}
|
|
41371
41259
|
|
|
@@ -46486,12 +46374,18 @@
|
|
|
46486
46374
|
var sequenceFlows = [];
|
|
46487
46375
|
|
|
46488
46376
|
if (is$1(source, 'bpmn:EventBasedGateway')) {
|
|
46489
|
-
sequenceFlows = target.incoming
|
|
46377
|
+
sequenceFlows = target.incoming
|
|
46378
|
+
.filter(flow =>
|
|
46379
|
+
flow !== connection &&
|
|
46380
|
+
isSequenceFlow(flow)
|
|
46381
|
+
);
|
|
46490
46382
|
} else {
|
|
46491
|
-
sequenceFlows = target.incoming
|
|
46492
|
-
|
|
46493
|
-
|
|
46494
|
-
|
|
46383
|
+
sequenceFlows = target.incoming
|
|
46384
|
+
.filter(flow =>
|
|
46385
|
+
flow !== connection &&
|
|
46386
|
+
isSequenceFlow(flow) &&
|
|
46387
|
+
is$1(flow.source, 'bpmn:EventBasedGateway')
|
|
46388
|
+
);
|
|
46495
46389
|
}
|
|
46496
46390
|
|
|
46497
46391
|
sequenceFlows.forEach(function(sequenceFlow) {
|
|
@@ -48515,51 +48409,6 @@
|
|
|
48515
48409
|
};
|
|
48516
48410
|
}
|
|
48517
48411
|
|
|
48518
|
-
/**
|
|
48519
|
-
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
48520
|
-
* @typedef {import('diagram-js/lib/features/tooltips/Tooltips').default} Tooltips
|
|
48521
|
-
* @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
|
|
48522
|
-
*/
|
|
48523
|
-
|
|
48524
|
-
var COLLAB_ERR_MSG = 'flow elements must be children of pools/participants';
|
|
48525
|
-
|
|
48526
|
-
/**
|
|
48527
|
-
* @param {EventBus} eventBus
|
|
48528
|
-
* @param {Tooltips} tooltips
|
|
48529
|
-
* @param {Translate} translate
|
|
48530
|
-
*/
|
|
48531
|
-
function ModelingFeedback(eventBus, tooltips, translate) {
|
|
48532
|
-
|
|
48533
|
-
function showError(position, message, timeout) {
|
|
48534
|
-
tooltips.add({
|
|
48535
|
-
position: {
|
|
48536
|
-
x: position.x + 5,
|
|
48537
|
-
y: position.y + 5
|
|
48538
|
-
},
|
|
48539
|
-
type: 'error',
|
|
48540
|
-
timeout: timeout || 2000,
|
|
48541
|
-
html: '<div>' + message + '</div>'
|
|
48542
|
-
});
|
|
48543
|
-
}
|
|
48544
|
-
|
|
48545
|
-
eventBus.on([ 'shape.move.rejected', 'create.rejected' ], function(event) {
|
|
48546
|
-
var context = event.context,
|
|
48547
|
-
shape = context.shape,
|
|
48548
|
-
target = context.target;
|
|
48549
|
-
|
|
48550
|
-
if (is$1(target, 'bpmn:Collaboration') && is$1(shape, 'bpmn:FlowNode')) {
|
|
48551
|
-
showError(event, translate(COLLAB_ERR_MSG));
|
|
48552
|
-
}
|
|
48553
|
-
});
|
|
48554
|
-
|
|
48555
|
-
}
|
|
48556
|
-
|
|
48557
|
-
ModelingFeedback.$inject = [
|
|
48558
|
-
'eventBus',
|
|
48559
|
-
'tooltips',
|
|
48560
|
-
'translate'
|
|
48561
|
-
];
|
|
48562
|
-
|
|
48563
48412
|
/**
|
|
48564
48413
|
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
48565
48414
|
* @typedef {import('../Modeling').default} Modeling
|
|
@@ -50748,7 +50597,6 @@
|
|
|
50748
50597
|
'labelBehavior',
|
|
50749
50598
|
'layoutConnectionBehavior',
|
|
50750
50599
|
'messageFlowBehavior',
|
|
50751
|
-
'modelingFeedback',
|
|
50752
50600
|
'removeElementBehavior',
|
|
50753
50601
|
'removeEmbeddedLabelBoundsBehavior',
|
|
50754
50602
|
'removeParticipantBehavior',
|
|
@@ -50787,7 +50635,6 @@
|
|
|
50787
50635
|
labelBehavior: [ 'type', LabelBehavior ],
|
|
50788
50636
|
layoutConnectionBehavior: [ 'type', LayoutConnectionBehavior ],
|
|
50789
50637
|
messageFlowBehavior: [ 'type', MessageFlowBehavior ],
|
|
50790
|
-
modelingFeedback: [ 'type', ModelingFeedback ],
|
|
50791
50638
|
removeElementBehavior: [ 'type', RemoveElementBehavior ],
|
|
50792
50639
|
removeEmbeddedLabelBoundsBehavior: [ 'type', RemoveEmbeddedLabelBoundsBehavior ],
|
|
50793
50640
|
removeParticipantBehavior: [ 'type', RemoveParticipantBehavior ],
|
|
@@ -54097,393 +53944,6 @@
|
|
|
54097
53944
|
commandStack: [ 'type', CommandStack ]
|
|
54098
53945
|
};
|
|
54099
53946
|
|
|
54100
|
-
/**
|
|
54101
|
-
* @typedef {import('../../core/Canvas').default} Canvas
|
|
54102
|
-
* @typedef {import('../../core/EventBus').default} EventBus
|
|
54103
|
-
*
|
|
54104
|
-
* @typedef {import('../../util/Types').RectTRBL} RectTRBL
|
|
54105
|
-
*
|
|
54106
|
-
* @typedef { {
|
|
54107
|
-
* html: string | HTMLElement;
|
|
54108
|
-
* position: RectTRBL;
|
|
54109
|
-
* show?: {
|
|
54110
|
-
* minZoom?: number;
|
|
54111
|
-
* maxZoom?: number;
|
|
54112
|
-
* };
|
|
54113
|
-
* timeout?: number;
|
|
54114
|
-
* } } Tooltip
|
|
54115
|
-
*/
|
|
54116
|
-
|
|
54117
|
-
// document wide unique tooltip ids
|
|
54118
|
-
var ids = new IdGenerator('tt');
|
|
54119
|
-
|
|
54120
|
-
|
|
54121
|
-
function createRoot(parentNode) {
|
|
54122
|
-
var root = domify$1(
|
|
54123
|
-
'<div class="djs-tooltip-container" />'
|
|
54124
|
-
);
|
|
54125
|
-
|
|
54126
|
-
assign(root, {
|
|
54127
|
-
position: 'absolute',
|
|
54128
|
-
width: '0',
|
|
54129
|
-
height: '0'
|
|
54130
|
-
});
|
|
54131
|
-
|
|
54132
|
-
parentNode.insertBefore(root, parentNode.firstChild);
|
|
54133
|
-
|
|
54134
|
-
return root;
|
|
54135
|
-
}
|
|
54136
|
-
|
|
54137
|
-
|
|
54138
|
-
function setPosition(el, x, y) {
|
|
54139
|
-
assign(el, { left: x + 'px', top: y + 'px' });
|
|
54140
|
-
}
|
|
54141
|
-
|
|
54142
|
-
function setVisible(el, visible) {
|
|
54143
|
-
el.style.display = visible === false ? 'none' : '';
|
|
54144
|
-
}
|
|
54145
|
-
|
|
54146
|
-
|
|
54147
|
-
var tooltipClass = 'djs-tooltip',
|
|
54148
|
-
tooltipSelector = '.' + tooltipClass;
|
|
54149
|
-
|
|
54150
|
-
/**
|
|
54151
|
-
* A service that allows users to render tool tips on the diagram.
|
|
54152
|
-
*
|
|
54153
|
-
* The tooltip service will take care of updating the tooltip positioning
|
|
54154
|
-
* during navigation + zooming.
|
|
54155
|
-
*
|
|
54156
|
-
* @example
|
|
54157
|
-
*
|
|
54158
|
-
* ```javascript
|
|
54159
|
-
*
|
|
54160
|
-
* // add a pink badge on the top left of the shape
|
|
54161
|
-
* tooltips.add({
|
|
54162
|
-
* position: {
|
|
54163
|
-
* x: 50,
|
|
54164
|
-
* y: 100
|
|
54165
|
-
* },
|
|
54166
|
-
* html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>'
|
|
54167
|
-
* });
|
|
54168
|
-
*
|
|
54169
|
-
* // or with optional life span
|
|
54170
|
-
* tooltips.add({
|
|
54171
|
-
* position: {
|
|
54172
|
-
* top: -5,
|
|
54173
|
-
* left: -5
|
|
54174
|
-
* },
|
|
54175
|
-
* html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>',
|
|
54176
|
-
* ttl: 2000
|
|
54177
|
-
* });
|
|
54178
|
-
*
|
|
54179
|
-
* // remove a tool tip
|
|
54180
|
-
* var id = tooltips.add(...);
|
|
54181
|
-
*
|
|
54182
|
-
* tooltips.remove(id);
|
|
54183
|
-
* ```
|
|
54184
|
-
*
|
|
54185
|
-
* @param {EventBus} eventBus
|
|
54186
|
-
* @param {Canvas} canvas
|
|
54187
|
-
*/
|
|
54188
|
-
function Tooltips(eventBus, canvas) {
|
|
54189
|
-
|
|
54190
|
-
this._eventBus = eventBus;
|
|
54191
|
-
this._canvas = canvas;
|
|
54192
|
-
|
|
54193
|
-
this._ids = ids;
|
|
54194
|
-
|
|
54195
|
-
this._tooltipDefaults = {
|
|
54196
|
-
show: {
|
|
54197
|
-
minZoom: 0.7,
|
|
54198
|
-
maxZoom: 5.0
|
|
54199
|
-
}
|
|
54200
|
-
};
|
|
54201
|
-
|
|
54202
|
-
/**
|
|
54203
|
-
* @type {Record<string, Tooltip>}
|
|
54204
|
-
*/
|
|
54205
|
-
this._tooltips = {};
|
|
54206
|
-
|
|
54207
|
-
// root html element for all tooltips
|
|
54208
|
-
this._tooltipRoot = createRoot(canvas.getContainer());
|
|
54209
|
-
|
|
54210
|
-
|
|
54211
|
-
var self = this;
|
|
54212
|
-
|
|
54213
|
-
delegate.bind(this._tooltipRoot, tooltipSelector, 'mousedown', function(event) {
|
|
54214
|
-
event.stopPropagation();
|
|
54215
|
-
});
|
|
54216
|
-
|
|
54217
|
-
delegate.bind(this._tooltipRoot, tooltipSelector, 'mouseover', function(event) {
|
|
54218
|
-
self.trigger('mouseover', event);
|
|
54219
|
-
});
|
|
54220
|
-
|
|
54221
|
-
delegate.bind(this._tooltipRoot, tooltipSelector, 'mouseout', function(event) {
|
|
54222
|
-
self.trigger('mouseout', event);
|
|
54223
|
-
});
|
|
54224
|
-
|
|
54225
|
-
this._init();
|
|
54226
|
-
}
|
|
54227
|
-
|
|
54228
|
-
|
|
54229
|
-
Tooltips.$inject = [ 'eventBus', 'canvas' ];
|
|
54230
|
-
|
|
54231
|
-
|
|
54232
|
-
/**
|
|
54233
|
-
* Adds an HTML tooltip to the diagram.
|
|
54234
|
-
*
|
|
54235
|
-
* @param {Tooltip} tooltip
|
|
54236
|
-
*
|
|
54237
|
-
* @return {string} ID of the tooltip.
|
|
54238
|
-
*/
|
|
54239
|
-
Tooltips.prototype.add = function(tooltip) {
|
|
54240
|
-
|
|
54241
|
-
if (!tooltip.position) {
|
|
54242
|
-
throw new Error('must specifiy tooltip position');
|
|
54243
|
-
}
|
|
54244
|
-
|
|
54245
|
-
if (!tooltip.html) {
|
|
54246
|
-
throw new Error('must specifiy tooltip html');
|
|
54247
|
-
}
|
|
54248
|
-
|
|
54249
|
-
var id = this._ids.next();
|
|
54250
|
-
|
|
54251
|
-
tooltip = assign$1({}, this._tooltipDefaults, tooltip, {
|
|
54252
|
-
id: id
|
|
54253
|
-
});
|
|
54254
|
-
|
|
54255
|
-
this._addTooltip(tooltip);
|
|
54256
|
-
|
|
54257
|
-
if (tooltip.timeout) {
|
|
54258
|
-
this.setTimeout(tooltip);
|
|
54259
|
-
}
|
|
54260
|
-
|
|
54261
|
-
return id;
|
|
54262
|
-
};
|
|
54263
|
-
|
|
54264
|
-
/**
|
|
54265
|
-
* @param {string} action
|
|
54266
|
-
* @param {Event} event
|
|
54267
|
-
*/
|
|
54268
|
-
Tooltips.prototype.trigger = function(action, event) {
|
|
54269
|
-
|
|
54270
|
-
var node = event.delegateTarget || event.target;
|
|
54271
|
-
|
|
54272
|
-
var tooltip = this.get(attr$1(node, 'data-tooltip-id'));
|
|
54273
|
-
|
|
54274
|
-
if (!tooltip) {
|
|
54275
|
-
return;
|
|
54276
|
-
}
|
|
54277
|
-
|
|
54278
|
-
if (action === 'mouseover' && tooltip.timeout) {
|
|
54279
|
-
this.clearTimeout(tooltip);
|
|
54280
|
-
}
|
|
54281
|
-
|
|
54282
|
-
if (action === 'mouseout' && tooltip.timeout) {
|
|
54283
|
-
|
|
54284
|
-
// cut timeout after mouse out
|
|
54285
|
-
tooltip.timeout = 1000;
|
|
54286
|
-
|
|
54287
|
-
this.setTimeout(tooltip);
|
|
54288
|
-
}
|
|
54289
|
-
};
|
|
54290
|
-
|
|
54291
|
-
/**
|
|
54292
|
-
* Get tooltip with given ID.
|
|
54293
|
-
*
|
|
54294
|
-
* @param {Tooltip|string} id
|
|
54295
|
-
*
|
|
54296
|
-
* @return {Tooltip|undefined}
|
|
54297
|
-
*/
|
|
54298
|
-
Tooltips.prototype.get = function(id) {
|
|
54299
|
-
|
|
54300
|
-
if (typeof id !== 'string') {
|
|
54301
|
-
id = id.id;
|
|
54302
|
-
}
|
|
54303
|
-
|
|
54304
|
-
return this._tooltips[id];
|
|
54305
|
-
};
|
|
54306
|
-
|
|
54307
|
-
/**
|
|
54308
|
-
* @param {Tooltip} tooltip
|
|
54309
|
-
*/
|
|
54310
|
-
Tooltips.prototype.clearTimeout = function(tooltip) {
|
|
54311
|
-
|
|
54312
|
-
tooltip = this.get(tooltip);
|
|
54313
|
-
|
|
54314
|
-
if (!tooltip) {
|
|
54315
|
-
return;
|
|
54316
|
-
}
|
|
54317
|
-
|
|
54318
|
-
var removeTimer = tooltip.removeTimer;
|
|
54319
|
-
|
|
54320
|
-
if (removeTimer) {
|
|
54321
|
-
clearTimeout(removeTimer);
|
|
54322
|
-
tooltip.removeTimer = null;
|
|
54323
|
-
}
|
|
54324
|
-
};
|
|
54325
|
-
|
|
54326
|
-
/**
|
|
54327
|
-
* @param {Tooltip} tooltip
|
|
54328
|
-
*/
|
|
54329
|
-
Tooltips.prototype.setTimeout = function(tooltip) {
|
|
54330
|
-
|
|
54331
|
-
tooltip = this.get(tooltip);
|
|
54332
|
-
|
|
54333
|
-
if (!tooltip) {
|
|
54334
|
-
return;
|
|
54335
|
-
}
|
|
54336
|
-
|
|
54337
|
-
this.clearTimeout(tooltip);
|
|
54338
|
-
|
|
54339
|
-
var self = this;
|
|
54340
|
-
|
|
54341
|
-
tooltip.removeTimer = setTimeout(function() {
|
|
54342
|
-
self.remove(tooltip);
|
|
54343
|
-
}, tooltip.timeout);
|
|
54344
|
-
};
|
|
54345
|
-
|
|
54346
|
-
/**
|
|
54347
|
-
* Remove tooltip with given ID.
|
|
54348
|
-
*
|
|
54349
|
-
* @param {string | Tooltip} id
|
|
54350
|
-
*/
|
|
54351
|
-
Tooltips.prototype.remove = function(id) {
|
|
54352
|
-
|
|
54353
|
-
var tooltip = this.get(id);
|
|
54354
|
-
|
|
54355
|
-
if (tooltip) {
|
|
54356
|
-
remove$2(tooltip.html);
|
|
54357
|
-
remove$2(tooltip.htmlContainer);
|
|
54358
|
-
|
|
54359
|
-
delete tooltip.htmlContainer;
|
|
54360
|
-
|
|
54361
|
-
delete this._tooltips[tooltip.id];
|
|
54362
|
-
}
|
|
54363
|
-
};
|
|
54364
|
-
|
|
54365
|
-
|
|
54366
|
-
Tooltips.prototype.show = function() {
|
|
54367
|
-
setVisible(this._tooltipRoot);
|
|
54368
|
-
};
|
|
54369
|
-
|
|
54370
|
-
|
|
54371
|
-
Tooltips.prototype.hide = function() {
|
|
54372
|
-
setVisible(this._tooltipRoot, false);
|
|
54373
|
-
};
|
|
54374
|
-
|
|
54375
|
-
|
|
54376
|
-
Tooltips.prototype._updateRoot = function(viewbox) {
|
|
54377
|
-
var a = viewbox.scale || 1;
|
|
54378
|
-
var d = viewbox.scale || 1;
|
|
54379
|
-
|
|
54380
|
-
var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';
|
|
54381
|
-
|
|
54382
|
-
this._tooltipRoot.style.transform = matrix;
|
|
54383
|
-
this._tooltipRoot.style['-ms-transform'] = matrix;
|
|
54384
|
-
};
|
|
54385
|
-
|
|
54386
|
-
|
|
54387
|
-
Tooltips.prototype._addTooltip = function(tooltip) {
|
|
54388
|
-
|
|
54389
|
-
var id = tooltip.id,
|
|
54390
|
-
html = tooltip.html,
|
|
54391
|
-
htmlContainer,
|
|
54392
|
-
tooltipRoot = this._tooltipRoot;
|
|
54393
|
-
|
|
54394
|
-
// unwrap jquery (for those who need it)
|
|
54395
|
-
if (html.get && html.constructor.prototype.jquery) {
|
|
54396
|
-
html = html.get(0);
|
|
54397
|
-
}
|
|
54398
|
-
|
|
54399
|
-
// create proper html elements from
|
|
54400
|
-
// tooltip HTML strings
|
|
54401
|
-
if (isString(html)) {
|
|
54402
|
-
html = domify$1(html);
|
|
54403
|
-
}
|
|
54404
|
-
|
|
54405
|
-
htmlContainer = domify$1('<div data-tooltip-id="' + id + '" class="' + tooltipClass + '">');
|
|
54406
|
-
assign(htmlContainer, { position: 'absolute' });
|
|
54407
|
-
|
|
54408
|
-
htmlContainer.appendChild(html);
|
|
54409
|
-
|
|
54410
|
-
if (tooltip.type) {
|
|
54411
|
-
classes$1(htmlContainer).add('djs-tooltip-' + tooltip.type);
|
|
54412
|
-
}
|
|
54413
|
-
|
|
54414
|
-
if (tooltip.className) {
|
|
54415
|
-
classes$1(htmlContainer).add(tooltip.className);
|
|
54416
|
-
}
|
|
54417
|
-
|
|
54418
|
-
tooltip.htmlContainer = htmlContainer;
|
|
54419
|
-
|
|
54420
|
-
tooltipRoot.appendChild(htmlContainer);
|
|
54421
|
-
|
|
54422
|
-
this._tooltips[id] = tooltip;
|
|
54423
|
-
|
|
54424
|
-
this._updateTooltip(tooltip);
|
|
54425
|
-
};
|
|
54426
|
-
|
|
54427
|
-
|
|
54428
|
-
Tooltips.prototype._updateTooltip = function(tooltip) {
|
|
54429
|
-
|
|
54430
|
-
var position = tooltip.position,
|
|
54431
|
-
htmlContainer = tooltip.htmlContainer;
|
|
54432
|
-
|
|
54433
|
-
// update overlay html based on tooltip x, y
|
|
54434
|
-
|
|
54435
|
-
setPosition(htmlContainer, position.x, position.y);
|
|
54436
|
-
};
|
|
54437
|
-
|
|
54438
|
-
|
|
54439
|
-
Tooltips.prototype._updateTooltipVisibilty = function(viewbox) {
|
|
54440
|
-
|
|
54441
|
-
forEach$1(this._tooltips, function(tooltip) {
|
|
54442
|
-
var show = tooltip.show,
|
|
54443
|
-
htmlContainer = tooltip.htmlContainer,
|
|
54444
|
-
visible = true;
|
|
54445
|
-
|
|
54446
|
-
if (show) {
|
|
54447
|
-
if (show.minZoom > viewbox.scale ||
|
|
54448
|
-
show.maxZoom < viewbox.scale) {
|
|
54449
|
-
visible = false;
|
|
54450
|
-
}
|
|
54451
|
-
|
|
54452
|
-
setVisible(htmlContainer, visible);
|
|
54453
|
-
}
|
|
54454
|
-
});
|
|
54455
|
-
};
|
|
54456
|
-
|
|
54457
|
-
Tooltips.prototype._init = function() {
|
|
54458
|
-
|
|
54459
|
-
var self = this;
|
|
54460
|
-
|
|
54461
|
-
// scroll/zoom integration
|
|
54462
|
-
|
|
54463
|
-
function updateViewbox(viewbox) {
|
|
54464
|
-
self._updateRoot(viewbox);
|
|
54465
|
-
self._updateTooltipVisibilty(viewbox);
|
|
54466
|
-
|
|
54467
|
-
self.show();
|
|
54468
|
-
}
|
|
54469
|
-
|
|
54470
|
-
this._eventBus.on('canvas.viewbox.changing', function(event) {
|
|
54471
|
-
self.hide();
|
|
54472
|
-
});
|
|
54473
|
-
|
|
54474
|
-
this._eventBus.on('canvas.viewbox.changed', function(event) {
|
|
54475
|
-
updateViewbox(event.viewbox);
|
|
54476
|
-
});
|
|
54477
|
-
};
|
|
54478
|
-
|
|
54479
|
-
/**
|
|
54480
|
-
* @type { import('didi').ModuleDeclaration }
|
|
54481
|
-
*/
|
|
54482
|
-
var TooltipsModule = {
|
|
54483
|
-
__init__: [ 'tooltips' ],
|
|
54484
|
-
tooltips: [ 'type', Tooltips ]
|
|
54485
|
-
};
|
|
54486
|
-
|
|
54487
53947
|
/**
|
|
54488
53948
|
* Remove from the beginning of a collection until it is empty.
|
|
54489
53949
|
*
|
|
@@ -62003,7 +61463,6 @@
|
|
|
62003
61463
|
OrderingModule,
|
|
62004
61464
|
ReplaceModule,
|
|
62005
61465
|
CommandModule,
|
|
62006
|
-
TooltipsModule,
|
|
62007
61466
|
LabelSupportModule,
|
|
62008
61467
|
AttachSupportModule,
|
|
62009
61468
|
SelectionModule,
|
|
@@ -62018,6 +61477,448 @@
|
|
|
62018
61477
|
connectionDocking: [ 'type', CroppingConnectionDocking ]
|
|
62019
61478
|
};
|
|
62020
61479
|
|
|
61480
|
+
/**
|
|
61481
|
+
* @typedef {import('../../core/Canvas').default} Canvas
|
|
61482
|
+
* @typedef {import('../../core/EventBus').default} EventBus
|
|
61483
|
+
*
|
|
61484
|
+
* @typedef {import('../../util/Types').RectTRBL} RectTRBL
|
|
61485
|
+
*
|
|
61486
|
+
* @typedef { {
|
|
61487
|
+
* html: string | HTMLElement;
|
|
61488
|
+
* position: RectTRBL;
|
|
61489
|
+
* show?: {
|
|
61490
|
+
* minZoom?: number;
|
|
61491
|
+
* maxZoom?: number;
|
|
61492
|
+
* };
|
|
61493
|
+
* timeout?: number;
|
|
61494
|
+
* } } Tooltip
|
|
61495
|
+
*/
|
|
61496
|
+
|
|
61497
|
+
// document wide unique tooltip ids
|
|
61498
|
+
var ids = new IdGenerator('tt');
|
|
61499
|
+
|
|
61500
|
+
|
|
61501
|
+
function createRoot(parentNode) {
|
|
61502
|
+
var root = domify$1(
|
|
61503
|
+
'<div class="djs-tooltip-container" />'
|
|
61504
|
+
);
|
|
61505
|
+
|
|
61506
|
+
assign(root, {
|
|
61507
|
+
position: 'absolute',
|
|
61508
|
+
width: '0',
|
|
61509
|
+
height: '0'
|
|
61510
|
+
});
|
|
61511
|
+
|
|
61512
|
+
parentNode.insertBefore(root, parentNode.firstChild);
|
|
61513
|
+
|
|
61514
|
+
return root;
|
|
61515
|
+
}
|
|
61516
|
+
|
|
61517
|
+
|
|
61518
|
+
function setPosition(el, x, y) {
|
|
61519
|
+
assign(el, { left: x + 'px', top: y + 'px' });
|
|
61520
|
+
}
|
|
61521
|
+
|
|
61522
|
+
function setVisible(el, visible) {
|
|
61523
|
+
el.style.display = visible === false ? 'none' : '';
|
|
61524
|
+
}
|
|
61525
|
+
|
|
61526
|
+
|
|
61527
|
+
var tooltipClass = 'djs-tooltip',
|
|
61528
|
+
tooltipSelector = '.' + tooltipClass;
|
|
61529
|
+
|
|
61530
|
+
/**
|
|
61531
|
+
* A service that allows users to render tool tips on the diagram.
|
|
61532
|
+
*
|
|
61533
|
+
* The tooltip service will take care of updating the tooltip positioning
|
|
61534
|
+
* during navigation + zooming.
|
|
61535
|
+
*
|
|
61536
|
+
* @example
|
|
61537
|
+
*
|
|
61538
|
+
* ```javascript
|
|
61539
|
+
*
|
|
61540
|
+
* // add a pink badge on the top left of the shape
|
|
61541
|
+
* tooltips.add({
|
|
61542
|
+
* position: {
|
|
61543
|
+
* x: 50,
|
|
61544
|
+
* y: 100
|
|
61545
|
+
* },
|
|
61546
|
+
* html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>'
|
|
61547
|
+
* });
|
|
61548
|
+
*
|
|
61549
|
+
* // or with optional life span
|
|
61550
|
+
* tooltips.add({
|
|
61551
|
+
* position: {
|
|
61552
|
+
* top: -5,
|
|
61553
|
+
* left: -5
|
|
61554
|
+
* },
|
|
61555
|
+
* html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>',
|
|
61556
|
+
* ttl: 2000
|
|
61557
|
+
* });
|
|
61558
|
+
*
|
|
61559
|
+
* // remove a tool tip
|
|
61560
|
+
* var id = tooltips.add(...);
|
|
61561
|
+
*
|
|
61562
|
+
* tooltips.remove(id);
|
|
61563
|
+
* ```
|
|
61564
|
+
*
|
|
61565
|
+
* @param {EventBus} eventBus
|
|
61566
|
+
* @param {Canvas} canvas
|
|
61567
|
+
*/
|
|
61568
|
+
function Tooltips(eventBus, canvas) {
|
|
61569
|
+
|
|
61570
|
+
this._eventBus = eventBus;
|
|
61571
|
+
this._canvas = canvas;
|
|
61572
|
+
|
|
61573
|
+
this._ids = ids;
|
|
61574
|
+
|
|
61575
|
+
this._tooltipDefaults = {
|
|
61576
|
+
show: {
|
|
61577
|
+
minZoom: 0.7,
|
|
61578
|
+
maxZoom: 5.0
|
|
61579
|
+
}
|
|
61580
|
+
};
|
|
61581
|
+
|
|
61582
|
+
/**
|
|
61583
|
+
* @type {Record<string, Tooltip>}
|
|
61584
|
+
*/
|
|
61585
|
+
this._tooltips = {};
|
|
61586
|
+
|
|
61587
|
+
// root html element for all tooltips
|
|
61588
|
+
this._tooltipRoot = createRoot(canvas.getContainer());
|
|
61589
|
+
|
|
61590
|
+
|
|
61591
|
+
var self = this;
|
|
61592
|
+
|
|
61593
|
+
delegate.bind(this._tooltipRoot, tooltipSelector, 'mousedown', function(event) {
|
|
61594
|
+
event.stopPropagation();
|
|
61595
|
+
});
|
|
61596
|
+
|
|
61597
|
+
delegate.bind(this._tooltipRoot, tooltipSelector, 'mouseover', function(event) {
|
|
61598
|
+
self.trigger('mouseover', event);
|
|
61599
|
+
});
|
|
61600
|
+
|
|
61601
|
+
delegate.bind(this._tooltipRoot, tooltipSelector, 'mouseout', function(event) {
|
|
61602
|
+
self.trigger('mouseout', event);
|
|
61603
|
+
});
|
|
61604
|
+
|
|
61605
|
+
this._init();
|
|
61606
|
+
}
|
|
61607
|
+
|
|
61608
|
+
|
|
61609
|
+
Tooltips.$inject = [ 'eventBus', 'canvas' ];
|
|
61610
|
+
|
|
61611
|
+
|
|
61612
|
+
/**
|
|
61613
|
+
* Adds an HTML tooltip to the diagram.
|
|
61614
|
+
*
|
|
61615
|
+
* @param {Tooltip} tooltip
|
|
61616
|
+
*
|
|
61617
|
+
* @return {string} ID of the tooltip.
|
|
61618
|
+
*/
|
|
61619
|
+
Tooltips.prototype.add = function(tooltip) {
|
|
61620
|
+
|
|
61621
|
+
if (!tooltip.position) {
|
|
61622
|
+
throw new Error('must specifiy tooltip position');
|
|
61623
|
+
}
|
|
61624
|
+
|
|
61625
|
+
if (!tooltip.html) {
|
|
61626
|
+
throw new Error('must specifiy tooltip html');
|
|
61627
|
+
}
|
|
61628
|
+
|
|
61629
|
+
var id = this._ids.next();
|
|
61630
|
+
|
|
61631
|
+
tooltip = assign$1({}, this._tooltipDefaults, tooltip, {
|
|
61632
|
+
id: id
|
|
61633
|
+
});
|
|
61634
|
+
|
|
61635
|
+
this._addTooltip(tooltip);
|
|
61636
|
+
|
|
61637
|
+
if (tooltip.timeout) {
|
|
61638
|
+
this.setTimeout(tooltip);
|
|
61639
|
+
}
|
|
61640
|
+
|
|
61641
|
+
return id;
|
|
61642
|
+
};
|
|
61643
|
+
|
|
61644
|
+
/**
|
|
61645
|
+
* @param {string} action
|
|
61646
|
+
* @param {Event} event
|
|
61647
|
+
*/
|
|
61648
|
+
Tooltips.prototype.trigger = function(action, event) {
|
|
61649
|
+
|
|
61650
|
+
var node = event.delegateTarget || event.target;
|
|
61651
|
+
|
|
61652
|
+
var tooltip = this.get(attr$1(node, 'data-tooltip-id'));
|
|
61653
|
+
|
|
61654
|
+
if (!tooltip) {
|
|
61655
|
+
return;
|
|
61656
|
+
}
|
|
61657
|
+
|
|
61658
|
+
if (action === 'mouseover' && tooltip.timeout) {
|
|
61659
|
+
this.clearTimeout(tooltip);
|
|
61660
|
+
}
|
|
61661
|
+
|
|
61662
|
+
if (action === 'mouseout' && tooltip.timeout) {
|
|
61663
|
+
|
|
61664
|
+
// cut timeout after mouse out
|
|
61665
|
+
tooltip.timeout = 1000;
|
|
61666
|
+
|
|
61667
|
+
this.setTimeout(tooltip);
|
|
61668
|
+
}
|
|
61669
|
+
};
|
|
61670
|
+
|
|
61671
|
+
/**
|
|
61672
|
+
* Get tooltip with given ID.
|
|
61673
|
+
*
|
|
61674
|
+
* @param {Tooltip|string} id
|
|
61675
|
+
*
|
|
61676
|
+
* @return {Tooltip|undefined}
|
|
61677
|
+
*/
|
|
61678
|
+
Tooltips.prototype.get = function(id) {
|
|
61679
|
+
|
|
61680
|
+
if (typeof id !== 'string') {
|
|
61681
|
+
id = id.id;
|
|
61682
|
+
}
|
|
61683
|
+
|
|
61684
|
+
return this._tooltips[id];
|
|
61685
|
+
};
|
|
61686
|
+
|
|
61687
|
+
/**
|
|
61688
|
+
* @param {Tooltip} tooltip
|
|
61689
|
+
*/
|
|
61690
|
+
Tooltips.prototype.clearTimeout = function(tooltip) {
|
|
61691
|
+
|
|
61692
|
+
tooltip = this.get(tooltip);
|
|
61693
|
+
|
|
61694
|
+
if (!tooltip) {
|
|
61695
|
+
return;
|
|
61696
|
+
}
|
|
61697
|
+
|
|
61698
|
+
var removeTimer = tooltip.removeTimer;
|
|
61699
|
+
|
|
61700
|
+
if (removeTimer) {
|
|
61701
|
+
clearTimeout(removeTimer);
|
|
61702
|
+
tooltip.removeTimer = null;
|
|
61703
|
+
}
|
|
61704
|
+
};
|
|
61705
|
+
|
|
61706
|
+
/**
|
|
61707
|
+
* @param {Tooltip} tooltip
|
|
61708
|
+
*/
|
|
61709
|
+
Tooltips.prototype.setTimeout = function(tooltip) {
|
|
61710
|
+
|
|
61711
|
+
tooltip = this.get(tooltip);
|
|
61712
|
+
|
|
61713
|
+
if (!tooltip) {
|
|
61714
|
+
return;
|
|
61715
|
+
}
|
|
61716
|
+
|
|
61717
|
+
this.clearTimeout(tooltip);
|
|
61718
|
+
|
|
61719
|
+
var self = this;
|
|
61720
|
+
|
|
61721
|
+
tooltip.removeTimer = setTimeout(function() {
|
|
61722
|
+
self.remove(tooltip);
|
|
61723
|
+
}, tooltip.timeout);
|
|
61724
|
+
};
|
|
61725
|
+
|
|
61726
|
+
/**
|
|
61727
|
+
* Remove tooltip with given ID.
|
|
61728
|
+
*
|
|
61729
|
+
* @param {string | Tooltip} id
|
|
61730
|
+
*/
|
|
61731
|
+
Tooltips.prototype.remove = function(id) {
|
|
61732
|
+
|
|
61733
|
+
var tooltip = this.get(id);
|
|
61734
|
+
|
|
61735
|
+
if (tooltip) {
|
|
61736
|
+
remove$2(tooltip.html);
|
|
61737
|
+
remove$2(tooltip.htmlContainer);
|
|
61738
|
+
|
|
61739
|
+
delete tooltip.htmlContainer;
|
|
61740
|
+
|
|
61741
|
+
delete this._tooltips[tooltip.id];
|
|
61742
|
+
}
|
|
61743
|
+
};
|
|
61744
|
+
|
|
61745
|
+
|
|
61746
|
+
Tooltips.prototype.show = function() {
|
|
61747
|
+
setVisible(this._tooltipRoot);
|
|
61748
|
+
};
|
|
61749
|
+
|
|
61750
|
+
|
|
61751
|
+
Tooltips.prototype.hide = function() {
|
|
61752
|
+
setVisible(this._tooltipRoot, false);
|
|
61753
|
+
};
|
|
61754
|
+
|
|
61755
|
+
|
|
61756
|
+
Tooltips.prototype._updateRoot = function(viewbox) {
|
|
61757
|
+
var a = viewbox.scale || 1;
|
|
61758
|
+
var d = viewbox.scale || 1;
|
|
61759
|
+
|
|
61760
|
+
var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';
|
|
61761
|
+
|
|
61762
|
+
this._tooltipRoot.style.transform = matrix;
|
|
61763
|
+
this._tooltipRoot.style['-ms-transform'] = matrix;
|
|
61764
|
+
};
|
|
61765
|
+
|
|
61766
|
+
|
|
61767
|
+
Tooltips.prototype._addTooltip = function(tooltip) {
|
|
61768
|
+
|
|
61769
|
+
var id = tooltip.id,
|
|
61770
|
+
html = tooltip.html,
|
|
61771
|
+
htmlContainer,
|
|
61772
|
+
tooltipRoot = this._tooltipRoot;
|
|
61773
|
+
|
|
61774
|
+
// unwrap jquery (for those who need it)
|
|
61775
|
+
if (html.get && html.constructor.prototype.jquery) {
|
|
61776
|
+
html = html.get(0);
|
|
61777
|
+
}
|
|
61778
|
+
|
|
61779
|
+
// create proper html elements from
|
|
61780
|
+
// tooltip HTML strings
|
|
61781
|
+
if (isString(html)) {
|
|
61782
|
+
html = domify$1(html);
|
|
61783
|
+
}
|
|
61784
|
+
|
|
61785
|
+
htmlContainer = domify$1('<div data-tooltip-id="' + id + '" class="' + tooltipClass + '">');
|
|
61786
|
+
assign(htmlContainer, { position: 'absolute' });
|
|
61787
|
+
|
|
61788
|
+
htmlContainer.appendChild(html);
|
|
61789
|
+
|
|
61790
|
+
if (tooltip.type) {
|
|
61791
|
+
classes$1(htmlContainer).add('djs-tooltip-' + tooltip.type);
|
|
61792
|
+
}
|
|
61793
|
+
|
|
61794
|
+
if (tooltip.className) {
|
|
61795
|
+
classes$1(htmlContainer).add(tooltip.className);
|
|
61796
|
+
}
|
|
61797
|
+
|
|
61798
|
+
tooltip.htmlContainer = htmlContainer;
|
|
61799
|
+
|
|
61800
|
+
tooltipRoot.appendChild(htmlContainer);
|
|
61801
|
+
|
|
61802
|
+
this._tooltips[id] = tooltip;
|
|
61803
|
+
|
|
61804
|
+
this._updateTooltip(tooltip);
|
|
61805
|
+
};
|
|
61806
|
+
|
|
61807
|
+
|
|
61808
|
+
Tooltips.prototype._updateTooltip = function(tooltip) {
|
|
61809
|
+
|
|
61810
|
+
var position = tooltip.position,
|
|
61811
|
+
htmlContainer = tooltip.htmlContainer;
|
|
61812
|
+
|
|
61813
|
+
// update overlay html based on tooltip x, y
|
|
61814
|
+
|
|
61815
|
+
setPosition(htmlContainer, position.x, position.y);
|
|
61816
|
+
};
|
|
61817
|
+
|
|
61818
|
+
|
|
61819
|
+
Tooltips.prototype._updateTooltipVisibilty = function(viewbox) {
|
|
61820
|
+
|
|
61821
|
+
forEach$1(this._tooltips, function(tooltip) {
|
|
61822
|
+
var show = tooltip.show,
|
|
61823
|
+
htmlContainer = tooltip.htmlContainer,
|
|
61824
|
+
visible = true;
|
|
61825
|
+
|
|
61826
|
+
if (show) {
|
|
61827
|
+
if (show.minZoom > viewbox.scale ||
|
|
61828
|
+
show.maxZoom < viewbox.scale) {
|
|
61829
|
+
visible = false;
|
|
61830
|
+
}
|
|
61831
|
+
|
|
61832
|
+
setVisible(htmlContainer, visible);
|
|
61833
|
+
}
|
|
61834
|
+
});
|
|
61835
|
+
};
|
|
61836
|
+
|
|
61837
|
+
Tooltips.prototype._init = function() {
|
|
61838
|
+
|
|
61839
|
+
var self = this;
|
|
61840
|
+
|
|
61841
|
+
// scroll/zoom integration
|
|
61842
|
+
|
|
61843
|
+
function updateViewbox(viewbox) {
|
|
61844
|
+
self._updateRoot(viewbox);
|
|
61845
|
+
self._updateTooltipVisibilty(viewbox);
|
|
61846
|
+
|
|
61847
|
+
self.show();
|
|
61848
|
+
}
|
|
61849
|
+
|
|
61850
|
+
this._eventBus.on('canvas.viewbox.changing', function(event) {
|
|
61851
|
+
self.hide();
|
|
61852
|
+
});
|
|
61853
|
+
|
|
61854
|
+
this._eventBus.on('canvas.viewbox.changed', function(event) {
|
|
61855
|
+
updateViewbox(event.viewbox);
|
|
61856
|
+
});
|
|
61857
|
+
};
|
|
61858
|
+
|
|
61859
|
+
/**
|
|
61860
|
+
* @type { import('didi').ModuleDeclaration }
|
|
61861
|
+
*/
|
|
61862
|
+
var TooltipsModule = {
|
|
61863
|
+
__init__: [ 'tooltips' ],
|
|
61864
|
+
tooltips: [ 'type', Tooltips ]
|
|
61865
|
+
};
|
|
61866
|
+
|
|
61867
|
+
/**
|
|
61868
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
61869
|
+
* @typedef {import('diagram-js/lib/features/tooltips/Tooltips').default} Tooltips
|
|
61870
|
+
* @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
|
|
61871
|
+
*/
|
|
61872
|
+
|
|
61873
|
+
var COLLAB_ERR_MSG = 'flow elements must be children of pools/participants';
|
|
61874
|
+
|
|
61875
|
+
/**
|
|
61876
|
+
* @param {EventBus} eventBus
|
|
61877
|
+
* @param {Tooltips} tooltips
|
|
61878
|
+
* @param {Translate} translate
|
|
61879
|
+
*/
|
|
61880
|
+
function ModelingFeedback(eventBus, tooltips, translate) {
|
|
61881
|
+
|
|
61882
|
+
function showError(position, message, timeout) {
|
|
61883
|
+
tooltips.add({
|
|
61884
|
+
position: {
|
|
61885
|
+
x: position.x + 5,
|
|
61886
|
+
y: position.y + 5
|
|
61887
|
+
},
|
|
61888
|
+
type: 'error',
|
|
61889
|
+
timeout: timeout || 2000,
|
|
61890
|
+
html: '<div>' + message + '</div>'
|
|
61891
|
+
});
|
|
61892
|
+
}
|
|
61893
|
+
|
|
61894
|
+
eventBus.on([ 'shape.move.rejected', 'create.rejected' ], function(event) {
|
|
61895
|
+
var context = event.context,
|
|
61896
|
+
shape = context.shape,
|
|
61897
|
+
target = context.target;
|
|
61898
|
+
|
|
61899
|
+
if (is$1(target, 'bpmn:Collaboration') && is$1(shape, 'bpmn:FlowNode')) {
|
|
61900
|
+
showError(event, translate(COLLAB_ERR_MSG));
|
|
61901
|
+
}
|
|
61902
|
+
});
|
|
61903
|
+
|
|
61904
|
+
}
|
|
61905
|
+
|
|
61906
|
+
ModelingFeedback.$inject = [
|
|
61907
|
+
'eventBus',
|
|
61908
|
+
'tooltips',
|
|
61909
|
+
'translate'
|
|
61910
|
+
];
|
|
61911
|
+
|
|
61912
|
+
var ModelingFeedbackModule = {
|
|
61913
|
+
__depends__: [
|
|
61914
|
+
TooltipsModule
|
|
61915
|
+
],
|
|
61916
|
+
__init__: [
|
|
61917
|
+
'modelingFeedback'
|
|
61918
|
+
],
|
|
61919
|
+
modelingFeedback: [ 'type', ModelingFeedback ]
|
|
61920
|
+
};
|
|
61921
|
+
|
|
62021
61922
|
/**
|
|
62022
61923
|
* @typedef {import('../../core/Types').ElementLike} Element
|
|
62023
61924
|
* @typedef {import('../../core/Types').ShapeLike} Shape
|
|
@@ -66030,8 +65931,6 @@
|
|
|
66030
65931
|
return this.importXML(initialDiagram);
|
|
66031
65932
|
};
|
|
66032
65933
|
|
|
66033
|
-
Modeler.prototype.createDiagram = wrapForCompatibility(Modeler.prototype.createDiagram);
|
|
66034
|
-
|
|
66035
65934
|
|
|
66036
65935
|
Modeler.prototype._interactionModules = [
|
|
66037
65936
|
|
|
@@ -66063,6 +65962,7 @@
|
|
|
66063
65962
|
KeyboardMoveSelectionModule,
|
|
66064
65963
|
LabelEditingModule,
|
|
66065
65964
|
ModelingModule,
|
|
65965
|
+
ModelingFeedbackModule,
|
|
66066
65966
|
MoveModule,
|
|
66067
65967
|
PaletteModule,
|
|
66068
65968
|
ReplacePreviewModule,
|