import{_ as t,n as e,al as i,aL as s,aK as a,b as l,h as n,d as o,o as c,p as r,w as d,a4 as h,v as u,f as p,aq as g,k as f,t as y,i as m,D as b,C as _,K as k}from"./index-2PZN6pGH.js";import{_ as w}from"./uni-badge.BFkMAjEp.js";const S=t({name:"UniListItem",emits:["click","switchChange"],props:{direction:{type:String,default:"row"},title:{type:String,default:""},note:{type:String,default:""},ellipsis:{type:[Number,String],default:0},disabled:{type:[Boolean,String],default:!1},clickable:{type:Boolean,default:!1},showArrow:{type:[Boolean,String],default:!1},link:{type:[Boolean,String],default:!1},to:{type:String,default:""},showBadge:{type:[Boolean,String],default:!1},showSwitch:{type:[Boolean,String],default:!1},switchChecked:{type:[Boolean,String],default:!1},badgeText:{type:String,default:""},badgeType:{type:String,default:"success"},badgeStyle:{type:Object,default:()=>({})},rightText:{type:String,default:""},thumb:{type:String,default:""},thumbSize:{type:String,default:"base"},showExtraIcon:{type:[Boolean,String],default:!1},extraIcon:{type:Object,default:()=>({type:"",color:"#000000",size:20})},border:{type:Boolean,default:!0}},data:()=>({isFirstChild:!1}),mounted(){this.list=this.getForm(),this.list&&(this.list.firstChildAppend||(this.list.firstChildAppend=!0,this.isFirstChild=!0))},methods:{getForm(t="uniList"){let e=this.$parent,i=e.$options.name;for(;i!==t;){if(e=e.$parent,!e)return!1;i=e.$options.name}return e},onClick(){""===this.to?(this.clickable||this.link)&&this.$emit("click",{data:{}}):this.openPage()},onSwitchChange(t){this.$emit("switchChange",t.detail)},openPage(){-1!==["navigateTo","redirectTo","reLaunch","switchTab"].indexOf(this.link)?this.pageApi(this.link):this.pageApi("navigateTo")},pageApi(t){let l={url:this.to,success:t=>{this.$emit("click",{data:t})},fail:t=>{this.$emit("click",{data:t})}};switch(t){case"navigateTo":default:e(l);break;case"redirectTo":a(l);break;case"reLaunch":s(l);break;case"switchTab":i(l)}}}},[["render",function(t,e,i,s,a,S){const x=m,C=b,T=l(o("uni-icons"),n),B=_,$=l(o("uni-badge"),w),I=k;return c(),r(x,{class:h([{"uni-list-item--disabled":i.disabled},"uni-list-item"]),"hover-class":!i.clickable&&!i.link||i.disabled||i.showSwitch?"":"uni-list-item--hover",onClick:S.onClick},{default:d((()=>[a.isFirstChild?u("",!0):(c(),r(x,{key:0,class:h(["border--left",{"uni-list--border":i.border}])},null,8,["class"])),p(x,{class:h(["uni-list-item__container",{"container--right":i.showArrow||i.link,"flex--direction":"column"===i.direction}])},{default:d((()=>[g(t.$slots,"header",{},(()=>[p(x,{class:"uni-list-item__header"},{default:d((()=>[i.thumb?(c(),r(x,{key:0,class:"uni-list-item__icon"},{default:d((()=>[p(C,{src:i.thumb,class:h(["uni-list-item__icon-img",["uni-list--"+i.thumbSize]])},null,8,["src","class"])])),_:1})):i.showExtraIcon?(c(),r(x,{key:1,class:"uni-list-item__icon"},{default:d((()=>[p(T,{color:i.extraIcon.color,size:i.extraIcon.size,type:i.extraIcon.type},null,8,["color","size","type"])])),_:1})):u("",!0)])),_:1})]),!0),g(t.$slots,"body",{},(()=>[p(x,{class:h(["uni-list-item__content",{"uni-list-item__content--center":i.thumb||i.showExtraIcon||i.showBadge||i.showSwitch}])},{default:d((()=>[i.title?(c(),r(B,{key:0,class:h(["uni-list-item__content-title",[0!==i.ellipsis&&i.ellipsis<=2?"uni-ellipsis-"+i.ellipsis:""]])},{default:d((()=>[f(y(i.title),1)])),_:1},8,["class"])):u("",!0),i.note?(c(),r(B,{key:1,class:"uni-list-item__content-note"},{default:d((()=>[f(y(i.note),1)])),_:1})):u("",!0)])),_:1},8,["class"])]),!0),g(t.$slots,"footer",{},(()=>[i.rightText||i.showBadge||i.showSwitch?(c(),r(x,{key:0,class:h(["uni-list-item__extra",{"flex--justify":"column"===i.direction}])},{default:d((()=>[i.rightText?(c(),r(B,{key:0,class:"uni-list-item__extra-text"},{default:d((()=>[f(y(i.rightText),1)])),_:1})):u("",!0),i.showBadge?(c(),r($,{key:1,type:i.badgeType,text:i.badgeText,"custom-style":i.badgeStyle},null,8,["type","text","custom-style"])):u("",!0),i.showSwitch?(c(),r(I,{key:2,disabled:i.disabled,checked:i.switchChecked,onChange:S.onSwitchChange},null,8,["disabled","checked","onChange"])):u("",!0)])),_:1},8,["class"])):u("",!0)]),!0)])),_:3},8,["class"]),i.showArrow||i.link?(c(),r(T,{key:1,size:16,class:"uni-icon-wrapper",color:"#bbb",type:"arrowright"})):u("",!0)])),_:3},8,["class","hover-class","onClick"])}],["__scopeId","data-v-f561971d"]]);export{S as _};
