-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
召伯
committed
Dec 2, 2016
0 parents
commit b868919
Showing
17 changed files
with
543 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "airbnb", | ||
"plugins": [ | ||
"react" | ||
], | ||
"env": { | ||
"browser": true | ||
}, | ||
"rules": { | ||
"import/no-extraneous-dependencies": "off", | ||
"react/jsx-no-bind": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
*.iml | ||
*.log | ||
.idea/ | ||
.ipr | ||
.iws | ||
*~ | ||
~* | ||
*.diff | ||
*.patch | ||
*.bak | ||
.DS_Store | ||
Thumbs.db | ||
.project | ||
.*proj | ||
.svn/ | ||
*.swp | ||
*.swo | ||
*.pyc | ||
*.pyo | ||
.build | ||
node_modules | ||
_site | ||
sea-modules | ||
spm_modules | ||
.cache | ||
.happypack | ||
dist | ||
build | ||
assets/**/*.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
bower_components/ | ||
*.cfg | ||
node_modules/ | ||
nohup.out | ||
*.iml | ||
.idea/ | ||
.ipr | ||
.iws | ||
*~ | ||
~* | ||
*.diff | ||
*.log | ||
*.patch | ||
*.bak | ||
.DS_Store | ||
Thumbs.db | ||
.project | ||
.*proj | ||
.svn/ | ||
*.swp | ||
out/ | ||
.build | ||
.happypack | ||
node_modules | ||
_site | ||
sea-modules | ||
spm_modules | ||
.cache | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
language: node_js | ||
|
||
sudo: false | ||
|
||
notification: | ||
email: | ||
- [email protected] | ||
|
||
node_js: | ||
- 4.0.0 | ||
|
||
before_install: | ||
- | | ||
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qve '(\.md$)|(\.html$)' | ||
then | ||
echo "Only docs were updated, stopping build process." | ||
exit | ||
fi | ||
phantomjs --version | ||
script: | ||
- | | ||
if [ "$TEST_TYPE" = test ]; then | ||
npm test | ||
else | ||
npm run $TEST_TYPE | ||
fi | ||
env: | ||
matrix: | ||
- TEST_TYPE=test | ||
- TEST_TYPE=coverage | ||
- TEST_TYPE=saucelabs | ||
|
||
matrix: | ||
allow_failures: | ||
- env: "TEST_TYPE=saucelabs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"generator-uxcore": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# history | ||
|
||
## 0.1.0 | ||
`NEW` a new form field component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
## uxcore-transfer-form-field | ||
|
||
React transfer form field | ||
|
||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![Test Coverage][coveralls-image]][coveralls-url] | ||
[![Dependency Status][dep-image]][dep-url] | ||
[![devDependency Status][devdep-image]][devdep-url] | ||
[![NPM downloads][downloads-image]][npm-url] | ||
|
||
[![Sauce Test Status][sauce-image]][sauce-url] | ||
|
||
[npm-image]: http://img.shields.io/npm/v/uxcore-transfer-form-field.svg?style=flat-square | ||
[npm-url]: http://npmjs.org/package/uxcore-transfer-form-field | ||
[travis-image]: https://img.shields.io/travis/uxcore/uxcore-transfer-form-field.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/uxcore/uxcore-transfer-form-field | ||
[coveralls-image]: https://img.shields.io/coveralls/uxcore/uxcore-transfer-form-field.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/uxcore/uxcore-transfer-form-field?branch=master | ||
[dep-image]: http://img.shields.io/david/uxcore/uxcore-transfer-form-field.svg?style=flat-square | ||
[dep-url]: https://david-dm.org/uxcore/uxcore-transfer-form-field | ||
[devdep-image]: http://img.shields.io/david/dev/uxcore/uxcore-transfer-form-field.svg?style=flat-square | ||
[devdep-url]: https://david-dm.org/uxcore/uxcore-transfer-form-field#info=devDependencies | ||
[downloads-image]: https://img.shields.io/npm/dm/uxcore-transfer-form-field.svg | ||
[sauce-image]: https://saucelabs.com/browser-matrix/uxcore-transfer-form-field.svg | ||
[sauce-url]: https://saucelabs.com/u/uxcore-transfer-form-field | ||
|
||
|
||
### Development | ||
|
||
```sh | ||
git clone https://github.com/uxcore/uxcore-transfer-form-field | ||
cd uxcore-transfer-form-field | ||
npm install | ||
npm run server | ||
``` | ||
|
||
if you'd like to save your install time,you can use uxcore-tools globally. | ||
|
||
```sh | ||
npm install uxcore-tools -g | ||
git clone https://github.com/uxcore/uxcore-transfer-form-field | ||
cd uxcore-transfer-form-field | ||
npm install | ||
npm run dep | ||
npm run start | ||
``` | ||
|
||
### Test Case | ||
|
||
```sh | ||
npm run test | ||
``` | ||
|
||
### Coverage | ||
|
||
```sh | ||
npm run coverage | ||
``` | ||
|
||
## Demo | ||
|
||
http://uxcore.github.io/components/transfer-form-field | ||
|
||
## Contribute | ||
|
||
Yes please! See the [CONTRIBUTING](https://github.com/uxcore/uxcore/blob/master/CONTRIBUTING.md) for details. | ||
|
||
## API | ||
|
||
## Props | ||
|
||
|参数|类型|必需|默认值|说明| | ||
|---|----|---|----|---| | ||
|height|number|optional|220|transfer高度| | ||
|disabled|boolean|optional|false|是否启用 disable 模式| | ||
|showSearch|boolean|optional|true|是否显示搜索条| | ||
|searchPlaceholder|string|optional|定位输入内容|| | ||
|leftTitle|string|optional|'未选中的'|左侧标题| | ||
|rightTitle|string|optional|'已选中的'|右侧标题| | ||
|
||
* 其它props请参考[FormField通用配置](http://uxcore.coding.me/components/form/#formfield-专属配置) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
/** | ||
* TransferFormField Component Demo for uxcore | ||
* @author maquanyun | ||
* | ||
* Copyright 2015-2016, Uxcore Team, Alinw. | ||
* All rights reserved. | ||
*/ | ||
|
||
import React from 'react'; | ||
import Form from 'uxcore-form'; | ||
import Button from 'uxcore-button'; | ||
import TransferFormField from '../src'; | ||
|
||
const { OtherFormField: Other } = Form; | ||
|
||
// const mockData = []; | ||
// const len = (Math.random() * 10) + 10; | ||
// for (let i = 0; i < len; i++) { | ||
// mockData.push({ | ||
// name: `内容${i + 1}`, | ||
// value: (i + 1), | ||
// description: `内容${i + 1}的描述`, | ||
// chosen: Math.random() * 2 > 1, | ||
// }); | ||
// } | ||
|
||
const mockData = [ | ||
{ | ||
name: '内容1', | ||
value: 1, | ||
description: '内容1的描述', | ||
chosen: true, | ||
}, | ||
{ | ||
name: '内容2', | ||
value: 2, | ||
description: '内容2的描述', | ||
chosen: true, | ||
}, | ||
{ | ||
name: '内容3', | ||
value: 3, | ||
description: '内容3的描述', | ||
chosen: true, | ||
}, | ||
{ | ||
name: '内容4', | ||
value: 4, | ||
description: '内容4的描述', | ||
chosen: true, | ||
}, | ||
{ | ||
name: '内容5', | ||
value: 5, | ||
description: '内容5的描述', | ||
chosen: false, | ||
}, | ||
{ | ||
name: '内容6', | ||
value: 6, | ||
description: '内容6的描述', | ||
chosen: true, | ||
}, | ||
{ | ||
name: '内容7', | ||
value: 7, | ||
description: '内容7的描述', | ||
chosen: true, | ||
}, | ||
{ | ||
name: '内容8', | ||
value: 8, | ||
description: '内容8的描述', | ||
chosen: false, | ||
}, | ||
{ | ||
name: '内容9', | ||
value: 9, | ||
description: '内容9的描述', | ||
chosen: true, | ||
}, | ||
{ | ||
name: '内容10', | ||
value: 10, | ||
description: '内容10的描述', | ||
chosen: false, | ||
}, | ||
{ | ||
name: '内容11', | ||
value: 11, | ||
description: '内容11的描述', | ||
chosen: true, | ||
}, | ||
{ | ||
name: '内容12', | ||
value: 12, | ||
description: '内容12的描述', | ||
chosen: false, | ||
}, | ||
{ | ||
name: '内容13', | ||
value: 13, | ||
description: '内容13的描述', | ||
chosen: false, | ||
}, | ||
{ | ||
name: '内容14', | ||
value: 14, | ||
description: '内容14的描述', | ||
chosen: false, | ||
}, | ||
]; | ||
|
||
class Demo extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
values: {}, | ||
}; | ||
} | ||
|
||
handleClick() { | ||
const me = this; | ||
alert(JSON.stringify(me.form.getValues())); | ||
} | ||
|
||
handleChange(data) { | ||
console.log(data); | ||
} | ||
|
||
handleReset() { | ||
const me = this; | ||
me.refs.form.resetValues(); | ||
} | ||
|
||
render() { | ||
const me = this; | ||
return ( | ||
<TransferFormField | ||
jsxlabel="穿梭框" | ||
value={mockData} | ||
disabled={false} | ||
showSearch | ||
standalone | ||
searchPlaceholder="请输入" | ||
leftTitle="未选中" | ||
rightTitle="已选中" | ||
handleDataChange={me.handleChange.bind(this)} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
module.exports = Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* TransferFormField Component Demo Style for Uxcore | ||
* @author maquanyun | ||
* | ||
* Copyright 2015-2016, Uxcore Team, Alinw. | ||
* All rights reserved. | ||
*/ | ||
|
||
@import "../node_modules/kuma-base/theme/orange"; | ||
@import "../src/TransferFormField.less"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* TransferFormField Component Demo for uxcore | ||
* @author maquanyun | ||
* | ||
* Copyright 2015-2016, Uxcore Team, Alinw. | ||
* All rights reserved. | ||
*/ | ||
|
||
import ReactDOM from 'react-dom'; | ||
import React from 'react'; | ||
import Demo from './TransferFormFieldDemo'; | ||
|
||
ReactDOM.render(<Demo />, document.getElementById('UXCoreDemo')); | ||
|
Oops, something went wrong.