From 610e3044047116808ea1b31180992ac77ecb102b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Thu, 21 Apr 2022 10:32:33 +0300 Subject: [PATCH] Fixed #2108 - Extend TreeNode API with expandedIcon & collapsedIcon --- src/components/tree/TreeNode.vue | 5 +---- src/views/tree/TreeDoc.vue | 12 ++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/tree/TreeNode.vue b/src/components/tree/TreeNode.vue index ef4767ce5..d36dcc1f4 100755 --- a/src/components/tree/TreeNode.vue +++ b/src/components/tree/TreeNode.vue @@ -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}]; diff --git a/src/views/tree/TreeDoc.vue b/src/views/tree/TreeDoc.vue index 1583b1081..24324afe2 100755 --- a/src/views/tree/TreeDoc.vue +++ b/src/views/tree/TreeDoc.vue @@ -57,6 +57,18 @@ import Tree from 'primevue/tree'; null Icon of the node to display next to content. + + expandedIcon + string + null + Icon to use in expanded state. + + + collapsedIcon + string + null + Icon to use in collapsed state. + children TreeNode[]