npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

transfer-tree-antd

v0.1.17

Published

简单的tree形式的穿梭框

Downloads

5

Readme

基于antd的tree组件实现treeTransfer组件

tree形式的穿梭框支持左右tree形式的数据展示

vue + element版本

API

| api | 类型 | 是否必选 | 默认值 | 说明 | | --- | --- | --- | --- | --- | | dataSource | array | true | [] | 完整的数据源遵循Tree的数据结构 | | title | array | true | - | 穿梭框的标题(数组第一项为左侧,第二项为右侧)| | defaultValues | array | false | [] | 默认的初始值只在组件第一次渲染时生效 | | values | array | false | [] | 受控选择的values | | disabled | boolean | false | false | 是否禁用 | | leftDisabled | boolean | false | false | 左侧Tree是否禁用 | | rightDisabled | boolean | false | false | 右侧Tree是否禁用 | | showSearch | boolean | false | true | 是否有搜索框 | | searchItems | array | false | ['label', 'key'] | 搜索时匹配的属性(数据源的属性要与此同步)| | searchPlaceholder | array | false | ['请输入', '请输入'] | 搜索框的placeHolder | | notFoundContent | string | false | 暂无数据 | 无数据时的显示文本 | | onMove | function | false | - | 数据移动时触发的函数, 默认参数一为选择的keys,参数二为数组形式的JSON字符串数据为为选择之后左侧的数据源和右侧的数据源 |

示例 简单示例

简单使用

npm install transfer-tree-antd --save

import React, { Component } from 'react';
import TreeTransfer from 'transfer-tree-antd';

const mockData = [
  {
    "title": '1',
    "key": "1",
    "children": [
      {
        "title": "1-0",
        "key": "1-0",
        "children": [
            {
              "title": "1-0-0",
              "key": "1-0-0"
            },
            {
              "title": "1-0-1",
              "key": "1-0-1"
            },
        ],
      },
      {
        "title": "1-1",
        "key": "1-1",
        "children": [
          {
            "title": "1-1-0",
            "key": "1-1-0"
          },
          {
            "title": "1-1-1",
            "key": "1-1-1"
          },
        ],
      }
    ],
  },
  {
    "title": '2',
    "key": "2",
    "children": [
      {
        "title": "2-0",
        "key": "2-0",
        "children": [
          {
            "title": "2-0-0",
            "key": "2-0-0"
          },
          {
            "title": "2-0-1",
            "key": "2-0-1"
          }
        ],
      },
      {
        "title": "2-1",
        "key": "2-1",
        "children": [
          {
            "title": "2-1-0",
            "key": "2-1-0"
          },
          {
            "title": "2-1-1",
            "key": "2-1-1"
          }
        ],
      },
    ],
  }
];

class App extends Component {
  onMove = (keys, info) => {
    console.log(keys);
    console.log(JSON.parse(info));
  }
 
  render() {
    return (
      <TreeTransfer
        dataSource={mockData}
        title={['左侧标题', '右侧标题']}
        onMove={this.onMove}
      />
    )
  }
}
 
render(<App />, document.querySelector('#app'));