@@ -3,10 +3,10 @@ import {SvgIcon} from '../svg.ts';
3
3
import {ref } from ' vue' ;
4
4
5
5
type 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 ;
10
10
children? : Item [];
11
11
};
12
12
@@ -26,7 +26,7 @@ const doLoadChildren = async () => {
26
26
if (! collapsed .value && props .loadChildren ) {
27
27
isLoading .value = true ;
28
28
try {
29
- children .value = await props .loadChildren (props .item .path );
29
+ children .value = await props .loadChildren (props .item .fullPath );
30
30
} finally {
31
31
isLoading .value = false ;
32
32
}
@@ -35,59 +35,59 @@ const doLoadChildren = async () => {
35
35
36
36
const doLoadDirContent = () => {
37
37
doLoadChildren ();
38
- props .loadContent (props .item .path );
38
+ props .loadContent (props .item .fullPath );
39
39
};
40
40
41
41
const doLoadFileContent = () => {
42
- props .loadContent (props .item .path );
42
+ props .loadContent (props .item .fullPath );
43
43
};
44
44
45
45
const doGotoSubModule = () => {
46
- location .href = props .item .sub_module_url ;
46
+ location .href = props .item .submoduleUrl ;
47
47
};
48
48
</script >
49
49
50
50
<template >
51
51
<!-- 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"-->
52
52
<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 "
55
55
@click.stop =" doGotoSubModule"
56
56
>
57
57
<!-- submodule -->
58
58
<div class =" item-content" >
59
59
<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 >
61
61
</div >
62
62
</div >
63
63
<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 "
67
67
@click.stop =" doLoadFileContent"
68
68
>
69
69
<!-- symlink -->
70
70
<div class =" item-content" >
71
71
<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 >
73
73
</div >
74
74
</div >
75
75
<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 "
79
79
@click.stop =" doLoadFileContent"
80
80
>
81
81
<!-- file -->
82
82
<div class =" item-content" >
83
83
<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 >
85
85
</div >
86
86
</div >
87
87
<div
88
88
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 "
91
91
@click.stop =" doLoadDirContent"
92
92
>
93
93
<!-- directory -->
@@ -97,12 +97,12 @@ const doGotoSubModule = () => {
97
97
</div >
98
98
<div class =" item-content" >
99
99
<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 >
101
101
</div >
102
102
</div >
103
103
104
104
<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" />
106
106
</div >
107
107
</template >
108
108
<style scoped>
@@ -120,7 +120,7 @@ const doGotoSubModule = () => {
120
120
border-radius : 4px ;
121
121
}
122
122
123
- .tree-item.type -directory {
123
+ .tree-item.entryMode -directory {
124
124
user-select : none ;
125
125
}
126
126
@@ -150,5 +150,7 @@ const doGotoSubModule = () => {
150
150
display : flex ;
151
151
align-items : center ;
152
152
gap : 0.25em ;
153
+ text-overflow : ellipsis ;
154
+ min-width : 0 ;
153
155
}
154
156
</style >
0 commit comments