react-ui-tree-porphyry

1.0.3 • Public • Published

react-ui-tree

React tree component for Porphyry

This project was initially developed for a webpage builder. It maintains an internal tree structure within the component through js-tree.

Modified:

Add remove, add, change in node render.

renderNode(node, id, handleRemoveNode, handleAddNode, forceChange)

Use Ctrl+mouse move to move the node.

Demo

https://pqx.github.io/react-ui-tree

Installation

npm install react-ui-tree --save

Usage

<Tree
  paddingLeft={20}              // left padding for children nodes in pixels
  tree={this.state.tree}        // tree object
  onChange={this.handleChange}  // onChange(tree) tree object changed
  renderNode={this.renderNode}  // renderNode(node) return react element
/>

// a sample tree object
// node.children, node.collapsed, node.leaf properties are hardcoded
{
  "module": "react-ui-tree",
  "children": [{
    "collapsed": true,
    "module": "dist",
    "children": [{
      "module": "node.js"
    }]
  }]
}

check app.js for a working example

Development

License

MIT

Package Sidebar

Install

npm i react-ui-tree-porphyry

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

20.6 kB

Total Files

11

Last publish

Collaborators

  • xuzhengyi