diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/tooltip.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/tooltip.js | 174 |
1 files changed, 98 insertions, 76 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/tooltip.js b/vendor/twbs/bootstrap/js/dist/tooltip.js index 2351fe6e0..5608e9531 100644 --- a/vendor/twbs/bootstrap/js/dist/tooltip.js +++ b/vendor/twbs/bootstrap/js/dist/tooltip.js @@ -1,5 +1,5 @@ /*! - * Bootstrap tooltip.js v4.3.1 (https://getbootstrap.com/) + * Bootstrap tooltip.js v4.4.1 (https://getbootstrap.com/) * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ @@ -7,7 +7,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('popper.js'), require('./util.js')) : typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util.js'], factory) : (global = global || self, global.Tooltip = factory(global.jQuery, global.Popper, global.Util)); -}(this, function ($, Popper, Util) { 'use strict'; +}(this, (function ($, Popper, Util) { 'use strict'; $ = $ && $.hasOwnProperty('default') ? $['default'] : $; Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; @@ -44,20 +44,35 @@ return obj; } - function _objectSpread(target) { + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); } - - ownKeys.forEach(function (key) { - _defineProperty(target, key, source[key]); - }); } return target; @@ -65,7 +80,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v4.3.1): tools/sanitizer.js + * Bootstrap (v4.4.1): tools/sanitizer.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -103,13 +118,13 @@ strong: [], u: [], ul: [] - /** - * A pattern that recognizes a commonly useful subset of URLs that are safe. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - }; + /** + * A pattern that recognizes a commonly useful subset of URLs that are safe. + * + * 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; /** * A pattern that matches safe data URLs. Only matches image, video and audio types. @@ -176,7 +191,7 @@ }; for (var i = 0, len = elements.length; i < len; i++) { - var _ret = _loop(i, len); + var _ret = _loop(i); if (_ret === "continue") continue; } @@ -191,7 +206,7 @@ */ var NAME = 'tooltip'; - var VERSION = '4.3.1'; + var VERSION = '4.4.1'; var DATA_KEY = 'bs.tooltip'; var EVENT_KEY = "." + DATA_KEY; var JQUERY_NO_CONFLICT = $.fn[NAME]; @@ -213,7 +228,8 @@ boundary: '(string|element)', sanitize: 'boolean', sanitizeFn: '(null|function)', - whiteList: 'object' + whiteList: 'object', + popperConfig: '(null|object)' }; var AttachmentMap = { AUTO: 'auto', @@ -237,7 +253,8 @@ boundary: 'scrollParent', sanitize: true, sanitizeFn: null, - whiteList: DefaultWhitelist + whiteList: DefaultWhitelist, + popperConfig: null }; var HoverState = { SHOW: 'show', @@ -269,22 +286,17 @@ FOCUS: 'focus', CLICK: 'click', MANUAL: 'manual' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - }; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ var Tooltip = /*#__PURE__*/ function () { function Tooltip(element, config) { - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ if (typeof Popper === 'undefined') { throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); } // private @@ -355,7 +367,7 @@ clearTimeout(this._timeout); $.removeData(this.element, this.constructor.DATA_KEY); $(this.element).off(this.constructor.EVENT_KEY); - $(this.element).closest('.modal').off('hide.bs.modal'); + $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); if (this.tip) { $(this.tip).remove(); @@ -366,7 +378,7 @@ this._hoverState = null; this._activeTrigger = null; - if (this._popper !== null) { + if (this._popper) { this._popper.destroy(); } @@ -419,29 +431,7 @@ } $(this.element).trigger(this.constructor.Event.INSERTED); - this._popper = new Popper(this.element, tip, { - placement: attachment, - modifiers: { - offset: this._getOffset(), - flip: { - behavior: this.config.fallbackPlacement - }, - arrow: { - element: Selector.ARROW - }, - preventOverflow: { - boundariesElement: this.config.boundary - } - }, - onCreate: function onCreate(data) { - if (data.originalPlacement !== data.placement) { - _this._handlePopperPlacementChange(data); - } - }, - onUpdate: function onUpdate(data) { - return _this._handlePopperPlacementChange(data); - } - }); + this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment)); $(tip).addClass(ClassName.SHOW); // 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 @@ -589,14 +579,43 @@ } // Private ; - _proto._getOffset = function _getOffset() { + _proto._getPopperConfig = function _getPopperConfig(attachment) { var _this3 = this; + var defaultBsConfig = { + placement: attachment, + modifiers: { + offset: this._getOffset(), + flip: { + behavior: this.config.fallbackPlacement + }, + arrow: { + element: Selector.ARROW + }, + preventOverflow: { + boundariesElement: this.config.boundary + } + }, + onCreate: function onCreate(data) { + if (data.originalPlacement !== data.placement) { + _this3._handlePopperPlacementChange(data); + } + }, + onUpdate: function onUpdate(data) { + return _this3._handlePopperPlacementChange(data); + } + }; + return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig); + }; + + _proto._getOffset = function _getOffset() { + var _this4 = this; + var offset = {}; if (typeof this.config.offset === 'function') { offset.fn = function (data) { - data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {}); + data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {}); return data; }; } else { @@ -623,32 +642,35 @@ }; _proto._setListeners = function _setListeners() { - var _this4 = this; + var _this5 = this; var triggers = this.config.trigger.split(' '); triggers.forEach(function (trigger) { if (trigger === 'click') { - $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) { - return _this4.toggle(event); + $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { + return _this5.toggle(event); }); } else if (trigger !== Trigger.MANUAL) { - var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; - var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; - $(_this4.element).on(eventIn, _this4.config.selector, function (event) { - return _this4._enter(event); - }).on(eventOut, _this4.config.selector, function (event) { - return _this4._leave(event); + 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; + $(_this5.element).on(eventIn, _this5.config.selector, function (event) { + return _this5._enter(event); + }).on(eventOut, _this5.config.selector, function (event) { + return _this5._leave(event); }); } }); - $(this.element).closest('.modal').on('hide.bs.modal', function () { - if (_this4.element) { - _this4.hide(); + + this._hideModalHandler = function () { + if (_this5.element) { + _this5.hide(); } - }); + }; + + $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); if (this.config.selector) { - this.config = _objectSpread({}, this.config, { + this.config = _objectSpread2({}, this.config, { trigger: 'manual', selector: '' }); @@ -748,7 +770,7 @@ delete dataAttributes[dataAttr]; } }); - config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); + config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {}); if (typeof config.delay === 'number') { config.delay = { @@ -903,5 +925,5 @@ return Tooltip; -})); +}))); //# sourceMappingURL=tooltip.js.map |