Jonathan Ouellette 580e90f6a2 initial add
2022-09-27 14:10:30 -07:00

10 lines
9.8 KiB
JavaScript

/*
* Kendo UI Complete v2013.3.1119 (http://kendoui.com)
* Copyright 2013 Telerik AD. All rights reserved.
*
* Kendo UI Complete commercial licenses may be obtained at
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
!function(define){return define(["./kendo.core.min","./kendo.fx.min","./kendo.mobile.scroller.min"],function(){!function(e,t){function i(e){var t,i,n=e.find(b("popover")),o=l.roles;for(t=0,i=n.length;i>t;t++)a.initWidget(n[t],{},o)}function n(e){a.triggeredByInput(e)||e.preventDefault()}function o(e,t,i){e[0]&&t[0]&&e[0]!=t[0]&&e.kendoAnimateTo(t,{effects:"fade",duration:f,reverse:i})}function r(t){t.each(function(){a.initWidget(e(this),{},l.roles)})}var a=window.kendo,s=a.mobile,l=s.ui,d=a.attr,c=a.Class,h=l.Widget,u="init",f=320,p='<div style="height: 100%; width: 100%; position: absolute; top: 0; left: 0; z-index: 20000; display: none" />',m="beforeShow",v="show",w="afterShow",g="beforeHide",y="hide",_="z-index",x=a.attrValue,b=a.roleSelector,k=h.extend({init:function(t,i){var n=this;h.fn.init.call(n,t,i),t=n.element,n.params={},n._paramsHistory=[],e.extend(n,i),n.applicationNativeScrolling=s.application&&s.application.options.useNativeScrolling,n._id(),n._layout(),n._scroller(),n._model()},events:[u,m,v,w,g,y],options:{name:"View",title:"",reload:!1,defaultTransition:"",useNativeScrolling:!1,stretch:!1,zoom:!1,model:null,initWidgets:!0},enable:function(e){t===e&&(e=!0),e?this.overlay.hide():this.overlay.show()},destroy:function(){this.layout&&this.layout.detach(this),h.fn.destroy.call(this),this.scroller&&this.scroller.destroy(),a.destroy(this.element)},purge:function(){this.destroy(),this.element.remove()},showStart:function(){var e=this;e.element.css("display",""),e.inited||(e.inited=!0,e.trigger(u,{view:e})),e.layout&&e.layout.attach(e),e._padIfNativeScrolling(),e.trigger(v,{view:e}),a.resize(e.element)},hideStart:function(){this.trigger(g,{view:this})},hideComplete:function(){var e=this;e.element.hide(),e.trigger(y,{view:e})},updateParams:function(e,t,i){this._paramsHistory[this._paramsHistory.length-2]===JSON.stringify(t)&&(this._paramsHistory.pop(),this.nextViewID=this.id,this.backTransition=this.transition),this.switchWith(new V(this),e,t,i)},_padIfNativeScrolling:function(){this.applicationNativeScrolling&&this.content.css({paddingTop:this.header.height(),paddingBottom:this.footer.height()})},switchWith:function(e,t,i,n){var o=this,r=this._paramsHistory,a=function(){o.trigger(w,{view:o}),o._padIfNativeScrolling(),n()};o.trigger(m,{view:o})||(o._back=r[r.length-1]===JSON.stringify(i),o._back||r.push(JSON.stringify(i)),o.params=i,e?(e.hideStart(),o.showStart(),new S({current:e,next:o,transition:t,defaultTransition:e.options.defaultTransition,complete:a})):(o.showStart(),a()))},parallaxContents:function(e){var t=this,i=t.content;return e.header[0]||(i=i.add(t.header)),e.footer[0]||(i=i.add(t.footer)),i},contentElement:function(){var e=this;return e.options.stretch?e.content:e.scrollerContent},_scroller:function(){var t=this;t.applicationNativeScrolling||(t.options.stretch?t.content.addClass("km-stretched-view"):(t.content.kendoMobileScroller({zoom:t.options.zoom,useNative:t.options.useNativeScrolling}),t.scroller=t.content.data("kendoMobileScroller"),t.scrollerContent=t.scroller.scrollElement),a.support.kineticScrollNeeded&&(e(t.element).on("touchmove",".km-header",n),t.options.useNativeScrolling||e(t.element).on("touchmove",".km-content",n)))},_model:function(){var e=this,t=e.element,n=e.options.model;"string"==typeof n&&(n=a.getter(n)(window)),e.model=n,i(t),e.element.css("display",""),e.options.initWidgets&&(n?a.bind(t.children(),n,l,a.ui,a.dataviz.ui):s.init(t.children())),e.element.css("display","none")},_id:function(){var e=this.element,t=e.attr("id")||"";this.id=x(e,"url")||"#"+t,"#"==this.id&&(this.id=a.guid(),e.attr("id",this.id))},_layout:function(){var t=this,i=b("content"),n=t.element;n.data("kendoView",t).addClass("km-view"),t.transition=x(n,"transition"),t.header=n.children(b("header")).addClass("km-header"),t.footer=n.children(b("footer")).addClass("km-footer"),n.children(i)[0]||n.wrapInner("<div "+d("role")+'="content"></div>'),t.content=n.children(b("content")).addClass("km-content"),t.element.prepend(t.header).append(t.footer),t.overlay=e(p).appendTo(t.element),t.layout&&t.layout.setup(t)}}),V=a.mobile.ui.Widget.extend({init:function(t){var i=t.element.clone(!0);e.extend(this,{element:i,header:i.children(b("header")),content:i.children(b("content")),footer:i.children(b("footer")),transition:t.transition,options:{defaultTransition:t.options.defaultTransition},params:JSON.stringify(t.params),id:t.id}),t.element.parent().append(this.element)},parallaxContents:k.prototype.parallaxContents,hideStart:e.noop,hideComplete:function(){this.element.remove()}}),S=c.extend({init:function(t){e.extend(this,t);var i=this,n=i.current,r=i.next,a=n.element,s=r.element,l=r,d=n,c=i._transition();c.reverse&&(l=n,d=r),l.element.css(_,1),d.element.css(_,0),c.parallax&&(o(n.footer,r.footer,c.reverse),o(n.header,r.header,c.reverse),a=n.parallaxContents(r),s=r.parallaxContents(n)),a.kendoAnimateTo(s,c),i.back()||(n.nextViewID=r.id,n.backTransition=c.transition)},_transition:function(){var e=this,t=e.current,i=e.next,n=e.back(),o=function(){t.hideComplete(),e.complete()},r=n?i.backTransition:i.transition,a=e.transition||r||e.defaultTransition,s=a.split(" "),l=s[0],d=/^slide/.test(l),c="reverse"===s[1];return e.back()&&!e.transition&&(c=!c),{effects:l,reverse:c,parallax:d,complete:o,transition:a,duration:f}},back:function(){var e=this.next,t=this.current;return e.nextViewID&&e.nextViewID===t.id&&e._back}}),N=h.extend({init:function(e,t){var n=this;h.fn.init.call(n,e,t),e=n.element,n.element=e.detach(),n.header=e.children(b("header")).addClass("km-header"),n.footer=e.children(b("footer")).addClass("km-footer"),n.elements=n.header.add(n.footer),i(e),a.mobile.init(n.element.children()),n.trigger(u,{layout:n})},options:{name:"Layout"},events:[u,v,y],setup:function(e){e.header[0]||(e.header=this.header),e.footer[0]||(e.footer=this.footer)},detach:function(e){var t=this;e.header===t.header&&t.header[0]&&e.element.prepend(t.header.detach()[0].cloneNode(!0)),e.footer===t.footer&&t.footer.length&&e.element.append(t.footer.detach()[0].cloneNode(!0)),t.trigger(y,{layout:t,view:e})},attach:function(e){var t=this,i=t.currentView;i&&t.detach(i),e.header===t.header&&(t.header.detach(),e.element.children(b("header")).remove(),e.element.prepend(t.header)),e.footer===t.footer&&(t.footer.detach(),e.element.children(b("footer")).remove(),e.element.append(t.footer)),t.trigger(v,{layout:t,view:e}),t.currentView=e}}),C=a.Observable,T=/<body[^>]*>(([\u000a\u000d\u2028\u2029]|.)*)<\/body>/i,W="loadStart",I="loadComplete",L="showStart",E="sameViewRequested",z="viewShow",D=C.extend({init:function(t){var i,n,o,s=this;if(C.fn.init.call(s),e.extend(s,t),s.sandbox=e("<div />"),o=s.container,i=s._hideViews(o),s.rootView=i.first(),!s.rootView[0]&&t.rootNeeded)throw n=o[0]==a.mobile.application.element[0]?'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.':'Your pane element does not contain any direct child elements with data-role="view" attribute set.',Error(n);s._view=null,s.layouts={},s._setupLayouts(o),r(o.children(b("modalview drawer"))),s.loader&&(s.bind(L,function(){s.loader.transition()}),s.bind(W,function(){s.loader.show()}),s.bind(I,function(){s.loader.hide()}),s.bind(z,function(){s.loader.transitionDone()}))},view:function(){return this._view},showView:function(e,i,n){if(e=e.replace(RegExp("^"+this.remoteViewURLPrefix),""),""===e&&this.remoteViewURLPrefix&&(e="/"),e===this.url)return this.trigger(E),t;this.trigger(L);var o=this,r=function(e){o._show(e,i,n)},a=o._findViewElement(e),s=a.data("kendoView");o.url=e,s&&s.reload&&(s.purge(),a=[]),this.trigger("viewTypeDetermined",{remote:0===a.length,url:e}),a[0]?(s||(s=o._createView(a)),r(s)):o._loadView(e,r)},append:function(e,t){var i,n,o,a=this,s=a.sandbox,l=(t||"").split("?")[0],c=a.container;return T.test(e)&&(e=RegExp.$1),s[0].innerHTML=e,c.append(s.children("script, style")),i=a._hideViews(s),o=i.first(),o.length||(i=o=s.wrapInner("<div data-role=view />").children()),l&&o.hide().attr(d("url"),l),a._setupLayouts(s),n=s.children(b("modalview drawer")),c.append(s.children(b("layout modalview drawer")).add(i)),r(n),a._createView(o)},_findViewElement:function(e){var t,i=e.split("?")[0];return i?(t=this.container.children("["+d("url")+"='"+i+"']"),t[0]||-1!==i.indexOf("/")||(t=this.container.children("#"===i.charAt(0)?i:"#"+i)),t):this.rootView},_createView:function(e){var i,n=this,o=x(e,"layout");return t===o&&(o=n.layout),o&&(o=n.layouts[o]),i={defaultTransition:n.transition,loader:n.loader,container:n.container,layout:o,reload:x(e,"reload")},a.initWidget(e,i,l.roles)},_loadView:function(i,n){var o=this;return this.serverNavigation?(location.href=i,t):(o._xhr&&o._xhr.abort(),o.trigger(W),o._xhr=e.get(a.absoluteURL(i,o.remoteViewURLPrefix),function(e){o.trigger(I),n(o.append(e,i))},"html").fail(function(e){o.trigger(I),0===e.status&&e.responseText&&n(o.append(e.responseText,i))}),t)},_show:function(e,t,i){var n=this;n._view!==e?e.switchWith(n._view,t,i,function(){n._view=e,n.trigger(z,{view:e})}):n._view.updateParams(t,i,function(){n.trigger(z,{view:n._view})})},_hideViews:function(e){return e.children(b("view splitview")).hide()},_setupLayouts:function(i){var n=this;i.children(b("layout")).each(function(){var i=e(this),o=x(i,"platform");(o===t||o===s.application.os.name)&&(n.layouts[a.attrValue(i,"id")]=a.initWidget(i,{},l.roles))})}});a.mobile.ViewEngine=D,l.plugin(k),l.plugin(N)}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(e,t){return t()});
//@ sourceMappingURL=kendo.mobile.view.min.js.map