@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
3 lines (2 loc) • 1.2 kB
JavaScript
;const l=require("vue"),m=require("../../presentation/icon/NeonIcon.vue.cjs.js"),f=require("../link/NeonLink.vue.cjs.js"),x=require("vue-router"),k=require("../../../model/common/color/NeonFunctionalColor.cjs.js"),y=l.defineComponent({name:"NeonTreeMenu",components:{NeonIcon:m,NeonLink:f},props:{id:{type:String,required:!0},modelValue:{type:Array,required:!0},color:{type:String,default:k.NeonFunctionalColor.Brand},expandAll:{type:Boolean,default:!1},exactHighlighting:{type:Boolean,default:!1}},emits:["update:modelValue","click"],setup(u,{emit:a}){const c=x.useRoute(),d=l.ref(null),p=n=>{const t=n.target;t.parentElement&&t.parentElement.click()},i=n=>{const t=u.modelValue.map(e=>{var o;return{...e,children:(o=e.children)==null?void 0:o.map(r=>({...r})),expanded:e.key===n?!e.expanded:e.expanded}});a("update:modelValue",t)},s=n=>{const t=u.modelValue.map(e=>{var o;return{...e,children:(o=e.children)==null?void 0:o.map(r=>({...r,expanded:r.key===n?!r.expanded:r.expanded}))}});a("update:modelValue",t)};return l.watch(()=>c.path,n=>d.value=n,{immediate:!0}),{url:d,emit:a,click:p,onSectionClick:i,onItemClick:s}}});module.exports=y;
//# sourceMappingURL=NeonTreeMenu.cjs.js.map