diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/toast.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/toast.js | 96 |
1 files changed, 58 insertions, 38 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/toast.js b/vendor/twbs/bootstrap/js/dist/toast.js index b1be5fc37..9283b2eff 100644 --- a/vendor/twbs/bootstrap/js/dist/toast.js +++ b/vendor/twbs/bootstrap/js/dist/toast.js @@ -1,5 +1,5 @@ /*! - * Bootstrap toast.js v4.3.1 (https://getbootstrap.com/) + * Bootstrap toast.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('./util.js')) : typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) : (global = global || self, global.Toast = factory(global.jQuery, global.Util)); -}(this, function ($, Util) { 'use strict'; +}(this, (function ($, Util) { 'use strict'; $ = $ && $.hasOwnProperty('default') ? $['default'] : $; Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util; @@ -43,20 +43,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; @@ -69,7 +84,7 @@ */ var NAME = 'toast'; - var VERSION = '4.3.1'; + var VERSION = '4.4.1'; var DATA_KEY = 'bs.toast'; var EVENT_KEY = "." + DATA_KEY; var JQUERY_NO_CONFLICT = $.fn[NAME]; @@ -98,13 +113,12 @@ }; var Selector = { DATA_DISMISS: '[data-dismiss="toast"]' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - }; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ var Toast = /*#__PURE__*/ @@ -124,7 +138,12 @@ _proto.show = function show() { var _this = this; - $(this._element).trigger(Event.SHOW); + var showEvent = $.Event(Event.SHOW); + $(this._element).trigger(showEvent); + + if (showEvent.isDefaultPrevented()) { + return; + } if (this._config.animation) { this._element.classList.add(ClassName.FADE); @@ -138,12 +157,16 @@ $(_this._element).trigger(Event.SHOWN); if (_this._config.autohide) { - _this.hide(); + _this._timeout = setTimeout(function () { + _this.hide(); + }, _this._config.delay); } }; this._element.classList.remove(ClassName.HIDE); + Util.reflow(this._element); + this._element.classList.add(ClassName.SHOWING); if (this._config.animation) { @@ -154,22 +177,19 @@ } }; - _proto.hide = function hide(withoutTimeout) { - var _this2 = this; - + _proto.hide = function hide() { if (!this._element.classList.contains(ClassName.SHOW)) { return; } - $(this._element).trigger(Event.HIDE); + var hideEvent = $.Event(Event.HIDE); + $(this._element).trigger(hideEvent); - if (withoutTimeout) { - this._close(); - } else { - this._timeout = setTimeout(function () { - _this2._close(); - }, this._config.delay); + if (hideEvent.isDefaultPrevented()) { + return; } + + this._close(); }; _proto.dispose = function dispose() { @@ -188,26 +208,26 @@ ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread({}, Default, $(this._element).data(), typeof config === 'object' && config ? config : {}); + config = _objectSpread2({}, Default, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {}); Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); return config; }; _proto._setListeners = function _setListeners() { - var _this3 = this; + var _this2 = this; $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function () { - return _this3.hide(true); + return _this2.hide(); }); }; _proto._close = function _close() { - var _this4 = this; + var _this3 = this; var complete = function complete() { - _this4._element.classList.add(ClassName.HIDE); + _this3._element.classList.add(ClassName.HIDE); - $(_this4._element).trigger(Event.HIDDEN); + $(_this3._element).trigger(Event.HIDDEN); }; this._element.classList.remove(ClassName.SHOW); @@ -279,5 +299,5 @@ return Toast; -})); +}))); //# sourceMappingURL=toast.js.map |