From 3040d5d2ff7aed8424a5819ce41027156e81c7a3 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 19 Aug 2021 22:53:47 +0800 Subject: [PATCH 1/4] =?UTF-8?q?inline=E5=B8=83=E5=B1=80=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E7=94=A8=E5=9C=A8virtualgroup=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/adapt/adapt.leftrightvertical.js | 14 ---------- src/core/wrapper/layout/adapt/adapt.table.js | 26 ++++++++++--------- .../layout/fill/float.fill.horizontal.js | 2 +- src/core/wrapper/layout/layout.inline.js | 6 +++-- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js b/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js index 6eb755ece..575f1397c 100644 --- a/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js +++ b/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js @@ -80,16 +80,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { this.right.stroke(this.options.items.right); }, - update: function (opt) { - this.left.update({ - items: opt.items.left - }); - this.right.update({ - items: opt.items.right - }); - return true; - }, - addItem: function () { // do nothing throw new Error("不能添加子组件"); @@ -143,10 +133,6 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, { this.layout.resize(); }, - update: function (opt) { - return this.layout.update(opt); - }, - addItem: function () { // do nothing throw new Error("不能添加子组件"); diff --git a/src/core/wrapper/layout/adapt/adapt.table.js b/src/core/wrapper/layout/adapt/adapt.table.js index 8ea7025a8..dcec1b19a 100644 --- a/src/core/wrapper/layout/adapt/adapt.table.js +++ b/src/core/wrapper/layout/adapt/adapt.table.js @@ -24,13 +24,25 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, { this.$table = BI.Widget._renderEngine.createElement("
").css({ position: "relative", display: "table", - width: (o.horizontalAlign === BI.HorizontalAlign.Center || o.horizontalAlign === BI.HorizontalAlign.Stretch) ? "100%" : "auto", + width: (o.horizontalAlign === BI.HorizontalAlign.Center || o.horizontalAlign === BI.HorizontalAlign.Stretch || this._hasFill()) ? "100%" : "auto", height: (o.verticalAlign !== BI.VerticalAlign.Top) ? "100%" : "auto", "white-space": "nowrap" }); this.populate(this.options.items); }, + _hasFill: function () { + var o = this.options; + if (o.columnSize.length > 0) { + return o.columnSize.indexOf("fill") >= 0; + } + return BI.some(o.items, function (i, item) { + if (item.width === "fill") { + return true; + } + }); + }, + _addElement: function (i, item) { var o = this.options; var td, width = ""; @@ -40,17 +52,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, { ((columnSize * 100).toFixed(1) + "%") : (columnSize + (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap); } - function hasFill() { - if (o.columnSize.length > 0) { - return o.columnSize.indexOf("fill") >= 0; - } - return BI.some(o.items, function (i, item) { - if (item.width === "fill") { - return true; - } - }); - } - if ((BI.isNull(columnSize) || columnSize === "") && hasFill()) { + if ((BI.isNull(columnSize) || columnSize === "") && this._hasFill()) { width = 2; } if (!this.hasWidget(this._getChildName(i))) { diff --git a/src/core/wrapper/layout/fill/float.fill.horizontal.js b/src/core/wrapper/layout/fill/float.fill.horizontal.js index abcbbca57..16aee27ef 100644 --- a/src/core/wrapper/layout/fill/float.fill.horizontal.js +++ b/src/core/wrapper/layout/fill/float.fill.horizontal.js @@ -76,7 +76,7 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, { } var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0), bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0); - if (BI.isNull(item.height)) { + if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) { w.element.css({ height: "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")" }); diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index 9759c8751..8376d9827 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -48,7 +48,9 @@ BI.InlineLayout = BI.inherit(BI.Layout, { } w.element.css({ position: "relative", - "vertical-align": o.verticalAlign + "vertical-align": o.verticalAlign, + "min-width": "auto", + "max-width": "auto" }); w.element.addClass("i-item"); if (columnSize === "fill" || columnSize === "") { @@ -77,7 +79,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, { } } this._handleGap(w, item, i); - if (o.verticalAlign === BI.VerticalAlign.Stretch) { + if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) { var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0), bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0); w.element.css("height", "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")"); From 15090441febfe166ea09857a3b62636ba0a8d577 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 19 Aug 2021 22:59:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/layout.inline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index 8376d9827..b843d5ed5 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -50,7 +50,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, { position: "relative", "vertical-align": o.verticalAlign, "min-width": "auto", - "max-width": "auto" + "max-width": "none" }); w.element.addClass("i-item"); if (columnSize === "fill" || columnSize === "") { From c10ffb3382b469a1987594cfd1b6f1e7669323ee Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 19 Aug 2021 23:04:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/layout.inline.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index b843d5ed5..d83af8519 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -43,16 +43,18 @@ BI.InlineLayout = BI.inherit(BI.Layout, { columnSize = null; } } - if (columnSize > 0) { - w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); - } w.element.css({ position: "relative", "vertical-align": o.verticalAlign, + width: "auto", "min-width": "auto", "max-width": "none" }); w.element.addClass("i-item"); + + if (columnSize > 0) { + w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); + } if (columnSize === "fill" || columnSize === "") { var length = o.hgap; var fillCount = 0, autoCount = 0; From 3038599fb8ff154de7d81f0f8660cb1ad3071f97 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 19 Aug 2021 23:06:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/layout.inline.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index d83af8519..9e3b35470 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -43,18 +43,14 @@ BI.InlineLayout = BI.inherit(BI.Layout, { columnSize = null; } } + if (columnSize > 0) { + w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); + } w.element.css({ position: "relative", - "vertical-align": o.verticalAlign, - width: "auto", - "min-width": "auto", - "max-width": "none" + "vertical-align": o.verticalAlign }); w.element.addClass("i-item"); - - if (columnSize > 0) { - w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); - } if (columnSize === "fill" || columnSize === "") { var length = o.hgap; var fillCount = 0, autoCount = 0;