Browse Source

chore: auto merge branches (#43223)

chore: merge master into feature
pull/43241/head
github-actions[bot] 1 year ago
committed by GitHub
parent
commit
238d89ec7f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 52
      .dumi/theme/slots/Content/ColumnCard.tsx
  2. 30
      .dumi/theme/slots/Content/JuejinLogo.tsx
  3. 23
      .dumi/theme/slots/Content/index.tsx
  4. 19
      CHANGELOG.en-US.md
  5. 19
      CHANGELOG.zh-CN.md
  6. 4
      components/date-picker/index.en-US.md
  7. 4
      components/date-picker/index.zh-CN.md
  8. 2
      components/upload/Upload.tsx
  9. 37
      components/upload/__tests__/upload.test.tsx
  10. 3
      docs/blog/tree-shaking.en-US.md
  11. 3
      docs/blog/tree-shaking.zh-CN.md
  12. 1
      docs/blog/why-not-static.en-US.md
  13. 1
      docs/blog/why-not-static.zh-CN.md
  14. 2
      docs/react/faq.en-US.md
  15. 2
      docs/react/faq.zh-CN.md
  16. 5
      package.json
  17. 1
      scripts/post-script.js

52
.dumi/theme/slots/Content/ColumnCard.tsx

@ -4,6 +4,7 @@ import { Button, Card, Divider } from 'antd';
import React from 'react';
import useLocale from '../../../hooks/useLocale';
import useSiteToken from '../../../hooks/useSiteToken';
import JuejinLogo from './JuejinLogo';
const ANTD_IMG_URL =
'https://picx.zhimg.com/v2-3b2bca09c2771e7a82a81562e806be4d.jpg?source=d16d100b';
@ -56,6 +57,8 @@ const useStyle = () => {
text-overflow: ellipsis;
white-space: nowrap;
.logo {
width: 24px;
height: 24px;
font-size: 24px;
&.zhihu-logo {
color: #056de8;
@ -63,6 +66,9 @@ const useStyle = () => {
&.yuque-logo {
color: #00b96b;
}
&.juejin-logo {
color: #1e80ff;
}
}
.arrowIcon {
margin: 0 8px;
@ -90,12 +96,14 @@ const locales = {
bigTitle: '文章被以下专栏收录:',
zhiHu: '一个 UI 设计体系',
yuQue: 'Ant Design 官方专栏',
junjin: 'Ant Design 开源专栏',
buttonText: '我有想法,去参与讨论',
},
en: {
bigTitle: 'Articles are included in the column:',
zhiHu: 'A UI design system',
yuQue: 'Ant Design official column',
junjin: 'Ant Design Open Source Column',
buttonText: 'Go to discuss',
},
};
@ -103,12 +111,13 @@ const locales = {
interface Props {
zhihuLink?: string;
yuqueLink?: string;
juejinLink?: string;
}
const ColumnCard: React.FC<Props> = ({ zhihuLink, yuqueLink }) => {
const ColumnCard: React.FC<Props> = ({ zhihuLink, yuqueLink, juejinLink }) => {
const [locale] = useLocale(locales);
const { card, bigTitle, cardBody, left, title, subTitle, btn } = useStyle();
if (!zhihuLink && !yuqueLink) {
if (!zhihuLink && !yuqueLink && !juejinLink) {
return null;
}
return (
@ -137,7 +146,7 @@ const ColumnCard: React.FC<Props> = ({ zhihuLink, yuqueLink }) => {
<Button
type="primary"
css={btn}
icon={<ZhihuOutlined style={{ fontSize: 15 }} />}
icon={<ZhihuOutlined style={{ fontSize: 16 }} />}
ghost
target="_blank"
href={zhihuLink}
@ -171,7 +180,7 @@ const ColumnCard: React.FC<Props> = ({ zhihuLink, yuqueLink }) => {
<Button
type="primary"
css={btn}
icon={<YuqueOutlined style={{ fontSize: 15 }} />}
icon={<YuqueOutlined style={{ fontSize: 16 }} />}
ghost
target="_blank"
href={yuqueLink}
@ -181,6 +190,41 @@ const ColumnCard: React.FC<Props> = ({ zhihuLink, yuqueLink }) => {
</div>
</>
)}
{juejinLink && (
<>
<Divider />
<div css={cardBody}>
<div css={left}>
<img src={ANTD_IMG_URL} alt="antd" />
<div>
<p css={title}>Ant Design</p>
<div css={subTitle}>
<JuejinLogo className="logo juejin-logo" />
<RightOutlined className="arrowIcon" />
<Button
target="_blank"
href="https://juejin.cn/column/7247354308258054200"
className="zl-btn"
type="link"
>
{locale.junjin}
</Button>
</div>
</div>
</div>
<Button
type="primary"
css={btn}
icon={<JuejinLogo style={{ fontSize: 16, width: 16, height: 16 }} />}
ghost
target="_blank"
href={juejinLink}
>
{locale.buttonText}
</Button>
</div>
</>
)}
</Card>
);
};

30
.dumi/theme/slots/Content/JuejinLogo.tsx

@ -0,0 +1,30 @@
import React from 'react';
interface Props {
className?: string;
style?: React.CSSProperties;
}
const JuejinLogo: React.FC<Props> = (props) => {
const { className, style } = props;
return (
<svg
className={className}
style={style}
xmlns="http://www.w3.org/2000/svg"
width="36"
height="28"
viewBox="0 0 36 28"
fill="none"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M17.5875 6.77268L21.8232 3.40505L17.5875 0.00748237L17.5837 0L13.3555 3.39757L17.5837 6.76894L17.5875 6.77268ZM17.5863 17.3955H17.59L28.5161 8.77432L25.5526 6.39453L17.59 12.6808H17.5863L17.5825 12.6845L9.61993 6.40201L6.66016 8.78181L17.5825 17.3992L17.5863 17.3955ZM17.5828 23.2891L17.5865 23.2854L32.2133 11.7456L35.1768 14.1254L28.5238 19.3752L17.5865 28L0.284376 14.3574L0 14.1291L2.95977 11.7531L17.5828 23.2891Z"
fill="currentColor"
/>
</svg>
);
};
export default JuejinLogo;

23
.dumi/theme/slots/Content/index.tsx

@ -104,7 +104,7 @@ type AnchorItem = {
children?: AnchorItem[];
};
const AvatarPlaceholder = ({ num = 3 }: { num?: number }) => (
const AvatarPlaceholder: React.FC<{ num?: number }> = ({ num = 3 }) => (
<>
{Array.from({ length: num }).map((_, i) => (
<Skeleton.Avatar size="small" active key={i} style={{ marginLeft: i === 0 ? 0 : -8 }} />
@ -273,10 +273,13 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
) : null}
{!meta.frontmatter.__autoDescription && meta.frontmatter.description}
{children}
{(meta.frontmatter?.zhihu_url || meta.frontmatter?.yuque_url) && (
{(meta.frontmatter?.zhihu_url ||
meta.frontmatter?.yuque_url ||
meta.frontmatter?.juejin_url) && (
<ColumnCard
zhihuLink={meta.frontmatter.zhihu_url}
yuqueLink={meta.frontmatter.yuque_url}
juejinLink={meta.frontmatter.juejin_url}
/>
)}
{meta.frontmatter.filename && (
@ -286,10 +289,14 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
css={styles.contributorsList}
cache
fileName={meta.frontmatter.filename}
renderItem={(item, loading) =>
loading || !item ? (
<AvatarPlaceholder />
) : (
renderItem={(item, loading) => {
if (!item || loading) {
return <AvatarPlaceholder />;
}
if (item.username?.includes('github-actions')) {
return null;
}
return (
<Tooltip
mouseEnterDelay={0.3}
title={`${formatMessage({ id: 'app.content.contributors' })}: ${item.username}`}
@ -305,8 +312,8 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
</Avatar>
</a>
</Tooltip>
)
}
);
}}
/>
)}
</article>

19
CHANGELOG.en-US.md

@ -15,6 +15,25 @@ timeline: true
---
## 5.6.3
`2023-06-25`
- BreadCrumb
- 🐞 Fix BreadCrumb `dropdownProps` does not working bug. [#43151](https://github.com/ant-design/ant-design/pull/43151) [@linxianxi](https://github.com/linxianxi)
- 🛠 Improve BreadCrumb behavior when receiving a null title. [#43099](https://github.com/ant-design/ant-design/pull/43099) [@Asanio06](https://github.com/Asanio06)
- 🐞 Fix Slider disabled state within Form. [#43142](https://github.com/ant-design/ant-design/pull/43142) [@Starpuccino](https://github.com/Starpuccino)
- 🐞 Fix Form that label offset does not work in vertical mode. [#43155](https://github.com/ant-design/ant-design/pull/43155) [@kiner-tang](https://github.com/kiner-tang)
- 🐞 Fix Table open filter popup throw react ref warning. [#43139](https://github.com/ant-design/ant-design/pull/43139)
- 🐞 Fix Transfer with `rowKey` makes item unselectable. [#43115](https://github.com/ant-design/ant-design/pull/43115)
- 🐞 Fix Space `size` priority when using with other components [#42752](https://github.com/ant-design/ant-design/pull/42752) [@linxianxi](https://github.com/linxianxi)
- 🐞 Fix QRCode color in dark mode. [#43162](https://github.com/ant-design/ant-design/pull/43162) [@ds1371dani](https://github.com/ds1371dani)
- 💄 Fix Select option unexpected margin when using with Badge and Tag. [#43097](https://github.com/ant-design/ant-design/pull/43097) [@Yuiai01](https://github.com/Yuiai01)
- TypeScript
- 🤖 Improve Button `target` property type definition. [#43129](https://github.com/ant-design/ant-design/pull/43129) [@li-jia-nan](https://github.com/li-jia-nan)
- 🤖 Improve Progress `size` property type to support percent value. [#43123](https://github.com/ant-design/ant-design/pull/43123) [@Ali-ovo](https://github.com/Ali-ovo)
- 🤖 Improve Slider tooltip type definition. [#43094](https://github.com/ant-design/ant-design/pull/43094) [@li-jia-nan](https://github.com/li-jia-nan)
## 5.6.2
`2023-06-19`

19
CHANGELOG.zh-CN.md

@ -15,6 +15,25 @@ timeline: true
---
## 5.6.3
`2023-06-25`
- BreadCrumb
- 🐞 修复 BreadCrumb 传递 `dropdownProps` 不生效的问题。[#43151](https://github.com/ant-design/ant-design/pull/43151) [@linxianxi](https://github.com/linxianxi)
- 🛠 优化 BreadCrumb 处理 `title``null` 时的行为。[#43099](https://github.com/ant-design/ant-design/pull/43099) [@Asanio06](https://github.com/Asanio06)
- 🐞 修复 Slider 在 Form 内部时的禁用状态。[#43142](https://github.com/ant-design/ant-design/pull/43142) [@Starpuccino](https://github.com/Starpuccino)
- 🐞 修复 Form 标签偏移值在垂直布局中不生效的问题。[#43155](https://github.com/ant-design/ant-design/pull/43155) [@kiner-tang](https://github.com/kiner-tang)
- 🐞 修复 Table 打开筛选面板会报 `react ref` 错误警告信息。[#43139](https://github.com/ant-design/ant-design/pull/43139)
- 🐞 修复 Transfer 配置 `rowKey` 后无法选中的问题。[#43115](https://github.com/ant-design/ant-design/pull/43115)
- 🐞 修复 Space 与其他组件搭配使用时的 `size` 优先级[#42752](https://github.com/ant-design/ant-design/pull/42752) [@linxianxi](https://github.com/linxianxi)
- 🐞 修复 QRCode 在暗黑模式下的颜色。[#43162](https://github.com/ant-design/ant-design/pull/43162) [@ds1371dani](https://github.com/ds1371dani)
- 💄 修复 Select 选项使用 Badge 和 Tag 时底部存在意外边距的问题。[#43097](https://github.com/ant-design/ant-design/pull/43097) [@Yuiai01](https://github.com/Yuiai01)
- TypeScript
- 🤖 优化 Button 的 `target` 属性类型定义。[#43129](https://github.com/ant-design/ant-design/pull/43129) [@li-jia-nan](https://github.com/li-jia-nan)
- 🤖 优化 Progress 的 `size` 属性类型定义以支持百分比值。[#43123](https://github.com/ant-design/ant-design/pull/43123) [@Ali-ovo](https://github.com/Ali-ovo)
- 🤖 优化 Slider tooltip 的类型定义。[#43094](https://github.com/ant-design/ant-design/pull/43094) [@li-jia-nan](https://github.com/li-jia-nan)
## 5.6.2
`2023-06-19`

4
components/date-picker/index.en-US.md

@ -223,6 +223,10 @@ export type FormatType = Generic | GenericFn | Array<Generic | GenericFn>;
Please refer [FAQ](/docs/react/faq#when-set-mode-to-datepickerrangepicker-cannot-select-year-or-month-anymore)
### Why does the date picker switch to the date panel after selecting the year instead of the month panel?
After selecting the year, the system directly switches to the date panel instead of month panel. This design is intended to reduce the user's operational burden by allowing them to complete the year modification with just one click, without having to enter the month selection interface again. At the same time, it also avoids additional cognitive burden of remembering the month.
### How to use DatePicker with customize date library like dayjs?
Please refer [Use custom date library](/docs/react/use-custom-date-library#datepicker)

4
components/date-picker/index.zh-CN.md

@ -224,6 +224,10 @@ export type FormatType = Generic | GenericFn | Array<Generic | GenericFn>;
请参考[常见问答](/docs/react/faq#当我指定了-datepickerrangepicker-的-mode-属性后点击后无法选择年份月份)
### 为何日期选择年份后返回的是日期面板而不是月份面板?
当用户选择完年份后,系统会直接切换至日期面板,而非显式提供月份选择。这样做的设计在于用户只需进行一次点击即可完成年份修改,无需再次点击进入月份选择界面,从而减少了用户的操作负担,同时也避免需要额外感知月份的记忆负担。
### 如何在 DatePicker 中使用自定义日期库(如 Moment.js )?
请参考[《使用自定义日期库》](/docs/react/use-custom-date-library#datepicker)

2
components/upload/Upload.tsx

@ -113,7 +113,7 @@ const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (
if (maxCount === 1) {
cloneList = cloneList.slice(-1);
} else if (maxCount) {
exceedMaxCount = true;
exceedMaxCount = cloneList.length > maxCount;
cloneList = cloneList.slice(0, maxCount);
}

37
components/upload/__tests__/upload.test.tsx

@ -777,6 +777,43 @@ describe('Upload', () => {
expect(args[0].file.name).toBe('foo.png');
});
});
// https://github.com/ant-design/ant-design/issues/43190
it('should trigger onChange when remove', async () => {
const onChange = jest.fn();
const { container } = render(
<Upload
onChange={onChange}
maxCount={2}
defaultFileList={[
{
uid: 'bamboo',
name: 'bamboo.png',
},
{
uid: 'little',
name: 'little.png',
},
]}
showUploadList
>
<button type="button">upload</button>
</Upload>,
);
// Click delete
fireEvent.click(container.querySelector('.ant-upload-list-item-action')!);
await waitFakeTimer();
expect(onChange).toHaveBeenCalledWith(
expect.objectContaining({
// Have 1 file
fileList: [expect.anything()],
}),
);
});
});
it('auto fill file uid', () => {

3
docs/blog/tree-shaking.en-US.md

@ -1,7 +1,8 @@
---
title: Bundle Size Optimization
date: 2023-06-24
date: 2023-06-25
author: zombieJ
juejin_url: https://juejin.cn/post/7248424501813674021
---
In modern JS applications, unused module can be automatically removed by modular packaging tools. This process is called [Tree Shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking). However, if you are already very familiar with it, you will find that it is not so perfect in reality. We still need some extra operations to achieve the best size optimization effect. Today, let's talk about a problem that ConfigProvider causes Tree Shaking to fail.

3
docs/blog/tree-shaking.zh-CN.md

@ -1,7 +1,8 @@
---
title: 打包体积优化
date: 2023-06-24
date: 2023-06-25
author: zombieJ
juejin_url: https://juejin.cn/post/7248424501813674021
---
在现代 JS 应用中,通过模块化打包工具可以自动将一些未使用的模块代码去除,这个过程叫做 [Tree Shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking)。不过如果你已经对此非常熟悉了,你会发现现实中它并不是那么完美,我们还需要一些额外的操作才能达到最佳的体积优化效果。今天,我们就来讲讲一个 ConfigProvider 导致的 Tree Shaking 失效的问题。

1
docs/blog/why-not-static.en-US.md

@ -3,6 +3,7 @@ title: Pain of static methods
date: 2023-04-26
author: zombieJ
zhihu_url: https://zhuanlan.zhihu.com/p/633333904
yuque_url: https://www.yuque.com/ant-design/ant-design/gkkyx81eihftzzq7
---
> `message.success` is working well, why do you warn me to use hooks? antd is getting worse and worse, goodbye!

1
docs/blog/why-not-static.zh-CN.md

@ -3,6 +3,7 @@ title: 静态方法之痛
date: 2023-04-26
author: zombieJ
zhihu_url: https://zhuanlan.zhihu.com/p/633333904
yuque_url: https://www.yuque.com/ant-design/ant-design/gkkyx81eihftzzq7
---
> `message.success` 用的好好的为什么要 warning 我去用 hooks?antd 越做越垃圾,走好不送!

2
docs/react/faq.en-US.md

@ -189,7 +189,7 @@ For historical reasons, the display names of the pop components are not uniform,
## Dynamic style using `:where` selector which not support old browser.
Please ref dynamic theme document [Compatible Adjustment](/docs/react/customize-theme#compatible-adjustment) part.
Please ref dynamic theme document [Legacy Browser Compatible](/docs/react/customize-theme#legacy-browser-compatible) part.
## How to disable motion?

2
docs/react/faq.zh-CN.md

@ -210,7 +210,7 @@ ConfigProvider.config({
## 动态样式有 `:where` 导致旧版浏览器不支持怎么办?
请参考动态主题文档 [兼容性调整](/docs/react/customize-theme-cn#兼容性调整) 部分内容。
请参考动态主题文档 [兼容旧版浏览器](/docs/react/customize-theme-cn#兼容旧版浏览器) 部分内容。
## 如何关闭组件动画

5
package.json

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "5.6.2",
"version": "5.6.3",
"packageManager": "^npm@9.0.0",
"description": "An enterprise-class UI design language and React components implementation",
"title": "Ant Design",
@ -299,7 +299,8 @@
"typescript": "~5.1.3",
"vanilla-jsoneditor": "^0.17.1",
"webpack-bundle-analyzer": "^4.1.0",
"xhr-mock": "^2.4.1"
"xhr-mock": "^2.4.1",
"file-system-cache": "2.3.0"
},
"peerDependencies": {
"react": ">=16.9.0",

1
scripts/post-script.js

@ -38,6 +38,7 @@ const DEPRECIATED_VERSION = {
'https://github.com/ant-design/ant-design/pull/41993',
],
'5.6.2': ['https://github.com/ant-design/ant-design/issues/43113'],
'5.6.3': ['https://github.com/ant-design/ant-design/issues/43190'],
};
function matchDeprecated(version) {

Loading…
Cancel
Save