FreeTube/src/renderer/components/ft-input/ft-input.vue

86 lines
2.2 KiB
Vue
Raw Normal View History

2020-02-16 19:30:00 +01:00
<template>
<div
class="ft-input-component"
:class="{
search: isSearch,
forceTextColor: forceTextColor,
showActionButton: showActionButton,
showClearTextButton: showClearTextButton,
disabled: disabled
}"
>
<label
v-if="showLabel"
:for="id"
>
{{ placeholder }}
<ft-tooltip
v-if="tooltip !== ''"
class="selectTooltip"
position="bottom"
:tooltip="tooltip"
/>
</label>
<font-awesome-icon
v-if="showClearTextButton && clearTextButtonExisting"
icon="times-circle"
class="clearInputTextButton"
:class="{
visible: clearTextButtonVisible
}"
tabindex="0"
role="button"
:title="$t('Search Bar.Clear Input')"
@click="handleClearTextClick"
@keydown.space.prevent="handleClearTextClick"
@keydown.enter.prevent="handleClearTextClick"
/>
2020-02-16 19:30:00 +01:00
<input
:id="id"
v-model="inputData"
2020-06-19 22:20:06 +02:00
:list="idDataList"
2020-02-16 19:30:00 +01:00
class="ft-input"
type="text"
:placeholder="placeholder"
2020-08-24 04:56:33 +02:00
:disabled="disabled"
:spellcheck="spellcheck"
2020-09-02 05:25:06 +02:00
@input="e => handleInput(e.target.value)"
2021-04-15 21:30:26 +02:00
@focus="handleFocus"
2020-12-11 19:14:11 +01:00
@blur="handleInputBlur"
@keydown="e => handleKeyDown(e.keyCode)"
2020-02-16 19:30:00 +01:00
>
<font-awesome-icon
v-if="showActionButton"
:icon="actionButtonIconName"
2020-02-16 19:30:00 +01:00
class="inputAction"
:class="{
enabled: inputDataPresent
}"
@click="handleClick"
2020-02-16 19:30:00 +01:00
/>
2020-12-11 19:14:11 +01:00
<div class="options">
<ul
v-if="inputData !== '' && visibleDataList.length > 0 && searchState.showOptions"
2020-12-11 19:14:11 +01:00
:id="idDataList"
class="list"
2020-12-11 19:14:11 +01:00
@mouseenter="searchState.isPointerInList = true"
@mouseleave="searchState.isPointerInList = false"
>
<li
v-for="(list, index) in visibleDataList"
2020-12-11 19:14:11 +01:00
:key="index"
:class="searchState.selectedOption == index ? 'hover': ''"
@click="handleOptionClick(index)"
@mouseenter="searchState.selectedOption = index"
>
{{ list }}
</li>
</ul>
</div>
2020-02-16 19:30:00 +01:00
</div>
</template>
<script src="./ft-input.js" />
<style scoped src="./ft-input.css" />