ngneat / dag

🐠 An Angular service for managing directed acyclic graphs
MIT License
154 stars 7 forks source link

Add Insert and insert and replace methods #29

Closed pjlamb12 closed 3 years ago

pjlamb12 commented 3 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

If you have a graph like this:

  1 2  3

And you want to add a new step above 2, but make it still have a sibling of 3 (so, have step 4 replace step 2 and have step 2 be the child of step 4):   1 4  3 2

The service currently can't do this. It puts 4 directly below 1 and as the parent of 2 and 3:   1   4 2  3

Expected behavior

4 should replace 2 in the graph and 2 should be pushed down one spot

pjlamb12 commented 3 years ago

I'm thinking instead of changing the functionality, this can just be a new method that places a new item in the place of an existing item, and pushes the existing item down a spot. Maybe even have a flag to remove and replace or just insert and replace

pjlamb12 commented 3 years ago

This will likely also help with #24