UNPKG

@aplus-frontend/ui

Version:

133 lines (132 loc) 3.85 kB
import { defineComponent as O, useSlots as $, computed as n, unref as o, createVNode as x, isVNode as z, Fragment as D, createElementBlock as p, openBlock as t, normalizeClass as a, createCommentVNode as v, createElementVNode as E, normalizeStyle as I, createBlock as c, resolveDynamicComponent as U, mergeProps as C, withCtx as d, renderSlot as r, createSlots as w, createTextVNode as F, toDisplayString as G, renderList as R, normalizeProps as _, guardReactiveProps as q } from "vue"; import { TypographyLink as H, TypographyText as J } from "@aplus-frontend/antdv"; import { isUndefined as s, omit as u, isString as K } from "lodash-unified"; import "../config-provider/index.mjs"; import "../utils/index.mjs"; import { useInjectApTextGroup as M } from "./context.mjs"; import Q from "./style/index.mjs"; import { useNamespace as W } from "../config-provider/hooks/use-namespace.mjs"; import { isDef as X } from "../utils/is.mjs"; const pe = /* @__PURE__ */ O({ name: "ApText", __name: "index", props: { ellipsis: { type: [Boolean, Object] }, delete: { type: Boolean }, type: {}, code: { type: Boolean }, mark: { type: Boolean }, strong: { type: Boolean }, content: {}, underline: { type: Boolean }, disabled: { type: Boolean }, prefixCls: {}, keyboard: { type: Boolean }, editable: { type: [Boolean, Object] }, copyable: { type: [Boolean, Object] }, "onUpdate:content": {}, label: {}, colon: { type: Boolean, default: void 0 }, vertical: { type: Boolean, default: void 0 }, labelStyle: { default: void 0 }, link: { type: [Boolean, String] }, linkProps: { default: () => ({}) }, onClickContent: {}, class: {}, style: {} }, setup(B) { const m = $(), e = B, { b: g, e: i, em: S, m: P } = W("ap-text"), h = Q("ap-text"), { colon: f, vertical: y, labelStyle: N } = M(), T = n(() => s(e.colon) ? s(f?.value) ? !0 : f.value : e.colon), V = n(() => s(e.vertical) ? s(y?.value) ? !1 : y.value : e.vertical), j = n(() => { const l = o(N) || {}; return Object.assign(l, e.labelStyle || {}), l; }), k = n(() => { if (e.label) return z(e.label) ? e.label : x(D, null, [e.label]); }), A = n(() => { const l = X(e.linkProps.ellipsis) ? e.linkProps.ellipsis : !!e.ellipsis; return { href: K(e.link) ? e.link : void 0, ...u(e, ["linkProps"]), ...e.linkProps, ellipsis: l }; }); return (l, Y) => (t(), p("div", { class: a([o(g)(), { [o(P)("vertical")]: V.value }, o(h)]) }, [k.value ? (t(), p("span", { key: 0, class: a([o(i)("label"), { [o(S)("label", "no-colon")]: !T.value }]), style: I(j.value) }, [(t(), c(U(k.value)))], 6)) : v("", !0), E("div", { class: a(o(i)("content")) }, [l.link ? (t(), c(o(H), C({ key: 0 }, A.value, { onClick: l.onClickContent }), { default: d(() => [r(l.$slots, "default")]), _: 3 }, 16, ["onClick"])) : (t(), c(o(J), C({ key: 1 }, o(u)(e, ["label", "colon", "link", "linkProps", "vertical", "labelStyle"]), { onClick: l.onClickContent }), w({ default: d(() => [r(l.$slots, "default", {}, () => [F(G(l.content || "--"), 1)])]), _: 2 }, [R(o(u)(m, ["default", "addonAfter"]), (Z, b) => ({ name: b, fn: d((L) => [r(l.$slots, b, _(q(L || {})))]) }))]), 1040, ["onClick"])), m.addonAfter ? (t(), p("div", { key: 2, class: a(o(i)("content-addon-after")) }, [r(l.$slots, "addonAfter")], 2)) : v("", !0)], 2)], 2)); } }); export { pe as default };