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.
2 lines
14 KiB
2 lines
14 KiB
define ("theme_ilb/bootstrap/tooltip",["exports","./tools/sanitizer","jquery","core/popper","./util"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;c=f(c);d=f(d);e=f(e);function f(a){return a&&a.__esModule?a:{default:a}}function g(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);if(b)d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable});c.push.apply(c,d)}return c}function h(a){for(var b=1,c;b<arguments.length;b++){c=null!=arguments[b]?arguments[b]:{};if(b%2){g(Object(c),!0).forEach(function(b){i(a,b,c[b])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(a,Object.getOwnPropertyDescriptors(c))}else{g(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}}return a}function i(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function j(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){j=function(a){return typeof a}}else{j=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return j(a)}function k(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function l(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function m(a,b,c){if(b)l(a.prototype,b);if(c)l(a,c);return a}var n="bs.tooltip",o=".".concat(n),p=c.default.fn.tooltip,q="bs-tooltip",r=new RegExp("(^|\\s)".concat(q,"\\S+"),"g"),s=["sanitize","whiteList","sanitizeFn"],t={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string|function)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",whiteList:"object",popperConfig:"(null|object)"},u={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},v={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",customClass:"",sanitize:!0,sanitizeFn:null,whiteList:b.DefaultWhitelist,popperConfig:null},w="show",x="out",y={HIDE:"hide".concat(o),HIDDEN:"hidden".concat(o),SHOW:"show".concat(o),SHOWN:"shown".concat(o),INSERTED:"inserted".concat(o),CLICK:"click".concat(o),FOCUSIN:"focusin".concat(o),FOCUSOUT:"focusout".concat(o),MOUSEENTER:"mouseenter".concat(o),MOUSELEAVE:"mouseleave".concat(o)},z="fade",A="show",B="hover",C="focus",D=function(){function a(b,c){k(this,a);if("undefined"==typeof d.default){throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)")}this._isEnabled=!0;this._timeout=0;this._hoverState="";this._activeTrigger={};this._popper=null;this.element=b;this.config=this._getConfig(c);this.tip=null;this._setListeners()}m(a,[{key:"enable",value:function enable(){this._isEnabled=!0}},{key:"disable",value:function disable(){this._isEnabled=!1}},{key:"toggleEnabled",value:function toggleEnabled(){this._isEnabled=!this._isEnabled}},{key:"toggle",value:function toggle(a){if(!this._isEnabled){return}if(a){var b=this.constructor.DATA_KEY,d=(0,c.default)(a.currentTarget).data(b);if(!d){d=new this.constructor(a.currentTarget,this._getDelegateConfig());(0,c.default)(a.currentTarget).data(b,d)}d._activeTrigger.click=!d._activeTrigger.click;if(d._isWithActiveTrigger()){d._enter(null,d)}else{d._leave(null,d)}}else{if((0,c.default)(this.getTipElement()).hasClass(A)){this._leave(null,this);return}this._enter(null,this)}}},{key:"dispose",value:function dispose(){clearTimeout(this._timeout);c.default.removeData(this.element,this.constructor.DATA_KEY);(0,c.default)(this.element).off(this.constructor.EVENT_KEY);(0,c.default)(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler);if(this.tip){(0,c.default)(this.tip).remove()}this._isEnabled=null;this._timeout=null;this._hoverState=null;this._activeTrigger=null;if(this._popper){this._popper.destroy()}this._popper=null;this.element=null;this.config=null;this.tip=null}},{key:"show",value:function show(){var a=this;if("none"===(0,c.default)(this.element).css("display")){throw new Error("Please use show on visible elements")}var b=c.default.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){(0,c.default)(this.element).trigger(b);var f=e.default.findShadowRoot(this.element),g=c.default.contains(null!==f?f:this.element.ownerDocument.documentElement,this.element);if(b.isDefaultPrevented()||!g){return}var h=this.getTipElement(),i=e.default.getUID(this.constructor.NAME);h.setAttribute("id",i);this.element.setAttribute("aria-describedby",i);this.setContent();if(this.config.animation){(0,c.default)(h).addClass(z)}var j="function"==typeof this.config.placement?this.config.placement.call(this,h,this.element):this.config.placement,k=this._getAttachment(j);this.addAttachmentClass(k);var l=this._getContainer();(0,c.default)(h).data(this.constructor.DATA_KEY,this);if(!c.default.contains(this.element.ownerDocument.documentElement,this.tip)){(0,c.default)(h).appendTo(l)}(0,c.default)(this.element).trigger(this.constructor.Event.INSERTED);this._popper=new d.default(this.element,h,this._getPopperConfig(k));(0,c.default)(h).addClass(A);(0,c.default)(h).addClass(this.config.customClass);if("ontouchstart"in document.documentElement){(0,c.default)(document.body).children().on("mouseover",null,c.default.noop)}var m=function(){if(a.config.animation){a._fixTransition()}var b=a._hoverState;a._hoverState=null;(0,c.default)(a.element).trigger(a.constructor.Event.SHOWN);if(b===x){a._leave(null,a)}};if((0,c.default)(this.tip).hasClass(z)){var n=e.default.getTransitionDurationFromElement(this.tip);(0,c.default)(this.tip).one(e.default.TRANSITION_END,m).emulateTransitionEnd(n)}else{m()}}}},{key:"hide",value:function hide(a){var b=this,d=this.getTipElement(),f=c.default.Event(this.constructor.Event.HIDE),g=function(){if(b._hoverState!==w&&d.parentNode){d.parentNode.removeChild(d)}b._cleanTipClass();b.element.removeAttribute("aria-describedby");(0,c.default)(b.element).trigger(b.constructor.Event.HIDDEN);if(null!==b._popper){b._popper.destroy()}if(a){a()}};(0,c.default)(this.element).trigger(f);if(f.isDefaultPrevented()){return}(0,c.default)(d).removeClass(A);if("ontouchstart"in document.documentElement){(0,c.default)(document.body).children().off("mouseover",null,c.default.noop)}this._activeTrigger["click"]=!1;this._activeTrigger[C]=!1;this._activeTrigger[B]=!1;if((0,c.default)(this.tip).hasClass(z)){var h=e.default.getTransitionDurationFromElement(d);(0,c.default)(d).one(e.default.TRANSITION_END,g).emulateTransitionEnd(h)}else{g()}this._hoverState=""}},{key:"update",value:function update(){if(null!==this._popper){this._popper.scheduleUpdate()}}},{key:"isWithContent",value:function isWithContent(){return!!this.getTitle()}},{key:"addAttachmentClass",value:function addAttachmentClass(a){(0,c.default)(this.getTipElement()).addClass("".concat(q,"-").concat(a))}},{key:"getTipElement",value:function getTipElement(){this.tip=this.tip||(0,c.default)(this.config.template)[0];return this.tip}},{key:"setContent",value:function setContent(){var a=this.getTipElement();this.setElementContent((0,c.default)(a.querySelectorAll(".tooltip-inner")),this.getTitle());(0,c.default)(a).removeClass("".concat(z," ").concat(A))}},{key:"setElementContent",value:function setElementContent(a,d){if("object"===j(d)&&(d.nodeType||d.jquery)){if(this.config.html){if(!(0,c.default)(d).parent().is(a)){a.empty().append(d)}}else{a.text((0,c.default)(d).text())}return}if(this.config.html){if(this.config.sanitize){d=(0,b.sanitizeHtml)(d,this.config.whiteList,this.config.sanitizeFn)}a.html(d)}else{a.text(d)}}},{key:"getTitle",value:function getTitle(){var a=this.element.getAttribute("data-original-title");if(!a){a="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title}return a}},{key:"_getPopperConfig",value:function _getPopperConfig(a){var b=this,c={placement:a,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:".arrow"},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function onCreate(a){if(a.originalPlacement!==a.placement){b._handlePopperPlacementChange(a)}},onUpdate:function onUpdate(a){return b._handlePopperPlacementChange(a)}};return h({},c,{},this.config.popperConfig)}},{key:"_getOffset",value:function _getOffset(){var a=this,b={};if("function"==typeof this.config.offset){b.fn=function(b){b.offsets=h({},b.offsets,{},a.config.offset(b.offsets,a.element)||{});return b}}else{b.offset=this.config.offset}return b}},{key:"_getContainer",value:function _getContainer(){if(!1===this.config.container){return document.body}if(e.default.isElement(this.config.container)){return(0,c.default)(this.config.container)}return(0,c.default)(document).find(this.config.container)}},{key:"_getAttachment",value:function _getAttachment(a){return u[a.toUpperCase()]}},{key:"_setListeners",value:function _setListeners(){var a=this,b=this.config.trigger.split(" ");b.forEach(function(b){if("click"===b){(0,c.default)(a.element).on(a.constructor.Event.CLICK,a.config.selector,function(b){return a.toggle(b)})}else if(b!=="manual"){var d=b===B?a.constructor.Event.MOUSEENTER:a.constructor.Event.FOCUSIN,e=b===B?a.constructor.Event.MOUSELEAVE:a.constructor.Event.FOCUSOUT;(0,c.default)(a.element).on(d,a.config.selector,function(b){return a._enter(b)}).on(e,a.config.selector,function(b){return a._leave(b)})}});this._hideModalHandler=function(){if(a.element){a.hide()}};(0,c.default)(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler);if(this.config.selector){this.config=h({},this.config,{trigger:"manual",selector:""})}else{this._fixTitle()}}},{key:"_fixTitle",value:function _fixTitle(){var a=j(this.element.getAttribute("data-original-title"));if(this.element.getAttribute("title")||"string"!==a){this.element.setAttribute("data-original-title",this.element.getAttribute("title")||"");this.element.setAttribute("title","")}}},{key:"_enter",value:function _enter(a,b){var d=this.constructor.DATA_KEY;b=b||(0,c.default)(a.currentTarget).data(d);if(!b){b=new this.constructor(a.currentTarget,this._getDelegateConfig());(0,c.default)(a.currentTarget).data(d,b)}if(a){b._activeTrigger["focusin"===a.type?C:B]=!0}if((0,c.default)(b.getTipElement()).hasClass(A)||b._hoverState===w){b._hoverState=w;return}clearTimeout(b._timeout);b._hoverState=w;if(!b.config.delay||!b.config.delay.show){b.show();return}b._timeout=setTimeout(function(){if(b._hoverState===w){b.show()}},b.config.delay.show)}},{key:"_leave",value:function _leave(a,b){var d=this.constructor.DATA_KEY;b=b||(0,c.default)(a.currentTarget).data(d);if(!b){b=new this.constructor(a.currentTarget,this._getDelegateConfig());(0,c.default)(a.currentTarget).data(d,b)}if(a){b._activeTrigger["focusout"===a.type?C:B]=!1}if(b._isWithActiveTrigger()){return}clearTimeout(b._timeout);b._hoverState=x;if(!b.config.delay||!b.config.delay.hide){b.hide();return}b._timeout=setTimeout(function(){if(b._hoverState===x){b.hide()}},b.config.delay.hide)}},{key:"_isWithActiveTrigger",value:function _isWithActiveTrigger(){for(var a in this._activeTrigger){if(this._activeTrigger[a]){return!0}}return!1}},{key:"_getConfig",value:function _getConfig(a){var d=(0,c.default)(this.element).data();Object.keys(d).forEach(function(a){if(-1!==s.indexOf(a)){delete d[a]}});a=h({},this.constructor.Default,{},d,{},"object"===j(a)&&a?a:{});if("number"==typeof a.delay){a.delay={show:a.delay,hide:a.delay}}if("number"==typeof a.title){a.title=a.title.toString()}if("number"==typeof a.content){a.content=a.content.toString()}e.default.typeCheckConfig("tooltip",a,this.constructor.DefaultType);if(a.sanitize){a.template=(0,b.sanitizeHtml)(a.template,a.whiteList,a.sanitizeFn)}return a}},{key:"_getDelegateConfig",value:function _getDelegateConfig(){var a={};if(this.config){for(var b in this.config){if(this.constructor.Default[b]!==this.config[b]){a[b]=this.config[b]}}}return a}},{key:"_cleanTipClass",value:function _cleanTipClass(){var a=(0,c.default)(this.getTipElement()),b=a.attr("class").match(r);if(null!==b&&b.length){a.removeClass(b.join(""))}}},{key:"_handlePopperPlacementChange",value:function _handlePopperPlacementChange(a){this.tip=a.instance.popper;this._cleanTipClass();this.addAttachmentClass(this._getAttachment(a.placement))}},{key:"_fixTransition",value:function _fixTransition(){var a=this.getTipElement(),b=this.config.animation;if(null!==a.getAttribute("x-placement")){return}(0,c.default)(a).removeClass(z);this.config.animation=!1;this.hide();this.show();this.config.animation=b}}],[{key:"_jQueryInterface",value:function _jQueryInterface(b){return this.each(function(){var d=(0,c.default)(this),e=d.data(n),f="object"===j(b)&&b;if(!e&&/dispose|hide/.test(b)){return}if(!e){e=new a(this,f);d.data(n,e)}if("string"==typeof b){if("undefined"==typeof e[b]){throw new TypeError("No method named \"".concat(b,"\""))}e[b]()}})}},{key:"VERSION",get:function get(){return"4.6.0"}},{key:"Default",get:function get(){return v}},{key:"NAME",get:function get(){return"tooltip"}},{key:"DATA_KEY",get:function get(){return n}},{key:"Event",get:function get(){return y}},{key:"EVENT_KEY",get:function get(){return o}},{key:"DefaultType",get:function get(){return t}}]);return a}();c.default.fn.tooltip=D._jQueryInterface;c.default.fn.tooltip.Constructor=D;c.default.fn.tooltip.noConflict=function(){c.default.fn.tooltip=p;return D._jQueryInterface};a.default=D;return a.default});
|
|
//# sourceMappingURL=tooltip.min.js.map
|
|
|