Sidebar-ControlComponent.js
1.57 KB
(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), true,
[
// 开关
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' }), mxResources.get('switch'), 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: mxResources.get('paramsSettings'), [COMPONENT_KEY]: 'ParameterSettings', [CATEGORY]: 'CONTROL' }), mxResources.get('paramsSettings'), null, !0, "text textbox textarea label"),
]
);
};
})();