diff --git a/components/alert/index.jsx b/components/alert/index.jsx
index a5cf1fa569251a554a89f8f86c84565a9a5e9a0b..91c0f8ad231f946f9309ef1d0bdc9c407884af3a 100644
--- a/components/alert/index.jsx
+++ b/components/alert/index.jsx
@@ -44,20 +44,20 @@ export default React.createClass({
let iconType = '';
switch (type) {
- case 'success':
- iconType = 'check-circle';
- break;
- case 'info':
- iconType = 'info-circle';
- break;
- case 'error':
- iconType = 'exclamation-circle';
- break;
- case 'warn':
- iconType = 'exclamation-circle';
- break;
- default:
- iconType = 'default';
+ case 'success':
+ iconType = 'check-circle';
+ break;
+ case 'info':
+ iconType = 'info-circle';
+ break;
+ case 'error':
+ iconType = 'exclamation-circle';
+ break;
+ case 'warn':
+ iconType = 'exclamation-circle';
+ break;
+ default:
+ iconType = 'default';
}
// use outline icon in alert with description
diff --git a/components/date-picker/RangePicker.jsx b/components/date-picker/RangePicker.jsx
index 6bda6ffc0ea10b12195328b26a86a37247296341..34fc598891fb7431762e8a61dbc2c194053c98f5 100644
--- a/components/date-picker/RangePicker.jsx
+++ b/components/date-picker/RangePicker.jsx
@@ -78,13 +78,13 @@ export default React.createClass({
const calendar = (
+ className={calendarClassName}
+ timePicker={timePicker}
+ disabledDate={disabledDate}
+ dateInputPlaceholder={[startPlaceholder, endPlaceholder]}
+ locale={locale.lang}
+ defaultValue={defaultCalendarValue}
+ showClear />
);
const pickerClass = classNames({
diff --git a/components/date-picker/index.jsx b/components/date-picker/index.jsx
index 091e6c25f29596b13e42f0e22861f4976872f80a..ad3d3af2b581be4632c9646e714d756f9d34ec9a 100644
--- a/components/date-picker/index.jsx
+++ b/components/date-picker/index.jsx
@@ -94,25 +94,25 @@ function createPicker(TheCalendar, defaultFormat) {
return (
+ disabled={this.props.disabled}
+ calendar={calendar}
+ value={this.state.value}
+ prefixCls="ant-calendar-picker-container"
+ style={this.props.popupStyle}
+ align={this.props.align}
+ onOpen={this.toggleOpen}
+ onClose={this.toggleOpen}
+ onChange={this.handleChange}>
{
({ value }) => {
return (
+ onChange={this.handleInputChange}
+ value={value && this.getFormatter().format(value)}
+ placeholder={placeholder}
+ style={this.props.style}
+ className={'ant-calendar-picker-input ant-input' + sizeClass}/>
);
diff --git a/components/input/index.jsx b/components/input/index.jsx
index c699680d74a22b1f0e14382b9c3b9ce63a44c09d..9bb54870bdbedfdbd8ddf44512595b7b31f1653e 100644
--- a/components/input/index.jsx
+++ b/components/input/index.jsx
@@ -72,9 +72,9 @@ class Input extends React.Component {
}
switch (props.size) {
- case 'small': inputClassName = prefixClsFn(prefixCls, 'input', 'input-sm'); break;
- case 'large': inputClassName = prefixClsFn(prefixCls, 'input', 'input-lg'); break;
- default:
+ case 'small': inputClassName = prefixClsFn(prefixCls, 'input', 'input-sm'); break;
+ case 'large': inputClassName = prefixClsFn(prefixCls, 'input', 'input-lg'); break;
+ default:
}
let placeholder = props.placeholder;
if (placeholder && ieGT9()) {
@@ -84,11 +84,14 @@ class Input extends React.Component {
props.value = fixControlledValue(props.value);
}
switch (props.type) {
- case 'textarea':
- return ;
- default:
- inputClassName = props.className ? props.className : inputClassName;
- return ;
+ case 'textarea':
+ return (
+
+ );
+ default:
+ inputClassName = props.className ? props.className : inputClassName;
+ return ;
}
}
diff --git a/components/layout/col.jsx b/components/layout/col.jsx
index 338e950ab58bb0205fd7b07cf6df4aefaef85d46..c8a5423667031935d6d09ef42b4ee511d0a001d3 100644
--- a/components/layout/col.jsx
+++ b/components/layout/col.jsx
@@ -12,7 +12,7 @@ const Col = React.createClass({
children: React.PropTypes.node,
},
render() {
- const {span, order, offset, push, pull, className, ...others} = this.props;
+ const { span, order, offset, push, pull, className, ...others } = this.props;
const classes = classNames({
['col-' + span]: span,
['col-order-' + order]: order,
diff --git a/components/layout/row.jsx b/components/layout/row.jsx
index 6f112140205ee368b0698fdfc2c31540efa1b388..234389425dbb7be924d8a3a22609fff2e41ca705 100644
--- a/components/layout/row.jsx
+++ b/components/layout/row.jsx
@@ -12,7 +12,7 @@ const Row = React.createClass({
render() {
const { type, justify, align, className, ...others } = this.props;
const classes = classNames({
- 'row': true,
+ row: true,
['row-' + type]: type,
['row-' + type + '-' + justify]: justify,
['row-' + type + '-' + align]: align,
diff --git a/components/menu/index.jsx b/components/menu/index.jsx
index ccad718e30edf55dd0ce89f23285ed716dabc263..90390d11a23478d5b34f0c4163bf73241dd8bd8d 100644
--- a/components/menu/index.jsx
+++ b/components/menu/index.jsx
@@ -43,16 +43,16 @@ const AntMenu = React.createClass({
let openAnimation = this.props.openAnimation || this.props.openTransitionName;
if (!openAnimation) {
switch (this.props.mode) {
- case 'horizontal':
- openAnimation = 'slide-up';
- break;
- case 'vertical':
- openAnimation = 'zoom-big';
- break;
- case 'inline':
- openAnimation = animation;
- break;
- default:
+ case 'horizontal':
+ openAnimation = 'slide-up';
+ break;
+ case 'vertical':
+ openAnimation = 'zoom-big';
+ break;
+ case 'inline':
+ openAnimation = animation;
+ break;
+ default:
}
}
diff --git a/components/message/index.jsx b/components/message/index.jsx
index cf982e88281d958f41781ba76d0a67061264eaa8..d539c69e98460239f8da4c26c04d9a138b22bbcf 100644
--- a/components/message/index.jsx
+++ b/components/message/index.jsx
@@ -12,7 +12,7 @@ function getMessageInstance() {
prefixCls: 'ant-message',
transitionName: 'move-up',
style: {
- top: top
+ top,
} // 覆盖原来的样式
});
return messageInstance;
@@ -20,31 +20,31 @@ function getMessageInstance() {
function notice(content, duration = defaultDuration, type, onClose) {
let iconClass = ({
- 'info': 'ant-message-info',
- 'success': 'ant-message-success',
- 'error': 'ant-message-error',
- 'warn': 'ant-message-warn',
- 'loading': 'ant-message-loading'
+ info: 'ant-message-info',
+ success: 'ant-message-success',
+ error: 'ant-message-error',
+ warn: 'ant-message-warn',
+ loading: 'ant-message-loading'
})[type];
let iconType = ({
- 'info': 'info-circle',
- 'success': 'check-circle',
- 'error': 'exclamation-circle',
- 'warn': 'exclamation-circle',
- 'loading': 'loading'
+ info: 'info-circle',
+ success: 'check-circle',
+ error: 'exclamation-circle',
+ warn: 'exclamation-circle',
+ loading: 'loading'
})[type];
let instance = getMessageInstance();
instance.notice({
- key: key,
- duration: duration,
+ key,
+ duration,
style: {},
content:
{content}
,
- onClose: onClose
+ onClose
});
return (function() {
let target = key++;
diff --git a/components/modal/confirm.jsx b/components/modal/confirm.jsx
index 21b9356407f93fbb729dd262a76776adf3d16a3e..a619185f3ec2eaf52da37d572bafb9920b064015 100644
--- a/components/modal/confirm.jsx
+++ b/components/modal/confirm.jsx
@@ -3,8 +3,10 @@ import ReactDOM from 'react-dom';
import Dialog from './index';
import Icon from '../icon';
import Button from '../button';
+import objectAssign from 'object-assign';
-export default function (props = {}) {
+export default function (config) {
+ const props = objectAssign({}, config || {});
let div = document.createElement('div');
document.body.appendChild(div);
@@ -110,7 +112,7 @@ export default function (props = {}) {
transitionName="zoom"
footer=""
maskTransitionName="fade" width={width}>
- {body} {footer}
+ {body} {footer}
, div, function () {
d = this;
});
diff --git a/components/modal/index.jsx b/components/modal/index.jsx
index 77f5fef7598dabb6f9f6c517c87bbad26bb39c4f..860fb01205c89a50344fe2f76d713bdfa61085ba 100644
--- a/components/modal/index.jsx
+++ b/components/modal/index.jsx
@@ -1,6 +1,7 @@
import React from 'react';
import Dialog from 'rc-dialog';
import { Dom } from 'rc-util';
+import objectAssign from 'object-assign';
import confirm from './confirm';
import Button from '../button';
@@ -72,32 +73,40 @@ let AntModal = React.createClass({
let footer = props.footer || defaultFooter;
return (
+ visible={props.visible} mousePosition={mousePosition} />
);
}
});
AntModal.info = function (props) {
- props.iconClassName = 'info-circle';
- props.okCancel = false;
- return confirm(props);
+ const config = objectAssign({}, props, {
+ iconClassName: 'info-circle',
+ okCancel: false,
+ });
+ return confirm(config);
};
AntModal.success = function (props) {
- props.iconClassName = 'check-circle';
- props.okCancel = false;
- return confirm(props);
+ const config = objectAssign({}, props, {
+ iconClassName: 'check-circle',
+ okCancel: false,
+ });
+ return confirm(config);
};
AntModal.error = function (props) {
- props.iconClassName = 'exclamation-circle';
- props.okCancel = false;
- return confirm(props);
+ const config = objectAssign({}, props, {
+ iconClassName: 'exclamation-circle',
+ okCancel: false,
+ });
+ return confirm(config);
};
AntModal.confirm = function (props) {
- props.okCancel = true;
- return confirm(props);
+ const config = objectAssign({}, props, {
+ okCancel: true,
+ });
+ return confirm(config);
};
export default AntModal;
diff --git a/components/notification/index.jsx b/components/notification/index.jsx
index 54ad38e993a8c718d153bd8a32c63f284425e456..af5c380097cfee2f44f4dfb911731963df99dc66 100644
--- a/components/notification/index.jsx
+++ b/components/notification/index.jsx
@@ -13,7 +13,7 @@ function getNotificationInstance() {
notificationInstance = Notification.newInstance({
prefixCls: 'ant-notification',
style: {
- top: top,
+ top,
right: 0
}
});
@@ -32,20 +32,20 @@ function notice(args) {
let prefixCls = ' ant-notification-notice-content-icon-';
let iconType = '';
switch (args.icon) {
- case 'success':
- iconType = 'check-circle-o';
- break;
- case 'info':
- iconType = 'info-circle-o';
- break;
- case 'error':
- iconType = 'exclamation-circle-o';
- break;
- case 'warn':
- iconType = 'question-circle-o';
- break;
- default:
- iconType = 'info-circle';
+ case 'success':
+ iconType = 'check-circle-o';
+ break;
+ case 'info':
+ iconType = 'info-circle-o';
+ break;
+ case 'error':
+ iconType = 'exclamation-circle-o';
+ break;
+ case 'warn':
+ iconType = 'question-circle-o';
+ break;
+ default:
+ iconType = 'info-circle';
}
getNotificationInstance().notice({
@@ -56,7 +56,7 @@ function notice(args) {
{args.description}
,
- duration: duration,
+ duration,
closable: true,
onClose: args.onClose,
key: args.key,
@@ -71,7 +71,7 @@ function notice(args) {
{args.description}
,
- duration: duration,
+ duration,
closable: true,
onClose: args.onClose,
key: args.key,
@@ -87,7 +87,7 @@ function notice(args) {
{args.btn}
,
- duration: duration,
+ duration,
closable: true,
onClose: args.onClose,
key: args.key,
diff --git a/components/pagination/index.jsx b/components/pagination/index.jsx
index 5435334341d6a6d667a7387bb1ee6152ff9db16d..1bbf3ac0cffb6505899851d31f9e392e77b716db 100644
--- a/components/pagination/index.jsx
+++ b/components/pagination/index.jsx
@@ -23,9 +23,9 @@ class AntPagination extends React.Component {
return (
+ selectPrefixCls="ant-select"
+ {...this.props}
+ className={className} />
);
}
}
diff --git a/components/popconfirm/index.jsx b/components/popconfirm/index.jsx
index eaa1fe0b36562fdbce7b5b02a0ba200dcb1eefda..8af14010bf7dbf006a91c9a2c197116f0c81266e 100644
--- a/components/popconfirm/index.jsx
+++ b/components/popconfirm/index.jsx
@@ -62,7 +62,7 @@ export default React.createClass({
}
},
render() {
- const {title, okText, cancelText, placement, overlayStyle, trigger} = this.props;
+ const { title, okText, cancelText, placement, overlayStyle, trigger } = this.props;
const overlay = (
@@ -82,13 +82,13 @@ export default React.createClass({
return (
+ overlayStyle={overlayStyle}
+ prefixCls={prefixCls}
+ onVisibleChange={this.onVisibleChange}
+ transitionName={transitionName}
+ visible={this.state.visible}
+ trigger={trigger}
+ overlay={overlay}>
{this.props.children}
);
diff --git a/components/popover/index.jsx b/components/popover/index.jsx
index dc2b9e9a6fbb4f613ec74c0d50c5abd03d95ce89..a90298221191d2a2df23440f25eb7ce30dbdb571 100644
--- a/components/popover/index.jsx
+++ b/components/popover/index.jsx
@@ -6,7 +6,7 @@ const prefixCls = 'ant-popover';
const Popover = React.createClass({
getDefaultProps() {
return {
- prefixCls: prefixCls,
+ prefixCls,
placement: 'top',
trigger: 'hover',
mouseEnterDelay: 0.1,
@@ -33,9 +33,9 @@ const Popover = React.createClass({
return (
+ ref="tooltip"
+ {...this.props}
+ overlay={this.getOverlay()}>
{this.props.children}
);
diff --git a/components/progress/index.jsx b/components/progress/index.jsx
index b089befb560e71f89e982dbc4f58ddf63d68083a..82bfce4c28d357e381045b01ac71127f7e2fcd04 100644
--- a/components/progress/index.jsx
+++ b/components/progress/index.jsx
@@ -1,4 +1,4 @@
-import {Circle as Progresscircle} from 'rc-progress';
+import { Circle as Progresscircle } from 'rc-progress';
import React from 'react';
import assign from 'object-assign';
import Icon from '../icon';
@@ -6,9 +6,9 @@ import Icon from '../icon';
const prefixCls = 'ant-progress';
const statusColorMap = {
- 'normal': '#2db7f5',
- 'exception': '#ff6600',
- 'success': '#87d068'
+ normal: '#2db7f5',
+ exception: '#ff6600',
+ success: '#87d068'
};
let Line = React.createClass({
@@ -83,7 +83,7 @@ let Circle = React.createClass({
strokeWidth: React.PropTypes.number,
width: React.PropTypes.number,
},
- getDefaultProps: function () {
+ getDefaultProps() {
return {
width: 132,
percent: 0,
@@ -100,9 +100,9 @@ let Circle = React.createClass({
}
let style = {
- 'width': props.width,
- 'height': props.width,
- 'fontSize': props.width * 0.16 + 6
+ width: props.width,
+ height: props.width,
+ fontSize: props.width * 0.16 + 6
};
let progressInfo;
const text = (typeof props.format === 'string') ?
@@ -136,6 +136,6 @@ let Circle = React.createClass({
});
export default {
- Line: Line,
- Circle: Circle
+ Line,
+ Circle,
};
diff --git a/components/radio/group.jsx b/components/radio/group.jsx
index 389417cd454de061336f3d3b7d9da1930aabdb2d..6cf061c6d505cbc2f95b9f6d36ac8a928e7bd01f 100644
--- a/components/radio/group.jsx
+++ b/components/radio/group.jsx
@@ -12,15 +12,15 @@ function getCheckedValue(children) {
}
export default React.createClass({
- getDefaultProps: function () {
+ getDefaultProps() {
return {
prefixCls: 'ant-radio-group',
disabled: false,
- onChange: function () {
+ onChange() {
}
};
},
- getInitialState: function () {
+ getInitialState() {
let props = this.props;
return {
value: props.value || props.defaultValue || getCheckedValue(props.children)
@@ -33,16 +33,16 @@ export default React.createClass({
});
}
},
- render: function () {
+ render() {
let props = this.props;
let children = React.Children.map(props.children, (radio) => {
if (radio.props) {
return (
+ {...radio.props}
+ onChange={this.onRadioChange}
+ checked={this.state.value === radio.props.value}
+ disabled={radio.props.disabled || this.props.disabled}/>
);
}
return radio;
@@ -53,7 +53,7 @@ export default React.createClass({
);
},
- onRadioChange: function (ev) {
+ onRadioChange(ev) {
this.setState({
value: ev.target.value
});
diff --git a/components/slider/index.jsx b/components/slider/index.jsx
index 8580ac7f2facff0b242be98733287f9edecc64c5..f08ace5d219717e55e0f4855219f084ebdca8dfb 100644
--- a/components/slider/index.jsx
+++ b/components/slider/index.jsx
@@ -9,7 +9,7 @@ export default React.createClass({
};
},
render() {
- const {isIncluded, marks, index, defaultIndex, ...rest} = this.props;
+ const { isIncluded, marks, index, defaultIndex, ...rest } = this.props;
if (isIncluded !== undefined) {
// 兼容 `isIncluded`
diff --git a/components/steps/index.jsx b/components/steps/index.jsx
index 35a634a3bcc341f5a0ea82eaa7a051d7d4a2d55d..ded92370a8b0bd14f2af9d2eb2f7d65c73d8fa67 100644
--- a/components/steps/index.jsx
+++ b/components/steps/index.jsx
@@ -18,11 +18,11 @@ const AntSteps = React.createClass({
}
return (
+ current={this.props.current}
+ direction={this.props.direction}
+ iconPrefix={this.props.iconPrefix}
+ maxDescriptionWidth={maxDescriptionWidth}
+ prefixCls={this.props.prefixCls}>
{this.props.children}
);
diff --git a/components/table/filterDropdown.jsx b/components/table/filterDropdown.jsx
index 267c2fe13801d5489334c313ff5e30045f4662a9..e0c5c00e25214d1663c82dc8b15f1e9d90fb73e7 100644
--- a/components/table/filterDropdown.jsx
+++ b/components/table/filterDropdown.jsx
@@ -20,12 +20,11 @@ let FilterMenu = React.createClass({
},
getDefaultProps() {
return {
- handleFilter: function () {
- },
+ handleFilter() {},
column: null
};
},
- setSelectedKeys: function ({selectedKeys}) {
+ setSelectedKeys({ selectedKeys }) {
this.setState({ selectedKeys });
},
handleClearFilters() {
@@ -41,7 +40,7 @@ let FilterMenu = React.createClass({
},
onVisibleChange(visible) {
this.setState({
- visible: visible
+ visible,
});
if (!visible) {
this.props.confirmFilter(this.props.column, this.state.selectedKeys);
@@ -89,7 +88,7 @@ let FilterMenu = React.createClass({
this.setState({ keyPathOfSelectedItem });
},
render() {
- let {column, locale} = this.props;
+ let { column, locale } = this.props;
// default multiple selection in filter dropdown
let multiple = true;
if ('filterMultiple' in column) {
@@ -117,19 +116,19 @@ let FilterMenu = React.createClass({
let menus = (
+ prefixCls="ant-dropdown-menu"
+ onSelect={this.setSelectedKeys}
+ onDeselect={this.setSelectedKeys}
+ selectedKeys={this.state.selectedKeys}>
{this.renderMenus(column.filters)}
@@ -144,10 +143,10 @@ let FilterMenu = React.createClass({
return (
+ overlay={menus}
+ visible={this.state.visible}
+ onVisibleChange={this.onVisibleChange}
+ closeOnSelect={false}>
);
diff --git a/components/table/index.jsx b/components/table/index.jsx
index f1c45343645b38570b705d75f02b6436ccbd0cd7..05aa2be785866bef52bac87918ae4176086e53cb 100644
--- a/components/table/index.jsx
+++ b/components/table/index.jsx
@@ -144,7 +144,9 @@ let AntTable = React.createClass({
sorter
};
this.setState(newState);
- this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
+ this.props.onChange.apply(this, this.prepareParamsArguments(
+ objectAssign({}, this.state, newState)
+ ));
},
handleFilter(column, nextFilters) {
@@ -164,7 +166,9 @@ let AntTable = React.createClass({
};
this.setState(newState);
this.setSelectedRowKeys([]);
- this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
+ this.props.onChange.apply(this, this.prepareParamsArguments(
+ objectAssign({}, this.state, newState)
+ ));
},
handleSelect(record, rowIndex, e) {
@@ -192,7 +196,7 @@ let AntTable = React.createClass({
}
},
- handleRadioSelect: function (record, rowIndex, e) {
+ handleRadioSelect(record, rowIndex, e) {
const checked = e.target.checked;
const defaultSelection = this.state.selectionDirty ? [] : this.getDefaultSelection();
let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection);
@@ -259,10 +263,12 @@ let AntTable = React.createClass({
};
this.setState(newState);
this.setSelectedRowKeys([]);
- this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
+ this.props.onChange.apply(this, this.prepareParamsArguments(
+ objectAssign({}, this.state, newState)
+ ));
},
- onRadioChange: function (ev) {
+ onRadioChange(ev) {
this.setState({
radioIndex: ev.target.value
});
@@ -282,8 +288,9 @@ let AntTable = React.createClass({
this.getDefaultSelection().indexOf(rowIndex) >= 0);
}
return (
-
+
);
},
@@ -302,7 +309,7 @@ let AntTable = React.createClass({
}
return (
+ onChange={this.handleSelect.bind(this, record, rowIndex)}/>
);
},
@@ -346,8 +353,8 @@ let AntTable = React.createClass({
this.props.rowSelection.getCheckboxProps(item).disabled);
const checkboxAll = (
+ disabled={checkboxAllDisabled}
+ onChange={this.handleSelectAllRow} />
);
selectionColumn = {
key: 'selection-column',
@@ -390,8 +397,8 @@ let AntTable = React.createClass({
let colFilters = this.state.filters[key] || [];
filterDropdown = (
+ selectedKeys={colFilters}
+ confirmFilter={this.handleFilter}/>
);
}
if (column.sorter) {
@@ -407,14 +414,14 @@ let AntTable = React.createClass({
+ title="↑"
+ onClick={this.toggleSortOrder.bind(this, 'ascend', column)}>
+ title="↓"
+ onClick={this.toggleSortOrder.bind(this, 'descend', column)}>
@@ -438,7 +445,7 @@ let AntTable = React.createClass({
}
let nextPagination = objectAssign(pagination, {
- pageSize: pageSize
+ pageSize,
});
this.setState({ pagination: nextPagination });
},
@@ -450,17 +457,17 @@ let AntTable = React.createClass({
}
let classString = classNames({
'ant-table-pagination': true,
- 'mini': this.props.size === 'middle' || this.props.size === 'small',
+ mini: this.props.size === 'middle' || this.props.size === 'small',
});
let total = this.state.pagination.total || this.getLocalData().length;
const pageSize = this.state.pagination.pageSize;
return (total > 0) ?
: null;
+ className={classString}
+ onChange={this.handlePageChange}
+ total={total}
+ pageSize={pageSize}
+ onShowSizeChange={this.handleShowSizeChange} /> : null;
},
prepareParamsArguments(state) {
@@ -551,8 +558,9 @@ let AntTable = React.createClass({
columns = this.renderColumnsDropdown(columns);
columns = columns.map((column, i) => {
- column.key = column.key || column.dataIndex || i;
- return column;
+ const newColumn = objectAssign({}, column);
+ newColumn.key = newColumn.key || newColumn.dataIndex || i;
+ return newColumn;
});
let emptyText;
let emptyClass = '';
@@ -568,15 +576,16 @@ let AntTable = React.createClass({
let table = (
+ data={data}
+ columns={columns}
+ className={classString}
+ expandIconAsCell={expandIconAsCell} />
{emptyText}
);
if (this.props.loading) {
- // if there is no pagination or no data, the height of spin should decrease by half of pagination
+ // if there is no pagination or no data,
+ // the height of spin should decrease by half of pagination
let paginationPatchClass = (this.hasPagination() && data && data.length !== 0)
? 'ant-table-with-pagination'
: 'ant-table-without-pagination';
diff --git a/components/tabs/index.jsx b/components/tabs/index.jsx
index 66eeccba838f5afd3bb8ee1b42f34022674306be..299922674c9efaf620440f2c94324ed2d4bdf555 100644
--- a/components/tabs/index.jsx
+++ b/components/tabs/index.jsx
@@ -66,10 +66,10 @@ class AntTabs extends React.Component {
);
return (
+ className={className}
+ tabBarExtraContent={tabBarExtraContent}
+ onChange={this.handleChange}
+ animation={animation}>
{children}
);
diff --git a/components/tag/index.jsx b/components/tag/index.jsx
index cb79983d742bbe6e445a8de0c00a3f2d0cc29c03..f88e8b3f912a2f4aaacb231e4e06e36c28a479ad 100644
--- a/components/tag/index.jsx
+++ b/components/tag/index.jsx
@@ -39,22 +39,25 @@ class AntTag extends React.Component {
className = this.state.closing ? className + ' ' + this.props.prefixCls + '-close' : className;
return this.state.closed ? null
- :
-
- ;
+ : (
+
+
+
+ );
}
}
+function NOOP() {}
AntTag.defaultProps = {
prefixCls: 'ant-tag',
closable: false,
- onClose: function() {}
+ onClose: NOOP,
};
export default AntTag;
diff --git a/components/timeline/index.jsx b/components/timeline/index.jsx
index b6886d55c05fcebf0d1ab90dd2f22d23617a6c65..d609ba9724c519318415ffe2d2378d8dd7446e90 100644
--- a/components/timeline/index.jsx
+++ b/components/timeline/index.jsx
@@ -37,12 +37,14 @@ Timeline.Item = React.createClass({
let pending = props.pending;
let timelineLast = props.timelineLast;
let endCls = pending && timelineLast ? prefixCls + '-item-last' : '';
- let last = pending && timelineLast ?
: null;
+ let last = pending && timelineLast ?
+
:
+ null;
let lastTailShow = (timelineLast && !pending) ? 'none' : 'block';
return (
-
+
{props.children}
{last}
diff --git a/components/tooltip/index.jsx b/components/tooltip/index.jsx
index 42746afc5feee71982ca89f11bb6fe4b23479996..bb66a0f0157f725e8a97c95e9c91be9c3b681587 100644
--- a/components/tooltip/index.jsx
+++ b/components/tooltip/index.jsx
@@ -41,7 +41,7 @@ export default React.createClass({
}
return (
- 0 ) {
+ if (targetKeys.length > 0) {
targetKeys.forEach((targetKey) => {
rightDataSource.push(leftDataSource.find((data, index) => {
- if ( data.key === targetKey ) {
+ if (data.key === targetKey) {
leftDataSource.splice(index, 1);
return true;
}
@@ -38,8 +38,8 @@ class Transfer extends Component {
}
return {
- leftDataSource: leftDataSource,
- rightDataSource: rightDataSource,
+ leftDataSource,
+ rightDataSource,
};
}
@@ -48,12 +48,14 @@ class Transfer extends Component {
const { leftCheckedKeys, rightCheckedKeys } = this.state;
// move items to target box
const newTargetKeys = direction === 'right' ?
- leftCheckedKeys.concat(targetKeys) :
- targetKeys.filter((targetKey) => !rightCheckedKeys.some((checkedKey) => targetKey === checkedKey));
+ leftCheckedKeys.concat(targetKeys) :
+ targetKeys.filter((targetKey) => {
+ return !rightCheckedKeys.some((checkedKey) => targetKey === checkedKey);
+ });
// empty checked keys
this.setState({
- [ direction === 'right' ? 'leftCheckedKeys' : 'rightCheckedKeys' ]: [],
+ [direction === 'right' ? 'leftCheckedKeys' : 'rightCheckedKeys']: [],
});
this.props.onChange(newTargetKeys);
@@ -70,8 +72,8 @@ class Transfer extends Component {
let globalCheckStatus;
- if ( checkedKeys.length > 0 ) {
- if ( checkedKeys.length < filteredDataSource.length ) {
+ if (checkedKeys.length > 0) {
+ if (checkedKeys.length < filteredDataSource.length) {
globalCheckStatus = 'part';
} else {
globalCheckStatus = 'all';
@@ -102,7 +104,7 @@ class Transfer extends Component {
const checkStatus = this.getGlobalCheckStatus(direction);
let holder = [];
- if ( checkStatus === 'all' ) {
+ if (checkStatus === 'all') {
holder = [];
} else {
holder = this.filterDataSource(dataSource, filter).map(item => item.key);
@@ -132,10 +134,10 @@ class Transfer extends Component {
const { leftCheckedKeys, rightCheckedKeys } = this.state;
const holder = direction === 'left' ? leftCheckedKeys : rightCheckedKeys;
const index = holder.findIndex((key) => key === selectedItem.key);
- if ( index > -1 ) {
+ if (index > -1) {
holder.splice(index, 1);
}
- if ( checked ) {
+ if (checked) {
holder.push(selectedItem.key);
}
this.setState({
@@ -165,46 +167,46 @@ class Transfer extends Component {
return (
+ dataSource={leftDataSource}
+ filter={leftFilter}
+ style={listStyle}
+ checkedKeys={leftCheckedKeys}
+ checkStatus={leftCheckStatus}
+ handleFilter={this.handleFilter.bind(this, 'left')}
+ handleClear={this.handleClear.bind(this, 'left')}
+ handleSelect={this.handleSelect.bind(this, 'left')}
+ handleSelectAll={this.handleSelectAll.bind(this, 'left')}
+ position="left"
+ render={this.props.render}
+ showSearch={showSearch}
+ searchPlaceholder={searchPlaceholder}
+ body={body}
+ footer={footer}
+ prefixCls={prefixCls + '-list'}/>
+ rightArrowText={operations[0]}
+ moveToRight={this.moveTo.bind(this, 'right')}
+ leftActive={leftActive}
+ leftArrowText={operations[1]}
+ moveToLeft={this.moveTo.bind(this, 'left')}
+ className={prefixCls + '-operation'}/>
+ dataSource={rightDataSource}
+ filter={rightFilter}
+ style={listStyle}
+ checkedKeys={rightCheckedKeys}
+ checkStatus={rightCheckStatus}
+ handleFilter={this.handleFilter.bind(this, 'right')}
+ handleClear={this.handleClear.bind(this, 'right')}
+ handleSelect={this.handleSelect.bind(this, 'right')}
+ handleSelectAll={this.handleSelectAll.bind(this, 'right')}
+ position="right"
+ render={this.props.render}
+ showSearch={showSearch}
+ searchPlaceholder={searchPlaceholder}
+ body={body}
+ footer={footer}
+ prefixCls={prefixCls + '-list'}/>
);
}
diff --git a/components/transfer/list.jsx b/components/transfer/list.jsx
index 1910c1fe2a2b9242c4504c90c3e6fc7c417563eb..a8fa4b9793d78dd9ab5e2ea8d7b809aea58ee033 100644
--- a/components/transfer/list.jsx
+++ b/components/transfer/list.jsx
@@ -56,8 +56,8 @@ class TransferList extends Component {
}
return (
+ className={checkboxCls}
+ onClick={(!props.disabled) && this.handleSelectALl.bind(this)}>
{customEle}
);
@@ -69,11 +69,12 @@ class TransferList extends Component {
}
render() {
- const { prefixCls, dataSource, titleText, filter, checkedKeys, checkStatus, body, footer, showSearch } = this.props;
+ const { prefixCls, dataSource, titleText, filter, checkedKeys,
+ checkStatus, body, footer, showSearch } = this.props;
// Custom Layout
- const footerDom = footer({...this.props});
- const bodyDom = body({...this.props});
+ const footerDom = footer({ ...this.props });
+ const bodyDom = body({ ...this.props });
const listCls = classNames({
[prefixCls]: true,
@@ -88,13 +89,27 @@ class TransferList extends Component {
checked: checkStatus === 'all',
checkPart: checkStatus === 'part',
checkable:
- })}{(checkedKeys.length > 0 ? checkedKeys.length + '/' : '') + dataSource.length} 条
- {titleText}
+ })}
+
+
+ {
+ (checkedKeys.length > 0 ? checkedKeys.length + '/' : '') + dataSource.length
+ } 条
+
+ {titleText}
+
{ bodyDom ? bodyDom :
-
+
{ showSearch ?
-
+
: null }
+
key === item.key)} />
{renderedText}
diff --git a/components/transfer/search.jsx b/components/transfer/search.jsx
index faecda0204fc8d00435d1a7ca736ff2ec6b1f880..c49c61944a0ad7c73abaf7fae49c719283d5d7cd 100644
--- a/components/transfer/search.jsx
+++ b/components/transfer/search.jsx
@@ -13,13 +13,15 @@ class Search extends Component {
}
render() {
- const {placeholder, value, prefixCls} = this.props;
+ const { placeholder, value, prefixCls } = this.props;
return (
-
+
{ value && value.length > 0 ?
-
+
:
diff --git a/components/upload/index.jsx b/components/upload/index.jsx
index ccf140f2a38908ef45993484d600475d8772407f..34a160edb3f06c2968c277226beafbb465d23448 100644
--- a/components/upload/index.jsx
+++ b/components/upload/index.jsx
@@ -125,7 +125,7 @@ const AntUpload = React.createClass({
targetItem.response = response;
this.onChange({
file: targetItem,
- fileList: fileList
+ fileList
});
}
},
@@ -136,7 +136,7 @@ const AntUpload = React.createClass({
targetItem.percent = e.percent;
this.onChange({
event: e,
- file: file,
+ file,
fileList: this.state.fileList
});
},
@@ -157,8 +157,8 @@ const AntUpload = React.createClass({
let fileList = this.removeFile(file);
if (fileList) {
this.onChange({
- file: file,
- fileList: fileList
+ file,
+ fileList,
});
}
},
@@ -257,7 +257,7 @@ const AntUpload = React.createClass({
AntUpload.Dragger = React.createClass({
render() {
- return
;
+ return
;
}
});
diff --git a/components/upload/uploadList.jsx b/components/upload/uploadList.jsx
index f4d7d6c848ba894adc5c5fc492c5d4eef9288e19..e03686dfd467be1c19a3cc1c7e9ba6ad76040599 100644
--- a/components/upload/uploadList.jsx
+++ b/components/upload/uploadList.jsx
@@ -55,9 +55,11 @@ export default React.createClass({
if (this.props.listType === 'picture') {
icon = (file.status === 'uploading' || (!file.thumbUrl && !file.url))
?
- :
;
+ : (
+
+ );
}
if (file.status === 'uploading') {
progress = (
diff --git a/index.js b/index.js
index 3d0a4f5fe483ae531af735b7d2b017b910f6c1bc..20c18196c6da7c5dab3c92d9d40b4ee70230fc7e 100644
--- a/index.js
+++ b/index.js
@@ -54,8 +54,12 @@ if (process.env.NODE_ENV !== 'production') {
const warning = require('warning');
const semver = require('semver');
const reactVersionInDeps = require('./package.json').devDependencies.react;
- warning(semver.satisfies(ReactVersion, reactVersionInDeps) || semver.gtr(ReactVersion, reactVersionInDeps),
- `antd@${antd.version} need react@${reactVersionInDeps} or higher, which is react@${ReactVersion} now.`);
+ warning(
+ semver.satisfies(ReactVersion, reactVersionInDeps) ||
+ semver.gtr(ReactVersion, reactVersionInDeps),
+ `antd@${antd.version} need react@${reactVersionInDeps} or higher, ` +
+ `which is react@${ReactVersion} now.`
+ );
}
module.exports = antd;