mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-23 01:45:05 +08:00
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
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:
commit
2a48c0540c
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@ -171,6 +171,7 @@ jobs:
|
||||
run: bun run dist
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=4096
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
CI: 1
|
||||
|
||||
- name: check build files
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`react router react router 3 1`] = `
|
||||
exports[`react router react router legacy 1`] = `
|
||||
<nav
|
||||
class="ant-breadcrumb"
|
||||
>
|
||||
|
@ -1,29 +1,10 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import type { RouterProps } from 'react-router-dom';
|
||||
import { Link, MemoryRouter, Route, Routes, useLocation, useNavigate } from 'react-router-dom';
|
||||
import React from 'react';
|
||||
import { MemoryRouter, useLocation } 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';
|
||||
|
||||
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', () => {
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers();
|
||||
@ -33,63 +14,37 @@ describe('react router', () => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('react router 6', () => {
|
||||
const Home: React.FC = () => {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const pathSnippets = location.pathname.split('/').filter((i) => i);
|
||||
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>
|
||||
);
|
||||
it('memoizes the current location', () => {
|
||||
let location1: ReactRouterLocation | undefined;
|
||||
const CaptureLocation1: React.FC = () => {
|
||||
location1 = useLocation();
|
||||
return null;
|
||||
};
|
||||
const { container } = render(
|
||||
<MemoryRouter initialEntries={['/']} initialIndex={0}>
|
||||
<Home />
|
||||
const { container: container1 } = render(
|
||||
<MemoryRouter>
|
||||
<CaptureLocation1 />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
expect(container.querySelectorAll('.ant-breadcrumb-link').length).toBe(1);
|
||||
expect(container.querySelectorAll('.ant-breadcrumb-link')[0].textContent).toBe('Home');
|
||||
expect(container1).toBeTruthy();
|
||||
expect(location1).toBeDefined();
|
||||
|
||||
fireEvent.click(container.querySelectorAll('.demo-nav a')[1]);
|
||||
|
||||
expect(container.querySelectorAll('.ant-breadcrumb-link').length).toBe(2);
|
||||
expect(container.querySelectorAll('.ant-breadcrumb-link')[1].textContent).toBe(
|
||||
'Application List',
|
||||
let location2: ReactRouterLocation | undefined;
|
||||
const CaptureLocation2: React.FC = () => {
|
||||
location2 = useLocation();
|
||||
return null;
|
||||
};
|
||||
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 = [
|
||||
{
|
||||
name: 'home',
|
||||
|
@ -549,7 +549,7 @@ type Rule = RuleConfig | ((form: FormInstance) => RuleConfig);
|
||||
| fields | Validate rule for child elements, valid when `type` is `array` or `object` | Record<string, [rule](#rule)> | |
|
||||
| len | 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 | |
|
||||
| pattern | Regex pattern | RegExp | |
|
||||
| required | Required field | boolean | |
|
||||
|
@ -548,7 +548,7 @@ type Rule = RuleConfig | ((form: FormInstance) => RuleConfig);
|
||||
| fields | 仅在 `type` 为 `array` 或 `object` 类型时有效,用于指定子元素的校验规则 | Record<string, [rule](#rule)> | |
|
||||
| len | string 类型时为字符串长度;number 类型时为确定数字; array 类型时为数组长度 | number | |
|
||||
| max | 必须设置 `type`:string 类型为字符串最大长度;number 类型时为最大值;array 类型时为数组最大长度 | number | |
|
||||
| message | 错误信息,不设置时会通过[模板](#validatemessages)自动生成 | string | |
|
||||
| message | 错误信息,不设置时会通过[模板](#validatemessages)自动生成 | string \| ReactElement | |
|
||||
| min | 必须设置 `type`:string 类型为字符串最小长度;number 类型时为最小值;array 类型时为数组最小长度 | number | |
|
||||
| pattern | 正则表达式匹配 | RegExp | |
|
||||
| required | 是否为必选字段 | boolean | |
|
||||
|
@ -4827,7 +4827,7 @@ Array [
|
||||
aria-live="assertive"
|
||||
id="DndLiveRegion-5"
|
||||
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"
|
||||
id="DndLiveRegion-1"
|
||||
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"
|
||||
id="DndLiveRegion-3"
|
||||
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;"
|
||||
/>,
|
||||
]
|
||||
`;
|
||||
|
@ -2494,7 +2494,7 @@ exports[`renders components/tabs/demo/custom-tab-bar-node.tsx extend context cor
|
||||
aria-live="assertive"
|
||||
id="DndLiveRegion-1"
|
||||
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
|
||||
class="ant-tabs-content-holder"
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
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 {
|
||||
arrayMove,
|
||||
horizontalListSortingStrategy,
|
||||
@ -9,12 +9,13 @@ import {
|
||||
} from '@dnd-kit/sortable';
|
||||
import { CSS } from '@dnd-kit/utilities';
|
||||
import { Tabs } from 'antd';
|
||||
import type { TabsProps } from 'antd';
|
||||
|
||||
interface DraggableTabPaneProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
'data-node-key': string;
|
||||
}
|
||||
|
||||
const DraggableTabNode = ({ className, ...props }: DraggableTabPaneProps) => {
|
||||
const DraggableTabNode: React.FC<Readonly<DraggableTabPaneProps>> = ({ className, ...props }) => {
|
||||
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
|
||||
id: props['data-node-key'],
|
||||
});
|
||||
@ -35,22 +36,10 @@ const DraggableTabNode = ({ className, ...props }: DraggableTabPaneProps) => {
|
||||
};
|
||||
|
||||
const App: React.FC = () => {
|
||||
const [items, setItems] = useState([
|
||||
{
|
||||
key: '1',
|
||||
label: 'Tab 1',
|
||||
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 [items, setItems] = useState<NonNullable<TabsProps['items']>>([
|
||||
{ key: '1', label: 'Tab 1', 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 } });
|
||||
|
@ -906,7 +906,7 @@ Array [
|
||||
aria-live="assertive"
|
||||
id="DndLiveRegion-1"
|
||||
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;"
|
||||
/>,
|
||||
]
|
||||
`;
|
||||
|
@ -2157,7 +2157,7 @@ Array [
|
||||
aria-live="assertive"
|
||||
id="DndLiveRegion-1"
|
||||
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;"
|
||||
/>,
|
||||
]
|
||||
`;
|
||||
|
10
package.json
10
package.json
@ -164,9 +164,9 @@
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@codecov/webpack-plugin": "^1.2.1",
|
||||
"@codesandbox/sandpack-react": "^2.19.9",
|
||||
"@dnd-kit/core": "^6.1.0",
|
||||
"@dnd-kit/modifiers": "^7.0.0",
|
||||
"@dnd-kit/sortable": "^8.0.0",
|
||||
"@dnd-kit/core": "^6.2.0",
|
||||
"@dnd-kit/modifiers": "^8.0.0",
|
||||
"@dnd-kit/sortable": "^9.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@emotion/css": "^11.13.4",
|
||||
"@emotion/react": "^11.13.3",
|
||||
@ -294,7 +294,7 @@
|
||||
"react-infinite-scroll-component": "^6.1.0",
|
||||
"react-intersection-observer": "^9.13.1",
|
||||
"react-resizable": "^3.0.5",
|
||||
"react-router-dom": "^6.27.0",
|
||||
"react-router-dom": "^7.0.1",
|
||||
"react-sticky-box": "^2.0.5",
|
||||
"regenerator-runtime": "^0.14.1",
|
||||
"rehype-stringify": "^10.0.1",
|
||||
@ -318,7 +318,7 @@
|
||||
"terser": "^5.36.0",
|
||||
"tsx": "4.11.2",
|
||||
"typedoc": "^0.26.10",
|
||||
"typescript": "~5.6.3",
|
||||
"typescript": "~5.7.0",
|
||||
"vanilla-jsoneditor": "^2.0.0",
|
||||
"vanilla-tilt": "^1.8.1",
|
||||
"webpack": "^5.95.0",
|
||||
|
Loading…
Reference in New Issue
Block a user