UNPKG

@aplus-frontend/ui

Version:

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