@progress/kendo-vue-dateinputs 6.1.0-develop.1 → 6.1.0-develop.2

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.
@@ -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 o=require("vue"),u=require("@progress/kendo-date-math"),y=require("@progress/kendo-vue-intl"),O=require("./models/kendo-date.js"),l=require("@progress/kendo-vue-common"),S=require("@progress/kendo-vue-buttons"),T=require("../package-metadata.js"),p=require("./utils.js"),D=require("../utils.js"),r=require("../messages/main.js"),B=require("../timepicker/utils.js"),v=require("../defaults.js"),_=require("@progress/kendo-vue-labels"),b=require("@progress/kendo-svg-icons");function P(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!o.isVNode(e)}const q="Please enter a valid value!",E=o.defineComponent({name:"DateInput",model:{event:"changemodel"},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},emits:{change:null,changemodel:null,"update:modelValue":null,focus:null,blur:null},props:{modelValue:Date,value:Date,defaultValue:Date,format:{type:[String,Object],default:function(){return p.defaultFormat}},formatPlaceholder:{type:[String,Object],default:function(){return p.defaultFormatPlaceholder}},rounded:{type:String,default:"medium",validator:function(e){return["small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,default:"medium",validator:function(e){return["small","medium","large"].includes(e)}},tabIndex:Number,title:String,steps:Object,placeholder:String,max:{type:Date,default:function(){return u.cloneDate(D.MAX_DATE)}},min:{type:Date,default:function(){return u.cloneDate(D.MIN_DATE)}},maxTime:{type:Date,default:function(){return u.cloneDate(v.MAX_TIME)}},minTime:{type:Date,default:function(){return u.cloneDate(v.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:"textbox"},ariaControls:String,ariaLabel:String,ariaExpanded:{type:Boolean,default:void 0},ariaHasPopup:{type:String,default:void 0}},data(){return{kendoDate:null,currentFormat:void 0,valueDuringOnChange:void 0,hasMounted:!1,isEmpty:void 0,lastSelectedSymbol:void 0,isFocused:!1}},created(){l.validatePackage(T.packageMetadata);const{formatPlaceholder:e,format:t,value:a,defaultValue:i}=this.$props;this.kendoDate=new O.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=l.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:n}=this.$props;return{"k-dateinput":!0,"k-input":!0,[`k-input-${l.kendoThemeMaps.sizeMap[a]||a}`]:a,[`k-input-${i}`]:i,[`k-rounded-${l.kendoThemeMaps.roundedMap[n]||n}`]:n,"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",e)},handleBlur(e){this.$data.isFocused=!1,this.$emit("blur",e)},intl(){return y.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&&l.canUseDOM&&document.activeElement!==t&&t.focus({preventScroll:!0})},elementChange(e){const t=this.element();if(!t||!this.kendoDate)return;const{text:a,format:i}=this.kendoDate.getTextAndFormat();this.$data.currentFormat=i;const n=this.computedValue,s=p.approximateStringMatching(a,this.$data.currentFormat,t.value,this.selection().start),c=s.length===1&&s[0][1]==="_";if(!c)for(let d=0;d<s.length;d++)this.kendoDate.parsePart(s[d][0],s[d][1]);s.length&&s[0][0]!=="_"&&this.setSelection(this.selectionBySymbol(s[0][0])),c&&this.switchDateSegment(1),this.triggerChange(e,n)},elementClick(e){this.setSelection(this.selectionByIndex(this.selection().start))},wheel(e){const t=this.element();l.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){switch(e.keyCode){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;default:return}e.preventDefault()}},setSelection(e){const t=this.element();this.$data.lastSelectedSymbol=this.$data.currentFormat[e.start],l.canUseDOM&&window.requestAnimationFrame(()=>{t&&l.canUseDOM&&document.activeElement===t&&t.setSelectionRange(e.start,e.end)})},triggerChange(e,t){this.$data.valueDuringOnChange=this.computedValue,u.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){const{start:t,end:a}=this.selection();if(t<a&&this.$data.currentFormat[t]!==this.$data.currentFormat[a-1]){this.setSelection(this.selectionByIndex(e>0?t:a-1));return}const i=this.$data.currentFormat[t];let n=t+e;for(;n>0&&n<this.$data.currentFormat.length&&!(this.$data.currentFormat[n]!==i&&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!==t||n+1!==a)?this.setSelection({start:s+1,end:n+1}):n<s&&(n!==t||s!==a)&&this.setSelection({start:n,end:s})},modifyDateSegmentValue(e,t){if(!this.kendoDate)return;const a=this.computedValue,i=this.$data.currentFormat[this.selection().start],n=this.kendoDate.symbolMap(i),s=((this.$props.steps||{})[n]||1)*e;this.kendoDate.modifyPart(i,s),this.setSelection(this.selectionBySymbol(i)),this.triggerChange(t,a)},validity(){const e=p.isInRange(this.computedValue,this.$props.min,this.$props.max)&&B.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=l.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=o.ref(null),t=o.inject("kendoIntlService",{}),a=o.inject("kendoLocalizationService",{});return{inputRef:e,kendoIntlService:t,kendoLocalizationService:a}},render(){const e=l.getDefaultSlots(this),t=y.provideLocalizationService(this),{formatPlaceholder:a,format:i,value:n,modelValue:s,name:c,label:d,id:k,ariaLabel:V,ariaExpanded:F,ariaHasPopup:M,ariaRole:I,ariaControls:C}=this.$props,m=n!==void 0?n:s;this.kendoDate.format=i,this.kendoDate.formatPlaceholder=a,this.valueDuringOnChange=this.valueDuringOnChange?this.valueDuringOnChange:void 0,m!==void 0&&this.computedValue!==m&&this.kendoDate.setValue(m);const{text:f,format:x}=this.kendoDate.getTextAndFormat();this.$data.currentFormat=x,this.$data.isEmpty=f===this._emptyText;const g=this.$props.placeholder!==void 0&&this.$data.isEmpty&&!this.$data.isFocused?null:f,$=k||this._inputId,w=!this.$props.validityStyles||this.validity().valid,h=o.createVNode("span",{class:this.wrapperClassNames,dir:this.$props.dir},[o.createVNode("input",{role:I,tabindex:this.$props.tabIndex,disabled:this.$props.disabled,title:this.$props.title!==void 0?this.$props.title:f,type:"text",spellcheck:!1,autocomplete:"off",autocorrect:"off",class:"k-input-inner",id:$,placeholder:this.$props.placeholder,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onKeydown:this.elementKeyDown,onChange:l.noop,onFocusin:this.handleFocus,onFocusout:this.handleBlur,value:g,name:c,"aria-label":V,"aria-expanded":F,"aria-haspopup":M,"aria-controls":C,"aria-disabled":this.$props.disabled,ref:l.setRef(this,"input")},null),e,this.$props.spinners&&o.createVNode("span",{class:"k-input-spinner k-spin-button",onMousedown:this.spinnersMouseDown},[o.createVNode(S.Button,{type:"button",tabIndex:-1,icon:"caret-alt-up",svgIcon:b.caretAltUpIcon,size:this.$props.size,fillMode:this.$props.fillMode,class:"k-spinner-increase","aria-label":t.toLanguageString(r.increaseValue,r.messages[r.increaseValue]),title:t.toLanguageString(r.increaseValue,r.messages[r.increaseValue]),onClick:this.increasePart},null),o.createVNode(S.Button,{type:"button",tabIndex:-1,class:"k-spinner-decrease",icon:"caret-alt-down",svgIcon:b.caretAltDownIcon,size:this.$props.size,fillMode:this.$props.fillMode,"aria-label":t.toLanguageString(r.decreaseValue,r.messages[r.decreaseValue]),title:t.toLanguageString(r.decreaseValue,r.messages[r.decreaseValue]),onClick:this.decreasePart},null)])]);return d?o.createVNode(_.FloatingLabel,{label:d,editorId:$,editorValue:g,editorPlaceholder:this.$props.placeholder,editorValid:w,editorDisabled:this.$props.disabled},P(h)?h:{default:()=>[h]}):h}});exports.DateInput=E;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),u=require("@progress/kendo-date-math"),y=require("@progress/kendo-vue-intl"),T=require("./models/kendo-date.js"),l=require("@progress/kendo-vue-common"),S=require("@progress/kendo-vue-buttons"),B=require("../package-metadata.js"),p=require("./utils.js"),D=require("../utils.js"),r=require("../messages/main.js"),P=require("../timepicker/utils.js"),b=require("../defaults.js"),_=require("@progress/kendo-vue-labels"),v=require("@progress/kendo-svg-icons");function q(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!o.isVNode(e)}const E="Please enter a valid value!",A=o.defineComponent({name:"DateInput",model:{event:"changemodel"},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},emits:{change:null,changemodel:null,"update:modelValue":null,focus:null,blur:null},props:{modelValue:Date,value:Date,defaultValue:Date,format:{type:[String,Object],default:function(){return p.defaultFormat}},formatPlaceholder:{type:[String,Object],default:function(){return p.defaultFormatPlaceholder}},rounded:{type:String,default:"medium",validator:function(e){return["small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,default:"medium",validator:function(e){return["small","medium","large"].includes(e)}},tabIndex:Number,title:String,steps:Object,placeholder:String,max:{type:Date,default:function(){return u.cloneDate(D.MAX_DATE)}},min:{type:Date,default:function(){return u.cloneDate(D.MIN_DATE)}},maxTime:{type:Date,default:function(){return u.cloneDate(b.MAX_TIME)}},minTime:{type:Date,default:function(){return u.cloneDate(b.MIN_TIME)}},disabled:{type:Boolean,default:!1},spinners:{type:Boolean,default:!1},name:String,dir:String,label:String,id:String,validationMessage:{type:String,default:E},required:{type:Boolean,default:!1},validityStyles:{type:Boolean,default:!0},validate:Boolean,valid:{type:Boolean,default:void 0},ariaRole:{type:String,default:"textbox"},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,lastSelectedSymbol:void 0,isFocused:!1}},created(){l.validatePackage(B.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=l.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:n}=this.$props;return{"k-dateinput":!0,"k-input":!0,[`k-input-${l.kendoThemeMaps.sizeMap[a]||a}`]:a,[`k-input-${i}`]:i,[`k-rounded-${l.kendoThemeMaps.roundedMap[n]||n}`]:n,"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",e)},handleBlur(e){this.$data.isFocused=!1,this.$emit("blur",e)},intl(){return y.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&&l.canUseDOM&&document.activeElement!==t&&t.focus({preventScroll:!0})},elementChange(e){const t=this.element();if(!t||!this.kendoDate)return;const{text:a,format:i}=this.kendoDate.getTextAndFormat();this.$data.currentFormat=i;const n=this.computedValue,s=p.approximateStringMatching(a,this.$data.currentFormat,t.value,this.selection().start),c=s.length===1&&s[0][1]==="_";if(!c)for(let d=0;d<s.length;d++)this.kendoDate.parsePart(s[d][0],s[d][1]);s.length&&s[0][0]!=="_"&&this.setSelection(this.selectionBySymbol(s[0][0])),c&&this.switchDateSegment(1),this.triggerChange(e,n)},elementClick(e){this.setSelection(this.selectionByIndex(this.selection().start))},wheel(e){const t=this.element();l.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){switch(e.keyCode){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;default:return}e.preventDefault()}},setSelection(e){const t=this.element();this.$data.lastSelectedSymbol=this.$data.currentFormat[e.start],l.canUseDOM&&window.requestAnimationFrame(()=>{t&&l.canUseDOM&&document.activeElement===t&&t.setSelectionRange(e.start,e.end)})},triggerChange(e,t){this.$data.valueDuringOnChange=this.computedValue,u.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){const{start:t,end:a}=this.selection();if(t<a&&this.$data.currentFormat[t]!==this.$data.currentFormat[a-1]){this.setSelection(this.selectionByIndex(e>0?t:a-1));return}const i=this.$data.currentFormat[t];let n=t+e;for(;n>0&&n<this.$data.currentFormat.length&&!(this.$data.currentFormat[n]!==i&&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!==t||n+1!==a)?this.setSelection({start:s+1,end:n+1}):n<s&&(n!==t||s!==a)&&this.setSelection({start:n,end:s})},modifyDateSegmentValue(e,t){if(!this.kendoDate)return;const a=this.computedValue,i=this.$data.currentFormat[this.selection().start],n=this.kendoDate.symbolMap(i),s=((this.$props.steps||{})[n]||1)*e;this.kendoDate.modifyPart(i,s),this.setSelection(this.selectionBySymbol(i)),this.triggerChange(t,a)},validity(){const e=p.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=l.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=o.ref(null),t=o.inject("kendoIntlService",{}),a=o.inject("kendoLocalizationService",{});return{inputRef:e,kendoIntlService:t,kendoLocalizationService:a}},render(){const e=l.getDefaultSlots(this),t=y.provideLocalizationService(this),{formatPlaceholder:a,format:i,value:n,modelValue:s,name:c,label:d,id:k,ariaLabel:V,ariaExpanded:F,ariaHasPopup:M,ariaRole:I,ariaControls:C,inputAttributes:x}=this.$props,m=n!==void 0?n:s;this.kendoDate.format=i,this.kendoDate.formatPlaceholder=a,this.valueDuringOnChange=this.valueDuringOnChange?this.valueDuringOnChange:void 0,m!==void 0&&this.computedValue!==m&&this.kendoDate.setValue(m);const{text:f,format:w}=this.kendoDate.getTextAndFormat();this.$data.currentFormat=w,this.$data.isEmpty=f===this._emptyText;const g=this.$props.placeholder!==void 0&&this.$data.isEmpty&&!this.$data.isFocused?null:f,$=k||this._inputId,O=!this.$props.validityStyles||this.validity().valid,h=o.createVNode("span",{class:this.wrapperClassNames,dir:this.$props.dir},[o.createVNode("input",o.mergeProps({role:I,tabindex:this.$props.tabIndex,disabled:this.$props.disabled,title:this.$props.title!==void 0?this.$props.title:f,type:"text",spellcheck:!1,autocomplete:"off",autocorrect:"off",class:"k-input-inner",id:$,placeholder:this.$props.placeholder,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onKeydown:this.elementKeyDown,onChange:l.noop,onFocusin:this.handleFocus,onFocusout:this.handleBlur,value:g,name:c,"aria-label":V,"aria-expanded":F,"aria-haspopup":M,"aria-controls":C,"aria-disabled":this.$props.disabled,ref:l.setRef(this,"input")},x),null),e,this.$props.spinners&&o.createVNode("span",{class:"k-input-spinner k-spin-button",onMousedown:this.spinnersMouseDown},[o.createVNode(S.Button,{type:"button",tabIndex:-1,icon:"caret-alt-up",svgIcon:v.caretAltUpIcon,size:this.$props.size,fillMode:this.$props.fillMode,class:"k-spinner-increase","aria-label":t.toLanguageString(r.increaseValue,r.messages[r.increaseValue]),title:t.toLanguageString(r.increaseValue,r.messages[r.increaseValue]),onClick:this.increasePart},null),o.createVNode(S.Button,{type:"button",tabIndex:-1,class:"k-spinner-decrease",icon:"caret-alt-down",svgIcon:v.caretAltDownIcon,size:this.$props.size,fillMode:this.$props.fillMode,"aria-label":t.toLanguageString(r.decreaseValue,r.messages[r.decreaseValue]),title:t.toLanguageString(r.decreaseValue,r.messages[r.decreaseValue]),onClick:this.decreasePart},null)])]);return d?o.createVNode(_.FloatingLabel,{label:d,editorId:$,editorValue:g,editorPlaceholder:this.$props.placeholder,editorValid:O,editorDisabled:this.$props.disabled},q(h)?h:{default:()=>[h]}):h}});exports.DateInput=A;
@@ -5,24 +5,24 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { defineComponent as w, ref as T, inject as S, createVNode as r, isVNode as _ } from "vue";
8
+ import { defineComponent as T, ref as _, inject as S, createVNode as r, mergeProps as O, isVNode as P } from "vue";
9
9
  import { cloneDate as u, isEqual as B } from "@progress/kendo-date-math";
10
- import { provideIntlService as O, provideLocalizationService as P } from "@progress/kendo-vue-intl";
11
- import { KendoDate as E } from "./models/kendo-date.mjs";
12
- import { validatePackage as A, guid as z, kendoThemeMaps as D, canUseDOM as c, getRef as L, getDefaultSlots as j, noop as R, setRef as N } from "@progress/kendo-vue-common";
13
- import { Button as v } from "@progress/kendo-vue-buttons";
14
- import { packageMetadata as K } from "../package-metadata.mjs";
15
- import { defaultFormat as q, defaultFormatPlaceholder as H, approximateStringMatching as U, isInRange as X } from "./utils.mjs";
16
- import { MAX_DATE as Y, MIN_DATE as G } from "../utils.mjs";
10
+ import { provideIntlService as E, provideLocalizationService as A } from "@progress/kendo-vue-intl";
11
+ import { KendoDate as z } from "./models/kendo-date.mjs";
12
+ import { validatePackage as L, guid as j, kendoThemeMaps as D, canUseDOM as c, getRef as R, getDefaultSlots as N, noop as K, setRef as q } from "@progress/kendo-vue-common";
13
+ import { Button as b } from "@progress/kendo-vue-buttons";
14
+ import { packageMetadata as H } from "../package-metadata.mjs";
15
+ import { defaultFormat as U, defaultFormatPlaceholder as X, approximateStringMatching as Y, isInRange as G } from "./utils.mjs";
16
+ import { MAX_DATE as W, MIN_DATE as J } from "../utils.mjs";
17
17
  import { increaseValue as h, messages as m, decreaseValue as p } from "../messages/main.mjs";
18
- import { isInTimeRange as W } from "../timepicker/utils.mjs";
19
- import { MAX_TIME as J, MIN_TIME as Q } from "../defaults.mjs";
20
- import { FloatingLabel as Z } from "@progress/kendo-vue-labels";
21
- import { caretAltUpIcon as ee, caretAltDownIcon as te } from "@progress/kendo-svg-icons";
22
- function ae(e) {
23
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !_(e);
18
+ import { isInTimeRange as Q } from "../timepicker/utils.mjs";
19
+ import { MAX_TIME as Z, MIN_TIME as ee } from "../defaults.mjs";
20
+ import { FloatingLabel as te } from "@progress/kendo-vue-labels";
21
+ import { caretAltUpIcon as ie, caretAltDownIcon as ae } from "@progress/kendo-svg-icons";
22
+ function ne(e) {
23
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !P(e);
24
24
  }
25
- const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
25
+ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
26
26
  name: "DateInput",
27
27
  model: {
28
28
  event: "changemodel"
@@ -49,13 +49,13 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
49
49
  format: {
50
50
  type: [String, Object],
51
51
  default: function() {
52
- return q;
52
+ return U;
53
53
  }
54
54
  },
55
55
  formatPlaceholder: {
56
56
  type: [String, Object],
57
57
  default: function() {
58
- return H;
58
+ return X;
59
59
  }
60
60
  },
61
61
  rounded: {
@@ -86,25 +86,25 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
86
86
  max: {
87
87
  type: Date,
88
88
  default: function() {
89
- return u(Y);
89
+ return u(W);
90
90
  }
91
91
  },
92
92
  min: {
93
93
  type: Date,
94
94
  default: function() {
95
- return u(G);
95
+ return u(J);
96
96
  }
97
97
  },
98
98
  maxTime: {
99
99
  type: Date,
100
100
  default: function() {
101
- return u(J);
101
+ return u(Z);
102
102
  }
103
103
  },
104
104
  minTime: {
105
105
  type: Date,
106
106
  default: function() {
107
- return u(Q);
107
+ return u(ee);
108
108
  }
109
109
  },
110
110
  disabled: {
@@ -121,7 +121,7 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
121
121
  id: String,
122
122
  validationMessage: {
123
123
  type: String,
124
- default: ie
124
+ default: se
125
125
  },
126
126
  required: {
127
127
  type: Boolean,
@@ -149,7 +149,8 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
149
149
  ariaHasPopup: {
150
150
  type: String,
151
151
  default: void 0
152
- }
152
+ },
153
+ inputAttributes: Object
153
154
  },
154
155
  data() {
155
156
  return {
@@ -163,14 +164,14 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
163
164
  };
164
165
  },
165
166
  created() {
166
- A(K);
167
+ L(H);
167
168
  const {
168
169
  formatPlaceholder: e,
169
170
  format: t,
170
- value: a,
171
- defaultValue: i
171
+ value: i,
172
+ defaultValue: a
172
173
  } = this.$props;
173
- this.kendoDate = new E(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 = z();
174
+ this.kendoDate = new z(this.intl, e, t), this.kendoDate.setValue(null), this._emptyText = this.kendoDate.getTextAndFormat().text, this.kendoDate.setValue(i || a || null), this._element = null, this._inputId = j();
174
175
  },
175
176
  computed: {
176
177
  computedValue() {
@@ -178,15 +179,15 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
178
179
  },
179
180
  wrapperClassNames() {
180
181
  const e = !this.$data.hasMounted || !this.$props.validityStyles || this.validity().valid, t = this.$props.disabled, {
181
- size: a,
182
- fillMode: i,
182
+ size: i,
183
+ fillMode: a,
183
184
  rounded: n
184
185
  } = this.$props;
185
186
  return {
186
187
  "k-dateinput": !0,
187
188
  "k-input": !0,
188
- [`k-input-${D.sizeMap[a] || a}`]: a,
189
- [`k-input-${i}`]: i,
189
+ [`k-input-${D.sizeMap[i] || i}`]: i,
190
+ [`k-input-${a}`]: a,
190
191
  [`k-rounded-${D.roundedMap[n] || n}`]: n,
191
192
  "k-disabled": t,
192
193
  "k-invalid": !e && e !== void 0,
@@ -220,7 +221,7 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
220
221
  this.$data.isFocused = !1, this.$emit("blur", e);
221
222
  },
222
223
  intl() {
223
- return O(this);
224
+ return E(this);
224
225
  },
225
226
  setValidity() {
226
227
  const e = this.element();
@@ -237,11 +238,11 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
237
238
  if (!t || !this.kendoDate)
238
239
  return;
239
240
  const {
240
- text: a,
241
- format: i
241
+ text: i,
242
+ format: a
242
243
  } = this.kendoDate.getTextAndFormat();
243
- this.$data.currentFormat = i;
244
- const n = this.computedValue, s = U(a, this.$data.currentFormat, t.value, this.selection().start), o = s.length === 1 && s[0][1] === "_";
244
+ this.$data.currentFormat = a;
245
+ const n = this.computedValue, s = Y(i, this.$data.currentFormat, t.value, this.selection().start), o = s.length === 1 && s[0][1] === "_";
245
246
  if (!o)
246
247
  for (let l = 0; l < s.length; l++)
247
248
  this.kendoDate.parsePart(s[l][0], s[l][1]);
@@ -301,12 +302,12 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
301
302
  })), this.$data.valueDuringOnChange = void 0;
302
303
  },
303
304
  selectionBySymbol(e) {
304
- let t = -1, a = 0;
305
- for (let i = 0; i < this.$data.currentFormat.length; i++)
306
- this.$data.currentFormat[i] === e && (a = i + 1, t === -1 && (t = i));
305
+ let t = -1, i = 0;
306
+ for (let a = 0; a < this.$data.currentFormat.length; a++)
307
+ this.$data.currentFormat[a] === e && (i = a + 1, t === -1 && (t = a));
307
308
  return t < 0 && (t = 0), {
308
309
  start: t,
309
- end: a
310
+ end: i
310
311
  };
311
312
  },
312
313
  selectionByIndex(e) {
@@ -314,13 +315,13 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
314
315
  start: e,
315
316
  end: e
316
317
  };
317
- for (let a = e, i = e - 1; a < this.$data.currentFormat.length || i >= 0; a++, i--) {
318
- if (a < this.$data.currentFormat.length && this.$data.currentFormat[a] !== "_") {
319
- t = this.selectionBySymbol(this.$data.currentFormat[a]);
318
+ for (let i = e, a = e - 1; i < this.$data.currentFormat.length || a >= 0; i++, a--) {
319
+ if (i < this.$data.currentFormat.length && this.$data.currentFormat[i] !== "_") {
320
+ t = this.selectionBySymbol(this.$data.currentFormat[i]);
320
321
  break;
321
322
  }
322
- if (i >= 0 && this.$data.currentFormat[i] !== "_") {
323
- t = this.selectionBySymbol(this.$data.currentFormat[i]);
323
+ if (a >= 0 && this.$data.currentFormat[a] !== "_") {
324
+ t = this.selectionBySymbol(this.$data.currentFormat[a]);
324
325
  break;
325
326
  }
326
327
  }
@@ -329,25 +330,25 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
329
330
  switchDateSegment(e) {
330
331
  const {
331
332
  start: t,
332
- end: a
333
+ end: i
333
334
  } = this.selection();
334
- if (t < a && this.$data.currentFormat[t] !== this.$data.currentFormat[a - 1]) {
335
- this.setSelection(this.selectionByIndex(e > 0 ? t : a - 1));
335
+ if (t < i && this.$data.currentFormat[t] !== this.$data.currentFormat[i - 1]) {
336
+ this.setSelection(this.selectionByIndex(e > 0 ? t : i - 1));
336
337
  return;
337
338
  }
338
- const i = this.$data.currentFormat[t];
339
+ const a = this.$data.currentFormat[t];
339
340
  let n = t + e;
340
- for (; n > 0 && n < this.$data.currentFormat.length && !(this.$data.currentFormat[n] !== i && this.$data.currentFormat[n] !== "_"); )
341
+ for (; n > 0 && n < this.$data.currentFormat.length && !(this.$data.currentFormat[n] !== a && this.$data.currentFormat[n] !== "_"); )
341
342
  n += e;
342
343
  if (this.$data.currentFormat[n] === "_")
343
344
  return;
344
345
  let s = n;
345
346
  for (; s >= 0 && s < this.$data.currentFormat.length && this.$data.currentFormat[s] === this.$data.currentFormat[n]; )
346
347
  s += e;
347
- n > s && (s + 1 !== t || n + 1 !== a) ? this.setSelection({
348
+ n > s && (s + 1 !== t || n + 1 !== i) ? this.setSelection({
348
349
  start: s + 1,
349
350
  end: n + 1
350
- }) : n < s && (n !== t || s !== a) && this.setSelection({
351
+ }) : n < s && (n !== t || s !== i) && this.setSelection({
351
352
  start: n,
352
353
  end: s
353
354
  });
@@ -355,59 +356,60 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
355
356
  modifyDateSegmentValue(e, t) {
356
357
  if (!this.kendoDate)
357
358
  return;
358
- const a = this.computedValue, i = this.$data.currentFormat[this.selection().start], n = this.kendoDate.symbolMap(i), s = ((this.$props.steps || {})[n] || 1) * e;
359
- this.kendoDate.modifyPart(i, s), this.setSelection(this.selectionBySymbol(i)), this.triggerChange(t, a);
359
+ const i = this.computedValue, a = this.$data.currentFormat[this.selection().start], n = this.kendoDate.symbolMap(a), s = ((this.$props.steps || {})[n] || 1) * e;
360
+ this.kendoDate.modifyPart(a, s), this.setSelection(this.selectionBySymbol(a)), this.triggerChange(t, i);
360
361
  },
361
362
  validity() {
362
- const e = X(this.computedValue, this.$props.min, this.$props.max) && W(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;
363
+ const e = G(this.computedValue, this.$props.min, this.$props.max) && Q(this.computedValue, this.$props.minTime, this.$props.maxTime), t = this.$props.validationMessage !== void 0, i = (!this.$props.required || this.computedValue !== null) && e, a = this.$props.valid !== void 0 ? this.$props.valid : i;
363
364
  return {
364
365
  customError: t,
365
366
  rangeOverflow: this.computedValue && this.$props.max.getTime() < this.computedValue.getTime() || !1,
366
367
  rangeUnderflow: this.computedValue && this.computedValue.getTime() < this.$props.min.getTime() || !1,
367
- valid: i,
368
+ valid: a,
368
369
  valueMissing: this.computedValue === null
369
370
  };
370
371
  }
371
372
  },
372
373
  mounted() {
373
- this._element = L(this, "input"), this.setValidity(), this.$data.hasMounted = !0;
374
+ this._element = R(this, "input"), this.setValidity(), this.$data.hasMounted = !0;
374
375
  },
375
376
  updated() {
376
377
  this.$data.lastSelectedSymbol && this.setSelection(this.selectionBySymbol(this.$data.lastSelectedSymbol)), this.setValidity();
377
378
  },
378
379
  setup() {
379
- const e = T(null), t = S("kendoIntlService", {}), a = S("kendoLocalizationService", {});
380
+ const e = _(null), t = S("kendoIntlService", {}), i = S("kendoLocalizationService", {});
380
381
  return {
381
382
  inputRef: e,
382
383
  kendoIntlService: t,
383
- kendoLocalizationService: a
384
+ kendoLocalizationService: i
384
385
  };
385
386
  },
386
387
  render() {
387
- const e = j(this), t = P(this), {
388
- formatPlaceholder: a,
389
- format: i,
388
+ const e = N(this), t = A(this), {
389
+ formatPlaceholder: i,
390
+ format: a,
390
391
  value: n,
391
392
  modelValue: s,
392
393
  name: o,
393
394
  label: l,
394
- id: b,
395
+ id: v,
395
396
  ariaLabel: k,
396
397
  ariaExpanded: V,
397
398
  ariaHasPopup: F,
398
399
  ariaRole: C,
399
- ariaControls: I
400
+ ariaControls: I,
401
+ inputAttributes: M
400
402
  } = this.$props, f = n !== void 0 ? n : s;
401
- this.kendoDate.format = i, this.kendoDate.formatPlaceholder = a, this.valueDuringOnChange = this.valueDuringOnChange ? this.valueDuringOnChange : void 0, f !== void 0 && this.computedValue !== f && this.kendoDate.setValue(f);
403
+ this.kendoDate.format = a, this.kendoDate.formatPlaceholder = i, this.valueDuringOnChange = this.valueDuringOnChange ? this.valueDuringOnChange : void 0, f !== void 0 && this.computedValue !== f && this.kendoDate.setValue(f);
402
404
  const {
403
405
  text: g,
404
- format: M
406
+ format: x
405
407
  } = this.kendoDate.getTextAndFormat();
406
- this.$data.currentFormat = M, this.$data.isEmpty = g === this._emptyText;
407
- const $ = this.$props.placeholder !== void 0 && this.$data.isEmpty && !this.$data.isFocused ? null : g, y = b || this._inputId, x = !this.$props.validityStyles || this.validity().valid, d = r("span", {
408
+ this.$data.currentFormat = x, this.$data.isEmpty = g === this._emptyText;
409
+ const $ = this.$props.placeholder !== void 0 && this.$data.isEmpty && !this.$data.isFocused ? null : g, y = v || this._inputId, w = !this.$props.validityStyles || this.validity().valid, d = r("span", {
408
410
  class: this.wrapperClassNames,
409
411
  dir: this.$props.dir
410
- }, [r("input", {
412
+ }, [r("input", O({
411
413
  role: C,
412
414
  tabindex: this.$props.tabIndex,
413
415
  disabled: this.$props.disabled,
@@ -423,7 +425,7 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
423
425
  onClick: this.elementClick,
424
426
  onInput: this.elementChange,
425
427
  onKeydown: this.elementKeyDown,
426
- onChange: R,
428
+ onChange: K,
427
429
  onFocusin: this.handleFocus,
428
430
  onFocusout: this.handleBlur,
429
431
  value: $,
@@ -433,45 +435,45 @@ const ie = "Please enter a valid value!", Se = /* @__PURE__ */ w({
433
435
  "aria-haspopup": F,
434
436
  "aria-controls": I,
435
437
  "aria-disabled": this.$props.disabled,
436
- ref: N(this, "input")
437
- }, null), e, this.$props.spinners && r("span", {
438
+ ref: q(this, "input")
439
+ }, M), null), e, this.$props.spinners && r("span", {
438
440
  class: "k-input-spinner k-spin-button",
439
441
  onMousedown: this.spinnersMouseDown
440
- }, [r(v, {
442
+ }, [r(b, {
441
443
  type: "button",
442
444
  tabIndex: -1,
443
445
  icon: "caret-alt-up",
444
- svgIcon: ee,
446
+ svgIcon: ie,
445
447
  size: this.$props.size,
446
448
  fillMode: this.$props.fillMode,
447
449
  class: "k-spinner-increase",
448
450
  "aria-label": t.toLanguageString(h, m[h]),
449
451
  title: t.toLanguageString(h, m[h]),
450
452
  onClick: this.increasePart
451
- }, null), r(v, {
453
+ }, null), r(b, {
452
454
  type: "button",
453
455
  tabIndex: -1,
454
456
  class: "k-spinner-decrease",
455
457
  icon: "caret-alt-down",
456
- svgIcon: te,
458
+ svgIcon: ae,
457
459
  size: this.$props.size,
458
460
  fillMode: this.$props.fillMode,
459
461
  "aria-label": t.toLanguageString(p, m[p]),
460
462
  title: t.toLanguageString(p, m[p]),
461
463
  onClick: this.decreasePart
462
464
  }, null)])]);
463
- return l ? r(Z, {
465
+ return l ? r(te, {
464
466
  label: l,
465
467
  editorId: y,
466
468
  editorValue: $,
467
469
  editorPlaceholder: this.$props.placeholder,
468
- editorValid: x,
470
+ editorValid: w,
469
471
  editorDisabled: this.$props.disabled
470
- }, ae(d) ? d : {
472
+ }, ne(d) ? d : {
471
473
  default: () => [d]
472
474
  }) : d;
473
475
  }
474
476
  });
475
477
  export {
476
- Se as DateInput
478
+ be as DateInput
477
479
  };
@@ -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 r=require("@progress/kendo-date-math"),p=require("./mask.js"),M=require("../utils.js");class y{constructor(t,e,s){this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.leadingZero=null,this.typedMonthPart="",this.knownParts="adHhmMsEy",this.symbols={E:"E",H:"H",M:"M",a:"a",d:"d",h:"h",m:"m",s:"s",y:"y"},this._value=r.getDate(new Date),this.intlProvider=t,this.formatPlaceholder=e,this.format=s,this.monthNames=this.allFormatedMonths()}get intl(){return this.intlProvider()}get value(){return this._value}setValue(t){t?r.isEqual(t,this._value)||(this._value=r.cloneDate(t),this.modifyExisting(!0)):(this._value=r.getDate(new Date),this.modifyExisting(!1))}hasValue(){const t=(e,s)=>e||s.type!=="literal"&&s.type!=="dayperiod"&&this.getExisting(s.pattern[0]);return this.intl.splitDateFormat(this.format).reduce(t,!1)}getDateObject(){for(let t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return r.cloneDate(this.value)}getTextAndFormat(){return this.merge(this.intl.formatDate(this.value,this.format),this.dateFormatString(this.value,this.format))}modifyExisting(t){const e=this.dateFormatString(this.value,this.format).symbols;for(let s=0;s<e.length;s++)this.setExisting(e[s],t)}getExisting(t){switch(t){case"y":return this.year;case"M":case"L":return this.month;case"d":return this.date;case"E":return this.date&&this.month&&this.year;case"h":case"H":return this.hours;case"m":return this.minutes;case"s":return this.seconds;default:return!0}}setExisting(t,e){switch(t){case"y":this.year=e,e===!1&&this._value.setFullYear(2e3);break;case"M":this.month=e,e===!1&&this._value.setMonth(0);break;case"d":this.date=e;break;case"h":case"H":this.hours=e;break;case"m":this.minutes=e;break;case"s":this.seconds=e;break;default:return}}modifyPart(t,e){let s=r.cloneDate(this.value);switch(t){case"y":s.setFullYear(s.getFullYear()+e);break;case"M":s=r.addMonths(this.value,e);break;case"d":case"E":s.setDate(s.getDate()+e);break;case"h":case"H":s.setHours(s.getHours()+e);break;case"m":s.setMinutes(s.getMinutes()+e);break;case"s":s.setSeconds(s.getSeconds()+e);break;case"a":s.setHours(s.getHours()+12*e);break}this.setExisting(t,!0),this._value=s}parsePart(t,e){if(this.resetLeadingZero(),!e)return this.setExisting(t,!1),{value:null};const s=this.intl.formatDate(this.value,this.format),n=this.dateFormatString(this.value,this.format),h=n.symbols;let i=!1,l="",o="",m="";for(let u=0;u<s.length;u++)h[u]===t?(o+=this.getExisting(t)?s[u]:"0",i=!0):i?m+=s[u]:l+=s[u];let a=null;const c=this.matchMonth(e);for(;o.length>0&&o.charAt(0)==="0";)o=o.slice(1);o.length>=4&&(o="");for(let u=0;u<2;u++){let g=o+e,f=parseInt(g,10);if(a=this.intl.parseDate(l+g+m,this.format),!a&&!isNaN(f)&&!isNaN(parseInt(e,10))){if(t==="M"&&!c){const d=f-1;d>-1&&d<12&&(a=r.cloneDate(this.value),a.setMonth(d),a.getMonth()!==d&&(a=r.lastDayOfMonth(r.addMonths(a,-1))))}t==="y"&&(a=r.createDate(parseInt(g,10),this.month?this.value.getMonth():0,this.date?this.value.getDate():1,this.hours?this.value.getHours():0,this.minutes?this.value.getMinutes():0,this.seconds?this.value.getSeconds():0,this.milliseconds?this.value.getMilliseconds():0),this.date&&a.getDate()!==this.value.getDate()&&(a=r.lastDayOfMonth(r.addMonths(a,-1))))}if(a)return this._value=a,this.setExisting(t,!0),{value:this.value};o=""}return c&&(a=this.intl.parseDate(l+c+m,this.format),a)?(this._value=a,this.setExisting(t,!0),{value:this.value}):(e==="0"&&(this.leadingZero=this.isAbbrMonth(n.partMap,t)?null:{[t]:!0},this.setExisting(t,!1)),{value:null})}symbolMap(t){return this.intl.splitDateFormat(this.format).reduce(M.dateSymbolMap,{})[t]}resetLeadingZero(){const t=this.leadingZero!==null;return this.leadingZero=null,t}isAbbrMonth(t,e){const s=this.partPattern(t,e);return s.type==="month"&&s.names}partPattern(t,e){return t.filter(s=>s.pattern.indexOf(e)!==-1)[0]}matchMonth(t){if(this.typedMonthPart+=t.toLowerCase(),this.monthNames.length===0)return"";for(;this.typedMonthPart.length>0;){for(let s=0;s<this.monthNames.length;s++)if(this.monthNames[s].toLowerCase().indexOf(this.typedMonthPart)===0)return this.monthNames[s];const e=parseInt(this.typedMonthPart,10);if(e>=1&&e<=12&&e.toString()===this.typedMonthPart)return this.monthNames[e-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""}allFormatedMonths(){const t=this.intl.splitDateFormat(this.format);for(let e=0;e<t.length;e++)if(t[e].type==="month"&&t[e].names)return this.intl.dateFormatNames(t[e].names);return[]}dateFormatString(t,e){const s=this.intl.splitDateFormat(e),n=[],h=[];for(let l=0;l<s.length;l++){let o=this.intl.formatDate(t,{pattern:s[l].pattern}).length;for(;o>0;)n.push(this.symbols[s[l].pattern[0]]||"_"),h.push(s[l]),o--}const i=new p.Mask;return i.symbols=n.join(""),i.partMap=h,i}merge(t,e){let s="",n="",h=e.symbols;for(let i=h.length-1;i>=0;i--)if(this.knownParts.indexOf(h[i])===-1||this.getExisting(h[i]))s=t[i]+s,n=h[i]+n;else{const l=h[i];for(;i>=0&&l===h[i];)i--;for(i++,this.leadingZero&&this.leadingZero[l]?s="0"+s:s=this.dateFieldName(e.partMap[i])+s;n.length<s.length;)n=h[i]+n}return{text:s,format:n}}dateFieldName(t){const e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:e==="formatPattern"?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))}}exports.KendoDate=y;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@progress/kendo-date-math"),p=require("./mask.js"),M=require("../utils.js");class y{constructor(t,e,s){this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.leadingZero=null,this.typedMonthPart="",this.knownParts="adHhmMsEy",this.symbols={E:"E",H:"H",M:"M",a:"a",d:"d",h:"h",m:"m",s:"s",y:"y"},this._value=n.getDate(new Date),this.intlProvider=t,this.formatPlaceholder=e,this.format=s,this.monthNames=this.allFormatedMonths()}get intl(){return this.intlProvider()}get value(){return this._value}setValue(t){t?n.isEqual(t,this._value)||(this._value=n.cloneDate(t),this.modifyExisting(!0)):(this._value=n.getDate(new Date),this.modifyExisting(!1))}hasValue(){const t=(e,s)=>e||s.type!=="literal"&&s.type!=="dayperiod"&&this.getExisting(s.pattern[0]);return this.intl.splitDateFormat(this.format).reduce(t,!1)}getDateObject(){for(let t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return n.cloneDate(this.value)}getTextAndFormat(){return this.merge(this.intl.formatDate(this.value,this.format),this.dateFormatString(this.value,this.format))}modifyExisting(t){const e=this.dateFormatString(this.value,this.format).symbols;for(let s=0;s<e.length;s++)this.setExisting(e[s],t)}getExisting(t){switch(t){case"y":return this.year;case"M":case"L":return this.month;case"d":return this.date;case"E":return this.date&&this.month&&this.year;case"h":case"H":return this.hours;case"m":return this.minutes;case"s":return this.seconds;default:return!0}}setExisting(t,e){switch(t){case"y":this.year=e,e===!1&&this._value.setFullYear(2e3);break;case"M":this.month=e,e===!1&&this._value.setMonth(0);break;case"d":this.date=e;break;case"h":case"H":this.hours=e;break;case"m":this.minutes=e;break;case"s":this.seconds=e;break;default:return}}modifyPart(t,e){let s=n.cloneDate(this.value);switch(t){case"y":s.setFullYear(s.getFullYear()+e);break;case"M":s=n.addMonths(this.value,e);break;case"d":case"E":s.setDate(s.getDate()+e);break;case"h":case"H":s.setHours(s.getHours()+e);break;case"m":s.setMinutes(s.getMinutes()+e);break;case"s":s.setSeconds(s.getSeconds()+e);break;case"a":s.setHours(s.getHours()+12*e);break}this.setExisting(t,!0),this._value=s}parsePart(t,e){if(this.resetLeadingZero(),!e)return this.setExisting(t,!1),{value:null};const s=this.intl.formatDate(this.value,this.format),h=this.dateFormatString(this.value,this.format),l=h.symbols;let o=!1,i="",r="",m="";for(let u=0;u<s.length;u++)l[u]===t?(r+=this.getExisting(t)?s[u]:"0",o=!0):o?m+=s[u]:i+=s[u];let a=null;const c=this.matchMonth(e);for(;r.length>0&&r.charAt(0)==="0";)r=r.slice(1);r.length>=4&&(r="");for(let u=0;u<2;u++){let g=r+e,f=parseInt(g,10);if(a=this.intl.parseDate(i+g+m,this.format),!a&&!isNaN(f)&&!isNaN(parseInt(e,10))){if(t==="M"&&!c){const d=f-1;d>-1&&d<12&&(a=n.cloneDate(this.value),a.setMonth(d),a.getMonth()!==d&&(a=n.lastDayOfMonth(n.addMonths(a,-1))))}t==="y"&&(a=n.createDate(parseInt(g,10),this.month?this.value.getMonth():0,this.date?this.value.getDate():1,this.hours?this.value.getHours():0,this.minutes?this.value.getMinutes():0,this.seconds?this.value.getSeconds():0,this.milliseconds?this.value.getMilliseconds():0),this.date&&a.getDate()!==this.value.getDate()&&(a=n.lastDayOfMonth(n.addMonths(a,-1))))}if(a)return this._value=a,this.setExisting(t,!0),{value:this.value};r=""}return c&&(a=this.intl.parseDate(i+c+m,this.format),a)?(this._value=a,this.setExisting(t,!0),{value:this.value}):(e==="0"&&(this.leadingZero=this.isAbbrMonth(h.partMap,t)?null:{[t]:!0},this.setExisting(t,!1)),{value:null})}symbolMap(t){return this.intl.splitDateFormat(this.format).reduce(M.dateSymbolMap,{})[t]}resetLeadingZero(){const t=this.leadingZero!==null;return this.leadingZero=null,t}isAbbrMonth(t,e){const s=this.partPattern(t,e);return s.type==="month"&&s.names}partPattern(t,e){return t.filter(s=>s.pattern.indexOf(e)!==-1)[0]}matchMonth(t){if(this.typedMonthPart+=t.toLowerCase(),this.monthNames.length===0)return"";for(;this.typedMonthPart.length>0;){for(let s=0;s<this.monthNames.length;s++)if(this.monthNames[s].toLowerCase().indexOf(this.typedMonthPart)===0)return this.monthNames[s];const e=parseInt(this.typedMonthPart,10);if(e>=1&&e<=12&&e.toString()===this.typedMonthPart)return this.monthNames[e-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""}allFormatedMonths(){const t=this.intl.splitDateFormat(this.format);for(let e=0;e<t.length;e++)if(t[e].type==="month"&&t[e].names)return this.intl.dateFormatNames(t[e].names);return[]}dateFormatString(t,e){const s=this.intl.splitDateFormat(e),h=[],l=[];for(let i=0;i<s.length;i++){let r=this.intl.formatDate(t,{pattern:s[i].pattern}).length;for(;r>0;)h.push(this.symbols[s[i].pattern[0]]||"_"),l.push(s[i]),r--}const o=new p.Mask;return o.symbols=h.join(""),o.partMap=l,o}merge(t,e){var o;let s="",h="",l=e.symbols;for(let i=l.length-1;i>=0;){if(this.knownParts.indexOf(l[i])===-1||this.getExisting(l[i]))s=t[i]+s,h=l[i]+h;else{const r=l[i];for(;i>=0&&r===l[i];)i--;for(i++,(o=this.leadingZero)!=null&&o[r]?s="0"+s:s=this.dateFieldName(e.partMap[i])+s;h.length<s.length;)h=l[i]+h}i--}return{text:s,format:h}}dateFieldName(t){const e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:e==="formatPattern"?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))}}exports.KendoDate=y;
@@ -131,18 +131,18 @@ class k {
131
131
  parsePart(t, e) {
132
132
  if (this.resetLeadingZero(), !e)
133
133
  return this.setExisting(t, !1), { value: null };
134
- const s = this.intl.formatDate(this.value, this.format), r = this.dateFormatString(this.value, this.format), n = r.symbols;
135
- let i = !1, h = "", l = "", d = "";
134
+ const s = this.intl.formatDate(this.value, this.format), n = this.dateFormatString(this.value, this.format), h = n.symbols;
135
+ let l = !1, i = "", r = "", d = "";
136
136
  for (let o = 0; o < s.length; o++)
137
- n[o] === t ? (l += this.getExisting(t) ? s[o] : "0", i = !0) : i ? d += s[o] : h += s[o];
137
+ h[o] === t ? (r += this.getExisting(t) ? s[o] : "0", l = !0) : l ? d += s[o] : i += s[o];
138
138
  let a = null;
139
139
  const g = this.matchMonth(e);
140
- for (; l.length > 0 && l.charAt(0) === "0"; )
141
- l = l.slice(1);
142
- l.length >= 4 && (l = "");
140
+ for (; r.length > 0 && r.charAt(0) === "0"; )
141
+ r = r.slice(1);
142
+ r.length >= 4 && (r = "");
143
143
  for (let o = 0; o < 2; o++) {
144
- let c = l + e, p = parseInt(c, 10);
145
- if (a = this.intl.parseDate(h + c + d, this.format), !a && !isNaN(p) && !isNaN(parseInt(e, 10))) {
144
+ let c = r + e, p = parseInt(c, 10);
145
+ if (a = this.intl.parseDate(i + c + d, this.format), !a && !isNaN(p) && !isNaN(parseInt(e, 10))) {
146
146
  if (t === "M" && !g) {
147
147
  const u = p - 1;
148
148
  u > -1 && u < 12 && (a = m(this.value), a.setMonth(u), a.getMonth() !== u && (a = y(f(a, -1))));
@@ -159,9 +159,9 @@ class k {
159
159
  }
160
160
  if (a)
161
161
  return this._value = a, this.setExisting(t, !0), { value: this.value };
162
- l = "";
162
+ r = "";
163
163
  }
164
- return g && (a = this.intl.parseDate(h + g + d, this.format), a) ? (this._value = a, this.setExisting(t, !0), { value: this.value }) : (e === "0" && (this.leadingZero = this.isAbbrMonth(r.partMap, t) ? null : { [t]: !0 }, this.setExisting(t, !1)), { value: null });
164
+ return g && (a = this.intl.parseDate(i + g + d, this.format), a) ? (this._value = a, this.setExisting(t, !0), { value: this.value }) : (e === "0" && (this.leadingZero = this.isAbbrMonth(n.partMap, t) ? null : { [t]: !0 }, this.setExisting(t, !1)), { value: null });
165
165
  }
166
166
  symbolMap(t) {
167
167
  return this.intl.splitDateFormat(this.format).reduce(D, {})[t];
@@ -199,28 +199,31 @@ class k {
199
199
  return [];
200
200
  }
201
201
  dateFormatString(t, e) {
202
- const s = this.intl.splitDateFormat(e), r = [], n = [];
203
- for (let h = 0; h < s.length; h++) {
204
- let l = this.intl.formatDate(t, { pattern: s[h].pattern }).length;
205
- for (; l > 0; )
206
- r.push(this.symbols[s[h].pattern[0]] || "_"), n.push(s[h]), l--;
202
+ const s = this.intl.splitDateFormat(e), n = [], h = [];
203
+ for (let i = 0; i < s.length; i++) {
204
+ let r = this.intl.formatDate(t, { pattern: s[i].pattern }).length;
205
+ for (; r > 0; )
206
+ n.push(this.symbols[s[i].pattern[0]] || "_"), h.push(s[i]), r--;
207
207
  }
208
- const i = new x();
209
- return i.symbols = r.join(""), i.partMap = n, i;
208
+ const l = new x();
209
+ return l.symbols = n.join(""), l.partMap = h, l;
210
210
  }
211
211
  merge(t, e) {
212
- let s = "", r = "", n = e.symbols;
213
- for (let i = n.length - 1; i >= 0; i--)
214
- if (this.knownParts.indexOf(n[i]) === -1 || this.getExisting(n[i]))
215
- s = t[i] + s, r = n[i] + r;
212
+ var l;
213
+ let s = "", n = "", h = e.symbols;
214
+ for (let i = h.length - 1; i >= 0; ) {
215
+ if (this.knownParts.indexOf(h[i]) === -1 || this.getExisting(h[i]))
216
+ s = t[i] + s, n = h[i] + n;
216
217
  else {
217
- const h = n[i];
218
- for (; i >= 0 && h === n[i]; )
218
+ const r = h[i];
219
+ for (; i >= 0 && r === h[i]; )
219
220
  i--;
220
- for (i++, this.leadingZero && this.leadingZero[h] ? s = "0" + s : s = this.dateFieldName(e.partMap[i]) + s; r.length < s.length; )
221
- r = n[i] + r;
221
+ for (i++, (l = this.leadingZero) != null && l[r] ? s = "0" + s : s = this.dateFieldName(e.partMap[i]) + s; n.length < s.length; )
222
+ n = h[i] + n;
222
223
  }
223
- return { text: s, format: r };
224
+ i--;
225
+ }
226
+ return { text: s, format: n };
224
227
  }
225
228
  dateFieldName(t) {
226
229
  const e = this.formatPlaceholder || "wide";
@@ -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 n=require("vue"),v=require("@progress/kendo-svg-icons"),G=require("@progress/kendo-vue-popup"),o=require("@progress/kendo-date-math"),t=require("@progress/kendo-vue-common"),J=require("../package-metadata.js"),Q=require("../dateinput/DateInput.js"),W=require("../calendar/components/Calendar.js"),r=require("../utils.js"),l=require("../messages/main.js"),D=require("@progress/kendo-vue-intl"),Y=require("./ToggleButton.js"),Z=require("@progress/kendo-vue-labels");function I(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const ee=n.defineComponent({name:"DatePicker",inject:{kendoLocalizationService:{default:null}},model:{event:"changemodel"},emits:{change:null,changemodel:null,"update:modelValue":null,iconclick:null,focus:null,blur:null,keydown:null,open:null,close:null},props:{defaultShow:{type:Boolean,default:!1},modelValue:{type:Date,default:void 0},defaultValue:{type:Date,default:void 0},disabled:{type:Boolean,default:!1},dateInput:{type:[String,Object,Function],default:function(){}},calendar:{type:[String,Object,Function],default:function(){}},toggleButton:{type:[String,Object,Function],default:function(){}},label:String,placeholder:String,popup:{type:[String,Object,Function],default:function(){}},rounded:{type:String,default:"medium",validator:function(e){return["small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,default:"medium",validator:function(e){return["small","medium","large"].includes(e)}},focusedDate:Date,format:{type:[Object,String],default:function(){return"d"}},formatPlaceholder:[Object,String],id:String,max:{type:Date,default:function(){return o.cloneDate(r.MAX_DATE)}},min:{type:Date,default:function(){return o.cloneDate(r.MIN_DATE)}},name:String,popupSettings:{type:Object,default:function(){return{}}},show:{type:Boolean,default:void 0},tabIndex:{type:Number,default:0},title:{type:String,default:function(){return""}},value:Date,weekNumber:Boolean,width:[Number,String],validityStyles:{type:Boolean,default:!0},validationMessage:String,required:Boolean,validate:Boolean,valid:{type:Boolean,default:void 0},ariaLabel:String},data:function(){return{isFocused:!1,currentValue:void 0,currentShow:void 0,valueDuringOnChange:void 0,showDuringOnChange:void 0,shouldFocusDateInput:!1}},created(){t.validatePackage(J.packageMetadata),this._popupId=t.guid(),this._anchor=t.guid(),this._dateInput=null,this._calendar=null,this.$data.currentValue=this.$props.defaultValue,this.$data.currentShow=this.$props.defaultShow},mounted(){this._dateInput=t.getRef(this,"dateInput"),(this.$refs.calendar||this.calendarRef)&&(this._calendar=t.getRef(this,"calendar")),this.computedShow&&this.$forceUpdate()},updated(){(this.$refs.calendar||this.calendarRef)&&(this._calendar=t.getRef(this,"calendar")),this.computedShow?this._calendar&&this._calendar.$el&&!this._oldShow&&this._calendar.focus({preventScroll:!0}):this._dateInput&&this._dateInput.$el&&this.$data.shouldFocusDateInput&&this._dateInput.focus({preventScroll:!0}),this.$data.shouldFocusDateInput=!1},watch:{show:function(e,a){this._oldShow=a},currentShow:function(e,a){this._oldShow=a}},computed:{computedValue(){const e=this.$data.valueDuringOnChange!==void 0?this.$data.valueDuringOnChange:this.$props.value!==void 0?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.$data.currentValue;return e!==null?o.cloneDate(e):null},computedShow(){return this.$data.showDuringOnChange!==void 0?this.$data.showDuringOnChange:this.$props.show!==void 0?this.$props.show:this.$data.currentShow}},methods:{focus(){this._dateInput&&this._dateInput.focus()},handleFocus(e){this._oldShow=this.computedShow,this.$data.isFocused=!0,this.$emit("focus",e)},handleBlur(e){this.$data.isFocused=!1,this.createBlurTimeout(),this.$emit("blur",e)},calendarBlur(){this.$emit("blur",event),clearTimeout(this._blurTimeout),this.createBlurTimeout()},calendarFocus(){this.$emit("focus",event),clearTimeout(this._blurTimeout)},createBlurTimeout(){this._blurTimeout=setTimeout(()=>{this._dateInput&&t.canUseDOM&&document.activeElement!==this._dateInput._element&&this.setShow(!1)},200)},validity(){const e=this.computedValue,a=r.isInDateRange(e,this.$props.min,this.$props.max),i=this.$props.validationMessage!==void 0,s=(!this.$props.required||e!==null)&&a,h=this.$props.valid!==void 0?this.$props.valid:s;return{customError:i,rangeOverflow:e&&this.$props.max.getTime()<e.getTime()||!1,rangeUnderflow:e&&e.getTime()<this.$props.min.getTime()||!1,valid:h,valueMissing:e===null}},nextValue(e,a){return e.value!==void 0?e.value:a.value},nextShow(e,a){return e.show!==void 0?e.show:a.show},setShow(e){this.computedShow!==e&&(this.$data.currentShow=e,this.$emit(e?"open":"close",{component:this}))},mergeTime(e){return this.computedValue&&e?r.setTime(e,this.computedValue):e},handleInputValueChange(e){this.handleValueChange(e.value,e)},handleCalendarValueChange(e){const a=this.mergeTime(e.value);this.handleValueChange(a,e)},getDateInputText(){return this.computedValue?!0:this._dateInput?this._dateInput._element.value:""},handleValueChange(e,a){this.$data.currentValue=o.cloneDate(e||void 0),this.$data.valueDuringOnChange=e,this.$data.showDuringOnChange=!1,this.$data.shouldFocusDateInput=!0,this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",{event:a.event,value:this.computedValue,show:this.computedShow,component:this,target:{name:this.$props.name,value:this.computedValue,valueAsDate:this.computedValue},validity:this.validity()}),this.$data.valueDuringOnChange=void 0,this.$data.showDuringOnChange=void 0,this.setShow(!1)},handleIconClick(e){e.stopPropagation(),e.preventDefault(),!this.$props.disabled&&(this.$data.shouldFocusDateInput=!0,this.$emit("iconclick",e),this.setShow(!this.computedShow))},handleIconMouseDown(e){e.stopPropagation(),e.preventDefault()},handleKeyDown(e){const{altKey:a,keyCode:i}=e;if(i===t.Keys.tab&&this._dateInput&&e.target!==this._dateInput._element){e.preventDefault(),this.$data.shouldFocusDateInput=!0,this.setShow(!1);return}if(i===t.Keys.esc){this.$data.shouldFocusDateInput=!0,this.setShow(!1);return}a&&(i===t.Keys.up||i===t.Keys.down)&&(e.preventDefault(),e.stopPropagation(),this.$data.shouldFocusDateInput=i===t.Keys.up,this.setShow(i===t.Keys.down)),this.$emit("keydown",e)}},setup(){const e=n.ref(null),a=n.ref(null),i=n.inject("kendoLocalizationService",{});return{listRef:e,kendoAnchorRef:a,kendoLocalizationService:i}},render(){t.getDefaultSlots(this);const{disabled:e,tabIndex:a,title:i,id:s,format:h,formatPlaceholder:y,min:m,max:$,weekNumber:b,focusedDate:k,width:V,name:_,validationMessage:C,required:T,validityStyles:R,size:c,fillMode:S,rounded:p,ariaLabel:B}=this.$props,{popupClass:F,animate:M,appendTo:O}=this.$props.popupSettings,f=this.computedShow,g=this.computedValue,q=g&&o.getDate(g),w=!this.$props.validityStyles||this.validity().valid,L=t.classNames("k-calendar-container k-group k-reset",F),N=this.$props.toggleButton?t.templateRendering.call(this,this.$props.toggleButton,t.getListeners.call(this)):void 0,x=n.createVNode(Y.ToggleButton,{type:"button",tabIndex:-1,icon:"calendar",svgIcon:v.calendarIcon,onMousedown:this.handleIconMouseDown,onClick:this.handleIconClick,title:D.provideLocalizationService(this).toLanguageString(l.toggleCalendar,l.messages[l.toggleCalendar]),"aria-label":D.provideLocalizationService(this).toLanguageString(l.toggleCalendar,l.messages[l.toggleCalendar]),rounded:null,class:"k-input-button"},null),j=t.getTemplate.call(this,{h:n.h,template:N,defaultRendering:x,defaultSlots:n.createVNode(t.Icon,{name:"calendar",icon:v.calendarIcon},null),additionalListeners:{click:this.handleIconClick}}),P=this.$props.dateInput?t.templateRendering.call(this,this.$props.dateInput,t.getListeners.call(this)):void 0,z=n.createVNode(Q.DateInput,{ref:t.setRef(this,"dateInput"),placeholder:this.$props.placeholder,disabled:e,format:h,formatPlaceholder:y,id:s,max:$,min:m,name:_,size:null,rounded:null,fillMode:null,onChange:this.handleInputValueChange,required:T,tabIndex:f?-1:a,title:i,valid:this.validity().valid,validationMessage:C,validityStyles:R,value:g,ariaHasPopup:"grid",ariaExpanded:f,ariaRole:"combobox",ariaControls:this._popupId,ariaLabel:B},null),K=t.getTemplate.call(this,{h:n.h,template:P,defaultRendering:z}),A=this.$props.calendar?t.templateRendering.call(this,this.$props.calendar,t.getListeners.call(this)):void 0,E=n.createVNode(W.Calendar,{ref:t.setRef(this,"calendar"),onKeydown:this.handleKeyDown,onFocus:this.calendarFocus,onBlur:this.calendarBlur,disabled:e,value:q,min:m,max:$,weekNumber:b,focusedDate:k,onChange:this.handleCalendarValueChange},null),u=t.getTemplate.call(this,{h:n.h,template:A,defaultRendering:E}),U=this.$props.popup?t.templateRendering.call(this,this.$props.popup,t.getListeners.call(this)):void 0,H=n.createVNode(G.Popup,{show:f,anchor:this._anchor,class:L,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},animate:M,appendTo:O},I(u)?u:{default:()=>[u]}),X=t.getTemplate.call(this,{h:n.h,template:U,defaultRendering:H,defaultSlots:u}),d=n.createVNode("span",{ref:t.setRef(this,"kendoAnchor"),role:"group",class:t.classNames("k-input","k-datepicker",{[`k-input-${t.kendoThemeMaps.sizeMap[c]||c}`]:c,[`k-input-${S}`]:S,[`k-rounded-${t.kendoThemeMaps.roundedMap[p]||p}`]:p,"k-invalid":!w,"k-required":this.required,"k-disabled":this.$props.disabled,"k-focus":this.$data.isFocused}),onKeydown:this.handleKeyDown,onFocusin:this.handleFocus,onFocusout:this.handleBlur},[K,j,X]);return this.$props.label?n.createVNode(Z.FloatingLabel,{label:this.$props.label,editorId:s,editorValid:w,editorValue:this.getDateInputText(),editorPlaceholder:this.$props.placeholder,editorDisabled:this.$props.disabled,style:{width:V}},I(d)?d:{default:()=>[d]}):d}});exports.DatePicker=ee;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),v=require("@progress/kendo-svg-icons"),J=require("@progress/kendo-vue-popup"),o=require("@progress/kendo-date-math"),t=require("@progress/kendo-vue-common"),Q=require("../package-metadata.js"),W=require("../dateinput/DateInput.js"),Y=require("../calendar/components/Calendar.js"),r=require("../utils.js"),l=require("../messages/main.js"),D=require("@progress/kendo-vue-intl"),Z=require("./ToggleButton.js"),ee=require("@progress/kendo-vue-labels");function b(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const te=n.defineComponent({name:"DatePicker",inject:{kendoLocalizationService:{default:null}},model:{event:"changemodel"},emits:{change:null,changemodel:null,"update:modelValue":null,iconclick:null,focus:null,blur:null,keydown:null,open:null,close:null},props:{defaultShow:{type:Boolean,default:!1},modelValue:{type:Date,default:void 0},defaultValue:{type:Date,default:void 0},disabled:{type:Boolean,default:!1},dateInput:{type:[String,Object,Function],default:function(){}},calendar:{type:[String,Object,Function],default:function(){}},toggleButton:{type:[String,Object,Function],default:function(){}},label:String,placeholder:String,popup:{type:[String,Object,Function],default:function(){}},rounded:{type:String,default:"medium",validator:function(e){return["small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,default:"medium",validator:function(e){return["small","medium","large"].includes(e)}},focusedDate:Date,format:{type:[Object,String],default:function(){return"d"}},formatPlaceholder:[Object,String],id:String,max:{type:Date,default:function(){return o.cloneDate(r.MAX_DATE)}},min:{type:Date,default:function(){return o.cloneDate(r.MIN_DATE)}},name:String,popupSettings:{type:Object,default:function(){return{}}},show:{type:Boolean,default:void 0},tabIndex:{type:Number,default:0},title:{type:String,default:function(){return""}},value:Date,weekNumber:Boolean,width:[Number,String],validityStyles:{type:Boolean,default:!0},validationMessage:String,required:Boolean,validate:Boolean,valid:{type:Boolean,default:void 0},ariaLabel:String,inputAttributes:Object},data:function(){return{isFocused:!1,currentValue:void 0,currentShow:void 0,valueDuringOnChange:void 0,showDuringOnChange:void 0,shouldFocusDateInput:!1}},created(){t.validatePackage(Q.packageMetadata),this._popupId=t.guid(),this._anchor=t.guid(),this._dateInput=null,this._calendar=null,this.$data.currentValue=this.$props.defaultValue,this.$data.currentShow=this.$props.defaultShow},mounted(){this._dateInput=t.getRef(this,"dateInput"),(this.$refs.calendar||this.calendarRef)&&(this._calendar=t.getRef(this,"calendar")),this.computedShow&&this.$forceUpdate()},updated(){(this.$refs.calendar||this.calendarRef)&&(this._calendar=t.getRef(this,"calendar")),this.computedShow?this._calendar&&this._calendar.$el&&!this._oldShow&&this._calendar.focus({preventScroll:!0}):this._dateInput&&this._dateInput.$el&&this.$data.shouldFocusDateInput&&this._dateInput.focus({preventScroll:!0}),this.$data.shouldFocusDateInput=!1},watch:{show:function(e,a){this._oldShow=a},currentShow:function(e,a){this._oldShow=a}},computed:{computedValue(){const e=this.$data.valueDuringOnChange!==void 0?this.$data.valueDuringOnChange:this.$props.value!==void 0?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.$data.currentValue;return e!==null?o.cloneDate(e):null},computedShow(){return this.$data.showDuringOnChange!==void 0?this.$data.showDuringOnChange:this.$props.show!==void 0?this.$props.show:this.$data.currentShow}},methods:{focus(){this._dateInput&&this._dateInput.focus()},handleFocus(e){this._oldShow=this.computedShow,this.$data.isFocused=!0,this.$emit("focus",e)},handleBlur(e){this.$data.isFocused=!1,this.createBlurTimeout(),this.$emit("blur",e)},calendarBlur(){this.$emit("blur",event),clearTimeout(this._blurTimeout),this.createBlurTimeout()},calendarFocus(){this.$emit("focus",event),clearTimeout(this._blurTimeout)},createBlurTimeout(){this._blurTimeout=setTimeout(()=>{this._dateInput&&t.canUseDOM&&document.activeElement!==this._dateInput._element&&this.setShow(!1)},200)},validity(){const e=this.computedValue,a=r.isInDateRange(e,this.$props.min,this.$props.max),i=this.$props.validationMessage!==void 0,s=(!this.$props.required||e!==null)&&a,h=this.$props.valid!==void 0?this.$props.valid:s;return{customError:i,rangeOverflow:e&&this.$props.max.getTime()<e.getTime()||!1,rangeUnderflow:e&&e.getTime()<this.$props.min.getTime()||!1,valid:h,valueMissing:e===null}},nextValue(e,a){return e.value!==void 0?e.value:a.value},nextShow(e,a){return e.show!==void 0?e.show:a.show},setShow(e){this.computedShow!==e&&(this.$data.currentShow=e,this.$emit(e?"open":"close",{component:this}))},mergeTime(e){return this.computedValue&&e?r.setTime(e,this.computedValue):e},handleInputValueChange(e){this.handleValueChange(e.value,e)},handleCalendarValueChange(e){const a=this.mergeTime(e.value);this.handleValueChange(a,e)},getDateInputText(){return this.computedValue?!0:this._dateInput?this._dateInput._element.value:""},handleValueChange(e,a){this.$data.currentValue=o.cloneDate(e||void 0),this.$data.valueDuringOnChange=e,this.$data.showDuringOnChange=!1,this.$data.shouldFocusDateInput=!0,this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",{event:a.event,value:this.computedValue,show:this.computedShow,component:this,target:{name:this.$props.name,value:this.computedValue,valueAsDate:this.computedValue},validity:this.validity()}),this.$data.valueDuringOnChange=void 0,this.$data.showDuringOnChange=void 0,this.setShow(!1)},handleIconClick(e){e.stopPropagation(),e.preventDefault(),!this.$props.disabled&&(this.$data.shouldFocusDateInput=!0,this.$emit("iconclick",e),this.setShow(!this.computedShow))},handleIconMouseDown(e){e.stopPropagation(),e.preventDefault()},handleKeyDown(e){const{altKey:a,keyCode:i}=e;if(i===t.Keys.tab&&this._dateInput&&e.target!==this._dateInput._element){e.preventDefault(),this.$data.shouldFocusDateInput=!0,this.setShow(!1);return}if(i===t.Keys.esc){this.$data.shouldFocusDateInput=!0,this.setShow(!1);return}a&&(i===t.Keys.up||i===t.Keys.down)&&(e.preventDefault(),e.stopPropagation(),this.$data.shouldFocusDateInput=i===t.Keys.up,this.setShow(i===t.Keys.down)),this.$emit("keydown",e)}},setup(){const e=n.ref(null),a=n.ref(null),i=n.inject("kendoLocalizationService",{});return{listRef:e,kendoAnchorRef:a,kendoLocalizationService:i}},render(){t.getDefaultSlots(this);const{disabled:e,tabIndex:a,title:i,id:s,format:h,formatPlaceholder:I,min:m,max:$,weekNumber:y,focusedDate:k,width:V,name:_,validationMessage:C,required:T,validityStyles:R,size:c,fillMode:S,rounded:p,ariaLabel:B,inputAttributes:F}=this.$props,{popupClass:O,animate:M,appendTo:q}=this.$props.popupSettings,f=this.computedShow,g=this.computedValue,L=g&&o.getDate(g),w=!this.$props.validityStyles||this.validity().valid,N=t.classNames("k-calendar-container k-group k-reset",O),j=this.$props.toggleButton?t.templateRendering.call(this,this.$props.toggleButton,t.getListeners.call(this)):void 0,x=n.createVNode(Z.ToggleButton,{type:"button",tabIndex:-1,icon:"calendar",svgIcon:v.calendarIcon,onMousedown:this.handleIconMouseDown,onClick:this.handleIconClick,title:D.provideLocalizationService(this).toLanguageString(l.toggleCalendar,l.messages[l.toggleCalendar]),"aria-label":D.provideLocalizationService(this).toLanguageString(l.toggleCalendar,l.messages[l.toggleCalendar]),rounded:null,class:"k-input-button"},null),P=t.getTemplate.call(this,{h:n.h,template:j,defaultRendering:x,defaultSlots:n.createVNode(t.Icon,{name:"calendar",icon:v.calendarIcon},null),additionalListeners:{click:this.handleIconClick}}),z=this.$props.dateInput?t.templateRendering.call(this,this.$props.dateInput,t.getListeners.call(this)):void 0,K=n.createVNode(W.DateInput,{ref:t.setRef(this,"dateInput"),placeholder:this.$props.placeholder,disabled:e,format:h,formatPlaceholder:I,id:s,max:$,min:m,name:_,size:null,rounded:null,fillMode:null,onChange:this.handleInputValueChange,required:T,tabIndex:f?-1:a,title:i,valid:this.validity().valid,validationMessage:C,validityStyles:R,value:g,ariaHasPopup:"grid",ariaExpanded:f,ariaRole:"combobox",ariaControls:this._popupId,ariaLabel:B,inputAttributes:F},null),A=t.getTemplate.call(this,{h:n.h,template:z,defaultRendering:K}),E=this.$props.calendar?t.templateRendering.call(this,this.$props.calendar,t.getListeners.call(this)):void 0,U=n.createVNode(Y.Calendar,{ref:t.setRef(this,"calendar"),onKeydown:this.handleKeyDown,onFocus:this.calendarFocus,onBlur:this.calendarBlur,disabled:e,value:L,min:m,max:$,weekNumber:y,focusedDate:k,onChange:this.handleCalendarValueChange},null),u=t.getTemplate.call(this,{h:n.h,template:E,defaultRendering:U}),H=this.$props.popup?t.templateRendering.call(this,this.$props.popup,t.getListeners.call(this)):void 0,X=n.createVNode(J.Popup,{show:f,anchor:this._anchor,class:N,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},animate:M,appendTo:q},b(u)?u:{default:()=>[u]}),G=t.getTemplate.call(this,{h:n.h,template:H,defaultRendering:X,defaultSlots:u}),d=n.createVNode("span",{ref:t.setRef(this,"kendoAnchor"),role:"group",class:t.classNames("k-input","k-datepicker",{[`k-input-${t.kendoThemeMaps.sizeMap[c]||c}`]:c,[`k-input-${S}`]:S,[`k-rounded-${t.kendoThemeMaps.roundedMap[p]||p}`]:p,"k-invalid":!w,"k-required":this.required,"k-disabled":this.$props.disabled,"k-focus":this.$data.isFocused}),onKeydown:this.handleKeyDown,onFocusin:this.handleFocus,onFocusout:this.handleBlur},[A,P,G]);return this.$props.label?n.createVNode(ee.FloatingLabel,{label:this.$props.label,editorId:s,editorValid:w,editorValue:this.getDateInputText(),editorPlaceholder:this.$props.placeholder,editorDisabled:this.$props.disabled,style:{width:V}},b(d)?d:{default:()=>[d]}):d}});exports.DatePicker=te;