@@ -122,6 +122,7 @@ export const StoredFilesRendererBase: FC<IStoredFilesRendererBaseProps> = ({
122122 hideFileName : rest . hideFileName && listType === 'thumbnail' ,
123123 isDragger,
124124 isStub,
125+ downloadZip,
125126 } ,
126127 } ) ;
127128
@@ -284,71 +285,69 @@ export const StoredFilesRendererBase: FC<IStoredFilesRendererBaseProps> = ({
284285 } ;
285286
286287 return (
287- < div className = { `${ styles . shaStoredFilesRenderer } ${ layout === 'horizontal' && listTypeAndLayout !== 'text' ? styles . shaStoredFilesRendererHorizontal
288- : layout === 'vertical' && listTypeAndLayout !== 'text' ? styles . shaStoredFilesRendererVertical
289- : layout === 'grid' && listTypeAndLayout !== 'text' ? styles . shaStoredFilesRendererGrid : '' } `}
290- >
291- { isStub
292- ? ( isDragger
293- ? < Dragger disabled > < DraggerStub styles = { styles } /> </ Dragger >
294- : (
295- < div
296- className = { listType === 'thumbnail' ? 'ant-upload-list-item-thumbnail ant-upload-list-item thumbnail-stub' : '' }
297- >
298- { renderUploadContent ( ) }
299- { listType !== 'text' && ! rest . hideFileName && (
300- < span className = "ant-upload-list-item-name ant-upload-list-item-name-stub" >
301- file name
302- </ span >
303- ) }
304- </ div >
305- ) )
306- : ( props . disabled && fileList . length === 0
307- ? (
308- < div className = { listType === 'thumbnail' ? styles . thumbnailReadOnly : '' } >
309- { renderUploadContent ( ) }
310- </ div >
311- )
312- : props . disabled
313- ? < Upload { ...props } style = { model ?. allStyles ?. fullStyle } listType = { listTypeAndLayout } />
314- : isDragger
315- ? (
316- < Dragger { ...props } >
317- < DraggerStub styles = { styles } />
318- </ Dragger >
319- )
320- : < Upload { ...props } listType = { listTypeAndLayout } > { renderUploadContent ( ) } </ Upload > ) }
321- { previewImage && (
322- < Image
323- wrapperStyle = { { display : 'none' } }
324- preview = { {
325- visible : previewOpen ,
326- onVisibleChange : ( visible ) => setPreviewOpen ( visible ) ,
327- afterOpenChange : ( visible ) => ! visible && setPreviewImage ( null ) ,
328- toolbarRender : ( original ) => {
329- return < div style = { { display : 'flex' , flexDirection : 'row-reverse' } } > < DownloadOutlined className = { styles . antPreviewDownloadIcon } onClick = { ( ) => downloadFile ( { fileId : previewImage . uid , fileName : previewImage . name } ) } /> { original } </ div > ;
330- } ,
331- } }
332- src = { previewImage . url }
333- />
334- ) }
335-
336- { fetchFilesError && (
337- < Alert message = "Error" description = "Sorry, an error occurred while trying to fetch file list." type = "error" />
338- ) }
339-
340- { downloadZipFileError && (
341- < Alert message = "Error" description = "Sorry, an error occurred while trying to download zip file." type = "error" />
342- ) }
343-
344- { downloadZip && hasFiles && ! ! downloadZipFile && (
345- < div className = { styles . storedFilesRendererBtnContainer } >
346- < Button size = "small" type = "link" icon onClick = { ( ) => downloadZipFile ( ) } loading = { isDownloadingFileListZip } >
347- { ! isDownloadingFileListZip && < FileZipOutlined /> } Download Zip
348- </ Button >
349- </ div >
350- ) }
351-
288+ < div className = { styles . storedFilesRendererWrapper } >
289+ < div className = { `${ styles . shaStoredFilesRenderer } ${ layout === 'horizontal' && listTypeAndLayout !== 'text' ? styles . shaStoredFilesRendererHorizontal
290+ : layout === 'vertical' && listTypeAndLayout !== 'text' ? styles . shaStoredFilesRendererVertical
291+ : layout === 'grid' && listTypeAndLayout !== 'text' ? styles . shaStoredFilesRendererGrid : '' } `}
292+ >
293+ { isStub
294+ ? ( isDragger
295+ ? < Dragger disabled > < DraggerStub styles = { styles } /> </ Dragger >
296+ : (
297+ < div
298+ className = { listType === 'thumbnail' ? 'ant-upload-list-item-thumbnail ant-upload-list-item thumbnail-stub' : '' }
299+ >
300+ { renderUploadContent ( ) }
301+ { listType !== 'text' && ! rest . hideFileName && (
302+ < span className = "ant-upload-list-item-name ant-upload-list-item-name-stub" >
303+ file name
304+ </ span >
305+ ) }
306+ </ div >
307+ ) )
308+ : ( props . disabled && fileList . length === 0
309+ ? null
310+ : props . disabled
311+ ? < Upload { ...props } style = { model ?. allStyles ?. fullStyle } listType = { listTypeAndLayout } />
312+ : isDragger
313+ ? (
314+ < Dragger { ...props } >
315+ < DraggerStub styles = { styles } />
316+ </ Dragger >
317+ )
318+ : < Upload { ...props } listType = { listTypeAndLayout } > { renderUploadContent ( ) } </ Upload > ) }
319+ { previewImage && (
320+ < Image
321+ wrapperStyle = { { display : 'none' } }
322+ preview = { {
323+ visible : previewOpen ,
324+ onVisibleChange : ( visible ) => setPreviewOpen ( visible ) ,
325+ afterOpenChange : ( visible ) => ! visible && setPreviewImage ( null ) ,
326+ toolbarRender : ( original ) => {
327+ return < div style = { { display : 'flex' , flexDirection : 'row-reverse' } } > < DownloadOutlined className = { styles . antPreviewDownloadIcon } onClick = { ( ) => downloadFile ( { fileId : previewImage . uid , fileName : previewImage . name } ) } /> { original } </ div > ;
328+ } ,
329+ } }
330+ src = { previewImage . url }
331+ />
332+ ) }
333+
334+ { fetchFilesError && (
335+ < Alert message = "Error" description = "Sorry, an error occurred while trying to fetch file list." type = "error" />
336+ ) }
337+
338+ { downloadZipFileError && (
339+ < Alert message = "Error" description = "Sorry, an error occurred while trying to download zip file." type = "error" />
340+ ) }
341+
342+ { downloadZip && hasFiles && ! ! downloadZipFile && (
343+ < div className = { styles . storedFilesRendererBtnContainer } >
344+ < Button size = "small" type = "link" icon onClick = { ( ) => downloadZipFile ( ) } loading = { isDownloadingFileListZip } >
345+ { ! isDownloadingFileListZip && < FileZipOutlined /> } Download Zip
346+ </ Button >
347+ </ div >
348+ ) }
349+
350+ </ div >
352351 </ div >
353352 ) ;
354353} ;
0 commit comments