@umijs/plugins 4.0.0-canary.20230517.1 → 4.0.0-canary.20230531.1
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 +29 -3
- package/dist/layout.js +11 -1
- package/dist/locale.js +3 -3
- package/package.json +4 -3
- package/templates/antd/runtime.ts.tpl +31 -0
package/dist/antd.js
CHANGED
|
@@ -53,6 +53,7 @@ var antd_default = (api) => {
|
|
|
53
53
|
antdVersion = require(`${pkgPath}/package.json`).version;
|
|
54
54
|
} catch (e) {
|
|
55
55
|
}
|
|
56
|
+
const isV5 = antdVersion.startsWith("5");
|
|
56
57
|
const appComponentAvailable = import_plugin_utils.semver.gte(antdVersion, "5.1.0");
|
|
57
58
|
const appConfigAvailable = import_plugin_utils.semver.gte(antdVersion, "5.3.0");
|
|
58
59
|
const day2MomentAvailable = import_plugin_utils.semver.gte(antdVersion, "5.0.0");
|
|
@@ -72,7 +73,8 @@ var antd_default = (api) => {
|
|
|
72
73
|
// Only antd@5.1.0 is supported
|
|
73
74
|
appConfig: zod.record(zod.any()).describe("Only antd@5.1.0 is supported"),
|
|
74
75
|
// DatePicker & Calendar use moment version
|
|
75
|
-
momentPicker: zod.boolean().describe("Only antd@5.x is supported")
|
|
76
|
+
momentPicker: zod.boolean().describe("Only antd@5.x is supported"),
|
|
77
|
+
styleProvider: zod.record(zod.any())
|
|
76
78
|
}).deepPartial();
|
|
77
79
|
}
|
|
78
80
|
},
|
|
@@ -167,7 +169,7 @@ var antd_default = (api) => {
|
|
|
167
169
|
return memo;
|
|
168
170
|
});
|
|
169
171
|
api.addExtraBabelPlugins(() => {
|
|
170
|
-
const style =
|
|
172
|
+
const style = isV5 ? false : api.config.antd.style || "less";
|
|
171
173
|
return api.config.antd.import && !api.appData.vite ? [
|
|
172
174
|
[
|
|
173
175
|
require.resolve("babel-plugin-import"),
|
|
@@ -185,11 +187,35 @@ var antd_default = (api) => {
|
|
|
185
187
|
api.onGenerateFiles(() => {
|
|
186
188
|
const withConfigProvider = !!api.config.antd.configProvider;
|
|
187
189
|
const withAppConfig = appConfigAvailable && !!api.config.antd.appConfig;
|
|
190
|
+
const styleProvider = api.config.antd.styleProvider;
|
|
191
|
+
const ieTarget = !!api.config.targets.ie || !!api.config.legacy;
|
|
192
|
+
let styleProviderConfig = false;
|
|
193
|
+
if (isV5 && (ieTarget || styleProvider)) {
|
|
194
|
+
const cssinjs = (0, import_resolveProjectDep.resolveProjectDep)({
|
|
195
|
+
pkg: api.pkg,
|
|
196
|
+
cwd: api.cwd,
|
|
197
|
+
dep: "@ant-design/cssinjs"
|
|
198
|
+
}) || (0, import_path.dirname)(require.resolve("@ant-design/cssinjs/package.json"));
|
|
199
|
+
if (cssinjs) {
|
|
200
|
+
styleProviderConfig = {
|
|
201
|
+
cssinjs
|
|
202
|
+
};
|
|
203
|
+
if (ieTarget) {
|
|
204
|
+
styleProviderConfig.hashPriority = "high";
|
|
205
|
+
styleProviderConfig.legacyTransformer = true;
|
|
206
|
+
}
|
|
207
|
+
styleProviderConfig = {
|
|
208
|
+
...styleProviderConfig,
|
|
209
|
+
...styleProvider
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
188
213
|
api.writeTmpFile({
|
|
189
214
|
path: `runtime.tsx`,
|
|
190
215
|
context: {
|
|
191
216
|
configProvider: withConfigProvider && JSON.stringify(api.config.antd.configProvider),
|
|
192
|
-
appConfig: appComponentAvailable && JSON.stringify(api.config.antd.appConfig)
|
|
217
|
+
appConfig: appComponentAvailable && JSON.stringify(api.config.antd.appConfig),
|
|
218
|
+
styleProvider: styleProviderConfig
|
|
193
219
|
},
|
|
194
220
|
tplPath: (0, import_plugin_utils.winPath)((0, import_path.join)(ANTD_TEMPLATES_DIR, "runtime.ts.tpl"))
|
|
195
221
|
});
|
package/dist/layout.js
CHANGED
|
@@ -251,7 +251,17 @@ const { formatMessage } = useIntl();
|
|
|
251
251
|
}
|
|
252
252
|
return defaultDom;
|
|
253
253
|
}}
|
|
254
|
-
itemRender={(route) =>
|
|
254
|
+
itemRender={(route, _, routes) => {
|
|
255
|
+
const { breadcrumbName, title, path } = route;
|
|
256
|
+
const label = title || breadcrumbName
|
|
257
|
+
const last = routes[routes.length - 1]
|
|
258
|
+
if (last) {
|
|
259
|
+
if (last.path === path || last.linkPath === path) {
|
|
260
|
+
return <span>{label}</span>;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return <Link to={path}>{label}</Link>;
|
|
264
|
+
}}
|
|
255
265
|
disableContentMargin
|
|
256
266
|
fixSiderbar
|
|
257
267
|
fixedHeader
|
package/dist/locale.js
CHANGED
|
@@ -108,7 +108,7 @@ var locale_default = (api) => {
|
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
110
|
api.onGenerateFiles(async () => {
|
|
111
|
-
var _a, _b, _c
|
|
111
|
+
var _a, _b, _c;
|
|
112
112
|
const localeTpl = (0, import_fs.readFileSync)(
|
|
113
113
|
(0, import_path.join)(LOCALE_TEMPLATES_DIR, "locale.tpl"),
|
|
114
114
|
"utf-8"
|
|
@@ -139,7 +139,7 @@ var locale_default = (api) => {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
let DefaultAntdLocales = [];
|
|
142
|
-
if (!antdLocales.length &&
|
|
142
|
+
if (!antdLocales.length && antd) {
|
|
143
143
|
const [lang, country = ""] = defaultLocale.split(baseSeparator);
|
|
144
144
|
DefaultAntdLocales = import_plugin_utils.lodash.uniq(
|
|
145
145
|
await addAntdLocales({
|
|
@@ -218,7 +218,7 @@ var locale_default = (api) => {
|
|
|
218
218
|
Antd: !!antd,
|
|
219
219
|
LocaleList: localeList,
|
|
220
220
|
ShowSelectLang: localeList.length > 1 && !!antd,
|
|
221
|
-
antdFiles: ((
|
|
221
|
+
antdFiles: ((_c = api.config) == null ? void 0 : _c.ssr) ? "lib" : "es"
|
|
222
222
|
})
|
|
223
223
|
});
|
|
224
224
|
api.writeTmpFile({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20230531.1",
|
|
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",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@ahooksjs/use-request": "^2.0.0",
|
|
21
21
|
"@ant-design/antd-theme-variable": "^1.0.0",
|
|
22
|
+
"@ant-design/cssinjs": "^1.9.1",
|
|
22
23
|
"@ant-design/icons": "^4.7.0",
|
|
23
24
|
"@ant-design/moment-webpack-plugin": "^0.0.3",
|
|
24
25
|
"@ant-design/pro-components": "^2.0.1",
|
|
@@ -43,12 +44,12 @@
|
|
|
43
44
|
"styled-components": "6.0.0-rc.0",
|
|
44
45
|
"tslib": "^2",
|
|
45
46
|
"warning": "^4.0.3",
|
|
46
|
-
"@umijs/bundler-utils": "4.0.0-canary.
|
|
47
|
+
"@umijs/bundler-utils": "4.0.0-canary.20230531.1",
|
|
47
48
|
"@umijs/valtio": "1.0.3"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"antd": "^4.24.1",
|
|
51
|
-
"umi": "4.0.0-canary.
|
|
52
|
+
"umi": "4.0.0-canary.20230531.1"
|
|
52
53
|
},
|
|
53
54
|
"publishConfig": {
|
|
54
55
|
"access": "public"
|
|
@@ -11,6 +11,14 @@ import {
|
|
|
11
11
|
notification,
|
|
12
12
|
} from 'antd';
|
|
13
13
|
import { ApplyPluginsType } from 'umi';
|
|
14
|
+
{{#styleProvider}}
|
|
15
|
+
import {
|
|
16
|
+
StyleProvider,
|
|
17
|
+
{{#styleProvider.legacyTransformer}}
|
|
18
|
+
legacyLogicalPropertiesTransformer
|
|
19
|
+
{{/styleProvider.legacyTransformer}}
|
|
20
|
+
} from '{{{styleProvider.cssinjs}}}';
|
|
21
|
+
{{/styleProvider}}
|
|
14
22
|
import { getPluginManager } from '../core/plugin';
|
|
15
23
|
|
|
16
24
|
let cacheAntdConfig = null;
|
|
@@ -58,9 +66,32 @@ export function rootContainer(rawContainer) {
|
|
|
58
66
|
iconPrefixCls: finalConfigProvider.iconPrefixCls,
|
|
59
67
|
});
|
|
60
68
|
};
|
|
69
|
+
|
|
70
|
+
if (finalConfigProvider.theme) {
|
|
71
|
+
// Pass config theme to static method
|
|
72
|
+
ConfigProvider.config({
|
|
73
|
+
theme: finalConfigProvider.theme,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
61
77
|
container = <ConfigProvider {...finalConfigProvider}>{container}</ConfigProvider>;
|
|
62
78
|
{{/configProvider}}
|
|
63
79
|
|
|
80
|
+
{{#styleProvider}}
|
|
81
|
+
container = (
|
|
82
|
+
<StyleProvider
|
|
83
|
+
{{#styleProvider.hashPriority}}
|
|
84
|
+
hashPriority="{{{styleProviderConfig.hashPriority}}}"
|
|
85
|
+
{{/styleProvider.hashPriority}}
|
|
86
|
+
{{#styleProvider.legacyTransformer}}
|
|
87
|
+
transformers={[legacyLogicalPropertiesTransformer]}
|
|
88
|
+
{{/styleProvider.legacyTransformer}}
|
|
89
|
+
>
|
|
90
|
+
{container}
|
|
91
|
+
</StyleProvider>
|
|
92
|
+
);
|
|
93
|
+
{{/styleProvider}}
|
|
94
|
+
|
|
64
95
|
return container;
|
|
65
96
|
}
|
|
66
97
|
|