demo20230512/Scripts/kendo/2014.2.716/kendo.mobile.view.min.js

16 lines
8.4 KiB
JavaScript
Raw Permalink Normal View History

2023-05-12 10:20:28 +08:00
/**
* Copyright 2014 Telerik AD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(e,define){define(["./kendo.core.min","./kendo.fx.min","./kendo.mobile.scroller.min","./kendo.view.min"],e)}(function(){return function(e,t){function n(e){var t,n,i=e.find(k("popover")),r=s.roles;for(t=0,n=i.length;n>t;t++)o.initWidget(i[t],{},r)}function i(e){o.triggeredByInput(e)||e.preventDefault()}function r(t){t.each(function(){o.initWidget(e(this),{},s.roles)})}var o=window.kendo,a=o.mobile,s=a.ui,l=o.attr,u=s.Widget,c=o.ViewClone,d="init",f='<div style="height: 100%; width: 100%; position: absolute; top: 0; left: 0; z-index: 20000; display: none" />',p="beforeShow",h="show",g="afterShow",m="beforeHide",v="transitionEnd",_="transitionStart",w="hide",y="destroy",b=o.attrValue,k=o.roleSelector,x=u.extend({init:function(t,n){u.fn.init.call(this,t,n),this.params={},e.extend(this,n),this.transition=this.transition||this.defaultTransition,this._id(),this._layout(),this._overlay(),this._scroller(),this._model()},events:[d,p,h,g,m,w,y,_,v],options:{name:"View",title:"",reload:!1,transition:"",defaultTransition:"",useNativeScrolling:!1,stretch:!1,zoom:!1,model:null,modelScope:window,scroller:{},initWidgets:!0},enable:function(e){t===e&&(e=!0),e?this.overlay.hide():this.overlay.show()},destroy:function(){this.layout&&this.layout.detach(this),this.trigger(y),u.fn.destroy.call(this),this.scroller&&this.scroller.destroy(),o.destroy(this.element)},purge:function(){this.destroy(),this.element.remove()},triggerBeforeShow:function(){return this.trigger(p,{view:this})?!1:!0},showStart:function(){var e=this;e.element.css("display",""),e.inited||(e.inited=!0,e.trigger(d,{view:e})),e.layout&&e.layout.attach(e),e._padIfNativeScrolling(),e.trigger(h,{view:e}),o.resize(e.element)},showEnd:function(){this.trigger(g,{view:this}),this._padIfNativeScrolling()},hideStart:function(){this.trigger(m,{view:this})},hideEnd:function(){var e=this;e.element.hide(),e.trigger(w,{view:e}),e.layout&&e.layout.trigger(w,{view:e,layout:e.layout})},beforeTransition:function(e){this.trigger(_,{type:e})},afterTransition:function(e){this.trigger(v,{type:e})},_padIfNativeScrolling:function(){if(a.appLevelNativeScrolling()){var e=o.support.mobileOS&&o.support.mobileOS.android,t=e?"footer":"header",n=e?"header":"footer";this.content.css({paddingTop:this[t].height(),paddingBottom:this[n].height()})}},contentElement:function(){var e=this;return e.options.stretch?e.content:e.scrollerContent},clone:function(){return new c(this)},_scroller:function(){var t=this;a.appLevelNativeScrolling()||(t.options.stretch?t.content.addClass("km-stretched-view"):(t.content.kendoMobileScroller(e.extend(t.options.scroller,{zoom:t.options.zoom,useNative:t.options.useNativeScrolling})),t.scroller=t.content.data("kendoMobileScroller"),t.scrollerContent=t.scroller.scrollElement),o.support.kineticScrollNeeded&&(e(t.element).on("touchmove",".km-header",i),t.options.useNativeScrolling||e(t.element).on("touchmove",".km-content",i)))},_model:function(){var e=this,t=e.element,i=e.options.model;"string"==typeof i&&(i=o.getter(i)(e.options.modelScope)),e.model=i,n(t),e.element.css("display",""),e.options.initWidgets&&(i?o.bind(t,i,s,o.ui,o.dataviz.ui):a.init(t.children())),e.element.css("display","none")},_id:function(){var e=this.element,t=e.attr("id")||"";this.id=b(e,"url")||"#"+t,"#"==this.id&&(this.id=o.guid(),e.attr("id",this.id))},_layout:function(){var e=this,t=k("content"),n=e.element;n.addClass("km-view"),e.header=n.children(k("header")).addClass("km-header"),e.footer=n.children(k("footer")).addClass("km-footer"),n.children(t)[0]||n.wrapInner("<div "+l("role")+'="content"></div>'),e.content=n.children(k("content")).addClass("km-content"),e.element.prepend(e.header).append(e.footer),e.layout&&e.layout.setup(e)},_overlay:function(){this.overlay=e(f).appendTo(this.element)}}),C=u.extend({init:function(e,t){var i=this;u.fn.init.call(i,e,t),e=i.element,i.header=e.children(k("header")).addClass("km-header"),i.footer=e.children(k("footer")).addClass("km-footer"),i.elements=i.header.add(i.footer),n(e),o.mobile.init(i.element.children()),i.element.detach(),i.trigger(d,{layout:i})},options