From 7ee9873a45a8e1237a22284ccb91a9850bc2b9e5 Mon Sep 17 00:00:00 2001 From: tinyfind <67093787+tinyfind@users.noreply.github.com> Date: Tue, 8 Nov 2022 20:26:26 +0800 Subject: [PATCH 01/24] fix: Paragraph break-word (#38439) --- components/typography/style/index.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/typography/style/index.less b/components/typography/style/index.less index 4469781712..679e8b0a0f 100644 --- a/components/typography/style/index.less +++ b/components/typography/style/index.less @@ -6,7 +6,7 @@ // =============== Basic =============== .@{typography-prefix-cls} { color: @text-color; - overflow-wrap: break-word; + word-break: break-word; &&-secondary { color: @text-color-secondary; From d5b16f336707a92f1dfb47aac174d467621207c0 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 8 Nov 2022 23:23:21 +0800 Subject: [PATCH 02/24] ci: add next notice (#38443) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: add next notice * Update release-helper.yml Co-authored-by: 二货爱吃白萝卜 --- .github/workflows/release-helper.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-helper.yml b/.github/workflows/release-helper.yml index 5303b693e9..9995712fb9 100644 --- a/.github/workflows/release-helper.yml +++ b/.github/workflows/release-helper.yml @@ -34,7 +34,18 @@ jobs: prettier: true prerelease-filter: '-, a, b, A, B' - - name: release bigfish + - name: notice next + uses: actions-cool/release-helper@v2 + with: + triger: 'tag' + dingding-token: ${{ secrets.DINGDING_BOT_V5_PRE_TOKEN }} + msg-title: '# Ant Design {{v}} 发布日志' + msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ' + msg-footer: '💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志' + prerelease-filter: '-, a, b, A, B' + prerelease-notice: true + + - name: notice bigfish uses: actions-cool/release-helper@v2 with: triger: 'tag' From cc67f63785ab9b058e10bc9533323fb6085d1124 Mon Sep 17 00:00:00 2001 From: Katsiaryna Pustakhod Date: Wed, 9 Nov 2022 02:42:10 +0100 Subject: [PATCH 03/24] fix: Adds role progressbar to Progress component (#38447) * Add role to progress component * Update snapshots --- .../__snapshots__/components.test.tsx.snap | 7 ++++ .../__snapshots__/demo-extend.test.ts.snap | 35 +++++++++++++++++++ .../__tests__/__snapshots__/demo.test.ts.snap | 35 +++++++++++++++++++ .../__snapshots__/index.test.tsx.snap | 18 ++++++++++ components/progress/progress.tsx | 1 + .../__snapshots__/demo-extend.test.ts.snap | 6 ++++ .../__tests__/__snapshots__/demo.test.ts.snap | 6 ++++ 7 files changed, 108 insertions(+) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap index 240198aa7e..a3563950ac 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap @@ -22170,6 +22170,7 @@ exports[`ConfigProvider components Popover prefixCls 1`] = ` exports[`ConfigProvider components Progress configProvider 1`] = `
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
= (props: ProgressProps) => { 'successPercent', ])} className={classString} + role="progressbar" > {progress}
diff --git a/components/steps/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/steps/__tests__/__snapshots__/demo-extend.test.ts.snap index 73345d4236..82d4bb46a0 100644 --- a/components/steps/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/steps/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1200,6 +1200,7 @@ Array [ >
Date: Wed, 9 Nov 2022 03:44:13 +0200 Subject: [PATCH 04/24] docs: Update index.en-US.md (#38445) Fix steps docs --- components/steps/index.en-US.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/steps/index.en-US.md b/components/steps/index.en-US.md index 8a89614846..514f251b24 100644 --- a/components/steps/index.en-US.md +++ b/components/steps/index.en-US.md @@ -22,7 +22,7 @@ ReactDOM.render( Date: Wed, 9 Nov 2022 17:36:49 +0800 Subject: [PATCH 09/24] chore: type optimization (#38460) --- components/_util/getRenderPropValue.ts | 5 ++--- components/_util/hooks/useSyncState.ts | 4 ++-- components/badge/ScrollNumber.tsx | 2 +- components/dropdown/dropdown.tsx | 2 +- components/input/hooks/useRemovePasswordTimeout.ts | 11 ++++++++--- components/modal/useModal/index.tsx | 6 +++--- components/timeline/Timeline.tsx | 2 +- components/typography/hooks/useMergedConfig.ts | 6 +++--- components/typography/hooks/useUpdatedEffect.ts | 4 +++- 9 files changed, 24 insertions(+), 18 deletions(-) diff --git a/components/_util/getRenderPropValue.ts b/components/_util/getRenderPropValue.ts index 50b2e6de9e..fe673166b5 100644 --- a/components/_util/getRenderPropValue.ts +++ b/components/_util/getRenderPropValue.ts @@ -9,9 +9,8 @@ export const getRenderPropValue = ( return null; } - const isRenderFunction = typeof propValue === 'function'; - if (isRenderFunction) { - return (propValue as RenderFunction)(); + if (typeof propValue === 'function') { + return propValue(); } return propValue; diff --git a/components/_util/hooks/useSyncState.ts b/components/_util/hooks/useSyncState.ts index cbb6434ba3..03fcb47097 100644 --- a/components/_util/hooks/useSyncState.ts +++ b/components/_util/hooks/useSyncState.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import useForceUpdate from './useForceUpdate'; -type UseSyncStateProps = [() => T, (newValue: T) => void]; +type UseSyncStateProps = readonly [() => T, (newValue: T) => void]; export default function useSyncState(initialValue: T): UseSyncStateProps { const ref = React.useRef(initialValue); @@ -14,5 +14,5 @@ export default function useSyncState(initialValue: T): UseSyncStateProps { // re-render forceUpdate(); }, - ]; + ] as const; } diff --git a/components/badge/ScrollNumber.tsx b/components/badge/ScrollNumber.tsx index f5cd1f5fb6..6e09cc2f44 100644 --- a/components/badge/ScrollNumber.tsx +++ b/components/badge/ScrollNumber.tsx @@ -75,7 +75,7 @@ const ScrollNumber: React.FC = ({ className: classNames(`${prefixCls}-custom-component`, oriProps?.className, motionClassName), })); } - return React.createElement(component as any, newProps, numberNodes); + return React.createElement(component, newProps, numberNodes); }; export default ScrollNumber; diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 42601aba60..f3f02f7d7d 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -213,7 +213,7 @@ const Dropdown: DropdownInterface = props => { if (menu?.items) { overlayNode = ; } else if (typeof overlay === 'function') { - overlayNode = (overlay as OverlayFunc)(); + overlayNode = overlay(); } else { overlayNode = overlay; } diff --git a/components/input/hooks/useRemovePasswordTimeout.ts b/components/input/hooks/useRemovePasswordTimeout.ts index 660d72bcb2..c3d6006798 100644 --- a/components/input/hooks/useRemovePasswordTimeout.ts +++ b/components/input/hooks/useRemovePasswordTimeout.ts @@ -5,10 +5,10 @@ export default function useRemovePasswordTimeout( inputRef: React.RefObject, triggerOnMount?: boolean, ) { - const removePasswordTimeoutRef = useRef([]); + const removePasswordTimeoutRef = useRef([]); const removePasswordTimeout = () => { removePasswordTimeoutRef.current.push( - window.setTimeout(() => { + setTimeout(() => { if ( inputRef.current?.input && inputRef.current?.input.getAttribute('type') === 'password' && @@ -25,7 +25,12 @@ export default function useRemovePasswordTimeout( removePasswordTimeout(); } - return () => removePasswordTimeoutRef.current.forEach(item => window.clearTimeout(item)); + return () => + removePasswordTimeoutRef.current.forEach(timer => { + if (timer) { + clearTimeout(timer); + } + }); }, []); return removePasswordTimeout; diff --git a/components/modal/useModal/index.tsx b/components/modal/useModal/index.tsx index d51b7a19dc..97cf0fa29e 100644 --- a/components/modal/useModal/index.tsx +++ b/components/modal/useModal/index.tsx @@ -28,7 +28,7 @@ const ElementsHolder = React.memo( ); export default function useModal(): [Omit, React.ReactElement] { - const holderRef = React.useRef(null as any); + const holderRef = React.useRef(null); // ========================== Effect ========================== const [actionQueue, setActionQueue] = React.useState<(() => void)[]>([]); @@ -52,14 +52,14 @@ export default function useModal(): [Omit, React.R const modalRef = React.createRef(); - let closeFunc: Function; + let closeFunc: Function | undefined; const modal = ( { - closeFunc(); + closeFunc?.(); }} /> ); diff --git a/components/timeline/Timeline.tsx b/components/timeline/Timeline.tsx index ca8f55a674..090f1a4e73 100644 --- a/components/timeline/Timeline.tsx +++ b/components/timeline/Timeline.tsx @@ -45,7 +45,7 @@ const Timeline: TimelineType = props => { ) : null; const timeLineItems = React.Children.toArray(children); - timeLineItems.push(pendingItem as any); + timeLineItems.push(pendingItem!); if (reverse) { timeLineItems.reverse(); } diff --git a/components/typography/hooks/useMergedConfig.ts b/components/typography/hooks/useMergedConfig.ts index 66c5b02fc7..bd16c97e62 100644 --- a/components/typography/hooks/useMergedConfig.ts +++ b/components/typography/hooks/useMergedConfig.ts @@ -3,8 +3,8 @@ import * as React from 'react'; export default function useMergedConfig( propConfig: any, templateConfig?: Target, -): [boolean, Target] { - return React.useMemo(() => { +): readonly [boolean, Target] { + return React.useMemo(() => { const support = !!propConfig; return [ @@ -13,6 +13,6 @@ export default function useMergedConfig( ...templateConfig, ...(support && typeof propConfig === 'object' ? propConfig : null), }, - ]; + ] as const; }, [propConfig]); } diff --git a/components/typography/hooks/useUpdatedEffect.ts b/components/typography/hooks/useUpdatedEffect.ts index 53141df476..ec85286161 100644 --- a/components/typography/hooks/useUpdatedEffect.ts +++ b/components/typography/hooks/useUpdatedEffect.ts @@ -1,7 +1,7 @@ import * as React from 'react'; /** Similar with `useEffect` but only trigger after mounted */ -export default (callback: () => void, conditions: any[]) => { +const useUpdatedEffect = (callback: () => void, conditions?: React.DependencyList) => { const mountRef = React.useRef(false); React.useEffect(() => { @@ -12,3 +12,5 @@ export default (callback: () => void, conditions: any[]) => { } }, conditions); }; + +export default useUpdatedEffect; From b0598e0d419ee29a0f547b4d828631bce222c344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <7971419+crazyair@users.noreply.github.com> Date: Wed, 9 Nov 2022 23:13:54 +0800 Subject: [PATCH 10/24] fix: List key (#38431) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复 key * feat: remove old key * feat: test * feat: test * feat: test --- components/list/__tests__/Item.test.tsx | 30 +++++++++++++++++++++++-- components/list/index.tsx | 19 +++++++--------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/components/list/__tests__/Item.test.tsx b/components/list/__tests__/Item.test.tsx index da73059628..2bf574d1c9 100644 --- a/components/list/__tests__/Item.test.tsx +++ b/components/list/__tests__/Item.test.tsx @@ -1,6 +1,6 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import List from '..'; -import { render } from '../../../tests/utils'; +import { pureRender, render } from '../../../tests/utils'; import ConfigProvider from '../../config-provider'; describe('List Item Layout', () => { @@ -204,4 +204,30 @@ describe('List Item Layout', () => { ); expect(ref.current).toHaveClass('ant-col'); }); + it('react key', () => { + const loadId: number[] = []; + + const Demo = ({ id }: { id: number }) => { + useEffect(() => { + loadId.push(id); + }, []); + + return
{id}
; + }; + const getDom = (id = 1) => ( + item.id} + renderItem={item => ( + + + + )} + /> + ); + const { rerender } = pureRender(getDom(1)); + rerender(getDom(3)); + rerender(getDom(5)); + expect(loadId).toEqual([1, 3, 5]); + }); }); diff --git a/components/list/index.tsx b/components/list/index.tsx index 32d12e0761..28c002067c 100644 --- a/components/list/index.tsx +++ b/components/list/index.tsx @@ -104,8 +104,6 @@ function List({ total: 0, }; - const listItemsKeys: { [index: number]: React.Key } = {}; - const triggerPaginationEvent = (eventName: string) => (page: number, pageSize: number) => { setPaginationCurrent(page); setPaginationSize(pageSize); @@ -135,9 +133,7 @@ function List({ key = `list-item-${index}`; } - listItemsKeys[index] = key; - - return renderItem(item, index); + return {renderItem(item, index)}; }; const isSomethingAfterLastItem = () => !!(loadMore || pagination || footer); @@ -249,13 +245,14 @@ function List({ let childrenContent = isLoading &&
; if (splitDataSource.length > 0) { const items = splitDataSource.map((item: T, index: number) => renderInnerItem(item, index)); - const childrenList = React.Children.map(items, (child: React.ReactNode, index: number) => ( -
- {child} -
- )); childrenContent = grid ? ( - {childrenList} + + {React.Children.map(items, child => ( +
+ {child} +
+ ))} +
) : (
    {items}
); From 8af0b4f1f2524ed6ecfd638c0e6226e697a137c3 Mon Sep 17 00:00:00 2001 From: JarvisArt <38420763+JarvisArt@users.noreply.github.com> Date: Thu, 10 Nov 2022 14:35:29 +0800 Subject: [PATCH 11/24] fix: The image preview operations are occluded (#38456) --- components/image/style/index.less | 9 ++++++--- package.json | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/image/style/index.less b/components/image/style/index.less index e9fa207d17..0cb27876f5 100644 --- a/components/image/style/index.less +++ b/components/image/style/index.less @@ -105,16 +105,19 @@ z-index: @zindex-image; } - &-operations { - .reset-component(); + &-operations-wrapper { position: fixed; top: 0; right: 0; z-index: @zindex-image + 1; + width: 100%; + } + + &-operations { + .reset-component(); display: flex; flex-direction: row-reverse; align-items: center; - width: 100%; color: @image-preview-operation-color; list-style: none; background: fade(@modal-mask-bg, 10%); diff --git a/package.json b/package.json index 7111320bfe..b15c98fe09 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,7 @@ "rc-drawer": "~6.0.0", "rc-dropdown": "~4.0.0", "rc-field-form": "~1.27.0", - "rc-image": "~5.10.0", + "rc-image": "~5.11.0", "rc-input": "~0.1.4", "rc-input-number": "~7.3.9", "rc-mentions": "~1.10.0", From ad34e27d42b787209c3624934cf243fc543472b5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 10 Nov 2022 19:15:35 +0800 Subject: [PATCH 12/24] chore: add Codeball Suggester --- .github/workflows/codeball.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/codeball.yml b/.github/workflows/codeball.yml index 8fb735a1ce..93d22951f9 100644 --- a/.github/workflows/codeball.yml +++ b/.github/workflows/codeball.yml @@ -14,6 +14,9 @@ jobs: - name: Codeball uses: sturdy-dev/codeball-action@v2 with: + # Settings for "Codeball Suggester" + codeSuggestionsFromComments: "true" + # Settings for "Codeball Approver" approvePullRequests: "true" labelPullRequestsWhenApproved: "true" labelPullRequestsWhenReviewNeeded: "false" From e62624434e3b8c71ece6939510b74ded532da0e1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 10 Nov 2022 19:18:14 +0800 Subject: [PATCH 13/24] chore: remove Codeball Suggester, it is not free.. --- .github/workflows/codeball.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/codeball.yml b/.github/workflows/codeball.yml index 93d22951f9..007eb9ac88 100644 --- a/.github/workflows/codeball.yml +++ b/.github/workflows/codeball.yml @@ -14,10 +14,8 @@ jobs: - name: Codeball uses: sturdy-dev/codeball-action@v2 with: - # Settings for "Codeball Suggester" - codeSuggestionsFromComments: "true" # Settings for "Codeball Approver" approvePullRequests: "true" labelPullRequestsWhenApproved: "true" - labelPullRequestsWhenReviewNeeded: "false" + labelPullRequestsWhenReviewNeeded: "true" failJobsWhenReviewNeeded: "false" From d5e3f1e6deb5329b5a4856b37ce7485fd87b14c8 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 10 Nov 2022 19:23:12 +0800 Subject: [PATCH 14/24] Update codeball.yml --- .github/workflows/codeball.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeball.yml b/.github/workflows/codeball.yml index 007eb9ac88..1e796958b0 100644 --- a/.github/workflows/codeball.yml +++ b/.github/workflows/codeball.yml @@ -15,7 +15,7 @@ jobs: uses: sturdy-dev/codeball-action@v2 with: # Settings for "Codeball Approver" - approvePullRequests: "true" + approvePullRequests: "false" labelPullRequestsWhenApproved: "true" labelPullRequestsWhenReviewNeeded: "true" failJobsWhenReviewNeeded: "false" From 07462491ab53c8d34171325b21f07580b3324362 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 10 Nov 2022 19:27:36 +0800 Subject: [PATCH 15/24] fix: Result should hide icon when it is falsy (#38488) close #38484 --- components/result/__tests__/index.test.tsx | 7 +++++++ components/result/index.tsx | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/components/result/__tests__/index.test.tsx b/components/result/__tests__/index.test.tsx index 44d74cc33e..fb64c42942 100644 --- a/components/result/__tests__/index.test.tsx +++ b/components/result/__tests__/index.test.tsx @@ -67,4 +67,11 @@ describe('Result', () => { warnSpy.mockRestore(); }); + + it('should hide icon by setting icon to false or null', () => { + const { container } = render(); + expect(container.querySelectorAll('.ant-result-icon')).toHaveLength(0); + const { container: container2 } = render(); + expect(container2.querySelectorAll('.ant-result-icon')).toHaveLength(0); + }); }); diff --git a/components/result/index.tsx b/components/result/index.tsx index a8ec027b32..fd42c07a01 100644 --- a/components/result/index.tsx +++ b/components/result/index.tsx @@ -73,10 +73,15 @@ const Icon: React.FC = ({ prefixCls, icon, status }) => {
); } + const iconNode = React.createElement( IconMap[status as Exclude], ); + if (icon === null || icon === false) { + return null; + } + return
{icon || iconNode}
; }; From d52b8c6afbb0d517b5351ec4c4c2a7a37bb0f5b7 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Fri, 11 Nov 2022 18:15:02 +0800 Subject: [PATCH 16/24] type: type optimization (#38510) --- components/_util/__tests__/util.test.tsx | 2 +- components/_util/__tests__/wave.test.tsx | 6 ++-- components/_util/wave.tsx | 2 +- .../config-provider/__tests__/form.test.tsx | 3 +- components/input/__tests__/focus.test.tsx | 3 +- components/layout/__tests__/index.test.tsx | 6 ++-- components/transfer/__tests__/list.test.tsx | 14 +++++++--- .../typography/__tests__/editable.test.tsx | 4 +-- .../typography/__tests__/ellipsis.test.tsx | 28 +++++++++---------- .../upload/__tests__/uploadlist.test.tsx | 2 +- .../template/Content/ComponentOverview.jsx | 2 +- 11 files changed, 40 insertions(+), 32 deletions(-) diff --git a/components/_util/__tests__/util.test.tsx b/components/_util/__tests__/util.test.tsx index 35ca704a63..419cc28703 100644 --- a/components/_util/__tests__/util.test.tsx +++ b/components/_util/__tests__/util.test.tsx @@ -152,7 +152,7 @@ describe('Test utils function', () => { describe('TransButton', () => { it('can be focus/blur', () => { - const ref = React.createRef(); + const ref = React.createRef(); render(TransButton); expect(typeof ref.current?.focus).toBe('function'); expect(typeof ref.current?.blur).toBe('function'); diff --git a/components/_util/__tests__/wave.test.tsx b/components/_util/__tests__/wave.test.tsx index 5028b7bcde..e23cf93495 100644 --- a/components/_util/__tests__/wave.test.tsx +++ b/components/_util/__tests__/wave.test.tsx @@ -174,7 +174,7 @@ describe('Wave component', () => { }); it('bindAnimationEvent should return when node is null', () => { - const ref = React.createRef(); + const ref = React.createRef(); render(