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
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
uses: dawidd6/action-download-artifact@v2
with:
@ -39,3 +59,5 @@ jobs:
run: npm run argos
env:
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:
branches:
- master
- next
- feature
# Cancel prev CI if new commit come
concurrency:
@ -13,7 +15,7 @@ concurrency:
cancel-in-progress: true
jobs:
test:
imagesnapshot:
runs-on: ubuntu-latest
steps:
- name: checkout
@ -58,3 +60,33 @@ jobs:
name: snapshots
path: imageSnapshots/
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>;
```
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
### Menu

View File

@ -49,6 +49,8 @@ return <Menu items={items} />;
</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
### Menu

View File

@ -86,10 +86,7 @@ describe('Segmented', () => {
it('render segmented with string options', () => {
const handleValueChange = jest.fn();
const wrapper = mount(
<Segmented
options={['Daily', 'Weekly', 'Monthly']}
onChange={e => handleValueChange(e.target.value)}
/>,
<Segmented options={['Daily', 'Weekly', 'Monthly']} onChange={handleValueChange} />,
);
expect(wrapper.render()).toMatchSnapshot();
@ -115,7 +112,7 @@ describe('Segmented', () => {
it('render segmented with numeric options', () => {
const handleValueChange = jest.fn();
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(
@ -139,7 +136,7 @@ describe('Segmented', () => {
const wrapper = mount(
<Segmented
options={['Daily', { label: 'Weekly', value: 'Weekly' }, 'Monthly']}
onChange={e => handleValueChange(e.target.value)}
onChange={value => handleValueChange(value)}
/>,
);
expect(wrapper.render()).toMatchSnapshot();
@ -159,7 +156,7 @@ describe('Segmented', () => {
const wrapper = mount(
<Segmented
options={['Daily', { label: 'Weekly', value: 'Weekly', disabled: true }, 'Monthly']}
onChange={e => handleValueChange(e.target.value)}
onChange={value => handleValueChange(value)}
/>,
);
expect(wrapper.render()).toMatchSnapshot();
@ -194,7 +191,7 @@ describe('Segmented', () => {
<Segmented
disabled
options={['Daily', 'Weekly', 'Monthly']}
onChange={e => handleValueChange(e.target.value)}
onChange={value => handleValueChange(value)}
/>,
);
expect(wrapper.render()).toMatchSnapshot();
@ -242,7 +239,7 @@ describe('Segmented', () => {
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 }> {
state = {
value: 'Map',
@ -253,9 +250,9 @@ describe('Segmented', () => {
<Segmented
options={['Map', 'Transit', 'Satellite']}
value={this.state.value}
onChange={e =>
onChange={value =>
this.setState({
value: e.target.value,
value,
})
}
/>
@ -277,7 +274,7 @@ describe('Segmented', () => {
<Segmented
options={[null, undefined, ''] as any}
disabled
onChange={e => handleValueChange(e.target.value)}
onChange={value => handleValueChange(value)}
/>,
);
expect(wrapper.render()).toMatchSnapshot();
@ -293,7 +290,7 @@ describe('Segmented', () => {
const wrapper = mount(
<Segmented
options={['Map', 'Transit', 'Satellite']}
onChange={e => handleValueChange(e.target.value)}
onChange={value => handleValueChange(value)}
/>,
);
expect(wrapper.render()).toMatchSnapshot();

View File

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

View File

@ -20,13 +20,7 @@ import { Segmented } from 'antd';
const Demo: React.FC = () => {
const [value, setValue] = useState<string | number>('Map');
return (
<Segmented
options={['Map', 'Transit', 'Satellite']}
value={value}
onChange={e => setValue(e.target.value)}
/>
);
return <Segmented options={['Map', 'Transit', 'Satellite']} value={value} onChange={setValue} />;
};
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 | |
| defaultValue | Default selected value | string \| number | | |
| 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 }> | [] | |
| size | The size of the Segmented. | `large` \| `middle` \| `small` | - | |
| 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 | |
| defaultValue | 默认选中的值 | string \| number | | |
| 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 }> | [] | |
| size | 控件尺寸 | `large` \| `middle` \| `small` | - | |
| value | 当前选中的值 | string \| number | | |

View File

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

View File

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

View File

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

View File

@ -47,11 +47,11 @@ async function run() {
'--batchCount',
chunks.length,
'--branch',
process.env.GITHUB_REF_NAME,
process.env.ARGOS_GITHUB_BRANCH,
'--commit',
process.env.GITHUB_SHA,
process.env.ARGOS_GITHUB_COMMIT,
'--external-build-id',
process.env.GITHUB_SHA,
process.env.ARGOS_GITHUB_COMMIT,
]);
// eslint-disable-next-line no-console -- pipe 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',
}),
LinkComponent: Link,
style: {
marginTop: 20,
},
},
],
};