1
1
import { defineComponent } from 'vue' ;
2
- import type { CSSProperties , PropType , ExtractPropTypes } from 'vue' ;
2
+ import type { CSSProperties , ExtractPropTypes } from 'vue' ;
3
3
import classNames from '../_util/classNames' ;
4
4
import LocaleReceiver from '../locale-provider/LocaleReceiver' ;
5
5
import DefaultEmptyImg from './empty' ;
6
6
import SimpleEmptyImg from './simple' ;
7
7
import { filterEmpty } from '../_util/props-util' ;
8
- import PropTypes from '../_util/vue-types ' ;
9
- import { withInstall } from '../_util/type' ;
8
+ import type { VueNode } from '../_util/type ' ;
9
+ import { anyType , objectType , withInstall } from '../_util/type' ;
10
10
import useConfigInject from '../config-provider/hooks/useConfigInject' ;
11
11
12
12
import useStyle from './style' ;
@@ -20,17 +20,16 @@ interface Locale {
20
20
21
21
export const emptyProps = ( ) => ( {
22
22
prefixCls : String ,
23
- class : PropTypes . any ,
24
- style : [ String , Object ] as PropType < string | CSSProperties > ,
25
- imageStyle : Object as PropType < CSSProperties > ,
26
- image : PropTypes . any ,
27
- description : PropTypes . any ,
23
+ imageStyle : objectType < CSSProperties > ( ) ,
24
+ image : anyType < VueNode > ( ) ,
25
+ description : anyType < VueNode > ( ) ,
28
26
} ) ;
29
27
30
28
export type EmptyProps = Partial < ExtractPropTypes < ReturnType < typeof emptyProps > > > ;
31
29
32
30
const Empty = defineComponent ( {
33
31
name : 'AEmpty' ,
32
+ compatConfig : { MODE : 3 } ,
34
33
inheritAttrs : false ,
35
34
props : emptyProps ( ) ,
36
35
setup ( props , { slots = { } , attrs } ) {
@@ -41,7 +40,7 @@ const Empty = defineComponent({
41
40
return ( ) => {
42
41
const prefixCls = prefixClsRef . value ;
43
42
const {
44
- image = defaultEmptyImg ,
43
+ image = slots . image ?. ( ) || defaultEmptyImg ,
45
44
description = slots . description ?.( ) || undefined ,
46
45
imageStyle,
47
46
class : className = '' ,
@@ -88,12 +87,5 @@ const Empty = defineComponent({
88
87
89
88
Empty . PRESENTED_IMAGE_DEFAULT = defaultEmptyImg ;
90
89
Empty . PRESENTED_IMAGE_SIMPLE = simpleEmptyImg ;
91
- Empty . inheritAttrs = false ;
92
- Empty . props = {
93
- prefixCls : String ,
94
- image : PropTypes . any ,
95
- description : PropTypes . any ,
96
- imageStyle : { type : Object as PropType < CSSProperties > , default : undefined as CSSProperties } ,
97
- } ;
98
90
99
91
export default withInstall ( Empty ) ;
0 commit comments