GetTerminus / terminus-ui

๐Ÿ“š The Terminus UI Library.
MIT License
53 stars 8 forks source link

Component: Need a 'tree' component #1023

Open benjamincharity opened 5 years ago

benjamincharity commented 5 years ago

Material CDK offers a tree component that can be used for our base. The Material Tree component uses it as a base, so we could lift some of their implementation if it helps. (links for both below)

Requirements


Possible usage examples:

<!-- Simple usage -->
<ts-tree>
  My tree!
  <ts-tree-node *ngFor="let item of items">{{ item }}</ts-tree-node>
</ts-tree>
<!-- Nested usage -->
<ts-tree>
  My tree!
  <ts-tree *ngFor="let tree of trees">
    {{ tree.name }}
    <ts-tree-node *ngFor="let item of tree.items">{{ item }}</ts-tree-node>
  </ts-tree>
</ts-tree>
<!-- Custom icons usage -->
<ts-tree [treeIcons]="myCustomTreeIconObject" [nodeIcon]="myNodeIcon">
  My tree!
  <ts-tree-node *ngFor="let item of items">{{ item }}</ts-tree-node>
</ts-tree>
<!-- Custom HTML usage -->
<ts-tree>
  My tree!
  <ts-tree-node *ngFor="let item of items">
    <div class="myClass">
      {{ item.name }}
      <small>{{ item.id }}</small>
    </div>
  </ts-tree-node>
</ts-tree>
<!-- Custom Toggle usage -->
<ts-tree>
  <button tsTreeNodeToggle [tsTreeNodeToggleRecursive]="true">
    Open Children
  </button>
  My tree!

  <ts-tree-node *ngFor="let item of items">
    <div class="myClass">
      {{ item.name }}
      <small>{{ item.id }}</small>
    </div>
  </ts-tree-node>
</ts-tree>

Resources

baigfaizan95 commented 5 years ago

@benjamincharity I would love to work on this feature, please can you elaborate the requirements

benjamincharity commented 5 years ago

Absolutely! Let me work up a better requirements list today/tomorrow and then I'll update this issue ๐Ÿ‘

benjamincharity commented 5 years ago

Updated ๐Ÿ‘