Browse Source

整理代码

es6
guy 3 years ago
parent
commit
9448f94feb
  1. 14
      src/core/wrapper/layout/flex/flex.horizontal.js
  2. 14
      src/core/wrapper/layout/flex/flex.vertical.js
  3. 14
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  4. 14
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js

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

@ -34,6 +34,18 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items); 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) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); 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"); w.element.addClass("f-s-n");
} }
} else { } else {

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

@ -33,6 +33,18 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
this.populate(this.options.items); 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) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexVerticalLayout.superclass._addElement.apply(this, arguments); 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"); w.element.addClass("f-s-n");
} }
} else { } else {

14
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); 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) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexWrapperHorizontalLayout.superclass._addElement.apply(this, arguments); 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"); w.element.addClass("f-s-n");
} }
} else { } else {

14
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); 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) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexWrapperVerticalLayout.superclass._addElement.apply(this, arguments); 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"); w.element.addClass("f-s-n");
} }
} else { } else {

Loading…
Cancel
Save