Files
xin-school/public/assets/index-VkcAtM9X.js
T
2026-05-30 17:38:49 +08:00

2 lines
7.4 KiB
JavaScript

import{R as f,r as o,aY as A,aZ as Z,K as X,L as N,a8 as L,z as j,G as q,a_ as Q,a3 as g,H as k,J as ee,a$ as te,b0 as le}from"./index-B-sDl1ER.js";const ne={xxxl:4,xxl:3,xl:3,lg:3,md:3,sm:2,xs:1},H=f.createContext(null),ae=e=>Z(e).map(t=>({...t?.props,key:t.key}));function se(e,t,n){const l=o.useMemo(()=>t||ae(n),[t,n]);return o.useMemo(()=>l.map(({span:a,...s})=>a==="filled"?{...s,filled:!0}:{...s,span:typeof a=="number"?a:A(e,a)}),[l,e])}function oe(e,t){let n=[],l=[],r=!1,a=0;return e.filter(s=>s).forEach(s=>{const{filled:d,...i}=s;if(d){l.push(i),n.push(l),l=[],a=0;return}const c=t-a;a+=s.span||1,a>=t?(a>t?(r=!0,l.push({...i,span:c})):l.push(i),n.push(l),l=[],a=0):l.push(i)}),l.length>0&&n.push(l),n=n.map(s=>{const d=s.reduce((i,c)=>i+(c.span||1),0);if(d<t){const i=s[s.length-1];return i.span=t-(d-(i.span||1)),s}return s}),[n,r]}const re=(e,t)=>{const[n,l]=o.useMemo(()=>oe(t,e),[t,e]);return n},ie=e=>e.children,P=e=>{const{itemPrefixCls:t,component:n,span:l,className:r,style:a,labelStyle:s,contentStyle:d,bordered:i,label:c,content:m,colon:w,type:b,styles:y,classNames:h}=e,x=n,{classNames:v,styles:z}=f.useContext(H),[p,S]=X([v,h],[z,y],{props:e}),$={...s,...S.label},B={...d,...S.content};return i?f.createElement(x,{colSpan:l,style:a,className:N(r,{[`${t}-item-${b}`]:b==="label"||b==="content",[p.label]:p.label&&b==="label",[p.content]:p.content&&b==="content"})},L(c)&&f.createElement("span",{style:$},c),L(m)&&f.createElement("span",{style:B},m)):f.createElement(x,{className:N(`${t}-item`,r),style:a,colSpan:l},f.createElement("div",{className:`${t}-item-container`},L(c)&&f.createElement("span",{style:$,className:N(`${t}-item-label`,p.label,{[`${t}-item-no-colon`]:!w})},c),L(m)&&f.createElement("span",{style:B,className:N(`${t}-item-content`,p.content)},m)))};function T(e,{colon:t,prefixCls:n,bordered:l},{component:r,type:a,showLabel:s,showContent:d,labelStyle:i,contentStyle:c,styles:m}){return e.map(({label:w,children:b,prefixCls:y=n,className:h,style:x,labelStyle:v,contentStyle:z,span:p=1,key:S,styles:$,classNames:B},M)=>typeof r=="string"?o.createElement(P,{key:`${a}-${S||M}`,className:h,style:x,classNames:B,styles:{label:{...i,...m?.label,...v,...$?.label},content:{...c,...m?.content,...z,...$?.content}},span:p,colon:t,component:r,itemPrefixCls:y,bordered:l,label:s?w:null,content:d?b:null,type:a}):[o.createElement(P,{key:`label-${S||M}`,className:h,style:{...i,...m?.label,...x,...v,...$?.label},span:1,colon:t,component:r[0],itemPrefixCls:y,bordered:l,label:w,type:"label"}),o.createElement(P,{key:`content-${S||M}`,className:h,style:{...c,...m?.content,...x,...z,...$?.content},span:p*2-1,component:r[1],itemPrefixCls:y,bordered:l,content:b,type:"content"})])}const ce=e=>{const t=o.useContext(H),{prefixCls:n,vertical:l,row:r,index:a,bordered:s}=e;return l?o.createElement(o.Fragment,null,o.createElement("tr",{key:`label-${a}`,className:`${n}-row`},T(r,e,{component:"th",type:"label",showLabel:!0,...t})),o.createElement("tr",{key:`content-${a}`,className:`${n}-row`},T(r,e,{component:"td",type:"content",showContent:!0,...t}))):o.createElement("tr",{key:a,className:`${n}-row`},T(r,e,{component:s?["th","td"]:"td",type:"item",showLabel:!0,showContent:!0,...t}))},de=e=>{const{componentCls:t,labelBg:n}=e;return{[`&${t}-bordered`]:{[`> ${t}-view`]:{border:`${g(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"> table":{tableLayout:"auto"},[`${t}-row`]:{borderBottom:`${g(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:first-child":{"> th:first-child, > td:first-child":{borderStartStartRadius:e.borderRadiusLG}},"&:last-child":{borderBottom:"none","> th:first-child, > td:first-child":{borderEndStartRadius:e.borderRadiusLG}},[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${g(e.padding)} ${g(e.paddingLG)}`,borderInlineEnd:`${g(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderInlineEnd:"none"}},[`> ${t}-item-label`]:{color:e.colorTextSecondary,backgroundColor:n,"&::after":{display:"none"}}}},[`&${t}-medium`]:{[`${t}-row`]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${g(e.paddingSM)} ${g(e.paddingLG)}`}}},[`&${t}-small`]:{[`${t}-row`]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${g(e.paddingXS)} ${g(e.padding)}`}}}}}},me=e=>{const{componentCls:t,extraColor:n,itemPaddingBottom:l,itemPaddingEnd:r,colonMarginRight:a,colonMarginLeft:s,titleMarginBottom:d}=e;return{[t]:{...k(e),...de(e),"&-rtl":{direction:"rtl"},[`${t}-header`]:{display:"flex",alignItems:"center",marginBottom:d},[`${t}-title`]:{...Q,flex:"auto",color:e.titleColor,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG},[`${t}-extra`]:{marginInlineStart:"auto",color:n,fontSize:e.fontSize},[`${t}-view`]:{width:"100%",borderRadius:e.borderRadiusLG,table:{width:"100%",tableLayout:"fixed",borderCollapse:"collapse"}},[`${t}-row`]:{"> th, > td":{paddingBottom:l,paddingInlineEnd:r},"> th:last-child, > td:last-child":{paddingInlineEnd:0},"&:last-child":{borderBottom:"none","> th, > td":{paddingBottom:0}}},[`${t}-item-label`]:{color:e.labelColor,fontWeight:"normal",fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"start","&::after":{content:'":"',position:"relative",top:-.5,marginInline:`${g(s)} ${g(a)}`},[`&${t}-item-no-colon::after`]:{content:'""'}},[`${t}-item-no-label`]:{"&::after":{margin:0,content:'""'}},[`${t}-item-content`]:{display:"table-cell",flex:1,color:e.contentColor,fontSize:e.fontSize,lineHeight:e.lineHeight,wordBreak:"break-word",overflowWrap:"break-word"},[`${t}-item`]:{paddingBottom:0,verticalAlign:"top","&-container":{display:"flex",[`${t}-item-label`]:{display:"inline-flex",alignItems:"baseline"},[`${t}-item-content`]:{display:"inline-flex",alignItems:"baseline",minWidth:"1em"}}},"&-medium":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingSM}}},"&-small":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingXS}}}}}},pe=e=>({labelBg:e.colorFillAlter,labelColor:e.colorTextTertiary,titleColor:e.colorText,titleMarginBottom:e.fontSizeSM*e.lineHeightSM,itemPaddingBottom:e.padding,itemPaddingEnd:e.padding,colonMarginRight:e.marginXS,colonMarginLeft:e.marginXXS/2,contentColor:e.colorText,extraColor:e.colorText}),ue=j("Descriptions",e=>{const t=q(e,{});return me(t)},pe),ge=e=>{const{prefixCls:t,title:n,extra:l,column:r,colon:a=!0,bordered:s,layout:d,children:i,className:c,rootClassName:m,style:w,size:b,labelStyle:y,contentStyle:h,styles:x,items:v,classNames:z,...p}=e,{getPrefixCls:S,direction:$,className:B,style:M,classNames:F,styles:_}=ee("descriptions"),u=S("descriptions",t),R=te(),G=o.useMemo(()=>typeof r=="number"?r:A(R,{...ne,...r})??3,[R,r]),W=se(R,v,i),I=le(b),U=re(G,W),[V,J]=ue(u),K={...e,column:G,items:W,size:I},[C,E]=X([F,z],[_,x],{props:K}),O=o.useMemo(()=>({labelStyle:y,contentStyle:h,styles:{label:E.label,content:E.content},classNames:{label:C.label,content:C.content}}),[y,h,E.label,E.content,C.label,C.content]);return o.createElement(H.Provider,{value:O},o.createElement("div",{className:N(u,B,C.root,{[`${u}-medium`]:I==="medium"||I==="middle",[`${u}-small`]:I==="small",[`${u}-bordered`]:!!s,[`${u}-rtl`]:$==="rtl"},c,m,V,J),style:{...M,...E.root,...w},...p},(n||l)&&o.createElement("div",{className:N(`${u}-header`,C.header),style:E.header},n&&o.createElement("div",{className:N(`${u}-title`,C.title),style:E.title},n),l&&o.createElement("div",{className:N(`${u}-extra`,C.extra),style:E.extra},l)),o.createElement("div",{className:`${u}-view`},o.createElement("table",null,o.createElement("tbody",null,U.map((Y,D)=>o.createElement(ce,{key:D,index:D,colon:a,prefixCls:u,vertical:d==="vertical",bordered:s,row:Y})))))))};ge.Item=ie;export{ge as D};