1234567891011121314151617181920212223242526 |
- /**
- * Kendo UI v2019.2.619 (http://www.telerik.com/kendo-ui)
- * Copyright 2019 Progress Software Corporation and/or one of its subsidiaries or affiliates. 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.switch.min",["kendo.fx.min","kendo.userevents.min"],e)}(function(){return function(e,n){function t(e){return"km-"+e}function s(e,n,t){return Math.max(n,Math.min(t,e))}var i=window.kendo,o=i.mobile.ui,a=i._outerWidth,r=o.Widget,c=i.support,l="change",p="switch-on",d="switch-off",h="margin-left",f="state-active",u="state-disabled",g="disabled",k=c.transitions.css===n?"":c.transitions.css,m=k+"transform",w=e.proxy,b='<span class="'+t("switch")+" "+t("widget")+'"> <span class="'+t("switch-wrapper")+'"> <span class="'+t("switch-background")+'"></span> </span> <span class="'+t("switch-container")+'"> <span class="'+t("switch-handle")+'"> <span class="'+t("switch-label-on")+'">{0}</span> <span class="'+t("switch-label-off")+'">{1}</span> </span> </span> </span>',v=r.extend({init:function(n,t){var s,o=this;r.fn.init.call(o,n,t),t=o.options,o.wrapper=e(i.format(b,t.onLabel,t.offLabel)),o.handle=o.wrapper.find(".km-switch-handle"),o.background=o.wrapper.find(".km-switch-background"),o.wrapper.insertBefore(o.element).prepend(o.element),o._drag(),o.origin=parseInt(o.background.css(h),10),o.constrain=0,o.snapPoint=0,n=o.element[0],n.type="checkbox",o._animateBackground=!0,s=o.options.checked,null===s&&(s=n.checked),o.check(s),o.options.enable=o.options.enable&&!o.element.attr(g),o.enable(o.options.enable),o.refresh(),i.notify(o,i.mobile.ui)},refresh:function(){var e=this,n=a(e.handle,!0);e.width=e.wrapper.width(),e.constrain=e.width-n,e.snapPoint=e.constrain/2,"number"!=typeof e.origin&&(e.origin=parseInt(e.background.css(h),10)),e.background.data("origin",e.origin),e.check(e.element[0].checked)},events:[l],options:{name:"Switch",onLabel:"on",offLabel:"off",checked:null,enable:!0},check:function(e){var s=this,i=s.element[0];return e===n?i.checked:(s._position(e?s.constrain:0),i.checked=e,s.wrapper.toggleClass(t(p),e).toggleClass(t(d),!e),n)},value:function(){return this.check.apply(this,arguments)},destroy:function(){r.fn.destroy.call(this),this.userEvents.destroy()},toggle:function(){var e=this;e.check(!e.element[0].checked)},enable:function(e){var s=this.element,i=this.wrapper;n===e&&(e=!0),this.options.enable=e,e?s.removeAttr(g):s.attr(g,g),i.toggleClass(t(u),!e)},_resize:function(){this.refresh()},_move:function(e){var n=this;e.preventDefault(),n._position(s(n.position+e.x.delta,0,n.width-a(n.handle,!0)))},_position:function(e){var n=this;n.position=e,n.handle.css(m,"translatex("+e+"px)"),n._animateBackground&&n.background.css(h,n.origin+e)},_start:function(){this.options.enable?(this.userEvents.capture(),this.handle.addClass(t(f))):this.userEvents.cancel()},_stop:function(){var e=this;e.handle.removeClass(t(f)),e._toggle(e.position>e.snapPoint)},_toggle:function(e){var n,s=this,o=s.handle,a=s.element[0],r=a.checked,c=i.mobile.application&&i.mobile.application.os.wp?100:200;s.wrapper.toggleClass(t(p),e).toggleClass(t(d),!e),s.position=n=e*s.constrain,s._animateBackground&&s.background.kendoStop(!0,!0).kendoAnimate({effects:"slideMargin",offset:n,reset:!0,reverse:!e,axis:"left",duration:c}),o.kendoStop(!0,!0).kendoAnimate({effects:"slideTo",duration:c,offset:n+"px,0",reset:!0,complete:function(){r!==e&&(a.checked=e,s.trigger(l,{checked:e}))}})},_drag:function(){var e=this;e.userEvents=new i.UserEvents(e.wrapper,{fastTap:!0,tap:function(){e.options.enable&&e._toggle(!e.element[0].checked)},start:w(e._start,e),move:w(e._move,e),end:w(e._stop,e)})}});o.plugin(v)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,n,t){(t||n)()});
- //# sourceMappingURL=kendo.mobile.switch.min.js.map
|