UNPKG

@progress/kendo-ui

Version:

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

1 lines 8.36 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(1472)},3:function(t,o){t.exports=function(){throw Error("define cannot be used indirect")}},1048:function(t,o){t.exports=require("./kendo.core")},1049:function(t,o){t.exports=require("./kendo.popup")},1057:function(t,o){t.exports=require("jquery")},1124:function(t,o){t.exports=require("./kendo.fx")},1472:function(t,o,e){var n,i,s;(function(r){!function(r,define){i=[e(1048),e(1049),e(1124)],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 p,u=window.kendo,c=u.ui.Widget,a=u.ui.Popup,l=u.isFunction,f=t.isPlainObject,h=t.extend,d=t.proxy,m=t(document),_=u.isLocalUrl,w="_tb_active",g="aria-describedby",v="show",k="hide",y="error",b="contentLoad",O="requestStart",x="k-content-frame",T='<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",H={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"}},D={top:"bottom",bottom:"top",left:"right",right:"left",center:"center"},P={bottom:"n",top:"s",left:"e",right:"w",center:"n"},q={horizontal:{offset:"top",size:"outerHeight"},vertical:{offset:"left",size:"outerWidth"}},A=function(t){return t.target.data(u.ns+"title")},E=c.extend({init:function(t,o){var e,n=this;c.fn.init.call(n,t,o),e=n.options.position.match(/left|right/)?"horizontal":"vertical",n.dimensions=q[e],u.support.touch&&this._isShownOnMouseEnter()&&n.element.on(u.support.mousedown+C,n.options.filter,d(n._showOn,n)),n.element.on(n.options.showOn+C,n.options.filter,d(n._showOn,n))},options:{name:"TooltipBase",filter:"",offset:0,showAfter:100,hideAfter:100,callout:!0,position:"bottom",showOn:"mouseenter",animation:{open:{effects:"fade:in",duration:0},close:{duration:40,hide:!0}}},destroy:function(){var t=this.popup;t&&(t.element.off(C),t.destroy()),clearTimeout(this.timeout),c.fn.destroy.call(this)},hide:function(){this.popup&&this.popup.close()},show:function(t){t=t||this.element,this._saveTitle(t),this._show(t)},target:function(){return this.popup?this.popup.options.anchor:null},_showOn:function(o){var e=this,n=t(o.currentTarget);e._isShownOnClick()&&!e._isShownOnMouseEnter()?e._show(n):e._isShownOnFocus()?(e._saveTitle(n),e._show(n)):(clearTimeout(e.timeout),e.timeout=setTimeout(function(){e._show(n)},e.options.showAfter))},_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/)},_positionCallout:function(){var o=this,e=o.options.position,n=o.dimensions,i=n.offset,s=o.popup,r=s.options.anchor,p=t(r).offset(),u=t(s.element).offset(),c=P[s.flipped?D[e]:e],a=p[i]-u[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,a)},_offset:function(t,o,e){var n=this,i="top"==t||"left"==t,s=n.popup.flipped,r=i&&s||!i&&!s?1:-1,p=i?"margin-"+t:"margin-"+D[t],c=(e||u._outerWidth(n.arrow))/2+o;n.popup.wrapper.css(p,c*r+"px")},_addDescribedBy:function(){var t=this,o=t.popup.options.anchor,e=o[0].id||t.element[0].id||u.guid(),n=[];o.attr(g)&&n.push(o.attr(g)),e&&(n.push(e+w),o.attr(g,n.join(" ")),t.popup.element.attr("id",e+w))},_removeDescribedBy:function(t){var o,e,n,i=this.popup.element.attr("id"),s=t.attr(g);s&&(o=s.split(" "),o&&o.length>0&&(e=o.filter(function(t){return t!==i})),e&&e.length>0?(n=e.join(" "),t.attr(g,n)):t.removeAttr(g))},_openPopup:function(){this.popup&&(this.popup._hovered=!0,this.popup.open())}});u.ui.plugin(E),p=E.extend({init:function(t,o){var e,n=this;E.fn.init.call(n,t,o),e=n.options.position.match(/left|right/)?"horizontal":"vertical",n.dimensions=q[e],n._documentKeyDownHandler=d(n._documentKeyDown,n),(this._isShownOnMouseEnter()||this._isShownOnClick())&&n.element.on("mouseenter"+C,n.options.filter,d(n._mouseenter,n)),this.options.autoHide&&this._isShownOnMouseEnter()&&n.element.on("mouseleave"+C,n.options.filter,d(n._mouseleave,n)),this.options.autoHide&&this._isShownOnFocus()&&n.element.on("blur"+C,n.options.filter,d(n._blur,n)),u.support.touch&&n.element.on(u.support.mousedown+C,n.options.filter,d(n._mouseenter,n))},options:{name:"Tooltip",filter:"",content:A,showAfter: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:[v,k,b,y,O],_mouseenter:function(o){s(t(o.currentTarget))},_saveTitle:function(t){s(t)},_appendContent:function(t){var o,e=this,n=e.options.content,i=e.content,s=e.options.iframe;f(n)&&n.url?("iframe"in e.options||(s=!_(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(b),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;o.contentLoading=!0,r.ajax(h({type:"GET",dataType:"html",cache:!1,error:function(t,e){u.ui.progress(o.content,!1),o.trigger(y,{status:e,xhr:t})},success:d(function(t){u.ui.progress(o.content,!1),o.content.html(t),o.contentLoading=!1,o.trigger(b),o._openPopup()},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)},_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),o._removeDescribedBy(t),this.element.removeAttr("id").attr("aria-hidden",!0),m.off("keydown"+C,o._documentKeyDownHandler)}),o.contentLoading||o._openPopup()},_initPopup:function(){var e=this,n=e.options,i=t(u.template(T)({callout:n.callout&&"center"!==n.position,dir:P[n.position],autoHide:n.autoHide}));e.popup=new a(i,h({autosize:!0,activate:function(){e._addDescribedBy(),n.callout?e._positionCallout():e._offset(e.options.position,e.options.offset),this.element.removeAttr("aria-hidden"),m.on("keydown"+C,e._documentKeyDownHandler),e.trigger(v),e.popup._hovered=o},close:function(){e.trigger(k)},copyAnchorStyles:!1,animation:n.animation},H[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,d(e._mouseleave,e)):i.on("click"+C,".k-tooltip-button",d(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))},destroy:function(){this.element.off(C),m.off("keydown"+C,this._documentKeyDownHandler),E.fn.destroy.call(this)}}),u.ui.plugin(p)}(window.kendo.jQuery),window.kendo},e(3))}).call(o,e(1057))}});