1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-23 04:40:15 +00:00
bramw_baserow/web-frontend/modules/database/mixins/singleSelectField.js
2021-10-04 15:54:29 +00:00

21 lines
529 B
JavaScript

export default {
computed: {
valueId() {
return this.value && this.value !== null ? this.value.id : null
},
},
methods: {
/**
* Checks if the new value has changed and if so it will be updated.
*/
updateValue(newId, oldValue) {
const newValue =
this.field.select_options.find((option) => option.id === newId) || null
const oldId = oldValue !== null ? oldValue.id : null
if (newId !== oldId) {
this.$emit('update', newValue, oldValue)
}
},
},
}