@react-antd-module/runtime 0.1.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 (176) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -0
  3. package/dist/api/home.d.ts +10 -0
  4. package/dist/api/notifications/index.d.ts +2 -0
  5. package/dist/api/system/menu/index.d.ts +6 -0
  6. package/dist/api/system/menu/types.d.ts +19 -0
  7. package/dist/api/system/role/index.d.ts +10 -0
  8. package/dist/api/system/role/types.d.ts +9 -0
  9. package/dist/api/user/index.d.ts +16 -0
  10. package/dist/api/user/types.d.ts +26 -0
  11. package/dist/components/access-control/index.d.ts +15 -0
  12. package/dist/components/basic-button/index.d.ts +7 -0
  13. package/dist/components/basic-content/index.d.ts +7 -0
  14. package/dist/components/basic-form/form-items/form-avatar-item.d.ts +6 -0
  15. package/dist/components/basic-form/form-items/form-tree-item.d.ts +13 -0
  16. package/dist/components/basic-form/form-items/index.d.ts +2 -0
  17. package/dist/components/basic-form/index.d.ts +1 -0
  18. package/dist/components/basic-table/constants.d.ts +1 -0
  19. package/dist/components/basic-table/index.d.ts +12 -0
  20. package/dist/components/basic-table/styles.d.ts +6 -0
  21. package/dist/components/exception-page/index.d.ts +3 -0
  22. package/dist/components/fullscreen-button/index.d.ts +17 -0
  23. package/dist/components/global-spin/index.d.ts +6 -0
  24. package/dist/components/iframe/index.d.ts +1 -0
  25. package/dist/components/jss-theme-provider/index.d.ts +26 -0
  26. package/dist/components/not-found/index.d.ts +6 -0
  27. package/dist/components/page-error/index.d.ts +2 -0
  28. package/dist/components/scrollbar/index.d.ts +7 -0
  29. package/dist/components/unknown-component/index.d.ts +6 -0
  30. package/dist/constants/options.d.ts +9 -0
  31. package/dist/constants/regular-expressions.d.ts +22 -0
  32. package/dist/constants/rules.d.ts +80 -0
  33. package/dist/hooks/use-access/constants.d.ts +24 -0
  34. package/dist/hooks/use-access/index.d.ts +9 -0
  35. package/dist/hooks/use-css-var/index.d.ts +17 -0
  36. package/dist/hooks/use-current-route/index.d.ts +6 -0
  37. package/dist/hooks/use-device-type/index.d.ts +9 -0
  38. package/dist/hooks/use-language/index.d.ts +5 -0
  39. package/dist/hooks/use-layout-menu/index.d.ts +6 -0
  40. package/dist/hooks/use-layout-style/index.d.ts +19 -0
  41. package/dist/hooks/use-preferences/index.d.ts +61 -0
  42. package/dist/icons/index.d.ts +3 -0
  43. package/dist/icons/local-icons.d.ts +17 -0
  44. package/dist/icons/menu-icons.d.ts +4 -0
  45. package/dist/icons/ri.d.ts +14 -0
  46. package/dist/icons/types.d.ts +9 -0
  47. package/dist/index.d.ts +41 -0
  48. package/dist/layout/constants.d.ts +50 -0
  49. package/dist/layout/container-layout/index.d.ts +11 -0
  50. package/dist/layout/hooks/index.d.ts +1 -0
  51. package/dist/layout/hooks/use-layout.d.ts +20 -0
  52. package/dist/layout/keep-alive-layer/index.d.ts +15 -0
  53. package/dist/layout/layout-content/index.d.ts +3 -0
  54. package/dist/layout/layout-effects/index.d.ts +9 -0
  55. package/dist/layout/layout-footer/index.d.ts +5 -0
  56. package/dist/layout/layout-header/components/fullscreen-button.d.ts +2 -0
  57. package/dist/layout/layout-header/components/language-button.d.ts +2 -0
  58. package/dist/layout/layout-header/components/theme-button.d.ts +9 -0
  59. package/dist/layout/layout-header/components/user-menu.d.ts +2 -0
  60. package/dist/layout/layout-header/index.d.ts +5 -0
  61. package/dist/layout/layout-menu/index.d.ts +17 -0
  62. package/dist/layout/layout-menu/style.d.ts +6 -0
  63. package/dist/layout/layout-menu/types.d.ts +26 -0
  64. package/dist/layout/layout-menu/use-menu.d.ts +7 -0
  65. package/dist/layout/layout-menu/utils.d.ts +49 -0
  66. package/dist/layout/layout-mixed-sidebar/first-column-menu.d.ts +9 -0
  67. package/dist/layout/layout-mixed-sidebar/index.d.ts +14 -0
  68. package/dist/layout/layout-mobile-menu/index.d.ts +1 -0
  69. package/dist/layout/layout-root/index.d.ts +5 -0
  70. package/dist/layout/layout-sidebar/index.d.ts +5 -0
  71. package/dist/layout/layout-tabbar/components/draggable-tab-bar.d.ts +16 -0
  72. package/dist/layout/layout-tabbar/components/tab-maximize.d.ts +10 -0
  73. package/dist/layout/layout-tabbar/components/tab-options.d.ts +17 -0
  74. package/dist/layout/layout-tabbar/hooks/use-dropdown-menu.d.ts +26 -0
  75. package/dist/layout/layout-tabbar/index.d.ts +5 -0
  76. package/dist/layout/layout-tabbar/style.d.ts +6 -0
  77. package/dist/layout/parent-layout/index.d.ts +1 -0
  78. package/dist/layout/widgets/breadcrumb-views/index.d.ts +1 -0
  79. package/dist/layout/widgets/global-search/components/search-footer.d.ts +5 -0
  80. package/dist/layout/widgets/global-search/components/search-panel.d.ts +11 -0
  81. package/dist/layout/widgets/global-search/index.d.ts +1 -0
  82. package/dist/layout/widgets/logo/index.d.ts +9 -0
  83. package/dist/layout/widgets/notification/index.d.ts +19 -0
  84. package/dist/layout/widgets/notification/notification-container.d.ts +2 -0
  85. package/dist/layout/widgets/notification/types.d.ts +7 -0
  86. package/dist/layout/widgets/preferences/blocks/animation/index.d.ts +1 -0
  87. package/dist/layout/widgets/preferences/blocks/footer/index.d.ts +1 -0
  88. package/dist/layout/widgets/preferences/blocks/general/index.d.ts +1 -0
  89. package/dist/layout/widgets/preferences/blocks/general/utils.d.ts +1 -0
  90. package/dist/layout/widgets/preferences/blocks/index.d.ts +7 -0
  91. package/dist/layout/widgets/preferences/blocks/layout/constants.d.ts +4 -0
  92. package/dist/layout/widgets/preferences/blocks/layout/index.d.ts +1 -0
  93. package/dist/layout/widgets/preferences/blocks/sidebar/index.d.ts +1 -0
  94. package/dist/layout/widgets/preferences/blocks/tabbar/index.d.ts +1 -0
  95. package/dist/layout/widgets/preferences/blocks/theme/builtin.d.ts +1 -0
  96. package/dist/layout/widgets/preferences/blocks/theme/index.d.ts +2 -0
  97. package/dist/layout/widgets/preferences/blocks/theme/theme.d.ts +1 -0
  98. package/dist/layout/widgets/preferences/index.d.ts +2 -0
  99. package/dist/layout/widgets/preferences/number-input-spinner.d.ts +10 -0
  100. package/dist/layout/widgets/preferences/select-item.d.ts +9 -0
  101. package/dist/layout/widgets/preferences/switch-item.d.ts +8 -0
  102. package/dist/layout/widgets/preferences/text-input.d.ts +8 -0
  103. package/dist/layout/widgets/sider-trigger/index.d.ts +5 -0
  104. package/dist/locales/helper.d.ts +15 -0
  105. package/dist/locales/index.d.ts +18 -0
  106. package/dist/locales/t.d.ts +10 -0
  107. package/dist/module-loader/define-module.d.ts +11 -0
  108. package/dist/module-loader/index.d.ts +20 -0
  109. package/dist/module-loader/keep-alive.d.ts +18 -0
  110. package/dist/module-loader/semver.d.ts +8 -0
  111. package/dist/module-loader/slots.d.ts +9 -0
  112. package/dist/module-loader/types.d.ts +81 -0
  113. package/dist/pages/login/components/code-login.d.ts +7 -0
  114. package/dist/pages/login/components/forgot-password.d.ts +6 -0
  115. package/dist/pages/login/components/password-login.d.ts +1 -0
  116. package/dist/pages/login/components/register-password.d.ts +8 -0
  117. package/dist/pages/login/constants.d.ts +6 -0
  118. package/dist/pages/login/form-mode-context.d.ts +5 -0
  119. package/dist/pages/login/index.d.ts +1 -0
  120. package/dist/plugins/hide-loading.d.ts +1 -0
  121. package/dist/plugins/loading.d.ts +7 -0
  122. package/dist/router/constants.d.ts +1 -0
  123. package/dist/router/extra-info/index.d.ts +1 -0
  124. package/dist/router/extra-info/route-path.d.ts +12 -0
  125. package/dist/router/guard/auth-guard.d.ts +21 -0
  126. package/dist/router/guard/index.d.ts +1 -0
  127. package/dist/router/guard/utils.d.ts +2 -0
  128. package/dist/router/index.d.ts +12 -0
  129. package/dist/router/routes/config.d.ts +7 -0
  130. package/dist/router/routes/core/auth.d.ts +3 -0
  131. package/dist/router/routes/core/exception.d.ts +12 -0
  132. package/dist/router/routes/core/fallback.d.ts +3 -0
  133. package/dist/router/routes/core/index.d.ts +2 -0
  134. package/dist/router/routes/index.d.ts +114 -0
  135. package/dist/router/types.d.ts +79 -0
  136. package/dist/router/utils/add-route-id-by-path.d.ts +81 -0
  137. package/dist/router/utils/ascending.d.ts +95 -0
  138. package/dist/router/utils/flatten-routes.d.ts +5 -0
  139. package/dist/router/utils/generate-menu-items-from-routes.d.ts +10 -0
  140. package/dist/router/utils/generate-routes-from-backend.d.ts +79 -0
  141. package/dist/router/utils/generate-routes-from-frontend.d.ts +5 -0
  142. package/dist/router/utils/merge-route-modules.d.ts +2 -0
  143. package/dist/router/utils/remove-trailing-slash.d.ts +10 -0
  144. package/dist/router/utils/resolve-layout.d.ts +21 -0
  145. package/dist/runtime.js +9179 -0
  146. package/dist/store/access.d.ts +14 -0
  147. package/dist/store/auth.d.ts +20 -0
  148. package/dist/store/global.d.ts +12 -0
  149. package/dist/store/preferences/index.d.ts +80 -0
  150. package/dist/store/preferences/types.d.ts +254 -0
  151. package/dist/store/tabs.d.ts +343 -0
  152. package/dist/store/user.d.ts +7 -0
  153. package/dist/types/app-info.d.ts +18 -0
  154. package/dist/utils/cn/index.d.ts +2 -0
  155. package/dist/utils/dom/index.d.ts +14 -0
  156. package/dist/utils/get-all-expanded-keys/index.d.ts +1 -0
  157. package/dist/utils/get-app-info/index.d.ts +13 -0
  158. package/dist/utils/get-app-namespace/index.d.ts +1 -0
  159. package/dist/utils/iframe-guard.d.ts +18 -0
  160. package/dist/utils/is/index.d.ts +56 -0
  161. package/dist/utils/is-dark-theme/index.d.ts +7 -0
  162. package/dist/utils/is-light-theme/index.d.ts +7 -0
  163. package/dist/utils/is-windows-os/index.d.ts +6 -0
  164. package/dist/utils/progress/index.d.ts +3 -0
  165. package/dist/utils/remember-route/index.d.ts +1 -0
  166. package/dist/utils/request/constants.d.ts +4 -0
  167. package/dist/utils/request/error-response.d.ts +12 -0
  168. package/dist/utils/request/global-progress.d.ts +21 -0
  169. package/dist/utils/request/go-login.d.ts +6 -0
  170. package/dist/utils/request/index.d.ts +1 -0
  171. package/dist/utils/request/refresh.d.ts +11 -0
  172. package/dist/utils/request/scoped.d.ts +17 -0
  173. package/dist/utils/static-antd/index.d.ts +12 -0
  174. package/dist/utils/toggle-html-class/index.d.ts +9 -0
  175. package/dist/utils/tree/index.d.ts +35 -0
  176. package/package.json +60 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 CondorHero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # @react-antd-module/runtime
2
+
3
+ 框架运行时。模块工程**唯一**应该 import 的框架入口。
4
+
5
+ ## 定位
6
+
7
+ | | |
8
+ |---|---|
9
+ | 消费者 | 模块工程(`entry.ts` 与页面代码)、预构建宿主 `@react-antd-module/shell` |
10
+ | 产物 | `dist/runtime.js`(单文件 ESM)。`dist/runtime.d.ts` 尚未产出,类型出口在 P3 随出口冻结一起收敛 |
11
+ | 加载方式 | 由宿主 importmap 映射为 `/assets/runtime.js`,全站唯一实例(单例,见设计文档 D5) |
12
+
13
+ 产物只保留**相对路径**代码;所有裸说明符(`react` / `antd` / `react-router` …)都被 external,交给宿主 importmap 解析。这是单例的实现前提——模块与宿主 import 到的是同一个 URL,因而是同一份实例。
14
+
15
+ ## 安装
16
+
17
+ 模块工程把它放在 `devDependencies`(仅用于类型检查与 IDE 跳转),运行期由宿主提供:
18
+
19
+ ```jsonc
20
+ {
21
+ "devDependencies": {
22
+ "@react-antd-module/runtime": "^x.y.z"
23
+ }
24
+ }
25
+ ```
26
+
27
+ ## 对外出口
28
+
29
+ 出口在 `src/index.ts` 收敛,当前为最小集合(P3 阶段依据实际用量冻结):
30
+
31
+ ```ts
32
+ // 模块契约
33
+ import type {
34
+ AppRouteRecordRaw,
35
+ ModuleDefinition,
36
+ RouteMeta,
37
+ } from "@react-antd-module/runtime";
38
+ import {
39
+ BasicContent,
40
+ defineModule,
41
+ } from "@react-antd-module/runtime";
42
+
43
+ // 宿主侧模块加载(模块工程一般不需要)
44
+ import {
45
+ getModule,
46
+ getModules,
47
+ getRegisteredApiPrefix,
48
+ getRegisteredStore,
49
+ getRoutes,
50
+ loadAll,
51
+ } from "@react-antd-module/runtime";
52
+ ```
53
+
54
+ > `antd`、`react`、`react-router`、`@tanstack/react-query` 等共享依赖**不从 runtime 转出**。模块请直接 import 这些包,由 importmap 命中宿主提供的同一份实例。
55
+
56
+ ## 模块定义示例
57
+
58
+ ```ts
59
+ import type { AppRouteRecordRaw, ModuleDefinition } from "@react-antd-module/runtime";
60
+ import { defineModule } from "@react-antd-module/runtime";
61
+ import { lazy } from "react";
62
+
63
+ const routes: AppRouteRecordRaw[] = [
64
+ {
65
+ path: "/demo",
66
+ Component: lazy(() => import("./pages/demo")),
67
+ handle: {
68
+ title: "demo:menu.demo",
69
+ // 布局语义:container(默认)| parent | none
70
+ layout: "container",
71
+ },
72
+ },
73
+ ];
74
+
75
+ export default defineModule({
76
+ name: "demo",
77
+ description: "示例模块",
78
+ version: "1.0.0",
79
+ routes,
80
+ i18n: {
81
+ "zh-CN": () => import("./locales/zh-CN.json"),
82
+ "en-US": () => import("./locales/en-US.json"),
83
+ },
84
+ } satisfies ModuleDefinition);
85
+ ```
86
+
87
+ ## 内置能力(非出口,但影响模块行为)
88
+
89
+ - **路由级缓存**:KeepAlive 位于宿主固定层,缓存开关由各模块路由的 `handle.keepAlive` 汇总得出,不依赖任何具体布局组件是否存在。
90
+ - **布局语义**:`handle.layout` 决定该路由用哪层布局包裹(`container` / `parent` / `none`)。迁移期未声明时按 `container` 处理,保持既有行为。
91
+ - **兜底页**:`NotFound`(404)与 `UnknownComponent`(后端下发路由找不到前端组件)由框架内置,模块无需提供;需要自定义时用自己的路由覆盖。
92
+
93
+ ## 构建
94
+
95
+ ```bash
96
+ # 只出 JS(shell 构建链路走这条,当前唯一可用的构建)
97
+ pnpm --filter @react-antd-module/runtime exec vite build
98
+
99
+ # vite build + tsc 出 d.ts + 重写 d.ts 里的 #src/* 说明符
100
+ # ⚠️ 目前 tsc 声明阶段仍有 3 处 declaration-emit 报错,属 P3 待办
101
+ pnpm --filter @react-antd-module/runtime build
102
+ ```
103
+
104
+ `dist/` 是**随仓库分发的预置产物**(`.gitignore` 中已显式放行),改动 runtime 源码后需要重新构建并提交。
105
+
106
+ ## 目录约定
107
+
108
+ ```
109
+ packages/runtime/src/
110
+ ├── index.ts # 唯一对外出口
111
+ ├── components/ # 框架组件(含 not-found / unknown-component 兜底页)
112
+ ├── layout/ # 布局与 keep-alive-layer(宿主固定层)
113
+ ├── module-loader/ # 模块加载、拓扑排序、生命周期、i18n 合并
114
+ ├── router/ # 路由类型、工具、核心路由表
115
+ ├── locales/ # 框架文案(模块文案由模块自带)
116
+ └── store/ # 框架状态
117
+ ```
118
+
119
+ 内部引用统一走 `#src/*` 子路径 imports;**禁止**出现 `#modules/*`(框架不得反向依赖业务模块,CI 有卡口)。
@@ -0,0 +1,10 @@
1
+ export interface PieDataType {
2
+ value: number;
3
+ code: string;
4
+ }
5
+ export declare function fetchPie(data: {
6
+ by: string | number;
7
+ }): Promise<ApiResponse<PieDataType[]>>;
8
+ export declare function fetchLine(data: {
9
+ range: string;
10
+ }): Promise<ApiResponse<string[]>>;
@@ -0,0 +1,2 @@
1
+ import type { NotificationItem } from "../../layout/widgets/notification/types";
2
+ export declare function fetchNotifications(): Promise<ApiResponse<NotificationItem[]>>;
@@ -0,0 +1,6 @@
1
+ import type { MenuItemType } from "./types";
2
+ export * from "./types";
3
+ export declare function fetchMenuList(data: any): Promise<ApiListResponse<MenuItemType>>;
4
+ export declare function fetchAddMenuItem(data: MenuItemType): Promise<ApiResponse<string>>;
5
+ export declare function fetchUpdateMenuItem(data: MenuItemType): Promise<ApiResponse<string>>;
6
+ export declare function fetchDeleteMenuItem(id: number): Promise<ApiResponse<string>>;
@@ -0,0 +1,19 @@
1
+ export interface MenuItemType {
2
+ parentId: string;
3
+ id: number;
4
+ menuType: 0 | 1 | 2 | 3;
5
+ name: string;
6
+ path: string;
7
+ component: string;
8
+ order: number;
9
+ icon: string;
10
+ currentActiveMenu: string;
11
+ iframeLink: string;
12
+ keepAlive: number;
13
+ externalLink: string;
14
+ hideInMenu: number;
15
+ ignoreAccess: number;
16
+ status: 1;
17
+ createTime: number;
18
+ updateTime: number;
19
+ }
@@ -0,0 +1,10 @@
1
+ import type { RoleItemType } from "./types";
2
+ export * from "./types";
3
+ export declare function fetchRoleList(data: any): Promise<ApiListResponse<RoleItemType>>;
4
+ export declare function fetchAddRoleItem(data: RoleItemType): Promise<ApiResponse<string>>;
5
+ export declare function fetchUpdateRoleItem(data: RoleItemType): Promise<ApiResponse<string>>;
6
+ export declare function fetchDeleteRoleItem(id: number): Promise<ApiResponse<string>>;
7
+ export declare function fetchRoleMenu(): Promise<ApiResponse<RoleItemType[]>>;
8
+ export declare function fetchMenuByRoleId(data: {
9
+ id: number;
10
+ }): Promise<ApiResponse<string[]>>;
@@ -0,0 +1,9 @@
1
+ export interface RoleItemType {
2
+ id: number;
3
+ createTime: number;
4
+ updateTime: number;
5
+ name: string;
6
+ code: string;
7
+ status: 1 | 0;
8
+ remark: string;
9
+ }
@@ -0,0 +1,16 @@
1
+ import type { AppRouteRecordRaw } from "../../router/types";
2
+ import type { AuthType, LoginInfo, UserInfoType } from "./types";
3
+ export * from "./types";
4
+ export declare function fetchLogin(data: LoginInfo): Promise<ApiResponse<AuthType>>;
5
+ export declare function fetchLogout(data?: {
6
+ readonly refreshToken?: string;
7
+ }): Promise<unknown>;
8
+ export declare function fetchAsyncRoutes(): Promise<ApiResponse<AppRouteRecordRaw[]>>;
9
+ export declare function fetchUserInfo(): Promise<ApiResponse<UserInfoType>>;
10
+ export interface RefreshTokenResult {
11
+ token: string;
12
+ refreshToken: string;
13
+ }
14
+ export declare function fetchRefreshToken(data: {
15
+ readonly refreshToken: string;
16
+ }): Promise<ApiResponse<AuthType>>;
@@ -0,0 +1,26 @@
1
+ import type { AppRouteRecordRaw } from "../../router/types";
2
+ export interface AuthType {
3
+ token: string;
4
+ refreshToken: string;
5
+ }
6
+ export interface LoginInfo {
7
+ username: string;
8
+ password: string;
9
+ }
10
+ export interface UserInfoType {
11
+ id: string;
12
+ avatar: string;
13
+ username: string;
14
+ email: string;
15
+ phoneNumber: string;
16
+ description: string;
17
+ roles: Array<string>;
18
+ /** 权限码列表(后端下发;模块级 requiredPermissions 门禁消费,P7.12) */
19
+ permissions?: Array<string>;
20
+ menus?: AppRouteRecordRaw[];
21
+ }
22
+ export interface AuthListProps {
23
+ label: string;
24
+ name: string;
25
+ auth: string[];
26
+ }
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from "react";
2
+ interface AccessControlProps {
3
+ type?: "code" | "role";
4
+ codes?: string | string[];
5
+ children?: ReactNode;
6
+ fallback?: ReactNode;
7
+ }
8
+ /**
9
+ * 权限验证组件
10
+ *
11
+ * @param AccessControlProps 权限验证组件的属性
12
+ * @returns 若子组件存在,并且传入的权限值有效,则返回子组件;否则返回 null
13
+ */
14
+ export declare function AccessControl({ type, codes, children, fallback }: AccessControlProps): ReactNode;
15
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ButtonProps } from "antd";
2
+ import type { ReactNode } from "react";
3
+ interface BasicButtonProps extends ButtonProps {
4
+ children?: ReactNode;
5
+ }
6
+ export declare function BasicButton(props: BasicButtonProps): import("#node_modules/@types/react").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ style?: React.CSSProperties;
3
+ className?: string;
4
+ children: React.ReactNode;
5
+ }
6
+ export declare function BasicContent(props: Props): import("#node_modules/@types/react").JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ interface FormAvatarItemProps {
2
+ value?: string;
3
+ onChange?: (value: any) => void;
4
+ }
5
+ export declare function FormAvatarItem({ value, onChange }: FormAvatarItemProps): import("#node_modules/@types/react").JSX.Element;
6
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { BasicDataNode } from "antd/lib/tree";
2
+ export interface TreeDataNodeWithId extends BasicDataNode {
3
+ id: string;
4
+ title: string;
5
+ children: TreeDataNodeWithId[];
6
+ }
7
+ interface FormTreeItemProps {
8
+ treeData: TreeDataNodeWithId[];
9
+ value?: React.Key[];
10
+ onChange?: (value: React.Key[]) => void;
11
+ }
12
+ export declare function FormTreeItem({ treeData, value, onChange }: FormTreeItemProps): import("#node_modules/@types/react").JSX.Element;
13
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./form-avatar-item";
2
+ export * from "./form-tree-item";
@@ -0,0 +1 @@
1
+ export * from "./form-items";
@@ -0,0 +1 @@
1
+ export declare const BASIC_TABLE_ROOT_CLASS_NAME = "basic-table";
@@ -0,0 +1,12 @@
1
+ import type { ParamsType, ProTableProps } from "@ant-design/pro-components";
2
+ export interface BasicTableProps<D, U, V> extends ProTableProps<D, U, V> {
3
+ /**
4
+ * @description 自适应内容区高度,如果设置了 scroll.y,则不进行自适应
5
+ * @default false
6
+ */
7
+ adaptive?: boolean | {
8
+ /** 表格距离页面底部的偏移量,默认值为 `16` */
9
+ offsetBottom?: number;
10
+ };
11
+ }
12
+ export declare function BasicTable<DataType extends Record<string, any>, Params extends ParamsType = ParamsType, ValueType = "text">(props: BasicTableProps<DataType, Params, ValueType>): import("#node_modules/@types/react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 显式标注返回的 classes 形状(P3.1 / TS2883,同 P3.5 的 layout-menu、
3
+ * layout-tabbar 修法):推断类型会引用 jss 的 Classes(非直接依赖,
4
+ * 声明不可移植),这里用结构化等价类型 Record<C, string> 替代。
5
+ */
6
+ export declare const useStyles: (data?: any) => Record<"basicTable", string>;
@@ -0,0 +1,3 @@
1
+ export default function ExceptionPage({ status }: {
2
+ status: "403" | "404" | "500";
3
+ }): import("#node_modules/@types/react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import type { ButtonProps } from "antd";
2
+ import type { RefObject } from "react";
3
+ export interface FullscreenButtonProps extends Omit<ButtonProps, "target"> {
4
+ target: HTMLElement | (() => Element) | RefObject<Element>;
5
+ fullscreenIcon?: React.ReactNode;
6
+ fullscreenExitIcon?: React.ReactNode;
7
+ }
8
+ /**
9
+ * 全屏按钮组件
10
+ *
11
+ * @param target 全屏目标元素
12
+ * @param fullscreenIcon 全屏时图标
13
+ * @param fullscreenExitIcon 退出全屏时图标
14
+ * @param restProps 其他属性
15
+ * @returns 返回全屏按钮组件
16
+ */
17
+ export declare const FullscreenButton: React.FC<FullscreenButtonProps>;
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from "react";
2
+ export interface GlobalSpinProps {
3
+ className?: string;
4
+ children: ReactNode;
5
+ }
6
+ export declare function GlobalSpin({ children, className }: GlobalSpinProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("#node_modules/@types/react").ReactPortal | import("#node_modules/@types/react").ReactElement<unknown, string | import("#node_modules/@types/react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("#node_modules/@types/react").JSX.Element | null | undefined;
@@ -0,0 +1 @@
1
+ export declare function Iframe(): import("#node_modules/@types/react").JSX.Element | null;
@@ -0,0 +1,26 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * 自定义的JSS主题提供者组件
4
+ *
5
+ * @zh 自定义的 JSS 主题提供者组件,用于在 React 应用中提供 JSS 主题
6
+ * @en Custom JSS theme provider component, used to provide JSS themes in React applications
7
+ */
8
+ export interface JSSThemeProviderProps {
9
+ /**
10
+ * 子组件
11
+ *
12
+ * @zh 子组件,该组件将接收JSS主题
13
+ * @en Children components, which will receive the JSS theme
14
+ */
15
+ children: ReactNode;
16
+ }
17
+ /**
18
+ * JSSThemeProvider 组件
19
+ *
20
+ * @zh JSSThemeProvider 组件,用于将 Ant Design 的 token 和全局主题状态传递给子组件
21
+ * @en JSSThemeProvider component, used to pass Ant Design tokens and global theme state to child components
22
+ *
23
+ * @param {JSSThemeProviderProps} props 组件属性
24
+ * @returns {JSX.Element} 返回的JSX元素
25
+ */
26
+ export declare function JSSThemeProvider({ children }: JSSThemeProviderProps): import("#node_modules/@types/react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @zh 框架内置 404 兜底页。模块可通过自定义 `*` 路由覆盖。
3
+ * @en Framework built-in 404 fallback. Modules may override it with their own `*` route.
4
+ */
5
+ export declare function NotFound(): import("#node_modules/@types/react").JSX.Element;
6
+ export default NotFound;
@@ -0,0 +1,2 @@
1
+ import type { FallbackProps } from "react-error-boundary";
2
+ export declare function PageError({ error, resetErrorBoundary }: FallbackProps): import("#node_modules/@types/react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { Props as SimplebarProps } from "simplebar-react";
2
+ /**
3
+ * @see https://github.com/Grsmto/simplebar/tree/master/packages/simplebar-react
4
+ */
5
+ export declare function Scrollbar({ ref, children, ...other }: SimplebarProps & {
6
+ ref?: React.RefObject<HTMLElement | null>;
7
+ }): import("#node_modules/@types/react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @zh 框架内置「路由无对应组件」兜底页,用于后端下发路由找不到前端组件时。
3
+ * @en Framework built-in fallback for backend routes whose frontend component is missing.
4
+ */
5
+ export declare function UnknownComponent(): import("#node_modules/@types/react").JSX.Element;
6
+ export default UnknownComponent;
@@ -0,0 +1,9 @@
1
+ import type { TFunction } from "i18next";
2
+ export declare function getYesNoOptions(t: TFunction<"translation", undefined>): {
3
+ label: string;
4
+ value: number;
5
+ }[];
6
+ export declare function getBooleanOptions(t: TFunction<"translation", undefined>): {
7
+ label: string;
8
+ value: boolean;
9
+ }[];
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 正则大全
3
+ * @see https://any-rule.vercel.app/
4
+ *
5
+ * 你需要的大部分规则可以通过上面的网站生成,然后复制粘贴到你的代码中。
6
+ */
7
+ export declare const USERNAME_REGEXP: RegExp;
8
+ export declare const ALPHA_NUMERIC_ONLY_REGEXP: RegExp;
9
+ /**
10
+ * @description 统一社会信用代码
11
+ * @see https://creditbj.jxj.beijing.gov.cn/credit-portal/credit_service/legal/search
12
+ *
13
+ * @example 91110105MA0071F38D, 91110105MADDCJMC8C, 91110101MABUT67T06
14
+ */
15
+ export declare const UNIFIED_SOCIAL_CREDIT_CODE_REGEXP: RegExp;
16
+ /**
17
+ * @description 手机号,只要是 1 开头即可
18
+ *
19
+ * @example 008618311006933, +8617888829981, 19119255642
20
+ */
21
+ export declare const MOBILE_PHONE_REGEXP: RegExp;
22
+ export declare const TELEPHONE_REGEXP: RegExp;
@@ -0,0 +1,80 @@
1
+ import type { TFunction } from "i18next";
2
+ export declare const FORM_REQUIRED: {
3
+ required: boolean;
4
+ }[];
5
+ /**
6
+ * 用户名规则验证函数
7
+ */
8
+ export declare function USERNAME_RULES(t: TFunction<"translation", undefined>): ({
9
+ required: boolean;
10
+ message: string;
11
+ pattern?: undefined;
12
+ } | {
13
+ pattern: RegExp;
14
+ message: string;
15
+ required?: undefined;
16
+ })[];
17
+ /**
18
+ * 密码规则验证函数
19
+ *
20
+ */
21
+ export declare function PASSWORD_RULES(t: TFunction<"translation", undefined>): ({
22
+ required: boolean;
23
+ message: string;
24
+ pattern?: undefined;
25
+ } | {
26
+ pattern: RegExp;
27
+ message: string;
28
+ required?: undefined;
29
+ })[];
30
+ /**
31
+ * 仅允许字母和数字的规则函数
32
+ *
33
+ */
34
+ export declare function ALPHA_NUMERIC_ONLY_RULES(t: TFunction<"translation", undefined>): ({
35
+ required: boolean;
36
+ message: string;
37
+ pattern?: undefined;
38
+ } | {
39
+ pattern: RegExp;
40
+ message: string;
41
+ required?: undefined;
42
+ })[];
43
+ /**
44
+ * 获取统一社会信用代码校验规则
45
+ *
46
+ */
47
+ export declare function UNIFIED_SOCIAL_CREDIT_CODE_RULES(t: TFunction<"translation", undefined>): ({
48
+ required: boolean;
49
+ message: string;
50
+ pattern?: undefined;
51
+ } | {
52
+ pattern: RegExp;
53
+ message: string;
54
+ required?: undefined;
55
+ })[];
56
+ /**
57
+ * 返回手机验证规则对象
58
+ *
59
+ */
60
+ export declare function MOBILE_PHONE_RULES(t: TFunction<"translation", undefined>): ({
61
+ required: boolean;
62
+ message: string;
63
+ pattern?: undefined;
64
+ } | {
65
+ pattern: RegExp;
66
+ message: string;
67
+ required?: undefined;
68
+ })[];
69
+ export declare function TELEPHONE_RULES(t: TFunction<"translation", undefined>): ({
70
+ required: boolean;
71
+ message: string;
72
+ pattern?: undefined;
73
+ } | {
74
+ pattern: RegExp;
75
+ message: string;
76
+ required?: undefined;
77
+ })[];
78
+ export declare function PHONE_RULE(t: TFunction<"translation", undefined>): {
79
+ validator: (_: unknown, value: string) => Promise<void>;
80
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 统一管理权限常量,避免在项目中到处写死字符串,便于维护。
3
+ */
4
+ /**
5
+ * 按钮权限前缀
6
+ */
7
+ export declare const permissionPrefix = "permission:button";
8
+ /**
9
+ * 常见按钮权限:
10
+ * - get: 获取
11
+ * - update: 更新
12
+ * - delete: 删除
13
+ * - add: 新增
14
+ */
15
+ export declare const accessControlCodes: {
16
+ get: string;
17
+ update: string;
18
+ delete: string;
19
+ add: string;
20
+ };
21
+ export declare const AccessControlRoles: {
22
+ admin: string;
23
+ common: string;
24
+ };
@@ -0,0 +1,9 @@
1
+ export * from "./constants";
2
+ /**
3
+ * @zh 权限判断
4
+ * @en Access judgment
5
+ */
6
+ export declare function useAccess(): {
7
+ hasAccessByCodes: (permission?: string | Array<string>) => boolean;
8
+ hasAccessByRoles: (roles?: string | Array<string>) => boolean;
9
+ };
@@ -0,0 +1,17 @@
1
+ export interface UseCssVarOptions {
2
+ initialValue?: string;
3
+ }
4
+ export interface UseCssVarProps {
5
+ name: `--${string}`;
6
+ root?: HTMLElement;
7
+ options?: UseCssVarOptions;
8
+ }
9
+ export interface CssVarControls {
10
+ set: (value: string) => void;
11
+ get: () => string;
12
+ remove: () => void;
13
+ }
14
+ /**
15
+ * @see https://soorria.com/snippets/use-css-var-react
16
+ */
17
+ export declare function useCssVar(name: `--${string}`, root?: HTMLElement, options?: UseCssVarOptions): CssVarControls;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 获取当前路由信息
3
+ *
4
+ * @returns 当前路由的匹配结果
5
+ */
6
+ export declare function useCurrentRoute(): import("react-router").UIMatch<unknown, import("../..").RouteMeta>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 判断当前设备类型(移动设备、iPad、PC 等)
3
+ *
4
+ */
5
+ export declare function useDeviceType(): {
6
+ isMobile: boolean;
7
+ isIpad: boolean;
8
+ isPC: boolean;
9
+ };
@@ -0,0 +1,5 @@
1
+ import type { LanguageType } from "../../locales/index";
2
+ export declare function useLanguage(): {
3
+ language: LanguageType;
4
+ setLanguage: (locale: LanguageType) => Promise<void>;
5
+ };
@@ -0,0 +1,6 @@
1
+ import type { PageLayoutType } from "../../store/preferences/types";
2
+ export declare function useLayoutMenu(): {
3
+ pageLayout: PageLayoutType;
4
+ setPageLayout: (value: PageLayoutType) => void;
5
+ layoutButtonTrigger: import("#node_modules/@types/react").JSX.Element;
6
+ };
@@ -0,0 +1,19 @@
1
+ import type { CSSProperties } from "react";
2
+ import type { VisibleDomRect } from "../../utils/dom/index";
3
+ /**
4
+ * @zh 获取布局内容区域的样式
5
+ * @en Get the style of the layout content area
6
+ */
7
+ export declare function useLayoutContentStyle(): {
8
+ contentElement: import("#node_modules/@types/react").RefObject<HTMLDivElement | null>;
9
+ overlayStyle: CSSProperties;
10
+ visibleDomRect: VisibleDomRect | null;
11
+ };
12
+ export declare function useLayoutHeaderStyle(): {
13
+ getLayoutHeaderHeight: () => number;
14
+ setLayoutHeaderHeight: (height: number) => void;
15
+ };
16
+ export declare function useLayoutFooterStyle(): {
17
+ getLayoutFooterHeight: () => number;
18
+ setLayoutFooterHeight: (height: number) => void;
19
+ };