Browse Source

JSY-25726 fix: 【冒烟】年季度/年月/年月区间筛选器,输入非法值后清空,设置框仍然标红

master
zsmj 2 years ago
parent
commit
e249a02bfb
  1. 120
      src/widget/yearmonth/combo.yearmonth.js
  2. 122
      src/widget/yearquarter/combo.yearquarter.js

120
src/widget/yearmonth/combo.yearmonth.js

@ -80,39 +80,45 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
ref: function () { ref: function () {
self.popup = this; self.popup = this;
}, },
listeners: [{ listeners: [
eventName: BI.DynamicYearMonthPopup.EVENT_CHANGE, {
action: function () { eventName: BI.DynamicYearMonthPopup.EVENT_CHANGE,
self.setValue(self.popup.getValue()); action: function () {
self.combo.hideView(); self.setValue(self.popup.getValue());
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM); self.combo.hideView();
} self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
}, { }
eventName: BI.DynamicYearMonthPopup.BUTTON_CLEAR_EVENT_CHANGE, }, {
action: function () { eventName: BI.DynamicYearMonthPopup.BUTTON_CLEAR_EVENT_CHANGE,
self.setValue(); action: function () {
self.combo.hideView(); self.setValue();
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM); self.comboWrapper.element.removeClass("error");
} self.combo.hideView();
}, { self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
eventName: BI.DynamicYearMonthPopup.BUTTON_lABEL_EVENT_CHANGE, }
action: function () { }, {
var date = BI.getDate(); eventName: BI.DynamicYearMonthPopup.BUTTON_lABEL_EVENT_CHANGE,
self.setValue({ type: BI.DynamicYearMonthCombo.Static, value: { year: date.getFullYear(), month: date.getMonth() + 1 } }); action: function () {
self.combo.hideView(); var date = BI.getDate();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); self.setValue({
} type: BI.DynamicYearMonthCombo.Static,
}, { value: { year: date.getFullYear(), month: date.getMonth() + 1 }
eventName: BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE, });
action: function () { self.combo.hideView();
var value = self.popup.getValue(); self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
if (self._checkValue(value)) { }
self.setValue(value); }, {
eventName: BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE,
action: function () {
var value = self.popup.getValue();
if (self._checkValue(value)) {
self.setValue(value);
}
self.combo.hideView();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
} }
self.combo.hideView();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
} }
}], ],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.minDate, min: o.minDate,
max: o.maxDate max: o.maxDate
@ -130,31 +136,35 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
el: { {
type: "bi.horizontal_fill", el: {
columnSize: ["", "fill"], type: "bi.horizontal_fill",
cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow", columnSize: ["", "fill"],
ref: function () { cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow",
self.comboWrapper = this; ref: function () {
self.comboWrapper = this;
},
items: [
{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: BI.toPix(o.height, border),
height: BI.toPix(o.height, border),
ref: function () {
self.changeIcon = this;
}
}
}, this.combo
]
}, },
items: [{ top: 0,
el: { left: 0,
type: "bi.icon_button", right: 0,
cls: "bi-trigger-icon-button date-change-h-font", bottom: 0
width: BI.toPix(o.height, border), }
height: BI.toPix(o.height, border), ]
ref: function () {
self.changeIcon = this;
}
}
}, this.combo]
},
top: 0,
left: 0,
right: 0,
bottom: 0
}]
}); });
this._checkDynamicValue(o.value); this._checkDynamicValue(o.value);
}, },

122
src/widget/yearquarter/combo.yearquarter.js

@ -1,6 +1,6 @@
BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
_consts:{ _consts: {
iconWidth: 24 iconWidth: 24
}, },
props: { props: {
@ -83,39 +83,45 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
ref: function () { ref: function () {
self.popup = this; self.popup = this;
}, },
listeners: [{ listeners: [
eventName: BI.DynamicYearQuarterPopup.EVENT_CHANGE, {
action: function () { eventName: BI.DynamicYearQuarterPopup.EVENT_CHANGE,
self.setValue(self.popup.getValue()); action: function () {
self.combo.hideView(); self.setValue(self.popup.getValue());
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM); self.combo.hideView();
} self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
}, { }
eventName: BI.DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE, }, {
action: function () { eventName: BI.DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE,
self.setValue(); action: function () {
self.combo.hideView(); self.setValue();
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM); self.comboWrapper.element.removeClass("error");
} self.combo.hideView();
}, { self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
eventName: BI.DynamicYearQuarterPopup.BUTTON_lABEL_EVENT_CHANGE, }
action: function () { }, {
var date = BI.getDate(); eventName: BI.DynamicYearQuarterPopup.BUTTON_lABEL_EVENT_CHANGE,
self.setValue({ type: BI.DynamicYearMonthCombo.Static, value: { year: date.getFullYear(), quarter: BI.getQuarter(date) } }); action: function () {
self.combo.hideView(); var date = BI.getDate();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); self.setValue({
} type: BI.DynamicYearMonthCombo.Static,
}, { value: { year: date.getFullYear(), quarter: BI.getQuarter(date) }
eventName: BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE, });
action: function () { self.combo.hideView();
var value = self.popup.getValue(); self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
if (self._checkValue(value)) { }
self.setValue(value); }, {
eventName: BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE,
action: function () {
var value = self.popup.getValue();
if (self._checkValue(value)) {
self.setValue(value);
}
self.combo.hideView();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
} }
self.combo.hideView();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
} }
}], ],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.minDate, min: o.minDate,
max: o.maxDate max: o.maxDate
@ -133,31 +139,35 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
el: { {
type: "bi.horizontal_fill", el: {
columnSize: ["", "fill"], type: "bi.horizontal_fill",
cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow", columnSize: ["", "fill"],
ref: function () { cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow",
self.comboWrapper = this; ref: function () {
self.comboWrapper = this;
},
items: [
{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: this._consts.iconWidth,
height: BI.toPix(o.height, border),
ref: function () {
self.changeIcon = this;
}
}
}, this.combo
]
}, },
items: [{ top: 0,
el: { left: 0,
type: "bi.icon_button", right: 0,
cls: "bi-trigger-icon-button date-change-h-font", bottom: 0
width: this._consts.iconWidth, }
height: BI.toPix(o.height, border), ]
ref: function () {
self.changeIcon = this;
}
}
}, this.combo]
},
top: 0,
left: 0,
right: 0,
bottom: 0
}]
}); });
this._checkDynamicValue(o.value); this._checkDynamicValue(o.value);
}, },

Loading…
Cancel
Save