@umijs/plugins 4.0.90 → 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/layout.js +32 -15
- package/package.json +4 -4
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/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"
|