!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("primeng/inputtext"),require("primeng/button"),require("@angular/forms")):"function"==typeof define&&define.amd?define("primeng/inputnumber",["exports","@angular/core","@angular/common","primeng/inputtext","primeng/button","@angular/forms"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).primeng=t.primeng||{},t.primeng.inputnumber={}),t.ng.core,t.ng.common,t.primeng.inputtext,t.primeng.button,t.ng.forms)}(this,(function(t,e,n,i,r,u){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */Object.create;function o(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,u=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=u.next()).done;)o.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return o}Object.create;var s={provide:u.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return a})),multi:!0},a=function(){function t(t,n){this.el=t,this.cd=n,this.showButtons=!1,this.format=!0,this.buttonLayout="stacked",this.incrementButtonIcon="pi pi-angle-up",this.decrementButtonIcon="pi pi-angle-down",this.step=1,this.onInput=new e.EventEmitter,this.onFocus=new e.EventEmitter,this.onBlur=new e.EventEmitter,this.onModelChange=function(){},this.onModelTouched=function(){},this.groupChar="",this.prefixChar="",this.suffixChar="",this._modeOption="decimal",this._useGroupingOption=!0}return Object.defineProperty(t.prototype,"locale",{get:function(){return this._localeOption},set:function(t){this._localeOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localeMatcher",{get:function(){return this._localeMatcherOption},set:function(t){this._localeMatcherOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mode",{get:function(){return this._modeOption},set:function(t){this._modeOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currency",{get:function(){return this._currencyOption},set:function(t){this._currencyOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currencyDisplay",{get:function(){return this._currencyDisplayOption},set:function(t){this._currencyDisplayOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useGrouping",{get:function(){return this._useGroupingOption},set:function(t){this._useGroupingOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFractionDigits",{get:function(){return this._minFractionDigitsOption},set:function(t){this._minFractionDigitsOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFractionDigits",{get:function(){return this._maxFractionDigitsOption},set:function(t){this._maxFractionDigitsOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._prefixOption},set:function(t){this._prefixOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"suffix",{get:function(){return this._suffixOption},set:function(t){this._suffixOption=t,this.updateConstructParser()},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.constructParser(),this.initialized=!0},t.prototype.getOptions=function(){return{localeMatcher:this.localeMatcher,style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,useGrouping:this.useGrouping,minimumFractionDigits:this.minFractionDigits,maximumFractionDigits:this.maxFractionDigits}},t.prototype.constructParser=function(){this.numberFormat=new Intl.NumberFormat(this.locale,this.getOptions());var t=function(){for(var t=[],e=0;e0&&e>o?r=i.slice(0,e-1)+"0"+i.slice(e):o>0&&1===o?(r=i.slice(0,e-1)+"0"+i.slice(e),r=this.parseValue(r)>0?r:""):r=i.slice(0,e-1)+i.slice(e)),this.updateValue(t,r,null,"delete-single")}else r=this.deleteRange(i,e,n),this.updateValue(t,r,null,"delete-range");break;case 46:if(t.preventDefault(),e===n){u=i.charAt(e),o=i.search(this._decimal);this._decimal.lastIndex=0,this.isNumeralChar(u)&&(this._group.test(u)?(this._group.lastIndex=0,r=i.slice(0,e)+i.slice(e+2)):this._decimal.test(u)?(this._decimal.lastIndex=0,this.input.nativeElement.setSelectionRange(e+1,e+1)):o>0&&e>o?r=i.slice(0,e)+"0"+i.slice(e+1):o>0&&1===o?(r=i.slice(0,e)+"0"+i.slice(e+1),r=this.parseValue(r)>0?r:""):r=i.slice(0,e)+i.slice(e+1)),this.updateValue(t,r,null,"delete-back-single")}else r=this.deleteRange(i,e,n),this.updateValue(t,r,null,"delete-range")}}},t.prototype.onInputKeyPress=function(t){t.preventDefault();var e=t.which||t.keyCode,n=String.fromCharCode(e),i=this.isDecimalSign(n),r=this.isMinusSign(n);(48<=e&&e<=57||r||i)&&this.insert(t,n,{isDecimalSign:i,isMinusSign:r})},t.prototype.onPaste=function(t){t.preventDefault();var e=(t.clipboardData||window.clipboardData).getData("Text");if(e){var n=this.parseValue(e);null!=n&&this.insert(t,n.toString())}},t.prototype.isMinusSign=function(t){return!!this._minusSign.test(t)&&(this._minusSign.lastIndex=0,!0)},t.prototype.isDecimalSign=function(t){return!!this._decimal.test(t)&&(this._decimal.lastIndex=0,!0)},t.prototype.insert=function(t,e,n){void 0===n&&(n={isDecimalSign:!1,isMinusSign:!1});var i=this.input.nativeElement.selectionStart,r=this.input.nativeElement.selectionEnd,u=this.input.nativeElement.value.trim(),o=u.search(this._decimal);this._decimal.lastIndex=0;var s,a=u.search(this._minusSign);if(this._minusSign.lastIndex=0,n.isMinusSign)0===i&&(s=u,-1!==a&&0===r||(s=this.insertText(u,e,0,r)),this.updateValue(t,s,e,"insert"));else if(n.isDecimalSign)o>0&&i===o?this.updateValue(t,u,e,"insert"):o>i&&o0&&i>o?i+e.length-(o+1)<=p&&(s=u.slice(0,i)+e+u.slice(i+e.length),this.updateValue(t,s,e,l)):(s=this.insertText(u,e,i,r),this.updateValue(t,s,e,l))}},t.prototype.insertText=function(t,e,n,i){if(2==e.split(".").length){var r=t.slice(n,i).search(this._decimal);return this._decimal.lastIndex=0,r>0?t.slice(0,n)+this.formatValue(e)+t.slice(i):t||this.formatValue(e)}return i-n===t.length?this.formatValue(e):0===n?e+t.slice(i):i===t.length?t.slice(0,n)+e:t.slice(0,n)+e+t.slice(i)},t.prototype.deleteRange=function(t,e,n){return n-e===t.length?"":0===e?t.slice(n):n===t.length?t.slice(0,e):t.slice(0,e)+t.slice(n)},t.prototype.initCursor=function(){var t=this.input.nativeElement.selectionStart,e=this.input.nativeElement.value,n=e.length,i=null,r=e.charAt(t);if(!this.isNumeralChar(r)){for(var u=t-1;u>=0;){if(r=e.charAt(u),this.isNumeralChar(r)){i=u;break}u--}if(null!==i)this.input.nativeElement.setSelectionRange(i+1,i+1);else{for(u=t+1;uthis.max?this.max:"-"===t?null:t},t.prototype.updateInput=function(t,e,n){e=e||"";var i=this.input.nativeElement.value,r=this.formatValue(t),u=i.length;if(0===u){this.input.nativeElement.value=r,this.input.nativeElement.setSelectionRange(0,0),this.initCursor();var o=(this.prefixChar||"").length+e.length;this.input.nativeElement.setSelectionRange(o,o)}else{var s=this.input.nativeElement.selectionStart;o=this.input.nativeElement.selectionEnd;if(this.maxlength&&this.maxlength0},enumerable:!1,configurable:!0}),t.prototype.clearTimer=function(){this.timer&&clearInterval(this.timer)},t}();a.decorators=[{type:e.Component,args:[{selector:"p-inputNumber",template:'\n \n \n \n \n \n \n \n \n \n ',changeDetection:e.ChangeDetectionStrategy.OnPush,providers:[s],encapsulation:e.ViewEncapsulation.None,host:{"[class.p-inputwrapper-filled]":"filled","[class.p-inputwrapper-focus]":"focused"},styles:[".p-inputnumber{display:-ms-inline-flexbox;display:inline-flex}.p-inputnumber-button{-ms-flex:0 0 auto;-ms-flex-align:center;-ms-flex-pack:center;align-items:center;display:-ms-flexbox;display:flex;flex:0 0 auto;justify-content:center}.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button .p-button-label,.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button .p-button-label{display:none}.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button-up{border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:0;padding:0}.p-inputnumber-buttons-stacked .p-inputnumber-input{border-bottom-right-radius:0;border-top-right-radius:0}.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button-down{border-bottom-left-radius:0;border-top-left-radius:0;border-top-right-radius:0;padding:0}.p-inputnumber-buttons-stacked .p-inputnumber-button-group{-ms-flex-direction:column;display:-ms-flexbox;display:flex;flex-direction:column}.p-inputnumber-buttons-stacked .p-inputnumber-button-group .p-button.p-inputnumber-button{-ms-flex:1 1 auto;flex:1 1 auto}.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button-up{-ms-flex-order:3;border-bottom-left-radius:0;border-top-left-radius:0;order:3}.p-inputnumber-buttons-horizontal .p-inputnumber-input{-ms-flex-order:2;border-radius:0;order:2}.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button-down{-ms-flex-order:1;border-bottom-right-radius:0;border-top-right-radius:0;order:1}.p-inputnumber-buttons-vertical{-ms-flex-direction:column;flex-direction:column}.p-inputnumber-buttons-vertical .p-button.p-inputnumber-button-up{-ms-flex-order:1;border-bottom-left-radius:0;border-bottom-right-radius:0;order:1;width:100%}.p-inputnumber-buttons-vertical .p-inputnumber-input{-ms-flex-order:2;border-radius:0;order:2;text-align:center}.p-inputnumber-buttons-vertical .p-button.p-inputnumber-button-down{-ms-flex-order:3;border-top-left-radius:0;border-top-right-radius:0;order:3;width:100%}.p-inputnumber-input{-ms-flex:1 1 auto;flex:1 1 auto}.p-fluid .p-inputnumber{width:100%}.p-fluid .p-inputnumber .p-inputnumber-input{width:1%}.p-fluid .p-inputnumber-buttons-vertical .p-inputnumber-input{width:100%}"]}]}],a.ctorParameters=function(){return[{type:e.ElementRef},{type:e.ChangeDetectorRef}]},a.propDecorators={showButtons:[{type:e.Input}],format:[{type:e.Input}],buttonLayout:[{type:e.Input}],disabled:[{type:e.Input}],inputId:[{type:e.Input}],styleClass:[{type:e.Input}],style:[{type:e.Input}],placeholder:[{type:e.Input}],size:[{type:e.Input}],maxlength:[{type:e.Input}],tabindex:[{type:e.Input}],title:[{type:e.Input}],ariaLabel:[{type:e.Input}],ariaRequired:[{type:e.Input}],name:[{type:e.Input}],required:[{type:e.Input}],autocomplete:[{type:e.Input}],min:[{type:e.Input}],max:[{type:e.Input}],incrementButtonClass:[{type:e.Input}],decrementButtonClass:[{type:e.Input}],incrementButtonIcon:[{type:e.Input}],decrementButtonIcon:[{type:e.Input}],step:[{type:e.Input}],inputStyle:[{type:e.Input}],inputStyleClass:[{type:e.Input}],input:[{type:e.ViewChild,args:["input"]}],onInput:[{type:e.Output}],onFocus:[{type:e.Output}],onBlur:[{type:e.Output}],locale:[{type:e.Input}],localeMatcher:[{type:e.Input}],mode:[{type:e.Input}],currency:[{type:e.Input}],currencyDisplay:[{type:e.Input}],useGrouping:[{type:e.Input}],minFractionDigits:[{type:e.Input}],maxFractionDigits:[{type:e.Input}],prefix:[{type:e.Input}],suffix:[{type:e.Input}]};var p=function(){};p.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,i.InputTextModule,r.ButtonModule],exports:[a],declarations:[a]}]}],t.INPUTNUMBER_VALUE_ACCESSOR=s,t.InputNumber=a,t.InputNumberModule=p,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=primeng-inputnumber.umd.min.js.map