Browse Source

Pull request #1913: 无JIRA任务 布局统一

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '68de06687fcb238feba611628141b140c0adb293':
  bugfix
  bugfix
  bugfix
es6
guy 4 years ago
parent
commit
8eee76b43b
  1. 74
      src/core/platform/web/config.js

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

@ -14,58 +14,58 @@ 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的顺序问题 return BI.extend({
// // 从右往左放置时,为了兼容,我们统一采用从右到左的放置方式 scrollx: true
// if (ob.horizontalAlign === BI.HorizontalAlign.Right) { }, ob, {type: "bi.inline"});
// 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) { BI.Plugin.configWidget("bi.center_adapt", function (ob) {
var supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); var 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 (!isAdapt || justOneItem) { // if (!isAdapt || justOneItem) {
if (supportFlex) { if (supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_center_adapt"}); return BI.extend({}, ob, {type: "bi.flex_center_adapt"});
}
return BI.extend({}, ob, {type: "bi.inline_center_adapt"});
} }
return ob; return BI.extend({}, ob, {type: "bi.inline_center_adapt"});
// }
// return ob;
}); });
BI.Plugin.configWidget("bi.vertical_adapt", function (ob) { BI.Plugin.configWidget("bi.vertical_adapt", function (ob) {
var supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1); var 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 (!isAdapt || justOneItem) { // if (!isAdapt || justOneItem) {
if (supportFlex) { if (supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_vertical_center_adapt"}); return BI.extend({}, ob, {type: "bi.flex_vertical_center_adapt"});
}
return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"});
} }
return ob; return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"});
// }
// 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); 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;
return BI.extend({}, ob, {type: "bi.horizontal_auto"}); 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) { BI.Plugin.configWidget("bi.horizontal_float", function (ob) {
if (isSupportFlex()) { if (isSupportFlex()) {

Loading…
Cancel
Save