guy 4 years ago
parent
commit
f42a0bfd3a
  1. 20
      src/base/single/label/abstract.label.js
  2. 2
      src/core/wrapper/layout/flex/flex.horizontal.js
  3. 2
      src/core/wrapper/layout/flex/flex.vertical.js
  4. 2
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  5. 2
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js

20
src/base/single/label/abstract.label.js

@ -1,7 +1,14 @@
/**
* Created by dailer on 2019/6/19.
*/
!(function () {
var _isSupportFlex;
var isSupportFlex = function () {
if (_isSupportFlex == null) {
_isSupportFlex = !!(BI.isSupportCss3 && BI.isSupportCss3("flex"));
}
return _isSupportFlex;
};
BI.AbstractLabel = BI.inherit(BI.Single, {
_defaultConfig: function (props) {
@ -203,7 +210,10 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
_createNotCenterEl: function () {
var o = this.options;
var adaptLayout = o.textAlign === "right" ? "bi.right_vertical_adapt" : "bi.vertical_adapt";
var adaptLayout = "bi.vertical_adapt";
if (o.textAlign === "right" && (BI.isIE() || !isSupportFlex())) {
adaptLayout = "bi.right_vertical_adapt";
}
var json = this._createJson();
if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
@ -211,6 +221,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
if (BI.isNumber(o.height) && o.height > 0) { // 2.1
BI.createWidget({
type: adaptLayout,
horizontalAlign: o.textAlign,
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
@ -224,6 +235,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
}
BI.createWidget({ // 2.2
type: adaptLayout,
horizontalAlign: o.textAlign,
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
vgap: o.vgap,
@ -260,6 +272,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
BI.createWidget({ // 2.4
type: adaptLayout,
horizontalAlign: o.textAlign,
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
vgap: o.vgap,
@ -278,6 +291,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
json.width = o.textWidth;
BI.createWidget({ // 2.5
type: adaptLayout,
horizontalAlign: o.textAlign,
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
vgap: o.vgap,
@ -325,6 +339,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
}));
BI.createWidget({
type: adaptLayout,
horizontalAlign: o.textAlign,
element: this,
scrollable: o.whiteSpace === "normal",
items: [this.text]
@ -371,3 +386,4 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
BI.AbstractLabel.superclass.populate.apply(this, arguments);
}
});
}());

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

@ -36,7 +36,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
"flex-shrink": "0"
});
if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i]);
w.element.width(o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]);
}
if (o.columnSize[i] === "fill") {
w.element.css("flex", "1");

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

@ -35,7 +35,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
"flex-shrink": "0"
});
if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i]);
w.element.height(o.rowSize[i] <= 1 ? (o.rowSize[i] * 100 + "%") : o.rowSize[i]);
}
if (o.rowSize[i] === "fill") {
w.element.css("flex", "1");

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

@ -37,7 +37,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
"flex-shrink": "0"
});
if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i]);
w.element.width(o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]);
}
if (o.columnSize[i] === "fill") {
w.element.css("flex", "1");

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

@ -37,7 +37,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
"flex-shrink": "0"
});
if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i]);
w.element.height(o.rowSize[i] <= 1 ? (o.rowSize[i] * 100 + "%") : o.rowSize[i]);
}
if (o.rowSize[i] === "fill") {
w.element.css("flex", "1");

Loading…
Cancel
Save