Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥feat: new component Flex #44362

Merged
merged 88 commits into from Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
3c6e9c4
feat: new component Flex
li-jia-nan Aug 22, 2023
7c3e030
feat: new component Flex
li-jia-nan Aug 22, 2023
ff95b08
Merge branch 'feature' into Flex
li-jia-nan Aug 22, 2023
27b0257
fix: fix
li-jia-nan Aug 22, 2023
e0d7751
test: add test case
li-jia-nan Aug 22, 2023
120e717
fix: fix
li-jia-nan Aug 23, 2023
15ca6c0
update size-limit
li-jia-nan Aug 23, 2023
51c3e53
test: update snap
li-jia-nan Aug 23, 2023
5da5530
fix: fix
li-jia-nan Aug 24, 2023
15f6a84
Merge branch 'feature' into Flex
li-jia-nan Aug 24, 2023
bec9b0b
Merge branch 'feature' into Flex
li-jia-nan Aug 24, 2023
13069e5
test: update snap
li-jia-nan Aug 24, 2023
f37cb23
chore: add use client
Aug 25, 2023
2bd14d3
Merge branch 'feature' into Flex
li-jia-nan Aug 25, 2023
01d0d61
fix: lint
li-jia-nan Aug 25, 2023
ede66f4
test: update snap
li-jia-nan Aug 25, 2023
ad55560
fix
li-jia-nan Aug 26, 2023
6ed3da1
docs: add docs
li-jia-nan Aug 26, 2023
94ba040
fix: fix demo
li-jia-nan Aug 26, 2023
b15e2d9
clear
li-jia-nan Aug 26, 2023
216ed5b
demo: update demo
li-jia-nan Aug 27, 2023
aba13ff
Merge branch 'feature' into Flex
li-jia-nan Aug 27, 2023
df4b466
update demos
li-jia-nan Aug 27, 2023
b36e06e
Merge branch 'feature' into Flex
li-jia-nan Aug 27, 2023
734d8f4
Merge branch 'feature' into Flex
li-jia-nan Aug 29, 2023
8bf8e15
fix: fix
li-jia-nan Aug 29, 2023
1b228bd
Merge branch 'feature' into Flex
li-jia-nan Aug 29, 2023
e775fe5
fix: fix
li-jia-nan Aug 29, 2023
9f04937
Merge branch 'feature' into Flex
li-jia-nan Aug 29, 2023
433a794
fix: fix
li-jia-nan Aug 30, 2023
baf4102
fix: fix
li-jia-nan Aug 30, 2023
9e5fc79
test: update snap
li-jia-nan Aug 30, 2023
ede0b91
Merge branch 'feature' into Flex
li-jia-nan Aug 30, 2023
1dc47ce
fix: fix
li-jia-nan Aug 30, 2023
30ebe35
fix: fix
li-jia-nan Aug 31, 2023
ed06df3
Merge branch 'feature' into Flex
li-jia-nan Aug 31, 2023
00972e4
demo: update demo
li-jia-nan Aug 31, 2023
3c1c126
Merge branch 'feature' into Flex
li-jia-nan Aug 31, 2023
0d9fca1
Merge branch 'feature' into Flex
li-jia-nan Sep 1, 2023
83a61c7
feat: CP
li-jia-nan Sep 1, 2023
53cc271
Merge branch 'feature' into Flex
li-jia-nan Sep 2, 2023
0d3aa1e
fix: use token
li-jia-nan Sep 2, 2023
6785fc7
fix: fix
li-jia-nan Sep 2, 2023
7f17475
fix: fix test case
li-jia-nan Sep 2, 2023
350e5b8
Merge branch 'feature' into Flex
li-jia-nan Sep 3, 2023
e33a2fe
test: update snap
li-jia-nan Sep 3, 2023
c1901c3
Update components/flex/style/index.ts
li-jia-nan Sep 4, 2023
76960ee
Merge branch 'feature' into Flex
li-jia-nan Sep 4, 2023
bb24d32
Update components/flex/demo/align.tsx
li-jia-nan Sep 4, 2023
8e23d25
demo: update demo
li-jia-nan Sep 4, 2023
936a7cb
fix: fix
li-jia-nan Sep 4, 2023
b8dec84
docs
li-jia-nan Sep 4, 2023
8b78232
update cover
li-jia-nan Sep 4, 2023
fb08b38
fix: fix
li-jia-nan Sep 4, 2023
2afdc9e
test: update case
li-jia-nan Sep 4, 2023
01ffd09
Merge branch 'feature' into Flex
li-jia-nan Sep 4, 2023
3c24ca0
Merge branch 'feature' into Flex
li-jia-nan Sep 5, 2023
fa3e31a
fix: rerun CI
li-jia-nan Sep 5, 2023
a340350
Merge branch 'feature' into Flex
li-jia-nan Sep 5, 2023
89c4d92
fix: fix
li-jia-nan Sep 5, 2023
1a82b4d
fix: fix
li-jia-nan Sep 5, 2023
7156079
Merge branch 'feature' into Flex
li-jia-nan Sep 5, 2023
7b64a47
Merge branch 'feature' into Flex
li-jia-nan Sep 5, 2023
1c1442d
fix: fix
li-jia-nan Sep 5, 2023
87f2991
fix: fix
li-jia-nan Sep 5, 2023
ed24f8e
demo: update demo
li-jia-nan Sep 5, 2023
b08950e
fix: fix lint
li-jia-nan Sep 5, 2023
d80183b
Merge branch 'feature' into Flex
li-jia-nan Sep 5, 2023
b9343d3
fix: fix
li-jia-nan Sep 5, 2023
7e47b89
fix: fix
li-jia-nan Sep 6, 2023
8ae176f
fix: fix
li-jia-nan Sep 6, 2023
12b5895
fix: fix
li-jia-nan Sep 6, 2023
1a3c286
fix: fix test case
li-jia-nan Sep 6, 2023
594182b
fix: fix
li-jia-nan Sep 6, 2023
b3cb81e
Merge branch 'feature' into Flex
li-jia-nan Sep 7, 2023
d912c56
docs: update docs
li-jia-nan Sep 7, 2023
0aa74c6
Merge branch 'feature' into Flex
li-jia-nan Sep 10, 2023
99ddaeb
Merge branch 'feature' into Flex
li-jia-nan Sep 11, 2023
fd51dc8
Merge branch 'feature' into Flex
li-jia-nan Sep 12, 2023
80f9ec3
fix: fix
li-jia-nan Sep 12, 2023
c8b5dcc
chore: fix
li-jia-nan Sep 12, 2023
27c76e7
Merge branch 'feature' into Flex
li-jia-nan Sep 13, 2023
19d5a48
chore: fix
li-jia-nan Sep 13, 2023
cf88ac6
docs: update docs
li-jia-nan Sep 13, 2023
f7dabf8
docs: update
li-jia-nan Sep 14, 2023
3d8cdcd
fix: fix demo
li-jia-nan Sep 14, 2023
6ccd2da
type: update type
li-jia-nan Sep 14, 2023
17c5dab
add debug demo
li-jia-nan Sep 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions components/__tests__/__snapshots__/index.test.ts.snap
Expand Up @@ -27,6 +27,7 @@ exports[`antd exports modules correctly 1`] = `
"Drawer",
"Dropdown",
"Empty",
"Flex",
"FloatButton",
"Form",
"Grid",
Expand Down
12 changes: 12 additions & 0 deletions components/config-provider/__tests__/style.test.tsx
Expand Up @@ -19,6 +19,7 @@ import Descriptions from '../../descriptions';
import Divider from '../../divider';
import Drawer from '../../drawer';
import Empty from '../../empty';
import Flex from '../../flex';
import Form from '../../form';
import Image from '../../image';
import Input from '../../input';
Expand Down Expand Up @@ -1267,4 +1268,15 @@ describe('ConfigProvider support style and className props', () => {

expect(container.querySelector('.ant-picker')).toHaveStyle('color: red; font-size: 16px;');
});

it('Should Flex className & style works', () => {
const { container } = render(
<ConfigProvider flex={{ className: 'cp-flex', style: { backgroundColor: 'blue' } }}>
<Flex>test</Flex>
</ConfigProvider>,
);
const element = container.querySelector<HTMLDivElement>('.ant-flex');
li-jia-nan marked this conversation as resolved.
Show resolved Hide resolved
expect(element).toHaveClass('cp-flex');
expect(element).toHaveStyle({ backgroundColor: 'blue' });
});
});
8 changes: 6 additions & 2 deletions components/config-provider/context.ts
Expand Up @@ -6,6 +6,7 @@ import type { WarningContextProps } from '../_util/warning';
import type { ShowWaveEffect } from '../_util/wave/interface';
import type { BadgeProps } from '../badge';
import type { ButtonProps } from '../button';
import type { FlexProps } from '../flex/interface';
import type { RequiredMark } from '../form/Form';
import type { InputProps } from '../input';
import type { Locale } from '../locale';
Expand Down Expand Up @@ -61,6 +62,10 @@ export interface ButtonConfig extends ComponentStyleConfig {
styles?: ButtonProps['styles'];
}

export interface FlexConfig extends ComponentStyleConfig {
vertical?: FlexProps['vertical'];
}

export type PopupOverflow = 'viewport' | 'scroll';

export interface WaveConfig {
Expand Down Expand Up @@ -154,9 +159,8 @@ export interface ConfigConsumerProps {
tree?: ComponentStyleConfig;
colorPicker?: ComponentStyleConfig;
datePicker?: ComponentStyleConfig;

flex?: FlexConfig;
wave?: WaveConfig;

warning?: WarningContextProps;
}

Expand Down
1 change: 1 addition & 0 deletions components/config-provider/index.en-US.md
Expand Up @@ -122,6 +122,7 @@ const {
| divider | Set Divider common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| drawer | Set Drawer common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| empty | Set Empty common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| flex | Set Flex common props | { className?: string, style?: React.CSSProperties, vertical?: boolean } | - | 5.10.0 |
| form | Set Form common props | { className?: string, style?: React.CSSProperties, validateMessages?: [ValidateMessages](/components/form/#validatemessages), requiredMark?: boolean \| `optional`, scrollToFirstError?: boolean \| [Options](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options) } | - | requiredMark: 4.8.0; colon: 4.18.0; scrollToFirstError: 5.2.0; className: 5.7.0; style: 5.7.0 |
| image | Set Image common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| input | Set Input common props | { autoComplete?: string, className?: string, style?: React.CSSProperties } | - | 4.2.0 |
Expand Down
7 changes: 6 additions & 1 deletion components/config-provider/index.tsx
@@ -1,3 +1,5 @@
'use client';
li-jia-nan marked this conversation as resolved.
Show resolved Hide resolved

import * as React from 'react';
import { createTheme } from '@ant-design/cssinjs';
import IconContext from '@ant-design/icons/lib/components/Context';
Expand Down Expand Up @@ -27,6 +29,7 @@ import type {
ConfigConsumerProps,
CSPConfig,
DirectionType,
FlexConfig,
PopupOverflow,
Theme,
ThemeConfig,
Expand Down Expand Up @@ -194,7 +197,7 @@ export interface ConfigProviderProps {
tree?: ComponentStyleConfig;
colorPicker?: ComponentStyleConfig;
datePicker?: ComponentStyleConfig;

flex?: FlexConfig;
/**
* Wave is special component which only patch on the effect of component interaction.
*/
Expand Down Expand Up @@ -335,6 +338,7 @@ const ProviderChildren: React.FC<ProviderChildrenProps> = (props) => {
tree,
colorPicker,
datePicker,
flex,
wave,
warning: warningConfig,
} = props;
Expand Down Expand Up @@ -425,6 +429,7 @@ const ProviderChildren: React.FC<ProviderChildrenProps> = (props) => {
tree,
colorPicker,
datePicker,
flex,
wave,
warning: warningConfig,
};
Expand Down
1 change: 1 addition & 0 deletions components/config-provider/index.zh-CN.md
Expand Up @@ -124,6 +124,7 @@ const {
| divider | 设置 Divider 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| drawer | 设置 Drawer 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| empty | 设置 Empty 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| flex | 设置 Flex 组件的通用属性 | { className?: string, style?: React.CSSProperties, vertical?: boolean } | - | 5.10.0 |
| form | 设置 Form 组件的通用属性 | { className?: string, style?: React.CSSProperties, validateMessages?: [ValidateMessages](/components/form-cn#validatemessages), requiredMark?: boolean \| `optional`, colon?: boolean, scrollToFirstError?: boolean \| [Options](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)} | - | requiredMark: 4.8.0; colon: 4.18.0; scrollToFirstError: 5.2.0; className: 5.7.0; style: 5.7.0 |
| image | 设置 Image 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| input | 设置 Input 组件的通用属性 | { autoComplete?: string, className?: string, style?: React.CSSProperties } | - | 5.7.0 |
Expand Down