Browse Source

BI-80432 fix: 当天日期不在可选范围内无法翻页

es6
windy 4 years ago
parent
commit
5e728712c5
  1. 22
      src/widget/date/calendar/popup.year.js

22
src/widget/date/calendar/popup.year.js

@ -71,8 +71,8 @@ BI.YearPopup = BI.inherit(BI.Widget, {
afterCardCreated: function () {
this.setValue(self.selectedYear);
var calendar = this.getSelectedCard();
calendar && self.backBtn.setEnable(!calendar.isFrontYear());
calendar && self.preBtn.setEnable(!calendar.isFinalYear());
calendar && self.backBtn.setEnable(self._checkMinYearValid());
calendar && self.preBtn.setEnable(self._checkMaxYearValid());
}
});
@ -87,12 +87,22 @@ BI.YearPopup = BI.inherit(BI.Widget, {
}
},
_checkMinYearValid: function () {
var o = this.options;
return this.selectedYear > BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear();
},
_checkMaxYearValid: function () {
var o = this.options;
return this.selectedYear < BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear();
},
_checkMin: function () {
var calendar = this.navigation.getSelectedCard();
if (BI.isNotNull(calendar)) {
calendar.setMinDate(this.options.min);
this.backBtn.setEnable(!calendar.isFrontYear());
this.preBtn.setEnable(!calendar.isFinalYear());
this.backBtn.setEnable(this._checkMinYearValid());
this.preBtn.setEnable(this._checkMaxYearValid());
}
},
@ -100,8 +110,8 @@ BI.YearPopup = BI.inherit(BI.Widget, {
var calendar = this.navigation.getSelectedCard();
if (BI.isNotNull(calendar)) {
calendar.setMaxDate(this.options.max);
this.backBtn.setEnable(!calendar.isFrontYear());
this.preBtn.setEnable(!calendar.isFinalYear());
this.backBtn.setEnable(this._checkMinYearValid());
this.preBtn.setEnable(this._checkMaxYearValid());
}
},

Loading…
Cancel
Save