diff --git a/src/webcomponents/commons/analysis/analysis-tools.js b/src/webcomponents/commons/analysis/analysis-tools.js index 8ae266c9e..e1c19fcbb 100644 --- a/src/webcomponents/commons/analysis/analysis-tools.js +++ b/src/webcomponents/commons/analysis/analysis-tools.js @@ -66,6 +66,20 @@ export default class AnalysisTools extends LitElement { super.update(changedProperties); } + firstUpdated() { + // register listeners to bootstrap collapse events + Array.from(this.querySelectorAll(`[data-bs-role="collapse"]`)).forEach(el => { + el.addEventListener("show.bs.collapse", e => { + e.target.previousElementSibling.querySelector("i").classList.remove("fa-chevron-down"); + e.target.previousElementSibling.querySelector("i").classList.add("fa-chevron-up"); + }); + el.addEventListener("hide.bs.collapse", e => { + e.target.previousElementSibling.querySelector("i").classList.remove("fa-chevron-up"); + e.target.previousElementSibling.querySelector("i").classList.add("fa-chevron-down"); + }); + }); + } + onChangeTool(newTool) { this._tool = newTool; this.requestUpdate(); @@ -73,18 +87,21 @@ export default class AnalysisTools extends LitElement { renderMenu() { return this._config.menu.map(item => { + const id = (item.name || item.id).replace(/ /g, "-").toLowerCase(); return html`