diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index 59108c851..c6877c383 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -34,6 +34,18 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, + _hasFill: function () { + var o = this.options; + if (o.columnSize.length > 0) { + return o.columnSize.indexOf("fill") >= 0; + } + return BI.some(o.items, function (i, item) { + if (item.width === "fill") { + return true; + } + }); + }, + _addElement: function (i, item) { var o = this.options; var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); @@ -54,7 +66,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { } } // 当既有动态宽度和自适应宽度的时候只压缩自适应 - if (columnSize === "" && o.columnSize.indexOf("fill") >= 0) { + if (columnSize === "" && this._hasFill()) { w.element.addClass("f-s-n"); } } else { diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js index eb38d07a3..f5fa620aa 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -33,6 +33,18 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, + _hasFill: function () { + var o = this.options; + if (o.rowSize.length > 0) { + return o.rowSize.indexOf("fill") >= 0; + } + return BI.some(o.items, function (i, item) { + if (item.height === "fill") { + return true; + } + }); + }, + _addElement: function (i, item) { var o = this.options; var w = BI.FlexVerticalLayout.superclass._addElement.apply(this, arguments); @@ -53,7 +65,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { } } // 当既有动态宽度和自适应宽度的时候只压缩自适应 - if (rowSize === "" && o.rowSize.indexOf("fill") >= 0) { + if (rowSize === "" && this._hasFill()) { w.element.addClass("f-s-n"); } } else { 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 fb4ea738a..f0715b150 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -30,6 +30,18 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, + _hasFill: function () { + var o = this.options; + if (o.columnSize.length > 0) { + return o.columnSize.indexOf("fill") >= 0; + } + return BI.some(o.items, function (i, item) { + if (item.width === "fill") { + return true; + } + }); + }, + _addElement: function (i, item) { var o = this.options; var w = BI.FlexWrapperHorizontalLayout.superclass._addElement.apply(this, arguments); @@ -50,7 +62,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { } } // 当既有动态宽度和自适应宽度的时候只压缩自适应 - if (columnSize === "" && o.columnSize.indexOf("fill") >= 0) { + if (columnSize === "" && this._hasFill()) { w.element.addClass("f-s-n"); } } else { 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 413bb0fa2..c46f8c222 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -30,6 +30,18 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, + _hasFill: function () { + var o = this.options; + if (o.rowSize.length > 0) { + return o.rowSize.indexOf("fill") >= 0; + } + return BI.some(o.items, function (i, item) { + if (item.height === "fill") { + return true; + } + }); + }, + _addElement: function (i, item) { var o = this.options; var w = BI.FlexWrapperVerticalLayout.superclass._addElement.apply(this, arguments); @@ -50,7 +62,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { } } // 当既有动态宽度和自适应宽度的时候只压缩自适应 - if (rowSize === "" && o.rowSize.indexOf("fill") >= 0) { + if (rowSize === "" && this._hasFill()) { w.element.addClass("f-s-n"); } } else {