@@ -48,6 +48,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
48
48
onChangeView,
49
49
view,
50
50
maxHeight,
51
+ minHeight,
51
52
uploadOnDrop,
52
53
footer,
53
54
header,
@@ -87,7 +88,8 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
87
88
const classNameCreated : string = useDropzoneStyles (
88
89
color ,
89
90
backgroundColor ,
90
- maxHeight
91
+ maxHeight ,
92
+ minHeight ,
91
93
) ;
92
94
const finalClassName : string = `dropzone-ui${ classNameCreated } ${
93
95
isDragging ? ` drag` : ``
@@ -122,11 +124,11 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
122
124
* @param files
123
125
*/
124
126
const fakeUpload = (
125
- file : FileValidated
127
+ file : FileValidated ,
126
128
) : Promise < UploadPromiseAxiosResponse > => {
127
129
return new Promise ( ( resolve , reject ) => {
128
130
setTimeout ( ( ) => {
129
- const randomNumber = Math . floor ( Math . random ( ) * 10 ) ;
131
+ const randomNumber = Math . floor ( Math . random ( ) * 10 ) ;
130
132
if ( randomNumber % 2 === 0 ) {
131
133
const status = true ;
132
134
const message = DropzoneLocalizer . fakeuploadsuccess as string ;
@@ -168,7 +170,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
168
170
const uploadFiles = async ( files : FileValidated [ ] ) => {
169
171
const totalNumber = files . length ;
170
172
const missingUpload = files . filter (
171
- ( x ) => x . valid && x . uploadStatus !== "success"
173
+ ( x ) => x . valid && x . uploadStatus !== "success" ,
172
174
) . length ;
173
175
let totalRejected : number = 0 ;
174
176
let currentCountUpload : number = 0 ;
@@ -178,7 +180,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
178
180
setOnUploadingStart ( true ) ;
179
181
if ( missingUpload > 0 && url ) {
180
182
setLocalMessage (
181
- uploadingMessenger ( `${ missingUpload } /${ totalNumber } ` )
183
+ uploadingMessenger ( `${ missingUpload } /${ totalNumber } ` ) ,
182
184
/* localization === "ES-es"
183
185
? `Subiendo ${missingUpload}/${totalNumber} archivos`
184
186
: `uploading ${missingUpload}/${totalNumber} files`, */
@@ -197,14 +199,14 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
197
199
let serverResponses : FileDuiResponse [ ] = [ ] ;
198
200
onUploadStart ?.(
199
201
uploadStartFiles . filter (
200
- ( f ) => f . uploadStatus === UPLOADSTATUS . uploading
201
- )
202
+ ( f ) => f . uploadStatus === UPLOADSTATUS . uploading ,
203
+ ) ,
202
204
) ;
203
205
for ( let i = 0 ; i < uploadStartFiles . length ; i ++ ) {
204
206
let currentFile : FileValidated = uploadStartFiles [ i ] ;
205
207
if ( currentFile . uploadStatus === UPLOADSTATUS . uploading ) {
206
208
setLocalMessage (
207
- uploadingMessenger ( `${ ++ currentCountUpload } /${ missingUpload } ` )
209
+ uploadingMessenger ( `${ ++ currentCountUpload } /${ missingUpload } ` ) ,
208
210
) ;
209
211
210
212
const { serverResponse, uploadedFile } : UploadPromiseAxiosResponse =
@@ -233,7 +235,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
233
235
const finishUploadMessenger : FunctionLabel =
234
236
DropzoneLocalizer . uploadFinished as FunctionLabel ;
235
237
setLocalMessage (
236
- finishUploadMessenger ( missingUpload - totalRejected , totalRejected )
238
+ finishUploadMessenger ( missingUpload - totalRejected , totalRejected ) ,
237
239
/* localization === "ES-es"
238
240
? `Archivos subidos: ${missingUpload - totalRejected}, Rechazados: ${totalRejected}`
239
241
: `Uloaded files: ${missingUpload - totalRejected}, Rejected: ${totalRejected}`,
@@ -245,7 +247,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
245
247
//console.log("queueFiles files:", queueFiles);
246
248
} else {
247
249
setLocalMessage (
248
- DropzoneLocalizer . noFilesMessage as string
250
+ DropzoneLocalizer . noFilesMessage as string ,
249
251
/* localization === "ES-es"
250
252
? `No hay archivos válidos pendientes por subir`
251
253
: `There is not any missing valid file for uploading`, */
@@ -272,7 +274,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
272
274
* @param evt
273
275
*/
274
276
const kamui : React . DragEventHandler < HTMLDivElement > = async (
275
- evt : React . DragEvent < HTMLDivElement >
277
+ evt : React . DragEvent < HTMLDivElement > ,
276
278
) : Promise < void > => {
277
279
evt . stopPropagation ( ) ;
278
280
evt . preventDefault ( ) ;
@@ -284,7 +286,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
284
286
const remainingValids : number = ( maxFiles || 7 ) - numberOfValidFiles ;
285
287
const output : FileValidated [ ] = fileListvalidator (
286
288
fileList ,
287
- remainingValids
289
+ remainingValids ,
288
290
) ;
289
291
if ( ! disableRipple ) {
290
292
createRipple ( evt , color as string ) ;
@@ -294,7 +296,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
294
296
} ;
295
297
296
298
const handleOnChangeInput : React . ChangeEventHandler < HTMLInputElement > = (
297
- evt : React . ChangeEvent < HTMLInputElement >
299
+ evt : React . ChangeEvent < HTMLInputElement > ,
298
300
) : void => {
299
301
if ( onUploadingStart ) {
300
302
return ;
@@ -303,15 +305,15 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
303
305
const remainingValids : number = ( maxFiles || 7 ) - numberOfValidFiles ;
304
306
const output : FileValidated [ ] = fileListvalidator (
305
307
fileList ,
306
- remainingValids
308
+ remainingValids ,
307
309
) ;
308
310
handleFilesChange ( output ) ;
309
311
} ;
310
312
311
313
//local function validator
312
314
const fileListvalidator = (
313
315
preValidatedFiles : FileList ,
314
- remainingValids : number
316
+ remainingValids : number ,
315
317
) : FileValidated [ ] => {
316
318
const output : FileValidated [ ] = [ ] ;
317
319
let countdown : number = remainingValids ;
@@ -345,23 +347,23 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
345
347
}
346
348
} ;
347
349
const handleDragEnter : React . DragEventHandler < HTMLDivElement > = (
348
- evt : React . DragEvent < HTMLDivElement >
350
+ evt : React . DragEvent < HTMLDivElement > ,
349
351
) : void => {
350
352
evt . stopPropagation ( ) ;
351
353
evt . preventDefault ( ) ;
352
354
evt . dataTransfer . dropEffect = "link" ;
353
355
setIsDragging ( true ) ;
354
356
} ;
355
357
const handleDragLeave : React . DragEventHandler < HTMLDivElement > = (
356
- evt : React . DragEvent < HTMLDivElement >
358
+ evt : React . DragEvent < HTMLDivElement > ,
357
359
) : void => {
358
360
evt . stopPropagation ( ) ;
359
361
evt . preventDefault ( ) ;
360
362
evt . dataTransfer . dropEffect = "link" ;
361
363
setIsDragging ( false ) ;
362
364
} ;
363
365
function handleClick < T extends HTMLDivElement > (
364
- e : React . MouseEvent < T , MouseEvent >
366
+ e : React . MouseEvent < T , MouseEvent > ,
365
367
) : void {
366
368
let referenceInput = inputRef . current ;
367
369
referenceInput ?. click ( ) ;
@@ -405,7 +407,9 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
405
407
/>
406
408
) }
407
409
{ value && files && files . length > 0 ? (
408
- < FileItemContainer view = { localView } > { children } </ FileItemContainer >
410
+ < FileItemContainer view = { localView } style = { { minHeight, maxHeight } } >
411
+ { children }
412
+ </ FileItemContainer >
409
413
) : (
410
414
< DropzoneLabel >
411
415
{ label || ( DropzoneLocalizer . defaultLabel as string ) }
0 commit comments