vpusher / paper-tree

Browsable tree of nodes with expandable/collapsible capabilities and actions menu
MIT License
27 stars 24 forks source link

Allow possibility to not display any icon #17

Open RHagendoorn opened 6 years ago

RHagendoorn commented 6 years ago

If I understand correctly, it is currently not possible to not set an icon on the node. A workaround is to add icon 'none', however there is still a white space where the icon would normally be.

nicolasr75 commented 6 years ago

I solved it by changing the code slightly. In paper-tree-node.html add this function

_isIconHidden(icon) {
    return icon == 'none';
}

then in the template bind the hidden attribute like so

...
<div class="node-row">
    <span class$="{{_computeClass(data.*)}}" on-click="toggleChildren"></span>
    <iron-icon class="node-icon" icon$="{{_computeIcon(data.icon)}}" 
               hidden$="{{_isIconHidden(data.icon)}}"          <-- ***** here  *****
               on-click="select"></iron-icon>
    <span class="node-name" on-click="select">{{data.name}}</span>                
</div>
...