Browse Source

Pull request #1754: BI-81061 日期面板当前时间动态灰化

Merge in VISUAL/fineui from ~WINDY/fui:master to master

* commit 'a4337c5a5d2557836b272531b1ad4efa2c68e162':
  BI-81061 日期面板当前时间动态灰化
es6
windy 4 years ago
parent
commit
58b5c3084b
  1. 1
      changelog.md
  2. 23
      src/widget/dynamicdate/dynamicdate.popup.js
  3. 23
      src/widget/dynamicdatetime/dynamicdatetime.popup.js
  4. 1
      src/widget/year/combo.year.js
  5. 27
      src/widget/year/popup.year.js
  6. 1
      src/widget/yearmonth/combo.yearmonth.js
  7. 11
      src/widget/yearmonth/popup.yearmonth.js
  8. 1
      src/widget/yearquarter/combo.yearquarter.js
  9. 11
      src/widget/yearquarter/popup.yearquarter.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志
2.0(2021-01)
- 修改了日期下拉面板中的当前时间按钮的交互效果
- 新增年区间和年季度区间控件
- 日期类型控件不操作下拉面板收起不发Confirm事件
- 日期类型控件全系列可设置是否显示动态日期

23
src/widget/dynamicdate/dynamicdate.popup.js

@ -40,8 +40,9 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
shadow: true,
textHeight: c.buttonHeight - 1,
text: BI.i18nText("BI-Multi_Date_Today"),
disabled: this._checkTodayValid(),
ref: function () {
self.textButton = this;
self.todayButton = this;
},
listeners: [{
eventName: BI.TextButton.EVENT_CHANGE,
@ -169,13 +170,13 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
_setInnerValue: function () {
if (this.dateTab.getSelect() === BI.DynamicDateCombo.Static) {
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.textButton.setEnable(true);
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.textButton.setEnable(!this._checkTodayValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
date = BI.print(date, "%Y-%X-%d");
this.textButton.setValue(date);
this.textButton.setEnable(false);
this.todayButton.setValue(date);
this.todayButton.setEnable(false);
}
},
@ -183,6 +184,12 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
return BI.isNull(value) || BI.isEmptyObject(value) || BI.isEmptyString(value);
},
_checkTodayValid: function () {
var o = this.options;
var today = BI.getDate();
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0];
},
setMinDate: function (minDate) {
if (this.options.min !== minDate) {
this.options.min = minDate;
@ -221,12 +228,12 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
month: date.getMonth() + 1,
day: date.getDate()
});
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
} else {
this.ymd.setValue(value);
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
}
this.textButton.setEnable(true);
this.todayButton.setEnable(!this._checkTodayValid());
break;
}
},

23
src/widget/dynamicdatetime/dynamicdatetime.popup.js

@ -40,8 +40,9 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
textHeight: c.buttonHeight - 1,
shadow: true,
text: BI.i18nText("BI-Multi_Date_Today"),
disabled: this._checkTodayValid(),
ref: function () {
self.textButton = this;
self.todayButton = this;
},
listeners: [{
eventName: BI.TextButton.EVENT_CHANGE,
@ -177,13 +178,13 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
_setInnerValue: function () {
if (this.dateTab.getSelect() === BI.DynamicDateCombo.Static) {
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.textButton.setEnable(true);
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.todayButton.setEnable(!this._checkTodayValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
date = BI.print(date, "%Y-%X-%d");
this.textButton.setValue(date);
this.textButton.setEnable(false);
this.todayButton.setValue(date);
this.todayButton.setEnable(false);
}
},
@ -191,6 +192,12 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
return BI.isNull(value) || BI.isEmptyObject(value) || BI.isEmptyString(value);
},
_checkTodayValid: function () {
var o = this.options;
var today = BI.getDate();
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0];
},
setMinDate: function (minDate) {
if (this.options.min !== minDate) {
this.options.min = minDate;
@ -228,7 +235,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
day: date.getDate()
});
this.timeSelect.setValue();
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
} else {
this.ymd.setValue(value);
this.timeSelect.setValue({
@ -236,9 +243,9 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
minute: value.minute,
second: value.second
});
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
}
this.textButton.setEnable(true);
this.todayButton.setEnable(!this._checkTodayValid());
break;
}
},

1
src/widget/year/combo.year.js

@ -63,6 +63,7 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
destroyWhenHide: true,
popup: {
minWidth: 85,
stopPropagation: false,

27
src/widget/year/popup.year.js

@ -48,8 +48,9 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
shadow: true,
text: BI.i18nText("BI-Basic_Current_Year"),
disabled: this._checkTodayValid(),
ref: function () {
self.textButton = this;
self.yearButton = this;
},
listeners: [{
eventName: BI.TextButton.EVENT_CHANGE,
@ -78,16 +79,22 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
_setInnerValue: function () {
if (this.dateTab.getSelect() === BI.DynamicDateCombo.Static) {
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Year"));
this.textButton.setEnable(true);
this.yearButton.setValue(BI.i18nText("BI-Basic_Current_Year"));
this.yearButton.setEnable(!this._checkYearValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
date = BI.print(date, "%Y");
this.textButton.setValue(date);
this.textButton.setEnable(false);
this.yearButton.setValue(date);
this.yearButton.setEnable(false);
}
},
_checkYearValid: function () {
var o = this.options;
var today = BI.getDate();
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0];
},
_getTabJson: function () {
var self = this, o = this.options;
return {
@ -176,6 +183,12 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
};
},
_checkTodayValid: function () {
var o = this.options;
var today = BI.getDate();
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0];
},
setMinDate: function (minDate) {
if (this.options.min !== minDate) {
this.options.min = minDate;
@ -208,8 +221,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
case BI.DynamicDateCombo.Static:
default:
this.year.setValue(value);
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Year"));
this.textButton.setEnable(true);
this.yearButton.setValue(BI.i18nText("BI-Basic_Current_Year"));
this.yearButton.setEnable(!this._checkTodayValid());
break;
}
},

1
src/widget/yearmonth/combo.yearmonth.js

@ -61,6 +61,7 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
destroyWhenHide: true,
popup: {
minWidth: 100,
stopPropagation: false,

11
src/widget/yearmonth/popup.yearmonth.js

@ -48,6 +48,7 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
textHeight: c.buttonHeight - 1,
shadow: true,
text: BI.i18nText("BI-Basic_Current_Month"),
disabled: this._checkTodayValid(),
ref: function () {
self.textButton = this;
},
@ -79,7 +80,7 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
_setInnerValue: function () {
if (this.dateTab.getSelect() === BI.DynamicDateCombo.Static) {
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Month"));
this.textButton.setEnable(true);
this.textButton.setEnable(!this._checkTodayValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
date = BI.print(date, "%Y-%x");
@ -88,6 +89,12 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
}
},
_checkTodayValid: function () {
var o = this.options;
var today = BI.getDate();
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0];
},
_getTabJson: function () {
var self = this, o = this.options;
return {
@ -210,7 +217,7 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
default:
this.year.setValue(value);
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Month"));
this.textButton.setEnable(true);
this.textButton.setEnable(!this._checkTodayValid());
break;
}
},

1
src/widget/yearquarter/combo.yearquarter.js

@ -61,6 +61,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
destroyWhenHide: true,
popup: {
minWidth: 85,
stopPropagation: false,

11
src/widget/yearquarter/popup.yearquarter.js

@ -41,6 +41,7 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
textHeight: c.buttonHeight - 1,
shadow: true,
text: BI.i18nText("BI-Basic_Current_Quarter"),
disabled: this._checkTodayValid(),
ref: function () {
self.textButton = this;
},
@ -72,7 +73,7 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
_setInnerValue: function () {
if (this.dateTab.getSelect() === BI.DynamicYearQuarterCombo.Static) {
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Quarter"));
this.textButton.setEnable(true);
this.textButton.setEnable(!this._checkTodayValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
date = BI.print(date, "%Y-%Q");
@ -81,6 +82,12 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
}
},
_checkTodayValid: function () {
var o = this.options;
var today = BI.getDate();
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0];
},
_getTabJson: function () {
var self = this, o = this.options;
return {
@ -203,7 +210,7 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
default:
this.year.setValue(value);
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Quarter"));
this.textButton.setEnable(true);
this.textButton.setEnable(!this._checkTodayValid());
break;
}
},

Loading…
Cancel
Save