# @feizheng/react-ant-tree-select

> Antd tree select wrapper for react.

Latest version **1.1.4** (published 2020-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @feizheng/react-ant-tree-select
pnpm add @feizheng/react-ant-tree-select
yarn add @feizheng/react-ant-tree-select
bun add @feizheng/react-ant-tree-select
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2020-04-20 |
| First published | 2019-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | afei |
| Maintainers | afeiship |
| Keywords | react, component |

## Links

- npm: https://www.npmjs.com/package/@feizheng/react-ant-tree-select
- Repository: https://github.com/afeiship/react-ant-tree-select
- Homepage: https://github.com/afeiship/react-ant-tree-select#readme
- Issues: https://github.com/afeiship/react-ant-tree-select/issues
- npm.io page: https://npm.io/package/@feizheng/react-ant-tree-select

## Dependencies (6)

- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [autoprefixer](https://npm.io/package/autoprefixer.md) ^9.7.4
- [object-assign](https://npm.io/package/object-assign.md) ^4.1.1
- [@feizheng/noop](https://npm.io/package/@feizheng/noop.md) ^1.0.0
- [@feizheng/next-tree-walk](https://npm.io/package/@feizheng/next-tree-walk.md) ^1.0.5

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.4 (latest) — 2020-04-20
- 1.1.3 — 2019-11-28
- 1.1.2 — 2019-11-27
- 1.1.1 — 2019-11-27
- 1.1.0 — 2019-11-27
- 1.0.0 — 2019-11-27

## README

# react-ant-tree-select
> Antd tree select wrapper for react.

## installation
```shell
npm install -S @feizheng/react-ant-tree-select
```

## update
```shell
npm update @feizheng/react-ant-tree-select
```

## properties
| Name      | Type   | Required | Default    | Description                           |
| --------- | ------ | -------- | ---------- | ------------------------------------- |
| className | string | false    | -          | The extended className for component. |
| items     | array  | false    | []         | Data source items(tree).              |
| template  | func   | false    | -          | The items template.                   |
| itemsKey  | union  | false    | 'children' | Items key(default: children).         |


## usage
1. import css
  ```scss
  @import "~@feizheng/react-ant-tree-select/dist/style.scss";

  // customize your styles:
  $react-ant-tree-select-options: ()
  ```
2. import js
  ```js
  import ReactAntTreeSelect from '@feizheng/react-ant-tree-select';
  import ReactDOM from 'react-dom';
  import React from 'react';
  import { TreeSelect } from 'antd';
  import './assets/style.scss';

  class App extends React.Component {
    constructor(inProps) {
      super(inProps);
      this.state = {
        items: [
          {
            label: '0-0',
            value: '0-0',
            children: [
              {
                label: '0-0-0',
                value: '0-0-0',
                children: [
                  { label: '0-0-0-0', value: '0-0-0-0' },
                  { label: '0-0-0-1', value: '0-0-0-1' },
                  { label: '0-0-0-2', value: '0-0-0-2' }
                ]
              },
              {
                label: '0-0-1',
                value: '0-0-1',
                children: [
                  { label: '0-0-1-0', value: '0-0-1-0' },
                  { label: '0-0-1-1', value: '0-0-1-1' },
                  { label: '0-0-1-2', value: '0-0-1-2' }
                ]
              },
              {
                label: '0-0-2',
                value: '0-0-2'
              }
            ]
          },
          {
            label: '0-1',
            value: '0-1',
            children: [
              { label: '0-1-0-0', value: '0-1-0-0' },
              { label: '0-1-0-1', value: '0-1-0-1' },
              { label: '0-1-0-2', value: '0-1-0-2' }
            ]
          },
          {
            label: '0-2',
            value: '0-2'
          }
        ]
      };
    }

    template = (inData) => {
      if (inData && inData.length) {
        return inData.map((item) => {
          const { label, value, ...itemProps } = item;
          if (item.children) {
            return (
              <TreeSelect.TreeNode
                title={label}
                key={value}
                value={value}
                {...itemProps}>
                {this.template(item.children)}
              </TreeSelect.TreeNode>
            );
          }
          return <TreeSelect.TreeNode title={label} key={value} value={value} />;
        });
      }
      return null;
    };

    render() {
      return (
        <div className="app-container">
          <ReactAntTreeSelect
            style={{ width: 200 }}
            items={this.state.items}
            // template={this.template}
          />
        </div>
      );
    }
  }

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

  ```

## documentation
- https://afeiship.github.io/react-ant-tree-select/

---
_Source: https://npm.io/package/@feizheng/react-ant-tree-select · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
