fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.8 KiB

7 years ago
// 工程配置
7 years ago
BI.prepares.push(function () {
7 years ago
// 注册布局
7 years ago
var _isSupprtFlex;
var isSupportFlex = function () {
if (_isSupprtFlex == null) {
7 years ago
_isSupprtFlex = !!(BI.isSupportCss3 && BI.isSupportCss3("flex"));
}
return _isSupprtFlex;
};
8 years ago
BI.Plugin.registerWidget("bi.horizontal", function (ob) {
7 years ago
// center_adapt
if (ob.verticalAlign === BI.VerticalAlign.Middle && ob.horizontalAlign === BI.HorizontalAlign.Center) {
return ob;
}
// vertical_adapt
if (ob.verticalAlign === BI.VerticalAlign.Middle && ob.horizontalAlign === BI.HorizontalAlign.Left) {
return ob;
}
// horizontal_adapt
if (ob.verticalAlign === BI.VerticalAlign.Top && ob.horizontalAlign === BI.HorizontalAlign.Center) {
return ob;
}
if (!BI.isIE() && isSupportFlex()) {
8 years ago
return BI.extend(ob, {type: "bi.flex_horizontal"});
}
7 years ago
return ob;
8 years ago
});
BI.Plugin.registerWidget("bi.center_adapt", function (ob) {
7 years ago
if (!BI.isIE() && isSupportFlex() && ob.items && ob.items.length <= 1) {
7 years ago
// 有滚动条的情况下需要用到flex_wrapper_center布局
8 years ago
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
7 years ago
// 不是IE用flex_wrapper_center布局
return BI.extend(ob, {type: "bi.flex_wrapper_center"});
8 years ago
}
return BI.extend(ob, {type: "bi.flex_center"});
}
7 years ago
return ob;
8 years ago
});
BI.Plugin.registerWidget("bi.vertical_adapt", function (ob) {
7 years ago
if (!BI.isIE() && isSupportFlex()) {
7 years ago
// 有滚动条的情况下需要用到flex_wrapper_center布局
8 years ago
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
7 years ago
// 不是IE用flex_wrapper_center布局
return BI.extend({}, ob, {type: "bi.flex_wrapper_vertical_center"});
8 years ago
}
8 years ago
return BI.extend(ob, {type: "bi.flex_vertical_center"});
}
7 years ago
return ob;
8 years ago
});
7 years ago
BI.Plugin.registerWidget("bi.horizontal_adapt", function (ob) {
if (ob.items && ob.items.length <= 1) {
return BI.extend(ob, {type: "bi.horizontal_auto"});
}
return ob;
});
8 years ago
BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) {
7 years ago
if (!BI.isIE() && isSupportFlex()) {
7 years ago
// 有滚动条的情况下需要用到flex_wrapper_center布局
8 years ago
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
7 years ago
// 不是IE用flex_wrapper_center布局
return BI.extend({}, ob, {type: "bi.flex_wrapper_center"});
8 years ago
}
return BI.extend(ob, {type: "bi.flex_center"});
}
return BI.extend(ob, {type: "bi.inline_center_adapt"});
8 years ago
});
7 years ago
});