|
|
const e="113bb94a-870d-42a7-8133-17634dd8015d",a="custom-actor-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="1687767926285" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="27332" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 181.333333c29.866667 0 53.333333-23.466667 53.333333-53.333333S541.866667 74.666667 512 74.666667 458.666667 98.133333 458.666667 128s23.466667 53.333333 53.333333 53.333333z m0-85.333333c17.066667 0 32 14.933333 32 32s-14.933333 32-32 32-32-14.933333-32-32 14.933333-32 32-32zM776.533333 401.066667l8.533334-21.333334-262.4-87.466666v-4.266667h-21.333334v4.266667l-262.4 87.466666 8.533334 21.333334 253.866666-85.333334v228.266667l-177.066666 356.266667 19.2 10.666666L512 571.733333l168.533333 339.2 19.2-10.666666-177.066666-356.266667V315.733333z" fill="#707070" p-id="27333"></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:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"填充","name":"fill","id":"u:0d19ed3e2bdc","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id"
"nodes": [ { "id": "7ced8c7f-d9ec-45ab-8e85-cf5eb9ea03ea", "type": "custom-actor-node", "x": 200, "y": 200, "text": { "value": "", "x": 200, "y": 200 }, "properties": { "id": "7ced8c7f-d9ec-45ab-8e85-cf5eb9ea03ea", "width": 100, "height": 100, "x": 200, "y": 200, "rotation": 0, "opacity": 1, "strokeWidth": 1, "showDefaultValue": false, "showUnit": false, "fontSize": 12, "nodeAlias": "人物", "lineHeight": 12, "fontStyle": "bold,italic,underline,line-through", "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 ActorModel 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' } }
style.fill = properties.fill || style.fill; window.changeFontColor(style, properties); return style; }
getResizeOutlineStyle() { return { stroke: "#00ffff", strokeWidth: 1, strokeDasharray: "none", }; }}
class ActorView extends RectResize.view { getResizeShape() { const { x, y, width, height } = this.props.model const style = this.props.model.getNodeStyle() // 人物头部圆形
const ellipseAttrs = { ...style, cx: x, cy: y - 3/8 * height, rx: 1/4 * width, ry: 1/8 * height, width, height } // 人物肩膀横线
const pathAAttrs = { ...style, d: \`M \${x - 1/2 * width} \${y - 1/8 * height} L \${x + 1/2 * width} \${y - 1/8 * height}\`
} // 人物身体躯干竖线
const pathBAttrs = { ...style, d: \`M \${x} \${y - 1/4 * height} L \${x} \${y + 1/5 * height}\`
} // 人物左腿斜线
const pathCAttrs = { ...style, d: \`M \${x} \${y + 1/5 * height} L \${x - 1/2 * width} \${y + 1/2 * height}\`
} // 人物右腿斜线
const pathDAttrs = { ...style, d: \`M \${x} \${y + 1/5 * height} L \${x + 1/2 * width} \${y + 1/2 * height}\`
} // 人物透明背景板
const bgAttrs = { x: x - 1/5 * width, y: y - 1/2 * height, width: 2/5 * width, height, style: 'fill: transparent' } return h('g', {}, [ h('ellipse', { ...ellipseAttrs, }), h('path', { ...pathAAttrs, }), h('path', { ...pathBAttrs }), h('path', { ...pathCAttrs }), h('path', { ...pathDAttrs }), h('rect', { ...bgAttrs }) ] ); }}
lf.register({ type: 'custom-actor-node', view: ActorView, model: ActorModel})`,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};
|