Merge branch 'master' of github.com:ant-design/ant-design

This commit is contained in:
afc163 2016-02-22 12:03:49 +08:00
commit a567faeafb
31 changed files with 84 additions and 99 deletions

View File

@ -7,9 +7,12 @@
"jest": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
},
"plugins": [
"markdown",
@ -28,6 +31,8 @@
"react/jsx-closing-bracket-location": 0,
"react/jsx-no-bind": 0,
"no-param-reassign": 0,
"max-len": 0
"no-return-assign": 0,
"max-len": 0,
"consistent-return": 0
}
}

View File

@ -4,10 +4,6 @@ import ScrollNumber from './ScrollNumber';
import classNames from 'classnames';
class AntBadge extends React.Component {
constructor(props) {
super(props);
}
render() {
let { count, prefixCls, overflowCount, className, style, children } = this.props;
const dot = this.props.dot;

View File

@ -18,13 +18,13 @@ const text = `
ReactDOM.render(
<Collapse accordion>
<Panel header={`This is panel header 1`} key="1">
<Panel header={'This is panel header 1'} key="1">
<p>{text}</p>
</Panel>
<Panel header={`This is panel header 2`} key="2">
<Panel header={'This is panel header 2'} key="2">
<p>{text}</p>
</Panel>
<Panel header={`This is panel header 3`} key="3">
<Panel header={'This is panel header 3'} key="3">
<p>{text}</p>
</Panel>
</Collapse>

View File

@ -22,17 +22,17 @@ const text = `
ReactDOM.render(
<Collapse onChange={callback} accordion>
<Panel header={`This is panel header 1`} key="1">
<Panel header={'This is panel header 1'} key="1">
<Collapse defaultActiveKey="1">
<Panel header={`This is panel nest panel`} key="1">
<Panel header={'This is panel nest panel'} key="1">
<p>{text}</p>
</Panel>
</Collapse>
</Panel>
<Panel header={`This is panel header 2`} key="2">
<Panel header={'This is panel header 2'} key="2">
<p>{text}</p>
</Panel>
<Panel header={`This is panel header 3`} key="3">
<Panel header={'This is panel header 3'} key="3">
<p>{text}</p>
</Panel>
</Collapse>

View File

@ -58,6 +58,8 @@ class FormItem extends React.Component {
} else if (getFieldValue(field) !== undefined) {
return 'success';
}
return '';
}
renderValidateWrapper(c1, c2, c3) {

View File

@ -1,14 +1,3 @@
function merge() {
const ret = {};
const args = [].slice.call(arguments, 0);
args.forEach((a) => {
Object.keys(a).forEach((k) => {
ret[k] = a[k];
});
});
return ret;
}
const ValueMixin = {
setValue(field, e) {
let v = e;
@ -24,7 +13,10 @@ const ValueMixin = {
const newFormData = {};
newFormData[field] = v;
this.setState({
formData: merge(this.state.formData, newFormData),
formData: {
...this.state.formData,
...newFormData,
},
});
},
};

View File

@ -17,7 +17,7 @@ const App = React.createClass({
};
},
onChange(e) {
console.log(`radio checked`, e.target.value);
console.log('radio checked', e.target.value);
this.setState({
value: e.target.value
});

View File

@ -59,9 +59,7 @@ let FilterMenu = React.createClass({
const keyPathOfSelectedItem = this.state.keyPathOfSelectedItem;
const containSelected = Object.keys(keyPathOfSelectedItem).some(key => {
const keyPath = keyPathOfSelectedItem[key];
if (keyPath.indexOf(item.value) >= 0) {
return true;
}
return keyPath.indexOf(item.value) >= 0;
});
const subMenuCls = containSelected ? 'ant-dropdown-submenu-contain-selected' : '';
return (

View File

@ -134,8 +134,8 @@ let AntTable = React.createClass({
}
}
if (typeof column.sorter === 'function') {
sorter = function () {
let result = column.sorter.apply(this, arguments);
sorter = function (...args) {
let result = column.sorter.apply(this, args);
if (sortOrder === 'ascend') {
return result;
} else if (sortOrder === 'descend') {
@ -517,10 +517,7 @@ let AntTable = React.createClass({
//
if (data.length > pageSize || pageSize === Number.MAX_VALUE) {
data = data.filter((item, i) => {
if (i >= (current - 1) * pageSize &&
i < current * pageSize) {
return item;
}
return i >= (current - 1) * pageSize && i < current * pageSize;
});
}
return data;

View File

@ -33,6 +33,7 @@ class Transfer extends Component {
leftDataSource.splice(index, 1);
return true;
}
return false;
})[0]);
});
}

View File

@ -81,21 +81,19 @@ class TransferList extends Component {
[`${prefixCls}-with-footer`]: !!footerDom,
});
const showItems = dataSource.map((item) => {
// apply filter
const showItems = dataSource.filter((item) => {
const itemText = this.props.render(item);
const filterResult = this.matchFilter(itemText, filter);
return !!filterResult;
}).map((item) => {
const renderedText = this.props.render(item);
if (filterResult) {
return (
<li onClick={this.handleSelect.bind(this, item)} key={item.key} title={renderedText}>
<Checkbox checked={checkedKeys.some(key => key === item.key)} />
{renderedText}
</li>
);
}
}).filter(item => !!item);
});
return (
<div className={listCls} {...this.props}>
@ -104,7 +102,7 @@ class TransferList extends Component {
prefixCls: 'ant-transfer',
checked: checkStatus === 'all',
checkPart: checkStatus === 'part',
checkable: <span className={`ant-transfer-checkbox-inner`}></span>
checkable: <span className={'ant-transfer-checkbox-inner'}></span>
})}<span className={`${prefixCls}-header-selected`}><span>{(checkedKeys.length > 0 ? `${checkedKeys.length}/` : '') + dataSource.length} </span>
<span className={`${prefixCls}-header-title`}>{titleText}</span></span>
</div>

View File

@ -4,10 +4,6 @@ function noop() {
}
class Search extends Component {
constructor(props) {
super(props);
}
handleChange(e) {
this.props.onChange(e);
}

View File

@ -86,12 +86,12 @@
"css-loader": "^0.23.0",
"cz-conventional-changelog": "^1.1.5",
"es3ify-loader": "^0.1.0",
"eslint": "^1.1.0",
"eslint-config-airbnb": "latest",
"eslint": "^2.2.0",
"eslint-config-airbnb": "^6.0.1",
"eslint-plugin-babel": "^3.0.0",
"eslint-plugin-markdown": "*",
"eslint-plugin-react": "^3.3.1",
"eslint-tinker": "~0.2.0",
"eslint-plugin-react": "^4.0.0",
"eslint-tinker": "^0.3.1",
"extract-text-webpack-plugin": "^1.0.1",
"gh-pages": "^0.9.0",
"history": "^1.17.0",
@ -130,7 +130,7 @@
"just-deploy": "npm run site && node scripts/deploy.js",
"lint": "npm run srclint && npm run mdlint && npm run lesshint",
"srclint": "eslint components test index.js --ext '.js,.jsx'",
"mdlint": "eslint components/*/demo/*.md --ext '.md' --global 'React,ReactDOM,mountNode' --rule 'no-console: 0,eol-last: 0'",
"mdlint": "eslint components/*/demo/*.md --ext '.md' --global 'React,ReactDOM,mountNode' --rule 'no-console: 0, eol-last: 0, prefer-rest-params: 0'",
"lesshint": "lesshint style/ -e 'style/+(core|mixins)/+(base|iconfont|normalize|layouts|compatibility|grid).less'",
"eslint-fix": "eslint --fix components test index.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md",
"test": "npm run lint && webpack && npm run jest",