kendo-ui-core
Version:
Kendo UI is everything you need to build sites and apps with HTML5 & JavaScript. Kendo UI Core is the free and open-source version of Kendo UI that provides access to the web's best UI widgets and key framework features, essential for developing great exp
17 lines • 2.51 kB
JavaScript
/*!
* Copyright 2026 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
*
* 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.
*/
import"./core-COCvCZRc.js";import"./kendo.core.js";const e={id:`toggleinputbase`,name:`ToggleInputBase`,category:`web`,description:`The ToggleInputBase component.`,depends:[`core`]};(function(e,t){var n=window.kendo,r=n.ui,i=r.Widget,a=`change`,o=`disabled`,s=`k-disabled`,c=`checked`,l=i.extend({init:function(e,t){var r=this;i.fn.init.call(r,e,t),r._wrapper(),r._initSettings(),r._attachEvents(),n.notify(r,n.ui)},events:[a],options:{name:`ToggleInputBase`},NS:`.kendoToggleInputBase`,RENDER_INPUT:e.noop,check:function(e){var n=this,r=n.element[0];if(e===t)return r.checked;r.checked!==e&&(n.options.checked=r.checked=e),e?n.element.attr(c,c):n.element.prop(c,!1)},destroy:function(){i.fn.destroy.call(this),this.wrapper.off(this.NS)},enable:function(e){let t=this.element,r=this.wrapper.siblings(`label[for='`+t.attr(`id`)+`']`);e===void 0&&(e=!0),this.options.enabled=e,n.toggleAttribute(t,o,!e),n.toggleClass(t,s,null,!e),n.toggleClass(r,s,null,!e)},toggle:function(){var e=this;e.check(!e.element[0].checked)},_attachEvents:function(){this.element.on(a+this.NS,this._change.bind(this))},_change:function(){var e=this.element[0].checked;this.trigger(a,{checked:e})},_initSettings:function(){var e=this,t=e.element[0],n=e.options;n.checked===null&&(n.checked=t.checked),e.check(n.checked),n.enabled=n.enabled&&!e.element.attr(o),e.enable(n.enabled)},_wrapper:function(){var t=this,n=t.options,r=t.RENDER_INPUT;r(t.element,e.extend({},n)),t.element.removeClass(`input-validation-error`),t.wrapper=t.element.wrap(`<span class="${n.wrapperClass}"></span>`).parent()},setOptions:function(t){this._clearCssClasses(t,this.element),this._setEvents(t),e.extend(this.options,t),this._applyCssClasses(this.element)}});r.plugin(l)})(window.kendo.jQuery);var t=kendo;export{e as __meta__,t as default};
//# sourceMappingURL=kendo.toggleinputbase.js.map