Skip to content

Commit

Permalink
fix #954 DateBox should close the popup when cleared and call change …
Browse files Browse the repository at this point in the history
…listeners when value is null
  • Loading branch information
vegegoku committed Sep 22, 2024
1 parent 8926d8a commit b9ad31e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,9 @@ public Date getDate() {
public Calendar setDate(Date date) {
Date oldDate = this.date;
this.date = date;
if (nonNull(date)) {
onDateViewUpdate(this.date);
onDateSelectionChanged(this.date);
triggerChangeListeners(oldDate, this.date);
}
onDateViewUpdate(this.date);
onDateSelectionChanged(this.date);
triggerChangeListeners(oldDate, this.date);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ public void onDateTimeFormatInfoChanged(DateTimeFormatInfo dateTimeFormatInfo) {
*/
@Override
public void onDateSelectionChanged(Date date) {
if (nonNull(date)) {
setDate(date);
}
setDate(date);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ protected void doSetValue(Date value) {
updateStringValue();
} else {
getInputElement().element().value = "";
close();
}
withDateSelectionToggleListeners(
false,
Expand All @@ -538,6 +539,12 @@ private void updateStringValue() {
getFormatted(this.value, this.calendar.getDateTimeFormatInfo());
}

@Override
public DateBox clear(boolean silent) {
close();
return super.clear(silent);
}

/**
* {@inheritDoc} Returns the string value of the underlying input element.
*
Expand Down

0 comments on commit b9ad31e

Please sign in to comment.