import{r as t,ap as e,Q as l,n as a,O as i,c as s,aq as r,ar as o,e as u,f as n,w as d,g as h,l as f,M as c,j as g,z as p,h as y,F as b,i as v,x as m,v as S,A as x,as as w,a8 as _,at as k,p as C,S as j,q as N,X as B}from"./index-DVkgSHpn.js";import{_ as W}from"./el-layout._U-vZTft.js";const $=W({__name:"el-tabs",props:{isScroll:{type:Boolean,default:!0},list:{type:Array,default:()=>[]},current:{type:[Number,String],default:0},height:{type:[String,Number],default:80},fontSize:{type:[String,Number],default:30},duration:{type:[String,Number],default:.5},activeColor:{type:String,default:"#2979ff"},inactiveColor:{type:String,default:"#303133"},barWidth:{type:[String,Number],default:40},barHeight:{type:[String,Number],default:6},gutter:{type:[String,Number],default:30},bgColor:{type:String,default:"#ffffff"},name:{type:String,default:"name"},count:{type:String,default:"count"},offset:{type:Array,default:()=>[5,20]},bold:{type:Boolean,default:!0},itemStyle:{type:Object,default:()=>({})},activeItemStyle:{type:Object,default:()=>({})},showBar:{type:Boolean,default:!0},barStyle:{type:Object,default:()=>({})},itemWidth:{type:[Number,String],default:"auto"},isLeft:{type:Boolean,default:!1},isRight:{type:Boolean,default:!1}},emits:["change"],setup(W,{emit:$}){const O=W,z=$;let H=B(),A=t(0),I=t([]),R=t(0),q=t(0),L=t(0),F=t(e()),M=t(O.current),Q=t(!0),T=t({width:0,height:0});const V=()=>{let t=I.value[M.value];if(!t)return;let e=t.width,l=t.left-L.value-(R.value-e)/2;A.value=l<0?0:l;let a=t.left+t.width/2-L.value;q.value=a-_(O.barWidth)/2,1==Q.value&&setTimeout((()=>{Q.value=!1}),100)},X=()=>{k("#"+F.value).then((t=>{L.value=t.left,R.value=t.width,(()=>{let t=N().in(H);for(let e=0;e<O.list.length;e++)t.select(`#el-tab-item-${e}`).fields({size:!0,rect:!0});t.exec(function(t){I.value=t,V()}.bind(H))})()})),k(".tabs-right",!1).then((t=>{T.value.width=t.width,T.value.height=t.height}))};l((()=>{a((()=>{X()}))})),i((()=>O.list),((t,e)=>{t.length!==e.length&&(M.value=0),a((()=>{X()}))})),i((()=>O.current),((t,e)=>{a((()=>{M.value=t,V()}))}),{deep:!0,immediate:!0});const D=s((()=>{let t={width:O.barWidth+"rpx",transform:`translate(${q.value}px, -100%)`,"transition-duration":`${Q.value?0:O.duration}s`,"background-color":O.activeColor,height:O.barHeight+"rpx",opacity:Q.value?0:1,"border-radius":O.barHeight/2+"px"};return Object.assign(t,O.barStyle)})),E=s((()=>t=>{let e={height:O.height+"rpx","line-height":O.height+"rpx","font-size":O.fontSize+"rpx","transition-duration":`${O.duration}s`,padding:O.isScroll?`0 ${O.gutter}rpx`:"",flex:O.isScroll?"auto":"1",width:r(O.itemWidth,!0)};return e=o(e,O.itemStyle),t==M.value&&O.bold&&(e.fontWeight="bold"),t==M.value?(e.color=O.activeColor,e=Object.assign(e,O.activeItemStyle)):e.color=O.inactiveColor,e}));return(t,e)=>{const l=C,a=j;return u(),n(l,{class:"el-tabs",style:m({background:W.bgColor})},{default:d((()=>[h(l,{id:f(F)},{default:d((()=>[W.isLeft?(u(),n(l,{key:0,class:"tabs-left"},{default:d((()=>[c(t.$slots,"left",{},void 0,!0)])),_:3})):g("",!0),h(a,{"scroll-x":"",class:"el-scroll-view","scroll-left":f(A),"scroll-with-animation":""},{default:d((()=>[h(l,{class:p(["el-scroll-box",{"el-tabs-scorll-flex":!W.isScroll}])},{default:d((()=>[(u(!0),y(b,null,v(W.list,((t,e)=>(u(),n(l,{class:"el-tab-item",id:"el-tab-item-"+e,key:e,onClick:t=>(t=>{t!=M.value&&z("change",t)})(e),style:m([E.value(e)])},{default:d((()=>[S(x(t[W.name]||t.name),1)])),_:2},1032,["id","onClick","style"])))),128)),W.isRight?(u(),n(l,{key:0,class:"el-tab-item",style:m([E.value(t.index),{width:f(w)(f(T).width,"rpx")}])},null,8,["style"])):g("",!0),W.showBar?(u(),n(l,{key:1,class:"el-tab-bar",style:m([D.value])},null,8,["style"])):g("",!0)])),_:1},8,["class"])])),_:1},8,["scroll-left"]),W.isRight?(u(),n(l,{key:1,class:"tabs-right",style:m([{padding:"0 10rpx"},{width:f(w)(O.itemWidth,"rpx"),height:f(w)(O.height+O.barHeight,"rpx"),lineHeight:f(w)(O.height,"rpx"),background:W.bgColor}])},{default:d((()=>[c(t.$slots,"right",{},void 0,!0)])),_:3},8,["style"])):g("",!0)])),_:3},8,["id"])])),_:3},8,["style"])}}},[["__scopeId","data-v-14665694"]]);export{$ as _};
//# sourceMappingURL=el-tabs.DRFTppt3.js.map
