@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
@@ -0,0 +1,343 @@
1
+ import type { TabPaneProps } from "antd";
2
+ /**
3
+ * @zh 标签页项目属性接口
4
+ * @en Tab item properties interface.
5
+ */
6
+ export interface TabItemProps extends Omit<TabPaneProps, "tab"> {
7
+ key: string;
8
+ label: React.ReactNode;
9
+ /**
10
+ * @zh 是否可拖拽
11
+ * @en Whether it can be dragged.
12
+ */
13
+ draggable?: boolean;
14
+ /**
15
+ * 可选的历史状态值,如 search 和 hash,可存储于此
16
+ * 在目标路由中可通过 useLocation 钩子访问该状态
17
+ * @see {@link https://reactrouter.com/en/main/hooks/use-navigate#optionsstate | usenavigate - options state}
18
+ */
19
+ historyState?: Record<string, any>;
20
+ }
21
+ export interface TabStateType extends Omit<TabItemProps, "label"> {
22
+ label: string;
23
+ /**
24
+ * @zh 标签页的新标题,用于修改标签页的标题
25
+ * @en The new title of the tab, used to modify the title of the tab.
26
+ */
27
+ newTabTitle?: React.ReactNode;
28
+ }
29
+ /**
30
+ * @zh 标签页的操作方法
31
+ * @en Tab operation methods.
32
+ */
33
+ interface TabsAction {
34
+ setIsRefresh: (state: boolean) => void;
35
+ addTab: (routePath: string, tabProps: TabStateType) => void;
36
+ insertBeforeTab: (routePath: string, tabProps: TabStateType) => void;
37
+ removeTab: (routePath: string) => void;
38
+ closeRightTabs: (routePath: string) => void;
39
+ closeLeftTabs: (routePath: string) => void;
40
+ closeOtherTabs: (routePath: string) => void;
41
+ closeAllTabs: () => void;
42
+ setActiveKey: (routePath: string) => void;
43
+ resetTabs: () => void;
44
+ changeTabOrder: (from: number, to: number) => void;
45
+ toggleMaximize: (state: boolean) => void;
46
+ setTableTitle: (routePath: string, title: string) => void;
47
+ resetTableTitle: (routePath: string) => void;
48
+ }
49
+ /**
50
+ * @zh 标签页状态管理
51
+ * @en Tab state management.
52
+ */
53
+ export declare const useTabsStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
54
+ /**
55
+ * @zh 标签页集合
56
+ * @en Tab collection.
57
+ */
58
+ openTabs: Map<string, TabStateType>;
59
+ /**
60
+ * @zh 当前激活的标签页
61
+ * @en The currently active tab.
62
+ */
63
+ activeKey: string;
64
+ /**
65
+ * @zh 标签页是否处于刷新状态
66
+ * @en Whether it is in a refresh state.
67
+ */
68
+ isRefresh: boolean;
69
+ /**
70
+ * @zh 标签页是否最大化
71
+ * @en Whether the tab is maximized.
72
+ */
73
+ isMaximize: boolean;
74
+ } & TabsAction>, "setState" | "persist"> & {
75
+ setState(partial: ({
76
+ /**
77
+ * @zh 标签页集合
78
+ * @en Tab collection.
79
+ */
80
+ openTabs: Map<string, TabStateType>;
81
+ /**
82
+ * @zh 当前激活的标签页
83
+ * @en The currently active tab.
84
+ */
85
+ activeKey: string;
86
+ /**
87
+ * @zh 标签页是否处于刷新状态
88
+ * @en Whether it is in a refresh state.
89
+ */
90
+ isRefresh: boolean;
91
+ /**
92
+ * @zh 标签页是否最大化
93
+ * @en Whether the tab is maximized.
94
+ */
95
+ isMaximize: boolean;
96
+ } & TabsAction) | Partial<{
97
+ /**
98
+ * @zh 标签页集合
99
+ * @en Tab collection.
100
+ */
101
+ openTabs: Map<string, TabStateType>;
102
+ /**
103
+ * @zh 当前激活的标签页
104
+ * @en The currently active tab.
105
+ */
106
+ activeKey: string;
107
+ /**
108
+ * @zh 标签页是否处于刷新状态
109
+ * @en Whether it is in a refresh state.
110
+ */
111
+ isRefresh: boolean;
112
+ /**
113
+ * @zh 标签页是否最大化
114
+ * @en Whether the tab is maximized.
115
+ */
116
+ isMaximize: boolean;
117
+ } & TabsAction> | ((state: {
118
+ /**
119
+ * @zh 标签页集合
120
+ * @en Tab collection.
121
+ */
122
+ openTabs: Map<string, TabStateType>;
123
+ /**
124
+ * @zh 当前激活的标签页
125
+ * @en The currently active tab.
126
+ */
127
+ activeKey: string;
128
+ /**
129
+ * @zh 标签页是否处于刷新状态
130
+ * @en Whether it is in a refresh state.
131
+ */
132
+ isRefresh: boolean;
133
+ /**
134
+ * @zh 标签页是否最大化
135
+ * @en Whether the tab is maximized.
136
+ */
137
+ isMaximize: boolean;
138
+ } & TabsAction) => ({
139
+ /**
140
+ * @zh 标签页集合
141
+ * @en Tab collection.
142
+ */
143
+ openTabs: Map<string, TabStateType>;
144
+ /**
145
+ * @zh 当前激活的标签页
146
+ * @en The currently active tab.
147
+ */
148
+ activeKey: string;
149
+ /**
150
+ * @zh 标签页是否处于刷新状态
151
+ * @en Whether it is in a refresh state.
152
+ */
153
+ isRefresh: boolean;
154
+ /**
155
+ * @zh 标签页是否最大化
156
+ * @en Whether the tab is maximized.
157
+ */
158
+ isMaximize: boolean;
159
+ } & TabsAction) | Partial<{
160
+ /**
161
+ * @zh 标签页集合
162
+ * @en Tab collection.
163
+ */
164
+ openTabs: Map<string, TabStateType>;
165
+ /**
166
+ * @zh 当前激活的标签页
167
+ * @en The currently active tab.
168
+ */
169
+ activeKey: string;
170
+ /**
171
+ * @zh 标签页是否处于刷新状态
172
+ * @en Whether it is in a refresh state.
173
+ */
174
+ isRefresh: boolean;
175
+ /**
176
+ * @zh 标签页是否最大化
177
+ * @en Whether the tab is maximized.
178
+ */
179
+ isMaximize: boolean;
180
+ } & TabsAction>), replace?: false | undefined): unknown;
181
+ setState(state: ({
182
+ /**
183
+ * @zh 标签页集合
184
+ * @en Tab collection.
185
+ */
186
+ openTabs: Map<string, TabStateType>;
187
+ /**
188
+ * @zh 当前激活的标签页
189
+ * @en The currently active tab.
190
+ */
191
+ activeKey: string;
192
+ /**
193
+ * @zh 标签页是否处于刷新状态
194
+ * @en Whether it is in a refresh state.
195
+ */
196
+ isRefresh: boolean;
197
+ /**
198
+ * @zh 标签页是否最大化
199
+ * @en Whether the tab is maximized.
200
+ */
201
+ isMaximize: boolean;
202
+ } & TabsAction) | ((state: {
203
+ /**
204
+ * @zh 标签页集合
205
+ * @en Tab collection.
206
+ */
207
+ openTabs: Map<string, TabStateType>;
208
+ /**
209
+ * @zh 当前激活的标签页
210
+ * @en The currently active tab.
211
+ */
212
+ activeKey: string;
213
+ /**
214
+ * @zh 标签页是否处于刷新状态
215
+ * @en Whether it is in a refresh state.
216
+ */
217
+ isRefresh: boolean;
218
+ /**
219
+ * @zh 标签页是否最大化
220
+ * @en Whether the tab is maximized.
221
+ */
222
+ isMaximize: boolean;
223
+ } & TabsAction) => {
224
+ /**
225
+ * @zh 标签页集合
226
+ * @en Tab collection.
227
+ */
228
+ openTabs: Map<string, TabStateType>;
229
+ /**
230
+ * @zh 当前激活的标签页
231
+ * @en The currently active tab.
232
+ */
233
+ activeKey: string;
234
+ /**
235
+ * @zh 标签页是否处于刷新状态
236
+ * @en Whether it is in a refresh state.
237
+ */
238
+ isRefresh: boolean;
239
+ /**
240
+ * @zh 标签页是否最大化
241
+ * @en Whether the tab is maximized.
242
+ */
243
+ isMaximize: boolean;
244
+ } & TabsAction), replace: true): unknown;
245
+ persist: {
246
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<{
247
+ /**
248
+ * @zh 标签页集合
249
+ * @en Tab collection.
250
+ */
251
+ openTabs: Map<string, TabStateType>;
252
+ /**
253
+ * @zh 当前激活的标签页
254
+ * @en The currently active tab.
255
+ */
256
+ activeKey: string;
257
+ /**
258
+ * @zh 标签页是否处于刷新状态
259
+ * @en Whether it is in a refresh state.
260
+ */
261
+ isRefresh: boolean;
262
+ /**
263
+ * @zh 标签页是否最大化
264
+ * @en Whether the tab is maximized.
265
+ */
266
+ isMaximize: boolean;
267
+ } & TabsAction, {
268
+ [k: string]: any;
269
+ }, unknown>>) => void;
270
+ clearStorage: () => void;
271
+ rehydrate: () => Promise<void> | void;
272
+ hasHydrated: () => boolean;
273
+ onHydrate: (fn: (state: {
274
+ /**
275
+ * @zh 标签页集合
276
+ * @en Tab collection.
277
+ */
278
+ openTabs: Map<string, TabStateType>;
279
+ /**
280
+ * @zh 当前激活的标签页
281
+ * @en The currently active tab.
282
+ */
283
+ activeKey: string;
284
+ /**
285
+ * @zh 标签页是否处于刷新状态
286
+ * @en Whether it is in a refresh state.
287
+ */
288
+ isRefresh: boolean;
289
+ /**
290
+ * @zh 标签页是否最大化
291
+ * @en Whether the tab is maximized.
292
+ */
293
+ isMaximize: boolean;
294
+ } & TabsAction) => void) => () => void;
295
+ onFinishHydration: (fn: (state: {
296
+ /**
297
+ * @zh 标签页集合
298
+ * @en Tab collection.
299
+ */
300
+ openTabs: Map<string, TabStateType>;
301
+ /**
302
+ * @zh 当前激活的标签页
303
+ * @en The currently active tab.
304
+ */
305
+ activeKey: string;
306
+ /**
307
+ * @zh 标签页是否处于刷新状态
308
+ * @en Whether it is in a refresh state.
309
+ */
310
+ isRefresh: boolean;
311
+ /**
312
+ * @zh 标签页是否最大化
313
+ * @en Whether the tab is maximized.
314
+ */
315
+ isMaximize: boolean;
316
+ } & TabsAction) => void) => () => void;
317
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<{
318
+ /**
319
+ * @zh 标签页集合
320
+ * @en Tab collection.
321
+ */
322
+ openTabs: Map<string, TabStateType>;
323
+ /**
324
+ * @zh 当前激活的标签页
325
+ * @en The currently active tab.
326
+ */
327
+ activeKey: string;
328
+ /**
329
+ * @zh 标签页是否处于刷新状态
330
+ * @en Whether it is in a refresh state.
331
+ */
332
+ isRefresh: boolean;
333
+ /**
334
+ * @zh 标签页是否最大化
335
+ * @en Whether the tab is maximized.
336
+ */
337
+ isMaximize: boolean;
338
+ } & TabsAction, {
339
+ [k: string]: any;
340
+ }, unknown>>;
341
+ };
342
+ }>;
343
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { UserInfoType } from "../api/user/types";
2
+ interface UserAction {
3
+ getUserInfo: () => Promise<UserInfoType>;
4
+ reset: () => void;
5
+ }
6
+ export declare const useUserStore: import("zustand").UseBoundStore<import("zustand").StoreApi<UserInfoType & UserAction>>;
7
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 构建时注入的应用元信息类型。
3
+ *
4
+ * 该对象由宿主在构建期通过 Vite `define` 注入为全局 `__APP_INFO__`,
5
+ * 框架内部**唯一**允许读取该全局的地方是 `getAppInfo()`(见 `utils/get-app-info`)。
6
+ * 模块工程应通过 `import { getAppInfo } from "@react-antd-module/runtime"` 获取,
7
+ * 不得直接依赖全局 `__APP_INFO__`,否则每个模块工程都要复制同样的 define 配置(设计文档 B9)。
8
+ */
9
+ export interface AppInfo {
10
+ pkg: {
11
+ name: string;
12
+ version: string;
13
+ license: string;
14
+ author: string;
15
+ dependencies: Record<string, string>;
16
+ };
17
+ lastBuildTime: string;
18
+ }
@@ -0,0 +1,2 @@
1
+ import type { ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,14 @@
1
+ export interface VisibleDomRect {
2
+ bottom: number;
3
+ height: number;
4
+ left: number;
5
+ right: number;
6
+ top: number;
7
+ width: number;
8
+ }
9
+ /**
10
+ * @zh 获取元素在可视区域的矩形
11
+ * @en Get the visible rectangle of an element in the viewport
12
+ * @param element
13
+ */
14
+ export declare function getElementVisibleRect(element?: HTMLElement | null | undefined): VisibleDomRect;
@@ -0,0 +1 @@
1
+ export declare function getAllExpandedKeys(data: any[], fieldName?: string): string[];
@@ -0,0 +1,13 @@
1
+ import type { AppInfo } from "../../types/app-info";
2
+ /**
3
+ * @zh 获取构建时注入的应用元信息(版本、依赖、构建时间等)。
4
+ * @en Get the app meta info injected at build time (version, dependencies, build time, ...).
5
+ *
6
+ * 以前各模块直接读取全局 `__APP_INFO__`(由 Vite `define` 注入),导致每个模块工程都要
7
+ * 复制同样的 define 配置(见设计文档 B9)。现统一通过本函数从框架获取,模块无需再依赖
8
+ * 全局注入;框架内部也只有这里读取该全局,避免散落多处的隐式耦合。
9
+ *
10
+ * @example
11
+ * const { version } = getAppInfo().pkg;
12
+ */
13
+ export declare function getAppInfo(): AppInfo;
@@ -0,0 +1 @@
1
+ export declare function getAppNamespace(name: string): string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * P6.4 / §4.8:iframe 链接守卫。
3
+ *
4
+ * iframeLink 来源不受信(后端路由、模块清单),无 scheme/域名白名单时
5
+ * 可注入 http 明文或任意第三方域。规则:
6
+ * 1. 仅接受 `https:`(`javascript:`/`data:` 等伪协议随之被拒);
7
+ * 2. host 必须命中白名单(允许其子域);
8
+ * 3. 不合规链接**拒绝渲染**(返回 null),不静默放行。
9
+ */
10
+ /**
11
+ * iframe 可嵌入的域名白名单;部署时按业务域增补后重建 runtime。
12
+ * 与 shell CSP frame-src 保持一致(tests/iframe-whitelist-consistency.test.ts 断言),
13
+ * 且必须覆盖仓库内全部 iframeLink 使用点(P7.4 修复:漏登 condorheroblog.github.io
14
+ * 曾导致「项目文档」嵌入页回归空白)。
15
+ */
16
+ export declare const IFRAME_ALLOWED_HOSTS: string[];
17
+ /** 校验并返回可安全渲染的链接;不合规返回 null(拒绝渲染) */
18
+ export declare function resolveSafeIframeLink(url: string): string | null;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * 判断给定的值是否为函数类型
3
+ * Determines whether the given value is of the function type
4
+ *
5
+ * @param value 给定的值 / The value to be checked
6
+ * @returns 如果给定的值是函数类型,则返回true;否则返回false / Returns true if the given value is a function type, otherwise returns false
7
+ */
8
+ export declare function isFunction(value: unknown): value is Function;
9
+ /**
10
+ * 判断给定的值是否为有限数字
11
+ * Determines whether the given value is a finite number
12
+ *
13
+ * @param value 待判断的值 / The value to be checked
14
+ * @returns 如果给定的值是有限数字,则返回true;否则返回false / Returns true if the given value is a finite number, otherwise returns false
15
+ */
16
+ export declare function isNumber(value: unknown): boolean;
17
+ /**
18
+ * 判断一个值是否为字符串类型
19
+ * Determines whether a value is of the string type
20
+ *
21
+ * @param value 待判断的值 / The value to be checked
22
+ * @returns 返回布尔值,表示该值是否为字符串类型 / Returns a boolean value indicating whether the value is of the string type
23
+ */
24
+ export declare function isString(value: unknown): value is string;
25
+ /**
26
+ * 判断给定的值是否为布尔值
27
+ * Determines whether the given value is a boolean value
28
+ *
29
+ * @param value 待判断的值 / The value to be checked
30
+ * @returns 如果给定的值是布尔值,则返回true;否则返回false / Returns true if the given value is a boolean value, otherwise returns false
31
+ */
32
+ export declare function isBoolean(value: unknown): value is boolean;
33
+ /**
34
+ * 判断一个值是否为对象类型(排除null)
35
+ * Determines whether a value is of the object type (excluding null)
36
+ *
37
+ * @param value 待判断的值 / The value to be checked
38
+ * @returns 返回布尔值,表示是否为对象类型 / Returns a boolean value indicating whether the value is of the object type
39
+ */
40
+ export declare function isObject(value: unknown): value is object;
41
+ /**
42
+ * 判断一个值是否为 null
43
+ * Determines whether a value is null
44
+ *
45
+ * @param value 待判断的值 / The value to be checked
46
+ * @returns 如果值为 null,则返回 true;否则返回 false / Returns true if the value is null, otherwise returns false
47
+ */
48
+ export declare function isNull(value: unknown): value is null;
49
+ /**
50
+ * 判断一个值是否为 undefined
51
+ * Determines whether a value is undefined
52
+ *
53
+ * @param value 待判断的值 / The value to be checked
54
+ * @returns 如果值为 undefined,则返回 true;否则返回 false / Returns true if the value is undefined, otherwise returns false
55
+ */
56
+ export declare function isUndefined(value: unknown): value is undefined;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 判断当前主题是否为深色主题
3
+ *
4
+ * @param theme 主题名称,可选值为 'dark'、'light' 或 'auto'
5
+ * @returns 如果当前主题为深色主题,则返回 true;否则返回 false
6
+ */
7
+ export declare function isDarkTheme(theme: string): boolean;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 判断当前主题是否为浅色主题
3
+ *
4
+ * @param theme 主题名称,可以是 "light"(浅色)、"dark"(深色)或 "auto"(自动)
5
+ * @returns 如果当前主题为浅色主题,则返回 true;否则返回 false
6
+ */
7
+ export declare function isLightTheme(theme: string): boolean;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 检查当前运行环境是否为 Windows OS。
3
+ *
4
+ * 通过检查 navigator.userAgent 字符串来判断当前运行环境。
5
+ */
6
+ export declare function isWindowsOs(): boolean;
@@ -0,0 +1,3 @@
1
+ import NProgress from "nprogress";
2
+ import "nprogress/nprogress.css";
3
+ export { NProgress };
@@ -0,0 +1 @@
1
+ export declare function rememberRoute(): string;
@@ -0,0 +1,4 @@
1
+ export declare const AUTH_HEADER = "Authorization";
2
+ export declare const LANG_HEADER = "X-Lang";
3
+ export declare const APP_NAME_HEADER = "X-App-Name";
4
+ export declare const REFRESH_TOKEN_PATH = "auth/refresh";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 处理错误响应
3
+ *
4
+ * 错误体不保证是 JSON(ram dev 404 纯文本、网关 502 HTML 都是常态),
5
+ * 故对齐 ky 自家的 text-first 模式:先取文本再显式 JSON.parse,
6
+ * 解析不出对象就静默回退状态文本——非 JSON 不再当异常刷 console.error。
7
+ * 经 clone 读取,保持原 body 对下游(ky .json() 链)可读。
8
+ *
9
+ * @param response 响应对象
10
+ * @returns 响应对象
11
+ */
12
+ export declare function handleErrorResponse(response: Response): Promise<Response>;
@@ -0,0 +1,21 @@
1
+ export declare const globalProgress: {
2
+ /**
3
+ * 启动请求
4
+ *
5
+ * 如果请求计数为 0,则显示全局加载动画,并将请求计数加 1。
6
+ */
7
+ start(): void;
8
+ /**
9
+ * 请求完成后的回调函数
10
+ *
11
+ * @description 将请求计数减 1,并保证请求计数不会小于 0;
12
+ * 如果请求计数为 0,则隐藏全局加载动画
13
+ */
14
+ done(): void;
15
+ /**
16
+ * 强制完成请求
17
+ *
18
+ * 将请求计数直接设置为0,并隐藏全局加载动画
19
+ */
20
+ forceFinish(): void;
21
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 跳转到登录页面
3
+ *
4
+ * @returns 无返回值
5
+ */
6
+ export declare function goLogin(): void;
@@ -0,0 +1 @@
1
+ export declare const request: import("ky").KyInstance;
@@ -0,0 +1,11 @@
1
+ import type { KyResponse, Options } from "ky";
2
+ /**
3
+ * 刷新token并重新发起请求
4
+ *
5
+ * @param request 请求对象
6
+ * @param options 请求选项
7
+ * @param refreshToken 刷新token
8
+ * @returns 响应对象
9
+ * @throws 刷新 token 失败时抛出异常
10
+ */
11
+ export declare function refreshTokenAndRetry(request: Request, options: Options, refreshToken: string): Promise<KyResponse<unknown>>;
@@ -0,0 +1,17 @@
1
+ import { request } from "./index";
2
+ /**
3
+ * P6.3 / D11:模块专用 scoped request client。
4
+ *
5
+ * 模块不再拿到全局 request——它以模块登记的 apiPrefix 为边界收敛:
6
+ * 请求 URL 必须以 `ctx.register.apiPrefix()` 声明的前缀开头,越界直接
7
+ * 拒绝(人话报错)。前缀读取是惰性的(每次请求时求值),因此允许模块
8
+ * 在生命周期中先发请求前登记、甚至重新登记。
9
+ *
10
+ * 这是纵深防御的前端一半;后端逐接口鉴权仍是安全兜底(§4.8 授权行)。
11
+ */
12
+ type GlobalRequest = typeof request;
13
+ /** 仅暴露安全子集:callable + HTTP verb 工厂;不给 create/extend(可绕过 hooks) */
14
+ export declare function createScopedRequest(moduleName: string, getPrefix: () => string | undefined,
15
+ /** 注入底层实例,测试用 */
16
+ underlying?: GlobalRequest): GlobalRequest;
17
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { MessageInstance } from "antd/es/message/interface";
2
+ import type { ModalStaticFunctions } from "antd/es/modal/confirm";
3
+ import type { NotificationInstance } from "antd/es/notification/interface";
4
+ declare let message: MessageInstance;
5
+ declare let notification: NotificationInstance;
6
+ declare let modal: Omit<ModalStaticFunctions, "warn">;
7
+ /**
8
+ * @see https://ant.design/components/app
9
+ * @see https://ant.design/docs/blog/why-not-static
10
+ */
11
+ export declare function StaticAntd(): null;
12
+ export { message, modal, notification, };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Toggle html class
3
+ *
4
+ * @param className
5
+ */
6
+ export declare function toggleHtmlClass(className: string): {
7
+ add: () => void;
8
+ remove: () => void;
9
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @description 构造树型结构数据
3
+ * @param data 数据源
4
+ * @param id id字段 默认id
5
+ * @param parentId 父节点字段,默认parentId
6
+ * @param children 子节点字段,默认children
7
+ * @returns 追加字段后的树
8
+ */
9
+ export declare function handleTree(data: any[], id?: string, parentId?: string, children?: string): any;
10
+ export interface TreeConfigOptions {
11
+ childProps: string;
12
+ }
13
+ /**
14
+ * @zh_CN 遍历树形结构,并返回所有节点中指定的值。
15
+ * @param tree 树形结构数组
16
+ * @param getValue 获取节点值的函数
17
+ * @param options 作为子节点数组的可选属性名称。
18
+ * @returns 所有节点中指定的值的数组
19
+ */
20
+ export declare function traverseTreeValues<T, V>(tree: T[], getValue: (node: T) => V, options?: TreeConfigOptions): V[];
21
+ /**
22
+ * 根据条件过滤给定树结构的节点,并以原有顺序返回所有匹配节点的数组。
23
+ * @param tree 要过滤的树结构的根节点数组。
24
+ * @param filter 用于匹配每个节点的条件。
25
+ * @param options 作为子节点数组的可选属性名称。
26
+ * @returns 包含所有匹配节点的数组。
27
+ */
28
+ export declare function filterTree<T extends Record<string, any>>(tree: T[], filter: (node: T) => boolean, options?: TreeConfigOptions): T[];
29
+ /**
30
+ * 根据条件重新映射给定树结构的节点
31
+ * @param tree 要过滤的树结构的根节点数组。
32
+ * @param mapper 用于map每个节点的条件。
33
+ * @param options 作为子节点数组的可选属性名称。
34
+ */
35
+ export declare function mapTree<T, V extends Record<string, any>>(tree: T[], mapper: (node: T) => V, options?: TreeConfigOptions): V[];