demo20230512/Scripts/kendo/2014.2.716/kendo.mobile.buttongroup.min.js

16 lines
2.3 KiB
JavaScript
Raw Permalink Normal View History

2023-05-12 10:20:28 +08:00
/**
* Copyright 2014 Telerik AD
*
* 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.
*/
!function(e,define){define(["./kendo.core.min"],e)}(function(){return function(e,t){function n(t){return e('<span class="km-badge">'+t+"</span>")}var i=window.kendo,r=i.mobile.ui,o=r.Widget,a="km-state-active",s="km-state-disabled",l="select",d="li:not(."+a+")",c=o.extend({init:function(e,t){var n=this;o.fn.init.call(n,e,t),n.element.addClass("km-buttongroup").find("li").each(n._button),n.element.on(n.options.selectOn,d,"_select"),n._enable=!0,n.select(n.options.index),n.options.enable||(n._enable=!1,n.wrapper.addClass(s))},events:[l],options:{name:"ButtonGroup",selectOn:"down",index:-1,enable:!0},current:function(){return this.element.find("."+a)},select:function(n){var i=this,r=-1;n!==t&&-1!==n&&i._enable&&!e(n).is("."+s)&&(i.current().removeClass(a),"number"==typeof n?(r=n,n=e(i.element[0].children[n])):n.nodeType&&(n=e(n),r=n.index()),n.addClass(a),i.selectedIndex=r)},badge:function(t,i){var r,o=this.element;return isNaN(t)||(t=o.children().get(t)),t=o.find(t),r=e(t.children(".km-badge")[0]||n(i).appendTo(t)),i||0===i?(r.html(i),this):i===!1?(r.empty().remove(),this):r.html()},enable:function(e){var n=this.wrapper;t===e&&(e=!0),e?n.removeClass(s):n.addClass(s),this._enable=this.options.enable=e},_button:function(){var t=e(this).addClass("km-button"),r=i.attrValue(t,"icon"),o=i.attrValue(t,"badge"),a=t.children("span"),s=t.find("img").addClass("km-image");a[0]||(a=t.wrapInner("<span/>").children("span")),a.addClass("km-text"),!s[0]&&r&&t.prepend(e('<span class="km-icon km-'+r+'"/>')),(o||0===o)&&n(o).appendTo(t)},_select:function(e){e.which>1||e.isDefaultPrevented()||!this._enable||(this.select(e.currentTarget),this.trigger(l,{index:this.selectedIndex}))}});r.plugin(c)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});