From b8c7e33e4e1ca110b24bb0853f0d58579e375095 Mon Sep 17 00:00:00 2001 From: git Date: Sun, 4 Jul 2021 11:15:16 +0800 Subject: [PATCH] =?UTF-8?q?td=E5=B8=83=E5=B1=80=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/layout.td.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/core/wrapper/layout/layout.td.js b/src/core/wrapper/layout/layout.td.js index 760562e93..572a810af 100644 --- a/src/core/wrapper/layout/layout.td.js +++ b/src/core/wrapper/layout/layout.td.js @@ -8,7 +8,9 @@ BI.TdLayout = BI.inherit(BI.Layout, { return BI.extend(BI.TdLayout.superclass.props.apply(this, arguments), { baseCls: "bi-td", columnSize: [], + rowSize: [], verticalAlign: BI.VerticalAlign.Middle, + horizontalAlign: BI.HorizontalAlign.Stretch, hgap: 0, vgap: 0, tgap: 0, @@ -20,10 +22,11 @@ BI.TdLayout = BI.inherit(BI.Layout, { }, render: function () { BI.TdLayout.superclass.render.apply(this, arguments); + var self = this, o = this.options; this.$table = BI.Widget._renderEngine.createElement("").attr({cellspacing: 0, cellpadding: 0}).css({ position: "relative", - width: "100%", - height: "100%", + width: (o.horizontalAlign === BI.HorizontalAlign.Center || o.horizontalAlign === BI.HorizontalAlign.Stretch) ? "100%" : "auto", + height: (o.verticalAlign !== BI.VerticalAlign.Top) ? "100%" : "auto", "border-spacing": "0px", border: "none", "border-collapse": "separate" @@ -72,9 +75,15 @@ BI.TdLayout = BI.inherit(BI.Layout, { } } + var height = o.rowSize[idx] === "" ? "" : (o.rowSize[idx] < 1 ? ((o.rowSize[idx] * 100).toFixed(1) + "%") : o.rowSize[idx]); + var tr = BI._lazyCreateWidget({ type: "bi.default", - tagName: "tr" + tagName: "tr", + height: height, + css: { + "max-height": BI.isNumber(o.rowSize[idx]) ? (o.rowSize[idx] <= 1 ? height : height / BI.pixRatio + BI.pixUnit) : height + } }); for (var i = 0; i < arr.length; i++) {