demo20230512/Scripts/kendo/2014.2.716/kendo.tooltip.min.js

16 lines
6.2 KiB
JavaScript
Raw Normal View History

2023-05-12 10:20:28 +08:00
/**
* Copyright 2014 Telerik AD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(e,define){define(["./kendo.core.min","./kendo.popup.min"],e)}(function(){return function(e){function t(e){for(;e.length;)n(e),e=e.parent()}function n(e){var t=e.data(o.ns+"title");t&&(e.attr("title",t),e.removeData(o.ns+"title"))}function i(e){var t=e.attr("title");t&&(e.data(o.ns+"title",t),e.attr("title",""))}function r(e){for(;e.length&&!e.is("body");)i(e),e=e.parent()}var o=window.kendo,a=o.ui.Widget,s=o.ui.Popup,l=o.isFunction,u=e.isPlainObject,d=e.extend,c=e.proxy,f=e(document),h=o.isLocalUrl,p="_tt_active",g="aria-describedby",m="show",v="hide",_="error",y="contentLoad",b="requestStart",w="k-content-frame",x='<div role="tooltip" class="k-widget k-tooltip#if (!autoHide) {# k-tooltip-closable#}#">#if (!autoHide) {# <div class="k-tooltip-button"><a href="\\#" class="k-icon k-i-close">close</a></div> #}#<div class="k-tooltip-content"></div>#if (callout){ #<div class="k-callout k-callout-#=dir#"></div>#}#</div>',k=o.template("<iframe frameborder='0' class='"+w+"' src='#= content.url #'>This page requires frames in order to show content</iframe>"),T=".kendoTooltip",C={bottom:{origin:"bottom center",position:"top center"},top:{origin:"top center",position:"bottom center"},left:{origin:"center left",position:"center right",collision:"fit flip"},right:{origin:"center right",position:"center left",collision:"fit flip"},center:{position:"center center",origin:"center center"}},S={top:"bottom",bottom:"top",left:"right",right:"left",center:"center"},F={bottom:"n",top:"s",left:"e",right:"w",center:"n"},M={horizontal:{offset:"top",size:"outerHeight"},vertical:{offset:"left",size:"outerWidth"}},D=function(e){return e.target.data(o.ns+"title")},E=a.extend({init:function(e,t){var n,i=this;a.fn.init.call(i,e,t),n=i.options.position.match(/left|right/)?"horizontal":"vertical",i.dimensions=M[n],i._documentKeyDownHandler=c(i._documentKeyDown,i),i.element.on(i.options.showOn+T,i.options.filter,c(i._showOn,i)).on("mouseenter"+T,i.options.filter,c(i._mouseenter,i)),this.options.autoHide&&i.element.on("mouseleave"+T,i.options.filter,c(i._mouseleave,i))},options:{name:"Tooltip",filter:"",content:D,showAfter:100,callout:!0,position:"bottom",showOn:"mouseenter",autoHide:!0,width:null,height:null,animation:{open:{effects:"fade:in",duration:0},close:{effects:"fade:out",duration:40,hide:!0}}},events:[m,v,y,_,b],_mouseenter:function(t){r(e(t.currentTarget))},_showOn:function(t){var n=this,i=e(t.currentTarget);n.options.showOn&&n.options.showOn.match(/click|focus/)?n._show(i):(clearTimeout(n.timeout),n.timeout=setTimeout(function(){n._show(i)},n.options.showAfter))},_appendContent:function(e){var t,n=this,i=n.options.content,r=n.content,a=n.options.iframe;u(i)&&i.url?("iframe"in n.options||(a=!h(i.url)),n.trigger(b,{options:i,target:e}),a?(r.hide(),t=r.find("."+w)[0],t?t.src=i.url||t.src:r.html(k({content:i})),r.find("."+w).off("load"+T).on("load"+T,function(){n.trigger(y),r.show()})):(r.empty(),o.ui.progress(r,!0),n._ajaxRequest(i))):i&&l(i)?(i=i({sender:this,target:e}),r.html(i||"")):r.html(i),n.angular("compile",function(){return{elements:r}})},_ajaxRequest:function(e){var t=this;jQuery.ajax(d({type:"GET",dataType:"html",cache:!1,error:function(e,n){o.ui.progress(t.content,!1),t.trigger(_,{status:n,xhr:e})},success:c(function(e){o.ui.progress(t.content,!1),t.content.html(e),t.trigger(y)},t)},e))},_documentKeyDown:function(e){e.keyCode===o.keys.ESC&&this.hide()},refresh:function(){var e=this,t=e.popup;t&&t.options.anchor&&e._appendContent(t.options.anchor)},hide:function(){this.popup&&this.popup.close()},show:function(e){e=e||this.element,r(e),this._show(e)},_show:function(e){var n=this,i=n.target();n.popup||n._initPopup(),i&&i[0]!=e[0]&&(n.popup.close(),n.popup.element.kendoStop(!0,!0)),i&&i[0]==e[0]||(n._appendContent(e),n.popup.options.anchor=e),n.popup.one("deactivate",function(){t(e),e.removeAttr(g),this.element.removeAttr("id").attr("aria-hidden",!0),f.off("keydown"+T,n._documentKeyDownHandler)}),n.popup.open()},_initPopup:function(){var t=this,n=t.options,i=e(o.template(x)({callout:n.callout&&"center"!==n.position,dir:F[n.posit