UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Discord Chat](https://img.shields.io/discord/55794023

2 lines (1 loc) 4.56 kB
import t from"primevue/icons/chevronright";import e from"primevue/basecomponent";import i from"primevue/breadcrumb/style";import{mergeProps as n,resolveComponent as s,openBlock as l,createElementBlock as o,Fragment as a,createBlock as m,withCtx as r,createElementVNode as c,resolveDynamicComponent as u,normalizeClass as p,createCommentVNode as d,toDisplayString as h,renderList as b,renderSlot as f,createVNode as x}from"vue";var v={name:"BaseBreadcrumb",extends:e,props:{model:{type:Array,default:null},home:{type:null,default:null},exact:{type:Boolean,default:!0}},style:i,provide:function(){return{$parentInstance:this}}},y={name:"BreadcrumbItem",hostName:"Breadcrumb",extends:e,props:{item:null,templates:null,exact:null,index:null},methods:{onClick:function(t,e){this.item.command&&this.item.command({originalEvent:t,item:this.item}),this.item.to&&e&&e(t)},visible:function(){return"function"==typeof this.item.visible?this.item.visible():!1!==this.item.visible},disabled:function(){return"function"==typeof this.item.disabled?this.item.disabled():this.item.disabled},label:function(){return"function"==typeof this.item.label?this.item.label():this.item.label},isCurrentUrl:function(){var t=this.item,e="undefined"!=typeof window?window.location.pathname:"";return t.to===e||t.url===e?"page":void 0}},computed:{ptmOptions:function(){return{context:{item:this.item,index:this.index}}},getMenuItemProps:function(){var t=this;return{action:n({class:this.cx("action"),"aria-current":this.isCurrentUrl(),onClick:function(e){return t.onClick(e)}},this.ptm("action",this.ptmOptions)),icon:n({class:[this.cx("icon"),this.item.icon]},this.ptm("icon",this.ptmOptions)),label:n({class:this.cx("label")},this.ptm("label",this.ptmOptions))}}}},k=["href","aria-current","onClick"],C=["href","target","aria-current"];y.render=function(t,e,i,b,f,x){var v=s("router-link");return x.visible()?(l(),o("li",n({key:0,class:[t.cx("menuitem"),i.item.class]},t.ptm("menuitem",x.ptmOptions)),[i.templates.item?(l(),m(u(i.templates.item),{key:1,item:i.item,label:x.label(),props:x.getMenuItemProps},null,8,["item","label","props"])):(l(),o(a,{key:0},[i.item.to?(l(),m(v,{key:0,to:i.item.to,custom:""},{default:r((function(e){var s=e.navigate;return[c("a",n({href:e.href,class:t.cx("action",{isActive:e.isActive,isExactActive:e.isExactActive}),"aria-current":x.isCurrentUrl(),onClick:function(t){return x.onClick(t,s)}},t.ptm("action",x.ptmOptions)),[i.templates.itemicon?(l(),m(u(i.templates.itemicon),{key:0,item:i.item,class:p(t.cx("icon"))},null,8,["item","class"])):i.item.icon?(l(),o("span",n({key:1,class:[t.cx("icon"),i.item.icon]},t.ptm("icon",x.ptmOptions)),null,16)):d("",!0),i.item.label?(l(),o("span",n({key:2,class:t.cx("label")},t.ptm("label",x.ptmOptions)),h(x.label()),17)):d("",!0)],16,k)]})),_:1},8,["to"])):(l(),o("a",n({key:1,href:i.item.url||"#",class:t.cx("action"),target:i.item.target,"aria-current":x.isCurrentUrl(),onClick:e[0]||(e[0]=function(){return x.onClick&&x.onClick.apply(x,arguments)})},t.ptm("action",x.ptmOptions)),[i.templates&&i.templates.itemicon?(l(),m(u(i.templates.itemicon),{key:0,item:i.item,class:p(t.cx("icon",x.ptmOptions))},null,8,["item","class"])):i.item.icon?(l(),o("span",n({key:1,class:[t.cx("icon"),i.item.icon]},t.ptm("icon",x.ptmOptions)),null,16)):d("",!0),i.item.label?(l(),o("span",n({key:2,class:t.cx("label")},t.ptm("label",x.ptmOptions)),h(x.label()),17)):d("",!0)],16,C))],64))],16)):d("",!0)};var g={name:"Breadcrumb",extends:v,beforeMount:function(){this.$slots.item||console.warn("In future versions, vue-router support will be removed. Item templating should be used.")},components:{BreadcrumbItem:y,ChevronRightIcon:t}};g.render=function(t,e,i,r,u,p){var h=s("BreadcrumbItem"),v=s("ChevronRightIcon");return l(),o("nav",n({class:t.cx("root")},t.ptm("root"),{"data-pc-name":"breadcrumb"}),[c("ol",n({class:t.cx("menu")},t.ptm("menu")),[t.home?(l(),m(h,n({key:0,item:t.home,class:t.cx("home"),templates:t.$slots,exact:t.exact,pt:t.pt,unstyled:t.unstyled},t.ptm("home")),null,16,["item","class","templates","exact","pt","unstyled"])):d("",!0),(l(!0),o(a,null,b(t.model,(function(e,i){return l(),o(a,{key:e.label+"_"+i},[t.home||0!==i?(l(),o("li",n({key:0,class:t.cx("separator")},t.ptm("separator")),[f(t.$slots,"separator",{},(function(){return[x(v,n({"aria-hidden":"true"},t.ptm("separatorIcon")),null,16)]}))],16)):d("",!0),x(h,{item:e,index:i,templates:t.$slots,exact:t.exact,pt:t.pt,unstyled:t.unstyled},null,8,["item","index","templates","exact","pt","unstyled"])],64)})),128))],16)],16)};export{g as default};