chore: auto merge branches (#51756)
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run

chore: merge master into feature
This commit is contained in:
github-actions[bot] 2024-11-24 17:37:12 +00:00 committed by GitHub
commit 2a48c0540c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 50 additions and 105 deletions

View File

@ -171,6 +171,7 @@ jobs:
run: bun run dist run: bun run dist
env: env:
NODE_OPTIONS: --max_old_space_size=4096 NODE_OPTIONS: --max_old_space_size=4096
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CI: 1 CI: 1
- name: check build files - name: check build files

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`react router react router 3 1`] = ` exports[`react router react router legacy 1`] = `
<nav <nav
class="ant-breadcrumb" class="ant-breadcrumb"
> >

View File

@ -1,29 +1,10 @@
import React, { useMemo } from 'react'; import React from 'react';
import type { RouterProps } from 'react-router-dom'; import { MemoryRouter, useLocation } from 'react-router-dom';
import { Link, MemoryRouter, Route, Routes, useLocation, useNavigate } from 'react-router-dom'; import type { Location as ReactRouterLocation } from 'react-router-dom';
import { fireEvent, render } from '../../../tests/utils'; import { render } from '../../../tests/utils';
import Breadcrumb from '../index'; import Breadcrumb from '../index';
const Apps: React.FC = () => (
<ul className="app-list">
<li>
<Link to="/apps/1">Application1</Link><Link to="/apps/1/detail">Detail</Link>
</li>
<li>
<Link to="/apps/2">Application2</Link><Link to="/apps/2/detail">Detail</Link>
</li>
</ul>
);
const breadcrumbNameMap = {
'/apps': 'Application List',
'/apps/1': 'Application1',
'/apps/2': 'Application2',
'/apps/1/detail': 'Detail',
'/apps/2/detail': 'Detail',
};
describe('react router', () => { describe('react router', () => {
beforeAll(() => { beforeAll(() => {
jest.useFakeTimers(); jest.useFakeTimers();
@ -33,63 +14,37 @@ describe('react router', () => {
jest.useRealTimers(); jest.useRealTimers();
}); });
it('react router 6', () => { it('memoizes the current location', () => {
const Home: React.FC = () => { let location1: ReactRouterLocation | undefined;
const location = useLocation(); const CaptureLocation1: React.FC = () => {
const navigate = useNavigate(); location1 = useLocation();
const pathSnippets = location.pathname.split('/').filter((i) => i); return null;
const extraBreadcrumbItems = pathSnippets.map((_, index) => {
const url = `/${pathSnippets.slice(0, index + 1).join('/')}`;
return (
<Breadcrumb.Item key={url}>
<Link to={url}>{breadcrumbNameMap[url as keyof typeof breadcrumbNameMap]}</Link>
</Breadcrumb.Item>
);
});
const breadcrumbItems = [
<Breadcrumb.Item key="home">
<Link to="/">Home</Link>
</Breadcrumb.Item>,
].concat(extraBreadcrumbItems);
const componentProps = useMemo<RouterProps>(
() => ({ component: Apps }) as unknown as RouterProps,
[],
);
const renderProps = useMemo<RouterProps>(
() => ({ render: () => <span>Home Page</span> }) as unknown as RouterProps,
[],
);
return (
<div className="demo">
<div className="demo-nav">
<a onClick={() => navigate('/')}>Home</a>
<a onClick={() => navigate('/apps')}>Application List</a>
</div>
<Routes>
<Route path="/apps" {...componentProps} />
<Route {...renderProps} />
</Routes>
<Breadcrumb>{breadcrumbItems}</Breadcrumb>
</div>
);
}; };
const { container } = render( const { container: container1 } = render(
<MemoryRouter initialEntries={['/']} initialIndex={0}> <MemoryRouter>
<Home /> <CaptureLocation1 />
</MemoryRouter>, </MemoryRouter>,
); );
expect(container.querySelectorAll('.ant-breadcrumb-link').length).toBe(1); expect(container1).toBeTruthy();
expect(container.querySelectorAll('.ant-breadcrumb-link')[0].textContent).toBe('Home'); expect(location1).toBeDefined();
fireEvent.click(container.querySelectorAll('.demo-nav a')[1]); let location2: ReactRouterLocation | undefined;
const CaptureLocation2: React.FC = () => {
expect(container.querySelectorAll('.ant-breadcrumb-link').length).toBe(2); location2 = useLocation();
expect(container.querySelectorAll('.ant-breadcrumb-link')[1].textContent).toBe( return null;
'Application List', };
const { container: container2 } = render(
<MemoryRouter>
<CaptureLocation2 />
</MemoryRouter>,
); );
expect(container2).toBeTruthy();
expect(location2).toBeDefined();
expect(location1).toEqual(location2);
}); });
it('react router 3', () => { it('react router legacy', () => {
const routes = [ const routes = [
{ {
name: 'home', name: 'home',

View File

@ -549,7 +549,7 @@ type Rule = RuleConfig | ((form: FormInstance) => RuleConfig);
| fields | Validate rule for child elements, valid when `type` is `array` or `object` | Record&lt;string, [rule](#rule)> | | | fields | Validate rule for child elements, valid when `type` is `array` or `object` | Record&lt;string, [rule](#rule)> | |
| len | Length of string, number, array | number | | | len | Length of string, number, array | number | |
| max | `type` required: max length of `string`, `number`, `array` | number | | | max | `type` required: max length of `string`, `number`, `array` | number | |
| message | Error message. Will auto generate by [template](#validatemessages) if not provided | string | | | message | Error message. Will auto generate by [template](#validatemessages) if not provided | string \| ReactElement | |
| min | `type` required: min length of `string`, `number`, `array` | number | | | min | `type` required: min length of `string`, `number`, `array` | number | |
| pattern | Regex pattern | RegExp | | | pattern | Regex pattern | RegExp | |
| required | Required field | boolean | | | required | Required field | boolean | |

View File

@ -548,7 +548,7 @@ type Rule = RuleConfig | ((form: FormInstance) => RuleConfig);
| fields | 仅在 `type``array``object` 类型时有效,用于指定子元素的校验规则 | Record&lt;string, [rule](#rule)> | | | fields | 仅在 `type``array``object` 类型时有效,用于指定子元素的校验规则 | Record&lt;string, [rule](#rule)> | |
| len | string 类型时为字符串长度number 类型时为确定数字; array 类型时为数组长度 | number | | | len | string 类型时为字符串长度number 类型时为确定数字; array 类型时为数组长度 | number | |
| max | 必须设置 `type`string 类型为字符串最大长度number 类型时为最大值array 类型时为数组最大长度 | number | | | max | 必须设置 `type`string 类型为字符串最大长度number 类型时为最大值array 类型时为数组最大长度 | number | |
| message | 错误信息,不设置时会通过[模板](#validatemessages)自动生成 | string | | | message | 错误信息,不设置时会通过[模板](#validatemessages)自动生成 | string \| ReactElement | |
| min | 必须设置 `type`string 类型为字符串最小长度number 类型时为最小值array 类型时为数组最小长度 | number | | | min | 必须设置 `type`string 类型为字符串最小长度number 类型时为最小值array 类型时为数组最小长度 | number | |
| pattern | 正则表达式匹配 | RegExp | | | pattern | 正则表达式匹配 | RegExp | |
| required | 是否为必选字段 | boolean | | | required | 是否为必选字段 | boolean | |

View File

@ -4827,7 +4827,7 @@ Array [
aria-live="assertive" aria-live="assertive"
id="DndLiveRegion-5" id="DndLiveRegion-5"
role="status" role="status"
style="position: fixed; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;" style="position: fixed; top: 0px; left: 0px; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;"
/>, />,
] ]
`; `;
@ -5063,7 +5063,7 @@ Array [
aria-live="assertive" aria-live="assertive"
id="DndLiveRegion-1" id="DndLiveRegion-1"
role="status" role="status"
style="position: fixed; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;" style="position: fixed; top: 0px; left: 0px; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;"
/>, />,
] ]
`; `;
@ -5406,7 +5406,7 @@ Array [
aria-live="assertive" aria-live="assertive"
id="DndLiveRegion-3" id="DndLiveRegion-3"
role="status" role="status"
style="position: fixed; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;" style="position: fixed; top: 0px; left: 0px; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;"
/>, />,
] ]
`; `;

View File

@ -2494,7 +2494,7 @@ exports[`renders components/tabs/demo/custom-tab-bar-node.tsx extend context cor
aria-live="assertive" aria-live="assertive"
id="DndLiveRegion-1" id="DndLiveRegion-1"
role="status" role="status"
style="position: fixed; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;" style="position: fixed; top: 0px; left: 0px; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;"
/> />
<div <div
class="ant-tabs-content-holder" class="ant-tabs-content-holder"

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import type { DragEndEvent } from '@dnd-kit/core'; import type { DragEndEvent } from '@dnd-kit/core';
import { DndContext, PointerSensor, closestCenter, useSensor } from '@dnd-kit/core'; import { closestCenter, DndContext, PointerSensor, useSensor } from '@dnd-kit/core';
import { import {
arrayMove, arrayMove,
horizontalListSortingStrategy, horizontalListSortingStrategy,
@ -9,12 +9,13 @@ import {
} from '@dnd-kit/sortable'; } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities'; import { CSS } from '@dnd-kit/utilities';
import { Tabs } from 'antd'; import { Tabs } from 'antd';
import type { TabsProps } from 'antd';
interface DraggableTabPaneProps extends React.HTMLAttributes<HTMLDivElement> { interface DraggableTabPaneProps extends React.HTMLAttributes<HTMLDivElement> {
'data-node-key': string; 'data-node-key': string;
} }
const DraggableTabNode = ({ className, ...props }: DraggableTabPaneProps) => { const DraggableTabNode: React.FC<Readonly<DraggableTabPaneProps>> = ({ className, ...props }) => {
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
id: props['data-node-key'], id: props['data-node-key'],
}); });
@ -35,22 +36,10 @@ const DraggableTabNode = ({ className, ...props }: DraggableTabPaneProps) => {
}; };
const App: React.FC = () => { const App: React.FC = () => {
const [items, setItems] = useState([ const [items, setItems] = useState<NonNullable<TabsProps['items']>>([
{ { key: '1', label: 'Tab 1', children: 'Content of Tab Pane 1' },
key: '1', { key: '2', label: 'Tab 2', children: 'Content of Tab Pane 2' },
label: 'Tab 1', { key: '3', label: 'Tab 3', children: 'Content of Tab Pane 3' },
children: 'Content of Tab Pane 1',
},
{
key: '2',
label: 'Tab 2',
children: 'Content of Tab Pane 2',
},
{
key: '3',
label: 'Tab 3',
children: 'Content of Tab Pane 3',
},
]); ]);
const sensor = useSensor(PointerSensor, { activationConstraint: { distance: 10 } }); const sensor = useSensor(PointerSensor, { activationConstraint: { distance: 10 } });

View File

@ -906,7 +906,7 @@ Array [
aria-live="assertive" aria-live="assertive"
id="DndLiveRegion-1" id="DndLiveRegion-1"
role="status" role="status"
style="position: fixed; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;" style="position: fixed; top: 0px; left: 0px; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;"
/>, />,
] ]
`; `;

View File

@ -2157,7 +2157,7 @@ Array [
aria-live="assertive" aria-live="assertive"
id="DndLiveRegion-1" id="DndLiveRegion-1"
role="status" role="status"
style="position: fixed; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;" style="position: fixed; top: 0px; left: 0px; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip-path: inset(100%); white-space: nowrap;"
/>, />,
] ]
`; `;

View File

@ -164,9 +164,9 @@
"@biomejs/biome": "^1.9.4", "@biomejs/biome": "^1.9.4",
"@codecov/webpack-plugin": "^1.2.1", "@codecov/webpack-plugin": "^1.2.1",
"@codesandbox/sandpack-react": "^2.19.9", "@codesandbox/sandpack-react": "^2.19.9",
"@dnd-kit/core": "^6.1.0", "@dnd-kit/core": "^6.2.0",
"@dnd-kit/modifiers": "^7.0.0", "@dnd-kit/modifiers": "^8.0.0",
"@dnd-kit/sortable": "^8.0.0", "@dnd-kit/sortable": "^9.0.0",
"@dnd-kit/utilities": "^3.2.2", "@dnd-kit/utilities": "^3.2.2",
"@emotion/css": "^11.13.4", "@emotion/css": "^11.13.4",
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
@ -294,7 +294,7 @@
"react-infinite-scroll-component": "^6.1.0", "react-infinite-scroll-component": "^6.1.0",
"react-intersection-observer": "^9.13.1", "react-intersection-observer": "^9.13.1",
"react-resizable": "^3.0.5", "react-resizable": "^3.0.5",
"react-router-dom": "^6.27.0", "react-router-dom": "^7.0.1",
"react-sticky-box": "^2.0.5", "react-sticky-box": "^2.0.5",
"regenerator-runtime": "^0.14.1", "regenerator-runtime": "^0.14.1",
"rehype-stringify": "^10.0.1", "rehype-stringify": "^10.0.1",
@ -318,7 +318,7 @@
"terser": "^5.36.0", "terser": "^5.36.0",
"tsx": "4.11.2", "tsx": "4.11.2",
"typedoc": "^0.26.10", "typedoc": "^0.26.10",
"typescript": "~5.6.3", "typescript": "~5.7.0",
"vanilla-jsoneditor": "^2.0.0", "vanilla-jsoneditor": "^2.0.0",
"vanilla-tilt": "^1.8.1", "vanilla-tilt": "^1.8.1",
"webpack": "^5.95.0", "webpack": "^5.95.0",