Window introduced

This commit is contained in:
barsdeveloper
2022-09-24 20:27:52 +02:00
parent bf2c3ec939
commit 9a4d323a87
27 changed files with 891 additions and 312 deletions

View File

@@ -0,0 +1,41 @@
import Configuration from "../Configuration"
import ISelectableDraggableElement from "./ISelectableDraggableElement"
import WindowTemplate from "../template/WindowTemplate"
/** @extends {ISelectableDraggableElement<Object, WindowTemplate>} */
export default class WindowElement extends ISelectableDraggableElement {
static #typeTemplateMap = {
"window": WindowTemplate,
}
static properties = {
...ISelectableDraggableElement.properties,
type: {
type: String,
attribute: "data-type",
reflect: true,
},
}
constructor(properties = {}) {
properties.type ??= "window"
super({}, new WindowElement.#typeTemplateMap[properties.type]())
this.type = properties.type
}
disconnectedCallback() {
super.disconnectedCallback()
this.dispatchCloseEvent()
}
dispatchCloseEvent(value) {
let deleteEvent = new CustomEvent(Configuration.windowCloseEventName, {
bubbles: true,
cancelable: true,
})
this.dispatchEvent(deleteEvent)
}
}
customElements.define("ueb-window", WindowElement)