EOS/Scripts/kendo/2015.3.1111/kendo.mobile.drawer.min.js
Nidhi Bhargava f0c1ab20e1 code push
2025-09-04 16:25:07 +05:30

9 lines
4.5 KiB
JavaScript

/*
* Kendo UI v2015.3.1111 (http://www.telerik.com/kendo-ui)
* Copyright 2015 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
!function(e,define){define(["./kendo.mobile.view.min","./kendo.userevents.min"],e)}(function(){return function(e,t){var n=window.kendo,i=n.mobile,o=n.support.mobileOS,r=n.effects.Transition,a=n.roleSelector,s="x",l=i.ui,c=!(o.ios&&7==o.majorVersion&&!o.appMode),u="beforeShow",d="init",h="show",f="hide",p="afterHide",g={enable:e.noop},m=l.View.extend({init:function(t,o){var r,s,l,u,h;if(e(t).parent().prepend(t),i.ui.Widget.fn.init.call(this,t,o),this.options.$angular||(this._layout(),this._scroller()),this._model(),r=this.element.closest(a("pane")).data("kendoMobilePane"))this.pane=r,this.pane.bind("viewShow",function(e){u._viewShow(e)}),this.pane.bind("sameViewRequested",function(){u.hide()}),s=this.userEvents=new n.UserEvents(r.element,{filter:a("view splitview"),allowSelection:!0});else{if(this.currentView=g,l=e(this.options.container),!l)throw Error("The drawer needs a container configuration option set.");s=this.userEvents=new n.UserEvents(l,{allowSelection:!0}),this._attachTransition(l)}u=this,h=function(e){u.visible&&(u.hide(),e.preventDefault())},this.options.swipeToOpen&&c?(s.bind("press",function(){u.transition.cancel()}),s.bind("start",function(e){u._start(e)}),s.bind("move",function(e){u._update(e)}),s.bind("end",function(e){u._end(e)}),s.bind("tap",h)):s.bind("press",h),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(d)},options:{name:"Drawer",position:"left",views:[],swipeToOpenViews:[],swipeToOpen:!0,title:"",container:null},events:[u,f,p,d,h],show:function(){this._activate()&&this._show()},hide:function(){this.currentView&&(this.currentView.enable(),m.current=null,this._moveViewTo(0),this.trigger(f,{view:this}))},openFor:function(){this.visible?this.hide():this.show()},destroy:function(){l.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})?!1:(this._setAsCurrent(),this.element.show(),this.trigger(h,{view:this}),this._invokeNgController(),!0)},_currentViewIncludedIn:function(t){if(!this.pane||!t.length)return!0;var n=this.pane.view();return e.inArray(n.id.replace("#",""),t)>-1||e.inArray(n.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(){m.last!==this&&(m.last&&m.last.element.hide(),this.element.show()),m.last=this,m.current=this},_moveViewTo:function(e){this.userEvents.cancel(),this.transition.moveTo({location:e,duration:400,ease:r.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,i=this.movable,o=i&&i.x;this.transition&&(this.transition.cancel(),this.movable.moveAxis("x",0)),i=this.movable=new n.ui.Movable(e),this.transition=new r({axis:s,movable:this.movable,onEnd:function(){0===i[s]&&(e[0].style.cssText="",t.element.hide(),t.trigger(p),t.visible=!1)}}),o&&(e.addClass("k-fx-hidden"),n.animationFrame(function(){e.removeClass("k-fx-hidden"),t.movable.moveAxis(s,o),t.hide()}))},_start:function(e){var i,o,r,a,s,l=e.sender;return Math.abs(e.x.velocity)<Math.abs(e.y.velocity)||n.triggeredByInput(e.event)||!this._currentViewIncludedIn(this.options.swipeToOpenViews)?(l.cancel(),t):(i=this.leftPositioned,o=this.visible,r=i&&o||!i&&!m.current,a=!i&&o||i&&!m.current,s=0>e.x.velocity,(r&&s||a&&!s)&&this._activate()?(l.capture(),t):(l.cancel(),t))},_update:function(e){var t,n=this.movable,i=n.x+e.x.delta;t=this.leftPositioned?Math.min(Math.max(0,i),this.element.width()):Math.max(Math.min(0,i),-this.element.width()),this.movable.moveAxis(s,t),e.event.preventDefault(),e.event.stopPropagation()},_end:function(e){var t,n=e.x.velocity,i=Math.abs(this.movable.x)>this.element.width()/2,o=.8;t=this.leftPositioned?n>-o&&(n>o||i):o>n&&(-o>n||i),t?this._show():this.hide()}});l.plugin(m)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});