码桶
发现社区成员的开源项目
index-BMbdBPA2.js22 KB
import{E as A,r as x,ag as j,c6 as $,c7 as H,aG as K,aH as z,Z as G,bJ as b,a3 as F,an as Z,$ as T,aL as C,R as m,a6 as Y,ac as W,aK as P,a5 as I,aa as p,aB as J,F as X,a8 as a}from"./index-GWuvg2UH.js";import{f as q}from"./object-DkPZvw8u.js";function Q(l){return x.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},l),x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.64 16.44a1.5 1.5 0 0 1-2.12 0l-5.66-5.66-5.66 5.66a1.5 1.5 0 1 1-2.12-2.12L10.8 7.6a1.5 1.5 0 0 1 2.12 0l6.72 6.72a1.5 1.5 0 0 1 0 2.12Z",fill:"currentColor"}))}const tt=A(Q,"chevron_up");var et=$;function nt(l){return et(l)&&l!=+l}var st=nt;const rt=j(st),it=(l,t)=>{const{isNaN:e}=Number;return e(l)&&e(t)},ot=Object.assign({},K),y=Object.assign(Object.assign({},H),{DEFAULT_STEP:1,DEFAULT_SHIFT_STEP:10,DEFAULT_PRESS_TIMEOUT:250,DEFAULT_PRESS_INTERVAL:0,MOUSE_BUTTON_LEFT:0}),at=Object.assign({},z);function ut(l,t){const e=(l.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=Math.pow(10,Math.max(e,n));return Math.round(l*s+t*s)/s}function U(l,t){return ut(l,-t)}class lt extends G{constructor(){super(...arguments),this._decimalPointSymbol=void 0,this._currencySymbol=""}init(){this._isCurrency()&&this._setCurrencySymbol(),this._setInitValue()}destroy(){this._unregisterInterval(),this._unregisterTimer(),this._adapter.unregisterGlobalEvent("mouseup")}isControlled(){return this._isControlledComponent("value")}_isCurrency(){const{currency:t}=this.getProps();return t===!0||typeof t=="string"&&t.trim()!==""}_getFinalCurrency(){const{currency:t}=this.getProps();return t===!0?this.getProp("defaultCurrency"):t}_doInput(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,s=t,r=t,i=!0;const o=this.isControlled();typeof t!="number"&&(r=this.doParse(t,!1),i=!isNaN(r)),i&&(s=r,o||this._adapter.setNumber(r)),o||this._adapter.setValue(t,n),this.getProp("keepFocus")&&this._adapter.setFocusing(!0,()=>{this._adapter.setClickUpOrDown(!0)}),this.notifyChange(s,e)}_registerInterval(t){const e=this.getProp("pressInterval")||y.DEFAULT_PRESS_INTERVAL;this._intervalHasRegistered=!0,this._interval=setInterval(()=>{typeof t=="function"&&this._intervalHasRegistered&&t()},e)}_unregisterInterval(){this._interval&&(this._intervalHasRegistered=!1,clearInterval(this._interval),this._interval=null)}_registerTimer(t){const e=this.getProp("pressTimeout")||y.DEFAULT_PRESS_TIMEOUT;this._timerHasRegistered=!0,this._timer=setTimeout(()=>{this._timerHasRegistered&&typeof t=="function"&&t()},e)}_unregisterTimer(){this._timer&&(this._timerHasRegistered=!1,clearTimeout(this._timer),this._timer=null)}_setCurrencySymbol(){const{localeCode:t,currencyDisplay:e}=this.getProps(),n=new Intl.NumberFormat(t,{style:"currency",currency:this._getFinalCurrency()||this.getCurrencyByLocaleCode(),currencyDisplay:e}).formatToParts(1234.5);for(const s of n)s.type==="decimal"&&(this._decimalPointSymbol=s.value),s.type==="currency"&&(this._currencySymbol=s.value)}handleInputFocus(t){const e=this.getState("value");if(e!==""&&this._isScientificNotation()&&!this._isCurrency()){const n=b(e);if(/e/i.test(n)&&/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)[eE][+-]?\d+$/.test(n.trim())){const r=this.doParse(n,!1,!1,!1);if(this.isValidNumber(r)){const i=this.doFormat(r,!0,!1);this._adapter.setValue(i)}}}this._adapter.recordCursorPosition(),this._adapter.setFocusing(!0,null),this._adapter.setClickUpOrDown(!1),this._adapter.notifyFocus(t)}handleInputChange(t,e){const n=this.doParse(t,!0,!0,!0),s=this.doParse(t,!1,!1,!1),r=this.afterParser(t);this._adapter.recordCursorPosition();let i,o=s,u=t;if(t==="")this.isControlled()||(o=null);else if(this.isValidNumber(s)&&this.isValidNumber(n))i=s,u=this.doFormat(s,!1);else{if(typeof s=="number"&&!isNaN(s)){u=this.doFormat(s,!1);const c=r.lastIndexOf("."),h=r.length-1-c,f=this._getPrecLen(s);if(f){if(f<h)for(let d=0;d<h-f;d++)u+="0"}else{const d=c>-1?r.slice(c):"";u+=d}o=s}else u=this.doFormat(r,!1);i=this.isControlled()?u:r}!this.isControlled()&&(o===null||typeof o=="number"&&!isNaN(o))&&this._adapter.setNumber(o),this._adapter.setValue(this.isControlled()&&!this._isCurrency()?u:this.doFormat(r,!1),()=>{this._adapter.restoreCursor()}),this.notifyChange(i,e)}handleInputKeyDown(t){const e=t.keyCode;if(e===F.UP||e===F.DOWN){this._adapter.setClickUpOrDown(!0),this._adapter.recordCursorPosition();const n=e===F.UP?this.add(null,t):this.minus(null,t);this._doInput(n,t,()=>{this._adapter.restoreCursor()}),t.preventDefault()}this._adapter.notifyKeyDown(t)}handleInputBlur(t){const e=b(this.getState("value"));let n=this.getState("number");if(n!=null||e!=null&&e!==""){const s=this.doParse(e,!1,!0,!0);let r=!1,i=!1,o,u;if(this.isValidNumber(s)&&n!==s&&(o=s,this.isControlled()||(n=o),r=!0),!this.isValidNumber(s)){const h=parseFloat(e);if(isNaN(h)){if(typeof n=="number"&&!isNaN(n)){const f=this.fetchMinOrMax(n);f!==n&&(o=f,this.isControlled()||(n=o),r=!0)}}else{const f=this.fetchMinOrMax(h);f!==n&&(o=f,this.isControlled()||(n=o),r=!0)}}const c=this.doFormat(n,!0,!0);if(c!==e&&(u=c,i=!0),i||r){const h=u??o;u!=null&&this._adapter.setValue(u),o!=null&&(this._isControlledComponent("value")||this._adapter.setNumber(o)),this.notifyChange(h,t)}}this._adapter.setFocusing(!1),this._adapter.notifyBlur(t)}handleInputMouseEnter(t){this._adapter.setHovering(!0)}handleInputMouseLeave(t){this._adapter.setHovering(!1)}handleInputMouseMove(t){this._adapter.setHovering(!0)}handleMouseUp(t){this._unregisterInterval(),this._unregisterTimer(),this._adapter.unregisterGlobalEvent("mouseup")}handleUpClick(t){const{readonly:e}=this.getProps();!this._isMouseButtonLeft(t)||e||(this._adapter.setClickUpOrDown(!0),t&&(this._persistEvent(t),t.stopPropagation(),this._preventDefault(t)),this.upClick(t),this._registerTimer(()=>{this._registerInterval(()=>{this.upClick(t)})}))}handleDownClick(t){const{readonly:e}=this.getProps();!this._isMouseButtonLeft(t)||e||(this._adapter.setClickUpOrDown(!0),t&&(this._persistEvent(t),t.stopPropagation(),this._preventDefault(t)),this.downClick(t),this._registerTimer(()=>{this._registerInterval(()=>{this.downClick(t)})}))}_isMouseButtonLeft(t){return Z(t,"button")===y.MOUSE_BUTTON_LEFT}_preventDefault(t){const e=this._adapter.getProp("keepFocus"),n=this._adapter.getProp("innerButtons");(e||n)&&t.preventDefault()}handleMouseLeave(t){this._adapter.registerGlobalEvent("mouseup",()=>{this.handleMouseUp(t)})}upClick(t){const e=this.add(null,t);this._doInput(e,t),this._adapter.notifyUpClick(e,t)}downClick(t){const e=this.minus(null,t);this._doInput(e,t),this._adapter.notifyDownClick(e,t)}_setInitValue(){const{defaultValue:t,value:e}=this.getProps(),n=this._isControlledComponent("value")?e:t;let s=n;typeof n=="number"&&!this._isCurrency()?s=this.doFormat(n):this._isCurrency()||(s=b(n));const r=this.doParse(s,!1,!0,!0);let i=null;typeof r=="number"&&!isNaN(r)&&(i=r);const o=typeof i=="number"?this.doFormat(i,!0,!0):"";this._adapter.setNumber(i),this._adapter.setValue(o),T(o)&&o!==String(n??"")&&this.notifyChange(o,null)}add(t,e){const s=e&&e.shiftKey?this.getProp("shiftStep"):this.getProp("step");t=t==null?s:Number(t);const r=Math.abs(C(t)),i=this.getState("number");let o=this.toNumber(i)||0;const u=this.getProp("min"),c=this.getProp("max"),h=this._getPrecLen(u),f=this._getPrecLen(c),d=this._getPrecLen(o),N=this._getPrecLen(t),g=Math.pow(10,Math.max(h,f,d,N));return t<0?Math.abs(U(u,o))>=r&&(o=Math.round(o*g+t*g)/g):t>0&&Math.abs(U(c,o))>=r&&(o=Math.round(o*g+t*g)/g),typeof u=="number"&&u>o&&(o=u),typeof c=="number"&&c<o&&(o=c),this.doFormat(o,!0,this._isCurrency())}minus(t,e){const s=e&&e.shiftKey?this.getProp("shiftStep"):this.getProp("step");return t=t==null?s:Number(t),this.add(-t,e)}_getPrecLen(t){if(typeof t!="string"){const n=Number(t||"");if(!isFinite(n)||n===0)return 0;const s=Math.abs(n).toString();if(/e/i.test(s)){const[r,i]=s.split(/e/i),o=(r.split(".")[1]||"").length;return Math.max(0,o-parseInt(i,10))}t=s}const e=t.indexOf(".")+1;return e?t.length-e:0}_adjustPrec(t){const e=this.getProp("precision");return typeof e=="number"&&t!==""&&t!==null&&!Number.isNaN(Number(t))&&(t=Number(t).toFixed(e)),b(t)}formatCurrency(t){const{localeCode:e,minimumFractionDigits:n,precision:s,maximumFractionDigits:r,currencyDisplay:i,showCurrencySymbol:o}=this.getProps();let u=t;typeof t=="string"&&Number.isNaN(Number(t))&&(u=this.parseInternationalCurrency(t));const h=new Intl.NumberFormat(e,{style:"currency",currency:this._getFinalCurrency()||this.getCurrencyByLocaleCode(),currencyDisplay:i,minimumFractionDigits:n||s||void 0,maximumFractionDigits:r||s||void 0}).format(Number(u));return o?h:h.replace(this._currencySymbol,"").trim()}_isScientificNotation(){const{scientificNotation:t}=this.getProps();return t===!0||typeof t=="object"&&t!==null}_getScientificNotationThreshold(){const{scientificNotation:t}=this.getProps();if(typeof t=="object"&&t!==null){const e=t.threshold;return typeof e=="number"&&Number.isFinite(e)&&e>=1?e:15}return 15}_toScientificNotation(t){const e=this._getScientificNotationThreshold(),n=Math.abs(t),s=String(n),r=/e/i.test(s),i=s.replace(/[.\-+eE]/g,"").replace(/^0+/,"");if((r||i.length>=e)&&n!==0){const o=Math.max(0,Math.min(100,Math.floor(e)-1));return t.toExponential(o).replace(/(\.\d*?)0+e/,"$1e").replace(/\.e/,"e")}return String(t)}doFormat(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{formatter:s}=this.getProps();let r;if(this._isCurrency()&&n?r=this.formatCurrency(t):e?r=this._adjustPrec(t):r=b(t),this._isScientificNotation()&&n&&!this._isCurrency()){const i=typeof t=="number"?t:parseFloat(r);!isNaN(i)&&isFinite(i)&&(r=this._toScientificNotation(i))}return typeof s=="function"&&(r=s(r)),r}fetchMinOrMax(t){const{min:e,max:n}=this.getProps();return t<e?e:t>n?n:t}parseInternationalCurrency(t){let e=t.replace(this._currencySymbol,"").replace(new RegExp(`[^\\d${this._decimalPointSymbol}\\-]`,"g"),"");return this._decimalPointSymbol&&this._decimalPointSymbol!=="."&&(e=e.replace(this._decimalPointSymbol,".")),parseFloat(e)}doParse(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(this._isCurrency()&&typeof t=="string"&&(t=this.parseInternationalCurrency(t)),typeof t=="number")return s&&(t=this.fetchMinOrMax(t)),n&&(t=this._adjustPrec(t)),C(t);const r=this.getProp("parser");if(typeof r=="function"){const i=r(t);t=typeof i=="number"?b(i):i}if(typeof t=="string"&&/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)[eE][+-]?\d+$/.test(t.trim())){const i=parseFloat(t.trim());if(!isNaN(i))return s?this.fetchMinOrMax(i):n?C(this._adjustPrec(i)):i}if(e&&typeof t=="string"){const i=t.indexOf(".")===-1||t.indexOf(".")>-1&&(t==="0"||t.lastIndexOf("0")<t.length-1),o=t.lastIndexOf(".")<t.length-1&&t.split("").filter(u=>u===".").length<2;if(!i||!o)return NaN}return n&&(t=this._adjustPrec(t)),typeof t=="string"&&t.length?s?this.fetchMinOrMax(C(t)):C(t):NaN}afterParser(t){const e=this.getProp("parser");return typeof t=="string"&&typeof e=="function"?b(e(t)):b(t)}toNumber(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof t=="number")return t;if(typeof t=="string"){const{parser:n}=this.getProps();if(this._isCurrency()&&(t=this.parseInternationalCurrency(t)),typeof n=="function"){const s=n(t);t=typeof s=="number"?b(s):s}e&&(t=this._adjustPrec(t))}return C(t)}isValidNumber(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof t=="number"&&!isNaN(t)){const{min:n,max:s,precision:r}=this.getProps(),i=this._getPrecLen(t),o=e?typeof r=="number"&&i<=r||typeof r!="number":!0;if(t>=n&&t<=s&&o)return!0}return!1}isValidString(t){if(typeof t=="string"&&t.length){const e=this.doParse(t);return this.isValidNumber(e)}return!1}notifyChange(t,e){if(t==null||t==="")this._adapter.notifyChange("",e);else{const n=this.toNumber(t,!0);typeof n=="number"&&!isNaN(n)?(this._adapter.notifyChange(n,e),this.notifyNumberChange(n,e)):this._adapter.notifyChange(this.afterParser(t),e)}}notifyNumberChange(t,e){const{number:n}=this.getStates();this.isValidNumber(t)&&t!==n&&this._adapter.notifyNumberChange(t,e)}updateStates(t,e){this._adapter.updateStates(t,e)}getCurrencyByLocaleCode(){const{localeCode:t}=this.getProps(),e={"zh-CN":"CNY","zh-HK":"HKD","zh-TW":"TWD","ja-JP":"JPY","ko-KR":"KRW","th-TH":"THB","vi-VN":"VND","ms-MY":"MYR","id-ID":"IDR","hi-IN":"INR","ar-SA":"SAR","en-GB":"GBP","de-DE":"EUR","fr-FR":"EUR","it-IT":"EUR","es-ES":"EUR","pt-PT":"EUR","ru-RU":"RUB","en-US":"USD","en-CA":"CAD","es-MX":"MXN","pt-BR":"BRL","es-AR":"ARS","en-AU":"AUD","en-NZ":"NZD","en-ZA":"ZAR","ar-EG":"EGP"};if(e[t])return e[t];const n=t.split("-")[0],s={en:"USD",zh:"CNY",es:"EUR",fr:"EUR",de:"EUR",it:"EUR",ja:"JPY",ko:"KRW",ru:"RUB",ar:"SAR"};return s[n]?s[n]:"USD"}}var ct=function(l,t){var e={};for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&t.indexOf(n)<0&&(e[n]=l[n]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(l);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(l,n[s])&&(e[n[s]]=l[n[s]]);return e};class E extends W{get adapter(){var t=this;return Object.assign(Object.assign({},super.adapter),{setValue:(e,n)=>this.setState({value:e},n),setNumber:(e,n)=>this.setState({number:e},n),setFocusing:(e,n)=>this.setState({focusing:e},n),setHovering:e=>this.setState({hovering:e}),notifyChange:function(){return t.props.onChange(...arguments)},notifyNumberChange:function(){return t.props.onNumberChange(...arguments)},notifyBlur:e=>this.props.onBlur(e),notifyFocus:e=>this.props.onFocus(e),notifyUpClick:(e,n)=>this.props.onUpClick(e,n),notifyDownClick:(e,n)=>this.props.onDownClick(e,n),notifyKeyDown:e=>this.props.onKeyDown(e),registerGlobalEvent:(e,n)=>{e&&typeof n=="function"&&(this.adapter.unregisterGlobalEvent(e),this.adapter.setCache(e,n),document.addEventListener(e,n))},unregisterGlobalEvent:e=>{if(e){const n=this.adapter.getCache(e);document.removeEventListener(e,n),this.adapter.setCache(e,null)}},getInputCharacter:e=>this.inputNode.value[e],recordCursorPosition:()=>{try{this.inputNode&&(this.cursorStart=this.inputNode.selectionStart,this.cursorEnd=this.inputNode.selectionEnd,this.currentValue=this.inputNode.value,this.cursorBefore=this.inputNode.value.substring(0,this.cursorStart),this.cursorAfter=this.inputNode.value.substring(this.cursorEnd))}catch(e){console.warn(e)}},restoreByAfter:e=>{if(P(e))return!1;const n=this.inputNode.value,s=n.lastIndexOf(e);return s===-1?!1:s+e.length===n.length?(this.adapter.fixCaret(s,s),!0):!1},restoreCursor:function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:t.cursorAfter;return P(e)?!1:Array.prototype.some.call(e,(n,s)=>{const r=e.substring(s);return t.adapter.restoreByAfter(r)})},fixCaret:(e,n)=>{if(!(e===void 0||n===void 0||!this.inputNode||!this.inputNode.value))try{const s=this.inputNode.selectionStart,r=this.inputNode.selectionEnd;(e!==s||n!==r)&&this.inputNode.setSelectionRange(e,n)}catch{}},setClickUpOrDown:e=>{this.clickUpOrDown=e},updateStates:(e,n)=>{this.setState(e,n)}})}constructor(t){super(t),this.setInputRef=n=>{const{forwardedRef:s}=this.props;this.inputNode=n,s&&typeof s=="object"?s.current=n:typeof s=="function"&&s(n)},this.handleInputFocus=n=>this.foundation.handleInputFocus(n),this.handleInputChange=(n,s)=>this.foundation.handleInputChange(n,s),this.handleInputBlur=n=>this.foundation.handleInputBlur(n),this.handleInputKeyDown=n=>this.foundation.handleInputKeyDown(n),this.handleInputMouseEnter=n=>this.foundation.handleInputMouseEnter(n),this.handleInputMouseLeave=n=>this.foundation.handleInputMouseLeave(n),this.handleInputMouseMove=n=>this.foundation.handleInputMouseMove(n),this.handleUpClick=n=>this.foundation.handleUpClick(n),this.handleDownClick=n=>this.foundation.handleDownClick(n),this.handleMouseUp=n=>this.foundation.handleMouseUp(n),this.handleMouseLeave=n=>this.foundation.handleMouseLeave(n),this.renderButtons=()=>{const{prefixCls:n,disabled:s,innerButtons:r,max:i,min:o}=this.props,{hovering:u,focusing:c,number:h}=this.state,f=s||h===i,d=s||h===o,N=I(`${n}-number-suffix-btns`,{[`${n}-number-suffix-btns-inner`]:r,[`${n}-number-suffix-btns-inner-hover`]:r&&u&&!c}),g=I(`${n}-number-button`,`${n}-number-button-up`,{[`${n}-number-button-up-disabled`]:s,[`${n}-number-button-up-not-allowed`]:f}),M=I(`${n}-number-button`,`${n}-number-button-down`,{[`${n}-number-button-down-disabled`]:s,[`${n}-number-button-down-not-allowed`]:d});return m.createElement("div",{className:N},m.createElement("span",{className:g,onMouseDown:f?p:this.handleUpClick,onMouseUp:this.handleMouseUp,onMouseLeave:this.handleMouseLeave},m.createElement(tt,{size:"extra-small"})),m.createElement("span",{className:M,onMouseDown:d?p:this.handleDownClick,onMouseUp:this.handleMouseUp,onMouseLeave:this.handleMouseLeave},m.createElement(J,{size:"extra-small"})))},this.renderSuffix=()=>{const{innerButtons:n,suffix:s}=this.props,{hovering:r,focusing:i}=this.state;return n&&(r||i)?this.renderButtons():s},this.foundation=new lt(this.adapter),this.inputNode=null,this.clickUpOrDown=!1;const e=this._getInitState(t);this.state={value:e.value,number:e.number,focusing:!!t.autofocus||!1,hovering:!1}}_getInitState(t){const e=this.isControlled("value")?t.value:t.defaultValue;if(P(e)||e==="")return{value:"",number:null};if(t.currency===!0||typeof t.currency=="string"&&t.currency.trim()!==""){if(typeof e=="number"){const i=this.foundation.doParse(e,!1,!0,!0);return this.foundation.isValidNumber(i)?{value:this.foundation.doFormat(i,!0,!1),number:i}:{value:"",number:null}}return{value:String(e),number:null}}let s=e;typeof e=="number"&&(s=this.foundation.doFormat(e));const r=this.foundation.doParse(s,!1,!0,!0);return this.foundation.isValidNumber(r)?{value:this.foundation.doFormat(r,!0,!0),number:r}:{value:"",number:null}}componentDidUpdate(t){const{value:e,preventScroll:n}=this.props,{focusing:s}=this.state;let r;if(e!==t.value&&!it(e,t.value)){if(P(e)||e==="")r="",this.foundation.updateStates({value:r,number:null});else{let i=e;typeof e=="number"&&(i=this.foundation.doFormat(e));const o=this.foundation.doParse(i,!1,!0,!0),u=typeof e=="number"?e:this.foundation.doParse(i,!1,!1,!1);if(s)if(this.foundation.isValidNumber(o)&&o!==this.state.number){const c={number:o};this.clickUpOrDown&&(c.value=this.foundation.doFormat(c.number,!0),r=c.value),this.foundation.updateStates(c,()=>this.adapter.restoreCursor())}else rt(u)?this.foundation.updateStates({value:i}):(r=this.foundation.doFormat(u,!1),this.foundation.updateStates({value:r}));else this.foundation.isValidNumber(o)?(r=this.foundation.doFormat(o,!0,!0),this.foundation.updateStates({number:o,value:r})):(r="",this.foundation.updateStates({number:null,value:r}))}if(r&&T(r)&&r!==String(this.props.value))if(this.foundation._isCurrency()){const i=this.foundation.doParse(r),o=typeof this.props.value=="string"?this.foundation.doParse(this.props.value):this.props.value;i!==o&&this.foundation.notifyChange(r,null)}else this.foundation.notifyChange(r,null)}this.clickUpOrDown&&this.props.keepFocus&&this.state.focusing&&document.activeElement!==this.inputNode&&this.inputNode.focus({preventScroll:n})}render(){const t=this.props,{disabled:e,className:n,prefixCls:s,min:r,max:i,step:o,shiftStep:u,precision:c,formatter:h,parser:f,forwardedRef:d,onUpClick:N,onDownClick:g,pressInterval:M,pressTimeout:ht,suffix:ft,size:D,hideButtons:v,innerButtons:R,style:L,onNumberChange:dt,keepFocus:pt,defaultValue:mt,defaultCurrency:gt,currency:bt,currencyDisplay:yt,minimumFractionDigits:Ct,maximumFractionDigits:_t,showCurrencySymbol:Nt,localeCode:St}=t,O=ct(t,["disabled","className","prefixCls","min","max","step","shiftStep","precision","formatter","parser","forwardedRef","onUpClick","onDownClick","pressInterval","pressTimeout","suffix","size","hideButtons","innerButtons","style","onNumberChange","keepFocus","defaultValue","defaultCurrency","currency","currencyDisplay","minimumFractionDigits","maximumFractionDigits","showCurrencySymbol","localeCode"]),{value:V,number:w}=this.state,k=I(n,`${s}-number`,{[`${s}-number-size-${D}`]:D}),B=this.renderButtons(),S={"aria-disabled":e,step:o};return w&&(S["aria-valuenow"]=w),i!==1/0&&(S["aria-valuemax"]=i),r!==-1/0&&(S["aria-valuemin"]=r),m.createElement("div",{className:k,style:L,onMouseMove:_=>this.handleInputMouseMove(_),onMouseEnter:_=>this.handleInputMouseEnter(_),onMouseLeave:_=>this.handleInputMouseLeave(_)},m.createElement(X,Object.assign({role:"spinbutton"},S,O,{size:D,disabled:e,ref:this.setInputRef,value:V,onFocus:this.handleInputFocus,onChange:this.handleInputChange,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,suffix:this.renderSuffix()})),v||R?null:B)}}E.propTypes={"aria-label":a.string,"aria-labelledby":a.string,"aria-invalid":a.bool,"aria-errormessage":a.string,"aria-describedby":a.string,"aria-required":a.bool,autofocus:a.bool,clearIcon:a.node,className:a.string,defaultValue:a.oneOfType([a.number,a.string]),disabled:a.bool,formatter:a.func,forwardedRef:a.any,hideButtons:a.bool,innerButtons:a.bool,insetLabel:a.node,insetLabelId:a.string,keepFocus:a.bool,max:a.number,min:a.number,parser:a.func,precision:a.number,prefixCls:a.string,pressInterval:a.number,pressTimeout:a.number,preventScroll:a.bool,shiftStep:a.number,showCurrencySymbol:a.bool,step:a.number,style:a.object,suffix:a.any,value:a.oneOfType([a.number,a.string]),scientificNotation:a.oneOfType([a.bool,a.object]),onBlur:a.func,onChange:a.func,onDownClick:a.func,onKeyDown:a.func,onNumberChange:a.func,onUpClick:a.func};E.defaultProps={forwardedRef:p,innerButtons:!1,keepFocus:!1,max:1/0,min:-1/0,prefixCls:ot.PREFIX,pressInterval:y.DEFAULT_PRESS_TIMEOUT,pressTimeout:y.DEFAULT_PRESS_TIMEOUT,shiftStep:y.DEFAULT_SHIFT_STEP,showCurrencySymbol:!0,size:at.DEFAULT_SIZE,step:y.DEFAULT_STEP,onBlur:p,onChange:p,onDownClick:p,onFocus:p,onKeyDown:p,onNumberChange:p,onUpClick:p};const Dt=q(m.forwardRef(function(t,e){return m.createElement(Y,{componentName:"InputNumber"},(n,s,r,i)=>m.createElement(E,Object.assign({localeCode:s,defaultCurrency:i},t,{forwardedRef:e})))}),E);export{Dt as I};