Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui5-daterange-picker): initial implementation #1785

Merged
merged 11 commits into from
Jun 30, 2020
1 change: 1 addition & 0 deletions packages/main/bundle.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Carousel from "./dist/Carousel.js";
import CheckBox from "./dist/CheckBox.js";
import ComboBox from "./dist/ComboBox.js";
import DatePicker from "./dist/DatePicker.js";
import DateRangePicker from "./dist/DateRangePicker.js";
import DateTimePicker from "./dist/DateTimePicker.js";
import DurationPicker from "./dist/DurationPicker.js";
import Dialog from "./dist/Dialog.js";
Expand Down
13 changes: 8 additions & 5 deletions packages/main/src/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class DatePicker extends UI5Element {
this.maxDate = null;
console.warn(`In order for the "maxDate" property to have effect, you should enter valid date format`); // eslint-disable-line
}
if (this.isValid(this.value) && this.isInValidRange(this._getTimeStampFromString(this.value))) {
if (this._checkValueValidity(this.value)) {
this._changeCalendarSelection();
} else {
this._calendar.selectedDates = [];
Expand Down Expand Up @@ -461,10 +461,9 @@ class DatePicker extends UI5Element {
_handleInputChange() {
let nextValue = this._getInput().getInputValue();
const emptyValue = nextValue === "";
const isValid = emptyValue || this.isValid(nextValue);
const isInValidRange = this.isInValidRange(this._getTimeStampFromString(nextValue));
const isValid = emptyValue || this._checkValueValidity(nextValue);

if (isValid && isInValidRange) {
if (isValid) {
nextValue = this.normalizeValue(nextValue);
this.valueState = ValueState.None;
} else {
Expand All @@ -481,12 +480,16 @@ class DatePicker extends UI5Element {
_handleInputLiveChange() {
const nextValue = this._getInput().getInputValue();
const emptyValue = nextValue === "";
const isValid = emptyValue || (this.isValid(nextValue) && this.isInValidRange(this._getTimeStampFromString(nextValue)));
const isValid = emptyValue || this._checkValueValidity(nextValue);

this.value = nextValue;
this.fireEvent("input", { value: nextValue, valid: isValid });
}

_checkValueValidity(value) {
return this.isValid(value) && this.isInValidRange(this._getTimeStampFromString(value));
}

_click(event) {
if (isPhone()) {
this.responsivePopover.open(this);
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/DateRangePicker.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{>include "./DatePicker.hbs"}}
Loading