@jiangood/open-admin 2.2.4 → 2.2.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/config/common-plugin.js +51 -0
- package/config/config.js +1 -51
- package/package.json +1 -2
- package/src/.umi-production/appData.json +60 -72
- package/src/framework/components/DownloadFileButton/index.tsx +1 -1
- package/src/framework/components/OrgTree/index.tsx +1 -1
- package/src/framework/components/PageLoading/index.tsx +5 -3
- package/src/framework/components/ProModal/index.tsx +2 -2
- package/src/framework/components/ProTable/components/ToolBar/index.tsx +1 -1
- package/src/framework/fields/FieldRemoteTreeSelect/index.tsx +3 -3
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.tsx +3 -3
- package/src/framework/utils/system/HttpUtils.ts +3 -0
- package/src/framework/utils/system/ThemeUtils.ts +37 -12
- package/src/framework/views/ViewFile/index.tsx +1 -1
- package/src/framework/views/ViewProcessInstanceProgress/index.tsx +1 -0
- package/src/layouts/{PageRender.jsx → PageRender.tsx} +6 -5
- package/src/layouts/admin/HeaderRight.jsx +1 -0
- package/src/layouts/admin/index.jsx +3 -2
- package/src/layouts/admin/index.less +6 -6
- package/src/layouts/index.jsx +59 -43
- package/src/pages/login.jsx +2 -0
- package/src/pages/system/dict/index.jsx +1 -1
- package/src/pages/system/file/index.jsx +1 -1
- package/src/pages/system/job/index.jsx +17 -4
- package/src/pages/system/manual/index.jsx +2 -2
- package/src/pages/system/role/index.jsx +7 -7
- package/src/pages/system/user/UserPerm.jsx +1 -1
- package/src/pages/system/user/index.jsx +1 -1
- package/src/pages/userCenter/index.jsx +1 -1
- package/src/layouts/PageRender.d.ts +0 -7
package/config/common-plugin.js
CHANGED
|
@@ -35,6 +35,57 @@ export default (api) => {
|
|
|
35
35
|
key: 'open-admin',
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
+
// Inject build-time defines and UmiJS defaults from environment variables
|
|
39
|
+
const servletContext = process.env.SERVLET_CONTEXT || '/change-this-servlet-context';
|
|
40
|
+
const isProd = process.env.NODE_ENV === 'production';
|
|
41
|
+
const serverPort = process.env.SERVER_PORT || '8080';
|
|
42
|
+
|
|
43
|
+
const theme = {};
|
|
44
|
+
if (process.env.THEME_PRIMARY_COLOR) theme["primary-color"] = process.env.THEME_PRIMARY_COLOR;
|
|
45
|
+
if (process.env.THEME_SUCCESS_COLOR) theme["success-color"] = process.env.THEME_SUCCESS_COLOR;
|
|
46
|
+
if (process.env.THEME_WARNING_COLOR) theme["warning-color"] = process.env.THEME_WARNING_COLOR;
|
|
47
|
+
if (process.env.THEME_ERROR_COLOR) theme["error-color"] = process.env.THEME_ERROR_COLOR;
|
|
48
|
+
if (process.env.THEME_BACKGROUND_COLOR) theme["background-color"] = process.env.THEME_BACKGROUND_COLOR;
|
|
49
|
+
|
|
50
|
+
api.modifyConfig((memo) => {
|
|
51
|
+
memo.define = memo.define || {};
|
|
52
|
+
|
|
53
|
+
// Define globals
|
|
54
|
+
memo.define.SERVLET_CONTEXT = servletContext;
|
|
55
|
+
if (Object.keys(theme).length > 0) {
|
|
56
|
+
memo.define.OPEN_ADMIN_THEME = theme;
|
|
57
|
+
}
|
|
58
|
+
if (process.env.PUBLIC_PAGES) {
|
|
59
|
+
memo.define.OPEN_ADMIN_PUBLIC_PAGES = process.env.PUBLIC_PAGES;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Build defaults (only if not explicitly set by project config.js)
|
|
63
|
+
if (memo.publicPath === undefined) {
|
|
64
|
+
memo.publicPath = isProd ? './' : '/';
|
|
65
|
+
}
|
|
66
|
+
if (memo.hash === undefined) memo.hash = true;
|
|
67
|
+
if (memo.history === undefined) memo.history = { type: 'hash' };
|
|
68
|
+
if (memo.mfsu === undefined) memo.mfsu = false;
|
|
69
|
+
if (memo.esbuildMinifyIIFE === undefined) memo.esbuildMinifyIIFE = true;
|
|
70
|
+
|
|
71
|
+
// Proxy dev server
|
|
72
|
+
if (memo.proxy === undefined) memo.proxy = {};
|
|
73
|
+
if (!memo.proxy[servletContext]) {
|
|
74
|
+
memo.proxy[servletContext] = {
|
|
75
|
+
target: `http://127.0.0.1:${serverPort}`,
|
|
76
|
+
changeOrigin: true,
|
|
77
|
+
ws: true, // WebSocket 代理支持(http-proxy-middleware)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return memo;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
api.logger.info(`SERVLET_CONTEXT=${servletContext}, proxy→http://127.0.0.1:${serverPort}`);
|
|
85
|
+
if (Object.keys(theme).length > 0) {
|
|
86
|
+
api.logger.info('OPEN_ADMIN_THEME:', theme);
|
|
87
|
+
}
|
|
88
|
+
|
|
38
89
|
const isFramework = api.pkg.name === pkgName;
|
|
39
90
|
|
|
40
91
|
try {
|
package/config/config.js
CHANGED
|
@@ -1,55 +1,5 @@
|
|
|
1
1
|
import {defineConfig} from 'umi';
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import * as path from "path";
|
|
4
|
-
|
|
5
|
-
// https://umijs.org/docs/api/config
|
|
6
|
-
|
|
7
|
-
const host = '127.0.0.1:8080';
|
|
8
|
-
|
|
9
|
-
function getPluginDir() {
|
|
10
|
-
try {
|
|
11
|
-
const isFramework = fs.existsSync(path.join(process.cwd(), 'config/common-plugin.js'));
|
|
12
|
-
console.log('isFramework', isFramework)
|
|
13
|
-
return isFramework ? './config' : '@jiangood/open-admin/config';
|
|
14
|
-
} catch (error) {
|
|
15
|
-
console.error('获取插件目录时出错:', error);
|
|
16
|
-
return '@jiangood/open-admin/config';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const pluginDir = getPluginDir();
|
|
21
|
-
|
|
22
|
-
const SERVLET_CONTEXT = process.env.SERVLET_CONTEXT || '/change-this-servlet-context'; // 见 .env
|
|
23
|
-
|
|
24
|
-
const proxyConfig = {
|
|
25
|
-
[SERVLET_CONTEXT]: {
|
|
26
|
-
target: `http://${host}`,
|
|
27
|
-
changeOrigin: true,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
2
|
|
|
31
3
|
export default defineConfig({
|
|
32
|
-
|
|
33
|
-
define: {
|
|
34
|
-
SERVLET_CONTEXT: SERVLET_CONTEXT,
|
|
35
|
-
},
|
|
36
|
-
// 资源使用相对路径,部署到任意 context-path 下都无需重新构建
|
|
37
|
-
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
|
|
38
|
-
// 配置是否让生成的文件包含 hash 后缀,通常用于增量发布和避免浏览器加载缓存
|
|
39
|
-
hash: true,
|
|
40
|
-
// 使用 hash 模式的路由
|
|
41
|
-
history: { type: 'hash' },
|
|
42
|
-
// 暂时关闭 MFSU,避免配置复杂性
|
|
43
|
-
mfsu: false,
|
|
44
|
-
// 启用 esbuild 压缩 IIFE
|
|
45
|
-
esbuildMinifyIIFE: true,
|
|
46
|
-
// 插件配置
|
|
47
|
-
plugins: [
|
|
48
|
-
`${pluginDir}/common-plugin`,
|
|
49
|
-
],
|
|
50
|
-
// 代理配置
|
|
51
|
-
proxy: proxyConfig,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
4
|
+
plugins: ['./config/common-plugin'],
|
|
55
5
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
"@types/lodash": "^4.17.23",
|
|
4
4
|
"@types/react": "^19.2.2",
|
|
5
5
|
"@types/react-dom": "^19.0.0",
|
|
6
|
-
"@umijs/plugins": "^4.3.17",
|
|
7
6
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
8
7
|
"typescript": "^6.0.3"
|
|
9
8
|
},
|
|
@@ -38,5 +37,5 @@
|
|
|
38
37
|
"dev": "umi dev",
|
|
39
38
|
"build": "umi build"
|
|
40
39
|
},
|
|
41
|
-
"version": "2.2.
|
|
40
|
+
"version": "2.2.5"
|
|
42
41
|
}
|