artem-mangilev / ngx-vflow

An open source library to build node-based UI with Angular 16+
https://www.ngx-vflow.org/
MIT License
165 stars 10 forks source link

[Feature request] - Multiselect nodes by hot keys & public service for programmatic actions #85

Open ChristofFritz opened 2 months ago

ChristofFritz commented 2 months ago

Hi, first of all: Awesome library. I looked through the code and I'm in awe. You're a truly skilled Angular developer.


Now to the feature request:

I'd love to have multi select capability for the nodes.

With the usual CMD/STRG + click to add or remove node to selection. The current selectable directive will deselect all previously selected nodes.

Also: Making the SelectionService available in the library would allow us to select nodes programmatically. That would make our routed flow easier to implement. Currently I built it kind of hacky by manually triggering the mousedown event on the node.

artem-mangilev commented 2 months ago

Hi, thank you for the positive feedback! The code might be a bit complex, but I prioritize providing a simple and convenient API, even if it requires a more complex implementation.

Yeah, I think I'll avoid reinventing the wheel and implement this similarly to how React Flow does it, using CMD + click as the default combination, while allowing the option to customize it.

I'll consider creating an API for programmatically selecting nodes (probably a single public service that can this and some other programmatic actions). The challenge with exposing SelectionService is that it's tied to a specific instance of the vflow component. So, if I make it { providedIn: 'root' }, I need to ensure it work with multiple vflow instances.

artem-mangilev commented 1 month ago

I implemented the configurable keyboard shortcuts with the node multiselection support in 0.13, could you please check if it's fine for you?