@jiangood/open-admin 1.0.0
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/dist/common-plugin.js +148 -0
- package/config/dist/config.js +45 -0
- package/config/dist/index.js +18 -0
- package/package.json +41 -0
- package/src/app.js +1 -0
- package/src/asserts/welcome.png +0 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/Gap/index.d.ts +23 -0
- package/src/framework/components/Gap/index.jsx +46 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +10 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/Page/index.d.ts +17 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.tsx +27 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +42 -0
- package/src/framework/components/ProTable/index.jsx +260 -0
- package/src/framework/components/ProTable/index.less +14 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +27 -0
- package/src/framework/components/index.ts +17 -0
- package/src/framework/components/system/ButtonList.d.ts +8 -0
- package/src/framework/components/system/ButtonList.jsx +42 -0
- package/src/framework/components/system/HasPerm.tsx +14 -0
- package/src/framework/components/system/index.tsx +29 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -0
- package/src/framework/components/view/ViewEllipsis.d.ts +11 -0
- package/src/framework/components/view/ViewEllipsis.jsx +30 -0
- package/src/framework/components/view/ViewFile.d.ts +10 -0
- package/src/framework/components/view/ViewFile.jsx +49 -0
- package/src/framework/components/view/ViewFileButton.d.ts +10 -0
- package/src/framework/components/view/ViewFileButton.jsx +0 -0
- package/src/framework/components/view/ViewImage.d.ts +9 -0
- package/src/framework/components/view/ViewImage.jsx +60 -0
- package/src/framework/components/view/ViewRange/index.d.ts +16 -0
- package/src/framework/components/view/ViewRange/index.jsx +20 -0
- package/src/framework/components/view/ViewText.tsx +16 -0
- package/src/framework/components/view/index.ts +10 -0
- package/src/framework/field-components/FieldBoolean.d.ts +13 -0
- package/src/framework/field-components/FieldBoolean.jsx +76 -0
- package/src/framework/field-components/FieldDate.d.ts +27 -0
- package/src/framework/field-components/FieldDate.jsx +114 -0
- package/src/framework/field-components/FieldDateRange.d.ts +6 -0
- package/src/framework/field-components/FieldDateRange.jsx +104 -0
- package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
- package/src/framework/field-components/FieldDictSelect.jsx +16 -0
- package/src/framework/field-components/FieldEditor.d.ts +10 -0
- package/src/framework/field-components/FieldEditor.jsx +58 -0
- package/src/framework/field-components/FieldNumberRange.d.ts +13 -0
- package/src/framework/field-components/FieldNumberRange.jsx +59 -0
- package/src/framework/field-components/FieldPercent.d.ts +12 -0
- package/src/framework/field-components/FieldPercent.jsx +27 -0
- package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
- package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
- package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +72 -0
- package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
- package/src/framework/field-components/FieldTable.d.ts +17 -0
- package/src/framework/field-components/FieldTable.jsx +108 -0
- package/src/framework/field-components/FieldTable.less +29 -0
- package/src/framework/field-components/FieldTableSelect.d.ts +19 -0
- package/src/framework/field-components/FieldTableSelect.jsx +59 -0
- package/src/framework/field-components/FieldUploadFile.d.ts +34 -0
- package/src/framework/field-components/FieldUploadFile.jsx +141 -0
- package/src/framework/field-components/index.ts +21 -0
- package/src/framework/field-components/system/OrgTree.tsx +61 -0
- package/src/framework/field-components/system/RoleTree.tsx +53 -0
- package/src/framework/field-components/system/index.ts +2 -0
- package/src/framework/index.ts +5 -0
- package/src/framework/pages/LoginPage.d.ts +16 -0
- package/src/framework/pages/LoginPage.jsx +135 -0
- package/src/framework/pages/LoginPage.less +53 -0
- package/src/framework/pages/LoginPageUtils.ts +36 -0
- package/src/framework/pages/index.ts +2 -0
- package/src/framework/utils/ArrUtils.ts +229 -0
- package/src/framework/utils/ColorsUtils.ts +378 -0
- package/src/framework/utils/DateUtils.ts +187 -0
- package/src/framework/utils/DeviceUtils.ts +46 -0
- package/src/framework/utils/DomUtils.ts +50 -0
- package/src/framework/utils/EventBusUtils.ts +144 -0
- package/src/framework/utils/Logger.ts +40 -0
- package/src/framework/utils/MessageUtils.tsx +170 -0
- package/src/framework/utils/ObjectUtils.ts +118 -0
- package/src/framework/utils/StorageUtils.ts +50 -0
- package/src/framework/utils/StringUtils.ts +436 -0
- package/src/framework/utils/TreeUtils.ts +251 -0
- package/src/framework/utils/UrlUtils.ts +152 -0
- package/src/framework/utils/UuidUtils.ts +88 -0
- package/src/framework/utils/ValidateUtils.ts +28 -0
- package/src/framework/utils/index.ts +16 -0
- package/src/framework/utils/system/DictUtils.ts +97 -0
- package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
- package/src/framework/utils/system/HttpUtils.ts +247 -0
- package/src/framework/utils/system/PageUtils.ts +163 -0
- package/src/framework/utils/system/PermUtils.ts +79 -0
- package/src/framework/utils/system/SysUtils.ts +97 -0
- package/src/framework/utils/system/ThemeUtils.ts +27 -0
- package/src/framework/utils/system/index.ts +7 -0
- package/src/framework/view-components/ViewApproveStatus.tsx +26 -0
- package/src/framework/view-components/ViewBoolean.tsx +6 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +12 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.jsx +97 -0
- package/src/framework/view-components/ViewFlowableInstanceProgressButton.tsx +26 -0
- package/src/framework/view-components/ViewPassword.tsx +25 -0
- package/src/framework/view-components/ViewProps.ts +11 -0
- package/src/framework/view-components/index.ts +6 -0
- package/src/index.ts +2 -0
- package/src/layouts/PageRender.d.ts +22 -0
- package/src/layouts/PageRender.jsx +90 -0
- package/src/layouts/admin/HeaderRight.jsx +104 -0
- package/src/layouts/admin/TabPageRender.jsx +158 -0
- package/src/layouts/admin/index.jsx +161 -0
- package/src/layouts/admin/index.less +65 -0
- package/src/layouts/index.jsx +165 -0
- package/src/layouts/index.less +24 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/login.jsx +21 -0
- package/src/pages/system/api/ApiDoc.jsx +144 -0
- package/src/pages/system/api/index.jsx +268 -0
- package/src/pages/system/api/perm.jsx +69 -0
- package/src/pages/system/dict/Dict.jsx +72 -0
- package/src/pages/system/dict/DictItem.jsx +177 -0
- package/src/pages/system/dict/index.jsx +25 -0
- package/src/pages/system/file/index.jsx +160 -0
- package/src/pages/system/job/index.jsx +324 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +262 -0
- package/src/pages/system/role/index.jsx +308 -0
- package/src/pages/system/role/perm.jsx +108 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +97 -0
- package/src/pages/system/user/index.jsx +258 -0
- package/src/pages/test.jsx +200 -0
- package/src/pages/ureport/index.jsx +16 -0
- package/src/pages/userCenter/ChangePassword.jsx +63 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +59 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var fs = require("fs");
|
|
4
|
+
var path = require("path");
|
|
5
|
+
var pkgName = '@jiangood/open-admin';
|
|
6
|
+
exports.default = (function (api) {
|
|
7
|
+
api.describe({
|
|
8
|
+
key: 'admin-spring-boot-stater',
|
|
9
|
+
});
|
|
10
|
+
api.logger.info('plugin starting... ');
|
|
11
|
+
var isFramework = api.pkg.name === pkgName;
|
|
12
|
+
var frameworkDirs = Utils.getDirs(api.paths.absNodeModulesPath + "/@jiangood");
|
|
13
|
+
api.logger.info('依赖的框架:', frameworkDirs);
|
|
14
|
+
var _loop_1 = function (frameworkDir) {
|
|
15
|
+
api.logger.info("正在解析文件夹", frameworkDir);
|
|
16
|
+
// 处理路由
|
|
17
|
+
var routeFiles = Utils.findFilesSync(frameworkDir, /src\/pages\/.*\.jsx$/); // src/pages/**
|
|
18
|
+
api.logger.info("找到的页面文件:", routeFiles);
|
|
19
|
+
api.modifyRoutes(function (routes) {
|
|
20
|
+
for (var _i = 0, routeFiles_1 = routeFiles; _i < routeFiles_1.length; _i++) {
|
|
21
|
+
var file = routeFiles_1[_i];
|
|
22
|
+
var route = convertFileToRoute(file);
|
|
23
|
+
if (route) {
|
|
24
|
+
if (routes[route.id] == null) { // 如果用户项目没有这个路由,则加入。否则以用户项目为准
|
|
25
|
+
api.logger.info("加入路由:", route.id, "路径:", route.absPath);
|
|
26
|
+
routes[route.id] = route;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
api.logger.info("路由修改完成");
|
|
31
|
+
return routes;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
// ==================== 处理路由 ========================
|
|
35
|
+
for (var _i = 0, frameworkDirs_1 = frameworkDirs; _i < frameworkDirs_1.length; _i++) {
|
|
36
|
+
var frameworkDir = frameworkDirs_1[_i];
|
|
37
|
+
_loop_1(frameworkDir);
|
|
38
|
+
}
|
|
39
|
+
// =============== 处理表单 ========================
|
|
40
|
+
{ // 导入工具类 FormRegistryUtils
|
|
41
|
+
var importFrom_1 = path.join(api.paths.absSrcPath, 'framework');
|
|
42
|
+
if (!isFramework) {
|
|
43
|
+
importFrom_1 = path.join(api.paths.absNodeModulesPath, pkgName);
|
|
44
|
+
}
|
|
45
|
+
api.logger.info('formRegistryPath', importFrom_1);
|
|
46
|
+
api.addEntryImports(function () { return ({
|
|
47
|
+
source: importFrom_1,
|
|
48
|
+
specifier: '{FormRegistryUtils}'
|
|
49
|
+
}); });
|
|
50
|
+
}
|
|
51
|
+
Utils.findFilesSync(api.paths.absSrcPath, /forms\/.*\.jsx$/).forEach(function (file) {
|
|
52
|
+
var name = Utils.getFileMainName(file);
|
|
53
|
+
api.addEntryImports(function () { return ({
|
|
54
|
+
source: file,
|
|
55
|
+
specifier: name
|
|
56
|
+
}); });
|
|
57
|
+
// register form
|
|
58
|
+
api.addEntryCodeAhead(function () { return "FormRegistryUtils.register(\"".concat(name, "\",").concat(name, " );"); });
|
|
59
|
+
api.logger.info('新版本 formRegistry.register: ', name, file);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
function convertFileToRoute(file) {
|
|
63
|
+
var absPath = file;
|
|
64
|
+
var mainName = Utils.getFileMainName(file);
|
|
65
|
+
// 只添加小写开头的文件页面,大写的默认为组件
|
|
66
|
+
if (mainName.charAt(0) !== mainName.charAt(0).toLowerCase()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
var routePath = file.substring(file.indexOf('pages') + 6, file.length - 4);
|
|
70
|
+
routePath = routePath.replaceAll("\$", ":"); // 文件$开头的会替换为路径变量 如$id 变为 :id
|
|
71
|
+
var parentId = "@@/global-layout";
|
|
72
|
+
if (routePath.endsWith("/index")) {
|
|
73
|
+
routePath = routePath.substring(0, routePath.length - 6);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
absPath: absPath,
|
|
77
|
+
id: routePath,
|
|
78
|
+
path: routePath,
|
|
79
|
+
file: file,
|
|
80
|
+
parentId: parentId
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
var Utils = /** @class */ (function () {
|
|
84
|
+
function Utils() {
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 获取目录下的所有子目录
|
|
88
|
+
* @param dir
|
|
89
|
+
* @returns {string[]} 完整路径
|
|
90
|
+
*/
|
|
91
|
+
Utils.getDirs = function (dir) {
|
|
92
|
+
console.log('获取dir....', dir);
|
|
93
|
+
if (!fs.existsSync(dir))
|
|
94
|
+
throw new Error("\u76EE\u5F55\u4E0D\u5B58\u5728: ".concat(dir));
|
|
95
|
+
return fs.readdirSync(dir).map(function (item) {
|
|
96
|
+
var fullPath = path.join(dir, item);
|
|
97
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
98
|
+
return path.join(dir, item);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* 同步获取目录下所有文件
|
|
104
|
+
*/
|
|
105
|
+
Utils.getAllFilesSync = function (dir) {
|
|
106
|
+
if (!fs.existsSync(dir))
|
|
107
|
+
throw new Error("\u76EE\u5F55\u4E0D\u5B58\u5728: ".concat(dir));
|
|
108
|
+
var results = [];
|
|
109
|
+
function traverse(currentDir) {
|
|
110
|
+
fs.readdirSync(currentDir).forEach(function (item) {
|
|
111
|
+
var fullPath = path.join(currentDir, item);
|
|
112
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
113
|
+
traverse(fullPath);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
results.push(fullPath.split(path.sep).join('/'));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
traverse(dir);
|
|
121
|
+
return results;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* 同步查找匹配模式的文件
|
|
125
|
+
*
|
|
126
|
+
* @return 文件列表 全路径
|
|
127
|
+
*/
|
|
128
|
+
Utils.findFilesSync = function (dir, pattern) {
|
|
129
|
+
var files = this.getAllFilesSync(dir);
|
|
130
|
+
return files.filter(function (file) { return pattern.test(file); }).map(function (file) { return file.split(path.sep).join('/'); });
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* 获取文件名(不含后缀)
|
|
134
|
+
* @param {string} filePath - 文件路径
|
|
135
|
+
* @returns {string} 文件名(不含后缀)
|
|
136
|
+
*/
|
|
137
|
+
Utils.getFileMainName = function (filePath) {
|
|
138
|
+
// 从路径中提取文件名
|
|
139
|
+
var fileName = path.basename(filePath);
|
|
140
|
+
// 移除扩展名
|
|
141
|
+
var lastDotIndex = fileName.lastIndexOf('.');
|
|
142
|
+
if (lastDotIndex > 0) {
|
|
143
|
+
return fileName.substring(0, lastDotIndex);
|
|
144
|
+
}
|
|
145
|
+
return fileName; // 没有扩展名的情况
|
|
146
|
+
};
|
|
147
|
+
return Utils;
|
|
148
|
+
}());
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var umi_1 = require("umi");
|
|
4
|
+
var fs = require("fs");
|
|
5
|
+
var path = require("path");
|
|
6
|
+
//https://umijs.org/docs/api/config
|
|
7
|
+
console.log('i am config.ts');
|
|
8
|
+
console.log('__dirname', __dirname);
|
|
9
|
+
console.log('process.cwd()', process.cwd());
|
|
10
|
+
var isFramework = fs.existsSync(path.join(process.cwd(), 'config/common-plugin.ts'));
|
|
11
|
+
console.log('isFramework', isFramework);
|
|
12
|
+
var pluginDir = isFramework ? './config' : '@jiangood/open-admin/config/dist';
|
|
13
|
+
console.log('pluginDir', pluginDir);
|
|
14
|
+
var host = '127.0.0.1:8080';
|
|
15
|
+
exports.default = (0, umi_1.defineConfig)({
|
|
16
|
+
// 配置是否让生成的文件包含 hash 后缀,通常用于增量发布和避免浏览器加载缓存。
|
|
17
|
+
hash: true,
|
|
18
|
+
history: { type: 'hash' },
|
|
19
|
+
// 复杂,还得设置忽略、编译等,先关掉
|
|
20
|
+
mfsu: false,
|
|
21
|
+
esbuildMinifyIIFE: true,
|
|
22
|
+
plugins: [
|
|
23
|
+
pluginDir + '/common-plugin',
|
|
24
|
+
],
|
|
25
|
+
proxy: {
|
|
26
|
+
'/admin': {
|
|
27
|
+
target: 'http://' + host,
|
|
28
|
+
changeOrigin: true,
|
|
29
|
+
},
|
|
30
|
+
'/preview': {
|
|
31
|
+
target: 'http://' + host,
|
|
32
|
+
changeOrigin: true,
|
|
33
|
+
},
|
|
34
|
+
'/ureport': {
|
|
35
|
+
target: 'http://' + host,
|
|
36
|
+
changeOrigin: true,
|
|
37
|
+
pathRewrite: { '^/ureport': '/ureport' },
|
|
38
|
+
},
|
|
39
|
+
'/admin/ws': {
|
|
40
|
+
target: 'ws://' + host,
|
|
41
|
+
changeOrigin: true,
|
|
42
|
+
ws: true,
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config"), exports);
|
|
18
|
+
__exportStar(require("./common-plugin"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"devDependencies": {
|
|
3
|
+
"@types/react": "^19.2.2",
|
|
4
|
+
"@types/react-dom": "^19.0.0",
|
|
5
|
+
"@types/react-lazylog": "^4.5.1",
|
|
6
|
+
"@umijs/plugins": "^4.3.17",
|
|
7
|
+
"typescript": "^5.0.0"
|
|
8
|
+
},
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@ant-design/icons": "^6.0.0",
|
|
11
|
+
"@bpmn-io/properties-panel": "^3.34.0",
|
|
12
|
+
"@tinymce/tinymce-react": "^6.0.0",
|
|
13
|
+
"@umijs/types": "^3.5.43",
|
|
14
|
+
"antd": "^6.0.0",
|
|
15
|
+
"antd-img-crop": "^4.23.0",
|
|
16
|
+
"axios": "^1.13.2",
|
|
17
|
+
"bpmn-js": "^18.7.0",
|
|
18
|
+
"bpmn-js-properties-panel": "^5.43.0",
|
|
19
|
+
"preact": "^10.27.2",
|
|
20
|
+
"dayjs": "^1.11.13",
|
|
21
|
+
"jsencrypt": "^3.5.4",
|
|
22
|
+
"lodash": "^4.17.21",
|
|
23
|
+
"qs": "^6.14.0",
|
|
24
|
+
"react": "^19.0.0",
|
|
25
|
+
"react-dom": "^19.0.0",
|
|
26
|
+
"umi": "^4.0.0"
|
|
27
|
+
},
|
|
28
|
+
"name": "@jiangood/open-admin",
|
|
29
|
+
"description": "open-admin",
|
|
30
|
+
"files": [
|
|
31
|
+
"src/*",
|
|
32
|
+
"config/dist/*",
|
|
33
|
+
"!src/.umi"
|
|
34
|
+
],
|
|
35
|
+
"main": "src/index.ts",
|
|
36
|
+
"version": "1.0.0",
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev": "umi dev",
|
|
39
|
+
"build": "tsc --outDir config/dist --skipLibCheck --noEmitOnError false config/index.ts"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/app.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('i am app.js')
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {Form, Input, InputNumber} from "antd";
|
|
2
|
+
|
|
3
|
+
export default function (){
|
|
4
|
+
|
|
5
|
+
return <div>
|
|
6
|
+
demo表单示例
|
|
7
|
+
<Form>
|
|
8
|
+
<Form.Item label="事由">
|
|
9
|
+
<Input/>
|
|
10
|
+
</Form.Item>
|
|
11
|
+
<Form.Item label="请假天数" name='days'>
|
|
12
|
+
<InputNumber/>
|
|
13
|
+
</Form.Item>
|
|
14
|
+
</Form>
|
|
15
|
+
</div>
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Button, Modal, Spin} from "antd";
|
|
3
|
+
import {HttpUtils} from "../utils";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class DownloadFileButton extends React.Component {
|
|
7
|
+
|
|
8
|
+
state = {
|
|
9
|
+
open:false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
onClick(){
|
|
13
|
+
const {url, params, children, ...rest} = this.props;
|
|
14
|
+
this.setState({open:true})
|
|
15
|
+
HttpUtils.downloadFile(url,params).then(rs=>{
|
|
16
|
+
|
|
17
|
+
}).finally(()=>{
|
|
18
|
+
this.setState({open:false})
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
render() {
|
|
23
|
+
const {url, params, children, ...rest} = this.props;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
return <> <Button {...rest}>{children}</Button>
|
|
27
|
+
|
|
28
|
+
<Modal title='提示' footer={null} onCancel={()=>{this.setState({open:false})}} maskClosable={false}>
|
|
29
|
+
<Spin /> 下载文件中,请勿关闭浏览器
|
|
30
|
+
</Modal>
|
|
31
|
+
</>
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Modal} from 'antd';
|
|
3
|
+
import './Ellipsis.less'
|
|
4
|
+
import {StringUtils} from "../utils";
|
|
5
|
+
|
|
6
|
+
export class Ellipsis extends React.Component {
|
|
7
|
+
static defaultProps = {length: 15}
|
|
8
|
+
|
|
9
|
+
render() {
|
|
10
|
+
let {length, children} = this.props;
|
|
11
|
+
let text = children;
|
|
12
|
+
if(!text){
|
|
13
|
+
return
|
|
14
|
+
}
|
|
15
|
+
if(text.length < this.props.length){
|
|
16
|
+
return text;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const shortText = StringUtils.ellipsis(text, length)
|
|
21
|
+
return (
|
|
22
|
+
<span className='ellipsis-text' onClick={this.showFull}>{shortText}</span>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
showFull = () => {
|
|
27
|
+
const pre = this.props.pre || false
|
|
28
|
+
let node = this.props.children
|
|
29
|
+
if(pre){
|
|
30
|
+
node = <pre>{node}</pre>
|
|
31
|
+
}
|
|
32
|
+
Modal.info({
|
|
33
|
+
icon: null,
|
|
34
|
+
title:'文本内容',
|
|
35
|
+
content: node
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
// 推荐(16+8n)px 作为间隔,n为自然数
|
|
5
|
+
declare type GapProps = {
|
|
6
|
+
/**
|
|
7
|
+
* mini 4px
|
|
8
|
+
* middle 8px
|
|
9
|
+
* large 16px
|
|
10
|
+
*
|
|
11
|
+
* 默认 middle
|
|
12
|
+
*/
|
|
13
|
+
size?: 'small' | 'middle' | 'large';
|
|
14
|
+
|
|
15
|
+
/** 方向:水平或垂直
|
|
16
|
+
* 默认垂直:上下间隔
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
direction?: 'horizontal' | 'vertical';
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export class Gap extends React.Component<GapProps, any> {
|
|
23
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 上下间隔
|
|
5
|
+
*/
|
|
6
|
+
export class Gap extends React.Component {
|
|
7
|
+
|
|
8
|
+
static defaultProps = {
|
|
9
|
+
size: 'middle',
|
|
10
|
+
direction: 'vertical',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
render() {
|
|
14
|
+
const {n = 0, size, direction} = this.props;
|
|
15
|
+
if (n) {
|
|
16
|
+
console.warn('参数 n 已经不被支持')
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const SizeMap = {
|
|
21
|
+
x: 4,
|
|
22
|
+
small: 8,
|
|
23
|
+
middle: 16,
|
|
24
|
+
large: 24,
|
|
25
|
+
xLarge: 32,
|
|
26
|
+
xxLarge: 40,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
let sizePx = SizeMap[size];
|
|
31
|
+
const isHorizontal = direction === 'horizontal';
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// 水平间隔:有宽度,无高度
|
|
35
|
+
// 垂直间隔:有高度,无宽度
|
|
36
|
+
const width = isHorizontal ? sizePx : 0;
|
|
37
|
+
const height = isHorizontal ? 0 : sizePx;
|
|
38
|
+
|
|
39
|
+
// 水平间隔用 inline-block(避免换行),垂直间隔用 block
|
|
40
|
+
const display = isHorizontal ? 'inline-block' : 'block';
|
|
41
|
+
|
|
42
|
+
const style = {display, height, width}
|
|
43
|
+
|
|
44
|
+
return <div style={style}></div>
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export interface LinkButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* 路径
|
|
7
|
+
*/
|
|
8
|
+
path: string;
|
|
9
|
+
label: string;
|
|
10
|
+
type?: 'primary' | 'default' | 'dashed' | 'link' | 'text' | 'ghost'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export class LinkButton extends React.Component<LinkButtonProps, any> {
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Button} from "antd";
|
|
3
|
+
import {PageUtils} from "../utils";
|
|
4
|
+
|
|
5
|
+
export function LinkButton(props) {
|
|
6
|
+
const {path, label, children, size = 'small', ...rest} = props;
|
|
7
|
+
return <Button size={size} {...rest} onClick={() => {
|
|
8
|
+
PageUtils.open(path, label)
|
|
9
|
+
}}>{children}</Button>
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Icons from '@ant-design/icons';
|
|
2
|
+
|
|
3
|
+
declare type NamedIconProps = {
|
|
4
|
+
name: string
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function NamedIcon(props:NamedIconProps){
|
|
8
|
+
let {name, ...rest} = props;
|
|
9
|
+
const IconType = Icons[name]
|
|
10
|
+
|
|
11
|
+
if(IconType){
|
|
12
|
+
return <IconType {...rest}></IconType>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import './index.less'
|
|
3
|
+
import {ThemeUtils} from "../../utils";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 上下间隔
|
|
7
|
+
*/
|
|
8
|
+
export class Page extends React.Component {
|
|
9
|
+
|
|
10
|
+
static defaultProps = {
|
|
11
|
+
padding: false,
|
|
12
|
+
backgroundGray:false
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
render() {
|
|
16
|
+
const style = {}
|
|
17
|
+
if(this.props.padding){
|
|
18
|
+
style.padding = 16
|
|
19
|
+
}
|
|
20
|
+
if(this.props.backgroundGray){
|
|
21
|
+
style.backgroundColor = ThemeUtils.getColor("background-color")
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
return <div className={'tmgg-page'} style={style}>
|
|
26
|
+
{this.props.children}
|
|
27
|
+
</div>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Alert, Spin} from "antd";
|
|
3
|
+
import {ThemeUtils} from "../utils";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 页面加载中的动画
|
|
7
|
+
*/
|
|
8
|
+
export function PageLoading(props: { message?: string }) {
|
|
9
|
+
const msg = props.message || '页面加载中...';
|
|
10
|
+
|
|
11
|
+
return <div style={{
|
|
12
|
+
height: '100vh', width: '100%',
|
|
13
|
+
display: 'flex', alignItems: 'center', justifyContent: "center",
|
|
14
|
+
color: ThemeUtils.getColor("primary-color")
|
|
15
|
+
}}>
|
|
16
|
+
<div style={{textAlign: "center", marginTop: '-10rem'}}>
|
|
17
|
+
<div>
|
|
18
|
+
<Spin size={"large"}></Spin>
|
|
19
|
+
</div>
|
|
20
|
+
<div style={{marginTop: '1rem'}}>
|
|
21
|
+
<Alert title={msg}></Alert>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, {ReactNode} from 'react';
|
|
2
|
+
import {Modal} from 'antd';
|
|
3
|
+
|
|
4
|
+
export interface ProModalProps {
|
|
5
|
+
title: string;
|
|
6
|
+
actionRef?: any; // 弃用,请使用ref
|
|
7
|
+
ref: any;
|
|
8
|
+
onShow?: any;
|
|
9
|
+
footer?: any;
|
|
10
|
+
width?: number;
|
|
11
|
+
children:ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export class ProModal extends React.Component<ProModalProps, any> {
|
|
14
|
+
|
|
15
|
+
constructor(props:ProModalProps) {
|
|
16
|
+
super(props);
|
|
17
|
+
if (props.actionRef) {
|
|
18
|
+
props.actionRef.current = this;
|
|
19
|
+
}
|
|
20
|
+
if (props.ref) {
|
|
21
|
+
props.ref.current = this;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
state = {
|
|
28
|
+
visible: false,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
show = () => {
|
|
32
|
+
this.setState({
|
|
33
|
+
visible: true,
|
|
34
|
+
});
|
|
35
|
+
if (this.props.onShow) {
|
|
36
|
+
this.props.onShow();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
hide = () => {
|
|
40
|
+
this.setState({
|
|
41
|
+
visible: false,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
open = () => {
|
|
45
|
+
this.show();
|
|
46
|
+
};
|
|
47
|
+
close = () => {
|
|
48
|
+
this.hide();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
render() {
|
|
52
|
+
return (
|
|
53
|
+
<Modal
|
|
54
|
+
maskClosable={false}
|
|
55
|
+
destroyOnHidden
|
|
56
|
+
title={this.props.title}
|
|
57
|
+
open={this.state.visible}
|
|
58
|
+
onCancel={this.hide}
|
|
59
|
+
footer={this.props.footer || null}
|
|
60
|
+
width={this.props.width || 800}
|
|
61
|
+
>
|
|
62
|
+
{this.state.visible && this.props.children}
|
|
63
|
+
</Modal>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|