You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
5.7 KiB
1 lines
5.7 KiB
import{a4 as t,a5 as e,a6 as a,aN as s,aA as i,aT as r,g as n,i as o,o as p,c,w as l,S as d,n as u,f as h,b as m,_,z as D,A as f,j as v,E as C,aS as x}from"./index-ed377420.js";import{_ as y}from"./u-icon.d58f766c.js";import{_ as g}from"./u-text.4b5d2c60.js";import{_ as w}from"./_plugin-vue_export-helper.1b428a4d.js";const S=w({name:"u-steps-item",mixins:[e,a,{props:{title:{type:[String,Number],default:()=>t.stepsItem.title},desc:{type:[String,Number],default:()=>t.stepsItem.desc},iconSize:{type:[String,Number],default:()=>t.stepsItem.iconSize},error:{type:Boolean,default:()=>t.stepsItem.error}}}],data:()=>({index:0,childLength:0,showLine:!1,size:{height:0,width:0},parentData:{direction:"row",current:0,activeColor:"",inactiveColor:"",activeIcon:"",inactiveIcon:"",dot:!1}}),watch:{parentData(t,e){}},created(){this.init()},computed:{lineStyle(){var t,e;const a={};return"row"===this.parentData.direction?(a.width=this.size.width+"px",a.left=this.size.width/2+"px"):a.height=this.size.height+"px",a.backgroundColor=(null==(e=null==(t=this.parent.children)?void 0:t[this.index+1])?void 0:e.error)?s.error:this.index<this.parentData.current?this.parentData.activeColor:this.parentData.inactiveColor,a},statusClass(){const{index:t,error:e}=this,{current:a}=this.parentData;return a==t?!0===e?"error":"process":e?"error":a>t?"finish":"wait"},statusColor(){let t="";switch(this.statusClass){case"finish":t=this.parentData.activeColor;break;case"error":t=s.error;break;case"process":t=this.parentData.dot?this.parentData.activeColor:"transparent";break;default:t=this.parentData.inactiveColor}return t},contentStyle(){const t={};return"column"===this.parentData.direction?(t.marginLeft=this.parentData.dot?"2px":"6px",t.marginTop=this.parentData.dot?"0px":"6px"):(t.marginTop=this.parentData.dot?"2px":"6px",t.marginLeft=this.parentData.dot?"2px":"6px"),t}},mounted(){this.parent&&this.parent.updateFromChild(),i().then((()=>{this.getStepsItemRect()}))},methods:{init(){if(this.updateParentData(),!this.parent)return r();this.index=this.parent.children.indexOf(this),this.childLength=this.parent.children.length},updateParentData(){this.getParentData("u-steps")},updateFromParent(){this.init()},getStepsItemRect(){this.$uGetRect(".u-steps-item").then((t=>{this.size=t}))}}},[["render",function(t,e,a,s,i,r){const x=v,w=n(o("u-icon"),y),S=C,I=n(o("up-text"),g);return p(),c(x,{class:d(["u-steps-item",[`u-steps-item--${i.parentData.direction}`]]),ref:"u-steps-item"},{default:l((()=>[i.index+1<i.childLength?(p(),c(x,{key:0,class:d(["u-steps-item__line",[`u-steps-item__line--${i.parentData.direction}`]]),style:u([r.lineStyle])},null,8,["class","style"])):h("v-if",!0),m(x,{class:d(["u-steps-item__wrapper",[`u-steps-item__wrapper--${i.parentData.direction}`,i.parentData.dot&&`u-steps-item__wrapper--${i.parentData.direction}--dot`]])},{default:l((()=>[_(t.$slots,"icon",{},(()=>[i.parentData.dot?(p(),c(x,{key:0,class:"u-steps-item__wrapper__dot",style:u({backgroundColor:r.statusColor})},null,8,["style"])):i.parentData.activeIcon||i.parentData.inactiveIcon?(p(),c(x,{key:1,class:"u-steps-item__wrapper__icon"},{default:l((()=>[m(w,{name:i.index<=i.parentData.current?i.parentData.activeIcon:i.parentData.inactiveIcon,size:t.iconSize,color:i.index<=i.parentData.current?i.parentData.activeColor:i.parentData.inactiveColor},null,8,["name","size","color"])])),_:1})):(p(),c(x,{key:2,style:u({backgroundColor:"process"===r.statusClass?i.parentData.activeColor:"transparent",borderColor:r.statusColor}),class:"u-steps-item__wrapper__circle"},{default:l((()=>["process"===r.statusClass||"wait"===r.statusClass?(p(),c(S,{key:0,class:"u-steps-item__wrapper__circle__text",style:u({color:i.index==i.parentData.current?"#ffffff":i.parentData.inactiveColor})},{default:l((()=>[D(f(i.index+1),1)])),_:1},8,["style"])):(p(),c(w,{key:1,color:"error"===r.statusClass?"error":i.parentData.activeColor,size:"12",name:"error"===r.statusClass?"close":"checkmark"},null,8,["color","name"]))])),_:1},8,["style"]))]),!0)])),_:3},8,["class"]),m(x,{class:d(["u-steps-item__content",[`u-steps-item__content--${i.parentData.direction}`]]),style:u([r.contentStyle])},{default:l((()=>[m(I,{text:t.title,type:i.parentData.current==i.index?"main":"content",lineHeight:"20px",size:i.parentData.current==i.index?14:13},null,8,["text","type","size"]),_(t.$slots,"desc",{},(()=>[m(I,{text:t.desc,type:"tips",size:"12"},null,8,["text"])]),!0)])),_:3},8,["class","style"]),h(' <view\r\n\t\t class="u-steps-item__line"\r\n\t\t v-if="showLine && parentData.direction === \'column\'"\r\n\t\t\t:class="[`u-steps-item__line--${parentData.direction}`]"\r\n\t\t :style="[lineStyle]"\r\n\t\t></view> ')])),_:3},8,["class"])}],["__scopeId","data-v-c6df7874"]]);const I=w({name:"u-steps",mixins:[e,a,{props:{direction:{type:String,default:()=>t.steps.direction},current:{type:[String,Number],default:()=>t.steps.current},activeColor:{type:String,default:()=>t.steps.activeColor},inactiveColor:{type:String,default:()=>t.steps.inactiveColor},activeIcon:{type:String,default:()=>t.steps.activeIcon},inactiveIcon:{type:String,default:()=>t.steps.inactiveIcon},dot:{type:Boolean,default:()=>t.steps.dot}}}],data:()=>({}),watch:{children(){this.updateChildData()},parentData(){this.updateChildData()}},computed:{parentData(){return[this.current,this.direction,this.activeColor,this.inactiveColor,this.activeIcon,this.inactiveIcon,this.dot]}},methods:{updateChildData(){this.children.map((t=>{x.func((t||{}).updateFromParent())&&t.updateFromParent()}))},updateFromChild(){this.updateChildData()}},created(){this.children=[]}},[["render",function(t,e,a,s,i,r){const n=v;return p(),c(n,{class:d(["u-steps",[`u-steps--${t.direction}`]])},{default:l((()=>[_(t.$slots,"default",{},void 0,!0)])),_:3},8,["class"])}],["__scopeId","data-v-ff3ce104"]]);export{S as _,I as a};
|
|
|