From f5b4565874bc286ccc3e2a60159bcd4ab061015f Mon Sep 17 00:00:00 2001 From: git Date: Sat, 19 Jun 2021 10:44:11 +0800 Subject: [PATCH 1/6] bugfix --- src/base/single/1.text.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/single/1.text.js b/src/base/single/1.text.js index 1baae987f..ad418b961 100644 --- a/src/base/single/1.text.js +++ b/src/base/single/1.text.js @@ -65,7 +65,7 @@ tagName: "span" }); this.text.element.click(function () { - o.handler(self.getValue()); + o.handler.call(self, self.getValue()); }); BI.createWidget({ type: "bi.default", From 0e0c74b55a1470056723d48a0d85eddd3efb9024 Mon Sep 17 00:00:00 2001 From: git Date: Sat, 19 Jun 2021 10:45:16 +0800 Subject: [PATCH 2/6] bugfix --- src/base/single/1.text.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/single/1.text.js b/src/base/single/1.text.js index ad418b961..125854873 100644 --- a/src/base/single/1.text.js +++ b/src/base/single/1.text.js @@ -64,8 +64,8 @@ type: "bi.layout", tagName: "span" }); - this.text.element.click(function () { - o.handler.call(self, self.getValue()); + this.text.element.click(function (e) { + o.handler.call(self, self.getValue(), self, e); }); BI.createWidget({ type: "bi.default", From 071ee7c08fd18b56995f5afae0f3ee83fb3844aa Mon Sep 17 00:00:00 2001 From: git Date: Sat, 19 Jun 2021 13:22:28 +0800 Subject: [PATCH 3/6] bugfix --- .../wrapper/layout/flex/flex.horizontal.js | 11 +-- src/core/wrapper/layout/flex/flex.vertical.js | 13 +-- .../flex/wrapper/flex.wrapper.horizontal.js | 11 +-- .../flex/wrapper/flex.wrapper.vertical.js | 11 +-- src/core/wrapper/layout/layout.tape.js | 84 +++++++------------ 5 files changed, 53 insertions(+), 77 deletions(-) diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index a5be46b07..fce23f432 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -37,11 +37,12 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width; w.element.css({ position: "relative" }); - if (o.columnSize[i] !== "auto") { - if (o.columnSize[i] === "fill" || o.columnSize[i] === "") { + if (columnSize !== "auto") { + if (columnSize === "fill" || columnSize === "") { if (o.horizontalAlign !== BI.HorizontalAlign.Stretch) { if (o.scrollable === true || o.scrollx === true) { w.element.addClass("f-s-n"); @@ -51,10 +52,10 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { w.element.addClass("f-s-n"); } } - if (o.columnSize[i] > 0) { - w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit))); + if (columnSize > 0) { + w.element.width(columnSize <= 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); } - if (o.columnSize[i] === "fill") { + if (columnSize === "fill") { w.element.addClass("f-f"); } w.element.addClass("c-e"); diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js index c4e3b5f0d..69f1e4b3a 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -34,13 +34,14 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { }, _addElement: function (i, item) { - var w = BI.FlexVerticalLayout.superclass._addElement.apply(this, arguments); var o = this.options; + var w = BI.FlexVerticalLayout.superclass._addElement.apply(this, arguments); + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height; w.element.css({ position: "relative" }); - if (o.rowSize[i] !== "auto") { - if (o.rowSize[i] === "fill" || o.rowSize[i] === "") { + if (rowSize !== "auto") { + if (rowSize === "fill" || rowSize === "") { if (o.verticalAlign !== BI.VerticalAlign.Stretch) { if (o.scrollable === true || o.scrolly === true) { w.element.addClass("f-s-n"); @@ -50,10 +51,10 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { w.element.addClass("f-s-n"); } } - if (o.rowSize[i] > 0) { - w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit))); + if (rowSize > 0) { + w.element.height(rowSize <= 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit)); } - if (o.rowSize[i] === "fill") { + if (rowSize === "fill") { w.element.addClass("f-f"); } w.element.addClass("c-e"); diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js index 55f20992d..5d488aa17 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -33,11 +33,12 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexWrapperHorizontalLayout.superclass._addElement.apply(this, arguments); + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width; w.element.css({ position: "relative" }); - if (o.columnSize[i] !== "auto") { - if (o.columnSize[i] === "fill" || o.columnSize[i] === "") { + if (columnSize !== "auto") { + if (columnSize === "fill" || columnSize === "") { if (o.horizontalAlign !== BI.HorizontalAlign.Stretch) { if (o.scrollable === true || o.scrollx === true) { w.element.addClass("f-s-n"); @@ -47,10 +48,10 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { w.element.addClass("f-s-n"); } } - if (o.columnSize[i] > 0) { - w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit))); + if (columnSize > 0) { + w.element.width(columnSize <= 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); } - if (o.columnSize[i] === "fill") { + if (columnSize === "fill") { w.element.addClass("f-f"); this.element.addClass("f-f"); } diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js index b60ddbfd5..e95af59ce 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -33,11 +33,12 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexWrapperVerticalLayout.superclass._addElement.apply(this, arguments); + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.width; w.element.css({ position: "relative" }); - if (o.rowSize[i] !== "auto") { - if (o.rowSize[i] === "fill" || o.rowSize[i] === "") { + if (rowSize !== "auto") { + if (rowSize === "fill" || rowSize === "") { if (o.verticalAlign !== BI.VerticalAlign.Stretch) { if (o.scrollable === true || o.scrolly === true) { w.element.addClass("f-s-n"); @@ -47,10 +48,10 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { w.element.addClass("f-s-n"); } } - if (o.rowSize[i] > 0) { - w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit))); + if (rowSize > 0) { + w.element.height(rowSize <= 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit)); } - if (o.rowSize[i] === "fill") { + if (rowSize === "fill") { w.element.addClass("f-f"); this.element.addClass("f-f"); } diff --git a/src/core/wrapper/layout/layout.tape.js b/src/core/wrapper/layout/layout.tape.js index f66191d36..018cf749b 100644 --- a/src/core/wrapper/layout/layout.tape.js +++ b/src/core/wrapper/layout/layout.tape.js @@ -64,59 +64,45 @@ BI.HTapeLayout = BI.inherit(BI.Layout, { BI.any(items, function (i, item) { var w = self.getWidgetByName(self._getChildName(i)); + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width; if (BI.isNull(left[i])) { - left[i] = left[i - 1] + (o.columnSize[i - 1] || items[i - 1].width) + (items[i - 1].lgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap; + var preColumnSize = o.columnSize.length > 0 ? o.columnSize[i - 1] : items[i - 1].width; + left[i] = left[i - 1] + preColumnSize + (items[i - 1].lgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap; } - if (o.columnSize[i] < 1 && o.columnSize[i] > 0) { + if (columnSize < 1 && columnSize > 0) { w.element.css({ left: (left[i] * 100).toFixed(1) + "%", - width: (o.columnSize[i] * 100).toFixed(1) + "%" - }); - } else if (item.width < 1 && item.width >= 0) { - w.element.css({ - left: (left[i] * 100).toFixed(1) + "%", - width: (item.width * 100).toFixed(1) + "%" + width: (columnSize * 100).toFixed(1) + "%" }); } else { w.element.css({ left: (left[i] + (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit, - width: o.columnSize[i] > 0 ? o.columnSize[i] / BI.pixRatio + BI.pixUnit : - BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : "" + width: BI.isNumber(columnSize) ? columnSize / BI.pixRatio + BI.pixUnit : "" }); } - if (o.columnSize[i] === "" || o.columnSize[i] === "fill") { - return true; - } - if (o.columnSize.length <= 0 && !BI.isNumber(item.width)) { + if (columnSize === "" || columnSize === "fill") { return true; } }); BI.backAny(items, function (i, item) { var w = self.getWidgetByName(self._getChildName(i)); + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width; if (BI.isNull(right[i])) { - right[i] = right[i + 1] + (o.columnSize[i + 1] || items[i + 1].width) + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap; + var nextColumnSize = o.columnSize.length > 0 ? o.columnSize[i + 1] : items[i + 1].width; + right[i] = right[i + 1] + nextColumnSize + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap; } - if (o.columnSize[i] < 1 && o.columnSize[i] > 0) { + if (columnSize < 1 && columnSize > 0) { w.element.css({ right: (right[i] * 100).toFixed(1) + "%", - width: (o.columnSize[i] * 100).toFixed(1) + "%" - }); - } else if (item.width < 1 && item.width >= 0) { - w.element.css({ - right: (right[i] * 100).toFixed(1) + "%", - width: (item.width * 100).toFixed(1) + "%" + width: (columnSize * 100).toFixed(1) + "%" }); } else { w.element.css({ right: (right[i] + (item.rgap || 0) + (item.hgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit, - width: o.columnSize[i] > 0 ? o.columnSize[i] / BI.pixRatio + BI.pixUnit : - BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : "" + width: BI.isNumber(columnSize) ? columnSize / BI.pixRatio + BI.pixUnit : "" }); } - if (o.columnSize[i] === "" || o.columnSize[i] === "fill") { - return true; - } - if (o.columnSize.length <= 0 && !BI.isNumber(item.width)) { + if (columnSize === "" || columnSize === "fill") { return true; } }); @@ -204,59 +190,45 @@ BI.VTapeLayout = BI.inherit(BI.Layout, { BI.any(items, function (i, item) { var w = self.getWidgetByName(self._getChildName(i)); + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height; if (BI.isNull(top[i])) { - top[i] = top[i - 1] + (o.rowSize[i - 1] || items[i - 1].height) + (items[i - 1].tgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap; + var preRowSize = o.rowSize.length > 0 ? o.rowSize[i - 1] : items[i - 1].height; + top[i] = top[i - 1] + preRowSize + (items[i - 1].tgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap; } - if (o.rowSize[i] < 1 && o.rowSize[i] > 0) { + if (rowSize < 1 && rowSize > 0) { w.element.css({ top: (top[i] * 100).toFixed(1) + "%", - height: (o.rowSize[i] * 100).toFixed(1) + "%" - }); - } else if (item.height < 1 && item.height >= 0) { - w.element.css({ - top: (top[i] * 100).toFixed(1) + "%", - height: (item.height * 100).toFixed(1) + "%" + height: (rowSize * 100).toFixed(1) + "%" }); } else { w.element.css({ top: (top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit, - height: o.rowSize[i] > 0 ? o.rowSize[i] / BI.pixRatio + BI.pixUnit : - BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : "" + height: BI.isNumber(rowSize) ? rowSize / BI.pixRatio + BI.pixUnit : "" }); } - if (o.rowSize[i] === "" || o.rowSize[i] === "fill") { - return true; - } - if (o.rowSize.length <= 0 && !BI.isNumber(item.height)) { + if (rowSize === "" || rowSize === "fill") { return true; } }); BI.backAny(items, function (i, item) { var w = self.getWidgetByName(self._getChildName(i)); + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height; if (BI.isNull(bottom[i])) { - bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] || items[i + 1].height) + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap; + var nextRowSize = o.rowSize.length > 0 ? o.rowSize[i + 1] : items[i + 1].height; + bottom[i] = bottom[i + 1] + nextRowSize + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap; } - if (o.rowSize[i] < 1 && o.rowSize[i] > 0) { + if (rowSize < 1 && rowSize > 0) { w.element.css({ bottom: (bottom[i] * 100).toFixed(1) + "%", - height: (o.rowSize[i] * 100).toFixed(1) + "%" - }); - } else if (item.height < 1 && item.height >= 0) { - w.element.css({ - bottom: (bottom[i] * 100).toFixed(1) + "%", - height: (item.height * 100).toFixed(1) + "%" + height: (rowSize * 100).toFixed(1) + "%" }); } else { w.element.css({ bottom: (bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit, - height: o.rowSize[i] > 0 ? o.rowSize[i] / BI.pixRatio + BI.pixUnit : - BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : "" + height: BI.isNumber(rowSize) ? rowSize / BI.pixRatio + BI.pixUnit : "" }); } - if (o.rowSize[i] === "" || o.rowSize[i] === "fill") { - return true; - } - if (o.rowSize.length <= 0 && !BI.isNumber(item.height)) { + if (rowSize === "" || rowSize === "fill") { return true; } }); From 366a84617fd74d48f8249ef0fc2649f0e3ca545e Mon Sep 17 00:00:00 2001 From: git Date: Sat, 19 Jun 2021 13:24:25 +0800 Subject: [PATCH 4/6] bugfix --- src/core/wrapper/layout/flex/flex.horizontal.js | 2 +- src/core/wrapper/layout/flex/flex.vertical.js | 2 +- .../wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js | 2 +- src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index fce23f432..60cb474ac 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -53,7 +53,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { } } if (columnSize > 0) { - w.element.width(columnSize <= 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); + w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); } if (columnSize === "fill") { w.element.addClass("f-f"); diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js index 69f1e4b3a..3e6a20433 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -52,7 +52,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { } } if (rowSize > 0) { - w.element.height(rowSize <= 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit)); + w.element.height(rowSize < 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit)); } if (rowSize === "fill") { w.element.addClass("f-f"); diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js index 5d488aa17..f4623241d 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -49,7 +49,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { } } if (columnSize > 0) { - w.element.width(columnSize <= 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); + w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit)); } if (columnSize === "fill") { w.element.addClass("f-f"); diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js index e95af59ce..6c0e593f6 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -33,7 +33,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexWrapperVerticalLayout.superclass._addElement.apply(this, arguments); - var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.width; + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height; w.element.css({ position: "relative" }); @@ -49,7 +49,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { } } if (rowSize > 0) { - w.element.height(rowSize <= 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit)); + w.element.height(rowSize < 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit)); } if (rowSize === "fill") { w.element.addClass("f-f"); From d48f00d6fdc1a95d4ed3b880932d9ed8847afc4e Mon Sep 17 00:00:00 2001 From: git Date: Sat, 19 Jun 2021 13:28:49 +0800 Subject: [PATCH 5/6] bugfix --- src/core/wrapper/layout/adapt/adapt.table.js | 4 ++-- src/core/wrapper/layout/layout.inline.js | 2 +- src/core/wrapper/layout/layout.td.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/wrapper/layout/adapt/adapt.table.js b/src/core/wrapper/layout/adapt/adapt.table.js index 999eef248..155203624 100644 --- a/src/core/wrapper/layout/adapt/adapt.table.js +++ b/src/core/wrapper/layout/adapt/adapt.table.js @@ -35,7 +35,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var td; - var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]); + var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] < 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]); if (!this.hasWidget(this._getChildName(i))) { var w = BI._lazyCreateWidget(item); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); @@ -53,7 +53,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, { // 1、由于直接对td设置最大宽度是在规范中未定义的, 所以要使用类似td:firstChild来迂回实现 // 2、不能给多个td设置最大宽度,这样只会平分宽度 // 3、多百分比宽度就算了 - td.element.css({"max-width": BI.isNumber(o.columnSize[i]) ? (o.columnSize[i] <= 1 ? width : width / BI.pixRatio + BI.pixUnit) : width}); + td.element.css({"max-width": BI.isNumber(o.columnSize[i]) ? (o.columnSize[i] < 1 ? width : width / BI.pixRatio + BI.pixUnit) : width}); if (i === 0) { td.element.addClass("first-element"); } diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index d75f7c9a4..ea0384782 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -37,7 +37,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, { var o = this.options; var w = BI.InlineLayout.superclass._addElement.apply(this, arguments); w.element.css({ - width: o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)), + width: o.columnSize[i] === "" ? "" : (o.columnSize[i] < 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)), position: "relative", "vertical-align": o.verticalAlign }); diff --git a/src/core/wrapper/layout/layout.td.js b/src/core/wrapper/layout/layout.td.js index 3d4cf3e9e..760562e93 100644 --- a/src/core/wrapper/layout/layout.td.js +++ b/src/core/wrapper/layout/layout.td.js @@ -102,7 +102,7 @@ BI.TdLayout = BI.inherit(BI.Layout, { }); } first(w, this.rows++, i); - var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]); + var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] < 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]); var td = BI._lazyCreateWidget({ type: "bi.default", width: width, From dfd0c38a133c02f6b7b82a54f19a1abb10fe91ed Mon Sep 17 00:00:00 2001 From: git Date: Sat, 19 Jun 2021 13:31:10 +0800 Subject: [PATCH 6/6] bugfix --- src/core/wrapper/layout/layout.table.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/wrapper/layout/layout.table.js b/src/core/wrapper/layout/layout.table.js index 65ce48362..d665c5429 100644 --- a/src/core/wrapper/layout/layout.table.js +++ b/src/core/wrapper/layout/layout.table.js @@ -69,8 +69,8 @@ BI.TableLayout = BI.inherit(BI.Layout, { abs.push(BI.extend({ top: 0, bottom: 0, - left: o.columnSize[i] <= 1 ? (left * 100).toFixed(1) + "%" : left, - width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100).toFixed(1) + "%" : o.columnSize[i] + left: o.columnSize[i] < 1 ? (left * 100).toFixed(1) + "%" : left, + width: o.columnSize[i] < 1 ? (o.columnSize[i] * 100).toFixed(1) + "%" : o.columnSize[i] }, arr[i])); left += o.columnSize[i] + (o.columnSize[i] < 1 ? 0 : o.hgap); } else { @@ -83,8 +83,8 @@ BI.TableLayout = BI.inherit(BI.Layout, { abs.push(BI.extend({ top: 0, bottom: 0, - right: o.columnSize[j] <= 1 ? (right * 100).toFixed(1) + "%" : right, - width: o.columnSize[j] <= 1 ? (o.columnSize[j] * 100).toFixed(1) + "%" : o.columnSize[j] + right: o.columnSize[j] < 1 ? (right * 100).toFixed(1) + "%" : right, + width: o.columnSize[j] < 1 ? (o.columnSize[j] * 100).toFixed(1) + "%" : o.columnSize[j] }, arr[j])); right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap); } else { @@ -96,8 +96,8 @@ BI.TableLayout = BI.inherit(BI.Layout, { abs.push(BI.extend({ top: 0, bottom: 0, - left: left <= 1 ? (left * 100).toFixed(1) + "%" : left, - right: right <= 1 ? (right * 100).toFixed(1) + "%" : right + left: left < 1 ? (left * 100).toFixed(1) + "%" : left, + right: right < 1 ? (right * 100).toFixed(1) + "%" : right }, arr[i])); } var w = BI._lazyCreateWidget({