Browse Source

feature: 支持auto

es6
guy 3 years ago
parent
commit
50019955e2
  1. 6
      src/core/platform/web/config.js
  2. 4
      src/core/wrapper/layout/flex/flex.horizontal.js
  3. 4
      src/core/wrapper/layout/flex/flex.vertical.js
  4. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  5. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js

6
src/core/platform/web/config.js

@ -49,7 +49,7 @@ BI.prepares.push(function () {
// 当列宽既需要自动列宽又需要自适应列宽时,inline布局也处理不了了,降级table处理吧 // 当列宽既需要自动列宽又需要自适应列宽时,inline布局也处理不了了,降级table处理吧
var hasAutoAndFillColumnSize = false; var hasAutoAndFillColumnSize = false;
if (ob.columnSize && ob.columnSize.length > 0) { if (ob.columnSize && ob.columnSize.length > 0) {
if (ob.columnSize.indexOf("") >= 0 && ob.columnSize.indexOf("fill") >= 0) { if ((ob.columnSize.indexOf("") >= 0 || ob.columnSize.indexOf("auto") >= 0) && ob.columnSize.indexOf("fill") >= 0) {
hasAutoAndFillColumnSize = true; hasAutoAndFillColumnSize = true;
} }
} else { } else {
@ -57,7 +57,7 @@ BI.prepares.push(function () {
BI.each(ob.items, function (i, item) { BI.each(ob.items, function (i, item) {
if (item.width === "fill") { if (item.width === "fill") {
hasFill = true; hasFill = true;
} else if (BI.isNull(item.width) || item.width === "") { } else if (BI.isNull(item.width) || item.width === "" || item.width === "auto") {
hasAuto = true; hasAuto = true;
} }
}); });
@ -173,7 +173,7 @@ BI.prepares.push(function () {
} }
var hasAuto = false; var hasAuto = false;
if (ob.rowSize && ob.rowSize.length > 0) { if (ob.rowSize && ob.rowSize.length > 0) {
if (ob.rowSize.indexOf("") >= 0) { if (ob.rowSize.indexOf("") >= 0 || ob.rowSize.indexOf("auto") >= 0) {
hasAuto = true; hasAuto = true;
} }
} else { } else {

4
src/core/wrapper/layout/flex/flex.horizontal.js

@ -40,10 +40,10 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
_hasFill: function () { _hasFill: function () {
var o = this.options; var o = this.options;
if (o.columnSize.length > 0) { if (o.columnSize.length > 0) {
return o.columnSize.indexOf("fill") >= 0; return o.columnSize.indexOf("fill") >= 0 || o.columnSize.indexOf("auto") >= 0;
} }
return BI.some(o.items, function (i, item) { return BI.some(o.items, function (i, item) {
if (item.width === "fill") { if (item.width === "fill" || item.width === "auto") {
return true; return true;
} }
}); });

4
src/core/wrapper/layout/flex/flex.vertical.js

@ -39,10 +39,10 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
_hasFill: function () { _hasFill: function () {
var o = this.options; var o = this.options;
if (o.rowSize.length > 0) { if (o.rowSize.length > 0) {
return o.rowSize.indexOf("fill") >= 0; return o.rowSize.indexOf("fill") >= 0 || o.rowSize.indexOf("auto") >= 0;
} }
return BI.some(o.items, function (i, item) { return BI.some(o.items, function (i, item) {
if (item.height === "fill") { if (item.height === "fill" || item.height === "auto") {
return true; return true;
} }
}); });

4
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js

@ -36,10 +36,10 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
_hasFill: function () { _hasFill: function () {
var o = this.options; var o = this.options;
if (o.columnSize.length > 0) { if (o.columnSize.length > 0) {
return o.columnSize.indexOf("fill") >= 0; return o.columnSize.indexOf("fill") >= 0 || o.columnSize.indexOf("auto") >= 0;
} }
return BI.some(o.items, function (i, item) { return BI.some(o.items, function (i, item) {
if (item.width === "fill") { if (item.width === "fill" || item.width === "auto") {
return true; return true;
} }
}); });

4
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js

@ -36,10 +36,10 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
_hasFill: function () { _hasFill: function () {
var o = this.options; var o = this.options;
if (o.rowSize.length > 0) { if (o.rowSize.length > 0) {
return o.rowSize.indexOf("fill") >= 0; return o.rowSize.indexOf("fill") >= 0 || o.rowSize.indexOf("auto") >= 0;
} }
return BI.some(o.items, function (i, item) { return BI.some(o.items, function (i, item) {
if (item.height === "fill") { if (item.height === "fill" || item.height === "auto") {
return true; return true;
} }
}); });

Loading…
Cancel
Save