diff options
author | Mario <mario@mariovavti.com> | 2019-12-12 14:51:10 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-12-12 14:51:10 +0000 |
commit | 544ef3bc588d4180d7ecad15bdacd43813a7c5c5 (patch) | |
tree | 62372d0af859287235f62f20d0cf55b5b5b1ace3 /vendor/twbs/bootstrap/js/dist/dropdown.js | |
parent | 124cc4396247c75c14280136cfaa95415860ad4c (diff) | |
download | volse-hubzilla-544ef3bc588d4180d7ecad15bdacd43813a7c5c5.tar.gz volse-hubzilla-544ef3bc588d4180d7ecad15bdacd43813a7c5c5.tar.bz2 volse-hubzilla-544ef3bc588d4180d7ecad15bdacd43813a7c5c5.zip |
update composer libs and minor notifications display fixes
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/dropdown.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/dropdown.js | 129 |
1 files changed, 75 insertions, 54 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/dropdown.js b/vendor/twbs/bootstrap/js/dist/dropdown.js index 32aff75c1..3557cecba 100644 --- a/vendor/twbs/bootstrap/js/dist/dropdown.js +++ b/vendor/twbs/bootstrap/js/dist/dropdown.js @@ -1,5 +1,5 @@ /*! - * Bootstrap dropdown.js v4.3.1 (https://getbootstrap.com/) + * Bootstrap dropdown.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('popper.js'), require('./util.js')) : typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util.js'], factory) : (global = global || self, global.Dropdown = factory(global.jQuery, global.Popper, global.Util)); -}(this, function ($, Popper, Util) { 'use strict'; +}(this, (function ($, Popper, Util) { 'use strict'; $ = $ && $.hasOwnProperty('default') ? $['default'] : $; Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; @@ -44,20 +44,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; @@ -70,7 +85,7 @@ */ var NAME = 'dropdown'; - var VERSION = '4.3.1'; + var VERSION = '4.4.1'; var DATA_KEY = 'bs.dropdown'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -130,21 +145,22 @@ flip: true, boundary: 'scrollParent', reference: 'toggle', - display: 'dynamic' + display: 'dynamic', + popperConfig: null }; var DefaultType = { offset: '(number|string|function)', flip: 'boolean', boundary: '(string|element)', reference: '(string|element)', - display: 'string' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - + display: 'string', + popperConfig: '(null|object)' }; + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ var Dropdown = /*#__PURE__*/ @@ -168,8 +184,6 @@ return; } - var parent = Dropdown._getParentFromElement(this._element); - var isActive = $(this._menu).hasClass(ClassName.SHOW); Dropdown._clearMenus(); @@ -178,10 +192,25 @@ return; } + this.show(true); + }; + + _proto.show = function show(usePopper) { + if (usePopper === void 0) { + usePopper = false; + } + + if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || $(this._menu).hasClass(ClassName.SHOW)) { + return; + } + var relatedTarget = { relatedTarget: this._element }; var showEvent = $.Event(Event.SHOW, relatedTarget); + + var parent = Dropdown._getParentFromElement(this._element); + $(parent).trigger(showEvent); if (showEvent.isDefaultPrevented()) { @@ -189,7 +218,7 @@ } // Disable totally Popper.js for Dropdown in Navbar - if (!this._inNavbar) { + if (!this._inNavbar && usePopper) { /** * Check for Popper dependency * Popper - https://popper.js.org @@ -236,28 +265,6 @@ $(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget)); }; - _proto.show = function show() { - if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || $(this._menu).hasClass(ClassName.SHOW)) { - return; - } - - var relatedTarget = { - relatedTarget: this._element - }; - var showEvent = $.Event(Event.SHOW, relatedTarget); - - var parent = Dropdown._getParentFromElement(this._element); - - $(parent).trigger(showEvent); - - if (showEvent.isDefaultPrevented()) { - return; - } - - $(this._menu).toggleClass(ClassName.SHOW); - $(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget)); - }; - _proto.hide = function hide() { if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || !$(this._menu).hasClass(ClassName.SHOW)) { return; @@ -276,6 +283,10 @@ return; } + if (this._popper) { + this._popper.destroy(); + } + $(this._menu).toggleClass(ClassName.SHOW); $(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget)); }; @@ -314,7 +325,7 @@ }; _proto._getConfig = function _getConfig(config) { - config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config); + config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config); Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); return config; }; @@ -363,7 +374,7 @@ if (typeof this._config.offset === 'function') { offset.fn = function (data) { - data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); + data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {}); return data; }; } else { @@ -384,9 +395,8 @@ preventOverflow: { boundariesElement: this._config.boundary } - } // Disable Popper.js if we have a static display - - }; + } + }; // Disable Popper.js if we have a static display if (this._config.display === 'static') { popperConfig.modifiers.applyStyle = { @@ -394,7 +404,7 @@ }; } - return popperConfig; + return _objectSpread2({}, popperConfig, {}, this._config.popperConfig); } // Static ; @@ -466,6 +476,11 @@ } toggles[i].setAttribute('aria-expanded', 'false'); + + if (context._popper) { + context._popper.destroy(); + } + $(dropdownMenu).removeClass(ClassName.SHOW); $(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget)); } @@ -506,6 +521,10 @@ var isActive = $(parent).hasClass(ClassName.SHOW); + if (!isActive && event.which === ESCAPE_KEYCODE) { + return; + } + if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { if (event.which === ESCAPE_KEYCODE) { var toggle = parent.querySelector(Selector.DATA_TOGGLE); @@ -516,7 +535,9 @@ return; } - var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS)); + var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS)).filter(function (item) { + return $(item).is(':visible'); + }); if (items.length === 0) { return; @@ -591,5 +612,5 @@ return Dropdown; -})); +}))); //# sourceMappingURL=dropdown.js.map |