@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 6.29 kB
JavaScript
module.exports=function(t){function i(e){if(n[e])return n[e].exports;var o=n[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,i),o.loaded=!0,o.exports}var n={};return i.m=t,i.c=n,i.p="",i(0)}({0:function(t,i,n){t.exports=n(1261)},3:function(t,i){t.exports=function(){throw Error("define cannot be used indirect")}},1006:function(t,i){t.exports=require("./kendo.core")},1038:function(t,i){t.exports=require("./kendo.popup")},1261:function(t,i,n){var e,o,a;!function(s,define){o=[n(1006),n(1038)],e=s,a="function"==typeof e?e.apply(i,o):e,!(void 0!==a&&(t.exports=a))}(function(){return function(t,i){var n=window.kendo,e=n.ui.Widget,o=t.proxy,a=t.extend,s=window.setTimeout,p="click",d="show",c="hide",l="k-notification",r=".k-notification-wrap .k-i-close",u="k-hiding",f="info",h="success",g="warning",m="error",_="top",w="left",k="bottom",v="right",b="up",P=".kendoNotification",T='<div class="k-widget k-popup k-notification"></div>',x='<div class="k-notification-wrap"><span class="k-icon k-i-#=typeIcon#" title="#=typeIcon#"></span><div class="k-notification-content">#=content#</div><span class="k-icon k-i-close" title="Hide"></span></div>',C=x.replace("#=content#","#:content#"),y=e.extend({init:function(i,o){var a=this;e.fn.init.call(a,i,o),o=a.options,o.appendTo&&t(o.appendTo).is(i)||a.element.hide(),a._compileTemplates(o.templates),a._guid="_"+n.guid(),a._isRtl=n.support.isRtl(i),a._compileStacking(o.stacking,o.position.top,o.position.left),n.notify(a)},events:[d,c],options:{name:"Notification",position:{pinned:!0,top:null,left:null,bottom:20,right:20},stacking:"default",hideOnClick:!0,button:!1,allowHideAfter:0,autoHideAfter:5e3,appendTo:null,width:null,height:null,templates:[],animation:{open:{effects:"fade:in",duration:300},close:{effects:"fade:out",duration:600,hide:!0}}},_compileTemplates:function(i){var e=this,o=n.template;e._compiled={},t.each(i,function(i,n){e._compiled[n.type]=o(n.template||t("#"+n.templateId).html())}),e._defaultCompiled=o(x),e._safeCompiled=o(C)},_getCompiled:function(t,i){var n=i?this._safeCompiled:this._defaultCompiled;return t?this._compiled[t]||n:n},_compileStacking:function(t,i,n){var e,o,a=this,s={paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},p=null!==n?w:v;switch(t){case"down":e=k+" "+p,o=_+" "+p,delete s.paddingBottom;break;case v:e=_+" "+v,o=_+" "+w,delete s.paddingRight;break;case w:e=_+" "+w,o=_+" "+v,delete s.paddingLeft;break;case b:e=_+" "+p,o=k+" "+p,delete s.paddingTop;break;default:null!==i?(e=k+" "+p,o=_+" "+p,delete s.paddingBottom):(e=_+" "+p,o=k+" "+p,delete s.paddingTop)}a._popupOrigin=e,a._popupPosition=o,a._popupPaddings=s},_attachPopupEvents:function(t,i){function n(t){t.on(p+P,function(){o._hidePopup(i)})}var e,o=this,a=t.allowHideAfter,d=!isNaN(a)&&a>0;t.hideOnClick?i.bind("activate",function(){d?s(function(){n(i.element)},a):n(i.element)}):t.button&&(e=i.element.find(r),d?s(function(){n(e)},a):n(e))},_showPopup:function(i,e){var o,p,d=this,c=e.autoHideAfter,l=e.position.left,f=e.position.top;p=t("."+d._guid+":not(."+u+")").last(),o=new n.ui.Popup(i,{anchor:p[0]?p:document.body,origin:d._popupOrigin,position:d._popupPosition,animation:e.animation,copyAnchorStyles:!1,modal:!0,collision:"",isRtl:d._isRtl,close:function(){d._triggerHide(this.element)},deactivate:function(t){t.sender.element.off(P),t.sender.element.find(r).off(P),t.sender.destroy()}}),d._attachPopupEvents(e,o),i.removeClass("k-group k-reset"),p[0]?o.open():(null===l&&(l=t(window).width()-i.outerWidth()-e.position.right),null===f&&(f=t(window).height()-i.outerHeight()-e.position.bottom),o.open(l,f)),o.wrapper.addClass(d._guid).css(a({margin:0,zIndex:10050},d._popupPaddings)),e.position.pinned?(o.wrapper.css("position","fixed"),p[0]&&d._togglePin(o.wrapper,!0)):p[0]||d._togglePin(o.wrapper,!1),c>0&&s(function(){d._hidePopup(o)},c)},_hidePopup:function(t){t.wrapper.addClass(u),t.close()},_togglePin:function(i,n){var e=t(window),o=n?-1:1;i.css({top:parseInt(i.css(_),10)+o*e.scrollTop(),left:parseInt(i.css(w),10)+o*e.scrollLeft()})},_attachStaticEvents:function(t,i){function n(t){t.on(p+P,o(e._hideStatic,e,i))}var e=this,a=t.allowHideAfter,d=!isNaN(a)&&a>0;t.hideOnClick?d?s(function(){n(i)},a):n(i):t.button&&(d?s(function(){n(i.find(r))},a):n(i.find(r)))},_showStatic:function(i,n){var e,o=this,a=n.autoHideAfter,p=n.animation,d=n.stacking==b||n.stacking==w?"prependTo":"appendTo";i.removeClass("k-popup").addClass(o._guid)[d](n.appendTo).hide().kendoAnimate(p.open||!1),e=o.getNotifications(),e.each(function(i,e){o._attachStaticEvents(n,t(e)),a>0&&s(function(){o._hideStatic(t(e))},a)})},_hideStatic:function(t){t.kendoAnimate(a(this.options.animation.close||!1,{complete:function(){t.off(P).find(r).off(P),t.remove()}})),this._triggerHide(t)},_triggerHide:function(t){this.trigger(c,{element:t}),this.angular("cleanup",function(){return{elements:t}})},show:function(e,o,s){var p,c,r=this,u=r.options,h=t(T);return o||(o=f),null!==e&&e!==i&&""!==e&&(n.isFunction(e)&&(e=e()),c={typeIcon:o,content:""},p=t.isPlainObject(e)?a(c,e):a(c,{content:e}),h.addClass(l+"-"+o).toggleClass(l+"-button",u.button).toggleClass(l+"-closable",u.button).attr("data-role","alert").css({width:u.width,height:u.height}).append(r._getCompiled(o,s)(p)),r.angular("compile",function(){return{elements:h,data:[{dataItem:p}]}}),t(u.appendTo)[0]?r._showStatic(h,u):r._showPopup(h,u),r.trigger(d,{element:h})),r},showText:function(t,i){this.show(t,i,!0)},info:function(t){return this.show(t,f)},success:function(t){return this.show(t,h)},warning:function(t){return this.show(t,g)},error:function(t){return this.show(t,m)},hide:function(){var i=this,n=i.getNotifications();return n.each(i.options.appendTo?function(n,e){i._hideStatic(t(e))}:function(n,e){var o=t(e).data("kendoPopup");o&&i._hidePopup(o)}),i},getNotifications:function(){var i=this,n=t("."+i._guid+":not(."+u+")");return i.options.appendTo?n:n.children("."+l)},setOptions:function(t){var n,o=this;e.fn.setOptions.call(o,t),n=o.options,t.templates!==i&&o._compileTemplates(n.templates),t.stacking===i&&t.position===i||o._compileStacking(n.stacking,n.position.top,n.position.left)},destroy:function(){e.fn.destroy.call(this),this.getNotifications().off(P).find(r).off(P)}});n.ui.plugin(y)}(window.kendo.jQuery),window.kendo},n(3))}});