camunda-bpmn-js 2.0.2 → 2.1.1
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 +14001 -10194
- package/dist/base-modeler.production.min.js +41 -38
- package/dist/base-navigated-viewer.development.js +161 -121
- package/dist/base-navigated-viewer.production.min.js +1 -1
- package/dist/base-viewer.development.js +155 -119
- package/dist/base-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-modeler.development.js +45602 -38158
- package/dist/camunda-cloud-modeler.production.min.js +35 -32
- package/dist/camunda-cloud-navigated-viewer.development.js +191 -141
- package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-viewer.development.js +185 -139
- package/dist/camunda-cloud-viewer.production.min.js +1 -1
- package/dist/camunda-platform-modeler.development.js +52130 -46628
- package/dist/camunda-platform-modeler.production.min.js +35 -32
- package/dist/camunda-platform-navigated-viewer.development.js +161 -121
- package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-platform-viewer.development.js +155 -119
- package/dist/camunda-platform-viewer.production.min.js +1 -1
- package/lib/base/Modeler.js +13 -8
- package/lib/camunda-cloud/Modeler.js +9 -7
- package/lib/camunda-platform/Modeler.js +8 -3
- package/package.json +17 -15
- package/lib/camunda-cloud/features/create-append-anything/ElementTemplatesAppendProvider.js +0 -162
- package/lib/camunda-cloud/features/create-append-anything/ElementTemplatesCreateProvider.js +0 -114
- package/lib/camunda-cloud/features/create-append-anything/index.js +0 -11
- package/lib/camunda-cloud/features/replace/ElementTemplatesReplaceProvider.js +0 -118
- package/lib/camunda-cloud/features/replace/index.js +0 -6
- package/lib/shared/features/replace/UnlinkTemplateReplaceProvider.js +0 -178
- package/lib/shared/features/replace/index.js +0 -8
- package/lib/shared/features/replace/util/ReplaceOptionsUtil.js +0 -7
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { isDifferentType } from 'bpmn-js/lib/features/popup-menu/util/TypeUtil';
|
|
2
|
-
import { getReplaceOptionGroups } from './util/ReplaceOptionsUtil';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A replace menu provider that allows to replace elements with
|
|
6
|
-
* templates applied with the correspondent plain element.
|
|
7
|
-
*/
|
|
8
|
-
export default function UnlinkTemplateReplaceProvider(popupMenu, translate, elementTemplates) {
|
|
9
|
-
|
|
10
|
-
this._popupMenu = popupMenu;
|
|
11
|
-
this._translate = translate;
|
|
12
|
-
this._elementTemplates = elementTemplates;
|
|
13
|
-
|
|
14
|
-
this.register();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
UnlinkTemplateReplaceProvider.$inject = [
|
|
18
|
-
'popupMenu',
|
|
19
|
-
'translate',
|
|
20
|
-
'elementTemplates'
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Register replace menu provider in the popup menu
|
|
25
|
-
*/
|
|
26
|
-
UnlinkTemplateReplaceProvider.prototype.register = function() {
|
|
27
|
-
this._popupMenu.registerProvider('bpmn-replace', this);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Adds the element templates to the replace menu.
|
|
32
|
-
* @param {djs.model.Base} element
|
|
33
|
-
*
|
|
34
|
-
* @returns {Object}
|
|
35
|
-
*/
|
|
36
|
-
UnlinkTemplateReplaceProvider.prototype.getPopupMenuEntries = function(element) {
|
|
37
|
-
|
|
38
|
-
return (entries) => {
|
|
39
|
-
|
|
40
|
-
// convert our entries into something sortable
|
|
41
|
-
let entrySet = Object.entries(entries);
|
|
42
|
-
|
|
43
|
-
if (this._elementTemplates.get(element)) {
|
|
44
|
-
|
|
45
|
-
// add unlink template option
|
|
46
|
-
this.addPlainElementEntry(element, entrySet, this._translate, this._elementTemplates);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// convert back to object
|
|
50
|
-
return entrySet.reduce((entries, [ key, value ]) => {
|
|
51
|
-
entries[key] = value;
|
|
52
|
-
|
|
53
|
-
return entries;
|
|
54
|
-
}, {});
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Adds the option to replace with plain element (unlink template).
|
|
61
|
-
*
|
|
62
|
-
* @param {djs.model.Base} element
|
|
63
|
-
* @param {Array<Object>} entries
|
|
64
|
-
*/
|
|
65
|
-
UnlinkTemplateReplaceProvider.prototype.addPlainElementEntry = function(element, entries, translate, elementTemplates) {
|
|
66
|
-
|
|
67
|
-
const replaceOption = this.getPlainEntry(element, entries, translate, elementTemplates);
|
|
68
|
-
|
|
69
|
-
if (!replaceOption) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const [
|
|
74
|
-
insertIndex,
|
|
75
|
-
entry
|
|
76
|
-
] = replaceOption;
|
|
77
|
-
|
|
78
|
-
// insert unlink entry
|
|
79
|
-
entries.splice(insertIndex, 0, [ entry.id, entry ]);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Returns the option to replace with plain element and the index where it should be inserted.
|
|
84
|
-
*
|
|
85
|
-
* @param {djs.model.Base} element
|
|
86
|
-
* @param {Array<Object>} entries
|
|
87
|
-
*
|
|
88
|
-
* @returns {Array<Object, number>}
|
|
89
|
-
*/
|
|
90
|
-
UnlinkTemplateReplaceProvider.prototype.getPlainEntry = function(element, entries, translate, elementTemplates) {
|
|
91
|
-
|
|
92
|
-
const {
|
|
93
|
-
options,
|
|
94
|
-
option,
|
|
95
|
-
optionIndex
|
|
96
|
-
} = findReplaceOptions(element) || { };
|
|
97
|
-
|
|
98
|
-
if (!options) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const entry = {
|
|
103
|
-
id: 'replace-unlink-element-template',
|
|
104
|
-
action: () => {
|
|
105
|
-
elementTemplates.applyTemplate(element, null);
|
|
106
|
-
},
|
|
107
|
-
label: translate(option.label),
|
|
108
|
-
className: option.className
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// insert after previous option, if it exists
|
|
112
|
-
const previousIndex = getOptionIndex(options, optionIndex - 1, entries);
|
|
113
|
-
|
|
114
|
-
if (previousIndex) {
|
|
115
|
-
return [
|
|
116
|
-
previousIndex + 1,
|
|
117
|
-
entry
|
|
118
|
-
];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// insert before next option, if it exists
|
|
122
|
-
const nextIndex = getOptionIndex(options, optionIndex + 1, entries);
|
|
123
|
-
|
|
124
|
-
if (nextIndex) {
|
|
125
|
-
return [
|
|
126
|
-
nextIndex,
|
|
127
|
-
entry
|
|
128
|
-
];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// fallback to insert at start
|
|
132
|
-
return [
|
|
133
|
-
0,
|
|
134
|
-
entry
|
|
135
|
-
];
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* @param {ModdleElement} element
|
|
141
|
-
*
|
|
142
|
-
* @return { { options: Array<any>, option: any, optionIndex: number } | null }
|
|
143
|
-
*/
|
|
144
|
-
function findReplaceOptions(element) {
|
|
145
|
-
|
|
146
|
-
const isSameType = (element, option) => option.target && !isDifferentType(element)(option);
|
|
147
|
-
|
|
148
|
-
return getReplaceOptionGroups().reduce((result, options) => {
|
|
149
|
-
|
|
150
|
-
if (result) {
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const optionIndex = options.findIndex(option => isSameType(element, option));
|
|
155
|
-
|
|
156
|
-
if (optionIndex === -1) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return {
|
|
161
|
-
options,
|
|
162
|
-
option: options[optionIndex],
|
|
163
|
-
optionIndex
|
|
164
|
-
};
|
|
165
|
-
}, null);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function getOptionIndex(options, index, entries) {
|
|
169
|
-
const option = options[index];
|
|
170
|
-
|
|
171
|
-
if (!option) {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return entries.findIndex(
|
|
176
|
-
([ key ]) => key === option.actionName
|
|
177
|
-
);
|
|
178
|
-
}
|