From e249a02bfb650b9ba31b7c0691741369e8148877 Mon Sep 17 00:00:00 2001 From: zsmj Date: Fri, 30 Dec 2022 11:06:45 +0800 Subject: [PATCH] =?UTF-8?q?JSY-25726=20fix:=20=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91=E5=B9=B4=E5=AD=A3=E5=BA=A6/=E5=B9=B4=E6=9C=88/?= =?UTF-8?q?=E5=B9=B4=E6=9C=88=E5=8C=BA=E9=97=B4=E7=AD=9B=E9=80=89=E5=99=A8?= =?UTF-8?q?=EF=BC=8C=E8=BE=93=E5=85=A5=E9=9D=9E=E6=B3=95=E5=80=BC=E5=90=8E?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=EF=BC=8C=E8=AE=BE=E7=BD=AE=E6=A1=86=E4=BB=8D?= =?UTF-8?q?=E7=84=B6=E6=A0=87=E7=BA=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/yearmonth/combo.yearmonth.js | 120 ++++++++++--------- src/widget/yearquarter/combo.yearquarter.js | 122 +++++++++++--------- 2 files changed, 131 insertions(+), 111 deletions(-) diff --git a/src/widget/yearmonth/combo.yearmonth.js b/src/widget/yearmonth/combo.yearmonth.js index 82d6e3ca8..0fc8cab5c 100644 --- a/src/widget/yearmonth/combo.yearmonth.js +++ b/src/widget/yearmonth/combo.yearmonth.js @@ -80,39 +80,45 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { ref: function () { self.popup = this; }, - listeners: [{ - eventName: BI.DynamicYearMonthPopup.EVENT_CHANGE, - action: function () { - self.setValue(self.popup.getValue()); - self.combo.hideView(); - self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM); - } - }, { - eventName: BI.DynamicYearMonthPopup.BUTTON_CLEAR_EVENT_CHANGE, - action: function () { - self.setValue(); - self.combo.hideView(); - self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM); - } - }, { - eventName: BI.DynamicYearMonthPopup.BUTTON_lABEL_EVENT_CHANGE, - action: function () { - var date = BI.getDate(); - self.setValue({ type: BI.DynamicYearMonthCombo.Static, value: { year: date.getFullYear(), month: date.getMonth() + 1 } }); - self.combo.hideView(); - self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); - } - }, { - eventName: BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE, - action: function () { - var value = self.popup.getValue(); - if (self._checkValue(value)) { - self.setValue(value); + listeners: [ + { + eventName: BI.DynamicYearMonthPopup.EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.DynamicYearMonthPopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + 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(); + self.setValue({ + type: BI.DynamicYearMonthCombo.Static, + value: { year: date.getFullYear(), month: date.getMonth() + 1 } + }); + self.combo.hideView(); + self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); + } + }, { + 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, min: o.minDate, max: o.maxDate @@ -130,31 +136,35 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { BI.createWidget({ type: "bi.absolute", element: this, - items: [{ - el: { - type: "bi.horizontal_fill", - columnSize: ["", "fill"], - cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow", - ref: function () { - self.comboWrapper = this; + items: [ + { + el: { + type: "bi.horizontal_fill", + columnSize: ["", "fill"], + cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow", + 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: [{ - 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] - }, - top: 0, - left: 0, - right: 0, - bottom: 0 - }] + top: 0, + left: 0, + right: 0, + bottom: 0 + } + ] }); this._checkDynamicValue(o.value); }, diff --git a/src/widget/yearquarter/combo.yearquarter.js b/src/widget/yearquarter/combo.yearquarter.js index 1403d254f..b7f04c4bd 100644 --- a/src/widget/yearquarter/combo.yearquarter.js +++ b/src/widget/yearquarter/combo.yearquarter.js @@ -1,6 +1,6 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { - _consts:{ + _consts: { iconWidth: 24 }, props: { @@ -83,39 +83,45 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { ref: function () { self.popup = this; }, - listeners: [{ - eventName: BI.DynamicYearQuarterPopup.EVENT_CHANGE, - action: function () { - self.setValue(self.popup.getValue()); - self.combo.hideView(); - self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM); - } - }, { - eventName: BI.DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE, - action: function () { - self.setValue(); - self.combo.hideView(); - self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM); - } - }, { - eventName: BI.DynamicYearQuarterPopup.BUTTON_lABEL_EVENT_CHANGE, - action: function () { - var date = BI.getDate(); - self.setValue({ type: BI.DynamicYearMonthCombo.Static, value: { year: date.getFullYear(), quarter: BI.getQuarter(date) } }); - self.combo.hideView(); - self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); - } - }, { - eventName: BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE, - action: function () { - var value = self.popup.getValue(); - if (self._checkValue(value)) { - self.setValue(value); + listeners: [ + { + eventName: BI.DynamicYearQuarterPopup.EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + 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(); + self.setValue({ + type: BI.DynamicYearMonthCombo.Static, + value: { year: date.getFullYear(), quarter: BI.getQuarter(date) } + }); + self.combo.hideView(); + self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); + } + }, { + 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, min: o.minDate, max: o.maxDate @@ -133,31 +139,35 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { BI.createWidget({ type: "bi.absolute", element: this, - items: [{ - el: { - type: "bi.horizontal_fill", - columnSize: ["", "fill"], - cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow", - ref: function () { - self.comboWrapper = this; + items: [ + { + el: { + type: "bi.horizontal_fill", + columnSize: ["", "fill"], + cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow", + 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: [{ - 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] - }, - top: 0, - left: 0, - right: 0, - bottom: 0 - }] + top: 0, + left: 0, + right: 0, + bottom: 0 + } + ] }); this._checkDynamicValue(o.value); },