@@ -39,30 +39,34 @@ export const AllFilesList = ({
39
39
onSelect ( getNewValue ( fullPath , checked , multiple , value ) ) ;
40
40
41
41
const items = [
42
- ...dirs . map ( ( path ) => {
43
- const fullPath = getFullPath ( breadcrumbs , path ) ;
44
- const type : FileOrDirectory = 'directory' ;
45
- return {
46
- fullPath,
47
- key : fullPath ,
48
- mimeType : undefined ,
49
- title : path ,
50
- type,
51
- onClick : ( ) => setBreadcrumbs ( [ ...breadcrumbs , path ] ) ,
52
- onSelect : targetType . startsWith ( 'dir' ) ? handleSelect ( fullPath ) : undefined ,
53
- } ;
54
- } ) ,
55
- ...files . map ( ( file ) => {
56
- const fullPath = getFullPath ( breadcrumbs , file . file_name ) ;
57
- const type : FileOrDirectory = 'file' ;
58
- return {
59
- fullPath,
60
- mimeType : file . mime_type ,
61
- title : file . file_name ,
62
- type,
63
- onSelect : handleSelect ( fullPath ) ,
64
- } ;
65
- } ) ,
42
+ ...dirs
43
+ . map ( ( path ) => {
44
+ const fullPath = getFullPath ( breadcrumbs , path ) ;
45
+ const type : FileOrDirectory = 'directory' ;
46
+ return {
47
+ fullPath,
48
+ key : fullPath ,
49
+ mimeType : undefined ,
50
+ title : path ,
51
+ type,
52
+ onClick : ( ) => setBreadcrumbs ( [ ...breadcrumbs , path ] ) ,
53
+ onSelect : targetType . startsWith ( 'dir' ) ? handleSelect ( fullPath ) : undefined ,
54
+ } ;
55
+ } )
56
+ . sort ( ( dirA , dirB ) => dirA . title . localeCompare ( dirB . title ) ) ,
57
+ ...files
58
+ . map ( ( file ) => {
59
+ const fullPath = getFullPath ( breadcrumbs , file . file_name ) ;
60
+ const type : FileOrDirectory = 'file' ;
61
+ return {
62
+ fullPath,
63
+ mimeType : file . mime_type ,
64
+ title : file . file_name ,
65
+ type,
66
+ onSelect : handleSelect ( fullPath ) ,
67
+ } ;
68
+ } )
69
+ . sort ( ( fileA , fileB ) => fileA . title . localeCompare ( fileB . title ) ) ,
66
70
] ;
67
71
68
72
if ( isLoading ) {
0 commit comments