芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/www/media/vendor/bootstrap/js/offcanvas.min.js
import{B as BaseComponent,E as EventHandler,M as Manipulator,a as typeCheckConfig,g as getElementFromSelector,h as isDisabled,i as isVisible,S as SelectorEngine,d as defineJQueryPlugin}from"./dom.min.js?1629745661";import{S as ScrollBarHelper,B as Backdrop}from"./modal.js";const NAME="offcanvas",DATA_KEY="bs.offcanvas",EVENT_KEY=`.${DATA_KEY}`,DATA_API_KEY=".data-api",EVENT_LOAD_DATA_API=`load${EVENT_KEY}.data-api`,ESCAPE_KEY="Escape",Default={backdrop:!0,keyboard:!0,scroll:!1},DefaultType={backdrop:"boolean",keyboard:"boolean",scroll:"boolean"},CLASS_NAME_SHOW="show",OPEN_SELECTOR=".offcanvas.show",EVENT_SHOW=`show${EVENT_KEY}`,EVENT_SHOWN=`shown${EVENT_KEY}`,EVENT_HIDE=`hide${EVENT_KEY}`,EVENT_HIDDEN=`hidden${EVENT_KEY}`,EVENT_FOCUSIN=`focusin${EVENT_KEY}`,EVENT_CLICK_DATA_API=`click${EVENT_KEY}.data-api`,EVENT_CLICK_DISMISS=`click.dismiss${EVENT_KEY}`,EVENT_KEYDOWN_DISMISS=`keydown.dismiss${EVENT_KEY}`,SELECTOR_DATA_DISMISS='[data-bs-dismiss="offcanvas"]',SELECTOR_DATA_TOGGLE='[data-bs-toggle="offcanvas"]';class Offcanvas extends BaseComponent{constructor(e,t){super(e),this._config=this._getConfig(t),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._addEventListeners()}static get NAME(){return NAME}static get Default(){return Default}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown)return;if(EventHandler.trigger(this._element,EVENT_SHOW,{relatedTarget:e}).defaultPrevented)return;this._isShown=!0,this._element.style.visibility="visible",this._backdrop.show(),this._config.scroll||((new ScrollBarHelper).hide(),this._enforceFocusOnElement(this._element)),this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add("show");this._queueCallback((()=>{EventHandler.trigger(this._element,EVENT_SHOWN,{relatedTarget:e})}),this._element,!0)}hide(){if(!this._isShown)return;if(EventHandler.trigger(this._element,EVENT_HIDE).defaultPrevented)return;EventHandler.off(document,EVENT_FOCUSIN),this._element.blur(),this._isShown=!1,this._element.classList.remove("show"),this._backdrop.hide();this._queueCallback((()=>{this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._element.style.visibility="hidden",this._config.scroll||(new ScrollBarHelper).reset(),EventHandler.trigger(this._element,EVENT_HIDDEN)}),this._element,!0)}dispose(){this._backdrop.dispose(),super.dispose(),EventHandler.off(document,EVENT_FOCUSIN)}_getConfig(e){return e={...Default,...Manipulator.getDataAttributes(this._element),..."object"==typeof e?e:{}},typeCheckConfig(NAME,e,DefaultType),e}_initializeBackDrop(){return new Backdrop({isVisible:this._config.backdrop,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:()=>this.hide()})}_enforceFocusOnElement(e){EventHandler.off(document,EVENT_FOCUSIN),EventHandler.on(document,EVENT_FOCUSIN,(t=>{document===t.target||e===t.target||e.contains(t.target)||e.focus()})),e.focus()}_addEventListeners(){EventHandler.on(this._element,EVENT_CLICK_DISMISS,SELECTOR_DATA_DISMISS,(()=>this.hide())),EventHandler.on(this._element,EVENT_KEYDOWN_DISMISS,(e=>{this._config.keyboard&&"Escape"===e.key&&this.hide()}))}static jQueryInterface(e){return this.each((function(){const t=Offcanvas.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}}))}}if(EventHandler.on(document,EVENT_CLICK_DATA_API,SELECTOR_DATA_TOGGLE,(function(e){const t=getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&e.preventDefault(),isDisabled(this))return;EventHandler.one(t,EVENT_HIDDEN,(()=>{isVisible(this)&&this.focus()}));const s=SelectorEngine.findOne(OPEN_SELECTOR);s&&s!==t&&Offcanvas.getInstance(s).hide();Offcanvas.getOrCreateInstance(t).toggle(this)})),EventHandler.on(window,EVENT_LOAD_DATA_API,(()=>SelectorEngine.find(OPEN_SELECTOR).forEach((e=>Offcanvas.getOrCreateInstance(e).show())))),defineJQueryPlugin(Offcanvas),window.bootstrap=window.bootstrap||{},window.bootstrap.Offcanvas=Offcanvas,Joomla&&Joomla.getOptions){const e=Joomla.getOptions("bootstrap.offcanvas");"object"==typeof e&&null!==e&&Object.keys(e).forEach((t=>{const s=e[t],n={backdrop:!s.backdrop||s.backdrop,keyboard:!s.keyboard||s.keyboard,scroll:!s.scroll||s.scroll},i=Array.from(document.querySelectorAll(t));i.length&&i.map((e=>new window.bootstrap.Offcanvas(e,n)))}))}export{Offcanvas as O};