From cde33ae9a00845313f3508337fe1c290ac4264b7 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 3 Jan 2020 10:27:21 +0800 Subject: [PATCH 1/3] CHART-12259 && BI-58432 --- changelog.md | 3 +++ src/widget/datetimepane/card.static.datetimepane.js | 3 +-- src/widget/singleslider/singleslider.js | 4 +++- src/widget/singleslider/singleslider.label.js | 2 +- src/widget/singleslider/singleslider.normal.js | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 251859dd5f..1c0dec9911 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 更新日志 +2.0(2020-1) +- 修复单值系滑块滑动松手后发两次EVENT_CHANGE的问题 + 2.0(2019-12) - 修复多层级单选下拉树主动设置container后搜索面板弹出问题 - bi.search_editor支持搜索中间含有空格的字符串 diff --git a/src/widget/datetimepane/card.static.datetimepane.js b/src/widget/datetimepane/card.static.datetimepane.js index c94f7592db..f17fe91041 100644 --- a/src/widget/datetimepane/card.static.datetimepane.js +++ b/src/widget/datetimepane/card.static.datetimepane.js @@ -36,8 +36,7 @@ BI.StaticDateTimePaneCard = BI.inherit(BI.Widget, { } self.selectedTime = BI.extend(self.selectedTime, { year: value.year, - month: value.month, - day: day + month: value.month }); day !== 0 && (self.selectedTime.day = day); self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); diff --git a/src/widget/singleslider/singleslider.js b/src/widget/singleslider/singleslider.js index c3c8e2c6e7..1a1f1aabec 100644 --- a/src/widget/singleslider/singleslider.js +++ b/src/widget/singleslider/singleslider.js @@ -52,7 +52,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { }); // 这边其实是有问题的,拖拽区域是个圆,在圆的边缘拖拽后放开,这边计算出来的蓝条宽度实际上会比放开时长一点或者短一点 sliderVertical.element.click(function (e) { - if (self.enable && self.isEnabled()) { + if (self.enable && self.isEnabled() && sliderVertical.element[0] === e.originalEvent.target) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0; @@ -71,6 +71,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { v = o.digit === false ? v : v.toFixed(o.digit); self.label.setValue(v); self.value = v; + console.log("click"); self.fireEvent(BI.SingleSlider.EVENT_CHANGE); } }); @@ -173,6 +174,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { } widget.element.removeClass("dragging"); mouseMoveTracker.releaseMouseMoves(); + console.log("drag"); self.fireEvent(BI.SingleSlider.EVENT_CHANGE); }, window); widget.element.on("mousedown", function (event) { diff --git a/src/widget/singleslider/singleslider.label.js b/src/widget/singleslider/singleslider.label.js index 034d22f141..fce46f0133 100644 --- a/src/widget/singleslider/singleslider.label.js +++ b/src/widget/singleslider/singleslider.label.js @@ -54,7 +54,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, { height: c.SLIDER_HEIGHT }); sliderVertical.element.click(function (e) { - if (self.enable && self.isEnabled()) { + if (self.enable && self.isEnabled() && sliderVertical.element[0] === e.originalEvent.target) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0; diff --git a/src/widget/singleslider/singleslider.normal.js b/src/widget/singleslider/singleslider.normal.js index 347906fae3..2ba74c8b98 100644 --- a/src/widget/singleslider/singleslider.normal.js +++ b/src/widget/singleslider/singleslider.normal.js @@ -42,7 +42,7 @@ BI.SingleSliderNormal = BI.inherit(BI.Single, { height: c.SLIDER_HEIGHT }); sliderVertical.element.click(function (e) { - if (self.enable && self.isEnabled()) { + if (self.enable && self.isEnabled() && sliderVertical.element[0] === e.originalEvent.target) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0; From f0fcfab1cb1b59090b45adaa853c5228b2967c1f Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 3 Jan 2020 11:41:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8E=BB=E6=8E=89console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/singleslider/singleslider.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/widget/singleslider/singleslider.js b/src/widget/singleslider/singleslider.js index 1a1f1aabec..eb0a700c70 100644 --- a/src/widget/singleslider/singleslider.js +++ b/src/widget/singleslider/singleslider.js @@ -71,7 +71,6 @@ BI.SingleSlider = BI.inherit(BI.Single, { v = o.digit === false ? v : v.toFixed(o.digit); self.label.setValue(v); self.value = v; - console.log("click"); self.fireEvent(BI.SingleSlider.EVENT_CHANGE); } }); @@ -174,7 +173,6 @@ BI.SingleSlider = BI.inherit(BI.Single, { } widget.element.removeClass("dragging"); mouseMoveTracker.releaseMouseMoves(); - console.log("drag"); self.fireEvent(BI.SingleSlider.EVENT_CHANGE); }, window); widget.element.on("mousedown", function (event) { From 52a569fc00b1f03d2c1e871f02f12f04de0b3b98 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 3 Jan 2020 16:06:48 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=B0=8F=E6=95=B0=E4=BD=8D=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/intervalslider/intervalslider.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/widget/intervalslider/intervalslider.js b/src/widget/intervalslider/intervalslider.js index a90a65f819..71b9c95d4f 100644 --- a/src/widget/intervalslider/intervalslider.js +++ b/src/widget/intervalslider/intervalslider.js @@ -514,13 +514,14 @@ BI.IntervalSlider = BI.inherit(BI.Single, { }, populate: function () { + var o = this.options; if (!isNaN(this.min) && !isNaN(this.max)) { this.enable = true; this._setVisible(true); this._setErrorText(); if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { - this.labelOne.setValue(this.valueOne); - this.labelTwo.setValue(this.valueTwo); + this.labelOne.setValue(o.digit === false ? this.valueOne : BI.parseFloat(this.valueOne).toFixed(o.digit)); + this.labelTwo.setValue(o.digit === false ? this.valueTwo : BI.parseFloat(this.valueTwo).toFixed(o.digit)); this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); } else { this.labelOne.setValue(this.min);