enter key search

This commit is contained in:
samunohito 2024-02-18 13:53:12 +09:00
parent ac943195cf
commit 38b4197395
2 changed files with 105 additions and 32 deletions

View File

@ -13,49 +13,97 @@
<div class="_gaps">
<div :class="[[spMode ? $style.searchAreaSp : $style.searchArea]]">
<MkInput v-model="queryName" :debounce="true" type="search" autocapitalize="off" class="col1 row1">
<MkInput
v-model="queryName"
:debounce="true"
type="search"
autocapitalize="off"
class="col1 row1"
@enter="onSearchRequest"
>
<template #label>name</template>
</MkInput>
<MkInput
v-model="queryCategory" :debounce="true" type="search" autocapitalize="off" class="col2 row1"
v-model="queryCategory"
:debounce="true"
type="search"
autocapitalize="off"
class="col2 row1"
@enter="onSearchRequest"
>
<template #label>category</template>
</MkInput>
<MkInput
v-model="queryAlias" :debounce="true" type="search" autocapitalize="off" class="col3 row1"
v-model="queryAlias"
:debounce="true"
type="search"
autocapitalize="off"
class="col3 row1"
@enter="onSearchRequest"
>
<template #label>alias</template>
</MkInput>
<MkInput
v-model="queryType" :debounce="true" type="search" autocapitalize="off" class="col1 row2"
v-model="queryType"
:debounce="true"
type="search"
autocapitalize="off"
class="col1 row2"
@enter="onSearchRequest"
>
<template #label>type</template>
</MkInput>
<MkInput
v-model="queryLicense" :debounce="true" type="search" autocapitalize="off" class="col2 row2"
v-model="queryLicense"
:debounce="true"
type="search"
autocapitalize="off"
class="col2 row2"
@enter="onSearchRequest"
>
<template #label>license</template>
</MkInput>
<MkSelect v-model="querySensitive" class="col3 row2">
<MkSelect
v-model="querySensitive"
class="col3 row2"
>
<template #label>sensitive</template>
<option :value="null">-</option>
<option :value="true">true</option>
<option :value="false">false</option>
</MkSelect>
<MkSelect v-model="queryLocalOnly" class="col1 row3">
<MkSelect
v-model="queryLocalOnly"
class="col1 row3"
>
<template #label>localOnly</template>
<option :value="null">-</option>
<option :value="true">true</option>
<option :value="false">false</option>
</MkSelect>
<MkInput v-model="queryUpdatedAtFrom" :debounce="true" type="date" autocapitalize="off" class="col2 row3">
<MkInput
v-model="queryUpdatedAtFrom"
:debounce="true"
type="date"
autocapitalize="off"
class="col2 row3"
@enter="onSearchRequest"
>
<template #label>updatedAt(from)</template>
</MkInput>
<MkInput v-model="queryUpdatedAtTo" :debounce="true" type="date" autocapitalize="off" class="col3 row3">
<MkInput
v-model="queryUpdatedAtTo"
:debounce="true"
type="date"
autocapitalize="off"
class="col3 row3"
@enter="onSearchRequest"
>
<template #label>updatedAt(to)</template>
</MkInput>
<MkInput
v-model="queryRolesText"
:debounce="true"
@ -92,7 +140,7 @@
</MkFolder>
<div :class="[[spMode ? $style.searchButtonsSp : $style.searchButtons]]">
<MkButton primary @click="onSearchButtonClicked">
<MkButton primary @click="onSearchRequest">
{{ i18n.ts.search }}
</MkButton>
<MkButton @click="onQueryResetButtonClicked">
@ -502,7 +550,7 @@ function onAddSortOrderButtonClicked(ev: MouseEvent) {
os.contextMenu(menuItems, ev);
}
async function onSearchButtonClicked() {
async function onSearchRequest() {
await refreshCustomEmojis();
}

View File

@ -10,16 +10,44 @@
<div class="_gaps">
<div :class="[[spMode ? $style.searchAreaSp : $style.searchArea]]">
<MkInput v-model="queryName" :debounce="true" type="search" autocapitalize="off" class="col1 row1">
<MkInput
v-model="queryName"
:debounce="true"
type="search"
autocapitalize="off"
class="col1 row1"
@enter="onSearchRequest"
>
<template #label>name</template>
</MkInput>
<MkInput v-model="queryHost" :debounce="true" type="search" autocapitalize="off" class="col2 row1">
<MkInput
v-model="queryHost"
:debounce="true"
type="search"
autocapitalize="off"
class="col2 row1"
@enter="onSearchRequest"
>
<template #label>host</template>
</MkInput>
<MkInput v-model="queryUri" :debounce="true" type="search" autocapitalize="off" class="col1 row2">
<MkInput
v-model="queryUri"
:debounce="true"
type="search"
autocapitalize="off"
class="col1 row2"
@enter="onSearchRequest"
>
<template #label>uri</template>
</MkInput>
<MkInput v-model="queryPublicUrl" :debounce="true" type="search" autocapitalize="off" class="col2 row2">
<MkInput
v-model="queryPublicUrl"
:debounce="true"
type="search"
autocapitalize="off"
class="col2 row2"
@enter="onSearchRequest"
>
<template #label>publicUrl</template>
</MkInput>
</div>
@ -46,7 +74,7 @@
</MkFolder>
<div :class="[[spMode ? $style.searchButtonsSp : $style.searchButtons]]">
<MkButton primary @click="onSearchButtonClicked">
<MkButton primary @click="onSearchRequest">
{{ i18n.ts.search }}
</MkButton>
<MkButton @click="onQueryResetButtonClicked">
@ -97,7 +125,6 @@ import { GridSetting } from '@/components/grid/grid.js';
import MkTagItem from '@/components/MkTagItem.vue';
import { deviceKind } from '@/scripts/device-kind.js';
import { MenuItem } from '@/types/menu.js';
import MkTab from '@/components/MkTab.vue';
import MkPagingButtons from '@/components/MkPagingButtons.vue';
type GridItem = {
@ -209,7 +236,7 @@ function onAddSortOrderButtonClicked(ev: MouseEvent) {
os.contextMenu(menuItems, ev);
}
async function onSearchButtonClicked() {
async function onSearchRequest() {
await refreshCustomEmojis();
}
@ -220,14 +247,6 @@ function onQueryResetButtonClicked() {
queryPublicUrl.value = null;
}
async function onLatestButtonClicked() {
await refreshCustomEmojis();
}
async function onOldestButtonClicked() {
await refreshCustomEmojis();
}
async function onImportClicked() {
const targets = gridItems.value.filter(it => it.checked);
await importEmojis(targets);
@ -312,12 +331,18 @@ async function refreshCustomEmojis() {
currentPage.value = 1;
}
const result = await misskeyApi('admin/emoji/v2/list', {
limit: 100,
query: query,
page: currentPage.value,
sort: sortOrders.value.map(({ key, direction }) => ({ key: key as any, direction })),
});
const result = await os.promiseDialog(
misskeyApi('admin/emoji/v2/list', {
limit: 100,
query: query,
page: currentPage.value,
sort: sortOrders.value.map(({ key, direction }) => ({ key: key as any, direction })),
}),
() => {
},
() => {
},
);
customEmojis.value = result.emojis;
allPages.value = result.allPages;