Add Clear Functionality in the SearchBox (#1989)

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: huchenlei <huchenlei@proton.me>
This commit is contained in:
Yuki Shindo
2024-12-20 02:40:08 +09:00
committed by GitHub
parent 89bf5c182d
commit 0e197261b0
6 changed files with 39 additions and 19 deletions

View File

@@ -1,22 +1,29 @@
<template> <template>
<div :class="props.class"> <div :class="props.class">
<IconField> <IconField>
<InputIcon :class="props.icon" />
<InputText
class="search-box-input"
:class="{ ['with-filter']: props.filterIcon }"
@input="handleInput"
:modelValue="props.modelValue"
:placeholder="props.placeholder"
/>
<Button <Button
v-if="props.filterIcon" v-if="props.filterIcon"
class="p-inputicon" class="p-inputicon filter-button"
:icon="props.filterIcon" :icon="props.filterIcon"
text text
severity="contrast" severity="contrast"
@click="$emit('showFilter', $event)" @click="$emit('showFilter', $event)"
/> />
<InputText
class="search-box-input w-full"
@input="handleInput"
:modelValue="props.modelValue"
:placeholder="props.placeholder"
/>
<InputIcon v-if="!props.modelValue" :class="props.icon" />
<Button
v-if="props.modelValue"
class="p-inputicon clear-button"
icon="pi pi-times"
text
severity="contrast"
@click="clearSearch"
/>
</IconField> </IconField>
<div <div
class="search-filters pt-2 flex flex-wrap gap-2" class="search-filters pt-2 flex flex-wrap gap-2"
@@ -79,21 +86,19 @@ const handleInput = (event: Event) => {
emit('update:modelValue', target.value) emit('update:modelValue', target.value)
emitSearch(target.value) emitSearch(target.value)
} }
const clearSearch = () => {
emit('update:modelValue', '')
emitSearch('')
}
</script> </script>
<style scoped> <style scoped>
.search-box-input { :deep(.p-inputtext) {
width: 100%; --p-form-field-padding-x: 0.625rem;
padding-left: 36px;
}
.search-box-input.with-filter {
padding-right: 36px;
} }
.p-button.p-inputicon { .p-button.p-inputicon {
padding: 0; @apply p-0 w-auto border-none;
width: auto;
border: none !important;
} }
</style> </style>

View File

@@ -5352,6 +5352,9 @@
}, },
"tile_size": { "tile_size": {
"name": "tile_size" "name": "tile_size"
},
"overlap": {
"name": "overlap"
} }
} }
}, },

View File

@@ -5319,6 +5319,9 @@
"VAEEncodeTiled": { "VAEEncodeTiled": {
"display_name": "VAEエンコードタイル", "display_name": "VAEエンコードタイル",
"inputs": { "inputs": {
"overlap": {
"name": "オーバーラップ"
},
"pixels": { "pixels": {
"name": "ピクセル" "name": "ピクセル"
}, },

View File

@@ -5319,6 +5319,9 @@
"VAEEncodeTiled": { "VAEEncodeTiled": {
"display_name": "VAE 인코드 (타일)", "display_name": "VAE 인코드 (타일)",
"inputs": { "inputs": {
"overlap": {
"name": "중첩"
},
"pixels": { "pixels": {
"name": "픽셀" "name": "픽셀"
}, },

View File

@@ -5319,6 +5319,9 @@
"VAEEncodeTiled": { "VAEEncodeTiled": {
"display_name": "Кодировать VAE (плитками)", "display_name": "Кодировать VAE (плитками)",
"inputs": { "inputs": {
"overlap": {
"name": "перекрытие"
},
"pixels": { "pixels": {
"name": "пиксели" "name": "пиксели"
}, },

View File

@@ -5319,6 +5319,9 @@
"VAEEncodeTiled": { "VAEEncodeTiled": {
"display_name": "VAE编码平铺", "display_name": "VAE编码平铺",
"inputs": { "inputs": {
"overlap": {
"name": "重叠"
},
"pixels": { "pixels": {
"name": "像素" "name": "像素"
}, },