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 e from"primevue/basecomponent";import t from"primevue/icons/chevronright";import{resolveComponent as i,openBlock as n,createElementBlock as l,mergeProps as a,Fragment as m,createBlock as r,withCtx as s,createElementVNode as o,resolveDynamicComponent as c,createCommentVNode as p,toDisplayString as u,renderList as d,renderSlot as b,createVNode as h}from"vue";var f={name:"BreadcrumbItem",extends:e,props:{item:null,templates:null,exact:null,index:null},methods:{onClick(e,t){this.item.command&&this.item.command({originalEvent:e,item:this.item}),this.item.to&&t&&t(e)},containerClass(){return["p-menuitem",{"p-disabled":this.disabled()},this.item.class]},linkClass(e){return["p-menuitem-link",{"router-link-active":e&&e.isActive,"router-link-active-exact":this.exact&&e&&e.isExactActive}]},visible(){return"function"==typeof this.item.visible?this.item.visible():!1!==this.item.visible},disabled(){return"function"==typeof this.item.disabled?this.item.disabled():this.item.disabled},label(){return"function"==typeof this.item.label?this.item.label():this.item.label},isCurrentUrl(){const{to:e,url:t}=this.item;let i=this.$router?this.$router.currentRoute.path:"";return e===i||t===i?"page":void 0}}};const y=["href","aria-current","onClick"],x=["href","target","aria-current"];f.render=function(e,t,d,b,h,f){const k=i("router-link");return f.visible()?(n(),l("li",a({key:0,class:f.containerClass()},e.ptm("menuitem")),[d.templates&&d.templates.item?(n(),r(c(d.templates.item),{key:1,item:d.item},null,8,["item"])):(n(),l(m,{key:0},[d.item.to?(n(),r(k,{key:0,to:d.item.to,custom:""},{default:s((({navigate:t,href:i,isActive:m,isExactActive:s})=>[o("a",a({href:i,class:f.linkClass({isActive:m,isExactActive:s}),"aria-current":f.isCurrentUrl(),onClick:e=>f.onClick(e,t)},e.ptm("action")),[d.templates.itemicon?(n(),r(c(d.templates.itemicon),{key:0,item:d.item,class:"p-menuitem-icon"},null,8,["item"])):d.item.icon?(n(),l("span",a({key:1,class:["p-menuitem-icon",d.item.icon]},e.ptm("icon")),null,16)):p("",!0),d.item.label?(n(),l("span",a({key:2,class:"p-menuitem-text"},e.ptm("label")),u(f.label()),17)):p("",!0)],16,y)])),_:1},8,["to"])):(n(),l("a",a({key:1,href:d.item.url||"#",class:f.linkClass(),target:d.item.target,"aria-current":f.isCurrentUrl(),onClick:t[0]||(t[0]=(...e)=>f.onClick&&f.onClick(...e))},e.ptm("action")),[d.templates&&d.templates.itemicon?(n(),r(c(d.templates.itemicon),{key:0,item:d.item,class:"p-menuitem-icon"},null,8,["item"])):d.item.icon?(n(),l("span",a({key:1,class:["p-menuitem-icon",d.item.icon]},e.ptm("icon")),null,16)):p("",!0),d.item.label?(n(),l("span",a({key:2,class:"p-menuitem-text"},e.ptm("label")),u(f.label()),17)):p("",!0)],16,x))],64))],16)):p("",!0)};var k={name:"Breadcrumb",extends:e,props:{model:{type:Array,default:null},home:{type:null,default:null},exact:{type:Boolean,default:!0}},components:{BreadcrumbItem:f,ChevronRightIcon:t}};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-breadcrumb {\n overflow-x: auto;\n}\n.p-breadcrumb .p-breadcrumb-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n display: flex;\n align-items: center;\n flex-wrap: nowrap;\n}\n.p-breadcrumb .p-menuitem-text {\n line-height: 1;\n}\n.p-breadcrumb .p-menuitem-link {\n text-decoration: none;\n display: flex;\n align-items: center;\n}\n.p-breadcrumb .p-menuitem-separator {\n display: flex;\n align-items: center;\n}\n.p-breadcrumb::-webkit-scrollbar {\n display: none;\n}\n"),k.render=function(e,t,s,c,u,f){const y=i("BreadcrumbItem"),x=i("ChevronRightIcon");return n(),l("nav",a({class:"p-breadcrumb p-component"},e.ptm("root")),[o("ol",a({class:"p-breadcrumb-list"},e.ptm("menu")),[s.home?(n(),r(y,{key:0,item:s.home,class:"p-breadcrumb-home",templates:e.$slots,exact:s.exact,pt:e.pt},null,8,["item","templates","exact","pt"])):p("",!0),(n(!0),l(m,null,d(s.model,((t,i)=>(n(),l(m,{key:t.label},[s.home||0!==i?(n(),l("li",a({key:0,class:"p-menuitem-separator"},e.ptm("separator")),[b(e.$slots,"separator",{},(()=>[h(x,a({"aria-hidden":"true"},e.ptm("separatorIcon")),null,16)]))],16)):p("",!0),h(y,{item:t,index:i,templates:e.$slots,exact:s.exact,pt:e.pt},null,8,["item","index","templates","exact","pt"])],64)))),128))],16)],16)};export{k as default};