mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-11-23 00:46:47 +08:00
reafctor(projects): use new elegant-router plugin
This commit is contained in:
240
src/typings/elegant-router.d.ts
vendored
240
src/typings/elegant-router.d.ts
vendored
@@ -1,240 +1,104 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
/* oxlint-disable */
|
||||
// biome-ignore lint: disable
|
||||
// Generated by elegant-router
|
||||
// Read more: https://github.com/soybeanjs/elegant-router
|
||||
|
||||
declare module "@elegant-router/types" {
|
||||
type ElegantConstRoute = import('@elegant-router/vue').ElegantConstRoute;
|
||||
type RouteRecordSingleView = import("vue-router").RouteRecordSingleView;
|
||||
type RouteRecordRedirect = import("vue-router").RouteRecordRedirect;
|
||||
type RouteComponent = import("vue-router").RouteComponent;
|
||||
|
||||
type Lazy<T> = () => Promise<T>;
|
||||
|
||||
export type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
|
||||
|
||||
/**
|
||||
* route layout
|
||||
* route layout key
|
||||
*/
|
||||
export type RouteLayout = "base" | "blank";
|
||||
export type RouteLayoutKey = "base" | "blank";
|
||||
|
||||
/**
|
||||
* route map
|
||||
* route path map
|
||||
*/
|
||||
export type RouteMap = {
|
||||
"root": "/";
|
||||
"not-found": "/:pathMatch(.*)*";
|
||||
export type RoutePathMap = {
|
||||
"Root": "/";
|
||||
"NotFound": "/:pathMatch(.*)*";
|
||||
"403": "/403";
|
||||
"404": "/404";
|
||||
"500": "/500";
|
||||
"home": "/home";
|
||||
"iframe-page": "/iframe-page/:url";
|
||||
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?";
|
||||
"Home": "/home";
|
||||
"IframeUrl": "/iframe/:url";
|
||||
"Login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?";
|
||||
"ManageApi": "/manage/api";
|
||||
"ManageDictionary": "/manage/dictionary";
|
||||
"ManageMenu": "/manage/menu";
|
||||
"ManageOrganization": "/manage/organization";
|
||||
"ManagePermission": "/manage/permission";
|
||||
"ManageRole": "/manage/role";
|
||||
"ManageRoute": "/manage/route";
|
||||
"ManageUser": "/manage/user";
|
||||
"Wip": "/wip";
|
||||
};
|
||||
|
||||
/**
|
||||
* route key
|
||||
*/
|
||||
export type RouteKey = keyof RouteMap;
|
||||
export type RouteKey = keyof RoutePathMap;
|
||||
|
||||
/**
|
||||
* route path
|
||||
*/
|
||||
export type RoutePath = RouteMap[RouteKey];
|
||||
export type RoutePath = RoutePathMap[RouteKey];
|
||||
|
||||
/**
|
||||
* custom route key
|
||||
* root route key
|
||||
*/
|
||||
export type CustomRouteKey = Extract<
|
||||
RouteKey,
|
||||
| "root"
|
||||
| "not-found"
|
||||
>;
|
||||
export type RootRouteKey = 'Root';
|
||||
|
||||
/**
|
||||
* the generated route key
|
||||
* not found route key
|
||||
*/
|
||||
export type GeneratedRouteKey = Exclude<RouteKey, CustomRouteKey>;
|
||||
export type NotFoundRouteKey = 'NotFound';
|
||||
|
||||
/**
|
||||
* the first level route key, which contain the layout of the route
|
||||
* builtin route key
|
||||
*/
|
||||
export type FirstLevelRouteKey = Extract<
|
||||
RouteKey,
|
||||
| "403"
|
||||
| "404"
|
||||
| "500"
|
||||
| "home"
|
||||
| "iframe-page"
|
||||
| "login"
|
||||
>;
|
||||
export type BuiltinRouteKey = RootRouteKey | NotFoundRouteKey;
|
||||
|
||||
/**
|
||||
* the custom first level route key
|
||||
* reuse route key
|
||||
*/
|
||||
export type CustomFirstLevelRouteKey = Extract<
|
||||
CustomRouteKey,
|
||||
| "root"
|
||||
| "not-found"
|
||||
>;
|
||||
export type ReuseRouteKey = never;
|
||||
|
||||
/**
|
||||
* the last level route key, which has the page file
|
||||
* the route file key, which has it's own file
|
||||
*/
|
||||
export type LastLevelRouteKey = Extract<
|
||||
RouteKey,
|
||||
| "403"
|
||||
| "404"
|
||||
| "500"
|
||||
| "iframe-page"
|
||||
| "login"
|
||||
| "home"
|
||||
>;
|
||||
export type RouteFileKey = Exclude<RouteKey, BuiltinRouteKey | ReuseRouteKey>;
|
||||
|
||||
/**
|
||||
* the custom last level route key
|
||||
* mapped name and path
|
||||
*/
|
||||
export type CustomLastLevelRouteKey = Extract<
|
||||
CustomRouteKey,
|
||||
| "root"
|
||||
| "not-found"
|
||||
>;
|
||||
type MappedNamePath = {
|
||||
[K in RouteKey]: { name: K; path: RoutePathMap[K] };
|
||||
}[RouteKey];
|
||||
|
||||
/**
|
||||
* the single level route key
|
||||
* auto router single view
|
||||
*/
|
||||
export type SingleLevelRouteKey = FirstLevelRouteKey & LastLevelRouteKey;
|
||||
export type AutoRouterSingleView = Omit<RouteRecordSingleView, 'component' | 'name' | 'path'> & {
|
||||
component: RouteFileKey;
|
||||
layout: RouteLayoutKey;
|
||||
} & MappedNamePath;
|
||||
|
||||
/**
|
||||
* the custom single level route key
|
||||
* auto router redirect
|
||||
*/
|
||||
export type CustomSingleLevelRouteKey = CustomFirstLevelRouteKey & CustomLastLevelRouteKey;
|
||||
export type AutoRouterRedirect = Omit<RouteRecordRedirect, 'children' | 'name' | 'path'> & MappedNamePath;
|
||||
|
||||
/**
|
||||
* the first level route key, but not the single level
|
||||
*/
|
||||
export type FirstLevelRouteNotSingleKey = Exclude<FirstLevelRouteKey, SingleLevelRouteKey>;
|
||||
|
||||
/**
|
||||
* the custom first level route key, but not the single level
|
||||
* auto router route
|
||||
*/
|
||||
export type CustomFirstLevelRouteNotSingleKey = Exclude<CustomFirstLevelRouteKey, CustomSingleLevelRouteKey>;
|
||||
|
||||
/**
|
||||
* the center level route key
|
||||
*/
|
||||
export type CenterLevelRouteKey = Exclude<GeneratedRouteKey, FirstLevelRouteKey | LastLevelRouteKey>;
|
||||
|
||||
/**
|
||||
* the custom center level route key
|
||||
*/
|
||||
export type CustomCenterLevelRouteKey = Exclude<CustomRouteKey, CustomFirstLevelRouteKey | CustomLastLevelRouteKey>;
|
||||
|
||||
/**
|
||||
* the center level route key
|
||||
*/
|
||||
type GetChildRouteKey<K extends RouteKey, T extends RouteKey = RouteKey> = T extends `${K}_${infer R}`
|
||||
? R extends `${string}_${string}`
|
||||
? never
|
||||
: T
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the single level route
|
||||
*/
|
||||
type SingleLevelRoute<K extends SingleLevelRouteKey = SingleLevelRouteKey> = K extends string
|
||||
? Omit<ElegantConstRoute, 'children'> & {
|
||||
name: K;
|
||||
path: RouteMap[K];
|
||||
component: `layout.${RouteLayout}$view.${K}`;
|
||||
}
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the last level route
|
||||
*/
|
||||
type LastLevelRoute<K extends GeneratedRouteKey> = K extends LastLevelRouteKey
|
||||
? Omit<ElegantConstRoute, 'children'> & {
|
||||
name: K;
|
||||
path: RouteMap[K];
|
||||
component: `view.${K}`;
|
||||
}
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the center level route
|
||||
*/
|
||||
type CenterLevelRoute<K extends GeneratedRouteKey> = K extends CenterLevelRouteKey
|
||||
? Omit<ElegantConstRoute, 'component'> & {
|
||||
name: K;
|
||||
path: RouteMap[K];
|
||||
children: (CenterLevelRoute<GetChildRouteKey<K>> | LastLevelRoute<GetChildRouteKey<K>>)[];
|
||||
}
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the multi level route
|
||||
*/
|
||||
type MultiLevelRoute<K extends FirstLevelRouteNotSingleKey = FirstLevelRouteNotSingleKey> = K extends string
|
||||
? ElegantConstRoute & {
|
||||
name: K;
|
||||
path: RouteMap[K];
|
||||
component: `layout.${RouteLayout}`;
|
||||
children: (CenterLevelRoute<GetChildRouteKey<K>> | LastLevelRoute<GetChildRouteKey<K>>)[];
|
||||
}
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the custom first level route
|
||||
*/
|
||||
type CustomSingleLevelRoute<K extends CustomFirstLevelRouteKey = CustomFirstLevelRouteKey> = K extends string
|
||||
? Omit<ElegantConstRoute, 'children'> & {
|
||||
name: K;
|
||||
path: RouteMap[K];
|
||||
component?: `layout.${RouteLayout}$view.${LastLevelRouteKey}`;
|
||||
}
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the custom last level route
|
||||
*/
|
||||
type CustomLastLevelRoute<K extends CustomRouteKey> = K extends CustomLastLevelRouteKey
|
||||
? Omit<ElegantConstRoute, 'children'> & {
|
||||
name: K;
|
||||
path: RouteMap[K];
|
||||
component?: `view.${LastLevelRouteKey}`;
|
||||
}
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the custom center level route
|
||||
*/
|
||||
type CustomCenterLevelRoute<K extends CustomRouteKey> = K extends CustomCenterLevelRouteKey
|
||||
? Omit<ElegantConstRoute, 'component'> & {
|
||||
name: K;
|
||||
path: RouteMap[K];
|
||||
children: (CustomCenterLevelRoute<GetChildRouteKey<K>> | CustomLastLevelRoute<GetChildRouteKey<K>>)[];
|
||||
}
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the custom multi level route
|
||||
*/
|
||||
type CustomMultiLevelRoute<K extends CustomFirstLevelRouteNotSingleKey = CustomFirstLevelRouteNotSingleKey> =
|
||||
K extends string
|
||||
? ElegantConstRoute & {
|
||||
name: K;
|
||||
path: RouteMap[K];
|
||||
component: `layout.${RouteLayout}`;
|
||||
children: (CustomCenterLevelRoute<GetChildRouteKey<K>> | CustomLastLevelRoute<GetChildRouteKey<K>>)[];
|
||||
}
|
||||
: never;
|
||||
|
||||
/**
|
||||
* the custom route
|
||||
*/
|
||||
type CustomRoute = CustomSingleLevelRoute | CustomMultiLevelRoute;
|
||||
|
||||
/**
|
||||
* the generated route
|
||||
*/
|
||||
type GeneratedRoute = SingleLevelRoute | MultiLevelRoute;
|
||||
|
||||
/**
|
||||
* the elegant route
|
||||
*/
|
||||
type ElegantRoute = GeneratedRoute | CustomRoute;
|
||||
export type AutoRouterRoute = AutoRouterSingleView | AutoRouterRedirect;
|
||||
}
|
||||
|
||||
4
src/typings/router.d.ts
vendored
4
src/typings/router.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
import 'vue-router';
|
||||
export {};
|
||||
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
export interface RouteMeta {
|
||||
/**
|
||||
* Title of the route
|
||||
*
|
||||
|
||||
44
src/typings/typed-router.d.ts
vendored
Normal file
44
src/typings/typed-router.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
/* prettier-ignore */
|
||||
/* oxlint-disable */
|
||||
// biome-ignore lint: disable
|
||||
// Generated by elegant-router
|
||||
// Read more: https://github.com/soybeanjs/elegant-router
|
||||
|
||||
export {}
|
||||
|
||||
declare module "vue-router" {
|
||||
type RouteNamedMap = import("vue-router/auto-routes").RouteNamedMap;
|
||||
|
||||
export interface TypesConfig {
|
||||
RouteNamedMap: RouteNamedMap;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "vue-router/auto-routes" {
|
||||
import type { RouteParamsRawGeneric, RouteParamsGeneric, RouteMeta, RouteRecordInfo, ParamValue, ParamValueZeroOrOne } from "vue-router";
|
||||
|
||||
/**
|
||||
* route named map
|
||||
*/
|
||||
export interface RouteNamedMap {
|
||||
"Root": RouteRecordInfo<"Root", "/", Record<never, never>, Record<never, never>>;
|
||||
"NotFound": RouteRecordInfo<"NotFound", "/:pathMatch(.*)*", Record<never, never>, Record<never, never>>;
|
||||
"403": RouteRecordInfo<"403", "/403", Record<never, never>, Record<never, never>>;
|
||||
"404": RouteRecordInfo<"404", "/404", Record<never, never>, Record<never, never>>;
|
||||
"500": RouteRecordInfo<"500", "/500", Record<never, never>, Record<never, never>>;
|
||||
"Home": RouteRecordInfo<"Home", "/home", Record<never, never>, Record<never, never>>;
|
||||
"IframeUrl": RouteRecordInfo<"IframeUrl", "/iframe/:url", { url: ParamValue<true> }, { url: ParamValue<false> }>;
|
||||
"Login": RouteRecordInfo<"Login", "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?", { module?: ParamValueZeroOrOne<true> }, { module?: ParamValueZeroOrOne<false> }>;
|
||||
"ManageApi": RouteRecordInfo<"ManageApi", "/manage/api", Record<never, never>, Record<never, never>>;
|
||||
"ManageDictionary": RouteRecordInfo<"ManageDictionary", "/manage/dictionary", Record<never, never>, Record<never, never>>;
|
||||
"ManageMenu": RouteRecordInfo<"ManageMenu", "/manage/menu", Record<never, never>, Record<never, never>>;
|
||||
"ManageOrganization": RouteRecordInfo<"ManageOrganization", "/manage/organization", Record<never, never>, Record<never, never>>;
|
||||
"ManagePermission": RouteRecordInfo<"ManagePermission", "/manage/permission", Record<never, never>, Record<never, never>>;
|
||||
"ManageRole": RouteRecordInfo<"ManageRole", "/manage/role", Record<never, never>, Record<never, never>>;
|
||||
"ManageRoute": RouteRecordInfo<"ManageRoute", "/manage/route", Record<never, never>, Record<never, never>>;
|
||||
"ManageUser": RouteRecordInfo<"ManageUser", "/manage/user", Record<never, never>, Record<never, never>>;
|
||||
"Wip": RouteRecordInfo<"Wip", "/wip", Record<never, never>, Record<never, never>>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user