1 | import * as React from 'react';
|
2 | import AnchorLink from './AnchorLink';
|
3 | import { ConfigConsumerProps } from '../config-provider';
|
4 | export declare type AnchorContainer = HTMLElement | Window;
|
5 | export interface AnchorProps {
|
6 | prefixCls?: string;
|
7 | className?: string;
|
8 | style?: React.CSSProperties;
|
9 | children?: React.ReactNode;
|
10 | offsetTop?: number;
|
11 | bounds?: number;
|
12 | affix?: boolean;
|
13 | showInkInFixed?: boolean;
|
14 | getContainer?: () => AnchorContainer;
|
15 |
|
16 | getCurrentAnchor?: () => string;
|
17 | onClick?: (e: React.MouseEvent<HTMLElement>, link: {
|
18 | title: React.ReactNode;
|
19 | href: string;
|
20 | }) => void;
|
21 |
|
22 | targetOffset?: number;
|
23 |
|
24 | onChange?: (currentActiveLink: string) => void;
|
25 | }
|
26 | export interface AnchorState {
|
27 | activeLink: null | string;
|
28 | }
|
29 | export interface AnchorDefaultProps extends AnchorProps {
|
30 | prefixCls: string;
|
31 | affix: boolean;
|
32 | showInkInFixed: boolean;
|
33 | getContainer: () => AnchorContainer;
|
34 | }
|
35 | export interface AntAnchor {
|
36 | registerLink: (link: string) => void;
|
37 | unregisterLink: (link: string) => void;
|
38 | activeLink: string | null;
|
39 | scrollTo: (link: string) => void;
|
40 | onClick?: (e: React.MouseEvent<HTMLElement>, link: {
|
41 | title: React.ReactNode;
|
42 | href: string;
|
43 | }) => void;
|
44 | }
|
45 | export default class Anchor extends React.Component<AnchorProps, AnchorState, ConfigConsumerProps> {
|
46 | static Link: typeof AnchorLink;
|
47 | static defaultProps: {
|
48 | affix: boolean;
|
49 | showInkInFixed: boolean;
|
50 | };
|
51 | static contextType: React.Context<ConfigConsumerProps>;
|
52 | state: {
|
53 | activeLink: null;
|
54 | };
|
55 | content: ConfigConsumerProps;
|
56 | private wrapperRef;
|
57 | private inkNode;
|
58 | private scrollContainer;
|
59 | private links;
|
60 | private scrollEvent;
|
61 | private animating;
|
62 | private prefixCls?;
|
63 | registerLink: (link: string) => void;
|
64 | unregisterLink: (link: string) => void;
|
65 | getContainer: () => any;
|
66 | componentDidMount(): void;
|
67 | componentDidUpdate(): void;
|
68 | componentWillUnmount(): void;
|
69 | getCurrentAnchor(offsetTop?: number, bounds?: number): string;
|
70 | handleScrollTo: (link: string) => void;
|
71 | saveInkNode: (node: HTMLSpanElement) => void;
|
72 | setCurrentActiveLink: (link: string) => void;
|
73 | handleScroll: () => void;
|
74 | updateInk: () => void;
|
75 | render: () => JSX.Element;
|
76 | }
|