Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bee-cascader

Package Overview
Dependencies
Maintainers
12
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bee-cascader - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

16

build/Cascader.js

@@ -181,2 +181,18 @@ 'use strict';

Cascader.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('options' in nextProps) {
var _options = nextProps.options;
for (var i = _options.length - 1; i >= 0; i--) {
_options[i]['parent'] = true;
}
this.setState({
option: _options,
textStr: []
});
if (this.props.onClick) {
this.props.onClick([]);
}
}
};
Cascader.prototype.render = function render() {

@@ -183,0 +199,0 @@ var va = this.state.textStr.join('/');

@@ -0,1 +1,12 @@

<a name="2.0.2"></a>
## [2.0.2](https://github.com/tinper-bee/bee-cascader/compare/v2.0.1...v2.0.2) (2019-03-04)
### Features
* **bee-cascader:** 动态改变options ([4cdcc1f](https://github.com/tinper-bee/bee-cascader/commit/4cdcc1f))
* **bee-cascader:** 动态改变options ([ec15d2b](https://github.com/tinper-bee/bee-cascader/commit/ec15d2b)), closes [#145](https://github.com/tinper-bee/bee-cascader/issues/145)
<a name="2.0.0"></a>

@@ -2,0 +13,0 @@ # [2.0.0](https://github.com/tinper-bee/bee-cascader/compare/v1.0.4...v2.0.0) (2019-01-23)

50

demo/demolist/Demo1.js

@@ -49,4 +49,9 @@ /**

class Demo1 extends Component {
constructor(props){
super(props);
this.state={
options:options
}
}
onClickHandler=(data)=>{

@@ -56,2 +61,42 @@ console.log("data: ",data);

click=()=>{
this.setState({
options:[
{
value: '浙江1',
children: [
{
value: '杭州',
children: [
{
value: '西湖',
children: [
{
value: '白娘子'
},
{
value: '许仙'
}]
}]
}
]
},
{
value: '江苏1',
children: [
{
value: '南京',
children: [
{
value: '中华门'
}]
}
]
},
{
value: '山东1'
}
]
})
}
render(){

@@ -61,4 +106,5 @@ return(

<Col md={4}>
<button onClick={this.click}>点击</button>
<div className="height-150">
<Cascader options = {options} onClick={this.onClickHandler}/>
<Cascader options = {this.state.options} onClick={this.onClickHandler}/>
</div>

@@ -65,0 +111,0 @@ </Col>

2

demo/index.js

@@ -13,3 +13,3 @@ import {Col, Row} from 'bee-layout';

var Demo1 = require("./demolist/Demo1");var DemoArray = [{"example":<Demo1 />,"title":" 基础级联菜单","code":"/**\n *\n * @title 基础级联菜单\n * @description\n *\n */\n\nimport React, { Component } from 'react';\nimport { Cascader, Row, Col } from 'tinper-bee';\n\n const options = [\n \t{\n \t value: '浙江',\n \t children: [\n \t\t {\n \t\t value: '杭州',\n \t\t children: [\n \t\t\t {\n \t\t\t value: '西湖',\n \t\t\t children: [\n \t\t\t\t {\n \t\t\t\t value: '白娘子'\n \t\t\t\t },\n \t\t\t\t {\n \t\t\t\t value: '许仙'\n \t\t\t\t }]\n \t\t\t }]\n \t\t }\n \t ]\n \t},\n \t{\n \t value: '江苏',\n \t children: [\n \t\t {\n \t\t value: '南京',\n \t\t children: [\n \t\t\t {\n \t\t\t value: '中华门'\n \t\t\t }]\n \t\t }\n \t ]\n \t},\n \t{\n \t value: '山东'\n \t}\n ];\n class Demo1 extends Component {\n\n\n\tonClickHandler=(data)=>{\n\t\tconsole.log(\"data: \",data);\n\t}\n\n \trender(){\n \t\treturn(\n <Row>\n <Col md={4}>\n <div className=\"height-150\">\n \t<Cascader options = {options} onClick={this.onClickHandler}/>\n </div>\n </Col>\n </Row>\n \t\t)\n \t}\n }\n","desc":""}]
var Demo1 = require("./demolist/Demo1");var DemoArray = [{"example":<Demo1 />,"title":" 基础级联菜单","code":"/**\n *\n * @title 基础级联菜单\n * @description\n *\n */\n\nimport React, { Component } from 'react';\nimport { Cascader, Row, Col } from 'tinper-bee';\n\n const options = [\n \t{\n \t value: '浙江',\n \t children: [\n \t\t {\n \t\t value: '杭州',\n \t\t children: [\n \t\t\t {\n \t\t\t value: '西湖',\n \t\t\t children: [\n \t\t\t\t {\n \t\t\t\t value: '白娘子'\n \t\t\t\t },\n \t\t\t\t {\n \t\t\t\t value: '许仙'\n \t\t\t\t }]\n \t\t\t }]\n \t\t }\n \t ]\n \t},\n \t{\n \t value: '江苏',\n \t children: [\n \t\t {\n \t\t value: '南京',\n \t\t children: [\n \t\t\t {\n \t\t\t value: '中华门'\n \t\t\t }]\n \t\t }\n \t ]\n \t},\n \t{\n \t value: '山东'\n \t}\n ];\n class Demo1 extends Component {\n\tconstructor(props){\n\t\tsuper(props);\n\t\tthis.state={\n\t\t\toptions:options\n\t\t}\n\t}\n\n\tonClickHandler=(data)=>{\n\t\tconsole.log(\"data: \",data);\n\t}\n\n\tclick=()=>{\n\t\tthis.setState({\n\t\t\toptions:[\n\t\t\t\t{\n\t\t\t\t\tvalue: '浙江1',\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: '杭州',\n\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: '西湖',\n\t\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvalue: '白娘子'\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvalue: '许仙'\n\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tvalue: '江苏1',\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: '南京',\n\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: '中华门'\n\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tvalue: '山东1'\n\t\t\t\t}\n\t\t\t]\n\t\t})\n\t}\n \trender(){\n \t\treturn(\n <Row>\n <Col md={4}>\n\t\t\t\t\t\t\t\t\t<button onClick={this.click}>点击</button>\n <div className=\"height-150\">\n \t<Cascader options = {this.state.options} onClick={this.onClickHandler}/>\n </div>\n </Col>\n </Row>\n \t\t)\n \t}\n }\n","desc":""}]

@@ -16,0 +16,0 @@

{
"name": "bee-cascader",
"version": "2.0.1",
"version": "2.0.2",
"description": "Cascader ui component for react",

@@ -16,3 +16,3 @@ "keywords": [

},
"homepage": "https://github.com/tinper-beebee-cascader.git",
"homepage": "https://github.com/tinper-bee/bee-cascader.git",
"author": "supernever",

@@ -19,0 +19,0 @@ "repository": "http://github.com/tinper-bee/bee-cascader",

@@ -130,2 +130,17 @@ import React, { Component } from 'react';

}
componentWillReceiveProps(nextProps){
if('options' in nextProps){
let options = nextProps.options;
for (let i = options.length - 1; i >= 0; i--) {
options[i]['parent'] = true
}
this.setState({
option:options,
textStr:[]
})
if(this.props.onClick){
this.props.onClick([]);
}
}
}
render(){

@@ -132,0 +147,0 @@ let va = this.state.textStr.join('/');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc