[Bug报告]:
作者: hg2370634854创建于 2026年1月22日更新于 2026年1月30日
标签status: todotype:feature-requirecore: anchorpriority:P2
class BaseFlowNodeView extends HtmlNode {
setHtml(rootEl) {
const model = this.props.model
const { id, containerClassName, mainColor, secondaryColor, icon, height } = model
// root container
const container = document.createElement("div")
container.className = `node-container ${containerClassName}`
container.style = `border: 1.5px solid ${mainColor}`
container.id = id
// header
const header = document.createElement("div")
header.className = 'header'
header.style = `
background-color: ${secondaryColor};
border-bottom: 1px solid ${secondaryColor};
`
const headerIcon = document.createElement('i')
headerIcon.style = `color: ${mainColor}`
headerIcon.className = 'icon'
headerIcon.innerHTML = icon
header.appendChild(headerIcon)
const headerTitle = document.createElement("div")
headerTitle.className = 'title';
headerTitle.style = `color: ${mainColor}`;
headerTitle.innerText = model.getProperties().title || ''
header.appendChild(headerTitle)
container.appendChild(header)
// main content area
const body = document.createElement("div")
body.className = 'body'
const main = this.getMain()
if (main) {
body.appendChild(main)
}
container.appendChild(body)
rootEl.innerHTML = ''
rootEl.appendChild(container)
const updateProperties = this.getUpdateProperties();
const newHeight = document.getElementById(id).getBoundingClientRect().height
if (height != newHeight) {
updateProperties.height = newHeight
}
model.setProperties(updateProperties)
}
getUpdateProperties() {
return {}
}
getRelativePosition(element, container) {
const elemRect = element.getBoundingClientRect();
const containerRect = container.getBoundingClientRect();
const relativeX = elemRect.left - containerRect.left;
const relativeY = elemRect.top - containerRect.top;
return { x: relativeX, y: relativeY };
}}
内容来源: didi/LogicFlow