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

react-multi-select-panel

v0.1.5

Published

可视化操控左右多选select的React组件

Downloads

3

Readme

MultiSelectPanel组件

示例

image

安装

npm i react-multi-select-panel

使用

import MultiSelectPanel from 'react-multi-select-panel';

require('react-multi-select-panel/index.css');

组件API

  • leftSelects: [Arrary]Checkboxname
  • rightSelects: [Arrary] : 当前选定的值,请使用数组;
  • submitFun: [Function] : 回调确定按钮的函数可接受当前情况下的左侧数据和右侧数据 submitFun(leftSelects, rightSelects)
  • cancelFun: [Function] : 回调取消按钮的函数可接受当前情况下的左侧数据和右侧数据,参数同上
  • warpClass: [String] : 自定义外层类名

leftSelectsrightSelects 参数示例,本根据现有业务参考,如有需求联系作者修改

{
  leftSelects: [
    {id: '6069231', title: '哈哈哈测试上传配图绑定'},
    {id: '6069232', title: '测试计划计划'},
    {id: '6069233', title: '测试计划计划'}
  ],
  rightSelects: [
    {id: '6069224', title: 'kkkk'},
    {id: '6069225', title: '新的乱买词'},
    {id: '6069216', title: '21新增的移动计划112312311'},
    {id: '6069217', title: '测试测试...1'},
    {id: '6069218', title: '客户端测试 计划hhh'},
    {id: '6069199', title: '2222'},
    {id: '6069191', title: '多线程计划'},
    {id: '6069182', title: '1233456789'},
    {id: '6069183', title: 'test_kune90909'}
  ]
}

左右多选Select组使用方法

import React, { Component } from 'react';
import MultiSelectPanel from 'react-multi-select-panel';

require('react-multi-select-panel/index.css')

class App extends Component {
  constructor(props){
    super(props);
    this.state = {
      noSelectedOptions: [
        {id: '6069231', title: '哈哈哈测试上传配图绑定'},
        {id: '6069232', title: '测试计划计划'},
        {id: '6069233', title: '测试计划计划'}
      ],
      selectedOptions: [
        {id: '6069224', title: 'kkkk'},
        {id: '6069225', title: '新的乱买词'},
        {id: '6069216', title: '21新增的移动计划112312311'},
        {id: '6069217', title: '测试测试...1'},
        {id: '6069218', title: '客户端测试 计划hhh'},
        {id: '6069199', title: '2222'},
        {id: '6069191', title: '多线程计划'},
        {id: '6069182', title: '1233456789'},
        {id: '6069183', title: 'test_kune90909'}
      ],
      showSelects: false
    }
  }
  render() {
    const {noSelectedOptions, selectedOptions, showSelects} = this.state;
    return (
      <div className="App">
        <button onClick={()=>this.btnClick()}>打开MultiSelectPanel组件</button>
        { showSelects &&
          <MultiSelectPanel
           leftSelects={noSelectedOptions}
           rightSelects={selectedOptions}
           submitFun={(left,right)=>this.panelSubmit(left, right)}
           cancelFun={()=>this.panelcancel()}
           // warpClass={'tianye'}
          />
        }
      </div>
    );
  }

  btnClick() {
    const {showSelects} = this.state;
    this.setState({showSelects: !showSelects})
  }

  panelSubmit(l,r) {
    console.log(Object.keys(r))
  }

  panelcancel() {
    this.btnClick()
  }
}

export default App;