valueflow-node-selector

## Description This module provides account and node selection for [Valueflow](https://github.com/peterporfy/valueflow).

Usage no npm install needed!

<script type="module">
  import valueflowNodeSelector from 'https://cdn.skypack.dev/valueflow-node-selector';
</script>

README

Valueflow Node Selector

Description

This module provides account and node selection for Valueflow.

It is basically an utility module which provides a UI to change currently selected accounts or nodes. This selection can be used later by other modules.

Dev guide

You can access the selection in the redux state with the getSelection selector function by passing in the valueflow state. E.g. in a redux connected react component you can do it in mapStateToProps(state) as const selected = getSelection(state.valueflow);.

The result structure will be like this:

[
 {
   name: 'account1',
   fullNodes: [
    {
      name: 'node1',
      selected: false
    }
    ...
   ],
   selected: true
 }
 ...
]

You can also just use the raw state of the module in state.valueflow.modules.nodeSelector if that fits better for you:

{
  accounts: {
    a: false,
    b: true
  },
  nodes: {
    c: true,
    d: true
  }
}