| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- import { c as C, g as N, m as D, d as o, a3 as G, u as W, i as j } from "./index2.js";
- import { defineComponent as I, createVNode as c } from "vue";
- const z = () => ({
- prefixCls: String,
- width: {
- type: [Number, String]
- }
- }), O = I({
- compatConfig: {
- MODE: 3
- },
- name: "SkeletonTitle",
- props: z(),
- setup(e) {
- return () => {
- const {
- prefixCls: t,
- width: n
- } = e, r = typeof n == "number" ? `${n}px` : n;
- return c("h3", {
- class: t,
- style: {
- width: r
- }
- }, null);
- };
- }
- }), X = () => ({
- prefixCls: String,
- width: {
- type: [Number, String, Array]
- },
- rows: Number
- }), q = I({
- compatConfig: {
- MODE: 3
- },
- name: "SkeletonParagraph",
- props: X(),
- setup(e) {
- const t = (n) => {
- const {
- width: r,
- rows: l = 2
- } = e;
- if (Array.isArray(r))
- return r[n];
- if (l - 1 === n)
- return r;
- };
- return () => {
- const {
- prefixCls: n,
- rows: r
- } = e, l = [...Array(r)].map((i, a) => {
- const d = t(a);
- return c("li", {
- key: a,
- style: {
- width: typeof d == "number" ? `${d}px` : d
- }
- }, null);
- });
- return c("ul", {
- class: n
- }, [l]);
- };
- }
- }), le = () => ({
- prefixCls: String,
- size: [String, Number],
- shape: String,
- active: {
- type: Boolean,
- default: void 0
- }
- }), L = (e) => {
- const {
- prefixCls: t,
- size: n,
- shape: r
- } = e, l = C({
- [`${t}-lg`]: n === "large",
- [`${t}-sm`]: n === "small"
- }), i = C({
- [`${t}-circle`]: r === "circle",
- [`${t}-square`]: r === "square",
- [`${t}-round`]: r === "round"
- }), a = typeof n == "number" ? {
- width: `${n}px`,
- height: `${n}px`,
- lineHeight: `${n}px`
- } : {};
- return c("span", {
- class: C(t, l, i),
- style: a
- }, null);
- };
- L.displayName = "SkeletonElement";
- const F = new G("ant-skeleton-loading", {
- "0%": {
- transform: "translateX(-37.5%)"
- },
- "100%": {
- transform: "translateX(37.5%)"
- }
- }), v = (e) => ({
- height: e,
- lineHeight: `${e}px`
- }), m = (e) => o({
- width: e
- }, v(e)), _ = (e) => ({
- position: "relative",
- // fix https://github.com/ant-design/ant-design/issues/36444
- // https://monshin.github.io/202109/css/safari-border-radius-overflow-hidden/
- /* stylelint-disable-next-line property-no-vendor-prefix,value-no-vendor-prefix */
- zIndex: 0,
- overflow: "hidden",
- background: "transparent",
- "&::after": {
- position: "absolute",
- top: 0,
- insetInlineEnd: "-150%",
- bottom: 0,
- insetInlineStart: "-150%",
- background: e.skeletonLoadingBackground,
- animationName: F,
- animationDuration: e.skeletonLoadingMotionDuration,
- animationTimingFunction: "ease",
- animationIterationCount: "infinite",
- content: '""'
- }
- }), P = (e) => o({
- width: e * 5,
- minWidth: e * 5
- }, v(e)), K = (e) => {
- const {
- skeletonAvatarCls: t,
- color: n,
- controlHeight: r,
- controlHeightLG: l,
- controlHeightSM: i
- } = e;
- return {
- [`${t}`]: o({
- display: "inline-block",
- verticalAlign: "top",
- background: n
- }, m(r)),
- [`${t}${t}-circle`]: {
- borderRadius: "50%"
- },
- [`${t}${t}-lg`]: o({}, m(l)),
- [`${t}${t}-sm`]: o({}, m(i))
- };
- }, V = (e) => {
- const {
- controlHeight: t,
- borderRadiusSM: n,
- skeletonInputCls: r,
- controlHeightLG: l,
- controlHeightSM: i,
- color: a
- } = e;
- return {
- [`${r}`]: o({
- display: "inline-block",
- verticalAlign: "top",
- background: a,
- borderRadius: n
- }, P(t)),
- [`${r}-lg`]: o({}, P(l)),
- [`${r}-sm`]: o({}, P(i))
- };
- }, M = (e) => o({
- width: e
- }, v(e)), J = (e) => {
- const {
- skeletonImageCls: t,
- imageSizeBase: n,
- color: r,
- borderRadiusSM: l
- } = e;
- return {
- [`${t}`]: o(o({
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- verticalAlign: "top",
- background: r,
- borderRadius: l
- }, M(n * 2)), {
- [`${t}-path`]: {
- fill: "#bfbfbf"
- },
- [`${t}-svg`]: o(o({}, M(n)), {
- maxWidth: n * 4,
- maxHeight: n * 4
- }),
- [`${t}-svg${t}-svg-circle`]: {
- borderRadius: "50%"
- }
- }),
- [`${t}${t}-circle`]: {
- borderRadius: "50%"
- }
- };
- }, x = (e, t, n) => {
- const {
- skeletonButtonCls: r
- } = e;
- return {
- [`${n}${r}-circle`]: {
- width: t,
- minWidth: t,
- borderRadius: "50%"
- },
- [`${n}${r}-round`]: {
- borderRadius: t
- }
- };
- }, E = (e) => o({
- width: e * 2,
- minWidth: e * 2
- }, v(e)), Q = (e) => {
- const {
- borderRadiusSM: t,
- skeletonButtonCls: n,
- controlHeight: r,
- controlHeightLG: l,
- controlHeightSM: i,
- color: a
- } = e;
- return o(o(o(o(o({
- [`${n}`]: o({
- display: "inline-block",
- verticalAlign: "top",
- background: a,
- borderRadius: t,
- width: r * 2,
- minWidth: r * 2
- }, E(r))
- }, x(e, r, n)), {
- [`${n}-lg`]: o({}, E(l))
- }), x(e, l, `${n}-lg`)), {
- [`${n}-sm`]: o({}, E(i))
- }), x(e, i, `${n}-sm`));
- }, U = (e) => {
- const {
- componentCls: t,
- skeletonAvatarCls: n,
- skeletonTitleCls: r,
- skeletonParagraphCls: l,
- skeletonButtonCls: i,
- skeletonInputCls: a,
- skeletonImageCls: d,
- controlHeight: y,
- controlHeightLG: f,
- controlHeightSM: p,
- color: g,
- padding: w,
- marginSM: B,
- borderRadius: s,
- skeletonTitleHeight: h,
- skeletonBlockRadius: u,
- skeletonParagraphLineHeight: $,
- controlHeightXS: k,
- skeletonParagraphMarginTop: S
- } = e;
- return {
- [`${t}`]: {
- display: "table",
- width: "100%",
- [`${t}-header`]: {
- display: "table-cell",
- paddingInlineEnd: w,
- verticalAlign: "top",
- // Avatar
- [`${n}`]: o({
- display: "inline-block",
- verticalAlign: "top",
- background: g
- }, m(y)),
- [`${n}-circle`]: {
- borderRadius: "50%"
- },
- [`${n}-lg`]: o({}, m(f)),
- [`${n}-sm`]: o({}, m(p))
- },
- [`${t}-content`]: {
- display: "table-cell",
- width: "100%",
- verticalAlign: "top",
- // Title
- [`${r}`]: {
- width: "100%",
- height: h,
- background: g,
- borderRadius: u,
- [`+ ${l}`]: {
- marginBlockStart: p
- }
- },
- // paragraph
- [`${l}`]: {
- padding: 0,
- "> li": {
- width: "100%",
- height: $,
- listStyle: "none",
- background: g,
- borderRadius: u,
- "+ li": {
- marginBlockStart: k
- }
- }
- },
- [`${l}> li:last-child:not(:first-child):not(:nth-child(2))`]: {
- width: "61%"
- }
- },
- [`&-round ${t}-content`]: {
- [`${r}, ${l} > li`]: {
- borderRadius: s
- }
- }
- },
- [`${t}-with-avatar ${t}-content`]: {
- // Title
- [`${r}`]: {
- marginBlockStart: B,
- [`+ ${l}`]: {
- marginBlockStart: S
- }
- }
- },
- // Skeleton element
- [`${t}${t}-element`]: o(o(o(o({
- display: "inline-block",
- width: "auto"
- }, Q(e)), K(e)), V(e)), J(e)),
- // Skeleton Block Button, Input
- [`${t}${t}-block`]: {
- width: "100%",
- [`${i}`]: {
- width: "100%"
- },
- [`${a}`]: {
- width: "100%"
- }
- },
- // With active animation
- [`${t}${t}-active`]: {
- [`
- ${r},
- ${l} > li,
- ${n},
- ${i},
- ${a},
- ${d}
- `]: o({}, _(e))
- }
- };
- }, Y = N("Skeleton", (e) => {
- const {
- componentCls: t
- } = e, n = D(e, {
- skeletonAvatarCls: `${t}-avatar`,
- skeletonTitleCls: `${t}-title`,
- skeletonParagraphCls: `${t}-paragraph`,
- skeletonButtonCls: `${t}-button`,
- skeletonInputCls: `${t}-input`,
- skeletonImageCls: `${t}-image`,
- imageSizeBase: e.controlHeight * 1.5,
- skeletonTitleHeight: e.controlHeight / 2,
- skeletonBlockRadius: e.borderRadiusSM,
- skeletonParagraphLineHeight: e.controlHeight / 2,
- skeletonParagraphMarginTop: e.marginLG + e.marginXXS,
- borderRadius: 100,
- skeletonLoadingBackground: `linear-gradient(90deg, ${e.color} 25%, ${e.colorGradientEnd} 37%, ${e.color} 63%)`,
- skeletonLoadingMotionDuration: "1.4s"
- });
- return [U(n)];
- }, (e) => {
- const {
- colorFillContent: t,
- colorFill: n
- } = e;
- return {
- color: t,
- colorGradientEnd: n
- };
- }), Z = () => ({
- active: {
- type: Boolean,
- default: void 0
- },
- loading: {
- type: Boolean,
- default: void 0
- },
- prefixCls: String,
- avatar: {
- type: [Boolean, Object],
- default: void 0
- },
- title: {
- type: [Boolean, Object],
- default: void 0
- },
- paragraph: {
- type: [Boolean, Object],
- default: void 0
- },
- round: {
- type: Boolean,
- default: void 0
- }
- });
- function R(e) {
- return e && typeof e == "object" ? e : {};
- }
- function ee(e, t) {
- return e && !t ? {
- size: "large",
- shape: "square"
- } : {
- size: "large",
- shape: "circle"
- };
- }
- function te(e, t) {
- return !e && t ? {
- width: "38%"
- } : e && t ? {
- width: "50%"
- } : {};
- }
- function ne(e, t) {
- const n = {};
- return (!e || !t) && (n.width = "61%"), !e && t ? n.rows = 3 : n.rows = 2, n;
- }
- const ie = I({
- compatConfig: {
- MODE: 3
- },
- name: "ASkeleton",
- props: j(Z(), {
- avatar: !1,
- title: !0,
- paragraph: !0
- }),
- setup(e, t) {
- let {
- slots: n
- } = t;
- const {
- prefixCls: r,
- direction: l
- } = W("skeleton", e), [i, a] = Y(r);
- return () => {
- var d;
- const {
- loading: y,
- avatar: f,
- title: p,
- paragraph: g,
- active: w,
- round: B
- } = e, s = r.value;
- if (y || e.loading === void 0) {
- const h = !!f || f === "", u = !!p || p === "", $ = !!g || g === "";
- let k;
- if (h) {
- const b = o(o({
- prefixCls: `${s}-avatar`
- }, ee(u, $)), R(f));
- k = c("div", {
- class: `${s}-header`
- }, [c(L, b, null)]);
- }
- let S;
- if (u || $) {
- let b;
- if (u) {
- const H = o(o({
- prefixCls: `${s}-title`
- }, te(h, $)), R(p));
- b = c(O, H, null);
- }
- let A;
- if ($) {
- const H = o(o({
- prefixCls: `${s}-paragraph`
- }, ne(h, u)), R(g));
- A = c(q, H, null);
- }
- S = c("div", {
- class: `${s}-content`
- }, [b, A]);
- }
- const T = C(s, {
- [`${s}-with-avatar`]: h,
- [`${s}-active`]: w,
- [`${s}-rtl`]: l.value === "rtl",
- [`${s}-round`]: B,
- [a.value]: !0
- });
- return i(c("div", {
- class: T
- }, [k, S]));
- }
- return (d = n.default) === null || d === void 0 ? void 0 : d.call(n);
- };
- }
- });
- export {
- L as E,
- ie as S,
- O as a,
- le as s,
- Y as u
- };
|