@progress/kendo-vue-dateinputs 7.0.1-develop.2 → 7.0.1-develop.3
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/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +4 -4
- package/calendar/components/CalendarHeaderTitle.js +1 -1
- package/calendar/components/CalendarHeaderTitle.mjs +5 -5
- package/calendar/components/CalendarWeekCell.js +1 -1
- package/calendar/components/CalendarWeekCell.mjs +5 -5
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +71 -67
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +35 -27
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +31 -27
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +51 -45
- package/dist/cdn/js/kendo-vue-dateinputs.js +1 -1
- package/index.d.mts +230 -128
- package/index.d.ts +230 -128
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimeList.js +1 -1
- package/timepicker/TimeList.mjs +10 -10
- package/timepicker/TimePart.js +1 -1
- package/timepicker/TimePart.mjs +13 -13
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +51 -45
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +14 -12
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +2 -2
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),v=require("@progress/kendo-vue-common"),k=a.defineComponent({name:"KendoCalendarCell",emits:{click:e=>!0,mousedown:e=>!0,mouseenter:e=>!0,mouseleave:e=>!0},props:{isDisabled:Boolean,view:Number,formattedValue:String,id:String,isWeekend:Boolean,isFocused:Boolean,isSelected:Boolean,isInRange:Boolean,isRangeStart:Boolean,isRangeEnd:Boolean,isRangeMid:Boolean,isRangeSplitEnd:Boolean,isRangeSplitStart:Boolean,isToday:Boolean,title:String,value:Date},updated(){},render(){const e=v.getDefaultSlots(this),{formattedValue:t,isWeekend:o,isFocused:i,isInRange:m,isSelected:l,isRangeStart:n,isRangeMid:d,isRangeEnd:s,isRangeSplitStart:r,isRangeSplitEnd:u,isToday:c,isDisabled:p,view:S,value:R}=this.$props,h=this.$props.activeRangeEnd==="end"&&s,g=this.$props.activeRangeEnd==="start"&&n;return a.createVNode("td",{id:this.$props.id,title:this.$props.title,class:{"k-calendar-td":!0,"k-range-end":s,"k-range-mid":d,"k-range-split-end":u,"k-range-split-start":r,"k-range-start":n,"k-active":g||h,"k-focus":i,"k-selected":l||n||s,"k-today":c,"k-weekend":o,"k-disabled":p},onClick:this.handleClick,onMousedown:this.handleMouseDown,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave},[a.createVNode("span",{class:"k-link"},[e])])},methods:{handleClick(e){const{value:t}=this.$props;this.$emit("click",t,e)},handleMouseDown(e){const{value:t}=this.$props;this.$emit("mousedown",t,e)},handleMouseEnter(){const{value:e}=this.$props;this.$emit("mouseenter",e)},handleMouseLeave(){const{value:e}=this.$props;this.$emit("mouseleave",e)}}});exports.CalendarCell=k;
|
|
@@ -10,10 +10,10 @@ import { getDefaultSlots as m } from "@progress/kendo-vue-common";
|
|
|
10
10
|
const M = /* @__PURE__ */ k({
|
|
11
11
|
name: "KendoCalendarCell",
|
|
12
12
|
emits: {
|
|
13
|
-
click:
|
|
14
|
-
mousedown:
|
|
15
|
-
mouseenter:
|
|
16
|
-
mouseleave:
|
|
13
|
+
click: (e) => !0,
|
|
14
|
+
mousedown: (e) => !0,
|
|
15
|
+
mouseenter: (e) => !0,
|
|
16
|
+
mouseleave: (e) => !0
|
|
17
17
|
},
|
|
18
18
|
props: {
|
|
19
19
|
isDisabled: Boolean,
|
|
@@ -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 t=require("vue"),o=require("@progress/kendo-vue-common"),n=require("@progress/kendo-vue-buttons");function i(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const r=t.defineComponent({name:"KendoHeaderTitle",emits:{click:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),o=require("@progress/kendo-vue-common"),n=require("@progress/kendo-vue-buttons");function i(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const r=t.defineComponent({name:"KendoHeaderTitle",emits:{click:e=>!0},props:{id:String,value:String,view:Number},methods:{handleClick(e){this.$emit("click",e)}},render(){const e=o.getDefaultSlots(this);return t.createVNode(n.Button,{role:"link",type:"button",id:this.$props.id,fillMode:"flat",themeColor:"primary",onClick:this.handleClick,tabIndex:0},i(e)?e:{default:()=>[e]})}});exports.CalendarHeaderTitle=r;
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { defineComponent as e, createVNode as o, isVNode as i } from "vue";
|
|
9
9
|
import { getDefaultSlots as r } from "@progress/kendo-vue-common";
|
|
10
|
-
import { Button as
|
|
11
|
-
function
|
|
10
|
+
import { Button as n } from "@progress/kendo-vue-buttons";
|
|
11
|
+
function l(t) {
|
|
12
12
|
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !i(t);
|
|
13
13
|
}
|
|
14
14
|
const m = /* @__PURE__ */ e({
|
|
15
15
|
name: "KendoHeaderTitle",
|
|
16
16
|
emits: {
|
|
17
|
-
click:
|
|
17
|
+
click: (t) => !0
|
|
18
18
|
},
|
|
19
19
|
props: {
|
|
20
20
|
id: String,
|
|
@@ -32,7 +32,7 @@ const m = /* @__PURE__ */ e({
|
|
|
32
32
|
*/
|
|
33
33
|
render() {
|
|
34
34
|
const t = r(this);
|
|
35
|
-
return o(
|
|
35
|
+
return o(n, {
|
|
36
36
|
role: "link",
|
|
37
37
|
type: "button",
|
|
38
38
|
id: this.$props.id,
|
|
@@ -40,7 +40,7 @@ const m = /* @__PURE__ */ e({
|
|
|
40
40
|
themeColor: "primary",
|
|
41
41
|
onClick: this.handleClick,
|
|
42
42
|
tabIndex: 0
|
|
43
|
-
},
|
|
43
|
+
}, l(t) ? t : {
|
|
44
44
|
default: () => [t]
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -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 t=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),l=require("@progress/kendo-vue-common"),n=t.defineComponent({props:{id:String,value:Number,className:String},emits:{click:e=>!0},render(){const e=l.getDefaultSlots(this);return t.createVNode("td",{onClick:this.handleClick,id:this.$props.id},[this.$props.value!==void 0?this.$props.value:e])},methods:{handleClick(e){const{value:i}=this.$props;this.$emit("click",i,e)}}});exports.CalendarWeekCell=n;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as i, createVNode as
|
|
9
|
-
import { getDefaultSlots as
|
|
8
|
+
import { defineComponent as i, createVNode as o } from "vue";
|
|
9
|
+
import { getDefaultSlots as r } from "@progress/kendo-vue-common";
|
|
10
10
|
const n = /* @__PURE__ */ i({
|
|
11
11
|
props: {
|
|
12
12
|
id: String,
|
|
@@ -14,15 +14,15 @@ const n = /* @__PURE__ */ i({
|
|
|
14
14
|
className: String
|
|
15
15
|
},
|
|
16
16
|
emits: {
|
|
17
|
-
click:
|
|
17
|
+
click: (e) => !0
|
|
18
18
|
},
|
|
19
19
|
/**
|
|
20
20
|
* @return
|
|
21
21
|
* Returns a `<td />` element with the [`value`]({% slug api_dateinputs_calendarweekcellprops %}#toc-value) as a child.
|
|
22
22
|
*/
|
|
23
23
|
render() {
|
|
24
|
-
const e =
|
|
25
|
-
return
|
|
24
|
+
const e = r(this);
|
|
25
|
+
return o("td", {
|
|
26
26
|
onClick: this.handleClick,
|
|
27
27
|
id: this.$props.id
|
|
28
28
|
}, [this.$props.value !== void 0 ? this.$props.value : e]);
|
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 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;
|
|
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"),r=require("@progress/kendo-vue-common"),S=require("@progress/kendo-vue-buttons"),B=require("../package-metadata.js"),p=require("./utils.js"),D=require("../utils.js"),l=require("../messages/main.js"),P=require("../timepicker/utils.js"),v=require("../defaults.js"),_=require("@progress/kendo-vue-labels"),b=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: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 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: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(){r.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=r.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-${r.kendoThemeMaps.sizeMap[a]||a}`]:a,[`k-input-${i}`]:i,[`k-rounded-${r.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",{event:e})},handleBlur(e){this.$data.isFocused=!1,this.$emit("blur",{event: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&&r.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();r.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],r.canUseDOM&&window.requestAnimationFrame(()=>{t&&r.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=r.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=r.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:r.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:r.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:b.caretAltUpIcon,size:this.$props.size,fillMode:this.$props.fillMode,class:"k-spinner-increase","aria-label":t.toLanguageString(l.increaseValue,l.messages[l.increaseValue]),title:t.toLanguageString(l.increaseValue,l.messages[l.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(l.decreaseValue,l.messages[l.decreaseValue]),title:t.toLanguageString(l.decreaseValue,l.messages[l.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;
|
package/dateinput/DateInput.mjs
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as T, createVNode as
|
|
8
|
+
import { defineComponent as T, createVNode as o, mergeProps as _, ref as O, inject as S, isVNode as P } from "vue";
|
|
9
9
|
import { isEqual as B, cloneDate as u } from "@progress/kendo-date-math";
|
|
10
10
|
import { provideLocalizationService as E, provideIntlService as A } from "@progress/kendo-vue-intl";
|
|
11
11
|
import { KendoDate as z } from "./models/kendo-date.mjs";
|
|
12
|
-
import { getDefaultSlots as L, setRef as j, noop as R, getRef as N, canUseDOM as c, kendoThemeMaps as
|
|
13
|
-
import { Button as
|
|
12
|
+
import { getDefaultSlots as L, setRef as j, noop as R, getRef as N, canUseDOM as c, kendoThemeMaps as v, validatePackage as K, guid as q } from "@progress/kendo-vue-common";
|
|
13
|
+
import { Button as D } from "@progress/kendo-vue-buttons";
|
|
14
14
|
import { packageMetadata as H } from "../package-metadata.mjs";
|
|
15
15
|
import { isInRange as U, approximateStringMatching as X, defaultFormatPlaceholder as Y, defaultFormat as G } from "./utils.mjs";
|
|
16
16
|
import { MIN_DATE as W, MAX_DATE as J } from "../utils.mjs";
|
|
@@ -18,11 +18,11 @@ import { increaseValue as h, messages as m, decreaseValue as p } from "../messag
|
|
|
18
18
|
import { isInTimeRange as Q } from "../timepicker/utils.mjs";
|
|
19
19
|
import { MIN_TIME as Z, MAX_TIME as ee } from "../defaults.mjs";
|
|
20
20
|
import { FloatingLabel as te } from "@progress/kendo-vue-labels";
|
|
21
|
-
import { caretAltUpIcon as
|
|
21
|
+
import { caretAltUpIcon as ae, caretAltDownIcon as ie } from "@progress/kendo-svg-icons";
|
|
22
22
|
function ne(e) {
|
|
23
23
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !P(e);
|
|
24
24
|
}
|
|
25
|
-
const se = "Please enter a valid value!",
|
|
25
|
+
const se = "Please enter a valid value!", De = /* @__PURE__ */ T({
|
|
26
26
|
name: "DateInput",
|
|
27
27
|
model: {
|
|
28
28
|
event: "changemodel"
|
|
@@ -36,11 +36,11 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
emits: {
|
|
39
|
-
change:
|
|
40
|
-
changemodel:
|
|
41
|
-
"update:modelValue":
|
|
42
|
-
focus:
|
|
43
|
-
blur:
|
|
39
|
+
change: (e) => !0,
|
|
40
|
+
changemodel: (e) => !0,
|
|
41
|
+
"update:modelValue": (e) => !0,
|
|
42
|
+
focus: (e) => !0,
|
|
43
|
+
blur: (e) => !0
|
|
44
44
|
},
|
|
45
45
|
props: {
|
|
46
46
|
modelValue: Date,
|
|
@@ -168,10 +168,10 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
168
168
|
const {
|
|
169
169
|
formatPlaceholder: e,
|
|
170
170
|
format: t,
|
|
171
|
-
value:
|
|
172
|
-
defaultValue:
|
|
171
|
+
value: a,
|
|
172
|
+
defaultValue: i
|
|
173
173
|
} = this.$props;
|
|
174
|
-
this.kendoDate = new z(this.intl, e, t), this.kendoDate.setValue(null), this._emptyText = this.kendoDate.getTextAndFormat().text, this.kendoDate.setValue(
|
|
174
|
+
this.kendoDate = new z(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 = q();
|
|
175
175
|
},
|
|
176
176
|
computed: {
|
|
177
177
|
computedValue() {
|
|
@@ -179,16 +179,16 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
179
179
|
},
|
|
180
180
|
wrapperClassNames() {
|
|
181
181
|
const e = !this.$data.hasMounted || !this.$props.validityStyles || this.validity().valid, t = this.$props.disabled, {
|
|
182
|
-
size:
|
|
183
|
-
fillMode:
|
|
182
|
+
size: a,
|
|
183
|
+
fillMode: i,
|
|
184
184
|
rounded: n
|
|
185
185
|
} = this.$props;
|
|
186
186
|
return {
|
|
187
187
|
"k-dateinput": !0,
|
|
188
188
|
"k-input": !0,
|
|
189
|
-
[`k-input-${
|
|
190
|
-
[`k-input-${
|
|
191
|
-
[`k-rounded-${
|
|
189
|
+
[`k-input-${v.sizeMap[a] || a}`]: a,
|
|
190
|
+
[`k-input-${i}`]: i,
|
|
191
|
+
[`k-rounded-${v.roundedMap[n] || n}`]: n,
|
|
192
192
|
"k-disabled": t,
|
|
193
193
|
"k-invalid": !e && e !== void 0,
|
|
194
194
|
"k-focus": this.isFocused,
|
|
@@ -215,10 +215,14 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
215
215
|
this._element && this._element.focus(e);
|
|
216
216
|
},
|
|
217
217
|
handleFocus(e) {
|
|
218
|
-
this.$data.isFocused = !0, this.$emit("focus",
|
|
218
|
+
this.$data.isFocused = !0, this.$emit("focus", {
|
|
219
|
+
event: e
|
|
220
|
+
});
|
|
219
221
|
},
|
|
220
222
|
handleBlur(e) {
|
|
221
|
-
this.$data.isFocused = !1, this.$emit("blur",
|
|
223
|
+
this.$data.isFocused = !1, this.$emit("blur", {
|
|
224
|
+
event: e
|
|
225
|
+
});
|
|
222
226
|
},
|
|
223
227
|
intl() {
|
|
224
228
|
return A(this);
|
|
@@ -238,15 +242,15 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
238
242
|
if (!t || !this.kendoDate)
|
|
239
243
|
return;
|
|
240
244
|
const {
|
|
241
|
-
text:
|
|
242
|
-
format:
|
|
245
|
+
text: a,
|
|
246
|
+
format: i
|
|
243
247
|
} = this.kendoDate.getTextAndFormat();
|
|
244
|
-
this.$data.currentFormat =
|
|
245
|
-
const n = this.computedValue, s = X(
|
|
246
|
-
if (!
|
|
247
|
-
for (let
|
|
248
|
-
this.kendoDate.parsePart(s[
|
|
249
|
-
s.length && s[0][0] !== "_" && this.setSelection(this.selectionBySymbol(s[0][0])),
|
|
248
|
+
this.$data.currentFormat = i;
|
|
249
|
+
const n = this.computedValue, s = X(a, this.$data.currentFormat, t.value, this.selection().start), l = s.length === 1 && s[0][1] === "_";
|
|
250
|
+
if (!l)
|
|
251
|
+
for (let r = 0; r < s.length; r++)
|
|
252
|
+
this.kendoDate.parsePart(s[r][0], s[r][1]);
|
|
253
|
+
s.length && s[0][0] !== "_" && this.setSelection(this.selectionBySymbol(s[0][0])), l && this.switchDateSegment(1), this.triggerChange(e, n);
|
|
250
254
|
},
|
|
251
255
|
elementClick(e) {
|
|
252
256
|
this.setSelection(this.selectionByIndex(this.selection().start));
|
|
@@ -302,12 +306,12 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
302
306
|
})), this.$data.valueDuringOnChange = void 0;
|
|
303
307
|
},
|
|
304
308
|
selectionBySymbol(e) {
|
|
305
|
-
let t = -1,
|
|
306
|
-
for (let
|
|
307
|
-
this.$data.currentFormat[
|
|
309
|
+
let t = -1, a = 0;
|
|
310
|
+
for (let i = 0; i < this.$data.currentFormat.length; i++)
|
|
311
|
+
this.$data.currentFormat[i] === e && (a = i + 1, t === -1 && (t = i));
|
|
308
312
|
return t < 0 && (t = 0), {
|
|
309
313
|
start: t,
|
|
310
|
-
end:
|
|
314
|
+
end: a
|
|
311
315
|
};
|
|
312
316
|
},
|
|
313
317
|
selectionByIndex(e) {
|
|
@@ -315,13 +319,13 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
315
319
|
start: e,
|
|
316
320
|
end: e
|
|
317
321
|
};
|
|
318
|
-
for (let
|
|
319
|
-
if (
|
|
320
|
-
t = this.selectionBySymbol(this.$data.currentFormat[
|
|
322
|
+
for (let a = e, i = e - 1; a < this.$data.currentFormat.length || i >= 0; a++, i--) {
|
|
323
|
+
if (a < this.$data.currentFormat.length && this.$data.currentFormat[a] !== "_") {
|
|
324
|
+
t = this.selectionBySymbol(this.$data.currentFormat[a]);
|
|
321
325
|
break;
|
|
322
326
|
}
|
|
323
|
-
if (
|
|
324
|
-
t = this.selectionBySymbol(this.$data.currentFormat[
|
|
327
|
+
if (i >= 0 && this.$data.currentFormat[i] !== "_") {
|
|
328
|
+
t = this.selectionBySymbol(this.$data.currentFormat[i]);
|
|
325
329
|
break;
|
|
326
330
|
}
|
|
327
331
|
}
|
|
@@ -330,25 +334,25 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
330
334
|
switchDateSegment(e) {
|
|
331
335
|
const {
|
|
332
336
|
start: t,
|
|
333
|
-
end:
|
|
337
|
+
end: a
|
|
334
338
|
} = this.selection();
|
|
335
|
-
if (t <
|
|
336
|
-
this.setSelection(this.selectionByIndex(e > 0 ? t :
|
|
339
|
+
if (t < a && this.$data.currentFormat[t] !== this.$data.currentFormat[a - 1]) {
|
|
340
|
+
this.setSelection(this.selectionByIndex(e > 0 ? t : a - 1));
|
|
337
341
|
return;
|
|
338
342
|
}
|
|
339
|
-
const
|
|
343
|
+
const i = this.$data.currentFormat[t];
|
|
340
344
|
let n = t + e;
|
|
341
|
-
for (; n > 0 && n < this.$data.currentFormat.length && !(this.$data.currentFormat[n] !==
|
|
345
|
+
for (; n > 0 && n < this.$data.currentFormat.length && !(this.$data.currentFormat[n] !== i && this.$data.currentFormat[n] !== "_"); )
|
|
342
346
|
n += e;
|
|
343
347
|
if (this.$data.currentFormat[n] === "_")
|
|
344
348
|
return;
|
|
345
349
|
let s = n;
|
|
346
350
|
for (; s >= 0 && s < this.$data.currentFormat.length && this.$data.currentFormat[s] === this.$data.currentFormat[n]; )
|
|
347
351
|
s += e;
|
|
348
|
-
n > s && (s + 1 !== t || n + 1 !==
|
|
352
|
+
n > s && (s + 1 !== t || n + 1 !== a) ? this.setSelection({
|
|
349
353
|
start: s + 1,
|
|
350
354
|
end: n + 1
|
|
351
|
-
}) : n < s && (n !== t || s !==
|
|
355
|
+
}) : n < s && (n !== t || s !== a) && this.setSelection({
|
|
352
356
|
start: n,
|
|
353
357
|
end: s
|
|
354
358
|
});
|
|
@@ -356,16 +360,16 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
356
360
|
modifyDateSegmentValue(e, t) {
|
|
357
361
|
if (!this.kendoDate)
|
|
358
362
|
return;
|
|
359
|
-
const
|
|
360
|
-
this.kendoDate.modifyPart(
|
|
363
|
+
const a = this.computedValue, i = this.$data.currentFormat[this.selection().start], n = this.kendoDate.symbolMap(i), s = ((this.$props.steps || {})[n] || 1) * e;
|
|
364
|
+
this.kendoDate.modifyPart(i, s), this.setSelection(this.selectionBySymbol(i)), this.triggerChange(t, a);
|
|
361
365
|
},
|
|
362
366
|
validity() {
|
|
363
|
-
const e = U(this.computedValue, this.$props.min, this.$props.max) && Q(this.computedValue, this.$props.minTime, this.$props.maxTime), t = this.$props.validationMessage !== void 0,
|
|
367
|
+
const e = U(this.computedValue, this.$props.min, this.$props.max) && Q(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;
|
|
364
368
|
return {
|
|
365
369
|
customError: t,
|
|
366
370
|
rangeOverflow: this.computedValue && this.$props.max.getTime() < this.computedValue.getTime() || !1,
|
|
367
371
|
rangeUnderflow: this.computedValue && this.computedValue.getTime() < this.$props.min.getTime() || !1,
|
|
368
|
-
valid:
|
|
372
|
+
valid: i,
|
|
369
373
|
valueMissing: this.computedValue === null
|
|
370
374
|
};
|
|
371
375
|
}
|
|
@@ -377,22 +381,22 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
377
381
|
this.$data.lastSelectedSymbol && this.setSelection(this.selectionBySymbol(this.$data.lastSelectedSymbol)), this.setValidity();
|
|
378
382
|
},
|
|
379
383
|
setup() {
|
|
380
|
-
const e = O(null), t = S("kendoIntlService", {}),
|
|
384
|
+
const e = O(null), t = S("kendoIntlService", {}), a = S("kendoLocalizationService", {});
|
|
381
385
|
return {
|
|
382
386
|
inputRef: e,
|
|
383
387
|
kendoIntlService: t,
|
|
384
|
-
kendoLocalizationService:
|
|
388
|
+
kendoLocalizationService: a
|
|
385
389
|
};
|
|
386
390
|
},
|
|
387
391
|
render() {
|
|
388
392
|
const e = L(this), t = E(this), {
|
|
389
|
-
formatPlaceholder:
|
|
390
|
-
format:
|
|
393
|
+
formatPlaceholder: a,
|
|
394
|
+
format: i,
|
|
391
395
|
value: n,
|
|
392
396
|
modelValue: s,
|
|
393
|
-
name:
|
|
394
|
-
label:
|
|
395
|
-
id:
|
|
397
|
+
name: l,
|
|
398
|
+
label: r,
|
|
399
|
+
id: b,
|
|
396
400
|
ariaLabel: k,
|
|
397
401
|
ariaExpanded: V,
|
|
398
402
|
ariaHasPopup: F,
|
|
@@ -400,16 +404,16 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
400
404
|
ariaControls: I,
|
|
401
405
|
inputAttributes: M
|
|
402
406
|
} = this.$props, f = n !== void 0 ? n : s;
|
|
403
|
-
this.kendoDate.format =
|
|
407
|
+
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);
|
|
404
408
|
const {
|
|
405
409
|
text: g,
|
|
406
410
|
format: x
|
|
407
411
|
} = this.kendoDate.getTextAndFormat();
|
|
408
412
|
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 =
|
|
413
|
+
const $ = this.$props.placeholder !== void 0 && this.$data.isEmpty && !this.$data.isFocused ? null : g, y = b || this._inputId, w = !this.$props.validityStyles || this.validity().valid, d = o("span", {
|
|
410
414
|
class: this.wrapperClassNames,
|
|
411
415
|
dir: this.$props.dir
|
|
412
|
-
}, [
|
|
416
|
+
}, [o("input", _({
|
|
413
417
|
role: C,
|
|
414
418
|
tabindex: this.$props.tabIndex,
|
|
415
419
|
disabled: this.$props.disabled,
|
|
@@ -429,41 +433,41 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
429
433
|
onFocusin: this.handleFocus,
|
|
430
434
|
onFocusout: this.handleBlur,
|
|
431
435
|
value: $,
|
|
432
|
-
name:
|
|
436
|
+
name: l,
|
|
433
437
|
"aria-label": k,
|
|
434
438
|
"aria-expanded": V,
|
|
435
439
|
"aria-haspopup": F,
|
|
436
440
|
"aria-controls": I,
|
|
437
441
|
"aria-disabled": this.$props.disabled,
|
|
438
442
|
ref: j(this, "input")
|
|
439
|
-
}, M), null), e, this.$props.spinners &&
|
|
443
|
+
}, M), null), e, this.$props.spinners && o("span", {
|
|
440
444
|
class: "k-input-spinner k-spin-button",
|
|
441
445
|
onMousedown: this.spinnersMouseDown
|
|
442
|
-
}, [
|
|
446
|
+
}, [o(D, {
|
|
443
447
|
type: "button",
|
|
444
448
|
tabIndex: -1,
|
|
445
449
|
icon: "caret-alt-up",
|
|
446
|
-
svgIcon:
|
|
450
|
+
svgIcon: ae,
|
|
447
451
|
size: this.$props.size,
|
|
448
452
|
fillMode: this.$props.fillMode,
|
|
449
453
|
class: "k-spinner-increase",
|
|
450
454
|
"aria-label": t.toLanguageString(h, m[h]),
|
|
451
455
|
title: t.toLanguageString(h, m[h]),
|
|
452
456
|
onClick: this.increasePart
|
|
453
|
-
}, null),
|
|
457
|
+
}, null), o(D, {
|
|
454
458
|
type: "button",
|
|
455
459
|
tabIndex: -1,
|
|
456
460
|
class: "k-spinner-decrease",
|
|
457
461
|
icon: "caret-alt-down",
|
|
458
|
-
svgIcon:
|
|
462
|
+
svgIcon: ie,
|
|
459
463
|
size: this.$props.size,
|
|
460
464
|
fillMode: this.$props.fillMode,
|
|
461
465
|
"aria-label": t.toLanguageString(p, m[p]),
|
|
462
466
|
title: t.toLanguageString(p, m[p]),
|
|
463
467
|
onClick: this.decreasePart
|
|
464
468
|
}, null)])]);
|
|
465
|
-
return
|
|
466
|
-
label:
|
|
469
|
+
return r ? o(te, {
|
|
470
|
+
label: r,
|
|
467
471
|
editorId: y,
|
|
468
472
|
editorValue: $,
|
|
469
473
|
editorPlaceholder: this.$props.placeholder,
|
|
@@ -475,5 +479,5 @@ const se = "Please enter a valid value!", be = /* @__PURE__ */ T({
|
|
|
475
479
|
}
|
|
476
480
|
});
|
|
477
481
|
export {
|
|
478
|
-
|
|
482
|
+
De as DateInput
|
|
479
483
|
};
|
package/datepicker/DatePicker.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 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;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),w=require("@progress/kendo-svg-icons"),J=require("@progress/kendo-vue-popup"),l=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"),o=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:e=>!0,changemodel:e=>!0,"update:modelValue":e=>!0,iconclick:e=>!0,focus:e=>!0,blur:e=>!0,keydown:e=>!0,open:e=>!0,close:e=>!0},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 l.cloneDate(r.MAX_DATE)}},min:{type:Date,default:function(){return l.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?l.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",{event:e})},handleBlur(e){this.$data.isFocused=!1,this.createBlurTimeout(),this.$emit("blur",{event:e})},calendarBlur(e){this.$emit("blur",{event:e}),clearTimeout(this._blurTimeout),this.createBlurTimeout()},calendarFocus(e){this.$emit("focus",{event:e}),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=l.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:v,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&&l.getDate(g),S=!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:w.calendarIcon,onMousedown:this.handleIconMouseDown,onClick:this.handleIconClick,title:D.provideLocalizationService(this).toLanguageString(o.toggleCalendar,o.messages[o.toggleCalendar]),"aria-label":D.provideLocalizationService(this).toLanguageString(o.toggleCalendar,o.messages[o.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:w.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-${v}`]:v,[`k-rounded-${t.kendoThemeMaps.roundedMap[p]||p}`]:p,"k-invalid":!S,"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:S,editorValue:this.getDateInputText(),editorPlaceholder:this.$props.placeholder,editorDisabled:this.$props.disabled,style:{width:V}},b(d)?d:{default:()=>[d]}):d}});exports.DatePicker=te;
|