12 lines
42 KiB
JavaScript
12 lines
42 KiB
JavaScript
import{g as Lt,r as n,R as Nt,aw as tt,by as Ht,bz as Dt,bA as Bt,L as D,bB as At,ax as se,O as Gt,bC as Le,bD as Ot,a9 as Wt,aA as nt,aD as Xt,aZ as pt,bE as at,z as bt,G as gt,a3 as d,a_ as Ae,H as Ge,bF as ht,bG as He,J as Oe,bg as $t,al as Kt,ac as Ft,b0 as vt,K as We,W as Vt,aL as jt,bH as Xe,bI as Ut,bx as qt,N as Yt}from"./index-B-sDl1ER.js";var xe={exports:{}},ot;function Jt(){if(ot)return xe.exports;ot=1,xe.exports=o,xe.exports.isMobile=o,xe.exports.default=o;const e=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,t=/CrOS/,a=/android|ipad|playbook|silk/i;function o(r){r||(r={});let i=r.ua;if(!i&&typeof navigator<"u"&&(i=navigator.userAgent),i&&i.headers&&typeof i.headers["user-agent"]=="string"&&(i=i.headers["user-agent"]),typeof i!="string")return!1;let s=e.test(i)&&!t.test(i)||!!r.tablet&&a.test(i);return!s&&r.tablet&&r.featureDetect&&navigator&&navigator.maxTouchPoints>1&&i.indexOf("Macintosh")!==-1&&i.indexOf("Safari")!==-1&&(s=!0),s}return xe.exports}var Zt=Jt();const Qt=Lt(Zt);let Ne;const kt=(()=>(typeof Ne>"u"&&(Ne=Qt()),Ne)),Ke=n.createContext(null),en=e=>{const{activeTabOffset:t,horizontal:a,rtl:o,indicator:r={}}=e,{size:i,align:s="center"}=r,[c,u]=n.useState(),l=n.useRef(),v=Nt.useCallback(p=>typeof i=="function"?i(p):typeof i=="number"?i:p,[i]);function R(){tt.cancel(l.current)}return n.useEffect(()=>{const p={};if(t)if(a){p.width=v(t.width);const E=o?"right":"left";s==="start"&&(p[E]=t[E]),s==="center"&&(p[E]=t[E]+t.width/2,p.transform=o?"translateX(50%)":"translateX(-50%)"),s==="end"&&(p[E]=t[E]+t.width,p.transform="translateX(-100%)")}else p.height=v(t.height),s==="start"&&(p.top=t.top),s==="center"&&(p.top=t.top+t.height/2,p.transform="translateY(-50%)"),s==="end"&&(p.top=t.top+t.height,p.transform="translateY(-100%)");return R(),l.current=tt(()=>{c&&p&&Object.keys(p).every(P=>{const x=p[P],C=c[P];return typeof x=="number"&&typeof C=="number"?Math.round(x)===Math.round(C):x===C})||u(p)}),R},[JSON.stringify(t),a,o,s,v]),{style:c}},rt={width:0,height:0,left:0,top:0};function tn(e,t,a){return n.useMemo(()=>{const o=new Map,r=t.get(e[0]?.key)||rt,i=r.left+r.width;for(let s=0;s<e.length;s+=1){const{key:c}=e[s];let u=t.get(c);u||(u=t.get(e[s-1]?.key)||rt);const l=o.get(c)||{...u};l.right=i-l.left-l.width,o.set(c,l)}return o},[e.map(o=>o.key).join("_"),t,a])}function it(e,t){const a=n.useRef(e),[,o]=n.useState({});function r(i){const s=typeof i=="function"?i(a.current):i;s!==a.current&&t(s,a.current),a.current=s,o({})}return[a.current,r]}const nn=.1,st=.01,Pe=20,lt=.995**Pe;function an(e,t){const[a,o]=n.useState(),[r,i]=n.useState(0),[s,c]=n.useState(0),[u,l]=n.useState(),v=n.useRef();function R(y){const{screenX:f,screenY:m}=y.touches[0];o({x:f,y:m}),window.clearInterval(v.current)}function p(y){if(!a)return;const{screenX:f,screenY:m}=y.touches[0];o({x:f,y:m});const h=f-a.x,S=m-a.y;t(h,S);const B=Date.now();i(B),c(B-r),l({x:h,y:S})}function E(){if(a&&(o(null),l(null),u)){const y=u.x/s,f=u.y/s,m=Math.abs(y),h=Math.abs(f);if(Math.max(m,h)<nn)return;let S=y,B=f;v.current=window.setInterval(()=>{if(Math.abs(S)<st&&Math.abs(B)<st){window.clearInterval(v.current);return}S*=lt,B*=lt,t(S*Pe,B*Pe)},Pe)}}const P=n.useRef();function x(y){const{deltaX:f,deltaY:m}=y;let h=0;const S=Math.abs(f),B=Math.abs(m);S===B?h=P.current==="x"?f:m:S>B?(h=f,P.current="x"):(h=m,P.current="y"),t(-h,-h)&&y.preventDefault()}const C=n.useRef(null);C.current={onTouchStart:R,onTouchMove:p,onTouchEnd:E,onWheel:x},n.useEffect(()=>{function y(S){C.current.onTouchStart(S)}function f(S){C.current.onTouchMove(S)}function m(S){C.current.onTouchEnd(S)}function h(S){C.current.onWheel(S)}return document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",m,{passive:!0}),e.current.addEventListener("touchstart",y,{passive:!0}),e.current.addEventListener("wheel",h,{passive:!1}),()=>{document.removeEventListener("touchmove",f),document.removeEventListener("touchend",m)}},[])}function yt(e){const[t,a]=n.useState(0),o=n.useRef(0),r=n.useRef();return r.current=e,Ht(()=>{r.current?.()},[t]),()=>{o.current===t&&(o.current+=1,a(o.current))}}function on(e){const t=n.useRef([]),[,a]=n.useState({}),o=n.useRef(typeof e=="function"?e():e),r=yt(()=>{let s=o.current;t.current.forEach(c=>{s=c(s)}),t.current=[],o.current=s,a({})});function i(s){t.current.push(s),r()}return[o.current,i]}const ct={width:0,height:0,left:0,top:0,right:0};function rn(e,t,a,o,r,i,{tabs:s,tabPosition:c,rtl:u}){let l,v,R;return["top","bottom"].includes(c)?(l="width",v=u?"right":"left",R=Math.abs(a)):(l="height",v="top",R=-a),n.useMemo(()=>{if(!s.length)return[0,0];const p=s.length;let E=p;for(let x=0;x<p;x+=1){const C=e.get(s[x].key)||ct;if(Math.floor(C[v]+C[l])>Math.floor(R+t)){E=x-1;break}}let P=0;for(let x=p-1;x>=0;x-=1)if((e.get(s[x].key)||ct)[v]<R){P=x+1;break}return P>E?[0,-1]:[P,E]},[e,t,o,r,i,R,c,s.map(p=>p.key).join("_"),u])}function dt(e){let t;return e instanceof Map?(t={},e.forEach((a,o)=>{t[o]=a})):t=e,JSON.stringify(t)}const sn="TABS_DQ";function St(e){return String(e).replace(/"/g,sn)}function Fe(e,t,a,o){return!(!a||o||e===!1||e===void 0&&(t===!1||t===null))}const xt=n.forwardRef((e,t)=>{const{prefixCls:a,editable:o,locale:r,style:i}=e;return!o||o.showAdd===!1?null:n.createElement("button",{ref:t,type:"button",className:`${a}-nav-add`,style:i,"aria-label":r?.addAriaLabel||"Add tab",onClick:s=>{o.onEdit("add",{event:s})}},o.addIcon||"+")}),ut=n.forwardRef((e,t)=>{const{position:a,prefixCls:o,extra:r}=e;if(!r)return null;let i,s={};return typeof r=="object"&&!n.isValidElement(r)?s=r:s.right=r,a==="right"&&(i=s.right),a==="left"&&(i=s.left),i?n.createElement("div",{className:`${o}-extra-content`,ref:t},i):null});function De(){return De=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e},De.apply(this,arguments)}const ln=n.forwardRef((e,t)=>{const{prefixCls:a,id:o,tabs:r,locale:i,mobile:s,more:c={},style:u,className:l,editable:v,tabBarGutter:R,rtl:p,removeAriaLabel:E,onTabClick:P,getPopupContainer:x,popupClassName:C,popupStyle:y}=e,[f,m]=n.useState(!1),[h,S]=n.useState(null),{icon:B="More"}=c,K=`${o}-more-popup`,M=`${a}-dropdown`,A=h!==null?`${K}-${h}`:null,X=i?.dropdownAriaLabel;function j(T,I){T.preventDefault(),T.stopPropagation(),v.onEdit("remove",{key:I,event:T})}const $=n.createElement(Dt,{onClick:({key:T,domEvent:I})=>{P(T,I),m(!1)},prefixCls:`${M}-menu`,id:K,tabIndex:-1,role:"listbox","aria-activedescendant":A,selectedKeys:[h],"aria-label":X!==void 0?X:"expanded dropdown"},r.map(T=>{const{closable:I,disabled:z,closeIcon:G,key:O,label:J}=T,L=Fe(I,G,v,z);return n.createElement(Bt,{key:O,id:`${K}-${O}`,role:"option","aria-controls":o&&`${o}-panel-${O}`,disabled:z},n.createElement("span",null,J),L&&n.createElement("button",{type:"button","aria-label":E||"remove",tabIndex:0,className:`${M}-menu-item-remove`,onClick:k=>{k.stopPropagation(),j(k,O)}},G||v.removeIcon||"×"))}));function H(T){const I=r.filter(O=>!O.disabled);let z=I.findIndex(O=>O.key===h)||0;const G=I.length;for(let O=0;O<G;O+=1){z=(z+T+G)%G;const J=I[z];if(!J.disabled){S(J.key);return}}}function U(T){const{which:I}=T;if(!f){[se.DOWN,se.SPACE,se.ENTER].includes(I)&&(m(!0),T.preventDefault());return}switch(I){case se.UP:H(-1),T.preventDefault();break;case se.DOWN:H(1),T.preventDefault();break;case se.ESC:m(!1);break;case se.SPACE:case se.ENTER:h!==null&&P(h,T);break}}n.useEffect(()=>{const T=document.getElementById(A);T?.scrollIntoView&&T.scrollIntoView(!1)},[A,h]),n.useEffect(()=>{f||S(null)},[f]);const _={marginInlineStart:R};r.length||(_.visibility="hidden",_.order=1);const Q=D(C,{[`${M}-rtl`]:p}),q=s?null:n.createElement(At,De({prefixCls:M,overlay:$,visible:r.length?f:!1,onVisibleChange:m,overlayClassName:Q,overlayStyle:y,mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:x},c),n.createElement("button",{type:"button",className:`${a}-nav-more`,style:_,"aria-haspopup":"listbox","aria-controls":K,id:`${o}-more`,"aria-expanded":f,onKeyDown:U},B));return n.createElement("div",{className:D(`${a}-nav-operations`,l),style:u,ref:t},q,n.createElement(xt,{prefixCls:a,locale:i,editable:v}))}),cn=n.memo(ln,(e,t)=>t.tabMoving),dn=e=>{const{prefixCls:t,id:a,active:o,focus:r,tab:{key:i,label:s,disabled:c,closeIcon:u,icon:l},closable:v,renderWrapper:R,removeAriaLabel:p,editable:E,onClick:P,onFocus:x,onBlur:C,onKeyDown:y,onMouseDown:f,onMouseUp:m,style:h,className:S,tabCount:B,currentPosition:K}=e,M=`${t}-tab`,A=Fe(v,u,E,c);function X(_){c||P(_)}function j(_){_.preventDefault(),_.stopPropagation(),E.onEdit("remove",{key:i,event:_})}const $=n.useMemo(()=>l&&typeof s=="string"?n.createElement("span",null,s):s,[s,l]),H=n.useRef(null);n.useEffect(()=>{r&&H.current&&H.current.focus()},[r]);const U=n.createElement("div",{key:i,"data-node-key":St(i),className:D(M,S,{[`${M}-with-remove`]:A,[`${M}-active`]:o,[`${M}-disabled`]:c,[`${M}-focus`]:r}),style:h,onClick:X},n.createElement("div",{ref:H,role:"tab","aria-selected":o,id:a&&`${a}-tab-${i}`,className:`${M}-btn`,"aria-controls":a&&`${a}-panel-${i}`,"aria-disabled":c,tabIndex:c?null:o?0:-1,onClick:_=>{_.stopPropagation(),X(_)},onKeyDown:y,onMouseDown:f,onMouseUp:m,onFocus:x,onBlur:C},r&&n.createElement("div",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},`Tab ${K} of ${B}`),l&&n.createElement("span",{className:`${M}-icon`},l),s&&$),A&&n.createElement("button",{type:"button","aria-label":p||"remove",tabIndex:o?0:-1,className:`${M}-remove`,onClick:_=>{_.stopPropagation(),j(_)}},u||E.removeIcon||"×"));return R?R(U):U};function Be(){return Be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e},Be.apply(this,arguments)}const un=(e,t)=>{const{offsetWidth:a,offsetHeight:o,offsetTop:r,offsetLeft:i}=e,{width:s,height:c,left:u,top:l}=e.getBoundingClientRect();return Math.abs(s-a)<1?[s,c,u-t.left,l-t.top]:[a,o,i,r]},ge=e=>{const{offsetWidth:t=0,offsetHeight:a=0}=e.current||{};if(e.current){const{width:o,height:r}=e.current.getBoundingClientRect();if(Math.abs(o-t)<1)return[o,r]}return[t,a]},Te=(e,t)=>e[t?0:1],ft=n.forwardRef((e,t)=>{const{className:a,style:o,id:r,animated:i,activeKey:s,rtl:c,extra:u,editable:l,locale:v,tabPosition:R,tabBarGutter:p,children:E,onTabClick:P,onTabScroll:x,indicator:C,classNames:y,styles:f}=e,{prefixCls:m,tabs:h}=n.useContext(Ke),S=n.useRef(null),B=n.useRef(null),K=n.useRef(null),M=n.useRef(null),A=n.useRef(null),X=n.useRef(null),j=n.useRef(null),$=R==="top"||R==="bottom",[H,U]=it(0,(b,g)=>{$&&x&&x({direction:b>g?"left":"right"})}),[_,Q]=it(0,(b,g)=>{!$&&x&&x({direction:b>g?"top":"bottom"})}),[q,T]=n.useState([0,0]),[I,z]=n.useState([0,0]),[G,O]=n.useState([0,0]),[J,L]=n.useState([0,0]),[k,le]=on(new Map),N=tn(h,k,I[0]),Z=Te(q,$),ee=Te(I,$),ae=Te(G,$),ce=Te(J,$),de=Math.floor(Z)<Math.floor(ee+ae),F=de?Z-ce:Z-ae,fe=`${m}-nav-operations-hidden`;let V=0,Y=0;$&&c?(V=0,Y=Math.max(0,ee-F)):(V=Math.min(0,F-ee),Y=0);function ue(b){return b<V?V:b>Y?Y:b}const he=n.useRef(null),[me,we]=n.useState();function $e(){we(Date.now())}function ve(){he.current&&clearTimeout(he.current)}an(M,(b,g)=>{function w(W,te){W(ie=>ue(ie+te))}return de?($?w(U,b):w(Q,g),ve(),$e(),!0):!1}),n.useEffect(()=>(ve(),me&&(he.current=setTimeout(()=>{we(0)},100)),ve),[me]);const[oe,re]=rn(N,F,$?H:_,ee,ae,ce,{...e,tabs:h}),Ee=Gt((b=s)=>{const g=N.get(b)||{width:0,height:0,left:0,right:0,top:0};if($){let w=H;c?g.right<H?w=g.right:g.right+g.width>H+F&&(w=g.right+g.width-F):g.left<-H?w=-g.left:g.left+g.width>-H+F&&(w=-(g.left+g.width-F)),Q(0),U(ue(w))}else{let w=_;g.top<-_?w=-g.top:g.top+g.height>-_+F&&(w=-(g.top+g.height-F)),U(0),Q(ue(w))}}),[pe,ye]=n.useState(),[Rt,Ve]=n.useState(!1),ne=h.filter(b=>!b.disabled).map(b=>b.key),be=b=>{const g=ne.indexOf(pe||s),w=ne.length,W=(g+b+w)%w,te=ne[W];ye(te)},je=(b,g)=>{const w=ne.indexOf(b),W=h.find(ie=>ie.key===b);Fe(W?.closable,W?.closeIcon,l,W?.disabled)&&(g.preventDefault(),g.stopPropagation(),l.onEdit("remove",{key:b,event:g}),w===ne.length-1?be(-1):be(1))},_t=(b,g)=>{Ve(!0),g.button===1&&je(b,g)},Tt=b=>{const{code:g}=b,w=c&&$,W=ne[0],te=ne[ne.length-1];switch(g){case"ArrowLeft":{$&&be(w?1:-1);break}case"ArrowRight":{$&&be(w?-1:1);break}case"ArrowUp":{b.preventDefault(),$||be(-1);break}case"ArrowDown":{b.preventDefault(),$||be(1);break}case"Home":{b.preventDefault(),ye(W);break}case"End":{b.preventDefault(),ye(te);break}case"Enter":case"Space":{b.preventDefault(),P(pe??s,b);break}case"Backspace":case"Delete":{je(pe,b);break}}},Re={};$?Re.marginInlineStart=p:Re.marginTop=p;const Ue=h.map((b,g)=>{const{key:w}=b;return n.createElement(dn,{id:r,prefixCls:m,key:w,tab:b,className:y?.item,style:g===0?f?.item:{...Re,...f?.item},closable:b.closable,editable:l,active:w===s,focus:w===pe,renderWrapper:E,removeAriaLabel:v?.removeAriaLabel,tabCount:ne.length,currentPosition:g+1,onClick:W=>{P(w,W)},onKeyDown:Tt,onFocus:()=>{Rt||ye(w),Ee(w),$e(),M.current&&(c||(M.current.scrollLeft=0),M.current.scrollTop=0)},onBlur:()=>{ye(void 0)},onMouseDown:W=>_t(w,W),onMouseUp:()=>{Ve(!1)}})}),qe=()=>le(()=>{const b=new Map,g=A.current?.getBoundingClientRect();return h.forEach(({key:w})=>{const W=A.current?.querySelector(`[data-node-key="${St(w)}"]`);if(W){const[te,ie,et,zt]=un(W,g);b.set(w,{width:te,height:ie,left:et,top:zt})}}),b});n.useEffect(()=>{qe()},[h.map(b=>b.key).join("_")]);const _e=yt(()=>{const b=ge(S),g=ge(B),w=ge(K);T([b[0]-g[0]-w[0],b[1]-g[1]-w[1]]);const W=ge(j);O(W);const te=ge(X);L(te);const ie=ge(A);z([ie[0]-W[0],ie[1]-W[1]]),qe()}),Pt=h.slice(0,oe),Mt=h.slice(re+1),Ye=[...Pt,...Mt],Je=N.get(s),{style:It}=en({activeTabOffset:Je,horizontal:$,indicator:C,rtl:c});n.useEffect(()=>{Ee()},[s,V,Y,dt(Je),dt(N),$]),n.useEffect(()=>{_e()},[c]);const Ze=!!Ye.length,Se=`${m}-nav-wrap`;let Ie,ze,Qe,ke;return $?c?(ze=H>0,Ie=H!==Y):(Ie=H<0,ze=H!==V):(Qe=_<0,ke=_!==V),n.createElement(Le,{onResize:_e},n.createElement("div",{ref:Ot(t,S),role:"tablist","aria-orientation":$?"horizontal":"vertical",className:D(`${m}-nav`,a,y?.header),style:{...f?.header,...o},onKeyDown:()=>{$e()}},n.createElement(ut,{ref:B,position:"left",extra:u,prefixCls:m}),n.createElement(Le,{onResize:_e},n.createElement("div",{className:D(Se,{[`${Se}-ping-left`]:Ie,[`${Se}-ping-right`]:ze,[`${Se}-ping-top`]:Qe,[`${Se}-ping-bottom`]:ke}),ref:M},n.createElement(Le,{onResize:_e},n.createElement("div",{ref:A,className:`${m}-nav-list`,style:{transform:`translate(${H}px, ${_}px)`,transition:me?"none":void 0}},Ue,n.createElement(xt,{ref:j,prefixCls:m,locale:v,editable:l,style:{...Ue.length===0?void 0:Re,visibility:Ze?"hidden":null}}),n.createElement("div",{className:D(`${m}-ink-bar`,y?.indicator,{[`${m}-ink-bar-animated`]:i.inkBar}),style:{...It,...f?.indicator}}))))),n.createElement(cn,Be({},e,{removeAriaLabel:v?.removeAriaLabel,ref:X,prefixCls:m,tabs:Ye,className:!Ze&&fe,popupStyle:f?.popup,tabMoving:!!me})),n.createElement(ut,{ref:K,position:"right",extra:u,prefixCls:m})))}),fn=({renderTabBar:e,...t})=>e?e(t,ft):n.createElement(ft,t),mn=n.forwardRef((e,t)=>{const{prefixCls:a,className:o,style:r,id:i,active:s,tabKey:c,children:u}=e,l=n.Children.count(u)>0;return n.createElement("div",{id:i&&`${i}-panel-${c}`,role:"tabpanel",tabIndex:s&&l?0:-1,"aria-labelledby":i&&`${i}-tab-${c}`,"aria-hidden":!s,style:r,className:D(a,s&&`${a}-active`,o),ref:t},u)});function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e},Me.apply(this,arguments)}const pn=e=>{const{id:t,activeKey:a,animated:o,tabPosition:r,destroyOnHidden:i,contentStyle:s,contentClassName:c}=e,{prefixCls:u,tabs:l}=n.useContext(Ke),v=o.tabPane,R=`${u}-tabpane`;return n.createElement("div",{className:D(`${u}-content-holder`)},n.createElement("div",{className:D(`${u}-content`,`${u}-content-${r}`,{[`${u}-content-animated`]:v})},l.map(p=>{const{key:E,forceRender:P,style:x,className:C,destroyOnHidden:y,...f}=p,m=E===a;return n.createElement(Wt,Me({key:E,visible:m,forceRender:P,removeOnLeave:!!(i??y),leavedClassName:`${R}-hidden`},o.tabPaneMotion),({style:h,className:S},B)=>n.createElement(mn,Me({},f,{prefixCls:R,id:t,tabKey:E,animated:v,active:m,style:{...s,...x,...h},className:D(c,C,S),ref:B})))})))};function bn(e={inkBar:!0,tabPane:!1}){let t;return e===!1?t={inkBar:!1,tabPane:!1}:e===!0?t={inkBar:!0,tabPane:!1}:t={inkBar:!0,...typeof e=="object"?e:{}},t.tabPaneMotion&&t.tabPane===void 0&&(t.tabPane=!0),!t.tabPaneMotion&&t.tabPane&&(t.tabPane=!1),t}function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e},Ce.apply(this,arguments)}let mt=0;const gn=n.forwardRef((e,t)=>{const{id:a,prefixCls:o="rc-tabs",className:r,items:i,direction:s,activeKey:c,defaultActiveKey:u,editable:l,animated:v,tabPosition:R="top",tabBarGutter:p,tabBarStyle:E,tabBarExtraContent:P,locale:x,more:C,destroyOnHidden:y,renderTabBar:f,onChange:m,onTabClick:h,onTabScroll:S,getPopupContainer:B,popupClassName:K,indicator:M,classNames:A,styles:X,...j}=e,$=n.useMemo(()=>(i||[]).filter(N=>N&&typeof N=="object"&&"key"in N),[i]),H=s==="rtl",U=bn(v),[_,Q]=n.useState(!1);n.useEffect(()=>{Q(kt())},[]);const[q,T]=nt(u??$[0]?.key,c),[I,z]=n.useState(()=>$.findIndex(N=>N.key===q));n.useEffect(()=>{let N=$.findIndex(Z=>Z.key===q);N===-1&&(N=Math.max(0,Math.min(I,$.length-1)),T($[N]?.key)),z(N)},[$.map(N=>N.key).join("_"),q,I]);const[G,O]=nt(null,a);n.useEffect(()=>{a||(O(`rc-tabs-${mt}`),mt+=1)},[]);function J(N,Z){h?.(N,Z);const ee=N!==q;T(N),ee&&m?.(N)}const L={id:G,activeKey:q,animated:U,tabPosition:R,rtl:H,mobile:_},k={...L,editable:l,locale:x,more:C,tabBarGutter:p,onTabClick:J,onTabScroll:S,extra:P,style:E,getPopupContainer:B,popupClassName:D(K,A?.popup),indicator:M,styles:X,classNames:A},le=n.useMemo(()=>({tabs:$,prefixCls:o}),[$,o]);return n.createElement(Ke.Provider,{value:le},n.createElement("div",Ce({ref:t,id:a,className:D(o,`${o}-${R}`,{[`${o}-mobile`]:_,[`${o}-editable`]:l,[`${o}-rtl`]:H},r)},j),n.createElement(fn,Ce({},k,{renderTabBar:f})),n.createElement(pn,Ce({destroyOnHidden:y},L,{contentStyle:X?.content,contentClassName:A?.content,animated:U}))))}),hn={motionAppear:!1,motionEnter:!0,motionLeave:!0};function $n(e,t={inkBar:!0,tabPane:!1}){let a;return t===!1?a={inkBar:!1,tabPane:!1}:t===!0?a={inkBar:!0,tabPane:!0}:a={inkBar:!0,...typeof t=="object"?t:{}},a.tabPane&&(a.tabPaneMotion={...hn,motionName:Xt(e,"switch")}),a}function vn(e){return e.filter(t=>t)}function yn(e,t){if(e)return e.map(o=>({...o,destroyOnHidden:o.destroyOnHidden??o.destroyInactiveTabPane}));const a=pt(t).map(o=>{if(n.isValidElement(o)){const{key:r,props:i}=o,{tab:s,...c}=i||{};return{key:String(r),...c,label:s}}return null});return vn(a)}const Sn=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}`}}}}},[at(e,"slide-up"),at(e,"slide-down")]]},xn=e=>{const{componentCls:t,tabsCardPadding:a,cardBg:o,cardGutter:r,colorBorderSecondary:i,itemSelectedColor:s}=e;return{[`${t}-card`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{margin:0,padding:a,background:o,border:`${d(e.lineWidth)} ${e.lineType} ${i}`,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOut}`},[`${t}-tab-active`]:{color:s,background:e.colorBgContainer},[`${t}-tab-focus:has(${t}-tab-btn:focus-visible)`]:ht(e,-3),[`& ${t}-tab${t}-tab-focus ${t}-tab-btn:focus-visible`]:{outline:"none"},[`${t}-ink-bar`]:{visibility:"hidden"}},[`&${t}-top, &${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginLeft:{_skip_check_:!0,value:d(r)}}}},[`&${t}-top`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:`${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)} 0 0`},[`${t}-tab-active`]:{borderBottomColor:e.colorBgContainer}}},[`&${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:`0 0 ${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)}`},[`${t}-tab-active`]:{borderTopColor:e.colorBgContainer}}},[`&${t}-left, &${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginTop:d(r)}}},[`&${t}-left`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`${d(e.borderRadiusLG)} 0 0 ${d(e.borderRadiusLG)}`}},[`${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 ${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)} 0`}},[`${t}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:e.colorBgContainer}}}}}}},Cn=e=>{const{componentCls:t,itemHoverColor:a,dropdownEdgeChildVerticalPadding:o}=e;return{[`${t}-dropdown`]:{...Ge(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:`${d(o)} 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":{...Ae,display:"flex",alignItems:"center",minWidth:e.tabsDropdownWidth,margin:0,padding:`${d(e.paddingXXS)} ${d(e.paddingSM)}`,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.colorIcon,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"}}}}}}},wn=e=>{const{componentCls:t,margin:a,colorBorderSecondary:o,horizontalMargin:r,verticalItemPadding:i,verticalItemMargin:s,motionDurationSlow:c,calc:u}=e;return{[`${t}-top, ${t}-bottom`]:{flexDirection:"column",[`> ${t}-nav, > div > ${t}-nav`]:{margin:r,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${d(e.lineWidth)} ${e.lineType} ${o}`,content:"''"},[`${t}-ink-bar`]:{height:e.lineWidthBold,"&-animated":{transition:["width","left","right"].map(l=>`${l} ${c}`).join(", ")}},[`${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,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:u(e.controlHeight).mul(1.25).equal(),[`${t}-tab`]:{padding:i,textAlign:"center"},[`${t}-tab + ${t}-tab`]:{margin:s},[`${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","top"].map(l=>`${l} ${c}`).join(", ")}},[`${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:d(u(e.lineWidth).mul(-1).equal())},borderLeft:{_skip_check_:!0,value:`${d(e.lineWidth)} ${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:u(e.lineWidth).mul(-1).equal()},borderRight:{_skip_check_:!0,value:`${d(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},[`> ${t}-content > ${t}-tabpane`]:{paddingRight:{_skip_check_:!0,value:e.paddingLG}}}}}},En=e=>{const{componentCls:t,cardPaddingSM:a,cardPaddingLG:o,cardHeightSM:r,cardHeightLG:i,horizontalItemPaddingSM:s,horizontalItemPaddingLG:c}=e;return{[t]:{"&-small":{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:s,fontSize:e.titleFontSizeSM}}},"&-large":{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:c,fontSize:e.titleFontSizeLG,lineHeight:e.lineHeightLG}}}},[`${t}-card`]:{[`&${t}-small`]:{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:a},[`${t}-nav-add`]:{minWidth:r,minHeight:r}},[`&${t}-bottom`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:`0 0 ${d(e.borderRadius)} ${d(e.borderRadius)}`}},[`&${t}-top`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:`${d(e.borderRadius)} ${d(e.borderRadius)} 0 0`}},[`&${t}-right`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${d(e.borderRadius)} ${d(e.borderRadius)} 0`}}},[`&${t}-left`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`${d(e.borderRadius)} 0 0 ${d(e.borderRadius)}`}}}},[`&${t}-large`]:{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:o},[`${t}-nav-add`]:{minWidth:i,minHeight:i}}}}}},Rn=e=>{const{componentCls:t,itemActiveColor:a,itemHoverColor:o,iconCls:r,tabsHorizontalItemMargin:i,horizontalItemPadding:s,itemSelectedColor:c,itemColor:u}=e,l=`${t}-tab`;return{[l]:{position:"relative",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",display:"inline-flex",alignItems:"center",padding:s,fontSize:e.titleFontSize,background:"transparent",border:0,outline:"none",cursor:"pointer",color:u,"&-btn, &-remove":{"&:focus:not(:focus-visible), &:active":{color:a}},"&-btn":{outline:"none",transition:`all ${e.motionDurationSlow}`,[`${l}-icon:not(:last-child)`]:{marginInlineEnd:e.marginSM}},"&-remove":{flex:"none",lineHeight:1,marginRight:{_skip_check_:!0,value:e.calc(e.marginXXS).mul(-1).equal()},marginLeft:{_skip_check_:!0,value:e.marginXS},color:e.colorIcon,fontSize:e.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${e.motionDurationSlow}`,"&:hover":{color:e.colorTextHeading},...He(e)},"&:hover":{color:o},[`&${l}-active ${l}-btn`]:{color:c},[`&${l}-focus ${l}-btn:focus-visible`]:ht(e),[`&${l}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed"},[`&${l}-disabled ${l}-btn, &${l}-disabled ${t}-remove`]:{"&:focus, &:active":{color:e.colorTextDisabled}},[`& ${l}-remove ${r}`]:{margin:0,verticalAlign:"middle"},[`${r}:not(:last-child)`]:{marginRight:{_skip_check_:!0,value:e.marginSM}}},[`${l} + ${l}`]:{margin:{_skip_check_:!0,value:i}}}},_n=e=>{const{componentCls:t,tabsHorizontalItemMarginRTL:a,iconCls:o,cardGutter:r,calc:i}=e;return{[`${t}-rtl`]:{direction:"rtl",[`${t}-nav`]:{[`${t}-tab`]:{margin:{_skip_check_:!0,value:a},[`${t}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[o]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:e.marginSM}},[`${t}-tab-remove`]:{marginRight:{_skip_check_:!0,value:e.marginXS},marginLeft:{_skip_check_:!0,value:i(e.marginXXS).mul(-1).equal()},[o]:{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:r},marginLeft:{_skip_check_:!0,value:0}}}}},[`${t}-dropdown-rtl`]:{direction:"rtl"},[`${t}-menu-item`]:{[`${t}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},Tn=e=>{const{componentCls:t,tabsCardPadding:a,cardHeight:o,cardGutter:r,itemHoverColor:i,itemActiveColor:s,colorBorderSecondary:c}=e;return{[t]:{...Ge(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,color:e.colorText,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:e.calc(e.controlHeightLG).div(8).equal(),transform:"translateY(100%)",content:"''"}},[`${t}-nav-add`]:{minWidth:o,minHeight:o,marginLeft:{_skip_check_:!0,value:r},background:"transparent",border:`${d(e.lineWidth)} ${e.lineType} ${c}`,borderRadius:`${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)} 0 0`,outline:"none",cursor:"pointer",color:e.colorText,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOut}`,"&:hover":{color:i},"&:active, &:focus:not(:focus-visible)":{color:s},...He(e,-3)}},[`${t}-extra-content`]:{flex:"none"},[`${t}-ink-bar`]:{position:"absolute",background:e.inkBarColor,pointerEvents:"none"},...Rn(e),[`${t}-content`]:{position:"relative",width:"100%"},[`${t}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${t}-tabpane`]:{...He(e),"&-hidden":{display:"none"}}},[`${t}-centered`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-nav-wrap`]:{[`&:not([class*='${t}-nav-wrap-ping']) > ${t}-nav-list`]:{margin:"auto"}}}}}},Pn=e=>{const{cardHeight:t,cardHeightSM:a,cardHeightLG:o,controlHeight:r,controlHeightLG:i}=e,s=t||i,c=a||r,u=o||i+8;return{zIndexPopup:e.zIndexPopupBase+50,cardBg:e.colorFillAlter,cardHeight:s,cardHeightSM:c,cardHeightLG:u,cardPadding:`${(s-e.fontHeight)/2-e.lineWidth}px ${e.padding}px`,cardPaddingSM:`${(c-e.fontHeight)/2-e.lineWidth}px ${e.paddingXS}px`,cardPaddingLG:`${(u-e.fontHeightLG)/2-e.lineWidth}px ${e.padding}px`,titleFontSize:e.fontSize,titleFontSizeLG:e.fontSizeLG,titleFontSizeSM:e.fontSize,inkBarColor:e.colorPrimary,horizontalMargin:`0 0 ${e.margin}px 0`,horizontalItemGutter:32,horizontalItemMargin:"",horizontalItemMarginRTL:"",horizontalItemPadding:`${e.paddingSM}px 0`,horizontalItemPaddingSM:`${e.paddingXS}px 0`,horizontalItemPaddingLG:`${e.padding}px 0`,verticalItemPadding:`${e.paddingXS}px ${e.paddingLG}px`,verticalItemMargin:`${e.margin}px 0 0 0`,itemColor:e.colorText,itemSelectedColor:e.colorPrimary,itemHoverColor:e.colorPrimaryHover,itemActiveColor:e.colorPrimaryActive,cardGutter:e.marginXXS/2}},Mn=bt("Tabs",e=>{const t=gt(e,{tabsCardPadding:e.cardPadding,dropdownEdgeChildVerticalPadding:e.paddingXXS,tabsDropdownHeight:200,tabsDropdownWidth:120,tabsHorizontalItemMargin:`0 0 0 ${d(e.horizontalItemGutter)}`,tabsHorizontalItemMarginRTL:`0 0 0 ${d(e.horizontalItemGutter)}`});return[En(t),_n(t),wn(t),Cn(t),xn(t),Tn(t),Sn(t)]},Pn),In=()=>null,zn=n.forwardRef((e,t)=>{const{type:a,className:o,rootClassName:r,size:i,onEdit:s,hideAdd:c,centered:u,addIcon:l,removeIcon:v,moreIcon:R,more:p,popupClassName:E,children:P,items:x,animated:C,style:y,indicatorSize:f,indicator:m,classNames:h,styles:S,destroyInactiveTabPane:B,destroyOnHidden:K,tabPlacement:M,tabPosition:A,...X}=e,{prefixCls:j}=X,{getPrefixCls:$,direction:H,getPopupContainer:U,className:_,style:Q,classNames:q,styles:T}=Oe("tabs"),{tabs:I}=n.useContext($t),z=$("tabs",j),G=jt(z),[O,J]=Mn(z,G),L=n.useRef(null);n.useImperativeHandle(t,()=>({nativeElement:L.current}));let k;a==="editable-card"&&(k={onEdit:(V,{key:Y,event:ue})=>{s?.(V==="add"?ue:Y,V)},removeIcon:v??I?.removeIcon??n.createElement(Ft,null),addIcon:(l??I?.addIcon)||n.createElement(Kt,null),showAdd:c!==!0});const le=$(),N=vt(i),Z=yn(x,P),ee=$n(z,C),ae={align:m?.align??I?.indicator?.align,size:m?.size??f??I?.indicator?.size??I?.indicatorSize},ce=n.useMemo(()=>{const V=M??A??void 0,Y=H==="rtl";switch(V){case"start":return Y?"right":"left";case"end":return Y?"left":"right";default:return V}},[M,A,H]),de={...e,size:N,tabPlacement:ce,items:Z},[F,fe]=We([q,h],[T,S],{props:de},{popup:{_default:"root"}});return n.createElement(gn,{ref:L,direction:H,getPopupContainer:U,...X,items:Z,className:D({[`${z}-large`]:N==="large",[`${z}-small`]:N==="small",[`${z}-card`]:["card","editable-card"].includes(a),[`${z}-editable-card`]:a==="editable-card",[`${z}-centered`]:u},_,o,r,F.root,O,J,G),classNames:{...F,popup:D(E,O,J,G,F.popup?.root)},styles:fe,style:{...fe.root,...Q,...y},editable:k,more:{icon:I?.more?.icon??I?.moreIcon??R??n.createElement(Vt,null),transitionName:`${le}-slide-up`,...p},prefixCls:z,animated:ee,indicator:ae,destroyOnHidden:K??B,tabPosition:ce})}),Ct=zn;Ct.TabPane=In;const wt=({prefixCls:e,className:t,hoverable:a=!0,...o})=>{const{getPrefixCls:r}=n.useContext($t),i=r("card",e),s=D(`${i}-grid`,t,{[`${i}-grid-hoverable`]:a});return n.createElement("div",{...o,className:s})},Ln=e=>{const{antCls:t,componentCls:a,headerHeight:o,headerPadding:r,tabsMarginBottom:i}=e;return{display:"flex",justifyContent:"center",flexDirection:"column",minHeight:o,marginBottom:-1,padding:`0 ${d(r)}`,color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:`${d(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`,borderRadius:`${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)} 0 0`,...Xe(),"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":{display:"inline-block",flex:1,...Ae,[`
|
||
> ${a}-typography,
|
||
> ${a}-typography-edit-content
|
||
`]:{insetInlineStart:0,marginTop:0,marginBottom:0}},[`${t}-tabs-top`]:{clear:"both",marginBottom:i,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:`${d(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`}}}},Nn=e=>{const{cardPaddingBase:t,colorBorderSecondary:a,cardShadow:o,lineWidth:r}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:`
|
||
${d(r)} 0 0 0 ${a},
|
||
0 ${d(r)} 0 0 ${a},
|
||
${d(r)} ${d(r)} 0 0 ${a},
|
||
${d(r)} 0 0 0 ${a} inset,
|
||
0 ${d(r)} 0 0 ${a} inset;
|
||
`,transition:`all ${e.motionDurationMid}`,"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:o}}},Hn=e=>{const{componentCls:t,iconCls:a,actionsLiMargin:o,cardActionsIconSize:r,colorBorderSecondary:i,actionsBg:s}=e;return{margin:0,padding:0,listStyle:"none",background:s,borderTop:`${d(e.lineWidth)} ${e.lineType} ${i}`,display:"flex",borderRadius:`0 0 ${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)}`,...Xe(),"& > li":{margin:o,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:`color ${e.motionDurationMid}`},[`a:not(${t}-btn), > ${a}`]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:d(e.fontHeight),transition:`color ${e.motionDurationMid}`,"&:hover":{color:e.colorPrimary}},[`> ${a}`]:{fontSize:r,lineHeight:d(e.calc(r).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:`${d(e.lineWidth)} ${e.lineType} ${i}`}}}},Dn=e=>({margin:`${d(e.calc(e.marginXXS).mul(-1).equal())} 0`,display:"flex",...Xe(),"&-avatar":{paddingInlineEnd:e.padding},"&-section":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":{color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG,...Ae},"&-description":{color:e.colorTextDescription}}),Bn=e=>{const{componentCls:t,colorFillAlter:a,headerPadding:o,bodyPadding:r}=e;return{[`${t}-head`]:{padding:`0 ${d(o)}`,background:a,"&-title":{fontSize:e.fontSize}},[`${t}-body`]:{padding:`${d(e.padding)} ${d(r)}`}}},An=e=>{const{componentCls:t}=e;return{overflow:"hidden",[`${t}-body`]:{userSelect:"none"}}},Gn=e=>{const{componentCls:t,cardShadow:a,cardHeadPadding:o,colorBorderSecondary:r,boxShadowTertiary:i,bodyPadding:s,extraColor:c,motionDurationMid:u}=e;return{[t]:{...Ge(e),position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,[`&:not(${t}-bordered)`]:{boxShadow:i},[`${t}-head`]:Ln(e),[`${t}-extra`]:{marginInlineStart:"auto",color:c,fontWeight:"normal",fontSize:e.fontSize},[`${t}-body`]:{padding:s,borderRadius:`0 0 ${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)}`,"&:first-child":{borderStartStartRadius:e.borderRadiusLG,borderStartEndRadius:e.borderRadiusLG},"&:not(:last-child)":{borderEndStartRadius:0,borderEndEndRadius:0}},[`${t}-grid`]:Nn(e),[`${t}-cover`]:{"> *":{display:"block",width:"100%",borderRadius:`${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)} 0 0`}},[`${t}-actions`]:Hn(e),[`${t}-meta`]:Dn(e)},[`${t}-bordered`]:{border:`${d(e.lineWidth)} ${e.lineType} ${r}`,[`${t}-cover`]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},[`${t}-hoverable`]:{cursor:"pointer",transition:["box-shadow","border-color"].map(l=>`${l} ${u}`).join(", "),"&:hover":{borderColor:"transparent",boxShadow:a}},[`${t}-contain-grid`]:{borderRadius:`${d(e.borderRadiusLG)} ${d(e.borderRadiusLG)} 0 0 `,[`&:not(:has(> ${t}-head))`]:{borderRadius:0},[`${t}-body`]:{display:"flex",flexWrap:"wrap"},[`&:not(${t}-loading) ${t}-body`]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},[`${t}-contain-tabs`]:{[`> div${t}-head`]:{minHeight:0,[`${t}-head-title, ${t}-extra`]:{paddingTop:o}}},[`${t}-type-inner`]:Bn(e),[`${t}-loading`]:An(e),[`${t}-rtl`]:{direction:"rtl"}}},On=e=>{const{componentCls:t,bodyPaddingSM:a,headerPaddingSM:o,headerHeightSM:r,headerFontSizeSM:i}=e;return{[`${t}-small`]:{[`> ${t}-head`]:{minHeight:r,padding:`0 ${d(o)}`,fontSize:i,[`> ${t}-head-wrapper`]:{[`> ${t}-extra`]:{fontSize:e.fontSize}}},[`> ${t}-body`]:{padding:a}},[`${t}-small${t}-contain-tabs`]:{[`> ${t}-head`]:{[`${t}-head-title, ${t}-extra`]:{paddingTop:0,display:"flex",alignItems:"center"}}}}},Wn=e=>({headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+e.padding*2,headerHeightSM:e.fontSize*e.lineHeight+e.paddingXS*2,actionsBg:e.colorBgContainer,actionsLiMargin:`${e.paddingSM}px 0`,tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:e.bodyPadding??e.paddingLG,headerPadding:e.headerPadding??e.paddingLG}),Xn=bt("Card",e=>{const t=gt(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[Gn(t),On(t)]},Wn),Kn=e=>{const{actionClasses:t,actions:a=[],actionStyle:o}=e;return n.createElement("ul",{className:t,style:o},a.map((r,i)=>{const s=`action-${i}`;return n.createElement("li",{style:{width:`${100/a.length}%`},key:s},n.createElement("span",null,r))}))},Fn=n.forwardRef((e,t)=>{const{prefixCls:a,className:o,rootClassName:r,style:i,extra:s,headStyle:c={},bodyStyle:u={},title:l,loading:v,bordered:R,variant:p,size:E,type:P,cover:x,actions:C,tabList:y,children:f,activeTabKey:m,defaultActiveTabKey:h,tabBarExtraContent:S,hoverable:B,tabProps:K={},classNames:M,styles:A,...X}=e,{getPrefixCls:j,direction:$,className:H,style:U,classNames:_,styles:Q}=Oe("card"),[q]=Ut("card",p,R),T=vt(E),I={...e,size:T,variant:q},[z,G]=We([_,M],[Q,A],{props:I}),O=oe=>{e.onTabChange?.(oe)},J=n.useMemo(()=>pt(f).some(re=>n.isValidElement(re)&&re.type===wt),[f]),L=j("card",a),[k,le]=Xn(L),N=n.createElement(Yt,{loading:!0,active:!0,paragraph:{rows:4},title:!1},f),Z=m!==void 0,ee={...K,[Z?"activeKey":"defaultActiveKey"]:Z?m:h,tabBarExtraContent:S};let ae;const ce=T!=="small"?"large":T,de=y?n.createElement(Ct,{size:ce,...ee,className:`${L}-head-tabs`,onChange:O,items:y.map(({tab:oe,...re})=>({label:oe,...re}))}):null;if(l||s||de){const oe=D(`${L}-head`,z.header),re=D(`${L}-head-title`,z.title),Ee=D(`${L}-extra`,z.extra),pe={...c,...G.header};ae=n.createElement("div",{className:oe,style:pe},n.createElement("div",{className:`${L}-head-wrapper`},l&&n.createElement("div",{className:re,style:G.title},l),s&&n.createElement("div",{className:Ee,style:G.extra},s)),de)}const F=D(`${L}-cover`,z.cover),fe=x?n.createElement("div",{className:F,style:G.cover},x):null,V=D(`${L}-body`,z.body),Y={...u,...G.body},ue=n.createElement("div",{className:V,style:Y},v?N:f),he=D(`${L}-actions`,z.actions),me=C?.length?n.createElement(Kn,{actionClasses:he,actionStyle:G.actions,actions:C}):null,we=qt(X,["onTabChange"]),$e=D(L,H,{[`${L}-loading`]:v,[`${L}-bordered`]:q!=="borderless",[`${L}-hoverable`]:B,[`${L}-contain-grid`]:J,[`${L}-contain-tabs`]:y?.length,[`${L}-small`]:T==="small",[`${L}-type-${P}`]:!!P,[`${L}-rtl`]:$==="rtl"},o,r,k,le,z.root),ve={...G.root,...U,...i};return n.createElement("div",{ref:t,...we,className:$e,style:ve},ae,fe,ue,me)}),Vn=e=>{const{prefixCls:t,className:a,avatar:o,title:r,description:i,style:s,classNames:c,styles:u,...l}=e,{getPrefixCls:v,className:R,style:p,classNames:E,styles:P}=Oe("cardMeta"),C=`${v("card",t)}-meta`,[y,f]=We([E,c],[P,u],{props:e}),m=D(C,a,R,y.root),h={...p,...f.root,...s},S=D(`${C}-avatar`,y.avatar),B=D(`${C}-title`,y.title),K=D(`${C}-description`,y.description),M=D(`${C}-section`,y.section),A=o?n.createElement("div",{className:S,style:f.avatar},o):null,X=r?n.createElement("div",{className:B,style:f.title},r):null,j=i?n.createElement("div",{className:K,style:f.description},i):null,$=X||j?n.createElement("div",{className:M,style:f.section},X,j):null;return n.createElement("div",{...l,className:m,style:h},A,$)},Et=Fn;Et.Grid=wt;Et.Meta=Vn;export{Et as C,Ct as T};
|