import{d as D,gF as S,aS as E,a4 as m,gG as K,dW as P,bj as F,fY as O,r as b,f as q,l,aw as A,h as G,o as Y,i as h,E as i,j as n,w as u,N as H,ep as J,z as Q,er as U,db as X,ab as Z,aG as ee,v as te}from"./index-9PRMimni.js";import{D as ae}from"./vuedraggable.umd-Co2xEC3p.js";import{e as se}from"./element-resize-detector-D6t9qRKJ.js";import{_ as oe}from"./Render.vue_vue_type_script_lang-DKUYY0Zw.js";const le=D({__name:"tabsView",props:S({border:{type:Boolean,default:!0}},{modelValue:{type:Object,default:()=>({collapsed:!1,activeKey:"basicInfo",tabsList:()=>[]})},modelModifiers:{}}),emits:S(["pageFullScreen","changeTab"],["update:modelValue"]),setup(x,{expose:W,emit:M}){E(e=>({"4cb71fb6":L.value}));const c=K(x,"modelValue"),w=M,y=P(),{getNavMode:p,getNavWidth:N,getNavMinWidth:R,getBorderRadius:V}=F(),k=O(),s=b(null),g=b(null),d=b(!1),z=m(()=>{const e=k.isMixMenu,t=q(),a=l(p);return l(a)!="horizontal-mix"?!0:!(l(a)==="horizontal-mix"&&e&&t.meta.isRoot)}),C=m(()=>{const{collapsed:e}=c.value,t=l(p),a=R.value,o=N.value;return{left:t==="horizontal"||!z.value?"0px":e?`${a}px`:`${o}px`,width:"calc(100%)"}}),L=m(()=>`${V.value}px`);function v(e,t){const a=s.value.scrollLeft,o=t>0&&a+t>=e||t<0&&a+t<=e?e:a+t;if(s.value&&s.value.scrollTo(o,0),o!==e)return window.requestAnimationFrame(()=>v(e,t))}function T(){const e=s.value.offsetWidth,t=s.value.scrollLeft;if(!t)return;const a=t>e?t-e:0;v(a,(a-t)/20)}function $(){const e=s.value.offsetWidth,t=s.value.scrollWidth,a=s.value.scrollLeft;if(t-a/2<=e)return;const o=t-a>e*2?a+e:t-e;v(o,(o-a)/20)}function B(e){if(!s.value)return;const a=s.value.getBoundingClientRect().width,o=s.value.scrollWidth;a<o?(d.value=!0,e&&[...s.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach(f=>{f.id===`tag${c.value.activeKey}`&&f.scrollIntoView&&f.scrollIntoView()})):d.value=!1}function j(){const{collapsed:e}=c.value;setTimeout(()=>{B(e)},200)}function I(e){c.value.activeKey=e.value,w("changeTab",e)}A(async()=>{_()});function _(){let e;e=se(),e.listenTo(g.value,j)}return W({onElementResize:_}),(e,t)=>{const a=H,o=Q;return Y(),G("div",{style:ee({...C.value,background:l(y).bodyColor}),class:i(["tabs-view"])},[h("div",{class:i(["tabs-view-main",e.border?"hasBorder":""])},[h("div",{ref_key:"navWrap",ref:g,class:i([{"tabs-card-scrollable":d.value},"tabs-card"])},[n(o,{tag:"span",class:i([{"tabs-card-prev-hide":!d.value},"tabs-card-prev"]),onClick:T},{default:u(()=>[n(a,{size:"16"},{default:u(()=>[n(l(J))]),_:1})]),_:1},8,["class"]),n(o,{tag:"span",class:i([{"tabs-card-next-hide":!d.value},"tabs-card-next"]),onClick:$},{default:u(()=>[n(a,{size:"16"},{default:u(()=>[n(l(U))]),_:1})]),_:1},8,["class"]),h("div",{ref_key:"navScroll",ref:s,class:"tabs-card-scroll"},[n(l(ae),{list:c.value.tabsList,animation:"300",class:"flex","item-key":"value",draggable:!1},{item:u(({element:r,index:f})=>[n(o,{tag:"div",id:`tag${r.value}`,class:i([{"active-item":c.value.activeKey===r.value},"shadow-sm tabs-card-scroll-item"]),onClick:X(ne=>I(r),["stop"])},{default:u(()=>[Z(e.$slots,"labelSlot",{element:r},()=>[n(l(oe),{ref:`renderDom_${f}`,value:r.label},null,8,["value"])],!0)]),_:2},1032,["id","class","onClick"])]),_:3},8,["list"])],512)],2)],2)],4)}}}),de=te(le,[["__scopeId","data-v-df7dbc08"]]);export{de as T};
