diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/toast.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/toast.js | 74 |
1 files changed, 33 insertions, 41 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/toast.js b/vendor/twbs/bootstrap/js/dist/toast.js index 9283b2eff..fcfc3e83a 100644 --- a/vendor/twbs/bootstrap/js/dist/toast.js +++ b/vendor/twbs/bootstrap/js/dist/toast.js @@ -1,6 +1,6 @@ /*! - * Bootstrap toast.js v4.4.1 (https://getbootstrap.com/) - * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Bootstrap toast.js v4.5.0 (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/master/LICENSE) */ (function (global, factory) { @@ -9,8 +9,8 @@ (global = global || self, global.Toast = factory(global.jQuery, global.Util)); }(this, (function ($, Util) { 'use strict'; - $ = $ && $.hasOwnProperty('default') ? $['default'] : $; - Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util; + $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $; + Util = Util && Object.prototype.hasOwnProperty.call(Util, 'default') ? Util['default'] : Util; function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { @@ -84,23 +84,19 @@ */ var NAME = 'toast'; - var VERSION = '4.4.1'; + var VERSION = '4.5.0'; var DATA_KEY = 'bs.toast'; var EVENT_KEY = "." + DATA_KEY; var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Event = { - CLICK_DISMISS: "click.dismiss" + EVENT_KEY, - HIDE: "hide" + EVENT_KEY, - HIDDEN: "hidden" + EVENT_KEY, - SHOW: "show" + EVENT_KEY, - SHOWN: "shown" + EVENT_KEY - }; - var ClassName = { - FADE: 'fade', - HIDE: 'hide', - SHOW: 'show', - SHOWING: 'showing' - }; + var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY; + var EVENT_HIDE = "hide" + EVENT_KEY; + var EVENT_HIDDEN = "hidden" + EVENT_KEY; + var EVENT_SHOW = "show" + EVENT_KEY; + var EVENT_SHOWN = "shown" + EVENT_KEY; + var CLASS_NAME_FADE = 'fade'; + var CLASS_NAME_HIDE = 'hide'; + var CLASS_NAME_SHOW = 'show'; + var CLASS_NAME_SHOWING = 'showing'; var DefaultType = { animation: 'boolean', autohide: 'boolean', @@ -111,18 +107,14 @@ autohide: true, delay: 500 }; - var Selector = { - DATA_DISMISS: '[data-dismiss="toast"]' - }; + var SELECTOR_DATA_DISMISS = '[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); @@ -138,7 +130,7 @@ _proto.show = function show() { var _this = this; - var showEvent = $.Event(Event.SHOW); + var showEvent = $.Event(EVENT_SHOW); $(this._element).trigger(showEvent); if (showEvent.isDefaultPrevented()) { @@ -146,15 +138,15 @@ } if (this._config.animation) { - this._element.classList.add(ClassName.FADE); + this._element.classList.add(CLASS_NAME_FADE); } var complete = function complete() { - _this._element.classList.remove(ClassName.SHOWING); + _this._element.classList.remove(CLASS_NAME_SHOWING); - _this._element.classList.add(ClassName.SHOW); + _this._element.classList.add(CLASS_NAME_SHOW); - $(_this._element).trigger(Event.SHOWN); + $(_this._element).trigger(EVENT_SHOWN); if (_this._config.autohide) { _this._timeout = setTimeout(function () { @@ -163,11 +155,11 @@ } }; - this._element.classList.remove(ClassName.HIDE); + this._element.classList.remove(CLASS_NAME_HIDE); Util.reflow(this._element); - this._element.classList.add(ClassName.SHOWING); + this._element.classList.add(CLASS_NAME_SHOWING); if (this._config.animation) { var transitionDuration = Util.getTransitionDurationFromElement(this._element); @@ -178,11 +170,11 @@ }; _proto.hide = function hide() { - if (!this._element.classList.contains(ClassName.SHOW)) { + if (!this._element.classList.contains(CLASS_NAME_SHOW)) { return; } - var hideEvent = $.Event(Event.HIDE); + var hideEvent = $.Event(EVENT_HIDE); $(this._element).trigger(hideEvent); if (hideEvent.isDefaultPrevented()) { @@ -196,11 +188,11 @@ clearTimeout(this._timeout); this._timeout = null; - if (this._element.classList.contains(ClassName.SHOW)) { - this._element.classList.remove(ClassName.SHOW); + if (this._element.classList.contains(CLASS_NAME_SHOW)) { + this._element.classList.remove(CLASS_NAME_SHOW); } - $(this._element).off(Event.CLICK_DISMISS); + $(this._element).off(EVENT_CLICK_DISMISS); $.removeData(this._element, DATA_KEY); this._element = null; this._config = null; @@ -208,7 +200,7 @@ ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2({}, Default, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {}); + config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default), $(this._element).data()), typeof config === 'object' && config ? config : {}); Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); return config; }; @@ -216,7 +208,7 @@ _proto._setListeners = function _setListeners() { var _this2 = this; - $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function () { + $(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () { return _this2.hide(); }); }; @@ -225,12 +217,12 @@ var _this3 = this; var complete = function complete() { - _this3._element.classList.add(ClassName.HIDE); + _this3._element.classList.add(CLASS_NAME_HIDE); - $(_this3._element).trigger(Event.HIDDEN); + $(_this3._element).trigger(EVENT_HIDDEN); }; - this._element.classList.remove(ClassName.SHOW); + this._element.classList.remove(CLASS_NAME_SHOW); if (this._config.animation) { var transitionDuration = Util.getTransitionDurationFromElement(this._element); |