Sidebar-BasicComponent.js
3.64 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
(function () {
Sidebar.prototype.addThingsKitBasicComponentsPalette = function () {
this.addBasicComponentsPalette()
}
const { COMPONENT_KEY, CATEGORY } = window.CellAttributeKeyEnum
const dt = 'basicComponents'
Sidebar.prototype.addBasicComponentsPalette = 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), true,
[
// Title组件
this.createVertexTemplateEntry("text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;", 40, 20, createUserObject({ label: 'Title', [COMPONENT_KEY]: 'Title', [CATEGORY]: 'BASIC' }), "Title", null, !0, "text textbox textarea label"),
// 变量组件
this.createVertexTemplateEntry("text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;", 40, 20, createUserObject({ label: mxResources.get('variable'), [COMPONENT_KEY]: 'Variable', [CATEGORY]: 'BASIC' }), mxResources.get('variable'), null, !0, "text textbox textarea label"),
// 水流
this.createEdgeTemplateEntry("shape=mxgraph.thingskit/waterFlowComponent;edgeStyle=orthogonalEdgeStyle;strokeColor=#409eff;strokeWidth=8;endArrow=none;dashed=1;html=1;", 200, 200, createUserObject({ [COMPONENT_KEY]: 'WaterFlow', [CATEGORY]: 'BASIC' }), mxResources.get('waters'), null, !0, ""),
// 数字时钟
this.createVertexTemplateEntry("shape=mxgraph.thingskit/digitalClockComponent;text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=16;", 250, 100, createUserObject({ label: '', [COMPONENT_KEY]: 'DigitalClock', [CATEGORY]: 'BASIC' }), mxResources.get('digitalClock'), null, !0, "digital clock"),
// 告警列表
this.createVertexTemplateEntry("shape=mxgraph.thingskit/alarmListComponent;text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=16;", 290, 230, createUserObject({ label: '', [COMPONENT_KEY]: 'AlarmList', [CATEGORY]: 'BASIC' }), mxResources.get('alarmList'), null, !0, "alarm list"),
// 视频组件
this.createVertexTemplateEntry('shape=mxgraph.thingskit/videoComponent;text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=16;', 300, 150, createUserObject({ label: '', [COMPONENT_KEY]: 'Video', [CATEGORY]: 'BASIC' }), mxResources.get('video'), null, !0, 'text textbox textarea label'),
// 变量图片组件
this.createVertexTemplateEntry('shape=mxgraph.thingskit/variableImageComponent;text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=16;', 200, 200, createUserObject({ label: '', [COMPONENT_KEY]: 'VariableImage', [CATEGORY]: 'BASIC' }), mxResources.get('variableImage'), null, !0, 'variable image'),
// 图片组件
this.createVertexTemplateEntry('shape=mxgraph.thingskit/imageComponent;text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=16;', 200, 200, createUserObject({ label: '', [COMPONENT_KEY]: 'Image', [CATEGORY]: 'BASIC' }), mxResources.get('image'), null, !0, 'image'),
]
);
this.setCurrentSearchEntryLibrary();
};
})();