@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.
@@ -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: defaults_1.MAX_DATE
104
+ default: function _default() {
105
+ return defaults_1.MAX_DATE;
106
+ }
117
107
  },
118
108
  min: {
119
109
  type: Date,
120
- default: defaults_1.MIN_DATE
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: Object // PropTypes.shape({ start: Date, end: Date })
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?: SelectionRange | null;
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.nextTick = this.nextTick.bind(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
- show: false,
179
- value: null
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.currentvalue;
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.value || models_1.EMPTY_SELECTIONRANGE;
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 startDateInputProps = __assign(__assign({
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.show
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
- var endDateInputProps = __assign(__assign({
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.show
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
- var popupProps = __assign(__assign({
246
- animate: this._wrapper !== null,
247
- anchor: this._wrapper,
248
- id: this._popupId,
249
- anchorAlign: {
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 calendarProps = __assign(__assign({
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
- var calendar = this.$props.calendar ? h(this.$props.calendar) : // @ts-ignore
274
- h(MultiViewCalendar // {...calendarProps}
275
- , {
276
- ref: this.setCalendarRef
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
- className: "k-select k-button k-flat",
283
- title: kendo_vue_intl_1.provideLocalizationService(this).toLanguageString(messages_1.swapStartEnd, messages_1.messages[messages_1.swapStartEnd])
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
- className: "k-select k-button k-flat",
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
- onMouseDown: this.handleReverseMouseDown,
411
+ onMousedown: this.handleReverseMouseDown,
288
412
  on: this.v3 ? undefined : {
289
- "mouseDown": this.handleReverseMouseDown,
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
- className: "k-icon k-i-arrows-swap",
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
- ref: function ref(span) {
304
- _this._element = span;
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
- onFocus: this.handleFocus,
438
+ onFocusin: this.handleFocus,
320
439
  on: this.v3 ? undefined : {
321
- "focus": this.handleFocus,
322
- "blur": this.handleBlur,
323
- "keyDown": this.handleKeyDown
440
+ "focusin": this.handleFocus,
441
+ "focusout": this.handleBlur,
442
+ "keydown": this.handleKeyDown
324
443
  },
325
- onBlur: this.handleBlur,
326
- onKeyDown: this.handleKeyDown
444
+ onFocusout: this.handleBlur,
445
+ onKeydown: this.handleKeyDown
327
446
  }, [h("span", {
328
- ref: function ref(span) {
329
- _this._wrapper = span;
330
- },
331
- className: "k-daterangepicker-wrap",
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.startDateInput ? h(this.$props.startDateInput) : // @ts-ignore
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.startDateInput) {
350
- this.startDateInput.focus();
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
- if (this._calendar && this._calendar.element) {
358
- this._calendar.element.focus({
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.startDateInput || !this.startDateInput.element || !this.endDateInput || !this.endDateInput.element) {
470
+ if (!document || !this._startDateInput || !this._startDateInput.element() || !this._endDateInput || !this._endDateInput.element()) {
365
471
  return;
366
472
  }
367
473
 
368
- if ((this.value.start === null || this.value.end !== null) && document.activeElement !== this.endDateInput.element) {
369
- this.startDateInput.element.focus({
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.startDateInput.element) {
373
- this.endDateInput.element.focus({
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.show === show) {
494
+ if (this.currentShow === show) {
396
495
  return;
397
496
  }
398
497
 
399
- this.setState({
400
- show: show
401
- });
498
+ this.currentShow = show;
402
499
  },
403
500
  handleReverseClick: function handleReverseClick(event) {
404
501
  var value = {
405
- start: this.value.end,
406
- end: this.value.start
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.startDateInput && this.startDateInput.element) {
424
- this.startDateInput.element.classList.add('k-state-focused');
518
+ if (this._startDateInput && this._startDateInput.element()) {
519
+ this._startDateInput.element().classList.add('k-state-focused');
425
520
  }
426
521
 
427
- if (this.endDateInput && this.endDateInput.element) {
428
- this.endDateInput.element.classList.add('k-state-focused');
522
+ if (this._endDateInput && this._endDateInput.element()) {
523
+ this._endDateInput.element().classList.add('k-state-focused');
429
524
  }
430
525
 
431
- var onFocus = this.$props.onFocus;
432
-
433
- if (onFocus) {
434
- onFocus.call(undefined, event);
435
- }
526
+ this.$emit('focus', event);
436
527
  },
437
- handleBlur: function handleBlur(event) {
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.nextTick(function () {
441
- if (_this.startDateInput && _this.startDateInput.element) {
442
- _this.startDateInput.element.classList.remove('k-state-focused');
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.endDateInput && _this.endDateInput.element) {
446
- _this.endDateInput.element.classList.remove('k-state-focused');
545
+ if (_this._endDateInput && _this._endDateInput.element()) {
546
+ _this._endDateInput.element().classList.remove('k-state-focused');
447
547
  }
448
548
 
449
- _this.setShow(false);
450
- });
451
- var onBlur = this.$props.onBlur;
452
-
453
- if (onBlur) {
454
- onBlur.call(undefined, event);
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.value.start,
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.value.end
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.value.end !== null ? candidate : this.value.start,
479
- end: this.value.start !== null ? candidate : this.value.end
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.show && this._calendar && this._calendar.element && this.endDateInput && this.endDateInput.element && document && document.activeElement === this.endDateInput.element) {
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.setState({
505
- value: value
506
- });
605
+ this.currentValue = value;
507
606
  this.valueDuringOnChange = value;
508
- var onChange = this.$props.onChange;
509
-
510
- if (onChange) {
511
- var args = {
512
- nativeEvent: event.event,
513
- value: this.value,
514
- show: this.show,
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
  }