2 lines
9.7 KiB
JavaScript
2 lines
9.7 KiB
JavaScript
import{bg as V,r as o,cL as T,aj as U,C as y,x as K,ax as q,y as J,z as f,bR as Q,A as Y,bj as Z,aK as k}from"./index-CYM97J2V.js";const ee={xxl:3,xl:3,lg:3,md:3,sm:2,xs:1},L=V.createContext({});var te=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(i[n[l]]=e[n[l]]);return i};const ne=e=>U(e).map(t=>Object.assign(Object.assign({},t==null?void 0:t.props),{key:t.key}));function le(e,t,i){const n=o.useMemo(()=>t||ne(i),[t,i]);return o.useMemo(()=>n.map(c=>{var{span:s}=c,b=te(c,["span"]);return s==="filled"?Object.assign(Object.assign({},b),{filled:!0}):Object.assign(Object.assign({},b),{span:typeof s=="number"?s:T(e,s)})}),[n,e])}var ae=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(i[n[l]]=e[n[l]]);return i};function ie(e,t){let i=[],n=[],l=!1,c=0;return e.filter(s=>s).forEach(s=>{const{filled:b}=s,m=ae(s,["filled"]);if(b){n.push(m),i.push(n),n=[],c=0;return}const p=t-c;c+=s.span||1,c>=t?(c>t?(l=!0,n.push(Object.assign(Object.assign({},m),{span:p}))):n.push(m),i.push(n),n=[],c=0):n.push(m)}),n.length>0&&i.push(n),i=i.map(s=>{const b=s.reduce((m,p)=>m+(p.span||1),0);if(b<t){const m=s[s.length-1];return m.span=t-(b-(m.span||1)),s}return s}),[i,l]}const oe=(e,t)=>{const[i,n]=o.useMemo(()=>ie(t,e),[t,e]);return i},se=({children:e})=>e,I=e=>e!=null,z=e=>{const{itemPrefixCls:t,component:i,span:n,className:l,style:c,labelStyle:s,contentStyle:b,bordered:m,label:p,content:d,colon:C,type:v,styles:u}=e,$=i,{classNames:a}=o.useContext(L),j=Object.assign(Object.assign({},s),u==null?void 0:u.label),r=Object.assign(Object.assign({},b),u==null?void 0:u.content);return m?o.createElement($,{colSpan:n,style:c,className:y(l,{[`${t}-item-${v}`]:v==="label"||v==="content",[a==null?void 0:a.label]:(a==null?void 0:a.label)&&v==="label",[a==null?void 0:a.content]:(a==null?void 0:a.content)&&v==="content"})},I(p)&&o.createElement("span",{style:j},p),I(d)&&o.createElement("span",{style:r},d)):o.createElement($,{colSpan:n,style:c,className:y(`${t}-item`,l)},o.createElement("div",{className:`${t}-item-container`},I(p)&&o.createElement("span",{style:j,className:y(`${t}-item-label`,a==null?void 0:a.label,{[`${t}-item-no-colon`]:!C})},p),I(d)&&o.createElement("span",{style:r,className:y(`${t}-item-content`,a==null?void 0:a.content)},d)))};function M(e,{colon:t,prefixCls:i,bordered:n},{component:l,type:c,showLabel:s,showContent:b,labelStyle:m,contentStyle:p,styles:d}){return e.map(({label:C,children:v,prefixCls:u=i,className:$,style:a,labelStyle:j,contentStyle:r,span:N=1,key:S,styles:g},E)=>typeof l=="string"?o.createElement(z,{key:`${c}-${S||E}`,className:$,style:a,styles:{label:Object.assign(Object.assign(Object.assign(Object.assign({},m),d==null?void 0:d.label),j),g==null?void 0:g.label),content:Object.assign(Object.assign(Object.assign(Object.assign({},p),d==null?void 0:d.content),r),g==null?void 0:g.content)},span:N,colon:t,component:l,itemPrefixCls:u,bordered:n,label:s?C:null,content:b?v:null,type:c}):[o.createElement(z,{key:`label-${S||E}`,className:$,style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},m),d==null?void 0:d.label),a),j),g==null?void 0:g.label),span:1,colon:t,component:l[0],itemPrefixCls:u,bordered:n,label:C,type:"label"}),o.createElement(z,{key:`content-${S||E}`,className:$,style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},p),d==null?void 0:d.content),a),r),g==null?void 0:g.content),span:N*2-1,component:l[1],itemPrefixCls:u,bordered:n,content:v,type:"content"})])}const re=e=>{const t=o.useContext(L),{prefixCls:i,vertical:n,row:l,index:c,bordered:s}=e;return n?o.createElement(o.Fragment,null,o.createElement("tr",{key:`label-${c}`,className:`${i}-row`},M(l,e,Object.assign({component:"th",type:"label",showLabel:!0},t))),o.createElement("tr",{key:`content-${c}`,className:`${i}-row`},M(l,e,Object.assign({component:"td",type:"content",showContent:!0},t)))):o.createElement("tr",{key:c,className:`${i}-row`},M(l,e,Object.assign({component:s?["th","td"]:"td",type:"item",showLabel:!0,showContent:!0},t)))},ce=e=>{const{componentCls:t,labelBg:i}=e;return{[`&${t}-bordered`]:{[`> ${t}-view`]:{border:`${f(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"> table":{tableLayout:"auto"},[`${t}-row`]:{borderBottom:`${f(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:`${f(e.padding)} ${f(e.paddingLG)}`,borderInlineEnd:`${f(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderInlineEnd:"none"}},[`> ${t}-item-label`]:{color:e.colorTextSecondary,backgroundColor:i,"&::after":{display:"none"}}}},[`&${t}-middle`]:{[`${t}-row`]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${f(e.paddingSM)} ${f(e.paddingLG)}`}}},[`&${t}-small`]:{[`${t}-row`]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${f(e.paddingXS)} ${f(e.padding)}`}}}}}},de=e=>{const{componentCls:t,extraColor:i,itemPaddingBottom:n,itemPaddingEnd:l,colonMarginRight:c,colonMarginLeft:s,titleMarginBottom:b}=e;return{[t]:Object.assign(Object.assign(Object.assign({},J(e)),ce(e)),{"&-rtl":{direction:"rtl"},[`${t}-header`]:{display:"flex",alignItems:"center",marginBottom:b},[`${t}-title`]:Object.assign(Object.assign({},Q),{flex:"auto",color:e.titleColor,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}),[`${t}-extra`]:{marginInlineStart:"auto",color:i,fontSize:e.fontSize},[`${t}-view`]:{width:"100%",borderRadius:e.borderRadiusLG,table:{width:"100%",tableLayout:"fixed",borderCollapse:"collapse"}},[`${t}-row`]:{"> th, > td":{paddingBottom:n,paddingInlineEnd:l},"> 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:`${f(s)} ${f(c)}`},[`&${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"}}},"&-middle":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingSM}}},"&-small":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingXS}}}})}},me=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}),be=K("Descriptions",e=>{const t=q(e,{});return de(t)},me);var ge=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(i[n[l]]=e[n[l]]);return i};const pe=e=>{const{prefixCls:t,title:i,extra:n,column:l,colon:c=!0,bordered:s,layout:b,children:m,className:p,rootClassName:d,style:C,size:v,labelStyle:u,contentStyle:$,styles:a,items:j,classNames:r}=e,N=ge(e,["prefixCls","title","extra","column","colon","bordered","layout","children","className","rootClassName","style","size","labelStyle","contentStyle","styles","items","classNames"]),{getPrefixCls:S,direction:g,className:E,style:_,classNames:h,styles:x}=Y("descriptions"),O=S("descriptions",t),P=Z(),H=o.useMemo(()=>{var w;return typeof l=="number"?l:(w=T(P,Object.assign(Object.assign({},ee),l)))!==null&&w!==void 0?w:3},[P,l]),W=le(P,j,m),B=k(v),A=oe(H,W),[D,G,X]=be(O),F=o.useMemo(()=>({labelStyle:u,contentStyle:$,styles:{content:Object.assign(Object.assign({},x.content),a==null?void 0:a.content),label:Object.assign(Object.assign({},x.label),a==null?void 0:a.label)},classNames:{label:y(h.label,r==null?void 0:r.label),content:y(h.content,r==null?void 0:r.content)}}),[u,$,a,r,h,x]);return D(o.createElement(L.Provider,{value:F},o.createElement("div",Object.assign({className:y(O,E,h.root,r==null?void 0:r.root,{[`${O}-${B}`]:B&&B!=="default",[`${O}-bordered`]:!!s,[`${O}-rtl`]:g==="rtl"},p,d,G,X),style:Object.assign(Object.assign(Object.assign(Object.assign({},_),x.root),a==null?void 0:a.root),C)},N),(i||n)&&o.createElement("div",{className:y(`${O}-header`,h.header,r==null?void 0:r.header),style:Object.assign(Object.assign({},x.header),a==null?void 0:a.header)},i&&o.createElement("div",{className:y(`${O}-title`,h.title,r==null?void 0:r.title),style:Object.assign(Object.assign({},x.title),a==null?void 0:a.title)},i),n&&o.createElement("div",{className:y(`${O}-extra`,h.extra,r==null?void 0:r.extra),style:Object.assign(Object.assign({},x.extra),a==null?void 0:a.extra)},n)),o.createElement("div",{className:`${O}-view`},o.createElement("table",null,o.createElement("tbody",null,A.map((w,R)=>o.createElement(re,{key:R,index:R,colon:c,prefixCls:O,vertical:b==="vertical",bordered:s,row:w}))))))))};pe.Item=se;export{pe as D};
|