@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.
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +82 -80
- package/dateinput/models/kendo-date.js +1 -1
- package/dateinput/models/kendo-date.mjs +29 -26
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +66 -63
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +29 -26
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +59 -56
- package/dist/cdn/js/kendo-vue-dateinputs.js +1 -1
- package/index.d.mts +107 -75
- package/index.d.ts +107 -75
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +62 -59
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
8
|
+
import { defineComponent as oe, ref as _, inject as le, createVNode as n, h as s, isVNode as ue } from "vue";
|
|
9
9
|
import { calendarIcon as k } from "@progress/kendo-svg-icons";
|
|
10
|
-
import { Popup as
|
|
11
|
-
import { cloneDate as d, getDate as
|
|
12
|
-
import { validatePackage as
|
|
13
|
-
import { packageMetadata as
|
|
14
|
-
import { DateInput as
|
|
15
|
-
import { Calendar as
|
|
16
|
-
import { MAX_DATE as
|
|
10
|
+
import { Popup as se } from "@progress/kendo-vue-popup";
|
|
11
|
+
import { cloneDate as d, getDate as de } from "@progress/kendo-date-math";
|
|
12
|
+
import { validatePackage as re, guid as V, getRef as w, canUseDOM as he, Keys as i, getDefaultSlots as pe, classNames as C, templateRendering as r, getListeners as h, getTemplate as p, Icon as ce, setRef as v, kendoThemeMaps as T } from "@progress/kendo-vue-common";
|
|
13
|
+
import { packageMetadata as fe } from "../package-metadata.mjs";
|
|
14
|
+
import { DateInput as me } from "../dateinput/DateInput.mjs";
|
|
15
|
+
import { Calendar as ge } from "../calendar/components/Calendar.mjs";
|
|
16
|
+
import { MAX_DATE as $e, MIN_DATE as Se, isInDateRange as we, setTime as ve } from "../utils.mjs";
|
|
17
17
|
import { toggleCalendar as c, messages as F } from "../messages/main.mjs";
|
|
18
18
|
import { provideLocalizationService as B } from "@progress/kendo-vue-intl";
|
|
19
|
-
import { ToggleButton as
|
|
20
|
-
import { FloatingLabel as
|
|
21
|
-
function
|
|
22
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
19
|
+
import { ToggleButton as De } from "./ToggleButton.mjs";
|
|
20
|
+
import { FloatingLabel as be } from "@progress/kendo-vue-labels";
|
|
21
|
+
function O(e) {
|
|
22
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !ue(e);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const je = /* @__PURE__ */ oe({
|
|
25
25
|
name: "DatePicker",
|
|
26
26
|
inject: {
|
|
27
27
|
kendoLocalizationService: {
|
|
@@ -114,13 +114,13 @@ const xe = /* @__PURE__ */ ie({
|
|
|
114
114
|
max: {
|
|
115
115
|
type: Date,
|
|
116
116
|
default: function() {
|
|
117
|
-
return d(
|
|
117
|
+
return d($e);
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
min: {
|
|
121
121
|
type: Date,
|
|
122
122
|
default: function() {
|
|
123
|
-
return d(
|
|
123
|
+
return d(Se);
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
name: String,
|
|
@@ -158,7 +158,8 @@ const xe = /* @__PURE__ */ ie({
|
|
|
158
158
|
type: Boolean,
|
|
159
159
|
default: void 0
|
|
160
160
|
},
|
|
161
|
-
ariaLabel: String
|
|
161
|
+
ariaLabel: String,
|
|
162
|
+
inputAttributes: Object
|
|
162
163
|
},
|
|
163
164
|
data: function() {
|
|
164
165
|
return {
|
|
@@ -171,7 +172,7 @@ const xe = /* @__PURE__ */ ie({
|
|
|
171
172
|
};
|
|
172
173
|
},
|
|
173
174
|
created() {
|
|
174
|
-
|
|
175
|
+
re(fe), this._popupId = V(), this._anchor = V(), this._dateInput = null, this._calendar = null, this.$data.currentValue = this.$props.defaultValue, this.$data.currentShow = this.$props.defaultShow;
|
|
175
176
|
},
|
|
176
177
|
mounted() {
|
|
177
178
|
this._dateInput = w(this, "dateInput"), (this.$refs.calendar || this.calendarRef) && (this._calendar = w(this, "calendar")), this.computedShow && this.$forceUpdate();
|
|
@@ -218,11 +219,11 @@ const xe = /* @__PURE__ */ ie({
|
|
|
218
219
|
},
|
|
219
220
|
createBlurTimeout() {
|
|
220
221
|
this._blurTimeout = setTimeout(() => {
|
|
221
|
-
this._dateInput &&
|
|
222
|
+
this._dateInput && he && document.activeElement !== this._dateInput._element && this.setShow(!1);
|
|
222
223
|
}, 200);
|
|
223
224
|
},
|
|
224
225
|
validity() {
|
|
225
|
-
const e = this.computedValue, t =
|
|
226
|
+
const e = this.computedValue, t = we(e, this.$props.min, this.$props.max), a = this.$props.validationMessage !== void 0, o = (!this.$props.required || e !== null) && t, f = this.$props.valid !== void 0 ? this.$props.valid : o;
|
|
226
227
|
return {
|
|
227
228
|
customError: a,
|
|
228
229
|
rangeOverflow: e && this.$props.max.getTime() < e.getTime() || !1,
|
|
@@ -243,7 +244,7 @@ const xe = /* @__PURE__ */ ie({
|
|
|
243
244
|
}));
|
|
244
245
|
},
|
|
245
246
|
mergeTime(e) {
|
|
246
|
-
return this.computedValue && e ?
|
|
247
|
+
return this.computedValue && e ? ve(e, this.computedValue) : e;
|
|
247
248
|
},
|
|
248
249
|
handleInputValueChange(e) {
|
|
249
250
|
this.handleValueChange(e.value, e);
|
|
@@ -292,7 +293,7 @@ const xe = /* @__PURE__ */ ie({
|
|
|
292
293
|
}
|
|
293
294
|
},
|
|
294
295
|
setup() {
|
|
295
|
-
const e = _(null), t = _(null), a =
|
|
296
|
+
const e = _(null), t = _(null), a = le("kendoLocalizationService", {});
|
|
296
297
|
return {
|
|
297
298
|
listRef: e,
|
|
298
299
|
kendoAnchorRef: t,
|
|
@@ -300,32 +301,33 @@ const xe = /* @__PURE__ */ ie({
|
|
|
300
301
|
};
|
|
301
302
|
},
|
|
302
303
|
render() {
|
|
303
|
-
|
|
304
|
+
pe(this);
|
|
304
305
|
const {
|
|
305
306
|
disabled: e,
|
|
306
307
|
tabIndex: t,
|
|
307
308
|
title: a,
|
|
308
309
|
id: o,
|
|
309
310
|
format: f,
|
|
310
|
-
formatPlaceholder:
|
|
311
|
+
formatPlaceholder: R,
|
|
311
312
|
min: D,
|
|
312
|
-
max:
|
|
313
|
+
max: b,
|
|
313
314
|
weekNumber: M,
|
|
314
315
|
focusedDate: x,
|
|
315
316
|
width: j,
|
|
316
317
|
name: L,
|
|
317
318
|
validationMessage: z,
|
|
318
|
-
required:
|
|
319
|
-
validityStyles:
|
|
319
|
+
required: A,
|
|
320
|
+
validityStyles: N,
|
|
320
321
|
size: m,
|
|
321
|
-
fillMode:
|
|
322
|
+
fillMode: I,
|
|
322
323
|
rounded: g,
|
|
323
|
-
ariaLabel:
|
|
324
|
+
ariaLabel: P,
|
|
325
|
+
inputAttributes: K
|
|
324
326
|
} = this.$props, {
|
|
325
|
-
popupClass:
|
|
326
|
-
animate:
|
|
327
|
-
appendTo:
|
|
328
|
-
} = this.$props.popupSettings, $ = this.computedShow, S = this.computedValue,
|
|
327
|
+
popupClass: q,
|
|
328
|
+
animate: E,
|
|
329
|
+
appendTo: U
|
|
330
|
+
} = this.$props.popupSettings, $ = this.computedShow, S = this.computedValue, H = S && de(S), y = !this.$props.validityStyles || this.validity().valid, X = C("k-calendar-container k-group k-reset", q), G = this.$props.toggleButton ? r.call(this, this.$props.toggleButton, h.call(this)) : void 0, J = n(De, {
|
|
329
331
|
type: "button",
|
|
330
332
|
tabIndex: -1,
|
|
331
333
|
icon: "calendar",
|
|
@@ -336,67 +338,68 @@ const xe = /* @__PURE__ */ ie({
|
|
|
336
338
|
"aria-label": B(this).toLanguageString(c, F[c]),
|
|
337
339
|
rounded: null,
|
|
338
340
|
class: "k-input-button"
|
|
339
|
-
}, null),
|
|
341
|
+
}, null), Q = p.call(this, {
|
|
340
342
|
h: s,
|
|
341
|
-
template:
|
|
342
|
-
defaultRendering:
|
|
343
|
-
defaultSlots: n(
|
|
343
|
+
template: G,
|
|
344
|
+
defaultRendering: J,
|
|
345
|
+
defaultSlots: n(ce, {
|
|
344
346
|
name: "calendar",
|
|
345
347
|
icon: k
|
|
346
348
|
}, null),
|
|
347
349
|
additionalListeners: {
|
|
348
350
|
click: this.handleIconClick
|
|
349
351
|
}
|
|
350
|
-
}),
|
|
352
|
+
}), W = this.$props.dateInput ? r.call(this, this.$props.dateInput, h.call(this)) : void 0, Y = n(me, {
|
|
351
353
|
ref: v(this, "dateInput"),
|
|
352
354
|
placeholder: this.$props.placeholder,
|
|
353
355
|
disabled: e,
|
|
354
356
|
format: f,
|
|
355
|
-
formatPlaceholder:
|
|
357
|
+
formatPlaceholder: R,
|
|
356
358
|
id: o,
|
|
357
|
-
max:
|
|
359
|
+
max: b,
|
|
358
360
|
min: D,
|
|
359
361
|
name: L,
|
|
360
362
|
size: null,
|
|
361
363
|
rounded: null,
|
|
362
364
|
fillMode: null,
|
|
363
365
|
onChange: this.handleInputValueChange,
|
|
364
|
-
required:
|
|
366
|
+
required: A,
|
|
365
367
|
tabIndex: $ ? -1 : t,
|
|
366
368
|
title: a,
|
|
367
369
|
valid: this.validity().valid,
|
|
368
370
|
validationMessage: z,
|
|
369
|
-
validityStyles:
|
|
371
|
+
validityStyles: N,
|
|
370
372
|
value: S,
|
|
371
373
|
ariaHasPopup: "grid",
|
|
372
374
|
ariaExpanded: $,
|
|
373
375
|
ariaRole: "combobox",
|
|
374
376
|
ariaControls: this._popupId,
|
|
375
|
-
ariaLabel:
|
|
376
|
-
|
|
377
|
+
ariaLabel: P,
|
|
378
|
+
inputAttributes: K
|
|
379
|
+
}, null), Z = p.call(this, {
|
|
377
380
|
h: s,
|
|
378
|
-
template:
|
|
379
|
-
defaultRendering:
|
|
380
|
-
}),
|
|
381
|
+
template: W,
|
|
382
|
+
defaultRendering: Y
|
|
383
|
+
}), ee = this.$props.calendar ? r.call(this, this.$props.calendar, h.call(this)) : void 0, te = n(ge, {
|
|
381
384
|
ref: v(this, "calendar"),
|
|
382
385
|
onKeydown: this.handleKeyDown,
|
|
383
386
|
onFocus: this.calendarFocus,
|
|
384
387
|
onBlur: this.calendarBlur,
|
|
385
388
|
disabled: e,
|
|
386
|
-
value:
|
|
389
|
+
value: H,
|
|
387
390
|
min: D,
|
|
388
|
-
max:
|
|
391
|
+
max: b,
|
|
389
392
|
weekNumber: M,
|
|
390
393
|
focusedDate: x,
|
|
391
394
|
onChange: this.handleCalendarValueChange
|
|
392
395
|
}, null), l = p.call(this, {
|
|
393
396
|
h: s,
|
|
394
|
-
template:
|
|
395
|
-
defaultRendering:
|
|
396
|
-
}),
|
|
397
|
+
template: ee,
|
|
398
|
+
defaultRendering: te
|
|
399
|
+
}), ae = this.$props.popup ? r.call(this, this.$props.popup, h.call(this)) : void 0, ne = n(se, {
|
|
397
400
|
show: $,
|
|
398
401
|
anchor: this._anchor,
|
|
399
|
-
class:
|
|
402
|
+
class: X,
|
|
400
403
|
id: this._popupId,
|
|
401
404
|
anchorAlign: {
|
|
402
405
|
horizontal: "left",
|
|
@@ -406,21 +409,21 @@ const xe = /* @__PURE__ */ ie({
|
|
|
406
409
|
horizontal: "left",
|
|
407
410
|
vertical: "top"
|
|
408
411
|
},
|
|
409
|
-
animate:
|
|
410
|
-
appendTo:
|
|
411
|
-
},
|
|
412
|
+
animate: E,
|
|
413
|
+
appendTo: U
|
|
414
|
+
}, O(l) ? l : {
|
|
412
415
|
default: () => [l]
|
|
413
|
-
}),
|
|
416
|
+
}), ie = p.call(this, {
|
|
414
417
|
h: s,
|
|
415
|
-
template:
|
|
416
|
-
defaultRendering:
|
|
418
|
+
template: ae,
|
|
419
|
+
defaultRendering: ne,
|
|
417
420
|
defaultSlots: l
|
|
418
421
|
}), u = n("span", {
|
|
419
422
|
ref: v(this, "kendoAnchor"),
|
|
420
423
|
role: "group",
|
|
421
424
|
class: C("k-input", "k-datepicker", {
|
|
422
425
|
[`k-input-${T.sizeMap[m] || m}`]: m,
|
|
423
|
-
[`k-input-${
|
|
426
|
+
[`k-input-${I}`]: I,
|
|
424
427
|
[`k-rounded-${T.roundedMap[g] || g}`]: g,
|
|
425
428
|
"k-invalid": !y,
|
|
426
429
|
"k-required": this.required,
|
|
@@ -430,8 +433,8 @@ const xe = /* @__PURE__ */ ie({
|
|
|
430
433
|
onKeydown: this.handleKeyDown,
|
|
431
434
|
onFocusin: this.handleFocus,
|
|
432
435
|
onFocusout: this.handleBlur
|
|
433
|
-
}, [
|
|
434
|
-
return this.$props.label ? n(
|
|
436
|
+
}, [Z, Q, ie]);
|
|
437
|
+
return this.$props.label ? n(be, {
|
|
435
438
|
label: this.$props.label,
|
|
436
439
|
editorId: o,
|
|
437
440
|
editorValid: y,
|
|
@@ -441,11 +444,11 @@ const xe = /* @__PURE__ */ ie({
|
|
|
441
444
|
style: {
|
|
442
445
|
width: j
|
|
443
446
|
}
|
|
444
|
-
},
|
|
447
|
+
}, O(u) ? u : {
|
|
445
448
|
default: () => [u]
|
|
446
449
|
}) : u;
|
|
447
450
|
}
|
|
448
451
|
});
|
|
449
452
|
export {
|
|
450
|
-
|
|
453
|
+
je as DatePicker
|
|
451
454
|
};
|
|
@@ -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 s=require("vue"),N=require("@progress/kendo-vue-popup"),c=require("@progress/kendo-date-math"),n=require("@progress/kendo-vue-common"),h=require("@progress/kendo-vue-intl"),x=require("../package-metadata.js"),m=require("../dateinput/DateInput.js"),j=require("../calendar/components/Calendar.js"),o=require("../calendar/models/SelectionRange.js"),g=require("../defaults.js"),a=require("../messages/main.js"),z=require("@progress/kendo-svg-icons"),P=s.defineComponent({name:"KendoDateRangePicker",emits:{blur:null,change:null,changemodel:null,"update:modelValue":null,focus:null,keydown:null,open:null,close:null},inject:{kendoLocalizationService:{default:null}},model:{event:"changemodel"},props:{allowReverse:{type:Boolean,default:!1},calendarSettings:Object,defaultShow:{type:Boolean,default:!1},defaultValue:{type:Object,default:function(){return o.EMPTY_SELECTIONRANGE}},modelValue:{type:Object,default:void 0},disabled:{type:Boolean,default:!1},popup:[String,Object,Function],calendar:[String,Object,Function],startDateInput:[String,Object,Function],endDateInput:[String,Object,Function],endDateInputSettings:Object,focusedDate:Date,format:{type:[String,Object],default:function(){return"d"}},id:String,ariaLabelledBy:String,ariaDescribedBy:String,max:{type:Date,default:function(){return g.MAX_DATE}},min:{type:Date,default:function(){return g.MIN_DATE}},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)}},popupSettings:{type:Object,default:function(){return{}}},show:{type:Boolean,default:void 0},startDateInputSettings:Object,swapButton:{type:Boolean,default:!1},tabIndex:Number,value:{type:Object,default:function(){}}},created(){this._element=null,this._wrapper=null,this._calendar=null,this._startDateInput=null,this._endDateInput=null,this._popupId=n.guid(),this._anchor=n.guid(),this._startInputId=n.guid(),this._endInputId=n.guid(),this._calendarId=n.guid(),n.validatePackage(x.packageMetadata),this.currentShow=this.$props.show||this.$props.defaultShow,this.currentValue=this.$props.value||this.$props.defaultValue,this.initialAnimation=this.currentShow},mounted(){this._calendar=this.calendarRef,this._startDateInput=this.startDateInputRef,this._endDateInput=this.endDateInputRef,this.computedShow&&(this.$forceUpdate(),this.$nextTick(function(){this.initialAnimation=!1}))},updated(){this._calendar=this.calendarRef,this._startDateInput=this.startDateInputRef,this._endDateInput=this.endDateInputRef,this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1},data(){return{currentShow:!1,currentValue:null,valueDuringOnChange:void 0,shouldFocusDateInput:!1,shouldFocusCalendar:!1}},computed:{rootClassName(){return{"k-daterangepicker":!0,"k-disabled":this.$props.disabled}},computedValue(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.$props.value!==void 0?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.currentValue)||o.EMPTY_SELECTIONRANGE},computedShow(){return this.$props.show!==void 0?this.$props.show:this.currentShow},swapButtonClass(){const{size:e,rounded:t}=this.$props;return{"k-button":!0,[`k-button-${n.kendoThemeMaps.sizeMap[e]||e}`]:e,"k-button-flat":!0,"k-button-flat-base":!0,"k-icon-button":!0,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t}}},setup(){const e=s.ref(null),t=s.inject("kendoLocalizationService",{});return{kendoAnchorRef:e,kendoLocalizationService:t}},render(){const e=this.computedValue||o.EMPTY_SELECTIONRANGE,{size:t,fillMode:i,rounded:r}=this.$props,l=(this.$props.startDateInputSettings||{}).id||this._startInputId,f=(this.$props.endDateInputSettings||{}).id||this._endInputId,d=h.provideLocalizationService(this),I=d.toLanguageString(a.start,a.messages[a.start]),S=d.toLanguageString(a.end,a.messages[a.end]),D=d.toLanguageString(a.separator,a.messages[a.separator]),v=this.$props.startDateInput?n.templateRendering.call(this,this.$props.startDateInput,n.getListeners.call(this)):void 0,w={label:I,format:this.$props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.$props.disabled,valid:this.$props.valid,size:t,fillMode:i,rounded:r,ariaHasPopup:"grid",ariaExpanded:this.computedShow,value:e.start,ariaRole:"combobox",ariaControls:this._popupId,...this.$props.startDateInputSettings},b=s.h(m.DateInput,{ref:u=>{this.startDateInputRef=u},...w,onChange:this.handleStartChange}),$=n.getTemplate.call(this,{h:s.h,template:v,defaultRendering:b,additionalListeners:{change:this.handleStartChange}}),C=this.$props.endDateInput?n.templateRendering.call(this,this.$props.endDateInput,n.getListeners.call(this)):void 0,R={label:S,format:this.$props.format,min:this.min,max:this.max,id:this._endInputId,size:t,fillMode:i,rounded:r,disabled:this.$props.disabled,valid:this.$props.valid,ariaHasPopup:"grid",ariaExpanded:this.computedShow,value:e.end,ariaRole:"combobox",ariaControls:this._popupId,...this.$props.endDateInputSettings},y=s.h(m.DateInput,{ref:u=>{this.endDateInputRef=u},...R,onChange:this.handleEndChange}),E=n.getTemplate.call(this,{h:s.h,template:C,defaultRendering:y,additionalListeners:{change:this.handleEndChange}}),_=this.$props.calendar?n.templateRendering.call(this,this.$props.calendar,n.getListeners.call(this)):void 0,V={id:this._calendarId,min:this.min,max:this.max,views:2,allowReverse:this.$props.allowReverse,mode:"range",focusedDate:this.$props.focusedDate,disabled:this.$props.disabled,value:e,...this.$props.calendarSettings},k=s.h(j.Calendar,{ref:u=>{this.calendarRef=u},onKeydown:this.handleKeyDown,onFocus:this.calendarFocus,onBlur:this.calendarBlur,onChange:this.handleCalendarChange,...V}),p=n.getTemplate.call(this,{h:s.h,template:_,defaultRendering:k,additionalListeners:{change:this.handleCalendarChange,keydown:this.handleKeyDown,focus:this.calendarFocus,blur:this.calendarBlur}}),{popupClass:T,animate:B}=this.$props.popupSettings,L=this.$props.popup?n.templateRendering.call(this,this.$props.popup,n.getListeners.call(this)):void 0,M={show:this.computedShow,anchor:this._anchor,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},animate:this.initialAnimation?!1:B,...this.$props.popupSettings},O=s.h(N.Popup,{class:T,...M},function(){return[p]}),F=n.getTemplate.call(this,{h:s.h,template:L,defaultRendering:O,defaultSlots:p}),A=s.createVNode("button",{class:this.swapButtonClass,role:"button",title:h.provideLocalizationService(this).toLanguageString(a.swapStartEnd,a.messages[a.swapStartEnd]),onMousedown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":l+" "+f,"aria-label":h.provideLocalizationService(this).toLanguageString(a.swapStartEnd,a.messages[a.swapStartEnd])},[s.createVNode(n.Icon,{name:"arrows-swap",icon:z.arrowsSwapIcon,style:{transform:"rotate(90deg)"},class:"k-button-icon"},null)]);return s.createVNode("span",{class:this.rootClassName,style:this.$attrs.style,id:this.$props.id,"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,tabindex:this.$props.tabIndex,onFocusin:this.handleFocus,onFocusout:this.handleBlur,onKeydown:this.handleKeyDown,ref:u=>{this.kendoAnchorRef=u}},[$,(this.$props.allowReverse||this.$props.calendarSettings&&this.$props.calendarSettings.allowReverse)&&this.$props.swapButton?A:D,E,F])},methods:{focus(){const e=this.getStartInput();e&&e.focus()},focusCalendarElement(){const e=this.getCalendar();e&&e.focus({preventScroll:!0})},focusDateInputElement(){const e=this.getStartInput(),t=this.getEndInput();!document||!e||!t||((this.computedValue.start===null||this.computedValue.end!==null)&&document.activeElement!==t?e.focus({preventScroll:!0}):document.activeElement!==e&&t.focus({preventScroll:!0}))},calculateValue(e,t){return(e.value!==void 0?e.value:t.currentValue)||o.EMPTY_SELECTIONRANGE},calculateShow(e,t){return e.show!==void 0?e.show:t.currentShow},setShow(e){this.currentShow!==e&&(this.currentShow=e,this.$emit(e?"open":"close",{component:this}))},handleReverseClick(e){const t={start:this.computedValue.end,end:this.computedValue.start},i={event:e.event};this.handleChange(t,i)},handleReverseMouseDown(e){e.preventDefault()},handleFocus(e){this.shouldFocusDateInput||this.setShow(!0),this.$emit("focus",e)},calendarBlur(){clearTimeout(this._blurTimeout),this.createBlurTimeout()},calendarFocus(){clearTimeout(this._blurTimeout)},createBlurTimeout(){this._blurTimeout=setTimeout(()=>{const e=this.getStartInput(),t=this.getEndInput();e&&t&&n.canUseDOM&&e&&document.activeElement!==t&&this.setShow(!1)},200)},getStartInput(){return this._startDateInput&&this._startDateInput.element?this._startDateInput.element():document.getElementById(this._startInputId)},getEndInput(){return this._endDateInput&&this._endDateInput.element?this._endDateInput.element():document.getElementById(this._endInputId)},getCalendar(){return this._calendar&&this._calendar.element?this._calendar:document.getElementById(this._calendarId)},handleBlur(e){this.createBlurTimeout(),this.$emit("blur",e)},handleEndChange(e){const t={start:this.computedValue.start,end:c.cloneDate(e.value||void 0)};this.handleChange(t,e)},handleStartChange(e){const t={start:c.cloneDate(e.value||void 0),end:this.computedValue.end};this.handleChange(t,e)},extractRangeFromValue(e){if(!Array.isArray(e.value)&&!(e.value instanceof Date))return e.value||o.EMPTY_SELECTIONRANGE;const t=Array.isArray(e.value)?e.value[0]:e.value;return{start:this.computedValue.end!==null?t:this.computedValue.start,end:this.computedValue.start!==null?t:this.computedValue.end}},handleCalendarChange(e){const t=this.extractRangeFromValue(e);this.handleChange(t,e)},handleKeyDown(e){const{keyCode:t,altKey:i}=e,r=this.getEndInput(),l=this.getCalendar();t===n.Keys.esc?(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):i&&t===n.Keys.down?(e.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0)):t===n.Keys.tab&&this.computedShow&&l&&r&&document&&document.activeElement===r&&(e.preventDefault(),this.focusCalendarElement()),this.$emit("keydown",e)},handleChange(e,t){this.currentValue=e,this.valueDuringOnChange=e;const i={event:t.event,value:this.computedValue,show:this.computedShow,component:this,target:{name:this.$props.name,value:this.computedValue,show:this.computedShow}};this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",i),this.valueDuringOnChange=void 0}}});exports.DateRangePicker=P;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),N=require("@progress/kendo-vue-popup"),c=require("@progress/kendo-date-math"),n=require("@progress/kendo-vue-common"),h=require("@progress/kendo-vue-intl"),j=require("../package-metadata.js"),m=require("../dateinput/DateInput.js"),x=require("../calendar/components/Calendar.js"),o=require("../calendar/models/SelectionRange.js"),g=require("../defaults.js"),a=require("../messages/main.js"),z=require("@progress/kendo-svg-icons"),P=s.defineComponent({name:"KendoDateRangePicker",emits:{blur:null,change:null,changemodel:null,"update:modelValue":null,focus:null,keydown:null,open:null,close:null},inject:{kendoLocalizationService:{default:null}},model:{event:"changemodel"},props:{allowReverse:{type:Boolean,default:!1},calendarSettings:Object,defaultShow:{type:Boolean,default:!1},defaultValue:{type:Object,default:function(){return o.EMPTY_SELECTIONRANGE}},modelValue:{type:Object,default:void 0},disabled:{type:Boolean,default:!1},popup:[String,Object,Function],calendar:[String,Object,Function],startDateInput:[String,Object,Function],endDateInput:[String,Object,Function],endDateInputSettings:Object,focusedDate:Date,format:{type:[String,Object],default:function(){return"d"}},id:String,ariaLabelledBy:String,ariaDescribedBy:String,max:{type:Date,default:function(){return g.MAX_DATE}},min:{type:Date,default:function(){return g.MIN_DATE}},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)}},popupSettings:{type:Object,default:function(){return{}}},show:{type:Boolean,default:void 0},startDateInputSettings:Object,swapButton:{type:Boolean,default:!1},tabIndex:Number,value:{type:Object,default:function(){}},inputAttributes:Object},created(){this._element=null,this._wrapper=null,this._calendar=null,this._startDateInput=null,this._endDateInput=null,this._popupId=n.guid(),this._anchor=n.guid(),this._startInputId=n.guid(),this._endInputId=n.guid(),this._calendarId=n.guid(),n.validatePackage(j.packageMetadata),this.currentShow=this.$props.show||this.$props.defaultShow,this.currentValue=this.$props.value||this.$props.defaultValue,this.initialAnimation=this.currentShow},mounted(){this._calendar=this.calendarRef,this._startDateInput=this.startDateInputRef,this._endDateInput=this.endDateInputRef,this.computedShow&&(this.$forceUpdate(),this.$nextTick(function(){this.initialAnimation=!1}))},updated(){this._calendar=this.calendarRef,this._startDateInput=this.startDateInputRef,this._endDateInput=this.endDateInputRef,this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1},data(){return{currentShow:!1,currentValue:null,valueDuringOnChange:void 0,shouldFocusDateInput:!1,shouldFocusCalendar:!1}},computed:{rootClassName(){return{"k-daterangepicker":!0,"k-disabled":this.$props.disabled}},computedValue(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.$props.value!==void 0?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.currentValue)||o.EMPTY_SELECTIONRANGE},computedShow(){return this.$props.show!==void 0?this.$props.show:this.currentShow},swapButtonClass(){const{size:e,rounded:t}=this.$props;return{"k-button":!0,[`k-button-${n.kendoThemeMaps.sizeMap[e]||e}`]:e,"k-button-flat":!0,"k-button-flat-base":!0,"k-icon-button":!0,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t}}},setup(){const e=s.ref(null),t=s.inject("kendoLocalizationService",{});return{kendoAnchorRef:e,kendoLocalizationService:t}},render(){const e=this.computedValue||o.EMPTY_SELECTIONRANGE,{size:t,fillMode:i,rounded:r}=this.$props,l=(this.$props.startDateInputSettings||{}).id||this._startInputId,f=(this.$props.endDateInputSettings||{}).id||this._endInputId,d=h.provideLocalizationService(this),I=d.toLanguageString(a.start,a.messages[a.start]),S=d.toLanguageString(a.end,a.messages[a.end]),D=d.toLanguageString(a.separator,a.messages[a.separator]),v=this.$props.startDateInput?n.templateRendering.call(this,this.$props.startDateInput,n.getListeners.call(this)):void 0,b={label:I,format:this.$props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.$props.disabled,valid:this.$props.valid,size:t,fillMode:i,rounded:r,ariaHasPopup:"grid",ariaExpanded:this.computedShow,value:e.start,ariaRole:"combobox",ariaControls:this._popupId,inputAttributes:this.$props.inputAttributes,...this.$props.startDateInputSettings},w=s.h(m.DateInput,{ref:u=>{this.startDateInputRef=u},...b,onChange:this.handleStartChange}),$=n.getTemplate.call(this,{h:s.h,template:v,defaultRendering:w,additionalListeners:{change:this.handleStartChange}}),C=this.$props.endDateInput?n.templateRendering.call(this,this.$props.endDateInput,n.getListeners.call(this)):void 0,R={label:S,format:this.$props.format,min:this.min,max:this.max,id:this._endInputId,size:t,fillMode:i,rounded:r,disabled:this.$props.disabled,valid:this.$props.valid,ariaHasPopup:"grid",ariaExpanded:this.computedShow,value:e.end,ariaRole:"combobox",ariaControls:this._popupId,inputAttributes:this.$props.inputAttributes,...this.$props.endDateInputSettings},y=s.h(m.DateInput,{ref:u=>{this.endDateInputRef=u},...R,onChange:this.handleEndChange}),E=n.getTemplate.call(this,{h:s.h,template:C,defaultRendering:y,additionalListeners:{change:this.handleEndChange}}),_=this.$props.calendar?n.templateRendering.call(this,this.$props.calendar,n.getListeners.call(this)):void 0,V={id:this._calendarId,min:this.min,max:this.max,views:2,allowReverse:this.$props.allowReverse,mode:"range",focusedDate:this.$props.focusedDate,disabled:this.$props.disabled,value:e,...this.$props.calendarSettings},k=s.h(x.Calendar,{ref:u=>{this.calendarRef=u},onKeydown:this.handleKeyDown,onFocus:this.calendarFocus,onBlur:this.calendarBlur,onChange:this.handleCalendarChange,...V}),p=n.getTemplate.call(this,{h:s.h,template:_,defaultRendering:k,additionalListeners:{change:this.handleCalendarChange,keydown:this.handleKeyDown,focus:this.calendarFocus,blur:this.calendarBlur}}),{popupClass:T,animate:B}=this.$props.popupSettings,L=this.$props.popup?n.templateRendering.call(this,this.$props.popup,n.getListeners.call(this)):void 0,O={show:this.computedShow,anchor:this._anchor,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},animate:this.initialAnimation?!1:B,...this.$props.popupSettings},A=s.h(N.Popup,{class:T,...O},function(){return[p]}),M=n.getTemplate.call(this,{h:s.h,template:L,defaultRendering:A,defaultSlots:p}),F=s.createVNode("button",{class:this.swapButtonClass,role:"button",title:h.provideLocalizationService(this).toLanguageString(a.swapStartEnd,a.messages[a.swapStartEnd]),onMousedown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":l+" "+f,"aria-label":h.provideLocalizationService(this).toLanguageString(a.swapStartEnd,a.messages[a.swapStartEnd])},[s.createVNode(n.Icon,{name:"arrows-swap",icon:z.arrowsSwapIcon,style:{transform:"rotate(90deg)"},class:"k-button-icon"},null)]);return s.createVNode("span",{class:this.rootClassName,style:this.$attrs.style,id:this.$props.id,"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,tabindex:this.$props.tabIndex,onFocusin:this.handleFocus,onFocusout:this.handleBlur,onKeydown:this.handleKeyDown,ref:u=>{this.kendoAnchorRef=u}},[$,(this.$props.allowReverse||this.$props.calendarSettings&&this.$props.calendarSettings.allowReverse)&&this.$props.swapButton?F:D,E,M])},methods:{focus(){const e=this.getStartInput();e&&e.focus()},focusCalendarElement(){const e=this.getCalendar();e&&e.focus({preventScroll:!0})},focusDateInputElement(){const e=this.getStartInput(),t=this.getEndInput();!document||!e||!t||((this.computedValue.start===null||this.computedValue.end!==null)&&document.activeElement!==t?e.focus({preventScroll:!0}):document.activeElement!==e&&t.focus({preventScroll:!0}))},calculateValue(e,t){return(e.value!==void 0?e.value:t.currentValue)||o.EMPTY_SELECTIONRANGE},calculateShow(e,t){return e.show!==void 0?e.show:t.currentShow},setShow(e){this.currentShow!==e&&(this.currentShow=e,this.$emit(e?"open":"close",{component:this}))},handleReverseClick(e){const t={start:this.computedValue.end,end:this.computedValue.start},i={event:e.event};this.handleChange(t,i)},handleReverseMouseDown(e){e.preventDefault()},handleFocus(e){this.shouldFocusDateInput||this.setShow(!0),this.$emit("focus",e)},calendarBlur(){clearTimeout(this._blurTimeout),this.createBlurTimeout()},calendarFocus(){clearTimeout(this._blurTimeout)},createBlurTimeout(){this._blurTimeout=setTimeout(()=>{const e=this.getStartInput(),t=this.getEndInput();e&&t&&n.canUseDOM&&e&&document.activeElement!==t&&this.setShow(!1)},200)},getStartInput(){return this._startDateInput&&this._startDateInput.element?this._startDateInput.element():document.getElementById(this._startInputId)},getEndInput(){return this._endDateInput&&this._endDateInput.element?this._endDateInput.element():document.getElementById(this._endInputId)},getCalendar(){return this._calendar&&this._calendar.element?this._calendar:document.getElementById(this._calendarId)},handleBlur(e){this.createBlurTimeout(),this.$emit("blur",e)},handleEndChange(e){const t={start:this.computedValue.start,end:c.cloneDate(e.value||void 0)};this.handleChange(t,e)},handleStartChange(e){const t={start:c.cloneDate(e.value||void 0),end:this.computedValue.end};this.handleChange(t,e)},extractRangeFromValue(e){if(!Array.isArray(e.value)&&!(e.value instanceof Date))return e.value||o.EMPTY_SELECTIONRANGE;const t=Array.isArray(e.value)?e.value[0]:e.value;return{start:this.computedValue.end!==null?t:this.computedValue.start,end:this.computedValue.start!==null?t:this.computedValue.end}},handleCalendarChange(e){const t=this.extractRangeFromValue(e);this.handleChange(t,e)},handleKeyDown(e){const{keyCode:t,altKey:i}=e,r=this.getEndInput(),l=this.getCalendar();t===n.Keys.esc?(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):i&&t===n.Keys.down?(e.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0)):t===n.Keys.tab&&this.computedShow&&l&&r&&document&&document.activeElement===r&&(e.preventDefault(),this.focusCalendarElement()),this.$emit("keydown",e)},handleChange(e,t){this.currentValue=e,this.valueDuringOnChange=e;const i={event:t.event,value:this.computedValue,show:this.computedShow,component:this,target:{name:this.$props.name,value:this.computedValue,show:this.computedShow}};this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",i),this.valueDuringOnChange=void 0}}});exports.DateRangePicker=P;
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
import { defineComponent as X, ref as Y, inject as q, h as a, createVNode as f } from "vue";
|
|
9
9
|
import { Popup as J } from "@progress/kendo-vue-popup";
|
|
10
10
|
import { cloneDate as S } from "@progress/kendo-date-math";
|
|
11
|
-
import { guid as o, validatePackage as Q, kendoThemeMaps as
|
|
11
|
+
import { guid as o, validatePackage as Q, kendoThemeMaps as b, templateRendering as l, getListeners as d, getTemplate as h, Icon as W, canUseDOM as Z, Keys as g } from "@progress/kendo-vue-common";
|
|
12
12
|
import { provideLocalizationService as I } from "@progress/kendo-vue-intl";
|
|
13
13
|
import { packageMetadata as tt } from "../package-metadata.mjs";
|
|
14
|
-
import { DateInput as
|
|
14
|
+
import { DateInput as v } from "../dateinput/DateInput.mjs";
|
|
15
15
|
import { Calendar as et } from "../calendar/components/Calendar.mjs";
|
|
16
|
-
import { EMPTY_SELECTIONRANGE as
|
|
16
|
+
import { EMPTY_SELECTIONRANGE as u } from "../calendar/models/SelectionRange.mjs";
|
|
17
17
|
import { MAX_DATE as nt, MIN_DATE as at } from "../defaults.mjs";
|
|
18
|
-
import { start as $, messages as
|
|
18
|
+
import { start as $, messages as r, end as w, separator as C, swapStartEnd as p } from "../messages/main.mjs";
|
|
19
19
|
import { arrowsSwapIcon as st } from "@progress/kendo-svg-icons";
|
|
20
20
|
const It = /* @__PURE__ */ X({
|
|
21
21
|
name: "KendoDateRangePicker",
|
|
@@ -50,7 +50,7 @@ const It = /* @__PURE__ */ X({
|
|
|
50
50
|
defaultValue: {
|
|
51
51
|
type: Object,
|
|
52
52
|
default: function() {
|
|
53
|
-
return
|
|
53
|
+
return u;
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
modelValue: {
|
|
@@ -129,7 +129,8 @@ const It = /* @__PURE__ */ X({
|
|
|
129
129
|
type: Object,
|
|
130
130
|
default: function() {
|
|
131
131
|
}
|
|
132
|
-
}
|
|
132
|
+
},
|
|
133
|
+
inputAttributes: Object
|
|
133
134
|
},
|
|
134
135
|
created() {
|
|
135
136
|
this._element = null, this._wrapper = null, this._calendar = null, this._startDateInput = null, this._endDateInput = null, this._popupId = o(), this._anchor = o(), this._startInputId = o(), this._endInputId = o(), this._calendarId = o(), Q(tt), this.currentShow = this.$props.show || this.$props.defaultShow, this.currentValue = this.$props.value || this.$props.defaultValue, this.initialAnimation = this.currentShow;
|
|
@@ -159,7 +160,7 @@ const It = /* @__PURE__ */ X({
|
|
|
159
160
|
};
|
|
160
161
|
},
|
|
161
162
|
computedValue() {
|
|
162
|
-
return (this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.$props.value !== void 0 ? this.$props.value : this.$props.modelValue !== void 0 ? this.$props.modelValue : this.currentValue) ||
|
|
163
|
+
return (this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.$props.value !== void 0 ? this.$props.value : this.$props.modelValue !== void 0 ? this.$props.modelValue : this.currentValue) || u;
|
|
163
164
|
},
|
|
164
165
|
computedShow() {
|
|
165
166
|
return this.$props.show !== void 0 ? this.$props.show : this.currentShow;
|
|
@@ -171,11 +172,11 @@ const It = /* @__PURE__ */ X({
|
|
|
171
172
|
} = this.$props;
|
|
172
173
|
return {
|
|
173
174
|
"k-button": !0,
|
|
174
|
-
[`k-button-${
|
|
175
|
+
[`k-button-${b.sizeMap[t] || t}`]: t,
|
|
175
176
|
"k-button-flat": !0,
|
|
176
177
|
"k-button-flat-base": !0,
|
|
177
178
|
"k-icon-button": !0,
|
|
178
|
-
[`k-rounded-${
|
|
179
|
+
[`k-rounded-${b.roundedMap[e] || e}`]: e
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
182
|
},
|
|
@@ -187,11 +188,11 @@ const It = /* @__PURE__ */ X({
|
|
|
187
188
|
};
|
|
188
189
|
},
|
|
189
190
|
render() {
|
|
190
|
-
const t = this.computedValue ||
|
|
191
|
+
const t = this.computedValue || u, {
|
|
191
192
|
size: e,
|
|
192
193
|
fillMode: n,
|
|
193
194
|
rounded: i
|
|
194
|
-
} = this.$props, c = (this.$props.startDateInputSettings || {}).id || this._startInputId, R = (this.$props.endDateInputSettings || {}).id || this._endInputId, m = I(this), y = m.toLanguageString($,
|
|
195
|
+
} = this.$props, c = (this.$props.startDateInputSettings || {}).id || this._startInputId, R = (this.$props.endDateInputSettings || {}).id || this._endInputId, m = I(this), y = m.toLanguageString($, r[$]), _ = m.toLanguageString(w, r[w]), V = m.toLanguageString(C, r[C]), k = this.$props.startDateInput ? l.call(this, this.$props.startDateInput, d.call(this)) : void 0, E = {
|
|
195
196
|
label: y,
|
|
196
197
|
format: this.$props.format,
|
|
197
198
|
min: this.min,
|
|
@@ -207,8 +208,9 @@ const It = /* @__PURE__ */ X({
|
|
|
207
208
|
value: t.start,
|
|
208
209
|
ariaRole: "combobox",
|
|
209
210
|
ariaControls: this._popupId,
|
|
211
|
+
inputAttributes: this.$props.inputAttributes,
|
|
210
212
|
...this.$props.startDateInputSettings
|
|
211
|
-
}, B = a(
|
|
213
|
+
}, B = a(v, {
|
|
212
214
|
ref: (s) => {
|
|
213
215
|
this.startDateInputRef = s;
|
|
214
216
|
},
|
|
@@ -221,7 +223,7 @@ const It = /* @__PURE__ */ X({
|
|
|
221
223
|
additionalListeners: {
|
|
222
224
|
change: this.handleStartChange
|
|
223
225
|
}
|
|
224
|
-
}),
|
|
226
|
+
}), A = this.$props.endDateInput ? l.call(this, this.$props.endDateInput, d.call(this)) : void 0, O = {
|
|
225
227
|
label: _,
|
|
226
228
|
format: this.$props.format,
|
|
227
229
|
min: this.min,
|
|
@@ -237,21 +239,22 @@ const It = /* @__PURE__ */ X({
|
|
|
237
239
|
value: t.end,
|
|
238
240
|
ariaRole: "combobox",
|
|
239
241
|
ariaControls: this._popupId,
|
|
242
|
+
inputAttributes: this.$props.inputAttributes,
|
|
240
243
|
...this.$props.endDateInputSettings
|
|
241
|
-
},
|
|
244
|
+
}, x = a(v, {
|
|
242
245
|
ref: (s) => {
|
|
243
246
|
this.endDateInputRef = s;
|
|
244
247
|
},
|
|
245
|
-
...
|
|
248
|
+
...O,
|
|
246
249
|
onChange: this.handleEndChange
|
|
247
|
-
}),
|
|
250
|
+
}), L = h.call(this, {
|
|
248
251
|
h: a,
|
|
249
|
-
template:
|
|
250
|
-
defaultRendering:
|
|
252
|
+
template: A,
|
|
253
|
+
defaultRendering: x,
|
|
251
254
|
additionalListeners: {
|
|
252
255
|
change: this.handleEndChange
|
|
253
256
|
}
|
|
254
|
-
}),
|
|
257
|
+
}), M = this.$props.calendar ? l.call(this, this.$props.calendar, d.call(this)) : void 0, T = {
|
|
255
258
|
id: this._calendarId,
|
|
256
259
|
min: this.min,
|
|
257
260
|
max: this.max,
|
|
@@ -270,10 +273,10 @@ const It = /* @__PURE__ */ X({
|
|
|
270
273
|
onFocus: this.calendarFocus,
|
|
271
274
|
onBlur: this.calendarBlur,
|
|
272
275
|
onChange: this.handleCalendarChange,
|
|
273
|
-
...
|
|
276
|
+
...T
|
|
274
277
|
}), D = h.call(this, {
|
|
275
278
|
h: a,
|
|
276
|
-
template:
|
|
279
|
+
template: M,
|
|
277
280
|
defaultRendering: j,
|
|
278
281
|
additionalListeners: {
|
|
279
282
|
change: this.handleCalendarChange,
|
|
@@ -311,11 +314,11 @@ const It = /* @__PURE__ */ X({
|
|
|
311
314
|
}), G = f("button", {
|
|
312
315
|
class: this.swapButtonClass,
|
|
313
316
|
role: "button",
|
|
314
|
-
title: I(this).toLanguageString(p,
|
|
317
|
+
title: I(this).toLanguageString(p, r[p]),
|
|
315
318
|
onMousedown: this.handleReverseMouseDown,
|
|
316
319
|
onClick: this.handleReverseClick,
|
|
317
320
|
"aria-controls": c + " " + R,
|
|
318
|
-
"aria-label": I(this).toLanguageString(p,
|
|
321
|
+
"aria-label": I(this).toLanguageString(p, r[p])
|
|
319
322
|
}, [f(W, {
|
|
320
323
|
name: "arrows-swap",
|
|
321
324
|
icon: st,
|
|
@@ -337,7 +340,7 @@ const It = /* @__PURE__ */ X({
|
|
|
337
340
|
ref: (s) => {
|
|
338
341
|
this.kendoAnchorRef = s;
|
|
339
342
|
}
|
|
340
|
-
}, [F, (this.$props.allowReverse || this.$props.calendarSettings && this.$props.calendarSettings.allowReverse) && this.$props.swapButton ? G : V,
|
|
343
|
+
}, [F, (this.$props.allowReverse || this.$props.calendarSettings && this.$props.calendarSettings.allowReverse) && this.$props.swapButton ? G : V, L, U]);
|
|
341
344
|
},
|
|
342
345
|
methods: {
|
|
343
346
|
focus() {
|
|
@@ -359,7 +362,7 @@ const It = /* @__PURE__ */ X({
|
|
|
359
362
|
}));
|
|
360
363
|
},
|
|
361
364
|
calculateValue(t, e) {
|
|
362
|
-
return (t.value !== void 0 ? t.value : e.currentValue) ||
|
|
365
|
+
return (t.value !== void 0 ? t.value : e.currentValue) || u;
|
|
363
366
|
},
|
|
364
367
|
calculateShow(t, e) {
|
|
365
368
|
return t.show !== void 0 ? t.show : e.currentShow;
|
|
@@ -424,7 +427,7 @@ const It = /* @__PURE__ */ X({
|
|
|
424
427
|
},
|
|
425
428
|
extractRangeFromValue(t) {
|
|
426
429
|
if (!Array.isArray(t.value) && !(t.value instanceof Date))
|
|
427
|
-
return t.value ||
|
|
430
|
+
return t.value || u;
|
|
428
431
|
const e = Array.isArray(t.value) ? t.value[0] : t.value;
|
|
429
432
|
return {
|
|
430
433
|
start: this.computedValue.end !== null ? e : this.computedValue.start,
|
|
@@ -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"),H=require("@progress/kendo-vue-labels"),G=require("@progress/kendo-vue-buttons"),J=require("@progress/kendo-vue-popup"),r=require("@progress/kendo-date-math"),t=require("@progress/kendo-vue-common"),Q=require("../dateinput/DateInput.js"),W=require("../package-metadata.js"),u=require("../utils.js"),o=require("../messages/main.js"),T=require("@progress/kendo-vue-intl"),Y=require("./DateTimeSelector.js"),Z=require("../timepicker/utils.js"),$=require("../defaults.js"),ee=require("../dateinput/utils.js"),te=require("@progress/kendo-svg-icons");function m(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const ie=n.defineComponent({name:"KendoDateTimePicker",emits:{changemodel:null,"update:modelValue":null,iconclick:null,change:null,focus:null,blur:null,keydown:null,open:null,close:null},props:{modelValue:{type:Date,default:void 0},defaultShow:{type:Boolean,default:!1},defaultValue:{type:Date,default:null},disabled:{type:Boolean,default:!1},dateInput:{type:[String,Object,Function],default:function(){}},popup:{type:[String,Object,Function],default:function(){}},calendar:{type:[String,Object,Function],default:function(){}},focusedDate:Date,format:{type:[String,Object],default:function(){return"g"}},formatPlaceholder:{type:[String,Object],default:function(){return ee.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)}},id:String,ariaLabelledBy:String,ariaDescribedBy:String,min:{type:Date,default:function(){return u.MIN_DATE}},max:{type:Date,default:function(){return u.MAX_DATE}},maxTime:{type:Date,default:function(){return r.cloneDate(u.MAX_TIME)}},minTime:{type:Date,default:function(){return r.cloneDate($.MIN_TIME)}},name:String,label:String,placeholder:String,popupSettings:{type:Object,default:function(){return{}}},show:{type:Boolean,default:void 0},tabIndex:{type:Number,default:0},title:{type:String,default:function(){return""}},steps:{type:Object,default:function(){return{}}},value:Date,weekNumber:{type:Boolean,default:!1},width:String,validationMessage:String,required:{type:Boolean,default:!1},validityStyles:{type:Boolean,default:!0},validate:Boolean,valid:{type:Boolean,default:void 0},cancelButton:{type:Boolean,default:!0}},model:{event:"changemodel"},created(){this._anchor=t.guid(),this._popupId="popup"+t.guid(),this._wrapper=null,this._dateInput=null,this._dateTimeSelector=null,t.validatePackage(W.packageMetadata),this.currentValue=this.$props.defaultValue,this.currentShow=this.$props.defaultShow},inject:{kendoLocalizationService:{default:null}},data(){return{currentValue:null,currentShow:!1,valueDuringOnChange:void 0,showDuringOnChange:void 0,shouldFocusDateInput:!1,isFocused:!1}},computed:{computedValue(){const e=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.$props.value!==void 0?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.$data.currentValue;return e!==null?r.cloneDate(e):null},computedShow(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.$props.show!==void 0?this.$props.show:this.currentShow}},watch:{show:function(e,i){this._oldShow=i},currentShow:function(e,i){this._oldShow=i}},mounted(){this.computedShow&&this.$forceUpdate();const e=this.dateInputElement();this._dateTimeSelector=this.$refs.dateTimeSelector,this._wrapper=this.kendoAnchorRef,this._dateInput=this.dateInputRef,e&&e.setAttribute("aria-haspopup","true")},updated(){const e=this.dateInputElement();this._dateTimeSelector=this.$refs.dateTimeSelector,this._wrapper=this.kendoAnchorRef,this._dateTimeSelector&&this.computedShow&&!this._oldShow&&this._dateTimeSelector.focus({preventScroll:!0}),e&&!this.computedShow&&this.shouldFocusDateInput&&this._dateInput.focus({preventScroll:!0}),this.shouldFocusDateInput=!1},setup(){const e=n.ref(null),i=n.inject("kendoLocalizationService",{});return{kendoAnchorRef:e,kendoLocalizationService:i}},render(){const e=t.getDefaultSlots(this),{disabled:i,tabIndex:a,title:d,id:f,format:g,formatPlaceholder:b,min:k,max:V,weekNumber:_,focusedDate:M,width:S,name:B,steps:D,placeholder:C,validationMessage:q,required:F,validityStyles:O,cancelButton:R,minTime:w,maxTime:I,ariaLabelledBy:ne,ariaDescribedBy:ae,size:p,fillMode:y,rounded:c}=this.$props,{popupClass:x,appendTo:E,animate:N}=this.$props.popupSettings,v=!this.$props.validityStyles||this.validity().valid,j=this.$props.dateInput?t.templateRendering.call(this,this.$props.dateInput,t.getListeners.call(this)):void 0,P=n.createVNode(Q.DateInput,{ref:h=>{this.dateInputRef=h},placeholder:C,disabled:i,format:g,formatPlaceholder:b,id:f,max:V,min:k,minTime:w,maxTime:I,name:B,size:null,rounded:null,fillMode:null,onChange:this.handleValueChange,required:F,steps:D,tabIndex:this.computedShow?-1:a,title:d,valid:this.validity().valid,validationMessage:q,validityStyles:O,value:this.computedValue,ariaHasPopup:"dialog",ariaExpanded:this.computedShow,ariaRole:"combobox",ariaControls:this._popupId},m(e)?e:{default:()=>[e]}),A=t.getTemplate.call(this,{h:n.h,template:j,defaultRendering:P}),L=this.$props.calendar?t.templateRendering.call(this,this.$props.calendar,t.getListeners.call(this)):void 0,l=n.createVNode(Y.DateTimeSelector,{ref:"dateTimeSelector",cancelButton:R,value:this.computedValue,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:_,min:this.$props.min,max:this.$props.max,minTime:w,maxTime:I,focusedDate:M,format:g,calendar:L,steps:D,onFocus:this.timeSelectorFocus,onBlur:this.timeSelectorBlur,onKeydown:this.handleKeyDown},null),K=t.classNames("k-datetime-container k-reset",x),z=this.$props.popup?t.templateRendering.call(this,this.$props.popup,t.getListeners.call(this)):void 0,U=n.createVNode(J.Popup,{show:this.computedShow,anchor:this._anchor,popupClass:K,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},appendTo:E,animate:N},m(l)?l:{default:()=>[l]}),X=t.getTemplate.call(this,{h:n.h,template:z,defaultRendering:U,defaultSlots:l}),s=n.createVNode("div",{class:t.classNames("k-input","k-datetimepicker",{[`k-input-${t.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-input-${y}`]:y,[`k-rounded-${t.kendoThemeMaps.roundedMap[c]||c}`]:c,"k-invalid":!v,"k-required":this.required,"k-disabled":this.$props.disabled}),ref:h=>{this.kendoAnchorRef=h},onKeydown:this.handleKeyDown,style:{width:S},onFocusin:this.handleFocus,onFocusout:this.handleBlur},[A,n.createVNode(G.Button,{type:"button",tabIndex:-1,icon:"calendar",svgIcon:te.calendarIcon,onMousedown:this.handleIconMouseDown,onClick:this.handleDateIconClick,title:T.provideLocalizationService(this).toLanguageString(o.toggleDateTimeSelector,o.messages[o.toggleDateTimeSelector]),rounded:null,class:"k-input-button","aria-controls":this._popupId,"aria-label":T.provideLocalizationService(this).toLanguageString(o.toggleDateTimeSelector,o.messages[o.toggleDateTimeSelector])},null),X]);return this.$props.label?n.createVNode(H.FloatingLabel,{label:this.$props.label,editorId:f,editorValid:v,editorValue:this.getDateInputText(),editorPlaceholder:this.$props.placeholder,editorDisabled:this.$props.disabled,style:{width:S}},m(s)?s:{default:()=>[s]}):s},methods:{validity(){const e=u.isInDateRange(this.computedValue,this.$props.min,this.$props.max)&&Z.isInTimeRange(this.computedValue,this.$props.minTime||$.MIN_TIME,this.$props.maxTime||u.MAX_TIME),i=this.$props.validationMessage!==void 0,a=(!this.$props.required||this.computedValue!==null)&&e,d=this.$props.valid!==void 0?this.$props.valid:a;return{customError:i,rangeOverflow:this.computedValue&&this.$props.max.getTime()<this.computedValue.getTime()||!1,rangeUnderflow:this.computedValue&&this.computedValue.getTime()<this.$props.min.getTime()||!1,valid:d,valueMissing:this.computedValue===null}},getDateInputText(){return this.computedValue?!0:this._dateInput?this._dateInput._element.value:""},focus(){const e=this.dateInputElement();e&&e.focus()},setShow(e){this.computedShow!==e&&(this.currentShow=e,this.$emit(e?"open":"close",{component:this}))},handleReject(){this.setShow(!1)},handleValueChange(e){this.currentValue=r.cloneDate(e.value||void 0),this.valueDuringOnChange=e.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0,this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",{event:e.event,value:this.computedValue,show:this.computedShow,component:this,target:{name:this.$props.name,value:this.computedValue,valueAsDate:this.computedValue}}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},handleFocus(e){this.isFocused=!0,this.$emit("focus",e)},handleBlur(e){this.createBlurTimeout(),this.$emit("blur",e)},timeSelectorBlur(e){this.$emit("blur",e),clearTimeout(this._blurTimeout),this.createBlurTimeout()},timeSelectorFocus(){clearTimeout(this._blurTimeout)},createBlurTimeout(){this._blurTimeout=setTimeout(()=>{this.isFocused=!1;const e=document.activeElement&&document.activeElement.closest(`#${this._popupId}`);this._dateInput&&t.canUseDOM&&document.activeElement!==this._dateInput.element()&&!e&&this.setShow(!1)},200)},handleDateIconClick(e){this.$props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.computedShow),this.$emit("iconclick",e))},handleIconMouseDown(e){e.preventDefault()},handleKeyDown(e){const{altKey:i,keyCode:a}=e;if(a===t.Keys.tab&&this._dateInput&&e.target!==this._dateInput._element){e.preventDefault(),this.$data.shouldFocusDateInput=!0,this.setShow(!1);return}if(a===t.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(a===t.Keys.up||a===t.Keys.down)&&(e.preventDefault(),e.stopPropagation(),this.shouldFocusDateInput=a===t.Keys.up,this.setShow(a===t.Keys.down)),this.$emit("keydown",e)},dateInputElement(){return this._dateInput&&this._dateInput.$el||this._wrapper&&this._wrapper.querySelector(".k-dateinput-wrap > input.k-input")}}});exports.DateTimePicker=ie;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),G=require("@progress/kendo-vue-labels"),J=require("@progress/kendo-vue-buttons"),Q=require("@progress/kendo-vue-popup"),r=require("@progress/kendo-date-math"),t=require("@progress/kendo-vue-common"),W=require("../dateinput/DateInput.js"),Y=require("../package-metadata.js"),u=require("../utils.js"),o=require("../messages/main.js"),T=require("@progress/kendo-vue-intl"),Z=require("./DateTimeSelector.js"),ee=require("../timepicker/utils.js"),b=require("../defaults.js"),te=require("../dateinput/utils.js"),ie=require("@progress/kendo-svg-icons");function m(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const ne=n.defineComponent({name:"KendoDateTimePicker",emits:{changemodel:null,"update:modelValue":null,iconclick:null,change:null,focus:null,blur:null,keydown:null,open:null,close:null},props:{modelValue:{type:Date,default:void 0},defaultShow:{type:Boolean,default:!1},defaultValue:{type:Date,default:null},disabled:{type:Boolean,default:!1},dateInput:{type:[String,Object,Function],default:function(){}},popup:{type:[String,Object,Function],default:function(){}},calendar:{type:[String,Object,Function],default:function(){}},focusedDate:Date,format:{type:[String,Object],default:function(){return"g"}},formatPlaceholder:{type:[String,Object],default:function(){return te.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)}},id:String,ariaLabelledBy:String,ariaDescribedBy:String,min:{type:Date,default:function(){return u.MIN_DATE}},max:{type:Date,default:function(){return u.MAX_DATE}},maxTime:{type:Date,default:function(){return r.cloneDate(u.MAX_TIME)}},minTime:{type:Date,default:function(){return r.cloneDate(b.MIN_TIME)}},name:String,label:String,placeholder:String,popupSettings:{type:Object,default:function(){return{}}},show:{type:Boolean,default:void 0},tabIndex:{type:Number,default:0},title:{type:String,default:function(){return""}},steps:{type:Object,default:function(){return{}}},value:Date,weekNumber:{type:Boolean,default:!1},width:String,validationMessage:String,required:{type:Boolean,default:!1},validityStyles:{type:Boolean,default:!0},validate:Boolean,valid:{type:Boolean,default:void 0},cancelButton:{type:Boolean,default:!0},inputAttributes:Object},model:{event:"changemodel"},created(){this._anchor=t.guid(),this._popupId="popup"+t.guid(),this._wrapper=null,this._dateInput=null,this._dateTimeSelector=null,t.validatePackage(Y.packageMetadata),this.currentValue=this.$props.defaultValue,this.currentShow=this.$props.defaultShow},inject:{kendoLocalizationService:{default:null}},data(){return{currentValue:null,currentShow:!1,valueDuringOnChange:void 0,showDuringOnChange:void 0,shouldFocusDateInput:!1,isFocused:!1}},computed:{computedValue(){const e=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.$props.value!==void 0?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.$data.currentValue;return e!==null?r.cloneDate(e):null},computedShow(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.$props.show!==void 0?this.$props.show:this.currentShow}},watch:{show:function(e,i){this._oldShow=i},currentShow:function(e,i){this._oldShow=i}},mounted(){this.computedShow&&this.$forceUpdate();const e=this.dateInputElement();this._dateTimeSelector=this.$refs.dateTimeSelector,this._wrapper=this.kendoAnchorRef,this._dateInput=this.dateInputRef,e&&e.setAttribute("aria-haspopup","true")},updated(){const e=this.dateInputElement();this._dateTimeSelector=this.$refs.dateTimeSelector,this._wrapper=this.kendoAnchorRef,this._dateTimeSelector&&this.computedShow&&!this._oldShow&&this._dateTimeSelector.focus({preventScroll:!0}),e&&!this.computedShow&&this.shouldFocusDateInput&&this._dateInput.focus({preventScroll:!0}),this.shouldFocusDateInput=!1},setup(){const e=n.ref(null),i=n.inject("kendoLocalizationService",{});return{kendoAnchorRef:e,kendoLocalizationService:i}},render(){const e=t.getDefaultSlots(this),{disabled:i,tabIndex:a,title:d,id:f,format:g,formatPlaceholder:$,min:k,max:V,weekNumber:_,focusedDate:M,width:S,name:B,steps:D,placeholder:C,validationMessage:q,required:F,validityStyles:O,cancelButton:R,minTime:w,maxTime:I,ariaLabelledBy:ae,ariaDescribedBy:oe,size:p,fillMode:y,rounded:c,inputAttributes:x}=this.$props,{popupClass:E,appendTo:A,animate:j}=this.$props.popupSettings,v=!this.$props.validityStyles||this.validity().valid,N=this.$props.dateInput?t.templateRendering.call(this,this.$props.dateInput,t.getListeners.call(this)):void 0,P=n.createVNode(W.DateInput,{ref:h=>{this.dateInputRef=h},placeholder:C,disabled:i,format:g,formatPlaceholder:$,id:f,max:V,min:k,minTime:w,maxTime:I,name:B,size:null,rounded:null,fillMode:null,onChange:this.handleValueChange,required:F,steps:D,tabIndex:this.computedShow?-1:a,title:d,valid:this.validity().valid,validationMessage:q,validityStyles:O,value:this.computedValue,ariaHasPopup:"dialog",ariaExpanded:this.computedShow,ariaRole:"combobox",ariaControls:this._popupId,inputAttributes:x},m(e)?e:{default:()=>[e]}),L=t.getTemplate.call(this,{h:n.h,template:N,defaultRendering:P}),K=this.$props.calendar?t.templateRendering.call(this,this.$props.calendar,t.getListeners.call(this)):void 0,s=n.createVNode(Z.DateTimeSelector,{ref:"dateTimeSelector",cancelButton:R,value:this.computedValue,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:_,min:this.$props.min,max:this.$props.max,minTime:w,maxTime:I,focusedDate:M,format:g,calendar:K,steps:D,onFocus:this.timeSelectorFocus,onBlur:this.timeSelectorBlur,onKeydown:this.handleKeyDown},null),z=t.classNames("k-datetime-container k-reset",E),U=this.$props.popup?t.templateRendering.call(this,this.$props.popup,t.getListeners.call(this)):void 0,X=n.createVNode(Q.Popup,{show:this.computedShow,anchor:this._anchor,popupClass:z,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},appendTo:A,animate:j},m(s)?s:{default:()=>[s]}),H=t.getTemplate.call(this,{h:n.h,template:U,defaultRendering:X,defaultSlots:s}),l=n.createVNode("div",{class:t.classNames("k-input","k-datetimepicker",{[`k-input-${t.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-input-${y}`]:y,[`k-rounded-${t.kendoThemeMaps.roundedMap[c]||c}`]:c,"k-invalid":!v,"k-required":this.required,"k-disabled":this.$props.disabled}),ref:h=>{this.kendoAnchorRef=h},onKeydown:this.handleKeyDown,style:{width:S},onFocusin:this.handleFocus,onFocusout:this.handleBlur},[L,n.createVNode(J.Button,{type:"button",tabIndex:-1,icon:"calendar",svgIcon:ie.calendarIcon,onMousedown:this.handleIconMouseDown,onClick:this.handleDateIconClick,title:T.provideLocalizationService(this).toLanguageString(o.toggleDateTimeSelector,o.messages[o.toggleDateTimeSelector]),rounded:null,class:"k-input-button","aria-controls":this._popupId,"aria-label":T.provideLocalizationService(this).toLanguageString(o.toggleDateTimeSelector,o.messages[o.toggleDateTimeSelector])},null),H]);return this.$props.label?n.createVNode(G.FloatingLabel,{label:this.$props.label,editorId:f,editorValid:v,editorValue:this.getDateInputText(),editorPlaceholder:this.$props.placeholder,editorDisabled:this.$props.disabled,style:{width:S}},m(l)?l:{default:()=>[l]}):l},methods:{validity(){const e=u.isInDateRange(this.computedValue,this.$props.min,this.$props.max)&&ee.isInTimeRange(this.computedValue,this.$props.minTime||b.MIN_TIME,this.$props.maxTime||u.MAX_TIME),i=this.$props.validationMessage!==void 0,a=(!this.$props.required||this.computedValue!==null)&&e,d=this.$props.valid!==void 0?this.$props.valid:a;return{customError:i,rangeOverflow:this.computedValue&&this.$props.max.getTime()<this.computedValue.getTime()||!1,rangeUnderflow:this.computedValue&&this.computedValue.getTime()<this.$props.min.getTime()||!1,valid:d,valueMissing:this.computedValue===null}},getDateInputText(){return this.computedValue?!0:this._dateInput?this._dateInput._element.value:""},focus(){const e=this.dateInputElement();e&&e.focus()},setShow(e){this.computedShow!==e&&(this.currentShow=e,this.$emit(e?"open":"close",{component:this}))},handleReject(){this.setShow(!1)},handleValueChange(e){this.currentValue=r.cloneDate(e.value||void 0),this.valueDuringOnChange=e.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0,this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",{event:e.event,value:this.computedValue,show:this.computedShow,component:this,target:{name:this.$props.name,value:this.computedValue,valueAsDate:this.computedValue}}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},handleFocus(e){this.isFocused=!0,this.$emit("focus",e)},handleBlur(e){this.createBlurTimeout(),this.$emit("blur",e)},timeSelectorBlur(e){this.$emit("blur",e),clearTimeout(this._blurTimeout),this.createBlurTimeout()},timeSelectorFocus(){clearTimeout(this._blurTimeout)},createBlurTimeout(){this._blurTimeout=setTimeout(()=>{this.isFocused=!1;const e=document.activeElement&&document.activeElement.closest(`#${this._popupId}`);this._dateInput&&t.canUseDOM&&document.activeElement!==this._dateInput.element()&&!e&&this.setShow(!1)},200)},handleDateIconClick(e){this.$props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.computedShow),this.$emit("iconclick",e))},handleIconMouseDown(e){e.preventDefault()},handleKeyDown(e){const{altKey:i,keyCode:a}=e;if(a===t.Keys.tab&&this._dateInput&&e.target!==this._dateInput._element){e.preventDefault(),this.$data.shouldFocusDateInput=!0,this.setShow(!1);return}if(a===t.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(a===t.Keys.up||a===t.Keys.down)&&(e.preventDefault(),e.stopPropagation(),this.shouldFocusDateInput=a===t.Keys.up,this.setShow(a===t.Keys.down)),this.$emit("keydown",e)},dateInputElement(){return this._dateInput&&this._dateInput.$el||this._wrapper&&this._wrapper.querySelector(".k-dateinput-wrap > input.k-input")}}});exports.DateTimePicker=ne;
|