django-vue3-admin-web/node_modules/@fast-crud/fast-extends/dist/fs-copyable-07963571.mjs
2025-10-20 21:21:14 +08:00

117 lines
3.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineComponent as g, computed as c, ref as v, resolveDirective as B, openBlock as t, createElementBlock as r, normalizeClass as b, withDirectives as i, renderSlot as h, Fragment as S, createTextVNode as d, toDisplayString as m, createBlock as C, resolveDynamicComponent as M, mergeProps as V, withCtx as w, createCommentVNode as _ } from "vue";
import { useUi as k } from "@fast-crud/fast-crud";
import { merge as $ } from "lodash-es";
import { _ as D } from "./index-50ffe046.mjs";
const N = g({
name: "FsCopyable",
props: {
modelValue: {
type: [String, Number, Boolean],
default: void 0
},
/**
* 复制按钮
* show: 是否显示默认true
* text: 按钮文字
* ...其他tag组件参数
*/
button: {
type: Object,
default() {
return {};
}
},
/**
* 成功信息
*/
successMessage: {
type: [Boolean, String],
default: !0
},
/**
* 错误时的信息
*/
errorMessage: {
type: [Boolean, String],
default: !0
},
inline: {
type: Boolean,
default: !1
}
},
emits: [
"update:modelValue",
/**
* 成功事件
*/
"success",
/**
* 失败事件
*/
"error"
],
setup(e, { emit: n, slots: a }) {
const u = c(() => a.default != null), { ui: s } = k(), l = v(s.tag.name), o = c(() => {
const y = {
text: "复制",
size: "small",
[s.tag.type]: "success",
show: !0,
showOnHover: !1
};
return $({}, y, e.button);
});
function f() {
n("success"), e.successMessage && s.message.success(e.successMessage === !0 ? "复制成功" : e.successMessage);
}
function p() {
n("error"), e.errorMessage && s.message.error(e.errorMessage === !0 ? "复制失败" : e.errorMessage);
}
return {
textInSlot: u,
tagName: l,
copyButton: o,
onSuccess: f,
onError: p
};
}
});
const E = { class: "pointer text" }, O = {
key: 0,
class: "copy-button"
};
function z(e, n, a, u, s, l) {
const o = B("clipboard");
return t(), r("div", {
class: b(["fs-copyable", { "show-on-hover": e.copyButton.showOnHover, inline: e.inline }])
}, [
i((t(), r("span", E, [
e.$slots.default ? h(e.$slots, "default", { key: 0 }) : (t(), r(S, { key: 1 }, [
d(m(e.modelValue), 1)
], 64))
])), [
[o, e.modelValue],
[o, e.onSuccess, "success"],
[o, e.onError, "error"]
]),
e.modelValue != null && e.copyButton.show !== !1 ? (t(), r("div", O, [
i((t(), C(M(e.tagName), V({ class: "pointer text" }, e.copyButton), {
default: w(() => [
d(m(e.copyButton.text ?? "复制"), 1)
]),
_: 1
}, 16)), [
[o, e.modelValue],
[o, e.onSuccess, "success"],
[o, e.onError, "error"]
])
])) : _("", !0)
], 2);
}
const P = /* @__PURE__ */ D(N, [["render", z]]);
export {
P as default
};
//# sourceMappingURL=fs-copyable-07963571.mjs.map