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

This commit is contained in:
afc163 2016-10-10 22:51:31 +08:00
commit d409065319
8 changed files with 63 additions and 50 deletions

View File

@ -58,6 +58,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
```jsx
import DatePicker from 'antd/lib/date-picker'; // just for js
import 'antd/lib/date-picker/style/css'; // with style
```

View File

@ -14,6 +14,8 @@ export interface InputNumberProps {
disabled?: boolean;
size?: 'large' | 'small' | 'default';
placeholder?: string;
style?: React.CSSProperties;
className?: string;
}
export default class InputNumber extends React.Component<InputNumberProps, any> {

View File

@ -37,7 +37,7 @@ const Sider = React.createClass({
render() {
return (
<div>
<Switch onChange={this.changeTheme} checkedChildren="dark" unCheckedChildren="light" />
<Switch onChange={this.changeTheme} checkedChildren={<Icon type="eye" />} unCheckedChildren={<Icon type="eye-o" />} />
<br />
<br />
<Menu theme={this.state.theme}

View File

@ -89,6 +89,7 @@ export interface TableProps {
scroll?: { x?: boolean | number, y?: boolean | number};
childrenColumnName?: 'string';
bodyStyle?: React.CSSProperties;
className?: string;
}
export interface TableContext {

View File

@ -120,7 +120,6 @@
&-header {
background: @table-head-background-color;
overflow: hidden;
border-radius: @border-radius-base @border-radius-base 0 0;
}
&-header table {
@ -232,21 +231,28 @@
}
&-bordered {
.@{table-prefix-cls}-body > table {
.@{table-prefix-cls}-header > table,
.@{table-prefix-cls}-body > table,
.@{table-prefix-cls}-fixed-left table,
.@{table-prefix-cls}-fixed-right table {
border: 1px solid @border-color-split;
}
&.@{table-prefix-cls}-fixed-header {
border: 1px solid @border-color-split;
table {
border: 0;
.@{table-prefix-cls}-header > table {
border-bottom: 0;
}
.@{table-prefix-cls}-fixed-left {
border-right: 1px solid @border-color-split;
.@{table-prefix-cls}-body > table {
border-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.@{table-prefix-cls}-fixed-right {
border-left: 1px solid @border-color-split;
.@{table-prefix-cls}-body-inner > table {
border-top: 0;
}
.@{table-prefix-cls}-placeholder {
border-bottom: 0;
}

View File

@ -66,8 +66,6 @@ export default class Upload extends React.Component<UploadProps, any> {
static defaultProps = {
prefixCls: 'ant-upload',
type: 'select',
// do not set
// name: '',
multiple: false,
action: '',
data: {},
@ -78,6 +76,8 @@ export default class Upload extends React.Component<UploadProps, any> {
listType: 'text', // or pictrue
className: '',
disabled: false,
onRemove() {},
onPreview() {},
};
recentUploadStatus: boolean | PromiseLike<any>;
@ -194,6 +194,7 @@ export default class Upload extends React.Component<UploadProps, any> {
}
handleRemove(file) {
this.props.onRemove(file);
let fileList = this.removeFile(file);
if (fileList) {
this.onChange({
@ -206,11 +207,7 @@ export default class Upload extends React.Component<UploadProps, any> {
handleManualRemove = (file) => {
this.refs.upload.abort(file);
file.status = 'removed'; // eslint-disable-line
if ('onRemove' in this.props) {
this.props.onRemove(file);
} else {
this.handleRemove(file);
}
this.handleRemove(file);
}
onChange = (info) => {
@ -239,44 +236,46 @@ export default class Upload extends React.Component<UploadProps, any> {
}
render() {
const { prefixCls } = this.props;
let type = this.props.type || 'select';
let props = assign({}, this.props, {
const {
prefixCls, showUploadList, listType, onPreview,
type, disabled, children, className,
} = this.props;
const rcUploadProps = assign({}, this.props, {
onStart: this.onStart,
onError: this.onError,
onProgress: this.onProgress,
onSuccess: this.onSuccess,
beforeUpload: this.props.beforeUpload,
});
let uploadList;
if (this.props.showUploadList) {
uploadList = (
<UploadList
listType={this.props.listType}
items={this.state.fileList}
onPreview={props.onPreview}
onRemove={this.handleManualRemove}
/>
);
}
const uploadList = showUploadList ? (
<UploadList
listType={listType}
items={this.state.fileList}
onPreview={onPreview}
onRemove={this.handleManualRemove}
/>
) : null;
if (type === 'drag') {
const dragCls = classNames({
[prefixCls]: true,
[`${prefixCls}-drag`]: true,
[`${prefixCls}-drag-uploading`]: this.state.fileList.some(file => file.status === 'uploading'),
[`${prefixCls}-drag-hover`]: this.state.dragState === 'dragover',
[`${prefixCls}-disabled`]: this.props.disabled,
[`${prefixCls}-disabled`]: disabled,
});
return (
<span className={this.props.className}>
<div className={dragCls}
<span className={className}>
<div
className={dragCls}
onDrop={this.onFileDrop}
onDragOver={this.onFileDrop}
onDragLeave={this.onFileDrop}
>
<RcUpload {...props} ref="upload" className={`${prefixCls}-btn`}>
<RcUpload {...rcUploadProps} ref="upload" className={`${prefixCls}-btn`}>
<div className={`${prefixCls}-drag-container`}>
{this.props.children}
{children}
</div>
</RcUpload>
</div>
@ -288,17 +287,17 @@ export default class Upload extends React.Component<UploadProps, any> {
const uploadButtonCls = classNames({
[prefixCls]: true,
[`${prefixCls}-select`]: true,
[`${prefixCls}-select-${this.props.listType}`]: true,
[`${prefixCls}-disabled`]: this.props.disabled,
[`${prefixCls}-select-${listType}`]: true,
[`${prefixCls}-disabled`]: disabled,
});
const uploadButton = this.props.children
? <div className={uploadButtonCls}><RcUpload {...props} ref="upload" /></div>
const uploadButton = children
? <div className={uploadButtonCls}>
<RcUpload {...rcUploadProps} ref="upload" />
</div>
: null;
const className = this.props.className;
if (this.props.listType === 'picture-card') {
if (listType === 'picture-card') {
return (
<span className={className}>
{uploadList}
@ -306,7 +305,6 @@ export default class Upload extends React.Component<UploadProps, any> {
</span>
);
}
return (
<span className={className}>
{uploadButton}

View File

@ -7,6 +7,7 @@
.@{upload-prefix-cls} {
font-size: @font-size-base;
outline: 0;
&-btn {
display: block;
@ -26,7 +27,6 @@
border: 1px dashed @border-color-base;
width: @upload-pictrue-card-size;
height: @upload-pictrue-card-size;
padding: 24px 0;
border-radius: @border-radius-base;
background-color: #fbfbfb;
text-align: center;
@ -37,6 +37,13 @@
margin-right: 8px;
margin-bottom: 8px;
> .@{upload-prefix-cls} {
display: block;
width: 100%;
height: 100%;
padding: 20px 0;
}
&:hover {
border-color: @primary-color;
}

View File

@ -28,10 +28,8 @@ export default class UploadList extends React.Component<UploadListProps, any> {
}
handlePreview = (file, e) => {
if (this.props.onPreview) {
e.preventDefault();
return this.props.onPreview(file);
}
e.preventDefault();
return this.props.onPreview(file);
}
componentDidUpdate() {