Skip to content

Commit 073752a

Browse files
committed
first commit
0 parents  commit 073752a

15 files changed

+456
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*.{js,css}]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 2

.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
*.iml
2+
*.log
3+
.idea
4+
.ipr
5+
.iws
6+
*~
7+
~*
8+
*.diff
9+
*.patch
10+
*.bak
11+
.DS_Store
12+
Thumbs.db
13+
.project
14+
.*proj
15+
.svn
16+
*.swp
17+
*.swo
18+
*.pyc
19+
*.pyo
20+
node_modules
21+
.cache
22+
*.css
23+
build
24+
lib

.travis.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
language: node_js
2+
3+
sudo: false
4+
5+
notifications:
6+
email:
7+
8+
9+
node_js:
10+
- 4.0.0
11+
12+
before_install:
13+
- |
14+
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
15+
then
16+
echo "Only docs were updated, stopping build process."
17+
exit
18+
fi
19+
phantomjs --version
20+
script:
21+
- |
22+
if [ "$TEST_TYPE" = test ]; then
23+
npm test
24+
else
25+
npm run $TEST_TYPE
26+
fi
27+
env:
28+
matrix:
29+
- TEST_TYPE=lint
30+
- TEST_TYPE=browser-test
31+
- TEST_TYPE=browser-test-cover
32+
- TEST_TYPE=saucelabs
33+
34+
35+
matrix:
36+
allow_failures:
37+
- env: "TEST_TYPE=saucelabs"

HISTORY.md

Whitespace-only changes.

README.md

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# rc-cascader
2+
---
3+
4+
React Cascader Component
5+
6+
7+
[![NPM version][npm-image]][npm-url]
8+
[![build status][travis-image]][travis-url]
9+
[![Test coverage][coveralls-image]][coveralls-url]
10+
[![gemnasium deps][gemnasium-image]][gemnasium-url]
11+
[![node version][node-image]][node-url]
12+
[![npm download][download-image]][download-url]
13+
[![Sauce Test Status](https://saucelabs.com/buildstatus/rc-cascader)](https://saucelabs.com/u/rc-cascader)
14+
15+
[![Sauce Test Status](https://saucelabs.com/browser-matrix/rc-cascader.svg)](https://saucelabs.com/u/rc-cascader)
16+
17+
[npm-image]: http://img.shields.io/npm/v/rc-cascader.svg?style=flat-square
18+
[npm-url]: http://npmjs.org/package/rc-cascader
19+
[travis-image]: https://img.shields.io/travis/react-component/cascader.svg?style=flat-square
20+
[travis-url]: https://travis-ci.org/react-component/cascader
21+
[coveralls-image]: https://img.shields.io/coveralls/react-component/cascader.svg?style=flat-square
22+
[coveralls-url]: https://coveralls.io/r/react-component/cascader?branch=master
23+
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/cascader.svg?style=flat-square
24+
[gemnasium-url]: https://gemnasium.com/react-component/cascader
25+
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
26+
[node-url]: http://nodejs.org/download/
27+
[download-image]: https://img.shields.io/npm/dm/rc-cascader.svg?style=flat-square
28+
[download-url]: https://npmjs.org/package/rc-cascader
29+
30+
31+
## Browser Support
32+
33+
|![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)|
34+
| --- | --- | --- | --- | --- |
35+
| IE 8+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ |
36+
37+
## Screenshots
38+
39+
<img src="" width="288"/>
40+
41+
42+
## Development
43+
44+
```
45+
npm install
46+
npm start
47+
```
48+
49+
## Example
50+
51+
http://localhost:8000/examples/
52+
53+
54+
online example: http://react-component.github.io/cascader/
55+
56+
57+
## Feature
58+
59+
* support ie8,ie8+,chrome,firefox,safari
60+
61+
### Keyboard
62+
63+
64+
## install
65+
66+
67+
[![rc-cascader](https://nodei.co/npm/rc-cascader.png)](https://npmjs.org/package/rc-cascader)
68+
69+
70+
## Usage
71+
72+
```js
73+
var Cascader = require('rc-cascader');
74+
var React = require('react');
75+
React.render(<Cascader />, container);
76+
```
77+
78+
## API
79+
80+
### props
81+
82+
<table class="table table-bordered table-striped">
83+
<thead>
84+
<tr>
85+
<th style="width: 100px;">name</th>
86+
<th style="width: 50px;">type</th>
87+
<th style="width: 50px;">default</th>
88+
<th>description</th>
89+
</tr>
90+
</thead>
91+
<tbody>
92+
<tr>
93+
<td>className</td>
94+
<td>String</td>
95+
<td></td>
96+
<td>additional css class of root dom node</td>
97+
</tr>
98+
</tbody>
99+
</table>
100+
101+
102+
## Test Case
103+
104+
http://localhost:8000/tests/runner.html?coverage
105+
106+
## Coverage
107+
108+
http://localhost:8000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8000/tests/runner.html?coverage
109+
110+
## License
111+
112+
rc-cascader is released under the MIT license.

assets/index.less

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.rc-cascader {
2+
&-menus-hidden {
3+
display: none;
4+
}
5+
}

examples/simple.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
placeholder

examples/simple.js

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// use jsx to render html, do not modify simple.html
2+
3+
import 'rc-cascader/assets/index.less';
4+
import Cascader from 'rc-cascader';
5+
import React from 'react';
6+
import ReactDOM from 'react-dom';
7+
8+
const addressOptions = [{
9+
"label": "福建",
10+
"value": "fj",
11+
"options": [{
12+
"label": "福州",
13+
"value": "fuzhou",
14+
"options": [{
15+
"label": "马尾",
16+
"value": "mawei",
17+
}],
18+
}, {
19+
"label": "泉州",
20+
"value": "quanzhou"
21+
}],
22+
}, {
23+
"label": "浙江",
24+
"value": "zj",
25+
"options": [{
26+
"label": "杭州",
27+
"value": "hangzhou",
28+
"options": [{
29+
"label": "余杭",
30+
"value": "yuhang",
31+
}],
32+
}],
33+
}, {
34+
"label": "北京",
35+
"value": "bj",
36+
"options": [{
37+
"label": "朝阳区",
38+
"value": "chaoyang",
39+
}, {
40+
"label": "海淀区",
41+
"value": "haidian",
42+
}],
43+
}];
44+
45+
const Demo = React.createClass({
46+
getInitialState() {
47+
return {
48+
value: '',
49+
};
50+
},
51+
onChange(options = []) {
52+
this.setState({
53+
value: options.map(o => o.label).join(', '),
54+
});
55+
},
56+
render() {
57+
return (
58+
<Cascader options={addressOptions} onChange={this.onChange}>
59+
<input value={this.state.value} />
60+
</Cascader>
61+
);
62+
},
63+
})
64+
65+
ReactDOM.render(<Demo />, document.getElementById('__react-content'));

index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// export this package's api
2+
import Cascader from './src/';
3+
export default Cascader;

package.json

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "rc-cascader",
3+
"version": "0.1.0",
4+
"description": "cascader ui component for react",
5+
"keywords": [
6+
"react",
7+
"react-component",
8+
"react-cascader",
9+
"cascader"
10+
],
11+
"homepage": "https://github.com/react-component/cascader",
12+
"author": "[email protected]",
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/react-component/cascader.git"
16+
},
17+
"bugs": {
18+
"url": "https://github.com/react-component/cascader/issues"
19+
},
20+
"files": [
21+
"lib",
22+
"assets/*.css"
23+
],
24+
"licenses": "MIT",
25+
"main": "./lib/index",
26+
"config": {
27+
"port": 8000
28+
},
29+
"scripts": {
30+
"build": "rc-tools run build",
31+
"gh-pages": "rc-tools run gh-pages",
32+
"start": "rc-server",
33+
"pub": "rc-tools run pub",
34+
"lint": "rc-tools run lint",
35+
"karma": "rc-tools run karma",
36+
"saucelabs": "rc-tools run saucelabs",
37+
"browser-test": "rc-tools run browser-test",
38+
"browser-test-cover": "rc-tools run browser-test-cover"
39+
},
40+
"devDependencies": {
41+
"expect.js": "0.3.x",
42+
"pre-commit": "1.x",
43+
"rc-server": "3.x",
44+
"rc-tools": "4.x",
45+
"react": "0.14.x",
46+
"react-addons-test-utils": "0.14.x",
47+
"react-dom": "0.14.x"
48+
},
49+
"pre-commit": [
50+
"lint"
51+
],
52+
"dependencies": {
53+
"rc-trigger": "^1.0.6"
54+
}
55+
}

0 commit comments

Comments
 (0)