mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 10:59:19 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6dd5a234de | ||
|
|
2a6d0b837e | ||
|
|
081e9a6311 | ||
|
|
a811b7a702 | ||
|
|
34b32bb389 | ||
|
|
2a823ea79c | ||
|
|
6339b669e7 | ||
|
|
2e771318d0 | ||
|
|
bd10127ad0 | ||
|
|
5ebd3cb42f |
@@ -1,11 +1,10 @@
|
||||
import React, { Suspense } from 'react';
|
||||
import { App, Button, ConfigProvider, Skeleton } from 'antd';
|
||||
import { App, Button, ConfigProvider, Skeleton, version } from 'antd';
|
||||
import { enUS, zhCN } from 'antd-token-previewer';
|
||||
import type { ThemeConfig } from 'antd/es/config-provider/context';
|
||||
import { Helmet } from 'dumi';
|
||||
|
||||
import useLocale from '../../hooks/useLocale';
|
||||
import useLocalStorage from '../../hooks/useLocalStorage';
|
||||
|
||||
const ThemeEditor = React.lazy(() => import('antd-token-previewer/lib/ThemeEditor'));
|
||||
|
||||
@@ -34,18 +33,24 @@ const locales = {
|
||||
},
|
||||
};
|
||||
|
||||
const ANT_THEME_EDITOR_THEME = 'ant-theme-editor-theme';
|
||||
const [antdMajor] = version.split('.');
|
||||
const ANT_DESIGN_V5_THEME_EDITOR_THEME = `ant-design-v${antdMajor}-theme-editor-theme`;
|
||||
|
||||
const CustomTheme: React.FC = () => {
|
||||
const { message } = App.useApp();
|
||||
const [locale, lang] = useLocale(locales);
|
||||
|
||||
const [themeConfig, setThemeConfig] = useLocalStorage<ThemeConfig>(ANT_THEME_EDITOR_THEME, {
|
||||
defaultValue: {},
|
||||
const [theme, setTheme] = React.useState<ThemeConfig>(() => {
|
||||
try {
|
||||
const storedConfig = localStorage.getItem(ANT_DESIGN_V5_THEME_EDITOR_THEME);
|
||||
return storedConfig ? JSON.parse(storedConfig) : {};
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
});
|
||||
|
||||
const handleSave = () => {
|
||||
setThemeConfig(themeConfig);
|
||||
localStorage.setItem(ANT_DESIGN_V5_THEME_EDITOR_THEME, JSON.stringify(theme));
|
||||
message.success(locale.saveSuccessfully);
|
||||
};
|
||||
|
||||
@@ -60,9 +65,11 @@ const CustomTheme: React.FC = () => {
|
||||
<ThemeEditor
|
||||
advanced
|
||||
hideAdvancedSwitcher
|
||||
theme={{ name: 'Custom Theme', key: 'test', config: themeConfig }}
|
||||
theme={{ name: 'Custom Theme', key: 'test', config: theme }}
|
||||
style={{ height: 'calc(100vh - 64px)' }}
|
||||
onThemeChange={(newTheme) => setThemeConfig(newTheme.config)}
|
||||
onThemeChange={(newTheme) => {
|
||||
setTheme(newTheme.config);
|
||||
}}
|
||||
locale={lang === 'cn' ? zhCN : enUS}
|
||||
actions={
|
||||
<Button type="primary" onClick={handleSave}>
|
||||
|
||||
@@ -48,7 +48,7 @@ const locales = {
|
||||
},
|
||||
};
|
||||
|
||||
const branchUrl = (repo: string) => `https://github.com/${repo}/edit/master/`;
|
||||
const branchUrl = (repo: string) => `https://github.com/${repo}/edit/5.x-stable/`;
|
||||
|
||||
function isVersionNumber(value?: string) {
|
||||
return value && /^\d+\.\d+\.\d+$/.test(value);
|
||||
@@ -126,7 +126,7 @@ const ComponentMeta: React.FC<ComponentMetaProps> = (props) => {
|
||||
if (String(source) === 'true') {
|
||||
const kebabComponent = kebabCase(component);
|
||||
return [
|
||||
`https://github.com/${repo}/blob/master/components/${kebabComponent}`,
|
||||
`https://github.com/${repo}/blob/5.x-stable/components/${kebabComponent}`,
|
||||
`components/${kebabComponent}`,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { EditOutlined } from '@ant-design/icons';
|
||||
import { Tooltip } from 'antd';
|
||||
import { createStyles } from 'antd-style';
|
||||
|
||||
const branchUrl = 'https://github.com/ant-design/ant-design/edit/master/';
|
||||
const branchUrl = 'https://github.com/ant-design/ant-design/edit/5.x-stable/';
|
||||
|
||||
export interface EditButtonProps {
|
||||
title: React.ReactNode;
|
||||
|
||||
@@ -157,21 +157,11 @@ const RoutesPlugin = async (api: IApi) => {
|
||||
api.modifyRoutes((routes) => {
|
||||
// TODO: append extra routes, such as home, changelog, form-v3
|
||||
|
||||
/**
|
||||
* **important!** Make sure that the `id` and `path` are consistent.
|
||||
* see: https://github.com/ant-design/ant-design/issues/55960
|
||||
*/
|
||||
const extraRoutesList: IRoute[] = [
|
||||
{
|
||||
id: 'changelog-cn',
|
||||
path: 'changelog-cn',
|
||||
absPath: '/changelog-cn',
|
||||
parentId: 'DocLayout',
|
||||
file: resolve('../../CHANGELOG.zh-CN.md'),
|
||||
},
|
||||
{
|
||||
id: 'components-changelog-cn',
|
||||
path: 'components/changelog-cn',
|
||||
absPath: '/changelog-cn',
|
||||
parentId: 'DocLayout',
|
||||
file: resolve('../../CHANGELOG.zh-CN.md'),
|
||||
},
|
||||
{
|
||||
id: 'changelog',
|
||||
path: 'changelog',
|
||||
@@ -180,12 +170,26 @@ const RoutesPlugin = async (api: IApi) => {
|
||||
file: resolve('../../CHANGELOG.en-US.md'),
|
||||
},
|
||||
{
|
||||
id: 'components-changelog',
|
||||
id: 'changelog-cn',
|
||||
path: 'changelog-cn',
|
||||
absPath: '/changelog-cn',
|
||||
parentId: 'DocLayout',
|
||||
file: resolve('../../CHANGELOG.zh-CN.md'),
|
||||
},
|
||||
{
|
||||
id: 'components/changelog',
|
||||
path: 'components/changelog',
|
||||
absPath: '/changelog',
|
||||
absPath: '/components/changelog',
|
||||
parentId: 'DocLayout',
|
||||
file: resolve('../../CHANGELOG.en-US.md'),
|
||||
},
|
||||
{
|
||||
id: 'components/changelog-cn',
|
||||
path: 'components/changelog-cn',
|
||||
absPath: '/components/changelog-cn',
|
||||
parentId: 'DocLayout',
|
||||
file: resolve('../../CHANGELOG.zh-CN.md'),
|
||||
},
|
||||
];
|
||||
|
||||
extraRoutesList.forEach((itemRoute) => {
|
||||
|
||||
@@ -259,6 +259,7 @@ const Header: React.FC = () => {
|
||||
|
||||
const { menuVisible, windowWidth, searching } = headerState;
|
||||
const docVersions: Record<string, string> = {
|
||||
...themeConfig?.docNewVersions,
|
||||
[pkg.version]: pkg.version,
|
||||
...themeConfig?.docVersions,
|
||||
};
|
||||
|
||||
@@ -55,4 +55,7 @@ export default {
|
||||
'0.10.x': 'https://010x.ant.design',
|
||||
'0.9.x': 'https://09x.ant.design',
|
||||
},
|
||||
docNewVersions: {
|
||||
'6.x': chineseMirror ? 'https://ant-design.antgroup.com' : 'https://ant.design',
|
||||
},
|
||||
};
|
||||
|
||||
4
.github/workflows/release-dingtalk.yml
vendored
4
.github/workflows/release-dingtalk.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
with:
|
||||
trigger: tag
|
||||
changelogs: 'CHANGELOG.en-US.md, CHANGELOG.zh-CN.md'
|
||||
branch: 'master, 4.x-stable'
|
||||
branch: 'master, 5.x-stable, 4.x-stable'
|
||||
tag: '5*, 4*'
|
||||
latest: '5*'
|
||||
dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }} ${{ secrets.DINGDING_BOT_COLLABORATOR_TOKEN }} ${{ secrets.DINGDING_BOT_MAINTAINER_TOKEN }}
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
with:
|
||||
trigger: tag
|
||||
changelogs: 'CHANGELOG.en-US.md, CHANGELOG.zh-CN.md'
|
||||
branch: 'master, 4.x-stable'
|
||||
branch: 'master, 5.x-stable, 4.x-stable'
|
||||
tag: '5*, 4*'
|
||||
latest: '5*'
|
||||
dingding-token: ${{ secrets.DINGDING_BOT_BIGFISH_TOKEN }} ${{ secrets.DINGDING_BOT_BIGFISH_2_TOKEN }} ${{ secrets.DINGDING_BOT_YUNFENGDIE_TOKEN }}
|
||||
|
||||
1
.github/workflows/sync-gitee.yml
vendored
1
.github/workflows/sync-gitee.yml
vendored
@@ -9,6 +9,7 @@ on:
|
||||
- 2.x-stable
|
||||
- 3.x-stable
|
||||
- 4.x-stable
|
||||
- 5.x-stable
|
||||
create:
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@@ -4,9 +4,9 @@ name: ✅ test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, feature]
|
||||
branches: [master, feature, 5.x-stable]
|
||||
pull_request:
|
||||
branches: [master, feature]
|
||||
branches: [master, feature, 5.x-stable]
|
||||
|
||||
# Cancel prev CI if new commit come
|
||||
concurrency:
|
||||
@@ -183,7 +183,7 @@ jobs:
|
||||
|
||||
# Artifact build files
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/5.x-stable'
|
||||
with:
|
||||
name: build artifacts
|
||||
path: |
|
||||
@@ -193,7 +193,7 @@ jobs:
|
||||
lib
|
||||
|
||||
- name: zip builds
|
||||
if: github.repository == 'ant-design/ant-design' && github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
if: github.repository == 'ant-design/ant-design' && github.event_name == 'push' && github.ref == 'refs/heads/5.x-stable'
|
||||
env:
|
||||
ALI_OSS_AK_ID: ${{ secrets.ALI_OSS_AK_ID }}
|
||||
ALI_OSS_AK_SECRET: ${{ secrets.ALI_OSS_AK_SECRET }}
|
||||
|
||||
@@ -4,7 +4,7 @@ name: 👀 Visual Regression Diff Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master, feature, next]
|
||||
branches: [master, feature, next, 5.x-stable]
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
# Cancel prev CI if new commit come
|
||||
|
||||
@@ -8,7 +8,7 @@ name: 👀 Visual Regression Diff Start
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: [master, feature, next]
|
||||
branches: [master, feature, next, 5.x-stable]
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
permissions:
|
||||
|
||||
@@ -89,7 +89,7 @@ jobs:
|
||||
path: ./tmp
|
||||
|
||||
- name: Persist Image Snapshot to OSS
|
||||
if: github.repository == 'ant-design/ant-design' && github.event.workflow_run.event == 'push' && (github.event.workflow_run.head_branch == 'master' || github.event.workflow_run.head_branch == 'feature' || github.event.workflow_run.head_branch == 'next')
|
||||
if: github.repository == 'ant-design/ant-design' && github.event.workflow_run.event == 'push' && (github.event.workflow_run.head_branch == 'master' || github.event.workflow_run.head_branch == 'feature' || github.event.workflow_run.head_branch == 'next' || github.event.workflow_run.head_branch == '5.x-stable')
|
||||
env:
|
||||
ALI_OSS_AK_ID: ${{ secrets.ALI_OSS_AK_ID }}
|
||||
ALI_OSS_AK_SECRET: ${{ secrets.ALI_OSS_AK_SECRET }}
|
||||
|
||||
@@ -8,6 +8,7 @@ on:
|
||||
- master
|
||||
- feature
|
||||
- next
|
||||
- 5.x-stable
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -15,6 +15,15 @@ tag: vVERSION
|
||||
|
||||
---
|
||||
|
||||
## 5.29.2
|
||||
|
||||
`2025-12-15`
|
||||
|
||||
- 🐞 Fix notification background colors incorrect when `cssVar` is disabled. [#56133](https://github.com/ant-design/ant-design/pull/56133) [@afc163](https://github.com/afc163)
|
||||
- 🐞 Raise Breadcrumb link style priority to avoid being overridden by global styles (v5). [#56139](https://github.com/ant-design/ant-design/pull/56139) [@guoyunhe](https://github.com/guoyunhe)
|
||||
- 🐞 Fix Input.Search should not warn about deprecated `addonAfter`. [#55806](https://github.com/ant-design/ant-design/pull/55806) [@zombieJ](https://github.com/zombieJ)
|
||||
- 🐞 Fix Splitter failing to fill its container when the sum of panel proportions is not 1. [#56217](https://github.com/ant-design/ant-design/pull/56217) [@zombieJ](https://github.com/zombieJ)
|
||||
|
||||
## 5.29.1
|
||||
|
||||
`2025-11-18`
|
||||
|
||||
@@ -15,6 +15,15 @@ tag: vVERSION
|
||||
|
||||
---
|
||||
|
||||
## 5.29.2
|
||||
|
||||
`2025-12-15`
|
||||
|
||||
- 🐞 修复关闭 `cssVar` 时 notification 背景色异常的问题。[#56133](https://github.com/ant-design/ant-design/pull/56133) [@afc163](https://github.com/afc163)
|
||||
- 🐞 提升 Breadcrumb 链接样式的优先级以避免被全局样式覆盖。[#56139](https://github.com/ant-design/ant-design/pull/56139) [@guoyunhe](https://github.com/guoyunhe)
|
||||
- 🐞 修复 Input.Search 会报 `addonAfter` 已经废弃的警告信息的问题。[#55806](https://github.com/ant-design/ant-design/pull/55806) [@zombieJ](https://github.com/zombieJ)
|
||||
- 🐞 修复 Splitter 在 Panel 总占比不为 1 时出现占不满的情况。 [#56217](https://github.com/ant-design/ant-design/pull/56217) [@zombieJ](https://github.com/zombieJ)
|
||||
|
||||
## 5.29.1
|
||||
|
||||
`2025-11-18`
|
||||
|
||||
@@ -1096,11 +1096,7 @@ exports[`renders components/auto-complete/demo/certain-category.tsx extend conte
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/auto-complete/demo/certain-category.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/auto-complete/demo/certain-category.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/auto-complete/demo/custom.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
@@ -2428,7 +2424,6 @@ exports[`renders components/auto-complete/demo/form-debug.tsx extend context cor
|
||||
exports[`renders components/auto-complete/demo/form-debug.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input.Group] \`Input.Group\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
|
||||
@@ -2987,11 +2982,7 @@ exports[`renders components/auto-complete/demo/uncertain-category.tsx extend con
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/auto-complete/demo/uncertain-category.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/auto-complete/demo/uncertain-category.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/auto-complete/demo/variant.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
|
||||
@@ -66,7 +66,7 @@ const genBreadcrumbStyle: GenerateStyle<BreadcrumbToken, CSSObject> = (token) =>
|
||||
listStyle: 'none',
|
||||
},
|
||||
|
||||
a: {
|
||||
[`a${componentCls}-link, ${componentCls}-link a`]: {
|
||||
color: token.linkColor,
|
||||
transition: `color ${token.motionDurationMid}`,
|
||||
padding: `0 ${unit(token.paddingXXS)}`,
|
||||
|
||||
@@ -2014,11 +2014,7 @@ Array [
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders components/button/demo/debug-icon.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/button/demo/debug-icon.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/button/demo/disabled.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
|
||||
@@ -11917,9 +11917,7 @@ exports[`renders components/form/demo/register.tsx extend context correctly 1`]
|
||||
class="ant-form-item-control-input-content"
|
||||
>
|
||||
<div
|
||||
aria-required="true"
|
||||
class="ant-space-compact ant-space-compact-block"
|
||||
id="register_phone"
|
||||
>
|
||||
<div
|
||||
class="ant-select ant-select-outlined ant-select-in-form-item ant-select-compact-item ant-select-compact-first-item ant-select-single ant-select-show-arrow"
|
||||
@@ -12067,7 +12065,9 @@ exports[`renders components/form/demo/register.tsx extend context correctly 1`]
|
||||
</span>
|
||||
</div>
|
||||
<input
|
||||
aria-required="true"
|
||||
class="ant-input ant-input-outlined ant-input-compact-item ant-input-compact-last-item"
|
||||
id="register_phone"
|
||||
style="width: 100%;"
|
||||
type="text"
|
||||
value=""
|
||||
@@ -12105,9 +12105,7 @@ exports[`renders components/form/demo/register.tsx extend context correctly 1`]
|
||||
class="ant-form-item-control-input-content"
|
||||
>
|
||||
<div
|
||||
aria-required="true"
|
||||
class="ant-space-compact ant-space-compact-block"
|
||||
id="register_donation"
|
||||
>
|
||||
<div
|
||||
class="ant-input-number ant-input-number-in-form-item ant-input-number-outlined ant-input-number-compact-item ant-input-number-compact-first-item"
|
||||
@@ -12175,8 +12173,10 @@ exports[`renders components/form/demo/register.tsx extend context correctly 1`]
|
||||
class="ant-input-number-input-wrap"
|
||||
>
|
||||
<input
|
||||
aria-required="true"
|
||||
autocomplete="off"
|
||||
class="ant-input-number-input"
|
||||
id="register_donation"
|
||||
role="spinbutton"
|
||||
step="1"
|
||||
value=""
|
||||
|
||||
@@ -7992,9 +7992,7 @@ exports[`renders components/form/demo/register.tsx correctly 1`] = `
|
||||
class="ant-form-item-control-input-content"
|
||||
>
|
||||
<div
|
||||
aria-required="true"
|
||||
class="ant-space-compact ant-space-compact-block"
|
||||
id="register_phone"
|
||||
>
|
||||
<div
|
||||
class="ant-select ant-select-outlined ant-select-in-form-item ant-select-compact-item ant-select-compact-first-item ant-select-single ant-select-show-arrow"
|
||||
@@ -8062,7 +8060,9 @@ exports[`renders components/form/demo/register.tsx correctly 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<input
|
||||
aria-required="true"
|
||||
class="ant-input ant-input-outlined ant-input-compact-item ant-input-compact-last-item"
|
||||
id="register_phone"
|
||||
style="width:100%"
|
||||
type="text"
|
||||
value=""
|
||||
@@ -8100,9 +8100,7 @@ exports[`renders components/form/demo/register.tsx correctly 1`] = `
|
||||
class="ant-form-item-control-input-content"
|
||||
>
|
||||
<div
|
||||
aria-required="true"
|
||||
class="ant-space-compact ant-space-compact-block"
|
||||
id="register_donation"
|
||||
>
|
||||
<div
|
||||
class="ant-input-number ant-input-number-in-form-item ant-input-number-outlined ant-input-number-compact-item ant-input-number-compact-first-item"
|
||||
@@ -8170,8 +8168,10 @@ exports[`renders components/form/demo/register.tsx correctly 1`] = `
|
||||
class="ant-input-number-input-wrap"
|
||||
>
|
||||
<input
|
||||
aria-required="true"
|
||||
autocomplete="off"
|
||||
class="ant-input-number-input"
|
||||
id="register_donation"
|
||||
role="spinbutton"
|
||||
step="1"
|
||||
value=""
|
||||
|
||||
@@ -80,6 +80,10 @@ const tailFormItemLayout: FormItemProps = {
|
||||
},
|
||||
};
|
||||
|
||||
function Injector({ children, ...rest }: { children: (props: any) => React.ReactElement }) {
|
||||
return children(rest);
|
||||
}
|
||||
|
||||
const App: React.FC = () => {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
@@ -214,11 +218,14 @@ const App: React.FC = () => {
|
||||
label="Phone Number"
|
||||
rules={[{ required: true, message: 'Please input your phone number!' }]}
|
||||
>
|
||||
{/* Demo only, real usage should wrap as custom component */}
|
||||
<Space.Compact block>
|
||||
{prefixSelector}
|
||||
<Input style={{ width: '100%' }} />
|
||||
</Space.Compact>
|
||||
<Injector>
|
||||
{(props) => (
|
||||
<Space.Compact block>
|
||||
{prefixSelector}
|
||||
<Input style={{ width: '100%' }} {...props} />
|
||||
</Space.Compact>
|
||||
)}
|
||||
</Injector>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
@@ -226,11 +233,14 @@ const App: React.FC = () => {
|
||||
label="Donation"
|
||||
rules={[{ required: true, message: 'Please input donation amount!' }]}
|
||||
>
|
||||
{/* Demo only, real usage should wrap as custom component */}
|
||||
<Space.Compact block>
|
||||
<InputNumber style={{ width: '100%' }} />
|
||||
{suffixSelector}
|
||||
</Space.Compact>
|
||||
<Injector>
|
||||
{(props) => (
|
||||
<Space.Compact block>
|
||||
<InputNumber style={{ width: '100%' }} {...props} />
|
||||
{suffixSelector}
|
||||
</Space.Compact>
|
||||
)}
|
||||
</Injector>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
|
||||
@@ -77,6 +77,9 @@ export interface InputProps
|
||||
classNames?: Partial<Record<SemanticName, string>>;
|
||||
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
||||
[key: `data-${string}`]: string | undefined;
|
||||
|
||||
/** @private Skip warning of addon. Only work in dev mode */
|
||||
_skipAddonWarning?: boolean;
|
||||
}
|
||||
|
||||
const Input = forwardRef<InputRef, InputProps>((props, ref) => {
|
||||
@@ -99,18 +102,22 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
|
||||
onChange,
|
||||
classNames,
|
||||
variant: customVariant,
|
||||
_skipAddonWarning,
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const { deprecated } = devUseWarning('Input');
|
||||
[
|
||||
['bordered', 'variant'],
|
||||
['addonAfter', 'Space.Compact'],
|
||||
['addonBefore', 'Space.Compact'],
|
||||
].forEach(([prop, newProp]) => {
|
||||
deprecated(!(prop in props), prop, newProp);
|
||||
});
|
||||
deprecated(!('bordered' in props), 'bordered', 'variant');
|
||||
|
||||
if (!_skipAddonWarning) {
|
||||
[
|
||||
['addonAfter', 'Space.Compact'],
|
||||
['addonBefore', 'Space.Compact'],
|
||||
].forEach(([prop, newProp]) => {
|
||||
deprecated(!(prop in props), prop, newProp);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
|
||||
@@ -185,6 +185,7 @@ const Search = React.forwardRef<InputRef, SearchProps>((props, ref) => {
|
||||
suffix,
|
||||
onChange,
|
||||
disabled,
|
||||
_skipAddonWarning: true,
|
||||
};
|
||||
|
||||
return <Input ref={composeRef<InputRef>(inputRef, ref)} {...inputProps} />;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { fireEvent, render } from '@testing-library/react';
|
||||
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
@@ -13,6 +14,20 @@ describe('Input.Search', () => {
|
||||
mountTest(Search);
|
||||
rtlTest(Search);
|
||||
|
||||
beforeEach(() => {
|
||||
resetWarned();
|
||||
});
|
||||
|
||||
// V5 Only
|
||||
it('no warning of addon', () => {
|
||||
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
render(<Search />);
|
||||
expect(errSpy).not.toHaveBeenCalled();
|
||||
|
||||
errSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('should support custom button', () => {
|
||||
const { asFragment } = render(<Search enterButton={<button type="button">ok</button>} />);
|
||||
expect(asFragment().firstChild).toMatchSnapshot();
|
||||
|
||||
@@ -6114,11 +6114,7 @@ exports[`renders components/input/demo/compact-style.tsx extend context correctl
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/input/demo/compact-style.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/input/demo/compact-style.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/input/demo/debug-addon.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
@@ -10310,7 +10306,6 @@ exports[`renders components/input/demo/group.tsx extend context correctly 1`] =
|
||||
exports[`renders components/input/demo/group.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input.Group] \`Input.Group\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
|
||||
@@ -11804,11 +11799,7 @@ exports[`renders components/input/demo/search-input.tsx extend context correctly
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/input/demo/search-input.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/input/demo/search-input.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/input/demo/search-input-loading.tsx extend context correctly 1`] = `
|
||||
Array [
|
||||
@@ -11960,11 +11951,7 @@ Array [
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders components/input/demo/search-input-loading.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/input/demo/search-input-loading.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/input/demo/show-count.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
@@ -12468,8 +12455,4 @@ exports[`renders components/input/demo/variant.tsx extend context correctly 1`]
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/input/demo/variant.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/input/demo/variant.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
@@ -14,63 +14,43 @@ exports[`renders components/notification/demo/basic.tsx extend context correctly
|
||||
exports[`renders components/notification/demo/basic.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/notification/demo/component-token.tsx extend context correctly 1`] = `
|
||||
Array [
|
||||
<h4>
|
||||
Custom Theme (Enhanced Colors)
|
||||
</h4>,
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center ant-space-gap-row-small ant-space-gap-col-small"
|
||||
<div
|
||||
class="ant-flex ant-flex-wrap-wrap"
|
||||
style="gap: 8px;"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-green ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary ant-btn-color-primary ant-btn-variant-solid"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Custom Success
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Custom Info
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Custom Warning
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-dangerous ant-btn-color-dangerous ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Custom Error
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>,
|
||||
]
|
||||
<span>
|
||||
Success
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-blue ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Info
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-yellow ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Warning
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-red ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Error
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/notification/demo/component-token.tsx extend context correctly 2`] = `[]`;
|
||||
@@ -819,56 +799,41 @@ exports[`renders components/notification/demo/with-btn.tsx extend context correc
|
||||
|
||||
exports[`renders components/notification/demo/with-icon.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center ant-space-gap-row-small ant-space-gap-col-small"
|
||||
class="ant-flex ant-flex-wrap-wrap"
|
||||
style="gap: 8px;"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-green ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Success
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
<span>
|
||||
Success
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-blue ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Info
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
<span>
|
||||
Info
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-yellow ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Warning
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
<span>
|
||||
Warning
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-red ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Error
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<span>
|
||||
Error
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
|
||||
@@ -12,63 +12,43 @@ exports[`renders components/notification/demo/basic.tsx correctly 1`] = `
|
||||
`;
|
||||
|
||||
exports[`renders components/notification/demo/component-token.tsx correctly 1`] = `
|
||||
Array [
|
||||
<h4>
|
||||
Custom Theme (Enhanced Colors)
|
||||
</h4>,
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center ant-space-gap-row-small ant-space-gap-col-small"
|
||||
<div
|
||||
class="ant-flex ant-flex-wrap-wrap"
|
||||
style="gap:8px"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-green ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary ant-btn-color-primary ant-btn-variant-solid"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Custom Success
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Custom Info
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Custom Warning
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-dangerous ant-btn-color-dangerous ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Custom Error
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>,
|
||||
]
|
||||
<span>
|
||||
Success
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-blue ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Info
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-yellow ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Warning
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-red ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Error
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/notification/demo/custom-icon.tsx correctly 1`] = `
|
||||
@@ -795,55 +775,40 @@ exports[`renders components/notification/demo/with-btn.tsx correctly 1`] = `
|
||||
|
||||
exports[`renders components/notification/demo/with-icon.tsx correctly 1`] = `
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center ant-space-gap-row-small ant-space-gap-col-small"
|
||||
class="ant-flex ant-flex-wrap-wrap"
|
||||
style="gap:8px"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-green ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Success
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
<span>
|
||||
Success
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-blue ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Info
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
<span>
|
||||
Info
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-yellow ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Warning
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
<span>
|
||||
Warning
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-red ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Error
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<span>
|
||||
Error
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Button, notification, Space, ConfigProvider } from 'antd';
|
||||
import { Button, notification, Flex, ConfigProvider } from 'antd';
|
||||
|
||||
type NotificationType = 'success' | 'info' | 'warning' | 'error';
|
||||
|
||||
@@ -16,17 +16,28 @@ const CustomThemeDemo: React.FC = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<h4>Custom Theme (Enhanced Colors)</h4>
|
||||
<Space>
|
||||
<Button type="primary" onClick={() => openNotificationWithIcon('success')}>
|
||||
Custom Success
|
||||
<Flex gap={8} wrap="wrap">
|
||||
<Button
|
||||
color="green"
|
||||
variant="outlined"
|
||||
onClick={() => openNotificationWithIcon('success')}
|
||||
>
|
||||
Success
|
||||
</Button>
|
||||
<Button onClick={() => openNotificationWithIcon('info')}>Custom Info</Button>
|
||||
<Button onClick={() => openNotificationWithIcon('warning')}>Custom Warning</Button>
|
||||
<Button danger onClick={() => openNotificationWithIcon('error')}>
|
||||
Custom Error
|
||||
<Button color="blue" variant="outlined" onClick={() => openNotificationWithIcon('info')}>
|
||||
Info
|
||||
</Button>
|
||||
</Space>
|
||||
<Button
|
||||
color="yellow"
|
||||
variant="outlined"
|
||||
onClick={() => openNotificationWithIcon('warning')}
|
||||
>
|
||||
Warning
|
||||
</Button>
|
||||
<Button color="red" variant="outlined" onClick={() => openNotificationWithIcon('error')}>
|
||||
Error
|
||||
</Button>
|
||||
</Flex>
|
||||
{contextHolder}
|
||||
</>
|
||||
);
|
||||
@@ -37,10 +48,10 @@ const App: React.FC = () => (
|
||||
theme={{
|
||||
components: {
|
||||
Notification: {
|
||||
colorSuccessBg: '#d9f7be', // Custom light green for success
|
||||
colorErrorBg: '#ffccc7', // Custom light red for error
|
||||
colorInfoBg: '#bae0ff', // Custom light blue for info
|
||||
colorWarningBg: '#ffffb8', // Custom light yellow for warning
|
||||
colorSuccessBg: 'linear-gradient(30deg, #d9f7be, #f6ffed)',
|
||||
colorErrorBg: 'linear-gradient(30deg, #ffccc7, #fff1f0)',
|
||||
colorInfoBg: 'linear-gradient(30deg, #bae0ff, #e6f4ff)',
|
||||
colorWarningBg: 'linear-gradient(30deg, #ffffb8, #feffe6)',
|
||||
},
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Button, notification, Space } from 'antd';
|
||||
import { Button, notification, Flex } from 'antd';
|
||||
|
||||
type NotificationType = 'success' | 'info' | 'warning' | 'error';
|
||||
|
||||
@@ -17,12 +17,28 @@ const App: React.FC = () => {
|
||||
return (
|
||||
<>
|
||||
{contextHolder}
|
||||
<Space>
|
||||
<Button onClick={() => openNotificationWithIcon('success')}>Success</Button>
|
||||
<Button onClick={() => openNotificationWithIcon('info')}>Info</Button>
|
||||
<Button onClick={() => openNotificationWithIcon('warning')}>Warning</Button>
|
||||
<Button onClick={() => openNotificationWithIcon('error')}>Error</Button>
|
||||
</Space>
|
||||
<Flex gap={8} wrap="wrap">
|
||||
<Button
|
||||
color="green"
|
||||
variant="outlined"
|
||||
onClick={() => openNotificationWithIcon('success')}
|
||||
>
|
||||
Success
|
||||
</Button>
|
||||
<Button color="blue" variant="outlined" onClick={() => openNotificationWithIcon('info')}>
|
||||
Info
|
||||
</Button>
|
||||
<Button
|
||||
color="yellow"
|
||||
variant="outlined"
|
||||
onClick={() => openNotificationWithIcon('warning')}
|
||||
>
|
||||
Warning
|
||||
</Button>
|
||||
<Button color="red" variant="outlined" onClick={() => openNotificationWithIcon('error')}>
|
||||
Error
|
||||
</Button>
|
||||
</Flex>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -377,10 +377,13 @@ const genNotificationStyle: GenerateStyle<NotificationToken> = (token) => {
|
||||
export const prepareComponentToken = (token: AliasToken) => ({
|
||||
zIndexPopup: token.zIndexPopupBase + CONTAINER_MAX_OFFSET + 50,
|
||||
width: 384,
|
||||
colorSuccessBg: token.colorSuccessBg,
|
||||
colorErrorBg: token.colorErrorBg,
|
||||
colorInfoBg: token.colorInfoBg,
|
||||
colorWarningBg: token.colorWarningBg,
|
||||
// Fix notification background color issue
|
||||
// https://github.com/ant-design/ant-design/issues/55649
|
||||
// https://github.com/ant-design/ant-design/issues/56055
|
||||
colorSuccessBg: undefined,
|
||||
colorErrorBg: undefined,
|
||||
colorInfoBg: undefined,
|
||||
colorWarningBg: undefined,
|
||||
});
|
||||
|
||||
export const prepareNotificationToken: (
|
||||
|
||||
@@ -9402,11 +9402,7 @@ exports[`renders components/space/demo/compact.tsx extend context correctly 1`]
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/space/demo/compact.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/space/demo/compact.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/space/demo/compact-button-vertical.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
@@ -16427,11 +16423,7 @@ Array [
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders components/space/demo/compact-nested.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/space/demo/compact-nested.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/space/demo/debug.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
|
||||
@@ -74,4 +74,37 @@ describe('useSizes', () => {
|
||||
// In impossible case, should average fill (1000 / 3 = 333.33... for each)
|
||||
expect(postPxSizes).toEqual([1000 / 3, 1000 / 3, 1000 / 3]);
|
||||
});
|
||||
|
||||
it('should average if size total is not 100%', () => {
|
||||
const items = [
|
||||
{
|
||||
size: '20%',
|
||||
},
|
||||
{
|
||||
size: '30%',
|
||||
},
|
||||
];
|
||||
|
||||
const { result } = renderHook(() => useSizes(items, containerSize));
|
||||
const [sizes] = result.current;
|
||||
|
||||
// Check sizes
|
||||
expect(sizes).toEqual([400, 600]);
|
||||
});
|
||||
|
||||
it('should correct when all size is 0', () => {
|
||||
const items = [
|
||||
{
|
||||
size: 0,
|
||||
},
|
||||
{
|
||||
size: 0,
|
||||
},
|
||||
];
|
||||
|
||||
const { result } = renderHook(() => useSizes(items, containerSize));
|
||||
const [, postPxSizes] = result.current;
|
||||
|
||||
expect(postPxSizes).toEqual([500, 500]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,6 +19,18 @@ export function autoPtgSizes(
|
||||
const restPtg = 1 - currentTotalPtg;
|
||||
const undefinedCount = undefinedIndexes.length;
|
||||
|
||||
// If all sizes are defined but don't sum to 1, scale them.
|
||||
if (ptgSizes.length && !undefinedIndexes.length && currentTotalPtg !== 1) {
|
||||
// Handle the case when all sizes are 0
|
||||
if (currentTotalPtg === 0) {
|
||||
const avg = 1 / ptgSizes.length;
|
||||
return ptgSizes.map(() => avg);
|
||||
}
|
||||
const scale = 1 / currentTotalPtg;
|
||||
// We know `size` is a number here because undefinedIndexes is empty.
|
||||
return ptgSizes.map((size) => (size as number) * scale);
|
||||
}
|
||||
|
||||
// Fill if exceed
|
||||
if (restPtg < 0) {
|
||||
const scale = 1 / currentTotalPtg;
|
||||
|
||||
@@ -4718,11 +4718,7 @@ exports[`renders components/tree/demo/search.tsx extend context correctly 1`] =
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/tree/demo/search.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Input] \`addonAfter\` is deprecated. Please use \`Space.Compact\` instead.",
|
||||
]
|
||||
`;
|
||||
exports[`renders components/tree/demo/search.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/tree/demo/switcher-icon.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antd",
|
||||
"version": "5.29.1",
|
||||
"version": "5.29.2",
|
||||
"description": "An enterprise-class UI design language and React components implementation",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
|
||||
@@ -10,6 +10,8 @@ const cwd = process.cwd();
|
||||
const git = simpleGit(cwd);
|
||||
const spinner = ora('Loading unicorns').start('开始检查仓库状态');
|
||||
|
||||
export const STABLE_BRANCH = '5.x-stable';
|
||||
|
||||
function exitProcess(code = 1) {
|
||||
console.log(''); // Keep an empty line here to make looks good~
|
||||
process.exit(code);
|
||||
@@ -52,8 +54,8 @@ async function checkBranch({ current }: StatusResult) {
|
||||
version.includes('-experimental.')
|
||||
) {
|
||||
spinner.info(chalk.cyan('😃 Alpha version. Skip branch check.'));
|
||||
} else if (current !== 'master') {
|
||||
spinner.fail(chalk.red('🤔 You are not in the master branch!'));
|
||||
} else if (current !== STABLE_BRANCH) {
|
||||
spinner.fail(chalk.red(`🤔 You are not in the ${STABLE_BRANCH} branch!`));
|
||||
exitProcess();
|
||||
}
|
||||
spinner.succeed('分支检查通过');
|
||||
@@ -73,7 +75,7 @@ async function checkCommit({ files }: StatusResult) {
|
||||
|
||||
async function checkRemote() {
|
||||
spinner.start('正在检查远程分支');
|
||||
const { remote } = await git.fetch('origin', 'master');
|
||||
const { remote } = await git.fetch('origin', STABLE_BRANCH);
|
||||
if (!remote?.includes('ant-design/ant-design')) {
|
||||
const { value } = await git.getConfig('remote.origin.url');
|
||||
if (!value?.includes('ant-design/ant-design')) {
|
||||
|
||||
@@ -98,7 +98,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
|
||||
|
||||
// Not find to use the latest version instead
|
||||
defaultVersionObj = defaultVersionObj || defaultVersionList[defaultVersionList.length - 1];
|
||||
let defaultVersion = defaultVersionObj ? defaultVersionObj.value : null;
|
||||
let defaultVersion = defaultVersionObj ? defaultVersionObj.value : undefined;
|
||||
|
||||
// If default version is less than current, use current
|
||||
if (semver.compare(defaultVersion!, distTags[CONCH_TAG]) < 0) {
|
||||
|
||||
@@ -234,7 +234,9 @@ const runPrePublish = async () => {
|
||||
firstArtifactFile = await Promise.any([downloadArtifactPromise, downloadOSSPromise]);
|
||||
} catch (error) {
|
||||
showMessage(
|
||||
chalk.bgRedBright(`下载失败 ${error},请确认你当前 ${sha.slice(0, 6)} 位于 master 分支中`),
|
||||
chalk.bgRedBright(
|
||||
`下载失败 ${error},请确认你当前 ${sha.slice(0, 6)} 位于 5.x-stable 分支中`,
|
||||
),
|
||||
'fail',
|
||||
);
|
||||
process.exit(1);
|
||||
|
||||
@@ -85,15 +85,17 @@ async function printLog() {
|
||||
|
||||
let toVersion = await select({
|
||||
message: `🔀 Please choose branch to compare with ${chalk.magenta(fromVersion)}:`,
|
||||
choices: ['master', '4.x-stable', '3.x-stable', 'feature', 'custom input ⌨️'].map((i) => ({
|
||||
name: i,
|
||||
value: i,
|
||||
})),
|
||||
choices: ['master', '5.x-stable', '4.x-stable', '3.x-stable', 'feature', 'custom input ⌨️'].map(
|
||||
(i) => ({
|
||||
name: i,
|
||||
value: i,
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
if (toVersion.startsWith('custom input')) {
|
||||
toVersion = await input({
|
||||
default: 'master',
|
||||
default: '5.x-stable',
|
||||
message: `🔀 Please input custom git hash id or branch name to compare with ${chalk.magenta(
|
||||
fromVersion,
|
||||
)}:`,
|
||||
|
||||
@@ -65,8 +65,9 @@ async function parseArgs() {
|
||||
if (!baseRef) {
|
||||
baseRef = await select({
|
||||
message: '📚 请选择基准分支',
|
||||
default: 'master',
|
||||
default: '5.x-stable',
|
||||
choices: [
|
||||
'5.x-stable',
|
||||
'master',
|
||||
'feature',
|
||||
'next',
|
||||
@@ -77,7 +78,7 @@ async function parseArgs() {
|
||||
if (baseRef.endsWith('Custom Input')) {
|
||||
baseRef = await input({
|
||||
message: '📚 请输入基准分支',
|
||||
default: 'master',
|
||||
default: '5.x-stable',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user