UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 7.42 kB
module.exports=function(t){function o(n){if(e[n])return e[n].exports;var i=e[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}var e={};return o.m=t,o.c=e,o.p="",o(0)}({0:function(t,o,e){t.exports=e(1441)},3:function(t,o){t.exports=function(){throw Error("define cannot be used indirect")}},1048:function(t,o){t.exports=require("jquery")},1049:function(t,o){t.exports=require("./kendo.core")},1089:function(t,o){t.exports=require("./kendo.popup")},1108:function(t,o){t.exports=require("./kendo.fx")},1441:function(t,o,e){var n,i,s;(function(r){!function(r,define){i=[e(1049),e(1089),e(1108)],n=r,s="function"==typeof n?n.apply(o,i):n,!(void 0!==s&&(t.exports=s))}(function(){return function(t,o){function e(t){for(;t.length&&!n(t);)t=t.parent()}function n(t){var o=t.data(u.ns+"title");if(o)return t.attr("title",o),t.removeData(u.ns+"title"),!0}function i(t){var o=t.attr("title");if(o)return t.data(u.ns+"title",o),t.attr("title",""),!0}function s(t){for(;t.length&&!t.is("body")&&!i(t);)t=t.parent()}var u=window.kendo,p=u.ui.Widget,c=u.ui.Popup,l=u.isFunction,a=t.isPlainObject,f=t.extend,h=t.proxy,d=t(document),m=u.isLocalUrl,w="_tt_active",_="aria-describedby",g="show",v="hide",k="error",y="contentLoad",O="requestStart",x="k-content-frame",b='<div role="tooltip" class="k-widget k-tooltip#if (!autoHide) {# k-tooltip-closable#}#"><div class="k-tooltip-content"></div>#if (!autoHide) {# <div class="k-tooltip-button"><a href="\\#" class="k-icon k-i-close" title="Close"></a></div> #}##if (callout){ #<div class="k-callout k-callout-#=dir#"></div>#}#</div>',S=u.template("<iframe frameborder='0' class='"+x+"' src='#= content.url #'>This page requires frames in order to show content</iframe>"),C=".kendoTooltip",T={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"}},H={top:"bottom",bottom:"top",left:"right",right:"left",center:"center"},q={bottom:"n",top:"s",left:"e",right:"w",center:"n"},E={horizontal:{offset:"top",size:"outerHeight"},vertical:{offset:"left",size:"outerWidth"}},A=function(t){return t.target.data(u.ns+"title")},D=p.extend({init:function(t,o){var e,n=this;p.fn.init.call(n,t,o),e=n.options.position.match(/left|right/)?"horizontal":"vertical",n.dimensions=E[e],n._documentKeyDownHandler=h(n._documentKeyDown,n),u.support.touch&&this._isShownOnMouseEnter()&&n.element.on(u.support.mousedown+C,n.options.filter,h(n._showOn,n)),n.element.on(n.options.showOn+C,n.options.filter,h(n._showOn,n)),(this._isShownOnMouseEnter()||this._isShownOnClick())&&n.element.on("mouseenter"+C,n.options.filter,h(n._mouseenter,n)),this.options.autoHide&&this._isShownOnMouseEnter()&&n.element.on("mouseleave"+C,n.options.filter,h(n._mouseleave,n)),this.options.autoHide&&this._isShownOnFocus()&&n.element.on("blur"+C,n.options.filter,h(n._blur,n)),u.support.touch&&n.element.on(u.support.mousedown+C,n.options.filter,h(n._mouseenter,n))},options:{name:"Tooltip",filter:"",content:A,showAfter:100,hideAfter:100,callout:!0,offset:0,position:"bottom",showOn:"mouseenter",autoHide:!0,width:null,height:null,animation:{open:{effects:"fade:in",duration:0},close:{duration:40,hide:!0}}},events:[g,v,y,k,O],_isShownOnFocus:function(){return this.options.showOn&&this.options.showOn.match(/focus/)},_isShownOnMouseEnter:function(){return this.options.showOn&&this.options.showOn.match(/mouseenter/)},_isShownOnClick:function(){return this.options.showOn&&this.options.showOn.match(/click/)},_mouseenter:function(o){s(t(o.currentTarget))},_showOn:function(o){var e=this,n=t(o.currentTarget);e._isShownOnClick()&&!e._isShownOnMouseEnter()?e._show(n):e._isShownOnFocus()?(s(n),e._show(n)):(clearTimeout(e.timeout),e.timeout=setTimeout(function(){e._show(n)},e.options.showAfter))},_appendContent:function(t){var o,e=this,n=e.options.content,i=e.content,s=e.options.iframe;a(n)&&n.url?("iframe"in e.options||(s=!m(n.url)),e.trigger(O,{options:n,target:t}),s?(i.hide(),o=i.find("."+x)[0],o?o.src=n.url||o.src:i.html(S({content:n})),i.find("."+x).off("load"+C).on("load"+C,function(){e.trigger(y),i.show()})):(i.empty(),u.ui.progress(i,!0),e._ajaxRequest(n))):n&&l(n)?(n=n({sender:this,target:t}),i.html(n||"")):i.html(n),e.angular("compile",function(){return{elements:i}})},_ajaxRequest:function(t){var o=this;r.ajax(f({type:"GET",dataType:"html",cache:!1,error:function(t,e){u.ui.progress(o.content,!1),o.trigger(k,{status:e,xhr:t})},success:h(function(t){u.ui.progress(o.content,!1),o.content.html(t),o.trigger(y)},o)},t))},_documentKeyDown:function(t){t.keyCode===u.keys.ESC&&this.hide()},refresh:function(){var t=this,o=t.popup;o&&o.options.anchor&&t._appendContent(o.options.anchor)},hide:function(){this.popup&&this.popup.close()},show:function(t){t=t||this.element,s(t),this._show(t)},_show:function(t){var o=this,n=o.target();o.popup||o._initPopup(),n&&n[0]!=t[0]&&(o.popup.close(),o.popup.element.kendoStop(!0,!0)),n&&n[0]==t[0]||(o._appendContent(t),o.popup.options.anchor=t),o.popup.one("deactivate",function(){e(t),t.removeAttr(_),this.element.removeAttr("id").attr("aria-hidden",!0),d.off("keydown"+C,o._documentKeyDownHandler)}),o.popup._hovered=!0,o.popup.open()},_initPopup:function(){var e=this,n=e.options,i=t(u.template(b)({callout:n.callout&&"center"!==n.position,dir:q[n.position],autoHide:n.autoHide}));e.popup=new c(i,f({autosize:!0,activate:function(){var t=this.options.anchor,i=t[0].id||e.element[0].id;i&&(t.attr(_,i+w),this.element.attr("id",i+w)),n.callout?e._positionCallout():e._offset(e.options.position,e.options.offset),this.element.removeAttr("aria-hidden"),d.on("keydown"+C,e._documentKeyDownHandler),e.trigger(g),e.popup._hovered=o},close:function(){e.trigger(v)},copyAnchorStyles:!1,animation:n.animation},T[n.position])),i.css({width:n.width,height:n.height}),e.content=i.find(".k-tooltip-content"),e.arrow=i.find(".k-callout"),n.autoHide&&this._isShownOnMouseEnter()?i.on("mouseleave"+C,h(e._mouseleave,e)):i.on("click"+C,".k-tooltip-button",h(e._closeButtonClick,e))},_closeButtonClick:function(t){t.preventDefault(),this.hide()},_mouseleave:function(t){var o=this;clearTimeout(o.timeout),o.timeout=setTimeout(function(){o._closePopup(t.currentTarget)},o.options.hideAfter)},_blur:function(t){this._closePopup(t.currentTarget)},_closePopup:function(o){this.popup&&!this.popup._hovered?this.popup.close():e(t(o))},target:function(){return this.popup?this.popup.options.anchor:null},_positionCallout:function(){var o=this,e=o.options.position,n=o.dimensions,i=n.offset,s=o.popup,r=s.options.anchor,u=t(r).offset(),p=t(s.element).offset(),c=q[s.flipped?H[e]:e],l=u[i]-p[i]+t(r)[n.size]()/2;o._offset(e,o.options.offset),o.arrow.removeClass("k-callout-n k-callout-s k-callout-w k-callout-e").addClass("k-callout-"+c).css(i,l)},destroy:function(){var t=this.popup;t&&(t.element.off(C),t.destroy()),clearTimeout(this.timeout),this.element.off(C),d.off("keydown"+C,this._documentKeyDownHandler),p.fn.destroy.call(this)},_offset:function(t,o){var e=this,n="top"==t||"left"==t,i=e.popup.flipped,s=n&&i||!n&&!i?1:-1,r=n?"margin-"+t:"margin-"+H[t],p=u._outerWidth(e.arrow)/2+o;e.popup.wrapper.css(r,p*s+"px")}});u.ui.plugin(D)}(window.kendo.jQuery),window.kendo},e(3))}).call(o,e(1048))}});