10 lines
8.7 KiB
JavaScript
10 lines
8.7 KiB
JavaScript
import{t as e}from"./tabs-B0pGTc5N.js";import{Bi as t,Ca as n,Ea as r,Ei as i,Fi as a,Ki as o,Li as s,Ri as c,Yi as l,Yr as u,_i as d,di as f,ir as p,pi as m,qn as h,wr as g,yi as _}from"./index-DThTpSPU.js";var v=r(n()),y=({prefixCls:e,className:n,hoverable:r=!0,...i})=>{let{getPrefixCls:a}=v.useContext(s),o=a(`card`,e),c=t(`${o}-grid`,n,{[`${o}-grid-hoverable`]:r});return v.createElement(`div`,{...i,className:c})},b=e=>{let{antCls:t,componentCls:n,headerHeight:r,headerPadding:i,tabsMarginBottom:o}=e;return{display:`flex`,justifyContent:`center`,flexDirection:`column`,minHeight:r,marginBottom:-1,padding:`0 ${a(i)}`,color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:`${a(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`,borderRadius:`${a(e.borderRadiusLG)} ${a(e.borderRadiusLG)} 0 0`,...m(),"&-wrapper":{width:`100%`,display:`flex`,alignItems:`center`},"&-title":{display:`inline-block`,flex:1,..._,[`
|
|
> ${n}-typography,
|
|
> ${n}-typography-edit-content
|
|
`]:{insetInlineStart:0,marginTop:0,marginBottom:0}},[`${t}-tabs-top`]:{clear:`both`,marginBottom:o,color:e.colorText,fontWeight:`normal`,fontSize:e.fontSize,"&-bar":{borderBottom:`${a(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`}}}},x=e=>{let{cardPaddingBase:t,colorBorderSecondary:n,cardShadow:r,lineWidth:i}=e;return{width:`33.33%`,padding:t,border:0,borderRadius:0,boxShadow:`
|
|
${a(i)} 0 0 0 ${n},
|
|
0 ${a(i)} 0 0 ${n},
|
|
${a(i)} ${a(i)} 0 0 ${n},
|
|
${a(i)} 0 0 0 ${n} inset,
|
|
0 ${a(i)} 0 0 ${n} inset;
|
|
`,transition:`all ${e.motionDurationMid}`,"&-hoverable:hover":{position:`relative`,zIndex:1,boxShadow:r}}},S=e=>{let{componentCls:t,iconCls:n,actionsLiMargin:r,cardActionsIconSize:i,colorBorderSecondary:o,actionsBg:s}=e;return{margin:0,padding:0,listStyle:`none`,background:s,borderTop:`${a(e.lineWidth)} ${e.lineType} ${o}`,display:`flex`,borderRadius:`0 0 ${a(e.borderRadiusLG)} ${a(e.borderRadiusLG)}`,...m(),"& > li":{margin:r,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), > ${n}`]:{display:`inline-block`,width:`100%`,color:e.colorIcon,lineHeight:a(e.fontHeight),transition:`color ${e.motionDurationMid}`,"&:hover":{color:e.colorPrimary}},[`> ${n}`]:{fontSize:i,lineHeight:a(e.calc(i).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:`${a(e.lineWidth)} ${e.lineType} ${o}`}}}},C=e=>({margin:`${a(e.calc(e.marginXXS).mul(-1).equal())} 0`,display:`flex`,...m(),"&-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,..._},"&-description":{color:e.colorTextDescription}}),w=e=>{let{componentCls:t,colorFillAlter:n,headerPadding:r,bodyPadding:i}=e;return{[`${t}-head`]:{padding:`0 ${a(r)}`,background:n,"&-title":{fontSize:e.fontSize}},[`${t}-body`]:{padding:`${a(e.padding)} ${a(i)}`}}},T=e=>{let{componentCls:t}=e;return{overflow:`hidden`,[`${t}-body`]:{userSelect:`none`}}},E=e=>{let{componentCls:t,cardShadow:n,cardHeadPadding:r,colorBorderSecondary:i,boxShadowTertiary:o,bodyPadding:s,extraColor:c,motionDurationMid:l}=e;return{[t]:{...d(e),position:`relative`,background:e.colorBgContainer,borderRadius:e.borderRadiusLG,[`&:not(${t}-bordered)`]:{boxShadow:o},[`${t}-head`]:b(e),[`${t}-extra`]:{marginInlineStart:`auto`,color:c,fontWeight:`normal`,fontSize:e.fontSize},[`${t}-body`]:{padding:s,borderRadius:`0 0 ${a(e.borderRadiusLG)} ${a(e.borderRadiusLG)}`,"&:first-child":{borderStartStartRadius:e.borderRadiusLG,borderStartEndRadius:e.borderRadiusLG},"&:not(:last-child)":{borderEndStartRadius:0,borderEndEndRadius:0}},[`${t}-grid`]:x(e),[`${t}-cover`]:{"> *":{display:`block`,width:`100%`,borderRadius:`${a(e.borderRadiusLG)} ${a(e.borderRadiusLG)} 0 0`}},[`${t}-actions`]:S(e),[`${t}-meta`]:C(e)},[`${t}-bordered`]:{border:`${a(e.lineWidth)} ${e.lineType} ${i}`,[`${t}-cover`]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},[`${t}-hoverable`]:{cursor:`pointer`,transition:[`box-shadow`,`border-color`].map(e=>`${e} ${l}`).join(`, `),"&:hover":{borderColor:`transparent`,boxShadow:n}},[`${t}-contain-grid`]:{borderRadius:`${a(e.borderRadiusLG)} ${a(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:r}}},[`${t}-type-inner`]:w(e),[`${t}-loading`]:T(e),[`${t}-rtl`]:{direction:`rtl`}}},D=e=>{let{componentCls:t,bodyPaddingSM:n,headerPaddingSM:r,headerHeightSM:i,headerFontSizeSM:o}=e;return{[`${t}-small`]:{[`> ${t}-head`]:{minHeight:i,padding:`0 ${a(r)}`,fontSize:o,[`> ${t}-head-wrapper`]:{[`> ${t}-extra`]:{fontSize:e.fontSize}}},[`> ${t}-body`]:{padding:n}},[`${t}-small${t}-contain-tabs`]:{[`> ${t}-head`]:{[`${t}-head-title, ${t}-extra`]:{paddingTop:0,display:`flex`,alignItems:`center`}}}}},O=f(`Card`,e=>{let t=i(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[E(t),D(t)]},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})),k=e=>{let{actionClasses:t,actions:n=[],actionStyle:r}=e;return v.createElement(`ul`,{className:t,style:r},n.map((e,t)=>{let r=`action-${t}`;return v.createElement(`li`,{style:{width:`${100/n.length}%`},key:r},v.createElement(`span`,null,e))}))},A=v.forwardRef((n,r)=>{let{prefixCls:i,className:a,rootClassName:s,style:d,extra:f,headStyle:m={},bodyStyle:_={},title:b,loading:x,bordered:S,variant:C,size:w,type:T,cover:E,actions:D,tabList:A,children:j,activeTabKey:M,defaultActiveTabKey:N,tabBarExtraContent:P,hoverable:F,tabProps:I={},classNames:L,styles:ee,...te}=n,{getPrefixCls:ne,direction:re,className:ie,style:R,classNames:z,styles:B}=c(`card`),[V]=h(`card`,C,S),H=g(w),U={...n,size:H,variant:V},[W,G]=u([z,L],[B,ee],{props:U}),K=e=>{n.onTabChange?.(e)},q=v.useMemo(()=>o(j),[j]),J=v.useMemo(()=>q.some(e=>v.isValidElement(e)&&e.type===y),[q]),Y=ne(`card`,i),[ae,oe]=O(Y),se=v.createElement(p,{loading:!0,active:!0,paragraph:{rows:4},title:!1},j),X=M!==void 0,ce={...I,[X?`activeKey`:`defaultActiveKey`]:X?M:N,tabBarExtraContent:P},Z,le=H===`small`?H:`large`,Q=A?v.createElement(e,{size:le,...ce,className:`${Y}-head-tabs`,onChange:K,items:A.map(({tab:e,...t})=>({label:e,...t}))}):null;if(b||f||Q){let e=t(`${Y}-head`,W.header),n=t(`${Y}-head-title`,W.title),r=t(`${Y}-extra`,W.extra),i={...m,...G.header};Z=v.createElement(`div`,{className:e,style:i},v.createElement(`div`,{className:`${Y}-head-wrapper`},b&&v.createElement(`div`,{className:n,style:G.title},b),f&&v.createElement(`div`,{className:r,style:G.extra},f)),Q)}let ue=t(`${Y}-cover`,W.cover),de=E?v.createElement(`div`,{className:ue,style:G.cover},E):null,fe=t(`${Y}-body`,W.body),pe={..._,...G.body},$=x||q.length?v.createElement(`div`,{className:fe,style:pe},x?se:j):null,me=t(`${Y}-actions`,W.actions),he=D?.length?v.createElement(k,{actionClasses:me,actionStyle:G.actions,actions:D}):null,ge=l(te,[`onTabChange`]),_e=t(Y,ie,{[`${Y}-loading`]:x,[`${Y}-bordered`]:V!==`borderless`,[`${Y}-hoverable`]:F,[`${Y}-contain-grid`]:J,[`${Y}-contain-tabs`]:A?.length,[`${Y}-small`]:H===`small`,[`${Y}-type-${T}`]:!!T,[`${Y}-rtl`]:re===`rtl`},a,s,ae,oe,W.root),ve={...G.root,...R,...d};return v.createElement(`div`,{ref:r,...ge,className:_e,style:ve},Z,de,$,he)}),j=e=>{let{prefixCls:n,className:r,avatar:i,title:a,description:o,style:s,classNames:l,styles:d,...f}=e,{getPrefixCls:p,className:m,style:h,classNames:g,styles:_}=c(`cardMeta`),y=`${p(`card`,n)}-meta`,[b,x]=u([g,l],[_,d],{props:e}),S=t(y,r,m,b.root),C={...h,...x.root,...s},w=t(`${y}-avatar`,b.avatar),T=t(`${y}-title`,b.title),E=t(`${y}-description`,b.description),D=t(`${y}-section`,b.section),O=i?v.createElement(`div`,{className:w,style:x.avatar},i):null,k=a?v.createElement(`div`,{className:T,style:x.title},a):null,A=o?v.createElement(`div`,{className:E,style:x.description},o):null,j=k||A?v.createElement(`div`,{className:D,style:x.section},k,A):null;return v.createElement(`div`,{...f,className:S,style:C},O,j)},M=A;M.Grid=y,M.Meta=j;export{M as t}; |