13 lines
9.8 KiB
JavaScript
13 lines
9.8 KiB
JavaScript
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[913],{22913:function(vt,Re,o){o.d(Re,{Z:function(){return qe}});var a=o(67294),Ae=o(93967),E=o.n(Ae),me=o(87462),re=o(4942),V=o(1413),Ze=o(74902),$=o(97685),ge=o(91),Ee=o(67656),we=o(82234),xe=o(87887),he=o(21770),Te=o(71002),Ne=o(9220),Se=o(8410),pe=o(75164),Ie=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important;
|
|
pointer-events: none !important;
|
|
`,Oe=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],oe={},S;function Ve(e){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(p&&oe[r])return oe[r];var n=window.getComputedStyle(e),u=n.getPropertyValue("box-sizing")||n.getPropertyValue("-moz-box-sizing")||n.getPropertyValue("-webkit-box-sizing"),m=parseFloat(n.getPropertyValue("padding-bottom"))+parseFloat(n.getPropertyValue("padding-top")),i=parseFloat(n.getPropertyValue("border-bottom-width"))+parseFloat(n.getPropertyValue("border-top-width")),v=Oe.map(function(f){return"".concat(f,":").concat(n.getPropertyValue(f))}).join(";"),y={sizingStyle:v,paddingSize:m,borderSize:i,boxSizing:u};return p&&r&&(oe[r]=y),y}function $e(e){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;S||(S=document.createElement("textarea"),S.setAttribute("tab-index","-1"),S.setAttribute("aria-hidden","true"),S.setAttribute("name","hiddenTextarea"),document.body.appendChild(S)),e.getAttribute("wrap")?S.setAttribute("wrap",e.getAttribute("wrap")):S.removeAttribute("wrap");var u=Ve(e,p),m=u.paddingSize,i=u.borderSize,v=u.boxSizing,y=u.sizingStyle;S.setAttribute("style","".concat(y,";").concat(Ie)),S.value=e.value||e.placeholder||"";var f=void 0,d=void 0,b,C=S.scrollHeight;if(v==="border-box"?C+=i:v==="content-box"&&(C-=m),r!==null||n!==null){S.value=" ";var w=S.scrollHeight-m;r!==null&&(f=w*r,v==="border-box"&&(f=f+m+i),C=Math.max(f,C)),n!==null&&(d=w*n,v==="border-box"&&(d=d+m+i),b=C>d?"":"hidden",C=Math.min(d,C))}var h={height:C,overflowY:b,resize:"none"};return f&&(h.minHeight=f),d&&(h.maxHeight=d),h}var Pe=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],le=0,se=1,ie=2,Fe=a.forwardRef(function(e,p){var r=e,n=r.prefixCls,u=r.defaultValue,m=r.value,i=r.autoSize,v=r.onResize,y=r.className,f=r.style,d=r.disabled,b=r.onChange,C=r.onInternalAutoSize,w=(0,ge.Z)(r,Pe),h=(0,he.Z)(u,{value:m,postState:function(x){return x!=null?x:""}}),P=(0,$.Z)(h,2),Q=P[0],k=P[1],F=function(x){k(x.target.value),b==null||b(x)},t=a.useRef();a.useImperativeHandle(p,function(){return{textArea:t.current}});var j=a.useMemo(function(){return i&&(0,Te.Z)(i)==="object"?[i.minRows,i.maxRows]:[]},[i]),g=(0,$.Z)(j,2),z=g[0],M=g[1],W=!!i,U=function(){try{if(document.activeElement===t.current){var x=t.current,ue=x.selectionStart,de=x.selectionEnd,te=x.scrollTop;t.current.setSelectionRange(ue,de),t.current.scrollTop=te}}catch(ae){}},G=a.useState(ie),Z=(0,$.Z)(G,2),s=Z[0],D=Z[1],q=a.useState(),L=(0,$.Z)(q,2),Y=L[0],J=L[1],H=function(){D(le)};(0,Se.Z)(function(){W&&H()},[m,z,M,W]),(0,Se.Z)(function(){if(s===le)D(se);else if(s===se){var O=$e(t.current,!1,z,M);D(ie),J(O)}else U()},[s]);var X=a.useRef(),T=function(){pe.Z.cancel(X.current)},N=function(x){s===ie&&(v==null||v(x),i&&(T(),X.current=(0,pe.Z)(function(){H()})))};a.useEffect(function(){return T},[]);var I=W?Y:null,R=(0,V.Z)((0,V.Z)({},f),I);return(s===le||s===se)&&(R.overflowY="hidden",R.overflowX="hidden"),a.createElement(Ne.Z,{onResize:N,disabled:!(i||v)},a.createElement("textarea",(0,me.Z)({},w,{ref:t,style:R,className:E()(n,y,(0,re.Z)({},"".concat(n,"-disabled"),d)),disabled:d,value:Q,onChange:F})))}),je=Fe,Me=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],De=a.forwardRef(function(e,p){var r,n=e.defaultValue,u=e.value,m=e.onFocus,i=e.onBlur,v=e.onChange,y=e.allowClear,f=e.maxLength,d=e.onCompositionStart,b=e.onCompositionEnd,C=e.suffix,w=e.prefixCls,h=w===void 0?"rc-textarea":w,P=e.showCount,Q=e.count,k=e.className,F=e.style,t=e.disabled,j=e.hidden,g=e.classNames,z=e.styles,M=e.onResize,W=e.onClear,U=e.onPressEnter,G=e.readOnly,Z=e.autoSize,s=e.onKeyDown,D=(0,ge.Z)(e,Me),q=(0,he.Z)(n,{value:u,defaultValue:n}),L=(0,$.Z)(q,2),Y=L[0],J=L[1],H=Y==null?"":String(Y),X=a.useState(!1),T=(0,$.Z)(X,2),N=T[0],I=T[1],R=a.useRef(!1),O=a.useState(null),x=(0,$.Z)(O,2),ue=x[0],de=x[1],te=(0,a.useRef)(null),ae=(0,a.useRef)(null),B=function(){var l;return(l=ae.current)===null||l===void 0?void 0:l.textArea},ye=function(){B().focus()};(0,a.useImperativeHandle)(p,function(){var c;return{resizableTextArea:ae.current,focus:ye,blur:function(){B().blur()},nativeElement:((c=te.current)===null||c===void 0?void 0:c.nativeElement)||B()}}),(0,a.useEffect)(function(){I(function(c){return!t&&c})},[t]);var _e=a.useState(null),be=(0,$.Z)(_e,2),ce=be[0],et=be[1];a.useEffect(function(){if(ce){var c;(c=B()).setSelectionRange.apply(c,(0,Ze.Z)(ce))}},[ce]);var A=(0,we.Z)(Q,P),_=(r=A.max)!==null&&r!==void 0?r:f,tt=Number(_)>0,ve=A.strategy(H),at=!!_&&ve>_,ze=function(l,K){var ne=K;!R.current&&A.exceedFormatter&&A.max&&A.strategy(K)>A.max&&(ne=A.exceedFormatter(K,{max:A.max}),K!==ne&&et([B().selectionStart||0,B().selectionEnd||0])),J(ne),(0,xe.rJ)(l.currentTarget,l,v,ne)},nt=function(l){R.current=!0,d==null||d(l)},rt=function(l){R.current=!1,ze(l,l.currentTarget.value),b==null||b(l)},ot=function(l){ze(l,l.target.value)},lt=function(l){l.key==="Enter"&&U&&U(l),s==null||s(l)},st=function(l){I(!0),m==null||m(l)},it=function(l){I(!1),i==null||i(l)},ut=function(l){J(""),ye(),(0,xe.rJ)(B(),l,v)},fe=C,ee;A.show&&(A.showFormatter?ee=A.showFormatter({value:H,count:ve,maxLength:_}):ee="".concat(ve).concat(tt?" / ".concat(_):""),fe=a.createElement(a.Fragment,null,fe,a.createElement("span",{className:E()("".concat(h,"-data-count"),g==null?void 0:g.count),style:z==null?void 0:z.count},ee)));var dt=function(l){var K;M==null||M(l),(K=B())!==null&&K!==void 0&&K.style.height&&de(!0)},ct=!Z&&!P&&!y;return a.createElement(Ee.Q,{ref:te,value:H,allowClear:y,handleReset:ut,suffix:fe,prefixCls:h,classNames:(0,V.Z)((0,V.Z)({},g),{},{affixWrapper:E()(g==null?void 0:g.affixWrapper,(0,re.Z)((0,re.Z)({},"".concat(h,"-show-count"),P),"".concat(h,"-textarea-allow-clear"),y))}),disabled:t,focused:N,className:E()(k,at&&"".concat(h,"-out-of-range")),style:(0,V.Z)((0,V.Z)({},F),ue&&!ct?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof ee=="string"?ee:void 0}},hidden:j,readOnly:G,onClear:W},a.createElement(je,(0,me.Z)({},D,{autoSize:Z,maxLength:f,onKeyDown:lt,onChange:ot,onFocus:st,onBlur:it,onCompositionStart:nt,onCompositionEnd:rt,className:E()(g==null?void 0:g.textarea),style:(0,V.Z)((0,V.Z)({},z==null?void 0:z.textarea),{},{resize:F==null?void 0:F.resize}),disabled:t,prefixCls:h,onResize:dt,ref:ae,readOnly:G})))}),Le=De,He=Le,Be=o(78290),Ce=o(9708),Ke=o(53124),We=o(98866),Ye=o(35792),Ue=o(98675),Ge=o(65223),Je=o(27833),Xe=o(82586),Qe=o(47673),ke=function(e,p){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&p.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,n=Object.getOwnPropertySymbols(e);u<n.length;u++)p.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]]);return r},qe=(0,a.forwardRef)((e,p)=>{var r,n;const{prefixCls:u,bordered:m=!0,size:i,disabled:v,status:y,allowClear:f,classNames:d,rootClassName:b,className:C,style:w,styles:h,variant:P}=e,Q=ke(e,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant"]),{getPrefixCls:k,direction:F,textArea:t}=a.useContext(Ke.E_),j=(0,Ue.Z)(i),g=a.useContext(We.Z),z=v!=null?v:g,{status:M,hasFeedback:W,feedbackIcon:U}=a.useContext(Ge.aM),G=(0,Ce.F)(M,y),Z=a.useRef(null);a.useImperativeHandle(p,()=>{var T;return{resizableTextArea:(T=Z.current)===null||T===void 0?void 0:T.resizableTextArea,focus:N=>{var I,R;(0,Xe.n)((R=(I=Z.current)===null||I===void 0?void 0:I.resizableTextArea)===null||R===void 0?void 0:R.textArea,N)},blur:()=>{var N;return(N=Z.current)===null||N===void 0?void 0:N.blur()}}});const s=k("input",u),D=(0,Ye.Z)(s),[q,L,Y]=(0,Qe.ZP)(s,D),[J,H]=(0,Je.Z)("textArea",P,m),X=(0,Be.Z)(f!=null?f:t==null?void 0:t.allowClear);return q(a.createElement(He,Object.assign({autoComplete:t==null?void 0:t.autoComplete},Q,{style:Object.assign(Object.assign({},t==null?void 0:t.style),w),styles:Object.assign(Object.assign({},t==null?void 0:t.styles),h),disabled:z,allowClear:X,className:E()(Y,D,C,b,t==null?void 0:t.className),classNames:Object.assign(Object.assign(Object.assign({},d),t==null?void 0:t.classNames),{textarea:E()({[`${s}-sm`]:j==="small",[`${s}-lg`]:j==="large"},L,d==null?void 0:d.textarea,(r=t==null?void 0:t.classNames)===null||r===void 0?void 0:r.textarea),variant:E()({[`${s}-${J}`]:H},(0,Ce.Z)(s,G)),affixWrapper:E()(`${s}-textarea-affix-wrapper`,{[`${s}-affix-wrapper-rtl`]:F==="rtl",[`${s}-affix-wrapper-sm`]:j==="small",[`${s}-affix-wrapper-lg`]:j==="large",[`${s}-textarea-show-count`]:e.showCount||((n=e.count)===null||n===void 0?void 0:n.show)},L)}),prefixCls:s,suffix:W&&a.createElement("span",{className:`${s}-textarea-suffix`},U),ref:Z})))})}}]);
|