@jiangood/admin-spring-boot-starter 0.2.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.
Files changed (190) hide show
  1. package/config/dist/config.js +45 -0
  2. package/config/dist/index.js +19 -0
  3. package/config/dist/plugins/form-plugin.js +51 -0
  4. package/config/dist/plugins/route-plugin.js +72 -0
  5. package/package.json +41 -0
  6. package/src/app.js +1 -0
  7. package/src/asserts/welcome.png +0 -0
  8. package/src/forms/demoForm.jsx +16 -0
  9. package/src/framework/components/DownloadFileButton.d.ts +11 -0
  10. package/src/framework/components/DownloadFileButton.jsx +33 -0
  11. package/src/framework/components/Ellipsis.jsx +39 -0
  12. package/src/framework/components/Ellipsis.less +8 -0
  13. package/src/framework/components/Gap/index.d.ts +23 -0
  14. package/src/framework/components/Gap/index.jsx +46 -0
  15. package/src/framework/components/LinkButton.d.ts +14 -0
  16. package/src/framework/components/LinkButton.jsx +10 -0
  17. package/src/framework/components/NamedIcon.tsx +15 -0
  18. package/src/framework/components/Page/index.d.ts +17 -0
  19. package/src/framework/components/Page/index.jsx +30 -0
  20. package/src/framework/components/Page/index.less +10 -0
  21. package/src/framework/components/PageLoading.tsx +27 -0
  22. package/src/framework/components/ProModal/index.tsx +66 -0
  23. package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
  24. package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
  25. package/src/framework/components/ProTable/index.d.ts +42 -0
  26. package/src/framework/components/ProTable/index.jsx +260 -0
  27. package/src/framework/components/ProTable/index.less +14 -0
  28. package/src/framework/components/ProTable/utils/index.js +43 -0
  29. package/src/framework/components/ValueType/index.jsx +34 -0
  30. package/src/framework/components/ValueType/registry.jsx +27 -0
  31. package/src/framework/components/index.ts +17 -0
  32. package/src/framework/components/system/ButtonList.d.ts +9 -0
  33. package/src/framework/components/system/ButtonList.jsx +35 -0
  34. package/src/framework/components/system/HasPerm.tsx +14 -0
  35. package/src/framework/components/system/index.tsx +29 -0
  36. package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -0
  37. package/src/framework/components/view/ViewEllipsis.d.ts +11 -0
  38. package/src/framework/components/view/ViewEllipsis.jsx +30 -0
  39. package/src/framework/components/view/ViewFile.d.ts +10 -0
  40. package/src/framework/components/view/ViewFile.jsx +49 -0
  41. package/src/framework/components/view/ViewFileButton.d.ts +10 -0
  42. package/src/framework/components/view/ViewFileButton.jsx +0 -0
  43. package/src/framework/components/view/ViewImage.d.ts +9 -0
  44. package/src/framework/components/view/ViewImage.jsx +60 -0
  45. package/src/framework/components/view/ViewRange/index.d.ts +16 -0
  46. package/src/framework/components/view/ViewRange/index.jsx +20 -0
  47. package/src/framework/components/view/ViewText.tsx +16 -0
  48. package/src/framework/components/view/index.ts +10 -0
  49. package/src/framework/field-components/FieldBoolean.d.ts +13 -0
  50. package/src/framework/field-components/FieldBoolean.jsx +76 -0
  51. package/src/framework/field-components/FieldDate.d.ts +27 -0
  52. package/src/framework/field-components/FieldDate.jsx +114 -0
  53. package/src/framework/field-components/FieldDateRange.d.ts +6 -0
  54. package/src/framework/field-components/FieldDateRange.jsx +104 -0
  55. package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
  56. package/src/framework/field-components/FieldDictSelect.jsx +16 -0
  57. package/src/framework/field-components/FieldEditor.d.ts +10 -0
  58. package/src/framework/field-components/FieldEditor.jsx +58 -0
  59. package/src/framework/field-components/FieldNumberRange.d.ts +13 -0
  60. package/src/framework/field-components/FieldNumberRange.jsx +59 -0
  61. package/src/framework/field-components/FieldPercent.d.ts +12 -0
  62. package/src/framework/field-components/FieldPercent.jsx +27 -0
  63. package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
  64. package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
  65. package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
  66. package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
  67. package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
  68. package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
  69. package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
  70. package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
  71. package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
  72. package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
  73. package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
  74. package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
  75. package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
  76. package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +68 -0
  77. package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
  78. package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
  79. package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
  80. package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
  81. package/src/framework/field-components/FieldTable.d.ts +17 -0
  82. package/src/framework/field-components/FieldTable.jsx +108 -0
  83. package/src/framework/field-components/FieldTable.less +29 -0
  84. package/src/framework/field-components/FieldTableSelect.d.ts +19 -0
  85. package/src/framework/field-components/FieldTableSelect.jsx +59 -0
  86. package/src/framework/field-components/FieldUploadFile.d.ts +34 -0
  87. package/src/framework/field-components/FieldUploadFile.jsx +141 -0
  88. package/src/framework/field-components/index.ts +21 -0
  89. package/src/framework/field-components/system/OrgTree.tsx +61 -0
  90. package/src/framework/field-components/system/RoleTree.tsx +53 -0
  91. package/src/framework/field-components/system/index.ts +2 -0
  92. package/src/framework/index.ts +5 -0
  93. package/src/framework/pages/LoginPage.d.ts +15 -0
  94. package/src/framework/pages/LoginPage.jsx +132 -0
  95. package/src/framework/pages/LoginPage.less +53 -0
  96. package/src/framework/pages/LoginPageUtils.ts +35 -0
  97. package/src/framework/pages/index.ts +2 -0
  98. package/src/framework/utils/ArrUtils.ts +229 -0
  99. package/src/framework/utils/ColorsUtils.ts +378 -0
  100. package/src/framework/utils/DateUtils.ts +187 -0
  101. package/src/framework/utils/DeviceUtils.ts +46 -0
  102. package/src/framework/utils/DomUtils.ts +50 -0
  103. package/src/framework/utils/EventBusUtils.ts +144 -0
  104. package/src/framework/utils/MessageUtils.tsx +145 -0
  105. package/src/framework/utils/ObjectUtils.ts +118 -0
  106. package/src/framework/utils/StorageUtils.ts +50 -0
  107. package/src/framework/utils/StringUtils.ts +412 -0
  108. package/src/framework/utils/TreeUtils.ts +251 -0
  109. package/src/framework/utils/UrlUtils.ts +152 -0
  110. package/src/framework/utils/UuidUtils.ts +88 -0
  111. package/src/framework/utils/ValidateUtils.ts +28 -0
  112. package/src/framework/utils/index.ts +16 -0
  113. package/src/framework/utils/system/DictUtils.ts +97 -0
  114. package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
  115. package/src/framework/utils/system/HttpUtils.ts +247 -0
  116. package/src/framework/utils/system/PageUtils.ts +163 -0
  117. package/src/framework/utils/system/PermUtils.ts +79 -0
  118. package/src/framework/utils/system/SysUtils.ts +97 -0
  119. package/src/framework/utils/system/ThemeUtils.ts +27 -0
  120. package/src/framework/utils/system/index.ts +7 -0
  121. package/src/framework/view-components/ViewApproveStatus.tsx +26 -0
  122. package/src/framework/view-components/ViewBoolean.tsx +6 -0
  123. package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +12 -0
  124. package/src/framework/view-components/ViewFlowableInstanceProgress.jsx +97 -0
  125. package/src/framework/view-components/ViewFlowableInstanceProgressButton.tsx +26 -0
  126. package/src/framework/view-components/ViewPassword.tsx +25 -0
  127. package/src/framework/view-components/ViewProps.ts +11 -0
  128. package/src/framework/view-components/index.ts +6 -0
  129. package/src/index.ts +2 -0
  130. package/src/layouts/PageRender.d.ts +22 -0
  131. package/src/layouts/PageRender.jsx +90 -0
  132. package/src/layouts/admin/HeaderRight.jsx +104 -0
  133. package/src/layouts/admin/TabPageRender.jsx +158 -0
  134. package/src/layouts/admin/index.jsx +161 -0
  135. package/src/layouts/admin/index.less +65 -0
  136. package/src/layouts/index.jsx +153 -0
  137. package/src/layouts/index.less +24 -0
  138. package/src/loading.jsx +18 -0
  139. package/src/pages/404.jsx +13 -0
  140. package/src/pages/about.jsx +14 -0
  141. package/src/pages/flowable/design/contextPad.js +50 -0
  142. package/src/pages/flowable/design/customTranslate/customTranslate.js +16 -0
  143. package/src/pages/flowable/design/customTranslate/translations-properties-panel.js +10 -0
  144. package/src/pages/flowable/design/customTranslate/translations.js +144 -0
  145. package/src/pages/flowable/design/descriptors/flowable.json +1109 -0
  146. package/src/pages/flowable/design/index.css +7 -0
  147. package/src/pages/flowable/design/index.jsx +171 -0
  148. package/src/pages/flowable/design/provider/FlowablePropertiesProvider.js +75 -0
  149. package/src/pages/flowable/design/provider/index.js +6 -0
  150. package/src/pages/flowable/design/provider/properties/ConditionDesign.jsx +175 -0
  151. package/src/pages/flowable/design/provider/properties/ConditionProps.jsx +76 -0
  152. package/src/pages/flowable/design/provider/properties/DelegateExpressionProps.js +54 -0
  153. package/src/pages/flowable/design/provider/properties/FormProps.js +55 -0
  154. package/src/pages/flowable/design/provider/properties/MultiInstanceProps.js +100 -0
  155. package/src/pages/flowable/design/provider/properties/UserTaskForm.jsx +48 -0
  156. package/src/pages/flowable/design/provider/properties/utils.jsx +35 -0
  157. package/src/pages/flowable/index.jsx +87 -0
  158. package/src/pages/flowable/monitor/definition.jsx +87 -0
  159. package/src/pages/flowable/monitor/instance/index.jsx +177 -0
  160. package/src/pages/flowable/monitor/instance/view.jsx +102 -0
  161. package/src/pages/flowable/monitor/task.jsx +98 -0
  162. package/src/pages/flowable/task/form.jsx +186 -0
  163. package/src/pages/flowable/task/index.jsx +184 -0
  164. package/src/pages/flowable/task/instance/view.jsx +85 -0
  165. package/src/pages/flowable/test/index.jsx +57 -0
  166. package/src/pages/index.jsx +25 -0
  167. package/src/pages/login.jsx +21 -0
  168. package/src/pages/system/api/ApiDoc.jsx +144 -0
  169. package/src/pages/system/api/index.jsx +268 -0
  170. package/src/pages/system/api/perm.jsx +69 -0
  171. package/src/pages/system/config/index.jsx +136 -0
  172. package/src/pages/system/dict/Dict.jsx +72 -0
  173. package/src/pages/system/dict/DictItem.jsx +177 -0
  174. package/src/pages/system/dict/index.jsx +25 -0
  175. package/src/pages/system/file/index.jsx +160 -0
  176. package/src/pages/system/job/index.jsx +324 -0
  177. package/src/pages/system/log/index.jsx +78 -0
  178. package/src/pages/system/org/index.jsx +262 -0
  179. package/src/pages/system/role/index.jsx +308 -0
  180. package/src/pages/system/role/perm.jsx +108 -0
  181. package/src/pages/system/sysManual/index.jsx +127 -0
  182. package/src/pages/system/user/UserPerm.jsx +97 -0
  183. package/src/pages/system/user/index.jsx +258 -0
  184. package/src/pages/test.jsx +200 -0
  185. package/src/pages/ureport/index.jsx +22 -0
  186. package/src/pages/userCenter/ChangePassword.jsx +63 -0
  187. package/src/pages/userCenter/index.jsx +90 -0
  188. package/src/pages/userCenter/manual.jsx +59 -0
  189. package/src/pages/userCenter/message.jsx +105 -0
  190. package/src/style/global.less +51 -0
@@ -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/plugins/route-plugin.ts'));
11
+ console.log('isFramework', isFramework);
12
+ var pluginDir = isFramework ? './config/plugins' : '@jiangood/admin-spring-boot-starter/config/dist/plugins';
13
+ console.log('pluginDir', pluginDir);
14
+ exports.default = (0, umi_1.defineConfig)({
15
+ // 配置是否让生成的文件包含 hash 后缀,通常用于增量发布和避免浏览器加载缓存。
16
+ hash: true,
17
+ history: { type: 'hash' },
18
+ // 复杂,还得设置忽略、编译等,先关掉
19
+ mfsu: false,
20
+ esbuildMinifyIIFE: true,
21
+ plugins: [
22
+ pluginDir + '/form-plugin',
23
+ pluginDir + '/route-plugin',
24
+ ],
25
+ proxy: {
26
+ '/admin': {
27
+ target: 'http://127.0.0.1:8002',
28
+ changeOrigin: true,
29
+ },
30
+ '/preview': {
31
+ target: 'http://127.0.0.1:8002',
32
+ changeOrigin: true,
33
+ },
34
+ '/ureport': {
35
+ target: 'http://127.0.0.1:8002',
36
+ changeOrigin: true,
37
+ pathRewrite: { '^/ureport': '/ureport' },
38
+ },
39
+ '/admin/ws': {
40
+ target: 'http://127.0.0.1:8002',
41
+ changeOrigin: true,
42
+ ws: true,
43
+ },
44
+ }
45
+ });
@@ -0,0 +1,19 @@
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("./plugins/route-plugin"), exports);
19
+ __exportStar(require("./plugins/form-plugin"), exports);
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var fs = require("fs");
4
+ var path = require("path");
5
+ // 自动注册src/forms下的表单
6
+ var pkgName = '@jiangood/admin-spring-boot-starter';
7
+ exports.default = (function (api) {
8
+ api.logger.info('plugin starting... ');
9
+ api.logger.info('info', JSON.stringify(api.env));
10
+ api.describe({
11
+ key: 'form-register-by-dir',
12
+ });
13
+ var isFramework = api.pkg.name === pkgName;
14
+ api.logger.info('current pkgName', api.pkg.name);
15
+ api.logger.info('is framework ?', isFramework);
16
+ var formRegistryPath = path.join(api.paths.absSrcPath, 'framework');
17
+ if (!isFramework) {
18
+ formRegistryPath = path.join(api.paths.absNodeModulesPath, pkgName);
19
+ }
20
+ api.logger.info('formRegistryPath', formRegistryPath);
21
+ api.addEntryImports(function () { return ({
22
+ source: formRegistryPath,
23
+ specifier: '{FormRegistryUtils}'
24
+ }); });
25
+ parseDir(api, path.join(api.paths.absSrcPath, 'forms'));
26
+ if (!isFramework) {
27
+ parseDir(api, path.join(api.paths.absNodeModulesPath, pkgName, 'src', 'forms'));
28
+ }
29
+ });
30
+ function parseDir(api, dir) {
31
+ api.logger.info('scan dir', dir);
32
+ if (!fs.existsSync(dir)) {
33
+ api.logger.info('dir not exist, return ');
34
+ return;
35
+ }
36
+ fs.readdirSync(dir).forEach(function (file) {
37
+ if (!file.endsWith(".jsx")) {
38
+ return;
39
+ }
40
+ var source = path.join(dir, file);
41
+ var name = file.replace(".jsx", "");
42
+ // import form
43
+ api.addEntryImports(function () { return ({
44
+ source: source,
45
+ specifier: name
46
+ }); });
47
+ // register form
48
+ api.addEntryCodeAhead(function () { return "FormRegistryUtils.register(\"".concat(name, "\",").concat(name, " );"); });
49
+ api.logger.info('formRegistry.register: ', name, source);
50
+ });
51
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var fs = require("fs");
4
+ var path = require("path");
5
+ // 自动注册src/forms下的表单
6
+ var pkgName = '@jiangood/admin-spring-boot-starter';
7
+ exports.default = (function (api) {
8
+ api.describe({
9
+ key: 'addDependenceRoutes',
10
+ });
11
+ var pageDir = api.paths.absNodeModulesPath + "/" + pkgName + "/src/pages";
12
+ api.logger.info('scan dir is', pageDir);
13
+ var exist = fs.existsSync(pageDir);
14
+ if (!exist) {
15
+ api.logger.info('dir not exist, return ');
16
+ return;
17
+ }
18
+ var frameworkRoutes = [];
19
+ parseDir(pageDir, frameworkRoutes);
20
+ api.logger.info('frameworkRoutes ', frameworkRoutes);
21
+ api.modifyRoutes(function (routes) {
22
+ // routes 代表用户项目的路由,umi已经自动解析过pages目录
23
+ // 接下来加入加入框架的路由,确保用户项目路由优先级高
24
+ for (var _i = 0, frameworkRoutes_1 = frameworkRoutes; _i < frameworkRoutes_1.length; _i++) {
25
+ var route = frameworkRoutes_1[_i];
26
+ if (routes[route.id] == null) { // 如果用户项目没有这个路由,则加入。否则以用户项目为准
27
+ routes[route.id] = route;
28
+ }
29
+ }
30
+ return routes;
31
+ });
32
+ });
33
+ function parseDir(pageDir, fileRoutes) {
34
+ var list = fs.readdirSync(pageDir);
35
+ for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
36
+ var fileName = list_1[_i];
37
+ var fullPath = path.join(pageDir, fileName);
38
+ var stats = fs.statSync(fullPath);
39
+ if (stats.isFile()) {
40
+ if (fileName.endsWith(".jsx")) {
41
+ addRoute(fullPath, fileRoutes);
42
+ }
43
+ }
44
+ else if (stats.isDirectory()) {
45
+ parseDir(fullPath, fileRoutes);
46
+ }
47
+ }
48
+ }
49
+ function addRoute(file, fileRoutes) {
50
+ var routePath = file.substring(file.indexOf('pages') + 6, file.length - 4);
51
+ routePath = routePath.replaceAll('\\', '/');
52
+ // 文件$开头的会替换为路径变量 如$id 变为 :id
53
+ routePath = routePath.replaceAll("\$", ":");
54
+ var parentId = "@@/global-layout";
55
+ fileRoutes.push({
56
+ absPath: file,
57
+ id: routePath,
58
+ path: routePath,
59
+ file: file,
60
+ parentId: parentId
61
+ });
62
+ if (routePath.endsWith("/index")) {
63
+ routePath = routePath.substring(0, routePath.length - 6);
64
+ fileRoutes.push({
65
+ absPath: file,
66
+ id: routePath,
67
+ path: routePath,
68
+ file: file,
69
+ parentId: parentId
70
+ });
71
+ }
72
+ }
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": "^5.4.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/admin-spring-boot-starter",
29
+ "description": "admin-spring-boot-starter",
30
+ "files": [
31
+ "src/*",
32
+ "config/dist/*",
33
+ "!src/.umi"
34
+ ],
35
+ "main": "src/index.ts",
36
+ "version": "0.2.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,11 @@
1
+ import React from "react";
2
+
3
+
4
+ declare type DownloadFileButtonProps = {
5
+ url: String;
6
+ params: any
7
+
8
+ };
9
+
10
+ export class DownloadFileButton extends React.Component<DownloadFileButtonProps, any> {
11
+ }
@@ -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,8 @@
1
+ .ellipsis-text {
2
+ cursor: pointer;
3
+ // text-decoration: none; /* 移除默认下划线 */
4
+ //border-bottom: 1px dotted #4990CD; /* 自定义点状下划线 */
5
+ //padding-bottom: 2px; /* 可选:调整下划线与文字的间距 */
6
+
7
+ text-decoration: underline dotted; /* 点状下划线 */
8
+ }
@@ -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,17 @@
1
+ // @ts-ignore
2
+ import React from "react";
3
+
4
+ declare type PageProps = {
5
+ /**
6
+ * 是否有内边距
7
+ */
8
+ padding?: boolean;
9
+
10
+ /**
11
+ * 背景色
12
+ */
13
+ backgroundGray?:boolean;
14
+ };
15
+
16
+ export class Page extends React.Component<PageProps, any> {
17
+ }
@@ -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,10 @@
1
+ .tmgg-page {
2
+ width: 100%;
3
+
4
+ // header 48 footer 43, tab 36
5
+ height: calc(100vh - 127px);
6
+
7
+ overflow: auto;
8
+
9
+ background-color: white;
10
+ }
@@ -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
+ }