primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 4.28 kB
JavaScript
import{UniqueComponentId as e}from"primevue/utils";import{resolveComponent as t,openBlock as n,createElementBlock as i,normalizeClass as s,createElementVNode as l,Fragment as a,renderList as o,normalizeStyle as p,createBlock as r,withCtx as c,toDisplayString as d,resolveDynamicComponent as m,createCommentVNode as u}from"vue";var b={name:"Steps",props:{id:{type:String,default:e()},model:{type:Array,default:null},readonly:{type:Boolean,default:!0},exact:{type:Boolean,default:!0}},methods:{onItemClick(e,t,n){this.disabled(t)||this.readonly?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),t.to&&n&&n(e))},isActive(e){return this.activeRoute===e.to||this.activeRoute===e.to+"/"},getItemClass(e){return["p-steps-item",e.class,{"p-highlight p-steps-current":this.isActive(e),"p-disabled":this.isItemDisabled(e)}]},linkClass(e){return["p-menuitem-link",{"router-link-active":e&&e.isActive,"router-link-active-exact":this.exact&&e&&e.isExactActive}]},isItemDisabled(e){return this.disabled(e)||this.readonly&&!this.isActive(e)},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label:e=>"function"==typeof e.label?e.label():e.label},computed:{activeRoute(){return this.$route.path},containerClass(){return["p-steps p-component",{"p-readonly":this.readonly}]}}};const f=["id"],x={role:"tablist"},y=["aria-selected","aria-expanded"],k=["href","onClick"],v={class:"p-steps-number"},h={class:"p-steps-title"},g={class:"p-steps-number"},C={class:"p-steps-title"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n.p-steps {\n position: relative;\n}\n.p-steps ul {\n padding: 0;\n margin: 0;\n list-style-type: none;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-steps-item {\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.p-steps-item .p-menuitem-link {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n overflow: hidden;\n text-decoration: none;\n}\n.p-steps.p-steps-readonly .p-steps-item {\n cursor: auto;\n}\n.p-steps-item.p-steps-current .p-menuitem-link {\n cursor: default;\n}\n.p-steps-title {\n white-space: nowrap;\n}\n.p-steps-number {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-steps-title {\n display: block;\n}\n"),b.render=function(e,b,w,A,I,E){const B=t("router-link");return n(),i("div",{id:w.id,class:s(E.containerClass)},[l("ul",x,[(n(!0),i(a,null,o(w.model,((t,o)=>(n(),i(a,{key:t.to},[E.visible(t)?(n(),i("li",{key:0,class:s(E.getItemClass(t)),style:p(t.style),role:"tab","aria-selected":E.isActive(t),"aria-expanded":E.isActive(t)},[e.$slots.item?(n(),r(m(e.$slots.item),{key:1,item:t},null,8,["item"])):(n(),i(a,{key:0},[E.isItemDisabled(t)?(n(),i("span",{key:1,class:s(E.linkClass()),role:"presentation"},[l("span",g,d(o+1),1),l("span",C,d(E.label(t)),1)],2)):(n(),r(B,{key:0,to:t.to,custom:""},{default:c((({navigate:e,href:n,isActive:i,isExactActive:a})=>[l("a",{href:n,class:s(E.linkClass({isActive:i,isExactActive:a})),onClick:n=>E.onItemClick(n,t,e),role:"presentation"},[l("span",v,d(o+1),1),l("span",h,d(E.label(t)),1)],10,k)])),_:2},1032,["to"]))],64))],14,y)):u("",!0)],64)))),128))])],10,f)};export{b as default};