| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  | /*! | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   * Bootstrap collapse.js v5.3.0-alpha1 (https://getbootstrap.com/)
 | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
 | 
					
						
							| 
									
										
										
										
											2020-06-17 02:50:01 +08:00
										 |  |  |   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   */ | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | (function (global, factory) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './dom/selector-engine', './base-component'], factory) : | 
					
						
							|  |  |  |   (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.Index, global.EventHandler, global.SelectorEngine, global.BaseComponent)); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | })(this, (function (index_js, EventHandler, SelectorEngine, BaseComponent) { 'use strict'; | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * -------------------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |    * Bootstrap (v5.3.0-alpha1): collapse.js | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |    * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 | 
					
						
							|  |  |  |    * -------------------------------------------------------------------------- | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-03 22:18:59 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * Constants | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const NAME = 'collapse'; | 
					
						
							|  |  |  |   const DATA_KEY = 'bs.collapse'; | 
					
						
							|  |  |  |   const EVENT_KEY = `.${DATA_KEY}`; | 
					
						
							|  |  |  |   const DATA_API_KEY = '.data-api'; | 
					
						
							|  |  |  |   const EVENT_SHOW = `show${EVENT_KEY}`; | 
					
						
							|  |  |  |   const EVENT_SHOWN = `shown${EVENT_KEY}`; | 
					
						
							|  |  |  |   const EVENT_HIDE = `hide${EVENT_KEY}`; | 
					
						
							|  |  |  |   const EVENT_HIDDEN = `hidden${EVENT_KEY}`; | 
					
						
							|  |  |  |   const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; | 
					
						
							|  |  |  |   const CLASS_NAME_SHOW = 'show'; | 
					
						
							|  |  |  |   const CLASS_NAME_COLLAPSE = 'collapse'; | 
					
						
							|  |  |  |   const CLASS_NAME_COLLAPSING = 'collapsing'; | 
					
						
							|  |  |  |   const CLASS_NAME_COLLAPSED = 'collapsed'; | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  |   const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |   const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const WIDTH = 'width'; | 
					
						
							|  |  |  |   const HEIGHT = 'height'; | 
					
						
							| 
									
										
										
										
											2021-09-07 23:37:44 +08:00
										 |  |  |   const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]'; | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   const Default = { | 
					
						
							| 
									
										
										
										
											2022-07-19 23:43:58 +08:00
										 |  |  |     parent: null, | 
					
						
							|  |  |  |     toggle: true | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   }; | 
					
						
							|  |  |  |   const DefaultType = { | 
					
						
							| 
									
										
										
										
											2022-07-19 23:43:58 +08:00
										 |  |  |     parent: '(null|element)', | 
					
						
							|  |  |  |     toggle: 'boolean' | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-08 14:39:10 +08:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |    * Class definition | 
					
						
							| 
									
										
										
										
											2019-10-08 14:39:10 +08:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   class Collapse extends BaseComponent { | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     constructor(element, config) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       super(element, config); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       this._isTransitioning = false; | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       this._triggerArray = []; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE); | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       for (const elem of toggleList) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |         const selector = SelectorEngine.getSelectorFromElement(elem); | 
					
						
							|  |  |  |         const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element); | 
					
						
							| 
									
										
										
										
											2019-03-02 00:31:34 +08:00
										 |  |  |         if (selector !== null && filterElement.length) { | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |           this._triggerArray.push(elem); | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       this._initializeChildren(); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       if (!this._config.parent) { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |         this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       if (this._config.toggle) { | 
					
						
							|  |  |  |         this.toggle(); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-05-10 14:00:59 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Getters
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     static get Default() { | 
					
						
							|  |  |  |       return Default; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |     static get DefaultType() { | 
					
						
							|  |  |  |       return DefaultType; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-05-14 00:22:20 +08:00
										 |  |  |     static get NAME() { | 
					
						
							|  |  |  |       return NAME; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-10-10 08:26:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Public
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     toggle() { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       if (this._isShown()) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         this.hide(); | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         this.show(); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     show() { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       if (this._isTransitioning || this._isShown()) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       let activeChildren = []; | 
					
						
							| 
									
										
										
										
											2018-09-18 03:34:34 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       // find active children
 | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       if (this._config.parent) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, { | 
					
						
							|  |  |  |           toggle: false | 
					
						
							|  |  |  |         })); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       if (activeChildren.length && activeChildren[0]._isTransitioning) { | 
					
						
							|  |  |  |         return; | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       const startEvent = EventHandler.trigger(this._element, EVENT_SHOW); | 
					
						
							| 
									
										
										
										
											2019-03-02 00:31:34 +08:00
										 |  |  |       if (startEvent.defaultPrevented) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       for (const activeInstance of activeChildren) { | 
					
						
							|  |  |  |         activeInstance.hide(); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       const dimension = this._getDimension(); | 
					
						
							| 
									
										
										
										
											2020-03-28 18:29:08 +08:00
										 |  |  |       this._element.classList.remove(CLASS_NAME_COLLAPSE); | 
					
						
							|  |  |  |       this._element.classList.add(CLASS_NAME_COLLAPSING); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       this._element.style[dimension] = 0; | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       this._addAriaAndCollapsedClass(this._triggerArray, true); | 
					
						
							|  |  |  |       this._isTransitioning = true; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       const complete = () => { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |         this._isTransitioning = false; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |         this._element.classList.remove(CLASS_NAME_COLLAPSING); | 
					
						
							|  |  |  |         this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW); | 
					
						
							|  |  |  |         this._element.style[dimension] = ''; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |         EventHandler.trigger(this._element, EVENT_SHOWN); | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  |       }; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); | 
					
						
							|  |  |  |       const scrollSize = `scroll${capitalizedDimension}`; | 
					
						
							| 
									
										
										
										
											2021-05-14 00:22:20 +08:00
										 |  |  |       this._queueCallback(complete, this._element, true); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       this._element.style[dimension] = `${this._element[scrollSize]}px`; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     hide() { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       if (this._isTransitioning || !this._isShown()) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       const startEvent = EventHandler.trigger(this._element, EVENT_HIDE); | 
					
						
							| 
									
										
										
										
											2019-03-02 00:31:34 +08:00
										 |  |  |       if (startEvent.defaultPrevented) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       const dimension = this._getDimension(); | 
					
						
							|  |  |  |       this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       index_js.reflow(this._element); | 
					
						
							| 
									
										
										
										
											2020-03-28 18:29:08 +08:00
										 |  |  |       this._element.classList.add(CLASS_NAME_COLLAPSING); | 
					
						
							| 
									
										
										
										
											2020-05-14 02:53:43 +08:00
										 |  |  |       this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW); | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       for (const trigger of this._triggerArray) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |         const element = SelectorEngine.getElementFromSelector(trigger); | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         if (element && !this._isShown(element)) { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |           this._addAriaAndCollapsedClass([trigger], false); | 
					
						
							| 
									
										
										
										
											2017-09-06 12:05:12 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       this._isTransitioning = true; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       const complete = () => { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |         this._isTransitioning = false; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |         this._element.classList.remove(CLASS_NAME_COLLAPSING); | 
					
						
							|  |  |  |         this._element.classList.add(CLASS_NAME_COLLAPSE); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |         EventHandler.trigger(this._element, EVENT_HIDDEN); | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  |       }; | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       this._element.style[dimension] = ''; | 
					
						
							| 
									
										
										
										
											2021-05-14 00:22:20 +08:00
										 |  |  |       this._queueCallback(complete, this._element, true); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |     _isShown(element = this._element) { | 
					
						
							|  |  |  |       return element.classList.contains(CLASS_NAME_SHOW); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Private
 | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |     _configAfterMerge(config) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       config.toggle = Boolean(config.toggle); // Coerce string values
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       config.parent = index_js.getElement(config.parent); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       return config; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     _getDimension() { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |     _initializeChildren() { | 
					
						
							|  |  |  |       if (!this._config.parent) { | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE); | 
					
						
							|  |  |  |       for (const element of children) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |         const selected = SelectorEngine.getElementFromSelector(element); | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |         if (selected) { | 
					
						
							|  |  |  |           this._addAriaAndCollapsedClass([element], this._isShown(selected)); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     _getFirstLevelChildren(selector) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); | 
					
						
							|  |  |  |       // remove children if greater depth
 | 
					
						
							|  |  |  |       return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element)); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |     _addAriaAndCollapsedClass(triggerArray, isOpen) { | 
					
						
							|  |  |  |       if (!triggerArray.length) { | 
					
						
							| 
									
										
										
										
											2020-09-14 23:12:06 +08:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       for (const element of triggerArray) { | 
					
						
							|  |  |  |         element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen); | 
					
						
							|  |  |  |         element.setAttribute('aria-expanded', isOpen); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-10-01 05:28:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Static
 | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |     static jQueryInterface(config) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       const _config = {}; | 
					
						
							|  |  |  |       if (typeof config === 'string' && /show|hide/.test(config)) { | 
					
						
							|  |  |  |         _config.toggle = false; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       return this.each(function () { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |         const data = Collapse.getOrCreateInstance(this, _config); | 
					
						
							|  |  |  |         if (typeof config === 'string') { | 
					
						
							|  |  |  |           if (typeof data[config] === 'undefined') { | 
					
						
							|  |  |  |             throw new TypeError(`No method named "${config}"`); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           data[config](); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |    * Data API implementation | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2017-10-01 05:28:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |     // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
 | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |     if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       event.preventDefault(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       Collapse.getOrCreateInstance(element, { | 
					
						
							|  |  |  |         toggle: false | 
					
						
							|  |  |  |       }).toggle(); | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * jQuery | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-05-10 14:00:59 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   index_js.defineJQueryPlugin(Collapse); | 
					
						
							| 
									
										
										
										
											2015-05-10 14:00:59 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return Collapse; | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  | })); | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | //# sourceMappingURL=collapse.js.map
 |