Browse Source

KERNEL-12552 feat: 不执行BI.init(),很多方法调用会出现问题

es6
zsmj 2 years ago
parent
commit
54aad3d9c5
  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.Resizers = new BI.ResizeController(); BI.Layers = new BI.LayerController();
BI.Layers = new BI.LayerController(); BI.Maskers = new BI.MaskersController();
BI.Maskers = new BI.MaskersController(); BI.Bubbles = new BI.BubblesController();
BI.Bubbles = new BI.BubblesController(); BI.Tooltips = new BI.TooltipsController();
BI.Tooltips = new BI.TooltipsController(); BI.Popovers = new BI.PopoverController();
BI.Popovers = new BI.PopoverController(); BI.Drawers = new BI.DrawerController();
BI.Drawers = new BI.DrawerController(); BI.Broadcasts = new BI.BroadcastController();
BI.Broadcasts = new BI.BroadcastController(); BI.StyleLoaders = new BI.StyleLoaderManager();
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类布局优先级规则 // adapt类布局优先级规则
// 1、支持flex的浏览器下使用flex布局 // 1、支持flex的浏览器下使用flex布局
@ -39,16 +39,16 @@ BI.prepares.push(function () {
// return BI.extend({}, ob, {type: "bi.table_adapt"}); // 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" });
} }
return BI.extend({ return BI.extend({
scrollx: true scrollx: true
}, ob, {type: "bi.inline"}); }, ob, { type: "bi.inline" });
}); });
BI.Plugin.configWidget("bi.vertical", function (ob) { BI.Plugin.configWidget("bi.vertical", function (ob) {
if (ob.horizontalAlign === BI.HorizontalAlign.Left || ob.horizontalAlign === BI.HorizontalAlign.Right) { if (ob.horizontalAlign === BI.HorizontalAlign.Left || ob.horizontalAlign === BI.HorizontalAlign.Right) {
if (isSupportFlex()) { if (isSupportFlex()) {
return BI.extend({}, ob, {type: "bi.flex_vertical"}); return BI.extend({}, ob, { type: "bi.flex_vertical" });
} }
return BI.extend({}, ob, { return BI.extend({}, ob, {
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
@ -88,14 +88,14 @@ BI.prepares.push(function () {
if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === BI.HorizontalAlign.Stretch) { if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === BI.HorizontalAlign.Stretch) {
return BI.extend({ return BI.extend({
verticalAlign: BI.VerticalAlign.Top verticalAlign: BI.VerticalAlign.Top
}, ob, {type: "bi.horizontal_float_fill"}); }, ob, { type: "bi.horizontal_float_fill" });
} }
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch horizontalAlign: BI.HorizontalAlign.Stretch
}, ob, {type: "bi.table_adapt"}); }, ob, { type: "bi.table_adapt" });
} }
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { 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; return ob;
}); });
@ -104,9 +104,9 @@ BI.prepares.push(function () {
// 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 BI.extend({}, ob, { type: "bi.inline_center_adapt" });
// } // }
// return ob; // return ob;
}); });
@ -115,9 +115,9 @@ BI.prepares.push(function () {
// 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 BI.extend({}, ob, { type: "bi.inline_vertical_adapt" });
// } // }
// return ob; // 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 isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
var verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP; var verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP;
if (verticalAlignTop && justOneItem) { if (verticalAlignTop && justOneItem) {
return BI.extend({}, ob, {type: "bi.horizontal_auto"}); return BI.extend({}, ob, { type: "bi.horizontal_auto" });
} }
var supportFlex = isSupportFlex(); var supportFlex = isSupportFlex();
// 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
@ -134,24 +134,24 @@ BI.prepares.push(function () {
if (isAdapt) { if (isAdapt) {
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center horizontalAlign: BI.HorizontalAlign.Center
}, ob, {type: "bi.table_adapt"}); }, ob, { type: "bi.table_adapt" });
} }
if (supportFlex) { if (supportFlex) {
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center, horizontalAlign: BI.HorizontalAlign.Center,
scrollx: false scrollx: false
}, ob, {type: "bi.flex_horizontal"}); }, ob, { type: "bi.flex_horizontal" });
} }
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Center horizontalAlign: BI.HorizontalAlign.Center
}, ob, {type: "bi.table_adapt"}); }, 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()) {
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) { 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; return ob;
}); });
@ -162,16 +162,16 @@ BI.prepares.push(function () {
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch, verticalAlign: BI.VerticalAlign.Stretch,
scrollx: false 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)) { if ((ob.horizontalAlign && ob.horizontalAlign !== BI.HorizontalAlign.Stretch) || (ob.scrollable === true || ob.scrollx === true)) {
// 宽度不受限,要用table布局 // 宽度不受限,要用table布局
return BI.extend({ return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.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) { BI.Plugin.configWidget("bi.vertical_fill", function (ob) {
if (isSupportFlex()) { if (isSupportFlex()) {
@ -179,7 +179,7 @@ BI.prepares.push(function () {
horizontalAlign: BI.HorizontalAlign.Stretch, horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch, verticalAlign: BI.VerticalAlign.Stretch,
scrolly: false scrolly: false
}, ob, {type: "bi.flex_vertical"}); }, ob, { type: "bi.flex_vertical" });
} }
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// 有滚动条,降级到table布局处理 // 有滚动条,降级到table布局处理
@ -204,18 +204,18 @@ BI.prepares.push(function () {
} }
if (hasAuto) { 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) { BI.Plugin.configWidget("bi.horizontal_sticky", function (ob) {
if (!isSupportSticky) { 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) { BI.Plugin.configWidget("bi.vertical_sticky", function (ob) {
if (!isSupportSticky) { 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()) { if (isSupportFlex()) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) { // 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; return ob;
@ -232,40 +232,40 @@ BI.prepares.push(function () {
if (ob.scrollable === true || ob.scrollx !== false) { if (ob.scrollable === true || ob.scrollx !== false) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { 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()) { 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) { BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) { if (ob.scrollable === true || ob.scrollx === true) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { 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) { BI.Plugin.configWidget("bi.table", function (ob) {
if (!isSupportGrid()) { if (!isSupportGrid()) {
return BI.extend({}, ob, {type: "bi.td"}); return BI.extend({}, ob, { type: "bi.td" });
} }
return ob; return ob;
}); });
BI.Plugin.configWidget("bi.radio", function (ob) { BI.Plugin.configWidget("bi.radio", function (ob) {
if (BI.isIE() && BI.getIEVersion() <= 9) { if (BI.isIE() && BI.getIEVersion() <= 9) {
return BI.extend({}, ob, {type: "bi.image_radio"}); return BI.extend({}, ob, { type: "bi.image_radio" });
} }
return ob; return ob;
}); });
BI.Plugin.configWidget("bi.checkbox", function (ob) { BI.Plugin.configWidget("bi.checkbox", function (ob) {
if (BI.isIE() && BI.getIEVersion() <= 9) { if (BI.isIE() && BI.getIEVersion() <= 9) {
return BI.extend({}, ob, {type: "bi.image_checkbox"}); return BI.extend({}, ob, { type: "bi.image_checkbox" });
} }
return ob; return ob;
}); });
@ -274,6 +274,6 @@ BI.prepares.push(function () {
if (BI.isIE() && BI.getIEVersion() < 9) { if (BI.isIE() && BI.getIEVersion() < 9) {
return ob; return ob;
} }
return BI.extend({}, ob, {type: "bi.half_button"}); return BI.extend({}, ob, { type: "bi.half_button" });
}); });
}); }());

Loading…
Cancel
Save