Merge branch 'master' into master-merge-feature

This commit is contained in:
栗嘉男 2023-10-15 20:38:10 +08:00
commit 0de095cc03
16 changed files with 56 additions and 15 deletions

View File

@ -1,6 +1,6 @@
import { startTransition, useState } from 'react';
const useLayoutState = <S>(
const useLayoutState: typeof useState = <S>(
...args: Parameters<typeof useState<S>>
): ReturnType<typeof useState<S>> => {
const [state, setState] = useState<S>(...args);

View File

@ -101,7 +101,7 @@ export default function ThemePicker(props: ThemePickerProps) {
onChange?.(theme);
}}
>
<input type="radio" name="theme" id={index === 0 ? id : null} />
<input type="radio" name="theme" id={index === 0 ? id : undefined} />
<img src={url} alt={theme} />
</label>
<span>{locale[theme as keyof typeof locale]}</span>

View File

@ -2,7 +2,7 @@ import React from 'react';
import { Global, css } from '@emotion/react';
import { useTheme } from 'antd-style';
const gray = {
const gray: { [key: number]: string } = {
1: '#fff',
2: '#fafafa',
3: '#f5f5f5',
@ -25,7 +25,7 @@ const ColorStyle = () => {
if (index <= 10) {
return `
.palette-${color}-${index} {
background: ${token[`${color}-${index}`]};
background: ${(token as any)[`${color}-${index}`]};
}
${makePalette(color, index + 1)}
`;

View File

@ -7,7 +7,7 @@ const ltrD =
const rtlD =
'M256 64l512 0 0 128-128 0 0 768-128 0 0-768-128 0 0 768-128 0 0-448c-123.712 0-224-100.288-224-224s100.288-224 224-224zM960 896l-256-224 256-224z';
const DirectionIcon: React.FC<{ direction: DirectionType }> = (props) => (
const DirectionIcon: React.FC<{ direction: DirectionType; className?: string }> = (props) => (
<Icon {...props}>
<svg viewBox="0 0 1024 1024" fill="currentColor">
<path d={props.direction === 'ltr' ? ltrD : rtlD} />

View File

@ -45,7 +45,7 @@ const getAlgorithm = (themes: ThemeName[] = []) =>
}
return null;
})
.filter((item) => item);
.filter((item) => item) as typeof antdTheme.darkAlgorithm[];
const GlobalLayout: React.FC = () => {
const outlet = useOutlet();
@ -109,7 +109,7 @@ const GlobalLayout: React.FC = () => {
setSiteState({
theme: _theme,
direction: _direction === 'rtl' ? 'rtl' : 'ltr',
bannerVisible: storedBannerVisibleLastTime ? storedBannerVisible : true,
bannerVisible: storedBannerVisibleLastTime ? !!storedBannerVisible : true,
});
// Handle isMobile
updateMobileMode();

View File

@ -57,7 +57,7 @@ const AffixTabs: React.FC = () => {
const containerRef = React.useRef<HTMLDivElement>(null);
const idsRef = React.useRef<string[]>([]);
const [loaded, setLoaded] = React.useState(false);
const [fixedId, setFixedId] = React.useState<string | null>(null);
const [fixedId, setFixedId] = React.useState<string | undefined>(undefined);
const {
styles: { affixTabs, affixTabsFixed, span },
@ -100,7 +100,7 @@ const AffixTabs: React.FC = () => {
}
}
setFixedId(null);
setFixedId(undefined);
}
return throttle(doSync);

View File

@ -37,7 +37,7 @@ const Community: React.FC = () => {
);
};
export const getEcosystemGroup = (): MenuProps['items'] => [
export const getEcosystemGroup = (): Exclude<MenuProps['items'], undefined> => [
{
label: (
<a href="https://charts.ant.design" target="_blank" rel="noopener noreferrer">

View File

@ -215,7 +215,8 @@ export default ({
label: (
<Link
to={utils.getLocalizedPathname(
blogList.sort((a, b) => (a.frontmatter.date > b.frontmatter.date ? -1 : 1))[0].link,
blogList.sort((a, b) => (a.frontmatter?.date > b.frontmatter?.date ? -1 : 1))[0]
.link,
isZhCN,
search,
)}

View File

@ -11,6 +11,7 @@ export interface LangBtnProps {
value: 1 | 2;
pure?: boolean;
onClick?: React.MouseEventHandler;
['aria-label']?: string;
}
const BASE_SIZE = '1.2em';

View File

@ -30,6 +30,11 @@ const locales = {
shortMessage: '支付宝语雀 · 大学生公益计划火热进行中!',
more: '了解更多',
},
en: {
message: '',
shortMessage: '',
more: '',
},
};
const useStyle = createStyles(({ token, css }) => {

View File

@ -16,6 +16,23 @@ tag: vVERSION
---
## 5.10.1
`2023-10-15`
- ⚡️ Optimize CSS-in-JS Design Token cache matching. [#45302](https://github.com/ant-design/ant-design/pull/45302)
- 🆕 Checkbox.Group &amp; Radio.Group `options` add missing `id` props. [#45287](https://github.com/ant-design/ant-design/pull/45287)
- 🐞 Fix Affix that `target` not work. [#45314](https://github.com/ant-design/ant-design/pull/45314) [@mingming-ma](https://github.com/mingming-ma)
- 🐞 MISC: Add `csp` attribute for icon style. [#45334](https://github.com/ant-design/ant-design/pull/45334) [@AlexeyTeterin](https://github.com/AlexeyTeterin)
- 🐞 Fix Button that does not display loading status when `loading` property is set to `{ delay: 0 }`. [#45282](https://github.com/ant-design/ant-design/pull/45282) [@YDFlame13](https://github.com/YDFlame13)
- 🐞 Fix Segmented text jump issue in Safari. [#45310](https://github.com/ant-design/ant-design/pull/45310)
- 🐞 Fix Watermark that can be hidden via "Hide Element" feature in browser. [#45290](https://github.com/ant-design/ant-design/pull/45290) [@Yuiai01](https://github.com/Yuiai01)
- 🐞 Fix Input that background should not be transparent when hovered or focused. [#45297](https://github.com/ant-design/ant-design/pull/45297) [@MadCcc](https://github.com/MadCcc)
- 🐞 Fix Form call `resetFields` will still keep Form.List field when its `initialValue` is set. [#45284](https://github.com/ant-design/ant-design/pull/45284)
- 🐞 Fix Tree.DirectoryTree `selectedNodes` in `onSelect` method could not get a value when configuring `fieldNames`. [#45036](https://github.com/ant-design/ant-design/pull/45036) [@Zian502](https://github.com/Zian502)
- 💄 Revert outline style of Input, InputNumber, Select, Cascader, TreeSelect, DatePicker, TimePicker, ColorPicker. [#45286](https://github.com/ant-design/ant-design/pull/45286) [@MadCcc](https://github.com/MadCcc)
- 💄 Fix Card style with small size Tabs. [#45272](https://github.com/ant-design/ant-design/pull/45272) [@MadCcc](https://github.com/MadCcc)
## 5.10.0
`2023-10-10`

View File

@ -16,6 +16,23 @@ tag: vVERSION
---
## 5.10.1
`2023-10-15`
- ⚡️ 优化 CSS-in-JS Design Token 缓存命中性能。[#45302](https://github.com/ant-design/ant-design/pull/45302)
- 🆕 为 Checkbox.Group 与 Radio.Group 的 `options` 添加 `id` 属性支持。[#45287](https://github.com/ant-design/ant-design/pull/45287)
- 🐞 修复 Affix 组件设置 `target` 失效的问题。[#45314](https://github.com/ant-design/ant-design/pull/45314) [@mingming-ma](https://github.com/mingming-ma)
- 🐞 MISC: 为图标样式设置 `csp` 属性。[#45334](https://github.com/ant-design/ant-design/pull/45334) [@AlexeyTeterin](https://github.com/AlexeyTeterin)
- 🐞 修复 Button 组件 `loading` 属性设置为 `{ delay: 0 }` 时不显示加载状态。[#45282](https://github.com/ant-design/ant-design/pull/45282) [@YDFlame13](https://github.com/YDFlame13)
- 🐞 修复 Segmented 在 Safari 下切换时的样式跳动问题。[#45310](https://github.com/ant-design/ant-design/pull/45310)
- 🐞 修复 Watermark可以使用浏览器的 `Hide Element` 来隐藏水印。[#45290](https://github.com/ant-design/ant-design/pull/45290) [@Yuiai01](https://github.com/Yuiai01)
- 🐞 修复 Input 组件 hover 或者 focus 状态时背景色变为透明的问题。[#45297](https://github.com/ant-design/ant-design/pull/45297) [@MadCcc](https://github.com/MadCcc)
- 🐞 修复 Form 在调用 `resetFields` 时,无法重置配置了 `initialValue` 的 Form.List 的问题。[#45284](https://github.com/ant-design/ant-design/pull/45284)
- 🐞 修复 Tree.DirectoryTree 在配置 `fieldNames` 时,`onSelect` 方法中的 `selectedNodes` 无法获取值。[#45036](https://github.com/ant-design/ant-design/pull/45036) [@Zian502](https://github.com/Zian502)
- 💄 回滚 Input、InputNumber、Select、Cascader、TreeSelect、DatePicker、TimePicker、ColorPicker 的描边样式。[#45286](https://github.com/ant-design/ant-design/pull/45286) [@MadCcc](https://github.com/MadCcc)
- 💄 修复 Card 搭配小尺寸 Tabs 时的样式问题。[#45272](https://github.com/ant-design/ant-design/pull/45272) [@MadCcc](https://github.com/MadCcc)
## 5.10.0
`2023-10-10`

View File

@ -13,7 +13,7 @@ You might want to use another date library (**Ant design currently supports [mom
The first way is to use `generatePicker` (or `generateCalendar`) to help create Picker components.
First, we initialize an antd demo with `create-react-app`. You can refer to [Use in TypeScript](/docs/react/use-in-typescript), or you can start directly here [init antd](https://github.com/xiaohuoni/antd4-generate-picker/commit/47fec964e36d48bd15760f8f5abcb9655c259aa6)
First, we initialize an antd demo with `create-react-app`. You can refer to [Usage with create-react-app](/docs/react/use-with-create-react-app), or you can start directly here [init antd](https://github.com/xiaohuoni/antd4-generate-picker/commit/47fec964e36d48bd15760f8f5abcb9655c259aa6)
### DatePicker.tsx

View File

@ -11,7 +11,7 @@ Ant Design 默认使用 [Day.js](https://day.js.org) 来处理时间日期问题
第一种方法是使用 `generatePicker`(或 `generateCalendar`)辅助创建 Picker 组件。
我们先初始化一个 `create-react-app` 的 antd demo你可以参考 [TypeScript 中使用](/docs/react/use-in-typescript) 进行构建,也可以直接从这里开始[init antd](https://github.com/xiaohuoni/antd4-generate-picker/commit/47fec964e36d48bd15760f8f5abcb9655c259aa6)
我们先初始化一个 `create-react-app` 的 antd demo你可以参考 [create-react-app 中使用](/docs/react/use-with-create-react-app-cn) 进行构建,也可以直接从这里开始[init antd](https://github.com/xiaohuoni/antd4-generate-picker/commit/47fec964e36d48bd15760f8f5abcb9655c259aa6)
### DatePicker.tsx

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "5.10.0",
"version": "5.10.1",
"packageManager": "^npm@9.0.0",
"description": "An enterprise-class UI design language and React components implementation",
"title": "Ant Design",

View File

@ -52,7 +52,7 @@ describe('site test', () => {
server = createServer({ root: join(process.cwd(), '_site') });
server.listen(port);
// eslint-disable-next-line no-console
console.log('site static server run: http://localhost:3000');
console.log(`site static server run: http://localhost:${port}`);
});
afterAll(() => {