Skip to content

Commit

Permalink
docs: mark deprecated for date-picker defaultPickerValue prop (ant-de…
Browse files Browse the repository at this point in the history
…sign#43781)

* docs: mark deprecated for date-picker defaultPickerValue prop

* docs: mark deprecated for date-picker defaultPickerValue prop

* docs: 删除 defaultPickerValue 属性

* chore: use defaultValue instead defaultPickerValue

---------

Co-authored-by: zbw01218944 <zbw01218944@alibaba-inc.com>
  • Loading branch information
zbw-zbw and zbw01218944 authored Sep 7, 2023
1 parent a41a756 commit c28e1ff
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 25 deletions.
4 changes: 2 additions & 2 deletions components/date-picker/__tests__/DatePicker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ describe('DatePicker', () => {
).toBe(60);
});

it('DatePicker.RangePicker with defaultPickerValue and showTime', () => {
it('DatePicker.RangePicker with defaultValue and showTime', () => {
const startDate = dayjs('1982-02-12');
const endDate = dayjs('1982-02-22');

const { container } = render(
<DatePicker.RangePicker defaultPickerValue={[startDate, endDate]} showTime open />,
<DatePicker.RangePicker defaultValue={[startDate, endDate]} showTime open />,
);

const m = container.querySelector('.ant-picker-header-view .ant-picker-month-btn')?.innerHTML;
Expand Down
10 changes: 4 additions & 6 deletions components/date-picker/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ If there are special needs (only modifying single component language), Please us

```jsx
import locale from 'antd/es/date-picker/locale/zh_CN';

import 'dayjs/locale/zh-cn';

<DatePicker locale={locale} />;
Expand All @@ -67,6 +68,7 @@ import 'dayjs/locale/zh-cn';
// The default locale is en-US, if you want to use other locale, just set locale in entry file globally.
import locale from 'antd/locale/zh_CN';
import dayjs from 'dayjs';

import 'dayjs/locale/zh-cn';

<ConfigProvider locale={locale}>
Expand Down Expand Up @@ -124,7 +126,6 @@ The following APIs are shared by DatePicker, RangePicker.

| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| defaultPickerValue | To set default picker date | [dayjs](https://day.js.org/) | - | |
| defaultValue | To set default date, if start time or end time is null or undefined, the date range will be an open interval | [dayjs](https://day.js.org/) | - | |
| disabledTime | To specify the time that cannot be selected | function(date) | - | |
| format | To set the date format. refer to [dayjs#format](https://day.js.org/docs/en/display/format) | [formatType](#formattype) | `YYYY-MM-DD` | |
Expand All @@ -142,7 +143,6 @@ The following APIs are shared by DatePicker, RangePicker.

| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| defaultPickerValue | To set default picker date | [dayjs](https://day.js.org/) | - | |
| defaultValue | To set default date | [dayjs](https://day.js.org/) | - | |
| format | To set the date format. refer to [dayjs#format](https://day.js.org/docs/en/display/format) | [formatType](#formattype) | `YYYY` | |
| renderExtraFooter | Render extra footer in panel | () => React.ReactNode | - | |
Expand All @@ -155,7 +155,6 @@ Added in `4.1.0`.

| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| defaultPickerValue | To set default picker date | [dayjs](https://day.js.org/) | - | |
| defaultValue | To set default date | [dayjs](https://day.js.org/) | - | |
| format | To set the date format. refer to [dayjs#format](https://day.js.org/docs/en/display/format) | [formatType](#formattype) | `YYYY-\QQ` | |
| renderExtraFooter | Render extra footer in panel | () => React.ReactNode | - | |
Expand All @@ -166,7 +165,6 @@ Added in `4.1.0`.

| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| defaultPickerValue | To set default picker date | [dayjs](https://day.js.org/) | - | |
| defaultValue | To set default date | [dayjs](https://day.js.org/) | - | |
| format | To set the date format. refer to [dayjs#format](https://day.js.org/docs/en/display/format) | [formatType](#formattype) | `YYYY-MM` | |
| renderExtraFooter | Render extra footer in panel | () => React.ReactNode | - | |
Expand All @@ -177,7 +175,6 @@ Added in `4.1.0`.

| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| defaultPickerValue | To set default picker date | [dayjs](https://day.js.org/) | - | |
| defaultValue | To set default date | [dayjs](https://day.js.org/) | - | |
| format | To set the date format. refer to [dayjs#format](https://day.js.org/docs/en/display/format) | [formatType](#formattype) | `YYYY-wo` | |
| renderExtraFooter | Render extra footer in panel | (mode) => React.ReactNode | - | |
Expand All @@ -191,7 +188,6 @@ Added in `4.1.0`.
| allowEmpty | Allow start or end input leave empty | \[boolean, boolean] | \[false, false] | |
| dateRender | Custom rendering function for date cells, >= 5.4.0 use `cellRender` instead. | function(currentDate: dayjs, today: dayjs) => React.ReactNode | - | < 5.4.0 |
| cellRender | Custom rendering function for picker cells | (current: dayjs, info: { originNode: React.ReactElement,today: DateType, range?: 'start' \| 'end', type: PanelMode, locale?: Locale, subType?: 'hour' \| 'minute' \| 'second' \| 'meridiem' }) => React.ReactNode | - | 5.4.0 |
| defaultPickerValue | To set default picker date | \[[dayjs](https://day.js.org/), [dayjs](https://day.js.org/)] | - | |
| defaultValue | To set default date | \[[dayjs](https://day.js.org/), [dayjs](https://day.js.org/)] | - | |
| disabled | If disable start or end | \[boolean, boolean] | - | |
| disabledTime | To specify the time that cannot be selected | function(date: dayjs, partial: `start` \| `end`) | - | |
Expand Down Expand Up @@ -250,7 +246,9 @@ Please use correct [language](/docs/react/i18n) ([#5605](https://github.com/ant-

```js
import dayjs from 'dayjs';

import 'dayjs/locale/zh-cn';

import updateLocale from 'dayjs/plugin/updateLocale';

dayjs.extend(updateLocale);
Expand Down
6 changes: 0 additions & 6 deletions components/date-picker/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ import 'dayjs/locale/zh-cn';

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| defaultPickerValue | 默认面板日期 | [dayjs](https://day.js.org/) | - | |
| defaultValue | 默认日期,如果开始时间或结束时间为 `null` 或者 `undefined`,日期范围将是一个开区间 | [dayjs](https://day.js.org/) | - | |
| disabledTime | 不可选择的时间 | function(date) | - | |
| format | 展示的日期格式,配置参考 [dayjs#format](https://day.js.org/docs/zh-CN/display/format#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%8D%A0%E4%BD%8D%E7%AC%A6%E5%88%97%E8%A1%A8)| [formatType](#formattype) | `YYYY-MM-DD` | |
Expand All @@ -145,7 +144,6 @@ import 'dayjs/locale/zh-cn';

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| defaultPickerValue | 默认面板日期 | [dayjs](https://day.js.org/) | - | |
| defaultValue | 默认日期 | [dayjs](https://day.js.org/) | - | |
| format | 展示的日期格式,配置参考 [dayjs#format](https://day.js.org/docs/zh-CN/display/format#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%8D%A0%E4%BD%8D%E7%AC%A6%E5%88%97%E8%A1%A8)| [formatType](#formattype) | `YYYY` | |
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |
Expand All @@ -158,7 +156,6 @@ import 'dayjs/locale/zh-cn';

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| defaultPickerValue | 默认面板日期 | [dayjs](https://day.js.org/) | - | |
| defaultValue | 默认日期 | [dayjs](https://day.js.org/) | - | |
| format | 展示的日期格式,配置参考 [dayjs#format](https://day.js.org/docs/zh-CN/display/format#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%8D%A0%E4%BD%8D%E7%AC%A6%E5%88%97%E8%A1%A8)| [formatType](#formattype) | `YYYY-\QQ` | |
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |
Expand All @@ -169,7 +166,6 @@ import 'dayjs/locale/zh-cn';

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| defaultPickerValue | 默认面板日期 | [dayjs](https://day.js.org/) | - | |
| defaultValue | 默认日期 | [dayjs](https://day.js.org/) | - | |
| format | 展示的日期格式,配置参考 [dayjs#format](https://day.js.org/docs/zh-CN/display/format#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%8D%A0%E4%BD%8D%E7%AC%A6%E5%88%97%E8%A1%A8)| [formatType](#formattype) | `YYYY-MM` | |
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |
Expand All @@ -180,7 +176,6 @@ import 'dayjs/locale/zh-cn';

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| defaultPickerValue | 默认面板日期 | [dayjs](https://day.js.org/) | - | |
| defaultValue | 默认日期 | [dayjs](https://day.js.org/) | - | |
| format | 展示的日期格式,配置参考 [dayjs#format](https://day.js.org/docs/zh-CN/display/format#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%8D%A0%E4%BD%8D%E7%AC%A6%E5%88%97%E8%A1%A8)| [formatType](#formattype) | `YYYY-wo` | |
| renderExtraFooter | 在面板中添加额外的页脚 | (mode) => React.ReactNode | - | |
Expand All @@ -194,7 +189,6 @@ import 'dayjs/locale/zh-cn';
| allowEmpty | 允许起始项部分为空 | \[boolean, boolean] | \[false, false] | |
| dateRender | 自定义日期单元格的内容,5.4.0 起用 `cellRender` 代替 | function(currentDate: dayjs, today: dayjs) => React.ReactNode | - | < 5.4.0 |
| cellRender | 自定义单元格的内容。 | (current: dayjs, info: { originNode: React.ReactElement,today: DateType, range?: 'start' \| 'end', type: PanelMode, locale?: Locale, subType?: 'hour' \| 'minute' \| 'second' \| 'meridiem' }) => React.ReactNode | - | 5.4.0 |
| defaultPickerValue | 默认面板日期 | [dayjs](https://day.js.org/)\[] | - | |
| defaultValue | 默认日期 | [dayjs](https://day.js.org/)\[] | - | |
| disabled | 禁用起始项 | \[boolean, boolean] | - | |
| disabledTime | 不可选择的时间 | function(date: dayjs, partial: `start` \| `end`) | - | |
Expand Down
8 changes: 4 additions & 4 deletions components/divider/demo/component-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ const App: React.FC = () => (
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista
probare, quae sunt a te dicta? Refert tamen, quo modo.
</p>
<Divider orientation='left'>Left Text</Divider>
<Divider orientation="left">Left Text</Divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista
probare, quae sunt a te dicta? Refert tamen, quo modo.
</p>
<Divider orientation='right'>Right Text</Divider>
<Divider orientation="right">Right Text</Divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista
probare, quae sunt a te dicta? Refert tamen, quo modo.
</p>
<Divider orientation='left' orientationMargin='0'>
<Divider orientation="left" orientationMargin="0">
Left Text with 0 orientationMargin
</Divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista
probare, quae sunt a te dicta? Refert tamen, quo modo.
</p>
<Divider orientation='right' orientationMargin={50}>
<Divider orientation="right" orientationMargin={50}>
Right Text with 50px orientationMargin
</Divider>
<p>
Expand Down
2 changes: 1 addition & 1 deletion components/table/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ Properties for row selection.
## Using in TypeScript

```tsx
import React from 'react';
import { Table } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import React from 'react';

interface User {
key: number;
Expand Down
12 changes: 6 additions & 6 deletions components/transfer/__tests__/search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ describe('Transfer.Search', () => {
const filterOption = jest.fn();

const { container } = testLibRender(
<Transfer
filterOption={filterOption}
dataSource={dataSource}
<Transfer
filterOption={filterOption}
dataSource={dataSource}
targetKeys={['b']}
showSearch
showSearch
/>,
);

fireEvent.change(
container
?.querySelectorAll('.ant-transfer-list')
?.item(0)
?.querySelector('input[type="text"]')!,
?.querySelector('input[type="text"]')!,
{ target: { value: 'a' } },
);
expect(filterOption).toHaveBeenNthCalledWith(
Expand All @@ -121,7 +121,7 @@ describe('Transfer.Search', () => {
container
?.querySelectorAll('.ant-transfer-list')
?.item(1)
?.querySelector('input[type="text"]')!,
?.querySelector('input[type="text"]')!,
{ target: { value: 'b' } },
);
expect(filterOption).toHaveBeenCalledWith(
Expand Down

0 comments on commit c28e1ff

Please sign in to comment.