From eed14a4d765ee3be82d5019a595e1ab832453a5d Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 26 May 2017 14:20:24 +0800 Subject: [PATCH] update --- bi/base.css | 3 ++ bi/base.js | 9 +++++- bi/case.js | 32 +++++++++++++--------- docs/base.css | 3 ++ docs/base.js | 9 +++++- docs/case.js | 32 +++++++++++++--------- src/base/combination/combo.js | 9 +++++- src/case/combo/bubblecombo/combo.bubble.js | 32 +++++++++++++--------- src/css/base/combo/combo.bubble.css | 3 ++ src/less/base/combo/combo.bubble.less | 3 ++ 10 files changed, 93 insertions(+), 42 deletions(-) diff --git a/bi/base.css b/bi/base.css index 8270c9fb0..b9ac8ced1 100644 --- a/bi/base.css +++ b/bi/base.css @@ -32,6 +32,9 @@ /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ +.bi-bubble-combo .button-combo-triangle-wrapper { + position: fixed !important; +} .bi-bubble-combo .bubble-combo-triangle-left { z-index: 1; width: 0; diff --git a/bi/base.js b/bi/base.js index a530305ce..f3bc308c3 100644 --- a/bi/base.js +++ b/bi/base.js @@ -2903,6 +2903,7 @@ BI.Combo = BI.inherit(BI.Widget, { toggle: true, direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right isDefaultInit: false, + destroyWhenHide: false, isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustWidth: true, stopEvent: false, @@ -3088,7 +3089,13 @@ BI.Combo = BI.inherit(BI.Widget, { _hideView: function () { this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW); - this.popupView && this.popupView.invisible(); + if (this.options.destroyWhenHide === true) { + this.popupView && this.popupView.destroy(); + this.popupView = null; + this._rendered = false; + } else { + this.popupView && this.popupView.invisible(); + } this.element.removeClass(this.options.comboClass); $(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); diff --git a/bi/case.js b/bi/case.js index d98ac5789..5287d3f57 100644 --- a/bi/case.js +++ b/bi/case.js @@ -4761,6 +4761,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { toggle: true, direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right isDefaultInit: false, + destroyWhenHide: false, isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustWidth: true, stopPropagation: false, @@ -4783,6 +4784,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { toggle: o.toggle, direction: o.direction, isDefaultInit: o.isDefaultInit, + destroyWhenHide: o.destroyWhenHide, isNeedAdjustHeight: o.isNeedAdjustHeight, isNeedAdjustWidth: o.isNeedAdjustWidth, adjustLength: this._getAdjustLength(), @@ -4833,37 +4835,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { _createTriangle: function (direction) { var pos = {}, op = {}; - var adjustLength = this._getAdjustLength(); + var adjustLength = this.options.adjustLength; + var offset = this.element.offset(); + var left = offset.left, right = offset.left + this.element.outerWidth(); + var top = offset.top, bottom = offset.top + this.element.outerHeight(); switch (direction) { case "left": pos = { - top: 0, - bottom: 0, - left: -adjustLength + top: top, + height: this.element.outerHeight(), + left: left - adjustLength - this._const.TRIANGLE_LENGTH }; op = {width: this._const.TRIANGLE_LENGTH}; break; case "right": pos = { - top: 0, - bottom: 0, - right: -adjustLength + top: top, + height: this.element.outerHeight(), + left: right + adjustLength }; op = {width: this._const.TRIANGLE_LENGTH}; break; case "top": pos = { - left: 0, - right: 0, - top: -adjustLength + left: left, + width: this.element.outerWidth(), + top: top - adjustLength - this._const.TRIANGLE_LENGTH }; op = {height: this._const.TRIANGLE_LENGTH}; break; case "bottom": pos = { - left: 0, - right: 0, - bottom: -adjustLength + left: left, + width: this.element.outerWidth(), + top: bottom + adjustLength }; op = {height: this._const.TRIANGLE_LENGTH}; break; @@ -4872,6 +4877,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { } this.triangle = BI.createWidget(op, { type: "bi.center_adapt", + cls: "button-combo-triangle-wrapper", items: [{ type: "bi.layout", cls: "bubble-combo-triangle-" + direction + " bi-high-light-border" diff --git a/docs/base.css b/docs/base.css index 8270c9fb0..b9ac8ced1 100644 --- a/docs/base.css +++ b/docs/base.css @@ -32,6 +32,9 @@ /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ +.bi-bubble-combo .button-combo-triangle-wrapper { + position: fixed !important; +} .bi-bubble-combo .bubble-combo-triangle-left { z-index: 1; width: 0; diff --git a/docs/base.js b/docs/base.js index a530305ce..f3bc308c3 100644 --- a/docs/base.js +++ b/docs/base.js @@ -2903,6 +2903,7 @@ BI.Combo = BI.inherit(BI.Widget, { toggle: true, direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right isDefaultInit: false, + destroyWhenHide: false, isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustWidth: true, stopEvent: false, @@ -3088,7 +3089,13 @@ BI.Combo = BI.inherit(BI.Widget, { _hideView: function () { this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW); - this.popupView && this.popupView.invisible(); + if (this.options.destroyWhenHide === true) { + this.popupView && this.popupView.destroy(); + this.popupView = null; + this._rendered = false; + } else { + this.popupView && this.popupView.invisible(); + } this.element.removeClass(this.options.comboClass); $(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); diff --git a/docs/case.js b/docs/case.js index d98ac5789..5287d3f57 100644 --- a/docs/case.js +++ b/docs/case.js @@ -4761,6 +4761,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { toggle: true, direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right isDefaultInit: false, + destroyWhenHide: false, isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustWidth: true, stopPropagation: false, @@ -4783,6 +4784,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { toggle: o.toggle, direction: o.direction, isDefaultInit: o.isDefaultInit, + destroyWhenHide: o.destroyWhenHide, isNeedAdjustHeight: o.isNeedAdjustHeight, isNeedAdjustWidth: o.isNeedAdjustWidth, adjustLength: this._getAdjustLength(), @@ -4833,37 +4835,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { _createTriangle: function (direction) { var pos = {}, op = {}; - var adjustLength = this._getAdjustLength(); + var adjustLength = this.options.adjustLength; + var offset = this.element.offset(); + var left = offset.left, right = offset.left + this.element.outerWidth(); + var top = offset.top, bottom = offset.top + this.element.outerHeight(); switch (direction) { case "left": pos = { - top: 0, - bottom: 0, - left: -adjustLength + top: top, + height: this.element.outerHeight(), + left: left - adjustLength - this._const.TRIANGLE_LENGTH }; op = {width: this._const.TRIANGLE_LENGTH}; break; case "right": pos = { - top: 0, - bottom: 0, - right: -adjustLength + top: top, + height: this.element.outerHeight(), + left: right + adjustLength }; op = {width: this._const.TRIANGLE_LENGTH}; break; case "top": pos = { - left: 0, - right: 0, - top: -adjustLength + left: left, + width: this.element.outerWidth(), + top: top - adjustLength - this._const.TRIANGLE_LENGTH }; op = {height: this._const.TRIANGLE_LENGTH}; break; case "bottom": pos = { - left: 0, - right: 0, - bottom: -adjustLength + left: left, + width: this.element.outerWidth(), + top: bottom + adjustLength }; op = {height: this._const.TRIANGLE_LENGTH}; break; @@ -4872,6 +4877,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { } this.triangle = BI.createWidget(op, { type: "bi.center_adapt", + cls: "button-combo-triangle-wrapper", items: [{ type: "bi.layout", cls: "bubble-combo-triangle-" + direction + " bi-high-light-border" diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 7a43f7070..373fbf6ff 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -11,6 +11,7 @@ BI.Combo = BI.inherit(BI.Widget, { toggle: true, direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right isDefaultInit: false, + destroyWhenHide: false, isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustWidth: true, stopEvent: false, @@ -196,7 +197,13 @@ BI.Combo = BI.inherit(BI.Widget, { _hideView: function () { this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW); - this.popupView && this.popupView.invisible(); + if (this.options.destroyWhenHide === true) { + this.popupView && this.popupView.destroy(); + this.popupView = null; + this._rendered = false; + } else { + this.popupView && this.popupView.invisible(); + } this.element.removeClass(this.options.comboClass); $(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js index 8801475f2..0ff96ae37 100644 --- a/src/case/combo/bubblecombo/combo.bubble.js +++ b/src/case/combo/bubblecombo/combo.bubble.js @@ -15,6 +15,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { toggle: true, direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right isDefaultInit: false, + destroyWhenHide: false, isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustWidth: true, stopPropagation: false, @@ -37,6 +38,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { toggle: o.toggle, direction: o.direction, isDefaultInit: o.isDefaultInit, + destroyWhenHide: o.destroyWhenHide, isNeedAdjustHeight: o.isNeedAdjustHeight, isNeedAdjustWidth: o.isNeedAdjustWidth, adjustLength: this._getAdjustLength(), @@ -87,37 +89,40 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { _createTriangle: function (direction) { var pos = {}, op = {}; - var adjustLength = this._getAdjustLength(); + var adjustLength = this.options.adjustLength; + var offset = this.element.offset(); + var left = offset.left, right = offset.left + this.element.outerWidth(); + var top = offset.top, bottom = offset.top + this.element.outerHeight(); switch (direction) { case "left": pos = { - top: 0, - bottom: 0, - left: -adjustLength + top: top, + height: this.element.outerHeight(), + left: left - adjustLength - this._const.TRIANGLE_LENGTH }; op = {width: this._const.TRIANGLE_LENGTH}; break; case "right": pos = { - top: 0, - bottom: 0, - right: -adjustLength + top: top, + height: this.element.outerHeight(), + left: right + adjustLength }; op = {width: this._const.TRIANGLE_LENGTH}; break; case "top": pos = { - left: 0, - right: 0, - top: -adjustLength + left: left, + width: this.element.outerWidth(), + top: top - adjustLength - this._const.TRIANGLE_LENGTH }; op = {height: this._const.TRIANGLE_LENGTH}; break; case "bottom": pos = { - left: 0, - right: 0, - bottom: -adjustLength + left: left, + width: this.element.outerWidth(), + top: bottom + adjustLength }; op = {height: this._const.TRIANGLE_LENGTH}; break; @@ -126,6 +131,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { } this.triangle = BI.createWidget(op, { type: "bi.center_adapt", + cls: "button-combo-triangle-wrapper", items: [{ type: "bi.layout", cls: "bubble-combo-triangle-" + direction + " bi-high-light-border" diff --git a/src/css/base/combo/combo.bubble.css b/src/css/base/combo/combo.bubble.css index b2c553173..bb4e3c4db 100644 --- a/src/css/base/combo/combo.bubble.css +++ b/src/css/base/combo/combo.bubble.css @@ -1,6 +1,9 @@ /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ +.bi-bubble-combo .button-combo-triangle-wrapper { + position: fixed !important; +} .bi-bubble-combo .bubble-combo-triangle-left { z-index: 1; width: 0; diff --git a/src/less/base/combo/combo.bubble.less b/src/less/base/combo/combo.bubble.less index fdca54079..da74aef0c 100644 --- a/src/less/base/combo/combo.bubble.less +++ b/src/less/base/combo/combo.bubble.less @@ -1,6 +1,9 @@ @import "../../bibase"; .bi-bubble-combo { + & .button-combo-triangle-wrapper { + position: fixed !important; + } & .bubble-combo-triangle-left { z-index: 1; .solid-triangle-right(@color-bi-background-highlight);