0.0.11 • Published 4 years ago
stencil-asset-tree v0.0.11
This is asset tree component which recursively adds nodes.
How to use this component?
<bhive-asset-tree [assets]='jsonData' (selected)='customMethod(data)'></bhive-asset-tree>
Structure of jsonData?
[{
id: 'dfd3d488-4a87-480c-b15e-b6c35f6a5847',
name: 'USA',
children: [{
id: 'a27705a0-348b-439f-aec6-a4264f3a332f',
name: 'New York City',
children: []
}, {
id: 'f2ec4ea3-3e10-4820-8bd3-552742a6578e',
name: 'Chicago',
children: []
}]
}, {
id: 'bad25ba2-4b89-417b-97c0-2daea4ffde41',
name: 'India',
children: [{
id: 'd0ce0f39-56af-4835-a503-d087f07cff5e',
name: 'Mumbai',
children: [{
id: '733134c8-970b-45bf-b66a-cd194ab104f8',
name: 'Borivali',
children: []
}, {
id: '203a5fc3-a74b-48ab-9679-078888e16b5a',
name: 'Malad',
children: []
}],
}, {
id: '0d47a7c8-d314-4488-b794-746b8b8cd850',
name: 'Delhi',
children: []
}]
}];
Where id, name and children properties are mandatory and contain any other keys apart from them.
The nodeSelected methods emits data in the following format:
<current_selected_asset_id>