11import { computed , defineComponent , onBeforeUnmount , onMounted , ref } from 'vue' ;
2- import type { ExtractPropTypes , PropType , CSSProperties } from 'vue' ;
2+ import type { ExtractPropTypes , CSSProperties } from 'vue' ;
33import EyeOutlined from '@ant-design/icons-vue/EyeOutlined' ;
44import DeleteOutlined from '@ant-design/icons-vue/DeleteOutlined' ;
55import DownloadOutlined from '@ant-design/icons-vue/DownloadOutlined' ;
@@ -16,36 +16,39 @@ import type {
1616import type { VueNode } from '../../_util/type' ;
1717import useConfigInject from '../../config-provider/hooks/useConfigInject' ;
1818import Transition , { getTransitionProps } from '../../_util/transition' ;
19+ import { booleanType , stringType , functionType , arrayType , objectType } from '../../_util/type' ;
20+
1921export const listItemProps = ( ) => {
2022 return {
2123 prefixCls : String ,
22- locale : { type : Object as PropType < UploadLocale > , default : undefined as UploadLocale } ,
23- file : Object as PropType < UploadFile > ,
24- items : Array as PropType < UploadFile [ ] > ,
25- listType : String as PropType < UploadListType > ,
26- isImgUrl : Function as PropType < ( file : UploadFile ) => boolean > ,
24+ locale : objectType < UploadLocale > ( undefined as UploadLocale ) ,
25+ file : objectType < UploadFile > ( ) ,
26+ items : arrayType < UploadFile [ ] > ( ) ,
27+ listType : stringType < UploadListType > ( ) ,
28+ isImgUrl : functionType < ( file : UploadFile ) => boolean > ( ) ,
2729
28- showRemoveIcon : { type : Boolean , default : undefined } ,
29- showDownloadIcon : { type : Boolean , default : undefined } ,
30- showPreviewIcon : { type : Boolean , default : undefined } ,
31- removeIcon : Function as PropType < ( opt : { file : UploadFile } ) => VueNode > ,
32- downloadIcon : Function as PropType < ( opt : { file : UploadFile } ) => VueNode > ,
33- previewIcon : Function as PropType < ( opt : { file : UploadFile } ) => VueNode > ,
30+ showRemoveIcon : booleanType ( ) ,
31+ showDownloadIcon : booleanType ( ) ,
32+ showPreviewIcon : booleanType ( ) ,
33+ removeIcon : functionType < ( opt : { file : UploadFile } ) => VueNode > ( ) ,
34+ downloadIcon : functionType < ( opt : { file : UploadFile } ) => VueNode > ( ) ,
35+ previewIcon : functionType < ( opt : { file : UploadFile } ) => VueNode > ( ) ,
3436
35- iconRender : Function as PropType < ( opt : { file : UploadFile } ) => VueNode > ,
36- actionIconRender : Function as PropType <
37- ( opt : {
38- customIcon : VueNode ;
39- callback : ( ) => void ;
40- prefixCls : string ;
41- title ?: string | undefined ;
42- } ) => VueNode
43- > ,
44- itemRender : Function as PropType < ItemRender > ,
45- onPreview : Function as PropType < ( file : UploadFile , e : Event ) => void > ,
46- onClose : Function as PropType < ( file : UploadFile ) => void > ,
47- onDownload : Function as PropType < ( file : UploadFile ) => void > ,
48- progress : Object as PropType < UploadListProgressProps > ,
37+ iconRender : functionType < ( opt : { file : UploadFile } ) => VueNode > ( ) ,
38+ actionIconRender :
39+ functionType <
40+ ( opt : {
41+ customIcon : VueNode ;
42+ callback : ( ) => void ;
43+ prefixCls : string ;
44+ title ?: string | undefined ;
45+ } ) => VueNode
46+ > ( ) ,
47+ itemRender : functionType < ItemRender > ( ) ,
48+ onPreview : functionType < ( file : UploadFile , e : Event ) => void > ( ) ,
49+ onClose : functionType < ( file : UploadFile ) => void > ( ) ,
50+ onDownload : functionType < ( file : UploadFile ) => void > ( ) ,
51+ progress : objectType < UploadListProgressProps > ( ) ,
4952 } ;
5053} ;
5154
@@ -93,7 +96,6 @@ export default defineComponent({
9396 const { class : className , style } = attrs ;
9497 // This is used for legacy span make scrollHeight the wrong value.
9598 // We will force these to be `display: block` with non `picture-card`
96- const spanClassName = `${ prefixCls } -span` ;
9799
98100 const iconNode = iconRender ( { file } ) ;
99101 let icon = < div class = { `${ prefixCls } -text-icon` } > { iconNode } </ div > ;
@@ -162,7 +164,7 @@ export default defineComponent({
162164 < span
163165 key = "download-delete"
164166 class = { [
165- `${ prefixCls } -list-item-card- actions` ,
167+ `${ prefixCls } -list-item-actions` ,
166168 {
167169 picture : listType === 'picture' ,
168170 } ,
@@ -231,30 +233,29 @@ export default defineComponent({
231233 } else {
232234 message = file . error ?. statusText || file . error ?. message || locale . uploadError ;
233235 }
234- const iconAndPreview = (
235- < span class = { spanClassName } >
236- { icon }
237- { preview }
238- </ span >
239- ) ;
240236
241237 const dom = (
242238 < div class = { infoUploadingClass } >
243- < div class = { `${ prefixCls } -list-item-info` } > { iconAndPreview } </ div >
239+ { icon }
240+ { preview }
244241 { actions }
245242 { showProgress . value && (
246243 < Transition { ...transitionProps . value } >
247244 < div v-show = { file . status === 'uploading' } class = { `${ prefixCls } -list-item-progress` } >
248245 { 'percent' in file ? (
249- < Progress { ...progressProps } type = "line" percent = { file . percent } />
246+ < Progress
247+ { ...( progressProps as UploadListProgressProps ) }
248+ type = "line"
249+ percent = { file . percent }
250+ />
250251 ) : null }
251252 </ div >
252253 </ Transition >
253254 ) }
254255 </ div >
255256 ) ;
256257 const listContainerNameClass = {
257- [ `${ prefixCls } -list-${ listType } -container` ] : true ,
258+ [ `${ prefixCls } -list-item -container` ] : true ,
258259 [ `${ className } ` ] : ! ! className ,
259260 } ;
260261 const item =
0 commit comments