添加测试信息
This commit is contained in:
2991
dist/bim-engine-sdk.es.js
vendored
2991
dist/bim-engine-sdk.es.js
vendored
File diff suppressed because one or more lines are too long
2
dist/bim-engine-sdk.es.js.map
vendored
2
dist/bim-engine-sdk.es.js.map
vendored
File diff suppressed because one or more lines are too long
362
dist/bim-engine-sdk.umd.js
vendored
362
dist/bim-engine-sdk.umd.js
vendored
File diff suppressed because one or more lines are too long
2
dist/bim-engine-sdk.umd.js.map
vendored
2
dist/bim-engine-sdk.umd.js.map
vendored
File diff suppressed because one or more lines are too long
99
dist/index.d.ts
vendored
99
dist/index.d.ts
vendored
@@ -12,8 +12,11 @@ export declare class BimButtonGroup implements IBimComponent {
|
||||
private customColors;
|
||||
private unsubscribeLocale;
|
||||
private unsubscribeTheme;
|
||||
protected engine: BimEngine | null;
|
||||
private readonly DEFAULT_ICON;
|
||||
constructor(options: ButtonGroupOptions);
|
||||
setEngine(engine: BimEngine): void;
|
||||
protected emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
|
||||
private initContainer;
|
||||
private updatePosition;
|
||||
/**
|
||||
@@ -55,6 +58,21 @@ export declare class BimButtonGroup implements IBimComponent {
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
declare abstract class BimComponent {
|
||||
protected engine: BimEngine;
|
||||
constructor(engine: BimEngine);
|
||||
/**
|
||||
* Helper to send events easily
|
||||
*/
|
||||
protected emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
|
||||
/**
|
||||
* Helper to listen to events easily
|
||||
* Returns an unsubscribe function
|
||||
*/
|
||||
protected on<K extends keyof EngineEvents>(event: K, listener: (payload: EngineEvents[K]) => void): () => void;
|
||||
abstract destroy(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用弹窗组件类
|
||||
* 支持拖拽、缩放、自定义内容和位置。
|
||||
@@ -120,7 +138,7 @@ declare class BimDialog implements IBimComponent {
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export declare class BimEngine {
|
||||
export declare class BimEngine extends EventEmitter {
|
||||
private container;
|
||||
private wrapper;
|
||||
private topLeftGroup;
|
||||
@@ -134,6 +152,8 @@ export declare class BimEngine {
|
||||
locale?: LocaleType;
|
||||
theme?: ThemeType;
|
||||
});
|
||||
emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
|
||||
on<K extends keyof EngineEvents>(event: K, listener: (payload: EngineEvents[K]) => void): () => void;
|
||||
setLocale(locale: LocaleType): void;
|
||||
getLocale(): LocaleType;
|
||||
setTheme(theme: 'dark' | 'light'): void;
|
||||
@@ -189,19 +209,16 @@ declare interface ButtonGroupColors {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用按钮组管理器
|
||||
* 负责创建和管理除底部工具栏以外的其他按钮组。
|
||||
* 通用按钮组管理器 (ButtonGroupManager)
|
||||
* 负责创建和管理通用的按钮组实例。
|
||||
*/
|
||||
declare class ButtonGroupManager {
|
||||
private activeGroups;
|
||||
declare class ButtonGroupManager extends BimComponent {
|
||||
private groups;
|
||||
private container;
|
||||
constructor(container: HTMLElement);
|
||||
/**
|
||||
* 创建一个新的按钮组
|
||||
*/
|
||||
create(options: Omit<ButtonGroupOptions, 'container'>): BimButtonGroup;
|
||||
constructor(engine: BimEngine, container: HTMLElement);
|
||||
create(id: string, options: Omit<ButtonGroupOptions, 'container'>): BimButtonGroup;
|
||||
get(id: string): BimButtonGroup | undefined;
|
||||
updateTheme(theme: ThemeConfig): void;
|
||||
refresh(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
@@ -232,11 +249,11 @@ export declare function createEngine(r) {
|
||||
const e = r.version || "v1";
|
||||
switch (e) {
|
||||
case "v2":
|
||||
return new Uc(r);
|
||||
return new Nc(r);
|
||||
case "v1":
|
||||
return new L_(r);
|
||||
return new I_(r);
|
||||
:
|
||||
return console.warn(`Version '${e}' not found. Falling back to v2.`), new Uc(r);
|
||||
return console.warn(`Version '${e}' not found. Falling back to v2.`), new Nc(r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,16 +277,17 @@ declare interface DialogColors {
|
||||
* 弹窗管理器
|
||||
* 负责创建和管理应用中的各类弹窗。
|
||||
*/
|
||||
declare class DialogManager {
|
||||
declare class DialogManager extends BimComponent {
|
||||
/** 弹窗挂载的父容器 */
|
||||
private container;
|
||||
/** 活跃的弹窗实例列表 */
|
||||
private activeDialogs;
|
||||
/**
|
||||
* 构造函数
|
||||
* @param engine 引擎实例
|
||||
* @param container 弹窗挂载的目标容器
|
||||
*/
|
||||
constructor(container: HTMLElement);
|
||||
constructor(engine: BimEngine, container: HTMLElement);
|
||||
/**
|
||||
* 创建一个通用弹窗
|
||||
* @param options 弹窗配置选项(不需要传 container,自动使用管理器绑定的容器)
|
||||
@@ -286,6 +304,7 @@ declare class DialogManager {
|
||||
* @param theme 全局主题配置
|
||||
*/
|
||||
updateTheme(theme: ThemeConfig): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,21 +349,49 @@ declare type DialogPosition = 'center' | 'top-left' | 'top-center' | 'top-right'
|
||||
y: number;
|
||||
};
|
||||
|
||||
declare interface EngineEvents {
|
||||
'ui:open-dialog': {
|
||||
id: string;
|
||||
data?: any;
|
||||
};
|
||||
'ui:close-dialog': {
|
||||
id: string;
|
||||
};
|
||||
'engine:model-loaded': {
|
||||
url: string;
|
||||
};
|
||||
'engine:object-clicked': {
|
||||
objectId: string;
|
||||
position: {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
};
|
||||
};
|
||||
'sys:theme-changed': {
|
||||
theme: string;
|
||||
};
|
||||
'sys:locale-changed': {
|
||||
locale: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 3D 引擎管理器
|
||||
* 负责连接 Engine 组件和 BimEngine,向外部暴露简化的 API
|
||||
* 采用延迟初始化模式,用户需主动调用 initialize() 方法
|
||||
*/
|
||||
declare class EngineManager {
|
||||
declare class EngineManager extends BimComponent {
|
||||
/** 3D 引擎挂载的父容器 */
|
||||
private container;
|
||||
/** 3D 引擎组件实例 */
|
||||
private engine;
|
||||
private engineInstance;
|
||||
/**
|
||||
* 构造函数
|
||||
* @param engine 引擎实例
|
||||
* @param container 3D 引擎挂载的目标容器
|
||||
*/
|
||||
constructor(container: HTMLElement);
|
||||
constructor(engine: BimEngine, container: HTMLElement);
|
||||
/**
|
||||
* 初始化 3D 引擎
|
||||
* @param options 引擎配置选项(可选,如果不提供则使用默认配置)
|
||||
@@ -389,6 +436,14 @@ export declare interface EngineOptions {
|
||||
showViewCube?: boolean;
|
||||
}
|
||||
|
||||
declare class EventEmitter {
|
||||
private events;
|
||||
on(event: string, listener: Listener): () => void;
|
||||
off(event: string, listener: Listener): void;
|
||||
emit(event: string, payload?: any): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
/** 二级菜单展开方向 */
|
||||
declare type ExpandDirection = 'up' | 'down' | 'left' | 'right';
|
||||
|
||||
@@ -428,6 +483,8 @@ declare interface IBimComponent {
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
declare type Listener<T = any> = (payload: T) => void;
|
||||
|
||||
declare type LocaleChangeListener = (locale: LocaleType) => void;
|
||||
|
||||
/**
|
||||
@@ -568,11 +625,11 @@ export declare class Toolbar extends BimButtonGroup {
|
||||
* 底部工具栏管理器 (ToolbarManager)
|
||||
* 仅负责管理底部工具栏实例。
|
||||
*/
|
||||
declare class ToolbarManager {
|
||||
declare class ToolbarManager extends BimComponent {
|
||||
private toolbar;
|
||||
private toolbarContainer;
|
||||
private container;
|
||||
constructor(container: HTMLElement);
|
||||
constructor(engine: BimEngine, container: HTMLElement);
|
||||
private init;
|
||||
updateTheme(theme: ThemeConfig): void;
|
||||
refresh(): void;
|
||||
|
||||
Reference in New Issue
Block a user