UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 2.5 kB
module.exports=function(t){var i={};function o(e){if(i[e])return i[e].exports;var n=i[e]={exports:{},id:e,loaded:!1};return t[e].call(n.exports,n,n.exports,o),n.loaded=!0,n.exports}return o.m=t,o.c=i,o.p="",o(0)}({0:function(e,n,t){e.exports=t(1356)},3:function(e,n){e.exports=function(){throw Error("define cannot be used indirect")}},1051:function(e,n){e.exports=require("./kendo.core")},1356:function(e,n,t){var i;t(3),t=[t(1051)],void 0===(n="function"==typeof(i=function(){var t={id:"mobile.buttongroup",name:"ButtonGroup",category:"mobile",description:"The Kendo mobile ButtonGroup widget is a linear set of grouped buttons.",depends:["core"]},r=window.kendo.jQuery,i=void 0,s=window.kendo,e=s.mobile.ui,o=e.Widget,a="state-active",d="state-disabled",n="select",c="li:not(.km-"+a+")";function l(e){return"k-"+e+" km-"+e}function u(e){return r('<span class="'+l("badge")+'">'+e+"</span>")}var p=o.extend({init:function(e,n){var t=this;o.fn.init.call(t,e,n);t.element.addClass("km-buttongroup k-widget k-button-group").find("li").each(t._button);t.element.on(t.options.selectOn,c,"_select");t._enable=true;t.select(t.options.index);if(!t.options.enable){t._enable=false;t.wrapper.addClass(l(d))}},events:[n],options:{name:"ButtonGroup",selectOn:"down",index:-1,enable:true},current:function(){return this.element.find(".km-"+a)},select:function(e){var n=this,t=-1;if(e===i||e===-1||!n._enable||r(e).is(".km-"+d))return;n.current().removeClass(l(a));if(typeof e==="number"){t=e;e=r(n.element[0].children[e])}else if(e.nodeType){e=r(e);t=e.index()}e.addClass(l(a));n.selectedIndex=t},badge:function(e,n){var t=this.element,i;if(!isNaN(e))e=t.children().get(e);e=t.find(e);i=r(e.children(".km-badge")[0]||u(n).appendTo(e));if(n||n===0){i.html(n);return this}if(n===false){i.empty().remove();return this}return i.html()},enable:function(e){if(typeof e=="undefined")e=true;this.wrapper.toggleClass(l(d),!e);this._enable=this.options.enable=e},_button:function(){var e=r(this).addClass(l("button")),n=s.attrValue(e,"icon"),t=s.attrValue(e,"badge"),i=e.children("span"),o=e.find("img").addClass(l("image"));if(!i[0])i=e.wrapInner("<span/>").children("span");i.addClass(l("text"));if(!o[0]&&n)e.prepend(r('<span class="'+l("icon")+" "+l(n)+'"/>'));if(t||t===0)u(t).appendTo(e)},_select:function(e){if(e.which>1||e.isDefaultPrevented()||!this._enable)return;this.select(e.currentTarget);this.trigger(n,{index:this.selectedIndex})}});return e.plugin(p),window.kendo})?i.apply(n,t):i)||(e.exports=n)}});