You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
2.3 KiB

var C=(y,P,n)=>new Promise((u,l)=>{var T=r=>{try{c(n.next(r))}catch(t){l(t)}},f=r=>{try{c(n.throw(r))}catch(t){l(t)}},c=r=>r.done?u(r.value):Promise.resolve(r.value).then(T,f);c((n=n.apply(y,P)).next())});import{d as M,r as v,bl as S,cb as K,P as w,o as b,g as q,b as R,w as B,F as V,bt as D,a as F,u as k,j as A,x as L,h as U,t as $,bz as N,ea as m,aT as G}from"./index-f4658ae7.js";import{a as H,T as J}from"./index-84fbff43.js";import Q from"./menu-42b70d55.js";import"./useRefs-2f4603d7.js";import"./PlusOutlined-7b96f081.js";const W={class:"tabs"},X=M({__name:"MenuTabs",emits:["removeCachePageId","addCachePageId","AddTabByKey"],setup(y,{expose:P,emit:n}){const u=n,l=v([]),f=S().query.EnName,c=Q.map(a=>a.children).flat(),r=v("small"),t=v([]),i=v("");l.value.push("");const h=K(),_=a=>C(this,null,function*(){let e=a.Paras;a.Paras.includes("EnName=TS.Port.MySetting")==!1&&(e=N(a.Paras));const s={path:a.path,query:m(e)};yield h.replace(s);const o=g(a.path+e);o?d(o.path+N(o.Paras)):(t.value.push(a),d(a.path+e),u("addCachePageId",a.path+e))});w(()=>{let a=t.value.find(e=>e.Paras.includes(f));if(a===void 0){u("AddTabByKey",f,!1);return}a&&_(a)});const x=a=>{if(u("removeCachePageId",a),t.value=t.value.filter(e=>e.path+e.Paras!==a),i.value===a){let e=-1;for(let s=l.value.length-1;s>=0;s--){let o=l.value.pop();if(o!=a){const p=t.value.find(I=>I.path+I.Paras===o);if(p){d(p.path+p.Paras),h.push({path:p.path,query:m(p.Paras)}),e=s;break}}}e==-1&&(d(t.value[0].path+t.value[0].Paras),h.push({path:t.value[0].path,query:m(t.value[0].Paras)}))}},z=(a,e)=>{const s=c.find(o=>o.Path+o.Paras==a);e==="add"&&s?_(s):x(a)},E=a=>{const e=g(a);e&&(d(e.path+e.Paras),h.push({path:e.path,query:m(e.Paras)}))},g=a=>{for(const e of t.value)if(e.Paras||(e.Paras=""),e.path+e.Paras==a)return e;return null},d=a=>{i.value=a,l.value.push(a)};return P({add:_,remove:x,activeKey:i}),(a,e)=>(b(),q("div",W,[R(k(J),{activeKey:i.value,"onUpdate:activeKey":e[0]||(e[0]=s=>i.value=s),size:r.value,type:"editable-card",onEdit:z,hideAdd:!0,onChange:E},{default:B(()=>[(b(!0),q(V,null,D(t.value,s=>(b(),F(k(H),{key:s.path+s.Paras,closable:s.closable},{tab:B(()=>[A("span",null,[A("i",{class:L(s.Icon)},null,2),U(" "+$(s.title),1)])]),_:2},1032,["closable"]))),128))]),_:1},8,["activeKey","size"])]))}});const sa=G(X,[["__scopeId","data-v-1fe814b5"]]);export{sa as default};