芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.3/vendor/bootstrap/js/collapse.min.js
import{B as BaseComponent,S as SelectorEngine,e as getSelectorFromElement,E as EventHandler,D as Data,r as reflow,g as getElementFromSelector,a as typeCheckConfig,f as getElement,M as Manipulator,d as defineJQueryPlugin}from"./dom.min.js?1629745661";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="#${this._element.id}"],${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`);const s=SelectorEngine.find(SELECTOR_DATA_TOGGLE);for(let e=0,t=s.length;e
e===this._element));null!==n&&l.length&&(this._selector=n,this._triggerArray.push(t))}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 NAME(){return NAME}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?Collapse.getInstance(n):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.set(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 l=`scroll${n[0].toUpperCase()+n.slice(1)}`;this._queueCallback((()=>{this._element.classList.remove("collapsing"),this._element.classList.add("collapse","show"),this._element.style[n]="",this.setTransitioning(!1),EventHandler.trigger(this._element,EVENT_SHOWN)}),this._element,!0),this._element.style[n]=`${this._element[l]}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
{this.setTransitioning(!1),this._element.classList.remove("collapsing"),this._element.classList.add("collapse"),EventHandler.trigger(this._element,EVENT_HIDDEN)}),this._element,!0)}setTransitioning(e){this._isTransitioning=e}_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;e=getElement(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=Collapse.getInstance(e);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.delegateTarget&&"A"===e.delegateTarget.tagName)&&e.preventDefault();const t=Manipulator.getDataAttributes(this),s=getSelectorFromElement(this);SelectorEngine.find(s).forEach((e=>{const s=Collapse.getInstance(e);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)}))})),defineJQueryPlugin(Collapse),window.bootstrap=window.bootstrap||{},window.bootstrap.Collapse=Collapse,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 l=Array.from(document.querySelectorAll(t));l.length&&l.map((e=>new window.bootstrap.Collapse(e,n)))}))}export{Collapse as C};