@aplus-frontend/ui
Version:
80 lines (79 loc) • 2.44 kB
JavaScript
import { defineComponent as f, h as t, createVNode as e, createTextVNode as v } from "vue";
import { Space as h, Tooltip as y } from "@aplus-frontend/antdv";
import { IconApAdFillWarn as g } from "@aplus-frontend/icon";
import "../../config-provider/index.mjs";
import { ApCopy as s } from "../ap-copy/index.mjs";
import { ApImage as m } from "../ap-image/index.mjs";
import { ApProductInfoProps as k } from "./constans.mjs";
import b from "./style/index.mjs";
import { useNamespace as w } from "../../config-provider/hooks/use-namespace.mjs";
const T = /* @__PURE__ */ f({
name: "ApProductInfo",
props: k(),
setup(r) {
const {
b: i,
e: o,
m: a
} = w("ap-product-info"), c = b("ap-product-info"), p = (l) => typeof l.value == "function" ? l.value() : l.helpMessage ? t(h.Compact, {}, [t(s, {
text: l.value,
link: l.link,
textStyle: l.link ? "link" : "minor"
}), t(y, {
placement: "top",
color: l.toolTipBgColor,
title: typeof l.helpMessage == "string" ? l.helpMessage : t(l.helpMessage)
}, () => t(g, {
color: "#FFA940",
style: {
cursor: "pointer"
}
}))]) : t(s, {
text: l.value,
textStyle: l.link ? "link" : "minor",
link: l.link,
disableCopy: r.disableCopy
}, l.value);
return () => e("div", {
class: [i(), c.value]
}, [r.showImg && e("div", {
class: o("img")
}, [e(m, {
src: r.imgSrc,
width: 44,
height: 44,
preview: r.preview
}, null)]), e("div", {
class: [o("content")]
}, [e(s, {
disableCopy: r.disableCopy
}, {
default: () => [r.title]
}), e("div", {
class: o("row-container")
}, [r.values.map((l, u) => {
const n = l.col === 2, d = l.col !== 2 && u % 2 === 0;
return e("div", {
key: JSON.stringify(l),
class: [o("row-item"), a(n ? "full" : "half")]
}, [e("div", {
class: [o("item")]
}, [l.label && e("div", {
class: o("label")
}, [l.label, e("span", null, [v(":")])]), e("div", {
class: [o("value"), !n && a("overflow")],
title: typeof l.value != "function" ? String(l.value || "") : ""
}, [p(l)])]), d && e("div", {
class: o("divider"),
style: {
right: 0
}
}, [e("div", {
class: o("divider-vertical")
}, null)])]);
})])])]);
}
});
export {
T as default
};