this.elem.addEventListener('click', this.onClick.bind(this));
let lastSearch = 0;
- this.searchInput.addEventListener('input', event => {
+ this.searchInput.addEventListener('input', () => {
lastSearch = Date.now();
this.showLoading();
setTimeout(() => {
});
// Keyboard navigation
- onChildEvent(this.$el, '[data-entity-type]', 'keydown', (e, el) => {
- if (e.ctrlKey && e.code === 'Enter') {
+ onChildEvent(this.$el, '[data-entity-type]', 'keydown', event => {
+ if (event.ctrlKey && event.code === 'Enter') {
const form = this.$el.closest('form');
if (form) {
form.submit();
- e.preventDefault();
+ event.preventDefault();
return;
}
}
- if (e.code === 'ArrowDown') {
+ if (event.code === 'ArrowDown') {
this.focusAdjacent(true);
}
- if (e.code === 'ArrowUp') {
+ if (event.code === 'ArrowUp') {
this.focusAdjacent(false);
}
});
- this.searchInput.addEventListener('keydown', e => {
- if (e.code === 'ArrowDown') {
+ this.searchInput.addEventListener('keydown', event => {
+ if (event.code === 'ArrowDown') {
this.focusAdjacent(true);
}
});
this.searchInput.focus();
}
+ searchText(queryText) {
+ this.searchInput.value = queryText;
+ this.searchEntities(queryText);
+ }
+
showLoading() {
this.loading.style.display = 'block';
this.resultsContainer.style.display = 'none';