Sidebar-FoodProcessingComponent.js
5.24 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
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
(function () {
// Adds Atlassian shapes
// foodProcessing label
Sidebar.prototype.addThingsKitFoodProcessingPalette = function () {
const gn = 'mxgraph.foodProcessing';
const dt = 'foodProcessing';
const label = '食品加工'
const width = 66;
const height = 74;
const prefix = `image;image=${window?.PROJECT_ENV.base}/webapp/images/thingskit/libs/`
const defaultStyle = ';imageAspect=0;'
this.setCurrentSearchEntryLibrary(dt);
const { COMPONENT_KEY, CATEGORY } = window.CellAttributeKeyEnum
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
}
// 自定义属性
const cellAttribute = {
[COMPONENT_KEY]: 'Image',
[CATEGORY]: 'DEFAULT'
}
const graphPathLib = [
{ name: '不锈钢减速机 1.svg', path: 'foodProcessing/不锈钢减速机 1.svg' },
{ name: '不锈钢减速机 2.svg', path: 'foodProcessing/不锈钢减速机 2.svg' },
{ name: '不锈钢搅拌机 (关).svg', path: 'foodProcessing/不锈钢搅拌机 (关).svg' },
{ name: '不锈钢搅拌机(开).svg', path: 'foodProcessing/不锈钢搅拌机(开).svg' },
{ name: '不锈钢料斗.svg', path: 'foodProcessing/不锈钢料斗.svg' },
{ name: '交叉带分隔符.svg', path: 'foodProcessing/交叉带分隔符.svg' },
{ name: '内联搅拌机乳化器.svg', path: 'foodProcessing/内联搅拌机乳化器.svg' },
{ name: '分离器.svg', path: 'foodProcessing/分离器.svg' },
{ name: '制氮机.svg', path: 'foodProcessing/制氮机.svg' },
{ name: '卫生内联混合器.svg', path: 'foodProcessing/卫生内联混合器.svg' },
{ name: '卫生加热器.svg', path: 'foodProcessing/卫生加热器.svg' },
{ name: '卫生输送泵.svg', path: 'foodProcessing/卫生输送泵.svg' },
{ name: '发酵.svg', path: 'foodProcessing/发酵.svg' },
{ name: '啤酒瓶.svg', path: 'foodProcessing/啤酒瓶.svg' },
{ name: '啤酒罐.svg', path: 'foodProcessing/啤酒罐.svg' },
{ name: '固化炉系统.svg', path: 'foodProcessing/固化炉系统.svg' },
{ name: '壳管换热器.svg', path: 'foodProcessing/壳管换热器.svg' },
{ name: '奶瓶用纸板.svg', path: 'foodProcessing/奶瓶用纸板.svg' },
{ name: '微流量计.svg', path: 'foodProcessing/微流量计.svg' },
{ name: '托盘封口机.svg', path: 'foodProcessing/托盘封口机.svg' },
{ name: '批处理流化床处理器.svg', path: 'foodProcessing/批处理流化床处理器.svg' },
{ name: '搅拌器.svg', path: 'foodProcessing/搅拌器.svg' },
{ name: '标准丝带搅拌机.svg', path: 'foodProcessing/标准丝带搅拌机.svg' },
{ name: '浆料除铁器.svg', path: 'foodProcessing/浆料除铁器.svg' },
{ name: '浓缩物分配器.svg', path: 'foodProcessing/浓缩物分配器.svg' },
{ name: '涡轮乳化剂.svg', path: 'foodProcessing/涡轮乳化剂.svg' },
{ name: '淬火和回火系统.svg', path: 'foodProcessing/淬火和回火系统.svg' },
{ name: '混台漏斗.svg', path: 'foodProcessing/混台漏斗.svg' },
{ name: '清洁空气过滤器.svg', path: 'foodProcessing/清洁空气过滤器.svg' },
{ name: '真空填充机.svg', path: 'foodProcessing/真空填充机.svg' },
{ name: '真空搅拌混合机.svg', path: 'foodProcessing/真空搅拌混合机.svg' },
{ name: '真空系统.svg', path: 'foodProcessing/真空系统.svg' },
{ name: '立式搅拌机.svg', path: 'foodProcessing/立式搅拌机.svg' },
{ name: '筛选机.svg', path: 'foodProcessing/筛选机.svg' },
{ name: '管传热器中的管.svg', path: 'foodProcessing/管传热器中的管.svg' },
{ name: '粉液搅拌机.svg', path: 'foodProcessing/粉液搅拌机.svg' },
{ name: '粘度计.svg', path: 'foodProcessing/粘度计.svg' },
{ name: '细颈瓶.svg', path: 'foodProcessing/细颈瓶.svg' },
{ name: '细颈瓶2.svg', path: 'foodProcessing/细颈瓶2.svg' },
{ name: '胶体磨.svg', path: 'foodProcessing/胶体磨.svg' },
{ name: '谷粮仓 1.svg', path: 'foodProcessing/谷粮仓 1.svg' },
{ name: '谷粮仓 2.svg', path: 'foodProcessing/谷粮仓 2.svg' },
{ name: '超细大豆处理系统.svg', path: 'foodProcessing/超细大豆处理系统.svg' },
{ name: '过滤系统.svg', path: 'foodProcessing/过滤系统.svg' },
{ name: '过滤装置.svg', path: 'foodProcessing/过滤装置.svg' },
{ name: '食品加工.svg', path: 'foodProcessing/食品加工.svg' },
{ name: '鼓形磁铁.svg', path: 'foodProcessing/鼓形磁铁.svg' },
]
const fns = graphPathLib.map(item => {
return this.addEntry(this.getTagsForStencil(gn, item.name, dt).join(' '), mxUtils.bind(this, function () {
const cell = new mxCell(createUserObject(cellAttribute), new mxGeometry(0, 0, width, height), `${ prefix }${ item.path }${ defaultStyle }`);
cell.setVertex(true)
return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, item.name);
}));
})
this.setGalleryLib(dt, label, graphPathLib)
this.addPaletteFunctions(dt, label, false, fns);
this.setCurrentSearchEntryLibrary();
};
})();