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

Merge features #19206

Merged
merged 81 commits into from Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
577bc87
Add Table `tableLayout` prop
afc163 Jun 25, 2019
d2aeaab
default overflow-wrap break-word for all cell
afc163 Sep 3, 2019
7c180a7
:up: upgrade rc-table
afc163 Sep 3, 2019
02da860
:white_check_mark: fix table snapshot
afc163 Sep 3, 2019
d9f2c90
:zap: support column.ellipsis
afc163 Sep 3, 2019
499c46b
:white_check_mark: fix table snapshot and ci
afc163 Sep 3, 2019
580312b
:memo: Add descriptions for ellipsis demo
afc163 Sep 4, 2019
49a37d1
:hammer: remove useless default value of tableLayout
afc163 Sep 4, 2019
033f812
:up: upgrade rc-table
afc163 Sep 4, 2019
251ae17
:clapper: Add tableLyout and ellipsis in Table demo
afc163 Sep 4, 2019
2e59284
:memo: Improve Table doc about tableLayout
afc163 Sep 4, 2019
96a9583
:up: support Slider[reverse]
afc163 Sep 6, 2019
c9a8f69
:white_check_mark: fix slider snapshot
afc163 Sep 6, 2019
b93d10d
feat(Anchor): add onChange prop (#18715)
shaodahong Sep 6, 2019
f8af697
Merge branch 'master' of github.com:ant-design/ant-design into feature
dengfuping Sep 6, 2019
f659d23
feat: upload add download icon (#18664)
qq645381995 Sep 11, 2019
5cd01d0
feat(Input.Search): add loading prop (#18771)
shaodahong Sep 12, 2019
632ba44
:bug: Fix Table cell word break style (#18789)
afc163 Sep 12, 2019
1200f7f
Merge branch 'feature' into master-to-merge
afc163 Sep 14, 2019
2128ee2
Merge pull request #18802 from ant-design/master-to-merge
afc163 Sep 14, 2019
db24346
:up: upgrade rc-upload to fix #17397 (#18850)
afc163 Sep 17, 2019
8846122
feat: Add visible to filterDropdown function (#17614)
sedx Sep 17, 2019
0f3f3dc
Merge pull request #18852 from ant-design/master
ycjcl868 Sep 17, 2019
721baa8
:refactor: remove unneccessary changes of #17614 (#18854)
afc163 Sep 17, 2019
17816b9
feat: upload should not be aborted until handleRemove is resolved as …
ladjzero Sep 23, 2019
9e9abfd
Merge branch 'feature' into master-for-merge
afc163 Sep 23, 2019
a5efb30
Merge pull request #18952 from ant-design/master-for-merge
afc163 Sep 23, 2019
a2edbc3
feat: Grid support row vertical gutter (#18979)
sosohime Sep 24, 2019
df7e366
:memo: Add recommendation for vedio components
afc163 Sep 23, 2019
e511e50
fix: TreeSelect removeIcon and clearIcon not working (#18949)
sosohime Sep 23, 2019
4cca77e
:bug: fix Tree switcherIcon prop not working when showLine
MrHeer Sep 16, 2019
fd31d91
:ok_hand: add use case
MrHeer Sep 16, 2019
05bf1ad
:lipstick: improve home page button style
afc163 Sep 23, 2019
b83f432
Delete publish-to-github-package.yml
orzyyyy Sep 23, 2019
d85f6c8
feat(actions): Automatic Rebase
orzyyyy Sep 23, 2019
0bc0a9d
:up: upgrade stylelint-config-prettier
afc163 Sep 24, 2019
61fc389
:wrench: update typescript definites of third libs
afc163 Sep 24, 2019
8179375
docs: fix API link
hsuanxyz Sep 24, 2019
0edbec1
:memo: Add recommendation for Visualization
afc163 Sep 24, 2019
5004a92
:memo: Add instruction for dropdownRender
afc163 Sep 24, 2019
efa8294
:white_check_mark: react-router@5.1 cannot work in React 15
afc163 Sep 25, 2019
a40b54a
:white_check_mark: update select test snapshot
afc163 Sep 25, 2019
53b3c5a
✨ support updating message content with a unique key
Sep 5, 2019
4a5b0e1
:sparkles: Flipping table to automatically scroll to the top
MrHeer Sep 8, 2019
90a77c0
:ok_hand: update README
MrHeer Sep 26, 2019
2c864b9
Add sortColumn to title render (#19012)
swillis12 Sep 26, 2019
0be5e33
refactor(Table): rename cWRP to UNSAFE_cWRP
kristofdombi Aug 13, 2019
1d5bd4a
fix(Table, SelectionCheckboxAll): add eslint comment
kristofdombi Aug 13, 2019
8bae8bf
refactor(Table): move createComponents outside of class, eliminate cWRP
kristofdombi Aug 14, 2019
8a60e19
fix(Table): rm commented line
kristofdombi Aug 14, 2019
948d0bd
fix(Table): move rowSelection logic to getDerivedStateFromProps
kristofdombi Aug 27, 2019
4cc5fcd
refactor(Table): move columns to state to set in getDerivedState
kristofdombi Aug 28, 2019
2228e91
refactor(Table): move filter updating to getDerivedStateFromProps
kristofdombi Aug 28, 2019
2875933
fix(Table): prevent reusing row from previous render
kristofdombi Sep 2, 2019
3274c55
refactor(Table): make row work like a class property
kristofdombi Sep 2, 2019
18017d6
fix(Table): correct lint errors
kristofdombi Sep 2, 2019
3f7b7de
:lipstick: improve code style
afc163 Sep 28, 2019
3acbc94
:hammer: react-lifecycles-compat for Table
afc163 Sep 28, 2019
bbc8800
:zap: optimize Table components compare logic
afc163 Sep 28, 2019
650d44e
:bug: fix React.createElement undefined
afc163 Sep 28, 2019
66ca4a8
:white_check_mark: more test cases
afc163 Sep 28, 2019
d41b5be
:white_check_mark: increase Table test coverage
afc163 Sep 28, 2019
e1a4f28
:bug: Fix Table filter submenu checkbox margin
afc163 Sep 28, 2019
fb913f4
:lipstick: fix lint
afc163 Sep 28, 2019
916c065
:white_check_mark: increase Table test coverage
afc163 Sep 28, 2019
dc0dfea
Merge pull request #19049 from ant-design/master
orzyyyy Sep 28, 2019
71b53b7
master to feature (#19062)
ikobe Sep 30, 2019
3ab6c48
chore: merge master to feature
orzyyyy Oct 5, 2019
54cf1a9
fix: lint
orzyyyy Oct 5, 2019
c4283e4
test: update snapshots for rc-upload bump to 2.8.0
orzyyyy Oct 5, 2019
391aab4
Merge pull request #19103 from ant-design/merge-to-feature
afc163 Oct 6, 2019
95710af
feat(Layout): add prop specialTriggerStyle to controll the style of z…
orzyyyy Oct 2, 2019
5e4697e
test: update cases
orzyyyy Oct 2, 2019
4a29aaa
docs: update
orzyyyy Oct 2, 2019
718a86d
chore: rename prop specialTriggerStyle to zeroWidthTriggerStyle
orzyyyy Oct 6, 2019
a877db7
:sparkles: Add `drawerStyle` and `headerStyle`
afc163 Oct 7, 2019
b41bdb0
fix: update rc-slider handle move exception
shaodahong Oct 8, 2019
04a27de
merge master
zombieJ Oct 14, 2019
8bb4613
Merge pull request #19202 from ant-design/master
zombieJ Oct 14, 2019
e75fa03
refactor: Use CSSMotion (#19205)
zombieJ Oct 14, 2019
338018e
feat: Pageheader new style and props (#19100)
chenshuai2144 Oct 15, 2019
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
25 changes: 18 additions & 7 deletions components/anchor/Anchor.tsx
Expand Up @@ -62,6 +62,8 @@ export interface AnchorProps {
) => void;
/** Scroll to target offset value, if none, it's offsetTop prop value or 0. */
targetOffset?: number;
/** Listening event when scrolling change active link */
onChange?: (currentActiveLink: string) => void;
}

export interface AnchorState {
Expand Down Expand Up @@ -205,7 +207,7 @@ export default class Anchor extends React.Component<AnchorProps, AnchorState> {
handleScrollTo = (link: string) => {
const { offsetTop, getContainer, targetOffset } = this.props as AnchorDefaultProps;

this.setState({ activeLink: link });
this.setCurrentActiveLink(link);
const container = getContainer();
const scrollTop = getScroll(container, true);
const sharpLinkMatch = sharpMatcherRegx.exec(link);
Expand Down Expand Up @@ -234,21 +236,30 @@ export default class Anchor extends React.Component<AnchorProps, AnchorState> {
this.inkNode = node;
};

setCurrentActiveLink = (link: string) => {
const { activeLink } = this.state;
const { onChange } = this.props;

if (activeLink !== link) {
this.setState({
activeLink: link,
});
if (onChange) {
onChange(link);
}
}
};

handleScroll = () => {
if (this.animating) {
return;
}
const { activeLink } = this.state;
const { offsetTop, bounds, targetOffset } = this.props;
const currentActiveLink = this.getCurrentAnchor(
targetOffset !== undefined ? targetOffset : offsetTop || 0,
bounds,
);
if (activeLink !== currentActiveLink) {
this.setState({
activeLink: currentActiveLink,
});
}
this.setCurrentActiveLink(currentActiveLink);
};

updateInk = () => {
Expand Down
14 changes: 14 additions & 0 deletions components/anchor/__tests__/Anchor.test.js
Expand Up @@ -322,4 +322,18 @@ describe('Anchor Render', () => {
dateNowMock.mockRestore();
jest.useRealTimers();
});

it('Anchor onChange prop', async () => {
const onChange = jest.fn();
const wrapper = mount(
<Anchor onChange={onChange}>
<Link href="#API1" title="API1" />
<Link href="#API2" title="API2" />
</Anchor>,
);
expect(onChange).toHaveBeenCalledTimes(1);
wrapper.instance().handleScrollTo('#API2');
expect(onChange).toHaveBeenCalledTimes(2);
expect(onChange).toHaveBeenCalledWith('#API2');
});
});
74 changes: 74 additions & 0 deletions components/anchor/__tests__/__snapshots__/demo.test.js.snap
Expand Up @@ -166,6 +166,80 @@ exports[`renders ./components/anchor/demo/customizeHighlight.md correctly 1`] =
</div>
`;

exports[`renders ./components/anchor/demo/onChange.md correctly 1`] = `
<div
class="ant-anchor-wrapper"
style="max-height:100vh"
>
<div
class="ant-anchor fixed"
>
<div
class="ant-anchor-ink"
>
<span
class="ant-anchor-ink-ball"
/>
</div>
<div
class="ant-anchor-link"
>
<a
class="ant-anchor-link-title"
href="#components-anchor-demo-basic"
title="Basic demo"
>
Basic demo
</a>
</div>
<div
class="ant-anchor-link"
>
<a
class="ant-anchor-link-title"
href="#components-anchor-demo-static"
title="Static demo"
>
Static demo
</a>
</div>
<div
class="ant-anchor-link"
>
<a
class="ant-anchor-link-title"
href="#API"
title="API"
>
API
</a>
<div
class="ant-anchor-link"
>
<a
class="ant-anchor-link-title"
href="#Anchor-Props"
title="Anchor Props"
>
Anchor Props
</a>
</div>
<div
class="ant-anchor-link"
>
<a
class="ant-anchor-link-title"
href="#Link-Props"
title="Link Props"
>
Link Props
</a>
</div>
</div>
</div>
</div>
`;

exports[`renders ./components/anchor/demo/onClick.md correctly 1`] = `
<div
class="ant-anchor-wrapper"
Expand Down
36 changes: 36 additions & 0 deletions components/anchor/demo/onChange.md
@@ -0,0 +1,36 @@
---
order: 6
title:
zh-CN: 监听锚点链接改变
en-US: Listening for anchor link change
---

## zh-CN

监听锚点链接改变

## en-US

Listening for anchor link change.

```jsx
import { Anchor } from 'antd';

const { Link } = Anchor;

const onChange = link => {
console.log('Anchor:OnChange', link);
};

ReactDOM.render(
<Anchor affix={false} onChange={onChange}>
<Link href="#components-anchor-demo-basic" title="Basic demo" />
<Link href="#components-anchor-demo-static" title="Static demo" />
<Link href="#API" title="API">
<Link href="#Anchor-Props" title="Anchor Props" />
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>,
mountNode,
);
```
2 changes: 1 addition & 1 deletion components/anchor/demo/targetOffset.md
@@ -1,5 +1,5 @@
---
order: 4
order: 5
title:
zh-CN: 设置锚点滚动偏移量
en-US: Set Anchor scroll offset
Expand Down
1 change: 1 addition & 0 deletions components/anchor/index.en-US.md
Expand Up @@ -26,6 +26,7 @@ For displaying anchor hyperlinks on page and jumping between them.
| onClick | set the handler to handle `click` event | Function(e: Event, link: Object) | - | 3.9.0 |
| getCurrentAnchor | Customize the anchor highlight | () => string | - | 3.22.0 |
| targetOffset | Anchor scroll offset, default as `offsetTop`, [example](#components-anchor-demo-targetOffset) | number | `offsetTop` | 3.22.0 |
| onChange | Listening for anchor link change | (currentActiveLink: string) => void | | 3.24.0 |

### Link Props

Expand Down
1 change: 1 addition & 0 deletions components/anchor/index.zh-CN.md
Expand Up @@ -27,6 +27,7 @@ title: Anchor
| onClick | `click` 事件的 handler | Function(e: Event, link: Object) | - | 3.9.0 |
| getCurrentAnchor | 自定义高亮的锚点 | () => string | - | 3.22.0 |
| targetOffset | 锚点滚动偏移量,默认与 offsetTop 相同,[例子](#components-anchor-demo-targetOffset) | number | `offsetTop` | 3.22.0 |
| onChange | 监听锚点链接改变 | (currentActiveLink: string) => void | | 3.24.0 |

### Link Props

Expand Down