diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/tooltip.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/tooltip.js | 139 |
1 files changed, 71 insertions, 68 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/tooltip.js b/vendor/twbs/bootstrap/js/dist/tooltip.js index 5d1713611..663337862 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.5.2 (https://getbootstrap.com/) + * Bootstrap tooltip.js v4.5.3 (https://getbootstrap.com/) * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -9,13 +9,15 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.jQuery, global.Popper, global.Util)); }(this, (function ($, Popper, Util) { 'use strict'; - $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $; - Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper; - Util = Util && Object.prototype.hasOwnProperty.call(Util, 'default') ? Util['default'] : Util; + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + var $__default = /*#__PURE__*/_interopDefaultLegacy($); + var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper); + var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util); /** * -------------------------------------------------------------------------- - * Bootstrap (v4.5.2): tools/sanitizer.js + * Bootstrap (v4.5.3): tools/sanitizer.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -146,10 +148,10 @@ */ var NAME = 'tooltip'; - var VERSION = '4.5.2'; + var VERSION = '4.5.3'; var DATA_KEY = 'bs.tooltip'; var EVENT_KEY = "." + DATA_KEY; - var JQUERY_NO_CONFLICT = $.fn[NAME]; + var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME]; var CLASS_PREFIX = 'bs-tooltip'; var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; @@ -226,7 +228,7 @@ var Tooltip = /*#__PURE__*/function () { function Tooltip(element, config) { - if (typeof Popper === 'undefined') { + if (typeof Popper__default['default'] === 'undefined') { throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); } // private @@ -267,11 +269,11 @@ if (event) { var dataKey = this.constructor.DATA_KEY; - var context = $(event.currentTarget).data(dataKey); + var context = $__default['default'](event.currentTarget).data(dataKey); if (!context) { context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); + $__default['default'](event.currentTarget).data(dataKey, context); } context._activeTrigger.click = !context._activeTrigger.click; @@ -282,7 +284,7 @@ context._leave(null, context); } } else { - if ($(this.getTipElement()).hasClass(CLASS_NAME_SHOW)) { + if ($__default['default'](this.getTipElement()).hasClass(CLASS_NAME_SHOW)) { this._leave(null, this); return; @@ -294,12 +296,12 @@ _proto.dispose = function dispose() { 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._hideModalHandler); + $__default['default'].removeData(this.element, this.constructor.DATA_KEY); + $__default['default'](this.element).off(this.constructor.EVENT_KEY); + $__default['default'](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); if (this.tip) { - $(this.tip).remove(); + $__default['default'](this.tip).remove(); } this._isEnabled = null; @@ -320,29 +322,29 @@ _proto.show = function show() { var _this = this; - if ($(this.element).css('display') === 'none') { + if ($__default['default'](this.element).css('display') === 'none') { throw new Error('Please use show on visible elements'); } - var showEvent = $.Event(this.constructor.Event.SHOW); + var showEvent = $__default['default'].Event(this.constructor.Event.SHOW); if (this.isWithContent() && this._isEnabled) { - $(this.element).trigger(showEvent); - var shadowRoot = Util.findShadowRoot(this.element); - var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); + $__default['default'](this.element).trigger(showEvent); + var shadowRoot = Util__default['default'].findShadowRoot(this.element); + var isInTheDom = $__default['default'].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); if (showEvent.isDefaultPrevented() || !isInTheDom) { return; } var tip = this.getTipElement(); - var tipId = Util.getUID(this.constructor.NAME); + var tipId = Util__default['default'].getUID(this.constructor.NAME); tip.setAttribute('id', tipId); this.element.setAttribute('aria-describedby', tipId); this.setContent(); if (this.config.animation) { - $(tip).addClass(CLASS_NAME_FADE); + $__default['default'](tip).addClass(CLASS_NAME_FADE); } var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; @@ -353,21 +355,21 @@ var container = this._getContainer(); - $(tip).data(this.constructor.DATA_KEY, this); + $__default['default'](tip).data(this.constructor.DATA_KEY, this); - if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { - $(tip).appendTo(container); + if (!$__default['default'].contains(this.element.ownerDocument.documentElement, this.tip)) { + $__default['default'](tip).appendTo(container); } - $(this.element).trigger(this.constructor.Event.INSERTED); - this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment)); - $(tip).addClass(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra + $__default['default'](this.element).trigger(this.constructor.Event.INSERTED); + this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment)); + $__default['default'](tip).addClass(CLASS_NAME_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 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html if ('ontouchstart' in document.documentElement) { - $(document.body).children().on('mouseover', null, $.noop); + $__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop); } var complete = function complete() { @@ -377,16 +379,16 @@ var prevHoverState = _this._hoverState; _this._hoverState = null; - $(_this.element).trigger(_this.constructor.Event.SHOWN); + $__default['default'](_this.element).trigger(_this.constructor.Event.SHOWN); if (prevHoverState === HOVER_STATE_OUT) { _this._leave(null, _this); } }; - if ($(this.tip).hasClass(CLASS_NAME_FADE)) { - var transitionDuration = Util.getTransitionDurationFromElement(this.tip); - $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); + if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE)) { + var transitionDuration = Util__default['default'].getTransitionDurationFromElement(this.tip); + $__default['default'](this.tip).one(Util__default['default'].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); } else { complete(); } @@ -397,7 +399,7 @@ var _this2 = this; var tip = this.getTipElement(); - var hideEvent = $.Event(this.constructor.Event.HIDE); + var hideEvent = $__default['default'].Event(this.constructor.Event.HIDE); var complete = function complete() { if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { @@ -408,7 +410,7 @@ _this2.element.removeAttribute('aria-describedby'); - $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); + $__default['default'](_this2.element).trigger(_this2.constructor.Event.HIDDEN); if (_this2._popper !== null) { _this2._popper.destroy(); @@ -419,26 +421,26 @@ } }; - $(this.element).trigger(hideEvent); + $__default['default'](this.element).trigger(hideEvent); if (hideEvent.isDefaultPrevented()) { return; } - $(tip).removeClass(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra + $__default['default'](tip).removeClass(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra // empty mouseover listeners we added for iOS support if ('ontouchstart' in document.documentElement) { - $(document.body).children().off('mouseover', null, $.noop); + $__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop); } this._activeTrigger[TRIGGER_CLICK] = false; this._activeTrigger[TRIGGER_FOCUS] = false; this._activeTrigger[TRIGGER_HOVER] = false; - if ($(this.tip).hasClass(CLASS_NAME_FADE)) { - var transitionDuration = Util.getTransitionDurationFromElement(tip); - $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); + if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE)) { + var transitionDuration = Util__default['default'].getTransitionDurationFromElement(tip); + $__default['default'](tip).one(Util__default['default'].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); } else { complete(); } @@ -458,29 +460,29 @@ }; _proto.addAttachmentClass = function addAttachmentClass(attachment) { - $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); + $__default['default'](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); }; _proto.getTipElement = function getTipElement() { - this.tip = this.tip || $(this.config.template)[0]; + this.tip = this.tip || $__default['default'](this.config.template)[0]; return this.tip; }; _proto.setContent = function setContent() { var tip = this.getTipElement(); - this.setElementContent($(tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle()); - $(tip).removeClass(CLASS_NAME_FADE + " " + CLASS_NAME_SHOW); + this.setElementContent($__default['default'](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle()); + $__default['default'](tip).removeClass(CLASS_NAME_FADE + " " + CLASS_NAME_SHOW); }; _proto.setElementContent = function setElementContent($element, content) { if (typeof content === 'object' && (content.nodeType || content.jquery)) { // Content is a DOM node or a jQuery if (this.config.html) { - if (!$(content).parent().is($element)) { + if (!$__default['default'](content).parent().is($element)) { $element.empty().append(content); } } else { - $element.text($(content).text()); + $element.text($__default['default'](content).text()); } return; @@ -559,11 +561,11 @@ return document.body; } - if (Util.isElement(this.config.container)) { - return $(this.config.container); + if (Util__default['default'].isElement(this.config.container)) { + return $__default['default'](this.config.container); } - return $(document).find(this.config.container); + return $__default['default'](document).find(this.config.container); }; _proto._getAttachment = function _getAttachment(placement) { @@ -576,13 +578,13 @@ var triggers = this.config.trigger.split(' '); triggers.forEach(function (trigger) { if (trigger === 'click') { - $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { + $__default['default'](_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 ? _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) { + $__default['default'](_this5.element).on(eventIn, _this5.config.selector, function (event) { return _this5._enter(event); }).on(eventOut, _this5.config.selector, function (event) { return _this5._leave(event); @@ -596,7 +598,7 @@ } }; - $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); + $__default['default'](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); if (this.config.selector) { this.config = _extends({}, this.config, { @@ -619,18 +621,18 @@ _proto._enter = function _enter(event, context) { var dataKey = this.constructor.DATA_KEY; - context = context || $(event.currentTarget).data(dataKey); + context = context || $__default['default'](event.currentTarget).data(dataKey); if (!context) { context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); + $__default['default'](event.currentTarget).data(dataKey, context); } if (event) { context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; } - if ($(context.getTipElement()).hasClass(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) { + if ($__default['default'](context.getTipElement()).hasClass(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) { context._hoverState = HOVER_STATE_SHOW; return; } @@ -652,11 +654,11 @@ _proto._leave = function _leave(event, context) { var dataKey = this.constructor.DATA_KEY; - context = context || $(event.currentTarget).data(dataKey); + context = context || $__default['default'](event.currentTarget).data(dataKey); if (!context) { context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); + $__default['default'](event.currentTarget).data(dataKey, context); } if (event) { @@ -693,7 +695,7 @@ }; _proto._getConfig = function _getConfig(config) { - var dataAttributes = $(this.element).data(); + var dataAttributes = $__default['default'](this.element).data(); Object.keys(dataAttributes).forEach(function (dataAttr) { if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { delete dataAttributes[dataAttr]; @@ -716,7 +718,7 @@ config.content = config.content.toString(); } - Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); + Util__default['default'].typeCheckConfig(NAME, config, this.constructor.DefaultType); if (config.sanitize) { config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); @@ -740,7 +742,7 @@ }; _proto._cleanTipClass = function _cleanTipClass() { - var $tip = $(this.getTipElement()); + var $tip = $__default['default'](this.getTipElement()); var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); if (tabClass !== null && tabClass.length) { @@ -764,7 +766,7 @@ return; } - $(tip).removeClass(CLASS_NAME_FADE); + $__default['default'](tip).removeClass(CLASS_NAME_FADE); this.config.animation = false; this.hide(); this.show(); @@ -774,7 +776,8 @@ Tooltip._jQueryInterface = function _jQueryInterface(config) { return this.each(function () { - var data = $(this).data(DATA_KEY); + var $element = $__default['default'](this); + var data = $element.data(DATA_KEY); var _config = typeof config === 'object' && config; @@ -784,7 +787,7 @@ if (!data) { data = new Tooltip(this, _config); - $(this).data(DATA_KEY, data); + $element.data(DATA_KEY, data); } if (typeof config === 'string') { @@ -843,11 +846,11 @@ */ - $.fn[NAME] = Tooltip._jQueryInterface; - $.fn[NAME].Constructor = Tooltip; + $__default['default'].fn[NAME] = Tooltip._jQueryInterface; + $__default['default'].fn[NAME].Constructor = Tooltip; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; + $__default['default'].fn[NAME].noConflict = function () { + $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT; return Tooltip._jQueryInterface; }; |