diff options
Diffstat (limited to 'js/dist/modal.js')
-rw-r--r-- | js/dist/modal.js | 99 |
1 files changed, 28 insertions, 71 deletions
diff --git a/js/dist/modal.js b/js/dist/modal.js index 5be3c20694..95915bafad 100644 --- a/js/dist/modal.js +++ b/js/dist/modal.js @@ -1,82 +1,22 @@ /*! - * Bootstrap modal.js v4.5.0 (https://getbootstrap.com/) + * Bootstrap modal.js v4.5.1 (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) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { 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.Modal = factory(global.jQuery, global.Util)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.jQuery, global.Util)); }(this, (function ($, Util) { 'use strict'; $ = $ && 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++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; - } - - 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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - 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)); - }); - } - } - - return target; - } + function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /** * ------------------------------------------------------------------------ * Constants @@ -84,7 +24,7 @@ */ var NAME = 'modal'; - var VERSION = '4.5.0'; + var VERSION = '4.5.1'; var DATA_KEY = 'bs.modal'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -276,7 +216,7 @@ ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default), config); + config = _extends({}, Default, config); Util.typeCheckConfig(NAME, config, DefaultType); return config; }; @@ -292,11 +232,24 @@ return; } + var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; + + if (!isModalOverflowing) { + this._element.style.overflowY = 'hidden'; + } + this._element.classList.add(CLASS_NAME_STATIC); - var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element); + var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog); + $(this._element).off(Util.TRANSITION_END); $(this._element).one(Util.TRANSITION_END, function () { _this3._element.classList.remove(CLASS_NAME_STATIC); + + if (!isModalOverflowing) { + $(_this3._element).one(Util.TRANSITION_END, function () { + _this3._element.style.overflowY = ''; + }).emulateTransitionEnd(_this3._element, modalTransitionDuration); + } }).emulateTransitionEnd(modalTransitionDuration); this._element.focus(); @@ -322,6 +275,8 @@ this._element.setAttribute('aria-modal', true); + this._element.setAttribute('role', 'dialog'); + if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) { modalBody.scrollTop = 0; } else { @@ -409,6 +364,8 @@ this._element.removeAttribute('aria-modal'); + this._element.removeAttribute('role'); + this._isTransitioning = false; this._showBackdrop(function () { @@ -590,7 +547,7 @@ return this.each(function () { var data = $(this).data(DATA_KEY); - var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default), $(this).data()), typeof config === 'object' && config ? config : {}); + var _config = _extends({}, Default, $(this).data(), typeof config === 'object' && config ? config : {}); if (!data) { data = new Modal(this, _config); @@ -640,7 +597,7 @@ target = document.querySelector(selector); } - var config = $(target).data(DATA_KEY) ? 'toggle' : _objectSpread2(_objectSpread2({}, $(target).data()), $(this).data()); + var config = $(target).data(DATA_KEY) ? 'toggle' : _extends({}, $(target).data(), $(this).data()); if (this.tagName === 'A' || this.tagName === 'AREA') { event.preventDefault(); |