https://github.com/afeiship/react-ant-draggable-tree
Draggable tree for antd.
https://github.com/afeiship/react-ant-draggable-tree
ant drag draggable drop list react sortable tree
Last synced: 10 months ago
JSON representation
Draggable tree for antd.
- Host: GitHub
- URL: https://github.com/afeiship/react-ant-draggable-tree
- Owner: afeiship
- License: mit
- Created: 2021-03-23T02:26:28.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-23T08:18:07.000Z (almost 5 years ago)
- Last Synced: 2025-03-08T23:17:08.399Z (11 months ago)
- Topics: ant, drag, draggable, drop, list, react, sortable, tree
- Language: JavaScript
- Homepage:
- Size: 6.31 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# react-ant-draggable-tree
> Draggable tree for antd.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]
## installation
```shell
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
```scss
@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: ()
```
2. import js
```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 (
{
console.log('event onChange:', e.target.value);
}}
/>
{
this.setState({ items: [] });
}}>
Set items
);
}
}
ReactDOM.render(, document.getElementById('app'));
```
## documentation
- https://afeiship.github.io/react-ant-draggable-tree/
## license
Code released under [the MIT license](https://github.com/afeiship/react-ant-draggable-tree/blob/master/LICENSE.txt).
[version-image]: https://img.shields.io/npm/v/@jswork/react-ant-draggable-tree
[version-url]: https://npmjs.org/package/@jswork/react-ant-draggable-tree
[license-image]: https://img.shields.io/npm/l/@jswork/react-ant-draggable-tree
[license-url]: https://github.com/afeiship/react-ant-draggable-tree/blob/master/LICENSE.txt
[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-ant-draggable-tree
[size-url]: https://github.com/afeiship/react-ant-draggable-tree/blob/master/dist/react-ant-draggable-tree.min.js
[download-image]: https://img.shields.io/npm/dm/@jswork/react-ant-draggable-tree
[download-url]: https://www.npmjs.com/package/@jswork/react-ant-draggable-tree