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-input v-model="searchTerm"
ref="searchTermInput"
@keydown.native="searchTermInputKeydown">
</b-input>
ref="searchTermInput" />
<b-button class="control"
type="is-primary"
@ -161,10 +159,19 @@
<${b}-table-column label="Actions"
v-slot="props">
<a :href="props.row.url"
target="_blank"
class="grid-action">
% if not request.use_oruga:
class="grid-action"
% endif
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>
</${b}-table-column>
@ -236,6 +243,7 @@
lookupShowDialog: false,
searchTerm: null,
searchTermInputElement: null,
searchTermLastUsed: null,
searchProductKey: true,
@ -250,6 +258,16 @@
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: {
focus() {