@@ -71,7 +71,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
71
71
localization,
72
72
disableScroll,
73
73
footerClassName,
74
- headerClassName
74
+ headerClassName,
75
75
} = mergeProps ( props , DropzonePropsDefault ) ;
76
76
//ref for ripple
77
77
const dz_ui_ripple_ref = React . useRef < HTMLDivElement > ( null ) ;
@@ -88,7 +88,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
88
88
const output : FileValidated [ ] = fileListvalidator (
89
89
fileList ,
90
90
remainingValids ,
91
- localValidator
91
+ localValidator ,
92
92
) ;
93
93
onChange ?.( output ) ;
94
94
}
@@ -111,7 +111,8 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
111
111
const [ localMessage , setLocalMessage ] = React . useState < string > ( "" ) ;
112
112
113
113
//ClassName for dynamic style
114
- const [ onUploadingStart , setOnUploadingStart ] = React . useState < boolean > ( false ) ;
114
+ const [ onUploadingStart , setOnUploadingStart ] =
115
+ React . useState < boolean > ( false ) ;
115
116
// const [queueFiles, setQueueFiles] = React.useState<FileValidated[]>([]);
116
117
// const offset:number= header && footer? 50: (!header && footer?23:(header && !footer?22:0)) ;
117
118
@@ -120,7 +121,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
120
121
backgroundColor ,
121
122
disableScroll ? undefined : maxHeight ,
122
123
minHeight ,
123
- header && footer ? 50 : ! header && footer ? 23 : header && ! footer ? 22 : 0
124
+ header && footer ? 50 : ! header && footer ? 23 : header && ! footer ? 22 : 0 ,
124
125
) ;
125
126
const finalClassName : string = `dropzone-ui${ classNameCreated } ${
126
127
isDragging ? ` drag` : ``
@@ -166,7 +167,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
166
167
* @param files
167
168
*/
168
169
const fakeUpload = (
169
- file : FileValidated
170
+ file : FileValidated ,
170
171
) : Promise < UploadPromiseAxiosResponse > => {
171
172
return new Promise ( ( resolve , reject ) => {
172
173
setTimeout ( ( ) => {
@@ -212,7 +213,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
212
213
const uploadFiles = async ( files : FileValidated [ ] ) => {
213
214
const totalNumber = files . length ;
214
215
const missingUpload = files . filter (
215
- ( x ) => x . valid && x . uploadStatus !== "success"
216
+ ( x ) => x . valid && x . uploadStatus !== "success" ,
216
217
) . length ;
217
218
let totalRejected : number = 0 ;
218
219
let currentCountUpload : number = 0 ;
@@ -222,7 +223,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
222
223
setOnUploadingStart ( true ) ;
223
224
if ( missingUpload > 0 && url ) {
224
225
setLocalMessage (
225
- uploadingMessenger ( `${ missingUpload } /${ totalNumber } ` )
226
+ uploadingMessenger ( `${ missingUpload } /${ totalNumber } ` ) ,
226
227
/* localization === "ES-es"
227
228
? `Subiendo ${missingUpload}/${totalNumber} archivos`
228
229
: `uploading ${missingUpload}/${totalNumber} files`, */
@@ -241,14 +242,14 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
241
242
let serverResponses : FileDuiResponse [ ] = [ ] ;
242
243
onUploadStart ?.(
243
244
uploadStartFiles . filter (
244
- ( f ) => f . uploadStatus === UPLOADSTATUS . uploading
245
- )
245
+ ( f ) => f . uploadStatus === UPLOADSTATUS . uploading ,
246
+ ) ,
246
247
) ;
247
248
for ( let i = 0 ; i < uploadStartFiles . length ; i ++ ) {
248
249
let currentFile : FileValidated = uploadStartFiles [ i ] ;
249
250
if ( currentFile . uploadStatus === UPLOADSTATUS . uploading ) {
250
251
setLocalMessage (
251
- uploadingMessenger ( `${ ++ currentCountUpload } /${ missingUpload } ` )
252
+ uploadingMessenger ( `${ ++ currentCountUpload } /${ missingUpload } ` ) ,
252
253
) ;
253
254
254
255
const { serverResponse, uploadedFile } : UploadPromiseAxiosResponse =
@@ -277,14 +278,14 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
277
278
const finishUploadMessenger : FunctionLabel =
278
279
DropzoneLocalizer . uploadFinished as FunctionLabel ;
279
280
setLocalMessage (
280
- finishUploadMessenger ( missingUpload - totalRejected , totalRejected )
281
+ finishUploadMessenger ( missingUpload - totalRejected , totalRejected ) ,
281
282
) ;
282
283
setTimeout ( ( ) => {
283
284
setOnUploadingStart ( false ) ;
284
285
} , 2300 ) ;
285
286
} else {
286
287
setLocalMessage (
287
- DropzoneLocalizer . noFilesMessage as string
288
+ DropzoneLocalizer . noFilesMessage as string ,
288
289
/* localization === "ES-es"
289
290
? `No hay archivos válidos pendientes por subir`
290
291
: `There is not any missing valid file for uploading`, */
@@ -317,7 +318,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
317
318
* @param evt
318
319
*/
319
320
const kamui : React . DragEventHandler < HTMLDivElement > = async (
320
- evt : React . DragEvent < HTMLDivElement >
321
+ evt : React . DragEvent < HTMLDivElement > ,
321
322
) : Promise < void > => {
322
323
evt . stopPropagation ( ) ;
323
324
evt . preventDefault ( ) ;
@@ -335,7 +336,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
335
336
const output : FileValidated [ ] = fileListvalidator (
336
337
fileList ,
337
338
behaviour === "replace" ? maxFiles || Infinity : remainingValids ,
338
- localValidator
339
+ localValidator ,
339
340
) ;
340
341
if ( ! disableRipple ) {
341
342
createRippleFromElement ( dz_ui_ripple_ref . current , evt , color as string ) ;
@@ -346,7 +347,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
346
347
} ;
347
348
348
349
const handleOnChangeInput : React . ChangeEventHandler < HTMLInputElement > = (
349
- evt : React . ChangeEvent < HTMLInputElement >
350
+ evt : React . ChangeEvent < HTMLInputElement > ,
350
351
) : void => {
351
352
if ( onUploadingStart ) {
352
353
return ;
@@ -360,7 +361,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
360
361
const output : FileValidated [ ] = fileListvalidator (
361
362
fileList ,
362
363
behaviour === "replace" ? maxFiles || Infinity : remainingValids ,
363
- localValidator
364
+ localValidator ,
364
365
) ;
365
366
// Clean input element to trigger onChange event on input
366
367
let element : HTMLInputElement | null = inputRef . current ;
@@ -375,7 +376,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
375
376
const fileListvalidator = (
376
377
preValidatedFiles : FileList ,
377
378
remainingValids : number ,
378
- localValidator : FileValidator
379
+ localValidator : FileValidator ,
379
380
) : FileValidated [ ] => {
380
381
const output : FileValidated [ ] = [ ] ;
381
382
let countdown : number = remainingValids ;
@@ -412,23 +413,23 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
412
413
}
413
414
} ;
414
415
const handleDragEnter : React . DragEventHandler < HTMLDivElement > = (
415
- evt : React . DragEvent < HTMLDivElement >
416
+ evt : React . DragEvent < HTMLDivElement > ,
416
417
) : void => {
417
418
evt . stopPropagation ( ) ;
418
419
evt . preventDefault ( ) ;
419
420
evt . dataTransfer . dropEffect = "link" ;
420
421
setIsDragging ( true ) ;
421
422
} ;
422
423
const handleDragLeave : React . DragEventHandler < HTMLDivElement > = (
423
- evt : React . DragEvent < HTMLDivElement >
424
+ evt : React . DragEvent < HTMLDivElement > ,
424
425
) : void => {
425
426
evt . stopPropagation ( ) ;
426
427
evt . preventDefault ( ) ;
427
428
evt . dataTransfer . dropEffect = "link" ;
428
429
setIsDragging ( false ) ;
429
430
} ;
430
431
function handleClick < T extends HTMLDivElement > (
431
- e : React . MouseEvent < T , MouseEvent >
432
+ e : React . MouseEvent < T , MouseEvent > ,
432
433
) : void {
433
434
let referenceInput = inputRef . current ;
434
435
referenceInput ?. click ( ) ;
@@ -460,6 +461,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
460
461
< div className = "dropzone-ui-ripple" ref = { dz_ui_ripple_ref } > </ div >
461
462
{ header && (
462
463
< DropzoneHeader
464
+ headerClassName = { headerClassName }
463
465
maxFileSize = { maxFileSize }
464
466
numberOfValidFiles = { files . filter ( ( x ) => x . valid ) . length }
465
467
onReset = { ! onUploadingStart ? handleReset : undefined }
@@ -503,6 +505,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
503
505
504
506
{ footer && (
505
507
< DropzoneFooter
508
+ footerClassName = { footerClassName }
506
509
accept = { accept }
507
510
message = { onUploadingStart ? localMessage : undefined }
508
511
localization = { localization }
0 commit comments