1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-12 08:34:08 +02:00
This commit is contained in:
XhmikosR
2020-03-28 12:29:08 +02:00
committed by GitHub
parent f761d8e801
commit 74afe149c4
59 changed files with 4462 additions and 4022 deletions

82
js/dist/toast.js vendored
View File

@@ -1,6 +1,6 @@
/*!
* Bootstrap toast.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* 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,9 +9,9 @@
(global = global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator));
}(this, (function (Data, EventHandler, Manipulator) { 'use strict';
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
@@ -63,13 +63,13 @@
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(source, true).forEach(function (key) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(source).forEach(function (key) {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
@@ -88,6 +88,10 @@
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
var toType = function toType(obj) {
if (obj === null || obj === undefined) {
return "" + obj;
}
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
};
@@ -115,9 +119,7 @@
};
var triggerTransitionEnd = function triggerTransitionEnd(element) {
var evt = document.createEvent('HTMLEvents');
evt.initEvent(TRANSITION_END, true, true);
element.dispatchEvent(evt);
element.dispatchEvent(new Event(TRANSITION_END));
};
var isElement = function isElement(obj) {
@@ -179,19 +181,15 @@
var VERSION = '4.3.1';
var DATA_KEY = 'bs.toast';
var EVENT_KEY = "." + DATA_KEY;
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',
@@ -202,18 +200,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);
@@ -231,22 +225,22 @@
_proto.show = function show() {
var _this = this;
var showEvent = EventHandler.trigger(this._element, Event.SHOW);
var showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
if (showEvent.defaultPrevented) {
return;
}
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);
EventHandler.trigger(_this._element, Event.SHOWN);
EventHandler.trigger(_this._element, EVENT_SHOWN);
if (_this._config.autohide) {
_this._timeout = setTimeout(function () {
@@ -255,11 +249,11 @@
}
};
this._element.classList.remove(ClassName.HIDE);
this._element.classList.remove(CLASS_NAME_HIDE);
reflow(this._element);
this._element.classList.add(ClassName.SHOWING);
this._element.classList.add(CLASS_NAME_SHOWING);
if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element);
@@ -273,23 +267,23 @@
_proto.hide = function hide() {
var _this2 = this;
if (!this._element.classList.contains(ClassName.SHOW)) {
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
return;
}
var hideEvent = EventHandler.trigger(this._element, Event.HIDE);
var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
if (hideEvent.defaultPrevented) {
return;
}
var complete = function complete() {
_this2._element.classList.add(ClassName.HIDE);
_this2._element.classList.add(CLASS_NAME_HIDE);
EventHandler.trigger(_this2._element, Event.HIDDEN);
EventHandler.trigger(_this2._element, EVENT_HIDDEN);
};
this._element.classList.remove(ClassName.SHOW);
this._element.classList.remove(CLASS_NAME_SHOW);
if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element);
@@ -304,11 +298,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);
}
EventHandler.off(this._element, Event.CLICK_DISMISS);
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
Data.removeData(this._element, DATA_KEY);
this._element = null;
this._config = null;
@@ -324,7 +318,7 @@
_proto._setListeners = function _setListeners() {
var _this3 = this;
EventHandler.on(this._element, Event.CLICK_DISMISS, Selector.DATA_DISMISS, function () {
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () {
return _this3.hide();
});
} // Static