Browse Source

Merge pull request #153075 in DEC/fineui from master to feature/x

* commit '71989e22631033324c108a0ebc2e3ea55698365f':
  KERNEL-12552 feat: 不执行BI.init(),很多方法调用会出现问题
master
superman 2 years ago
parent
commit
323412fd74
  1. 20
      src/base/0.base.js
  2. 0
      src/core/6.plugin.js
  3. 70
      src/core/platform/web/config.js

20
src/base/0.base.js

@ -1,11 +1,9 @@
BI.prepares.push(function () {
BI.Resizers = new BI.ResizeController();
BI.Layers = new BI.LayerController();
BI.Maskers = new BI.MaskersController();
BI.Bubbles = new BI.BubblesController();
BI.Tooltips = new BI.TooltipsController();
BI.Popovers = new BI.PopoverController();
BI.Drawers = new BI.DrawerController();
BI.Broadcasts = new BI.BroadcastController();
BI.StyleLoaders = new BI.StyleLoaderManager();
});
BI.Resizers = new BI.ResizeController();
BI.Layers = new BI.LayerController();
BI.Maskers = new BI.MaskersController();
BI.Bubbles = new BI.BubblesController();
BI.Tooltips = new BI.TooltipsController();
BI.Popovers = new BI.PopoverController();
BI.Drawers = new BI.DrawerController();
BI.Broadcasts = new BI.BroadcastController();
BI.StyleLoaders = new BI.StyleLoaderManager();

0
src/core/plugin.js → src/core/6.plugin.js

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

@ -1,5 +1,5 @@
// 工程配置
BI.prepares.push(function () {
!(function () {
// 注册布局
// adapt类布局优先级规则
// 1、支持flex的浏览器下使用flex布局
@ -39,16 +39,16 @@ BI.prepares.push(function () {
// return BI.extend({}, ob, {type: "bi.table_adapt"});
// }
if (supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_horizontal"});
return BI.extend({}, ob, { type: "bi.flex_horizontal" });
}
return BI.extend({
scrollx: true
}, ob, {type: "bi.inline"});
}, ob, { type: "bi.inline" });
});
BI.Plugin.configWidget("bi.vertical", function (ob) {
if (ob.horizontalAlign === BI.HorizontalAlign.Left || ob.horizontalAlign === BI.HorizontalAlign.Right) {
if (isSupportFlex()) {
return BI.extend({}, ob, {type: "bi.flex_vertical"});
return BI.extend({}, ob, { type: "bi.flex_vertical" });
}
return BI.extend({}, ob, {
horizontalAlign: BI.HorizontalAlign.Stretch,
@ -88,14 +88,14 @@ BI.prepares.push(function () {
if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === BI.HorizontalAlign.Stretch) {
return BI.extend({
verticalAlign: BI.VerticalAlign.Top
}, ob, {type: "bi.horizontal_float_fill"});
}, ob, { type: "bi.horizontal_float_fill" });
}
return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch
}, ob, {type: "bi.table_adapt"});
}, ob, { type: "bi.table_adapt" });
}
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, {type: "bi.responsive_inline"});
return BI.extend({}, ob, { type: "bi.responsive_inline" });
}
return ob;
});
@ -104,9 +104,9 @@ BI.prepares.push(function () {
// var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
// if (!isAdapt || justOneItem) {
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 BI.extend({}, ob, { type: "bi.inline_center_adapt" });
// }
// return ob;
});
@ -115,9 +115,9 @@ BI.prepares.push(function () {
// var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
// if (!isAdapt || justOneItem) {
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 BI.extend({}, ob, { type: "bi.inline_vertical_adapt" });
// }
// return ob;
});
@ -126,7 +126,7 @@ BI.prepares.push(function () {
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 BI.extend({}, ob, { type: "bi.horizontal_auto" });
}
var supportFlex = isSupportFlex();
// 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
@ -134,24 +134,24 @@ BI.prepares.push(function () {
if (isAdapt) {
return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center
}, ob, {type: "bi.table_adapt"});
}, ob, { type: "bi.table_adapt" });
}
if (supportFlex) {
return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center,
scrollx: false
}, ob, {type: "bi.flex_horizontal"});
}, ob, { type: "bi.flex_horizontal" });
}
return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center
}, ob, {type: "bi.table_adapt"});
}, ob, { type: "bi.table_adapt" });
});
BI.Plugin.configWidget("bi.horizontal_float", function (ob) {
if (isSupportFlex()) {
return BI.extend({}, ob, {type: "bi.flex_horizontal_adapt"});
return BI.extend({}, ob, { type: "bi.flex_horizontal_adapt" });
}
if (ob.items && ob.items.length <= 1) {
return BI.extend({}, ob, {type: "bi.inline_horizontal_adapt"});
return BI.extend({}, ob, { type: "bi.inline_horizontal_adapt" });
}
return ob;
});
@ -162,16 +162,16 @@ BI.prepares.push(function () {
horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch,
scrollx: false
}, ob, {type: "bi.flex_horizontal"});
}, ob, { type: "bi.flex_horizontal" });
}
if ((ob.horizontalAlign && ob.horizontalAlign !== BI.HorizontalAlign.Stretch) || (ob.scrollable === true || ob.scrollx === true)) {
// 宽度不受限,要用table布局
return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch
}, ob, {type: "bi.table_adapt"});
}, ob, { type: "bi.table_adapt" });
}
return BI.extend({}, ob, {type: "bi.horizontal_float_fill"});
return BI.extend({}, ob, { type: "bi.horizontal_float_fill" });
});
BI.Plugin.configWidget("bi.vertical_fill", function (ob) {
if (isSupportFlex()) {
@ -179,7 +179,7 @@ BI.prepares.push(function () {
horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch,
scrolly: false
}, ob, {type: "bi.flex_vertical"});
}, ob, { type: "bi.flex_vertical" });
}
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// 有滚动条,降级到table布局处理
@ -204,18 +204,18 @@ BI.prepares.push(function () {
}
if (hasAuto) {
// 有自动高的时候
return BI.extend({}, ob, {type: "bi.vtape_auto"});
return BI.extend({}, ob, { type: "bi.vtape_auto" });
}
return BI.extend({}, ob, {type: "bi.vtape"});
return BI.extend({}, ob, { type: "bi.vtape" });
});
BI.Plugin.configWidget("bi.horizontal_sticky", function (ob) {
if (!isSupportSticky) {
return BI.extend({ scrollx: true }, ob, {type: "bi.horizontal_fill"});
return BI.extend({ scrollx: true }, ob, { type: "bi.horizontal_fill" });
}
});
BI.Plugin.configWidget("bi.vertical_sticky", function (ob) {
if (!isSupportSticky) {
return BI.extend({ scrolly: true }, ob, {type: "bi.vertical_fill"});
return BI.extend({ scrolly: true }, ob, { type: "bi.vertical_fill" });
}
});
@ -223,7 +223,7 @@ BI.prepares.push(function () {
if (isSupportFlex()) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_left_right_vertical_adapt"});
return BI.extend({}, ob, { type: "bi.flex_left_right_vertical_adapt" });
// }
}
return ob;
@ -232,40 +232,40 @@ BI.prepares.push(function () {
if (ob.scrollable === true || ob.scrollx !== false) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, {type: "bi.responsive_flex_scrollable_horizontal"});
return BI.extend({}, ob, { type: "bi.responsive_flex_scrollable_horizontal" });
}
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"});
return BI.extend({}, ob, { type: "bi.flex_scrollable_horizontal" });
}
}
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, {type: "bi.responsive_flex_horizontal"});
return BI.extend({}, ob, { type: "bi.responsive_flex_horizontal" });
}
});
BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"});
return BI.extend({}, ob, { type: "bi.flex_scrollable_vertical" });
}
}
});
BI.Plugin.configWidget("bi.table", function (ob) {
if (!isSupportGrid()) {
return BI.extend({}, ob, {type: "bi.td"});
return BI.extend({}, ob, { type: "bi.td" });
}
return ob;
});
BI.Plugin.configWidget("bi.radio", function (ob) {
if (BI.isIE() && BI.getIEVersion() <= 9) {
return BI.extend({}, ob, {type: "bi.image_radio"});
return BI.extend({}, ob, { type: "bi.image_radio" });
}
return ob;
});
BI.Plugin.configWidget("bi.checkbox", function (ob) {
if (BI.isIE() && BI.getIEVersion() <= 9) {
return BI.extend({}, ob, {type: "bi.image_checkbox"});
return BI.extend({}, ob, { type: "bi.image_checkbox" });
}
return ob;
});
@ -274,6 +274,6 @@ BI.prepares.push(function () {
if (BI.isIE() && BI.getIEVersion() < 9) {
return ob;
}
return BI.extend({}, ob, {type: "bi.half_button"});
return BI.extend({}, ob, { type: "bi.half_button" });
});
});
}());

Loading…
Cancel
Save