@@ -204,7 +204,11 @@ const AjaxUploader: React.FC<Readonly<React.PropsWithChildren<UploadProps>>> = p
204204 props . onBatchStart ?.(
205205 fileList . map ( ( { origin, parsedFile } ) => ( { file : origin , parsedFile } ) ) ,
206206 ) ;
207- fileList . filter ( file => file . parsedFile !== null ) . forEach ( file => post ( file ) ) ;
207+ fileList
208+ . filter ( file => file . parsedFile !== null )
209+ . forEach ( file => {
210+ post ( file ) ;
211+ } ) ;
208212 } ) ;
209213 } ;
210214
@@ -259,14 +263,8 @@ const AjaxUploader: React.FC<Readonly<React.PropsWithChildren<UploadProps>>> = p
259263 }
260264 } ;
261265
262- const cls = classnames ( prefixCls , className , {
263- [ `${ prefixCls } -disabled` ] : disabled ,
264- } ) ;
265-
266266 // because input don't have directory/webkitdirectory type declaration
267- const dirProps : any = directory
268- ? { directory : 'directory' , webkitdirectory : 'webkitdirectory' }
269- : { } ;
267+ const dirProps = directory ? { directory : 'directory' , webkitdirectory : 'webkitdirectory' } : { } ;
270268
271269 const events = disabled
272270 ? { }
@@ -277,11 +275,18 @@ const AjaxUploader: React.FC<Readonly<React.PropsWithChildren<UploadProps>>> = p
277275 onMouseLeave,
278276 onDrop : onFileDrop ,
279277 onDragOver : onFileDrop ,
280- tabIndex : hasControlInside ? undefined : 0 ,
281278 } ;
282279
283280 return (
284- < Tag { ...events } className = { cls } role = { hasControlInside ? undefined : 'button' } style = { style } >
281+ < Tag
282+ { ...events }
283+ style = { style }
284+ role = { disabled || hasControlInside ? undefined : 'button' }
285+ tabIndex = { disabled || hasControlInside ? undefined : 0 }
286+ className = { classnames ( prefixCls , className , {
287+ [ `${ prefixCls } -disabled` ] : disabled ,
288+ } ) }
289+ >
285290 < input
286291 { ...pickAttrs ( otherProps , { aria : true , data : true } ) }
287292 id = { id }
@@ -308,4 +313,8 @@ const AjaxUploader: React.FC<Readonly<React.PropsWithChildren<UploadProps>>> = p
308313 ) ;
309314} ;
310315
316+ if ( process . env . NODE_ENV !== 'production' ) {
317+ AjaxUploader . displayName = 'AjaxUploader' ;
318+ }
319+
311320export default AjaxUploader ;
0 commit comments