Browse Source

BI-82267 取消翻页限制后的交互

master
windy 4 years ago
parent
commit
b1ca16d30f
  1. 1
      changelog.md
  2. 4
      src/widget/date/calendar/picker.year.js
  3. 6
      src/widget/date/calendar/popup.month.js
  4. 11
      src/widget/date/calendar/popup.year.js
  5. 3
      src/widget/dynamicdate/dynamicdate.combo.js
  6. 3
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  7. 18
      src/widget/yearmonth/combo.yearmonth.js
  8. 18
      src/widget/yearquarter/combo.yearquarter.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2021-03) 2.0(2021-03)
- 时间类型控件无翻页限制
- 时间类型控件优化动态时间面板的交互 - 时间类型控件优化动态时间面板的交互
2.0(2021-02) 2.0(2021-02)

4
src/widget/date/calendar/picker.year.js

@ -83,9 +83,7 @@ BI.YearPicker = BI.inherit(BI.Widget, {
width: 25 width: 25
}] }]
}); });
this.setValue({ this.setValue(this._year);
year: this._year
});
}, },
_checkLeftValid: function () { _checkLeftValid: function () {

6
src/widget/date/calendar/popup.month.js

@ -18,6 +18,8 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
BI.MonthPopup.superclass._init.apply(this, arguments); BI.MonthPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.selectedMonth = BI.getDate().getMonth() + 1;
this.month = BI.createWidget({ this.month = BI.createWidget({
type: "bi.button_group", type: "bi.button_group",
element: this, element: this,
@ -39,6 +41,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
}); });
this.month.on(BI.Controller.EVENT_CHANGE, function (type) { this.month.on(BI.Controller.EVENT_CHANGE, function (type) {
self.selectedMonth = this.getValue()[0];
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.MonthPopup.EVENT_CHANGE); self.fireEvent(BI.MonthPopup.EVENT_CHANGE);
@ -82,11 +85,12 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
}, },
getValue: function () { getValue: function () {
return this.month.getValue()[0]; return this.selectedMonth;
}, },
setValue: function (v) { setValue: function (v) {
v = BI.parseInt(v); v = BI.parseInt(v);
this.selectedMonth = v;
this.month.setValue([v]); this.month.setValue([v]);
} }
}); });

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

@ -119,12 +119,13 @@ BI.YearPopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var o = this.options; var o = this.options;
v = BI.parseInt(v); v = BI.parseInt(v);
// 切换年不受范围限制
// 对于年控件来说,只要传入的minDate和maxDate的year区间包含v就是合法的 // 对于年控件来说,只要传入的minDate和maxDate的year区间包含v就是合法的
var startDate = BI.parseDateTime(o.min, "%Y-%X-%d"); // var startDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var endDate = BI.parseDateTime(o.max, "%Y-%X-%d"); // var endDate = BI.parseDateTime(o.max, "%Y-%X-%d");
if (BI.checkDateVoid(v, 1, 1, BI.print(BI.getDate(startDate.getFullYear(), 0, 1), "%Y-%X-%d"), BI.print(BI.getDate(endDate.getFullYear(), 0, 1), "%Y-%X-%d"))[0]) { // if (BI.checkDateVoid(v, 1, 1, BI.print(BI.getDate(startDate.getFullYear(), 0, 1), "%Y-%X-%d"), BI.print(BI.getDate(endDate.getFullYear(), 0, 1), "%Y-%X-%d"))[0]) {
v = BI.getDate().getFullYear(); // v = BI.getDate().getFullYear();
} // }
this.selectedYear = v; this.selectedYear = v;
this.navigation.setSelect(BI.YearCalendar.getPageByYear(v)); this.navigation.setSelect(BI.YearCalendar.getPageByYear(v));

3
src/widget/dynamicdate/dynamicdate.combo.js

@ -271,10 +271,13 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
}, },
_checkValue: function (v) { _checkValue: function (v) {
var o = this.options;
switch (v.type) { switch (v.type) {
case BI.DynamicDateCombo.Dynamic: case BI.DynamicDateCombo.Dynamic:
return BI.isNotEmptyObject(v.value); return BI.isNotEmptyObject(v.value);
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
var value = v.value || {};
return !BI.checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0];
default: default:
return true; return true;
} }

3
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -279,10 +279,13 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
}, },
_checkValue: function (v) { _checkValue: function (v) {
var o = this.options;
switch (v.type) { switch (v.type) {
case BI.DynamicDateCombo.Dynamic: case BI.DynamicDateCombo.Dynamic:
return BI.isNotEmptyObject(v.value); return BI.isNotEmptyObject(v.value);
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
var value = v.value || {};
return !BI.checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0];
default: default:
return true; return true;
} }

18
src/widget/yearmonth/combo.yearmonth.js

@ -99,7 +99,10 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
}, { }, {
eventName: BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE, eventName: BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE,
action: function () { action: function () {
self.setValue(self.popup.getValue()); var value = self.popup.getValue();
if (self._checkValue(value)) {
self.setValue(value);
}
self.combo.hideView(); self.combo.hideView();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
} }
@ -159,6 +162,19 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}, },
_checkValue: function (v) {
var o = this.options;
switch (v.type) {
case BI.DynamicDateCombo.Dynamic:
return BI.isNotEmptyObject(v.value);
case BI.DynamicDateCombo.Static:
var value = v.value || {};
return !BI.checkDateVoid(value.year, value.month, 1, o.minDate, o.maxDate)[0];
default:
return true;
}
},
setMinDate: function (minDate) { setMinDate: function (minDate) {
var o = this.options; var o = this.options;
o.minDate = minDate; o.minDate = minDate;

18
src/widget/yearquarter/combo.yearquarter.js

@ -99,7 +99,10 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
}, { }, {
eventName: BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE, eventName: BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE,
action: function () { action: function () {
self.setValue(self.popup.getValue()); var value = self.popup.getValue();
if (self._checkValue(value)) {
self.setValue(value);
}
self.combo.hideView(); self.combo.hideView();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
} }
@ -159,6 +162,19 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
} }
}, },
_checkValue: function (v) {
var o = this.options;
switch (v.type) {
case BI.DynamicDateCombo.Dynamic:
return BI.isNotEmptyObject(v.value);
case BI.DynamicDateCombo.Static:
var value = v.value || {};
return !BI.checkDateVoid(value.year, (value.quarter - 1) * 3 + 1, 1, o.minDate, o.maxDate)[0];
default:
return true;
}
},
setMinDate: function (minDate) { setMinDate: function (minDate) {
var o = this.options; var o = this.options;
o.minDate = minDate; o.minDate = minDate;

Loading…
Cancel
Save