工具箱類別
工具箱的類別。建立工具箱的 DOM。
Signature:
export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeyboardAccessible, IStyleable, IToolbox, IFocusableNode
擴充: DeleteArea
實作: IAutoHideable、IKeyboardAccessible、IStyleable、IToolbox、IFocusableNode
建構函式
建構函式 | 修飾符 | 說明 |
---|---|---|
(建構函式)(工作區) | 建構 Toolbox 類別的新例項 |
屬性
屬性 | 修飾符 | 類型 | 說明 |
---|---|---|---|
boundEvents_ | protected |
browserEvents.Data[] | 這個陣列會保留取消繫結事件處理常式所需的資訊。用於處置。例如:[[node, name, func], [node, name, func]]。 |
內容 | protected |
Map<string, IToolboxItem> | 從 ID 對應到對應的工具箱項目。 |
contentsDiv_ | protected |
HTMLDivElement | null | 工具箱內容的 HTML 容器。 |
height_ | protected |
數字 | 工具箱的高度。 |
HtmlDiv | HTMLDivElement | null | 工具箱的 HTML 容器。 | |
id | 字串 | 這個元件的專屬 ID,用於向 ComponentManager 註冊。 | |
isVisible_ | protected |
布林值 | 工具箱是否顯示。 |
previouslySelectedItem_ | protected |
ISelectableToolboxItem | null | 先前選取的項目。 |
RTL | 布林值 | ||
selectedItem_ | protected |
ISelectableToolboxItem | null | 目前選取的項目。 |
toolboxDef_ | protected |
toolbox.ToolboxInfo | |
toolboxPosition | toolbox.Position | ||
width_ | protected |
數字 | 工具箱的寬度。 |
workspace_ |
|
WorkspaceSvg | 工具箱所在的工作區。 |
方法
方法 | 修飾符 | 說明 |
---|---|---|
addToolboxItem_(toolboxItem) | protected |
將項目新增至工具箱。 |
attachEvents_(container, contentsContainer) | protected |
將事件監聽器新增至工具箱容器 div。 |
autoHide(onlyClosePopups) | 隱藏元件。Called in WorkspaceSvg.hideChaff. | |
canBeFocused() | 請參閱 IFocusableNode.canBeFocused。 | |
clearSelection() | 取消醒目顯示先前選取的項目。 | |
createContainer_() | protected |
建立工具箱的容器 div。 |
createContentsContainer_() | protected |
為工具箱中的所有內容建立容器。 |
createDom_(workspace) | protected |
建立工具箱的 DOM。 |
createFlyout_() | protected |
根據工具箱版面配置建立彈出式視窗。 |
deselectItem_(item) | protected |
取消選取指定項目、將其標示為未選取,並更新 aria 狀態。 |
dispose() | 處置這個工具箱。 | |
getClientRect() | 傳回拖曳目標區域的邊界矩形,以相對於可視區域的像素單位表示。 | |
getFlyout() | 取得工具箱彈出式視窗。 | |
getFocusableElement() | 請參閱 IFocusableNode.getFocusableElement。 | |
getFocusableTree() | 請參閱 IFocusableNode.getFocusableTree。 | |
getHeight() | 取得工具箱的高度。 | |
getNestedTrees() | 請參閱 IFocusableTree.getNestedTrees。 | |
getPreviouslySelectedItem() | 取得先前選取的項目。 | |
getRestoredFocusableNode(previousNode) | 請參閱 IFocusableTree.getRestoredFocusableNode。 | |
getRootFocusableNode() | 請參閱 IFocusableTree.getRootFocusableNode。 | |
getSelectedItem() | 取得所選項目。 | |
getToolboxItemById(id) | 取得具有指定 ID 的工具箱項目。 | |
getToolboxItems() | 取得工具箱中的項目。 | |
getWidth() | 取得工具箱的寬度。 | |
getWorkspace() | 取得工具箱的工作區。 | |
init() | 初始化工具箱 | |
isHorizontal() | 取得工具箱是否為水平。 | |
lookUpFocusableNode(id) | 請參閱 IFocusableTree.lookUpFocusableNode。 | |
onClick_(e) | protected |
處理工具箱或工具箱項目點擊事件。 |
onDragEnter(_dragElement) | 處理游標進入這個拖曳目標 (含有區塊或泡泡) 的情況。 | |
onDragExit(_dragElement) | 處理游標 (含區塊或泡泡) 離開這個拖曳目標時的情況。 | |
onDrop(_dragElement) | 處理方塊或泡泡放置在這個元件上的情況。不應在此處處理刪除作業。 | |
onKeyDown_(e) | protected |
處理工具箱的按鍵按下事件。 |
onNodeBlur() | 請參閱 IFocusableNode.onNodeBlur。 | |
onNodeFocus() | 請參閱 IFocusableNode.onNodeFocus。 | |
onShortcut(_shortcut) | 處理指定的鍵盤快速鍵。 | |
onTreeBlur(nextTree) | 請參閱 IFocusableTree.onTreeBlur。 | |
onTreeFocus(node, _previousTree) | 請參閱 IFocusableTree.onTreeFocus。 | |
position() | 根據工具箱是否為水平工具箱,以及工作區是否為從右到左的語言,放置工具箱。 | |
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 |
根據方塊或泡泡是否預期會在放置時刪除 (使用內部 this.wouldDelete_ 屬性),在工具箱上方的游標新增或移除 CSS 樣式。 |
updateFlyout_(oldItem, newItem) | protected |
根據所選項目決定是否隱藏或顯示飛出式選單。 |
updateWouldDelete_(wouldDelete) | protected |
更新內部 wouldDelete_ 狀態。 |
wouldDelete(element) | 如果將提供的方塊或泡泡拖曳到這個區域,系統會傳回是否會刪除。這個方法應檢查元素是否可刪除,且一律會在 onDragEnter/onDragOver/onDragExit 之前呼叫。 |