From 6a7548de5cec889c277343ac83dd28d6dc9a5353 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 30 Mar 2021 13:54:39 +0800 Subject: [PATCH] =?UTF-8?q?left=5Fright=5Fvertical=5Fadapt=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E5=BD=93=E5=8F=B3=E8=BE=B9=E5=85=83=E7=B4=A0=E5=87=BA?= =?UTF-8?q?=E7=8E=B0invisible=E7=9A=84=E6=97=B6=E5=80=99=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/widget.js | 3 --- .../flex/flex.leftrightvertical.center.js | 18 ++++++------------ .../wrapper/flex.leftrightvertical.center.less | 11 ----------- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/core/widget.js b/src/core/widget.js index 6dda06edb..b1d1fe258 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -183,7 +183,6 @@ if (o.invisible) { // 用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 this.element.css("display", "none"); - this.element.addClass("invisible"); } }, @@ -355,11 +354,9 @@ if (visible === true) { // 用this.element.show()会把display属性改成block this.element.css("display", ""); - this.element.removeClass("invisible"); this._mount(); } else if (visible === false) { this.element.css("display", "none"); - this.element.addClass("invisible"); } this.fireEvent(BI.Events.VIEW, visible); }, diff --git a/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js b/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js index eaaeeb275..497ea9052 100644 --- a/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js +++ b/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js @@ -55,14 +55,6 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { return json; }); rightItems = BI.map(rightItems, function (i, item) { - // if (i === 0) { - if (BI.isWidget(item)) { - item.element.addClass("flex-left-auto"); - } else { - var t = BI.stripEL(item); - t.cls = (t.cls || "") + " flex-left-auto"; - } - // } var json = { el: BI.stripEL(item) }; @@ -70,9 +62,7 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { json.tgap = o.rvgap + o.rtgap + (item.tgap || 0) + (item.vgap || 0); } if (o.rhgap + o.rlgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { - if (i > 0) { - json.lgap = o.rlgap + (item.lgap || 0) + (item.hgap || 0); - } + json.lgap = o.rlgap + (item.lgap || 0) + (item.hgap || 0); } if (o.rhgap + o.rrgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { json.rgap = o.rhgap + o.rrgap + (item.rgap || 0) + (item.hgap || 0); @@ -82,7 +72,11 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { } return json; }); - return leftItems.concat(rightItems); + return leftItems.concat({ + type: "bi.flex_vertical_adapt", + cls: "flex-left-auto", + items: rightItems + }); }, resize: function () { diff --git a/src/less/core/wrapper/flex.leftrightvertical.center.less b/src/less/core/wrapper/flex.leftrightvertical.center.less index a56cbbb61..7eb867365 100644 --- a/src/less/core/wrapper/flex.leftrightvertical.center.less +++ b/src/less/core/wrapper/flex.leftrightvertical.center.less @@ -1,16 +1,5 @@ .bi-f-lr-v-c { > .flex-left-auto { margin-left: auto; - - // 当隐藏的元素出现在中间某个元素的情况 - + .flex-left-auto.invisible { - + .flex-left-auto { - margin-left: initial; - } - } - - &:not(.invisible) + .flex-left-auto { - margin-left: initial; - } } }