工具箱类
用于工具箱的类。创建工具箱的 DOM。
Signature:
export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeyboardAccessible, IStyleable, IToolbox
扩展:DeleteArea
实现:IAutoHideable、IKeyboardAccessible、IStyleable、IToolbox
构造函数
构造函数 | 修饰符 | 说明 |
---|---|---|
(构造函数)(工作区) | 构造 Toolbox 类的新实例 |
属性
媒体资源 | 修饰符 | 类型 | 说明 |
---|---|---|---|
boundEvents_ | protected |
browserEvents.Data[] | 包含解除绑定事件处理脚本所需的信息的数组。用于处置。例如:[[node, name, func], [node, name, func]]。 |
contentMap_ | protected |
{ [key: string]: IToolboxItem; } | |
contents_ | protected |
IToolboxItem[] | 工具箱中的项目列表。 |
contentsDiv_ | protected |
HTMLDivElement | null | 用于存放工具箱内容的 HTML 容器。 |
height_ | protected |
number | 工具箱的高度。 |
HtmlDiv | HTMLDivElement | null | 工具箱的 HTML 容器。 | |
ID [id] | string | 用于向 ComponentManager 注册的此组件的唯一 ID。 | |
isVisible_ | protected |
boolean | Toolbox 是否可见。 |
previouslySelectedItem_ | protected |
ISelectableToolboxItem | null | 之前选择的项。 |
RTL | boolean | ||
selectedItem_ | protected |
ISelectableToolboxItem | null | 当前选择的项。 |
toolboxDef_ | protected |
toolbox.ToolboxInfo | |
toolboxPosition | toolbox.Position | ||
width_ | protected |
number | 工具箱的宽度。 |
workspace_ |
|
WorkspaceSvg | 此工具箱所在的工作区。 |
方法
方法 | 修饰符 | 说明 |
---|---|---|
addToolboxItem_(toolboxItem) | protected |
向工具箱中添加项。 |
AttachEvents_(container, CONTENTContainer) | protected |
向工具箱容器 div 添加事件监听器。 |
autoHide(onlyClosePopups) | 隐藏组件。在 WorkspaceSvg.hideChaff 中调用。 | |
clearSelection() | 取消突出显示之前选择的所有项。 | |
createContainer_() | protected |
为工具箱创建容器 div。 |
createContentsContainer_() | protected |
为工具箱中的所有内容创建容器。 |
createDom_(workspace) | protected |
为工具箱创建 DOM。 |
createFlyout_() | protected |
根据工具箱布局创建浮出控件。 |
deselectItem_(item) | protected |
取消选择给定项,将其标记为未选择,并更新 aria 状态。 |
dispose() | 处置此工具箱。 | |
getClientRect() | 返回相对于视口的拖动目标区域的边界矩形(以像素为单位)。 | |
getFlyout() | 获取工具箱浮出控件。 | |
getHeight() | 获取工具箱的高度。 | |
getPreviouslySelectedItem() | 获取之前选择的项。 | |
getSelectedItem() | 获取所选内容。 | |
getToolboxItemById(id) | 获取具有指定 ID 的工具箱项。 | |
getToolboxItems() | 获取工具箱中的项。 | |
getWidth() | 获取工具箱的宽度。 | |
getWorkspace() | 获取工具箱的工作区。 | |
init() | 初始化工具箱 | |
isHorizontal() | 获取工具箱是否处于水平状态。 | |
onClick_(e) | protected |
处理点击工具箱或工具箱项时的点击事件。 |
onDragEnter(_dragElement) | 处理带有块或气泡的光标进入此拖动目标的情况。 | |
onDragExit(_dragElement) | 处理带有块或气泡的光标离开此拖动目标的情况。 | |
onDrop(_dragElement) | 处理在此组件上掉落块或气泡的情况。此处不应处理删除。 | |
onKeyDown_(e) | protected |
处理工具箱的按键按下事件。 |
onShortcut(_shortcut) | 处理指定的键盘快捷键。 | |
position() | 根据工具箱是否为水平工具箱以及工作区是否为 RTL 来确定工具箱的位置。 | |
refreshSelection() | 更新浮出控件的内容,而不关闭它。应该用于响应某个动态类别(如变量或过程)发生的变化。 | |
renderContents_(toolboxDef) | protected |
将工具箱中的所有项添加到工具箱中。 |
selectItem_(oldItem, newItem) | protected |
选择给定项,将其标记为选定,并更新 aria 状态。 |
selectItemByPosition(position) | 根据工具箱项在工具箱项列表中的位置选择工具箱项。 | |
setSelectedItem(newItem) | 将指定项设置为选中状态。如果内容不可选择,则不执行任何操作。 | |
setVisible(isVisible) | 显示或隐藏工具箱。 | |
shouldDeselectItem_(oldItem, newItem) | protected |
决定是否取消选择旧内容。 |
shouldSelectItem_(oldItem, newItem) | protected |
决定是否应选择新项。 |
updateCursorDeleteStyle_(addStyle) | protected |
根据在放下块或气泡后预计是否会删除光标在工具箱上的 CSS 样式(使用内部 this. elseDelete_ 属性),添加或移除了光标的 CSS 样式。 |
updateFlyout_(oldItem, newItem) | protected |
根据所选项,决定是隐藏还是显示浮出控件。 |
updateWouldDelete_(wouldDelete) | protected |
更新内部 WillDelete_ 状态。 |
wouldDelete(element, _couldConnect) | 返回如果将提供的方块或气泡拖放到此区域,是否会被删除。此方法应检查元素是否可删除,以及是否始终在 onDragEnter/onDragOver/onDragExit 之前调用。 |