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 line
7.1 KiB
1 line
7.1 KiB
6 years ago
|
define(["exports","jquery","core/popper","./util"],function(a,b,c,d){"use strict";function e(a){return a&&a.__esModule?a:{"default":a}}function f(a){return(f="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 g(){return g=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},g.apply(this,arguments)}function h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function i(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 j(a,b,c){return b&&i(a.prototype,b),c&&i(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var k=e(b),l=e(c),m=e(d),n=function(a){var b="dropdown",c="4.0.0",d="bs.dropdown",e=".".concat(d),i=".data-api",k=a.fn[b],n=27,o=32,p=9,q=38,r=40,s=3,t=new RegExp("".concat(q,"|").concat(r,"|").concat(n)),u={HIDE:"hide".concat(e),HIDDEN:"hidden".concat(e),SHOW:"show".concat(e),SHOWN:"shown".concat(e),CLICK:"click".concat(e),CLICK_DATA_API:"click".concat(e).concat(i),KEYDOWN_DATA_API:"keydown".concat(e).concat(i),KEYUP_DATA_API:"keyup".concat(e).concat(i)},v={DISABLED:"disabled",SHOW:"show",DROPUP:"dropup",DROPRIGHT:"dropright",DROPLEFT:"dropleft",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",POSITION_STATIC:"position-static"},w={DATA_TOGGLE:'[data-toggle="dropdown"]',FORM_CHILD:".dropdown form",MENU:".dropdown-menu",NAVBAR_NAV:".navbar-nav",VISIBLE_ITEMS:".dropdown-menu .dropdown-item:not(.disabled)"},x={TOP:"top-start",TOPEND:"top-end",BOTTOM:"bottom-start",BOTTOMEND:"bottom-end",RIGHT:"right-start",RIGHTEND:"right-end",LEFT:"left-start",LEFTEND:"left-end"},y={offset:0,flip:!1,boundary:"scrollParent"},z={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)"},A=function(){function i(a,b){h(this,i),this._element=a,this._popper=null,this._config=this._getConfig(b),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}return j(i,[{key:"toggle",value:function(){if(!this._element.disabled&&!a(this._element).hasClass(v.DISABLED)){var b=i._getParentFromElement(this._element),c=a(this._menu).hasClass(v.SHOW);if(i._clearMenus(),!c){var d={relatedTarget:this._element},e=a.Event(u.SHOW,d);if(a(b).trigger(e),!e.isDefaultPrevented()){if(!this._inNavbar){if("undefined"==typeof l["default"])throw new TypeError("Bootstrap dropdown require Popper.js (https://popper.js.org)");var f=this._element;a(b).hasClass(v.DROPUP)&&(a(this._menu).hasClass(v.MENULEFT)||a(this._menu).hasClass(v.MENURIGHT))&&(f=b),"scrollParent"!==this._config.boundary&&a(b).addClass(v.POSITION_STATIC),this._popper=new l["default"](f,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===a(b).closest(w.NAVBAR_NAV).length&&a("body").children().on("mouseover",null,a.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),a(this._menu).toggleClass(v.SHOW),a(b).toggleClass(v.SHOW).trigger(a.Event(u.SHOWN,d))}}}}},{key:"dispose",value:function(){a.removeData(this._element,d),a(this._element).off(e),this._element=null,this._menu=null,null!==this._popper&&(this._popper.destroy(),this._popper=null)}},{key:"update",value:function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()}},{key:"_addEventListeners",value:function(){var b=this;a(this._element).on(u.CLICK,function(a){a.preventDefault(),a.stopPropagation(),b.toggle()})}},{key:"_getConfig",value:function(c){return c=g({},this.constructor.Default,a(this._element).data(),c),m["default"].typeCheckConfig(b,c,this.constructor.DefaultType),c}},{key:"_getMenuElement",value:function(){if(!this._menu){var b=i._getParentFromElement(this._element);this._menu=a(b).find(w.MENU)[0]}return this._menu}},{key:"_getPlacement",value:function(){var b=a(this._e
|