mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-18 14:02:15 +00:00
6 lines
7.7 KiB
JavaScript
6 lines
7.7 KiB
JavaScript
/*!
|
|
* Bootstrap dropdown.js v4.6.0 (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(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery"),require("popper.js"),require("./util.js")):"function"==typeof define&&define.amd?define(["jquery","popper.js","./util"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Dropdown=t(e.jQuery,e.Popper,e.Util)}(this,(function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(e),i=r(t),a=r(n);function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var f="dropdown",u="bs.dropdown",d="."+u,h=o.default.fn[f],p=new RegExp("38|40|27"),c="hide"+d,g="hidden"+d,m="click.bs.dropdown.data-api",_="keydown.bs.dropdown.data-api",v="disabled",y="show",b="dropdown-menu-right",w='[data-toggle="dropdown"]',C=".dropdown-menu",E={offset:0,flip:!0,boundary:"scrollParent",reference:"toggle",display:"dynamic",popperConfig:null},P={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string",popperConfig:"(null|object)"},j=function(){function e(e,t){this._element=e,this._popper=null,this._config=this._getConfig(t),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var t,n,r,h=e.prototype;return h.toggle=function(){if(!this._element.disabled&&!o.default(this._element).hasClass(v)){var t=o.default(this._menu).hasClass(y);e._clearMenus(),t||this.show(!0)}},h.show=function(t){if(void 0===t&&(t=!1),!(this._element.disabled||o.default(this._element).hasClass(v)||o.default(this._menu).hasClass(y))){var n={relatedTarget:this._element},r=o.default.Event("show.bs.dropdown",n),l=e._getParentFromElement(this._element);if(o.default(l).trigger(r),!r.isDefaultPrevented()){if(!this._inNavbar&&t){if(void 0===i.default)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");var s=this._element;"parent"===this._config.reference?s=l:a.default.isElement(this._config.reference)&&(s=this._config.reference,void 0!==this._config.reference.jquery&&(s=this._config.reference[0])),"scrollParent"!==this._config.boundary&&o.default(l).addClass("position-static"),this._popper=new i.default(s,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===o.default(l).closest(".navbar-nav").length&&o.default(document.body).children().on("mouseover",null,o.default.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),o.default(this._menu).toggleClass(y),o.default(l).toggleClass(y).trigger(o.default.Event("shown.bs.dropdown",n))}}},h.hide=function(){if(!this._element.disabled&&!o.default(this._element).hasClass(v)&&o.default(this._menu).hasClass(y)){var t={relatedTarget:this._element},n=o.default.Event(c,t),r=e._getParentFromElement(this._element);o.default(r).trigger(n),n.isDefaultPrevented()||(this._popper&&this._popper.destroy(),o.default(this._menu).toggleClass(y),o.default(r).toggleClass(y).trigger(o.default.Event(g,t)))}},h.dispose=function(){o.default.removeData(this._element,u),o.default(this._element).off(d),this._element=null,this._menu=null,null!==this._popper&&(this._popper.destroy(),this._popper=null)},h.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},h._addEventListeners=function(){var e=this;o.default(this._element).on("click.bs.dropdown",(function(t){t.preventDefault(),t.stopPropagation(),e.toggle()}))},h._getConfig=function(e){return e=s({},this.constructor.Default,o.default(this._element).data(),e),a.default.typeCheckConfig(f,e,this.constructor.DefaultType),e},h._getMenuElement=function(){if(!this._menu){var t=e._getParentFromElement(this._element);t&&(this._menu=t.querySelector(C))}return this._menu},h._getPlacement=function(){var e=o.default(this._element.parentNode),t="bottom-start";return e.hasClass("dropup")?t=o.default(this._menu).hasClass(b)?"top-end":"top-start":e.hasClass("dropright")?t="right-start":e.hasClass("dropleft")?t="left-start":o.default(this._menu).hasClass(b)&&(t="bottom-end"),t},h._detectNavbar=function(){return o.default(this._element).closest(".navbar").length>0},h._getOffset=function(){var e=this,t={};return"function"==typeof this._config.offset?t.fn=function(t){return t.offsets=s({},t.offsets,e._config.offset(t.offsets,e._element)||{}),t}:t.offset=this._config.offset,t},h._getPopperConfig=function(){var e={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(e.modifiers.applyStyle={enabled:!1}),s({},e,this._config.popperConfig)},e._jQueryInterface=function(t){return this.each((function(){var n=o.default(this).data(u);if(n||(n=new e(this,"object"==typeof t?t:null),o.default(this).data(u,n)),"string"==typeof t){if(void 0===n[t])throw new TypeError('No method named "'+t+'"');n[t]()}}))},e._clearMenus=function(t){if(!t||3!==t.which&&("keyup"!==t.type||9===t.which))for(var n=[].slice.call(document.querySelectorAll(w)),r=0,i=n.length;r<i;r++){var a=e._getParentFromElement(n[r]),l=o.default(n[r]).data(u),s={relatedTarget:n[r]};if(t&&"click"===t.type&&(s.clickEvent=t),l){var f=l._menu;if(o.default(a).hasClass(y)&&!(t&&("click"===t.type&&/input|textarea/i.test(t.target.tagName)||"keyup"===t.type&&9===t.which)&&o.default.contains(a,t.target))){var d=o.default.Event(c,s);o.default(a).trigger(d),d.isDefaultPrevented()||("ontouchstart"in document.documentElement&&o.default(document.body).children().off("mouseover",null,o.default.noop),n[r].setAttribute("aria-expanded","false"),l._popper&&l._popper.destroy(),o.default(f).removeClass(y),o.default(a).removeClass(y).trigger(o.default.Event(g,s)))}}}},e._getParentFromElement=function(e){var t,n=a.default.getSelectorFromElement(e);return n&&(t=document.querySelector(n)),t||e.parentNode},e._dataApiKeydownHandler=function(t){if(!(/input|textarea/i.test(t.target.tagName)?32===t.which||27!==t.which&&(40!==t.which&&38!==t.which||o.default(t.target).closest(C).length):!p.test(t.which))&&!this.disabled&&!o.default(this).hasClass(v)){var n=e._getParentFromElement(this),r=o.default(n).hasClass(y);if(r||27!==t.which){if(t.preventDefault(),t.stopPropagation(),!r||27===t.which||32===t.which)return 27===t.which&&o.default(n.querySelector(w)).trigger("focus"),void o.default(this).trigger("click");var i=[].slice.call(n.querySelectorAll(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)")).filter((function(e){return o.default(e).is(":visible")}));if(0!==i.length){var a=i.indexOf(t.target);38===t.which&&a>0&&a--,40===t.which&&a<i.length-1&&a++,a<0&&(a=0),i[a].focus()}}}},t=e,r=[{key:"VERSION",get:function(){return"4.6.0"}},{key:"Default",get:function(){return E}},{key:"DefaultType",get:function(){return P}}],(n=null)&&l(t.prototype,n),r&&l(t,r),e}();return o.default(document).on(_,w,j._dataApiKeydownHandler).on(_,C,j._dataApiKeydownHandler).on(m+" keyup.bs.dropdown.data-api",j._clearMenus).on(m,w,(function(e){e.preventDefault(),e.stopPropagation(),j._jQueryInterface.call(o.default(this),"toggle")})).on(m,".dropdown form",(function(e){e.stopPropagation()})),o.default.fn[f]=j._jQueryInterface,o.default.fn[f].Constructor=j,o.default.fn[f].noConflict=function(){return o.default.fn[f]=h,j._jQueryInterface},j})); |