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')"

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,6 +12,7 @@
</NcTextField> </NcTextField>
</div> </div>
<div v-if="detail">
<div class="photo" v-for="photo of detail" :key="photo.fileid"> <div class="photo" v-for="photo of detail" :key="photo.fileid">
<Tag :data="photo" :noNavigate="true" @open="clickFace" /> <Tag :data="photo" :noNavigate="true" @open="clickFace" />
</div> </div>
@ -18,6 +20,7 @@
<div v-else> <div v-else>
{{ t("memories", "Loading …") }} {{ t("memories", "Loading …") }}
</div> </div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -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;