Files
716d43a9a8 Nuxt 3 migration (#4342)
Update the nuxt3 version.

Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
Co-authored-by: Cezary <cezary@baserow.io>
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
Co-authored-by: Bram <bram2w@users.noreply.github.com>
2026-01-22 10:27:19 +01:00

60 lines
1.6 KiB
Vue

<template>
<div
ref="cell"
class="grid-view__cell active"
:class="{
editing: editing,
invalid: editing && !isValid(),
}"
@contextmenu="stopContextIfEditing($event)"
>
<div v-show="!editing" class="grid-field-duration">
{{ formattedValue }}
</div>
<template v-if="editing">
<input
ref="input"
v-model="formattedValue"
type="text"
class="grid-field-duration__input"
:placeholder="field.duration_format"
@keypress="onKeyPress(field, $event)"
@input="onInput(field, $event)"
/>
<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'
import durationField from '@baserow/modules/database/mixins/durationField'
export default {
mixins: [gridField, gridFieldInput, durationField],
methods: {
cancel() {
this.$super(gridFieldInput).cancel()
this.updateFormattedValue(this.field, this.copy)
},
beforeSave(value) {
this.updateFormattedValue(this.field, value)
return this.$super(gridFieldInput).beforeSave(value)
},
afterEdit(event, value) {
if (value !== null) {
this.updateCopy(this.field, value)
this.updateFormattedValue(this.field, this.copy)
}
this.$nextTick(() => {
this.$refs.input.focus()
this.$refs.input.selectionStart = this.$refs.input.selectionEnd = 100000
})
},
},
}
</script>