diff options
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r-- | dist/js/bootstrap.js | 1583 |
1 files changed, 831 insertions, 752 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index c2fbb790c4..fe7ce857f4 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1,30 +1,14 @@ /*! - * Bootstrap v4.0.0-beta (https://getbootstrap.com) - * Copyright 2011-2017 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - -if (typeof jQuery === 'undefined') { - throw new Error('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.') -} - -(function ($) { - var version = $.fn.jquery.split(' ')[0].split('.') - if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 4)) { - throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0') - } -})(jQuery); - -(function () { -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + * Bootstrap v4.0.0-beta (https://getbootstrap.com) + * Copyright 2011-2017 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ + +var bootstrap = (function (exports,$,Popper) { +'use strict'; -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +$ = $ && $.hasOwnProperty('default') ? $['default'] : $; +Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; /** * -------------------------------------------------------------------------- @@ -33,7 +17,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * -------------------------------------------------------------------------- */ -var Util = function ($) { +var Util = function () { /** * ------------------------------------------------------------------------ @@ -68,7 +52,7 @@ var Util = function ($) { if ($(event.target).is(this)) { return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params } - return undefined; + return undefined; // eslint-disable-line no-undefined } }; } @@ -81,7 +65,7 @@ var Util = function ($) { var el = document.createElement('bootstrap'); for (var name in TransitionEndEvent) { - if (el.style[name] !== undefined) { + if (typeof el.style[name] !== 'undefined') { return { end: TransitionEndEvent[name] }; @@ -143,7 +127,7 @@ var Util = function ($) { } try { - var $selector = $(selector); + var $selector = $(document).find(selector); return $selector.length > 0 ? selector : null; } catch (error) { return null; @@ -160,7 +144,7 @@ var Util = function ($) { }, typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { for (var property in configTypes) { - if (configTypes.hasOwnProperty(property)) { + if (Object.prototype.hasOwnProperty.call(configTypes, property)) { var expectedTypes = configTypes[property]; var value = config[property]; var valueType = value && isElement(value) ? 'element' : toType(value); @@ -178,6 +162,63 @@ var Util = function ($) { return Util; }(jQuery); +var babelHelpers = {}; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; +} : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; +}; + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +}; + +var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; +}; + +babelHelpers; + /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0-beta): alert.js @@ -185,7 +226,7 @@ var Util = function ($) { * -------------------------------------------------------------------------- */ -var Alert = function ($) { +var Alert = function () { /** * ------------------------------------------------------------------------ @@ -225,7 +266,7 @@ var Alert = function ($) { }; var Alert = function () { function Alert(element) { - _classCallCheck(this, Alert); + classCallCheck(this, Alert); this._element = element; } @@ -277,7 +318,7 @@ var Alert = function ($) { }; Alert.prototype._removeElement = function _removeElement(element) { - var _this2 = this; + var _this = this; $(element).removeClass(ClassName.SHOW); @@ -287,7 +328,7 @@ var Alert = function ($) { } $(element).one(Util.TRANSITION_END, function (event) { - return _this2._destroyElement(element, event); + return _this._destroyElement(element, event); }).emulateTransitionEnd(TRANSITION_DURATION); }; @@ -323,13 +364,12 @@ var Alert = function ($) { }; }; - _createClass(Alert, null, [{ + createClass(Alert, null, [{ key: 'VERSION', get: function get() { return VERSION; } }]); - return Alert; }(); @@ -364,7 +404,7 @@ var Alert = function ($) { * -------------------------------------------------------------------------- */ -var Button = function ($) { +var Button = function () { /** * ------------------------------------------------------------------------ @@ -406,7 +446,7 @@ var Button = function ($) { }; var Button = function () { function Button(element) { - _classCallCheck(this, Button); + classCallCheck(this, Button); this._element = element; } @@ -480,13 +520,12 @@ var Button = function ($) { }); }; - _createClass(Button, null, [{ + createClass(Button, null, [{ key: 'VERSION', get: function get() { return VERSION; } }]); - return Button; }(); @@ -534,7 +573,7 @@ var Button = function ($) { * -------------------------------------------------------------------------- */ -var Carousel = function ($) { +var Carousel = function () { /** * ------------------------------------------------------------------------ @@ -616,7 +655,7 @@ var Carousel = function ($) { }; var Carousel = function () { function Carousel(element, config) { - _classCallCheck(this, Carousel); + classCallCheck(this, Carousel); this._items = null; this._interval = null; @@ -688,7 +727,7 @@ var Carousel = function ($) { }; Carousel.prototype.to = function to(index) { - var _this3 = this; + var _this = this; this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; @@ -700,7 +739,7 @@ var Carousel = function ($) { if (this._isSliding) { $(this._element).one(Event.SLID, function () { - return _this3.to(index); + return _this.to(index); }); return; } @@ -739,19 +778,19 @@ var Carousel = function ($) { }; Carousel.prototype._addEventListeners = function _addEventListeners() { - var _this4 = this; + var _this2 = this; if (this._config.keyboard) { $(this._element).on(Event.KEYDOWN, function (event) { - return _this4._keydown(event); + return _this2._keydown(event); }); } if (this._config.pause === 'hover') { $(this._element).on(Event.MOUSEENTER, function (event) { - return _this4.pause(event); + return _this2.pause(event); }).on(Event.MOUSELEAVE, function (event) { - return _this4.cycle(event); + return _this2.cycle(event); }); if ('ontouchstart' in document.documentElement) { // if it's a touch-enabled device, mouseenter/leave are fired as @@ -762,13 +801,13 @@ var Carousel = function ($) { // is NOT fired) and after a timeout (to allow for mouse compatibility // events to fire) we explicitly restart cycling $(this._element).on(Event.TOUCHEND, function () { - _this4.pause(); - if (_this4.touchTimeout) { - clearTimeout(_this4.touchTimeout); + _this2.pause(); + if (_this2.touchTimeout) { + clearTimeout(_this2.touchTimeout); } - _this4.touchTimeout = setTimeout(function (event) { - return _this4.cycle(event); - }, TOUCHEVENT_COMPAT_WAIT + _this4._config.interval); + _this2.touchTimeout = setTimeout(function (event) { + return _this2.cycle(event); + }, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval); }); } } @@ -843,7 +882,7 @@ var Carousel = function ($) { }; Carousel.prototype._slide = function _slide(direction, element) { - var _this5 = this; + var _this3 = this; var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; var activeElementIndex = this._getItemIndex(activeElement); @@ -909,10 +948,10 @@ var Carousel = function ($) { $(activeElement).removeClass(ClassName.ACTIVE + ' ' + orderClassName + ' ' + directionalClassName); - _this5._isSliding = false; + _this3._isSliding = false; setTimeout(function () { - return $(_this5._element).trigger(slidEvent); + return $(_this3._element).trigger(slidEvent); }, 0); }).emulateTransitionEnd(TRANSITION_DURATION); } else { @@ -949,7 +988,7 @@ var Carousel = function ($) { if (typeof config === 'number') { data.to(config); } else if (typeof action === 'string') { - if (data[action] === undefined) { + if (typeof data[action] === 'undefined') { throw new Error('No method named "' + action + '"'); } data[action](); @@ -989,7 +1028,7 @@ var Carousel = function ($) { event.preventDefault(); }; - _createClass(Carousel, null, [{ + createClass(Carousel, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -1000,7 +1039,6 @@ var Carousel = function ($) { return Default; } }]); - return Carousel; }(); @@ -1042,7 +1080,7 @@ var Carousel = function ($) { * -------------------------------------------------------------------------- */ -var Collapse = function ($) { +var Collapse = function () { /** * ------------------------------------------------------------------------ @@ -1101,7 +1139,7 @@ var Collapse = function ($) { }; var Collapse = function () { function Collapse(element, config) { - _classCallCheck(this, Collapse); + classCallCheck(this, Collapse); this._isTransitioning = false; this._element = element; @@ -1140,7 +1178,7 @@ var Collapse = function ($) { }; Collapse.prototype.show = function show() { - var _this6 = this; + var _this = this; if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) { return; @@ -1189,13 +1227,13 @@ var Collapse = function ($) { this.setTransitioning(true); var complete = function complete() { - $(_this6._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW); + $(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW); - _this6._element.style[dimension] = ''; + _this._element.style[dimension] = ''; - _this6.setTransitioning(false); + _this.setTransitioning(false); - $(_this6._element).trigger(Event.SHOWN); + $(_this._element).trigger(Event.SHOWN); }; if (!Util.supportsTransitionEnd()) { @@ -1212,7 +1250,7 @@ var Collapse = function ($) { }; Collapse.prototype.hide = function hide() { - var _this7 = this; + var _this2 = this; if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) { return; @@ -1248,8 +1286,8 @@ var Collapse = function ($) { this.setTransitioning(true); var complete = function complete() { - _this7.setTransitioning(false); - $(_this7._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN); + _this2.setTransitioning(false); + $(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN); }; this._element.style[dimension] = ''; @@ -1291,13 +1329,13 @@ var Collapse = function ($) { }; Collapse.prototype._getParent = function _getParent() { - var _this8 = this; + var _this3 = this; var parent = $(this._config.parent)[0]; var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]'; $(parent).find(selector).each(function (i, element) { - _this8._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); + _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); }); return parent; @@ -1336,7 +1374,7 @@ var Collapse = function ($) { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error('No method named "' + config + '"'); } data[config](); @@ -1344,7 +1382,7 @@ var Collapse = function ($) { }); }; - _createClass(Collapse, null, [{ + createClass(Collapse, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -1355,7 +1393,6 @@ var Collapse = function ($) { return Default; } }]); - return Collapse; }(); @@ -1366,7 +1403,8 @@ var Collapse = function ($) { */ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { - if (!/input|textarea/i.test(event.target.tagName)) { + // preventDefault only for <a> elements (which change the URL) not inside the collapsible element + if (event.target.tagName === 'A' && !$.contains(this, event.target)) { event.preventDefault(); } @@ -1396,8 +1434,6 @@ var Collapse = function ($) { return Collapse; }(jQuery); -/* global Popper */ - /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0-beta): dropdown.js @@ -1405,7 +1441,7 @@ var Collapse = function ($) { * -------------------------------------------------------------------------- */ -var Dropdown = function ($) { +var Dropdown = function () { /** * Check for Popper dependency @@ -1489,7 +1525,7 @@ var Dropdown = function ($) { }; var Dropdown = function () { function Dropdown(element, config) { - _classCallCheck(this, Dropdown); + classCallCheck(this, Dropdown); this._element = element; this._popper = null; @@ -1574,18 +1610,18 @@ var Dropdown = function ($) { // private Dropdown.prototype._addEventListeners = function _addEventListeners() { - var _this9 = this; + var _this = this; $(this._element).on(Event.CLICK, function (event) { event.preventDefault(); event.stopPropagation(); - _this9.toggle(); + _this.toggle(); }); }; Dropdown.prototype._getConfig = function _getConfig(config) { var elementData = $(this._element).data(); - if (elementData.placement !== undefined) { + if (typeof elementData.placement !== 'undefined') { elementData.placement = AttachmentMap[elementData.placement.toUpperCase()]; } @@ -1658,7 +1694,7 @@ var Dropdown = function ($) { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error('No method named "' + config + '"'); } data[config](); @@ -1773,7 +1809,7 @@ var Dropdown = function ($) { items[index].focus(); }; - _createClass(Dropdown, null, [{ + createClass(Dropdown, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -1789,7 +1825,6 @@ var Dropdown = function ($) { return DefaultType; } }]); - return Dropdown; }(); @@ -1821,7 +1856,7 @@ var Dropdown = function ($) { }; return Dropdown; -}(jQuery); +}(jQuery, Popper); /** * -------------------------------------------------------------------------- @@ -1830,7 +1865,7 @@ var Dropdown = function ($) { * -------------------------------------------------------------------------- */ -var Modal = function ($) { +var Modal = function () { /** * ------------------------------------------------------------------------ @@ -1889,6 +1924,7 @@ var Modal = function ($) { DATA_TOGGLE: '[data-toggle="modal"]', DATA_DISMISS: '[data-dismiss="modal"]', FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', + STICKY_CONTENT: '.sticky-top', NAVBAR_TOGGLER: '.navbar-toggler' /** @@ -1900,7 +1936,7 @@ var Modal = function ($) { }; var Modal = function () { function Modal(element, config) { - _classCallCheck(this, Modal); + classCallCheck(this, Modal); this._config = this._getConfig(config); this._element = element; @@ -1922,7 +1958,7 @@ var Modal = function ($) { }; Modal.prototype.show = function show(relatedTarget) { - var _this10 = this; + var _this = this; if (this._isTransitioning) { return; @@ -1947,30 +1983,32 @@ var Modal = function ($) { this._checkScrollbar(); this._setScrollbar(); + this._adjustDialog(); + $(document.body).addClass(ClassName.OPEN); this._setEscapeEvent(); this._setResizeEvent(); $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) { - return _this10.hide(event); + return _this.hide(event); }); $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () { - $(_this10._element).one(Event.MOUSEUP_DISMISS, function (event) { - if ($(event.target).is(_this10._element)) { - _this10._ignoreBackdropClick = true; + $(_this._element).one(Event.MOUSEUP_DISMISS, function (event) { + if ($(event.target).is(_this._element)) { + _this._ignoreBackdropClick = true; } }); }); this._showBackdrop(function () { - return _this10._showElement(relatedTarget); + return _this._showElement(relatedTarget); }); }; Modal.prototype.hide = function hide(event) { - var _this11 = this; + var _this2 = this; if (event) { event.preventDefault(); @@ -2009,7 +2047,7 @@ var Modal = function ($) { if (transition) { $(this._element).one(Util.TRANSITION_END, function (event) { - return _this11._hideModal(event); + return _this2._hideModal(event); }).emulateTransitionEnd(TRANSITION_DURATION); } else { this._hideModal(); @@ -2044,7 +2082,7 @@ var Modal = function ($) { }; Modal.prototype._showElement = function _showElement(relatedTarget) { - var _this12 = this; + var _this3 = this; var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE); @@ -2072,11 +2110,11 @@ var Modal = function ($) { }); var transitionComplete = function transitionComplete() { - if (_this12._config.focus) { - _this12._element.focus(); + if (_this3._config.focus) { + _this3._element.focus(); } - _this12._isTransitioning = false; - $(_this12._element).trigger(shownEvent); + _this3._isTransitioning = false; + $(_this3._element).trigger(shownEvent); }; if (transition) { @@ -2087,24 +2125,24 @@ var Modal = function ($) { }; Modal.prototype._enforceFocus = function _enforceFocus() { - var _this13 = this; + var _this4 = this; $(document).off(Event.FOCUSIN) // guard against infinite focus loop .on(Event.FOCUSIN, function (event) { - if (document !== event.target && _this13._element !== event.target && !$(_this13._element).has(event.target).length) { - _this13._element.focus(); + if (document !== event.target && _this4._element !== event.target && !$(_this4._element).has(event.target).length) { + _this4._element.focus(); } }); }; Modal.prototype._setEscapeEvent = function _setEscapeEvent() { - var _this14 = this; + var _this5 = this; if (this._isShown && this._config.keyboard) { $(this._element).on(Event.KEYDOWN_DISMISS, function (event) { if (event.which === ESCAPE_KEYCODE) { event.preventDefault(); - _this14.hide(); + _this5.hide(); } }); } else if (!this._isShown) { @@ -2113,11 +2151,11 @@ var Modal = function ($) { }; Modal.prototype._setResizeEvent = function _setResizeEvent() { - var _this15 = this; + var _this6 = this; if (this._isShown) { $(window).on(Event.RESIZE, function (event) { - return _this15.handleUpdate(event); + return _this6.handleUpdate(event); }); } else { $(window).off(Event.RESIZE); @@ -2125,16 +2163,16 @@ var Modal = function ($) { }; Modal.prototype._hideModal = function _hideModal() { - var _this16 = this; + var _this7 = this; this._element.style.display = 'none'; this._element.setAttribute('aria-hidden', true); this._isTransitioning = false; this._showBackdrop(function () { $(document.body).removeClass(ClassName.OPEN); - _this16._resetAdjustments(); - _this16._resetScrollbar(); - $(_this16._element).trigger(Event.HIDDEN); + _this7._resetAdjustments(); + _this7._resetScrollbar(); + $(_this7._element).trigger(Event.HIDDEN); }); }; @@ -2146,7 +2184,7 @@ var Modal = function ($) { }; Modal.prototype._showBackdrop = function _showBackdrop(callback) { - var _this17 = this; + var _this8 = this; var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : ''; @@ -2163,17 +2201,17 @@ var Modal = function ($) { $(this._backdrop).appendTo(document.body); $(this._element).on(Event.CLICK_DISMISS, function (event) { - if (_this17._ignoreBackdropClick) { - _this17._ignoreBackdropClick = false; + if (_this8._ignoreBackdropClick) { + _this8._ignoreBackdropClick = false; return; } if (event.target !== event.currentTarget) { return; } - if (_this17._config.backdrop === 'static') { - _this17._element.focus(); + if (_this8._config.backdrop === 'static') { + _this8._element.focus(); } else { - _this17.hide(); + _this8.hide(); } }); @@ -2197,7 +2235,7 @@ var Modal = function ($) { $(this._backdrop).removeClass(ClassName.SHOW); var callbackRemove = function callbackRemove() { - _this17._removeBackdrop(); + _this8._removeBackdrop(); if (callback) { callback(); } @@ -2236,12 +2274,13 @@ var Modal = function ($) { }; Modal.prototype._checkScrollbar = function _checkScrollbar() { - this._isBodyOverflowing = document.body.clientWidth < window.innerWidth; + var rect = document.body.getBoundingClientRect(); + this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; this._scrollbarWidth = this._getScrollbarWidth(); }; Modal.prototype._setScrollbar = function _setScrollbar() { - var _this18 = this; + var _this9 = this; if (this._isBodyOverflowing) { // Note: DOMNode.style.paddingRight returns the actual value or '' if not set @@ -2251,14 +2290,21 @@ var Modal = function ($) { $(Selector.FIXED_CONTENT).each(function (index, element) { var actualPadding = $(element)[0].style.paddingRight; var calculatedPadding = $(element).css('padding-right'); - $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this18._scrollbarWidth + 'px'); + $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + 'px'); + }); + + // Adjust sticky content margin + $(Selector.STICKY_CONTENT).each(function (index, element) { + var actualMargin = $(element)[0].style.marginRight; + var calculatedMargin = $(element).css('margin-right'); + $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + 'px'); }); // Adjust navbar-toggler margin $(Selector.NAVBAR_TOGGLER).each(function (index, element) { var actualMargin = $(element)[0].style.marginRight; var calculatedMargin = $(element).css('margin-right'); - $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this18._scrollbarWidth + 'px'); + $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + 'px'); }); // Adjust body padding @@ -2277,8 +2323,8 @@ var Modal = function ($) { } }); - // Restore navbar-toggler margin - $(Selector.NAVBAR_TOGGLER).each(function (index, element) { + // Restore sticky content and navbar-toggler margin + $(Selector.STICKY_CONTENT + ', ' + Selector.NAVBAR_TOGGLER).each(function (index, element) { var margin = $(element).data('margin-right'); if (typeof margin !== 'undefined') { $(element).css('margin-right', margin).removeData('margin-right'); @@ -2315,7 +2361,7 @@ var Modal = function ($) { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error('No method named "' + config + '"'); } data[config](relatedTarget); @@ -2325,7 +2371,7 @@ var Modal = function ($) { }); }; - _createClass(Modal, null, [{ + createClass(Modal, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -2336,7 +2382,6 @@ var Modal = function ($) { return Default; } }]); - return Modal; }(); @@ -2347,7 +2392,7 @@ var Modal = function ($) { */ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { - var _this19 = this; + var _this10 = this; var target = void 0; var selector = Util.getSelectorFromElement(this); @@ -2369,8 +2414,8 @@ var Modal = function ($) { } $target.one(Event.HIDDEN, function () { - if ($(_this19).is(':visible')) { - _this19.focus(); + if ($(_this10).is(':visible')) { + _this10.focus(); } }); }); @@ -2396,587 +2441,12 @@ var Modal = function ($) { /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): scrollspy.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -var ScrollSpy = function ($) { - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME = 'scrollspy'; - var VERSION = '4.0.0-beta'; - var DATA_KEY = 'bs.scrollspy'; - var EVENT_KEY = '.' + DATA_KEY; - var DATA_API_KEY = '.data-api'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - - var Default = { - offset: 10, - method: 'auto', - target: '' - }; - - var DefaultType = { - offset: 'number', - method: 'string', - target: '(string|element)' - }; - - var Event = { - ACTIVATE: 'activate' + EVENT_KEY, - SCROLL: 'scroll' + EVENT_KEY, - LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY - }; - - var ClassName = { - DROPDOWN_ITEM: 'dropdown-item', - DROPDOWN_MENU: 'dropdown-menu', - ACTIVE: 'active' - }; - - var Selector = { - DATA_SPY: '[data-spy="scroll"]', - ACTIVE: '.active', - NAV_LIST_GROUP: '.nav, .list-group', - NAV_LINKS: '.nav-link', - LIST_ITEMS: '.list-group-item', - DROPDOWN: '.dropdown', - DROPDOWN_ITEMS: '.dropdown-item', - DROPDOWN_TOGGLE: '.dropdown-toggle' - }; - - var OffsetMethod = { - OFFSET: 'offset', - POSITION: 'position' - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - }; - var ScrollSpy = function () { - function ScrollSpy(element, config) { - var _this20 = this; - - _classCallCheck(this, ScrollSpy); - - this._element = element; - this._scrollElement = element.tagName === 'BODY' ? window : element; - this._config = this._getConfig(config); - this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS); - this._offsets = []; - this._targets = []; - this._activeTarget = null; - this._scrollHeight = 0; - - $(this._scrollElement).on(Event.SCROLL, function (event) { - return _this20._process(event); - }); - - this.refresh(); - this._process(); - } - - // getters - - // public - - ScrollSpy.prototype.refresh = function refresh() { - var _this21 = this; - - var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET; - - var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; - - var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; - - this._offsets = []; - this._targets = []; - - this._scrollHeight = this._getScrollHeight(); - - var targets = $.makeArray($(this._selector)); - - targets.map(function (element) { - var target = void 0; - var targetSelector = Util.getSelectorFromElement(element); - - if (targetSelector) { - target = $(targetSelector)[0]; - } - - if (target) { - var targetBCR = target.getBoundingClientRect(); - if (targetBCR.width || targetBCR.height) { - // todo (fat): remove sketch reliance on jQuery position/offset - return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; - } - } - return null; - }).filter(function (item) { - return item; - }).sort(function (a, b) { - return a[0] - b[0]; - }).forEach(function (item) { - _this21._offsets.push(item[0]); - _this21._targets.push(item[1]); - }); - }; - - ScrollSpy.prototype.dispose = function dispose() { - $.removeData(this._element, DATA_KEY); - $(this._scrollElement).off(EVENT_KEY); - - this._element = null; - this._scrollElement = null; - this._config = null; - this._selector = null; - this._offsets = null; - this._targets = null; - this._activeTarget = null; - this._scrollHeight = null; - }; - - // private - - ScrollSpy.prototype._getConfig = function _getConfig(config) { - config = $.extend({}, Default, config); - - if (typeof config.target !== 'string') { - var id = $(config.target).attr('id'); - if (!id) { - id = Util.getUID(NAME); - $(config.target).attr('id', id); - } - config.target = '#' + id; - } - - Util.typeCheckConfig(NAME, config, DefaultType); - - return config; - }; - - ScrollSpy.prototype._getScrollTop = function _getScrollTop() { - return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; - }; - - ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() { - return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); - }; - - ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() { - return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; - }; - - ScrollSpy.prototype._process = function _process() { - var scrollTop = this._getScrollTop() + this._config.offset; - var scrollHeight = this._getScrollHeight(); - var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); - - if (this._scrollHeight !== scrollHeight) { - this.refresh(); - } - - if (scrollTop >= maxScroll) { - var target = this._targets[this._targets.length - 1]; - - if (this._activeTarget !== target) { - this._activate(target); - } - return; - } - - if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { - this._activeTarget = null; - this._clear(); - return; - } - - for (var i = this._offsets.length; i--;) { - var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]); - - if (isActiveTarget) { - this._activate(this._targets[i]); - } - } - }; - - ScrollSpy.prototype._activate = function _activate(target) { - this._activeTarget = target; - - this._clear(); - - var queries = this._selector.split(','); - queries = queries.map(function (selector) { - return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]'); - }); - - var $link = $(queries.join(',')); - - if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { - $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); - $link.addClass(ClassName.ACTIVE); - } else { - // Set triggered link as active - $link.addClass(ClassName.ACTIVE); - // Set triggered links parents as active - // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor - $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); - } - - $(this._scrollElement).trigger(Event.ACTIVATE, { - relatedTarget: target - }); - }; - - ScrollSpy.prototype._clear = function _clear() { - $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); - }; - - // static - - ScrollSpy._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config; - - if (!data) { - data = new ScrollSpy(this, _config); - $(this).data(DATA_KEY, data); - } - - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config](); - } - }); - }; - - _createClass(ScrollSpy, null, [{ - key: 'VERSION', - get: function get() { - return VERSION; - } - }, { - key: 'Default', - get: function get() { - return Default; - } - }]); - - return ScrollSpy; - }(); - - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - $(window).on(Event.LOAD_DATA_API, function () { - var scrollSpys = $.makeArray($(Selector.DATA_SPY)); - - for (var i = scrollSpys.length; i--;) { - var $spy = $(scrollSpys[i]); - ScrollSpy._jQueryInterface.call($spy, $spy.data()); - } - }); - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = ScrollSpy._jQueryInterface; - $.fn[NAME].Constructor = ScrollSpy; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return ScrollSpy._jQueryInterface; - }; - - return ScrollSpy; -}(jQuery); - -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta): tab.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - -var Tab = function ($) { - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME = 'tab'; - var VERSION = '4.0.0-beta'; - var DATA_KEY = 'bs.tab'; - var EVENT_KEY = '.' + DATA_KEY; - var DATA_API_KEY = '.data-api'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var TRANSITION_DURATION = 150; - - var Event = { - HIDE: 'hide' + EVENT_KEY, - HIDDEN: 'hidden' + EVENT_KEY, - SHOW: 'show' + EVENT_KEY, - SHOWN: 'shown' + EVENT_KEY, - CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY - }; - - var ClassName = { - DROPDOWN_MENU: 'dropdown-menu', - ACTIVE: 'active', - DISABLED: 'disabled', - FADE: 'fade', - SHOW: 'show' - }; - - var Selector = { - DROPDOWN: '.dropdown', - NAV_LIST_GROUP: '.nav, .list-group', - ACTIVE: '.active', - ACTIVE_UL: '> li > .active', - DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', - DROPDOWN_TOGGLE: '.dropdown-toggle', - DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - }; - var Tab = function () { - function Tab(element) { - _classCallCheck(this, Tab); - - this._element = element; - } - - // getters - - // public - - Tab.prototype.show = function show() { - var _this22 = this; - - if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) { - return; - } - - var target = void 0; - var previous = void 0; - var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0]; - var selector = Util.getSelectorFromElement(this._element); - - if (listElement) { - var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE; - previous = $.makeArray($(listElement).find(itemSelector)); - previous = previous[previous.length - 1]; - } - - var hideEvent = $.Event(Event.HIDE, { - relatedTarget: this._element - }); - - var showEvent = $.Event(Event.SHOW, { - relatedTarget: previous - }); - - if (previous) { - $(previous).trigger(hideEvent); - } - - $(this._element).trigger(showEvent); - - if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { - return; - } - - if (selector) { - target = $(selector)[0]; - } - - this._activate(this._element, listElement); - - var complete = function complete() { - var hiddenEvent = $.Event(Event.HIDDEN, { - relatedTarget: _this22._element - }); - - var shownEvent = $.Event(Event.SHOWN, { - relatedTarget: previous - }); - - $(previous).trigger(hiddenEvent); - $(_this22._element).trigger(shownEvent); - }; - - if (target) { - this._activate(target, target.parentNode, complete); - } else { - complete(); - } - }; - - Tab.prototype.dispose = function dispose() { - $.removeData(this._element, DATA_KEY); - this._element = null; - }; - - // private - - Tab.prototype._activate = function _activate(element, container, callback) { - var _this23 = this; - - var activeElements = void 0; - if (container.nodeName === 'UL') { - activeElements = $(container).find(Selector.ACTIVE_UL); - } else { - activeElements = $(container).children(Selector.ACTIVE); - } - - var active = activeElements[0]; - var isTransitioning = callback && Util.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE); - - var complete = function complete() { - return _this23._transitionComplete(element, active, isTransitioning, callback); - }; - - if (active && isTransitioning) { - $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); - } else { - complete(); - } - - if (active) { - $(active).removeClass(ClassName.SHOW); - } - }; - - Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) { - if (active) { - $(active).removeClass(ClassName.ACTIVE); - - var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; - - if (dropdownChild) { - $(dropdownChild).removeClass(ClassName.ACTIVE); - } - - active.setAttribute('aria-expanded', false); - } - - $(element).addClass(ClassName.ACTIVE); - element.setAttribute('aria-expanded', true); - - if (isTransitioning) { - Util.reflow(element); - $(element).addClass(ClassName.SHOW); - } else { - $(element).removeClass(ClassName.FADE); - } - - if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { - - var dropdownElement = $(element).closest(Selector.DROPDOWN)[0]; - if (dropdownElement) { - $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); - } - - element.setAttribute('aria-expanded', true); - } - - if (callback) { - callback(); - } - }; - - // static - - Tab._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var $this = $(this); - var data = $this.data(DATA_KEY); - - if (!data) { - data = new Tab(this); - $this.data(DATA_KEY, data); - } - - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config](); - } - }); - }; - - _createClass(Tab, null, [{ - key: 'VERSION', - get: function get() { - return VERSION; - } - }]); - - return Tab; - }(); - - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { - event.preventDefault(); - Tab._jQueryInterface.call($(this), 'show'); - }); - - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Tab._jQueryInterface; - $.fn[NAME].Constructor = Tab; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return Tab._jQueryInterface; - }; - - return Tab; -}(jQuery); - -/* global Popper */ - -/** - * -------------------------------------------------------------------------- * Bootstrap (v4.0.0-beta): tooltip.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Tooltip = function ($) { +var Tooltip = function () { /** * Check for Popper dependency @@ -3081,7 +2551,8 @@ var Tooltip = function ($) { }; var Tooltip = function () { function Tooltip(element, config) { - _classCallCheck(this, Tooltip); + classCallCheck(this, Tooltip); + // private this._isEnabled = true; @@ -3115,6 +2586,10 @@ var Tooltip = function ($) { }; Tooltip.prototype.toggle = function toggle(event) { + if (!this._isEnabled) { + return; + } + if (event) { var dataKey = this.constructor.DATA_KEY; var context = $(event.currentTarget).data(dataKey); @@ -3161,15 +2636,15 @@ var Tooltip = function ($) { if (this._popper !== null) { this._popper.destroy(); } - this._popper = null; + this._popper = null; this.element = null; this.config = null; this.tip = null; }; Tooltip.prototype.show = function show() { - var _this24 = this; + var _this = this; if ($(this.element).css('display') === 'none') { throw new Error('Please use show on visible elements'); @@ -3227,11 +2702,11 @@ var Tooltip = function ($) { }, onCreate: function onCreate(data) { if (data.originalPlacement !== data.placement) { - _this24._handlePopperPlacementChange(data); + _this._handlePopperPlacementChange(data); } }, onUpdate: function onUpdate(data) { - _this24._handlePopperPlacementChange(data); + _this._handlePopperPlacementChange(data); } }); @@ -3246,16 +2721,16 @@ var Tooltip = function ($) { } var complete = function complete() { - if (_this24.config.animation) { - _this24._fixTransition(); + if (_this.config.animation) { + _this._fixTransition(); } - var prevHoverState = _this24._hoverState; - _this24._hoverState = null; + var prevHoverState = _this._hoverState; + _this._hoverState = null; - $(_this24.element).trigger(_this24.constructor.Event.SHOWN); + $(_this.element).trigger(_this.constructor.Event.SHOWN); if (prevHoverState === HoverState.OUT) { - _this24._leave(null, _this24); + _this._leave(null, _this); } }; @@ -3268,20 +2743,20 @@ var Tooltip = function ($) { }; Tooltip.prototype.hide = function hide(callback) { - var _this25 = this; + var _this2 = this; var tip = this.getTipElement(); var hideEvent = $.Event(this.constructor.Event.HIDE); var complete = function complete() { - if (_this25._hoverState !== HoverState.SHOW && tip.parentNode) { + if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { tip.parentNode.removeChild(tip); } - _this25._cleanTipClass(); - _this25.element.removeAttribute('aria-describedby'); - $(_this25.element).trigger(_this25.constructor.Event.HIDDEN); - if (_this25._popper !== null) { - _this25._popper.destroy(); + _this2._cleanTipClass(); + _this2.element.removeAttribute('aria-describedby'); + $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); + if (_this2._popper !== null) { + _this2._popper.destroy(); } if (callback) { @@ -3334,7 +2809,8 @@ var Tooltip = function ($) { }; Tooltip.prototype.getTipElement = function getTipElement() { - return this.tip = this.tip || $(this.config.template)[0]; + this.tip = this.tip || $(this.config.template)[0]; + return this.tip; }; Tooltip.prototype.setContent = function setContent() { @@ -3376,28 +2852,28 @@ var Tooltip = function ($) { }; Tooltip.prototype._setListeners = function _setListeners() { - var _this26 = this; + var _this3 = this; var triggers = this.config.trigger.split(' '); triggers.forEach(function (trigger) { if (trigger === 'click') { - $(_this26.element).on(_this26.constructor.Event.CLICK, _this26.config.selector, function (event) { - return _this26.toggle(event); + $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) { + return _this3.toggle(event); }); } else if (trigger !== Trigger.MANUAL) { - var eventIn = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSEENTER : _this26.constructor.Event.FOCUSIN; - var eventOut = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSELEAVE : _this26.constructor.Event.FOCUSOUT; + var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; + var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; - $(_this26.element).on(eventIn, _this26.config.selector, function (event) { - return _this26._enter(event); - }).on(eventOut, _this26.config.selector, function (event) { - return _this26._leave(event); + $(_this3.element).on(eventIn, _this3.config.selector, function (event) { + return _this3._enter(event); + }).on(eventOut, _this3.config.selector, function (event) { + return _this3._leave(event); }); } - $(_this26.element).closest('.modal').on('hide.bs.modal', function () { - return _this26.hide(); + $(_this3.element).closest('.modal').on('hide.bs.modal', function () { + return _this3.hide(); }); }); @@ -3578,7 +3054,7 @@ var Tooltip = function ($) { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error('No method named "' + config + '"'); } data[config](); @@ -3586,7 +3062,7 @@ var Tooltip = function ($) { }); }; - _createClass(Tooltip, null, [{ + createClass(Tooltip, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -3622,7 +3098,6 @@ var Tooltip = function ($) { return DefaultType; } }]); - return Tooltip; }(); @@ -3640,7 +3115,7 @@ var Tooltip = function ($) { }; return Tooltip; -}(jQuery); +}(jQuery, Popper); /** * -------------------------------------------------------------------------- @@ -3649,7 +3124,7 @@ var Tooltip = function ($) { * -------------------------------------------------------------------------- */ -var Popover = function ($) { +var Popover = function () { /** * ------------------------------------------------------------------------ @@ -3706,12 +3181,11 @@ var Popover = function ($) { }; var Popover = function (_Tooltip) { - _inherits(Popover, _Tooltip); + inherits(Popover, _Tooltip); function Popover() { - _classCallCheck(this, Popover); - - return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments)); + classCallCheck(this, Popover); + return possibleConstructorReturn(this, _Tooltip.apply(this, arguments)); } // overrides @@ -3725,7 +3199,8 @@ var Popover = function ($) { }; Popover.prototype.getTipElement = function getTipElement() { - return this.tip = this.tip || $(this.config.template)[0]; + this.tip = this.tip || $(this.config.template)[0]; + return this.tip; }; Popover.prototype.setContent = function setContent() { @@ -3769,7 +3244,7 @@ var Popover = function ($) { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error('No method named "' + config + '"'); } data[config](); @@ -3777,7 +3252,7 @@ var Popover = function ($) { }); }; - _createClass(Popover, null, [{ + createClass(Popover, null, [{ key: 'VERSION', @@ -3817,7 +3292,6 @@ var Popover = function ($) { return DefaultType; } }]); - return Popover; }(Tooltip); @@ -3837,5 +3311,610 @@ var Popover = function ($) { return Popover; }(jQuery); +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0-beta): scrollspy.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +var ScrollSpy = function () { + + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + var NAME = 'scrollspy'; + var VERSION = '4.0.0-beta'; + var DATA_KEY = 'bs.scrollspy'; + var EVENT_KEY = '.' + DATA_KEY; + var DATA_API_KEY = '.data-api'; + var JQUERY_NO_CONFLICT = $.fn[NAME]; + + var Default = { + offset: 10, + method: 'auto', + target: '' + }; + + var DefaultType = { + offset: 'number', + method: 'string', + target: '(string|element)' + }; + + var Event = { + ACTIVATE: 'activate' + EVENT_KEY, + SCROLL: 'scroll' + EVENT_KEY, + LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY + }; + + var ClassName = { + DROPDOWN_ITEM: 'dropdown-item', + DROPDOWN_MENU: 'dropdown-menu', + ACTIVE: 'active' + }; + + var Selector = { + DATA_SPY: '[data-spy="scroll"]', + ACTIVE: '.active', + NAV_LIST_GROUP: '.nav, .list-group', + NAV_LINKS: '.nav-link', + LIST_ITEMS: '.list-group-item', + DROPDOWN: '.dropdown', + DROPDOWN_ITEMS: '.dropdown-item', + DROPDOWN_TOGGLE: '.dropdown-toggle' + }; + + var OffsetMethod = { + OFFSET: 'offset', + POSITION: 'position' + + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + }; + var ScrollSpy = function () { + function ScrollSpy(element, config) { + var _this = this; + + classCallCheck(this, ScrollSpy); + + this._element = element; + this._scrollElement = element.tagName === 'BODY' ? window : element; + this._config = this._getConfig(config); + this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS); + this._offsets = []; + this._targets = []; + this._activeTarget = null; + this._scrollHeight = 0; + + $(this._scrollElement).on(Event.SCROLL, function (event) { + return _this._process(event); + }); + + this.refresh(); + this._process(); + } + + // getters + + // public + + ScrollSpy.prototype.refresh = function refresh() { + var _this2 = this; + + var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET; + + var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; + + var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; + + this._offsets = []; + this._targets = []; + + this._scrollHeight = this._getScrollHeight(); + + var targets = $.makeArray($(this._selector)); + + targets.map(function (element) { + var target = void 0; + var targetSelector = Util.getSelectorFromElement(element); + + if (targetSelector) { + target = $(targetSelector)[0]; + } + + if (target) { + var targetBCR = target.getBoundingClientRect(); + if (targetBCR.width || targetBCR.height) { + // todo (fat): remove sketch reliance on jQuery position/offset + return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; + } + } + return null; + }).filter(function (item) { + return item; + }).sort(function (a, b) { + return a[0] - b[0]; + }).forEach(function (item) { + _this2._offsets.push(item[0]); + _this2._targets.push(item[1]); + }); + }; + + ScrollSpy.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + $(this._scrollElement).off(EVENT_KEY); + + this._element = null; + this._scrollElement = null; + this._config = null; + this._selector = null; + this._offsets = null; + this._targets = null; + this._activeTarget = null; + this._scrollHeight = null; + }; + + // private + + ScrollSpy.prototype._getConfig = function _getConfig(config) { + config = $.extend({}, Default, config); + + if (typeof config.target !== 'string') { + var id = $(config.target).attr('id'); + if (!id) { + id = Util.getUID(NAME); + $(config.target).attr('id', id); + } + config.target = '#' + id; + } + + Util.typeCheckConfig(NAME, config, DefaultType); + + return config; + }; + + ScrollSpy.prototype._getScrollTop = function _getScrollTop() { + return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; + }; + + ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() { + return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); + }; + + ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() { + return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; + }; + + ScrollSpy.prototype._process = function _process() { + var scrollTop = this._getScrollTop() + this._config.offset; + var scrollHeight = this._getScrollHeight(); + var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); + + if (this._scrollHeight !== scrollHeight) { + this.refresh(); + } + + if (scrollTop >= maxScroll) { + var target = this._targets[this._targets.length - 1]; + + if (this._activeTarget !== target) { + this._activate(target); + } + return; + } + + if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { + this._activeTarget = null; + this._clear(); + return; + } + + for (var i = this._offsets.length; i--;) { + var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); + + if (isActiveTarget) { + this._activate(this._targets[i]); + } + } + }; + + ScrollSpy.prototype._activate = function _activate(target) { + this._activeTarget = target; + + this._clear(); + + var queries = this._selector.split(','); + // eslint-disable-next-line arrow-body-style + queries = queries.map(function (selector) { + return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]'); + }); + + var $link = $(queries.join(',')); + + if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { + $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); + $link.addClass(ClassName.ACTIVE); + } else { + // Set triggered link as active + $link.addClass(ClassName.ACTIVE); + // Set triggered links parents as active + // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor + $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); + } + + $(this._scrollElement).trigger(Event.ACTIVATE, { + relatedTarget: target + }); + }; + + ScrollSpy.prototype._clear = function _clear() { + $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); + }; + + // static + + ScrollSpy._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); + var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config; + + if (!data) { + data = new ScrollSpy(this, _config); + $(this).data(DATA_KEY, data); + } + + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new Error('No method named "' + config + '"'); + } + data[config](); + } + }); + }; + + createClass(ScrollSpy, null, [{ + key: 'VERSION', + get: function get() { + return VERSION; + } + }, { + key: 'Default', + get: function get() { + return Default; + } + }]); + return ScrollSpy; + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + + $(window).on(Event.LOAD_DATA_API, function () { + var scrollSpys = $.makeArray($(Selector.DATA_SPY)); + + for (var i = scrollSpys.length; i--;) { + var $spy = $(scrollSpys[i]); + ScrollSpy._jQueryInterface.call($spy, $spy.data()); + } + }); + + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ + + $.fn[NAME] = ScrollSpy._jQueryInterface; + $.fn[NAME].Constructor = ScrollSpy; + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return ScrollSpy._jQueryInterface; + }; + + return ScrollSpy; +}(jQuery); + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0-beta): tab.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +var Tab = function () { + + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + var NAME = 'tab'; + var VERSION = '4.0.0-beta'; + var DATA_KEY = 'bs.tab'; + var EVENT_KEY = '.' + DATA_KEY; + var DATA_API_KEY = '.data-api'; + var JQUERY_NO_CONFLICT = $.fn[NAME]; + var TRANSITION_DURATION = 150; + + var Event = { + HIDE: 'hide' + EVENT_KEY, + HIDDEN: 'hidden' + EVENT_KEY, + SHOW: 'show' + EVENT_KEY, + SHOWN: 'shown' + EVENT_KEY, + CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY + }; + + var ClassName = { + DROPDOWN_MENU: 'dropdown-menu', + ACTIVE: 'active', + DISABLED: 'disabled', + FADE: 'fade', + SHOW: 'show' + }; + + var Selector = { + DROPDOWN: '.dropdown', + NAV_LIST_GROUP: '.nav, .list-group', + ACTIVE: '.active', + ACTIVE_UL: '> li > .active', + DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', + DROPDOWN_TOGGLE: '.dropdown-toggle', + DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' + + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + }; + var Tab = function () { + function Tab(element) { + classCallCheck(this, Tab); + + this._element = element; + } + + // getters + + // public + + Tab.prototype.show = function show() { + var _this = this; + + if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) { + return; + } + + var target = void 0; + var previous = void 0; + var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0]; + var selector = Util.getSelectorFromElement(this._element); + + if (listElement) { + var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE; + previous = $.makeArray($(listElement).find(itemSelector)); + previous = previous[previous.length - 1]; + } + + var hideEvent = $.Event(Event.HIDE, { + relatedTarget: this._element + }); + + var showEvent = $.Event(Event.SHOW, { + relatedTarget: previous + }); + + if (previous) { + $(previous).trigger(hideEvent); + } + + $(this._element).trigger(showEvent); + + if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { + return; + } + + if (selector) { + target = $(selector)[0]; + } + + this._activate(this._element, listElement); + + var complete = function complete() { + var hiddenEvent = $.Event(Event.HIDDEN, { + relatedTarget: _this._element + }); + + var shownEvent = $.Event(Event.SHOWN, { + relatedTarget: previous + }); + + $(previous).trigger(hiddenEvent); + $(_this._element).trigger(shownEvent); + }; + + if (target) { + this._activate(target, target.parentNode, complete); + } else { + complete(); + } + }; + + Tab.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + this._element = null; + }; + + // private + + Tab.prototype._activate = function _activate(element, container, callback) { + var _this2 = this; + + var activeElements = void 0; + if (container.nodeName === 'UL') { + activeElements = $(container).find(Selector.ACTIVE_UL); + } else { + activeElements = $(container).children(Selector.ACTIVE); + } + + var active = activeElements[0]; + var isTransitioning = callback && Util.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE); + + var complete = function complete() { + return _this2._transitionComplete(element, active, isTransitioning, callback); + }; + + if (active && isTransitioning) { + $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); + } else { + complete(); + } + + if (active) { + $(active).removeClass(ClassName.SHOW); + } + }; + + Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) { + if (active) { + $(active).removeClass(ClassName.ACTIVE); + + var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; + + if (dropdownChild) { + $(dropdownChild).removeClass(ClassName.ACTIVE); + } + + active.setAttribute('aria-expanded', false); + } + + $(element).addClass(ClassName.ACTIVE); + element.setAttribute('aria-expanded', true); + + if (isTransitioning) { + Util.reflow(element); + $(element).addClass(ClassName.SHOW); + } else { + $(element).removeClass(ClassName.FADE); + } + + if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { + + var dropdownElement = $(element).closest(Selector.DROPDOWN)[0]; + if (dropdownElement) { + $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); + } + + element.setAttribute('aria-expanded', true); + } + + if (callback) { + callback(); + } + }; + + // static + + Tab._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var $this = $(this); + var data = $this.data(DATA_KEY); + + if (!data) { + data = new Tab(this); + $this.data(DATA_KEY, data); + } + + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new Error('No method named "' + config + '"'); + } + data[config](); + } + }); + }; + + createClass(Tab, null, [{ + key: 'VERSION', + get: function get() { + return VERSION; + } + }]); + return Tab; + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + + $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { + event.preventDefault(); + Tab._jQueryInterface.call($(this), 'show'); + }); + + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ + + $.fn[NAME] = Tab._jQueryInterface; + $.fn[NAME].Constructor = Tab; + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Tab._jQueryInterface; + }; + + return Tab; +}(jQuery); + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0-alpha.6): index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +(function () { + if (typeof jQuery === 'undefined') { + throw new Error('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); + } + + var version = $.fn.jquery.split(' ')[0].split('.'); + var min = 3; + var max = 4; + if (version[0] < min || version[0] >= max) { + throw new Error('Bootstrap\'s JavaScript requires at least jQuery v3.0.0 but less than v4.0.0'); + } +})(jQuery); -})();
\ No newline at end of file +exports.Util = Util; +exports.Alert = Alert; +exports.Button = Button; +exports.Carousel = Carousel; +exports.Collapse = Collapse; +exports.Dropdown = Dropdown; +exports.Modal = Modal; +exports.Popover = Popover; +exports.Scrollspy = ScrollSpy; +exports.Tab = Tab; +exports.Tooltip = Tooltip; + +return exports; + +}({},$,Popper)); |