@aplus-frontend/ui
Version:
108 lines (107 loc) • 4.25 kB
JavaScript
import { defineComponent as x, createElementBlock as n, openBlock as o, normalizeStyle as B, normalizeClass as f, unref as l, createVNode as E, mergeProps as _, withCtx as d, Fragment as a, renderList as w, createCommentVNode as A, createBlock as i, h as p, renderSlot as M, resolveDynamicComponent as j } from "vue";
import { Descriptions as z, DescriptionsItem as b } from "@aplus-frontend/antdv";
import { mixinsAttachmentExtraProps as F, transformValue as G, isEmptyWithType as L } from "./helper.mjs";
import { get as m } from "lodash-unified";
import "./help-message/index.vue.mjs";
import "../config-provider/index.mjs";
import { useGlobalConfig as c } from "../config-provider/hooks/use-global-config.mjs";
import { useNamespace as R } from "../config-provider/hooks/use-namespace.mjs";
import $ from "./help-message/index.vue2.mjs";
const I = { key: 0 }, Y = /* @__PURE__ */ x({
name: "ApDescriptions",
__name: "ap-descriptions",
props: {
descriptionsProps: {},
schemas: {},
dataSource: {},
style: { type: [Boolean, null, String, Object, Array] },
className: {}
},
setup(S) {
const r = S, g = c("uiMode", "admin"), v = c("apDescriptions"), C = c("downloadCenterTriggerConfig"), { m: k, b: P, be: D } = R("ap-descriptions"), N = (e = {}) => {
let s = "";
return r.descriptionsProps?.layout === "vertical" && (s = "start"), {
justifyContent: s,
...e
};
}, u = (e) => {
const s = m(r.dataSource, e.field);
if (e.customRender)
return e.customRender(r.dataSource);
e.valueType === "attachment" && (e.extraProps = F(e.extraProps, {
fromConfig: v.value?.downloadFile,
fromGlobal: C.value?.trigger
}));
const t = e.format ? e.format(s, r.dataSource || {}) : s;
return G({ value: t, record: r.dataSource }, e);
}, T = (e) => e.valueType === "text" && !!e.extraProps?.ellipsis, V = (e) => {
if (e.visible != null) {
if (typeof e.visible == "boolean")
return e.visible;
if (typeof e.visible == "function")
return e.visible({
record: r.dataSource || {},
schema: e
});
}
return !0;
};
return (e, s) => (o(), n("div", {
class: f([e.className, l(P)(), l(k)(l(g))]),
style: B(e.style)
}, [
E(l(z), _(e.descriptionsProps, {
"label-style": N({ ...e.descriptionsProps?.labelStyle || {} })
}), {
default: d(() => [
(o(!0), n(a, null, w(e.schemas, (t, y) => (o(), n(a, {
key: t.field || "empty" + y
}, [
V(t) ? (o(), n(a, { key: 0 }, [
t.valueType === "empty" ? (o(), i(l(b), {
key: 0,
"content-style": t.contentStyle,
"label-style": t.labelStyle,
span: t.span
}, null, 8, ["content-style", "label-style", "span"])) : (o(), i(l(b), {
key: 1,
class: f(T(t) ? l(D)("item", "ellipsis") : ""),
label: t.label ? p(a, [
p($, {
helpMessage: t.helpMessage,
label: t.label
})
]) : null,
span: t.span,
"content-style": t.contentStyle,
"label-style": t.labelStyle
}, {
default: d(() => [
l(L)(l(m)(e.dataSource, t.field), t) ? (o(), n("span", I, "--")) : (o(), n(a, { key: 1 }, [
t.contentSlotName ? M(e.$slots, t.contentSlotName, {
key: 0,
index: y,
item: u(t),
record: e.dataSource
}) : (o(), i(j(
p(a, [
t.prefix,
u(t),
t.suffix
])
), { key: 1 }))
], 64))
]),
_: 2
}, 1032, ["class", "label", "span", "content-style", "label-style"]))
], 64)) : A("", !0)
], 64))), 128))
]),
_: 3
}, 16, ["label-style"])
], 6));
}
});
export {
Y as default
};