Files
mixtape/zero.Backoffice.UI/app/components/ui-search.vue
T

99 lines
2.1 KiB
Vue
Raw Normal View History

2020-04-11 13:59:54 +02:00
<template>
<div class="ui-searchinput">
2021-12-16 13:55:09 +01:00
<input ref="input" type="search" :value="value" @input="onChange" @keyup.enter="onSubmit" class="ui-input" v-localize:placeholder="placeholder" />
2020-06-16 12:31:04 +02:00
<slot name="button" v-bind="{ onSubmit: onSubmit }">
2021-01-17 20:04:43 +01:00
<button type="button" class="ui-searchinput-button" v-localize:title="'@ui.search.button'" @click="onSubmit">
<ui-icon symbol="fth-search" />
</button>
2020-06-16 12:31:04 +02:00
</slot>
2020-04-11 13:59:54 +02:00
</div>
</template>
<script>
export default {
name: 'uiSearch',
props: {
2021-12-16 13:55:09 +01:00
value: {
2020-04-11 13:59:54 +02:00
type: String,
default: ''
},
placeholder: {
type: String,
default: '@ui.search.placeholder'
}
},
computed: {
},
methods: {
onChange(ev)
{
2021-12-16 13:55:09 +01:00
//this.$emit('change', ev.target.value);
this.$emit('input', ev.target.value);
2021-12-16 13:55:09 +01:00
//this.$emit('update:value', ev.target.value);
//this.$emit('update:modelValue', ev.target.value);
2020-04-11 13:59:54 +02:00
},
onSubmit(ev)
{
2020-06-16 12:31:04 +02:00
this.$emit('submit', this.$refs.input.value);
2020-06-10 11:47:17 +02:00
},
focus()
{
this.$refs.input.focus();
2020-04-11 13:59:54 +02:00
}
}
}
</script>
<style lang="scss">
.ui-searchinput
{
position: relative;
.ui-input
{
2020-04-24 18:32:54 +02:00
display: block;
2021-04-22 14:48:10 +02:00
min-width: 320px;
2020-04-11 13:59:54 +02:00
padding-right: 40px;
2021-04-22 14:48:10 +02:00
border: var(--color-input-border);
background: var(--color-input);
}
2021-01-17 20:04:43 +01:00
&.onbg .ui-input:not(:focus)
{
2021-01-17 20:04:43 +01:00
/*box-shadow: var(--shadow-short);
background: var(--color-button-light-onbg);*/
2021-08-23 12:56:40 +02:00
background: transparent;
border: 1px dashed var(--color-line-dashed-onbg);
2020-04-11 13:59:54 +02:00
}
.ui-searchinput-button
{
position: absolute;
right: 0;
top: 0;
height: 100%;
2021-01-17 20:04:43 +01:00
width: 45px;
2020-04-11 13:59:54 +02:00
text-align: center;
font-size: var(--font-size);
padding-top: 1px;
2020-09-10 16:12:06 +02:00
border: 1px solid transparent;
border-radius: var(--radius);
}
2020-09-10 18:32:38 +02:00
.ui-input:focus
2020-09-10 16:12:06 +02:00
{
2020-09-10 18:32:38 +02:00
background-color: var(--color-input-focus-bg);
border: var(--color-input-focus-border);
box-shadow: var(--color-input-focus-shadow);
outline: none;
2020-04-11 13:59:54 +02:00
}
}
</style>