mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
docs: fix some doc and lint issue (#48982)
* chore: fix dumi lint * test: update snapshot
This commit is contained in:
parent
733d58deb1
commit
bf265c0efe
@ -1,15 +1,16 @@
|
|||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
import React, { useContext, useMemo } from 'react';
|
import React, { useContext, useMemo } from 'react';
|
||||||
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
|
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
|
||||||
import type { MenuProps } from 'antd';
|
import type { GetProp, MenuProps } from 'antd';
|
||||||
import { createStyles } from 'antd-style';
|
import { createStyles } from 'antd-style';
|
||||||
import type { MenuItemType } from 'antd/es/menu/hooks/useItems';
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import useMenu from '../../hooks/useMenu';
|
import useMenu from '../../hooks/useMenu';
|
||||||
import SiteContext from '../slots/SiteContext';
|
import SiteContext from '../slots/SiteContext';
|
||||||
import type { SiteContextProps } from '../slots/SiteContext';
|
import type { SiteContextProps } from '../slots/SiteContext';
|
||||||
|
|
||||||
|
type MenuItemType = Extract<GetProp<MenuProps, 'items'>[number], { type?: 'item' }>;
|
||||||
|
|
||||||
const useStyle = createStyles(({ token, css }) => {
|
const useStyle = createStyles(({ token, css }) => {
|
||||||
const { colorSplit, iconCls, fontSizeIcon } = token;
|
const { colorSplit, iconCls, fontSizeIcon } = token;
|
||||||
|
|
||||||
|
@ -807,7 +807,7 @@ Array [
|
|||||||
<form
|
<form
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-form ant-form-horizontal"
|
class="ant-form ant-form-horizontal"
|
||||||
id="basic"
|
id="col-24-debug"
|
||||||
style="max-width: 600px;"
|
style="max-width: 600px;"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -821,7 +821,7 @@ Array [
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="ant-form-item-required"
|
class="ant-form-item-required"
|
||||||
for="basic_username"
|
for="col-24-debug_username"
|
||||||
title="Username"
|
title="Username"
|
||||||
>
|
>
|
||||||
Username
|
Username
|
||||||
@ -839,7 +839,7 @@ Array [
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
class="ant-input ant-input-outlined"
|
class="ant-input ant-input-outlined"
|
||||||
id="basic_username"
|
id="col-24-debug_username"
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
@ -859,7 +859,7 @@ Array [
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="ant-form-item-required"
|
class="ant-form-item-required"
|
||||||
for="basic_password"
|
for="col-24-debug_password"
|
||||||
title="Password"
|
title="Password"
|
||||||
>
|
>
|
||||||
Password
|
Password
|
||||||
@ -880,7 +880,7 @@ Array [
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
class="ant-input"
|
class="ant-input"
|
||||||
id="basic_password"
|
id="col-24-debug_password"
|
||||||
type="password"
|
type="password"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
@ -929,7 +929,7 @@ Array [
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class=""
|
class=""
|
||||||
for="basic_select"
|
for="col-24-debug_select"
|
||||||
title=""
|
title=""
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
@ -1010,13 +1010,13 @@ Array [
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-autocomplete="list"
|
aria-autocomplete="list"
|
||||||
aria-controls="basic_select_list"
|
aria-controls="col-24-debug_select_list"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-haspopup="listbox"
|
aria-haspopup="listbox"
|
||||||
aria-owns="basic_select_list"
|
aria-owns="col-24-debug_select_list"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-select-selection-search-input"
|
class="ant-select-selection-search-input"
|
||||||
id="basic_select"
|
id="col-24-debug_select"
|
||||||
readonly=""
|
readonly=""
|
||||||
role="combobox"
|
role="combobox"
|
||||||
style="opacity: 0;"
|
style="opacity: 0;"
|
||||||
@ -1039,14 +1039,14 @@ Array [
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
id="basic_select_list"
|
id="col-24-debug_select_list"
|
||||||
role="listbox"
|
role="listbox"
|
||||||
style="height: 0px; width: 0px; overflow: hidden;"
|
style="height: 0px; width: 0px; overflow: hidden;"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="Bamboo"
|
aria-label="Bamboo"
|
||||||
aria-selected="true"
|
aria-selected="true"
|
||||||
id="basic_select_list_0"
|
id="col-24-debug_select_list_0"
|
||||||
role="option"
|
role="option"
|
||||||
>
|
>
|
||||||
bamboo
|
bamboo
|
||||||
@ -1054,7 +1054,7 @@ Array [
|
|||||||
<div
|
<div
|
||||||
aria-label="Little"
|
aria-label="Little"
|
||||||
aria-selected="false"
|
aria-selected="false"
|
||||||
id="basic_select_list_1"
|
id="col-24-debug_select_list_1"
|
||||||
role="option"
|
role="option"
|
||||||
>
|
>
|
||||||
little
|
little
|
||||||
@ -7035,25 +7035,6 @@ exports[`renders components/form/demo/form-context.tsx extend context correctly
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
class="ant-form-item ant-form-item-hidden"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-row ant-form-item-row"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-16 ant-form-item-control"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-form-item-control-input"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-form-item-control-input-content"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class="ant-form-item"
|
class="ant-form-item"
|
||||||
>
|
>
|
||||||
@ -7149,11 +7130,7 @@ exports[`renders components/form/demo/form-context.tsx extend context correctly
|
|||||||
</form>
|
</form>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`renders components/form/demo/form-context.tsx extend context correctly 2`] = `
|
exports[`renders components/form/demo/form-context.tsx extend context correctly 2`] = `[]`;
|
||||||
[
|
|
||||||
"Warning: [antd: Form.Item] \`name\` is only used for validate React element. If you are using Form.Item as layout display, please remove \`name\` instead.",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`renders components/form/demo/form-dependencies.tsx extend context correctly 1`] = `
|
exports[`renders components/form/demo/form-dependencies.tsx extend context correctly 1`] = `
|
||||||
<form
|
<form
|
||||||
|
@ -643,7 +643,7 @@ Array [
|
|||||||
<form
|
<form
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-form ant-form-horizontal"
|
class="ant-form ant-form-horizontal"
|
||||||
id="basic"
|
id="col-24-debug"
|
||||||
style="max-width:600px"
|
style="max-width:600px"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -657,7 +657,7 @@ Array [
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="ant-form-item-required"
|
class="ant-form-item-required"
|
||||||
for="basic_username"
|
for="col-24-debug_username"
|
||||||
title="Username"
|
title="Username"
|
||||||
>
|
>
|
||||||
Username
|
Username
|
||||||
@ -675,7 +675,7 @@ Array [
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
class="ant-input ant-input-outlined"
|
class="ant-input ant-input-outlined"
|
||||||
id="basic_username"
|
id="col-24-debug_username"
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
@ -695,7 +695,7 @@ Array [
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="ant-form-item-required"
|
class="ant-form-item-required"
|
||||||
for="basic_password"
|
for="col-24-debug_password"
|
||||||
title="Password"
|
title="Password"
|
||||||
>
|
>
|
||||||
Password
|
Password
|
||||||
@ -716,7 +716,7 @@ Array [
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
class="ant-input"
|
class="ant-input"
|
||||||
id="basic_password"
|
id="col-24-debug_password"
|
||||||
type="password"
|
type="password"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
@ -765,7 +765,7 @@ Array [
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class=""
|
class=""
|
||||||
for="basic_select"
|
for="col-24-debug_select"
|
||||||
title=""
|
title=""
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
@ -846,13 +846,13 @@ Array [
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-autocomplete="list"
|
aria-autocomplete="list"
|
||||||
aria-controls="basic_select_list"
|
aria-controls="col-24-debug_select_list"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-haspopup="listbox"
|
aria-haspopup="listbox"
|
||||||
aria-owns="basic_select_list"
|
aria-owns="col-24-debug_select_list"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-select-selection-search-input"
|
class="ant-select-selection-search-input"
|
||||||
id="basic_select"
|
id="col-24-debug_select"
|
||||||
readonly=""
|
readonly=""
|
||||||
role="combobox"
|
role="combobox"
|
||||||
style="opacity:0"
|
style="opacity:0"
|
||||||
@ -3970,25 +3970,6 @@ exports[`renders components/form/demo/form-context.tsx correctly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
class="ant-form-item ant-form-item-hidden"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-row ant-form-item-row"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-col ant-col-16 ant-form-item-control"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-form-item-control-input"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-form-item-control-input-content"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class="ant-form-item"
|
class="ant-form-item"
|
||||||
>
|
>
|
||||||
|
@ -32,7 +32,7 @@ const App: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Form
|
<Form
|
||||||
name="basic"
|
name="col-24-debug"
|
||||||
labelCol={{ span: 24 }}
|
labelCol={{ span: 24 }}
|
||||||
wrapperCol={{ span: 24 }}
|
wrapperCol={{ span: 24 }}
|
||||||
initialValues={{ remember: true }}
|
initialValues={{ remember: true }}
|
||||||
|
@ -19,7 +19,7 @@ const App: React.FC = () => (
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
name="basic"
|
name="component-token"
|
||||||
labelCol={{ span: 8 }}
|
labelCol={{ span: 8 }}
|
||||||
wrapperCol={{ span: 16 }}
|
wrapperCol={{ span: 16 }}
|
||||||
style={{ maxWidth: 600 }}
|
style={{ maxWidth: 600 }}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { SmileOutlined, UserOutlined } from '@ant-design/icons';
|
import { SmileOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Button, Form, Input, InputNumber, Modal, Space, Typography } from 'antd';
|
import { Avatar, Button, Flex, Form, Input, InputNumber, Modal, Space, Typography } from 'antd';
|
||||||
import type { GetRef } from 'antd';
|
import type { GetRef } from 'antd';
|
||||||
|
|
||||||
type FormInstance = GetRef<typeof Form>;
|
type FormInstance = GetRef<typeof Form>;
|
||||||
@ -97,7 +97,7 @@ const App: React.FC = () => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
{/* Create a hidden field to make Form instance record this */}
|
{/* Create a hidden field to make Form instance record this */}
|
||||||
<Form.Item name="users" hidden />
|
<Form.Item name="users" noStyle />
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="User List"
|
label="User List"
|
||||||
@ -106,16 +106,14 @@ const App: React.FC = () => {
|
|||||||
{({ getFieldValue }) => {
|
{({ getFieldValue }) => {
|
||||||
const users: UserType[] = getFieldValue('users') || [];
|
const users: UserType[] = getFieldValue('users') || [];
|
||||||
return users.length ? (
|
return users.length ? (
|
||||||
<ul>
|
<Flex vertical gap={8}>
|
||||||
{users.map((user) => (
|
{users.map((user) => (
|
||||||
<li key={user.name} className="user">
|
<Space key={user.name}>
|
||||||
<Space>
|
<Avatar icon={<UserOutlined />} />
|
||||||
<Avatar icon={<UserOutlined />} />
|
{`${user.name} - ${user.age}`}
|
||||||
{`${user.name} - ${user.age}`}
|
</Space>
|
||||||
</Space>
|
|
||||||
</li>
|
|
||||||
))}
|
))}
|
||||||
</ul>
|
</Flex>
|
||||||
) : (
|
) : (
|
||||||
<Typography.Text className="ant-form-text" type="secondary">
|
<Typography.Text className="ant-form-text" type="secondary">
|
||||||
( <SmileOutlined /> No user yet. )
|
( <SmileOutlined /> No user yet. )
|
||||||
|
Loading…
Reference in New Issue
Block a user