mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
Merge pull request #46710 from ant-design/master
chore: merge master into feature
This commit is contained in:
commit
276e66cdaa
@ -16,6 +16,25 @@ tag: vVERSION
|
||||
|
||||
---
|
||||
|
||||
## 5.12.6
|
||||
|
||||
`2023-12-30`
|
||||
|
||||
- 🐞 Fix Upload accessibility issue of tabbing twicely. [#46432](https://github.com/ant-design/ant-design/pull/46432)
|
||||
- 🐞 Fix Modal `footer` Button duplicated gap style. [#46702](https://github.com/ant-design/ant-design/pull/46702)
|
||||
- Select
|
||||
- 🐞 Fix Select that scrollbar do not display in some case. [#46696](https://github.com/ant-design/ant-design/pull/46696) [@MadCcc](https://github.com/MadCcc)
|
||||
- 💄 Optimize Select style of multiple selection. [#46646](https://github.com/ant-design/ant-design/pull/46646) [@MadCcc](https://github.com/MadCcc)
|
||||
- Tree
|
||||
- 🐞 Fix Tree that scrollbar do not display in some case. [#46672](https://github.com/ant-design/ant-design/pull/46672) [@yyz945947732](https://github.com/yyz945947732)
|
||||
- 💄 Optimize Tree the TreeNode style when focused. [#46608](https://github.com/ant-design/ant-design/pull/46608) [@MadCcc](https://github.com/MadCcc)
|
||||
- 🐞 Fix Layout.Sider will collapse when trigger printer. [#46650](https://github.com/ant-design/ant-design/pull/46650) [@anilpixel](https://github.com/anilpixel)
|
||||
- 🐞 Fix Table style with edge shadow overflow. [#46644](https://github.com/ant-design/ant-design/pull/46644) [@Fatpandac](https://github.com/Fatpandac)
|
||||
- 🐞 Typography.Text should update the Tooltip when the width changes. [#46613](https://github.com/ant-design/ant-design/pull/46613) [@linxianxi](https://github.com/linxianxi)
|
||||
- 🐞 Fix Tooltip, Popover or other popup like component arrow issue when in nest case. [#46294](https://github.com/ant-design/ant-design/pull/46294) [@bestlyg](https://github.com/bestlyg)
|
||||
- TypeScript
|
||||
- 🤖 Export ConfigProvider `ConfigProviderProps` type. [#46605](https://github.com/ant-design/ant-design/pull/46605) [@li-jia-nan](https://github.com/li-jia-nan)
|
||||
|
||||
## 5.12.5
|
||||
|
||||
`2023-12-22`
|
||||
|
@ -16,6 +16,25 @@ tag: vVERSION
|
||||
|
||||
---
|
||||
|
||||
## 5.12.6
|
||||
|
||||
`2023-12-30`
|
||||
|
||||
- 🐞 修复 Upload 组件包裹 Button 时 Tab 键会聚焦两次的问题。[#46432](https://github.com/ant-design/ant-design/pull/46432)
|
||||
- 🐞 修复 Modal `footer` 内 Button 可能重复的边距样式问题。[#46702](https://github.com/ant-design/ant-design/pull/46702)
|
||||
- Select
|
||||
- 🐞 修复 Select 组件滚动条在某些条件下不会显示的问题。[#46696](https://github.com/ant-design/ant-design/pull/46696) [@MadCcc](https://github.com/MadCcc)
|
||||
- 💄 优化 Select 组件多选时选项样式。[#46646](https://github.com/ant-design/ant-design/pull/46646) [@MadCcc](https://github.com/MadCcc)
|
||||
- Tree
|
||||
- 🐞 修复 Tree 组件滚动条在某些条件下不会显示的问题。[#46672](https://github.com/ant-design/ant-design/pull/46672) [@yyz945947732](https://github.com/yyz945947732)
|
||||
- 💄 优化 Tree 组件 TreeNode 节点聚焦样式。[#46608](https://github.com/ant-design/ant-design/pull/46608) [@MadCcc](https://github.com/MadCcc)
|
||||
- 🐞 修复触发打印时,Layout.Sider 会收起的问题。[#46650](https://github.com/ant-design/ant-design/pull/46650) [@anilpixel](https://github.com/anilpixel)
|
||||
- 🐞 修复 Table 边缘阴影会超出 Table 高度。[#46644](https://github.com/ant-design/ant-design/pull/46644) [@Fatpandac](https://github.com/Fatpandac)
|
||||
- 🐞 修复 Typography.Text 省略模式下修改宽度 Tooltip 不会触发的问题。[#46613](https://github.com/ant-design/ant-design/pull/46613) [@linxianxi](https://github.com/linxianxi)
|
||||
- 🐞 修复 Tooltip、Popover 等弹出组件嵌套使用时,箭头样式问题。[#46294](https://github.com/ant-design/ant-design/pull/46294) [@bestlyg](https://github.com/bestlyg)
|
||||
- TypeScript
|
||||
- 🤖 ConfigProvider 导出 `ConfigProviderProps` 类型。[#46605](https://github.com/ant-design/ant-design/pull/46605) [@li-jia-nan](https://github.com/li-jia-nan)
|
||||
|
||||
## 5.12.5
|
||||
|
||||
`2023-12-22`
|
||||
|
@ -42235,8 +42235,6 @@ exports[`ConfigProvider components Upload configProvider 1`] = `
|
||||
>
|
||||
<span
|
||||
class="config-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -42333,7 +42331,6 @@ exports[`ConfigProvider components Upload configProvider componentDisabled 1`] =
|
||||
>
|
||||
<span
|
||||
class="config-upload config-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -42400,8 +42397,6 @@ exports[`ConfigProvider components Upload configProvider componentSize large 1`]
|
||||
>
|
||||
<span
|
||||
class="config-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -42498,8 +42493,6 @@ exports[`ConfigProvider components Upload configProvider componentSize middle 1`
|
||||
>
|
||||
<span
|
||||
class="config-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -42596,8 +42589,6 @@ exports[`ConfigProvider components Upload configProvider componentSize small 1`]
|
||||
>
|
||||
<span
|
||||
class="config-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -42694,8 +42685,6 @@ exports[`ConfigProvider components Upload normal 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -42792,8 +42781,6 @@ exports[`ConfigProvider components Upload prefixCls 1`] = `
|
||||
>
|
||||
<span
|
||||
class="prefix-Upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -5184,7 +5184,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -5192,7 +5191,10 @@ Array [
|
||||
style="display: none;"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border: 0px; background: none;"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -5220,7 +5222,7 @@ Array [
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -21114,8 +21116,6 @@ exports[`renders components/form/demo/validate-other.tsx extend context correctl
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -2718,7 +2718,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -2726,7 +2725,10 @@ Array [
|
||||
style="display:none"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border:0;background:none"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -2754,7 +2756,7 @@ Array [
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -9670,8 +9672,6 @@ exports[`renders components/form/demo/validate-other.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -933,7 +933,6 @@ exports[`Form form should support disabled 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -102,10 +102,10 @@ const FormDisabledDemo: React.FC = () => {
|
||||
</Form.Item>
|
||||
<Form.Item label="Upload" valuePropName="fileList" getValueFromEvent={normFile}>
|
||||
<Upload action="/upload.do" listType="picture-card">
|
||||
<div>
|
||||
<button style={{ border: 0, background: 'none' }} type="button">
|
||||
<PlusOutlined />
|
||||
<div style={{ marginTop: 8 }}>Upload</div>
|
||||
</div>
|
||||
</button>
|
||||
</Upload>
|
||||
</Form.Item>
|
||||
<Form.Item label="Button">
|
||||
|
@ -177,8 +177,6 @@ exports[`renders components/space/demo/base.tsx extend context correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -175,8 +175,6 @@ exports[`renders components/space/demo/base.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -6,8 +6,14 @@ import type { UploadProps } from './interface';
|
||||
export type DraggerProps = UploadProps & { height?: number };
|
||||
|
||||
const Dragger = React.forwardRef<UploadRef, DraggerProps>(
|
||||
({ style, height, ...restProps }, ref) => (
|
||||
<Upload ref={ref} {...restProps} type="drag" style={{ ...style, height }} />
|
||||
({ style, height, hasControlInside = false, ...restProps }, ref) => (
|
||||
<Upload
|
||||
ref={ref}
|
||||
hasControlInside={hasControlInside}
|
||||
{...restProps}
|
||||
type="drag"
|
||||
style={{ ...style, height }}
|
||||
/>
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -60,6 +60,7 @@ const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (
|
||||
maxCount,
|
||||
data = {},
|
||||
multiple = false,
|
||||
hasControlInside = true,
|
||||
action = '',
|
||||
accept = '',
|
||||
supportServerRender = true,
|
||||
@ -350,6 +351,7 @@ const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (
|
||||
disabled: mergedDisabled,
|
||||
beforeUpload: mergedBeforeUpload,
|
||||
onChange: undefined,
|
||||
hasControlInside,
|
||||
} as RcUploadProps;
|
||||
|
||||
delete rcUploadProps.className;
|
||||
|
@ -10,15 +10,16 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display: none;"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border: 0px; background: none;"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -46,7 +47,7 @@ Array [
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</span>,
|
||||
@ -58,15 +59,16 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display: none;"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border: 0px; background: none;"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -94,7 +96,7 @@ Array [
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</span>,
|
||||
@ -112,8 +114,6 @@ exports[`renders components/upload/demo/basic.tsx extend context correctly 1`] =
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -170,8 +170,6 @@ exports[`renders components/upload/demo/component-token.tsx extend context corre
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -470,8 +468,6 @@ exports[`renders components/upload/demo/customize-progress-bar.tsx extend contex
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -534,7 +530,6 @@ exports[`renders components/upload/demo/debug-disabled.tsx extend context correc
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -561,7 +556,6 @@ exports[`renders components/upload/demo/debug-disabled.tsx extend context correc
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -837,7 +831,6 @@ exports[`renders components/upload/demo/debug-disabled.tsx extend context correc
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -845,7 +838,10 @@ exports[`renders components/upload/demo/debug-disabled.tsx extend context correc
|
||||
style="display: none;"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border: 0px; background: none;"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -873,7 +869,7 @@ exports[`renders components/upload/demo/debug-disabled.tsx extend context correc
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1109,7 +1105,6 @@ exports[`renders components/upload/demo/debug-disabled.tsx extend context correc
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -1117,7 +1112,10 @@ exports[`renders components/upload/demo/debug-disabled.tsx extend context correc
|
||||
style="display: none;"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border: 0px; background: none;"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -1145,7 +1143,7 @@ exports[`renders components/upload/demo/debug-disabled.tsx extend context correc
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1228,8 +1226,6 @@ exports[`renders components/upload/demo/defaultFileList.tsx extend context corre
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -1528,8 +1524,6 @@ exports[`renders components/upload/demo/directory.tsx extend context correctly 1
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -1654,8 +1648,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -2713,15 +2705,16 @@ exports[`renders components/upload/demo/file-type.tsx extend context correctly 1
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display: none;"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border: 0px; background: none;"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -2749,7 +2742,7 @@ exports[`renders components/upload/demo/file-type.tsx extend context correctly 1
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -2767,8 +2760,6 @@ exports[`renders components/upload/demo/fileList.tsx extend context correctly 1`
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -2908,8 +2899,6 @@ exports[`renders components/upload/demo/max-count.tsx extend context correctly 1
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -2965,8 +2954,6 @@ exports[`renders components/upload/demo/max-count.tsx extend context correctly 1
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -3514,15 +3501,16 @@ exports[`renders components/upload/demo/picture-card.tsx extend context correctl
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display: none;"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border: 0px; background: none;"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -3550,7 +3538,7 @@ exports[`renders components/upload/demo/picture-card.tsx extend context correctl
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -3789,15 +3777,16 @@ exports[`renders components/upload/demo/picture-circle.tsx extend context correc
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display: none;"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border: 0px; background: none;"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -3825,7 +3814,7 @@ exports[`renders components/upload/demo/picture-circle.tsx extend context correc
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -3844,8 +3833,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4141,8 +4128,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4442,8 +4427,6 @@ exports[`renders components/upload/demo/preview-file.tsx extend context correctl
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4500,8 +4483,6 @@ exports[`renders components/upload/demo/transform-file.tsx extend context correc
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4558,8 +4539,6 @@ exports[`renders components/upload/demo/upload-custom-action-icon.tsx extend con
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4877,8 +4856,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4946,8 +4923,6 @@ exports[`renders components/upload/demo/upload-png-only.tsx extend context corre
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -5033,8 +5008,6 @@ exports[`renders components/upload/demo/upload-with-aliyun-oss.tsx extend contex
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -10,15 +10,16 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display:none"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border:0;background:none"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -46,7 +47,7 @@ Array [
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</span>,
|
||||
@ -58,15 +59,16 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display:none"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border:0;background:none"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -94,7 +96,7 @@ Array [
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</span>,
|
||||
@ -110,8 +112,6 @@ exports[`renders components/upload/demo/basic.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -166,8 +166,6 @@ exports[`renders components/upload/demo/component-token.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -445,8 +443,6 @@ exports[`renders components/upload/demo/customize-progress-bar.tsx correctly 1`]
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -507,7 +503,6 @@ exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -534,7 +529,6 @@ exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -791,7 +785,6 @@ exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -799,7 +792,10 @@ exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = `
|
||||
style="display:none"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border:0;background:none"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -827,7 +823,7 @@ exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = `
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1044,7 +1040,6 @@ exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -1052,7 +1047,10 @@ exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = `
|
||||
style="display:none"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border:0;background:none"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -1080,7 +1078,7 @@ exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = `
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1161,8 +1159,6 @@ exports[`renders components/upload/demo/defaultFileList.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -1440,8 +1436,6 @@ exports[`renders components/upload/demo/directory.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -1561,8 +1555,6 @@ exports[`renders components/upload/demo/drag-sorting.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -2526,15 +2518,16 @@ exports[`renders components/upload/demo/file-type.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display:none"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border:0;background:none"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -2562,7 +2555,7 @@ exports[`renders components/upload/demo/file-type.tsx correctly 1`] = `
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -2578,8 +2571,6 @@ exports[`renders components/upload/demo/fileList.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -2717,8 +2708,6 @@ exports[`renders components/upload/demo/max-count.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -2774,8 +2763,6 @@ exports[`renders components/upload/demo/max-count.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -3302,15 +3289,16 @@ exports[`renders components/upload/demo/picture-card.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display:none"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border:0;background:none"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -3338,7 +3326,7 @@ exports[`renders components/upload/demo/picture-card.tsx correctly 1`] = `
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -3556,15 +3544,16 @@ exports[`renders components/upload/demo/picture-circle.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
style="display:none"
|
||||
type="file"
|
||||
/>
|
||||
<div>
|
||||
<button
|
||||
style="border:0;background:none"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="plus"
|
||||
class="anticon anticon-plus"
|
||||
@ -3592,7 +3581,7 @@ exports[`renders components/upload/demo/picture-circle.tsx correctly 1`] = `
|
||||
>
|
||||
Upload
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -3609,8 +3598,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -3887,8 +3874,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4167,8 +4152,6 @@ exports[`renders components/upload/demo/preview-file.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4223,8 +4206,6 @@ exports[`renders components/upload/demo/transform-file.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4279,8 +4260,6 @@ exports[`renders components/upload/demo/upload-custom-action-icon.tsx correctly
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4577,8 +4556,6 @@ Array [
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4644,8 +4621,6 @@ exports[`renders components/upload/demo/upload-png-only.tsx correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -4729,8 +4704,6 @@ exports[`renders components/upload/demo/upload-with-aliyun-oss.tsx correctly 1`]
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -10,8 +10,6 @@ exports[`Upload rtl render component should be rendered correctly in RTL directi
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -9,8 +9,6 @@ exports[`Upload List handle error 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -171,8 +169,6 @@ exports[`Upload List should be uploading when upload a file 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -274,8 +270,6 @@ exports[`Upload List should non-image format file preview 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -992,8 +986,6 @@ exports[`Upload List should support removeIcon and downloadIcon 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -1139,8 +1131,6 @@ exports[`Upload List should support removeIcon and downloadIcon 2`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
@ -1286,8 +1276,6 @@ exports[`Upload List should support showRemoveIcon and showPreviewIcon 1`] = `
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<input
|
||||
accept=""
|
||||
|
@ -41,10 +41,10 @@ const App: React.FC = () => {
|
||||
};
|
||||
|
||||
const uploadButton = (
|
||||
<div>
|
||||
<button style={{ border: 0, background: 'none' }} type="button">
|
||||
{loading ? <LoadingOutlined /> : <PlusOutlined />}
|
||||
<div style={{ marginTop: 8 }}>Upload</div>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -34,10 +34,10 @@ const fileList: UploadFile[] = [
|
||||
|
||||
const App: React.FC = () => {
|
||||
const uploadButton = (
|
||||
<div>
|
||||
<button style={{ border: 0, background: 'none' }} type="button">
|
||||
<PlusOutlined />
|
||||
<div style={{ marginTop: 8 }}>Upload</div>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -93,10 +93,10 @@ const App: React.FC = () => {
|
||||
};
|
||||
|
||||
const uploadButton = (
|
||||
<div>
|
||||
<button style={{ border: 0, background: 'none' }} type="button">
|
||||
<PlusOutlined />
|
||||
<div style={{ marginTop: 8 }}>Upload</div>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -71,10 +71,10 @@ const App: React.FC = () => {
|
||||
setFileList(newFileList);
|
||||
|
||||
const uploadButton = (
|
||||
<div>
|
||||
<button style={{ border: 0, background: 'none' }} type="button">
|
||||
<PlusOutlined />
|
||||
<div style={{ marginTop: 8 }}>Upload</div>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
|
@ -53,10 +53,10 @@ const App: React.FC = () => {
|
||||
setFileList(newFileList);
|
||||
|
||||
const uploadButton = (
|
||||
<div>
|
||||
<button style={{ border: 0, background: 'none' }} type="button">
|
||||
<PlusOutlined />
|
||||
<div style={{ marginTop: 8 }}>Upload</div>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
|
@ -87,7 +87,7 @@ type TransformFileHandler = (
|
||||
) => string | Blob | File | PromiseLike<string | Blob | File>;
|
||||
type BeforeUploadValueType = void | boolean | string | Blob | File;
|
||||
|
||||
export interface UploadProps<T = any> extends Pick<RcUploadProps, 'capture'> {
|
||||
export interface UploadProps<T = any> extends Pick<RcUploadProps, 'capture' | 'hasControlInside'> {
|
||||
type?: UploadType;
|
||||
name?: string;
|
||||
defaultFileList?: Array<UploadFile<T>>;
|
||||
|
@ -23,10 +23,14 @@ const genDraggerStyle: GenerateStyle<UploadToken> = (token) => {
|
||||
},
|
||||
|
||||
[`${componentCls}-btn`]: {
|
||||
display: 'table',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
placeContent: 'center',
|
||||
outline: 'none',
|
||||
borderRadius: token.borderRadiusLG,
|
||||
|
||||
'&:focus': {
|
||||
outline: `${unit(token.lineWidthFocus)} solid ${token.colorPrimaryBorder}`,
|
||||
},
|
||||
},
|
||||
|
||||
[`${componentCls}-drag-container`]: {
|
||||
|
@ -187,6 +187,14 @@ For historical reasons, the display names of the pop components are not uniform,
|
||||
|
||||
Please ref dynamic theme document [Legacy Browser Compatible](/docs/react/compatible-style) part.
|
||||
|
||||
## CSS-in-JS css priority conflict with tailwindcss?
|
||||
|
||||
Same as above. You can adjust antd css priority to override. Related issue: [#38794](https://github.com/ant-design/ant-design/issues/38794)
|
||||
|
||||
## How to let CSS-in-JS work with shadow DOM?
|
||||
|
||||
Please ref document [Shadow Dom Usage](/docs/react/compatible-style#shadow-dom-usage).
|
||||
|
||||
## How to disable motion?
|
||||
|
||||
Config with SeedToken:
|
||||
@ -199,14 +207,6 @@ import { ConfigProvider } from 'antd';
|
||||
</ConfigProvider>;
|
||||
```
|
||||
|
||||
## CSS-in-JS css priority conflict with tailwindcss?
|
||||
|
||||
Same as above. You can adjust antd css priority to override. Related issue: [#38794](https://github.com/ant-design/ant-design/issues/38794)
|
||||
|
||||
## How to let CSS-in-JS work with shadow DOM?
|
||||
|
||||
Please ref document [Shadow Dom Usage](/docs/react/compatible-style#shadow-dom-usage).
|
||||
|
||||
## How to support SSR?
|
||||
|
||||
Please ref dynamic theme document [SSR](/docs/react/server-side-rendering) part.
|
||||
@ -268,13 +268,47 @@ The above problem occurs if `strictNullChecks` is set to `true`, If you can dete
|
||||
|
||||
## The antd component reported an error when using the App Router of Next.js
|
||||
|
||||
If you are using the App Router of Next.js, when you use the sub-components provided by some antd components, such as `Select.Option `, `Form.Item`, etc., you may get the following error:
|
||||
If you are using the App Router of Next.js, when you use the sub-components provided by some antd components, such as `Select.Option `, `Form.Item`, `Typography.Title`, etc., you may get the following error:
|
||||
|
||||
```bash
|
||||
Error: Cannot access .Option on the server. You cannot dot into a client module from a server component. You can only pass the imported name through.
|
||||
```
|
||||
|
||||
At present, this problem is waiting for Next.js to give an official solution, before this, if you use sub-components in your page, you can try to add the following client tag at the top of the page to solve this problem:
|
||||
Currently, this problem is [waiting for Next.js to give an official solution](https://github.com/vercel/next.js/issues/51593). There are two workarounds as of now if you need to use sub-components in your page with the App Router:
|
||||
|
||||
|
||||
- Create a wrapper component that extracts the sub-components that you need, and re-exports them. Take the `Typography` component as an example. A wrapper component would look something like this:
|
||||
|
||||
```tsx
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { Typography as OriginTypography } from 'antd';
|
||||
import type { LinkProps } from 'antd/es/typography/Link';
|
||||
import type { ParagraphProps } from 'antd/es/typography/Paragraph';
|
||||
import type { TextProps } from 'antd/es/typography/Text';
|
||||
import type { TitleProps } from 'antd/es/typography/Title';
|
||||
|
||||
const Title = React.forwardRef<HTMLElement, TitleProps & React.RefAttributes<HTMLElement>>(
|
||||
(props, ref) => <OriginTypography.Title ref={ref} {...props} />,
|
||||
);
|
||||
|
||||
const Paragraph = React.forwardRef<HTMLElement, ParagraphProps & React.RefAttributes<HTMLElement>>(
|
||||
(props, ref) => <OriginTypography.Paragraph ref={ref} {...props} />,
|
||||
);
|
||||
|
||||
const Link = React.forwardRef<HTMLElement, LinkProps & React.RefAttributes<HTMLElement>>(
|
||||
(props, ref) => <OriginTypography.Link ref={ref} {...props} />,
|
||||
);
|
||||
|
||||
const Text = React.forwardRef<HTMLElement, TextProps & React.RefAttributes<HTMLElement>>(
|
||||
(props, ref) => <OriginTypography.Text ref={ref} {...props} />,
|
||||
);
|
||||
|
||||
export { Title, Link, Text, Paragraph };
|
||||
```
|
||||
|
||||
- You can also make the page fully client-rendered by adding `use client` tag at the beginning of your page's source:
|
||||
|
||||
```tsx
|
||||
'use client';
|
||||
@ -292,3 +326,5 @@ export default () => {
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
|
@ -215,6 +215,14 @@ message/notification/Modal.confirm 等静态方法不同于 `<Button />` 的渲
|
||||
|
||||
请参考动态主题文档 [兼容旧版浏览器](/docs/react/compatible-style-cn) 部分内容。
|
||||
|
||||
## CSS-in-JS 与 tailwindcss 优先级冲突?
|
||||
|
||||
同上,你可以调整 antd 样式优先级以覆盖。相关 issue: [#38794](https://github.com/ant-design/ant-design/issues/38794)
|
||||
|
||||
## CSS-in-JS 如何与 Shadow DOM 一同使用?
|
||||
|
||||
请参考文档 [Shadow Dom 场景](/docs/react/compatible-style-cn#shadow-dom-场景) 内容。
|
||||
|
||||
## 如何关闭组件动画
|
||||
|
||||
通过 SeedToken 可以很方便的实现:
|
||||
@ -227,14 +235,6 @@ import { ConfigProvider } from 'antd';
|
||||
</ConfigProvider>;
|
||||
```
|
||||
|
||||
## CSS-in-JS 与 tailwindcss 优先级冲突?
|
||||
|
||||
同上,你可以调整 antd 样式优先级以覆盖。相关 issue: [#38794](https://github.com/ant-design/ant-design/issues/38794)
|
||||
|
||||
## CSS-in-JS 如何与 Shadow DOM 一同使用?
|
||||
|
||||
请参考文档 [Shadow Dom 场景](/docs/react/compatible-style-cn#shadow-dom-场景) 内容。
|
||||
|
||||
## 如何支持 SSR?
|
||||
|
||||
请参考动态主题文档 [服务端渲染](/docs/react/server-side-rendering-cn) 部分内容。
|
||||
@ -297,18 +297,51 @@ export default () => {
|
||||
|
||||
## 使用 Next.js 的 App Router 时 antd 组件报错
|
||||
|
||||
如果你在使用 Next.js 的 App Router,当你使用 antd 中某些组件提供的子组件,如:`Select.Option`、`Form.Item` 等,可能会出现如下报错:
|
||||
如果你在使用 Next.js 的 App Router,当你使用 antd 中某些组件提供的子组件,如:`Select.Option`、`Form.Item`、`Typography.Title` 等,可能会出现如下报错:
|
||||
|
||||
```bash
|
||||
Error: Cannot access .Option on the server. You cannot dot into a client module from a server component. You can only pass the imported name through.
|
||||
```
|
||||
|
||||
目前这个问题等待 Next.js 给出官方的解决方案,在此之前,如果在你的页面中有使用子组件的话,可以尝试在页面顶部增加如下客户端标签解决这个问题:
|
||||
目前这个问题需要[等待 Next.js 官方给出解决方案](https://github.com/vercel/next.js/issues/51593),在此之前,如果你需要在使用 App router 的页面中使用子组件,目前有两种变通方法:
|
||||
|
||||
- 创建一个包裹组件,提取所需的子组件并重新导出。以 `Typography` 组件为例,代码大概像这样:
|
||||
|
||||
```tsx
|
||||
'use client';
|
||||
|
||||
// This is not real world code, just for explain
|
||||
import React from 'react';
|
||||
import { Typography as OriginTypography } from 'antd';
|
||||
import type { LinkProps } from 'antd/es/typography/Link';
|
||||
import type { ParagraphProps } from 'antd/es/typography/Paragraph';
|
||||
import type { TextProps } from 'antd/es/typography/Text';
|
||||
import type { TitleProps } from 'antd/es/typography/Title';
|
||||
|
||||
const Title = React.forwardRef<HTMLElement, TitleProps & React.RefAttributes<HTMLElement>>(
|
||||
(props, ref) => <OriginTypography.Title ref={ref} {...props} />,
|
||||
);
|
||||
|
||||
const Paragraph = React.forwardRef<HTMLElement, ParagraphProps & React.RefAttributes<HTMLElement>>(
|
||||
(props, ref) => <OriginTypography.Paragraph ref={ref} {...props} />,
|
||||
);
|
||||
|
||||
const Link = React.forwardRef<HTMLElement, LinkProps & React.RefAttributes<HTMLElement>>(
|
||||
(props, ref) => <OriginTypography.Link ref={ref} {...props} />,
|
||||
);
|
||||
|
||||
const Text = React.forwardRef<HTMLElement, TextProps & React.RefAttributes<HTMLElement>>(
|
||||
(props, ref) => <OriginTypography.Text ref={ref} {...props} />,
|
||||
);
|
||||
|
||||
export { Title, Link, Text, Paragraph };
|
||||
```
|
||||
|
||||
- 你也可以在组件的开头添加 "use client" 指令,使页面完全由客户端渲染:
|
||||
|
||||
```tsx
|
||||
'use client';
|
||||
|
||||
// 非真实代码,仅做逻辑说明
|
||||
export default () => (
|
||||
<div className="App">
|
||||
<Form>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antd",
|
||||
"version": "5.12.5",
|
||||
"version": "5.12.6",
|
||||
"description": "An enterprise-class UI design language and React components implementation",
|
||||
"keywords": [
|
||||
"ant",
|
||||
@ -157,7 +157,7 @@
|
||||
"rc-tooltip": "~6.1.3",
|
||||
"rc-tree": "~5.8.2",
|
||||
"rc-tree-select": "~5.15.0",
|
||||
"rc-upload": "~4.3.6",
|
||||
"rc-upload": "~4.5.2",
|
||||
"rc-util": "^5.38.1",
|
||||
"scroll-into-view-if-needed": "^3.1.0",
|
||||
"throttle-debounce": "^5.0.0"
|
||||
@ -198,6 +198,7 @@
|
||||
"@types/jquery": "^3.5.29",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/lodash": "^4.14.202",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "^20.10.5",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/pixelmatch": "^5.2.6",
|
||||
@ -210,6 +211,7 @@
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/react-highlight-words": "^0.16.7",
|
||||
"@types/react-resizable": "^3.0.7",
|
||||
"@types/semver": "^7.5.6",
|
||||
"@types/tar": "^6.1.10",
|
||||
"@types/throttle-debounce": "^5.0.2",
|
||||
"@types/warning": "^3.0.3",
|
||||
|
Loading…
Reference in New Issue
Block a user