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.switch.min",["kendo.core.min"],e)}(function(){return function(e,t){var n=window.kendo,c=n.ui,a=".kendoSwitch",i=c.Widget,s=n.support,d="change",l={widget:"k-switch k-widget",container:"k-switch-container",handle:"k-switch-handle",checked:"k-switch-on",checkedLabel:"k-switch-label-on",unchecked:"k-switch-off",uncheckedLabel:"k-switch-label-off",disabled:"k-state-disabled",readonly:"k-state-readonly",active:"k-state-active"},r="disabled",o="aria-disabled",h="readonly",k="aria-readonly",p="aria-checked",u="checked",w=s.click+a,f=s.pointers?"pointerup":"touchend",y="keydown"+a,b="_label",g=e.proxy,m=n.template('<span class="#=styles.widget#" role="switch"></span>'),v=n.template("<span class='#=styles.container#'><span class='#=styles.checkedLabel#'>#=checked#</span><span class='#=styles.uncheckedLabel#'>#=unchecked#</span><span class='#=styles.handle#'></span></span>"),_=i.extend({init:function(t,c){var a,s=this;i.fn.init.call(s,t,c),c=s.options,t=s.element[0],t.type="checkbox",a=e(m({styles:l})),s.wrapper=s.element.wrap(a).parent(),s.wrapper.append(e(v({styles:l,checked:c.messages.checked,unchecked:c.messages.unchecked}))).addClass(t.className),s.wrapper.on(w,g(s._click,s)).on(f,g(s._touchEnd,s)).on(y,g(s._keydown,s)),s.options.enabled&&s._tabindex(),s._initSettings(),s._aria(),n.notify(s,n.ui)},setOptions:function(n){var c,a,i=this,s=n.messages;i.options=e.extend(i.options,n),s&&s.checked!==t&&(c=i.wrapper.find("."+l.checkedLabel),c.text(s.checked)),s&&s.unchecked!==t&&(a=i.wrapper.find("."+l.uncheckedLabel),a.text(s.unchecked)),n.width&&i.wrapper.css({width:n.width}),n.enabled!==t&&i.enable(n.enabled),n.readonly!==t&&i.readonly(n.readonly),i.check(n.checked)},_initSettings:function(){var e=this,t=e.element[0],n=e.options;n.width&&e.wrapper.css({width:n.width}),null===n.checked&&(n.checked=t.checked),e.check(n.checked),n.enabled=n.enabled&&!e.element.attr(r),e.enable(n.enabled),n.readonly=n.readonly||!!e.element.attr(h),e.readonly(n.readonly)},_aria:function(){var t,c=this,a=c.element,i=c.wrapper,s=a.attr("id"),d=e('label[for="'+s+'"]'),l=a.attr("aria-label"),r=a.attr("aria-labelledby");l?i.attr("aria-label",l):r?i.attr("aria-labelledby",r):d.length&&(t=d.attr("id"),t||(t=(s||n.guid())+b,d.attr("id",t)),i.attr("aria-labelledby",t))},events:[d],options:{name:"Switch",messages:{checked:"On",unchecked:"Off"},width:null,checked:null,enabled:!0,readonly:!1},check:function(e){var n=this,c=n.element[0];return e===t?c.checked:(c.checked!==e&&(n.options.checked=c.checked=e),n.wrapper.attr(p,e).toggleClass(l.checked,e).toggleClass(l.unchecked,!e),e?n.element.attr(u,u):n.element.removeAttr(u),t)},value:function(e){return"string"==typeof e&&(e="true"===e),this.check.apply(this,[e])},destroy:function(){i.fn.destroy.call(this),this.wrapper.off(a)},toggle:function(){var e=this;e.check(!e.element[0].checked)},enable:function(e){var n=this.element,c=this.wrapper;t===e&&(e=!0),this.options.enabled=e,e?(n.removeAttr(r),c.removeAttr(o)):(n.attr(r,r),c.attr(o,!0)),c.toggleClass(l.disabled,!e)},readonly:function(e){var n=this,c=n.element,a=n.wrapper;t===e&&(e=!0),n.options.readonly=e,e?(c.attr(h,!0),a.attr(k,!0)):(c.removeAttr(h),a.removeAttr(k)),a.toggleClass(l.readonly,e)},_check:function(){var e=this,n=e.element[0].checked=!e.element[0].checked;return e.wrapper.focus(),!e.options.enabled||e.options.readonly||e.trigger(d,{checked:n})?(e.element[0].checked=!n,t):(e.check(n),t)},_keydown:function(e){e.keyCode===n.keys.SPACEBAR&&(this._check(),e.preventDefault())},_isTouch:function(e){return/touch/.test(e.type)||e.originalEvent&&/touch/.test(e.originalEvent.pointerType)},_click:function(e){this._isTouch(e)||1!==e.which||this._check()},_touchEnd:function(e){this._isTouch(e)&&(this._check(),e.preventDefault())}});c.plugin(_)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()});
- //# sourceMappingURL=kendo.switch.min.js.map
|