diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-03-28 13:29:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 13:29:08 +0300 |
commit | 74afe149c48e8386c4de2bbd8fab36142227f755 (patch) | |
tree | cc1bddb6ace670de15e5fd58ecdf2fa856a05bf9 /dist/js/bootstrap.js | |
parent | f761d8e801ddb972ca2a694a27d16c0244a59d94 (diff) |
Dist (#29924)
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r-- | dist/js/bootstrap.js | 1256 |
1 files changed, 559 insertions, 697 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index fbaa847f72..2847673d48 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1,6 +1,6 @@ /*! * Bootstrap v4.3.1 (https://getbootstrap.com/) - * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ (function (global, factory) { @@ -9,7 +9,7 @@ (global = global || self, global.bootstrap = factory(global.Popper)); }(this, (function (Popper) { 'use strict'; - Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; + Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper; function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { @@ -61,13 +61,13 @@ var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { - ownKeys(source, true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys(source).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } @@ -93,6 +93,10 @@ var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) var toType = function toType(obj) { + if (obj === null || obj === undefined) { + return "" + obj; + } + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); }; /** @@ -160,9 +164,7 @@ }; var triggerTransitionEnd = function triggerTransitionEnd(element) { - var evt = document.createEvent('HTMLEvents'); - evt.initEvent(TRANSITION_END, true, true); - element.dispatchEvent(evt); + element.dispatchEvent(new Event(TRANSITION_END)); }; var isElement = function isElement(obj) { @@ -199,14 +201,6 @@ }); }; - var makeArray = function makeArray(nodeList) { - if (!nodeList) { - return []; - } - - return [].slice.call(nodeList); - }; - var isVisible = function isVisible(element) { if (!element) { return false; @@ -331,58 +325,11 @@ }; /* istanbul ignore file */ - var _Element$prototype = Element.prototype, - matches = _Element$prototype.matches, - closest = _Element$prototype.closest; var find = Element.prototype.querySelectorAll; - var findOne = Element.prototype.querySelector; - - var createCustomEvent = function createCustomEvent(eventName, params) { - var cEvent = new CustomEvent(eventName, params); - return cEvent; - }; - - if (typeof window.CustomEvent !== 'function') { - createCustomEvent = function createCustomEvent(eventName, params) { - params = params || { - bubbles: false, - cancelable: false, - detail: null - }; - var evt = document.createEvent('CustomEvent'); - evt.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail); - return evt; - }; - } - - var workingDefaultPrevented = function () { - var e = document.createEvent('CustomEvent'); - e.initEvent('Bootstrap', true, true); - e.preventDefault(); - return e.defaultPrevented; - }(); - - if (!workingDefaultPrevented) { - var origPreventDefault = Event.prototype.preventDefault; - - Event.prototype.preventDefault = function () { - if (!this.cancelable) { - return; - } - - origPreventDefault.call(this); - Object.defineProperty(this, 'defaultPrevented', { - get: function get() { - return true; - }, - configurable: true - }); - }; - } // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached - + var findOne = Element.prototype.querySelector; // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached var defaultPreventedPreservedOnDispatch = function () { - var e = createCustomEvent('Bootstrap', { + var e = new CustomEvent('Bootstrap', { cancelable: true }); var element = document.createElement('div'); @@ -394,26 +341,6 @@ return e.defaultPrevented; }(); - if (!matches) { - matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; - } - - if (!closest) { - closest = function closest(selector) { - var element = this; - - do { - if (matches.call(element, selector)) { - return element; - } - - element = element.parentElement || element.parentNode; - } while (element !== null && element.nodeType === 1); - - return null; - }; - } - var scopeSelectorRegex = /:scope\b/; var supportScopeQuery = function () { @@ -721,7 +648,7 @@ evt = document.createEvent('HTMLEvents'); evt.initEvent(typeEvent, bubbles, true); } else { - evt = createCustomEvent(event, { + evt = new CustomEvent(event, { bubbles: bubbles, cancelable: true }); @@ -776,15 +703,17 @@ var NODE_TEXT = 3; var SelectorEngine = { - matches: function matches$1(element, selector) { - return matches.call(element, selector); + matches: function matches(element, selector) { + return element.matches(selector); }, find: function find$1(selector, element) { + var _ref; + if (element === void 0) { element = document.documentElement; } - return find.call(element, selector); + return (_ref = []).concat.apply(_ref, find.call(element, selector)); }, findOne: function findOne$1(selector, element) { if (element === void 0) { @@ -794,11 +723,12 @@ return findOne.call(element, selector); }, children: function children(element, selector) { - var _this = this; + var _ref2; + + var children = (_ref2 = []).concat.apply(_ref2, element.children); - var children = makeArray(element.children); return children.filter(function (child) { - return _this.matches(child, selector); + return child.matches(selector); }); }, parents: function parents(element, selector) { @@ -815,22 +745,34 @@ return parents; }, - closest: function closest$1(element, selector) { - return closest.call(element, selector); + closest: function closest(element, selector) { + return element.closest(selector); }, prev: function prev(element, selector) { - var siblings = []; - var previous = element.previousSibling; + var previous = element.previousElementSibling; - while (previous && previous.nodeType === Node.ELEMENT_NODE && previous.nodeType !== NODE_TEXT) { - if (this.matches(previous, selector)) { - siblings.push(previous); + while (previous) { + if (previous.matches(selector)) { + return [previous]; } - previous = previous.previousSibling; + previous = previous.previousElementSibling; } - return siblings; + return []; + }, + next: function next(element, selector) { + var next = element.nextElementSibling; + + while (next) { + if (this.matches(next, selector)) { + return [next]; + } + + next = next.nextElementSibling; + } + + return []; } }; @@ -845,28 +787,20 @@ var DATA_KEY = 'bs.alert'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; - var Selector = { - DISMISS: '[data-dismiss="alert"]' - }; - var Event$1 = { - CLOSE: "close" + EVENT_KEY, - CLOSED: "closed" + EVENT_KEY, - CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY - }; - var ClassName = { - ALERT: 'alert', - FADE: 'fade', - SHOW: 'show' - }; + var SELECTOR_DISMISS = '[data-dismiss="alert"]'; + var EVENT_CLOSE = "close" + EVENT_KEY; + var EVENT_CLOSED = "closed" + EVENT_KEY; + var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY; + var CLASSNAME_ALERT = 'alert'; + var CLASSNAME_FADE = 'fade'; + var CLASSNAME_SHOW = 'show'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var Alert = - /*#__PURE__*/ - function () { + var Alert = /*#__PURE__*/function () { function Alert(element) { this._element = element; @@ -905,22 +839,22 @@ var parent = getElementFromSelector(element); if (!parent) { - parent = SelectorEngine.closest(element, "." + ClassName.ALERT); + parent = SelectorEngine.closest(element, "." + CLASSNAME_ALERT); } return parent; }; _proto._triggerCloseEvent = function _triggerCloseEvent(element) { - return EventHandler.trigger(element, Event$1.CLOSE); + return EventHandler.trigger(element, EVENT_CLOSE); }; _proto._removeElement = function _removeElement(element) { var _this = this; - element.classList.remove(ClassName.SHOW); + element.classList.remove(CLASSNAME_SHOW); - if (!element.classList.contains(ClassName.FADE)) { + if (!element.classList.contains(CLASSNAME_FADE)) { this._destroyElement(element); return; @@ -938,7 +872,7 @@ element.parentNode.removeChild(element); } - EventHandler.trigger(element, Event$1.CLOSED); + EventHandler.trigger(element, EVENT_CLOSED); } // Static ; @@ -986,7 +920,7 @@ */ - EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert.handleDismiss(new Alert())); + EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())); var $$1 = getjQuery(); /** * ------------------------------------------------------------------------ @@ -1019,32 +953,25 @@ var DATA_KEY$1 = 'bs.button'; var EVENT_KEY$1 = "." + DATA_KEY$1; var DATA_API_KEY$1 = '.data-api'; - var ClassName$1 = { - ACTIVE: 'active', - BUTTON: 'btn', - FOCUS: 'focus' - }; - var Selector$1 = { - DATA_TOGGLE_CARROT: '[data-toggle^="button"]', - DATA_TOGGLE: '[data-toggle="buttons"]', - INPUT: 'input:not([type="hidden"])', - ACTIVE: '.active', - BUTTON: '.btn' - }; - var Event$2 = { - CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1, - FOCUS_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1, - BLUR_DATA_API: "blur" + EVENT_KEY$1 + DATA_API_KEY$1 - }; + var CLASS_NAME_ACTIVE = 'active'; + var CLASS_NAME_BUTTON = 'btn'; + var CLASS_NAME_DISABLED = 'disabled'; + var CLASS_NAME_FOCUS = 'focus'; + var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; + var SELECTOR_DATA_TOGGLE = '[data-toggle="buttons"]'; + var SELECTOR_INPUT = 'input:not([type="hidden"])'; + var SELECTOR_ACTIVE = '.active'; + var SELECTOR_BUTTON = '.btn'; + var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1; + var EVENT_FOCUS_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1; + var EVENT_BLUR_DATA_API = "blur" + EVENT_KEY$1 + DATA_API_KEY$1; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var Button = - /*#__PURE__*/ - function () { + var Button = /*#__PURE__*/function () { function Button(element) { this._element = element; Data.setData(element, DATA_KEY$1, this); @@ -1057,28 +984,28 @@ _proto.toggle = function toggle() { var triggerChangeEvent = true; var addAriaPressed = true; - var rootElement = SelectorEngine.closest(this._element, Selector$1.DATA_TOGGLE); + var rootElement = SelectorEngine.closest(this._element, SELECTOR_DATA_TOGGLE); if (rootElement) { - var input = SelectorEngine.findOne(Selector$1.INPUT, this._element); + var input = SelectorEngine.findOne(SELECTOR_INPUT, this._element); if (input && input.type === 'radio') { - if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { + if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) { triggerChangeEvent = false; } else { - var activeElement = SelectorEngine.findOne(Selector$1.ACTIVE, rootElement); + var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE, rootElement); if (activeElement) { - activeElement.classList.remove(ClassName$1.ACTIVE); + activeElement.classList.remove(CLASS_NAME_ACTIVE); } } if (triggerChangeEvent) { - if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { + if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains(CLASS_NAME_DISABLED) || rootElement.classList.contains(CLASS_NAME_DISABLED)) { return; } - input.checked = !this._element.classList.contains(ClassName$1.ACTIVE); + input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE); EventHandler.trigger(input, 'change'); } @@ -1088,11 +1015,11 @@ } if (addAriaPressed) { - this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE)); + this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE)); } if (triggerChangeEvent) { - this._element.classList.toggle(ClassName$1.ACTIVE); + this._element.classList.toggle(CLASS_NAME_ACTIVE); } }; @@ -1136,12 +1063,12 @@ */ - EventHandler.on(document, Event$2.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { + EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) { event.preventDefault(); var button = event.target; - if (!button.classList.contains(ClassName$1.BUTTON)) { - button = SelectorEngine.closest(button, Selector$1.BUTTON); + if (!button.classList.contains(CLASS_NAME_BUTTON)) { + button = SelectorEngine.closest(button, SELECTOR_BUTTON); } var data = Data.getData(button, DATA_KEY$1); @@ -1152,18 +1079,18 @@ data.toggle(); }); - EventHandler.on(document, Event$2.FOCUS_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { - var button = SelectorEngine.closest(event.target, Selector$1.BUTTON); + EventHandler.on(document, EVENT_FOCUS_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { + var button = SelectorEngine.closest(event.target, SELECTOR_BUTTON); if (button) { - button.classList.add(ClassName$1.FOCUS); + button.classList.add(CLASS_NAME_FOCUS); } }); - EventHandler.on(document, Event$2.BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { - var button = SelectorEngine.closest(event.target, Selector$1.BUTTON); + EventHandler.on(document, EVENT_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { + var button = SelectorEngine.closest(event.target, SELECTOR_BUTTON); if (button) { - button.classList.remove(ClassName$1.FOCUS); + button.classList.remove(CLASS_NAME_FOCUS); } }); var $$2 = getjQuery(); @@ -1301,48 +1228,39 @@ wrap: 'boolean', touch: 'boolean' }; - var Direction = { - NEXT: 'next', - PREV: 'prev', - LEFT: 'left', - RIGHT: 'right' - }; - var Event$3 = { - SLIDE: "slide" + EVENT_KEY$2, - SLID: "slid" + EVENT_KEY$2, - KEYDOWN: "keydown" + EVENT_KEY$2, - MOUSEENTER: "mouseenter" + EVENT_KEY$2, - MOUSELEAVE: "mouseleave" + EVENT_KEY$2, - TOUCHSTART: "touchstart" + EVENT_KEY$2, - TOUCHMOVE: "touchmove" + EVENT_KEY$2, - TOUCHEND: "touchend" + EVENT_KEY$2, - POINTERDOWN: "pointerdown" + EVENT_KEY$2, - POINTERUP: "pointerup" + EVENT_KEY$2, - DRAG_START: "dragstart" + EVENT_KEY$2, - LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, - CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 - }; - var ClassName$2 = { - 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$2 = { - 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$2; + var EVENT_SLID = "slid" + EVENT_KEY$2; + var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2; + var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2; + var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2; + var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2; + var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2; + var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2; + var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2; + var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2; + var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2; + var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$2; + var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2; + var CLASS_NAME_CAROUSEL = 'carousel'; + var CLASS_NAME_ACTIVE$1 = '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$1 = '.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' @@ -1353,9 +1271,7 @@ * ------------------------------------------------------------------------ */ - var Carousel = - /*#__PURE__*/ - function () { + var Carousel = /*#__PURE__*/function () { function Carousel(element, config) { this._items = null; this._interval = null; @@ -1367,7 +1283,7 @@ this.touchDeltaX = 0; this._config = this._getConfig(config); this._element = element; - this._indicatorsElement = SelectorEngine.findOne(Selector$2.INDICATORS, this._element); + this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); @@ -1382,7 +1298,7 @@ // Public _proto.next = function next() { if (!this._isSliding) { - this._slide(Direction.NEXT); + this._slide(DIRECTION_NEXT); } }; @@ -1396,7 +1312,7 @@ _proto.prev = function prev() { if (!this._isSliding) { - this._slide(Direction.PREV); + this._slide(DIRECTION_PREV); } }; @@ -1405,7 +1321,7 @@ this._isPaused = true; } - if (SelectorEngine.findOne(Selector$2.NEXT_PREV, this._element)) { + if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) { triggerTransitionEnd(this._element); this.cycle(true); } @@ -1432,7 +1348,7 @@ _proto.to = function to(index) { var _this = this; - this._activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element); + this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); var activeIndex = this._getItemIndex(this._activeElement); @@ -1441,7 +1357,7 @@ } if (this._isSliding) { - EventHandler.one(this._element, Event$3.SLID, function () { + EventHandler.one(this._element, EVENT_SLID, function () { return _this.to(index); }); return; @@ -1453,7 +1369,7 @@ return; } - var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; + var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV; this._slide(direction, this._items[index]); }; @@ -1502,16 +1418,16 @@ var _this2 = this; if (this._config.keyboard) { - EventHandler.on(this._element, Event$3.KEYDOWN, function (event) { + EventHandler.on(this._element, EVENT_KEYDOWN, function (event) { return _this2._keydown(event); }); } if (this._config.pause === 'hover') { - EventHandler.on(this._element, Event$3.MOUSEENTER, function (event) { + EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) { return _this2.pause(event); }); - EventHandler.on(this._element, Event$3.MOUSELEAVE, function (event) { + EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) { return _this2.cycle(event); }); } @@ -1568,29 +1484,29 @@ } }; - makeArray(SelectorEngine.find(Selector$2.ITEM_IMG, this._element)).forEach(function (itemImg) { - EventHandler.on(itemImg, Event$3.DRAG_START, function (e) { + SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) { + EventHandler.on(itemImg, EVENT_DRAG_START, function (e) { return e.preventDefault(); }); }); if (this._pointerEvent) { - EventHandler.on(this._element, Event$3.POINTERDOWN, function (event) { + EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) { return start(event); }); - EventHandler.on(this._element, Event$3.POINTERUP, function (event) { + EventHandler.on(this._element, EVENT_POINTERUP, function (event) { return end(event); }); - this._element.classList.add(ClassName$2.POINTER_EVENT); + this._element.classList.add(CLASS_NAME_POINTER_EVENT); } else { - EventHandler.on(this._element, Event$3.TOUCHSTART, function (event) { + EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) { return start(event); }); - EventHandler.on(this._element, Event$3.TOUCHMOVE, function (event) { + EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) { return move(event); }); - EventHandler.on(this._element, Event$3.TOUCHEND, function (event) { + EventHandler.on(this._element, EVENT_TOUCHEND, function (event) { return end(event); }); } @@ -1615,13 +1531,13 @@ }; _proto._getItemIndex = function _getItemIndex(element) { - this._items = element && element.parentNode ? makeArray(SelectorEngine.find(Selector$2.ITEM, element.parentNode)) : []; + this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : []; 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); @@ -1632,7 +1548,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]; }; @@ -1640,9 +1556,9 @@ _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { var targetIndex = this._getItemIndex(relatedTarget); - var fromIndex = this._getItemIndex(SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element)); + var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)); - return EventHandler.trigger(this._element, Event$3.SLIDE, { + return EventHandler.trigger(this._element, EVENT_SLIDE, { relatedTarget: relatedTarget, direction: eventDirectionName, from: fromIndex, @@ -1652,16 +1568,16 @@ _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { if (this._indicatorsElement) { - var indicators = SelectorEngine.find(Selector$2.ACTIVE, this._indicatorsElement); + var indicators = SelectorEngine.find(SELECTOR_ACTIVE$1, this._indicatorsElement); for (var i = 0; i < indicators.length; i++) { - indicators[i].classList.remove(ClassName$2.ACTIVE); + indicators[i].classList.remove(CLASS_NAME_ACTIVE$1); } var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; if (nextIndicator) { - nextIndicator.classList.add(ClassName$2.ACTIVE); + nextIndicator.classList.add(CLASS_NAME_ACTIVE$1); } } }; @@ -1669,7 +1585,7 @@ _proto._slide = function _slide(direction, element) { var _this4 = this; - var activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element); + var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); var activeElementIndex = this._getItemIndex(activeElement); @@ -1682,17 +1598,17 @@ var orderClassName; var eventDirectionName; - if (direction === Direction.NEXT) { - directionalClassName = ClassName$2.LEFT; - orderClassName = ClassName$2.NEXT; - eventDirectionName = Direction.LEFT; + if (direction === DIRECTION_NEXT) { + directionalClassName = CLASS_NAME_LEFT; + orderClassName = CLASS_NAME_NEXT; + eventDirectionName = DIRECTION_LEFT; } else { - directionalClassName = ClassName$2.RIGHT; - orderClassName = ClassName$2.PREV; - eventDirectionName = Direction.RIGHT; + directionalClassName = CLASS_NAME_RIGHT; + orderClassName = CLASS_NAME_PREV; + eventDirectionName = DIRECTION_RIGHT; } - if (nextElement && nextElement.classList.contains(ClassName$2.ACTIVE)) { + if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$1)) { this._isSliding = false; return; } @@ -1716,7 +1632,7 @@ this._setActiveIndicatorElement(nextElement); - if (this._element.classList.contains(ClassName$2.SLIDE)) { + if (this._element.classList.contains(CLASS_NAME_SLIDE)) { nextElement.classList.add(orderClassName); reflow(nextElement); activeElement.classList.add(directionalClassName); @@ -1734,13 +1650,13 @@ EventHandler.one(activeElement, TRANSITION_END, function () { nextElement.classList.remove(directionalClassName); nextElement.classList.remove(orderClassName); - nextElement.classList.add(ClassName$2.ACTIVE); - activeElement.classList.remove(ClassName$2.ACTIVE); + nextElement.classList.add(CLASS_NAME_ACTIVE$1); + activeElement.classList.remove(CLASS_NAME_ACTIVE$1); activeElement.classList.remove(orderClassName); activeElement.classList.remove(directionalClassName); _this4._isSliding = false; setTimeout(function () { - EventHandler.trigger(_this4._element, Event$3.SLID, { + EventHandler.trigger(_this4._element, EVENT_SLID, { relatedTarget: nextElement, direction: eventDirectionName, from: activeElementIndex, @@ -1750,10 +1666,10 @@ }); emulateTransitionEnd(activeElement, transitionDuration); } else { - activeElement.classList.remove(ClassName$2.ACTIVE); - nextElement.classList.add(ClassName$2.ACTIVE); + activeElement.classList.remove(CLASS_NAME_ACTIVE$1); + nextElement.classList.add(CLASS_NAME_ACTIVE$1); this._isSliding = false; - EventHandler.trigger(this._element, Event$3.SLID, { + EventHandler.trigger(this._element, EVENT_SLID, { relatedTarget: nextElement, direction: eventDirectionName, from: activeElementIndex, @@ -1805,7 +1721,7 @@ Carousel.dataApiClickHandler = function dataApiClickHandler(event) { var target = getElementFromSelector(this); - if (!target || !target.classList.contains(ClassName$2.CAROUSEL)) { + if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { return; } @@ -1851,9 +1767,9 @@ */ - EventHandler.on(document, Event$3.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel.dataApiClickHandler); - EventHandler.on(window, Event$3.LOAD_DATA_API, function () { - var carousels = makeArray(SelectorEngine.find(Selector$2.DATA_RIDE)); + EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler); + EventHandler.on(window, EVENT_LOAD_DATA_API, function () { + var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); for (var i = 0, len = carousels.length; i < len; i++) { Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2)); @@ -1899,47 +1815,37 @@ toggle: 'boolean', parent: '(string|element)' }; - var Event$4 = { - SHOW: "show" + EVENT_KEY$3, - SHOWN: "shown" + EVENT_KEY$3, - HIDE: "hide" + EVENT_KEY$3, - HIDDEN: "hidden" + EVENT_KEY$3, - CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 - }; - var ClassName$3 = { - SHOW: 'show', - COLLAPSE: 'collapse', - COLLAPSING: 'collapsing', - COLLAPSED: 'collapsed' - }; - var Dimension = { - WIDTH: 'width', - HEIGHT: 'height' - }; - var Selector$3 = { - ACTIVES: '.show, .collapsing', - DATA_TOGGLE: '[data-toggle="collapse"]' - }; + var EVENT_SHOW = "show" + EVENT_KEY$3; + var EVENT_SHOWN = "shown" + EVENT_KEY$3; + var EVENT_HIDE = "hide" + EVENT_KEY$3; + var EVENT_HIDDEN = "hidden" + EVENT_KEY$3; + var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3; + var CLASS_NAME_SHOW = 'show'; + var CLASS_NAME_COLLAPSE = 'collapse'; + var CLASS_NAME_COLLAPSING = 'collapsing'; + var CLASS_NAME_COLLAPSED = 'collapsed'; + var WIDTH = 'width'; + var HEIGHT = 'height'; + var SELECTOR_ACTIVES = '.show, .collapsing'; + var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var Collapse = - /*#__PURE__*/ - function () { + var Collapse = /*#__PURE__*/function () { function Collapse(element, config) { this._isTransitioning = false; this._element = element; this._config = this._getConfig(config); - this._triggerArray = makeArray(SelectorEngine.find("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); - var toggleList = makeArray(SelectorEngine.find(Selector$3.DATA_TOGGLE)); + this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1 + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE$1 + "[data-target=\"#" + element.id + "\"]")); + var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1); for (var i = 0, len = toggleList.length; i < len; i++) { var elem = toggleList[i]; var selector = getSelectorFromElement(elem); - var filterElement = makeArray(SelectorEngine.find(selector)).filter(function (foundElem) { + var filterElement = SelectorEngine.find(selector).filter(function (foundElem) { return foundElem === element; }); @@ -1968,7 +1874,7 @@ // Public _proto.toggle = function toggle() { - if (this._element.classList.contains(ClassName$3.SHOW)) { + if (this._element.classList.contains(CLASS_NAME_SHOW)) { this.hide(); } else { this.show(); @@ -1978,7 +1884,7 @@ _proto.show = function show() { var _this = this; - if (this._isTransitioning || this._element.classList.contains(ClassName$3.SHOW)) { + if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) { return; } @@ -1986,12 +1892,12 @@ var activesData; if (this._parent) { - actives = makeArray(SelectorEngine.find(Selector$3.ACTIVES, this._parent)).filter(function (elem) { + actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) { if (typeof _this._config.parent === 'string') { return elem.getAttribute('data-parent') === _this._config.parent; } - return elem.classList.contains(ClassName$3.COLLAPSE); + return elem.classList.contains(CLASS_NAME_COLLAPSE); }); if (actives.length === 0) { @@ -2012,7 +1918,7 @@ } } - var startEvent = EventHandler.trigger(this._element, Event$4.SHOW); + var startEvent = EventHandler.trigger(this._element, EVENT_SHOW); if (startEvent.defaultPrevented) { return; @@ -2032,15 +1938,15 @@ var dimension = this._getDimension(); - this._element.classList.remove(ClassName$3.COLLAPSE); + this._element.classList.remove(CLASS_NAME_COLLAPSE); - this._element.classList.add(ClassName$3.COLLAPSING); + this._element.classList.add(CLASS_NAME_COLLAPSING); this._element.style[dimension] = 0; if (this._triggerArray.length) { this._triggerArray.forEach(function (element) { - element.classList.remove(ClassName$3.COLLAPSED); + element.classList.remove(CLASS_NAME_COLLAPSED); element.setAttribute('aria-expanded', true); }); } @@ -2048,17 +1954,17 @@ this.setTransitioning(true); var complete = function complete() { - _this._element.classList.remove(ClassName$3.COLLAPSING); + _this._element.classList.remove(CLASS_NAME_COLLAPSING); - _this._element.classList.add(ClassName$3.COLLAPSE); + _this._element.classList.add(CLASS_NAME_COLLAPSE); - _this._element.classList.add(ClassName$3.SHOW); + _this._element.classList.add(CLASS_NAME_SHOW); _this._element.style[dimension] = ''; _this.setTransitioning(false); - EventHandler.trigger(_this._element, Event$4.SHOWN); + EventHandler.trigger(_this._element, EVENT_SHOWN); }; var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); @@ -2072,11 +1978,11 @@ _proto.hide = function hide() { var _this2 = this; - if (this._isTransitioning || !this._element.classList.contains(ClassName$3.SHOW)) { + if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) { return; } - var startEvent = EventHandler.trigger(this._element, Event$4.HIDE); + var startEvent = EventHandler.trigger(this._element, EVENT_HIDE); if (startEvent.defaultPrevented) { return; @@ -2087,11 +1993,11 @@ this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; reflow(this._element); - this._element.classList.add(ClassName$3.COLLAPSING); + this._element.classList.add(CLASS_NAME_COLLAPSING); - this._element.classList.remove(ClassName$3.COLLAPSE); + this._element.classList.remove(CLASS_NAME_COLLAPSE); - this._element.classList.remove(ClassName$3.SHOW); + this._element.classList.remove(CLASS_NAME_SHOW); var triggerArrayLength = this._triggerArray.length; @@ -2100,8 +2006,8 @@ var trigger = this._triggerArray[i]; var elem = getElementFromSelector(trigger); - if (elem && !elem.classList.contains(ClassName$3.SHOW)) { - trigger.classList.add(ClassName$3.COLLAPSED); + if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) { + trigger.classList.add(CLASS_NAME_COLLAPSED); trigger.setAttribute('aria-expanded', false); } } @@ -2112,11 +2018,11 @@ var complete = function complete() { _this2.setTransitioning(false); - _this2._element.classList.remove(ClassName$3.COLLAPSING); + _this2._element.classList.remove(CLASS_NAME_COLLAPSING); - _this2._element.classList.add(ClassName$3.COLLAPSE); + _this2._element.classList.add(CLASS_NAME_COLLAPSE); - EventHandler.trigger(_this2._element, Event$4.HIDDEN); + EventHandler.trigger(_this2._element, EVENT_HIDDEN); }; this._element.style[dimension] = ''; @@ -2148,9 +2054,9 @@ }; _proto._getDimension = function _getDimension() { - var hasWidth = this._element.classList.contains(Dimension.WIDTH); + var hasWidth = this._element.classList.contains(WIDTH); - return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; + return hasWidth ? WIDTH : HEIGHT; }; _proto._getParent = function _getParent() { @@ -2167,8 +2073,8 @@ parent = SelectorEngine.findOne(parent); } - var selector = "[data-toggle=\"collapse\"][data-parent=\"" + parent + "\"]"; - makeArray(SelectorEngine.find(selector, parent)).forEach(function (element) { + var selector = SELECTOR_DATA_TOGGLE$1 + "[data-parent=\"" + parent + "\"]"; + SelectorEngine.find(selector, parent).forEach(function (element) { var selected = getElementFromSelector(element); _this3._addAriaAndCollapsedClass(selected, [element]); @@ -2178,14 +2084,14 @@ _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { if (element) { - var isOpen = element.classList.contains(ClassName$3.SHOW); + var isOpen = element.classList.contains(CLASS_NAME_SHOW); if (triggerArray.length) { triggerArray.forEach(function (elem) { if (isOpen) { - elem.classList.remove(ClassName$3.COLLAPSED); + elem.classList.remove(CLASS_NAME_COLLAPSED); } else { - elem.classList.add(ClassName$3.COLLAPSED); + elem.classList.add(CLASS_NAME_COLLAPSED); } elem.setAttribute('aria-expanded', isOpen); @@ -2248,7 +2154,7 @@ */ - EventHandler.on(document, Event$4.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) { + EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) { // preventDefault only for <a> elements (which change the URL) not inside the collapsible element if (event.target.tagName === 'A') { event.preventDefault(); @@ -2256,7 +2162,7 @@ var triggerData = Manipulator.getDataAttributes(this); var selector = getSelectorFromElement(this); - var selectorElements = makeArray(SelectorEngine.find(selector)); + var selectorElements = SelectorEngine.find(selector); selectorElements.forEach(function (element) { var data = Data.getData(element, DATA_KEY$3); var config; @@ -2321,42 +2227,33 @@ var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); - var Event$5 = { - HIDE: "hide" + EVENT_KEY$4, - HIDDEN: "hidden" + EVENT_KEY$4, - SHOW: "show" + EVENT_KEY$4, - SHOWN: "shown" + EVENT_KEY$4, - CLICK: "click" + EVENT_KEY$4, - CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, - KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, - KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 - }; - var ClassName$4 = { - DISABLED: 'disabled', - SHOW: 'show', - DROPUP: 'dropup', - DROPRIGHT: 'dropright', - DROPLEFT: 'dropleft', - MENURIGHT: 'dropdown-menu-right', - POSITION_STATIC: 'position-static' - }; - var Selector$4 = { - DATA_TOGGLE: '[data-toggle="dropdown"]', - FORM_CHILD: '.dropdown form', - MENU: '.dropdown-menu', - NAVBAR_NAV: '.navbar-nav', - VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' - }; - var AttachmentMap = { - TOP: 'top-start', - TOPEND: 'top-end', - BOTTOM: 'bottom-start', - BOTTOMEND: 'bottom-end', - RIGHT: 'right-start', - RIGHTEND: 'right-end', - LEFT: 'left-start', - LEFTEND: 'left-end' - }; + var EVENT_HIDE$1 = "hide" + EVENT_KEY$4; + var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4; + var EVENT_SHOW$1 = "show" + EVENT_KEY$4; + var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4; + var EVENT_CLICK = "click" + EVENT_KEY$4; + var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4; + var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4; + var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4; + var CLASS_NAME_DISABLED$1 = 'disabled'; + var CLASS_NAME_SHOW$1 = 'show'; + var CLASS_NAME_DROPUP = 'dropup'; + var CLASS_NAME_DROPRIGHT = 'dropright'; + var CLASS_NAME_DROPLEFT = 'dropleft'; + var CLASS_NAME_MENURIGHT = 'dropdown-menu-right'; + var CLASS_NAME_NAVBAR = 'navbar'; + var CLASS_NAME_POSITION_STATIC = 'position-static'; + var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]'; + var SELECTOR_FORM_CHILD = '.dropdown form'; + var SELECTOR_MENU = '.dropdown-menu'; + var SELECTOR_NAVBAR_NAV = '.navbar-nav'; + var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; + var PLACEMENT_TOP = 'top-start'; + var PLACEMENT_TOPEND = 'top-end'; + var PLACEMENT_BOTTOM = 'bottom-start'; + var PLACEMENT_BOTTOMEND = 'bottom-end'; + var PLACEMENT_RIGHT = 'right-start'; + var PLACEMENT_LEFT = 'left-start'; var Default$2 = { offset: 0, flip: true, @@ -2379,9 +2276,7 @@ * ------------------------------------------------------------------------ */ - var Dropdown = - /*#__PURE__*/ - function () { + var Dropdown = /*#__PURE__*/function () { function Dropdown(element, config) { this._element = element; this._popper = null; @@ -2399,11 +2294,11 @@ // Public _proto.toggle = function toggle() { - if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED)) { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1)) { return; } - var isActive = this._menu.classList.contains(ClassName$4.SHOW); + var isActive = this._element.classList.contains(CLASS_NAME_SHOW$1); Dropdown.clearMenus(); @@ -2415,7 +2310,7 @@ }; _proto.show = function show() { - if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || this._menu.classList.contains(ClassName$4.SHOW)) { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1) || this._menu.classList.contains(CLASS_NAME_SHOW$1)) { return; } @@ -2423,7 +2318,7 @@ var relatedTarget = { relatedTarget: this._element }; - var showEvent = EventHandler.trigger(parent, Event$5.SHOW, relatedTarget); + var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, relatedTarget); if (showEvent.defaultPrevented) { return; @@ -2451,7 +2346,7 @@ if (this._config.boundary !== 'scrollParent') { - parent.classList.add(ClassName$4.POSITION_STATIC); + parent.classList.add(CLASS_NAME_POSITION_STATIC); } this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); @@ -2461,8 +2356,10 @@ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html - if ('ontouchstart' in document.documentElement && !makeArray(SelectorEngine.closest(parent, Selector$4.NAVBAR_NAV)).length) { - makeArray(document.body.children).forEach(function (elem) { + if ('ontouchstart' in document.documentElement && !SelectorEngine.closest(parent, SELECTOR_NAVBAR_NAV)) { + var _ref; + + (_ref = []).concat.apply(_ref, document.body.children).forEach(function (elem) { return EventHandler.on(elem, 'mouseover', null, noop()); }); } @@ -2471,13 +2368,13 @@ this._element.setAttribute('aria-expanded', true); - Manipulator.toggleClass(this._menu, ClassName$4.SHOW); - Manipulator.toggleClass(parent, ClassName$4.SHOW); - EventHandler.trigger(parent, Event$5.SHOWN, relatedTarget); + Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1); + Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1); + EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget); }; _proto.hide = function hide() { - if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || !this._menu.classList.contains(ClassName$4.SHOW)) { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1) || !this._menu.classList.contains(CLASS_NAME_SHOW$1)) { return; } @@ -2485,7 +2382,7 @@ var relatedTarget = { relatedTarget: this._element }; - var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget); + var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget); if (hideEvent.defaultPrevented) { return; @@ -2495,9 +2392,9 @@ this._popper.destroy(); } - Manipulator.toggleClass(this._menu, ClassName$4.SHOW); - Manipulator.toggleClass(parent, ClassName$4.SHOW); - EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget); + Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1); + Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1); + EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget); }; _proto.dispose = function dispose() { @@ -2525,7 +2422,7 @@ _proto._addEventListeners = function _addEventListeners() { var _this = this; - EventHandler.on(this._element, Event$5.CLICK, function (event) { + EventHandler.on(this._element, EVENT_CLICK, function (event) { event.preventDefault(); event.stopPropagation(); @@ -2540,33 +2437,32 @@ }; _proto._getMenuElement = function _getMenuElement() { - var parent = Dropdown.getParentFromElement(this._element); - return SelectorEngine.findOne(Selector$4.MENU, parent); + return SelectorEngine.next(this._element, SELECTOR_MENU)[0]; }; _proto._getPlacement = function _getPlacement() { var parentDropdown = this._element.parentNode; - var placement = AttachmentMap.BOTTOM; // Handle dropup + var placement = PLACEMENT_BOTTOM; // Handle dropup - if (parentDropdown.classList.contains(ClassName$4.DROPUP)) { - placement = AttachmentMap.TOP; + if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { + placement = PLACEMENT_TOP; - if (this._menu.classList.contains(ClassName$4.MENURIGHT)) { - placement = AttachmentMap.TOPEND; + if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) { + placement = PLACEMENT_TOPEND; } - } else if (parentDropdown.classList.contains(ClassName$4.DROPRIGHT)) { - placement = AttachmentMap.RIGHT; - } else if (parentDropdown.classList.contains(ClassName$4.DROPLEFT)) { - placement = AttachmentMap.LEFT; - } else if (this._menu.classList.contains(ClassName$4.MENURIGHT)) { - placement = AttachmentMap.BOTTOMEND; + } else if (parentDropdown.classList.contains(CLASS_NAME_DROPRIGHT)) { + placement = PLACEMENT_RIGHT; + } else if (parentDropdown.classList.contains(CLASS_NAME_DROPLEFT)) { + placement = PLACEMENT_LEFT; + } else if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) { + placement = PLACEMENT_BOTTOMEND; } return placement; }; _proto._detectNavbar = function _detectNavbar() { - return Boolean(SelectorEngine.closest(this._element, '.navbar')); + return Boolean(SelectorEngine.closest(this._element, "." + CLASS_NAME_NAVBAR)); }; _proto._getOffset = function _getOffset() { @@ -2639,7 +2535,7 @@ return; } - var toggles = makeArray(SelectorEngine.find(Selector$4.DATA_TOGGLE)); + var toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$2); for (var i = 0, len = toggles.length; i < len; i++) { var parent = Dropdown.getParentFromElement(toggles[i]); @@ -2658,15 +2554,15 @@ var dropdownMenu = context._menu; - if (!parent.classList.contains(ClassName$4.SHOW)) { + if (!toggles[i].classList.contains(CLASS_NAME_SHOW$1)) { continue; } - if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && parent.contains(event.target)) { + if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && dropdownMenu.contains(event.target)) { continue; } - var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget); + var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget); if (hideEvent.defaultPrevented) { continue; @@ -2675,7 +2571,9 @@ if ('ontouchstart' in document.documentElement) { - makeArray(document.body.children).forEach(function (elem) { + var _ref2; + + (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) { return EventHandler.off(elem, 'mouseover', null, noop()); }); } @@ -2686,9 +2584,9 @@ context._popper.destroy(); } - dropdownMenu.classList.remove(ClassName$4.SHOW); - parent.classList.remove(ClassName$4.SHOW); - EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget); + dropdownMenu.classList.remove(CLASS_NAME_SHOW$1); + toggles[i].classList.remove(CLASS_NAME_SHOW$1); + EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget); } }; @@ -2704,36 +2602,39 @@ // - If key is other than escape // - If key is not up or down => not a dropdown command // - If trigger inside the menu => not a dropdown command - if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || SelectorEngine.closest(event.target, Selector$4.MENU)) : !REGEXP_KEYDOWN.test(event.which)) { + if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || SelectorEngine.closest(event.target, SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.which)) { return; } event.preventDefault(); event.stopPropagation(); - if (this.disabled || this.classList.contains(ClassName$4.DISABLED)) { + if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED$1)) { return; } var parent = Dropdown.getParentFromElement(this); - var isActive = parent.classList.contains(ClassName$4.SHOW); + var isActive = this.classList.contains(CLASS_NAME_SHOW$1); - if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { - if (event.which === ESCAPE_KEYCODE) { - SelectorEngine.findOne(Selector$4.DATA_TOGGLE, parent).focus(); - } + if (event.which === ESCAPE_KEYCODE) { + var button = this.matches(SELECTOR_DATA_TOGGLE$2) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$2)[0]; + button.focus(); + Dropdown.clearMenus(); + return; + } + if (!isActive || event.which === SPACE_KEYCODE) { Dropdown.clearMenus(); return; } - var items = makeArray(SelectorEngine.find(Selector$4.VISIBLE_ITEMS, parent)).filter(isVisible); + var items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible); if (!items.length) { return; } - var index = items.indexOf(event.target); + var index = items.indexOf(event.target) || 0; if (event.which === ARROW_UP_KEYCODE && index > 0) { // Up @@ -2745,10 +2646,6 @@ index++; } - if (index < 0) { - index = 0; - } - items[index].focus(); }; @@ -2782,16 +2679,16 @@ */ - EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown.dataApiKeydownHandler); - EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown.dataApiKeydownHandler); - EventHandler.on(document, Event$5.CLICK_DATA_API, Dropdown.clearMenus); - EventHandler.on(document, Event$5.KEYUP_DATA_API, Dropdown.clearMenus); - EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) { + EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown.dataApiKeydownHandler); + EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); + EventHandler.on(document, EVENT_CLICK_DATA_API$4, Dropdown.clearMenus); + EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); + EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) { event.preventDefault(); event.stopPropagation(); Dropdown.dropdownInterface(this, 'toggle'); }); - EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { + EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) { return e.stopPropagation(); }); var $$5 = getjQuery(); @@ -2840,50 +2737,42 @@ focus: 'boolean', show: 'boolean' }; - var Event$6 = { - HIDE: "hide" + EVENT_KEY$5, - HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5, - HIDDEN: "hidden" + EVENT_KEY$5, - SHOW: "show" + EVENT_KEY$5, - SHOWN: "shown" + EVENT_KEY$5, - FOCUSIN: "focusin" + EVENT_KEY$5, - RESIZE: "resize" + EVENT_KEY$5, - CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, - KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, - MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, - MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, - CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 - }; - var ClassName$5 = { - SCROLLABLE: 'modal-dialog-scrollable', - SCROLLBAR_MEASURER: 'modal-scrollbar-measure', - BACKDROP: 'modal-backdrop', - OPEN: 'modal-open', - FADE: 'fade', - SHOW: 'show', - STATIC: 'modal-static' - }; - var Selector$5 = { - DIALOG: '.modal-dialog', - MODAL_BODY: '.modal-body', - DATA_TOGGLE: '[data-toggle="modal"]', - DATA_DISMISS: '[data-dismiss="modal"]', - FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', - STICKY_CONTENT: '.sticky-top' - }; + var EVENT_HIDE$2 = "hide" + EVENT_KEY$5; + var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5; + var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5; + var EVENT_SHOW$2 = "show" + EVENT_KEY$5; + var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5; + var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5; + var EVENT_RESIZE = "resize" + EVENT_KEY$5; + var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5; + var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5; + var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5; + var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5; + var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5; + var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable'; + var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; + var CLASS_NAME_BACKDROP = 'modal-backdrop'; + var CLASS_NAME_OPEN = 'modal-open'; + var CLASS_NAME_FADE = 'fade'; + var CLASS_NAME_SHOW$2 = 'show'; + var CLASS_NAME_STATIC = 'modal-static'; + var SELECTOR_DIALOG = '.modal-dialog'; + var SELECTOR_MODAL_BODY = '.modal-body'; + var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]'; + var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]'; + var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; + var SELECTOR_STICKY_CONTENT = '.sticky-top'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var Modal = - /*#__PURE__*/ - function () { + var Modal = /*#__PURE__*/function () { function Modal(element, config) { this._config = this._getConfig(config); this._element = element; - this._dialog = SelectorEngine.findOne(Selector$5.DIALOG, element); + this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element); this._backdrop = null; this._isShown = false; this._isBodyOverflowing = false; @@ -2908,11 +2797,11 @@ return; } - if (this._element.classList.contains(ClassName$5.FADE)) { + if (this._element.classList.contains(CLASS_NAME_FADE)) { this._isTransitioning = true; } - var showEvent = EventHandler.trigger(this._element, Event$6.SHOW, { + var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, { relatedTarget: relatedTarget }); @@ -2932,11 +2821,11 @@ this._setResizeEvent(); - EventHandler.on(this._element, Event$6.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) { + EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) { return _this.hide(event); }); - EventHandler.on(this._dialog, Event$6.MOUSEDOWN_DISMISS, function () { - EventHandler.one(_this._element, Event$6.MOUSEUP_DISMISS, function (event) { + EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () { + EventHandler.one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) { if (event.target === _this._element) { _this._ignoreBackdropClick = true; } @@ -2959,7 +2848,7 @@ return; } - var hideEvent = EventHandler.trigger(this._element, Event$6.HIDE); + var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2); if (hideEvent.defaultPrevented) { return; @@ -2967,7 +2856,7 @@ this._isShown = false; - var transition = this._element.classList.contains(ClassName$5.FADE); + var transition = this._element.classList.contains(CLASS_NAME_FADE); if (transition) { this._isTransitioning = true; @@ -2977,12 +2866,12 @@ this._setResizeEvent(); - EventHandler.off(document, Event$6.FOCUSIN); + EventHandler.off(document, EVENT_FOCUSIN); - this._element.classList.remove(ClassName$5.SHOW); + this._element.classList.remove(CLASS_NAME_SHOW$2); - EventHandler.off(this._element, Event$6.CLICK_DISMISS); - EventHandler.off(this._dialog, Event$6.MOUSEDOWN_DISMISS); + EventHandler.off(this._element, EVENT_CLICK_DISMISS); + EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS); if (transition) { var transitionDuration = getTransitionDurationFromElement(this._element); @@ -3000,12 +2889,12 @@ return EventHandler.off(htmlElement, EVENT_KEY$5); }); /** - * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` + * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` * Do not move `document` in `htmlElements` array - * It will remove `Event.CLICK_DATA_API` event that should remain + * It will remove `EVENT_CLICK_DATA_API` event that should remain */ - EventHandler.off(document, Event$6.FOCUSIN); + EventHandler.off(document, EVENT_FOCUSIN); Data.removeData(this._element, DATA_KEY$5); this._config = null; this._element = null; @@ -3032,9 +2921,9 @@ _proto._showElement = function _showElement(relatedTarget) { var _this3 = this; - var transition = this._element.classList.contains(ClassName$5.FADE); + var transition = this._element.classList.contains(CLASS_NAME_FADE); - var modalBody = SelectorEngine.findOne(Selector$5.MODAL_BODY, this._dialog); + var modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { // Don't move modal's DOM position @@ -3047,7 +2936,7 @@ this._element.setAttribute('aria-modal', true); - if (this._dialog.classList.contains(ClassName$5.SCROLLABLE) && modalBody) { + if (this._dialog.classList.contains(CLASS_NAME_SCROLLABLE) && modalBody) { modalBody.scrollTop = 0; } else { this._element.scrollTop = 0; @@ -3057,7 +2946,7 @@ reflow(this._element); } - this._element.classList.add(ClassName$5.SHOW); + this._element.classList.add(CLASS_NAME_SHOW$2); if (this._config.focus) { this._enforceFocus(); @@ -3069,7 +2958,7 @@ } _this3._isTransitioning = false; - EventHandler.trigger(_this3._element, Event$6.SHOWN, { + EventHandler.trigger(_this3._element, EVENT_SHOWN$2, { relatedTarget: relatedTarget }); }; @@ -3086,9 +2975,9 @@ _proto._enforceFocus = function _enforceFocus() { var _this4 = this; - EventHandler.off(document, Event$6.FOCUSIN); // guard against infinite focus loop + EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop - EventHandler.on(document, Event$6.FOCUSIN, function (event) { + EventHandler.on(document, EVENT_FOCUSIN, function (event) { if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) { _this4._element.focus(); } @@ -3098,14 +2987,18 @@ _proto._setEscapeEvent = function _setEscapeEvent() { var _this5 = this; - if (this._isShown && this._config.keyboard) { - EventHandler.on(this._element, Event$6.KEYDOWN_DISMISS, function (event) { - if (event.which === ESCAPE_KEYCODE$1) { + if (this._isShown) { + EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) { + if (_this5._config.keyboard && event.which === ESCAPE_KEYCODE$1) { + event.preventDefault(); + + _this5.hide(); + } else if (!_this5._config.keyboard && event.which === ESCAPE_KEYCODE$1) { _this5._triggerBackdropTransition(); } }); } else { - EventHandler.off(this._element, Event$6.KEYDOWN_DISMISS); + EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS); } }; @@ -3113,11 +3006,11 @@ var _this6 = this; if (this._isShown) { - EventHandler.on(window, Event$6.RESIZE, function () { + EventHandler.on(window, EVENT_RESIZE, function () { return _this6._adjustDialog(); }); } else { - EventHandler.off(window, Event$6.RESIZE); + EventHandler.off(window, EVENT_RESIZE); } }; @@ -3133,13 +3026,13 @@ this._isTransitioning = false; this._showBackdrop(function () { - document.body.classList.remove(ClassName$5.OPEN); + document.body.classList.remove(CLASS_NAME_OPEN); _this7._resetAdjustments(); _this7._resetScrollbar(); - EventHandler.trigger(_this7._element, Event$6.HIDDEN); + EventHandler.trigger(_this7._element, EVENT_HIDDEN$2); }); }; @@ -3152,18 +3045,18 @@ _proto._showBackdrop = function _showBackdrop(callback) { var _this8 = this; - var animate = this._element.classList.contains(ClassName$5.FADE) ? ClassName$5.FADE : ''; + var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : ''; if (this._isShown && this._config.backdrop) { this._backdrop = document.createElement('div'); - this._backdrop.className = ClassName$5.BACKDROP; + this._backdrop.className = CLASS_NAME_BACKDROP; if (animate) { this._backdrop.classList.add(animate); } document.body.appendChild(this._backdrop); - EventHandler.on(this._element, Event$6.CLICK_DISMISS, function (event) { + EventHandler.on(this._element, EVENT_CLICK_DISMISS, function (event) { if (_this8._ignoreBackdropClick) { _this8._ignoreBackdropClick = false; return; @@ -3180,7 +3073,7 @@ reflow(this._backdrop); } - this._backdrop.classList.add(ClassName$5.SHOW); + this._backdrop.classList.add(CLASS_NAME_SHOW$2); if (!animate) { callback(); @@ -3191,7 +3084,7 @@ EventHandler.one(this._backdrop, TRANSITION_END, callback); emulateTransitionEnd(this._backdrop, backdropTransitionDuration); } else if (!this._isShown && this._backdrop) { - this._backdrop.classList.remove(ClassName$5.SHOW); + this._backdrop.classList.remove(CLASS_NAME_SHOW$2); var callbackRemove = function callbackRemove() { _this8._removeBackdrop(); @@ -3199,7 +3092,7 @@ callback(); }; - if (this._element.classList.contains(ClassName$5.FADE)) { + if (this._element.classList.contains(CLASS_NAME_FADE)) { var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove); @@ -3216,17 +3109,17 @@ var _this9 = this; if (this._config.backdrop === 'static') { - var hideEvent = EventHandler.trigger(this._element, Event$6.HIDE_PREVENTED); + var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); if (hideEvent.defaultPrevented) { return; } - this._element.classList.add(ClassName$5.STATIC); + this._element.classList.add(CLASS_NAME_STATIC); var modalTransitionDuration = getTransitionDurationFromElement(this._element); EventHandler.one(this._element, TRANSITION_END, function () { - _this9._element.classList.remove(ClassName$5.STATIC); + _this9._element.classList.remove(CLASS_NAME_STATIC); }); emulateTransitionEnd(this._element, modalTransitionDuration); @@ -3269,14 +3162,14 @@ // Note: DOMNode.style.paddingRight returns the actual value or '' if not set // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set // Adjust fixed content padding - makeArray(SelectorEngine.find(Selector$5.FIXED_CONTENT)).forEach(function (element) { + SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) { var actualPadding = element.style.paddingRight; var calculatedPadding = window.getComputedStyle(element)['padding-right']; Manipulator.setDataAttribute(element, 'padding-right', actualPadding); element.style.paddingRight = parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"; }); // Adjust sticky content margin - makeArray(SelectorEngine.find(Selector$5.STICKY_CONTENT)).forEach(function (element) { + SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) { var actualMargin = element.style.marginRight; var calculatedMargin = window.getComputedStyle(element)['margin-right']; Manipulator.setDataAttribute(element, 'margin-right', actualMargin); @@ -3289,12 +3182,12 @@ document.body.style.paddingRight = parseFloat(calculatedPadding) + this._scrollbarWidth + "px"; } - document.body.classList.add(ClassName$5.OPEN); + document.body.classList.add(CLASS_NAME_OPEN); }; _proto._resetScrollbar = function _resetScrollbar() { // Restore fixed content padding - makeArray(SelectorEngine.find(Selector$5.FIXED_CONTENT)).forEach(function (element) { + SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) { var padding = Manipulator.getDataAttribute(element, 'padding-right'); if (typeof padding !== 'undefined') { @@ -3303,7 +3196,7 @@ } }); // Restore sticky content and navbar-toggler margin - makeArray(SelectorEngine.find("" + Selector$5.STICKY_CONTENT)).forEach(function (element) { + SelectorEngine.find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) { var margin = Manipulator.getDataAttribute(element, 'margin-right'); if (typeof margin !== 'undefined') { @@ -3325,7 +3218,7 @@ _proto._getScrollbarWidth = function _getScrollbarWidth() { // thx d.walsh var scrollDiv = document.createElement('div'); - scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; + scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; document.body.appendChild(scrollDiv); var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); @@ -3380,7 +3273,7 @@ */ - EventHandler.on(document, Event$6.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { + EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) { var _this11 = this; var target = getElementFromSelector(this); @@ -3389,13 +3282,13 @@ event.preventDefault(); } - EventHandler.one(target, Event$6.SHOW, function (showEvent) { + EventHandler.one(target, EVENT_SHOW$2, function (showEvent) { if (showEvent.defaultPrevented) { // only register focus restorer if modal will actually get shown return; } - EventHandler.one(target, Event$6.HIDDEN, function () { + EventHandler.one(target, EVENT_HIDDEN$2, function () { if (isVisible(_this11)) { _this11.focus(); } @@ -3446,21 +3339,21 @@ * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts */ - var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; + var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi; /** * A pattern that matches safe data URLs. Only matches image, video and audio types. * * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts */ - var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; + var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) { var attrName = attr.nodeName.toLowerCase(); if (allowedAttributeList.indexOf(attrName) !== -1) { if (uriAttrs.indexOf(attrName) !== -1) { - return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); + return SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue); } return true; @@ -3470,8 +3363,8 @@ return attrRegex instanceof RegExp; }); // Check if a regular expression validates the attribute. - for (var i = 0, l = regExp.length; i < l; i++) { - if (attrName.match(regExp[i])) { + for (var i = 0, len = regExp.length; i < len; i++) { + if (regExp[i].test(attrName)) { return true; } } @@ -3498,7 +3391,7 @@ h5: [], h6: [], i: [], - img: ['src', 'alt', 'title', 'width', 'height'], + img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], li: [], ol: [], p: [], @@ -3513,6 +3406,8 @@ ul: [] }; function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { + var _ref; + if (!unsafeHtml.length) { return unsafeHtml; } @@ -3524,9 +3419,12 @@ var domParser = new window.DOMParser(); var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); var whitelistKeys = Object.keys(whiteList); - var elements = makeArray(createdDocument.body.querySelectorAll('*')); + + var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*')); var _loop = function _loop(i, len) { + var _ref2; + var el = elements[i]; var elName = el.nodeName.toLowerCase(); @@ -3535,7 +3433,8 @@ return "continue"; } - var attributeList = makeArray(el.attributes); + var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes); + var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); attributeList.forEach(function (attr) { if (!allowedAttribute(attr, whitelistedAttributes)) { @@ -3584,7 +3483,7 @@ whiteList: 'object', popperConfig: '(null|object)' }; - var AttachmentMap$1 = { + var AttachmentMap = { AUTO: 'auto', TOP: 'top', RIGHT: 'right', @@ -3609,11 +3508,7 @@ whiteList: DefaultWhitelist, popperConfig: null }; - var HoverState = { - SHOW: 'show', - OUT: 'out' - }; - var Event$7 = { + var Event$1 = { HIDE: "hide" + EVENT_KEY$6, HIDDEN: "hidden" + EVENT_KEY$6, SHOW: "show" + EVENT_KEY$6, @@ -3625,28 +3520,23 @@ MOUSEENTER: "mouseenter" + EVENT_KEY$6, MOUSELEAVE: "mouseleave" + EVENT_KEY$6 }; - var ClassName$6 = { - FADE: 'fade', - SHOW: 'show' - }; - var Selector$6 = { - TOOLTIP_INNER: '.tooltip-inner' - }; - var Trigger = { - HOVER: 'hover', - FOCUS: 'focus', - CLICK: 'click', - MANUAL: 'manual' - }; + var CLASS_NAME_FADE$1 = 'fade'; + var CLASS_NAME_MODAL = 'modal'; + var CLASS_NAME_SHOW$3 = 'show'; + var HOVER_STATE_SHOW = 'show'; + var HOVER_STATE_OUT = 'out'; + var SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; + var TRIGGER_HOVER = 'hover'; + var TRIGGER_FOCUS = 'focus'; + var TRIGGER_CLICK = 'click'; + var TRIGGER_MANUAL = 'manual'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var Tooltip = - /*#__PURE__*/ - function () { + var Tooltip = /*#__PURE__*/function () { function Tooltip(element, config) { if (typeof Popper === 'undefined') { throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)'); @@ -3706,7 +3596,7 @@ context._leave(null, context); } } else { - if (this.getTipElement().classList.contains(ClassName$6.SHOW)) { + if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) { this._leave(null, this); return; @@ -3720,7 +3610,7 @@ clearTimeout(this._timeout); Data.removeData(this.element, this.constructor.DATA_KEY); EventHandler.off(this.element, this.constructor.EVENT_KEY); - EventHandler.off(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler); + EventHandler.off(SelectorEngine.closest(this.element, "." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); if (this.tip) { this.tip.parentNode.removeChild(this.tip); @@ -3764,7 +3654,7 @@ this.setContent(); if (this.config.animation) { - tip.classList.add(ClassName$6.FADE); + tip.classList.add(CLASS_NAME_FADE$1); } var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; @@ -3783,13 +3673,15 @@ EventHandler.trigger(this.element, this.constructor.Event.INSERTED); this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment)); - tip.classList.add(ClassName$6.SHOW); // If this is a touch-enabled device we add extra + tip.classList.add(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we add extra // empty mouseover listeners to the body's immediate children; // only needed because of broken event delegation on iOS // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html if ('ontouchstart' in document.documentElement) { - makeArray(document.body.children).forEach(function (element) { + var _ref; + + (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) { EventHandler.on(element, 'mouseover', noop()); }); } @@ -3803,12 +3695,12 @@ _this._hoverState = null; EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN); - if (prevHoverState === HoverState.OUT) { + if (prevHoverState === HOVER_STATE_OUT) { _this._leave(null, _this); } }; - if (this.tip.classList.contains(ClassName$6.FADE)) { + if (this.tip.classList.contains(CLASS_NAME_FADE$1)) { var transitionDuration = getTransitionDurationFromElement(this.tip); EventHandler.one(this.tip, TRANSITION_END, complete); emulateTransitionEnd(this.tip, transitionDuration); @@ -3824,7 +3716,7 @@ var tip = this.getTipElement(); var complete = function complete() { - if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { + if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { tip.parentNode.removeChild(tip); } @@ -3843,20 +3735,22 @@ return; } - tip.classList.remove(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra + tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra // empty mouseover listeners we added for iOS support if ('ontouchstart' in document.documentElement) { - makeArray(document.body.children).forEach(function (element) { + var _ref2; + + (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) { return EventHandler.off(element, 'mouseover', noop); }); } - this._activeTrigger[Trigger.CLICK] = false; - this._activeTrigger[Trigger.FOCUS] = false; - this._activeTrigger[Trigger.HOVER] = false; + this._activeTrigger[TRIGGER_CLICK] = false; + this._activeTrigger[TRIGGER_FOCUS] = false; + this._activeTrigger[TRIGGER_HOVER] = false; - if (this.tip.classList.contains(ClassName$6.FADE)) { + if (this.tip.classList.contains(CLASS_NAME_FADE$1)) { var transitionDuration = getTransitionDurationFromElement(tip); EventHandler.one(tip, TRANSITION_END, complete); emulateTransitionEnd(tip, transitionDuration); @@ -3891,9 +3785,9 @@ _proto.setContent = function setContent() { var tip = this.getTipElement(); - this.setElementContent(SelectorEngine.findOne(Selector$6.TOOLTIP_INNER, tip), this.getTitle()); - tip.classList.remove(ClassName$6.FADE); - tip.classList.remove(ClassName$6.SHOW); + this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle()); + tip.classList.remove(CLASS_NAME_FADE$1); + tip.classList.remove(CLASS_NAME_SHOW$3); }; _proto.setElementContent = function setElementContent(element, content) { @@ -4004,7 +3898,7 @@ }; _proto._getAttachment = function _getAttachment(placement) { - return AttachmentMap$1[placement.toUpperCase()]; + return AttachmentMap[placement.toUpperCase()]; }; _proto._setListeners = function _setListeners() { @@ -4016,9 +3910,9 @@ EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) { return _this5.toggle(event); }); - } else if (trigger !== Trigger.MANUAL) { - var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; - var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; + } else if (trigger !== TRIGGER_MANUAL) { + var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; + var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) { return _this5._enter(event); }); @@ -4034,7 +3928,7 @@ } }; - EventHandler.on(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler); + EventHandler.on(SelectorEngine.closest(this.element, "." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); if (this.config.selector) { this.config = _objectSpread2({}, this.config, { @@ -4065,16 +3959,16 @@ } if (event) { - context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; + context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; } - if (context.getTipElement().classList.contains(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { - context._hoverState = HoverState.SHOW; + if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) { + context._hoverState = HOVER_STATE_SHOW; return; } clearTimeout(context._timeout); - context._hoverState = HoverState.SHOW; + context._hoverState = HOVER_STATE_SHOW; if (!context.config.delay || !context.config.delay.show) { context.show(); @@ -4082,7 +3976,7 @@ } context._timeout = setTimeout(function () { - if (context._hoverState === HoverState.SHOW) { + if (context._hoverState === HOVER_STATE_SHOW) { context.show(); } }, context.config.delay.show); @@ -4098,7 +3992,7 @@ } if (event) { - context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; + context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; } if (context._isWithActiveTrigger()) { @@ -4106,7 +4000,7 @@ } clearTimeout(context._timeout); - context._hoverState = HoverState.OUT; + context._hoverState = HOVER_STATE_OUT; if (!context.config.delay || !context.config.delay.hide) { context.hide(); @@ -4114,7 +4008,7 @@ } context._timeout = setTimeout(function () { - if (context._hoverState === HoverState.OUT) { + if (context._hoverState === HOVER_STATE_OUT) { context.hide(); } }, context.config.delay.hide); @@ -4186,7 +4080,7 @@ var tip = this.getTipElement(); var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX); - if (tabClass !== null && tabClass.length) { + if (tabClass !== null && tabClass.length > 0) { tabClass.map(function (token) { return token.trim(); }).forEach(function (tClass) { @@ -4212,7 +4106,7 @@ return; } - tip.classList.remove(ClassName$6.FADE); + tip.classList.remove(CLASS_NAME_FADE$1); this.config.animation = false; this.hide(); this.show(); @@ -4271,7 +4165,7 @@ }, { key: "Event", get: function get() { - return Event$7; + return Event$1; } }, { key: "EVENT_KEY", @@ -4333,15 +4227,7 @@ content: '(string|element|function)' }); - var ClassName$7 = { - FADE: 'fade', - SHOW: 'show' - }; - var Selector$7 = { - TITLE: '.popover-header', - CONTENT: '.popover-body' - }; - var Event$8 = { + var Event$2 = { HIDE: "hide" + EVENT_KEY$7, HIDDEN: "hidden" + EVENT_KEY$7, SHOW: "show" + EVENT_KEY$7, @@ -4353,15 +4239,17 @@ MOUSEENTER: "mouseenter" + EVENT_KEY$7, MOUSELEAVE: "mouseleave" + EVENT_KEY$7 }; + var CLASS_NAME_FADE$2 = 'fade'; + var CLASS_NAME_SHOW$4 = 'show'; + var SELECTOR_TITLE = '.popover-header'; + var SELECTOR_CONTENT = '.popover-body'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var Popover = - /*#__PURE__*/ - function (_Tooltip) { + var Popover = /*#__PURE__*/function (_Tooltip) { _inheritsLoose(Popover, _Tooltip); function Popover() { @@ -4378,7 +4266,7 @@ _proto.setContent = function setContent() { var tip = this.getTipElement(); // we use append for html objects to maintain js events - this.setElementContent(SelectorEngine.findOne(Selector$7.TITLE, tip), this.getTitle()); + this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle()); var content = this._getContent(); @@ -4386,9 +4274,9 @@ content = content.call(this.element); } - this.setElementContent(SelectorEngine.findOne(Selector$7.CONTENT, tip), content); - tip.classList.remove(ClassName$7.FADE); - tip.classList.remove(ClassName$7.SHOW); + this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content); + tip.classList.remove(CLASS_NAME_FADE$2); + tip.classList.remove(CLASS_NAME_SHOW$4); }; _proto._addAttachmentClass = function _addAttachmentClass(attachment) { @@ -4467,7 +4355,7 @@ }, { key: "Event", get: function get() { - return Event$8; + return Event$2; } }, { key: "EVENT_KEY", @@ -4525,49 +4413,39 @@ method: 'string', target: '(string|element)' }; - var Event$9 = { - ACTIVATE: "activate" + EVENT_KEY$8, - SCROLL: "scroll" + EVENT_KEY$8, - LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 - }; - var ClassName$8 = { - DROPDOWN_ITEM: 'dropdown-item', - ACTIVE: 'active' - }; - var Selector$8 = { - DATA_SPY: '[data-spy="scroll"]', - NAV_LIST_GROUP: '.nav, .list-group', - NAV_LINKS: '.nav-link', - NAV_ITEMS: '.nav-item', - LIST_ITEMS: '.list-group-item', - DROPDOWN: '.dropdown', - DROPDOWN_TOGGLE: '.dropdown-toggle' - }; - var OffsetMethod = { - OFFSET: 'offset', - POSITION: 'position' - }; + var EVENT_ACTIVATE = "activate" + EVENT_KEY$8; + var EVENT_SCROLL = "scroll" + EVENT_KEY$8; + var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$6; + var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; + var CLASS_NAME_ACTIVE$2 = 'active'; + var SELECTOR_DATA_SPY = '[data-spy="scroll"]'; + var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; + var SELECTOR_NAV_LINKS = '.nav-link'; + var SELECTOR_NAV_ITEMS = '.nav-item'; + var SELECTOR_LIST_ITEMS = '.list-group-item'; + var SELECTOR_DROPDOWN = '.dropdown'; + var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; + var METHOD_OFFSET = 'offset'; + var METHOD_POSITION = 'position'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var ScrollSpy = - /*#__PURE__*/ - function () { + var ScrollSpy = /*#__PURE__*/function () { function ScrollSpy(element, config) { var _this = this; this._element = element; this._scrollElement = element.tagName === 'BODY' ? window : element; this._config = this._getConfig(config); - this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " ." + ClassName$8.DROPDOWN_ITEM); + this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM); this._offsets = []; this._targets = []; this._activeTarget = null; this._scrollHeight = 0; - EventHandler.on(this._scrollElement, Event$9.SCROLL, function (event) { + EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) { return _this._process(event); }); this.refresh(); @@ -4584,13 +4462,13 @@ _proto.refresh = function refresh() { var _this2 = this; - var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; + var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; - var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; + var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; this._offsets = []; this._targets = []; this._scrollHeight = this._getScrollHeight(); - var targets = makeArray(SelectorEngine.find(this._selector)); + var targets = SelectorEngine.find(this._selector); targets.map(function (element) { var target; var targetSelector = getSelectorFromElement(element); @@ -4714,37 +4592,37 @@ var link = SelectorEngine.findOne(queries.join(',')); - if (link.classList.contains(ClassName$8.DROPDOWN_ITEM)) { - SelectorEngine.findOne(Selector$8.DROPDOWN_TOGGLE, SelectorEngine.closest(link, Selector$8.DROPDOWN)).classList.add(ClassName$8.ACTIVE); - link.classList.add(ClassName$8.ACTIVE); + if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { + SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, SelectorEngine.closest(link, SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$2); + link.classList.add(CLASS_NAME_ACTIVE$2); } else { // Set triggered link as active - link.classList.add(ClassName$8.ACTIVE); - SelectorEngine.parents(link, Selector$8.NAV_LIST_GROUP).forEach(function (listGroup) { + link.classList.add(CLASS_NAME_ACTIVE$2); + SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach(function (listGroup) { // Set triggered links parents as active // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor - SelectorEngine.prev(listGroup, Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).forEach(function (item) { - return item.classList.add(ClassName$8.ACTIVE); + SelectorEngine.prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) { + return item.classList.add(CLASS_NAME_ACTIVE$2); }); // Handle special case when .nav-link is inside .nav-item - SelectorEngine.prev(listGroup, Selector$8.NAV_ITEMS).forEach(function (navItem) { - SelectorEngine.children(navItem, Selector$8.NAV_LINKS).forEach(function (item) { - return item.classList.add(ClassName$8.ACTIVE); + SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) { + SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) { + return item.classList.add(CLASS_NAME_ACTIVE$2); }); }); }); } - EventHandler.trigger(this._scrollElement, Event$9.ACTIVATE, { + EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, { relatedTarget: target }); }; _proto._clear = function _clear() { - makeArray(SelectorEngine.find(this._selector)).filter(function (node) { - return node.classList.contains(ClassName$8.ACTIVE); + SelectorEngine.find(this._selector).filter(function (node) { + return node.classList.contains(CLASS_NAME_ACTIVE$2); }).forEach(function (node) { - return node.classList.remove(ClassName$8.ACTIVE); + return node.classList.remove(CLASS_NAME_ACTIVE$2); }); } // Static ; @@ -4794,8 +4672,8 @@ */ - EventHandler.on(window, Event$9.LOAD_DATA_API, function () { - makeArray(SelectorEngine.find(Selector$8.DATA_SPY)).forEach(function (spy) { + EventHandler.on(window, EVENT_LOAD_DATA_API$1, function () { + SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) { return new ScrollSpy(spy, Manipulator.getDataAttributes(spy)); }); }); @@ -4830,38 +4708,30 @@ var DATA_KEY$9 = 'bs.tab'; var EVENT_KEY$9 = "." + DATA_KEY$9; var DATA_API_KEY$7 = '.data-api'; - var Event$a = { - HIDE: "hide" + EVENT_KEY$9, - HIDDEN: "hidden" + EVENT_KEY$9, - SHOW: "show" + EVENT_KEY$9, - SHOWN: "shown" + EVENT_KEY$9, - CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7 - }; - var ClassName$9 = { - DROPDOWN_MENU: 'dropdown-menu', - ACTIVE: 'active', - DISABLED: 'disabled', - FADE: 'fade', - SHOW: 'show' - }; - var Selector$9 = { - DROPDOWN: '.dropdown', - NAV_LIST_GROUP: '.nav, .list-group', - ACTIVE: '.active', - ACTIVE_UL: ':scope > li > .active', - DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', - DROPDOWN_TOGGLE: '.dropdown-toggle', - DROPDOWN_ACTIVE_CHILD: ':scope > .dropdown-menu .active' - }; + var EVENT_HIDE$3 = "hide" + EVENT_KEY$9; + var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9; + var EVENT_SHOW$3 = "show" + EVENT_KEY$9; + var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9; + var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7; + var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; + var CLASS_NAME_ACTIVE$3 = 'active'; + var CLASS_NAME_DISABLED$2 = 'disabled'; + var CLASS_NAME_FADE$3 = 'fade'; + var CLASS_NAME_SHOW$5 = 'show'; + var SELECTOR_DROPDOWN$1 = '.dropdown'; + var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; + var SELECTOR_ACTIVE$2 = '.active'; + var SELECTOR_ACTIVE_UL = ':scope > li > .active'; + var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'; + var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; + var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var Tab = - /*#__PURE__*/ - function () { + var Tab = /*#__PURE__*/function () { function Tab(element) { this._element = element; Data.setData(this._element, DATA_KEY$9, this); @@ -4874,29 +4744,29 @@ _proto.show = function show() { var _this = this; - if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(ClassName$9.ACTIVE) || this._element.classList.contains(ClassName$9.DISABLED)) { + if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE$3) || this._element.classList.contains(CLASS_NAME_DISABLED$2)) { return; } var previous; var target = getElementFromSelector(this._element); - var listElement = SelectorEngine.closest(this._element, Selector$9.NAV_LIST_GROUP); + var listElement = SelectorEngine.closest(this._element, SELECTOR_NAV_LIST_GROUP$1); if (listElement) { - var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE; - previous = makeArray(SelectorEngine.find(itemSelector, listElement)); + var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2; + previous = SelectorEngine.find(itemSelector, listElement); previous = previous[previous.length - 1]; } var hideEvent = null; if (previous) { - hideEvent = EventHandler.trigger(previous, Event$a.HIDE, { + hideEvent = EventHandler.trigger(previous, EVENT_HIDE$3, { relatedTarget: this._element }); } - var showEvent = EventHandler.trigger(this._element, Event$a.SHOW, { + var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { relatedTarget: previous }); @@ -4907,10 +4777,10 @@ this._activate(this._element, listElement); var complete = function complete() { - EventHandler.trigger(previous, Event$a.HIDDEN, { + EventHandler.trigger(previous, EVENT_HIDDEN$3, { relatedTarget: _this._element }); - EventHandler.trigger(_this._element, Event$a.SHOWN, { + EventHandler.trigger(_this._element, EVENT_SHOWN$3, { relatedTarget: previous }); }; @@ -4931,9 +4801,9 @@ _proto._activate = function _activate(element, container, callback) { var _this2 = this; - var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(Selector$9.ACTIVE_UL, container) : SelectorEngine.children(container, Selector$9.ACTIVE); + var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE$2); var active = activeElements[0]; - var isTransitioning = callback && active && active.classList.contains(ClassName$9.FADE); + var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$3); var complete = function complete() { return _this2._transitionComplete(element, active, callback); @@ -4941,7 +4811,7 @@ if (active && isTransitioning) { var transitionDuration = getTransitionDurationFromElement(active); - active.classList.remove(ClassName$9.SHOW); + active.classList.remove(CLASS_NAME_SHOW$5); EventHandler.one(active, TRANSITION_END, complete); emulateTransitionEnd(active, transitionDuration); } else { @@ -4951,11 +4821,11 @@ _proto._transitionComplete = function _transitionComplete(element, active, callback) { if (active) { - active.classList.remove(ClassName$9.ACTIVE); - var dropdownChild = SelectorEngine.findOne(Selector$9.DROPDOWN_ACTIVE_CHILD, active.parentNode); + active.classList.remove(CLASS_NAME_ACTIVE$3); + var dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode); if (dropdownChild) { - dropdownChild.classList.remove(ClassName$9.ACTIVE); + dropdownChild.classList.remove(CLASS_NAME_ACTIVE$3); } if (active.getAttribute('role') === 'tab') { @@ -4963,7 +4833,7 @@ } } - element.classList.add(ClassName$9.ACTIVE); + element.classList.add(CLASS_NAME_ACTIVE$3); if (element.getAttribute('role') === 'tab') { element.setAttribute('aria-selected', true); @@ -4971,16 +4841,16 @@ reflow(element); - if (element.classList.contains(ClassName$9.FADE)) { - element.classList.add(ClassName$9.SHOW); + if (element.classList.contains(CLASS_NAME_FADE$3)) { + element.classList.add(CLASS_NAME_SHOW$5); } - if (element.parentNode && element.parentNode.classList.contains(ClassName$9.DROPDOWN_MENU)) { - var dropdownElement = SelectorEngine.closest(element, Selector$9.DROPDOWN); + if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { + var dropdownElement = SelectorEngine.closest(element, SELECTOR_DROPDOWN$1); if (dropdownElement) { - makeArray(SelectorEngine.find(Selector$9.DROPDOWN_TOGGLE)).forEach(function (dropdown) { - return dropdown.classList.add(ClassName$9.ACTIVE); + SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE$1).forEach(function (dropdown) { + return dropdown.classList.add(CLASS_NAME_ACTIVE$3); }); } @@ -5027,7 +4897,7 @@ */ - EventHandler.on(document, Event$a.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) { + EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) { event.preventDefault(); var data = Data.getData(this, DATA_KEY$9) || new Tab(this); data.show(); @@ -5063,19 +4933,15 @@ var VERSION$a = '4.3.1'; var DATA_KEY$a = 'bs.toast'; var EVENT_KEY$a = "." + DATA_KEY$a; - var Event$b = { - CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a, - HIDE: "hide" + EVENT_KEY$a, - HIDDEN: "hidden" + EVENT_KEY$a, - SHOW: "show" + EVENT_KEY$a, - SHOWN: "shown" + EVENT_KEY$a - }; - var ClassName$a = { - FADE: 'fade', - HIDE: 'hide', - SHOW: 'show', - SHOWING: 'showing' - }; + var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a; + var EVENT_HIDE$4 = "hide" + EVENT_KEY$a; + var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a; + var EVENT_SHOW$4 = "show" + EVENT_KEY$a; + var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a; + var CLASS_NAME_FADE$4 = 'fade'; + var CLASS_NAME_HIDE = 'hide'; + var CLASS_NAME_SHOW$6 = 'show'; + var CLASS_NAME_SHOWING = 'showing'; var DefaultType$7 = { animation: 'boolean', autohide: 'boolean', @@ -5086,18 +4952,14 @@ autohide: true, delay: 500 }; - var Selector$a = { - DATA_DISMISS: '[data-dismiss="toast"]' - }; + var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ - var Toast = - /*#__PURE__*/ - function () { + var Toast = /*#__PURE__*/function () { function Toast(element, config) { this._element = element; this._config = this._getConfig(config); @@ -5115,22 +4977,22 @@ _proto.show = function show() { var _this = this; - var showEvent = EventHandler.trigger(this._element, Event$b.SHOW); + var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4); if (showEvent.defaultPrevented) { return; } if (this._config.animation) { - this._element.classList.add(ClassName$a.FADE); + this._element.classList.add(CLASS_NAME_FADE$4); } var complete = function complete() { - _this._element.classList.remove(ClassName$a.SHOWING); + _this._element.classList.remove(CLASS_NAME_SHOWING); - _this._element.classList.add(ClassName$a.SHOW); + _this._element.classList.add(CLASS_NAME_SHOW$6); - EventHandler.trigger(_this._element, Event$b.SHOWN); + EventHandler.trigger(_this._element, EVENT_SHOWN$4); if (_this._config.autohide) { _this._timeout = setTimeout(function () { @@ -5139,11 +5001,11 @@ } }; - this._element.classList.remove(ClassName$a.HIDE); + this._element.classList.remove(CLASS_NAME_HIDE); reflow(this._element); - this._element.classList.add(ClassName$a.SHOWING); + this._element.classList.add(CLASS_NAME_SHOWING); if (this._config.animation) { var transitionDuration = getTransitionDurationFromElement(this._element); @@ -5157,23 +5019,23 @@ _proto.hide = function hide() { var _this2 = this; - if (!this._element.classList.contains(ClassName$a.SHOW)) { + if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) { return; } - var hideEvent = EventHandler.trigger(this._element, Event$b.HIDE); + var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4); if (hideEvent.defaultPrevented) { return; } var complete = function complete() { - _this2._element.classList.add(ClassName$a.HIDE); + _this2._element.classList.add(CLASS_NAME_HIDE); - EventHandler.trigger(_this2._element, Event$b.HIDDEN); + EventHandler.trigger(_this2._element, EVENT_HIDDEN$4); }; - this._element.classList.remove(ClassName$a.SHOW); + this._element.classList.remove(CLASS_NAME_SHOW$6); if (this._config.animation) { var transitionDuration = getTransitionDurationFromElement(this._element); @@ -5188,11 +5050,11 @@ clearTimeout(this._timeout); this._timeout = null; - if (this._element.classList.contains(ClassName$a.SHOW)) { - this._element.classList.remove(ClassName$a.SHOW); + if (this._element.classList.contains(CLASS_NAME_SHOW$6)) { + this._element.classList.remove(CLASS_NAME_SHOW$6); } - EventHandler.off(this._element, Event$b.CLICK_DISMISS); + EventHandler.off(this._element, EVENT_CLICK_DISMISS$1); Data.removeData(this._element, DATA_KEY$a); this._element = null; this._config = null; @@ -5208,7 +5070,7 @@ _proto._setListeners = function _setListeners() { var _this3 = this; - EventHandler.on(this._element, Event$b.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () { + EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () { return _this3.hide(); }); } // Static |