Sidebar-FoodProcessingComponent.js
5.87 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
103
(function () {
// Adds Atlassian shapes
// foodProcessing label
Sidebar.prototype.addThingsKitFoodProcessingPalette = function () {
const gn = 'mxgraph.foodProcessing';
const dt = 'foodProcessing';
const label = mxResources.get('foodProcessing')
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: mxResources.get('foodProcessing1'), path: 'foodProcessing/不锈钢减速机 1.svg' },
{ name: mxResources.get('foodProcessing2'), path: 'foodProcessing/不锈钢减速机 2.svg' },
{ name: mxResources.get('foodProcessing3'), path: 'foodProcessing/不锈钢搅拌机 (关).svg' },
{ name: mxResources.get('foodProcessing4'), path: 'foodProcessing/不锈钢搅拌机(开).svg' },
{ name: mxResources.get('foodProcessing5'), path: 'foodProcessing/不锈钢料斗.svg' },
{ name: mxResources.get('foodProcessing6'), path: 'foodProcessing/交叉带分隔符.svg' },
{ name: mxResources.get('foodProcessing7'), path: 'foodProcessing/内联搅拌机乳化器.svg' },
{ name: mxResources.get('foodProcessing8'), path: 'foodProcessing/分离器.svg' },
{ name: mxResources.get('foodProcessing9'), path: 'foodProcessing/制氮机.svg' },
{ name: mxResources.get('foodProcessing10'), path: 'foodProcessing/卫生内联混合器.svg' },
{ name: mxResources.get('foodProcessing11'), path: 'foodProcessing/卫生加热器.svg' },
{ name: mxResources.get('foodProcessing12'), path: 'foodProcessing/卫生输送泵.svg' },
{ name: mxResources.get('foodProcessing13'), path: 'foodProcessing/发酵.svg' },
{ name: mxResources.get('foodProcessing14'), path: 'foodProcessing/啤酒瓶.svg' },
{ name: mxResources.get('foodProcessing15'), path: 'foodProcessing/啤酒罐.svg' },
{ name: mxResources.get('foodProcessing16'), path: 'foodProcessing/固化炉系统.svg' },
{ name: mxResources.get('foodProcessing17'), path: 'foodProcessing/壳管换热器.svg' },
{ name: mxResources.get('foodProcessing18'), path: 'foodProcessing/奶瓶用纸板.svg' },
{ name: mxResources.get('foodProcessing19'), path: 'foodProcessing/微流量计.svg' },
{ name: mxResources.get('foodProcessing20'), path: 'foodProcessing/托盘封口机.svg' },
{ name: mxResources.get('foodProcessing21'), path: 'foodProcessing/批处理流化床处理器.svg' },
{ name: mxResources.get('foodProcessing22'), path: 'foodProcessing/搅拌器.svg' },
{ name: mxResources.get('foodProcessing23'), path: 'foodProcessing/标准丝带搅拌机.svg' },
{ name: mxResources.get('foodProcessing24'), path: 'foodProcessing/浆料除铁器.svg' },
{ name: mxResources.get('foodProcessing25'), path: 'foodProcessing/浓缩物分配器.svg' },
{ name: mxResources.get('foodProcessing26'), path: 'foodProcessing/涡轮乳化剂.svg' },
{ name: mxResources.get('foodProcessing27'), path: 'foodProcessing/淬火和回火系统.svg' },
{ name: mxResources.get('foodProcessing28'), path: 'foodProcessing/混台漏斗.svg' },
{ name: mxResources.get('foodProcessing29'), path: 'foodProcessing/清洁空气过滤器.svg' },
{ name: mxResources.get('foodProcessing30'), path: 'foodProcessing/真空填充机.svg' },
{ name: mxResources.get('foodProcessing31'), path: 'foodProcessing/真空搅拌混合机.svg' },
{ name: mxResources.get('foodProcessing32'), path: 'foodProcessing/真空系统.svg' },
{ name: mxResources.get('foodProcessing33'), path: 'foodProcessing/立式搅拌机.svg' },
{ name: mxResources.get('foodProcessing34'), path: 'foodProcessing/筛选机.svg' },
{ name: mxResources.get('foodProcessing35'), path: 'foodProcessing/管传热器中的管.svg' },
{ name: mxResources.get('foodProcessing36'), path: 'foodProcessing/粉液搅拌机.svg' },
{ name: mxResources.get('foodProcessing37'), path: 'foodProcessing/粘度计.svg' },
{ name: mxResources.get('foodProcessing38'), path: 'foodProcessing/细颈瓶.svg' },
{ name: mxResources.get('foodProcessing39'), path: 'foodProcessing/细颈瓶2.svg' },
{ name: mxResources.get('foodProcessing40'), path: 'foodProcessing/胶体磨.svg' },
{ name: mxResources.get('foodProcessing41'), path: 'foodProcessing/谷粮仓 1.svg' },
{ name: mxResources.get('foodProcessing42'), path: 'foodProcessing/谷粮仓 2.svg' },
{ name: mxResources.get('foodProcessing43'), path: 'foodProcessing/超细大豆处理系统.svg' },
{ name: mxResources.get('foodProcessing44'), path: 'foodProcessing/过滤系统.svg' },
{ name: mxResources.get('foodProcessing45'), path: 'foodProcessing/过滤装置.svg' },
{ name: mxResources.get('foodProcessing46'), path: 'foodProcessing/食品加工.svg' },
{ name: mxResources.get('foodProcessing47'), 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();
};
})();