@aplus-frontend/ui
Version:
86 lines (85 loc) • 2.78 kB
JavaScript
import { defineComponent as k, ref as g, computed as T, createElementBlock as c, openBlock as l, mergeProps as w, unref as e, createElementVNode as _, createCommentVNode as B, normalizeClass as u, createVNode as m, createSlots as O, withCtx as i, createBlock as s, resolveDynamicComponent as f, h as y } from "vue";
import { CopyOutlined as E, CheckOutlined as N } from "@ant-design/icons-vue";
import { Tooltip as d } from "@aplus-frontend/antdv";
import "../../../config-provider/index.mjs";
import { copy as V } from "../../../utils/copy.mjs";
import j from "../../style/ellipsis.mjs";
import { useNamespace as x } from "../../../config-provider/hooks/use-namespace.mjs";
import { useLocale as S } from "../../../config-provider/hooks/use-locale.mjs";
const F = /* @__PURE__ */ k({
name: "ApTableParagraphEllipsis",
__name: "index",
props: {
copyable: { type: Boolean },
content: { type: [Object, String, Number, Boolean, null, Array] },
rawValue: {},
ellipsis: { type: [Boolean, Object] }
},
setup(h) {
const t = h, { b: p } = x("ap-table-paragraph-ellipsis"), b = j("ap-table-paragraph-ellipsis"), { t: n } = S(), o = g(!1), a = T(() => t.ellipsis === !0 ? {
rows: 1,
tooltip: t.content,
htmlTitle: ""
} : typeof t.ellipsis == "object" ? Object.assign(
{
rows: 1,
tooltip: t.content,
htmlTitle: ""
},
t.ellipsis
) : {});
function v() {
const r = t.rawValue || "";
V(r) && !o.value && (o.value = !0, setTimeout(() => {
o.value = !1;
}, 2200));
}
return (r, C) => (l(), c("div", w({
class: [e(p)(), e(b)]
}, {
...r.$attrs
}, {
style: {
"--ap-table-paragraph-ellipsis-rows": a.value?.rows
}
}), [
_("div", {
class: u([e(p)("content")])
}, [
m(e(d), null, O({
default: i(() => [
(l(), s(f(
y("span", { title: a.value?.htmlTitle }, [t.content])
)))
]),
_: 2
}, [
a.value?.tooltip ? {
name: "title",
fn: i(() => [
(l(), s(f(y("div", [a.value.tooltip]))))
]),
key: "0"
} : void 0
]), 1024)
], 2),
t.copyable ? (l(), c("div", {
key: 0,
class: u([e(p)("copyable")]),
onClick: v
}, [
m(e(d), {
title: o.value ? e(n)("ap.apTable.paragraphEllipsis.copySuccess") : e(n)("ap.apTable.paragraphEllipsis.copy")
}, {
default: i(() => [
o.value ? (l(), s(e(N), { key: 1 })) : (l(), s(e(E), { key: 0 }))
]),
_: 1
}, 8, ["title"])
], 2)) : B("", !0)
], 16));
}
});
export {
F as default
};