@umijs/plugins 4.3.4 → 4.3.5
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 +8 -0
- package/package.json +3 -3
package/dist/layout.js
CHANGED
|
@@ -388,11 +388,13 @@ ${icons.map((icon) => {
|
|
|
388
388
|
export default { ${icons.join(", ")} };
|
|
389
389
|
`
|
|
390
390
|
});
|
|
391
|
+
const isIconsFeatureEnable = api.isPluginEnable("icons");
|
|
391
392
|
api.writeTmpFile({
|
|
392
393
|
path: "runtime.tsx",
|
|
393
394
|
content: `
|
|
394
395
|
import React from 'react';
|
|
395
396
|
import icons from './icons';
|
|
397
|
+
${isIconsFeatureEnable ? `import { Icon, getIconComponent } from '@umijs/max';` : ""}
|
|
396
398
|
|
|
397
399
|
function formatIcon(name: string) {
|
|
398
400
|
return name
|
|
@@ -406,6 +408,12 @@ export function patchRoutes({ routes }) {
|
|
|
406
408
|
Object.keys(routes).forEach(key => {
|
|
407
409
|
const { icon } = routes[key];
|
|
408
410
|
if (icon && typeof icon === 'string') {
|
|
411
|
+
${isIconsFeatureEnable ? `const Component = getIconComponent(icon)
|
|
412
|
+
if (Component) {
|
|
413
|
+
routes[key].icon = <Icon icon={icon} width={14} height={14} />;
|
|
414
|
+
return;
|
|
415
|
+
}` : ""}
|
|
416
|
+
|
|
409
417
|
const upperIcon = formatIcon(icon);
|
|
410
418
|
if (icons[upperIcon] || icons[upperIcon + 'Outlined']) {
|
|
411
419
|
routes[key].icon = React.createElement(icons[upperIcon] || icons[upperIcon + 'Outlined']);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.5",
|
|
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",
|
|
@@ -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.3.
|
|
48
|
+
"@umijs/bundler-utils": "4.3.5",
|
|
49
49
|
"@umijs/valtio": "1.0.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"antd": "^4.24.1",
|
|
53
|
-
"umi": "4.3.
|
|
53
|
+
"umi": "4.3.5"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|