diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/carousel.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/carousel.js | 113 |
1 files changed, 58 insertions, 55 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/carousel.js b/vendor/twbs/bootstrap/js/dist/carousel.js index 7ae15c89a..b9d1ec6d8 100644 --- a/vendor/twbs/bootstrap/js/dist/carousel.js +++ b/vendor/twbs/bootstrap/js/dist/carousel.js @@ -1,5 +1,5 @@ /*! - * Bootstrap carousel.js v4.5.2 (https://getbootstrap.com/) + * Bootstrap carousel.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.Carousel = 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 = 'carousel'; - var VERSION = '4.5.2'; + var VERSION = '4.5.3'; var DATA_KEY = 'bs.carousel'; 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 ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key @@ -125,9 +127,10 @@ }; _proto.nextWhenVisible = function nextWhenVisible() { - // Don't call next when the page isn't visible + var $element = $__default['default'](this._element); // Don't call next when the page isn't visible // or the carousel or its parent isn't visible - if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { + + if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') { this.next(); } }; @@ -144,7 +147,7 @@ } if (this._element.querySelector(SELECTOR_NEXT_PREV)) { - Util.triggerTransitionEnd(this._element); + Util__default['default'].triggerTransitionEnd(this._element); this.cycle(true); } @@ -179,7 +182,7 @@ } if (this._isSliding) { - $(this._element).one(EVENT_SLID, function () { + $__default['default'](this._element).one(EVENT_SLID, function () { return _this.to(index); }); return; @@ -197,8 +200,8 @@ }; _proto.dispose = function dispose() { - $(this._element).off(EVENT_KEY); - $.removeData(this._element, DATA_KEY); + $__default['default'](this._element).off(EVENT_KEY); + $__default['default'].removeData(this._element, DATA_KEY); this._items = null; this._config = null; this._element = null; @@ -212,7 +215,7 @@ _proto._getConfig = function _getConfig(config) { config = _extends({}, Default, config); - Util.typeCheckConfig(NAME, config, DefaultType); + Util__default['default'].typeCheckConfig(NAME, config, DefaultType); return config; }; @@ -240,13 +243,13 @@ var _this2 = this; if (this._config.keyboard) { - $(this._element).on(EVENT_KEYDOWN, function (event) { + $__default['default'](this._element).on(EVENT_KEYDOWN, function (event) { return _this2._keydown(event); }); } if (this._config.pause === 'hover') { - $(this._element).on(EVENT_MOUSEENTER, function (event) { + $__default['default'](this._element).on(EVENT_MOUSEENTER, function (event) { return _this2.pause(event); }).on(EVENT_MOUSELEAVE, function (event) { return _this2.cycle(event); @@ -309,27 +312,27 @@ } }; - $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) { + $__default['default'](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) { return e.preventDefault(); }); if (this._pointerEvent) { - $(this._element).on(EVENT_POINTERDOWN, function (event) { + $__default['default'](this._element).on(EVENT_POINTERDOWN, function (event) { return start(event); }); - $(this._element).on(EVENT_POINTERUP, function (event) { + $__default['default'](this._element).on(EVENT_POINTERUP, function (event) { return end(event); }); this._element.classList.add(CLASS_NAME_POINTER_EVENT); } else { - $(this._element).on(EVENT_TOUCHSTART, function (event) { + $__default['default'](this._element).on(EVENT_TOUCHSTART, function (event) { return start(event); }); - $(this._element).on(EVENT_TOUCHMOVE, function (event) { + $__default['default'](this._element).on(EVENT_TOUCHMOVE, function (event) { return move(event); }); - $(this._element).on(EVENT_TOUCHEND, function (event) { + $__default['default'](this._element).on(EVENT_TOUCHEND, function (event) { return end(event); }); } @@ -381,25 +384,25 @@ var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM)); - var slideEvent = $.Event(EVENT_SLIDE, { + var slideEvent = $__default['default'].Event(EVENT_SLIDE, { relatedTarget: relatedTarget, direction: eventDirectionName, from: fromIndex, to: targetIndex }); - $(this._element).trigger(slideEvent); + $__default['default'](this._element).trigger(slideEvent); return slideEvent; }; _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { if (this._indicatorsElement) { var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE)); - $(indicators).removeClass(CLASS_NAME_ACTIVE); + $__default['default'](indicators).removeClass(CLASS_NAME_ACTIVE); var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; if (nextIndicator) { - $(nextIndicator).addClass(CLASS_NAME_ACTIVE); + $__default['default'](nextIndicator).addClass(CLASS_NAME_ACTIVE); } } }; @@ -430,7 +433,7 @@ eventDirectionName = DIRECTION_RIGHT; } - if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE)) { + if (nextElement && $__default['default'](nextElement).hasClass(CLASS_NAME_ACTIVE)) { this._isSliding = false; return; } @@ -454,18 +457,18 @@ this._setActiveIndicatorElement(nextElement); - var slidEvent = $.Event(EVENT_SLID, { + var slidEvent = $__default['default'].Event(EVENT_SLID, { relatedTarget: nextElement, direction: eventDirectionName, from: activeElementIndex, to: nextElementIndex }); - if ($(this._element).hasClass(CLASS_NAME_SLIDE)) { - $(nextElement).addClass(orderClassName); - Util.reflow(nextElement); - $(activeElement).addClass(directionalClassName); - $(nextElement).addClass(directionalClassName); + if ($__default['default'](this._element).hasClass(CLASS_NAME_SLIDE)) { + $__default['default'](nextElement).addClass(orderClassName); + Util__default['default'].reflow(nextElement); + $__default['default'](activeElement).addClass(directionalClassName); + $__default['default'](nextElement).addClass(directionalClassName); var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); if (nextElementInterval) { @@ -475,20 +478,20 @@ this._config.interval = this._config.defaultInterval || this._config.interval; } - var transitionDuration = Util.getTransitionDurationFromElement(activeElement); - $(activeElement).one(Util.TRANSITION_END, function () { - $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE); - $(activeElement).removeClass(CLASS_NAME_ACTIVE + " " + orderClassName + " " + directionalClassName); + var transitionDuration = Util__default['default'].getTransitionDurationFromElement(activeElement); + $__default['default'](activeElement).one(Util__default['default'].TRANSITION_END, function () { + $__default['default'](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE); + $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE + " " + orderClassName + " " + directionalClassName); _this4._isSliding = false; setTimeout(function () { - return $(_this4._element).trigger(slidEvent); + return $__default['default'](_this4._element).trigger(slidEvent); }, 0); }).emulateTransitionEnd(transitionDuration); } else { - $(activeElement).removeClass(CLASS_NAME_ACTIVE); - $(nextElement).addClass(CLASS_NAME_ACTIVE); + $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE); + $__default['default'](nextElement).addClass(CLASS_NAME_ACTIVE); this._isSliding = false; - $(this._element).trigger(slidEvent); + $__default['default'](this._element).trigger(slidEvent); } if (isCycling) { @@ -499,9 +502,9 @@ Carousel._jQueryInterface = function _jQueryInterface(config) { return this.each(function () { - var data = $(this).data(DATA_KEY); + var data = $__default['default'](this).data(DATA_KEY); - var _config = _extends({}, Default, $(this).data()); + var _config = _extends({}, Default, $__default['default'](this).data()); if (typeof config === 'object') { _config = _extends({}, _config, config); @@ -511,7 +514,7 @@ if (!data) { data = new Carousel(this, _config); - $(this).data(DATA_KEY, data); + $__default['default'](this).data(DATA_KEY, data); } if (typeof config === 'number') { @@ -530,19 +533,19 @@ }; Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { - var selector = Util.getSelectorFromElement(this); + var selector = Util__default['default'].getSelectorFromElement(this); if (!selector) { return; } - var target = $(selector)[0]; + var target = $__default['default'](selector)[0]; - if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) { + if (!target || !$__default['default'](target).hasClass(CLASS_NAME_CAROUSEL)) { return; } - var config = _extends({}, $(target).data(), $(this).data()); + var config = _extends({}, $__default['default'](target).data(), $__default['default'](this).data()); var slideIndex = this.getAttribute('data-slide-to'); @@ -550,10 +553,10 @@ config.interval = false; } - Carousel._jQueryInterface.call($(target), config); + Carousel._jQueryInterface.call($__default['default'](target), config); if (slideIndex) { - $(target).data(DATA_KEY).to(slideIndex); + $__default['default'](target).data(DATA_KEY).to(slideIndex); } event.preventDefault(); @@ -580,12 +583,12 @@ */ - $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler); - $(window).on(EVENT_LOAD_DATA_API, function () { + $__default['default'](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler); + $__default['default'](window).on(EVENT_LOAD_DATA_API, function () { var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)); for (var i = 0, len = carousels.length; i < len; i++) { - var $carousel = $(carousels[i]); + var $carousel = $__default['default'](carousels[i]); Carousel._jQueryInterface.call($carousel, $carousel.data()); } @@ -596,11 +599,11 @@ * ------------------------------------------------------------------------ */ - $.fn[NAME] = Carousel._jQueryInterface; - $.fn[NAME].Constructor = Carousel; + $__default['default'].fn[NAME] = Carousel._jQueryInterface; + $__default['default'].fn[NAME].Constructor = Carousel; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; + $__default['default'].fn[NAME].noConflict = function () { + $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT; return Carousel._jQueryInterface; }; |