增加定义
This commit is contained in:
91
AutoRobot/Windows/Robot/Web/src/DockLayout/types.d.ts
vendored
Normal file
91
AutoRobot/Windows/Robot/Web/src/DockLayout/types.d.ts
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* DockLayout 类型声明(仅类型,无运行时代码)
|
||||
* 位置:e:\JoyD\AutoRobot\Windows\Robot\Web\src\DockLayout\types.d.ts
|
||||
*
|
||||
* 目标:为停靠布局的面板区、子面板区、TabGroup、全局面板列表等提供统一的类型约定。
|
||||
*/
|
||||
|
||||
/** 面板区枚举 */
|
||||
export type PanelPosition = 'left' | 'right' | 'top' | 'bottom' | 'center';
|
||||
|
||||
/** 影响关系项 */
|
||||
export interface InfluenceEntry {
|
||||
position: PanelPosition; // 目标面板区位置
|
||||
influence: boolean; // 是否产生影响(用于过滤/开关)
|
||||
}
|
||||
|
||||
/** 子面板元数据(全局面板列表,非 DOM 实例) */
|
||||
export interface PanelMeta {
|
||||
id: string;
|
||||
title: string;
|
||||
icon?: string;
|
||||
component?: unknown; // 非 DOM 实例的渲染引用或组件名
|
||||
initialPosition?: PanelPosition;
|
||||
tags?: string[];
|
||||
flags?: { collapsed?: boolean; floating?: boolean };
|
||||
}
|
||||
|
||||
/** 子面板(标签页项) */
|
||||
export interface Panel {
|
||||
id: string; // 面板唯一标识(建议与 PanelMeta.id 对齐)
|
||||
title: string;
|
||||
icon?: string;
|
||||
content?: unknown; // 组件或渲染函数引用
|
||||
collapsed?: boolean;
|
||||
}
|
||||
|
||||
/** 子面板区(TabGroup 容器) */
|
||||
export interface SubArea {
|
||||
id: string;
|
||||
tabGroupId: string; // 绑定的 TabGroup 标识
|
||||
panels: string[]; // 标签页集合(仅保存面板 id,数据来自全局 allPanels)
|
||||
}
|
||||
|
||||
/** 面板区(一级容器) */
|
||||
export interface PanelArea {
|
||||
id: string;
|
||||
parentAreaId?: string; // 上级面板区id
|
||||
position: PanelPosition;
|
||||
subAreas: SubArea[]; // 一个或多个子面板区
|
||||
activeTabIndex?: number; // 当前激活标签索引(按区内的顺序)
|
||||
influence: InfluenceEntry[]; // 受影响列表
|
||||
influencedBy: InfluenceEntry[]; // 被影响列表
|
||||
pendingUpdates: Set<string>; // 待更新列表(去重队列)面板区id
|
||||
|
||||
// 尺寸与边界(用于绝对定位计算)
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
|
||||
// 在上级面板区中的比例(按区维度)
|
||||
widthRatios: number;
|
||||
heightRatios: number;
|
||||
}
|
||||
|
||||
/** 最小尺寸与布局配置 */
|
||||
export interface MinSizes {
|
||||
panelWidth: number;
|
||||
panelHeight: number;
|
||||
floatingWindowWidth?: number;
|
||||
floatingWindowHeight?: number;
|
||||
}
|
||||
|
||||
/** DockLayout 根状态 */
|
||||
export interface DockLayoutState {
|
||||
rootAreaId: string; // 根面板区id
|
||||
areas: Record<string, PanelArea>; // 面板区(一级容器)
|
||||
allPanels: Record<string, PanelMeta>; // 全局面板列表(非 DOM 实例)
|
||||
pendingGlobalRecompute?: Set<string>; // 全局待重算队列(可选,防循环控制)面板区id
|
||||
}
|
||||
|
||||
/** TabGroup 行为与事件约定(仅类型) */
|
||||
export type TabGroupEvent = 'tabAdded' | 'tabClosed' | 'tabActivated';
|
||||
|
||||
export interface PanelRegistry {
|
||||
registerPanel(meta: PanelMeta): void;
|
||||
unregisterPanel(id: string): void;
|
||||
getPanelById(id: string): PanelMeta | undefined;
|
||||
listPanels(): PanelMeta[];
|
||||
updatePanelMeta(id: string, patch: Partial<PanelMeta>): void;
|
||||
}
|
||||
Reference in New Issue
Block a user