katoikia-app/web-ui/web-react/node_modules/primereact/inputnumber/inputnumber.min.js

2 lines
25 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.inputnumber=function(e,t,n,i,s,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(t);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function l(e){if(Array.isArray(e))return u(e)}function p(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function v(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function b(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function k(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var C=function(e){v(C,e);var o,u,y,g,w,D=(o=C,u=k(),function(){var e,t=x(o);if(u){var n=x(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return b(this,e)});function C(e){var n;return f(this,C),(n=D.call(this,e)).state={focused:!1},n.constructParser(),n.onInput=n.onInput.bind(m(n)),n.onInputKeyDown=n.onInputKeyDown.bind(m(n)),n.onInputKeyPress=n.onInputKeyPress.bind(m(n)),n.onInputClick=n.onInputClick.bind(m(n)),n.onInputBlur=n.onInputBlur.bind(m(n)),n.onInputFocus=n.onInputFocus.bind(m(n)),n.onPaste=n.onPaste.bind(m(n)),n.onUpButtonMouseLeave=n.onUpButtonMouseLeave.bind(m(n)),n.onUpButtonMouseDown=n.onUpButtonMouseDown.bind(m(n)),n.onUpButtonMouseUp=n.onUpButtonMouseUp.bind(m(n)),n.onUpButtonKeyDown=n.onUpButtonKeyDown.bind(m(n)),n.onUpButtonKeyUp=n.onUpButtonKeyUp.bind(m(n)),n.onDownButtonMouseLeave=n.onDownButtonMouseLeave.bind(m(n)),n.onDownButtonMouseDown=n.onDownButtonMouseDown.bind(m(n)),n.onDownButtonMouseUp=n.onDownButtonMouseUp.bind(m(n)),n.onDownButtonKeyDown=n.onDownButtonKeyDown.bind(m(n)),n.onDownButtonKeyUp=n.onDownButtonKeyUp.bind(m(n)),n.inputRef=t.createRef(n.props.inputRef),n}return y=C,g=[{key:"getOptions",value:function(){return{localeMatcher:this.props.localeMatcher,style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,useGrouping:this.props.useGrouping,minimumFractionDigits:this.props.minFractionDigits,maximumFractionDigits:this.props.maxFractionDigits}}},{key:"constructParser",value:function(){this.numberFormat=new Intl.NumberFormat(this.props.locale,this.getOptions());var e,t=(e=new Intl.NumberFormat(this.props.locale,{useGrouping:!1}).format(9876543210),l(e)||p(e)||c(e)||h()).reverse(),n=new Map(t.map((function(e,t){return[e,t]})));this._numeral=new RegExp("[".concat(t.join(""),"]"),"g"),this._group=this.getGroupingExpression(),this._minusSign=this.getMinusSignExpression(),this._currency=this.getCurrencyExpression(),this._decimal=this.getDecimalExpression(),this._suffix=this.getSuffixExpression(),this._prefix=this.getPrefixExpression(),this._index=function(e){return n.get(e)}}},{key:"escapeRegExp",value:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}},{key:"getDecimalExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,I(I({},this.getOptions()),{},{useGrouping:!1}));return new RegExp("[".concat(e.format(1.1).replace(this._currency,"").trim().replace(this._numeral,""),"]"),"g")}},{key:"getGroupingExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,{useGrouping:!0});return this.groupChar=e.format(1e6).trim().replace(this._numeral,"").charAt(0),new RegExp("[".concat(this.groupChar,"]"),"g")}},{key:"getMinusSignExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,{useGrouping:!1});return new RegExp("[".concat(e.format(-1).trim().replace(this._numeral,""),"]"),"g")}},{key:"getCurrencyExpression",value:function(){if(this.props.currency){var e=new Intl.NumberFormat(this.props.locale,{style:"currency",currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});return new RegExp("[".concat(e.format(1).replace(/\s/g,"").replace(this._numeral,"").replace(this._group,""),"]"),"g")}return new RegExp("[]","g")}},{key:"getPrefixExpression",value:function(){if(this.props.prefix)this.prefixChar=this.props.prefix;else{var e=new Intl.NumberFormat(this.props.locale,{style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay});this.prefixChar=e.format(1).split("1")[0]}return new RegExp("".concat(this.escapeRegExp(this.prefixChar||"")),"g")}},{key:"getSuffixExpression",value:function(){if(this.props.suffix)this.suffixChar=this.props.suffix;else{var e=new Intl.NumberFormat(this.props.locale,{style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});this.suffixChar=e.format(1).split("1")[1]}return new RegExp("".concat(this.escapeRegExp(this.suffixChar||"")),"g")}},{key:"formatValue",value:function(e){if(null!=e){if("-"===e)return e;if(this.props.format){var t=new Intl.NumberFormat(this.props.locale,this.getOptions()).format(e);return this.props.prefix&&(t=this.props.prefix+t),this.props.suffix&&(t+=this.props.suffix),t}return e.toString()}return""}},{key:"parseValue",value:function(e){var t=e.replace(this._suffix,"").replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").replace(this._group,"").replace(this._minusSign,"-").replace(this._decimal,".").replace(this._numeral,this._index);if(t){if("-"===t)return t;var n=+t;return isNaN(n)?null:n}return null}},{key:"repeat",value:function(e,t,n){var i=this,s=t||500;this.clearTimer(),this.timer=setTimeout((function(){i.repeat(e,40,n)}),s),this.spin(e,n)}},{key:"spin",value:function(e,t){if(this.inputRef&&this.inputRef.current){var n=this.props.step*t,i=this.parseValue(this.inputRef.current.value)||0,s=this.validateValue(i+n);this.updateInput(s,null,"spin"),this.updateModel(e,s),this.handleOnChange(e,i,s)}}},{key:"onUpButtonMouseDown",value:function(e){this.props.disabled||this.props.readOnly||(this.inputRef.current.focus(),this.repeat(e,null,1),e.preventDefault())}},{key:"onUpButtonMouseUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonMouseLeave",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonKeyUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonKeyDown",value:function(e){this.props.disabled||this.props.readOnly||32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,1)}},{key:"onDownButtonMouseDown",value:function(e){this.props.disabled||this.props.readOnly||(this.inputRef.current.focus(),this.repeat(e,null,-1),e.preventDefault())}},{key:"onDownButtonMouseUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonMouseLeave",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonKeyUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonKeyDown",value:function(e){this.props.disabled||this.props.readOnly||32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,-1)}},{key:"onInput",value:function(e){this.props.disabled||this.props.readOnly||(this.isSpecialChar&&(e.target.value=this.lastValue),this.isSpecialChar=!1)}},{key:"onInputKeyDown",value:function(e){if(!this.props.disabled&&!this.props.readOnly)if(this.lastValue=e.target.value,e.shiftKey||e.altKey)this.isSpecialChar=!0;else{var t=e.target.selectionStart,n=e.target.selectionEnd,i=e.target.value,s=null;switch(e.altKey&&e.preventDefault(),e.which){case 38:this.spin(e,1),e.preventDefault();break;case 40:this.spin(e,-1),e.preventDefault();break;case 37:this.isNumeralChar(i.charAt(t-1))||e.preventDefault();break;case 39:this.isNumeralChar(i.charAt(t))||e.preventDefault();break;case 13:s=this.validateValue(this.parseValue(i)),this.inputRef.current.value=this.formatValue(s),this.inputRef.current.setAttribute("aria-valuenow",s),this.updateModel(e,s);break;case 8:if(e.preventDefault(),t===n){var r=i.charAt(t-1),o=this.getDecimalCharIndexes(i),a=o.decimalCharIndex,u=o.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(r)){var l=this.getDecimalLength(i);if(this._group.test(r))this._group.lastIndex=0,s=i.slice(0,t-2)+i.slice(t-1);else if(this._decimal.test(r))this._decimal.lastIndex=0,l?this.inputRef.current.setSelectionRange(t-1,t-1):s=i.slice(0,t-1)+i.slice(t);else if(a>0&&t>a){var p=this.isDecimalMode()&&(this.props.minFractionDigits||0)<l?"":"0";s=i.slice(0,t-1)+p+i.slice(t)}else 1===u?(s=i.slice(0,t-1)+"0"+i.slice(t),s=this.parseValue(s)>0?s:""):s=i.slice(0,t-1)+i.slice(t)}this.updateValue(e,s,null,"delete-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case 46:if(e.preventDefault(),t===n){var c=i.charAt(t),h=this.getDecimalCharIndexes(i),f=h.decimalCharIndex,d=h.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(c)){var m=this.getDecimalLength(i);if(this._group.test(c))this._group.lastIndex=0,s=i.slice(0,t)+i.slice(t+2);else if(this._decimal.test(c))this._decimal.lastIndex=0,m?this.$refs.input.$el.setSelectionRange(t+1,t+1):s=i.slice(0,t)+i.slice(t+1);else if(f>0&&t>f){var y=this.isDecimalMode()&&(this.props.minFractionDigits||0)<m?"":"0";s=i.slice(0,t)+y+i.slice(t+1)}else 1===d?(s=i.slice(0,t)+"0"+i.slice(t+1),s=this.parseValue(s)>0?s:""):s=i.slice(0,t)+i.slice(t+1)}this.updateValue(e,s,null,"delete-back-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range")}this.props.onKeyDown&&this.props.onKeyDown(e)}}},{key:"onInputKeyPress",value:function(e){if(!this.props.disabled&&!this.props.readOnly){var t=e.which||e.keyCode,n=String.fromCharCode(t),i=this.isDecimalSign(n),s=this.isMinusSign(n);(48<=t&&t<=57||s||i)&&(this.insert(e,n,{isDecimalSign:i,isMinusSign:s}),e.preventDefault())}}},{key:"onPaste",value:function(e){if(e.preventDefault(),!this.props.disabled&&!this.props.readOnly){var t=(e.clipboardData||window.clipboardData).getData("Text");if(t){var n=this.parseValue(t);null!=n&&this.insert(e,n.toString())}}}},{key:"allowMinusSign",value:function(){return null===this.props.min||this.props.min<0}},{key:"isMinusSign",value:function(e){return!(!this._minusSign.test(e)&&"-"!==e||(this._minusSign.lastIndex=0,0))}},{key:"isDecimalSign",value:function(e){return!!this._decimal.test(e)&&(this._decimal.lastIndex=0,!0)}},{key:"isDecimalMode",value:function(){return"decimal"===this.props.mode}},{key:"getDecimalCharIndexes",value:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").search(this._decimal);return this._decimal.lastIndex=0,{decimalCharIndex:t,decimalCharIndexWithoutPrefix:n}}},{key:"getCharIndexes",value:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.search(this._minusSign);this._minusSign.lastIndex=0;var i=e.search(this._suffix);this._suffix.lastIndex=0;var s=e.search(this._currency);return this._currency.lastIndex=0,{decimalCharIndex:t,minusCharIndex:n,suffixCharIndex:i,currencyCharIndex:s}}},{key:"insert",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{isDecimalSign:!1,isMinusSign:!1},i=t.search(this._minusSign);if(this._minusSign.lastIndex=0,this.allowMinusSign()||-1===i){var s,r=this.inputRef.current.selectionStart,o=this.inputRef.current.selectionEnd,a=this.inputRef.current.value.trim(),u=this.getCharIndexes(a),l=u.decimalCharIndex,p=u.minusCharIndex,c=u.suffixCharIndex,h=u.currencyCharIndex;if(n.isMinusSign)0===r&&(s=a,-1!==p&&0===o||(s=this.insertText(a,t,0,o)),this.updateValue(e,s,t,"insert"));else if(n.isDecimalSign)l>0&&r===l?this.updateValue(e,a,t,"insert"):(l>r&&l<o||-1===l&&this.props.maxFractionDigits)&&(s=this.insertText(a,t,r,o),this.updateValue(e,s,t,"insert"));else{var f=this.numberFormat.resolvedOptions().maximumFractionDigits,d=r!==o?"range-insert":"insert";if(l>0&&r>l){if(r+t.length-(l+1)<=f){var m=h>=r?h-1:c>=r?c:a.length;s=a.slice(0,r)+t+a.slice(r+t.length,m)+a.slice(m),this.updateValue(e,s,t,d)}}else s=this.insertText(a,t,r,o),this.updateValue(e,s,t,d)}}}},{key:"insertText",value:function(e,t,n,i){if(2===("."===t?t:t.split(".")).length){var s=e.slice(n,i).search(this._decimal);return this._decimal.lastIndex=0,s>0?e.slice(0,n)+this.formatValue(t)+e.slice(i):e||this.formatValue(t)}return i-n===e.length?this.formatValue(t):0===n?t+e.slice(i):i===e.length?e.slice(0,n)+t:e.slice(0,n)+t+e.slice(i)}},{key:"deleteRange",value:function(e,t,n){return n-t===e.length?"":0===t?e.slice(n):n===e.length?e.slice(0,t):e.slice(0,t)+e.slice(n)}},{key:"initCursor",value:function(){var e=this.inputRef.current.selectionStart,t=this.inputRef.current.value,n=t.length,i=null,s=(this.prefixChar||"").length,r=(t=t.replace(this._prefix,"")).charAt(e-=s);if(this.isNumeralChar(r))return e+s;for(var o=e-1;o>=0;){if(r=t.charAt(o),this.isNumeralChar(r)){i=o+s;break}o--}if(null!==i)this.inputRef.current.setSelectionRange(i+1,i+1);else{for(o=e;o<n;){if(r=t.charAt(o),this.isNumeralChar(r)){i=o+s;break}o++}null!==i&&this.inputRef.current.setSelectionRange(i,i)}return i||0}},{key:"onInputClick",value:function(){this.initCursor()}},{key:"isNumeralChar",value:function(e){return!(1!==e.length||!(this._numeral.test(e)||this._decimal.test(e)||this._group.test(e)||this._minusSign.test(e))||(this.resetRegex(),0))}},{key:"resetRegex",value:function(){this._numeral.lastIndex=0,this._decimal.lastIndex=0,this._group.lastIndex=0,this._minusSign.lastIndex=0}},{key:"updateValue",value:function(e,t,n,i){var s=this.inputRef.current.value,r=null;null!=t&&(r=this.parseValue(t),r=this.evaluateEmpty(r),this.updateInput(r,n,i,t),this.handleOnChange(e,s,r))}},{key:"evaluateEmpty",value:function(e){return e||this.props.allowEmpty?e:this.props.min||0}},{key:"handleOnChange",value:function(e,t,n){this.props.onChange&&this.isValueChanged(t,n)&&this.props.onChange({originalEvent:e,value:n})}},{key:"isValueChanged",value:function(e,t){return null===t&&null!==e||null!=t&&t!==("string"==typeof e?this.parseValue(e):e)}},{key:"validateValue",value:function(e){return"-"===e||null==e?null:null!==this.props.min&&e<this.props.min?this.props.min:null!==this.props.max&&e>this.props.max?this.props.max:e}},{key:"updateInput",value:function(e,t,n,i){t=t||"";var s=this.inputRef.current,r=s.value,o=this.formatValue(e),a=r.length;if(o!==i&&(o=this.concatValues(o,i)),0===a){s.value=o,s.setSelectionRange(0,0);var u=this.initCursor()+t.length;s.setSelectionRange(u,u)}else{var l=s.selectionStart,p=s.selectionEnd;s.value=o;var c=o.length;if("range-insert"===n){var h=this.parseValue((r||"").slice(0,l)),f=(null!==h?h.toString():"").split("").join("(".concat(this.groupChar,")?")),d=new RegExp(f,"g");d.test(o);var m=t.split("").join("(".concat(this.groupChar,")?")),y=new RegExp(m,"g");y.test(o.slice(d.lastIndex)),s.setSelectionRange(p=d.lastIndex+y.lastIndex,p)}else if(c===a)"insert"===n||"delete-back-single"===n?s.setSelectionRange(p+1,p+1):"delete-single"===n?s.setSelectionRange(p-1,p-1):"delete-range"!==n&&"spin"!==n||s.setSelectionRange(p,p);else if("delete-back-single"===n){var v=r.charAt(p-1),g=r.charAt(p),b=a-c,x=this._group.test(g);x&&1===b?p+=1:!x&&this.isNumeralChar(v)&&(p+=-1*b+1),this._group.lastIndex=0,s.setSelectionRange(p,p)}else if("-"===r&&"insert"===n){s.setSelectionRange(0,0);var w=this.initCursor()+t.length+1;s.setSelectionRange(w,w)}else s.setSelectionRange(p+=c-a,p)}s.setAttribute("aria-valuenow",e)}},{key:"updateInputValue",value:function(e){e=this.evaluateEmpty(e);var t=this.inputRef.current,n=t.value,i=this.formattedValue(e);n!==i&&(t.value=i,t.setAttribute("aria-valuenow",e))}},{key:"formattedValue",value:function(e){var t=this.evaluateEmpty(e);return this.formatValue(t)}},{key:"concatValues",value:function(e,t){if(e&&t){var n=t.search(this._decimal);return this._decimal.lastIndex=0,-1!==n?e.split(this._decimal)[0]+t.slice(n):e}return e}},{key:"getDecimalLength",value:function(e){if(e){var t=e.split(this._decimal);if(2===t.length)return t[1].replace(this._suffix,"").trim().replace(/\s/g,"").replace(this._currency,"").length}return 0}},{key:"updateModel",value:function(e,t){this.props.onValueChange&&this.props.onValueChange({originalEvent:e,value:t,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:t}})}},{key:"onInputFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onInputBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){var n=t.inputRef.current.value;if(t.isValueChanged(n,t.props.value)){var i=t.validateValue(t.parseValue(n));t.updateInputValue(i),t.updateModel(e,i)}t.props.onBlur&&t.props.onBlur(e)}))}},{key:"clearTimer",value:function(){this.timer&&clearInterval(this.timer)}},{key:"isStacked",value:function(){return this.props.showButtons&&"stacked"===this.props.buttonLayout}},{key:"isHorizontal",value:function(){return this.props.showButtons&&"horizontal"===this.props.buttonLayout}},{key:"isVertical",value:function(){return this.props.showButtons&&"vertical"===this.props.buttonLayout}},{key:"getInputMode",value:function(){return this.props.inputMode||("decimal"!==this.props.mode||this.props.minFractionDigits?"decimal":"numeric")}},{key:"getFormatter",value:function(){return this.numberFormat}},{key:"updateInputRef",value:function(){var e=this.props.inputRef;e&&("function"==typeof e?e(this.inputRef.current):e.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.props.tooltip&&this.renderTooltip();var e=this.validateValue(this.props.value);null!==this.props.value&&this.props.value!==e&&this.updateModel(null,e)}},{key:"componentDidUpdate",value:function(e){e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(I({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip());var t=this.isOptionChanged(e);if(t&&this.constructParser(),e.value!==this.props.value||t){var n=this.validateValue(this.props.value);this.updateInputValue(n),null!==this.props.value&&this.props.value!==n&&this.updateModel(null,n)}}},{key:"isOptionChanged",value:function(e){var t=this;return["locale","localeMatcher","mode","currency","currencyDisplay","useGrouping","minFractionDigits","maxFractionDigits","suffix","prefix"].some((function(n){return e[n]!==t.props[n]}))}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=s.tip({target:this.element,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderInputElement",value:function(){var e=i.classNames("p-inputnumber-input",this.props.inputClassName),t=this.formattedValue(this.props.value);return a.default.createElement(n.InputText,{ref:this.inputRef,id:this.props.inputId,style:this.props.inputStyle,role:"spinbutton",className:e,defaultValue:t,type:this.props.type,size:this.props.size,tabIndex:this.props.tabIndex,inputMode:this.getInputMode(),maxLength:this.props.maxLength,disabled:this.props.disabled,required:this.props.required,pattern:this.props.pattern,placeholder:this.props.placeholder,readOnly:this.props.readOnly,name:this.props.name,autoFocus:this.props.autoFocus,onKeyDown:this.onInputKeyDown,onKeyPress:this.onInputKeyPress,onInput:this.onInput,onClick:this.onInputClick,onBlur:this.onInputBlur,onFocus:this.onInputFocus,onPaste:this.onPaste,min:this.props.min,max:this.props.max,"aria-valuemin":this.props.min,"aria-valuemax":this.props.max,"aria-valuenow":this.props.value,"aria-labelledby":this.props.ariaLabelledBy})}},{key:"renderUpButton",value:function(){var e=i.classNames("p-inputnumber-button p-inputnumber-button-up p-button p-button-icon-only p-component",{"p-disabled":this.props.disabled},this.props.incrementButtonClassName),t=i.classNames("p-button-icon",this.props.incrementButtonIcon);return a.default.createElement("button",{type:"button",className:e,onMouseLeave:this.onUpButtonMouseLeave,onMouseDown:this.onUpButtonMouseDown,onMouseUp:this.onUpButtonMouseUp,onKeyDown:this.onUpButtonKeyDown,onKeyUp:this.onUpButtonKeyUp,disabled:this.props.disabled,tabIndex:-1},a.default.createElement("span",{className:t}),a.default.createElement(r.Ripple,null))}},{key:"renderDownButton",value:function(){var e=i.classNames("p-inputnumber-button p-inputnumber-button-down p-button p-button-icon-only p-component",{"p-disabled":this.props.disabled},this.props.decrementButtonClassName),t=i.classNames("p-button-icon",this.props.decrementButtonIcon);return a.default.createElement("button",{type:"button",className:e,onMouseLeave:this.onDownButtonMouseLeave,onMouseDown:this.onDownButtonMouseDown,onMouseUp:this.onDownButtonMouseUp,onKeyDown:this.onDownButtonKeyDown,onKeyUp:this.onDownButtonKeyUp,disabled:this.props.disabled,tabIndex:-1},a.default.createElement("span",{className:t}),a.default.createElement(r.Ripple,null))}},{key:"renderButtonGroup",value:function(){var e=this.props.showButtons&&this.renderUpButton(),t=this.props.showButtons&&this.renderDownButton();return this.isStacked()?a.default.createElement("span",{className:"p-inputnumber-button-group"},e,t):a.default.createElement(a.default.Fragment,null,e,t)}},{key:"render",value:function(){var e=this,t=i.classNames("p-inputnumber p-component p-inputwrapper",this.props.className,{"p-inputwrapper-filled":null!=this.props.value&&this.props.value.toString().length>0,"p-inputwrapper-focus":this.state.focused,"p-inputnumber-buttons-stacked":this.isStacked(),"p-inputnumber-buttons-horizontal":this.isHorizontal(),"p-inputnumber-buttons-vertical":this.isVertical()}),n=this.renderInputElement(),s=this.renderButtonGroup();return a.default.createElement("span",{ref:function(t){return e.element=t},id:this.props.id,className:t,style:this.props.style},n,s)}}],g&&d(y.prototype,g),w&&d(y,w),Object.defineProperty(y,"prototype",{writable:!1}),C}(t.Component);return w(C,"defaultProps",{value:null,inputRef:null,format:!0,showButtons:!1,buttonLayout:"stacked",incrementButtonClassName:null,decrementButtonClassName:null,incrementButtonIcon:"pi pi-angle-up",decrementButtonIcon:"pi pi-angle-down",locale:void 0,localeMatcher:void 0,mode:"decimal",suffix:null,prefix:null,currency:void 0,currencyDisplay:void 0,useGrouping:!0,minFractionDigits:void 0,maxFractionDigits:void 0,id:null,name:null,type:"text",allowEmpty:!0,step:1,min:null,max:null,disabled:!1,required:!1,tabIndex:null,pattern:null,inputMode:null,placeholder:null,readOnly:!1,size:null,style:null,className:null,inputId:null,autoFocus:!1,inputStyle:null,inputClassName:null,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onValueChange:null,onChange:null,onBlur:null,onFocus:null,onKeyDown:null}),e.InputNumber=C,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.inputtext,primereact.utils,primereact.tooltip,primereact.ripple);