2 lines
5.8 KiB
JavaScript
2 lines
5.8 KiB
JavaScript
import{ak as y,al as v,ao as q,at as I,i as V,g as a,bc as D,z as $,bd as H,be as F,bf as O,c as r,aF as M,bg as U,I as J,n as K,bh as Q,aD as p,G as X,bi as Y,bj as Z,m as G,av as B,bk as ee,bl as te,q as L,bm as le,bn as ae,a as se,bo as ne,bp as E,bq as re,br as R,bs as oe,bt as ie,bu as ue,bv as ce,B as de,F as pe}from"./main-BhFWIRV_.js";const W=Symbol.for("vuetify:v-stepper"),j=v({color:String,disabled:{type:[Boolean,String],default:!1},prevText:{type:String,default:"$vuetify.stepper.prev"},nextText:{type:String,default:"$vuetify.stepper.next"}},"VStepperActions"),ve=y()({name:"VStepperActions",props:j(),emits:{"click:prev":()=>!0,"click:next":()=>!0},setup(e,i){let{emit:t,slots:l}=i;const{t:s}=q();function n(){t("click:prev")}function o(){t("click:next")}return I(()=>{const u={onClick:n},c={onClick:o};return V("div",{class:"v-stepper-actions"},[a(D,{defaults:{VBtn:{disabled:["prev",!0].includes(e.disabled),text:s(e.prevText),variant:"text"}}},{default:()=>[l.prev?.({props:u})??a($,u,null)]}),a(D,{defaults:{VBtn:{color:e.color,disabled:["next",!0].includes(e.disabled),text:s(e.nextText),variant:"tonal"}}},{default:()=>[l.next?.({props:c})??a($,c,null)]})])}),{}}}),me=H("v-stepper-header"),be=v({color:String,title:String,subtitle:String,complete:Boolean,completeIcon:{type:p,default:"$complete"},editable:Boolean,editIcon:{type:p,default:"$edit"},error:Boolean,errorIcon:{type:p,default:"$error"},icon:p,ripple:{type:[Boolean,Object],default:!0},rules:{type:Array,default:()=>[]}},"StepperItem"),fe=v({...be(),...Q()},"VStepperItem"),Ve=y()({name:"VStepperItem",directives:{vRipple:F},props:fe(),emits:{"group:selected":e=>!0},setup(e,i){let{slots:t}=i;const l=O(e,W,!0),s=r(()=>l?.value.value??e.value),n=r(()=>e.rules.every(S=>S()===!0)),o=r(()=>!e.disabled&&e.editable),u=r(()=>!e.disabled&&e.editable),c=r(()=>e.error||!n.value),m=r(()=>e.complete||e.rules.length>0&&n.value),k=r(()=>c.value?e.errorIcon:m.value?e.completeIcon:l.isSelected.value&&e.editable?e.editIcon:e.icon),b=r(()=>({canEdit:u.value,hasError:c.value,hasCompleted:m.value,title:e.title,subtitle:e.subtitle,step:s.value,value:e.value}));return I(()=>{const S=(!l||l.isSelected.value||m.value||u.value)&&!c.value&&!e.disabled,h=!!(e.title!=null||t.title),w=!!(e.subtitle!=null||t.subtitle);function x(){l?.toggle()}return M(V("button",{class:K(["v-stepper-item",{"v-stepper-item--complete":m.value,"v-stepper-item--disabled":e.disabled,"v-stepper-item--error":c.value},l?.selectedClass.value]),disabled:!e.editable,type:"button",onClick:x},[o.value&&U(!0,"v-stepper-item"),a(J,{key:"stepper-avatar",class:"v-stepper-item__avatar",color:S?e.color:void 0,size:24},{default:()=>[t.icon?.(b.value)??(k.value?a(X,{icon:k.value},null):s.value)]}),V("div",{class:"v-stepper-item__content"},[h&&V("div",{key:"title",class:"v-stepper-item__title"},[t.title?.(b.value)??e.title]),w&&V("div",{key:"subtitle",class:"v-stepper-item__subtitle"},[t.subtitle?.(b.value)??e.subtitle]),t.default?.(b.value)])]),[[F,e.editable&&e.ripple,null]])}),{}}}),Se=v({...ee(te(),["continuous","nextIcon","prevIcon","showArrows","touch","mandatory"])},"VStepperWindow"),ye=y()({name:"VStepperWindow",props:Se(),emits:{"update:modelValue":e=>!0},setup(e,i){let{slots:t}=i;const l=Y(W,null),s=Z(e,"modelValue"),n=r({get(){return s.value!=null||!l?s.value:l.items.value.find(o=>l.selected.value.includes(o.id))?.value},set(o){s.value=o}});return I(()=>{const o=G.filterProps(e);return a(G,B({_as:"VStepperWindow"},o,{modelValue:n.value,"onUpdate:modelValue":u=>n.value=u,class:["v-stepper-window",e.class],style:e.style,mandatory:!1,touch:!1}),t)}),{}}}),Ie=v({...le()},"VStepperWindowItem"),ke=y()({name:"VStepperWindowItem",props:Ie(),setup(e,i){let{slots:t}=i;return I(()=>{const l=L.filterProps(e);return a(L,B({_as:"VStepperWindowItem"},l,{class:["v-stepper-window-item",e.class],style:e.style}),t)}),{}}}),we=v({altLabels:Boolean,bgColor:String,completeIcon:p,editIcon:p,editable:Boolean,errorIcon:p,hideActions:Boolean,items:{type:Array,default:()=>[]},itemTitle:{type:String,default:"title"},itemValue:{type:String,default:"value"},nonLinear:Boolean,flat:Boolean,...ce()},"Stepper"),xe=v({...we(),...ue({mandatory:"force",selectedClass:"v-stepper-item--selected"}),...ie(),...oe(j(),["prevText","nextText"])},"VStepper"),Pe=y()({name:"VStepper",props:xe(),emits:{"update:modelValue":e=>!0},setup(e,i){let{slots:t}=i;const{items:l,next:s,prev:n,selected:o}=ae(e,W),{displayClasses:u,mobile:c}=se(e),{completeIcon:m,editIcon:k,errorIcon:b,color:S,editable:h,prevText:w,nextText:x}=ne(e),A=r(()=>e.items.map((d,P)=>{const g=E(d,e.itemTitle,d),C=E(d,e.itemValue,P+1);return{title:g,value:C,raw:d}})),_=r(()=>l.value.findIndex(d=>o.value.includes(d.id))),z=r(()=>e.disabled?e.disabled:_.value===0?"prev":_.value===l.value.length-1?"next":!1);return re({VStepperItem:{editable:h,errorIcon:b,completeIcon:m,editIcon:k,prevText:w,nextText:x},VStepperActions:{color:S,disabled:z,prevText:w,nextText:x}}),I(()=>{const d=R.filterProps(e),P=!!(t.header||e.items.length),g=e.items.length>0,C=!e.hideActions&&!!(g||t.actions);return a(R,B(d,{color:e.bgColor,class:["v-stepper",{"v-stepper--alt-labels":e.altLabels,"v-stepper--flat":e.flat,"v-stepper--non-linear":e.nonLinear,"v-stepper--mobile":c.value},u.value,e.class],style:e.style}),{default:()=>[P&&a(me,{key:"stepper-header"},{default:()=>[A.value.map((f,N)=>{let{raw:ge,...T}=f;return V(pe,null,[!!N&&a(de,null,null),a(Ve,T,{default:t[`header-item.${T.value}`]??t.header,icon:t.icon,title:t.title,subtitle:t.subtitle})])})]}),g&&a(ye,{key:"stepper-window"},{default:()=>[A.value.map(f=>a(ke,{value:f.value},{default:()=>t[`item.${f.value}`]?.(f)??t.item?.(f)}))]}),t.default?.({prev:n,next:s}),C&&(t.actions?.({next:s,prev:n})??a(ve,{key:"stepper-actions","onClick:prev":n,"onClick:next":s},t))]})}),{prev:n,next:s}}});export{me as V,Ve as a,ye as b,ke as c,ve as d,Pe as e};
|