diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index c1e8e1305f2d..96c2526e4c4b 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -1,4 +1,4 @@ { - "sandboxes": ["antd-reproduction-template-y9vgcf"], - "node": "14" + "sandboxes": ["antd-reproduction-template-forked-jyh2k9"], + "node": "18" } diff --git a/.dumi/theme/common/LiveCode.tsx b/.dumi/theme/common/LiveCode.tsx index 9f80e95c6e04..960e47529ac0 100644 --- a/.dumi/theme/common/LiveCode.tsx +++ b/.dumi/theme/common/LiveCode.tsx @@ -16,11 +16,11 @@ const useStyle = createStyles(({ token, css }) => { outline: none; &:hover { - border: 1px solid ${colorPrimaryBorder} !important; + box-shadow: inset 0 0 0 1px ${colorPrimaryBorder} !important; } &:focus { - border: 1px solid ${colorPrimary} !important; + box-shadow: inset 0 0 0 1px ${colorPrimary} !important; } } `, diff --git a/.dumi/theme/slots/Header/index.tsx b/.dumi/theme/slots/Header/index.tsx index 9850087a0131..6f492550e5d9 100644 --- a/.dumi/theme/slots/Header/index.tsx +++ b/.dumi/theme/slots/Header/index.tsx @@ -25,15 +25,16 @@ const RESPONSIVE_SM = 1200; const locales = { cn: { - message: - '语雀公益计划:大学生认证教育邮箱,即可免费获得语雀会员。语雀,支付宝匠心打造的在线文档平台。', - shortMessage: '支付宝语雀 · 大学生公益计划火热进行中!', - more: '了解更多', + message: '第十八届 D2 终端技术大会火热来袭,以技术会友,一起分享技术的乐趣。', + shortMessage: '第十八届 D2 终端技术大会火热来袭!', + more: '点击报名', + link: 'https://d2.alibabatech.com/', }, en: { message: '', shortMessage: '', more: '', + link: '', }, }; @@ -366,26 +367,21 @@ const Header: React.FC = () => { )} {isZhCN && bannerVisible && ( - + - yuque {isMobile ? locale.shortMessage : locale.message} { window.gtag?.('event', '点击', { event_category: 'top_banner', - event_label: 'https://www.yuque.com/yuque/blog/welfare-edu?source=antd', + event_label: locale.link, }); }} > diff --git a/.eslintrc.js b/.eslintrc.js index 12e49328d21e..ca15e6624923 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -25,7 +25,16 @@ module.exports = { }, }, parser: '@typescript-eslint/parser', - plugins: ['react', '@babel', 'jest', '@typescript-eslint', 'react-hooks', 'unicorn', 'markdown'], + plugins: [ + 'react', + '@babel', + 'jest', + '@typescript-eslint', + 'react-hooks', + 'unicorn', + 'markdown', + 'lodash', + ], // https://github.com/typescript-eslint/typescript-eslint/issues/46#issuecomment-470486034 overrides: [ { @@ -156,6 +165,7 @@ module.exports = { 'react/no-unused-class-component-methods': 0, 'import/extensions': 0, 'import/no-cycle': 2, + 'lodash/import-scope': 2, 'import/no-extraneous-dependencies': [ 'error', { diff --git a/.github/lock.yml b/.github/lock.yml deleted file mode 100644 index e5b9a627f1e1..000000000000 --- a/.github/lock.yml +++ /dev/null @@ -1,14 +0,0 @@ -# Configuration for lock-threads - https://github.com/dessant/lock-threads - -# Number of days of inactivity before a closed issue or pull request is locked -daysUntilLock: 365 -# Comment to post before locking. Set to `false` to disable -lockComment: > - This thread has been automatically locked because it has not had recent - activity. Please open a new issue for related bugs and link to relevant - comments in this thread. -# Issues or pull requests with these labels will not be locked -# exemptLabels: -# - no-locking -# Limit to only `issues` or `pulls` -only: issues diff --git a/.github/tests_checker.yml b/.github/tests_checker.yml deleted file mode 100644 index 46378d7461df..000000000000 --- a/.github/tests_checker.yml +++ /dev/null @@ -1,3 +0,0 @@ -comment: 'Could you please add tests to make sure this change works as expected?', -fileExtensions: [.ts', '.tsx', '.json'] -testDir: '__tests__' diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 40f70446d23c..2f818e5a7cf8 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -40,7 +40,9 @@ jobs: body: | Hello @${{ github.event.issue.user.login }}. Please provide a online reproduction by forking codesandbox of [antd@5.x](https://u.ant.design/codesandbox-repro) or [antd@4.x](https://u.ant.design/codesandbox-repro-4x), or provide a minimal GitHub repository. Issues labeled by `Need Reproduce` will be closed if no activities in 3 days. - 你好 @${{ github.event.issue.user.login }}, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 [antd@5.x](https://u.ant.design/codesandbox-repro) 或 [antd@4.x](https://u.ant.design/codesandbox-repro-4x) 的 codesandbox,或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。 + 你好 @${{ github.event.issue.user.login }},我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 [antd@5.x](https://u.ant.design/codesandbox-repro) 或 [antd@4.x](https://u.ant.design/codesandbox-repro-4x) 的 codesandbox,或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。 + + > [什么是最小化重现,为什么这是必需的?](https://github.com/ant-design/ant-design/wiki/%E4%BB%80%E4%B9%88%E6%98%AF%E6%9C%80%E5%B0%8F%E5%8C%96%E9%87%8D%E7%8E%B0%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E8%BF%99%E6%98%AF%E5%BF%85%E9%9C%80%E7%9A%84%EF%BC%9F) ![](https://gw.alipayobjects.com/zos/antfincdn/y9kwg7DVCd/reproduce.gif) diff --git a/.github/workflows/pr-open-check.yml b/.github/workflows/pr-open-check.yml index 2c6c89b3c9f8..f30c621392ad 100644 --- a/.github/workflows/pr-open-check.yml +++ b/.github/workflows/pr-open-check.yml @@ -19,10 +19,13 @@ jobs: refuse-issue-label: '🎱 Collaborate PR only' need-creator-authority: 'write' comment: | - Hi @${{ github.event.pull_request.user.login }}. The issue mentioned in this PR needs to be confirmed with the designer or core team. This PR is temporarily not accepted. Thank you again for your contribution! 😊 + Hi @${{ github.event.pull_request.user.login }}. The issue mentioned in this PR needs to be confirmed with the designer or core team. Thank you for your contribution! 😊 - 你好 @${{ github.event.pull_request.user.login }}。这个 PR 提及的 issue 需要和设计师或核心团队进行确认,暂时不接受 PR,再次感谢你的贡献!😊 - close: true + 你好 @${{ github.event.pull_request.user.login }}。这个 PR 提及的 issue 需要和设计师或核心团队进行确认!感谢您的贡献!😊 + close: false + reviewers: | + MadCcc + zombieJ check-changelog: permissions: diff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.yml index 2c6910ea67e3..faff89343859 100644 --- a/.github/workflows/preview-deploy.yml +++ b/.github/workflows/preview-deploy.yml @@ -74,6 +74,7 @@ jobs: # Download site artifact - name: download site artifact + if: ${{ fromJSON(needs.upstream-workflow-summary.outputs.build-success) }} uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow_run.workflow_id }} @@ -81,7 +82,6 @@ jobs: name: site - name: upload surge service - if: ${{ fromJSON(needs.upstream-workflow-summary.outputs.build-success) }} id: deploy continue-on-error: true run: | diff --git a/.github/workflows/upgrade-deps.yml b/.github/workflows/upgrade-deps.yml new file mode 100644 index 000000000000..d6169a8c6b2d --- /dev/null +++ b/.github/workflows/upgrade-deps.yml @@ -0,0 +1,60 @@ +name: Upgrade Dependencies + +on: + schedule: + - cron: "0 18 * * *" # every day at 18:00 UTC + # - timezone: Asia/Shanghai # not supported yet https://github.com/orgs/community/discussions/13454 + +jobs: + upgrade-deps: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + permissions: + pull-requests: write # for peter-evans/create-pull-request to create PRs + contents: write # for git push + steps: + - name: checkout + uses: actions/checkout@v4 + with: + sparse-checkout: | + .github + .ncurc.js + package.json + + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: upgrade deps + id: upgrade + run: | + if [ ! -d .tmp ] ; then + mkdir .tmp + fi + $(npx npm-check-updates -u > .tmp/upgrade-deps-logs.txt) 2>&1 || true + if [ -s .tmp/upgrade-deps-logs.txt ]; then + cat .tmp/upgrade-deps-logs.txt + echo "logs<> $GITHUB_OUTPUT + cat .tmp/upgrade-deps-logs.txt >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + fi + + - name: create pull request + id: cpr + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} # Cannot be default!!! + assignees: 'afc163, zombieJ, xrkffgg, MadCcc' + title: "chore: upgrade deps" + commit-message: "chore: upgrade deps" + body: | + Upgrade dependencies + + ``` + ${{ steps.upgrade.outputs.logs }} + ``` + branch: auto-upgrade-deps + delete-branch: true + add-paths: | + package.json diff --git a/.ncurc.js b/.ncurc.js new file mode 100644 index 000000000000..a521db4d8050 --- /dev/null +++ b/.ncurc.js @@ -0,0 +1,29 @@ +// doc: https://github.com/raineorshine/npm-check-updates/tree/v16.14.6#readme +const path = require('path'); + +const rcOrg = ['@rc-component/', 'rc-']; +const check = ['@ant-design/', ...rcOrg]; + +// rules: https://github.com/ant-design/ant-design/pull/45593#issuecomment-1784891887 +module.exports = { + packageFile: path.resolve(__dirname, './package.json'), + upgrade: false, // use `npx npm-check-updates -u` to upgrade + packageManager: 'npm', + dep: ['prod'], // check only prod dependencies + // https://github.com/raineorshine/npm-check-updates#filter + filter: (name) => check.some((prefix) => name.startsWith(prefix)), + // https://github.com/raineorshine/npm-check-updates#target + target: (name, semver) => { + const { operator } = semver[0] ?? {}; + + // rc-component + if (rcOrg.some((prefix) => name.startsWith(prefix))) { + // `^` always upgrade latest, otherwise follow semver. + if (operator === '^') { + return 'latest'; + } + } + + return 'semver'; + }, +}; diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index dfdafd7ce544..d20a9a1d8f3d 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -16,6 +16,75 @@ tag: vVERSION --- +## 5.11.2 + +`2023-11-17` + +- 🆕 Table with `virtual` can now customize `components` except the `components.body`. [#45857](https://github.com/ant-design/ant-design/pull/45857) +- 🐞 Fix Button with href and disabled that could be focused. [#45910](https://github.com/ant-design/ant-design/pull/45910) [@MadCcc](https://github.com/MadCcc) +- 🐞 Fix `zIndex` logic problem that message and notification are covered when multiple Modal are opened. [#45911](https://github.com/ant-design/ant-design/pull/45911) [#45864](https://github.com/ant-design/ant-design/pull/45864) [@kiner-tang](https://github.com/kiner-tang) +- 💄 Fix QRCode `style.padding` is not working. [#45815](https://github.com/ant-design/ant-design/pull/45815) +- 💄 Optimize Carousel dots border radius style. [#45817](https://github.com/ant-design/ant-design/pull/45817) +- TypeScript + - 🤖 Optimize List `gutter` property type definition. [#45791](https://github.com/ant-design/ant-design/pull/45791) [@Asanio06](https://github.com/Asanio06) + +## 5.11.1 + +`2023-11-09` + +- 🐞 Fix Dropdown use wrong `zIndex` when nest items. [#45761](https://github.com/ant-design/ant-design/pull/45761) +- 🐞 Fix Upload should show remove icon when `showRemoveIcon` is specified to true explicitly. [#45752](https://github.com/ant-design/ant-design/pull/45752) +- 🐞 Fix Descriptions use `children` structure missing the Descriptions.Item `key` prop. [#45757](https://github.com/ant-design/ant-design/pull/45757) +- 🐞 Fix Message that token specified in component scope not work. [#45721](https://github.com/ant-design/ant-design/pull/45721) [@MadCcc](https://github.com/MadCcc) +- 🐞 Fix Popconfirm not compatible with `visible` prop. [#45702](https://github.com/ant-design/ant-design/pull/45702) [@linhf123](https://github.com/linhf123) +- 🐞 Fix Tag default background color not correct. [#45711](https://github.com/ant-design/ant-design/pull/45711) [@kiner-tang](https://github.com/kiner-tang) +- 💄 Fix Notification that `style.width` not work. [#45681](https://github.com/ant-design/ant-design/pull/45681) [@MadCcc](https://github.com/MadCcc) +- 🐞 Fix App console unexpected attr warning when set `component=false`. [#45671](https://github.com/ant-design/ant-design/pull/45671) [@li-jia-nan](https://github.com/li-jia-nan) +- TypeScript + - 🤖 App support generic type definition. [#45669](https://github.com/ant-design/ant-design/pull/45669) [@JexLau](https://github.com/JexLau) + +## 5.11.0 + +`2023-11-03` + +- Slider + - 🆕 Slider will show tooltip when focus handler. [#45653](https://github.com/ant-design/ant-design/pull/45653) + - 💄 Slider handler should be movable after click tracker. [#45651](https://github.com/ant-design/ant-design/pull/45651) +- InputNumber + - 🆕 InputNumber support `changeOnBlur` prop to disable trigger `onChange` event when blur. [#45395](https://github.com/ant-design/ant-design/pull/45395) + - 🐞 Fix InputNumber in Form with `hasFeedback` that will lose focus when feedback icon appear. [#45632](https://github.com/ant-design/ant-design/pull/45632) [@MadCcc](https://github.com/MadCcc) + - 🐞 Fix InputNumber dynamic modify `formatter` not working. [#45325](https://github.com/ant-design/ant-design/pull/45325) +- Table + - 🆕 Table `columnTitle` support render function. [#41937](https://github.com/ant-design/ant-design/pull/41937) [@Zhou-Bill](https://github.com/Zhou-Bill) + - 🛠 Refactor Table `ref` to support `scrollTo` to scroll to target `key` or `index` or `top`. [#45245](https://github.com/ant-design/ant-design/pull/45245) +- Tabs + - 🆕 Tabs `items` support tab pane level `destroyInactiveTabPane`. [#45359](https://github.com/ant-design/ant-design/pull/45359) + - 🐞 Fix Tabs overflow blinking when Tab bar has decimal width. [#45370](https://github.com/ant-design/ant-design/pull/45370) +- ConfigProvider + - 🆕 ConfigProvider support RangePicker `className` and `style` properties. [#45479](https://github.com/ant-design/ant-design/pull/45479) [@chenzhuo198](https://github.com/chenzhuo198) + - 🆕 ConfigProvider support Dropdown `className` and `style` properties. [#45621](https://github.com/ant-design/ant-design/pull/45621) [@li-jia-nan](https://github.com/li-jia-nan) +- 🆕 ColorPicker `preset` prop support `defaultOpen` to control whether preset colors is open by default. [#45607](https://github.com/ant-design/ant-design/pull/45607) [@Wxh16144](https://github.com/Wxh16144) +- 🆕 Select support `optionRender` prop. [#45529](https://github.com/ant-design/ant-design/pull/45529) [@RedJue](https://github.com/RedJue) +- 🆕 Pagination support combine `simple` and `showSizeChanger`. [#45538](https://github.com/ant-design/ant-design/pull/45538) +- 🆕 Spin support `fullscreen` to display as backdrop. [#44986](https://github.com/ant-design/ant-design/pull/44986) [@Rafael-Martins](https://github.com/Rafael-Martins) [#45436](https://github.com/ant-design/ant-design/pull/45436) [@li-jia-nan](https://github.com/li-jia-nan) +- 🆕 Form `validateFields` support `dirty` for validating touched and validated fields. [#45389](https://github.com/ant-design/ant-design/pull/45389) +- 🆕 Watermark support `inherit` prop to disable watermark pass to Drawer and Modal. [#45319](https://github.com/ant-design/ant-design/pull/45319) +- 🆕 App support `component` for customization. [#45292](https://github.com/ant-design/ant-design/pull/45292) +- 🆕 Input and Input.TextArea support `count` custom character count (for example, fix emoji character length to `1`); `count.max` supports out-of-range styles; restore emoji to native count to solve the problem of `maxLength` and `value` mismatch. [#45140](https://github.com/ant-design/ant-design/pull/45140) +- 🐞 Fix Dropdown not trigger `onOpenChange` when click menu item to close the popup. [#45378](https://github.com/ant-design/ant-design/pull/45378) +- 💄 Modal static function support `styles`. [#45558](https://github.com/ant-design/ant-design/pull/45558) [@KotoriK](https://github.com/KotoriK) +- 💄 Optimize z-index logic of popup components, and make them don't block each other by default. [#45512](https://github.com/ant-design/ant-design/pull/45512) [#45490](https://github.com/ant-design/ant-design/pull/45490) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Menu. [#45498](https://github.com/ant-design/ant-design/pull/45498) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of DatePicker and TimePicker. [#45497](https://github.com/ant-design/ant-design/pull/45497) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Drawer. [#45496](https://github.com/ant-design/ant-design/pull/45496) [#45417](https://github.com/ant-design/ant-design/pull/45417) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Cascader, TreeSelect and AutoComplete. [#45494](https://github.com/ant-design/ant-design/pull/45494) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Dropdown. [#45486](https://github.com/ant-design/ant-design/pull/45486) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Tour. [#45425](https://github.com/ant-design/ant-design/pull/45425) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Tooltip. [#45422](https://github.com/ant-design/ant-design/pull/45422) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Popover. [#45420](https://github.com/ant-design/ant-design/pull/45420) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Popconfirm. [#45421](https://github.com/ant-design/ant-design/pull/45421) [@kiner-tang](https://github.com/kiner-tang) + - Optimize z-index logic of Modal and Select. [#45346](https://github.com/ant-design/ant-design/pull/45346) [@kiner-tang](https://github.com/kiner-tang) + ## 5.10.3 `2023-10-30` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index cb605d6f3953..62fc02ceb9ff 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -16,6 +16,75 @@ tag: vVERSION --- +## 5.11.2 + +`2023-11-17` + +- 🆕 放开 Table `virtual` 下 `components` 的限制,现在除了 `components.body` 都可以自定义。[#45857](https://github.com/ant-design/ant-design/pull/45857) +- 🐞 修复 Button 带有链接且禁用时可以被聚焦到的问题。[#45910](https://github.com/ant-design/ant-design/pull/45910) [@MadCcc](https://github.com/MadCcc) +- 🐞 修复 `zIndex` 逻辑,解决多层 Modal 打开时,message 与 notification 被遮盖的问题。[#45911](https://github.com/ant-design/ant-design/pull/45911) [#45864](https://github.com/ant-design/ant-design/pull/45864) [@kiner-tang](https://github.com/kiner-tang) +- 💄 修复 QRCode 设置 `style.padding` 时无效的问题。[#45815](https://github.com/ant-design/ant-design/pull/45815) +- 💄 优化 Carousel 切换条圆角样式。[#45817](https://github.com/ant-design/ant-design/pull/45817) +- TypeScript + - 🤖 优化 List 属性 `gutter` 的类型定义。[#45791](https://github.com/ant-design/ant-design/pull/45791) [@Asanio06](https://github.com/Asanio06) + +## 5.11.1 + +`2023-11-09` + +- 🐞 修复 Dropdown 在嵌套列表时 `zIndex` 错误的问题。[#45761](https://github.com/ant-design/ant-design/pull/45761) +- 🐞 修复 Upload 显式指定 `showRemoveIcon: true` 时删除图标未显示的问题。[#45752](https://github.com/ant-design/ant-design/pull/45752) +- 🐞 修复 Descriptions 使用 `children` 结构语法糖时,会丢失 Descriptions.Item 的 `key` 的问题。[#45757](https://github.com/ant-design/ant-design/pull/45757) +- 🐞 修复 Message 组件在组件范围设置全局 `token` 无效的问题。[#45721](https://github.com/ant-design/ant-design/pull/45721) [@MadCcc](https://github.com/MadCcc) +- 🐞 修复 Popconfirm 不兼容 `visible` 的问题。[#45702](https://github.com/ant-design/ant-design/pull/45702) [@linhf123](https://github.com/linhf123) +- 🐞 修复默认 Tag 的背景颜色不正确的问题。[#45711](https://github.com/ant-design/ant-design/pull/45711) [@kiner-tang](https://github.com/kiner-tang) +- 💄 修复 Notification 组件设置 `style.width` 无效的问题。[#45681](https://github.com/ant-design/ant-design/pull/45681) [@MadCcc](https://github.com/MadCcc) +- 🐞 修复 App 设置 `component=false` 时,会报非预期的属性警告的问题。[#45671](https://github.com/ant-design/ant-design/pull/45671) [@li-jia-nan](https://github.com/li-jia-nan) +- TypeScript + - 🤖 App 支持泛型定义。[#45669](https://github.com/ant-design/ant-design/pull/45669) [@JexLau](https://github.com/JexLau) + +## 5.11.0 + +`2023-11-03` + +- Slider + - 🆕 Slider 聚焦滑块时现在会显示 Tooltip。[#45653](https://github.com/ant-design/ant-design/pull/45653) + - 💄 优化 Slider 交互体验,点击轨道后可直接拖拽滑块。[#45651](https://github.com/ant-design/ant-design/pull/45651) +- InputNumber + - 🆕 InputNumber 添加 `changeOnBlur` 属性以支持在失去焦点时不触发 `onChange` 事件。[#45395](https://github.com/ant-design/ant-design/pull/45395) + - 🐞 修复 InputNumber 组件在 Form 组件中使用并且启用 `hasFeedback` 时,反馈图标出现会使 InputNumber 失去焦点的问题。[#45632](https://github.com/ant-design/ant-design/pull/45632) [@MadCcc](https://github.com/MadCcc) + - 🐞 修复 InputNumber 动态改变 `formatter` 不生效的问题。[#45325](https://github.com/ant-design/ant-design/pull/45325) +- Table + - 🆕 Table 组件 `columnTitle` 支持传入 render 方法。[#41937](https://github.com/ant-design/ant-design/pull/41937) [@Zhou-Bill](https://github.com/Zhou-Bill) + - 🛠 重构 Table `ref` 支持 `scrollTo` 以滚动到目标 `key` 或 `index` 或 `top`。[#45245](https://github.com/ant-design/ant-design/pull/45245) +- Tabs + - 🆕 Tabs `items` 支持单个标签页设置 `destroyInactiveTabPane`。[#45359](https://github.com/ant-design/ant-design/pull/45359) + - 🐞 修复 Tabs 的标签宽度存在小数时,滚动会出现抖动的问题。[#45370](https://github.com/ant-design/ant-design/pull/45370) +- ConfigProvider + - 🆕 ConfigProvider 支持 RangePicker 组件的 `className` 和 `style` 属性。[#45479](https://github.com/ant-design/ant-design/pull/45479) [@chenzhuo198](https://github.com/chenzhuo198) + - 🆕 ConfigProvider 支持 Dropdown 组件的 `className` 和 `style` 属性。[#45621](https://github.com/ant-design/ant-design/pull/45621) [@li-jia-nan](https://github.com/li-jia-nan) +- 🆕 ColorPicker 组件 `preset` 新增 `defaultOpen` 属性,可控制预设颜色默认是否展开。[#45607](https://github.com/ant-design/ant-design/pull/45607) [@Wxh16144](https://github.com/Wxh16144) +- 🆕 Select 组件支持 `optionRender` 方法。[#45529](https://github.com/ant-design/ant-design/pull/45529) [@RedJue](https://github.com/RedJue) +- 🆕 Pagination 组件支持组合 `simple` 和 `showSizeChanger` 使用。[#45538](https://github.com/ant-design/ant-design/pull/45538) +- 🆕 Spin 组件新增 `fullscreen` 属性,支持全屏展示。[#44986](https://github.com/ant-design/ant-design/pull/44986) [@Rafael-Martins](https://github.com/Rafael-Martins) [#45436](https://github.com/ant-design/ant-design/pull/45436) [@li-jia-nan](https://github.com/li-jia-nan) +- 🆕 Form `validateFields` 支持 `dirty` 参数以校验被修改过和校验过的字段。[#45389](https://github.com/ant-design/ant-design/pull/45389) +- 🆕 Watermark 支持 `inherit` 配置,关闭水印传导至弹出 Drawer 与 Modal。[#45319](https://github.com/ant-design/ant-design/pull/45319) +- 🆕 App 支持 `component` 以自定义渲染元素。[#45292](https://github.com/ant-design/ant-design/pull/45292) +- 🆕 Input 与 Input.TextArea 支持 `count` 自定义字符计数(例如固定 emoji 字符长度为 `1`);`count.max` 支持超出范围样式;将 emoji 计数还原为原生计数以解决 `maxLength` 与 `value` 不匹配的问题。[#45140](https://github.com/ant-design/ant-design/pull/45140) +- 🐞 修复 Dropdown 在点击菜单项关闭弹出框时不会触发 `onOpenChange` 的问题。[#45378](https://github.com/ant-design/ant-design/pull/45378) +- 💄 Modal 静态方法支持 `styles` 属性。[#45558](https://github.com/ant-design/ant-design/pull/45558) [@KotoriK](https://github.com/KotoriK) +- 💄 优化弹层组件的 `z-index` 逻辑,使其在默认情况下不会互相遮挡。[#45512](https://github.com/ant-design/ant-design/pull/45512) [#45490](https://github.com/ant-design/ant-design/pull/45490) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Menu 组件 `z-index` 逻辑。[#45498](https://github.com/ant-design/ant-design/pull/45498) [@kiner-tang](https://github.com/kiner-tang) + - 优化 DatePicker、TimePicker 组件 `z-index` 逻辑。[#45497](https://github.com/ant-design/ant-design/pull/45497) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Drawer 组件 `z-index` 逻辑。[#45496](https://github.com/ant-design/ant-design/pull/45496) [#45417](https://github.com/ant-design/ant-design/pull/45417) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Cascader、TreeSelect、AutoComplete 组件 `z-index` 逻辑。[#45494](https://github.com/ant-design/ant-design/pull/45494) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Dropdown 组件 `z-index` 逻辑。[#45486](https://github.com/ant-design/ant-design/pull/45486) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Tour 组件 `z-index` 逻辑。[#45425](https://github.com/ant-design/ant-design/pull/45425) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Tooltip 组件 `z-index` 逻辑。[#45422](https://github.com/ant-design/ant-design/pull/45422) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Popover 组件 `z-index` 逻辑。[#45420](https://github.com/ant-design/ant-design/pull/45420) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Popconfirm 组件 `z-index` 逻辑。[#45421](https://github.com/ant-design/ant-design/pull/45421) [@kiner-tang](https://github.com/kiner-tang) + - 优化 Modal、Select 组件 `z-index` 逻辑。[#45346](https://github.com/ant-design/ant-design/pull/45346) [@kiner-tang](https://github.com/kiner-tang) + ## 5.10.3 `2023-10-30` diff --git a/README-zh_CN.md b/README-zh_CN.md index 1d9e5c6e417c..ff2c60baa56d 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -84,7 +84,7 @@ pnpm add antd ## 🔨 示例 -```jsx +```tsx import React from 'react'; import { Button, DatePicker } from 'antd'; @@ -94,6 +94,8 @@ const App = () => ( ); + +export default App; ``` ### 🌈 定制主题 @@ -102,7 +104,7 @@ const App = () => ( ### 🛡 TypeScript -参考 [在 TypeScript 中使用](https://ant.design/docs/react/use-in-typescript-cn)。 +`antd` 使用 TypeScript 编写,具有完整的类型定义,参考 [在 create-react-app 中使用](https://ant.design/docs/react/use-with-create-react-app-cn)。 ## 🌍 国际化 diff --git a/README.md b/README.md index 82971f3c6632..18fbbcd8ea7a 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ pnpm add antd ## 🔨 Usage -```jsx +```tsx import React from 'react'; import { Button, DatePicker } from 'antd'; @@ -94,11 +94,13 @@ const App = () => ( ); + +export default App; ``` ### TypeScript -`antd` is written in TypeScript with complete definitions, check [Use in TypeScript](https://ant.design/docs/react/use-in-typescript) to get started. +`antd` is written in TypeScript with complete definitions, check [Usage with create-react-app](https://ant.design/docs/react/use-with-create-react-app) to get started. ## 🌍 Internationalization @@ -146,11 +148,11 @@ Open your browser and visit http://127.0.0.1:8001 , see more at [Development](ht ## 🤝 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) -Read our [contributing guide](https://ant.design/docs/react/contributing) and let's build a better antd together. +Let's build a better antd together. -We welcome all contributions. Please read our [CONTRIBUTING.md](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/ant-design/ant-design/pulls) or as [GitHub issues](https://github.com/ant-design/ant-design/issues). If you'd like to improve code, check out the [Development Instructions](https://github.com/ant-design/ant-design/wiki/Development) and have a good time! :) +We welcome all contributions. Please read our [Contributing Guide](https://ant.design/docs/react/contributing) first. You can submit any ideas as [Pull Requests](https://github.com/ant-design/ant-design/pulls) or as [GitHub Issues](https://github.com/ant-design/ant-design/issues). If you'd like to improve code, check out the [Development Instructions](https://github.com/ant-design/ant-design/wiki/Development) and have a good time! :) -If you are a collaborator, please follow our [Pull Request principle](https://github.com/ant-design/ant-design/wiki/PR-principle) to create a Pull Request with [collaborator template](https://github.com/ant-design/ant-design/compare?expand=1&template=collaborator.md). +If you are a collaborator, please follow our [Pull Request Principle](https://github.com/ant-design/ant-design/wiki/PR-principle) to create a Pull Request with our [Pull Request Template](https://github.com/ant-design/ant-design/wiki/PR-principle#pull-request-template). [![Let's fund issues in this repository](https://raw.githubusercontent.com/BoostIO/issuehunt-materials/master/v1/issuehunt-button-v1.svg)](https://issuehunt.io/repos/34526884) diff --git a/components/_util/__tests__/useZIndex.test.tsx b/components/_util/__tests__/useZIndex.test.tsx new file mode 100644 index 000000000000..52df2a225245 --- /dev/null +++ b/components/_util/__tests__/useZIndex.test.tsx @@ -0,0 +1,358 @@ +import type { PropsWithChildren } from 'react'; +import React, { useEffect } from 'react'; +import { render } from '@testing-library/react'; +import type { MenuProps } from 'antd'; +import { + AutoComplete, + Cascader, + ColorPicker, + DatePicker, + Drawer, + Dropdown, + Menu, + Modal, + Popconfirm, + Popover, + Select, + Tooltip, + Tour, + TreeSelect, +} from 'antd'; + +import { waitFakeTimer } from '../../../tests/utils'; +import type { ZIndexConsumer, ZIndexContainer } from '../hooks/useZIndex'; +import { consumerBaseZIndexOffset, containerBaseZIndexOffset, useZIndex } from '../hooks/useZIndex'; +import zIndexContext from '../zindexContext'; + +const WrapWithProvider: React.FC> = ({ + children, + containerType, +}) => { + const [, contextZIndex] = useZIndex(containerType); + return {children}; +}; + +const containerComponent: Record< + ZIndexContainer, + React.FC> +> = { + Modal: ({ children, ...restProps }) => ( + + {children} + + ), + Drawer: ({ children, ...restProps }) => ( + + {children} + + ), + Popover: ({ children, ...restProps }) => ( + + {children} + + ), + Popconfirm: ({ children, ...restProps }) => ( + + {children} + + ), + Tooltip: ({ children, ...restProps }) => ( + + {children} + + ), + Tour: ({ children, ...restProps }) => ( + + ), +}; + +const options = [ + { + label: 'Option 1', + value: '1', + }, + { + label: 'Option 2', + value: '2', + }, +]; + +const items: MenuProps['items'] = [ + { + label: 'Test', + key: 'SubMenu', + children: [ + { + type: 'group', + label: 'Item 1', + children: [ + { + label: 'Option 1', + key: 'setting:1', + }, + { + label: 'Option 2', + key: 'setting:2', + }, + ], + }, + { + type: 'group', + label: 'Item 2', + children: [ + { + label: 'Option 3', + key: 'setting:3', + }, + { + label: 'Option 4', + key: 'setting:4', + }, + ], + }, + ], + }, +]; + +const consumerComponent: Record> = { + SelectLike: ({ rootClassName, ...props }) => ( + <> + + + + 12 / 10 + + + + +
+
+ Emoji count as length 1 +
+ + + + + 3 + + + +
+
+
+ Not exceed max +
+ + + + + 6 / 6 + + + +
+ +`; + +exports[`renders components/input/demo/advance-count.tsx extend context correctly 2`] = `[]`; + exports[`renders components/input/demo/align.tsx extend context correctly 1`] = ` Array [
@@ -10347,15 +10435,15 @@ Array [ 0 / 20 - , -
, -
, +