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,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var some = require("min-dash").some;
|
4
|
+
|
5
|
+
var ALLOWED_TYPES = {
|
6
|
+
FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
|
7
|
+
Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
|
8
|
+
Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
|
9
|
+
};
|
10
|
+
|
11
|
+
function is(element, type) {
|
12
|
+
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
|
13
|
+
}
|
14
|
+
|
15
|
+
function exists(element) {
|
16
|
+
return element && element.length;
|
17
|
+
}
|
18
|
+
|
19
|
+
function includesType(collection, type) {
|
20
|
+
return (
|
21
|
+
exists(collection) &&
|
22
|
+
some(collection, function(element) {
|
23
|
+
return is(element, type);
|
24
|
+
})
|
25
|
+
);
|
26
|
+
}
|
27
|
+
|
28
|
+
function anyType(element, types) {
|
29
|
+
return some(types, function(type) {
|
30
|
+
return is(element, type);
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
function isAllowed(propName, propDescriptor, newElement) {
|
35
|
+
var name = propDescriptor.name,
|
36
|
+
types = ALLOWED_TYPES[name.replace(/activiti:/, "")];
|
37
|
+
|
38
|
+
return name === propName && anyType(newElement, types);
|
39
|
+
}
|
40
|
+
|
41
|
+
function ActivitiModdleExtension(eventBus) {
|
42
|
+
eventBus.on(
|
43
|
+
"property.clone",
|
44
|
+
function(context) {
|
45
|
+
var newElement = context.newElement,
|
46
|
+
propDescriptor = context.propertyDescriptor;
|
47
|
+
|
48
|
+
this.canCloneProperty(newElement, propDescriptor);
|
49
|
+
},
|
50
|
+
this
|
51
|
+
);
|
52
|
+
}
|
53
|
+
|
54
|
+
ActivitiModdleExtension.$inject = ["eventBus"];
|
55
|
+
|
56
|
+
ActivitiModdleExtension.prototype.canCloneProperty = function(newElement, propDescriptor) {
|
57
|
+
if (isAllowed("activiti:FailedJobRetryTimeCycle", propDescriptor, newElement)) {
|
58
|
+
return (
|
59
|
+
includesType(newElement.eventDefinitions, "bpmn:TimerEventDefinition") ||
|
60
|
+
includesType(newElement.eventDefinitions, "bpmn:SignalEventDefinition") ||
|
61
|
+
is(newElement.loopCharacteristics, "bpmn:MultiInstanceLoopCharacteristics")
|
62
|
+
);
|
63
|
+
}
|
64
|
+
|
65
|
+
if (isAllowed("activiti:Connector", propDescriptor, newElement)) {
|
66
|
+
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
|
67
|
+
}
|
68
|
+
|
69
|
+
if (isAllowed("activiti:Field", propDescriptor, newElement)) {
|
70
|
+
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
module.exports = ActivitiModdleExtension;
|
@@ -0,0 +1,148 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var isFunction = require("min-dash").isFunction,
|
4
|
+
isObject = require("min-dash").isObject,
|
5
|
+
some = require("min-dash").some;
|
6
|
+
|
7
|
+
var WILDCARD = "*";
|
8
|
+
|
9
|
+
function CamundaModdleExtension(eventBus) {
|
10
|
+
var self = this;
|
11
|
+
|
12
|
+
eventBus.on("moddleCopy.canCopyProperty", function(context) {
|
13
|
+
var property = context.property,
|
14
|
+
parent = context.parent;
|
15
|
+
|
16
|
+
return self.canCopyProperty(property, parent);
|
17
|
+
});
|
18
|
+
}
|
19
|
+
|
20
|
+
CamundaModdleExtension.$inject = ["eventBus"];
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Check wether to disallow copying property.
|
24
|
+
*/
|
25
|
+
CamundaModdleExtension.prototype.canCopyProperty = function(property, parent) {
|
26
|
+
// (1) check wether property is allowed in parent
|
27
|
+
if (isObject(property) && !isAllowedInParent(property, parent)) {
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
|
31
|
+
// (2) check more complex scenarios
|
32
|
+
|
33
|
+
if (is(property, "camunda:InputOutput") && !this.canHostInputOutput(parent)) {
|
34
|
+
return false;
|
35
|
+
}
|
36
|
+
|
37
|
+
if (isAny(property, ["camunda:Connector", "camunda:Field"]) && !this.canHostConnector(parent)) {
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
|
41
|
+
if (is(property, "camunda:In") && !this.canHostIn(parent)) {
|
42
|
+
return false;
|
43
|
+
}
|
44
|
+
};
|
45
|
+
|
46
|
+
CamundaModdleExtension.prototype.canHostInputOutput = function(parent) {
|
47
|
+
// allowed in camunda:Connector
|
48
|
+
var connector = getParent(parent, "camunda:Connector");
|
49
|
+
|
50
|
+
if (connector) {
|
51
|
+
return true;
|
52
|
+
}
|
53
|
+
|
54
|
+
// special rules inside bpmn:FlowNode
|
55
|
+
var flowNode = getParent(parent, "bpmn:FlowNode");
|
56
|
+
|
57
|
+
if (!flowNode) {
|
58
|
+
return false;
|
59
|
+
}
|
60
|
+
|
61
|
+
if (isAny(flowNode, ["bpmn:StartEvent", "bpmn:Gateway", "bpmn:BoundaryEvent"])) {
|
62
|
+
return false;
|
63
|
+
}
|
64
|
+
|
65
|
+
if (is(flowNode, "bpmn:SubProcess") && flowNode.get("triggeredByEvent")) {
|
66
|
+
return false;
|
67
|
+
}
|
68
|
+
|
69
|
+
return true;
|
70
|
+
};
|
71
|
+
|
72
|
+
CamundaModdleExtension.prototype.canHostConnector = function(parent) {
|
73
|
+
var serviceTaskLike = getParent(parent, "camunda:ServiceTaskLike");
|
74
|
+
|
75
|
+
if (is(serviceTaskLike, "bpmn:MessageEventDefinition")) {
|
76
|
+
// only allow on throw and end events
|
77
|
+
return getParent(parent, "bpmn:IntermediateThrowEvent") || getParent(parent, "bpmn:EndEvent");
|
78
|
+
}
|
79
|
+
|
80
|
+
return true;
|
81
|
+
};
|
82
|
+
|
83
|
+
CamundaModdleExtension.prototype.canHostIn = function(parent) {
|
84
|
+
var callActivity = getParent(parent, "bpmn:CallActivity");
|
85
|
+
|
86
|
+
if (callActivity) {
|
87
|
+
return true;
|
88
|
+
}
|
89
|
+
|
90
|
+
var signalEventDefinition = getParent(parent, "bpmn:SignalEventDefinition");
|
91
|
+
|
92
|
+
if (signalEventDefinition) {
|
93
|
+
// only allow on throw and end events
|
94
|
+
return getParent(parent, "bpmn:IntermediateThrowEvent") || getParent(parent, "bpmn:EndEvent");
|
95
|
+
}
|
96
|
+
|
97
|
+
return true;
|
98
|
+
};
|
99
|
+
|
100
|
+
module.exports = CamundaModdleExtension;
|
101
|
+
|
102
|
+
// helpers //////////
|
103
|
+
|
104
|
+
function is(element, type) {
|
105
|
+
return element && isFunction(element.$instanceOf) && element.$instanceOf(type);
|
106
|
+
}
|
107
|
+
|
108
|
+
function isAny(element, types) {
|
109
|
+
return some(types, function(t) {
|
110
|
+
return is(element, t);
|
111
|
+
});
|
112
|
+
}
|
113
|
+
|
114
|
+
function getParent(element, type) {
|
115
|
+
if (!type) {
|
116
|
+
return element.$parent;
|
117
|
+
}
|
118
|
+
|
119
|
+
if (is(element, type)) {
|
120
|
+
return element;
|
121
|
+
}
|
122
|
+
|
123
|
+
if (!element.$parent) {
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
|
127
|
+
return getParent(element.$parent, type);
|
128
|
+
}
|
129
|
+
|
130
|
+
function isAllowedInParent(property, parent) {
|
131
|
+
// (1) find property descriptor
|
132
|
+
var descriptor = property.$type && property.$model.getTypeDescriptor(property.$type);
|
133
|
+
|
134
|
+
var allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn;
|
135
|
+
|
136
|
+
if (!allowedIn || isWildcard(allowedIn)) {
|
137
|
+
return true;
|
138
|
+
}
|
139
|
+
|
140
|
+
// (2) check wether property has parent of allowed type
|
141
|
+
return some(allowedIn, function(type) {
|
142
|
+
return getParent(parent, type);
|
143
|
+
});
|
144
|
+
}
|
145
|
+
|
146
|
+
function isWildcard(allowedIn) {
|
147
|
+
return allowedIn.indexOf(WILDCARD) !== -1;
|
148
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var some = require("min-dash").some;
|
4
|
+
|
5
|
+
var ALLOWED_TYPES = {
|
6
|
+
FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
|
7
|
+
Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
|
8
|
+
Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
|
9
|
+
};
|
10
|
+
|
11
|
+
function is(element, type) {
|
12
|
+
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
|
13
|
+
}
|
14
|
+
|
15
|
+
function exists(element) {
|
16
|
+
return element && element.length;
|
17
|
+
}
|
18
|
+
|
19
|
+
function includesType(collection, type) {
|
20
|
+
return (
|
21
|
+
exists(collection) &&
|
22
|
+
some(collection, function(element) {
|
23
|
+
return is(element, type);
|
24
|
+
})
|
25
|
+
);
|
26
|
+
}
|
27
|
+
|
28
|
+
function anyType(element, types) {
|
29
|
+
return some(types, function(type) {
|
30
|
+
return is(element, type);
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
function isAllowed(propName, propDescriptor, newElement) {
|
35
|
+
var name = propDescriptor.name,
|
36
|
+
types = ALLOWED_TYPES[name.replace(/flowable:/, "")];
|
37
|
+
|
38
|
+
return name === propName && anyType(newElement, types);
|
39
|
+
}
|
40
|
+
|
41
|
+
function FlowableModdleExtension(eventBus) {
|
42
|
+
eventBus.on(
|
43
|
+
"property.clone",
|
44
|
+
function(context) {
|
45
|
+
var newElement = context.newElement,
|
46
|
+
propDescriptor = context.propertyDescriptor;
|
47
|
+
|
48
|
+
this.canCloneProperty(newElement, propDescriptor);
|
49
|
+
},
|
50
|
+
this
|
51
|
+
);
|
52
|
+
}
|
53
|
+
|
54
|
+
FlowableModdleExtension.$inject = ["eventBus"];
|
55
|
+
|
56
|
+
FlowableModdleExtension.prototype.canCloneProperty = function(newElement, propDescriptor) {
|
57
|
+
if (isAllowed("flowable:FailedJobRetryTimeCycle", propDescriptor, newElement)) {
|
58
|
+
return (
|
59
|
+
includesType(newElement.eventDefinitions, "bpmn:TimerEventDefinition") ||
|
60
|
+
includesType(newElement.eventDefinitions, "bpmn:SignalEventDefinition") ||
|
61
|
+
is(newElement.loopCharacteristics, "bpmn:MultiInstanceLoopCharacteristics")
|
62
|
+
);
|
63
|
+
}
|
64
|
+
|
65
|
+
if (isAllowed("flowable:Connector", propDescriptor, newElement)) {
|
66
|
+
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
|
67
|
+
}
|
68
|
+
|
69
|
+
if (isAllowed("flowable:Field", propDescriptor, newElement)) {
|
70
|
+
return includesType(newElement.eventDefinitions, "bpmn:MessageEventDefinition");
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
module.exports = FlowableModdleExtension;
|
@@ -0,0 +1,156 @@
|
|
1
|
+
import PaletteProvider from "bpmn-js/lib/features/palette/PaletteProvider";
|
2
|
+
import { assign } from "min-dash";
|
3
|
+
|
4
|
+
export default function CustomPalette(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) {
|
5
|
+
PaletteProvider.call(this, palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate, 2000);
|
6
|
+
}
|
7
|
+
|
8
|
+
const F = function() {}; // 核心,利用空对象作为中介;
|
9
|
+
F.prototype = PaletteProvider.prototype; // 核心,将父类的原型赋值给空对象F;
|
10
|
+
|
11
|
+
// 利用中介函数重写原型链方法
|
12
|
+
F.prototype.getPaletteEntries = function() {
|
13
|
+
var actions = {},
|
14
|
+
create = this._create,
|
15
|
+
elementFactory = this._elementFactory,
|
16
|
+
spaceTool = this._spaceTool,
|
17
|
+
lassoTool = this._lassoTool,
|
18
|
+
handTool = this._handTool,
|
19
|
+
globalConnect = this._globalConnect,
|
20
|
+
translate = this._translate;
|
21
|
+
|
22
|
+
function createAction(type, group, className, title, options) {
|
23
|
+
function createListener(event) {
|
24
|
+
var shape = elementFactory.createShape(assign({ type: type }, options));
|
25
|
+
|
26
|
+
if (options) {
|
27
|
+
shape.businessObject.di.isExpanded = options.isExpanded;
|
28
|
+
}
|
29
|
+
|
30
|
+
create.start(event, shape);
|
31
|
+
}
|
32
|
+
|
33
|
+
var shortType = type.replace(/^bpmn:/, "");
|
34
|
+
|
35
|
+
return {
|
36
|
+
group: group,
|
37
|
+
className: className,
|
38
|
+
title: title || translate("Create {type}", { type: shortType }),
|
39
|
+
action: {
|
40
|
+
dragstart: createListener,
|
41
|
+
click: createListener
|
42
|
+
}
|
43
|
+
};
|
44
|
+
}
|
45
|
+
|
46
|
+
function createSubprocess(event) {
|
47
|
+
var subProcess = elementFactory.createShape({
|
48
|
+
type: "bpmn:SubProcess",
|
49
|
+
x: 0,
|
50
|
+
y: 0,
|
51
|
+
isExpanded: true
|
52
|
+
});
|
53
|
+
|
54
|
+
var startEvent = elementFactory.createShape({
|
55
|
+
type: "bpmn:StartEvent",
|
56
|
+
x: 40,
|
57
|
+
y: 82,
|
58
|
+
parent: subProcess
|
59
|
+
});
|
60
|
+
|
61
|
+
create.start(event, [subProcess, startEvent], {
|
62
|
+
hints: {
|
63
|
+
autoSelect: [startEvent]
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
function createParticipant(event) {
|
69
|
+
create.start(event, elementFactory.createParticipantShape());
|
70
|
+
}
|
71
|
+
|
72
|
+
assign(actions, {
|
73
|
+
"hand-tool": {
|
74
|
+
group: "tools",
|
75
|
+
className: "bpmn-icon-hand-tool",
|
76
|
+
title: translate("Activate the hand tool"),
|
77
|
+
action: {
|
78
|
+
click: function(event) {
|
79
|
+
handTool.activateHand(event);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
},
|
83
|
+
"lasso-tool": {
|
84
|
+
group: "tools",
|
85
|
+
className: "bpmn-icon-lasso-tool",
|
86
|
+
title: translate("Activate the lasso tool"),
|
87
|
+
action: {
|
88
|
+
click: function(event) {
|
89
|
+
lassoTool.activateSelection(event);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
},
|
93
|
+
"space-tool": {
|
94
|
+
group: "tools",
|
95
|
+
className: "bpmn-icon-space-tool",
|
96
|
+
title: translate("Activate the create/remove space tool"),
|
97
|
+
action: {
|
98
|
+
click: function(event) {
|
99
|
+
spaceTool.activateSelection(event);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
},
|
103
|
+
"global-connect-tool": {
|
104
|
+
group: "tools",
|
105
|
+
className: "bpmn-icon-connection-multi",
|
106
|
+
title: translate("Activate the global connect tool"),
|
107
|
+
action: {
|
108
|
+
click: function(event) {
|
109
|
+
globalConnect.toggle(event);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
},
|
113
|
+
"tool-separator": {
|
114
|
+
group: "tools",
|
115
|
+
separator: true
|
116
|
+
},
|
117
|
+
"create.start-event": createAction("bpmn:StartEvent", "event", "bpmn-icon-start-event-none", translate("Create StartEvent")),
|
118
|
+
"create.intermediate-event": createAction(
|
119
|
+
"bpmn:IntermediateThrowEvent",
|
120
|
+
"event",
|
121
|
+
"bpmn-icon-intermediate-event-none",
|
122
|
+
translate("Create Intermediate/Boundary Event")
|
123
|
+
),
|
124
|
+
"create.end-event": createAction("bpmn:EndEvent", "event", "bpmn-icon-end-event-none", translate("Create EndEvent")),
|
125
|
+
"create.exclusive-gateway": createAction("bpmn:ExclusiveGateway", "gateway", "bpmn-icon-gateway-none", translate("Create Gateway")),
|
126
|
+
"create.user-task": createAction("bpmn:UserTask", "activity", "bpmn-icon-user-task", translate("Create User Task")),
|
127
|
+
"create.data-object": createAction("bpmn:DataObjectReference", "data-object", "bpmn-icon-data-object", translate("Create DataObjectReference")),
|
128
|
+
"create.data-store": createAction("bpmn:DataStoreReference", "data-store", "bpmn-icon-data-store", translate("Create DataStoreReference")),
|
129
|
+
"create.subprocess-expanded": {
|
130
|
+
group: "activity",
|
131
|
+
className: "bpmn-icon-subprocess-expanded",
|
132
|
+
title: translate("Create expanded SubProcess"),
|
133
|
+
action: {
|
134
|
+
dragstart: createSubprocess,
|
135
|
+
click: createSubprocess
|
136
|
+
}
|
137
|
+
},
|
138
|
+
"create.participant-expanded": {
|
139
|
+
group: "collaboration",
|
140
|
+
className: "bpmn-icon-participant",
|
141
|
+
title: translate("Create Pool/Participant"),
|
142
|
+
action: {
|
143
|
+
dragstart: createParticipant,
|
144
|
+
click: createParticipant
|
145
|
+
}
|
146
|
+
},
|
147
|
+
"create.group": createAction("bpmn:Group", "artifact", "bpmn-icon-group", translate("Create Group"))
|
148
|
+
});
|
149
|
+
|
150
|
+
return actions;
|
151
|
+
};
|
152
|
+
|
153
|
+
CustomPalette.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "translate"];
|
154
|
+
|
155
|
+
CustomPalette.prototype = new F(); // 核心,将 F的实例赋值给子类;
|
156
|
+
CustomPalette.prototype.constructor = CustomPalette; // 修复子类CustomPalette的构造器指向,防止原型链的混乱;
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import { assign } from "min-dash";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* A palette provider for BPMN 2.0 elements.
|
5
|
+
*/
|
6
|
+
export default function PaletteProvider(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) {
|
7
|
+
this._palette = palette;
|
8
|
+
this._create = create;
|
9
|
+
this._elementFactory = elementFactory;
|
10
|
+
this._spaceTool = spaceTool;
|
11
|
+
this._lassoTool = lassoTool;
|
12
|
+
this._handTool = handTool;
|
13
|
+
this._globalConnect = globalConnect;
|
14
|
+
this._translate = translate;
|
15
|
+
|
16
|
+
palette.registerProvider(this);
|
17
|
+
}
|
18
|
+
|
19
|
+
PaletteProvider.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "translate"];
|
20
|
+
|
21
|
+
PaletteProvider.prototype.getPaletteEntries = function() {
|
22
|
+
var actions = {},
|
23
|
+
create = this._create,
|
24
|
+
elementFactory = this._elementFactory,
|
25
|
+
spaceTool = this._spaceTool,
|
26
|
+
lassoTool = this._lassoTool,
|
27
|
+
handTool = this._handTool,
|
28
|
+
globalConnect = this._globalConnect,
|
29
|
+
translate = this._translate;
|
30
|
+
|
31
|
+
function createAction(type, group, className, title, options) {
|
32
|
+
function createListener(event) {
|
33
|
+
var shape = elementFactory.createShape(assign({ type: type }, options));
|
34
|
+
|
35
|
+
if (options) {
|
36
|
+
shape.businessObject.di.isExpanded = options.isExpanded;
|
37
|
+
}
|
38
|
+
|
39
|
+
create.start(event, shape);
|
40
|
+
}
|
41
|
+
|
42
|
+
var shortType = type.replace(/^bpmn:/, "");
|
43
|
+
|
44
|
+
return {
|
45
|
+
group: group,
|
46
|
+
className: className,
|
47
|
+
title: title || translate("Create {type}", { type: shortType }),
|
48
|
+
action: {
|
49
|
+
dragstart: createListener,
|
50
|
+
click: createListener
|
51
|
+
}
|
52
|
+
};
|
53
|
+
}
|
54
|
+
|
55
|
+
function createSubprocess(event) {
|
56
|
+
var subProcess = elementFactory.createShape({
|
57
|
+
type: "bpmn:SubProcess",
|
58
|
+
x: 0,
|
59
|
+
y: 0,
|
60
|
+
isExpanded: true
|
61
|
+
});
|
62
|
+
|
63
|
+
var startEvent = elementFactory.createShape({
|
64
|
+
type: "bpmn:StartEvent",
|
65
|
+
x: 40,
|
66
|
+
y: 82,
|
67
|
+
parent: subProcess
|
68
|
+
});
|
69
|
+
|
70
|
+
create.start(event, [subProcess, startEvent], {
|
71
|
+
hints: {
|
72
|
+
autoSelect: [startEvent]
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
function createParticipant(event) {
|
78
|
+
create.start(event, elementFactory.createParticipantShape());
|
79
|
+
}
|
80
|
+
|
81
|
+
assign(actions, {
|
82
|
+
"hand-tool": {
|
83
|
+
group: "tools",
|
84
|
+
className: "bpmn-icon-hand-tool",
|
85
|
+
title: translate("Activate the hand tool"),
|
86
|
+
action: {
|
87
|
+
click: function(event) {
|
88
|
+
handTool.activateHand(event);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
},
|
92
|
+
"lasso-tool": {
|
93
|
+
group: "tools",
|
94
|
+
className: "bpmn-icon-lasso-tool",
|
95
|
+
title: translate("Activate the lasso tool"),
|
96
|
+
action: {
|
97
|
+
click: function(event) {
|
98
|
+
lassoTool.activateSelection(event);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
},
|
102
|
+
"space-tool": {
|
103
|
+
group: "tools",
|
104
|
+
className: "bpmn-icon-space-tool",
|
105
|
+
title: translate("Activate the create/remove space tool"),
|
106
|
+
action: {
|
107
|
+
click: function(event) {
|
108
|
+
spaceTool.activateSelection(event);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
},
|
112
|
+
"global-connect-tool": {
|
113
|
+
group: "tools",
|
114
|
+
className: "bpmn-icon-connection-multi",
|
115
|
+
title: translate("Activate the global connect tool"),
|
116
|
+
action: {
|
117
|
+
click: function(event) {
|
118
|
+
globalConnect.toggle(event);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
},
|
122
|
+
"tool-separator": {
|
123
|
+
group: "tools",
|
124
|
+
separator: true
|
125
|
+
},
|
126
|
+
"create.start-event": createAction("bpmn:StartEvent", "event", "bpmn-icon-start-event-none", translate("Create StartEvent")),
|
127
|
+
"create.intermediate-event": createAction(
|
128
|
+
"bpmn:IntermediateThrowEvent",
|
129
|
+
"event",
|
130
|
+
"bpmn-icon-intermediate-event-none",
|
131
|
+
translate("Create Intermediate/Boundary Event")
|
132
|
+
),
|
133
|
+
"create.end-event": createAction("bpmn:EndEvent", "event", "bpmn-icon-end-event-none", translate("Create EndEvent")),
|
134
|
+
"create.exclusive-gateway": createAction("bpmn:ExclusiveGateway", "gateway", "bpmn-icon-gateway-none", translate("Create Gateway")),
|
135
|
+
"create.user-task": createAction("bpmn:UserTask", "activity", "bpmn-icon-user-task", translate("Create User Task")),
|
136
|
+
"create.data-object": createAction("bpmn:DataObjectReference", "data-object", "bpmn-icon-data-object", translate("Create DataObjectReference")),
|
137
|
+
"create.data-store": createAction("bpmn:DataStoreReference", "data-store", "bpmn-icon-data-store", translate("Create DataStoreReference")),
|
138
|
+
"create.subprocess-expanded": {
|
139
|
+
group: "activity",
|
140
|
+
className: "bpmn-icon-subprocess-expanded",
|
141
|
+
title: translate("Create expanded SubProcess"),
|
142
|
+
action: {
|
143
|
+
dragstart: createSubprocess,
|
144
|
+
click: createSubprocess
|
145
|
+
}
|
146
|
+
},
|
147
|
+
"create.participant-expanded": {
|
148
|
+
group: "collaboration",
|
149
|
+
className: "bpmn-icon-participant",
|
150
|
+
title: translate("Create Pool/Participant"),
|
151
|
+
action: {
|
152
|
+
dragstart: createParticipant,
|
153
|
+
click: createParticipant
|
154
|
+
}
|
155
|
+
},
|
156
|
+
"create.group": createAction("bpmn:Group", "artifact", "bpmn-icon-group", translate("Create Group"))
|
157
|
+
});
|
158
|
+
|
159
|
+
return actions;
|
160
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// import translations from "./zh";
|
2
|
+
//
|
3
|
+
// export default function customTranslate(template, replacements) {
|
4
|
+
// replacements = replacements || {};
|
5
|
+
//
|
6
|
+
// // Translate
|
7
|
+
// template = translations[template] || template;
|
8
|
+
//
|
9
|
+
// // Replace
|
10
|
+
// return template.replace(/{([^}]+)}/g, function(_, key) {
|
11
|
+
// let str = replacements[key];
|
12
|
+
// if (
|
13
|
+
// translations[replacements[key]] !== null &&
|
14
|
+
// translations[replacements[key]] !== "undefined"
|
15
|
+
// ) {
|
16
|
+
// // eslint-disable-next-line no-mixed-spaces-and-tabs
|
17
|
+
// str = translations[replacements[key]];
|
18
|
+
// // eslint-disable-next-line no-mixed-spaces-and-tabs
|
19
|
+
// }
|
20
|
+
// return str || "{" + key + "}";
|
21
|
+
// });
|
22
|
+
// }
|
23
|
+
|
24
|
+
export default function customTranslate(translations) {
|
25
|
+
return function(template, replacements) {
|
26
|
+
replacements = replacements || {};
|
27
|
+
// Translate
|
28
|
+
template = translations[template] || template;
|
29
|
+
|
30
|
+
// Replace
|
31
|
+
return template.replace(/{([^}]+)}/g, function(_, key) {
|
32
|
+
let str = replacements[key];
|
33
|
+
if (translations[replacements[key]] !== null && translations[replacements[key]] !== undefined) {
|
34
|
+
// eslint-disable-next-line no-mixed-spaces-and-tabs
|
35
|
+
str = translations[replacements[key]];
|
36
|
+
// eslint-disable-next-line no-mixed-spaces-and-tabs
|
37
|
+
}
|
38
|
+
return str || "{" + key + "}";
|
39
|
+
});
|
40
|
+
};
|
41
|
+
}
|