camunda-bpmn-js 5.15.0 → 5.17.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/element-template-chooser.css +1 -1
- package/dist/base-modeler.development.js +57316 -54087
- package/dist/base-modeler.production.min.js +45 -45
- package/dist/base-navigated-viewer.development.js +1958 -1314
- package/dist/base-navigated-viewer.production.min.js +1 -1
- package/dist/base-viewer.development.js +1221 -599
- package/dist/base-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-modeler.development.js +14537 -7986
- package/dist/camunda-cloud-modeler.production.min.js +47 -47
- package/dist/camunda-cloud-navigated-viewer.development.js +1850 -1171
- package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-viewer.development.js +1842 -1185
- package/dist/camunda-cloud-viewer.production.min.js +1 -1
- package/dist/camunda-platform-modeler.development.js +11979 -6776
- package/dist/camunda-platform-modeler.production.min.js +45 -45
- package/dist/camunda-platform-navigated-viewer.development.js +1839 -1183
- package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-platform-viewer.development.js +1818 -1184
- package/dist/camunda-platform-viewer.production.min.js +1 -1
- package/lib/base/Modeler.js +12 -0
- package/lib/base/NavigatedViewer.js +10 -0
- package/lib/base/Viewer.js +10 -0
- package/lib/camunda-cloud/ElementTemplatesValidator.js +10 -0
- package/lib/camunda-cloud/Modeler.js +10 -0
- package/lib/camunda-cloud/NavigatedViewer.js +10 -0
- package/lib/camunda-cloud/Viewer.js +10 -0
- package/lib/camunda-cloud/features/external-resources/README.md +1 -1
- package/lib/camunda-cloud/features/external-resources/ResourceLoader.d.ts +9 -0
- package/lib/camunda-cloud/features/external-resources/ResourceLoader.js +10 -0
- package/lib/camunda-cloud/features/external-resources/Resources.d.ts +9 -0
- package/lib/camunda-cloud/features/external-resources/Resources.js +10 -0
- package/lib/camunda-cloud/features/external-resources/cmd/ComposedCommandHandler.d.ts +9 -0
- package/lib/camunda-cloud/features/external-resources/cmd/ComposedCommandHandler.js +10 -0
- package/lib/camunda-cloud/features/external-resources/cmd/index.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/decision/AppendMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/decision/CreateMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/decision/ReplaceMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/decision/createElement.d.ts +15 -5
- package/lib/camunda-cloud/features/external-resources/handlers/decision/createElement.js +29 -4
- package/lib/camunda-cloud/features/external-resources/handlers/decision/index.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/decision/replaceElement.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/decision/searchTerms.d.ts +9 -0
- package/lib/camunda-cloud/features/external-resources/handlers/decision/searchTerms.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/form/AppendMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/form/CreateMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/form/ReplaceMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/form/createElement.d.ts +15 -1
- package/lib/camunda-cloud/features/external-resources/handlers/form/createElement.js +28 -3
- package/lib/camunda-cloud/features/external-resources/handlers/form/index.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/form/replaceElement.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/form/searchTerms.d.ts +9 -0
- package/lib/camunda-cloud/features/external-resources/handlers/form/searchTerms.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/process/AppendMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/process/CreateMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/process/ReplaceMenuProvider.js +11 -1
- package/lib/camunda-cloud/features/external-resources/handlers/process/createElement.d.ts +14 -5
- package/lib/camunda-cloud/features/external-resources/handlers/process/createElement.js +35 -4
- package/lib/camunda-cloud/features/external-resources/handlers/process/index.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/process/replaceElement.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/process/searchTerms.d.ts +9 -0
- package/lib/camunda-cloud/features/external-resources/handlers/process/searchTerms.js +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/AppendMenuProvider.d.ts +6 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/AppendMenuProvider.js +41 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/CreateMenuProvider.d.ts +6 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/CreateMenuProvider.js +41 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/ReplaceMenuProvider.d.ts +6 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/ReplaceMenuProvider.js +41 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/constants.d.ts +12 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/constants.js +14 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/createElement.d.ts +14 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/createElement.js +61 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/index.d.ts +8 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/index.js +20 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/replaceElement.d.ts +15 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/replaceElement.js +59 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/searchTerms.d.ts +10 -0
- package/lib/camunda-cloud/features/external-resources/handlers/rpa/searchTerms.js +11 -0
- package/lib/camunda-cloud/features/external-resources/handlers/util/BaseAppendMenuProvider.d.ts +21 -4
- package/lib/camunda-cloud/features/external-resources/handlers/util/BaseAppendMenuProvider.js +26 -8
- package/lib/camunda-cloud/features/external-resources/handlers/util/BaseCreateMenuProvider.d.ts +19 -3
- package/lib/camunda-cloud/features/external-resources/handlers/util/BaseCreateMenuProvider.js +24 -7
- package/lib/camunda-cloud/features/external-resources/handlers/util/BaseReplaceMenuProvider.d.ts +6 -2
- package/lib/camunda-cloud/features/external-resources/handlers/util/BaseReplaceMenuProvider.js +19 -6
- package/lib/camunda-cloud/features/external-resources/index.d.ts +4 -0
- package/lib/camunda-cloud/features/external-resources/index.js +13 -1
- package/lib/camunda-cloud/features/popup-menu/CamundaDetailsPopupMenuProvider.js +10 -0
- package/lib/camunda-cloud/features/popup-menu/index.js +10 -0
- package/lib/camunda-cloud/util/commonModules.js +10 -0
- package/lib/camunda-platform/Modeler.js +10 -0
- package/lib/camunda-platform/NavigatedViewer.js +10 -0
- package/lib/camunda-platform/Viewer.js +10 -0
- package/lib/camunda-platform/util/commonModules.js +10 -0
- package/lib/util/ExtensionElementsUtil.js +10 -0
- package/package.json +24 -22
|
@@ -16,31 +16,27 @@
|
|
|
16
16
|
* @return {T[]}
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
const nativeToString$
|
|
20
|
-
const nativeHasOwnProperty$
|
|
19
|
+
const nativeToString$6 = Object.prototype.toString;
|
|
20
|
+
const nativeHasOwnProperty$5 = Object.prototype.hasOwnProperty;
|
|
21
21
|
|
|
22
|
-
function isUndefined$
|
|
22
|
+
function isUndefined$6(obj) {
|
|
23
23
|
return obj === undefined;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function
|
|
27
|
-
return obj !== undefined;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function isNil(obj) {
|
|
26
|
+
function isNil$3(obj) {
|
|
31
27
|
return obj == null;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
function isArray$
|
|
35
|
-
return nativeToString$
|
|
30
|
+
function isArray$6(obj) {
|
|
31
|
+
return nativeToString$6.call(obj) === '[object Array]';
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
function isObject(obj) {
|
|
39
|
-
return nativeToString$
|
|
34
|
+
function isObject$2(obj) {
|
|
35
|
+
return nativeToString$6.call(obj) === '[object Object]';
|
|
40
36
|
}
|
|
41
37
|
|
|
42
|
-
function isNumber(obj) {
|
|
43
|
-
return nativeToString$
|
|
38
|
+
function isNumber$1(obj) {
|
|
39
|
+
return nativeToString$6.call(obj) === '[object Number]';
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
/**
|
|
@@ -48,8 +44,8 @@
|
|
|
48
44
|
*
|
|
49
45
|
* @return {boolean}
|
|
50
46
|
*/
|
|
51
|
-
function isFunction(obj) {
|
|
52
|
-
const tag = nativeToString$
|
|
47
|
+
function isFunction$2(obj) {
|
|
48
|
+
const tag = nativeToString$6.call(obj);
|
|
53
49
|
|
|
54
50
|
return (
|
|
55
51
|
tag === '[object Function]' ||
|
|
@@ -60,10 +56,6 @@
|
|
|
60
56
|
);
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
function isString(obj) {
|
|
64
|
-
return nativeToString$2.call(obj) === '[object String]';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
59
|
/**
|
|
68
60
|
* Return true, if target owns a property with the given key.
|
|
69
61
|
*
|
|
@@ -72,8 +64,8 @@
|
|
|
72
64
|
*
|
|
73
65
|
* @return {Boolean}
|
|
74
66
|
*/
|
|
75
|
-
function has$
|
|
76
|
-
return !isNil(target) && nativeHasOwnProperty$
|
|
67
|
+
function has$5(target, key) {
|
|
68
|
+
return !isNil$3(target) && nativeHasOwnProperty$5.call(target, key);
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
/**
|
|
@@ -136,13 +128,13 @@
|
|
|
136
128
|
*
|
|
137
129
|
* @return {Object}
|
|
138
130
|
*/
|
|
139
|
-
function find(collection, matcher) {
|
|
131
|
+
function find$2(collection, matcher) {
|
|
140
132
|
|
|
141
|
-
const matchFn = toMatcher(matcher);
|
|
133
|
+
const matchFn = toMatcher$2(matcher);
|
|
142
134
|
|
|
143
135
|
let match;
|
|
144
136
|
|
|
145
|
-
forEach$
|
|
137
|
+
forEach$5(collection, function(val, key) {
|
|
146
138
|
if (matchFn(val, key)) {
|
|
147
139
|
match = val;
|
|
148
140
|
|
|
@@ -155,33 +147,6 @@
|
|
|
155
147
|
}
|
|
156
148
|
|
|
157
149
|
|
|
158
|
-
/**
|
|
159
|
-
* Find element index in collection.
|
|
160
|
-
*
|
|
161
|
-
* @template T
|
|
162
|
-
* @param {Collection<T>} collection
|
|
163
|
-
* @param {Matcher<T>} matcher
|
|
164
|
-
*
|
|
165
|
-
* @return {number | string | undefined}
|
|
166
|
-
*/
|
|
167
|
-
function findIndex(collection, matcher) {
|
|
168
|
-
|
|
169
|
-
const matchFn = toMatcher(matcher);
|
|
170
|
-
|
|
171
|
-
let idx = isArray$3(collection) ? -1 : undefined;
|
|
172
|
-
|
|
173
|
-
forEach$2(collection, function(val, key) {
|
|
174
|
-
if (matchFn(val, key)) {
|
|
175
|
-
idx = key;
|
|
176
|
-
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
return idx;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
150
|
/**
|
|
186
151
|
* Filter elements in collection.
|
|
187
152
|
*
|
|
@@ -191,13 +156,13 @@
|
|
|
191
156
|
*
|
|
192
157
|
* @return {T[]} result
|
|
193
158
|
*/
|
|
194
|
-
function filter(collection, matcher) {
|
|
159
|
+
function filter$2(collection, matcher) {
|
|
195
160
|
|
|
196
|
-
const matchFn = toMatcher(matcher);
|
|
161
|
+
const matchFn = toMatcher$2(matcher);
|
|
197
162
|
|
|
198
163
|
let result = [];
|
|
199
164
|
|
|
200
|
-
forEach$
|
|
165
|
+
forEach$5(collection, function(val, key) {
|
|
201
166
|
if (matchFn(val, key)) {
|
|
202
167
|
result.push(val);
|
|
203
168
|
}
|
|
@@ -217,20 +182,20 @@
|
|
|
217
182
|
*
|
|
218
183
|
* @return {T} return result that stopped the iteration
|
|
219
184
|
*/
|
|
220
|
-
function forEach$
|
|
185
|
+
function forEach$5(collection, iterator) {
|
|
221
186
|
|
|
222
187
|
let val,
|
|
223
188
|
result;
|
|
224
189
|
|
|
225
|
-
if (isUndefined$
|
|
190
|
+
if (isUndefined$6(collection)) {
|
|
226
191
|
return;
|
|
227
192
|
}
|
|
228
193
|
|
|
229
|
-
const convertKey = isArray$
|
|
194
|
+
const convertKey = isArray$6(collection) ? toNum$5 : identity$5;
|
|
230
195
|
|
|
231
196
|
for (let key in collection) {
|
|
232
197
|
|
|
233
|
-
if (has$
|
|
198
|
+
if (has$5(collection, key)) {
|
|
234
199
|
val = collection[key];
|
|
235
200
|
|
|
236
201
|
result = iterator(val, convertKey(key));
|
|
@@ -243,45 +208,6 @@
|
|
|
243
208
|
}
|
|
244
209
|
|
|
245
210
|
|
|
246
|
-
/**
|
|
247
|
-
* Reduce collection, returning a single result.
|
|
248
|
-
*
|
|
249
|
-
* @template T
|
|
250
|
-
* @template V
|
|
251
|
-
*
|
|
252
|
-
* @param {Collection<T>} collection
|
|
253
|
-
* @param {(result: V, entry: T, index: any) => V} iterator
|
|
254
|
-
* @param {V} result
|
|
255
|
-
*
|
|
256
|
-
* @return {V} result returned from last iterator
|
|
257
|
-
*/
|
|
258
|
-
function reduce(collection, iterator, result) {
|
|
259
|
-
|
|
260
|
-
forEach$2(collection, function(value, idx) {
|
|
261
|
-
result = iterator(result, value, idx);
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
return result;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Return true if every element in the collection
|
|
270
|
-
* matches the criteria.
|
|
271
|
-
*
|
|
272
|
-
* @param {Object|Array} collection
|
|
273
|
-
* @param {Function} matcher
|
|
274
|
-
*
|
|
275
|
-
* @return {Boolean}
|
|
276
|
-
*/
|
|
277
|
-
function every(collection, matcher) {
|
|
278
|
-
|
|
279
|
-
return !!reduce(collection, function(matches, val, key) {
|
|
280
|
-
return matches && matcher(val, key);
|
|
281
|
-
}, true);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
211
|
/**
|
|
286
212
|
* Return true if some elements in the collection
|
|
287
213
|
* match the criteria.
|
|
@@ -293,7 +219,7 @@
|
|
|
293
219
|
*/
|
|
294
220
|
function some(collection, matcher) {
|
|
295
221
|
|
|
296
|
-
return !!find(collection, matcher);
|
|
222
|
+
return !!find$2(collection, matcher);
|
|
297
223
|
}
|
|
298
224
|
|
|
299
225
|
|
|
@@ -310,7 +236,7 @@
|
|
|
310
236
|
|
|
311
237
|
let result = [];
|
|
312
238
|
|
|
313
|
-
forEach$
|
|
239
|
+
forEach$5(collection, function(val, key) {
|
|
314
240
|
result.push(fn(val, key));
|
|
315
241
|
});
|
|
316
242
|
|
|
@@ -318,331 +244,124 @@
|
|
|
318
244
|
}
|
|
319
245
|
|
|
320
246
|
|
|
321
|
-
/**
|
|
322
|
-
* Create an object pattern matcher.
|
|
323
|
-
*
|
|
324
|
-
* @example
|
|
325
|
-
*
|
|
326
|
-
* ```javascript
|
|
327
|
-
* const matcher = matchPattern({ id: 1 });
|
|
328
|
-
*
|
|
329
|
-
* let element = find(elements, matcher);
|
|
330
|
-
* ```
|
|
331
|
-
*
|
|
332
|
-
* @template T
|
|
333
|
-
*
|
|
334
|
-
* @param {T} pattern
|
|
335
|
-
*
|
|
336
|
-
* @return { (el: any) => boolean } matcherFn
|
|
337
|
-
*/
|
|
338
|
-
function matchPattern(pattern) {
|
|
339
|
-
|
|
340
|
-
return function(el) {
|
|
341
|
-
|
|
342
|
-
return every(pattern, function(val, key) {
|
|
343
|
-
return el[key] === val;
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
247
|
/**
|
|
351
248
|
* @template T
|
|
352
249
|
* @param {Matcher<T>} matcher
|
|
353
250
|
*
|
|
354
251
|
* @return {MatchFn<T>}
|
|
355
252
|
*/
|
|
356
|
-
function toMatcher(matcher) {
|
|
357
|
-
return isFunction(matcher) ? matcher : (e) => {
|
|
253
|
+
function toMatcher$2(matcher) {
|
|
254
|
+
return isFunction$2(matcher) ? matcher : (e) => {
|
|
358
255
|
return e === matcher;
|
|
359
256
|
};
|
|
360
257
|
}
|
|
361
258
|
|
|
362
259
|
|
|
363
|
-
function identity$
|
|
260
|
+
function identity$5(arg) {
|
|
364
261
|
return arg;
|
|
365
262
|
}
|
|
366
263
|
|
|
367
|
-
function toNum$
|
|
264
|
+
function toNum$5(arg) {
|
|
368
265
|
return Number(arg);
|
|
369
266
|
}
|
|
370
267
|
|
|
371
|
-
/* global setTimeout clearTimeout */
|
|
372
|
-
|
|
373
268
|
/**
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
269
|
+
* Convenience wrapper for `Object.assign`.
|
|
270
|
+
*
|
|
271
|
+
* @param {Object} target
|
|
272
|
+
* @param {...Object} others
|
|
273
|
+
*
|
|
274
|
+
* @return {Object} the target
|
|
379
275
|
*/
|
|
276
|
+
function assign$6(target, ...others) {
|
|
277
|
+
return Object.assign(target, ...others);
|
|
278
|
+
}
|
|
380
279
|
|
|
381
280
|
/**
|
|
382
|
-
*
|
|
383
|
-
* elapsed between calls.
|
|
281
|
+
* Pick all target properties, excluding the given ones.
|
|
384
282
|
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
283
|
+
* @template T
|
|
284
|
+
* @template {any[]} V
|
|
387
285
|
*
|
|
388
|
-
* @param
|
|
389
|
-
* @param
|
|
286
|
+
* @param {T} target
|
|
287
|
+
* @param {V} properties
|
|
390
288
|
*
|
|
391
|
-
* @return {
|
|
289
|
+
* @return {Omit<T, V>} target
|
|
392
290
|
*/
|
|
393
|
-
function
|
|
394
|
-
|
|
395
|
-
let timer;
|
|
396
|
-
|
|
397
|
-
let lastArgs;
|
|
398
|
-
let lastThis;
|
|
399
|
-
|
|
400
|
-
let lastNow;
|
|
291
|
+
function omit(target, properties) {
|
|
401
292
|
|
|
402
|
-
|
|
293
|
+
let result = {};
|
|
403
294
|
|
|
404
|
-
|
|
295
|
+
let obj = Object(target);
|
|
405
296
|
|
|
406
|
-
|
|
297
|
+
forEach$5(obj, function(prop, key) {
|
|
407
298
|
|
|
408
|
-
if (
|
|
409
|
-
|
|
299
|
+
if (properties.indexOf(key) === -1) {
|
|
300
|
+
result[key] = prop;
|
|
410
301
|
}
|
|
302
|
+
});
|
|
411
303
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
clear();
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function schedule(timeout) {
|
|
418
|
-
timer = setTimeout(fire, timeout);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function clear() {
|
|
422
|
-
if (timer) {
|
|
423
|
-
clearTimeout(timer);
|
|
424
|
-
}
|
|
304
|
+
return result;
|
|
305
|
+
}
|
|
425
306
|
|
|
426
|
-
|
|
427
|
-
}
|
|
307
|
+
var DEFAULT_RENDER_PRIORITY$1 = 1000;
|
|
428
308
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
309
|
+
/**
|
|
310
|
+
* @typedef {import('../core/Types').ElementLike} Element
|
|
311
|
+
* @typedef {import('../core/Types').ConnectionLike} Connection
|
|
312
|
+
* @typedef {import('../core/Types').ShapeLike} Shape
|
|
313
|
+
*
|
|
314
|
+
* @typedef {import('../core/EventBus').default} EventBus
|
|
315
|
+
*/
|
|
433
316
|
|
|
434
|
-
|
|
435
|
-
|
|
317
|
+
/**
|
|
318
|
+
* The base implementation of shape and connection renderers.
|
|
319
|
+
*
|
|
320
|
+
* @param {EventBus} eventBus
|
|
321
|
+
* @param {number} [renderPriority=1000]
|
|
322
|
+
*/
|
|
323
|
+
function BaseRenderer(eventBus, renderPriority) {
|
|
324
|
+
var self = this;
|
|
436
325
|
|
|
437
|
-
|
|
438
|
-
* @type { DebouncedFunction }
|
|
439
|
-
*/
|
|
440
|
-
function callback(...args) {
|
|
441
|
-
lastNow = Date.now();
|
|
326
|
+
renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY$1;
|
|
442
327
|
|
|
443
|
-
|
|
444
|
-
|
|
328
|
+
eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
|
|
329
|
+
var type = evt.type,
|
|
330
|
+
element = context.element,
|
|
331
|
+
visuals = context.gfx,
|
|
332
|
+
attrs = context.attrs;
|
|
445
333
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
334
|
+
if (self.canRender(element)) {
|
|
335
|
+
if (type === 'render.shape') {
|
|
336
|
+
return self.drawShape(visuals, element, attrs);
|
|
337
|
+
} else {
|
|
338
|
+
return self.drawConnection(visuals, element, attrs);
|
|
339
|
+
}
|
|
449
340
|
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
callback.flush = flush;
|
|
453
|
-
callback.cancel = clear;
|
|
341
|
+
});
|
|
454
342
|
|
|
455
|
-
|
|
343
|
+
eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
|
|
344
|
+
if (self.canRender(element)) {
|
|
345
|
+
if (evt.type === 'render.getShapePath') {
|
|
346
|
+
return self.getShapePath(element);
|
|
347
|
+
} else {
|
|
348
|
+
return self.getConnectionPath(element);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
});
|
|
456
352
|
}
|
|
457
353
|
|
|
458
354
|
/**
|
|
459
|
-
*
|
|
355
|
+
* Checks whether an element can be rendered.
|
|
460
356
|
*
|
|
461
|
-
* @param
|
|
462
|
-
* @param {Object} target
|
|
357
|
+
* @param {Element} element The element to be rendered.
|
|
463
358
|
*
|
|
464
|
-
* @return {
|
|
359
|
+
* @return {boolean} Whether the element can be rendered.
|
|
465
360
|
*/
|
|
466
|
-
function
|
|
467
|
-
return fn.bind(target);
|
|
468
|
-
}
|
|
361
|
+
BaseRenderer.prototype.canRender = function(element) {};
|
|
469
362
|
|
|
470
363
|
/**
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* @param {Object} target
|
|
474
|
-
* @param {...Object} others
|
|
475
|
-
*
|
|
476
|
-
* @return {Object} the target
|
|
477
|
-
*/
|
|
478
|
-
function assign$2(target, ...others) {
|
|
479
|
-
return Object.assign(target, ...others);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* Sets a nested property of a given object to the specified value.
|
|
484
|
-
*
|
|
485
|
-
* This mutates the object and returns it.
|
|
486
|
-
*
|
|
487
|
-
* @template T
|
|
488
|
-
*
|
|
489
|
-
* @param {T} target The target of the set operation.
|
|
490
|
-
* @param {(string|number)[]} path The path to the nested value.
|
|
491
|
-
* @param {any} value The value to set.
|
|
492
|
-
*
|
|
493
|
-
* @return {T}
|
|
494
|
-
*/
|
|
495
|
-
function set(target, path, value) {
|
|
496
|
-
|
|
497
|
-
let currentTarget = target;
|
|
498
|
-
|
|
499
|
-
forEach$2(path, function(key, idx) {
|
|
500
|
-
|
|
501
|
-
if (typeof key !== 'number' && typeof key !== 'string') {
|
|
502
|
-
throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
if (key === 'constructor') {
|
|
506
|
-
throw new Error('illegal key: constructor');
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
if (key === '__proto__') {
|
|
510
|
-
throw new Error('illegal key: __proto__');
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
let nextKey = path[idx + 1];
|
|
514
|
-
let nextTarget = currentTarget[key];
|
|
515
|
-
|
|
516
|
-
if (isDefined(nextKey) && isNil(nextTarget)) {
|
|
517
|
-
nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
if (isUndefined$3(nextKey)) {
|
|
521
|
-
if (isUndefined$3(value)) {
|
|
522
|
-
delete currentTarget[key];
|
|
523
|
-
} else {
|
|
524
|
-
currentTarget[key] = value;
|
|
525
|
-
}
|
|
526
|
-
} else {
|
|
527
|
-
currentTarget = nextTarget;
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
return target;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Pick properties from the given target.
|
|
536
|
-
*
|
|
537
|
-
* @template T
|
|
538
|
-
* @template {any[]} V
|
|
539
|
-
*
|
|
540
|
-
* @param {T} target
|
|
541
|
-
* @param {V} properties
|
|
542
|
-
*
|
|
543
|
-
* @return Pick<T, V>
|
|
544
|
-
*/
|
|
545
|
-
function pick(target, properties) {
|
|
546
|
-
|
|
547
|
-
let result = {};
|
|
548
|
-
|
|
549
|
-
let obj = Object(target);
|
|
550
|
-
|
|
551
|
-
forEach$2(properties, function(prop) {
|
|
552
|
-
|
|
553
|
-
if (prop in obj) {
|
|
554
|
-
result[prop] = target[prop];
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
|
|
558
|
-
return result;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Pick all target properties, excluding the given ones.
|
|
563
|
-
*
|
|
564
|
-
* @template T
|
|
565
|
-
* @template {any[]} V
|
|
566
|
-
*
|
|
567
|
-
* @param {T} target
|
|
568
|
-
* @param {V} properties
|
|
569
|
-
*
|
|
570
|
-
* @return {Omit<T, V>} target
|
|
571
|
-
*/
|
|
572
|
-
function omit(target, properties) {
|
|
573
|
-
|
|
574
|
-
let result = {};
|
|
575
|
-
|
|
576
|
-
let obj = Object(target);
|
|
577
|
-
|
|
578
|
-
forEach$2(obj, function(prop, key) {
|
|
579
|
-
|
|
580
|
-
if (properties.indexOf(key) === -1) {
|
|
581
|
-
result[key] = prop;
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
|
|
585
|
-
return result;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
var DEFAULT_RENDER_PRIORITY$1 = 1000;
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* @typedef {import('../core/Types').ElementLike} Element
|
|
592
|
-
* @typedef {import('../core/Types').ConnectionLike} Connection
|
|
593
|
-
* @typedef {import('../core/Types').ShapeLike} Shape
|
|
594
|
-
*
|
|
595
|
-
* @typedef {import('../core/EventBus').default} EventBus
|
|
596
|
-
*/
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* The base implementation of shape and connection renderers.
|
|
600
|
-
*
|
|
601
|
-
* @param {EventBus} eventBus
|
|
602
|
-
* @param {number} [renderPriority=1000]
|
|
603
|
-
*/
|
|
604
|
-
function BaseRenderer(eventBus, renderPriority) {
|
|
605
|
-
var self = this;
|
|
606
|
-
|
|
607
|
-
renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY$1;
|
|
608
|
-
|
|
609
|
-
eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
|
|
610
|
-
var type = evt.type,
|
|
611
|
-
element = context.element,
|
|
612
|
-
visuals = context.gfx,
|
|
613
|
-
attrs = context.attrs;
|
|
614
|
-
|
|
615
|
-
if (self.canRender(element)) {
|
|
616
|
-
if (type === 'render.shape') {
|
|
617
|
-
return self.drawShape(visuals, element, attrs);
|
|
618
|
-
} else {
|
|
619
|
-
return self.drawConnection(visuals, element, attrs);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
});
|
|
623
|
-
|
|
624
|
-
eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
|
|
625
|
-
if (self.canRender(element)) {
|
|
626
|
-
if (evt.type === 'render.getShapePath') {
|
|
627
|
-
return self.getShapePath(element);
|
|
628
|
-
} else {
|
|
629
|
-
return self.getConnectionPath(element);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Checks whether an element can be rendered.
|
|
637
|
-
*
|
|
638
|
-
* @param {Element} element The element to be rendered.
|
|
639
|
-
*
|
|
640
|
-
* @return {boolean} Whether the element can be rendered.
|
|
641
|
-
*/
|
|
642
|
-
BaseRenderer.prototype.canRender = function(element) {};
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Draws a shape.
|
|
364
|
+
* Draws a shape.
|
|
646
365
|
*
|
|
647
366
|
* @param {SVGElement} visuals The SVG element to draw the shape into.
|
|
648
367
|
* @param {Shape} shape The shape to be drawn.
|
|
@@ -799,301 +518,711 @@
|
|
|
799
518
|
}
|
|
800
519
|
|
|
801
520
|
/**
|
|
802
|
-
*
|
|
521
|
+
* Flatten array, one level deep.
|
|
803
522
|
*
|
|
804
|
-
* @
|
|
523
|
+
* @template T
|
|
805
524
|
*
|
|
806
|
-
* @
|
|
525
|
+
* @param {T[][] | T[] | null} [arr]
|
|
526
|
+
*
|
|
527
|
+
* @return {T[]}
|
|
807
528
|
*/
|
|
808
|
-
|
|
809
|
-
|
|
529
|
+
|
|
530
|
+
const nativeToString$5 = Object.prototype.toString;
|
|
531
|
+
const nativeHasOwnProperty$4 = Object.prototype.hasOwnProperty;
|
|
532
|
+
|
|
533
|
+
function isUndefined$5(obj) {
|
|
534
|
+
return obj === undefined;
|
|
810
535
|
}
|
|
811
536
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
*
|
|
815
|
-
* @param {any} value
|
|
816
|
-
*
|
|
817
|
-
* @return {boolean}
|
|
818
|
-
*/
|
|
819
|
-
function isLabel(value) {
|
|
820
|
-
return isObject(value) && has$2(value, 'labelTarget');
|
|
537
|
+
function isDefined$1(obj) {
|
|
538
|
+
return obj !== undefined;
|
|
821
539
|
}
|
|
822
540
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
*
|
|
827
|
-
* @typedef {import('../model/Types').Element} Element
|
|
828
|
-
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
829
|
-
*/
|
|
541
|
+
function isNil$2(obj) {
|
|
542
|
+
return obj == null;
|
|
543
|
+
}
|
|
830
544
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
};
|
|
545
|
+
function isArray$5(obj) {
|
|
546
|
+
return nativeToString$5.call(obj) === '[object Array]';
|
|
547
|
+
}
|
|
835
548
|
|
|
836
|
-
|
|
549
|
+
function isObject$1(obj) {
|
|
550
|
+
return nativeToString$5.call(obj) === '[object Object]';
|
|
551
|
+
}
|
|
837
552
|
|
|
553
|
+
function isNumber(obj) {
|
|
554
|
+
return nativeToString$5.call(obj) === '[object Number]';
|
|
555
|
+
}
|
|
838
556
|
|
|
839
557
|
/**
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
* @param {Element} semantic
|
|
558
|
+
* @param {any} obj
|
|
843
559
|
*
|
|
844
560
|
* @return {boolean}
|
|
845
561
|
*/
|
|
846
|
-
function
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
562
|
+
function isFunction$1(obj) {
|
|
563
|
+
const tag = nativeToString$5.call(obj);
|
|
564
|
+
|
|
565
|
+
return (
|
|
566
|
+
tag === '[object Function]' ||
|
|
567
|
+
tag === '[object AsyncFunction]' ||
|
|
568
|
+
tag === '[object GeneratorFunction]' ||
|
|
569
|
+
tag === '[object AsyncGeneratorFunction]' ||
|
|
570
|
+
tag === '[object Proxy]'
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function isString$3(obj) {
|
|
575
|
+
return nativeToString$5.call(obj) === '[object String]';
|
|
856
576
|
}
|
|
857
577
|
|
|
858
578
|
/**
|
|
859
|
-
*
|
|
579
|
+
* Return true, if target owns a property with the given key.
|
|
860
580
|
*
|
|
861
|
-
* @param
|
|
581
|
+
* @param {Object} target
|
|
582
|
+
* @param {String} key
|
|
862
583
|
*
|
|
863
|
-
* @return {
|
|
584
|
+
* @return {Boolean}
|
|
864
585
|
*/
|
|
865
|
-
function
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
var mid = waypoints.length / 2 - 1;
|
|
869
|
-
|
|
870
|
-
var first = waypoints[Math.floor(mid)];
|
|
871
|
-
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
872
|
-
|
|
873
|
-
// get position
|
|
874
|
-
var position = getWaypointsMid(waypoints);
|
|
875
|
-
|
|
876
|
-
// calculate angle
|
|
877
|
-
var angle = Math.atan((second.y - first.y) / (second.x - first.x));
|
|
878
|
-
|
|
879
|
-
var x = position.x,
|
|
880
|
-
y = position.y;
|
|
881
|
-
|
|
882
|
-
if (Math.abs(angle) < Math.PI / 2) {
|
|
883
|
-
y -= FLOW_LABEL_INDENT;
|
|
884
|
-
} else {
|
|
885
|
-
x += FLOW_LABEL_INDENT;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
return { x: x, y: y };
|
|
889
|
-
}
|
|
586
|
+
function has$4(target, key) {
|
|
587
|
+
return !isNil$2(target) && nativeHasOwnProperty$4.call(target, key);
|
|
588
|
+
}
|
|
890
589
|
|
|
590
|
+
/**
|
|
591
|
+
* @template T
|
|
592
|
+
* @typedef { (
|
|
593
|
+
* ((e: T) => boolean) |
|
|
594
|
+
* ((e: T, idx: number) => boolean) |
|
|
595
|
+
* ((e: T, key: string) => boolean) |
|
|
596
|
+
* string |
|
|
597
|
+
* number
|
|
598
|
+
* ) } Matcher
|
|
599
|
+
*/
|
|
891
600
|
|
|
892
601
|
/**
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
* @param {Point[]} waypoints
|
|
602
|
+
* @template T
|
|
603
|
+
* @template U
|
|
896
604
|
*
|
|
897
|
-
* @
|
|
605
|
+
* @typedef { (
|
|
606
|
+
* ((e: T) => U) | string | number
|
|
607
|
+
* ) } Extractor
|
|
898
608
|
*/
|
|
899
|
-
function getWaypointsMid(waypoints) {
|
|
900
609
|
|
|
901
|
-
var mid = waypoints.length / 2 - 1;
|
|
902
610
|
|
|
903
|
-
|
|
904
|
-
|
|
611
|
+
/**
|
|
612
|
+
* @template T
|
|
613
|
+
* @typedef { (val: T, key: any) => boolean } MatchFn
|
|
614
|
+
*/
|
|
905
615
|
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
}
|
|
616
|
+
/**
|
|
617
|
+
* @template T
|
|
618
|
+
* @typedef { T[] } ArrayCollection
|
|
619
|
+
*/
|
|
911
620
|
|
|
912
621
|
/**
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
* @param {Element} element
|
|
916
|
-
*
|
|
917
|
-
* @return {Point}
|
|
622
|
+
* @template T
|
|
623
|
+
* @typedef { { [key: string]: T } } StringKeyValueCollection
|
|
918
624
|
*/
|
|
919
|
-
function getExternalLabelMid(element) {
|
|
920
625
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
x: element.x + element.width / 2,
|
|
926
|
-
y: element.y + DEFAULT_LABEL_SIZE$1.height / 2
|
|
927
|
-
};
|
|
928
|
-
} else {
|
|
929
|
-
return {
|
|
930
|
-
x: element.x + element.width / 2,
|
|
931
|
-
y: element.y + element.height + DEFAULT_LABEL_SIZE$1.height / 2
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
}
|
|
626
|
+
/**
|
|
627
|
+
* @template T
|
|
628
|
+
* @typedef { { [key: number]: T } } NumberKeyValueCollection
|
|
629
|
+
*/
|
|
935
630
|
|
|
631
|
+
/**
|
|
632
|
+
* @template T
|
|
633
|
+
* @typedef { StringKeyValueCollection<T> | NumberKeyValueCollection<T> } KeyValueCollection
|
|
634
|
+
*/
|
|
936
635
|
|
|
937
636
|
/**
|
|
938
|
-
*
|
|
939
|
-
*
|
|
637
|
+
* @template T
|
|
638
|
+
* @typedef { KeyValueCollection<T> | ArrayCollection<T> } Collection
|
|
639
|
+
*/
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Find element in collection.
|
|
940
643
|
*
|
|
941
|
-
* @
|
|
942
|
-
* @param {
|
|
644
|
+
* @template T
|
|
645
|
+
* @param {Collection<T>} collection
|
|
646
|
+
* @param {Matcher<T>} matcher
|
|
943
647
|
*
|
|
944
|
-
* @return {
|
|
648
|
+
* @return {Object}
|
|
945
649
|
*/
|
|
946
|
-
function
|
|
947
|
-
|
|
948
|
-
var mid,
|
|
949
|
-
size,
|
|
950
|
-
bounds,
|
|
951
|
-
label = di.label;
|
|
650
|
+
function find$1(collection, matcher) {
|
|
952
651
|
|
|
953
|
-
|
|
954
|
-
bounds = label.bounds;
|
|
652
|
+
const matchFn = toMatcher$1(matcher);
|
|
955
653
|
|
|
956
|
-
|
|
957
|
-
width: Math.max(DEFAULT_LABEL_SIZE$1.width, bounds.width),
|
|
958
|
-
height: bounds.height
|
|
959
|
-
};
|
|
654
|
+
let match;
|
|
960
655
|
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
};
|
|
965
|
-
} else {
|
|
656
|
+
forEach$4(collection, function(val, key) {
|
|
657
|
+
if (matchFn(val, key)) {
|
|
658
|
+
match = val;
|
|
966
659
|
|
|
967
|
-
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
});
|
|
968
663
|
|
|
969
|
-
|
|
970
|
-
}
|
|
664
|
+
return match;
|
|
971
665
|
|
|
972
|
-
return assign$2({
|
|
973
|
-
x: mid.x - size.width / 2,
|
|
974
|
-
y: mid.y - size.height / 2
|
|
975
|
-
}, size);
|
|
976
666
|
}
|
|
977
667
|
|
|
978
|
-
/**
|
|
979
|
-
* @param {ModdleElement} semantic
|
|
980
|
-
*
|
|
981
|
-
* @returns {string}
|
|
982
|
-
*/
|
|
983
|
-
function getLabelAttr(semantic) {
|
|
984
|
-
if (
|
|
985
|
-
is$1(semantic, 'bpmn:FlowElement') ||
|
|
986
|
-
is$1(semantic, 'bpmn:Participant') ||
|
|
987
|
-
is$1(semantic, 'bpmn:Lane') ||
|
|
988
|
-
is$1(semantic, 'bpmn:SequenceFlow') ||
|
|
989
|
-
is$1(semantic, 'bpmn:MessageFlow') ||
|
|
990
|
-
is$1(semantic, 'bpmn:DataInput') ||
|
|
991
|
-
is$1(semantic, 'bpmn:DataOutput')
|
|
992
|
-
) {
|
|
993
|
-
return 'name';
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
if (is$1(semantic, 'bpmn:TextAnnotation')) {
|
|
997
|
-
return 'text';
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
if (is$1(semantic, 'bpmn:Group')) {
|
|
1001
|
-
return 'categoryValueRef';
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
668
|
|
|
1005
669
|
/**
|
|
1006
|
-
*
|
|
670
|
+
* Filter elements in collection.
|
|
1007
671
|
*
|
|
1008
|
-
* @
|
|
672
|
+
* @template T
|
|
673
|
+
* @param {Collection<T>} collection
|
|
674
|
+
* @param {Matcher<T>} matcher
|
|
675
|
+
*
|
|
676
|
+
* @return {T[]} result
|
|
1009
677
|
*/
|
|
1010
|
-
function
|
|
1011
|
-
var categoryValueRef = semantic['categoryValueRef'];
|
|
678
|
+
function filter$1(collection, matcher) {
|
|
1012
679
|
|
|
1013
|
-
|
|
1014
|
-
return '';
|
|
1015
|
-
}
|
|
680
|
+
const matchFn = toMatcher$1(matcher);
|
|
1016
681
|
|
|
682
|
+
let result = [];
|
|
1017
683
|
|
|
1018
|
-
|
|
684
|
+
forEach$4(collection, function(val, key) {
|
|
685
|
+
if (matchFn(val, key)) {
|
|
686
|
+
result.push(val);
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
return result;
|
|
1019
691
|
}
|
|
1020
692
|
|
|
693
|
+
|
|
1021
694
|
/**
|
|
1022
|
-
*
|
|
695
|
+
* Iterate over collection; returning something
|
|
696
|
+
* (non-undefined) will stop iteration.
|
|
1023
697
|
*
|
|
1024
|
-
* @
|
|
698
|
+
* @template T
|
|
699
|
+
* @param {Collection<T>} collection
|
|
700
|
+
* @param { ((item: T, idx: number) => (boolean|void)) | ((item: T, key: string) => (boolean|void)) } iterator
|
|
701
|
+
*
|
|
702
|
+
* @return {T} return result that stopped the iteration
|
|
1025
703
|
*/
|
|
1026
|
-
function
|
|
1027
|
-
var semantic = element.businessObject,
|
|
1028
|
-
attr = getLabelAttr(semantic);
|
|
1029
|
-
|
|
1030
|
-
if (attr) {
|
|
1031
|
-
|
|
1032
|
-
if (attr === 'categoryValueRef') {
|
|
704
|
+
function forEach$4(collection, iterator) {
|
|
1033
705
|
|
|
1034
|
-
|
|
1035
|
-
|
|
706
|
+
let val,
|
|
707
|
+
result;
|
|
1036
708
|
|
|
1037
|
-
|
|
709
|
+
if (isUndefined$5(collection)) {
|
|
710
|
+
return;
|
|
1038
711
|
}
|
|
1039
|
-
}
|
|
1040
712
|
|
|
1041
|
-
|
|
713
|
+
const convertKey = isArray$5(collection) ? toNum$4 : identity$4;
|
|
1042
714
|
|
|
1043
|
-
|
|
1044
|
-
try {
|
|
715
|
+
for (let key in collection) {
|
|
1045
716
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
} catch (e) {
|
|
717
|
+
if (has$4(collection, key)) {
|
|
718
|
+
val = collection[key];
|
|
1049
719
|
|
|
1050
|
-
|
|
720
|
+
result = iterator(val, convertKey(key));
|
|
721
|
+
|
|
722
|
+
if (result === false) {
|
|
723
|
+
return val;
|
|
724
|
+
}
|
|
1051
725
|
}
|
|
1052
726
|
}
|
|
1053
|
-
|
|
1054
|
-
return element;
|
|
1055
727
|
}
|
|
1056
728
|
|
|
1057
|
-
/**
|
|
1058
|
-
* appendTo utility
|
|
1059
|
-
*/
|
|
1060
|
-
|
|
1061
729
|
|
|
1062
730
|
/**
|
|
1063
|
-
*
|
|
731
|
+
* Reduce collection, returning a single result.
|
|
1064
732
|
*
|
|
1065
|
-
* @
|
|
1066
|
-
* @
|
|
733
|
+
* @template T
|
|
734
|
+
* @template V
|
|
1067
735
|
*
|
|
1068
|
-
* @
|
|
736
|
+
* @param {Collection<T>} collection
|
|
737
|
+
* @param {(result: V, entry: T, index: any) => V} iterator
|
|
738
|
+
* @param {V} result
|
|
739
|
+
*
|
|
740
|
+
* @return {V} result returned from last iterator
|
|
1069
741
|
*/
|
|
1070
|
-
function
|
|
1071
|
-
return target.appendChild(ensureImported(element, target));
|
|
1072
|
-
}
|
|
742
|
+
function reduce(collection, iterator, result) {
|
|
1073
743
|
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
744
|
+
forEach$4(collection, function(value, idx) {
|
|
745
|
+
result = iterator(result, value, idx);
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
return result;
|
|
749
|
+
}
|
|
1077
750
|
|
|
1078
751
|
|
|
1079
752
|
/**
|
|
1080
|
-
*
|
|
753
|
+
* Return true if every element in the collection
|
|
754
|
+
* matches the criteria.
|
|
1081
755
|
*
|
|
1082
|
-
* @param {
|
|
1083
|
-
* @param {
|
|
756
|
+
* @param {Object|Array} collection
|
|
757
|
+
* @param {Function} matcher
|
|
1084
758
|
*
|
|
1085
|
-
* @return {
|
|
759
|
+
* @return {Boolean}
|
|
1086
760
|
*/
|
|
1087
|
-
function
|
|
1088
|
-
appendTo(node, target);
|
|
1089
|
-
return target;
|
|
1090
|
-
}
|
|
761
|
+
function every(collection, matcher) {
|
|
1091
762
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
763
|
+
return !!reduce(collection, function(matches, val, key) {
|
|
764
|
+
return matches && matcher(val, key);
|
|
765
|
+
}, true);
|
|
766
|
+
}
|
|
1095
767
|
|
|
1096
|
-
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Create an object pattern matcher.
|
|
771
|
+
*
|
|
772
|
+
* @example
|
|
773
|
+
*
|
|
774
|
+
* ```javascript
|
|
775
|
+
* const matcher = matchPattern({ id: 1 });
|
|
776
|
+
*
|
|
777
|
+
* let element = find(elements, matcher);
|
|
778
|
+
* ```
|
|
779
|
+
*
|
|
780
|
+
* @template T
|
|
781
|
+
*
|
|
782
|
+
* @param {T} pattern
|
|
783
|
+
*
|
|
784
|
+
* @return { (el: any) => boolean } matcherFn
|
|
785
|
+
*/
|
|
786
|
+
function matchPattern(pattern) {
|
|
787
|
+
|
|
788
|
+
return function(el) {
|
|
789
|
+
|
|
790
|
+
return every(pattern, function(val, key) {
|
|
791
|
+
return el[key] === val;
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* @template T
|
|
800
|
+
* @param {Matcher<T>} matcher
|
|
801
|
+
*
|
|
802
|
+
* @return {MatchFn<T>}
|
|
803
|
+
*/
|
|
804
|
+
function toMatcher$1(matcher) {
|
|
805
|
+
return isFunction$1(matcher) ? matcher : (e) => {
|
|
806
|
+
return e === matcher;
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
function identity$4(arg) {
|
|
812
|
+
return arg;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
function toNum$4(arg) {
|
|
816
|
+
return Number(arg);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/* global setTimeout clearTimeout */
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* @typedef { {
|
|
823
|
+
* (...args: any[]): any;
|
|
824
|
+
* flush: () => void;
|
|
825
|
+
* cancel: () => void;
|
|
826
|
+
* } } DebouncedFunction
|
|
827
|
+
*/
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Debounce fn, calling it only once if the given time
|
|
831
|
+
* elapsed between calls.
|
|
832
|
+
*
|
|
833
|
+
* Lodash-style the function exposes methods to `#clear`
|
|
834
|
+
* and `#flush` to control internal behavior.
|
|
835
|
+
*
|
|
836
|
+
* @param {Function} fn
|
|
837
|
+
* @param {Number} timeout
|
|
838
|
+
*
|
|
839
|
+
* @return {DebouncedFunction} debounced function
|
|
840
|
+
*/
|
|
841
|
+
function debounce(fn, timeout) {
|
|
842
|
+
|
|
843
|
+
let timer;
|
|
844
|
+
|
|
845
|
+
let lastArgs;
|
|
846
|
+
let lastThis;
|
|
847
|
+
|
|
848
|
+
let lastNow;
|
|
849
|
+
|
|
850
|
+
function fire(force) {
|
|
851
|
+
|
|
852
|
+
let now = Date.now();
|
|
853
|
+
|
|
854
|
+
let scheduledDiff = force ? 0 : (lastNow + timeout) - now;
|
|
855
|
+
|
|
856
|
+
if (scheduledDiff > 0) {
|
|
857
|
+
return schedule(scheduledDiff);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
fn.apply(lastThis, lastArgs);
|
|
861
|
+
|
|
862
|
+
clear();
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
function schedule(timeout) {
|
|
866
|
+
timer = setTimeout(fire, timeout);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
function clear() {
|
|
870
|
+
if (timer) {
|
|
871
|
+
clearTimeout(timer);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
timer = lastNow = lastArgs = lastThis = undefined;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
function flush() {
|
|
878
|
+
if (timer) {
|
|
879
|
+
fire(true);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
clear();
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* @type { DebouncedFunction }
|
|
887
|
+
*/
|
|
888
|
+
function callback(...args) {
|
|
889
|
+
lastNow = Date.now();
|
|
890
|
+
|
|
891
|
+
lastArgs = args;
|
|
892
|
+
lastThis = this;
|
|
893
|
+
|
|
894
|
+
// ensure an execution is scheduled
|
|
895
|
+
if (!timer) {
|
|
896
|
+
schedule(timeout);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
callback.flush = flush;
|
|
901
|
+
callback.cancel = clear;
|
|
902
|
+
|
|
903
|
+
return callback;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Bind function against target <this>.
|
|
908
|
+
*
|
|
909
|
+
* @param {Function} fn
|
|
910
|
+
* @param {Object} target
|
|
911
|
+
*
|
|
912
|
+
* @return {Function} bound function
|
|
913
|
+
*/
|
|
914
|
+
function bind$4(fn, target) {
|
|
915
|
+
return fn.bind(target);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Convenience wrapper for `Object.assign`.
|
|
920
|
+
*
|
|
921
|
+
* @param {Object} target
|
|
922
|
+
* @param {...Object} others
|
|
923
|
+
*
|
|
924
|
+
* @return {Object} the target
|
|
925
|
+
*/
|
|
926
|
+
function assign$5(target, ...others) {
|
|
927
|
+
return Object.assign(target, ...others);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* Checks whether a value is an instance of Connection.
|
|
932
|
+
*
|
|
933
|
+
* @param {any} value
|
|
934
|
+
*
|
|
935
|
+
* @return {boolean}
|
|
936
|
+
*/
|
|
937
|
+
function isConnection(value) {
|
|
938
|
+
return isObject$1(value) && has$4(value, 'waypoints');
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Checks whether a value is an instance of Label.
|
|
943
|
+
*
|
|
944
|
+
* @param {any} value
|
|
945
|
+
*
|
|
946
|
+
* @return {boolean}
|
|
947
|
+
*/
|
|
948
|
+
function isLabel(value) {
|
|
949
|
+
return isObject$1(value) && has$4(value, 'labelTarget');
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
954
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
955
|
+
*
|
|
956
|
+
* @typedef {import('../model/Types').Element} Element
|
|
957
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
958
|
+
*/
|
|
959
|
+
|
|
960
|
+
var DEFAULT_LABEL_SIZE$1 = {
|
|
961
|
+
width: 90,
|
|
962
|
+
height: 20
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
var FLOW_LABEL_INDENT = 15;
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Return true if the given semantic has an external label.
|
|
970
|
+
*
|
|
971
|
+
* @param {Element} semantic
|
|
972
|
+
*
|
|
973
|
+
* @return {boolean}
|
|
974
|
+
*/
|
|
975
|
+
function isLabelExternal(semantic) {
|
|
976
|
+
return is$1(semantic, 'bpmn:Event') ||
|
|
977
|
+
is$1(semantic, 'bpmn:Gateway') ||
|
|
978
|
+
is$1(semantic, 'bpmn:DataStoreReference') ||
|
|
979
|
+
is$1(semantic, 'bpmn:DataObjectReference') ||
|
|
980
|
+
is$1(semantic, 'bpmn:DataInput') ||
|
|
981
|
+
is$1(semantic, 'bpmn:DataOutput') ||
|
|
982
|
+
is$1(semantic, 'bpmn:SequenceFlow') ||
|
|
983
|
+
is$1(semantic, 'bpmn:MessageFlow') ||
|
|
984
|
+
is$1(semantic, 'bpmn:Group');
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Get the position of a sequence flow label.
|
|
989
|
+
*
|
|
990
|
+
* @param {Point[]} waypoints
|
|
991
|
+
*
|
|
992
|
+
* @return {Point}
|
|
993
|
+
*/
|
|
994
|
+
function getFlowLabelPosition(waypoints) {
|
|
995
|
+
|
|
996
|
+
// get the waypoints mid
|
|
997
|
+
var mid = waypoints.length / 2 - 1;
|
|
998
|
+
|
|
999
|
+
var first = waypoints[Math.floor(mid)];
|
|
1000
|
+
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
1001
|
+
|
|
1002
|
+
// get position
|
|
1003
|
+
var position = getWaypointsMid(waypoints);
|
|
1004
|
+
|
|
1005
|
+
// calculate angle
|
|
1006
|
+
var angle = Math.atan((second.y - first.y) / (second.x - first.x));
|
|
1007
|
+
|
|
1008
|
+
var x = position.x,
|
|
1009
|
+
y = position.y;
|
|
1010
|
+
|
|
1011
|
+
if (Math.abs(angle) < Math.PI / 2) {
|
|
1012
|
+
y -= FLOW_LABEL_INDENT;
|
|
1013
|
+
} else {
|
|
1014
|
+
x += FLOW_LABEL_INDENT;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
return { x: x, y: y };
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Get the middle of a number of waypoints.
|
|
1023
|
+
*
|
|
1024
|
+
* @param {Point[]} waypoints
|
|
1025
|
+
*
|
|
1026
|
+
* @return {Point}
|
|
1027
|
+
*/
|
|
1028
|
+
function getWaypointsMid(waypoints) {
|
|
1029
|
+
|
|
1030
|
+
var mid = waypoints.length / 2 - 1;
|
|
1031
|
+
|
|
1032
|
+
var first = waypoints[Math.floor(mid)];
|
|
1033
|
+
var second = waypoints[Math.ceil(mid + 0.01)];
|
|
1034
|
+
|
|
1035
|
+
return {
|
|
1036
|
+
x: first.x + (second.x - first.x) / 2,
|
|
1037
|
+
y: first.y + (second.y - first.y) / 2
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Get the middle of the external label of an element.
|
|
1043
|
+
*
|
|
1044
|
+
* @param {Element} element
|
|
1045
|
+
*
|
|
1046
|
+
* @return {Point}
|
|
1047
|
+
*/
|
|
1048
|
+
function getExternalLabelMid(element) {
|
|
1049
|
+
|
|
1050
|
+
if (element.waypoints) {
|
|
1051
|
+
return getFlowLabelPosition(element.waypoints);
|
|
1052
|
+
} else if (is$1(element, 'bpmn:Group')) {
|
|
1053
|
+
return {
|
|
1054
|
+
x: element.x + element.width / 2,
|
|
1055
|
+
y: element.y + DEFAULT_LABEL_SIZE$1.height / 2
|
|
1056
|
+
};
|
|
1057
|
+
} else {
|
|
1058
|
+
return {
|
|
1059
|
+
x: element.x + element.width / 2,
|
|
1060
|
+
y: element.y + element.height + DEFAULT_LABEL_SIZE$1.height / 2
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* Return the bounds of an elements label, parsed from the elements DI or
|
|
1068
|
+
* generated from its bounds.
|
|
1069
|
+
*
|
|
1070
|
+
* @param {ModdleElement} di
|
|
1071
|
+
* @param {Element} element
|
|
1072
|
+
*
|
|
1073
|
+
* @return {Rect}
|
|
1074
|
+
*/
|
|
1075
|
+
function getExternalLabelBounds(di, element) {
|
|
1076
|
+
|
|
1077
|
+
var mid,
|
|
1078
|
+
size,
|
|
1079
|
+
bounds,
|
|
1080
|
+
label = di.label;
|
|
1081
|
+
|
|
1082
|
+
if (label && label.bounds) {
|
|
1083
|
+
bounds = label.bounds;
|
|
1084
|
+
|
|
1085
|
+
size = {
|
|
1086
|
+
width: Math.max(DEFAULT_LABEL_SIZE$1.width, bounds.width),
|
|
1087
|
+
height: bounds.height
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
mid = {
|
|
1091
|
+
x: bounds.x + bounds.width / 2,
|
|
1092
|
+
y: bounds.y + bounds.height / 2
|
|
1093
|
+
};
|
|
1094
|
+
} else {
|
|
1095
|
+
|
|
1096
|
+
mid = getExternalLabelMid(element);
|
|
1097
|
+
|
|
1098
|
+
size = DEFAULT_LABEL_SIZE$1;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
return assign$6({
|
|
1102
|
+
x: mid.x - size.width / 2,
|
|
1103
|
+
y: mid.y - size.height / 2
|
|
1104
|
+
}, size);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* @param {ModdleElement} semantic
|
|
1109
|
+
*
|
|
1110
|
+
* @returns {string}
|
|
1111
|
+
*/
|
|
1112
|
+
function getLabelAttr(semantic) {
|
|
1113
|
+
if (
|
|
1114
|
+
is$1(semantic, 'bpmn:FlowElement') ||
|
|
1115
|
+
is$1(semantic, 'bpmn:Participant') ||
|
|
1116
|
+
is$1(semantic, 'bpmn:Lane') ||
|
|
1117
|
+
is$1(semantic, 'bpmn:SequenceFlow') ||
|
|
1118
|
+
is$1(semantic, 'bpmn:MessageFlow') ||
|
|
1119
|
+
is$1(semantic, 'bpmn:DataInput') ||
|
|
1120
|
+
is$1(semantic, 'bpmn:DataOutput')
|
|
1121
|
+
) {
|
|
1122
|
+
return 'name';
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
if (is$1(semantic, 'bpmn:TextAnnotation')) {
|
|
1126
|
+
return 'text';
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
if (is$1(semantic, 'bpmn:Group')) {
|
|
1130
|
+
return 'categoryValueRef';
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* @param {ModdleElement} semantic
|
|
1136
|
+
*
|
|
1137
|
+
* @returns {string}
|
|
1138
|
+
*/
|
|
1139
|
+
function getCategoryValue(semantic) {
|
|
1140
|
+
var categoryValueRef = semantic['categoryValueRef'];
|
|
1141
|
+
|
|
1142
|
+
if (!categoryValueRef) {
|
|
1143
|
+
return '';
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
return categoryValueRef.value || '';
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* @param {Element} element
|
|
1152
|
+
*
|
|
1153
|
+
* @return {string}
|
|
1154
|
+
*/
|
|
1155
|
+
function getLabel(element) {
|
|
1156
|
+
var semantic = element.businessObject,
|
|
1157
|
+
attr = getLabelAttr(semantic);
|
|
1158
|
+
|
|
1159
|
+
if (attr) {
|
|
1160
|
+
|
|
1161
|
+
if (attr === 'categoryValueRef') {
|
|
1162
|
+
|
|
1163
|
+
return getCategoryValue(semantic);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
return semantic[attr] || '';
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
function ensureImported(element, target) {
|
|
1171
|
+
|
|
1172
|
+
if (element.ownerDocument !== target.ownerDocument) {
|
|
1173
|
+
try {
|
|
1174
|
+
|
|
1175
|
+
// may fail on webkit
|
|
1176
|
+
return target.ownerDocument.importNode(element, true);
|
|
1177
|
+
} catch (e) {
|
|
1178
|
+
|
|
1179
|
+
// ignore
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
return element;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* appendTo utility
|
|
1188
|
+
*/
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* Append a node to a target element and return the appended node.
|
|
1193
|
+
*
|
|
1194
|
+
* @param {SVGElement} element
|
|
1195
|
+
* @param {SVGElement} target
|
|
1196
|
+
*
|
|
1197
|
+
* @return {SVGElement} the appended node
|
|
1198
|
+
*/
|
|
1199
|
+
function appendTo(element, target) {
|
|
1200
|
+
return target.appendChild(ensureImported(element, target));
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* append utility
|
|
1205
|
+
*/
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Append a node to an element
|
|
1210
|
+
*
|
|
1211
|
+
* @param {SVGElement} element
|
|
1212
|
+
* @param {SVGElement} node
|
|
1213
|
+
*
|
|
1214
|
+
* @return {SVGElement} the element
|
|
1215
|
+
*/
|
|
1216
|
+
function append(target, node) {
|
|
1217
|
+
appendTo(node, target);
|
|
1218
|
+
return target;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* attribute accessor utility
|
|
1223
|
+
*/
|
|
1224
|
+
|
|
1225
|
+
var LENGTH_ATTR = 2;
|
|
1097
1226
|
|
|
1098
1227
|
var CSS_PROPERTIES = {
|
|
1099
1228
|
'alignment-baseline': 1,
|
|
@@ -1504,7 +1633,7 @@
|
|
|
1504
1633
|
*/
|
|
1505
1634
|
|
|
1506
1635
|
var TEXT_ENTITIES = /([&<>]{1})/g;
|
|
1507
|
-
var ATTR_ENTITIES = /([
|
|
1636
|
+
var ATTR_ENTITIES = /([&<>\n\r"]{1})/g;
|
|
1508
1637
|
|
|
1509
1638
|
var ENTITY_REPLACEMENT = {
|
|
1510
1639
|
'&': '&',
|
|
@@ -2017,7 +2146,7 @@
|
|
|
2017
2146
|
* @returns {number}
|
|
2018
2147
|
*/
|
|
2019
2148
|
function getWidth(bounds, overrides = {}) {
|
|
2020
|
-
return has$
|
|
2149
|
+
return has$5(overrides, 'width') ? overrides.width : bounds.width;
|
|
2021
2150
|
}
|
|
2022
2151
|
|
|
2023
2152
|
/**
|
|
@@ -2029,7 +2158,7 @@
|
|
|
2029
2158
|
* @returns {number}
|
|
2030
2159
|
*/
|
|
2031
2160
|
function getHeight(bounds, overrides = {}) {
|
|
2032
|
-
return has$
|
|
2161
|
+
return has$5(overrides, 'height') ? overrides.height : bounds.height;
|
|
2033
2162
|
}
|
|
2034
2163
|
|
|
2035
2164
|
function _mergeNamespaces$2(n, m) {
|
|
@@ -2057,15 +2186,15 @@
|
|
|
2057
2186
|
* @return {T[]}
|
|
2058
2187
|
*/
|
|
2059
2188
|
|
|
2060
|
-
const nativeToString$
|
|
2061
|
-
const nativeHasOwnProperty$
|
|
2189
|
+
const nativeToString$4 = Object.prototype.toString;
|
|
2190
|
+
const nativeHasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
2062
2191
|
|
|
2063
|
-
function isUndefined$
|
|
2192
|
+
function isUndefined$4(obj) {
|
|
2064
2193
|
return obj === undefined;
|
|
2065
2194
|
}
|
|
2066
2195
|
|
|
2067
|
-
function isArray$
|
|
2068
|
-
return nativeToString$
|
|
2196
|
+
function isArray$4(obj) {
|
|
2197
|
+
return nativeToString$4.call(obj) === '[object Array]';
|
|
2069
2198
|
}
|
|
2070
2199
|
|
|
2071
2200
|
/**
|
|
@@ -2076,8 +2205,8 @@
|
|
|
2076
2205
|
*
|
|
2077
2206
|
* @return {Boolean}
|
|
2078
2207
|
*/
|
|
2079
|
-
function has$
|
|
2080
|
-
return nativeHasOwnProperty$
|
|
2208
|
+
function has$3(target, key) {
|
|
2209
|
+
return nativeHasOwnProperty$3.call(target, key);
|
|
2081
2210
|
}
|
|
2082
2211
|
|
|
2083
2212
|
|
|
@@ -2091,20 +2220,20 @@
|
|
|
2091
2220
|
*
|
|
2092
2221
|
* @return {T} return result that stopped the iteration
|
|
2093
2222
|
*/
|
|
2094
|
-
function forEach$
|
|
2223
|
+
function forEach$3(collection, iterator) {
|
|
2095
2224
|
|
|
2096
2225
|
let val,
|
|
2097
2226
|
result;
|
|
2098
2227
|
|
|
2099
|
-
if (isUndefined$
|
|
2228
|
+
if (isUndefined$4(collection)) {
|
|
2100
2229
|
return;
|
|
2101
2230
|
}
|
|
2102
2231
|
|
|
2103
|
-
const convertKey = isArray$
|
|
2232
|
+
const convertKey = isArray$4(collection) ? toNum$3 : identity$3;
|
|
2104
2233
|
|
|
2105
2234
|
for (let key in collection) {
|
|
2106
2235
|
|
|
2107
|
-
if (has$
|
|
2236
|
+
if (has$3(collection, key)) {
|
|
2108
2237
|
val = collection[key];
|
|
2109
2238
|
|
|
2110
2239
|
result = iterator(val, convertKey(key));
|
|
@@ -2117,11 +2246,11 @@
|
|
|
2117
2246
|
}
|
|
2118
2247
|
|
|
2119
2248
|
|
|
2120
|
-
function identity$
|
|
2249
|
+
function identity$3(arg) {
|
|
2121
2250
|
return arg;
|
|
2122
2251
|
}
|
|
2123
2252
|
|
|
2124
|
-
function toNum$
|
|
2253
|
+
function toNum$3(arg) {
|
|
2125
2254
|
return Number(arg);
|
|
2126
2255
|
}
|
|
2127
2256
|
|
|
@@ -2133,15 +2262,15 @@
|
|
|
2133
2262
|
*
|
|
2134
2263
|
* @return {Element} the element
|
|
2135
2264
|
*/
|
|
2136
|
-
function assign$
|
|
2265
|
+
function assign$4(element, ...styleSources) {
|
|
2137
2266
|
const target = element.style;
|
|
2138
2267
|
|
|
2139
|
-
forEach$
|
|
2268
|
+
forEach$3(styleSources, function(style) {
|
|
2140
2269
|
if (!style) {
|
|
2141
2270
|
return;
|
|
2142
2271
|
}
|
|
2143
2272
|
|
|
2144
|
-
forEach$
|
|
2273
|
+
forEach$3(style, function(value, key) {
|
|
2145
2274
|
target[key] = value;
|
|
2146
2275
|
});
|
|
2147
2276
|
});
|
|
@@ -2371,7 +2500,7 @@
|
|
|
2371
2500
|
// when delegating.
|
|
2372
2501
|
var forceCaptureEvents$1 = [ 'focus', 'blur' ];
|
|
2373
2502
|
|
|
2374
|
-
function bind$
|
|
2503
|
+
function bind$3(el, selector, type, fn, capture) {
|
|
2375
2504
|
if (forceCaptureEvents$1.indexOf(type) !== -1) {
|
|
2376
2505
|
capture = true;
|
|
2377
2506
|
}
|
|
@@ -2403,7 +2532,7 @@
|
|
|
2403
2532
|
}
|
|
2404
2533
|
|
|
2405
2534
|
var delegate$1 = {
|
|
2406
|
-
bind: bind$
|
|
2535
|
+
bind: bind$3,
|
|
2407
2536
|
unbind: unbind$2
|
|
2408
2537
|
};
|
|
2409
2538
|
|
|
@@ -2990,7 +3119,7 @@
|
|
|
2990
3119
|
|
|
2991
3120
|
function drawCircle(parentGfx, width, height, offset, attrs = {}) {
|
|
2992
3121
|
|
|
2993
|
-
if (isObject(offset)) {
|
|
3122
|
+
if (isObject$2(offset)) {
|
|
2994
3123
|
attrs = offset;
|
|
2995
3124
|
offset = 0;
|
|
2996
3125
|
}
|
|
@@ -3016,7 +3145,7 @@
|
|
|
3016
3145
|
|
|
3017
3146
|
function drawRect(parentGfx, width, height, r, offset, attrs) {
|
|
3018
3147
|
|
|
3019
|
-
if (isObject(offset)) {
|
|
3148
|
+
if (isObject$2(offset)) {
|
|
3020
3149
|
attrs = offset;
|
|
3021
3150
|
offset = 0;
|
|
3022
3151
|
}
|
|
@@ -3111,7 +3240,7 @@
|
|
|
3111
3240
|
}
|
|
3112
3241
|
|
|
3113
3242
|
function drawMarker(type, parentGfx, path, attrs) {
|
|
3114
|
-
return drawPath(parentGfx, path, assign$
|
|
3243
|
+
return drawPath(parentGfx, path, assign$6({ 'data-marker': type }, attrs));
|
|
3115
3244
|
}
|
|
3116
3245
|
|
|
3117
3246
|
function renderer(type) {
|
|
@@ -3658,7 +3787,7 @@
|
|
|
3658
3787
|
taskMarkers.push('AdhocMarker');
|
|
3659
3788
|
|
|
3660
3789
|
if (!subprocess) {
|
|
3661
|
-
assign$
|
|
3790
|
+
assign$6(attrs, { compensation: attrs.compensation - 18 });
|
|
3662
3791
|
}
|
|
3663
3792
|
}
|
|
3664
3793
|
|
|
@@ -3667,12 +3796,12 @@
|
|
|
3667
3796
|
|
|
3668
3797
|
if (loopCharacteristics) {
|
|
3669
3798
|
|
|
3670
|
-
assign$
|
|
3799
|
+
assign$6(attrs, {
|
|
3671
3800
|
compensation: attrs.compensation - 18,
|
|
3672
3801
|
});
|
|
3673
3802
|
|
|
3674
3803
|
if (taskMarkers.includes('AdhocMarker')) {
|
|
3675
|
-
assign$
|
|
3804
|
+
assign$6(attrs, {
|
|
3676
3805
|
seq: -23,
|
|
3677
3806
|
loop: -18,
|
|
3678
3807
|
parallel: -24
|
|
@@ -3693,18 +3822,18 @@
|
|
|
3693
3822
|
}
|
|
3694
3823
|
|
|
3695
3824
|
if (taskMarkers.includes('CompensationMarker') && taskMarkers.length === 1) {
|
|
3696
|
-
assign$
|
|
3825
|
+
assign$6(attrs, {
|
|
3697
3826
|
compensation: -8
|
|
3698
3827
|
});
|
|
3699
3828
|
}
|
|
3700
3829
|
|
|
3701
|
-
forEach$
|
|
3830
|
+
forEach$5(taskMarkers, function(marker) {
|
|
3702
3831
|
renderTaskMarker(marker, parentGfx, element, attrs);
|
|
3703
3832
|
});
|
|
3704
3833
|
}
|
|
3705
3834
|
|
|
3706
3835
|
function renderLabel(parentGfx, label, attrs = {}) {
|
|
3707
|
-
attrs = assign$
|
|
3836
|
+
attrs = assign$6({
|
|
3708
3837
|
size: {
|
|
3709
3838
|
width: 100
|
|
3710
3839
|
}
|
|
@@ -3750,7 +3879,7 @@
|
|
|
3750
3879
|
return renderLabel(parentGfx, getLabel(element), {
|
|
3751
3880
|
box: box,
|
|
3752
3881
|
fitBox: true,
|
|
3753
|
-
style: assign$
|
|
3882
|
+
style: assign$6(
|
|
3754
3883
|
{},
|
|
3755
3884
|
textRenderer.getExternalStyle(),
|
|
3756
3885
|
{
|
|
@@ -5109,15 +5238,15 @@
|
|
|
5109
5238
|
* @return {T[]}
|
|
5110
5239
|
*/
|
|
5111
5240
|
|
|
5112
|
-
const nativeToString = Object.prototype.toString;
|
|
5113
|
-
const nativeHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
5241
|
+
const nativeToString$3 = Object.prototype.toString;
|
|
5242
|
+
const nativeHasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
5114
5243
|
|
|
5115
|
-
function isUndefined$
|
|
5244
|
+
function isUndefined$3(obj) {
|
|
5116
5245
|
return obj === undefined;
|
|
5117
5246
|
}
|
|
5118
5247
|
|
|
5119
|
-
function isArray$
|
|
5120
|
-
return nativeToString.call(obj) === '[object Array]';
|
|
5248
|
+
function isArray$3(obj) {
|
|
5249
|
+
return nativeToString$3.call(obj) === '[object Array]';
|
|
5121
5250
|
}
|
|
5122
5251
|
|
|
5123
5252
|
/**
|
|
@@ -5128,8 +5257,8 @@
|
|
|
5128
5257
|
*
|
|
5129
5258
|
* @return {Boolean}
|
|
5130
5259
|
*/
|
|
5131
|
-
function has(target, key) {
|
|
5132
|
-
return nativeHasOwnProperty.call(target, key);
|
|
5260
|
+
function has$2(target, key) {
|
|
5261
|
+
return nativeHasOwnProperty$2.call(target, key);
|
|
5133
5262
|
}
|
|
5134
5263
|
|
|
5135
5264
|
|
|
@@ -5143,20 +5272,20 @@
|
|
|
5143
5272
|
*
|
|
5144
5273
|
* @return {T} return result that stopped the iteration
|
|
5145
5274
|
*/
|
|
5146
|
-
function forEach(collection, iterator) {
|
|
5275
|
+
function forEach$2(collection, iterator) {
|
|
5147
5276
|
|
|
5148
5277
|
let val,
|
|
5149
5278
|
result;
|
|
5150
5279
|
|
|
5151
|
-
if (isUndefined$
|
|
5280
|
+
if (isUndefined$3(collection)) {
|
|
5152
5281
|
return;
|
|
5153
5282
|
}
|
|
5154
5283
|
|
|
5155
|
-
const convertKey = isArray$
|
|
5284
|
+
const convertKey = isArray$3(collection) ? toNum$2 : identity$2;
|
|
5156
5285
|
|
|
5157
5286
|
for (let key in collection) {
|
|
5158
5287
|
|
|
5159
|
-
if (has(collection, key)) {
|
|
5288
|
+
if (has$2(collection, key)) {
|
|
5160
5289
|
val = collection[key];
|
|
5161
5290
|
|
|
5162
5291
|
result = iterator(val, convertKey(key));
|
|
@@ -5169,11 +5298,11 @@
|
|
|
5169
5298
|
}
|
|
5170
5299
|
|
|
5171
5300
|
|
|
5172
|
-
function identity(arg) {
|
|
5301
|
+
function identity$2(arg) {
|
|
5173
5302
|
return arg;
|
|
5174
5303
|
}
|
|
5175
5304
|
|
|
5176
|
-
function toNum(arg) {
|
|
5305
|
+
function toNum$2(arg) {
|
|
5177
5306
|
return Number(arg);
|
|
5178
5307
|
}
|
|
5179
5308
|
|
|
@@ -5185,15 +5314,15 @@
|
|
|
5185
5314
|
*
|
|
5186
5315
|
* @return {Element} the element
|
|
5187
5316
|
*/
|
|
5188
|
-
function assign(element, ...styleSources) {
|
|
5317
|
+
function assign$3(element, ...styleSources) {
|
|
5189
5318
|
const target = element.style;
|
|
5190
5319
|
|
|
5191
|
-
forEach(styleSources, function(style) {
|
|
5320
|
+
forEach$2(styleSources, function(style) {
|
|
5192
5321
|
if (!style) {
|
|
5193
5322
|
return;
|
|
5194
5323
|
}
|
|
5195
5324
|
|
|
5196
|
-
forEach(style, function(value, key) {
|
|
5325
|
+
forEach$2(style, function(value, key) {
|
|
5197
5326
|
target[key] = value;
|
|
5198
5327
|
});
|
|
5199
5328
|
});
|
|
@@ -5470,7 +5599,7 @@
|
|
|
5470
5599
|
// when delegating.
|
|
5471
5600
|
var forceCaptureEvents = [ 'focus', 'blur' ];
|
|
5472
5601
|
|
|
5473
|
-
function bind(el, selector, type, fn, capture) {
|
|
5602
|
+
function bind$2(el, selector, type, fn, capture) {
|
|
5474
5603
|
if (forceCaptureEvents.indexOf(type) !== -1) {
|
|
5475
5604
|
capture = true;
|
|
5476
5605
|
}
|
|
@@ -5502,7 +5631,7 @@
|
|
|
5502
5631
|
}
|
|
5503
5632
|
|
|
5504
5633
|
var delegate = {
|
|
5505
|
-
bind,
|
|
5634
|
+
bind: bind$2,
|
|
5506
5635
|
unbind
|
|
5507
5636
|
};
|
|
5508
5637
|
|
|
@@ -5704,8 +5833,8 @@
|
|
|
5704
5833
|
*/
|
|
5705
5834
|
function parsePadding(padding) {
|
|
5706
5835
|
|
|
5707
|
-
if (isObject(padding)) {
|
|
5708
|
-
return assign$
|
|
5836
|
+
if (isObject$1(padding)) {
|
|
5837
|
+
return assign$5({ top: 0, left: 0, right: 0, bottom: 0 }, padding);
|
|
5709
5838
|
} else {
|
|
5710
5839
|
return {
|
|
5711
5840
|
top: padding,
|
|
@@ -5899,7 +6028,7 @@
|
|
|
5899
6028
|
id: 'helper-svg'
|
|
5900
6029
|
});
|
|
5901
6030
|
|
|
5902
|
-
assign(helperSvg, {
|
|
6031
|
+
assign$3(helperSvg, {
|
|
5903
6032
|
visibility: 'hidden',
|
|
5904
6033
|
position: 'fixed',
|
|
5905
6034
|
width: 0,
|
|
@@ -5920,7 +6049,7 @@
|
|
|
5920
6049
|
*/
|
|
5921
6050
|
function Text(config) {
|
|
5922
6051
|
|
|
5923
|
-
this._config = assign$
|
|
6052
|
+
this._config = assign$5({}, {
|
|
5924
6053
|
size: DEFAULT_LABEL_SIZE,
|
|
5925
6054
|
padding: DEFAULT_BOX_PADDING,
|
|
5926
6055
|
style: {},
|
|
@@ -5964,8 +6093,8 @@
|
|
|
5964
6093
|
* } }
|
|
5965
6094
|
*/
|
|
5966
6095
|
Text.prototype.layoutText = function(text, options) {
|
|
5967
|
-
var box = assign$
|
|
5968
|
-
style = assign$
|
|
6096
|
+
var box = assign$5({}, this._config.size, options.box),
|
|
6097
|
+
style = assign$5({}, this._config.style, options.style),
|
|
5969
6098
|
align = parseAlign(options.align || this._config.align),
|
|
5970
6099
|
padding = parsePadding(options.padding !== undefined ? options.padding : this._config.padding),
|
|
5971
6100
|
fitBox = options.fitBox || false;
|
|
@@ -6021,7 +6150,7 @@
|
|
|
6021
6150
|
|
|
6022
6151
|
// layout each line taking into account that parent
|
|
6023
6152
|
// shape might resize to fit text size
|
|
6024
|
-
forEach$
|
|
6153
|
+
forEach$4(layouted, function(line) {
|
|
6025
6154
|
|
|
6026
6155
|
var x;
|
|
6027
6156
|
|
|
@@ -6103,7 +6232,7 @@
|
|
|
6103
6232
|
*/
|
|
6104
6233
|
function TextRenderer(config) {
|
|
6105
6234
|
|
|
6106
|
-
var defaultStyle = assign$
|
|
6235
|
+
var defaultStyle = assign$6({
|
|
6107
6236
|
fontFamily: 'Arial, sans-serif',
|
|
6108
6237
|
fontSize: DEFAULT_FONT_SIZE,
|
|
6109
6238
|
fontWeight: 'normal',
|
|
@@ -6112,7 +6241,7 @@
|
|
|
6112
6241
|
|
|
6113
6242
|
var fontSize = parseInt(defaultStyle.fontSize, 10) - 1;
|
|
6114
6243
|
|
|
6115
|
-
var externalStyle = assign$
|
|
6244
|
+
var externalStyle = assign$6({}, defaultStyle, {
|
|
6116
6245
|
fontSize: fontSize
|
|
6117
6246
|
}, config && config.externalStyle || {});
|
|
6118
6247
|
|
|
@@ -6909,7 +7038,7 @@
|
|
|
6909
7038
|
* @return {Object}
|
|
6910
7039
|
*/
|
|
6911
7040
|
function elementData(semantic, di, attrs) {
|
|
6912
|
-
return assign$
|
|
7041
|
+
return assign$6({
|
|
6913
7042
|
id: semantic.id,
|
|
6914
7043
|
type: semantic.$type,
|
|
6915
7044
|
businessObject: semantic,
|
|
@@ -7251,7 +7380,7 @@
|
|
|
7251
7380
|
function getBBox(elements, stopRecursion) {
|
|
7252
7381
|
|
|
7253
7382
|
stopRecursion = !!stopRecursion;
|
|
7254
|
-
if (!isArray$
|
|
7383
|
+
if (!isArray$5(elements)) {
|
|
7255
7384
|
elements = [ elements ];
|
|
7256
7385
|
}
|
|
7257
7386
|
|
|
@@ -7260,7 +7389,7 @@
|
|
|
7260
7389
|
maxX,
|
|
7261
7390
|
maxY;
|
|
7262
7391
|
|
|
7263
|
-
forEach$
|
|
7392
|
+
forEach$4(elements, function(element) {
|
|
7264
7393
|
|
|
7265
7394
|
// If element is a connection the bbox must be computed first
|
|
7266
7395
|
var bbox = element;
|
|
@@ -7488,7 +7617,7 @@
|
|
|
7488
7617
|
/**
|
|
7489
7618
|
* @type {OverlaysConfigDefault}
|
|
7490
7619
|
*/
|
|
7491
|
-
this._overlayDefaults = assign$
|
|
7620
|
+
this._overlayDefaults = assign$5({
|
|
7492
7621
|
|
|
7493
7622
|
// no show constraints
|
|
7494
7623
|
show: null,
|
|
@@ -7550,11 +7679,11 @@
|
|
|
7550
7679
|
*/
|
|
7551
7680
|
Overlays.prototype.get = function(search) {
|
|
7552
7681
|
|
|
7553
|
-
if (isString(search)) {
|
|
7682
|
+
if (isString$3(search)) {
|
|
7554
7683
|
search = { id: search };
|
|
7555
7684
|
}
|
|
7556
7685
|
|
|
7557
|
-
if (isString(search.element)) {
|
|
7686
|
+
if (isString$3(search.element)) {
|
|
7558
7687
|
search.element = this._elementRegistry.get(search.element);
|
|
7559
7688
|
}
|
|
7560
7689
|
|
|
@@ -7563,12 +7692,12 @@
|
|
|
7563
7692
|
|
|
7564
7693
|
// return a list of overlays when searching by element (+type)
|
|
7565
7694
|
if (container) {
|
|
7566
|
-
return search.type ? filter(container.overlays, matchPattern({ type: search.type })) : container.overlays.slice();
|
|
7695
|
+
return search.type ? filter$1(container.overlays, matchPattern({ type: search.type })) : container.overlays.slice();
|
|
7567
7696
|
} else {
|
|
7568
7697
|
return [];
|
|
7569
7698
|
}
|
|
7570
7699
|
} else if (search.type) {
|
|
7571
|
-
return filter(this._overlays, matchPattern({ type: search.type }));
|
|
7700
|
+
return filter$1(this._overlays, matchPattern({ type: search.type }));
|
|
7572
7701
|
} else {
|
|
7573
7702
|
|
|
7574
7703
|
// return single element when searching by id
|
|
@@ -7587,7 +7716,7 @@
|
|
|
7587
7716
|
*/
|
|
7588
7717
|
Overlays.prototype.add = function(element, type, overlay) {
|
|
7589
7718
|
|
|
7590
|
-
if (isObject(type)) {
|
|
7719
|
+
if (isObject$1(type)) {
|
|
7591
7720
|
overlay = type;
|
|
7592
7721
|
type = null;
|
|
7593
7722
|
}
|
|
@@ -7610,7 +7739,7 @@
|
|
|
7610
7739
|
|
|
7611
7740
|
var id = this._ids.next();
|
|
7612
7741
|
|
|
7613
|
-
overlay = assign$
|
|
7742
|
+
overlay = assign$5({}, this._overlayDefaults, overlay, {
|
|
7614
7743
|
id: id,
|
|
7615
7744
|
type: type,
|
|
7616
7745
|
element: element,
|
|
@@ -7634,13 +7763,13 @@
|
|
|
7634
7763
|
|
|
7635
7764
|
var overlays = this.get(filter) || [];
|
|
7636
7765
|
|
|
7637
|
-
if (!isArray$
|
|
7766
|
+
if (!isArray$5(overlays)) {
|
|
7638
7767
|
overlays = [ overlays ];
|
|
7639
7768
|
}
|
|
7640
7769
|
|
|
7641
7770
|
var self = this;
|
|
7642
7771
|
|
|
7643
|
-
forEach$
|
|
7772
|
+
forEach$4(overlays, function(overlay) {
|
|
7644
7773
|
|
|
7645
7774
|
var container = self._getOverlayContainer(overlay.element, true);
|
|
7646
7775
|
|
|
@@ -7766,7 +7895,7 @@
|
|
|
7766
7895
|
|
|
7767
7896
|
Overlays.prototype._createOverlayContainer = function(element) {
|
|
7768
7897
|
var html = domify$1('<div class="djs-overlays" />');
|
|
7769
|
-
assign(html, { position: 'absolute' });
|
|
7898
|
+
assign$3(html, { position: 'absolute' });
|
|
7770
7899
|
|
|
7771
7900
|
this._overlayRoot.appendChild(html);
|
|
7772
7901
|
|
|
@@ -7803,7 +7932,7 @@
|
|
|
7803
7932
|
|
|
7804
7933
|
|
|
7805
7934
|
Overlays.prototype._getOverlayContainer = function(element, raw) {
|
|
7806
|
-
var container = find(this._overlayContainers, function(c) {
|
|
7935
|
+
var container = find$1(this._overlayContainers, function(c) {
|
|
7807
7936
|
return c.element === element;
|
|
7808
7937
|
});
|
|
7809
7938
|
|
|
@@ -7831,14 +7960,14 @@
|
|
|
7831
7960
|
|
|
7832
7961
|
// create proper html elements from
|
|
7833
7962
|
// overlay HTML strings
|
|
7834
|
-
if (isString(html)) {
|
|
7963
|
+
if (isString$3(html)) {
|
|
7835
7964
|
html = domify$1(html);
|
|
7836
7965
|
}
|
|
7837
7966
|
|
|
7838
7967
|
overlayContainer = this._getOverlayContainer(element);
|
|
7839
7968
|
|
|
7840
7969
|
htmlContainer = domify$1('<div class="djs-overlay" data-overlay-id="' + id + '">');
|
|
7841
|
-
assign(htmlContainer, { position: 'absolute' });
|
|
7970
|
+
assign$3(htmlContainer, { position: 'absolute' });
|
|
7842
7971
|
|
|
7843
7972
|
htmlContainer.appendChild(html);
|
|
7844
7973
|
|
|
@@ -7876,8 +8005,8 @@
|
|
|
7876
8005
|
visible = false;
|
|
7877
8006
|
} else if (show) {
|
|
7878
8007
|
if (
|
|
7879
|
-
(isDefined(minZoom) && minZoom > viewbox.scale) ||
|
|
7880
|
-
(isDefined(maxZoom) && maxZoom < viewbox.scale)
|
|
8008
|
+
(isDefined$1(minZoom) && minZoom > viewbox.scale) ||
|
|
8009
|
+
(isDefined$1(maxZoom) && maxZoom < viewbox.scale)
|
|
7881
8010
|
) {
|
|
7882
8011
|
visible = false;
|
|
7883
8012
|
}
|
|
@@ -7907,16 +8036,16 @@
|
|
|
7907
8036
|
maxScale = shouldScale.max;
|
|
7908
8037
|
}
|
|
7909
8038
|
|
|
7910
|
-
if (isDefined(minScale) && viewbox.scale < minScale) {
|
|
8039
|
+
if (isDefined$1(minScale) && viewbox.scale < minScale) {
|
|
7911
8040
|
scale = (1 / viewbox.scale || 1) * minScale;
|
|
7912
8041
|
}
|
|
7913
8042
|
|
|
7914
|
-
if (isDefined(maxScale) && viewbox.scale > maxScale) {
|
|
8043
|
+
if (isDefined$1(maxScale) && viewbox.scale > maxScale) {
|
|
7915
8044
|
scale = (1 / viewbox.scale || 1) * maxScale;
|
|
7916
8045
|
}
|
|
7917
8046
|
}
|
|
7918
8047
|
|
|
7919
|
-
if (isDefined(scale)) {
|
|
8048
|
+
if (isDefined$1(scale)) {
|
|
7920
8049
|
transform = 'scale(' + scale + ',' + scale + ')';
|
|
7921
8050
|
}
|
|
7922
8051
|
|
|
@@ -7928,7 +8057,7 @@
|
|
|
7928
8057
|
|
|
7929
8058
|
var self = this;
|
|
7930
8059
|
|
|
7931
|
-
forEach$
|
|
8060
|
+
forEach$4(this._overlays, function(overlay) {
|
|
7932
8061
|
self._updateOverlayVisibilty(overlay, viewbox);
|
|
7933
8062
|
});
|
|
7934
8063
|
};
|
|
@@ -7965,7 +8094,7 @@
|
|
|
7965
8094
|
var element = e.element;
|
|
7966
8095
|
var overlays = self.get({ element: element });
|
|
7967
8096
|
|
|
7968
|
-
forEach$
|
|
8097
|
+
forEach$4(overlays, function(o) {
|
|
7969
8098
|
self.remove(o.id);
|
|
7970
8099
|
});
|
|
7971
8100
|
|
|
@@ -7989,7 +8118,7 @@
|
|
|
7989
8118
|
var container = self._getOverlayContainer(element, true);
|
|
7990
8119
|
|
|
7991
8120
|
if (container) {
|
|
7992
|
-
forEach$
|
|
8121
|
+
forEach$4(container.overlays, function(overlay) {
|
|
7993
8122
|
self._updateOverlay(overlay);
|
|
7994
8123
|
});
|
|
7995
8124
|
|
|
@@ -8026,7 +8155,7 @@
|
|
|
8026
8155
|
'<div class="djs-overlay-container" />'
|
|
8027
8156
|
);
|
|
8028
8157
|
|
|
8029
|
-
assign(root, {
|
|
8158
|
+
assign$3(root, {
|
|
8030
8159
|
position: 'absolute',
|
|
8031
8160
|
width: 0,
|
|
8032
8161
|
height: 0
|
|
@@ -8038,7 +8167,7 @@
|
|
|
8038
8167
|
}
|
|
8039
8168
|
|
|
8040
8169
|
function setPosition(el, x, y) {
|
|
8041
|
-
assign(el, { left: x + 'px', top: y + 'px' });
|
|
8170
|
+
assign$3(el, { left: x + 'px', top: y + 'px' });
|
|
8042
8171
|
}
|
|
8043
8172
|
|
|
8044
8173
|
/**
|
|
@@ -8212,7 +8341,7 @@
|
|
|
8212
8341
|
*/
|
|
8213
8342
|
CommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {
|
|
8214
8343
|
|
|
8215
|
-
if (isFunction(hook) || isNumber(hook)) {
|
|
8344
|
+
if (isFunction$1(hook) || isNumber(hook)) {
|
|
8216
8345
|
that = unwrap;
|
|
8217
8346
|
unwrap = handlerFn;
|
|
8218
8347
|
handlerFn = priority;
|
|
@@ -8220,29 +8349,29 @@
|
|
|
8220
8349
|
hook = null;
|
|
8221
8350
|
}
|
|
8222
8351
|
|
|
8223
|
-
if (isFunction(priority)) {
|
|
8352
|
+
if (isFunction$1(priority)) {
|
|
8224
8353
|
that = unwrap;
|
|
8225
8354
|
unwrap = handlerFn;
|
|
8226
8355
|
handlerFn = priority;
|
|
8227
8356
|
priority = DEFAULT_PRIORITY$1;
|
|
8228
8357
|
}
|
|
8229
8358
|
|
|
8230
|
-
if (isObject(unwrap)) {
|
|
8359
|
+
if (isObject$1(unwrap)) {
|
|
8231
8360
|
that = unwrap;
|
|
8232
8361
|
unwrap = false;
|
|
8233
8362
|
}
|
|
8234
8363
|
|
|
8235
|
-
if (!isFunction(handlerFn)) {
|
|
8364
|
+
if (!isFunction$1(handlerFn)) {
|
|
8236
8365
|
throw new Error('handlerFn must be a function');
|
|
8237
8366
|
}
|
|
8238
8367
|
|
|
8239
|
-
if (!isArray$
|
|
8368
|
+
if (!isArray$5(events)) {
|
|
8240
8369
|
events = [ events ];
|
|
8241
8370
|
}
|
|
8242
8371
|
|
|
8243
8372
|
var eventBus = this._eventBus;
|
|
8244
8373
|
|
|
8245
|
-
forEach$
|
|
8374
|
+
forEach$4(events, function(event) {
|
|
8246
8375
|
|
|
8247
8376
|
// concat commandStack(.event)?(.hook)?
|
|
8248
8377
|
var fullEvent = [ 'commandStack', event, hook ].filter(function(e) { return e; }).join('.');
|
|
@@ -8376,7 +8505,7 @@
|
|
|
8376
8505
|
*/
|
|
8377
8506
|
const hookFn = function(events, priority, handlerFn, unwrap, that) {
|
|
8378
8507
|
|
|
8379
|
-
if (isFunction(events) || isNumber(events)) {
|
|
8508
|
+
if (isFunction$1(events) || isNumber(events)) {
|
|
8380
8509
|
that = unwrap;
|
|
8381
8510
|
unwrap = handlerFn;
|
|
8382
8511
|
handlerFn = priority;
|
|
@@ -8525,7 +8654,7 @@
|
|
|
8525
8654
|
var shape = event.element,
|
|
8526
8655
|
businessObject = getBusinessObject(shape);
|
|
8527
8656
|
|
|
8528
|
-
var isPresent = find(businessObjectParents, function(element) {
|
|
8657
|
+
var isPresent = find$2(businessObjectParents, function(element) {
|
|
8529
8658
|
return element === businessObject;
|
|
8530
8659
|
});
|
|
8531
8660
|
|
|
@@ -9466,13 +9595,13 @@
|
|
|
9466
9595
|
}
|
|
9467
9596
|
|
|
9468
9597
|
function registerEvents(svg) {
|
|
9469
|
-
forEach$
|
|
9598
|
+
forEach$4(bindings, function(val, key) {
|
|
9470
9599
|
registerEvent(svg, key, val);
|
|
9471
9600
|
});
|
|
9472
9601
|
}
|
|
9473
9602
|
|
|
9474
9603
|
function unregisterEvents(svg) {
|
|
9475
|
-
forEach$
|
|
9604
|
+
forEach$4(bindings, function(val, key) {
|
|
9476
9605
|
unregisterEvent(svg, key, val);
|
|
9477
9606
|
});
|
|
9478
9607
|
}
|
|
@@ -9543,7 +9672,7 @@
|
|
|
9543
9672
|
|
|
9544
9673
|
function createHitStyle(classNames, attrs) {
|
|
9545
9674
|
|
|
9546
|
-
attrs = assign$
|
|
9675
|
+
attrs = assign$5({
|
|
9547
9676
|
stroke: 'white',
|
|
9548
9677
|
strokeWidth: 15
|
|
9549
9678
|
}, attrs || {});
|
|
@@ -9582,7 +9711,7 @@
|
|
|
9582
9711
|
this.removeHits = function(gfx) {
|
|
9583
9712
|
var hits = all('.djs-hit', gfx);
|
|
9584
9713
|
|
|
9585
|
-
forEach$
|
|
9714
|
+
forEach$4(hits, remove$3);
|
|
9586
9715
|
};
|
|
9587
9716
|
|
|
9588
9717
|
/**
|
|
@@ -9641,7 +9770,7 @@
|
|
|
9641
9770
|
*/
|
|
9642
9771
|
this.createBoxHit = function(gfx, type, attrs) {
|
|
9643
9772
|
|
|
9644
|
-
attrs = assign$
|
|
9773
|
+
attrs = assign$5({
|
|
9645
9774
|
x: 0,
|
|
9646
9775
|
y: 0
|
|
9647
9776
|
}, attrs);
|
|
@@ -9876,7 +10005,7 @@
|
|
|
9876
10005
|
var selectedElements = this._selectedElements,
|
|
9877
10006
|
oldSelection = selectedElements.slice();
|
|
9878
10007
|
|
|
9879
|
-
if (!isArray$
|
|
10008
|
+
if (!isArray$5(elements)) {
|
|
9880
10009
|
elements = elements ? [ elements ] : [];
|
|
9881
10010
|
}
|
|
9882
10011
|
|
|
@@ -9893,7 +10022,7 @@
|
|
|
9893
10022
|
// selection may be cleared by passing an empty array or null
|
|
9894
10023
|
// to the method
|
|
9895
10024
|
if (add) {
|
|
9896
|
-
forEach$
|
|
10025
|
+
forEach$4(elements, function(element) {
|
|
9897
10026
|
if (selectedElements.indexOf(element) !== -1) {
|
|
9898
10027
|
|
|
9899
10028
|
// already selected
|
|
@@ -9960,13 +10089,13 @@
|
|
|
9960
10089
|
var oldSelection = event.oldSelection,
|
|
9961
10090
|
newSelection = event.newSelection;
|
|
9962
10091
|
|
|
9963
|
-
forEach$
|
|
10092
|
+
forEach$4(oldSelection, function(e) {
|
|
9964
10093
|
if (newSelection.indexOf(e) === -1) {
|
|
9965
10094
|
deselect(e);
|
|
9966
10095
|
}
|
|
9967
10096
|
});
|
|
9968
10097
|
|
|
9969
|
-
forEach$
|
|
10098
|
+
forEach$4(newSelection, function(e) {
|
|
9970
10099
|
if (oldSelection.indexOf(e) === -1) {
|
|
9971
10100
|
select(e);
|
|
9972
10101
|
}
|
|
@@ -10009,7 +10138,7 @@
|
|
|
10009
10138
|
return;
|
|
10010
10139
|
}
|
|
10011
10140
|
|
|
10012
|
-
if (isArray$
|
|
10141
|
+
if (isArray$5(autoSelect)) {
|
|
10013
10142
|
selection.select(autoSelect);
|
|
10014
10143
|
} else {
|
|
10015
10144
|
|
|
@@ -10036,7 +10165,7 @@
|
|
|
10036
10165
|
var shape = elementRegistry.get(event.context.shape.id);
|
|
10037
10166
|
|
|
10038
10167
|
// Always select main shape on move
|
|
10039
|
-
var isSelected = find(previousSelection, function(selectedShape) {
|
|
10168
|
+
var isSelected = find$1(previousSelection, function(selectedShape) {
|
|
10040
10169
|
return shape.id === selectedShape.id;
|
|
10041
10170
|
});
|
|
10042
10171
|
|
|
@@ -10128,7 +10257,7 @@
|
|
|
10128
10257
|
*
|
|
10129
10258
|
* @return {boolean}
|
|
10130
10259
|
*/
|
|
10131
|
-
function isArray(obj) {
|
|
10260
|
+
function isArray$2(obj) {
|
|
10132
10261
|
return Array.isArray(obj);
|
|
10133
10262
|
}
|
|
10134
10263
|
|
|
@@ -10155,7 +10284,7 @@
|
|
|
10155
10284
|
*/
|
|
10156
10285
|
function annotate(...args) {
|
|
10157
10286
|
|
|
10158
|
-
if (args.length === 1 && isArray(args[0])) {
|
|
10287
|
+
if (args.length === 1 && isArray$2(args[0])) {
|
|
10159
10288
|
args = args[0];
|
|
10160
10289
|
}
|
|
10161
10290
|
|
|
@@ -10300,7 +10429,7 @@
|
|
|
10300
10429
|
}
|
|
10301
10430
|
|
|
10302
10431
|
if (typeof fn !== 'function') {
|
|
10303
|
-
if (isArray(fn)) {
|
|
10432
|
+
if (isArray$2(fn)) {
|
|
10304
10433
|
fn = annotate(fn.slice());
|
|
10305
10434
|
} else {
|
|
10306
10435
|
throw error(`Cannot invoke "${ fn }". Expected a function!`);
|
|
@@ -10599,7 +10728,7 @@
|
|
|
10599
10728
|
// helpers ///////////////
|
|
10600
10729
|
|
|
10601
10730
|
function arrayUnwrap(type, value) {
|
|
10602
|
-
if (type !== 'value' && isArray(value)) {
|
|
10731
|
+
if (type !== 'value' && isArray$2(value)) {
|
|
10603
10732
|
value = annotate(value.slice());
|
|
10604
10733
|
}
|
|
10605
10734
|
|
|
@@ -10654,9 +10783,9 @@
|
|
|
10654
10783
|
});
|
|
10655
10784
|
|
|
10656
10785
|
if (isFrameElement(element)) {
|
|
10657
|
-
attr$1(rect, assign$
|
|
10786
|
+
attr$1(rect, assign$5({}, this.FRAME_STYLE, attrs || {}));
|
|
10658
10787
|
} else {
|
|
10659
|
-
attr$1(rect, assign$
|
|
10788
|
+
attr$1(rect, assign$5({}, this.SHAPE_STYLE, attrs || {}));
|
|
10660
10789
|
}
|
|
10661
10790
|
|
|
10662
10791
|
append(visuals, rect);
|
|
@@ -10669,7 +10798,7 @@
|
|
|
10669
10798
|
*/
|
|
10670
10799
|
DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
|
|
10671
10800
|
|
|
10672
|
-
var line = createLine(connection.waypoints, assign$
|
|
10801
|
+
var line = createLine(connection.waypoints, assign$5({}, this.CONNECTION_STYLE, attrs || {}));
|
|
10673
10802
|
append(visuals, line);
|
|
10674
10803
|
|
|
10675
10804
|
return line;
|
|
@@ -10751,7 +10880,7 @@
|
|
|
10751
10880
|
this.cls = function(className, traits, additionalAttrs) {
|
|
10752
10881
|
var attrs = this.style(traits, additionalAttrs);
|
|
10753
10882
|
|
|
10754
|
-
return assign$
|
|
10883
|
+
return assign$5(attrs, { 'class': className });
|
|
10755
10884
|
};
|
|
10756
10885
|
|
|
10757
10886
|
/**
|
|
@@ -10765,16 +10894,16 @@
|
|
|
10765
10894
|
*/
|
|
10766
10895
|
this.style = function(traits, additionalAttrs) {
|
|
10767
10896
|
|
|
10768
|
-
if (!isArray$
|
|
10897
|
+
if (!isArray$5(traits) && !additionalAttrs) {
|
|
10769
10898
|
additionalAttrs = traits;
|
|
10770
10899
|
traits = [];
|
|
10771
10900
|
}
|
|
10772
10901
|
|
|
10773
10902
|
var attrs = reduce(traits, function(attrs, t) {
|
|
10774
|
-
return assign$
|
|
10903
|
+
return assign$5(attrs, defaultTraits[t] || {});
|
|
10775
10904
|
}, {});
|
|
10776
10905
|
|
|
10777
|
-
return additionalAttrs ? assign$
|
|
10906
|
+
return additionalAttrs ? assign$5(attrs, additionalAttrs) : attrs;
|
|
10778
10907
|
};
|
|
10779
10908
|
|
|
10780
10909
|
|
|
@@ -10789,12 +10918,12 @@
|
|
|
10789
10918
|
* @return {Object} the style definition
|
|
10790
10919
|
*/
|
|
10791
10920
|
this.computeStyle = function(custom, traits, defaultStyles) {
|
|
10792
|
-
if (!isArray$
|
|
10921
|
+
if (!isArray$5(traits)) {
|
|
10793
10922
|
defaultStyles = traits;
|
|
10794
10923
|
traits = [];
|
|
10795
10924
|
}
|
|
10796
10925
|
|
|
10797
|
-
return self.style(traits || [], assign$
|
|
10926
|
+
return self.style(traits || [], assign$5({}, defaultStyles, custom || {}));
|
|
10798
10927
|
};
|
|
10799
10928
|
}
|
|
10800
10929
|
|
|
@@ -10949,7 +11078,7 @@
|
|
|
10949
11078
|
*/
|
|
10950
11079
|
function createContainer(options) {
|
|
10951
11080
|
|
|
10952
|
-
options = assign$
|
|
11081
|
+
options = assign$5({}, { width: '100%', height: '100%' }, options);
|
|
10953
11082
|
|
|
10954
11083
|
const container = options.container || document.body;
|
|
10955
11084
|
|
|
@@ -10959,7 +11088,7 @@
|
|
|
10959
11088
|
const parent = document.createElement('div');
|
|
10960
11089
|
parent.setAttribute('class', 'djs-container djs-parent');
|
|
10961
11090
|
|
|
10962
|
-
assign(parent, {
|
|
11091
|
+
assign$3(parent, {
|
|
10963
11092
|
position: 'relative',
|
|
10964
11093
|
overflow: 'hidden',
|
|
10965
11094
|
width: ensurePx(options.width),
|
|
@@ -11102,7 +11231,7 @@
|
|
|
11102
11231
|
// debounce canvas.viewbox.changed events when deferUpdate is set
|
|
11103
11232
|
// to help with potential performance issues
|
|
11104
11233
|
if (config.deferUpdate) {
|
|
11105
|
-
this._viewboxChanged = debounce(bind$
|
|
11234
|
+
this._viewboxChanged = debounce(bind$4(this._viewboxChanged, this), 300);
|
|
11106
11235
|
}
|
|
11107
11236
|
|
|
11108
11237
|
eventBus.on('diagram.init', () => {
|
|
@@ -11444,7 +11573,7 @@
|
|
|
11444
11573
|
};
|
|
11445
11574
|
|
|
11446
11575
|
Canvas.prototype._findPlaneForRoot = function(rootElement) {
|
|
11447
|
-
return find(this._planes, function(plane) {
|
|
11576
|
+
return find$1(this._planes, function(plane) {
|
|
11448
11577
|
return plane.rootElement === rootElement;
|
|
11449
11578
|
});
|
|
11450
11579
|
};
|
|
@@ -11479,7 +11608,7 @@
|
|
|
11479
11608
|
return;
|
|
11480
11609
|
}
|
|
11481
11610
|
|
|
11482
|
-
forEach$
|
|
11611
|
+
forEach$4([ container.gfx, container.secondaryGfx ], function(gfx) {
|
|
11483
11612
|
if (gfx) {
|
|
11484
11613
|
|
|
11485
11614
|
// invoke either addClass or removeClass based on mode
|
|
@@ -12137,7 +12266,7 @@
|
|
|
12137
12266
|
|
|
12138
12267
|
if (delta) {
|
|
12139
12268
|
this._changeViewbox(function() {
|
|
12140
|
-
delta = assign$
|
|
12269
|
+
delta = assign$5({ dx: 0, dy: 0 }, delta || {});
|
|
12141
12270
|
|
|
12142
12271
|
matrix = this._svg.createSVGMatrix().translate(delta.dx, delta.dy).multiply(matrix);
|
|
12143
12272
|
|
|
@@ -12336,7 +12465,7 @@
|
|
|
12336
12465
|
const currentScale = currentMatrix.a;
|
|
12337
12466
|
|
|
12338
12467
|
if (center) {
|
|
12339
|
-
centerPoint = assign$
|
|
12468
|
+
centerPoint = assign$5(point, center);
|
|
12340
12469
|
|
|
12341
12470
|
// revert applied viewport transformations
|
|
12342
12471
|
originalPoint = centerPoint.matrixTransform(currentMatrix.inverse());
|
|
@@ -13276,7 +13405,7 @@
|
|
|
13276
13405
|
if (!Type) {
|
|
13277
13406
|
throw new Error('unknown type: <' + type + '>');
|
|
13278
13407
|
}
|
|
13279
|
-
return assign$
|
|
13408
|
+
return assign$5(new Type(), attrs);
|
|
13280
13409
|
}
|
|
13281
13410
|
|
|
13282
13411
|
/**
|
|
@@ -13376,7 +13505,7 @@
|
|
|
13376
13505
|
*/
|
|
13377
13506
|
ElementFactory.prototype.create = function(type, attrs) {
|
|
13378
13507
|
|
|
13379
|
-
attrs = assign$
|
|
13508
|
+
attrs = assign$5({}, attrs || {});
|
|
13380
13509
|
|
|
13381
13510
|
if (!attrs.id) {
|
|
13382
13511
|
attrs.id = type + '_' + (this._uid++);
|
|
@@ -13554,9 +13683,9 @@
|
|
|
13554
13683
|
*/
|
|
13555
13684
|
EventBus.prototype.on = function(events, priority, callback, that) {
|
|
13556
13685
|
|
|
13557
|
-
events = isArray$
|
|
13686
|
+
events = isArray$5(events) ? events : [ events ];
|
|
13558
13687
|
|
|
13559
|
-
if (isFunction(priority)) {
|
|
13688
|
+
if (isFunction$1(priority)) {
|
|
13560
13689
|
that = callback;
|
|
13561
13690
|
callback = priority;
|
|
13562
13691
|
priority = DEFAULT_PRIORITY;
|
|
@@ -13569,7 +13698,7 @@
|
|
|
13569
13698
|
var actualCallback = callback;
|
|
13570
13699
|
|
|
13571
13700
|
if (that) {
|
|
13572
|
-
actualCallback = bind$
|
|
13701
|
+
actualCallback = bind$4(callback, that);
|
|
13573
13702
|
|
|
13574
13703
|
// make sure we remember and are able to remove
|
|
13575
13704
|
// bound callbacks via {@link #off} using the original
|
|
@@ -13613,7 +13742,7 @@
|
|
|
13613
13742
|
EventBus.prototype.once = function(events, priority, callback, that) {
|
|
13614
13743
|
var self = this;
|
|
13615
13744
|
|
|
13616
|
-
if (isFunction(priority)) {
|
|
13745
|
+
if (isFunction$1(priority)) {
|
|
13617
13746
|
that = callback;
|
|
13618
13747
|
callback = priority;
|
|
13619
13748
|
priority = DEFAULT_PRIORITY;
|
|
@@ -13652,7 +13781,7 @@
|
|
|
13652
13781
|
*/
|
|
13653
13782
|
EventBus.prototype.off = function(events, callback) {
|
|
13654
13783
|
|
|
13655
|
-
events = isArray$
|
|
13784
|
+
events = isArray$5(events) ? events : [ events ];
|
|
13656
13785
|
|
|
13657
13786
|
var self = this;
|
|
13658
13787
|
|
|
@@ -13977,7 +14106,7 @@
|
|
|
13977
14106
|
};
|
|
13978
14107
|
|
|
13979
14108
|
InternalEvent.prototype.init = function(data) {
|
|
13980
|
-
assign$
|
|
14109
|
+
assign$5(this, data || {});
|
|
13981
14110
|
};
|
|
13982
14111
|
|
|
13983
14112
|
|
|
@@ -14176,7 +14305,7 @@
|
|
|
14176
14305
|
|
|
14177
14306
|
// update all parents of changed and reorganized their children
|
|
14178
14307
|
// in the correct order (as indicated in our model)
|
|
14179
|
-
forEach$
|
|
14308
|
+
forEach$4(parents, function(parent) {
|
|
14180
14309
|
|
|
14181
14310
|
var children = parent.children;
|
|
14182
14311
|
|
|
@@ -14186,7 +14315,7 @@
|
|
|
14186
14315
|
|
|
14187
14316
|
var childrenGfx = self._getChildrenContainer(parent);
|
|
14188
14317
|
|
|
14189
|
-
forEach$
|
|
14318
|
+
forEach$4(children.slice().reverse(), function(child) {
|
|
14190
14319
|
var childGfx = elementRegistry.getGraphics(child);
|
|
14191
14320
|
|
|
14192
14321
|
prependTo(childGfx.parentNode, childrenGfx);
|
|
@@ -14514,47 +14643,272 @@
|
|
|
14514
14643
|
};
|
|
14515
14644
|
|
|
14516
14645
|
/**
|
|
14517
|
-
* @overlord
|
|
14518
|
-
*
|
|
14519
|
-
* Invoke the given function, injecting dependencies. Return the result.
|
|
14520
|
-
*
|
|
14521
|
-
* @template T
|
|
14522
|
-
*
|
|
14523
|
-
* @param {FactoryFunction<T>} func
|
|
14524
|
-
* @param {InjectionContext} [context]
|
|
14525
|
-
* @param {LocalsMap} [locals]
|
|
14526
|
-
*
|
|
14527
|
-
* @return {T}
|
|
14528
|
-
*/
|
|
14529
|
-
/**
|
|
14530
|
-
* Invoke the given function, injecting dependencies provided in
|
|
14531
|
-
* array notation. Return the result.
|
|
14646
|
+
* @overlord
|
|
14647
|
+
*
|
|
14648
|
+
* Invoke the given function, injecting dependencies. Return the result.
|
|
14649
|
+
*
|
|
14650
|
+
* @template T
|
|
14651
|
+
*
|
|
14652
|
+
* @param {FactoryFunction<T>} func
|
|
14653
|
+
* @param {InjectionContext} [context]
|
|
14654
|
+
* @param {LocalsMap} [locals]
|
|
14655
|
+
*
|
|
14656
|
+
* @return {T}
|
|
14657
|
+
*/
|
|
14658
|
+
/**
|
|
14659
|
+
* Invoke the given function, injecting dependencies provided in
|
|
14660
|
+
* array notation. Return the result.
|
|
14661
|
+
*
|
|
14662
|
+
* @template T
|
|
14663
|
+
*
|
|
14664
|
+
* @param {ArrayFunc<T>} func function to be invoked
|
|
14665
|
+
* @param {InjectionContext} [context] context of the invocation
|
|
14666
|
+
* @param {LocalsMap} [locals] locals provided
|
|
14667
|
+
*
|
|
14668
|
+
* @return {T}
|
|
14669
|
+
*/
|
|
14670
|
+
Diagram.prototype.invoke = function(func, context, locals) {
|
|
14671
|
+
return this._injector.invoke(func, context, locals);
|
|
14672
|
+
};
|
|
14673
|
+
|
|
14674
|
+
/**
|
|
14675
|
+
* Destroys the diagram
|
|
14676
|
+
*/
|
|
14677
|
+
Diagram.prototype.destroy = function() {
|
|
14678
|
+
this.get('eventBus').fire('diagram.destroy');
|
|
14679
|
+
};
|
|
14680
|
+
|
|
14681
|
+
/**
|
|
14682
|
+
* Clear the diagram, removing all contents.
|
|
14683
|
+
*/
|
|
14684
|
+
Diagram.prototype.clear = function() {
|
|
14685
|
+
this.get('eventBus').fire('diagram.clear');
|
|
14686
|
+
};
|
|
14687
|
+
|
|
14688
|
+
/**
|
|
14689
|
+
* Flatten array, one level deep.
|
|
14690
|
+
*
|
|
14691
|
+
* @template T
|
|
14692
|
+
*
|
|
14693
|
+
* @param {T[][] | T[] | null} [arr]
|
|
14694
|
+
*
|
|
14695
|
+
* @return {T[]}
|
|
14696
|
+
*/
|
|
14697
|
+
|
|
14698
|
+
const nativeToString$2 = Object.prototype.toString;
|
|
14699
|
+
|
|
14700
|
+
function isString$2(obj) {
|
|
14701
|
+
return nativeToString$2.call(obj) === '[object String]';
|
|
14702
|
+
}
|
|
14703
|
+
|
|
14704
|
+
/**
|
|
14705
|
+
* Convenience wrapper for `Object.assign`.
|
|
14706
|
+
*
|
|
14707
|
+
* @param {Object} target
|
|
14708
|
+
* @param {...Object} others
|
|
14709
|
+
*
|
|
14710
|
+
* @return {Object} the target
|
|
14711
|
+
*/
|
|
14712
|
+
function assign$2(target, ...others) {
|
|
14713
|
+
return Object.assign(target, ...others);
|
|
14714
|
+
}
|
|
14715
|
+
|
|
14716
|
+
/**
|
|
14717
|
+
* Flatten array, one level deep.
|
|
14718
|
+
*
|
|
14719
|
+
* @template T
|
|
14720
|
+
*
|
|
14721
|
+
* @param {T[][] | T[] | null} [arr]
|
|
14722
|
+
*
|
|
14723
|
+
* @return {T[]}
|
|
14724
|
+
*/
|
|
14725
|
+
|
|
14726
|
+
const nativeToString$1 = Object.prototype.toString;
|
|
14727
|
+
const nativeHasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
14728
|
+
|
|
14729
|
+
function isUndefined$2(obj) {
|
|
14730
|
+
return obj === undefined;
|
|
14731
|
+
}
|
|
14732
|
+
|
|
14733
|
+
function isDefined(obj) {
|
|
14734
|
+
return obj !== undefined;
|
|
14735
|
+
}
|
|
14736
|
+
|
|
14737
|
+
function isNil$1(obj) {
|
|
14738
|
+
return obj == null;
|
|
14739
|
+
}
|
|
14740
|
+
|
|
14741
|
+
function isArray$1(obj) {
|
|
14742
|
+
return nativeToString$1.call(obj) === '[object Array]';
|
|
14743
|
+
}
|
|
14744
|
+
|
|
14745
|
+
function isObject(obj) {
|
|
14746
|
+
return nativeToString$1.call(obj) === '[object Object]';
|
|
14747
|
+
}
|
|
14748
|
+
|
|
14749
|
+
function isString$1(obj) {
|
|
14750
|
+
return nativeToString$1.call(obj) === '[object String]';
|
|
14751
|
+
}
|
|
14752
|
+
|
|
14753
|
+
/**
|
|
14754
|
+
* Return true, if target owns a property with the given key.
|
|
14755
|
+
*
|
|
14756
|
+
* @param {Object} target
|
|
14757
|
+
* @param {String} key
|
|
14758
|
+
*
|
|
14759
|
+
* @return {Boolean}
|
|
14760
|
+
*/
|
|
14761
|
+
function has$1(target, key) {
|
|
14762
|
+
return !isNil$1(target) && nativeHasOwnProperty$1.call(target, key);
|
|
14763
|
+
}
|
|
14764
|
+
|
|
14765
|
+
|
|
14766
|
+
/**
|
|
14767
|
+
* Iterate over collection; returning something
|
|
14768
|
+
* (non-undefined) will stop iteration.
|
|
14769
|
+
*
|
|
14770
|
+
* @template T
|
|
14771
|
+
* @param {Collection<T>} collection
|
|
14772
|
+
* @param { ((item: T, idx: number) => (boolean|void)) | ((item: T, key: string) => (boolean|void)) } iterator
|
|
14773
|
+
*
|
|
14774
|
+
* @return {T} return result that stopped the iteration
|
|
14775
|
+
*/
|
|
14776
|
+
function forEach$1(collection, iterator) {
|
|
14777
|
+
|
|
14778
|
+
let val,
|
|
14779
|
+
result;
|
|
14780
|
+
|
|
14781
|
+
if (isUndefined$2(collection)) {
|
|
14782
|
+
return;
|
|
14783
|
+
}
|
|
14784
|
+
|
|
14785
|
+
const convertKey = isArray$1(collection) ? toNum$1 : identity$1;
|
|
14786
|
+
|
|
14787
|
+
for (let key in collection) {
|
|
14788
|
+
|
|
14789
|
+
if (has$1(collection, key)) {
|
|
14790
|
+
val = collection[key];
|
|
14791
|
+
|
|
14792
|
+
result = iterator(val, convertKey(key));
|
|
14793
|
+
|
|
14794
|
+
if (result === false) {
|
|
14795
|
+
return val;
|
|
14796
|
+
}
|
|
14797
|
+
}
|
|
14798
|
+
}
|
|
14799
|
+
}
|
|
14800
|
+
|
|
14801
|
+
|
|
14802
|
+
function identity$1(arg) {
|
|
14803
|
+
return arg;
|
|
14804
|
+
}
|
|
14805
|
+
|
|
14806
|
+
function toNum$1(arg) {
|
|
14807
|
+
return Number(arg);
|
|
14808
|
+
}
|
|
14809
|
+
|
|
14810
|
+
/**
|
|
14811
|
+
* Bind function against target <this>.
|
|
14812
|
+
*
|
|
14813
|
+
* @param {Function} fn
|
|
14814
|
+
* @param {Object} target
|
|
14815
|
+
*
|
|
14816
|
+
* @return {Function} bound function
|
|
14817
|
+
*/
|
|
14818
|
+
function bind(fn, target) {
|
|
14819
|
+
return fn.bind(target);
|
|
14820
|
+
}
|
|
14821
|
+
|
|
14822
|
+
/**
|
|
14823
|
+
* Convenience wrapper for `Object.assign`.
|
|
14824
|
+
*
|
|
14825
|
+
* @param {Object} target
|
|
14826
|
+
* @param {...Object} others
|
|
14827
|
+
*
|
|
14828
|
+
* @return {Object} the target
|
|
14829
|
+
*/
|
|
14830
|
+
function assign$1(target, ...others) {
|
|
14831
|
+
return Object.assign(target, ...others);
|
|
14832
|
+
}
|
|
14833
|
+
|
|
14834
|
+
/**
|
|
14835
|
+
* Sets a nested property of a given object to the specified value.
|
|
14836
|
+
*
|
|
14837
|
+
* This mutates the object and returns it.
|
|
14838
|
+
*
|
|
14839
|
+
* @template T
|
|
14840
|
+
*
|
|
14841
|
+
* @param {T} target The target of the set operation.
|
|
14842
|
+
* @param {(string|number)[]} path The path to the nested value.
|
|
14843
|
+
* @param {any} value The value to set.
|
|
14844
|
+
*
|
|
14845
|
+
* @return {T}
|
|
14846
|
+
*/
|
|
14847
|
+
function set(target, path, value) {
|
|
14848
|
+
|
|
14849
|
+
let currentTarget = target;
|
|
14850
|
+
|
|
14851
|
+
forEach$1(path, function(key, idx) {
|
|
14852
|
+
|
|
14853
|
+
if (typeof key !== 'number' && typeof key !== 'string') {
|
|
14854
|
+
throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
|
|
14855
|
+
}
|
|
14856
|
+
|
|
14857
|
+
if (key === 'constructor') {
|
|
14858
|
+
throw new Error('illegal key: constructor');
|
|
14859
|
+
}
|
|
14860
|
+
|
|
14861
|
+
if (key === '__proto__') {
|
|
14862
|
+
throw new Error('illegal key: __proto__');
|
|
14863
|
+
}
|
|
14864
|
+
|
|
14865
|
+
let nextKey = path[idx + 1];
|
|
14866
|
+
let nextTarget = currentTarget[key];
|
|
14867
|
+
|
|
14868
|
+
if (isDefined(nextKey) && isNil$1(nextTarget)) {
|
|
14869
|
+
nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
|
|
14870
|
+
}
|
|
14871
|
+
|
|
14872
|
+
if (isUndefined$2(nextKey)) {
|
|
14873
|
+
if (isUndefined$2(value)) {
|
|
14874
|
+
delete currentTarget[key];
|
|
14875
|
+
} else {
|
|
14876
|
+
currentTarget[key] = value;
|
|
14877
|
+
}
|
|
14878
|
+
} else {
|
|
14879
|
+
currentTarget = nextTarget;
|
|
14880
|
+
}
|
|
14881
|
+
});
|
|
14882
|
+
|
|
14883
|
+
return target;
|
|
14884
|
+
}
|
|
14885
|
+
|
|
14886
|
+
/**
|
|
14887
|
+
* Pick properties from the given target.
|
|
14532
14888
|
*
|
|
14533
14889
|
* @template T
|
|
14890
|
+
* @template {any[]} V
|
|
14534
14891
|
*
|
|
14535
|
-
* @param {
|
|
14536
|
-
* @param {
|
|
14537
|
-
* @param {LocalsMap} [locals] locals provided
|
|
14892
|
+
* @param {T} target
|
|
14893
|
+
* @param {V} properties
|
|
14538
14894
|
*
|
|
14539
|
-
* @return
|
|
14895
|
+
* @return Pick<T, V>
|
|
14540
14896
|
*/
|
|
14541
|
-
|
|
14542
|
-
return this._injector.invoke(func, context, locals);
|
|
14543
|
-
};
|
|
14897
|
+
function pick(target, properties) {
|
|
14544
14898
|
|
|
14545
|
-
|
|
14546
|
-
* Destroys the diagram
|
|
14547
|
-
*/
|
|
14548
|
-
Diagram.prototype.destroy = function() {
|
|
14549
|
-
this.get('eventBus').fire('diagram.destroy');
|
|
14550
|
-
};
|
|
14899
|
+
let result = {};
|
|
14551
14900
|
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14901
|
+
let obj = Object(target);
|
|
14902
|
+
|
|
14903
|
+
forEach$1(properties, function(prop) {
|
|
14904
|
+
|
|
14905
|
+
if (prop in obj) {
|
|
14906
|
+
result[prop] = target[prop];
|
|
14907
|
+
}
|
|
14908
|
+
});
|
|
14909
|
+
|
|
14910
|
+
return result;
|
|
14911
|
+
}
|
|
14558
14912
|
|
|
14559
14913
|
/**
|
|
14560
14914
|
* Moddle base element.
|
|
@@ -14589,7 +14943,7 @@
|
|
|
14589
14943
|
prototype = Object.create(Base.prototype);
|
|
14590
14944
|
|
|
14591
14945
|
// initialize default values
|
|
14592
|
-
forEach$
|
|
14946
|
+
forEach$1(descriptor.properties, function(p) {
|
|
14593
14947
|
if (!p.isMany && p.default !== undefined) {
|
|
14594
14948
|
prototype[p.name] = p.default;
|
|
14595
14949
|
}
|
|
@@ -14608,7 +14962,7 @@
|
|
|
14608
14962
|
props.define(this, '$attrs', { value: {} });
|
|
14609
14963
|
props.define(this, '$parent', { writable: true });
|
|
14610
14964
|
|
|
14611
|
-
forEach$
|
|
14965
|
+
forEach$1(attrs, bind(function(val, key) {
|
|
14612
14966
|
this.set(key, val);
|
|
14613
14967
|
}, this));
|
|
14614
14968
|
}
|
|
@@ -14915,10 +15269,10 @@
|
|
|
14915
15269
|
return;
|
|
14916
15270
|
}
|
|
14917
15271
|
|
|
14918
|
-
forEach$
|
|
15272
|
+
forEach$1(t.properties, bind(function(p) {
|
|
14919
15273
|
|
|
14920
15274
|
// clone property to allow extensions
|
|
14921
|
-
p = assign$
|
|
15275
|
+
p = assign$1({}, p, {
|
|
14922
15276
|
name: p.ns.localName,
|
|
14923
15277
|
inherited: inherited
|
|
14924
15278
|
});
|
|
@@ -14962,7 +15316,7 @@
|
|
|
14962
15316
|
|
|
14963
15317
|
this.properties = properties;
|
|
14964
15318
|
|
|
14965
|
-
forEach$
|
|
15319
|
+
forEach$1(packages, bind(this.registerPackage, this));
|
|
14966
15320
|
}
|
|
14967
15321
|
|
|
14968
15322
|
|
|
@@ -14978,7 +15332,7 @@
|
|
|
14978
15332
|
Registry.prototype.registerPackage = function(pkg) {
|
|
14979
15333
|
|
|
14980
15334
|
// copy package
|
|
14981
|
-
pkg = assign$
|
|
15335
|
+
pkg = assign$1({}, pkg);
|
|
14982
15336
|
|
|
14983
15337
|
var pkgMap = this.packageMap;
|
|
14984
15338
|
|
|
@@ -14986,7 +15340,7 @@
|
|
|
14986
15340
|
ensureAvailable(pkgMap, pkg, 'uri');
|
|
14987
15341
|
|
|
14988
15342
|
// register types
|
|
14989
|
-
forEach$
|
|
15343
|
+
forEach$1(pkg.types, bind(function(descriptor) {
|
|
14990
15344
|
this.registerType(descriptor, pkg);
|
|
14991
15345
|
}, this));
|
|
14992
15346
|
|
|
@@ -15000,11 +15354,11 @@
|
|
|
15000
15354
|
*/
|
|
15001
15355
|
Registry.prototype.registerType = function(type, pkg) {
|
|
15002
15356
|
|
|
15003
|
-
type = assign$
|
|
15357
|
+
type = assign$1({}, type, {
|
|
15004
15358
|
superClass: (type.superClass || []).slice(),
|
|
15005
15359
|
extends: (type.extends || []).slice(),
|
|
15006
15360
|
properties: (type.properties || []).slice(),
|
|
15007
|
-
meta: assign$
|
|
15361
|
+
meta: assign$1((type.meta || {}))
|
|
15008
15362
|
});
|
|
15009
15363
|
|
|
15010
15364
|
var ns = parseName(type.name, pkg.prefix),
|
|
@@ -15012,7 +15366,7 @@
|
|
|
15012
15366
|
propertiesByName = {};
|
|
15013
15367
|
|
|
15014
15368
|
// parse properties
|
|
15015
|
-
forEach$
|
|
15369
|
+
forEach$1(type.properties, bind(function(p) {
|
|
15016
15370
|
|
|
15017
15371
|
// namespace property names
|
|
15018
15372
|
var propertyNs = parseName(p.name, ns.prefix),
|
|
@@ -15023,7 +15377,7 @@
|
|
|
15023
15377
|
p.type = parseName(p.type, propertyNs.prefix).name;
|
|
15024
15378
|
}
|
|
15025
15379
|
|
|
15026
|
-
assign$
|
|
15380
|
+
assign$1(p, {
|
|
15027
15381
|
ns: propertyNs,
|
|
15028
15382
|
name: propertyName
|
|
15029
15383
|
});
|
|
@@ -15032,13 +15386,13 @@
|
|
|
15032
15386
|
}, this));
|
|
15033
15387
|
|
|
15034
15388
|
// update ns + name
|
|
15035
|
-
assign$
|
|
15389
|
+
assign$1(type, {
|
|
15036
15390
|
ns: ns,
|
|
15037
15391
|
name: name,
|
|
15038
15392
|
propertiesByName: propertiesByName
|
|
15039
15393
|
});
|
|
15040
15394
|
|
|
15041
|
-
forEach$
|
|
15395
|
+
forEach$1(type.extends, bind(function(extendsName) {
|
|
15042
15396
|
var extendsNameNs = parseName(extendsName, ns.prefix);
|
|
15043
15397
|
|
|
15044
15398
|
var extended = this.typeMap[extendsNameNs.name];
|
|
@@ -15047,510 +15401,768 @@
|
|
|
15047
15401
|
extended.traits.push(name);
|
|
15048
15402
|
}, this));
|
|
15049
15403
|
|
|
15050
|
-
// link to package
|
|
15051
|
-
this.definePackage(type, pkg);
|
|
15404
|
+
// link to package
|
|
15405
|
+
this.definePackage(type, pkg);
|
|
15406
|
+
|
|
15407
|
+
// register
|
|
15408
|
+
this.typeMap[name] = type;
|
|
15409
|
+
};
|
|
15410
|
+
|
|
15411
|
+
|
|
15412
|
+
/**
|
|
15413
|
+
* Traverse the type hierarchy from bottom to top,
|
|
15414
|
+
* calling iterator with (type, inherited) for all elements in
|
|
15415
|
+
* the inheritance chain.
|
|
15416
|
+
*
|
|
15417
|
+
* @param {Object} nsName
|
|
15418
|
+
* @param {Function} iterator
|
|
15419
|
+
* @param {Boolean} [trait=false]
|
|
15420
|
+
*/
|
|
15421
|
+
Registry.prototype.mapTypes = function(nsName, iterator, trait) {
|
|
15422
|
+
|
|
15423
|
+
var type = isBuiltIn(nsName.name) ? { name: nsName.name } : this.typeMap[nsName.name];
|
|
15424
|
+
|
|
15425
|
+
var self = this;
|
|
15426
|
+
|
|
15427
|
+
/**
|
|
15428
|
+
* Traverse the selected super type or trait
|
|
15429
|
+
*
|
|
15430
|
+
* @param {String} cls
|
|
15431
|
+
* @param {Boolean} [trait=false]
|
|
15432
|
+
*/
|
|
15433
|
+
function traverse(cls, trait) {
|
|
15434
|
+
var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
|
|
15435
|
+
self.mapTypes(parentNs, iterator, trait);
|
|
15436
|
+
}
|
|
15437
|
+
|
|
15438
|
+
/**
|
|
15439
|
+
* Traverse the selected trait.
|
|
15440
|
+
*
|
|
15441
|
+
* @param {String} cls
|
|
15442
|
+
*/
|
|
15443
|
+
function traverseTrait(cls) {
|
|
15444
|
+
return traverse(cls, true);
|
|
15445
|
+
}
|
|
15446
|
+
|
|
15447
|
+
/**
|
|
15448
|
+
* Traverse the selected super type
|
|
15449
|
+
*
|
|
15450
|
+
* @param {String} cls
|
|
15451
|
+
*/
|
|
15452
|
+
function traverseSuper(cls) {
|
|
15453
|
+
return traverse(cls, false);
|
|
15454
|
+
}
|
|
15455
|
+
|
|
15456
|
+
if (!type) {
|
|
15457
|
+
throw new Error('unknown type <' + nsName.name + '>');
|
|
15458
|
+
}
|
|
15459
|
+
|
|
15460
|
+
forEach$1(type.superClass, trait ? traverseTrait : traverseSuper);
|
|
15461
|
+
|
|
15462
|
+
// call iterator with (type, inherited=!trait)
|
|
15463
|
+
iterator(type, !trait);
|
|
15464
|
+
|
|
15465
|
+
forEach$1(type.traits, traverseTrait);
|
|
15466
|
+
};
|
|
15467
|
+
|
|
15468
|
+
|
|
15469
|
+
/**
|
|
15470
|
+
* Returns the effective descriptor for a type.
|
|
15471
|
+
*
|
|
15472
|
+
* @param {String} type the namespaced name (ns:localName) of the type
|
|
15473
|
+
*
|
|
15474
|
+
* @return {Descriptor} the resulting effective descriptor
|
|
15475
|
+
*/
|
|
15476
|
+
Registry.prototype.getEffectiveDescriptor = function(name) {
|
|
15477
|
+
|
|
15478
|
+
var nsName = parseName(name);
|
|
15479
|
+
|
|
15480
|
+
var builder = new DescriptorBuilder(nsName);
|
|
15481
|
+
|
|
15482
|
+
this.mapTypes(nsName, function(type, inherited) {
|
|
15483
|
+
builder.addTrait(type, inherited);
|
|
15484
|
+
});
|
|
15485
|
+
|
|
15486
|
+
var descriptor = builder.build();
|
|
15487
|
+
|
|
15488
|
+
// define package link
|
|
15489
|
+
this.definePackage(descriptor, descriptor.allTypes[descriptor.allTypes.length - 1].$pkg);
|
|
15490
|
+
|
|
15491
|
+
return descriptor;
|
|
15492
|
+
};
|
|
15493
|
+
|
|
15494
|
+
|
|
15495
|
+
Registry.prototype.definePackage = function(target, pkg) {
|
|
15496
|
+
this.properties.define(target, '$pkg', { value: pkg });
|
|
15497
|
+
};
|
|
15498
|
+
|
|
15499
|
+
|
|
15500
|
+
|
|
15501
|
+
// helpers ////////////////////////////
|
|
15502
|
+
|
|
15503
|
+
function ensureAvailable(packageMap, pkg, identifierKey) {
|
|
15504
|
+
|
|
15505
|
+
var value = pkg[identifierKey];
|
|
15506
|
+
|
|
15507
|
+
if (value in packageMap) {
|
|
15508
|
+
throw new Error('package with ' + identifierKey + ' <' + value + '> already defined');
|
|
15509
|
+
}
|
|
15510
|
+
}
|
|
15511
|
+
|
|
15512
|
+
/**
|
|
15513
|
+
* A utility that gets and sets properties of model elements.
|
|
15514
|
+
*
|
|
15515
|
+
* @param {Model} model
|
|
15516
|
+
*/
|
|
15517
|
+
function Properties(model) {
|
|
15518
|
+
this.model = model;
|
|
15519
|
+
}
|
|
15520
|
+
|
|
15521
|
+
|
|
15522
|
+
/**
|
|
15523
|
+
* Sets a named property on the target element.
|
|
15524
|
+
* If the value is undefined, the property gets deleted.
|
|
15525
|
+
*
|
|
15526
|
+
* @param {Object} target
|
|
15527
|
+
* @param {String} name
|
|
15528
|
+
* @param {Object} value
|
|
15529
|
+
*/
|
|
15530
|
+
Properties.prototype.set = function(target, name, value) {
|
|
15531
|
+
|
|
15532
|
+
if (!isString$1(name) || !name.length) {
|
|
15533
|
+
throw new TypeError('property name must be a non-empty string');
|
|
15534
|
+
}
|
|
15535
|
+
|
|
15536
|
+
var property = this.getProperty(target, name);
|
|
15537
|
+
|
|
15538
|
+
var propertyName = property && property.name;
|
|
15539
|
+
|
|
15540
|
+
if (isUndefined$1(value)) {
|
|
15541
|
+
|
|
15542
|
+
// unset the property, if the specified value is undefined;
|
|
15543
|
+
// delete from $attrs (for extensions) or the target itself
|
|
15544
|
+
if (property) {
|
|
15545
|
+
delete target[propertyName];
|
|
15546
|
+
} else {
|
|
15547
|
+
delete target.$attrs[stripGlobal(name)];
|
|
15548
|
+
}
|
|
15549
|
+
} else {
|
|
15550
|
+
|
|
15551
|
+
// set the property, defining well defined properties on the fly
|
|
15552
|
+
// or simply updating them in target.$attrs (for extensions)
|
|
15553
|
+
if (property) {
|
|
15554
|
+
if (propertyName in target) {
|
|
15555
|
+
target[propertyName] = value;
|
|
15556
|
+
} else {
|
|
15557
|
+
defineProperty(target, property, value);
|
|
15558
|
+
}
|
|
15559
|
+
} else {
|
|
15560
|
+
target.$attrs[stripGlobal(name)] = value;
|
|
15561
|
+
}
|
|
15562
|
+
}
|
|
15563
|
+
};
|
|
15564
|
+
|
|
15565
|
+
/**
|
|
15566
|
+
* Returns the named property of the given element
|
|
15567
|
+
*
|
|
15568
|
+
* @param {Object} target
|
|
15569
|
+
* @param {String} name
|
|
15570
|
+
*
|
|
15571
|
+
* @return {Object}
|
|
15572
|
+
*/
|
|
15573
|
+
Properties.prototype.get = function(target, name) {
|
|
15574
|
+
|
|
15575
|
+
var property = this.getProperty(target, name);
|
|
15576
|
+
|
|
15577
|
+
if (!property) {
|
|
15578
|
+
return target.$attrs[stripGlobal(name)];
|
|
15579
|
+
}
|
|
15580
|
+
|
|
15581
|
+
var propertyName = property.name;
|
|
15582
|
+
|
|
15583
|
+
// check if access to collection property and lazily initialize it
|
|
15584
|
+
if (!target[propertyName] && property.isMany) {
|
|
15585
|
+
defineProperty(target, property, []);
|
|
15586
|
+
}
|
|
15587
|
+
|
|
15588
|
+
return target[propertyName];
|
|
15589
|
+
};
|
|
15590
|
+
|
|
15591
|
+
|
|
15592
|
+
/**
|
|
15593
|
+
* Define a property on the target element
|
|
15594
|
+
*
|
|
15595
|
+
* @param {Object} target
|
|
15596
|
+
* @param {String} name
|
|
15597
|
+
* @param {Object} options
|
|
15598
|
+
*/
|
|
15599
|
+
Properties.prototype.define = function(target, name, options) {
|
|
15600
|
+
|
|
15601
|
+
if (!options.writable) {
|
|
15602
|
+
|
|
15603
|
+
var value = options.value;
|
|
15604
|
+
|
|
15605
|
+
// use getters for read-only variables to support ES6 proxies
|
|
15606
|
+
// cf. https://github.com/bpmn-io/internal-docs/issues/386
|
|
15607
|
+
options = assign$1({}, options, {
|
|
15608
|
+
get: function() { return value; }
|
|
15609
|
+
});
|
|
15610
|
+
|
|
15611
|
+
delete options.value;
|
|
15612
|
+
}
|
|
15613
|
+
|
|
15614
|
+
Object.defineProperty(target, name, options);
|
|
15615
|
+
};
|
|
15052
15616
|
|
|
15053
|
-
|
|
15054
|
-
|
|
15617
|
+
|
|
15618
|
+
/**
|
|
15619
|
+
* Define the descriptor for an element
|
|
15620
|
+
*/
|
|
15621
|
+
Properties.prototype.defineDescriptor = function(target, descriptor) {
|
|
15622
|
+
this.define(target, '$descriptor', { value: descriptor });
|
|
15055
15623
|
};
|
|
15056
15624
|
|
|
15625
|
+
/**
|
|
15626
|
+
* Define the model for an element
|
|
15627
|
+
*/
|
|
15628
|
+
Properties.prototype.defineModel = function(target, model) {
|
|
15629
|
+
this.define(target, '$model', { value: model });
|
|
15630
|
+
};
|
|
15057
15631
|
|
|
15058
15632
|
/**
|
|
15059
|
-
*
|
|
15060
|
-
* calling iterator with (type, inherited) for all elements in
|
|
15061
|
-
* the inheritance chain.
|
|
15633
|
+
* Return property with the given name on the element.
|
|
15062
15634
|
*
|
|
15063
|
-
* @param {
|
|
15064
|
-
* @param {
|
|
15065
|
-
*
|
|
15635
|
+
* @param {any} target
|
|
15636
|
+
* @param {string} name
|
|
15637
|
+
*
|
|
15638
|
+
* @return {object | null} property
|
|
15066
15639
|
*/
|
|
15067
|
-
|
|
15640
|
+
Properties.prototype.getProperty = function(target, name) {
|
|
15068
15641
|
|
|
15069
|
-
var
|
|
15642
|
+
var model = this.model;
|
|
15070
15643
|
|
|
15071
|
-
var
|
|
15644
|
+
var property = model.getPropertyDescriptor(target, name);
|
|
15072
15645
|
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
*
|
|
15076
|
-
* @param {String} cls
|
|
15077
|
-
* @param {Boolean} [trait=false]
|
|
15078
|
-
*/
|
|
15079
|
-
function traverse(cls, trait) {
|
|
15080
|
-
var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
|
|
15081
|
-
self.mapTypes(parentNs, iterator, trait);
|
|
15646
|
+
if (property) {
|
|
15647
|
+
return property;
|
|
15082
15648
|
}
|
|
15083
15649
|
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
*
|
|
15087
|
-
* @param {String} cls
|
|
15088
|
-
*/
|
|
15089
|
-
function traverseTrait(cls) {
|
|
15090
|
-
return traverse(cls, true);
|
|
15650
|
+
if (name.includes(':')) {
|
|
15651
|
+
return null;
|
|
15091
15652
|
}
|
|
15092
15653
|
|
|
15093
|
-
|
|
15094
|
-
* Traverse the selected super type
|
|
15095
|
-
*
|
|
15096
|
-
* @param {String} cls
|
|
15097
|
-
*/
|
|
15098
|
-
function traverseSuper(cls) {
|
|
15099
|
-
return traverse(cls, false);
|
|
15100
|
-
}
|
|
15654
|
+
const strict = model.config.strict;
|
|
15101
15655
|
|
|
15102
|
-
if (
|
|
15103
|
-
|
|
15104
|
-
}
|
|
15656
|
+
if (typeof strict !== 'undefined') {
|
|
15657
|
+
const error = new TypeError(`unknown property <${ name }> on <${ target.$type }>`);
|
|
15105
15658
|
|
|
15106
|
-
|
|
15659
|
+
if (strict) {
|
|
15660
|
+
throw error;
|
|
15661
|
+
} else {
|
|
15107
15662
|
|
|
15108
|
-
|
|
15109
|
-
|
|
15663
|
+
// eslint-disable-next-line no-undef
|
|
15664
|
+
typeof console !== 'undefined' && console.warn(error);
|
|
15665
|
+
}
|
|
15666
|
+
}
|
|
15110
15667
|
|
|
15111
|
-
|
|
15668
|
+
return null;
|
|
15112
15669
|
};
|
|
15113
15670
|
|
|
15671
|
+
function isUndefined$1(val) {
|
|
15672
|
+
return typeof val === 'undefined';
|
|
15673
|
+
}
|
|
15674
|
+
|
|
15675
|
+
function defineProperty(target, property, value) {
|
|
15676
|
+
Object.defineProperty(target, property.name, {
|
|
15677
|
+
enumerable: !property.isReference,
|
|
15678
|
+
writable: true,
|
|
15679
|
+
value: value,
|
|
15680
|
+
configurable: true
|
|
15681
|
+
});
|
|
15682
|
+
}
|
|
15683
|
+
|
|
15684
|
+
function stripGlobal(name) {
|
|
15685
|
+
return name.replace(/^:/, '');
|
|
15686
|
+
}
|
|
15687
|
+
|
|
15688
|
+
// Moddle implementation /////////////////////////////////////////////////
|
|
15114
15689
|
|
|
15115
15690
|
/**
|
|
15116
|
-
*
|
|
15691
|
+
* @class Moddle
|
|
15117
15692
|
*
|
|
15118
|
-
*
|
|
15693
|
+
* A model that can be used to create elements of a specific type.
|
|
15119
15694
|
*
|
|
15120
|
-
* @
|
|
15695
|
+
* @example
|
|
15696
|
+
*
|
|
15697
|
+
* var Moddle = require('moddle');
|
|
15698
|
+
*
|
|
15699
|
+
* var pkg = {
|
|
15700
|
+
* name: 'mypackage',
|
|
15701
|
+
* prefix: 'my',
|
|
15702
|
+
* types: [
|
|
15703
|
+
* { name: 'Root' }
|
|
15704
|
+
* ]
|
|
15705
|
+
* };
|
|
15706
|
+
*
|
|
15707
|
+
* var moddle = new Moddle([pkg]);
|
|
15708
|
+
*
|
|
15709
|
+
* @param {Array<Package>} packages the packages to contain
|
|
15710
|
+
*
|
|
15711
|
+
* @param { { strict?: boolean } } [config] moddle configuration
|
|
15121
15712
|
*/
|
|
15122
|
-
|
|
15713
|
+
function Moddle(packages, config = {}) {
|
|
15123
15714
|
|
|
15124
|
-
|
|
15715
|
+
this.properties = new Properties(this);
|
|
15125
15716
|
|
|
15126
|
-
|
|
15717
|
+
this.factory = new Factory(this, this.properties);
|
|
15718
|
+
this.registry = new Registry(packages, this.properties);
|
|
15127
15719
|
|
|
15128
|
-
this.
|
|
15129
|
-
builder.addTrait(type, inherited);
|
|
15130
|
-
});
|
|
15720
|
+
this.typeCache = {};
|
|
15131
15721
|
|
|
15132
|
-
|
|
15722
|
+
this.config = config;
|
|
15723
|
+
}
|
|
15133
15724
|
|
|
15134
|
-
// define package link
|
|
15135
|
-
this.definePackage(descriptor, descriptor.allTypes[descriptor.allTypes.length - 1].$pkg);
|
|
15136
15725
|
|
|
15137
|
-
|
|
15138
|
-
|
|
15726
|
+
/**
|
|
15727
|
+
* Create an instance of the specified type.
|
|
15728
|
+
*
|
|
15729
|
+
* @method Moddle#create
|
|
15730
|
+
*
|
|
15731
|
+
* @example
|
|
15732
|
+
*
|
|
15733
|
+
* var foo = moddle.create('my:Foo');
|
|
15734
|
+
* var bar = moddle.create('my:Bar', { id: 'BAR_1' });
|
|
15735
|
+
*
|
|
15736
|
+
* @param {String|Object} descriptor the type descriptor or name know to the model
|
|
15737
|
+
* @param {Object} attrs a number of attributes to initialize the model instance with
|
|
15738
|
+
* @return {Object} model instance
|
|
15739
|
+
*/
|
|
15740
|
+
Moddle.prototype.create = function(descriptor, attrs) {
|
|
15741
|
+
var Type = this.getType(descriptor);
|
|
15139
15742
|
|
|
15743
|
+
if (!Type) {
|
|
15744
|
+
throw new Error('unknown type <' + descriptor + '>');
|
|
15745
|
+
}
|
|
15140
15746
|
|
|
15141
|
-
|
|
15142
|
-
this.properties.define(target, '$pkg', { value: pkg });
|
|
15747
|
+
return new Type(attrs);
|
|
15143
15748
|
};
|
|
15144
15749
|
|
|
15145
15750
|
|
|
15751
|
+
/**
|
|
15752
|
+
* Returns the type representing a given descriptor
|
|
15753
|
+
*
|
|
15754
|
+
* @method Moddle#getType
|
|
15755
|
+
*
|
|
15756
|
+
* @example
|
|
15757
|
+
*
|
|
15758
|
+
* var Foo = moddle.getType('my:Foo');
|
|
15759
|
+
* var foo = new Foo({ 'id' : 'FOO_1' });
|
|
15760
|
+
*
|
|
15761
|
+
* @param {String|Object} descriptor the type descriptor or name know to the model
|
|
15762
|
+
* @return {Object} the type representing the descriptor
|
|
15763
|
+
*/
|
|
15764
|
+
Moddle.prototype.getType = function(descriptor) {
|
|
15146
15765
|
|
|
15147
|
-
|
|
15766
|
+
var cache = this.typeCache;
|
|
15148
15767
|
|
|
15149
|
-
|
|
15768
|
+
var name = isString$1(descriptor) ? descriptor : descriptor.ns.name;
|
|
15150
15769
|
|
|
15151
|
-
var
|
|
15770
|
+
var type = cache[name];
|
|
15152
15771
|
|
|
15153
|
-
if (
|
|
15154
|
-
|
|
15772
|
+
if (!type) {
|
|
15773
|
+
descriptor = this.registry.getEffectiveDescriptor(name);
|
|
15774
|
+
type = cache[name] = this.factory.createType(descriptor);
|
|
15155
15775
|
}
|
|
15156
|
-
}
|
|
15157
15776
|
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
*
|
|
15161
|
-
* @param {Model} model
|
|
15162
|
-
*/
|
|
15163
|
-
function Properties(model) {
|
|
15164
|
-
this.model = model;
|
|
15165
|
-
}
|
|
15777
|
+
return type;
|
|
15778
|
+
};
|
|
15166
15779
|
|
|
15167
15780
|
|
|
15168
15781
|
/**
|
|
15169
|
-
*
|
|
15170
|
-
* If the value is undefined, the property gets deleted.
|
|
15782
|
+
* Creates an any-element type to be used within model instances.
|
|
15171
15783
|
*
|
|
15172
|
-
*
|
|
15173
|
-
*
|
|
15174
|
-
*
|
|
15784
|
+
* This can be used to create custom elements that lie outside the meta-model.
|
|
15785
|
+
* The created element contains all the meta-data required to serialize it
|
|
15786
|
+
* as part of meta-model elements.
|
|
15787
|
+
*
|
|
15788
|
+
* @method Moddle#createAny
|
|
15789
|
+
*
|
|
15790
|
+
* @example
|
|
15791
|
+
*
|
|
15792
|
+
* var foo = moddle.createAny('vendor:Foo', 'http://vendor', {
|
|
15793
|
+
* value: 'bar'
|
|
15794
|
+
* });
|
|
15795
|
+
*
|
|
15796
|
+
* var container = moddle.create('my:Container', 'http://my', {
|
|
15797
|
+
* any: [ foo ]
|
|
15798
|
+
* });
|
|
15799
|
+
*
|
|
15800
|
+
* // go ahead and serialize the stuff
|
|
15801
|
+
*
|
|
15802
|
+
*
|
|
15803
|
+
* @param {String} name the name of the element
|
|
15804
|
+
* @param {String} nsUri the namespace uri of the element
|
|
15805
|
+
* @param {Object} [properties] a map of properties to initialize the instance with
|
|
15806
|
+
* @return {Object} the any type instance
|
|
15175
15807
|
*/
|
|
15176
|
-
|
|
15808
|
+
Moddle.prototype.createAny = function(name, nsUri, properties) {
|
|
15177
15809
|
|
|
15178
|
-
|
|
15179
|
-
throw new TypeError('property name must be a non-empty string');
|
|
15180
|
-
}
|
|
15810
|
+
var nameNs = parseName(name);
|
|
15181
15811
|
|
|
15182
|
-
var
|
|
15812
|
+
var element = {
|
|
15813
|
+
$type: name,
|
|
15814
|
+
$instanceOf: function(type) {
|
|
15815
|
+
return type === this.$type;
|
|
15816
|
+
},
|
|
15817
|
+
get: function(key) {
|
|
15818
|
+
return this[key];
|
|
15819
|
+
},
|
|
15820
|
+
set: function(key, value) {
|
|
15821
|
+
set(this, [ key ], value);
|
|
15822
|
+
}
|
|
15823
|
+
};
|
|
15183
15824
|
|
|
15184
|
-
var
|
|
15825
|
+
var descriptor = {
|
|
15826
|
+
name: name,
|
|
15827
|
+
isGeneric: true,
|
|
15828
|
+
ns: {
|
|
15829
|
+
prefix: nameNs.prefix,
|
|
15830
|
+
localName: nameNs.localName,
|
|
15831
|
+
uri: nsUri
|
|
15832
|
+
}
|
|
15833
|
+
};
|
|
15185
15834
|
|
|
15186
|
-
|
|
15835
|
+
this.properties.defineDescriptor(element, descriptor);
|
|
15836
|
+
this.properties.defineModel(element, this);
|
|
15837
|
+
this.properties.define(element, 'get', { enumerable: false, writable: true });
|
|
15838
|
+
this.properties.define(element, 'set', { enumerable: false, writable: true });
|
|
15839
|
+
this.properties.define(element, '$parent', { enumerable: false, writable: true });
|
|
15840
|
+
this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
|
|
15187
15841
|
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
delete target[propertyName];
|
|
15842
|
+
forEach$1(properties, function(a, key) {
|
|
15843
|
+
if (isObject(a) && a.value !== undefined) {
|
|
15844
|
+
element[a.name] = a.value;
|
|
15192
15845
|
} else {
|
|
15193
|
-
|
|
15846
|
+
element[key] = a;
|
|
15194
15847
|
}
|
|
15195
|
-
}
|
|
15848
|
+
});
|
|
15196
15849
|
|
|
15197
|
-
|
|
15198
|
-
// or simply updating them in target.$attrs (for extensions)
|
|
15199
|
-
if (property) {
|
|
15200
|
-
if (propertyName in target) {
|
|
15201
|
-
target[propertyName] = value;
|
|
15202
|
-
} else {
|
|
15203
|
-
defineProperty(target, property, value);
|
|
15204
|
-
}
|
|
15205
|
-
} else {
|
|
15206
|
-
target.$attrs[stripGlobal(name)] = value;
|
|
15207
|
-
}
|
|
15208
|
-
}
|
|
15850
|
+
return element;
|
|
15209
15851
|
};
|
|
15210
15852
|
|
|
15211
15853
|
/**
|
|
15212
|
-
* Returns
|
|
15213
|
-
*
|
|
15214
|
-
* @param {Object} target
|
|
15215
|
-
* @param {String} name
|
|
15854
|
+
* Returns a registered package by uri or prefix
|
|
15216
15855
|
*
|
|
15217
|
-
* @return {Object}
|
|
15856
|
+
* @return {Object} the package
|
|
15218
15857
|
*/
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
var property = this.getProperty(target, name);
|
|
15222
|
-
|
|
15223
|
-
if (!property) {
|
|
15224
|
-
return target.$attrs[stripGlobal(name)];
|
|
15225
|
-
}
|
|
15226
|
-
|
|
15227
|
-
var propertyName = property.name;
|
|
15228
|
-
|
|
15229
|
-
// check if access to collection property and lazily initialize it
|
|
15230
|
-
if (!target[propertyName] && property.isMany) {
|
|
15231
|
-
defineProperty(target, property, []);
|
|
15232
|
-
}
|
|
15233
|
-
|
|
15234
|
-
return target[propertyName];
|
|
15858
|
+
Moddle.prototype.getPackage = function(uriOrPrefix) {
|
|
15859
|
+
return this.registry.getPackage(uriOrPrefix);
|
|
15235
15860
|
};
|
|
15236
15861
|
|
|
15237
|
-
|
|
15238
15862
|
/**
|
|
15239
|
-
*
|
|
15863
|
+
* Returns a snapshot of all known packages
|
|
15240
15864
|
*
|
|
15241
|
-
* @
|
|
15242
|
-
* @param {String} name
|
|
15243
|
-
* @param {Object} options
|
|
15865
|
+
* @return {Object} the package
|
|
15244
15866
|
*/
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
var value = options.value;
|
|
15867
|
+
Moddle.prototype.getPackages = function() {
|
|
15868
|
+
return this.registry.getPackages();
|
|
15869
|
+
};
|
|
15250
15870
|
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15871
|
+
/**
|
|
15872
|
+
* Returns the descriptor for an element
|
|
15873
|
+
*/
|
|
15874
|
+
Moddle.prototype.getElementDescriptor = function(element) {
|
|
15875
|
+
return element.$descriptor;
|
|
15876
|
+
};
|
|
15256
15877
|
|
|
15257
|
-
|
|
15878
|
+
/**
|
|
15879
|
+
* Returns true if the given descriptor or instance
|
|
15880
|
+
* represents the given type.
|
|
15881
|
+
*
|
|
15882
|
+
* May be applied to this, if element is omitted.
|
|
15883
|
+
*/
|
|
15884
|
+
Moddle.prototype.hasType = function(element, type) {
|
|
15885
|
+
if (type === undefined) {
|
|
15886
|
+
type = element;
|
|
15887
|
+
element = this;
|
|
15258
15888
|
}
|
|
15259
15889
|
|
|
15260
|
-
|
|
15261
|
-
};
|
|
15890
|
+
var descriptor = element.$model.getElementDescriptor(element);
|
|
15262
15891
|
|
|
15892
|
+
return (type in descriptor.allTypesByName);
|
|
15893
|
+
};
|
|
15263
15894
|
|
|
15264
15895
|
/**
|
|
15265
|
-
*
|
|
15896
|
+
* Returns the descriptor of an elements named property
|
|
15266
15897
|
*/
|
|
15267
|
-
|
|
15268
|
-
this.
|
|
15898
|
+
Moddle.prototype.getPropertyDescriptor = function(element, property) {
|
|
15899
|
+
return this.getElementDescriptor(element).propertiesByName[property];
|
|
15269
15900
|
};
|
|
15270
15901
|
|
|
15271
15902
|
/**
|
|
15272
|
-
*
|
|
15903
|
+
* Returns a mapped type's descriptor
|
|
15273
15904
|
*/
|
|
15274
|
-
|
|
15275
|
-
this.
|
|
15905
|
+
Moddle.prototype.getTypeDescriptor = function(type) {
|
|
15906
|
+
return this.registry.typeMap[type];
|
|
15276
15907
|
};
|
|
15277
15908
|
|
|
15278
15909
|
/**
|
|
15279
|
-
*
|
|
15910
|
+
* Flatten array, one level deep.
|
|
15280
15911
|
*
|
|
15281
|
-
* @
|
|
15282
|
-
* @param {string} name
|
|
15912
|
+
* @template T
|
|
15283
15913
|
*
|
|
15284
|
-
* @
|
|
15914
|
+
* @param {T[][] | T[] | null} [arr]
|
|
15915
|
+
*
|
|
15916
|
+
* @return {T[]}
|
|
15285
15917
|
*/
|
|
15286
|
-
Properties.prototype.getProperty = function(target, name) {
|
|
15287
15918
|
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
var property = model.getPropertyDescriptor(target, name);
|
|
15291
|
-
|
|
15292
|
-
if (property) {
|
|
15293
|
-
return property;
|
|
15294
|
-
}
|
|
15295
|
-
|
|
15296
|
-
if (name.includes(':')) {
|
|
15297
|
-
return null;
|
|
15298
|
-
}
|
|
15299
|
-
|
|
15300
|
-
const strict = model.config.strict;
|
|
15919
|
+
const nativeToString = Object.prototype.toString;
|
|
15920
|
+
const nativeHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
15301
15921
|
|
|
15302
|
-
|
|
15303
|
-
|
|
15922
|
+
function isUndefined(obj) {
|
|
15923
|
+
return obj === undefined;
|
|
15924
|
+
}
|
|
15304
15925
|
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15926
|
+
function isNil(obj) {
|
|
15927
|
+
return obj == null;
|
|
15928
|
+
}
|
|
15308
15929
|
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
}
|
|
15930
|
+
function isArray(obj) {
|
|
15931
|
+
return nativeToString.call(obj) === '[object Array]';
|
|
15932
|
+
}
|
|
15313
15933
|
|
|
15314
|
-
|
|
15315
|
-
|
|
15934
|
+
/**
|
|
15935
|
+
* @param {any} obj
|
|
15936
|
+
*
|
|
15937
|
+
* @return {boolean}
|
|
15938
|
+
*/
|
|
15939
|
+
function isFunction(obj) {
|
|
15940
|
+
const tag = nativeToString.call(obj);
|
|
15316
15941
|
|
|
15317
|
-
|
|
15318
|
-
|
|
15942
|
+
return (
|
|
15943
|
+
tag === '[object Function]' ||
|
|
15944
|
+
tag === '[object AsyncFunction]' ||
|
|
15945
|
+
tag === '[object GeneratorFunction]' ||
|
|
15946
|
+
tag === '[object AsyncGeneratorFunction]' ||
|
|
15947
|
+
tag === '[object Proxy]'
|
|
15948
|
+
);
|
|
15319
15949
|
}
|
|
15320
15950
|
|
|
15321
|
-
function
|
|
15322
|
-
|
|
15323
|
-
enumerable: !property.isReference,
|
|
15324
|
-
writable: true,
|
|
15325
|
-
value: value,
|
|
15326
|
-
configurable: true
|
|
15327
|
-
});
|
|
15951
|
+
function isString(obj) {
|
|
15952
|
+
return nativeToString.call(obj) === '[object String]';
|
|
15328
15953
|
}
|
|
15329
15954
|
|
|
15330
|
-
|
|
15331
|
-
|
|
15955
|
+
/**
|
|
15956
|
+
* Return true, if target owns a property with the given key.
|
|
15957
|
+
*
|
|
15958
|
+
* @param {Object} target
|
|
15959
|
+
* @param {String} key
|
|
15960
|
+
*
|
|
15961
|
+
* @return {Boolean}
|
|
15962
|
+
*/
|
|
15963
|
+
function has(target, key) {
|
|
15964
|
+
return !isNil(target) && nativeHasOwnProperty.call(target, key);
|
|
15332
15965
|
}
|
|
15333
15966
|
|
|
15334
|
-
|
|
15967
|
+
/**
|
|
15968
|
+
* @template T
|
|
15969
|
+
* @typedef { (
|
|
15970
|
+
* ((e: T) => boolean) |
|
|
15971
|
+
* ((e: T, idx: number) => boolean) |
|
|
15972
|
+
* ((e: T, key: string) => boolean) |
|
|
15973
|
+
* string |
|
|
15974
|
+
* number
|
|
15975
|
+
* ) } Matcher
|
|
15976
|
+
*/
|
|
15335
15977
|
|
|
15336
15978
|
/**
|
|
15337
|
-
* @
|
|
15338
|
-
*
|
|
15339
|
-
* A model that can be used to create elements of a specific type.
|
|
15340
|
-
*
|
|
15341
|
-
* @example
|
|
15342
|
-
*
|
|
15343
|
-
* var Moddle = require('moddle');
|
|
15344
|
-
*
|
|
15345
|
-
* var pkg = {
|
|
15346
|
-
* name: 'mypackage',
|
|
15347
|
-
* prefix: 'my',
|
|
15348
|
-
* types: [
|
|
15349
|
-
* { name: 'Root' }
|
|
15350
|
-
* ]
|
|
15351
|
-
* };
|
|
15979
|
+
* @template T
|
|
15980
|
+
* @template U
|
|
15352
15981
|
*
|
|
15353
|
-
*
|
|
15982
|
+
* @typedef { (
|
|
15983
|
+
* ((e: T) => U) | string | number
|
|
15984
|
+
* ) } Extractor
|
|
15985
|
+
*/
|
|
15986
|
+
|
|
15987
|
+
|
|
15988
|
+
/**
|
|
15989
|
+
* @template T
|
|
15990
|
+
* @typedef { (val: T, key: any) => boolean } MatchFn
|
|
15991
|
+
*/
|
|
15992
|
+
|
|
15993
|
+
/**
|
|
15994
|
+
* @template T
|
|
15995
|
+
* @typedef { T[] } ArrayCollection
|
|
15996
|
+
*/
|
|
15997
|
+
|
|
15998
|
+
/**
|
|
15999
|
+
* @template T
|
|
16000
|
+
* @typedef { { [key: string]: T } } StringKeyValueCollection
|
|
16001
|
+
*/
|
|
16002
|
+
|
|
16003
|
+
/**
|
|
16004
|
+
* @template T
|
|
16005
|
+
* @typedef { { [key: number]: T } } NumberKeyValueCollection
|
|
16006
|
+
*/
|
|
16007
|
+
|
|
16008
|
+
/**
|
|
16009
|
+
* @template T
|
|
16010
|
+
* @typedef { StringKeyValueCollection<T> | NumberKeyValueCollection<T> } KeyValueCollection
|
|
16011
|
+
*/
|
|
16012
|
+
|
|
16013
|
+
/**
|
|
16014
|
+
* @template T
|
|
16015
|
+
* @typedef { KeyValueCollection<T> | ArrayCollection<T> } Collection
|
|
16016
|
+
*/
|
|
16017
|
+
|
|
16018
|
+
/**
|
|
16019
|
+
* Find element in collection.
|
|
15354
16020
|
*
|
|
15355
|
-
* @
|
|
16021
|
+
* @template T
|
|
16022
|
+
* @param {Collection<T>} collection
|
|
16023
|
+
* @param {Matcher<T>} matcher
|
|
15356
16024
|
*
|
|
15357
|
-
* @
|
|
16025
|
+
* @return {Object}
|
|
15358
16026
|
*/
|
|
15359
|
-
function
|
|
16027
|
+
function find(collection, matcher) {
|
|
16028
|
+
|
|
16029
|
+
const matchFn = toMatcher(matcher);
|
|
15360
16030
|
|
|
15361
|
-
|
|
16031
|
+
let match;
|
|
15362
16032
|
|
|
15363
|
-
|
|
15364
|
-
|
|
16033
|
+
forEach(collection, function(val, key) {
|
|
16034
|
+
if (matchFn(val, key)) {
|
|
16035
|
+
match = val;
|
|
15365
16036
|
|
|
15366
|
-
|
|
16037
|
+
return false;
|
|
16038
|
+
}
|
|
16039
|
+
});
|
|
16040
|
+
|
|
16041
|
+
return match;
|
|
15367
16042
|
|
|
15368
|
-
this.config = config;
|
|
15369
16043
|
}
|
|
15370
16044
|
|
|
15371
16045
|
|
|
15372
16046
|
/**
|
|
15373
|
-
*
|
|
15374
|
-
*
|
|
15375
|
-
* @method Moddle#create
|
|
15376
|
-
*
|
|
15377
|
-
* @example
|
|
16047
|
+
* Find element index in collection.
|
|
15378
16048
|
*
|
|
15379
|
-
*
|
|
15380
|
-
*
|
|
16049
|
+
* @template T
|
|
16050
|
+
* @param {Collection<T>} collection
|
|
16051
|
+
* @param {Matcher<T>} matcher
|
|
15381
16052
|
*
|
|
15382
|
-
* @
|
|
15383
|
-
* @param {Object} attrs a number of attributes to initialize the model instance with
|
|
15384
|
-
* @return {Object} model instance
|
|
16053
|
+
* @return {number | string | undefined}
|
|
15385
16054
|
*/
|
|
15386
|
-
|
|
15387
|
-
var Type = this.getType(descriptor);
|
|
16055
|
+
function findIndex(collection, matcher) {
|
|
15388
16056
|
|
|
15389
|
-
|
|
15390
|
-
throw new Error('unknown type <' + descriptor + '>');
|
|
15391
|
-
}
|
|
16057
|
+
const matchFn = toMatcher(matcher);
|
|
15392
16058
|
|
|
15393
|
-
|
|
15394
|
-
|
|
16059
|
+
let idx = isArray(collection) ? -1 : undefined;
|
|
16060
|
+
|
|
16061
|
+
forEach(collection, function(val, key) {
|
|
16062
|
+
if (matchFn(val, key)) {
|
|
16063
|
+
idx = key;
|
|
16064
|
+
|
|
16065
|
+
return false;
|
|
16066
|
+
}
|
|
16067
|
+
});
|
|
16068
|
+
|
|
16069
|
+
return idx;
|
|
16070
|
+
}
|
|
15395
16071
|
|
|
15396
16072
|
|
|
15397
16073
|
/**
|
|
15398
|
-
*
|
|
15399
|
-
*
|
|
15400
|
-
* @method Moddle#getType
|
|
15401
|
-
*
|
|
15402
|
-
* @example
|
|
16074
|
+
* Filter elements in collection.
|
|
15403
16075
|
*
|
|
15404
|
-
*
|
|
15405
|
-
*
|
|
16076
|
+
* @template T
|
|
16077
|
+
* @param {Collection<T>} collection
|
|
16078
|
+
* @param {Matcher<T>} matcher
|
|
15406
16079
|
*
|
|
15407
|
-
* @
|
|
15408
|
-
* @return {Object} the type representing the descriptor
|
|
16080
|
+
* @return {T[]} result
|
|
15409
16081
|
*/
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
var cache = this.typeCache;
|
|
16082
|
+
function filter(collection, matcher) {
|
|
15413
16083
|
|
|
15414
|
-
|
|
16084
|
+
const matchFn = toMatcher(matcher);
|
|
15415
16085
|
|
|
15416
|
-
|
|
16086
|
+
let result = [];
|
|
15417
16087
|
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
16088
|
+
forEach(collection, function(val, key) {
|
|
16089
|
+
if (matchFn(val, key)) {
|
|
16090
|
+
result.push(val);
|
|
16091
|
+
}
|
|
16092
|
+
});
|
|
15422
16093
|
|
|
15423
|
-
return
|
|
15424
|
-
}
|
|
16094
|
+
return result;
|
|
16095
|
+
}
|
|
15425
16096
|
|
|
15426
16097
|
|
|
15427
16098
|
/**
|
|
15428
|
-
*
|
|
15429
|
-
*
|
|
15430
|
-
* This can be used to create custom elements that lie outside the meta-model.
|
|
15431
|
-
* The created element contains all the meta-data required to serialize it
|
|
15432
|
-
* as part of meta-model elements.
|
|
15433
|
-
*
|
|
15434
|
-
* @method Moddle#createAny
|
|
15435
|
-
*
|
|
15436
|
-
* @example
|
|
15437
|
-
*
|
|
15438
|
-
* var foo = moddle.createAny('vendor:Foo', 'http://vendor', {
|
|
15439
|
-
* value: 'bar'
|
|
15440
|
-
* });
|
|
15441
|
-
*
|
|
15442
|
-
* var container = moddle.create('my:Container', 'http://my', {
|
|
15443
|
-
* any: [ foo ]
|
|
15444
|
-
* });
|
|
15445
|
-
*
|
|
15446
|
-
* // go ahead and serialize the stuff
|
|
16099
|
+
* Iterate over collection; returning something
|
|
16100
|
+
* (non-undefined) will stop iteration.
|
|
15447
16101
|
*
|
|
16102
|
+
* @template T
|
|
16103
|
+
* @param {Collection<T>} collection
|
|
16104
|
+
* @param { ((item: T, idx: number) => (boolean|void)) | ((item: T, key: string) => (boolean|void)) } iterator
|
|
15448
16105
|
*
|
|
15449
|
-
* @
|
|
15450
|
-
* @param {String} nsUri the namespace uri of the element
|
|
15451
|
-
* @param {Object} [properties] a map of properties to initialize the instance with
|
|
15452
|
-
* @return {Object} the any type instance
|
|
16106
|
+
* @return {T} return result that stopped the iteration
|
|
15453
16107
|
*/
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
var nameNs = parseName(name);
|
|
16108
|
+
function forEach(collection, iterator) {
|
|
15457
16109
|
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
$instanceOf: function(type) {
|
|
15461
|
-
return type === this.$type;
|
|
15462
|
-
},
|
|
15463
|
-
get: function(key) {
|
|
15464
|
-
return this[key];
|
|
15465
|
-
},
|
|
15466
|
-
set: function(key, value) {
|
|
15467
|
-
set(this, [ key ], value);
|
|
15468
|
-
}
|
|
15469
|
-
};
|
|
16110
|
+
let val,
|
|
16111
|
+
result;
|
|
15470
16112
|
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
ns: {
|
|
15475
|
-
prefix: nameNs.prefix,
|
|
15476
|
-
localName: nameNs.localName,
|
|
15477
|
-
uri: nsUri
|
|
15478
|
-
}
|
|
15479
|
-
};
|
|
16113
|
+
if (isUndefined(collection)) {
|
|
16114
|
+
return;
|
|
16115
|
+
}
|
|
15480
16116
|
|
|
15481
|
-
|
|
15482
|
-
this.properties.defineModel(element, this);
|
|
15483
|
-
this.properties.define(element, 'get', { enumerable: false, writable: true });
|
|
15484
|
-
this.properties.define(element, 'set', { enumerable: false, writable: true });
|
|
15485
|
-
this.properties.define(element, '$parent', { enumerable: false, writable: true });
|
|
15486
|
-
this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
|
|
16117
|
+
const convertKey = isArray(collection) ? toNum : identity;
|
|
15487
16118
|
|
|
15488
|
-
|
|
15489
|
-
if (isObject(a) && a.value !== undefined) {
|
|
15490
|
-
element[a.name] = a.value;
|
|
15491
|
-
} else {
|
|
15492
|
-
element[key] = a;
|
|
15493
|
-
}
|
|
15494
|
-
});
|
|
16119
|
+
for (let key in collection) {
|
|
15495
16120
|
|
|
15496
|
-
|
|
15497
|
-
|
|
16121
|
+
if (has(collection, key)) {
|
|
16122
|
+
val = collection[key];
|
|
15498
16123
|
|
|
15499
|
-
|
|
15500
|
-
* Returns a registered package by uri or prefix
|
|
15501
|
-
*
|
|
15502
|
-
* @return {Object} the package
|
|
15503
|
-
*/
|
|
15504
|
-
Moddle.prototype.getPackage = function(uriOrPrefix) {
|
|
15505
|
-
return this.registry.getPackage(uriOrPrefix);
|
|
15506
|
-
};
|
|
16124
|
+
result = iterator(val, convertKey(key));
|
|
15507
16125
|
|
|
15508
|
-
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
return this.registry.getPackages();
|
|
15515
|
-
};
|
|
16126
|
+
if (result === false) {
|
|
16127
|
+
return val;
|
|
16128
|
+
}
|
|
16129
|
+
}
|
|
16130
|
+
}
|
|
16131
|
+
}
|
|
15516
16132
|
|
|
15517
|
-
/**
|
|
15518
|
-
* Returns the descriptor for an element
|
|
15519
|
-
*/
|
|
15520
|
-
Moddle.prototype.getElementDescriptor = function(element) {
|
|
15521
|
-
return element.$descriptor;
|
|
15522
|
-
};
|
|
15523
16133
|
|
|
15524
16134
|
/**
|
|
15525
|
-
*
|
|
15526
|
-
*
|
|
16135
|
+
* @template T
|
|
16136
|
+
* @param {Matcher<T>} matcher
|
|
15527
16137
|
*
|
|
15528
|
-
*
|
|
16138
|
+
* @return {MatchFn<T>}
|
|
15529
16139
|
*/
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
16140
|
+
function toMatcher(matcher) {
|
|
16141
|
+
return isFunction(matcher) ? matcher : (e) => {
|
|
16142
|
+
return e === matcher;
|
|
16143
|
+
};
|
|
16144
|
+
}
|
|
15535
16145
|
|
|
15536
|
-
var descriptor = element.$model.getElementDescriptor(element);
|
|
15537
16146
|
|
|
15538
|
-
|
|
15539
|
-
|
|
16147
|
+
function identity(arg) {
|
|
16148
|
+
return arg;
|
|
16149
|
+
}
|
|
15540
16150
|
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
Moddle.prototype.getPropertyDescriptor = function(element, property) {
|
|
15545
|
-
return this.getElementDescriptor(element).propertiesByName[property];
|
|
15546
|
-
};
|
|
16151
|
+
function toNum(arg) {
|
|
16152
|
+
return Number(arg);
|
|
16153
|
+
}
|
|
15547
16154
|
|
|
15548
16155
|
/**
|
|
15549
|
-
*
|
|
16156
|
+
* Convenience wrapper for `Object.assign`.
|
|
16157
|
+
*
|
|
16158
|
+
* @param {Object} target
|
|
16159
|
+
* @param {...Object} others
|
|
16160
|
+
*
|
|
16161
|
+
* @return {Object} the target
|
|
15550
16162
|
*/
|
|
15551
|
-
|
|
15552
|
-
return
|
|
15553
|
-
}
|
|
16163
|
+
function assign(target, ...others) {
|
|
16164
|
+
return Object.assign(target, ...others);
|
|
16165
|
+
}
|
|
15554
16166
|
|
|
15555
16167
|
var fromCharCode = String.fromCharCode;
|
|
15556
16168
|
|
|
@@ -16698,7 +17310,7 @@
|
|
|
16698
17310
|
* @property {Boolean} lax
|
|
16699
17311
|
*/
|
|
16700
17312
|
|
|
16701
|
-
assign
|
|
17313
|
+
assign(this, options);
|
|
16702
17314
|
|
|
16703
17315
|
this.elementsById = {};
|
|
16704
17316
|
this.references = [];
|
|
@@ -16919,7 +17531,7 @@
|
|
|
16919
17531
|
model = this.model,
|
|
16920
17532
|
propNameNs;
|
|
16921
17533
|
|
|
16922
|
-
forEach
|
|
17534
|
+
forEach(attributes, function(value, name) {
|
|
16923
17535
|
|
|
16924
17536
|
var prop = descriptor.propertiesByName[name],
|
|
16925
17537
|
values;
|
|
@@ -16937,7 +17549,7 @@
|
|
|
16937
17549
|
// IDREFS: parse references as whitespace-separated list
|
|
16938
17550
|
values = value.split(' ');
|
|
16939
17551
|
|
|
16940
|
-
forEach
|
|
17552
|
+
forEach(values, function(v) {
|
|
16941
17553
|
context.addReference({
|
|
16942
17554
|
element: instance,
|
|
16943
17555
|
property: prop.ns.name,
|
|
@@ -17006,7 +17618,7 @@
|
|
|
17006
17618
|
|
|
17007
17619
|
const elementType = model.getType(normalizedTypeName);
|
|
17008
17620
|
|
|
17009
|
-
return assign
|
|
17621
|
+
return assign({}, property, {
|
|
17010
17622
|
effectiveType: getModdleDescriptor(elementType).name
|
|
17011
17623
|
});
|
|
17012
17624
|
}
|
|
@@ -17028,7 +17640,7 @@
|
|
|
17028
17640
|
});
|
|
17029
17641
|
|
|
17030
17642
|
if (property) {
|
|
17031
|
-
return assign
|
|
17643
|
+
return assign({}, property, {
|
|
17032
17644
|
effectiveType: getModdleDescriptor(elementType).name
|
|
17033
17645
|
});
|
|
17034
17646
|
}
|
|
@@ -17103,7 +17715,7 @@
|
|
|
17103
17715
|
}
|
|
17104
17716
|
|
|
17105
17717
|
if (propertyDesc.isReference) {
|
|
17106
|
-
assign
|
|
17718
|
+
assign(newElement, {
|
|
17107
17719
|
element: element
|
|
17108
17720
|
});
|
|
17109
17721
|
|
|
@@ -17212,7 +17824,7 @@
|
|
|
17212
17824
|
};
|
|
17213
17825
|
}
|
|
17214
17826
|
|
|
17215
|
-
assign
|
|
17827
|
+
assign(this, { lax: false }, options);
|
|
17216
17828
|
}
|
|
17217
17829
|
|
|
17218
17830
|
/**
|
|
@@ -17267,7 +17879,7 @@
|
|
|
17267
17879
|
var model = this.model,
|
|
17268
17880
|
lax = this.lax;
|
|
17269
17881
|
|
|
17270
|
-
var context = new Context(assign
|
|
17882
|
+
var context = new Context(assign({}, options, { rootHandler: rootHandler })),
|
|
17271
17883
|
parser = new Parser({ proxy: true }),
|
|
17272
17884
|
stack = createStack();
|
|
17273
17885
|
|
|
@@ -17672,14 +18284,14 @@
|
|
|
17672
18284
|
|
|
17673
18285
|
function getElementNs(ns, descriptor) {
|
|
17674
18286
|
if (descriptor.isGeneric) {
|
|
17675
|
-
return assign
|
|
18287
|
+
return assign({ localName: descriptor.ns.localName }, ns);
|
|
17676
18288
|
} else {
|
|
17677
|
-
return assign
|
|
18289
|
+
return assign({ localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg) }, ns);
|
|
17678
18290
|
}
|
|
17679
18291
|
}
|
|
17680
18292
|
|
|
17681
18293
|
function getPropertyNs(ns, descriptor) {
|
|
17682
|
-
return assign
|
|
18294
|
+
return assign({ localName: descriptor.ns.localName }, ns);
|
|
17683
18295
|
}
|
|
17684
18296
|
|
|
17685
18297
|
function getSerializableProperties(element) {
|
|
@@ -17693,7 +18305,7 @@
|
|
|
17693
18305
|
}
|
|
17694
18306
|
|
|
17695
18307
|
// do not serialize defaults
|
|
17696
|
-
if (!has
|
|
18308
|
+
if (!has(element, name)) {
|
|
17697
18309
|
return false;
|
|
17698
18310
|
}
|
|
17699
18311
|
|
|
@@ -17913,7 +18525,7 @@
|
|
|
17913
18525
|
if (this.isLocalNs(effectiveNs)) {
|
|
17914
18526
|
return { localName: ns.localName };
|
|
17915
18527
|
} else {
|
|
17916
|
-
return assign
|
|
18528
|
+
return assign({ localName: ns.localName }, effectiveNs);
|
|
17917
18529
|
}
|
|
17918
18530
|
};
|
|
17919
18531
|
|
|
@@ -17936,7 +18548,7 @@
|
|
|
17936
18548
|
var children = element.$children;
|
|
17937
18549
|
|
|
17938
18550
|
if (children) {
|
|
17939
|
-
forEach
|
|
18551
|
+
forEach(children, child => {
|
|
17940
18552
|
this.body.push(new ElementSerializer(this).build(child));
|
|
17941
18553
|
});
|
|
17942
18554
|
}
|
|
@@ -17996,7 +18608,7 @@
|
|
|
17996
18608
|
// parse namespace attributes first
|
|
17997
18609
|
// and log them. push non namespace attributes to a list
|
|
17998
18610
|
// and process them later
|
|
17999
|
-
forEach
|
|
18611
|
+
forEach(genericAttrs, function(value, name) {
|
|
18000
18612
|
|
|
18001
18613
|
var nonNsAttr = self.parseNsAttribute(element, name, value);
|
|
18002
18614
|
|
|
@@ -18012,7 +18624,7 @@
|
|
|
18012
18624
|
|
|
18013
18625
|
var self = this;
|
|
18014
18626
|
|
|
18015
|
-
forEach
|
|
18627
|
+
forEach(attributes, function(attr) {
|
|
18016
18628
|
|
|
18017
18629
|
try {
|
|
18018
18630
|
self.addAttribute(self.nsAttributeName(attr.name), attr.value);
|
|
@@ -18034,7 +18646,7 @@
|
|
|
18034
18646
|
body = this.body,
|
|
18035
18647
|
element = this.element;
|
|
18036
18648
|
|
|
18037
|
-
forEach
|
|
18649
|
+
forEach(properties, function(p) {
|
|
18038
18650
|
var value = element.get(p.name),
|
|
18039
18651
|
isReference = p.isReference,
|
|
18040
18652
|
isMany = p.isMany;
|
|
@@ -18046,11 +18658,11 @@
|
|
|
18046
18658
|
if (p.isBody) {
|
|
18047
18659
|
body.push(new BodySerializer().build(p, value[0]));
|
|
18048
18660
|
} else if (isSimple(p.type)) {
|
|
18049
|
-
forEach
|
|
18661
|
+
forEach(value, function(v) {
|
|
18050
18662
|
body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
|
|
18051
18663
|
});
|
|
18052
18664
|
} else if (isReference) {
|
|
18053
|
-
forEach
|
|
18665
|
+
forEach(value, function(v) {
|
|
18054
18666
|
body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
|
|
18055
18667
|
});
|
|
18056
18668
|
} else {
|
|
@@ -18059,7 +18671,7 @@
|
|
|
18059
18671
|
// rather than element name
|
|
18060
18672
|
var serialization = getSerialization(p);
|
|
18061
18673
|
|
|
18062
|
-
forEach
|
|
18674
|
+
forEach(value, function(v) {
|
|
18063
18675
|
var serializer;
|
|
18064
18676
|
|
|
18065
18677
|
if (serialization) {
|
|
@@ -18171,7 +18783,7 @@
|
|
|
18171
18783
|
var self = this,
|
|
18172
18784
|
element = this.element;
|
|
18173
18785
|
|
|
18174
|
-
forEach
|
|
18786
|
+
forEach(properties, function(p) {
|
|
18175
18787
|
|
|
18176
18788
|
var value = element.get(p.name);
|
|
18177
18789
|
|
|
@@ -18181,7 +18793,7 @@
|
|
|
18181
18793
|
value = value.id;
|
|
18182
18794
|
} else {
|
|
18183
18795
|
var values = [];
|
|
18184
|
-
forEach
|
|
18796
|
+
forEach(value, function(v) {
|
|
18185
18797
|
values.push(v.id);
|
|
18186
18798
|
});
|
|
18187
18799
|
|
|
@@ -18237,7 +18849,7 @@
|
|
|
18237
18849
|
attrs = getNsAttrs(namespaces).concat(attrs);
|
|
18238
18850
|
}
|
|
18239
18851
|
|
|
18240
|
-
forEach
|
|
18852
|
+
forEach(attrs, function(a) {
|
|
18241
18853
|
writer
|
|
18242
18854
|
.append(' ')
|
|
18243
18855
|
.append(nsName(a.name)).append('="').append(a.value).append('"');
|
|
@@ -18264,7 +18876,7 @@
|
|
|
18264
18876
|
.indent();
|
|
18265
18877
|
}
|
|
18266
18878
|
|
|
18267
|
-
forEach
|
|
18879
|
+
forEach(this.body, function(b) {
|
|
18268
18880
|
b.serializeTo(writer);
|
|
18269
18881
|
});
|
|
18270
18882
|
|
|
@@ -18379,7 +18991,7 @@
|
|
|
18379
18991
|
*/
|
|
18380
18992
|
function Writer(options) {
|
|
18381
18993
|
|
|
18382
|
-
options = assign
|
|
18994
|
+
options = assign({ format: false, preamble: true }, options || {});
|
|
18383
18995
|
|
|
18384
18996
|
function toXML(tree, writer) {
|
|
18385
18997
|
var internalWriter = writer || new SavingWriter();
|
|
@@ -18485,7 +19097,7 @@
|
|
|
18485
19097
|
*/
|
|
18486
19098
|
BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
|
|
18487
19099
|
|
|
18488
|
-
if (!isString(typeName)) {
|
|
19100
|
+
if (!isString$2(typeName)) {
|
|
18489
19101
|
options = typeName;
|
|
18490
19102
|
typeName = 'bpmn:Definitions';
|
|
18491
19103
|
}
|
|
@@ -22197,7 +22809,7 @@
|
|
|
22197
22809
|
function ensureCompatDiRef(businessObject) {
|
|
22198
22810
|
|
|
22199
22811
|
// bpmnElement can have multiple independent DIs
|
|
22200
|
-
if (!has$
|
|
22812
|
+
if (!has$5(businessObject, 'di')) {
|
|
22201
22813
|
Object.defineProperty(businessObject, 'di', {
|
|
22202
22814
|
enumerable: false,
|
|
22203
22815
|
get: function() {
|
|
@@ -22233,7 +22845,7 @@
|
|
|
22233
22845
|
* @return {ModdleElement}
|
|
22234
22846
|
*/
|
|
22235
22847
|
function findDisplayCandidate(definitions) {
|
|
22236
|
-
return find(definitions.rootElements, function(e) {
|
|
22848
|
+
return find$2(definitions.rootElements, function(e) {
|
|
22237
22849
|
return is(e, 'bpmn:Process') || is(e, 'bpmn:Collaboration');
|
|
22238
22850
|
});
|
|
22239
22851
|
}
|
|
@@ -22337,7 +22949,7 @@
|
|
|
22337
22949
|
function handlePlane(plane) {
|
|
22338
22950
|
registerDi(plane);
|
|
22339
22951
|
|
|
22340
|
-
forEach$
|
|
22952
|
+
forEach$5(plane.planeElement, handlePlaneElement);
|
|
22341
22953
|
}
|
|
22342
22954
|
|
|
22343
22955
|
function handlePlaneElement(planeElement) {
|
|
@@ -22455,7 +23067,7 @@
|
|
|
22455
23067
|
// walk through all processes that have not yet been drawn and draw them
|
|
22456
23068
|
// if they contain lanes with DI information.
|
|
22457
23069
|
// we do this to pass the free-floating lane test cases in the MIWG test suite
|
|
22458
|
-
var processes = filter(rootElements, function(e) {
|
|
23070
|
+
var processes = filter$2(rootElements, function(e) {
|
|
22459
23071
|
return !isHandled(e) && is(e, 'bpmn:Process') && e.laneSets;
|
|
22460
23072
|
});
|
|
22461
23073
|
|
|
@@ -22467,7 +23079,7 @@
|
|
|
22467
23079
|
}
|
|
22468
23080
|
|
|
22469
23081
|
function handleMessageFlows(messageFlows, context) {
|
|
22470
|
-
forEach$
|
|
23082
|
+
forEach$5(messageFlows, contextual(handleMessageFlow, context));
|
|
22471
23083
|
}
|
|
22472
23084
|
|
|
22473
23085
|
function handleDataAssociation(association, context) {
|
|
@@ -22493,7 +23105,7 @@
|
|
|
22493
23105
|
|
|
22494
23106
|
function handleArtifacts(artifacts, context) {
|
|
22495
23107
|
|
|
22496
|
-
forEach$
|
|
23108
|
+
forEach$5(artifacts, function(e) {
|
|
22497
23109
|
if (is(e, 'bpmn:Association')) {
|
|
22498
23110
|
deferred.push(function() {
|
|
22499
23111
|
handleArtifact(e, context);
|
|
@@ -22510,8 +23122,8 @@
|
|
|
22510
23122
|
return;
|
|
22511
23123
|
}
|
|
22512
23124
|
|
|
22513
|
-
forEach$
|
|
22514
|
-
forEach$
|
|
23125
|
+
forEach$5(ioSpecification.dataInputs, contextual(handleDataInput, context));
|
|
23126
|
+
forEach$5(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
|
|
22515
23127
|
}
|
|
22516
23128
|
|
|
22517
23129
|
var handleSubProcess = this.handleSubProcess = function handleSubProcess(subProcess, context) {
|
|
@@ -22538,8 +23150,8 @@
|
|
|
22538
23150
|
// * bpmn:CatchEvent
|
|
22539
23151
|
//
|
|
22540
23152
|
deferred.push(function() {
|
|
22541
|
-
forEach$
|
|
22542
|
-
forEach$
|
|
23153
|
+
forEach$5(flowNode.dataInputAssociations, contextual(handleDataAssociation, context));
|
|
23154
|
+
forEach$5(flowNode.dataOutputAssociations, contextual(handleDataAssociation, context));
|
|
22543
23155
|
});
|
|
22544
23156
|
}
|
|
22545
23157
|
|
|
@@ -22566,11 +23178,11 @@
|
|
|
22566
23178
|
}
|
|
22567
23179
|
|
|
22568
23180
|
function handleLaneSet(laneSet, context) {
|
|
22569
|
-
forEach$
|
|
23181
|
+
forEach$5(laneSet.lanes, contextual(handleLane, context));
|
|
22570
23182
|
}
|
|
22571
23183
|
|
|
22572
23184
|
function handleLaneSets(laneSets, context) {
|
|
22573
|
-
forEach$
|
|
23185
|
+
forEach$5(laneSets, contextual(handleLaneSet, context));
|
|
22574
23186
|
}
|
|
22575
23187
|
|
|
22576
23188
|
function handleFlowElementsContainer(container, context) {
|
|
@@ -22582,7 +23194,7 @@
|
|
|
22582
23194
|
}
|
|
22583
23195
|
|
|
22584
23196
|
function handleFlowElements(flowElements, context) {
|
|
22585
|
-
forEach$
|
|
23197
|
+
forEach$5(flowElements, function(flowElement) {
|
|
22586
23198
|
if (is(flowElement, 'bpmn:SequenceFlow')) {
|
|
22587
23199
|
deferred.push(function() {
|
|
22588
23200
|
handleSequenceFlow(flowElement, context);
|
|
@@ -22620,7 +23232,7 @@
|
|
|
22620
23232
|
|
|
22621
23233
|
function handleCollaboration(collaboration, context) {
|
|
22622
23234
|
|
|
22623
|
-
forEach$
|
|
23235
|
+
forEach$5(collaboration.participants, contextual(handleParticipant, context));
|
|
22624
23236
|
|
|
22625
23237
|
deferred.push(function() {
|
|
22626
23238
|
handleMessageFlows(collaboration.messageFlows, context);
|
|
@@ -22633,7 +23245,7 @@
|
|
|
22633
23245
|
function wireFlowNodeRefs(lane) {
|
|
22634
23246
|
|
|
22635
23247
|
// wire the virtual flowNodeRefs <-> relationship
|
|
22636
|
-
forEach$
|
|
23248
|
+
forEach$5(lane.flowNodeRef, function(flowNode) {
|
|
22637
23249
|
var lanes = flowNode.get('lanes');
|
|
22638
23250
|
|
|
22639
23251
|
if (lanes) {
|
|
@@ -22711,7 +23323,7 @@
|
|
|
22711
23323
|
|
|
22712
23324
|
// traverse BPMN 2.0 document model,
|
|
22713
23325
|
// starting at definitions
|
|
22714
|
-
forEach$
|
|
23326
|
+
forEach$5(diagramsToImport, function(diagram) {
|
|
22715
23327
|
walker.handleDefinitions(definitions, diagram);
|
|
22716
23328
|
});
|
|
22717
23329
|
|
|
@@ -22777,12 +23389,12 @@
|
|
|
22777
23389
|
if (is$1(rootElement, 'bpmn:Collaboration')) {
|
|
22778
23390
|
collaboration = rootElement;
|
|
22779
23391
|
} else {
|
|
22780
|
-
collaboration = find(definitions.rootElements, function(element) {
|
|
23392
|
+
collaboration = find$2(definitions.rootElements, function(element) {
|
|
22781
23393
|
if (!is$1(element, 'bpmn:Collaboration')) {
|
|
22782
23394
|
return;
|
|
22783
23395
|
}
|
|
22784
23396
|
|
|
22785
|
-
return find(element.participants, function(participant) {
|
|
23397
|
+
return find$2(element.participants, function(participant) {
|
|
22786
23398
|
return participant.processRef === rootElement;
|
|
22787
23399
|
});
|
|
22788
23400
|
});
|
|
@@ -22806,7 +23418,7 @@
|
|
|
22806
23418
|
var diagramsToImport = [ bpmnDiagram ];
|
|
22807
23419
|
var handledElements = [ bpmnElement ];
|
|
22808
23420
|
|
|
22809
|
-
forEach$
|
|
23421
|
+
forEach$5(definitions.diagrams, function(diagram) {
|
|
22810
23422
|
|
|
22811
23423
|
if (!diagram.plane) {
|
|
22812
23424
|
return;
|
|
@@ -22830,7 +23442,7 @@
|
|
|
22830
23442
|
function selfAndAllFlowElements(elements) {
|
|
22831
23443
|
var result = [];
|
|
22832
23444
|
|
|
22833
|
-
forEach$
|
|
23445
|
+
forEach$5(elements, function(element) {
|
|
22834
23446
|
if (!element) {
|
|
22835
23447
|
return;
|
|
22836
23448
|
}
|
|
@@ -22926,11 +23538,11 @@
|
|
|
22926
23538
|
function createLightbox() {
|
|
22927
23539
|
lightbox = domify$1$1(LIGHTBOX_MARKUP);
|
|
22928
23540
|
|
|
22929
|
-
assign$
|
|
22930
|
-
assign$
|
|
22931
|
-
assign$
|
|
22932
|
-
assign$
|
|
22933
|
-
assign$
|
|
23541
|
+
assign$4(lightbox, LIGHTBOX_STYLES);
|
|
23542
|
+
assign$4(query$1('svg', lightbox), LOGO_STYLES);
|
|
23543
|
+
assign$4(query$1('.backdrop', lightbox), BACKDROP_STYLES);
|
|
23544
|
+
assign$4(query$1('.notice', lightbox), NOTICE_STYLES);
|
|
23545
|
+
assign$4(query$1('.link', lightbox), LINK_STYLES, {
|
|
22934
23546
|
'margin': '15px 20px 15px 10px',
|
|
22935
23547
|
'alignSelf': 'center'
|
|
22936
23548
|
});
|
|
@@ -23070,7 +23682,7 @@
|
|
|
23070
23682
|
/**
|
|
23071
23683
|
* @type {BaseViewerOptions}
|
|
23072
23684
|
*/
|
|
23073
|
-
options = assign$
|
|
23685
|
+
options = assign$6({}, DEFAULT_OPTIONS, options);
|
|
23074
23686
|
|
|
23075
23687
|
/**
|
|
23076
23688
|
* @type {Moddle}
|
|
@@ -23614,8 +24226,8 @@
|
|
|
23614
24226
|
|
|
23615
24227
|
const diagramModules = [].concat(staticModules, baseModules, additionalModules);
|
|
23616
24228
|
|
|
23617
|
-
const diagramOptions = assign$
|
|
23618
|
-
canvas: assign$
|
|
24229
|
+
const diagramOptions = assign$6(omit(options, [ 'additionalModules' ]), {
|
|
24230
|
+
canvas: assign$6({}, options.canvas, { container: container }),
|
|
23619
24231
|
modules: diagramModules
|
|
23620
24232
|
});
|
|
23621
24233
|
|
|
@@ -23648,7 +24260,7 @@
|
|
|
23648
24260
|
|
|
23649
24261
|
const container = domify$1$1('<div class="bjs-container"></div>');
|
|
23650
24262
|
|
|
23651
|
-
assign$
|
|
24263
|
+
assign$4(container, {
|
|
23652
24264
|
width: ensureUnit(options.width),
|
|
23653
24265
|
height: ensureUnit(options.height),
|
|
23654
24266
|
position: options.position
|
|
@@ -23663,7 +24275,7 @@
|
|
|
23663
24275
|
* @return {Moddle}
|
|
23664
24276
|
*/
|
|
23665
24277
|
BaseViewer.prototype._createModdle = function(options) {
|
|
23666
|
-
const moddleOptions = assign$
|
|
24278
|
+
const moddleOptions = assign$6({}, this._moddleExtensions, options.moddleExtensions);
|
|
23667
24279
|
|
|
23668
24280
|
return new SimpleBpmnModdle(moddleOptions);
|
|
23669
24281
|
};
|
|
@@ -23705,7 +24317,7 @@
|
|
|
23705
24317
|
* Ensure the passed argument is a proper unit (defaulting to px)
|
|
23706
24318
|
*/
|
|
23707
24319
|
function ensureUnit(val) {
|
|
23708
|
-
return val + (isNumber(val) ? 'px' : '');
|
|
24320
|
+
return val + (isNumber$1(val) ? 'px' : '');
|
|
23709
24321
|
}
|
|
23710
24322
|
|
|
23711
24323
|
|
|
@@ -23722,7 +24334,7 @@
|
|
|
23722
24334
|
return null;
|
|
23723
24335
|
}
|
|
23724
24336
|
|
|
23725
|
-
return find(definitions.diagrams, function(element) {
|
|
24337
|
+
return find$2(definitions.diagrams, function(element) {
|
|
23726
24338
|
return element.id === diagramId;
|
|
23727
24339
|
}) || null;
|
|
23728
24340
|
}
|
|
@@ -23749,8 +24361,8 @@
|
|
|
23749
24361
|
|
|
23750
24362
|
const linkElement = domify$1$1(linkMarkup);
|
|
23751
24363
|
|
|
23752
|
-
assign$
|
|
23753
|
-
assign$
|
|
24364
|
+
assign$4(query$1('svg', linkElement), LOGO_STYLES);
|
|
24365
|
+
assign$4(linkElement, LINK_STYLES, {
|
|
23754
24366
|
position: 'absolute',
|
|
23755
24367
|
bottom: '15px',
|
|
23756
24368
|
right: '15px',
|
|
@@ -24650,6 +25262,29 @@
|
|
|
24650
25262
|
type: "String"
|
|
24651
25263
|
}
|
|
24652
25264
|
]
|
|
25265
|
+
},
|
|
25266
|
+
{
|
|
25267
|
+
name: "ConditionalFilter",
|
|
25268
|
+
superClass: [
|
|
25269
|
+
"Element"
|
|
25270
|
+
],
|
|
25271
|
+
meta: {
|
|
25272
|
+
allowedIn: [
|
|
25273
|
+
"bpmn:ConditionalEventDefinition"
|
|
25274
|
+
]
|
|
25275
|
+
},
|
|
25276
|
+
properties: [
|
|
25277
|
+
{
|
|
25278
|
+
name: "variableNames",
|
|
25279
|
+
isAttr: true,
|
|
25280
|
+
type: "String"
|
|
25281
|
+
},
|
|
25282
|
+
{
|
|
25283
|
+
name: "variableEvents",
|
|
25284
|
+
isAttr: true,
|
|
25285
|
+
type: "String"
|
|
25286
|
+
}
|
|
25287
|
+
]
|
|
24653
25288
|
}
|
|
24654
25289
|
];
|
|
24655
25290
|
var zeebeModdle = {
|
|
@@ -24661,6 +25296,17 @@
|
|
|
24661
25296
|
types: types
|
|
24662
25297
|
};
|
|
24663
25298
|
|
|
25299
|
+
/**
|
|
25300
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
25301
|
+
* under one or more contributor license agreements. See the NOTICE file
|
|
25302
|
+
* distributed with this work for additional information regarding copyright
|
|
25303
|
+
* ownership.
|
|
25304
|
+
*
|
|
25305
|
+
* Camunda licenses this file to you under the MIT; you may not use this file
|
|
25306
|
+
* except in compliance with the MIT License.
|
|
25307
|
+
*/
|
|
25308
|
+
|
|
25309
|
+
|
|
24664
25310
|
const commonModules = [
|
|
24665
25311
|
iconRendererModule
|
|
24666
25312
|
];
|
|
@@ -24674,6 +25320,17 @@
|
|
|
24674
25320
|
zeebe: zeebeModdle
|
|
24675
25321
|
};
|
|
24676
25322
|
|
|
25323
|
+
/**
|
|
25324
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
25325
|
+
* under one or more contributor license agreements. See the NOTICE file
|
|
25326
|
+
* distributed with this work for additional information regarding copyright
|
|
25327
|
+
* ownership.
|
|
25328
|
+
*
|
|
25329
|
+
* Camunda licenses this file to you under the MIT; you may not use this file
|
|
25330
|
+
* except in compliance with the MIT License.
|
|
25331
|
+
*/
|
|
25332
|
+
|
|
25333
|
+
|
|
24677
25334
|
/**
|
|
24678
25335
|
* @typedef {import('bpmn-js/lib/BaseViewer').BaseViewerOptions} BaseViewerOptions
|
|
24679
25336
|
*/
|