camunda-bpmn-js 4.3.1 → 4.3.2
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/camunda-cloud-modeler.development.js +413 -410
- package/dist/camunda-cloud-modeler.production.min.js +2 -2
- package/dist/camunda-platform-modeler.development.js +393 -390
- package/dist/camunda-platform-modeler.production.min.js +1 -1
- package/lib/base/Modeler.d.ts +15 -15
- package/lib/base/NavigatedViewer.d.ts +2 -2
- package/lib/base/Viewer.d.ts +2 -2
- package/lib/camunda-cloud/ElementTemplatesValidator.d.ts +1 -1
- package/lib/camunda-cloud/Modeler.d.ts +3 -3
- package/lib/camunda-cloud/Modeler.js +84 -84
- package/lib/camunda-cloud/NavigatedViewer.d.ts +3 -3
- package/lib/camunda-cloud/Viewer.d.ts +3 -3
- package/lib/camunda-cloud/util/commonModules.d.ts +9 -9
- package/lib/camunda-platform/Modeler.d.ts +3 -3
- package/lib/camunda-platform/Modeler.js +68 -68
- package/lib/camunda-platform/NavigatedViewer.d.ts +5 -5
- package/lib/camunda-platform/Viewer.d.ts +5 -5
- package/lib/camunda-platform/util/commonModules.d.ts +9 -9
- package/lib/util/ExtensionElementsUtil.d.ts +24 -24
- package/package.json +140 -140
|
@@ -129747,9 +129747,9 @@
|
|
|
129747
129747
|
target[property] = [];
|
|
129748
129748
|
}
|
|
129749
129749
|
|
|
129750
|
-
const
|
|
129750
|
+
const propertiesToAdd = source[property].filter(o => !target[property].includes(o));
|
|
129751
129751
|
|
|
129752
|
-
target[property].push(...
|
|
129752
|
+
target[property].push(...propertiesToAdd);
|
|
129753
129753
|
}
|
|
129754
129754
|
|
|
129755
129755
|
function mergeEntries(target, source, visited = []) {
|
|
@@ -132216,99 +132216,102 @@
|
|
|
132216
132216
|
return true;
|
|
132217
132217
|
};
|
|
132218
132218
|
|
|
132219
|
-
const appendIcon = `<svg width="22" height="22" viewBox="0 0 5.82 5.82" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
132220
|
-
<path d="M1.3 3.4c.3 0 .5-.2.5-.5s-.2-.4-.5-.4c-.2 0-.4.1-.4.4 0 .3.2.5.4.5zM3 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5zM4.6 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5z"/>
|
|
132221
|
-
</svg>`;
|
|
132222
|
-
const createIcon = `<svg width="46" height="46" viewBox="-2 -2 9.82 9.82" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
132223
|
-
<path d="M1.3 3.4c.3 0 .5-.2.5-.5s-.2-.4-.5-.4c-.2 0-.4.1-.4.4 0 .3.2.5.4.5zM3 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5zM4.6 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5z"/>
|
|
132219
|
+
const appendIcon = `<svg width="22" height="22" viewBox="0 0 5.82 5.82" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
132220
|
+
<path d="M1.3 3.4c.3 0 .5-.2.5-.5s-.2-.4-.5-.4c-.2 0-.4.1-.4.4 0 .3.2.5.4.5zM3 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5zM4.6 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5z"/>
|
|
132221
|
+
</svg>`;
|
|
132222
|
+
const createIcon = `<svg width="46" height="46" viewBox="-2 -2 9.82 9.82" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
132223
|
+
<path d="M1.3 3.4c.3 0 .5-.2.5-.5s-.2-.4-.5-.4c-.2 0-.4.1-.4.4 0 .3.2.5.4.5zM3 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5zM4.6 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5z"/>
|
|
132224
132224
|
</svg>`;
|
|
132225
132225
|
|
|
132226
|
-
/**
|
|
132227
|
-
* A provider for append context pad button
|
|
132228
|
-
*/
|
|
132229
|
-
function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
|
|
132230
|
-
|
|
132231
|
-
this._contextPad = contextPad;
|
|
132232
|
-
this._popupMenu = popupMenu;
|
|
132233
|
-
this._translate = translate;
|
|
132234
|
-
this._canvas = canvas;
|
|
132235
|
-
|
|
132236
|
-
|
|
132237
|
-
|
|
132238
|
-
|
|
132239
|
-
|
|
132240
|
-
|
|
132241
|
-
'
|
|
132242
|
-
'
|
|
132243
|
-
'
|
|
132244
|
-
|
|
132245
|
-
|
|
132246
|
-
|
|
132247
|
-
|
|
132248
|
-
|
|
132249
|
-
|
|
132250
|
-
|
|
132251
|
-
|
|
132252
|
-
|
|
132253
|
-
|
|
132254
|
-
|
|
132255
|
-
|
|
132256
|
-
*
|
|
132257
|
-
*
|
|
132258
|
-
|
|
132259
|
-
|
|
132260
|
-
|
|
132261
|
-
|
|
132262
|
-
const
|
|
132263
|
-
|
|
132264
|
-
|
|
132265
|
-
|
|
132266
|
-
|
|
132267
|
-
|
|
132268
|
-
|
|
132269
|
-
|
|
132270
|
-
|
|
132271
|
-
|
|
132272
|
-
|
|
132273
|
-
|
|
132274
|
-
|
|
132275
|
-
|
|
132276
|
-
|
|
132277
|
-
|
|
132278
|
-
|
|
132279
|
-
|
|
132280
|
-
|
|
132281
|
-
|
|
132282
|
-
|
|
132283
|
-
|
|
132284
|
-
|
|
132285
|
-
|
|
132286
|
-
|
|
132287
|
-
|
|
132288
|
-
|
|
132289
|
-
|
|
132290
|
-
|
|
132291
|
-
|
|
132292
|
-
|
|
132293
|
-
|
|
132294
|
-
|
|
132295
|
-
*
|
|
132296
|
-
|
|
132297
|
-
|
|
132298
|
-
|
|
132299
|
-
|
|
132300
|
-
|
|
132301
|
-
|
|
132302
|
-
|
|
132303
|
-
|
|
132304
|
-
|
|
132305
|
-
|
|
132306
|
-
|
|
132307
|
-
|
|
132308
|
-
|
|
132309
|
-
|
|
132310
|
-
|
|
132311
|
-
|
|
132226
|
+
/**
|
|
132227
|
+
* A provider for append context pad button
|
|
132228
|
+
*/
|
|
132229
|
+
function AppendContextPadProvider(contextPad, popupMenu, translate, canvas, rules) {
|
|
132230
|
+
|
|
132231
|
+
this._contextPad = contextPad;
|
|
132232
|
+
this._popupMenu = popupMenu;
|
|
132233
|
+
this._translate = translate;
|
|
132234
|
+
this._canvas = canvas;
|
|
132235
|
+
this._rules = rules;
|
|
132236
|
+
|
|
132237
|
+
this.register();
|
|
132238
|
+
}
|
|
132239
|
+
|
|
132240
|
+
AppendContextPadProvider.$inject = [
|
|
132241
|
+
'contextPad',
|
|
132242
|
+
'popupMenu',
|
|
132243
|
+
'translate',
|
|
132244
|
+
'canvas',
|
|
132245
|
+
'rules'
|
|
132246
|
+
];
|
|
132247
|
+
|
|
132248
|
+
/**
|
|
132249
|
+
* Register append button provider in the context pad
|
|
132250
|
+
*/
|
|
132251
|
+
AppendContextPadProvider.prototype.register = function() {
|
|
132252
|
+
this._contextPad.registerProvider(this);
|
|
132253
|
+
};
|
|
132254
|
+
|
|
132255
|
+
/**
|
|
132256
|
+
* Gets the append context pad entry
|
|
132257
|
+
*
|
|
132258
|
+
* @param {djs.model.Base} element
|
|
132259
|
+
* @returns {Object} entries
|
|
132260
|
+
*/
|
|
132261
|
+
AppendContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
132262
|
+
const popupMenu = this._popupMenu;
|
|
132263
|
+
const translate = this._translate;
|
|
132264
|
+
const rules = this._rules;
|
|
132265
|
+
const getAppendMenuPosition = this._getAppendMenuPosition.bind(this);
|
|
132266
|
+
|
|
132267
|
+
if (rules.allowed('shape.append', { element })) {
|
|
132268
|
+
|
|
132269
|
+
// append menu entry
|
|
132270
|
+
return {
|
|
132271
|
+
'append': {
|
|
132272
|
+
group: 'model',
|
|
132273
|
+
html: `<div class="entry">${appendIcon}</div>`,
|
|
132274
|
+
title: translate('Append element'),
|
|
132275
|
+
action: {
|
|
132276
|
+
click: function(event, element) {
|
|
132277
|
+
|
|
132278
|
+
const position = assign(getAppendMenuPosition(element), {
|
|
132279
|
+
cursor: { x: event.x, y: event.y }
|
|
132280
|
+
});
|
|
132281
|
+
|
|
132282
|
+
popupMenu.open(element, 'bpmn-append', position, {
|
|
132283
|
+
title: translate('Append element'),
|
|
132284
|
+
width: 300,
|
|
132285
|
+
search: true
|
|
132286
|
+
});
|
|
132287
|
+
}
|
|
132288
|
+
}
|
|
132289
|
+
}
|
|
132290
|
+
};
|
|
132291
|
+
}
|
|
132292
|
+
};
|
|
132293
|
+
|
|
132294
|
+
/**
|
|
132295
|
+
* Calculates the position for the append menu relatively to the element
|
|
132296
|
+
*
|
|
132297
|
+
* @param {djs.model.Base} element
|
|
132298
|
+
* @returns {Object}
|
|
132299
|
+
*/
|
|
132300
|
+
AppendContextPadProvider.prototype._getAppendMenuPosition = function(element) {
|
|
132301
|
+
const contextPad = this._contextPad;
|
|
132302
|
+
|
|
132303
|
+
const X_OFFSET = 5;
|
|
132304
|
+
|
|
132305
|
+
const pad = contextPad.getPad(element).html;
|
|
132306
|
+
|
|
132307
|
+
const padRect = pad.getBoundingClientRect();
|
|
132308
|
+
|
|
132309
|
+
const pos = {
|
|
132310
|
+
x: padRect.right + X_OFFSET,
|
|
132311
|
+
y: padRect.top
|
|
132312
|
+
};
|
|
132313
|
+
|
|
132314
|
+
return pos;
|
|
132312
132315
|
};
|
|
132313
132316
|
|
|
132314
132317
|
function e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}));}
|
|
@@ -132921,87 +132924,87 @@
|
|
|
132921
132924
|
return el.querySelector(selector);
|
|
132922
132925
|
}
|
|
132923
132926
|
|
|
132924
|
-
const LOWER_PRIORITY = 900;
|
|
132925
|
-
|
|
132926
|
-
/**
|
|
132927
|
-
* A palette provider for the create elements menu.
|
|
132928
|
-
*/
|
|
132929
|
-
function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
|
|
132930
|
-
|
|
132931
|
-
this._palette = palette;
|
|
132932
|
-
this._translate = translate;
|
|
132933
|
-
this._popupMenu = popupMenu;
|
|
132934
|
-
this._canvas = canvas;
|
|
132935
|
-
this._mouse = mouse;
|
|
132936
|
-
|
|
132937
|
-
this.register();
|
|
132938
|
-
}
|
|
132939
|
-
|
|
132940
|
-
CreatePaletteProvider.$inject = [
|
|
132941
|
-
'palette',
|
|
132942
|
-
'translate',
|
|
132943
|
-
'popupMenu',
|
|
132944
|
-
'canvas',
|
|
132945
|
-
'mouse'
|
|
132946
|
-
];
|
|
132947
|
-
|
|
132948
|
-
/**
|
|
132949
|
-
* Register create button provider in the palette
|
|
132950
|
-
*/
|
|
132951
|
-
CreatePaletteProvider.prototype.register = function() {
|
|
132952
|
-
this._palette.registerProvider(LOWER_PRIORITY, this);
|
|
132953
|
-
};
|
|
132954
|
-
|
|
132955
|
-
/**
|
|
132956
|
-
* Gets the palette create entry
|
|
132957
|
-
*
|
|
132958
|
-
* @param {djs.model.Base} element
|
|
132959
|
-
* @returns {Object}
|
|
132960
|
-
*/
|
|
132961
|
-
CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
|
|
132962
|
-
const translate = this._translate,
|
|
132963
|
-
popupMenu = this._popupMenu,
|
|
132964
|
-
canvas = this._canvas,
|
|
132965
|
-
mouse = this._mouse;
|
|
132966
|
-
|
|
132967
|
-
const getPosition = (event) => {
|
|
132968
|
-
const X_OFFSET = 35;
|
|
132969
|
-
const Y_OFFSET = 10;
|
|
132970
|
-
|
|
132971
|
-
if (event instanceof KeyboardEvent) {
|
|
132972
|
-
event = mouse.getLastMoveEvent();
|
|
132973
|
-
return { x: event.x, y: event.y };
|
|
132974
|
-
}
|
|
132975
|
-
|
|
132976
|
-
const target = event && event.target || query('.djs-palette [data-action="create"]');
|
|
132977
|
-
const targetPosition = target.getBoundingClientRect();
|
|
132978
|
-
|
|
132979
|
-
return target && {
|
|
132980
|
-
x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
|
|
132981
|
-
y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
|
|
132982
|
-
};
|
|
132983
|
-
};
|
|
132984
|
-
|
|
132985
|
-
return {
|
|
132986
|
-
'create': {
|
|
132987
|
-
group: 'create',
|
|
132988
|
-
html: `<div class="entry"> ${createIcon}</div>`,
|
|
132989
|
-
title: translate('Create element'),
|
|
132990
|
-
action: {
|
|
132991
|
-
click: function(event) {
|
|
132992
|
-
const position = getPosition(event);
|
|
132993
|
-
|
|
132994
|
-
const element = canvas.getRootElement();
|
|
132995
|
-
|
|
132996
|
-
popupMenu.open(element, 'bpmn-create', position, {
|
|
132997
|
-
title: translate('Create element'),
|
|
132998
|
-
width: 300,
|
|
132999
|
-
search: true
|
|
133000
|
-
});
|
|
133001
|
-
}
|
|
133002
|
-
}
|
|
133003
|
-
}
|
|
133004
|
-
};
|
|
132927
|
+
const LOWER_PRIORITY = 900;
|
|
132928
|
+
|
|
132929
|
+
/**
|
|
132930
|
+
* A palette provider for the create elements menu.
|
|
132931
|
+
*/
|
|
132932
|
+
function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
|
|
132933
|
+
|
|
132934
|
+
this._palette = palette;
|
|
132935
|
+
this._translate = translate;
|
|
132936
|
+
this._popupMenu = popupMenu;
|
|
132937
|
+
this._canvas = canvas;
|
|
132938
|
+
this._mouse = mouse;
|
|
132939
|
+
|
|
132940
|
+
this.register();
|
|
132941
|
+
}
|
|
132942
|
+
|
|
132943
|
+
CreatePaletteProvider.$inject = [
|
|
132944
|
+
'palette',
|
|
132945
|
+
'translate',
|
|
132946
|
+
'popupMenu',
|
|
132947
|
+
'canvas',
|
|
132948
|
+
'mouse'
|
|
132949
|
+
];
|
|
132950
|
+
|
|
132951
|
+
/**
|
|
132952
|
+
* Register create button provider in the palette
|
|
132953
|
+
*/
|
|
132954
|
+
CreatePaletteProvider.prototype.register = function() {
|
|
132955
|
+
this._palette.registerProvider(LOWER_PRIORITY, this);
|
|
132956
|
+
};
|
|
132957
|
+
|
|
132958
|
+
/**
|
|
132959
|
+
* Gets the palette create entry
|
|
132960
|
+
*
|
|
132961
|
+
* @param {djs.model.Base} element
|
|
132962
|
+
* @returns {Object}
|
|
132963
|
+
*/
|
|
132964
|
+
CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
|
|
132965
|
+
const translate = this._translate,
|
|
132966
|
+
popupMenu = this._popupMenu,
|
|
132967
|
+
canvas = this._canvas,
|
|
132968
|
+
mouse = this._mouse;
|
|
132969
|
+
|
|
132970
|
+
const getPosition = (event) => {
|
|
132971
|
+
const X_OFFSET = 35;
|
|
132972
|
+
const Y_OFFSET = 10;
|
|
132973
|
+
|
|
132974
|
+
if (event instanceof KeyboardEvent) {
|
|
132975
|
+
event = mouse.getLastMoveEvent();
|
|
132976
|
+
return { x: event.x, y: event.y };
|
|
132977
|
+
}
|
|
132978
|
+
|
|
132979
|
+
const target = event && event.target || query('.djs-palette [data-action="create"]');
|
|
132980
|
+
const targetPosition = target.getBoundingClientRect();
|
|
132981
|
+
|
|
132982
|
+
return target && {
|
|
132983
|
+
x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
|
|
132984
|
+
y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
|
|
132985
|
+
};
|
|
132986
|
+
};
|
|
132987
|
+
|
|
132988
|
+
return {
|
|
132989
|
+
'create': {
|
|
132990
|
+
group: 'create',
|
|
132991
|
+
html: `<div class="entry"> ${createIcon}</div>`,
|
|
132992
|
+
title: translate('Create element'),
|
|
132993
|
+
action: {
|
|
132994
|
+
click: function(event) {
|
|
132995
|
+
const position = getPosition(event);
|
|
132996
|
+
|
|
132997
|
+
const element = canvas.getRootElement();
|
|
132998
|
+
|
|
132999
|
+
popupMenu.open(element, 'bpmn-create', position, {
|
|
133000
|
+
title: translate('Create element'),
|
|
133001
|
+
width: 300,
|
|
133002
|
+
search: true
|
|
133003
|
+
});
|
|
133004
|
+
}
|
|
133005
|
+
}
|
|
133006
|
+
}
|
|
133007
|
+
};
|
|
133005
133008
|
};
|
|
133006
133009
|
|
|
133007
133010
|
var CreateMenuModule = {
|
|
@@ -134444,226 +134447,226 @@
|
|
|
134444
134447
|
return ALL_OPTIONS;
|
|
134445
134448
|
}
|
|
134446
134449
|
|
|
134447
|
-
/**
|
|
134448
|
-
* A replace menu provider that allows to replace elements with
|
|
134449
|
-
* templates applied with the correspondent plain element.
|
|
134450
|
-
*/
|
|
134451
|
-
function RemoveTemplateReplaceProvider(popupMenu, translate, elementTemplates) {
|
|
134452
|
-
|
|
134453
|
-
this._popupMenu = popupMenu;
|
|
134454
|
-
this._translate = translate;
|
|
134455
|
-
this._elementTemplates = elementTemplates;
|
|
134456
|
-
|
|
134457
|
-
this.register();
|
|
134458
|
-
}
|
|
134459
|
-
|
|
134460
|
-
RemoveTemplateReplaceProvider.$inject = [
|
|
134461
|
-
'popupMenu',
|
|
134462
|
-
'translate',
|
|
134463
|
-
'elementTemplates'
|
|
134464
|
-
];
|
|
134465
|
-
|
|
134466
|
-
/**
|
|
134467
|
-
* Register replace menu provider in the popup menu
|
|
134468
|
-
*/
|
|
134469
|
-
RemoveTemplateReplaceProvider.prototype.register = function() {
|
|
134470
|
-
this._popupMenu.registerProvider('bpmn-replace', this);
|
|
134471
|
-
};
|
|
134472
|
-
|
|
134473
|
-
/**
|
|
134474
|
-
* Adds the element templates to the replace menu.
|
|
134475
|
-
* @param {djs.model.Base} element
|
|
134476
|
-
*
|
|
134477
|
-
* @returns {Object}
|
|
134478
|
-
*/
|
|
134479
|
-
RemoveTemplateReplaceProvider.prototype.getPopupMenuEntries = function(element) {
|
|
134480
|
-
|
|
134481
|
-
return (entries) => {
|
|
134482
|
-
|
|
134483
|
-
// convert our entries into something sortable
|
|
134484
|
-
let entrySet = Object.entries(entries);
|
|
134485
|
-
|
|
134486
|
-
if (this._elementTemplates && this._elementTemplates.get(element)) {
|
|
134487
|
-
|
|
134488
|
-
// add remove template option
|
|
134489
|
-
this.addPlainElementEntry(element, entrySet, this._translate, this._elementTemplates);
|
|
134490
|
-
}
|
|
134491
|
-
|
|
134492
|
-
// convert back to object
|
|
134493
|
-
return entrySet.reduce((entries, [ key, value ]) => {
|
|
134494
|
-
entries[key] = value;
|
|
134495
|
-
|
|
134496
|
-
return entries;
|
|
134497
|
-
}, {});
|
|
134498
|
-
};
|
|
134499
|
-
};
|
|
134500
|
-
|
|
134501
|
-
|
|
134502
|
-
/**
|
|
134503
|
-
* Adds the option to replace with plain element (remove template).
|
|
134504
|
-
*
|
|
134505
|
-
* @param {djs.model.Base} element
|
|
134506
|
-
* @param {Array<Object>} entries
|
|
134507
|
-
*/
|
|
134508
|
-
RemoveTemplateReplaceProvider.prototype.addPlainElementEntry = function(element, entries, translate, elementTemplates) {
|
|
134509
|
-
|
|
134510
|
-
const replaceOption = this.getPlainEntry(element, entries, translate, elementTemplates);
|
|
134511
|
-
|
|
134512
|
-
if (!replaceOption) {
|
|
134513
|
-
return;
|
|
134514
|
-
}
|
|
134515
|
-
|
|
134516
|
-
const [
|
|
134517
|
-
insertIndex,
|
|
134518
|
-
entry
|
|
134519
|
-
] = replaceOption;
|
|
134520
|
-
|
|
134521
|
-
// insert remove entry
|
|
134522
|
-
entries.splice(insertIndex, 0, [ entry.id, entry ]);
|
|
134523
|
-
};
|
|
134524
|
-
|
|
134525
|
-
/**
|
|
134526
|
-
* Returns the option to replace with plain element and the index where it should be inserted.
|
|
134527
|
-
*
|
|
134528
|
-
* @param {djs.model.Base} element
|
|
134529
|
-
* @param {Array<Object>} entries
|
|
134530
|
-
*
|
|
134531
|
-
* @returns {Array<Object, number>}
|
|
134532
|
-
*/
|
|
134533
|
-
RemoveTemplateReplaceProvider.prototype.getPlainEntry = function(element, entries, translate, elementTemplates) {
|
|
134534
|
-
|
|
134535
|
-
const {
|
|
134536
|
-
options,
|
|
134537
|
-
option,
|
|
134538
|
-
optionIndex
|
|
134539
|
-
} = findReplaceOptions(element) || { };
|
|
134540
|
-
|
|
134541
|
-
if (!options) {
|
|
134542
|
-
return null;
|
|
134543
|
-
}
|
|
134544
|
-
|
|
134545
|
-
const entry = {
|
|
134546
|
-
id: 'replace-remove-element-template',
|
|
134547
|
-
action: () => {
|
|
134548
|
-
elementTemplates.removeTemplate(element);
|
|
134549
|
-
},
|
|
134550
|
-
label: translate(option.label),
|
|
134551
|
-
className: option.className
|
|
134552
|
-
};
|
|
134553
|
-
|
|
134554
|
-
// insert after previous option, if it exists
|
|
134555
|
-
const previousIndex = getOptionIndex(options, optionIndex - 1, entries);
|
|
134556
|
-
|
|
134557
|
-
if (previousIndex) {
|
|
134558
|
-
return [
|
|
134559
|
-
previousIndex + 1,
|
|
134560
|
-
entry
|
|
134561
|
-
];
|
|
134562
|
-
}
|
|
134563
|
-
|
|
134564
|
-
// insert before next option, if it exists
|
|
134565
|
-
const nextIndex = getOptionIndex(options, optionIndex + 1, entries);
|
|
134566
|
-
|
|
134567
|
-
if (nextIndex) {
|
|
134568
|
-
return [
|
|
134569
|
-
nextIndex,
|
|
134570
|
-
entry
|
|
134571
|
-
];
|
|
134572
|
-
}
|
|
134573
|
-
|
|
134574
|
-
// fallback to insert at start
|
|
134575
|
-
return [
|
|
134576
|
-
0,
|
|
134577
|
-
entry
|
|
134578
|
-
];
|
|
134579
|
-
};
|
|
134580
|
-
|
|
134581
|
-
|
|
134582
|
-
/**
|
|
134583
|
-
* @param {ModdleElement} element
|
|
134584
|
-
*
|
|
134585
|
-
* @return { { options: Array<any>, option: any, optionIndex: number } | null }
|
|
134586
|
-
*/
|
|
134587
|
-
function findReplaceOptions(element) {
|
|
134588
|
-
|
|
134589
|
-
const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
|
|
134590
|
-
|
|
134591
|
-
return getReplaceOptionGroups().reduce((result, options) => {
|
|
134592
|
-
|
|
134593
|
-
if (result) {
|
|
134594
|
-
return result;
|
|
134595
|
-
}
|
|
134596
|
-
|
|
134597
|
-
const optionIndex = options.findIndex(option => isSameType(element, option));
|
|
134598
|
-
|
|
134599
|
-
if (optionIndex === -1) {
|
|
134600
|
-
return;
|
|
134601
|
-
}
|
|
134602
|
-
|
|
134603
|
-
return {
|
|
134604
|
-
options,
|
|
134605
|
-
option: options[optionIndex],
|
|
134606
|
-
optionIndex
|
|
134607
|
-
};
|
|
134608
|
-
}, null);
|
|
134609
|
-
}
|
|
134610
|
-
|
|
134611
|
-
function getOptionIndex(options, index, entries) {
|
|
134612
|
-
const option = options[index];
|
|
134613
|
-
|
|
134614
|
-
if (!option) {
|
|
134615
|
-
return false;
|
|
134616
|
-
}
|
|
134617
|
-
|
|
134618
|
-
return entries.findIndex(
|
|
134619
|
-
([ key ]) => key === option.actionName
|
|
134620
|
-
);
|
|
134450
|
+
/**
|
|
134451
|
+
* A replace menu provider that allows to replace elements with
|
|
134452
|
+
* templates applied with the correspondent plain element.
|
|
134453
|
+
*/
|
|
134454
|
+
function RemoveTemplateReplaceProvider(popupMenu, translate, elementTemplates) {
|
|
134455
|
+
|
|
134456
|
+
this._popupMenu = popupMenu;
|
|
134457
|
+
this._translate = translate;
|
|
134458
|
+
this._elementTemplates = elementTemplates;
|
|
134459
|
+
|
|
134460
|
+
this.register();
|
|
134461
|
+
}
|
|
134462
|
+
|
|
134463
|
+
RemoveTemplateReplaceProvider.$inject = [
|
|
134464
|
+
'popupMenu',
|
|
134465
|
+
'translate',
|
|
134466
|
+
'elementTemplates'
|
|
134467
|
+
];
|
|
134468
|
+
|
|
134469
|
+
/**
|
|
134470
|
+
* Register replace menu provider in the popup menu
|
|
134471
|
+
*/
|
|
134472
|
+
RemoveTemplateReplaceProvider.prototype.register = function() {
|
|
134473
|
+
this._popupMenu.registerProvider('bpmn-replace', this);
|
|
134474
|
+
};
|
|
134475
|
+
|
|
134476
|
+
/**
|
|
134477
|
+
* Adds the element templates to the replace menu.
|
|
134478
|
+
* @param {djs.model.Base} element
|
|
134479
|
+
*
|
|
134480
|
+
* @returns {Object}
|
|
134481
|
+
*/
|
|
134482
|
+
RemoveTemplateReplaceProvider.prototype.getPopupMenuEntries = function(element) {
|
|
134483
|
+
|
|
134484
|
+
return (entries) => {
|
|
134485
|
+
|
|
134486
|
+
// convert our entries into something sortable
|
|
134487
|
+
let entrySet = Object.entries(entries);
|
|
134488
|
+
|
|
134489
|
+
if (this._elementTemplates && this._elementTemplates.get(element)) {
|
|
134490
|
+
|
|
134491
|
+
// add remove template option
|
|
134492
|
+
this.addPlainElementEntry(element, entrySet, this._translate, this._elementTemplates);
|
|
134493
|
+
}
|
|
134494
|
+
|
|
134495
|
+
// convert back to object
|
|
134496
|
+
return entrySet.reduce((entries, [ key, value ]) => {
|
|
134497
|
+
entries[key] = value;
|
|
134498
|
+
|
|
134499
|
+
return entries;
|
|
134500
|
+
}, {});
|
|
134501
|
+
};
|
|
134502
|
+
};
|
|
134503
|
+
|
|
134504
|
+
|
|
134505
|
+
/**
|
|
134506
|
+
* Adds the option to replace with plain element (remove template).
|
|
134507
|
+
*
|
|
134508
|
+
* @param {djs.model.Base} element
|
|
134509
|
+
* @param {Array<Object>} entries
|
|
134510
|
+
*/
|
|
134511
|
+
RemoveTemplateReplaceProvider.prototype.addPlainElementEntry = function(element, entries, translate, elementTemplates) {
|
|
134512
|
+
|
|
134513
|
+
const replaceOption = this.getPlainEntry(element, entries, translate, elementTemplates);
|
|
134514
|
+
|
|
134515
|
+
if (!replaceOption) {
|
|
134516
|
+
return;
|
|
134517
|
+
}
|
|
134518
|
+
|
|
134519
|
+
const [
|
|
134520
|
+
insertIndex,
|
|
134521
|
+
entry
|
|
134522
|
+
] = replaceOption;
|
|
134523
|
+
|
|
134524
|
+
// insert remove entry
|
|
134525
|
+
entries.splice(insertIndex, 0, [ entry.id, entry ]);
|
|
134526
|
+
};
|
|
134527
|
+
|
|
134528
|
+
/**
|
|
134529
|
+
* Returns the option to replace with plain element and the index where it should be inserted.
|
|
134530
|
+
*
|
|
134531
|
+
* @param {djs.model.Base} element
|
|
134532
|
+
* @param {Array<Object>} entries
|
|
134533
|
+
*
|
|
134534
|
+
* @returns {Array<Object, number>}
|
|
134535
|
+
*/
|
|
134536
|
+
RemoveTemplateReplaceProvider.prototype.getPlainEntry = function(element, entries, translate, elementTemplates) {
|
|
134537
|
+
|
|
134538
|
+
const {
|
|
134539
|
+
options,
|
|
134540
|
+
option,
|
|
134541
|
+
optionIndex
|
|
134542
|
+
} = findReplaceOptions(element) || { };
|
|
134543
|
+
|
|
134544
|
+
if (!options) {
|
|
134545
|
+
return null;
|
|
134546
|
+
}
|
|
134547
|
+
|
|
134548
|
+
const entry = {
|
|
134549
|
+
id: 'replace-remove-element-template',
|
|
134550
|
+
action: () => {
|
|
134551
|
+
elementTemplates.removeTemplate(element);
|
|
134552
|
+
},
|
|
134553
|
+
label: translate(option.label),
|
|
134554
|
+
className: option.className
|
|
134555
|
+
};
|
|
134556
|
+
|
|
134557
|
+
// insert after previous option, if it exists
|
|
134558
|
+
const previousIndex = getOptionIndex(options, optionIndex - 1, entries);
|
|
134559
|
+
|
|
134560
|
+
if (previousIndex) {
|
|
134561
|
+
return [
|
|
134562
|
+
previousIndex + 1,
|
|
134563
|
+
entry
|
|
134564
|
+
];
|
|
134565
|
+
}
|
|
134566
|
+
|
|
134567
|
+
// insert before next option, if it exists
|
|
134568
|
+
const nextIndex = getOptionIndex(options, optionIndex + 1, entries);
|
|
134569
|
+
|
|
134570
|
+
if (nextIndex) {
|
|
134571
|
+
return [
|
|
134572
|
+
nextIndex,
|
|
134573
|
+
entry
|
|
134574
|
+
];
|
|
134575
|
+
}
|
|
134576
|
+
|
|
134577
|
+
// fallback to insert at start
|
|
134578
|
+
return [
|
|
134579
|
+
0,
|
|
134580
|
+
entry
|
|
134581
|
+
];
|
|
134582
|
+
};
|
|
134583
|
+
|
|
134584
|
+
|
|
134585
|
+
/**
|
|
134586
|
+
* @param {ModdleElement} element
|
|
134587
|
+
*
|
|
134588
|
+
* @return { { options: Array<any>, option: any, optionIndex: number } | null }
|
|
134589
|
+
*/
|
|
134590
|
+
function findReplaceOptions(element) {
|
|
134591
|
+
|
|
134592
|
+
const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
|
|
134593
|
+
|
|
134594
|
+
return getReplaceOptionGroups().reduce((result, options) => {
|
|
134595
|
+
|
|
134596
|
+
if (result) {
|
|
134597
|
+
return result;
|
|
134598
|
+
}
|
|
134599
|
+
|
|
134600
|
+
const optionIndex = options.findIndex(option => isSameType(element, option));
|
|
134601
|
+
|
|
134602
|
+
if (optionIndex === -1) {
|
|
134603
|
+
return;
|
|
134604
|
+
}
|
|
134605
|
+
|
|
134606
|
+
return {
|
|
134607
|
+
options,
|
|
134608
|
+
option: options[optionIndex],
|
|
134609
|
+
optionIndex
|
|
134610
|
+
};
|
|
134611
|
+
}, null);
|
|
134612
|
+
}
|
|
134613
|
+
|
|
134614
|
+
function getOptionIndex(options, index, entries) {
|
|
134615
|
+
const option = options[index];
|
|
134616
|
+
|
|
134617
|
+
if (!option) {
|
|
134618
|
+
return false;
|
|
134619
|
+
}
|
|
134620
|
+
|
|
134621
|
+
return entries.findIndex(
|
|
134622
|
+
([ key ]) => key === option.actionName
|
|
134623
|
+
);
|
|
134621
134624
|
}
|
|
134622
134625
|
|
|
134623
|
-
var RemoveTemplatesModule = {
|
|
134624
|
-
__init__: [ 'removeTemplateReplaceProvider' ],
|
|
134625
|
-
removeTemplateReplaceProvider: [ 'type', RemoveTemplateReplaceProvider ]
|
|
134626
|
+
var RemoveTemplatesModule = {
|
|
134627
|
+
__init__: [ 'removeTemplateReplaceProvider' ],
|
|
134628
|
+
removeTemplateReplaceProvider: [ 'type', RemoveTemplateReplaceProvider ]
|
|
134626
134629
|
};
|
|
134627
134630
|
|
|
134628
|
-
/**
|
|
134629
|
-
* @typedef {import('bpmn-js/lib/BaseViewer').BaseViewerOptions} BaseViewerOptions
|
|
134630
|
-
*/
|
|
134631
|
-
|
|
134632
|
-
/**
|
|
134633
|
-
* @param {BaseViewerOptions} options
|
|
134634
|
-
*/
|
|
134635
|
-
function Modeler(options = {}) {
|
|
134636
|
-
|
|
134637
|
-
options = {
|
|
134638
|
-
...options,
|
|
134639
|
-
moddleExtensions: {
|
|
134640
|
-
...commonModdleExtensions,
|
|
134641
|
-
...options.moddleExtensions
|
|
134642
|
-
},
|
|
134643
|
-
propertiesPanel: {
|
|
134644
|
-
tooltip: TooltipProvider,
|
|
134645
|
-
...options.propertiesPanel
|
|
134646
|
-
}
|
|
134647
|
-
};
|
|
134648
|
-
|
|
134649
|
-
Modeler$1.call(this, options);
|
|
134650
|
-
}
|
|
134651
|
-
|
|
134652
|
-
e$7(Modeler, Modeler$1);
|
|
134653
|
-
|
|
134654
|
-
Modeler.prototype._camundaPlatformModules = [
|
|
134655
|
-
behaviorsModule,
|
|
134656
|
-
index$4,
|
|
134657
|
-
index,
|
|
134658
|
-
colorPickerModule,
|
|
134659
|
-
index$1,
|
|
134660
|
-
CamundaVariableResolverModule,
|
|
134661
|
-
RemoveTemplatesModule
|
|
134662
|
-
];
|
|
134663
|
-
|
|
134664
|
-
Modeler.prototype._modules = [].concat(
|
|
134665
|
-
Modeler$1.prototype._modules,
|
|
134666
|
-
Modeler.prototype._camundaPlatformModules
|
|
134631
|
+
/**
|
|
134632
|
+
* @typedef {import('bpmn-js/lib/BaseViewer').BaseViewerOptions} BaseViewerOptions
|
|
134633
|
+
*/
|
|
134634
|
+
|
|
134635
|
+
/**
|
|
134636
|
+
* @param {BaseViewerOptions} options
|
|
134637
|
+
*/
|
|
134638
|
+
function Modeler(options = {}) {
|
|
134639
|
+
|
|
134640
|
+
options = {
|
|
134641
|
+
...options,
|
|
134642
|
+
moddleExtensions: {
|
|
134643
|
+
...commonModdleExtensions,
|
|
134644
|
+
...options.moddleExtensions
|
|
134645
|
+
},
|
|
134646
|
+
propertiesPanel: {
|
|
134647
|
+
tooltip: TooltipProvider,
|
|
134648
|
+
...options.propertiesPanel
|
|
134649
|
+
}
|
|
134650
|
+
};
|
|
134651
|
+
|
|
134652
|
+
Modeler$1.call(this, options);
|
|
134653
|
+
}
|
|
134654
|
+
|
|
134655
|
+
e$7(Modeler, Modeler$1);
|
|
134656
|
+
|
|
134657
|
+
Modeler.prototype._camundaPlatformModules = [
|
|
134658
|
+
behaviorsModule,
|
|
134659
|
+
index$4,
|
|
134660
|
+
index,
|
|
134661
|
+
colorPickerModule,
|
|
134662
|
+
index$1,
|
|
134663
|
+
CamundaVariableResolverModule,
|
|
134664
|
+
RemoveTemplatesModule
|
|
134665
|
+
];
|
|
134666
|
+
|
|
134667
|
+
Modeler.prototype._modules = [].concat(
|
|
134668
|
+
Modeler$1.prototype._modules,
|
|
134669
|
+
Modeler.prototype._camundaPlatformModules
|
|
134667
134670
|
);
|
|
134668
134671
|
|
|
134669
134672
|
return Modeler;
|