@progress/kendo-vue-inputs
Advanced tools
Comparing version 1.0.0-dev.202005061030 to 1.0.0-dev.202005070802
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("vue"),require("@progress/kendo-vue-intl")):"function"==typeof define&&define.amd?define(["vue","@progress/kendo-vue-intl"],t):"object"==typeof exports?exports.KendoVueInputs=t(require("vue"),require("@progress/kendo-vue-intl")):e.KendoVueInputs=t(e.Vue,e.KendoVueIntl)}(window,(function(e,t){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";n.r(t),n.d(t,"classNames",(function(){return i})),n.d(t,"guid",(function(){return a})),n.d(t,"Keys",(function(){return r})),n.d(t,"noop",(function(){return f})),n.d(t,"canUseDOM",(function(){return s})),n.d(t,"focusFirstFocusableChild",(function(){return u})),n.d(t,"clone",(function(){return l})),n.d(t,"cloneArray",(function(){return p})),n.d(t,"cloneValue",(function(){return d})),n.d(t,"cloneObject",(function(){return c})),n.d(t,"cloneDate",(function(){return o})),n.d(t,"VueComponent",(function(){return g})),n.d(t,"templateRendering",(function(){return $}));var i=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter((function(e){return!0!==e&&!!e})).map((function(e){return Array.isArray(e)?i.apply(void 0,e):"object"==typeof e?Object.keys(e).map((function(t,n){return e[n]||e[t]&&t||null})).filter((function(e){return null!==e})).join(" "):e})).filter((function(e){return!!e})).join(" ")},a=function(){var e,t,n="";for(e=0;e<32;e++)t=16*Math.random()|0,8!==e&&12!==e&&16!==e&&20!==e||(n+="-"),n+=(12===e?4:16===e?3&t|8:t).toString(16);return n},r={backspace:8,tab:9,enter:13,shift:16,esc:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,delete:46},s=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement),u=function(e){if(e){var t=e.querySelectorAll('input, [tabindex]:not([tabindex="-1"])');t.length&&t[0].focus&&t[0].focus()}},o=function(e){return e?new Date(e.getTime()):null};function l(e){var t={};return c(e,t),t}function c(e,t){for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];t[n]=d(i,t[n])}}function d(e,t){if(Array.isArray(e))return p(e);if(e instanceof Date)return o(e);if(e&&"object"==typeof e){var n=t||{};return c(e,n),n}return e}function p(e){return e.map((function(e){return d(e,void 0)}))}var h,f=function(){},v=n(1),m=(h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t}(n.n(v).a);function $(e,t){if(e){var n=this.$scopedSlots[e]||(e.toLowerCase?this.$scopedSlots[e.toLowerCase()]:null);return"string"==typeof e&&n?{type:"slot",render:n,listeners:t}:"string"==typeof e||"object"==typeof e||"function"==typeof e&&e.component?{type:"component",render:e,listeners:t}:{type:"renderFunction",render:e,listeners:t}}}},function(t,n){t.exports=e},function(e,t,n){"use strict";function i(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),i(n(3)),i(n(4))},function(e,t,n){"use strict";var i=function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),r={model:{event:"changemodel"},inheritAttrs:!1,props:{defaultValue:{type:[String,Number],default:""},value:{type:[String,Number]},label:{type:String},placeholder:{type:String},required:{type:Boolean,default:!1},dir:{type:String},valid:{type:Boolean,default:void 0},validate:{type:Boolean},validationMessage:{type:String},validityStyles:{type:Boolean,default:!0}},data:function(){return{hasMounted:!1,autofill:!1,currentValue:"",valueDuringOnChange:"",input:null,inputId:a.guid(),focused:!1}},created:function(){this.$data.valueDuringOnChange=void 0,this.$data.currentValue=this.$props.defaultValue},mounted:function(){this.$data.input=this.$refs.input,this.$data.hasMounted=!0},updated:function(){this.setValidity()},render:function(e){var t=this.$props,n=t.label,r=t.id,s=t.required,u=r||this.$data.inputId,o=e("input",{domProps:i(i({},this.$attrs),{placeholder:this.$props.placeholder,id:u,required:s,value:this.computedValue}),class:i({},this.inputClassNames()),ref:"input",on:{change:this.handleChange,focus:this.emitFocus,blur:this.emitBlur,input:this.$listeners.input||this.$listeners.changemodel?this.handleInput:a.noop,animationstart:this.handleAutoFill,animationend:this.handleAutoFillEnd}});return n?e("span",{class:this.spanClassNames,on:{focusin:this.handleFocus,focusout:this.handleBlur},attrs:{dir:this.$props.dir}},[o,n?r?e("label",{attrs:{for:r},class:"k-label"},[n]):e("span",{class:"k-label"},[n]):null]):o},methods:{emitFocus:function(e){this.$emit("focus",e)},emitBlur:function(e){this.$emit("blur",e)},handleBlur:function(e){this.$data.focused=!1},handleFocus:function(e){this.$data.focused=!0},focus:function(){this.$data.input&&this.$data.input.focus()},inputClassNames:function(){var e=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-textbox":!0,"k-state-invalid":!e&&void 0!==e}},validity:function(){var e={badInput:!!this.$data.input&&this.$data.input.validity.badInput,patternMismatch:!!this.$data.input&&this.$data.input.validity.patternMismatch,rangeOverflow:!!this.$data.input&&this.$data.input.validity.rangeOverflow,rangeUnderflow:!!this.$data.input&&this.$data.input.validity.rangeUnderflow,stepMismatch:!!this.$data.input&&this.$data.input.validity.stepMismatch,tooLong:!!this.$data.input&&this.$data.input.validity.tooLong,typeMismatch:!!this.$data.input&&this.$data.input.validity.typeMismatch,valueMissing:!!this.$data.input&&this.$data.input.validity.valueMissing};return i(i({},e),{customError:void 0!==this.$props.validationMessage,valid:void 0!==this.$props.valid?this.$props.valid:!this.$data.input||!this.isInvalid(e)})},isInvalid:function(e){var t=!1;for(var n in e)e.hasOwnProperty(n)&&(t=t||e[n]);return t},setValidity:function(){this.$data.input&&this.$data.input.setCustomValidity&&this.$data.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||"")},handleInput:function(e){this.$data.currentValue=e.target.value,this.$data.valueDuringOnChange=e.target.value,this.$nextTick((function(){this.$emit("input",{event:e,value:e.target.value,component:this,target:e.target,validity:this.validity()}),this.$emit("changemodel",e.target.value),this.$data.valueDuringOnChange=void 0}))},handleChange:function(e){this.$data.currentValue=e.target.value,this.$data.valueDuringOnChange=e.target.value,this.$nextTick((function(){this.$emit("change",{event:e,value:e.target.value,component:this,target:e.target,validity:this.validity()}),this.$emit("changemodel",e.target.value),this.$data.valueDuringOnChange=void 0}))},handleAutoFill:function(e){if("autoFillStart"===e.animationName){var t=e.target.parentNode;t&&t.classList.contains("k-state-empty")&&(this.$data.autofill=!0)}},handleAutoFillEnd:function(e){"autoFillEnd"===e.animationName&&(e.target.parentNode&&(this.$data.autofill=!1))},name:function(){return this.$props.name}},computed:{spanClassNames:{get:function(){var e=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-floating-label-container":!0,"k-state-focused":this.$data.focused,"k-state-empty":!(0===this.computedValue||this.computedValue||this.$props.placeholder||this.$data.autofill),"k-autofill":this.$data.autofill,"k-state-invalid":!e&&void 0!==e,"k-rtl":"rtl"===this.$props.dir}}},computedValue:{get:function(){return void 0!==this.$data.valueDuringOnChange?this.$data.valueDuringOnChange:void 0!==this.$props.value?this.$props.value:this.$data.currentValue}}}};t.Input=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(5),a=n(0),r=n(6),s=n(7),u={model:{event:"changemodel"},inheritAttrs:!1,props:{value:Number,defaultValue:Number,step:{type:Number,default:1},format:[String,Object],tabIndex:Number,accessKey:String,title:String,placeholder:String,min:Number,max:Number,spinners:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},dir:String,name:String,label:String,validationMessage:String,validityStyles:{type:Boolean,default:!0},valid:{type:Boolean,default:void 0},required:{type:Boolean,default:!1},id:String},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},data:function(){return{hasMounted:!1,isInvalid:!1,isEmpty:!1,currentValue:0,valueDuringOnChange:0,currentLooseValue:"",selectionStart:0,selectionEnd:0,decimalSelect:!1,focused:!1,forceUpdate:!1}},created:function(){this._textBeforeInput="",this._inputId=a.guid(),this.$data.currentLooseValue=null,this.$data.valueDuringOnChange=void 0,this._intl=i.provideIntlService(this),this._symbols=this._intl.numberSymbols(),void 0!==this.$props.value?this.$data.currentValue=this.$props.value:void 0!==this.$props.defaultValue?this.$data.currentValue=this.$props.defaultValue:this.$data.currentValue=null},mounted:function(){this._input=this.$refs.input,this._elementWrapper=this.$refs.elementWrapper,this.$data.hasMounted=!0,this._input&&(this._textBeforeInput=this._input.value),this.setValidity()},updated:function(){document&&document.activeElement!==this._input||!this._input||null===this.$data.currentLooseValue||this.$data.forceUpdate&&(this._input.selectionStart=this.$data.selectionStart,this._input.selectionEnd=this.$data.selectionEnd,this.$data.forceUpdate=!1),this._input&&(this._textBeforeInput=this._input.value),this.setValidity()},computed:{computedValue:{get:function(){return void 0!==this.$data.valueDuringOnChange?this.$data.valueDuringOnChange:this.$data.currentValue}},looseValue:{get:function(){return s.formatValue(this.$data.focused?this.$data.currentLooseValue:s.getStateOrPropsValue(this.$props.value,this.$data.currentValue),this.$props.format,this._intl)}},spanClassNames:{get:function(){var e=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid,t=this.computedValue;return{"k-floating-label-container":!0,"k-state-focused":this.$data.focused,"k-state-empty":!(0===t||(t||this.$props.placeholder)),"k-state-invalid":!e&&void 0!==e,"k-rtl":"rtl"===this.$props.dir}}},wrapperClassNames:{get:function(){var e=!this.$props.validityStyles||this.validity().valid;return{"k-numeric-wrap":!0,"k-state-disabled":this.$props.disabled,"k-state-invalid":!e||this.$data.isInvalid}}}},methods:{validity:function(){var e=void 0!==this.$props.validationMessage,t=!this.$props.required||null!==this.computedValue;return{customError:e,valid:void 0!==this.$props.valid?this.$props.valid:t,valueMissing:null===this.computedValue}},focus:function(){this._input&&this._input.focus()},emitFocus:function(e){this.$data.currentLooseValue=this._prevLooseValue,this.$data.focused=!0,this.$emit("focus",e),this.$data.forceUpdate=!0},emitBlur:function(e){this.$data.eventValue=null,this.$data.prevLooseValue="",this.$data.currentLooseValue="",this.$data.focused=!1,this.$data.selectionStart=void 0,this.$data.selectionEnd=void 0,this.$data.decimalSelect=!1,this.$data.valueIsCorrected=!1,this.$data.valueIsOutOfRange=!1,this.$emit("blur",e),this.$data.forceUpdate=!0},handleFocus:function(e){this.$data.focused=!0},handleBlur:function(e){this.$data.focused=!1},setValidity:function(){this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||"Please enter a valid value!")},getCurrentState:function(){return{eventValue:s.getStateOrPropsValue(this.$props.value,this.$data.currentValue),prevLooseValue:this._prevLooseValue,currentLooseValue:this._input.value,selectionStart:this._input.selectionStart,selectionEnd:this._input.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:this._isPaste,focused:this.$data.focused}},parseNumber:function(e){return this._intl.parseNumber(e,this.$props.format)},elementChange:function(e){var t=this.getCurrentState();this._isPaste=!1,this.triggerChange(e,s.sanitizeNumber(t,this.$props.format,this._intl))},triggerChange:function(e,t){var n=this;if(!this.$props.disabled){this.$data.valueDuringOnChange=t.eventValue,this.$data.currentValue=t.eventValue;var i=s.formatValue(s.rangeValue(t.eventValue,this.$props.min,this.$props.max),this.$props.format,this._intl),a=s.rangeValue(this.parseNumber(i),this.$props.min,this.$props.max);if(a!==t.eventValue&&(t.valueIsOutOfRange=!0,t.eventValue=a),t.valueIsCorrected){var r=this._elementWrapper;r&&-1===r.className.indexOf("k-state-invalid")&&(this.$data.isInvalid=!0,setTimeout((function(){n.$data.isInvalid=!1}),50))}var u=this.$props.value!==t.eventValue;void 0!==this.$props.value?this.$data.currentValue=this.$props.value:this.$data.currentValue=this.$data.valueDuringOnChange,this.$data.prevLooseValue=t.prevLooseValue,this.$data.currentLooseValue=t.currentLooseValue,this.$data.selectionStart=t.selectionStart,this.$data.selectionEnd=t.selectionEnd,this.$data.decimalSelect=t.decimalSelect,this.$data.valueIsCorrected=t.valueIsCorrected,this.$data.valueIsOutOfRange=t.valueIsOutOfRange,this.$data.focused=t.focused,this.$data.isPaste=t.isPaste,this.$data.forceUpdate=!this.$data.forceUpdate,u&&(this.$emit("change",{event:e,value:this.$data.valueDuringOnChange,component:this,target:{name:this.$props.name,value:this.$data.valueDuringOnChange},validity:this.validity()}),this.$emit("changemodel",this.$data.valueDuringOnChange)),this.$data.valueDuringOnChange=void 0}},onPasteHandler:function(e){this._isPaste=!0},increase:function(e){var t=this.getCurrentState();s.increaseValue(this.parseNumber(String(t.currentLooseValue)),t,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl),this.triggerChange(e,t)},decrease:function(e){var t=this.getCurrentState();s.decreaseValue(this.parseNumber(String(t.currentLooseValue)),t,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl),this.triggerChange(e,t)},wheel:function(e){document&&document.activeElement===this._input&&this._input&&(e.deltaY<0&&(e.preventDefault(),this.increase(e)),e.deltaY>0&&(e.preventDefault(),this.decrease(e)))},keyDown:function(e){var t=this.getCurrentState(),n=this.parseNumber(String(t.currentLooseValue));if(!(t.selectionEnd>t.selectionStart&&t.selectionEnd-t.selectionStart===String(t.currentLooseValue).length)){switch(e.keyCode){case 38:s.increaseValue(n,t,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl);break;case 40:s.decreaseValue(n,t,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl);break;case 13:var i=s.formatValue(s.rangeValue(n,this.$props.min,this.$props.max),this.$props.format,this._intl),a=s.rangeValue(this.parseNumber(i),this.$props.min,this.$props.max);t.eventValue=a,t.currentLooseValue=s.formatValue(a,this.$props.format,this._intl),t.selectionStart=t.selectionEnd=t.currentLooseValue.length;break;case 110:var r=this._input,u=this._intl.numberSymbols();r&&(t.currentLooseValue=t.currentLooseValue.slice(0,t.selectionStart)+u.decimal+t.currentLooseValue.slice(t.selectionEnd),t.selectionStart=t.selectionEnd=t.selectionStart+1,t=s.sanitizeNumber(t,this.$props.format,this._intl));break;default:return}e.preventDefault(),this.triggerChange(e,t)}},spinnersWrapperMouseDown:function(e){document&&this._input&&(e.preventDefault(),document.activeElement!==this._input&&this._input.focus())}},render:function(e){var t=this.$props.id||this._inputId,n=i.provideLocalizationService(this);void 0!==this.$props.value&&this.$props.value!==this.$data.currentValue&&(this.$data.currentValue=this.$props.value),this._prevLooseValue=this.looseValue;var a=e("span",{attrs:{dir:this.$props.dir,"aria-disabled":this.$props.disabled?"true":void 0},class:"k-widget k-numerictextbox"},[e("span",{class:this.wrapperClassNames,ref:"elementWrapper"},[e("input",{attrs:{tabIndex:this.$props.tabIndex,accessKey:this.$props.accessKey,disabled:this.$props.disabled,title:this.$props.title,"aria-valuemin":this.$props.min,"aria-valuemax":this.$props.max,placeholder:this.$props.placeholder,type:this.$props.inputType||"tel",spellCheck:!1,autoComplete:"off",autoCorrect:"off",id:t,"aria-valuenow":null!==this.$data.currentValue?this.$data.currentValue:void 0,name:this.$props.name},class:"k-input k-formatted-value",domProps:{value:this.looseValue},on:{wheel:this.wheel,keydown:this.keyDown,input:this.elementChange,focus:this.emitFocus,blur:this.emitBlur,paste:this.onPasteHandler},ref:"input"}),this.$slots.default,this.$props.spinners&&e("span",{class:"k-select",on:{mousedown:this.spinnersWrapperMouseDown}},[e("span",{class:"k-link k-link-increase",attrs:{"aria-label":n.toLanguageString(r.numericIncreaseValue,r.messages[r.numericIncreaseValue]),title:n.toLanguageString(r.numericIncreaseValue,r.messages[r.numericIncreaseValue])},on:{click:this.increase}},[e("span",{class:"k-icon k-i-arrow-n"})]),e("span",{class:"k-link k-link-decrease",attrs:{"aria-label":n.toLanguageString(r.numericDecreaseValue,r.messages[r.numericDecreaseValue]),title:n.toLanguageString(r.numericDecreaseValue,r.messages[r.numericDecreaseValue])},on:{click:this.decrease}},[e("span",{class:"k-icon k-i-arrow-s"})])])])]);return this.$props.label?e("span",{class:this.spanClassNames,on:{focusin:this.handleFocus,focusout:this.handleBlur},attrs:{dir:this.$props.dir}},[a,this.$props.label?this.$props.id?e("label",{attrs:{for:this.$props.id},class:"k-label"},[this.$props.label]):e("span",{class:"k-label"},[this.$props.label]):null]):a}};t.NumericTextBox=u},function(e,n){e.exports=t},function(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.numericIncreaseValue="numerictextbox.increment",t.numericDecreaseValue="numerictextbox.decrement",t.sliderIncreaseValue="slider.increment",t.sliderDecreaseValue="slider.decrement",t.sliderDragTitle="slider.dragTitle",t.colorGradientR="colorGradient.r",t.colorGradientG="colorGradient.g",t.colorGradientB="colorGradient.b",t.colorGradientA="colorGradient.a",t.colorGradientHex="colorGradient.hex",t.messages=((i={})[t.numericIncreaseValue]="Increase value",i[t.numericDecreaseValue]="Decrease value",i[t.sliderIncreaseValue]="Increase",i[t.sliderDecreaseValue]="Decrease",i[t.sliderDragTitle]="Drag",i[t.colorGradientR]="r",i[t.colorGradientG]="g",i[t.colorGradientB]="b",i[t.colorGradientA]="a",i[t.colorGradientHex]="hex",i)},function(e,t,n){"use strict";var i=function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var a=/\d/;t.getInitialState=function(){return{eventValue:null,prevLooseValue:"",currentLooseValue:"",focused:!1,selectionStart:void 0,selectionEnd:void 0,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1}},t.getStateOrPropsValue=function(e,t){return void 0!==e?e:t},t.formatValue=function(e,t,n){return null===e&&void 0===e?"":"string"==typeof e?e:n.formatNumber(e,t)},t.increaseValue=function(e,n,i,r,s,u,o){var l=t.rangeValue((e||0)+(i||0),r,s);n.eventValue=l,n.currentLooseValue=t.formatValue(l,u,o),n.selectionStart=n.selectionEnd=t.getLastNumberIndex(n.currentLooseValue,a)},t.decreaseValue=function(e,n,i,r,s,u,o){var l=t.rangeValue((e||0)-(i||0),r,s);n.eventValue=l,n.currentLooseValue=t.formatValue(l,u,o),n.selectionStart=n.selectionEnd=t.getLastNumberIndex(n.currentLooseValue,a)},t.rangeValue=function(e,t,n){return null==e?e:e>1||e<1||1===e?void 0!==n&&void 0!==t&&n<t?null:(void 0!==n&&e>n&&(e=n),void 0!==t&&e<t&&(e=t),e):null},t.getMaxCursorPosition=function(e,t){var n=t.findIndex((function(t){t[0];var n=t[1];return Boolean(n)&&e.indexOf(n)===e.length-n.length}));if(-1===n)return-1;var i=t[n][1];return e.length-i.length},t.getMinCursorPosition=function(e,t){var n=t.findIndex((function(t){var n=t[0];t[1];return Boolean(n)&&0===e.indexOf(n)}));return-1===n?-1:t[n][0].length},t.rangeSelection=function(e,n,i){var a=t.getMaxCursorPosition(e,n);if(-1!==a&&i.selectionStart>a)i.selectionStart=i.selectionEnd=a;else{i.selectionStart>e.length&&(i.selectionStart=i.selectionEnd=e.length);var r=t.getMinCursorPosition(e,n);-1!==r&&i.selectionStart<r&&(i.selectionStart=i.selectionEnd=r),-1===i.selectionStart&&(i.selectionStart=i.selectionEnd=0)}},t.setSelection=function(e,n,i,a){e.selectionStart=e.selectionEnd=n,t.rangeSelection(i,a,e)},t.setInvalid=function(e,n,i,a){e.eventValue=a.parseNumber(e.prevLooseValue,n),e.currentLooseValue=e.prevLooseValue,e.valueIsCorrected=!0,t.setSelection(e,e.selectionStart,e.currentLooseValue,i)},t.isMinusSymbolAdded=function(e,t){var n=String(e.currentLooseValue),i=String(e.prevLooseValue);return n.split(t.minusSign).length!==i.split(t.minusSign).length&&n.length===i.length+t.minusSign.length},t.isDecimalDuplicated=function(e,t){return String(e.currentLooseValue).split(t.decimal).length>2},t.getFormatPrefixSufix=function(e,n){var i=n.formatNumber(1111111.1111111,e),a=n.formatNumber(-1111111.1111111,e),r=n.formatNumber(0,e),s=n.formatNumber(1,e),u=t.getPrefix(i),o=t.getPrefix(a),l=t.getPrefix(r),c=t.getPrefix(s);return{positiveInfo:[u,t.getSuffix(i)],negativeInfo:[o,t.getSuffix(a)],zeroInfo:[l,t.getSuffix(r)],oneInfo:[c,t.getSuffix(s)]}},t.getFormatSymbols=function(e,t){var n=t.formatNumber(1111111.1111111,e),i=t.formatNumber(-1111111.1111111,e),a=t.formatNumber(0,e),r=t.formatNumber(1,e),s=t.numberSymbols(),u=new RegExp("[\\d\\"+s.decimal+s.group+"]","g");return[n,i,a,r].map((function(e){return e.replace(u,"")})).join("").split("").filter((function(e,t,n){return n.indexOf(e)===t})).join("")},t.getInitialPosition=function(e,n){var i=e.indexOf(n.decimal);return i>-1?i:t.getLastNumberIndex(e,a)},t.reverseString=function(e){return e.split("").reverse().join("")},t.getLastNumberIndex=function(e,n){return e.length-t.reverseString(e).search(n)},t.getPrefix=function(e){return e.split(e[e.search(a)])[0]},t.getSuffix=function(e){var n=t.reverseString(e);return t.reverseString(n.split(n[n.search(a)])[0])},t.getFirstNumberIndex=function(e,t){return e.search(t)},t.getDecimalCount=function(e,t){var n=e.indexOf(t);return n>-1?e.length-n-1:0},t.changeBasedSelection=function(e,t,n,i,r){var s="0"===e.replace(r,"")[0],u="0"===t.replace(r,"")[0];if(s&&!u)return n-1;if(u&&i)return n+1;for(var o=0,l=0;l<n;l++)a.test(e.charAt(l))&&o++;for(var c=0;o>0&&t.length>c;)a.test(t.charAt(c))&&o--,c++;return c},t.sanitizeNumber=function(e,n,r){var s=i({},e),u=s.prevLooseValue,o=r.numberSymbols(),l=t.getFormatSymbols(n,r),c=String(s.currentLooseValue),d=String(u),p=new RegExp("[^\\d\\"+o.decimal+"]","g"),h=new RegExp("[^\\d\\"+o.decimal+"\\"+o.group+"]","g"),f=new RegExp("[\\d\\"+o.decimal+"\\"+o.group+"]"),v=c.replace(p,""),m=t.getFirstNumberIndex(c,a),g=-1===m?-1:t.getLastNumberIndex(c,a),$=c.indexOf(o.decimal),V=(c.substring(0,m)+c.substring(m,g).replace(h,"")+c.substring(g,c.length)).split("").filter((function(e){return-1!==l.indexOf(e)||-1!==e.search(f)})).join(""),b=r.formatNumber(.31111111111111117,n).replace(p,""),y=b.indexOf(o.decimal),S=y>-1?b.length-y-1:0,x=r.formatNumber(1,n).replace(p,""),L=x.indexOf(o.decimal),I=L>-1?x.length-L-1:0,O=t.getFormatPrefixSufix(n,r),_=[O.positiveInfo,O.negativeInfo,O.zeroInfo,O.oneInfo],N=1!==_.findIndex((function(e){return-1!==e.findIndex((function(e){return Boolean(e)}))})),C=c.length>0&&c.length<d.length;if(!s.isPaste){if(""===c)return s.eventValue=null,s.currentLooseValue="",s;if(s.currentLooseValue===o.minusSign&&r.formatNumber(-0,n)!==d)return s.eventValue=-0,s.currentLooseValue=t.formatValue(s.eventValue,n,r),t.setSelection(s,t.getInitialPosition(s.currentLooseValue,o),s.currentLooseValue,_),s;if(t.isMinusSymbolAdded(s,o)){var k=r.parseNumber(u,n);s.eventValue=-(null!==k?k:0),s.currentLooseValue=t.formatValue(s.eventValue,n,r);var D=t.getFirstNumberIndex(s.currentLooseValue,a),P=t.getFirstNumberIndex(d,a);return t.setSelection(s,s.selectionEnd-1+(D-P),s.currentLooseValue,_),s}if(s.currentLooseValue===o.decimal){s.eventValue=0;var w=t.formatValue(s.eventValue,n,r);if(0===I&&S>0){var M=t.getLastNumberIndex(w,a);s.currentLooseValue=w.substring(0,M)+o.decimal+w.substring(M)}else s.currentLooseValue=w;return t.setSelection(s,t.getInitialPosition(s.currentLooseValue,o)+1,s.currentLooseValue,_),s}if(t.isDecimalDuplicated(s,o))return t.setInvalid(s,n,_,r),s;if("p"===n&&c&&-1===c.indexOf(o.percentSign))return s.eventValue=r.parseNumber(c,n)/100,s.currentLooseValue=t.formatValue(s.eventValue,n,r),s;if(String(s.currentLooseValue).replace(/[^\d]/g,"").length>15)return t.setInvalid(s,n,_,r),s;if(v!==c&&c&&N)if(-1===_.findIndex((function(e){var t=e[0],n=e[1],i=c.indexOf(t),a=c.indexOf(n),r=0===i,s=a===c.length-n.length,u=i+t.length!==m&&-1!==m&&c[i+t.length]!==o.decimal,l=a!==g&&-1!==g&&c[a-1]!==o.decimal;return t&&n?!u&&!l&&(r&&s):t?!u&&r:!!n&&(!l&&s)})))return t.setInvalid(s,n,_,r),s;if(v[v.length-1]===o.decimal&&S>0)return s.eventValue=r.parseNumber(c,n),s.currentLooseValue=V,s;if(s.currentLooseValue&&u)if((l+o.decimal+o.group).split("").findIndex((function(e){return c.split("").filter((function(t){return t===e})).length<d.split("").filter((function(t){return t===e})).length&&c.length+1===d.length&&(e!==o.decimal||0!==t.getDecimalCount(d.replace(p,""),o.decimal))}))>-1)return s.eventValue=r.parseNumber(e.prevLooseValue,n),s.currentLooseValue=e.prevLooseValue,s;var E=t.getDecimalCount(v,o.decimal),j="0"===v[v.length-1];if(C&&j&&E<I)return s.eventValue=r.parseNumber(s.currentLooseValue,n),s.currentLooseValue=t.formatValue(s.eventValue,n,r),s;if(E>0){var B=c.substring(0,$);if(j&&(!B||0!==d.indexOf(B))){s.eventValue=r.parseNumber(s.currentLooseValue,n);var F=t.formatValue(s.eventValue,n,r);return t.setSelection(s,t.changeBasedSelection(c,F,s.selectionEnd,C,p),F,_),s.currentLooseValue=F,s}if(E>S){var A=c.indexOf(o.decimal),G=c.substring(0,A)+c.substring(A,A+1+S)+c.substring(g,String(s.currentLooseValue).length);return s.eventValue=r.parseNumber(G,n),s.currentLooseValue=G,t.setSelection(s,s.selectionStart,G,_),s}if(I!==S&&E<=S&&j)return s.eventValue=r.parseNumber(s.currentLooseValue,n),s.currentLooseValue=V,s;if(E<I)return s.eventValue=r.parseNumber(s.currentLooseValue,n),s.currentLooseValue=t.formatValue(s.eventValue,n,r),s}}if(s.eventValue=r.parseNumber(s.currentLooseValue,n),"number"==typeof s.eventValue){F=t.formatValue(s.eventValue,n,r);1===c.length?t.setSelection(s,t.getInitialPosition(F,o),F,_):t.setSelection(s,t.changeBasedSelection(c,F,s.selectionEnd,C,p),F,_),s.currentLooseValue=F}else s.currentLooseValue=t.formatValue(r.parseNumber(v),n,r);return s}}])})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@progress/kendo-vue-intl")):"function"==typeof define&&define.amd?define(["@progress/kendo-vue-intl"],t):"object"==typeof exports?exports.KendoVueInputs=t(require("@progress/kendo-vue-intl")):e.KendoVueInputs=t(e.KendoVueIntl)}(window,(function(e){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";n.r(t),n.d(t,"classNames",(function(){return i})),n.d(t,"guid",(function(){return a})),n.d(t,"Keys",(function(){return r})),n.d(t,"noop",(function(){return h})),n.d(t,"canUseDOM",(function(){return s})),n.d(t,"focusFirstFocusableChild",(function(){return u})),n.d(t,"clone",(function(){return l})),n.d(t,"cloneArray",(function(){return p})),n.d(t,"cloneValue",(function(){return d})),n.d(t,"cloneObject",(function(){return c})),n.d(t,"cloneDate",(function(){return o})),n.d(t,"templateRendering",(function(){return f}));var i=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter((function(e){return!0!==e&&!!e})).map((function(e){return Array.isArray(e)?i.apply(void 0,e):"object"==typeof e?Object.keys(e).map((function(t,n){return e[n]||e[t]&&t||null})).filter((function(e){return null!==e})).join(" "):e})).filter((function(e){return!!e})).join(" ")},a=function(){var e,t,n="";for(e=0;e<32;e++)t=16*Math.random()|0,8!==e&&12!==e&&16!==e&&20!==e||(n+="-"),n+=(12===e?4:16===e?3&t|8:t).toString(16);return n},r={backspace:8,tab:9,enter:13,shift:16,esc:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,delete:46},s=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement),u=function(e){if(e){var t=e.querySelectorAll('input, [tabindex]:not([tabindex="-1"])');t.length&&t[0].focus&&t[0].focus()}},o=function(e){return e?new Date(e.getTime()):null};function l(e){var t={};return c(e,t),t}function c(e,t){for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];t[n]=d(i,t[n])}}function d(e,t){if(Array.isArray(e))return p(e);if(e instanceof Date)return o(e);if(e&&"object"==typeof e){var n=t||{};return c(e,n),n}return e}function p(e){return e.map((function(e){return d(e,void 0)}))}var h=function(){};function f(e,t){if(e){var n=this.$scopedSlots[e]||(e.toLowerCase?this.$scopedSlots[e.toLowerCase()]:null);return"string"==typeof e&&n?{type:"slot",render:n,listeners:t}:"string"==typeof e||"object"==typeof e||"function"==typeof e&&e.component?{type:"component",render:e,listeners:t}:{type:"renderFunction",render:e,listeners:t}}}},function(e,t,n){"use strict";function i(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),i(n(2)),i(n(3))},function(e,t,n){"use strict";var i=function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),r={model:{event:"changemodel"},inheritAttrs:!1,props:{defaultValue:{type:[String,Number],default:""},value:{type:[String,Number]},label:{type:String},placeholder:{type:String},required:{type:Boolean,default:!1},dir:{type:String},valid:{type:Boolean,default:void 0},validate:{type:Boolean},validationMessage:{type:String},validityStyles:{type:Boolean,default:!0}},data:function(){return{hasMounted:!1,autofill:!1,currentValue:"",valueDuringOnChange:"",input:null,inputId:a.guid(),focused:!1}},created:function(){this.$data.valueDuringOnChange=void 0,this.$data.currentValue=this.$props.defaultValue},mounted:function(){this.$data.input=this.$refs.input,this.$data.hasMounted=!0},updated:function(){this.setValidity()},render:function(e){var t=this.$props,n=t.label,r=t.id,s=t.required,u=r||this.$data.inputId,o=e("input",{domProps:i(i({},this.$attrs),{placeholder:this.$props.placeholder,id:u,required:s,value:this.computedValue}),class:i({},this.inputClassNames()),ref:"input",on:{change:this.handleChange,focus:this.emitFocus,blur:this.emitBlur,input:this.$listeners.input||this.$listeners.changemodel?this.handleInput:a.noop,animationstart:this.handleAutoFill,animationend:this.handleAutoFillEnd}});return n?e("span",{class:this.spanClassNames,on:{focusin:this.handleFocus,focusout:this.handleBlur},attrs:{dir:this.$props.dir}},[o,n?r?e("label",{attrs:{for:r},class:"k-label"},[n]):e("span",{class:"k-label"},[n]):null]):o},methods:{emitFocus:function(e){this.$emit("focus",e)},emitBlur:function(e){this.$emit("blur",e)},handleBlur:function(e){this.$data.focused=!1},handleFocus:function(e){this.$data.focused=!0},focus:function(){this.$data.input&&this.$data.input.focus()},inputClassNames:function(){var e=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-textbox":!0,"k-state-invalid":!e&&void 0!==e}},validity:function(){var e={badInput:!!this.$data.input&&this.$data.input.validity.badInput,patternMismatch:!!this.$data.input&&this.$data.input.validity.patternMismatch,rangeOverflow:!!this.$data.input&&this.$data.input.validity.rangeOverflow,rangeUnderflow:!!this.$data.input&&this.$data.input.validity.rangeUnderflow,stepMismatch:!!this.$data.input&&this.$data.input.validity.stepMismatch,tooLong:!!this.$data.input&&this.$data.input.validity.tooLong,typeMismatch:!!this.$data.input&&this.$data.input.validity.typeMismatch,valueMissing:!!this.$data.input&&this.$data.input.validity.valueMissing};return i(i({},e),{customError:void 0!==this.$props.validationMessage,valid:void 0!==this.$props.valid?this.$props.valid:!this.$data.input||!this.isInvalid(e)})},isInvalid:function(e){var t=!1;for(var n in e)e.hasOwnProperty(n)&&(t=t||e[n]);return t},setValidity:function(){this.$data.input&&this.$data.input.setCustomValidity&&this.$data.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||"")},handleInput:function(e){this.$data.currentValue=e.target.value,this.$data.valueDuringOnChange=e.target.value,this.$nextTick((function(){this.$emit("input",{event:e,value:e.target.value,component:this,target:e.target,validity:this.validity()}),this.$emit("changemodel",e.target.value),this.$data.valueDuringOnChange=void 0}))},handleChange:function(e){this.$data.currentValue=e.target.value,this.$data.valueDuringOnChange=e.target.value,this.$nextTick((function(){this.$emit("change",{event:e,value:e.target.value,component:this,target:e.target,validity:this.validity()}),this.$emit("changemodel",e.target.value),this.$data.valueDuringOnChange=void 0}))},handleAutoFill:function(e){if("autoFillStart"===e.animationName){var t=e.target.parentNode;t&&t.classList.contains("k-state-empty")&&(this.$data.autofill=!0)}},handleAutoFillEnd:function(e){"autoFillEnd"===e.animationName&&(e.target.parentNode&&(this.$data.autofill=!1))},name:function(){return this.$props.name}},computed:{spanClassNames:{get:function(){var e=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-floating-label-container":!0,"k-state-focused":this.$data.focused,"k-state-empty":!(0===this.computedValue||this.computedValue||this.$props.placeholder||this.$data.autofill),"k-autofill":this.$data.autofill,"k-state-invalid":!e&&void 0!==e,"k-rtl":"rtl"===this.$props.dir}}},computedValue:{get:function(){return void 0!==this.$data.valueDuringOnChange?this.$data.valueDuringOnChange:void 0!==this.$props.value?this.$props.value:this.$data.currentValue}}}};t.Input=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(0),r=n(5),s=n(6),u={model:{event:"changemodel"},inheritAttrs:!1,props:{value:Number,defaultValue:Number,step:{type:Number,default:1},format:[String,Object],tabIndex:Number,accessKey:String,title:String,placeholder:String,min:Number,max:Number,spinners:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},dir:String,name:String,label:String,validationMessage:String,validityStyles:{type:Boolean,default:!0},valid:{type:Boolean,default:void 0},required:{type:Boolean,default:!1},id:String},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},data:function(){return{hasMounted:!1,isInvalid:!1,isEmpty:!1,currentValue:0,valueDuringOnChange:0,currentLooseValue:"",selectionStart:0,selectionEnd:0,decimalSelect:!1,focused:!1,forceUpdate:!1}},created:function(){this._textBeforeInput="",this._inputId=a.guid(),this.$data.currentLooseValue=null,this.$data.valueDuringOnChange=void 0,this._intl=i.provideIntlService(this),this._symbols=this._intl.numberSymbols(),void 0!==this.$props.value?this.$data.currentValue=this.$props.value:void 0!==this.$props.defaultValue?this.$data.currentValue=this.$props.defaultValue:this.$data.currentValue=null},mounted:function(){this._input=this.$refs.input,this._elementWrapper=this.$refs.elementWrapper,this.$data.hasMounted=!0,this._input&&(this._textBeforeInput=this._input.value),this.setValidity()},updated:function(){document&&document.activeElement!==this._input||!this._input||null===this.$data.currentLooseValue||this.$data.forceUpdate&&(this._input.selectionStart=this.$data.selectionStart,this._input.selectionEnd=this.$data.selectionEnd,this.$data.forceUpdate=!1),this._input&&(this._textBeforeInput=this._input.value),this.setValidity()},computed:{computedValue:{get:function(){return void 0!==this.$data.valueDuringOnChange?this.$data.valueDuringOnChange:this.$data.currentValue}},looseValue:{get:function(){return s.formatValue(this.$data.focused?this.$data.currentLooseValue:s.getStateOrPropsValue(this.$props.value,this.$data.currentValue),this.$props.format,this._intl)}},spanClassNames:{get:function(){var e=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid,t=this.computedValue;return{"k-floating-label-container":!0,"k-state-focused":this.$data.focused,"k-state-empty":!(0===t||(t||this.$props.placeholder)),"k-state-invalid":!e&&void 0!==e,"k-rtl":"rtl"===this.$props.dir}}},wrapperClassNames:{get:function(){var e=!this.$props.validityStyles||this.validity().valid;return{"k-numeric-wrap":!0,"k-state-disabled":this.$props.disabled,"k-state-invalid":!e||this.$data.isInvalid}}}},methods:{validity:function(){var e=void 0!==this.$props.validationMessage,t=!this.$props.required||null!==this.computedValue;return{customError:e,valid:void 0!==this.$props.valid?this.$props.valid:t,valueMissing:null===this.computedValue}},focus:function(){this._input&&this._input.focus()},emitFocus:function(e){this.$data.currentLooseValue=this._prevLooseValue,this.$data.focused=!0,this.$emit("focus",e),this.$data.forceUpdate=!0},emitBlur:function(e){this.$data.eventValue=null,this.$data.prevLooseValue="",this.$data.currentLooseValue="",this.$data.focused=!1,this.$data.selectionStart=void 0,this.$data.selectionEnd=void 0,this.$data.decimalSelect=!1,this.$data.valueIsCorrected=!1,this.$data.valueIsOutOfRange=!1,this.$emit("blur",e),this.$data.forceUpdate=!0},handleFocus:function(e){this.$data.focused=!0},handleBlur:function(e){this.$data.focused=!1},setValidity:function(){this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||"Please enter a valid value!")},getCurrentState:function(){return{eventValue:s.getStateOrPropsValue(this.$props.value,this.$data.currentValue),prevLooseValue:this._prevLooseValue,currentLooseValue:this._input.value,selectionStart:this._input.selectionStart,selectionEnd:this._input.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:this._isPaste,focused:this.$data.focused}},parseNumber:function(e){return this._intl.parseNumber(e,this.$props.format)},elementChange:function(e){var t=this.getCurrentState();this._isPaste=!1,this.triggerChange(e,s.sanitizeNumber(t,this.$props.format,this._intl))},triggerChange:function(e,t){var n=this;if(!this.$props.disabled){this.$data.valueDuringOnChange=t.eventValue,this.$data.currentValue=t.eventValue;var i=s.formatValue(s.rangeValue(t.eventValue,this.$props.min,this.$props.max),this.$props.format,this._intl),a=s.rangeValue(this.parseNumber(i),this.$props.min,this.$props.max);if(a!==t.eventValue&&(t.valueIsOutOfRange=!0,t.eventValue=a),t.valueIsCorrected){var r=this._elementWrapper;r&&-1===r.className.indexOf("k-state-invalid")&&(this.$data.isInvalid=!0,setTimeout((function(){n.$data.isInvalid=!1}),50))}var u=this.$props.value!==t.eventValue;void 0!==this.$props.value?this.$data.currentValue=this.$props.value:this.$data.currentValue=this.$data.valueDuringOnChange,this.$data.prevLooseValue=t.prevLooseValue,this.$data.currentLooseValue=t.currentLooseValue,this.$data.selectionStart=t.selectionStart,this.$data.selectionEnd=t.selectionEnd,this.$data.decimalSelect=t.decimalSelect,this.$data.valueIsCorrected=t.valueIsCorrected,this.$data.valueIsOutOfRange=t.valueIsOutOfRange,this.$data.focused=t.focused,this.$data.isPaste=t.isPaste,this.$data.forceUpdate=!this.$data.forceUpdate,u&&(this.$emit("change",{event:e,value:this.$data.valueDuringOnChange,component:this,target:{name:this.$props.name,value:this.$data.valueDuringOnChange},validity:this.validity()}),this.$emit("changemodel",this.$data.valueDuringOnChange)),this.$data.valueDuringOnChange=void 0}},onPasteHandler:function(e){this._isPaste=!0},increase:function(e){var t=this.getCurrentState();s.increaseValue(this.parseNumber(String(t.currentLooseValue)),t,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl),this.triggerChange(e,t)},decrease:function(e){var t=this.getCurrentState();s.decreaseValue(this.parseNumber(String(t.currentLooseValue)),t,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl),this.triggerChange(e,t)},wheel:function(e){document&&document.activeElement===this._input&&this._input&&(e.deltaY<0&&(e.preventDefault(),this.increase(e)),e.deltaY>0&&(e.preventDefault(),this.decrease(e)))},keyDown:function(e){var t=this.getCurrentState(),n=this.parseNumber(String(t.currentLooseValue));if(!(t.selectionEnd>t.selectionStart&&t.selectionEnd-t.selectionStart===String(t.currentLooseValue).length)){switch(e.keyCode){case 38:s.increaseValue(n,t,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl);break;case 40:s.decreaseValue(n,t,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl);break;case 13:var i=s.formatValue(s.rangeValue(n,this.$props.min,this.$props.max),this.$props.format,this._intl),a=s.rangeValue(this.parseNumber(i),this.$props.min,this.$props.max);t.eventValue=a,t.currentLooseValue=s.formatValue(a,this.$props.format,this._intl),t.selectionStart=t.selectionEnd=t.currentLooseValue.length;break;case 110:var r=this._input,u=this._intl.numberSymbols();r&&(t.currentLooseValue=t.currentLooseValue.slice(0,t.selectionStart)+u.decimal+t.currentLooseValue.slice(t.selectionEnd),t.selectionStart=t.selectionEnd=t.selectionStart+1,t=s.sanitizeNumber(t,this.$props.format,this._intl));break;default:return}e.preventDefault(),this.triggerChange(e,t)}},spinnersWrapperMouseDown:function(e){document&&this._input&&(e.preventDefault(),document.activeElement!==this._input&&this._input.focus())}},render:function(e){var t=this.$props.id||this._inputId,n=i.provideLocalizationService(this);void 0!==this.$props.value&&this.$props.value!==this.$data.currentValue&&(this.$data.currentValue=this.$props.value),this._prevLooseValue=this.looseValue;var a=e("span",{attrs:{dir:this.$props.dir,"aria-disabled":this.$props.disabled?"true":void 0},class:"k-widget k-numerictextbox"},[e("span",{class:this.wrapperClassNames,ref:"elementWrapper"},[e("input",{attrs:{tabIndex:this.$props.tabIndex,accessKey:this.$props.accessKey,disabled:this.$props.disabled,title:this.$props.title,"aria-valuemin":this.$props.min,"aria-valuemax":this.$props.max,placeholder:this.$props.placeholder,type:this.$props.inputType||"tel",spellCheck:!1,autoComplete:"off",autoCorrect:"off",id:t,"aria-valuenow":null!==this.$data.currentValue?this.$data.currentValue:void 0,name:this.$props.name},class:"k-input k-formatted-value",domProps:{value:this.looseValue},on:{wheel:this.wheel,keydown:this.keyDown,input:this.elementChange,focus:this.emitFocus,blur:this.emitBlur,paste:this.onPasteHandler},ref:"input"}),this.$slots.default,this.$props.spinners&&e("span",{class:"k-select",on:{mousedown:this.spinnersWrapperMouseDown}},[e("span",{class:"k-link k-link-increase",attrs:{"aria-label":n.toLanguageString(r.numericIncreaseValue,r.messages[r.numericIncreaseValue]),title:n.toLanguageString(r.numericIncreaseValue,r.messages[r.numericIncreaseValue])},on:{click:this.increase}},[e("span",{class:"k-icon k-i-arrow-n"})]),e("span",{class:"k-link k-link-decrease",attrs:{"aria-label":n.toLanguageString(r.numericDecreaseValue,r.messages[r.numericDecreaseValue]),title:n.toLanguageString(r.numericDecreaseValue,r.messages[r.numericDecreaseValue])},on:{click:this.decrease}},[e("span",{class:"k-icon k-i-arrow-s"})])])])]);return this.$props.label?e("span",{class:this.spanClassNames,on:{focusin:this.handleFocus,focusout:this.handleBlur},attrs:{dir:this.$props.dir}},[a,this.$props.label?this.$props.id?e("label",{attrs:{for:this.$props.id},class:"k-label"},[this.$props.label]):e("span",{class:"k-label"},[this.$props.label]):null]):a}};t.NumericTextBox=u},function(t,n){t.exports=e},function(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.numericIncreaseValue="numerictextbox.increment",t.numericDecreaseValue="numerictextbox.decrement",t.sliderIncreaseValue="slider.increment",t.sliderDecreaseValue="slider.decrement",t.sliderDragTitle="slider.dragTitle",t.colorGradientR="colorGradient.r",t.colorGradientG="colorGradient.g",t.colorGradientB="colorGradient.b",t.colorGradientA="colorGradient.a",t.colorGradientHex="colorGradient.hex",t.messages=((i={})[t.numericIncreaseValue]="Increase value",i[t.numericDecreaseValue]="Decrease value",i[t.sliderIncreaseValue]="Increase",i[t.sliderDecreaseValue]="Decrease",i[t.sliderDragTitle]="Drag",i[t.colorGradientR]="r",i[t.colorGradientG]="g",i[t.colorGradientB]="b",i[t.colorGradientA]="a",i[t.colorGradientHex]="hex",i)},function(e,t,n){"use strict";var i=function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var a=/\d/;t.getInitialState=function(){return{eventValue:null,prevLooseValue:"",currentLooseValue:"",focused:!1,selectionStart:void 0,selectionEnd:void 0,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1}},t.getStateOrPropsValue=function(e,t){return void 0!==e?e:t},t.formatValue=function(e,t,n){return null===e&&void 0===e?"":"string"==typeof e?e:n.formatNumber(e,t)},t.increaseValue=function(e,n,i,r,s,u,o){var l=t.rangeValue((e||0)+(i||0),r,s);n.eventValue=l,n.currentLooseValue=t.formatValue(l,u,o),n.selectionStart=n.selectionEnd=t.getLastNumberIndex(n.currentLooseValue,a)},t.decreaseValue=function(e,n,i,r,s,u,o){var l=t.rangeValue((e||0)-(i||0),r,s);n.eventValue=l,n.currentLooseValue=t.formatValue(l,u,o),n.selectionStart=n.selectionEnd=t.getLastNumberIndex(n.currentLooseValue,a)},t.rangeValue=function(e,t,n){return null==e?e:e>1||e<1||1===e?void 0!==n&&void 0!==t&&n<t?null:(void 0!==n&&e>n&&(e=n),void 0!==t&&e<t&&(e=t),e):null},t.getMaxCursorPosition=function(e,t){var n=t.findIndex((function(t){t[0];var n=t[1];return Boolean(n)&&e.indexOf(n)===e.length-n.length}));if(-1===n)return-1;var i=t[n][1];return e.length-i.length},t.getMinCursorPosition=function(e,t){var n=t.findIndex((function(t){var n=t[0];t[1];return Boolean(n)&&0===e.indexOf(n)}));return-1===n?-1:t[n][0].length},t.rangeSelection=function(e,n,i){var a=t.getMaxCursorPosition(e,n);if(-1!==a&&i.selectionStart>a)i.selectionStart=i.selectionEnd=a;else{i.selectionStart>e.length&&(i.selectionStart=i.selectionEnd=e.length);var r=t.getMinCursorPosition(e,n);-1!==r&&i.selectionStart<r&&(i.selectionStart=i.selectionEnd=r),-1===i.selectionStart&&(i.selectionStart=i.selectionEnd=0)}},t.setSelection=function(e,n,i,a){e.selectionStart=e.selectionEnd=n,t.rangeSelection(i,a,e)},t.setInvalid=function(e,n,i,a){e.eventValue=a.parseNumber(e.prevLooseValue,n),e.currentLooseValue=e.prevLooseValue,e.valueIsCorrected=!0,t.setSelection(e,e.selectionStart,e.currentLooseValue,i)},t.isMinusSymbolAdded=function(e,t){var n=String(e.currentLooseValue),i=String(e.prevLooseValue);return n.split(t.minusSign).length!==i.split(t.minusSign).length&&n.length===i.length+t.minusSign.length},t.isDecimalDuplicated=function(e,t){return String(e.currentLooseValue).split(t.decimal).length>2},t.getFormatPrefixSufix=function(e,n){var i=n.formatNumber(1111111.1111111,e),a=n.formatNumber(-1111111.1111111,e),r=n.formatNumber(0,e),s=n.formatNumber(1,e),u=t.getPrefix(i),o=t.getPrefix(a),l=t.getPrefix(r),c=t.getPrefix(s);return{positiveInfo:[u,t.getSuffix(i)],negativeInfo:[o,t.getSuffix(a)],zeroInfo:[l,t.getSuffix(r)],oneInfo:[c,t.getSuffix(s)]}},t.getFormatSymbols=function(e,t){var n=t.formatNumber(1111111.1111111,e),i=t.formatNumber(-1111111.1111111,e),a=t.formatNumber(0,e),r=t.formatNumber(1,e),s=t.numberSymbols(),u=new RegExp("[\\d\\"+s.decimal+s.group+"]","g");return[n,i,a,r].map((function(e){return e.replace(u,"")})).join("").split("").filter((function(e,t,n){return n.indexOf(e)===t})).join("")},t.getInitialPosition=function(e,n){var i=e.indexOf(n.decimal);return i>-1?i:t.getLastNumberIndex(e,a)},t.reverseString=function(e){return e.split("").reverse().join("")},t.getLastNumberIndex=function(e,n){return e.length-t.reverseString(e).search(n)},t.getPrefix=function(e){return e.split(e[e.search(a)])[0]},t.getSuffix=function(e){var n=t.reverseString(e);return t.reverseString(n.split(n[n.search(a)])[0])},t.getFirstNumberIndex=function(e,t){return e.search(t)},t.getDecimalCount=function(e,t){var n=e.indexOf(t);return n>-1?e.length-n-1:0},t.changeBasedSelection=function(e,t,n,i,r){var s="0"===e.replace(r,"")[0],u="0"===t.replace(r,"")[0];if(s&&!u)return n-1;if(u&&i)return n+1;for(var o=0,l=0;l<n;l++)a.test(e.charAt(l))&&o++;for(var c=0;o>0&&t.length>c;)a.test(t.charAt(c))&&o--,c++;return c},t.sanitizeNumber=function(e,n,r){var s=i({},e),u=s.prevLooseValue,o=r.numberSymbols(),l=t.getFormatSymbols(n,r),c=String(s.currentLooseValue),d=String(u),p=new RegExp("[^\\d\\"+o.decimal+"]","g"),h=new RegExp("[^\\d\\"+o.decimal+"\\"+o.group+"]","g"),f=new RegExp("[\\d\\"+o.decimal+"\\"+o.group+"]"),v=c.replace(p,""),m=t.getFirstNumberIndex(c,a),g=-1===m?-1:t.getLastNumberIndex(c,a),$=c.indexOf(o.decimal),V=(c.substring(0,m)+c.substring(m,g).replace(h,"")+c.substring(g,c.length)).split("").filter((function(e){return-1!==l.indexOf(e)||-1!==e.search(f)})).join(""),b=r.formatNumber(.31111111111111117,n).replace(p,""),y=b.indexOf(o.decimal),S=y>-1?b.length-y-1:0,x=r.formatNumber(1,n).replace(p,""),L=x.indexOf(o.decimal),I=L>-1?x.length-L-1:0,O=t.getFormatPrefixSufix(n,r),N=[O.positiveInfo,O.negativeInfo,O.zeroInfo,O.oneInfo],_=1!==N.findIndex((function(e){return-1!==e.findIndex((function(e){return Boolean(e)}))})),C=c.length>0&&c.length<d.length;if(!s.isPaste){if(""===c)return s.eventValue=null,s.currentLooseValue="",s;if(s.currentLooseValue===o.minusSign&&r.formatNumber(-0,n)!==d)return s.eventValue=-0,s.currentLooseValue=t.formatValue(s.eventValue,n,r),t.setSelection(s,t.getInitialPosition(s.currentLooseValue,o),s.currentLooseValue,N),s;if(t.isMinusSymbolAdded(s,o)){var k=r.parseNumber(u,n);s.eventValue=-(null!==k?k:0),s.currentLooseValue=t.formatValue(s.eventValue,n,r);var D=t.getFirstNumberIndex(s.currentLooseValue,a),P=t.getFirstNumberIndex(d,a);return t.setSelection(s,s.selectionEnd-1+(D-P),s.currentLooseValue,N),s}if(s.currentLooseValue===o.decimal){s.eventValue=0;var w=t.formatValue(s.eventValue,n,r);if(0===I&&S>0){var M=t.getLastNumberIndex(w,a);s.currentLooseValue=w.substring(0,M)+o.decimal+w.substring(M)}else s.currentLooseValue=w;return t.setSelection(s,t.getInitialPosition(s.currentLooseValue,o)+1,s.currentLooseValue,N),s}if(t.isDecimalDuplicated(s,o))return t.setInvalid(s,n,N,r),s;if("p"===n&&c&&-1===c.indexOf(o.percentSign))return s.eventValue=r.parseNumber(c,n)/100,s.currentLooseValue=t.formatValue(s.eventValue,n,r),s;if(String(s.currentLooseValue).replace(/[^\d]/g,"").length>15)return t.setInvalid(s,n,N,r),s;if(v!==c&&c&&_)if(-1===N.findIndex((function(e){var t=e[0],n=e[1],i=c.indexOf(t),a=c.indexOf(n),r=0===i,s=a===c.length-n.length,u=i+t.length!==m&&-1!==m&&c[i+t.length]!==o.decimal,l=a!==g&&-1!==g&&c[a-1]!==o.decimal;return t&&n?!u&&!l&&(r&&s):t?!u&&r:!!n&&(!l&&s)})))return t.setInvalid(s,n,N,r),s;if(v[v.length-1]===o.decimal&&S>0)return s.eventValue=r.parseNumber(c,n),s.currentLooseValue=V,s;if(s.currentLooseValue&&u)if((l+o.decimal+o.group).split("").findIndex((function(e){return c.split("").filter((function(t){return t===e})).length<d.split("").filter((function(t){return t===e})).length&&c.length+1===d.length&&(e!==o.decimal||0!==t.getDecimalCount(d.replace(p,""),o.decimal))}))>-1)return s.eventValue=r.parseNumber(e.prevLooseValue,n),s.currentLooseValue=e.prevLooseValue,s;var E=t.getDecimalCount(v,o.decimal),j="0"===v[v.length-1];if(C&&j&&E<I)return s.eventValue=r.parseNumber(s.currentLooseValue,n),s.currentLooseValue=t.formatValue(s.eventValue,n,r),s;if(E>0){var B=c.substring(0,$);if(j&&(!B||0!==d.indexOf(B))){s.eventValue=r.parseNumber(s.currentLooseValue,n);var F=t.formatValue(s.eventValue,n,r);return t.setSelection(s,t.changeBasedSelection(c,F,s.selectionEnd,C,p),F,N),s.currentLooseValue=F,s}if(E>S){var A=c.indexOf(o.decimal),G=c.substring(0,A)+c.substring(A,A+1+S)+c.substring(g,String(s.currentLooseValue).length);return s.eventValue=r.parseNumber(G,n),s.currentLooseValue=G,t.setSelection(s,s.selectionStart,G,N),s}if(I!==S&&E<=S&&j)return s.eventValue=r.parseNumber(s.currentLooseValue,n),s.currentLooseValue=V,s;if(E<I)return s.eventValue=r.parseNumber(s.currentLooseValue,n),s.currentLooseValue=t.formatValue(s.eventValue,n,r),s}}if(s.eventValue=r.parseNumber(s.currentLooseValue,n),"number"==typeof s.eventValue){F=t.formatValue(s.eventValue,n,r);1===c.length?t.setSelection(s,t.getInitialPosition(F,o),F,N):t.setSelection(s,t.changeBasedSelection(c,F,s.selectionEnd,C,p),F,N),s.currentLooseValue=F}else s.currentLooseValue=t.formatValue(r.parseNumber(v),n,r);return s}}])})); |
{ | ||
"name": "@progress/kendo-vue-inputs", | ||
"description": "KendoVue Input package", | ||
"version": "1.0.0-dev.202005061030", | ||
"version": "1.0.0-dev.202005070802", | ||
"repository": { | ||
@@ -36,10 +36,10 @@ "type": "git", | ||
"peerDependencies": { | ||
"@progress/kendo-vue-intl": "^0.5.1", | ||
"@progress/kendo-vue-intl": "^1.0.0", | ||
"vue": "^2.6.11" | ||
}, | ||
"dependencies": { | ||
"@progress/kendo-vue-common": "1.0.0-dev.202005061030" | ||
"@progress/kendo-vue-common": "1.0.0-dev.202005070802" | ||
}, | ||
"devDependencies": { | ||
"@progress/kendo-vue-intl": "1.0.0-dev.202005061030", | ||
"@progress/kendo-vue-intl": "1.0.0-dev.202005070802", | ||
"cldr-core": "^34.0.0", | ||
@@ -46,0 +46,0 @@ "cldr-dates-full": "^34.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
345879
+ Added@progress/kendo-vue-common@1.0.0-dev.2020050708021.2.0(transitive)
+ Added@progress/kendo-vue-intl@1.2.0(transitive)
- Removed@progress/kendo-vue-common@0.5.81.0.0-dev.202005061030(transitive)
- Removed@progress/kendo-vue-intl@0.5.8(transitive)
- Removedvue-class-component@7.2.6(transitive)