@vaadin/vaadin-date-picker
Advanced tools
Comparing version 4.0.6 to 4.0.7
@@ -13,3 +13,3 @@ { | ||
"name": "@vaadin/vaadin-date-picker", | ||
"version": "4.0.6", | ||
"version": "4.0.7", | ||
"main": "vaadin-date-picker.js", | ||
@@ -16,0 +16,0 @@ "author": "Vaadin Ltd", |
@@ -305,3 +305,2 @@ /** | ||
'_updateHasValue(value)', | ||
'_validateInput(_selectedDate, _minDate, _maxDate)', | ||
'_selectedDateChanged(_selectedDate, i18n.formatDate)', | ||
@@ -481,4 +480,5 @@ '_focusedDateChanged(_focusedDate, i18n.formatDate)', | ||
const value = this._formatISO(selectedDate); | ||
this._inputValue = selectedDate ? inputValue : ''; | ||
if (value !== this.value) { | ||
this.validate(inputValue); | ||
this.validate(); | ||
this.value = value; | ||
@@ -491,3 +491,2 @@ } | ||
this._ignoreFocusedDateChange = false; | ||
this._inputValue = selectedDate ? inputValue : ''; | ||
} | ||
@@ -533,2 +532,3 @@ | ||
this[property] = date; | ||
this.value && this.validate(); | ||
} | ||
@@ -696,3 +696,5 @@ } | ||
} | ||
this.validate(); | ||
// No need to revalidate the value after `_selectedDateChanged` | ||
// Needed in case the value was not changed: open and close dropdown. | ||
!this.value && this.validate(); | ||
} | ||
@@ -706,7 +708,7 @@ | ||
*/ | ||
validate(value) { | ||
// reset invalid state on the underlying text field | ||
this.invalid = false; | ||
value = value !== undefined ? value : this._inputValue; | ||
return !(this.invalid = !this.checkValidity(value)); | ||
validate() { | ||
// Note (Yuriy): Workaround `this._inputValue` is used in order | ||
// to avoid breaking change on custom `checkValidity`. | ||
// Can be removed with next major. | ||
return !(this.invalid = !this.checkValidity(this._inputValue)); | ||
} | ||
@@ -722,16 +724,18 @@ | ||
*/ | ||
checkValidity(value) { | ||
var inputValid = !value || | ||
(this._selectedDate && value === this.i18n.formatDate(DatePickerHelper._extractDateParts(this._selectedDate))); | ||
var minMaxValid = !this._selectedDate || | ||
checkValidity() { | ||
const inputValid = !this._inputValue || | ||
(this._selectedDate && this._inputValue === this.i18n.formatDate(DatePickerHelper._extractDateParts(this._selectedDate))); | ||
const minMaxValid = !this._selectedDate || | ||
DatePickerHelper._dateAllowed(this._selectedDate, this._minDate, this._maxDate); | ||
var inputValidity = true; | ||
let inputValidity = true; | ||
if (this._inputElement) { | ||
if (this._inputElement.checkValidity) { | ||
// vaadin native input elements have the checkValidity method | ||
inputValidity = this._inputElement.checkValidity(value); | ||
this._inputElement.__forceCheckValidity = true; | ||
inputValidity = this._inputElement.checkValidity(); | ||
this._inputElement.__forceCheckValidity = false; | ||
} else if (this._inputElement.validate) { | ||
// iron-form-elements have the validate API | ||
inputValidity = this._inputElement.validate(value); | ||
inputValidity = this._inputElement.validate(); | ||
} | ||
@@ -846,8 +850,2 @@ } | ||
_validateInput(date, min, max) { | ||
if (date && (min || max)) { | ||
this.invalid = !DatePickerHelper._dateAllowed(date, min, max); | ||
} | ||
} | ||
_onUserInput(e) { | ||
@@ -854,0 +852,0 @@ if (!this.opened && this._inputElement.value) { |
@@ -152,3 +152,3 @@ /** | ||
static get version() { | ||
return '4.0.6'; | ||
return '4.0.7'; | ||
} | ||
@@ -155,0 +155,0 @@ |
134803
3371