@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.
- package/LICENSE +21 -0
- package/README.md +119 -0
- package/dist/api/home.d.ts +10 -0
- package/dist/api/notifications/index.d.ts +2 -0
- package/dist/api/system/menu/index.d.ts +6 -0
- package/dist/api/system/menu/types.d.ts +19 -0
- package/dist/api/system/role/index.d.ts +10 -0
- package/dist/api/system/role/types.d.ts +9 -0
- package/dist/api/user/index.d.ts +16 -0
- package/dist/api/user/types.d.ts +26 -0
- package/dist/components/access-control/index.d.ts +15 -0
- package/dist/components/basic-button/index.d.ts +7 -0
- package/dist/components/basic-content/index.d.ts +7 -0
- package/dist/components/basic-form/form-items/form-avatar-item.d.ts +6 -0
- package/dist/components/basic-form/form-items/form-tree-item.d.ts +13 -0
- package/dist/components/basic-form/form-items/index.d.ts +2 -0
- package/dist/components/basic-form/index.d.ts +1 -0
- package/dist/components/basic-table/constants.d.ts +1 -0
- package/dist/components/basic-table/index.d.ts +12 -0
- package/dist/components/basic-table/styles.d.ts +6 -0
- package/dist/components/exception-page/index.d.ts +3 -0
- package/dist/components/fullscreen-button/index.d.ts +17 -0
- package/dist/components/global-spin/index.d.ts +6 -0
- package/dist/components/iframe/index.d.ts +1 -0
- package/dist/components/jss-theme-provider/index.d.ts +26 -0
- package/dist/components/not-found/index.d.ts +6 -0
- package/dist/components/page-error/index.d.ts +2 -0
- package/dist/components/scrollbar/index.d.ts +7 -0
- package/dist/components/unknown-component/index.d.ts +6 -0
- package/dist/constants/options.d.ts +9 -0
- package/dist/constants/regular-expressions.d.ts +22 -0
- package/dist/constants/rules.d.ts +80 -0
- package/dist/hooks/use-access/constants.d.ts +24 -0
- package/dist/hooks/use-access/index.d.ts +9 -0
- package/dist/hooks/use-css-var/index.d.ts +17 -0
- package/dist/hooks/use-current-route/index.d.ts +6 -0
- package/dist/hooks/use-device-type/index.d.ts +9 -0
- package/dist/hooks/use-language/index.d.ts +5 -0
- package/dist/hooks/use-layout-menu/index.d.ts +6 -0
- package/dist/hooks/use-layout-style/index.d.ts +19 -0
- package/dist/hooks/use-preferences/index.d.ts +61 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/icons/local-icons.d.ts +17 -0
- package/dist/icons/menu-icons.d.ts +4 -0
- package/dist/icons/ri.d.ts +14 -0
- package/dist/icons/types.d.ts +9 -0
- package/dist/index.d.ts +41 -0
- package/dist/layout/constants.d.ts +50 -0
- package/dist/layout/container-layout/index.d.ts +11 -0
- package/dist/layout/hooks/index.d.ts +1 -0
- package/dist/layout/hooks/use-layout.d.ts +20 -0
- package/dist/layout/keep-alive-layer/index.d.ts +15 -0
- package/dist/layout/layout-content/index.d.ts +3 -0
- package/dist/layout/layout-effects/index.d.ts +9 -0
- package/dist/layout/layout-footer/index.d.ts +5 -0
- package/dist/layout/layout-header/components/fullscreen-button.d.ts +2 -0
- package/dist/layout/layout-header/components/language-button.d.ts +2 -0
- package/dist/layout/layout-header/components/theme-button.d.ts +9 -0
- package/dist/layout/layout-header/components/user-menu.d.ts +2 -0
- package/dist/layout/layout-header/index.d.ts +5 -0
- package/dist/layout/layout-menu/index.d.ts +17 -0
- package/dist/layout/layout-menu/style.d.ts +6 -0
- package/dist/layout/layout-menu/types.d.ts +26 -0
- package/dist/layout/layout-menu/use-menu.d.ts +7 -0
- package/dist/layout/layout-menu/utils.d.ts +49 -0
- package/dist/layout/layout-mixed-sidebar/first-column-menu.d.ts +9 -0
- package/dist/layout/layout-mixed-sidebar/index.d.ts +14 -0
- package/dist/layout/layout-mobile-menu/index.d.ts +1 -0
- package/dist/layout/layout-root/index.d.ts +5 -0
- package/dist/layout/layout-sidebar/index.d.ts +5 -0
- package/dist/layout/layout-tabbar/components/draggable-tab-bar.d.ts +16 -0
- package/dist/layout/layout-tabbar/components/tab-maximize.d.ts +10 -0
- package/dist/layout/layout-tabbar/components/tab-options.d.ts +17 -0
- package/dist/layout/layout-tabbar/hooks/use-dropdown-menu.d.ts +26 -0
- package/dist/layout/layout-tabbar/index.d.ts +5 -0
- package/dist/layout/layout-tabbar/style.d.ts +6 -0
- package/dist/layout/parent-layout/index.d.ts +1 -0
- package/dist/layout/widgets/breadcrumb-views/index.d.ts +1 -0
- package/dist/layout/widgets/global-search/components/search-footer.d.ts +5 -0
- package/dist/layout/widgets/global-search/components/search-panel.d.ts +11 -0
- package/dist/layout/widgets/global-search/index.d.ts +1 -0
- package/dist/layout/widgets/logo/index.d.ts +9 -0
- package/dist/layout/widgets/notification/index.d.ts +19 -0
- package/dist/layout/widgets/notification/notification-container.d.ts +2 -0
- package/dist/layout/widgets/notification/types.d.ts +7 -0
- package/dist/layout/widgets/preferences/blocks/animation/index.d.ts +1 -0
- package/dist/layout/widgets/preferences/blocks/footer/index.d.ts +1 -0
- package/dist/layout/widgets/preferences/blocks/general/index.d.ts +1 -0
- package/dist/layout/widgets/preferences/blocks/general/utils.d.ts +1 -0
- package/dist/layout/widgets/preferences/blocks/index.d.ts +7 -0
- package/dist/layout/widgets/preferences/blocks/layout/constants.d.ts +4 -0
- package/dist/layout/widgets/preferences/blocks/layout/index.d.ts +1 -0
- package/dist/layout/widgets/preferences/blocks/sidebar/index.d.ts +1 -0
- package/dist/layout/widgets/preferences/blocks/tabbar/index.d.ts +1 -0
- package/dist/layout/widgets/preferences/blocks/theme/builtin.d.ts +1 -0
- package/dist/layout/widgets/preferences/blocks/theme/index.d.ts +2 -0
- package/dist/layout/widgets/preferences/blocks/theme/theme.d.ts +1 -0
- package/dist/layout/widgets/preferences/index.d.ts +2 -0
- package/dist/layout/widgets/preferences/number-input-spinner.d.ts +10 -0
- package/dist/layout/widgets/preferences/select-item.d.ts +9 -0
- package/dist/layout/widgets/preferences/switch-item.d.ts +8 -0
- package/dist/layout/widgets/preferences/text-input.d.ts +8 -0
- package/dist/layout/widgets/sider-trigger/index.d.ts +5 -0
- package/dist/locales/helper.d.ts +15 -0
- package/dist/locales/index.d.ts +18 -0
- package/dist/locales/t.d.ts +10 -0
- package/dist/module-loader/define-module.d.ts +11 -0
- package/dist/module-loader/index.d.ts +20 -0
- package/dist/module-loader/keep-alive.d.ts +18 -0
- package/dist/module-loader/semver.d.ts +8 -0
- package/dist/module-loader/slots.d.ts +9 -0
- package/dist/module-loader/types.d.ts +81 -0
- package/dist/pages/login/components/code-login.d.ts +7 -0
- package/dist/pages/login/components/forgot-password.d.ts +6 -0
- package/dist/pages/login/components/password-login.d.ts +1 -0
- package/dist/pages/login/components/register-password.d.ts +8 -0
- package/dist/pages/login/constants.d.ts +6 -0
- package/dist/pages/login/form-mode-context.d.ts +5 -0
- package/dist/pages/login/index.d.ts +1 -0
- package/dist/plugins/hide-loading.d.ts +1 -0
- package/dist/plugins/loading.d.ts +7 -0
- package/dist/router/constants.d.ts +1 -0
- package/dist/router/extra-info/index.d.ts +1 -0
- package/dist/router/extra-info/route-path.d.ts +12 -0
- package/dist/router/guard/auth-guard.d.ts +21 -0
- package/dist/router/guard/index.d.ts +1 -0
- package/dist/router/guard/utils.d.ts +2 -0
- package/dist/router/index.d.ts +12 -0
- package/dist/router/routes/config.d.ts +7 -0
- package/dist/router/routes/core/auth.d.ts +3 -0
- package/dist/router/routes/core/exception.d.ts +12 -0
- package/dist/router/routes/core/fallback.d.ts +3 -0
- package/dist/router/routes/core/index.d.ts +2 -0
- package/dist/router/routes/index.d.ts +114 -0
- package/dist/router/types.d.ts +79 -0
- package/dist/router/utils/add-route-id-by-path.d.ts +81 -0
- package/dist/router/utils/ascending.d.ts +95 -0
- package/dist/router/utils/flatten-routes.d.ts +5 -0
- package/dist/router/utils/generate-menu-items-from-routes.d.ts +10 -0
- package/dist/router/utils/generate-routes-from-backend.d.ts +79 -0
- package/dist/router/utils/generate-routes-from-frontend.d.ts +5 -0
- package/dist/router/utils/merge-route-modules.d.ts +2 -0
- package/dist/router/utils/remove-trailing-slash.d.ts +10 -0
- package/dist/router/utils/resolve-layout.d.ts +21 -0
- package/dist/runtime.js +9179 -0
- package/dist/store/access.d.ts +14 -0
- package/dist/store/auth.d.ts +20 -0
- package/dist/store/global.d.ts +12 -0
- package/dist/store/preferences/index.d.ts +80 -0
- package/dist/store/preferences/types.d.ts +254 -0
- package/dist/store/tabs.d.ts +343 -0
- package/dist/store/user.d.ts +7 -0
- package/dist/types/app-info.d.ts +18 -0
- package/dist/utils/cn/index.d.ts +2 -0
- package/dist/utils/dom/index.d.ts +14 -0
- package/dist/utils/get-all-expanded-keys/index.d.ts +1 -0
- package/dist/utils/get-app-info/index.d.ts +13 -0
- package/dist/utils/get-app-namespace/index.d.ts +1 -0
- package/dist/utils/iframe-guard.d.ts +18 -0
- package/dist/utils/is/index.d.ts +56 -0
- package/dist/utils/is-dark-theme/index.d.ts +7 -0
- package/dist/utils/is-light-theme/index.d.ts +7 -0
- package/dist/utils/is-windows-os/index.d.ts +6 -0
- package/dist/utils/progress/index.d.ts +3 -0
- package/dist/utils/remember-route/index.d.ts +1 -0
- package/dist/utils/request/constants.d.ts +4 -0
- package/dist/utils/request/error-response.d.ts +12 -0
- package/dist/utils/request/global-progress.d.ts +21 -0
- package/dist/utils/request/go-login.d.ts +6 -0
- package/dist/utils/request/index.d.ts +1 -0
- package/dist/utils/request/refresh.d.ts +11 -0
- package/dist/utils/request/scoped.d.ts +17 -0
- package/dist/utils/static-antd/index.d.ts +12 -0
- package/dist/utils/toggle-html-class/index.d.ts +9 -0
- package/dist/utils/tree/index.d.ts +35 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PreferencesFooter(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function General(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getLanguageItems: () => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PreferencesLayout(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Sidebar(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Tabbar(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function BuiltinTheme(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SiteTheme(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface NumberInputSpinnerProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
name: string;
|
|
4
|
+
min: number;
|
|
5
|
+
max: number;
|
|
6
|
+
value?: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onChange?: (a: string, b: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function NumberInputSpinner({ children, disabled, value, name, onChange, min, max, }: NumberInputSpinnerProps): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SelectProps } from "antd";
|
|
2
|
+
export interface SelectItemProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
name: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
items: SelectProps["options"];
|
|
8
|
+
}
|
|
9
|
+
export declare function SelectItem({ children, items, disabled, value, name }: SelectItemProps): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SwitchProps } from "antd";
|
|
2
|
+
export interface SwitchItemProps extends Omit<SwitchProps, "onChange"> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
name: string;
|
|
5
|
+
onChange?: (a: string, b: unknown) => void;
|
|
6
|
+
tooltip?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function SwitchItem({ tooltip, children, disabled, checked, name, onChange, ...restProps }: SwitchItemProps): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface TextInputProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
name: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onChange?: (name: string, value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function TextInput({ children, disabled, value, name, onChange, }: TextInputProps): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 通用的语言模块映射类型,表示可以嵌套的对象结构
|
|
3
|
+
*
|
|
4
|
+
* 导出供 i18nResources 的声明生成引用(P3.5 / TS4023:未导出类型会阻断 d.ts)
|
|
5
|
+
*/
|
|
6
|
+
export interface LanguageModule<T> {
|
|
7
|
+
[key: string]: T | any;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 语言文件的参数类型,用于描述导入的语言文件集合
|
|
11
|
+
*/
|
|
12
|
+
export type LanguageFileMap = Record<string, LanguageModule<LanguageFileMap>>;
|
|
13
|
+
export declare function getZhCnLang(): LanguageModule<LanguageFileMap>;
|
|
14
|
+
export declare function getEnUsLang(): LanguageModule<LanguageFileMap>;
|
|
15
|
+
export declare function organizeLanguageFiles(files: LanguageFileMap): LanguageModule<LanguageFileMap>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InitOptions } from "i18next";
|
|
2
|
+
export * from "./t";
|
|
3
|
+
export type LanguageType = "zh-CN" | "en-US";
|
|
4
|
+
export declare const ANT_DESIGN_LOCALE: {
|
|
5
|
+
"zh-CN": import("antd/lib/locale").Locale;
|
|
6
|
+
"en-US": import("antd/lib/locale").Locale;
|
|
7
|
+
};
|
|
8
|
+
export declare const i18nResources: {
|
|
9
|
+
"zh-CN": {
|
|
10
|
+
translation: import("./helper").LanguageModule<import("./helper").LanguageFileMap>;
|
|
11
|
+
};
|
|
12
|
+
"en-US": {
|
|
13
|
+
translation: import("./helper").LanguageModule<import("./helper").LanguageFileMap>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const i18nInitOptions: InitOptions;
|
|
17
|
+
export declare const i18n: import("i18next").i18n;
|
|
18
|
+
export declare function setupI18n(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh 此函数没有任何意义,仅用于对 lokalise.i18n-ally 插件获取更好良好的语言提示支持。
|
|
3
|
+
* @en This function has no practical meaning; it is only used to obtain better language prompt support for the lokalise.i18n-ally plugin.
|
|
4
|
+
*
|
|
5
|
+
* @link https://github.com/i18next/react-i18next/issues/1058
|
|
6
|
+
* @zh 官方不推荐在纯 JS 或者 TS 文件场景下如何使用 react-i18next,且目前没有较好的解决方案。
|
|
7
|
+
* @en The official recommendation does not cover how to use react-i18next in pure JS or TS file scenarios, and there is currently no good solution.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare function $t(path: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ModuleDefinition } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* 声明一个模块。
|
|
4
|
+
*
|
|
5
|
+
* 目前只做类型收窄,但它是模块契约的**唯一入口**:
|
|
6
|
+
* - 编译期:收窄 entry.ts 的导出类型,字段名写错会直接报错
|
|
7
|
+
* - 构建期:CLI 用 esbuild bundle + 真实 import() 解析出 name / version
|
|
8
|
+
* (packages/cli/src/build.ts 的 readModuleDefinition),
|
|
9
|
+
* 替代 `scripts/build-modules.ts` 里脆弱的正则(B10)
|
|
10
|
+
*/
|
|
11
|
+
export declare function defineModule(definition: ModuleDefinition): ModuleDefinition;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AppRouteRecordRaw } from "../router/types";
|
|
2
|
+
import type { Manifest, ModuleInstance } from "./types";
|
|
3
|
+
export declare function loadAll(manifest: Manifest): Promise<ModuleInstance[]>;
|
|
4
|
+
export declare function getModules(): ModuleInstance[];
|
|
5
|
+
export declare function getModule(name: string): ModuleInstance | undefined;
|
|
6
|
+
export declare function getRoutes(): AppRouteRecordRaw[];
|
|
7
|
+
export declare function getRegisteredStore<T = unknown>(name: string): T | undefined;
|
|
8
|
+
export declare function getRegisteredApiPrefix(moduleName: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* 卸载模块:执行 onDestroy 生命周期 → 清理其布局插槽(US-8)→ 移除实例。
|
|
11
|
+
* 供运维下线单个模块使用,其余模块不受影响。
|
|
12
|
+
*/
|
|
13
|
+
export declare function unloadModule(name: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* KeepAlive exclude key:各模块路由中 `handle.keepAlive === false` 的路径集合。
|
|
16
|
+
* 由 module-loader 汇总,不再依赖 access store 的 flatRouteList(B13)。
|
|
17
|
+
*/
|
|
18
|
+
export declare function getKeepAliveExcludeKeys(): string[];
|
|
19
|
+
/** 全部路由 key:关闭多 tab 时整体排除,仅保留切换动画 */
|
|
20
|
+
export declare function getAllRoutePathKeys(): string[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AppRouteRecordRaw } from "../router/types";
|
|
2
|
+
import type { ModuleDefinition } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* 纯函数:从一组路由中收集 `handle.keepAlive === false` 的路由 key。
|
|
5
|
+
* key 与 `flattenRoutes` 产出的键一致,从而能和 KeepAlive 的 `activeCacheKey`
|
|
6
|
+
* (= pathname)精确匹配。
|
|
7
|
+
*
|
|
8
|
+
* 这是 P2.1 把 exclude 计算从 access store 的 `flatRouteList` 反转到
|
|
9
|
+
* module-loader 的核心:缓存是否排除只取决于「模块声明」,不再依赖某条路由
|
|
10
|
+
* 是否套了 ContainerLayout(见设计文档 B13 / R9)。
|
|
11
|
+
*/
|
|
12
|
+
export declare function collectKeepAliveExcludes(routes: AppRouteRecordRaw[]): string[];
|
|
13
|
+
/** 纯函数:收集所有路由 key(关闭多 tab 时用于整体排除,仅保留切换动画) */
|
|
14
|
+
export declare function collectAllRoutePaths(routes: AppRouteRecordRaw[]): string[];
|
|
15
|
+
/** 基于一组模块定义计算 exclude key(供单元测试) */
|
|
16
|
+
export declare function getKeepAliveExcludes(definitions: ModuleDefinition[]): string[];
|
|
17
|
+
/** 基于一组模块定义计算全部路由 key(供单元测试) */
|
|
18
|
+
export declare function getAllRoutePaths(definitions: ModuleDefinition[]): string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P7.6:最小 semver 范围判定,覆盖 CLI 产出的 peerRuntime 形态子集:
|
|
3
|
+
* 精确版、"^x.y.z"、"~x.y.z"、">=a <b" 空格合取、"*"。
|
|
4
|
+
* 不追求完整 semver 规范——超纲形态一律返回 false(拒绝加载并显式报错,
|
|
5
|
+
* 比静默放行安全)。
|
|
6
|
+
*/
|
|
7
|
+
/** version 是否满足 range(空格分隔的多个比较符为合取) */
|
|
8
|
+
export declare function satisfiesSemver(version: string, range: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** 供模块上下文调用:注册/覆盖本模块在某插槽上的节点 */
|
|
3
|
+
export declare function registerSlot(moduleName: string, slotName: string, node: ReactNode): void;
|
|
4
|
+
/** 模块卸载时清理其注册的全部插槽节点 */
|
|
5
|
+
export declare function removeModuleSlots(moduleName: string): void;
|
|
6
|
+
/** 纯读:某插槽当前挂载的全部节点(注册顺序即 Object 值序) */
|
|
7
|
+
export declare function getSlotNodes(slotName: string): ReactNode[];
|
|
8
|
+
/** 布局组件订阅:插槽节点变化(注册/卸载)时触发重渲染 */
|
|
9
|
+
export declare function useSlotNodes(slotName: string): ReactNode[];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { AppRouteRecordRaw } from "../router/types";
|
|
2
|
+
/** 模块上下文 — 主框架向模块注入的能力 */
|
|
3
|
+
export interface ModuleContext {
|
|
4
|
+
/** 当前模块的元信息 */
|
|
5
|
+
module: {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
/** 主框架工具 */
|
|
10
|
+
utils: {
|
|
11
|
+
request: typeof import("../utils/request/index").request;
|
|
12
|
+
};
|
|
13
|
+
/** 模块注册器 */
|
|
14
|
+
register: {
|
|
15
|
+
/** 注册额外的 Zustand store */
|
|
16
|
+
store: (name: string, store: unknown) => void;
|
|
17
|
+
/** 注册 API 路由前缀 */
|
|
18
|
+
apiPrefix: (prefix: string) => void;
|
|
19
|
+
};
|
|
20
|
+
/** 注册布局插槽节点(US-8 L2),卸载模块时自动清理 */
|
|
21
|
+
registerSlot: (slotName: string, node: React.ReactNode) => void;
|
|
22
|
+
}
|
|
23
|
+
/** 模块配置 */
|
|
24
|
+
export interface ModuleConfig {
|
|
25
|
+
/** 模块级别要求的角色,用户须满足其一才能激活此模块 */
|
|
26
|
+
requiredRoles?: string[];
|
|
27
|
+
/** 模块级别要求的权限码,用户须全部满足才能激活此模块 */
|
|
28
|
+
requiredPermissions?: string[];
|
|
29
|
+
/** 依赖的其他模块 name 列表,须在 beforeInit 之前完成加载 */
|
|
30
|
+
dependencies?: string[];
|
|
31
|
+
}
|
|
32
|
+
/** 生命周期钩子 */
|
|
33
|
+
export interface ModuleLifecycle {
|
|
34
|
+
beforeInit?: (ctx: ModuleContext) => Promise<void>;
|
|
35
|
+
onInit?: (ctx: ModuleContext) => Promise<void>;
|
|
36
|
+
onActivate?: (ctx: ModuleContext) => Promise<void>;
|
|
37
|
+
onDeactivate?: (ctx: ModuleContext) => Promise<void>;
|
|
38
|
+
onDestroy?: (ctx: ModuleContext) => Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
/** i18n 资源声明 */
|
|
41
|
+
export interface ModuleI18n {
|
|
42
|
+
[locale: string]: () => Promise<Record<string, unknown>>;
|
|
43
|
+
}
|
|
44
|
+
/** 模块定义 — entry.ts 的导出类型 */
|
|
45
|
+
export interface ModuleDefinition {
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
version: string;
|
|
49
|
+
routes: AppRouteRecordRaw[];
|
|
50
|
+
lifecycle?: ModuleLifecycle;
|
|
51
|
+
i18n?: ModuleI18n;
|
|
52
|
+
config?: ModuleConfig;
|
|
53
|
+
/** 兼容的宿主 runtime 版本(semver 范围),宿主加载前校验,不兼容则拒绝加载并显式报错 */
|
|
54
|
+
peerRuntime?: string;
|
|
55
|
+
}
|
|
56
|
+
/** 运行时模块实例 */
|
|
57
|
+
export interface ModuleInstance {
|
|
58
|
+
definition: ModuleDefinition;
|
|
59
|
+
/** missing-deps:声明的依赖模块缺失或加载失败,本模块未执行生命周期(US-9 禁止半加载) */
|
|
60
|
+
status: "pending" | "loading" | "loaded" | "active" | "error" | "missing-deps";
|
|
61
|
+
error?: Error;
|
|
62
|
+
}
|
|
63
|
+
/** manifest.json 中的模块条目 */
|
|
64
|
+
export interface ManifestModuleEntry {
|
|
65
|
+
/** 模块名称,需与 entry.ts 中 name 一致 */
|
|
66
|
+
name: string;
|
|
67
|
+
/** 模块资源路径(本地相对路径或远程 URL) */
|
|
68
|
+
entry: string;
|
|
69
|
+
/** 是否启用 */
|
|
70
|
+
enabled?: boolean;
|
|
71
|
+
/** 依赖的其他模块 name 列表(清单层冗余声明,供运维观测) */
|
|
72
|
+
dependencies?: string[];
|
|
73
|
+
/** 兼容的宿主 runtime 版本(semver 范围),P7.6 起在加载后即刻校验 */
|
|
74
|
+
peerRuntime?: string;
|
|
75
|
+
}
|
|
76
|
+
/** manifest.json 格式 */
|
|
77
|
+
export interface Manifest {
|
|
78
|
+
modules: ManifestModuleEntry[];
|
|
79
|
+
/** 宿主 runtime 实际版本(shell 侧取自 versions.json);提供即启用 peerRuntime 校验(US-5) */
|
|
80
|
+
runtimeVersion?: string;
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PasswordLogin(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const FORM_INITIAL_VALUES: {
|
|
2
|
+
username: string;
|
|
3
|
+
password: string;
|
|
4
|
+
confirmPassword: string;
|
|
5
|
+
};
|
|
6
|
+
export type RegisterPasswordFormType = typeof FORM_INITIAL_VALUES;
|
|
7
|
+
export declare function RegisterPassword(): import("#node_modules/@types/react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const FORM_COMPONENT_MAP: {
|
|
2
|
+
login: import("#node_modules/@types/react").FunctionComponentElement<{}>;
|
|
3
|
+
register: import("#node_modules/@types/react").FunctionComponentElement<{}>;
|
|
4
|
+
forgotPassword: import("#node_modules/@types/react").FunctionComponentElement<{}>;
|
|
5
|
+
codeLogin: import("#node_modules/@types/react").FunctionComponentElement<{}>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type FormComponentMapType = "login" | "register" | "forgotPassword" | "codeLogin";
|
|
2
|
+
export declare const FormModeContext: import("#node_modules/@types/react").Context<{
|
|
3
|
+
formMode: FormComponentMapType;
|
|
4
|
+
setFormMode: React.Dispatch<React.SetStateAction<FormComponentMapType>>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Login(): import("#node_modules/@types/react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hideLoading(): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const loadingId = "loading-e8a3a985";
|
|
2
|
+
export declare const loadingContainerId = "loading-container-e8a3a985";
|
|
3
|
+
/**
|
|
4
|
+
* Preview loading page.
|
|
5
|
+
* https://github.com/user-attachments/assets/110701a8-2cf4-4e5f-a07e-b832da4e1586
|
|
6
|
+
*/
|
|
7
|
+
export declare function setupLoading(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ROOT_ROUTE_ID = "root-route";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./route-path";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 如果在其他地方用到了路由跳转,将路由的 path 抽离出来,在此方便维护
|
|
3
|
+
* 防止修改 path 时忘记修改其他地方的 path
|
|
4
|
+
*/
|
|
5
|
+
export declare const loginPath = "/login";
|
|
6
|
+
export declare const privacyPolicyPath = "/privacy-policy";
|
|
7
|
+
export declare const termsOfServicePath = "/terms-of-service";
|
|
8
|
+
export declare const exceptionPath = "/exception";
|
|
9
|
+
export declare const exception403Path = "/exception/403";
|
|
10
|
+
export declare const exception404Path = "/exception/404";
|
|
11
|
+
export declare const exception500Path = "/exception/500";
|
|
12
|
+
export declare const exceptionUnknownComponentPath = "/exception/not-found-component";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface AuthGuardProps {
|
|
2
|
+
children?: React.ReactNode;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* @zh AuthGuard 组件,用于权限验证,代码的顺序很重要,不要随意调整
|
|
6
|
+
* @en AuthGuard component, used for permission verification. The order of the code is important and should not be arbitrarily adjusted
|
|
7
|
+
*/
|
|
8
|
+
export declare function AuthGuard({ children }: AuthGuardProps): string | number | bigint | boolean | Iterable<import("#node_modules/@types/react").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<import("#node_modules/@types/react").ReactNode> | null | undefined> | import("#node_modules/@types/react").JSX.Element | null | undefined;
|
|
9
|
+
export {};
|
|
10
|
+
/**
|
|
11
|
+
* 验证路由跳转是否正确的步骤:
|
|
12
|
+
* 1. 未登录情况下,输入 login 路由
|
|
13
|
+
* 2. 未登录情况下,输入非 login 路由
|
|
14
|
+
* 3. 已登录情况下,使用系统的退出登录,然后再次登录
|
|
15
|
+
* 4. 任选一个非 home 页面,使用开发者工具清除 localStorage,刷新页面之后进行登录
|
|
16
|
+
* 5. 已登录情况下,输入 login 路由
|
|
17
|
+
* 6. 已登录情况下,输入非 login 路由
|
|
18
|
+
* 7. 已登录情况下,输入 http://localhost:3333 跳转到 /home 路由,用户接口发送一次
|
|
19
|
+
* 8. 已登录情况下,输入 http://localhost:3333/ 跳转到 /home 路由,用户接口发送一次
|
|
20
|
+
* 9. 已登录情况下,输入 http://localhost:3333/home 跳转到 /home 路由,用户接口发送一次
|
|
21
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./auth-guard";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 当前路由匹配逻辑:
|
|
3
|
+
* https://mermaid.live/edit#pako:eNqNVF1v0zAU_SuWH6uWD21PfUAqGhqVBqo6EBJJH6zETSySuHIcWDVNGh_TGFtZgW2i0yaK0AYPoAIPFLR1_JkmDU_7Czhx1mXrpi1SrGvfc-451048CzWqY5iHVYs-0UzEOLg3oTpAPNNczJR4rIBc7ga4SWeuKyr0t7772_NBezU8eOcv7Ax6b8RUhRXJikAxuuBxc9JDTFf8V-2w1wNILOSMaOUKd2dAsLHY3_uVsIbgmErcEuJm0blLp6hBnAcm4XiKuFzp_274KwvB8ldgRQkQdjuDtR-DzReZTBK2en6z4TfWM5nD_ZX-wbK_--xwf7PGyGOk1XM1ahGtntAS6fPEgLAC_OZu7KjoxkkleN8RS4PWnt9bvwxf4GP-LUeXaDnGyBIysBJHIAorafwk5vddzIpOlSrh666_ujFY-xK87Pb_fgyedoSyrJPYSjs9rj0CuXTxiHeb2jiqAmRVzcTaoxJmNnFdQhP5CwrFzDL1OGZlSrkStP_InQdXpcuTB3GMTJsdGjkLdNT0KXdK8Gk--LATbD__12oON-sU6IQIMRzKcEHTsOuej95a8r81kxZiWuRr_Nq4Il5Qi87wYqUytfCI0_Dz23Dp59CvbDSNSzcrRceE6FhaNN3CmZ_eaMUUBGahLXKI6OIumI0IKuQmtrEK8yLUcRV5FldhVqZsISKkC5ZQlQhGDFPkVWdOlBK_Op2uOxrMc-bhLGTUM0yYryLLFTOvpiOOJwgyGLKHq1gnnLI78jaKL6UsrCHnIaVHmLn_M6fdRw
|
|
4
|
+
* 1. 初次进入应用
|
|
5
|
+
* 2. 加载 auth-guard.tsx 文件
|
|
6
|
+
* 3. 不包括 login 路由的**路由白名单**,例如:privacy-policy 路由
|
|
7
|
+
* 4. ……
|
|
8
|
+
*/
|
|
9
|
+
import type { RouteObject } from "react-router";
|
|
10
|
+
export declare const rootRoute: RouteObject[];
|
|
11
|
+
export declare const router: import("react-router").DataRouter;
|
|
12
|
+
export default router;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AppRouteRecordRaw } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* P7.14 / 评审 F11:框架内置 /exception/403|404|500 兜底路由。
|
|
4
|
+
*
|
|
5
|
+
* 守卫硬编码向这三个路径跳转,它们因此是框架契约的一部分,必须由框架
|
|
6
|
+
* 自己兜底(此前依赖可禁用的 modules/exception 提供)。exception 模块
|
|
7
|
+
* 启用时其同路径路由优先——auth-guard 只在路径未被任何来源覆盖时
|
|
8
|
+
* 注入本兜底(见 ensureBuiltinExceptionRoutes)。
|
|
9
|
+
*/
|
|
10
|
+
export declare const builtinExceptionRoutes: AppRouteRecordRaw[];
|
|
11
|
+
/** 目标路径未被覆盖时注入内置异常页兜底;返回新数组,不改入参 */
|
|
12
|
+
export declare function ensureBuiltinExceptionRoutes(routes: AppRouteRecordRaw[]): AppRouteRecordRaw[];
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { AppRouteRecordRaw, RouteFileModule } from "../types";
|
|
2
|
+
export declare const externalRouteFiles: RouteFileModule;
|
|
3
|
+
export declare const staticRouteFiles: RouteFileModule;
|
|
4
|
+
/**
|
|
5
|
+
* 外部路由 1. 不进行权限校验, 2. 不会触发请求,例如用户信息接口
|
|
6
|
+
* @example "privacy-policy", "terms-of-service" 等
|
|
7
|
+
*/
|
|
8
|
+
export declare const externalRoutes: AppRouteRecordRaw[];
|
|
9
|
+
/** 静态路由 */
|
|
10
|
+
export declare const staticRoutes: AppRouteRecordRaw[];
|
|
11
|
+
/**
|
|
12
|
+
* 基本路由列表,由核心路由、外部路由组成,会一直存在系统中
|
|
13
|
+
*/
|
|
14
|
+
declare const baseRoutes: ({
|
|
15
|
+
handle: {
|
|
16
|
+
order: number;
|
|
17
|
+
title: import("#node_modules/@types/react").ReactNode;
|
|
18
|
+
icon?: import("#node_modules/@types/react").ReactNode;
|
|
19
|
+
roles?: string[];
|
|
20
|
+
permissions?: string[];
|
|
21
|
+
keepAlive?: boolean;
|
|
22
|
+
layout?: "container" | "parent" | "none";
|
|
23
|
+
hideInMenu?: boolean;
|
|
24
|
+
iframeLink?: string;
|
|
25
|
+
externalLink?: string;
|
|
26
|
+
ignoreAccess?: boolean;
|
|
27
|
+
currentActiveMenu?: string;
|
|
28
|
+
backstage?: boolean;
|
|
29
|
+
};
|
|
30
|
+
redirect?: string;
|
|
31
|
+
caseSensitive?: boolean | undefined;
|
|
32
|
+
path?: string | undefined;
|
|
33
|
+
middleware?: import("react-router").MiddlewareFunction[] | undefined;
|
|
34
|
+
loader?: (import("react-router").LoaderFunction | boolean) | undefined;
|
|
35
|
+
action?: (import("react-router").ActionFunction | boolean) | undefined;
|
|
36
|
+
hasErrorBoundary?: boolean | undefined;
|
|
37
|
+
shouldRevalidate?: import("react-router").ShouldRevalidateFunction | undefined;
|
|
38
|
+
lazy?: ({
|
|
39
|
+
middleware?: (() => Promise<import("react-router").MiddlewareFunction<unknown>[] | null | undefined>) | undefined;
|
|
40
|
+
loader?: (() => Promise<boolean | import("react-router").LoaderFunction<any> | null | undefined>) | undefined;
|
|
41
|
+
action?: (() => Promise<boolean | import("react-router").ActionFunction<any> | null | undefined>) | undefined;
|
|
42
|
+
hasErrorBoundary?: (() => Promise<boolean | null | undefined>) | undefined;
|
|
43
|
+
shouldRevalidate?: (() => Promise<import("react-router").ShouldRevalidateFunction | null | undefined>) | undefined;
|
|
44
|
+
handle?: (() => Promise<any>) | undefined;
|
|
45
|
+
Component?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
46
|
+
element?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
47
|
+
ErrorBoundary?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
48
|
+
errorElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
49
|
+
HydrateFallback?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
50
|
+
hydrateFallbackElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
51
|
+
} | import("react-router").LazyRouteFunction<import("react-router").BaseRouteObject>) | undefined;
|
|
52
|
+
Component?: (React.ComponentType | null) | undefined;
|
|
53
|
+
element?: import("#node_modules/@types/react").ReactNode;
|
|
54
|
+
ErrorBoundary?: (React.ComponentType | null) | undefined;
|
|
55
|
+
errorElement?: import("#node_modules/@types/react").ReactNode;
|
|
56
|
+
HydrateFallback?: (React.ComponentType | null) | undefined;
|
|
57
|
+
hydrateFallbackElement?: import("#node_modules/@types/react").ReactNode;
|
|
58
|
+
children?: undefined | undefined;
|
|
59
|
+
index: true;
|
|
60
|
+
} | {
|
|
61
|
+
handle: {
|
|
62
|
+
order: number;
|
|
63
|
+
title: import("#node_modules/@types/react").ReactNode;
|
|
64
|
+
icon?: import("#node_modules/@types/react").ReactNode;
|
|
65
|
+
roles?: string[];
|
|
66
|
+
permissions?: string[];
|
|
67
|
+
keepAlive?: boolean;
|
|
68
|
+
layout?: "container" | "parent" | "none";
|
|
69
|
+
hideInMenu?: boolean;
|
|
70
|
+
iframeLink?: string;
|
|
71
|
+
externalLink?: string;
|
|
72
|
+
ignoreAccess?: boolean;
|
|
73
|
+
currentActiveMenu?: string;
|
|
74
|
+
backstage?: boolean;
|
|
75
|
+
};
|
|
76
|
+
redirect?: string;
|
|
77
|
+
children?: AppRouteRecordRaw[];
|
|
78
|
+
caseSensitive?: boolean | undefined;
|
|
79
|
+
path?: string | undefined;
|
|
80
|
+
middleware?: import("react-router").MiddlewareFunction[] | undefined;
|
|
81
|
+
loader?: (import("react-router").LoaderFunction | boolean) | undefined;
|
|
82
|
+
action?: (import("react-router").ActionFunction | boolean) | undefined;
|
|
83
|
+
hasErrorBoundary?: boolean | undefined;
|
|
84
|
+
shouldRevalidate?: import("react-router").ShouldRevalidateFunction | undefined;
|
|
85
|
+
lazy?: ({
|
|
86
|
+
middleware?: (() => Promise<import("react-router").MiddlewareFunction<unknown>[] | null | undefined>) | undefined;
|
|
87
|
+
loader?: (() => Promise<boolean | import("react-router").LoaderFunction<any> | null | undefined>) | undefined;
|
|
88
|
+
action?: (() => Promise<boolean | import("react-router").ActionFunction<any> | null | undefined>) | undefined;
|
|
89
|
+
hasErrorBoundary?: (() => Promise<boolean | null | undefined>) | undefined;
|
|
90
|
+
shouldRevalidate?: (() => Promise<import("react-router").ShouldRevalidateFunction | null | undefined>) | undefined;
|
|
91
|
+
handle?: (() => Promise<any>) | undefined;
|
|
92
|
+
Component?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
93
|
+
element?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
94
|
+
ErrorBoundary?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
95
|
+
errorElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
96
|
+
HydrateFallback?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
97
|
+
hydrateFallbackElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
98
|
+
} | import("react-router").LazyRouteFunction<import("react-router").BaseRouteObject>) | undefined;
|
|
99
|
+
Component?: (React.ComponentType | null) | undefined;
|
|
100
|
+
element?: import("#node_modules/@types/react").ReactNode;
|
|
101
|
+
ErrorBoundary?: (React.ComponentType | null) | undefined;
|
|
102
|
+
errorElement?: import("#node_modules/@types/react").ReactNode;
|
|
103
|
+
HydrateFallback?: (React.ComponentType | null) | undefined;
|
|
104
|
+
hydrateFallbackElement?: import("#node_modules/@types/react").ReactNode;
|
|
105
|
+
index?: false | undefined;
|
|
106
|
+
})[];
|
|
107
|
+
/** 权限路由列表(静态路由,模块路由由 module-loader 动态提供) */
|
|
108
|
+
declare const accessRoutes: AppRouteRecordRaw[];
|
|
109
|
+
/**
|
|
110
|
+
* 路由白名单 1. 不进行权限校验, 2. 不会触发请求,例如用户信息接口
|
|
111
|
+
* @example "privacy-policy", "terms-of-service" 等
|
|
112
|
+
*/
|
|
113
|
+
declare const whiteRouteNames: (string | undefined)[];
|
|
114
|
+
export { accessRoutes, baseRoutes, whiteRouteNames, };
|