feat(projects): page: support manage_menu more options. close #366

This commit is contained in:
Soybean
2024-05-07 01:36:22 +08:00
parent ebe55af7d5
commit c4b5c65625
9 changed files with 286 additions and 205 deletions

64
src/typings/api.d.ts vendored
View File

@ -171,6 +171,20 @@ declare namespace Api {
*/
type IconType = '1' | '2';
type MenuPropsOfRoute = Pick<
import('vue-router').RouteMeta,
| 'i18nKey'
| 'keepAlive'
| 'constant'
| 'order'
| 'href'
| 'hideInMenu'
| 'activeMenu'
| 'multiTab'
| 'fixedIndexInTab'
| 'query'
>;
type Menu = Common.CommonRecord<{
/** parent menu id */
parentId: number;
@ -184,56 +198,16 @@ declare namespace Api {
routePath: string;
/** component */
component?: string;
/**
* i18n key
*
* it is for internationalization
*/
i18nKey?: App.I18n.I18nKey;
/** iconify icon name or local icon name */
icon: string;
/** icon type */
iconType: IconType;
/** menu order */
order: number;
/** whether to cache the route */
keepAlive?: boolean;
/**
* Is constant route
*
* Does not need to login, and the route is defined in the front-end
*/
constant?: boolean;
/** outer link */
href?: string;
/** whether to hide the route in the menu */
hideInMenu?: boolean;
/**
* The menu key will be activated when entering the route
*
* The route is not in the menu
*
* @example
* the route is "user_detail", if it is set to "user_list", the menu "user_list" will be activated
*/
activeMenu?: import('@elegant-router/types').LastLevelRouteKey;
/** By default, the same route path will use one tab, if set to true, it will use multiple tabs */
multiTab?: boolean;
/** If set, the route will be fixed in tabs, and the value is the order of fixed tabs */
fixedIndexInTab?: number | null;
/** if set query parameters, it will be automatically carried when entering the route */
query: Record<string, string>;
/** menu buttons */
buttons?: MenuButton[];
/**
* Roles of the route
*
* Route can be accessed if the current user has at least one of the roles
*/
roles?: string[];
/** buttons */
buttons?: MenuButton[] | null;
/** children menu */
children?: Menu[];
}>;
children?: Menu[] | null;
}> &
MenuPropsOfRoute;
/** menu list */
type MenuList = Common.PaginatingQueryRecord<Menu>;

View File

@ -158,7 +158,7 @@ declare namespace App {
/** The menu label */
label: string;
/** The menu i18n key */
i18nKey?: I18n.I18nKey;
i18nKey?: I18n.I18nKey | null;
/** The route key */
routeKey: RouteKey;
/** The route path */
@ -216,7 +216,7 @@ declare namespace App {
*/
localIcon?: string;
/** I18n key */
i18nKey?: I18n.I18nKey;
i18nKey?: I18n.I18nKey | null;
};
/** Form rule */
@ -537,7 +537,7 @@ declare namespace App {
menuName: string;
routeName: string;
routePath: string;
routeParams: string;
pathParam: string;
layout: string;
page: string;
i18nKey: string;
@ -552,7 +552,6 @@ declare namespace App {
activeMenu: string;
multiTab: string;
fixedIndexInTab: string;
roles: string;
query: string;
button: string;
buttonCode: string;
@ -564,6 +563,7 @@ declare namespace App {
menuName: string;
routeName: string;
routePath: string;
pathParam: string;
layout: string;
page: string;
i18nKey: string;
@ -577,7 +577,6 @@ declare namespace App {
multiTab: string;
fixedInTab: string;
fixedIndexInTab: string;
roles: string;
queryKey: string;
queryValue: string;
button: string;

View File

@ -13,21 +13,23 @@ declare module 'vue-router' {
*
* It's used in i18n, if it is set, the title will be ignored
*/
i18nKey?: App.I18n.I18nKey;
i18nKey?: App.I18n.I18nKey | null;
/**
* Roles of the route
*
* Route can be accessed if the current user has at least one of the roles
*
* It only works when the route mode is "static", if the route mode is "dynamic", it will be ignored
*/
roles?: string[];
/** Whether to cache the route */
keepAlive?: boolean;
keepAlive?: boolean | null;
/**
* Is constant route
*
* Does not need to login, and the route is defined in the front-end
*/
constant?: boolean;
constant?: boolean | null;
/**
* Iconify icon
*
@ -41,11 +43,11 @@ declare module 'vue-router' {
*/
localIcon?: string;
/** Router order */
order?: number;
order?: number | null;
/** The outer link of the route */
href?: string;
href?: string | null;
/** Whether to hide the route in the menu */
hideInMenu?: boolean;
hideInMenu?: boolean | null;
/**
* The menu key will be activated when entering the route
*
@ -54,12 +56,12 @@ declare module 'vue-router' {
* @example
* the route is "user_detail", if it is set to "user_list", the menu "user_list" will be activated
*/
activeMenu?: import('@elegant-router/types').RouteKey;
activeMenu?: import('@elegant-router/types').RouteKey | null;
/** By default, the same route path will use one tab, if set to true, it will use multiple tabs */
multiTab?: boolean;
multiTab?: boolean | null;
/** If set, the route will be fixed in tabs, and the value is the order of fixed tabs */
fixedIndexInTab?: number | null;
/** if set query parameters, it will be automatically carried when entering the route */
query?: Record<string, string>;
query?: { key: string; value: string }[] | null;
}
}