Style tuning
This commit is contained in:
@@ -4,7 +4,7 @@ import type {
|
||||
FileEntry,
|
||||
FUID,
|
||||
DirList,
|
||||
SelectedItems,
|
||||
SelectedItems
|
||||
} from '@/repositories/Document'
|
||||
import { formatSize, formatUnixDate } from '@/utils'
|
||||
import { defineStore } from 'pinia'
|
||||
@@ -74,7 +74,14 @@ export const useDocumentStore = defineStore({
|
||||
}
|
||||
// Pre sort directory entries folders first then files, names in natural ordering
|
||||
dataMapped.sort((a, b) =>
|
||||
a.type === b.type ? a.name.localeCompare(b.name, undefined, {numeric: true, sensitivity: 'base'}) : a.type === 'folder' ? -1 : 1
|
||||
a.type === b.type
|
||||
? a.name.localeCompare(b.name, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: 'base'
|
||||
})
|
||||
: a.type === 'folder'
|
||||
? -1
|
||||
: 1
|
||||
)
|
||||
this.document = dataMapped
|
||||
},
|
||||
@@ -183,7 +190,7 @@ export const useDocumentStore = defineStore({
|
||||
ret.fullpath[attr.id] = fullname
|
||||
ret.relpath[attr.id] = r
|
||||
ret.ids.push(attr.id)
|
||||
if (!("dir" in attr)) ret.url[attr.id] = `/files/${fullname}`
|
||||
if (!('dir' in attr)) ret.url[attr.id] = `/files/${fullname}`
|
||||
}
|
||||
traverseDir(attr, fullname, r)
|
||||
}
|
||||
@@ -205,7 +212,12 @@ export const useDocumentStore = defineStore({
|
||||
if (!ret.selected.has(id)) ret.missing.add(id)
|
||||
}
|
||||
// Sorted array of FUIDs for easy traversal
|
||||
ret.ids.sort((a, b) => ret.relpath[a].localeCompare(ret.relpath[b] , undefined, {numeric: true, sensitivity: 'base'}))
|
||||
ret.ids.sort((a, b) =>
|
||||
ret.relpath[a].localeCompare(ret.relpath[b], undefined, {
|
||||
numeric: true,
|
||||
sensitivity: 'base'
|
||||
})
|
||||
)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user