File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 compact
1212 :href =" href "
1313 :name =" name "
14- target="_self">
14+ target="_self"
15+ @click =" onClick " >
1516 <template #icon >
16- <img class =" account-menu-entry__icon"
17+ <NcLoadingIcon v-if =" loading " :size =" 20 " class="account-menu-entry__loading" />
18+ <slot v-else-if =" $scopedSlots.icon" name =" icon" />
19+ <img v-else
20+ class =" account-menu-entry__icon"
1721 :class =" { 'account-menu-entry__icon--active': active }"
1822 :src =" iconSource"
1923 alt =" " >
2024 </template >
21- <template v-if =" loading " #indicator >
22- <NcLoadingIcon />
23- </template >
2425 </NcListItem >
2526</template >
2627
27- <script >
28+ <script lang="ts" >
2829import { loadState } from ' @nextcloud/initial-state'
30+ import { defineComponent } from ' vue'
2931
3032import NcListItem from ' @nextcloud/vue/components/NcListItem'
3133import NcLoadingIcon from ' @nextcloud/vue/components/NcLoadingIcon'
3234
3335const versionHash = loadState (' core' , ' versionHash' , ' ' )
3436
35- export default {
37+ export default defineComponent ( {
3638 name: ' AccountMenuEntry' ,
3739
3840 components: {
@@ -55,11 +57,11 @@ export default {
5557 },
5658 active: {
5759 type: Boolean ,
58- required : true ,
60+ default: false ,
5961 },
6062 icon: {
6163 type: String ,
62- required : true ,
64+ default: ' ' ,
6365 },
6466 },
6567
@@ -76,11 +78,12 @@ export default {
7678 },
7779
7880 methods: {
79- handleClick ( ) {
81+ onClick( e ) {
8082 this .loading = true
83+ this .$emit (' click' , e )
8184 },
8285 },
83- }
86+ })
8487 </script >
8588
8689<style lang="scss" scoped>
@@ -96,6 +99,12 @@ export default {
9699 }
97100 }
98101
102+ & __loading {
103+ height : 20px ;
104+ width : 20px ;
105+ margin : calc ((var (--default-clickable-area ) - 20px ) / 2 ); // 20px icon size
106+ }
107+
99108 :deep (.list-item-content__main ) {
100109 width : fit-content ;
101110 }
You can’t perform that action at this time.
0 commit comments