tianheng-ui 0.0.56 → 0.0.57
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/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
- package/lib/{c755e7fc08446566ee8dd3a8aa8fe43f.js → 2d84c80112a372bc149cad3464e90fa3.js} +404 -502
- 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/index.js +4 -2
- 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/{iconfont.eot → theme-chalk/fonts/iconfont.eot} +0 -0
- package/lib/{iconfont.svg → theme-chalk/fonts/iconfont.svg} +0 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/images/notData.png +0 -0
- package/lib/theme-chalk/index.scss +29 -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 +59 -0
- package/lib/theme-chalk/styles/empty.scss +22 -0
- package/lib/theme-chalk/styles/feature.scss +42 -0
- package/lib/theme-chalk/styles/font.css +7 -0
- package/lib/theme-chalk/{icon.css → styles/icon.css} +3 -3
- 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 +8 -0
- package/lib/theme-chalk/{root.css → styles/root.css} +2 -35
- package/lib/theme-chalk/styles/row.scss +23 -0
- package/lib/theme-chalk/styles/variable.scss +80 -0
- package/lib/tianheng-ui.js +71 -9
- package/package.json +24 -4
- 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 → Cell}/index.js +0 -0
- package/packages/Cell/index.vue +68 -0
- package/packages/{codeEditor → CodeEditor}/index.js +0 -0
- package/packages/{codeEditor → CodeEditor}/index.vue +73 -108
- package/packages/Col/index.js +8 -0
- package/packages/Col/index.vue +41 -0
- package/packages/{dialog → Dialog}/index.js +0 -0
- package/packages/{dialog → Dialog}/index.vue +19 -10
- package/packages/Empty/images/notData.png +0 -0
- package/packages/{empty → Empty}/index.js +0 -0
- package/packages/Empty/index.vue +35 -0
- package/packages/FormMaking/Container.vue +1907 -0
- package/packages/{formMaking → FormMaking}/FormConfig.vue +22 -6
- package/packages/FormMaking/GenerateForm.vue +246 -0
- package/packages/{formMaking → FormMaking}/GenerateFormItem.vue +340 -172
- package/packages/FormMaking/GenerateFormItemH5.vue +828 -0
- package/packages/{formMaking → FormMaking}/Upload/index.vue +0 -0
- package/packages/FormMaking/WidgetConfig.vue +473 -0
- package/packages/{formMaking → FormMaking}/WidgetForm.vue +49 -31
- package/packages/FormMaking/WidgetFormItem.vue +157 -0
- package/packages/{formMaking/componentsConfig.js → FormMaking/custom/config.js} +379 -163
- 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 +144 -0
- package/packages/FormMaking/custom/configs/cascader.vue +182 -0
- package/packages/FormMaking/custom/configs/cell.vue +81 -0
- package/packages/FormMaking/custom/configs/checkbox.vue +237 -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 +52 -0
- package/packages/FormMaking/custom/configs/grid.vue +103 -0
- package/packages/FormMaking/custom/configs/image.vue +148 -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 +215 -0
- package/packages/FormMaking/custom/configs/rate.vue +109 -0
- package/packages/FormMaking/custom/configs/select.vue +308 -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 +150 -0
- package/packages/FormMaking/custom/index.js +33 -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 +129 -0
- package/packages/FormMaking/custom/items/image.vue +42 -0
- package/packages/FormMaking/custom/items/input.vue +36 -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 +83 -0
- package/packages/FormMaking/custom/mixins/index.js +61 -0
- package/packages/FormMaking/custom/register.js +18 -0
- package/packages/{formMaking → FormMaking}/iconfont/demo.css +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/demo_index.html +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.css +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.eot +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.js +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.svg +0 -0
- package/{lib → packages/FormMaking/iconfont}/iconfont.ttf +0 -0
- package/{lib → packages/FormMaking/iconfont}/iconfont.woff +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.woff2 +0 -0
- package/packages/FormMaking/index.js +35 -0
- package/packages/{formMaking → FormMaking}/lang/en-US.js +1 -1
- package/packages/{formMaking → FormMaking}/lang/zh-CN.js +1 -1
- package/packages/{formMaking → FormMaking}/styles/cover.scss +1 -1
- package/packages/{formMaking → FormMaking}/styles/index.scss +445 -429
- package/packages/{formMaking → FormMaking/util}/generateCode.js +5 -5
- package/packages/{formMaking → FormMaking}/util/index.js +0 -0
- package/packages/{formMaking → FormMaking}/util/request.js +0 -0
- package/packages/{icons → Icons}/index.js +0 -0
- package/packages/{icons → Icons}/index.vue +26 -9
- 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 +35 -0
- package/packages/{table → Table}/action.js +0 -0
- package/packages/{table → Table}/action.vue +1 -1
- package/packages/Table/column.vue +63 -0
- package/packages/{table → Table}/index.js +0 -0
- package/packages/{table → Table}/index.vue +25 -23
- package/packages/{table → Table}/search.js +0 -0
- package/packages/{table → Table}/search.vue +2 -2
- package/packages/{table → Table}/tools.js +0 -0
- package/packages/{table → Table}/tools.vue +0 -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 +26 -0
- package/packages/Workflow/index.vue +394 -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 +247 -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 +62 -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/upload/ajax.js +85 -0
- package/packages/upload/index.js +8 -0
- package/packages/upload/index.vue +325 -0
- package/packages/upload/locale.js +9 -0
- package/packages/upload/upload-dragger.vue +70 -0
- package/packages/upload/upload-list.vue +101 -0
- package/packages/upload/upload.vue +211 -0
- package/lib/03250ed25fc1b305e9980cf7cf0dfb09.js +0 -1
- package/lib/theme-chalk/cell.css +0 -53
- package/lib/theme-chalk/dialog.css +0 -41
- package/lib/theme-chalk/empty.css +0 -27
- package/lib/theme-chalk/index.css +0 -6
- package/lib/theme-chalk/reset.css +0 -4
- package/lib/tianheng-ui.js.map +0 -1
- package/packages/cell/index.vue +0 -116
- package/packages/empty/index.vue +0 -33
- package/packages/formMaking/Container.vue +0 -591
- package/packages/formMaking/CusDialog.vue +0 -134
- package/packages/formMaking/GenerateForm.vue +0 -174
- package/packages/formMaking/WidgetConfig.vue +0 -1539
- package/packages/formMaking/WidgetFormItem.vue +0 -817
- package/packages/formMaking/iconfont/iconfont.ttf +0 -0
- package/packages/formMaking/iconfont/iconfont.woff +0 -0
- package/packages/formMaking/index.js +0 -77
- package/packages/table/column.vue +0 -111
@@ -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
|
+
}
|