Skip to content

Commit

Permalink
Merge branch 'master' into feature-merge-master
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Aug 24, 2023
2 parents 2096c01 + 9312b00 commit 68ee322
Show file tree
Hide file tree
Showing 24 changed files with 127 additions and 189 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,11 @@ exports[`renders components/badge/demo/change.tsx extend context correctly 1`] =
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
5 changes: 1 addition & 4 deletions components/badge/__tests__/__snapshots__/demo.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,11 @@ exports[`renders components/badge/demo/change.tsx correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
10 changes: 2 additions & 8 deletions components/card/__tests__/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,11 @@ exports[`Card correct pass tabList props 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -227,14 +224,11 @@ exports[`Card correct pass tabList props 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
5 changes: 3 additions & 2 deletions components/color-picker/components/ColorPresets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ const ColorPresets: FC<ColorPresetsProps> = ({ prefixCls, presets, value: color,
children: (
<div className={`${colorPresetsPrefixCls}-items`}>
{Array.isArray(preset?.colors) && preset.colors?.length > 0 ? (
preset.colors.map((presetColor: Color) => (
preset.colors.map((presetColor: Color, index: number) => (
<ColorBlock
key={`preset-${presetColor.toHexString()}`}
// eslint-disable-next-line react/no-array-index-key
key={`preset-${index}-${presetColor.toHexString()}`}
color={generateColor(presetColor).toRgbString()}
prefixCls={prefixCls}
className={classNames(`${colorPresetsPrefixCls}-color`, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,14 +526,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
5 changes: 1 addition & 4 deletions components/drawer/__tests__/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,11 @@ exports[`renders components/drawer/demo/form-in-drawer.tsx correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
55 changes: 30 additions & 25 deletions components/form/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5177,14 +5177,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -6051,14 +6048,11 @@ exports[`renders components/form/demo/dynamic-form-item.tsx extend context corre
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -6089,14 +6083,11 @@ exports[`renders components/form/demo/dynamic-form-item.tsx extend context corre
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -6186,14 +6177,11 @@ exports[`renders components/form/demo/dynamic-form-items.tsx extend context corr
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -6454,14 +6442,11 @@ exports[`renders components/form/demo/dynamic-form-items-complex.tsx extend cont
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -6576,14 +6561,11 @@ exports[`renders components/form/demo/dynamic-form-items-no-style.tsx extend con
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -6833,6 +6815,25 @@ exports[`renders components/form/demo/form-context.tsx extend context correctly
</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
class="ant-form-item"
>
Expand Down Expand Up @@ -6928,7 +6929,11 @@ exports[`renders components/form/demo/form-context.tsx extend context correctly
</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-in-modal.tsx extend context correctly 1`] = `
<div>
Expand Down
49 changes: 25 additions & 24 deletions components/form/__tests__/__snapshots__/demo.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2658,14 +2658,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3333,14 +3330,11 @@ exports[`renders components/form/demo/dynamic-form-item.tsx correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3371,14 +3365,11 @@ exports[`renders components/form/demo/dynamic-form-item.tsx correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3466,14 +3457,11 @@ exports[`renders components/form/demo/dynamic-form-items.tsx correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3652,14 +3640,11 @@ exports[`renders components/form/demo/dynamic-form-items-complex.tsx correctly 1
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3772,14 +3757,11 @@ exports[`renders components/form/demo/dynamic-form-items-no-style.tsx correctly
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -4025,6 +4007,25 @@ exports[`renders components/form/demo/form-context.tsx correctly 1`] = `
</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
class="ant-form-item"
>
Expand Down
12 changes: 9 additions & 3 deletions components/form/demo/form-context.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import { SmileOutlined, UserOutlined } from '@ant-design/icons';
import { Avatar, Button, Form, Input, InputNumber, Modal, Typography } from 'antd';
import { Avatar, Button, Form, Input, InputNumber, Modal, Space, Typography } from 'antd';
import type { FormInstance } from 'antd/es/form';

const layout = {
Expand Down Expand Up @@ -93,6 +93,10 @@ const App: React.FC = () => {
<Form.Item name="group" label="Group Name" rules={[{ required: true }]}>
<Input />
</Form.Item>

{/* Create a hidden field to make Form instance record this */}
<Form.Item name="users" hidden />

<Form.Item
label="User List"
shouldUpdate={(prevValues, curValues) => prevValues.users !== curValues.users}
Expand All @@ -103,8 +107,10 @@ const App: React.FC = () => {
<ul>
{users.map((user) => (
<li key={user.name} className="user">
<Avatar icon={<UserOutlined />} />
{user.name} - {user.age}
<Space>
<Avatar icon={<UserOutlined />} />
{`${user.name} - ${user.age}`}
</Space>
</li>
))}
</ul>
Expand Down
Loading

0 comments on commit 68ee322

Please sign in to comment.