You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
9.8 KiB
1 lines
9.8 KiB
define(["exports","jquery","./util"],function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function f(){return f=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},f.apply(this,arguments)}function g(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function h(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function i(a,b,c){return b&&h(a.prototype,b),c&&h(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var j=d(b),k=d(c),l=function(a){var b="modal",c="4.0.0",d="bs.modal",h=".".concat(d),j=".data-api",l=a.fn[b],m=300,n=150,o=27,p={backdrop:!0,keyboard:!0,focus:!0,show:!0},q={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},r={HIDE:"hide".concat(h),HIDDEN:"hidden".concat(h),SHOW:"show".concat(h),SHOWN:"shown".concat(h),FOCUSIN:"focusin".concat(h),RESIZE:"resize".concat(h),CLICK_DISMISS:"click.dismiss".concat(h),KEYDOWN_DISMISS:"keydown.dismiss".concat(h),MOUSEUP_DISMISS:"mouseup.dismiss".concat(h),MOUSEDOWN_DISMISS:"mousedown.dismiss".concat(h),CLICK_DATA_API:"click".concat(h).concat(j)},s={SCROLLBAR_MEASURER:"modal-scrollbar-measure",BACKDROP:"modal-backdrop",OPEN:"modal-open",FADE:"fade",SHOW:"show"},t={DIALOG:".modal-dialog",DATA_TOGGLE:'[data-toggle="modal"]',DATA_DISMISS:'[data-dismiss="modal"]',FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top",NAVBAR_TOGGLER:".navbar-toggler"},u=function(){function j(b,c){g(this,j),this._config=this._getConfig(c),this._element=b,this._dialog=a(b).find(t.DIALOG)[0],this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._originalBodyPadding=0,this._scrollbarWidth=0}return i(j,[{key:"toggle",value:function(a){return this._isShown?this.hide():this.show(a)}},{key:"show",value:function(b){var c=this;if(!this._isTransitioning&&!this._isShown){k["default"].supportsTransitionEnd()&&a(this._element).hasClass(s.FADE)&&(this._isTransitioning=!0);var d=a.Event(r.SHOW,{relatedTarget:b});a(this._element).trigger(d),this._isShown||d.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),a(document.body).addClass(s.OPEN),this._setEscapeEvent(),this._setResizeEvent(),a(this._element).on(r.CLICK_DISMISS,t.DATA_DISMISS,function(a){return c.hide(a)}),a(this._dialog).on(r.MOUSEDOWN_DISMISS,function(){a(c._element).one(r.MOUSEUP_DISMISS,function(b){a(b.target).is(c._element)&&(c._ignoreBackdropClick=!0)})}),this._showBackdrop(function(){return c._showElement(b)}))}}},{key:"hide",value:function(b){var c=this;if(b&&b.preventDefault(),!this._isTransitioning&&this._isShown){var d=a.Event(r.HIDE);if(a(this._element).trigger(d),this._isShown&&!d.isDefaultPrevented()){this._isShown=!1;var e=k["default"].supportsTransitionEnd()&&a(this._element).hasClass(s.FADE);e&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),a(document).off(r.FOCUSIN),a(this._element).removeClass(s.SHOW),a(this._element).off(r.CLICK_DISMISS),a(this._dialog).off(r.MOUSEDOWN_DISMISS),e?a(this._element).one(k["default"].TRANSITION_END,function(a){return c._hideModal(a)}).emulateTransitionEnd(m):this._hideModal()}}}},{key:"dispose",value:function(){a.removeData(this._element,d),a(window,document,this._element,this._backdrop).off(h),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._scrollbarWidth=null}},{key:"handleUpdate",value:function(){this._adjustDialog()}},{key:"_getConfig",value:function(a){return a=f({},p,a),k["default"].typeCheckConfig(b,a,q),a}},{key:"_showElement",value:function(b){var c=this,d=k["default"].supportsTransitionEnd()&&a(this._element).hasClass(s.FADE);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.scrollTop=0,d&&k["default"].reflow(this._element),a(this._element).addClass(s.SHOW),this._config.focus&&this._enforceFocus();var e=a.Event(r.SHOWN,{relatedTarget:b}),f=function(){c._config.focus&&c._element.focus(),c._isTransitioning=!1,a(c._element).trigger(e)};d?a(this._dialog).one(k["default"].TRANSITION_END,f).emulateTransitionEnd(m):f()}},{key:"_enforceFocus",value:function(){var b=this;a(document).off(r.FOCUSIN).on(r.FOCUSIN,function(c){document!==c.target&&b._element!==c.target&&0===a(b._element).has(c.target).length&&b._element.focus()})}},{key:"_setEscapeEvent",value:function(){var b=this;this._isShown&&this._config.keyboard?a(this._element).on(r.KEYDOWN_DISMISS,function(a){a.which===o&&(a.preventDefault(),b.hide())}):this._isShown||a(this._element).off(r.KEYDOWN_DISMISS)}},{key:"_setResizeEvent",value:function(){var b=this;this._isShown?a(window).on(r.RESIZE,function(a){return b.handleUpdate(a)}):a(window).off(r.RESIZE)}},{key:"_hideModal",value:function(){var b=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1,this._showBackdrop(function(){a(document.body).removeClass(s.OPEN),b._resetAdjustments(),b._resetScrollbar(),a(b._element).trigger(r.HIDDEN)})}},{key:"_removeBackdrop",value:function(){this._backdrop&&(a(this._backdrop).remove(),this._backdrop=null)}},{key:"_showBackdrop",value:function(b){var c=this,d=a(this._element).hasClass(s.FADE)?s.FADE:"";if(this._isShown&&this._config.backdrop){var e=k["default"].supportsTransitionEnd()&&d;if(this._backdrop=document.createElement("div"),this._backdrop.className=s.BACKDROP,d&&a(this._backdrop).addClass(d),a(this._backdrop).appendTo(document.body),a(this._element).on(r.CLICK_DISMISS,function(a){return c._ignoreBackdropClick?void(c._ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"===c._config.backdrop?c._element.focus():c.hide()))}),e&&k["default"].reflow(this._backdrop),a(this._backdrop).addClass(s.SHOW),!b)return;if(!e)return void b();a(this._backdrop).one(k["default"].TRANSITION_END,b).emulateTransitionEnd(n)}else if(!this._isShown&&this._backdrop){a(this._backdrop).removeClass(s.SHOW);var f=function(){c._removeBackdrop(),b&&b()};k["default"].supportsTransitionEnd()&&a(this._element).hasClass(s.FADE)?a(this._backdrop).one(k["default"].TRANSITION_END,f).emulateTransitionEnd(n):f()}else b&&b()}},{key:"_adjustDialog",value:function(){var a=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&a&&(this._element.style.paddingLeft="".concat(this._scrollbarWidth,"px")),this._isBodyOverflowing&&!a&&(this._element.style.paddingRight="".concat(this._scrollbarWidth,"px"))}},{key:"_resetAdjustments",value:function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}},{key:"_checkScrollbar",value:function(){var a=document.body.getBoundingClientRect();this._isBodyOverflowing=a.left+a.right<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()}},{key:"_setScrollbar",value:function(){var b=this;if(this._isBodyOverflowing){a(t.FIXED_CONTENT).each(function(c,d){var e=a(d)[0].style.paddingRight,f=a(d).css("padding-right");a(d).data("padding-right",e).css("padding-right","".concat(parseFloat(f)+b._scrollbarWidth,"px"))}),a(t.STICKY_CONTENT).each(function(c,d){var e=a(d)[0].style.marginRight,f=a(d).css("margin-right");a(d).data("margin-right",e).css("margin-right","".concat(parseFloat(f)-b._scrollbarWidth,"px"))}),a(t.NAVBAR_TOGGLER).each(function(c,d){var e=a(d)[0].style.marginRight,f=a(d).css("margin-right");a(d).data("margin-right",e).css("margin-right","".concat(parseFloat(f)+b._scrollbarWidth,"px"))});var c=document.body.style.paddingRight,d=a("body").css("padding-right");a("body").data("padding-right",c).css("padding-right","".concat(parseFloat(d)+this._scrollbarWidth,"px"))}}},{key:"_resetScrollbar",value:function(){a(t.FIXED_CONTENT).each(function(b,c){var d=a(c).data("padding-right");"undefined"!=typeof d&&a(c).css("padding-right",d).removeData("padding-right")}),a("".concat(t.STICKY_CONTENT,", ").concat(t.NAVBAR_TOGGLER)).each(function(b,c){var d=a(c).data("margin-right");"undefined"!=typeof d&&a(c).css("margin-right",d).removeData("margin-right")});var b=a("body").data("padding-right");"undefined"!=typeof b&&a("body").css("padding-right",b).removeData("padding-right")}},{key:"_getScrollbarWidth",value:function(){var a=document.createElement("div");a.className=s.SCROLLBAR_MEASURER,document.body.appendChild(a);var b=a.getBoundingClientRect().width-a.clientWidth;return document.body.removeChild(a),b}}],[{key:"_jQueryInterface",value:function(b,c){return this.each(function(){var g=a(this).data(d),h=f({},j.Default,a(this).data(),"object"===e(b)&&b);if(g||(g=new j(this,h),a(this).data(d,g)),"string"==typeof b){if("undefined"==typeof g[b])throw new TypeError('No method named "'.concat(b,'"'));g[b](c)}else h.show&&g.show(c)})}},{key:"VERSION",get:function(){return c}},{key:"Default",get:function(){return p}}]),j}();return a(document).on(r.CLICK_DATA_API,t.DATA_TOGGLE,function(b){var c,e=this,g=k["default"].getSelectorFromElement(this);g&&(c=a(g)[0]);var h=a(c).data(d)?"toggle":f({},a(c).data(),a(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||b.preventDefault();var i=a(c).one(r.SHOW,function(b){b.isDefaultPrevented()||i.one(r.HIDDEN,function(){a(e).is(":visible")&&e.focus()})});u._jQueryInterface.call(a(c),h,this)}),a.fn[b]=u._jQueryInterface,a.fn[b].Constructor=u,a.fn[b].noConflict=function(){return a.fn[b]=l,u._jQueryInterface},u}(j["default"]);a["default"]=l});
|