mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
commit
81f16cb2e0
@ -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>
|
||||
|
2
components/calendar/locale/el_GR.tsx
Normal file
2
components/calendar/locale/el_GR.tsx
Normal file
@ -0,0 +1,2 @@
|
||||
import el_GR from '../../date-picker/locale/el_GR';
|
||||
export default el_GR;
|
2
components/calendar/locale/fa_IR.tsx
Normal file
2
components/calendar/locale/fa_IR.tsx
Normal file
@ -0,0 +1,2 @@
|
||||
import fa_IR from '../../date-picker/locale/fa_IR';
|
||||
export default fa_IR;
|
2
components/calendar/locale/nb_NO.tsx
Normal file
2
components/calendar/locale/nb_NO.tsx
Normal file
@ -0,0 +1,2 @@
|
||||
import nb_NO from '../../date-picker/locale/nb_NO';
|
||||
export default nb_NO;
|
2
components/calendar/locale/sr_RS.tsx
Normal file
2
components/calendar/locale/sr_RS.tsx
Normal file
@ -0,0 +1,2 @@
|
||||
import sr_RS from '../../date-picker/locale/sr_RS';
|
||||
export default sr_RS;
|
19
components/date-picker/locale/el_GR.tsx
Normal file
19
components/date-picker/locale/el_GR.tsx
Normal 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;
|
19
components/date-picker/locale/fa_IR.tsx
Normal file
19
components/date-picker/locale/fa_IR.tsx
Normal 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;
|
19
components/date-picker/locale/nb_NO.tsx
Normal file
19
components/date-picker/locale/nb_NO.tsx
Normal 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;
|
19
components/date-picker/locale/sr_RS.tsx
Normal file
19
components/date-picker/locale/sr_RS.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import CalendarLocale from 'rc-calendar/lib/locale/sr_RS';
|
||||
import TimePickerLocale from '../../time-picker/locale/sr_RS';
|
||||
|
||||
// Merge into a locale object
|
||||
const locale = {
|
||||
lang: {
|
||||
placeholder: 'Izaberite datum',
|
||||
rangePlaceholder: ['Početni datum', 'Krajnji datum'],
|
||||
...CalendarLocale,
|
||||
},
|
||||
timePickerLocale: {
|
||||
...TimePickerLocale,
|
||||
},
|
||||
};
|
||||
|
||||
// All settings at:
|
||||
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
|
||||
|
||||
export default locale;
|
@ -49,7 +49,6 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger ant-btn-default"
|
||||
disabled=""
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
|
@ -10,6 +10,7 @@ export interface DropDownProps {
|
||||
style?: React.CSSProperties;
|
||||
onVisibleChange?: (visible?: boolean) => void;
|
||||
visible?: boolean;
|
||||
disabled?: boolean;
|
||||
align?: Object;
|
||||
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
||||
prefixCls?: string;
|
||||
@ -44,9 +45,10 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, prefixCls, overlay } = this.props;
|
||||
const { children, prefixCls, overlay, trigger, disabled } = this.props;
|
||||
const dropdownTrigger = cloneElement(children as any, {
|
||||
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
|
||||
disabled,
|
||||
});
|
||||
// menu cannot be selectable in dropdown defaultly
|
||||
const overlayProps = overlay && (overlay as any).props;
|
||||
@ -58,8 +60,9 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
});
|
||||
return (
|
||||
<RcDropdown
|
||||
transitionName={this.getTransitionName()}
|
||||
{...this.props}
|
||||
transitionName={this.getTransitionName()}
|
||||
trigger={disabled ? [] : trigger}
|
||||
overlay={fixedModeOverlay}
|
||||
>
|
||||
{dropdownTrigger}
|
||||
|
@ -20,6 +20,7 @@ If there are too many operations to display, you can wrap them in a `Dropdown`.
|
||||
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
||||
| getPopupContainer | to set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| visible | determine whether the dropdown menu is visible | boolean | - |
|
||||
| disabled| determine whether the dropdown menu is disabled| boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, can be executed when the visible state is changing | Function(visible) | - |
|
||||
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
||||
@ -39,5 +40,6 @@ You can get the menu list by `antd.Menu`, and set a callback function `onSelect`
|
||||
| trigger | the trigger mode which can execute the drop-down action | Array<'click'\|'hover'> | ['hover'] |
|
||||
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
||||
| visible | determine whether the dropdown menu is visible | boolean | - |
|
||||
| disabled | determine whether the dropdown menu is disabled| boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, can be executed when the visible state is changing | Function | - |
|
||||
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
@ -21,6 +21,7 @@ title: Dropdown
|
||||
| overlay | 菜单 | [Menu](/components/menu) | - |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| visible | 菜单是否显示 | boolean | - |
|
||||
| disabled | 菜单是否禁用 | boolean | - |
|
||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - |
|
||||
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
||||
@ -40,5 +41,6 @@ title: Dropdown
|
||||
| trigger | 触发下拉的行为 | Array<'click'\|'hover'> | ['hover'] |
|
||||
| overlay | 菜单 | [Menu](/components/menu/) | - |
|
||||
| visible | 菜单是否显示 | boolean | - |
|
||||
| disabled | 菜单是否禁用 | boolean | - |
|
||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function | - |
|
||||
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
@ -68,7 +68,9 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="Previous Page"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -121,7 +123,9 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="Next Page"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<div
|
||||
class="ant-pagination-options"
|
||||
@ -1551,7 +1555,9 @@ exports[`renders ./components/locale-provider/demo/basic.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="Previous Page"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -1604,7 +1610,9 @@ exports[`renders ./components/locale-provider/demo/basic.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="Next Page"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<div
|
||||
class="ant-pagination-options"
|
||||
|
@ -28,8 +28,12 @@ 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';
|
||||
import srRS from '../sr_RS';
|
||||
|
||||
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, srRS];
|
||||
|
||||
const Option = Select.Option;
|
||||
const RangePicker = DatePicker.RangePicker;
|
||||
|
47
components/locale-provider/el_GR.tsx
Normal file
47
components/locale-provider/el_GR.tsx
Normal 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: 'Προεπισκόπηση αρχείου',
|
||||
},
|
||||
};
|
47
components/locale-provider/fa_IR.tsx
Normal file
47
components/locale-provider/fa_IR.tsx
Normal 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: 'مشاهدهی فایل',
|
||||
},
|
||||
};
|
47
components/locale-provider/nb_NO.tsx
Normal file
47
components/locale-provider/nb_NO.tsx
Normal 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',
|
||||
},
|
||||
};
|
47
components/locale-provider/sr_RS.tsx
Normal file
47
components/locale-provider/sr_RS.tsx
Normal file
@ -0,0 +1,47 @@
|
||||
import moment from 'moment';
|
||||
moment.locale('sr');
|
||||
|
||||
import Pagination from 'rc-pagination/lib/locale/sr_RS';
|
||||
import DatePicker from '../date-picker/locale/sr_RS';
|
||||
import TimePicker from '../time-picker/locale/sr_RS';
|
||||
import Calendar from '../calendar/locale/sr_RS';
|
||||
|
||||
export default {
|
||||
locale: 'sr',
|
||||
Pagination,
|
||||
DatePicker,
|
||||
TimePicker,
|
||||
Calendar,
|
||||
Table: {
|
||||
filterTitle: 'Filter',
|
||||
filterConfirm: 'Primeni filter',
|
||||
filterReset: 'Resetuj filter',
|
||||
emptyText: 'Nema podataka',
|
||||
selectAll: 'Obeleži sve na trenutnoj strani',
|
||||
selectInvert: 'Obrni selekciju na trenutnoj stranici',
|
||||
},
|
||||
Modal: {
|
||||
okText: 'U redu',
|
||||
cancelText: 'Otkaži',
|
||||
justOkText: 'U redu',
|
||||
},
|
||||
Popconfirm: {
|
||||
okText: 'U redu',
|
||||
cancelText: 'Otkaži',
|
||||
},
|
||||
Transfer: {
|
||||
notFoundContent: 'Nisu pronađeni rezultati pretrage',
|
||||
searchPlaceholder: 'Pretražite ovde',
|
||||
itemUnit: 'stavka',
|
||||
itemsUnit: 'stavki',
|
||||
},
|
||||
Select: {
|
||||
notFoundContent: 'Nije pronađeno',
|
||||
},
|
||||
Upload: {
|
||||
uploading: 'Slanje...',
|
||||
removeFile: 'Ukloni fajl',
|
||||
uploadError: 'Greška prilikom slanja',
|
||||
previewFile: 'Pogledaj fajl',
|
||||
},
|
||||
};
|
@ -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;
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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);
|
||||
````
|
||||
|
@ -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
|
||||
|
||||
@ -61,8 +63,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.
|
||||
|
||||
|
@ -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 |
|
||||
|
||||
#### 清空旧数据
|
||||
|
||||
@ -59,8 +61,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 |
|
||||
|
||||
以上函数调用后,会返回一个引用,可以通过该引用关闭弹窗。
|
||||
|
||||
|
@ -11,7 +11,9 @@ exports[`renders ./components/pagination/demo/basic.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -64,7 +66,9 @@ exports[`renders ./components/pagination/demo/basic.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
`;
|
||||
@ -80,7 +84,9 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1"
|
||||
@ -132,7 +138,9 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="向后 5 页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-50"
|
||||
@ -149,7 +157,9 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<div
|
||||
class="ant-pagination-options"
|
||||
@ -201,7 +211,9 @@ exports[`renders ./components/pagination/demo/controlled.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1"
|
||||
@ -254,7 +266,100 @@ exports[`renders ./components/pagination/demo/controlled.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/pagination/demo/itemRender.md correctly 1`] = `
|
||||
<ul
|
||||
class="ant-pagination "
|
||||
unselectable="unselectable"
|
||||
>
|
||||
<li
|
||||
aria-disabled="true"
|
||||
class="ant-pagination-disabled ant-pagination-prev"
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a>
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
tabindex="0"
|
||||
title="1"
|
||||
>
|
||||
<a>
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-2"
|
||||
tabindex="0"
|
||||
title="2"
|
||||
>
|
||||
<a>
|
||||
2
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-3"
|
||||
tabindex="0"
|
||||
title="3"
|
||||
>
|
||||
<a>
|
||||
3
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-4"
|
||||
tabindex="0"
|
||||
title="4"
|
||||
>
|
||||
<a>
|
||||
4
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-5 ant-pagination-item-before-jump-next"
|
||||
tabindex="0"
|
||||
title="5"
|
||||
>
|
||||
<a>
|
||||
5
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-jump-next"
|
||||
tabindex="0"
|
||||
title="向后 5 页"
|
||||
>
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-50"
|
||||
tabindex="0"
|
||||
title="50"
|
||||
>
|
||||
<a>
|
||||
50
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
aria-disabled="false"
|
||||
class=" ant-pagination-next"
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a>
|
||||
Next
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
`;
|
||||
@ -270,7 +375,9 @@ exports[`renders ./components/pagination/demo/jump.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1"
|
||||
@ -322,7 +429,9 @@ exports[`renders ./components/pagination/demo/jump.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="向后 5 页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-50"
|
||||
@ -339,7 +448,9 @@ exports[`renders ./components/pagination/demo/jump.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<div
|
||||
class="ant-pagination-options"
|
||||
@ -370,7 +481,9 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -423,7 +536,9 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
<ul
|
||||
@ -436,7 +551,9 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -489,7 +606,9 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<div
|
||||
class="ant-pagination-options"
|
||||
@ -553,7 +672,9 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -606,7 +727,9 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -623,7 +746,9 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1"
|
||||
@ -639,7 +764,9 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="向前 5 页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-4 ant-pagination-item-after-jump-prev"
|
||||
@ -691,7 +818,9 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="向后 5 页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-50"
|
||||
@ -708,7 +837,9 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
`;
|
||||
@ -769,7 +900,9 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -822,7 +955,9 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
<br />
|
||||
@ -841,7 +976,9 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -894,7 +1031,9 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
31
components/pagination/demo/itemRender.md
Normal file
31
components/pagination/demo/itemRender.md
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
order: 10
|
||||
title:
|
||||
zh-CN: 上一步和下一步
|
||||
en-US: Prev and next
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
修改上一步和下一步为文字链接。
|
||||
|
||||
## en-US
|
||||
|
||||
Use text link for prev and next button.
|
||||
|
||||
````jsx
|
||||
import { Pagination } from 'antd';
|
||||
|
||||
function itemRender(current, type, originalElement) {
|
||||
if (type === 'prev') {
|
||||
return <a>Previous</a>;
|
||||
} else if (type === 'next') {
|
||||
return <a>Next</a>;
|
||||
}
|
||||
return originalElement;
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Pagination total={500} itemRender={itemRender} />
|
||||
, mountNode);
|
||||
````
|
@ -33,4 +33,4 @@ showQuickJumper | determine whether you can jump to a page directly | boolean |
|
||||
size | specify the size of `Pagination`, can be set to `small` | string | ""
|
||||
simple | whether to use simple mode | boolean | -
|
||||
showTotal | to display the total number and range | Function(total, range) | -
|
||||
itemRender | to customize item innerHTML | (page, type: 'page' \| 'prev' \| 'next') => React.ReactNode | - |
|
||||
itemRender | to customize item innerHTML | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
|
||||
|
@ -34,4 +34,4 @@ cols: 1
|
||||
| size | 当为「small」时,是小尺寸分页 | string | "" |
|
||||
| simple | 当添加该属性时,显示为简单分页 | boolean | - |
|
||||
| showTotal | 用于显示数据总量和当前数据顺序 | Function(total, range) | - |
|
||||
| itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next') => React.ReactNode | - |
|
||||
| itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
|
||||
|
@ -141,13 +141,24 @@
|
||||
|
||||
&-prev,
|
||||
&-next {
|
||||
border: @border-width-base @border-style-base @border-color-base;
|
||||
background-color: @component-background;
|
||||
outline: 0;
|
||||
|
||||
a {
|
||||
color: @text-color;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
&:hover a {
|
||||
color: @primary-color;
|
||||
}
|
||||
|
||||
.@{pagination-prefix-cls}-item-link {
|
||||
border: @border-width-base @border-style-base @border-color-base;
|
||||
background-color: @component-background;
|
||||
border-radius: @border-radius-base;
|
||||
outline: none;
|
||||
display: block;
|
||||
transition: all .3s;
|
||||
|
||||
&:after {
|
||||
.iconfont-size-under-12px(8px);
|
||||
@ -156,49 +167,43 @@
|
||||
line-height: 26px;
|
||||
font-family: "anticon";
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
&:focus,
|
||||
&:hover {
|
||||
&:focus .@{pagination-prefix-cls}-item-link,
|
||||
&:hover .@{pagination-prefix-cls}-item-link {
|
||||
border-color: @primary-color;
|
||||
a {
|
||||
color: @primary-color;
|
||||
}
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
&-prev {
|
||||
a {
|
||||
&:after {
|
||||
content: "\e620";
|
||||
display: block;
|
||||
}
|
||||
.@{pagination-prefix-cls}-item-link:after {
|
||||
content: "\e620";
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&-next {
|
||||
a {
|
||||
&:after {
|
||||
content: "\e61f";
|
||||
display: block;
|
||||
}
|
||||
.@{pagination-prefix-cls}-item-link:after {
|
||||
content: "\e61f";
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&-disabled {
|
||||
&,
|
||||
&:hover,
|
||||
&:focus {
|
||||
border-color: @border-color-base;
|
||||
a {
|
||||
cursor: not-allowed;
|
||||
a,
|
||||
.@{pagination-prefix-cls}-item-link {
|
||||
border-color: @border-color-base;
|
||||
color: @disabled-color;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
cursor: not-allowed;
|
||||
a {
|
||||
color: @disabled-color;
|
||||
}
|
||||
}
|
||||
|
||||
&-slash {
|
||||
@ -281,13 +286,15 @@
|
||||
min-width: 20px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
&.mini &-prev &-item-link,
|
||||
&.mini &-next &-item-link {
|
||||
border: 0;
|
||||
|
||||
a {
|
||||
&:after {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
&:after {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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>
|
||||
|
@ -21,6 +21,7 @@ title: Popconfirm
|
||||
| onConfirm | 点击确认的回调 | function(e) | 无 |
|
||||
| onCancel | 点击取消的回调 | function(e) | 无 |
|
||||
| okText | 确认按钮文字 | string | 确定 |
|
||||
| okType | 确认按钮类型 | string | primary |
|
||||
| cancelText| 取消按钮文字 | string | 取消 |
|
||||
|
||||
更多属性请参考 [Tooltip](/components/tooltip/#API)。
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
32
components/radio/demo/radiogroup-with-name.md
Normal file
32
components/radio/demo/radiogroup-with-name.md
Normal 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);
|
||||
```
|
@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ radio group,wrap 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 |
|
||||
|
@ -28,6 +28,7 @@ title: Radio
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|----------------|----------------------------------|-------------------|--------|--------|
|
||||
| name | RadioGroup 下所有 `input[type="radio"]` 的 `name` 属性 | string | | 无 |
|
||||
| onChange | 选项变化时的回调函数 | Function(e:Event) | 无 | 无 |
|
||||
| value | 用于设置当前选中的值 | any | 无 | 无 |
|
||||
| defaultValue | 默认选中的值 | any | 无 | 无 |
|
||||
|
@ -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;
|
||||
|
@ -21,6 +21,7 @@ export interface SelectionCheckboxAllProps {
|
||||
data: any[];
|
||||
prefixCls: string | undefined;
|
||||
onSelect: (key: string, index: number, selectFunc: any) => void;
|
||||
hideDefaultSelections?: boolean;
|
||||
selections?: SelectionDecorator[] | boolean;
|
||||
getPopupContainer: (triggerNode?: Element) => HTMLElement;
|
||||
}
|
||||
@ -32,7 +33,7 @@ export default class SelectionCheckboxAll extends React.Component<SelectionCheck
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.defaultSelections = [{
|
||||
this.defaultSelections = props.hideDefaultSelections ? [] : [{
|
||||
key: 'all',
|
||||
text: props.locale.selectAll,
|
||||
onSelect: () => {},
|
||||
@ -164,7 +165,7 @@ export default class SelectionCheckboxAll extends React.Component<SelectionCheck
|
||||
let newSelections = Array.isArray(selections) ? this.defaultSelections.concat(selections)
|
||||
: this.defaultSelections;
|
||||
|
||||
let menu = (
|
||||
const menu = (
|
||||
<Menu
|
||||
className={`${selectionPrefixCls}-menu`}
|
||||
selectedKeys={[]}
|
||||
@ -173,7 +174,7 @@ export default class SelectionCheckboxAll extends React.Component<SelectionCheck
|
||||
</Menu>
|
||||
);
|
||||
|
||||
customSelections = (
|
||||
customSelections = newSelections.length > 0 ? (
|
||||
<Dropdown
|
||||
overlay={menu}
|
||||
getPopupContainer={getPopupContainer}
|
||||
@ -182,7 +183,7 @@ export default class SelectionCheckboxAll extends React.Component<SelectionCheck
|
||||
<Icon type="down" />
|
||||
</div>
|
||||
</Dropdown>
|
||||
);
|
||||
) : null;
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -56,6 +56,12 @@ export interface TableRowSelection<T> {
|
||||
onSelectAll?: (selected: boolean, selectedRows: Object[], changeRows: Object[]) => any;
|
||||
onSelectInvert?: (selectedRows: Object[]) => any;
|
||||
selections?: SelectionDecorator[] | boolean;
|
||||
hideDefaultSelections?: boolean;
|
||||
}
|
||||
|
||||
export interface DefaultColumnSortOrder {
|
||||
columnTitle: string;
|
||||
sortOrder: 'ascend' | 'descend';
|
||||
}
|
||||
|
||||
export interface TableProps<T> {
|
||||
@ -70,6 +76,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 +163,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 +339,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,
|
||||
@ -669,6 +692,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
||||
prefixCls={prefixCls}
|
||||
onSelect={this.handleSelectRow}
|
||||
selections={rowSelection.selections}
|
||||
hideDefaultSelections={rowSelection.hideDefaultSelections}
|
||||
getPopupContainer={this.getPopupContainer}
|
||||
/>
|
||||
);
|
||||
@ -731,10 +755,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';
|
||||
|
@ -227,6 +227,7 @@ describe('Table.rowSelection', () => {
|
||||
const wrapper = mount(createTable({ rowSelection }));
|
||||
|
||||
const dropdownWrapper = mount(wrapper.find('Trigger').node.getComponent());
|
||||
expect(dropdownWrapper.find('.ant-dropdown-menu-item').length).toBe(4);
|
||||
|
||||
dropdownWrapper.find('.ant-dropdown-menu-item > div').at(2).simulate('click');
|
||||
expect(handleSelectOdd).toBeCalledWith([0, 1, 2, 3]);
|
||||
@ -235,6 +236,22 @@ describe('Table.rowSelection', () => {
|
||||
expect(handleSelectEven).toBeCalledWith([0, 1, 2, 3]);
|
||||
});
|
||||
|
||||
it('could hide default selection options', () => {
|
||||
const rowSelection = {
|
||||
hideDefaultSelections: true,
|
||||
selections: [{
|
||||
key: 'odd',
|
||||
text: '奇数项',
|
||||
}, {
|
||||
key: 'even',
|
||||
text: '偶数项',
|
||||
}],
|
||||
};
|
||||
const wrapper = mount(createTable({ rowSelection }));
|
||||
const dropdownWrapper = mount(wrapper.find('Trigger').node.getComponent());
|
||||
expect(dropdownWrapper.find('.ant-dropdown-menu-item').length).toBe(2);
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/4245
|
||||
it('handles disabled checkbox correctly when dataSource changes', () => {
|
||||
const rowSelection = {
|
||||
|
@ -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());
|
||||
|
||||
|
@ -82,7 +82,9 @@ exports[`Table.pagination renders pagination correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -108,7 +110,9 @@ exports[`Table.pagination renders pagination correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -358,7 +358,9 @@ exports[`renders ./components/table/demo/basic.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -375,7 +377,9 @@ exports[`renders ./components/table/demo/basic.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -546,7 +550,9 @@ exports[`renders ./components/table/demo/bordered.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -563,7 +569,9 @@ exports[`renders ./components/table/demo/bordered.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -815,7 +823,9 @@ exports[`renders ./components/table/demo/colspan-rowspan.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -832,7 +842,9 @@ exports[`renders ./components/table/demo/colspan-rowspan.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -1013,7 +1025,9 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -1030,7 +1044,9 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -2354,7 +2370,9 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -2371,7 +2389,9 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -2557,7 +2577,9 @@ exports[`renders ./components/table/demo/edit-cell.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -2574,7 +2596,9 @@ exports[`renders ./components/table/demo/edit-cell.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -2717,7 +2741,9 @@ exports[`renders ./components/table/demo/edit-row.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -2734,7 +2760,9 @@ exports[`renders ./components/table/demo/edit-row.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -2935,7 +2963,9 @@ exports[`renders ./components/table/demo/expand.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -2952,7 +2982,9 @@ exports[`renders ./components/table/demo/expand.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -3492,7 +3524,9 @@ exports[`renders ./components/table/demo/expand-children.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -3509,7 +3543,9 @@ exports[`renders ./components/table/demo/expand-children.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -3947,7 +3983,9 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -3964,7 +4002,9 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -5273,7 +5313,9 @@ exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] =
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -5325,7 +5367,9 @@ exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] =
|
||||
tabindex="0"
|
||||
title="向后 5 页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-10"
|
||||
@ -5342,7 +5386,9 @@ exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] =
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -6598,7 +6644,9 @@ exports[`renders ./components/table/demo/fixed-header.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -6624,7 +6672,9 @@ exports[`renders ./components/table/demo/fixed-header.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -7671,7 +7721,9 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -7723,7 +7775,9 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="向后 5 页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-10"
|
||||
@ -7740,7 +7794,9 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -7811,7 +7867,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
class=""
|
||||
class="ant-table-column-sort"
|
||||
>
|
||||
<span>
|
||||
Age
|
||||
@ -7827,7 +7883,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 +7929,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 +7942,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
Jim Green
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-sort"
|
||||
>
|
||||
42
|
||||
</td>
|
||||
@ -7929,10 +7962,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 +8011,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
Jim Red
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
class="ant-table-column-sort"
|
||||
>
|
||||
32
|
||||
</td>
|
||||
@ -7980,7 +8036,9 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -7997,7 +8055,9 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -8283,7 +8343,9 @@ exports[`renders ./components/table/demo/jsx.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -8300,7 +8362,9 @@ exports[`renders ./components/table/demo/jsx.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -8570,7 +8634,9 @@ exports[`renders ./components/table/demo/nested-table.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -8587,7 +8653,9 @@ exports[`renders ./components/table/demo/nested-table.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -8856,7 +8924,9 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -8873,7 +8943,9 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -9173,7 +9245,9 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -9190,7 +9264,9 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -9753,7 +9829,9 @@ exports[`renders ./components/table/demo/row-selection-and-operation.md correctl
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -9806,7 +9884,9 @@ exports[`renders ./components/table/demo/row-selection-and-operation.md correctl
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -10360,7 +10440,9 @@ exports[`renders ./components/table/demo/row-selection-custom.md correctly 1`] =
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -10413,7 +10495,9 @@ exports[`renders ./components/table/demo/row-selection-custom.md correctly 1`] =
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -10566,7 +10650,9 @@ exports[`renders ./components/table/demo/size.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -10583,7 +10669,9 @@ exports[`renders ./components/table/demo/size.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -10732,7 +10820,9 @@ exports[`renders ./components/table/demo/size.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="上一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
@ -10749,7 +10839,9 @@ exports[`renders ./components/table/demo/size.md correctly 1`] = `
|
||||
tabindex="0"
|
||||
title="下一页"
|
||||
>
|
||||
<a />
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -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);
|
||||
````
|
||||
|
@ -51,6 +51,7 @@ class App extends React.Component {
|
||||
const rowSelection = {
|
||||
selectedRowKeys,
|
||||
onChange: this.onSelectChange,
|
||||
hideDefaultSelections: true,
|
||||
selections: [{
|
||||
key: 'all-data',
|
||||
text: 'Select All Data',
|
||||
|
@ -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) | |
|
||||
@ -123,7 +124,8 @@ Properties for selection.
|
||||
| onSelect | callback that is called when select/deselect one row | Function(record, selected, selectedRows) | - |
|
||||
| onSelectAll | callback that is called when select/deselect all | Function(selected, selectedRows, changeRows) | - |
|
||||
| onSelectInvert | callback that is called when select invert | Function(selectedRows) | - |
|
||||
| selections | custom selection [config](#rowSelection), show default selections via setting to `true` | object[] | - |
|
||||
| selections | custom selection [config](#rowSelection), only display default selections when set to `true` | object[]\|boolean | - |
|
||||
| hideDefaultSelections | remove the default `Select All` and `Select invert` selections | boolean | false |
|
||||
|
||||
### selection
|
||||
|
||||
|
@ -124,7 +124,8 @@ const columns = [{
|
||||
| onSelect | 用户手动选择/取消选择某列的回调 | Function(record, selected, selectedRows) | - |
|
||||
| onSelectAll | 用户手动选择/取消选择所有列的回调 | Function(selected, selectedRows, changeRows) | - |
|
||||
| onSelectInvert | 用户手动选择反选的回调 | Function(selectedRows) | - |
|
||||
| selections | 自定义选择项 [配置项](#selection), 设为 `true` 时显示默认选择项 | object[] | true |
|
||||
| selections | 自定义选择项 [配置项](#selection), 设为 `true` 时使用默认选择项 | object[]\|boolean | true |
|
||||
| hideDefaultSelections | 去掉『全选』『反选』两个默认选项 | boolean | false |
|
||||
|
||||
### selection
|
||||
|
||||
|
5
components/time-picker/locale/el_GR.tsx
Normal file
5
components/time-picker/locale/el_GR.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
const locale = {
|
||||
placeholder: 'Επιλέξτε ώρα',
|
||||
};
|
||||
|
||||
export default locale;
|
5
components/time-picker/locale/fa_IR.tsx
Normal file
5
components/time-picker/locale/fa_IR.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
const locale = {
|
||||
placeholder: 'انتخاب زمان',
|
||||
};
|
||||
|
||||
export default locale;
|
5
components/time-picker/locale/nb_NO.tsx
Normal file
5
components/time-picker/locale/nb_NO.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
const locale = {
|
||||
placeholder: 'Velg tid',
|
||||
};
|
||||
|
||||
export default locale;
|
5
components/time-picker/locale/sr_RS.tsx
Normal file
5
components/time-picker/locale/sr_RS.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
const locale = {
|
||||
placeholder: 'Izaberite vreme',
|
||||
};
|
||||
|
||||
export default locale;
|
@ -43,9 +43,12 @@ 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|
|
||||
|Serbian|sr_RS|
|
||||
|Slovak|sk_SK|
|
||||
|Spanish|es_ES|
|
||||
|Swedish|sv_SE|
|
||||
|
@ -41,9 +41,12 @@ return (
|
||||
|意大利语|it_IT|
|
||||
|日语|ja_JP|
|
||||
|韩语/朝鲜语|ko_KR|
|
||||
|挪威|nb_NO|
|
||||
|波斯语|fa_IR|
|
||||
|波兰语|pl_PL|
|
||||
|葡萄牙语|pt_BR|
|
||||
|俄罗斯语|ru_RU|
|
||||
|塞尔维亚|sr_RS|
|
||||
|斯洛伐克语|sk_SK|
|
||||
|西班牙语|es_ES|
|
||||
|瑞典语|sv_SE|
|
||||
|
@ -57,7 +57,7 @@
|
||||
"rc-input-number": "~3.6.0",
|
||||
"rc-menu": "~5.0.10",
|
||||
"rc-notification": "~2.0.0",
|
||||
"rc-pagination": "~1.11.0",
|
||||
"rc-pagination": "~1.12.0",
|
||||
"rc-progress": "~2.2.2",
|
||||
"rc-rate": "~2.1.1",
|
||||
"rc-select": "~6.8.6",
|
||||
|
Loading…
Reference in New Issue
Block a user