4 lines
33 KiB
JavaScript
4 lines
33 KiB
JavaScript
import{aB as je,aC as nt,aD as ht,ci as mt,dg as gt,aq as $t,s as W,e as ke,b6 as me,d as le,r as Q,k as H,C as h,aP as ie,ct as Z,b7 as Ce,aI as T,aR as F,aX as we,cx as D,o as Te,a1 as oe,bm as yt,bn as xt,dh as he,aQ as te,aW as ge,a_ as _t,ba as St,bc as Ct,bd as Tt,be as ot,cz as wt,di as it,aK as lt,bT as Pt,a$ as Rt,bb as It,dj as Et,cU as De,aL as Bt,cE as Lt,bD as At,aT as xe,aS as Dt,aU as Ot}from"./vNwORUzZ.js";import{u as kt,E as Mt,M as Nt,_ as Wt}from"./DthsPRuY.js";import{D as Ht}from"./CDTKgsv-.js";import{R as Fe}from"./DsBtkfRw.js";import{u as zt}from"./jWeiyGsk.js";import{h as Gt}from"./CRGbT1rP.js";import{f as Kt}from"./BZwHMXHs.js";import{i as Xt}from"./BbN7I0i_.js";import{u as Ve}from"./Bm2ySzQc.js";import{i as Ye}from"./BuV2w3Jf.js";function jt(e,t,a,i){if(!je(e))return e;t=nt(t,e);for(var o=-1,l=t.length,n=l-1,s=e;s!=null&&++o<l;){var v=ht(t[o]),c=a;if(v==="__proto__"||v==="constructor"||v==="prototype")return e;if(o!=n){var p=s[v];c=void 0,c===void 0&&(c=je(p)?p:mt(t[o+1])?[]:{})}gt(s,v,c),s=s[v]}return e}function Ft(e,t,a){for(var i=-1,o=t.length,l={};++i<o;){var n=t[i],s=$t(e,n);a(s,n)&&jt(l,nt(n,e),s)}return l}function Vt(e,t){return Ft(e,t,function(a,i){return Gt(e,i)})}var rt=Kt(function(e,t){return e==null?{}:Vt(e,t)});function Yt(e){const t=W(),a=W(!1);function i(){for(var o=arguments.length,l=new Array(o),n=0;n<o;n++)l[n]=arguments[n];a.value||(me.cancel(t.value),t.value=me(()=>{e(...l)}))}return ke(()=>{a.value=!0,me.cancel(t.value)}),i}function Ut(e){const t=W([]),a=W(typeof e=="function"?e():e),i=Yt(()=>{let l=a.value;t.value.forEach(n=>{l=n(l)}),t.value=[],a.value=l});function o(l){t.value.push(l),i()}return[a,o]}const qt=le({compatConfig:{MODE:3},name:"TabNode",props:{id:{type:String},prefixCls:{type:String},tab:{type:Object},active:{type:Boolean},closable:{type:Boolean},editable:{type:Object},onClick:{type:Function},onResize:{type:Function},renderWrapper:{type:Function},removeAriaLabel:{type:String},onFocus:{type:Function}},emits:["click","resize","remove","focus"],setup(e,t){let{expose:a,attrs:i}=t;const o=Q();function l(v){var c;!((c=e.tab)===null||c===void 0)&&c.disabled||e.onClick(v)}a({domRef:o});function n(v){var c;v.preventDefault(),v.stopPropagation(),e.editable.onEdit("remove",{key:(c=e.tab)===null||c===void 0?void 0:c.key,event:v})}const s=H(()=>{var v;return e.editable&&e.closable!==!1&&!(!((v=e.tab)===null||v===void 0)&&v.disabled)});return()=>{var v;const{prefixCls:c,id:p,active:S,tab:{key:m,tab:d,disabled:y,closeIcon:x},renderWrapper:w,removeAriaLabel:C,editable:O,onFocus:G}=e,k=`${c}-tab`,r=h("div",{key:m,ref:o,class:ie(k,{[`${k}-with-remove`]:s.value,[`${k}-active`]:S,[`${k}-disabled`]:y}),style:i.style,onClick:l},[h("div",{role:"tab","aria-selected":S,id:p&&`${p}-tab-${m}`,class:`${k}-btn`,"aria-controls":p&&`${p}-panel-${m}`,"aria-disabled":y,tabindex:y?null:0,onClick:g=>{g.stopPropagation(),l(g)},onKeydown:g=>{[Z.SPACE,Z.ENTER].includes(g.which)&&(g.preventDefault(),l(g))},onFocus:G},[typeof d=="function"?d():d]),s.value&&h("button",{type:"button","aria-label":C||"remove",tabindex:0,class:`${k}-remove`,onClick:g=>{g.stopPropagation(),n(g)}},[(x==null?void 0:x())||((v=O.removeIcon)===null||v===void 0?void 0:v.call(O))||"×"])]);return w?w(r):r}}}),Ue={width:0,height:0,left:0,top:0};function Zt(e,t){const a=Q(new Map);return Ce(()=>{var i,o;const l=new Map,n=e.value,s=t.value.get((i=n[0])===null||i===void 0?void 0:i.key)||Ue,v=s.left+s.width;for(let c=0;c<n.length;c+=1){const{key:p}=n[c];let S=t.value.get(p);S||(S=t.value.get((o=n[c-1])===null||o===void 0?void 0:o.key)||Ue);const m=l.get(p)||T({},S);m.right=v-m.left-m.width,l.set(p,m)}a.value=new Map(l)}),a}const st=le({compatConfig:{MODE:3},name:"AddButton",inheritAttrs:!1,props:{prefixCls:String,editable:{type:Object},locale:{type:Object,default:void 0}},setup(e,t){let{expose:a,attrs:i}=t;const o=Q();return a({domRef:o}),()=>{const{prefixCls:l,editable:n,locale:s}=e;return!n||n.showAdd===!1?null:h("button",{ref:o,type:"button",class:`${l}-nav-add`,style:i.style,"aria-label":(s==null?void 0:s.addAriaLabel)||"Add tab",onClick:v=>{n.onEdit("add",{event:v})}},[n.addIcon?n.addIcon():"+"])}}}),Qt={prefixCls:{type:String},id:{type:String},tabs:{type:Object},rtl:{type:Boolean},tabBarGutter:{type:Number},activeKey:{type:[String,Number]},mobile:{type:Boolean},moreIcon:we.any,moreTransitionName:{type:String},editable:{type:Object},locale:{type:Object,default:void 0},removeAriaLabel:String,onTabClick:{type:Function},popupClassName:String,getPopupContainer:F()},Jt=le({compatConfig:{MODE:3},name:"OperationNode",inheritAttrs:!1,props:Qt,emits:["tabClick"],slots:Object,setup(e,t){let{attrs:a,slots:i}=t;const[o,l]=D(!1),[n,s]=D(null),v=d=>{const y=e.tabs.filter(C=>!C.disabled);let x=y.findIndex(C=>C.key===n.value)||0;const w=y.length;for(let C=0;C<w;C+=1){x=(x+d+w)%w;const O=y[x];if(!O.disabled){s(O.key);return}}},c=d=>{const{which:y}=d;if(!o.value){[Z.DOWN,Z.SPACE,Z.ENTER].includes(y)&&(l(!0),d.preventDefault());return}switch(y){case Z.UP:v(-1),d.preventDefault();break;case Z.DOWN:v(1),d.preventDefault();break;case Z.ESC:l(!1);break;case Z.SPACE:case Z.ENTER:n.value!==null&&e.onTabClick(n.value,d);break}},p=H(()=>`${e.id}-more-popup`),S=H(()=>n.value!==null?`${p.value}-${n.value}`:null),m=(d,y)=>{d.preventDefault(),d.stopPropagation(),e.editable.onEdit("remove",{key:y,event:d})};return Te(()=>{oe(n,()=>{const d=document.getElementById(S.value);d&&d.scrollIntoView&&d.scrollIntoView(!1)},{flush:"post",immediate:!0})}),oe(o,()=>{o.value||s(null)}),kt({}),()=>{var d;const{prefixCls:y,id:x,tabs:w,locale:C,mobile:O,moreIcon:G=((d=i.moreIcon)===null||d===void 0?void 0:d.call(i))||h(Mt,null,null),moreTransitionName:k,editable:r,tabBarGutter:g,rtl:u,onTabClick:$,popupClassName:E}=e;if(!w.length)return null;const R=`${y}-dropdown`,K=C==null?void 0:C.dropdownAriaLabel,re={[u?"marginRight":"marginLeft"]:g};w.length||(re.visibility="hidden",re.order=1);const se=ie({[`${R}-rtl`]:u,[`${E}`]:!0}),de=O?null:h(Ht,{prefixCls:R,trigger:["hover"],visible:o.value,transitionName:k,onVisibleChange:l,overlayClassName:se,mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:e.getPopupContainer},{overlay:()=>h(Nt,{onClick:I=>{let{key:J,domEvent:M}=I;$(J,M),l(!1)},id:p.value,tabindex:-1,role:"listbox","aria-activedescendant":S.value,selectedKeys:[n.value],"aria-label":K!==void 0?K:"expanded dropdown"},{default:()=>[w.map(I=>{var J,M;const V=r&&I.closable!==!1&&!I.disabled;return h(Wt,{key:I.key,id:`${p.value}-${I.key}`,role:"option","aria-controls":x&&`${x}-panel-${I.key}`,disabled:I.disabled},{default:()=>[h("span",null,[typeof I.tab=="function"?I.tab():I.tab]),V&&h("button",{type:"button","aria-label":e.removeAriaLabel||"remove",tabindex:0,class:`${R}-menu-item-remove`,onClick:Y=>{Y.stopPropagation(),m(Y,I.key)}},[((J=I.closeIcon)===null||J===void 0?void 0:J.call(I))||((M=r.removeIcon)===null||M===void 0?void 0:M.call(r))||"×"])]})})]}),default:()=>h("button",{type:"button",class:`${y}-nav-more`,style:re,tabindex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":p.value,id:`${x}-more`,"aria-expanded":o.value,onKeydown:c},[G])});return h("div",{class:ie(`${y}-nav-operations`,a.class),style:a.style},[de,h(st,{prefixCls:y,locale:C,editable:r},null)])}}}),ct=Symbol("tabsContextKey"),ea=e=>{xt(ct,e)},dt=()=>yt(ct,{tabs:Q([]),prefixCls:Q()}),ta=.1,qe=.01,_e=20,Ze=Math.pow(.995,_e);function aa(e,t){const[a,i]=D(),[o,l]=D(0),[n,s]=D(0),[v,c]=D(),p=Q();function S(r){const{screenX:g,screenY:u}=r.touches[0];i({x:g,y:u}),clearInterval(p.value)}function m(r){if(!a.value)return;r.preventDefault();const{screenX:g,screenY:u}=r.touches[0],$=g-a.value.x,E=u-a.value.y;t($,E),i({x:g,y:u});const R=Date.now();s(R-o.value),l(R),c({x:$,y:E})}function d(){if(!a.value)return;const r=v.value;if(i(null),c(null),r){const g=r.x/n.value,u=r.y/n.value,$=Math.abs(g),E=Math.abs(u);if(Math.max($,E)<ta)return;let R=g,K=u;p.value=setInterval(()=>{if(Math.abs(R)<qe&&Math.abs(K)<qe){clearInterval(p.value);return}R*=Ze,K*=Ze,t(R*_e,K*_e)},_e)}}const y=Q();function x(r){const{deltaX:g,deltaY:u}=r;let $=0;const E=Math.abs(g),R=Math.abs(u);E===R?$=y.value==="x"?g:u:E>R?($=g,y.value="x"):($=u,y.value="y"),t(-$,-$)&&r.preventDefault()}const w=Q({onTouchStart:S,onTouchMove:m,onTouchEnd:d,onWheel:x});function C(r){w.value.onTouchStart(r)}function O(r){w.value.onTouchMove(r)}function G(r){w.value.onTouchEnd(r)}function k(r){w.value.onWheel(r)}Te(()=>{var r,g;document.addEventListener("touchmove",O,{passive:!1}),document.addEventListener("touchend",G,{passive:!1}),(r=e.value)===null||r===void 0||r.addEventListener("touchstart",C,{passive:!1}),(g=e.value)===null||g===void 0||g.addEventListener("wheel",k,{passive:!1})}),ke(()=>{document.removeEventListener("touchmove",O),document.removeEventListener("touchend",G)})}function Qe(e,t){const a=Q(e);function i(o){const l=typeof o=="function"?o(a.value):o;l!==a.value&&t(l,a.value),a.value=l}return[a,i]}const Je={width:0,height:0,left:0,top:0,right:0},na=()=>({id:{type:String},tabPosition:{type:String},activeKey:{type:[String,Number]},rtl:{type:Boolean},animated:ge(),editable:ge(),moreIcon:we.any,moreTransitionName:{type:String},mobile:{type:Boolean},tabBarGutter:{type:Number},renderTabBar:{type:Function},locale:ge(),popupClassName:String,getPopupContainer:F(),onTabClick:{type:Function},onTabScroll:{type:Function}}),oa=(e,t)=>{const{offsetWidth:a,offsetHeight:i,offsetTop:o,offsetLeft:l}=e,{width:n,height:s,x:v,y:c}=e.getBoundingClientRect();return Math.abs(n-a)<1?[n,s,v-t.x,c-t.y]:[a,i,l,o]},et=le({compatConfig:{MODE:3},name:"TabNavList",inheritAttrs:!1,props:na(),slots:Object,emits:["tabClick","tabScroll"],setup(e,t){let{attrs:a,slots:i}=t;const{tabs:o,prefixCls:l}=dt(),n=W(),s=W(),v=W(),c=W(),[p,S]=zt(),m=H(()=>e.tabPosition==="top"||e.tabPosition==="bottom"),[d,y]=Qe(0,(f,b)=>{m.value&&e.onTabScroll&&e.onTabScroll({direction:f>b?"left":"right"})}),[x,w]=Qe(0,(f,b)=>{!m.value&&e.onTabScroll&&e.onTabScroll({direction:f>b?"top":"bottom"})}),[C,O]=D(0),[G,k]=D(0),[r,g]=D(null),[u,$]=D(null),[E,R]=D(0),[K,re]=D(0),[se,de]=Ut(new Map),I=Zt(o,se),J=H(()=>`${l.value}-nav-operations-hidden`),M=W(0),V=W(0);Ce(()=>{m.value?e.rtl?(M.value=0,V.value=Math.max(0,C.value-r.value)):(M.value=Math.min(0,r.value-C.value),V.value=0):(M.value=Math.min(0,u.value-G.value),V.value=0)});const Y=f=>f<M.value?M.value:f>V.value?V.value:f,ue=W(),[z,ve]=D(),be=()=>{ve(Date.now())},pe=()=>{clearTimeout(ue.value)},$e=(f,b)=>{f(_=>Y(_+b))};aa(n,(f,b)=>{if(m.value){if(r.value>=C.value)return!1;$e(y,f)}else{if(u.value>=G.value)return!1;$e(w,b)}return pe(),be(),!0}),oe(z,()=>{pe(),z.value&&(ue.value=setTimeout(()=>{ve(0)},100))});const ce=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e.activeKey;const b=I.value.get(f)||{width:0,height:0,left:0,right:0,top:0};if(m.value){let _=d.value;e.rtl?b.right<d.value?_=b.right:b.right+b.width>d.value+r.value&&(_=b.right+b.width-r.value):b.left<-d.value?_=-b.left:b.left+b.width>-d.value+r.value&&(_=-(b.left+b.width-r.value)),w(0),y(Y(_))}else{let _=x.value;b.top<-x.value?_=-b.top:b.top+b.height>-x.value+u.value&&(_=-(b.top+b.height-u.value)),y(0),w(Y(_))}},Pe=W(0),Re=W(0);Ce(()=>{let f,b,_,P,L,B;const U=I.value;["top","bottom"].includes(e.tabPosition)?(f="width",P=r.value,L=C.value,B=E.value,b=e.rtl?"right":"left",_=Math.abs(d.value)):(f="height",P=u.value,L=C.value,B=K.value,b="top",_=-x.value);let N=P;L+B>P&&L<P&&(N=P-B);const j=o.value;if(!j.length)return[Pe.value,Re.value]=[0,0];const q=j.length;let ne=q;for(let X=0;X<q;X+=1){const ee=U.get(j[X].key)||Je;if(ee[b]+ee[f]>_+N){ne=X-1;break}}let A=0;for(let X=q-1;X>=0;X-=1)if((U.get(j[X].key)||Je)[b]<_){A=X+1;break}return[Pe.value,Re.value]=[A,ne]});const Ne=()=>{de(()=>{var f;const b=new Map,_=(f=s.value)===null||f===void 0?void 0:f.getBoundingClientRect();return o.value.forEach(P=>{let{key:L}=P;const B=S.value.get(L),U=(B==null?void 0:B.$el)||B;if(U){const[N,j,q,ne]=oa(U,_);b.set(L,{width:N,height:j,left:q,top:ne})}}),b})};oe(()=>o.value.map(f=>f.key).join("%%"),()=>{Ne()},{flush:"post"});const Ie=()=>{var f,b,_,P,L;const B=((f=n.value)===null||f===void 0?void 0:f.offsetWidth)||0,U=((b=n.value)===null||b===void 0?void 0:b.offsetHeight)||0,N=((_=c.value)===null||_===void 0?void 0:_.$el)||{},j=N.offsetWidth||0,q=N.offsetHeight||0;g(B),$(U),R(j),re(q);const ne=(((P=s.value)===null||P===void 0?void 0:P.offsetWidth)||0)-j,A=(((L=s.value)===null||L===void 0?void 0:L.offsetHeight)||0)-q;O(ne),k(A),Ne()},We=H(()=>[...o.value.slice(0,Pe.value),...o.value.slice(Re.value+1)]),[vt,bt]=D(),ae=H(()=>I.value.get(e.activeKey)),He=W(),ze=()=>{me.cancel(He.value)};oe([ae,m,()=>e.rtl],()=>{const f={};ae.value&&(m.value?(e.rtl?f.right=he(ae.value.right):f.left=he(ae.value.left),f.width=he(ae.value.width)):(f.top=he(ae.value.top),f.height=he(ae.value.height))),ze(),He.value=me(()=>{bt(f)})}),oe([()=>e.activeKey,ae,I,m],()=>{ce()},{flush:"post"}),oe([()=>e.rtl,()=>e.tabBarGutter,()=>e.activeKey,()=>o.value],()=>{Ie()},{flush:"post"});const Ee=f=>{let{position:b,prefixCls:_,extra:P}=f;if(!P)return null;const L=P==null?void 0:P({position:b});return L?h("div",{class:`${_}-extra-content`},[L]):null};return ke(()=>{pe(),ze()}),()=>{const{id:f,animated:b,activeKey:_,rtl:P,editable:L,locale:B,tabPosition:U,tabBarGutter:N,onTabClick:j}=e,{class:q,style:ne}=a,A=l.value,X=!!We.value.length,ee=`${A}-nav-wrap`;let Be,Le,Ge,Ke;m.value?P?(Le=d.value>0,Be=d.value+r.value<C.value):(Be=d.value<0,Le=-d.value+r.value<C.value):(Ge=x.value<0,Ke=-x.value+u.value<G.value);const ye={};U==="top"||U==="bottom"?ye[P?"marginRight":"marginLeft"]=typeof N=="number"?`${N}px`:N:ye.marginTop=typeof N=="number"?`${N}px`:N;const Xe=o.value.map((Ae,pt)=>{const{key:fe}=Ae;return h(qt,{id:f,prefixCls:A,key:fe,tab:Ae,style:pt===0?void 0:ye,closable:Ae.closable,editable:L,active:fe===_,removeAriaLabel:B==null?void 0:B.removeAriaLabel,ref:p(fe),onClick:ft=>{j(fe,ft)},onFocus:()=>{ce(fe),be(),n.value&&(P||(n.value.scrollLeft=0),n.value.scrollTop=0)}},i)});return h("div",{role:"tablist",class:ie(`${A}-nav`,q),style:ne,onKeydown:()=>{be()}},[h(Ee,{position:"left",prefixCls:A,extra:i.leftExtra},null),h(Fe,{onResize:Ie},{default:()=>[h("div",{class:ie(ee,{[`${ee}-ping-left`]:Be,[`${ee}-ping-right`]:Le,[`${ee}-ping-top`]:Ge,[`${ee}-ping-bottom`]:Ke}),ref:n},[h(Fe,{onResize:Ie},{default:()=>[h("div",{ref:s,class:`${A}-nav-list`,style:{transform:`translate(${d.value}px, ${x.value}px)`,transition:z.value?"none":void 0}},[Xe,h(st,{ref:c,prefixCls:A,locale:B,editable:L,style:T(T({},Xe.length===0?void 0:ye),{visibility:X?"hidden":null})},null),h("div",{class:ie(`${A}-ink-bar`,{[`${A}-ink-bar-animated`]:b.inkBar}),style:vt.value},null)])]})])]}),h(Jt,te(te({},e),{},{removeAriaLabel:B==null?void 0:B.removeAriaLabel,ref:v,prefixCls:A,tabs:We.value,class:!X&&J.value}),rt(i,["moreIcon"])),h(Ee,{position:"right",prefixCls:A,extra:i.rightExtra},null),h(Ee,{position:"right",prefixCls:A,extra:i.tabBarExtraContent},null)])}}}),ia=le({compatConfig:{MODE:3},name:"TabPanelList",inheritAttrs:!1,props:{activeKey:{type:[String,Number]},id:{type:String},rtl:{type:Boolean},animated:{type:Object,default:void 0},tabPosition:{type:String},destroyInactiveTabPane:{type:Boolean}},setup(e){const{tabs:t,prefixCls:a}=dt();return()=>{const{id:i,activeKey:o,animated:l,tabPosition:n,rtl:s,destroyInactiveTabPane:v}=e,c=l.tabPane,p=a.value,S=t.value.findIndex(m=>m.key===o);return h("div",{class:`${p}-content-holder`},[h("div",{class:[`${p}-content`,`${p}-content-${n}`,{[`${p}-content-animated`]:c}],style:S&&c?{[s?"marginRight":"marginLeft"]:`-${S}00%`}:null},[t.value.map(m=>_t(m.node,{key:m.key,prefixCls:p,tabKey:m.key,id:i,animated:c,active:m.key===o,destroyInactiveTabPane:v}))])])}}});var la={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};function tt(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},i=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(a).filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable}))),i.forEach(function(o){ra(e,o,a[o])})}return e}function ra(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var Me=function(t,a){var i=tt({},t,a.attrs);return h(St,tt({},i,{icon:la}),null)};Me.displayName="PlusOutlined";Me.inheritAttrs=!1;const sa=e=>{const{componentCls:t,motionDurationSlow:a}=e;return[{[t]:{[`${t}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${a}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${a}`}}}}},[Ye(e,"slide-up"),Ye(e,"slide-down")]]},ca=e=>{const{componentCls:t,tabsCardHorizontalPadding:a,tabsCardHeadBackground:i,tabsCardGutter:o,colorSplit:l}=e;return{[`${t}-card`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{margin:0,padding:a,background:i,border:`${e.lineWidth}px ${e.lineType} ${l}`,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOut}`},[`${t}-tab-active`]:{color:e.colorPrimary,background:e.colorBgContainer},[`${t}-ink-bar`]:{visibility:"hidden"}},[`&${t}-top, &${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginLeft:{_skip_check_:!0,value:`${o}px`}}}},[`&${t}-top`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:`${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`},[`${t}-tab-active`]:{borderBottomColor:e.colorBgContainer}}},[`&${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:`0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px`},[`${t}-tab-active`]:{borderTopColor:e.colorBgContainer}}},[`&${t}-left, &${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginTop:`${o}px`}}},[`&${t}-left`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`${e.borderRadiusLG}px 0 0 ${e.borderRadiusLG}px`}},[`${t}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:e.colorBgContainer}}}},[`&${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px 0`}},[`${t}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:e.colorBgContainer}}}}}}},da=e=>{const{componentCls:t,tabsHoverColor:a,dropdownEdgeChildVerticalPadding:i}=e;return{[`${t}-dropdown`]:T(T({},ot(e)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:e.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${t}-dropdown-menu`]:{maxHeight:e.tabsDropdownHeight,margin:0,padding:`${i}px 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:e.colorBgContainer,backgroundClip:"padding-box",borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary,"&-item":T(T({},wt),{display:"flex",alignItems:"center",minWidth:e.tabsDropdownWidth,margin:0,padding:`${e.paddingXXS}px ${e.paddingSM}px`,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:e.marginSM},color:e.colorTextDescription,fontSize:e.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:a}},"&:hover":{background:e.controlItemBgHover},"&-disabled":{"&, &:hover":{color:e.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},ua=e=>{const{componentCls:t,margin:a,colorSplit:i}=e;return{[`${t}-top, ${t}-bottom`]:{flexDirection:"column",[`> ${t}-nav, > div > ${t}-nav`]:{margin:`0 0 ${a}px 0`,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${e.lineWidth}px ${e.lineType} ${i}`,content:"''"},[`${t}-ink-bar`]:{height:e.lineWidthBold,"&-animated":{transition:`width ${e.motionDurationSlow}, left ${e.motionDurationSlow},
|
||
right ${e.motionDurationSlow}`}},[`${t}-nav-wrap`]:{"&::before, &::after":{top:0,bottom:0,width:e.controlHeight},"&::before":{left:{_skip_check_:!0,value:0},boxShadow:e.boxShadowTabsOverflowLeft},"&::after":{right:{_skip_check_:!0,value:0},boxShadow:e.boxShadowTabsOverflowRight},[`&${t}-nav-wrap-ping-left::before`]:{opacity:1},[`&${t}-nav-wrap-ping-right::after`]:{opacity:1}}}},[`${t}-top`]:{[`> ${t}-nav,
|
||
> div > ${t}-nav`]:{"&::before":{bottom:0},[`${t}-ink-bar`]:{bottom:0}}},[`${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{order:1,marginTop:`${a}px`,marginBottom:0,"&::before":{top:0},[`${t}-ink-bar`]:{top:0}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{order:0}},[`${t}-left, ${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{flexDirection:"column",minWidth:e.controlHeight*1.25,[`${t}-tab`]:{padding:`${e.paddingXS}px ${e.paddingLG}px`,textAlign:"center"},[`${t}-tab + ${t}-tab`]:{margin:`${e.margin}px 0 0 0`},[`${t}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:e.controlHeight},"&::before":{top:0,boxShadow:e.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:e.boxShadowTabsOverflowBottom},[`&${t}-nav-wrap-ping-top::before`]:{opacity:1},[`&${t}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${t}-ink-bar`]:{width:e.lineWidthBold,"&-animated":{transition:`height ${e.motionDurationSlow}, top ${e.motionDurationSlow}`}},[`${t}-nav-list, ${t}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${t}-left`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{marginLeft:{_skip_check_:!0,value:`-${e.lineWidth}px`},borderLeft:{_skip_check_:!0,value:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`},[`> ${t}-content > ${t}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:e.paddingLG}}}},[`${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{order:1,[`${t}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:-e.lineWidth},borderRight:{_skip_check_:!0,value:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`},[`> ${t}-content > ${t}-tabpane`]:{paddingRight:{_skip_check_:!0,value:e.paddingLG}}}}}},va=e=>{const{componentCls:t,padding:a}=e;return{[t]:{"&-small":{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:`${e.paddingXS}px 0`,fontSize:e.fontSize}}},"&-large":{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:`${a}px 0`,fontSize:e.fontSizeLG}}}},[`${t}-card`]:{[`&${t}-small`]:{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:`${e.paddingXXS*1.5}px ${a}px`}},[`&${t}-bottom`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:`0 0 ${e.borderRadius}px ${e.borderRadius}px`}},[`&${t}-top`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:`${e.borderRadius}px ${e.borderRadius}px 0 0`}},[`&${t}-right`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${e.borderRadius}px ${e.borderRadius}px 0`}}},[`&${t}-left`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`${e.borderRadius}px 0 0 ${e.borderRadius}px`}}}},[`&${t}-large`]:{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:`${e.paddingXS}px ${a}px ${e.paddingXXS*1.5}px`}}}}}},ba=e=>{const{componentCls:t,tabsActiveColor:a,tabsHoverColor:i,iconCls:o,tabsHorizontalGutter:l}=e,n=`${t}-tab`;return{[n]:{position:"relative",display:"inline-flex",alignItems:"center",padding:`${e.paddingSM}px 0`,fontSize:`${e.fontSize}px`,background:"transparent",border:0,outline:"none",cursor:"pointer","&-btn, &-remove":T({"&:focus:not(:focus-visible), &:active":{color:a}},it(e)),"&-btn":{outline:"none",transition:"all 0.3s"},"&-remove":{flex:"none",marginRight:{_skip_check_:!0,value:-e.marginXXS},marginLeft:{_skip_check_:!0,value:e.marginXS},color:e.colorTextDescription,fontSize:e.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${e.motionDurationSlow}`,"&:hover":{color:e.colorTextHeading}},"&:hover":{color:i},[`&${n}-active ${n}-btn`]:{color:e.colorPrimary,textShadow:e.tabsActiveTextShadow},[`&${n}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed"},[`&${n}-disabled ${n}-btn, &${n}-disabled ${t}-remove`]:{"&:focus, &:active":{color:e.colorTextDisabled}},[`& ${n}-remove ${o}`]:{margin:0},[o]:{marginRight:{_skip_check_:!0,value:e.marginSM}}},[`${n} + ${n}`]:{margin:{_skip_check_:!0,value:`0 0 0 ${l}px`}}}},pa=e=>{const{componentCls:t,tabsHorizontalGutter:a,iconCls:i,tabsCardGutter:o}=e;return{[`${t}-rtl`]:{direction:"rtl",[`${t}-nav`]:{[`${t}-tab`]:{margin:{_skip_check_:!0,value:`0 0 0 ${a}px`},[`${t}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[i]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:`${e.marginSM}px`}},[`${t}-tab-remove`]:{marginRight:{_skip_check_:!0,value:`${e.marginXS}px`},marginLeft:{_skip_check_:!0,value:`-${e.marginXXS}px`},[i]:{margin:0}}}},[`&${t}-left`]:{[`> ${t}-nav`]:{order:1},[`> ${t}-content-holder`]:{order:0}},[`&${t}-right`]:{[`> ${t}-nav`]:{order:0},[`> ${t}-content-holder`]:{order:1}},[`&${t}-card${t}-top, &${t}-card${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginRight:{_skip_check_:!0,value:`${o}px`},marginLeft:{_skip_check_:!0,value:0}}}}},[`${t}-dropdown-rtl`]:{direction:"rtl"},[`${t}-menu-item`]:{[`${t}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},fa=e=>{const{componentCls:t,tabsCardHorizontalPadding:a,tabsCardHeight:i,tabsCardGutter:o,tabsHoverColor:l,tabsActiveColor:n,colorSplit:s}=e;return{[t]:T(T(T(T({},ot(e)),{display:"flex",[`> ${t}-nav, > div > ${t}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${t}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${e.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${t}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${e.motionDurationSlow}`},[`${t}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${t}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${t}-nav-more`]:{position:"relative",padding:a,background:"transparent",border:0,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:e.controlHeightLG/8,transform:"translateY(100%)",content:"''"}},[`${t}-nav-add`]:T({minWidth:`${i}px`,marginLeft:{_skip_check_:!0,value:`${o}px`},padding:`0 ${e.paddingXS}px`,background:"transparent",border:`${e.lineWidth}px ${e.lineType} ${s}`,borderRadius:`${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`,outline:"none",cursor:"pointer",color:e.colorText,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOut}`,"&:hover":{color:l},"&:active, &:focus:not(:focus-visible)":{color:n}},it(e))},[`${t}-extra-content`]:{flex:"none"},[`${t}-ink-bar`]:{position:"absolute",background:e.colorPrimary,pointerEvents:"none"}}),ba(e)),{[`${t}-content`]:{position:"relative",display:"flex",width:"100%","&-animated":{transition:"margin 0.3s"}},[`${t}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${t}-tabpane`]:{outline:"none",flex:"none",width:"100%"}}),[`${t}-centered`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-nav-wrap`]:{[`&:not([class*='${t}-nav-wrap-ping'])`]:{justifyContent:"center"}}}}}},ha=Ct("Tabs",e=>{const t=e.controlHeightLG,a=Tt(e,{tabsHoverColor:e.colorPrimaryHover,tabsActiveColor:e.colorPrimaryActive,tabsCardHorizontalPadding:`${(t-Math.round(e.fontSize*e.lineHeight))/2-e.lineWidth}px ${e.padding}px`,tabsCardHeight:t,tabsCardGutter:e.marginXXS/2,tabsHorizontalGutter:32,tabsCardHeadBackground:e.colorFillAlter,dropdownEdgeChildVerticalPadding:e.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120});return[va(a),pa(a),ua(a),da(a),ca(a),fa(a),sa(a)]},e=>({zIndexPopup:e.zIndexPopupBase+50}));let at=0;const ut=()=>({prefixCls:{type:String},id:{type:String},popupClassName:String,getPopupContainer:F(),activeKey:{type:[String,Number]},defaultActiveKey:{type:[String,Number]},direction:xe(),animated:Ot([Boolean,Object]),renderTabBar:F(),tabBarGutter:{type:Number},tabBarStyle:ge(),tabPosition:xe(),destroyInactiveTabPane:Dt(),hideAdd:Boolean,type:xe(),size:xe(),centered:Boolean,onEdit:F(),onChange:F(),onTabClick:F(),onTabScroll:F(),"onUpdate:activeKey":F(),locale:ge(),onPrevClick:F(),onNextClick:F(),tabBarExtraContent:we.any});function ma(e){return e.map(t=>{if(It(t)){const a=T({},t.props||{});for(const[m,d]of Object.entries(a))delete a[m],a[Et(m)]=d;const i=t.children||{},o=t.key!==void 0?t.key:void 0,{tab:l=i.tab,disabled:n,forceRender:s,closable:v,animated:c,active:p,destroyInactiveTabPane:S}=a;return T(T({key:o},a),{node:t,closeIcon:i.closeIcon,tab:l,disabled:n===""||n,forceRender:s===""||s,closable:v===""||v,animated:c===""||c,active:p===""||p,destroyInactiveTabPane:S===""||S})}return null}).filter(t=>t)}const ga=le({compatConfig:{MODE:3},name:"InternalTabs",inheritAttrs:!1,props:T(T({},lt(ut(),{tabPosition:"top",animated:{inkBar:!0,tabPane:!1}})),{tabs:At()}),slots:Object,setup(e,t){let{attrs:a,slots:i}=t;De(e.onPrevClick===void 0&&e.onNextClick===void 0,"Tabs","`onPrevClick / @prevClick` and `onNextClick / @nextClick` has been removed. Please use `onTabScroll / @tabScroll` instead."),De(e.tabBarExtraContent===void 0,"Tabs","`tabBarExtraContent` prop has been removed. Please use `rightExtra` slot instead."),De(i.tabBarExtraContent===void 0,"Tabs","`tabBarExtraContent` slot is deprecated. Please use `rightExtra` slot instead.");const{prefixCls:o,direction:l,size:n,rootPrefixCls:s,getPopupContainer:v}=Bt("tabs",e),[c,p]=ha(o),S=H(()=>l.value==="rtl"),m=H(()=>{const{animated:u,tabPosition:$}=e;return u===!1||["left","right"].includes($)?{inkBar:!1,tabPane:!1}:u===!0?{inkBar:!0,tabPane:!0}:T({inkBar:!0,tabPane:!1},typeof u=="object"?u:{})}),[d,y]=D(!1);Te(()=>{y(Xt())});const[x,w]=Ve(()=>{var u;return(u=e.tabs[0])===null||u===void 0?void 0:u.key},{value:H(()=>e.activeKey),defaultValue:e.defaultActiveKey}),[C,O]=D(()=>e.tabs.findIndex(u=>u.key===x.value));Ce(()=>{var u;let $=e.tabs.findIndex(E=>E.key===x.value);$===-1&&($=Math.max(0,Math.min(C.value,e.tabs.length-1)),w((u=e.tabs[$])===null||u===void 0?void 0:u.key)),O($)});const[G,k]=Ve(null,{value:H(()=>e.id)}),r=H(()=>d.value&&!["left","right"].includes(e.tabPosition)?"top":e.tabPosition);Te(()=>{e.id||(k(`rc-tabs-${at}`),at+=1)});const g=(u,$)=>{var E,R;(E=e.onTabClick)===null||E===void 0||E.call(e,u,$);const K=u!==x.value;w(u),K&&((R=e.onChange)===null||R===void 0||R.call(e,u))};return ea({tabs:H(()=>e.tabs),prefixCls:o}),()=>{const{id:u,type:$,tabBarGutter:E,tabBarStyle:R,locale:K,destroyInactiveTabPane:re,renderTabBar:se=i.renderTabBar,onTabScroll:de,hideAdd:I,centered:J}=e,M={id:G.value,activeKey:x.value,animated:m.value,tabPosition:r.value,rtl:S.value,mobile:d.value};let V;$==="editable-card"&&(V={onEdit:(ve,be)=>{let{key:pe,event:$e}=be;var ce;(ce=e.onEdit)===null||ce===void 0||ce.call(e,ve==="add"?$e:pe,ve)},removeIcon:()=>h(Lt,null,null),addIcon:i.addIcon?i.addIcon:()=>h(Me,null,null),showAdd:I!==!0});let Y;const ue=T(T({},M),{moreTransitionName:`${s.value}-slide-up`,editable:V,locale:K,tabBarGutter:E,onTabClick:g,onTabScroll:de,style:R,getPopupContainer:v.value,popupClassName:ie(e.popupClassName,p.value)});se?Y=se(T(T({},ue),{DefaultTabBar:et})):Y=h(et,ue,rt(i,["moreIcon","leftExtra","rightExtra","tabBarExtraContent"]));const z=o.value;return c(h("div",te(te({},a),{},{id:u,class:ie(z,`${z}-${r.value}`,{[p.value]:!0,[`${z}-${n.value}`]:n.value,[`${z}-card`]:["card","editable-card"].includes($),[`${z}-editable-card`]:$==="editable-card",[`${z}-centered`]:J,[`${z}-mobile`]:d.value,[`${z}-editable`]:$==="editable-card",[`${z}-rtl`]:S.value},a.class)}),[Y,h(ia,te(te({destroyInactiveTabPane:re},M),{},{animated:m.value}),null)]))}}}),Se=le({compatConfig:{MODE:3},name:"ATabs",inheritAttrs:!1,props:lt(ut(),{tabPosition:"top",animated:{inkBar:!0,tabPane:!1}}),slots:Object,setup(e,t){let{attrs:a,slots:i,emit:o}=t;const l=n=>{o("update:activeKey",n),o("change",n)};return()=>{var n;const s=ma(Pt((n=i.default)===null||n===void 0?void 0:n.call(i)));return h(ga,te(te(te({},Rt(e,["onUpdate:activeKey"])),a),{},{onChange:l,tabs:s}),i)}}}),$a=()=>({tab:we.any,disabled:{type:Boolean},forceRender:{type:Boolean},closable:{type:Boolean},animated:{type:Boolean},active:{type:Boolean},destroyInactiveTabPane:{type:Boolean},prefixCls:{type:String},tabKey:{type:[String,Number]},id:{type:String}}),Oe=le({compatConfig:{MODE:3},name:"ATabPane",inheritAttrs:!1,__ANT_TAB_PANE:!0,props:$a(),slots:Object,setup(e,t){let{attrs:a,slots:i}=t;const o=Q(e.forceRender);oe([()=>e.active,()=>e.destroyInactiveTabPane],()=>{e.active?o.value=!0:e.destroyInactiveTabPane&&(o.value=!1)},{immediate:!0});const l=H(()=>e.active?{}:e.animated?{visibility:"hidden",height:0,overflowY:"hidden"}:{display:"none"});return()=>{var n;const{prefixCls:s,forceRender:v,id:c,active:p,tabKey:S}=e;return h("div",{id:c&&`${c}-panel-${S}`,role:"tabpanel",tabindex:p?0:-1,"aria-labelledby":c&&`${c}-tab-${S}`,"aria-hidden":!p,style:[l.value,a.style],class:[`${s}-tabpane`,p&&`${s}-tabpane-active`,a.class]},[(p||o.value||v)&&((n=i.default)===null||n===void 0?void 0:n.call(i))])}}});Se.TabPane=Oe;Se.install=function(e){return e.component(Se.name,Se),e.component(Oe.name,Oe),e};export{Se as T,Oe as _};
|