forked from bpmn-io/bpmn-js-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMagicPropertiesProvider.js
102 lines (80 loc) · 2.72 KB
/
MagicPropertiesProvider.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import inherits from 'inherits';
import PropertiesActivator from 'bpmn-js-properties-panel/lib/PropertiesActivator';
// Require all properties you need from existing providers.
// In this case all available bpmn relevant properties without camunda extensions.
import processProps from 'bpmn-js-properties-panel/lib/provider/bpmn/parts/ProcessProps';
import eventProps from 'bpmn-js-properties-panel/lib/provider/bpmn/parts/EventProps';
import linkProps from 'bpmn-js-properties-panel/lib/provider/bpmn/parts/LinkProps';
import documentationProps from 'bpmn-js-properties-panel/lib/provider/bpmn/parts/DocumentationProps';
import idProps from 'bpmn-js-properties-panel/lib/provider/bpmn/parts/IdProps';
import nameProps from 'bpmn-js-properties-panel/lib/provider/bpmn/parts/NameProps';
// Require your custom property entries.
import spellProps from './parts/SpellProps';
// The general tab contains all bpmn relevant properties.
// The properties are organized in groups.
function createGeneralTabGroups(element, bpmnFactory, elementRegistry, translate) {
var generalGroup = {
id: 'general',
label: 'General',
entries: []
};
idProps(generalGroup, element, translate);
nameProps(generalGroup, element, translate);
processProps(generalGroup, element, translate);
var detailsGroup = {
id: 'details',
label: 'Details',
entries: []
};
linkProps(detailsGroup, element, translate);
eventProps(detailsGroup, element, bpmnFactory, elementRegistry, translate);
var documentationGroup = {
id: 'documentation',
label: 'Documentation',
entries: []
};
documentationProps(documentationGroup, element, bpmnFactory, translate);
return[
generalGroup,
detailsGroup,
documentationGroup
];
}
// Create the custom magic tab
function createMagicTabGroups(element, elementRegistry) {
// Create a group called "Black Magic".
var blackMagicGroup = {
id: 'black-magic',
label: 'Black Magic',
entries: []
};
// Add the spell props to the black magic group.
spellProps(blackMagicGroup, element);
return [
blackMagicGroup
];
}
export default function MagicPropertiesProvider(
eventBus, bpmnFactory, elementRegistry,
translate) {
PropertiesActivator.call(this, eventBus);
this.getTabs = function(element) {
var generalTab = {
id: 'general',
label: 'General',
groups: createGeneralTabGroups(element, bpmnFactory, elementRegistry, translate)
};
// The "magic" tab
var magicTab = {
id: 'magic',
label: 'Magic',
groups: createMagicTabGroups(element, elementRegistry)
};
// Show general + "magic" tab
return [
generalTab,
magicTab
];
};
}
inherits(MagicPropertiesProvider, PropertiesActivator);