- md5
- da70fc2fa8ed4dfcf760eafecdac7f2b
- sha1
- 315e6d62c1e82790c27b37fbede4cb92f9944b6e
- sha256
- 70516c6f1c6a48164649c6ba87934c6bbcaacfc5eb49b764927cfbc62bc4760f
import{B as BaseComponent,S as SelectorEngine,d as getSelectorFromElement,D as Data,E as EventHandler,a as getTransitionDurationFromElement,T as TRANSITION_END,e as emulateTransitionEnd,r as reflow,g as getElementFromSelector,c as typeCheckConfig,f as isElement,M as Manipulator,o as onDOMContentLoaded,b as getjQuery}from"./dom-8eef6b5f.js";const NAME="collapse",DATA_KEY="bs.collapse",EVENT_KEY=".bs.collapse",DATA_API_KEY=".data-api",Default={toggle:!0,parent:""},DefaultType={toggle:"boolean",parent:"(string|element)"},EVENT_SHOW="show.bs.collapse",EVENT_SHOWN="shown.bs.collapse",EVENT_HIDE="hide.bs.collapse",EVENT_HIDDEN="hidden.bs.collapse",EVENT_CLICK_DATA_API="click.bs.collapse.data-api",CLASS_NAME_SHOW="show",CLASS_NAME_COLLAPSE="collapse",CLASS_NAME_COLLAPSING="collapsing",CLASS_NAME_COLLAPSED="collapsed",WIDTH="width",HEIGHT="height",SELECTOR_ACTIVES=".show, .collapsing",SELECTOR_DATA_TOGGLE='[data-bs-toggle="collapse"]';class Collapse extends BaseComponent{constructor(e,t){super(e),this._isTransitioning=!1,this._config=this._getConfig(t),this._triggerArray=SelectorEngine.find(`${SELECTOR_DATA_TOGGLE}[href="#${e.id}"],${SELECTOR_DATA_TOGGLE}[data-bs-target="#${e.id}"]`);const s=SelectorEngine.find(SELECTOR_DATA_TOGGLE);for(let t=0,n=s.length;t<n;t++){const n=s[t],i=getSelectorFromElement(n),a=SelectorEngine.find(i).filter((t=>t===e));null!==i&&a.length&&(this._selector=i,this._triggerArray.push(n))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}static get Default(){return Default}static get DATA_KEY(){return DATA_KEY}toggle(){this._element.classList.contains("show")?this.hide():this.show()}show(){if(this._isTransitioning||this._element.classList.contains("show"))return;let e,t;this._parent&&(e=SelectorEngine.find(SELECTOR_ACTIVES,this._parent).filter((e=>"string"==typeof this._config.parent?e.getAttribute("data-bs-parent")===this._config.parent:e.classList.contains("collapse"))),0===e.length&&(e=null));const s=SelectorEngine.findOne(this._selector);if(e){const n=e.find((e=>s!==e));if(t=n?Data.getData(n,DATA_KEY):null,t&&t._isTransitioning)return}if(EventHandler.trigger(this._element,EVENT_SHOW).defaultPrevented)return;e&&e.forEach((e=>{s!==e&&Collapse.collapseInterface(e,"hide"),t||Data.setData(e,DATA_KEY,null)}));const n=this._getDimension();this._element.classList.remove("collapse"),this._element.classList.add("collapsing"),this._element.style[n]=0,this._triggerArray.length&&this._triggerArray.forEach((e=>{e.classList.remove("collapsed"),e.setAttribute("aria-expanded",!0)})),this.setTransitioning(!0);const i=`scroll${n[0].toUpperCase()+n.slice(1)}`,a=getTransitionDurationFromElement(this._element);EventHandler.one(this._element,TRANSITION_END,(()=>{this._element.classList.remove("collapsing"),this._element.classList.add("collapse","show"),this._element.style[n]="",this.setTransitioning(!1),EventHandler.trigger(this._element,EVENT_SHOWN)})),emulateTransitionEnd(this._element,a),this._element.style[n]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._element.classList.contains("show"))return;if(EventHandler.trigger(this._element,EVENT_HIDE).defaultPrevented)return;const e=this._getDimension();this._element.style[e]=`${this._element.getBoundingClientRect()[e]}px`,reflow(this._element),this._element.classList.add("collapsing"),this._element.classList.remove("collapse","show");const t=this._triggerArray.length;if(t>0)for(let e=0;e<t;e++){const t=this._triggerArray[e],s=getElementFromSelector(t);s&&!s.classList.contains("show")&&(t.classList.add("collapsed"),t.setAttribute("aria-expanded",!1))}this.setTransitioning(!0);this._element.style[e]="";const s=getTransitionDurationFromElement(this._element);EventHandler.one(this._element,TRANSITION_END,(()=>{this.setTransitioning(!1),this._element.classList.remove("collapsing"),this._element.classList.add("collapse"),EventHandler.trigger(this._element,EVENT_HIDDEN)})),emulateTransitionEnd(this._element,s)}setTransitioning(e){this._isTransitioning=e}dispose(){super.dispose(),this._config=null,this._parent=null,this._triggerArray=null,this._isTransitioning=null}_getConfig(e){return(e={...Default,...e}).toggle=Boolean(e.toggle),typeCheckConfig(NAME,e,DefaultType),e}_getDimension(){return this._element.classList.contains(WIDTH)?WIDTH:HEIGHT}_getParent(){let{parent:e}=this._config;isElement(e)?void 0===e.jquery&&void 0===e[0]||(e=e[0]):e=SelectorEngine.findOne(e);const t=`${SELECTOR_DATA_TOGGLE}[data-bs-parent="${e}"]`;return SelectorEngine.find(t,e).forEach((e=>{const t=getElementFromSelector(e);this._addAriaAndCollapsedClass(t,[e])})),e}_addAriaAndCollapsedClass(e,t){if(!e||!t.length)return;const s=e.classList.contains("show");t.forEach((e=>{s?e.classList.remove("collapsed"):e.classList.add("collapsed"),e.setAttribute("aria-expanded",s)}))}static collapseInterface(e,t){let s=Data.getData(e,DATA_KEY);const n={...Default,...Manipulator.getDataAttributes(e),..."object"==typeof t&&t?t:{}};if(!s&&n.toggle&&"string"==typeof t&&/show|hide/.test(t)&&(n.toggle=!1),s||(s=new Collapse(e,n)),"string"==typeof t){if(void 0===s[t])throw new TypeError(`No method named "${t}"`);s[t]()}}static jQueryInterface(e){return this.each((function(){Collapse.collapseInterface(this,e)}))}}if(EventHandler.on(document,EVENT_CLICK_DATA_API,SELECTOR_DATA_TOGGLE,(function(e){"A"===e.target.tagName&&e.preventDefault();const t=Manipulator.getDataAttributes(this),s=getSelectorFromElement(this);SelectorEngine.find(s).forEach((e=>{const s=Data.getData(e,DATA_KEY);let n;s?(null===s._parent&&"string"==typeof t.parent&&(s._config.parent=t.parent,s._parent=s._getParent()),n="toggle"):n=t,Collapse.collapseInterface(e,n)}))})),onDOMContentLoaded((()=>{const e=getjQuery();if(e){const t=e.fn[NAME];e.fn[NAME]=Collapse.jQueryInterface,e.fn[NAME].Constructor=Collapse,e.fn[NAME].noConflict=()=>(e.fn[NAME]=t,Collapse.jQueryInterface)}})),window.bootstrap=window.bootstrap||{},window.bootstrap.Collapse=Collapse,Object.prototype.hasOwnProperty.call(document.body.dataset,"bsNoJquery")||(document.body.dataset.bsNoJquery=""),Joomla&&Joomla.getOptions){const e={...Joomla.getOptions("bootstrap.collapse"),...Joomla.getOptions("bootstrap.accordion")};Object.keys(e).forEach((t=>{const s=e[t],n={toggle:!s.toggle||s.toggle};s.parent&&(n.parent=s.parent);const i=Array.from(document.querySelectorAll(t));i.length&&i.map((e=>new window.bootstrap.Collapse(e,n)))}))}export{Collapse as C};
No other release has this exact content. See every version of this file.