@progress/kendo-vue-layout
Version:
9 lines (8 loc) • 2.81 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),c=require("../package-metadata.js"),a=require("@progress/kendo-vue-common"),d=require("./models/utils.js"),u=require("./BottomNavigationItem.js"),m=l.defineComponent({name:"KendoBottomNavigation",emits:{keydown:null,select:null},props:{dir:String,themeColor:{type:String,default:"primary",validator:function(t){return["primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"].includes(t)}},fill:{type:String,default:"flat",validator:function(t){return["solid","flat"].includes(t)}},fillMode:{type:String,default:"flat",validator:function(t){return["solid","flat"].includes(t)}},item:[String,Object,Function],items:Array,itemFlow:{type:String,default:"vertical",validator:function(t){return["vertical","horizontal"].includes(t)}},positionMode:{type:String,default:"fixed",validator:function(t){return["sticky","fixed"].includes(t)}},border:{type:Boolean,default:!0},disabled:Boolean,selected:Number},created(){a.validatePackage(c.packageMetadata),this.navId=a.guid()},computed:{navClasses(){const{themeColor:t,fillMode:e,positionMode:n,itemFlow:r,border:i,disabled:o}=this.$props,s=e!==void 0?e:this.$props.fill;return{"k-bottom-nav":!0,[d.POSITION_MODE_CLASSES[n]]:!0,[d.THEME_COLOR_CLASSES[t]]:!0,[`k-bottom-nav-${s}`]:s,[`k-bottom-nav-${s}-${t}`]:!!(s&&t),[d.ITEM_FLOW_CLASSES[r]]:!0,"k-bottom-nav-border":i,"k-disabled":o}}},render(){const{id:t,items:e,item:n,disabled:r}=this.$props;return l.createVNode("nav",{class:this.navClasses,id:t||this.navId},[e&&e.map(function(i,o){const s=a.templateRendering.call(this,i.item||n,a.getListeners.call(this));return l.createVNode(u.BottomNavigationItem,{key:o,index:o,style:i.style,class:i.class,id:`${t||this.navId}-${o}`,disabled:r||i.disabled,selected:this.selected===o||i.selected,dataItem:i,item:s,onSelect:this.handleSelect,onKeydown:this.handleKeyDown},null)},this)])},methods:{focus(){this.$el&&a.focusFirstFocusableChild(this.$el)},dispatchSelectEvent(t,e){this.items&&(this.items[e].disabled||this.$emit("select",{event:t,itemTarget:this.items[e],itemIndex:e}))},handleSelect(t,e){this.dispatchSelectEvent(t,e)},handleKeyDown(t,e){switch(t.keyCode){case a.Keys.enter:case a.Keys.space:this.dispatchSelectEvent(t,e),t.preventDefault();break}this.$emit("keydown",{event:t,itemTarget:this.items[e],itemIndex:e})}}});exports.BottomNavigation=m;