camunda-bpmn-js 5.16.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/base-modeler.development.js +57150 -53965
- 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 +11564 -7177
- 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 +9064 -4379
- 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 +20 -18
|
@@ -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$1(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$2;
|
|
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
|
|
|
@@ -9491,13 +9620,13 @@
|
|
|
9491
9620
|
}
|
|
9492
9621
|
|
|
9493
9622
|
function registerEvents(svg) {
|
|
9494
|
-
forEach$
|
|
9623
|
+
forEach$4(bindings, function(val, key) {
|
|
9495
9624
|
registerEvent(svg, key, val);
|
|
9496
9625
|
});
|
|
9497
9626
|
}
|
|
9498
9627
|
|
|
9499
9628
|
function unregisterEvents(svg) {
|
|
9500
|
-
forEach$
|
|
9629
|
+
forEach$4(bindings, function(val, key) {
|
|
9501
9630
|
unregisterEvent(svg, key, val);
|
|
9502
9631
|
});
|
|
9503
9632
|
}
|
|
@@ -9568,7 +9697,7 @@
|
|
|
9568
9697
|
|
|
9569
9698
|
function createHitStyle(classNames, attrs) {
|
|
9570
9699
|
|
|
9571
|
-
attrs = assign$
|
|
9700
|
+
attrs = assign$5({
|
|
9572
9701
|
stroke: 'white',
|
|
9573
9702
|
strokeWidth: 15
|
|
9574
9703
|
}, attrs || {});
|
|
@@ -9607,7 +9736,7 @@
|
|
|
9607
9736
|
this.removeHits = function(gfx) {
|
|
9608
9737
|
var hits = all('.djs-hit', gfx);
|
|
9609
9738
|
|
|
9610
|
-
forEach$
|
|
9739
|
+
forEach$4(hits, remove$3);
|
|
9611
9740
|
};
|
|
9612
9741
|
|
|
9613
9742
|
/**
|
|
@@ -9666,7 +9795,7 @@
|
|
|
9666
9795
|
*/
|
|
9667
9796
|
this.createBoxHit = function(gfx, type, attrs) {
|
|
9668
9797
|
|
|
9669
|
-
attrs = assign$
|
|
9798
|
+
attrs = assign$5({
|
|
9670
9799
|
x: 0,
|
|
9671
9800
|
y: 0
|
|
9672
9801
|
}, attrs);
|
|
@@ -9901,7 +10030,7 @@
|
|
|
9901
10030
|
var selectedElements = this._selectedElements,
|
|
9902
10031
|
oldSelection = selectedElements.slice();
|
|
9903
10032
|
|
|
9904
|
-
if (!isArray$
|
|
10033
|
+
if (!isArray$5(elements)) {
|
|
9905
10034
|
elements = elements ? [ elements ] : [];
|
|
9906
10035
|
}
|
|
9907
10036
|
|
|
@@ -9918,7 +10047,7 @@
|
|
|
9918
10047
|
// selection may be cleared by passing an empty array or null
|
|
9919
10048
|
// to the method
|
|
9920
10049
|
if (add) {
|
|
9921
|
-
forEach$
|
|
10050
|
+
forEach$4(elements, function(element) {
|
|
9922
10051
|
if (selectedElements.indexOf(element) !== -1) {
|
|
9923
10052
|
|
|
9924
10053
|
// already selected
|
|
@@ -9985,13 +10114,13 @@
|
|
|
9985
10114
|
var oldSelection = event.oldSelection,
|
|
9986
10115
|
newSelection = event.newSelection;
|
|
9987
10116
|
|
|
9988
|
-
forEach$
|
|
10117
|
+
forEach$4(oldSelection, function(e) {
|
|
9989
10118
|
if (newSelection.indexOf(e) === -1) {
|
|
9990
10119
|
deselect(e);
|
|
9991
10120
|
}
|
|
9992
10121
|
});
|
|
9993
10122
|
|
|
9994
|
-
forEach$
|
|
10123
|
+
forEach$4(newSelection, function(e) {
|
|
9995
10124
|
if (oldSelection.indexOf(e) === -1) {
|
|
9996
10125
|
select(e);
|
|
9997
10126
|
}
|
|
@@ -10034,7 +10163,7 @@
|
|
|
10034
10163
|
return;
|
|
10035
10164
|
}
|
|
10036
10165
|
|
|
10037
|
-
if (isArray$
|
|
10166
|
+
if (isArray$5(autoSelect)) {
|
|
10038
10167
|
selection.select(autoSelect);
|
|
10039
10168
|
} else {
|
|
10040
10169
|
|
|
@@ -10061,7 +10190,7 @@
|
|
|
10061
10190
|
var shape = elementRegistry.get(event.context.shape.id);
|
|
10062
10191
|
|
|
10063
10192
|
// Always select main shape on move
|
|
10064
|
-
var isSelected = find(previousSelection, function(selectedShape) {
|
|
10193
|
+
var isSelected = find$1(previousSelection, function(selectedShape) {
|
|
10065
10194
|
return shape.id === selectedShape.id;
|
|
10066
10195
|
});
|
|
10067
10196
|
|
|
@@ -10153,7 +10282,7 @@
|
|
|
10153
10282
|
*
|
|
10154
10283
|
* @return {boolean}
|
|
10155
10284
|
*/
|
|
10156
|
-
function isArray(obj) {
|
|
10285
|
+
function isArray$2(obj) {
|
|
10157
10286
|
return Array.isArray(obj);
|
|
10158
10287
|
}
|
|
10159
10288
|
|
|
@@ -10180,7 +10309,7 @@
|
|
|
10180
10309
|
*/
|
|
10181
10310
|
function annotate(...args) {
|
|
10182
10311
|
|
|
10183
|
-
if (args.length === 1 && isArray(args[0])) {
|
|
10312
|
+
if (args.length === 1 && isArray$2(args[0])) {
|
|
10184
10313
|
args = args[0];
|
|
10185
10314
|
}
|
|
10186
10315
|
|
|
@@ -10325,7 +10454,7 @@
|
|
|
10325
10454
|
}
|
|
10326
10455
|
|
|
10327
10456
|
if (typeof fn !== 'function') {
|
|
10328
|
-
if (isArray(fn)) {
|
|
10457
|
+
if (isArray$2(fn)) {
|
|
10329
10458
|
fn = annotate(fn.slice());
|
|
10330
10459
|
} else {
|
|
10331
10460
|
throw error(`Cannot invoke "${ fn }". Expected a function!`);
|
|
@@ -10624,7 +10753,7 @@
|
|
|
10624
10753
|
// helpers ///////////////
|
|
10625
10754
|
|
|
10626
10755
|
function arrayUnwrap(type, value) {
|
|
10627
|
-
if (type !== 'value' && isArray(value)) {
|
|
10756
|
+
if (type !== 'value' && isArray$2(value)) {
|
|
10628
10757
|
value = annotate(value.slice());
|
|
10629
10758
|
}
|
|
10630
10759
|
|
|
@@ -10679,9 +10808,9 @@
|
|
|
10679
10808
|
});
|
|
10680
10809
|
|
|
10681
10810
|
if (isFrameElement(element)) {
|
|
10682
|
-
attr$1(rect, assign$
|
|
10811
|
+
attr$1(rect, assign$5({}, this.FRAME_STYLE, attrs || {}));
|
|
10683
10812
|
} else {
|
|
10684
|
-
attr$1(rect, assign$
|
|
10813
|
+
attr$1(rect, assign$5({}, this.SHAPE_STYLE, attrs || {}));
|
|
10685
10814
|
}
|
|
10686
10815
|
|
|
10687
10816
|
append(visuals, rect);
|
|
@@ -10694,7 +10823,7 @@
|
|
|
10694
10823
|
*/
|
|
10695
10824
|
DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
|
|
10696
10825
|
|
|
10697
|
-
var line = createLine(connection.waypoints, assign$
|
|
10826
|
+
var line = createLine(connection.waypoints, assign$5({}, this.CONNECTION_STYLE, attrs || {}));
|
|
10698
10827
|
append(visuals, line);
|
|
10699
10828
|
|
|
10700
10829
|
return line;
|
|
@@ -10776,7 +10905,7 @@
|
|
|
10776
10905
|
this.cls = function(className, traits, additionalAttrs) {
|
|
10777
10906
|
var attrs = this.style(traits, additionalAttrs);
|
|
10778
10907
|
|
|
10779
|
-
return assign$
|
|
10908
|
+
return assign$5(attrs, { 'class': className });
|
|
10780
10909
|
};
|
|
10781
10910
|
|
|
10782
10911
|
/**
|
|
@@ -10790,16 +10919,16 @@
|
|
|
10790
10919
|
*/
|
|
10791
10920
|
this.style = function(traits, additionalAttrs) {
|
|
10792
10921
|
|
|
10793
|
-
if (!isArray$
|
|
10922
|
+
if (!isArray$5(traits) && !additionalAttrs) {
|
|
10794
10923
|
additionalAttrs = traits;
|
|
10795
10924
|
traits = [];
|
|
10796
10925
|
}
|
|
10797
10926
|
|
|
10798
10927
|
var attrs = reduce(traits, function(attrs, t) {
|
|
10799
|
-
return assign$
|
|
10928
|
+
return assign$5(attrs, defaultTraits[t] || {});
|
|
10800
10929
|
}, {});
|
|
10801
10930
|
|
|
10802
|
-
return additionalAttrs ? assign$
|
|
10931
|
+
return additionalAttrs ? assign$5(attrs, additionalAttrs) : attrs;
|
|
10803
10932
|
};
|
|
10804
10933
|
|
|
10805
10934
|
|
|
@@ -10814,12 +10943,12 @@
|
|
|
10814
10943
|
* @return {Object} the style definition
|
|
10815
10944
|
*/
|
|
10816
10945
|
this.computeStyle = function(custom, traits, defaultStyles) {
|
|
10817
|
-
if (!isArray$
|
|
10946
|
+
if (!isArray$5(traits)) {
|
|
10818
10947
|
defaultStyles = traits;
|
|
10819
10948
|
traits = [];
|
|
10820
10949
|
}
|
|
10821
10950
|
|
|
10822
|
-
return self.style(traits || [], assign$
|
|
10951
|
+
return self.style(traits || [], assign$5({}, defaultStyles, custom || {}));
|
|
10823
10952
|
};
|
|
10824
10953
|
}
|
|
10825
10954
|
|
|
@@ -10974,7 +11103,7 @@
|
|
|
10974
11103
|
*/
|
|
10975
11104
|
function createContainer(options) {
|
|
10976
11105
|
|
|
10977
|
-
options = assign$
|
|
11106
|
+
options = assign$5({}, { width: '100%', height: '100%' }, options);
|
|
10978
11107
|
|
|
10979
11108
|
const container = options.container || document.body;
|
|
10980
11109
|
|
|
@@ -10984,7 +11113,7 @@
|
|
|
10984
11113
|
const parent = document.createElement('div');
|
|
10985
11114
|
parent.setAttribute('class', 'djs-container djs-parent');
|
|
10986
11115
|
|
|
10987
|
-
assign(parent, {
|
|
11116
|
+
assign$3(parent, {
|
|
10988
11117
|
position: 'relative',
|
|
10989
11118
|
overflow: 'hidden',
|
|
10990
11119
|
width: ensurePx(options.width),
|
|
@@ -11127,7 +11256,7 @@
|
|
|
11127
11256
|
// debounce canvas.viewbox.changed events when deferUpdate is set
|
|
11128
11257
|
// to help with potential performance issues
|
|
11129
11258
|
if (config.deferUpdate) {
|
|
11130
|
-
this._viewboxChanged = debounce(bind$
|
|
11259
|
+
this._viewboxChanged = debounce(bind$4(this._viewboxChanged, this), 300);
|
|
11131
11260
|
}
|
|
11132
11261
|
|
|
11133
11262
|
eventBus.on('diagram.init', () => {
|
|
@@ -11469,7 +11598,7 @@
|
|
|
11469
11598
|
};
|
|
11470
11599
|
|
|
11471
11600
|
Canvas.prototype._findPlaneForRoot = function(rootElement) {
|
|
11472
|
-
return find(this._planes, function(plane) {
|
|
11601
|
+
return find$1(this._planes, function(plane) {
|
|
11473
11602
|
return plane.rootElement === rootElement;
|
|
11474
11603
|
});
|
|
11475
11604
|
};
|
|
@@ -11504,7 +11633,7 @@
|
|
|
11504
11633
|
return;
|
|
11505
11634
|
}
|
|
11506
11635
|
|
|
11507
|
-
forEach$
|
|
11636
|
+
forEach$4([ container.gfx, container.secondaryGfx ], function(gfx) {
|
|
11508
11637
|
if (gfx) {
|
|
11509
11638
|
|
|
11510
11639
|
// invoke either addClass or removeClass based on mode
|
|
@@ -12162,7 +12291,7 @@
|
|
|
12162
12291
|
|
|
12163
12292
|
if (delta) {
|
|
12164
12293
|
this._changeViewbox(function() {
|
|
12165
|
-
delta = assign$
|
|
12294
|
+
delta = assign$5({ dx: 0, dy: 0 }, delta || {});
|
|
12166
12295
|
|
|
12167
12296
|
matrix = this._svg.createSVGMatrix().translate(delta.dx, delta.dy).multiply(matrix);
|
|
12168
12297
|
|
|
@@ -12361,7 +12490,7 @@
|
|
|
12361
12490
|
const currentScale = currentMatrix.a;
|
|
12362
12491
|
|
|
12363
12492
|
if (center) {
|
|
12364
|
-
centerPoint = assign$
|
|
12493
|
+
centerPoint = assign$5(point, center);
|
|
12365
12494
|
|
|
12366
12495
|
// revert applied viewport transformations
|
|
12367
12496
|
originalPoint = centerPoint.matrixTransform(currentMatrix.inverse());
|
|
@@ -13301,7 +13430,7 @@
|
|
|
13301
13430
|
if (!Type) {
|
|
13302
13431
|
throw new Error('unknown type: <' + type + '>');
|
|
13303
13432
|
}
|
|
13304
|
-
return assign$
|
|
13433
|
+
return assign$5(new Type(), attrs);
|
|
13305
13434
|
}
|
|
13306
13435
|
|
|
13307
13436
|
/**
|
|
@@ -13401,7 +13530,7 @@
|
|
|
13401
13530
|
*/
|
|
13402
13531
|
ElementFactory.prototype.create = function(type, attrs) {
|
|
13403
13532
|
|
|
13404
|
-
attrs = assign$
|
|
13533
|
+
attrs = assign$5({}, attrs || {});
|
|
13405
13534
|
|
|
13406
13535
|
if (!attrs.id) {
|
|
13407
13536
|
attrs.id = type + '_' + (this._uid++);
|
|
@@ -13579,9 +13708,9 @@
|
|
|
13579
13708
|
*/
|
|
13580
13709
|
EventBus.prototype.on = function(events, priority, callback, that) {
|
|
13581
13710
|
|
|
13582
|
-
events = isArray$
|
|
13711
|
+
events = isArray$5(events) ? events : [ events ];
|
|
13583
13712
|
|
|
13584
|
-
if (isFunction(priority)) {
|
|
13713
|
+
if (isFunction$1(priority)) {
|
|
13585
13714
|
that = callback;
|
|
13586
13715
|
callback = priority;
|
|
13587
13716
|
priority = DEFAULT_PRIORITY$1;
|
|
@@ -13594,7 +13723,7 @@
|
|
|
13594
13723
|
var actualCallback = callback;
|
|
13595
13724
|
|
|
13596
13725
|
if (that) {
|
|
13597
|
-
actualCallback = bind$
|
|
13726
|
+
actualCallback = bind$4(callback, that);
|
|
13598
13727
|
|
|
13599
13728
|
// make sure we remember and are able to remove
|
|
13600
13729
|
// bound callbacks via {@link #off} using the original
|
|
@@ -13638,7 +13767,7 @@
|
|
|
13638
13767
|
EventBus.prototype.once = function(events, priority, callback, that) {
|
|
13639
13768
|
var self = this;
|
|
13640
13769
|
|
|
13641
|
-
if (isFunction(priority)) {
|
|
13770
|
+
if (isFunction$1(priority)) {
|
|
13642
13771
|
that = callback;
|
|
13643
13772
|
callback = priority;
|
|
13644
13773
|
priority = DEFAULT_PRIORITY$1;
|
|
@@ -13677,7 +13806,7 @@
|
|
|
13677
13806
|
*/
|
|
13678
13807
|
EventBus.prototype.off = function(events, callback) {
|
|
13679
13808
|
|
|
13680
|
-
events = isArray$
|
|
13809
|
+
events = isArray$5(events) ? events : [ events ];
|
|
13681
13810
|
|
|
13682
13811
|
var self = this;
|
|
13683
13812
|
|
|
@@ -14002,7 +14131,7 @@
|
|
|
14002
14131
|
};
|
|
14003
14132
|
|
|
14004
14133
|
InternalEvent.prototype.init = function(data) {
|
|
14005
|
-
assign$
|
|
14134
|
+
assign$5(this, data || {});
|
|
14006
14135
|
};
|
|
14007
14136
|
|
|
14008
14137
|
|
|
@@ -14201,7 +14330,7 @@
|
|
|
14201
14330
|
|
|
14202
14331
|
// update all parents of changed and reorganized their children
|
|
14203
14332
|
// in the correct order (as indicated in our model)
|
|
14204
|
-
forEach$
|
|
14333
|
+
forEach$4(parents, function(parent) {
|
|
14205
14334
|
|
|
14206
14335
|
var children = parent.children;
|
|
14207
14336
|
|
|
@@ -14211,7 +14340,7 @@
|
|
|
14211
14340
|
|
|
14212
14341
|
var childrenGfx = self._getChildrenContainer(parent);
|
|
14213
14342
|
|
|
14214
|
-
forEach$
|
|
14343
|
+
forEach$4(children.slice().reverse(), function(child) {
|
|
14215
14344
|
var childGfx = elementRegistry.getGraphics(child);
|
|
14216
14345
|
|
|
14217
14346
|
prependTo(childGfx.parentNode, childrenGfx);
|
|
@@ -14581,6 +14710,231 @@
|
|
|
14581
14710
|
this.get('eventBus').fire('diagram.clear');
|
|
14582
14711
|
};
|
|
14583
14712
|
|
|
14713
|
+
/**
|
|
14714
|
+
* Flatten array, one level deep.
|
|
14715
|
+
*
|
|
14716
|
+
* @template T
|
|
14717
|
+
*
|
|
14718
|
+
* @param {T[][] | T[] | null} [arr]
|
|
14719
|
+
*
|
|
14720
|
+
* @return {T[]}
|
|
14721
|
+
*/
|
|
14722
|
+
|
|
14723
|
+
const nativeToString$2 = Object.prototype.toString;
|
|
14724
|
+
|
|
14725
|
+
function isString$2(obj) {
|
|
14726
|
+
return nativeToString$2.call(obj) === '[object String]';
|
|
14727
|
+
}
|
|
14728
|
+
|
|
14729
|
+
/**
|
|
14730
|
+
* Convenience wrapper for `Object.assign`.
|
|
14731
|
+
*
|
|
14732
|
+
* @param {Object} target
|
|
14733
|
+
* @param {...Object} others
|
|
14734
|
+
*
|
|
14735
|
+
* @return {Object} the target
|
|
14736
|
+
*/
|
|
14737
|
+
function assign$2(target, ...others) {
|
|
14738
|
+
return Object.assign(target, ...others);
|
|
14739
|
+
}
|
|
14740
|
+
|
|
14741
|
+
/**
|
|
14742
|
+
* Flatten array, one level deep.
|
|
14743
|
+
*
|
|
14744
|
+
* @template T
|
|
14745
|
+
*
|
|
14746
|
+
* @param {T[][] | T[] | null} [arr]
|
|
14747
|
+
*
|
|
14748
|
+
* @return {T[]}
|
|
14749
|
+
*/
|
|
14750
|
+
|
|
14751
|
+
const nativeToString$1 = Object.prototype.toString;
|
|
14752
|
+
const nativeHasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
14753
|
+
|
|
14754
|
+
function isUndefined$2(obj) {
|
|
14755
|
+
return obj === undefined;
|
|
14756
|
+
}
|
|
14757
|
+
|
|
14758
|
+
function isDefined(obj) {
|
|
14759
|
+
return obj !== undefined;
|
|
14760
|
+
}
|
|
14761
|
+
|
|
14762
|
+
function isNil$1(obj) {
|
|
14763
|
+
return obj == null;
|
|
14764
|
+
}
|
|
14765
|
+
|
|
14766
|
+
function isArray$1(obj) {
|
|
14767
|
+
return nativeToString$1.call(obj) === '[object Array]';
|
|
14768
|
+
}
|
|
14769
|
+
|
|
14770
|
+
function isObject(obj) {
|
|
14771
|
+
return nativeToString$1.call(obj) === '[object Object]';
|
|
14772
|
+
}
|
|
14773
|
+
|
|
14774
|
+
function isString$1(obj) {
|
|
14775
|
+
return nativeToString$1.call(obj) === '[object String]';
|
|
14776
|
+
}
|
|
14777
|
+
|
|
14778
|
+
/**
|
|
14779
|
+
* Return true, if target owns a property with the given key.
|
|
14780
|
+
*
|
|
14781
|
+
* @param {Object} target
|
|
14782
|
+
* @param {String} key
|
|
14783
|
+
*
|
|
14784
|
+
* @return {Boolean}
|
|
14785
|
+
*/
|
|
14786
|
+
function has$1(target, key) {
|
|
14787
|
+
return !isNil$1(target) && nativeHasOwnProperty$1.call(target, key);
|
|
14788
|
+
}
|
|
14789
|
+
|
|
14790
|
+
|
|
14791
|
+
/**
|
|
14792
|
+
* Iterate over collection; returning something
|
|
14793
|
+
* (non-undefined) will stop iteration.
|
|
14794
|
+
*
|
|
14795
|
+
* @template T
|
|
14796
|
+
* @param {Collection<T>} collection
|
|
14797
|
+
* @param { ((item: T, idx: number) => (boolean|void)) | ((item: T, key: string) => (boolean|void)) } iterator
|
|
14798
|
+
*
|
|
14799
|
+
* @return {T} return result that stopped the iteration
|
|
14800
|
+
*/
|
|
14801
|
+
function forEach$1(collection, iterator) {
|
|
14802
|
+
|
|
14803
|
+
let val,
|
|
14804
|
+
result;
|
|
14805
|
+
|
|
14806
|
+
if (isUndefined$2(collection)) {
|
|
14807
|
+
return;
|
|
14808
|
+
}
|
|
14809
|
+
|
|
14810
|
+
const convertKey = isArray$1(collection) ? toNum$1 : identity$1;
|
|
14811
|
+
|
|
14812
|
+
for (let key in collection) {
|
|
14813
|
+
|
|
14814
|
+
if (has$1(collection, key)) {
|
|
14815
|
+
val = collection[key];
|
|
14816
|
+
|
|
14817
|
+
result = iterator(val, convertKey(key));
|
|
14818
|
+
|
|
14819
|
+
if (result === false) {
|
|
14820
|
+
return val;
|
|
14821
|
+
}
|
|
14822
|
+
}
|
|
14823
|
+
}
|
|
14824
|
+
}
|
|
14825
|
+
|
|
14826
|
+
|
|
14827
|
+
function identity$1(arg) {
|
|
14828
|
+
return arg;
|
|
14829
|
+
}
|
|
14830
|
+
|
|
14831
|
+
function toNum$1(arg) {
|
|
14832
|
+
return Number(arg);
|
|
14833
|
+
}
|
|
14834
|
+
|
|
14835
|
+
/**
|
|
14836
|
+
* Bind function against target <this>.
|
|
14837
|
+
*
|
|
14838
|
+
* @param {Function} fn
|
|
14839
|
+
* @param {Object} target
|
|
14840
|
+
*
|
|
14841
|
+
* @return {Function} bound function
|
|
14842
|
+
*/
|
|
14843
|
+
function bind(fn, target) {
|
|
14844
|
+
return fn.bind(target);
|
|
14845
|
+
}
|
|
14846
|
+
|
|
14847
|
+
/**
|
|
14848
|
+
* Convenience wrapper for `Object.assign`.
|
|
14849
|
+
*
|
|
14850
|
+
* @param {Object} target
|
|
14851
|
+
* @param {...Object} others
|
|
14852
|
+
*
|
|
14853
|
+
* @return {Object} the target
|
|
14854
|
+
*/
|
|
14855
|
+
function assign$1(target, ...others) {
|
|
14856
|
+
return Object.assign(target, ...others);
|
|
14857
|
+
}
|
|
14858
|
+
|
|
14859
|
+
/**
|
|
14860
|
+
* Sets a nested property of a given object to the specified value.
|
|
14861
|
+
*
|
|
14862
|
+
* This mutates the object and returns it.
|
|
14863
|
+
*
|
|
14864
|
+
* @template T
|
|
14865
|
+
*
|
|
14866
|
+
* @param {T} target The target of the set operation.
|
|
14867
|
+
* @param {(string|number)[]} path The path to the nested value.
|
|
14868
|
+
* @param {any} value The value to set.
|
|
14869
|
+
*
|
|
14870
|
+
* @return {T}
|
|
14871
|
+
*/
|
|
14872
|
+
function set$1(target, path, value) {
|
|
14873
|
+
|
|
14874
|
+
let currentTarget = target;
|
|
14875
|
+
|
|
14876
|
+
forEach$1(path, function(key, idx) {
|
|
14877
|
+
|
|
14878
|
+
if (typeof key !== 'number' && typeof key !== 'string') {
|
|
14879
|
+
throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
|
|
14880
|
+
}
|
|
14881
|
+
|
|
14882
|
+
if (key === 'constructor') {
|
|
14883
|
+
throw new Error('illegal key: constructor');
|
|
14884
|
+
}
|
|
14885
|
+
|
|
14886
|
+
if (key === '__proto__') {
|
|
14887
|
+
throw new Error('illegal key: __proto__');
|
|
14888
|
+
}
|
|
14889
|
+
|
|
14890
|
+
let nextKey = path[idx + 1];
|
|
14891
|
+
let nextTarget = currentTarget[key];
|
|
14892
|
+
|
|
14893
|
+
if (isDefined(nextKey) && isNil$1(nextTarget)) {
|
|
14894
|
+
nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
|
|
14895
|
+
}
|
|
14896
|
+
|
|
14897
|
+
if (isUndefined$2(nextKey)) {
|
|
14898
|
+
if (isUndefined$2(value)) {
|
|
14899
|
+
delete currentTarget[key];
|
|
14900
|
+
} else {
|
|
14901
|
+
currentTarget[key] = value;
|
|
14902
|
+
}
|
|
14903
|
+
} else {
|
|
14904
|
+
currentTarget = nextTarget;
|
|
14905
|
+
}
|
|
14906
|
+
});
|
|
14907
|
+
|
|
14908
|
+
return target;
|
|
14909
|
+
}
|
|
14910
|
+
|
|
14911
|
+
/**
|
|
14912
|
+
* Pick properties from the given target.
|
|
14913
|
+
*
|
|
14914
|
+
* @template T
|
|
14915
|
+
* @template {any[]} V
|
|
14916
|
+
*
|
|
14917
|
+
* @param {T} target
|
|
14918
|
+
* @param {V} properties
|
|
14919
|
+
*
|
|
14920
|
+
* @return Pick<T, V>
|
|
14921
|
+
*/
|
|
14922
|
+
function pick(target, properties) {
|
|
14923
|
+
|
|
14924
|
+
let result = {};
|
|
14925
|
+
|
|
14926
|
+
let obj = Object(target);
|
|
14927
|
+
|
|
14928
|
+
forEach$1(properties, function(prop) {
|
|
14929
|
+
|
|
14930
|
+
if (prop in obj) {
|
|
14931
|
+
result[prop] = target[prop];
|
|
14932
|
+
}
|
|
14933
|
+
});
|
|
14934
|
+
|
|
14935
|
+
return result;
|
|
14936
|
+
}
|
|
14937
|
+
|
|
14584
14938
|
/**
|
|
14585
14939
|
* Moddle base element.
|
|
14586
14940
|
*/
|
|
@@ -14614,7 +14968,7 @@
|
|
|
14614
14968
|
prototype = Object.create(Base.prototype);
|
|
14615
14969
|
|
|
14616
14970
|
// initialize default values
|
|
14617
|
-
forEach$
|
|
14971
|
+
forEach$1(descriptor.properties, function(p) {
|
|
14618
14972
|
if (!p.isMany && p.default !== undefined) {
|
|
14619
14973
|
prototype[p.name] = p.default;
|
|
14620
14974
|
}
|
|
@@ -14633,7 +14987,7 @@
|
|
|
14633
14987
|
props.define(this, '$attrs', { value: {} });
|
|
14634
14988
|
props.define(this, '$parent', { writable: true });
|
|
14635
14989
|
|
|
14636
|
-
forEach$
|
|
14990
|
+
forEach$1(attrs, bind(function(val, key) {
|
|
14637
14991
|
this.set(key, val);
|
|
14638
14992
|
}, this));
|
|
14639
14993
|
}
|
|
@@ -14846,736 +15200,994 @@
|
|
|
14846
15200
|
var name = parseName(parts[0], nsPrefix);
|
|
14847
15201
|
var attrName = parseName(parts[1], name.prefix).name;
|
|
14848
15202
|
|
|
14849
|
-
var redefinedProperty = this.propertiesByName[attrName];
|
|
14850
|
-
if (!redefinedProperty) {
|
|
14851
|
-
throw new Error('refined property <' + attrName + '> not found');
|
|
14852
|
-
} else {
|
|
14853
|
-
this.replaceProperty(redefinedProperty, p, replace);
|
|
15203
|
+
var redefinedProperty = this.propertiesByName[attrName];
|
|
15204
|
+
if (!redefinedProperty) {
|
|
15205
|
+
throw new Error('refined property <' + attrName + '> not found');
|
|
15206
|
+
} else {
|
|
15207
|
+
this.replaceProperty(redefinedProperty, p, replace);
|
|
15208
|
+
}
|
|
15209
|
+
|
|
15210
|
+
delete p.redefines;
|
|
15211
|
+
};
|
|
15212
|
+
|
|
15213
|
+
DescriptorBuilder.prototype.addNamedProperty = function(p, validate) {
|
|
15214
|
+
var ns = p.ns,
|
|
15215
|
+
propsByName = this.propertiesByName;
|
|
15216
|
+
|
|
15217
|
+
if (validate) {
|
|
15218
|
+
this.assertNotDefined(p, ns.name);
|
|
15219
|
+
this.assertNotDefined(p, ns.localName);
|
|
15220
|
+
}
|
|
15221
|
+
|
|
15222
|
+
propsByName[ns.name] = propsByName[ns.localName] = p;
|
|
15223
|
+
};
|
|
15224
|
+
|
|
15225
|
+
DescriptorBuilder.prototype.removeNamedProperty = function(p) {
|
|
15226
|
+
var ns = p.ns,
|
|
15227
|
+
propsByName = this.propertiesByName;
|
|
15228
|
+
|
|
15229
|
+
delete propsByName[ns.name];
|
|
15230
|
+
delete propsByName[ns.localName];
|
|
15231
|
+
};
|
|
15232
|
+
|
|
15233
|
+
DescriptorBuilder.prototype.setBodyProperty = function(p, validate) {
|
|
15234
|
+
|
|
15235
|
+
if (validate && this.bodyProperty) {
|
|
15236
|
+
throw new Error(
|
|
15237
|
+
'body property defined multiple times ' +
|
|
15238
|
+
'(<' + this.bodyProperty.ns.name + '>, <' + p.ns.name + '>)');
|
|
15239
|
+
}
|
|
15240
|
+
|
|
15241
|
+
this.bodyProperty = p;
|
|
15242
|
+
};
|
|
15243
|
+
|
|
15244
|
+
DescriptorBuilder.prototype.setIdProperty = function(p, validate) {
|
|
15245
|
+
|
|
15246
|
+
if (validate && this.idProperty) {
|
|
15247
|
+
throw new Error(
|
|
15248
|
+
'id property defined multiple times ' +
|
|
15249
|
+
'(<' + this.idProperty.ns.name + '>, <' + p.ns.name + '>)');
|
|
15250
|
+
}
|
|
15251
|
+
|
|
15252
|
+
this.idProperty = p;
|
|
15253
|
+
};
|
|
15254
|
+
|
|
15255
|
+
DescriptorBuilder.prototype.assertNotTrait = function(typeDescriptor) {
|
|
15256
|
+
|
|
15257
|
+
const _extends = typeDescriptor.extends || [];
|
|
15258
|
+
|
|
15259
|
+
if (_extends.length) {
|
|
15260
|
+
throw new Error(
|
|
15261
|
+
`cannot create <${ typeDescriptor.name }> extending <${ typeDescriptor.extends }>`
|
|
15262
|
+
);
|
|
15263
|
+
}
|
|
15264
|
+
};
|
|
15265
|
+
|
|
15266
|
+
DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
|
|
15267
|
+
var propertyName = p.name,
|
|
15268
|
+
definedProperty = this.propertiesByName[propertyName];
|
|
15269
|
+
|
|
15270
|
+
if (definedProperty) {
|
|
15271
|
+
throw new Error(
|
|
15272
|
+
'property <' + propertyName + '> already defined; ' +
|
|
15273
|
+
'override of <' + definedProperty.definedBy.ns.name + '#' + definedProperty.ns.name + '> by ' +
|
|
15274
|
+
'<' + p.definedBy.ns.name + '#' + p.ns.name + '> not allowed without redefines');
|
|
15275
|
+
}
|
|
15276
|
+
};
|
|
15277
|
+
|
|
15278
|
+
DescriptorBuilder.prototype.hasProperty = function(name) {
|
|
15279
|
+
return this.propertiesByName[name];
|
|
15280
|
+
};
|
|
15281
|
+
|
|
15282
|
+
DescriptorBuilder.prototype.addTrait = function(t, inherited) {
|
|
15283
|
+
|
|
15284
|
+
if (inherited) {
|
|
15285
|
+
this.assertNotTrait(t);
|
|
15286
|
+
}
|
|
15287
|
+
|
|
15288
|
+
var typesByName = this.allTypesByName,
|
|
15289
|
+
types = this.allTypes;
|
|
15290
|
+
|
|
15291
|
+
var typeName = t.name;
|
|
15292
|
+
|
|
15293
|
+
if (typeName in typesByName) {
|
|
15294
|
+
return;
|
|
15295
|
+
}
|
|
15296
|
+
|
|
15297
|
+
forEach$1(t.properties, bind(function(p) {
|
|
15298
|
+
|
|
15299
|
+
// clone property to allow extensions
|
|
15300
|
+
p = assign$1({}, p, {
|
|
15301
|
+
name: p.ns.localName,
|
|
15302
|
+
inherited: inherited
|
|
15303
|
+
});
|
|
15304
|
+
|
|
15305
|
+
Object.defineProperty(p, 'definedBy', {
|
|
15306
|
+
value: t
|
|
15307
|
+
});
|
|
15308
|
+
|
|
15309
|
+
var replaces = p.replaces,
|
|
15310
|
+
redefines = p.redefines;
|
|
15311
|
+
|
|
15312
|
+
// add replace/redefine support
|
|
15313
|
+
if (replaces || redefines) {
|
|
15314
|
+
this.redefineProperty(p, replaces || redefines, replaces);
|
|
15315
|
+
} else {
|
|
15316
|
+
if (p.isBody) {
|
|
15317
|
+
this.setBodyProperty(p);
|
|
15318
|
+
}
|
|
15319
|
+
if (p.isId) {
|
|
15320
|
+
this.setIdProperty(p);
|
|
15321
|
+
}
|
|
15322
|
+
this.addProperty(p);
|
|
15323
|
+
}
|
|
15324
|
+
}, this));
|
|
15325
|
+
|
|
15326
|
+
types.push(t);
|
|
15327
|
+
typesByName[typeName] = t;
|
|
15328
|
+
};
|
|
15329
|
+
|
|
15330
|
+
/**
|
|
15331
|
+
* A registry of Moddle packages.
|
|
15332
|
+
*
|
|
15333
|
+
* @param {Array<Package>} packages
|
|
15334
|
+
* @param {Properties} properties
|
|
15335
|
+
*/
|
|
15336
|
+
function Registry(packages, properties) {
|
|
15337
|
+
this.packageMap = {};
|
|
15338
|
+
this.typeMap = {};
|
|
15339
|
+
|
|
15340
|
+
this.packages = [];
|
|
15341
|
+
|
|
15342
|
+
this.properties = properties;
|
|
15343
|
+
|
|
15344
|
+
forEach$1(packages, bind(this.registerPackage, this));
|
|
15345
|
+
}
|
|
15346
|
+
|
|
15347
|
+
|
|
15348
|
+
Registry.prototype.getPackage = function(uriOrPrefix) {
|
|
15349
|
+
return this.packageMap[uriOrPrefix];
|
|
15350
|
+
};
|
|
15351
|
+
|
|
15352
|
+
Registry.prototype.getPackages = function() {
|
|
15353
|
+
return this.packages;
|
|
15354
|
+
};
|
|
15355
|
+
|
|
15356
|
+
|
|
15357
|
+
Registry.prototype.registerPackage = function(pkg) {
|
|
15358
|
+
|
|
15359
|
+
// copy package
|
|
15360
|
+
pkg = assign$1({}, pkg);
|
|
15361
|
+
|
|
15362
|
+
var pkgMap = this.packageMap;
|
|
15363
|
+
|
|
15364
|
+
ensureAvailable(pkgMap, pkg, 'prefix');
|
|
15365
|
+
ensureAvailable(pkgMap, pkg, 'uri');
|
|
15366
|
+
|
|
15367
|
+
// register types
|
|
15368
|
+
forEach$1(pkg.types, bind(function(descriptor) {
|
|
15369
|
+
this.registerType(descriptor, pkg);
|
|
15370
|
+
}, this));
|
|
15371
|
+
|
|
15372
|
+
pkgMap[pkg.uri] = pkgMap[pkg.prefix] = pkg;
|
|
15373
|
+
this.packages.push(pkg);
|
|
15374
|
+
};
|
|
15375
|
+
|
|
15376
|
+
|
|
15377
|
+
/**
|
|
15378
|
+
* Register a type from a specific package with us
|
|
15379
|
+
*/
|
|
15380
|
+
Registry.prototype.registerType = function(type, pkg) {
|
|
15381
|
+
|
|
15382
|
+
type = assign$1({}, type, {
|
|
15383
|
+
superClass: (type.superClass || []).slice(),
|
|
15384
|
+
extends: (type.extends || []).slice(),
|
|
15385
|
+
properties: (type.properties || []).slice(),
|
|
15386
|
+
meta: assign$1((type.meta || {}))
|
|
15387
|
+
});
|
|
15388
|
+
|
|
15389
|
+
var ns = parseName(type.name, pkg.prefix),
|
|
15390
|
+
name = ns.name,
|
|
15391
|
+
propertiesByName = {};
|
|
15392
|
+
|
|
15393
|
+
// parse properties
|
|
15394
|
+
forEach$1(type.properties, bind(function(p) {
|
|
15395
|
+
|
|
15396
|
+
// namespace property names
|
|
15397
|
+
var propertyNs = parseName(p.name, ns.prefix),
|
|
15398
|
+
propertyName = propertyNs.name;
|
|
15399
|
+
|
|
15400
|
+
// namespace property types
|
|
15401
|
+
if (!isBuiltIn(p.type)) {
|
|
15402
|
+
p.type = parseName(p.type, propertyNs.prefix).name;
|
|
15403
|
+
}
|
|
15404
|
+
|
|
15405
|
+
assign$1(p, {
|
|
15406
|
+
ns: propertyNs,
|
|
15407
|
+
name: propertyName
|
|
15408
|
+
});
|
|
15409
|
+
|
|
15410
|
+
propertiesByName[propertyName] = p;
|
|
15411
|
+
}, this));
|
|
15412
|
+
|
|
15413
|
+
// update ns + name
|
|
15414
|
+
assign$1(type, {
|
|
15415
|
+
ns: ns,
|
|
15416
|
+
name: name,
|
|
15417
|
+
propertiesByName: propertiesByName
|
|
15418
|
+
});
|
|
15419
|
+
|
|
15420
|
+
forEach$1(type.extends, bind(function(extendsName) {
|
|
15421
|
+
var extendsNameNs = parseName(extendsName, ns.prefix);
|
|
15422
|
+
|
|
15423
|
+
var extended = this.typeMap[extendsNameNs.name];
|
|
15424
|
+
|
|
15425
|
+
extended.traits = extended.traits || [];
|
|
15426
|
+
extended.traits.push(name);
|
|
15427
|
+
}, this));
|
|
15428
|
+
|
|
15429
|
+
// link to package
|
|
15430
|
+
this.definePackage(type, pkg);
|
|
15431
|
+
|
|
15432
|
+
// register
|
|
15433
|
+
this.typeMap[name] = type;
|
|
15434
|
+
};
|
|
15435
|
+
|
|
15436
|
+
|
|
15437
|
+
/**
|
|
15438
|
+
* Traverse the type hierarchy from bottom to top,
|
|
15439
|
+
* calling iterator with (type, inherited) for all elements in
|
|
15440
|
+
* the inheritance chain.
|
|
15441
|
+
*
|
|
15442
|
+
* @param {Object} nsName
|
|
15443
|
+
* @param {Function} iterator
|
|
15444
|
+
* @param {Boolean} [trait=false]
|
|
15445
|
+
*/
|
|
15446
|
+
Registry.prototype.mapTypes = function(nsName, iterator, trait) {
|
|
15447
|
+
|
|
15448
|
+
var type = isBuiltIn(nsName.name) ? { name: nsName.name } : this.typeMap[nsName.name];
|
|
15449
|
+
|
|
15450
|
+
var self = this;
|
|
15451
|
+
|
|
15452
|
+
/**
|
|
15453
|
+
* Traverse the selected super type or trait
|
|
15454
|
+
*
|
|
15455
|
+
* @param {String} cls
|
|
15456
|
+
* @param {Boolean} [trait=false]
|
|
15457
|
+
*/
|
|
15458
|
+
function traverse(cls, trait) {
|
|
15459
|
+
var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
|
|
15460
|
+
self.mapTypes(parentNs, iterator, trait);
|
|
15461
|
+
}
|
|
15462
|
+
|
|
15463
|
+
/**
|
|
15464
|
+
* Traverse the selected trait.
|
|
15465
|
+
*
|
|
15466
|
+
* @param {String} cls
|
|
15467
|
+
*/
|
|
15468
|
+
function traverseTrait(cls) {
|
|
15469
|
+
return traverse(cls, true);
|
|
15470
|
+
}
|
|
15471
|
+
|
|
15472
|
+
/**
|
|
15473
|
+
* Traverse the selected super type
|
|
15474
|
+
*
|
|
15475
|
+
* @param {String} cls
|
|
15476
|
+
*/
|
|
15477
|
+
function traverseSuper(cls) {
|
|
15478
|
+
return traverse(cls, false);
|
|
14854
15479
|
}
|
|
14855
15480
|
|
|
14856
|
-
|
|
14857
|
-
|
|
15481
|
+
if (!type) {
|
|
15482
|
+
throw new Error('unknown type <' + nsName.name + '>');
|
|
15483
|
+
}
|
|
14858
15484
|
|
|
14859
|
-
|
|
14860
|
-
var ns = p.ns,
|
|
14861
|
-
propsByName = this.propertiesByName;
|
|
15485
|
+
forEach$1(type.superClass, trait ? traverseTrait : traverseSuper);
|
|
14862
15486
|
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
this.assertNotDefined(p, ns.localName);
|
|
14866
|
-
}
|
|
15487
|
+
// call iterator with (type, inherited=!trait)
|
|
15488
|
+
iterator(type, !trait);
|
|
14867
15489
|
|
|
14868
|
-
|
|
15490
|
+
forEach$1(type.traits, traverseTrait);
|
|
14869
15491
|
};
|
|
14870
15492
|
|
|
14871
|
-
DescriptorBuilder.prototype.removeNamedProperty = function(p) {
|
|
14872
|
-
var ns = p.ns,
|
|
14873
|
-
propsByName = this.propertiesByName;
|
|
14874
15493
|
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
15494
|
+
/**
|
|
15495
|
+
* Returns the effective descriptor for a type.
|
|
15496
|
+
*
|
|
15497
|
+
* @param {String} type the namespaced name (ns:localName) of the type
|
|
15498
|
+
*
|
|
15499
|
+
* @return {Descriptor} the resulting effective descriptor
|
|
15500
|
+
*/
|
|
15501
|
+
Registry.prototype.getEffectiveDescriptor = function(name) {
|
|
14878
15502
|
|
|
14879
|
-
|
|
15503
|
+
var nsName = parseName(name);
|
|
14880
15504
|
|
|
14881
|
-
|
|
14882
|
-
throw new Error(
|
|
14883
|
-
'body property defined multiple times ' +
|
|
14884
|
-
'(<' + this.bodyProperty.ns.name + '>, <' + p.ns.name + '>)');
|
|
14885
|
-
}
|
|
15505
|
+
var builder = new DescriptorBuilder(nsName);
|
|
14886
15506
|
|
|
14887
|
-
this.
|
|
14888
|
-
|
|
15507
|
+
this.mapTypes(nsName, function(type, inherited) {
|
|
15508
|
+
builder.addTrait(type, inherited);
|
|
15509
|
+
});
|
|
14889
15510
|
|
|
14890
|
-
|
|
15511
|
+
var descriptor = builder.build();
|
|
14891
15512
|
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
'id property defined multiple times ' +
|
|
14895
|
-
'(<' + this.idProperty.ns.name + '>, <' + p.ns.name + '>)');
|
|
14896
|
-
}
|
|
15513
|
+
// define package link
|
|
15514
|
+
this.definePackage(descriptor, descriptor.allTypes[descriptor.allTypes.length - 1].$pkg);
|
|
14897
15515
|
|
|
14898
|
-
|
|
15516
|
+
return descriptor;
|
|
14899
15517
|
};
|
|
14900
15518
|
|
|
14901
|
-
DescriptorBuilder.prototype.assertNotTrait = function(typeDescriptor) {
|
|
14902
|
-
|
|
14903
|
-
const _extends = typeDescriptor.extends || [];
|
|
14904
15519
|
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
`cannot create <${ typeDescriptor.name }> extending <${ typeDescriptor.extends }>`
|
|
14908
|
-
);
|
|
14909
|
-
}
|
|
15520
|
+
Registry.prototype.definePackage = function(target, pkg) {
|
|
15521
|
+
this.properties.define(target, '$pkg', { value: pkg });
|
|
14910
15522
|
};
|
|
14911
15523
|
|
|
14912
|
-
DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
|
|
14913
|
-
var propertyName = p.name,
|
|
14914
|
-
definedProperty = this.propertiesByName[propertyName];
|
|
14915
15524
|
|
|
14916
|
-
if (definedProperty) {
|
|
14917
|
-
throw new Error(
|
|
14918
|
-
'property <' + propertyName + '> already defined; ' +
|
|
14919
|
-
'override of <' + definedProperty.definedBy.ns.name + '#' + definedProperty.ns.name + '> by ' +
|
|
14920
|
-
'<' + p.definedBy.ns.name + '#' + p.ns.name + '> not allowed without redefines');
|
|
14921
|
-
}
|
|
14922
|
-
};
|
|
14923
15525
|
|
|
14924
|
-
|
|
14925
|
-
return this.propertiesByName[name];
|
|
14926
|
-
};
|
|
15526
|
+
// helpers ////////////////////////////
|
|
14927
15527
|
|
|
14928
|
-
|
|
15528
|
+
function ensureAvailable(packageMap, pkg, identifierKey) {
|
|
14929
15529
|
|
|
14930
|
-
|
|
14931
|
-
|
|
15530
|
+
var value = pkg[identifierKey];
|
|
15531
|
+
|
|
15532
|
+
if (value in packageMap) {
|
|
15533
|
+
throw new Error('package with ' + identifierKey + ' <' + value + '> already defined');
|
|
14932
15534
|
}
|
|
15535
|
+
}
|
|
14933
15536
|
|
|
14934
|
-
|
|
14935
|
-
|
|
15537
|
+
/**
|
|
15538
|
+
* A utility that gets and sets properties of model elements.
|
|
15539
|
+
*
|
|
15540
|
+
* @param {Model} model
|
|
15541
|
+
*/
|
|
15542
|
+
function Properties(model) {
|
|
15543
|
+
this.model = model;
|
|
15544
|
+
}
|
|
14936
15545
|
|
|
14937
|
-
var typeName = t.name;
|
|
14938
15546
|
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
15547
|
+
/**
|
|
15548
|
+
* Sets a named property on the target element.
|
|
15549
|
+
* If the value is undefined, the property gets deleted.
|
|
15550
|
+
*
|
|
15551
|
+
* @param {Object} target
|
|
15552
|
+
* @param {String} name
|
|
15553
|
+
* @param {Object} value
|
|
15554
|
+
*/
|
|
15555
|
+
Properties.prototype.set = function(target, name, value) {
|
|
14942
15556
|
|
|
14943
|
-
|
|
15557
|
+
if (!isString$1(name) || !name.length) {
|
|
15558
|
+
throw new TypeError('property name must be a non-empty string');
|
|
15559
|
+
}
|
|
14944
15560
|
|
|
14945
|
-
|
|
14946
|
-
p = assign$2({}, p, {
|
|
14947
|
-
name: p.ns.localName,
|
|
14948
|
-
inherited: inherited
|
|
14949
|
-
});
|
|
15561
|
+
var property = this.getProperty(target, name);
|
|
14950
15562
|
|
|
14951
|
-
|
|
14952
|
-
value: t
|
|
14953
|
-
});
|
|
15563
|
+
var propertyName = property && property.name;
|
|
14954
15564
|
|
|
14955
|
-
|
|
14956
|
-
redefines = p.redefines;
|
|
15565
|
+
if (isUndefined$1(value)) {
|
|
14957
15566
|
|
|
14958
|
-
//
|
|
14959
|
-
|
|
14960
|
-
|
|
15567
|
+
// unset the property, if the specified value is undefined;
|
|
15568
|
+
// delete from $attrs (for extensions) or the target itself
|
|
15569
|
+
if (property) {
|
|
15570
|
+
delete target[propertyName];
|
|
14961
15571
|
} else {
|
|
14962
|
-
|
|
14963
|
-
this.setBodyProperty(p);
|
|
14964
|
-
}
|
|
14965
|
-
if (p.isId) {
|
|
14966
|
-
this.setIdProperty(p);
|
|
14967
|
-
}
|
|
14968
|
-
this.addProperty(p);
|
|
15572
|
+
delete target.$attrs[stripGlobal(name)];
|
|
14969
15573
|
}
|
|
14970
|
-
}
|
|
15574
|
+
} else {
|
|
14971
15575
|
|
|
14972
|
-
|
|
14973
|
-
|
|
15576
|
+
// set the property, defining well defined properties on the fly
|
|
15577
|
+
// or simply updating them in target.$attrs (for extensions)
|
|
15578
|
+
if (property) {
|
|
15579
|
+
if (propertyName in target) {
|
|
15580
|
+
target[propertyName] = value;
|
|
15581
|
+
} else {
|
|
15582
|
+
defineProperty(target, property, value);
|
|
15583
|
+
}
|
|
15584
|
+
} else {
|
|
15585
|
+
target.$attrs[stripGlobal(name)] = value;
|
|
15586
|
+
}
|
|
15587
|
+
}
|
|
14974
15588
|
};
|
|
14975
15589
|
|
|
14976
15590
|
/**
|
|
14977
|
-
*
|
|
15591
|
+
* Returns the named property of the given element
|
|
14978
15592
|
*
|
|
14979
|
-
* @param
|
|
14980
|
-
* @param
|
|
15593
|
+
* @param {Object} target
|
|
15594
|
+
* @param {String} name
|
|
15595
|
+
*
|
|
15596
|
+
* @return {Object}
|
|
14981
15597
|
*/
|
|
14982
|
-
function
|
|
14983
|
-
this.packageMap = {};
|
|
14984
|
-
this.typeMap = {};
|
|
14985
|
-
|
|
14986
|
-
this.packages = [];
|
|
15598
|
+
Properties.prototype.get = function(target, name) {
|
|
14987
15599
|
|
|
14988
|
-
this.
|
|
15600
|
+
var property = this.getProperty(target, name);
|
|
14989
15601
|
|
|
14990
|
-
|
|
14991
|
-
|
|
15602
|
+
if (!property) {
|
|
15603
|
+
return target.$attrs[stripGlobal(name)];
|
|
15604
|
+
}
|
|
14992
15605
|
|
|
15606
|
+
var propertyName = property.name;
|
|
14993
15607
|
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
15608
|
+
// check if access to collection property and lazily initialize it
|
|
15609
|
+
if (!target[propertyName] && property.isMany) {
|
|
15610
|
+
defineProperty(target, property, []);
|
|
15611
|
+
}
|
|
14997
15612
|
|
|
14998
|
-
|
|
14999
|
-
return this.packages;
|
|
15613
|
+
return target[propertyName];
|
|
15000
15614
|
};
|
|
15001
15615
|
|
|
15002
15616
|
|
|
15003
|
-
|
|
15617
|
+
/**
|
|
15618
|
+
* Define a property on the target element
|
|
15619
|
+
*
|
|
15620
|
+
* @param {Object} target
|
|
15621
|
+
* @param {String} name
|
|
15622
|
+
* @param {Object} options
|
|
15623
|
+
*/
|
|
15624
|
+
Properties.prototype.define = function(target, name, options) {
|
|
15004
15625
|
|
|
15005
|
-
|
|
15006
|
-
pkg = assign$2({}, pkg);
|
|
15626
|
+
if (!options.writable) {
|
|
15007
15627
|
|
|
15008
|
-
|
|
15628
|
+
var value = options.value;
|
|
15009
15629
|
|
|
15010
|
-
|
|
15011
|
-
|
|
15630
|
+
// use getters for read-only variables to support ES6 proxies
|
|
15631
|
+
// cf. https://github.com/bpmn-io/internal-docs/issues/386
|
|
15632
|
+
options = assign$1({}, options, {
|
|
15633
|
+
get: function() { return value; }
|
|
15634
|
+
});
|
|
15012
15635
|
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
this.registerType(descriptor, pkg);
|
|
15016
|
-
}, this));
|
|
15636
|
+
delete options.value;
|
|
15637
|
+
}
|
|
15017
15638
|
|
|
15018
|
-
|
|
15019
|
-
this.packages.push(pkg);
|
|
15639
|
+
Object.defineProperty(target, name, options);
|
|
15020
15640
|
};
|
|
15021
15641
|
|
|
15022
15642
|
|
|
15023
15643
|
/**
|
|
15024
|
-
*
|
|
15644
|
+
* Define the descriptor for an element
|
|
15025
15645
|
*/
|
|
15026
|
-
|
|
15646
|
+
Properties.prototype.defineDescriptor = function(target, descriptor) {
|
|
15647
|
+
this.define(target, '$descriptor', { value: descriptor });
|
|
15648
|
+
};
|
|
15027
15649
|
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
|
|
15650
|
+
/**
|
|
15651
|
+
* Define the model for an element
|
|
15652
|
+
*/
|
|
15653
|
+
Properties.prototype.defineModel = function(target, model) {
|
|
15654
|
+
this.define(target, '$model', { value: model });
|
|
15655
|
+
};
|
|
15034
15656
|
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15657
|
+
/**
|
|
15658
|
+
* Return property with the given name on the element.
|
|
15659
|
+
*
|
|
15660
|
+
* @param {any} target
|
|
15661
|
+
* @param {string} name
|
|
15662
|
+
*
|
|
15663
|
+
* @return {object | null} property
|
|
15664
|
+
*/
|
|
15665
|
+
Properties.prototype.getProperty = function(target, name) {
|
|
15666
|
+
|
|
15667
|
+
var model = this.model;
|
|
15038
15668
|
|
|
15039
|
-
|
|
15040
|
-
forEach$2(type.properties, bind$3(function(p) {
|
|
15669
|
+
var property = model.getPropertyDescriptor(target, name);
|
|
15041
15670
|
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15671
|
+
if (property) {
|
|
15672
|
+
return property;
|
|
15673
|
+
}
|
|
15045
15674
|
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
}
|
|
15675
|
+
if (name.includes(':')) {
|
|
15676
|
+
return null;
|
|
15677
|
+
}
|
|
15050
15678
|
|
|
15051
|
-
|
|
15052
|
-
ns: propertyNs,
|
|
15053
|
-
name: propertyName
|
|
15054
|
-
});
|
|
15679
|
+
const strict = model.config.strict;
|
|
15055
15680
|
|
|
15056
|
-
|
|
15057
|
-
|
|
15681
|
+
if (typeof strict !== 'undefined') {
|
|
15682
|
+
const error = new TypeError(`unknown property <${ name }> on <${ target.$type }>`);
|
|
15058
15683
|
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
name: name,
|
|
15063
|
-
propertiesByName: propertiesByName
|
|
15064
|
-
});
|
|
15684
|
+
if (strict) {
|
|
15685
|
+
throw error;
|
|
15686
|
+
} else {
|
|
15065
15687
|
|
|
15066
|
-
|
|
15067
|
-
|
|
15688
|
+
// eslint-disable-next-line no-undef
|
|
15689
|
+
typeof console !== 'undefined' && console.warn(error);
|
|
15690
|
+
}
|
|
15691
|
+
}
|
|
15068
15692
|
|
|
15069
|
-
|
|
15693
|
+
return null;
|
|
15694
|
+
};
|
|
15070
15695
|
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15696
|
+
function isUndefined$1(val) {
|
|
15697
|
+
return typeof val === 'undefined';
|
|
15698
|
+
}
|
|
15074
15699
|
|
|
15075
|
-
|
|
15076
|
-
|
|
15700
|
+
function defineProperty(target, property, value) {
|
|
15701
|
+
Object.defineProperty(target, property.name, {
|
|
15702
|
+
enumerable: !property.isReference,
|
|
15703
|
+
writable: true,
|
|
15704
|
+
value: value,
|
|
15705
|
+
configurable: true
|
|
15706
|
+
});
|
|
15707
|
+
}
|
|
15077
15708
|
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
}
|
|
15709
|
+
function stripGlobal(name) {
|
|
15710
|
+
return name.replace(/^:/, '');
|
|
15711
|
+
}
|
|
15081
15712
|
|
|
15713
|
+
// Moddle implementation /////////////////////////////////////////////////
|
|
15082
15714
|
|
|
15083
15715
|
/**
|
|
15084
|
-
*
|
|
15085
|
-
* calling iterator with (type, inherited) for all elements in
|
|
15086
|
-
* the inheritance chain.
|
|
15716
|
+
* @class Moddle
|
|
15087
15717
|
*
|
|
15088
|
-
*
|
|
15089
|
-
*
|
|
15090
|
-
* @
|
|
15718
|
+
* A model that can be used to create elements of a specific type.
|
|
15719
|
+
*
|
|
15720
|
+
* @example
|
|
15721
|
+
*
|
|
15722
|
+
* var Moddle = require('moddle');
|
|
15723
|
+
*
|
|
15724
|
+
* var pkg = {
|
|
15725
|
+
* name: 'mypackage',
|
|
15726
|
+
* prefix: 'my',
|
|
15727
|
+
* types: [
|
|
15728
|
+
* { name: 'Root' }
|
|
15729
|
+
* ]
|
|
15730
|
+
* };
|
|
15731
|
+
*
|
|
15732
|
+
* var moddle = new Moddle([pkg]);
|
|
15733
|
+
*
|
|
15734
|
+
* @param {Array<Package>} packages the packages to contain
|
|
15735
|
+
*
|
|
15736
|
+
* @param { { strict?: boolean } } [config] moddle configuration
|
|
15091
15737
|
*/
|
|
15092
|
-
|
|
15093
|
-
|
|
15094
|
-
var type = isBuiltIn(nsName.name) ? { name: nsName.name } : this.typeMap[nsName.name];
|
|
15738
|
+
function Moddle(packages, config = {}) {
|
|
15095
15739
|
|
|
15096
|
-
|
|
15740
|
+
this.properties = new Properties(this);
|
|
15097
15741
|
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
*
|
|
15101
|
-
* @param {String} cls
|
|
15102
|
-
* @param {Boolean} [trait=false]
|
|
15103
|
-
*/
|
|
15104
|
-
function traverse(cls, trait) {
|
|
15105
|
-
var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
|
|
15106
|
-
self.mapTypes(parentNs, iterator, trait);
|
|
15107
|
-
}
|
|
15742
|
+
this.factory = new Factory(this, this.properties);
|
|
15743
|
+
this.registry = new Registry(packages, this.properties);
|
|
15108
15744
|
|
|
15109
|
-
|
|
15110
|
-
* Traverse the selected trait.
|
|
15111
|
-
*
|
|
15112
|
-
* @param {String} cls
|
|
15113
|
-
*/
|
|
15114
|
-
function traverseTrait(cls) {
|
|
15115
|
-
return traverse(cls, true);
|
|
15116
|
-
}
|
|
15745
|
+
this.typeCache = {};
|
|
15117
15746
|
|
|
15118
|
-
|
|
15119
|
-
|
|
15120
|
-
*
|
|
15121
|
-
* @param {String} cls
|
|
15122
|
-
*/
|
|
15123
|
-
function traverseSuper(cls) {
|
|
15124
|
-
return traverse(cls, false);
|
|
15125
|
-
}
|
|
15747
|
+
this.config = config;
|
|
15748
|
+
}
|
|
15126
15749
|
|
|
15127
|
-
if (!type) {
|
|
15128
|
-
throw new Error('unknown type <' + nsName.name + '>');
|
|
15129
|
-
}
|
|
15130
15750
|
|
|
15131
|
-
|
|
15751
|
+
/**
|
|
15752
|
+
* Create an instance of the specified type.
|
|
15753
|
+
*
|
|
15754
|
+
* @method Moddle#create
|
|
15755
|
+
*
|
|
15756
|
+
* @example
|
|
15757
|
+
*
|
|
15758
|
+
* var foo = moddle.create('my:Foo');
|
|
15759
|
+
* var bar = moddle.create('my:Bar', { id: 'BAR_1' });
|
|
15760
|
+
*
|
|
15761
|
+
* @param {String|Object} descriptor the type descriptor or name know to the model
|
|
15762
|
+
* @param {Object} attrs a number of attributes to initialize the model instance with
|
|
15763
|
+
* @return {Object} model instance
|
|
15764
|
+
*/
|
|
15765
|
+
Moddle.prototype.create = function(descriptor, attrs) {
|
|
15766
|
+
var Type = this.getType(descriptor);
|
|
15132
15767
|
|
|
15133
|
-
|
|
15134
|
-
|
|
15768
|
+
if (!Type) {
|
|
15769
|
+
throw new Error('unknown type <' + descriptor + '>');
|
|
15770
|
+
}
|
|
15135
15771
|
|
|
15136
|
-
|
|
15772
|
+
return new Type(attrs);
|
|
15137
15773
|
};
|
|
15138
15774
|
|
|
15139
15775
|
|
|
15140
15776
|
/**
|
|
15141
|
-
* Returns the
|
|
15777
|
+
* Returns the type representing a given descriptor
|
|
15142
15778
|
*
|
|
15143
|
-
* @
|
|
15779
|
+
* @method Moddle#getType
|
|
15144
15780
|
*
|
|
15145
|
-
* @
|
|
15781
|
+
* @example
|
|
15782
|
+
*
|
|
15783
|
+
* var Foo = moddle.getType('my:Foo');
|
|
15784
|
+
* var foo = new Foo({ 'id' : 'FOO_1' });
|
|
15785
|
+
*
|
|
15786
|
+
* @param {String|Object} descriptor the type descriptor or name know to the model
|
|
15787
|
+
* @return {Object} the type representing the descriptor
|
|
15146
15788
|
*/
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
var nsName = parseName(name);
|
|
15789
|
+
Moddle.prototype.getType = function(descriptor) {
|
|
15150
15790
|
|
|
15151
|
-
var
|
|
15791
|
+
var cache = this.typeCache;
|
|
15152
15792
|
|
|
15153
|
-
|
|
15154
|
-
builder.addTrait(type, inherited);
|
|
15155
|
-
});
|
|
15793
|
+
var name = isString$1(descriptor) ? descriptor : descriptor.ns.name;
|
|
15156
15794
|
|
|
15157
|
-
var
|
|
15795
|
+
var type = cache[name];
|
|
15158
15796
|
|
|
15159
|
-
|
|
15160
|
-
|
|
15797
|
+
if (!type) {
|
|
15798
|
+
descriptor = this.registry.getEffectiveDescriptor(name);
|
|
15799
|
+
type = cache[name] = this.factory.createType(descriptor);
|
|
15800
|
+
}
|
|
15161
15801
|
|
|
15162
|
-
return
|
|
15802
|
+
return type;
|
|
15163
15803
|
};
|
|
15164
15804
|
|
|
15165
15805
|
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15806
|
+
/**
|
|
15807
|
+
* Creates an any-element type to be used within model instances.
|
|
15808
|
+
*
|
|
15809
|
+
* This can be used to create custom elements that lie outside the meta-model.
|
|
15810
|
+
* The created element contains all the meta-data required to serialize it
|
|
15811
|
+
* as part of meta-model elements.
|
|
15812
|
+
*
|
|
15813
|
+
* @method Moddle#createAny
|
|
15814
|
+
*
|
|
15815
|
+
* @example
|
|
15816
|
+
*
|
|
15817
|
+
* var foo = moddle.createAny('vendor:Foo', 'http://vendor', {
|
|
15818
|
+
* value: 'bar'
|
|
15819
|
+
* });
|
|
15820
|
+
*
|
|
15821
|
+
* var container = moddle.create('my:Container', 'http://my', {
|
|
15822
|
+
* any: [ foo ]
|
|
15823
|
+
* });
|
|
15824
|
+
*
|
|
15825
|
+
* // go ahead and serialize the stuff
|
|
15826
|
+
*
|
|
15827
|
+
*
|
|
15828
|
+
* @param {String} name the name of the element
|
|
15829
|
+
* @param {String} nsUri the namespace uri of the element
|
|
15830
|
+
* @param {Object} [properties] a map of properties to initialize the instance with
|
|
15831
|
+
* @return {Object} the any type instance
|
|
15832
|
+
*/
|
|
15833
|
+
Moddle.prototype.createAny = function(name, nsUri, properties) {
|
|
15834
|
+
|
|
15835
|
+
var nameNs = parseName(name);
|
|
15169
15836
|
|
|
15837
|
+
var element = {
|
|
15838
|
+
$type: name,
|
|
15839
|
+
$instanceOf: function(type) {
|
|
15840
|
+
return type === this.$type;
|
|
15841
|
+
},
|
|
15842
|
+
get: function(key) {
|
|
15843
|
+
return this[key];
|
|
15844
|
+
},
|
|
15845
|
+
set: function(key, value) {
|
|
15846
|
+
set$1(this, [ key ], value);
|
|
15847
|
+
}
|
|
15848
|
+
};
|
|
15170
15849
|
|
|
15850
|
+
var descriptor = {
|
|
15851
|
+
name: name,
|
|
15852
|
+
isGeneric: true,
|
|
15853
|
+
ns: {
|
|
15854
|
+
prefix: nameNs.prefix,
|
|
15855
|
+
localName: nameNs.localName,
|
|
15856
|
+
uri: nsUri
|
|
15857
|
+
}
|
|
15858
|
+
};
|
|
15171
15859
|
|
|
15172
|
-
|
|
15860
|
+
this.properties.defineDescriptor(element, descriptor);
|
|
15861
|
+
this.properties.defineModel(element, this);
|
|
15862
|
+
this.properties.define(element, 'get', { enumerable: false, writable: true });
|
|
15863
|
+
this.properties.define(element, 'set', { enumerable: false, writable: true });
|
|
15864
|
+
this.properties.define(element, '$parent', { enumerable: false, writable: true });
|
|
15865
|
+
this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
|
|
15173
15866
|
|
|
15174
|
-
|
|
15867
|
+
forEach$1(properties, function(a, key) {
|
|
15868
|
+
if (isObject(a) && a.value !== undefined) {
|
|
15869
|
+
element[a.name] = a.value;
|
|
15870
|
+
} else {
|
|
15871
|
+
element[key] = a;
|
|
15872
|
+
}
|
|
15873
|
+
});
|
|
15175
15874
|
|
|
15176
|
-
|
|
15875
|
+
return element;
|
|
15876
|
+
};
|
|
15177
15877
|
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15878
|
+
/**
|
|
15879
|
+
* Returns a registered package by uri or prefix
|
|
15880
|
+
*
|
|
15881
|
+
* @return {Object} the package
|
|
15882
|
+
*/
|
|
15883
|
+
Moddle.prototype.getPackage = function(uriOrPrefix) {
|
|
15884
|
+
return this.registry.getPackage(uriOrPrefix);
|
|
15885
|
+
};
|
|
15182
15886
|
|
|
15183
15887
|
/**
|
|
15184
|
-
*
|
|
15888
|
+
* Returns a snapshot of all known packages
|
|
15185
15889
|
*
|
|
15186
|
-
* @
|
|
15890
|
+
* @return {Object} the package
|
|
15187
15891
|
*/
|
|
15188
|
-
function
|
|
15189
|
-
this.
|
|
15190
|
-
}
|
|
15892
|
+
Moddle.prototype.getPackages = function() {
|
|
15893
|
+
return this.registry.getPackages();
|
|
15894
|
+
};
|
|
15191
15895
|
|
|
15896
|
+
/**
|
|
15897
|
+
* Returns the descriptor for an element
|
|
15898
|
+
*/
|
|
15899
|
+
Moddle.prototype.getElementDescriptor = function(element) {
|
|
15900
|
+
return element.$descriptor;
|
|
15901
|
+
};
|
|
15192
15902
|
|
|
15193
15903
|
/**
|
|
15194
|
-
*
|
|
15195
|
-
*
|
|
15904
|
+
* Returns true if the given descriptor or instance
|
|
15905
|
+
* represents the given type.
|
|
15196
15906
|
*
|
|
15197
|
-
*
|
|
15198
|
-
* @param {String} name
|
|
15199
|
-
* @param {Object} value
|
|
15907
|
+
* May be applied to this, if element is omitted.
|
|
15200
15908
|
*/
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15909
|
+
Moddle.prototype.hasType = function(element, type) {
|
|
15910
|
+
if (type === undefined) {
|
|
15911
|
+
type = element;
|
|
15912
|
+
element = this;
|
|
15205
15913
|
}
|
|
15206
15914
|
|
|
15207
|
-
var
|
|
15208
|
-
|
|
15209
|
-
var propertyName = property && property.name;
|
|
15915
|
+
var descriptor = element.$model.getElementDescriptor(element);
|
|
15210
15916
|
|
|
15211
|
-
|
|
15917
|
+
return (type in descriptor.allTypesByName);
|
|
15918
|
+
};
|
|
15212
15919
|
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
}
|
|
15220
|
-
} else {
|
|
15920
|
+
/**
|
|
15921
|
+
* Returns the descriptor of an elements named property
|
|
15922
|
+
*/
|
|
15923
|
+
Moddle.prototype.getPropertyDescriptor = function(element, property) {
|
|
15924
|
+
return this.getElementDescriptor(element).propertiesByName[property];
|
|
15925
|
+
};
|
|
15221
15926
|
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
} else {
|
|
15228
|
-
defineProperty(target, property, value);
|
|
15229
|
-
}
|
|
15230
|
-
} else {
|
|
15231
|
-
target.$attrs[stripGlobal(name)] = value;
|
|
15232
|
-
}
|
|
15233
|
-
}
|
|
15927
|
+
/**
|
|
15928
|
+
* Returns a mapped type's descriptor
|
|
15929
|
+
*/
|
|
15930
|
+
Moddle.prototype.getTypeDescriptor = function(type) {
|
|
15931
|
+
return this.registry.typeMap[type];
|
|
15234
15932
|
};
|
|
15235
15933
|
|
|
15236
15934
|
/**
|
|
15237
|
-
*
|
|
15935
|
+
* Flatten array, one level deep.
|
|
15238
15936
|
*
|
|
15239
|
-
* @
|
|
15240
|
-
* @param {String} name
|
|
15937
|
+
* @template T
|
|
15241
15938
|
*
|
|
15242
|
-
* @
|
|
15939
|
+
* @param {T[][] | T[] | null} [arr]
|
|
15940
|
+
*
|
|
15941
|
+
* @return {T[]}
|
|
15243
15942
|
*/
|
|
15244
|
-
Properties.prototype.get = function(target, name) {
|
|
15245
|
-
|
|
15246
|
-
var property = this.getProperty(target, name);
|
|
15247
|
-
|
|
15248
|
-
if (!property) {
|
|
15249
|
-
return target.$attrs[stripGlobal(name)];
|
|
15250
|
-
}
|
|
15251
15943
|
|
|
15252
|
-
|
|
15944
|
+
const nativeToString = Object.prototype.toString;
|
|
15945
|
+
const nativeHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
15253
15946
|
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
}
|
|
15947
|
+
function isUndefined(obj) {
|
|
15948
|
+
return obj === undefined;
|
|
15949
|
+
}
|
|
15258
15950
|
|
|
15259
|
-
|
|
15260
|
-
|
|
15951
|
+
function isNil(obj) {
|
|
15952
|
+
return obj == null;
|
|
15953
|
+
}
|
|
15261
15954
|
|
|
15955
|
+
function isArray(obj) {
|
|
15956
|
+
return nativeToString.call(obj) === '[object Array]';
|
|
15957
|
+
}
|
|
15262
15958
|
|
|
15263
15959
|
/**
|
|
15264
|
-
*
|
|
15960
|
+
* @param {any} obj
|
|
15265
15961
|
*
|
|
15266
|
-
* @
|
|
15267
|
-
* @param {String} name
|
|
15268
|
-
* @param {Object} options
|
|
15962
|
+
* @return {boolean}
|
|
15269
15963
|
*/
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
if (!options.writable) {
|
|
15273
|
-
|
|
15274
|
-
var value = options.value;
|
|
15275
|
-
|
|
15276
|
-
// use getters for read-only variables to support ES6 proxies
|
|
15277
|
-
// cf. https://github.com/bpmn-io/internal-docs/issues/386
|
|
15278
|
-
options = assign$2({}, options, {
|
|
15279
|
-
get: function() { return value; }
|
|
15280
|
-
});
|
|
15281
|
-
|
|
15282
|
-
delete options.value;
|
|
15283
|
-
}
|
|
15964
|
+
function isFunction(obj) {
|
|
15965
|
+
const tag = nativeToString.call(obj);
|
|
15284
15966
|
|
|
15285
|
-
|
|
15286
|
-
|
|
15967
|
+
return (
|
|
15968
|
+
tag === '[object Function]' ||
|
|
15969
|
+
tag === '[object AsyncFunction]' ||
|
|
15970
|
+
tag === '[object GeneratorFunction]' ||
|
|
15971
|
+
tag === '[object AsyncGeneratorFunction]' ||
|
|
15972
|
+
tag === '[object Proxy]'
|
|
15973
|
+
);
|
|
15974
|
+
}
|
|
15287
15975
|
|
|
15976
|
+
function isString(obj) {
|
|
15977
|
+
return nativeToString.call(obj) === '[object String]';
|
|
15978
|
+
}
|
|
15288
15979
|
|
|
15289
15980
|
/**
|
|
15290
|
-
*
|
|
15981
|
+
* Return true, if target owns a property with the given key.
|
|
15982
|
+
*
|
|
15983
|
+
* @param {Object} target
|
|
15984
|
+
* @param {String} key
|
|
15985
|
+
*
|
|
15986
|
+
* @return {Boolean}
|
|
15291
15987
|
*/
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
}
|
|
15988
|
+
function has(target, key) {
|
|
15989
|
+
return !isNil(target) && nativeHasOwnProperty.call(target, key);
|
|
15990
|
+
}
|
|
15295
15991
|
|
|
15296
15992
|
/**
|
|
15297
|
-
*
|
|
15993
|
+
* @template T
|
|
15994
|
+
* @typedef { (
|
|
15995
|
+
* ((e: T) => boolean) |
|
|
15996
|
+
* ((e: T, idx: number) => boolean) |
|
|
15997
|
+
* ((e: T, key: string) => boolean) |
|
|
15998
|
+
* string |
|
|
15999
|
+
* number
|
|
16000
|
+
* ) } Matcher
|
|
15298
16001
|
*/
|
|
15299
|
-
Properties.prototype.defineModel = function(target, model) {
|
|
15300
|
-
this.define(target, '$model', { value: model });
|
|
15301
|
-
};
|
|
15302
16002
|
|
|
15303
16003
|
/**
|
|
15304
|
-
*
|
|
15305
|
-
*
|
|
15306
|
-
* @param {any} target
|
|
15307
|
-
* @param {string} name
|
|
16004
|
+
* @template T
|
|
16005
|
+
* @template U
|
|
15308
16006
|
*
|
|
15309
|
-
* @
|
|
16007
|
+
* @typedef { (
|
|
16008
|
+
* ((e: T) => U) | string | number
|
|
16009
|
+
* ) } Extractor
|
|
15310
16010
|
*/
|
|
15311
|
-
Properties.prototype.getProperty = function(target, name) {
|
|
15312
|
-
|
|
15313
|
-
var model = this.model;
|
|
15314
|
-
|
|
15315
|
-
var property = model.getPropertyDescriptor(target, name);
|
|
15316
|
-
|
|
15317
|
-
if (property) {
|
|
15318
|
-
return property;
|
|
15319
|
-
}
|
|
15320
|
-
|
|
15321
|
-
if (name.includes(':')) {
|
|
15322
|
-
return null;
|
|
15323
|
-
}
|
|
15324
|
-
|
|
15325
|
-
const strict = model.config.strict;
|
|
15326
|
-
|
|
15327
|
-
if (typeof strict !== 'undefined') {
|
|
15328
|
-
const error = new TypeError(`unknown property <${ name }> on <${ target.$type }>`);
|
|
15329
16011
|
|
|
15330
|
-
if (strict) {
|
|
15331
|
-
throw error;
|
|
15332
|
-
} else {
|
|
15333
16012
|
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
16013
|
+
/**
|
|
16014
|
+
* @template T
|
|
16015
|
+
* @typedef { (val: T, key: any) => boolean } MatchFn
|
|
16016
|
+
*/
|
|
15338
16017
|
|
|
15339
|
-
|
|
15340
|
-
|
|
16018
|
+
/**
|
|
16019
|
+
* @template T
|
|
16020
|
+
* @typedef { T[] } ArrayCollection
|
|
16021
|
+
*/
|
|
15341
16022
|
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
16023
|
+
/**
|
|
16024
|
+
* @template T
|
|
16025
|
+
* @typedef { { [key: string]: T } } StringKeyValueCollection
|
|
16026
|
+
*/
|
|
15345
16027
|
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
value: value,
|
|
15351
|
-
configurable: true
|
|
15352
|
-
});
|
|
15353
|
-
}
|
|
16028
|
+
/**
|
|
16029
|
+
* @template T
|
|
16030
|
+
* @typedef { { [key: number]: T } } NumberKeyValueCollection
|
|
16031
|
+
*/
|
|
15354
16032
|
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
16033
|
+
/**
|
|
16034
|
+
* @template T
|
|
16035
|
+
* @typedef { StringKeyValueCollection<T> | NumberKeyValueCollection<T> } KeyValueCollection
|
|
16036
|
+
*/
|
|
15358
16037
|
|
|
15359
|
-
|
|
16038
|
+
/**
|
|
16039
|
+
* @template T
|
|
16040
|
+
* @typedef { KeyValueCollection<T> | ArrayCollection<T> } Collection
|
|
16041
|
+
*/
|
|
15360
16042
|
|
|
15361
16043
|
/**
|
|
15362
|
-
*
|
|
15363
|
-
*
|
|
15364
|
-
* A model that can be used to create elements of a specific type.
|
|
15365
|
-
*
|
|
15366
|
-
* @example
|
|
15367
|
-
*
|
|
15368
|
-
* var Moddle = require('moddle');
|
|
15369
|
-
*
|
|
15370
|
-
* var pkg = {
|
|
15371
|
-
* name: 'mypackage',
|
|
15372
|
-
* prefix: 'my',
|
|
15373
|
-
* types: [
|
|
15374
|
-
* { name: 'Root' }
|
|
15375
|
-
* ]
|
|
15376
|
-
* };
|
|
15377
|
-
*
|
|
15378
|
-
* var moddle = new Moddle([pkg]);
|
|
16044
|
+
* Find element in collection.
|
|
15379
16045
|
*
|
|
15380
|
-
* @
|
|
16046
|
+
* @template T
|
|
16047
|
+
* @param {Collection<T>} collection
|
|
16048
|
+
* @param {Matcher<T>} matcher
|
|
15381
16049
|
*
|
|
15382
|
-
* @
|
|
16050
|
+
* @return {Object}
|
|
15383
16051
|
*/
|
|
15384
|
-
function
|
|
16052
|
+
function find(collection, matcher) {
|
|
15385
16053
|
|
|
15386
|
-
|
|
16054
|
+
const matchFn = toMatcher(matcher);
|
|
15387
16055
|
|
|
15388
|
-
|
|
15389
|
-
this.registry = new Registry(packages, this.properties);
|
|
16056
|
+
let match;
|
|
15390
16057
|
|
|
15391
|
-
|
|
16058
|
+
forEach(collection, function(val, key) {
|
|
16059
|
+
if (matchFn(val, key)) {
|
|
16060
|
+
match = val;
|
|
16061
|
+
|
|
16062
|
+
return false;
|
|
16063
|
+
}
|
|
16064
|
+
});
|
|
16065
|
+
|
|
16066
|
+
return match;
|
|
15392
16067
|
|
|
15393
|
-
this.config = config;
|
|
15394
16068
|
}
|
|
15395
16069
|
|
|
15396
16070
|
|
|
15397
16071
|
/**
|
|
15398
|
-
*
|
|
15399
|
-
*
|
|
15400
|
-
* @method Moddle#create
|
|
15401
|
-
*
|
|
15402
|
-
* @example
|
|
16072
|
+
* Find element index in collection.
|
|
15403
16073
|
*
|
|
15404
|
-
*
|
|
15405
|
-
*
|
|
16074
|
+
* @template T
|
|
16075
|
+
* @param {Collection<T>} collection
|
|
16076
|
+
* @param {Matcher<T>} matcher
|
|
15406
16077
|
*
|
|
15407
|
-
* @
|
|
15408
|
-
* @param {Object} attrs a number of attributes to initialize the model instance with
|
|
15409
|
-
* @return {Object} model instance
|
|
16078
|
+
* @return {number | string | undefined}
|
|
15410
16079
|
*/
|
|
15411
|
-
|
|
15412
|
-
var Type = this.getType(descriptor);
|
|
16080
|
+
function findIndex(collection, matcher) {
|
|
15413
16081
|
|
|
15414
|
-
|
|
15415
|
-
throw new Error('unknown type <' + descriptor + '>');
|
|
15416
|
-
}
|
|
16082
|
+
const matchFn = toMatcher(matcher);
|
|
15417
16083
|
|
|
15418
|
-
|
|
15419
|
-
|
|
16084
|
+
let idx = isArray(collection) ? -1 : undefined;
|
|
16085
|
+
|
|
16086
|
+
forEach(collection, function(val, key) {
|
|
16087
|
+
if (matchFn(val, key)) {
|
|
16088
|
+
idx = key;
|
|
16089
|
+
|
|
16090
|
+
return false;
|
|
16091
|
+
}
|
|
16092
|
+
});
|
|
16093
|
+
|
|
16094
|
+
return idx;
|
|
16095
|
+
}
|
|
15420
16096
|
|
|
15421
16097
|
|
|
15422
16098
|
/**
|
|
15423
|
-
*
|
|
15424
|
-
*
|
|
15425
|
-
* @method Moddle#getType
|
|
15426
|
-
*
|
|
15427
|
-
* @example
|
|
16099
|
+
* Filter elements in collection.
|
|
15428
16100
|
*
|
|
15429
|
-
*
|
|
15430
|
-
*
|
|
16101
|
+
* @template T
|
|
16102
|
+
* @param {Collection<T>} collection
|
|
16103
|
+
* @param {Matcher<T>} matcher
|
|
15431
16104
|
*
|
|
15432
|
-
* @
|
|
15433
|
-
* @return {Object} the type representing the descriptor
|
|
16105
|
+
* @return {T[]} result
|
|
15434
16106
|
*/
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
var cache = this.typeCache;
|
|
16107
|
+
function filter(collection, matcher) {
|
|
15438
16108
|
|
|
15439
|
-
|
|
16109
|
+
const matchFn = toMatcher(matcher);
|
|
15440
16110
|
|
|
15441
|
-
|
|
16111
|
+
let result = [];
|
|
15442
16112
|
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
16113
|
+
forEach(collection, function(val, key) {
|
|
16114
|
+
if (matchFn(val, key)) {
|
|
16115
|
+
result.push(val);
|
|
16116
|
+
}
|
|
16117
|
+
});
|
|
15447
16118
|
|
|
15448
|
-
return
|
|
15449
|
-
}
|
|
16119
|
+
return result;
|
|
16120
|
+
}
|
|
15450
16121
|
|
|
15451
16122
|
|
|
15452
16123
|
/**
|
|
15453
|
-
*
|
|
15454
|
-
*
|
|
15455
|
-
* This can be used to create custom elements that lie outside the meta-model.
|
|
15456
|
-
* The created element contains all the meta-data required to serialize it
|
|
15457
|
-
* as part of meta-model elements.
|
|
15458
|
-
*
|
|
15459
|
-
* @method Moddle#createAny
|
|
15460
|
-
*
|
|
15461
|
-
* @example
|
|
15462
|
-
*
|
|
15463
|
-
* var foo = moddle.createAny('vendor:Foo', 'http://vendor', {
|
|
15464
|
-
* value: 'bar'
|
|
15465
|
-
* });
|
|
15466
|
-
*
|
|
15467
|
-
* var container = moddle.create('my:Container', 'http://my', {
|
|
15468
|
-
* any: [ foo ]
|
|
15469
|
-
* });
|
|
15470
|
-
*
|
|
15471
|
-
* // go ahead and serialize the stuff
|
|
16124
|
+
* Iterate over collection; returning something
|
|
16125
|
+
* (non-undefined) will stop iteration.
|
|
15472
16126
|
*
|
|
16127
|
+
* @template T
|
|
16128
|
+
* @param {Collection<T>} collection
|
|
16129
|
+
* @param { ((item: T, idx: number) => (boolean|void)) | ((item: T, key: string) => (boolean|void)) } iterator
|
|
15473
16130
|
*
|
|
15474
|
-
* @
|
|
15475
|
-
* @param {String} nsUri the namespace uri of the element
|
|
15476
|
-
* @param {Object} [properties] a map of properties to initialize the instance with
|
|
15477
|
-
* @return {Object} the any type instance
|
|
16131
|
+
* @return {T} return result that stopped the iteration
|
|
15478
16132
|
*/
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
var nameNs = parseName(name);
|
|
16133
|
+
function forEach(collection, iterator) {
|
|
15482
16134
|
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
$instanceOf: function(type) {
|
|
15486
|
-
return type === this.$type;
|
|
15487
|
-
},
|
|
15488
|
-
get: function(key) {
|
|
15489
|
-
return this[key];
|
|
15490
|
-
},
|
|
15491
|
-
set: function(key, value) {
|
|
15492
|
-
set$1(this, [ key ], value);
|
|
15493
|
-
}
|
|
15494
|
-
};
|
|
16135
|
+
let val,
|
|
16136
|
+
result;
|
|
15495
16137
|
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
ns: {
|
|
15500
|
-
prefix: nameNs.prefix,
|
|
15501
|
-
localName: nameNs.localName,
|
|
15502
|
-
uri: nsUri
|
|
15503
|
-
}
|
|
15504
|
-
};
|
|
16138
|
+
if (isUndefined(collection)) {
|
|
16139
|
+
return;
|
|
16140
|
+
}
|
|
15505
16141
|
|
|
15506
|
-
|
|
15507
|
-
this.properties.defineModel(element, this);
|
|
15508
|
-
this.properties.define(element, 'get', { enumerable: false, writable: true });
|
|
15509
|
-
this.properties.define(element, 'set', { enumerable: false, writable: true });
|
|
15510
|
-
this.properties.define(element, '$parent', { enumerable: false, writable: true });
|
|
15511
|
-
this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
|
|
16142
|
+
const convertKey = isArray(collection) ? toNum : identity;
|
|
15512
16143
|
|
|
15513
|
-
|
|
15514
|
-
if (isObject(a) && a.value !== undefined) {
|
|
15515
|
-
element[a.name] = a.value;
|
|
15516
|
-
} else {
|
|
15517
|
-
element[key] = a;
|
|
15518
|
-
}
|
|
15519
|
-
});
|
|
16144
|
+
for (let key in collection) {
|
|
15520
16145
|
|
|
15521
|
-
|
|
15522
|
-
|
|
16146
|
+
if (has(collection, key)) {
|
|
16147
|
+
val = collection[key];
|
|
15523
16148
|
|
|
15524
|
-
|
|
15525
|
-
* Returns a registered package by uri or prefix
|
|
15526
|
-
*
|
|
15527
|
-
* @return {Object} the package
|
|
15528
|
-
*/
|
|
15529
|
-
Moddle.prototype.getPackage = function(uriOrPrefix) {
|
|
15530
|
-
return this.registry.getPackage(uriOrPrefix);
|
|
15531
|
-
};
|
|
16149
|
+
result = iterator(val, convertKey(key));
|
|
15532
16150
|
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
return this.registry.getPackages();
|
|
15540
|
-
};
|
|
16151
|
+
if (result === false) {
|
|
16152
|
+
return val;
|
|
16153
|
+
}
|
|
16154
|
+
}
|
|
16155
|
+
}
|
|
16156
|
+
}
|
|
15541
16157
|
|
|
15542
|
-
/**
|
|
15543
|
-
* Returns the descriptor for an element
|
|
15544
|
-
*/
|
|
15545
|
-
Moddle.prototype.getElementDescriptor = function(element) {
|
|
15546
|
-
return element.$descriptor;
|
|
15547
|
-
};
|
|
15548
16158
|
|
|
15549
16159
|
/**
|
|
15550
|
-
*
|
|
15551
|
-
*
|
|
16160
|
+
* @template T
|
|
16161
|
+
* @param {Matcher<T>} matcher
|
|
15552
16162
|
*
|
|
15553
|
-
*
|
|
16163
|
+
* @return {MatchFn<T>}
|
|
15554
16164
|
*/
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
16165
|
+
function toMatcher(matcher) {
|
|
16166
|
+
return isFunction(matcher) ? matcher : (e) => {
|
|
16167
|
+
return e === matcher;
|
|
16168
|
+
};
|
|
16169
|
+
}
|
|
15560
16170
|
|
|
15561
|
-
var descriptor = element.$model.getElementDescriptor(element);
|
|
15562
16171
|
|
|
15563
|
-
|
|
15564
|
-
|
|
16172
|
+
function identity(arg) {
|
|
16173
|
+
return arg;
|
|
16174
|
+
}
|
|
15565
16175
|
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
Moddle.prototype.getPropertyDescriptor = function(element, property) {
|
|
15570
|
-
return this.getElementDescriptor(element).propertiesByName[property];
|
|
15571
|
-
};
|
|
16176
|
+
function toNum(arg) {
|
|
16177
|
+
return Number(arg);
|
|
16178
|
+
}
|
|
15572
16179
|
|
|
15573
16180
|
/**
|
|
15574
|
-
*
|
|
16181
|
+
* Convenience wrapper for `Object.assign`.
|
|
16182
|
+
*
|
|
16183
|
+
* @param {Object} target
|
|
16184
|
+
* @param {...Object} others
|
|
16185
|
+
*
|
|
16186
|
+
* @return {Object} the target
|
|
15575
16187
|
*/
|
|
15576
|
-
|
|
15577
|
-
return
|
|
15578
|
-
}
|
|
16188
|
+
function assign(target, ...others) {
|
|
16189
|
+
return Object.assign(target, ...others);
|
|
16190
|
+
}
|
|
15579
16191
|
|
|
15580
16192
|
var fromCharCode = String.fromCharCode;
|
|
15581
16193
|
|
|
@@ -16723,7 +17335,7 @@
|
|
|
16723
17335
|
* @property {Boolean} lax
|
|
16724
17336
|
*/
|
|
16725
17337
|
|
|
16726
|
-
assign
|
|
17338
|
+
assign(this, options);
|
|
16727
17339
|
|
|
16728
17340
|
this.elementsById = {};
|
|
16729
17341
|
this.references = [];
|
|
@@ -16944,7 +17556,7 @@
|
|
|
16944
17556
|
model = this.model,
|
|
16945
17557
|
propNameNs;
|
|
16946
17558
|
|
|
16947
|
-
forEach
|
|
17559
|
+
forEach(attributes, function(value, name) {
|
|
16948
17560
|
|
|
16949
17561
|
var prop = descriptor.propertiesByName[name],
|
|
16950
17562
|
values;
|
|
@@ -16962,7 +17574,7 @@
|
|
|
16962
17574
|
// IDREFS: parse references as whitespace-separated list
|
|
16963
17575
|
values = value.split(' ');
|
|
16964
17576
|
|
|
16965
|
-
forEach
|
|
17577
|
+
forEach(values, function(v) {
|
|
16966
17578
|
context.addReference({
|
|
16967
17579
|
element: instance,
|
|
16968
17580
|
property: prop.ns.name,
|
|
@@ -17031,7 +17643,7 @@
|
|
|
17031
17643
|
|
|
17032
17644
|
const elementType = model.getType(normalizedTypeName);
|
|
17033
17645
|
|
|
17034
|
-
return assign
|
|
17646
|
+
return assign({}, property, {
|
|
17035
17647
|
effectiveType: getModdleDescriptor(elementType).name
|
|
17036
17648
|
});
|
|
17037
17649
|
}
|
|
@@ -17053,7 +17665,7 @@
|
|
|
17053
17665
|
});
|
|
17054
17666
|
|
|
17055
17667
|
if (property) {
|
|
17056
|
-
return assign
|
|
17668
|
+
return assign({}, property, {
|
|
17057
17669
|
effectiveType: getModdleDescriptor(elementType).name
|
|
17058
17670
|
});
|
|
17059
17671
|
}
|
|
@@ -17128,7 +17740,7 @@
|
|
|
17128
17740
|
}
|
|
17129
17741
|
|
|
17130
17742
|
if (propertyDesc.isReference) {
|
|
17131
|
-
assign
|
|
17743
|
+
assign(newElement, {
|
|
17132
17744
|
element: element
|
|
17133
17745
|
});
|
|
17134
17746
|
|
|
@@ -17237,7 +17849,7 @@
|
|
|
17237
17849
|
};
|
|
17238
17850
|
}
|
|
17239
17851
|
|
|
17240
|
-
assign
|
|
17852
|
+
assign(this, { lax: false }, options);
|
|
17241
17853
|
}
|
|
17242
17854
|
|
|
17243
17855
|
/**
|
|
@@ -17292,7 +17904,7 @@
|
|
|
17292
17904
|
var model = this.model,
|
|
17293
17905
|
lax = this.lax;
|
|
17294
17906
|
|
|
17295
|
-
var context = new Context(assign
|
|
17907
|
+
var context = new Context(assign({}, options, { rootHandler: rootHandler })),
|
|
17296
17908
|
parser = new Parser({ proxy: true }),
|
|
17297
17909
|
stack = createStack();
|
|
17298
17910
|
|
|
@@ -17697,14 +18309,14 @@
|
|
|
17697
18309
|
|
|
17698
18310
|
function getElementNs(ns, descriptor) {
|
|
17699
18311
|
if (descriptor.isGeneric) {
|
|
17700
|
-
return assign
|
|
18312
|
+
return assign({ localName: descriptor.ns.localName }, ns);
|
|
17701
18313
|
} else {
|
|
17702
|
-
return assign
|
|
18314
|
+
return assign({ localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg) }, ns);
|
|
17703
18315
|
}
|
|
17704
18316
|
}
|
|
17705
18317
|
|
|
17706
18318
|
function getPropertyNs(ns, descriptor) {
|
|
17707
|
-
return assign
|
|
18319
|
+
return assign({ localName: descriptor.ns.localName }, ns);
|
|
17708
18320
|
}
|
|
17709
18321
|
|
|
17710
18322
|
function getSerializableProperties(element) {
|
|
@@ -17718,7 +18330,7 @@
|
|
|
17718
18330
|
}
|
|
17719
18331
|
|
|
17720
18332
|
// do not serialize defaults
|
|
17721
|
-
if (!has
|
|
18333
|
+
if (!has(element, name)) {
|
|
17722
18334
|
return false;
|
|
17723
18335
|
}
|
|
17724
18336
|
|
|
@@ -17938,7 +18550,7 @@
|
|
|
17938
18550
|
if (this.isLocalNs(effectiveNs)) {
|
|
17939
18551
|
return { localName: ns.localName };
|
|
17940
18552
|
} else {
|
|
17941
|
-
return assign
|
|
18553
|
+
return assign({ localName: ns.localName }, effectiveNs);
|
|
17942
18554
|
}
|
|
17943
18555
|
};
|
|
17944
18556
|
|
|
@@ -17961,7 +18573,7 @@
|
|
|
17961
18573
|
var children = element.$children;
|
|
17962
18574
|
|
|
17963
18575
|
if (children) {
|
|
17964
|
-
forEach
|
|
18576
|
+
forEach(children, child => {
|
|
17965
18577
|
this.body.push(new ElementSerializer(this).build(child));
|
|
17966
18578
|
});
|
|
17967
18579
|
}
|
|
@@ -18021,7 +18633,7 @@
|
|
|
18021
18633
|
// parse namespace attributes first
|
|
18022
18634
|
// and log them. push non namespace attributes to a list
|
|
18023
18635
|
// and process them later
|
|
18024
|
-
forEach
|
|
18636
|
+
forEach(genericAttrs, function(value, name) {
|
|
18025
18637
|
|
|
18026
18638
|
var nonNsAttr = self.parseNsAttribute(element, name, value);
|
|
18027
18639
|
|
|
@@ -18037,7 +18649,7 @@
|
|
|
18037
18649
|
|
|
18038
18650
|
var self = this;
|
|
18039
18651
|
|
|
18040
|
-
forEach
|
|
18652
|
+
forEach(attributes, function(attr) {
|
|
18041
18653
|
|
|
18042
18654
|
try {
|
|
18043
18655
|
self.addAttribute(self.nsAttributeName(attr.name), attr.value);
|
|
@@ -18059,7 +18671,7 @@
|
|
|
18059
18671
|
body = this.body,
|
|
18060
18672
|
element = this.element;
|
|
18061
18673
|
|
|
18062
|
-
forEach
|
|
18674
|
+
forEach(properties, function(p) {
|
|
18063
18675
|
var value = element.get(p.name),
|
|
18064
18676
|
isReference = p.isReference,
|
|
18065
18677
|
isMany = p.isMany;
|
|
@@ -18071,11 +18683,11 @@
|
|
|
18071
18683
|
if (p.isBody) {
|
|
18072
18684
|
body.push(new BodySerializer().build(p, value[0]));
|
|
18073
18685
|
} else if (isSimple(p.type)) {
|
|
18074
|
-
forEach
|
|
18686
|
+
forEach(value, function(v) {
|
|
18075
18687
|
body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
|
|
18076
18688
|
});
|
|
18077
18689
|
} else if (isReference) {
|
|
18078
|
-
forEach
|
|
18690
|
+
forEach(value, function(v) {
|
|
18079
18691
|
body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
|
|
18080
18692
|
});
|
|
18081
18693
|
} else {
|
|
@@ -18084,7 +18696,7 @@
|
|
|
18084
18696
|
// rather than element name
|
|
18085
18697
|
var serialization = getSerialization(p);
|
|
18086
18698
|
|
|
18087
|
-
forEach
|
|
18699
|
+
forEach(value, function(v) {
|
|
18088
18700
|
var serializer;
|
|
18089
18701
|
|
|
18090
18702
|
if (serialization) {
|
|
@@ -18196,7 +18808,7 @@
|
|
|
18196
18808
|
var self = this,
|
|
18197
18809
|
element = this.element;
|
|
18198
18810
|
|
|
18199
|
-
forEach
|
|
18811
|
+
forEach(properties, function(p) {
|
|
18200
18812
|
|
|
18201
18813
|
var value = element.get(p.name);
|
|
18202
18814
|
|
|
@@ -18206,7 +18818,7 @@
|
|
|
18206
18818
|
value = value.id;
|
|
18207
18819
|
} else {
|
|
18208
18820
|
var values = [];
|
|
18209
|
-
forEach
|
|
18821
|
+
forEach(value, function(v) {
|
|
18210
18822
|
values.push(v.id);
|
|
18211
18823
|
});
|
|
18212
18824
|
|
|
@@ -18262,7 +18874,7 @@
|
|
|
18262
18874
|
attrs = getNsAttrs(namespaces).concat(attrs);
|
|
18263
18875
|
}
|
|
18264
18876
|
|
|
18265
|
-
forEach
|
|
18877
|
+
forEach(attrs, function(a) {
|
|
18266
18878
|
writer
|
|
18267
18879
|
.append(' ')
|
|
18268
18880
|
.append(nsName(a.name)).append('="').append(a.value).append('"');
|
|
@@ -18289,7 +18901,7 @@
|
|
|
18289
18901
|
.indent();
|
|
18290
18902
|
}
|
|
18291
18903
|
|
|
18292
|
-
forEach
|
|
18904
|
+
forEach(this.body, function(b) {
|
|
18293
18905
|
b.serializeTo(writer);
|
|
18294
18906
|
});
|
|
18295
18907
|
|
|
@@ -18404,7 +19016,7 @@
|
|
|
18404
19016
|
*/
|
|
18405
19017
|
function Writer(options) {
|
|
18406
19018
|
|
|
18407
|
-
options = assign
|
|
19019
|
+
options = assign({ format: false, preamble: true }, options || {});
|
|
18408
19020
|
|
|
18409
19021
|
function toXML(tree, writer) {
|
|
18410
19022
|
var internalWriter = writer || new SavingWriter();
|
|
@@ -18510,7 +19122,7 @@
|
|
|
18510
19122
|
*/
|
|
18511
19123
|
BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
|
|
18512
19124
|
|
|
18513
|
-
if (!isString(typeName)) {
|
|
19125
|
+
if (!isString$2(typeName)) {
|
|
18514
19126
|
options = typeName;
|
|
18515
19127
|
typeName = 'bpmn:Definitions';
|
|
18516
19128
|
}
|
|
@@ -22222,7 +22834,7 @@
|
|
|
22222
22834
|
function ensureCompatDiRef(businessObject) {
|
|
22223
22835
|
|
|
22224
22836
|
// bpmnElement can have multiple independent DIs
|
|
22225
|
-
if (!has$
|
|
22837
|
+
if (!has$5(businessObject, 'di')) {
|
|
22226
22838
|
Object.defineProperty(businessObject, 'di', {
|
|
22227
22839
|
enumerable: false,
|
|
22228
22840
|
get: function() {
|
|
@@ -22258,7 +22870,7 @@
|
|
|
22258
22870
|
* @return {ModdleElement}
|
|
22259
22871
|
*/
|
|
22260
22872
|
function findDisplayCandidate(definitions) {
|
|
22261
|
-
return find(definitions.rootElements, function(e) {
|
|
22873
|
+
return find$2(definitions.rootElements, function(e) {
|
|
22262
22874
|
return is(e, 'bpmn:Process') || is(e, 'bpmn:Collaboration');
|
|
22263
22875
|
});
|
|
22264
22876
|
}
|
|
@@ -22362,7 +22974,7 @@
|
|
|
22362
22974
|
function handlePlane(plane) {
|
|
22363
22975
|
registerDi(plane);
|
|
22364
22976
|
|
|
22365
|
-
forEach$
|
|
22977
|
+
forEach$5(plane.planeElement, handlePlaneElement);
|
|
22366
22978
|
}
|
|
22367
22979
|
|
|
22368
22980
|
function handlePlaneElement(planeElement) {
|
|
@@ -22480,7 +23092,7 @@
|
|
|
22480
23092
|
// walk through all processes that have not yet been drawn and draw them
|
|
22481
23093
|
// if they contain lanes with DI information.
|
|
22482
23094
|
// we do this to pass the free-floating lane test cases in the MIWG test suite
|
|
22483
|
-
var processes = filter(rootElements, function(e) {
|
|
23095
|
+
var processes = filter$2(rootElements, function(e) {
|
|
22484
23096
|
return !isHandled(e) && is(e, 'bpmn:Process') && e.laneSets;
|
|
22485
23097
|
});
|
|
22486
23098
|
|
|
@@ -22492,7 +23104,7 @@
|
|
|
22492
23104
|
}
|
|
22493
23105
|
|
|
22494
23106
|
function handleMessageFlows(messageFlows, context) {
|
|
22495
|
-
forEach$
|
|
23107
|
+
forEach$5(messageFlows, contextual(handleMessageFlow, context));
|
|
22496
23108
|
}
|
|
22497
23109
|
|
|
22498
23110
|
function handleDataAssociation(association, context) {
|
|
@@ -22518,7 +23130,7 @@
|
|
|
22518
23130
|
|
|
22519
23131
|
function handleArtifacts(artifacts, context) {
|
|
22520
23132
|
|
|
22521
|
-
forEach$
|
|
23133
|
+
forEach$5(artifacts, function(e) {
|
|
22522
23134
|
if (is(e, 'bpmn:Association')) {
|
|
22523
23135
|
deferred.push(function() {
|
|
22524
23136
|
handleArtifact(e, context);
|
|
@@ -22535,8 +23147,8 @@
|
|
|
22535
23147
|
return;
|
|
22536
23148
|
}
|
|
22537
23149
|
|
|
22538
|
-
forEach$
|
|
22539
|
-
forEach$
|
|
23150
|
+
forEach$5(ioSpecification.dataInputs, contextual(handleDataInput, context));
|
|
23151
|
+
forEach$5(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
|
|
22540
23152
|
}
|
|
22541
23153
|
|
|
22542
23154
|
var handleSubProcess = this.handleSubProcess = function handleSubProcess(subProcess, context) {
|
|
@@ -22563,8 +23175,8 @@
|
|
|
22563
23175
|
// * bpmn:CatchEvent
|
|
22564
23176
|
//
|
|
22565
23177
|
deferred.push(function() {
|
|
22566
|
-
forEach$
|
|
22567
|
-
forEach$
|
|
23178
|
+
forEach$5(flowNode.dataInputAssociations, contextual(handleDataAssociation, context));
|
|
23179
|
+
forEach$5(flowNode.dataOutputAssociations, contextual(handleDataAssociation, context));
|
|
22568
23180
|
});
|
|
22569
23181
|
}
|
|
22570
23182
|
|
|
@@ -22591,11 +23203,11 @@
|
|
|
22591
23203
|
}
|
|
22592
23204
|
|
|
22593
23205
|
function handleLaneSet(laneSet, context) {
|
|
22594
|
-
forEach$
|
|
23206
|
+
forEach$5(laneSet.lanes, contextual(handleLane, context));
|
|
22595
23207
|
}
|
|
22596
23208
|
|
|
22597
23209
|
function handleLaneSets(laneSets, context) {
|
|
22598
|
-
forEach$
|
|
23210
|
+
forEach$5(laneSets, contextual(handleLaneSet, context));
|
|
22599
23211
|
}
|
|
22600
23212
|
|
|
22601
23213
|
function handleFlowElementsContainer(container, context) {
|
|
@@ -22607,7 +23219,7 @@
|
|
|
22607
23219
|
}
|
|
22608
23220
|
|
|
22609
23221
|
function handleFlowElements(flowElements, context) {
|
|
22610
|
-
forEach$
|
|
23222
|
+
forEach$5(flowElements, function(flowElement) {
|
|
22611
23223
|
if (is(flowElement, 'bpmn:SequenceFlow')) {
|
|
22612
23224
|
deferred.push(function() {
|
|
22613
23225
|
handleSequenceFlow(flowElement, context);
|
|
@@ -22645,7 +23257,7 @@
|
|
|
22645
23257
|
|
|
22646
23258
|
function handleCollaboration(collaboration, context) {
|
|
22647
23259
|
|
|
22648
|
-
forEach$
|
|
23260
|
+
forEach$5(collaboration.participants, contextual(handleParticipant, context));
|
|
22649
23261
|
|
|
22650
23262
|
deferred.push(function() {
|
|
22651
23263
|
handleMessageFlows(collaboration.messageFlows, context);
|
|
@@ -22658,7 +23270,7 @@
|
|
|
22658
23270
|
function wireFlowNodeRefs(lane) {
|
|
22659
23271
|
|
|
22660
23272
|
// wire the virtual flowNodeRefs <-> relationship
|
|
22661
|
-
forEach$
|
|
23273
|
+
forEach$5(lane.flowNodeRef, function(flowNode) {
|
|
22662
23274
|
var lanes = flowNode.get('lanes');
|
|
22663
23275
|
|
|
22664
23276
|
if (lanes) {
|
|
@@ -22736,7 +23348,7 @@
|
|
|
22736
23348
|
|
|
22737
23349
|
// traverse BPMN 2.0 document model,
|
|
22738
23350
|
// starting at definitions
|
|
22739
|
-
forEach$
|
|
23351
|
+
forEach$5(diagramsToImport, function(diagram) {
|
|
22740
23352
|
walker.handleDefinitions(definitions, diagram);
|
|
22741
23353
|
});
|
|
22742
23354
|
|
|
@@ -22802,12 +23414,12 @@
|
|
|
22802
23414
|
if (is$1(rootElement, 'bpmn:Collaboration')) {
|
|
22803
23415
|
collaboration = rootElement;
|
|
22804
23416
|
} else {
|
|
22805
|
-
collaboration = find(definitions.rootElements, function(element) {
|
|
23417
|
+
collaboration = find$2(definitions.rootElements, function(element) {
|
|
22806
23418
|
if (!is$1(element, 'bpmn:Collaboration')) {
|
|
22807
23419
|
return;
|
|
22808
23420
|
}
|
|
22809
23421
|
|
|
22810
|
-
return find(element.participants, function(participant) {
|
|
23422
|
+
return find$2(element.participants, function(participant) {
|
|
22811
23423
|
return participant.processRef === rootElement;
|
|
22812
23424
|
});
|
|
22813
23425
|
});
|
|
@@ -22831,7 +23443,7 @@
|
|
|
22831
23443
|
var diagramsToImport = [ bpmnDiagram ];
|
|
22832
23444
|
var handledElements = [ bpmnElement ];
|
|
22833
23445
|
|
|
22834
|
-
forEach$
|
|
23446
|
+
forEach$5(definitions.diagrams, function(diagram) {
|
|
22835
23447
|
|
|
22836
23448
|
if (!diagram.plane) {
|
|
22837
23449
|
return;
|
|
@@ -22855,7 +23467,7 @@
|
|
|
22855
23467
|
function selfAndAllFlowElements(elements) {
|
|
22856
23468
|
var result = [];
|
|
22857
23469
|
|
|
22858
|
-
forEach$
|
|
23470
|
+
forEach$5(elements, function(element) {
|
|
22859
23471
|
if (!element) {
|
|
22860
23472
|
return;
|
|
22861
23473
|
}
|
|
@@ -22951,11 +23563,11 @@
|
|
|
22951
23563
|
function createLightbox() {
|
|
22952
23564
|
lightbox = domify$1$1(LIGHTBOX_MARKUP);
|
|
22953
23565
|
|
|
22954
|
-
assign$
|
|
22955
|
-
assign$
|
|
22956
|
-
assign$
|
|
22957
|
-
assign$
|
|
22958
|
-
assign$
|
|
23566
|
+
assign$4(lightbox, LIGHTBOX_STYLES);
|
|
23567
|
+
assign$4(query$1('svg', lightbox), LOGO_STYLES);
|
|
23568
|
+
assign$4(query$1('.backdrop', lightbox), BACKDROP_STYLES);
|
|
23569
|
+
assign$4(query$1('.notice', lightbox), NOTICE_STYLES);
|
|
23570
|
+
assign$4(query$1('.link', lightbox), LINK_STYLES, {
|
|
22959
23571
|
'margin': '15px 20px 15px 10px',
|
|
22960
23572
|
'alignSelf': 'center'
|
|
22961
23573
|
});
|
|
@@ -23095,7 +23707,7 @@
|
|
|
23095
23707
|
/**
|
|
23096
23708
|
* @type {BaseViewerOptions}
|
|
23097
23709
|
*/
|
|
23098
|
-
options = assign$
|
|
23710
|
+
options = assign$6({}, DEFAULT_OPTIONS, options);
|
|
23099
23711
|
|
|
23100
23712
|
/**
|
|
23101
23713
|
* @type {Moddle}
|
|
@@ -23639,8 +24251,8 @@
|
|
|
23639
24251
|
|
|
23640
24252
|
const diagramModules = [].concat(staticModules, baseModules, additionalModules);
|
|
23641
24253
|
|
|
23642
|
-
const diagramOptions = assign$
|
|
23643
|
-
canvas: assign$
|
|
24254
|
+
const diagramOptions = assign$6(omit(options, [ 'additionalModules' ]), {
|
|
24255
|
+
canvas: assign$6({}, options.canvas, { container: container }),
|
|
23644
24256
|
modules: diagramModules
|
|
23645
24257
|
});
|
|
23646
24258
|
|
|
@@ -23673,7 +24285,7 @@
|
|
|
23673
24285
|
|
|
23674
24286
|
const container = domify$1$1('<div class="bjs-container"></div>');
|
|
23675
24287
|
|
|
23676
|
-
assign$
|
|
24288
|
+
assign$4(container, {
|
|
23677
24289
|
width: ensureUnit(options.width),
|
|
23678
24290
|
height: ensureUnit(options.height),
|
|
23679
24291
|
position: options.position
|
|
@@ -23688,7 +24300,7 @@
|
|
|
23688
24300
|
* @return {Moddle}
|
|
23689
24301
|
*/
|
|
23690
24302
|
BaseViewer.prototype._createModdle = function(options) {
|
|
23691
|
-
const moddleOptions = assign$
|
|
24303
|
+
const moddleOptions = assign$6({}, this._moddleExtensions, options.moddleExtensions);
|
|
23692
24304
|
|
|
23693
24305
|
return new SimpleBpmnModdle(moddleOptions);
|
|
23694
24306
|
};
|
|
@@ -23730,7 +24342,7 @@
|
|
|
23730
24342
|
* Ensure the passed argument is a proper unit (defaulting to px)
|
|
23731
24343
|
*/
|
|
23732
24344
|
function ensureUnit(val) {
|
|
23733
|
-
return val + (isNumber(val) ? 'px' : '');
|
|
24345
|
+
return val + (isNumber$1(val) ? 'px' : '');
|
|
23734
24346
|
}
|
|
23735
24347
|
|
|
23736
24348
|
|
|
@@ -23747,7 +24359,7 @@
|
|
|
23747
24359
|
return null;
|
|
23748
24360
|
}
|
|
23749
24361
|
|
|
23750
|
-
return find(definitions.diagrams, function(element) {
|
|
24362
|
+
return find$2(definitions.diagrams, function(element) {
|
|
23751
24363
|
return element.id === diagramId;
|
|
23752
24364
|
}) || null;
|
|
23753
24365
|
}
|
|
@@ -23774,8 +24386,8 @@
|
|
|
23774
24386
|
|
|
23775
24387
|
const linkElement = domify$1$1(linkMarkup);
|
|
23776
24388
|
|
|
23777
|
-
assign$
|
|
23778
|
-
assign$
|
|
24389
|
+
assign$4(query$1('svg', linkElement), LOGO_STYLES);
|
|
24390
|
+
assign$4(linkElement, LINK_STYLES, {
|
|
23779
24391
|
position: 'absolute',
|
|
23780
24392
|
bottom: '15px',
|
|
23781
24393
|
right: '15px',
|
|
@@ -23862,6 +24474,7 @@
|
|
|
23862
24474
|
|
|
23863
24475
|
var KEYS_COPY = [ 'c', 'C' ];
|
|
23864
24476
|
var KEYS_PASTE = [ 'v', 'V' ];
|
|
24477
|
+
var KEYS_DUPLICATE = [ 'd', 'D' ];
|
|
23865
24478
|
var KEYS_REDO = [ 'y', 'Y' ];
|
|
23866
24479
|
var KEYS_UNDO = [ 'z', 'Z' ];
|
|
23867
24480
|
|
|
@@ -23896,7 +24509,7 @@
|
|
|
23896
24509
|
* @return {boolean}
|
|
23897
24510
|
*/
|
|
23898
24511
|
function isKey(keys, event) {
|
|
23899
|
-
keys = isArray$
|
|
24512
|
+
keys = isArray$5(keys) ? keys : [ keys ];
|
|
23900
24513
|
|
|
23901
24514
|
return keys.indexOf(event.key) !== -1 || keys.indexOf(event.code) !== -1;
|
|
23902
24515
|
}
|
|
@@ -23922,6 +24535,13 @@
|
|
|
23922
24535
|
return isCmd(event) && isKey(KEYS_PASTE, event);
|
|
23923
24536
|
}
|
|
23924
24537
|
|
|
24538
|
+
/**
|
|
24539
|
+
* @param {KeyboardEvent} event
|
|
24540
|
+
*/
|
|
24541
|
+
function isDuplicate(event) {
|
|
24542
|
+
return isCmd(event) && isKey(KEYS_DUPLICATE, event);
|
|
24543
|
+
}
|
|
24544
|
+
|
|
23925
24545
|
/**
|
|
23926
24546
|
* @param {KeyboardEvent} event
|
|
23927
24547
|
*/
|
|
@@ -24117,7 +24737,7 @@
|
|
|
24117
24737
|
* @param {string} [type='keyboard.keydown']
|
|
24118
24738
|
*/
|
|
24119
24739
|
Keyboard.prototype.addListener = function(priority, listener, type) {
|
|
24120
|
-
if (isFunction(priority)) {
|
|
24740
|
+
if (isFunction$1(priority)) {
|
|
24121
24741
|
type = listener;
|
|
24122
24742
|
listener = priority;
|
|
24123
24743
|
priority = DEFAULT_PRIORITY;
|
|
@@ -24247,6 +24867,20 @@
|
|
|
24247
24867
|
}
|
|
24248
24868
|
});
|
|
24249
24869
|
|
|
24870
|
+
// duplicate
|
|
24871
|
+
// CTRL/CMD + D
|
|
24872
|
+
addListener('duplicate', function(context) {
|
|
24873
|
+
|
|
24874
|
+
var event = context.keyEvent;
|
|
24875
|
+
|
|
24876
|
+
if (isDuplicate(event)) {
|
|
24877
|
+
editorActions.trigger('duplicate');
|
|
24878
|
+
|
|
24879
|
+
return true;
|
|
24880
|
+
}
|
|
24881
|
+
});
|
|
24882
|
+
|
|
24883
|
+
|
|
24250
24884
|
// zoom in one step
|
|
24251
24885
|
// CTRL/CMD + +
|
|
24252
24886
|
addListener('stepZoom', function(context) {
|
|
@@ -24339,7 +24973,7 @@
|
|
|
24339
24973
|
|
|
24340
24974
|
var self = this;
|
|
24341
24975
|
|
|
24342
|
-
this._config = assign$
|
|
24976
|
+
this._config = assign$5({}, DEFAULT_CONFIG, config || {});
|
|
24343
24977
|
|
|
24344
24978
|
keyboard.addListener(arrowsListener);
|
|
24345
24979
|
|
|
@@ -24729,7 +25363,7 @@
|
|
|
24729
25363
|
this._canvas = canvas;
|
|
24730
25364
|
this._container = canvas._container;
|
|
24731
25365
|
|
|
24732
|
-
this._handleWheel = bind$
|
|
25366
|
+
this._handleWheel = bind$4(this._handleWheel, this);
|
|
24733
25367
|
|
|
24734
25368
|
this._totalDelta = 0;
|
|
24735
25369
|
this._scale = config.scale || DEFAULT_SCALE;
|
|
@@ -24958,6 +25592,16 @@
|
|
|
24958
25592
|
NavigatedViewer.prototype._navigationModules
|
|
24959
25593
|
);
|
|
24960
25594
|
|
|
25595
|
+
/**
|
|
25596
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
25597
|
+
* under one or more contributor license agreements. See the NOTICE file
|
|
25598
|
+
* distributed with this work for additional information regarding copyright
|
|
25599
|
+
* ownership.
|
|
25600
|
+
*
|
|
25601
|
+
* Camunda licenses this file to you under the MIT; you may not use this file
|
|
25602
|
+
* except in compliance with the MIT License.
|
|
25603
|
+
*/
|
|
25604
|
+
|
|
24961
25605
|
return NavigatedViewer;
|
|
24962
25606
|
|
|
24963
25607
|
}));
|