ant-design-x-vue
Version:
Craft AI-driven interfaces effortlessly
123 lines (122 loc) • 3.64 kB
JavaScript
import { defineComponent as S, mergeDefaults as $, toRef as h, useSlots as b, computed as n, createVNode as i, isVNode as w } from "vue";
import { b as r } from "../chunks/module-chunk.mjs";
import "../x-provider/index.mjs";
import j from "../_util/hooks/use-x-component-config.mjs";
import W from "./style/index.mjs";
import { Typography as m, Flex as c } from "ant-design-vue";
import O from "../x-provider/hooks/use-x-provider-context.mjs";
import { _ as V } from "../chunks/helper-chunk.mjs";
function p(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !w(e);
}
const T = /* @__PURE__ */ S({
name: "AXWelcome",
__name: "Welcome",
props: $({
prefixCls: {
type: String,
required: !1
},
rootClassName: {
type: String,
required: !1
},
className: {
type: String,
required: !1
},
style: {
required: !1
},
variant: {
type: String,
required: !1
},
classNames: {
type: Object,
required: !1
},
styles: {
type: Object,
required: !1
},
icon: {
required: !1
},
title: {
required: !1
},
description: {
required: !1
},
extra: {
required: !1
}
}, {
variant: "filled",
classNames: () => ({}),
styles: () => ({})
}),
setup(e, {
expose: d
}) {
d(), h(e, "prefixCls");
const s = b(), {
direction: x,
getPrefixCls: y
} = O(), l = y("welcome", e.prefixCls), a = j("welcome"), [v, N, g] = W(l), C = n(() => {
const t = s.icon ? s.icon() : typeof e.icon == "function" ? e.icon() : e.icon;
if (!t)
return null;
let f = t;
return typeof t == "string" && t.startsWith("http") && (f = i("img", {
src: t,
alt: "icon"
}, null)), i("div", {
class: r(`${l}-icon`, a.value.classNames.icon, e.classNames.icon),
style: e.styles.icon
}, [f]);
}), o = n(() => {
const t = s.title ? s.title() : typeof e.title == "function" ? e.title() : e.title;
return t ? i(m.Title, {
level: 4,
class: r(`${l}-title`, a.value.classNames.title, e.classNames.title),
style: e.styles.title
}, p(t) ? t : {
default: () => [t]
}) : null;
}), u = n(() => s.description ? s.description() : typeof e.description == "function" ? e.description() : e.description), q = n(() => {
const t = s.extra ? s.extra() : typeof e.extra == "function" ? e.extra() : e.extra;
return t ? i("div", {
class: r(`${l}-extra`, a.value.classNames.extra, e.classNames.extra),
style: e.styles.extra
}, [t]) : null;
});
return () => v(i(c, {
class: r(l, a.value.className, e.className, e.rootClassName, N.value, g, `${l}-${e.variant}`, {
[`${l}-rtl`]: x.value === "rtl"
}),
style: e.style
}, {
default: () => [C.value, i(c, {
vertical: !0,
class: `${l}-content-wrapper`
}, {
default: () => [s.extra || e.extra ? i(c, {
align: "flex-start",
class: `${l}-title-wrapper`
}, {
default: () => [o.value, q.value]
}) : o.value, u.value && i(m.Text, {
class: r(`${l}-description`, a.value.classNames.description, e.classNames.description),
style: e.styles.description
}, {
default: () => [u.value]
})]
})]
}));
}
}), R = /* @__PURE__ */ V(T, [["__file", "/Users/wangzhichao/办公/code/github/ant-design-x-vue-pure/ant-design-x-vue/src/welcome/Welcome.vue"]]);
export {
R as default
};