Merge pull request #29358 from ant-design/master

sync: master branch to feature
This commit is contained in:
二货机器人 2021-02-19 17:09:28 +08:00 committed by GitHub
commit 272a944949
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 934 additions and 20 deletions

4
.github/FUNDING.yml vendored
View File

@ -2,8 +2,4 @@
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
open_collective: ant-design open_collective: ant-design
patreon: ant_design
ko_fi: # Replace with a single Ko-fi username
issuehunt: ant-design/ant-design issuehunt: ant-design/ant-design
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: https://www.buymeacoffee.com/antdesign

View File

@ -1,7 +0,0 @@
# Configuration for weekly-digest - https://github.com/apps/weekly-digest
publishDay: sun
canPublishIssues: true
canPublishPullRequests: true
canPublishContributors: true
canPublishStargazers: true
canPublishCommits: true

18
.github/workflows/compressed-size.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: 📦 Compressed Size
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v2
- uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
pattern: "./dist/**/*.min.{js,css}"
build-script: "dist:esbuild"

63
.github/workflows/issue-reply.yml vendored Normal file
View File

@ -0,0 +1,63 @@
# Origin Source
# https://github.com/ant-design/ant-design/blob/79f566b7f8abb1012ef55b0d2793bfdf5595b85d/.github/workflows/issue-reply.yml
name: Issue Reply
on:
issues:
types: [labeled]
jobs:
reply-helper:
runs-on: ubuntu-latest
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome to [send us a Pull Request](https://help.github.com/en/articles/creating-a-pull-request) for it. Please send your Pull Request to proper branch (feature branch for the new feature, master for bugfix and other changes), fill the [Pull Request Template](https://github.com/ant-design/ant-design/blob/master/.github/PULL_REQUEST_TEMPLATE.md) here, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
你好 @${{ github.event.issue.user.login }},我们完全同意你的提议/反馈,欢迎直接在此仓库 [创建一个 Pull Request](https://help.github.com/en/articles/creating-a-pull-request) 来解决这个问题。请将 Pull Request 发到正确的分支(新特性发到 feature 分支,其他发到 master 分支),务必填写 Pull Request 内的[预设模板](https://github.com/ant-design/ant-design/blob/master/.github/PULL_REQUEST_TEMPLATE.md),提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review提前感谢和期待您的贡献。
![giphy](https://user-images.githubusercontent.com/507615/62342668-4735dc00-b51a-11e9-92a7-d46fbb1cc0c7.gif)
- name: 🤔 Need Reproduce
if: github.event.label.name == '🤔 Need Reproduce'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro or a minimal GitHub repository. Issues labeled by `Need Reproduce` will be closed if no activities in 3 days.
你好 @${{ github.event.issue.user.login }}, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 [此处](https://u.ant.design/codesandbox-repro) 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。
![](https://gw.alipayobjects.com/zos/antfincdn/y9kwg7DVCd/reproduce.gif)
- name: Usage
if: github.event.label.name == 'Usage' || github.event.label.name == 'Question'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment,close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}, we use GitHub issues to trace bugs or discuss plans of Ant Design. So, please [don't ask usage questions](https://github.com/ant-design/ant-design/issues/2320) here. You can try to open a new discussion in [antd discussions](https://github.com/ant-design/ant-design/discussions), select `Q&A` to ask questions, also can ask questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/antd) or [Segment Fault](https://segmentfault.com/t/antd), then apply tag `antd` and `react` to your question.
你好 @${{ github.event.issue.user.login }}Ant Design Issue 板块是用于 bug 反馈与需求讨论的地方。请[勿询问如何使用的问题](https://github.com/ant-design/ant-design/issues/2320),你可以试着在 [antd discussions](https://github.com/ant-design/ant-design/discussions) 新开一个 discussion选择 `Q&A` 类别进行提问,也可以在 [Stack Overflow](http://stackoverflow.com/questions/tagged/antd) 或者 [Segment Fault](https://segmentfault.com/t/antd) 中提问(记得添加 `antd` 和 `react` 标签哦~)。
- name: 3.x
if: github.event.label.name == '3.x'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment,close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hi @${{ github.event.issue.user.login }}. Current version (3.x) is off the maintenance period. We may not accept pull request or fix bug with it anymore. This topic will be auto closed.
你好 @${{ github.event.issue.user.login }}当前版本3.x已经过了维护期。我们不会再接受对其的相关 PR 与 issue。当前 topic 会被自动关闭。

20
.github/workflows/pr-refuse.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: PR Refuse
on:
pull_request_target:
types: [opened, edited]
jobs:
refuse:
runs-on: ubuntu-latest
steps:
- uses: actions-cool/pr-welcome@v1.1.1
with:
refuse-issue-label: '🎱 Collaborate PR only'
need-creator-authority: 'write'
comment: |
Hi @${{ github.event.pull_request.user.login }}. The issue mentioned in this PR needs to be confirmed with the designer or core team. This PR is temporarily not accepted. Thank you again for your contribution! 😊
你好 @${{ github.event.pull_request.user.login }}。这个 PR 提及的 issue 需要和设计师或核心团队进行确认,暂时不接受 PR再次感谢你的贡献😊
pr-emoji: 'heart'
close: true

83
.github/workflows/preview-build.yml vendored Normal file
View File

@ -0,0 +1,83 @@
# Each PR will build preview site that help to check code is work as expect.
name: Preview Build
on: pull_request
jobs:
# Prepare node modules. Reuse cache if available
setup:
name: prepare preview
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: cache package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: create package-lock.json
run: npm i --package-lock-only
- name: hack for single file
run: |
if [ ! -d "package-temp-dir" ]; then
mkdir package-temp-dir
fi
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci
build-site:
name: build preview
runs-on: ubuntu-latest
needs: setup
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: npm run site
id: site
run: npm run site
- name: upload site artifact
uses: actions/upload-artifact@v2
with:
name: site
path: _site/
retention-days: 5
# Upload PR id for next workflow use
- name: Save PR number
if: ${{ always() }}
run: echo ${{ github.event.number }} > ./pr-id.txt
- name: Upload PR number
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: pr
path: ./pr-id.txt

93
.github/workflows/preview-deploy.yml vendored Normal file
View File

@ -0,0 +1,93 @@
# Each PR will build preview site that help to check code is work as expect.
name: Preview Deploy
on:
workflow_run:
workflows: ["Preview Build"]
types:
- completed
jobs:
deploy-site:
name: deploy preview
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
# We need get PR id first
- name: download pr artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pr
# Save PR id to output
- name: save PR id
id: pr
run: echo "::set-output name=id::$(<pr-id.txt)"
# Download site artifact
- name: download site artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: site
- name: upload surge service
id: deploy
run: |
export DEPLOY_DOMAIN=https://preview-${{ steps.pr.outputs.id }}-ant-design.surge.sh
npx surge --project ./ --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
- name: update status comment
uses: actions-cool/maintain-one-comment@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
[<img width="306" src="https://user-images.githubusercontent.com/5378891/72400743-23dbb200-3785-11ea-9d13-1a2d92743846.png">](https://preview-${{ steps.pr.outputs.id }}-ant-design.surge.sh)
<!-- AUTO_PREVIEW_HOOK -->
body-include: '<!-- AUTO_PREVIEW_HOOK -->'
number: ${{ steps.pr.outputs.id }}
- name: The job has failed
if: ${{ failure() }}
uses: actions-cool/maintain-one-comment@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
<img width="534" src="https://user-images.githubusercontent.com/5378891/75333447-1e63a280-58c1-11ea-975d-235367fd1522.png">
<!-- AUTO_PREVIEW_HOOK -->
body-include: '<!-- AUTO_PREVIEW_HOOK -->'
number: ${{ steps.pr.outputs.id }}
build-site-failed:
name: build preview failed
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
# We need get PR id first
- name: download pr artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pr
# Save PR id to output
- name: save PR id
id: pr
run: echo "::set-output name=id::$(<pr-id.txt)"
- name: The job has failed
uses: actions-cool/maintain-one-comment@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
<img width="534" src="https://user-images.githubusercontent.com/5378891/75333447-1e63a280-58c1-11ea-975d-235367fd1522.png">
<!-- AUTO_PREVIEW_HOOK -->
body-include: '<!-- AUTO_PREVIEW_HOOK -->'
number: ${{ steps.pr.outputs.id }}

23
.github/workflows/preview-start.yml vendored Normal file
View File

@ -0,0 +1,23 @@
# When `preview-build` start. Leave a message on the PR
#
# 🚨🚨🚨 Important 🚨🚨🚨
# Never do any `checkout` or `npm install` action!
# `pull_request_target` will enable PR to access the secrets!
name: Preview Start
on: pull_request_target
jobs:
preview-start:
name: start preview info
runs-on: ubuntu-latest
steps:
- name: update status comment
uses: actions-cool/maintain-one-comment@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
![Prepare preview](https://user-images.githubusercontent.com/5378891/72351368-2c979e00-371b-11ea-9652-eb4e825d745e.gif)
<!-- AUTO_PREVIEW_HOOK -->
body-include: '<!-- AUTO_PREVIEW_HOOK -->'

456
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,456 @@
# Origin Source
# https://github.com/ant-design/ant-design/blob/79f566b7f8abb1012ef55b0d2793bfdf5595b85d/.github/workflows/test.yml
name: ✅ test
on: [push, pull_request]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: cache package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: create package-lock.json
run: npm i --package-lock-only
- name: hack for single file
run: |
if [ ! -d "package-temp-dir" ]; then
mkdir package-temp-dir
fi
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci
compile:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: cache lib
uses: actions/cache@v2
with:
path: lib
key: lib-${{ github.sha }}
- name: cache es
uses: actions/cache@v2
with:
path: es
key: es-${{ github.sha }}
- name: compile
run: npm run compile
- name: check
run: node ./tests/dekko/lib.test.js
needs: setup
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: lint
run: npm run lint
needs: setup
tsx-demo:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: tsx-demo
run: npm run check-ts-demo
needs: setup
check_metadata:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: check demo
run: node ./scripts/check-demo.js
needs: setup
react-17-dom:
name: react@17.x / dom
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: test
run: npm test -- -w 1 --coverage
- name: coverage
run: bash <(curl -s https://codecov.io/bash)
needs: setup
react-17-node:
name: react@17.x / node
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: test
run: npm run test-node
needs: setup
react-17-lib:
name: react@17.x / lib
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: restore cache from lib
uses: actions/cache@v2
with:
path: lib
key: lib-${{ github.sha }}
- name: test
run: npm test
env:
LIB_DIR: lib
needs: compile
react-17-es:
name: react@17.x / es
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: restore cache from es
uses: actions/cache@v2
with:
path: es
key: es-${{ github.sha }}
- name: test
run: npm test
env:
LIB_DIR: es
needs: compile
react-17-dist:
name: react@17.x / dist
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: dist
run: npm run dist
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: check
run: node ./tests/dekko/dist.test.js
- name: bundlesize
run: npm run bundlesize
env:
BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }}
- name: test
run: npm test
env:
LIB_DIR: dist
needs: setup
react-16-dom:
name: react@16.x / dom
runs-on: ubuntu-latest
env:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: install react 16
run: npm run install-react-16
- name: test
run: npm test -- -w 1 --coverage
needs: setup
react-16-node:
name: react@16.x / node
runs-on: ubuntu-latest
env:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: install react 16
run: npm run install-react-16
- name: test
run: npm run test-node
needs: setup
react-16-lib:
name: react@16.x / lib
runs-on: ubuntu-latest
env:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: restore cache from lib
uses: actions/cache@v2
with:
path: lib
key: lib-${{ github.sha }}
- name: install react 16
run: npm run install-react-16
- name: test
run: npm test
env:
LIB_DIR: lib
needs: compile
react-16-es:
name: react@16.x / es
runs-on: ubuntu-latest
env:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: restore cache from es
uses: actions/cache@v2
with:
path: es
key: es-${{ github.sha }}
- name: install react 16
run: npm run install-react-16
- name: test
run: npm test
env:
LIB_DIR: es
needs: compile
react-16-dist:
name: react@16.x / dist
runs-on: ubuntu-latest
env:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: install react 16
run: npm run install-react-16
- name: dist
run: npm run dist
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: check
run: node ./tests/dekko/dist.test.js
- name: test
run: npm test
env:
LIB_DIR: dist
needs: setup

48
.github/workflows/ui-upload.yml vendored Normal file
View File

@ -0,0 +1,48 @@
# Upload 📷 UI snapshots to argos server, help visual regression testing.
name: UI Upload
on:
workflow_run:
workflows: ["📷 UI"]
types:
- completed
jobs:
upload-ui:
name: deploy preview
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success'
steps:
- 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:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: snapshots
- name: Upload argos-ci
id: deploy
run: |
npx argos-cli upload ./ --token ${{ secrets.ARGOS_TOKEN }} --branch ${{ steps.branch.outputs.id }} --commit ${{ steps.commit.outputs.id }}

57
.github/workflows/ui.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: 📷 UI
on:
pull_request:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: install
run: npm install
- name: test
run: npm run test-image
- name: upload snapshots artifact
uses: actions/upload-artifact@v2
with:
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@v2
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@v2
with:
name: branch
path: ./branch.txt

View File

@ -0,0 +1,19 @@
name: Verify Files modify
on:
pull_request_target:
types: [opened, edited, reopened, synchronize, ready_for_review]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: verify-version
uses: actions-cool/verify-files-modify@v1.1.0
with:
forbid-paths: '.github/, scripts/'
skip-verify-authority: 'write'
assignees: 'afc163, zombieJ, yesmeck, shaodahong, xrkffgg'
comment: |
Hi @${{ github.event.pull_request.user.login }}. Thanks for your contribution. The path `.github/` or `scripts/` is only maintained by team members. This current PR will be closed and team members will help on this.
close: true

View File

@ -0,0 +1,18 @@
name: Verify Package Version
on:
pull_request:
types: [opened, edited, reopened, synchronize, ready_for_review]
jobs:
verify:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.title, 'changelog') || contains(github.event.pull_request.title, 'release')
steps:
- uses: actions/checkout@v2
- name: verify-version
uses: actions-cool/verify-package-version@v1.1.1
with:
title-include-content: 'docs'
title-include-version: true
open-comment: true

View File

@ -4,6 +4,7 @@ import Dropdown from '..';
import Menu from '../../menu'; import Menu from '../../menu';
import mountTest from '../../../tests/shared/mountTest'; import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest'; import rtlTest from '../../../tests/shared/rtlTest';
import { sleep } from '../../../tests/utils';
describe('Dropdown', () => { describe('Dropdown', () => {
mountTest(() => ( mountTest(() => (
@ -35,4 +36,27 @@ describe('Dropdown', () => {
); );
expect(wrapper).toMatchRenderedSnapshot(); expect(wrapper).toMatchRenderedSnapshot();
}); });
it('support Menu expandIcon', async () => {
const props = {
overlay: (
<Menu expandIcon={<span id="customExpandIcon" />}>
<Menu.Item>foo</Menu.Item>
<Menu.SubMenu title="SubMenu">
<Menu.Item>foo</Menu.Item>
</Menu.SubMenu>
</Menu>
),
visible: true,
getPopupContainer: node => node,
};
const wrapper = mount(
<Dropdown {...props}>
<button type="button">button</button>
</Dropdown>,
);
await sleep(500);
expect(wrapper.find(Dropdown).find('#customExpandIcon').length).toBe(1);
});
}); });

View File

@ -2,7 +2,6 @@ import * as React from 'react';
import RcDropdown from 'rc-dropdown'; import RcDropdown from 'rc-dropdown';
import classNames from 'classnames'; import classNames from 'classnames';
import RightOutlined from '@ant-design/icons/RightOutlined'; import RightOutlined from '@ant-design/icons/RightOutlined';
import DropdownButton from './dropdown-button'; import DropdownButton from './dropdown-button';
import { ConfigContext } from '../config-provider'; import { ConfigContext } from '../config-provider';
import devWarning from '../_util/devWarning'; import devWarning from '../_util/devWarning';
@ -17,6 +16,7 @@ const Placements = tuple(
'bottomCenter', 'bottomCenter',
'bottomRight', 'bottomRight',
); );
type Placement = typeof Placements[number]; type Placement = typeof Placements[number];
type OverlayFunc = () => React.ReactElement; type OverlayFunc = () => React.ReactElement;
@ -102,9 +102,12 @@ const Dropdown: DropdownInterface = props => {
// menu cannot be selectable in dropdown defaultly // menu cannot be selectable in dropdown defaultly
// menu should be focusable in dropdown defaultly // menu should be focusable in dropdown defaultly
const { selectable = false, focusable = true } = overlayProps; const { selectable = false, focusable = true, expandIcon } = overlayProps;
const expandIcon = ( const overlayNodeExpandIcon =
typeof expandIcon !== 'undefined' && React.isValidElement(expandIcon) ? (
expandIcon
) : (
<span className={`${prefixCls}-menu-submenu-arrow`}> <span className={`${prefixCls}-menu-submenu-arrow`}>
<RightOutlined className={`${prefixCls}-menu-submenu-arrow-icon`} /> <RightOutlined className={`${prefixCls}-menu-submenu-arrow-icon`} />
</span> </span>
@ -117,7 +120,7 @@ const Dropdown: DropdownInterface = props => {
mode: 'vertical', mode: 'vertical',
selectable, selectable,
focusable, focusable,
expandIcon, expandIcon: overlayNodeExpandIcon,
}); });
return fixedModeOverlay as React.ReactElement; return fixedModeOverlay as React.ReactElement;

View File

@ -20,7 +20,7 @@ function ariaConvert(wrapper: CheerIO) {
const matches = new Map(); const matches = new Map();
function process(entry: CheerIOElement) { function process(entry: CheerIOElement) {
if (entry.type === 'text') { if (entry.type === 'text' || entry.type === 'comment') {
return; return;
} }
const { attribs, children } = entry; const { attribs, children } = entry;