2021-08-18 00:01:11 +02:00
|
|
|
<template>
|
|
|
|
<div class="w-full">
|
2022-08-16 00:35:13 +02:00
|
|
|
<slot>
|
|
|
|
<p class="px-1 text-sm font-semibold" :class="{ 'text-gray-400': disabled }">
|
|
|
|
{{ label }}<em v-if="note" class="font-normal text-xs pl-2">{{ note }}</em>
|
|
|
|
</p>
|
|
|
|
</slot>
|
2022-04-15 00:15:52 +02:00
|
|
|
<ui-text-input ref="input" v-model="inputValue" :disabled="disabled" :readonly="readonly" :type="type" class="w-full" @blur="inputBlurred" />
|
2021-08-18 00:01:11 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
value: [String, Number],
|
|
|
|
label: String,
|
2021-09-14 03:18:58 +02:00
|
|
|
note: String,
|
2021-08-20 02:14:24 +02:00
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
default: 'text'
|
|
|
|
},
|
2022-03-19 12:41:54 +01:00
|
|
|
readonly: Boolean,
|
2021-08-18 00:01:11 +02:00
|
|
|
disabled: Boolean
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
inputValue: {
|
|
|
|
get() {
|
|
|
|
return this.value
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('input', val)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-02-17 21:33:12 +01:00
|
|
|
methods: {
|
2022-08-04 01:38:08 +02:00
|
|
|
setFocus() {
|
|
|
|
if (this.$refs.input && this.$refs.input.setFocus) {
|
|
|
|
this.$refs.input.setFocus()
|
|
|
|
}
|
|
|
|
},
|
2022-02-17 21:33:12 +01:00
|
|
|
blur() {
|
|
|
|
if (this.$refs.input && this.$refs.input.blur) {
|
|
|
|
this.$refs.input.blur()
|
|
|
|
}
|
2022-04-15 00:15:52 +02:00
|
|
|
},
|
|
|
|
inputBlurred() {
|
|
|
|
this.$emit('blur')
|
2022-02-17 21:33:12 +01:00
|
|
|
}
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|