UNPKG

vuestic-ui

Version:
48 lines (47 loc) 1.45 kB
import { c as createModalInstance } from "../modal.js"; import { d as defineVuesticPlugin } from "../../../services/vue-plugin/utils/define-vuestic-plugin.js"; import { d as defineGlobalProperty } from "../../../services/vue-plugin/utils/global-properties.js"; const createVaModalPlugin = (app) => ({ init(options) { return createModalInstance(options, app == null ? void 0 : app._context); }, confirm(options) { if (typeof options === "string") { return new Promise((resolve) => { createModalInstance({ message: options, onOk() { resolve(true); }, onCancel() { resolve(false); } }, app == null ? void 0 : app._context); }); } return new Promise((resolve) => { createModalInstance({ ...options, onOk() { var _a; (_a = options == null ? void 0 : options.onOk) == null ? void 0 : _a.call(options); resolve(true); }, onCancel() { var _a; (_a = options == null ? void 0 : options.onCancel) == null ? void 0 : _a.call(options); resolve(false); } }, app == null ? void 0 : app._context); }); } }); const VaModalPlugin = defineVuesticPlugin(() => ({ install(app) { defineGlobalProperty(app, "$vaModal", createVaModalPlugin(app)); } })); export { VaModalPlugin as V }; //# sourceMappingURL=index.js.map