@wetspace/pro-components
Version:
::: tip 基本介绍
145 lines (144 loc) • 5.18 kB
JavaScript
import { defineComponent as j, shallowRef as z, computed as d, cloneVNode as p, watch as R, createVNode as a, mergeProps as w, isVNode as H } from "vue";
import { wetProCardProps as A } from "./types.mjs";
import { useNamespace as N, ElSpace as T, ElIcon as C, ElText as I, ElTooltip as O, ElCol as x, ElCard as S, ElRow as k } from "element-plus";
import "../../delete-button/index.mjs";
import "../../count-down-button/index.mjs";
import { TextEllipsis as D } from "../../ellipsis/index.mjs";
import "../../form-fileds/index.mjs";
import "../../pro-form/index.mjs";
import "../../pro-table/index.mjs";
import "../../pro-descriptions/index.mjs";
import "../../pro-list/index.mjs";
import "../index.mjs";
import "../../page/index.mjs";
import "../../guide/index.mjs";
import "../../notice-menu/index.mjs";
import "../../state/index.mjs";
import { ArrowRight as F, InfoFilled as q } from "../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.12_typescript@5.4.2_/node_modules/@element-plus/icons-vue/dist/index.mjs";
function E(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !H(e);
}
const V = (e) => e && typeof e == "object" && e.name && e.name === "WetProCard", ie = /* @__PURE__ */ j({
name: "WetProCard",
props: A,
emits: {
"update:collapse": (e) => typeof e
},
setup(e, {
emit: P,
slots: r,
attrs: W
}) {
const t = N("pro-card"), c = W["is-col"], n = z(!1), m = d(() => {
const l = r.default && r.default() || [];
let f = !1;
return {
render: l.map((i, s) => V(i.type) ? (f = !0, p(i, {
"is-col": !0,
bordered: !e.split,
splitHorizontal: e.split === "x" && s !== l.length - 1,
splitVertical: e.split === "y" && s !== l.length - 1
})) : typeof i.type == "symbol" && i.type.toString() === "Symbol(v-fgt)" && Array.isArray(i.children) ? i.children.map((u) => V(u == null ? void 0 : u.type) ? (f = !0, p(u, {
"is-col": !0,
bordered: !e.split,
splitHorizontal: e.split === "x" && s !== l.length - 1,
splitVertical: e.split === "y" && s !== l.length - 1
})) : u) : i),
isRow: f
};
}), b = d(() => {
var l;
return e.span && typeof e.span == "number" ? e.span : (l = e.colSpan) == null ? void 0 : l.span;
}), o = d(() => e.span && typeof e.span == "string" ? e.span : ""), h = d(() => e.ghost ? "never" : e.shadow);
R(() => e.collapse, (l) => {
l !== void 0 && (n.value = l);
}, {
deep: !0,
immediate: !0
});
const _ = () => {
e.collapsible && (n.value = !n.value, P("update:collapse", n.value));
}, g = (e.title || r.extra || r.header) && (() => a("div", {
class: [t.e("header-content")],
onClick: () => _()
}, [a(T, null, {
default: () => [e.collapsible && a(C, {
class: [t.em("header-content", "arrow-icon"), t.is("collapse", n.value)]
}, {
default: () => [a(F, null, null)]
}), a(I, {
tag: "b"
}, {
default: () => [a(D, null, {
default: () => [e.title]
})]
}), e.tooltip && a(O, {
content: e.tooltip,
placement: "top"
}, {
default: () => [a(C, null, {
default: () => [a(q, null, null)]
})]
})]
}), r.extra && r.extra()])), v = () => a(S, {
class: [t.b(), t.is("ghost", e.ghost), t.is("split", !!e.split), t.is("no-border", !e.bordered), t.is("split-vertical", e.splitVertical), t.is("split-horizontal", e.splitHorizontal), t.is("collapsible", e.collapsible), t.is("collapse", n.value)],
shadow: h.value
}, {
default() {
return r.default && r.default();
},
header: g,
footer: r.footer && r.footer()
}), y = () => a(S, {
class: [t.b(), t.is("ghost", e.ghost), t.is("split", !!e.split), t.is("no-border", !e.bordered), t.is("split-vertical", e.splitVertical), t.is("split-horizontal", e.splitHorizontal), t.is("collapsible", e.collapsible), t.is("collapse", n.value)],
shadow: h.value
}, {
default() {
return a(k, {
gutter: e.gutter,
justify: e.justify,
tag: e.tag,
align: e.align
}, {
default: () => [e.bordered, m.value.render]
});
},
header: g,
footer: r.footer && r.footer()
});
return () => {
if (m.value.isRow)
if (c) {
let l;
return a(x, w(e.colSpan, {
style: {
maxWidth: o.value,
minWidth: o.value,
flex: o.value === "auto" && 1
},
span: b.value
}), E(l = y()) ? l : {
default: () => [l]
});
} else
return y();
else if (c) {
let l;
return a(x, w(e.colSpan, {
span: b.value,
style: {
maxWidth: o.value,
minWidth: o.value,
flex: o.value === "auto" && 1
}
}), E(l = v()) ? l : {
default: () => [l]
});
} else
return v();
};
}
});
export {
ie as default
};