0.0.9 • Published 4 years ago

@opuscapita/react-hierarchy-tree v0.0.9

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

react-hierarchy-tree

Description

Describe the component here

Installation

npm install @opuscapita/react-hierarchy-tree

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

Prop nameTypeDefaultDescription
idKeystring'id'Tree item's unique identifier property
valueKeystring'name'Tree item's node name property
leafValueKeystringundefinedTree item's leaf name property (if differs from valueKey)
childKeystring'children'Property where you'll find tree item's children
defaultExpandedKeysarray[]Array of items that are expanded by default (ids).
lockedKeystringundefinedProperty that tells whether node or it's parents can be deleted, moved, etc.
sortKeystringundefinedTree item's property used for grid sorting (if needed)
treeDataarray[]Array of tree items
maxLevelnumber0Maximal allowed number of hierarchy levels (if greater than 0)
maxValueLengthnumberundefinedMaximal allowed number of characters of the item's node name (if needed)
onChangefuncrequiredonChange callback
onPreventDeletefuncundefinedFunction that's called when deleting a locked item
gridgridShaperequired@opuscapita/react-grid. See documentation for details
gridColumnsgridColumnShaperequired@opuscapita/react-grid. See documentation for details

Code example

import React from 'react';
import HierarchyTree from '@opuscapita/react-hierarchy-tree';

export default class TreeExample extends React.Component {
  render() {
    return (
      <HierarchyTree
        propName="propValue"
      />
    );
  }
}