aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/dist/carousel.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/carousel.js')
-rw-r--r--vendor/twbs/bootstrap/js/dist/carousel.js262
1 files changed, 102 insertions, 160 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/carousel.js b/vendor/twbs/bootstrap/js/dist/carousel.js
index 287b2435f..7ae15c89a 100644
--- a/vendor/twbs/bootstrap/js/dist/carousel.js
+++ b/vendor/twbs/bootstrap/js/dist/carousel.js
@@ -1,67 +1,22 @@
/*!
- * Bootstrap carousel.js v4.3.1 (https://getbootstrap.com/)
- * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * Bootstrap carousel.js v4.5.2 (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)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
- (global = global || self, global.Carousel = factory(global.jQuery, global.Util));
-}(this, function ($, Util) { 'use strict';
-
- $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
- Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
-
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
-
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
- }
-
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.jQuery, global.Util));
+}(this, (function ($, Util) { 'use strict';
- return obj;
- }
+ $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
+ Util = Util && Object.prototype.hasOwnProperty.call(Util, 'default') ? Util['default'] : Util;
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
+ 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); }
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
-
- ownKeys.forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- }
-
- return target;
- }
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* ------------------------------------------------------------------------
* Constants
@@ -69,7 +24,7 @@
*/
var NAME = 'carousel';
- var VERSION = '4.3.1';
+ var VERSION = '4.5.2';
var DATA_KEY = 'bs.carousel';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@@ -97,62 +52,50 @@
wrap: 'boolean',
touch: 'boolean'
};
- var Direction = {
- NEXT: 'next',
- PREV: 'prev',
- LEFT: 'left',
- RIGHT: 'right'
- };
- var Event = {
- SLIDE: "slide" + EVENT_KEY,
- SLID: "slid" + EVENT_KEY,
- KEYDOWN: "keydown" + EVENT_KEY,
- MOUSEENTER: "mouseenter" + EVENT_KEY,
- MOUSELEAVE: "mouseleave" + EVENT_KEY,
- TOUCHSTART: "touchstart" + EVENT_KEY,
- TOUCHMOVE: "touchmove" + EVENT_KEY,
- TOUCHEND: "touchend" + EVENT_KEY,
- POINTERDOWN: "pointerdown" + EVENT_KEY,
- POINTERUP: "pointerup" + EVENT_KEY,
- DRAG_START: "dragstart" + EVENT_KEY,
- LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
- CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
- };
- var ClassName = {
- CAROUSEL: 'carousel',
- ACTIVE: 'active',
- SLIDE: 'slide',
- RIGHT: 'carousel-item-right',
- LEFT: 'carousel-item-left',
- NEXT: 'carousel-item-next',
- PREV: 'carousel-item-prev',
- ITEM: 'carousel-item',
- POINTER_EVENT: 'pointer-event'
- };
- var Selector = {
- ACTIVE: '.active',
- ACTIVE_ITEM: '.active.carousel-item',
- ITEM: '.carousel-item',
- ITEM_IMG: '.carousel-item img',
- NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
- INDICATORS: '.carousel-indicators',
- DATA_SLIDE: '[data-slide], [data-slide-to]',
- DATA_RIDE: '[data-ride="carousel"]'
- };
+ var DIRECTION_NEXT = 'next';
+ var DIRECTION_PREV = 'prev';
+ var DIRECTION_LEFT = 'left';
+ var DIRECTION_RIGHT = 'right';
+ var EVENT_SLIDE = "slide" + EVENT_KEY;
+ var EVENT_SLID = "slid" + EVENT_KEY;
+ var EVENT_KEYDOWN = "keydown" + EVENT_KEY;
+ var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY;
+ var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY;
+ var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY;
+ var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY;
+ var EVENT_TOUCHEND = "touchend" + EVENT_KEY;
+ var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY;
+ var EVENT_POINTERUP = "pointerup" + EVENT_KEY;
+ var EVENT_DRAG_START = "dragstart" + EVENT_KEY;
+ var EVENT_LOAD_DATA_API = "load" + EVENT_KEY + DATA_API_KEY;
+ var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
+ var CLASS_NAME_CAROUSEL = 'carousel';
+ var CLASS_NAME_ACTIVE = 'active';
+ var CLASS_NAME_SLIDE = 'slide';
+ var CLASS_NAME_RIGHT = 'carousel-item-right';
+ var CLASS_NAME_LEFT = 'carousel-item-left';
+ var CLASS_NAME_NEXT = 'carousel-item-next';
+ var CLASS_NAME_PREV = 'carousel-item-prev';
+ var CLASS_NAME_POINTER_EVENT = 'pointer-event';
+ var SELECTOR_ACTIVE = '.active';
+ var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
+ var SELECTOR_ITEM = '.carousel-item';
+ var SELECTOR_ITEM_IMG = '.carousel-item img';
+ var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
+ var SELECTOR_INDICATORS = '.carousel-indicators';
+ var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
+ var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
var PointerType = {
TOUCH: 'touch',
PEN: 'pen'
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
-
};
+ /**
+ * ------------------------------------------------------------------------
+ * Class Definition
+ * ------------------------------------------------------------------------
+ */
- var Carousel =
- /*#__PURE__*/
- function () {
+ var Carousel = /*#__PURE__*/function () {
function Carousel(element, config) {
this._items = null;
this._interval = null;
@@ -164,7 +107,7 @@
this.touchDeltaX = 0;
this._config = this._getConfig(config);
this._element = element;
- this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
+ this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
@@ -177,7 +120,7 @@
// Public
_proto.next = function next() {
if (!this._isSliding) {
- this._slide(Direction.NEXT);
+ this._slide(DIRECTION_NEXT);
}
};
@@ -191,7 +134,7 @@
_proto.prev = function prev() {
if (!this._isSliding) {
- this._slide(Direction.PREV);
+ this._slide(DIRECTION_PREV);
}
};
@@ -200,7 +143,7 @@
this._isPaused = true;
}
- if (this._element.querySelector(Selector.NEXT_PREV)) {
+ if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
Util.triggerTransitionEnd(this._element);
this.cycle(true);
}
@@ -227,7 +170,7 @@
_proto.to = function to(index) {
var _this = this;
- this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
+ this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
var activeIndex = this._getItemIndex(this._activeElement);
@@ -236,7 +179,7 @@
}
if (this._isSliding) {
- $(this._element).one(Event.SLID, function () {
+ $(this._element).one(EVENT_SLID, function () {
return _this.to(index);
});
return;
@@ -248,7 +191,7 @@
return;
}
- var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
+ var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
this._slide(direction, this._items[index]);
};
@@ -268,7 +211,7 @@
;
_proto._getConfig = function _getConfig(config) {
- config = _objectSpread({}, Default, config);
+ config = _extends({}, Default, config);
Util.typeCheckConfig(NAME, config, DefaultType);
return config;
};
@@ -280,7 +223,8 @@
return;
}
- var direction = absDeltax / this.touchDeltaX; // swipe left
+ var direction = absDeltax / this.touchDeltaX;
+ this.touchDeltaX = 0; // swipe left
if (direction > 0) {
this.prev();
@@ -296,15 +240,15 @@
var _this2 = this;
if (this._config.keyboard) {
- $(this._element).on(Event.KEYDOWN, function (event) {
+ $(this._element).on(EVENT_KEYDOWN, function (event) {
return _this2._keydown(event);
});
}
if (this._config.pause === 'hover') {
- $(this._element).on(Event.MOUSEENTER, function (event) {
+ $(this._element).on(EVENT_MOUSEENTER, function (event) {
return _this2.pause(event);
- }).on(Event.MOUSELEAVE, function (event) {
+ }).on(EVENT_MOUSELEAVE, function (event) {
return _this2.cycle(event);
});
}
@@ -365,27 +309,27 @@
}
};
- $(this._element.querySelectorAll(Selector.ITEM_IMG)).on(Event.DRAG_START, function (e) {
+ $(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) {
+ $(this._element).on(EVENT_POINTERDOWN, function (event) {
return start(event);
});
- $(this._element).on(Event.POINTERUP, function (event) {
+ $(this._element).on(EVENT_POINTERUP, function (event) {
return end(event);
});
- this._element.classList.add(ClassName.POINTER_EVENT);
+ this._element.classList.add(CLASS_NAME_POINTER_EVENT);
} else {
- $(this._element).on(Event.TOUCHSTART, function (event) {
+ $(this._element).on(EVENT_TOUCHSTART, function (event) {
return start(event);
});
- $(this._element).on(Event.TOUCHMOVE, function (event) {
+ $(this._element).on(EVENT_TOUCHMOVE, function (event) {
return move(event);
});
- $(this._element).on(Event.TOUCHEND, function (event) {
+ $(this._element).on(EVENT_TOUCHEND, function (event) {
return end(event);
});
}
@@ -406,19 +350,17 @@
event.preventDefault();
this.next();
break;
-
- default:
}
};
_proto._getItemIndex = function _getItemIndex(element) {
- this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
+ this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
return this._items.indexOf(element);
};
_proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
- var isNextDirection = direction === Direction.NEXT;
- var isPrevDirection = direction === Direction.PREV;
+ var isNextDirection = direction === DIRECTION_NEXT;
+ var isPrevDirection = direction === DIRECTION_PREV;
var activeIndex = this._getItemIndex(activeElement);
@@ -429,7 +371,7 @@
return activeElement;
}
- var delta = direction === Direction.PREV ? -1 : 1;
+ var delta = direction === DIRECTION_PREV ? -1 : 1;
var itemIndex = (activeIndex + delta) % this._items.length;
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
};
@@ -437,9 +379,9 @@
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
var targetIndex = this._getItemIndex(relatedTarget);
- var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
+ var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
- var slideEvent = $.Event(Event.SLIDE, {
+ var slideEvent = $.Event(EVENT_SLIDE, {
relatedTarget: relatedTarget,
direction: eventDirectionName,
from: fromIndex,
@@ -451,13 +393,13 @@
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) {
- var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
- $(indicators).removeClass(ClassName.ACTIVE);
+ var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE));
+ $(indicators).removeClass(CLASS_NAME_ACTIVE);
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
if (nextIndicator) {
- $(nextIndicator).addClass(ClassName.ACTIVE);
+ $(nextIndicator).addClass(CLASS_NAME_ACTIVE);
}
}
};
@@ -465,7 +407,7 @@
_proto._slide = function _slide(direction, element) {
var _this4 = this;
- var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
+ var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
var activeElementIndex = this._getItemIndex(activeElement);
@@ -478,17 +420,17 @@
var orderClassName;
var eventDirectionName;
- if (direction === Direction.NEXT) {
- directionalClassName = ClassName.LEFT;
- orderClassName = ClassName.NEXT;
- eventDirectionName = Direction.LEFT;
+ if (direction === DIRECTION_NEXT) {
+ directionalClassName = CLASS_NAME_LEFT;
+ orderClassName = CLASS_NAME_NEXT;
+ eventDirectionName = DIRECTION_LEFT;
} else {
- directionalClassName = ClassName.RIGHT;
- orderClassName = ClassName.PREV;
- eventDirectionName = Direction.RIGHT;
+ directionalClassName = CLASS_NAME_RIGHT;
+ orderClassName = CLASS_NAME_PREV;
+ eventDirectionName = DIRECTION_RIGHT;
}
- if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
+ if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE)) {
this._isSliding = false;
return;
}
@@ -512,14 +454,14 @@
this._setActiveIndicatorElement(nextElement);
- var slidEvent = $.Event(Event.SLID, {
+ var slidEvent = $.Event(EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex
});
- if ($(this._element).hasClass(ClassName.SLIDE)) {
+ if ($(this._element).hasClass(CLASS_NAME_SLIDE)) {
$(nextElement).addClass(orderClassName);
Util.reflow(nextElement);
$(activeElement).addClass(directionalClassName);
@@ -535,16 +477,16 @@
var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
$(activeElement).one(Util.TRANSITION_END, function () {
- $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
- $(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
+ $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE);
+ $(activeElement).removeClass(CLASS_NAME_ACTIVE + " " + orderClassName + " " + directionalClassName);
_this4._isSliding = false;
setTimeout(function () {
return $(_this4._element).trigger(slidEvent);
}, 0);
}).emulateTransitionEnd(transitionDuration);
} else {
- $(activeElement).removeClass(ClassName.ACTIVE);
- $(nextElement).addClass(ClassName.ACTIVE);
+ $(activeElement).removeClass(CLASS_NAME_ACTIVE);
+ $(nextElement).addClass(CLASS_NAME_ACTIVE);
this._isSliding = false;
$(this._element).trigger(slidEvent);
}
@@ -559,10 +501,10 @@
return this.each(function () {
var data = $(this).data(DATA_KEY);
- var _config = _objectSpread({}, Default, $(this).data());
+ var _config = _extends({}, Default, $(this).data());
if (typeof config === 'object') {
- _config = _objectSpread({}, _config, config);
+ _config = _extends({}, _config, config);
}
var action = typeof config === 'string' ? config : _config.slide;
@@ -596,11 +538,11 @@
var target = $(selector)[0];
- if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
+ if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) {
return;
}
- var config = _objectSpread({}, $(target).data(), $(this).data());
+ var config = _extends({}, $(target).data(), $(this).data());
var slideIndex = this.getAttribute('data-slide-to');
@@ -638,9 +580,9 @@
*/
- $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
- $(window).on(Event.LOAD_DATA_API, function () {
- var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
+ $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
+ $(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]);
@@ -664,5 +606,5 @@
return Carousel;
-}));
+})));
//# sourceMappingURL=carousel.js.map