@jiangood/open-admin 1.3.4 → 2.0.1

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 (153) hide show
  1. package/config/config.js +3 -8
  2. package/package.json +5 -9
  3. package/src/.umi-production/appData.json +325 -365
  4. package/src/.umi-production/core/helmet.ts +1 -1
  5. package/src/.umi-production/core/history.ts +1 -1
  6. package/src/.umi-production/core/historyIntelli.ts +1 -1
  7. package/src/.umi-production/core/pluginConfig.ts +1 -1
  8. package/src/.umi-production/core/polyfill.ts +216 -216
  9. package/src/.umi-production/core/route.tsx +2 -4
  10. package/src/.umi-production/exports.ts +3 -3
  11. package/src/.umi-production/testBrowser.tsx +1 -1
  12. package/src/.umi-production/tsconfig.json +1 -1
  13. package/src/.umi-production/umi.ts +2 -2
  14. package/src/framework/components/ErrorBoundary/index.tsx +86 -0
  15. package/src/framework/components/Gap/index.tsx +42 -0
  16. package/src/framework/components/NamedIcon/index.d.ts +6 -4
  17. package/src/framework/components/NamedIcon/index.jsx +9 -6
  18. package/src/framework/components/OrgTree/{index.jsx → index.tsx} +10 -19
  19. package/src/framework/components/PageLoading/{index.jsx → index.tsx} +2 -5
  20. package/src/framework/components/ProModal/index.tsx +1 -1
  21. package/src/framework/components/ProTable/components/ToolBar/{index.jsx → index.tsx} +3 -3
  22. package/src/framework/components/ProTable/index.less +1 -1
  23. package/src/framework/components/ProTable/{index.jsx → index.tsx} +9 -7
  24. package/src/framework/components/ProTable/utils/index.ts +62 -0
  25. package/src/framework/components/RoleTree/{index.jsx → index.tsx} +7 -17
  26. package/src/framework/components/ValueType/{index.jsx → index.tsx} +2 -1
  27. package/src/framework/components/ViewRange/index.tsx +15 -0
  28. package/src/framework/components/index.ts +2 -1
  29. package/src/framework/components/system/ButtonList.tsx +22 -0
  30. package/src/framework/components/system/index.tsx +4 -4
  31. package/src/framework/fields/BaseRemoteSelect/index.tsx +129 -0
  32. package/src/framework/fields/FieldDictSelect/{index.jsx → index.tsx} +10 -4
  33. package/src/framework/fields/FieldRemoteSelect/index.tsx +37 -0
  34. package/src/framework/fields/FieldRemoteSelectMultiple/index.tsx +29 -0
  35. package/src/framework/fields/FieldRemoteSelectMultipleInline/index.tsx +33 -0
  36. package/src/framework/fields/FieldRemoteTree/index.tsx +31 -0
  37. package/src/framework/fields/FieldRemoteTreeCascader/index.tsx +39 -0
  38. package/src/framework/fields/FieldRemoteTreeSelect/index.tsx +39 -0
  39. package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.tsx +43 -0
  40. package/src/framework/fields/FieldSysOrgTree/{index.jsx → index.tsx} +2 -2
  41. package/src/framework/fields/FieldSysOrgTreeSelect/{index.jsx → index.tsx} +2 -2
  42. package/src/framework/fields/FieldTable/{index.jsx → index.tsx} +5 -5
  43. package/src/framework/fields/FieldUploadFile/{index.jsx → index.tsx} +1 -3
  44. package/src/framework/index.ts +0 -1
  45. package/src/framework/utils/ArrayUtils.ts +186 -0
  46. package/src/framework/utils/EventBusUtils.ts +0 -1
  47. package/src/framework/utils/MessageUtils.tsx +0 -2
  48. package/src/framework/utils/TreeUtils.ts +2 -2
  49. package/src/framework/utils/index.ts +1 -1
  50. package/src/framework/utils/system/FormRegistryUtils.ts +0 -1
  51. package/src/framework/utils/system/PermUtils.ts +2 -2
  52. package/src/framework/views/ViewApproveStatus/index.tsx +11 -0
  53. package/src/framework/views/ViewBoolean/index.tsx +6 -0
  54. package/src/framework/views/ViewFile/{index.jsx → index.tsx} +4 -4
  55. package/src/framework/views/ViewImage/{index.jsx → index.tsx} +3 -3
  56. package/src/framework/views/ViewPassword/{index.jsx → index.tsx} +2 -2
  57. package/src/framework/views/ViewProcessInstanceProgressButton/{index.jsx → index.tsx} +1 -2
  58. package/src/layouts/PageRender.jsx +6 -6
  59. package/src/layouts/admin/HeaderRight.jsx +2 -2
  60. package/src/layouts/admin/TabPageRender.jsx +28 -13
  61. package/src/layouts/admin/index.jsx +15 -14
  62. package/src/layouts/admin/index.less +1 -1
  63. package/src/layouts/index.jsx +12 -13
  64. package/src/layouts/index.less +2 -2
  65. package/src/loading.jsx +17 -16
  66. package/src/pages/login.jsx +132 -4
  67. package/src/{framework/pages/LoginPage.less → pages/login.less} +3 -3
  68. package/src/pages/system/dict/index.jsx +4 -3
  69. package/src/pages/system/file/index.jsx +6 -5
  70. package/src/pages/system/job/index.jsx +10 -9
  71. package/src/pages/system/{sysManual → manual}/index.jsx +1 -1
  72. package/src/pages/system/org/index.jsx +4 -5
  73. package/src/pages/system/role/index.jsx +5 -5
  74. package/src/pages/system/role/perm.jsx +6 -6
  75. package/src/pages/system/user/UserPerm.jsx +4 -4
  76. package/src/pages/system/user/index.jsx +2 -2
  77. package/src/pages/userCenter/ChangePassword.jsx +3 -5
  78. package/src/pages/userCenter/manual.jsx +1 -1
  79. package/src/pages/userCenter/message.jsx +1 -1
  80. package/src/framework/components/DownloadFileButton/index.d.ts +0 -11
  81. package/src/framework/components/Gap/index.d.ts +0 -23
  82. package/src/framework/components/Gap/index.jsx +0 -46
  83. package/src/framework/components/LinkButton/index.d.ts +0 -14
  84. package/src/framework/components/OrgTree/index.d.ts +0 -4
  85. package/src/framework/components/Page/index.d.ts +0 -17
  86. package/src/framework/components/PageLoading/index.d.ts +0 -1
  87. package/src/framework/components/ProTable/index.d.ts +0 -42
  88. package/src/framework/components/ProTable/utils/index.js +0 -43
  89. package/src/framework/components/RoleTree/index.d.ts +0 -4
  90. package/src/framework/components/ViewRange/index.d.ts +0 -14
  91. package/src/framework/components/ViewRange/index.jsx +0 -20
  92. package/src/framework/components/system/ButtonList.d.ts +0 -8
  93. package/src/framework/components/system/ButtonList.jsx +0 -42
  94. package/src/framework/fields/FieldBoolean/index.d.ts +0 -9
  95. package/src/framework/fields/FieldDate/index.d.ts +0 -23
  96. package/src/framework/fields/FieldDateRange/index.d.ts +0 -22
  97. package/src/framework/fields/FieldDictSelect/index.d.ts +0 -12
  98. package/src/framework/fields/FieldEditor/index.d.ts +0 -14
  99. package/src/framework/fields/FieldNumberRange/index.d.ts +0 -10
  100. package/src/framework/fields/FieldPercent/index.d.ts +0 -8
  101. package/src/framework/fields/FieldRemoteSelect/index.d.ts +0 -44
  102. package/src/framework/fields/FieldRemoteSelect/index.jsx +0 -66
  103. package/src/framework/fields/FieldRemoteSelectMultiple/index.d.ts +0 -20
  104. package/src/framework/fields/FieldRemoteSelectMultiple/index.jsx +0 -85
  105. package/src/framework/fields/FieldRemoteSelectMultipleInline/index.d.ts +0 -21
  106. package/src/framework/fields/FieldRemoteSelectMultipleInline/index.jsx +0 -88
  107. package/src/framework/fields/FieldRemoteTree/index.d.ts +0 -20
  108. package/src/framework/fields/FieldRemoteTree/index.jsx +0 -50
  109. package/src/framework/fields/FieldRemoteTreeCascader/index.d.ts +0 -18
  110. package/src/framework/fields/FieldRemoteTreeCascader/index.jsx +0 -59
  111. package/src/framework/fields/FieldRemoteTreeSelect/index.d.ts +0 -19
  112. package/src/framework/fields/FieldRemoteTreeSelect/index.jsx +0 -57
  113. package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.d.ts +0 -20
  114. package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.jsx +0 -62
  115. package/src/framework/fields/FieldSysOrgTree/index.d.ts +0 -9
  116. package/src/framework/fields/FieldSysOrgTreeSelect/index.d.ts +0 -9
  117. package/src/framework/fields/FieldTable/index.d.ts +0 -14
  118. package/src/framework/fields/FieldTableSelect/index.d.ts +0 -19
  119. package/src/framework/fields/FieldUploadFile/index.d.ts +0 -31
  120. package/src/framework/pages/LoginPage.d.ts +0 -16
  121. package/src/framework/pages/LoginPage.jsx +0 -135
  122. package/src/framework/pages/LoginPageUtils.ts +0 -36
  123. package/src/framework/pages/index.ts +0 -2
  124. package/src/framework/utils/ArrUtils.ts +0 -229
  125. package/src/framework/views/ViewApproveStatus/index.d.ts +0 -5
  126. package/src/framework/views/ViewApproveStatus/index.jsx +0 -15
  127. package/src/framework/views/ViewBoolean/index.d.ts +0 -3
  128. package/src/framework/views/ViewBoolean/index.jsx +0 -4
  129. package/src/framework/views/ViewBooleanEnableDisable/index.d.ts +0 -5
  130. package/src/framework/views/ViewFile/index.d.ts +0 -10
  131. package/src/framework/views/ViewFileButton/index.d.ts +0 -10
  132. package/src/framework/views/ViewImage/index.d.ts +0 -6
  133. package/src/framework/views/ViewPassword/index.d.ts +0 -5
  134. package/src/framework/views/ViewProcessInstanceProgress/index.d.ts +0 -12
  135. package/src/framework/views/ViewProcessInstanceProgressButton/index.d.ts +0 -6
  136. package/src/framework/views/ViewText/index.d.ts +0 -16
  137. package/src/pages/system/api/index.jsx +0 -279
  138. package/src/pages/test/views.jsx +0 -95
  139. package/src/framework/components/DownloadFileButton/{index.jsx → index.tsx} +0 -0
  140. package/src/framework/components/LinkButton/{index.jsx → index.tsx} +0 -0
  141. package/src/framework/components/Page/{index.jsx → index.tsx} +0 -0
  142. package/src/framework/components/ValueType/{registry.jsx → registry.tsx} +1 -1
  143. /package/src/framework/fields/FieldBoolean/{index.jsx → index.tsx} +0 -0
  144. /package/src/framework/fields/FieldDate/{index.jsx → index.tsx} +0 -0
  145. /package/src/framework/fields/FieldDateRange/{index.jsx → index.tsx} +0 -0
  146. /package/src/framework/fields/FieldEditor/{index.jsx → index.tsx} +0 -0
  147. /package/src/framework/fields/FieldNumberRange/{index.jsx → index.tsx} +0 -0
  148. /package/src/framework/fields/FieldPercent/{index.jsx → index.tsx} +0 -0
  149. /package/src/framework/fields/FieldTableSelect/{index.jsx → index.tsx} +0 -0
  150. /package/src/framework/views/ViewBooleanEnableDisable/{index.jsx → index.tsx} +0 -0
  151. /package/src/framework/views/ViewFileButton/{index.jsx → index.tsx} +0 -0
  152. /package/src/framework/views/ViewProcessInstanceProgress/{index.jsx → index.tsx} +0 -0
  153. /package/src/framework/views/ViewText/{index.jsx → index.tsx} +0 -0
@@ -19,27 +19,25 @@ if (process.env.NODE_ENV === 'development') {
19
19
  import React from 'react';
20
20
 
21
21
  export async function getRoutes() {
22
- const routes = {"404":{"path":"*","id":"404","parentId":"@@/global-layout"},"userCenter/ChangePassword":{"path":"userCenter/ChangePassword","id":"userCenter/ChangePassword","parentId":"@@/global-layout"},"system/sysManual/index":{"path":"system/sysManual","id":"system/sysManual/index","parentId":"@@/global-layout"},"system/user/UserPerm":{"path":"system/user/UserPerm","id":"system/user/UserPerm","parentId":"@@/global-layout"},"userCenter/message":{"path":"userCenter/message","id":"userCenter/message","parentId":"@@/global-layout"},"system/dict/index":{"path":"system/dict","id":"system/dict/index","parentId":"@@/global-layout"},"system/file/index":{"path":"system/file","id":"system/file/index","parentId":"@@/global-layout"},"system/role/index":{"path":"system/role","id":"system/role/index","parentId":"@@/global-layout"},"system/user/index":{"path":"system/user","id":"system/user/index","parentId":"@@/global-layout"},"userCenter/manual":{"path":"userCenter/manual","id":"userCenter/manual","parentId":"@@/global-layout"},"system/api/index":{"path":"system/api","id":"system/api/index","parentId":"@@/global-layout"},"system/job/index":{"path":"system/job","id":"system/job/index","parentId":"@@/global-layout"},"system/log/index":{"path":"system/log","id":"system/log/index","parentId":"@@/global-layout"},"system/org/index":{"path":"system/org","id":"system/org/index","parentId":"@@/global-layout"},"system/role/perm":{"path":"system/role/perm","id":"system/role/perm","parentId":"@@/global-layout"},"userCenter/index":{"path":"userCenter","id":"userCenter/index","parentId":"@@/global-layout"},"test/views":{"path":"test/views","id":"test/views","parentId":"@@/global-layout"},"about":{"path":"about","id":"about","parentId":"@@/global-layout"},"index":{"path":"/","id":"index","parentId":"@@/global-layout"},"login":{"path":"login","id":"login","parentId":"@@/global-layout"},"@@/global-layout":{"id":"@@/global-layout","path":"/","isLayout":true}} as const;
22
+ const routes = {"404":{"path":"*","id":"404","parentId":"@@/global-layout"},"userCenter/ChangePassword":{"path":"userCenter/ChangePassword","id":"userCenter/ChangePassword","parentId":"@@/global-layout"},"system/user/UserPerm":{"path":"system/user/UserPerm","id":"system/user/UserPerm","parentId":"@@/global-layout"},"system/manual/index":{"path":"system/manual","id":"system/manual/index","parentId":"@@/global-layout"},"userCenter/message":{"path":"userCenter/message","id":"userCenter/message","parentId":"@@/global-layout"},"system/dict/index":{"path":"system/dict","id":"system/dict/index","parentId":"@@/global-layout"},"system/file/index":{"path":"system/file","id":"system/file/index","parentId":"@@/global-layout"},"system/role/index":{"path":"system/role","id":"system/role/index","parentId":"@@/global-layout"},"system/user/index":{"path":"system/user","id":"system/user/index","parentId":"@@/global-layout"},"userCenter/manual":{"path":"userCenter/manual","id":"userCenter/manual","parentId":"@@/global-layout"},"system/job/index":{"path":"system/job","id":"system/job/index","parentId":"@@/global-layout"},"system/log/index":{"path":"system/log","id":"system/log/index","parentId":"@@/global-layout"},"system/org/index":{"path":"system/org","id":"system/org/index","parentId":"@@/global-layout"},"system/role/perm":{"path":"system/role/perm","id":"system/role/perm","parentId":"@@/global-layout"},"userCenter/index":{"path":"userCenter","id":"userCenter/index","parentId":"@@/global-layout"},"about":{"path":"about","id":"about","parentId":"@@/global-layout"},"index":{"path":"/","id":"index","parentId":"@@/global-layout"},"login":{"path":"login","id":"login","parentId":"@@/global-layout"},"@@/global-layout":{"id":"@@/global-layout","path":"/","isLayout":true}} as const;
23
23
  return {
24
24
  routes,
25
25
  routeComponents: {
26
26
  '404': React.lazy(() => import(/* webpackChunkName: "src__pages__404" */'../../../src/pages/404.jsx')),
27
27
  'userCenter/ChangePassword': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__ChangePassword" */'../../../src/pages/userCenter/ChangePassword.jsx')),
28
- 'system/sysManual/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__sysManual__index" */'../../../src/pages/system/sysManual/index.jsx')),
29
28
  'system/user/UserPerm': React.lazy(() => import(/* webpackChunkName: "src__pages__system__user__UserPerm" */'../../../src/pages/system/user/UserPerm.jsx')),
29
+ 'system/manual/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__manual__index" */'../../../src/pages/system/manual/index.jsx')),
30
30
  'userCenter/message': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__message" */'../../../src/pages/userCenter/message.jsx')),
31
31
  'system/dict/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__dict__index" */'../../../src/pages/system/dict/index.jsx')),
32
32
  'system/file/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__file__index" */'../../../src/pages/system/file/index.jsx')),
33
33
  'system/role/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__role__index" */'../../../src/pages/system/role/index.jsx')),
34
34
  'system/user/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__user__index" */'../../../src/pages/system/user/index.jsx')),
35
35
  'userCenter/manual': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__manual" */'../../../src/pages/userCenter/manual.jsx')),
36
- 'system/api/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__api__index" */'../../../src/pages/system/api/index.jsx')),
37
36
  'system/job/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__job__index" */'../../../src/pages/system/job/index.jsx')),
38
37
  'system/log/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__log__index" */'../../../src/pages/system/log/index.jsx')),
39
38
  'system/org/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__org__index" */'../../../src/pages/system/org/index.jsx')),
40
39
  'system/role/perm': React.lazy(() => import(/* webpackChunkName: "src__pages__system__role__perm" */'../../../src/pages/system/role/perm.jsx')),
41
40
  'userCenter/index': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__index" */'../../../src/pages/userCenter/index.jsx')),
42
- 'test/views': React.lazy(() => import(/* webpackChunkName: "src__pages__test__views" */'../../../src/pages/test/views.jsx')),
43
41
  'about': React.lazy(() => import(/* webpackChunkName: "src__pages__about" */'../../../src/pages/about.jsx')),
44
42
  'index': React.lazy(() => import(/* webpackChunkName: "src__pages__index" */'../../../src/pages/index.jsx')),
45
43
  'login': React.lazy(() => import(/* webpackChunkName: "src__pages__login" */'../../../src/pages/login.jsx')),
@@ -7,10 +7,10 @@ export type { RuntimeConfig } from './core/defineApp'
7
7
  // plugins
8
8
  // plugins types.d.ts
9
9
  // @umijs/renderer-*
10
- export { createBrowserHistory, createHashHistory, createMemoryHistory, Helmet, HelmetProvider, createSearchParams, generatePath, matchPath, matchRoutes, Navigate, NavLink, Outlet, resolvePath, useLocation, useMatch, useNavigate, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams, useAppData, useClientLoaderData, useLoaderData, useRouteProps, useSelectedRoutes, useServerLoaderData, renderClient, __getRoot, Link, useRouteData, __useFetcher, withRouter } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.51_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react';
11
- export type { History, ClientLoader } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.51_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react'
10
+ export { createBrowserHistory, createHashHistory, createMemoryHistory, Helmet, HelmetProvider, createSearchParams, generatePath, matchPath, matchRoutes, Navigate, NavLink, Outlet, resolvePath, useLocation, useMatch, useNavigate, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams, useAppData, useClientLoaderData, useLoaderData, useRouteProps, useSelectedRoutes, useServerLoaderData, renderClient, __getRoot, Link, useRouteData, __useFetcher, withRouter } from '/home/runner/work/open-admin/open-admin/web/node_modules/@umijs/renderer-react';
11
+ export type { History, ClientLoader } from '/home/runner/work/open-admin/open-admin/web/node_modules/@umijs/renderer-react'
12
12
  // umi/client/client/plugin
13
- export { ApplyPluginsType, PluginManager } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/umi@4.6.51_@babel+core@7.29.0_@types+node@25.6.0_@types+react@19.2.14_eslint@8.57.1_lig_f1c7f91a64c199a5f22b4d6a795e45de/node_modules/umi/client/client/plugin.js';
13
+ export { ApplyPluginsType, PluginManager } from '/home/runner/work/open-admin/open-admin/web/node_modules/umi/client/client/plugin.js';
14
14
  export { history, createHistory } from './core/history';
15
15
  export { terminal } from './core/terminal';
16
16
  // react ssr
@@ -3,7 +3,7 @@
3
3
  // DO NOT CHANGE IT MANUALLY!
4
4
  import React, { useEffect, useState } from 'react';
5
5
  import { ApplyPluginsType } from 'umi';
6
- import { renderClient, RenderClientOpts } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.51_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react';
6
+ import { renderClient, RenderClientOpts } from '/home/runner/work/open-admin/open-admin/web/node_modules/@umijs/renderer-react';
7
7
  import { createHistory } from './core/history';
8
8
  import { createPluginManager } from './core/plugin';
9
9
  import { getRoutes } from './core/route';
@@ -26,7 +26,7 @@
26
26
  "../../src/.umi/*"
27
27
  ],
28
28
  "umi": [
29
- "../../node_modules/.pnpm/umi@4.6.51_@babel+core@7.29.0_@types+node@25.6.0_@types+react@19.2.14_eslint@8.57.1_lig_f1c7f91a64c199a5f22b4d6a795e45de/node_modules/umi"
29
+ "../../node_modules/umi"
30
30
  ],
31
31
  "umi/typings": [
32
32
  "../../src/.umi/typings"
@@ -3,7 +3,7 @@
3
3
  // DO NOT CHANGE IT MANUALLY!
4
4
  import './core/polyfill';
5
5
 
6
- import { renderClient } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.51_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react';
6
+ import { renderClient } from '/home/runner/work/open-admin/open-admin/web/node_modules/@umijs/renderer-react';
7
7
  import { getRoutes } from './core/route';
8
8
  import { createPluginManager } from './core/plugin';
9
9
  import { createHistory } from './core/history';
@@ -78,6 +78,6 @@ render();
78
78
 
79
79
  if (typeof window !== 'undefined') {
80
80
  window.g_umi = {
81
- version: '4.6.51',
81
+ version: '4.6.55',
82
82
  };
83
83
  }
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import {Button, Collapse, Result} from 'antd';
3
+ import {ThemeUtils} from '../../utils';
4
+
5
+ interface Props {
6
+ children: React.ReactNode;
7
+ /** 自定义降级 UI */
8
+ fallback?: React.ReactNode;
9
+ /** 错误回调,可用于上报 */
10
+ onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
11
+ }
12
+
13
+ interface State {
14
+ hasError: boolean;
15
+ error: Error | null;
16
+ errorInfo: React.ErrorInfo | null;
17
+ }
18
+
19
+ export default class ErrorBoundary extends React.Component<Props, State> {
20
+
21
+ state: State = {
22
+ hasError: false,
23
+ error: null,
24
+ errorInfo: null,
25
+ };
26
+
27
+ static getDerivedStateFromError(error: Error) {
28
+ return {hasError: true, error};
29
+ }
30
+
31
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
32
+ this.setState({errorInfo});
33
+ this.props.onError?.(error, errorInfo);
34
+ }
35
+
36
+ handleRetry = () => {
37
+ this.setState({hasError: false, error: null, errorInfo: null});
38
+ };
39
+
40
+ render() {
41
+ if (!this.state.hasError) {
42
+ return this.props.children;
43
+ }
44
+
45
+ if (this.props.fallback) {
46
+ return this.props.fallback;
47
+ }
48
+
49
+ const detailStyle: React.CSSProperties = {
50
+ maxHeight: 300, overflow: 'auto',
51
+ fontSize: 12, fontFamily: 'monospace',
52
+ whiteSpace: 'pre-wrap', wordBreak: 'break-all',
53
+ background: '#f5f5f5', padding: 12, borderRadius: 4,
54
+ color: ThemeUtils.getColor('error-color') || '#ff4d4f',
55
+ };
56
+
57
+ return (
58
+ <Result
59
+ status="error"
60
+ title="页面渲染异常"
61
+ subTitle="组件渲染时发生错误,请尝试刷新页面。"
62
+ extra={[
63
+ <Button key="retry" type="primary" onClick={this.handleRetry}>
64
+ 重试
65
+ </Button>,
66
+ <Button key="refresh" onClick={() => window.location.reload()}>
67
+ 刷新页面
68
+ </Button>,
69
+ ]}
70
+ >
71
+ <Collapse
72
+ size="small"
73
+ items={[{
74
+ key: 'detail',
75
+ label: '错误详情',
76
+ children: (
77
+ <div style={detailStyle}>
78
+ {this.state.error?.stack || String(this.state.error)}
79
+ </div>
80
+ ),
81
+ }]}
82
+ />
83
+ </Result>
84
+ );
85
+ }
86
+ }
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+
3
+ const SizeMap = {
4
+ xs: 4,
5
+ sm: 8,
6
+ md: 16,
7
+ lg: 24,
8
+ xl: 32,
9
+ xxl: 40,
10
+ };
11
+
12
+ type GapProps = {
13
+ size?: keyof typeof SizeMap;
14
+ direction?: "horizontal" | "vertical";
15
+ } & React.HTMLAttributes<HTMLDivElement>;
16
+
17
+ /**
18
+ * 上下间隔
19
+ */
20
+ export const Gap: React.FC<GapProps> = ({
21
+ size = "md",
22
+ direction = "vertical",
23
+ ...rest
24
+ }) => {
25
+ if (size && !Object.hasOwn(SizeMap, size)) {
26
+ throw new Error(
27
+ `Gap: size 属性必须为 [${Object.keys(SizeMap).join(", ")}] 之一,当前传入:${size}`
28
+ );
29
+ }
30
+
31
+ const sizePx = SizeMap[size];
32
+ const isHorizontal = direction === "horizontal";
33
+
34
+ const style: React.CSSProperties = {
35
+ display: isHorizontal ? "inline-block" : "block",
36
+ width: isHorizontal ? sizePx : 0,
37
+ height: isHorizontal ? 0 : sizePx,
38
+ ...rest.style,
39
+ };
40
+
41
+ return <div style={style} {...rest} />;
42
+ };
@@ -1,5 +1,7 @@
1
- declare type NamedIconProps = {
2
- name: string
3
- };
1
+ import React from 'react';
4
2
 
5
- export function NamedIcon(props:NamedIconProps);
3
+ type NamedIconProps = {
4
+ name: string;
5
+ } & React.ComponentProps<typeof import('@ant-design/icons').WarningOutlined>;
6
+
7
+ export function NamedIcon(props: NamedIconProps): React.ReactElement;
@@ -1,11 +1,14 @@
1
1
  import * as Icons from '@ant-design/icons';
2
+ import { WarningOutlined } from '@ant-design/icons';
2
3
 
3
- export function NamedIcon(props){
4
- let {name, ...rest} = props;
5
- const IconType = Icons[name]
4
+ export function NamedIcon(props) {
5
+ const {name, ...rest} = props;
6
+ const IconType = Icons[name];
6
7
 
7
- if(IconType){
8
- return <IconType {...rest}></IconType>
8
+ if (IconType) {
9
+ return <IconType {...rest}></IconType>;
9
10
  }
10
11
 
11
- }
12
+ console.warn(`NamedIcon: icon "${name}" not found, using fallback`);
13
+ return <WarningOutlined {...rest} />;
14
+ }
@@ -3,39 +3,33 @@ import React from 'react';
3
3
  import * as Icons from '@ant-design/icons';
4
4
  import {HttpUtils} from "../../utils";
5
5
 
6
-
7
- export class OrgTree extends React.Component {
6
+ export class OrgTree extends React.Component<any, any> {
8
7
 
9
8
  state = {
10
9
  treeDataLoading: true,
11
10
  treeData: [],
12
-
13
11
  currentOrgId: null
14
12
  }
15
13
 
16
-
17
14
  componentDidMount() {
18
- HttpUtils.get('admin/sysOrg/deptTree').then(tree => {
19
- this.setState({treeData: tree,treeDataLoading: false})
15
+ HttpUtils.get('admin/sysOrg/dept-tree').then(tree => {
16
+ this.setState({treeData: tree, treeDataLoading: false})
20
17
  })
21
18
  }
22
19
 
23
-
24
20
  onSelectOrg = orgIds => {
25
- let orgId = orgIds[0] || null;
21
+ const orgId = orgIds[0] || null;
26
22
  this.props.onChange(orgId)
27
23
  }
28
24
 
29
-
30
25
  render() {
31
- let {treeData, treeDataLoading} = this.state
26
+ const {treeData, treeDataLoading} = this.state
32
27
  if (treeDataLoading) {
33
28
  return <Skeleton title='加载中...'/>
34
29
  }
35
30
 
36
31
  if (treeData.length === 0) {
37
- return <Alert type={"warning"} message={'组织机构数据为空'}>
38
- </Alert>
32
+ return <Alert type={"warning"} message={'组织机构数据为空'}/>
39
33
  }
40
34
 
41
35
  return <Tree
@@ -44,15 +38,12 @@ export class OrgTree extends React.Component {
44
38
  onSelect={this.onSelectOrg}
45
39
  showIcon
46
40
  blockNode
47
- icon={item=>{
48
- const icon = Icons[item.iconName]
49
- if(icon){
41
+ icon={item => {
42
+ const icon = Icons[item.iconName]
43
+ if (icon) {
50
44
  return React.createElement(icon)
51
45
  }
52
46
  }}
53
- >
54
- </Tree>
47
+ />
55
48
  }
56
-
57
-
58
49
  }
@@ -2,8 +2,7 @@ import React from "react";
2
2
  import {Alert, Spin} from "antd";
3
3
  import {ThemeUtils} from "../../utils";
4
4
 
5
-
6
- export function PageLoading(props) {
5
+ export function PageLoading(props: { message?: string }) {
7
6
  const msg = props.message || '页面加载中...';
8
7
 
9
8
  return <div style={{
@@ -18,8 +17,6 @@ export function PageLoading(props) {
18
17
  <div style={{marginTop: '1rem'}}>
19
18
  <Alert title={msg}></Alert>
20
19
  </div>
21
-
22
-
23
20
  </div>
24
- </div>
21
+ </div>;
25
22
  }
@@ -52,7 +52,7 @@ export class ProModal extends React.Component<ProModalProps, any> {
52
52
  return (
53
53
  <Modal
54
54
  maskClosable={false}
55
- destroyOnHidden
55
+ destroyOnClose
56
56
  title={this.props.title}
57
57
  open={this.state.visible}
58
58
  onCancel={this.hide}
@@ -7,7 +7,7 @@ import React from 'react';
7
7
  import './index.less';
8
8
  import {DateUtils, PageUtils, StorageUtils} from "../../../../utils";
9
9
 
10
- export default class Toolbar extends React.Component {
10
+ export class Toolbar extends React.Component {
11
11
 
12
12
  state = {
13
13
  // 查询历史的模态框
@@ -55,7 +55,7 @@ export default class Toolbar extends React.Component {
55
55
  open={this.state.historyOpen}
56
56
  onCancel={() => this.setState({historyOpen: false})}
57
57
  footer={null}
58
- destroyOnHidden
58
+ destroyOnClose
59
59
  >
60
60
 
61
61
  <Table
@@ -104,7 +104,7 @@ export default class Toolbar extends React.Component {
104
104
  return
105
105
  }
106
106
  const list = StorageUtils.get(this.getParamKey()) || []
107
- let data = {time: DateUtils.now(), params};
107
+ const data = {time: DateUtils.now(), params};
108
108
  list.unshift(data)
109
109
  if (list.length > 5) {
110
110
  list.pop()
@@ -6,7 +6,7 @@
6
6
 
7
7
  .form-item-double-width {
8
8
  .ant-form-item-control {
9
- flex: 0 0 480px !important;
9
+ flex: 0 0 480px;
10
10
  }
11
11
  }
12
12
  }
@@ -1,10 +1,12 @@
1
- import {Button, Form, Table} from 'antd';
2
- import Toolbar from './components/ToolBar';
3
1
  import React from "react";
4
- import './index.less'
2
+ import {Button, Form, Table} from 'antd';
5
3
  import {SearchOutlined} from "@ant-design/icons";
4
+
5
+ import { Toolbar } from './components/ToolBar';
6
6
  import {StringUtils} from "../../utils";
7
7
 
8
+ import './index.less'
9
+
8
10
 
9
11
  export class ProTable extends React.Component {
10
12
 
@@ -58,7 +60,7 @@ export class ProTable extends React.Component {
58
60
  }
59
61
  }
60
62
 
61
- let scrollY = this.props.scrollY;
63
+ const scrollY = this.props.scrollY;
62
64
  if (scrollY) {
63
65
  this.setState({scrollY: scrollY})
64
66
  }
@@ -101,7 +103,7 @@ export class ProTable extends React.Component {
101
103
  const {selectedRows} = this.state
102
104
  for (let i = 0; i < selectedRows.length; i++) {
103
105
  for (let newItem of list) {
104
- let oldItem = selectedRows[i];
106
+ const oldItem = selectedRows[i];
105
107
  if (oldItem[rowKey] === newItem[rowKey]) {
106
108
  selectedRows[i] = newItem;
107
109
  break
@@ -210,7 +212,7 @@ export class ProTable extends React.Component {
210
212
  if (!toolBarRender) {
211
213
  return
212
214
  }
213
- let {selectedRows, selectedRowKeys, params} = this.state;
215
+ const {selectedRows, selectedRowKeys, params} = this.state;
214
216
  return toolBarRender(params, {
215
217
  selectedRows: selectedRows,
216
218
  selectedRowKeys: selectedRowKeys,
@@ -224,7 +226,7 @@ export class ProTable extends React.Component {
224
226
  if (rowSelection === true) {
225
227
  rowSelection = {}
226
228
  }
227
- let {type, onChange: inputOnChange} = rowSelection
229
+ const {type, onChange: inputOnChange} = rowSelection
228
230
 
229
231
 
230
232
  return {
@@ -0,0 +1,62 @@
1
+ import type { MutableRefObject } from 'react';
2
+
3
+ interface PageInfo {
4
+ current: number;
5
+ pageSize: number;
6
+ total: number;
7
+ }
8
+
9
+ interface ActionType {
10
+ pageInfo: PageInfo;
11
+ reload: () => void;
12
+ reset: () => void;
13
+ setPageInfo: (info: Partial<PageInfo>) => void;
14
+ }
15
+
16
+ interface ActionProps {
17
+ onCleanSelected: () => void;
18
+ resetAll: () => void;
19
+ }
20
+
21
+ interface UserAction {
22
+ pageInfo: PageInfo;
23
+ reload: (resetPageIndex?: boolean) => Promise<void>;
24
+ reloadAndRest: () => Promise<void>;
25
+ reset: () => Promise<void>;
26
+ clearSelected: () => void;
27
+ setPageInfo: (rest: Partial<PageInfo>) => void;
28
+ }
29
+
30
+ /**
31
+ * 获取用户的 action 信息
32
+ */
33
+ export function useActionType(
34
+ ref: MutableRefObject<UserAction | undefined>,
35
+ action: ActionType,
36
+ props: ActionProps,
37
+ ): void {
38
+ /** 这里生成action的映射,保证 action 总是使用的最新 只需要渲染一次即可 */
39
+ const userAction: UserAction = {
40
+ pageInfo: action.pageInfo,
41
+ reload: async (resetPageIndex) => {
42
+ if (resetPageIndex) {
43
+ await action.setPageInfo({ current: 1 });
44
+ }
45
+ action?.reload();
46
+ },
47
+ reloadAndRest: async () => {
48
+ props.onCleanSelected();
49
+ await action.setPageInfo({ current: 1 });
50
+ await action?.reload();
51
+ },
52
+ reset: async () => {
53
+ await props.resetAll();
54
+ await action?.reset?.();
55
+ await action?.reload();
56
+ },
57
+ clearSelected: () => props.onCleanSelected(),
58
+ setPageInfo: (rest) => action.setPageInfo(rest),
59
+ };
60
+ // eslint-disable-next-line no-param-reassign
61
+ ref.current = userAction;
62
+ }
@@ -3,48 +3,38 @@ import React from 'react';
3
3
  import {SolutionOutlined} from '@ant-design/icons';
4
4
  import {HttpUtils} from "../../utils";
5
5
 
6
-
7
- export class RoleTree extends React.Component {
6
+ export class RoleTree extends React.Component<any, any> {
8
7
 
9
8
  state = {
10
9
  treeDataLoading: true,
11
10
  treeData: [],
12
-
13
11
  currentOrgId: null
14
12
  }
15
13
 
16
-
17
14
  componentDidMount() {
18
- HttpUtils.get('admin/sysRole/bizTree').then(tree => {
19
- this.setState({treeData: tree,treeDataLoading: false})
15
+ HttpUtils.get('admin/sysRole/biz-tree').then(tree => {
16
+ this.setState({treeData: tree, treeDataLoading: false})
20
17
  })
21
18
  }
22
19
 
23
20
  onSelect = keys => {
24
- let orgId = keys[0] || null;
21
+ const orgId = keys[0] || null;
25
22
  this.props.onSelect(orgId)
26
23
  }
27
24
 
28
-
29
25
  render() {
30
- let {treeData, treeDataLoading} = this.state
26
+ const {treeData, treeDataLoading} = this.state
31
27
  if (treeDataLoading) {
32
28
  return <Skeleton title='加载中...'/>
33
29
  }
34
30
 
35
-
36
31
  return <Tree
37
32
  treeData={treeData}
38
33
  defaultExpandAll
39
34
  onSelect={this.onSelect}
40
35
  showIcon
41
36
  blockNode
42
- icon={item=>{
43
- return <SolutionOutlined />
44
- }}
45
- >
46
- </Tree>
37
+ icon={item => <SolutionOutlined/>}
38
+ />
47
39
  }
48
-
49
-
50
40
  }
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
- import {fieldRegistry, viewRegistry} from "./registry";
3
2
  import {Input} from "antd";
3
+
4
+ import {fieldRegistry, viewRegistry} from "./registry";
4
5
  import {ViewText} from "../../views";
5
6
 
6
7
  function getComponent(registry, type) {
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+
3
+ interface ViewRangeProps {
4
+ min?: string;
5
+ max?: string;
6
+ }
7
+
8
+ export const ViewRange: React.FC<ViewRangeProps> = ({ min, max }) => {
9
+ if ((min == null || min === "") && (max == null || max === "")) {
10
+ return null;
11
+ }
12
+ const showMin = min ?? '未知';
13
+ const showMax = max ?? '未知';
14
+ return <>{showMin} - {showMax}</>;
15
+ };
@@ -10,4 +10,5 @@ export * from './Page'
10
10
  export * from './ValueType'
11
11
  export * from './OrgTree'
12
12
  export * from './RoleTree'
13
- export * from './ViewRange'
13
+ export * from './ViewRange'
14
+ export { default as ErrorBoundary } from './ErrorBoundary'
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Space } from 'antd';
3
+ import { PermUtils } from '../../utils';
4
+
5
+ /**
6
+ * 带权限的按钮列表
7
+ * @param maxNum: 显示子节点的个数, 超过的为收缩起来
8
+ */
9
+ export function ButtonList(props) {
10
+ const { children } = props;
11
+
12
+ const checkPerm = (element) => {
13
+ const _props = element?.props;
14
+ return !_props?.perm || PermUtils.hasPermission(_props.perm);
15
+ };
16
+
17
+ const nodes = React.Children.toArray(children).filter(
18
+ (child) => child != null && checkPerm(child)
19
+ );
20
+
21
+ return <Space>{nodes}</Space>;
22
+ }
@@ -12,18 +12,18 @@ export function FieldUserSelectMultiple(props) {
12
12
  }
13
13
 
14
14
  export function FieldUnitTreeSelect(props) {
15
- return <FieldRemoteTreeSelect url="admin/sysOrg/unitTree" {...props} />;
15
+ return <FieldRemoteTreeSelect url="admin/sysOrg/unit-tree" {...props} />;
16
16
  }
17
17
 
18
18
  export function FieldDeptTreeSelect(props) {
19
- return <FieldRemoteTreeSelect url="admin/sysOrg/deptTree" {...props} />;
19
+ return <FieldRemoteTreeSelect url="admin/sysOrg/dept-tree" {...props} />;
20
20
  }
21
21
 
22
22
  export function FieldOrgTreeSelect(props) {
23
- return <FieldRemoteTreeSelect url="admin/sysOrg/deptTree" {...props} />;
23
+ return <FieldRemoteTreeSelect url="admin/sysOrg/dept-tree" {...props} />;
24
24
  }
25
25
 
26
26
  export function FieldOrgTreeMultipleSelect(props) {
27
- return <FieldRemoteSelectMultiple url="/sysOrg/deptTree" {...props} />;
27
+ return <FieldRemoteSelectMultiple url="/sysOrg/dept-tree" {...props} />;
28
28
  }
29
29