From 1507e9b74a3dbf6097b093972802c95ca3c72ad1 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 10 May 2017 09:49:09 +0800 Subject: [PATCH 1/2] add --- bi/base.js | 7 ++++--- bi/core.js | 6 ++++-- docs/base.js | 7 ++++--- docs/core.js | 6 ++++-- src/base/single/tip/tip.tooltip.js | 7 ++++--- src/core/controller/controller.tooltips.js | 1 + src/core/widget.js | 5 +++-- 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/bi/base.js b/bi/base.js index 511fb732d7..2aedadb450 100644 --- a/bi/base.js +++ b/bi/base.js @@ -19759,6 +19759,8 @@ BI.Tooltip = BI.inherit(BI.Tip, { extraCls: "bi-tooltip", text: "", level: "success",//success或warning + stopEvent: false, + stopPropagation: false, height: 20 }) }, @@ -19767,9 +19769,8 @@ BI.Tooltip = BI.inherit(BI.Tip, { var self = this, o = this.options; this.element.addClass("tooltip-" + o.level); var fn = function (e) { - e.stopPropagation(); - e.stopEvent(); - return false; + o.stopPropagation && e.stopPropagation(); + o.stopEvent && e.stopEvent(); }; this.element.bind({ "click": fn, diff --git a/bi/core.js b/bi/core.js index 744231b761..46433d2bdf 100644 --- a/bi/core.js +++ b/bi/core.js @@ -4512,11 +4512,12 @@ BI.Widget = BI.inherit(BI.OB, { setVisible: function (visible) { if (visible === true) { this.options.invisible = false; - this.element.show(); + //用this.element.show()会把display属性改成block + this.element.css("display", ""); this._mount(); } else if (visible === false) { this.options.invisible = true; - this.element.hide(); + this.element.css("display", "none"); } this.fireEvent(BI.Events.VIEW, visible); }, @@ -16173,6 +16174,7 @@ BI.TooltipsController = BI.inherit(BI.Controller, { type: "bi.tooltip", text: text, level: level, + stopEvent: true, height: this._const.height }); }, diff --git a/docs/base.js b/docs/base.js index 511fb732d7..2aedadb450 100644 --- a/docs/base.js +++ b/docs/base.js @@ -19759,6 +19759,8 @@ BI.Tooltip = BI.inherit(BI.Tip, { extraCls: "bi-tooltip", text: "", level: "success",//success或warning + stopEvent: false, + stopPropagation: false, height: 20 }) }, @@ -19767,9 +19769,8 @@ BI.Tooltip = BI.inherit(BI.Tip, { var self = this, o = this.options; this.element.addClass("tooltip-" + o.level); var fn = function (e) { - e.stopPropagation(); - e.stopEvent(); - return false; + o.stopPropagation && e.stopPropagation(); + o.stopEvent && e.stopEvent(); }; this.element.bind({ "click": fn, diff --git a/docs/core.js b/docs/core.js index 429e62f8ff..1ad16266ec 100644 --- a/docs/core.js +++ b/docs/core.js @@ -14507,11 +14507,12 @@ BI.Widget = BI.inherit(BI.OB, { setVisible: function (visible) { if (visible === true) { this.options.invisible = false; - this.element.show(); + //用this.element.show()会把display属性改成block + this.element.css("display", ""); this._mount(); } else if (visible === false) { this.options.invisible = true; - this.element.hide(); + this.element.css("display", "none"); } this.fireEvent(BI.Events.VIEW, visible); }, @@ -21260,6 +21261,7 @@ BI.TooltipsController = BI.inherit(BI.Controller, { type: "bi.tooltip", text: text, level: level, + stopEvent: true, height: this._const.height }); }, diff --git a/src/base/single/tip/tip.tooltip.js b/src/base/single/tip/tip.tooltip.js index 8d947f6c2e..64dd0c594c 100644 --- a/src/base/single/tip/tip.tooltip.js +++ b/src/base/single/tip/tip.tooltip.js @@ -15,6 +15,8 @@ BI.Tooltip = BI.inherit(BI.Tip, { extraCls: "bi-tooltip", text: "", level: "success",//success或warning + stopEvent: false, + stopPropagation: false, height: 20 }) }, @@ -23,9 +25,8 @@ BI.Tooltip = BI.inherit(BI.Tip, { var self = this, o = this.options; this.element.addClass("tooltip-" + o.level); var fn = function (e) { - e.stopPropagation(); - e.stopEvent(); - return false; + o.stopPropagation && e.stopPropagation(); + o.stopEvent && e.stopEvent(); }; this.element.bind({ "click": fn, diff --git a/src/core/controller/controller.tooltips.js b/src/core/controller/controller.tooltips.js index 4f0c21dc48..c470722b5e 100644 --- a/src/core/controller/controller.tooltips.js +++ b/src/core/controller/controller.tooltips.js @@ -26,6 +26,7 @@ BI.TooltipsController = BI.inherit(BI.Controller, { type: "bi.tooltip", text: text, level: level, + stopEvent: true, height: this._const.height }); }, diff --git a/src/core/widget.js b/src/core/widget.js index 2cd8c3b52f..af3aed4ca5 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -208,11 +208,12 @@ BI.Widget = BI.inherit(BI.OB, { setVisible: function (visible) { if (visible === true) { this.options.invisible = false; - this.element.show(); + //用this.element.show()会把display属性改成block + this.element.css("display", ""); this._mount(); } else if (visible === false) { this.options.invisible = true; - this.element.hide(); + this.element.css("display", "none"); } this.fireEvent(BI.Events.VIEW, visible); }, From b3c33f3babf60a4260caacfd55d81214eb0335d5 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 10 May 2017 11:52:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 4 ++-- bi/core.js | 4 +++- docs/base.js | 4 ++-- docs/core.js | 4 +++- src/base/combination/combo.js | 4 ++-- src/core/func/dom.js | 4 +++- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bi/base.js b/bi/base.js index 2aedadb450..cc33c66a5e 100644 --- a/bi/base.js +++ b/bi/base.js @@ -2935,7 +2935,7 @@ BI.Combo = BI.inherit(BI.Widget, { } } }, BI.EVENT_RESPONSE_TIME, true); - self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function(e){ + self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) { debounce(e); st(e); }); @@ -3051,7 +3051,7 @@ BI.Combo = BI.inherit(BI.Widget, { break; case "top": case "top,right": - p = $.getComboPosition(this.combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['top', 'bottom', 'right', 'left'], o.offsetStyle); + p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['top', 'bottom', 'right', 'left'], o.offsetStyle); break; case "left": case "left,bottom": diff --git a/bi/core.js b/bi/core.js index 46433d2bdf..32390d7e00 100644 --- a/bi/core.js +++ b/bi/core.js @@ -17057,7 +17057,9 @@ BI.extend(jQuery, { } break; } - popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); + if(needAdaptHeight === true) { + popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); + } return position; } });/** diff --git a/docs/base.js b/docs/base.js index 2aedadb450..cc33c66a5e 100644 --- a/docs/base.js +++ b/docs/base.js @@ -2935,7 +2935,7 @@ BI.Combo = BI.inherit(BI.Widget, { } } }, BI.EVENT_RESPONSE_TIME, true); - self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function(e){ + self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) { debounce(e); st(e); }); @@ -3051,7 +3051,7 @@ BI.Combo = BI.inherit(BI.Widget, { break; case "top": case "top,right": - p = $.getComboPosition(this.combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['top', 'bottom', 'right', 'left'], o.offsetStyle); + p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['top', 'bottom', 'right', 'left'], o.offsetStyle); break; case "left": case "left,bottom": diff --git a/docs/core.js b/docs/core.js index 1ad16266ec..4631967d7a 100644 --- a/docs/core.js +++ b/docs/core.js @@ -22569,7 +22569,9 @@ BI.extend(jQuery, { } break; } - popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); + if(needAdaptHeight === true) { + popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); + } return position; } });/** diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 105339c08e..fae9df9728 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -132,7 +132,7 @@ BI.Combo = BI.inherit(BI.Widget, { } } }, BI.EVENT_RESPONSE_TIME, true); - self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function(e){ + self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) { debounce(e); st(e); }); @@ -248,7 +248,7 @@ BI.Combo = BI.inherit(BI.Widget, { break; case "top": case "top,right": - p = $.getComboPosition(this.combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['top', 'bottom', 'right', 'left'], o.offsetStyle); + p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['top', 'bottom', 'right', 'left'], o.offsetStyle); break; case "left": case "left,bottom": diff --git a/src/core/func/dom.js b/src/core/func/dom.js index 95213e37ca..b8c9d6505f 100644 --- a/src/core/func/dom.js +++ b/src/core/func/dom.js @@ -577,7 +577,9 @@ BI.extend(jQuery, { } break; } - popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); + if(needAdaptHeight === true) { + popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); + } return position; } }); \ No newline at end of file