Files
xin-procurement/public/assets/descriptions-ByqJ1eHE.js
T
2026-09-16 23:53:05 +08:00

1 line
7.7 KiB
JavaScript

import{o as e}from"./request-DWqS4XYU.js";import{Ct as t,Hn as n,Ln as r,Ot as i,Pr as a,Q as o,Wn as s,Zn as c,en as l,nn as u,qt as d,rr as f,wn as p,wt as m}from"./jsx-runtime-Dk2XcqH2.js";import{n as h,t as g}from"./useBreakpoint-oUFNqAoS.js";var _=e(a()),v={xxxl:4,xxl:3,xl:3,lg:3,md:3,sm:2,xs:1},y=_.createContext(null),b=e=>c(e).map(e=>({...e?.props,key:e.key}));function x(e,t,n){let r=_.useMemo(()=>t||b(n),[t,n]);return _.useMemo(()=>r.map(({span:t,...n})=>t===`filled`?{...n,filled:!0}:{...n,span:i(t)?t:h(e,t)}),[r,e])}function S(e,t){let n=[],r=[],i=!1,a=0;return e.filter(e=>e).forEach(e=>{let{filled:o,...s}=e;if(o){r.push(s),n.push(r),r=[],a=0;return}let c=t-a;a+=e.span||1,a>=t?(a>t?(i=!0,r.push({...s,span:c})):r.push(s),n.push(r),r=[],a=0):r.push(s)}),r.length>0&&n.push(r),n=n.map(e=>{let n=e.reduce((e,t)=>e+(t.span||1),0);if(n<t){let r=e[e.length-1];return r.span=t-(n-(r.span||1)),e}return e}),[n,i]}var C=(e,t)=>{let[n,r]=(0,_.useMemo)(()=>S(t,e),[t,e]);return n},w=e=>e.children,T=e=>{let{itemPrefixCls:n,component:r,span:i,className:a,style:o,labelStyle:c,contentStyle:l,bordered:u,label:d,content:p,colon:m,type:h,styles:g,classNames:v}=e,b=r,{classNames:x,styles:S}=_.useContext(y),[C,w]=t([x,v],[S,g],{props:e}),T={...c,...w.label},E={...l,...w.content};if(u){let e;h===`label`&&(e=T),h===`content`&&(e=E);let t=e?{...o,...e}:o;return _.createElement(b,{colSpan:i,style:t,className:s(a,{[`${n}-item-${h}`]:h===`label`||h===`content`,[C.label]:C.label&&h===`label`,[C.content]:C.content&&h===`content`})},f(d)&&_.createElement(`span`,null,d),f(p)&&_.createElement(`span`,null,p))}return _.createElement(b,{className:s(`${n}-item`,a),style:o,colSpan:i},_.createElement(`div`,{className:`${n}-item-container`},f(d)&&_.createElement(`span`,{style:T,className:s(`${n}-item-label`,C.label,{[`${n}-item-no-colon`]:!m})},d),f(p)&&_.createElement(`span`,{style:E,className:s(`${n}-item-content`,C.content)},p)))};function E(e,{colon:t,prefixCls:n,bordered:r},{component:i,type:a,showLabel:o,showContent:s,labelStyle:c,contentStyle:l,styles:u}){return e.map(({label:e,children:d,prefixCls:f=n,className:p,style:m,labelStyle:h,contentStyle:g,span:v=1,key:y,styles:b,classNames:x},S)=>{let C=y??S;if(typeof i==`string`)return _.createElement(T,{key:`${a}-${C}`,className:p,style:m,classNames:x,styles:{label:{...c,...u?.label,...h,...b?.label},content:{...l,...u?.content,...g,...b?.content}},span:v,colon:t,component:i,itemPrefixCls:f,bordered:r,label:o?e:null,content:s?d:null,type:a});let w={label:{...c,...u?.label,...h,...b?.label},content:{...l,...u?.content,...g,...b?.content}};return[_.createElement(T,{key:`label-${C}`,className:p,style:m,classNames:x,styles:w,span:1,colon:t,component:i[0],itemPrefixCls:f,bordered:r,label:e,type:`label`}),_.createElement(T,{key:`content-${C}`,className:p,style:m,classNames:x,styles:w,span:v*2-1,component:i[1],itemPrefixCls:f,bordered:r,content:d,type:`content`})]})}var D=e=>{let t=_.useContext(y),{prefixCls:n,vertical:r,row:i,index:a,bordered:o}=e;return r?_.createElement(_.Fragment,null,_.createElement(`tr`,{key:`label-${a}`,className:`${n}-row`},E(i,e,{component:`th`,type:`label`,showLabel:!0,...t})),_.createElement(`tr`,{key:`content-${a}`,className:`${n}-row`},E(i,e,{component:`td`,type:`content`,showContent:!0,...t}))):_.createElement(`tr`,{key:a,className:`${n}-row`},E(i,e,{component:o?[`th`,`td`]:`td`,type:`item`,showLabel:!0,showContent:!0,...t}))},O=e=>{let{componentCls:t,labelBg:n}=e;return{[`&${t}-bordered`]:{[`> ${t}-view`]:{border:`${r(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"> table":{tableLayout:`auto`},[`${t}-row`]:{borderBottom:`${r(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:`${r(e.padding)} ${r(e.paddingLG)}`,borderInlineEnd:`${r(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:`${r(e.paddingSM)} ${r(e.paddingLG)}`}}},[`&${t}-small`]:{[`${t}-row`]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${r(e.paddingXS)} ${r(e.padding)}`}}}}}},k=e=>{let{componentCls:t,extraColor:n,itemPaddingBottom:i,itemPaddingEnd:a,colonMarginRight:o,colonMarginLeft:s,titleMarginBottom:c}=e;return{[t]:{...l(e),...O(e),"&-rtl":{direction:`rtl`},[`${t}-header`]:{display:`flex`,alignItems:`center`,marginBottom:c},[`${t}-title`]:{...u,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:{minWidth:`100%`,tableLayout:`fixed`,borderCollapse:`collapse`}},[`${t}-row`]:{"> th, > td":{paddingBottom:i,paddingInlineEnd:a},"> 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:`${r(s)} ${r(o)}`},[`&${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}}}}}},A=d(`Descriptions`,e=>k(p(e,{})),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})),j=_.forwardRef((e,r)=>{let{prefixCls:a,title:c,extra:l,column:u,colon:d=!0,bordered:f,layout:p,children:b,className:S,rootClassName:w,style:T,size:E,labelStyle:O,contentStyle:k,styles:j,items:ee,classNames:M,...N}=e,{getPrefixCls:P,direction:F,className:I,style:L,classNames:R,styles:z}=n(`descriptions`),B=P(`descriptions`,a),V=g(),H=_.useMemo(()=>i(u)?u:h(V,u)??h(V,v)??3,[V,u]),U=x(V,ee,b),W=o(E),G=C(H,U),[K,q]=A(B),J={...e,column:H,items:U,size:W},Y=m(L),X=m(T),[Z,Q]=t([R,M],[z,Y,j,X],{props:J}),te=_.useMemo(()=>({labelStyle:O,contentStyle:k,styles:{label:Q.label,content:Q.content},classNames:{label:Z.label,content:Z.content}}),[O,k,Q.label,Q.content,Z.label,Z.content]),$=_.useRef(null);return _.useImperativeHandle(r,()=>({nativeElement:$.current})),_.createElement(y.Provider,{value:te},_.createElement(`div`,{ref:$,className:s(B,I,Z.root,{[`${B}-medium`]:W===`medium`||W===`middle`,[`${B}-small`]:W===`small`,[`${B}-bordered`]:!!f,[`${B}-rtl`]:F===`rtl`},S,w,K,q),style:Q.root,...N},(c||l)&&_.createElement(`div`,{className:s(`${B}-header`,Z.header),style:Q.header},c&&_.createElement(`div`,{className:s(`${B}-title`,Z.title),style:Q.title},c),l&&_.createElement(`div`,{className:s(`${B}-extra`,Z.extra),style:Q.extra},l)),_.createElement(`div`,{className:`${B}-view`},_.createElement(`table`,null,_.createElement(`tbody`,null,G.map((e,t)=>_.createElement(D,{key:t,index:t,colon:d,prefixCls:B,vertical:p===`vertical`,bordered:f,row:e})))))))});j.Item=w;export{j as t};