From c057a5f7fbeda6c82c2d735774892fdce01e61f1 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 27 Mar 2021 16:03:13 +0800 Subject: [PATCH] =?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; } }