@progress/kendo-vue-dateinputs 10.2.0-develop.11 → 10.2.0-develop.12
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/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +5 -5
- package/dist/cdn/js/kendo-vue-dateinputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +31 -30
- package/timepicker/utils.js +1 -1
- package/timepicker/utils.mjs +51 -48
package/dateinput/DateInput.js
CHANGED
|
@@ -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 u=require("vue"),p=require("@progress/kendo-date-math"),V=require("@progress/kendo-vue-intl"),T=require("./models/kendo-date.js"),o=require("@progress/kendo-vue-common"),F=require("@progress/kendo-vue-buttons"),O=require("../package-metadata.js"),$=require("./utils.js"),M=require("../utils.js"),d=require("../messages/main.js"),P=require("../timepicker/utils.js"),w=require("../defaults.js"),_=require("@progress/kendo-vue-labels"),C=require("@progress/kendo-svg-icons");function E(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!u.isVNode(e)}const q="Please enter a valid value!",A=u.defineComponent({name:"DateInput",model:{event:"changemodel"},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},emits:{change:e=>!0,changemodel:e=>!0,"update:modelValue":e=>!0,focus:e=>!0,blur:e=>!0},props:{modelValue:Date,value:Date,defaultValue:Date,format:{type:[String,Object],default:function(){return $.defaultFormat}},formatPlaceholder:{type:[String,Object],default:function(){return $.defaultFormatPlaceholder}},rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},tabIndex:Number,title:String,steps:Object,placeholder:String,max:{type:Date,default:function(){return p.cloneDate(M.MAX_DATE)}},min:{type:Date,default:function(){return p.cloneDate(M.MIN_DATE)}},maxTime:{type:Date,default:function(){return p.cloneDate(w.MAX_TIME)}},minTime:{type:Date,default:function(){return p.cloneDate(w.MIN_TIME)}},disabled:{type:Boolean,default:!1},spinners:{type:Boolean,default:!1},name:String,dir:String,label:String,id:String,validationMessage:{type:String,default:q},required:{type:Boolean,default:!1},validityStyles:{type:Boolean,default:!0},validate:Boolean,valid:{type:Boolean,default:void 0},ariaRole:{type:String,default:void 0},ariaControls:String,ariaLabel:String,ariaExpanded:{type:Boolean,default:void 0},ariaHasPopup:{type:String,default:void 0},inputAttributes:Object},data(){return{kendoDate:null,currentFormat:void 0,valueDuringOnChange:void 0,hasMounted:!1,isEmpty:void 0,isDeleting:!1,lastSelectedSymbol:void 0,isFocused:!1}},created(){o.validatePackage(O.packageMetadata);const{formatPlaceholder:e,format:t,value:a,defaultValue:i}=this.$props;this.kendoDate=new T.KendoDate(this.intl,e,t),this.kendoDate.setValue(null),this._emptyText=this.kendoDate.getTextAndFormat().text,this.kendoDate.setValue(a||i||null),this._element=null,this._inputId=o.guid()},computed:{computedValue(){return this.$data.valueDuringOnChange!==void 0?this.$data.valueDuringOnChange:this.kendoDate&&this.kendoDate.getDateObject()},wrapperClassNames(){const e=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid,t=this.$props.disabled,{size:a,fillMode:i,rounded:l}=this.$props;return{"k-dateinput":!0,"k-input":!0,[`k-input-${o.kendoThemeMaps.sizeMap[a]||a}`]:a,[`k-input-${i}`]:i,[`k-rounded-${o.kendoThemeMaps.roundedMap[l]||l}`]:l,"k-disabled":t,"k-invalid":!e&&e!==void 0,"k-focus":this.isFocused,"k-rtl":this.$props.dir==="rtl"}}},methods:{selection(){let e={start:0,end:0};const t=this.element();return t!==null&&t.selectionStart!==void 0&&(e={start:t.selectionStart,end:t.selectionEnd}),e},element(){return this._element},focus(e){this._element&&this._element.focus(e)},handleFocus(e){this.$data.isFocused=!0,this.$emit("focus",{event:e})},handleBlur(e){this.$data.isFocused=!1,this.$data.isDeleting=!1,this.$emit("blur",{event:e})},intl(){return V.provideIntlService(this)},setValidity(){const e=this.element();e&&e.setCustomValidity&&e.setCustomValidity(this.validity().valid?"":this.$props.validationMessage)},spinnersMouseDown(e){const t=this.element();e.preventDefault(),t&&o.canUseDOM&&document.activeElement!==t&&t.focus({preventScroll:!0})},elementChange(e){var g;const t=this.element();if(!t||!this.kendoDate)return;const{text:a,format:i}=this.kendoDate.getTextAndFormat();this.$data.currentFormat=i;const l=this.computedValue,n=e.inputType==="deleteContentBackward",s=(g=e.inputType)==null?void 0:g.startsWith("delete"),r=$.approximateStringMatching(a,this.$data.currentFormat,t.value,this.selection().start),m=r.length===1&&r[0][1]==="_";let h=!1,f=!1;if(!m)for(let c=0;c<r.length;c++){const y=this.kendoDate.parsePart(r[c][0],r[c][1],s);h=!!y.switchToNext,f=!!y.isComplete}if(s){this.handleDelete(n,a,t);return}if(f){t.value=a,this.setSelection(this.selectionBySymbol(r[0][0]));return}if(r.length&&r[0][0]!=="_"&&!h&&this.setSelection(this.selectionBySymbol(r[0][0])),m)this.switchDateSegment(1);else if(h){const c=this.selectionBySymbol(r[0][0]);this.switchDateSegment(1,{start:c.start,end:c.start})}this.triggerChange(e,l)},handleDelete(e,t,a){if(this.$data.isDeleting=!0,!this.kendoDate.hasValue()){a.value=t,this.setSelection(this.selectionByIndex(0));return}e&&this.computedValue===null&&this.switchDateSegment(-1)},elementClick(e){this.setSelection(this.selectionByIndex(this.selection().start))},wheel(e){const t=this.element();o.canUseDOM&&document.activeElement!==t||(e.deltaY<0&&(e.preventDefault(),this.increasePart(e)),e.deltaY>0&&(e.preventDefault(),this.decreasePart(e)))},increasePart(e){e.preventDefault(),this.modifyDateSegmentValue(1,e)},decreasePart(e){e.preventDefault(),this.modifyDateSegmentValue(-1,e)},elementKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;switch(e.keyCode||{Backspace:8,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Home:36,End:35}[e.key]){case 37:this.switchDateSegment(-1);break;case 38:this.modifyDateSegmentValue(1,e);break;case 39:this.switchDateSegment(1);break;case 40:this.modifyDateSegmentValue(-1,e);break;case 36:this.setSelection(this.selectionByIndex(0));break;case 35:this.setSelection(this.selectionByIndex(this.$data.currentFormat.length));break;default:return}e.preventDefault()},setSelection(e,t=!0){const a=this.element();t&&(this.$data.lastSelectedSymbol=this.$data.currentFormat[e.start]),o.canUseDOM&&window.requestAnimationFrame(()=>{a&&o.canUseDOM&&document.activeElement===a&&a.setSelectionRange(e.start,e.end)})},triggerChange(e,t){this.$data.valueDuringOnChange=this.computedValue,p.isEqual(t,this.computedValue)||(this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",{event:e,value:this.computedValue,component:this,target:{name:this.$props.name,value:this.$data.valueDuringOnChange,valueAsDate:this.$data.valueDuringOnChange},validity:this.validity()})),this.$data.valueDuringOnChange=void 0},selectionBySymbol(e){let t=-1,a=0;for(let i=0;i<this.$data.currentFormat.length;i++)this.$data.currentFormat[i]===e&&(a=i+1,t===-1&&(t=i));return t<0&&(t=0),{start:t,end:a}},selectionByIndex(e){let t={start:e,end:e};for(let a=e,i=e-1;a<this.$data.currentFormat.length||i>=0;a++,i--){if(a<this.$data.currentFormat.length&&this.$data.currentFormat[a]!=="_"){t=this.selectionBySymbol(this.$data.currentFormat[a]);break}if(i>=0&&this.$data.currentFormat[i]!=="_"){t=this.selectionBySymbol(this.$data.currentFormat[i]);break}}return t},switchDateSegment(e,t){const{start:a,end:i}=t||this.selection();if(a<i&&this.$data.currentFormat[a]!==this.$data.currentFormat[i-1]){this.setSelection(this.selectionByIndex(e>0?a:i-1));return}const l=this.$data.currentFormat[a];let n=a+e;for(;n>0&&n<this.$data.currentFormat.length&&!(this.$data.currentFormat[n]!==l&&this.$data.currentFormat[n]!=="_");)n+=e;if(this.$data.currentFormat[n]==="_")return;let s=n;for(;s>=0&&s<this.$data.currentFormat.length&&this.$data.currentFormat[s]===this.$data.currentFormat[n];)s+=e;n>s&&(s+1!==a||n+1!==i)?this.setSelection({start:s+1,end:n+1}):n<s&&(n!==a||s!==i)&&this.setSelection({start:n,end:s})},modifyDateSegmentValue(e,t){if(!this.kendoDate)return;const a=this.computedValue,i=this.$data.currentFormat[this.selection().start],l=this.kendoDate.symbolMap(i),n=((this.$props.steps||{})[l]||1)*e;this.kendoDate.modifyPart(i,n),this.setSelection(this.selectionBySymbol(i)),this.triggerChange(t,a)},validity(){const e=$.isInRange(this.computedValue,this.$props.min,this.$props.max)&&P.isInTimeRange(this.computedValue,this.$props.minTime,this.$props.maxTime),t=this.$props.validationMessage!==void 0,a=(!this.$props.required||this.computedValue!==null)&&e,i=this.$props.valid!==void 0?this.$props.valid:a;return{customError:t,rangeOverflow:this.computedValue&&this.$props.max.getTime()<this.computedValue.getTime()||!1,rangeUnderflow:this.computedValue&&this.computedValue.getTime()<this.$props.min.getTime()||!1,valid:i,valueMissing:this.computedValue===null}}},mounted(){this._element=o.getRef(this,"input"),this.setValidity(),this.$data.hasMounted=!0},updated(){this.$data.lastSelectedSymbol&&this.setSelection(this.selectionBySymbol(this.$data.lastSelectedSymbol)),this.setValidity()},setup(){const e=u.ref(null),t=u.inject("kendoIntlService",{}),a=u.inject("kendoLocalizationService",{});return{inputRef:e,kendoIntlService:t,kendoLocalizationService:a}},render(){const e=o.getDefaultSlots(this),t=V.provideLocalizationService(this),{formatPlaceholder:a,format:i,value:l,modelValue:n,name:s,label:r,id:m,ariaLabel:h,ariaExpanded:f,ariaHasPopup:g,ariaRole:c,ariaControls:y,inputAttributes:I}=this.$props,D=l!==void 0?l:n;this.kendoDate.format=i,this.kendoDate.formatPlaceholder=a,this.valueDuringOnChange=this.valueDuringOnChange?this.valueDuringOnChange:void 0,D!==void 0&&this.computedValue!==D&&!this.$data.isDeleting&&this.kendoDate.setValue(D);const{text:v,format:B}=this.kendoDate.getTextAndFormat();this.$data.currentFormat=B,this.$data.isEmpty=v===this._emptyText;const k=this.$props.placeholder!==void 0&&this.$data.isEmpty&&!this.$data.isFocused?null:v,b=m||this._inputId,x=!this.$props.validityStyles||this.validity().valid,S=u.createVNode("span",{class:this.wrapperClassNames,dir:this.$props.dir},[u.createVNode("input",u.mergeProps({role:c,tabindex:this.$props.tabIndex,disabled:this.$props.disabled,title:this.$props.title!==void 0?this.$props.title:v,type:"text",spellcheck:!1,autocomplete:"off",autocorrect:"off",class:"k-input-inner",id:b,placeholder:this.$props.placeholder,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onKeydown:this.elementKeyDown,onChange:o.noop,onFocusin:this.handleFocus,onFocusout:this.handleBlur,value:k,name:s,"aria-label":h,"aria-expanded":f,"aria-haspopup":g,"aria-controls":y,"aria-disabled":this.$props.disabled||void 0,ref:o.setRef(this,"input")},I),null),e,this.$props.spinners&&u.createVNode("span",{class:"k-input-spinner k-spin-button",onMousedown:this.spinnersMouseDown},[u.createVNode(F.Button,{type:"button",tabIndex:-1,icon:"chevron-up",svgIcon:C.chevronUpIcon,size:this.$props.size,fillMode:this.$props.fillMode,class:"k-spinner-increase","aria-label":t.toLanguageString(d.increaseValue,d.messages[d.increaseValue]),title:t.toLanguageString(d.increaseValue,d.messages[d.increaseValue]),onClick:this.increasePart},null),u.createVNode(F.Button,{type:"button",tabIndex:-1,class:"k-spinner-decrease",icon:"chevron-down",svgIcon:C.chevronDownIcon,size:this.$props.size,fillMode:this.$props.fillMode,"aria-label":t.toLanguageString(d.decreaseValue,d.messages[d.decreaseValue]),title:t.toLanguageString(d.decreaseValue,d.messages[d.decreaseValue]),onClick:this.decreasePart},null)])]);return r?u.createVNode(_.FloatingLabel,{label:r,editorId:b,editorValue:k,editorPlaceholder:this.$props.placeholder,editorValid:x,editorDisabled:this.$props.disabled},E(S)?S:{default:()=>[S]}):S}});exports.DateInput=A;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),p=require("@progress/kendo-date-math"),V=require("@progress/kendo-vue-intl"),T=require("./models/kendo-date.js"),o=require("@progress/kendo-vue-common"),F=require("@progress/kendo-vue-buttons"),O=require("../package-metadata.js"),$=require("./utils.js"),M=require("../utils.js"),d=require("../messages/main.js"),P=require("../timepicker/utils.js"),w=require("../defaults.js"),_=require("@progress/kendo-vue-labels"),C=require("@progress/kendo-svg-icons");function E(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!u.isVNode(e)}const q="Please enter a valid value!",A=u.defineComponent({name:"DateInput",model:{event:"changemodel"},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},emits:{change:e=>!0,changemodel:e=>!0,"update:modelValue":e=>!0,focus:e=>!0,blur:e=>!0},props:{modelValue:Date,value:Date,defaultValue:Date,format:{type:[String,Object],default:function(){return $.defaultFormat}},formatPlaceholder:{type:[String,Object],default:function(){return $.defaultFormatPlaceholder}},rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},tabIndex:Number,title:String,steps:Object,placeholder:String,max:{type:Date,default:function(){return p.cloneDate(M.MAX_DATE)}},min:{type:Date,default:function(){return p.cloneDate(M.MIN_DATE)}},maxTime:{type:Date,default:function(){return p.cloneDate(w.MAX_TIME)}},minTime:{type:Date,default:function(){return p.cloneDate(w.MIN_TIME)}},disabled:{type:Boolean,default:!1},spinners:{type:Boolean,default:!1},name:String,dir:String,label:String,id:String,validationMessage:{type:String,default:q},required:{type:Boolean,default:!1},validityStyles:{type:Boolean,default:!0},validate:Boolean,valid:{type:Boolean,default:void 0},ariaRole:{type:String,default:void 0},ariaControls:String,ariaLabel:String,ariaExpanded:{type:Boolean,default:void 0},ariaHasPopup:{type:String,default:void 0},inputAttributes:Object},data(){return{kendoDate:null,currentFormat:void 0,valueDuringOnChange:void 0,hasMounted:!1,isEmpty:void 0,isDeleting:!1,lastSelectedSymbol:void 0,isFocused:!1}},created(){o.validatePackage(O.packageMetadata);const{formatPlaceholder:e,format:t,value:a,defaultValue:i}=this.$props;this.kendoDate=new T.KendoDate(this.intl,e,t),this.kendoDate.setValue(null),this._emptyText=this.kendoDate.getTextAndFormat().text,this.kendoDate.setValue(a||i||null),this._element=null,this._inputId=o.guid()},computed:{computedValue(){return this.$data.valueDuringOnChange!==void 0?this.$data.valueDuringOnChange:this.kendoDate&&this.kendoDate.getDateObject()},wrapperClassNames(){const e=!this.$data.hasMounted||!this.$props.validityStyles||this.validity().valid,t=this.$props.disabled,{size:a,fillMode:i,rounded:l}=this.$props;return{"k-dateinput":!0,"k-input":!0,[`k-input-${o.kendoThemeMaps.sizeMap[a]||a}`]:a,[`k-input-${i}`]:i,[`k-rounded-${o.kendoThemeMaps.roundedMap[l]||l}`]:l,"k-disabled":t,"k-invalid":!e&&e!==void 0,"k-focus":this.isFocused,"k-rtl":this.$props.dir==="rtl"}}},methods:{selection(){let e={start:0,end:0};const t=this.element();return t!==null&&t.selectionStart!==void 0&&(e={start:t.selectionStart,end:t.selectionEnd}),e},element(){return this._element},focus(e){this._element&&this._element.focus(e)},handleFocus(e){this.$data.isFocused=!0,this.$emit("focus",{event:e})},handleBlur(e){this.$data.isFocused=!1,this.$data.isDeleting=!1,this.$emit("blur",{event:e})},intl(){return V.provideIntlService(this)},setValidity(){const e=this.element();e&&e.setCustomValidity&&e.setCustomValidity(this.validity().valid?"":this.$props.validationMessage)},spinnersMouseDown(e){const t=this.element();e.preventDefault(),t&&o.canUseDOM&&document.activeElement!==t&&t.focus({preventScroll:!0})},elementChange(e){var g;const t=this.element();if(!t||!this.kendoDate)return;const{text:a,format:i}=this.kendoDate.getTextAndFormat();this.$data.currentFormat=i;const l=this.computedValue,n=e.inputType==="deleteContentBackward",s=(g=e.inputType)==null?void 0:g.startsWith("delete"),r=$.approximateStringMatching(a,this.$data.currentFormat,t.value,this.selection().start),m=r.length===1&&r[0][1]==="_";let h=!1,f=!1;if(!m)for(let c=0;c<r.length;c++){const y=this.kendoDate.parsePart(r[c][0],r[c][1],s);h=!!y.switchToNext,f=!!y.isComplete}if(s){this.handleDelete(n,a,t);return}if(f){t.value=a,this.setSelection(this.selectionBySymbol(r[0][0]));return}if(r.length&&r[0][0]!=="_"&&!h&&this.setSelection(this.selectionBySymbol(r[0][0])),m)this.switchDateSegment(1);else if(h){const c=this.selectionBySymbol(r[0][0]);this.switchDateSegment(1,{start:c.start,end:c.start})}this.triggerChange(e,l)},handleDelete(e,t,a){if(this.$data.isDeleting=!0,!this.kendoDate.hasValue()){a.value=t,this.setSelection(this.selectionByIndex(0));return}e&&this.computedValue===null&&this.switchDateSegment(-1)},elementClick(e){this.setSelection(this.selectionByIndex(this.selection().start))},wheel(e){const t=this.element();o.canUseDOM&&document.activeElement!==t||(e.deltaY<0&&(e.preventDefault(),this.increasePart(e)),e.deltaY>0&&(e.preventDefault(),this.decreasePart(e)))},increasePart(e){e.preventDefault(),this.modifyDateSegmentValue(1,e)},decreasePart(e){e.preventDefault(),this.modifyDateSegmentValue(-1,e)},elementKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;switch(e.keyCode||{Backspace:8,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Home:36,End:35}[e.key]){case 37:this.switchDateSegment(-1);break;case 38:this.modifyDateSegmentValue(1,e);break;case 39:this.switchDateSegment(1);break;case 40:this.modifyDateSegmentValue(-1,e);break;case 36:this.setSelection(this.selectionByIndex(0));break;case 35:this.setSelection(this.selectionByIndex(this.$data.currentFormat.length));break;default:return}e.preventDefault()},setSelection(e,t=!0){const a=this.element();t&&(this.$data.lastSelectedSymbol=this.$data.currentFormat[e.start]),o.canUseDOM&&(a&&document.activeElement===a&&a.setSelectionRange(e.start,e.end),window.requestAnimationFrame(()=>{a&&o.canUseDOM&&document.activeElement===a&&a.setSelectionRange(e.start,e.end)}))},triggerChange(e,t){this.$data.valueDuringOnChange=this.computedValue,p.isEqual(t,this.computedValue)||(this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",{event:e,value:this.computedValue,component:this,target:{name:this.$props.name,value:this.$data.valueDuringOnChange,valueAsDate:this.$data.valueDuringOnChange},validity:this.validity()})),this.$data.valueDuringOnChange=void 0},selectionBySymbol(e){let t=-1,a=0;for(let i=0;i<this.$data.currentFormat.length;i++)this.$data.currentFormat[i]===e&&(a=i+1,t===-1&&(t=i));return t<0&&(t=0),{start:t,end:a}},selectionByIndex(e){let t={start:e,end:e};for(let a=e,i=e-1;a<this.$data.currentFormat.length||i>=0;a++,i--){if(a<this.$data.currentFormat.length&&this.$data.currentFormat[a]!=="_"){t=this.selectionBySymbol(this.$data.currentFormat[a]);break}if(i>=0&&this.$data.currentFormat[i]!=="_"){t=this.selectionBySymbol(this.$data.currentFormat[i]);break}}return t},switchDateSegment(e,t){const{start:a,end:i}=t||this.selection();if(a<i&&this.$data.currentFormat[a]!==this.$data.currentFormat[i-1]){this.setSelection(this.selectionByIndex(e>0?a:i-1));return}const l=this.$data.currentFormat[a];let n=a+e;for(;n>0&&n<this.$data.currentFormat.length&&!(this.$data.currentFormat[n]!==l&&this.$data.currentFormat[n]!=="_");)n+=e;if(this.$data.currentFormat[n]==="_")return;let s=n;for(;s>=0&&s<this.$data.currentFormat.length&&this.$data.currentFormat[s]===this.$data.currentFormat[n];)s+=e;n>s&&(s+1!==a||n+1!==i)?this.setSelection({start:s+1,end:n+1}):n<s&&(n!==a||s!==i)&&this.setSelection({start:n,end:s})},modifyDateSegmentValue(e,t){if(!this.kendoDate)return;const a=this.computedValue,i=this.$data.currentFormat[this.selection().start],l=this.kendoDate.symbolMap(i),n=((this.$props.steps||{})[l]||1)*e;this.kendoDate.modifyPart(i,n),this.setSelection(this.selectionBySymbol(i)),this.triggerChange(t,a)},validity(){const e=$.isInRange(this.computedValue,this.$props.min,this.$props.max)&&P.isInTimeRange(this.computedValue,this.$props.minTime,this.$props.maxTime),t=this.$props.validationMessage!==void 0,a=(!this.$props.required||this.computedValue!==null)&&e,i=this.$props.valid!==void 0?this.$props.valid:a;return{customError:t,rangeOverflow:this.computedValue&&this.$props.max.getTime()<this.computedValue.getTime()||!1,rangeUnderflow:this.computedValue&&this.computedValue.getTime()<this.$props.min.getTime()||!1,valid:i,valueMissing:this.computedValue===null}}},mounted(){this._element=o.getRef(this,"input"),this.setValidity(),this.$data.hasMounted=!0},updated(){this.$data.lastSelectedSymbol&&this.setSelection(this.selectionBySymbol(this.$data.lastSelectedSymbol)),this.setValidity()},setup(){const e=u.ref(null),t=u.inject("kendoIntlService",{}),a=u.inject("kendoLocalizationService",{});return{inputRef:e,kendoIntlService:t,kendoLocalizationService:a}},render(){const e=o.getDefaultSlots(this),t=V.provideLocalizationService(this),{formatPlaceholder:a,format:i,value:l,modelValue:n,name:s,label:r,id:m,ariaLabel:h,ariaExpanded:f,ariaHasPopup:g,ariaRole:c,ariaControls:y,inputAttributes:I}=this.$props,D=l!==void 0?l:n;this.kendoDate.format=i,this.kendoDate.formatPlaceholder=a,this.valueDuringOnChange=this.valueDuringOnChange?this.valueDuringOnChange:void 0,D!==void 0&&this.computedValue!==D&&!this.$data.isDeleting&&this.kendoDate.setValue(D);const{text:v,format:B}=this.kendoDate.getTextAndFormat();this.$data.currentFormat=B,this.$data.isEmpty=v===this._emptyText;const k=this.$props.placeholder!==void 0&&this.$data.isEmpty&&!this.$data.isFocused?null:v,b=m||this._inputId,x=!this.$props.validityStyles||this.validity().valid,S=u.createVNode("span",{class:this.wrapperClassNames,dir:this.$props.dir},[u.createVNode("input",u.mergeProps({role:c,tabindex:this.$props.tabIndex,disabled:this.$props.disabled,title:this.$props.title!==void 0?this.$props.title:v,type:"text",spellcheck:!1,autocomplete:"off",autocorrect:"off",class:"k-input-inner",id:b,placeholder:this.$props.placeholder,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onKeydown:this.elementKeyDown,onChange:o.noop,onFocusin:this.handleFocus,onFocusout:this.handleBlur,value:k,name:s,"aria-label":h,"aria-expanded":f,"aria-haspopup":g,"aria-controls":y,"aria-disabled":this.$props.disabled||void 0,ref:o.setRef(this,"input")},I),null),e,this.$props.spinners&&u.createVNode("span",{class:"k-input-spinner k-spin-button",onMousedown:this.spinnersMouseDown},[u.createVNode(F.Button,{type:"button",tabIndex:-1,icon:"chevron-up",svgIcon:C.chevronUpIcon,size:this.$props.size,fillMode:this.$props.fillMode,class:"k-spinner-increase","aria-label":t.toLanguageString(d.increaseValue,d.messages[d.increaseValue]),title:t.toLanguageString(d.increaseValue,d.messages[d.increaseValue]),onClick:this.increasePart},null),u.createVNode(F.Button,{type:"button",tabIndex:-1,class:"k-spinner-decrease",icon:"chevron-down",svgIcon:C.chevronDownIcon,size:this.$props.size,fillMode:this.$props.fillMode,"aria-label":t.toLanguageString(d.decreaseValue,d.messages[d.decreaseValue]),title:t.toLanguageString(d.decreaseValue,d.messages[d.decreaseValue]),onClick:this.decreasePart},null)])]);return r?u.createVNode(_.FloatingLabel,{label:r,editorId:b,editorValue:k,editorPlaceholder:this.$props.placeholder,editorValid:x,editorDisabled:this.$props.disabled},E(S)?S:{default:()=>[S]}):S}});exports.DateInput=A;
|
package/dateinput/DateInput.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { defineComponent as M, createVNode as d, mergeProps as T, ref as _, inje
|
|
|
9
9
|
import { isEqual as P, cloneDate as g } from "@progress/kendo-date-math";
|
|
10
10
|
import { provideLocalizationService as E, provideIntlService as A } from "@progress/kendo-vue-intl";
|
|
11
11
|
import { KendoDate as L } from "./models/kendo-date.mjs";
|
|
12
|
-
import { getDefaultSlots as z, noop as
|
|
12
|
+
import { getDefaultSlots as z, noop as R, setRef as j, getRef as N, canUseDOM as y, kendoThemeMaps as w, validatePackage as K, guid as H } from "@progress/kendo-vue-common";
|
|
13
13
|
import { Button as C } from "@progress/kendo-vue-buttons";
|
|
14
14
|
import { packageMetadata as q } from "../package-metadata.mjs";
|
|
15
15
|
import { isInRange as U, approximateStringMatching as W, defaultFormatPlaceholder as X, defaultFormat as Y } from "./utils.mjs";
|
|
@@ -328,9 +328,9 @@ const se = "Please enter a valid value!", ve = /* @__PURE__ */ M({
|
|
|
328
328
|
},
|
|
329
329
|
setSelection(e, t = !0) {
|
|
330
330
|
const i = this.element();
|
|
331
|
-
t && (this.$data.lastSelectedSymbol = this.$data.currentFormat[e.start]), y && window.requestAnimationFrame(() => {
|
|
331
|
+
t && (this.$data.lastSelectedSymbol = this.$data.currentFormat[e.start]), y && (i && document.activeElement === i && i.setSelectionRange(e.start, e.end), window.requestAnimationFrame(() => {
|
|
332
332
|
i && y && document.activeElement === i && i.setSelectionRange(e.start, e.end);
|
|
333
|
-
});
|
|
333
|
+
}));
|
|
334
334
|
},
|
|
335
335
|
triggerChange(e, t) {
|
|
336
336
|
this.$data.valueDuringOnChange = this.computedValue, P(t, this.computedValue) || (this.$emit("changemodel", this.computedValue), this.$emit("update:modelValue", this.computedValue), this.$emit("change", {
|
|
@@ -469,7 +469,7 @@ const se = "Please enter a valid value!", ve = /* @__PURE__ */ M({
|
|
|
469
469
|
onClick: this.elementClick,
|
|
470
470
|
onInput: this.elementChange,
|
|
471
471
|
onKeydown: this.elementKeyDown,
|
|
472
|
-
onChange:
|
|
472
|
+
onChange: R,
|
|
473
473
|
onFocusin: this.handleFocus,
|
|
474
474
|
onFocusout: this.handleBlur,
|
|
475
475
|
value: k,
|
|
@@ -479,7 +479,7 @@ const se = "Please enter a valid value!", ve = /* @__PURE__ */ M({
|
|
|
479
479
|
"aria-haspopup": p,
|
|
480
480
|
"aria-controls": m,
|
|
481
481
|
"aria-disabled": this.$props.disabled || void 0,
|
|
482
|
-
ref:
|
|
482
|
+
ref: j(this, "input")
|
|
483
483
|
}, I), null), e, this.$props.spinners && d("span", {
|
|
484
484
|
class: "k-input-spinner k-spin-button",
|
|
485
485
|
onMousedown: this.spinnersMouseDown
|