diff options
author | Christopher Ng <chrng8@gmail.com> | 2024-08-07 20:52:29 -0700 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2024-08-08 11:15:52 -0700 |
commit | 44bc57bc57d9129ab15041b631aca5d48c52124a (patch) | |
tree | c979d2744c3271cd8579b1e10ea91459311a699c /apps/files/src/components | |
parent | cfec6fcb1a9eaa57bef5bba757b5b9dbda387c96 (diff) | |
download | nextcloud-server-44bc57bc57d9129ab15041b631aca5d48c52124a.tar.gz nextcloud-server-44bc57bc57d9129ab15041b631aca5d48c52124a.zip |
feat: Load limited depth tree
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/files/src/components')
-rw-r--r-- | apps/files/src/components/FilesNavigationItem.vue | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/files/src/components/FilesNavigationItem.vue b/apps/files/src/components/FilesNavigationItem.vue index 75507803957..f05ad389f50 100644 --- a/apps/files/src/components/FilesNavigationItem.vue +++ b/apps/files/src/components/FilesNavigationItem.vue @@ -9,6 +9,7 @@ :key="view.id" class="files-navigation__item" allow-collapse + :loading="view.loading" :data-cy-files-navigation-item="view.id" :exact="useExactRouteMatching(view)" :icon="view.iconClass" @@ -17,11 +18,14 @@ :pinned="view.sticky" :to="generateToNavigation(view)" :style="style" - @update:open="onToggleExpand(view)"> + @update:open="(open) => onOpen(open, view)"> <template v-if="view.icon" #icon> <NcIconSvgWrapper :svg="view.icon" /> </template> + <!-- Hack to force the collapse icon to be displayed --> + <li v-if="view.loadChildViews && !view.loaded" style="display: none" /> + <!-- Recursively nest child views --> <FilesNavigationItem v-if="hasChildViews(view)" :parent="view" @@ -142,14 +146,18 @@ export default defineComponent({ /** * Expand/collapse a a view with children and permanently * save this setting in the server. - * @param view View to toggle + * @param open True if open + * @param view View */ - onToggleExpand(view: View) { + async onOpen(open: boolean, view: View) { // Invert state const isExpanded = this.isExpanded(view) // Update the view expanded state, might not be necessary view.expanded = !isExpanded this.viewConfigStore.update(view.id, 'expanded', !isExpanded) + if (open && view.loadChildViews) { + await view.loadChildViews(view) + } }, /** |