@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,79 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { IndexRouteObject, NonIndexRouteObject, createBrowserRouter as RemixRouter } from "react-router";
|
|
3
|
+
export interface IndexRouteMeta extends Omit<IndexRouteObject, "id"> {
|
|
4
|
+
redirect?: string;
|
|
5
|
+
handle: RouteMeta;
|
|
6
|
+
}
|
|
7
|
+
export interface NonIndexRouteMeta extends Omit<NonIndexRouteObject, "id"> {
|
|
8
|
+
redirect?: string;
|
|
9
|
+
handle: RouteMeta;
|
|
10
|
+
children?: AppRouteRecordRaw[];
|
|
11
|
+
}
|
|
12
|
+
export type AppRouteRecordRaw = IndexRouteMeta | NonIndexRouteMeta;
|
|
13
|
+
export interface RouteMeta {
|
|
14
|
+
/**
|
|
15
|
+
* 路由标题,通常用于页面标题或者侧边栏菜单显示
|
|
16
|
+
*/
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* 菜单图标,用于侧边栏菜单项的图标显示
|
|
20
|
+
*/
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* 菜单排序,用于控制侧边栏菜单的显示顺序
|
|
24
|
+
*/
|
|
25
|
+
order?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 用于配置页面的权限,只有拥有对应权限的用户才能访问页面,不配置则不需要权限。
|
|
28
|
+
*/
|
|
29
|
+
roles?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* 页面内按钮级别的权限,用于控制页面内按钮的显示和隐藏
|
|
32
|
+
*/
|
|
33
|
+
permissions?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* 设置页面是否开启缓存,开启后页面会缓存,不会重新加载,仅在标签页启用时有效。
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
keepAlive?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 布局包裹方式(P2.2,设计文档 D9)。显式声明,不做隐式推导。
|
|
41
|
+
* - `"container"`:套完整 chrome(header / sidebar / tabbar / content)
|
|
42
|
+
* - `"parent"`:套父级布局(自身含 Outlet,用于嵌套菜单场景)
|
|
43
|
+
* - `"none"`:不套任何布局,页面/子路由直接渲染
|
|
44
|
+
* @default "container"(迁移期向后兼容,目标在 P2.7 补全显式声明后改为 `"none"`)
|
|
45
|
+
*/
|
|
46
|
+
layout?: "container" | "parent" | "none";
|
|
47
|
+
/**
|
|
48
|
+
* 是否在菜单中隐藏,用于控制某些路由不在侧边栏菜单中显示
|
|
49
|
+
*/
|
|
50
|
+
hideInMenu?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* iframe链接,如果路由需要在iframe中加载外部页面时使用
|
|
53
|
+
*/
|
|
54
|
+
iframeLink?: string;
|
|
55
|
+
/**
|
|
56
|
+
* 外部链接,点击后直接在新标签页中打开
|
|
57
|
+
*/
|
|
58
|
+
externalLink?: string;
|
|
59
|
+
/**
|
|
60
|
+
* 用于配置页面是否忽略权限,直接可以访问
|
|
61
|
+
*/
|
|
62
|
+
ignoreAccess?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* @description 指定当前激活的菜单,适用于动态路由情景下激活父菜单
|
|
65
|
+
* @example 从父路由 '/user/info' 导航到子路由 '/user/info/1' 时,可以手动手动指定以高亮显示父菜单 '/user/info'
|
|
66
|
+
*/
|
|
67
|
+
currentActiveMenu?: string;
|
|
68
|
+
/**
|
|
69
|
+
* 当前路由为请求后端接口得到的
|
|
70
|
+
*/
|
|
71
|
+
backstage?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export type ReactRouterType = ReturnType<typeof RemixRouter>;
|
|
74
|
+
export type RouterSubscriber = Parameters<ReactRouterType["subscribe"]>[0];
|
|
75
|
+
export type RouterState = ReactRouterType["state"];
|
|
76
|
+
export type RouterNavigate = ReactRouterType["navigate"];
|
|
77
|
+
export type RouteFileModule = Record<string, {
|
|
78
|
+
default: AppRouteRecordRaw[];
|
|
79
|
+
}>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { AppRouteRecordRaw } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* 为路由对象添加一个唯一的 ID,替代路由自动生成的 id,该 ID 默认为路由的路径(path)
|
|
4
|
+
* {
|
|
5
|
+
* path: '/dashboard',
|
|
6
|
+
* }
|
|
7
|
+
*
|
|
8
|
+
* 转化后
|
|
9
|
+
*
|
|
10
|
+
* {
|
|
11
|
+
* path: '/dashboard',
|
|
12
|
+
* id: '/dashboard',
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export declare function addRouteIdByPath(routes: AppRouteRecordRaw[], parentId?: string): ({
|
|
16
|
+
id: string | undefined;
|
|
17
|
+
redirect?: string;
|
|
18
|
+
handle: import("../types").RouteMeta;
|
|
19
|
+
caseSensitive?: boolean | undefined;
|
|
20
|
+
path?: string | undefined;
|
|
21
|
+
middleware?: import("react-router").MiddlewareFunction[] | undefined;
|
|
22
|
+
loader?: (import("react-router").LoaderFunction | boolean) | undefined;
|
|
23
|
+
action?: (import("react-router").ActionFunction | boolean) | undefined;
|
|
24
|
+
hasErrorBoundary?: boolean | undefined;
|
|
25
|
+
shouldRevalidate?: import("react-router").ShouldRevalidateFunction | undefined;
|
|
26
|
+
lazy?: ({
|
|
27
|
+
middleware?: (() => Promise<import("react-router").MiddlewareFunction<unknown>[] | null | undefined>) | undefined;
|
|
28
|
+
loader?: (() => Promise<boolean | import("react-router").LoaderFunction<any> | null | undefined>) | undefined;
|
|
29
|
+
action?: (() => Promise<boolean | import("react-router").ActionFunction<any> | null | undefined>) | undefined;
|
|
30
|
+
hasErrorBoundary?: (() => Promise<boolean | null | undefined>) | undefined;
|
|
31
|
+
shouldRevalidate?: (() => Promise<import("react-router").ShouldRevalidateFunction | null | undefined>) | undefined;
|
|
32
|
+
handle?: (() => Promise<any>) | undefined;
|
|
33
|
+
Component?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
34
|
+
element?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
35
|
+
ErrorBoundary?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
36
|
+
errorElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
37
|
+
HydrateFallback?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
38
|
+
hydrateFallbackElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
39
|
+
} | import("react-router").LazyRouteFunction<import("react-router").BaseRouteObject>) | undefined;
|
|
40
|
+
Component?: (React.ComponentType | null) | undefined;
|
|
41
|
+
element?: import("#node_modules/@types/react").ReactNode;
|
|
42
|
+
ErrorBoundary?: (React.ComponentType | null) | undefined;
|
|
43
|
+
errorElement?: import("#node_modules/@types/react").ReactNode;
|
|
44
|
+
HydrateFallback?: (React.ComponentType | null) | undefined;
|
|
45
|
+
hydrateFallbackElement?: import("#node_modules/@types/react").ReactNode;
|
|
46
|
+
children?: undefined | undefined;
|
|
47
|
+
index: true;
|
|
48
|
+
} | {
|
|
49
|
+
id: string | undefined;
|
|
50
|
+
redirect?: string;
|
|
51
|
+
handle: import("../types").RouteMeta;
|
|
52
|
+
children?: AppRouteRecordRaw[];
|
|
53
|
+
caseSensitive?: boolean | undefined;
|
|
54
|
+
path?: string | undefined;
|
|
55
|
+
middleware?: import("react-router").MiddlewareFunction[] | undefined;
|
|
56
|
+
loader?: (import("react-router").LoaderFunction | boolean) | undefined;
|
|
57
|
+
action?: (import("react-router").ActionFunction | boolean) | undefined;
|
|
58
|
+
hasErrorBoundary?: boolean | undefined;
|
|
59
|
+
shouldRevalidate?: import("react-router").ShouldRevalidateFunction | undefined;
|
|
60
|
+
lazy?: ({
|
|
61
|
+
middleware?: (() => Promise<import("react-router").MiddlewareFunction<unknown>[] | null | undefined>) | undefined;
|
|
62
|
+
loader?: (() => Promise<boolean | import("react-router").LoaderFunction<any> | null | undefined>) | undefined;
|
|
63
|
+
action?: (() => Promise<boolean | import("react-router").ActionFunction<any> | null | undefined>) | undefined;
|
|
64
|
+
hasErrorBoundary?: (() => Promise<boolean | null | undefined>) | undefined;
|
|
65
|
+
shouldRevalidate?: (() => Promise<import("react-router").ShouldRevalidateFunction | null | undefined>) | undefined;
|
|
66
|
+
handle?: (() => Promise<any>) | undefined;
|
|
67
|
+
Component?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
68
|
+
element?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
69
|
+
ErrorBoundary?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
70
|
+
errorElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
71
|
+
HydrateFallback?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
72
|
+
hydrateFallbackElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
73
|
+
} | import("react-router").LazyRouteFunction<import("react-router").BaseRouteObject>) | undefined;
|
|
74
|
+
Component?: (React.ComponentType | null) | undefined;
|
|
75
|
+
element?: import("#node_modules/@types/react").ReactNode;
|
|
76
|
+
ErrorBoundary?: (React.ComponentType | null) | undefined;
|
|
77
|
+
errorElement?: import("#node_modules/@types/react").ReactNode;
|
|
78
|
+
HydrateFallback?: (React.ComponentType | null) | undefined;
|
|
79
|
+
hydrateFallbackElement?: import("#node_modules/@types/react").ReactNode;
|
|
80
|
+
index?: false | undefined;
|
|
81
|
+
})[];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { AppRouteRecordRaw } from "../types";
|
|
2
|
+
/** 按照路由中 order 升序来排序路由 */
|
|
3
|
+
export declare function ascending(arr: AppRouteRecordRaw[]): ({
|
|
4
|
+
handle: {
|
|
5
|
+
order: number;
|
|
6
|
+
title: import("#node_modules/@types/react").ReactNode;
|
|
7
|
+
icon?: import("#node_modules/@types/react").ReactNode;
|
|
8
|
+
roles?: string[];
|
|
9
|
+
permissions?: string[];
|
|
10
|
+
keepAlive?: boolean;
|
|
11
|
+
layout?: "container" | "parent" | "none";
|
|
12
|
+
hideInMenu?: boolean;
|
|
13
|
+
iframeLink?: string;
|
|
14
|
+
externalLink?: string;
|
|
15
|
+
ignoreAccess?: boolean;
|
|
16
|
+
currentActiveMenu?: string;
|
|
17
|
+
backstage?: boolean;
|
|
18
|
+
};
|
|
19
|
+
redirect?: string;
|
|
20
|
+
caseSensitive?: boolean | undefined;
|
|
21
|
+
path?: string | undefined;
|
|
22
|
+
middleware?: import("react-router").MiddlewareFunction[] | undefined;
|
|
23
|
+
loader?: (import("react-router").LoaderFunction | boolean) | undefined;
|
|
24
|
+
action?: (import("react-router").ActionFunction | boolean) | undefined;
|
|
25
|
+
hasErrorBoundary?: boolean | undefined;
|
|
26
|
+
shouldRevalidate?: import("react-router").ShouldRevalidateFunction | undefined;
|
|
27
|
+
lazy?: ({
|
|
28
|
+
middleware?: (() => Promise<import("react-router").MiddlewareFunction<unknown>[] | null | undefined>) | undefined;
|
|
29
|
+
loader?: (() => Promise<boolean | import("react-router").LoaderFunction<any> | null | undefined>) | undefined;
|
|
30
|
+
action?: (() => Promise<boolean | import("react-router").ActionFunction<any> | null | undefined>) | undefined;
|
|
31
|
+
hasErrorBoundary?: (() => Promise<boolean | null | undefined>) | undefined;
|
|
32
|
+
shouldRevalidate?: (() => Promise<import("react-router").ShouldRevalidateFunction | null | undefined>) | undefined;
|
|
33
|
+
handle?: (() => Promise<any>) | undefined;
|
|
34
|
+
Component?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
35
|
+
element?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
36
|
+
ErrorBoundary?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
37
|
+
errorElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
38
|
+
HydrateFallback?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
39
|
+
hydrateFallbackElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
40
|
+
} | import("react-router").LazyRouteFunction<import("react-router").BaseRouteObject>) | undefined;
|
|
41
|
+
Component?: (React.ComponentType | null) | undefined;
|
|
42
|
+
element?: import("#node_modules/@types/react").ReactNode;
|
|
43
|
+
ErrorBoundary?: (React.ComponentType | null) | undefined;
|
|
44
|
+
errorElement?: import("#node_modules/@types/react").ReactNode;
|
|
45
|
+
HydrateFallback?: (React.ComponentType | null) | undefined;
|
|
46
|
+
hydrateFallbackElement?: import("#node_modules/@types/react").ReactNode;
|
|
47
|
+
children?: undefined | undefined;
|
|
48
|
+
index: true;
|
|
49
|
+
} | {
|
|
50
|
+
handle: {
|
|
51
|
+
order: number;
|
|
52
|
+
title: import("#node_modules/@types/react").ReactNode;
|
|
53
|
+
icon?: import("#node_modules/@types/react").ReactNode;
|
|
54
|
+
roles?: string[];
|
|
55
|
+
permissions?: string[];
|
|
56
|
+
keepAlive?: boolean;
|
|
57
|
+
layout?: "container" | "parent" | "none";
|
|
58
|
+
hideInMenu?: boolean;
|
|
59
|
+
iframeLink?: string;
|
|
60
|
+
externalLink?: string;
|
|
61
|
+
ignoreAccess?: boolean;
|
|
62
|
+
currentActiveMenu?: string;
|
|
63
|
+
backstage?: boolean;
|
|
64
|
+
};
|
|
65
|
+
redirect?: string;
|
|
66
|
+
children?: AppRouteRecordRaw[];
|
|
67
|
+
caseSensitive?: boolean | undefined;
|
|
68
|
+
path?: string | undefined;
|
|
69
|
+
middleware?: import("react-router").MiddlewareFunction[] | undefined;
|
|
70
|
+
loader?: (import("react-router").LoaderFunction | boolean) | undefined;
|
|
71
|
+
action?: (import("react-router").ActionFunction | boolean) | undefined;
|
|
72
|
+
hasErrorBoundary?: boolean | undefined;
|
|
73
|
+
shouldRevalidate?: import("react-router").ShouldRevalidateFunction | undefined;
|
|
74
|
+
lazy?: ({
|
|
75
|
+
middleware?: (() => Promise<import("react-router").MiddlewareFunction<unknown>[] | null | undefined>) | undefined;
|
|
76
|
+
loader?: (() => Promise<boolean | import("react-router").LoaderFunction<any> | null | undefined>) | undefined;
|
|
77
|
+
action?: (() => Promise<boolean | import("react-router").ActionFunction<any> | null | undefined>) | undefined;
|
|
78
|
+
hasErrorBoundary?: (() => Promise<boolean | null | undefined>) | undefined;
|
|
79
|
+
shouldRevalidate?: (() => Promise<import("react-router").ShouldRevalidateFunction | null | undefined>) | undefined;
|
|
80
|
+
handle?: (() => Promise<any>) | undefined;
|
|
81
|
+
Component?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
82
|
+
element?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
83
|
+
ErrorBoundary?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
84
|
+
errorElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
85
|
+
HydrateFallback?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
86
|
+
hydrateFallbackElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
87
|
+
} | import("react-router").LazyRouteFunction<import("react-router").BaseRouteObject>) | undefined;
|
|
88
|
+
Component?: (React.ComponentType | null) | undefined;
|
|
89
|
+
element?: import("#node_modules/@types/react").ReactNode;
|
|
90
|
+
ErrorBoundary?: (React.ComponentType | null) | undefined;
|
|
91
|
+
errorElement?: import("#node_modules/@types/react").ReactNode;
|
|
92
|
+
HydrateFallback?: (React.ComponentType | null) | undefined;
|
|
93
|
+
hydrateFallbackElement?: import("#node_modules/@types/react").ReactNode;
|
|
94
|
+
index?: false | undefined;
|
|
95
|
+
})[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MenuItemType } from "../../layout/layout-menu/types";
|
|
2
|
+
import type { AppRouteRecordRaw } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* 根据路由列表生成菜单项数组
|
|
5
|
+
*
|
|
6
|
+
* @param routeList 路由列表,类型为 AppRouteRecordRaw 数组
|
|
7
|
+
* @param parentPath 父路由绝对路径(递归用,顶层为 "/")
|
|
8
|
+
* @returns 返回菜单项数组,数组元素类型为 MenuItemType
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateMenuItemsFromRoutes(routeList: AppRouteRecordRaw[], parentPath?: string): MenuItemType[];
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { AppRouteRecordRaw } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* @zh 根据路由获取框架页面组件路径(仅 src/pages;模块页面不在此解析)
|
|
4
|
+
* @en Get framework page component path by route (src/pages only; module pages are resolved elsewhere)
|
|
5
|
+
*/
|
|
6
|
+
export declare function getComponentPathByRoute(route: AppRouteRecordRaw & {
|
|
7
|
+
component?: string;
|
|
8
|
+
}): string;
|
|
9
|
+
/**
|
|
10
|
+
* @zh 根据后端路由配置生成前端路由
|
|
11
|
+
* @en Generate frontend routes based on backend route configurations
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateRoutesFromBackend(backendRoutes: Array<AppRouteRecordRaw>): Promise<({
|
|
14
|
+
id: string | undefined;
|
|
15
|
+
redirect?: string;
|
|
16
|
+
handle: import("../types").RouteMeta;
|
|
17
|
+
caseSensitive?: boolean | undefined;
|
|
18
|
+
path?: string | undefined;
|
|
19
|
+
middleware?: import("react-router").MiddlewareFunction[] | undefined;
|
|
20
|
+
loader?: (import("react-router").LoaderFunction | boolean) | undefined;
|
|
21
|
+
action?: (import("react-router").ActionFunction | boolean) | undefined;
|
|
22
|
+
hasErrorBoundary?: boolean | undefined;
|
|
23
|
+
shouldRevalidate?: import("react-router").ShouldRevalidateFunction | undefined;
|
|
24
|
+
lazy?: ({
|
|
25
|
+
middleware?: (() => Promise<import("react-router").MiddlewareFunction<unknown>[] | null | undefined>) | undefined;
|
|
26
|
+
loader?: (() => Promise<boolean | import("react-router").LoaderFunction<any> | null | undefined>) | undefined;
|
|
27
|
+
action?: (() => Promise<boolean | import("react-router").ActionFunction<any> | null | undefined>) | undefined;
|
|
28
|
+
hasErrorBoundary?: (() => Promise<boolean | null | undefined>) | undefined;
|
|
29
|
+
shouldRevalidate?: (() => Promise<import("react-router").ShouldRevalidateFunction | null | undefined>) | undefined;
|
|
30
|
+
handle?: (() => Promise<any>) | undefined;
|
|
31
|
+
Component?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
32
|
+
element?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
33
|
+
ErrorBoundary?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
34
|
+
errorElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
35
|
+
HydrateFallback?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
36
|
+
hydrateFallbackElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
37
|
+
} | import("react-router").LazyRouteFunction<import("react-router").BaseRouteObject>) | undefined;
|
|
38
|
+
Component?: (React.ComponentType | null) | undefined;
|
|
39
|
+
element?: import("#node_modules/@types/react").ReactNode;
|
|
40
|
+
ErrorBoundary?: (React.ComponentType | null) | undefined;
|
|
41
|
+
errorElement?: import("#node_modules/@types/react").ReactNode;
|
|
42
|
+
HydrateFallback?: (React.ComponentType | null) | undefined;
|
|
43
|
+
hydrateFallbackElement?: import("#node_modules/@types/react").ReactNode;
|
|
44
|
+
children?: undefined | undefined;
|
|
45
|
+
index: true;
|
|
46
|
+
} | {
|
|
47
|
+
id: string | undefined;
|
|
48
|
+
redirect?: string;
|
|
49
|
+
handle: import("../types").RouteMeta;
|
|
50
|
+
children?: AppRouteRecordRaw[];
|
|
51
|
+
caseSensitive?: boolean | undefined;
|
|
52
|
+
path?: string | undefined;
|
|
53
|
+
middleware?: import("react-router").MiddlewareFunction[] | undefined;
|
|
54
|
+
loader?: (import("react-router").LoaderFunction | boolean) | undefined;
|
|
55
|
+
action?: (import("react-router").ActionFunction | boolean) | undefined;
|
|
56
|
+
hasErrorBoundary?: boolean | undefined;
|
|
57
|
+
shouldRevalidate?: import("react-router").ShouldRevalidateFunction | undefined;
|
|
58
|
+
lazy?: ({
|
|
59
|
+
middleware?: (() => Promise<import("react-router").MiddlewareFunction<unknown>[] | null | undefined>) | undefined;
|
|
60
|
+
loader?: (() => Promise<boolean | import("react-router").LoaderFunction<any> | null | undefined>) | undefined;
|
|
61
|
+
action?: (() => Promise<boolean | import("react-router").ActionFunction<any> | null | undefined>) | undefined;
|
|
62
|
+
hasErrorBoundary?: (() => Promise<boolean | null | undefined>) | undefined;
|
|
63
|
+
shouldRevalidate?: (() => Promise<import("react-router").ShouldRevalidateFunction | null | undefined>) | undefined;
|
|
64
|
+
handle?: (() => Promise<any>) | undefined;
|
|
65
|
+
Component?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
66
|
+
element?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
67
|
+
ErrorBoundary?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
68
|
+
errorElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
69
|
+
HydrateFallback?: (() => Promise<import("#node_modules/@types/react").ComponentType<{}> | null | undefined>) | undefined;
|
|
70
|
+
hydrateFallbackElement?: (() => Promise<import("#node_modules/@types/react").ReactNode>) | undefined;
|
|
71
|
+
} | import("react-router").LazyRouteFunction<import("react-router").BaseRouteObject>) | undefined;
|
|
72
|
+
Component?: (React.ComponentType | null) | undefined;
|
|
73
|
+
element?: import("#node_modules/@types/react").ReactNode;
|
|
74
|
+
ErrorBoundary?: (React.ComponentType | null) | undefined;
|
|
75
|
+
errorElement?: import("#node_modules/@types/react").ReactNode;
|
|
76
|
+
HydrateFallback?: (React.ComponentType | null) | undefined;
|
|
77
|
+
hydrateFallbackElement?: import("#node_modules/@types/react").ReactNode;
|
|
78
|
+
index?: false | undefined;
|
|
79
|
+
})[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh 移除路径末尾的斜杠
|
|
3
|
+
* @en Remove trailing slashes from a path
|
|
4
|
+
* @param {string} pathname - The path to remove trailing slashes from
|
|
5
|
+
* @returns {string} The path with trailing slashes removed
|
|
6
|
+
* @example
|
|
7
|
+
* removeTrailingSlash('/about/') // return '/about'
|
|
8
|
+
* removeTrailingSlash('/about') // return '/about'
|
|
9
|
+
*/
|
|
10
|
+
export declare function removeTrailingSlash(pathname: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { AppRouteRecordRaw, RouteMeta } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* 根据路由 `handle.layout` 解析所用布局组件(P2.2,设计文档 D9)。
|
|
5
|
+
*
|
|
6
|
+
* - `"parent"` → ParentLayout(自身含 Outlet,用于嵌套菜单场景)
|
|
7
|
+
* - `"container"` → ContainerLayout(整站 chrome:header / sidebar / tabbar / footer)
|
|
8
|
+
* - `"none"` / 未声明 → Outlet(无 chrome,页面 / 子路由直接渲染)
|
|
9
|
+
*
|
|
10
|
+
* 未声明即 `none` 是 D9 的目标态(P2.7 dogfooding 验证后自迁移期默认 `container` 翻转):
|
|
11
|
+
* 布局必须显式声明,框架不做隐式推导;后端下发的父级路由需在 handle 中携带 layout。
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveLayoutComponent(handle?: Partial<RouteMeta>): ComponentType;
|
|
14
|
+
/**
|
|
15
|
+
* 递归为缺少 Component 的父级路由按 `handle.layout` 注入布局组件(P2.7,US-8)。
|
|
16
|
+
*
|
|
17
|
+
* 模块路由不再直接 import ContainerLayout / ParentLayout,由框架在
|
|
18
|
+
* module-loader 出口统一包裹;已有 Component 的路由(页面组件)不受影响。
|
|
19
|
+
* 纯函数:返回新路由树,不修改模块 definition 中的原对象。
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveRouteLayouts(routes: AppRouteRecordRaw[]): AppRouteRecordRaw[];
|