Browse Source

整理代码

es6
guy 3 years ago
parent
commit
52f1c6621b
  1. 15
      src/core/wrapper/layout/float/float.absolute.horizontal.js
  2. 9
      src/core/wrapper/layout/float/float.absolute.vertical.js
  3. 10
      src/less/core/wrapper/float.absolute.less

15
src/core/wrapper/layout/float/float.absolute.horizontal.js

@ -31,26 +31,29 @@ BI.FloatAbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
},
hgap: "50%",
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
bgap: o.bgap,
// lgap和rgap不传的话内部不会设置left和right
lgap: o.lgap,
rgap: o.rgap
};
},
_formatItems: function (items) {
if (this.options.horizontalAlign !== BI.HorizontalAlign.Center) {
var o = this.options;
if (o.horizontalAlign === BI.HorizontalAlign.Left) {
return items;
}
var cls = o.horizontalAlign === BI.HorizontalAlign.Right ? "bi-abs-r-x-item" : "bi-abs-c-x-item";
return BI.map(items, function (i, item) {
if (!item || BI.isEmptyObject(item)) {
return item;
}
var el = BI.stripEL(item);
if (BI.isWidget(el)) {
el.element.addClass("bi-abs-c-x-item");
el.element.addClass(cls);
} else {
el.cls = (el.cls || "") + "bi-abs-c-x-item";
el.cls = (el.cls || "") + cls;
}
return item;
});

9
src/core/wrapper/layout/float/float.absolute.vertical.js

@ -33,24 +33,27 @@ BI.FloatAbsoluteVerticalLayout = BI.inherit(BI.Layout, {
hgap: o.hgap,
lgap: o.lgap,
rgap: o.rgap,
// tgap和bgap不传的话内部不会设置top和bottom
tgap: o.tgap,
bgap: o.bgap
};
},
_formatItems: function (items) {
if (this.options.verticalAlign !== BI.VerticalAlign.Middle) {
var o = this.options;
if (o.verticalAlign === BI.VerticalAlign.Top) {
return items;
}
var cls = o.verticalAlign === BI.VerticalAlign.Bottom ? "bi-abs-b-y-item" : "bi-abs-c-y-item";
return BI.map(items, function (i, item) {
if (!item || BI.isEmptyObject(item)) {
return item;
}
var el = BI.stripEL(item);
if (BI.isWidget(el)) {
el.element.addClass("bi-abs-c-y-item");
el.element.addClass(cls);
} else {
el.cls = (el.cls || "") + "bi-abs-c-y-item";
el.cls = (el.cls || "") + cls;
}
return item;
});

10
src/less/core/wrapper/float.absolute.less

@ -25,3 +25,13 @@
-o-transform: translate(-50%, -50%); /* Opera */
transform: translate(-50%, -50%);
}
.bi-abs-b-y-item {
bottom: 0;
margin-top: auto;
}
.bi-abs-r-x-item {
right: 0;
margin-left: auto;
}

Loading…
Cancel
Save