@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
49 lines (48 loc) • 1.39 kB
JavaScript
var l = Object.defineProperty;
var m = (a, e, t) => e in a ? l(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
var r = (a, e, t) => m(a, typeof e != "symbol" ? e + "" : e, t);
import { NeonEventBus as i } from "../../common/event/NeonEventBus.es.js";
import { nextTick as v } from "vue";
const s = class s {
/**
* Show a dialog message.
*
* @param dialog the dialog message to display.
*/
static async show(e) {
return s.resolve(!1), await v(), s.emit(e), new Promise(
(t) => i.on(this.resolveEventKey, (o) => {
t(o);
})
);
}
/**
* Trigger a resolution of the show dialog promise.
*
* @param key boolean value to resolve the promise.
*/
static resolve(e) {
i.emit(s.resolveEventKey, e);
}
/**
* Generate an event key so that all events are published on the correct topic.
* @returns The event key for sending a message on <a href="/utils/common/event/NeonEventBus">NeonEventBus</a>.
*/
static generateEventKey() {
return `${i.messagePrefix}-dialog`;
}
static emit(e) {
const t = s.generateEventKey();
i.emit(t, e);
}
};
r(s, "resolveEventKey", `${i.messagePrefix}-dialog-resolve`), r(s, "defaultDialogMessage", {
open: !1,
title: "",
question: ""
});
let n = s;
export {
n as NeonDialogService
};
//# sourceMappingURL=NeonDialogService.es.js.map