0.2.7 • Published 2 years ago

table-flow-graph v0.2.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Table-Flow-Graph

A simple flow graph editor/viewer. (working in progress)

Features

  • Light-weight flow graph based on html table
  • Grid based lines
  • Movable & resizable nodes
  • Fully customizable

Installation

Via npm

  npm install table-flow-graph

Via yarn

  yarn add table-flow-graph

Usage

Step1: add js & css files

option A: Copy table-flow-graph/dist/index.css and table-flow-graph/dist/index.min.js to your project's static, and include them directly into html file:

<link rel="stylesheet" href="./static/table-fow-graph/index.css">
<script src="./static/table-flow-graph/index.min.js"></script>

option B: For libraries like react and vue, first import the css file into your project's entry file(usally the main.js file):

// add css to mian.js/ts/jsx/tsx
import 'table-flow-graph/dist/index.css';

then import TableFlowGraph wherever needed:

import { TableFlowGraph } from 'table-flow-graph';

Step2: prepare the dom element:

<div id="my_flow_graph"></div>

Step3: initiate TableFlowGraph instance:

const el = document.getElementById('my_flow_graph');
// create a table-flow-graph with 10x10 cells
const graphInstance = new TableFlowGraph(el, {
    isEditor: true,
    totalColumns: 10,
    totalRows: 10,
});

Options

OptionTypeDescriptionDefault
isEditorBooleanIf set to true, this flow graph instance will be editable.false
nodesArraynodes(blocks) of the flow graph.[]
columnsArraystores data of table header title and column width.[]
linesArray2D array of anchor point ids to draw lines.[]
totalRowspositive integerTotal row number of flow graph table.8
totalColumnspositive integerTotal column numbe fo flow graph table.8
maxRowspositive integerDisable add row functionalitiy when totalRows reaches maxRows.30
maxColumnspositive integerDisable add column functionalitiy when totalColumns reaches maxColumns.12
tableLayoutFixedBooleanIf true, the width of each column will be equal.false
labelsObjectNo i18n functionalitiy provided in this project, you can use this option to customize all the texts/labels.-
onChangeLinesFunctionEvent hook triggered when new line is drawn or a line is deleted.-
addColumnFunctionEvent hook triggered when 'Add Column' button is pressed. This will overwrite the build in functionalitiy of adding new column(which will trigger onAddColumn). You need to call refresh(newOptions) to refresh the flow graph instance after adding column with this method.-
onAddColumnFunctionEvent hook triggered after adding column with build in method.-
editColumnFunctionEvent hook triggered when 'Edit Column' button is pressed. This will overwrite the build in functionalitiy of editing a column(which will trigger onEditColumn). You need to call refresh(newOptions) to refresh the flow graph instance after editing column with this method.-
onEditColumnFunctionEvent hook triggered after editing column with build in method.-
deleteColumnFunctionEvent hook triggered when 'Delete Column' button is pressed. This will overwrite the build in functionalitiy of deleting a column(which will trigger onDeleteColumn). You need to call refresh(newOptions) to refresh the flow graph instance after deleting column with this method.-
onDeleteColumnFunctionEvent hook triggered after deleting column with build in method.-
addRowFunctionEvent hook triggered when 'Add Row' button is pressed. This will overwrite the build in functionalitiy of adding new row(which will trigger onAddRow). You need to call refresh(newOptions) to refresh the flow graph instance after adding row with this method.-
onAddRowFunctionEvent hook triggered after adding row with build in method.-
deleteRowFunctionEvent hook triggered when 'Delete Row' button is pressed. This will overwrite the build in functionalitiy of deleting a row(which will trigger onDeleteRow). You need to call refresh(newOptions) to refresh the flow graph instance after deleting row with this method.-
onDeleteRowFunctionEvent hook triggered after deleting row with build in method.-
addNodeFunctionEvent hook triggered when 'Add Node' button is pressed. This will overwrite the build in functionalitiy of adding a node(which will trigger onAddNode). You need to call refresh(newOptions) to refresh the flow graph instance after adding node with this method.-
onAddNodeFunctionEvent hook triggered after adding node with build in method.-
editNodeFunctionEvent hook triggered when 'Edit Node' button is pressed. This will overwrite the build in functionalitiy of editing node(which will trigger onEditNode). You need to call refresh(newOptions to refresh the flow graph instance after editing node with this method.-
onEditNodeFunctionEvent hook triggered after editing node with build in method.-
deleteNodeFunctionEvent hook triggered when 'Delete Node' button is pressed. This will overwrite the build in functionalitiy of deleting a node(which will trigger onDeleteNode). You need to call refresh(newOptions)-
onDeleteNodeFunctionEvent hook triggered after deleting node with build in method.-
onClickNodeFunctionEvent hook triggered when node is clicked in viewer mode.-
renderNodeFunctionCustomize how the node content is rendered.-
renderNodeHoverPopupFunctionCustomize how the node's hover Popup is rendered.-
0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago