0.5.4 • Published 6 years ago

uxcore-multi-select v0.5.4

Weekly downloads
17
License
MIT
Repository
github
Last release
6 years ago

uxcore-multi-select Dependency Status devDependency Status

TL;DR

uxcore-multi-select ui component for react

setup develop environment

$ git clone https://github.com/uxcore/uxcore-multi-select
$ cd uxcore-multi-select
$ npm install
$ npm start

Usage

let Multiselect = require('../src');

let Item = Multiselect.Item;

class Demo extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            value: ["item2", "item15"],
            disabled: false
        }
    }

    handleChange(value){
        this.setState({
            value: value,
            disabled: false
        })
        console.log('onChange', arguments)
    }
    handleSubmit(){
        console.log('onSubmit', arguments)
    }

    render() {
      let text= ['汉皇重色思倾国','御宇多年求不得','杨家有女初长成','养在深闺人未识',
                  '天生丽质难自弃','一朝选在君王侧','回眸一笑百媚生','六宫粉黛无颜色',
                  '春寒赐浴华清池','温泉水滑洗凝脂','侍儿扶起娇无力','始是新承恩泽时',
                  '云鬓花颜金步摇','芙蓉帐暖度春宵','春宵苦短日高起','从此君王不早朝'];

        return (
            <div>
                <Multiselect
                    value={this.state.value}
                    disabled={this.state.disabled}
                    onChange={this.handleChange.bind(this)}
                    onSubmit={this.handleSubmit.bind(this)}>
                  {text.map(function(item, index) {
                    return <Item value={'item' + index} text={item} />
                  })}
                </Multiselect>
            </div>
        );
    }
};

module.exports = Demo;

demo

http://uxcore.github.io/uxcore/components/uxcore-multi-select/

Props

MulitSelect

配置项类型必填默认值功能/备注
valuearrayrequired[]由 value 组成的数组,与 React 受限组件表现一致,选中项与 value 保持一致,数组中的值与 item 的 value 相对应
localestringoptionalzh-cn国际化语言,可选 zh-cn,en-us
onChangefunctionrequired-与 React 受限组件表现一致,在 checkbox 群发生改变时触发,借此来更改 value
disabledbooleanoptionalfalse是否为 disable 状态
classNamestringoptional''选择框的classname
dropdownClassNamestringoptional''下拉框的classname
placeholderstringoptional''-
titleBreakStrstringoptional'、'选中选项在选择框中的链接符
optionLabelPropstringoptional'text'item中的哪一个prop作为选项展示的label
maxSelectnumberoptional-最多可选选项数量
showSelectAllbooleanoptionaltrue是否显示全选按钮(如果maxSelect小于实际数量则该按钮成为disabled状态)
showClearbooleanoptionaltrue是否显示清空按钮
onSubmitfunctionoptional-点击确认时的回调函数,返回valueList数组和labelList数组
sizestringoptionallarge尺寸,枚举值 large, middle, small

MulitSelectItem

通过 MulitSelect.Item 取得。实际prop与checkboxGroup.Item相同

配置项类型必填默认值功能/备注
textstringoptinal-checkbox 后面跟着的说明文字
valuestringrequired-checkbox 对应的值
0.5.4

6 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.9

7 years ago

0.4.8

7 years ago

0.4.7

7 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.4

9 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago