UNPKG

ideaz-element

Version:

<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>

108 lines (107 loc) 3.26 kB
import { isVNode as _, defineComponent as P, createVNode as t, mergeProps as i } from "vue"; import { WarningFilled as S } from "@element-plus/icons-vue"; import "../../../utils/index.mjs"; import { ElButton as d, ElIcon as j, ElDialog as k } from "element-plus"; import "./hooks/index.mjs"; import { dialogProps as z } from "./props.mjs"; import { useNamespace as B } from "../../../hooks/useNamespace.mjs"; import { useLocale as E } from "../../../hooks/useLocale.mjs"; import { useDialog as F } from "./hooks/useDialog.mjs"; import { isFunction as f, isString as N } from "../../../utils/is.mjs"; function w(e) { return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !_(e); } const G = /* @__PURE__ */ P({ name: "ZDialog", props: z, emits: ["update:modelValue", "cancel", "confirm", "vanish"], setup(e, { emit: c, slots: a, expose: v }) { const { isShowDialog: r, dialogConfig: y, confirmBtnProps: u, cancelBtnProps: m, handleCancel: p, handleConfirm: g, handleClosed: C, done: b } = F(e, c), o = B("dialog"), { t: s } = E(), h = () => f(e.title) ? (l) => e.title(l) : N(e.title) ? () => t("span", { class: "el-dialog__title" }, [e.title]) : e.extend ? () => t("span", { class: "el-dialog__title" }, [s("dialog.tip")]) : a.header || a.title, V = () => { const { type: l } = e; if (e.footer === !1) return null; if (f(a.footer)) return a.footer(); if (f(e.footer)) return e.footer(); if (l === "info") { let n; return t("div", { class: o.e("footer") }, [t(d, i({ type: "primary", size: "default", onClick: g }, u.value), w(n = s("dialog.got")) ? n : { default: () => [n] })]); } return t("div", { class: o.e("footer") }, [t(d, i({ type: "default", size: "default", onClick: p }, m.value), { default: () => [m.value.label] }), t(d, i({ type: l === "warning" || l === "danger" ? l : "primary", size: "default", onClick: g }, u.value), { default: () => [u.value.label] })]); }, D = () => { var l, n; return e.type !== "normal" ? t("div", { class: o.e("content") }, [t("div", { class: o.e("container") }, [t(j, { class: [o.e("status"), o.bm("icon", e.type)] }, { default: () => [t(S, null, null)] }), t("div", { class: o.e("message") }, [t("p", null, [((l = a.default) == null ? void 0 : l.call(a)) || e.message])])])]) : (n = a.default) == null ? void 0 : n.call(a); }; return v({ isShowDialog: r, done: b }), () => t(k, i({ class: [o.b(""), e.type !== "normal" && o.b("tip"), e.footer === !1 && o.b("no-footer")] }, y.value, { modelValue: e.modelValue || r.value, "onUpdate:modelValue": (l) => { r.value = l, c("update:modelValue", l); }, onClosed: C }), { default: () => [D()], footer: () => V(), header: h() }); } }); export { G as default }; //# sourceMappingURL=index.mjs.map