File

platform-components-ng/projects/platform-components-lib/src/lib/components/collection/collection-browser-tree/collection-browser-tree.component.ts

Description

Qpp collection tree

Implements

OnInit OnDestroy OnChanges

Metadata

selector qpp-collection-tree
templateUrl ./collection-browser-tree.component.html

Index

Properties
Methods
Inputs
Outputs
HostListeners

Constructor

constructor(collectionService: CollectionBrowsingService, errorMessageService: QppErrorMessageService, treeDragDropService: TreeDragDropService)
Parameters :
Name Type Optional
collectionService CollectionBrowsingService No
errorMessageService QppErrorMessageService No
treeDragDropService TreeDragDropService No

Inputs

config
Type : CollectionBrowserTreeConfig
Default value : new CollectionBrowserTreeConfig({ enableCollectionMove: false })

Parent component can pass the config for move collection to browser tree

selectedNodeId
Type : number

Outputs

collectionSelected
Type : EventEmitter

HostListeners

keydown
Arguments : '$event'
keydown(event: KeyboardEvent)

Methods

createPrimeNgTreeNode
createPrimeNgTreeNode(collectionObj)

The collection data from the API gateway is modelled into Prime NG tree nodes.

Parameters :
Name Optional
collectionObj No
Returns : any

any

expandNodeOnDragOver
expandNodeOnDragOver(node)

Expands the node when dragged over

Parameters :
Name Optional Description
node No
  • The node to expand
Returns : void
expandParents
expandParents(parentCollections, nodeId: number)

Expands the parent collections.

Parameters :
Name Type Optional Description
parentCollections No
  • The array of parent collections.
nodeId number No
  • The ID of the node.
Returns : Promise<void>

A promise that resolves when the expansion is complete.

findCollectionInHierarchy
findCollectionInHierarchy(tree, collectionId)

Finds the given collectionId in the tree.

Parameters :
Name Optional Description
tree No
collectionId No

Collection Id

Returns : any

any

getExpandCollapseButton
getExpandCollapseButton(collectionId: number)

Get Expand/Collapse Button

Parameters :
Name Type Optional Description
collectionId number No

collectionId

Returns : any | null

any

handleItemsDrop
handleItemsDrop(event: CdkDragDrop, targetNode: any)

Handles item drop on a specific node (shared logic)

Parameters :
Name Type Optional Description
event CdkDragDrop<any[]> No
  • The CDK drag drop event
targetNode any No
  • The target node to drop on
Returns : void
loadNode
loadNode(node, el?: any)

Loads child nodes of the given node.

Parameters :
Name Type Optional
node No
el any Yes
Returns : void

void

ngOnChanges
ngOnChanges()

Component lifecycle hook

Returns : void

void

ngOnDestroy
ngOnDestroy()

Componet life cycle hook All subscriptions are closed by setting alive as false.

Returns : void
ngOnInit
ngOnInit(refresh)

Component lifecycle hook

Parameters :
Name Optional Default value Description
refresh No false

Refresh

Returns : void

void

nodeSelect
nodeSelect(event)

Node select

Parameters :
Name Optional Description
event No

Event

Returns : void

void

nodeSelectionChanged
nodeSelectionChanged(collection)

Node selection changed

Parameters :
Name Optional
collection No
Returns : void

void

onDrop
onDrop(event)

Handles internal collection drag-drop within the tree

Parameters :
Name Optional Description
event No
  • The PrimeNG tree drop event
Returns : void
onNodeDragOver
onNodeDragOver(event: DragEvent, node: any)

Handles node-level drag over for auto-expansion

Parameters :
Name Type Optional Description
event DragEvent No
  • The drag event
node any No
  • The node being dragged over
Returns : void
onNodeDragOverTreeNode
onNodeDragOverTreeNode(event: DragEvent, node: any)
Parameters :
Name Type Optional
event DragEvent No
node any No
Returns : void
onNodeExpand
onNodeExpand(eventNode)

On node expand

Parameters :
Name Optional Description
eventNode No

Event node

Returns : void

void

onTreeContainerDragEnter
onTreeContainerDragEnter()

Handles CDK drag enter/leave on the tree container

Returns : void
onTreeContainerDragLeave
onTreeContainerDragLeave()

Handles CDK drag leave on the tree container

Returns : void
onTreeContainerDrop
onTreeContainerDrop(event: CdkDragDrop)

Handles CDK drop on the tree container with intelligent node detection

Parameters :
Name Type Optional Description
event CdkDragDrop<any[]> No
  • The CDK drag drop event
Returns : void
selectRootNode
selectRootNode(collectionObj)

Select root node

Parameters :
Name Optional
collectionObj No
Returns : void

void

setSelectedCollectionNode
setSelectedCollectionNode(collection)

Set selected collection node

Parameters :
Name Optional
collection No
Returns : void

void

updateCollectionHierarchy
updateCollectionHierarchy(selectedNode, nodes)

Update collection hierarchy

Parameters :
Name Optional
selectedNode No
nodes No
Returns : void

void

updateCollectionTree
updateCollectionTree(treeNodes, selectedCollectionNodeId, childNodes)

All addition, deletion, updation of nodes is done by iterating over the nodes, comparing them with the new data and then updating the tree if changes exist.

Parameters :
Name Optional
treeNodes No
selectedCollectionNodeId No
childNodes No
Returns : void

void

updateCollectionTreeComponent
updateCollectionTreeComponent(nodeId, parentId: number, refresh)

Change the selected node in the Tree if the target node is already loaded. If the node and its parent nodes have not been loaded, load the parents and expand them until the target node is reached.

Parameters :
Name Type Optional Default value Description
nodeId No

Node id

parentId number No 0

Parent id

refresh No false

Refresh Update collection tree component

Returns : void

void

updateRootNode
updateRootNode(aCollection)

Update root node

Parameters :
Name Optional
aCollection No
Returns : void

Properties

alive
Default value : true
allowItemDrop
Default value : false
collectionBrowserTree
Type : Tree
Decorators :
@ViewChild('collectionBrowserTree')
collectionMoveDlg
Type : QppCollectionMoveConfirmComponent
Decorators :
@ViewChild('collectionMoveDialog')

Collection drag dialog present as child component of browser tree component

collectionNodes
Type : any[]
Default value : []
dragEntered
Default value : false
isDragDrop
Default value : false
lastHoveredNode
Type : any
Default value : null
selectedCollectionId
Type : number
selectedCollectionNode
Type : any
showLoader
Default value : true

result-matching ""

    No results matching ""