feat(plugin): support enterprise extension (#861)

This commit is contained in:
Haze
2026-04-16 17:15:25 +08:00
committed by GitHub
parent 2fefbf3aba
commit b884db629e
29 changed files with 847 additions and 22 deletions

48
src/extensions/types.ts Normal file
View File

@@ -0,0 +1,48 @@
import type { ComponentType } from 'react';
export interface NavItemDef {
to: string;
icon: ComponentType<{ className?: string; strokeWidth?: number }>;
label: string;
labelI18nKey?: string;
testId?: string;
}
export type I18nResources = Record<string, Record<string, unknown>>;
export interface SidebarExtension {
id: string;
navItems?: NavItemDef[];
hiddenRoutes?: string[];
}
export interface RouteDef {
path: string;
component: ComponentType;
}
export interface RouteExtension {
id: string;
routes: RouteDef[];
}
export interface SettingsSectionDef {
id: string;
component: ComponentType;
order?: number;
}
export interface SettingsSectionExtension {
id: string;
sections: SettingsSectionDef[];
}
export interface RendererExtension {
id: string;
sidebar?: SidebarExtension;
routes?: RouteExtension;
settings?: SettingsSectionExtension;
i18nResources?: I18nResources;
setup?(): void | Promise<void>;
teardown?(): void;
}