iflow-engine 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/hdr/001.hdr +0 -0
- package/dist/assets/svg/rotate-orbit.svg +1 -0
- package/dist/assets/viewcube/cn_back.png +0 -0
- package/dist/assets/viewcube/cn_bottom.png +0 -0
- package/dist/assets/viewcube/cn_front.png +0 -0
- package/dist/assets/viewcube/cn_left.png +0 -0
- package/dist/assets/viewcube/cn_right.png +0 -0
- package/dist/assets/viewcube/cn_top.png +0 -0
- package/dist/assets/viewcube/home.png +0 -0
- package/dist/draco/DRACOLoader.js +739 -0
- package/dist/draco/draco_decoder.js +52 -0
- package/dist/draco/draco_decoder.wasm +0 -0
- package/dist/draco/draco_encoder.js +33 -0
- package/dist/draco/draco_wasm_wrapper.js +104 -0
- package/dist/engine/src/bim-engine.d.ts +51 -0
- package/dist/engine/src/components/ai-chat/index.d.ts +202 -0
- package/dist/engine/src/components/ai-chat/types.d.ts +133 -0
- package/dist/engine/src/components/button-group/index.d.ts +89 -0
- package/dist/engine/src/components/button-group/index.type.d.ts +84 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/ai-chat/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/fullscreen/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/home/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/info/icon.d.ts +1 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/info/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/map/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/measure/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/property/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/section/section-axis/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/section/section-box/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/section/section-menu/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/section/section-plane/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/setting/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/walk/walk-bird/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/walk/walk-menu/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/walk/walk-person/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/buttons/zoom-box/index.d.ts +2 -0
- package/dist/engine/src/components/button-group/toolbar/index.d.ts +4 -0
- package/dist/engine/src/components/collapse/index.d.ts +21 -0
- package/dist/engine/src/components/collapse/types.d.ts +34 -0
- package/dist/engine/src/components/description/index.d.ts +25 -0
- package/dist/engine/src/components/description/types.d.ts +43 -0
- package/dist/engine/src/components/dialog/index.d.ts +87 -0
- package/dist/engine/src/components/dialog/index.type.d.ts +57 -0
- package/dist/engine/src/components/engine/index.d.ts +436 -0
- package/dist/engine/src/components/engine/types.d.ts +31 -0
- package/dist/engine/src/components/measure-panel/index.d.ts +185 -0
- package/dist/engine/src/components/measure-panel/types.d.ts +87 -0
- package/dist/engine/src/components/menu/buttons/four.d.ts +2 -0
- package/dist/engine/src/components/menu/buttons/home.d.ts +2 -0
- package/dist/engine/src/components/menu/buttons/info.d.ts +2 -0
- package/dist/engine/src/components/menu/buttons/second.d.ts +2 -0
- package/dist/engine/src/components/menu/index.d.ts +57 -0
- package/dist/engine/src/components/menu/item.d.ts +12 -0
- package/dist/engine/src/components/menu/types.d.ts +34 -0
- package/dist/engine/src/components/right-key/index.d.ts +55 -0
- package/dist/engine/src/components/right-key/types.d.ts +20 -0
- package/dist/engine/src/components/section-axis-panel/index.d.ts +88 -0
- package/dist/engine/src/components/section-axis-panel/types.d.ts +31 -0
- package/dist/engine/src/components/section-box-panel/index.d.ts +53 -0
- package/dist/engine/src/components/section-box-panel/types.d.ts +60 -0
- package/dist/engine/src/components/section-plane-panel/index.d.ts +48 -0
- package/dist/engine/src/components/section-plane-panel/types.d.ts +22 -0
- package/dist/engine/src/components/tab/index.d.ts +64 -0
- package/dist/engine/src/components/tab/index.type.d.ts +35 -0
- package/dist/engine/src/components/tree/index.d.ts +71 -0
- package/dist/engine/src/components/tree/tree-node.d.ts +60 -0
- package/dist/engine/src/components/tree/types.d.ts +74 -0
- package/dist/engine/src/components/walk-control-panel/index.d.ts +46 -0
- package/dist/engine/src/components/walk-control-panel/types.d.ts +64 -0
- package/dist/engine/src/components/walk-path-panel/index.d.ts +102 -0
- package/dist/engine/src/components/walk-path-panel/types.d.ts +22 -0
- package/dist/engine/src/components/walk-plan-view-panel/index.d.ts +16 -0
- package/dist/engine/src/core/base-dialog-manager.d.ts +57 -0
- package/dist/engine/src/core/base-manager.d.ts +31 -0
- package/dist/engine/src/core/event-emitter.d.ts +36 -0
- package/dist/engine/src/core/manager-registry.d.ts +89 -0
- package/dist/engine/src/index.d.ts +10 -0
- package/dist/engine/src/locales/en-US.d.ts +2 -0
- package/dist/engine/src/locales/types.d.ts +236 -0
- package/dist/engine/src/locales/zh-CN.d.ts +2 -0
- package/dist/engine/src/managers/ai-chat-manager.d.ts +86 -0
- package/dist/engine/src/managers/button-group-manager.d.ts +35 -0
- package/dist/engine/src/managers/component-detail-manager.d.ts +24 -0
- package/dist/engine/src/managers/construct-tree-manager-btn.d.ts +89 -0
- package/dist/engine/src/managers/dialog-manager.d.ts +12 -0
- package/dist/engine/src/managers/engine-info-dialog-manager.d.ts +12 -0
- package/dist/engine/src/managers/engine-manager.d.ts +242 -0
- package/dist/engine/src/managers/measure-dialog-manager.d.ts +24 -0
- package/dist/engine/src/managers/right-key-manager.d.ts +34 -0
- package/dist/engine/src/managers/section-axis-dialog-manager.d.ts +55 -0
- package/dist/engine/src/managers/section-box-dialog-manager.d.ts +58 -0
- package/dist/engine/src/managers/section-plane-dialog-manager.d.ts +35 -0
- package/dist/engine/src/managers/toolbar-manager.d.ts +81 -0
- package/dist/engine/src/managers/walk-control-manager.d.ts +21 -0
- package/dist/engine/src/managers/walk-path-dialog-manager.d.ts +33 -0
- package/dist/engine/src/managers/walk-plan-view-dialog-manager.d.ts +33 -0
- package/dist/engine/src/services/locale.d.ts +35 -0
- package/dist/engine/src/services/theme.d.ts +35 -0
- package/dist/engine/src/themes/presets.d.ts +15 -0
- package/dist/engine/src/themes/types.d.ts +261 -0
- package/dist/engine/src/types/component.d.ts +27 -0
- package/dist/engine/src/types/events.d.ts +104 -0
- package/dist/engine/src/types/measure.d.ts +57 -0
- package/dist/engine/src/utils/icon-manager.d.ts +10 -0
- package/dist/iflow-engine.es.js +16785 -12008
- package/dist/iflow-engine.es.js.map +1 -1
- package/dist/iflow-engine.umd.js +2264 -173
- package/dist/iflow-engine.umd.js.map +1 -1
- package/package.json +3 -3
- package/dist/index.d.ts +0 -1963
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ButtonGroupOptions, ButtonConfig, ButtonGroupColors } from './index.type';
|
|
2
|
+
import { ThemeConfig } from '../../themes/types';
|
|
3
|
+
import { IBimComponent } from '../../types/component';
|
|
4
|
+
import { EngineEvents } from '../../types/events';
|
|
5
|
+
export declare class BimButtonGroup implements IBimComponent {
|
|
6
|
+
private container;
|
|
7
|
+
private options;
|
|
8
|
+
private groups;
|
|
9
|
+
private activeBtnIds;
|
|
10
|
+
private btnRefs;
|
|
11
|
+
private dropdownElement;
|
|
12
|
+
private hoverTimeout;
|
|
13
|
+
private customColors;
|
|
14
|
+
private unsubscribeLocale;
|
|
15
|
+
private unsubscribeTheme;
|
|
16
|
+
private readonly DEFAULT_ICON;
|
|
17
|
+
constructor(options: ButtonGroupOptions);
|
|
18
|
+
protected emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
|
|
19
|
+
private initContainer;
|
|
20
|
+
/**
|
|
21
|
+
* 设置事件拦截,防止事件冒泡到下层元素(如 3D 引擎)
|
|
22
|
+
*/
|
|
23
|
+
private setupEventInterception;
|
|
24
|
+
private updatePosition;
|
|
25
|
+
/**
|
|
26
|
+
* 应用样式到容器
|
|
27
|
+
*/
|
|
28
|
+
private applyStyles;
|
|
29
|
+
/**
|
|
30
|
+
* 设置主题的primary颜色(用于边框等)
|
|
31
|
+
*/
|
|
32
|
+
private setPrimaryColor;
|
|
33
|
+
/**
|
|
34
|
+
* 设置主题颜色
|
|
35
|
+
* 只会应用到没有被用户自定义的颜色属性上
|
|
36
|
+
*/
|
|
37
|
+
setTheme(theme: ThemeConfig): void;
|
|
38
|
+
/**
|
|
39
|
+
* 应用主题系统的 CSS 变量到容器
|
|
40
|
+
* 供 glass-pill 等样式变体使用
|
|
41
|
+
*/
|
|
42
|
+
private applyThemeCssVars;
|
|
43
|
+
/**
|
|
44
|
+
* 同步 CSS 变量到所有 dropdown 元素
|
|
45
|
+
* dropdown 被添加到 body,无法继承容器的 CSS 变量
|
|
46
|
+
*/
|
|
47
|
+
private syncDropdownCssVars;
|
|
48
|
+
/**
|
|
49
|
+
* 直接设置颜色(强制覆盖)
|
|
50
|
+
* 设置的颜色会被标记为自定义,后续的 setTheme 不会覆盖它们
|
|
51
|
+
*/
|
|
52
|
+
setColors(colors: ButtonGroupColors): void;
|
|
53
|
+
init(): Promise<void>;
|
|
54
|
+
setLocales(): void;
|
|
55
|
+
addGroup(groupId: string, beforeGroupId?: string): void;
|
|
56
|
+
addButton(config: ButtonConfig): void;
|
|
57
|
+
private findButton;
|
|
58
|
+
render(): void;
|
|
59
|
+
private renderGroup;
|
|
60
|
+
private renderButton;
|
|
61
|
+
/**
|
|
62
|
+
* 设置按钮的激活状态
|
|
63
|
+
* @param id 按钮 ID
|
|
64
|
+
* @param active 可选,如果不传则切换(toggle)当前状态
|
|
65
|
+
*/
|
|
66
|
+
setBtnActive(id: string, active?: boolean): void;
|
|
67
|
+
private handleClick;
|
|
68
|
+
/**
|
|
69
|
+
* 互斥关闭同范围内的其它已激活按钮,并触发它们的 onClick
|
|
70
|
+
* @param button 当前被激活的按钮
|
|
71
|
+
*/
|
|
72
|
+
private deactivateExclusiveSiblings;
|
|
73
|
+
private handleMouseEnter;
|
|
74
|
+
private handleMouseLeave;
|
|
75
|
+
private showDropdown;
|
|
76
|
+
private renderDropdownItem;
|
|
77
|
+
private closeDropdown;
|
|
78
|
+
private updateButtonState;
|
|
79
|
+
private getIcon;
|
|
80
|
+
updateButtonVisibility(id: string, visible: boolean): void;
|
|
81
|
+
setShowLabel(show: boolean): void;
|
|
82
|
+
private updateLabelsVisibility;
|
|
83
|
+
private findButtonById;
|
|
84
|
+
setBackgroundColor(color: string): void;
|
|
85
|
+
private isVisible;
|
|
86
|
+
setType(type: 'default' | 'glass-pill'): void;
|
|
87
|
+
getType(): 'default' | 'glass-pill';
|
|
88
|
+
destroy(): void;
|
|
89
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type ButtonType = 'button' | 'menu';
|
|
2
|
+
/** 按钮组样式类型 */
|
|
3
|
+
export type ButtonGroupType = 'default' | 'glass-pill';
|
|
4
|
+
/** 按钮配置 */
|
|
5
|
+
export interface ButtonConfig {
|
|
6
|
+
id: string;
|
|
7
|
+
type: ButtonType;
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
keepActive?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 是否互斥(开关互斥)
|
|
13
|
+
*
|
|
14
|
+
* 行为说明:
|
|
15
|
+
* - 当按钮从“未激活”切换到“激活”时,如果该按钮开启了 exclusive,
|
|
16
|
+
* 会自动关闭同互斥范围内的其它已激活按钮,并触发它们的 onClick(用于执行关闭逻辑)。
|
|
17
|
+
* - 一级按钮:互斥范围 = 同 groupId 下的一级按钮
|
|
18
|
+
* - 二级按钮:互斥范围 = 同 groupId 且同 parentId 下的二级按钮
|
|
19
|
+
*
|
|
20
|
+
* 注意:该能力通常与 keepActive 搭配使用。
|
|
21
|
+
*/
|
|
22
|
+
exclusive?: boolean;
|
|
23
|
+
isActive?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
onClick?: (button: OptButton) => void;
|
|
26
|
+
children?: ButtonConfig[];
|
|
27
|
+
groupId?: string;
|
|
28
|
+
parentId?: string;
|
|
29
|
+
/** 按钮内部图标文字排列 (默认 vertical,即图标在上) */
|
|
30
|
+
align?: ButtonAlign;
|
|
31
|
+
/** 图标大小 (正方形,单位 px,默认 32) */
|
|
32
|
+
iconSize?: number;
|
|
33
|
+
/** 按钮最小宽度 (单位 px,默认 50) */
|
|
34
|
+
minWidth?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface OptButton extends ButtonConfig {
|
|
37
|
+
children?: OptButton[];
|
|
38
|
+
}
|
|
39
|
+
export interface ButtonGroup {
|
|
40
|
+
id: string;
|
|
41
|
+
buttons: OptButton[];
|
|
42
|
+
}
|
|
43
|
+
export interface ButtonGroupColors {
|
|
44
|
+
backgroundColor?: string;
|
|
45
|
+
btnBackgroundColor?: string;
|
|
46
|
+
btnHoverColor?: string;
|
|
47
|
+
btnActiveColor?: string;
|
|
48
|
+
iconColor?: string;
|
|
49
|
+
iconActiveColor?: string;
|
|
50
|
+
textColor?: string;
|
|
51
|
+
textActiveColor?: string;
|
|
52
|
+
}
|
|
53
|
+
/** 弹窗/按钮组位置 */
|
|
54
|
+
export type GroupPosition = 'center' | 'top-left' | 'top-center' | 'top-right' | 'left-center' | 'right-center' | 'bottom-left' | 'bottom-center' | 'bottom-right' | {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
} | 'static';
|
|
58
|
+
/** 按钮组排列方向 (Flex-direction) */
|
|
59
|
+
export type GroupDirection = 'row' | 'column';
|
|
60
|
+
/** 按钮内部文字图标排列 */
|
|
61
|
+
export type ButtonAlign = 'vertical' | 'horizontal';
|
|
62
|
+
/** 二级菜单展开方向 */
|
|
63
|
+
export type ExpandDirection = 'up' | 'down' | 'left' | 'right';
|
|
64
|
+
export interface ButtonGroupOptions extends ButtonGroupColors {
|
|
65
|
+
container: HTMLElement | string;
|
|
66
|
+
/** 样式类型 (默认 'default') */
|
|
67
|
+
type?: ButtonGroupType;
|
|
68
|
+
/** 屏幕位置 (如 top-left) */
|
|
69
|
+
position?: GroupPosition;
|
|
70
|
+
/** 按钮组排列方向 (默认 row) */
|
|
71
|
+
direction?: GroupDirection;
|
|
72
|
+
/** 按钮内部图标文字排列 (默认 vertical) */
|
|
73
|
+
align?: ButtonAlign;
|
|
74
|
+
/** 菜单展开方向 */
|
|
75
|
+
expand?: ExpandDirection;
|
|
76
|
+
showLabel?: boolean;
|
|
77
|
+
visibility?: Record<string, boolean>;
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface ClickPayload {
|
|
81
|
+
button: OptButton;
|
|
82
|
+
action: 'activate' | 'deactivate' | 'trigger';
|
|
83
|
+
isActive?: boolean;
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const infoIcon = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z\" fill=\"currentColor\"/><path d=\"M464 336a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z\" fill=\"currentColor\"/></svg>";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CollapseOptions } from './types';
|
|
2
|
+
import { IBimComponent } from '../../types/component';
|
|
3
|
+
import { ThemeConfig } from '../../themes/types';
|
|
4
|
+
/**
|
|
5
|
+
* 折叠面板组件
|
|
6
|
+
*/
|
|
7
|
+
export declare class BimCollapse implements IBimComponent {
|
|
8
|
+
private element;
|
|
9
|
+
private options;
|
|
10
|
+
private items;
|
|
11
|
+
private activeIds;
|
|
12
|
+
private unsubscribeLocale;
|
|
13
|
+
private unsubscribeTheme;
|
|
14
|
+
constructor(options: CollapseOptions);
|
|
15
|
+
init(): void;
|
|
16
|
+
toggleItem(id: string): void;
|
|
17
|
+
private refreshState;
|
|
18
|
+
setTheme(theme: ThemeConfig): void;
|
|
19
|
+
setLocales(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface CollapseItemConfig {
|
|
2
|
+
/** 唯一标识符 */
|
|
3
|
+
id: string;
|
|
4
|
+
/** 标题文本的翻译键 (例如 'panel.attributes') */
|
|
5
|
+
title: string;
|
|
6
|
+
/** 内容: HTML字符串 或 HTMLElement */
|
|
7
|
+
content: string | HTMLElement;
|
|
8
|
+
/** 标题栏左侧图标 (SVG 字符串, 可选) */
|
|
9
|
+
icon?: string;
|
|
10
|
+
/** 标题栏右侧额外内容 (可选) */
|
|
11
|
+
extra?: string | HTMLElement;
|
|
12
|
+
/** 是否禁用 */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** 自定义类名 */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CollapseOptions {
|
|
18
|
+
/** 挂载容器 */
|
|
19
|
+
container: HTMLElement | string;
|
|
20
|
+
/** 面板项列表 */
|
|
21
|
+
items: CollapseItemConfig[];
|
|
22
|
+
/** 是否开启手风琴模式 (默认 false) */
|
|
23
|
+
accordion?: boolean;
|
|
24
|
+
/** 初始展开的面板 ID 列表 */
|
|
25
|
+
activeIds?: string[];
|
|
26
|
+
/** 是否显示边框 (默认 true) */
|
|
27
|
+
bordered?: boolean;
|
|
28
|
+
/** 是否幽灵模式 (默认 false) */
|
|
29
|
+
ghost?: boolean;
|
|
30
|
+
/** 自定义类名 */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** 切换面板时的回调 */
|
|
33
|
+
onChange?: (activeIds: string[]) => void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DescriptionOptions, DescriptionItem } from './types';
|
|
2
|
+
import { IBimComponent } from '../../types/component';
|
|
3
|
+
import { ThemeConfig } from '../../themes/types';
|
|
4
|
+
/**
|
|
5
|
+
* 描述列表组件
|
|
6
|
+
* 用于展示一组 Key-Value 数据
|
|
7
|
+
* 注意:本组件为纯展示组件,不处理国际化,请在外部传入处理好的文本。
|
|
8
|
+
*/
|
|
9
|
+
export declare class BimDescription implements IBimComponent {
|
|
10
|
+
private element;
|
|
11
|
+
private options;
|
|
12
|
+
private unsubscribeTheme;
|
|
13
|
+
constructor(options: DescriptionOptions);
|
|
14
|
+
init(): void;
|
|
15
|
+
private createDom;
|
|
16
|
+
private applyCustomStyles;
|
|
17
|
+
private renderItems;
|
|
18
|
+
/**
|
|
19
|
+
* 动态更新数据
|
|
20
|
+
*/
|
|
21
|
+
setItems(items: DescriptionItem[]): void;
|
|
22
|
+
setTheme(theme: ThemeConfig): void;
|
|
23
|
+
setLocales(): void;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 描述列表项配置
|
|
3
|
+
*/
|
|
4
|
+
export interface DescriptionItem {
|
|
5
|
+
/** 标签文本 (直接显示,组件内部不翻译) */
|
|
6
|
+
label: string;
|
|
7
|
+
/** 内容文本或元素 */
|
|
8
|
+
value: string | HTMLElement;
|
|
9
|
+
/** 行级自定义标签颜色 */
|
|
10
|
+
labelColor?: string;
|
|
11
|
+
/** 行级自定义内容颜色 */
|
|
12
|
+
valueColor?: string;
|
|
13
|
+
/** 自定义类名 */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 描述列表组件配置
|
|
18
|
+
*/
|
|
19
|
+
export interface DescriptionOptions {
|
|
20
|
+
/** 挂载容器 */
|
|
21
|
+
container: HTMLElement | string;
|
|
22
|
+
/** 数据项列表 */
|
|
23
|
+
items: DescriptionItem[];
|
|
24
|
+
/**
|
|
25
|
+
* 是否显示边框 (默认 false)
|
|
26
|
+
* 开启后,将显示行间分割线以及 Key-Value 之间的纵向分割线
|
|
27
|
+
*/
|
|
28
|
+
bordered?: boolean;
|
|
29
|
+
/** 标签固定宽度 (例如 '80px'),若不设置则自适应 */
|
|
30
|
+
labelWidth?: string;
|
|
31
|
+
/** 全局标签颜色 */
|
|
32
|
+
labelColor?: string;
|
|
33
|
+
/** 全局内容颜色 */
|
|
34
|
+
valueColor?: string;
|
|
35
|
+
/** 全局字体大小 */
|
|
36
|
+
fontSize?: string;
|
|
37
|
+
/** 标签内边距 (默认 '0 4px') */
|
|
38
|
+
labelPadding?: string;
|
|
39
|
+
/** 内容内边距 (默认 '0 4px') */
|
|
40
|
+
valuePadding?: string;
|
|
41
|
+
/** 自定义类名 */
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DialogOptions } from './index.type';
|
|
2
|
+
import { ThemeConfig } from '../../themes/types';
|
|
3
|
+
import { IBimComponent } from '../../types/component';
|
|
4
|
+
/**
|
|
5
|
+
* 通用弹窗组件类
|
|
6
|
+
* 支持拖拽、缩放、自定义内容和位置。
|
|
7
|
+
*/
|
|
8
|
+
export declare class BimDialog implements IBimComponent {
|
|
9
|
+
private element;
|
|
10
|
+
private options;
|
|
11
|
+
private container;
|
|
12
|
+
private header;
|
|
13
|
+
private contentArea;
|
|
14
|
+
private _isDestroyed;
|
|
15
|
+
private _isInitialized;
|
|
16
|
+
private unsubscribeTheme;
|
|
17
|
+
private unsubscribeLocale;
|
|
18
|
+
private rafId;
|
|
19
|
+
/**
|
|
20
|
+
* 构造函数
|
|
21
|
+
* @param options 弹窗配置选项
|
|
22
|
+
*/
|
|
23
|
+
constructor(options: DialogOptions);
|
|
24
|
+
/**
|
|
25
|
+
* 设置主题
|
|
26
|
+
* @param theme 全局主题配置
|
|
27
|
+
*/
|
|
28
|
+
setTheme(theme: ThemeConfig): void;
|
|
29
|
+
/**
|
|
30
|
+
* 初始化组件功能 (接口实现)
|
|
31
|
+
*/
|
|
32
|
+
init(): void;
|
|
33
|
+
setLocales(): void;
|
|
34
|
+
/**
|
|
35
|
+
* 创建弹窗的 DOM 结构
|
|
36
|
+
*/
|
|
37
|
+
private createDom;
|
|
38
|
+
/**
|
|
39
|
+
* 设置元素尺寸
|
|
40
|
+
*/
|
|
41
|
+
private setSize;
|
|
42
|
+
/**
|
|
43
|
+
* 根据内容自动调整弹窗宽度
|
|
44
|
+
* @param recenter 是否重新计算定位(例如保持居中),默认 true
|
|
45
|
+
*/
|
|
46
|
+
fitWidth(recenter?: boolean): void;
|
|
47
|
+
/**
|
|
48
|
+
* 根据内容自动调整弹窗高度
|
|
49
|
+
*
|
|
50
|
+
* 设计说明:
|
|
51
|
+
* - 主要用于“内容展开/收起”场景(比如测量面板展开后,Dialog 高度跟随变化)
|
|
52
|
+
* - 默认不改变用户拖拽后的当前位置,只做边界夹紧,避免弹窗超出容器
|
|
53
|
+
*
|
|
54
|
+
* @param recenter 是否根据 options.position 重新定位(默认 false)
|
|
55
|
+
*/
|
|
56
|
+
fitHeight(recenter?: boolean): void;
|
|
57
|
+
/**
|
|
58
|
+
* 边界夹紧:保持当前 left/top 不变的前提下,确保弹窗不超出容器
|
|
59
|
+
* 说明:用于 fitHeight / fitWidth 后的"尺寸变化"场景,避免弹窗被裁切。
|
|
60
|
+
*/
|
|
61
|
+
private clampToContainer;
|
|
62
|
+
/**
|
|
63
|
+
* 初始化弹窗位置
|
|
64
|
+
*/
|
|
65
|
+
private initPosition;
|
|
66
|
+
/**
|
|
67
|
+
* 初始化拖拽功能 (性能优化 + 解决粘手)
|
|
68
|
+
*/
|
|
69
|
+
private initDrag;
|
|
70
|
+
/**
|
|
71
|
+
* 初始化缩放功能 (性能优化 + 解决粘手)
|
|
72
|
+
*/
|
|
73
|
+
private initResize;
|
|
74
|
+
/**
|
|
75
|
+
* 动态设置内容
|
|
76
|
+
* @param content 内容元素或 HTML 字符串
|
|
77
|
+
*/
|
|
78
|
+
setContent(content: HTMLElement | string): void;
|
|
79
|
+
/**
|
|
80
|
+
* 关闭弹窗并销毁
|
|
81
|
+
*/
|
|
82
|
+
close(): void;
|
|
83
|
+
/**
|
|
84
|
+
* 销毁组件 (接口实现)
|
|
85
|
+
*/
|
|
86
|
+
destroy(): void;
|
|
87
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 弹窗位置类型定义
|
|
3
|
+
* 可以是预设的字符串位置(如 'center', 'top-left' 等),
|
|
4
|
+
* 也可以是具体的坐标对象 { x, y }
|
|
5
|
+
*/
|
|
6
|
+
export type DialogPosition = 'center' | 'top-left' | 'top-center' | 'top-right' | 'left-center' | 'right-center' | 'bottom-left' | 'bottom-center' | 'bottom-right' | {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 弹窗颜色配置
|
|
12
|
+
*/
|
|
13
|
+
export interface DialogColors {
|
|
14
|
+
/** 窗体背景颜色,默认 rgba(17, 17, 17, 0.95) */
|
|
15
|
+
backgroundColor?: string;
|
|
16
|
+
/** 标题栏背景颜色,默认 #2a2a2a */
|
|
17
|
+
headerBackgroundColor?: string;
|
|
18
|
+
/** 标题文字颜色,默认 #fff */
|
|
19
|
+
titleColor?: string;
|
|
20
|
+
/** 内容文字颜色,默认 #ccc */
|
|
21
|
+
textColor?: string;
|
|
22
|
+
/** 边框颜色,默认 #444 */
|
|
23
|
+
borderColor?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 弹窗配置选项接口
|
|
27
|
+
*/
|
|
28
|
+
export interface DialogOptions extends DialogColors {
|
|
29
|
+
/** 弹窗挂载的父容器 */
|
|
30
|
+
container: HTMLElement;
|
|
31
|
+
/** 弹窗标题 */
|
|
32
|
+
title?: string;
|
|
33
|
+
/** 弹窗内容,支持 HTML 字符串或 HTMLElement */
|
|
34
|
+
content?: HTMLElement | string;
|
|
35
|
+
/** 弹窗宽度,数字(像素)或字符串(如 '50%') */
|
|
36
|
+
width?: number | string;
|
|
37
|
+
/** 弹窗高度 */
|
|
38
|
+
height?: number | string;
|
|
39
|
+
/** 弹窗位置 */
|
|
40
|
+
position?: DialogPosition;
|
|
41
|
+
/** 是否可拖拽 */
|
|
42
|
+
draggable?: boolean;
|
|
43
|
+
/** 是否可调整大小 */
|
|
44
|
+
resizable?: boolean;
|
|
45
|
+
/** 最小宽度限制 */
|
|
46
|
+
minWidth?: number;
|
|
47
|
+
/** 最小高度限制 */
|
|
48
|
+
minHeight?: number;
|
|
49
|
+
/** 底部偏移量(用于避开底部工具栏),默认 70px */
|
|
50
|
+
bottomOffset?: number;
|
|
51
|
+
/** 关闭时的回调函数 */
|
|
52
|
+
onClose?: () => void;
|
|
53
|
+
/** 打开时的回调函数 */
|
|
54
|
+
onOpen?: () => void;
|
|
55
|
+
/** 弹窗唯一标识 ID (可选) */
|
|
56
|
+
id?: string;
|
|
57
|
+
}
|