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
11 KiB

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(){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){return(g="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 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="tooltip",c="4.0.0",d="bs.tooltip",e=".".concat(d),i=a.fn[b],k=150,n="bs-tooltip",o=new RegExp("(^|\\s)".concat(n,"\\S+"),"g"),p={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)"},q={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},r={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent"},s={SHOW:"show",OUT:"out"},t={HIDE:"hide".concat(e),HIDDEN:"hidden".concat(e),SHOW:"show".concat(e),SHOWN:"shown".concat(e),INSERTED:"inserted".concat(e),CLICK:"click".concat(e),FOCUSIN:"focusin".concat(e),FOCUSOUT:"focusout".concat(e),MOUSEENTER:"mouseenter".concat(e),MOUSELEAVE:"mouseleave".concat(e)},u={FADE:"fade",SHOW:"show"},v={TOOLTIP:".tooltip",TOOLTIP_INNER:".tooltip-inner",ARROW:".arrow"},w={HOVER:"hover",FOCUS:"focus",CLICK:"click",MANUAL:"manual"},x=function(){function i(a,b){if(h(this,i),"undefined"==typeof l["default"])throw new TypeError("Bootstrap tooltips require Popper.js (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=a,this.config=this._getConfig(b),this.tip=null,this._setListeners()}return j(i,[{key:"enable",value:function(){this._isEnabled=!0}},{key:"disable",value:function(){this._isEnabled=!1}},{key:"toggleEnabled",value:function(){this._isEnabled=!this._isEnabled}},{key:"toggle",value:function(b){if(this._isEnabled)if(b){var c=this.constructor.DATA_KEY,d=a(b.currentTarget).data(c);d||(d=new this.constructor(b.currentTarget,this._getDelegateConfig()),a(b.currentTarget).data(c,d)),d._activeTrigger.click=!d._activeTrigger.click,d._isWithActiveTrigger()?d._enter(null,d):d._leave(null,d)}else{if(a(this.getTipElement()).hasClass(u.SHOW))return void this._leave(null,this);this._enter(null,this)}}},{key:"dispose",value:function(){clearTimeout(this._timeout),a.removeData(this.element,this.constructor.DATA_KEY),a(this.element).off(this.constructor.EVENT_KEY),a(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&a(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,null!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null}},{key:"show",value:function(){var b=this;if("none"===a(this.element).css("display"))throw new Error("Please use show on visible elements");var c=a.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){a(this.element).trigger(c);var d=a.contains(this.element.ownerDocument.documentElement,this.element);if(c.isDefaultPrevented()||!d)return;var e=this.getTipElement(),f=m["default"].getUID(this.constructor.NAME);e.setAttribute("id",f),this.element.setAttribute("aria-describedby",f),this.setContent(),this.config.animation&&a(e).addClass(u.FADE);var g="function"==typeof this.config.placement?this.config.placement.call(this,e,this.element):this.config.placement,h=this._getAttachment(g);this.addAttachmentClass(h);var j=this.config.container===!1?document.body:a(this.config.container);a(e).data(this.constructor.DATA_KEY,this),a.contains(this.element.ownerDocument.documentElement,this.tip)||a(e).appendTo(j),a(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new l["default"](this.element,e,{placement:h,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:v.ARROW},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(a){a.originalPlacement!==a.placement&&b._handlePopperPlacementChange(a)},onUpdate:function(a){b._handlePopperPlacementChange(a)}}),a(e).addClass(u.SHOW),"ontouchstart"in document.documentElement&&a("body").children().on("mouseover",null,a.noop);var k=function(){b.config.animation&&b._fixTransition();var c=b._hoverState;b._hoverState=null,a(b.element).trigger(b.constructor.Event.SHOWN),c===s.OUT&&b._leave(null,b)};m["default"].supportsTransitionEnd()&&a(this.tip).hasClass(u.FADE)?a(this.tip).one(m["default"].TRANSITION_END,k).emulateTransitionEnd(i._TRANSITION_DURATION):k()}}},{key:"hide",value:function(b){var c=this,d=this.getTipElement(),e=a.Event(this.constructor.Event.HIDE),f=function(){c._hoverState!==s.SHOW&&d.parentNode&&d.parentNode.removeChild(d),c._cleanTipClass(),c.element.removeAttribute("aria-describedby"),a(c.element).trigger(c.constructor.Event.HIDDEN),null!==c._popper&&c._popper.destroy(),b&&b()};a(this.element).trigger(e),e.isDefaultPrevented()||(a(d).removeClass(u.SHOW),"ontouchstart"in document.documentElement&&a("body").children().off("mouseover",null,a.noop),this._activeTrigger[w.CLICK]=!1,this._activeTrigger[w.FOCUS]=!1,this._activeTrigger[w.HOVER]=!1,m["default"].supportsTransitionEnd()&&a(this.tip).hasClass(u.FADE)?a(d).one(m["default"].TRANSITION_END,f).emulateTransitionEnd(k):f(),this._hoverState="")}},{key:"update",value:function(){null!==this._popper&&this._popper.scheduleUpdate()}},{key:"isWithContent",value:function(){return Boolean(this.getTitle())}},{key:"addAttachmentClass",value:function(b){a(this.getTipElement()).addClass("".concat(n,"-").concat(b))}},{key:"getTipElement",value:function(){return this.tip=this.tip||a(this.config.template)[0],this.tip}},{key:"setContent",value:function(){var b=a(this.getTipElement());this.setElementContent(b.find(v.TOOLTIP_INNER),this.getTitle()),b.removeClass("".concat(u.FADE," ").concat(u.SHOW))}},{key:"setElementContent",value:function(b,c){var d=this.config.html;"object"===g(c)&&(c.nodeType||c.jquery)?d?a(c).parent().is(b)||b.empty().append(c):b.text(a(c).text()):b[d?"html":"text"](c)}},{key:"getTitle",value:function(){var a=this.element.getAttribute("data-original-title");return a||(a="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),a}},{key:"_getAttachment",value:function(a){return q[a.toUpperCase()]}},{key:"_setListeners",value:function(){var b=this,c=this.config.trigger.split(" ");c.forEach(function(c){if("click"===c)a(b.element).on(b.constructor.Event.CLICK,b.config.selector,function(a){return b.toggle(a)});else if(c!==w.MANUAL){var d=c===w.HOVER?b.constructor.Event.MOUSEENTER:b.constructor.Event.FOCUSIN,e=c===w.HOVER?b.constructor.Event.MOUSELEAVE:b.constructor.Event.FOCUSOUT;a(b.element).on(d,b.config.selector,function(a){return b._enter(a)}).on(e,b.config.selector,function(a){return b._leave(a)})}a(b.element).closest(".modal").on("hide.bs.modal",function(){return b.hide()})}),this.config.selector?this.config=f({},this.config,{trigger:"manual",selector:""}):this._fixTitle()}},{key:"_fixTitle",value:function(){var a=g(this.element.getAttribute("data-original-title"));(this.element.getAttribute("title")||"string"!==a)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))}},{key:"_enter",value:function(b,c){var d=this.constructor.DATA_KEY;return c=c||a(b.currentTarget).data(d),c||(c=new this.constructor(b.currentTarget,this._getDelegateConfig()),a(b.currentTarget).data(d,c)),b&&(c._activeTrigger["focusin"===b.type?w.FOCUS:w.HOVER]=!0),a(c.getTipElement()).hasClass(u.SHOW)||c._hoverState===s.SHOW?void(c._hoverState=s.SHOW):(clearTimeout(c._timeout),c._hoverState=s.SHOW,c.config.delay&&c.config.delay.show?void(c._timeout=setTimeout(function(){c._hoverState===s.SHOW&&c.show()},c.config.delay.show)):void c.show())}},{key:"_leave",value:function(b,c){var d=this.constructor.DATA_KEY;if(c=c||a(b.currentTarget).data(d),c||(c=new this.constructor(b.currentTarget,this._getDelegateConfig()),a(b.currentTarget).data(d,c)),b&&(c._activeTrigger["focusout"===b.type?w.FOCUS:w.HOVER]=!1),!c._isWithActiveTrigger())return clearTimeout(c._timeout),c._hoverState=s.OUT,c.config.delay&&c.config.delay.hide?void(c._timeout=setTimeout(function(){c._hoverState===s.OUT&&c.hide()},c.config.delay.hide)):void c.hide()}},{key:"_isWithActiveTrigger",value:function(){for(var a in this._activeTrigger)if(this._activeTrigger[a])return!0;return!1}},{key:"_getConfig",value:function(c){return c=f({},this.constructor.Default,a(this.element).data(),c),"number"==typeof c.delay&&(c.delay={show:c.delay,hide:c.delay}),"number"==typeof c.title&&(c.title=c.title.toString()),"number"==typeof c.content&&(c.content=c.content.toString()),m["default"].typeCheckConfig(b,c,this.constructor.DefaultType),c}},{key:"_getDelegateConfig",value:function(){var a={};if(this.config)for(var b in this.config)this.constructor.Default[b]!==this.config[b]&&(a[b]=this.config[b]);return a}},{key:"_cleanTipClass",value:function(){var b=a(this.getTipElement()),c=b.attr("class").match(o);null!==c&&c.length>0&&b.removeClass(c.join(""))}},{key:"_handlePopperPlacementChange",value:function(a){this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(a.placement))}},{key:"_fixTransition",value:function(){var b=this.getTipElement(),c=this.config.animation;null===b.getAttribute("x-placement")&&(a(b).removeClass(u.FADE),this.config.animation=!1,this.hide(),this.show(),this.config.animation=c)}}],[{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=a(this).data(d),e="object"===g(b)&&b;if((c||!/dispose|hide/.test(b))&&(c||(c=new i(this,e),a(this).data(d,c)),"string"==typeof b)){if("undefined"==typeof c[b])throw new TypeError('No method named "'.concat(b,'"'));c[b]()}})}},{key:"VERSION",get:function(){return c}},{key:"Default",get:function(){return r}},{key:"NAME",get:function(){return b}},{key:"DATA_KEY",get:function(){return d}},{key:"Event",get:function(){return t}},{key:"EVENT_KEY",get:function(){return e}},{key:"DefaultType",get:function(){return p}}]),i}();return a.fn[b]=x._jQueryInterface,a.fn[b].Constructor=x,a.fn[b].noConflict=function(){return a.fn[b]=i,x._jQueryInterface},x}(k["default"],l["default"]);a["default"]=n});