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.buttongroup.min",["kendo.core.min"],e)}(function(){return function(e,t){function n(n,i){n!==t&&e('<span class="k-badge">'+s.htmlEncode(n)+"</span>").appendTo(i)}var s=window.kendo,i=s.ui,a=i.Widget,o=s.keys,d=e.proxy,l=s.template,r=".kendoButtonGroup",c="k-widget",u="k-button-group",m="k-button",f="k-button-icontext",p="k-button-icon",h="k-state-active",C="k-state-focused",g="k-state-disabled",b="select",k="click",v="keydown",y="focus",x="blur",_="mousedown",w={item:l('<span #= item.enabled === false ? "disabled" : "" # # if (item.badge) { #'+s.attr("badge")+'="#=item.badge#"# } #>#= icon(iconClass) ##= image(item) ##= text #</span>'),image:l('<img alt="icon" src="#=data.imageUrl#" />'),icon:l('<span class="#=data#" />'),empty:l("")},I=a.extend({init:function(t,n){var s=this;a.fn.init.call(s,t,n),s.wrapper=s.element,s.options.items&&s._renderItems(s.options.items),s.selectedIndices=[],s.element.addClass(c+" "+u).attr("role","group").attr("tabindex",s.element.attr("tabindex")||"0").children().each(function(){var t=e(this);s._updateClasses.bind(s)(t)}),s._enable=!0,s.options.enable||(s._enable=!1,s.element.attr("aria-disabled",!0).addClass(g)),s.select(s.options.index),s.element.on(k+r,"."+m,d(s._click,s)).on(y+r,d(s._focus,s)).on(v+r,d(s._keyDown,s)).on(x+r,function(){s.preventFocus=!1,s.element.find("."+m).removeClass(C)}).on(_+r,function(){s.preventFocus=!0})},events:[b],options:{name:"ButtonGroup",selection:"single",index:-1,enable:!0},current:function(){return this.element.find("."+h)},_renderItems:function(t){var n=this;t.forEach(function(t){var i=e(w.item({image:t.imageUrl?w.image:w.empty,icon:t.imageUrl||!t.iconClass&&!t.icon?w.empty:w.icon,iconClass:t.iconClass||"k-icon k-i-"+t.icon,item:t,text:t.text?t.encoded===!1?t.text:s.htmlEncode(t.text):""}));t.attributes&&i.attr(t.attributes),t.selected&&i.addClass(h),(t.iconClass||t.icon||t.imageUrl)&&i.addClass(t.text?"k-button-icontext":"k-button-icon"),i.appendTo(n.element)})},_focus:function(){var t=e(this.element);this.preventFocus||(t.find("."+h).length?t.find("."+h).first().focus().addClass(C):t.children().first().focus().addClass(C))},_keyDown:function(t){var n,i=this,a=e(i.element),d=a.find("."+m),l=a.find("."+C),r=d.index(l),c=s.support.isRtl(i.element);t.keyCode===o.LEFT&&!c||t.keyCode===o.RIGHT&&c?(l.removeClass(C),n=0===r?d.eq(d.length-1):e(d[r-1]),n.focus().addClass(C),t.preventDefault()):t.keyCode===o.LEFT&&c||t.keyCode===o.RIGHT&&!c?(l.removeClass(C),n=r+1===d.length?d.eq(0):e(d[r+1]),n.focus().addClass(C),t.preventDefault()):t.keyCode!==o.ENTER&&t.keyCode!==o.SPACEBAR||(i._select(l),t.preventDefault())},select:function(n){var s,i=this,a=-1;n!==t&&n!==-1&&(i.element.find("."+m).removeClass(C),"number"==typeof n?(a=n,n=i.element.children().eq(n)):n.nodeType&&(n=e(n),a=n.index()),"multiple"===i.options.selection?(s="true"===n.attr("aria-pressed"),n.attr("aria-pressed",!s).toggleClass(h),i.selectedIndices.indexOf(a)===-1?i.selectedIndices.push(a):i.selectedIndices.splice(i.selectedIndices.indexOf(a),1)):(i.selectedIndices=[],i.current().attr("aria-pressed",!1).removeClass(h),n.attr("aria-pressed",!0).addClass(h),i.selectedIndices.push(a)),i.trigger(b,{indices:i.selectedIndices}))},badge:function(e,i){var a,o=this.element,d=isNaN(e)?o.find(e):o.children().eq(e),l=i||0===i;if(d.length){if(a=d.children(".k-badge").eq(0),!a.length&&l)return n(s.htmlEncode(i),d),s.htmlEncode(i);if(l)a.html(s.htmlEncode(i));else if(i===!1)return a.empty().remove(),t;return a.html()}},enable:function(e){t===e&&(e=!0),this.element.attr("aria-disabled",!e).toggleClass(g,!e),this._enable=this.options.enable=e},destroy:function(){var e=this;e.element.off(r),a.fn.destroy.call(e)},_updateClasses:function(t){var i=s.attrValue(t,"icon"),a=s.attrValue(t,"badge"),o=t.find("img").addClass("k-image"),d=!0;t.attr("aria-pressed",!1).attr("role","button").addClass(m),(t.is("[disabled]")||t.hasClass(g))&&t.addClass(g).attr("aria-disabled",!0).removeAttr("disabled"),t.is("."+h)&&(t.removeClass(h),(!t.hasClass(g)&&"single"===this.options.selection||"multiple"===this.options.selection)&&this.select(t[0])),!o[0]&&i&&t.prepend(e(w.icon("k-icon k-i-"+i))),t.contents().filter(function(){return!e(this).hasClass("k-icon")&&!e(this).hasClass("k-image")}).each(function(){(1==this.nodeType||3==this.nodeType&&e.trim(this.nodeValue).length>0)&&(d=!1)}),(o[0]||i)&&t.addClass(d?p:f),(a||0===a)&&n(a,t)},_click:function(t){var n=e(t.target).closest("."+m);t.isDefaultPrevented()||this._select(n)},_select:function(e){var n=e;return this.element.find("."+m).removeClass(C),!this._enable||n.is("."+g)?(n.addClass(C),t):(this.select(e[0]),n.addClass(C),t)}});i.plugin(I)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()});
- //# sourceMappingURL=kendo.buttongroup.min.js.map
|