# flow-graph-designer

> A React component capable of flow graph designer.

Latest version **0.4.2** (published 2018-12-13) · AGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install flow-graph-designer
pnpm add flow-graph-designer
yarn add flow-graph-designer
bun add flow-graph-designer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2018-12-13 |
| First published | 2018-06-20 |
| Weekly downloads | 0 |
| License | AGPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 3 |
| Unpacked size | 972.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Li Sheng Liang |
| Maintainers | shengliangli |
| Keywords | react, flow graph, designer, visual |

## Links

- npm: https://www.npmjs.com/package/flow-graph-designer
- Repository: https://github.com/censoft-corp/flow-graph-designer
- Homepage: https://github.com/censoft-corp/flow-graph-designer#readme
- Issues: https://github.com/censoft-corp/flow-graph-designer/issues
- npm.io page: https://npm.io/package/flow-graph-designer

## Dependencies (3)

- [immer](https://npm.io/package/immer.md) ^1.3.1
- [stateshot](https://npm.io/package/stateshot.md) ^1.2.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.8

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.4.2 (latest) — 2018-12-13
- 0.4.1 — 2018-11-14
- 0.4.0 — 2018-11-12
- 0.3.10 — 2018-11-01
- 0.3.9 — 2018-11-01
- 0.3.8 — 2018-10-29
- 0.3.7 — 2018-10-15
- 0.3.6 — 2018-07-27
- 0.3.5 — 2018-07-27
- 0.3.4 — 2018-07-04
- 0.3.3 — 2018-06-21
- 0.3.2 — 2018-06-21
- 0.3.1 — 2018-06-21
- 0.3.0 — 2018-06-21
- 0.2.5 — 2018-06-20
- … 5 more at https://npm.io/package/flow-graph-designer/versions

## README

# flow-graph-designer
A react component that make flow graph by drag & drop.

**feature**

- auto layout
- colorized node
- mouse drag & drop support
- copy & paste whether in one page or across multi pages
- undo/redo support
- action detail info

![demo image](https://raw.githubusercontent.com/censoft-corp/flow-graph-designer/master/demo.png?time=20181213)
## useage

**install:**

```
npm install flow-graph-designer
```

**use:**

```
import React from 'react';
import getFlowDesignerComponent from 'flow-graph-designer'
const FlowDesignerComponent = getFlowDesignerComponent({lang: 'zh_CN'});

const template={...}  
...
React.render(
  document.getElementById('app'),
  <FlowDesignerComponent
    data={{id: 'root', children: []}},
    template={template}
    theme="theme-1"
  />
)
```

**props**

theme:

valid values from ```theme-1``` to ```theme-8```

template:

```
const template = {
  id: "default",
  nodes: [
    "open",
    "click",
    "data",
    "input",
    "verification",
    "dropdown",
    "loop",
    "switch",
    "mouse-enter",
    "stop-loop",
    "stop",
    "case",
  ],
  entities: {
    node: {
      open: {
        id: "open",
        type: "normal",
        icon:
          "data:image/png;base64...U5ErkJggg==",    // src of icon on iconbar, could be base64 image or image url.
        props: {
          action: "open-page",
          name: "open page",
          type: "normal",
          showInToolbar: "Y",   // should show in toolbar
        },
      },
      ...
    }
  }
}
```

data:

```
{
  id: 'root',
  type: 'normal',
  action: 'root',
  name: 'root node'
  children: [
    id: '001',
    type: 'normal',     // control flow, value is one of : normal, loop, switch, case, stop-loop, stop
    action: 'open',     // for specifying the meaning of the node.
    children: [
      ...
    ]
  ]
}
```
## develop

**clone**
```
git clone https://github.com/censoft-corp/flow-graph-designer.git
```

**init**
```
yarn
```

or 

```
npm install
```

**start**
```
yarn run start
```

or 

```
npm run start
```

**playground**

there are a playground site.The url is  http://localhost:8080/

![playground image](https://raw.githubusercontent.com/censoft-corp/flow-graph-designer/master/playground.png)

## publish

set npm register server if necessary
```
npm config set registry https://registry.npmjs.org/
```

npm login, run once
```
npm login
...
```

everytime:
```
npm run publish-to-npm
```

restore npm register server to tapbao image if you wish
```
npm config set registry https://registry.npm.taobao.org
```

---
_Source: https://npm.io/package/flow-graph-designer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
