mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 12:38:58 +08:00
style: update code style to please the fucking lint
This commit is contained in:
parent
209170e813
commit
b72d18fd44
@ -85,7 +85,10 @@ class Input extends React.Component {
|
|||||||
}
|
}
|
||||||
switch (props.type) {
|
switch (props.type) {
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
return <textarea {...props} placeholder={placeholder} className={inputClassName} ref="input" />;
|
return (
|
||||||
|
<textarea {...props} placeholder={placeholder}
|
||||||
|
className={inputClassName} ref="input" />
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
inputClassName = props.className ? props.className : inputClassName;
|
inputClassName = props.className ? props.className : inputClassName;
|
||||||
return <input {...props} placeholder={placeholder} className={inputClassName} ref="input"/>;
|
return <input {...props} placeholder={placeholder} className={inputClassName} ref="input"/>;
|
||||||
|
@ -12,7 +12,7 @@ const Row = React.createClass({
|
|||||||
render() {
|
render() {
|
||||||
const { type, justify, align, className, ...others } = this.props;
|
const { type, justify, align, className, ...others } = this.props;
|
||||||
const classes = classNames({
|
const classes = classNames({
|
||||||
'row': true,
|
row: true,
|
||||||
['row-' + type]: type,
|
['row-' + type]: type,
|
||||||
['row-' + type + '-' + justify]: justify,
|
['row-' + type + '-' + justify]: justify,
|
||||||
['row-' + type + '-' + align]: align,
|
['row-' + type + '-' + align]: align,
|
||||||
|
@ -12,7 +12,7 @@ function getMessageInstance() {
|
|||||||
prefixCls: 'ant-message',
|
prefixCls: 'ant-message',
|
||||||
transitionName: 'move-up',
|
transitionName: 'move-up',
|
||||||
style: {
|
style: {
|
||||||
top: top
|
top,
|
||||||
} // 覆盖原来的样式
|
} // 覆盖原来的样式
|
||||||
});
|
});
|
||||||
return messageInstance;
|
return messageInstance;
|
||||||
@ -20,31 +20,31 @@ function getMessageInstance() {
|
|||||||
|
|
||||||
function notice(content, duration = defaultDuration, type, onClose) {
|
function notice(content, duration = defaultDuration, type, onClose) {
|
||||||
let iconClass = ({
|
let iconClass = ({
|
||||||
'info': 'ant-message-info',
|
info: 'ant-message-info',
|
||||||
'success': 'ant-message-success',
|
success: 'ant-message-success',
|
||||||
'error': 'ant-message-error',
|
error: 'ant-message-error',
|
||||||
'warn': 'ant-message-warn',
|
warn: 'ant-message-warn',
|
||||||
'loading': 'ant-message-loading'
|
loading: 'ant-message-loading'
|
||||||
})[type];
|
})[type];
|
||||||
|
|
||||||
let iconType = ({
|
let iconType = ({
|
||||||
'info': 'info-circle',
|
info: 'info-circle',
|
||||||
'success': 'check-circle',
|
success: 'check-circle',
|
||||||
'error': 'exclamation-circle',
|
error: 'exclamation-circle',
|
||||||
'warn': 'exclamation-circle',
|
warn: 'exclamation-circle',
|
||||||
'loading': 'loading'
|
loading: 'loading'
|
||||||
})[type];
|
})[type];
|
||||||
|
|
||||||
let instance = getMessageInstance();
|
let instance = getMessageInstance();
|
||||||
instance.notice({
|
instance.notice({
|
||||||
key: key,
|
key,
|
||||||
duration: duration,
|
duration,
|
||||||
style: {},
|
style: {},
|
||||||
content: <div className={'ant-message-custom-content ' + iconClass}>
|
content: <div className={'ant-message-custom-content ' + iconClass}>
|
||||||
<Icon className={iconClass} type={iconType} />
|
<Icon className={iconClass} type={iconType} />
|
||||||
<span>{content}</span>
|
<span>{content}</span>
|
||||||
</div>,
|
</div>,
|
||||||
onClose: onClose
|
onClose
|
||||||
});
|
});
|
||||||
return (function() {
|
return (function() {
|
||||||
let target = key++;
|
let target = key++;
|
||||||
|
@ -3,8 +3,10 @@ import ReactDOM from 'react-dom';
|
|||||||
import Dialog from './index';
|
import Dialog from './index';
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
import Button from '../button';
|
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');
|
let div = document.createElement('div');
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Dialog from 'rc-dialog';
|
import Dialog from 'rc-dialog';
|
||||||
import { Dom } from 'rc-util';
|
import { Dom } from 'rc-util';
|
||||||
|
import objectAssign from 'object-assign';
|
||||||
import confirm from './confirm';
|
import confirm from './confirm';
|
||||||
import Button from '../button';
|
import Button from '../button';
|
||||||
|
|
||||||
@ -78,26 +79,34 @@ let AntModal = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
AntModal.info = function (props) {
|
AntModal.info = function (props) {
|
||||||
props.iconClassName = 'info-circle';
|
const config = objectAssign({}, props, {
|
||||||
props.okCancel = false;
|
iconClassName: 'info-circle',
|
||||||
return confirm(props);
|
okCancel: false,
|
||||||
|
});
|
||||||
|
return confirm(config);
|
||||||
};
|
};
|
||||||
|
|
||||||
AntModal.success = function (props) {
|
AntModal.success = function (props) {
|
||||||
props.iconClassName = 'check-circle';
|
const config = objectAssign({}, props, {
|
||||||
props.okCancel = false;
|
iconClassName: 'check-circle',
|
||||||
return confirm(props);
|
okCancel: false,
|
||||||
|
});
|
||||||
|
return confirm(config);
|
||||||
};
|
};
|
||||||
|
|
||||||
AntModal.error = function (props) {
|
AntModal.error = function (props) {
|
||||||
props.iconClassName = 'exclamation-circle';
|
const config = objectAssign({}, props, {
|
||||||
props.okCancel = false;
|
iconClassName: 'exclamation-circle',
|
||||||
return confirm(props);
|
okCancel: false,
|
||||||
|
});
|
||||||
|
return confirm(config);
|
||||||
};
|
};
|
||||||
|
|
||||||
AntModal.confirm = function (props) {
|
AntModal.confirm = function (props) {
|
||||||
props.okCancel = true;
|
const config = objectAssign({}, props, {
|
||||||
return confirm(props);
|
okCancel: true,
|
||||||
|
});
|
||||||
|
return confirm(config);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AntModal;
|
export default AntModal;
|
||||||
|
@ -13,7 +13,7 @@ function getNotificationInstance() {
|
|||||||
notificationInstance = Notification.newInstance({
|
notificationInstance = Notification.newInstance({
|
||||||
prefixCls: 'ant-notification',
|
prefixCls: 'ant-notification',
|
||||||
style: {
|
style: {
|
||||||
top: top,
|
top,
|
||||||
right: 0
|
right: 0
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -56,7 +56,7 @@ function notice(args) {
|
|||||||
|
|
||||||
<div className={prefixCls + 'description'}>{args.description}</div>
|
<div className={prefixCls + 'description'}>{args.description}</div>
|
||||||
</div>,
|
</div>,
|
||||||
duration: duration,
|
duration,
|
||||||
closable: true,
|
closable: true,
|
||||||
onClose: args.onClose,
|
onClose: args.onClose,
|
||||||
key: args.key,
|
key: args.key,
|
||||||
@ -71,7 +71,7 @@ function notice(args) {
|
|||||||
|
|
||||||
<div className={prefixCls + 'description'}>{args.description}</div>
|
<div className={prefixCls + 'description'}>{args.description}</div>
|
||||||
</div>,
|
</div>,
|
||||||
duration: duration,
|
duration,
|
||||||
closable: true,
|
closable: true,
|
||||||
onClose: args.onClose,
|
onClose: args.onClose,
|
||||||
key: args.key,
|
key: args.key,
|
||||||
@ -87,7 +87,7 @@ function notice(args) {
|
|||||||
{args.btn}
|
{args.btn}
|
||||||
</span>
|
</span>
|
||||||
</div>,
|
</div>,
|
||||||
duration: duration,
|
duration,
|
||||||
closable: true,
|
closable: true,
|
||||||
onClose: args.onClose,
|
onClose: args.onClose,
|
||||||
key: args.key,
|
key: args.key,
|
||||||
|
@ -6,7 +6,7 @@ const prefixCls = 'ant-popover';
|
|||||||
const Popover = React.createClass({
|
const Popover = React.createClass({
|
||||||
getDefaultProps() {
|
getDefaultProps() {
|
||||||
return {
|
return {
|
||||||
prefixCls: prefixCls,
|
prefixCls,
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
mouseEnterDelay: 0.1,
|
mouseEnterDelay: 0.1,
|
||||||
|
@ -6,9 +6,9 @@ import Icon from '../icon';
|
|||||||
const prefixCls = 'ant-progress';
|
const prefixCls = 'ant-progress';
|
||||||
|
|
||||||
const statusColorMap = {
|
const statusColorMap = {
|
||||||
'normal': '#2db7f5',
|
normal: '#2db7f5',
|
||||||
'exception': '#ff6600',
|
exception: '#ff6600',
|
||||||
'success': '#87d068'
|
success: '#87d068'
|
||||||
};
|
};
|
||||||
|
|
||||||
let Line = React.createClass({
|
let Line = React.createClass({
|
||||||
@ -83,7 +83,7 @@ let Circle = React.createClass({
|
|||||||
strokeWidth: React.PropTypes.number,
|
strokeWidth: React.PropTypes.number,
|
||||||
width: React.PropTypes.number,
|
width: React.PropTypes.number,
|
||||||
},
|
},
|
||||||
getDefaultProps: function () {
|
getDefaultProps() {
|
||||||
return {
|
return {
|
||||||
width: 132,
|
width: 132,
|
||||||
percent: 0,
|
percent: 0,
|
||||||
@ -100,9 +100,9 @@ let Circle = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let style = {
|
let style = {
|
||||||
'width': props.width,
|
width: props.width,
|
||||||
'height': props.width,
|
height: props.width,
|
||||||
'fontSize': props.width * 0.16 + 6
|
fontSize: props.width * 0.16 + 6
|
||||||
};
|
};
|
||||||
let progressInfo;
|
let progressInfo;
|
||||||
const text = (typeof props.format === 'string') ?
|
const text = (typeof props.format === 'string') ?
|
||||||
@ -136,6 +136,6 @@ let Circle = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Line: Line,
|
Line,
|
||||||
Circle: Circle
|
Circle,
|
||||||
};
|
};
|
||||||
|
@ -12,15 +12,15 @@ function getCheckedValue(children) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default React.createClass({
|
export default React.createClass({
|
||||||
getDefaultProps: function () {
|
getDefaultProps() {
|
||||||
return {
|
return {
|
||||||
prefixCls: 'ant-radio-group',
|
prefixCls: 'ant-radio-group',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
onChange: function () {
|
onChange() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getInitialState: function () {
|
getInitialState() {
|
||||||
let props = this.props;
|
let props = this.props;
|
||||||
return {
|
return {
|
||||||
value: props.value || props.defaultValue || getCheckedValue(props.children)
|
value: props.value || props.defaultValue || getCheckedValue(props.children)
|
||||||
@ -33,7 +33,7 @@ export default React.createClass({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render: function () {
|
render() {
|
||||||
let props = this.props;
|
let props = this.props;
|
||||||
let children = React.Children.map(props.children, (radio) => {
|
let children = React.Children.map(props.children, (radio) => {
|
||||||
if (radio.props) {
|
if (radio.props) {
|
||||||
@ -53,7 +53,7 @@ export default React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onRadioChange: function (ev) {
|
onRadioChange(ev) {
|
||||||
this.setState({
|
this.setState({
|
||||||
value: ev.target.value
|
value: ev.target.value
|
||||||
});
|
});
|
||||||
|
@ -20,12 +20,11 @@ let FilterMenu = React.createClass({
|
|||||||
},
|
},
|
||||||
getDefaultProps() {
|
getDefaultProps() {
|
||||||
return {
|
return {
|
||||||
handleFilter: function () {
|
handleFilter() {},
|
||||||
},
|
|
||||||
column: null
|
column: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
setSelectedKeys: function ({selectedKeys}) {
|
setSelectedKeys({ selectedKeys }) {
|
||||||
this.setState({ selectedKeys });
|
this.setState({ selectedKeys });
|
||||||
},
|
},
|
||||||
handleClearFilters() {
|
handleClearFilters() {
|
||||||
@ -41,7 +40,7 @@ let FilterMenu = React.createClass({
|
|||||||
},
|
},
|
||||||
onVisibleChange(visible) {
|
onVisibleChange(visible) {
|
||||||
this.setState({
|
this.setState({
|
||||||
visible: visible
|
visible,
|
||||||
});
|
});
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
this.props.confirmFilter(this.props.column, this.state.selectedKeys);
|
this.props.confirmFilter(this.props.column, this.state.selectedKeys);
|
||||||
|
@ -144,7 +144,9 @@ let AntTable = React.createClass({
|
|||||||
sorter
|
sorter
|
||||||
};
|
};
|
||||||
this.setState(newState);
|
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) {
|
handleFilter(column, nextFilters) {
|
||||||
@ -164,7 +166,9 @@ let AntTable = React.createClass({
|
|||||||
};
|
};
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
this.setSelectedRowKeys([]);
|
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) {
|
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 checked = e.target.checked;
|
||||||
const defaultSelection = this.state.selectionDirty ? [] : this.getDefaultSelection();
|
const defaultSelection = this.state.selectionDirty ? [] : this.getDefaultSelection();
|
||||||
let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection);
|
let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection);
|
||||||
@ -259,10 +263,12 @@ let AntTable = React.createClass({
|
|||||||
};
|
};
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
this.setSelectedRowKeys([]);
|
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({
|
this.setState({
|
||||||
radioIndex: ev.target.value
|
radioIndex: ev.target.value
|
||||||
});
|
});
|
||||||
@ -282,7 +288,8 @@ let AntTable = React.createClass({
|
|||||||
this.getDefaultSelection().indexOf(rowIndex) >= 0);
|
this.getDefaultSelection().indexOf(rowIndex) >= 0);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Radio disabled={props.disabled} onChange={this.handleRadioSelect.bind(this, record, rowIndex)}
|
<Radio disabled={props.disabled}
|
||||||
|
onChange={this.handleRadioSelect.bind(this, record, rowIndex)}
|
||||||
value={rowIndex} checked={checked}/>
|
value={rowIndex} checked={checked}/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -438,7 +445,7 @@ let AntTable = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let nextPagination = objectAssign(pagination, {
|
let nextPagination = objectAssign(pagination, {
|
||||||
pageSize: pageSize
|
pageSize,
|
||||||
});
|
});
|
||||||
this.setState({ pagination: nextPagination });
|
this.setState({ pagination: nextPagination });
|
||||||
},
|
},
|
||||||
@ -450,7 +457,7 @@ let AntTable = React.createClass({
|
|||||||
}
|
}
|
||||||
let classString = classNames({
|
let classString = classNames({
|
||||||
'ant-table-pagination': true,
|
'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;
|
let total = this.state.pagination.total || this.getLocalData().length;
|
||||||
const pageSize = this.state.pagination.pageSize;
|
const pageSize = this.state.pagination.pageSize;
|
||||||
@ -551,8 +558,9 @@ let AntTable = React.createClass({
|
|||||||
|
|
||||||
columns = this.renderColumnsDropdown(columns);
|
columns = this.renderColumnsDropdown(columns);
|
||||||
columns = columns.map((column, i) => {
|
columns = columns.map((column, i) => {
|
||||||
column.key = column.key || column.dataIndex || i;
|
const newColumn = objectAssign({}, column);
|
||||||
return column;
|
newColumn.key = newColumn.key || newColumn.dataIndex || i;
|
||||||
|
return newColumn;
|
||||||
});
|
});
|
||||||
let emptyText;
|
let emptyText;
|
||||||
let emptyClass = '';
|
let emptyClass = '';
|
||||||
@ -576,7 +584,8 @@ let AntTable = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
if (this.props.loading) {
|
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)
|
let paginationPatchClass = (this.hasPagination() && data && data.length !== 0)
|
||||||
? 'ant-table-with-pagination'
|
? 'ant-table-with-pagination'
|
||||||
: 'ant-table-without-pagination';
|
: 'ant-table-without-pagination';
|
||||||
|
@ -39,7 +39,8 @@ class AntTag extends React.Component {
|
|||||||
className = this.state.closing ? className + ' ' + this.props.prefixCls + '-close' : className;
|
className = this.state.closing ? className + ' ' + this.props.prefixCls + '-close' : className;
|
||||||
|
|
||||||
return this.state.closed ? null
|
return this.state.closed ? null
|
||||||
: <Animate component=""
|
: (
|
||||||
|
<Animate component=""
|
||||||
showProp="data-show"
|
showProp="data-show"
|
||||||
transitionName={this.props.prefixCls + '-zoom'}
|
transitionName={this.props.prefixCls + '-zoom'}
|
||||||
onEnd={this.animationEnd.bind(this)}>
|
onEnd={this.animationEnd.bind(this)}>
|
||||||
@ -47,14 +48,16 @@ class AntTag extends React.Component {
|
|||||||
<a className={this.props.prefixCls + '-text'} {...this.props} />
|
<a className={this.props.prefixCls + '-text'} {...this.props} />
|
||||||
{close}
|
{close}
|
||||||
</div>
|
</div>
|
||||||
</Animate>;
|
</Animate>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function NOOP() {}
|
||||||
AntTag.defaultProps = {
|
AntTag.defaultProps = {
|
||||||
prefixCls: 'ant-tag',
|
prefixCls: 'ant-tag',
|
||||||
closable: false,
|
closable: false,
|
||||||
onClose: function() {}
|
onClose: NOOP,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AntTag;
|
export default AntTag;
|
||||||
|
@ -37,7 +37,9 @@ Timeline.Item = React.createClass({
|
|||||||
let pending = props.pending;
|
let pending = props.pending;
|
||||||
let timelineLast = props.timelineLast;
|
let timelineLast = props.timelineLast;
|
||||||
let endCls = pending && timelineLast ? prefixCls + '-item-last' : '';
|
let endCls = pending && timelineLast ? prefixCls + '-item-last' : '';
|
||||||
let last = pending && timelineLast ? <div className={prefixCls + '-item-head ' + prefixCls + '-item-head-end'}></div> : null;
|
let last = pending && timelineLast ?
|
||||||
|
<div className={prefixCls + '-item-head ' + prefixCls + '-item-head-end'}></div> :
|
||||||
|
null;
|
||||||
let lastTailShow = (timelineLast && !pending) ? 'none' : 'block';
|
let lastTailShow = (timelineLast && !pending) ? 'none' : 'block';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -38,8 +38,8 @@ class Transfer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
leftDataSource: leftDataSource,
|
leftDataSource,
|
||||||
rightDataSource: rightDataSource,
|
rightDataSource,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,9 @@ class Transfer extends Component {
|
|||||||
// move items to target box
|
// move items to target box
|
||||||
const newTargetKeys = direction === 'right' ?
|
const newTargetKeys = direction === 'right' ?
|
||||||
leftCheckedKeys.concat(targetKeys) :
|
leftCheckedKeys.concat(targetKeys) :
|
||||||
targetKeys.filter((targetKey) => !rightCheckedKeys.some((checkedKey) => targetKey === checkedKey));
|
targetKeys.filter((targetKey) => {
|
||||||
|
return !rightCheckedKeys.some((checkedKey) => targetKey === checkedKey);
|
||||||
|
});
|
||||||
|
|
||||||
// empty checked keys
|
// empty checked keys
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -69,7 +69,8 @@ class TransferList extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
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
|
// Custom Layout
|
||||||
const footerDom = footer({ ...this.props });
|
const footerDom = footer({ ...this.props });
|
||||||
@ -88,13 +89,27 @@ class TransferList extends Component {
|
|||||||
checked: checkStatus === 'all',
|
checked: checkStatus === 'all',
|
||||||
checkPart: checkStatus === 'part',
|
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>
|
<span className={`${prefixCls}-header-selected`}>
|
||||||
|
<span>
|
||||||
|
{
|
||||||
|
(checkedKeys.length > 0 ? checkedKeys.length + '/' : '') + dataSource.length
|
||||||
|
} 条
|
||||||
|
</span>
|
||||||
|
<span className={`${prefixCls}-header-title`}>{titleText}</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{ bodyDom ? bodyDom :
|
{ bodyDom ? bodyDom :
|
||||||
<div className={ showSearch ? `${prefixCls}-body ${prefixCls}-body-with-search` : `${prefixCls}-body`}>
|
<div className={
|
||||||
|
showSearch ?
|
||||||
|
`${prefixCls}-body ${prefixCls}-body-with-search` :
|
||||||
|
`${prefixCls}-body`
|
||||||
|
}>
|
||||||
{ showSearch ? <div className={`${prefixCls}-body-search-wrapper`}>
|
{ showSearch ? <div className={`${prefixCls}-body-search-wrapper`}>
|
||||||
<Search prefixCls={`${prefixCls}-search`} onChange={this.handleFilter.bind(this)} handleClear={this.handleClear.bind(this)} value={filter} />
|
<Search prefixCls={`${prefixCls}-search`}
|
||||||
|
onChange={this.handleFilter.bind(this)}
|
||||||
|
handleClear={this.handleClear.bind(this)}
|
||||||
|
value={filter} />
|
||||||
</div> : null }
|
</div> : null }
|
||||||
<Animate component="ul"
|
<Animate component="ul"
|
||||||
transitionName={this.state.mounted ? `${prefixCls}-highlight` : ''}
|
transitionName={this.state.mounted ? `${prefixCls}-highlight` : ''}
|
||||||
@ -109,7 +124,8 @@ class TransferList extends Component {
|
|||||||
|
|
||||||
if (filterResult) {
|
if (filterResult) {
|
||||||
return (
|
return (
|
||||||
<li onClick={this.handleSelect.bind(this, item)} key={item.key} title={renderedText}>
|
<li onClick={this.handleSelect.bind(this, item)}
|
||||||
|
key={item.key} title={renderedText}>
|
||||||
<Checkbox checked={checkedKeys.some(key => key === item.key)} />
|
<Checkbox checked={checkedKeys.some(key => key === item.key)} />
|
||||||
{renderedText}
|
{renderedText}
|
||||||
</li>
|
</li>
|
||||||
|
@ -16,10 +16,12 @@ class Search extends Component {
|
|||||||
const { placeholder, value, prefixCls } = this.props;
|
const { placeholder, value, prefixCls } = this.props;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<input placeholder={placeholder} className={ prefixCls + ' ant-input' } value={ value } ref="input"
|
<input placeholder={placeholder} className={ prefixCls + ' ant-input' }
|
||||||
|
value={ value } ref="input"
|
||||||
onChange={this.handleChange.bind(this)}/>
|
onChange={this.handleChange.bind(this)}/>
|
||||||
{ value && value.length > 0 ?
|
{ value && value.length > 0 ?
|
||||||
<a href="javascirpt:;" className={ prefixCls + '-action' } onClick={this.props.handleClear}>
|
<a href="javascirpt:;" className={ prefixCls + '-action' }
|
||||||
|
onClick={this.props.handleClear}>
|
||||||
<Icon type="cross-circle" />
|
<Icon type="cross-circle" />
|
||||||
</a>
|
</a>
|
||||||
: <span className={ prefixCls + '-action' }><Icon type="search" /></span>
|
: <span className={ prefixCls + '-action' }><Icon type="search" /></span>
|
||||||
|
@ -125,7 +125,7 @@ const AntUpload = React.createClass({
|
|||||||
targetItem.response = response;
|
targetItem.response = response;
|
||||||
this.onChange({
|
this.onChange({
|
||||||
file: targetItem,
|
file: targetItem,
|
||||||
fileList: fileList
|
fileList
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -136,7 +136,7 @@ const AntUpload = React.createClass({
|
|||||||
targetItem.percent = e.percent;
|
targetItem.percent = e.percent;
|
||||||
this.onChange({
|
this.onChange({
|
||||||
event: e,
|
event: e,
|
||||||
file: file,
|
file,
|
||||||
fileList: this.state.fileList
|
fileList: this.state.fileList
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -157,8 +157,8 @@ const AntUpload = React.createClass({
|
|||||||
let fileList = this.removeFile(file);
|
let fileList = this.removeFile(file);
|
||||||
if (fileList) {
|
if (fileList) {
|
||||||
this.onChange({
|
this.onChange({
|
||||||
file: file,
|
file,
|
||||||
fileList: fileList
|
fileList,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -55,9 +55,11 @@ export default React.createClass({
|
|||||||
if (this.props.listType === 'picture') {
|
if (this.props.listType === 'picture') {
|
||||||
icon = (file.status === 'uploading' || (!file.thumbUrl && !file.url))
|
icon = (file.status === 'uploading' || (!file.thumbUrl && !file.url))
|
||||||
? <Icon className={prefixCls + '-list-item-thumbnail'} type="picture" />
|
? <Icon className={prefixCls + '-list-item-thumbnail'} type="picture" />
|
||||||
: <a className={prefixCls + '-list-item-thumbnail'}
|
: (
|
||||||
|
<a className={prefixCls + '-list-item-thumbnail'}
|
||||||
href={file.url}
|
href={file.url}
|
||||||
target="_blank"><img src={file.thumbUrl || file.url} alt={file.name} /></a>;
|
target="_blank"><img src={file.thumbUrl || file.url} alt={file.name} /></a>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (file.status === 'uploading') {
|
if (file.status === 'uploading') {
|
||||||
progress = (
|
progress = (
|
||||||
|
8
index.js
8
index.js
@ -54,8 +54,12 @@ if (process.env.NODE_ENV !== 'production') {
|
|||||||
const warning = require('warning');
|
const warning = require('warning');
|
||||||
const semver = require('semver');
|
const semver = require('semver');
|
||||||
const reactVersionInDeps = require('./package.json').devDependencies.react;
|
const reactVersionInDeps = require('./package.json').devDependencies.react;
|
||||||
warning(semver.satisfies(ReactVersion, reactVersionInDeps) || semver.gtr(ReactVersion, reactVersionInDeps),
|
warning(
|
||||||
`antd@${antd.version} need react@${reactVersionInDeps} or higher, which is react@${ReactVersion} now.`);
|
semver.satisfies(ReactVersion, reactVersionInDeps) ||
|
||||||
|
semver.gtr(ReactVersion, reactVersionInDeps),
|
||||||
|
`antd@${antd.version} need react@${reactVersionInDeps} or higher, ` +
|
||||||
|
`which is react@${ReactVersion} now.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = antd;
|
module.exports = antd;
|
||||||
|
Loading…
Reference in New Issue
Block a user