@progress/kendo-vue-dateinputs 2.6.3 → 2.6.4
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/Calendar.js +1 -1
- package/dist/es/daterangepicker/DateRangePicker.d.ts +3 -2
- package/dist/es/daterangepicker/DateRangePicker.js +274 -182
- package/dist/es/main.d.ts +3 -1
- package/dist/es/main.js +2 -20
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/calendar/components/Calendar.js +1 -1
- package/dist/npm/daterangepicker/DateRangePicker.d.ts +3 -2
- package/dist/npm/daterangepicker/DateRangePicker.js +272 -178
- package/dist/npm/main.d.ts +3 -1
- package/dist/npm/main.js +3 -12
- package/dist/npm/package-metadata.js +1 -1
- package/package.json +7 -7
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var __assign = undefined && undefined.__assign || function () {
|
|
4
|
-
__assign = Object.assign || function (t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
|
|
8
|
-
for (var p in s) {
|
|
9
|
-
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return t;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return __assign.apply(this, arguments);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
3
|
Object.defineProperty(exports, "__esModule", {
|
|
20
4
|
value: true
|
|
21
5
|
});
|
|
@@ -42,6 +26,8 @@ var package_metadata_1 = require("../package-metadata");
|
|
|
42
26
|
|
|
43
27
|
var DateInput_1 = require("../dateinput/DateInput");
|
|
44
28
|
|
|
29
|
+
var Calendar_1 = require("../calendar/components/Calendar");
|
|
30
|
+
|
|
45
31
|
var models_1 = require("../calendar/models");
|
|
46
32
|
|
|
47
33
|
var defaults_1 = require("../defaults");
|
|
@@ -80,6 +66,8 @@ var DateRangePicker = {
|
|
|
80
66
|
type: Boolean,
|
|
81
67
|
default: false
|
|
82
68
|
},
|
|
69
|
+
startDateInput: [String, Object, Function],
|
|
70
|
+
endDateInput: [String, Object, Function],
|
|
83
71
|
endDateInputSettings: Object,
|
|
84
72
|
focusedDate: Date,
|
|
85
73
|
format: {
|
|
@@ -113,21 +101,38 @@ var DateRangePicker = {
|
|
|
113
101
|
ariaDescribedBy: String,
|
|
114
102
|
max: {
|
|
115
103
|
type: Date,
|
|
116
|
-
default:
|
|
104
|
+
default: function _default() {
|
|
105
|
+
return defaults_1.MAX_DATE;
|
|
106
|
+
}
|
|
117
107
|
},
|
|
118
108
|
min: {
|
|
119
109
|
type: Date,
|
|
120
|
-
default:
|
|
110
|
+
default: function _default() {
|
|
111
|
+
return defaults_1.MIN_DATE;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
popupSettings: {
|
|
115
|
+
type: Object,
|
|
116
|
+
default: function _default() {
|
|
117
|
+
return {};
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
show: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: undefined
|
|
121
123
|
},
|
|
122
|
-
popupSettings: Object,
|
|
123
|
-
show: Boolean,
|
|
124
124
|
startDateInputSettings: Object,
|
|
125
125
|
swapButton: {
|
|
126
126
|
type: Boolean,
|
|
127
127
|
default: false
|
|
128
128
|
},
|
|
129
129
|
tabIndex: Number,
|
|
130
|
-
value:
|
|
130
|
+
value: {
|
|
131
|
+
type: Object,
|
|
132
|
+
default: function _default() {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
} // PropTypes.shape({ start: Date, end: Date })
|
|
131
136
|
|
|
132
137
|
},
|
|
133
138
|
created: function created() {
|
|
@@ -135,30 +140,36 @@ var DateRangePicker = {
|
|
|
135
140
|
this._wrapper = null;
|
|
136
141
|
this._calendar = null;
|
|
137
142
|
this._startDateInput = null;
|
|
138
|
-
this._endDateInput = null; // this.valueDuringOnChange
|
|
143
|
+
this._endDateInput = null; // this.valueDuringOnChange = undefined;
|
|
139
144
|
// this.showDuringOnChange?: boolean;
|
|
140
|
-
// this.nextTickId: any;
|
|
141
145
|
|
|
142
146
|
this._popupId = kendo_vue_common_1.guid();
|
|
147
|
+
this._anchor = kendo_vue_common_1.guid();
|
|
143
148
|
this._startInputId = kendo_vue_common_1.guid();
|
|
144
149
|
this._endInputId = kendo_vue_common_1.guid();
|
|
145
|
-
this.shouldFocusDateInput = false;
|
|
146
|
-
this.shouldFocusCalendar = false;
|
|
147
150
|
kendo_vue_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
148
151
|
this.currentShow = this.$props.show || this.$props.defaultShow;
|
|
149
152
|
this.currentValue = this.$props.value || this.$props.defaultValue;
|
|
150
|
-
this.
|
|
151
|
-
this.setShow = this.setShow.bind(this);
|
|
152
|
-
this.focusCalendarElement = this.focusCalendarElement.bind(this);
|
|
153
|
-
this.focusDateInputElement = this.focusDateInputElement.bind(this);
|
|
153
|
+
this.initialAnimation = this.currentShow;
|
|
154
154
|
},
|
|
155
155
|
mounted: function mounted() {
|
|
156
|
+
this._calendar = this.v3 ? this.calendarRef : this.$refs.calendar;
|
|
157
|
+
this._startDateInput = this.v3 ? this.startDateInputRef : this.$refs.startDateInput;
|
|
158
|
+
this._endDateInput = this.v3 ? this.endDateInputRef : this.$refs.endDateInput;
|
|
159
|
+
|
|
156
160
|
if (this.computedShow) {
|
|
157
161
|
// If defaultShow is true during the initial render, the popup is not aligned.
|
|
158
162
|
this.$forceUpdate();
|
|
163
|
+
this.$nextTick(function () {
|
|
164
|
+
this.initialAnimation = false;
|
|
165
|
+
});
|
|
159
166
|
}
|
|
160
167
|
},
|
|
161
168
|
updated: function updated() {
|
|
169
|
+
if (!this._calendar) {
|
|
170
|
+
this._calendar = this.v3 ? this.calendarRef : this.$refs.calendar;
|
|
171
|
+
}
|
|
172
|
+
|
|
162
173
|
if (this.shouldFocusCalendar) {
|
|
163
174
|
this.focusCalendarElement();
|
|
164
175
|
}
|
|
@@ -170,19 +181,22 @@ var DateRangePicker = {
|
|
|
170
181
|
this.shouldFocusCalendar = false;
|
|
171
182
|
this.shouldFocusDateInput = false;
|
|
172
183
|
},
|
|
173
|
-
destroyed: function destroyed() {
|
|
174
|
-
clearTimeout(this.nextTickId);
|
|
175
|
-
},
|
|
176
184
|
data: function data() {
|
|
177
185
|
return {
|
|
178
|
-
|
|
179
|
-
|
|
186
|
+
currentShow: false,
|
|
187
|
+
currentValue: null,
|
|
188
|
+
valueDuringOnChange: undefined,
|
|
189
|
+
shouldFocusDateInput: false,
|
|
190
|
+
shouldFocusCalendar: false
|
|
180
191
|
};
|
|
181
192
|
},
|
|
182
193
|
computed: {
|
|
183
194
|
computedValue: function computedValue() {
|
|
184
|
-
var value = this.valueDuringOnChange !== undefined ? this.valueDuringOnChange : this.$props.value !== undefined ? this.$props.value : this.
|
|
195
|
+
var value = this.valueDuringOnChange !== undefined ? this.valueDuringOnChange : this.$props.value !== undefined ? this.$props.value : this.currentValue;
|
|
185
196
|
return value || models_1.EMPTY_SELECTIONRANGE;
|
|
197
|
+
},
|
|
198
|
+
computedShow: function computedShow() {
|
|
199
|
+
return this.$props.show !== undefined ? this.$props.show : this.currentShow;
|
|
186
200
|
}
|
|
187
201
|
},
|
|
188
202
|
// @ts-ignore
|
|
@@ -201,7 +215,7 @@ var DateRangePicker = {
|
|
|
201
215
|
var _this = this;
|
|
202
216
|
|
|
203
217
|
var h = gh || createElement;
|
|
204
|
-
var value = this.
|
|
218
|
+
var value = this.computedValue || models_1.EMPTY_SELECTIONRANGE;
|
|
205
219
|
var startDateInputId = (this.$props.startDateInputSettings || {}).id || this._startInputId;
|
|
206
220
|
var endDateInputId = (this.$props.endDateInputSettings || {}).id || this._endInputId;
|
|
207
221
|
var rootClassName = kendo_vue_common_1.classNames('k-daterangepicker', {
|
|
@@ -211,9 +225,26 @@ var DateRangePicker = {
|
|
|
211
225
|
var startMessage = localizationService.toLanguageString(messages_1.start, messages_1.messages[messages_1.start]);
|
|
212
226
|
var endMessage = localizationService.toLanguageString(messages_1.end, messages_1.messages[messages_1.end]);
|
|
213
227
|
var separatorMessage = localizationService.toLanguageString(messages_1.separator, messages_1.messages[messages_1.separator]);
|
|
214
|
-
|
|
215
|
-
var
|
|
228
|
+
var startDateInputRender = this.$props.startDateInput ? kendo_vue_common_2.templateRendering.call(this, this.$props.startDateInput, kendo_vue_common_2.getListeners.call(this)) : undefined;
|
|
229
|
+
var startDateInputDefaultRendering = // @ts-ignore
|
|
230
|
+
h(DateInput_1.DateInput, {
|
|
231
|
+
ref: this.v3 ? function (el) {
|
|
232
|
+
_this.startDateInputRef = el;
|
|
233
|
+
} : 'startDateInput',
|
|
216
234
|
label: startMessage,
|
|
235
|
+
attrs: this.v3 ? undefined : {
|
|
236
|
+
label: startMessage,
|
|
237
|
+
format: this.$props.format,
|
|
238
|
+
min: this.min,
|
|
239
|
+
max: this.max,
|
|
240
|
+
id: this._startInputId,
|
|
241
|
+
disabled: this.$props.disabled,
|
|
242
|
+
valid: this.$props.valid,
|
|
243
|
+
ariaHasPopup: true,
|
|
244
|
+
ariaExpanded: this.computedShow // ...this.$props.startDateInputSettings,
|
|
245
|
+
,
|
|
246
|
+
value: value.start
|
|
247
|
+
},
|
|
217
248
|
format: this.$props.format,
|
|
218
249
|
min: this.min,
|
|
219
250
|
max: this.max,
|
|
@@ -221,14 +252,41 @@ var DateRangePicker = {
|
|
|
221
252
|
disabled: this.$props.disabled,
|
|
222
253
|
valid: this.$props.valid,
|
|
223
254
|
ariaHasPopup: true,
|
|
224
|
-
ariaExpanded: this.
|
|
225
|
-
}, this.$props.startDateInputSettings), {
|
|
255
|
+
ariaExpanded: this.computedShow,
|
|
226
256
|
value: value.start,
|
|
227
|
-
onChange: this.handleStartChange
|
|
257
|
+
onChange: this.handleStartChange,
|
|
258
|
+
on: this.v3 ? undefined : {
|
|
259
|
+
"change": this.handleStartChange
|
|
260
|
+
}
|
|
228
261
|
});
|
|
229
|
-
|
|
230
|
-
|
|
262
|
+
var startDateInputRendering = kendo_vue_common_2.getTemplate.call(this, {
|
|
263
|
+
h: h,
|
|
264
|
+
template: startDateInputRender,
|
|
265
|
+
defaultRendering: startDateInputDefaultRendering,
|
|
266
|
+
additionalListeners: {
|
|
267
|
+
change: this.handleStartChange
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
var endDateInputRender = this.$props.endDateInput ? kendo_vue_common_2.templateRendering.call(this, this.$props.endDateInput, kendo_vue_common_2.getListeners.call(this)) : undefined;
|
|
271
|
+
var endDateInputDefaultRendering = // @ts-ignore
|
|
272
|
+
h(DateInput_1.DateInput, {
|
|
273
|
+
ref: this.v3 ? function (el) {
|
|
274
|
+
_this.endDateInputRef = el;
|
|
275
|
+
} : 'endDateInput',
|
|
231
276
|
label: endMessage,
|
|
277
|
+
attrs: this.v3 ? undefined : {
|
|
278
|
+
label: endMessage,
|
|
279
|
+
format: this.$props.format,
|
|
280
|
+
min: this.min,
|
|
281
|
+
max: this.max,
|
|
282
|
+
id: this._endInputId,
|
|
283
|
+
disabled: this.$props.disabled,
|
|
284
|
+
valid: this.$props.valid,
|
|
285
|
+
ariaHasPopup: true,
|
|
286
|
+
ariaExpanded: this.computedShow // ...this.$props.endDateInputSettings,
|
|
287
|
+
,
|
|
288
|
+
value: value.end
|
|
289
|
+
},
|
|
232
290
|
format: this.$props.format,
|
|
233
291
|
min: this.min,
|
|
234
292
|
max: this.max,
|
|
@@ -236,141 +294,189 @@ var DateRangePicker = {
|
|
|
236
294
|
disabled: this.$props.disabled,
|
|
237
295
|
valid: this.$props.valid,
|
|
238
296
|
ariaHasPopup: true,
|
|
239
|
-
ariaExpanded: this.
|
|
240
|
-
}, this.$props.endDateInputSettings), {
|
|
297
|
+
ariaExpanded: this.computedShow,
|
|
241
298
|
value: value.end,
|
|
242
|
-
onChange: this.handleEndChange
|
|
299
|
+
onChange: this.handleEndChange,
|
|
300
|
+
on: this.v3 ? undefined : {
|
|
301
|
+
"change": this.handleEndChange
|
|
302
|
+
}
|
|
243
303
|
});
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
horizontal: 'left',
|
|
251
|
-
vertical: 'bottom'
|
|
252
|
-
},
|
|
253
|
-
popupAlign: {
|
|
254
|
-
horizontal: 'left',
|
|
255
|
-
vertical: 'top'
|
|
304
|
+
var endDateInputRendering = kendo_vue_common_2.getTemplate.call(this, {
|
|
305
|
+
h: h,
|
|
306
|
+
template: endDateInputRender,
|
|
307
|
+
defaultRendering: endDateInputDefaultRendering,
|
|
308
|
+
additionalListeners: {
|
|
309
|
+
change: this.handleEndChange
|
|
256
310
|
}
|
|
257
|
-
}, this.$props.popupSettings), {
|
|
258
|
-
show: this.show
|
|
259
311
|
});
|
|
260
|
-
|
|
261
|
-
var
|
|
312
|
+
var calendarRender = this.$props.calendar ? kendo_vue_common_2.templateRendering.call(this, this.$props.calendar, kendo_vue_common_2.getListeners.call(this)) : undefined;
|
|
313
|
+
var calendarDefaultRendering = // @ts-ignore
|
|
314
|
+
h(Calendar_1.Calendar, {
|
|
315
|
+
ref: this.v3 ? function (el) {
|
|
316
|
+
_this.calendarRef = el;
|
|
317
|
+
} : 'calendar',
|
|
318
|
+
onKeydown: this.handleKeyDown,
|
|
319
|
+
on: this.v3 ? undefined : {
|
|
320
|
+
"keydown": this.handleKeyDown,
|
|
321
|
+
"focus": this.calendarFocus,
|
|
322
|
+
"blur": this.calendarBlur,
|
|
323
|
+
"change": this.handleCalendarChange
|
|
324
|
+
},
|
|
325
|
+
onFocus: this.calendarFocus,
|
|
326
|
+
onBlur: this.calendarBlur,
|
|
262
327
|
min: this.min,
|
|
328
|
+
attrs: this.v3 ? undefined : {
|
|
329
|
+
min: this.min,
|
|
330
|
+
max: this.max,
|
|
331
|
+
views: 2,
|
|
332
|
+
allowReverse: this.$props.allowReverse,
|
|
333
|
+
mode: 'range',
|
|
334
|
+
focusedDate: this.$props.focusedDate,
|
|
335
|
+
disabled: this.$props.disabled // ...this.$props.calendarSettings,
|
|
336
|
+
,
|
|
337
|
+
value: value
|
|
338
|
+
},
|
|
263
339
|
max: this.max,
|
|
340
|
+
views: 2,
|
|
264
341
|
allowReverse: this.$props.allowReverse,
|
|
265
342
|
mode: 'range',
|
|
266
343
|
focusedDate: this.$props.focusedDate,
|
|
267
|
-
disabled: this.$props.disabled
|
|
268
|
-
}, this.$props.calendarSettings), {
|
|
344
|
+
disabled: this.$props.disabled,
|
|
269
345
|
value: value,
|
|
270
346
|
onChange: this.handleCalendarChange
|
|
271
347
|
});
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
348
|
+
var calendarRendering = kendo_vue_common_2.getTemplate.call(this, {
|
|
349
|
+
h: h,
|
|
350
|
+
template: calendarRender,
|
|
351
|
+
defaultRendering: calendarDefaultRendering,
|
|
352
|
+
additionalListeners: {
|
|
353
|
+
change: this.handleCalendarChange
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
var _a = this.$props.popupSettings,
|
|
357
|
+
popupClass = _a.popupClass,
|
|
358
|
+
animate = _a.animate,
|
|
359
|
+
appendTo = _a.appendTo;
|
|
360
|
+
var popupRender = this.$props.popup ? kendo_vue_common_2.templateRendering.call(this, this.$props.popup, kendo_vue_common_2.getListeners.call(this)) : undefined;
|
|
361
|
+
var popupDefaultRendering = // @ts-ignore function children
|
|
362
|
+
h(kendo_vue_popup_1.Popup, {
|
|
363
|
+
show: this.computedShow,
|
|
364
|
+
attrs: this.v3 ? undefined : {
|
|
365
|
+
show: this.computedShow,
|
|
366
|
+
anchor: this._anchor,
|
|
367
|
+
id: this._popupId,
|
|
368
|
+
anchorAlign: {
|
|
369
|
+
horizontal: 'left',
|
|
370
|
+
vertical: 'bottom'
|
|
371
|
+
},
|
|
372
|
+
popupAlign: {
|
|
373
|
+
horizontal: 'left',
|
|
374
|
+
vertical: 'top'
|
|
375
|
+
},
|
|
376
|
+
animate: this.initialAnimation ? false : animate,
|
|
377
|
+
appendTo: appendTo
|
|
378
|
+
},
|
|
379
|
+
anchor: this._anchor,
|
|
380
|
+
id: this._popupId,
|
|
381
|
+
anchorAlign: {
|
|
382
|
+
horizontal: 'left',
|
|
383
|
+
vertical: 'bottom'
|
|
384
|
+
},
|
|
385
|
+
popupAlign: {
|
|
386
|
+
horizontal: 'left',
|
|
387
|
+
vertical: 'top'
|
|
388
|
+
},
|
|
389
|
+
animate: this.initialAnimation ? false : animate,
|
|
390
|
+
appendTo: appendTo,
|
|
391
|
+
"class": popupClass
|
|
392
|
+
}, this.v3 ? function () {
|
|
393
|
+
return [calendarRendering];
|
|
394
|
+
} : [calendarRendering]);
|
|
395
|
+
var popupRendering = kendo_vue_common_2.getTemplate.call(this, {
|
|
396
|
+
h: h,
|
|
397
|
+
template: popupRender,
|
|
398
|
+
defaultRendering: popupDefaultRendering,
|
|
399
|
+
defaultSlots: calendarRendering
|
|
277
400
|
});
|
|
278
401
|
var reverseButton = h("span", {
|
|
279
402
|
role: "button",
|
|
280
403
|
attrs: this.v3 ? undefined : {
|
|
281
404
|
role: "button",
|
|
282
|
-
|
|
283
|
-
|
|
405
|
+
title: kendo_vue_intl_1.provideLocalizationService(this).toLanguageString(messages_1.swapStartEnd, messages_1.messages[messages_1.swapStartEnd]),
|
|
406
|
+
"aria-controls": startDateInputId + ' ' + endDateInputId,
|
|
407
|
+
"aria-label": kendo_vue_intl_1.provideLocalizationService(this).toLanguageString(messages_1.swapStartEnd, messages_1.messages[messages_1.swapStartEnd])
|
|
284
408
|
},
|
|
285
|
-
|
|
409
|
+
"class": "k-select k-button k-flat",
|
|
286
410
|
title: kendo_vue_intl_1.provideLocalizationService(this).toLanguageString(messages_1.swapStartEnd, messages_1.messages[messages_1.swapStartEnd]),
|
|
287
|
-
|
|
411
|
+
onMousedown: this.handleReverseMouseDown,
|
|
288
412
|
on: this.v3 ? undefined : {
|
|
289
|
-
"
|
|
413
|
+
"mousedown": this.handleReverseMouseDown,
|
|
290
414
|
"click": this.handleReverseClick
|
|
291
415
|
},
|
|
292
|
-
onClick: this.handleReverseClick
|
|
416
|
+
onClick: this.handleReverseClick,
|
|
417
|
+
"aria-controls": startDateInputId + ' ' + endDateInputId,
|
|
418
|
+
"aria-label": kendo_vue_intl_1.provideLocalizationService(this).toLanguageString(messages_1.swapStartEnd, messages_1.messages[messages_1.swapStartEnd])
|
|
293
419
|
}, [h("span", {
|
|
294
420
|
style: {
|
|
295
421
|
transform: 'rotate(90deg)'
|
|
296
422
|
},
|
|
297
|
-
|
|
298
|
-
attrs: this.v3 ? undefined : {
|
|
299
|
-
className: "k-icon k-i-arrows-swap"
|
|
300
|
-
}
|
|
423
|
+
"class": "k-icon k-i-arrows-swap"
|
|
301
424
|
})]);
|
|
302
425
|
return h("span", {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
className: rootClassName,
|
|
426
|
+
"class": rootClassName,
|
|
427
|
+
style: this.$props.style,
|
|
428
|
+
id: this.$props.id,
|
|
307
429
|
attrs: this.v3 ? undefined : {
|
|
308
|
-
className: rootClassName,
|
|
309
430
|
id: this.$props.id,
|
|
310
431
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
311
432
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
312
433
|
tabIndex: this.$props.tabIndex
|
|
313
434
|
},
|
|
314
|
-
style: this.$props.style,
|
|
315
|
-
id: this.$props.id,
|
|
316
435
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
317
436
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
318
437
|
tabIndex: this.$props.tabIndex,
|
|
319
|
-
|
|
438
|
+
onFocusin: this.handleFocus,
|
|
320
439
|
on: this.v3 ? undefined : {
|
|
321
|
-
"
|
|
322
|
-
"
|
|
323
|
-
"
|
|
440
|
+
"focusin": this.handleFocus,
|
|
441
|
+
"focusout": this.handleBlur,
|
|
442
|
+
"keydown": this.handleKeyDown
|
|
324
443
|
},
|
|
325
|
-
|
|
326
|
-
|
|
444
|
+
onFocusout: this.handleBlur,
|
|
445
|
+
onKeydown: this.handleKeyDown
|
|
327
446
|
}, [h("span", {
|
|
328
|
-
ref: function
|
|
329
|
-
_this.
|
|
330
|
-
},
|
|
331
|
-
|
|
332
|
-
attrs: this.v3 ? undefined : {
|
|
333
|
-
className: "k-daterangepicker-wrap"
|
|
334
|
-
},
|
|
447
|
+
ref: this.v3 ? function (el) {
|
|
448
|
+
_this.kendoAnchorRef = el;
|
|
449
|
+
} : this._anchor,
|
|
450
|
+
"class": "k-daterangepicker-wrap",
|
|
335
451
|
style: WRAPPER_STYLES
|
|
336
|
-
}, [this.$props.
|
|
337
|
-
h(DateInput_1.DateInput, {
|
|
338
|
-
// {...startDateInputProps}
|
|
339
|
-
ref: this._startDateInput
|
|
340
|
-
}), (this.$props.allowReverse || this.$props.calendarSettings && this.$props.calendarSettings.allowReverse) && this.$props.swapButton ? reverseButton : separatorMessage, this.$props.endDateInput ? h(this.$props.endDateInput) : // @ts-ignore
|
|
341
|
-
h(DateInput_1.DateInput, {
|
|
342
|
-
// {...endDateInputProps}
|
|
343
|
-
ref: this._endDateInput
|
|
344
|
-
})]), this.$props.popup ? h(this.$props.popup, [calendar]) : // @ts-ignore
|
|
345
|
-
h(kendo_vue_popup_1.Popup, [calendar])]);
|
|
452
|
+
}, [startDateInputRendering, (this.$props.allowReverse || this.$props.calendarSettings && this.$props.calendarSettings.allowReverse) && this.$props.swapButton ? reverseButton : separatorMessage, endDateInputRendering]), popupRendering]);
|
|
346
453
|
},
|
|
347
454
|
methods: {
|
|
348
455
|
focus: function focus() {
|
|
349
|
-
if (this.
|
|
350
|
-
this.
|
|
456
|
+
if (this._startDateInput) {
|
|
457
|
+
this._startDateInput.focus();
|
|
351
458
|
}
|
|
352
459
|
},
|
|
353
|
-
setCalendarRef: function setCalendarRef(calendar) {
|
|
354
|
-
this._calendar = calendar;
|
|
355
|
-
},
|
|
356
460
|
focusCalendarElement: function focusCalendarElement() {
|
|
357
|
-
|
|
358
|
-
|
|
461
|
+
var popup = document.getElementById(this._popupId);
|
|
462
|
+
|
|
463
|
+
if (this._calendar && popup) {
|
|
464
|
+
popup.getElementsByClassName('k-calendar-table')[0].focus({
|
|
359
465
|
preventScroll: true
|
|
360
466
|
});
|
|
361
467
|
}
|
|
362
468
|
},
|
|
363
469
|
focusDateInputElement: function focusDateInputElement() {
|
|
364
|
-
if (!document || !this.
|
|
470
|
+
if (!document || !this._startDateInput || !this._startDateInput.element() || !this._endDateInput || !this._endDateInput.element()) {
|
|
365
471
|
return;
|
|
366
472
|
}
|
|
367
473
|
|
|
368
|
-
if ((this.
|
|
369
|
-
this.
|
|
474
|
+
if ((this.computedValue.start === null || this.computedValue.end !== null) && document.activeElement !== this._endDateInput.element()) {
|
|
475
|
+
this._startDateInput.focus({
|
|
370
476
|
preventScroll: true
|
|
371
477
|
});
|
|
372
|
-
} else if (document.activeElement !== this.
|
|
373
|
-
this.
|
|
478
|
+
} else if (document.activeElement !== this._startDateInput.element()) {
|
|
479
|
+
this._endDateInput.focus({
|
|
374
480
|
preventScroll: true
|
|
375
481
|
});
|
|
376
482
|
}
|
|
@@ -384,26 +490,17 @@ var DateRangePicker = {
|
|
|
384
490
|
return nextProps.show !== undefined ? nextProps.show // @ts-ignore
|
|
385
491
|
: nextState.show;
|
|
386
492
|
},
|
|
387
|
-
// nextTick(f: () => any): void {
|
|
388
|
-
// // XXX: use window.setTimeout due to async focus/blur events in IE, and missing relatedTarget prop.
|
|
389
|
-
// // XXX: https://github.com/facebook/react/issues/3751
|
|
390
|
-
// // Handles multiple focus events happening at the same time.
|
|
391
|
-
// clearTimeout(this.nextTickId);
|
|
392
|
-
// this.nextTickId = window.setTimeout(() => f());
|
|
393
|
-
// },
|
|
394
493
|
setShow: function setShow(show) {
|
|
395
|
-
if (this.
|
|
494
|
+
if (this.currentShow === show) {
|
|
396
495
|
return;
|
|
397
496
|
}
|
|
398
497
|
|
|
399
|
-
this.
|
|
400
|
-
show: show
|
|
401
|
-
});
|
|
498
|
+
this.currentShow = show;
|
|
402
499
|
},
|
|
403
500
|
handleReverseClick: function handleReverseClick(event) {
|
|
404
501
|
var value = {
|
|
405
|
-
start: this.
|
|
406
|
-
end: this.
|
|
502
|
+
start: this.computedValue.end,
|
|
503
|
+
end: this.computedValue.start
|
|
407
504
|
};
|
|
408
505
|
var args = {
|
|
409
506
|
nativeEvent: event.nativeEvent
|
|
@@ -414,49 +511,53 @@ var DateRangePicker = {
|
|
|
414
511
|
event.preventDefault();
|
|
415
512
|
},
|
|
416
513
|
handleFocus: function handleFocus(event) {
|
|
417
|
-
clearTimeout(this.nextTickId);
|
|
418
|
-
|
|
419
514
|
if (!this.shouldFocusDateInput) {
|
|
420
515
|
this.setShow(true);
|
|
421
516
|
}
|
|
422
517
|
|
|
423
|
-
if (this.
|
|
424
|
-
this.
|
|
518
|
+
if (this._startDateInput && this._startDateInput.element()) {
|
|
519
|
+
this._startDateInput.element().classList.add('k-state-focused');
|
|
425
520
|
}
|
|
426
521
|
|
|
427
|
-
if (this.
|
|
428
|
-
this.
|
|
522
|
+
if (this._endDateInput && this._endDateInput.element()) {
|
|
523
|
+
this._endDateInput.element().classList.add('k-state-focused');
|
|
429
524
|
}
|
|
430
525
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (onFocus) {
|
|
434
|
-
onFocus.call(undefined, event);
|
|
435
|
-
}
|
|
526
|
+
this.$emit('focus', event);
|
|
436
527
|
},
|
|
437
|
-
|
|
528
|
+
calendarBlur: function calendarBlur() {
|
|
529
|
+
// this.$emit('blur', event);
|
|
530
|
+
clearTimeout(this._blurTimeout);
|
|
531
|
+
this.createBlurTimeout();
|
|
532
|
+
},
|
|
533
|
+
calendarFocus: function calendarFocus() {
|
|
534
|
+
// this.$emit('focus', event);
|
|
535
|
+
clearTimeout(this._blurTimeout);
|
|
536
|
+
},
|
|
537
|
+
createBlurTimeout: function createBlurTimeout() {
|
|
438
538
|
var _this = this;
|
|
439
539
|
|
|
440
|
-
this.
|
|
441
|
-
if (_this.
|
|
442
|
-
_this.
|
|
540
|
+
this._blurTimeout = setTimeout(function () {
|
|
541
|
+
if (_this._startDateInput && _this._startDateInput.element()) {
|
|
542
|
+
_this._startDateInput.element().classList.remove('k-state-focused');
|
|
443
543
|
}
|
|
444
544
|
|
|
445
|
-
if (_this.
|
|
446
|
-
_this.
|
|
545
|
+
if (_this._endDateInput && _this._endDateInput.element()) {
|
|
546
|
+
_this._endDateInput.element().classList.remove('k-state-focused');
|
|
447
547
|
}
|
|
448
548
|
|
|
449
|
-
_this.
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
549
|
+
if (_this._startDateInput && kendo_vue_common_1.canUseDOM && document.activeElement !== _this._startDateInput._element && document.activeElement !== _this._endDateInput._element) {
|
|
550
|
+
_this.setShow(false);
|
|
551
|
+
}
|
|
552
|
+
}, 200);
|
|
553
|
+
},
|
|
554
|
+
handleBlur: function handleBlur(event) {
|
|
555
|
+
this.createBlurTimeout();
|
|
556
|
+
this.$emit('blur', event);
|
|
456
557
|
},
|
|
457
558
|
handleEndChange: function handleEndChange(event) {
|
|
458
559
|
var value = {
|
|
459
|
-
start: this.
|
|
560
|
+
start: this.computedValue.start,
|
|
460
561
|
end: kendo_date_math_1.cloneDate(event.value || undefined)
|
|
461
562
|
};
|
|
462
563
|
this.handleChange(value, event);
|
|
@@ -464,7 +565,7 @@ var DateRangePicker = {
|
|
|
464
565
|
handleStartChange: function handleStartChange(event) {
|
|
465
566
|
var value = {
|
|
466
567
|
start: kendo_date_math_1.cloneDate(event.value || undefined),
|
|
467
|
-
end: this.
|
|
568
|
+
end: this.computedValue.end
|
|
468
569
|
};
|
|
469
570
|
this.handleChange(value, event);
|
|
470
571
|
},
|
|
@@ -475,8 +576,8 @@ var DateRangePicker = {
|
|
|
475
576
|
|
|
476
577
|
var candidate = Array.isArray(event.value) ? event.value[0] : event.value;
|
|
477
578
|
return {
|
|
478
|
-
start: this.
|
|
479
|
-
end: this.
|
|
579
|
+
start: this.computedValue.end !== null ? candidate : this.computedValue.start,
|
|
580
|
+
end: this.computedValue.start !== null ? candidate : this.computedValue.end
|
|
480
581
|
};
|
|
481
582
|
},
|
|
482
583
|
handleCalendarChange: function handleCalendarChange(event) {
|
|
@@ -495,28 +596,21 @@ var DateRangePicker = {
|
|
|
495
596
|
event.preventDefault();
|
|
496
597
|
this.shouldFocusCalendar = true;
|
|
497
598
|
this.setShow(true);
|
|
498
|
-
} else if (keyCode === kendo_vue_common_1.Keys.tab && this.
|
|
599
|
+
} else if (keyCode === kendo_vue_common_1.Keys.tab && this.computedShow && this._calendar && this._calendar.$el && this._endDateInput && this._endDateInput.element() && document && document.activeElement === this._endDateInput.element()) {
|
|
499
600
|
event.preventDefault();
|
|
500
601
|
this.focusCalendarElement();
|
|
501
602
|
}
|
|
502
603
|
},
|
|
503
604
|
handleChange: function handleChange(value, event) {
|
|
504
|
-
this.
|
|
505
|
-
value: value
|
|
506
|
-
});
|
|
605
|
+
this.currentValue = value;
|
|
507
606
|
this.valueDuringOnChange = value;
|
|
508
|
-
var
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
target: this
|
|
516
|
-
};
|
|
517
|
-
onChange.call(undefined, args);
|
|
518
|
-
}
|
|
519
|
-
|
|
607
|
+
var args = {
|
|
608
|
+
event: event.event,
|
|
609
|
+
value: this.computedValue,
|
|
610
|
+
show: this.computedShow,
|
|
611
|
+
target: this
|
|
612
|
+
};
|
|
613
|
+
this.$emit('change', args);
|
|
520
614
|
this.valueDuringOnChange = undefined;
|
|
521
615
|
}
|
|
522
616
|
}
|