2025-07-10 14:18:26 +08:00
|
|
|
import{W as e,aW as a,bP as l,b as t,A as s,h as o,_ as r,d as n,j as i,I as u,a as d,r as c,D as p,aY as v,aw as b,c as m,e as f,$ as h,n as g,g as y,k as w,bQ as _,af as k,bR as C,bS as $,F as x,o as F,bT as P,N,E as T,bU as B,L as R,Y as S,ai as V,y as E,x as A,f as L,bV as U,aS as q,U as W,p as j,aq as K,bW as z,ad as I,bx as Y,R as D,ag as H,S as M,v as O,s as Q,a_ as X,bf as G,a$ as J,b3 as Z,b7 as ee,aB as ae,w as le,l as te,O as se,t as oe,bz as re,bA as ne,aj as ie,ak as ue,bC as de,by as ce}from"./index.1752128255261UEem1IaN.js";import{E as pe}from"./el-card.1752128255261B-6UY0RR.js";const ve=(t,s)=>{const o={},r=e([]);return{children:r,addChild:e=>{o[e.uid]=e,r.value=((e,t,s)=>a(e.subTree).filter((e=>{var a;return l(e)&&(null==(a=e.type)?void 0:a.name)===t&&!!e.component})).map((e=>e.component.uid)).map((e=>s[e])).filter((e=>!!e)))(t,s,o)},removeChild:e=>{delete o[e],r.value=r.value.filter((a=>a.uid!==e))}}},be=Symbol("tabsRootContextKey"),me=t({tabs:{type:o(Array),default:()=>s([])}}),fe="ElTabBar",he=n({name:fe});var ge=r(n({...he,props:me,setup(e,{expose:a}){const l=e,t=w(),s=i(be);s||u(fe,"<el-tabs><el-tab-bar /></el-tabs>");const o=d("tabs"),r=c(),n=c(),C=()=>n.value=(()=>{let e=0,a=0;const o=["top","bottom"].includes(s.props.tabPosition)?"width":"height",r="width"===o?"x":"y",n="x"===r?"left":"top";return l.tabs.every((l=>{var s,r;const i=null==(r=null==(s=t.parent)?void 0:s.refs)?void 0:r[`tab-${l.uid}`];if(!i)return!1;if(!l.active)return!0;e=i[`offset${_(n)}`],a=i[`client${_(o)}`];const u=window.getComputedStyle(i);return"width"===o&&(a-=Number.parseFloat(u.paddingLeft)+Number.parseFloat(u.paddingRight),e+=Number.parseFloat(u.paddingLeft)),!1})),{[o]:`${a}px`,transform:`translate${_(r)}(${e}px)`}})(),$=[];p((()=>l.tabs),(async()=>{await k(),C(),(()=>{var e;$.forEach((e=>e.stop())),$.length=0;const a=null==(e=t.parent)?void 0:e.refs;if(a)for(const l in a)if(l.startsWith("tab-")){const e=a[l];e&&$.push(v(e,C))}})()}),{immediate:!0});const x=v(r,(()=>C()));return b((()=>{$.forEach((e=>e.stop())),$.length=0,x.stop()})),a({ref:r,update:C}),(e,a)=>(f(),m("div",{ref_key:"barRef",ref:r,class:g([y(o).e("active-bar"),y(o).is(y(s).props.tabPosition)]),style:h(n.value)},null,6))}}),[["__file","tab-bar.vue"]]);const ye=t({panes:{type:o(Array),default:()=>s([])},currentName:{type:[String,Number],default:""},editable:Boolean,type:{type:String,values:["card","border-card",""],default:""},stretch:Boolean}),we="ElTabNav",_e=n({name:we,props:ye,emits:{tabClick:(e,a,l)=>l instanceof Event,tabRemove:(e,a)=>a instanceof Event},setup(e,{expose:a,emit:l}){const t=i(be);t||u(we,"<el-tabs><tab-nav /></el-tabs>");const s=d("tabs"),o=C(),r=$(),n=c(),b=c(),m=c(),f=c(),h=c(!1),g=c(0),y=c(!1),w=c(!0),E=x((()=>["top","bottom"].includes(t.props.tabPosition)?"width":"height")),A=x((()=>({transform:`translate${"width"===E.value?"X":"Y"}(-${g.value}px)`}))),L=()=>{if(!n.value)return;const e=n.value[`offset${_(E.value)}`],a=g.value;if(!a)return;const l=a>e?a-e:0;g.value=l},U=()=>{if(!n.value||!b.value)return;const e=b.value[`offset${_(E.value)}`],a=n.value[`offset${_(E.value)}`],l=g.value;if(e-l<=a)return;const t=e-l>2*a?l+a:e-a;g.value=t},q=async()=>{const e=b.value;if(!(h.value&&m.value&&n.value&&e))return;await k();const a=m.value.querySelector(".is-active");if(!a)return;const l=n.value,s=["top","bottom"].includes(t.props.tabPosition),o=a.getBoundingClientRect(),r=l.getBoundingClientRect(),i=s?e.offsetWidth-r.width:e.offsetHeight-r.height,u=g.value;let d=u;s?(o.left<r.left&&(d=u-(r.left-o.left)),o.right>r.right&&(d=u+o.right-r.right)):(o.top<r.top&&(d=u-(r.top-o.top)),o.bottom>r.bottom&&(d=u+(o.bottom-r.bottom))),d=Math.max(d,0),g.value=Math.min(d,i)},W=()=>{var a;if(!b.value||!n.value)return;e.stretch&&(null==(a=f.value)||a.update());const l=b.value[`offset${_(E.value)}`],t=n.value[`offset${_(E.value)}`],s=g.value;t<l?(h.value=h.value||{},h.value.prev=s,h.value.next=s+t<l,l-s<t&&(g.value=l-t)):(h.value=!1,s>0&&(g.value=0))},j=e=>{let a=0;switch(e.code){case S.left:case S.up:a=-1;break;case S.right:case S.down:a=1;break;default:return
|