feat: Add sorting functionality to the virtual file system and adapter list methods

This commit is contained in:
shiyu
2025-09-06 16:15:24 +08:00
parent 57919aa7ae
commit 74ffc0bb30
12 changed files with 211 additions and 48 deletions

View File

@@ -27,12 +27,14 @@ export interface SearchResultItem {
}
export const vfsApi = {
list: (path: string, page: number = 1, pageSize: number = 50) => {
list: (path: string, page: number = 1, pageSize: number = 50, sortBy: string = 'name', sortOrder: string = 'asc') => {
const cleaned = path.replace(/\\/g, '/');
const trimmed = cleaned === '/' ? '' : cleaned.replace(/^\/+/, '');
const params = new URLSearchParams({
page: page.toString(),
page_size: pageSize.toString()
page_size: pageSize.toString(),
sort_by: sortBy,
sort_order: sortOrder
});
return request<DirListing>(`/fs/${encodeURI(trimmed)}?${params}`);
},