sync working code, and import type-doc
This commit is contained in:
@ -38,7 +38,7 @@ function trimPx(px) {
|
||||
return px;
|
||||
}
|
||||
|
||||
class Popup {
|
||||
export class Popup {
|
||||
#mask;
|
||||
#option;
|
||||
#bounds;
|
||||
@ -116,6 +116,9 @@ class Popup {
|
||||
if (typeof this.#option.onMasking === 'function') {
|
||||
this.#option.onMasking.call(this, false);
|
||||
}
|
||||
if (typeof this.#option.resolve === 'function') {
|
||||
this.#option.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -124,7 +127,7 @@ class Popup {
|
||||
if (option.mask === false) {
|
||||
mask.classList.add('ui-popup-transparent');
|
||||
} else if (typeof option.onMasking === 'function') {
|
||||
this.#option.onMasking.call(this, true);
|
||||
option.onMasking.call(this, true);
|
||||
}
|
||||
if (!isNaN(option.zIndex)) {
|
||||
mask.style.zIndex = String(option.zIndex);
|
||||
@ -478,8 +481,6 @@ class Popup {
|
||||
}
|
||||
}
|
||||
|
||||
export default Popup;
|
||||
|
||||
export function createPopup(title, content, ...buttons) {
|
||||
const popup = new Popup({
|
||||
title,
|
||||
@ -506,6 +507,7 @@ export function showAlert(title, message, iconType = 'info', parent = document.b
|
||||
createIcon('fa-solid', iconTypes[iconType] ?? 'info-circle'),
|
||||
createElement('span', span => span.innerText = message)
|
||||
),
|
||||
resolve,
|
||||
buttons: [
|
||||
{ text: r('ok', 'OK'), trigger: resolve }
|
||||
]
|
||||
@ -529,6 +531,7 @@ export function showConfirm(title, content, buttons, iconType = 'question', pare
|
||||
const popup = new Popup({
|
||||
title,
|
||||
content: wrapper,
|
||||
resolve,
|
||||
buttons: buttons?.map(b => {
|
||||
return {
|
||||
text: b.text,
|
||||
|
Reference in New Issue
Block a user