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.21 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(1355)},3:function(t,o){t.exports=function(){throw Error("define cannot be used indirect")}},1005:function(t,o){t.exports=require("jquery")},1006:function(t,o){t.exports=require("./kendo.core")},1038:function(t,o){t.exports=require("./kendo.popup")},1056:function(t,o){t.exports=require("./kendo.fx")},1355:function(t,o,e){var n,i,r;(function(s){!function(s,define){i=[e(1006),e(1038),e(1056)],n=s,r="function"==typeof n?n.apply(o,i):n,!(void 0!==r&&(t.exports=r))}(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 r(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",x="requestStart",O="k-content-frame",b='<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" title="Close"></a></div> #}#<div class="k-tooltip-content"></div>#if (callout){ #<div class="k-callout k-callout-#=dir#"></div>#}#</div>',C=u.template("<iframe frameborder='0' class='"+O+"' src='#= content.url #'>This page requires frames in order to show content</iframe>"),S=".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"},A={horizontal:{offset:"top",size:"outerHeight"},vertical:{offset:"left",size:"outerWidth"}},D=function(t){return t.target.data(u.ns+"title")},E=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=A[e],n._documentKeyDownHandler=h(n._documentKeyDown,n),n.element.on(n.options.showOn+S,n.options.filter,h(n._showOn,n)),(this._isShownOnMouseEnter()||this._isShownOnClick())&&n.element.on("mouseenter"+S,n.options.filter,h(n._mouseenter,n)),this.options.autoHide&&this._isShownOnMouseEnter()&&n.element.on("mouseleave"+S,n.options.filter,h(n._mouseleave,n)),this.options.autoHide&&this._isShownOnFocus()&&n.element.on("blur"+S,n.options.filter,h(n._blur,n))},options:{name:"Tooltip",filter:"",content:D,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,x],_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){r(t(o.currentTarget))},_showOn:function(o){var e=this,n=t(o.currentTarget);e._isShownOnClick()&&!e._isShownOnMouseEnter()?e._show(n):e._isShownOnFocus()?(r(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,r=e.options.iframe;a(n)&&n.url?("iframe"in e.options||(r=!m(n.url)),e.trigger(x,{options:n,target:t}),r?(i.hide(),o=i.find("."+O)[0],o?o.src=n.url||o.src:i.html(C({content:n})),i.find("."+O).off("load"+S).on("load"+S,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;s.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,r(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"+S,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"+S,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"+S,h(e._mouseleave,e)):i.on("click"+S,".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,r=o.popup,s=r.options.anchor,u=t(s).offset(),p=t(r.element).offset(),c=q[r.flipped?H[e]:e],l=u[i]-p[i]+t(s)[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(S),t.destroy()),clearTimeout(this.timeout),this.element.off(S),d.off("keydown"+S,this._documentKeyDownHandler),p.fn.destroy.call(this)},_offset:function(t,o){var e=this,n="top"==t||"left"==t,i=e.popup.flipped,r=n&&i||!n&&!i?1:-1,s=n?"margin-"+t:"margin-"+H[t],p=u._outerWidth(e.arrow)/2+o;e.popup.wrapper.css(s,p*r+"px")}});u.ui.plugin(E)}(window.kendo.jQuery),window.kendo},e(3))}).call(o,e(1005))}});