mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 13:32:15 +00:00
6 lines
11 KiB
JavaScript
6 lines
11 KiB
JavaScript
/*!
|
|
* Bootstrap modal.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("./util.js")):"function"==typeof define&&define.amd?define(["jquery","./util"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Modal=t(e.jQuery,e.Util)}(this,(function(e,t){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e),a=i(t);function o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var s="modal",d="bs.modal",r=".bs.modal",u=n.default.fn.modal,h={backdrop:!0,keyboard:!0,focus:!0,show:!0},f={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},c="hidden.bs.modal",m="show.bs.modal",_="focusin.bs.modal",g="resize.bs.modal",p="click.dismiss.bs.modal",b="keydown.dismiss.bs.modal",v="mousedown.dismiss.bs.modal",y="modal-open",k="fade",w="show",T="modal-static",E=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",S=".sticky-top",N=function(){function e(e,t){this._config=this._getConfig(t),this._element=e,this._dialog=e.querySelector(".modal-dialog"),this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollbarWidth=0}var t,i,u,N=e.prototype;return N.toggle=function(e){return this._isShown?this.hide():this.show(e)},N.show=function(e){var t=this;if(!this._isShown&&!this._isTransitioning){n.default(this._element).hasClass(k)&&(this._isTransitioning=!0);var i=n.default.Event(m,{relatedTarget:e});n.default(this._element).trigger(i),this._isShown||i.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),n.default(this._element).on(p,'[data-dismiss="modal"]',(function(e){return t.hide(e)})),n.default(this._dialog).on(v,(function(){n.default(t._element).one("mouseup.dismiss.bs.modal",(function(e){n.default(e.target).is(t._element)&&(t._ignoreBackdropClick=!0)}))})),this._showBackdrop((function(){return t._showElement(e)})))}},N.hide=function(e){var t=this;if(e&&e.preventDefault(),this._isShown&&!this._isTransitioning){var i=n.default.Event("hide.bs.modal");if(n.default(this._element).trigger(i),this._isShown&&!i.isDefaultPrevented()){this._isShown=!1;var o=n.default(this._element).hasClass(k);if(o&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),n.default(document).off(_),n.default(this._element).removeClass(w),n.default(this._element).off(p),n.default(this._dialog).off(v),o){var l=a.default.getTransitionDurationFromElement(this._element);n.default(this._element).one(a.default.TRANSITION_END,(function(e){return t._hideModal(e)})).emulateTransitionEnd(l)}else this._hideModal()}}},N.dispose=function(){[window,this._element,this._dialog].forEach((function(e){return n.default(e).off(r)})),n.default(document).off(_),n.default.removeData(this._element,d),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._isTransitioning=null,this._scrollbarWidth=null},N.handleUpdate=function(){this._adjustDialog()},N._getConfig=function(e){return e=l({},h,e),a.default.typeCheckConfig(s,e,f),e},N._triggerBackdropTransition=function(){var e=this,t=n.default.Event("hidePrevented.bs.modal");if(n.default(this._element).trigger(t),!t.isDefaultPrevented()){var i=this._element.scrollHeight>document.documentElement.clientHeight;i||(this._element.style.overflowY="hidden"),this._element.classList.add(T);var o=a.default.getTransitionDurationFromElement(this._dialog);n.default(this._element).off(a.default.TRANSITION_END),n.default(this._element).one(a.default.TRANSITION_END,(function(){e._element.classList.remove(T),i||n.default(e._element).one(a.default.TRANSITION_END,(function(){e._element.style.overflowY=""})).emulateTransitionEnd(e._element,o)})).emulateTransitionEnd(o),this._element.focus()}},N._showElement=function(e){var t=this,i=n.default(this._element).hasClass(k),o=this._dialog?this._dialog.querySelector(".modal-body"):null;this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),n.default(this._dialog).hasClass("modal-dialog-scrollable")&&o?o.scrollTop=0:this._element.scrollTop=0,i&&a.default.reflow(this._element),n.default(this._element).addClass(w),this._config.focus&&this._enforceFocus();var l=n.default.Event("shown.bs.modal",{relatedTarget:e}),s=function(){t._config.focus&&t._element.focus(),t._isTransitioning=!1,n.default(t._element).trigger(l)};if(i){var d=a.default.getTransitionDurationFromElement(this._dialog);n.default(this._dialog).one(a.default.TRANSITION_END,s).emulateTransitionEnd(d)}else s()},N._enforceFocus=function(){var e=this;n.default(document).off(_).on(_,(function(t){document!==t.target&&e._element!==t.target&&0===n.default(e._element).has(t.target).length&&e._element.focus()}))},N._setEscapeEvent=function(){var e=this;this._isShown?n.default(this._element).on(b,(function(t){e._config.keyboard&&27===t.which?(t.preventDefault(),e.hide()):e._config.keyboard||27!==t.which||e._triggerBackdropTransition()})):this._isShown||n.default(this._element).off(b)},N._setResizeEvent=function(){var e=this;this._isShown?n.default(window).on(g,(function(t){return e.handleUpdate(t)})):n.default(window).off(g)},N._hideModal=function(){var e=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._showBackdrop((function(){n.default(document.body).removeClass(y),e._resetAdjustments(),e._resetScrollbar(),n.default(e._element).trigger(c)}))},N._removeBackdrop=function(){this._backdrop&&(n.default(this._backdrop).remove(),this._backdrop=null)},N._showBackdrop=function(e){var t=this,i=n.default(this._element).hasClass(k)?k:"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className="modal-backdrop",i&&this._backdrop.classList.add(i),n.default(this._backdrop).appendTo(document.body),n.default(this._element).on(p,(function(e){t._ignoreBackdropClick?t._ignoreBackdropClick=!1:e.target===e.currentTarget&&("static"===t._config.backdrop?t._triggerBackdropTransition():t.hide())})),i&&a.default.reflow(this._backdrop),n.default(this._backdrop).addClass(w),!e)return;if(!i)return void e();var o=a.default.getTransitionDurationFromElement(this._backdrop);n.default(this._backdrop).one(a.default.TRANSITION_END,e).emulateTransitionEnd(o)}else if(!this._isShown&&this._backdrop){n.default(this._backdrop).removeClass(w);var l=function(){t._removeBackdrop(),e&&e()};if(n.default(this._element).hasClass(k)){var s=a.default.getTransitionDurationFromElement(this._backdrop);n.default(this._backdrop).one(a.default.TRANSITION_END,l).emulateTransitionEnd(s)}else l()}else e&&e()},N._adjustDialog=function(){var e=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&e&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!e&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},N._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},N._checkScrollbar=function(){var e=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(e.left+e.right)<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},N._setScrollbar=function(){var e=this;if(this._isBodyOverflowing){var t=[].slice.call(document.querySelectorAll(E)),i=[].slice.call(document.querySelectorAll(S));n.default(t).each((function(t,i){var a=i.style.paddingRight,o=n.default(i).css("padding-right");n.default(i).data("padding-right",a).css("padding-right",parseFloat(o)+e._scrollbarWidth+"px")})),n.default(i).each((function(t,i){var a=i.style.marginRight,o=n.default(i).css("margin-right");n.default(i).data("margin-right",a).css("margin-right",parseFloat(o)-e._scrollbarWidth+"px")}));var a=document.body.style.paddingRight,o=n.default(document.body).css("padding-right");n.default(document.body).data("padding-right",a).css("padding-right",parseFloat(o)+this._scrollbarWidth+"px")}n.default(document.body).addClass(y)},N._resetScrollbar=function(){var e=[].slice.call(document.querySelectorAll(E));n.default(e).each((function(e,t){var i=n.default(t).data("padding-right");n.default(t).removeData("padding-right"),t.style.paddingRight=i||""}));var t=[].slice.call(document.querySelectorAll(".sticky-top"));n.default(t).each((function(e,t){var i=n.default(t).data("margin-right");void 0!==i&&n.default(t).css("margin-right",i).removeData("margin-right")}));var i=n.default(document.body).data("padding-right");n.default(document.body).removeData("padding-right"),document.body.style.paddingRight=i||""},N._getScrollbarWidth=function(){var e=document.createElement("div");e.className="modal-scrollbar-measure",document.body.appendChild(e);var t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t},e._jQueryInterface=function(t,i){return this.each((function(){var a=n.default(this).data(d),o=l({},h,n.default(this).data(),"object"==typeof t&&t?t:{});if(a||(a=new e(this,o),n.default(this).data(d,a)),"string"==typeof t){if(void 0===a[t])throw new TypeError('No method named "'+t+'"');a[t](i)}else o.show&&a.show(i)}))},t=e,u=[{key:"VERSION",get:function(){return"4.6.0"}},{key:"Default",get:function(){return h}}],(i=null)&&o(t.prototype,i),u&&o(t,u),e}();return n.default(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',(function(e){var t,i=this,o=a.default.getSelectorFromElement(this);o&&(t=document.querySelector(o));var s=n.default(t).data(d)?"toggle":l({},n.default(t).data(),n.default(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||e.preventDefault();var r=n.default(t).one(m,(function(e){e.isDefaultPrevented()||r.one(c,(function(){n.default(i).is(":visible")&&i.focus()}))}));N._jQueryInterface.call(n.default(t),s,this)})),n.default.fn.modal=N._jQueryInterface,n.default.fn.modal.Constructor=N,n.default.fn.modal.noConflict=function(){return n.default.fn.modal=u,N._jQueryInterface},N})); |