Merge pull request #2475 from tugcekucukoglu/tree-icons

Fixed #2108 - Extend TreeNode API with expandedIcon & collapsedIcon
pull/2496/head
Yiğit FINDIKLI 2022-04-25 14:08:18 +03:00 committed by GitHub
commit 884e91dfb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -273,10 +273,7 @@ export default {
return ['p-treenode-icon', this.node.icon];
},
toggleIcon() {
return ['p-tree-toggler-icon pi pi-fw', {
'pi-chevron-down': this.expanded,
'pi-chevron-right': !this.expanded
}];
return ['p-tree-toggler-icon pi pi-fw', this.expanded ? this.node.expandedIcon || 'pi-chevron-down' : this.node.collapsedIcon || 'pi-chevron-right'];
},
checkboxClass() {
return ['p-checkbox-box', {'p-highlight': this.checked, 'p-indeterminate': this.partialChecked}];

View File

@ -57,6 +57,18 @@ import Tree from 'primevue/tree';
<td>null</td>
<td>Icon of the node to display next to content.</td>
</tr>
<tr>
<td>expandedIcon</td>
<td>string</td>
<td>null</td>
<td>Icon to use in expanded state.</td>
</tr>
<tr>
<td>collapsedIcon</td>
<td>string</td>
<td>null</td>
<td>Icon to use in collapsed state.</td>
</tr>
<tr>
<td>children</td>
<td>TreeNode[]</td>