添加测试信息

This commit is contained in:
yuding
2025-12-16 11:57:44 +08:00
parent 2a2258cb9c
commit 9d1ebfd817
30 changed files with 6196 additions and 5211 deletions

135
dist/index.d.ts vendored
View File

@@ -18,6 +18,10 @@ export declare class BimButtonGroup implements IBimComponent {
setEngine(engine: BimEngine): void;
protected emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
private initContainer;
/**
* 设置事件拦截防止事件<E4BA8B><E4BBB6>泡到下层元素如 3D 引擎)
*/
private setupEventInterception;
private updatePosition;
/**
* 应用样式到容器
@@ -111,6 +115,11 @@ declare class BimDialog implements IBimComponent {
* 设置元素尺寸
*/
private setSize;
/**
* 根据内容自动调整弹窗宽度
* @param recenter 是否重新计算定位(例如保持居中),默认 true
*/
fitWidth(recenter?: boolean): void;
/**
* 初始化弹窗位置
*/
@@ -142,11 +151,11 @@ export declare class BimEngine extends EventEmitter {
private container;
private wrapper;
toolbar: ToolbarManager | null;
constructTreeBtn: ConstructTreeManagerBtn | null;
buttonGroup: ButtonGroupManager | null;
dialog: DialogManager | null;
engine: EngineManager | null;
get localeManager(): LocaleManager;
get themeManager(): ThemeManager;
rightKey: RightKeyManager | null;
constructor(container: HTMLElement | string, options?: {
locale?: LocaleType;
theme?: ThemeType;
@@ -230,11 +239,17 @@ export declare class BimRightKey implements IBimComponent {
private content;
private isVisible;
private onCloseCallback?;
private options?;
private mouseDownTime;
private readonly CLICK_THRESHOLD;
constructor(options?: RightKeyOptions);
init(): void;
setTheme(_theme: ThemeConfig): void;
setLocales(): void;
destroy(): void;
private handleContainerMouseDown;
private handleContainerMouseUp;
private handleContainerContextMenu;
/**
* 设置关闭时的回调函数
* 通常用于通知 Manager 状态变更
@@ -343,15 +358,38 @@ export declare interface ClickPayload {
isActive?: boolean;
}
export declare function createEngine(r) {
const e = r.version || "v1";
/**
* 底部工具栏管理器 (ToolbarManager)
* 仅负责管理底部工具栏实例。
*/
declare class ConstructTreeManagerBtn extends BimComponent {
private toolbar;
private toolbarContainer;
private container;
private dialog;
constructor(engine: BimEngine, container: HTMLElement);
private init;
openConstructTreeDialog(): void;
refresh(): void;
destroy(): void;
addGroup(groupId: string, beforeGroupId?: string): void;
addButton(config: ButtonConfig): void;
setButtonVisibility(id: string, v: boolean): void;
setShowLabel(show: boolean): void;
setVisible(visible: boolean): void;
setBackgroundColor(color: string): void;
setColors(colors: ButtonGroupColors): void;
}
export declare function createEngine(s) {
const e = s.version || "v1";
switch (e) {
case "v2":
return new Oc(r);
return new Fc(s);
case "v1":
return new U_(r);
return new O_(s);
:
return console.warn(`Version '${e}' not found. Falling back to v2.`), new Oc(r);
return console.warn(`Version '${e}' not found. Falling back to v2.`), new Fc(s);
}
}
@@ -466,6 +504,20 @@ declare interface EngineEvents {
z: number;
};
};
'ui:tree-node-check': {
id: string;
checked: boolean;
node: any;
};
'ui:tree-node-select': {
id: string;
selected: boolean;
node: any;
};
'ui:tree-node-expand': {
id: string;
expanded: boolean;
};
'sys:theme-changed': {
theme: string;
};
@@ -595,35 +647,6 @@ declare interface IRightKeyContent {
declare type Listener<T = any> = (payload: T) => void;
declare type LocaleChangeListener = (locale: LocaleType) => void;
/**
* 语言管理器类
*/
declare class LocaleManager {
private currentLocale;
private messages;
private listeners;
constructor();
/**
* 获取当前语言
*/
getLocale(): LocaleType;
/**
* 切换语言
*/
setLocale(locale: LocaleType): void;
/**
* 翻译核心方法
*/
t(key: string): string;
/**
* 订阅变更
*/
subscribe(listener: LocaleChangeListener): () => void;
private notifyListeners;
}
/**
* 语言代码类型
*/
@@ -693,7 +716,6 @@ declare class RightKeyManager extends BimComponent {
private rightKeyPanel;
private contextHandlers;
constructor(engine: BimEngine, container: HTMLElement);
private initEventListeners;
destroy(): void;
/**
* 注册上下文菜单处理器
@@ -715,6 +737,7 @@ declare class RightKeyManager extends BimComponent {
hide(): void;
/**
* 处理右键点击事件
* 由 BimRightKey 组件在检测到有效右键点击时调用
*/
private handleContextMenu;
}
@@ -724,10 +747,12 @@ declare interface RightKeyOptions {
className?: string;
/** 层级 (z-index) */
zIndex?: number;
/** 监听事件的容器 */
container?: HTMLElement;
/** 有效右键点击时的回调 */
onContext?: (e: MouseEvent) => void;
}
declare type ThemeChangeListener = (theme: ThemeConfig) => void;
/**
* 全局主题配置接口
* 定义系统通用的语义化颜色
@@ -761,38 +786,6 @@ declare interface ThemeConfig {
componentActive: string;
}
/**
* 主题管理器 (单例)
*/
declare class ThemeManager {
private currentTheme;
private listeners;
constructor();
/**
* 获取当前主题配置
*/
getTheme(): ThemeConfig;
/**
* 切换预设主题
* @param themeName 'dark' | 'light'
*/
setTheme(themeName: 'dark' | 'light'): void;
/**
* 应用自定义主题配置
* @param theme 配置对象
*/
setCustomTheme(theme: ThemeConfig): void;
/**
* 内部应用主题逻辑
*/
private applyTheme;
/**
* 订阅主题变更
*/
subscribe(listener: ThemeChangeListener): () => void;
private notifyListeners;
}
/**
* 主题类型定义
*/