3 class BreadcrumbListing {
7 this.searchInput = elem.querySelector('input');
8 this.loadingElem = elem.querySelector('.loading-container');
9 this.entityListElem = elem.querySelector('.breadcrumb-listing-entity-list');
11 // this.loadingElem.style.display = 'none';
12 const entityDescriptor = elem.getAttribute('breadcrumb-listing').split(':');
13 this.entityType = entityDescriptor[0];
14 this.entityId = Number(entityDescriptor[1]);
16 this.elem.addEventListener('show', this.onShow.bind(this));
17 this.searchInput.addEventListener('input', this.onSearch.bind(this));
21 this.loadEntityView();
25 const input = this.searchInput.value.toLowerCase().trim();
26 const listItems = this.entityListElem.querySelectorAll('.entity-list-item');
27 for (let listItem of listItems) {
28 const match = !input || listItem.textContent.toLowerCase().includes(input);
29 listItem.style.display = match ? 'flex' : 'none';
30 listItem.classList.toggle('hidden', !match);
35 this.toggleLoading(true);
38 'entity_id': this.entityId,
39 'entity_type': this.entityType,
42 window.$http.get('/search/entity/siblings', params).then(resp => {
43 this.entityListElem.innerHTML = resp.data;
47 this.toggleLoading(false);
52 toggleLoading(show = false) {
53 this.loadingElem.style.display = show ? 'block' : 'none';
58 export default BreadcrumbListing;