guy 4 years ago
parent
commit
ca09f7c835
  1. 15
      src/core/platform/web/config.js

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

@ -36,12 +36,10 @@ BI.prepares.push(function () {
BI.Plugin.configWidget("bi.center_adapt", function (ob) { BI.Plugin.configWidget("bi.center_adapt", function (ob) {
var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
if (!isIE && supportFlex) { if (!isAdapt || justOneItem) {
if (!isAdapt || justOneItem) { if (!isIE && supportFlex) {
return BI.extend(ob, {type: "bi.flex_center_adapt"}); return BI.extend(ob, {type: "bi.flex_center_adapt"});
} }
}
if (!isAdapt || justOneItem) {
return BI.extend(ob, {type: "bi.inline_center_adapt"}); return BI.extend(ob, {type: "bi.inline_center_adapt"});
} }
return ob; return ob;
@ -49,19 +47,18 @@ BI.prepares.push(function () {
BI.Plugin.configWidget("bi.vertical_adapt", function (ob) { BI.Plugin.configWidget("bi.vertical_adapt", function (ob) {
var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
if (!isIE && supportFlex) { if (!isAdapt || justOneItem) {
if (!isAdapt || justOneItem) { if (!isIE && supportFlex) {
return BI.extend(ob, {type: "bi.flex_vertical_center_adapt"}); return BI.extend(ob, {type: "bi.flex_vertical_center_adapt"});
} }
}
if (!isAdapt || justOneItem) {
return BI.extend(ob, {type: "bi.inline_vertical_adapt"}); return BI.extend(ob, {type: "bi.inline_vertical_adapt"});
} }
return ob; return ob;
}); });
BI.Plugin.configWidget("bi.horizontal_adapt", function (ob) { BI.Plugin.configWidget("bi.horizontal_adapt", function (ob) {
var justOneItem = (ob.items && ob.items.length <= 1);
if (!ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP) { if (!ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP) {
if (ob.items && ob.items.length <= 1) { if (justOneItem) {
return BI.extend(ob, {type: "bi.horizontal_auto"}); return BI.extend(ob, {type: "bi.horizontal_auto"});
} }
} }

Loading…
Cancel
Save