diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/collapse.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/collapse.js | 104 |
1 files changed, 53 insertions, 51 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/collapse.js b/vendor/twbs/bootstrap/js/dist/collapse.js index 7f192dadc..b5d663243 100644 --- a/vendor/twbs/bootstrap/js/dist/collapse.js +++ b/vendor/twbs/bootstrap/js/dist/collapse.js @@ -1,5 +1,5 @@ /*! - * Bootstrap collapse.js v4.5.2 (https://getbootstrap.com/) + * Bootstrap collapse.js v4.5.3 (https://getbootstrap.com/) * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -9,8 +9,10 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.jQuery, global.Util)); }(this, (function ($, Util) { 'use strict'; - $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $; - Util = Util && Object.prototype.hasOwnProperty.call(Util, 'default') ? Util['default'] : Util; + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + var $__default = /*#__PURE__*/_interopDefaultLegacy($); + var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util); function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } @@ -24,11 +26,11 @@ */ var NAME = 'collapse'; - var VERSION = '4.5.2'; + var VERSION = '4.5.3'; var DATA_KEY = 'bs.collapse'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; + var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME]; var Default = { toggle: true, parent: '' @@ -66,7 +68,7 @@ for (var i = 0, len = toggleList.length; i < len; i++) { var elem = toggleList[i]; - var selector = Util.getSelectorFromElement(elem); + var selector = Util__default['default'].getSelectorFromElement(elem); var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { return foundElem === element; }); @@ -94,7 +96,7 @@ // Public _proto.toggle = function toggle() { - if ($(this._element).hasClass(CLASS_NAME_SHOW)) { + if ($__default['default'](this._element).hasClass(CLASS_NAME_SHOW)) { this.hide(); } else { this.show(); @@ -104,7 +106,7 @@ _proto.show = function show() { var _this = this; - if (this._isTransitioning || $(this._element).hasClass(CLASS_NAME_SHOW)) { + if (this._isTransitioning || $__default['default'](this._element).hasClass(CLASS_NAME_SHOW)) { return; } @@ -126,64 +128,64 @@ } if (actives) { - activesData = $(actives).not(this._selector).data(DATA_KEY); + activesData = $__default['default'](actives).not(this._selector).data(DATA_KEY); if (activesData && activesData._isTransitioning) { return; } } - var startEvent = $.Event(EVENT_SHOW); - $(this._element).trigger(startEvent); + var startEvent = $__default['default'].Event(EVENT_SHOW); + $__default['default'](this._element).trigger(startEvent); if (startEvent.isDefaultPrevented()) { return; } if (actives) { - Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); + Collapse._jQueryInterface.call($__default['default'](actives).not(this._selector), 'hide'); if (!activesData) { - $(actives).data(DATA_KEY, null); + $__default['default'](actives).data(DATA_KEY, null); } } var dimension = this._getDimension(); - $(this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING); + $__default['default'](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING); this._element.style[dimension] = 0; if (this._triggerArray.length) { - $(this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true); + $__default['default'](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true); } this.setTransitioning(true); var complete = function complete() { - $(_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW); + $__default['default'](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW); _this._element.style[dimension] = ''; _this.setTransitioning(false); - $(_this._element).trigger(EVENT_SHOWN); + $__default['default'](_this._element).trigger(EVENT_SHOWN); }; var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); var scrollSize = "scroll" + capitalizedDimension; - var transitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); + var transitionDuration = Util__default['default'].getTransitionDurationFromElement(this._element); + $__default['default'](this._element).one(Util__default['default'].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); this._element.style[dimension] = this._element[scrollSize] + "px"; }; _proto.hide = function hide() { var _this2 = this; - if (this._isTransitioning || !$(this._element).hasClass(CLASS_NAME_SHOW)) { + if (this._isTransitioning || !$__default['default'](this._element).hasClass(CLASS_NAME_SHOW)) { return; } - var startEvent = $.Event(EVENT_HIDE); - $(this._element).trigger(startEvent); + var startEvent = $__default['default'].Event(EVENT_HIDE); + $__default['default'](this._element).trigger(startEvent); if (startEvent.isDefaultPrevented()) { return; @@ -192,20 +194,20 @@ var dimension = this._getDimension(); this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; - Util.reflow(this._element); - $(this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW); + Util__default['default'].reflow(this._element); + $__default['default'](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW); var triggerArrayLength = this._triggerArray.length; if (triggerArrayLength > 0) { for (var i = 0; i < triggerArrayLength; i++) { var trigger = this._triggerArray[i]; - var selector = Util.getSelectorFromElement(trigger); + var selector = Util__default['default'].getSelectorFromElement(trigger); if (selector !== null) { - var $elem = $([].slice.call(document.querySelectorAll(selector))); + var $elem = $__default['default']([].slice.call(document.querySelectorAll(selector))); if (!$elem.hasClass(CLASS_NAME_SHOW)) { - $(trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false); + $__default['default'](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false); } } } @@ -216,12 +218,12 @@ var complete = function complete() { _this2.setTransitioning(false); - $(_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN); + $__default['default'](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN); }; this._element.style[dimension] = ''; - var transitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); + var transitionDuration = Util__default['default'].getTransitionDurationFromElement(this._element); + $__default['default'](this._element).one(Util__default['default'].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); }; _proto.setTransitioning = function setTransitioning(isTransitioning) { @@ -229,7 +231,7 @@ }; _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY); + $__default['default'].removeData(this._element, DATA_KEY); this._config = null; this._parent = null; this._element = null; @@ -242,12 +244,12 @@ config = _extends({}, Default, config); config.toggle = Boolean(config.toggle); // Coerce string values - Util.typeCheckConfig(NAME, config, DefaultType); + Util__default['default'].typeCheckConfig(NAME, config, DefaultType); return config; }; _proto._getDimension = function _getDimension() { - var hasWidth = $(this._element).hasClass(DIMENSION_WIDTH); + var hasWidth = $__default['default'](this._element).hasClass(DIMENSION_WIDTH); return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT; }; @@ -256,7 +258,7 @@ var parent; - if (Util.isElement(this._config.parent)) { + if (Util__default['default'].isElement(this._config.parent)) { parent = this._config.parent; // It's a jQuery object if (typeof this._config.parent.jquery !== 'undefined') { @@ -268,32 +270,32 @@ var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; var children = [].slice.call(parent.querySelectorAll(selector)); - $(children).each(function (i, element) { + $__default['default'](children).each(function (i, element) { _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); }); return parent; }; _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { - var isOpen = $(element).hasClass(CLASS_NAME_SHOW); + var isOpen = $__default['default'](element).hasClass(CLASS_NAME_SHOW); if (triggerArray.length) { - $(triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen); + $__default['default'](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen); } } // Static ; Collapse._getTargetFromElement = function _getTargetFromElement(element) { - var selector = Util.getSelectorFromElement(element); + var selector = Util__default['default'].getSelectorFromElement(element); return selector ? document.querySelector(selector) : null; }; Collapse._jQueryInterface = function _jQueryInterface(config) { return this.each(function () { - var $this = $(this); - var data = $this.data(DATA_KEY); + var $element = $__default['default'](this); + var data = $element.data(DATA_KEY); - var _config = _extends({}, Default, $this.data(), typeof config === 'object' && config ? config : {}); + var _config = _extends({}, Default, $element.data(), typeof config === 'object' && config ? config : {}); if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { _config.toggle = false; @@ -301,7 +303,7 @@ if (!data) { data = new Collapse(this, _config); - $this.data(DATA_KEY, data); + $element.data(DATA_KEY, data); } if (typeof config === 'string') { @@ -335,17 +337,17 @@ */ - $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { + $__default['default'](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { // preventDefault only for <a> elements (which change the URL) not inside the collapsible element if (event.currentTarget.tagName === 'A') { event.preventDefault(); } - var $trigger = $(this); - var selector = Util.getSelectorFromElement(this); + var $trigger = $__default['default'](this); + var selector = Util__default['default'].getSelectorFromElement(this); var selectors = [].slice.call(document.querySelectorAll(selector)); - $(selectors).each(function () { - var $target = $(this); + $__default['default'](selectors).each(function () { + var $target = $__default['default'](this); var data = $target.data(DATA_KEY); var config = data ? 'toggle' : $trigger.data(); @@ -358,11 +360,11 @@ * ------------------------------------------------------------------------ */ - $.fn[NAME] = Collapse._jQueryInterface; - $.fn[NAME].Constructor = Collapse; + $__default['default'].fn[NAME] = Collapse._jQueryInterface; + $__default['default'].fn[NAME].Constructor = Collapse; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; + $__default['default'].fn[NAME].noConflict = function () { + $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT; return Collapse._jQueryInterface; }; |