@progress/kendo-vue-dateinputs 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-vue-dateinputs.js +1 -1
- package/dist/es/calendar/components/CalendarCell.d.ts +1 -0
- package/dist/es/calendar/components/CalendarHeaderTitle.d.ts +1 -0
- package/dist/es/calendar/components/Header.d.ts +2 -0
- package/dist/es/calendar/components/View.d.ts +2 -0
- package/dist/es/calendar/components/ViewList.d.ts +2 -0
- package/dist/es/calendar/components/ViewList.js +1 -1
- package/dist/es/calendar/components/interfaces/CalendarComputed.d.ts +1 -0
- package/dist/es/calendar/components/interfaces/CalendarMethods.d.ts +1 -0
- package/dist/es/dateinput/DateInput.js +31 -25
- package/dist/es/dateinput/interfaces/DateInputComputed.d.ts +2 -1
- package/dist/es/dateinput/interfaces/DateInputData.d.ts +1 -0
- package/dist/es/dateinput/interfaces/DateInputMethods.d.ts +1 -0
- package/dist/es/datepicker/DatePicker.js +31 -5
- package/dist/es/datepicker/interfaces/DatePickerComputed.d.ts +1 -0
- package/dist/es/datepicker/interfaces/DatePickerMethods.d.ts +2 -0
- package/dist/es/datepicker/interfaces/DatePickerProps.d.ts +8 -0
- package/dist/es/datetimepicker/DateTimePicker.d.ts +5 -0
- package/dist/es/datetimepicker/DateTimePicker.js +49 -13
- package/dist/es/datetimepicker/DateTimeSelector.d.ts +2 -0
- package/dist/es/datetimepicker/models/DateTimePickerSettings.d.ts +13 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/timepicker/TimeList.d.ts +2 -0
- package/dist/es/timepicker/TimePart.d.ts +2 -0
- package/dist/es/timepicker/TimePicker.d.ts +5 -0
- package/dist/es/timepicker/TimePicker.js +47 -17
- package/dist/es/timepicker/TimeSelector.d.ts +2 -0
- package/dist/es/timepicker/models/TimePickerSettings.d.ts +14 -2
- package/dist/es/virtualization/Virtualization.d.ts +2 -0
- package/dist/npm/calendar/components/CalendarCell.d.ts +1 -0
- package/dist/npm/calendar/components/CalendarHeaderTitle.d.ts +1 -0
- package/dist/npm/calendar/components/Header.d.ts +2 -0
- package/dist/npm/calendar/components/View.d.ts +2 -0
- package/dist/npm/calendar/components/ViewList.d.ts +2 -0
- package/dist/npm/calendar/components/ViewList.js +1 -1
- package/dist/npm/calendar/components/interfaces/CalendarComputed.d.ts +1 -0
- package/dist/npm/calendar/components/interfaces/CalendarMethods.d.ts +1 -0
- package/dist/npm/dateinput/DateInput.js +31 -24
- package/dist/npm/dateinput/interfaces/DateInputComputed.d.ts +2 -1
- package/dist/npm/dateinput/interfaces/DateInputData.d.ts +1 -0
- package/dist/npm/dateinput/interfaces/DateInputMethods.d.ts +1 -0
- package/dist/npm/datepicker/DatePicker.js +32 -5
- package/dist/npm/datepicker/interfaces/DatePickerComputed.d.ts +1 -0
- package/dist/npm/datepicker/interfaces/DatePickerMethods.d.ts +2 -0
- package/dist/npm/datepicker/interfaces/DatePickerProps.d.ts +8 -0
- package/dist/npm/datetimepicker/DateTimePicker.d.ts +5 -0
- package/dist/npm/datetimepicker/DateTimePicker.js +50 -13
- package/dist/npm/datetimepicker/DateTimeSelector.d.ts +2 -0
- package/dist/npm/datetimepicker/models/DateTimePickerSettings.d.ts +13 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/timepicker/TimeList.d.ts +2 -0
- package/dist/npm/timepicker/TimePart.d.ts +2 -0
- package/dist/npm/timepicker/TimePicker.d.ts +5 -0
- package/dist/npm/timepicker/TimePicker.js +48 -17
- package/dist/npm/timepicker/TimeSelector.d.ts +2 -0
- package/dist/npm/timepicker/models/TimePickerSettings.d.ts +14 -2
- package/dist/npm/virtualization/Virtualization.d.ts +2 -0
- package/package.json +7 -6
|
@@ -33,6 +33,7 @@ export interface HeaderProps {
|
|
|
33
33
|
* @hidden
|
|
34
34
|
*/
|
|
35
35
|
export interface HeaderMethods {
|
|
36
|
+
[key: string]: any;
|
|
36
37
|
getTitle: () => string;
|
|
37
38
|
handleTitleClick: (event: any) => void;
|
|
38
39
|
handleTodayClick: (event: any) => void;
|
|
@@ -47,6 +48,7 @@ export interface HeaderMethods {
|
|
|
47
48
|
* @hidden
|
|
48
49
|
*/
|
|
49
50
|
export interface HeaderComputed {
|
|
51
|
+
[key: string]: any;
|
|
50
52
|
navigate?: () => void;
|
|
51
53
|
todayIsInRange?: () => boolean;
|
|
52
54
|
}
|
|
@@ -61,6 +61,7 @@ export interface ViewProps {
|
|
|
61
61
|
* @hidden
|
|
62
62
|
*/
|
|
63
63
|
export interface ViewComputed {
|
|
64
|
+
[key: string]: any;
|
|
64
65
|
isMonthView?: boolean;
|
|
65
66
|
weekNumber?: boolean;
|
|
66
67
|
isHorizontal?: boolean;
|
|
@@ -69,6 +70,7 @@ export interface ViewComputed {
|
|
|
69
70
|
* @hidden
|
|
70
71
|
*/
|
|
71
72
|
export interface ViewMethods {
|
|
73
|
+
[key: string]: any;
|
|
72
74
|
buildWeekNumber: (row: any, idx: number) => void;
|
|
73
75
|
buildRow: (row: any) => void;
|
|
74
76
|
firstDate: (row: any) => any;
|
|
@@ -69,6 +69,7 @@ export interface ViewListState {
|
|
|
69
69
|
* @hidden
|
|
70
70
|
*/
|
|
71
71
|
export interface ViewListComputed {
|
|
72
|
+
[key: string]: any;
|
|
72
73
|
weekNames?: string[];
|
|
73
74
|
weekNumber?: boolean;
|
|
74
75
|
animate?: boolean;
|
|
@@ -77,6 +78,7 @@ export interface ViewListComputed {
|
|
|
77
78
|
* @hidden
|
|
78
79
|
*/
|
|
79
80
|
export interface ViewListMethods {
|
|
81
|
+
[key: string]: any;
|
|
80
82
|
blurActiveDate: () => void;
|
|
81
83
|
focusActiveDate: (event: any) => void;
|
|
82
84
|
handleCellEnter: (event: any) => void;
|
|
@@ -227,7 +227,7 @@ var ViewList = {
|
|
|
227
227
|
render: function render(createElement) {
|
|
228
228
|
var h = gh || createElement;
|
|
229
229
|
var selectionRange = this.$props.allowReverse ? this.rotateSelectionRange(this.$props.selectionRange) : this.$props.selectionRange;
|
|
230
|
-
var rootClassNames = classNames('k-calendar-view', 'k-
|
|
230
|
+
var rootClassNames = classNames('k-calendar-view', 'k-hstack k-align-items-start k-justify-content-center', {
|
|
231
231
|
'k-calendar-monthview': this.$props.activeView === CalendarViewEnum.month,
|
|
232
232
|
'k-calendar-yearview': this.$props.activeView === CalendarViewEnum.year,
|
|
233
233
|
'k-calendar-decadeview': this.$props.activeView === CalendarViewEnum.decade,
|
|
@@ -23,11 +23,12 @@ import { provideIntlService, provideLocalizationService } from '@progress/kendo-
|
|
|
23
23
|
import { KendoDate } from './models';
|
|
24
24
|
import { guid, noop, validatePackage, canUseDOM } from '@progress/kendo-vue-common';
|
|
25
25
|
import { packageMetadata } from '../package-metadata';
|
|
26
|
-
import { approximateStringMatching, defaultFormat, defaultFormatPlaceholder, isInRange,
|
|
26
|
+
import { approximateStringMatching, defaultFormat, defaultFormatPlaceholder, isInRange, wrapperClasses } from './utils';
|
|
27
27
|
import { MAX_DATE, MIN_DATE } from './../utils';
|
|
28
28
|
import { messages, increaseValue, decreaseValue } from './../messages';
|
|
29
29
|
import { isInTimeRange } from '../timepicker/utils';
|
|
30
30
|
import { MIN_TIME, MAX_TIME } from '../defaults';
|
|
31
|
+
import { FloatingLabel } from '@progress/kendo-vue-labels';
|
|
31
32
|
var VALIDATION_MESSAGE = 'Please enter a valid value!';
|
|
32
33
|
var DateInput = {
|
|
33
34
|
name: 'DateInput',
|
|
@@ -130,9 +131,9 @@ var DateInput = {
|
|
|
130
131
|
currentFormat: undefined,
|
|
131
132
|
valueDuringOnChange: undefined,
|
|
132
133
|
hasMounted: false,
|
|
133
|
-
focused: false,
|
|
134
134
|
isEmpty: undefined,
|
|
135
|
-
lastSelectedSymbol: undefined
|
|
135
|
+
lastSelectedSymbol: undefined,
|
|
136
|
+
isFocused: false
|
|
136
137
|
};
|
|
137
138
|
},
|
|
138
139
|
created: function created() {
|
|
@@ -159,14 +160,15 @@ var DateInput = {
|
|
|
159
160
|
return this.kendoDate && this.kendoDate.getDateObject();
|
|
160
161
|
}
|
|
161
162
|
},
|
|
162
|
-
|
|
163
|
+
wrapperClassNames: {
|
|
163
164
|
get: function get() {
|
|
164
165
|
var isValid = !this.$data.hasMounted || !this.$props.validityStyles || this.validity().valid;
|
|
166
|
+
var disabled = this.$props.disabled;
|
|
165
167
|
return {
|
|
166
|
-
'k-
|
|
167
|
-
'k-state-
|
|
168
|
-
'k-state-empty': this.$data.isEmpty && this.$props.placeholder === '',
|
|
168
|
+
'k-dateinput-wrap': true,
|
|
169
|
+
'k-state-disabled': disabled,
|
|
169
170
|
'k-state-invalid': !isValid && isValid !== undefined,
|
|
171
|
+
'k-state-focused': this.isFocused,
|
|
170
172
|
'k-rtl': this.$props.dir === 'rtl'
|
|
171
173
|
};
|
|
172
174
|
}
|
|
@@ -198,11 +200,11 @@ var DateInput = {
|
|
|
198
200
|
}
|
|
199
201
|
},
|
|
200
202
|
handleFocus: function handleFocus(e) {
|
|
201
|
-
this.$data.
|
|
203
|
+
this.$data.isFocused = true;
|
|
202
204
|
this.$emit('focus', e);
|
|
203
205
|
},
|
|
204
206
|
handleBlur: function handleBlur(e) {
|
|
205
|
-
this.$data.
|
|
207
|
+
this.$data.isFocused = false;
|
|
206
208
|
this.$emit('blur', e);
|
|
207
209
|
},
|
|
208
210
|
intl: function intl() {
|
|
@@ -542,7 +544,7 @@ var DateInput = {
|
|
|
542
544
|
|
|
543
545
|
this.$data.currentFormat = currentFormat;
|
|
544
546
|
this.$data.isEmpty = currentText === this._emptyText;
|
|
545
|
-
var showPlaceHolder = this.$props.placeholder !== undefined && this.$data.isEmpty && !this.$data.
|
|
547
|
+
var showPlaceHolder = this.$props.placeholder !== undefined && this.$data.isEmpty && !this.$data.isFocused;
|
|
546
548
|
var textToDisplay = !showPlaceHolder ? currentText : null;
|
|
547
549
|
var inputId = id || this._inputId;
|
|
548
550
|
var isValid = !this.$props.validityStyles || this.validity().valid;
|
|
@@ -558,9 +560,9 @@ var DateInput = {
|
|
|
558
560
|
attrs: this.v3 ? undefined : {
|
|
559
561
|
dir: this.$props.dir
|
|
560
562
|
},
|
|
561
|
-
"class":
|
|
563
|
+
"class": wrapperClassesInstance.join(' ')
|
|
562
564
|
}, [h("span", {
|
|
563
|
-
"class":
|
|
565
|
+
"class": this.wrapperClassNames
|
|
564
566
|
}, [h("input", {
|
|
565
567
|
role: "spinbutton",
|
|
566
568
|
attrs: this.v3 ? undefined : {
|
|
@@ -653,21 +655,25 @@ var DateInput = {
|
|
|
653
655
|
}, [h("span", {
|
|
654
656
|
"class": "k-icon k-i-arrow-s"
|
|
655
657
|
})])])])]);
|
|
656
|
-
return label ?
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
attrs: this.v3 ? undefined : {
|
|
660
|
-
dir: this.$props.dir
|
|
661
|
-
}
|
|
662
|
-
}, [dateinput, this.$props.label ? inputId ? h("label", {
|
|
663
|
-
"for": inputId,
|
|
658
|
+
return label ? // @ts-ignore function children
|
|
659
|
+
h(FloatingLabel, {
|
|
660
|
+
label: label,
|
|
664
661
|
attrs: this.v3 ? undefined : {
|
|
665
|
-
|
|
662
|
+
label: label,
|
|
663
|
+
editorId: inputId,
|
|
664
|
+
editorValue: textToDisplay,
|
|
665
|
+
editorPlaceholder: this.$props.placeholder,
|
|
666
|
+
editorValid: isValid,
|
|
667
|
+
editorDisabled: this.$props.disabled
|
|
666
668
|
},
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
669
|
+
editorId: inputId,
|
|
670
|
+
editorValue: textToDisplay,
|
|
671
|
+
editorPlaceholder: this.$props.placeholder,
|
|
672
|
+
editorValid: isValid,
|
|
673
|
+
editorDisabled: this.$props.disabled
|
|
674
|
+
}, this.v3 ? function () {
|
|
675
|
+
return [dateinput];
|
|
676
|
+
} : [dateinput]) : dateinput;
|
|
671
677
|
}
|
|
672
678
|
};
|
|
673
679
|
var DateInputVue3 = DateInput;
|
|
@@ -15,7 +15,8 @@ import { isInDateRange } from '../utils';
|
|
|
15
15
|
import { messages, toggleCalendar } from '../messages';
|
|
16
16
|
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
17
17
|
import { ToggleButton } from './ToggleButton';
|
|
18
|
-
import { PickerWrap } from '../common/PickerWrap';
|
|
18
|
+
import { PickerWrap } from '../common/PickerWrap';
|
|
19
|
+
import { FloatingLabel } from '@progress/kendo-vue-labels'; // tslint:enable:max-line-length
|
|
19
20
|
|
|
20
21
|
var DatePicker = {
|
|
21
22
|
name: 'DatePicker',
|
|
@@ -32,6 +33,7 @@ var DatePicker = {
|
|
|
32
33
|
'change': null,
|
|
33
34
|
'changemodel': null,
|
|
34
35
|
'update:modelValue': null,
|
|
36
|
+
'iconclick': null,
|
|
35
37
|
'focus': null,
|
|
36
38
|
'blur': null
|
|
37
39
|
},
|
|
@@ -70,6 +72,7 @@ var DatePicker = {
|
|
|
70
72
|
return undefined;
|
|
71
73
|
}
|
|
72
74
|
},
|
|
75
|
+
label: String,
|
|
73
76
|
placeholder: String,
|
|
74
77
|
popup: {
|
|
75
78
|
type: [String, Object, Function],
|
|
@@ -231,7 +234,6 @@ var DatePicker = {
|
|
|
231
234
|
get: function get() {
|
|
232
235
|
var disabled = this.$props.disabled;
|
|
233
236
|
return {
|
|
234
|
-
'k-state-default': !disabled,
|
|
235
237
|
'k-state-disabled': disabled,
|
|
236
238
|
'k-state-focused': this.$data.isFocused
|
|
237
239
|
};
|
|
@@ -316,6 +318,9 @@ var DatePicker = {
|
|
|
316
318
|
var value = this.mergeTime(event.value);
|
|
317
319
|
this.handleValueChange(value, event);
|
|
318
320
|
},
|
|
321
|
+
getDateInputText: function getDateInputText() {
|
|
322
|
+
return this._dateInput ? this._dateInput._element.value : '';
|
|
323
|
+
},
|
|
319
324
|
handleValueChange: function handleValueChange(value, event) {
|
|
320
325
|
this.$data.currentValue = cloneDate(value || undefined);
|
|
321
326
|
this.$data.currentShow = false;
|
|
@@ -349,6 +354,7 @@ var DatePicker = {
|
|
|
349
354
|
|
|
350
355
|
this.$data.shouldFocusDateInput = true;
|
|
351
356
|
this.setShow(!this.computedShow);
|
|
357
|
+
this.$emit('iconclick', event);
|
|
352
358
|
},
|
|
353
359
|
handleIconMouseDown: function handleIconMouseDown(event) {
|
|
354
360
|
event.stopPropagation();
|
|
@@ -467,7 +473,6 @@ var DatePicker = {
|
|
|
467
473
|
placeholder: this.$props.placeholder,
|
|
468
474
|
attrs: this.v3 ? undefined : {
|
|
469
475
|
placeholder: this.$props.placeholder,
|
|
470
|
-
label: this.$props.label,
|
|
471
476
|
disabled: disabled,
|
|
472
477
|
format: format,
|
|
473
478
|
formatPlaceholder: formatPlaceholder,
|
|
@@ -483,7 +488,6 @@ var DatePicker = {
|
|
|
483
488
|
validityStyles: validityStyles,
|
|
484
489
|
value: value
|
|
485
490
|
},
|
|
486
|
-
label: this.$props.label,
|
|
487
491
|
disabled: disabled,
|
|
488
492
|
format: format,
|
|
489
493
|
formatPlaceholder: formatPlaceholder,
|
|
@@ -601,7 +605,7 @@ var DatePicker = {
|
|
|
601
605
|
defaultRendering: popupDefaultRendering,
|
|
602
606
|
defaultSlots: calendarRendering
|
|
603
607
|
});
|
|
604
|
-
|
|
608
|
+
var datepicker = h("span", {
|
|
605
609
|
ref: this.v3 ? function (el) {
|
|
606
610
|
_this.kendoAnchorRef = el;
|
|
607
611
|
} : this._anchor,
|
|
@@ -621,6 +625,28 @@ var DatePicker = {
|
|
|
621
625
|
onFocusin: this.handleFocus,
|
|
622
626
|
onFocusout: this.handleBlur
|
|
623
627
|
}, [pickerWrapRendering, popupRendering]);
|
|
628
|
+
return this.$props.label ? // @ts-ignore function children
|
|
629
|
+
h(FloatingLabel, {
|
|
630
|
+
label: this.$props.label,
|
|
631
|
+
attrs: this.v3 ? undefined : {
|
|
632
|
+
label: this.$props.label,
|
|
633
|
+
editorId: id,
|
|
634
|
+
editorValid: isValid,
|
|
635
|
+
editorValue: this.getDateInputText(),
|
|
636
|
+
editorPlaceholder: this.$props.placeholder,
|
|
637
|
+
editorDisabled: this.$props.disabled
|
|
638
|
+
},
|
|
639
|
+
editorId: id,
|
|
640
|
+
editorValid: isValid,
|
|
641
|
+
editorValue: this.getDateInputText(),
|
|
642
|
+
editorPlaceholder: this.$props.placeholder,
|
|
643
|
+
editorDisabled: this.$props.disabled,
|
|
644
|
+
style: {
|
|
645
|
+
width: width
|
|
646
|
+
}
|
|
647
|
+
}, this.v3 ? function () {
|
|
648
|
+
return [datepicker];
|
|
649
|
+
} : [datepicker]) : datepicker;
|
|
624
650
|
}
|
|
625
651
|
};
|
|
626
652
|
var DatePickerVue3 = DatePicker;
|
|
@@ -5,6 +5,7 @@ import { DatePickerState } from './DatePickerState';
|
|
|
5
5
|
* @hidden
|
|
6
6
|
*/
|
|
7
7
|
export interface DatePickerMethods {
|
|
8
|
+
[key: string]: any;
|
|
8
9
|
emitBlur?: (_: any) => void;
|
|
9
10
|
validity: () => FormComponentValidity;
|
|
10
11
|
nextValue: (nextProps: DatePickerProps, nextState: DatePickerState) => any;
|
|
@@ -18,6 +19,7 @@ export interface DatePickerMethods {
|
|
|
18
19
|
handleBlur: (event: any) => void;
|
|
19
20
|
calendarFocus: (event: any) => void;
|
|
20
21
|
calendarBlur: (event: any) => void;
|
|
22
|
+
getDateInputText: () => string;
|
|
21
23
|
createBlurTimeout: () => void;
|
|
22
24
|
handleIconClick: () => void;
|
|
23
25
|
handleIconMouseDown: (event: any) => void;
|
|
@@ -17,6 +17,14 @@ export interface DatePickerProps extends DatePickerSettings, FormComponentProps
|
|
|
17
17
|
* Fires each time the user selects a new value ([see example]({% slug controlled_datepicker_native %}#toc-controlling-the-date-value)).
|
|
18
18
|
*/
|
|
19
19
|
change?: (event: DatePickerChangeEvent) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Fires when the icon element is clicked.
|
|
22
|
+
*/
|
|
23
|
+
iconclick?: (event: any) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Renders a floating label for the DatePicker.
|
|
26
|
+
*/
|
|
27
|
+
label?: string;
|
|
20
28
|
/**
|
|
21
29
|
* Specifies the value of the placeholder.
|
|
22
30
|
*/
|
|
@@ -51,6 +51,7 @@ export interface DateTimePickerData {
|
|
|
51
51
|
valueDuringOnChange?: Date | null;
|
|
52
52
|
showDuringOnChange?: boolean;
|
|
53
53
|
shouldFocusDateInput: boolean;
|
|
54
|
+
isFocused: boolean;
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* @hidden
|
|
@@ -59,6 +60,7 @@ export interface DateTimePickerState {
|
|
|
59
60
|
_popupId: string;
|
|
60
61
|
_wrapper: any;
|
|
61
62
|
_dateInput: any;
|
|
63
|
+
dateInputRef: any;
|
|
62
64
|
_dateTimeSelector: any;
|
|
63
65
|
_anchor: any;
|
|
64
66
|
_oldShow: boolean;
|
|
@@ -70,6 +72,7 @@ export interface DateTimePickerState {
|
|
|
70
72
|
* @hidden
|
|
71
73
|
*/
|
|
72
74
|
export interface DateTimePickerComputed {
|
|
75
|
+
[key: string]: any;
|
|
73
76
|
computedValue: Date | null;
|
|
74
77
|
computedShow: boolean;
|
|
75
78
|
}
|
|
@@ -77,6 +80,7 @@ export interface DateTimePickerComputed {
|
|
|
77
80
|
* @hidden
|
|
78
81
|
*/
|
|
79
82
|
export interface DateTimePickerMethods {
|
|
83
|
+
[key: string]: any;
|
|
80
84
|
validity: () => FormComponentValidity;
|
|
81
85
|
focus: () => void;
|
|
82
86
|
setShow: (show: boolean) => void;
|
|
@@ -91,6 +95,7 @@ export interface DateTimePickerMethods {
|
|
|
91
95
|
timeSelectorBlur: (event: any) => void;
|
|
92
96
|
timeSelectorFocus: () => void;
|
|
93
97
|
createBlurTimeout: () => void;
|
|
98
|
+
getDateInputText: () => string;
|
|
94
99
|
}
|
|
95
100
|
/**
|
|
96
101
|
* @hidden
|
|
@@ -4,6 +4,7 @@ var allVue = Vue;
|
|
|
4
4
|
var gh = allVue.h;
|
|
5
5
|
var ref = allVue.ref;
|
|
6
6
|
var inject = allVue.inject;
|
|
7
|
+
import { FloatingLabel } from '@progress/kendo-vue-labels';
|
|
7
8
|
import { Popup } from '@progress/kendo-vue-popup';
|
|
8
9
|
import { cloneDate } from '@progress/kendo-date-math';
|
|
9
10
|
import { classNames, guid, Keys, templateRendering, getListeners, getTemplate, validatePackage, canUseDOM } from '@progress/kendo-vue-common';
|
|
@@ -19,6 +20,15 @@ import { defaultFormatPlaceholder } from '../dateinput/utils'; // tslint:enable:
|
|
|
19
20
|
|
|
20
21
|
var DateTimePicker = {
|
|
21
22
|
name: 'KendoDateTimePicker',
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
emits: {
|
|
25
|
+
'changemodel': null,
|
|
26
|
+
'update:modelValue': null,
|
|
27
|
+
'iconclick': null,
|
|
28
|
+
'change': null,
|
|
29
|
+
'focus': null,
|
|
30
|
+
'blur': null
|
|
31
|
+
},
|
|
22
32
|
props: {
|
|
23
33
|
modelValue: {
|
|
24
34
|
type: Date,
|
|
@@ -95,6 +105,7 @@ var DateTimePicker = {
|
|
|
95
105
|
}
|
|
96
106
|
},
|
|
97
107
|
name: String,
|
|
108
|
+
label: String,
|
|
98
109
|
placeholder: String,
|
|
99
110
|
popupSettings: {
|
|
100
111
|
type: Object,
|
|
@@ -171,7 +182,8 @@ var DateTimePicker = {
|
|
|
171
182
|
currentShow: false,
|
|
172
183
|
valueDuringOnChange: undefined,
|
|
173
184
|
showDuringOnChange: undefined,
|
|
174
|
-
shouldFocusDateInput: false
|
|
185
|
+
shouldFocusDateInput: false,
|
|
186
|
+
isFocused: false
|
|
175
187
|
};
|
|
176
188
|
},
|
|
177
189
|
computed: {
|
|
@@ -200,6 +212,7 @@ var DateTimePicker = {
|
|
|
200
212
|
var dateInputElement = this.dateInputElement();
|
|
201
213
|
this._dateTimeSelector = this.$refs.dateTimeSelector;
|
|
202
214
|
this._wrapper = this.$refs[this._anchor];
|
|
215
|
+
this._dateInput = this.v3 ? this.dateInputRef : this.$refs.dateInput;
|
|
203
216
|
|
|
204
217
|
if (dateInputElement) {
|
|
205
218
|
dateInputElement.setAttribute('aria-haspopup', 'true');
|
|
@@ -277,13 +290,15 @@ var DateTimePicker = {
|
|
|
277
290
|
'k-state-invalid': !isValid
|
|
278
291
|
});
|
|
279
292
|
var wrapperClassNames = classNames('k-picker-wrap', {
|
|
280
|
-
'k-state-
|
|
281
|
-
'k-state-
|
|
293
|
+
'k-state-disabled': disabled,
|
|
294
|
+
'k-state-focused': this.isFocused
|
|
282
295
|
});
|
|
283
296
|
var dateInput = this.$props.dateInput ? templateRendering.call(this, this.$props.dateInput, getListeners.call(this)) : undefined;
|
|
284
297
|
var dateInputDefaultRendering = // @ts-ignore function children
|
|
285
298
|
h(DateInput, {
|
|
286
|
-
ref:
|
|
299
|
+
ref: this.v3 ? function (el) {
|
|
300
|
+
_this.dateInputRef = el;
|
|
301
|
+
} : 'dateInput',
|
|
287
302
|
placeholder: placeholder,
|
|
288
303
|
attrs: this.v3 ? undefined : {
|
|
289
304
|
placeholder: placeholder,
|
|
@@ -419,7 +434,7 @@ var DateTimePicker = {
|
|
|
419
434
|
defaultRendering: popupDefaultRendering,
|
|
420
435
|
defaultSlots: dataTimeSelector
|
|
421
436
|
});
|
|
422
|
-
|
|
437
|
+
var dateTimePicker = h("div", {
|
|
423
438
|
"class": rootClassName,
|
|
424
439
|
onKeydown: this.handleKeyDown,
|
|
425
440
|
on: this.v3 ? undefined : {
|
|
@@ -460,6 +475,28 @@ var DateTimePicker = {
|
|
|
460
475
|
}, [h("span", {
|
|
461
476
|
"class": "k-icon k-i-calendar"
|
|
462
477
|
})])])]), popupRendering]);
|
|
478
|
+
return this.$props.label ? // @ts-ignore function children
|
|
479
|
+
h(FloatingLabel, {
|
|
480
|
+
label: this.$props.label,
|
|
481
|
+
attrs: this.v3 ? undefined : {
|
|
482
|
+
label: this.$props.label,
|
|
483
|
+
editorId: id,
|
|
484
|
+
editorValid: isValid,
|
|
485
|
+
editorValue: this.getDateInputText(),
|
|
486
|
+
editorPlaceholder: this.$props.placeholder,
|
|
487
|
+
editorDisabled: this.$props.disabled
|
|
488
|
+
},
|
|
489
|
+
editorId: id,
|
|
490
|
+
editorValid: isValid,
|
|
491
|
+
editorValue: this.getDateInputText(),
|
|
492
|
+
editorPlaceholder: this.$props.placeholder,
|
|
493
|
+
editorDisabled: this.$props.disabled,
|
|
494
|
+
style: {
|
|
495
|
+
width: width
|
|
496
|
+
}
|
|
497
|
+
}, this.v3 ? function () {
|
|
498
|
+
return [dateTimePicker];
|
|
499
|
+
} : [dateTimePicker]) : dateTimePicker;
|
|
463
500
|
},
|
|
464
501
|
methods: {
|
|
465
502
|
validity: function validity() {
|
|
@@ -475,6 +512,9 @@ var DateTimePicker = {
|
|
|
475
512
|
valueMissing: this.computedValue === null
|
|
476
513
|
};
|
|
477
514
|
},
|
|
515
|
+
getDateInputText: function getDateInputText() {
|
|
516
|
+
return this._dateInput ? this._dateInput._element.value : '';
|
|
517
|
+
},
|
|
478
518
|
focus: function focus() {
|
|
479
519
|
var dateInputElement = this.dateInputElement();
|
|
480
520
|
|
|
@@ -515,10 +555,7 @@ var DateTimePicker = {
|
|
|
515
555
|
this.showDuringOnChange = undefined;
|
|
516
556
|
},
|
|
517
557
|
handleFocus: function handleFocus(event) {
|
|
518
|
-
|
|
519
|
-
this._wrapper.classList.add('k-state-focused');
|
|
520
|
-
}
|
|
521
|
-
|
|
558
|
+
this.isFocused = true;
|
|
522
559
|
this.$emit('focus', event);
|
|
523
560
|
},
|
|
524
561
|
handleBlur: function handleBlur(event) {
|
|
@@ -537,22 +574,21 @@ var DateTimePicker = {
|
|
|
537
574
|
var _this = this;
|
|
538
575
|
|
|
539
576
|
this._blurTimeout = setTimeout(function () {
|
|
540
|
-
|
|
541
|
-
_this._wrapper.classList.remove('k-state-focused');
|
|
542
|
-
}
|
|
577
|
+
_this.isFocused = false;
|
|
543
578
|
|
|
544
579
|
if (_this._dateInput && canUseDOM && document.activeElement !== _this._dateInput.element() && document.activeElement && document.activeElement.className.indexOf('k-time-list') === -1) {
|
|
545
580
|
_this.setShow(false);
|
|
546
581
|
}
|
|
547
582
|
}, 200);
|
|
548
583
|
},
|
|
549
|
-
handleDateIconClick: function handleDateIconClick() {
|
|
584
|
+
handleDateIconClick: function handleDateIconClick(event) {
|
|
550
585
|
if (this.$props.disabled) {
|
|
551
586
|
return;
|
|
552
587
|
}
|
|
553
588
|
|
|
554
589
|
this.shouldFocusDateInput = true;
|
|
555
590
|
this.setShow(!this.computedShow);
|
|
591
|
+
this.$emit('iconclick', event);
|
|
556
592
|
},
|
|
557
593
|
handleIconMouseDown: function handleIconMouseDown(event) {
|
|
558
594
|
event.preventDefault();
|
|
@@ -63,6 +63,7 @@ export interface DateTimeSelectorState {
|
|
|
63
63
|
* @hidden
|
|
64
64
|
*/
|
|
65
65
|
export interface DateTimeSelectorComputed {
|
|
66
|
+
[key: string]: any;
|
|
66
67
|
hasDateValue: boolean;
|
|
67
68
|
computedMinTime: Date | null;
|
|
68
69
|
computedMaxTime: Date | null;
|
|
@@ -71,6 +72,7 @@ export interface DateTimeSelectorComputed {
|
|
|
71
72
|
* @hidden
|
|
72
73
|
*/
|
|
73
74
|
export interface DateTimeSelectorMethods {
|
|
75
|
+
[key: string]: any;
|
|
74
76
|
focus: (args?: any) => void;
|
|
75
77
|
calendarElement: () => any;
|
|
76
78
|
normalizeRange: (candidate: Date, value: Date | null) => Date | null;
|
|
@@ -74,6 +74,10 @@ export interface DateTimePickerSettings {
|
|
|
74
74
|
* Specifies the `name` property of the `input` DOM element.
|
|
75
75
|
*/
|
|
76
76
|
name?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Renders a floating label for the DateTimePicker.
|
|
79
|
+
*/
|
|
80
|
+
label?: string;
|
|
77
81
|
/**
|
|
78
82
|
* Specifies the value of the placeholder.
|
|
79
83
|
*/
|
|
@@ -96,6 +100,10 @@ export interface DateTimePickerSettings {
|
|
|
96
100
|
* Fires each time the user focuses any of the DateTimePicker elements.
|
|
97
101
|
*/
|
|
98
102
|
focus?: (event: any) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Fires when the icon element is clicked.
|
|
105
|
+
*/
|
|
106
|
+
iconclick?: (event: any) => void;
|
|
99
107
|
/**
|
|
100
108
|
* Specifies if the popup will be displayed
|
|
101
109
|
* ([see example]({% slug controlled_datetimepicker %}#toc-controlling-the-popup-state)).
|
|
@@ -132,4 +140,9 @@ export interface DateTimePickerSettings {
|
|
|
132
140
|
* Specifies the validate of the DateTimePicker.
|
|
133
141
|
*/
|
|
134
142
|
validate?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Controls the form error message of the component. If set to an empty string, no error will be thrown.
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
validationMessage?: string;
|
|
135
148
|
}
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-vue-dateinputs',
|
|
6
6
|
productName: 'Kendo UI for Vue',
|
|
7
7
|
productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1633591049,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
|
|
11
11
|
};
|
|
@@ -46,6 +46,7 @@ export interface TimeListState {
|
|
|
46
46
|
* @hidden
|
|
47
47
|
*/
|
|
48
48
|
export interface TimeListComputed {
|
|
49
|
+
[key: string]: any;
|
|
49
50
|
animate: boolean;
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
@@ -58,6 +59,7 @@ export interface TimeListData {
|
|
|
58
59
|
* @hidden
|
|
59
60
|
*/
|
|
60
61
|
export interface TimeListMethods {
|
|
62
|
+
[key: string]: any;
|
|
61
63
|
focus: (args?: any) => void;
|
|
62
64
|
itemOffset: (scrollTop: number) => number;
|
|
63
65
|
calculateHeights: () => void;
|
|
@@ -58,6 +58,7 @@ export interface TimePartData {
|
|
|
58
58
|
* @hidden
|
|
59
59
|
*/
|
|
60
60
|
export interface TimePartComputed {
|
|
61
|
+
[key: string]: any;
|
|
61
62
|
element: HTMLSpanElement | null;
|
|
62
63
|
computedValue: Date;
|
|
63
64
|
intl: IntlService;
|
|
@@ -68,6 +69,7 @@ export interface TimePartComputed {
|
|
|
68
69
|
* @hidden
|
|
69
70
|
*/
|
|
70
71
|
export interface TimePartMethods {
|
|
72
|
+
[key: string]: any;
|
|
71
73
|
focus: (args?: any) => void;
|
|
72
74
|
timeFormatReducer: (acc: string, current: DateFormatPart) => any;
|
|
73
75
|
timeFormatFilter: (part: DateFormatPart, index: number, all: DateFormatPart[]) => boolean;
|