@jiangood/open-admin 2.0.1 → 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.
Files changed (47) hide show
  1. package/config/common-plugin.js +51 -0
  2. package/config/config.js +1 -56
  3. package/package.json +5 -2
  4. package/src/.umi-production/appData.json +73 -100
  5. package/src/.umi-production/umi.ts +2 -2
  6. package/src/framework/components/DownloadFileButton/index.tsx +1 -1
  7. package/src/framework/components/OrgTree/index.tsx +1 -1
  8. package/src/framework/components/Page/index.less +1 -1
  9. package/src/framework/components/Page/index.tsx +19 -22
  10. package/src/framework/components/PageLoading/index.tsx +5 -3
  11. package/src/framework/components/ProModal/index.tsx +2 -2
  12. package/src/framework/components/ProTable/components/ToolBar/index.tsx +1 -1
  13. package/src/framework/fields/FieldEditor/index.tsx +3 -2
  14. package/src/framework/fields/FieldRemoteTreeSelect/index.tsx +3 -3
  15. package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.tsx +3 -3
  16. package/src/framework/fields/FieldUploadFile/index.tsx +8 -4
  17. package/src/framework/utils/MessageUtils.tsx +21 -99
  18. package/src/framework/utils/system/HttpUtils.ts +5 -1
  19. package/src/framework/utils/system/SysUtils.ts +8 -0
  20. package/src/framework/utils/system/ThemeUtils.ts +37 -12
  21. package/src/framework/views/ViewFile/index.tsx +1 -1
  22. package/src/framework/views/ViewProcessInstanceProgress/index.tsx +1 -0
  23. package/src/layouts/PageRender.tsx +29 -0
  24. package/src/layouts/admin/HeaderRight.jsx +1 -0
  25. package/src/layouts/admin/TabPageRender.jsx +138 -158
  26. package/src/layouts/admin/index.jsx +123 -19
  27. package/src/layouts/admin/index.less +124 -6
  28. package/src/layouts/index.jsx +94 -161
  29. package/src/pages/404.jsx +7 -5
  30. package/src/pages/about.jsx +3 -3
  31. package/src/pages/index.jsx +4 -5
  32. package/src/pages/login.jsx +18 -9
  33. package/src/pages/login.less +0 -1
  34. package/src/pages/system/dict/index.jsx +8 -11
  35. package/src/pages/system/file/index.jsx +6 -6
  36. package/src/pages/system/job/index.jsx +26 -11
  37. package/src/pages/system/log/index.jsx +4 -5
  38. package/src/pages/system/manual/index.jsx +8 -6
  39. package/src/pages/system/org/index.jsx +4 -2
  40. package/src/pages/system/role/index.jsx +16 -14
  41. package/src/pages/system/role/perm.jsx +3 -4
  42. package/src/pages/system/user/UserPerm.jsx +1 -1
  43. package/src/pages/system/user/index.jsx +9 -7
  44. package/src/pages/userCenter/index.jsx +2 -2
  45. package/src/pages/userCenter/message.jsx +4 -2
  46. package/src/layouts/PageRender.d.ts +0 -22
  47. package/src/layouts/PageRender.jsx +0 -90
@@ -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,60 +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 proxyConfig = {
23
- '/admin': {
24
- target: `http://${host}`,
25
- changeOrigin: true,
26
- },
27
- '/preview': {
28
- target: `http://${host}`,
29
- changeOrigin: true,
30
- },
31
- '/ureport': {
32
- target: `http://${host}`,
33
- changeOrigin: true,
34
- },
35
- '/admin/ws': {
36
- target: `ws://${host}`,
37
- changeOrigin: true,
38
- ws: true,
39
- },
40
- };
41
2
 
42
3
  export default defineConfig({
43
- // 配置是否让生成的文件包含 hash 后缀,通常用于增量发布和避免浏览器加载缓存
44
- hash: true,
45
- // 使用 hash 模式的路由
46
- history: { type: 'hash' },
47
- // 暂时关闭 MFSU,避免配置复杂性
48
- mfsu: false,
49
- // 启用 esbuild 压缩 IIFE
50
- esbuildMinifyIIFE: true,
51
- // 插件配置
52
- plugins: [
53
- `${pluginDir}/common-plugin`,
54
- ],
55
- // 代理配置
56
- proxy: proxyConfig,
57
-
58
-
59
-
4
+ plugins: ['./config/common-plugin'],
60
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
  },
@@ -22,6 +21,10 @@
22
21
  "umi": "^4.0.0"
23
22
  },
24
23
  "name": "@jiangood/open-admin",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/jiangood/open-admin"
27
+ },
25
28
  "description": "open-admin",
26
29
  "files": [
27
30
  "src/*",
@@ -34,5 +37,5 @@
34
37
  "dev": "umi dev",
35
38
  "build": "umi build"
36
39
  },
37
- "version": "2.0.1"
40
+ "version": "2.2.5"
38
41
  }