From d3f2187770506d35805411d58cd8a64bd7c90630 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 26 Mar 2021 16:01:37 +0800 Subject: [PATCH 01/28] =?UTF-8?q?left=5Fright=5Fvertical=5Fadapt=E6=8D=A2?= =?UTF-8?q?=E4=B8=80=E7=A7=8D=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 37 +++++-- .../flex/flex.leftrightvertical.center.js | 102 ++++++++++++++++++ .../flex.leftrightvertical.center.less | 5 + 3 files changed, 136 insertions(+), 8 deletions(-) create mode 100644 src/core/wrapper/layout/flex/flex.leftrightvertical.center.js create mode 100644 src/less/core/wrapper/flex.leftrightvertical.center.less diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index ea1c29cf6..65174dd2e 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -23,8 +23,11 @@ BI.prepares.push(function () { if (ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch) { return BI.extend({}, ob, {type: "bi.table_adapt"}); } - if (!isIE && supportFlex) { - return BI.extend({}, ob, {type: "bi.flex_horizontal"}); + if (supportFlex) { + // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 + if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, {type: "bi.flex_horizontal"}); + } } // // 解决使用inline_vertical_adapt的顺序问题 // // 从右往左放置时,为了兼容,我们统一采用从右到左的放置方式 @@ -40,8 +43,11 @@ BI.prepares.push(function () { var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; if (!isAdapt || justOneItem) { - if (!isIE && supportFlex) { - return BI.extend({}, ob, {type: "bi.flex_center_adapt"}); + if (supportFlex) { + // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 + if (!isIE || (ob.scrollable !== true && ob.scrollx !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, {type: "bi.flex_center_adapt"}); + } } return BI.extend({}, ob, {type: "bi.inline_center_adapt"}); } @@ -51,8 +57,11 @@ BI.prepares.push(function () { var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; if (!isAdapt || justOneItem) { - if (!isIE && supportFlex) { - return BI.extend({}, ob, {type: "bi.flex_vertical_center_adapt"}); + if (supportFlex) { + // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 + if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, {type: "bi.flex_vertical_adapt"}); + } } return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"}); } @@ -68,11 +77,23 @@ BI.prepares.push(function () { return ob; }); BI.Plugin.configWidget("bi.horizontal_float", function (ob) { - if (!BI.isIE() && isSupportFlex()) { - return BI.extend({}, ob, {type: "bi.flex_horizontal_adapt"}); + if (isSupportFlex()) { + // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 + if (!BI.isIE() || (ob.scrollable !== true && ob.scrollx !== true)) { + return BI.extend({}, ob, {type: "bi.flex_horizontal_adapt"}); + } } return BI.extend({}, ob, {type: "bi.inline_horizontal_adapt"}); }); + BI.Plugin.configWidget("bi.left_right_vertical_adapt", function (ob) { + if (isSupportFlex()) { + // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 + if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, {type: "bi.flex_left_right_vertical_adapt"}); + } + } + return ob; + }); BI.Plugin.configWidget("bi.flex_horizontal", function (ob) { if (ob.scrollable === true || ob.scrolly === true) { diff --git a/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js b/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js new file mode 100644 index 000000000..47a8194c1 --- /dev/null +++ b/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js @@ -0,0 +1,102 @@ +BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { + props: function () { + return BI.extend(BI.FlexLeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), { + baseCls: "bi-f-lr-v-c", + items: {}, + llgap: 0, + lrgap: 0, + lhgap: 0, + ltgap: 0, + lbgap: 0, + lvgap: 0, + rlgap: 0, + rrgap: 0, + rhgap: 0, + rtgap: 0, + rbgap: 0, + rvgap: 0 + }); + }, + render: function () { + var o = this.options, self = this; + BI.FlexLeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); + return { + type: "bi.flex_vertical_adapt", + ref: function (_ref) { + self.layout = _ref; + }, + items: this._formatItems(), + scrollx: o.scrollx, + scrolly: o.scrolly, + scrollable: o.scrollable + }; + }, + + _formatItems: function () { + var o = this.options; + var leftItems = o.items.left || []; + var rightItems = o.items.right || []; + leftItems = BI.map(leftItems, function (i, item) { + var json = { + el: BI.stripEL(item) + }; + if (o.lvgap + o.ltgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { + json.tgap = o.lvgap + o.ltgap + (item.tgap || 0) + (item.vgap || 0); + } + if (o.lhgap + o.llgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { + json.lgap = (i === 0 ? o.lhgap : 0) + o.llgap + (item.lgap || 0) + (item.hgap || 0); + } + if (o.lhgap + o.lrgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { + json.rgap = o.lhgap + o.lrgap + (item.rgap || 0) + (item.hgap || 0); + } + if (o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { + json.bgap = o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0); + } + return json; + }); + rightItems = BI.map(rightItems, function (i, item) { + if (i === 0) { + if (BI.isWidget(item)) { + item.addClass("flex-left-auto"); + } else { + var t = BI.stripEL(item); + t.cls = (t.cls || "") + " flex-left-auto"; + } + } + var json = { + el: BI.stripEL(item) + }; + if (o.rvgap + o.rtgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { + 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); + } + } + if (o.rhgap + o.rrgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { + json.rgap = o.rhgap + o.rrgap + (item.rgap || 0) + (item.hgap || 0); + } + if (o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { + json.bgap = o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0); + } + return json; + }); + return leftItems.concat(rightItems); + }, + + resize: function () { + // console.log("left_right_vertical_adapt布局不需要resize"); + }, + + addItem: function () { + // do nothing + throw new Error("cannot be added"); + }, + + populate: function (items) { + this.options.items = items; + this.layout.populate(this._formatItems()); + } +}); +BI.shortcut("bi.flex_left_right_vertical_adapt", BI.FlexLeftRightVerticalAdaptLayout); diff --git a/src/less/core/wrapper/flex.leftrightvertical.center.less b/src/less/core/wrapper/flex.leftrightvertical.center.less new file mode 100644 index 000000000..7eb867365 --- /dev/null +++ b/src/less/core/wrapper/flex.leftrightvertical.center.less @@ -0,0 +1,5 @@ +.bi-f-lr-v-c { + > .flex-left-auto { + margin-left: auto; + } +} From d5b458709261a3b8b75a1b93ebe0501359c94be8 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 26 Mar 2021 22:21:16 +0800 Subject: [PATCH 02/28] =?UTF-8?q?inline=E5=B8=83=E5=B1=80=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=94=A8calc=E8=AE=A1=E7=AE=97fill=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/adapt/inline.center.js | 11 +++++++++++ src/core/wrapper/layout/adapt/inline.horizontal.js | 11 +++++++++++ src/core/wrapper/layout/adapt/inline.vertical.js | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/src/core/wrapper/layout/adapt/inline.center.js b/src/core/wrapper/layout/adapt/inline.center.js index 819252093..3e0d39040 100644 --- a/src/core/wrapper/layout/adapt/inline.center.js +++ b/src/core/wrapper/layout/adapt/inline.center.js @@ -43,6 +43,17 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, { "vertical-align": o.verticalAlign }); w.element.addClass("i-c-a-item"); + if (o.columnSize[i] === "fill") { + var left = o.hgap + (item.lgap || 0) + (item.hgap || 0), + right = o.hgap + (item.rgap || 0) + (item.hgap || 0); + for (var k = 0; k < i; k++) { + left += o.hgap + o.lgap + o.rgap + o.columnSize[k]; + } + for (var k = i + 1; k < o.columnSize.length; k++) { + right += o.hgap + o.lgap + o.rgap + o.columnSize[k]; + } + w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); + } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit diff --git a/src/core/wrapper/layout/adapt/inline.horizontal.js b/src/core/wrapper/layout/adapt/inline.horizontal.js index 7667d4587..917c34fec 100644 --- a/src/core/wrapper/layout/adapt/inline.horizontal.js +++ b/src/core/wrapper/layout/adapt/inline.horizontal.js @@ -43,6 +43,17 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, { "vertical-align": o.verticalAlign }); w.element.addClass("i-h-a-item"); + if (o.columnSize[i] === "fill") { + var left = o.hgap + (item.lgap || 0) + (item.hgap || 0), + right = o.hgap + (item.rgap || 0) + (item.hgap || 0); + for (var k = 0; k < i; k++) { + left += o.hgap + o.lgap + o.rgap + o.columnSize[k]; + } + for (var k = i + 1; k < o.columnSize.length; k++) { + right += o.hgap + o.lgap + o.rgap + o.columnSize[k]; + } + w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); + } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit diff --git a/src/core/wrapper/layout/adapt/inline.vertical.js b/src/core/wrapper/layout/adapt/inline.vertical.js index 9918066b6..e753ba36d 100644 --- a/src/core/wrapper/layout/adapt/inline.vertical.js +++ b/src/core/wrapper/layout/adapt/inline.vertical.js @@ -43,6 +43,17 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, { "vertical-align": o.verticalAlign }); w.element.addClass("i-v-a-item"); + if (o.columnSize[i] === "fill") { + var left = o.hgap + (item.lgap || 0) + (item.hgap || 0), + right = o.hgap + (item.rgap || 0) + (item.hgap || 0); + for (var k = 0; k < i; k++) { + left += o.hgap + o.lgap + o.rgap + o.columnSize[k]; + } + for (var k = i + 1; k < o.columnSize.length; k++) { + right += o.hgap + o.lgap + o.rgap + o.columnSize[k]; + } + w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); + } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit From c1aa4fd0fc825b82f8bff24c993325741f87aca7 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 26 Mar 2021 22:23:34 +0800 Subject: [PATCH 03/28] =?UTF-8?q?inline=E5=B8=83=E5=B1=80=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=94=A8calc=E8=AE=A1=E7=AE=97fill=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index d0aa79f1b..93eaf86ec 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ # 更新日志 2.0(2021-03) +- 优化left_right_vertical_adapt布局,去掉float布局只使用flex +- inline布局支持用calc计算fill列宽度 - 时间类型控件无翻页限制 - 时间类型控件优化动态时间面板的交互 From 0df70053857aa35f1d22cb0ad573bee13beadd4d Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 26 Mar 2021 22:38:48 +0800 Subject: [PATCH 04/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/adapt/adapt.table.js | 2 +- src/core/wrapper/layout/layout.horizontal.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/wrapper/layout/adapt/adapt.table.js b/src/core/wrapper/layout/adapt/adapt.table.js index c612227ef..47f0ed9d9 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] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : o.columnSize[i]; + var width = 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"}); diff --git a/src/core/wrapper/layout/layout.horizontal.js b/src/core/wrapper/layout/layout.horizontal.js index c8103ad2d..440b0d60f 100644 --- a/src/core/wrapper/layout/layout.horizontal.js +++ b/src/core/wrapper/layout/layout.horizontal.js @@ -39,7 +39,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var td; - var width = o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : o.columnSize[i]; + var width = 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", margin: "0px auto"}); From bd7f97fb30989c445864b447164dcb93a9ec2790 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 00:16:45 +0800 Subject: [PATCH 05/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 12 +++++ .../wrapper/layout/flex/flex.horizontal.js | 6 +-- src/core/wrapper/layout/flex/flex.vertical.js | 6 +-- .../flex/wrapper/flex.wrapper.horizontal.js | 6 +-- .../flex/wrapper/flex.wrapper.vertical.js | 6 +-- src/core/wrapper/layout/layout.td.js | 45 ++++++++++--------- src/less/core/wrapper/flex.horizontal.less | 4 +- src/less/core/wrapper/flex.vertical.less | 4 +- .../core/wrapper/flex.wrapper.horizontal.less | 4 +- .../core/wrapper/flex.wrapper.vertical.less | 4 +- 10 files changed, 56 insertions(+), 41 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 65174dd2e..78cf5bffa 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -21,6 +21,18 @@ BI.prepares.push(function () { // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景 if (ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch) { + var justOneItem = (ob.items && ob.items.length <= 1); + // 在这种情况下,也可以通过flex支持该布局 + if (supportFlex) { + // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 + if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, { + type: "bi.flex_horizontal", + horizontalAlign: !justOneItem && ob.horizontalAlign === BI.HorizontalAlign.Center + ? BI.HorizontalAlign.Left : ob.horizontalAlign + }); + } + } return BI.extend({}, ob, {type: "bi.table_adapt"}); } if (supportFlex) { diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index 11f751526..f7a06d415 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -36,16 +36,16 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { }); if (o.columnSize[i] !== "auto") { if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] !== "") { - w.element.addClass("fill"); + w.element.addClass("f-f"); } else { - w.element.addClass("shrink-none"); + w.element.addClass("f-s-n"); } } if (o.columnSize[i] > 0) { w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)); } if (o.columnSize[i] === "fill") { - w.element.addClass("fill"); + w.element.addClass("f-f"); } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js index d071d410a..29eb17179 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -35,16 +35,16 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { }); if (o.rowSize[i] !== "auto") { if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] !== "") { - w.element.addClass("fill"); + w.element.addClass("f-f"); } else { - w.element.addClass("shrink-none"); + w.element.addClass("f-s-n"); } } if (o.rowSize[i] > 0) { w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)); } if (o.rowSize[i] === "fill") { - w.element.addClass("fill"); + w.element.addClass("f-f"); } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ 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 33fd1e4d6..7b81608e7 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -37,16 +37,16 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { }); if (o.columnSize[i] !== "auto") { if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] !== "") { - w.element.addClass("fill"); + w.element.addClass("f-f"); } else { - w.element.addClass("shrink-none"); + w.element.addClass("f-s-n"); } } if (o.columnSize[i] > 0) { w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)); } if (o.columnSize[i] === "fill") { - w.element.addClass("fill"); + w.element.addClass("f-f"); } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ 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 f11e1bf15..39a18f6e9 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -37,16 +37,16 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { }); if (o.rowSize[i] !== "auto") { if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] !== "") { - w.element.addClass("fill"); + w.element.addClass("f-f"); } else { - w.element.addClass("shrink-none"); + w.element.addClass("f-s-n"); } } if (o.rowSize[i] > 0) { w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)); } if (o.rowSize[i] === "fill") { - w.element.addClass("fill"); + w.element.addClass("f-f"); } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ diff --git a/src/core/wrapper/layout/layout.td.js b/src/core/wrapper/layout/layout.td.js index 46b42f238..d8e8cc3a5 100644 --- a/src/core/wrapper/layout/layout.td.js +++ b/src/core/wrapper/layout/layout.td.js @@ -7,20 +7,14 @@ BI.TdLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.TdLayout.superclass.props.apply(this, arguments), { baseCls: "bi-td", - columnSize: [200, 200, 200], + columnSize: [], hgap: 0, vgap: 0, - items: [[ - { - el: {text: "label1"} - }, - { - el: {text: "label2"} - }, - { - el: {text: "label3"} - } - ]] + tgap: 0, + bgap: 0, + lgap: 0, + rgap: 0, + items: [] }); }, render: function () { @@ -85,22 +79,31 @@ BI.TdLayout = BI.inherit(BI.Layout, { for (var i = 0; i < arr.length; i++) { var w = BI._lazyCreateWidget(arr[i]); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); - if (arr[i].lgap) { - w.element.css({"margin-left": arr[i].lgap / BI.pixRatio + BI.pixUnit}); + var item = arr[i]; + if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { + w.element.css({ + "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit + }); } - if (arr[i].rgap) { - w.element.css({"margin-right": arr[i].rgap / BI.pixRatio + BI.pixUnit}); + if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { + w.element.css({ + "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit + }); } - if (arr[i].tgap) { - w.element.css({"margin-top": arr[i].tgap / BI.pixRatio + BI.pixUnit}); + if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { + w.element.css({ + "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit + }); } - if (arr[i].bgap) { - w.element.css({"margin-bottom": arr[i].bgap / BI.pixRatio + BI.pixUnit}); + if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { + w.element.css({ + "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit + }); } first(w, this.rows++, i); var td = BI._lazyCreateWidget({ type: "bi.default", - width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : o.columnSize[i], + width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i], tagName: "td", items: [w] }); diff --git a/src/less/core/wrapper/flex.horizontal.less b/src/less/core/wrapper/flex.horizontal.less index a2536dee1..c20a7c55a 100644 --- a/src/less/core/wrapper/flex.horizontal.less +++ b/src/less/core/wrapper/flex.horizontal.less @@ -122,14 +122,14 @@ justify-content: flex-end; } - > .shrink-none { + > .f-s-n { -webkit-flex-shrink: 0; -moz-flex-shrink: 0; -ms-flex-shrink: 0; flex-shrink: 0; } - > .fill { + > .f-f { -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-grow: 1; diff --git a/src/less/core/wrapper/flex.vertical.less b/src/less/core/wrapper/flex.vertical.less index 0de23d791..eb22290b5 100644 --- a/src/less/core/wrapper/flex.vertical.less +++ b/src/less/core/wrapper/flex.vertical.less @@ -121,14 +121,14 @@ justify-content: flex-end; } - > .shrink-none { + > .f-s-n { -webkit-flex-shrink: 0; -moz-flex-shrink: 0; -ms-flex-shrink: 0; flex-shrink: 0; } - > .fill { + > .f-f { -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-grow: 1; diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less index 1142520f5..48a067a26 100644 --- a/src/less/core/wrapper/flex.wrapper.horizontal.less +++ b/src/less/core/wrapper/flex.wrapper.horizontal.less @@ -129,14 +129,14 @@ justify-content: flex-end; } - > .shrink-none { + > .f-s-n { -webkit-flex-shrink: 0; -moz-flex-shrink: 0; -ms-flex-shrink: 0; flex-shrink: 0; } - > .fill { + > .f-f { -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-grow: 1; diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index 1866ad2c3..b5b48e5ae 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -129,14 +129,14 @@ justify-content: flex-end; } - > .shrink-none { + > .f-s-n { -webkit-flex-shrink: 0; -moz-flex-shrink: 0; -ms-flex-shrink: 0; flex-shrink: 0; } - > .fill { + > .f-f { -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-grow: 1; From d7828ae2e331cc5125e10721f07a609bdc577032 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 11:52:56 +0800 Subject: [PATCH 06/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 93eaf86ec..537379312 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # 更新日志 2.0(2021-03) -- 优化left_right_vertical_adapt布局,去掉float布局只使用flex +- 优化left_right_vertical_adapt布局,去掉float属性只使用flex - inline布局支持用calc计算fill列宽度 - 时间类型控件无翻页限制 - 时间类型控件优化动态时间面板的交互 From 52abc4a1e471ffef9baf3fefed3f804633911bf4 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 12:30:53 +0800 Subject: [PATCH 07/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/shortcut.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/core/shortcut.js b/src/core/shortcut.js index 704d2a6b9..aa4a3b916 100644 --- a/src/core/shortcut.js +++ b/src/core/shortcut.js @@ -56,24 +56,30 @@ if (item.type || options.type) { el = BI.extend({}, options, item); w = BI.Plugin.getWidget(el.type, el); - w.listeners = (w.listeners || []).concat([{ - eventName: BI.Events.MOUNT, - action: function () { - BI.Plugin.getObject(el.type, this); - } - }]); - return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({/**important**/}, el, {type: w.type}), options, context, lazy); + if (w.type === el.type) { + w.listeners = (w.listeners || []).concat([{ + eventName: BI.Events.MOUNT, + action: function () { + BI.Plugin.getObject(el.type, this); + } + }]); + return createWidget(w, context, lazy); + } + return BI.createWidget(w, options, context, lazy); } if (item.el && (item.el.type || options.type)) { el = BI.extend({}, options, item.el); w = BI.Plugin.getWidget(el.type, el); - w.listeners = (w.listeners || []).concat([{ - eventName: BI.Events.MOUNT, - action: function () { - BI.Plugin.getObject(el.type, this); - } - }]); - return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({/**important**/}, el, {type: w.type}), options, context, lazy); + if (w.type === el.type) { + w.listeners = (w.listeners || []).concat([{ + eventName: BI.Events.MOUNT, + action: function () { + BI.Plugin.getObject(el.type, this); + } + }]); + return createWidget(w, context, lazy); + } + return BI.createWidget(w, options, context, lazy); } if (BI.isWidget(item.el)) { return item.el; From b765afb9a7542551782c2d2bae32ea1ad988e979 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 12:34:10 +0800 Subject: [PATCH 08/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/plugin.js | 4 ++++ src/core/shortcut.js | 28 ++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/core/plugin.js b/src/core/plugin.js index 31d460d16..e7a3f4714 100644 --- a/src/core/plugin.js +++ b/src/core/plugin.js @@ -81,6 +81,10 @@ BI.Plugin = BI.Plugin || {}; return res || object; }, + hasObject: function (type) { + return __GlobalObjectConfigFns.length > 0 || !!_ObjectPlugin[type]; + }, + registerObject: function (type, fn) { if (!_ObjectPlugin[type]) { _ObjectPlugin[type] = []; diff --git a/src/core/shortcut.js b/src/core/shortcut.js index aa4a3b916..54af3bdbe 100644 --- a/src/core/shortcut.js +++ b/src/core/shortcut.js @@ -57,12 +57,14 @@ el = BI.extend({}, options, item); w = BI.Plugin.getWidget(el.type, el); if (w.type === el.type) { - w.listeners = (w.listeners || []).concat([{ - eventName: BI.Events.MOUNT, - action: function () { - BI.Plugin.getObject(el.type, this); - } - }]); + if (BI.Plugin.hasObject(el.type)) { + w.listeners = (w.listeners || []).concat([{ + eventName: BI.Events.MOUNT, + action: function () { + BI.Plugin.getObject(el.type, this); + } + }]); + } return createWidget(w, context, lazy); } return BI.createWidget(w, options, context, lazy); @@ -71,12 +73,14 @@ el = BI.extend({}, options, item.el); w = BI.Plugin.getWidget(el.type, el); if (w.type === el.type) { - w.listeners = (w.listeners || []).concat([{ - eventName: BI.Events.MOUNT, - action: function () { - BI.Plugin.getObject(el.type, this); - } - }]); + if (BI.Plugin.hasObject(el.type)) { + w.listeners = (w.listeners || []).concat([{ + eventName: BI.Events.MOUNT, + action: function () { + BI.Plugin.getObject(el.type, this); + } + }]); + } return createWidget(w, context, lazy); } return BI.createWidget(w, options, context, lazy); From 882331485225e954793d7a717b0cb21527d0e81c Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 13:00:17 +0800 Subject: [PATCH 09/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/flex/wrapper/flex.wrapper.horizontal.js | 3 ++- .../wrapper/layout/flex/wrapper/flex.wrapper.vertical.js | 3 ++- src/less/core/wrapper/flex.wrapper.horizontal.less | 6 ++++++ src/less/core/wrapper/flex.wrapper.vertical.less | 8 ++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) 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 7b81608e7..5893591eb 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -8,7 +8,8 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.FlexWrapperHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-f-s-h clearfix", + // 逆天的IE设置min-height撑不起来高度 + baseCls: "bi-f-s-h clearfix" + (BI.isIE() ? " hack" : ""), verticalAlign: BI.VerticalAlign.Top, horizontalAlign: BI.HorizontalAlign.Left, columnSize: [], 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 39a18f6e9..efcd838cd 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -8,7 +8,8 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.FlexWrapperVerticalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-f-s-v clearfix", + // 逆天的IE设置min-height撑不起来高度 + baseCls: "bi-f-s-v clearfix" + (BI.isIE() ? " hack" : ""), horizontalAlign: BI.HorizontalAlign.Left, verticalAlign: BI.VerticalAlign.Top, rowSize: [], diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less index 48a067a26..0fccf4346 100644 --- a/src/less/core/wrapper/flex.wrapper.horizontal.less +++ b/src/less/core/wrapper/flex.wrapper.horizontal.less @@ -29,6 +29,12 @@ } .bi-f-s-h, .bi-flex-scrollable-horizontal-layout { + &.hack { + & .f-s-h-w, & .flex-scrollable-horizontal-layout-wrapper { + height: 100%; + } + } + & .f-s-h-w, & .flex-scrollable-horizontal-layout-wrapper { .flex(); .horizontal(); diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index b5b48e5ae..d9071cb8a 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -29,6 +29,14 @@ } .bi-f-s-v, .bi-flex-scrollable-vertical-layout { + &.hack { + & .f-s-v-w, & .flex-scrollable-vertical-layout-wrapper { + &.h-center.v-middle { + height: 100%; + } + } + } + & .f-s-v-w, & .flex-scrollable-vertical-layout-wrapper { .flex(); .vertical(); From 3c27983d9e6d3d19692fc6cae2eafe108c884171 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 15:07:32 +0800 Subject: [PATCH 10/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/adapt/adapt.table.js | 2 +- src/core/wrapper/layout/adapt/inline.center.js | 2 +- src/core/wrapper/layout/adapt/inline.horizontal.js | 2 +- src/core/wrapper/layout/adapt/inline.vertical.js | 2 +- src/core/wrapper/layout/flex/flex.horizontal.js | 2 +- src/core/wrapper/layout/flex/flex.vertical.js | 2 +- .../layout/flex/wrapper/flex.wrapper.horizontal.js | 2 +- .../layout/flex/wrapper/flex.wrapper.vertical.js | 2 +- src/core/wrapper/layout/layout.horizontal.js | 2 +- src/core/wrapper/layout/layout.table.js | 14 ++------------ src/core/wrapper/layout/layout.td.js | 2 +- 11 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/core/wrapper/layout/adapt/adapt.table.js b/src/core/wrapper/layout/adapt/adapt.table.js index 47f0ed9d9..baa065655 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] <= 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"}); diff --git a/src/core/wrapper/layout/adapt/inline.center.js b/src/core/wrapper/layout/adapt/inline.center.js index 3e0d39040..e2caf07c7 100644 --- a/src/core/wrapper/layout/adapt/inline.center.js +++ b/src/core/wrapper/layout/adapt/inline.center.js @@ -38,7 +38,7 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, { var o = this.options; var w = BI.InlineCenterAdaptLayout.superclass._addElement.apply(this, arguments); w.element.css({ - width: 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/adapt/inline.horizontal.js b/src/core/wrapper/layout/adapt/inline.horizontal.js index 917c34fec..32cc6bc50 100644 --- a/src/core/wrapper/layout/adapt/inline.horizontal.js +++ b/src/core/wrapper/layout/adapt/inline.horizontal.js @@ -38,7 +38,7 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, { var o = this.options; var w = BI.InlineHorizontalAdaptLayout.superclass._addElement.apply(this, arguments); w.element.css({ - width: 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/adapt/inline.vertical.js b/src/core/wrapper/layout/adapt/inline.vertical.js index e753ba36d..10b07d357 100644 --- a/src/core/wrapper/layout/adapt/inline.vertical.js +++ b/src/core/wrapper/layout/adapt/inline.vertical.js @@ -38,7 +38,7 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, { var o = this.options; var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments); w.element.css({ - width: 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/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index f7a06d415..1f9c0f242 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -42,7 +42,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { } } if (o.columnSize[i] > 0) { - w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)); + w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit))); } if (o.columnSize[i] === "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 29eb17179..d88bad7e1 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -41,7 +41,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { } } if (o.rowSize[i] > 0) { - w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)); + w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit))); } if (o.rowSize[i] === "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 5893591eb..2a68067d1 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -44,7 +44,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { } } if (o.columnSize[i] > 0) { - w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)); + w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit))); } if (o.columnSize[i] === "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 efcd838cd..de365f05b 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -44,7 +44,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { } } if (o.rowSize[i] > 0) { - w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)); + w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit))); } if (o.rowSize[i] === "fill") { w.element.addClass("f-f"); diff --git a/src/core/wrapper/layout/layout.horizontal.js b/src/core/wrapper/layout/layout.horizontal.js index 440b0d60f..79bb92a20 100644 --- a/src/core/wrapper/layout/layout.horizontal.js +++ b/src/core/wrapper/layout/layout.horizontal.js @@ -39,7 +39,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var td; - var width = 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", margin: "0px auto"}); diff --git a/src/core/wrapper/layout/layout.table.js b/src/core/wrapper/layout/layout.table.js index ec1c96646..65ce48362 100644 --- a/src/core/wrapper/layout/layout.table.js +++ b/src/core/wrapper/layout/layout.table.js @@ -9,21 +9,11 @@ BI.TableLayout = BI.inherit(BI.Layout, { return BI.extend(BI.TableLayout.superclass.props.apply(this, arguments), { baseCls: "bi-t", scrolly: true, - columnSize: [200, 200, "fill"], + columnSize: [], rowSize: 30, // or [30,30,30] hgap: 0, vgap: 0, - items: [[ - { - el: {text: "label1"} - }, - { - el: {text: "label2"} - }, - { - el: {text: "label3"} - } - ]] + items: [] }); }, render: function () { diff --git a/src/core/wrapper/layout/layout.td.js b/src/core/wrapper/layout/layout.td.js index d8e8cc3a5..d2f66dff3 100644 --- a/src/core/wrapper/layout/layout.td.js +++ b/src/core/wrapper/layout/layout.td.js @@ -103,7 +103,7 @@ BI.TdLayout = BI.inherit(BI.Layout, { first(w, this.rows++, i); var td = BI._lazyCreateWidget({ type: "bi.default", - width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i], + 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]), tagName: "td", items: [w] }); From ce55d0e9cc6253cf9ab2cfe2f7daf0370c03ceb9 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 15:35:06 +0800 Subject: [PATCH 11/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 70 +++++++++++----------- src/less/core/wrapper/flex.horizontal.less | 47 +++++++++------ src/less/core/wrapper/flex.vertical.less | 49 +++++++++------ 3 files changed, 94 insertions(+), 72 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 78cf5bffa..02764ae06 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -107,41 +107,41 @@ BI.prepares.push(function () { return ob; }); - BI.Plugin.configWidget("bi.flex_horizontal", function (ob) { - if (ob.scrollable === true || ob.scrolly === true) { - return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"}); - } - }); - BI.Plugin.configWidget("bi.flex_vertical", function (ob) { - if (ob.scrollable === true || ob.scrollx === true) { - return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"}); - } - }); - BI.Plugin.configWidget("bi.flex_horizontal_adapt", function (ob) { - if (ob.scrollable === true || ob.scrollx === true) { - return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"}); - } - }); - BI.Plugin.configWidget("bi.flex_vertical_adapt", function (ob) { - if (ob.scrollable === true || ob.scrolly === true) { - return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"}); - } - }); - BI.Plugin.configWidget("bi.flex_horizontal_center_adapt", function (ob) { - if (ob.scrollable === true || ob.scrollx === true) { - return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"}); - } - }); - BI.Plugin.configWidget("bi.flex_vertical_center_adapt", function (ob) { - if (ob.scrollable === true || ob.scrolly === true) { - return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"}); - } - }); - BI.Plugin.configWidget("bi.flex_center_adapt", function (ob) { - if (ob.scrollable === true || ob.scrolly === true || ob.scrollx === true) { - return BI.extend({}, ob, {type: "bi.flex_scrollable_center_adapt"}); - } - }); + // BI.Plugin.configWidget("bi.flex_horizontal", function (ob) { + // if (ob.scrollable === true || ob.scrolly === true) { + // return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"}); + // } + // }); + // BI.Plugin.configWidget("bi.flex_vertical", function (ob) { + // if (ob.scrollable === true || ob.scrollx === true) { + // return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"}); + // } + // }); + // BI.Plugin.configWidget("bi.flex_horizontal_adapt", function (ob) { + // if (ob.scrollable === true || ob.scrollx === true) { + // return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"}); + // } + // }); + // BI.Plugin.configWidget("bi.flex_vertical_adapt", function (ob) { + // if (ob.scrollable === true || ob.scrolly === true) { + // return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"}); + // } + // }); + // BI.Plugin.configWidget("bi.flex_horizontal_center_adapt", function (ob) { + // if (ob.scrollable === true || ob.scrollx === true) { + // return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"}); + // } + // }); + // BI.Plugin.configWidget("bi.flex_vertical_center_adapt", function (ob) { + // if (ob.scrollable === true || ob.scrolly === true) { + // return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"}); + // } + // }); + // BI.Plugin.configWidget("bi.flex_center_adapt", function (ob) { + // if (ob.scrollable === true || ob.scrolly === true || ob.scrollx === true) { + // return BI.extend({}, ob, {type: "bi.flex_scrollable_center_adapt"}); + // } + // }); BI.Plugin.configWidget("bi.radio", function (ob) { if (BI.isIE() && BI.getIEVersion() <= 9) { diff --git a/src/less/core/wrapper/flex.horizontal.less b/src/less/core/wrapper/flex.horizontal.less index c20a7c55a..452aeca4c 100644 --- a/src/less/core/wrapper/flex.horizontal.less +++ b/src/less/core/wrapper/flex.horizontal.less @@ -63,15 +63,19 @@ flex-wrap: nowrap; &.v-middle { - /* 09版 */ - -webkit-box-align: center; - /* 12版 */ - -webkit-align-items: center; - -moz-align-items: center; - -ms-align-items: center; - -ms-flex-align: center; - -o-align-items: center; - align-items: center; + ///* 09版 */ + //-webkit-box-align: center; + ///* 12版 */ + //-webkit-align-items: center; + //-moz-align-items: center; + //-ms-align-items: center; + //-ms-flex-align: center; + //-o-align-items: center; + //align-items: center; + > * { + margin-top: auto !important; + margin-bottom: auto !important; + } } &.v-bottom { @@ -99,15 +103,22 @@ } &.h-center { - /* 09版 */ - -webkit-box-pack: center; - /* 12版 */ - -webkit-justify-content: center; - -moz-justify-content: center; - -ms-justify-content: center; - -ms-flex-pack: center; - -o-justify-content: center; - justify-content: center; + ///* 09版 */ + //-webkit-box-pack: center; + ///* 12版 */ + //-webkit-justify-content: center; + //-moz-justify-content: center; + //-ms-justify-content: center; + //-ms-flex-pack: center; + //-o-justify-content: center; + //justify-content: center; + > *:first-child { + margin-left: auto !important; + } + + > *:last-child { + margin-right: auto !important; + } } &.h-right { diff --git a/src/less/core/wrapper/flex.vertical.less b/src/less/core/wrapper/flex.vertical.less index eb22290b5..7b123be52 100644 --- a/src/less/core/wrapper/flex.vertical.less +++ b/src/less/core/wrapper/flex.vertical.less @@ -28,7 +28,7 @@ flex-direction: row; } -.bi-f-v, .bi-flex-vertical-layout{ +.bi-f-v, .bi-flex-vertical-layout { .flex(); .vertical(); @@ -62,15 +62,19 @@ flex-wrap: nowrap; &.h-center { - /* 09版 */ - -webkit-box-align: center; - /* 12版 */ - -webkit-align-items: center; - -moz-align-items: center; - -ms-align-items: center; - -ms-flex-align: center; - -o-align-items: center; - align-items: center; + ///* 09版 */ + //-webkit-box-align: center; + ///* 12版 */ + //-webkit-align-items: center; + //-moz-align-items: center; + //-ms-align-items: center; + //-ms-flex-align: center; + //-o-align-items: center; + //align-items: center; + > * { + margin-left: auto !important; + margin-right: auto !important; + } } &.h-right { @@ -98,15 +102,22 @@ } &.v-middle { - /* 09版 */ - -webkit-box-pack: center; - /* 12版 */ - -webkit-justify-content: center; - -moz-justify-content: center; - -ms-justify-content: center; - -ms-flex-pack: center; - -o-justify-content: center; - justify-content: center; + ///* 09版 */ + //-webkit-box-pack: center; + ///* 12版 */ + //-webkit-justify-content: center; + //-moz-justify-content: center; + //-ms-justify-content: center; + //-ms-flex-pack: center; + //-o-justify-content: center; + //justify-content: center; + > *:first-child { + margin-left: auto !important; + } + + > *:last-child { + margin-right: auto !important; + } } &.v-bottom { From 31552ce4f5333e467b960d027d3a73fb4fd249cc Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 15:36:11 +0800 Subject: [PATCH 12/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 02764ae06..d86a2523e 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -25,13 +25,13 @@ BI.prepares.push(function () { // 在这种情况下,也可以通过flex支持该布局 if (supportFlex) { // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 - if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { - return BI.extend({}, ob, { - type: "bi.flex_horizontal", - horizontalAlign: !justOneItem && ob.horizontalAlign === BI.HorizontalAlign.Center - ? BI.HorizontalAlign.Left : ob.horizontalAlign - }); - } + // if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, { + type: "bi.flex_horizontal", + horizontalAlign: !justOneItem && ob.horizontalAlign === BI.HorizontalAlign.Center + ? BI.HorizontalAlign.Left : ob.horizontalAlign + }); + // } } return BI.extend({}, ob, {type: "bi.table_adapt"}); } @@ -57,9 +57,9 @@ BI.prepares.push(function () { if (!isAdapt || justOneItem) { if (supportFlex) { // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 - if (!isIE || (ob.scrollable !== true && ob.scrollx !== true && ob.scrolly !== true)) { - return BI.extend({}, ob, {type: "bi.flex_center_adapt"}); - } + // if (!isIE || (ob.scrollable !== true && ob.scrollx !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, {type: "bi.flex_center_adapt"}); + // } } return BI.extend({}, ob, {type: "bi.inline_center_adapt"}); } @@ -71,9 +71,9 @@ BI.prepares.push(function () { if (!isAdapt || justOneItem) { if (supportFlex) { // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 - if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { - return BI.extend({}, ob, {type: "bi.flex_vertical_adapt"}); - } + // if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, {type: "bi.flex_vertical_adapt"}); + // } } return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"}); } @@ -91,18 +91,18 @@ BI.prepares.push(function () { BI.Plugin.configWidget("bi.horizontal_float", function (ob) { if (isSupportFlex()) { // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 - if (!BI.isIE() || (ob.scrollable !== true && ob.scrollx !== true)) { - return BI.extend({}, ob, {type: "bi.flex_horizontal_adapt"}); - } + // if (!BI.isIE() || (ob.scrollable !== true && ob.scrollx !== true)) { + return BI.extend({}, ob, {type: "bi.flex_horizontal_adapt"}); + // } } return BI.extend({}, ob, {type: "bi.inline_horizontal_adapt"}); }); BI.Plugin.configWidget("bi.left_right_vertical_adapt", function (ob) { if (isSupportFlex()) { // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 - if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) { - return BI.extend({}, ob, {type: "bi.flex_left_right_vertical_adapt"}); - } + // if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, {type: "bi.flex_left_right_vertical_adapt"}); + // } } return ob; }); From c057a5f7fbeda6c82c2d735774892fdce01e61f1 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 16:03:13 +0800 Subject: [PATCH 13/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/flex/flex.horizontal.js | 9 ++++++++- src/core/wrapper/layout/flex/flex.vertical.js | 9 ++++++++- src/less/core/wrapper/flex.horizontal.less | 6 +++--- src/less/core/wrapper/flex.vertical.less | 6 +++--- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index 1f9c0f242..c0b2c5617 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -35,7 +35,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { position: "relative" }); if (o.columnSize[i] !== "auto") { - if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] !== "") { + if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] === "fill") { w.element.addClass("f-f"); } else { w.element.addClass("f-s-n"); @@ -47,6 +47,13 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { if (o.columnSize[i] === "fill") { w.element.addClass("f-f"); } + w.element.addClass("c-e"); + if (i === 0) { + w.element.addClass("f-c"); + } + if (i === o.items.length - 1) { + w.element.addClass("l-c"); + } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js index d88bad7e1..b53915aa8 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -34,7 +34,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { position: "relative" }); if (o.rowSize[i] !== "auto") { - if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] !== "") { + if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] === "fill") { w.element.addClass("f-f"); } else { w.element.addClass("f-s-n"); @@ -46,6 +46,13 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { if (o.rowSize[i] === "fill") { w.element.addClass("f-f"); } + w.element.addClass("c-e"); + if (i === 0) { + w.element.addClass("f-c"); + } + if (i === o.items.length - 1) { + w.element.addClass("l-c"); + } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ "margin-top": ((i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit diff --git a/src/less/core/wrapper/flex.horizontal.less b/src/less/core/wrapper/flex.horizontal.less index 452aeca4c..54a96397c 100644 --- a/src/less/core/wrapper/flex.horizontal.less +++ b/src/less/core/wrapper/flex.horizontal.less @@ -72,7 +72,7 @@ //-ms-flex-align: center; //-o-align-items: center; //align-items: center; - > * { + > .c-e { margin-top: auto !important; margin-bottom: auto !important; } @@ -112,11 +112,11 @@ //-ms-flex-pack: center; //-o-justify-content: center; //justify-content: center; - > *:first-child { + > .f-c { margin-left: auto !important; } - > *:last-child { + > .l-c { margin-right: auto !important; } } diff --git a/src/less/core/wrapper/flex.vertical.less b/src/less/core/wrapper/flex.vertical.less index 7b123be52..fcbecd364 100644 --- a/src/less/core/wrapper/flex.vertical.less +++ b/src/less/core/wrapper/flex.vertical.less @@ -71,7 +71,7 @@ //-ms-flex-align: center; //-o-align-items: center; //align-items: center; - > * { + > .c-e { margin-left: auto !important; margin-right: auto !important; } @@ -111,11 +111,11 @@ //-ms-flex-pack: center; //-o-justify-content: center; //justify-content: center; - > *:first-child { + > .f-c { margin-left: auto !important; } - > *:last-child { + > .l-c { margin-right: auto !important; } } From d0ce902274647d3b9fd361b6812d8713a9a2eb12 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 16:52:28 +0800 Subject: [PATCH 14/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js | 7 +++++++ .../wrapper/layout/flex/wrapper/flex.wrapper.vertical.js | 7 +++++++ 2 files changed, 14 insertions(+) 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 2a68067d1..08d9c9835 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -49,6 +49,13 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { if (o.columnSize[i] === "fill") { w.element.addClass("f-f"); } + w.element.addClass("c-e"); + if (i === 0) { + w.element.addClass("f-c"); + } + if (i === o.items.length - 1) { + w.element.addClass("l-c"); + } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit 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 de365f05b..92bc16154 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -49,6 +49,13 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { if (o.rowSize[i] === "fill") { w.element.addClass("f-f"); } + w.element.addClass("c-e"); + if (i === 0) { + w.element.addClass("f-c"); + } + if (i === o.items.length - 1) { + w.element.addClass("l-c"); + } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ "margin-top": ((i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit From 3fe7dd11d2684396dad8fe9ed3f1b0b5da4a15c1 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 18:22:39 +0800 Subject: [PATCH 15/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 43 +++----------- .../flex/wrapper/flex.wrapper.horizontal.js | 2 +- .../flex/wrapper/flex.wrapper.vertical.js | 2 +- .../core/wrapper/flex.wrapper.horizontal.less | 54 ++++++++++-------- .../core/wrapper/flex.wrapper.vertical.less | 57 ++++++++++--------- 5 files changed, 70 insertions(+), 88 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index d86a2523e..d37f5d765 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -106,42 +106,13 @@ BI.prepares.push(function () { } return ob; }); - - // BI.Plugin.configWidget("bi.flex_horizontal", function (ob) { - // if (ob.scrollable === true || ob.scrolly === true) { - // return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"}); - // } - // }); - // BI.Plugin.configWidget("bi.flex_vertical", function (ob) { - // if (ob.scrollable === true || ob.scrollx === true) { - // return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"}); - // } - // }); - // BI.Plugin.configWidget("bi.flex_horizontal_adapt", function (ob) { - // if (ob.scrollable === true || ob.scrollx === true) { - // return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"}); - // } - // }); - // BI.Plugin.configWidget("bi.flex_vertical_adapt", function (ob) { - // if (ob.scrollable === true || ob.scrolly === true) { - // return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"}); - // } - // }); - // BI.Plugin.configWidget("bi.flex_horizontal_center_adapt", function (ob) { - // if (ob.scrollable === true || ob.scrollx === true) { - // return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"}); - // } - // }); - // BI.Plugin.configWidget("bi.flex_vertical_center_adapt", function (ob) { - // if (ob.scrollable === true || ob.scrolly === true) { - // return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"}); - // } - // }); - // BI.Plugin.configWidget("bi.flex_center_adapt", function (ob) { - // if (ob.scrollable === true || ob.scrolly === true || ob.scrollx === true) { - // return BI.extend({}, ob, {type: "bi.flex_scrollable_center_adapt"}); - // } - // }); + BI.Plugin.configWidget("bi.flex_horizontal", function (ob) { + if (ob.scrollable === true || ob.scrollx !== false) { + if (ob.hgap > 0 || ob.rgap > 0) { + return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"}); + } + } + }); BI.Plugin.configWidget("bi.radio", function (ob) { if (BI.isIE() && BI.getIEVersion() <= 9) { 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 08d9c9835..39bfc329f 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -9,7 +9,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.FlexWrapperHorizontalLayout.superclass.props.apply(this, arguments), { // 逆天的IE设置min-height撑不起来高度 - baseCls: "bi-f-s-h clearfix" + (BI.isIE() ? " hack" : ""), + baseCls: "bi-f-s-h", verticalAlign: BI.VerticalAlign.Top, horizontalAlign: BI.HorizontalAlign.Left, columnSize: [], 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 92bc16154..69e7b6103 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -9,7 +9,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.FlexWrapperVerticalLayout.superclass.props.apply(this, arguments), { // 逆天的IE设置min-height撑不起来高度 - baseCls: "bi-f-s-v clearfix" + (BI.isIE() ? " hack" : ""), + baseCls: "bi-f-s-v", horizontalAlign: BI.HorizontalAlign.Left, verticalAlign: BI.VerticalAlign.Top, rowSize: [], diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less index 0fccf4346..0d81f46f8 100644 --- a/src/less/core/wrapper/flex.wrapper.horizontal.less +++ b/src/less/core/wrapper/flex.wrapper.horizontal.less @@ -29,11 +29,7 @@ } .bi-f-s-h, .bi-flex-scrollable-horizontal-layout { - &.hack { - & .f-s-h-w, & .flex-scrollable-horizontal-layout-wrapper { - height: 100%; - } - } + .flex(); & .f-s-h-w, & .flex-scrollable-horizontal-layout-wrapper { .flex(); @@ -71,19 +67,22 @@ min-height: 100%; &.v-middle { - /* 09版 */ - -webkit-box-align: center; - /* 12版 */ - -webkit-align-items: center; - -moz-align-items: center; - -ms-align-items: center; - -ms-flex-align: center; - -o-align-items: center; - align-items: center; + ///* 09版 */ + //-webkit-box-align: center; + ///* 12版 */ + //-webkit-align-items: center; + //-moz-align-items: center; + //-ms-align-items: center; + //-ms-flex-align: center; + //-o-align-items: center; + //align-items: center; + > .c-e { + margin-top: auto !important; + margin-bottom: auto !important; + } &.h-center { min-width: 100%; - float: left; } } @@ -112,15 +111,22 @@ } &.h-center { - /* 09版 */ - -webkit-box-pack: center; - /* 12版 */ - -webkit-justify-content: center; - -moz-justify-content: center; - -ms-justify-content: center; - -ms-flex-pack: center; - -o-justify-content: center; - justify-content: center; + ///* 09版 */ + //-webkit-box-pack: center; + ///* 12版 */ + //-webkit-justify-content: center; + //-moz-justify-content: center; + //-ms-justify-content: center; + //-ms-flex-pack: center; + //-o-justify-content: center; + //justify-content: center; + > .f-c { + margin-left: auto !important; + } + + > .l-c { + margin-right: auto !important; + } } &.h-right { diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index d9071cb8a..a01580a8d 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -29,13 +29,7 @@ } .bi-f-s-v, .bi-flex-scrollable-vertical-layout { - &.hack { - & .f-s-v-w, & .flex-scrollable-vertical-layout-wrapper { - &.h-center.v-middle { - height: 100%; - } - } - } + .flex(); & .f-s-v-w, & .flex-scrollable-vertical-layout-wrapper { .flex(); @@ -73,19 +67,23 @@ min-width: 100%; &.h-center { - /* 09版 */ - -webkit-box-align: center; - /* 12版 */ - -webkit-align-items: center; - -moz-align-items: center; - -ms-align-items: center; - -ms-flex-align: center; - -o-align-items: center; - align-items: center; + ///* 09版 */ + //-webkit-box-align: center; + ///* 12版 */ + //-webkit-align-items: center; + //-moz-align-items: center; + //-ms-align-items: center; + //-ms-flex-align: center; + //-o-align-items: center; + //align-items: center; + + > .c-e { + margin-left: auto !important; + margin-right: auto !important; + } &.v-middle { min-height: 100%; - float: left; } } @@ -114,15 +112,22 @@ } &.v-middle { - /* 09版 */ - -webkit-box-pack: center; - /* 12版 */ - -webkit-justify-content: center; - -moz-justify-content: center; - -ms-justify-content: center; - -o-justify-content: center; - -ms-flex-pack: center; - justify-content: center; + ///* 09版 */ + //-webkit-box-pack: center; + ///* 12版 */ + //-webkit-justify-content: center; + //-moz-justify-content: center; + //-ms-justify-content: center; + //-o-justify-content: center; + //-ms-flex-pack: center; + //justify-content: center; + > .f-c { + margin-left: auto !important; + } + + > .l-c { + margin-right: auto !important; + } } &.v-bottom { From 073a13f5f145b021a6c1dd757dfd5c877d620989 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 18:24:57 +0800 Subject: [PATCH 16/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js | 1 - src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js | 1 - 2 files changed, 2 deletions(-) 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 39bfc329f..2bf01cc06 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -8,7 +8,6 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.FlexWrapperHorizontalLayout.superclass.props.apply(this, arguments), { - // 逆天的IE设置min-height撑不起来高度 baseCls: "bi-f-s-h", verticalAlign: BI.VerticalAlign.Top, horizontalAlign: BI.HorizontalAlign.Left, 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 69e7b6103..baaacdb53 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -8,7 +8,6 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.FlexWrapperVerticalLayout.superclass.props.apply(this, arguments), { - // 逆天的IE设置min-height撑不起来高度 baseCls: "bi-f-s-v", horizontalAlign: BI.HorizontalAlign.Left, verticalAlign: BI.VerticalAlign.Top, From a6d270d11b968c069c68cac7ac41be28b904dd10 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 18:27:38 +0800 Subject: [PATCH 17/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index d37f5d765..52771f68b 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -108,11 +108,18 @@ BI.prepares.push(function () { }); BI.Plugin.configWidget("bi.flex_horizontal", function (ob) { if (ob.scrollable === true || ob.scrollx !== false) { - if (ob.hgap > 0 || ob.rgap > 0) { + if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效 return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"}); } } }); + BI.Plugin.configWidget("bi.flex_vertical", function (ob) { + if (ob.scrollable === true || ob.scrollx === true) { + if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效 + return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"}); + } + } + }); BI.Plugin.configWidget("bi.radio", function (ob) { if (BI.isIE() && BI.getIEVersion() <= 9) { From 824b0ebf4049df02797f278122b786f0cc9f2917 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 18:50:34 +0800 Subject: [PATCH 18/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/less/core/wrapper/flex.wrapper.horizontal.less | 1 + src/less/core/wrapper/flex.wrapper.vertical.less | 1 + 2 files changed, 2 insertions(+) diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less index 0d81f46f8..645d13e9f 100644 --- a/src/less/core/wrapper/flex.wrapper.horizontal.less +++ b/src/less/core/wrapper/flex.wrapper.horizontal.less @@ -65,6 +65,7 @@ flex-wrap: nowrap; min-height: 100%; + min-width: 100%; &.v-middle { ///* 09版 */ diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index a01580a8d..08c373718 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -65,6 +65,7 @@ flex-wrap: nowrap; min-width: 100%; + min-height: 100%; &.h-center { ///* 09版 */ From 2f449d0d3f42cbcf5e12b4f3e2f3ec54a2278b72 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 18:51:04 +0800 Subject: [PATCH 19/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/less/core/wrapper/flex.wrapper.horizontal.less | 6 +++--- src/less/core/wrapper/flex.wrapper.vertical.less | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less index 645d13e9f..502867bf0 100644 --- a/src/less/core/wrapper/flex.wrapper.horizontal.less +++ b/src/less/core/wrapper/flex.wrapper.horizontal.less @@ -82,9 +82,9 @@ margin-bottom: auto !important; } - &.h-center { - min-width: 100%; - } + //&.h-center { + // min-width: 100%; + //} } &.v-bottom { diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index 08c373718..e3e1e531e 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -83,9 +83,9 @@ margin-right: auto !important; } - &.v-middle { - min-height: 100%; - } + //&.v-middle { + // min-height: 100%; + //} } &.h-right { From 0d6eba1cb7e1f83d3b837396c681cee335ae5724 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 20:28:01 +0800 Subject: [PATCH 20/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/less/core/wrapper/flex.wrapper.horizontal.less | 7 +++---- src/less/core/wrapper/flex.wrapper.vertical.less | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less index 502867bf0..0d81f46f8 100644 --- a/src/less/core/wrapper/flex.wrapper.horizontal.less +++ b/src/less/core/wrapper/flex.wrapper.horizontal.less @@ -65,7 +65,6 @@ flex-wrap: nowrap; min-height: 100%; - min-width: 100%; &.v-middle { ///* 09版 */ @@ -82,9 +81,9 @@ margin-bottom: auto !important; } - //&.h-center { - // min-width: 100%; - //} + &.h-center { + min-width: 100%; + } } &.v-bottom { diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index e3e1e531e..a01580a8d 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -65,7 +65,6 @@ flex-wrap: nowrap; min-width: 100%; - min-height: 100%; &.h-center { ///* 09版 */ @@ -83,9 +82,9 @@ margin-right: auto !important; } - //&.v-middle { - // min-height: 100%; - //} + &.v-middle { + min-height: 100%; + } } &.h-right { From 8191e94f0beb14b98718f5acd42d8a6dd09ab8c5 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 21:04:39 +0800 Subject: [PATCH 21/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wrapper/layout/adapt/inline.center.js | 87 ++++--------------- .../wrapper/layout/adapt/inline.horizontal.js | 87 ++++--------------- .../wrapper/layout/adapt/inline.vertical.js | 74 ++++------------ src/core/wrapper/layout/layout.inline.js | 42 ++++++++- src/less/core/wrapper/inline.less | 24 +++++ 5 files changed, 117 insertions(+), 197 deletions(-) create mode 100644 src/less/core/wrapper/inline.less diff --git a/src/core/wrapper/layout/adapt/inline.center.js b/src/core/wrapper/layout/adapt/inline.center.js index e2caf07c7..0aea35ef1 100644 --- a/src/core/wrapper/layout/adapt/inline.center.js +++ b/src/core/wrapper/layout/adapt/inline.center.js @@ -25,78 +25,27 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, { }, render: function () { - BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments); - var o = this.options; - this.element.css({ - whiteSpace: "nowrap", - textAlign: o.horizontalAlign - }); - this.populate(o.items); - }, - - _addElement: function (i, item, length) { - var o = this.options; - var w = BI.InlineCenterAdaptLayout.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)), - position: "relative", - "vertical-align": o.verticalAlign - }); - w.element.addClass("i-c-a-item"); - if (o.columnSize[i] === "fill") { - var left = o.hgap + (item.lgap || 0) + (item.hgap || 0), - right = o.hgap + (item.rgap || 0) + (item.hgap || 0); - for (var k = 0; k < i; k++) { - left += o.hgap + o.lgap + o.rgap + o.columnSize[k]; - } - for (var k = i + 1; k < o.columnSize.length; k++) { - right += o.hgap + o.lgap + o.rgap + o.columnSize[k]; - } - w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); - } - if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { - w.element.css({ - "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { - w.element.css({ - "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { - w.element.css({ - "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { - w.element.css({ - "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) - }); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - throw new Error("不能添加元素"); - }, - - stroke: function (items) { - var self = this; - BI.each(items, function (i, item) { - if (item) { - self._addElement(i, item, items.length); - } - }); + var self = this, o = this.options; + return { + type: "bi.inline", + ref: function (_ref) { + self.layout = _ref; + }, + items: o.items, + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign, + columnSize: o.columnSize, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap + }; }, populate: function (items) { - BI.InlineCenterAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); + this.layout.populate.apply(this.layout, arguments); } }); BI.shortcut("bi.inline_center_adapt", BI.InlineCenterAdaptLayout); diff --git a/src/core/wrapper/layout/adapt/inline.horizontal.js b/src/core/wrapper/layout/adapt/inline.horizontal.js index 32cc6bc50..3ad1bc602 100644 --- a/src/core/wrapper/layout/adapt/inline.horizontal.js +++ b/src/core/wrapper/layout/adapt/inline.horizontal.js @@ -25,78 +25,27 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, { }, render: function () { - BI.InlineHorizontalAdaptLayout.superclass.render.apply(this, arguments); - var o = this.options; - this.element.css({ - whiteSpace: "nowrap", - textAlign: o.horizontalAlign - }); - this.populate(o.items); - }, - - _addElement: function (i, item, length) { - var o = this.options; - var w = BI.InlineHorizontalAdaptLayout.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)), - position: "relative", - "vertical-align": o.verticalAlign - }); - w.element.addClass("i-h-a-item"); - if (o.columnSize[i] === "fill") { - var left = o.hgap + (item.lgap || 0) + (item.hgap || 0), - right = o.hgap + (item.rgap || 0) + (item.hgap || 0); - for (var k = 0; k < i; k++) { - left += o.hgap + o.lgap + o.rgap + o.columnSize[k]; - } - for (var k = i + 1; k < o.columnSize.length; k++) { - right += o.hgap + o.lgap + o.rgap + o.columnSize[k]; - } - w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); - } - if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { - w.element.css({ - "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { - w.element.css({ - "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { - w.element.css({ - "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { - w.element.css({ - "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - throw new Error("不能添加元素"); - }, - - stroke: function (items) { - var self = this; - BI.each(items, function (i, item) { - if (item) { - self._addElement(i, item, items.length); - } - }); + var self = this, o = this.options; + return { + type: "bi.inline", + ref: function (_ref) { + self.layout = _ref; + }, + items: o.items, + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign, + columnSize: o.columnSize, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap + }; }, populate: function (items) { - BI.InlineHorizontalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); + this.layout.populate.apply(this.layout, arguments); } }); BI.shortcut("bi.inline_horizontal_adapt", BI.InlineHorizontalAdaptLayout); diff --git a/src/core/wrapper/layout/adapt/inline.vertical.js b/src/core/wrapper/layout/adapt/inline.vertical.js index 10b07d357..1e7401e46 100644 --- a/src/core/wrapper/layout/adapt/inline.vertical.js +++ b/src/core/wrapper/layout/adapt/inline.vertical.js @@ -25,65 +25,27 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, { }, render: function () { - BI.InlineVerticalAdaptLayout.superclass.render.apply(this, arguments); - var o = this.options; - this.element.css({ - whiteSpace: "nowrap", - textAlign: o.horizontalAlign - }); - this.populate(o.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.InlineVerticalAdaptLayout.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)), - position: "relative", - "vertical-align": o.verticalAlign - }); - w.element.addClass("i-v-a-item"); - if (o.columnSize[i] === "fill") { - var left = o.hgap + (item.lgap || 0) + (item.hgap || 0), - right = o.hgap + (item.rgap || 0) + (item.hgap || 0); - for (var k = 0; k < i; k++) { - left += o.hgap + o.lgap + o.rgap + o.columnSize[k]; - } - for (var k = i + 1; k < o.columnSize.length; k++) { - right += o.hgap + o.lgap + o.rgap + o.columnSize[k]; - } - w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); - } - if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { - w.element.css({ - "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { - w.element.css({ - "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { - w.element.css({ - "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { - w.element.css({ - "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit - }); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); + var self = this, o = this.options; + return { + type: "bi.inline", + ref: function (_ref) { + self.layout = _ref; + }, + items: o.items, + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign, + columnSize: o.columnSize, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap + }; }, populate: function (items) { - BI.InlineVerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); + this.layout.populate.apply(this.layout, arguments); } }); BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout); diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index 864b8b35d..24078ace2 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -12,6 +12,9 @@ BI.InlineLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.InlineLayout.superclass.props.apply(this, arguments), { baseCls: "bi-i", + horizontalAlign: BI.HorizontalAlign.Left, + verticalAlign: BI.VerticalAlign.Top, + columnSize: [], hgap: 0, vgap: 0, lgap: 0, @@ -23,13 +26,33 @@ BI.InlineLayout = BI.inherit(BI.Layout, { render: function () { BI.InlineLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); + var o = this.options; + this.element.css({ + textAlign: o.horizontalAlign + }); + this.populate(o.items); }, - _addElement: function (i, item) { + _addElement: function (i, item, length) { var o = this.options; var w = BI.InlineLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", display: "inline-block", "*display": "inline", "*zoom": 1}); + w.element.css({ + 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 + }); + w.element.addClass("i-item"); + if (o.columnSize[i] === "fill") { + var left = o.hgap + (item.lgap || 0) + (item.hgap || 0), + right = o.hgap + (item.rgap || 0) + (item.hgap || 0); + for (var k = 0; k < i; k++) { + left += o.hgap + o.lgap + o.rgap + o.columnSize[k]; + } + for (var k = i + 1; k < o.columnSize.length; k++) { + right += o.hgap + o.lgap + o.rgap + o.columnSize[k]; + } + w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); + } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit @@ -57,6 +80,19 @@ BI.InlineLayout = BI.inherit(BI.Layout, { this.stroke(this.options.items); }, + addItem: function (item) { + throw new Error("不能添加元素"); + }, + + stroke: function (items) { + var self = this; + BI.each(items, function (i, item) { + if (item) { + self._addElement(i, item, items.length); + } + }); + }, + populate: function (items) { BI.InlineLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/less/core/wrapper/inline.less b/src/less/core/wrapper/inline.less new file mode 100644 index 000000000..f87f98c8a --- /dev/null +++ b/src/less/core/wrapper/inline.less @@ -0,0 +1,24 @@ +.bi-i { + white-space: nowrap; + &:after { + display: inline-block; + width: 0; + min-height: 100%; + vertical-align: middle; + content: ' '; + } + + & > .i-item { + display: inline-block; + + &.x-icon { + display: inline-block !important; + } + } + + & > .bi-combo { + &.bi-combo-popup { + display: inline-block !important; + } + } +} From 6ef9418ac106f66a1b651208d887c6c206407b12 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 21:53:47 +0800 Subject: [PATCH 22/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 52771f68b..6cdaabeeb 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -113,13 +113,6 @@ BI.prepares.push(function () { } } }); - BI.Plugin.configWidget("bi.flex_vertical", function (ob) { - if (ob.scrollable === true || ob.scrollx === true) { - if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效 - return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"}); - } - } - }); BI.Plugin.configWidget("bi.radio", function (ob) { if (BI.isIE() && BI.getIEVersion() <= 9) { From b60e6c2317cf4acb5cdb431cbc0bbe38d4c67476 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 21:58:49 +0800 Subject: [PATCH 23/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 7 +++++++ src/less/core/wrapper/flex.wrapper.vertical.less | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 6cdaabeeb..52771f68b 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -113,6 +113,13 @@ BI.prepares.push(function () { } } }); + BI.Plugin.configWidget("bi.flex_vertical", function (ob) { + if (ob.scrollable === true || ob.scrollx === true) { + if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效 + return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"}); + } + } + }); BI.Plugin.configWidget("bi.radio", function (ob) { if (BI.isIE() && BI.getIEVersion() <= 9) { diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index a01580a8d..67f1a460d 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -64,7 +64,7 @@ -o-flex-wrap: nowrap; flex-wrap: nowrap; - min-width: 100%; + //min-width: 100%; &.h-center { ///* 09版 */ From 1c463065430539f8f8a6545fbfffa918f151f4d5 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 28 Mar 2021 12:22:12 +0800 Subject: [PATCH 24/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flex/wrapper/flex.wrapper.horizontal.js | 1 + .../flex/wrapper/flex.wrapper.vertical.js | 1 + src/less/core/wrapper/flex.vertical.less | 4 +- .../core/wrapper/flex.wrapper.horizontal.less | 39 +++++++++++++++++ .../core/wrapper/flex.wrapper.vertical.less | 42 ++++++++++++++++++- 5 files changed, 83 insertions(+), 4 deletions(-) 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 2bf01cc06..8f4eec3f8 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -25,6 +25,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { render: function () { BI.FlexWrapperHorizontalLayout.superclass.render.apply(this, arguments); var o = this.options; + this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign); this.$wrapper = BI.Widget._renderEngine.createElement("
").addClass("f-s-h-w v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign); this.populate(this.options.items); }, 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 baaacdb53..51e657d2a 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -25,6 +25,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { render: function () { BI.FlexWrapperVerticalLayout.superclass.render.apply(this, arguments); var o = this.options; + this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign); this.$wrapper = BI.Widget._renderEngine.createElement("
").addClass("f-s-v-w h-" + o.horizontalAlign).addClass("v-" + o.verticalAlign); this.populate(this.options.items); }, diff --git a/src/less/core/wrapper/flex.vertical.less b/src/less/core/wrapper/flex.vertical.less index fcbecd364..e9446f931 100644 --- a/src/less/core/wrapper/flex.vertical.less +++ b/src/less/core/wrapper/flex.vertical.less @@ -112,11 +112,11 @@ //-o-justify-content: center; //justify-content: center; > .f-c { - margin-left: auto !important; + margin-top: auto !important; } > .l-c { - margin-right: auto !important; + margin-bottom: auto !important; } } diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less index 0d81f46f8..2c080150d 100644 --- a/src/less/core/wrapper/flex.wrapper.horizontal.less +++ b/src/less/core/wrapper/flex.wrapper.horizontal.less @@ -31,6 +31,45 @@ .bi-f-s-h, .bi-flex-scrollable-horizontal-layout { .flex(); + &.h-center { + > .f-s-h-w { + margin-left: auto !important; + margin-right: auto !important; + } + } + + &.v-middle { + > .f-s-h-w { + margin-top: auto !important; + margin-right: auto !important; + } + } + + &.h-right { + /* 09版 */ + -webkit-box-pack: flex-end; + /* 12版 */ + -webkit-justify-content: flex-end; + -moz-justify-content: flex-end; + -ms-justify-content: flex-end; + -ms-flex-pack: end; + -o-justify-content: flex-end; + justify-content: flex-end; + } + + + &.v-bottom { + /* 09版 */ + -webkit-box-align: flex-end; + /* 12版 */ + -webkit-align-items: flex-end; + -moz-align-items: flex-end; + -ms-align-items: flex-end; + -ms-flex-align: end; + -o-align-items: flex-end; + align-items: flex-end; + } + & .f-s-h-w, & .flex-scrollable-horizontal-layout-wrapper { .flex(); .horizontal(); diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index 67f1a460d..81673f99f 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -31,6 +31,44 @@ .bi-f-s-v, .bi-flex-scrollable-vertical-layout { .flex(); + &.h-center { + > .f-s-v-w { + margin-left: auto !important; + margin-right: auto !important; + } + } + + &.v-middle { + > .f-s-v-w { + margin-top: auto !important; + margin-bottom: auto !important; + } + } + + &.v-bottom { + /* 09版 */ + -webkit-box-align: flex-end; + /* 12版 */ + -webkit-align-items: flex-end; + -moz-align-items: flex-end; + -ms-align-items: flex-end; + -ms-flex-align: end; + -o-align-items: flex-end; + align-items: flex-end; + } + + &.h-right { + /* 09版 */ + -webkit-box-pack: flex-end; + /* 12版 */ + -webkit-justify-content: flex-end; + -moz-justify-content: flex-end; + -ms-justify-content: flex-end; + -ms-flex-pack: end; + -o-justify-content: flex-end; + justify-content: flex-end; + } + & .f-s-v-w, & .flex-scrollable-vertical-layout-wrapper { .flex(); .vertical(); @@ -122,11 +160,11 @@ //-ms-flex-pack: center; //justify-content: center; > .f-c { - margin-left: auto !important; + margin-top: auto !important; } > .l-c { - margin-right: auto !important; + margin-bottom: auto !important; } } From 54fb4d00271f5d583b47e91aaa7b4a6b0c4ee708 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 28 Mar 2021 12:42:01 +0800 Subject: [PATCH 25/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/wrapper/flex.wrapper.vertical.less | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index 81673f99f..c9653c175 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -30,6 +30,7 @@ .bi-f-s-v, .bi-flex-scrollable-vertical-layout { .flex(); + .vertical(); &.h-center { > .f-s-v-w { @@ -45,7 +46,7 @@ } } - &.v-bottom { + &.h-right { /* 09版 */ -webkit-box-align: flex-end; /* 12版 */ @@ -57,7 +58,7 @@ align-items: flex-end; } - &.h-right { + &.v-bottom { /* 09版 */ -webkit-box-pack: flex-end; /* 12版 */ @@ -69,6 +70,18 @@ justify-content: flex-end; } + &.h-stretch { + /* 09版 */ + -webkit-box-align: stretch; + /* 12版 */ + -webkit-align-items: stretch; + -moz-align-items: stretch; + -ms-align-items: stretch; + -ms-flex-align: stretch; + -o-align-items: stretch; + align-items: stretch; + } + & .f-s-v-w, & .flex-scrollable-vertical-layout-wrapper { .flex(); .vertical(); From f0270a207f68be501ff777b5b7ddf2f901163b93 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 28 Mar 2021 15:53:41 +0800 Subject: [PATCH 26/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/layout.inline.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index 24078ace2..ea4c6dc5a 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -52,6 +52,9 @@ BI.InlineLayout = BI.inherit(BI.Layout, { right += o.hgap + o.lgap + o.rgap + o.columnSize[k]; } w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); + if (o.horizontalAlign === BI.HorizontalAlign.Stretch) { + w.element.width(0); + } } if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { w.element.css({ From 1a11c3b51be0bd044f95c8cb4f6b44a9481240d2 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 28 Mar 2021 15:54:58 +0800 Subject: [PATCH 27/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 52771f68b..54d1d499a 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -52,7 +52,7 @@ BI.prepares.push(function () { return BI.extend({}, ob, {type: "bi.table_adapt"}); }); BI.Plugin.configWidget("bi.center_adapt", function (ob) { - var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); + var supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; if (!isAdapt || justOneItem) { if (supportFlex) { @@ -66,7 +66,7 @@ BI.prepares.push(function () { return ob; }); BI.Plugin.configWidget("bi.vertical_adapt", function (ob) { - var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); + var supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; if (!isAdapt || justOneItem) { if (supportFlex) { From 84e90c13b37070fe547daea09e58dc32d89c55ed Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 28 Mar 2021 16:16:14 +0800 Subject: [PATCH 28/28] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 54d1d499a..de1a203b9 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -33,22 +33,29 @@ BI.prepares.push(function () { }); // } } + // // IE9以上可以使用calc计算布局 + // if (!isIE || BI.getIEVersion() > 8) { + // return BI.extend({}, ob, { + // type: "bi.inline", + // horizontalAlign: !justOneItem && ob.horizontalAlign === BI.HorizontalAlign.Center + // ? BI.HorizontalAlign.Left : ob.horizontalAlign + // }); + // } return BI.extend({}, ob, {type: "bi.table_adapt"}); } if (supportFlex) { // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 - if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { - return BI.extend({}, ob, {type: "bi.flex_horizontal"}); - } + // if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) { + return BI.extend({}, ob, {type: "bi.flex_horizontal"}); + // } } - // // 解决使用inline_vertical_adapt的顺序问题 - // // 从右往左放置时,为了兼容,我们统一采用从右到左的放置方式 - // if (ob.horizontalAlign === BI.HorizontalAlign.Right) { - // return BI.extend({verticalAlign: BI.VerticalAlign.Top}, ob, { - // type: "bi.inline_vertical_adapt", - // items: ob.items && ob.items.reverse() + // // IE9以上采用inline + // if (!isIE || BI.getIEVersion() > 8) { + // return BI.extend({}, ob, { + // type: "bi.inline" // }); // } + // 否则采用table,不过horizontalAlign的right就不支持了。 return BI.extend({}, ob, {type: "bi.table_adapt"}); }); BI.Plugin.configWidget("bi.center_adapt", function (ob) { @@ -61,7 +68,9 @@ BI.prepares.push(function () { return BI.extend({}, ob, {type: "bi.flex_center_adapt"}); // } } - return BI.extend({}, ob, {type: "bi.inline_center_adapt"}); + if (!BI.isIE() || BI.getIEVersion() > 8) { + return BI.extend({}, ob, {type: "bi.inline_center_adapt"}); + } } return ob; }); @@ -75,7 +84,9 @@ BI.prepares.push(function () { return BI.extend({}, ob, {type: "bi.flex_vertical_adapt"}); // } } - return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"}); + if (!BI.isIE() || BI.getIEVersion() > 8) { + return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"}); + } } return ob; });