mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-09 07:06:36 +02:00
74
js/dist/modal.js
vendored
74
js/dist/modal.js
vendored
@@ -1,27 +1,21 @@
|
||||
/*!
|
||||
* Bootstrap modal.js v5.0.0 (https://getbootstrap.com/)
|
||||
* Bootstrap modal.js v5.0.1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
||||
}(this, (function (EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.SelectorEngine, global.EventHandler, global.Manipulator, global.Base));
|
||||
}(this, (function (SelectorEngine, EventHandler, Manipulator, BaseComponent) { 'use strict';
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
||||
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
||||
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
||||
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
||||
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const MILLISECONDS_MULTIPLIER = 1000;
|
||||
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
|
||||
@@ -89,7 +83,17 @@
|
||||
element.dispatchEvent(new Event(TRANSITION_END));
|
||||
};
|
||||
|
||||
const isElement = obj => (obj[0] || obj).nodeType;
|
||||
const isElement = obj => {
|
||||
if (!obj || typeof obj !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof obj.jquery !== 'undefined') {
|
||||
obj = obj[0];
|
||||
}
|
||||
|
||||
return typeof obj.nodeType !== 'undefined';
|
||||
};
|
||||
|
||||
const emulateTransitionEnd = (element, duration) => {
|
||||
let called = false;
|
||||
@@ -159,12 +163,13 @@
|
||||
|
||||
const isRTL = () => document.documentElement.dir === 'rtl';
|
||||
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
const defineJQueryPlugin = plugin => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
const name = plugin.NAME;
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
@@ -185,7 +190,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0): util/scrollBar.js
|
||||
* Bootstrap (v5.0.1): util/scrollBar.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -259,7 +264,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0): util/backdrop.js
|
||||
* Bootstrap (v5.0.1): util/backdrop.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -343,6 +348,7 @@
|
||||
config = { ...Default$1,
|
||||
...(typeof config === 'object' ? config : {})
|
||||
};
|
||||
config.rootElement = config.rootElement || document.body;
|
||||
typeCheckConfig(NAME$1, config, DefaultType$1);
|
||||
return config;
|
||||
}
|
||||
@@ -387,7 +393,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0): modal.js
|
||||
* Bootstrap (v5.0.1): modal.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -454,8 +460,8 @@
|
||||
return Default;
|
||||
}
|
||||
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
static get NAME() {
|
||||
return NAME;
|
||||
} // Public
|
||||
|
||||
|
||||
@@ -536,17 +542,14 @@
|
||||
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
|
||||
EventHandler__default['default'].off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
|
||||
|
||||
if (isAnimated) {
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
EventHandler__default['default'].one(this._element, 'transitionend', event => this._hideModal(event));
|
||||
emulateTransitionEnd(this._element, transitionDuration);
|
||||
} else {
|
||||
this._hideModal();
|
||||
}
|
||||
this._queueCallback(() => this._hideModal(), this._element, isAnimated);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
[window, this._dialog].forEach(htmlElement => EventHandler__default['default'].off(htmlElement, EVENT_KEY));
|
||||
|
||||
this._backdrop.dispose();
|
||||
|
||||
super.dispose();
|
||||
/**
|
||||
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
||||
@@ -555,15 +558,6 @@
|
||||
*/
|
||||
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
||||
this._config = null;
|
||||
this._dialog = null;
|
||||
|
||||
this._backdrop.dispose();
|
||||
|
||||
this._backdrop = null;
|
||||
this._isShown = null;
|
||||
this._ignoreBackdropClick = null;
|
||||
this._isTransitioning = null;
|
||||
}
|
||||
|
||||
handleUpdate() {
|
||||
@@ -633,13 +627,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
if (isAnimated) {
|
||||
const transitionDuration = getTransitionDurationFromElement(this._dialog);
|
||||
EventHandler__default['default'].one(this._dialog, 'transitionend', transitionComplete);
|
||||
emulateTransitionEnd(this._dialog, transitionDuration);
|
||||
} else {
|
||||
transitionComplete();
|
||||
}
|
||||
this._queueCallback(transitionComplete, this._dialog, isAnimated);
|
||||
}
|
||||
|
||||
_enforceFocus() {
|
||||
@@ -829,7 +817,7 @@
|
||||
* add .Modal to jQuery only if jQuery is present
|
||||
*/
|
||||
|
||||
defineJQueryPlugin(NAME, Modal);
|
||||
defineJQueryPlugin(Modal);
|
||||
|
||||
return Modal;
|
||||
|
||||
|
Reference in New Issue
Block a user