58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
|
|
declare namespace App {
|
|||
|
|
namespace ObjectContext {
|
|||
|
|
type DomainKey = 'project' | 'product' | string;
|
|||
|
|
|
|||
|
|
type ObjectType = 'project' | 'product' | string;
|
|||
|
|
|
|||
|
|
type Menu = {
|
|||
|
|
/** 对象上下文菜单 key,优先约定为目标路由 name */
|
|||
|
|
key: string;
|
|||
|
|
/** 菜单文案 */
|
|||
|
|
label: string;
|
|||
|
|
/** 路由 name,可为空 */
|
|||
|
|
routeKey?: string | null;
|
|||
|
|
/** 路由 path,可为空 */
|
|||
|
|
routePath?: string | null;
|
|||
|
|
/** 子菜单 */
|
|||
|
|
children?: Menu[];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
interface DomainConfig {
|
|||
|
|
domainKey: DomainKey;
|
|||
|
|
mode: 'object-context';
|
|||
|
|
objectType: ObjectType;
|
|||
|
|
/** 用于识别当前路由是否属于该业务域 */
|
|||
|
|
routePathPrefixes: string[];
|
|||
|
|
/** 业务域入口页 */
|
|||
|
|
entryRouteKey: string;
|
|||
|
|
entryRoutePath: string;
|
|||
|
|
/** 对象默认首页兜底值 */
|
|||
|
|
fallbackDefaultRouteKey: string;
|
|||
|
|
fallbackDefaultRoutePath: string;
|
|||
|
|
/** 上下文接口 */
|
|||
|
|
contextApiPath: string;
|
|||
|
|
contextApiObjectIdParamKey: string;
|
|||
|
|
contextApiObjectIdPlacement?: 'query' | 'path';
|
|||
|
|
/** 第一版固定为 objectId */
|
|||
|
|
objectIdQueryKey: 'objectId';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
interface Summary {
|
|||
|
|
[key: string]: unknown;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
interface State {
|
|||
|
|
domainKey: DomainKey;
|
|||
|
|
objectType: ObjectType;
|
|||
|
|
objectId: string;
|
|||
|
|
objectName: string;
|
|||
|
|
objectSummary: Summary | null;
|
|||
|
|
contextScopedMenus: Menu[];
|
|||
|
|
buttonCodes: string[];
|
|||
|
|
defaultRouteKey: string;
|
|||
|
|
defaultRoutePath: string;
|
|||
|
|
isReady: boolean;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|