modal: auto focus face search (fix #484)

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/488/head
Varun Patil 2023-03-14 12:04:21 -07:00
parent 657909d76b
commit c77f334182
2 changed files with 13 additions and 8 deletions

View File

@ -6,8 +6,9 @@
<div class="fields"> <div class="fields">
<NcTextField <NcTextField
:value.sync="name"
class="field" class="field"
:autofocus="true"
:value.sync="name"
:label="t('memories', 'Name')" :label="t('memories', 'Name')"
:label-visible="false" :label-visible="false"
:placeholder="t('memories', 'Name')" :placeholder="t('memories', 'Name')"
@ -118,4 +119,4 @@ export default defineComponent({
.fields { .fields {
margin-top: 8px; margin-top: 8px;
} }
</style> </style>

View File

@ -1,7 +1,8 @@
<template> <template>
<div class="outer" v-if="detail"> <div class="outer">
<div class="search"> <div class="search">
<NcTextField <NcTextField
:autofocus="true"
:value.sync="search" :value.sync="search"
:label="t('memories', 'Search')" :label="t('memories', 'Search')"
:placeholder="t('memories', 'Search')" :placeholder="t('memories', 'Search')"
@ -11,12 +12,14 @@
</NcTextField> </NcTextField>
</div> </div>
<div class="photo" v-for="photo of detail" :key="photo.fileid"> <div v-if="detail">
<Tag :data="photo" :noNavigate="true" @open="clickFace" /> <div class="photo" v-for="photo of detail" :key="photo.fileid">
<Tag :data="photo" :noNavigate="true" @open="clickFace" />
</div>
</div>
<div v-else>
{{ t("memories", "Loading …") }}
</div> </div>
</div>
<div v-else>
{{ t("memories", "Loading …") }}
</div> </div>
</template> </template>
@ -99,6 +102,7 @@ export default defineComponent({
}, },
searchChanged() { searchChanged() {
if (!this.detail) return;
this.detail = this.search this.detail = this.search
? this.fuse.search(this.search).map((r) => r.item) ? this.fuse.search(this.search).map((r) => r.item)
: this.fullDetail; : this.fullDetail;