accessibleprimevue
Version:
Note: This is the forked version of the Primefaces/PrimeVue repository. Since V3 has reached its EOL this is use to fix identified accessibility bugs in the v3 version of primevue. PrimeVue is an open source UI library for Vue featuring a rich set of 80+
2 lines (1 loc) • 3.52 kB
JavaScript
import t from"primevue/icons/chevronright";import e from"primevue/basecomponent";import i from"primevue/breadcrumb/style";import{mergeProps as n,openBlock as s,createElementBlock as l,createBlock as m,resolveDynamicComponent as r,normalizeClass as o,createCommentVNode as a,toDisplayString as c,resolveComponent as p,createElementVNode as u,Fragment as d,renderList as h,renderSlot as b,createVNode as f}from"vue";var y={name:"BaseBreadcrumb",extends:e,props:{model:{type:Array,default:null},home:{type:null,default:null}},style:i,provide:function(){return{$parentInstance:this}}},x={name:"BreadcrumbItem",hostName:"Breadcrumb",extends:e,props:{item:null,templates:null,index:null},methods:{onClick:function(t){this.item.command&&this.item.command({originalEvent:t,item:this.item})},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))}}}},v=["href","target","aria-current"];x.render=function(t,e,i,p,u,d){return d.visible()?(s(),l("li",n({key:0,class:[t.cx("menuitem"),i.item.class]},t.ptm("menuitem",d.ptmOptions)),[i.templates.item?(s(),m(r(i.templates.item),{key:1,item:i.item,label:d.label(),props:d.getMenuItemProps},null,8,["item","label","props"])):(s(),l("a",n({key:0,href:i.item.url||"#",class:t.cx("action"),target:i.item.target,"aria-current":d.isCurrentUrl(),onClick:e[0]||(e[0]=function(){return d.onClick&&d.onClick.apply(d,arguments)})},t.ptm("action",d.ptmOptions)),[i.templates&&i.templates.itemicon?(s(),m(r(i.templates.itemicon),{key:0,item:i.item,class:o(t.cx("icon",d.ptmOptions))},null,8,["item","class"])):i.item.icon?(s(),l("span",n({key:1,class:[t.cx("icon"),i.item.icon]},t.ptm("icon",d.ptmOptions)),null,16)):a("",!0),i.item.label?(s(),l("span",n({key:2,class:t.cx("label")},t.ptm("label",d.ptmOptions)),c(d.label()),17)):a("",!0)],16,v))],16)):a("",!0)};var k={name:"Breadcrumb",extends:y,inheritAttrs:!1,components:{BreadcrumbItem:x,ChevronRightIcon:t}};k.render=function(t,e,i,r,o,c){var y=p("BreadcrumbItem"),x=p("ChevronRightIcon");return s(),l("nav",n({class:t.cx("root")},t.ptmi("root")),[u("ol",n({class:t.cx("menu")},t.ptm("menu")),[t.home?(s(),m(y,n({key:0,item:t.home,class:t.cx("home"),templates:t.$slots,pt:t.pt,unstyled:t.unstyled},t.ptm("home")),null,16,["item","class","templates","pt","unstyled"])):a("",!0),(s(!0),l(d,null,h(t.model,(function(e,i){return s(),l(d,{key:e.label+"_"+i},[t.home||0!==i?(s(),l("li",n({key:0,class:t.cx("separator")},t.ptm("separator")),[b(t.$slots,"separator",{},(function(){return[f(x,n({"aria-hidden":"true"},t.ptm("separatorIcon")),null,16)]}))],16)):a("",!0),f(y,{item:e,index:i,templates:t.$slots,pt:t.pt,unstyled:t.unstyled},null,8,["item","index","templates","pt","unstyled"])],64)})),128))],16)],16)};export{k as default};