UNPKG

@progress/kendo-ui

Version:

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

1 lines 4.74 kB
module.exports=function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return e[n].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}({0:function(e,t,i){e.exports=i(1244)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},1040:function(e,t){e.exports=require("./kendo.userevents")},1224:function(e,t){e.exports=require("./kendo.mobile.view")},1244:function(e,t,i){var n,s,o;!function(r,define){s=[i(1224),i(1040)],n=r,o="function"==typeof n?n.apply(t,s):n,!(void 0!==o&&(e.exports=o))}(function(){return function(e,t){var i=window.kendo,n=i.mobile,s=i.support.mobileOS,o=i.effects.Transition,r=i.roleSelector,a="x",h=n.ui,l=!(s.ios&&7==s.majorVersion&&!s.appMode),u="beforeShow",c="init",d="show",v="hide",w="afterHide",f={enable:e.noop},p=h.View.extend({init:function(t,s){var o,a,h,u,d;if(e(t).parent().prepend(t),n.ui.Widget.fn.init.call(this,t,s),this.options.$angular||(this._layout(),this._scroller()),this._model(),o=this.element.closest(r("pane")).data("kendoMobilePane"))this.pane=o,this.pane.bind("viewShow",function(e){u._viewShow(e)}),this.pane.bind("sameViewRequested",function(){u.hide()}),a=this.userEvents=new i.UserEvents(o.element,{fastTap:!0,filter:r("view splitview"),allowSelection:!0});else{if(this.currentView=f,h=e(this.options.container),!h)throw Error("The drawer needs a container configuration option set.");a=this.userEvents=new i.UserEvents(h,{fastTap:!0,allowSelection:!0}),this._attachTransition(h)}u=this,d=function(e){u.visible&&(u.hide(),e.preventDefault())},this.options.swipeToOpen&&l?(a.bind("press",function(){u.transition.cancel()}),a.bind("start",function(e){u._start(e)}),a.bind("move",function(e){u._update(e)}),a.bind("end",function(e){u._end(e)}),a.bind("tap",d)):a.bind("press",d),this.leftPositioned="left"===this.options.position,this.visible=!1,this.element.hide().addClass("km-drawer").addClass(this.leftPositioned?"km-left-drawer":"km-right-drawer"),this.trigger(c)},options:{name:"Drawer",position:"left",views:[],swipeToOpenViews:[],swipeToOpen:!0,title:"",container:null},events:[u,v,w,c,d],show:function(){this._activate()&&this._show()},hide:function(){this.currentView&&(this.currentView.enable(),p.current=null,this._moveViewTo(0),this.trigger(v,{view:this}))},openFor:function(){this.visible?this.hide():this.show()},destroy:function(){h.View.fn.destroy.call(this),this.userEvents.destroy()},_activate:function(){if(this.visible)return!0;var e=this._currentViewIncludedIn(this.options.views);return!(!e||this.trigger(u,{view:this}))&&(this._setAsCurrent(),this.element.show(),this.trigger(d,{view:this}),this._invokeNgController(),!0)},_currentViewIncludedIn:function(t){if(!this.pane||!t.length)return!0;var i=this.pane.view();return e.inArray(i.id.replace("#",""),t)>-1||e.inArray(i.element.attr("id"),t)>-1},_show:function(){this.currentView.enable(!1),this.visible=!0;var e=this.element.width();this.leftPositioned||(e=-e),this._moveViewTo(e)},_setAsCurrent:function(){p.last!==this&&(p.last&&p.last.element.hide(),this.element.show()),p.last=this,p.current=this},_moveViewTo:function(e){this.userEvents.cancel(),this.transition.moveTo({location:e,duration:400,ease:o.easeOutExpo})},_viewShow:function(e){return this.currentView&&this.currentView.enable(),this.currentView===e.view?(this.hide(),t):(this.currentView=e.view,this._attachTransition(e.view.element),t)},_attachTransition:function(e){var t=this,n=this.movable,s=n&&n.x;this.transition&&(this.transition.cancel(),this.movable.moveAxis("x",0)),n=this.movable=new i.ui.Movable(e),this.transition=new o({axis:a,movable:this.movable,onEnd:function(){0===n[a]&&(e[0].style.cssText="",t.element.hide(),t.trigger(w),t.visible=!1)}}),s&&(e.addClass("k-fx-hidden"),i.animationFrame(function(){e.removeClass("k-fx-hidden"),t.movable.moveAxis(a,s),t.hide()}))},_start:function(e){var n,s,o,r,a,h=e.sender;return Math.abs(e.x.velocity)<Math.abs(e.y.velocity)||i.triggeredByInput(e.event)||!this._currentViewIncludedIn(this.options.swipeToOpenViews)?(h.cancel(),t):(n=this.leftPositioned,s=this.visible,o=n&&s||!n&&!p.current,r=!n&&s||n&&!p.current,a=e.x.velocity<0,(o&&a||r&&!a)&&this._activate()?(h.capture(),t):(h.cancel(),t))},_update:function(e){var t,i=this.movable,n=i.x+e.x.delta;t=this.leftPositioned?Math.min(Math.max(0,n),this.element.width()):Math.max(Math.min(0,n),-this.element.width()),this.movable.moveAxis(a,t),e.event.preventDefault(),e.event.stopPropagation()},_end:function(e){var t,i=e.x.velocity,n=Math.abs(this.movable.x)>this.element.width()/2,s=.8;t=this.leftPositioned?i>-s&&(i>s||n):i<s&&(i<-s||n),t?this._show():this.hide()}});h.plugin(p)}(window.kendo.jQuery),window.kendo},i(3))}});