|
|
const e="1345a30b-48f0-429a-8b80-e16627d8752a",a="custom-cylinde-node",t="圆柱体",n='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1687767218740" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3382" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M843.1864 216.860073c-8.723685-41.122583-43.780109-78.319763-100.925621-106.317421-61.84658-30.297027-143.617955-46.985104-230.265384-46.985104-86.641289 0-168.412664 16.687054-230.259244 46.985104-57.155744 27.998681-92.201935 65.195861-100.925621 106.317421h-2.166339v590.273714h2.166339c8.723685 41.12463 43.769876 78.326926 100.925621 106.323561 61.84658 30.29498 143.617955 46.986127 230.259244 46.986127 86.647429 0 168.417781-16.691147 230.265384-46.986127 57.155744-27.996634 92.201935-65.199954 100.925621-106.323561h2.166339v-590.273714h-2.166339zM724.283336 876.765681c-56.356542 27.608801-131.74965 42.821271-212.286918 42.821271-80.533175 0-155.925259-15.211447-212.282824-42.821271-50.975998-24.974811-80.213903-57.795311-80.213903-90.057085 0-32.259728 29.236881-65.080228 80.213903-90.055039 56.357566-27.608801 131.74965-42.823318 212.282824-42.823318 80.537268 0 155.930375 15.213493 212.286918 42.823318 50.977022 24.974811 80.213903 57.795311 80.213903 90.055039 0 32.262798-29.236881 65.082274-80.213903 90.057085z m80.213903-174.960801c-16.229636-15.431457-37.09178-29.526477-62.235437-41.844013-61.84658-30.29498-143.617955-46.984081-230.265384-46.984081-86.641289 0-168.412664 16.689101-230.259244 46.984081-25.143657 12.317537-46.0058 26.412556-62.236459 41.844013V322.193073c16.23066 15.427364 37.092803 29.53057 62.236459 41.848107 61.84658 30.29498 143.617955 46.985104 230.259244 46.985104 86.637196 0 168.417781-16.689101 230.265384-46.985104 25.143657-12.317537 46.0058-26.420743 62.235437-41.848107v379.611807z m-80.213903-374.45946c-56.356542 27.611871-131.74965 42.819225-212.286918 42.819224-80.533175 0-155.925259-15.207353-212.282824-42.819224-50.975998-24.971741-80.213903-57.796334-80.213903-90.055039 0-32.258705 29.236881-65.084321 80.213903-90.056062 56.357566-27.611871 131.74965-42.819225 212.282824-42.819224 80.537268 0 155.930375 15.207353 212.286918 42.819224 50.977022 24.971741 80.213903 57.796334 80.213903 90.056062 0 32.257681-29.236881 65.081251-80.213903 90.055039z" fill="#707070" p-id="3383"></path></svg>',l="svg",i="基础",o="基础图形",r=!1,u=!0,d="基础图形",s=`{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:1954dc15dd5b","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:656efdb758ad","step":1,"suffix":"px","placeholder":"组件宽度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelClassName":"w-8","labelAlign":"left","precision":2,"inputClassName":"w-full"}],"id":"u:4274c47a4ef5","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:1ed6dcd98c1a","step":1,"suffix":"px","placeholder":"组件高度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelAlign":"left","labelClassName":"w-8","precision":2,"inputClassName":"w-full"}],"id":"u:3e9d1e71a69f","md":6}]},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:dcc0c21d16
"nodes": [ { "id": "086fff82-e8bf-42d5-83d7-cc111b7696cb", "type": "custom-cylinde-node", "x": 200, "y": 200, "text": { "value": "", "x": 200, "y": 200 }, "properties": { "id": "086fff82-e8bf-42d5-83d7-cc111b7696cb", "width": 100, "height": 100, "x": 200, "y": 200, "rotation": 0, "opacity": 1, "strokeWidth": 1, "showDefaultValue": false, "showUnit": false, "fontSize": 12, "nodeAlias": "圆柱体", "dynamic": { "normalData": { "dataPoint": "", "compareType": "", "conditionVariables": [], "defaultValue": "[{ \\"val\\": 0.00 }]", "unit": "" }, "eventsData": { "eventCombo": [ { "eventType": "click", "enable": false, "config": "{\\"globalInputParamsCalculated\\":[],\\"device\\":\\"\\",\\"command\\":\\"\\",\\"eventAction\\":\\"sendCommand\\",\\"dataPointParamsCalculate\\":\\"return [\\\\n {\\\\n key: \\\\\\"\\\\\\",\\\\n value: ''\\\\n }\\\\n]\\",\\"sendCommandMethod\\":\\"config\\",\\"inputParamsCalculate\\":\\"// console.log('deviceInfo', deviceInfo, 'command', command, 'event', event);\\\\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\\\\nconst condition = {\\\\n deviceName: deviceInfo.code,\\\\n attrCode: command.controlDeviceAttr,\\\\n value: event == 0 ? 1 : event == 1 ? 0 : event\\\\n}\\\\nreturn {\\\\n \\\\\\"condition\\\\\\": JSON.stringify(condition),\\\\n \\\\\\"controlId\\\\\\": command.id\\\\n}\\",\\"requestMethod\\":\\"post\\",\\"requestUrl\\":\\"/thing/device/control/control\\"}"
}, { "eventType": "dblClick", "enable": false, "config": "" } ] }, "uiData": { "dataPoint": "", "compareType": "", "conditionVariables": [] }, "animationData": { "animationCombo": [ { "min": "", "max": "", "animationName": "旋转", "animationTime": 3 } ] }, "hiddenData": { "hiddenCombo": [ { "dataPoint": "", "min": "", "max": "", "showOrHiddenName": "隐藏" } ] } } } } ]}`,javascript:`// 圆柱体
class CylindeModel extends RectResize.model { realValue = ''
initNodeData(data) { super.initNodeData(data) const { properties } = this; this.width = properties.width || 100; this.height = properties.height || 100; this.text.editable = false; // 不允许文本被编辑
window.nodeEventsListeners(this); }
setAttributes() { const { x, y, properties } = this; const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties; const { normalData } = dynamic || {}; let textValue = properties.content || ''; if (normalData) { const { defaultValue } = normalData || {} const realValue = window.resolveScadaNewValue(defaultValue) this.realValue = realValue const { showDefaultValue, showUnit } = properties if(showDefaultValue) { textValue += ' ' + realValue } if (showUnit) { textValue += ' ' + normalData.unit } } this.text = { ...this.text, x: x + textHorizontalMove, y: y + textVerticalMove, value: textValue, } }
getNodeStyle() { const style = super.getNodeStyle(); const { properties } = this;
style.fill = properties.fill || style.fill;
window.changeBackgroundColor(style, properties);
style.stroke = properties.strokeColor || style.stroke; style.strokeWidth = properties.strokeWidth || style.strokeWidth; style.opacity = properties.opacity || 1; return style; }
getTextStyle() { const style = super.getTextStyle(); const { properties } = this; style.color = properties.fontColor || style.color; style.fontSize = properties.fontSize || style.fontSize; const fontStyle = properties.fontStyle; if(fontStyle) { if (fontStyle.includes('bold')) { style.fontWeight = 'bolder'; } if(fontStyle.includes('italic')) { style.fontStyle = 'italic' } if (fontStyle.includes('underline,line-through')) { style.textDecoration = 'underline line-through' } else if (fontStyle.includes('line-through,underline')) { style.textDecoration = 'line-through underline' } else if (fontStyle.includes('underline')) { style.textDecoration = 'underline' } else if (fontStyle.includes('line-through')) { style.textDecoration = 'line-through' } } window.changeFontColor(style, properties); return style; }
getResizeOutlineStyle() { return { stroke: "#00ffff", strokeWidth: 1, strokeDasharray: "none", }; }}
class CylindeView extends RectResize.view { getResizeShape () { const { x, y, width, height } = this.props.model const style = this.props.model.getNodeStyle() // 圆柱体顶部椭圆
const ellipseAAttrs = { ...style, cx: x, cy: y - 1/3 * height, rx: 1/2 * width, ry: 1/6 * height, width, height } // 圆柱体左直线
const pathAAttrs = { ...style, d: \`M \${x - 1/2 * width} \${y - 1/3 * height} L \${x - 1/2 * width} \${y + 1/3 * height}\`
} // 圆柱体右直线
const pathBAttrs = { ...style, d: \`M \${x + 1/2 * width} \${y - 1/3 * height} L \${x + 1/2 * width} \${y + 1/3 * height}\`
} // 圆柱体下椭圆
const ellipseBAttrs = { ...style, cx: x, cy: y + 1/3 * height, rx: 1/2 * width, ry: 1/6 * height, width, height } // 圆柱体中间填充部分
const rectAttrs = { ...style, x: x - 1/2 * width, y: y - 1/3 * height, width, height: 2/3 * height, stroke: 'transparent' } return h('g', {}, [ h('ellipse', { ...ellipseBAttrs }), h('rect', { ...rectAttrs }), h('path', { ...pathAAttrs }), h('path', { ...pathBAttrs }), h('ellipse', { ...ellipseAAttrs }) ]) }}
lf.register({ type: 'custom-cylinde-node', model: CylindeModel, view: CylindeView})`,css:""},m={id:e,name:a,aliasName:t,image:n,imageType:l,groupName:i,groupType:o,isRemote:!1,isDefault:!0,sectionType:d,config:s,files:c};export{t as aliasName,s as config,m as default,c as files,i as groupName,o as groupType,e as id,n as image,l as imageType,u as isDefault,r as isRemote,a as name,d as sectionType};
|