@umijs/plugins 4.0.42 → 4.0.43
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/access.js +12 -4
- package/dist/analytics.js +17 -11
- package/dist/antd.js +33 -16
- package/dist/dva.js +15 -7
- package/dist/initial-state.js +6 -3
- package/dist/layout.js +20 -12
- package/dist/locale.js +57 -26
- package/dist/mf.js +40 -16
- package/dist/model.js +14 -5
- package/dist/moment2dayjs.js +14 -6
- package/dist/qiankun/master.js +24 -5
- package/dist/qiankun/slave.js +101 -62
- package/dist/qiankun.js +12 -6
- package/dist/{icons.d.ts → react-query.d.ts} +0 -0
- package/dist/react-query.js +153 -0
- package/dist/request.js +17 -9
- package/dist/styled-components.js +4 -1
- package/dist/tailwindcss.js +24 -14
- package/dist/unocss.js +13 -5
- package/dist/utils/astUtils.js +4 -1
- package/dist/utils/localeUtils.js +11 -5
- package/dist/utils/modelUtils.js +34 -12
- package/dist/utils/resolveProjectDep.js +5 -3
- package/dist/utils/withTmpPath.js +7 -1
- package/dist/valtio.js +7 -2
- package/libs/qiankun/master/MicroApp.tsx +12 -0
- package/libs/qiankun/master/masterRuntimePlugin.tsx +10 -0
- package/libs/qiankun/master/routeUtils.ts +26 -0
- package/libs/qiankun/slave/MicroAppLink.tsx +122 -0
- package/libs/qiankun/slave/constants.ts +5 -0
- package/package.json +12 -9
- package/dist/icons.js +0 -29
package/dist/unocss.js
CHANGED
|
@@ -31,9 +31,12 @@ var unocss_default = (api) => {
|
|
|
31
31
|
key: "unocss",
|
|
32
32
|
config: {
|
|
33
33
|
schema(Joi) {
|
|
34
|
-
return Joi.alternatives().try(
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
return Joi.alternatives().try(
|
|
35
|
+
Joi.object({
|
|
36
|
+
watch: Joi.array()
|
|
37
|
+
}),
|
|
38
|
+
Joi.boolean().invalid(true)
|
|
39
|
+
);
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
42
|
enableBy: api.EnableBy.config
|
|
@@ -43,11 +46,16 @@ var unocss_default = (api) => {
|
|
|
43
46
|
if (process.env.IS_UMI_BUILD_WORKER)
|
|
44
47
|
return;
|
|
45
48
|
if (!(0, import_fs.existsSync)((0, import_path.join)(api.paths.cwd, "unocss.config.ts")))
|
|
46
|
-
api.logger.warn(
|
|
49
|
+
api.logger.warn(
|
|
50
|
+
"请在项目目录中添加 unocss.config.ts 文件,并配置需要的 unocss presets,否则插件将没有效果!"
|
|
51
|
+
);
|
|
47
52
|
const generatedPath = (0, import_path.join)(api.paths.absTmpPath, outputPath);
|
|
48
53
|
const binPath = (0, import_path.join)(api.cwd, "node_modules/.bin/unocss");
|
|
49
54
|
const watchDirs = api.config.unocss.watch;
|
|
50
|
-
const unocss = (0, import_child_process.exec)(
|
|
55
|
+
const unocss = (0, import_child_process.exec)(
|
|
56
|
+
`${binPath} ${watchDirs.join(" ")} --out-file ${generatedPath} ${api.env === "development" ? "--watch" : ""}`,
|
|
57
|
+
{ cwd: api.cwd }
|
|
58
|
+
);
|
|
51
59
|
unocss.on("error", (m) => {
|
|
52
60
|
api.logger.error("unocss service encounter an error: " + m);
|
|
53
61
|
});
|
package/dist/utils/astUtils.js
CHANGED
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
20
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
24
|
|
|
22
25
|
// src/utils/astUtils.ts
|
|
@@ -32,7 +32,9 @@ var import_plugin_utils = require("umi/plugin-utils");
|
|
|
32
32
|
var getMomentLocale = (lang, country, resolveKey) => {
|
|
33
33
|
var _a, _b;
|
|
34
34
|
const momentLocation = require.resolve(`${resolveKey}/locale/zh-cn`).replace(/zh\-cn\.js$/, "");
|
|
35
|
-
if ((0, import_fs.existsSync)(
|
|
35
|
+
if ((0, import_fs.existsSync)(
|
|
36
|
+
(0, import_path.join)(momentLocation, `${lang}-${(_a = country == null ? void 0 : country.toLocaleLowerCase) == null ? void 0 : _a.call(country)}.js`)
|
|
37
|
+
)) {
|
|
36
38
|
const momentLocale = `${lang}-${(_b = country == null ? void 0 : country.toLocaleLowerCase) == null ? void 0 : _b.call(country)}`;
|
|
37
39
|
return {
|
|
38
40
|
momentLocale
|
|
@@ -63,12 +65,16 @@ var getLocaleList = async (opts) => {
|
|
|
63
65
|
addAntdLocales,
|
|
64
66
|
resolveKey = "moment"
|
|
65
67
|
} = opts;
|
|
66
|
-
const localeFileMath = new RegExp(
|
|
68
|
+
const localeFileMath = new RegExp(
|
|
69
|
+
`^([a-z]{2})${separator}?([A-Z]{2})?.(js|json|ts)$`
|
|
70
|
+
);
|
|
67
71
|
const localeFiles = import_plugin_utils.glob.sync("*.{ts,js,json}", {
|
|
68
72
|
cwd: (0, import_plugin_utils.winPath)((0, import_path.join)(absSrcPath, localeFolder))
|
|
69
|
-
}).map((name) => (0, import_plugin_utils.winPath)((0, import_path.join)(absSrcPath, localeFolder, name))).concat(
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
}).map((name) => (0, import_plugin_utils.winPath)((0, import_path.join)(absSrcPath, localeFolder, name))).concat(
|
|
74
|
+
import_plugin_utils.glob.sync(`**/${localeFolder}/*.{ts,js,json}`, {
|
|
75
|
+
cwd: absPagesPath
|
|
76
|
+
}).map((name) => (0, import_plugin_utils.winPath)((0, import_path.join)(absPagesPath, name)))
|
|
77
|
+
).filter((p) => localeFileMath.test((0, import_path.basename)(p)) && (0, import_fs.existsSync)(p)).map((fullName) => {
|
|
72
78
|
var _a, _b;
|
|
73
79
|
const fileName = (0, import_path.basename)(fullName);
|
|
74
80
|
const fileInfo = (_b = (_a = localeFileMath.exec(fileName)) == null ? void 0 : _a.slice(1, 3)) == null ? void 0 : _b.filter(Boolean);
|
package/dist/utils/modelUtils.js
CHANGED
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
20
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
24
|
|
|
22
25
|
// src/utils/modelUtils.ts
|
|
@@ -40,7 +43,9 @@ function getNamespace(absFilePath, absSrcPath) {
|
|
|
40
43
|
const parts = relPath.split("/");
|
|
41
44
|
const dirs = parts.slice(0, -1);
|
|
42
45
|
const file = parts[parts.length - 1];
|
|
43
|
-
const validDirs = dirs.filter(
|
|
46
|
+
const validDirs = dirs.filter(
|
|
47
|
+
(dir) => !["src", "pages", "models"].includes(dir)
|
|
48
|
+
);
|
|
44
49
|
let normalizedFile = file;
|
|
45
50
|
normalizedFile = (0, import_path.basename)(file, (0, import_path.extname)(file));
|
|
46
51
|
if (normalizedFile.endsWith(".model")) {
|
|
@@ -113,15 +118,24 @@ var _ModelUtils = class {
|
|
|
113
118
|
}),
|
|
114
119
|
...opts.extraModels
|
|
115
120
|
].map((file) => {
|
|
116
|
-
return new Model(
|
|
121
|
+
return new Model(
|
|
122
|
+
file,
|
|
123
|
+
this.api.paths.absSrcPath,
|
|
124
|
+
opts.sort,
|
|
125
|
+
this.count++
|
|
126
|
+
);
|
|
117
127
|
});
|
|
118
128
|
const namespaces = models.map((model) => model.namespace);
|
|
119
129
|
if (new Set(namespaces).size !== namespaces.length) {
|
|
120
|
-
throw new Error(
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Duplicate namespace in models: ${namespaces.sort().join(", ")}`
|
|
132
|
+
);
|
|
121
133
|
}
|
|
122
134
|
if (opts.sort) {
|
|
123
135
|
const namespaces2 = _ModelUtils.topologicalSort(models);
|
|
124
|
-
models.sort(
|
|
136
|
+
models.sort(
|
|
137
|
+
(a, b) => namespaces2.indexOf(a.namespace) - namespaces2.indexOf(b.namespace)
|
|
138
|
+
);
|
|
125
139
|
}
|
|
126
140
|
return models;
|
|
127
141
|
}
|
|
@@ -170,16 +184,22 @@ var _ModelUtils = class {
|
|
|
170
184
|
const imports = [];
|
|
171
185
|
const modelProps = [];
|
|
172
186
|
models.forEach((model) => {
|
|
173
|
-
const fileWithoutExt = (0, import_plugin_utils.winPath)(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
187
|
+
const fileWithoutExt = (0, import_plugin_utils.winPath)(
|
|
188
|
+
(0, import_path.format)({
|
|
189
|
+
dir: (0, import_path.dirname)(model.file),
|
|
190
|
+
base: (0, import_path.basename)(model.file, (0, import_path.extname)(model.file))
|
|
191
|
+
})
|
|
192
|
+
);
|
|
177
193
|
if (model.exportName !== "default") {
|
|
178
|
-
imports.push(
|
|
194
|
+
imports.push(
|
|
195
|
+
`import { ${model.exportName} as ${model.id} } from '${fileWithoutExt}';`
|
|
196
|
+
);
|
|
179
197
|
} else {
|
|
180
198
|
imports.push(`import ${model.id} from '${fileWithoutExt}';`);
|
|
181
199
|
}
|
|
182
|
-
modelProps.push(
|
|
200
|
+
modelProps.push(
|
|
201
|
+
`${model.id}: { namespace: '${model.namespace}', model: ${model.id} },`
|
|
202
|
+
);
|
|
183
203
|
});
|
|
184
204
|
return `
|
|
185
205
|
${imports.join("\n")}
|
|
@@ -234,7 +254,9 @@ ModelUtils.topologicalSort = (models) => {
|
|
|
234
254
|
}
|
|
235
255
|
const leftNodes = graph.filter(Boolean);
|
|
236
256
|
if (leftNodes.length > 0) {
|
|
237
|
-
throw new Error(
|
|
257
|
+
throw new Error(
|
|
258
|
+
`Circle dependency detected in models: ${leftNodes.map((m) => import_plugin_utils.chalk.red(m.namespace)).join(", ")}`
|
|
259
|
+
);
|
|
238
260
|
}
|
|
239
261
|
return queue;
|
|
240
262
|
};
|
|
@@ -27,9 +27,11 @@ var import_plugin_utils = require("umi/plugin-utils");
|
|
|
27
27
|
function resolveProjectDep(opts) {
|
|
28
28
|
var _a, _b;
|
|
29
29
|
if (((_a = opts.pkg.dependencies) == null ? void 0 : _a[opts.dep]) || ((_b = opts.pkg.devDependencies) == null ? void 0 : _b[opts.dep])) {
|
|
30
|
-
return (0, import_path.dirname)(
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
return (0, import_path.dirname)(
|
|
31
|
+
import_plugin_utils.resolve.sync(`${opts.dep}/package.json`, {
|
|
32
|
+
basedir: opts.cwd
|
|
33
|
+
})
|
|
34
|
+
);
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -25,7 +25,13 @@ module.exports = __toCommonJS(withTmpPath_exports);
|
|
|
25
25
|
var import_path = require("path");
|
|
26
26
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
27
27
|
function withTmpPath(opts) {
|
|
28
|
-
return (0, import_plugin_utils.winPath)(
|
|
28
|
+
return (0, import_plugin_utils.winPath)(
|
|
29
|
+
(0, import_path.join)(
|
|
30
|
+
opts.api.paths.absTmpPath,
|
|
31
|
+
opts.api.plugin.key && !opts.noPluginDir ? `plugin-${opts.api.plugin.key}` : "",
|
|
32
|
+
opts.path
|
|
33
|
+
)
|
|
34
|
+
);
|
|
29
35
|
}
|
|
30
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
37
|
0 && (module.exports = {
|
package/dist/valtio.js
CHANGED
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
20
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
24
|
|
|
22
25
|
// src/valtio.ts
|
|
@@ -37,7 +40,9 @@ var valtio_default = (api) => {
|
|
|
37
40
|
},
|
|
38
41
|
enableBy: api.EnableBy.config
|
|
39
42
|
});
|
|
40
|
-
const libPath = (0, import_utils.winPath)(
|
|
43
|
+
const libPath = (0, import_utils.winPath)(
|
|
44
|
+
(0, import_path.dirname)(require.resolve("@umijs/valtio/package.json"))
|
|
45
|
+
);
|
|
41
46
|
api.onGenerateFiles(() => {
|
|
42
47
|
api.writeTmpFile({
|
|
43
48
|
path: "index.ts",
|
|
@@ -163,6 +163,12 @@ export const MicroApp = forwardRef(
|
|
|
163
163
|
...propsFromConfig,
|
|
164
164
|
...stateForSlave,
|
|
165
165
|
...propsFromParams,
|
|
166
|
+
__globalRoutesInfo: {
|
|
167
|
+
appNameKeyAlias,
|
|
168
|
+
masterHistoryType,
|
|
169
|
+
base: globalSettings.base,
|
|
170
|
+
microAppRoutes: globalSettings.microAppRoutes,
|
|
171
|
+
},
|
|
166
172
|
setLoading,
|
|
167
173
|
},
|
|
168
174
|
},
|
|
@@ -225,6 +231,12 @@ export const MicroApp = forwardRef(
|
|
|
225
231
|
...propsFromConfig,
|
|
226
232
|
...stateForSlave,
|
|
227
233
|
...propsFromParams,
|
|
234
|
+
__globalRoutesInfo: {
|
|
235
|
+
appNameKeyAlias,
|
|
236
|
+
masterHistoryType,
|
|
237
|
+
base: globalSettings.base,
|
|
238
|
+
microAppRoutes: globalSettings.microAppRoutes,
|
|
239
|
+
},
|
|
228
240
|
setLoading,
|
|
229
241
|
};
|
|
230
242
|
|
|
@@ -8,6 +8,7 @@ import { insertRoute, noop, patchMicroAppRoute } from './common';
|
|
|
8
8
|
import { getMicroAppRouteComponent } from './getMicroAppRouteComponent';
|
|
9
9
|
import { getMasterOptions, setMasterOptions } from './masterOptions';
|
|
10
10
|
import { MasterOptions, MicroAppRoute } from './types';
|
|
11
|
+
import { deepFilterLeafRoutes } from './routeUtils';
|
|
11
12
|
|
|
12
13
|
let microAppRuntimeRoutes: MicroAppRoute[];
|
|
13
14
|
|
|
@@ -137,6 +138,15 @@ export async function render(oldRender: typeof noop) {
|
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
export function patchClientRoutes({ routes }: { routes: any[] }) {
|
|
141
|
+
const microAppRoutes = [].concat(
|
|
142
|
+
deepFilterLeafRoutes(routes),
|
|
143
|
+
deepFilterLeafRoutes(microAppRuntimeRoutes),
|
|
144
|
+
);
|
|
145
|
+
// 微应用的 routes 存到 masterOptions.microAppRoutes 下以供 MicroAppLink 使用
|
|
146
|
+
const masterOptions = getMasterOptions();
|
|
147
|
+
masterOptions.microAppRoutes = microAppRoutes;
|
|
148
|
+
setMasterOptions(masterOptions);
|
|
149
|
+
|
|
140
150
|
if (microAppRuntimeRoutes) {
|
|
141
151
|
patchMicroAppRouteComponent(routes);
|
|
142
152
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface Route extends Record<string, any> {
|
|
2
|
+
children: Route[];
|
|
3
|
+
microApp?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function deepFilterLeafRoutes(routeTree: Route[]) {
|
|
7
|
+
if (!routeTree?.length) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const leafRoutes: Route[] = [];
|
|
12
|
+
|
|
13
|
+
const findLeafRoutes = (routes: Route[]) => {
|
|
14
|
+
for (let i = 0; i < routes.length; i++) {
|
|
15
|
+
const r = routes[i];
|
|
16
|
+
if (r.children) {
|
|
17
|
+
findLeafRoutes(r.children);
|
|
18
|
+
}
|
|
19
|
+
leafRoutes.push(r);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
findLeafRoutes(routeTree);
|
|
24
|
+
|
|
25
|
+
return leafRoutes.filter((r) => r.microApp);
|
|
26
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
__USE_MODEL__;
|
|
4
|
+
import React, {
|
|
5
|
+
forwardRef,
|
|
6
|
+
FC,
|
|
7
|
+
useImperativeHandle,
|
|
8
|
+
useRef,
|
|
9
|
+
MouseEvent,
|
|
10
|
+
HTMLAttributes,
|
|
11
|
+
useCallback,
|
|
12
|
+
} from 'react';
|
|
13
|
+
import noop from 'lodash/noop';
|
|
14
|
+
import find from 'lodash/find';
|
|
15
|
+
import {
|
|
16
|
+
qiankunStateFromMasterModelNamespace,
|
|
17
|
+
defaultHistoryType,
|
|
18
|
+
} from './constants';
|
|
19
|
+
|
|
20
|
+
const COMPONENT_NAME = 'qiankun-microapp-link';
|
|
21
|
+
|
|
22
|
+
interface MicroAppLinkProps {
|
|
23
|
+
// 应用名称
|
|
24
|
+
name?: string;
|
|
25
|
+
|
|
26
|
+
// 相对路由,不包含应用前缀,以为 `/` 开头
|
|
27
|
+
to: string;
|
|
28
|
+
|
|
29
|
+
// 是否主应用下的路由,默认false
|
|
30
|
+
isMaster?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const urlFactory =
|
|
34
|
+
(base: string, routes: Record<string, any>[]) =>
|
|
35
|
+
({ name, to, isMaster }: MicroAppLinkProps) => {
|
|
36
|
+
if (isMaster) {
|
|
37
|
+
return to;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!to?.startsWith('/')) {
|
|
41
|
+
throw new Error(`[${COMPONENT_NAME}] props "to" should start with "/"`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const app = find(routes, ({ microApp }) => microApp === name);
|
|
45
|
+
if (!app) {
|
|
46
|
+
console.error(`[${COMPONENT_NAME}] microapp "${name}" is not found`);
|
|
47
|
+
return to;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const prefix =
|
|
51
|
+
base === '/'
|
|
52
|
+
? app.path.replace('/*', '')
|
|
53
|
+
: `${base}${app.path.replace('/*', '')}`;
|
|
54
|
+
return `${prefix}${to}`;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const MicroAppLink: FC<
|
|
58
|
+
MicroAppLinkProps & HTMLAttributes<HTMLAnchorElement>
|
|
59
|
+
> = forwardRef((props, ref) => {
|
|
60
|
+
const { children, name, to, isMaster = false, ...anchorProps } = props;
|
|
61
|
+
const stateFromMaster = (useModel || noop)(
|
|
62
|
+
qiankunStateFromMasterModelNamespace,
|
|
63
|
+
);
|
|
64
|
+
const linkRef = useRef<HTMLAnchorElement>();
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
masterHistoryType,
|
|
68
|
+
microAppRoutes,
|
|
69
|
+
base,
|
|
70
|
+
appNameKeyAlias = 'name',
|
|
71
|
+
} = stateFromMaster?.__globalRoutesInfo || {};
|
|
72
|
+
// ref: https://github.com/umijs/plugins/pull/866 基于 name 或 appNameKeyAlias 取到 appName 的逻辑
|
|
73
|
+
const appName =
|
|
74
|
+
name && props[appNameKeyAlias] ? name : props[appNameKeyAlias] || name;
|
|
75
|
+
|
|
76
|
+
const linkProps = { name: appName, to, isMaster };
|
|
77
|
+
const createHerf = urlFactory(base, microAppRoutes);
|
|
78
|
+
|
|
79
|
+
const linkUrl =
|
|
80
|
+
masterHistoryType === 'browser'
|
|
81
|
+
? createHerf(linkProps)
|
|
82
|
+
: `#${createHerf(linkProps)}`;
|
|
83
|
+
|
|
84
|
+
useImperativeHandle(ref, () => linkRef.current);
|
|
85
|
+
|
|
86
|
+
const handleClick = useCallback(
|
|
87
|
+
(e: MouseEvent<HTMLAnchorElement>) => {
|
|
88
|
+
if (anchorProps.onClick) {
|
|
89
|
+
return anchorProps.onClick(e);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// hash路由 使用 a标签 默认行为
|
|
93
|
+
if (masterHistoryType === 'hash') {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (masterHistoryType === 'browser') {
|
|
98
|
+
e?.stopPropagation();
|
|
99
|
+
e?.preventDefault();
|
|
100
|
+
return window.history.pushState({}, '', linkUrl);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
console.error(
|
|
104
|
+
`[${COMPONENT_NAME}] not support "masterHistoryType = '${masterHistoryType}'"`,
|
|
105
|
+
);
|
|
106
|
+
return;
|
|
107
|
+
},
|
|
108
|
+
[anchorProps.onClick, masterHistoryType],
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<a
|
|
113
|
+
{...anchorProps}
|
|
114
|
+
ref={linkRef}
|
|
115
|
+
className={`${COMPONENT_NAME} ${anchorProps.className}`}
|
|
116
|
+
href={linkUrl}
|
|
117
|
+
onClick={handleClick}
|
|
118
|
+
>
|
|
119
|
+
{children}
|
|
120
|
+
</a>
|
|
121
|
+
);
|
|
122
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.43",
|
|
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,12 +27,14 @@
|
|
|
27
27
|
"@ant-design/antd-theme-variable": "^1.0.0",
|
|
28
28
|
"@ant-design/icons": "^4.7.0",
|
|
29
29
|
"@ant-design/pro-components": "^2.0.1",
|
|
30
|
-
"@
|
|
30
|
+
"@tanstack/react-query": "^4.22.0",
|
|
31
|
+
"@tanstack/react-query-devtools": "^4.22.0",
|
|
32
|
+
"@umijs/bundler-utils": "4.0.43",
|
|
31
33
|
"@umijs/valtio": "^1.0.2",
|
|
32
34
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
33
35
|
"axios": "^0.27.2",
|
|
34
|
-
"babel-plugin-import": "^1.13.
|
|
35
|
-
"dayjs": "^1.11.
|
|
36
|
+
"babel-plugin-import": "^1.13.6",
|
|
37
|
+
"dayjs": "^1.11.7",
|
|
36
38
|
"dva-core": "^2.0.4",
|
|
37
39
|
"dva-immer": "^1.0.0",
|
|
38
40
|
"dva-loading": "^3.0.22",
|
|
@@ -40,17 +42,18 @@
|
|
|
40
42
|
"fast-deep-equal": "3.1.3",
|
|
41
43
|
"intl": "1.2.5",
|
|
42
44
|
"lodash": "^4.17.21",
|
|
43
|
-
"moment": "^2.29.
|
|
44
|
-
"qiankun": "^2.
|
|
45
|
+
"moment": "^2.29.4",
|
|
46
|
+
"qiankun": "^2.8.4",
|
|
45
47
|
"react-intl": "3.12.1",
|
|
46
|
-
"react-redux": "^8.0.
|
|
48
|
+
"react-redux": "^8.0.5",
|
|
47
49
|
"redux": "^4.2.0",
|
|
48
|
-
"styled-components": "
|
|
50
|
+
"styled-components": "^5.3.6",
|
|
51
|
+
"tslib": "^2",
|
|
49
52
|
"warning": "^4.0.3"
|
|
50
53
|
},
|
|
51
54
|
"devDependencies": {
|
|
52
55
|
"antd": "^4.24.1",
|
|
53
|
-
"umi": "4.0.
|
|
56
|
+
"umi": "4.0.43"
|
|
54
57
|
},
|
|
55
58
|
"publishConfig": {
|
|
56
59
|
"access": "public"
|
package/dist/icons.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/icons.ts
|
|
20
|
-
var icons_exports = {};
|
|
21
|
-
__export(icons_exports, {
|
|
22
|
-
default: () => icons_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(icons_exports);
|
|
25
|
-
var icons_default = (api) => {
|
|
26
|
-
api;
|
|
27
|
-
};
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {});
|