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/GridViewFieldNumber.vue
2021-07-11 18:02:37 +00:00

42 lines
1.0 KiB
Vue

<template>
<div
class="grid-view__cell active"
:class="{
editing: editing,
invalid: editing && !valid,
}"
@contextmenu="stopContextIfEditing($event)"
>
<div v-show="!editing" class="grid-field-number">{{ value }}</div>
<template v-if="editing">
<input
ref="input"
v-model="copy"
type="text"
class="grid-field-number__input"
/>
<div v-show="!valid" class="grid-view__cell--error align-right">
{{ error }}
</div>
</template>
</div>
</template>
<script>
import gridField from '@baserow/modules/database/mixins/gridField'
import gridFieldInput from '@baserow/modules/database/mixins/gridFieldInput'
import numberField from '@baserow/modules/database/mixins/numberField'
export default {
mixins: [gridField, gridFieldInput, numberField],
methods: {
afterEdit() {
this.$nextTick(() => {
this.$refs.input.focus()
this.$refs.input.selectionStart = this.$refs.input.selectionEnd = 100000
})
},
},
}
</script>