UNPKG

primevue

Version:

PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBloc

2 lines (1 loc) 14.2 kB
this.primevue=this.primevue||{},this.primevue.stepper=function(e,t,n,r){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=a(n),l={name:"BaseStepper",extends:i.default,props:{activeStep:{type:Number,default:0},orientation:{type:String,default:"horizontal"},linear:{type:Boolean,default:!1}},style:a(r).default,provide:function(){return{$parentInstance:this}}},p={name:"StepperContent",hostName:"Stepper",extends:i.default,props:{id:null,template:null,ariaLabelledby:null,stepperpanel:null,index:null,active:null,highlighted:null,clickCallback:null,prevCallback:null,nextCallback:null,getStepPT:null}};function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t,n){var r;return(t="symbol"==o(r=u(t,"string"))?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var h=["id","aria-labelledby","data-pc-index","data-p-active"];p.render=function(e,n,r,a,i,l){return t.openBlock(),t.createElementBlock("div",t.mergeProps({id:r.id,class:e.cx("stepper.content",{stepperpanel:r.stepperpanel,index:r.index}),role:"tabpanel","aria-labelledby":r.ariaLabelledby},s(s({},r.getStepPT(r.stepperpanel,"root",r.index)),r.getStepPT(r.stepperpanel,"content",r.index)),{"data-pc-name":"stepperpanel","data-pc-index":r.index,"data-p-active":r.active}),[r.template?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.template),{key:0,index:r.index,active:r.active,highlighted:r.highlighted,clickCallback:function(t){return e.onItemClick(t,r.index)},prevCallback:function(e){return r.prevCallback(e,r.index)},nextCallback:function(e){return r.nextCallback(e,r.index)}},null,8,["index","active","highlighted","clickCallback","prevCallback","nextCallback"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.stepperpanel),{key:1}))],16,h)};var g={name:"StepperHeader",hostName:"Stepper",extends:i.default,props:{id:null,template:null,stepperpanel:null,index:null,disabled:null,active:null,highlighted:null,ariaControls:null,clickCallback:null,getStepPT:null,getStepProp:null}},m=["id","tabindex","aria-controls"];g.render=function(e,n,r,a,i,l){return r.template?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.template),{key:0,index:r.index,active:r.active,highlighted:r.highlighted,class:t.normalizeClass(e.cx("stepper.action")),headerClass:e.cx("stepper.action"),numberClass:e.cx("stepper.number"),titleClass:e.cx("stepper.title"),clickCallback:function(e){return r.clickCallback(e,r.index)}},null,8,["index","active","highlighted","class","headerClass","numberClass","titleClass","clickCallback"])):(t.openBlock(),t.createElementBlock("button",t.mergeProps({key:1,id:r.id,class:e.cx("stepper.action"),role:"tab",tabindex:r.disabled?-1:void 0,"aria-controls":r.ariaControls,onClick:n[0]||(n[0]=function(e){return r.clickCallback(e,r.index)})},r.getStepPT(r.stepperpanel,"action",r.index)),[t.createElementVNode("span",t.mergeProps({class:e.cx("stepper.number")},r.getStepPT(r.stepperpanel,"number",r.index)),t.toDisplayString(r.index+1),17),t.createElementVNode("span",t.mergeProps({class:e.cx("stepper.title")},r.getStepPT(r.stepperpanel,"title",r.index)),t.toDisplayString(r.getStepProp(r.stepperpanel,"header")),17)],16,m))};var v={name:"StepperSeparator",hostName:"Stepper",extends:i.default,props:{template:null,separatorClass:null,stepperpanel:null,index:null,active:null,highlighted:null,getStepPT:null}};v.render=function(e,n,r,a,i,l){return r.template?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.template),{key:0,class:t.normalizeClass(r.separatorClass),index:r.index,active:r.active,highlighted:r.highlighted},null,8,["class","index","active","highlighted"])):(t.openBlock(),t.createElementBlock("span",t.mergeProps({key:1,class:r.separatorClass,"aria-hidden":"true"},r.getStepPT),null,16))};var S={name:"Stepper",extends:l,inheritAttrs:!1,emits:["update:activeStep","step-change"],data:function(){return{id:this.$attrs.id,d_activeStep:this.activeStep}},watch:{"$attrs.id":function(t){this.id=t||e.UniqueComponentId()},activeStep:function(e){this.d_activeStep=e}},mounted:function(){this.id=this.id||e.UniqueComponentId()},methods:{isStep:function(e){return"StepperPanel"===e.type.name},isStepActive:function(e){return this.d_activeStep===e},getStepProp:function(e,t){return e.props?e.props[t]:void 0},getStepKey:function(e,t){return this.getStepProp(e,"header")||t},getStepHeaderActionId:function(e){return"".concat(this.id,"_").concat(e,"_header_action")},getStepContentId:function(e){return"".concat(this.id,"_").concat(e,"_content")},getStepPT:function(e,n,r){var a=this.stepperpanels.length,i={props:e.props,parent:{instance:this,props:this.$props,state:this.$data},context:{index:r,count:a,first:0===r,last:r===a-1,active:this.isStepActive(r),highlighted:r<this.d_activeStep,disabled:this.isItemDisabled(r)}};return t.mergeProps(this.ptm("stepperpanel.".concat(n),{stepperpanel:i}),this.ptm("stepperpanel.".concat(n),i),this.ptmo(this.getStepProp(e,"pt"),n,i))},updateActiveStep:function(e,t){this.d_activeStep=t,this.$emit("update:activeStep",t),this.$emit("step-change",{originalEvent:e,index:t})},onItemClick:function(e,t){this.linear?e.preventDefault():t!==this.d_activeStep&&this.updateActiveStep(e,t)},isItemDisabled:function(e){return this.linear&&!this.isStepActive(e)},prevCallback:function(e,t){0!==t&&this.updateActiveStep(e,t-1)},nextCallback:function(e,t){t!==this.stepperpanels.length-1&&this.updateActiveStep(e,t+1)}},computed:{stepperpanels:function(){var e=this;return this.$slots.default().reduce((function(t,n){return e.isStep(n)?t.push(n):n.children&&n.children instanceof Array&&n.children.forEach((function(n){e.isStep(n)&&t.push(n)})),t}),[])}},components:{StepperContent:p,StepperHeader:g,StepperSeparator:v}};function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t,n){var r;return(t="symbol"==b(r=C(t,"string"))?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C(e,t){if("object"!=b(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var x=["aria-current","data-p-highlight","data-p-disabled","data-pc-index","data-p-active"],P=["aria-current","data-p-highlight","data-p-disabled","data-pc-index","data-p-active"];return S.render=function(e,n,r,a,i,l){var p=t.resolveComponent("StepperHeader"),o=t.resolveComponent("StepperSeparator"),c=t.resolveComponent("StepperContent");return t.openBlock(),t.createElementBlock("div",t.mergeProps({class:e.cx("root"),role:"tablist"},e.ptmi("root")),[e.$slots.start?t.renderSlot(e.$slots,"start",{key:0}):t.createCommentVNode("",!0),"horizontal"===e.orientation?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("ul",t.mergeProps({ref:"nav",class:e.cx("nav")},e.ptm("nav")),[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.stepperpanels,(function(n,r){return t.openBlock(),t.createElementBlock("li",t.mergeProps({key:l.getStepKey(n,r),class:e.cx("stepper.header",{step:n,index:r}),"aria-current":l.isStepActive(r)?"step":void 0,role:"presentation"},k(k({},l.getStepPT(n,"root",r)),l.getStepPT(n,"header",r)),{"data-pc-name":"stepperpanel","data-p-highlight":l.isStepActive(r),"data-p-disabled":l.isItemDisabled(r),"data-pc-index":r,"data-p-active":l.isStepActive(r)}),[t.renderSlot(e.$slots,"header",{},(function(){var a;return[t.createVNode(p,{id:l.getStepHeaderActionId(r),template:null===(a=n.children)||void 0===a?void 0:a.header,stepperpanel:n,index:r,disabled:l.isItemDisabled(r),active:l.isStepActive(r),highlighted:r<i.d_activeStep,class:t.normalizeClass(e.cx("stepper.action")),"aria-controls":l.getStepContentId(r),clickCallback:function(e){return l.onItemClick(e,r)},getStepPT:l.getStepPT,getStepProp:l.getStepProp,unstyled:e.unstyled},null,8,["id","template","stepperpanel","index","disabled","active","highlighted","class","aria-controls","clickCallback","getStepPT","getStepProp","unstyled"])]})),r!==l.stepperpanels.length-1?t.renderSlot(e.$slots,"separator",{key:0},(function(){var a;return[t.createVNode(o,{template:null===(a=n.children)||void 0===a?void 0:a.separator,separatorClass:e.cx("stepper.separator"),stepperpanel:n,index:r,active:l.isStepActive(r),highlighted:r<i.d_activeStep,getStepPT:l.getStepPT(n,"separator",r),unstyled:e.unstyled},null,8,["template","separatorClass","stepperpanel","index","active","highlighted","getStepPT","unstyled"])]})):t.createCommentVNode("",!0)],16,x)})),128))],16),t.createElementVNode("div",t.mergeProps({class:e.cx("panelContainer")},e.ptm("panelContainer")),[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.stepperpanels,(function(n,r){var a;return t.withDirectives((t.openBlock(),t.createBlock(c,{key:l.getStepKey(n,r),id:l.getStepContentId(r),template:null==n||null===(a=n.children)||void 0===a?void 0:a.content,stepperpanel:n,index:r,active:l.isStepActive(r),highlighted:r<i.d_activeStep,clickCallback:function(e){return l.onItemClick(e,r)},prevCallback:function(e){return l.prevCallback(e,r)},nextCallback:function(e){return l.nextCallback(e,r)},getStepPT:l.getStepPT,"aria-labelledby":l.getStepHeaderActionId(r),unstyled:e.unstyled},null,8,["id","template","stepperpanel","index","active","highlighted","clickCallback","prevCallback","nextCallback","getStepPT","aria-labelledby","unstyled"])),[[t.vShow,l.isStepActive(r)]])})),128))],16)],64)):"vertical"===e.orientation?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(l.stepperpanels,(function(n,r){return t.openBlock(),t.createElementBlock("div",t.mergeProps({ref_for:!0,ref:"nav",key:l.getStepKey(n,r),class:e.cx("panel",{step:n,index:r}),"aria-current":l.isStepActive(r)?"step":void 0},k(k({},l.getStepPT(n,"root",r)),l.getStepPT(n,"panel",r)),{"data-pc-name":"stepperpanel","data-p-highlight":l.isStepActive(r),"data-p-disabled":l.isItemDisabled(r),"data-pc-index":r,"data-p-active":l.isStepActive(r)}),[t.createElementVNode("div",t.mergeProps({class:e.cx("stepper.header",{step:n,index:r})},l.getStepPT(n,"header",r)),[t.renderSlot(e.$slots,"header",{},(function(){var a;return[t.createVNode(p,{id:l.getStepHeaderActionId(r),template:null===(a=n.children)||void 0===a?void 0:a.header,stepperpanel:n,index:r,disabled:l.isItemDisabled(r),active:l.isStepActive(r),highlighted:r<i.d_activeStep,class:t.normalizeClass(e.cx("stepper.action")),"aria-controls":l.getStepContentId(r),clickCallback:function(e){return l.onItemClick(e,r)},getStepPT:l.getStepPT,getStepProp:l.getStepProp},null,8,["id","template","stepperpanel","index","disabled","active","highlighted","class","aria-controls","clickCallback","getStepPT","getStepProp"])]}))],16),t.createVNode(t.Transition,t.mergeProps({name:"p-toggleable-content"},l.getStepPT(n,"transition",r)),{default:t.withCtx((function(){return[t.withDirectives(t.createElementVNode("div",t.mergeProps({class:e.cx("stepper.toggleableContent")},l.getStepPT(n,"toggleableContent",r)),[r!==l.stepperpanels.length-1?t.renderSlot(e.$slots,"separator",{key:0},(function(){var a;return[t.createVNode(o,{template:null===(a=n.children)||void 0===a?void 0:a.separator,separatorClass:e.cx("stepper.separator"),stepperpanel:n,index:r,active:l.isStepActive(r),highlighted:r<i.d_activeStep,getStepPT:l.getStepPT(n,"separator",r)},null,8,["template","separatorClass","stepperpanel","index","active","highlighted","getStepPT"])]})):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"content",{},(function(){var e;return[t.createVNode(c,{id:l.getStepContentId(r),template:null==n||null===(e=n.children)||void 0===e?void 0:e.content,stepperpanel:n,index:r,active:l.isStepActive(r),highlighted:r<i.d_activeStep,clickCallback:function(e){return l.onItemClick(e,r)},prevCallback:function(e){return l.prevCallback(e,r)},nextCallback:function(e){return l.nextCallback(e,r)},getStepPT:l.getStepPT,"aria-labelledby":l.getStepHeaderActionId(r)},null,8,["id","template","stepperpanel","index","active","highlighted","clickCallback","prevCallback","nextCallback","getStepPT","aria-labelledby"])]}))],16),[[t.vShow,l.isStepActive(r)]])]})),_:2},1040)],16,P)})),128)):t.createCommentVNode("",!0),e.$slots.end?t.renderSlot(e.$slots,"end",{key:3}):t.createCommentVNode("",!0)],16)},S}(primevue.utils,Vue,primevue.basecomponent,primevue.stepper.style);