antoniandre / wave-ui

A UI framework for Vue.js 3 (and 2) with only the bright side. ☀️
https://antoniandre.github.io/wave-ui
MIT License
544 stars 39 forks source link

Tree nested selection #107

Closed kevinpoulet closed 1 year ago

kevinpoulet commented 1 year ago

Hello,

I was having a look at the tree component, more specifically the events: https://antoniandre.github.io/wave-ui/w-tree#events

If I have a tree structure like this:

and select item 1/brief, as far as I can tell, the event will only contain a label of brief and a depth of 1 which does not allow to identify which item was selected.

Is there a way to have a list to the path of selected item (e.g. ["item 1", "brief"]) ?

Thank you in advance.

antoniandre commented 1 year ago

Hi @kevinpoulet, Thanks for the suggestion, it makes sense. The path is now available in version 3.3.0: https://antoniandre.github.io/wave-ui/w-tree#events

Check the definition of the path in the API section of that page (in events and slots parameters) for more details. Also note that each item in the array of the path is the original tree item object instead of just the label, because you might be interested in the label, and someone else another property, even custom ones are accessible like so!

Hope it helps, please reopen if not solved. :)

kevinpoulet commented 1 year ago

Great, thank you!

Good idea for the custom properties, I was planning on looking them up following the path but that way is even better :)