uxcore-select2
Advanced tools
Comparing version 0.1.5 to 0.1.6
/** | ||
* Select2 Component Demo for uxcore | ||
* @author | ||
* @author | ||
* | ||
@@ -10,2 +10,2 @@ * Copyright 2014-2015, Uxcore Team, Alinw. | ||
var Demo = require('./Select2Demo'); | ||
React.render(<Demo/>, document.getElementById('UXCoreDemo')); | ||
ReactDOM.render(<Demo/>, document.getElementById('UXCoreDemo')); |
@@ -33,2 +33,3 @@ let Select = require('../src'); | ||
options: [], | ||
ajaxData: [], | ||
cities: cityData[provinceData[0]], | ||
@@ -39,2 +40,24 @@ secondCity:cityData[provinceData[0]][0] | ||
fetchData(value) { | ||
let me = this; | ||
$.ajax({ | ||
url: "http://suggest.taobao.com/sug", | ||
dataType: "jsonp", | ||
data: {q: value}, | ||
success: (data) => { | ||
me.setState({ | ||
ajaxData: data.result | ||
}); | ||
}, | ||
fail: () => { | ||
console.log("Fetch Data failed"); | ||
} | ||
}) | ||
} | ||
handleSearch(value) { | ||
let me = this; | ||
me.fetchData(value); | ||
} | ||
handleMailChange(value) { | ||
@@ -67,2 +90,3 @@ var options; | ||
render() { | ||
let me = this; | ||
let provinceOptions = provinceData.map(function(province) { | ||
@@ -74,2 +98,5 @@ return <Option key={province}>{province}</Option>; | ||
}); | ||
let ajaxOptions = me.state.ajaxData.map((d,index) => { | ||
return <Option key={d[1]}>{d[0]}</Option>; | ||
}); | ||
return ( | ||
@@ -95,2 +122,6 @@ <div> | ||
</Select> | ||
<p>多选提示,提示项根据 ajax 获得</p> | ||
<Select multiple filterOption={false} style={{width: 400}} onSearch={me.handleSearch.bind(me)} onChange={handleChange}> | ||
{ajaxOptions} | ||
</Select> | ||
<p>标签:(标签的意义是,用户可以通过键盘自己输入值,而不局限于传入的选项)</p> | ||
@@ -97,0 +128,0 @@ <Select style={{width: '100%'}} searchPlaceholder="标签模式" tags onChange={handleChange}> |
@@ -5,4 +5,7 @@ # History | ||
## 0.1.6 | ||
`CHANGED` upgrade to react@0.14 | ||
## 0.1.5 | ||
`CHANGED` update rc-select to 4.9.0 | ||
`CHANGED` update rc-select to 4.9.0 | ||
@@ -9,0 +12,0 @@ ## 0.1.4 |
{ | ||
"name": "uxcore-select2", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "select ui component for react", | ||
@@ -35,3 +35,6 @@ "main": "src/index.js", | ||
"gulp-sourcemaps": "~1.5.2", | ||
"jquery": "~1.11.3", | ||
"jsonp": "^0.2.0", | ||
"react": "~0.14.0", | ||
"react-dom": "~0.14.0", | ||
"webpack": "^1.10.5" | ||
@@ -43,4 +46,3 @@ }, | ||
"rc-select": "~4.9.0", | ||
"react": "^0.13.3", | ||
"uxcore-kuma": "~1.0.6" | ||
"uxcore-kuma": "^1.1.0" | ||
}, | ||
@@ -47,0 +49,0 @@ "author": "", |
@@ -1,35 +0,21 @@ | ||
# uxcore-select | ||
--- | ||
- tags: uxcore, select | ||
- description: uxcore select | ||
- maintainers: vincent.bian | ||
- version: 0.1.4 | ||
- lastupdate: 2015/9/1 | ||
- screenshots: | ||
## uxcore-select2 [](https://david-dm.org/uxcore/uxcore-select2) [](https://david-dm.org/uxcore/uxcore-select2#info=devDependencies) | ||
--- | ||
## TL;DR | ||
uxcore-select2 ui component for react | ||
#### setup develop environment | ||
```sh | ||
$ git clone https://github.com/uxcore/select | ||
$ cd select | ||
$ git clone https://github.com/uxcore/uxcore-select2 | ||
$ cd uxcore-select2 | ||
$ npm install | ||
$ npm run dev | ||
$ gulp server | ||
``` | ||
nav http://localhost:9090/webpack-dev-server/example/ to see the demo | ||
#### deploy to gh-pages | ||
[refer to]( http://stackoverflow.com/questions/17643381/how-to-upload-my-angularjs-static-site-to-github-pages) | ||
```sh | ||
$ npm run build | ||
$ git add build & git commit -m 'update deploy files' | ||
$ npm run deploy | ||
``` | ||
## Usage | ||
```js | ||
```javascript | ||
var Select = require('uxcore-select2'); | ||
@@ -44,3 +30,3 @@ <Select> | ||
## API | ||
## Props | ||
@@ -65,2 +51,3 @@ ### Select props | ||
|size | 选择框大小 | String | 无 | | ||
|optionLabelProp| 选择 Option 的哪个 prop 作为选择框中的显示。| string | 'children' | | ||
@@ -67,0 +54,0 @@ ### Option props |
let RcSelect = require('rc-select'); | ||
let assign = require('object-assign'); | ||
@@ -9,4 +10,6 @@ class Select2 extends RcSelect { | ||
Select2.displayName = 'Select2'; | ||
Select2.defaultProps = RcSelect.defaultProps; | ||
Select2.defaultProps.prefixCls = "kuma-select"; | ||
Select2.defaultProps = assign({}, RcSelect.defaultProps, { | ||
prefixCls: "kuma-select", | ||
optionLabelProp: "children" | ||
}); | ||
@@ -13,0 +16,0 @@ module.exports = Select2; |
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 not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
44272
4
637
0
15
64
+ Addeduxcore-kuma@1.2.10(transitive)
- Removedreact@^0.13.3
- Removedacorn@5.7.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedast-types@0.9.6(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase62@1.2.8(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcommoner@0.10.8(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddefined@1.0.1(transitive)
- Removeddetective@4.7.1(transitive)
- Removedenvify@3.4.1(transitive)
- Removedesprima@3.1.3(transitive)
- Removedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
- Removedglob@5.0.15(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjstransform@11.0.3(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprivate@0.1.8(transitive)
- Removedq@1.5.1(transitive)
- Removedreact@0.13.3(transitive)
- Removedrecast@0.11.23(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsource-map@0.4.40.5.7(transitive)
- Removedthrough@2.3.8(transitive)
- Removeduxcore-kuma@1.0.8(transitive)
- Removedwrappy@1.0.2(transitive)
Updateduxcore-kuma@^1.1.0