|
|
@ -1,4 +1,4 @@ |
|
|
|
import { defineComponent } from 'vue'; |
|
|
|
import { defineComponent, h } from 'vue'; |
|
|
|
import type { CSSProperties, 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'; |
|
|
@ -11,9 +11,6 @@ import useConfigInject from '../config-provider/hooks/useConfigInject'; |
|
|
|
|
|
|
|
|
|
|
|
import useStyle from './style'; |
|
|
|
import useStyle from './style'; |
|
|
|
|
|
|
|
|
|
|
|
const defaultEmptyImg = <DefaultEmptyImg />; |
|
|
|
|
|
|
|
const simpleEmptyImg = <SimpleEmptyImg />; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Locale { |
|
|
|
interface Locale { |
|
|
|
description?: string; |
|
|
|
description?: string; |
|
|
|
} |
|
|
|
} |
|
|
@ -40,13 +37,16 @@ const Empty = defineComponent({ |
|
|
|
return () => { |
|
|
|
return () => { |
|
|
|
const prefixCls = prefixClsRef.value; |
|
|
|
const prefixCls = prefixClsRef.value; |
|
|
|
const { |
|
|
|
const { |
|
|
|
image = slots.image?.() || defaultEmptyImg, |
|
|
|
image: mergedImage = slots.image?.() || h(DefaultEmptyImg), |
|
|
|
description = slots.description?.() || undefined, |
|
|
|
description = slots.description?.() || undefined, |
|
|
|
imageStyle, |
|
|
|
imageStyle, |
|
|
|
class: className = '', |
|
|
|
class: className = '', |
|
|
|
...restProps |
|
|
|
...restProps |
|
|
|
} = { ...props, ...attrs }; |
|
|
|
} = { ...props, ...attrs }; |
|
|
|
|
|
|
|
const image = |
|
|
|
|
|
|
|
typeof mergedImage === 'function' ? (mergedImage as () => VueNode)() : mergedImage; |
|
|
|
|
|
|
|
const isNormal = |
|
|
|
|
|
|
|
typeof image === 'object' && 'type' in image && (image.type as any).PRESENTED_IMAGE_SIMPLE; |
|
|
|
return wrapSSR( |
|
|
|
return wrapSSR( |
|
|
|
<LocaleReceiver |
|
|
|
<LocaleReceiver |
|
|
|
componentName="Empty" |
|
|
|
componentName="Empty" |
|
|
@ -64,7 +64,7 @@ const Empty = defineComponent({ |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
class={classNames(prefixCls, className, hashId.value, { |
|
|
|
class={classNames(prefixCls, className, hashId.value, { |
|
|
|
[`${prefixCls}-normal`]: image === simpleEmptyImg, |
|
|
|
[`${prefixCls}-normal`]: isNormal, |
|
|
|
[`${prefixCls}-rtl`]: direction.value === 'rtl', |
|
|
|
[`${prefixCls}-rtl`]: direction.value === 'rtl', |
|
|
|
})} |
|
|
|
})} |
|
|
|
{...restProps} |
|
|
|
{...restProps} |
|
|
@ -85,7 +85,7 @@ const Empty = defineComponent({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg; |
|
|
|
Empty.PRESENTED_IMAGE_DEFAULT = () => h(DefaultEmptyImg); |
|
|
|
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg; |
|
|
|
Empty.PRESENTED_IMAGE_SIMPLE = () => h(SimpleEmptyImg); |
|
|
|
|
|
|
|
|
|
|
|
export default withInstall(Empty); |
|
|
|
export default withInstall(Empty); |
|
|
|