Numeric sorting and filter. "New Folder 12" > "New Folder 2"

This commit is contained in:
Leo Vasanko
2023-11-04 01:27:09 +00:00
parent 115bb5db59
commit 997e0b8549
62 changed files with 64 additions and 63 deletions

View File

@@ -73,7 +73,7 @@ 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) : 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
},
@@ -85,6 +85,7 @@ export const useDocumentStore = defineStore({
if (
localeIncludes(name, filter, {
usage: 'search',
numeric: true,
sensitivity: 'base'
})
) {