dgreene1 / react-accessible-treeview

A react component that implements the treeview pattern as described by the WAI-ARIA Authoring Practices.
https://dgreene1.github.io/react-accessible-treeview
MIT License
277 stars 37 forks source link

Allow for IDs to be strings as well as numbers and also not require them to sequential #99

Closed kpustakhod closed 1 year ago

kpustakhod commented 1 year ago

What was doen in this PR:

  1. Refactored the way to access particular node in data. Originally data is an INode[] with sequential numbers as data indexes and node ids and node access was implemented as data[id]. Now data is still INode[] but supports non-sequential ids and node access is implemented with getTreeParent and getTreeNode helpers.
  2. Node ids now supports numbers and strings.
  3. Added additional validation for data: INode[] to now allow rendering of broken data. For example: two nodes are market as root nodes (parent: null), or there are duplicates in node's children, etc.
  4. Types and reducer was moved in separate files to improve readability.

Reference: UIEN-3971, UIEN-3972