|
|
@ -1,12 +1,12 @@ |
|
|
|
import { defineComponent } from 'vue'; |
|
|
|
import { defineComponent } from 'vue'; |
|
|
|
import type { CSSProperties, PropType, ExtractPropTypes } from 'vue'; |
|
|
|
import type { CSSProperties, ExtractPropTypes } from 'vue'; |
|
|
|
import classNames from '../_util/classNames'; |
|
|
|
import classNames from '../_util/classNames'; |
|
|
|
import LocaleReceiver from '../locale-provider/LocaleReceiver'; |
|
|
|
import LocaleReceiver from '../locale-provider/LocaleReceiver'; |
|
|
|
import DefaultEmptyImg from './empty'; |
|
|
|
import DefaultEmptyImg from './empty'; |
|
|
|
import SimpleEmptyImg from './simple'; |
|
|
|
import SimpleEmptyImg from './simple'; |
|
|
|
import { filterEmpty } from '../_util/props-util'; |
|
|
|
import { filterEmpty } from '../_util/props-util'; |
|
|
|
import PropTypes from '../_util/vue-types'; |
|
|
|
import type { VueNode } from '../_util/type'; |
|
|
|
import { withInstall } from '../_util/type'; |
|
|
|
import { anyType, objectType, withInstall } from '../_util/type'; |
|
|
|
import useConfigInject from '../config-provider/hooks/useConfigInject'; |
|
|
|
import useConfigInject from '../config-provider/hooks/useConfigInject'; |
|
|
|
|
|
|
|
|
|
|
|
import useStyle from './style'; |
|
|
|
import useStyle from './style'; |
|
|
@ -20,17 +20,16 @@ interface Locale { |
|
|
|
|
|
|
|
|
|
|
|
export const emptyProps = () => ({ |
|
|
|
export const emptyProps = () => ({ |
|
|
|
prefixCls: String, |
|
|
|
prefixCls: String, |
|
|
|
class: PropTypes.any, |
|
|
|
imageStyle: objectType<CSSProperties>(), |
|
|
|
style: [String, Object] as PropType<string | CSSProperties>, |
|
|
|
image: anyType<VueNode>(), |
|
|
|
imageStyle: Object as PropType<CSSProperties>, |
|
|
|
description: anyType<VueNode>(), |
|
|
|
image: PropTypes.any, |
|
|
|
|
|
|
|
description: PropTypes.any, |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
export type EmptyProps = Partial<ExtractPropTypes<ReturnType<typeof emptyProps>>>; |
|
|
|
export type EmptyProps = Partial<ExtractPropTypes<ReturnType<typeof emptyProps>>>; |
|
|
|
|
|
|
|
|
|
|
|
const Empty = defineComponent({ |
|
|
|
const Empty = defineComponent({ |
|
|
|
name: 'AEmpty', |
|
|
|
name: 'AEmpty', |
|
|
|
|
|
|
|
compatConfig: { MODE: 3 }, |
|
|
|
inheritAttrs: false, |
|
|
|
inheritAttrs: false, |
|
|
|
props: emptyProps(), |
|
|
|
props: emptyProps(), |
|
|
|
setup(props, { slots = {}, attrs }) { |
|
|
|
setup(props, { slots = {}, attrs }) { |
|
|
@ -41,7 +40,7 @@ const Empty = defineComponent({ |
|
|
|
return () => { |
|
|
|
return () => { |
|
|
|
const prefixCls = prefixClsRef.value; |
|
|
|
const prefixCls = prefixClsRef.value; |
|
|
|
const { |
|
|
|
const { |
|
|
|
image = defaultEmptyImg, |
|
|
|
image = slots.image?.() || defaultEmptyImg, |
|
|
|
description = slots.description?.() || undefined, |
|
|
|
description = slots.description?.() || undefined, |
|
|
|
imageStyle, |
|
|
|
imageStyle, |
|
|
|
class: className = '', |
|
|
|
class: className = '', |
|
|
@ -88,12 +87,5 @@ const Empty = defineComponent({ |
|
|
|
|
|
|
|
|
|
|
|
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg; |
|
|
|
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg; |
|
|
|
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg; |
|
|
|
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg; |
|
|
|
Empty.inheritAttrs = false; |
|
|
|
|
|
|
|
Empty.props = { |
|
|
|
|
|
|
|
prefixCls: String, |
|
|
|
|
|
|
|
image: PropTypes.any, |
|
|
|
|
|
|
|
description: PropTypes.any, |
|
|
|
|
|
|
|
imageStyle: { type: Object as PropType<CSSProperties>, default: undefined as CSSProperties }, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default withInstall(Empty); |
|
|
|
export default withInstall(Empty); |
|
|
|