chore: merge master to next

This commit is contained in:
afc163 2022-04-24 12:17:49 +08:00
commit b25d5f90bd
14 changed files with 78 additions and 42 deletions

View File

@ -23,6 +23,26 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Download commit artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: commit
- name: Save commit id
id: commit
run: echo "::set-output name=id::$(<commit.txt)"
- name: Download branch artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: branch
- name: Save branch id
id: branch
run: echo "::set-output name=id::$(<branch.txt)"
- name: Download snapshots artifact - name: Download snapshots artifact
uses: dawidd6/action-download-artifact@v2 uses: dawidd6/action-download-artifact@v2
with: with:
@ -39,3 +59,5 @@ jobs:
run: npm run argos run: npm run argos
env: env:
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }} ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
ARGOS_GITHUB_BRANCH: ${{ steps.branch.outputs.id }}
ARGOS_GITHUB_COMMIT: ${{ steps.commit.outputs.id }}

View File

@ -6,6 +6,8 @@ on:
push: push:
branches: branches:
- master - master
- next
- feature
# Cancel prev CI if new commit come # Cancel prev CI if new commit come
concurrency: concurrency:
@ -13,7 +15,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
test: imagesnapshot:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
@ -58,3 +60,33 @@ jobs:
name: snapshots name: snapshots
path: imageSnapshots/ path: imageSnapshots/
retention-days: 3 retention-days: 3
- name: Save commit
if: github.event_name == 'pull_request' && github.base_ref == 'master'
run: echo ${{ github.event.pull_request.head.sha }} > ./commit.txt
- name: Save commit
if: github.event_name == 'push'
run: echo ${{ github.sha }} > ./commit.txt
- name: Upload commit
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: commit
path: ./commit.txt
- name: Save branch
if: github.event_name == 'pull_request' && github.base_ref == 'master'
run: echo pull/${{ github.event.pull_request.number }}/merge > ./branch.txt
- name: Save branch
if: github.event_name == 'push'
run: echo ${GITHUB_REF##*/} > ./branch.txt
- name: Upload branch
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: branch
path: ./branch.txt

View File

@ -48,6 +48,8 @@ return <Menu items={items} />;
</Menu>; </Menu>;
``` ```
The legacy demo code for version `<4.20.0` could be found at [https://github.com/ant-design/ant-design/tree/4.19.5/components/menu/demo](https://github.com/ant-design/ant-design/tree/4.19.5/components/menu/demo).
## API ## API
### Menu ### Menu

View File

@ -49,6 +49,8 @@ return <Menu items={items} />;
</Menu>; </Menu>;
``` ```
`<4.20.0` 版本的 JSX 演示写法可以参考 [https://github.com/ant-design/ant-design/tree/4.19.5/components/menu/demo](https://github.com/ant-design/ant-design/tree/4.19.5/components/menu/demo)。
## API ## API
### Menu ### Menu

View File

@ -86,10 +86,7 @@ describe('Segmented', () => {
it('render segmented with string options', () => { it('render segmented with string options', () => {
const handleValueChange = jest.fn(); const handleValueChange = jest.fn();
const wrapper = mount( const wrapper = mount(
<Segmented <Segmented options={['Daily', 'Weekly', 'Monthly']} onChange={handleValueChange} />,
options={['Daily', 'Weekly', 'Monthly']}
onChange={e => handleValueChange(e.target.value)}
/>,
); );
expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();
@ -115,7 +112,7 @@ describe('Segmented', () => {
it('render segmented with numeric options', () => { it('render segmented with numeric options', () => {
const handleValueChange = jest.fn(); const handleValueChange = jest.fn();
const wrapper = mount( const wrapper = mount(
<Segmented options={[1, 2, 3, 4, 5]} onChange={e => handleValueChange(e.target.value)} />, <Segmented options={[1, 2, 3, 4, 5]} onChange={value => handleValueChange(value)} />,
); );
expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();
expect( expect(
@ -139,7 +136,7 @@ describe('Segmented', () => {
const wrapper = mount( const wrapper = mount(
<Segmented <Segmented
options={['Daily', { label: 'Weekly', value: 'Weekly' }, 'Monthly']} options={['Daily', { label: 'Weekly', value: 'Weekly' }, 'Monthly']}
onChange={e => handleValueChange(e.target.value)} onChange={value => handleValueChange(value)}
/>, />,
); );
expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();
@ -159,7 +156,7 @@ describe('Segmented', () => {
const wrapper = mount( const wrapper = mount(
<Segmented <Segmented
options={['Daily', { label: 'Weekly', value: 'Weekly', disabled: true }, 'Monthly']} options={['Daily', { label: 'Weekly', value: 'Weekly', disabled: true }, 'Monthly']}
onChange={e => handleValueChange(e.target.value)} onChange={value => handleValueChange(value)}
/>, />,
); );
expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();
@ -194,7 +191,7 @@ describe('Segmented', () => {
<Segmented <Segmented
disabled disabled
options={['Daily', 'Weekly', 'Monthly']} options={['Daily', 'Weekly', 'Monthly']}
onChange={e => handleValueChange(e.target.value)} onChange={value => handleValueChange(value)}
/>, />,
); );
expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();
@ -242,7 +239,7 @@ describe('Segmented', () => {
expect((wrapper.find(Segmented).getElement() as any).ref).toBe(ref); expect((wrapper.find(Segmented).getElement() as any).ref).toBe(ref);
}); });
it('render segmented with controlled mode', () => { it('render segmented with controlled mode', async () => {
class Demo extends React.Component<{}, { value: SegmentedValue }> { class Demo extends React.Component<{}, { value: SegmentedValue }> {
state = { state = {
value: 'Map', value: 'Map',
@ -253,9 +250,9 @@ describe('Segmented', () => {
<Segmented <Segmented
options={['Map', 'Transit', 'Satellite']} options={['Map', 'Transit', 'Satellite']}
value={this.state.value} value={this.state.value}
onChange={e => onChange={value =>
this.setState({ this.setState({
value: e.target.value, value,
}) })
} }
/> />
@ -277,7 +274,7 @@ describe('Segmented', () => {
<Segmented <Segmented
options={[null, undefined, ''] as any} options={[null, undefined, ''] as any}
disabled disabled
onChange={e => handleValueChange(e.target.value)} onChange={value => handleValueChange(value)}
/>, />,
); );
expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();
@ -293,7 +290,7 @@ describe('Segmented', () => {
const wrapper = mount( const wrapper = mount(
<Segmented <Segmented
options={['Map', 'Transit', 'Satellite']} options={['Map', 'Transit', 'Satellite']}
onChange={e => handleValueChange(e.target.value)} onChange={value => handleValueChange(value)}
/>, />,
); );
expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();

View File

@ -22,17 +22,9 @@ const Demo = () => {
const [foo, setFoo] = useState('AND'); const [foo, setFoo] = useState('AND');
return ( return (
<> <>
<Segmented <Segmented value={foo} options={['AND', 'OR', 'NOT']} onChange={setFoo} />
value={foo}
options={['AND', 'OR', 'NOT']}
onChange={e => setFoo(e.target.value)}
/>
&nbsp;&nbsp; &nbsp;&nbsp;
<Segmented <Segmented value={foo} options={['AND', 'OR', 'NOT']} onChange={value => setFoo(value)} />
value={foo}
options={['AND', 'OR', 'NOT']}
onChange={e => setFoo(e.target.value)}
/>
</> </>
); );
}; };

View File

@ -20,13 +20,7 @@ import { Segmented } from 'antd';
const Demo: React.FC = () => { const Demo: React.FC = () => {
const [value, setValue] = useState<string | number>('Map'); const [value, setValue] = useState<string | number>('Map');
return ( return <Segmented options={['Map', 'Transit', 'Satellite']} value={value} onChange={setValue} />;
<Segmented
options={['Map', 'Transit', 'Satellite']}
value={value}
onChange={e => setValue(e.target.value)}
/>
);
}; };
export default Demo; export default Demo;

View File

@ -21,7 +21,7 @@ Segmented Controls. This component is available since `antd@4.20.0`.
| block | Option to fit width to its parent\'s width | boolean | false | | | block | Option to fit width to its parent\'s width | boolean | false | |
| defaultValue | Default selected value | string \| number | | | | defaultValue | Default selected value | string \| number | | |
| disabled | Disable all segments | boolean | false | | | disabled | Disable all segments | boolean | false | |
| onChange | The callback function that is triggered when the state changes | function(e:Event) | | | | onChange | The callback function that is triggered when the state changes | function(value: string \| number) | | |
| options | Set children optional | string\[] \| number\[] \| Array<{ label: string value: string icon? ReactNode disabled?: boolean className?: string }> | [] | | | options | Set children optional | string\[] \| number\[] \| Array<{ label: string value: string icon? ReactNode disabled?: boolean className?: string }> | [] | |
| size | The size of the Segmented. | `large` \| `middle` \| `small` | - | | | size | The size of the Segmented. | `large` \| `middle` \| `small` | - | |
| value | Currently selected value | string \| number | | | | value | Currently selected value | string \| number | | |

View File

@ -24,7 +24,7 @@ cover: https://gw.alipayobjects.com/zos/bmw-prod/a3ff040f-24ba-43e0-92e9-c845df1
| block | 将宽度调整为父元素宽度的选项 | boolean | false | | | block | 将宽度调整为父元素宽度的选项 | boolean | false | |
| defaultValue | 默认选中的值 | string \| number | | | | defaultValue | 默认选中的值 | string \| number | | |
| disabled | 是否禁用 | boolean | false | | | disabled | 是否禁用 | boolean | false | |
| onChange | 选项变化时的回调函数 | function(e:Event) | | | | onChange | 选项变化时的回调函数 | function(value: string \| number) | | |
| options | 数据化配置选项内容 | string\[] \| number\[] \| Array<{ label: string value: string icon? ReactNode disabled?: boolean className?: string }> | [] | | | options | 数据化配置选项内容 | string\[] \| number\[] \| Array<{ label: string value: string icon? ReactNode disabled?: boolean className?: string }> | [] | |
| size | 控件尺寸 | `large` \| `middle` \| `small` | - | | | size | 控件尺寸 | `large` \| `middle` \| `small` | - | |
| value | 当前选中的值 | string \| number | | | | value | 当前选中的值 | string \| number | | |

View File

@ -12,7 +12,6 @@
// .reset-component(); // .reset-component();
// display: flex; // display: flex;
// overflow: hidden;
// // ========================== Navigation ========================== // // ========================== Navigation ==========================
// > .@{tab-prefix-cls}-nav, // > .@{tab-prefix-cls}-nav,

View File

@ -713,7 +713,6 @@ const genTabsStyle: GenerateStyle<TabsToken> = (token: TabsToken): CSSObject =>
[componentCls]: { [componentCls]: {
...resetComponent(token), ...resetComponent(token),
display: 'flex', display: 'flex',
overflow: 'hidden',
// ========================== Navigation ========================== // ========================== Navigation ==========================
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: { [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {

View File

@ -144,7 +144,7 @@
"rc-progress": "~3.2.1", "rc-progress": "~3.2.1",
"rc-rate": "~2.9.0", "rc-rate": "~2.9.0",
"rc-resize-observer": "^1.2.0", "rc-resize-observer": "^1.2.0",
"rc-segmented": "~1.3.0", "rc-segmented": "~2.0.0",
"rc-select": "~14.1.1", "rc-select": "~14.1.1",
"rc-slider": "~10.0.0", "rc-slider": "~10.0.0",
"rc-steps": "~4.1.0", "rc-steps": "~4.1.0",

View File

@ -47,11 +47,11 @@ async function run() {
'--batchCount', '--batchCount',
chunks.length, chunks.length,
'--branch', '--branch',
process.env.GITHUB_REF_NAME, process.env.ARGOS_GITHUB_BRANCH,
'--commit', '--commit',
process.env.GITHUB_SHA, process.env.ARGOS_GITHUB_COMMIT,
'--external-build-id', '--external-build-id',
process.env.GITHUB_SHA, process.env.ARGOS_GITHUB_COMMIT,
]); ]);
// eslint-disable-next-line no-console -- pipe stdout // eslint-disable-next-line no-console -- pipe stdout
console.log(argosResults.stdout); console.log(argosResults.stdout);

View File

@ -314,9 +314,6 @@ class Footer extends React.Component<WrappedComponentProps & { location: any }>
enUS: 'components-config-provider-demo-theme', enUS: 'components-config-provider-demo-theme',
}), }),
LinkComponent: Link, LinkComponent: Link,
style: {
marginTop: 20,
},
}, },
], ],
}; };