tianheng-ui 0.1.0 → 0.1.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/README.md +9 -18
- package/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
- package/lib/2d84c80112a372bc149cad3464e90fa3.js +1617 -0
- package/lib/5977b934a4c6b480790864ea01303173.js +10834 -0
- package/lib/7745f3e776488705a38e62f85adad54d.js +16 -0
- package/lib/de8dee841ffdaaede3a2254deef30376.js +15395 -0
- package/lib/e78eab250e7f8ccac3d918dfdb06ca10.js +8904 -0
- package/lib/theme-chalk/fonts/PingFang.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.eot +0 -0
- package/lib/theme-chalk/fonts/bpmn.svg +224 -0
- package/lib/theme-chalk/fonts/bpmn.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff2 +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.eot +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.svg +2671 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.ttf +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff2 +0 -0
- package/lib/theme-chalk/fonts/iconfont.eot +0 -0
- package/lib/theme-chalk/fonts/iconfont.svg +155 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff2 +0 -0
- package/lib/theme-chalk/images/notData.png +0 -0
- package/lib/theme-chalk/index.scss +31 -0
- package/lib/theme-chalk/js/Log.js +99 -0
- package/lib/theme-chalk/js/axios.js +86 -0
- package/lib/theme-chalk/js/store/getters.js +5 -0
- package/lib/theme-chalk/js/store/modules/makingForm.js +21 -0
- package/lib/theme-chalk/js/store/store.js +26 -0
- package/lib/theme-chalk/styles/button.scss +501 -0
- package/lib/theme-chalk/styles/card.scss +29 -0
- package/lib/theme-chalk/styles/cell.scss +54 -0
- package/lib/theme-chalk/styles/codeEditor.scss +9 -0
- package/lib/theme-chalk/styles/col.scss +151 -0
- package/lib/theme-chalk/styles/dialog.scss +56 -0
- package/lib/theme-chalk/styles/empty.scss +22 -0
- package/lib/theme-chalk/styles/feature.scss +46 -0
- package/lib/theme-chalk/styles/font.css +7 -0
- package/lib/theme-chalk/styles/grid.scss +41 -0
- package/lib/theme-chalk/styles/icon.css +1944 -0
- package/lib/theme-chalk/styles/imagePreview.scss +113 -0
- package/lib/theme-chalk/styles/img.scss +35 -0
- package/lib/theme-chalk/styles/reset.scss +17 -0
- package/lib/theme-chalk/styles/root.css +64 -0
- package/lib/theme-chalk/styles/row.scss +23 -0
- package/lib/theme-chalk/styles/upload.scss +744 -0
- package/lib/theme-chalk/styles/variable.scss +80 -0
- package/lib/tianheng-ui.js +116 -0
- package/package.json +86 -48
- package/packages/Button/index.js +8 -0
- package/packages/Button/index.vue +80 -0
- package/packages/Card/index.js +8 -0
- package/packages/Card/index.vue +37 -0
- package/packages/Cell/index.js +8 -0
- package/packages/Cell/index.vue +68 -0
- package/packages/CodeEditor/index.js +8 -0
- package/packages/CodeEditor/index.vue +177 -0
- package/packages/Col/index.js +8 -0
- package/packages/Col/index.vue +43 -0
- package/packages/Dialog/index.js +8 -0
- package/packages/Dialog/index.vue +129 -0
- package/packages/Empty/index.js +8 -0
- package/packages/Empty/index.vue +35 -0
- package/packages/FormMaking/FormConfig.vue +60 -0
- package/packages/FormMaking/GenerateForm.vue +308 -0
- package/packages/FormMaking/GenerateFormItem.vue +887 -0
- package/packages/FormMaking/GenerateFormItemH5.vue +825 -0
- package/packages/FormMaking/Upload/index.vue +572 -0
- package/packages/FormMaking/WidgetConfig.vue +472 -0
- package/packages/FormMaking/WidgetForm.vue +159 -0
- package/packages/FormMaking/WidgetFormItem.vue +187 -0
- package/packages/FormMaking/custom/config.js +762 -0
- package/packages/FormMaking/custom/configs/alliance.vue +0 -0
- package/packages/FormMaking/custom/configs/blank.vue +54 -0
- package/packages/FormMaking/custom/configs/button.vue +172 -0
- package/packages/FormMaking/custom/configs/cascader.vue +175 -0
- package/packages/FormMaking/custom/configs/cell.vue +81 -0
- package/packages/FormMaking/custom/configs/checkbox.vue +234 -0
- package/packages/FormMaking/custom/configs/color.vue +137 -0
- package/packages/FormMaking/custom/configs/date.vue +158 -0
- package/packages/FormMaking/custom/configs/divider.vue +61 -0
- package/packages/FormMaking/custom/configs/editor.vue +71 -0
- package/packages/FormMaking/custom/configs/filler.vue +57 -0
- package/packages/FormMaking/custom/configs/grid.vue +103 -0
- package/packages/FormMaking/custom/configs/image.vue +138 -0
- package/packages/FormMaking/custom/configs/input.vue +176 -0
- package/packages/FormMaking/custom/configs/number.vue +140 -0
- package/packages/FormMaking/custom/configs/radio.vue +211 -0
- package/packages/FormMaking/custom/configs/rate.vue +109 -0
- package/packages/FormMaking/custom/configs/select.vue +305 -0
- package/packages/FormMaking/custom/configs/slider.vue +142 -0
- package/packages/FormMaking/custom/configs/switch.vue +130 -0
- package/packages/FormMaking/custom/configs/table.vue +105 -0
- package/packages/FormMaking/custom/configs/table_h5.vue +102 -0
- package/packages/FormMaking/custom/configs/tabs.vue +175 -0
- package/packages/FormMaking/custom/configs/text.vue +71 -0
- package/packages/FormMaking/custom/configs/textarea.vue +167 -0
- package/packages/FormMaking/custom/configs/time.vue +153 -0
- package/packages/FormMaking/custom/configs/upload.vue +155 -0
- package/packages/FormMaking/custom/index.js +32 -0
- package/packages/FormMaking/custom/items/alliance.vue +132 -0
- package/packages/FormMaking/custom/items/blank.vue +16 -0
- package/packages/FormMaking/custom/items/button.vue +27 -0
- package/packages/FormMaking/custom/items/cascader.vue +29 -0
- package/packages/FormMaking/custom/items/cell.vue +18 -0
- package/packages/FormMaking/custom/items/checkbox.vue +46 -0
- package/packages/FormMaking/custom/items/color.vue +19 -0
- package/packages/FormMaking/custom/items/date.vue +29 -0
- package/packages/FormMaking/custom/items/divider.vue +14 -0
- package/packages/FormMaking/custom/items/editor.vue +22 -0
- package/packages/FormMaking/custom/items/filler.vue +17 -0
- package/packages/FormMaking/custom/items/grid.vue +130 -0
- package/packages/FormMaking/custom/items/image.vue +70 -0
- package/packages/FormMaking/custom/items/input.vue +33 -0
- package/packages/FormMaking/custom/items/login.vue +13 -0
- package/packages/FormMaking/custom/items/number.vue +24 -0
- package/packages/FormMaking/custom/items/radio.vue +44 -0
- package/packages/FormMaking/custom/items/rate.vue +20 -0
- package/packages/FormMaking/custom/items/select.vue +32 -0
- package/packages/FormMaking/custom/items/slider.vue +34 -0
- package/packages/FormMaking/custom/items/switch.vue +22 -0
- package/packages/FormMaking/custom/items/table.vue +106 -0
- package/packages/FormMaking/custom/items/table_h5.vue +126 -0
- package/packages/FormMaking/custom/items/tabs.vue +145 -0
- package/packages/FormMaking/custom/items/text.vue +18 -0
- package/packages/FormMaking/custom/items/textarea.vue +37 -0
- package/packages/FormMaking/custom/items/time.vue +32 -0
- package/packages/FormMaking/custom/items/upload.vue +102 -0
- package/packages/FormMaking/custom/mixins/index.js +61 -0
- package/packages/FormMaking/custom/register.js +18 -0
- package/packages/FormMaking/generate.js +5 -0
- package/packages/FormMaking/iconfont/demo.css +539 -0
- package/packages/FormMaking/iconfont/demo_index.html +1159 -0
- package/packages/FormMaking/iconfont/iconfont.css +189 -0
- package/packages/FormMaking/iconfont/iconfont.eot +0 -0
- package/packages/FormMaking/iconfont/iconfont.js +1 -0
- package/packages/FormMaking/iconfont/iconfont.svg +155 -0
- package/packages/FormMaking/iconfont/iconfont.ttf +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff2 +0 -0
- package/packages/FormMaking/index.js +33 -0
- package/packages/FormMaking/index.vue +807 -0
- package/packages/FormMaking/lang/en-US.js +187 -0
- package/packages/FormMaking/lang/zh-CN.js +187 -0
- package/packages/FormMaking/making.js +9 -0
- package/packages/FormMaking/styles/cover.scss +41 -0
- package/packages/FormMaking/styles/index.scss +785 -0
- package/packages/FormMaking/util/generateCode.js +163 -0
- package/packages/FormMaking/util/index.js +33 -0
- package/packages/FormMaking/util/request.js +28 -0
- package/packages/Grid/index.js +8 -0
- package/packages/Grid/index.vue +21 -0
- package/packages/GridItem/index.js +8 -0
- package/packages/GridItem/index.vue +69 -0
- package/packages/Icons/index.js +8 -0
- package/packages/Icons/index.vue +377 -0
- package/packages/Image/index.js +8 -0
- package/packages/Image/index.vue +146 -0
- package/packages/ImagePreview/index.js +8 -0
- package/packages/ImagePreview/index.vue +386 -0
- package/packages/Row/index.js +8 -0
- package/packages/Row/index.vue +33 -0
- package/packages/Table/action.js +8 -0
- package/packages/Table/action.vue +168 -0
- package/packages/Table/column.vue +63 -0
- package/packages/Table/index.js +8 -0
- package/packages/Table/index.vue +327 -0
- package/packages/Table/search.js +8 -0
- package/packages/Table/search.vue +163 -0
- package/packages/Table/tools.js +8 -0
- package/packages/Table/tools.vue +49 -0
- package/packages/TableMaking/custom/configs/fieldSearch.vue +17 -0
- package/packages/TableMaking/custom/configs/fieldTable.vue +15 -0
- package/packages/TableMaking/custom/items/search/index.vue +158 -0
- package/packages/TableMaking/custom/items/tools/index.vue +49 -0
- package/packages/TableMaking/generate.js +5 -0
- package/packages/TableMaking/generateTable.vue +560 -0
- package/packages/TableMaking/index.vue +229 -0
- package/packages/TableMaking/making.js +5 -0
- package/packages/TableMaking/util/index.js +433 -0
- package/packages/TableMaking/widgetConfig.vue +390 -0
- package/packages/TableMaking/widgetTable.vue +305 -0
- package/packages/Upload/ajax.js +85 -0
- package/packages/Upload/index.js +8 -0
- package/packages/Upload/index.vue +325 -0
- package/packages/Upload/upload-dragger.vue +70 -0
- package/packages/Upload/upload-list.vue +121 -0
- package/packages/Upload/upload.vue +193 -0
- package/packages/VueEditor/index.js +8 -0
- package/packages/VueEditor/index.vue +38 -0
- package/packages/Workflow/Log.js +99 -0
- package/packages/Workflow/designer/ProcessDesigner.vue +628 -0
- package/packages/Workflow/designer/index.js +7 -0
- package/packages/Workflow/designer/plugins/content-pad/contentPadProvider.js +390 -0
- package/packages/Workflow/designer/plugins/content-pad/index.js +6 -0
- package/packages/Workflow/designer/plugins/defaultEmpty.js +24 -0
- package/packages/Workflow/designer/plugins/descriptor/activitiDescriptor.json +1071 -0
- package/packages/Workflow/designer/plugins/descriptor/camundaDescriptor.json +1087 -0
- package/packages/Workflow/designer/plugins/descriptor/flowableDescriptor.json +1215 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/activitiExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/index.js +9 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/extension.js +148 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/index.js +6 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/flowableExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/index.js +9 -0
- package/packages/Workflow/designer/plugins/palette/CustomPalette.js +156 -0
- package/packages/Workflow/designer/plugins/palette/index.js +6 -0
- package/packages/Workflow/designer/plugins/palette/paletteProvider.js +160 -0
- package/packages/Workflow/designer/plugins/translate/customTranslate.js +41 -0
- package/packages/Workflow/designer/plugins/translate/zh.js +238 -0
- package/packages/Workflow/highlight/index.js +5 -0
- package/packages/Workflow/index.js +34 -0
- package/packages/Workflow/index.vue +399 -0
- package/packages/Workflow/modules/auto-place/CustomAutoPlace.js +81 -0
- package/packages/Workflow/modules/auto-place/index.js +6 -0
- package/packages/Workflow/modules/custom-renderer/CustomRenderer.js +17 -0
- package/packages/Workflow/modules/custom-renderer/index.js +6 -0
- package/packages/Workflow/modules/rules/CustomRules.js +16 -0
- package/packages/Workflow/modules/rules/index.js +6 -0
- package/packages/Workflow/palette/ProcessPalette.vue +106 -0
- package/packages/Workflow/palette/index.js +7 -0
- package/packages/Workflow/penal/PropertiesPanel.vue +245 -0
- package/packages/Workflow/penal/base/ElementBaseInfo.vue +80 -0
- package/packages/Workflow/penal/flow-condition/FlowCondition.vue +142 -0
- package/packages/Workflow/penal/form/ElementForm.vue +367 -0
- package/packages/Workflow/penal/index.js +7 -0
- package/packages/Workflow/penal/listeners/ElementListeners.vue +299 -0
- package/packages/Workflow/penal/listeners/UserTaskListeners.vue +322 -0
- package/packages/Workflow/penal/listeners/template.js +178 -0
- package/packages/Workflow/penal/listeners/utilSelf.js +64 -0
- package/packages/Workflow/penal/multi-instance/ElementMultiInstance.vue +200 -0
- package/packages/Workflow/penal/other/ElementOtherConfig.vue +59 -0
- package/packages/Workflow/penal/properties/ElementProperties.vue +135 -0
- package/packages/Workflow/penal/signal-message/SignalAndMessage.vue +104 -0
- package/packages/Workflow/penal/task/ElementTask.vue +73 -0
- package/packages/Workflow/penal/task/task-components/ReceiveTask.vue +97 -0
- package/packages/Workflow/penal/task/task-components/ScriptTask.vue +85 -0
- package/packages/Workflow/penal/task/task-components/UserTask.vue +535 -0
- package/packages/Workflow/theme/element-variables.scss +70 -0
- package/packages/Workflow/theme/index.scss +2 -0
- package/packages/Workflow/theme/process-designer.scss +157 -0
- package/packages/Workflow/theme/process-panel.scss +107 -0
- package/packages/Workflow/translations.js +25 -0
- package/packages/Workflow/utils.js +71 -0
- package/packages/index.js +160 -0
- package/babel.config.js +0 -15
- package/index.js +0 -11
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/App.vue +0 -28
- package/src/assets/logo.png +0 -0
- package/src/components/HelloWorld.vue +0 -58
- package/src/main.js +0 -8
@@ -0,0 +1,390 @@
|
|
1
|
+
import { assign, forEach, isArray } from "min-dash";
|
2
|
+
|
3
|
+
import { is } from "bpmn-js/lib/util/ModelUtil";
|
4
|
+
|
5
|
+
import { isExpanded, isEventSubProcess } from "bpmn-js/lib/util/DiUtil";
|
6
|
+
|
7
|
+
import { isAny } from "bpmn-js/lib/features/modeling/util/ModelingUtil";
|
8
|
+
|
9
|
+
import { getChildLanes } from "bpmn-js/lib/features/modeling/util/LaneUtil";
|
10
|
+
|
11
|
+
import { hasPrimaryModifier } from "diagram-js/lib/util/Mouse";
|
12
|
+
|
13
|
+
/**
|
14
|
+
* A provider for BPMN 2.0 elements context pad
|
15
|
+
*/
|
16
|
+
export default function ContextPadProvider(
|
17
|
+
config,
|
18
|
+
injector,
|
19
|
+
eventBus,
|
20
|
+
contextPad,
|
21
|
+
modeling,
|
22
|
+
elementFactory,
|
23
|
+
connect,
|
24
|
+
create,
|
25
|
+
popupMenu,
|
26
|
+
canvas,
|
27
|
+
rules,
|
28
|
+
translate,
|
29
|
+
elementRegistry
|
30
|
+
) {
|
31
|
+
config = config || {};
|
32
|
+
|
33
|
+
contextPad.registerProvider(this);
|
34
|
+
|
35
|
+
this._contextPad = contextPad;
|
36
|
+
|
37
|
+
this._modeling = modeling;
|
38
|
+
|
39
|
+
this._elementFactory = elementFactory;
|
40
|
+
this._connect = connect;
|
41
|
+
this._create = create;
|
42
|
+
this._popupMenu = popupMenu;
|
43
|
+
this._canvas = canvas;
|
44
|
+
this._rules = rules;
|
45
|
+
this._translate = translate;
|
46
|
+
|
47
|
+
if (config.autoPlace !== false) {
|
48
|
+
this._autoPlace = injector.get("autoPlace", false);
|
49
|
+
}
|
50
|
+
|
51
|
+
eventBus.on("create.end", 250, function(event) {
|
52
|
+
var context = event.context,
|
53
|
+
shape = context.shape;
|
54
|
+
|
55
|
+
if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
|
59
|
+
var entries = contextPad.getEntries(shape);
|
60
|
+
|
61
|
+
if (entries.replace) {
|
62
|
+
entries.replace.action.click(event, shape);
|
63
|
+
}
|
64
|
+
});
|
65
|
+
}
|
66
|
+
|
67
|
+
ContextPadProvider.$inject = [
|
68
|
+
"config.contextPad",
|
69
|
+
"injector",
|
70
|
+
"eventBus",
|
71
|
+
"contextPad",
|
72
|
+
"modeling",
|
73
|
+
"elementFactory",
|
74
|
+
"connect",
|
75
|
+
"create",
|
76
|
+
"popupMenu",
|
77
|
+
"canvas",
|
78
|
+
"rules",
|
79
|
+
"translate",
|
80
|
+
"elementRegistry"
|
81
|
+
];
|
82
|
+
|
83
|
+
ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
84
|
+
var contextPad = this._contextPad,
|
85
|
+
modeling = this._modeling,
|
86
|
+
elementFactory = this._elementFactory,
|
87
|
+
connect = this._connect,
|
88
|
+
create = this._create,
|
89
|
+
popupMenu = this._popupMenu,
|
90
|
+
canvas = this._canvas,
|
91
|
+
rules = this._rules,
|
92
|
+
autoPlace = this._autoPlace,
|
93
|
+
translate = this._translate;
|
94
|
+
|
95
|
+
var actions = {};
|
96
|
+
|
97
|
+
if (element.type === "label") {
|
98
|
+
return actions;
|
99
|
+
}
|
100
|
+
|
101
|
+
var businessObject = element.businessObject;
|
102
|
+
|
103
|
+
function startConnect(event, element) {
|
104
|
+
connect.start(event, element);
|
105
|
+
}
|
106
|
+
|
107
|
+
function removeElement() {
|
108
|
+
modeling.removeElements([element]);
|
109
|
+
}
|
110
|
+
|
111
|
+
function getReplaceMenuPosition(element) {
|
112
|
+
var Y_OFFSET = 5;
|
113
|
+
|
114
|
+
var diagramContainer = canvas.getContainer(),
|
115
|
+
pad = contextPad.getPad(element).html;
|
116
|
+
|
117
|
+
var diagramRect = diagramContainer.getBoundingClientRect(),
|
118
|
+
padRect = pad.getBoundingClientRect();
|
119
|
+
|
120
|
+
var top = padRect.top - diagramRect.top;
|
121
|
+
var left = padRect.left - diagramRect.left;
|
122
|
+
|
123
|
+
var pos = {
|
124
|
+
x: left,
|
125
|
+
y: top + padRect.height + Y_OFFSET
|
126
|
+
};
|
127
|
+
|
128
|
+
return pos;
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Create an append action
|
133
|
+
*
|
134
|
+
* @param {string} type
|
135
|
+
* @param {string} className
|
136
|
+
* @param {string} [title]
|
137
|
+
* @param {Object} [options]
|
138
|
+
*
|
139
|
+
* @return {Object} descriptor
|
140
|
+
*/
|
141
|
+
function appendAction(type, className, title, options) {
|
142
|
+
if (typeof title !== "string") {
|
143
|
+
options = title;
|
144
|
+
title = translate("Append {type}", { type: type.replace(/^bpmn:/, "") });
|
145
|
+
}
|
146
|
+
|
147
|
+
function appendStart(event, element) {
|
148
|
+
var shape = elementFactory.createShape(assign({ type: type }, options));
|
149
|
+
create.start(event, shape, {
|
150
|
+
source: element
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
var append = autoPlace
|
155
|
+
? function(event, element) {
|
156
|
+
var shape = elementFactory.createShape(assign({ type: type }, options));
|
157
|
+
|
158
|
+
autoPlace.append(element, shape);
|
159
|
+
}
|
160
|
+
: appendStart;
|
161
|
+
|
162
|
+
return {
|
163
|
+
group: "model",
|
164
|
+
className: className,
|
165
|
+
title: title,
|
166
|
+
action: {
|
167
|
+
dragstart: appendStart,
|
168
|
+
click: append
|
169
|
+
}
|
170
|
+
};
|
171
|
+
}
|
172
|
+
|
173
|
+
function splitLaneHandler(count) {
|
174
|
+
return function(event, element) {
|
175
|
+
// actual split
|
176
|
+
modeling.splitLane(element, count);
|
177
|
+
|
178
|
+
// refresh context pad after split to
|
179
|
+
// get rid of split icons
|
180
|
+
contextPad.open(element, true);
|
181
|
+
};
|
182
|
+
}
|
183
|
+
|
184
|
+
if (isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) && isExpanded(businessObject)) {
|
185
|
+
var childLanes = getChildLanes(element);
|
186
|
+
|
187
|
+
assign(actions, {
|
188
|
+
"lane-insert-above": {
|
189
|
+
group: "lane-insert-above",
|
190
|
+
className: "bpmn-icon-lane-insert-above",
|
191
|
+
title: translate("Add Lane above"),
|
192
|
+
action: {
|
193
|
+
click: function(event, element) {
|
194
|
+
modeling.addLane(element, "top");
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
});
|
199
|
+
|
200
|
+
if (childLanes.length < 2) {
|
201
|
+
if (element.height >= 120) {
|
202
|
+
assign(actions, {
|
203
|
+
"lane-divide-two": {
|
204
|
+
group: "lane-divide",
|
205
|
+
className: "bpmn-icon-lane-divide-two",
|
206
|
+
title: translate("Divide into two Lanes"),
|
207
|
+
action: {
|
208
|
+
click: splitLaneHandler(2)
|
209
|
+
}
|
210
|
+
}
|
211
|
+
});
|
212
|
+
}
|
213
|
+
|
214
|
+
if (element.height >= 180) {
|
215
|
+
assign(actions, {
|
216
|
+
"lane-divide-three": {
|
217
|
+
group: "lane-divide",
|
218
|
+
className: "bpmn-icon-lane-divide-three",
|
219
|
+
title: translate("Divide into three Lanes"),
|
220
|
+
action: {
|
221
|
+
click: splitLaneHandler(3)
|
222
|
+
}
|
223
|
+
}
|
224
|
+
});
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
assign(actions, {
|
229
|
+
"lane-insert-below": {
|
230
|
+
group: "lane-insert-below",
|
231
|
+
className: "bpmn-icon-lane-insert-below",
|
232
|
+
title: translate("Add Lane below"),
|
233
|
+
action: {
|
234
|
+
click: function(event, element) {
|
235
|
+
modeling.addLane(element, "bottom");
|
236
|
+
}
|
237
|
+
}
|
238
|
+
}
|
239
|
+
});
|
240
|
+
}
|
241
|
+
|
242
|
+
if (is(businessObject, "bpmn:FlowNode")) {
|
243
|
+
if (is(businessObject, "bpmn:EventBasedGateway")) {
|
244
|
+
assign(actions, {
|
245
|
+
"append.receive-task": appendAction("bpmn:ReceiveTask", "bpmn-icon-receive-task", translate("Append ReceiveTask")),
|
246
|
+
"append.message-intermediate-event": appendAction(
|
247
|
+
"bpmn:IntermediateCatchEvent",
|
248
|
+
"bpmn-icon-intermediate-event-catch-message",
|
249
|
+
translate("Append MessageIntermediateCatchEvent"),
|
250
|
+
{ eventDefinitionType: "bpmn:MessageEventDefinition" }
|
251
|
+
),
|
252
|
+
"append.timer-intermediate-event": appendAction(
|
253
|
+
"bpmn:IntermediateCatchEvent",
|
254
|
+
"bpmn-icon-intermediate-event-catch-timer",
|
255
|
+
translate("Append TimerIntermediateCatchEvent"),
|
256
|
+
{ eventDefinitionType: "bpmn:TimerEventDefinition" }
|
257
|
+
),
|
258
|
+
"append.condition-intermediate-event": appendAction(
|
259
|
+
"bpmn:IntermediateCatchEvent",
|
260
|
+
"bpmn-icon-intermediate-event-catch-condition",
|
261
|
+
translate("Append ConditionIntermediateCatchEvent"),
|
262
|
+
{ eventDefinitionType: "bpmn:ConditionalEventDefinition" }
|
263
|
+
),
|
264
|
+
"append.signal-intermediate-event": appendAction(
|
265
|
+
"bpmn:IntermediateCatchEvent",
|
266
|
+
"bpmn-icon-intermediate-event-catch-signal",
|
267
|
+
translate("Append SignalIntermediateCatchEvent"),
|
268
|
+
{ eventDefinitionType: "bpmn:SignalEventDefinition" }
|
269
|
+
)
|
270
|
+
});
|
271
|
+
} else if (isEventType(businessObject, "bpmn:BoundaryEvent", "bpmn:CompensateEventDefinition")) {
|
272
|
+
assign(actions, {
|
273
|
+
"append.compensation-activity": appendAction("bpmn:Task", "bpmn-icon-task", translate("Append compensation activity"), {
|
274
|
+
isForCompensation: true
|
275
|
+
})
|
276
|
+
});
|
277
|
+
} else if (
|
278
|
+
!is(businessObject, "bpmn:EndEvent") &&
|
279
|
+
!businessObject.isForCompensation &&
|
280
|
+
!isEventType(businessObject, "bpmn:IntermediateThrowEvent", "bpmn:LinkEventDefinition") &&
|
281
|
+
!isEventSubProcess(businessObject)
|
282
|
+
) {
|
283
|
+
assign(actions, {
|
284
|
+
"append.end-event": appendAction("bpmn:EndEvent", "bpmn-icon-end-event-none", translate("Append EndEvent")),
|
285
|
+
"append.gateway": appendAction("bpmn:ExclusiveGateway", "bpmn-icon-gateway-none", translate("Append Gateway")),
|
286
|
+
"append.append-task": appendAction("bpmn:UserTask", "bpmn-icon-user-task", translate("Append Task")),
|
287
|
+
"append.intermediate-event": appendAction(
|
288
|
+
"bpmn:IntermediateThrowEvent",
|
289
|
+
"bpmn-icon-intermediate-event-none",
|
290
|
+
translate("Append Intermediate/Boundary Event")
|
291
|
+
)
|
292
|
+
});
|
293
|
+
}
|
294
|
+
}
|
295
|
+
|
296
|
+
if (!popupMenu.isEmpty(element, "bpmn-replace")) {
|
297
|
+
// Replace menu entry
|
298
|
+
assign(actions, {
|
299
|
+
replace: {
|
300
|
+
group: "edit",
|
301
|
+
className: "bpmn-icon-screw-wrench",
|
302
|
+
title: translate("Change type"),
|
303
|
+
action: {
|
304
|
+
click: function(event, element) {
|
305
|
+
var position = assign(getReplaceMenuPosition(element), {
|
306
|
+
cursor: { x: event.x, y: event.y }
|
307
|
+
});
|
308
|
+
|
309
|
+
popupMenu.open(element, "bpmn-replace", position);
|
310
|
+
}
|
311
|
+
}
|
312
|
+
}
|
313
|
+
});
|
314
|
+
}
|
315
|
+
|
316
|
+
if (isAny(businessObject, ["bpmn:FlowNode", "bpmn:InteractionNode", "bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
|
317
|
+
assign(actions, {
|
318
|
+
"append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation"),
|
319
|
+
|
320
|
+
connect: {
|
321
|
+
group: "connect",
|
322
|
+
className: "bpmn-icon-connection-multi",
|
323
|
+
title: translate("Connect using " + (businessObject.isForCompensation ? "" : "Sequence/MessageFlow or ") + "Association"),
|
324
|
+
action: {
|
325
|
+
click: startConnect,
|
326
|
+
dragstart: startConnect
|
327
|
+
}
|
328
|
+
}
|
329
|
+
});
|
330
|
+
}
|
331
|
+
|
332
|
+
if (isAny(businessObject, ["bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
|
333
|
+
assign(actions, {
|
334
|
+
connect: {
|
335
|
+
group: "connect",
|
336
|
+
className: "bpmn-icon-connection-multi",
|
337
|
+
title: translate("Connect using DataInputAssociation"),
|
338
|
+
action: {
|
339
|
+
click: startConnect,
|
340
|
+
dragstart: startConnect
|
341
|
+
}
|
342
|
+
}
|
343
|
+
});
|
344
|
+
}
|
345
|
+
|
346
|
+
if (is(businessObject, "bpmn:Group")) {
|
347
|
+
assign(actions, {
|
348
|
+
"append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation")
|
349
|
+
});
|
350
|
+
}
|
351
|
+
|
352
|
+
// delete element entry, only show if allowed by rules
|
353
|
+
var deleteAllowed = rules.allowed("elements.delete", { elements: [element] });
|
354
|
+
|
355
|
+
if (isArray(deleteAllowed)) {
|
356
|
+
// was the element returned as a deletion candidate?
|
357
|
+
deleteAllowed = deleteAllowed[0] === element;
|
358
|
+
}
|
359
|
+
|
360
|
+
if (deleteAllowed) {
|
361
|
+
assign(actions, {
|
362
|
+
delete: {
|
363
|
+
group: "edit",
|
364
|
+
className: "bpmn-icon-trash",
|
365
|
+
title: translate("Remove"),
|
366
|
+
action: {
|
367
|
+
click: removeElement
|
368
|
+
}
|
369
|
+
}
|
370
|
+
});
|
371
|
+
}
|
372
|
+
|
373
|
+
return actions;
|
374
|
+
};
|
375
|
+
|
376
|
+
// helpers /////////
|
377
|
+
|
378
|
+
function isEventType(eventBo, type, definition) {
|
379
|
+
var isType = eventBo.$instanceOf(type);
|
380
|
+
var isDefinition = false;
|
381
|
+
|
382
|
+
var definitions = eventBo.eventDefinitions || [];
|
383
|
+
forEach(definitions, function(def) {
|
384
|
+
if (def.$type === definition) {
|
385
|
+
isDefinition = true;
|
386
|
+
}
|
387
|
+
});
|
388
|
+
|
389
|
+
return isType && isDefinition;
|
390
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export default (key, name, type) => {
|
2
|
+
if (!type) type = "camunda";
|
3
|
+
const TYPE_TARGET = {
|
4
|
+
activiti: "http://activiti.org/bpmn",
|
5
|
+
camunda: "http://bpmn.io/schema/bpmn",
|
6
|
+
flowable: "http://flowable.org/bpmn"
|
7
|
+
};
|
8
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
9
|
+
<bpmn2:definitions
|
10
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
11
|
+
xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL"
|
12
|
+
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
|
13
|
+
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
|
14
|
+
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
|
15
|
+
id="diagram_${key}"
|
16
|
+
targetNamespace="${TYPE_TARGET[type]}">
|
17
|
+
<bpmn2:process id="${key}" name="${name}" isExecutable="true">
|
18
|
+
</bpmn2:process>
|
19
|
+
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
20
|
+
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${key}">
|
21
|
+
</bpmndi:BPMNPlane>
|
22
|
+
</bpmndi:BPMNDiagram>
|
23
|
+
</bpmn2:definitions>`;
|
24
|
+
};
|