Sidebar-Control-Components.js
1.15 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 () {
// Adds Atlassian shapes
// Control Component 控制元件
Sidebar.prototype.addControlComponentsPalette = function () {
const { COMPONENT_TYPE } = this.enumCellBasicAttribute
const { SWITCH } = this.enumComponentType
const gn = 'mxgraph.control';
const dt = 'control';
const label = '控制元件'
const width = 66;
const height = 74;
const staticPath = `${Proxy_Prefix}/img/lib/thingskit/`
const prefix = 'image;image=img/lib/thingskit/'
const defaultStyle = ';imageAspect=0;'
this.setCurrentSearchEntryLibrary(dt);
// 自定义属性
const cellAttribute = {
[COMPONENT_TYPE]: SWITCH
}
const fns = [
this.addEntry(this.getTagsForStencil(gn, 'Switch', dt).join(' '), mxUtils.bind(this, function () {
const cell = new mxCell('', new mxGeometry(0, 0, 48, 48), `image;image=images/thingskit/switch-on.svg;${defaultStyle}`);
cell.setVertex(true)
this.setCellAttributes(cell, cellAttribute)
return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '开关');
})),
]
this.addPaletteFunctions(dt, label, false, fns);
this.setCurrentSearchEntryLibrary();
};
})();