Merge pull request #49145 from ant-design/master

chore: feature merge master
This commit is contained in:
afc163 2024-05-31 12:20:03 +08:00 committed by GitHub
commit 38050d6ada
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 88 additions and 95 deletions

View File

@ -4,9 +4,6 @@ name: ✅ test
on: [push, pull_request]
env:
TZ: Asia/Shanghai
# Cancel prev CI if new commit come
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

View File

@ -7,9 +7,6 @@ on:
branches: [master, feature]
types: [opened, synchronize, reopened]
env:
TZ: Asia/Shanghai
# Cancel prev CI if new commit come
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

View File

@ -42,12 +42,12 @@ const AnchorLink: React.FC<AnchorLinkProps> = (props) => {
}, [href]);
const handleClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
onClick?.(e, { title, href });
scrollTo?.(href);
if (replace) {
e.preventDefault();
window.location.replace(href);
}
onClick?.(e, { title, href });
scrollTo?.(href);
};
// =================== Warning =====================

View File

@ -46,8 +46,8 @@ demo:
| allowClear | 支持清除 | boolean \| { clearIcon?: ReactNode } | false | 5.8.0: 支持对象形式 |
| autoFocus | 自动获取焦点 | boolean | false | |
| backfill | 使用键盘选择选项的时候把选中项回填到输入框中 | boolean | false | |
| children (自动完成的数据源) | 自动完成的数据源 | React.ReactElement&lt;OptionProps> \| Array&lt;React.ReactElement&lt;OptionProps>> | - | |
| children (自定义输入框) | 自定义输入框 | HTMLInputElement \| HTMLTextAreaElement \| React.ReactElement&lt;InputProps> | &lt;Input /> | |
| children (自动完成的数据源) | 自动完成的数据源,不能和自定义输入框同时配置 | React.ReactElement&lt;OptionProps> \| Array&lt;React.ReactElement&lt;OptionProps>> | - | |
| children (自定义输入框) | 自定义输入框,不能和自动完成的数据源同时配置 | HTMLInputElement \| HTMLTextAreaElement \| React.ReactElement&lt;InputProps> | &lt;Input /> | |
| defaultActiveFirstOption | 是否默认高亮第一个选项 | boolean | true | |
| defaultOpen | 是否默认展开下拉菜单 | boolean | - | |
| defaultValue | 指定默认选中的条目 | string | - | |

View File

@ -1,11 +1,9 @@
import * as React from 'react';
export type DisabledType = boolean | undefined;
const DisabledContext = React.createContext<DisabledType>(false);
const DisabledContext = React.createContext<boolean>(false);
export interface DisabledContextProps {
disabled?: DisabledType;
disabled?: boolean;
children?: React.ReactNode;
}

View File

@ -7459,7 +7459,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
id="getValueProps_date"
placeholder="Select date"
size="12"
value="2024-05-11"
value="2024-01-01"
/>
<span
class="ant-picker-suffix"
@ -7560,7 +7560,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
tabindex="-1"
type="button"
>
May
Jan
</button>
<button
class="ant-picker-year-btn"
@ -7624,37 +7624,17 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
<tr>
<td
class="ant-picker-cell"
title="2024-04-28"
title="2023-12-31"
>
<div
class="ant-picker-cell-inner"
>
28
31
</div>
</td>
<td
class="ant-picker-cell"
title="2024-04-29"
>
<div
class="ant-picker-cell-inner"
>
29
</div>
</td>
<td
class="ant-picker-cell"
title="2024-04-30"
>
<div
class="ant-picker-cell-inner"
>
30
</div>
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-01"
class="ant-picker-cell ant-picker-cell-hover ant-picker-cell-selected ant-picker-cell-in-view"
title="2024-01-01"
>
<div
class="ant-picker-cell-inner"
@ -7664,7 +7644,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-02"
title="2024-01-02"
>
<div
class="ant-picker-cell-inner"
@ -7674,7 +7654,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-03"
title="2024-01-03"
>
<div
class="ant-picker-cell-inner"
@ -7684,7 +7664,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-04"
title="2024-01-04"
>
<div
class="ant-picker-cell-inner"
@ -7692,11 +7672,9 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
4
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-05"
title="2024-01-05"
>
<div
class="ant-picker-cell-inner"
@ -7706,7 +7684,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-06"
title="2024-01-06"
>
<div
class="ant-picker-cell-inner"
@ -7714,9 +7692,11 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
6
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-07"
title="2024-01-07"
>
<div
class="ant-picker-cell-inner"
@ -7726,7 +7706,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-08"
title="2024-01-08"
>
<div
class="ant-picker-cell-inner"
@ -7736,7 +7716,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-09"
title="2024-01-09"
>
<div
class="ant-picker-cell-inner"
@ -7746,7 +7726,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-10"
title="2024-01-10"
>
<div
class="ant-picker-cell-inner"
@ -7755,8 +7735,8 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</div>
</td>
<td
class="ant-picker-cell ant-picker-cell-hover ant-picker-cell-selected ant-picker-cell-in-view"
title="2024-05-11"
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-01-11"
>
<div
class="ant-picker-cell-inner"
@ -7764,11 +7744,9 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
11
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-12"
title="2024-01-12"
>
<div
class="ant-picker-cell-inner"
@ -7778,7 +7756,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-13"
title="2024-01-13"
>
<div
class="ant-picker-cell-inner"
@ -7786,9 +7764,11 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
13
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-14"
title="2024-01-14"
>
<div
class="ant-picker-cell-inner"
@ -7798,7 +7778,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-15"
title="2024-01-15"
>
<div
class="ant-picker-cell-inner"
@ -7808,7 +7788,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-16"
title="2024-01-16"
>
<div
class="ant-picker-cell-inner"
@ -7818,7 +7798,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-17"
title="2024-01-17"
>
<div
class="ant-picker-cell-inner"
@ -7828,7 +7808,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-18"
title="2024-01-18"
>
<div
class="ant-picker-cell-inner"
@ -7836,11 +7816,9 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
18
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-19"
title="2024-01-19"
>
<div
class="ant-picker-cell-inner"
@ -7850,7 +7828,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-20"
title="2024-01-20"
>
<div
class="ant-picker-cell-inner"
@ -7858,9 +7836,11 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
20
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-21"
title="2024-01-21"
>
<div
class="ant-picker-cell-inner"
@ -7870,7 +7850,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-22"
title="2024-01-22"
>
<div
class="ant-picker-cell-inner"
@ -7880,7 +7860,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-23"
title="2024-01-23"
>
<div
class="ant-picker-cell-inner"
@ -7890,7 +7870,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-24"
title="2024-01-24"
>
<div
class="ant-picker-cell-inner"
@ -7900,7 +7880,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-25"
title="2024-01-25"
>
<div
class="ant-picker-cell-inner"
@ -7908,11 +7888,9 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
25
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-26"
title="2024-01-26"
>
<div
class="ant-picker-cell-inner"
@ -7922,7 +7900,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-27"
title="2024-01-27"
>
<div
class="ant-picker-cell-inner"
@ -7930,9 +7908,11 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
27
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-28"
title="2024-01-28"
>
<div
class="ant-picker-cell-inner"
@ -7942,7 +7922,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-29"
title="2024-01-29"
>
<div
class="ant-picker-cell-inner"
@ -7952,7 +7932,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-30"
title="2024-01-30"
>
<div
class="ant-picker-cell-inner"
@ -7962,7 +7942,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2024-05-31"
title="2024-01-31"
>
<div
class="ant-picker-cell-inner"
@ -7972,7 +7952,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell"
title="2024-06-01"
title="2024-02-01"
>
<div
class="ant-picker-cell-inner"
@ -7980,11 +7960,9 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
1
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell"
title="2024-06-02"
title="2024-02-02"
>
<div
class="ant-picker-cell-inner"
@ -7994,7 +7972,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell"
title="2024-06-03"
title="2024-02-03"
>
<div
class="ant-picker-cell-inner"
@ -8002,9 +7980,11 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
3
</div>
</td>
</tr>
<tr>
<td
class="ant-picker-cell"
title="2024-06-04"
title="2024-02-04"
>
<div
class="ant-picker-cell-inner"
@ -8014,7 +7994,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell"
title="2024-06-05"
title="2024-02-05"
>
<div
class="ant-picker-cell-inner"
@ -8024,7 +8004,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell"
title="2024-06-06"
title="2024-02-06"
>
<div
class="ant-picker-cell-inner"
@ -8034,7 +8014,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell"
title="2024-06-07"
title="2024-02-07"
>
<div
class="ant-picker-cell-inner"
@ -8044,7 +8024,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
</td>
<td
class="ant-picker-cell"
title="2024-06-08"
title="2024-02-08"
>
<div
class="ant-picker-cell-inner"
@ -8052,6 +8032,26 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx extend context
8
</div>
</td>
<td
class="ant-picker-cell"
title="2024-02-09"
>
<div
class="ant-picker-cell-inner"
>
9
</div>
</td>
<td
class="ant-picker-cell"
title="2024-02-10"
>
<div
class="ant-picker-cell-inner"
>
10
</div>
</td>
</tr>
</tbody>
</table>

View File

@ -4386,7 +4386,7 @@ exports[`renders components/form/demo/getValueProps-normalize.tsx correctly 1`]
id="getValueProps_date"
placeholder="Select date"
size="12"
value="2024-05-11"
value="2024-01-01"
/>
<span
class="ant-picker-suffix"

View File

@ -3,6 +3,8 @@ import type { FormProps } from 'antd';
import { Button, DatePicker, Form } from 'antd';
import dayjs from 'dayjs';
const dateTimestamp = dayjs('2024-01-01').valueOf();
type FieldType = {
date?: string;
};
@ -17,7 +19,7 @@ const App: React.FC = () => (
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
style={{ maxWidth: 600 }}
initialValues={{ date: '1715356800000' }}
initialValues={{ date: dateTimestamp }}
onFinish={onFinish}
autoComplete="off"
>

View File

@ -2,7 +2,6 @@ import type * as React from 'react';
import type { AbstractCheckboxProps } from '../checkbox/Checkbox';
import type { AbstractCheckboxGroupProps } from '../checkbox/Group';
import type { DisabledType } from '../config-provider/DisabledContext';
import type { SizeType } from '../config-provider/SizeContext';
export type { CheckboxRef as RadioRef } from 'rc-checkbox';
@ -14,7 +13,7 @@ export interface RadioGroupProps extends AbstractCheckboxGroupProps {
value?: any;
onChange?: (e: RadioChangeEvent) => void;
size?: SizeType;
disabled?: DisabledType;
disabled?: boolean;
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
name?: string;

View File

@ -53,7 +53,7 @@ type CheckboxGroupType = GetProps<typeof Checkbox.Group>;
#### GetProp 获取属性类型
对于组件的属性类型,我们可以通过 `GetProp` 来获取。它已经将 `NonNullable` 进行了封装。所以不用考虑为空的情况:
对于组件的属性类型,我们可以通过 `GetProp` 来获取。它已经将 `NonNullable` 进行了封装。所以不用考虑为空的情况:
```tsx
import type { GetProp, Select, SelectProps } from 'antd';

View File

@ -218,7 +218,7 @@
"@types/react": "^18.3.1",
"@types/react-copy-to-clipboard": "^5.0.7",
"@types/react-dom": "^18.3.0",
"@types/react-highlight-words": "^0.16.7",
"@types/react-highlight-words": "^0.20.0",
"@types/react-resizable": "^3.0.7",
"@types/semver": "^7.5.8",
"@types/spinnies": "^0.5.3",