ucc-ui
Version:
ucc-ui components library
100 lines (99 loc) • 3.41 kB
JavaScript
import { defineComponent as w, ref as v, computed as n, openBlock as x, createBlock as z, unref as c, mergeProps as r, withCtx as l, createElementVNode as i, normalizeStyle as N, createVNode as p, renderSlot as a, toDisplayString as m, createTextVNode as y } from "vue";
import { U as R } from "./CodeEditor-CoBtVBCt.js";
import { a as B } from "./Dialog-B5dowvNE.js";
import { U as S } from "./Button-DOc5qANu.js";
import { p as V } from "./utils-BzE2Aob-.js";
import "./ConfigProvider-C-6nRyrn.js";
const $ = { class: "u-popconfirm__content" }, I = { class: "u-popconfirm__title" }, W = { class: "u-popconfirm__actions" }, q = { class: "u-popconfirm__refrence" }, H = /* @__PURE__ */ w({
name: "UPopconfirm",
__name: "Popconfirm",
props: {
title: { default: "" },
confirmButtonText: {},
cancelButtonText: {},
confirmButtonType: {},
cancelButtonType: {},
confirmButtonProps: {},
cancelButtonProps: {},
icon: { default: "question-circle" },
iconColor: {},
hideIcon: { type: Boolean },
hideTimeout: {},
teleported: { type: Boolean },
persistent: { type: Boolean },
width: { default: 150 },
tooltipProps: { default: void 0 }
},
emits: ["confirm", "cancel"],
setup(T, { emit: h }) {
const t = T, f = v(!1), u = h, s = v(null), C = n(() => V(t.width, { unit: "rem" })), P = n(() => t.cancelButtonText ?? "取消"), U = n(() => t.confirmButtonText ?? "确定"), k = n(() => t.cancelButtonType ?? void 0), g = n(() => t.confirmButtonType ?? "primary"), d = (o) => {
var e;
(e = s.value) == null || e.onClose(), u("confirm", o);
}, _ = (o) => {
var e;
(e = s.value) == null || e.onClose(), u("cancel", o);
};
return (o, e) => (x(), z(c(R), r({
class: "u-popconfirm",
visible: f.value,
"onUpdate:visible": e[0] || (e[0] = (b) => f.value = b),
effect: "light",
trigger: "click",
ref_key: "tooltipRef",
ref: s
}, o.tooltipProps), {
content: l(() => [
i("main", {
style: N({ minWidth: C.value }),
class: "u-popconfirm__main"
}, [
i("div", $, [
p(c(S), {
class: "u-popconfirm__icon",
icon: o.icon
}, null, 8, ["icon"]),
a(o.$slots, "default", {}, () => [
i("span", I, m(o.title), 1)
])
]),
i("div", W, [
a(o.$slots, "actions", {
confirm: d,
cancel: _
}, () => [
p(c(B), r({
class: "u-popconfirm__cancel",
size: "small",
type: k.value
}, o.cancelButtonProps, { onClick: _ }), {
default: l(() => [
y(m(P.value), 1)
]),
_: 1
}, 16, ["type"]),
p(c(B), r({
class: "u-popconfirm__confirm",
size: "small",
type: g.value
}, o.confirmButtonProps, { onClick: d }), {
default: l(() => [
y(m(U.value), 1)
]),
_: 1
}, 16, ["type"])
])
])
], 4)
]),
default: l(() => [
i("div", q, [
a(o.$slots, "reference")
])
]),
_: 3
}, 16, ["visible"]));
}
});
export {
H as _
};