mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-15 09:44:49 +08:00
Added template concept
This commit is contained in:
@@ -2,21 +2,24 @@
|
||||
* A Graph Entity is an element that can stay directly (as a first child) on the blueprint grid. Those entities are either nodes or links
|
||||
*/
|
||||
export default class GraphEntity extends HTMLElement {
|
||||
constructor() {
|
||||
/**
|
||||
*
|
||||
* @param {import("./template/Template").default} template The template to render this node
|
||||
*/
|
||||
constructor(template) {
|
||||
super()
|
||||
/** @type {import("./UEBlueprint").EBlueprint}" */
|
||||
this.blueprint = null
|
||||
this.template = template
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.blueprint = this.closest('u-blueprint')
|
||||
let aDiv = document.createElement('div')
|
||||
aDiv.innerHTML = this.render()
|
||||
this.appendChild(aDiv.firstElementChild)
|
||||
this.append(...this.template.getElements(this))
|
||||
}
|
||||
|
||||
// Subclasses want to rewrite this
|
||||
render() {
|
||||
return ""
|
||||
return ''
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user