@@ -23,7 +23,6 @@ import type { Breakpoint, ScreenMap } from '../_util/responsiveObserve';
23
23
import ResponsiveObserve , { responsiveArray } from '../_util/responsiveObserve' ;
24
24
import Row from './Row' ;
25
25
import PropTypes from '../_util/vue-types' ;
26
- import { tuple } from '../_util/type' ;
27
26
import { cloneElement } from '../_util/vnode' ;
28
27
import { flattenChildren } from '../_util/props-util' ;
29
28
import useConfigInject from '../_util/hooks/useConfigInject' ;
@@ -34,19 +33,21 @@ export const DescriptionsItemProps = {
34
33
span : Number ,
35
34
} ;
36
35
37
- const descriptionsItemProp = {
36
+ const descriptionsItemProp = ( ) => ( {
38
37
prefixCls : String ,
39
38
label : PropTypes . any ,
40
- labelStyle : PropTypes . style ,
41
- contentStyle : PropTypes . style ,
42
- span : PropTypes . number . def ( 1 ) ,
43
- } ;
39
+ labelStyle : { type : Object as PropType < CSSProperties > , default : undefined as CSSProperties } ,
40
+ contentStyle : { type : Object as PropType < CSSProperties > , default : undefined as CSSProperties } ,
41
+ span : { type : Number , default : 1 } ,
42
+ } ) ;
44
43
45
- export type DescriptionsItemProp = Partial < ExtractPropTypes < typeof descriptionsItemProp > > ;
44
+ export type DescriptionsItemProp = Partial <
45
+ ExtractPropTypes < ReturnType < typeof descriptionsItemProp > >
46
+ > ;
46
47
47
48
export const DescriptionsItem = defineComponent ( {
48
49
name : 'ADescriptionsItem' ,
49
- props : descriptionsItemProp ,
50
+ props : descriptionsItemProp ( ) ,
50
51
slots : [ 'label' ] ,
51
52
setup ( _ , { slots } ) {
52
53
return ( ) => slots . default ?.( ) ;
@@ -128,24 +129,24 @@ function getRows(children: VNode[], column: number) {
128
129
return rows ;
129
130
}
130
131
131
- export const descriptionsProps = {
132
+ export const descriptionsProps = ( ) => ( {
132
133
prefixCls : String ,
133
134
bordered : { type : Boolean , default : undefined } ,
134
- size : PropTypes . oneOf ( tuple ( 'default' , 'middle' , 'small' ) ) . def ( 'default' ) ,
135
+ size : { type : String as PropType < 'default' | 'middle' | 'small' > , default : 'default' } ,
135
136
title : PropTypes . any ,
136
137
extra : PropTypes . any ,
137
138
column : {
138
139
type : [ Number , Object ] as PropType < number | Partial < Record < Breakpoint , number > > > ,
139
140
default : ( ) : number | Partial < Record < Breakpoint , number > > => DEFAULT_COLUMN_MAP ,
140
141
} ,
141
- layout : PropTypes . oneOf ( tuple ( 'horizontal' , 'vertical' ) ) ,
142
+ layout : String as PropType < 'horizontal' | 'vertical' > ,
142
143
colon : { type : Boolean , default : undefined } ,
143
- labelStyle : PropTypes . style ,
144
- contentStyle : PropTypes . style ,
145
- } ;
144
+ labelStyle : { type : Object as PropType < CSSProperties > , default : undefined as CSSProperties } ,
145
+ contentStyle : { type : Object as PropType < CSSProperties > , default : undefined as CSSProperties } ,
146
+ } ) ;
146
147
147
148
export type DescriptionsProps = HTMLAttributes &
148
- Partial < ExtractPropTypes < typeof descriptionsProps > > ;
149
+ Partial < ExtractPropTypes < ReturnType < typeof descriptionsProps > > > ;
149
150
150
151
export interface DescriptionsContextProp {
151
152
labelStyle ?: Ref < CSSProperties > ;
@@ -157,7 +158,7 @@ export const descriptionsContext: InjectionKey<DescriptionsContextProp> =
157
158
158
159
const Descriptions = defineComponent ( {
159
160
name : 'ADescriptions' ,
160
- props : descriptionsProps ,
161
+ props : descriptionsProps ( ) ,
161
162
slots : [ 'title' , 'extra' ] ,
162
163
Item : DescriptionsItem ,
163
164
setup ( props , { slots } ) {
0 commit comments