From 8368458bf77f5cf8170ddf95167b07776ef79419 Mon Sep 17 00:00:00 2001 From: Peach Date: Fri, 11 Aug 2023 14:40:50 +0800 Subject: [PATCH 1/7] docs: changelog for 5.8.3 (#44167) * docs: changelog for 5.8.3 * chore: bump version to 5.8.3 * docs: update changelog * Update CHANGELOG.en-US.md Co-authored-by: xrkffgg Signed-off-by: Peach --------- Signed-off-by: Peach Co-authored-by: xrkffgg --- CHANGELOG.en-US.md | 23 +++++++++++++++++++++++ CHANGELOG.zh-CN.md | 23 +++++++++++++++++++++++ package.json | 2 +- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 1e4a1f3e6449..dc13f5c553a7 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -16,6 +16,29 @@ tag: vVERSION --- +## 5.8.3 + +`2023-08-11` + +- DatePicker + - 🐞 Fix DatePicker panel cannot toggle when selecting time with truthy `open` and truthy `defaultOpen`. [#44105](https://github.com/ant-design/ant-design/pull/44105) [@Yuiai01](https://github.com/Yuiai01) + - 🐞 Fix DatePicker and RangePicker still show the clear button when disable `allowClear`. [#44015](https://github.com/ant-design/ant-design/pull/44015) [@bartpio](https://github.com/bartpio) +- Carousel + - 🐞 Fix Carousel do not support `id` prop. [#44079](https://github.com/ant-design/ant-design/pull/44079) + - 💄 Fix Carousel `dots` extra margin style. [#44076](https://github.com/ant-design/ant-design/pull/44076) +- 🐞 Fix Modal footer disabled state that affect by Form. [#43055](https://github.com/ant-design/ant-design/pull/43055) [@Wxh16144](https://github.com/Wxh16144) +- 🐞 Fix Upload thumbnail that gif will not play. [#44083](https://github.com/ant-design/ant-design/pull/44083) [@linxianxi](https://github.com/linxianxi) +- 🐞 Fix FloatButton that menu mode didn't support `badge` prop. [#44109](https://github.com/ant-design/ant-design/pull/44109) [@MadCcc](https://github.com/MadCcc) +- 🐞 Fix Grid & List responsive config take effect after first render which cause screen flick. [#44075](https://github.com/ant-design/ant-design/pull/44075) +- 🐞 Fix that Design Token partially missing when `@ant-design/cssinjs` version `1.15.0`. [#44091](https://github.com/ant-design/ant-design/pull/44091) [@MadCcc](https://github.com/MadCcc) +- 💄 Fix Badge `status="processing"` with `dot` wave style issue. [#44153](https://github.com/ant-design/ant-design/pull/44153) +- 💄 Fix Descriptions border styles when it nests itself. [#43454](https://github.com/ant-design/ant-design/pull/43454) [@Yuiai01](https://github.com/Yuiai01) +- 💄 Fix Pagination transition style in prev/next buttons. [#44030](https://github.com/ant-design/ant-design/pull/44030) +- 💄 Fix Popconfirm button group wraps unexpectedly. [#44022](https://github.com/ant-design/ant-design/pull/44022) [@MuxinFeng](https://github.com/MuxinFeng) +- 💄 Optimize style of Image preview operation icons. [#44141](https://github.com/ant-design/ant-design/pull/44141) [@MadCcc](https://github.com/MadCcc) +- 💄 Optimize Input and InputNumber font size in large mode. [#44000](https://github.com/ant-design/ant-design/pull/44000) [@MuxinFeng](https://github.com/MuxinFeng) +- 💄 Remove Space part useless style. [#44098](https://github.com/ant-design/ant-design/pull/44098) + ## 5.8.2 `2023-08-04` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index c38251ffce4e..6ba8ef008e4d 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -16,6 +16,29 @@ tag: vVERSION --- +## 5.8.3 + +`2023-08-11` + +- DatePicker + - 🐞 修复 DatePicker 在 `open` 和 `defaultOpen` 为 `true` 时选中时间不会切换面板的问题。[#44105](https://github.com/ant-design/ant-design/pull/44105) [@Yuiai01](https://github.com/Yuiai01) + - 🐞 修复 DatePicker 和 RangePicker 禁用 `allowClear` 时仍然展示清除按钮的问题。[#44015](https://github.com/ant-design/ant-design/pull/44015) [@bartpio](https://github.com/bartpio) +- Carousel + - 🐞 修复 Carousel 不支持 `id` 属性的问题。[#44079](https://github.com/ant-design/ant-design/pull/44079) + - 💄 修复 Carousel `dots` 切换点有多余 margin 的问题。[#44076](https://github.com/ant-design/ant-design/pull/44076) +- 🐞 修复 Modal 页脚禁用态受 Form 影响的问题。[#43055](https://github.com/ant-design/ant-design/pull/43055) [@Wxh16144](https://github.com/Wxh16144) +- 🐞 修复 Upload gif 缩略图不会动的问题。[#44083](https://github.com/ant-design/ant-design/pull/44083) [@linxianxi](https://github.com/linxianxi) +- 🐞 修复 FloatButton 组件菜单模式不支持 `badge` 配置的问题。[#44109](https://github.com/ant-design/ant-design/pull/44109) [@MadCcc](https://github.com/MadCcc) +- 🐞 修复 Grid 与 List 响应式布局生效稍晚于首次渲染导致屏幕闪动的问题。[#44075](https://github.com/ant-design/ant-design/pull/44075) +- 🐞 修复 `@ant-design/cssinjs` 版本小于 `1.15.0` 时 Design Token 部分丢失的问题。[#44091](https://github.com/ant-design/ant-design/pull/44091) [@MadCcc](https://github.com/MadCcc) +- 💄 修复 Badge `status="processing"` 和 `dot` 配合使用时,波纹样式异常的问题。[#44153](https://github.com/ant-design/ant-design/pull/44153) +- 💄 修复 Descriptions 组件自行嵌套时的边框样式问题。[#43454](https://github.com/ant-design/ant-design/pull/43454) [@Yuiai01](https://github.com/Yuiai01) +- 💄 修复 Pagination 上下页切换按钮 `transition`` 丢失的问题。[#44030](https://github.com/ant-design/ant-design/pull/44030) +- 💄 修复 Popconfirm 按钮组意外换行的问题。[#44022](https://github.com/ant-design/ant-design/pull/44022) [@MuxinFeng](https://github.com/MuxinFeng) +- 💄 优化 Image 组件预览操作图标的样式。[#44141](https://github.com/ant-design/ant-design/pull/44141) [@MadCcc](https://github.com/MadCcc) +- 💄 优化 Input 和 InputNumber 在大尺寸下的字体大小。[#44000](https://github.com/ant-design/ant-design/pull/44000) [@MuxinFeng](https://github.com/MuxinFeng) +- 💄 移除 Space 部分未使用的样式。[#44098](https://github.com/ant-design/ant-design/pull/44098) + ## 5.8.2 `2023-08-04` diff --git a/package.json b/package.json index 7df4e99d4835..19565db1c24f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "5.8.2", + "version": "5.8.3", "packageManager": "^npm@9.0.0", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", From ddfe37a14e2abd9d66aa43fabd0efd359a78e322 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Fri, 11 Aug 2023 19:37:53 +0800 Subject: [PATCH 2/7] docs: bump theme-editor (#44171) * chore: fix plugin antd import * chore: code clean * chore: fix image test * chore: fix image test --- .dumi/pages/theme-editor/index.tsx | 136 +++-------------------------- .dumi/theme/plugin.ts | 23 ++++- .dumirc.ts | 2 +- .jest.js | 2 + package.json | 2 +- tests/shared/imageTest.tsx | 2 +- 6 files changed, 39 insertions(+), 128 deletions(-) diff --git a/.dumi/pages/theme-editor/index.tsx b/.dumi/pages/theme-editor/index.tsx index 1ee416a80532..d67fa4ca52d6 100644 --- a/.dumi/pages/theme-editor/index.tsx +++ b/.dumi/pages/theme-editor/index.tsx @@ -1,17 +1,11 @@ -import { createStyles } from 'antd-style'; -import { ThemeEditor, enUS, zhCN } from 'antd-token-previewer'; +import { enUS, zhCN } from 'antd-token-previewer'; import { Helmet } from 'dumi'; -import React, { Suspense, useCallback, useEffect, useState } from 'react'; -import type { JSONContent, TextContent } from 'vanilla-jsoneditor'; +import React, { Suspense, useEffect } from 'react'; import type { ThemeConfig } from 'antd/es/config-provider/context'; -import { Button, ConfigProvider, Modal, Spin, Typography, message } from 'antd'; +import { Button, message, Skeleton } from 'antd'; import useLocale from '../../hooks/useLocale'; -const JSONEditor = React.lazy(() => import('../../theme/common/JSONEditor')); - -function isObject(target: any) { - return Object.prototype.toString.call(target) === '[object Object]'; -} +const ThemeEditor = React.lazy(() => import('antd-token-previewer/lib/ThemeEditor')); const locales = { cn: { @@ -38,17 +32,6 @@ const locales = { }, }; -const useStyle = createStyles(({ css }) => ({ - header: css({ - display: 'flex', - height: 56, - alignItems: 'center', - padding: '0 24px', - justifyContent: 'space-between', - borderBottom: '1px solid #F0F0F0', - }), -})); - const ANT_DESIGN_V5_THEME_EDITOR_THEME = 'ant-design-v5-theme-editor-theme'; const CustomTheme = () => { @@ -57,13 +40,6 @@ const CustomTheme = () => { const [theme, setTheme] = React.useState({}); - const [editModelOpen, setEditModelOpen] = useState(false); - const [editThemeFormatRight, setEditThemeFormatRight] = useState(true); - const [themeConfigContent, setThemeConfigContent] = useState({ - text: '{}', - json: undefined, - }); - useEffect(() => { const storedConfig = localStorage.getItem(ANT_DESIGN_V5_THEME_EDITOR_THEME); if (storedConfig) { @@ -77,61 +53,11 @@ const CustomTheme = () => { } }, []); - const { styles } = useStyle(); - const handleSave = () => { localStorage.setItem(ANT_DESIGN_V5_THEME_EDITOR_THEME, JSON.stringify(theme)); messageApi.success(locale.saveSuccessfully); }; - const handleEditConfig = () => { - setEditModelOpen(true); - }; - - const editModelClose = useCallback(() => { - setEditModelOpen(false); - }, [themeConfigContent]); - - const handleEditConfigChange = (newcontent, preContent, status) => { - setThemeConfigContent(newcontent); - setEditThemeFormatRight(!status.contentErrors); - }; - - const editSave = useCallback(() => { - const contentFormatError = !editThemeFormatRight; - - if (contentFormatError) { - message.error(locale.editJsonContentTypeError); - return; - } - const themeConfig = themeConfigContent.text - ? JSON.parse(themeConfigContent.text) - : themeConfigContent.json; - if (!isObject(themeConfig)) { - message.error(locale.editJsonContentTypeError); - return; - } - setTheme(themeConfig); - editModelClose(); - messageApi.success(locale.editSuccessfully); - }, [themeConfigContent, editThemeFormatRight]); - - const handleExport = () => { - const file = new File([JSON.stringify(theme, null, 2)], `Ant Design Theme.json`, { - type: 'text/json; charset=utf-8;', - }); - const tmpLink = document.createElement('a'); - const objectUrl = URL.createObjectURL(file); - - tmpLink.href = objectUrl; - tmpLink.download = file.name; - document.body.appendChild(tmpLink); - tmpLink.click(); - - document.body.removeChild(tmpLink); - URL.revokeObjectURL(objectUrl); - }; - return (
@@ -139,58 +65,22 @@ const CustomTheme = () => { {contextHolder} - -
- - {locale.title} - -
- - - -
- } - > - - - - - - -
-
+ }> { setTheme(newTheme.config); - setThemeConfigContent({ - json: newTheme.config, - text: undefined, - }); }} locale={lang === 'cn' ? zhCN : enUS} + actions={ + + } /> - + ); }; diff --git a/.dumi/theme/plugin.ts b/.dumi/theme/plugin.ts index 68438c08ab03..2f312dc468d6 100644 --- a/.dumi/theme/plugin.ts +++ b/.dumi/theme/plugin.ts @@ -5,9 +5,28 @@ import type { IApi, IRoute } from 'dumi'; import ReactTechStack from 'dumi/dist/techStacks/react'; import chalk from 'chalk'; import sylvanas from 'sylvanas'; -import { extractStaticStyle } from 'antd-style'; +import createEmotionServer from '@emotion/server/create-instance'; import localPackage from '../../package.json'; +function extractEmotionStyle(html: string) { + // copy from emotion ssr + // https://github.com/vercel/next.js/blob/deprecated-main/examples/with-emotion-vanilla/pages/_document.js + const styles = global.__ANTD_STYLE_CACHE_MANAGER_FOR_SSR__.getCacheList().map((cache) => { + const result = createEmotionServer(cache).extractCritical(html); + if (!result.css) return null; + + const { css, ids } = result; + + return { + key: cache.key, + css, + ids, + tag: ``, + }; + }); + return styles.filter(Boolean); +} + export const getHash = (str: string, length = 8) => createHash('md5').update(str).digest('hex').slice(0, length); @@ -129,7 +148,7 @@ const RoutesPlugin = (api: IApi) => { file.content = file.content.replace('', `${globalStyles}`); // 1. 提取 antd-style 样式 - const styles = extractStaticStyle(file.content, { includeAntd: false }); + const styles = extractEmotionStyle(file.content); // 2. 提取每个样式到独立 css 文件 styles.forEach((result) => { diff --git a/.dumirc.ts b/.dumirc.ts index 2f7b95de0a56..f9aed1f0e5ec 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -11,6 +11,7 @@ export default defineConfig({ }, ssr: process.env.NODE_ENV === 'production' ? {} : false, hash: true, + mfsu: false, crossorigin: {}, outputPath: '_site', favicons: ['https://gw.alipayobjects.com/zos/rmsportal/rlpTLlbMzTNYuZGGCVYM.png'], @@ -34,7 +35,6 @@ export default defineConfig({ }, extraRehypePlugins: [rehypeAntd], extraRemarkPlugins: [remarkAntd], - mfsu: false, metas: [{ name: 'theme-color', content: '#1677ff' }], analytics: { ga_v2: 'UA-72788897-1', diff --git a/.jest.js b/.jest.js index 08ff43ec46eb..20d85ca82e07 100644 --- a/.jest.js +++ b/.jest.js @@ -33,6 +33,8 @@ module.exports = { '/\\.(css|less)$/': 'identity-obj-proxy', '^antd$': '/components/index', '^antd/es/(.*)$': '/components/$1', + '^antd/lib/(.*)$': '/components/$1', + '^antd/locale/(.*)$': '/components/locale/$1', }, testPathIgnorePatterns: ['/node_modules/', 'dekko', 'node', 'image.test.js', 'image.test.ts'], transform: { diff --git a/package.json b/package.json index 19565db1c24f..70ced90bb945 100644 --- a/package.json +++ b/package.json @@ -210,7 +210,7 @@ "@typescript-eslint/parser": "^5.40.0", "antd-img-crop": "^4.9.0", "antd-style": "^3.4.2-beta.1", - "antd-token-previewer": "^1.1.0-21", + "antd-token-previewer": "^2.0.1", "chalk": "^4.0.0", "cheerio": "1.0.0-rc.12", "circular-dependency-plugin": "^5.2.2", diff --git a/tests/shared/imageTest.tsx b/tests/shared/imageTest.tsx index 16c91160ccda..372e1a18fed6 100644 --- a/tests/shared/imageTest.tsx +++ b/tests/shared/imageTest.tsx @@ -38,7 +38,7 @@ export default function imageTest(component: React.ReactElement) { MockDate.set(dayjs('2016-11-22').valueOf()); page.on('request', onRequestHandle); await page.goto(`file://${process.cwd()}/tests/index.html`); - await page.addStyleTag({ path: `${process.cwd()}/dist/reset.css` }); + await page.addStyleTag({ path: `${process.cwd()}/components/style/reset.css` }); await page.addStyleTag({ content: '*{animation: none!important;}' }); const cache = createCache(); From 56c168fe9e72d35a0919d2be6ab43ac3433c1c34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:35:26 +0800 Subject: [PATCH 3/7] chore(deps-dev): bump @types/gtag.js from 0.0.12 to 0.0.13 (#44180) Bumps [@types/gtag.js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/gtag.js) from 0.0.12 to 0.0.13. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/gtag.js) --- updated-dependencies: - dependency-name: "@types/gtag.js" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 70ced90bb945..771f1c302547 100644 --- a/package.json +++ b/package.json @@ -182,7 +182,7 @@ "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.2", "@types/fs-extra": "^11.0.1", - "@types/gtag.js": "^0.0.12", + "@types/gtag.js": "^0.0.13", "@types/http-server": "^0.12.1", "@types/inquirer": "^9.0.3", "@types/isomorphic-fetch": "^0.0.36", From 95c6d4a365b3c2bc5122897e8ca1e4dd98b236d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:36:10 +0800 Subject: [PATCH 4/7] chore(deps-dev): bump gh-pages from 5.0.0 to 6.0.0 (#44178) Bumps [gh-pages](https://github.com/tschaub/gh-pages) from 5.0.0 to 6.0.0. - [Release notes](https://github.com/tschaub/gh-pages/releases) - [Changelog](https://github.com/tschaub/gh-pages/blob/main/changelog.md) - [Commits](https://github.com/tschaub/gh-pages/compare/v5.0.0...v6.0.0) --- updated-dependencies: - dependency-name: gh-pages dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 771f1c302547..fa6a79bf0bc3 100644 --- a/package.json +++ b/package.json @@ -236,7 +236,7 @@ "fast-glob": "^3.2.11", "fetch-jsonp": "^1.1.3", "fs-extra": "^11.0.0", - "gh-pages": "^5.0.0", + "gh-pages": "^6.0.0", "glob": "^10.0.0", "html2sketch": "^1.0.0", "http-server": "^14.0.0", From 5ddec3ab8296d574caf3c9646d0c9b7d1d45f770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Sat, 12 Aug 2023 00:36:34 +0800 Subject: [PATCH 5/7] chore: CI of PR welcome (#44184) --- .github/workflows/pr-contributor-welcome.yml | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/pr-contributor-welcome.yml diff --git a/.github/workflows/pr-contributor-welcome.yml b/.github/workflows/pr-contributor-welcome.yml new file mode 100644 index 000000000000..302e9c71535b --- /dev/null +++ b/.github/workflows/pr-contributor-welcome.yml @@ -0,0 +1,28 @@ +# 当 PR 被合并时,留言欢迎加入共建群 +name: PullRequest Contributor Welcome + +on: + pull_request_target: + types: + - closed + paths: + - 'components/**' + +jobs: + check-merged: + runs-on: ubuntu-latest + needs: read-file + if: github.event.pull_request.merged == true + steps: + - uses: actions-cool/maintain-one-comment@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 🎉 Thanks for contribution. Please feel free to join DingTalk Social Community (Provide the PR link please). + + 🎉 感谢参与贡献,欢迎扫码加入钉钉社区(进群后请提供 PR 地址)。 + + + + + body-include: '' \ No newline at end of file From 56f2bc5072f558b042c309686f4540f1e89f3ec1 Mon Sep 17 00:00:00 2001 From: Electrolux <59329360+yilaikesi@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:08:25 +0800 Subject: [PATCH 6/7] fix: (tabs)Unexpected color change in the click area of the mobile tabs component (#44200) --- components/tabs/style/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/tabs/style/index.ts b/components/tabs/style/index.ts index c010b20f457c..43c2f34ddaee 100644 --- a/components/tabs/style/index.ts +++ b/components/tabs/style/index.ts @@ -663,6 +663,8 @@ const genTabStyle: GenerateStyle = (token: TabsToken) => { return { [tabCls]: { position: 'relative', + WebkitTouchCallout: 'none', + WebkitTapHighlightColor: 'transparent', display: 'inline-flex', alignItems: 'center', padding: horizontalItemPadding, From 72b449a1a4feb80c16b7c7b6371b83fdc0b914d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Mon, 14 Aug 2023 13:32:57 +0800 Subject: [PATCH 7/7] docs: update faq (#44198) * docs: update faq * chore: update lint * chore: update lint * chore: use returnType --- .dumi/theme/builtins/IconSearch/Category.tsx | 2 +- .dumi/theme/layouts/DocLayout/index.tsx | 2 +- .dumi/theme/slots/Header/index.tsx | 2 +- components/_util/ActionButton.tsx | 2 +- components/affix/index.tsx | 2 +- components/button/button.tsx | 2 +- components/form/index.en-US.md | 4 ++-- components/form/index.zh-CN.md | 4 ++-- components/input/hooks/useRemovePasswordTimeout.ts | 2 +- components/modal/confirm.tsx | 2 +- components/statistic/Countdown.tsx | 2 +- components/typography/Base/index.tsx | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.dumi/theme/builtins/IconSearch/Category.tsx b/.dumi/theme/builtins/IconSearch/Category.tsx index 83b70a309eea..1cbbdf4c57c6 100644 --- a/.dumi/theme/builtins/IconSearch/Category.tsx +++ b/.dumi/theme/builtins/IconSearch/Category.tsx @@ -16,7 +16,7 @@ const Category: React.FC = (props) => { const { icons, title, newIcons, theme } = props; const intl = useIntl(); const [justCopied, setJustCopied] = React.useState(null); - const copyId = React.useRef(null); + const copyId = React.useRef | null>(null); const onCopied = React.useCallback((type: string, text: string) => { message.success( diff --git a/.dumi/theme/layouts/DocLayout/index.tsx b/.dumi/theme/layouts/DocLayout/index.tsx index f5af2a0a7876..4e910e6edc9b 100644 --- a/.dumi/theme/layouts/DocLayout/index.tsx +++ b/.dumi/theme/layouts/DocLayout/index.tsx @@ -32,7 +32,7 @@ const DocLayout: React.FC = () => { const location = useLocation(); const { pathname, search, hash } = location; const [locale, lang] = useLocale(locales); - const timerRef = useRef(null); + const timerRef = useRef | null>(null); const { direction } = useContext(SiteContext); const { loading } = useSiteData(); diff --git a/.dumi/theme/slots/Header/index.tsx b/.dumi/theme/slots/Header/index.tsx index ae41778b685d..fecc9c97568f 100644 --- a/.dumi/theme/slots/Header/index.tsx +++ b/.dumi/theme/slots/Header/index.tsx @@ -139,7 +139,7 @@ const Header: React.FC = () => { searching: false, }); const { direction, isMobile, updateSiteConfig } = useContext(SiteContext); - const pingTimer = useRef(null); + const pingTimer = useRef | null>(null); const location = useLocation(); const { pathname, search } = location; diff --git a/components/_util/ActionButton.tsx b/components/_util/ActionButton.tsx index aed3cd743997..18552030c216 100644 --- a/components/_util/ActionButton.tsx +++ b/components/_util/ActionButton.tsx @@ -48,7 +48,7 @@ const ActionButton: React.FC = (props) => { }; React.useEffect(() => { - let timeoutId: NodeJS.Timer | null = null; + let timeoutId: ReturnType | null = null; if (autoFocus) { timeoutId = setTimeout(() => { buttonRef.current?.focus(); diff --git a/components/affix/index.tsx b/components/affix/index.tsx index 9f60cdf6661b..3f4fb4b17651 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -71,7 +71,7 @@ class InternalAffix extends React.Component { private fixedNodeRef = createRef(); - private timer: NodeJS.Timeout | null; + private timer: ReturnType | null; context: ConfigConsumerProps; diff --git a/components/button/button.tsx b/components/button/button.tsx index 8fbc7f8807fe..64bdc20e413d 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -145,7 +145,7 @@ const InternalButton: React.ForwardRefRenderFunction< const needInserted = Children.count(children) === 1 && !icon && !isUnBorderedButtonType(type); useEffect(() => { - let delayTimer: NodeJS.Timer | null = null; + let delayTimer: ReturnType | null = null; if (loadingOrDelay.delay > 0) { delayTimer = setTimeout(() => { delayTimer = null; diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index 4363236da885..2b52c06c7dc0 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -296,8 +296,8 @@ Provide linkage between forms. If a sub form with `name` prop update, it will au | resetFields | Reset fields to `initialValues` | (fields?: [NamePath](#namepath)\[]) => void | | | scrollToField | Scroll to field position | (name: [NamePath](#namepath), options: \[[ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)]) => void | | | setFields | Set fields status | (fields: [FieldData](#fielddata)\[]) => void | | -| setFieldValue | Set fields value(Will directly pass to form store. If you do not want to modify passed object, please clone first) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 | -| setFieldsValue | Set fields value(Will directly pass to form store. If you do not want to modify passed object, please clone first). Use `setFieldValue` instead if you want to only config single value in Form.List | (values) => void | | +| setFieldValue | Set fields value(Will directly pass to form store and **reset validation message**. If you do not want to modify passed object, please clone first) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 | +| setFieldsValue | Set fields value(Will directly pass to form store and **reset validation message**. If you do not want to modify passed object, please clone first). Use `setFieldValue` instead if you want to only config single value in Form.List | (values) => void | | | submit | Submit the form. It's same as click `submit` button | () => void | | | validateFields | Validate fields | (nameList?: [NamePath](#namepath)\[], { validateOnly?: boolean }) => Promise | `validateOnly`: 5.5.0 | diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index 98ae05170e46..f1c735c07897 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -295,8 +295,8 @@ Form.List 渲染表单相关操作函数。 | resetFields | 重置一组字段到 `initialValues` | (fields?: [NamePath](#namepath)\[]) => void | | | scrollToField | 滚动到对应字段位置 | (name: [NamePath](#namepath), options: [ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)) => void | | | setFields | 设置一组字段状态 | (fields: [FieldData](#fielddata)\[]) => void | | -| setFieldValue | 设置表单的值(该值将直接传入 form store 中。如果你不希望传入对象被修改,请克隆后传入) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 | -| setFieldsValue | 设置表单的值(该值将直接传入 form store 中。如果你不希望传入对象被修改,请克隆后传入)。如果你只想修改 Form.List 中单项值,请通过 `setFieldValue` 进行指定 | (values) => void | | +| setFieldValue | 设置表单的值(该值将直接传入 form store 中并且**重置错误信息**。如果你不希望传入对象被修改,请克隆后传入) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 | +| setFieldsValue | 设置表单的值(该值将直接传入 form store 中并且**重置错误信息**。如果你不希望传入对象被修改,请克隆后传入)。如果你只想修改 Form.List 中单项值,请通过 `setFieldValue` 进行指定 | (values) => void | | | submit | 提交表单,与点击 `submit` 按钮效果相同 | () => void | | | validateFields | 触发表单验证 | (nameList?: [NamePath](#namepath)\[], { validateOnly?: boolean }) => Promise | `validateOnly`: 5.5.0 | diff --git a/components/input/hooks/useRemovePasswordTimeout.ts b/components/input/hooks/useRemovePasswordTimeout.ts index b67d7ae9ce3c..94bf78a8279f 100644 --- a/components/input/hooks/useRemovePasswordTimeout.ts +++ b/components/input/hooks/useRemovePasswordTimeout.ts @@ -5,7 +5,7 @@ export default function useRemovePasswordTimeout( inputRef: React.RefObject, triggerOnMount?: boolean, ) { - const removePasswordTimeoutRef = useRef([]); + const removePasswordTimeoutRef = useRef[]>([]); const removePasswordTimeout = () => { removePasswordTimeoutRef.current.push( setTimeout(() => { diff --git a/components/modal/confirm.tsx b/components/modal/confirm.tsx index 5dc126aaae91..26a6883d0e94 100644 --- a/components/modal/confirm.tsx +++ b/components/modal/confirm.tsx @@ -31,7 +31,7 @@ export default function confirm(config: ModalFuncProps) { const container = document.createDocumentFragment(); // eslint-disable-next-line @typescript-eslint/no-use-before-define let currentConfig = { ...config, close, open: true } as any; - let timeoutId: NodeJS.Timeout; + let timeoutId: ReturnType; function destroy(...args: any[]) { const triggerCancel = args.some((param) => param && param.triggerCancel); diff --git a/components/statistic/Countdown.tsx b/components/statistic/Countdown.tsx index 4fcd5c95eeba..6fbdf5de1bc6 100644 --- a/components/statistic/Countdown.tsx +++ b/components/statistic/Countdown.tsx @@ -24,7 +24,7 @@ const Countdown: React.FC = (props) => { const forceUpdate = useForceUpdate(); - const countdown = React.useRef(null); + const countdown = React.useRef | null>(null); const stopTimer = () => { onFinish?.(); diff --git a/components/typography/Base/index.tsx b/components/typography/Base/index.tsx index 56cef15b4775..7baefd7711de 100644 --- a/components/typography/Base/index.tsx +++ b/components/typography/Base/index.tsx @@ -193,7 +193,7 @@ const Base = React.forwardRef((props, ref) => { // ========================== Copyable ========================== const [enableCopy, copyConfig] = useMergedConfig(copyable); const [copied, setCopied] = React.useState(false); - const copyIdRef = React.useRef(null); + const copyIdRef = React.useRef | null>(null); const copyOptions: Pick = {}; if (copyConfig.format) {