mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
Merge branch "1.x-stable"
This commit is contained in:
commit
e0eb9ae162
@ -34,8 +34,9 @@
|
||||
transition: all 0.1s linear;
|
||||
display: block;
|
||||
width: 100%;
|
||||
&:hover {
|
||||
background: #fefefe;
|
||||
font-weight: bold;
|
||||
&:active {
|
||||
background: #f4f4f4;
|
||||
}
|
||||
&:hover &-up-inner,
|
||||
&:hover &-down-inner {
|
||||
@ -155,8 +156,8 @@
|
||||
&-handler-wrap {
|
||||
border-left: 1px solid @border-color-base;
|
||||
width: 22px;
|
||||
height: 28px;
|
||||
background: #fff;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
|
@ -112,35 +112,40 @@ export default class Modal extends React.Component<ModalProps, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
let props = this.props;
|
||||
let { okText, cancelText, confirmLoading, footer, visible } = this.props;
|
||||
|
||||
let { okText, cancelText } = props;
|
||||
if (this.context.antLocale && this.context.antLocale.Modal) {
|
||||
okText = okText || this.context.antLocale.Modal.okText;
|
||||
cancelText = cancelText || this.context.antLocale.Modal.cancelText;
|
||||
}
|
||||
|
||||
let defaultFooter = [
|
||||
<Button key="cancel"
|
||||
const defaultFooter = [
|
||||
<Button
|
||||
key="cancel"
|
||||
type="ghost"
|
||||
size="large"
|
||||
onClick={this.handleCancel}
|
||||
>
|
||||
{cancelText || '取消'}
|
||||
</Button>,
|
||||
<Button key="confirm"
|
||||
<Button
|
||||
key="confirm"
|
||||
type="primary"
|
||||
size="large"
|
||||
loading={props.confirmLoading}
|
||||
loading={confirmLoading}
|
||||
onClick={this.handleOk}
|
||||
>
|
||||
{okText || '确定'}
|
||||
</Button>,
|
||||
];
|
||||
let footer = props.footer || defaultFooter;
|
||||
|
||||
return (
|
||||
<Dialog onClose={this.handleCancel} footer={footer} {...props}
|
||||
visible={props.visible} mousePosition={mousePosition}
|
||||
<Dialog
|
||||
onClose={this.handleCancel}
|
||||
footer={footer || defaultFooter}
|
||||
{...this.props}
|
||||
visible={visible}
|
||||
mousePosition={mousePosition}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ title:
|
||||
|
||||
省市联动是典型的例子。
|
||||
|
||||
推荐使用 [Cascader](/components/cascader) 组件。
|
||||
推荐使用 [Cascader](/components/cascader/) 组件。
|
||||
|
||||
## en-US
|
||||
|
||||
|
@ -29,7 +29,6 @@ const defaultLocale = {
|
||||
};
|
||||
|
||||
const defaultPagination = {
|
||||
pageSize: 10,
|
||||
onChange: noop,
|
||||
onShowSizeChange: noop,
|
||||
};
|
||||
@ -85,6 +84,7 @@ export interface TableProps {
|
||||
footer?: (currentPageData: Object[]) => React.ReactNode;
|
||||
title?: (currentPageData: Object[]) => React.ReactNode;
|
||||
scroll?: { x?: boolean | number, y?: boolean | number};
|
||||
childrenColumnName?: 'string';
|
||||
}
|
||||
|
||||
interface TableContext {
|
||||
@ -121,6 +121,7 @@ export default class Table extends React.Component<TableProps, any> {
|
||||
onChange: noop,
|
||||
locale: {},
|
||||
rowKey: 'key',
|
||||
childrenColumnName: 'children',
|
||||
};
|
||||
|
||||
static contextTypes = {
|
||||
@ -143,6 +144,7 @@ export default class Table extends React.Component<TableProps, any> {
|
||||
pagination: this.hasPagination() ?
|
||||
assign({}, defaultPagination, pagination, {
|
||||
current: pagination.defaultCurrent || pagination.current || 1,
|
||||
pageSize: pagination.defaultPageSize || pagination.pageSize || 10,
|
||||
}) : {},
|
||||
});
|
||||
|
||||
@ -770,14 +772,25 @@ export default class Table extends React.Component<TableProps, any> {
|
||||
return flatArray(this.getCurrentPageData());
|
||||
}
|
||||
|
||||
recursiveSort(data, sorterFn) {
|
||||
const { childrenColumnName } = this.props;
|
||||
return data.sort(sorterFn).map(item => (item[childrenColumnName] ? assign(
|
||||
{},
|
||||
item, {
|
||||
[childrenColumnName]: this.recursiveSort(item[childrenColumnName], sorterFn),
|
||||
},
|
||||
) : item));
|
||||
}
|
||||
|
||||
getLocalData() {
|
||||
const state = this.state;
|
||||
let data = this.props.dataSource || [];
|
||||
const { dataSource } = this.props;
|
||||
let data = dataSource || [];
|
||||
// 优化本地排序
|
||||
data = data.slice(0);
|
||||
const sorterFn = this.getSorterFn();
|
||||
if (sorterFn) {
|
||||
data = data.sort(sorterFn);
|
||||
data = this.recursiveSort(data, sorterFn);
|
||||
}
|
||||
// 筛选
|
||||
if (state.filters) {
|
||||
|
Loading…
Reference in New Issue
Block a user