Class: FolderTreeService
molecule.FolderTreeService
Hierarchy
↳
FolderTreeService
Implements
Constructors
constructor
• new FolderTreeService()
Overrides
Defined in
services/workbench/explorer/folderTreeService.ts:184
Properties
builtinService
• Private Readonly builtinService: IBuiltinService
Defined in
services/workbench/explorer/folderTreeService.ts:180
explorerService
• Private Readonly explorerService: IExplorerService
Defined in
services/workbench/explorer/folderTreeService.ts:179
fileContextMenu
• Private fileContextMenu: IMenuItemProps[] = []
Defined in
services/workbench/explorer/folderTreeService.ts:181
folderContextMenu
• Private folderContextMenu: IMenuItemProps[] = []
Defined in
services/workbench/explorer/folderTreeService.ts:182
state
• Protected state: IFolderTree
Implementation of
Overrides
Defined in
services/workbench/explorer/folderTreeService.ts:178
Methods
add
▸ add(data, id?): void
Add data into folder tree
Parameters
| Name | Type |
|---|---|
data | IFolderTreeNodeProps |
id? | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:380
addRootFolder
▸ Private addRootFolder(folder): void
Parameters
| Name | Type |
|---|---|
folder | IFolderTreeNodeProps |
Returns
void
Defined in
services/workbench/explorer/folderTreeService.ts:315
count
▸ count(name): number
Count the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Event name |
Returns
number
Implementation of
Inherited from
Defined in
emit
▸ emit(name, ...args): void
Emit the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Event name |
...args | any | Arguments |
Returns
void
Implementation of
Inherited from
Defined in
forceUpdate
▸ forceUpdate(): void
Force to update the Component
Returns
void
Implementation of
IFolderTreeService.forceUpdate
Inherited from
Defined in
get
▸ get(id): null | IFolderTreeNodeProps
Get specific data in folder tree
Parameters
| Name | Type |
|---|---|
id | UniqueId |
Returns
null | IFolderTreeNodeProps
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:490
getCurrentRootFolderInfo
▸ Private getCurrentRootFolderInfo(id): { currentRootFolder: null = null; index: number = -1; tree: null = null } | { currentRootFolder: IFolderTreeNodeProps ; index: number ; tree: TreeViewUtil<IFolderTreeNodeProps> }
Parameters
| Name | Type |
|---|---|
id | UniqueId |
Returns
{ currentRootFolder: null = null; index: number = -1; tree: null = null } | { currentRootFolder: IFolderTreeNodeProps ; index: number ; tree: TreeViewUtil<IFolderTreeNodeProps> }
Defined in
services/workbench/explorer/folderTreeService.ts:344
getExpandKeys
▸ getExpandKeys(): UniqueId[]
Get the expandKeys in folderTree
Returns
UniqueId[]
Implementation of
IFolderTreeService.getExpandKeys
Defined in
services/workbench/explorer/folderTreeService.ts:264
getFileContextMenu
▸ getFileContextMenu(): IMenuItemProps[]
Get the context menus for file
Returns
Implementation of
IFolderTreeService.getFileContextMenu
Defined in
services/workbench/explorer/folderTreeService.ts:239
getFolderContextMenu
▸ getFolderContextMenu(): IMenuItemProps[]
Get the context menus for folder
Returns
Implementation of
IFolderTreeService.getFolderContextMenu
Defined in
services/workbench/explorer/folderTreeService.ts:256
getLoadedKeys
▸ getLoadedKeys(): string[]
Get the loadedKeys for folderTree
Returns
string[]
Implementation of
IFolderTreeService.getLoadedKeys
Defined in
services/workbench/explorer/folderTreeService.ts:275
getParentNode
▸ getParentNode(id): null | IFolderTreeNodeProps
get the current treeNode's parentNode
Parameters
| Name | Type |
|---|---|
id | UniqueId |
Returns
null | IFolderTreeNodeProps
Implementation of
IFolderTreeService.getParentNode
Defined in
services/workbench/explorer/folderTreeService.ts:243
getPosOfType
▸ Private getPosOfType(type, folderList): number
Parameters
| Name | Type |
|---|---|
type | "File" | "Folder" | "RootFolder" |
folderList | IFolderTreeNodeProps[] |
Returns
number
Defined in
services/workbench/explorer/folderTreeService.ts:365
getRootFolderById
▸ Private getRootFolderById(id): null | IFolderTreeNodeProps
Returns the node of root folder in folderTree
Parameters
| Name | Type |
|---|---|
id | UniqueId |
Returns
null | IFolderTreeNodeProps
Defined in
services/workbench/explorer/folderTreeService.ts:303
getRootFolderIndex
▸ Private getRootFolderIndex(id): number
Parameters
| Name | Type |
|---|---|
id | UniqueId |
Returns
number
Defined in
services/workbench/explorer/folderTreeService.ts:338
getState
▸ getState(): IFolderTree
Get the Component state
Returns
Implementation of
Inherited from
Defined in
isHiddenFile
▸ Private isHiddenFile(file): boolean
Parameters
| Name | Type |
|---|---|
file | IFolderTreeNodeProps |
Returns
boolean
Defined in
services/workbench/explorer/folderTreeService.ts:191
onContextMenu
▸ onContextMenu(callback): void
Listen to the click event about the context menu except for built-in menus
Parameters
| Name | Type |
|---|---|
callback | (contextMenu: IMenuItemProps, treeNode?: IFolderTreeNodeProps) => void |
Returns
void
Implementation of
IFolderTreeService.onContextMenu
Defined in
services/workbench/explorer/folderTreeService.ts:561
onCreate
▸ onCreate(callback): void
Listen to create a node for folder tree
Parameters
| Name | Type |
|---|---|
callback | (type: "File" | "Folder" | "RootFolder", nodeId?: UniqueId) => void |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:555
onDropTree
▸ onDropTree(callback): void
Listen to drop event
Parameters
| Name | Type |
|---|---|
callback | (source: IFolderTreeNodeProps, target: IFolderTreeNodeProps) => void |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:537
onExpandKeys
▸ onExpandKeys(callback): void
Callback for expanding tree node
Parameters
| Name | Type |
|---|---|
callback | (expandKeys: UniqueId[]) => void |
Returns
void
Implementation of
IFolderTreeService.onExpandKeys
Defined in
services/workbench/explorer/folderTreeService.ts:579
onLoadData
▸ onLoadData(callback): void
Callback for load folder tree data
Parameters
| Name | Type |
|---|---|
callback | (treeNode: IFolderTreeNodeProps, callback: (treeNode: IFolderTreeNodeProps) => void) => void |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:570
onRemove
▸ onRemove(callback): void
Listen to remove a node
Parameters
| Name | Type |
|---|---|
callback | (id: UniqueId) => void |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:525
onRename
▸ onRename(callback): void
Listen to event about clicking rename button
Parameters
| Name | Type |
|---|---|
callback | (id: UniqueId) => void |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:521
onRightClick
▸ onRightClick(callback): void
Listen to right click event
Parameters
| Name | Type |
|---|---|
callback | (treeData: IFolderTreeNodeProps, menus: IMenuItemProps[]) => void |
Returns
void
Implementation of
IFolderTreeService.onRightClick
Defined in
services/workbench/explorer/folderTreeService.ts:546
onSelectFile
▸ onSelectFile(callback): void
Listen to select a file
Parameters
| Name | Type |
|---|---|
callback | (file: IFolderTreeNodeProps) => void |
Returns
void
Implementation of
IFolderTreeService.onSelectFile
Defined in
services/workbench/explorer/folderTreeService.ts:533
onUpdateFileName
▸ onUpdateFileName(callback): void
Listen to update file or folder name
Parameters
| Name | Type |
|---|---|
callback | (file: IFolderTreeNodeProps) => void |
Returns
void
Implementation of
IFolderTreeService.onUpdateFileName
Defined in
services/workbench/explorer/folderTreeService.ts:529
onUpdateState
▸ onUpdateState(listener): void
Listen to the Component state update event
Parameters
| Name | Type |
|---|---|
listener | (prevState: IFolderTree, nextState: IFolderTree) => void |
Returns
void
Implementation of
IFolderTreeService.onUpdateState
Inherited from
Defined in
remove
▸ remove(id): void
Remove specific data in folder tree
Parameters
| Name | Type |
|---|---|
id | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:436
removeOnUpdateState
▸ removeOnUpdateState(listener?): void
Remove the Component update event listening, default is remove all, also you can remove one by pass the listener
Parameters
| Name | Type |
|---|---|
listener? | Function |
Returns
void
Implementation of
IFolderTreeService.removeOnUpdateState
Inherited from
Defined in
render
▸ render(nextState?): void
Initiative notify the component to render the view by the state
Parameters
| Name | Type |
|---|---|
nextState? | IFolderTree |
Returns
void
Implementation of
Inherited from
Defined in
reset
▸ reset(): void
Reset the FolderTreeService state
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:227
setActive
▸ setActive(id?): void
Active specific node, or unactive any node in folder tree
Parameters
| Name | Type |
|---|---|
id? | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:501
setCurrentFolderLocation
▸ Private setCurrentFolderLocation(data, id): void
Parameters
| Name | Type |
|---|---|
data | IFolderTreeNodeProps |
id | UniqueId |
Returns
void
Defined in
services/workbench/explorer/folderTreeService.ts:286
setEntry
▸ setEntry(entry): void
Set a entry page for folder tree
Parameters
| Name | Type |
|---|---|
entry | ReactNode |
Returns
void
Implementation of
Defined in
services/workbench/explorer/folderTreeService.ts:515
setExpandKeys
▸ setExpandKeys(expandKeys): void
Set the expandKeys for folderTree
Parameters
| Name | Type |
|---|---|
expandKeys | UniqueId[] |
Returns
void
Implementation of
IFolderTreeService.setExpandKeys
Defined in
services/workbench/explorer/folderTreeService.ts:268
setFileContextMenu
▸ setFileContextMenu(menus): void
Set the context menus for file
Parameters
| Name | Type |
|---|---|
menus | IMenuItemProps[] |
Returns
void
Implementation of
IFolderTreeService.setFileContextMenu
Defined in
services/workbench/explorer/folderTreeService.ts:252
setFolderContextMenu
▸ setFolderContextMenu(menus): void
Set the context menus for folder
Parameters
| Name | Type |
|---|---|
menus | IMenuItemProps[] |
Returns
void
Implementation of
IFolderTreeService.setFolderContextMenu
Defined in
services/workbench/explorer/folderTreeService.ts:260
setLoadedKeys
▸ setLoadedKeys(loadedKeys): void
Set the loadedKeys for folderTree
Parameters
| Name | Type |
|---|---|
loadedKeys | string[] |
Returns
void
Implementation of
IFolderTreeService.setLoadedKeys
Defined in
services/workbench/explorer/folderTreeService.ts:279
setState
▸ setState(values, callback?): void
Set the state values, and notify the view component to re render
Parameters
| Name | Type | Description |
|---|---|---|
values | Partial<IFolderTree> | update target state values |
callback? | (prevState: IFolderTree, nextState: IFolderTree) => void | - |
Returns
void
Implementation of
Inherited from
Defined in
sortTree
▸ Private sortTree(tree): void
Parameters
| Name | Type |
|---|---|
tree | IFolderTreeNodeProps[] |
Returns
void
Defined in
services/workbench/explorer/folderTreeService.ts:195
subscribe
▸ subscribe(name, listener): void
Subscribe the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | string[] | Event name |
listener | Function | Listener function |
Returns
void
Implementation of
Inherited from
Defined in
toggleAutoSort
▸ toggleAutoSort(): void
Toggle whether to enable sorting, which is disabled by default.
Returns
void
Implementation of
IFolderTreeService.toggleAutoSort
Defined in
services/workbench/explorer/folderTreeService.ts:583
unsubscribe
▸ unsubscribe(name, listener?): void
Unsubscribe the specific event and the listener function
Parameters
| Name | Type | Description |
|---|---|---|
name | any | The event name |
listener? | Function | optional, it unsubscribes events via name if not pass the listener function |
Returns
void
Implementation of
IFolderTreeService.unsubscribe
Inherited from
Defined in
update
▸ update(data): void
Update specific data in folder tree
Parameters
| Name | Type |
|---|---|
data | IFolderTreeNodeProps |
Returns
void