chore: auto merge branchs (#35681)

chore: Next merge feature
This commit is contained in:
github-actions[bot] 2022-05-23 08:49:19 +00:00 committed by GitHub
commit 0c39a938c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 5452 additions and 145 deletions

View File

@ -15,6 +15,16 @@ timeline: true
---
## 4.20.6
`2022-05-22`
- 🐞 Fix DatePicker placeholder flush when open first time. [#35620](https://github.com/ant-design/ant-design/pull/35620) [@yykoypj](https://github.com/yykoypj)
- 🛠 Remove Grid default `role` attr to fit [aria-required-parent](https://accessibilityinsights.io/info-examples/web/aria-required-parent/) requirement. [#35616](https://github.com/ant-design/ant-design/pull/35616) [@bartpio](https://github.com/bartpio)
- 🐞 Fix Anchor cut content in some browser. [#35612](https://github.com/ant-design/ant-design/pull/35612) [@josonho](https://github.com/josonho)
- 🐞 Fix Table header cell border when have `rowSpan` and `scroll.y`. [#35591](https://github.com/ant-design/ant-design/pull/35591)
- 🐞 Fix Drawer that the button in it closes too fast issue. [#35339](https://github.com/ant-design/ant-design/pull/35339)
## 4.20.5
`2022-05-15`

View File

@ -15,6 +15,16 @@ timeline: true
---
## 4.20.6
`2022-05-22`
- 🐞 修复 DatePicker 初次打开时 placeholder 闪烁的问题。[#35620](https://github.com/ant-design/ant-design/pull/35620) [@yykoypj](https://github.com/yykoypj)
- 🛠 移除 Grid 默认 `role` 标签,以使其更好的适配 [aria-required-parent](https://accessibilityinsights.io/info-examples/web/aria-required-parent/) 要求。[#35616](https://github.com/ant-design/ant-design/pull/35616) [@bartpio](https://github.com/bartpio)
- 🐞 修复 Anchor 在某些游览器下会被切割内容的问题。[#35612](https://github.com/ant-design/ant-design/pull/35612) [@josonho](https://github.com/josonho)
- 🐞 修复 Table 存在表头分组和垂直滚动条时表头边框异常的问题。[#35591](https://github.com/ant-design/ant-design/pull/35591)
- 🐞 修复 Drawer 内按钮关闭速度过快问题。[#35339](https://github.com/ant-design/ant-design/pull/35339)
## 4.20.5
`2022-05-15`

View File

@ -0,0 +1,3 @@
import tkTK from '../../date-picker/locale/tk_TK';
export default tkTK;

View File

@ -0,0 +1,24 @@
import CalendarLocale from 'rc-picker/lib/locale/tk_TK';
import TimePickerLocale from '../../time-picker/locale/tk_TK';
import type { PickerLocale } from '../generatePicker';
const locale: PickerLocale = {
lang: {
placeholder: 'Wagt saýlaň',
rangePlaceholder: ['Başlanýan wagty', 'Gutarýan wagty'],
yearPlaceholder: 'Ýyl saýlaň',
quarterPlaceholder: 'Çärýek saýlaň',
monthPlaceholder: 'Aý saýlaň',
weekPlaceholder: 'Hepde saýlaň',
rangeYearPlaceholder: ['Başlanýan ýyly', 'Gutarýan ýyly'],
rangeQuarterPlaceholder: ['Başlanýan çärýegi', 'Gutarýan çärýegi'],
rangeMonthPlaceholder: ['Başlanýan aýy', 'Gutarýan aýy'],
rangeWeekPlaceholder: ['Başlanýan hepdesi', 'Gutarýan hepdesi'],
...CalendarLocale,
},
timePickerLocale: {
...TimePickerLocale,
},
};
export default locale;

View File

@ -1,150 +1,152 @@
/* eslint-disable react/no-multi-comp */
import React from 'react';
import { mount } from 'enzyme';
import dayjs from 'dayjs';
import 'dayjs/locale/ar';
import 'dayjs/locale/az';
import 'dayjs/locale/be';
import 'dayjs/locale/bg';
import 'dayjs/locale/bn-bd';
import 'dayjs/locale/ca';
import 'dayjs/locale/cs';
import 'dayjs/locale/da';
import 'dayjs/locale/de';
import 'dayjs/locale/el';
import 'dayjs/locale/en';
import 'dayjs/locale/en-gb';
import 'dayjs/locale/es';
import 'dayjs/locale/et';
import 'dayjs/locale/fa';
import 'dayjs/locale/fi';
import 'dayjs/locale/fr';
import 'dayjs/locale/fr-ca';
import 'dayjs/locale/ga';
import 'dayjs/locale/gl';
import 'dayjs/locale/he';
import 'dayjs/locale/hi';
import 'dayjs/locale/hr';
import 'dayjs/locale/hu';
import 'dayjs/locale/hy-am';
import 'dayjs/locale/id';
import 'dayjs/locale/is';
import 'dayjs/locale/it';
import 'dayjs/locale/ja';
import 'dayjs/locale/ka';
import 'dayjs/locale/kk';
import 'dayjs/locale/km';
import 'dayjs/locale/kn';
import 'dayjs/locale/ko';
import 'dayjs/locale/ku';
import 'dayjs/locale/lt';
import 'dayjs/locale/lv';
import 'dayjs/locale/mk';
import 'dayjs/locale/ml';
import 'dayjs/locale/mn';
import 'dayjs/locale/ms';
import 'dayjs/locale/nb';
import 'dayjs/locale/ne';
import 'dayjs/locale/nl';
import 'dayjs/locale/nl-be';
import 'dayjs/locale/pl';
import 'dayjs/locale/pt';
import 'dayjs/locale/pt-br';
import 'dayjs/locale/ro';
import 'dayjs/locale/ru';
import 'dayjs/locale/sk';
import 'dayjs/locale/sl';
import 'dayjs/locale/sr';
import 'dayjs/locale/sv';
import 'dayjs/locale/ta';
import 'dayjs/locale/th';
import 'dayjs/locale/tk';
import 'dayjs/locale/tr';
import 'dayjs/locale/uk';
import 'dayjs/locale/ur';
import 'dayjs/locale/vi';
import 'dayjs/locale/zh-cn';
import 'dayjs/locale/zh-hk';
import 'dayjs/locale/zh-tw';
import preParsePostFormat from 'dayjs/plugin/preParsePostFormat';
import { mount } from 'enzyme';
import MockDate from 'mockdate';
import mountTest from '../../../tests/shared/mountTest';
import React from 'react';
import LocaleProvider from '..';
import {
Pagination,
DatePicker,
TimePicker,
Calendar,
Popconfirm,
Table,
DatePicker,
Modal,
Pagination,
Popconfirm,
Select,
Table,
TimePicker,
Transfer,
} from '../..';
import LocaleProvider from '..';
import mountTest from '../../../tests/shared/mountTest';
import arEG from '../ar_EG';
import 'dayjs/locale/ar';
import azAZ from '../az_AZ';
import 'dayjs/locale/az';
import bgBG from '../bg_BG';
import 'dayjs/locale/bg';
import bnBD from '../bn_BD';
import 'dayjs/locale/bn-bd';
import byBY from '../by_BY';
import 'dayjs/locale/be';
import caES from '../ca_ES';
import 'dayjs/locale/ca';
import csCZ from '../cs_CZ';
import 'dayjs/locale/cs';
import deDE from '../de_DE';
import 'dayjs/locale/de';
import daDK from '../da_DK';
import 'dayjs/locale/da';
import deDE from '../de_DE';
import elGR from '../el_GR';
import 'dayjs/locale/el';
import enGB from '../en_GB';
import 'dayjs/locale/en-gb';
import enUS from '../en_US';
import 'dayjs/locale/en';
import esES from '../es_ES';
import 'dayjs/locale/es';
import etEE from '../et_EE';
import 'dayjs/locale/et';
import faIR from '../fa_IR';
import 'dayjs/locale/fa';
import fiFI from '../fi_FI';
import 'dayjs/locale/fi';
import frBE from '../fr_BE';
import frCA from '../fr_CA';
import 'dayjs/locale/fr-ca';
import frFR from '../fr_FR';
import 'dayjs/locale/fr';
import gaIE from '../ga_IE';
import 'dayjs/locale/ga';
import glES from '../gl_ES';
import 'dayjs/locale/gl';
import heIL from '../he_IL';
import 'dayjs/locale/he';
import hiIN from '../hi_IN';
import 'dayjs/locale/hi';
import hrHR from '../hr_HR';
import 'dayjs/locale/hr';
import huHU from '../hu_HU';
import 'dayjs/locale/hu';
import hyAM from '../hy_AM';
import 'dayjs/locale/hy-am';
import idID from '../id_ID';
import 'dayjs/locale/id';
import isIS from '../is_IS';
import 'dayjs/locale/is';
import itIT from '../it_IT';
import 'dayjs/locale/it';
import jaJP from '../ja_JP';
import 'dayjs/locale/ja';
import kaGE from '../ka_GE';
import 'dayjs/locale/ka';
import kkKZ from '../kk_KZ';
import 'dayjs/locale/kk';
import knIN from '../kn_IN';
import 'dayjs/locale/kn';
import koKR from '../ko_KR';
import 'dayjs/locale/ko';
import kmKH from '../km_KH';
import 'dayjs/locale/km';
import kmrIQ from '../kmr_IQ';
import kmKH from '../km_KH';
import knIN from '../kn_IN';
import koKR from '../ko_KR';
import kuIQ from '../ku_IQ';
import 'dayjs/locale/ku';
import lvLV from '../lv_LV';
import 'dayjs/locale/lv';
import ltLT from '../lt_LT';
import 'dayjs/locale/lt';
import lvLV from '../lv_LV';
import mkMK from '../mk_MK';
import 'dayjs/locale/mk';
import mlIN from '../ml_IN';
import 'dayjs/locale/ml';
import mnMN from '../mn_MN';
import 'dayjs/locale/mn';
import msMY from '../ms_MY';
import 'dayjs/locale/ms';
import nbNO from '../nb_NO';
import 'dayjs/locale/nb';
import neNP from '../ne_NP';
import 'dayjs/locale/ne';
import nlBE from '../nl_BE';
import 'dayjs/locale/nl-be';
import nlNL from '../nl_NL';
import 'dayjs/locale/nl';
import plPL from '../pl_PL';
import 'dayjs/locale/pl';
import ptBR from '../pt_BR';
import 'dayjs/locale/pt-br';
import ptPT from '../pt_PT';
import 'dayjs/locale/pt';
import roRO from '../ro_RO';
import 'dayjs/locale/ro';
import ruRU from '../ru_RU';
import 'dayjs/locale/ru';
import skSK from '../sk_SK';
import 'dayjs/locale/sk';
import slSI from '../sl_SI';
import 'dayjs/locale/sl';
import srRS from '../sr_RS';
import 'dayjs/locale/sr';
import svSE from '../sv_SE';
import 'dayjs/locale/sv';
import taIN from '../ta_IN';
import 'dayjs/locale/ta';
import thTH from '../th_TH';
import 'dayjs/locale/th';
import tkTK from '../tk_TK';
import trTR from '../tr_TR';
import 'dayjs/locale/tr';
import ukUA from '../uk_UA';
import 'dayjs/locale/uk';
import viVN from '../vi_VN';
import 'dayjs/locale/vi';
import zhCN from '../zh_CN';
import 'dayjs/locale/zh-cn';
import zhHK from '../zh_HK';
import 'dayjs/locale/zh-hk';
import zhTW from '../zh_TW';
import 'dayjs/locale/zh-tw';
import urPK from '../ur_PK';
import 'dayjs/locale/ur';
import viVN from '../vi_VN';
import zhCN from '../zh_CN';
import zhHK from '../zh_HK';
import zhTW from '../zh_TW';
dayjs.extend(preParsePostFormat);
@ -206,6 +208,7 @@ const locales = [
taIN,
thTH,
trTR,
tkTK,
ukUA,
viVN,
idID,

View File

@ -0,0 +1,3 @@
import locale from '../locale/tk_TK';
export default locale;

132
components/locale/tk_TK.tsx Normal file
View File

@ -0,0 +1,132 @@
/* eslint-disable no-template-curly-in-string */
import Pagination from 'rc-pagination/lib/locale/tk_TK';
import Calendar from '../calendar/locale/tk_TK';
import DatePicker from '../date-picker/locale/tk_TK';
import type { Locale } from '../locale-provider';
import TimePicker from '../time-picker/locale/tk_TK';
const typeTemplate: string = '${label} ${type} görnüşinde däl';
const localeValues: Locale = {
locale: 'tk',
Pagination,
DatePicker,
TimePicker,
Calendar,
global: {
placeholder: 'Saýlaň',
},
Table: {
filterTitle: 'Filter',
filterConfirm: 'Bolýar',
filterReset: 'Arassala',
filterEmptyText: 'Filtersiz',
emptyText: 'Maglumat ýok',
selectAll: 'Ählisini saýla',
selectInvert: 'Tersini saýlaň',
selectNone: 'Ähli maglumatlary arassala',
selectionAll: 'Ähli maglumatlary saýla',
sortTitle: 'Tertiple',
expand: 'Setirleri aç',
collapse: 'Setirleri ýygna',
triggerDesc: 'Kemelýän tertipde tertiple',
triggerAsc: 'Artýan tertipde tertiple',
cancelSort: 'Tertipleri arassala',
},
Modal: {
okText: 'Bolýar',
cancelText: 'Ýatyr',
justOkText: 'Bolýar',
},
Popconfirm: {
okText: 'Bolýar',
cancelText: 'Ýatyr',
},
Transfer: {
titles: ['', ''],
searchPlaceholder: 'Gözle',
itemUnit: 'elem.',
itemsUnit: 'elem.',
remove: 'Poz',
selectAll: 'Ähli maglumatlary saýla',
selectCurrent: 'Şu sahypany saýlaň',
selectInvert: 'Ters tertipde görkez',
removeAll: 'Ähli maglumatlary poz',
removeCurrent: 'Şu sahypany poz',
},
Upload: {
uploading: 'Ugradylýar...',
removeFile: 'Faýly poz',
uploadError: 'Ugratmakda näsazlyk ýüze çykdy',
previewFile: 'Faýly görmek',
downloadFile: 'Faýly ýükle',
},
Empty: {
description: 'Maglumat ýok',
},
Icon: {
icon: 'nyşan',
},
Text: {
edit: 'Üýtgetmek',
copy: 'Göçürmek',
copied: 'Göçürildi',
expand: 'Ýygnamak',
},
PageHeader: {
back: 'Yza',
},
Form: {
defaultValidateMessages: {
default: '${label} meýdany barlanmady',
required: '${label} meýdany giriziň',
enum: '${label} meýdan şulardan biri bolmaly: [${enum}]',
whitespace: '${label} meýdany boş bolup bilmeýär',
date: {
format: '${label} ýalňyş wagt formaty',
parse: '${label} meýdany wagta çalşyp bolmady',
invalid: '${label} meýdany nädogry wagt',
},
types: {
string: typeTemplate,
method: typeTemplate,
array: typeTemplate,
object: typeTemplate,
number: typeTemplate,
date: typeTemplate,
boolean: typeTemplate,
integer: typeTemplate,
float: typeTemplate,
regexp: typeTemplate,
email: typeTemplate,
url: typeTemplate,
hex: typeTemplate,
},
string: {
len: '${label} meýdany ${len} simwol bolmaly',
min: '${label} meýdany ${min} simwoldan az bolmaly däl',
max: '${label} meýdany ${max} simwoldan köp bolmaly däl',
range: '${label} meýdany ${min}-${max} simwol aralygynda bolmaly',
},
number: {
len: '${label} meýdan ${len} simwol bolmaly',
min: '${label} meýdany ${min} simwoldan az bolmaly däl',
max: '${label} meýdany ${max} simwoldan köp bolmaly däl',
},
array: {
len: '${label} meýdanynyň elementleriniň sany ${len} deň bolmaly',
min: '${label} meýdanynyň elementleriniň sany ${min} az bolmaly däl',
max: '${label} meýdanynyň elementleriniň sany ${max} köp bolmaly däl',
range: '${label} meýdanynyň elementleriniň sany ${min} we ${max} aralykda bolmaly',
},
pattern: {
mismatch: '${label} meýdany ${pattern} şablony bilen gabat gelmeýär',
},
},
},
Image: {
preview: 'Öňünden görmek',
},
};
export default localeValues;

View File

@ -1,21 +1,20 @@
import * as React from 'react';
import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';
import classNames from 'classnames';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';
import KeyCode from 'rc-util/lib/KeyCode';
import type { AbstractTooltipProps } from '../tooltip';
import Tooltip from '../tooltip';
import * as React from 'react';
import Button from '../button';
import type { LegacyButtonType, ButtonProps } from '../button/button';
import type { ButtonProps, LegacyButtonType } from '../button/button';
import { convertLegacyProps } from '../button/button';
import { ConfigContext } from '../config-provider';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale/default';
import { ConfigContext } from '../config-provider';
import Popover from '../popover';
import type { AbstractTooltipProps } from '../tooltip';
import ActionButton from '../_util/ActionButton';
import type { RenderFunction } from '../_util/getRenderPropValue';
import { getRenderPropValue } from '../_util/getRenderPropValue';
import { cloneElement } from '../_util/reactNode';
import { getTransitionName } from '../_util/motion';
import ActionButton from '../_util/ActionButton';
export interface PopconfirmProps extends AbstractTooltipProps {
title: React.ReactNode | RenderFunction;
@ -140,19 +139,17 @@ const Popconfirm = React.forwardRef<unknown, PopconfirmProps>((props, ref) => {
{(popconfirmLocale: PopconfirmLocale) => renderOverlay(prefixCls, popconfirmLocale)}
</LocaleReceiver>
);
const rootPrefixCls = getPrefixCls();
return (
<Tooltip
<Popover
{...restProps}
prefixCls={prefixCls}
placement={placement}
onVisibleChange={onVisibleChange}
visible={visible}
overlay={overlay}
_overlay={overlay}
overlayClassName={overlayClassNames}
ref={ref as any}
transitionName={getTransitionName(rootPrefixCls, 'zoom-big', props.transitionName)}
>
{cloneElement(children, {
onKeyDown: (e: React.KeyboardEvent<any>) => {
@ -162,7 +159,7 @@ const Popconfirm = React.forwardRef<unknown, PopconfirmProps>((props, ref) => {
onKeyDown(e);
},
})}
</Tooltip>
</Popover>
);
});

View File

@ -1,22 +1,26 @@
import * as React from 'react';
import classNames from 'classnames';
import * as React from 'react';
import { ConfigContext } from '../config-provider';
import type { AbstractTooltipProps, TooltipPlacement } from '../tooltip';
import Tooltip from '../tooltip';
import { ConfigContext } from '../config-provider';
import type { RenderFunction } from '../_util/getRenderPropValue';
import { getRenderPropValue } from '../_util/getRenderPropValue';
import { getTransitionName } from '../_util/motion';
// CSSINJS
import useStyle from './style';
export interface PopoverProps extends AbstractTooltipProps {
title?: React.ReactNode | RenderFunction;
content?: React.ReactNode | RenderFunction;
/** @private Used for Popconfirm. Safe to remove. */
_overlay?: React.ReactNode;
}
const Popover = React.forwardRef<unknown, PopoverProps>(
({ prefixCls: customizePrefixCls, title, content, overlayClassName, ...otherProps }, ref) => {
(
{ prefixCls: customizePrefixCls, title, content, overlayClassName, _overlay, ...otherProps },
ref,
) => {
const { getPrefixCls } = React.useContext(ConfigContext);
const getOverlay = (prefixCls: string) => {
@ -41,7 +45,7 @@ const Popover = React.forwardRef<unknown, PopoverProps>(
prefixCls={prefixCls}
overlayClassName={overlayCls}
ref={ref as any}
overlay={getOverlay(prefixCls)}
overlay={_overlay || getOverlay(prefixCls)}
transitionName={getTransitionName(rootPrefixCls, 'zoom-big', otherProps.transitionName)}
/>,
);

View File

@ -1,11 +1,11 @@
import { mount } from 'enzyme';
import React from 'react';
import { act } from 'react-dom/test-utils';
import { mount } from 'enzyme';
import Table from '..';
import Checkbox from '../../checkbox';
import { resetWarned } from '../../_util/warning';
import ConfigProvider from '../../config-provider';
import { render } from '../../../tests/utils';
import Checkbox from '../../checkbox';
import ConfigProvider from '../../config-provider';
import { resetWarned } from '../../_util/warning';
describe('Table.rowSelection', () => {
window.requestAnimationFrame = callback => window.setTimeout(callback, 16);
@ -217,7 +217,9 @@ describe('Table.rowSelection', () => {
.last()
.simulate('change', { target: { checked: true } });
expect(handleChange).toHaveBeenCalledWith([3], [{ key: 3, name: 'Jerry' }]);
expect(handleChange).toHaveBeenCalledWith([3], [{ key: 3, name: 'Jerry' }], {
type: 'single',
});
expect(handleSelect.mock.calls.length).toBe(1);
expect(handleSelect.mock.calls[0][0]).toEqual({ key: 3, name: 'Jerry' });
expect(handleSelect.mock.calls[0][1]).toEqual(true);
@ -252,6 +254,9 @@ describe('Table.rowSelection', () => {
nativeEvent: { shiftKey: true },
});
expect(handleSelect).toHaveBeenCalled();
expect(handleChange).toHaveBeenLastCalledWith([0], [{ key: 0, name: 'Jack' }], {
type: 'single',
});
wrapper
.find('input')
@ -265,6 +270,15 @@ describe('Table.rowSelection', () => {
[data[0], data[1], data[2]],
[data[1], data[2]],
);
expect(handleChange).toHaveBeenLastCalledWith(
[0, 1, 2],
[
{ key: 0, name: 'Jack' },
{ key: 1, name: 'Lucy' },
{ key: 2, name: 'Tom' },
],
{ type: 'multiple' },
);
wrapper
.find('input')
@ -274,6 +288,7 @@ describe('Table.rowSelection', () => {
nativeEvent: { shiftKey: true },
});
expect(handleSelectMulti).toHaveBeenCalledWith(false, [], [data[0], data[1], data[2]]);
expect(handleChange).toHaveBeenLastCalledWith([], [], { type: 'multiple' });
expect(order).toEqual([
'onSelect',
@ -468,7 +483,7 @@ describe('Table.rowSelection', () => {
wrapper.find('Trigger').setState({ popupVisible: true });
wrapper.find('li.ant-dropdown-menu-item').first().simulate('click');
expect(onChange).toHaveBeenCalledWith([0, 2], expect.anything());
expect(onChange).toHaveBeenCalledWith([0, 2], expect.anything(), { type: 'all' });
});
it('SELECTION_INVERT', () => {
@ -488,7 +503,7 @@ describe('Table.rowSelection', () => {
wrapper.find('Trigger').setState({ popupVisible: true });
wrapper.find('li.ant-dropdown-menu-item').first().simulate('click');
expect(onChange).toHaveBeenCalledWith([0], expect.anything());
expect(onChange).toHaveBeenCalledWith([0], expect.anything(), { type: 'invert' });
});
it('SELECTION_NONE', () => {
@ -508,7 +523,7 @@ describe('Table.rowSelection', () => {
wrapper.find('Trigger').setState({ popupVisible: true });
wrapper.find('li.ant-dropdown-menu-item').first().simulate('click');
expect(onChange).toHaveBeenCalledWith([1], expect.anything());
expect(onChange).toHaveBeenCalledWith([1], expect.anything(), { type: 'none' });
});
});
@ -881,12 +896,14 @@ describe('Table.rowSelection', () => {
);
const checkboxes = wrapper.find('input');
checkboxes.at(2).simulate('change', { target: { checked: true } });
expect(onChange).toHaveBeenLastCalledWith([11], [newDatas[0].list[0]]);
expect(onChange).toHaveBeenLastCalledWith([11], [newDatas[0].list[0]], { type: 'single' });
onChange.mockReset();
checkboxes.at(1).simulate('change', { target: { checked: true } });
const item0 = newDatas[0];
expect(onChange).toHaveBeenLastCalledWith([11, 1], [newDatas[0].list[0], item0]);
expect(onChange).toHaveBeenLastCalledWith([11, 1], [newDatas[0].list[0], item0], {
type: 'single',
});
});
it('clear selection className when remove `rowSelection`', () => {
@ -1379,14 +1396,14 @@ describe('Table.rowSelection', () => {
.find('tbody input')
.first()
.simulate('change', { target: { checked: true } });
expect(onChange).toHaveBeenCalledWith(['light'], [{ name: 'light' }]);
expect(onChange).toHaveBeenCalledWith(['light'], [{ name: 'light' }], { type: 'single' });
wrapper.setProps({ dataSource: [{ name: 'bamboo' }] });
wrapper
.find('tbody input')
.first()
.simulate('change', { target: { checked: true } });
expect(onChange).toHaveBeenCalledWith(['bamboo'], [{ name: 'bamboo' }]);
expect(onChange).toHaveBeenCalledWith(['bamboo'], [{ name: 'bamboo' }], { type: 'single' });
});
it('cache with preserveSelectedRowKeys', () => {
@ -1403,7 +1420,7 @@ describe('Table.rowSelection', () => {
.find('tbody input')
.first()
.simulate('change', { target: { checked: true } });
expect(onChange).toHaveBeenCalledWith(['light'], [{ name: 'light' }]);
expect(onChange).toHaveBeenCalledWith(['light'], [{ name: 'light' }], { type: 'single' });
wrapper.setProps({ dataSource: [{ name: 'bamboo' }] });
wrapper
@ -1413,6 +1430,7 @@ describe('Table.rowSelection', () => {
expect(onChange).toHaveBeenCalledWith(
['light', 'bamboo'],
[{ name: 'light' }, { name: 'bamboo' }],
{ type: 'single' },
);
});
@ -1432,7 +1450,7 @@ describe('Table.rowSelection', () => {
.find('tbody input')
.first()
.simulate('change', { target: { checked: true } });
expect(onChange).toHaveBeenCalledWith(['Jack'], [{ name: 'Jack' }]);
expect(onChange).toHaveBeenCalledWith(['Jack'], [{ name: 'Jack' }], { type: 'single' });
});
it('works with selectionType radio receive selectedRowKeys from [] to undefined', () => {
@ -1451,7 +1469,7 @@ describe('Table.rowSelection', () => {
.find('tbody input')
.first()
.simulate('change', { target: { checked: true } });
expect(onChange).toHaveBeenCalledWith(['Jack'], [{ name: 'Jack' }]);
expect(onChange).toHaveBeenCalledWith(['Jack'], [{ name: 'Jack' }], { type: 'single' });
});
it('selectedRows ant selectedKeys should keep sync in initial state', () => {
@ -1484,7 +1502,11 @@ describe('Table.rowSelection', () => {
.find('tbody input')
.first()
.simulate('change', { target: { checked: true } });
expect(onChange).toHaveBeenCalledWith(['Jack', 'Lucy'], [{ name: 'Jack' }, { name: 'Lucy' }]);
expect(onChange).toHaveBeenCalledWith(
['Jack', 'Lucy'],
[{ name: 'Jack' }, { name: 'Lucy' }],
{ type: 'single' },
);
});
});
});

View File

@ -1,13 +1,13 @@
import * as React from 'react';
import { useState, useCallback, useMemo } from 'react';
import DownOutlined from '@ant-design/icons/DownOutlined';
import { convertDataToEntities } from 'rc-tree/lib/utils/treeUtil';
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
import { arrAdd, arrDel } from 'rc-tree/lib/util';
import type { DataNode, GetCheckDisabled } from 'rc-tree/lib/interface';
import { INTERNAL_COL_DEFINE } from 'rc-table';
import type { FixedType } from 'rc-table/lib/interface';
import type { DataNode, GetCheckDisabled } from 'rc-tree/lib/interface';
import { arrAdd, arrDel } from 'rc-tree/lib/util';
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
import { convertDataToEntities } from 'rc-tree/lib/utils/treeUtil';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import * as React from 'react';
import { useCallback, useMemo, useState } from 'react';
import type { CheckboxProps } from '../../checkbox';
import Checkbox from '../../checkbox';
import Dropdown from '../../dropdown';
@ -15,16 +15,17 @@ import Menu from '../../menu';
import Radio from '../../radio';
import warning from '../../_util/warning';
import type {
TableRowSelection,
Key,
ColumnsType,
ColumnType,
GetRowKey,
TableLocale,
SelectionItem,
TransformColumns,
ExpandType,
GetPopupContainer,
GetRowKey,
Key,
RowSelectMethod,
SelectionItem,
TableLocale,
TableRowSelection,
TransformColumns,
} from '../interface';
// TODO: warning if use ajax!!!
@ -218,7 +219,7 @@ export default function useSelection<RecordType>(
}, [!!rowSelection]);
const setSelectedKeys = useCallback(
(keys: Key[]) => {
(keys: Key[], method: RowSelectMethod) => {
let availableKeys: Key[];
let records: RecordType[];
@ -243,7 +244,7 @@ export default function useSelection<RecordType>(
setMergedSelectedKeys(availableKeys);
onSelectionChange?.(availableKeys, records);
onSelectionChange?.(availableKeys, records, { type: method });
},
[setMergedSelectedKeys, getRecordByKey, onSelectionChange, preserveSelectedRowKeys],
);
@ -257,7 +258,7 @@ export default function useSelection<RecordType>(
onSelect(getRecordByKey(key), selected, rows, event);
}
setSelectedKeys(keys);
setSelectedKeys(keys, 'single');
},
[onSelect, getRecordByKey, setSelectedKeys],
);
@ -283,6 +284,7 @@ export default function useSelection<RecordType>(
const checkProps = checkboxPropsMap.get(key);
return !checkProps?.disabled || derivedSelectedKeySet.has(key);
}),
'all',
);
},
};
@ -316,7 +318,7 @@ export default function useSelection<RecordType>(
onSelectInvert(keys);
}
setSelectedKeys(keys);
setSelectedKeys(keys, 'invert');
},
};
}
@ -331,6 +333,7 @@ export default function useSelection<RecordType>(
const checkProps = checkboxPropsMap.get(key);
return checkProps?.disabled;
}),
'none',
);
},
};
@ -389,7 +392,7 @@ export default function useSelection<RecordType>(
changeKeys.map(k => getRecordByKey(k)),
);
setSelectedKeys(keys);
setSelectedKeys(keys, 'all');
};
// ===================== Render =====================
@ -566,7 +569,7 @@ export default function useSelection<RecordType>(
changedKeys.map(recordKey => getRecordByKey(recordKey)),
);
setSelectedKeys(keys);
setSelectedKeys(keys, 'multiple');
} else {
// Single record selected
const originCheckedKeys = derivedSelectedKeys;

View File

@ -209,7 +209,7 @@ Properties for row selection.
| selectedRowKeys | Controlled selected row keys | string\[] \| number\[] | \[] | |
| selections | Custom selection [config](#selection), only displays default selections when set to `true` | object\[] \| boolean | - | |
| type | `checkbox` or `radio` | `checkbox` \| `radio` | `checkbox` | |
| onChange | Callback executed when selected rows change | function(selectedRowKeys, selectedRows) | - | |
| onChange | Callback executed when selected rows change | function(selectedRowKeys, selectedRows, info: { type }) | - | `info.type`: 4.21.0 |
| onSelect | Callback executed when select/deselect one row | function(record, selected, selectedRows, nativeEvent) | - | |
| onSelectAll | Callback executed when select/deselect all rows | function(selected, selectedRows, changeRows) | - | |
| onSelectInvert | Callback executed when row selection is inverted | function(selectedRowKeys) | - | |

View File

@ -211,7 +211,7 @@ const columns = [
| defaultSelectedRowKeys | 默认选中项的 key 数组 | string\[] \| number\[] | \[] | |
| selections | 自定义选择项 [配置项](#selection), 设为 `true` 时使用默认选择项 | object\[] \| boolean | true | |
| type | 多选/单选 | `checkbox` \| `radio` | `checkbox` | |
| onChange | 选中项发生变化时的回调 | function(selectedRowKeys, selectedRows) | - | |
| onChange | 选中项发生变化时的回调 | function(selectedRowKeys, selectedRows, info: { type }) | - | `info.type`: 4.21.0 |
| onSelect | 用户手动选择/取消选择某行的回调 | function(record, selected, selectedRows, nativeEvent) | - | |
| onSelectAll | 用户手动选择/取消选择所有行的回调 | function(selected, selectedRows, changeRows) | - | |
| onSelectInvert | 用户手动选择反选的回调 | function(selectedRowKeys) | - | |

View File

@ -1,16 +1,16 @@
import type * as React from 'react';
import type {
ColumnType as RcColumnType,
RenderedCell as RcRenderedCell,
FixedType,
RenderedCell as RcRenderedCell,
} from 'rc-table/lib/interface';
import { GetRowKey, ExpandableConfig } from 'rc-table/lib/interface';
import type { TooltipProps } from '../tooltip';
import { ExpandableConfig, GetRowKey } from 'rc-table/lib/interface';
import type * as React from 'react';
import type { CheckboxProps } from '../checkbox';
import type { PaginationProps } from '../pagination';
import type { TooltipProps } from '../tooltip';
import type { Breakpoint } from '../_util/responsiveObserve';
import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
import { tuple } from '../_util/type';
import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
// import { TableAction } from './Table';
export { GetRowKey, ExpandableConfig };
@ -144,13 +144,15 @@ export type SelectionSelectFn<T> = (
nativeEvent: Event,
) => void;
export type RowSelectMethod = 'all' | 'none' | 'invert' | 'single' | 'multiple';
export interface TableRowSelection<T> {
/** Keep the selection keys in list even the key not exist in `dataSource` anymore */
preserveSelectedRowKeys?: boolean;
type?: RowSelectionType;
selectedRowKeys?: Key[];
defaultSelectedRowKeys?: Key[];
onChange?: (selectedRowKeys: Key[], selectedRows: T[]) => void;
onChange?: (selectedRowKeys: Key[], selectedRows: T[], info: { type: RowSelectMethod }) => void;
getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>>;
onSelect?: SelectionSelectFn<T>;
/** @deprecated This function is deprecated and should use `onChange` instead */

View File

@ -0,0 +1,8 @@
import type { TimePickerLocale } from '../index';
const locale: TimePickerLocale = {
placeholder: 'Wagty saýlaň',
rangePlaceholder: ['Başlanýan wagty', 'Gutarýan wagty'],
};
export default locale;

View File

@ -88,6 +88,7 @@ The following languages are currently supported:
| Tamil | ta_IN |
| Thai | th_TH |
| Turkish | tr_TR |
| Turkmen | tk_TK |
| Urdu (Pakistan) | ur_PK |
| Ukrainian | uk_UA |
| Vietnamese | vi_VN |
@ -123,6 +124,6 @@ Do it step by step:
npm run test -- components/locale-provider -u
```
8. Add the language to i18n list [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.en-US.md) and [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.zh-CN.md).
8. Add the language to i18n list [docs/react/i18n.en-US.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.en-US.md) and [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.zh-CN.md).
9. Watch out the CI status, and if it failed, look at the logs and make some changes until it all passes.
10. Ok, now everything is ready for review.

View File

@ -85,6 +85,7 @@ return (
| 泰米尔语 | ta_IN |
| 泰语 | th_TH |
| 土耳其语 | tr_TR |
| 土库曼 | tk_TK |
| 乌尔都语 (巴基斯坦) | ur_PK |
| 乌克兰语 | uk_UA |
| 越南语 | vi_VN |

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "4.20.5",
"version": "4.20.6",
"description": "An enterprise-class UI design language and React components implementation",
"title": "Ant Design",
"keywords": [
@ -140,8 +140,8 @@
"rc-menu": "~9.6.0",
"rc-motion": "^2.5.1",
"rc-notification": "~5.0.0-alpha.8",
"rc-pagination": "~3.1.9",
"rc-picker": "~2.6.4",
"rc-pagination": "~3.1.16",
"rc-picker": "~2.6.8",
"rc-progress": "~3.3.2",
"rc-rate": "~2.9.0",
"rc-resize-observer": "^1.2.0",