import{n as t,N as e,J as i,O as s,e as a,o as l,c as o,w as n,x as r,f as c,a as d,u,b as h,t as p,i as f,g,h as m,H as b}from"./index.e9f016fd.js";import{_ as y}from"./uni-icons.219b5d7c.js";import{r as _}from"./uni-app.es.d4b58485.js";import{_ as k}from"./uni-badge.319eeb41.js";import{_ as w}from"./plugin-vue_export-helper.21dcd24c.js";var S=w({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(a){let l={url:this.to,success:t=>{this.$emit("click",{data:t})},fail:t=>{this.$emit("click",{data:t})}};switch(a){case"navigateTo":default:t(l);break;case"redirectTo":s(l);break;case"reLaunch":i(l);break;case"switchTab":e(l)}}}},[["render",function(t,e,i,s,w,S){const x=f,C=g,B=_(a("uni-icons"),y),T=m,$=_(a("uni-badge"),k),v=b;return l(),o(x,{class:r([{"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:n((()=>[w.isFirstChild?c("",!0):(l(),o(x,{key:0,class:r(["border--left",{"uni-list--border":i.border}])},null,8,["class"])),d(x,{class:r(["uni-list-item__container",{"container--right":i.showArrow||i.link,"flex--direction":"column"===i.direction}])},{default:n((()=>[u(t.$slots,"header",{},(()=>[d(x,{class:"uni-list-item__header"},{default:n((()=>[i.thumb?(l(),o(x,{key:0,class:"uni-list-item__icon"},{default:n((()=>[d(C,{src:i.thumb,class:r(["uni-list-item__icon-img",["uni-list--"+i.thumbSize]])},null,8,["src","class"])])),_:1})):i.showExtraIcon?(l(),o(x,{key:1,class:"uni-list-item__icon"},{default:n((()=>[d(B,{color:i.extraIcon.color,size:i.extraIcon.size,type:i.extraIcon.type},null,8,["color","size","type"])])),_:1})):c("",!0)])),_:1})]),!0),u(t.$slots,"body",{},(()=>[d(x,{class:r(["uni-list-item__content",{"uni-list-item__content--center":i.thumb||i.showExtraIcon||i.showBadge||i.showSwitch}])},{default:n((()=>[i.title?(l(),o(T,{key:0,class:r(["uni-list-item__content-title",[0!==i.ellipsis&&i.ellipsis<=2?"uni-ellipsis-"+i.ellipsis:""]])},{default:n((()=>[h(p(i.title),1)])),_:1},8,["class"])):c("",!0),i.note?(l(),o(T,{key:1,class:"uni-list-item__content-note"},{default:n((()=>[h(p(i.note),1)])),_:1})):c("",!0)])),_:1},8,["class"])]),!0),u(t.$slots,"footer",{},(()=>[i.rightText||i.showBadge||i.showSwitch?(l(),o(x,{key:0,class:r(["uni-list-item__extra",{"flex--justify":"column"===i.direction}])},{default:n((()=>[i.rightText?(l(),o(T,{key:0,class:"uni-list-item__extra-text"},{default:n((()=>[h(p(i.rightText),1)])),_:1})):c("",!0),i.showBadge?(l(),o($,{key:1,type:i.badgeType,text:i.badgeText,"custom-style":i.badgeStyle},null,8,["type","text","custom-style"])):c("",!0),i.showSwitch?(l(),o(v,{key:2,disabled:i.disabled,checked:i.switchChecked,onChange:S.onSwitchChange},null,8,["disabled","checked","onChange"])):c("",!0)])),_:1},8,["class"])):c("",!0)]),!0)])),_:3},8,["class"]),i.showArrow||i.link?(l(),o(B,{key:1,size:16,class:"uni-icon-wrapper",color:"#bbb",type:"arrowright"})):c("",!0)])),_:3},8,["class","hover-class","onClick"])}],["__scopeId","data-v-69619d8d"]]);var x=w({name:"uniList","mp-weixin":{options:{multipleSlots:!1}},props:{enableBackToTop:{type:[Boolean,String],default:!1},scrollY:{type:[Boolean,String],default:!1},border:{type:Boolean,default:!0}},created(){this.firstChildAppend=!1},methods:{loadMore(t){this.$emit("scrolltolower")}}},[["render",function(t,e,i,s,a,r){const d=f;return l(),o(d,{class:"uni-list uni-border-top-bottom"},{default:n((()=>[i.border?(l(),o(d,{key:0,class:"uni-list--border-top"})):c("",!0),u(t.$slots,"default",{},void 0,!0),i.border?(l(),o(d,{key:1,class:"uni-list--border-bottom"})):c("",!0)])),_:3})}],["__scopeId","data-v-5d0c354c"]]);export{S as _,x as a};