Skip to content

Commit

Permalink
Merge pull request ant-design#33163 from ant-design/master
Browse files Browse the repository at this point in the history
chore: merge master into feature
  • Loading branch information
xrkffgg authored Dec 5, 2021
2 parents 4cc0557 + 97fd6d5 commit a04a4ef
Show file tree
Hide file tree
Showing 76 changed files with 777 additions and 649 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name: Preview Build

on:
on:
pull_request:
types: [opened, synchronize, reopened]

Expand All @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: cache package-lock.json
uses: actions/cache@v2
Expand All @@ -22,7 +22,7 @@ jobs:
key: lock-${{ github.sha }}

- name: create package-lock.json
run: npm i --package-lock-only
run: npm i --package-lock-only --ignore-scripts

- name: hack for single file
run: |
Expand All @@ -47,7 +47,7 @@ jobs:
needs: setup
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Automatic Rebase

on:
on:
issue_comment:
types: [created]

Expand All @@ -10,7 +10,7 @@ jobs:
if: github.event.issue.pull_request != '' && (contains(github.event.comment.body, '/rebase') || contains(github.event.comment.body, '\rebase'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Automatic Rebase
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/site-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: github.event.ref_type == 'tag' && (contains(github.event.ref, '-') == false)
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: cache package-lock.json
uses: actions/cache@v2
Expand All @@ -19,7 +19,7 @@ jobs:
key: lock-${{ github.sha }}

- name: create package-lock.json
run: npm i --package-lock-only
run: npm i --package-lock-only --ignore-scripts

- name: hack for single file
run: |
Expand All @@ -43,7 +43,7 @@ jobs:
needs: setup
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: cache package-lock.json
uses: actions/cache@v2
Expand All @@ -18,7 +18,7 @@ jobs:
key: lock-${{ github.sha }}

- name: create package-lock.json
run: npm i --package-lock-only
run: npm i --package-lock-only --ignore-scripts

- name: hack for single file
run: |
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand All @@ -100,7 +100,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand All @@ -122,7 +122,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand All @@ -145,7 +145,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand All @@ -171,7 +171,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand All @@ -194,7 +194,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -296,7 +296,7 @@ jobs:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -324,7 +324,7 @@ jobs:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -352,7 +352,7 @@ jobs:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -388,7 +388,7 @@ jobs:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -424,7 +424,7 @@ jobs:
REACT: 16
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -460,7 +460,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- name: restore cache from package-lock.json
uses: actions/cache@v2
Expand Down Expand Up @@ -496,4 +496,4 @@ jobs:

- name: lessc mixins
run: npx lessc --js ./es/style/mixins/index.less
needs: setup
needs: setup
27 changes: 25 additions & 2 deletions .github/workflows/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@v2

- 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 --ignore-scripts

- 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
run: npm install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci

- name: test
run: npm run test-image
Expand Down
2 changes: 1 addition & 1 deletion README-pt_BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Uma solução empresarial de design e biblioteca UI para React.
[bundlesize-css-image]: https://img.badgesize.io/https:/unpkg.com/antd/dist/antd.min.css?label=antd.min.css&compression=gzip&style=flat-square
[unpkg-js-url]: https://unpkg.com/browse/antd/dist/antd.min.js
[unpkg-css-url]: https://unpkg.com/browse/antd/dist/antd.min.css
[issues-helper-image]: https://img.shields.io/badge/Issues%20Manage%20By-issues--helper-orange?style=flat-square
[issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square
[issues-helper-url]: https://github.com/actions-cool/issues-helper

</div>
Expand Down
2 changes: 1 addition & 1 deletion README-uk_UA.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
[bundlesize-css-image]: https://img.badgesize.io/https:/unpkg.com/antd/dist/antd.min.css?label=antd.min.css&compression=gzip&style=flat-square
[unpkg-js-url]: https://unpkg.com/browse/antd/dist/antd.min.js
[unpkg-css-url]: https://unpkg.com/browse/antd/dist/antd.min.css
[issues-helper-image]: https://img.shields.io/badge/Issues%20Manage%20By-issues--helper-orange?style=flat-square
[issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square
[issues-helper-url]: https://github.com/actions-cool/issues-helper

</div>
Expand Down
2 changes: 1 addition & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
[bundlesize-css-image]: https://img.badgesize.io/https:/unpkg.com/antd/dist/antd.min.css?label=antd.min.css&compression=gzip&style=flat-square
[unpkg-js-url]: https://unpkg.com/browse/antd/dist/antd.min.js
[unpkg-css-url]: https://unpkg.com/browse/antd/dist/antd.min.css
[issues-helper-image]: https://img.shields.io/badge/Issues%20Manage%20By-issues--helper-orange?style=flat-square
[issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square
[issues-helper-url]: https://github.com/actions-cool/issues-helper

</div>
Expand Down
2 changes: 2 additions & 0 deletions components/affix/__tests__/Affix.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Affix, { AffixProps, AffixState } from '..';
import { getObserverEntities } from '../utils';
import Button from '../../button';
import rtlTest from '../../../tests/shared/rtlTest';
import accessibilityTest from '../../../tests/shared/accessibilityTest';
import { sleep } from '../../../tests/utils';

const events: Partial<Record<keyof HTMLElementEventMap, (ev: Partial<Event>) => void>> = {};
Expand Down Expand Up @@ -53,6 +54,7 @@ class AffixMounter extends React.Component<{

describe('Affix Render', () => {
rtlTest(Affix);
accessibilityTest(Affix);

const domMock = jest.spyOn(HTMLElement.prototype, 'getBoundingClientRect');
let affixMounterWrapper: ReactWrapper<unknown, unknown, AffixMounter>;
Expand Down
13 changes: 3 additions & 10 deletions components/affix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ class Affix extends React.Component<AffixProps, AffixState> {
componentDidUpdate(prevProps: AffixProps) {
const { prevTarget } = this.state;
const targetFunc = this.getTargetFunc();
let newTarget = null;
if (targetFunc) {
newTarget = targetFunc() || null;
}
const newTarget = targetFunc?.() || null;

if (prevTarget !== newTarget) {
removeObserveTarget(this);
Expand Down Expand Up @@ -128,12 +125,8 @@ class Affix extends React.Component<AffixProps, AffixState> {
}

getOffsetTop = () => {
const { offsetBottom } = this.props;
let { offsetTop } = this.props;
if (offsetBottom === undefined && offsetTop === undefined) {
offsetTop = 0;
}
return offsetTop;
const { offsetBottom, offsetTop } = this.props;
return (offsetBottom === undefined && offsetTop === undefined) ? 0 : offsetTop;
};

getOffsetBottom = () => this.props.offsetBottom;
Expand Down
Loading

0 comments on commit a04a4ef

Please sign in to comment.