From b01c235f1ab3a3a75416cfd11c08946a7c737bed Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 27 Jul 2020 12:14:17 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-35908=20&&=20REPORT-36013=20fix:=20?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=97=A5=E6=9C=9Fvalue=E4=B8=8D=E5=9C=A8min?= =?UTF-8?q?=E5=92=8Cmax=E4=B9=8B=E9=97=B4=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E7=81=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + src/case/calendar/calendar.js | 2 -- src/widget/date/calendar/picker.date.js | 47 +++++++++++++++++-------- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/changelog.md b/changelog.md index ead4d92ef..cf2eccb14 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-07) +- 修复了日期类型控件设置一个不在minDate和maxDate之间的日期值时,面板灰化与翻页按钮状态不对的问题 - BI.OB的on方法返回一个解除监听的函数 - 修复了grid_view执行_unMount时不调用子组件的_unMount的问题 - combo新增belowMouse属性,允许popup在点击处弹出 diff --git a/src/case/calendar/calendar.js b/src/case/calendar/calendar.js index 9d2ed758b..56507ab34 100644 --- a/src/case/calendar/calendar.js +++ b/src/case/calendar/calendar.js @@ -23,8 +23,6 @@ BI.Calendar = BI.inherit(BI.Widget, { var self = this, o = this.options, log = {}, De = BI.getDate(); var mins = o.min.match(/\d+/g); var maxs = o.max.match(/\d+/g); - Y < (mins[0] | 0) && (Y = (mins[0] | 0)); - Y > (maxs[0] | 0) && (Y = (maxs[0] | 0)); De.setFullYear(Y, M, D); log.ymd = [De.getFullYear(), De.getMonth(), De.getDate()]; diff --git a/src/widget/date/calendar/picker.date.js b/src/widget/date/calendar/picker.date.js index 2d840b2b0..bf6abd378 100644 --- a/src/widget/date/calendar/picker.date.js +++ b/src/widget/date/calendar/picker.date.js @@ -136,49 +136,68 @@ BI.DatePicker = BI.inherit(BI.Widget, { if (!BI.contains(allowMonth, month)) { month = allowMonth[0]; } + return month; }, _getAllowMonths: function () { - var self = this, o = this.options; - var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); - var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); - minDate.setDate(1); - maxDate.setDate(1); - var calcMin = BI.print(minDate, "%Y-%X-%d"); - var calcMax = BI.print(maxDate, "%Y-%X-%d"); + var obj = this._getCheckMinMaxDate(); + var year = this.year.getValue() || this._year; return BI.filter(BI.range(1, 13), function (idx, v) { - return !BI.checkDateVoid(self.year.getValue(), v, 1, calcMin, calcMax)[0]; + return !BI.checkDateVoid(year, v, 1, obj.min, obj.max)[0]; }); }, + // 上一年月不合法则灰化 _checkLeftValid: function () { - var o = this.options; - var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); - var valid = !(this._month <= (minDate.getMonth() + 1) && this._year <= minDate.getFullYear()); + var obj = this._getCheckMinMaxDate(); + var year = this._month === 1 ? this._year - 1 : this._year; + var month = this._month === 1 ? 12 : this.month - 1; + var valid = BI.isNull(BI.checkDateVoid(year, month, 1, obj.min, obj.max)[0]); this.left.setEnable(valid); return valid; }, + // 下一年月不合法则灰化 _checkRightValid: function () { - var o = this.options; - var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); - var valid = !(this._month >= (maxDate.getMonth() + 1) && this._year >= maxDate.getFullYear()); + var obj = this._getCheckMinMaxDate(); + var year = this._month === 12 ? this._year + 1 : this._year; + var month = this._month === 12 ? 1 : this.month + 1; + var valid = BI.isNull(BI.checkDateVoid(year, month, 1, obj.min, obj.max)[0]); this.right.setEnable(valid); return valid; }, + _getCheckMinMaxDate() { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); + var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + minDate.setDate(1); + maxDate.setDate(1); + + return { + min: BI.print(minDate, "%Y-%X-%d"), + max: BI.print(maxDate, "%Y-%X-%d") + }; + }, + setMinDate: function (minDate) { this.options.min = minDate; this.year.setMinDate(minDate); + this._refreshMonth(); + this._checkLeftValid(); + this._checkRightValid(); }, setMaxDate: function (maxDate) { this.options.max = maxDate; this.year.setMaxDate(maxDate); + this._refreshMonth(); + this._checkLeftValid(); + this._checkRightValid(); }, setValue: function (ob) { From 72f0b99b6ca354294723e8ed45cde072493178ad Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 27 Jul 2020 15:55:43 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/date/calendar/picker.date.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/date/calendar/picker.date.js b/src/widget/date/calendar/picker.date.js index bf6abd378..2c4e312a7 100644 --- a/src/widget/date/calendar/picker.date.js +++ b/src/widget/date/calendar/picker.date.js @@ -171,7 +171,7 @@ BI.DatePicker = BI.inherit(BI.Widget, { return valid; }, - _getCheckMinMaxDate() { + _getCheckMinMaxDate: function() { var o = this.options; var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); From ac9194e0c971adcafc747eb6b5f9d50b330fb568 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 27 Jul 2020 17:04:43 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/date/calendar/picker.date.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/date/calendar/picker.date.js b/src/widget/date/calendar/picker.date.js index 2c4e312a7..21258aadf 100644 --- a/src/widget/date/calendar/picker.date.js +++ b/src/widget/date/calendar/picker.date.js @@ -87,7 +87,7 @@ BI.DatePicker = BI.inherit(BI.Widget, { }); this.month.on(BI.MonthDateCombo.EVENT_CHANGE, function () { self.setValue({ - year: self.year.getValue(), + year: self.year.getValue() || self._year, month: self.month.getValue(), }); self.fireEvent(BI.DatePicker.EVENT_CHANGE); From a29ece4bf872a03459a0e46498bc914f265b6681 Mon Sep 17 00:00:00 2001 From: Guyi Date: Tue, 28 Jul 2020 10:04:08 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8C=85=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 60f222663..2f80c1469 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "types": "dist/lib/index.d.ts", "dependencies": {}, "devDependencies": { + "@babel/polyfill": "7.6.0", "@fui/babel-preset-fineui": "^1.0.0", "@fui/eslint-plugin": "1.0.7", "@typescript-eslint/eslint-plugin": "1.11.0", From 6c52318f29d0f3ce2c77f30ed29eb3dea721db1c Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 28 Jul 2020 12:18:05 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=9D=E8=AF=81=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/input/file.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index eb55755c7..76b140658 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -103,6 +103,7 @@ // FireFox 3+, Safari 4 beta (Chrome 2 beta file is buggy and will not work) if (xhr.upload || xhr.sendAsBinary) { sendFile = function (handler, maxSize, width, height) { + var current = handler.current; if (-1 < maxSize && maxSize < handler.file.fileSize) { if (isFunction(handler.onerror)) { handler.onerror(); @@ -190,7 +191,7 @@ if (handler.file.type.indexOf("image") != -1) { attachO.attach_type = "image"; } - handler.attach_array.push(attachO); + handler.attach_array[current] = attachO; } else { upload["onerror"]({}); } @@ -211,7 +212,7 @@ handler.attach_array[0] = attachO; // handler.attach_array.push(attachO); } else { - handler.attach_array.push(attachO); + handler.attach_array[current] = attachO; } break; } @@ -238,6 +239,7 @@ // Internet Explorer, Opera, others else { sendFile = function (handler, maxSize, width, height) { + var current = handler.current; var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"), rpe = { loaded: 1, total: 100, simulation: true, interval: setInterval(function () { @@ -272,7 +274,7 @@ if (handler.maxlength == 1) { handler.attach_array[0] = attachO; } else { - handler.attach_array.push(attachO); + handler.attach_array[current] = attachO; } } catch (e) { if (isFunction(handler.onerror)) { @@ -645,4 +647,4 @@ BI.File.EVENT_PROGRESS = "EVENT_PROGRESS"; BI.File.EVENT_UPLOADED = "EVENT_UPLOADED"; BI.shortcut("bi.file", BI.File); -})(_global.document || {}); \ No newline at end of file +})(_global.document || {}); From 92de06fbfca52fcf8d46b89a164e01ae453f0aa7 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 29 Jul 2020 13:40:36 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/date/calendar/picker.date.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widget/date/calendar/picker.date.js b/src/widget/date/calendar/picker.date.js index 21258aadf..dbb28bb72 100644 --- a/src/widget/date/calendar/picker.date.js +++ b/src/widget/date/calendar/picker.date.js @@ -153,7 +153,7 @@ BI.DatePicker = BI.inherit(BI.Widget, { _checkLeftValid: function () { var obj = this._getCheckMinMaxDate(); var year = this._month === 1 ? this._year - 1 : this._year; - var month = this._month === 1 ? 12 : this.month - 1; + var month = this._month === 1 ? 12 : this._month - 1; var valid = BI.isNull(BI.checkDateVoid(year, month, 1, obj.min, obj.max)[0]); this.left.setEnable(valid); @@ -164,7 +164,7 @@ BI.DatePicker = BI.inherit(BI.Widget, { _checkRightValid: function () { var obj = this._getCheckMinMaxDate(); var year = this._month === 12 ? this._year + 1 : this._year; - var month = this._month === 12 ? 1 : this.month + 1; + var month = this._month === 12 ? 1 : this._month + 1; var valid = BI.isNull(BI.checkDateVoid(year, month, 1, obj.min, obj.max)[0]); this.right.setEnable(valid);