From 4491fb091f021c61cd3089323b3e0a9289ef768d Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 14 Sep 2020 18:12:06 +0300 Subject: Dist (#31644) --- dist/js/bootstrap.esm.js | 243 ++++++++++++++++++++++------------------------- 1 file changed, 112 insertions(+), 131 deletions(-) (limited to 'dist/js/bootstrap.esm.js') diff --git a/dist/js/bootstrap.esm.js b/dist/js/bootstrap.esm.js index d90b2ef36e..f3cbdd0720 100644 --- a/dist/js/bootstrap.esm.js +++ b/dist/js/bootstrap.esm.js @@ -21,53 +21,22 @@ function _createClass(Constructor, protoProps, 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 _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)); - }); +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 target; + }; + + return _extends.apply(this, arguments); } function _inheritsLoose(subClass, superClass) { @@ -268,22 +237,22 @@ var mapData = function () { var id = 1; return { set: function set(element, key, data) { - if (typeof element.key === 'undefined') { - element.key = { + if (typeof element.bsKey === 'undefined') { + element.bsKey = { key: key, id: id }; id++; } - storeData[element.key.id] = data; + storeData[element.bsKey.id] = data; }, get: function get(element, key) { - if (!element || typeof element.key === 'undefined') { + if (!element || typeof element.bsKey === 'undefined') { return null; } - var keyProperties = element.key; + var keyProperties = element.bsKey; if (keyProperties.key === key) { return storeData[keyProperties.id]; @@ -292,15 +261,15 @@ var mapData = function () { return null; }, delete: function _delete(element, key) { - if (typeof element.key === 'undefined') { + if (typeof element.bsKey === 'undefined') { return; } - var keyProperties = element.key; + var keyProperties = element.bsKey; if (keyProperties.key === key) { delete storeData[keyProperties.id]; - delete element.key; + delete element.bsKey; } } }; @@ -433,6 +402,8 @@ function getEvent(element) { function bootstrapHandler(element, fn) { return function handler(event) { + event.delegateTarget = element; + if (handler.oneOff) { EventHandler.off(element, event.type, fn); } @@ -448,6 +419,8 @@ function bootstrapDelegationHandler(element, selector, fn) { for (var target = event.target; target && target !== this; target = target.parentNode) { for (var i = domElements.length; i--;) { if (domElements[i] === target) { + event.delegateTarget = target; + if (handler.oneOff) { EventHandler.off(element, event.type, fn); } @@ -632,7 +605,7 @@ var EventHandler = { bubbles: bubbles, cancelable: true }); - } // merge custom informations in our event + } // merge custom information in our event if (typeof args !== 'undefined') { @@ -707,11 +680,7 @@ var Alert = /*#__PURE__*/function () { // Public _proto.close = function close(element) { - var rootElement = this._element; - - if (element) { - rootElement = this._getRootElement(element); - } + var rootElement = element ? this._getRootElement(element) : this._element; var customEvent = this._triggerCloseEvent(rootElement); @@ -980,7 +949,7 @@ var Manipulator = { return {}; } - var attributes = _objectSpread2({}, element.dataset); + var attributes = _extends({}, element.dataset); Object.keys(attributes).forEach(function (key) { attributes[key] = normalizeData(attributes[key]); @@ -1293,7 +1262,7 @@ var Carousel = /*#__PURE__*/function () { ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default), config); + config = _extends({}, Default, config); typeCheckConfig(NAME$2, config, DefaultType); return config; }; @@ -1587,10 +1556,10 @@ var Carousel = /*#__PURE__*/function () { Carousel.carouselInterface = function carouselInterface(element, config) { var data = Data.getData(element, DATA_KEY$2); - var _config = _objectSpread2(_objectSpread2({}, Default), Manipulator.getDataAttributes(element)); + var _config = _extends({}, Default, Manipulator.getDataAttributes(element)); if (typeof config === 'object') { - _config = _objectSpread2(_objectSpread2({}, _config), config); + _config = _extends({}, _config, config); } var action = typeof config === 'string' ? config : _config.slide; @@ -1626,7 +1595,7 @@ var Carousel = /*#__PURE__*/function () { return; } - var config = _objectSpread2(_objectSpread2({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this)); + var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this)); var slideIndex = this.getAttribute('data-slide-to'); @@ -1943,7 +1912,7 @@ var Collapse = /*#__PURE__*/function () { ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default$1), config); + config = _extends({}, Default$1, config); config.toggle = Boolean(config.toggle); // Coerce string values typeCheckConfig(NAME$3, config, DefaultType$1); @@ -1951,9 +1920,7 @@ var Collapse = /*#__PURE__*/function () { }; _proto._getDimension = function _getDimension() { - var hasWidth = this._element.classList.contains(WIDTH); - - return hasWidth ? WIDTH : HEIGHT; + return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT; }; _proto._getParent = function _getParent() { @@ -1980,28 +1947,27 @@ var Collapse = /*#__PURE__*/function () { }; _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { - if (element) { - var isOpen = element.classList.contains(CLASS_NAME_SHOW); - - if (triggerArray.length) { - triggerArray.forEach(function (elem) { - if (isOpen) { - elem.classList.remove(CLASS_NAME_COLLAPSED); - } else { - elem.classList.add(CLASS_NAME_COLLAPSED); - } + if (!element || !triggerArray.length) { + return; + } - elem.setAttribute('aria-expanded', isOpen); - }); + var isOpen = element.classList.contains(CLASS_NAME_SHOW); + triggerArray.forEach(function (elem) { + if (isOpen) { + elem.classList.remove(CLASS_NAME_COLLAPSED); + } else { + elem.classList.add(CLASS_NAME_COLLAPSED); } - } + + elem.setAttribute('aria-expanded', isOpen); + }); } // Static ; Collapse.collapseInterface = function collapseInterface(element, config) { var data = Data.getData(element, DATA_KEY$3); - var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$1), Manipulator.getDataAttributes(element)), typeof config === 'object' && config ? config : {}); + var _config = _extends({}, Default$1, Manipulator.getDataAttributes(element), typeof config === 'object' && config ? config : {}); if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { _config.toggle = false; @@ -2323,7 +2289,7 @@ var Dropdown = /*#__PURE__*/function () { }; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2(_objectSpread2({}, this.constructor.Default), Manipulator.getDataAttributes(this._element)), config); + config = _extends({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config); typeCheckConfig(NAME$4, config, this.constructor.DefaultType); return config; }; @@ -2364,7 +2330,7 @@ var Dropdown = /*#__PURE__*/function () { if (typeof this._config.offset === 'function') { offset.fn = function (data) { - data.offsets = _objectSpread2(_objectSpread2({}, data.offsets), _this2._config.offset(data.offsets, _this2._element) || {}); + data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); return data; }; } else { @@ -2394,7 +2360,7 @@ var Dropdown = /*#__PURE__*/function () { }; } - return _objectSpread2(_objectSpread2({}, popperConfig), this._config.popperConfig); + return _extends({}, popperConfig, this._config.popperConfig); } // Static ; @@ -2805,7 +2771,7 @@ var Modal = /*#__PURE__*/function () { ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default$3), config); + config = _extends({}, Default$3, config); typeCheckConfig(NAME$5, config, DefaultType$3); return config; }; @@ -3011,11 +2977,25 @@ var Modal = /*#__PURE__*/function () { 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 = getTransitionDurationFromElement(this._element); + var modalTransitionDuration = getTransitionDurationFromElement(this._dialog); + EventHandler.off(this._element, TRANSITION_END); EventHandler.one(this._element, TRANSITION_END, function () { _this9._element.classList.remove(CLASS_NAME_STATIC); + + if (!isModalOverflowing) { + EventHandler.one(_this9._element, TRANSITION_END, function () { + _this9._element.style.overflowY = ''; + }); + emulateTransitionEnd(_this9._element, modalTransitionDuration); + } }); emulateTransitionEnd(this._element, modalTransitionDuration); @@ -3126,7 +3106,7 @@ var Modal = /*#__PURE__*/function () { return this.each(function () { var data = Data.getData(this, DATA_KEY$5); - var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$3), Manipulator.getDataAttributes(this)), typeof config === 'object' && config ? config : {}); + var _config = _extends({}, Default$3, Manipulator.getDataAttributes(this), typeof config === 'object' && config ? config : {}); if (!data) { data = new Modal(this, _config); @@ -3193,7 +3173,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, functi var data = Data.getData(target, DATA_KEY$5); if (!data) { - var config = _objectSpread2(_objectSpread2({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this)); + var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this)); data = new Modal(target, config); } @@ -3268,7 +3248,7 @@ var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) { return false; }; -var DefaultWhitelist = { +var DefaultAllowlist = { // Global attributes allowed on any supplied element below. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], a: ['target', 'href', 'title', 'rel'], @@ -3301,7 +3281,7 @@ var DefaultWhitelist = { u: [], ul: [] }; -function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { +function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) { var _ref; if (!unsafeHtml.length) { @@ -3314,7 +3294,7 @@ function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { var domParser = new window.DOMParser(); var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); - var whitelistKeys = Object.keys(whiteList); + var allowlistKeys = Object.keys(allowList); var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*')); @@ -3324,16 +3304,16 @@ function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { var el = elements[i]; var elName = el.nodeName.toLowerCase(); - if (whitelistKeys.indexOf(elName) === -1) { + if (allowlistKeys.indexOf(elName) === -1) { el.parentNode.removeChild(el); return "continue"; } var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes); - var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); + var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []); attributeList.forEach(function (attr) { - if (!allowedAttribute(attr, whitelistedAttributes)) { + if (!allowedAttribute(attr, allowedAttributes)) { el.removeAttribute(attr.nodeName); } }); @@ -3360,7 +3340,7 @@ var DATA_KEY$6 = 'bs.tooltip'; var EVENT_KEY$6 = "." + DATA_KEY$6; var CLASS_PREFIX = 'bs-tooltip'; var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); -var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; +var DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn']; var DefaultType$4 = { animation: 'boolean', template: 'string', @@ -3376,7 +3356,7 @@ var DefaultType$4 = { boundary: '(string|element)', sanitize: 'boolean', sanitizeFn: '(null|function)', - whiteList: 'object', + allowList: 'object', popperConfig: '(null|object)' }; var AttachmentMap = { @@ -3401,7 +3381,7 @@ var Default$4 = { boundary: 'scrollParent', sanitize: true, sanitizeFn: null, - whiteList: DefaultWhitelist, + allowList: DefaultAllowlist, popperConfig: null }; var Event$1 = { @@ -3477,11 +3457,11 @@ var Tooltip = /*#__PURE__*/function () { if (event) { var dataKey = this.constructor.DATA_KEY; - var context = Data.getData(event.target, dataKey); + var context = Data.getData(event.delegateTarget, dataKey); if (!context) { - context = new this.constructor(event.target, this._getDelegateConfig()); - Data.setData(event.target, dataKey, context); + context = new this.constructor(event.delegateTarget, this._getDelegateConfig()); + Data.setData(event.delegateTarget, dataKey, context); } context._activeTrigger.click = !context._activeTrigger.click; @@ -3710,7 +3690,7 @@ var Tooltip = /*#__PURE__*/function () { if (this.config.html) { if (this.config.sanitize) { - content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); + content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn); } element.innerHTML = content; @@ -3756,7 +3736,7 @@ var Tooltip = /*#__PURE__*/function () { return _this3._handlePopperPlacementChange(data); } }; - return _objectSpread2(_objectSpread2({}, defaultBsConfig), this.config.popperConfig); + return _extends({}, defaultBsConfig, this.config.popperConfig); }; _proto._addAttachmentClass = function _addAttachmentClass(attachment) { @@ -3770,7 +3750,7 @@ var Tooltip = /*#__PURE__*/function () { if (typeof this.config.offset === 'function') { offset.fn = function (data) { - data.offsets = _objectSpread2(_objectSpread2({}, data.offsets), _this4.config.offset(data.offsets, _this4.element) || {}); + data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {}); return data; }; } else { @@ -3826,7 +3806,7 @@ var Tooltip = /*#__PURE__*/function () { EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); if (this.config.selector) { - this.config = _objectSpread2(_objectSpread2({}, this.config), {}, { + this.config = _extends({}, this.config, { trigger: 'manual', selector: '' }); @@ -3846,11 +3826,11 @@ var Tooltip = /*#__PURE__*/function () { _proto._enter = function _enter(event, context) { var dataKey = this.constructor.DATA_KEY; - context = context || Data.getData(event.target, dataKey); + context = context || Data.getData(event.delegateTarget, dataKey); if (!context) { - context = new this.constructor(event.target, this._getDelegateConfig()); - Data.setData(event.target, dataKey, context); + context = new this.constructor(event.delegateTarget, this._getDelegateConfig()); + Data.setData(event.delegateTarget, dataKey, context); } if (event) { @@ -3879,11 +3859,11 @@ var Tooltip = /*#__PURE__*/function () { _proto._leave = function _leave(event, context) { var dataKey = this.constructor.DATA_KEY; - context = context || Data.getData(event.target, dataKey); + context = context || Data.getData(event.delegateTarget, dataKey); if (!context) { - context = new this.constructor(event.target, this._getDelegateConfig()); - Data.setData(event.target, dataKey, context); + context = new this.constructor(event.delegateTarget, this._getDelegateConfig()); + Data.setData(event.delegateTarget, dataKey, context); } if (event) { @@ -3931,7 +3911,7 @@ var Tooltip = /*#__PURE__*/function () { config.container = config.container[0]; } - config = _objectSpread2(_objectSpread2(_objectSpread2({}, this.constructor.Default), dataAttributes), typeof config === 'object' && config ? config : {}); + config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); if (typeof config.delay === 'number') { config.delay = { @@ -3951,7 +3931,7 @@ var Tooltip = /*#__PURE__*/function () { typeCheckConfig(NAME$6, config, this.constructor.DefaultType); if (config.sanitize) { - config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); + config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn); } return config; @@ -3985,8 +3965,7 @@ var Tooltip = /*#__PURE__*/function () { }; _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { - var popperInstance = popperData.instance; - this.tip = popperInstance.popper; + this.tip = popperData.instance.popper; this._cleanTipClass(); @@ -4111,14 +4090,14 @@ var EVENT_KEY$7 = "." + DATA_KEY$7; var CLASS_PREFIX$1 = 'bs-popover'; var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); -var Default$5 = _objectSpread2(_objectSpread2({}, Tooltip.Default), {}, { +var Default$5 = _extends({}, Tooltip.Default, { placement: 'right', trigger: 'click', content: '', template: '' }); -var DefaultType$5 = _objectSpread2(_objectSpread2({}, Tooltip.DefaultType), {}, { +var DefaultType$5 = _extends({}, Tooltip.DefaultType, { content: '(string|element|function)' }); @@ -4171,12 +4150,12 @@ var Popover = /*#__PURE__*/function (_Tooltip) { this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content); tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4); - }; + } // Private + ; _proto._addAttachmentClass = function _addAttachmentClass(attachment) { this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment); - } // Private - ; + }; _proto._getContent = function _getContent() { return this.element.getAttribute('data-content') || this.config.content; @@ -4334,7 +4313,7 @@ var ScrollSpy = /*#__PURE__*/function () { this._element = element; this._scrollElement = element.tagName === 'BODY' ? window : element; this._config = this._getConfig(config); - this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM); + this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + ", " + this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM; this._offsets = []; this._targets = []; this._activeTarget = null; @@ -4364,12 +4343,8 @@ var ScrollSpy = /*#__PURE__*/function () { this._scrollHeight = this._getScrollHeight(); var targets = SelectorEngine.find(this._selector); targets.map(function (element) { - var target; var targetSelector = getSelectorFromElement(element); - - if (targetSelector) { - target = SelectorEngine.findOne(targetSelector); - } + var target = targetSelector ? SelectorEngine.findOne(targetSelector) : null; if (target) { var targetBCR = target.getBoundingClientRect(); @@ -4406,7 +4381,7 @@ var ScrollSpy = /*#__PURE__*/function () { ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default$6), typeof config === 'object' && config ? config : {}); + config = _extends({}, Default$6, typeof config === 'object' && config ? config : {}); if (typeof config.target !== 'string' && isElement(config.target)) { var id = config.target.id; @@ -4843,7 +4818,7 @@ var DefaultType$7 = { var Default$7 = { animation: true, autohide: true, - delay: 500 + delay: 5000 }; var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]'; /** @@ -4876,6 +4851,8 @@ var Toast = /*#__PURE__*/function () { return; } + this._clearTimeout(); + if (this._config.animation) { this._element.classList.add(CLASS_NAME_FADE$4); } @@ -4940,8 +4917,7 @@ var Toast = /*#__PURE__*/function () { }; _proto.dispose = function dispose() { - clearTimeout(this._timeout); - this._timeout = null; + this._clearTimeout(); if (this._element.classList.contains(CLASS_NAME_SHOW$6)) { this._element.classList.remove(CLASS_NAME_SHOW$6); @@ -4955,7 +4931,7 @@ var Toast = /*#__PURE__*/function () { ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$7), Manipulator.getDataAttributes(this._element)), typeof config === 'object' && config ? config : {}); + config = _extends({}, Default$7, Manipulator.getDataAttributes(this._element), typeof config === 'object' && config ? config : {}); typeCheckConfig(NAME$a, config, this.constructor.DefaultType); return config; }; @@ -4966,6 +4942,11 @@ var Toast = /*#__PURE__*/function () { EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () { return _this3.hide(); }); + }; + + _proto._clearTimeout = function _clearTimeout() { + clearTimeout(this._timeout); + this._timeout = null; } // Static ; -- cgit v1.2.3