From 54aad3d9c55e862bce0a3ec507fcd973eead3183 Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 25 Aug 2022 15:34:47 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-12552=20feat:=20=E4=B8=8D=E6=89=A7?= =?UTF-8?q?=E8=A1=8CBI.init()=EF=BC=8C=E5=BE=88=E5=A4=9A=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E4=BC=9A=E5=87=BA=E7=8E=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/0.base.js | 20 ++++----- src/core/{plugin.js => 6.plugin.js} | 0 src/core/platform/web/config.js | 70 ++++++++++++++--------------- 3 files changed, 44 insertions(+), 46 deletions(-) rename src/core/{plugin.js => 6.plugin.js} (100%) diff --git a/src/base/0.base.js b/src/base/0.base.js index a8aa11a21..1100c0709 100644 --- a/src/base/0.base.js +++ b/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(); diff --git a/src/core/plugin.js b/src/core/6.plugin.js similarity index 100% rename from src/core/plugin.js rename to src/core/6.plugin.js diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 9c4ba840c..6a955a27e 100644 --- a/src/core/platform/web/config.js +++ b/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" }); }); -}); +}());