9 lines
23 KiB
JavaScript
9 lines
23 KiB
JavaScript
|
|
import{r as o,aq as Ae,de as we,bk as De,ar as We,at as Oe,as as oe,df as fe,ce as pe,br as $e,ax as D,bp as Be,ao as Y,bs as Xe,bu as Ge,au as Ke,av as Qe,dg as Ye,dh as Ue,di as ke,dj as Je,dk as Fe,dl as U,dm as Ze,dn as et,cr as tt,cf as le,bM as xe,dp as nt,cM as rt,dq as ot,dr as ve,ds as at,bO as je,b4 as lt,aX as it,dt as st,bw as ct,Q as mt,bx as ut,bt as dt,b0 as ft,cO as pt,b2 as gt,bP as bt,a$ as ht,du as Pe,an as Ne,dv as yt,dw as Ct,dx as $t,dy as xt,dz as vt,dA as St,ap as Et,dB as It,dC as wt}from"./index-D2cxrzyv.js";import{u as Me,g as Re,t as ue,a as Ot}from"./useForm-CaItC8xb.js";import{C as _e,R as Ft}from"./row-C5EMotZ4.js";function jt(e){return e==null?null:typeof e=="object"&&!o.isValidElement(e)?e:{title:e}}function ie(e){const[t,n]=o.useState(e);return o.useEffect(()=>{const r=setTimeout(()=>{n(e)},e.length?0:10);return()=>{clearTimeout(r)}},[e]),t}const Pt=e=>{const{componentCls:t}=e,n=`${t}-show-help`,r=`${t}-show-help-item`;return{[n]:{transition:`opacity ${e.motionDurationFast} ${e.motionEaseInOut}`,"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[r]:{overflow:"hidden",transition:`height ${e.motionDurationFast} ${e.motionEaseInOut},
|
||
|
|
opacity ${e.motionDurationFast} ${e.motionEaseInOut},
|
||
|
|
transform ${e.motionDurationFast} ${e.motionEaseInOut} !important`,[`&${r}-appear, &${r}-enter`]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},[`&${r}-leave-active`]:{transform:"translateY(-5px)"}}}}},Nt=e=>({legend:{display:"block",width:"100%",marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:`${oe(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:`0 0 0 ${oe(e.controlOutlineWidth)} ${e.controlOutline}`},output:{display:"block",paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),Se=(e,t)=>{const{formItemCls:n}=e;return{[n]:{[`${n}-label > label`]:{height:t},[`${n}-control-input`]:{minHeight:t}}}},Mt=e=>{const{componentCls:t}=e;return{[e.componentCls]:Object.assign(Object.assign(Object.assign({},Oe(e)),Nt(e)),{[`${t}-text`]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":Object.assign({},Se(e,e.controlHeightSM)),"&-large":Object.assign({},Se(e,e.controlHeightLG))})}},Rt=e=>{const{formItemCls:t,iconCls:n,rootPrefixCls:r,antCls:a,labelRequiredMarkColor:i,labelColor:u,labelFontSize:s,labelHeight:f,labelColonMarginInlineStart:m,labelColonMarginInlineEnd:p,itemMarginBottom:d}=e;return{[t]:Object.assign(Object.assign({},Oe(e)),{marginBottom:d,verticalAlign:"top","&-with-help":{transition:"none"},[`&-hidden,
|
||
|
|
&-hidden${a}-row`]:{display:"none"},"&-has-warning":{[`${t}-split`]:{color:e.colorError}},"&-has-error":{[`${t}-split`]:{color:e.colorWarning}},[`${t}-label`]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:e.lineHeight,whiteSpace:"unset","> label":{verticalAlign:"middle",textWrap:"balance"}},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:f,color:u,fontSize:s,[`> ${n}`]:{fontSize:e.fontSize,verticalAlign:"top"},[`&${t}-required`]:{"&::before":{display:"inline-block",marginInlineEnd:e.marginXXS,color:i,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"'},[`&${t}-required-mark-hidden, &${t}-required-mark-optional`]:{"&::before":{display:"none"}}},[`${t}-optional`]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,[`&${t}-required-mark-hidden`]:{display:"none"}},[`${t}-tooltip`]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:m,marginInlineEnd:p},[`&${t}-no-colon::after`]:{content:'"\\a0"'}}},[`${t}-control`]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,[`&:first-child:not([class^="'${r}-col-'"]):not([class*="' ${r}-col-'"])`]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%",[`&:has(> ${a}-switch:only-child, > ${a}-rate:only-child)`]:{display:"flex",alignItems:"center"}}}},[t]:{"&-additional":{display:"flex",flexDirection:"column"},"&-explain, &-extra":{clear:"both",color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:e.controlHeightSM,transition:`color ${e.motionDurationMid} ${e.motionEaseOut}`},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},[`&-with-help ${t}-explain`]:{height:"auto",opacity:1},[`${t}-feedback-icon`]:{fontSize:e.fontSize,textAlign:"center",visibility:"visible",animationName:we,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:"none","&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}})}},re=e=>({padding:e.verticalLabelPadding,margin:e.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),_t=e=>{const{antCls:t,formItemCls:n}=e;return{[`${n}-horizontal`]:{[`${n}-label`]:{flexGrow:0},[`${n}-control`]:{flex:"1 1 0",minWidth:0},[`${n}-label[class$='-24'], ${n}-label[class*='-24 ']`]:{[`& + ${n}-control`]:{minWidth:"unset"}},[`${t}-col-24${n}-label,
|
||
|
|
${t}-col-xl-24${n}-label`]:re(e)}}},Lt=e=>{const{componentCls:t,formItemCls:n,inlineItemMarginBottom:r}=e;return{[`${t}-inline`]:{display:"flex",flexWrap:"wrap",[`${n}-inline`]:{flex:"none",marginInlineEnd:e.margin,marginBottom:r,"&-row":{flexWrap:"nowrap"},[`> ${n}-label,
|
||
|
|
> ${n}-control`]:{display:"inline-block",verticalAlign:"top"},[`> ${n}-label`]:{flex:"none"},[`${t}-text`]:{display:"inline-block"},[`${n}-has-feedback`]:{display:"inline-block"}}}}},Vt=e=>{const{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{[`${n} ${n}-label`]:re(e),[`${t}:not(${t}-inline)`]:{[n]:{flexWrap:"wrap",[`${n}-label, ${n}-control`]:{[`&:not([class*=" ${r}-col-xs"])`]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},Tt=e=>{const{componentCls:t,formItemCls:n,antCls:r}=e;return{[`${n}-vertical`]:{[`${n}-row`]:{flexDirection:"column"},[`${n}-label > label`]:{height:"auto"},[`${n}-control`]:{width:"100%"},[`${n}-label,
|
||
|
|
${r}-col-24${n}-label,
|
||
|
|
${r}-col-xl-24${n}-label`]:re(e)},[`@media (max-width: ${oe(e.screenXSMax)})`]:[Vt(e),{[t]:{[`${n}:not(${n}-horizontal)`]:{[`${r}-col-xs-24${n}-label`]:re(e)}}}],[`@media (max-width: ${oe(e.screenSMMax)})`]:{[t]:{[`${n}:not(${n}-horizontal)`]:{[`${r}-col-sm-24${n}-label`]:re(e)}}},[`@media (max-width: ${oe(e.screenMDMax)})`]:{[t]:{[`${n}:not(${n}-horizontal)`]:{[`${r}-col-md-24${n}-label`]:re(e)}}},[`@media (max-width: ${oe(e.screenLGMax)})`]:{[t]:{[`${n}:not(${n}-horizontal)`]:{[`${r}-col-lg-24${n}-label`]:re(e)}}}}},zt=e=>({labelRequiredMarkColor:e.colorError,labelColor:e.colorTextHeading,labelFontSize:e.fontSize,labelHeight:e.controlHeight,labelColonMarginInlineStart:e.marginXXS/2,labelColonMarginInlineEnd:e.marginXS,itemMarginBottom:e.marginLG,verticalLabelPadding:`0 0 ${e.paddingXS}px`,verticalLabelMargin:0,inlineItemMarginBottom:0}),Le=(e,t)=>We(e,{formItemCls:`${e.componentCls}-item`,rootPrefixCls:t}),ge=Ae("Form",(e,{rootPrefixCls:t})=>{const n=Le(e,t);return[Mt(n),Rt(n),Pt(n),_t(n),Lt(n),Tt(n),De(n),we]},zt,{order:-1e3}),Ee=[];function de(e,t,n,r=0){return{key:typeof e=="string"?e:`${t}-${r}`,error:e,errorStatus:n}}const Ve=({help:e,helpStatus:t,errors:n=Ee,warnings:r=Ee,className:a,fieldId:i,onVisibleChanged:u})=>{const{prefixCls:s}=o.useContext(fe),f=`${s}-item-explain`,m=pe(s),[p,d,j]=ge(s,m),_=o.useMemo(()=>$e(s),[s]),P=ie(n),h=ie(r),g=o.useMemo(()=>e!=null?[de(e,"help",t)]:[].concat(D(P.map((c,l)=>de(c,"error","error",l))),D(h.map((c,l)=>de(c,"warning","warning",l)))),[e,t,P,h]),N=o.useMemo(()=>{const c={};return g.forEach(({key:l})=>{c[l]=(c[l]||0)+1}),g.map((l,x)=>Object.assign(Object.assign({},l),{key:c[l.key]>1?`${l.key}-fallback-${x}`:l.key}))},[g]),I={};return i&&(I.id=`${i}_help`),p(o.createElement(Be,{motionDeadline:_.motionDeadline,motionName:`${s}-show-help`,visible:!!N.length,onVisibleChanged:u},c=>{const{className:l,style:x}=c;return o.createElement("div",Object.assign({},I,{className:Y(f,l,j,m,a,d),style:x}),o.createElement(Xe,Object.assign({keys:N},$e(s),{motionName:`${s}-show-help-item`,component:!1}),M=>{const{key:y,error:w,errorStatus:b,className:v,style:S}=M;return o.createElement("div",{key:y,className:Y(v,{[`${f}-${b}`]:b}),style:S},w)}))}))};var qt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};const Ht=(e,t)=>{const n=o.useContext(Ge),{getPrefixCls:r,direction:a,requiredMark:i,colon:u,scrollToFirstError:s,className:f,style:m}=Ke("form"),{prefixCls:p,className:d,rootClassName:j,size:_,disabled:P=n,form:h,colon:g,labelAlign:N,labelWrap:I,labelCol:c,wrapperCol:l,hideRequiredMark:x,layout:M="horizontal",scrollToFirstError:y,requiredMark:w,onFinishFailed:b,name:v,style:S,feedbackIcons:H,variant:W}=e,L=qt(e,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons","variant"]),V=Qe(_),T=o.useContext(Ye),A=o.useMemo(()=>w!==void 0?w:x?!1:i!==void 0?i:!0,[x,w,i]),z=g??u,C=r("form",p),G=pe(C),[q,K,ee]=ge(C,G),se=Y(C,`${C}-${M}`,{[`${C}-hide-required-mark`]:A===!1,[`${C}-rtl`]:a==="rtl",[`${C}-${V}`]:V},ee,G,K,f,d,j),[Q]=Me(h),{__INTERNAL__:k}=Q;k.name=v;const $=o.useMemo(()=>({name:v,labelAlign:N,labelCol:c,labelWrap:I,wrapperCol:l,layout:M,colon:z,requiredMark:A,itemRef:k.itemRef,form:Q,feedbackIcons:H}),[v,N,c,l,M,z,A,Q,H]),R=o.useRef(null);o.useImperativeHandle(t,()=>{var E;return Object.assign(Object.assign({},Q),{nativeElement:(E=R.current)===null||E===void 0?void 0:E.nativeElement})});const O=(E,X)=>{if(E){let J={block:"nearest"};typeof E=="object"&&(J=Object.assign(Object.assign({},J),E)),Q.scrollToField(X,J)}},B=E=>{if(b==null||b(E),E.errorFields.length){const X=E.errorFields[0].name;if(y!==void 0){O(y,X);return}s!==void 0&&O(s,
|