react-widget-tree
`npm install --save react-widget-tree`
Last updated a year ago by bplok20010 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-widget-tree 
SYNC missed versions from official npm registry.

react-nil-tree

npm install --save react-widget-tree

Tree属性

{
    prefixCls: 'nil-tree',
    className: '',
    rootId: null,
    loadingLabel: 'Loading...',
    loadingComponent: 'div',
    loadData: null,
    showIcon: true,
    showExpanderIcon: true,
    checkable: false,
    maxDepth: 50, //最大层级

    rootComponent: 'div',
    childNodesWrapperComponent: ChildNodesWrapper,
    nodeItemWrapperComponent: Fragment,
    //自定义
    renderIndentIcons: null,
    renderExpanderIcon: null,
    renderLoadingIcon: null,
    renderIcon: null,
    renderCheckbox: null,
    renderLabel: null,
    renderExtIcons: null,
    renderNode: null,
    //events
    onNodeClick: noop,
    onNodeDoubleClick: noop,
    onNodeContextMenu: noop,
    onNodeMouseDown: noop,
    onNodeMouseUp: noop,
    onNodeMouseEnter: noop,
    onNodeMouseLeave: noop,
    onNodeMouseOver: noop,
    onNodeMouseOut: noop,
    onNodeMouseMove: noop,
}

Node属性

  • id
  • label
  • leaf
  • pid
  • cls
  • iconCls
  • relativeDepth [readonly]
  • expanded
  • checked
  • loading [readonly]
  • isRoot [readonly]

示例

import React, { Component } from 'react';
import TreeStore from 'xtree-store';
import RWTree from 'react-widget-tree';
import data from '../data.json';

export default class DEMO extends Component {

    constructor(props) {
        super(props);

        this.store = new TreeStore(data, {
            simpleData: true
        });

    }

    loadData = node => {
        const store = this.store;
        return store.getChildren(node.id);
    }

    toggleExpand = (node, e, t) => {
        node.expanded = !node.expanded;
        node.checked = !node.checked;
        this.forceUpdate();
        //or
        // t.toggleExpand()
    }
    //checkable的选择状态需要通过回调设置checked
    render() {
        return (
            <RWTree
                onNodeClick={this.toggleExpand}
                loadData={this.loadData}
                showIcon
                checkable
            />
        );
    }

}

Current Tags

  • 1.0.0                                ...           latest (a year ago)

1 Versions

  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (7)
Dev Dependencies (57)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |