Add configurable columns to directory view
This commit is contained in:
@@ -270,9 +270,14 @@ const sort_children = (children: FSNode[], field: string, asc: boolean) => {
|
||||
[a, b] = [b, a]
|
||||
}
|
||||
|
||||
// If the two values are equal then we force sort by name, since names
|
||||
// are always unique
|
||||
if (a[field] === b[field]) {
|
||||
if (field === "size") {
|
||||
// When doing a size comparison we also take the recursive directory
|
||||
// size into account
|
||||
return (a.type === "dir" ? a.recursive_size : a.file_size) -
|
||||
(b.type === "dir" ? b.recursive_size : b.file_size)
|
||||
} else if (a[field] === b[field]) {
|
||||
// If the two values are equal then we force sort by name, since
|
||||
// names are always unique
|
||||
return a.name.localeCompare(b.name, undefined, { numeric: true })
|
||||
} else if (typeof (a[field]) === "number") {
|
||||
// Sort ints from high to low
|
||||
|
||||
Reference in New Issue
Block a user