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
|
@@ -135250,9 +135250,9 @@
|
|
|
135250
135250
|
target[property] = [];
|
|
135251
135251
|
}
|
|
135252
135252
|
|
|
135253
|
-
const
|
|
135253
|
+
const propertiesToAdd = source[property].filter(o => !target[property].includes(o));
|
|
135254
135254
|
|
|
135255
|
-
target[property].push(...
|
|
135255
|
+
target[property].push(...propertiesToAdd);
|
|
135256
135256
|
}
|
|
135257
135257
|
|
|
135258
135258
|
function mergeEntries(target, source, visited = []) {
|
|
@@ -157448,99 +157448,102 @@
|
|
|
157448
157448
|
return true;
|
|
157449
157449
|
};
|
|
157450
157450
|
|
|
157451
|
-
const appendIcon = `<svg width="22" height="22" viewBox="0 0 5.82 5.82" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
157452
|
-
<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"/>
|
|
157453
|
-
</svg>`;
|
|
157454
|
-
const createIcon = `<svg width="46" height="46" viewBox="-2 -2 9.82 9.82" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
157455
|
-
<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"/>
|
|
157451
|
+
const appendIcon = `<svg width="22" height="22" viewBox="0 0 5.82 5.82" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
157452
|
+
<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"/>
|
|
157453
|
+
</svg>`;
|
|
157454
|
+
const createIcon = `<svg width="46" height="46" viewBox="-2 -2 9.82 9.82" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
157455
|
+
<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"/>
|
|
157456
157456
|
</svg>`;
|
|
157457
157457
|
|
|
157458
|
-
/**
|
|
157459
|
-
* A provider for append context pad button
|
|
157460
|
-
*/
|
|
157461
|
-
function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
|
|
157462
|
-
|
|
157463
|
-
this._contextPad = contextPad;
|
|
157464
|
-
this._popupMenu = popupMenu;
|
|
157465
|
-
this._translate = translate;
|
|
157466
|
-
this._canvas = canvas;
|
|
157467
|
-
|
|
157468
|
-
|
|
157469
|
-
|
|
157470
|
-
|
|
157471
|
-
|
|
157472
|
-
|
|
157473
|
-
'
|
|
157474
|
-
'
|
|
157475
|
-
'
|
|
157476
|
-
|
|
157477
|
-
|
|
157478
|
-
|
|
157479
|
-
|
|
157480
|
-
|
|
157481
|
-
|
|
157482
|
-
|
|
157483
|
-
|
|
157484
|
-
|
|
157485
|
-
|
|
157486
|
-
|
|
157487
|
-
|
|
157488
|
-
*
|
|
157489
|
-
*
|
|
157490
|
-
|
|
157491
|
-
|
|
157492
|
-
|
|
157493
|
-
|
|
157494
|
-
const
|
|
157495
|
-
|
|
157496
|
-
|
|
157497
|
-
|
|
157498
|
-
|
|
157499
|
-
|
|
157500
|
-
|
|
157501
|
-
|
|
157502
|
-
|
|
157503
|
-
|
|
157504
|
-
|
|
157505
|
-
|
|
157506
|
-
|
|
157507
|
-
|
|
157508
|
-
|
|
157509
|
-
|
|
157510
|
-
|
|
157511
|
-
|
|
157512
|
-
|
|
157513
|
-
|
|
157514
|
-
|
|
157515
|
-
|
|
157516
|
-
|
|
157517
|
-
|
|
157518
|
-
|
|
157519
|
-
|
|
157520
|
-
|
|
157521
|
-
|
|
157522
|
-
|
|
157523
|
-
|
|
157524
|
-
|
|
157525
|
-
|
|
157526
|
-
|
|
157527
|
-
*
|
|
157528
|
-
|
|
157529
|
-
|
|
157530
|
-
|
|
157531
|
-
|
|
157532
|
-
|
|
157533
|
-
|
|
157534
|
-
|
|
157535
|
-
|
|
157536
|
-
|
|
157537
|
-
|
|
157538
|
-
|
|
157539
|
-
|
|
157540
|
-
|
|
157541
|
-
|
|
157542
|
-
|
|
157543
|
-
|
|
157458
|
+
/**
|
|
157459
|
+
* A provider for append context pad button
|
|
157460
|
+
*/
|
|
157461
|
+
function AppendContextPadProvider(contextPad, popupMenu, translate, canvas, rules) {
|
|
157462
|
+
|
|
157463
|
+
this._contextPad = contextPad;
|
|
157464
|
+
this._popupMenu = popupMenu;
|
|
157465
|
+
this._translate = translate;
|
|
157466
|
+
this._canvas = canvas;
|
|
157467
|
+
this._rules = rules;
|
|
157468
|
+
|
|
157469
|
+
this.register();
|
|
157470
|
+
}
|
|
157471
|
+
|
|
157472
|
+
AppendContextPadProvider.$inject = [
|
|
157473
|
+
'contextPad',
|
|
157474
|
+
'popupMenu',
|
|
157475
|
+
'translate',
|
|
157476
|
+
'canvas',
|
|
157477
|
+
'rules'
|
|
157478
|
+
];
|
|
157479
|
+
|
|
157480
|
+
/**
|
|
157481
|
+
* Register append button provider in the context pad
|
|
157482
|
+
*/
|
|
157483
|
+
AppendContextPadProvider.prototype.register = function() {
|
|
157484
|
+
this._contextPad.registerProvider(this);
|
|
157485
|
+
};
|
|
157486
|
+
|
|
157487
|
+
/**
|
|
157488
|
+
* Gets the append context pad entry
|
|
157489
|
+
*
|
|
157490
|
+
* @param {djs.model.Base} element
|
|
157491
|
+
* @returns {Object} entries
|
|
157492
|
+
*/
|
|
157493
|
+
AppendContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
157494
|
+
const popupMenu = this._popupMenu;
|
|
157495
|
+
const translate = this._translate;
|
|
157496
|
+
const rules = this._rules;
|
|
157497
|
+
const getAppendMenuPosition = this._getAppendMenuPosition.bind(this);
|
|
157498
|
+
|
|
157499
|
+
if (rules.allowed('shape.append', { element })) {
|
|
157500
|
+
|
|
157501
|
+
// append menu entry
|
|
157502
|
+
return {
|
|
157503
|
+
'append': {
|
|
157504
|
+
group: 'model',
|
|
157505
|
+
html: `<div class="entry">${appendIcon}</div>`,
|
|
157506
|
+
title: translate('Append element'),
|
|
157507
|
+
action: {
|
|
157508
|
+
click: function(event, element) {
|
|
157509
|
+
|
|
157510
|
+
const position = assign(getAppendMenuPosition(element), {
|
|
157511
|
+
cursor: { x: event.x, y: event.y }
|
|
157512
|
+
});
|
|
157513
|
+
|
|
157514
|
+
popupMenu.open(element, 'bpmn-append', position, {
|
|
157515
|
+
title: translate('Append element'),
|
|
157516
|
+
width: 300,
|
|
157517
|
+
search: true
|
|
157518
|
+
});
|
|
157519
|
+
}
|
|
157520
|
+
}
|
|
157521
|
+
}
|
|
157522
|
+
};
|
|
157523
|
+
}
|
|
157524
|
+
};
|
|
157525
|
+
|
|
157526
|
+
/**
|
|
157527
|
+
* Calculates the position for the append menu relatively to the element
|
|
157528
|
+
*
|
|
157529
|
+
* @param {djs.model.Base} element
|
|
157530
|
+
* @returns {Object}
|
|
157531
|
+
*/
|
|
157532
|
+
AppendContextPadProvider.prototype._getAppendMenuPosition = function(element) {
|
|
157533
|
+
const contextPad = this._contextPad;
|
|
157534
|
+
|
|
157535
|
+
const X_OFFSET = 5;
|
|
157536
|
+
|
|
157537
|
+
const pad = contextPad.getPad(element).html;
|
|
157538
|
+
|
|
157539
|
+
const padRect = pad.getBoundingClientRect();
|
|
157540
|
+
|
|
157541
|
+
const pos = {
|
|
157542
|
+
x: padRect.right + X_OFFSET,
|
|
157543
|
+
y: padRect.top
|
|
157544
|
+
};
|
|
157545
|
+
|
|
157546
|
+
return pos;
|
|
157544
157547
|
};
|
|
157545
157548
|
|
|
157546
157549
|
function e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}));}
|
|
@@ -158153,87 +158156,87 @@
|
|
|
158153
158156
|
return el.querySelector(selector);
|
|
158154
158157
|
}
|
|
158155
158158
|
|
|
158156
|
-
const LOWER_PRIORITY = 900;
|
|
158157
|
-
|
|
158158
|
-
/**
|
|
158159
|
-
* A palette provider for the create elements menu.
|
|
158160
|
-
*/
|
|
158161
|
-
function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
|
|
158162
|
-
|
|
158163
|
-
this._palette = palette;
|
|
158164
|
-
this._translate = translate;
|
|
158165
|
-
this._popupMenu = popupMenu;
|
|
158166
|
-
this._canvas = canvas;
|
|
158167
|
-
this._mouse = mouse;
|
|
158168
|
-
|
|
158169
|
-
this.register();
|
|
158170
|
-
}
|
|
158171
|
-
|
|
158172
|
-
CreatePaletteProvider.$inject = [
|
|
158173
|
-
'palette',
|
|
158174
|
-
'translate',
|
|
158175
|
-
'popupMenu',
|
|
158176
|
-
'canvas',
|
|
158177
|
-
'mouse'
|
|
158178
|
-
];
|
|
158179
|
-
|
|
158180
|
-
/**
|
|
158181
|
-
* Register create button provider in the palette
|
|
158182
|
-
*/
|
|
158183
|
-
CreatePaletteProvider.prototype.register = function() {
|
|
158184
|
-
this._palette.registerProvider(LOWER_PRIORITY, this);
|
|
158185
|
-
};
|
|
158186
|
-
|
|
158187
|
-
/**
|
|
158188
|
-
* Gets the palette create entry
|
|
158189
|
-
*
|
|
158190
|
-
* @param {djs.model.Base} element
|
|
158191
|
-
* @returns {Object}
|
|
158192
|
-
*/
|
|
158193
|
-
CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
|
|
158194
|
-
const translate = this._translate,
|
|
158195
|
-
popupMenu = this._popupMenu,
|
|
158196
|
-
canvas = this._canvas,
|
|
158197
|
-
mouse = this._mouse;
|
|
158198
|
-
|
|
158199
|
-
const getPosition = (event) => {
|
|
158200
|
-
const X_OFFSET = 35;
|
|
158201
|
-
const Y_OFFSET = 10;
|
|
158202
|
-
|
|
158203
|
-
if (event instanceof KeyboardEvent) {
|
|
158204
|
-
event = mouse.getLastMoveEvent();
|
|
158205
|
-
return { x: event.x, y: event.y };
|
|
158206
|
-
}
|
|
158207
|
-
|
|
158208
|
-
const target = event && event.target || query('.djs-palette [data-action="create"]');
|
|
158209
|
-
const targetPosition = target.getBoundingClientRect();
|
|
158210
|
-
|
|
158211
|
-
return target && {
|
|
158212
|
-
x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
|
|
158213
|
-
y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
|
|
158214
|
-
};
|
|
158215
|
-
};
|
|
158216
|
-
|
|
158217
|
-
return {
|
|
158218
|
-
'create': {
|
|
158219
|
-
group: 'create',
|
|
158220
|
-
html: `<div class="entry"> ${createIcon}</div>`,
|
|
158221
|
-
title: translate('Create element'),
|
|
158222
|
-
action: {
|
|
158223
|
-
click: function(event) {
|
|
158224
|
-
const position = getPosition(event);
|
|
158225
|
-
|
|
158226
|
-
const element = canvas.getRootElement();
|
|
158227
|
-
|
|
158228
|
-
popupMenu.open(element, 'bpmn-create', position, {
|
|
158229
|
-
title: translate('Create element'),
|
|
158230
|
-
width: 300,
|
|
158231
|
-
search: true
|
|
158232
|
-
});
|
|
158233
|
-
}
|
|
158234
|
-
}
|
|
158235
|
-
}
|
|
158236
|
-
};
|
|
158159
|
+
const LOWER_PRIORITY = 900;
|
|
158160
|
+
|
|
158161
|
+
/**
|
|
158162
|
+
* A palette provider for the create elements menu.
|
|
158163
|
+
*/
|
|
158164
|
+
function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
|
|
158165
|
+
|
|
158166
|
+
this._palette = palette;
|
|
158167
|
+
this._translate = translate;
|
|
158168
|
+
this._popupMenu = popupMenu;
|
|
158169
|
+
this._canvas = canvas;
|
|
158170
|
+
this._mouse = mouse;
|
|
158171
|
+
|
|
158172
|
+
this.register();
|
|
158173
|
+
}
|
|
158174
|
+
|
|
158175
|
+
CreatePaletteProvider.$inject = [
|
|
158176
|
+
'palette',
|
|
158177
|
+
'translate',
|
|
158178
|
+
'popupMenu',
|
|
158179
|
+
'canvas',
|
|
158180
|
+
'mouse'
|
|
158181
|
+
];
|
|
158182
|
+
|
|
158183
|
+
/**
|
|
158184
|
+
* Register create button provider in the palette
|
|
158185
|
+
*/
|
|
158186
|
+
CreatePaletteProvider.prototype.register = function() {
|
|
158187
|
+
this._palette.registerProvider(LOWER_PRIORITY, this);
|
|
158188
|
+
};
|
|
158189
|
+
|
|
158190
|
+
/**
|
|
158191
|
+
* Gets the palette create entry
|
|
158192
|
+
*
|
|
158193
|
+
* @param {djs.model.Base} element
|
|
158194
|
+
* @returns {Object}
|
|
158195
|
+
*/
|
|
158196
|
+
CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
|
|
158197
|
+
const translate = this._translate,
|
|
158198
|
+
popupMenu = this._popupMenu,
|
|
158199
|
+
canvas = this._canvas,
|
|
158200
|
+
mouse = this._mouse;
|
|
158201
|
+
|
|
158202
|
+
const getPosition = (event) => {
|
|
158203
|
+
const X_OFFSET = 35;
|
|
158204
|
+
const Y_OFFSET = 10;
|
|
158205
|
+
|
|
158206
|
+
if (event instanceof KeyboardEvent) {
|
|
158207
|
+
event = mouse.getLastMoveEvent();
|
|
158208
|
+
return { x: event.x, y: event.y };
|
|
158209
|
+
}
|
|
158210
|
+
|
|
158211
|
+
const target = event && event.target || query('.djs-palette [data-action="create"]');
|
|
158212
|
+
const targetPosition = target.getBoundingClientRect();
|
|
158213
|
+
|
|
158214
|
+
return target && {
|
|
158215
|
+
x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
|
|
158216
|
+
y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
|
|
158217
|
+
};
|
|
158218
|
+
};
|
|
158219
|
+
|
|
158220
|
+
return {
|
|
158221
|
+
'create': {
|
|
158222
|
+
group: 'create',
|
|
158223
|
+
html: `<div class="entry"> ${createIcon}</div>`,
|
|
158224
|
+
title: translate('Create element'),
|
|
158225
|
+
action: {
|
|
158226
|
+
click: function(event) {
|
|
158227
|
+
const position = getPosition(event);
|
|
158228
|
+
|
|
158229
|
+
const element = canvas.getRootElement();
|
|
158230
|
+
|
|
158231
|
+
popupMenu.open(element, 'bpmn-create', position, {
|
|
158232
|
+
title: translate('Create element'),
|
|
158233
|
+
width: 300,
|
|
158234
|
+
search: true
|
|
158235
|
+
});
|
|
158236
|
+
}
|
|
158237
|
+
}
|
|
158238
|
+
}
|
|
158239
|
+
};
|
|
158237
158240
|
};
|
|
158238
158241
|
|
|
158239
158242
|
var CreateMenuModule = {
|
|
@@ -160079,248 +160082,248 @@
|
|
|
160079
160082
|
return ALL_OPTIONS;
|
|
160080
160083
|
}
|
|
160081
160084
|
|
|
160082
|
-
/**
|
|
160083
|
-
* A replace menu provider that allows to replace elements with
|
|
160084
|
-
* templates applied with the correspondent plain element.
|
|
160085
|
-
*/
|
|
160086
|
-
function RemoveTemplateReplaceProvider(popupMenu, translate, elementTemplates) {
|
|
160087
|
-
|
|
160088
|
-
this._popupMenu = popupMenu;
|
|
160089
|
-
this._translate = translate;
|
|
160090
|
-
this._elementTemplates = elementTemplates;
|
|
160091
|
-
|
|
160092
|
-
this.register();
|
|
160093
|
-
}
|
|
160094
|
-
|
|
160095
|
-
RemoveTemplateReplaceProvider.$inject = [
|
|
160096
|
-
'popupMenu',
|
|
160097
|
-
'translate',
|
|
160098
|
-
'elementTemplates'
|
|
160099
|
-
];
|
|
160100
|
-
|
|
160101
|
-
/**
|
|
160102
|
-
* Register replace menu provider in the popup menu
|
|
160103
|
-
*/
|
|
160104
|
-
RemoveTemplateReplaceProvider.prototype.register = function() {
|
|
160105
|
-
this._popupMenu.registerProvider('bpmn-replace', this);
|
|
160106
|
-
};
|
|
160107
|
-
|
|
160108
|
-
/**
|
|
160109
|
-
* Adds the element templates to the replace menu.
|
|
160110
|
-
* @param {djs.model.Base} element
|
|
160111
|
-
*
|
|
160112
|
-
* @returns {Object}
|
|
160113
|
-
*/
|
|
160114
|
-
RemoveTemplateReplaceProvider.prototype.getPopupMenuEntries = function(element) {
|
|
160115
|
-
|
|
160116
|
-
return (entries) => {
|
|
160117
|
-
|
|
160118
|
-
// convert our entries into something sortable
|
|
160119
|
-
let entrySet = Object.entries(entries);
|
|
160120
|
-
|
|
160121
|
-
if (this._elementTemplates && this._elementTemplates.get(element)) {
|
|
160122
|
-
|
|
160123
|
-
// add remove template option
|
|
160124
|
-
this.addPlainElementEntry(element, entrySet, this._translate, this._elementTemplates);
|
|
160125
|
-
}
|
|
160126
|
-
|
|
160127
|
-
// convert back to object
|
|
160128
|
-
return entrySet.reduce((entries, [ key, value ]) => {
|
|
160129
|
-
entries[key] = value;
|
|
160130
|
-
|
|
160131
|
-
return entries;
|
|
160132
|
-
}, {});
|
|
160133
|
-
};
|
|
160134
|
-
};
|
|
160135
|
-
|
|
160136
|
-
|
|
160137
|
-
/**
|
|
160138
|
-
* Adds the option to replace with plain element (remove template).
|
|
160139
|
-
*
|
|
160140
|
-
* @param {djs.model.Base} element
|
|
160141
|
-
* @param {Array<Object>} entries
|
|
160142
|
-
*/
|
|
160143
|
-
RemoveTemplateReplaceProvider.prototype.addPlainElementEntry = function(element, entries, translate, elementTemplates) {
|
|
160144
|
-
|
|
160145
|
-
const replaceOption = this.getPlainEntry(element, entries, translate, elementTemplates);
|
|
160146
|
-
|
|
160147
|
-
if (!replaceOption) {
|
|
160148
|
-
return;
|
|
160149
|
-
}
|
|
160150
|
-
|
|
160151
|
-
const [
|
|
160152
|
-
insertIndex,
|
|
160153
|
-
entry
|
|
160154
|
-
] = replaceOption;
|
|
160155
|
-
|
|
160156
|
-
// insert remove entry
|
|
160157
|
-
entries.splice(insertIndex, 0, [ entry.id, entry ]);
|
|
160158
|
-
};
|
|
160159
|
-
|
|
160160
|
-
/**
|
|
160161
|
-
* Returns the option to replace with plain element and the index where it should be inserted.
|
|
160162
|
-
*
|
|
160163
|
-
* @param {djs.model.Base} element
|
|
160164
|
-
* @param {Array<Object>} entries
|
|
160165
|
-
*
|
|
160166
|
-
* @returns {Array<Object, number>}
|
|
160167
|
-
*/
|
|
160168
|
-
RemoveTemplateReplaceProvider.prototype.getPlainEntry = function(element, entries, translate, elementTemplates) {
|
|
160169
|
-
|
|
160170
|
-
const {
|
|
160171
|
-
options,
|
|
160172
|
-
option,
|
|
160173
|
-
optionIndex
|
|
160174
|
-
} = findReplaceOptions(element) || { };
|
|
160175
|
-
|
|
160176
|
-
if (!options) {
|
|
160177
|
-
return null;
|
|
160178
|
-
}
|
|
160179
|
-
|
|
160180
|
-
const entry = {
|
|
160181
|
-
id: 'replace-remove-element-template',
|
|
160182
|
-
action: () => {
|
|
160183
|
-
elementTemplates.removeTemplate(element);
|
|
160184
|
-
},
|
|
160185
|
-
label: translate(option.label),
|
|
160186
|
-
className: option.className
|
|
160187
|
-
};
|
|
160188
|
-
|
|
160189
|
-
// insert after previous option, if it exists
|
|
160190
|
-
const previousIndex = getOptionIndex(options, optionIndex - 1, entries);
|
|
160191
|
-
|
|
160192
|
-
if (previousIndex) {
|
|
160193
|
-
return [
|
|
160194
|
-
previousIndex + 1,
|
|
160195
|
-
entry
|
|
160196
|
-
];
|
|
160197
|
-
}
|
|
160198
|
-
|
|
160199
|
-
// insert before next option, if it exists
|
|
160200
|
-
const nextIndex = getOptionIndex(options, optionIndex + 1, entries);
|
|
160201
|
-
|
|
160202
|
-
if (nextIndex) {
|
|
160203
|
-
return [
|
|
160204
|
-
nextIndex,
|
|
160205
|
-
entry
|
|
160206
|
-
];
|
|
160207
|
-
}
|
|
160208
|
-
|
|
160209
|
-
// fallback to insert at start
|
|
160210
|
-
return [
|
|
160211
|
-
0,
|
|
160212
|
-
entry
|
|
160213
|
-
];
|
|
160214
|
-
};
|
|
160215
|
-
|
|
160216
|
-
|
|
160217
|
-
/**
|
|
160218
|
-
* @param {ModdleElement} element
|
|
160219
|
-
*
|
|
160220
|
-
* @return { { options: Array<any>, option: any, optionIndex: number } | null }
|
|
160221
|
-
*/
|
|
160222
|
-
function findReplaceOptions(element) {
|
|
160223
|
-
|
|
160224
|
-
const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
|
|
160225
|
-
|
|
160226
|
-
return getReplaceOptionGroups().reduce((result, options) => {
|
|
160227
|
-
|
|
160228
|
-
if (result) {
|
|
160229
|
-
return result;
|
|
160230
|
-
}
|
|
160231
|
-
|
|
160232
|
-
const optionIndex = options.findIndex(option => isSameType(element, option));
|
|
160233
|
-
|
|
160234
|
-
if (optionIndex === -1) {
|
|
160235
|
-
return;
|
|
160236
|
-
}
|
|
160237
|
-
|
|
160238
|
-
return {
|
|
160239
|
-
options,
|
|
160240
|
-
option: options[optionIndex],
|
|
160241
|
-
optionIndex
|
|
160242
|
-
};
|
|
160243
|
-
}, null);
|
|
160244
|
-
}
|
|
160245
|
-
|
|
160246
|
-
function getOptionIndex(options, index, entries) {
|
|
160247
|
-
const option = options[index];
|
|
160248
|
-
|
|
160249
|
-
if (!option) {
|
|
160250
|
-
return false;
|
|
160251
|
-
}
|
|
160252
|
-
|
|
160253
|
-
return entries.findIndex(
|
|
160254
|
-
([ key ]) => key === option.actionName
|
|
160255
|
-
);
|
|
160085
|
+
/**
|
|
160086
|
+
* A replace menu provider that allows to replace elements with
|
|
160087
|
+
* templates applied with the correspondent plain element.
|
|
160088
|
+
*/
|
|
160089
|
+
function RemoveTemplateReplaceProvider(popupMenu, translate, elementTemplates) {
|
|
160090
|
+
|
|
160091
|
+
this._popupMenu = popupMenu;
|
|
160092
|
+
this._translate = translate;
|
|
160093
|
+
this._elementTemplates = elementTemplates;
|
|
160094
|
+
|
|
160095
|
+
this.register();
|
|
160096
|
+
}
|
|
160097
|
+
|
|
160098
|
+
RemoveTemplateReplaceProvider.$inject = [
|
|
160099
|
+
'popupMenu',
|
|
160100
|
+
'translate',
|
|
160101
|
+
'elementTemplates'
|
|
160102
|
+
];
|
|
160103
|
+
|
|
160104
|
+
/**
|
|
160105
|
+
* Register replace menu provider in the popup menu
|
|
160106
|
+
*/
|
|
160107
|
+
RemoveTemplateReplaceProvider.prototype.register = function() {
|
|
160108
|
+
this._popupMenu.registerProvider('bpmn-replace', this);
|
|
160109
|
+
};
|
|
160110
|
+
|
|
160111
|
+
/**
|
|
160112
|
+
* Adds the element templates to the replace menu.
|
|
160113
|
+
* @param {djs.model.Base} element
|
|
160114
|
+
*
|
|
160115
|
+
* @returns {Object}
|
|
160116
|
+
*/
|
|
160117
|
+
RemoveTemplateReplaceProvider.prototype.getPopupMenuEntries = function(element) {
|
|
160118
|
+
|
|
160119
|
+
return (entries) => {
|
|
160120
|
+
|
|
160121
|
+
// convert our entries into something sortable
|
|
160122
|
+
let entrySet = Object.entries(entries);
|
|
160123
|
+
|
|
160124
|
+
if (this._elementTemplates && this._elementTemplates.get(element)) {
|
|
160125
|
+
|
|
160126
|
+
// add remove template option
|
|
160127
|
+
this.addPlainElementEntry(element, entrySet, this._translate, this._elementTemplates);
|
|
160128
|
+
}
|
|
160129
|
+
|
|
160130
|
+
// convert back to object
|
|
160131
|
+
return entrySet.reduce((entries, [ key, value ]) => {
|
|
160132
|
+
entries[key] = value;
|
|
160133
|
+
|
|
160134
|
+
return entries;
|
|
160135
|
+
}, {});
|
|
160136
|
+
};
|
|
160137
|
+
};
|
|
160138
|
+
|
|
160139
|
+
|
|
160140
|
+
/**
|
|
160141
|
+
* Adds the option to replace with plain element (remove template).
|
|
160142
|
+
*
|
|
160143
|
+
* @param {djs.model.Base} element
|
|
160144
|
+
* @param {Array<Object>} entries
|
|
160145
|
+
*/
|
|
160146
|
+
RemoveTemplateReplaceProvider.prototype.addPlainElementEntry = function(element, entries, translate, elementTemplates) {
|
|
160147
|
+
|
|
160148
|
+
const replaceOption = this.getPlainEntry(element, entries, translate, elementTemplates);
|
|
160149
|
+
|
|
160150
|
+
if (!replaceOption) {
|
|
160151
|
+
return;
|
|
160152
|
+
}
|
|
160153
|
+
|
|
160154
|
+
const [
|
|
160155
|
+
insertIndex,
|
|
160156
|
+
entry
|
|
160157
|
+
] = replaceOption;
|
|
160158
|
+
|
|
160159
|
+
// insert remove entry
|
|
160160
|
+
entries.splice(insertIndex, 0, [ entry.id, entry ]);
|
|
160161
|
+
};
|
|
160162
|
+
|
|
160163
|
+
/**
|
|
160164
|
+
* Returns the option to replace with plain element and the index where it should be inserted.
|
|
160165
|
+
*
|
|
160166
|
+
* @param {djs.model.Base} element
|
|
160167
|
+
* @param {Array<Object>} entries
|
|
160168
|
+
*
|
|
160169
|
+
* @returns {Array<Object, number>}
|
|
160170
|
+
*/
|
|
160171
|
+
RemoveTemplateReplaceProvider.prototype.getPlainEntry = function(element, entries, translate, elementTemplates) {
|
|
160172
|
+
|
|
160173
|
+
const {
|
|
160174
|
+
options,
|
|
160175
|
+
option,
|
|
160176
|
+
optionIndex
|
|
160177
|
+
} = findReplaceOptions(element) || { };
|
|
160178
|
+
|
|
160179
|
+
if (!options) {
|
|
160180
|
+
return null;
|
|
160181
|
+
}
|
|
160182
|
+
|
|
160183
|
+
const entry = {
|
|
160184
|
+
id: 'replace-remove-element-template',
|
|
160185
|
+
action: () => {
|
|
160186
|
+
elementTemplates.removeTemplate(element);
|
|
160187
|
+
},
|
|
160188
|
+
label: translate(option.label),
|
|
160189
|
+
className: option.className
|
|
160190
|
+
};
|
|
160191
|
+
|
|
160192
|
+
// insert after previous option, if it exists
|
|
160193
|
+
const previousIndex = getOptionIndex(options, optionIndex - 1, entries);
|
|
160194
|
+
|
|
160195
|
+
if (previousIndex) {
|
|
160196
|
+
return [
|
|
160197
|
+
previousIndex + 1,
|
|
160198
|
+
entry
|
|
160199
|
+
];
|
|
160200
|
+
}
|
|
160201
|
+
|
|
160202
|
+
// insert before next option, if it exists
|
|
160203
|
+
const nextIndex = getOptionIndex(options, optionIndex + 1, entries);
|
|
160204
|
+
|
|
160205
|
+
if (nextIndex) {
|
|
160206
|
+
return [
|
|
160207
|
+
nextIndex,
|
|
160208
|
+
entry
|
|
160209
|
+
];
|
|
160210
|
+
}
|
|
160211
|
+
|
|
160212
|
+
// fallback to insert at start
|
|
160213
|
+
return [
|
|
160214
|
+
0,
|
|
160215
|
+
entry
|
|
160216
|
+
];
|
|
160217
|
+
};
|
|
160218
|
+
|
|
160219
|
+
|
|
160220
|
+
/**
|
|
160221
|
+
* @param {ModdleElement} element
|
|
160222
|
+
*
|
|
160223
|
+
* @return { { options: Array<any>, option: any, optionIndex: number } | null }
|
|
160224
|
+
*/
|
|
160225
|
+
function findReplaceOptions(element) {
|
|
160226
|
+
|
|
160227
|
+
const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
|
|
160228
|
+
|
|
160229
|
+
return getReplaceOptionGroups().reduce((result, options) => {
|
|
160230
|
+
|
|
160231
|
+
if (result) {
|
|
160232
|
+
return result;
|
|
160233
|
+
}
|
|
160234
|
+
|
|
160235
|
+
const optionIndex = options.findIndex(option => isSameType(element, option));
|
|
160236
|
+
|
|
160237
|
+
if (optionIndex === -1) {
|
|
160238
|
+
return;
|
|
160239
|
+
}
|
|
160240
|
+
|
|
160241
|
+
return {
|
|
160242
|
+
options,
|
|
160243
|
+
option: options[optionIndex],
|
|
160244
|
+
optionIndex
|
|
160245
|
+
};
|
|
160246
|
+
}, null);
|
|
160247
|
+
}
|
|
160248
|
+
|
|
160249
|
+
function getOptionIndex(options, index, entries) {
|
|
160250
|
+
const option = options[index];
|
|
160251
|
+
|
|
160252
|
+
if (!option) {
|
|
160253
|
+
return false;
|
|
160254
|
+
}
|
|
160255
|
+
|
|
160256
|
+
return entries.findIndex(
|
|
160257
|
+
([ key ]) => key === option.actionName
|
|
160258
|
+
);
|
|
160256
160259
|
}
|
|
160257
160260
|
|
|
160258
|
-
var RemoveTemplatesModule = {
|
|
160259
|
-
__init__: [ 'removeTemplateReplaceProvider' ],
|
|
160260
|
-
removeTemplateReplaceProvider: [ 'type', RemoveTemplateReplaceProvider ]
|
|
160261
|
+
var RemoveTemplatesModule = {
|
|
160262
|
+
__init__: [ 'removeTemplateReplaceProvider' ],
|
|
160263
|
+
removeTemplateReplaceProvider: [ 'type', RemoveTemplateReplaceProvider ]
|
|
160261
160264
|
};
|
|
160262
160265
|
|
|
160263
|
-
var index = {
|
|
160264
|
-
__depends__: [
|
|
160265
|
-
AppendElementTemplatesModule,
|
|
160266
|
-
CreateElementTemplatesModule,
|
|
160267
|
-
ReplaceElementTemplatesModule,
|
|
160268
|
-
RemoveTemplatesModule
|
|
160269
|
-
]
|
|
160270
|
-
};
|
|
160271
|
-
|
|
160272
|
-
/**
|
|
160273
|
-
* @typedef {import('bpmn-js/lib/BaseViewer').BaseViewerOptions} BaseViewerOptions
|
|
160274
|
-
*/
|
|
160275
|
-
|
|
160276
|
-
/**
|
|
160277
|
-
* @param {BaseViewerOptions} options
|
|
160278
|
-
*/
|
|
160279
|
-
function Modeler(options = {}) {
|
|
160280
|
-
|
|
160281
|
-
options = {
|
|
160282
|
-
...options,
|
|
160283
|
-
moddleExtensions: {
|
|
160284
|
-
...commonModdleExtensions,
|
|
160285
|
-
...options.moddleExtensions
|
|
160286
|
-
},
|
|
160287
|
-
propertiesPanel: {
|
|
160288
|
-
tooltip: TooltipProvider$1,
|
|
160289
|
-
...options.propertiesPanel
|
|
160290
|
-
}
|
|
160291
|
-
};
|
|
160292
|
-
|
|
160293
|
-
this._addElementTemplateChooserModule(options);
|
|
160294
|
-
|
|
160295
|
-
Modeler$1.call(this, options);
|
|
160296
|
-
}
|
|
160297
|
-
|
|
160298
|
-
e$7(Modeler, Modeler$1);
|
|
160299
|
-
|
|
160300
|
-
Modeler.prototype._addElementTemplateChooserModule = function(options) {
|
|
160301
|
-
const { elementTemplateChooser } = options;
|
|
160302
|
-
|
|
160303
|
-
if (elementTemplateChooser !== false) {
|
|
160304
|
-
this._modules = [ ...this._modules, index$2 ];
|
|
160305
|
-
}
|
|
160266
|
+
var index = {
|
|
160267
|
+
__depends__: [
|
|
160268
|
+
AppendElementTemplatesModule,
|
|
160269
|
+
CreateElementTemplatesModule,
|
|
160270
|
+
ReplaceElementTemplatesModule,
|
|
160271
|
+
RemoveTemplatesModule
|
|
160272
|
+
]
|
|
160306
160273
|
};
|
|
160307
160274
|
|
|
160308
|
-
|
|
160309
|
-
|
|
160310
|
-
|
|
160311
|
-
|
|
160312
|
-
|
|
160313
|
-
|
|
160314
|
-
|
|
160315
|
-
|
|
160316
|
-
|
|
160317
|
-
|
|
160318
|
-
|
|
160319
|
-
|
|
160320
|
-
|
|
160321
|
-
|
|
160322
|
-
|
|
160323
|
-
|
|
160275
|
+
/**
|
|
160276
|
+
* @typedef {import('bpmn-js/lib/BaseViewer').BaseViewerOptions} BaseViewerOptions
|
|
160277
|
+
*/
|
|
160278
|
+
|
|
160279
|
+
/**
|
|
160280
|
+
* @param {BaseViewerOptions} options
|
|
160281
|
+
*/
|
|
160282
|
+
function Modeler(options = {}) {
|
|
160283
|
+
|
|
160284
|
+
options = {
|
|
160285
|
+
...options,
|
|
160286
|
+
moddleExtensions: {
|
|
160287
|
+
...commonModdleExtensions,
|
|
160288
|
+
...options.moddleExtensions
|
|
160289
|
+
},
|
|
160290
|
+
propertiesPanel: {
|
|
160291
|
+
tooltip: TooltipProvider$1,
|
|
160292
|
+
...options.propertiesPanel
|
|
160293
|
+
}
|
|
160294
|
+
};
|
|
160295
|
+
|
|
160296
|
+
this._addElementTemplateChooserModule(options);
|
|
160297
|
+
|
|
160298
|
+
Modeler$1.call(this, options);
|
|
160299
|
+
}
|
|
160300
|
+
|
|
160301
|
+
e$7(Modeler, Modeler$1);
|
|
160302
|
+
|
|
160303
|
+
Modeler.prototype._addElementTemplateChooserModule = function(options) {
|
|
160304
|
+
const { elementTemplateChooser } = options;
|
|
160305
|
+
|
|
160306
|
+
if (elementTemplateChooser !== false) {
|
|
160307
|
+
this._modules = [ ...this._modules, index$2 ];
|
|
160308
|
+
}
|
|
160309
|
+
};
|
|
160310
|
+
|
|
160311
|
+
Modeler.prototype._camundaCloudModules = [
|
|
160312
|
+
...commonModules,
|
|
160313
|
+
behaviorsModule,
|
|
160314
|
+
index$1$2,
|
|
160315
|
+
index$1$1,
|
|
160316
|
+
index$1,
|
|
160317
|
+
index,
|
|
160318
|
+
colorPickerModule,
|
|
160319
|
+
ZeebeVariableResolverModule,
|
|
160320
|
+
exampleDataPropertiesProviderModule,
|
|
160321
|
+
index$3
|
|
160322
|
+
];
|
|
160323
|
+
|
|
160324
|
+
Modeler.prototype._modules = [].concat(
|
|
160325
|
+
Modeler$1.prototype._modules,
|
|
160326
|
+
Modeler.prototype._camundaCloudModules
|
|
160324
160327
|
);
|
|
160325
160328
|
|
|
160326
160329
|
return Modeler;
|