@jswork/react-ant-draggable-tree

1.0.5 • Public • Published

react-ant-draggable-tree

Draggable tree for antd.

version license size download

installation

npm install -S @jswork/react-ant-draggable-tree

properties

Name Type Required Default Description
className string false - The extended className for component.
items array false [] The data source for tree.
uniqKey string false 'value' The unique id key.
onChange func false noop The change handler.
dropValidate func false () => { return true; } When drag and drop validation passed.

usage

  1. import css
@import "~@jswork/react-ant-draggable-tree/dist/style.css";

// or use sass
@import "~@jswork/react-ant-draggable-tree/dist/style.scss";

// customize your styles:
$react-ant-draggable-tree-options: ()
  1. import js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactAntDraggableTree from '@jswork/react-ant-draggable-tree';
import './assets/style.scss';

class App extends React.Component {
  state = {
    items: require('./assets/tree.json')
  };

  render() {
    return (
      <ReactDemokit
        className="p-3 app-container"
        url="https://github.com/afeiship/react-ant-draggable-tree">
        <ReactAntDraggableTree
          items={this.state.items}
          className="mb-5 has-text-white"
          onChange={(e) => {
            console.log('event onChange:', e.target.value);
          }}
        />
        <button
          className="button is-primary"
          onClick={(e) => {
            this.setState({ items: [] });
          }}>
          Set items
        </button>
      </ReactDemokit>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));

documentation

license

Code released under the MIT license.

Package Sidebar

Install

npm i @jswork/react-ant-draggable-tree

Weekly Downloads

3

Version

1.0.5

License

MIT

Unpacked Size

25.9 kB

Total Files

7

Last publish

Collaborators

  • afeiship