Files
bim_engine/dist/index.d.ts

102 lines
2.3 KiB
TypeScript
Raw Normal View History

2025-12-03 12:00:46 +08:00
export declare class BimEngine {
private container;
private optBtnGroups;
2025-12-03 12:00:46 +08:00
constructor(container: HTMLElement | string);
private init;
private initOptBtnGroups;
destroy(): void;
}
/**
*
*/
declare interface ButtonConfig {
id: string;
type: ButtonType;
label: string;
icon?: string;
keepActive?: boolean;
disabled?: boolean;
onClick?: (button: OptButton) => void;
children?: ButtonConfig[];
groupId?: string;
parentId?: string;
}
/**
*
*/
export declare interface ButtonGroup {
id: string;
buttons: OptButton[];
}
declare type ButtonType = 'button' | 'menu';
/**
*
*/
export declare interface ClickPayload {
button: OptButton;
action: 'activate' | 'deactivate' | 'trigger';
isActive?: boolean;
}
export declare class OptBtnGroups {
private container;
private options;
private groups;
private activeBtnIds;
private btnRefs;
private dropdownElement;
private hoverTimeout;
private readonly DEFAULT_ICON;
constructor(options: OptBtnGroupsOptions);
private initContainer;
/**
*
* @param groupId ID
* @param beforeGroupId
*/
addGroup(groupId: string, beforeGroupId?: string): void;
/**
*
* @param config groupId parentId
*/
addButton(config: ButtonConfig): void;
private findButton;
init(): Promise<void>;
render(): void;
private renderGroup;
private renderButton;
private handleClick;
private handleSubClick;
private handleMouseEnter;
private handleMouseLeave;
private showDropdown;
private renderDropdownItem;
private closeDropdown;
private updateButtonState;
private getIcon;
private isVisible;
destroy(): void;
}
/**
* OptBtnGroups
*/
export declare interface OptBtnGroupsOptions {
container: HTMLElement | string;
showLabel?: boolean;
visibility?: Record<string, boolean>;
}
/**
* 使
*/
export declare interface OptButton extends ButtonConfig {
children?: OptButton[];
2025-12-03 12:00:46 +08:00
}
export { }