mirror of
https://gitlab.com/bramw/baserow.git
synced 2024-11-25 00:46:46 +00:00
26 lines
740 B
JavaScript
26 lines
740 B
JavaScript
import createSelectOption from '@baserow/modules/database/mixins/createSelectOption'
|
|
import selectDropdown from '@baserow/modules/database/mixins/selectDropdown'
|
|
|
|
export default {
|
|
mixins: [createSelectOption, selectDropdown],
|
|
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)
|
|
}
|
|
},
|
|
},
|
|
}
|