Bugfixes on tooltip z-indexing. Search using breadcrumbs in table. Link fixes.

This commit is contained in:
Leo Vasanko
2023-11-07 00:44:55 +00:00
parent e3af21af91
commit 1f24313d23
7 changed files with 166 additions and 123 deletions

View File

@@ -60,7 +60,7 @@ export const useDocumentStore = defineStore({
updateRoot(root: DirEntry | null = null) {
root ??= this.root
// Transform tree data to flat documents array
let loc = [] as Array<string>
let loc = ""
const mapper = ([name, attr]: [string, FileEntry | DirEntry]) => ({
loc,
name,
@@ -75,7 +75,7 @@ export const useDocumentStore = defineStore({
for (let doc; (doc = queue.shift()) !== undefined;) {
docs.push(doc)
if ("dir" in doc) {
loc = [...doc.loc, doc.name]
loc = doc.loc ? `${doc.loc}/${doc.name}` : doc.name
queue.push(...Object.entries(doc.dir).map(mapper))
}
}
@@ -88,16 +88,6 @@ export const useDocumentStore = defineStore({
this.root = root
this.document = docs
},
find(query: string): Document[] {
const needle = needleFormat(query)
return this.document.filter(doc => localeIncludes(doc.haystack, needle))
},
directory(loc: string[]) {
const ret = this.document.filter(
doc => doc.loc.length === loc.length && doc.loc.every((e, i) => e === loc[i])
)
return ret
},
updateUploadingDocuments(key: number, progress: number) {
for (const d of this.uploadingDocuments) {
if (d.key === key) d.progress = progress
@@ -129,12 +119,19 @@ export const useDocumentStore = defineStore({
}
},
getters: {
mainDocument(): Document[] {
return this.document
},
isUserLogged(): boolean {
return this.user.isLoggedIn
},
recentDocuments(): Document[] {
const ret = [...this.document]
ret.sort((a, b) => b.mtime - a.mtime)
return ret
},
largeDocuments(): Document[] {
const ret = [...this.document]
ret.sort((a, b) => b.size - a.size)
return ret
},
selectedFiles(): SelectedItems {
function traverseDir(data: DirEntry | FileEntry, path: string, relpath: string) {
if (!('dir' in data)) return