guy 4 years ago
parent
commit
f42a0bfd3a
  1. 24
      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

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

@ -1,8 +1,15 @@
/** /**
* Created by dailer on 2019/6/19. * Created by dailer on 2019/6/19.
*/ */
!(function () {
BI.AbstractLabel = BI.inherit(BI.Single, { 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) { _defaultConfig: function (props) {
var conf = BI.AbstractLabel.superclass._defaultConfig.apply(this, arguments); var conf = BI.AbstractLabel.superclass._defaultConfig.apply(this, arguments);
@ -203,7 +210,10 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
_createNotCenterEl: function () { _createNotCenterEl: function () {
var o = this.options; 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(); var json = this._createJson();
if (BI.isNumber(o.width) && o.width > 0) { if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 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 if (BI.isNumber(o.height) && o.height > 0) { // 2.1
BI.createWidget({ BI.createWidget({
type: adaptLayout, type: adaptLayout,
horizontalAlign: o.textAlign,
height: o.height, height: o.height,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
element: this, element: this,
@ -224,6 +235,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
} }
BI.createWidget({ // 2.2 BI.createWidget({ // 2.2
type: adaptLayout, type: adaptLayout,
horizontalAlign: o.textAlign,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -260,6 +272,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap; json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
BI.createWidget({ // 2.4 BI.createWidget({ // 2.4
type: adaptLayout, type: adaptLayout,
horizontalAlign: o.textAlign,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -278,6 +291,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
json.width = o.textWidth; json.width = o.textWidth;
BI.createWidget({ // 2.5 BI.createWidget({ // 2.5
type: adaptLayout, type: adaptLayout,
horizontalAlign: o.textAlign,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -325,6 +339,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
})); }));
BI.createWidget({ BI.createWidget({
type: adaptLayout, type: adaptLayout,
horizontalAlign: o.textAlign,
element: this, element: this,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
items: [this.text] items: [this.text]
@ -370,4 +385,5 @@ BI.AbstractLabel = BI.inherit(BI.Single, {
populate: function () { populate: function () {
BI.AbstractLabel.superclass.populate.apply(this, arguments); 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" "flex-shrink": "0"
}); });
if (o.columnSize[i] > 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") { if (o.columnSize[i] === "fill") {
w.element.css("flex", "1"); 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" "flex-shrink": "0"
}); });
if (o.rowSize[i] > 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") { if (o.rowSize[i] === "fill") {
w.element.css("flex", "1"); 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" "flex-shrink": "0"
}); });
if (o.columnSize[i] > 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") { if (o.columnSize[i] === "fill") {
w.element.css("flex", "1"); 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" "flex-shrink": "0"
}); });
if (o.rowSize[i] > 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") { if (o.rowSize[i] === "fill") {
w.element.css("flex", "1"); w.element.css("flex", "1");

Loading…
Cancel
Save