@@ -3,10 +3,10 @@ import {SvgIcon} from '../svg.ts';
33import {ref } from ' vue' ;
44
55type Item = {
6- name : string ;
7- path : string ;
8- sub_module_url ? : string ;
9- type : string ;
6+ entryName : string ;
7+ entryMode : string ;
8+ fullPath : string ;
9+ submoduleUrl ? : string ;
1010 children? : Item [];
1111};
1212
@@ -26,7 +26,7 @@ const doLoadChildren = async () => {
2626 if (! collapsed .value && props .loadChildren ) {
2727 isLoading .value = true ;
2828 try {
29- children .value = await props .loadChildren (props .item .path );
29+ children .value = await props .loadChildren (props .item .fullPath );
3030 } finally {
3131 isLoading .value = false ;
3232 }
@@ -35,59 +35,59 @@ const doLoadChildren = async () => {
3535
3636const doLoadDirContent = () => {
3737 doLoadChildren ();
38- props .loadContent (props .item .path );
38+ props .loadContent (props .item .fullPath );
3939};
4040
4141const doLoadFileContent = () => {
42- props .loadContent (props .item .path );
42+ props .loadContent (props .item .fullPath );
4343};
4444
4545const doGotoSubModule = () => {
46- location .href = props .item .sub_module_url ;
46+ location .href = props .item .submoduleUrl ;
4747};
4848 </script >
4949
5050<template >
5151 <!-- title instead of tooltip above as the tooltip needs too much work with the current methods, i.e. not being loaded or staying open for "too long"-->
5252 <div
53- v-if =" item.type === 'commit'" class =" tree-item type-submodule"
54- :title =" item.name "
53+ v-if =" item.entryMode === 'commit'" class =" tree-item type-submodule"
54+ :title =" item.entryName "
5555 @click.stop =" doGotoSubModule"
5656 >
5757 <!-- submodule -->
5858 <div class =" item-content" >
5959 <SvgIcon class =" text primary" name =" octicon-file-submodule" />
60- <span class =" gt-ellipsis tw-flex-1" >{{ item.name }}</span >
60+ <span class =" gt-ellipsis tw-flex-1" >{{ item.entryName }}</span >
6161 </div >
6262 </div >
6363 <div
64- v-else-if =" item.type === 'symlink'" class =" tree-item type-symlink"
65- :class =" {'selected': selectedItem.value === item.path }"
66- :title =" item.name "
64+ v-else-if =" item.entryMode === 'symlink'" class =" tree-item type-symlink"
65+ :class =" {'selected': selectedItem.value === item.fullPath }"
66+ :title =" item.entryName "
6767 @click.stop =" doLoadFileContent"
6868 >
6969 <!-- symlink -->
7070 <div class =" item-content" >
7171 <SvgIcon name =" octicon-file-symlink-file" />
72- <span class =" gt-ellipsis tw-flex-1" >{{ item.name }}</span >
72+ <span class =" gt-ellipsis tw-flex-1" >{{ item.entryName }}</span >
7373 </div >
7474 </div >
7575 <div
76- v-else-if =" item.type !== 'tree'" class =" tree-item type-file"
77- :class =" {'selected': selectedItem.value === item.path }"
78- :title =" item.name "
76+ v-else-if =" item.entryMode !== 'tree'" class =" tree-item type-file"
77+ :class =" {'selected': selectedItem.value === item.fullPath }"
78+ :title =" item.entryName "
7979 @click.stop =" doLoadFileContent"
8080 >
8181 <!-- file -->
8282 <div class =" item-content" >
8383 <SvgIcon name =" octicon-file" />
84- <span class =" gt-ellipsis tw-flex-1" >{{ item.name }}</span >
84+ <span class =" gt-ellipsis tw-flex-1" >{{ item.entryName }}</span >
8585 </div >
8686 </div >
8787 <div
8888 v-else class =" tree-item type-directory"
89- :class =" {'selected': selectedItem.value === item.path }"
90- :title =" item.name "
89+ :class =" {'selected': selectedItem.value === item.fullPath }"
90+ :title =" item.entryName "
9191 @click.stop =" doLoadDirContent"
9292 >
9393 <!-- directory -->
@@ -97,12 +97,12 @@ const doGotoSubModule = () => {
9797 </div >
9898 <div class =" item-content" >
9999 <SvgIcon class =" text primary" :name =" collapsed ? 'octicon-file-directory-fill' : 'octicon-file-directory-open-fill'" />
100- <span class =" gt-ellipsis" >{{ item.name }}</span >
100+ <span class =" gt-ellipsis" >{{ item.entryName }}</span >
101101 </div >
102102 </div >
103103
104104 <div v-if =" children?.length" v-show =" !collapsed" class =" sub-items" >
105- <ViewFileTreeItem v-for =" childItem in children" :key =" childItem.name " :item =" childItem" :selected-item =" selectedItem" :load-content =" loadContent" :load-children =" loadChildren" />
105+ <ViewFileTreeItem v-for =" childItem in children" :key =" childItem.entryName " :item =" childItem" :selected-item =" selectedItem" :load-content =" loadContent" :load-children =" loadChildren" />
106106 </div >
107107</template >
108108<style scoped>
@@ -120,7 +120,7 @@ const doGotoSubModule = () => {
120120 border-radius : 4px ;
121121}
122122
123- .tree-item.type -directory {
123+ .tree-item.entryMode -directory {
124124 user-select : none ;
125125}
126126
@@ -150,5 +150,7 @@ const doGotoSubModule = () => {
150150 display : flex ;
151151 align-items : center ;
152152 gap : 0.25em ;
153+ text-overflow : ellipsis ;
154+ min-width : 0 ;
153155}
154156 </style >
0 commit comments