fix: update skeleton
parent
fb0f01cf6a
commit
22db40bc41
|
@ -1,13 +1,10 @@
|
||||||
import type { ExtractPropTypes } from 'vue';
|
import type { ExtractPropTypes, PropType } from 'vue';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import PropTypes from '../_util/vue-types';
|
|
||||||
|
|
||||||
const widthUnit = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
|
|
||||||
|
|
||||||
export const skeletonParagraphProps = {
|
export const skeletonParagraphProps = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: String,
|
||||||
width: PropTypes.oneOfType([widthUnit, PropTypes.arrayOf(widthUnit)]),
|
width: { type: [Number, String] as PropType<string | number> },
|
||||||
rows: PropTypes.number,
|
rows: Number,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SkeletonParagraphProps = Partial<ExtractPropTypes<typeof skeletonParagraphProps>>;
|
export type SkeletonParagraphProps = Partial<ExtractPropTypes<typeof skeletonParagraphProps>>;
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
import type { ExtractPropTypes } from 'vue';
|
import type { ExtractPropTypes, PropType } from 'vue';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import classNames from '../_util/classNames';
|
import classNames from '../_util/classNames';
|
||||||
import PropTypes, { withUndefined } from '../_util/vue-types';
|
|
||||||
import { initDefaultProps } from '../_util/props-util';
|
import { initDefaultProps } from '../_util/props-util';
|
||||||
import type { AvatarProps } from './Avatar';
|
import type { AvatarProps } from './Avatar';
|
||||||
import { avatarProps } from './Avatar';
|
|
||||||
import type { SkeletonTitleProps } from './Title';
|
import type { SkeletonTitleProps } from './Title';
|
||||||
import Title, { skeletonTitleProps } from './Title';
|
import Title from './Title';
|
||||||
import type { SkeletonParagraphProps } from './Paragraph';
|
import type { SkeletonParagraphProps } from './Paragraph';
|
||||||
import Paragraph, { skeletonParagraphProps } from './Paragraph';
|
import Paragraph from './Paragraph';
|
||||||
import Omit from 'omit.js';
|
|
||||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||||
import Element from './Element';
|
import Element from './Element';
|
||||||
|
|
||||||
|
@ -17,30 +14,22 @@ import Element from './Element';
|
||||||
type SkeletonAvatarProps = Omit<AvatarProps, 'active'>;
|
type SkeletonAvatarProps = Omit<AvatarProps, 'active'>;
|
||||||
|
|
||||||
export const skeletonProps = {
|
export const skeletonProps = {
|
||||||
active: PropTypes.looseBool,
|
active: { type: Boolean, default: undefined },
|
||||||
loading: PropTypes.looseBool,
|
loading: { type: Boolean, default: undefined },
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: String,
|
||||||
avatar: withUndefined(
|
avatar: {
|
||||||
PropTypes.oneOfType([
|
type: [Boolean, Object] as PropType<SkeletonAvatarProps | boolean>,
|
||||||
PropTypes.string,
|
default: undefined as SkeletonAvatarProps | boolean,
|
||||||
PropTypes.shape(Omit(avatarProps, ['active'])).loose,
|
},
|
||||||
PropTypes.looseBool,
|
title: {
|
||||||
]),
|
type: [Boolean, Object] as PropType<SkeletonTitleProps | boolean>,
|
||||||
),
|
default: undefined as SkeletonTitleProps | boolean,
|
||||||
title: withUndefined(
|
},
|
||||||
PropTypes.oneOfType([
|
paragraph: {
|
||||||
PropTypes.looseBool,
|
type: [Boolean, Object] as PropType<SkeletonParagraphProps | boolean>,
|
||||||
PropTypes.string,
|
default: undefined as SkeletonParagraphProps | boolean,
|
||||||
PropTypes.shape(skeletonTitleProps).loose,
|
},
|
||||||
]),
|
round: { type: Boolean, default: undefined },
|
||||||
),
|
|
||||||
paragraph: withUndefined(
|
|
||||||
PropTypes.oneOfType([
|
|
||||||
PropTypes.looseBool,
|
|
||||||
PropTypes.string,
|
|
||||||
PropTypes.shape(skeletonParagraphProps).loose,
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SkeletonProps = Partial<ExtractPropTypes<typeof skeletonProps>>;
|
export type SkeletonProps = Partial<ExtractPropTypes<typeof skeletonProps>>;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import type { ExtractPropTypes } from 'vue';
|
import type { ExtractPropTypes, PropType } from 'vue';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import PropTypes from '../_util/vue-types';
|
|
||||||
|
|
||||||
export const skeletonTitleProps = {
|
export const skeletonTitleProps = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: String,
|
||||||
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
width: { type: [Number, String] as PropType<string | number> },
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SkeletonTitleProps = Partial<ExtractPropTypes<typeof skeletonTitleProps>>;
|
export type SkeletonTitleProps = Partial<ExtractPropTypes<typeof skeletonTitleProps>>;
|
||||||
|
|
Loading…
Reference in New Issue