@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
3 lines (2 loc) • 4.98 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("kendo.core.js"),require("kendo.icons.js")):"function"==typeof define&&define.amd?define(["exports","kendo.core.min","kendo.icons"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Bottomnavigation={}))}(this,(function(e){!function(e){var t=window.kendo,i=t.ui,n=i.Widget,o=e.extend,s=t.template,a=t.keys,l=e.isPlainObject,d=e.isEmptyObject,r=".kendoBottomNavigation",m=".",c="select",f=function(e){return"string"==typeof e},u={widget:"k-bottom-nav",item:"k-bottom-nav-item",navIcon:"k-bottom-nav-item-icon",icon:"k-icon",text:"k-bottom-nav-item-text",itemFlow:{vertical:"k-bottom-nav-item-flow-vertical",horizontal:"k-bottom-nav-item-flow-horizontal"},selected:"k-selected",disabled:"k-disabled",border:"k-bottom-nav-border",shadow:"k-bottom-nav-shadow",focus:"k-focus"},p={item:s((()=>`<span class="${u.item}"></span>`)),anchor:s((({url:e})=>`<a class="${u.item}" href="${t.htmlEncode(e)}"></a>`)),text:s((({text:e})=>`<span class="${u.text}" >${e}</span>`)),icon:s((({icon:i})=>t.ui.icon(e(`<span class="${u.navIcon}"></span>`),{icon:i,size:"xlarge"})))},g=n.extend({init:function(t,i){var o=this;i=i||{},n.fn.init.call(o,t,i),o.element=e(t),null===this.options.fillMode&&(this.options.fillMode=this.options.fill),o._updateCssClasses(),o._items(),o._bindEvents()},options:{name:"BottomNavigation",positionMode:"fixed",items:[],themeColor:"primary",itemFlow:"vertical",fillMode:null,fill:"flat",shadow:!1,border:!0,template:null},events:[c],destroy:function(){this.element.off(r),n.fn.destroy.call(this)},_tabindex:function(e){var i=this.element,n="tabindex",o=i.attr("data-"+t.ns+n),s=e.attr(n)||i.attr(n)||o;o||(i.removeAttr(n),i.attr("data-"+t.ns+n,s)),e.attr(n,isNaN(s)?0:s)},_updateCssClasses:function(){var e=this,i=e.options,n=u;e.element.removeClass((function(t,i){0===i.indexOf("k-")&&e.element.removeClass(i)})),e.element.addClass(n.widget),e.element.addClass(t.getValidCssClass("k-pos-","positionMode",i.positionMode)),e.element.toggleClass(n.border,i.border),e.element.toggleClass(n.shadow,i.shadow),e._itemFlow(i.itemFlow),e._applyCssClasses()},_itemFlow:function(e){var t=u.itemFlow;this._toggleClassGroup(this.element,e,t)},_toggleClassGroup:function(e,t,i){if(f(i[t])){for(var n in i)e.removeClass(i[n]);e.addClass(i[t])}},_items:function(){for(var e,t=this,i=t.options.items,n=0;n<i.length;n++)e=t._renderItem(i[n]),t.element.append(e)},_renderItem:function(i){var n,a,l=i.template||this.options.template,d=i.url&&f(i.url);return(n=e(d?s(p.anchor)(i):s(p.item)(i))).toggleClass(u.selected,!0===i.selected).toggleClass(u.disabled,!1===i.enabled).addClass(i.cssClass).attr(o({},i.attributes,{"aria-disabled":!1===i.enabled})).data(i.data),this._tabindex(n),n.attr("role")||d||n.attr("role","link"),l?(n.append(s(l)(i)),n):(i=o({},{icon:""},i),a=e(p.icon(i)).addClass(i.iconClass),n.append(a),i.text&&(i.text=!1===i.encoded?i.text:t.htmlEncode(i.text),n.append(e(p.text(i)))),n)},_bindEvents:function(){var e=this,t=e._click.bind(e),i=e._keydown.bind(e);e.element.on("click"+r,m+u.item,t).on("keydown"+r,m+u.item,i)},_click:function(t){var i=e(t.target).closest(m+u.item);i.is(m+u.disabled)?t.preventDefault():this._triggerSelect(i,t)},_triggerSelect:function(e,t){e.is(m+u.disabled)||this.trigger(c,{originalEvent:t,item:e,data:e.data()})||this.select(e)},_keydown:function(t){var i=e(t.target),n=t.keyCode;n!==a.ENTER&&n!==a.SPACEBAR||this._isItem(i)&&(this._triggerSelect(i,t),n===a.SPACEBAR&&t.preventDefault())},_isItem:function(t){return(t=e(t)).is(m+u.item)&&!!this.element.find(t).length},items:function(){return this.element.children()},select:function(t,i){var n=this.items().filter(m+u.selected);if(!t)return n;i=!1!==i,this._isItem(t)&&(n.removeClass(u.selected),e(t).toggleClass(u.selected,i))},enable:function(t,i){i=!1===i,t&&this._isItem(t)&&(e(t).toggleClass(u.disabled,i),e(t).attr("aria-disabled",i))},item:function(e){return isNaN(e)?null:this.items().eq(e)},itemById:function(e){return this.element.find("#"+e)},add:function(t,i){var n=this,o="append",s=n.element;i&&n._isItem(i)&&(o="before",s=e(i)),t&&l(t)&&!d(t)&&s[o](n._renderItem(t))},remove:function(e){e&&this._isItem(e)&&e.remove()},showText:function(e){e=!1!==e,this.items().find(m+u.text).toggle(e)},setOptions:function(e){var t=this;n.fn.setOptions.call(this,e),t._updateCssClasses(),("items"in e||"template"in e)&&(t.element.empty(),t._items())}});i.plugin(g),t.cssProperties.registerPrefix("BottomNavigation","k-bottom-nav-")}(window.kendo.jQuery);var t=kendo;e.__meta__={id:"bottomnavigation",name:"BottomNavigation",category:"web",description:"The BottomNavigation widget is a navigation element that allows movement between primary destinations in an app.",depends:["core","icons"]},e.default=t,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=kendo.bottomnavigation.min.js.map