Fix product lookup component, per butterball

This commit is contained in:
Lance Edgar 2024-06-04 17:16:57 -05:00
parent d02bf0e5c7
commit da6ccf4425

View file

@ -56,9 +56,7 @@
<b-field grouped> <b-field grouped>
<b-input v-model="searchTerm" <b-input v-model="searchTerm"
ref="searchTermInput" ref="searchTermInput" />
@keydown.native="searchTermInputKeydown">
</b-input>
<b-button class="control" <b-button class="control"
type="is-primary" type="is-primary"
@ -161,10 +159,19 @@
<${b}-table-column label="Actions" <${b}-table-column label="Actions"
v-slot="props"> v-slot="props">
<a :href="props.row.url" <a :href="props.row.url"
target="_blank" % if not request.use_oruga:
class="grid-action"> class="grid-action"
<i class="fas fa-external-link-alt"></i> % endif
View target="_blank">
% if request.use_oruga:
<span class="icon-text">
<o-icon icon="external-link-alt" />
<span>View</span>
</span>
% else:
<i class="fas fa-external-link-alt"></i>
View
% endif
</a> </a>
</${b}-table-column> </${b}-table-column>
@ -236,6 +243,7 @@
lookupShowDialog: false, lookupShowDialog: false,
searchTerm: null, searchTerm: null,
searchTermInputElement: null,
searchTermLastUsed: null, searchTermLastUsed: null,
searchProductKey: true, searchProductKey: true,
@ -250,6 +258,16 @@
searchResultSelected: null, searchResultSelected: null,
} }
}, },
mounted() {
this.searchTermInputElement = this.$refs.searchTermInput.$el.querySelector('input')
this.searchTermInputElement.addEventListener('keydown', this.searchTermInputKeydown)
},
beforeDestroy() {
this.searchTermInputElement.removeEventListener('keydown', this.searchTermInputKeydown)
},
methods: { methods: {
focus() { focus() {