@progress/kendo-vue-inputs 6.5.0-develop.4 → 6.5.0-develop.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-vue-inputs.js +1 -1
- package/index.d.mts +38 -7
- package/index.d.ts +38 -7
- package/input-separator/InputSeparator.js +1 -1
- package/input-separator/InputSeparator.mjs +16 -5
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +72 -69
- package/numerictextbox/utils/main.js +1 -1
- package/numerictextbox/utils/main.mjs +93 -93
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -9
package/index.d.mts
CHANGED
|
@@ -1994,15 +1994,46 @@ export declare interface InputProps extends FormComponentProps {
|
|
|
1994
1994
|
|
|
1995
1995
|
/**
|
|
1996
1996
|
* Represents the Kendo UI for Vue InputSeparator component. It can be used as a separator
|
|
1997
|
-
*
|
|
1997
|
+
* between horizontal icons in prefix and suffix templates.
|
|
1998
1998
|
*
|
|
1999
|
-
*
|
|
2000
|
-
*
|
|
2001
|
-
*
|
|
2002
|
-
*
|
|
2003
|
-
*
|
|
1999
|
+
* ```jsx
|
|
2000
|
+
* <template>
|
|
2001
|
+
* <InputSeparator orientation="vertical" />
|
|
2002
|
+
* </template>
|
|
2003
|
+
* ```
|
|
2004
|
+
*/
|
|
2005
|
+
export declare const InputSeparator: DefineComponent<ExtractPropTypes< {
|
|
2006
|
+
/**
|
|
2007
|
+
* Specifies the orientation of the InputSeparator.
|
|
2008
|
+
*
|
|
2009
|
+
* @default `vertical`
|
|
2010
|
+
*/
|
|
2011
|
+
orientation: {
|
|
2012
|
+
type: () => InputSeparatorOrientation;
|
|
2013
|
+
default: InputSeparatorOrientation;
|
|
2014
|
+
};
|
|
2015
|
+
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
2016
|
+
/**
|
|
2017
|
+
* Specifies the orientation of the InputSeparator.
|
|
2018
|
+
*
|
|
2019
|
+
* @default `vertical`
|
|
2020
|
+
*/
|
|
2021
|
+
orientation: {
|
|
2022
|
+
type: () => InputSeparatorOrientation;
|
|
2023
|
+
default: InputSeparatorOrientation;
|
|
2024
|
+
};
|
|
2025
|
+
}>> & Readonly<{}>, {
|
|
2026
|
+
orientation: InputSeparatorOrientation;
|
|
2027
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
2028
|
+
|
|
2029
|
+
/**
|
|
2030
|
+
* Specifies the orientation direction of the InputSeparator.
|
|
2031
|
+
*
|
|
2032
|
+
* The possible values are:
|
|
2033
|
+
* * `vertical` (Default) — InputSeparator is displayed vertically.
|
|
2034
|
+
* * `horizontal` — InputSeparator is displayed horizontally.
|
|
2004
2035
|
*/
|
|
2005
|
-
export declare
|
|
2036
|
+
export declare type InputSeparatorOrientation = 'horizontal' | 'vertical';
|
|
2006
2037
|
|
|
2007
2038
|
/**
|
|
2008
2039
|
* @hidden
|
package/index.d.ts
CHANGED
|
@@ -1994,15 +1994,46 @@ export declare interface InputProps extends FormComponentProps {
|
|
|
1994
1994
|
|
|
1995
1995
|
/**
|
|
1996
1996
|
* Represents the Kendo UI for Vue InputSeparator component. It can be used as a separator
|
|
1997
|
-
*
|
|
1997
|
+
* between horizontal icons in prefix and suffix templates.
|
|
1998
1998
|
*
|
|
1999
|
-
*
|
|
2000
|
-
*
|
|
2001
|
-
*
|
|
2002
|
-
*
|
|
2003
|
-
*
|
|
1999
|
+
* ```jsx
|
|
2000
|
+
* <template>
|
|
2001
|
+
* <InputSeparator orientation="vertical" />
|
|
2002
|
+
* </template>
|
|
2003
|
+
* ```
|
|
2004
|
+
*/
|
|
2005
|
+
export declare const InputSeparator: DefineComponent<ExtractPropTypes< {
|
|
2006
|
+
/**
|
|
2007
|
+
* Specifies the orientation of the InputSeparator.
|
|
2008
|
+
*
|
|
2009
|
+
* @default `vertical`
|
|
2010
|
+
*/
|
|
2011
|
+
orientation: {
|
|
2012
|
+
type: () => InputSeparatorOrientation;
|
|
2013
|
+
default: InputSeparatorOrientation;
|
|
2014
|
+
};
|
|
2015
|
+
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
2016
|
+
/**
|
|
2017
|
+
* Specifies the orientation of the InputSeparator.
|
|
2018
|
+
*
|
|
2019
|
+
* @default `vertical`
|
|
2020
|
+
*/
|
|
2021
|
+
orientation: {
|
|
2022
|
+
type: () => InputSeparatorOrientation;
|
|
2023
|
+
default: InputSeparatorOrientation;
|
|
2024
|
+
};
|
|
2025
|
+
}>> & Readonly<{}>, {
|
|
2026
|
+
orientation: InputSeparatorOrientation;
|
|
2027
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
2028
|
+
|
|
2029
|
+
/**
|
|
2030
|
+
* Specifies the orientation direction of the InputSeparator.
|
|
2031
|
+
*
|
|
2032
|
+
* The possible values are:
|
|
2033
|
+
* * `vertical` (Default) — InputSeparator is displayed vertically.
|
|
2034
|
+
* * `horizontal` — InputSeparator is displayed horizontally.
|
|
2004
2035
|
*/
|
|
2005
|
-
export declare
|
|
2036
|
+
export declare type InputSeparatorOrientation = 'horizontal' | 'vertical';
|
|
2006
2037
|
|
|
2007
2038
|
/**
|
|
2008
2039
|
* @hidden
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../package-metadata.js"),a=require("@progress/kendo-vue-common"),r=e.defineComponent({props:{orientation:{type:String,default:"vertical"}},created(){a.validatePackage(t.packageMetadata)},render(){return e.createVNode("span",{class:`k-input-separator k-input-separator-${this.orientation}`},null)}});exports.InputSeparator=r;
|
|
@@ -5,16 +5,27 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
8
|
+
import { defineComponent as t, createVNode as e } from "vue";
|
|
9
9
|
import { packageMetadata as r } from "../package-metadata.mjs";
|
|
10
|
-
import { validatePackage as
|
|
11
|
-
const i = /* @__PURE__ */
|
|
10
|
+
import { validatePackage as a } from "@progress/kendo-vue-common";
|
|
11
|
+
const i = /* @__PURE__ */ t({
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* Specifies the orientation of the InputSeparator.
|
|
15
|
+
*
|
|
16
|
+
* @default `vertical`
|
|
17
|
+
*/
|
|
18
|
+
orientation: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "vertical"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
12
23
|
created() {
|
|
13
|
-
|
|
24
|
+
a(r);
|
|
14
25
|
},
|
|
15
26
|
render() {
|
|
16
27
|
return e("span", {
|
|
17
|
-
class:
|
|
28
|
+
class: `k-input-separator k-input-separator-${this.orientation}`
|
|
18
29
|
}, null);
|
|
19
30
|
}
|
|
20
31
|
});
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),s=require("@progress/kendo-vue-common"),f=require("@progress/kendo-vue-intl"),$=require("@progress/kendo-vue-buttons"),r=require("../messages/main.js"),i=require("./utils/main.js"),S=require("../package-metadata.js"),p=require("@progress/kendo-svg-icons"),k="Please enter a valid value!",C=a.defineComponent({model:{event:"changemodel"},emits:{change:null,changemodel:null,"update:modelValue":null,focus:null,blur:null},props:{modelValue:Number,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},size:{type:String,default:"medium",validator:function(t){return[null,"small","medium","large"].includes(t)}},rounded:{type:String,default:"medium",validator:function(t){return[null,"small","medium","large","full"].includes(t)}},fillMode:{type:String,default:"solid",validator:function(t){return[null,"solid","flat","outline"].includes(t)}},required:{type:Boolean,default:!1},id:String,ariaLabel:String,iconName:String,inputPrefix:[String,Function],inputSuffix:[String,Function],showValidationIcon:Boolean,showLoadingIcon:Boolean,showClearButton:Boolean,inputClass:String,inputType:{type:String,default:"tel"},wrapperClass:String,inputAttributes:Object},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},data(){return{hasMounted:!1,isInvalid:!1,isEmpty:!1,currentValue:0,valueDuringOnChange:0,currentLooseValue:"",selectionStart:0,selectionEnd:0,decimalSelect:!1,focused:!1,forceUpdate:!1}},created(){s.validatePackage(S.packageMetadata),this._textBeforeInput="",this._inputId=s.guid(),this.$data.currentLooseValue=null,this.$data.valueDuringOnChange=void 0,this._intl=f.provideIntlService(this),this._symbols=this._intl.numberSymbols(),this.$props.value!==void 0?this.$data.currentValue=this.$props.value:this.$props.modelValue!==void 0?this.$data.currentValue=this.$props.modelValue:this.$props.defaultValue!==void 0?this.$data.currentValue=this.$props.defaultValue:this.$data.currentValue=null},mounted(){this._input=s.getRef(this,"input"),this._elementWrapper=this.elementWrapperRef,this.$data.hasMounted=!0,this._input&&(this._textBeforeInput=this._input.value),this.setValidity()},updated(){!(s.canUseDOM&&document.activeElement!==this._input||!this._input)&&this.$data.currentLooseValue!==null&&this.$data.forceUpdate&&this._input.type!=="number"&&(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(){return this.$data.valueDuringOnChange!==void 0?this.$data.valueDuringOnChange:this.$data.currentValue},looseValue(){return i.formatValue(this.$data.focused?this.$data.currentLooseValue:i.getStateOrPropsValue(this.$props.value,this.$data.currentValue),this.$props.format,this._intl)},spanClassNames(){const t=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid,e=this.computedValue;return{"k-floating-label-container":!0,"k-focus":this.$data.focused,"k-empty":!(e===0||e||this.$props.placeholder),"k-invalid":!t&&t!==void 0,"k-rtl":this.$props.dir==="rtl",[this.inputClass]:this.inputClass}},wrapperClassNames(){const{size:t,fillMode:e,rounded:n,required:l,disabled:o}=this.$props,u=!this.$props.validityStyles||this.validity().valid;return{"k-input":!0,"k-numerictextbox":!0,[`k-input-${s.kendoThemeMaps.sizeMap[t]||t}`]:t,[`k-input-${e}`]:e,[`k-rounded-${s.kendoThemeMaps.roundedMap[n]||n}`]:n,"k-invalid":!u,"k-required":l,"k-disabled":o,"k-loading":this.showLoadingIcon,[this.wrapperClass]:this.wrapperClass}},inputInnerClass(){return{"k-input-inner":!0,[this.inputClass]:this.inputClass}}},methods:{validity(){const t=this.$props.validationMessage!==void 0,e=!this.$data.valueIsOutOfRange&&(!this.$props.required||this.computedValue!==null),n=this.$props.valid!==void 0?this.$props.valid:e;return{customError:t,valid:n,valueMissing:this.computedValue===null}},clearClick(t){this.$props.value!==void 0?this.$data.currentValue=this.$props.value:this.$props.modelValue!==void 0?this.$data.currentValue=this.$props.modelValue:this.$data.currentValue=null,this.$emit("changemodel",null),this.$emit("update:modelValue",null),this.$emit("change",{event:t,value:null,component:this,target:{name:this.$props.name,value:null},validity:this.validity()})},focus(){this._input&&this._input.focus()},emitFocus(t){this.$data.currentLooseValue=this._prevLooseValue,this.$data.focused=!0,this.$emit("focus",t),this.$data.forceUpdate=!0},emitBlur(t){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",t),this.$data.forceUpdate=!0},handleFocus(t){this.$data.focused=!0},handleBlur(t){this.$data.focused=!1},setValidity(){this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||k)},getCurrentState(){return{eventValue:i.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(t){return this._intl.parseNumber(t,this.$props.format)},elementChange(t){const e=this.getCurrentState();this._isPaste=!1,this.triggerChange(t,i.sanitizeNumber(e,this.$props.format,this._intl))},triggerChange(t,e){if(this.$props.disabled)return;this.$data.valueDuringOnChange=e.eventValue,this.$data.currentValue=e.eventValue;const n=i.formatValue(i.rangeValue(e.eventValue,this.$props.min,this.$props.max),this.$props.format,this._intl),l=i.rangeValue(this.parseNumber(n),this.$props.min,this.$props.max);if(l!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=l,this.$data.valueDuringOnChange=l,this.$data.currentValue=l),e.valueIsCorrected){const u=this._elementWrapper;u&&u.className.indexOf("k-invalid")===-1&&(this.$data.isInvalid=!0,setTimeout(()=>{this.$data.isInvalid=!1},50))}const o=this.$props.value!==e.eventValue;this.$props.value!==void 0?this.$data.currentValue=this.$props.value:this.$props.modelValue!==void 0?this.$data.currentValue=this.$props.modelValue:this.$data.currentValue=this.$data.valueDuringOnChange,this.$data.prevLooseValue=e.prevLooseValue,this.$data.currentLooseValue=void 0,this.$data.currentLooseValue=e.currentLooseValue,this.$data.selectionStart=e.selectionStart,this.$data.selectionEnd=e.selectionEnd,this.$data.decimalSelect=e.decimalSelect,this.$data.valueIsCorrected=e.valueIsCorrected,this.$data.valueIsOutOfRange=e.valueIsOutOfRange,this.$data.focused=e.focused,this.$data.isPaste=e.isPaste,this.$data.forceUpdate=!this.$data.forceUpdate,o&&(this.$emit("changemodel",this.$data.valueDuringOnChange),this.$emit("update:modelValue",this.$data.valueDuringOnChange),this.$emit("change",{event:t,value:this.$data.valueDuringOnChange,component:this,target:{name:this.$props.name,value:this.$data.valueDuringOnChange},validity:this.validity()})),this.$data.valueDuringOnChange=void 0},onPasteHandler(t){this._isPaste=!0},increase(t){const e=this.getCurrentState();i.increaseValue(this.parseNumber(String(e.currentLooseValue)),e,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl),this.triggerChange(t,e)},decrease(t){const e=this.getCurrentState();i.decreaseValue(this.parseNumber(String(e.currentLooseValue)),e,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl),this.triggerChange(t,e)},wheel(t){!s.canUseDOM||document.activeElement!==this._input||!this._input||(t.deltaY<0&&(t.preventDefault(),this.increase(t)),t.deltaY>0&&(t.preventDefault(),this.decrease(t)))},keyDown(t){let e=this.getCurrentState(),n,l,o,u;const d=this.parseNumber(String(e.currentLooseValue));if(!(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length)){switch(t.keyCode){case 38:i.increaseValue(d,e,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl);break;case 40:i.decreaseValue(d,e,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl);break;case 13:n=i.formatValue(i.rangeValue(d,this.$props.min,this.$props.max),this.$props.format,this._intl),l=i.rangeValue(this.parseNumber(n),this.$props.min,this.$props.max),e.eventValue=l,e.currentLooseValue=i.formatValue(l,this.$props.format,this._intl),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break;case 110:o=this._input,u=this._intl.numberSymbols(),o&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+u.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=i.sanitizeNumber(e,this.$props.format,this._intl));break;default:return}t.preventDefault(),this.triggerChange(t,e)}},spinnersWrapperMouseDown(t){s.canUseDOM&&this._input&&(t.preventDefault(),document.activeElement!==this._input&&this._input.focus())}},setup(){const t=a.ref(null),e=a.ref(null),n=a.inject("kendoLocalizationService",{}),l=a.inject("kendoIntlService",{});return{inputRef:t,elementWrapperRef:e,kendoLocalizationService:n,kendoIntlService:l}},render(){const{iconName:t,showValidationIcon:e,showLoadingIcon:n,showClearButton:l,inputAttributes:o}=this.$props,u=this.$props.id||this._inputId,d=s.getDefaultSlots(this),c=f.provideLocalizationService(this),h=this.validity().valid;this.$props.value!==void 0&&this.$props.value!==this.$data.currentValue?this.$data.currentValue=this.$props.value:this.$props.modelValue!==void 0&&this.$props.modelValue!==this.$data.currentValue&&(this.$data.currentValue=this.$props.modelValue),this._prevLooseValue=this.$data.currentLooseValue?this.looseValue:this.looseValue;const V=s.templateRendering.call(this,this.$props.inputPrefix,s.getListeners.call(this)),g=s.templateRendering.call(this,this.$props.inputSuffix,s.getListeners.call(this)),v=s.getTemplate.call(this,{h:a.h,template:V,additionalProps:{value:this.computedValue,valid:h}}),b=s.getTemplate.call(this,{h:a.h,template:g,additionalProps:{value:this.computedValue,valid:h}}),m=a.createVNode("span",{dir:this.$props.dir,class:this.wrapperClassNames,style:this.$attrs.style},[t&&a.createVNode(s.Icon,{name:t,class:"k-input-icon"},null),this.$props.inputPrefix&&a.createVNode("span",{class:"k-input-prefix"},[v]),a.createVNode("input",a.mergeProps({tabindex:this.$props.tabIndex,accesskey:this.$props.accessKey,disabled:this.$props.disabled,title:this.$props.title,"aria-label":this.$props.ariaLabel,"aria-valuemin":this.$props.min,"aria-valuemax":this.$props.max,"aria-disabled":this.$props.disabled?"true":void 0,placeholder:this.$props.placeholder,type:this.$props.inputType,spellcheck:!1,autocomplete:"off",autocorrect:"off",class:this.inputInnerClass,id:u,role:"spinbutton",value:this.looseValue,name:this.$props.name,onWheel:this.wheel,onKeydown:this.keyDown,onInput:this.elementChange,onFocus:this.emitFocus,onBlur:this.emitBlur,onPaste:this.onPasteHandler,ref:s.setRef(this,"input")},o),null),this.$props.inputSuffix&&a.createVNode("span",{class:"k-input-suffix"},[b]),e&&h&&a.createVNode(s.Icon,{name:"check",icon:p.checkIcon,class:"k-input-validation-icon"},null),e&&!h&&a.createVNode(s.Icon,{name:"exclamation-circle",icon:p.exclamationCircleIcon,class:"k-input-validation-icon"},null),n&&a.createVNode(s.Icon,{name:"loading",class:"k-input-loading-icon"},null),l&&this.computedValue!==void 0&&this.computedValue!==null&&a.createVNode("span",{onClick:this.clearClick,class:"k-clear-value"},[a.createVNode(s.Icon,{name:"x",icon:p.xIcon},null)]),d,this.$props.spinners&&a.createVNode("span",{class:"k-input-spinner k-spin-button",onMousedown:this.spinnersWrapperMouseDown},[a.createVNode($.Button,{type:"button",tabIndex:-1,icon:"caret-alt-up",svgIcon:p.caretAltUpIcon,class:"k-spinner-increase",rounded:null,"aria-label":c.toLanguageString(r.numericIncreaseValue,r.messages[r.numericIncreaseValue]),title:c.toLanguageString(r.numericIncreaseValue,r.messages[r.numericIncreaseValue]),onClick:this.increase},null),a.createVNode($.Button,{type:"button",tabIndex:-1,class:"k-spinner-decrease",icon:"caret-alt-down",svgIcon:p.caretAltDownIcon,rounded:null,"aria-label":c.toLanguageString(r.numericDecreaseValue,r.messages[r.numericDecreaseValue]),title:c.toLanguageString(r.numericDecreaseValue,r.messages[r.numericDecreaseValue]),onClick:this.decrease},null)])]);return this.$props.label?a.createVNode("span",{class:this.spanClassNames,onFocusin:this.handleFocus,onFocusout:this.handleBlur,dir:this.$props.dir},[m,this.$props.label?u?a.createVNode("label",{for:u,class:"k-floating-label"},[this.$props.label]):a.createVNode("span",{class:"k-label"},[this.$props.label]):null]):m}});exports.NumericTextBox=C;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),a=require("@progress/kendo-vue-common"),$=require("@progress/kendo-vue-intl"),g=require("@progress/kendo-vue-buttons"),r=require("../messages/main.js"),i=require("./utils/main.js"),S=require("../package-metadata.js"),h=require("@progress/kendo-svg-icons"),k="Please enter a valid value!",y=s.defineComponent({model:{event:"changemodel"},emits:{change:null,changemodel:null,"update:modelValue":null,focus:null,blur:null},props:{modelValue:Number,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},size:{type:String,default:"medium",validator:function(t){return[null,"small","medium","large"].includes(t)}},rounded:{type:String,default:"medium",validator:function(t){return[null,"small","medium","large","full"].includes(t)}},fillMode:{type:String,default:"solid",validator:function(t){return[null,"solid","flat","outline"].includes(t)}},required:{type:Boolean,default:!1},id:String,ariaLabel:String,iconName:String,inputPrefix:[String,Function],inputSuffix:[String,Function],showValidationIcon:Boolean,showLoadingIcon:Boolean,showClearButton:Boolean,inputClass:String,inputType:{type:String,default:"tel"},wrapperClass:String,inputAttributes:Object},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},data(){return{hasMounted:!1,isInvalid:!1,isEmpty:!1,currentValue:0,valueDuringOnChange:0,currentLooseValue:"",selectionStart:0,selectionEnd:0,decimalSelect:!1,focused:!1,forceUpdate:!1}},created(){a.validatePackage(S.packageMetadata),this._textBeforeInput="",this._inputId=a.guid(),this.$data.currentLooseValue=null,this.$data.valueDuringOnChange=void 0,this._intl=$.provideIntlService(this),this._symbols=this._intl.numberSymbols(),this.$props.value!==void 0?this.$data.currentValue=this.$props.value:this.$props.modelValue!==void 0?this.$data.currentValue=this.$props.modelValue:this.$props.defaultValue!==void 0?this.$data.currentValue=this.$props.defaultValue:this.$data.currentValue=null},mounted(){this._input=a.getRef(this,"input"),this._elementWrapper=this.elementWrapperRef,this.$data.hasMounted=!0,this._input&&(this._textBeforeInput=this._input.value),this.setValidity()},updated(){!(a.canUseDOM&&document.activeElement!==this._input||!this._input)&&this.$data.currentLooseValue!==null&&this.$data.forceUpdate&&this._input.type!=="number"&&(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(){return this.$data.valueDuringOnChange!==void 0?this.$data.valueDuringOnChange:this.$data.currentValue},looseValue(){return i.formatValue(this.$data.focused?this.$data.currentLooseValue:i.getStateOrPropsValue(this.$props.value,this.$data.currentValue),this.$props.format,this._intl)},spanClassNames(){const t=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid,e=this.computedValue;return{"k-floating-label-container":!0,"k-focus":this.$data.focused,"k-empty":!(e===0||e||this.$props.placeholder),"k-invalid":!t&&t!==void 0,"k-rtl":this.$props.dir==="rtl",[this.inputClass]:this.inputClass}},wrapperClassNames(){const{size:t,fillMode:e,rounded:n,required:l,disabled:d}=this.$props,u=!this.$props.validityStyles||this.validity().valid;return{"k-input":!0,"k-numerictextbox":!0,[`k-input-${a.kendoThemeMaps.sizeMap[t]||t}`]:t,[`k-input-${e}`]:e,[`k-rounded-${a.kendoThemeMaps.roundedMap[n]||n}`]:n,"k-invalid":!u,"k-required":l,"k-disabled":d,"k-loading":this.showLoadingIcon,[this.wrapperClass]:this.wrapperClass}},inputInnerClass(){return{"k-input-inner":!0,[this.inputClass]:this.inputClass}}},methods:{validity(){const t=this.$props.validationMessage!==void 0,e=!this.$data.valueIsOutOfRange&&(!this.$props.required||this.computedValue!==null),n=this.$props.valid!==void 0?this.$props.valid:e;return{customError:t,valid:n,valueMissing:this.computedValue===null}},clearClick(t){this.$props.value!==void 0?this.$data.currentValue=this.$props.value:this.$props.modelValue!==void 0?this.$data.currentValue=this.$props.modelValue:this.$data.currentValue=null,this.$emit("changemodel",null),this.$emit("update:modelValue",null),this.$emit("change",{event:t,value:null,component:this,target:{name:this.$props.name,value:null},validity:this.validity()})},focus(){this._input&&this._input.focus()},emitFocus(t){this.$data.currentLooseValue=this._prevLooseValue,this.$data.focused=!0,this.$emit("focus",t)},emitBlur(t){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",t)},handleFocus(t){this.$data.focused=!0},handleBlur(t){this.$data.focused=!1},setValidity(){this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||k)},getCurrentState(){return{eventValue:i.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(t){return this._intl.parseNumber(t,this.$props.format)},elementChange(t){const e=this.getCurrentState();this._isPaste=!1,this.triggerChange(t,i.sanitizeNumber(e,this.$props.format,this._intl))},triggerChange(t,e){if(this.$props.disabled)return;this.$data.valueDuringOnChange=e.eventValue,this.$data.currentValue=e.eventValue;const n=i.formatValue(i.rangeValue(e.eventValue,this.$props.min,this.$props.max),this.$props.format,this._intl),l=i.rangeValue(this.parseNumber(n),this.$props.min,this.$props.max);if(l!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=l,this.$data.valueDuringOnChange=l,this.$data.currentValue=l),e.valueIsCorrected){const u=this._elementWrapper;u&&u.className.indexOf("k-invalid")===-1&&(this.$data.isInvalid=!0,setTimeout(()=>{this.$data.isInvalid=!1},50))}const d=this.$props.value!==e.eventValue;this.$props.value!==void 0?this.$data.currentValue=this.$props.value:this.$props.modelValue!==void 0?this.$data.currentValue=this.$props.modelValue:this.$data.currentValue=this.$data.valueDuringOnChange,this.$data.prevLooseValue=e.prevLooseValue,this.$data.currentLooseValue=void 0,this.$data.currentLooseValue=e.currentLooseValue,this.$data.selectionStart=e.selectionStart,this.$data.selectionEnd=e.selectionEnd,this.$data.decimalSelect=e.decimalSelect,this.$data.valueIsCorrected=e.valueIsCorrected,this.$data.valueIsOutOfRange=e.valueIsOutOfRange,this.$data.focused=e.focused,this.$data.isPaste=e.isPaste,this.$data.forceUpdate=!this.$data.forceUpdate,d&&(this.$emit("changemodel",this.$data.valueDuringOnChange),this.$emit("update:modelValue",this.$data.valueDuringOnChange),this.$emit("change",{event:t,value:this.$data.valueDuringOnChange,component:this,target:{name:this.$props.name,value:this.$data.valueDuringOnChange},validity:this.validity()})),this.$data.valueDuringOnChange=void 0},onPasteHandler(t){this._isPaste=!0},increase(t){const e=this.getCurrentState();i.increaseValue(this.parseNumber(String(e.currentLooseValue)),e,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl),this.triggerChange(t,e)},decrease(t){const e=this.getCurrentState();i.decreaseValue(this.parseNumber(String(e.currentLooseValue)),e,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl),this.triggerChange(t,e)},wheel(t){!a.canUseDOM||document.activeElement!==this._input||!this._input||(t.deltaY<0&&(t.preventDefault(),this.increase(t)),t.deltaY>0&&(t.preventDefault(),this.decrease(t)))},keyDown(t){let e=this.getCurrentState(),n,l,d,u;const c=this.parseNumber(String(e.currentLooseValue));if(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length){const o=this._intl.numberSymbols(),p=o&&t.key===o.minusSign,m=o&&t.key===o.decimal;this.$data.isPaste=!p&&!m;return}switch(t.keyCode){case 38:i.increaseValue(c,e,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl);break;case 40:i.decreaseValue(c,e,this.$props.step,this.$props.min,this.$props.max,this.$props.format,this._intl);break;case 13:n=i.formatValue(i.rangeValue(c,this.$props.min,this.$props.max),this.$props.format,this._intl),l=i.rangeValue(this.parseNumber(n),this.$props.min,this.$props.max),e.eventValue=l,e.currentLooseValue=i.formatValue(l,this.$props.format,this._intl),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break;case 110:d=this._input,u=this._intl.numberSymbols(),d&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+u.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=i.sanitizeNumber(e,this.$props.format,this._intl));break;default:return}t.preventDefault(),this.triggerChange(t,e)},spinnersWrapperMouseDown(t){a.canUseDOM&&this._input&&(t.preventDefault(),document.activeElement!==this._input&&this._input.focus())}},setup(){const t=s.ref(null),e=s.ref(null),n=s.inject("kendoLocalizationService",{}),l=s.inject("kendoIntlService",{});return{inputRef:t,elementWrapperRef:e,kendoLocalizationService:n,kendoIntlService:l}},render(){const{iconName:t,showValidationIcon:e,showLoadingIcon:n,showClearButton:l,inputAttributes:d}=this.$props,u=this.$props.id||this._inputId,c=a.getDefaultSlots(this),o=$.provideLocalizationService(this),p=this.validity().valid;this.$props.value!==void 0&&this.$props.value!==this.$data.currentValue?this.$data.currentValue=this.$props.value:this.$props.modelValue!==void 0&&this.$props.modelValue!==this.$data.currentValue&&(this.$data.currentValue=this.$props.modelValue),this._prevLooseValue=this.$data.currentLooseValue?this.looseValue:this.looseValue;const m=a.templateRendering.call(this,this.$props.inputPrefix,a.getListeners.call(this)),V=a.templateRendering.call(this,this.$props.inputSuffix,a.getListeners.call(this)),v=a.getTemplate.call(this,{h:s.h,template:m,additionalProps:{value:this.computedValue,valid:p}}),b=a.getTemplate.call(this,{h:s.h,template:V,additionalProps:{value:this.computedValue,valid:p}}),f=s.createVNode("span",{dir:this.$props.dir,class:this.wrapperClassNames,style:this.$attrs.style},[t&&s.createVNode(a.Icon,{name:t,class:"k-input-icon"},null),this.$props.inputPrefix&&s.createVNode("span",{class:"k-input-prefix"},[v]),s.createVNode("input",s.mergeProps({tabindex:this.$props.tabIndex,accesskey:this.$props.accessKey,disabled:this.$props.disabled,title:this.$props.title,"aria-label":this.$props.ariaLabel,"aria-valuemin":this.$props.min,"aria-valuemax":this.$props.max,"aria-disabled":this.$props.disabled?"true":void 0,placeholder:this.$props.placeholder,type:this.$props.inputType,spellcheck:!1,autocomplete:"off",autocorrect:"off",class:this.inputInnerClass,id:u,role:"spinbutton",value:this.looseValue,name:this.$props.name,onWheel:this.wheel,onKeydown:this.keyDown,onInput:this.elementChange,onFocus:this.emitFocus,onBlur:this.emitBlur,onPaste:this.onPasteHandler,ref:a.setRef(this,"input")},d),null),this.$props.inputSuffix&&s.createVNode("span",{class:"k-input-suffix"},[b]),e&&p&&s.createVNode(a.Icon,{name:"check",icon:h.checkIcon,class:"k-input-validation-icon"},null),e&&!p&&s.createVNode(a.Icon,{name:"exclamation-circle",icon:h.exclamationCircleIcon,class:"k-input-validation-icon"},null),n&&s.createVNode(a.Icon,{name:"loading",class:"k-input-loading-icon"},null),l&&this.computedValue!==void 0&&this.computedValue!==null&&s.createVNode("span",{onClick:this.clearClick,class:"k-clear-value"},[s.createVNode(a.Icon,{name:"x",icon:h.xIcon},null)]),c,this.$props.spinners&&s.createVNode("span",{class:"k-input-spinner k-spin-button",onMousedown:this.spinnersWrapperMouseDown},[s.createVNode(g.Button,{type:"button",tabIndex:-1,icon:"caret-alt-up",svgIcon:h.caretAltUpIcon,class:"k-spinner-increase",rounded:null,"aria-label":o.toLanguageString(r.numericIncreaseValue,r.messages[r.numericIncreaseValue]),title:o.toLanguageString(r.numericIncreaseValue,r.messages[r.numericIncreaseValue]),onClick:this.increase},null),s.createVNode(g.Button,{type:"button",tabIndex:-1,class:"k-spinner-decrease",icon:"caret-alt-down",svgIcon:h.caretAltDownIcon,rounded:null,"aria-label":o.toLanguageString(r.numericDecreaseValue,r.messages[r.numericDecreaseValue]),title:o.toLanguageString(r.numericDecreaseValue,r.messages[r.numericDecreaseValue]),onClick:this.decrease},null)])]);return this.$props.label?s.createVNode("span",{class:this.spanClassNames,onFocusin:this.handleFocus,onFocusout:this.handleBlur,dir:this.$props.dir},[f,this.$props.label?u?s.createVNode("label",{for:u,class:"k-floating-label"},[this.$props.label]):s.createVNode("span",{class:"k-label"},[this.$props.label]):null]):f}});exports.NumericTextBox=y;
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
9
|
-
import { getDefaultSlots as w, templateRendering as
|
|
10
|
-
import { provideLocalizationService as
|
|
11
|
-
import { Button as
|
|
8
|
+
import { defineComponent as B, h as V, createVNode as i, mergeProps as M, ref as b, inject as S } from "vue";
|
|
9
|
+
import { getDefaultSlots as w, templateRendering as _, getListeners as k, getTemplate as y, Icon as p, setRef as R, canUseDOM as g, kendoThemeMaps as C, getRef as F, validatePackage as z, guid as T } from "@progress/kendo-vue-common";
|
|
10
|
+
import { provideLocalizationService as A, provideIntlService as U } from "@progress/kendo-vue-intl";
|
|
11
|
+
import { Button as I } from "@progress/kendo-vue-buttons";
|
|
12
12
|
import { numericIncreaseValue as d, messages as h, numericDecreaseValue as c } from "../messages/main.mjs";
|
|
13
|
-
import { sanitizeNumber as
|
|
13
|
+
import { sanitizeNumber as x, formatValue as m, rangeValue as f, decreaseValue as L, increaseValue as O, getStateOrPropsValue as D } from "./utils/main.mjs";
|
|
14
14
|
import { packageMetadata as W } from "../package-metadata.mjs";
|
|
15
15
|
import { checkIcon as j, exclamationCircleIcon as q, xIcon as K, caretAltUpIcon as H, caretAltDownIcon as Y } from "@progress/kendo-svg-icons";
|
|
16
|
-
const G = "Please enter a valid value!", ae = /* @__PURE__ */
|
|
16
|
+
const G = "Please enter a valid value!", ae = /* @__PURE__ */ B({
|
|
17
17
|
model: {
|
|
18
18
|
event: "changemodel"
|
|
19
19
|
},
|
|
@@ -124,20 +124,20 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
124
124
|
};
|
|
125
125
|
},
|
|
126
126
|
created() {
|
|
127
|
-
z(W), this._textBeforeInput = "", this._inputId = T(), this.$data.currentLooseValue = null, this.$data.valueDuringOnChange = void 0, this._intl =
|
|
127
|
+
z(W), this._textBeforeInput = "", this._inputId = T(), this.$data.currentLooseValue = null, this.$data.valueDuringOnChange = void 0, this._intl = U(this), this._symbols = this._intl.numberSymbols(), this.$props.value !== void 0 ? this.$data.currentValue = this.$props.value : this.$props.modelValue !== void 0 ? this.$data.currentValue = this.$props.modelValue : this.$props.defaultValue !== void 0 ? this.$data.currentValue = this.$props.defaultValue : this.$data.currentValue = null;
|
|
128
128
|
},
|
|
129
129
|
mounted() {
|
|
130
130
|
this._input = F(this, "input"), this._elementWrapper = this.elementWrapperRef, this.$data.hasMounted = !0, this._input && (this._textBeforeInput = this._input.value), this.setValidity();
|
|
131
131
|
},
|
|
132
132
|
updated() {
|
|
133
|
-
!(
|
|
133
|
+
!(g && document.activeElement !== this._input || !this._input) && this.$data.currentLooseValue !== null && this.$data.forceUpdate && this._input.type !== "number" && (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();
|
|
134
134
|
},
|
|
135
135
|
computed: {
|
|
136
136
|
computedValue() {
|
|
137
137
|
return this.$data.valueDuringOnChange !== void 0 ? this.$data.valueDuringOnChange : this.$data.currentValue;
|
|
138
138
|
},
|
|
139
139
|
looseValue() {
|
|
140
|
-
return m(this.$data.focused ? this.$data.currentLooseValue :
|
|
140
|
+
return m(this.$data.focused ? this.$data.currentLooseValue : D(this.$props.value, this.$data.currentValue), this.$props.format, this._intl);
|
|
141
141
|
},
|
|
142
142
|
spanClassNames() {
|
|
143
143
|
const t = !this.$data.hasMounted || !this.$props.validityStyles || this.validity().valid, e = this.computedValue;
|
|
@@ -156,17 +156,17 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
156
156
|
fillMode: e,
|
|
157
157
|
rounded: s,
|
|
158
158
|
required: a,
|
|
159
|
-
disabled:
|
|
159
|
+
disabled: r
|
|
160
160
|
} = this.$props, n = !this.$props.validityStyles || this.validity().valid;
|
|
161
161
|
return {
|
|
162
162
|
"k-input": !0,
|
|
163
163
|
"k-numerictextbox": !0,
|
|
164
|
-
[`k-input-${
|
|
164
|
+
[`k-input-${C.sizeMap[t] || t}`]: t,
|
|
165
165
|
[`k-input-${e}`]: e,
|
|
166
|
-
[`k-rounded-${
|
|
166
|
+
[`k-rounded-${C.roundedMap[s] || s}`]: s,
|
|
167
167
|
"k-invalid": !n,
|
|
168
168
|
"k-required": a,
|
|
169
|
-
"k-disabled":
|
|
169
|
+
"k-disabled": r,
|
|
170
170
|
"k-loading": this.showLoadingIcon,
|
|
171
171
|
[this.wrapperClass]: this.wrapperClass
|
|
172
172
|
};
|
|
@@ -203,10 +203,10 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
203
203
|
this._input && this._input.focus();
|
|
204
204
|
},
|
|
205
205
|
emitFocus(t) {
|
|
206
|
-
this.$data.currentLooseValue = this._prevLooseValue, this.$data.focused = !0, this.$emit("focus", t)
|
|
206
|
+
this.$data.currentLooseValue = this._prevLooseValue, this.$data.focused = !0, this.$emit("focus", t);
|
|
207
207
|
},
|
|
208
208
|
emitBlur(t) {
|
|
209
|
-
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", t)
|
|
209
|
+
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", t);
|
|
210
210
|
},
|
|
211
211
|
handleFocus(t) {
|
|
212
212
|
this.$data.focused = !0;
|
|
@@ -219,7 +219,7 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
219
219
|
},
|
|
220
220
|
getCurrentState() {
|
|
221
221
|
return {
|
|
222
|
-
eventValue:
|
|
222
|
+
eventValue: D(this.$props.value, this.$data.currentValue),
|
|
223
223
|
prevLooseValue: this._prevLooseValue,
|
|
224
224
|
currentLooseValue: this._input.value,
|
|
225
225
|
selectionStart: this._input.selectionStart,
|
|
@@ -236,7 +236,7 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
236
236
|
},
|
|
237
237
|
elementChange(t) {
|
|
238
238
|
const e = this.getCurrentState();
|
|
239
|
-
this._isPaste = !1, this.triggerChange(t,
|
|
239
|
+
this._isPaste = !1, this.triggerChange(t, x(e, this.$props.format, this._intl));
|
|
240
240
|
},
|
|
241
241
|
triggerChange(t, e) {
|
|
242
242
|
if (this.$props.disabled)
|
|
@@ -249,8 +249,8 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
249
249
|
this.$data.isInvalid = !1;
|
|
250
250
|
}, 50));
|
|
251
251
|
}
|
|
252
|
-
const
|
|
253
|
-
this.$props.value !== void 0 ? this.$data.currentValue = this.$props.value : this.$props.modelValue !== void 0 ? this.$data.currentValue = this.$props.modelValue : this.$data.currentValue = this.$data.valueDuringOnChange, this.$data.prevLooseValue = e.prevLooseValue, this.$data.currentLooseValue = void 0, this.$data.currentLooseValue = e.currentLooseValue, this.$data.selectionStart = e.selectionStart, this.$data.selectionEnd = e.selectionEnd, this.$data.decimalSelect = e.decimalSelect, this.$data.valueIsCorrected = e.valueIsCorrected, this.$data.valueIsOutOfRange = e.valueIsOutOfRange, this.$data.focused = e.focused, this.$data.isPaste = e.isPaste, this.$data.forceUpdate = !this.$data.forceUpdate,
|
|
252
|
+
const r = this.$props.value !== e.eventValue;
|
|
253
|
+
this.$props.value !== void 0 ? this.$data.currentValue = this.$props.value : this.$props.modelValue !== void 0 ? this.$data.currentValue = this.$props.modelValue : this.$data.currentValue = this.$data.valueDuringOnChange, this.$data.prevLooseValue = e.prevLooseValue, this.$data.currentLooseValue = void 0, this.$data.currentLooseValue = e.currentLooseValue, this.$data.selectionStart = e.selectionStart, this.$data.selectionEnd = e.selectionEnd, this.$data.decimalSelect = e.decimalSelect, this.$data.valueIsCorrected = e.valueIsCorrected, this.$data.valueIsOutOfRange = e.valueIsOutOfRange, this.$data.focused = e.focused, this.$data.isPaste = e.isPaste, this.$data.forceUpdate = !this.$data.forceUpdate, r && (this.$emit("changemodel", this.$data.valueDuringOnChange), this.$emit("update:modelValue", this.$data.valueDuringOnChange), this.$emit("change", {
|
|
254
254
|
event: t,
|
|
255
255
|
value: this.$data.valueDuringOnChange,
|
|
256
256
|
component: this,
|
|
@@ -266,44 +266,47 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
266
266
|
},
|
|
267
267
|
increase(t) {
|
|
268
268
|
const e = this.getCurrentState();
|
|
269
|
-
|
|
269
|
+
O(this.parseNumber(String(e.currentLooseValue)), e, this.$props.step, this.$props.min, this.$props.max, this.$props.format, this._intl), this.triggerChange(t, e);
|
|
270
270
|
},
|
|
271
271
|
decrease(t) {
|
|
272
272
|
const e = this.getCurrentState();
|
|
273
|
-
|
|
273
|
+
L(this.parseNumber(String(e.currentLooseValue)), e, this.$props.step, this.$props.min, this.$props.max, this.$props.format, this._intl), this.triggerChange(t, e);
|
|
274
274
|
},
|
|
275
275
|
wheel(t) {
|
|
276
|
-
|
|
276
|
+
!g || document.activeElement !== this._input || !this._input || (t.deltaY < 0 && (t.preventDefault(), this.increase(t)), t.deltaY > 0 && (t.preventDefault(), this.decrease(t)));
|
|
277
277
|
},
|
|
278
278
|
keyDown(t) {
|
|
279
|
-
let e = this.getCurrentState(), s, a,
|
|
280
|
-
const
|
|
281
|
-
if (
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
279
|
+
let e = this.getCurrentState(), s, a, r, n;
|
|
280
|
+
const o = this.parseNumber(String(e.currentLooseValue));
|
|
281
|
+
if (e.selectionEnd > e.selectionStart && e.selectionEnd - e.selectionStart === String(e.currentLooseValue).length) {
|
|
282
|
+
const l = this._intl.numberSymbols(), u = l && t.key === l.minusSign, $ = l && t.key === l.decimal;
|
|
283
|
+
this.$data.isPaste = !u && !$;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
switch (t.keyCode) {
|
|
287
|
+
case 38:
|
|
288
|
+
O(o, e, this.$props.step, this.$props.min, this.$props.max, this.$props.format, this._intl);
|
|
289
|
+
break;
|
|
290
|
+
case 40:
|
|
291
|
+
L(o, e, this.$props.step, this.$props.min, this.$props.max, this.$props.format, this._intl);
|
|
292
|
+
break;
|
|
293
|
+
case 13:
|
|
294
|
+
s = m(f(o, this.$props.min, this.$props.max), this.$props.format, this._intl), a = f(this.parseNumber(s), this.$props.min, this.$props.max), e.eventValue = a, e.currentLooseValue = m(a, this.$props.format, this._intl), e.selectionStart = e.selectionEnd = e.currentLooseValue.length;
|
|
295
|
+
break;
|
|
296
|
+
case 110:
|
|
297
|
+
r = this._input, n = this._intl.numberSymbols(), r && (e.currentLooseValue = e.currentLooseValue.slice(0, e.selectionStart) + n.decimal + e.currentLooseValue.slice(e.selectionEnd), e.selectionStart = e.selectionEnd = e.selectionStart + 1, e = x(e, this.$props.format, this._intl));
|
|
298
|
+
break;
|
|
299
|
+
default:
|
|
300
|
+
return;
|
|
299
301
|
}
|
|
302
|
+
t.preventDefault(), this.triggerChange(t, e);
|
|
300
303
|
},
|
|
301
304
|
spinnersWrapperMouseDown(t) {
|
|
302
|
-
|
|
305
|
+
g && this._input && (t.preventDefault(), document.activeElement !== this._input && this._input.focus());
|
|
303
306
|
}
|
|
304
307
|
},
|
|
305
308
|
setup() {
|
|
306
|
-
const t =
|
|
309
|
+
const t = b(null), e = b(null), s = S("kendoLocalizationService", {}), a = S("kendoIntlService", {});
|
|
307
310
|
return {
|
|
308
311
|
inputRef: t,
|
|
309
312
|
elementWrapperRef: e,
|
|
@@ -317,28 +320,28 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
317
320
|
showValidationIcon: e,
|
|
318
321
|
showLoadingIcon: s,
|
|
319
322
|
showClearButton: a,
|
|
320
|
-
inputAttributes:
|
|
321
|
-
} = this.$props, n = this.$props.id || this._inputId,
|
|
323
|
+
inputAttributes: r
|
|
324
|
+
} = this.$props, n = this.$props.id || this._inputId, o = w(this), l = A(this), u = this.validity().valid;
|
|
322
325
|
this.$props.value !== void 0 && this.$props.value !== this.$data.currentValue ? this.$data.currentValue = this.$props.value : this.$props.modelValue !== void 0 && this.$props.modelValue !== this.$data.currentValue && (this.$data.currentValue = this.$props.modelValue), this._prevLooseValue = this.$data.currentLooseValue ? this.looseValue : this.looseValue;
|
|
323
|
-
const
|
|
324
|
-
h:
|
|
325
|
-
template:
|
|
326
|
+
const $ = _.call(this, this.$props.inputPrefix, k.call(this)), N = _.call(this, this.$props.inputSuffix, k.call(this)), E = y.call(this, {
|
|
327
|
+
h: V,
|
|
328
|
+
template: $,
|
|
326
329
|
additionalProps: {
|
|
327
330
|
value: this.computedValue,
|
|
328
|
-
valid:
|
|
331
|
+
valid: u
|
|
329
332
|
}
|
|
330
|
-
}),
|
|
331
|
-
h:
|
|
333
|
+
}), P = y.call(this, {
|
|
334
|
+
h: V,
|
|
332
335
|
template: N,
|
|
333
336
|
additionalProps: {
|
|
334
337
|
value: this.computedValue,
|
|
335
|
-
valid:
|
|
338
|
+
valid: u
|
|
336
339
|
}
|
|
337
|
-
}),
|
|
340
|
+
}), v = i("span", {
|
|
338
341
|
dir: this.$props.dir,
|
|
339
342
|
class: this.wrapperClassNames,
|
|
340
343
|
style: this.$attrs.style
|
|
341
|
-
}, [t && i(
|
|
344
|
+
}, [t && i(p, {
|
|
342
345
|
name: t,
|
|
343
346
|
class: "k-input-icon"
|
|
344
347
|
}, null), this.$props.inputPrefix && i("span", {
|
|
@@ -369,47 +372,47 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
369
372
|
onBlur: this.emitBlur,
|
|
370
373
|
onPaste: this.onPasteHandler,
|
|
371
374
|
ref: R(this, "input")
|
|
372
|
-
},
|
|
375
|
+
}, r), null), this.$props.inputSuffix && i("span", {
|
|
373
376
|
class: "k-input-suffix"
|
|
374
|
-
}, [
|
|
377
|
+
}, [P]), e && u && i(p, {
|
|
375
378
|
name: "check",
|
|
376
379
|
icon: j,
|
|
377
380
|
class: "k-input-validation-icon"
|
|
378
|
-
}, null), e && !
|
|
381
|
+
}, null), e && !u && i(p, {
|
|
379
382
|
name: "exclamation-circle",
|
|
380
383
|
icon: q,
|
|
381
384
|
class: "k-input-validation-icon"
|
|
382
|
-
}, null), s && i(
|
|
385
|
+
}, null), s && i(p, {
|
|
383
386
|
name: "loading",
|
|
384
387
|
class: "k-input-loading-icon"
|
|
385
388
|
}, null), a && this.computedValue !== void 0 && this.computedValue !== null && i("span", {
|
|
386
389
|
onClick: this.clearClick,
|
|
387
390
|
class: "k-clear-value"
|
|
388
|
-
}, [i(
|
|
391
|
+
}, [i(p, {
|
|
389
392
|
name: "x",
|
|
390
393
|
icon: K
|
|
391
|
-
}, null)]),
|
|
394
|
+
}, null)]), o, this.$props.spinners && i("span", {
|
|
392
395
|
class: "k-input-spinner k-spin-button",
|
|
393
396
|
onMousedown: this.spinnersWrapperMouseDown
|
|
394
|
-
}, [i(
|
|
397
|
+
}, [i(I, {
|
|
395
398
|
type: "button",
|
|
396
399
|
tabIndex: -1,
|
|
397
400
|
icon: "caret-alt-up",
|
|
398
401
|
svgIcon: H,
|
|
399
402
|
class: "k-spinner-increase",
|
|
400
403
|
rounded: null,
|
|
401
|
-
"aria-label":
|
|
402
|
-
title:
|
|
404
|
+
"aria-label": l.toLanguageString(d, h[d]),
|
|
405
|
+
title: l.toLanguageString(d, h[d]),
|
|
403
406
|
onClick: this.increase
|
|
404
|
-
}, null), i(
|
|
407
|
+
}, null), i(I, {
|
|
405
408
|
type: "button",
|
|
406
409
|
tabIndex: -1,
|
|
407
410
|
class: "k-spinner-decrease",
|
|
408
411
|
icon: "caret-alt-down",
|
|
409
412
|
svgIcon: Y,
|
|
410
413
|
rounded: null,
|
|
411
|
-
"aria-label":
|
|
412
|
-
title:
|
|
414
|
+
"aria-label": l.toLanguageString(c, h[c]),
|
|
415
|
+
title: l.toLanguageString(c, h[c]),
|
|
413
416
|
onClick: this.decrease
|
|
414
417
|
}, null)])]);
|
|
415
418
|
return this.$props.label ? i("span", {
|
|
@@ -417,12 +420,12 @@ const G = "Please enter a valid value!", ae = /* @__PURE__ */ P({
|
|
|
417
420
|
onFocusin: this.handleFocus,
|
|
418
421
|
onFocusout: this.handleBlur,
|
|
419
422
|
dir: this.$props.dir
|
|
420
|
-
}, [
|
|
423
|
+
}, [v, this.$props.label ? n ? i("label", {
|
|
421
424
|
for: n,
|
|
422
425
|
class: "k-floating-label"
|
|
423
426
|
}, [this.$props.label]) : i("span", {
|
|
424
427
|
class: "k-label"
|
|
425
|
-
}, [this.$props.label]) : null]) :
|
|
428
|
+
}, [this.$props.label]) : null]) : v;
|
|
426
429
|
}
|
|
427
430
|
});
|
|
428
431
|
export {
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=11111111111111e-7,he=.31111111111111117,Le=1,ee=1,ne=0,V=/\d/,te=15,Ie=(t,n)=>t!==void 0?t:n,m=(t,n,r)=>t===null&&t===void 0?"":typeof t=="string"?t:r.formatNumber(t,n),T=t=>(String(t).split(".")[1]||"").length,re=(t,n)=>Math.max(T(t),T(n)),oe=t=>Math.min(t,te),G=(t,n)=>{const r=oe(n);return parseFloat(t.toFixed(r))},Ne=(t,n,r,e,u,o,a)=>{const s=re(t||0,r||0),c=U(G((t||0)+(r||0),s),e,u);n.eventValue=c,n.currentLooseValue=m(c,o,a),n.selectionStart=n.selectionEnd=N(n.currentLooseValue,V)},Pe=(t,n,r,e,u,o,a)=>{const s=re(t||0,r||0),c=U(G((t||0)-(r||0),s),e,u);n.eventValue=c,n.currentLooseValue=m(c,o,a),n.selectionStart=n.selectionEnd=N(n.currentLooseValue,V)},U=(t,n,r)=>t==null?t:!(t>1||t<1||t===1)||r!==void 0&&n!==void 0&&r<n?null:(r!==void 0&&t>r&&(t=r),n!==void 0&&t<n&&(t=n),t),se=(t,n)=>{const r=n.findIndex(([u,o])=>!!o&&t.indexOf(o)===t.length-o.length);if(r===-1)return-1;const e=n[r][1];return t.length-e.length},ue=(t,n)=>{const r=n.findIndex(([u,o])=>!!u&&t.indexOf(u)===0);return r===-1?-1:n[r][0].length},ie=(t,n,r)=>{const e=se(t,n);if(e!==-1&&r.selectionStart>e){r.selectionStart=r.selectionEnd=e;return}r.selectionStart>t.length&&(r.selectionStart=r.selectionEnd=t.length);const u=ue(t,n);u!==-1&&r.selectionStart<u&&(r.selectionStart=r.selectionEnd=u),r.selectionStart===-1&&(r.selectionStart=r.selectionEnd=0)},x=(t,n,r,e)=>{t.selectionStart=t.selectionEnd=n,ie(r,e,t)},M=(t,n,r,e)=>{t.eventValue=e.parseNumber(t.prevLooseValue,n),t.currentLooseValue=t.prevLooseValue,t.valueIsCorrected=!0,x(t,t.selectionStart,t.currentLooseValue,r)},v=(t,n,r)=>n.split(t).length!==r.split(t).length&&n.length===r.length+t.length,ce=(t,n)=>{const r=String(t.currentLooseValue),e=String(t.prevLooseValue);return v(n.minusSign,r,e)||v("-",r,e)||v("−",r,e)},le=(t,n)=>{const r=String(t.currentLooseValue),e=String(t.prevLooseValue);return r.indexOf(n.minusSign)===-1&&e.indexOf(n.minusSign)!==-1},ae=(t,n)=>String(t.currentLooseValue).split(n.decimal).length>2,de=(t,n)=>{const r=n.formatNumber(w,t),e=n.formatNumber(-11111111111111e-7,t),u=n.formatNumber(ne,t),o=n.formatNumber(ee,t),a=D(r),s=D(e),c=D(u),l=D(o),P=O(r),C=O(e),b=O(u),h=O(o);return{positiveInfo:[a,P],negativeInfo:[s,C],zeroInfo:[c,b],oneInfo:[l,h]}},ge=(t,n)=>{const r=n.formatNumber(w,t),e=n.formatNumber(-11111111111111e-7,t),u=n.formatNumber(ne,t),o=n.formatNumber(ee,t),a=n.numberSymbols(),s=new RegExp(`[\\d\\${a.decimal}${a.group}]`,"g");return[r,e,u,o].map(l=>l.replace(s,"")).join("").split("").filter((l,P,C)=>C.indexOf(l)===P).join("")},y=(t,n)=>{const r=t.indexOf(n.decimal);return r>-1?r:N(t,V)},S=t=>t.split("").reverse().join(""),N=(t,n)=>t.length-S(t).search(n),D=t=>t.split(t[t.search(V)])[0],O=t=>{const n=S(t);return S(n.split(n[n.search(V)])[0])},F=(t,n)=>t.search(n),$=(t,n)=>{const r=t.indexOf(n);return r>-1?t.length-r-1:0},j=(t,n,r,e,u)=>{const o=t.replace(u,"")[0]==="0",a=n.replace(u,"")[0]==="0";if(o&&!a)return r-1;if(a&&e)return r+1;let s=0;for(let l=0;l<r;l++)V.test(t.charAt(l))&&s++;let c=0;for(;s>0&&n.length>c;)V.test(n.charAt(c))&&s--,c++;return c},Ce=(t,n,r)=>{const e={...t},{prevLooseValue:u}=e,o=r.numberSymbols(),a=ge(n,r),s=String(e.currentLooseValue),c=String(u),l=new RegExp(`[^\\d\\${o.decimal}]`,"g"),P=new RegExp(`[^\\d\\${o.decimal}\\${o.group}]`,"g"),C=new RegExp(`[\\d\\${o.decimal}\\${o.group}]`),b=s.replace(l,""),h=F(s,V),E=h===-1?-1:N(s,V),fe=s.indexOf(o.decimal),X=(s.substring(0,h)+s.substring(h,E).replace(P,"")+s.substring(E,s.length)).split("").filter(p=>a.indexOf(p)!==-1||p.search(C)!==-1).join(""),Z=r.formatNumber(he,n).replace(l,""),W=Z.indexOf(o.decimal),I=W>-1?Z.length-W-1:0,k=r.formatNumber(Le,n).replace(l,""),q=k.indexOf(o.decimal),R=q>-1?k.length-q-1:0,{positiveInfo:me,negativeInfo:Ve,zeroInfo:pe,oneInfo:xe}=de(n,r),g=[me,Ve,pe,xe],be=g.findIndex(p=>p.findIndex(L=>!!L)!==-1)!==1,z=s.length>0&&s.length<c.length,H=typeof n=="string"&&n[0]==="p"&&s&&s.indexOf(o.percentSign)===-1;if(!e.isPaste){if(s==="")return e.eventValue=null,e.currentLooseValue="",e;if(e.currentLooseValue===o.minusSign&&r.formatNumber(-0,n)!==c)return e.eventValue=-0,e.currentLooseValue=m(e.eventValue,n,r),x(e,y(e.currentLooseValue,o),e.currentLooseValue,g),e;if(e.currentLooseValue===o.decimal){e.eventValue=0;const f=m(e.eventValue,n,r);if(R===0&&I>0){const i=N(f,V);e.currentLooseValue=f.substring(0,i)+o.decimal+f.substring(i)}else e.currentLooseValue=f;return x(e,y(e.currentLooseValue,o)+1,e.currentLooseValue,g),e}if(ce(e,o)){const f=r.parseNumber(u,n);e.eventValue=-(f!==null?f:0),e.currentLooseValue=m(e.eventValue,n,r);const i=F(e.currentLooseValue,V),d=F(c,V);return x(e,e.selectionEnd-1+(i-d),e.currentLooseValue,g),e}if(le(e,o))return e.eventValue=r.parseNumber(e.currentLooseValue,n),x(e,e.selectionStart,e.currentLooseValue,g),e;if(ae(e,o))return M(e,n,g,r),e;if(H)return e.eventValue=r.parseNumber(s,n)/100,e.currentLooseValue=m(e.eventValue,n,r),e;if(String(e.currentLooseValue).replace(/[^\d]/g,"").length>te||b!==s&&s&&be&&g.findIndex(([i,d])=>{const _=s.indexOf(i),B=s.indexOf(d),J=_===0,K=B===s.length-d.length,Q=_+i.length!==h&&h!==-1&&s[_+i.length]!==o.decimal,Y=B!==E&&E!==-1&&s[B-1]!==o.decimal;return i&&d?Q||Y?!1:J&&K:i?Q?!1:J:d?Y?!1:K:!1})===-1)return M(e,n,g,r),e;if(b[b.length-1]===o.decimal&&I>0)return e.eventValue=r.parseNumber(s,n),e.currentLooseValue=X,e;if(e.currentLooseValue&&u&&(a+o.decimal+o.group).split("").findIndex(i=>s.split("").filter(d=>d===i).length<c.split("").filter(d=>d===i).length&&s.length+1===c.length?!(i===o.decimal&&$(c.replace(l,""),o.decimal)===0):!1)>-1)return e.eventValue=r.parseNumber(t.prevLooseValue,n),e.currentLooseValue=t.prevLooseValue,e;const L=$(b,o.decimal),A=b[b.length-1]==="0";if(z&&A&&L<R)return e.eventValue=r.parseNumber(e.currentLooseValue,n),e.currentLooseValue=m(e.eventValue,n,r),e;if(L>0){const f=s.substring(0,fe);if(A&&(!f||c.indexOf(f)!==0)){e.eventValue=r.parseNumber(e.currentLooseValue,n);const i=m(e.eventValue,n,r);return x(e,j(s,i,e.selectionEnd,z,l),i,g),e.currentLooseValue=i,e}if(L>I){const i=s.indexOf(o.decimal),d=s.substring(0,i)+s.substring(i,i+1+I)+s.substring(E,String(e.currentLooseValue).length);return e.eventValue=r.parseNumber(d,n),e.currentLooseValue=d,x(e,e.selectionStart,d,g),e}if(R!==I&&L<=I&&A)return e.eventValue=r.parseNumber(e.currentLooseValue,n),e.currentLooseValue=X,e;if(L<R)return e.eventValue=r.parseNumber(e.currentLooseValue,n),e.currentLooseValue=m(e.eventValue,n,r),e}}if(e.eventValue=r.parseNumber(e.currentLooseValue,n),H&&(e.eventValue=e.eventValue/100),typeof e.eventValue=="number"){const p=m(e.eventValue,n,r);s.length===1?x(e,y(p,o),p,g):x(e,j(s,p,e.selectionEnd,z,l),p,g),e.currentLooseValue=p}else e.currentLooseValue=m(r.parseNumber(b),n,r);return e};exports.changeBasedSelection=j;exports.decreaseValue=Pe;exports.formatValue=m;exports.fractionLength=T;exports.getDecimalCount=$;exports.getFirstNumberIndex=F;exports.getFormatPrefixSufix=de;exports.getFormatSymbols=ge;exports.getInitialPosition=y;exports.getLastNumberIndex=N;exports.getMaxCursorPosition=se;exports.getMinCursorPosition=ue;exports.getPrefix=D;exports.getStateOrPropsValue=Ie;exports.getSuffix=O;exports.increaseValue=Ne;exports.isDecimalDuplicated=ae;exports.isMinusSymbolAdded=ce;exports.isMinusSymbolRemoved=le;exports.limitPrecision=oe;exports.rangeSelection=ie;exports.rangeValue=U;exports.reverseString=S;exports.sanitizeNumber=Ce;exports.setInvalid=M;exports.setSelection=x;exports.toFixedPrecision=G;
|