/// import type { PathPattern } from 'react-router-dom'; import type { RouteItem } from './RouteConfig'; import type RouteController from '../controllers'; type PathRule = string[] | RegExp[]; interface RegionConfig { type?: 'center' | 'dcenter' | 'region'; regionList?: IPayloadRegion[]; defaultRegion?: string; regionbarVisiblePaths?: PathPattern[]; globalVisiblePaths?: PathPattern[]; } interface ResourceGroupConfig { resourceGroupVisiblePaths?: PathPattern[]; } interface ConsoleBaseConfig { regionList?: Array<{ id: string; name: string; }>; } interface ThemeConfig { disableDefaultThemeClass: boolean; } interface ConsoleMenuConfig { notDisplayPath?: PathRule; /** * 默认收起侧边栏的路径设置 */ collapsedPath?: PathRule; /** * 默认展开的目录 */ defaultOpen?: PathRule; /** * 是否在 微应用中展示,默认隐藏。 */ showInMicroApp?: boolean; } interface LoggerOptions { enable: boolean; } interface RouteConfig { mode: 'browser' | 'hash' | 'memory'; /** * 兜底路由 */ redirect?: string; /** * 路由前缀 */ basename?: string; routes?: RouteItem[]; /** * 重定向 */ alias?: Record; /** * 路由参数控制器 */ controllers?: Array<(appConfig?: AppConfig) => RouteController | undefined>; errorBoundary?: React.ComponentType; } export interface IPayloadRegion { id: string; name: string; /** * regionBar 置灰 */ disabled?: boolean; } export interface ErrorCodeConfig { title: string; message: string; messageExtra: string; confirmLabel: string; confirmHref: string; cancelLabel: string; cancelHref: string; target?: '_blank' | undefined; ignore?: boolean; } export interface BaseError extends Error { code?: string; title?: string; response?: any; details?: any; detailsAuth?: any; requestId?: string; preventDefault?: any; } export type ErrorCodeConfigCallback = (error: BaseError) => Partial; export type GetMessageCallback = (code: string, msg: string, error: BaseError) => string; export interface ErrorCenterOption { enable?: boolean; errorCodes?: Record>; errorConfig?: ErrorCodeConfigCallback; getMessage?: GetMessageCallback; } export interface AppConfig { /** * region 相关配置 */ region?: RegionConfig; /** * 资源组相关配置 */ resourceGroup?: ResourceGroupConfig; /** * consoleBase 相关配置 */ consoleBase?: ConsoleBaseConfig; /** * consoleMenu 相关配置 */ consoleMenu?: ConsoleMenuConfig; /** * 错误中心配置 */ errorCenter?: ErrorCenterOption; logger?: LoggerOptions; router?: RouteConfig; microApp?: { syncHistory: boolean; }; theme?: ThemeConfig; custom?: any; } export {};