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