import { PinEntity } from "../../dist/ueblueprint" import Template from "./Template" export default class NodeTemplate extends Template { /** * Computes the html content of the target element. * @param {HTMLElement} entity Entity representing the element * @returns The computed html */ header(entity) { return `
${entity.graphNodeName}
` } /** * Computes the html content of the target element. * @param {import("../entity/ObjectEntity").default} entity Entity representing the element * @returns The computed html */ body(entity) { let inputs = entity.CustomProperties.filter(v => v instanceof PinEntity) let outputs = inputs.filter(v => v.isOutput()) inputs = inputs.filter(v => !v.isOutput()) return `
${inputs.map((input, index) => `
${input.name}
`).join("") ?? ""}
${outputs.map((output, index) => `
${output.name}
`).join("") ?? ''}
` } /** * Computes the html content of the target element. * @param {HTMLElement} entity Entity representing the element * @returns The computed html */ render(entity) { return `
${this.header(entity)} ${this.body(entity)}
` } }