From 629519097aa3d68fa033d1da79ced139069fa31f Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 22 Jan 2021 14:35:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?KERNEL-6836=20=E6=97=B6=E9=97=B4=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=8E=A7=E4=BB=B6=E4=B8=8D=E5=81=9A=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=94=B6=E8=B5=B7=E4=B8=8D=E5=8F=91=E9=80=81confirm=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + src/widget/dynamicdate/dynamicdate.combo.js | 6 +++--- src/widget/dynamicdatetime/dynamicdatetime.combo.js | 6 +++--- src/widget/yearmonth/combo.yearmonth.js | 7 +++---- src/widget/yearquarter/combo.yearquarter.js | 7 +++---- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/changelog.md b/changelog.md index e83771b879..de60e2185f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2021-01) +- 日期类型控件不操作下拉面板收起不发Confirm事件 - 日期类型控件全系列可设置是否显示动态日期 - 日期类型控件全系列可设置最大最小日期 - 调整了combo的popup显示位置计算逻辑 diff --git a/src/widget/dynamicdate/dynamicdate.combo.js b/src/widget/dynamicdate/dynamicdate.combo.js index b313f814fd..4cda9f9b75 100644 --- a/src/widget/dynamicdate/dynamicdate.combo.js +++ b/src/widget/dynamicdate/dynamicdate.combo.js @@ -114,11 +114,11 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { }, { eventName: BI.DynamicDateTrigger.EVENT_CONFIRM, action: function () { - if (self.combo.isViewVisible()) { - return; - } var dateStore = self.storeTriggerValue; var dateObj = self.trigger.getKey(); + if (self.combo.isViewVisible() || BI.isEqual(dateObj, dateStore)) { + return; + } if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) { self.storeValue = self.trigger.getValue(); self.setValue(self.trigger.getValue()); diff --git a/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/src/widget/dynamicdatetime/dynamicdatetime.combo.js index f2b0f2c124..350a163c28 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -119,11 +119,11 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { }, { eventName: BI.DynamicDateTimeTrigger.EVENT_CONFIRM, action: function () { - if (self.combo.isViewVisible()) { - return; - } var dateStore = self.storeTriggerValue; var dateObj = self.trigger.getKey(); + if (self.combo.isViewVisible() || BI.isEqual(dateObj, dateStore)) { + return; + } if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) { self.storeValue = self.trigger.getValue(); self.setValue(self.trigger.getValue()); diff --git a/src/widget/yearmonth/combo.yearmonth.js b/src/widget/yearmonth/combo.yearmonth.js index 51d4f1c44b..a4bb5571b8 100644 --- a/src/widget/yearmonth/combo.yearmonth.js +++ b/src/widget/yearmonth/combo.yearmonth.js @@ -38,12 +38,11 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { self.fireEvent(BI.DynamicYearMonthCombo.EVENT_VALID); }); this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_CONFIRM, function () { - // 没看出来干啥的,先去掉 - // if (self.combo.isViewVisible()) { - // return; - // } var dateStore = self.storeTriggerValue; var dateObj = self.trigger.getKey(); + if (BI.isEqual(dateObj, dateStore)) { + return; + } if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) { self.storeValue = self.trigger.getValue(); self.setValue(self.trigger.getValue()); diff --git a/src/widget/yearquarter/combo.yearquarter.js b/src/widget/yearquarter/combo.yearquarter.js index 8e599e22b5..6a9f838b64 100644 --- a/src/widget/yearquarter/combo.yearquarter.js +++ b/src/widget/yearquarter/combo.yearquarter.js @@ -34,12 +34,11 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { self.combo.isViewVisible() && self.combo.hideView(); }); this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_CONFIRM, function () { - // 没看出来干啥的,先去掉 - // if (self.combo.isViewVisible()) { - // return; - // } var dateStore = self.storeTriggerValue; var dateObj = self.trigger.getKey(); + if (BI.isEqual(dateObj, dateStore)) { + return; + } if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) { self.storeValue = self.trigger.getValue(); self.setValue(self.trigger.getValue()); From 2250ed8172b459b20c3e78b028c39620cab44414 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 22 Jan 2021 16:45:14 +0800 Subject: [PATCH 2/2] update --- src/widget/dynamicdate/dynamicdate.card.js | 14 +++++++------- src/widget/year/card.dynamic.year.js | 4 ++-- src/widget/yearmonth/card.dynamic.yearmonth.js | 4 ++-- src/widget/yearquarter/card.dynamic.yearquarter.js | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/widget/dynamicdate/dynamicdate.card.js b/src/widget/dynamicdate/dynamicdate.card.js index cacb66eb50..621756ac03 100644 --- a/src/widget/dynamicdate/dynamicdate.card.js +++ b/src/widget/dynamicdate/dynamicdate.card.js @@ -284,22 +284,22 @@ BI.DynamicDateCard = BI.inherit(BI.Widget, { var valueMap = {}; switch (value.dateType) { case BI.DynamicDateCard.TYPE.YEAR: - valueMap.year = (value.offset === 0 ? -value.value : value.value); + valueMap.year = (value.offset === 0 ? -value.value : +value.value); break; case BI.DynamicDateCard.TYPE.QUARTER: - valueMap.quarter = (value.offset === 0 ? -value.value : value.value); + valueMap.quarter = (value.offset === 0 ? -value.value : +value.value); break; case BI.DynamicDateCard.TYPE.MONTH: - valueMap.month = (value.offset === 0 ? -value.value : value.value); + valueMap.month = (value.offset === 0 ? -value.value : +value.value); break; case BI.DynamicDateCard.TYPE.WEEK: - valueMap.week = (value.offset === 0 ? -value.value : value.value); + valueMap.week = (value.offset === 0 ? -value.value : +value.value); break; case BI.DynamicDateCard.TYPE.DAY: - valueMap.day = (value.offset === 0 ? -value.value : value.value); + valueMap.day = (value.offset === 0 ? -value.value : +value.value); break; case BI.DynamicDateCard.TYPE.WORK_DAY: - valueMap.workDay = (value.offset === 0 ? -value.value : value.value); + valueMap.workDay = (value.offset === 0 ? -value.value : +value.value); break; default: break; @@ -369,7 +369,7 @@ BI.DynamicDateCard = BI.inherit(BI.Widget, { } if(this.workDayBox.isSelected()) { var value = buttons[0].getValue(); - valueMap.workDay = (value.offset === 0 ? -value.value : value.value); + valueMap.workDay = (value.offset === 0 ? -value.value : +value.value); } return valueMap; } diff --git a/src/widget/year/card.dynamic.year.js b/src/widget/year/card.dynamic.year.js index cf2d83ad63..25a96ae7f6 100644 --- a/src/widget/year/card.dynamic.year.js +++ b/src/widget/year/card.dynamic.year.js @@ -48,7 +48,7 @@ BI.DynamicYearCard = BI.inherit(BI.Widget, { _checkDate: function (obj) { var o = this.options; var date = BI.DynamicDateHelper.getCalculation({ - year: (obj.offset === 0 ? -obj.value : obj.value) + year: (obj.offset === 0 ? -obj.value : +obj.value) }); return !BI.checkDateVoid(date.getFullYear(), date.getMonth() + 1, date.getDate(), o.min, o.max)[0]; @@ -82,7 +82,7 @@ BI.DynamicYearCard = BI.inherit(BI.Widget, { getValue: function () { var value = this.item.getValue(); return { - year: (value.offset === 0 ? -value.value : value.value) + year: (value.offset === 0 ? -value.value : +value.value) }; } }); diff --git a/src/widget/yearmonth/card.dynamic.yearmonth.js b/src/widget/yearmonth/card.dynamic.yearmonth.js index 7edd5a7f9c..914f1988ee 100644 --- a/src/widget/yearmonth/card.dynamic.yearmonth.js +++ b/src/widget/yearmonth/card.dynamic.yearmonth.js @@ -76,10 +76,10 @@ BI.DynamicYearMonthCard = BI.inherit(BI.Widget, { var valueMap = {}; switch (value.dateType) { case BI.DynamicDateCard.TYPE.YEAR: - valueMap.year = (value.offset === 0 ? -value.value : value.value); + valueMap.year = (value.offset === 0 ? -value.value : +value.value); break; case BI.DynamicDateCard.TYPE.MONTH: - valueMap.month = (value.offset === 0 ? -value.value : value.value); + valueMap.month = (value.offset === 0 ? -value.value : +value.value); break; default: break; diff --git a/src/widget/yearquarter/card.dynamic.yearquarter.js b/src/widget/yearquarter/card.dynamic.yearquarter.js index d0d8ca844d..45edb3579b 100644 --- a/src/widget/yearquarter/card.dynamic.yearquarter.js +++ b/src/widget/yearquarter/card.dynamic.yearquarter.js @@ -76,10 +76,10 @@ BI.DynamicYearQuarterCard = BI.inherit(BI.Widget, { var valueMap = {}; switch (value.dateType) { case BI.DynamicDateCard.TYPE.YEAR: - valueMap.year = (value.offset === 0 ? -value.value : value.value); + valueMap.year = (value.offset === 0 ? -value.value : +value.value); break; case BI.DynamicDateCard.TYPE.MONTH: - valueMap.quarter = (value.offset === 0 ? -value.value : value.value); + valueMap.quarter = (value.offset === 0 ? -value.value : +value.value); break; default: break;