diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 4785244881..c75662ae62 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -14,26 +14,15 @@ BI.prepares.push(function () { return _isSupportFlex; }; BI.Plugin.configWidget("bi.horizontal", function (ob) { - var isIE = BI.isIE(), supportFlex = isSupportFlex(), isLessIE8 = isIE && BI.getIEVersion() < 8; - if (isLessIE8) { - return ob; - } - // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) - // 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景 - if (ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch) { - return BI.extend({}, ob, {type: "bi.table_adapt"}); - } + var supportFlex = isSupportFlex(); + // // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) + // // 主要出现在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) { 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"}); }); BI.Plugin.configWidget("bi.center_adapt", function (ob) { @@ -60,12 +49,21 @@ BI.prepares.push(function () { }); 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 (justOneItem) { - return BI.extend({}, ob, {type: "bi.horizontal_auto"}); - } + var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; + var verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP; + if (verticalAlignTop && justOneItem) { + return BI.extend({}, ob, {type: "bi.horizontal_auto"}); } - return ob; + var supportFlex = isSupportFlex(); + // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) + // 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景 + if (isAdapt) { + return BI.extend({}, ob, {type: "bi.table_adapt"}); + } + 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) { if (isSupportFlex()) {