|
|
|
@ -27,7 +27,7 @@ export class Dialog extends HTMLElement {
|
|
|
|
const style = document.createElement('style')
|
|
|
|
const style = document.createElement('style')
|
|
|
|
style.textContent = `
|
|
|
|
style.textContent = `
|
|
|
|
dialog {
|
|
|
|
dialog {
|
|
|
|
margin-top: 120px;
|
|
|
|
margin-top: var(--margin-top, --120px);
|
|
|
|
min-width: 200px;
|
|
|
|
min-width: 200px;
|
|
|
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
|
|
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
|
|
|
border-radius: 6px;
|
|
|
|
border-radius: 6px;
|
|
|
|
@ -59,8 +59,8 @@ export class Dialog extends HTMLElement {
|
|
|
|
this.footerEl.setAttribute('part', 'footer')
|
|
|
|
this.footerEl.setAttribute('part', 'footer')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open() {
|
|
|
|
open(anchor = undefined) {
|
|
|
|
this.dialogEl.showModal();
|
|
|
|
this.dialogEl.showModal()
|
|
|
|
this.dialogEl.classList.add('opened')
|
|
|
|
this.dialogEl.classList.add('opened')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +70,7 @@ export class Dialog extends HTMLElement {
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.dialogEl.close()
|
|
|
|
this.dialogEl.close()
|
|
|
|
this.dialogEl.classList.remove('closing')
|
|
|
|
this.dialogEl.classList.remove('closing')
|
|
|
|
}, 500)
|
|
|
|
}, 350)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
clickedInside(e, el) {
|
|
|
|
clickedInside(e, el) {
|
|
|
|
@ -82,4 +82,12 @@ export class Dialog extends HTMLElement {
|
|
|
|
e.clientX <= rect.left + rect.width
|
|
|
|
e.clientX <= rect.left + rect.width
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set top(v) {
|
|
|
|
|
|
|
|
style.setProperty('--margin-top', `${v}px`)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get top() {
|
|
|
|
|
|
|
|
return style.getProperty('--margin-top')
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|