} element */
constructed(element) {
super.constructed(element)
this.element.dataset.id = this.element.GetPinIdValue()
}
connectedCallback() {
super.connectedCallback()
this.element.nodeElement = this.element.closest("ueb-node")
}
/** @returns {IInput[]} */
createInputObjects() {
return [
new MouseCreateLink(this.getClickableElement(), this.element.blueprint, {
moveEverywhere: true,
})
]
}
render() {
const icon = html`
${this.renderIcon()}
`
const content = html`
${this.element.getPinDisplayName()}
${this.element.isInput() ? this.renderInput() : nothing}
`
return html`
${this.element.isInput() ? html`${icon}${content}` : html`${content}${icon}`}
`
}
/** @returns {TemplateResult | symbol} */
renderIcon() {
return html`
`
}
/** @returns {TemplateResult | symbol} */
renderInput() {
return nothing
}
/** @param {Map} changedProperties */
updated(changedProperties) {
if (this.element.isInput() && changedProperties.has("isLinked")) {
// When connected, an input may drop its input fields which means the node has to reflow
const node = this.element.nodeElement
node.addNextUpdatedCallbacks(() => node.dispatchReflowEvent())
node.requestUpdate()
}
}
/** @param {Map} changedProperties */
firstUpdated(changedProperties) {
this.element.style.setProperty("--ueb-pin-color-rgb", Configuration.pinColor[this.element.pinType])
}
getLinkLocation() {
const rect = this.element.querySelector(".ueb-pin-icon").getBoundingClientRect()
const location = Utility.convertLocation(
[(rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2],
this.element.blueprint.gridElement
)
return this.element.blueprint.compensateTranslation(location)
}
getClickableElement() {
return this.element
}
}