assisrafael / react-bootstrap-utils

React bootstrap library
MIT License
6 stars 6 forks source link

feat: include nodePath as argument to template functions in TreeView nodes #48

Closed joaoassisb closed 3 years ago

assisrafael commented 3 years ago

@joaoassisb after analysing this PR I decided to revert your previous commit. I think you should work more in the proposal and describe what use cases this feature will enable.

joaoassisb commented 3 years ago

@joaoassisb after analysing this PR I decided to revert your previous commit. I think you should work more in the proposal and describe what use cases this feature will enable.

@assisrafael the use case is to simplify the usage of TreeViews with Forms. At the moment, the template function passes only the item,index and parentItem, making a lot harder to handle paths and possible changes.

I updated the TreeViewExample to illustrate better my use case. image Now I can use a FormInput using the relativePath in the name of the input, and the changes will automatically updates the initial nodes structure.

image

assisrafael commented 3 years ago

@assisrafael the use case is to simplify the usage of TreeViews with Forms. At the moment, the template function passes only the item,index and parentItem, making a lot harder to handle paths and possible changes.

Your use case make sense. Regarding the PR content, I think it would be better with the prop would be called nodePath instead of relativePath.