guy 4 years ago
parent
commit
9396f3c2eb
  1. 38
      src/core/platform/web/config.js

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

@ -14,26 +14,15 @@ BI.prepares.push(function () {
return _isSupportFlex; return _isSupportFlex;
}; };
BI.Plugin.configWidget("bi.horizontal", function (ob) { BI.Plugin.configWidget("bi.horizontal", function (ob) {
var isIE = BI.isIE(), supportFlex = isSupportFlex(), isLessIE8 = isIE && BI.getIEVersion() < 8; var supportFlex = isSupportFlex();
if (isLessIE8) { // // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
return ob; // // 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景
} // if (ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch) {
// 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // return BI.extend({}, ob, {type: "bi.table_adapt"});
// 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景 // }
if (ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch) {
return BI.extend({}, ob, {type: "bi.table_adapt"});
}
if (supportFlex) { if (supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_horizontal"}); return BI.extend({}, ob, {type: "bi.flex_horizontal"});
} }
// // 解决使用inline_vertical_adapt的顺序问题
// // 从右往左放置时,为了兼容,我们统一采用从右到左的放置方式
// if (ob.horizontalAlign === BI.HorizontalAlign.Right) {
// return BI.extend({verticalAlign: BI.VerticalAlign.Top}, ob, {
// type: "bi.inline_vertical_adapt",
// items: ob.items && ob.items.reverse()
// });
// }
return BI.extend({}, ob, {type: "bi.table_adapt"}); return BI.extend({}, ob, {type: "bi.table_adapt"});
}); });
BI.Plugin.configWidget("bi.center_adapt", function (ob) { BI.Plugin.configWidget("bi.center_adapt", function (ob) {
@ -60,12 +49,21 @@ BI.prepares.push(function () {
}); });
BI.Plugin.configWidget("bi.horizontal_adapt", function (ob) { BI.Plugin.configWidget("bi.horizontal_adapt", function (ob) {
var justOneItem = (ob.items && ob.items.length <= 1); var justOneItem = (ob.items && ob.items.length <= 1);
if (!ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP) { var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
if (justOneItem) { var verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP;
if (verticalAlignTop && justOneItem) {
return BI.extend({}, ob, {type: "bi.horizontal_auto"}); return BI.extend({}, ob, {type: "bi.horizontal_auto"});
} }
var supportFlex = isSupportFlex();
// 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
// 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景
if (isAdapt) {
return BI.extend({}, ob, {type: "bi.table_adapt"});
} }
return ob; if (supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_horizontal"});
}
return BI.extend({}, ob, {type: "bi.table_adapt"});
}); });
BI.Plugin.configWidget("bi.horizontal_float", function (ob) { BI.Plugin.configWidget("bi.horizontal_float", function (ob) {
if (isSupportFlex()) { if (isSupportFlex()) {

Loading…
Cancel
Save