@umijs/plugins 4.0.89 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/antd.js +50 -11
- package/dist/layout.js +32 -15
- package/dist/react-query.js +1 -0
- package/dist/styled-components.js +1 -0
- package/libs/qiankun/master/masterRuntimePlugin.tsx +3 -1
- package/package.json +4 -4
package/dist/antd.js
CHANGED
|
@@ -61,22 +61,61 @@ var antd_default = (api) => {
|
|
|
61
61
|
api.describe({
|
|
62
62
|
config: {
|
|
63
63
|
schema({ zod }) {
|
|
64
|
-
|
|
65
|
-
configProvider: zod.record(zod.any()),
|
|
66
|
-
// themes
|
|
64
|
+
const commonSchema = {
|
|
67
65
|
dark: zod.boolean(),
|
|
68
66
|
compact: zod.boolean(),
|
|
69
67
|
// babel-plugin-import
|
|
70
68
|
import: zod.boolean(),
|
|
71
69
|
// less or css, default less
|
|
72
|
-
style: zod.enum(["less", "css"]).describe("less or css, default less")
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
style: zod.enum(["less", "css"]).describe("less or css, default less")
|
|
71
|
+
};
|
|
72
|
+
const createZodRecordWithSpecifiedPartial = (partial) => {
|
|
73
|
+
const keys = Object.keys(partial);
|
|
74
|
+
return zod.union([
|
|
75
|
+
zod.object(partial),
|
|
76
|
+
zod.record(zod.any()).refine((obj) => {
|
|
77
|
+
return !keys.some((key) => key in obj);
|
|
78
|
+
})
|
|
79
|
+
]);
|
|
80
|
+
};
|
|
81
|
+
const createV5Schema = () => {
|
|
82
|
+
const componentNameSchema = zod.string().refine(
|
|
83
|
+
(value) => {
|
|
84
|
+
const firstLetter = value.slice(0, 1);
|
|
85
|
+
return firstLetter === firstLetter.toUpperCase();
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
message: "theme.components.[componentName] needs to be in PascalCase, e.g. theme.components.Button"
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
const themeSchema = createZodRecordWithSpecifiedPartial({
|
|
92
|
+
components: zod.record(componentNameSchema, zod.record(zod.any()))
|
|
93
|
+
});
|
|
94
|
+
const configProvider = createZodRecordWithSpecifiedPartial({
|
|
95
|
+
theme: themeSchema
|
|
96
|
+
});
|
|
97
|
+
return zod.object({
|
|
98
|
+
...commonSchema,
|
|
99
|
+
theme: themeSchema.describe("Shortcut of `configProvider.theme`"),
|
|
100
|
+
appConfig: zod.record(zod.any()).describe("Only >= antd@5.1.0 is supported"),
|
|
101
|
+
momentPicker: zod.boolean().describe("DatePicker & Calendar use moment version"),
|
|
102
|
+
styleProvider: zod.record(zod.any()),
|
|
103
|
+
configProvider
|
|
104
|
+
}).deepPartial();
|
|
105
|
+
};
|
|
106
|
+
const createV4Schema = () => {
|
|
107
|
+
return zod.object({
|
|
108
|
+
...commonSchema,
|
|
109
|
+
configProvider: zod.record(zod.any())
|
|
110
|
+
}).deepPartial();
|
|
111
|
+
};
|
|
112
|
+
if (isV5) {
|
|
113
|
+
return createV5Schema();
|
|
114
|
+
}
|
|
115
|
+
if (isV4) {
|
|
116
|
+
return createV4Schema();
|
|
117
|
+
}
|
|
118
|
+
return zod.object({});
|
|
80
119
|
}
|
|
81
120
|
},
|
|
82
121
|
enableBy({ userConfig }) {
|
package/dist/layout.js
CHANGED
|
@@ -64,6 +64,7 @@ var layout_default = (api) => {
|
|
|
64
64
|
antdVersion = require(`${pkgPath2}/package.json`).version;
|
|
65
65
|
} catch (e) {
|
|
66
66
|
}
|
|
67
|
+
const packageName = api.pkg.name || "plugin-layout";
|
|
67
68
|
const isAntd5 = antdVersion.startsWith("5");
|
|
68
69
|
const layoutFile = isAntd5 ? "Layout.css" : "Layout.less";
|
|
69
70
|
api.describe({
|
|
@@ -231,7 +232,7 @@ const { formatMessage } = useIntl();
|
|
|
231
232
|
<ProLayout
|
|
232
233
|
route={route}
|
|
233
234
|
location={location}
|
|
234
|
-
title={userConfig.title || '
|
|
235
|
+
title={userConfig.title || '${packageName}'}
|
|
235
236
|
navTheme="dark"
|
|
236
237
|
siderWidth={256}
|
|
237
238
|
onMenuHeaderClick={(e) => {
|
|
@@ -435,21 +436,28 @@ export function getRightRenderContent (opts: {
|
|
|
435
436
|
);
|
|
436
437
|
}
|
|
437
438
|
|
|
438
|
-
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
439
|
+
const showAvatar = opts.initialState?.avatar || opts.initialState?.name || opts.runtimeConfig.logout;
|
|
440
|
+
const disableAvatarImg = opts.initialState?.avatar === false;
|
|
441
|
+
const nameClassName = disableAvatarImg ? 'umi-plugin-layout-name umi-plugin-layout-hide-avatar-img' : 'umi-plugin-layout-name';
|
|
442
|
+
const avatar =
|
|
443
|
+
showAvatar ? (
|
|
444
|
+
<span className="umi-plugin-layout-action">
|
|
445
|
+
{!disableAvatarImg ?
|
|
446
|
+
(
|
|
447
|
+
<Avatar
|
|
448
|
+
size="small"
|
|
449
|
+
className="umi-plugin-layout-avatar"
|
|
450
|
+
src={
|
|
451
|
+
opts.initialState?.avatar ||
|
|
452
|
+
"https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png"
|
|
453
|
+
}
|
|
454
|
+
alt="avatar"
|
|
455
|
+
/>
|
|
456
|
+
) : null}
|
|
457
|
+
<span className={nameClassName}>{opts.initialState?.name}</span>
|
|
451
458
|
</span>
|
|
452
|
-
|
|
459
|
+
) : null;
|
|
460
|
+
|
|
453
461
|
|
|
454
462
|
if (opts.loading) {
|
|
455
463
|
return (
|
|
@@ -459,6 +467,11 @@ export function getRightRenderContent (opts: {
|
|
|
459
467
|
);
|
|
460
468
|
}
|
|
461
469
|
|
|
470
|
+
// 如果没有打开Locale,并且头像为空就取消掉这个返回的内容
|
|
471
|
+
{{^Locale}}
|
|
472
|
+
if(!avatar) return null;
|
|
473
|
+
{{/Locale}}
|
|
474
|
+
|
|
462
475
|
const langMenu = {
|
|
463
476
|
className: "umi-plugin-layout-menu",
|
|
464
477
|
selectedKeys: [],
|
|
@@ -498,6 +511,7 @@ export function getRightRenderContent (opts: {
|
|
|
498
511
|
}
|
|
499
512
|
|
|
500
513
|
|
|
514
|
+
|
|
501
515
|
return (
|
|
502
516
|
<div className="umi-plugin-layout-right anticon">
|
|
503
517
|
{opts.runtimeConfig.logout ? (
|
|
@@ -575,6 +589,9 @@ ${// antd@5里面没有这个样式了
|
|
|
575
589
|
.umi-plugin-layout-name {
|
|
576
590
|
margin-left: 8px;
|
|
577
591
|
}
|
|
592
|
+
.umi-plugin-layout-name.umi-plugin-layout-hide-avatar-img {
|
|
593
|
+
margin-left: 0;
|
|
594
|
+
}
|
|
578
595
|
`
|
|
579
596
|
});
|
|
580
597
|
api.writeTmpFile({
|
package/dist/react-query.js
CHANGED
|
@@ -87,6 +87,7 @@ var react_query_default = (api) => {
|
|
|
87
87
|
api.writeTmpFile({
|
|
88
88
|
path: "runtime.tsx",
|
|
89
89
|
content: enableQueryClient ? `
|
|
90
|
+
import React from 'react';
|
|
90
91
|
import { defaultContext, QueryClient, QueryClientProvider } from '${pkgPath}';
|
|
91
92
|
import { ReactQueryDevtools } from '${devtoolPkgPath}';
|
|
92
93
|
${reactQueryRuntimeCode}
|
|
@@ -120,6 +120,7 @@ export { styled, ThemeProvider, createGlobalStyle, css, keyframes, StyleSheetMan
|
|
|
120
120
|
api.writeTmpFile({
|
|
121
121
|
path: "runtime.tsx",
|
|
122
122
|
content: `
|
|
123
|
+
import React from 'react';
|
|
123
124
|
${hasProvider ? `import { StyleSheetManager } from '${(0, import_utils.winPath)(libPath)}';` : ``}
|
|
124
125
|
|
|
125
126
|
${styledComponentsRuntimeCode}
|
|
@@ -109,7 +109,7 @@ export async function render(oldRender: typeof noop) {
|
|
|
109
109
|
microAppRuntimeRoutes = routes;
|
|
110
110
|
|
|
111
111
|
// 主应用相关的配置注册完毕后即可开启渲染
|
|
112
|
-
oldRender();
|
|
112
|
+
const renderData = oldRender();
|
|
113
113
|
|
|
114
114
|
// 未使用 base 配置的可以认为是路由关联或者使用标签装载的应用
|
|
115
115
|
const loadableApps = apps.filter((app) => !app.base);
|
|
@@ -133,6 +133,8 @@ export async function render(oldRender: typeof noop) {
|
|
|
133
133
|
'[plugins/qiankun] 检测到还在使用旧版配置,该配置已移除,请尽快升级到最新配置方式以获得更好的开发体验,详见 https://umijs.org/plugins/plugin-qiankun#%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97',
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
|
+
|
|
137
|
+
return renderData;
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
export function patchClientRoutes({ routes }: { routes: any[] }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "@umijs/plugins",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@tanstack/react-query-devtools": "^4.24.10",
|
|
28
28
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
|
-
"babel-plugin-import": "^1.13.
|
|
30
|
+
"babel-plugin-import": "^1.13.8",
|
|
31
31
|
"babel-plugin-styled-components": "2.1.4",
|
|
32
32
|
"dayjs": "^1.11.7",
|
|
33
33
|
"dva-core": "^2.0.4",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"styled-components": "6.1.1",
|
|
46
46
|
"tslib": "^2",
|
|
47
47
|
"warning": "^4.0.3",
|
|
48
|
-
"@umijs/bundler-utils": "4.0
|
|
48
|
+
"@umijs/bundler-utils": "4.1.0",
|
|
49
49
|
"@umijs/valtio": "1.0.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"antd": "^4.24.1",
|
|
53
|
-
"umi": "4.0
|
|
53
|
+
"umi": "4.1.0"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|