Browse Source

KERNEL-14316 fix: config 找不到依赖

es6
Treecat 2 years ago
parent
commit
4055f40eb0
  1. 3
      package.json
  2. 89
      src/core/platform/web/config.js

3
package.json

@ -4,6 +4,9 @@
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"module": "dist/esm/index.js", "module": "dist/esm/index.js",
"sideEffects": [
"dist/esm/core/**"
],
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",
"bin": { "bin": {
"fui-cli": "./bin/cli/cli.js" "fui-cli": "./bin/cli/cli.js"

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

@ -3,6 +3,21 @@ import { Providers } from "../../5.inject";
import { Plugin } from "../../6.plugin"; import { Plugin } from "../../6.plugin";
import { isSupportCss3, isIE, getIEVersion } from "../../platform/web"; import { isSupportCss3, isIE, getIEVersion } from "../../platform/web";
import { HorizontalAlign, VerticalAlign } from "../../constant"; import { HorizontalAlign, VerticalAlign } from "../../constant";
import { FlexCenterLayout, FlexHorizontalLayout, VerticalLayout,
FlexVerticalLayout, TdLayout, InlineLayout, TableAdaptLayout,
FloatHorizontalFillLayout, ResponsiveInlineLayout,
InlineCenterAdaptLayout, FlexVerticalCenterAdapt,
InlineVerticalAdaptLayout, HorizontalAutoLayout,
TableAdaptLayout, FlexHorizontalCenter,
InlineHorizontalAdaptLayout, TableLayout,
AutoVerticalTapeLayout, VTapeLayout,
HorizontalFillLayout, VerticalFillLayout,
FlexLeftRightVerticalAdaptLayout, ResponsiveFlexWrapperHorizontalLayout,
FlexWrapperHorizontalLayout, ResponsiveFlexHorizontalLayout,
FlexWrapperVerticalLayout
} from "@/core/wrapper/layout/index";
import { SystemProvider } from "@/core/system";
// 工程配置 // 工程配置
// 注册布局 // 注册布局
@ -54,25 +69,25 @@ configWidget("bi.horizontal", ob => {
// return extend({}, ob, {type: "bi.table_adapt"}); // return extend({}, ob, {type: "bi.table_adapt"});
// } // }
if (supportFlex) { if (supportFlex) {
return extend({}, ob, { type: "bi.flex_horizontal" }); return extend({}, ob, { type: FlexHorizontalLayout.xtype });
} }
return extend({ return extend({
scrollx: true, scrollx: true,
}, ob, { type: "bi.inline" }); }, ob, { type: InlineLayout.xtype });
}); });
configWidget("bi.vertical", ob => { configWidget("bi.vertical", ob => {
if (ob.horizontalAlign === HorizontalAlign.Left || ob.horizontalAlign === HorizontalAlign.Right) { if (ob.horizontalAlign === HorizontalAlign.Left || ob.horizontalAlign === HorizontalAlign.Right) {
if (isSupportFlex()) { if (isSupportFlex()) {
return extend({}, ob, { type: "bi.flex_vertical" }); return extend({}, ob, { type: FlexVerticalLayout.xtype });
} }
return extend({}, ob, { return extend({}, ob, {
horizontalAlign: HorizontalAlign.Stretch, horizontalAlign: HorizontalAlign.Stretch,
type: "bi.vertical", type: VerticalLayout.xtype,
items: map(ob.items, (i, item) => { items: map(ob.items, (i, item) => {
return { return {
type: "bi.inline", type: InlineLayout.xtype,
horizontalAlign: ob.horizontalAlign, horizontalAlign: ob.horizontalAlign,
items: [item], items: [item],
}; };
@ -83,7 +98,7 @@ configWidget("bi.vertical", ob => {
if (isSupportFlex()) { if (isSupportFlex()) {
return extend({ return extend({
horizontalAlign: HorizontalAlign.Stretch, horizontalAlign: HorizontalAlign.Stretch,
}, ob, { type: "bi.flex_vertical" }); }, ob, { type: FlexVerticalLayout.xtype });
} }
} }
@ -113,15 +128,15 @@ configWidget("bi.inline", ob => {
if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === HorizontalAlign.Stretch) { if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === HorizontalAlign.Stretch) {
return extend({ return extend({
verticalAlign: VerticalAlign.Top, verticalAlign: VerticalAlign.Top,
}, ob, { type: "bi.horizontal_float_fill" }); }, ob, { type: FloatHorizontalFillLayout.xtype });
} }
return extend({ return extend({
horizontalAlign: HorizontalAlign.Stretch, horizontalAlign: HorizontalAlign.Stretch,
}, ob, { type: "bi.table_adapt" }); }, ob, { type: TableAdaptLayout.xtype });
} }
if (Providers.getProvider("bi.provider.system").getResponsiveMode()) { if (Providers.getProvider(SystemProvider.xtype).getResponsiveMode()) {
return extend({}, ob, { type: "bi.responsive_inline" }); return extend({}, ob, { type: ResponsiveInlineLayout.xtype });
} }
return ob; return ob;
@ -131,10 +146,10 @@ configWidget("bi.center_adapt", ob => {
// var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch; // var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch;
// if (!isAdapt || justOneItem) { // if (!isAdapt || justOneItem) {
if (supportFlex) { if (supportFlex) {
return extend({}, ob, { type: "bi.flex_center_adapt" }); return extend({}, ob, { type: FlexCenterLayout.xtype });
} }
return extend({}, ob, { type: "bi.inline_center_adapt" }); return extend({}, ob, { type: InlineCenterAdaptLayout.xtype });
// } // }
// return ob; // return ob;
}); });
@ -143,10 +158,10 @@ configWidget("bi.vertical_adapt", ob => {
// var isAdapt = ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch; // var isAdapt = ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch;
// if (!isAdapt || justOneItem) { // if (!isAdapt || justOneItem) {
if (supportFlex) { if (supportFlex) {
return extend({}, ob, { type: "bi.flex_vertical_center_adapt" }); return extend({}, ob, { type: FlexVerticalCenterAdapt.xtype });
} }
return extend({}, ob, { type: "bi.inline_vertical_adapt" }); return extend({}, ob, { type: InlineVerticalAdaptLayout.xtype });
// } // }
// return ob; // return ob;
}); });
@ -156,7 +171,7 @@ configWidget("bi.horizontal_adapt", ob => {
const isAdapt = !ob.horizontalAlign || ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch; const isAdapt = !ob.horizontalAlign || ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch;
const verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === VerticalAlign.TOP; const verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === VerticalAlign.TOP;
if (verticalAlignTop && justOneItem) { if (verticalAlignTop && justOneItem) {
return extend({}, ob, { type: "bi.horizontal_auto" }); return extend({}, ob, { type: HorizontalAutoLayout.xtype });
} }
const supportFlex = isSupportFlex(); const supportFlex = isSupportFlex();
// 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
@ -164,26 +179,26 @@ configWidget("bi.horizontal_adapt", ob => {
if (isAdapt) { if (isAdapt) {
return extend({ return extend({
horizontalAlign: HorizontalAlign.Center, horizontalAlign: HorizontalAlign.Center,
}, ob, { type: "bi.table_adapt" }); }, ob, { type: TableAdaptLayout.xtype });
} }
if (supportFlex) { if (supportFlex) {
return extend({ return extend({
horizontalAlign: HorizontalAlign.Center, horizontalAlign: HorizontalAlign.Center,
scrollx: false, scrollx: false,
}, ob, { type: "bi.flex_horizontal" }); }, ob, { type: FlexHorizontalLayout.xtype });
} }
return extend({ return extend({
horizontalAlign: HorizontalAlign.Center, horizontalAlign: HorizontalAlign.Center,
}, ob, { type: "bi.table_adapt" }); }, ob, { type: TableAdaptLayout.xtype });
}); });
configWidget("bi.horizontal_float", ob => { configWidget("bi.horizontal_float", ob => {
if (isSupportFlex()) { if (isSupportFlex()) {
return extend({}, ob, { type: "bi.flex_horizontal_adapt" }); return extend({}, ob, { type: FlexHorizontalCenter.xtype });
} }
if (ob.items && ob.items.length <= 1) { if (ob.items && ob.items.length <= 1) {
return extend({}, ob, { type: "bi.inline_horizontal_adapt" }); return extend({}, ob, { type: InlineHorizontalAdaptLayout.xtype });
} }
return ob; return ob;
@ -195,17 +210,17 @@ configWidget("bi.horizontal_fill", ob => {
horizontalAlign: HorizontalAlign.Stretch, horizontalAlign: HorizontalAlign.Stretch,
verticalAlign: VerticalAlign.Stretch, verticalAlign: VerticalAlign.Stretch,
scrollx: false, scrollx: false,
}, ob, { type: "bi.flex_horizontal" }); }, ob, { type: FlexHorizontalLayout.xtype });
} }
if ((ob.horizontalAlign && ob.horizontalAlign !== HorizontalAlign.Stretch) || (ob.scrollable === true || ob.scrollx === true)) { if ((ob.horizontalAlign && ob.horizontalAlign !== HorizontalAlign.Stretch) || (ob.scrollable === true || ob.scrollx === true)) {
// 宽度不受限,要用table布局 // 宽度不受限,要用table布局
return extend({ return extend({
horizontalAlign: HorizontalAlign.Stretch, horizontalAlign: HorizontalAlign.Stretch,
verticalAlign: VerticalAlign.Stretch, verticalAlign: VerticalAlign.Stretch,
}, ob, { type: "bi.table_adapt" }); }, ob, { type: TableLayout.xtype });
} }
return extend({}, ob, { type: "bi.horizontal_float_fill" }); return extend({}, ob, { type: FloatHorizontalFillLayout.xtype });
}); });
configWidget("bi.vertical_fill", ob => { configWidget("bi.vertical_fill", ob => {
if (isSupportFlex()) { if (isSupportFlex()) {
@ -213,12 +228,12 @@ configWidget("bi.vertical_fill", ob => {
horizontalAlign: HorizontalAlign.Stretch, horizontalAlign: HorizontalAlign.Stretch,
verticalAlign: VerticalAlign.Stretch, verticalAlign: VerticalAlign.Stretch,
scrolly: false, scrolly: false,
}, ob, { type: "bi.flex_vertical" }); }, ob, { type: FlexVerticalLayout });
} }
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
// 有滚动条,降级到table布局处理 // 有滚动条,降级到table布局处理
return extend({}, ob, { return extend({}, ob, {
type: "bi.td", type: TdLayout.xtype,
items: map(ob.items, (i, item) => [item]), items: map(ob.items, (i, item) => [item]),
}); });
} }
@ -236,19 +251,19 @@ configWidget("bi.vertical_fill", ob => {
} }
if (hasAuto) { if (hasAuto) {
// 有自动高的时候 // 有自动高的时候
return extend({}, ob, { type: "bi.vtape_auto" }); return extend({}, ob, { type: AutoVerticalTapeLayout.xtype });
} }
return extend({}, ob, { type: "bi.vtape" }); return extend({}, ob, { type: VTapeLayout.xtype });
}); });
configWidget("bi.horizontal_sticky", ob => { configWidget("bi.horizontal_sticky", ob => {
if (!isSupportSticky) { if (!isSupportSticky) {
return extend({ scrollx: true }, ob, { type: "bi.horizontal_fill" }); return extend({ scrollx: true }, ob, { type: HorizontalFillLayout.xtype });
} }
}); });
configWidget("bi.vertical_sticky", ob => { configWidget("bi.vertical_sticky", ob => {
if (!isSupportSticky) { if (!isSupportSticky) {
return extend({ scrolly: true }, ob, { type: "bi.vertical_fill" }); return extend({ scrolly: true }, ob, { type: VerticalFillLayout.xtype });
} }
}); });
@ -256,7 +271,7 @@ configWidget("bi.left_right_vertical_adapt", ob => {
if (isSupportFlex()) { if (isSupportFlex()) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!isIE() || (ob.scrollable !== true && ob.scrolly !== true)) { // if (!isIE() || (ob.scrollable !== true && ob.scrolly !== true)) {
return extend({}, ob, { type: "bi.flex_left_right_vertical_adapt" }); return extend({}, ob, { type: FlexLeftRightVerticalAdaptLayout.xtype });
// } // }
} }
@ -265,28 +280,28 @@ configWidget("bi.left_right_vertical_adapt", ob => {
configWidget("bi.flex_horizontal", ob => { configWidget("bi.flex_horizontal", ob => {
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
if (Providers.getProvider("bi.provider.system").getResponsiveMode()) { if (Providers.getProvider(SystemProvider.xtype).getResponsiveMode()) {
return extend({}, ob, { type: "bi.responsive_flex_scrollable_horizontal" }); return extend({}, ob, { type: ResponsiveFlexWrapperHorizontalLayout.xtype });
} }
return extend({}, ob, { type: "bi.flex_scrollable_horizontal" }); return extend({}, ob, { type: FlexWrapperHorizontalLayout.xtype });
} }
} }
if (Providers.getProvider("bi.provider.system").getResponsiveMode()) { if (Providers.getProvider(SystemProvider.xtype).getResponsiveMode()) {
return extend({}, ob, { type: "bi.responsive_flex_horizontal" }); return extend({}, ob, { type: ResponsiveFlexHorizontalLayout.xtype });
} }
}); });
configWidget("bi.flex_vertical", ob => { configWidget("bi.flex_vertical", ob => {
if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) {
if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
return extend({}, ob, { type: "bi.flex_scrollable_vertical" }); return extend({}, ob, { type: FlexWrapperVerticalLayout.xtype });
} }
} }
}); });
configWidget("bi.table", ob => { configWidget("bi.table", ob => {
if (!isSupportGrid()) { if (!isSupportGrid()) {
return extend({}, ob, { type: "bi.td" }); return extend({}, ob, { type: TdLayout.xtype });
} }
return ob; return ob;

Loading…
Cancel
Save