Sidebar-ControlComponent.js
1.52 KB
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
(function () {
Sidebar.prototype.addThingsKitControlComponentsPalette = function () {
this.addControlComponentsPalette()
}
const { COMPONENT_KEY, CATEGORY } = window.CellAttributeKeyEnum
const dt = 'controlComponents'
Sidebar.prototype.addControlComponentsPalette = function () {
function createUserObject(attribute) {
attribute = Object.assign({ [COMPONENT_KEY]: '', [CATEGORY]: '' }, attribute || {})
var xmlElement = mxUtils.createXmlDocument().createElement('UserObject');
Object.keys(attribute).forEach(key => {
xmlElement.setAttribute(key, attribute[key]);
})
return xmlElement
}
this.setCurrentSearchEntryLibrary(dt);
this.addPaletteFunctions(dt, mxResources.get(dt), false,
[
// 开关
this.createVertexTemplateEntry("shape=mxgraph.thingskit/switchComponent;text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=12;", 60, 60, createUserObject({ label: '', [COMPONENT_KEY]: 'Switch', [CATEGORY]: 'CONTROL' }), "开关", null, !0, "text textbox textarea label"),
// 参数设置
this.createVertexTemplateEntry("text;html=1;strokeColor=#1890ff;fillColor=#1890ff;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontColor=#FFFFFF;rounded=1;shadow=0;fontSize=12;", 60, 32, createUserObject({ label: '参数设置', [COMPONENT_KEY]: 'ParameterSettings', [CATEGORY]: 'CONTROL' }), "参数设置", null, !0, "text textbox textarea label"),
]
);
};
})();