1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-25 00:46:46 +00:00
bramw_baserow/web-frontend/modules/database/components/view/grid/fields/GridViewFieldPhoneNumber.vue
2022-09-20 08:51:55 +00:00

48 lines
1.1 KiB
Vue

<template>
<div
class="grid-view__cell active"
:class="{
editing: editing,
invalid: editing && !isValid(),
}"
@contextmenu="stopContextIfEditing($event)"
>
<div v-show="!editing" class="grid-field-text">
<a
:href="'tel:' + value"
target="_blank"
rel="nofollow noopener noreferrer"
>{{ value }}</a
>
</div>
<template v-if="editing">
<input
ref="input"
v-model="copy"
type="tel"
class="grid-field-text__input"
/>
<div v-show="!isValid()" class="grid-view__cell--error align-right">
{{ getError() }}
</div>
</template>
</div>
</template>
<script>
import gridField from '@baserow/modules/database/mixins/gridField'
import gridFieldInput from '@baserow/modules/database/mixins/gridFieldInput'
export default {
mixins: [gridField, gridFieldInput],
methods: {
afterEdit() {
this.$nextTick(() => {
this.$refs.input.focus()
this.$refs.input.selectionStart = this.$refs.input.selectionEnd = 100000
})
},
},
}
</script>