feat(files): allow hidden views

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2025-06-24 15:04:07 +02:00
parent b2d0b4adeb
commit 2c65bd2f4b
No known key found for this signature in database
GPG key ID: 45FAE7268762B400

View file

@ -89,7 +89,7 @@ export default defineComponent({
return (Object.values(this.views).reduce((acc, views) => [...acc, ...views], []) as View[])
.filter(view => view.params?.dir.startsWith(this.parent.params?.dir))
}
return this.views[this.parent.id] ?? [] // Root level views have `undefined` parent ids
return this.filterVisible(this.views[this.parent.id] ?? [])
},
style() {
@ -103,11 +103,15 @@ export default defineComponent({
},
methods: {
filterVisible(views: View[]) {
return views.filter(({ _view, id }) => id === this.currentView?.id || _view.hidden !== true)
},
hasChildViews(view: View): boolean {
if (this.level >= maxLevel) {
return false
}
return this.views[view.id]?.length > 0
return this.filterVisible(this.views[view.id] ?? []).length > 0
},
/**