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');
10 this.toggleElem = elem.querySelector('[dropdown-toggle]');
12 // this.loadingElem.style.display = 'none';
13 const entityDescriptor = elem.getAttribute('breadcrumb-listing').split(':');
14 this.entityType = entityDescriptor[0];
15 this.entityId = Number(entityDescriptor[1]);
17 this.toggleElem.addEventListener('click', this.onShow.bind(this));
18 this.searchInput.addEventListener('input', this.onSearch.bind(this));
22 this.loadEntityView();
26 const input = this.searchInput.value.toLowerCase().trim();
27 const listItems = this.entityListElem.querySelectorAll('.entity-list-item');
28 for (let listItem of listItems) {
29 const match = !input || listItem.textContent.toLowerCase().includes(input);
30 listItem.style.display = match ? 'flex' : 'none';
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;