Fixed #2108 - Extend TreeNode API with expandedIcon & collapsedIcon

pull/2475/head
Tuğçe Küçükoğlu 2022-04-21 10:32:33 +03:00
parent 7aab982030
commit 610e304404
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>