@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 10.5 kB
JavaScript
module.exports=function(i){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={exports:{},id:e,loaded:!1};return i[e].call(t.exports,t,t.exports,o),t.loaded=!0,t.exports}return o.m=i,o.c=n,o.p="",o(0)}({0:function(e,t,i){e.exports=i(1371)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},1051:function(e,t){e.exports=require("./kendo.core")},1080:function(e,t){e.exports=require("./kendo.mobile.scroller")},1133:function(e,t){e.exports=require("./kendo.fx")},1135:function(e,t){e.exports=require("./kendo.view")},1371:function(e,t,i){var n;i(3),i=[i(1051),i(1133),i(1080),i(1135)],void 0===(t="function"==typeof(n=function(){var e={id:"mobile.view",name:"View",category:"mobile",description:"Mobile View",depends:["core","fx","mobile.scroller","view"],hidden:true},s=window.kendo.jQuery,c=void 0,a=window.kendo,l=a.mobile,r=l.ui,h=a.attr,i=r.Widget,u=a.ViewClone,n="init",f='<div style="height: 100%; width: 100%; position: absolute; top: 0; left: 0; z-index: 20000; display: none"></div>',p="beforeShow",o="show",g="afterShow",v="beforeHide",m="transitionEnd",w="transitionStart",t="hide",y="destroy",_=a.attrValue,d=a.roleSelector,x=a.directiveSelector,b=a.compileMobileDirective;function S(e){var t=e.find(d("popover")),i,n,o=r.roles;for(i=0,n=t.length;i<n;i++)a.initWidget(t[i],{},o)}function V(e){if(!a.triggeredByInput(e))e.preventDefault()}var k=i.extend({init:function(e,t){i.fn.init.call(this,e,t);this.params={};s.extend(this,t);this.transition=this.transition||this.defaultTransition;this._id();if(!this.options.$angular){this._layout();this._overlay();this._scroller();this._model()}else this._overlay()},events:[n,p,o,g,v,t,y,w,m],options:{name:"View",title:"",layout:null,getLayout:s.noop,reload:false,transition:"",defaultTransition:"",useNativeScrolling:false,stretch:false,zoom:false,model:null,modelScope:window,scroller:{},initWidgets:true},enable:function(e){if(typeof e=="undefined")e=true;if(e)this.overlay.hide();else this.overlay.show()},destroy:function(){if(this.layout)this.layout.detach(this);this.trigger(y);i.fn.destroy.call(this);if(this.scroller)this.scroller.destroy();if(this.options.$angular)this.element.scope().$destroy();a.destroy(this.element)},purge:function(){this.destroy();this.element.remove()},triggerBeforeShow:function(){if(this.trigger(p,{view:this}))return false;return true},triggerBeforeHide:function(){if(this.trigger(v,{view:this}))return false;return true},showStart:function(){var e=this.element;e.css("display","");if(!this.inited){this.inited=true;this.trigger(n,{view:this})}else this._invokeNgController();if(this.layout)this.layout.attach(this);this._padIfNativeScrolling();this.trigger(o,{view:this});a.resize(e)},showEnd:function(){this.trigger(g,{view:this});this._padIfNativeScrolling()},hideEnd:function(){var e=this;e.element.hide();e.trigger(t,{view:e});if(e.layout)e.layout.trigger(t,{view:e,layout:e.layout})},beforeTransition:function(e){this.trigger(w,{type:e})},afterTransition:function(e){this.trigger(m,{type:e})},_padIfNativeScrolling:function(){if(l.appLevelNativeScrolling()){var e=a.support.mobileOS&&a.support.mobileOS.android,t=l.application.skin()||"",i=l.application.os.android||t.indexOf("android")>-1,n=t==="flat"||t.indexOf("material")>-1,o=(e||i)&&!n?"footer":"header",r=(e||i)&&!n?"header":"footer";this.content.css({paddingTop:this[o].height(),paddingBottom:this[r].height()})}},contentElement:function(){var e=this;return e.options.stretch?e.content:e.scrollerContent},clone:function(){return new u(this)},_scroller:function(){var e=this;if(l.appLevelNativeScrolling())return;if(e.options.stretch)e.content.addClass("km-stretched-view");else{e.content.kendoMobileScroller(s.extend(e.options.scroller,{zoom:e.options.zoom,useNative:e.options.useNativeScrolling}));e.scroller=e.content.data("kendoMobileScroller");e.scrollerContent=e.scroller.scrollElement}if(a.support.kineticScrollNeeded){s(e.element).on("touchmove",".km-header",V);if(!e.options.useNativeScrolling&&!e.options.stretch)s(e.element).on("touchmove",".km-content",V)}},_model:function(){var e=this,t=e.element,i=e.options.model;if(typeof i==="string")i=a.getter(i)(e.options.modelScope);e.model=i;S(t);e.element.css("display","");if(e.options.initWidgets)if(i)a.bind(t,i,r,a.ui,a.dataviz.ui);else l.init(t.children());e.element.css("display","none")},_id:function(){var e=this.element,t=e.attr("id")||"";this.id=_(e,"url")||"#"+t;if(this.id=="#"){this.id=a.guid();e.attr("id",this.id)}},_layout:function(){var e=d("content"),t=this.element;t.addClass("km-view");this.header=t.children(d("header")).addClass("km-header");this.footer=t.children(d("footer")).addClass("km-footer");if(!t.children(e)[0])t.wrapInner("<div "+h("role")+'="content"></div>');this.content=t.children(d("content")).addClass("km-content");this.element.prepend(this.header).append(this.footer);this.layout=this.options.getLayout(this.layout);if(this.layout)this.layout.setup(this)},_overlay:function(){this.overlay=s(f).appendTo(this.element)},_invokeNgController:function(){var e,t;if(this.options.$angular){e=this.element.controller();t=this.options.$angular[0];if(e){var i=this._callController.bind(this,e,t);if(/^\$(digest|apply)$/.test(t.$$phase))i();else t.$apply(i)}}},_callController:function(e,t){this.element.injector().invoke(e.constructor,e,{$scope:t})}});function C(e){e.each(function(){a.initWidget(s(this),{},r.roles)})}var $=i.extend({init:function(e,t){i.fn.init.call(this,e,t);e=this.element;this.header=e.children(this._locate("header")).addClass("km-header");this.footer=e.children(this._locate("footer")).addClass("km-footer");this.elements=this.header.add(this.footer);S(e);if(!this.options.$angular)a.mobile.init(this.element.children());this.element.detach();this.trigger(n,{layout:this})},_locate:function(e){return this.options.$angular?x(e):d(e)},options:{name:"Layout",id:null,platform:null},events:[n,o,t],setup:function(e){if(!e.header[0])e.header=this.header;if(!e.footer[0])e.footer=this.footer},detach:function(e){var t=this;if(e.header===t.header&&t.header[0])e.element.prepend(t.header.detach()[0].cloneNode(true));if(e.footer===t.footer&&t.footer.length)e.element.append(t.footer.detach()[0].cloneNode(true))},attach:function(e){var t=this,i=t.currentView;if(i)t.detach(i);if(e.header===t.header){t.header.detach();e.element.children(d("header")).remove();e.element.prepend(t.header)}if(e.footer===t.footer){t.footer.detach();e.element.children(d("footer")).remove();e.element.append(t.footer)}t.trigger(o,{layout:t,view:e});t.currentView=e}}),L=a.Observable,N=/<body[^>]*>(([\u000a\u000d\u2028\u2029]|.)*)<\/body>/i,T="loadStart",E="loadComplete",I="showStart",O="sameViewRequested",R="viewShow",W="viewTypeDetermined",z="after",M=L.extend({init:function(i){var t=this,e,n,o,r;L.fn.init.call(t);s.extend(t,i);t.sandbox=s("<div />");o=t.container;e=t._hideViews(o);t.rootView=e.first();if(!t.rootView[0]&&i.rootNeeded){if(o[0]==a.mobile.application.element[0])n='Your kendo mobile application element does not contain any direct child elements with data-role="view" attribute set. Make sure that you instantiate the mobile application using the correct container.';else n='Your pane element does not contain any direct child elements with data-role="view" attribute set.';throw new Error(n)}t.layouts={};t.viewContainer=new a.ViewContainer(t.container);t.viewContainer.bind("accepted",function(e){e.view.params=t.params});t.viewContainer.bind("complete",function(e){t.trigger(R,{view:e.view})});t.viewContainer.bind(z,function(){t.trigger(z)});this.getLayoutProxy=this._getLayout.bind(this);t._setupLayouts(o);r=o.children(t._locate("modalview drawer"));if(t.$angular){t.$angular[0].viewOptions={defaultTransition:t.transition,loader:t.loader,container:t.container,getLayout:t.getLayoutProxy};r.each(function(e,t){b(s(t),i.$angular[0])})}else C(r);this.bind(this.events,i)},events:[I,z,R,T,E,O,W],destroy:function(){a.destroy(this.container);for(var e in this.layouts)this.layouts[e].destroy()},view:function(){return this.viewContainer.view},showView:function(t,i,e){t=t.replace(new RegExp("^"+this.remoteViewURLPrefix),"");if(t===""&&this.remoteViewURLPrefix)t="/";if(t.replace(/^#/,"")===this.url){this.trigger(O);return false}this.trigger(I);var n=this,o=function(e){return n.viewContainer.show(e,i,t)},r=n._findViewElement(t),s=a.widgetInstance(r);n.url=t.replace(/^#/,"");n.params=e;if(s&&s.reload){s.purge();r=[]}this.trigger(W,{remote:r.length===0,url:t});if(r[0]){if(!s)s=n._createView(r);return o(s)}else{if(this.serverNavigation)location.href=t;else n._loadView(t,o);return true}},append:function(e,t){var i=this.sandbox,n=(t||"").split("?")[0],o=this.container,r,s,a;if(N.test(e))e=RegExp.$1;i[0].innerHTML=e;o.append(i.children("script, style"));r=this._hideViews(i);a=r.first();if(!a.length)r=a=i.wrapInner("<div data-role=view />").children();if(n)a.hide().attr(h("url"),n);this._setupLayouts(i);s=i.children(this._locate("modalview drawer"));o.append(i.children(this._locate("layout modalview drawer")).add(r));C(s);return this._createView(a)},_locate:function(e){return this.$angular?x(e):d(e)},_findViewElement:function(e){var t,i=e.split("?")[0];if(!i)return this.rootView;t=this.container.children("["+h("url")+"='"+i+"']");if(!t[0]&&i.indexOf("/")===-1)t=this.container.children(i.charAt(0)==="#"?i:"#"+i);return t},_createView:function(e){if(this.$angular)return b(e,this.$angular[0]);else return a.initWidget(e,{defaultTransition:this.transition,loader:this.loader,container:this.container,getLayout:this.getLayoutProxy,modelScope:this.modelScope,reload:_(e,"reload")},r.roles)},_getLayout:function(e){if(e==="")return null;return e?this.layouts[e]:this.layouts[this.layout]},_loadView:function(e,t){if(this._xhr)this._xhr.abort();this.trigger(T);this._xhr=s.get(a.absoluteURL(e,this.remoteViewURLPrefix),"html").always(this._xhrComplete.bind(this,t,e))},_xhrComplete:function(e,t,i){var n=true;if(typeof i==="object")if(i.status===0)if(i.responseText&&i.responseText.length>0){n=true;i=i.responseText}else return;this.trigger(E);if(n)e(this.append(i,t))},_hideViews:function(e){return e.children(this._locate("view splitview")).hide()},_setupLayouts:function(e){var t=this,i;e.children(t._locate("layout")).each(function(){if(t.$angular)i=b(s(this),t.$angular[0]);else i=a.initWidget(s(this),{},r.roles);var e=i.options.platform;if(!e||e===l.application.os.name)t.layouts[i.options.id]=i;else i.destroy()})}});return a.mobile.ViewEngine=M,r.plugin(k),r.plugin($),window.kendo})?n.apply(t,i):n)||(e.exports=t)}});