@jswork/react-ant-draggable-tree
v1.0.5
Published
Draggable tree for antd.
Downloads
16
Maintainers
Readme
react-ant-draggable-tree
Draggable tree for antd.
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
- 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: ()
- 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
- https://afeiship.github.io/react-ant-draggable-tree/
license
Code released under the MIT license.