Skip to content

Commit

Permalink
feat: 1st ci
Browse files Browse the repository at this point in the history
  • Loading branch information
召伯 committed Dec 2, 2016
0 parents commit b868919
Show file tree
Hide file tree
Showing 17 changed files with 543 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .eslintrc.json
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"
}
}
29 changes: 29 additions & 0 deletions .gitignore
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
29 changes: 29 additions & 0 deletions .npmignore
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
37 changes: 37 additions & 0 deletions .travis.yml
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"
3 changes: 3 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"generator-uxcore": {}
}
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# history

## 0.1.0
`NEW` a new form field component
83 changes: 83 additions & 0 deletions README.md
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-专属配置)

155 changes: 155 additions & 0 deletions demo/TransferFormFieldDemo.jsx
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;
10 changes: 10 additions & 0 deletions demo/TransferFormFieldDemo.less
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";
14 changes: 14 additions & 0 deletions demo/index.jsx
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'));

Loading

0 comments on commit b868919

Please sign in to comment.