diff options
author | Mark Otto <markdotto@gmail.com> | 2017-06-15 06:44:32 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2017-06-15 06:44:32 +0300 |
commit | 2e798301ca15ed45c86283371d4c5a37510f945d (patch) | |
tree | ccb2c4c91d089026a8b695c812a19a7994663b4e /js | |
parent | d7302c221aa5688edb6323d754a4b7dd508759e3 (diff) |
build
Diffstat (limited to 'js')
-rw-r--r-- | js/dist/collapse.js | 32 | ||||
-rw-r--r-- | js/dist/collapse.js.map | 2 |
2 files changed, 27 insertions, 7 deletions
diff --git a/js/dist/collapse.js b/js/dist/collapse.js index 0e2bc75e21..823c2be026 100644 --- a/js/dist/collapse.js +++ b/js/dist/collapse.js @@ -76,6 +76,14 @@ var Collapse = function ($) { this._element = element; this._config = this._getConfig(config); this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]'))); + var tabToggles = $(Selector.DATA_TOGGLE); + for (var i = 0; i < tabToggles.length; i++) { + var elem = tabToggles[i]; + var selector = Util.getSelectorFromElement(elem); + if (selector !== null && $(selector).filter(element).length > 0) { + this._triggerArray.push(elem); + } + } this._parent = this._config.parent ? this._getParent() : null; @@ -194,7 +202,16 @@ var Collapse = function ($) { $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW); if (this._triggerArray.length) { - $(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); + for (var i = 0; i < this._triggerArray.length; i++) { + var trigger = this._triggerArray[i]; + var selector = Util.getSelectorFromElement(trigger); + if (selector !== null) { + var $elem = $(selector); + if (!$elem.hasClass(ClassName.SHOW)) { + $(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); + } + } + } } this.setTransitioning(true); @@ -322,11 +339,14 @@ var Collapse = function ($) { event.preventDefault(); } - var target = Collapse._getTargetFromElement(this); - var data = $(target).data(DATA_KEY); - var config = data ? 'toggle' : $(this).data(); - - Collapse._jQueryInterface.call($(target), config); + var $trigger = $(this); + var selector = Util.getSelectorFromElement(this); + $(selector).each(function () { + var $target = $(this); + var data = $target.data(DATA_KEY); + var config = data ? 'toggle' : $trigger.data(); + Collapse._jQueryInterface.call($target, config); + }); }); /** diff --git a/js/dist/collapse.js.map b/js/dist/collapse.js.map index 5fa9f74faf..6ffeac9d2c 100644 --- a/js/dist/collapse.js.map +++ b/js/dist/collapse.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/collapse.js"],"names":["Collapse","$","NAME","VERSION","DATA_KEY","EVENT_KEY","DATA_API_KEY","JQUERY_NO_CONFLICT","fn","TRANSITION_DURATION","Default","toggle","parent","DefaultType","Event","SHOW","SHOWN","HIDE","HIDDEN","CLICK_DATA_API","ClassName","COLLAPSE","COLLAPSING","COLLAPSED","Dimension","WIDTH","HEIGHT","Selector","ACTIVES","DATA_TOGGLE","element","config","_isTransitioning","_element","_config","_getConfig","_triggerArray","makeArray","id","_parent","_getParent","_addAriaAndCollapsedClass","hasClass","hide","show","actives","activesData","children","length","data","startEvent","trigger","isDefaultPrevented","_jQueryInterface","call","dimension","_getDimension","removeClass","addClass","style","attr","setTransitioning","complete","Util","supportsTransitionEnd","capitalizedDimension","toUpperCase","slice","scrollSize","one","TRANSITION_END","emulateTransitionEnd","getBoundingClientRect","reflow","isTransitioning","dispose","removeData","extend","Boolean","typeCheckConfig","hasWidth","selector","find","each","i","_getTargetFromElement","triggerArray","isOpen","toggleClass","getSelectorFromElement","$this","test","undefined","Error","document","on","event","target","tagName","preventDefault","Constructor","noConflict","jQuery"],"mappings":";;;;;;AAGA;;;;;;;AAOA,IAAMA,WAAY,UAACC,CAAD,EAAO;;AAGvB;;;;;;AAMA,MAAMC,OAAsB,UAA5B;AACA,MAAMC,UAAsB,eAA5B;AACA,MAAMC,WAAsB,aAA5B;AACA,MAAMC,kBAA0BD,QAAhC;AACA,MAAME,eAAsB,WAA5B;AACA,MAAMC,qBAAsBN,EAAEO,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WgB,CA4WdsG,MA5Wc,CAAjB","file":"collapse.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0-alpha.6): collapse.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Collapse = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'collapse'\n const VERSION = '4.0.0-alpha.6'\n const DATA_KEY = 'bs.collapse'\n const EVENT_KEY = `.${DATA_KEY}`\n const DATA_API_KEY = '.data-api'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const TRANSITION_DURATION = 600\n\n const Default = {\n toggle : true,\n parent : ''\n }\n\n const DefaultType = {\n toggle : 'boolean',\n parent : 'string'\n }\n\n const Event = {\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`,\n HIDE : `hide${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`\n }\n\n const ClassName = {\n SHOW : 'show',\n COLLAPSE : 'collapse',\n COLLAPSING : 'collapsing',\n COLLAPSED : 'collapsed'\n }\n\n const Dimension = {\n WIDTH : 'width',\n HEIGHT : 'height'\n }\n\n const Selector = {\n ACTIVES : '.show, .collapsing',\n DATA_TOGGLE : '[data-toggle=\"collapse\"]'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Collapse {\n\n constructor(element, config) {\n this._isTransitioning = false\n this._element = element\n this._config = this._getConfig(config)\n this._triggerArray = $.makeArray($(\n `[data-toggle=\"collapse\"][href=\"#${element.id}\"],` +\n `[data-toggle=\"collapse\"][data-target=\"#${element.id}\"]`\n ))\n\n this._parent = this._config.parent ? this._getParent() : null\n\n if (!this._config.parent) {\n this._addAriaAndCollapsedClass(this._element, this._triggerArray)\n }\n\n if (this._config.toggle) {\n this.toggle()\n }\n }\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n\n // public\n\n toggle() {\n if ($(this._element).hasClass(ClassName.SHOW)) {\n this.hide()\n } else {\n this.show()\n }\n }\n\n show() {\n if (this._isTransitioning ||\n $(this._element).hasClass(ClassName.SHOW)) {\n return\n }\n\n let actives\n let activesData\n\n if (this._parent) {\n actives = $.makeArray($(this._parent).children().children(Selector.ACTIVES))\n if (!actives.length) {\n actives = null\n }\n }\n\n if (actives) {\n activesData = $(actives).data(DATA_KEY)\n if (activesData && activesData._isTransitioning) {\n return\n }\n }\n\n const startEvent = $.Event(Event.SHOW)\n $(this._element).trigger(startEvent)\n if (startEvent.isDefaultPrevented()) {\n return\n }\n\n if (actives) {\n Collapse._jQueryInterface.call($(actives), 'hide')\n if (!activesData) {\n $(actives).data(DATA_KEY, null)\n }\n }\n\n const dimension = this._getDimension()\n\n $(this._element)\n .removeClass(ClassName.COLLAPSE)\n .addClass(ClassName.COLLAPSING)\n\n this._element.style[dimension] = 0\n\n if (this._triggerArray.length) {\n $(this._triggerArray)\n .removeClass(ClassName.COLLAPSED)\n .attr('aria-expanded', true)\n }\n\n this.setTransitioning(true)\n\n const complete = () => {\n $(this._element)\n .removeClass(ClassName.COLLAPSING)\n .addClass(ClassName.COLLAPSE)\n .addClass(ClassName.SHOW)\n\n this._element.style[dimension] = ''\n\n this.setTransitioning(false)\n\n $(this._element).trigger(Event.SHOWN)\n }\n\n if (!Util.supportsTransitionEnd()) {\n complete()\n return\n }\n\n const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)\n const scrollSize = `scroll${capitalizedDimension}`\n\n $(this._element)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(TRANSITION_DURATION)\n\n this._element.style[dimension] = `${this._element[scrollSize]}px`\n }\n\n hide() {\n if (this._isTransitioning ||\n !$(this._element).hasClass(ClassName.SHOW)) {\n return\n }\n\n const startEvent = $.Event(Event.HIDE)\n $(this._element).trigger(startEvent)\n if (startEvent.isDefaultPrevented()) {\n return\n }\n\n const dimension = this._getDimension()\n\n this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`\n\n Util.reflow(this._element)\n\n $(this._element)\n .addClass(ClassName.COLLAPSING)\n .removeClass(ClassName.COLLAPSE)\n .removeClass(ClassName.SHOW)\n\n if (this._triggerArray.length) {\n $(this._triggerArray)\n .addClass(ClassName.COLLAPSED)\n .attr('aria-expanded', false)\n }\n\n this.setTransitioning(true)\n\n const complete = () => {\n this.setTransitioning(false)\n $(this._element)\n .removeClass(ClassName.COLLAPSING)\n .addClass(ClassName.COLLAPSE)\n .trigger(Event.HIDDEN)\n }\n\n this._element.style[dimension] = ''\n\n if (!Util.supportsTransitionEnd()) {\n complete()\n return\n }\n\n $(this._element)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(TRANSITION_DURATION)\n }\n\n setTransitioning(isTransitioning) {\n this._isTransitioning = isTransitioning\n }\n\n dispose() {\n $.removeData(this._element, DATA_KEY)\n\n this._config = null\n this._parent = null\n this._element = null\n this._triggerArray = null\n this._isTransitioning = null\n }\n\n\n // private\n\n _getConfig(config) {\n config = $.extend({}, Default, config)\n config.toggle = Boolean(config.toggle) // coerce string values\n Util.typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n\n _getDimension() {\n const hasWidth = $(this._element).hasClass(Dimension.WIDTH)\n return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT\n }\n\n _getParent() {\n const parent = $(this._config.parent)[0]\n const selector =\n `[data-toggle=\"collapse\"][data-parent=\"${this._config.parent}\"]`\n\n $(parent).find(selector).each((i, element) => {\n this._addAriaAndCollapsedClass(\n Collapse._getTargetFromElement(element),\n [element]\n )\n })\n\n return parent\n }\n\n _addAriaAndCollapsedClass(element, triggerArray) {\n if (element) {\n const isOpen = $(element).hasClass(ClassName.SHOW)\n\n if (triggerArray.length) {\n $(triggerArray)\n .toggleClass(ClassName.COLLAPSED, !isOpen)\n .attr('aria-expanded', isOpen)\n }\n }\n }\n\n\n // static\n\n static _getTargetFromElement(element) {\n const selector = Util.getSelectorFromElement(element)\n return selector ? $(selector)[0] : null\n }\n\n static _jQueryInterface(config) {\n return this.each(function () {\n const $this = $(this)\n let data = $this.data(DATA_KEY)\n const _config = $.extend(\n {},\n Default,\n $this.data(),\n typeof config === 'object' && config\n )\n\n if (!data && _config.toggle && /show|hide/.test(config)) {\n _config.toggle = false\n }\n\n if (!data) {\n data = new Collapse(this, _config)\n $this.data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (data[config] === undefined) {\n throw new Error(`No method named \"${config}\"`)\n }\n data[config]()\n }\n })\n }\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {\n if (!/input|textarea/i.test(event.target.tagName)) {\n event.preventDefault()\n }\n\n const target = Collapse._getTargetFromElement(this)\n const data = $(target).data(DATA_KEY)\n const config = data ? 'toggle' : $(this).data()\n\n Collapse._jQueryInterface.call($(target), config)\n })\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Collapse._jQueryInterface\n $.fn[NAME].Constructor = Collapse\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Collapse._jQueryInterface\n }\n\n return Collapse\n\n})(jQuery)\n\nexport default Collapse\n"]}
\ No newline at end of file +{"version":3,"sources":["../src/collapse.js"],"names":["Collapse","$","NAME","VERSION","DATA_KEY","EVENT_KEY","DATA_API_KEY","JQUERY_NO_CONFLICT","fn","TRANSITION_DURATION","Default","toggle","parent","DefaultType","Event","SHOW","SHOWN","HIDE","HIDDEN","CLICK_DATA_API","ClassName","COLLAPSE","COLLAPSING","COLLAPSED","Dimension","WIDTH","HEIGHT","Selector","ACTIVES","DATA_TOGGLE","element","config","_isTransitioning","_element","_config","_getConfig","_triggerArray","makeArray","id","tabToggles","i","length","elem","selector","Util","getSelectorFromElement","filter","push","_parent","_getParent","_addAriaAndCollapsedClass","hasClass","hide","show","actives","activesData","children","data","startEvent","trigger","isDefaultPrevented","_jQueryInterface","call","dimension","_getDimension","removeClass","addClass","style","attr","setTransitioning","complete","supportsTransitionEnd","capitalizedDimension","toUpperCase","slice","scrollSize","one","TRANSITION_END","emulateTransitionEnd","getBoundingClientRect","reflow","$elem","isTransitioning","dispose","removeData","extend","Boolean","typeCheckConfig","hasWidth","find","each","_getTargetFromElement","triggerArray","isOpen","toggleClass","$this","test","undefined","Error","document","on","event","target","tagName","preventDefault","$trigger","$target","Constructor","noConflict","jQuery"],"mappings":";;;;;;AAGA;;;;;;;AAOA,IAAMA,WAAY,UAACC,CAAD,EAAO;;AAGvB;;;;;;AAMA,MAAMC,OAAsB,UAA5B;AACA,MAAMC,UAAsB,eAA5B;AACA,MAAMC,WAAsB,aAA5B;AACA,MAAMC,kBAA0BD,QAAhC;AACA,MAAME,eAAsB,WAA5B;AACA,MAAMC,qBAAsBN,EAAEO,EAAF,CAAKN,IAAL,CAA5B;AACA,MAAMO,sBAAsB,GAA5B;;AAEA,MAAMC,UAAU;AACdC,YAAS,IADK;AAEdC,YAAS;AAFK,GAAhB;;AAKA,MAAMC,cAAc;AAClBF,YAAS,SADS;AAElBC,YAAS;AAFS,GAApB;;AAKA,MAAME,QAAQ;AACZC,mBAAwBV,SADZ;AAEZW,qBAAyBX,SAFb;AAGZY,mBAAwBZ,SAHZ;AAIZa,uBAA0Bb,SAJd;AAKZc,8BAAyBd,SAAzB,GAAqCC;AALzB,GAAd;;AAQA,MAAMc,YAAY;AAChBL,UAAa,MADG;AAEhBM,cAAa,UAFG;AAGhBC,gBAAa,YAHG;AAIhBC,eAAa;AAJG,GAAlB;;AAOA,MAAMC,YAAY;AAChBC,WAAS,OADO;AAEhBC,YAAS;AAFO,GAAlB;;AAKA,MAAMC,WAAW;AACfC,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C,OAA/B,EAAwC3E,MAAxC;AACD,KALD;AAMD,GAbD;;AAgBA;;;;;;AAMA9B,IAAEO,EAAF,CAAKN,IAAL,IAAyBF,SAAS6D,gBAAlC;AACA5D,IAAEO,EAAF,CAAKN,IAAL,EAAWyG,WAAX,GAAyB3G,QAAzB;AACAC,IAAEO,EAAF,CAAKN,IAAL,EAAW0G,UAAX,GAAyB,YAAY;AACnC3G,MAAEO,EAAF,CAAKN,IAAL,IAAaK,kBAAb;AACA,WAAOP,SAAS6D,gBAAhB;AACD,GAHD;;AAKA,SAAO7D,QAAP;AAED,CA/XgB,CA+Xd6G,MA/Xc,CAAjB","file":"collapse.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0-alpha.6): collapse.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Collapse = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'collapse'\n const VERSION = '4.0.0-alpha.6'\n const DATA_KEY = 'bs.collapse'\n const EVENT_KEY = `.${DATA_KEY}`\n const DATA_API_KEY = '.data-api'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const TRANSITION_DURATION = 600\n\n const Default = {\n toggle : true,\n parent : ''\n }\n\n const DefaultType = {\n toggle : 'boolean',\n parent : 'string'\n }\n\n const Event = {\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`,\n HIDE : `hide${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`\n }\n\n const ClassName = {\n SHOW : 'show',\n COLLAPSE : 'collapse',\n COLLAPSING : 'collapsing',\n COLLAPSED : 'collapsed'\n }\n\n const Dimension = {\n WIDTH : 'width',\n HEIGHT : 'height'\n }\n\n const Selector = {\n ACTIVES : '.show, .collapsing',\n DATA_TOGGLE : '[data-toggle=\"collapse\"]'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Collapse {\n\n constructor(element, config) {\n this._isTransitioning = false\n this._element = element\n this._config = this._getConfig(config)\n this._triggerArray = $.makeArray($(\n `[data-toggle=\"collapse\"][href=\"#${element.id}\"],` +\n `[data-toggle=\"collapse\"][data-target=\"#${element.id}\"]`\n ))\n const tabToggles = $(Selector.DATA_TOGGLE)\n for (let i = 0; i < tabToggles.length; i++) {\n const elem = tabToggles[i]\n const selector = Util.getSelectorFromElement(elem)\n if (selector !== null && $(selector).filter(element).length > 0) {\n this._triggerArray.push(elem)\n }\n }\n\n this._parent = this._config.parent ? this._getParent() : null\n\n if (!this._config.parent) {\n this._addAriaAndCollapsedClass(this._element, this._triggerArray)\n }\n\n if (this._config.toggle) {\n this.toggle()\n }\n }\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n\n // public\n\n toggle() {\n if ($(this._element).hasClass(ClassName.SHOW)) {\n this.hide()\n } else {\n this.show()\n }\n }\n\n show() {\n if (this._isTransitioning ||\n $(this._element).hasClass(ClassName.SHOW)) {\n return\n }\n\n let actives\n let activesData\n\n if (this._parent) {\n actives = $.makeArray($(this._parent).children().children(Selector.ACTIVES))\n if (!actives.length) {\n actives = null\n }\n }\n\n if (actives) {\n activesData = $(actives).data(DATA_KEY)\n if (activesData && activesData._isTransitioning) {\n return\n }\n }\n\n const startEvent = $.Event(Event.SHOW)\n $(this._element).trigger(startEvent)\n if (startEvent.isDefaultPrevented()) {\n return\n }\n\n if (actives) {\n Collapse._jQueryInterface.call($(actives), 'hide')\n if (!activesData) {\n $(actives).data(DATA_KEY, null)\n }\n }\n\n const dimension = this._getDimension()\n\n $(this._element)\n .removeClass(ClassName.COLLAPSE)\n .addClass(ClassName.COLLAPSING)\n\n this._element.style[dimension] = 0\n\n if (this._triggerArray.length) {\n $(this._triggerArray)\n .removeClass(ClassName.COLLAPSED)\n .attr('aria-expanded', true)\n }\n\n this.setTransitioning(true)\n\n const complete = () => {\n $(this._element)\n .removeClass(ClassName.COLLAPSING)\n .addClass(ClassName.COLLAPSE)\n .addClass(ClassName.SHOW)\n\n this._element.style[dimension] = ''\n\n this.setTransitioning(false)\n\n $(this._element).trigger(Event.SHOWN)\n }\n\n if (!Util.supportsTransitionEnd()) {\n complete()\n return\n }\n\n const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)\n const scrollSize = `scroll${capitalizedDimension}`\n\n $(this._element)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(TRANSITION_DURATION)\n\n this._element.style[dimension] = `${this._element[scrollSize]}px`\n }\n\n hide() {\n if (this._isTransitioning ||\n !$(this._element).hasClass(ClassName.SHOW)) {\n return\n }\n\n const startEvent = $.Event(Event.HIDE)\n $(this._element).trigger(startEvent)\n if (startEvent.isDefaultPrevented()) {\n return\n }\n\n const dimension = this._getDimension()\n\n this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`\n\n Util.reflow(this._element)\n\n $(this._element)\n .addClass(ClassName.COLLAPSING)\n .removeClass(ClassName.COLLAPSE)\n .removeClass(ClassName.SHOW)\n\n if (this._triggerArray.length) {\n for (let i = 0; i < this._triggerArray.length; i++) {\n const trigger = this._triggerArray[i]\n const selector = Util.getSelectorFromElement(trigger)\n if (selector !== null) {\n const $elem = $(selector)\n if (!$elem.hasClass(ClassName.SHOW)) {\n $(trigger).addClass(ClassName.COLLAPSED)\n .attr('aria-expanded', false)\n }\n }\n }\n }\n\n this.setTransitioning(true)\n\n const complete = () => {\n this.setTransitioning(false)\n $(this._element)\n .removeClass(ClassName.COLLAPSING)\n .addClass(ClassName.COLLAPSE)\n .trigger(Event.HIDDEN)\n }\n\n this._element.style[dimension] = ''\n\n if (!Util.supportsTransitionEnd()) {\n complete()\n return\n }\n\n $(this._element)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(TRANSITION_DURATION)\n }\n\n setTransitioning(isTransitioning) {\n this._isTransitioning = isTransitioning\n }\n\n dispose() {\n $.removeData(this._element, DATA_KEY)\n\n this._config = null\n this._parent = null\n this._element = null\n this._triggerArray = null\n this._isTransitioning = null\n }\n\n\n // private\n\n _getConfig(config) {\n config = $.extend({}, Default, config)\n config.toggle = Boolean(config.toggle) // coerce string values\n Util.typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n\n _getDimension() {\n const hasWidth = $(this._element).hasClass(Dimension.WIDTH)\n return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT\n }\n\n _getParent() {\n const parent = $(this._config.parent)[0]\n const selector =\n `[data-toggle=\"collapse\"][data-parent=\"${this._config.parent}\"]`\n\n $(parent).find(selector).each((i, element) => {\n this._addAriaAndCollapsedClass(\n Collapse._getTargetFromElement(element),\n [element]\n )\n })\n\n return parent\n }\n\n _addAriaAndCollapsedClass(element, triggerArray) {\n if (element) {\n const isOpen = $(element).hasClass(ClassName.SHOW)\n\n if (triggerArray.length) {\n $(triggerArray)\n .toggleClass(ClassName.COLLAPSED, !isOpen)\n .attr('aria-expanded', isOpen)\n }\n }\n }\n\n\n // static\n\n static _getTargetFromElement(element) {\n const selector = Util.getSelectorFromElement(element)\n return selector ? $(selector)[0] : null\n }\n\n static _jQueryInterface(config) {\n return this.each(function () {\n const $this = $(this)\n let data = $this.data(DATA_KEY)\n const _config = $.extend(\n {},\n Default,\n $this.data(),\n typeof config === 'object' && config\n )\n\n if (!data && _config.toggle && /show|hide/.test(config)) {\n _config.toggle = false\n }\n\n if (!data) {\n data = new Collapse(this, _config)\n $this.data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (data[config] === undefined) {\n throw new Error(`No method named \"${config}\"`)\n }\n data[config]()\n }\n })\n }\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {\n if (!/input|textarea/i.test(event.target.tagName)) {\n event.preventDefault()\n }\n\n const $trigger = $(this)\n const selector = Util.getSelectorFromElement(this)\n $(selector).each(function () {\n const $target = $(this)\n const data = $target.data(DATA_KEY)\n const config = data ? 'toggle' : $trigger.data()\n Collapse._jQueryInterface.call($target, config)\n })\n })\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Collapse._jQueryInterface\n $.fn[NAME].Constructor = Collapse\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Collapse._jQueryInterface\n }\n\n return Collapse\n\n})(jQuery)\n\nexport default Collapse\n"]}
\ No newline at end of file |