Add some autocomplete workarounds for new vendor catalog batch

when user selects a parser, it may auto-select the vendor, but keeping
that all in sync is complicated.  this seems to be an improvement but
it could likely use more..
This commit is contained in:
Lance Edgar 2022-02-05 21:41:05 -06:00
parent a36f775752
commit b261e8bb9b
5 changed files with 60 additions and 21 deletions

View file

@ -95,21 +95,21 @@ const TailboneAutocomplete = {
}
},
watch: {
// TODO: yikes this feels hacky. what happens is, when the
// caller explicitly assigns a new UUID value to the tailbone
// autocomplate component, the underlying buefy autocomplete
// component was not getting the new value. so here we are
// explicitly making sure it is in sync. this issue was
// discovered on the "new vendor catalog batch" page
value(val) {
this.$nextTick(() => {
if (this.buefyValue != val) {
this.buefyValue = val
}
})
},
},
// watch: {
// // TODO: yikes this feels hacky. what happens is, when the
// // caller explicitly assigns a new UUID value to the tailbone
// // autocomplate component, the underlying buefy autocomplete
// // component was not getting the new value. so here we are
// // explicitly making sure it is in sync. this issue was
// // discovered on the "new vendor catalog batch" page
// value(val) {
// this.$nextTick(() => {
// if (this.buefyValue != val) {
// this.buefyValue = val
// }
// })
// },
// },
methods: {
@ -163,9 +163,18 @@ const TailboneAutocomplete = {
this.buefyValue = null
// here is where we alert callers to the new value
if (option) {
this.$emit('new-label', option.label)
}
this.$emit('input', option ? option.value : null)
},
// set selection to the given option, which should a simple
// object with (at least) `value` and `label` properties
setSelection(option) {
this.$refs.autocomplete.setSelected(option)
},
// clear the field of any value, i.e. set the "currently
// selected option" to null. this is invoked when you click
// the button, which is visible while the field has a value.