Merge branch 'feature-2.13' into antd-3.0

This commit is contained in:
afc163 2017-08-10 16:33:18 +08:00
commit b48f749e26
39 changed files with 500 additions and 48 deletions

View File

@ -141,6 +141,7 @@ Tino D <ginodeis@gmail.com>
Tyler <chaotyler@gmail.com>
Vadim Macagon <vadim.macagon@gmail.com>
Valentin Vichnal <valentin@vichnal.com>
Vemund Santi <veund@santi.no>
Vincent Zhang <vxzhong@qq.com>
Walter Barbagallo <turbometalskater@gmail.com>
Warren Seymour <warren@fountainhead.tech>

View File

@ -0,0 +1,2 @@
import el_GR from '../../date-picker/locale/el_GR';
export default el_GR;

View File

@ -0,0 +1,2 @@
import fa_IR from '../../date-picker/locale/fa_IR';
export default fa_IR;

View File

@ -0,0 +1,2 @@
import nb_NO from '../../date-picker/locale/nb_NO';
export default nb_NO;

View File

@ -0,0 +1,19 @@
import CalendarLocale from 'rc-calendar/lib/locale/el_GR';
import TimePickerLocale from '../../time-picker/locale/el_GR';
// Merge into a locale object
const locale = {
lang: {
placeholder: 'Επιλέξτε ημερομηνία',
rangePlaceholder: ['Αρχική ημερομηνία', 'Τελική ημερομηνία'],
...CalendarLocale,
},
timePickerLocale: {
...TimePickerLocale,
},
};
// All settings at:
// https://github.com/ant-design/ant-design/issues/424
export default locale;

View File

@ -0,0 +1,19 @@
import CalendarLocale from 'rc-calendar/lib/locale/fa_IR';
import TimePickerLocale from '../../time-picker/locale/fa_IR';
// Merge into a locale object
const locale = {
lang: {
placeholder: 'انتخاب تاریخ',
rangePlaceholder: ['تاریخ شروع', 'تاریخ پایان'],
...CalendarLocale,
},
timePickerLocale: {
...TimePickerLocale,
},
};
// All settings at:
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
export default locale;

View File

@ -0,0 +1,19 @@
import CalendarLocale from 'rc-calendar/lib/locale/nb_NO';
import TimePickerLocale from '../../time-picker/locale/nb_NO';
// Merge into a locale object
const locale = {
lang: {
placeholder: 'Velg dato',
rangePlaceholder: ['Startdato', 'Sluttdato'],
...CalendarLocale,
},
timePickerLocale: {
...TimePickerLocale,
},
};
// All settings at:
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
export default locale;

View File

@ -28,8 +28,11 @@ import plPL from '../pl_PL';
import bgBG from '../bg_BG';
import viVN from '../vi_VN';
import thTH from '../th_TH';
import faIR from '../fa_IR';
import elGR from '../el_GR';
import nbNO from '../nb_NO';
const locales = [enUS, ptBR, ruRU, esES, svSE, frBE, deDE, nlNL, caES, csCZ, koKR, etEE, skSK, jaJP, trTR, zhTW, fiFI, plPL, bgBG, enGB, frFR, nlBE, itIT, viVN, thTH];
const locales = [enUS, ptBR, ruRU, esES, svSE, frBE, deDE, nlNL, caES, csCZ, koKR, etEE, skSK, jaJP, trTR, zhTW, fiFI, plPL, bgBG, enGB, frFR, nlBE, itIT, viVN, thTH, faIR, elGR, nbNO];
const Option = Select.Option;
const RangePicker = DatePicker.RangePicker;

View File

@ -0,0 +1,47 @@
import moment from 'moment';
moment.locale('el');
import Pagination from 'rc-pagination/lib/locale/el_GR';
import DatePicker from '../date-picker/locale/el_GR';
import TimePicker from '../time-picker/locale/el_GR';
import Calendar from '../calendar/locale/el_GR';
export default {
locale: 'el',
Pagination,
DatePicker,
TimePicker,
Calendar,
Table: {
filterTitle: 'Μενού φίλτρων',
filterConfirm: 'ΟΚ',
filterReset: 'Επαναφορά',
emptyText: 'Δεν υπάρχουν δεδομένα',
selectAll: 'Επιλογή τρέχουσας σελίδας',
selectInvert: 'Αντιστροφή τρέχουσας σελίδας',
},
Modal: {
okText: 'ΟΚ',
cancelText: 'Άκυρο',
justOkText: 'ΟΚ',
},
Popconfirm: {
okText: 'ΟΚ',
cancelText: 'Άκυρο',
},
Transfer: {
notFoundContent: 'Δεν βρέθηκε',
searchPlaceholder: 'Αναζήτηση',
itemUnit: 'αντικείμενο',
itemsUnit: 'αντικείμενα',
},
Select: {
notFoundContent: 'Δεν βρέθηκε',
},
Upload: {
uploading: 'Μεταφόρτωση...',
removeFile: 'Αφαίρεση αρχείου',
uploadError: 'Σφάλμα μεταφόρτωσης',
previewFile: 'Προεπισκόπηση αρχείου',
},
};

View File

@ -0,0 +1,47 @@
import moment from 'moment';
moment.locale('fa');
import Pagination from 'rc-pagination/lib/locale/fa_IR';
import DatePicker from '../date-picker/locale/fa_IR';
import TimePicker from '../time-picker/locale/fa_IR';
import Calendar from '../calendar/locale/fa_IR';
export default {
locale: 'fa',
Pagination,
DatePicker,
TimePicker,
Calendar,
Table: {
filterTitle: 'منوی فیلتر',
filterConfirm: 'تایید',
filterReset: 'پاک کردن',
emptyText: 'داده‌ای موجود نیست',
selectAll: 'انتخاب صفحه‌ی کنونی',
selectInvert: 'معکوس کردن انتخاب‌ها در صفحه ی کنونی',
},
Modal: {
okText: 'تایید',
cancelText: 'لغو',
justOkText: 'تایید',
},
Popconfirm: {
okText: 'تایید',
cancelText: 'لغو',
},
Transfer: {
notFoundContent: 'داده‌ای موجود نیست',
searchPlaceholder: 'جستجو',
itemUnit: '',
itemsUnit: '',
},
Select: {
notFoundContent: 'داده‌ای موجود نیست',
},
Upload: {
uploading: 'در حال آپلود...',
removeFile: 'حذف فایل',
uploadError: 'خطا در آپلود',
previewFile: 'مشاهده‌ی فایل',
},
};

View File

@ -0,0 +1,47 @@
import moment from 'moment';
moment.locale('nb');
import Pagination from 'rc-pagination/lib/locale/nb_NO';
import DatePicker from '../date-picker/locale/nb_NO';
import TimePicker from '../time-picker/locale/nb_NO';
import Calendar from '../calendar/locale/nb_NO';
export default {
locale: 'nb',
DatePicker,
TimePicker,
Calendar,
Pagination,
Table: {
filterTitle: 'Filtermeny',
filterConfirm: 'OK',
filterReset: 'Nullstill',
emptyText: 'Ingen data',
selectAll: 'Velg alle',
selectInvert: 'Inverter valg',
},
Modal: {
okText: 'OK',
cancelText: 'Avbryt',
justOkText: 'OK',
},
Popconfirm: {
okText: 'OK',
cancelText: 'Avbryt',
},
Transfer: {
notFoundContent: 'Ingen treff',
searchPlaceholder: 'Søk her',
itemUnit: 'element',
itemsUnit: 'elementer',
},
Select: {
notFoundContent: 'Ingen treff',
},
Upload: {
uploading: 'Laster opp...',
removeFile: 'Fjern fil',
uploadError: 'Feil ved opplastning',
previewFile: 'Forhåndsvisning',
},
};

View File

@ -1,9 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Button from '../button';
import { ButtonType } from '../button/button';
export interface ActionButtonProps {
type?: 'primary' | 'dashed';
type?: ButtonType;
actionFn: Function;
closeModal: Function;
autoFocus?: Boolean;

View File

@ -3,6 +3,7 @@ import Dialog from 'rc-dialog';
import PropTypes from 'prop-types';
import addEventListener from 'rc-util/lib/Dom/addEventListener';
import Button from '../button';
import { ButtonType } from '../button/button';
let mousePosition;
let mousePositionEventBinded;
@ -27,6 +28,8 @@ export interface ModalProps {
footer?: React.ReactNode;
/** 确认按钮文字*/
okText?: string;
/** 确认按钮类型*/
okType?: ButtonType;
/** 取消按钮文字*/
cancelText?: string;
/** 点击蒙层是否允许关闭*/
@ -37,6 +40,7 @@ export interface ModalProps {
transitionName?: string;
className?: string;
getContainer?: (instance: React.ReactInstance) => HTMLElement;
zIndex?: boolean;
}
export interface ModalContext {
@ -54,9 +58,11 @@ export interface ModalFuncProps {
width?: string | number;
iconClassName?: string;
okText?: string;
okType?: ButtonType;
cancelText?: string;
iconType?: string;
maskClosable?: boolean;
zIndex?: boolean;
}
export type ModalFunc = (props: ModalFuncProps) => {
destroy: () => void,
@ -77,6 +83,7 @@ export default class Modal extends React.Component<ModalProps, any> {
maskTransitionName: 'fade',
confirmLoading: false,
visible: false,
okType: 'primary',
};
static propTypes = {
@ -133,7 +140,7 @@ export default class Modal extends React.Component<ModalProps, any> {
}
render() {
let { okText, cancelText, confirmLoading, footer, visible } = this.props;
let { okText, okType, cancelText, confirmLoading, footer, visible } = this.props;
if (this.context.antLocale && this.context.antLocale.Modal) {
okText = okText || this.context.antLocale.Modal.okText;
@ -151,7 +158,7 @@ export default class Modal extends React.Component<ModalProps, any> {
), (
<Button
key="confirm"
type="primary"
type={okType}
size="large"
loading={confirmLoading}
onClick={this.handleOk}

View File

@ -9,6 +9,7 @@ import { getConfirmLocale } from './locale';
export default function confirm(config) {
const props = {
iconType: 'question-circle',
okType: 'primary',
...config,
};
const prefixCls = props.prefixCls || 'ant-confirm';
@ -59,7 +60,7 @@ export default function confirm(config) {
<ActionButton actionFn={props.onCancel} closeModal={close}>
{props.cancelText}
</ActionButton>
<ActionButton type="primary" actionFn={props.onOk} closeModal={close} autoFocus>
<ActionButton type={props.okType} actionFn={props.onOk} closeModal={close} autoFocus>
{props.okText}
</ActionButton>
</div>
@ -67,7 +68,7 @@ export default function confirm(config) {
} else {
footer = (
<div className={`${prefixCls}-btns`}>
<ActionButton type="primary" actionFn={props.onOk} closeModal={close} autoFocus>
<ActionButton type={props.okType} actionFn={props.onOk} closeModal={close} autoFocus>
{props.okText}
</ActionButton>
</div>
@ -90,6 +91,7 @@ export default function confirm(config) {
maskClosable={maskClosable}
style={style}
width={width}
zIndex={props.zIndex}
>
<div className={`${prefixCls}-body-wrapper`}>
{body} {footer}

View File

@ -30,9 +30,30 @@ function showConfirm() {
});
}
function showDeleteConfirm() {
confirm({
title: 'Are you sure delete this task?',
content: 'Some descriptions',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
onOk() {
console.log('OK');
},
onCancel() {
console.log('Cancel');
},
});
}
ReactDOM.render(
<Button onClick={showConfirm}>
Confirm
</Button>
<div>
<Button onClick={showConfirm}>
Confirm
</Button>
<Button onClick={showDeleteConfirm} type="dashed">
Delete
</Button>
</div>
, mountNode);
````

View File

@ -27,12 +27,14 @@ and so on.
| width | Width of a modal dialog | string\|number | 520 |
| footer | Footer content, set as `footer={null}` when you don't need default buttons | string\|ReactNode | OK and cancel button |
| okText | Text of the OK button | string | OK |
| okType | type of the confirmation button | string | primary |
| cancelText | Text of the Cancel button | string | Cancel |
| maskClosable | Determine whether to close the modal dialog when clicked mask of it. | boolean | true |
| style | Style of floating layer, typically used at least for adjusting the position. | object | - |
| wrapClassName | The class name of the container of the modal dialog | string | - |
| afterClose | Specify a function that will be called when modal is closed completely. | function | - |
| getContainer | Return the mount node for Modal | (instance): HTMLElement | () => document.body |
| zIndex | To set the `z-index` of Modal | Number | 1000 |
#### Destroy on close
@ -71,8 +73,10 @@ The properties of the object are follows:
| width | Width of dialog | string\|number | 416 |
| iconType | Type of Icon component | string | question-circle |
| okText | Text of OK button | string | OK |
| okType | type of the confirmation button | string | primary |
| cancelText | Text of cancel button | string | Cancel |
| maskClosable | Determine whether to close the modal dialog when clicked mask of it. | Boolean | `false` |
| zIndex | To set the `z-index` of Modal | Number | 1000 |
All the `Modal.method`s will return a reference, and then we can close the popup by the reference.

View File

@ -26,12 +26,14 @@ title: Modal
| width | 宽度 | string\|number | 520 |
| footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer={null}` | string\|ReactNode | 确定取消按钮 |
| okText | 确认按钮文字 | string | 确定 |
| okType | 确认按钮类型 | string | primary |
| cancelText | 取消按钮文字 | string | 取消 |
| maskClosable | 点击蒙层是否允许关闭 | boolean | true |
| style | 可用于设置浮层的样式,调整浮层位置等 | object | - |
| wrapClassName | 对话框外层容器的类名 | string | - |
| afterClose | Modal 完全关闭后的回调 | function | 无 |
| getContainer | 指定 Modal 挂载的 HTML 节点 | (instance): HTMLElement | () => document.body |
| zIndex | 设置 Modal 的 `z-index` | Number | 1000 |
#### 清空旧数据
@ -69,8 +71,10 @@ title: Modal
| width | 宽度 | string\|number | 416 |
| iconType | 图标 Icon 类型 | string | question-circle |
| okText | 确认按钮文字 | string | 确定 |
| okType | 确认按钮类型 | string | primary |
| cancelText | 取消按钮文字 | string | 取消 |
| maskClosable | 点击蒙层是否允许关闭 | Boolean | `false` |
| zIndex | 设置 Modal 的 `z-index` | Number | 1000 |
以上函数调用后,会返回一个引用,可以通过该引用关闭弹窗。

View File

@ -20,6 +20,7 @@ The difference with `confirm` is more lightweight than the static popped full-sc
| onConfirm | callback of confirmation | function(e) | none |
| onCancel | callback of cancel | function(e) | none |
| okText | text of the confirmation button | string | Confirm |
| okType | type of the confirmation button | string | primary |
| cancelText| text of the cancel button | string | Cancel |
Consult [Tooltip's documentation](https://ant.design/components/tooltip/#API) to find more APIs.

View File

@ -2,6 +2,7 @@ import React from 'react';
import Tooltip, { AbstractTooltipProps } from '../tooltip';
import Icon from '../icon';
import Button from '../button';
import { ButtonType } from '../button/button';
import injectLocale from '../locale-provider/injectLocale';
export interface PopconfirmProps extends AbstractTooltipProps {
@ -9,6 +10,7 @@ export interface PopconfirmProps extends AbstractTooltipProps {
onConfirm?: (e: React.MouseEvent<any>) => void;
onCancel?: (e: React.MouseEvent<any>) => void;
okText?: React.ReactNode;
okType?: ButtonType;
cancelText?: React.ReactNode;
}
@ -18,6 +20,7 @@ abstract class Popconfirm extends React.Component<PopconfirmProps, any> {
transitionName: 'zoom-big',
placement: 'top',
trigger: 'click',
okType: 'primary',
};
refs: {
@ -79,7 +82,7 @@ abstract class Popconfirm extends React.Component<PopconfirmProps, any> {
}
render() {
const { prefixCls, title, placement, okText, cancelText, ...restProps } = this.props;
const { prefixCls, title, placement, okText, okType, cancelText, ...restProps } = this.props;
const popconfirmLocale = this.getLocale();
const overlay = (
@ -93,7 +96,7 @@ abstract class Popconfirm extends React.Component<PopconfirmProps, any> {
<Button onClick={this.onCancel} size="small">
{cancelText || popconfirmLocale.cancelText}
</Button>
<Button onClick={this.onConfirm} type="primary" size="small">
<Button onClick={this.onConfirm} type={okType} size="small">
{okText || popconfirmLocale.okText}
</Button>
</div>

View File

@ -21,6 +21,7 @@ title: Popconfirm
| onConfirm | 点击确认的回调 | function(e) | 无 |
| onCancel | 点击取消的回调 | function(e) | 无 |
| okText | 确认按钮文字 | string | 确定 |
| okType | 确认按钮类型 | string | primary |
| cancelText| 取消按钮文字 | string | 取消 |
更多属性请参考 [Tooltip](/components/tooltip/#API)。

View File

@ -675,6 +675,90 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
</div>
`;
exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] = `
<div
class="ant-radio-group"
>
<label
class="ant-radio-wrapper ant-radio-wrapper-checked"
>
<span
class="ant-radio ant-radio-checked"
>
<input
checked=""
class="ant-radio-input"
name="radiogroup"
type="radio"
/>
<span
class="ant-radio-inner"
/>
</span>
<span>
A
</span>
</label>
<label
class="ant-radio-wrapper"
>
<span
class="ant-radio"
>
<input
class="ant-radio-input"
name="radiogroup"
type="radio"
/>
<span
class="ant-radio-inner"
/>
</span>
<span>
B
</span>
</label>
<label
class="ant-radio-wrapper"
>
<span
class="ant-radio"
>
<input
class="ant-radio-input"
name="radiogroup"
type="radio"
/>
<span
class="ant-radio-inner"
/>
</span>
<span>
C
</span>
</label>
<label
class="ant-radio-wrapper"
>
<span
class="ant-radio"
>
<input
class="ant-radio-input"
name="radiogroup"
type="radio"
/>
<span
class="ant-radio-inner"
/>
</span>
<span>
D
</span>
</label>
</div>
`;
exports[`renders ./components/radio/demo/size.md correctly 1`] = `
<div>
<div>

View File

@ -101,4 +101,15 @@ describe('Radio', () => {
expect(radios.length).toBe(3);
});
it('all children should have a name property', () => {
const GROUP_NAME = 'radiogroup';
const wrapper = mount(
createRadioGroup({ name: GROUP_NAME })
);
expect(wrapper.find('input[type="radio"]').forEach((el) => {
expect(el.props().name).toEqual(GROUP_NAME);
}));
});
});

View File

@ -0,0 +1,32 @@
---
order: 4
title:
zh-CN: 单选组合 - 配合 name 使用
en-US: RadioGroup with name
---
## zh-CN
可以为 RadioGroup 配置 `name` 参数,为组合内的 input 元素赋予相同的 `name` 属性,使浏览器把 RadioGroup 下的 Radio 真正看作是一组(例如可以通过方向键始终**在同一组内**更改选项)。
## en-US
Passing the `name` property to all `input[type="radio"]` that are in the same RadioGroup. It is usually used to let the browser see your RadioGroup as a real "group" and keep the default behavior. For example, using left/right keyboard arrow to change your selection that in the same RadioGroup.
```jsx
import { Radio } from 'antd';
const RadioGroup = Radio.Group;
function App() {
return (
<RadioGroup name="radiogroup" defaultValue={1}>
<Radio value={1}>A</Radio>
<Radio value={2}>B</Radio>
<Radio value={3}>C</Radio>
<Radio value={4}>D</Radio>
</RadioGroup>
);
}
ReactDOM.render(<App />, mountNode);
```

View File

@ -24,6 +24,7 @@ export interface RadioGroupProps extends AbstractCheckboxGroupProps {
size?: 'large' | 'default' | 'small';
onMouseEnter?: React.FormEventHandler<any>;
onMouseLeave?: React.FormEventHandler<any>;
name?: string;
}
export default class RadioGroup extends React.Component<RadioGroupProps, any> {
@ -57,6 +58,7 @@ export default class RadioGroup extends React.Component<RadioGroupProps, any> {
onChange: this.onRadioChange,
value: this.state.value,
disabled: this.props.disabled,
name: this.props.name,
},
};
}

View File

@ -27,6 +27,7 @@ radio groupwrap a group of `Radio`。
| Property | Description | Type | optional | Default |
|----------------|----------------------------------|-------------------|--------|--------|
| name | The `name` property of all `input[type="radio"]` children | string | | none |
| onChange | The callback function that is triggered when the state changes. | Function(e:Event) | none | none |
| value | Used for setting the currently selected value. | any | none | none |
| defaultValue | Default selected value | any | none | none |

View File

@ -28,6 +28,7 @@ title: Radio
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|----------------|----------------------------------|-------------------|--------|--------|
| name | RadioGroup 下所有 `input[type="radio"]``name` 属性 | string | | 无 |
| onChange | 选项变化时的回调函数 | Function(e:Event) | 无 | 无 |
| value | 用于设置当前选中的值 | any | 无 | 无 |
| defaultValue | 默认选中的值 | any | 无 | 无 |

View File

@ -40,6 +40,7 @@ export default class Radio extends React.Component<RadioProps, any> {
const { radioGroup } = context;
let radioProps: RadioProps = { ...restProps };
if (radioGroup) {
radioProps.name = radioGroup.name;
radioProps.onChange = radioGroup.onChange;
radioProps.checked = props.value === radioGroup.value;
radioProps.disabled = props.disabled || radioGroup.disabled;

View File

@ -58,6 +58,11 @@ export interface TableRowSelection<T> {
selections?: SelectionDecorator[] | boolean;
}
export interface DefaultColumnSortOrder {
columnTitle: string;
sortOrder: 'ascend' | 'descend';
}
export interface TableProps<T> {
prefixCls?: string;
dropdownPrefixCls?: string;
@ -70,6 +75,7 @@ export interface TableProps<T> {
rowClassName?: (record: T, index: number) => string;
expandedRowRender?: any;
defaultExpandedRowKeys?: string[] | number[];
defaultSortOrder?: DefaultColumnSortOrder;
expandedRowKeys?: string[] | number[];
expandIconAsCell?: boolean;
expandIconColumnIndex?: number;
@ -156,7 +162,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
this.columns = props.columns || normalizeColumns(props.children);
this.state = {
...this.getSortStateFromColumns(),
...this.getDefaultSortOrder(this.columns),
// 减少状态
filters: this.getFiltersFromColumns(),
pagination: this.getDefaultPagination(props),
@ -332,16 +338,32 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
return filters;
}
getDefaultSortOrder(columns?) {
const definedSortState = this.getSortStateFromColumns(columns);
if (this.props.defaultSortOrder && !definedSortState.sortColumn) {
let columnTitle = this.props.defaultSortOrder.columnTitle;
return {
sortColumn: flatFilter(columns || this.columns || [], column => column.title === columnTitle)[0],
sortOrder: this.props.defaultSortOrder.sortOrder,
};
}
return definedSortState;
}
getSortStateFromColumns(columns?) {
// return fisrt column which sortOrder is not falsy
// return first column which sortOrder is not falsy
const sortedColumn =
this.getSortOrderColumns(columns).filter(col => col.sortOrder)[0];
if (sortedColumn) {
return {
sortColumn: sortedColumn,
sortOrder: sortedColumn.sortOrder,
};
}
return {
sortColumn: null,
sortOrder: null,
@ -731,10 +753,9 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
if (column.sorter) {
let isSortColumn = this.isSortColumn(column);
if (isSortColumn) {
column.className = column.className || '';
if (sortOrder) {
column.className += ` ${prefixCls}-column-sort`;
}
column.className = classNames(column.className, {
[`${prefixCls}-column-sort`]: sortOrder,
});
}
const isAscend = isSortColumn && sortOrder === 'ascend';
const isDescend = isSortColumn && sortOrder === 'descend';

View File

@ -38,6 +38,28 @@ describe('Table.sorter', () => {
expect(wrapper.find('thead')).toMatchSnapshot();
});
it('default sort order ascend', () => {
const wrapper = mount(createTable({
defaultSortOrder: {
columnTitle: 'Name',
sortOrder: 'ascend',
},
}));
expect(renderedNames(wrapper)).toEqual(['Jack', 'Jerry', 'Lucy', 'Tom']);
});
it('default sort order descend', () => {
const wrapper = mount(createTable({
defaultSortOrder: {
columnTitle: 'Name',
sortOrder: 'descend',
},
}));
expect(renderedNames(wrapper)).toEqual(['Tom', 'Lucy', 'Jack', 'Jerry']);
});
it('sort records', () => {
const wrapper = mount(createTable());

View File

@ -7811,7 +7811,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
</span>
</th>
<th
class=""
class="ant-table-column-sort"
>
<span>
Age
@ -7827,7 +7827,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
/>
</span>
<span
class="ant-table-column-sorter-down off"
class="ant-table-column-sorter-down on"
title="↓"
>
<i
@ -7873,29 +7873,6 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
<tbody
class="ant-table-tbody"
>
<tr
class="ant-table-row ant-table-row-level-0"
>
<td
class=""
>
<span
class="ant-table-row-indent indent-level-0"
style="padding-left:0px;"
/>
John Brown
</td>
<td
class=""
>
32
</td>
<td
class=""
>
New York No. 1 Lake Park
</td>
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
>
@ -7909,7 +7886,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
Jim Green
</td>
<td
class=""
class="ant-table-column-sort"
>
42
</td>
@ -7929,10 +7906,33 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
class="ant-table-row-indent indent-level-0"
style="padding-left:0px;"
/>
Joe Black
John Brown
</td>
<td
class="ant-table-column-sort"
>
32
</td>
<td
class=""
>
New York No. 1 Lake Park
</td>
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
>
<td
class=""
>
<span
class="ant-table-row-indent indent-level-0"
style="padding-left:0px;"
/>
Joe Black
</td>
<td
class="ant-table-column-sort"
>
32
</td>
@ -7955,7 +7955,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
Jim Red
</td>
<td
class=""
class="ant-table-column-sort"
>
32
</td>

View File

@ -89,5 +89,10 @@ function onChange(pagination, filters, sorter) {
console.log('params', pagination, filters, sorter);
}
ReactDOM.render(<Table columns={columns} dataSource={data} onChange={onChange} />, mountNode);
ReactDOM.render(<Table
columns={columns}
dataSource={data}
onChange={onChange}
defaultSortOrder={{ columnTitle: 'Age', sortOrder: 'descend' }}
/>, mountNode);
````

View File

@ -60,7 +60,8 @@ const columns = [{
| rowKey | get row's key, could be a string or function | string\|Function(record):string | 'key' |
| rowClassName | get row's className | Function(record, index):string | - |
| expandedRowRender | expanded container render for each row | Function | - |
| defaultExpandedRowKeys | initial expanded row keys | string[] | - |
| defaultSortOrder | default column sorting | Object({columnTitle, sortOrder}) | - |
| defaultExpandedRowKeys | initial expanded row keys | | - |
| expandedRowKeys | current expanded rows keys | string[] | - |
| defaultExpandAllRows | expand all rows initially | boolean | false |
| onExpandedRowsChange | function to call when the expanded rows change | Function(expandedRows) | |

View File

@ -0,0 +1,5 @@
const locale = {
placeholder: 'Επιλέξτε ώρα',
};
export default locale;

View File

@ -0,0 +1,5 @@
const locale = {
placeholder: 'انتخاب زمان',
};
export default locale;

View File

@ -0,0 +1,5 @@
const locale = {
placeholder: 'Velg tid',
};
export default locale;

View File

@ -43,6 +43,8 @@ Supported languages:
|Italian|it_IT|
|Japanese|ja_JP|
|Korean|ko_KR|
|Norwegian|nb_NO|
|Persian|fa_IR|
|Polish|pl_PL|
|Portuguese (Brazil)|pt_BR|
|Russian|ru_RU|

View File

@ -41,6 +41,8 @@ return (
|意大利语|it_IT|
|日语|ja_JP|
|韩语/朝鲜语|ko_KR|
|挪威|nb_NO|
|波斯语|fa_IR|
|波兰语|pl_PL|
|葡萄牙语|pt_BR|
|俄罗斯语|ru_RU|

View File

@ -57,7 +57,7 @@
"rc-input-number": "~3.6.0",
"rc-menu": "~5.0.10",
"rc-notification": "~2.0.0",
"rc-pagination": "~1.10.0",
"rc-pagination": "~1.10.6",
"rc-progress": "~2.1.2",
"rc-rate": "~2.1.1",
"rc-select": "~6.8.6",