跳到主要内容
版本:1.x

Class: FolderTreeService

molecule.FolderTreeService

Hierarchy​

Implements​

Constructors​

constructor​

• new FolderTreeService()

Overrides​

Component.constructor

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​

IFolderTreeService.state

Overrides​

Component.state

Defined in​

services/workbench/explorer/folderTreeService.ts:178

Methods​

add​

▸ add(data, id?): void

Add data into folder tree

Parameters​

NameType
dataIFolderTreeNodeProps
id?UniqueId

Returns​

void

Implementation of​

IFolderTreeService.add

Defined in​

services/workbench/explorer/folderTreeService.ts:380


addRootFolder​

▸ Private addRootFolder(folder): void

Parameters​

NameType
folderIFolderTreeNodeProps

Returns​

void

Defined in​

services/workbench/explorer/folderTreeService.ts:315


count​

▸ count(name): number

Count the service event

Parameters​

NameTypeDescription
namestringEvent name

Returns​

number

Implementation of​

IFolderTreeService.count

Inherited from​

Component.count

Defined in​

common/event/eventBus.ts:28


emit​

▸ emit(name, ...args): void

Emit the service event

Parameters​

NameTypeDescription
namestringEvent name
...argsanyArguments

Returns​

void

Implementation of​

IFolderTreeService.emit

Inherited from​

Component.emit

Defined in​

common/event/eventBus.ts:20


forceUpdate​

▸ forceUpdate(): void

Force to update the Component

Returns​

void

Implementation of​

IFolderTreeService.forceUpdate

Inherited from​

Component.forceUpdate

Defined in​

react/component.ts:81


get​

▸ get(id): null | IFolderTreeNodeProps

Get specific data in folder tree

Parameters​

NameType
idUniqueId

Returns​

null | IFolderTreeNodeProps

Implementation of​

IFolderTreeService.get

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​

NameType
idUniqueId

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​

IMenuItemProps[]

Implementation of​

IFolderTreeService.getFileContextMenu

Defined in​

services/workbench/explorer/folderTreeService.ts:239


getFolderContextMenu​

▸ getFolderContextMenu(): IMenuItemProps[]

Get the context menus for folder

Returns​

IMenuItemProps[]

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​

NameType
idUniqueId

Returns​

null | IFolderTreeNodeProps

Implementation of​

IFolderTreeService.getParentNode

Defined in​

services/workbench/explorer/folderTreeService.ts:243


getPosOfType​

▸ Private getPosOfType(type, folderList): number

Parameters​

NameType
type"File" | "Folder" | "RootFolder"
folderListIFolderTreeNodeProps[]

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​

NameType
idUniqueId

Returns​

null | IFolderTreeNodeProps

Defined in​

services/workbench/explorer/folderTreeService.ts:303


getRootFolderIndex​

▸ Private getRootFolderIndex(id): number

Parameters​

NameType
idUniqueId

Returns​

number

Defined in​

services/workbench/explorer/folderTreeService.ts:338


getState​

▸ getState(): IFolderTree

Get the Component state

Returns​

IFolderTree

Implementation of​

IFolderTreeService.getState

Inherited from​

Component.getState

Defined in​

react/component.ts:85


isHiddenFile​

▸ Private isHiddenFile(file): boolean

Parameters​

NameType
fileIFolderTreeNodeProps

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​

NameType
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​

NameType
callback(type: "File" | "Folder" | "RootFolder", nodeId?: UniqueId) => void

Returns​

void

Implementation of​

IFolderTreeService.onCreate

Defined in​

services/workbench/explorer/folderTreeService.ts:555


onDropTree​

▸ onDropTree(callback): void

Listen to drop event

Parameters​

NameType
callback(source: IFolderTreeNodeProps, target: IFolderTreeNodeProps) => void

Returns​

void

Implementation of​

IFolderTreeService.onDropTree

Defined in​

services/workbench/explorer/folderTreeService.ts:537


onExpandKeys​

▸ onExpandKeys(callback): void

Callback for expanding tree node

Parameters​

NameType
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​

NameType
callback(treeNode: IFolderTreeNodeProps, callback: (treeNode: IFolderTreeNodeProps) => void) => void

Returns​

void

Implementation of​

IFolderTreeService.onLoadData

Defined in​

services/workbench/explorer/folderTreeService.ts:570


onRemove​

▸ onRemove(callback): void

Listen to remove a node

Parameters​

NameType
callback(id: UniqueId) => void

Returns​

void

Implementation of​

IFolderTreeService.onRemove

Defined in​

services/workbench/explorer/folderTreeService.ts:525


onRename​

▸ onRename(callback): void

Listen to event about clicking rename button

Parameters​

NameType
callback(id: UniqueId) => void

Returns​

void

Implementation of​

IFolderTreeService.onRename

Defined in​

services/workbench/explorer/folderTreeService.ts:521


onRightClick​

▸ onRightClick(callback): void

Listen to right click event

Parameters​

NameType
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​

NameType
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​

NameType
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​

NameType
listener(prevState: IFolderTree, nextState: IFolderTree) => void

Returns​

void

Implementation of​

IFolderTreeService.onUpdateState

Inherited from​

Component.onUpdateState

Defined in​

react/component.ts:73


remove​

▸ remove(id): void

Remove specific data in folder tree

Parameters​

NameType
idUniqueId

Returns​

void

Implementation of​

IFolderTreeService.remove

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​

NameType
listener?Function

Returns​

void

Implementation of​

IFolderTreeService.removeOnUpdateState

Inherited from​

Component.removeOnUpdateState

Defined in​

react/component.ts:77


render​

▸ render(nextState?): void

Initiative notify the component to render the view by the state

Parameters​

NameType
nextState?IFolderTree

Returns​

void

Implementation of​

IFolderTreeService.render

Inherited from​

Component.render

Defined in​

react/component.ts:69


reset​

▸ reset(): void

Reset the FolderTreeService state

Returns​

void

Implementation of​

IFolderTreeService.reset

Defined in​

services/workbench/explorer/folderTreeService.ts:227


setActive​

▸ setActive(id?): void

Active specific node, or unactive any node in folder tree

Parameters​

NameType
id?UniqueId

Returns​

void

Implementation of​

IFolderTreeService.setActive

Defined in​

services/workbench/explorer/folderTreeService.ts:501


setCurrentFolderLocation​

▸ Private setCurrentFolderLocation(data, id): void

Parameters​

NameType
dataIFolderTreeNodeProps
idUniqueId

Returns​

void

Defined in​

services/workbench/explorer/folderTreeService.ts:286


setEntry​

▸ setEntry(entry): void

Set a entry page for folder tree

Parameters​

NameType
entryReactNode

Returns​

void

Implementation of​

IFolderTreeService.setEntry

Defined in​

services/workbench/explorer/folderTreeService.ts:515


setExpandKeys​

▸ setExpandKeys(expandKeys): void

Set the expandKeys for folderTree

Parameters​

NameType
expandKeysUniqueId[]

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​

NameType
menusIMenuItemProps[]

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​

NameType
menusIMenuItemProps[]

Returns​

void

Implementation of​

IFolderTreeService.setFolderContextMenu

Defined in​

services/workbench/explorer/folderTreeService.ts:260


setLoadedKeys​

▸ setLoadedKeys(loadedKeys): void

Set the loadedKeys for folderTree

Parameters​

NameType
loadedKeysstring[]

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​

NameTypeDescription
valuesPartial<IFolderTree>update target state values
callback?(prevState: IFolderTree, nextState: IFolderTree) => void-

Returns​

void

Implementation of​

IFolderTreeService.setState

Inherited from​

Component.setState

Defined in​

react/component.ts:56


sortTree​

▸ Private sortTree(tree): void

Parameters​

NameType
treeIFolderTreeNodeProps[]

Returns​

void

Defined in​

services/workbench/explorer/folderTreeService.ts:195


subscribe​

▸ subscribe(name, listener): void

Subscribe the service event

Parameters​

NameTypeDescription
namestring | string[]Event name
listenerFunctionListener function

Returns​

void

Implementation of​

IFolderTreeService.subscribe

Inherited from​

Component.subscribe

Defined in​

common/event/eventBus.ts:11


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​

NameTypeDescription
nameanyThe event name
listener?Functionoptional, it unsubscribes events via name if not pass the listener function

Returns​

void

Implementation of​

IFolderTreeService.unsubscribe

Inherited from​

Component.unsubscribe

Defined in​

common/event/eventBus.ts:37


update​

▸ update(data): void

Update specific data in folder tree

Parameters​

NameType
dataIFolderTreeNodeProps

Returns​

void

Implementation of​

IFolderTreeService.update

Defined in​

services/workbench/explorer/folderTreeService.ts:462